(callID, action string)
| 1400 | } |
| 1401 | |
| 1402 | func (a *Agent) controlRunningTool(callID, action string) error { |
| 1403 | a.mu.RLock() |
| 1404 | handle, ok := a.runningTools[callID] |
| 1405 | a.mu.RUnlock() |
| 1406 | |
| 1407 | if !ok || handle == nil || handle.interruptible == nil { |
| 1408 | return errors.New("tool not interruptible or not running") |
| 1409 | } |
| 1410 | |
| 1411 | switch action { |
| 1412 | case "pause": |
| 1413 | return handle.interruptible.Pause() |
| 1414 | case "resume": |
| 1415 | return handle.interruptible.Resume() |
| 1416 | case "cancel": |
| 1417 | a.updateToolRecord(callID, types.ToolCallStateCancelling, "") |
| 1418 | return handle.interruptible.Cancel() |
| 1419 | default: |
| 1420 | return fmt.Errorf("unknown action: %s", action) |
| 1421 | } |
| 1422 | } |
| 1423 | |
| 1424 | func (a *Agent) snapshotToolCall(callID string) types.ToolCallSnapshot { |
| 1425 | a.mu.RLock() |
no test coverage detected