From dcbc51e22dcd3d7b5a01d6c3b7b0285efa49bca4 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Fri, 29 May 2026 18:45:45 +0900 Subject: feat: stop generation button with abort signal plumbing - Add POST /chat/stop endpoint on API - Thread abortSignal from agent-manager through Agent.run() to streamText - Thread abortSignal option through the Agent.run() signature - Emit status:idle on stopTab() so frontend WS gets the update - Add stopGeneration() store method on frontend tabStore - Add stop button in ChatInput (btn-sm lg:btn-xs for mobile tap target) - Add tests for /chat/stop endpoint - Refactor processMessage to pass abortSignal to agent.run --- packages/core/src/agent/agent.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'packages/core/src/agent') diff --git a/packages/core/src/agent/agent.ts b/packages/core/src/agent/agent.ts index 4eace0c..82b98df 100644 --- a/packages/core/src/agent/agent.ts +++ b/packages/core/src/agent/agent.ts @@ -673,7 +673,10 @@ export class Agent { async *run( userMessage: string, - options?: { reasoningEffort?: "none" | "low" | "medium" | "high" | "max" }, + options?: { + reasoningEffort?: "none" | "low" | "medium" | "high" | "max"; + abortSignal?: AbortSignal; + }, ): AsyncGenerator { this.status = "running"; yield { type: "status", status: "running" }; @@ -779,6 +782,7 @@ export class Agent { model, messages: coreMessages, tools, + abortSignal: options?.abortSignal, }; // Encourage tool use on Anthropic. Without an explicit -- cgit v1.2.3