feat(#1178): add list_containers tool to AgentServer (topology-scoped to descendants)

This commit is contained in:
damocles 2026-06-03 22:21:01 +02:00 committed by mara
commit 94c2d651c0
4 changed files with 98 additions and 0 deletions

View file

@ -542,6 +542,12 @@ pub enum Request {
},
/// *(privileged)* List every schedule in the queue.
ListSchedules,
/// List all containers that are topological descendants of the calling
/// agent (direct children + their subtrees). Scoped to the caller's
/// subtree; gated by the `lifecycle` tool group. The result includes all
/// known descendants regardless of whether the container is currently
/// running — use `running` to distinguish.
ListDescendants,
/// *(privileged)* Fire a scheduled prompt out of band immediately.
FireScheduleNow { id: i64 },
/// *(privileged)* Edit an existing schedule's mutable fields.
@ -627,12 +633,25 @@ pub enum Response {
/// `ListSchedules` result. Snapshot of every schedule.
/// Returned on the manager socket only.
Schedules { schedules: Vec<WireSchedule> },
/// `ListDescendants` result: all descendant containers, with running
/// status. Ordered by topology depth (parents before children), then
/// alphabetically within each depth tier.
Containers { containers: Vec<ContainerInfo> },
}
/// Backwards-compatible response aliases.
pub type AgentResponse = Response;
pub type ManagerResponse = Response;
/// One entry in a `ListDescendants` result.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ContainerInfo {
/// Logical agent name (no `h-` prefix).
pub name: String,
/// Whether the container is currently running.
pub running: bool,
}
/// Serde default for the `running` field; keeps wire backwards-compat
/// with pre-running-field payloads. See
/// `docs/conventions.md::Agent metadata`.