hive-bash-mcp: publish each task's status and output to the swarm queue
This commit is contained in:
parent
faadc5abe2
commit
c0b9c1778c
2 changed files with 841 additions and 211 deletions
|
|
@ -78,6 +78,29 @@ unread rooms. An inline `wait_seconds` / `status` observation that already
|
|||
delivered the result instead clears the keyed todo, so no redundant
|
||||
loose-end follows.
|
||||
|
||||
### Status and output the swarm sees
|
||||
|
||||
The daemon also tells the swarm about each task, so the swarm UI can list the
|
||||
running ones and read their output without calling the agent
|
||||
(`swarm_wire::bash_task`; the bucket, the stream and the grants are in
|
||||
[`controller.md`](../swarm/controller.md)). It publishes as the agent, over the
|
||||
connection `swarm_queue_client::agent_publisher` makes with the agent's own
|
||||
queue credential, and publishes nothing in a container without a queue address
|
||||
or a secret store. Everything is best-effort: a failed connect or publish is a
|
||||
log line, and a task never waits on the queue.
|
||||
|
||||
- **Status.** The runner writes a task file at every state change, and each
|
||||
write also publishes the task's state to `$KV.bash-task-status.<agent>.<task>`.
|
||||
While a task is `pending` or `running`, the publish task repeats it every 60
|
||||
seconds, so a daemon that died reads as stale. A finished task leaves that
|
||||
repeat.
|
||||
- **Output.** A task's output goes to files, so while it runs the daemon reads
|
||||
what the files gain twice a second and publishes it as rows on
|
||||
`$SWARM.term.<agent>.bash.<task>`, each with the `Swarm-Stream` header
|
||||
(`stdout` or `stderr`). A chunk never splits a character, and one larger than
|
||||
the queue's payload limit goes out in pieces. When the process exits, the daemon
|
||||
publishes what the files still hold before it writes the final status.
|
||||
|
||||
## Relationship to the `execution` permission
|
||||
|
||||
`Permission::Execution` (in `Permission::DEFAULT`) is the real gate on bash:
|
||||
|
|
|
|||
|
|
@ -202,8 +202,7 @@ goes to `$SWARM.term.<agent>.bash.<task>`, with a `Swarm-Stream` header of `stdo
|
|||
`stderr`, into the stream `term-bash-<agent>` that swarm-controller creates for every declared
|
||||
agent, for 24 hours or 64 MiB like the subagent rows. The agent's credential may publish
|
||||
`$KV.bash-task-status.<agent>.*` and `$SWARM.term.<agent>.bash.>` and nothing else of
|
||||
JetStream. Only the names, the grants and the two stores exist so far; the bash MCP doesn't
|
||||
publish yet.
|
||||
JetStream. The bash daemon publishes both (see [`bash.md`](../agent-tools/bash.md)).
|
||||
|
||||
The queue would refuse a row too large for its `max_payload` outright and
|
||||
take the connection down with it, so the harness drops such a row's body before
|
||||
|
|
|
|||
Loading…
Reference in a new issue