fix: restore model activity reasoning stream
This commit is contained in:
@@ -9,6 +9,7 @@ interface Entry {
|
||||
interface SessionState {
|
||||
pendingWidget: WidgetDescriptor | null;
|
||||
transcript: Entry[];
|
||||
activity: Entry[];
|
||||
toasts: { level: string; text: string }[];
|
||||
stepMessages: { level: string; text: string }[];
|
||||
lastUserEntry: { kind: "input" | "choice"; text: string } | null;
|
||||
@@ -31,6 +32,7 @@ interface SessionState {
|
||||
const empty = {
|
||||
pendingWidget: null,
|
||||
transcript: [] as Entry[],
|
||||
activity: [] as Entry[],
|
||||
toasts: [] as { level: string; text: string }[],
|
||||
stepMessages: [] as { level: string; text: string }[],
|
||||
lastUserEntry: null as { kind: "input" | "choice"; text: string } | null,
|
||||
@@ -63,6 +65,13 @@ export const useSessionStore = create<SessionState>((set) => ({
|
||||
// Streamed text means the turn is alive (also covers reattaching mid-turn).
|
||||
return { transcript: t, agentActive: true };
|
||||
}
|
||||
if (e.type === "activity_delta") {
|
||||
const activity = [...st.activity];
|
||||
const last = activity.at(-1);
|
||||
if (last) activity[activity.length - 1] = { role: "assistant", text: last.text + e.text };
|
||||
else activity.push({ role: "assistant", text: e.text });
|
||||
return { activity, agentActive: true };
|
||||
}
|
||||
if (e.type === "info") {
|
||||
const stepMessages = [...st.stepMessages, { level: e.level ?? "info", text: e.text }];
|
||||
// An error during the active phase marks that phase red until the next gate.
|
||||
|
||||
Reference in New Issue
Block a user