Stop background tasks separately from chat turns

Keep Esc and /stop scoped to the foreground turn while exposing an explicit stop-tasks operation for supported chat backends. Add the protocol, server routing, app command, and coverage for task stopping and unsupported harnesses.
This commit is contained in:
2026-11-13 16:47:41 +00:00
parent c3c2c1bbc9
commit 2a182d7f17
19 changed files with 331 additions and 2 deletions
+7
View File
@@ -49,6 +49,10 @@ type chatPromptWithMessageID interface {
PromptWithMessageID(context.Context, string, string, string) error
}
type chatTaskStopper interface {
StopTasks(context.Context, string) (int, error)
}
// chatPromptWithFiles is implemented by a broker that can hand local files to
// the agent with a prompt. The server writes browser attachment bytes to private
// temporary files first; a browser URI is not readable by the agent service.
@@ -195,6 +199,9 @@ func handleChat(ctx context.Context, request protocol.Message, broker chatBroker
case protocol.ChatInterrupt:
handleChatSimple(ctx, request, broker, hub, write)
return true
case protocol.ChatStopTasks:
handleChatStopTasks(ctx, request, broker, write)
return true
case protocol.ChatReply:
handleChatSimple(ctx, request, broker, hub, write)
return true