story-kit: merge 149_bug_web_ui_does_not_update_when_agents_are_started_or_stopped

This commit is contained in:
Dave
2026-02-24 23:09:13 +00:00
parent 51303c07d8
commit dc631d1933
8 changed files with 187 additions and 108 deletions

View File

@@ -61,6 +61,8 @@ export type WsResponse =
}
/** `.story_kit/project.toml` was modified; re-fetch the agent roster. */
| { type: "agent_config_changed" }
/** An agent started, stopped, or changed state; re-fetch agent list. */
| { type: "agent_state_changed" }
| { type: "tool_activity"; tool_name: string }
/** Heartbeat response confirming the connection is alive. */
| { type: "pong" }
@@ -282,6 +284,7 @@ export class ChatWebSocket {
message: string,
) => void;
private onAgentConfigChanged?: () => void;
private onAgentStateChanged?: () => void;
private onOnboardingStatus?: (needsOnboarding: boolean) => void;
private connected = false;
private closeTimer?: number;
@@ -358,6 +361,7 @@ export class ChatWebSocket {
data.message,
);
if (data.type === "agent_config_changed") this.onAgentConfigChanged?.();
if (data.type === "agent_state_changed") this.onAgentStateChanged?.();
if (data.type === "onboarding_status")
this.onOnboardingStatus?.(data.needs_onboarding);
if (data.type === "pong") {
@@ -410,6 +414,7 @@ export class ChatWebSocket {
message: string,
) => void;
onAgentConfigChanged?: () => void;
onAgentStateChanged?: () => void;
onOnboardingStatus?: (needsOnboarding: boolean) => void;
},
wsPath = DEFAULT_WS_PATH,
@@ -423,6 +428,7 @@ export class ChatWebSocket {
this.onActivity = handlers.onActivity;
this.onReconciliationProgress = handlers.onReconciliationProgress;
this.onAgentConfigChanged = handlers.onAgentConfigChanged;
this.onAgentStateChanged = handlers.onAgentStateChanged;
this.onOnboardingStatus = handlers.onOnboardingStatus;
this.wsPath = wsPath;
this.shouldReconnect = true;