summaryrefslogtreecommitdiffhomepage
path: root/packages/api/src/app.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-05-29 18:45:45 +0900
committerAdam Malczewski <[email protected]>2026-05-29 18:45:45 +0900
commitdcbc51e22dcd3d7b5a01d6c3b7b0285efa49bca4 (patch)
tree72e1a635662ed20deaee1f0b01408a5954445b26 /packages/api/src/app.ts
parent5b3e1ac64681e233f35e1b4d2230d9988667c37e (diff)
downloaddispatch-dcbc51e22dcd3d7b5a01d6c3b7b0285efa49bca4.tar.gz
dispatch-dcbc51e22dcd3d7b5a01d6c3b7b0285efa49bca4.zip
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
Diffstat (limited to 'packages/api/src/app.ts')
-rw-r--r--packages/api/src/app.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/api/src/app.ts b/packages/api/src/app.ts
index ba5dabd..73d3de5 100644
--- a/packages/api/src/app.ts
+++ b/packages/api/src/app.ts
@@ -94,6 +94,15 @@ app.post("/chat/cancel", async (c) => {
return c.json({ success: cancelled });
});
+app.post("/chat/stop", async (c) => {
+ const body = await c.req.json();
+ if (typeof body.tabId !== "string") {
+ return c.json({ error: "tabId is required" }, 400);
+ }
+ agentManager.stopTab(body.tabId);
+ return c.json({ success: true });
+});
+
app.route("/skills", skillsRoutes);
app.route("/models", modelsRoutes);
app.route("/tabs", tabsRoutes);