fix: harden resume and SSE replay

This commit is contained in:
User
2026-07-15 00:06:00 +02:00
parent e5366d14a6
commit 2b4797f133
18 changed files with 871 additions and 102 deletions
+4 -2
View File
@@ -13,7 +13,7 @@ export type ClientEvent =
| { type: "activity_delta"; text: string }
| { type: "activity_event"; activity: ToolActivity }
| { type: "info"; [k: string]: any }
| { type: "system_event"; [k: string]: any };
| { type: "system_event"; event: string };
export type TurnState = "idle" | "running" | "waiting" | "failed";
@@ -61,7 +61,9 @@ export class SessionBridge {
this.emitToolActivity(m, "end");
// Tool updates and raw payloads remain intentionally dropped.
} else if (m.type === "system_event") {
this.fan(m as ClientEvent);
if (typeof m.event === "string" && m.event.trim() !== "") {
this.fan({ type: "system_event", event: m.event });
}
} else if (m.type === "agent_end") {
if (this.state !== "failed" && !this.pending) this.state = "idle";
this.fan({ type: "system_event", event: "agent_end" });