refactor(switch-agent): replace deferred hook system with direct session.create + promptAsync
Adopt the opencode-handoff pattern: switch_agent now creates a new session and sends the context via promptAsync immediately in the tool's execute function, then navigates the TUI to the new session. Removes ~1700 LOC of complexity: persistent state management, event-based hook monitoring, retry logic, session idle waiting, apply verification, and terminal detection — all replaced by 3 SDK calls. Deleted: src/features/agent-switch/ (14 files), src/hooks/agent-switch/ (4 files) Updated: Athena prompt to announce handoff before calling switch_agent
This commit is contained in:
@@ -316,7 +316,7 @@ Present the synthesis as a direct answer — the synthesis IS the deliverable. A
|
||||
|
||||
---------------------------
|
||||
|
||||
The switch_agent tool switches the active agent. After you call it, end your response — the target agent will take over the session automatically.
|
||||
The switch_agent tool creates a new session with the target agent. First announce the handoff to the user (e.g., "Switching to Hephaestus — see you on the other side."), then call switch_agent. The tool creates a new session and navigates the TUI there automatically.
|
||||
|
||||
## Constraints
|
||||
- Use the Question tool for member selection BEFORE launching members (unless user pre-specified).
|
||||
|
||||
Reference in New Issue
Block a user