story-kit: merge 86_story_show_live_activity_status_instead_of_static_thinking_indicator_in_chat

This commit is contained in:
Dave
2026-02-23 18:38:15 +00:00
parent da8ded460e
commit af1625a132
5 changed files with 54 additions and 4 deletions

View File

@@ -50,7 +50,8 @@ export type WsResponse =
request_id: string;
tool_name: string;
tool_input: Record<string, unknown>;
};
}
| { type: "tool_activity"; tool_name: string };
export interface ProviderConfig {
provider: string;
@@ -260,6 +261,7 @@ export class ChatWebSocket {
toolName: string,
toolInput: Record<string, unknown>,
) => void;
private onActivity?: (toolName: string) => void;
private connected = false;
private closeTimer?: number;
private wsPath = DEFAULT_WS_PATH;
@@ -302,6 +304,7 @@ export class ChatWebSocket {
data.tool_name,
data.tool_input,
);
if (data.type === "tool_activity") this.onActivity?.(data.tool_name);
} catch (err) {
this.onError?.(String(err));
}
@@ -341,6 +344,7 @@ export class ChatWebSocket {
toolName: string,
toolInput: Record<string, unknown>,
) => void;
onActivity?: (toolName: string) => void;
},
wsPath = DEFAULT_WS_PATH,
) {
@@ -350,6 +354,7 @@ export class ChatWebSocket {
this.onError = handlers.onError;
this.onPipelineState = handlers.onPipelineState;
this.onPermissionRequest = handlers.onPermissionRequest;
this.onActivity = handlers.onActivity;
this.wsPath = wsPath;
this.shouldReconnect = true;