fix: restore model activity reasoning stream

This commit is contained in:
User
2026-07-14 15:03:07 +02:00
parent 1b1554b353
commit c7474f3852
11 changed files with 490 additions and 14 deletions
+9
View File
@@ -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.