Expand description
agents message — stream-aware delivery primitive.
Resolves the target, decides whether to enqueue / race delivery
against a live agent / take over and spawn, all driven by
dangerous_advanced.stream (mirror of agents instances spawn’s same flag).
Tag resolution is the first step: a MessageTarget::Tag lookup
against tags either yields a BOUND hierarchy (which makes the
call act like a Direct target) or fails (PENDING / ABSENT), in
which case the call falls back to a pure enqueue.
Once we have a resolved hierarchy, the path splits by stream mode:
- stream=false (default): non-acquiring lock-file check. If a live agent holds it: enqueue + race DB-delivery against lock-file release. If no live agent: re-exec ourselves as a detached subprocess with stream=true so the new process becomes the agent.
- stream=true: try to acquire the lock-file. On success:
skip enqueue, run
spawn::run_multi_passin-process. On failure: enqueue + race DB-delivery against lock acquisition.
Modules§
Structs§
Enums§
- Enqueue
Mode - “Fire and forget into the queue” mode. When attached to a
RequestviaRequest::enqueue, the handler short-circuits: no tag lookup, no lock-file race, no spawn-takeover, no detached respawn — just one INSERT (preceded by a key-collision DELETE whenKeyed) and aResponse::Enqueuedreply. - Message
Target - Mutually-exclusive addressing for an
agents messagecall. - Path
- Request
Message - Response
- Unary response (stream=false). Exactly one of these per call.
Internally tagged via
type; bare unit variantDeliveredserializes as{"type":"delivered"}. - Response
Item - Streamed response (stream=true). The cli yields a sequence of
these. Same
Delivered/Enqueued/Idfirst-item semantics asResponse; the spawn-take-over branch adds streamingChunkitems after the initialId. - Schema