swarm: list an agent's bash tasks from their published status
GET /api/agents/{name}/bash-tasks reads the agent's keys of the bash-task-status
bucket and reports each task's state, command and times, with a live task whose
daemon stopped reporting as stale. The swarm UI shows them in a background tasks
section of the agent card, running ones first. The task output stays unread.
This commit is contained in:
parent
cc7b298cf3
commit
5de20f31dd
2 changed files with 625 additions and 11 deletions
|
|
@ -203,6 +203,9 @@ goes to `$SWARM.term.<agent>.bash.<task>`, with a `Swarm-Stream` header of `stdo
|
|||
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. The bash daemon publishes both (see [`bash.md`](../agent-tools/bash.md)).
|
||||
`GET /api/agents/<name>/bash-tasks` lists an agent's tasks from the status keys, newest first and at
|
||||
most 200, each with its `state` (the published one, or `stale` when a live task's daemon stopped
|
||||
reporting), `cmd`, `created_unix`, `since_unix` and `exit`. The output stream isn't read yet.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -595,6 +595,20 @@ store identity, or no queue address, publishes no subagent terminals.
|
|||
|
||||
</details>
|
||||
|
||||
<details><summary>Where the background task list comes from</summary>
|
||||
|
||||
An opened agent card has a **background tasks** section, below the subagents, listing the
|
||||
tasks the agent started through the bash MCP. Its bash MCP publishes one status per task
|
||||
to the `bash-task-status` bucket, and swarm-controller serves the list as
|
||||
`GET /api/agents/<name>/bash-tasks`: each task's id, command, state, the time the agent queued it and
|
||||
the time it entered its state, and the exit status. The state is the published
|
||||
one, or `stale` for a live task whose daemon stopped reporting. The section lists the running
|
||||
tasks first, then the rest, each newest first. Before the age it says `started`,
|
||||
`finished`, `exited N`, `timed out`, `killed` or `stopped reporting`. It refetches
|
||||
every ten seconds and shows no output, which is a separate stream.
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>Where an agent's terminal history comes from</summary>
|
||||
|
||||
The harness publishes the agent's terminal rows on `$SWARM.term.<agent>`, into
|
||||
|
|
|
|||
Loading…
Reference in a new issue