Expand description
The agents__* family - one address space for every forge session.
A target is a slot: (org, project, label), with lead reserved
for a projectβs own agent. Three verbs reach any slot from any
session; the rest act on the callerβs own project and are lead-only.
Re-exportsΒ§
use std::sync::Arc;πuse forge_sdk::mcp::tool::Tool;πuse forge_sdk::mcp::tool::ToolInput;πuse forge_sdk::mcp::tool::ToolOutput;πuse crate::SessionSlot;πuse crate::mcp::agents::facade::AgentDispatcher;πuse crate::mcp::agents::target::AgentTarget;πuse crate::mcp::agents::target::TargetError;πuse crate::mcp::peers::facade::WorkspaceFacade;πuse crate::mcp::peers::types::MessageId;πuse crate::mcp::peers::types::PeerStatus;πuse crate::mcp::peers::types::WrappedKind;πuse crate::mcp::peers::types::WrappedPrompt;πuse crate::mcp::workers::facade::DespawnOutcome;πuse crate::mcp::workers::facade::WorkerCapSource;πuse crate::mcp::workers::facade::WorkerDespawnError;πuse crate::mcp::workers::facade::WorkerFacade;πuse crate::mcp::workers::facade::WorkerSpawnError;πuse crate::mcp::workers::facade::WorkerUpdateError;πuse crate::protocol::SessionChoice;π
ModulesΒ§
- facade
- The seam between the merged
agents__*family and the two engines it drives. Every verb that takes a target resolves it here, so the routing rule lives in one place rather than at each call site. - target
- The address an
agents__*call names.
StructsΒ§
- Capacity π
agents__capacity- lead-only aggregate read of the callerβs project worker capacity. One JSON object rather than the per-worker snapshotsagents__listreturns.- Despawn π
agents__despawn- lead-only. Closes a worker by label and cleans up its git worktree. A clean worktree is removed; a dirty one (uncommitted/untracked or unpushed commits) blocks the despawn unlessforce.- Despawn
Args π - Handoff π
agents__handoff- hand this seat over to a fresh session, from the session itself.- Handoff
Args π - List π
agents__list- every seat you can address, optionally narrowed to one project. No target args.- List
Args π - Send
Message π agents__send_message- one verb for every send, to any seat.- Send
Message πArgs - Spawn π
agents__spawn- lead-only. Allocates a new session in the callerβs project, threadingcharterthrough the new sessionβs system-prompt addendum, then returns the assignedsession_idandtag(forge:worker:<label>).- Spawn
Args π - Target
Args π - Update π
agents__update- lead-only. Revises the storedcharter,kickandresume_kickof an EXISTING worker, keyed by(project_key, label)exactly asagents__spawnpersisted it.- Update
Args π - Whoami π
agents__whoami- the callerβs own slot and identity. No args.
FunctionsΒ§
- add_
lead_ πtools - Attach the four lead-only verbs to an existing
McpServerBuilder. Each acts on the callerβs own project, so a worker has no project to act on and is not offered the surface. - add_
shared_ πtools - Attach the three any-caller verbs to an existing
McpServerBuilder. - build_
server - Build a standalone
forgeMCP server carrying the wholeagents__*family as a lead sees it. The wire-conformance harness drives the surface through this against mock facades. - canonical_
spawn_ πfamilies - Validate and canonicalise a spawn or update
mcp_familiesargument: names in wire order, de-duplicated; an empty list resolves toNone(every family) for a spawn. - format_
despawn_ πerror - format_
spawn_ πerror - format_
update_ πerror - json_
output π - row π
- A snapshot row: the address to pass back to
agents__send_message, then whatever the engine that produced the snapshot knows about the seat. - sender_
identity π - The name and org an envelope carries for the session that sent it,
derived from that sessionβs own slot: the project for a projectβs own
agent,
project/labelfor a worker, with the org beside it. - slot_
json π - The slot an agent is addressed by, which is the shape every row and every response carries.
- target_
error_ πmessage - LLM-facing explanation of a target that did not resolve. Names the reachable set, because a target that refuses is usually a typo.
- tool_
error π