Skip to main content

Module message

Module message 

Source
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_pass in-process. On failure: enqueue + race DB-delivery against lock acquisition.

Modules§

request_schema
response_schema

Structs§

Args
Command
MessageArgs
Request
RequestDangerousAdvanced

Enums§

EnqueueMode
“Fire and forget into the queue” mode. When attached to a Request via Request::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 when Keyed) and a Response::Enqueued reply.
MessageTarget
Mutually-exclusive addressing for an agents message call.
Path
RequestMessage
Response
Unary response (stream=false). Exactly one of these per call. Internally tagged via type; bare unit variant Delivered serializes as {"type":"delivered"}.
ResponseItem
Streamed response (stream=true). The cli yields a sequence of these. Same Delivered / Enqueued / Id first-item semantics as Response; the spawn-take-over branch adds streaming Chunk items after the initial Id.
Schema

Functions§

execute
execute_jq
execute_streaming
execute_streaming_jq