ask_operator tool: non-blocking; operator answer arrives as helper event

new mcp tool on the manager surface that queues a question on the
dashboard and returns the question id immediately. operator submits an
answer via /answer-question/<id>; the dashboard fires
HelperEvent::OperatorAnswered { id, question, answer } into the manager
inbox so the next turn picks it up.

also: fix async-form button stuck on spinner after successful submit
(refreshState skipped re-rendering, so the button was never re-enabled).
This commit is contained in:
müde 2026-05-15 18:44:42 +02:00
parent abfd2cce4b
commit 2770630f33
17 changed files with 426 additions and 79 deletions

View file

@ -169,6 +169,10 @@ Manager additionally:
- `mcp__hyperhive__kill(name)` — graceful stop.
- `mcp__hyperhive__request_apply_commit(agent, commit_ref)` — submit a
config change for any agent (including `hm1nd` for self-mods).
- `mcp__hyperhive__ask_operator(question, options?)` — non-blocking;
queues a question on the dashboard, returns the question id. Operator's
answer arrives later as a `HelperEvent::OperatorAnswered` in the
manager inbox.
The shared per-turn plumbing lives in `hive_ag3nt::turn::{write_mcp_config,
write_settings, write_system_prompt, run_turn, drive_turn, emit_turn_end,
@ -274,9 +278,13 @@ manager itself now.
rubber-stamp sub-agent config requests. It verifies (role match, package
legitimacy, cheaper alternative, blast radius) before committing +
calling `request_apply_commit`. For ambiguous cases or anything that
needs human signal, the manager forwards the question to the operator
via `send(to: "operator", ...)` — a dedicated `mcp__hyperhive__ask_operator`
tool with proper pause/resume semantics is in [TODO.md](TODO.md).
needs human signal, the manager calls `ask_operator(question, options?)`
which queues the question on the dashboard and returns the id
immediately; the operator's answer arrives later as
`HelperEvent::OperatorAnswered` in the manager inbox. Store at
`hive-c0re::operator_questions` (sqlite); answer flow:
`POST /answer-question/{id}``OperatorQuestions::answer`
`notify_manager(OperatorAnswered { ... })`.
## Helper events to the manager
@ -296,6 +304,9 @@ turn so the manager can react. Variants
(ApplyCommit).
- `Killed { agent }` — admin `HostRequest::Kill` + dashboard `/kill`.
- `Destroyed { agent }``actions::destroy`.
- `OperatorAnswered { id, question, answer }``dashboard::post_answer_question`
fires this after the operator submits the answer form for a question
the manager queued via `ask_operator`.
To add a new event: new `HelperEvent` variant + call sites + update
`prompts/manager.md` so the manager knows the new shape.