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
+12
View File
@@ -746,6 +746,18 @@ func (m *chatManager) Shells(ctx context.Context, sessionID string) ([]protocol.
return nil, nil
}
func (m *chatManager) StopTasks(ctx context.Context, sessionID string) (int, error) {
adapter, err := m.brokerFor(ctx, sessionID)
if err != nil {
return 0, err
}
stopper, ok := adapter.(chatTaskStopper)
if !ok {
return 0, errors.New("this chat backend cannot stop background tasks separately")
}
return stopper.StopTasks(ctx, sessionID)
}
func (m *chatManager) Reply(ctx context.Context, request protocol.ChatReplyRequest) error {
adapter, err := m.brokerFor(ctx, request.SessionID)
if err != nil {