swarm: cancel an agent's turn from the swarm queue
A separate $SWARM.control.<agent> subject carries commands, apart from
the text subject. swarm-controller exposes POST /api/agents/{name}/cancel
as a NATS request; the harness answers whether a turn was actually
stopped, through the same cancel path as the dashboard button. The agent
credential gets subscribe on its control subject and allow_responses to
answer; only the controller may publish there.
Refs #3803
This commit is contained in:
parent
e7ed28b382
commit
fefc565794
11 changed files with 558 additions and 69 deletions
|
|
@ -209,6 +209,15 @@ credential may subscribe there. The harness doesn't reply, so swarm-controller
|
|||
answers 202 when the request times out after two seconds, and 503 when the
|
||||
queue reports no subscriber.
|
||||
|
||||
A command has its own subject, so the harness never mistakes typed text for
|
||||
one. `POST /api/agents/<name>/cancel` sends `"cancel"` as a NATS request on
|
||||
`$SWARM.control.<name>`, and only swarm-controller may publish there. The
|
||||
harness answers `{acted}`, which says whether a turn was running when the
|
||||
cancel stopped it. It runs the same code as the hive dashboard's cancel button.
|
||||
Unlike input, the harness answers a command, so swarm-controller returns that
|
||||
answer as 200, 503 for no subscriber, and 504 when the harness held the command
|
||||
and didn't answer within ten seconds. A 504 means unknown, not cancelled.
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>Where the subagent list and rows come from</summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue