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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user