Skip to main content

Module deliver

Module deliver 

Source
Expand description

agents queue deliver — wake every queue-pending descendant agent of the caller.

The handler enumerates two kinds of targets with active queued prompts in the caller’s subtree: unique AIHs that are STRICT descendants of the caller (direct rows + rows against BOUND tags), and un-upgraded (GROUPED) tags whose group parent sits in the subtree. Per target it try-acquires the agent’s (or tag’s) lock with no waiting: a live owner yields AgentActiveResponseItem / TagActiveResponseItem; winning the lock yields AgentSpawnedResponseItem / TagSpawnedResponseItem and runs the same spawn machinery agents spawn / agents message use (empty messages, plus the stored continuation for AIHs or the group’s stored agent spec for tags), streaming each spawn item as a ValueResponseItem and releasing the lock when that task’s stream ends. Once EVERY target has resolved (active or spawned), the bare string "AllAgentsActive" is emitted.

Two modes, selected by dangerous_advanced.stream_spawns:

  • unset/false (the default, user-facing): re-exec the cli binary as a detached orphan with stream_spawns = true and emit the child’s items up to and including AllAgentsActive, then return — the orphan keeps running the spawns to completion.
  • true (the re-exec’d child): run the full delivery in-process and stream everything, spawn output included.

Modules§

request_schema
response_schema

Structs§

AgentActiveResponseItem
This agent’s lock was held by a live owner — it is already active and will drain its own queue; nothing was spawned for it.
AgentSpawnedResponseItem
This agent’s lock was won and its spawn has started; its output follows as ValueResponseItems (in stream_spawns mode).
Args
Command
Request
RequestDangerousAdvanced
TagActiveResponseItem
This un-upgraded tag’s lock was held by a live owner — another process is already materializing it; the queued rows will reach the agent it mints. Nothing was spawned for it.
TagSpawnedResponseItem
This un-upgraded tag’s lock was won and a fresh spawn of the group’s stored agent spec has started. The minted agent_instance_hierarchy isn’t known yet at this point — it arrives as the FIRST inner item (the spawn Id) of the ValueResponseItems that follow (in stream_spawns mode).
ValueResponseItem
One output item from one delivered agent’s spawn stream. value is the typed root crate::cli::command::ResponseItem (the spawn item wrapped at the root) — boxed because the root union transitively contains this type (agents → queue → deliver), and boxing is what makes the recursion sized.

Enums§

AgentActiveType
AgentSpawnedType
AllAgentsActive
Every target has resolved to active-or-spawned. Wire shape is the bare string "AllAgentsActive" (a one-variant enum — a unit variant in the untagged ResponseItem would serialize as null, not the marker string). The detached default mode stops reading its child at this item.
Path
ResponseItem
One stream item from agents queue deliver. Untagged — the variants are disjoint on the wire: Value requires value, AgentActive / AgentSpawned / TagActive / TagSpawned carry distinct type markers, and AllAgentsActive is the bare string "AllAgentsActive".
Schema
TagActiveType
TagSpawnedType

Functions§

execute
execute_transform