Engine reference — generated from the canonical engineering source. Do not edit this page by hand.
ZMQ Wire Protocol Reference
This is the CANONICAL wire-protocol reference. All other wire-protocol
pages (docs/PROTOCOL.md, docs/zmq-worker-protocol.md,
docs-site/reference/zmq-protocol.md) are thin pointers to this file.
Security material (HMAC, CURVE, enrollment keys, ownership gates) lives in
docs/zmq-security.md; worker integration examples live in
docs/worker-integration.md and example/python/zmq_worker.py.
Protocol Version: 4 — sol_zmq_protocol:protocol_version/0 (Sol) and
zmq_protocol.lua:M.VERSION (Luna). Increment on breaking semantic changes.
Version policy is STRICT-FORWARD with a config-gated N/N−1 skew window
a worker whose
ready version is exactly Sol’s constant, or (while the window is enabled)
exactly one below it, is admitted; anything older is refused at the
handshake ({version_mismatch, V, Expected}) and a min_version above
Sol’s is refused (min_version_too_new). Task frames to an N−1 worker are
stamped min(SolVersion, WorkerVersion) —: every
Sol→Luna frame, not only the task frame, is stamped at the target’s
admitted version (frame_version_for/1), so Luna’s own
v > M.VERSION inbound validator accepts them. The skew is counted by the
sol_zmq_fleet_skew{version} gauge and WARNING-logged at registration;
strict equality is the rollback posture (zmq_wire_skew_window=false).
(No v1 compatibility;,: token frames gained a per-task
seq;,: team_directive gained leader attribution +
content signature and joined the per-frame MAC plane;,
the task frame gained inference_binding and the
lane_control/lane_control_ack round-trip was introduced — upgrade
stop-then-upgrade: a v3 Sol would silently drop lane_control.
ALL Sol→Luna builders stamp the target’s admitted
version;:
the additive-v4 lane_revoke push joins the plane (advisory; suppressed
for pre-v4 targets).)
Overview
Sol (Erlang/OTP) and Luna (LuaJIT) communicate over ZMQ (ZMTP, DEALER–ROUTER
pattern) using msgpack-encoded maps. Every claim below is traceable to a code
symbol: the builders/validators in server/src/sol_zmq_protocol.erl, the
frame router server/src/sol_zmq_frame_router.erl, the receive dispatcher
server/src/sol_zmq_recv_dispatcher.erl, the ownership gates
server/src/sol_zmq_ownership.erl, and the Luna builders in
client/core/zmq_protocol.lua + client/core/zmq_worker.lua.
Message Framing
DEALER/ROUTER uses multipart ZMQ messages with a single msgpack-encoded map payload:
ROUTER → DEALER: [identity_frame] [payload_frame]
DEALER → ROUTER: [payload_frame] (+ [payload_frame, mac] on MAC'd sessions)
The ROUTER socket prepends the worker’s routing identity; the DEALER
socket adds NOTHING — the worker’s payloads go out bare ([payload]) or
MAC-signed ([payload, mac_hex]), and the wire-effective shapes at the
Sol gateway are [Identity, Payload] and [Identity, Payload, MacHex]
(sol_zmq_sender.erl sends [Identity, Payload] via
chumak:send_multipart; sol_zmq_gateway.erl matches exactly those two
shapes and DROPS anything else). A delimiter-frame-shaped
[Identity, "", Payload] message matches the MAC’d 3-frame clause — the
empty frame occupies the payload slot and the intended payload is taken
for the MAC frame — so the payload decode fails on the empty frame: the
gateway logs a WARNING and the message is dropped UNDECODED and never
dispatched (no error reply — unlike the 2-frame shape, whose decode
failure answers the sender with a decode_error error frame).
msgpack options: {pack_str, from_binary}, {unpack_str, as_binary}, {map_format, map} (?MSGPACK_OPTS, sol_zmq_protocol.erl).
All keys are binary strings.
Frame-size cap: 10 MB (max_msg_size/0, sol_zmq_protocol.erl) — the
receive boundary rejects oversized frames before decode; Luna’s
ffi/zmq.lua mirrors the same cap pre-copy.
Per-frame v stamping
Every frame carries v — the protocol version it was built with
(stamp_version/1 on Sol builders, stamp/1 in zmq_protocol.lua).
Absent v is treated as legacy v1 (the msgpack map is extensible).
Enforcement is asymmetric, and the per-frame v itself is NOT a Sol-side
gate: Luna drops inbound frames whose v is higher than its supported
version (validate_incoming, zmq_protocol.lua), while Sol enforces the
protocol version at the ready HANDSHAKE only — validate_ready_msg/1
accepts the current version (and, while zmq_wire_skew_window is on, the
N−1 window value) and no Sol code reads the per-frame v field.
Version skew window N/N−1
Default-on rolling-upgrade window (zmq_wire_skew_window; rollback lever).
: every Sol→Luna frame is stamped at the TARGET worker’s
admitted version (sol_zmq_protocol:frame_version_for/1 — the centralized
stamping authority; the frame-class × stamp-policy matrix lives in
server/test/fixtures/wire_compat_matrix.json, machine-checked by
ci/stamp_policy_matrix_lint.py, and is consumed by BOTH sides’ tests).
This closes the control-frame gap: the frame-level
differences a v3-mode worker sees during the window:
| Surface | Current (v4) | v3-mode worker (N−1, skew window) |
|---|---|---|
ready version | 4 | accepted only while zmq_wire_skew_window=true |
task frame v | 4 | stamped 3 (min(SolVersion, WorkerVersion)) so Luna’s v > M.VERSION gate accepts it |
| task frame fields | full v4 set | the SAME additive fields (permissions, attempt, task_timeout_ms, inference_binding) — none is required; a v3 Luna ignores the binding and uses its legacy model path |
ALL control frames (cancel, timeout-cancel, cancel_ack, spawn_ack, child_result, skill_sync, plugin_tool_result, acp_forward, acp_discover_reply, team_directive, team_mail_push) | stamped at the target’s admitted version | stamped 3 — accepted and acted on |
lane_control / lane_control_ack / lane_revoke (v4) | the lane-control round-trip + revoke push | v4-only semantics — never downstamped. A v3 worker never sends lane_control (no producer), so it never receives an ack; a lane_revoke push to a pre-v4 target is SUPPRESSED at the send site (target_admits/2 → suppress_frame/2: zmq_frame_suppressed_total counter + warning log — visible, never silent) |
error / ready_required (Sol→Luna refusals) | stamped at the target’s admitted version (registered peer) or the DECLARED version of the frame being refused | accepted — a peer always hears the refusal in a shape its own validator admits. The pre-registration decode-error leg stays legacy-unstamped on purpose (absent v = v1 = universally accepted: Sol cannot know an undecodable peer’s version, and stamping it current would make an N−1 peer DROP the feedback) |
| token frames | per-task seq (v2 feature, unchanged) | identical |
Refused loudly (never degraded): v2 and older READY
({version_mismatch, V, Expected}); a min_version above Sol’s
(min_version_too_new — enforced on BOTH the exact-version and the N−1
skew arm since then -8; the hole is closed). Every
admitted skew worker is counted by
sol_zmq_fleet_skew{version} and WARNING-logged.
V4 upgrade posture: STOP-THEN-UPGRADE. The
new lane_control frame is unknown to a v3 Sol (sol_zmq_handler_default
drops it silently), so a v4 Luna against a v3 Sol would hang its resolve
until its own timeout with zero server feedback. Upgrade Sol and Luna
together (wild CD ships both); the N/N−1 window exists for the
task-dispatch rolling upgrade, NOT as a lane-control compatibility claim.
** refinement: the v3-worker side of the window is now
control-frame complete** (every control frame downstamps or visibly
suppresses — see the table above), so a rolling SOL upgrade with v3
workers still running is safe for cancel/sub-agent/team/plugin/ACP
traffic; only lane consumption remains v4-only. The v3-Sol direction
(a Luna downgrade) remains stop-then-upgrade.
Connection Model
Naming scope. Worker-id uniqueness is
enforced per Sol node — the registry and the worker_id_in_use
conflict gate (sol_zmq_worker_manager) live in node-local state; Sol
has NO fleet-wide id namespace. A node-spawned worker is minted
init-wkr-N identically on EVERY node, so the same wire id can exist
once per node by design; never treat a worker_id as globally unique
(e.g. as a database key across a cluster). Task ids follow the same
rule (see the task table below).
- Worker opens a DEALER socket, sets
ZMQ.IDENTITY(= itsworker_id), connects totcp://<host>:<port>. - Worker sends
readyimmediately after connect (must carry the current protocolversion). - Sol validates
ready(validate_ready_msg/1): version accepted (current or, whilezmq_wire_skew_window=true, the N−1 window) →ok; anything else →{version_mismatch, V, Expected}(registration refused); amin_versionabove Sol’s version on the exact-version arm OR the N−1 skew arm →{error, {min_version_too_new, Min, Supported}}(the N−1 arm does not bound it — ); missingversion/worker_id/capabilities→{error, missing_fields}. - Sol registers the worker and routes tasks to idle registered workers. If no workers are ready, tasks queue until one is available.
- Liveness while connected is carried by periodic
heartbeatframes . A heartbeating identity Sol does NOT hold as registered — the full-VM-restart shape: the DEALER transport auto-reconnects, so the worker’s frames keep flowing while its registration is gone — is answered with the typedready_requiredcontrol frame (, ); the worker degradesconnectedtruthfully and re-registers with a proof-carryingready(freshnonce+ monotonicctr) after a full-jitter backoff. An IDLE worker may additionally re-sendreadyperiodically when explicitly configured (LUNA_ZMQ_REREADY_IDLE_MS, default OFF) — the frame is a fully signed registration (realctr/nonce proof). A proof-less mid-task re-ready remains FORBIDDEN: it trips Sol’s fail-closed adoption gate and orphans the in-flight task with aworker_reconnectederror. - Reconnection is handled by ZMQ internally (DEALER reconnects
automatically); a reconnect with an in-flight task re-
readys with the resume proof. The ADOPTION predicates are exact (, XS-11 — the pre-fix prose said “a secret is configured”, which is neither necessary nor sufficient): thereadymust be credential-VERIFIED by the normal registration gate, must NOT be wildcard-bound, must claim the same routing identity +worker_id, must name the exact in-flighttask_id, and the session MAC key derived from the presented credential must equal the key recorded on the existing registration (credential continuity — a different key, including a fleet-wide wildcard holder, never inherits the task). A failed predicate refuses the READY and the in-flight task is resolved through the error strategy asworker_reconnected.
Dispatch Topology
Task dispatch is node-affine by construction and always has two legs:
- The task leg rides ZMQ to MY Sol. A worker’s frames are served by the Sol node its DEALER is connected to; that node’s gateway queues, seats and dispatches the task, and its task store owns the rows. There is no Sol→Sol task forwarding and no cross-node re-dispatch: a node’s in-flight work is stranded (visible via the stranded-task datum, and requeued by its own outbox reconcile) until that node revives.
- The inference leg rides HTTP to whichever node’s llama holds the
lane. A lane grant’s endpoint may point at ANOTHER cluster node’s
llama server (cross-node placement via the lane orchestrator); the
worker dials that HTTP endpoint directly. The granting node’s bind
contract governs reachability: a
bind_mode=loopbacklane is granted only to a worker on the same machine; abind_mode=nonloopbacklane must advertise a routable host (loopback_advertisedrefuses the grant typed otherwise).
Consequence: each Sol node is an independent dispatch universe joined by the membership plane (catalog + lane inventory) and the placement rpc — not a single distributed queue.
Message Types
Frame types are the type key of each msgpack map. Direction: Worker → Sol frames are built by Luna (zmq_protocol.lua); Sol → Worker frames
are built by sol_zmq_protocol:build_*_msg/* and dispatched by the
gateway.
Sol → Luna
Luna-side validation: EVERY frame type in this
section is validated at Luna’s _handle_frames gate against the Required
columns of its field table (zmq_protocol.validate_incoming). A frame
failing validation is dropped, counted, and logged — never dispatched, and
the rest of the receive tick is unaffected (task additionally answers Sol
with an invalid_message error frame from _on_task). The per-type
Required fields are machine-pinned to the validator by
ci/zmq_protocol_doc_parity_lint.py.
1. task
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "task" |
task_id | binary | yes | Task identifier, unique per Sol node — zmq-<ms>-<node-local counter> (sol_zmq_task_dispatcher:generate_task_id/1; the counter is dispatcher state, so ids are not fleet-unique; the zmq- namespace is server-reserved) |
prompt | binary | yes | Agent prompt text (may be empty for tool-call-only tasks) |
model | binary | no | Model override |
user_uuid | binary | no | Requesting user (present when Mango auth is on) |
workspace_root | binary | no | Working directory |
plugin_tools | list | no | Plugin tool descriptors |
permission_mode | binary | no | Permission profile — clamped server-side |
permission_rules | map | no | {deny, ask, allow} permission-rule ceiling stamped by sol_zmq_permission_rules:stamp/3 (bounded/validated server-side; additive, legacy peers ignore it) |
mode | binary | no | Advisory agent-mode request — a mode name resolved by Luna through core.agent_modes. Sol keeps it on the frame ONLY when the assigned worker’s READY-advertised modes list contains the exact value; otherwise it is stripped, counted (zmq_task_mode_fallback_total) and logged (mode is advisory — never a terminal; permission_mode is untouched). Absent stays absent. Additive: a pre-v4 peer ignores the key |
legacy_write_implies_execute | boolean | no | Execute-grade stamp — Sol’s effective legacy_write_implies_execute value (write-class permissions keep execute grade only while this is true). Luna clamps with min(Sol, Luna) so a split config can never widen the worker’s execute grade past Sol’s authority. Absent = legacy true (byte-identical for older peers; additive msgpack key, no protocol bump) |
task_timeout_ms | integer | no | Task idle deadline. Since it is the idle window of the progress-renewed lease: Sol re-arms it on every token/heartbeat for the task, bounded by the server-side task_max_lifetime_ms cap (a chatty-but-endless task is still cancelled at the cap). A dispatch Opts timeout_ms overrides the value per task. Disabled deadline: task_timeout_ms=0 disables the GATEWAY deadline; the wire field is then stamped with the shared 24h sentinel (docs/fixtures/task_timeout_contract.json, disabled_wire_sentinel_ms=86400000) so Luna’s max(value, 30000) wedge watchdog cannot preempt Sol’s decision at an absent-field 300s default. The field is never omitted |
permissions | list | no | RBAC permission list — always present (possibly empty) since then; explicit [] = the server granted NOTHING |
attempt | integer | no | Retry epoch — starts at 1 and increments on every re-dispatch/retry; Luna resets its per-task token seq on a changed attempt and Sol keys the expected token-seq rows by {task_id, attempt}. Absent = 1 is a DECIDED contract and is NOT flipped: a result/error frame without attempt for a receipt at attempt 2 is refused by the current gate (the regression pin is sol_zmq_attempt_gate_tests:absent_attempt_is_one_decided_guard/0; any future change needs a protocol-v-next decision). Since Luna ECHOES the same epoch on its terminal result/error frames so Sol can refuse a stale terminal (attempt lower than the current dispatch attempt) — see §15/§16. adds the same additive stamp to attempt-resolution cancel frames (§2) |
inference_binding | map | no | Local-lane grant binding — stamped by the dispatcher from the WARM-ONLY sol_lane_orchestrator:resolve_warm/2 probe (never starts a lane, never blocks). {status => "granted"} carries the pinned descriptor — the 7-key shape (lane, endpoint, wire_format, caps, ctx, lease_id, expires_at) + holder + expires_in_ms — of a LIVE local grant; the probe refuses non-openai formats at grant time, so every granted descriptor is worker-consumable. {status => "required", lane?, requirements?} is a marker — the worker must resolve asynchronously via lane_control (§27) and surface the typed refusal. ABSENT = remote-plane task: use the legacy key-based model path (§5 provider semantics) — and when that path does not exist (a keyless worker), the worker resolves a lane instead (typed lane_unavailable on refusal; never a mock). Additive; a v3 peer ignores it |
Builder (Erlang): sol_zmq_protocol:build_task_msg/3
Handler (Lua): zmq_worker.lua:_on_task/1
Dead task-frame fields: opts, capabilities and
request_id were removed from the task frame — Sol sent them but no Luna
consumer ever read them (the capabilities LSP gate and the
child_result.tokens/duration_ms reads were removed on the Luna side in
the same phase; child_result never carried those fields). They
re-enter the wire only together with a real consumer; the
ci/wire_field_provenance_lint.py consumption leg enforces it.
2. cancel
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "cancel" |
task_id | binary | yes | Task to cancel |
user_uuid | binary | no | Requesting user |
cancel_reason | binary | no | Present on the gateway’s attempt-resolution cancels: "task_timeout" and the RESERVED "attempt_retry". Both are ATTEMPT resolutions — the task may be re-dispatched under error_strategy=retry, so Luna must not tombstone the id nor emit a fabricated cancelled terminal. Current Sol deliberately sends NOTHING on a send-failure requeue to the legacy fleet (every reason the current Luna does not recognize is a terminal tombstone); a future capability-gated client may consume attempt_retry. ABSENT = the plain (terminal) cancel: Luna tombstones the id and answers cancelled |
attempt | integer | no | **** — the dispatch epoch the cancel resolves. A delayed control retry (sender backoff) must not abort a newer attempt on the same worker: Luna ignores a cancel whose attempt is lower than its executing attempt. Absent = the legacy any-attempt shape (plain terminal cancel); never fabricated when unknown |
Builder (Erlang): sol_zmq_protocol:build_cancel_msg/1-3 (plain);
sol_zmq_protocol:build_cancel_timeout_msg/1-3 (typed timeout cancel);
sol_zmq_protocol:build_cancel_retry_msg/3 (typed attempt-retry cancel)
Handler (Lua): zmq_worker.lua:_on_cancel/1
3. spawn_ack
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "spawn_ack" |
parent_task_id | binary | yes | Parent task ID |
child_task_id | binary | yes | Spawned child ID — non-empty on dispatched, EMPTY (<<>>) on rejected |
status | binary | yes | "dispatched", "rejected" — the ONLY statuses |
reason | binary | no | Rejection cause, present on EVERY rejected ack — bounded atom-name set: leaf_worker, unknown_parent, max_children_exceeded, max_depth_exceeded, seat_cap_reached, no_workers_available, unknown (non-atom reasons fail-closed to unknown) |
async | boolean | no | True if background spawn |
Builder (Erlang): sol_zmq_protocol:build_spawn_ack_msg/3-5
Handler (Lua): zmq_worker.lua:_on_spawn_ack/1 — fail-closes on anything
that is not exactly "dispatched" (unknown status is treated as rejected).
4. child_result
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "child_result" |
parent_task_id | binary | yes | Parent task ID |
child_task_id | binary | yes | Child task ID |
status | binary | yes | "ok", "error", "timeout" |
content | any | yes | Result content |
async | boolean | no | True if background result |
Builder (Erlang): sol_zmq_protocol:build_child_result_msg/4-5
Handler (Lua): zmq_worker.lua:_on_child_result/1, _on_background_result/1
5. cancel_ack
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "cancel_ack" |
task_id | binary | yes | Task ID |
status | binary | yes | "cancelled", "already_cancelled", "not_found", "not_owner" — the closed enum as sent (the historical "ok"/"error" pair was never produced by the handlers) |
not_owner covers both the dispatcher leg (sender does not own the task,
sol_zmq_handler_agent) and the background-task leg (sol_zmq_bg_task);
already_cancelled means a cancel was already accepted for the task.
Builder (Erlang): sol_zmq_protocol:build_cancel_ack_msg/2
Handler (Lua): zmq_worker.lua:_on_cancel_ack/1
6. skill_sync
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "skill_sync" |
skills | list | yes | Skill definitions; each entry carries the registry record (name/description/version/tags) plus, when the body fits the cap, body (the full SKILL.md content) |
skills_version | integer | no | **** — payload contract marker, 2 when body/revision semantics apply. A marked version > 2 is DROPPED by Luna (unknown breaking semantics); absent = legacy metadata-only shape |
revision | integer | no | **** — the Sol skill-registry revision at push time (monotonic per Sol boot epoch, seeded from wall clock so a restart always mismatches). Luna stores it and advertises it on READY (skills_revision, §12); a garbage/absent value is omitted (the worker then treats its copy as stale) |
bodies_omitted | boolean | no | **** — set on the metadata-only retry when the full payload would exceed the 10 MB wire cap: Luna updates metadata and the revision but never rewrites or prunes body files (the omission must not fabricate or delete content) |
Materialization contract: the push writes each
body to the worker-managed ~/.luna/skills/remote/registry/<name>/SKILL.md
(atomic tmp→rename) with a provenance.json beside it
({source: "registry", version, fetched_at, revision}); names absent from
the next full sync are pruned (tombstones). The marketplace install route
materializes under remote/marketplace/<author>/<name>/ — same target root,
same provenance shape with source: "marketplace". Both paths are additions:
sol_zmq_protocol:build_skill_sync_msg/1-3, Luna validator
zmq_protocol.lua:validate_incoming/1 (the skill_sync arm).
Builder (Erlang): sol_zmq_protocol:build_skill_sync_msg/1-3
Handler (Lua): zmq_worker.lua:_on_skill_sync/1 → core.skills:_on_skill_sync/1
7. team_directive
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "team_directive" |
team_id | binary | yes | Team identifier |
directive | binary | yes | Directive type |
task | any | no | Directive payload |
sender | binary | no | **** — leader attribution: the directive AUTHOR’s registered worker_id, stamped SERVER-SIDE (the gateway’s directive leg / leader gate). Frame-supplied sender values on the worker→Sol direction are never identity. Absent/empty ⇒ Luna treats the directive as unattributed |
hmac | binary | no | **** — enrollment-bound content signature: HMAC-SHA256(session_key, material), signed by the gateway with the TARGET worker’s session key. hmac_v selects the material: v1 = sol_zmq_frame_mac:directive_payload/3 (the length-prefixed team_id/directive/sender field triple composed under the per-frame material, so the worker’s routing identity stays bound in); v2 = directive_payload_v2/4 ("D2" domain + the same triple + u16be(len(task.prompt))/task.prompt). Unsigned/mismatched directives are announce-only on Luna (refused, never executed) |
hmac_v | integer | no | ** (LUNA-20), Sol v2 signer merge-fix** — 2 when the frame carries an executable task.prompt and hmac is the task-bound material; absent or 1 = metadata-only (announce-only). Luna executes a dispatch ONLY with a valid hmac_v=2 signature, so an on-path attacker cannot rewrite the prompt of a captured frame. Cross-language vectors: docs/fixtures/directive_hmac_v2.json |
user_uuid | binary | no | **** — the leader/OWNER identity resolved server-side from the team member row. Luna runs the directive turn under this principal; absent ⇒ the explicit worker:<id> namespace |
permissions | binary list | no | **** — the DECLARED bounded team-dispatched grant (sol_team_lifecycle:directive_grant/0). Luna uses this grant; it never reuses the LAST task’s permission snapshot (absent ⇒ explicit-empty deny-default, read-only) |
Trust contract:
Worker → Sol: requires registration AND team membership AND the
sender’s registry member row role == leader (sol_zmq_handler_team).
Non-leader directives are refused + counted (zmq_auth_failures_total).
Credentialed sessions additionally require the per-frame MAC —
team_directive joined the MAC-verified plane set (, the
recorded acceptance; sol_zmq_frame_mac:worker_plane_type/1,
same zmq_frame_mac required|prefer|off lever).
Sol → Worker: signed + attributed by the gateway (fields above).
Luna executes a directive ONLY when it is leader-attributed AND the
signature verifies; otherwise it is announce-only (refusal is loud,
run_turn is never reached).
Server-side semantics stay event-notify-only: sol_team_lifecycle:handle_directive/3
publishes the directive as a sol_event (announce); no server-side task
execution. Fan-out to member workers rides the event router’s dealer
routes.
Builder (Erlang): sol_zmq_protocol:build_team_directive_msg/3-4
(sender + signature added by the gateway’s send leg)
Handlers (Lua): zmq_worker.lua:_handle_frames (trust-evidence decode
- HMAC verification) →
agent.lua:handle_team_directive(refusal gate)
8. team_mail_push
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "team_mail_push" |
team_id | binary | yes | Team identifier |
msg_id | binary | no | ** (XSV-09)** — the durable per-recipient row id. Luna dedupes a READY re-push by this id (exactly-once per worker process); the field is absent on legacy/previous pushes |
expires_at | integer | no | **** — absolute Unix-seconds expiry of the durable row; Luna drops an already-expired re-push (the server also re-checks expiry before sending) |
from_kind | binary | yes | Sender struct kind — "worker" or "user" |
from_id | binary | yes | Sender struct id — the registered worker_id (kind worker) or the originating user_uuid (kind user) |
from_worker_id | binary | worker-kind only | Sender worker ID (server-derived); present ONLY when from_kind = "worker" |
to_worker_id | binary | yes | Recipient worker ID |
message | map | yes | Mail content (carries from/from_kind/from_id mirrors of the sender struct) |
hmac | binary | no | ** T2b** — the v1 ENVELOPE stamp: HMAC-SHA256(the RECIPIENT's session key, material) over the canonical zerg-team-mail-v1 || u16be(team_id) || u16be(from_id) || u16be(to_worker_id) || u16be(recipient routing identity) (sol_zmq_frame_mac:mail_countersign_material/3; the recipient identity is bound in explicitly). Present on every push to a CREDENTIALED session; absent only for anonymous (dev) sessions, which have no key material to sign with. It does NOT bind the message content. Luna verifies BEFORE injecting into agent context — a credentialed session that receives a missing/mismatched stamp QUARANTINES the mail (never injected) and counts it (vectors: docs/fixtures/team_plane_hmac_vectors.json) |
hmac2 | binary | no | ** (SC-06)** — the v2 CONTENT stamp, dual-signed with hmac: frame_mac(identity, 'zerg-team-mail-v2' || u16be(team_id) || u16be(from_kind) || u16be(from_id) || u16be(to_worker_id) || u16be(recipient routing identity) || u16be(priority) || u16be(timestamp) || u16be(subject) || u16be(sha256(canonical-JSON body))) (sol_zmq_frame_mac:mail_v2_material/9, mail_hmac_v2/10). Luna requires and verifies hmac2 whenever hmac_v is present: a body/priority/timestamp/subject mutation fails CLOSED even though the v1 envelope hmac still verifies. Vectors: docs/fixtures/team_plane_hmac_vectors.json (mail_v2, mail_v2_canonical) |
hmac_v | integer | no | ** (SC-06)** — signature material version. 2 = body-bound (hmac2 required and verified); any other value is refused. ABSENT = the expiring v1 compatibility posture (envelope-only hmac), refused by default since then (PRT-10). A pre-cutover fleet may open the window with `LUNA_TEAM_MAIL_V1_UNTIL=<epoch |
Builder (Erlang): sol_zmq_protocol:build_team_mail_push_msg/4-5 (/4 =
worker-kind legacy wrapper; /5 = struct form), dual-signed by
sol_zmq_frame_mac:sign_mail_hmac/3 + sign_mail_hmac_v2/3 on the
credentialed push leg
Handler (Lua): zmq_worker.lua:_handle_frames → zmq_team_plane.lua:team_mail_auth
(v2 via core/team_mail_hmac.lua; v1 only when hmac_v is absent)
The recipient replies to team mail by sending NEW mail with to = the
received struct’s from_id — the server resolves it at send time
(user uuid → the member row’s worker_id; worker id → passthrough), so the
reply is always worker-addressable.
9. plugin_tool_result
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "plugin_tool_result" |
task_id | binary | yes | Plugin tool task ID |
tool_name | binary | yes | Tool name |
status | binary | yes | "ok", "error" |
result | any | no | Tool result (on success) |
error | any | no | Error details (on failure) |
Builder (Erlang): sol_zmq_protocol:build_plugin_tool_result_msg/3
Handler (Lua): zmq_worker.lua:_on_plugin_tool_result/1
: on the timeout path the
errorfield carries the distinguishable reason"plugin_timeout"— the manager-side kill fired atplugin_execute_timeout_ms. Tool semantics are AT LEAST ONCE: the tool MAY HAVE RUN (bridge effects may be committed) when this reason arrives, so retries must be outcome-safe.execution_crashedremains the reason for a genuine worker crash.
: the worker→Sol inbound leg of this frame is RETIRED (Luna’s builder had zero producers; Sol’s inbound handler is deleted). The Sol→Luna reply leg documented above is LIVE — the plugin executor emits these frames and Luna’s inbound arm + validator are untouched.
10. acp_forward
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "acp_forward" |
request_id | binary | yes | ACP request ID |
from | binary | yes | Sender identity |
acp_type | binary | yes | "request", "notify" |
payload | any | no | Forwarded payload when not merged inline (non-map payloads) |
Builder (Erlang): sol_zmq_protocol:build_acp_forward_msg/4
Handler (Lua): zmq_worker.lua:_on_acp/1
11. acp_discover_reply
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "acp_discover_reply" |
request_id | binary | yes | ACP request ID |
to | binary | yes | Target worker |
agents | list | yes | Agent descriptors |
Builder (Erlang): sol_zmq_protocol:build_acp_discover_reply/3
Handler (Lua): zmq_worker.lua:_handle_frames
Sol → Luna error (server-initiated control-plane errors)
Sol ALSO sends type: "error" frames to the worker — control-plane
refusals, NACKs and decode feedback. These are bare msgpack maps built
at the refusal sites (never sol_zmq_protocol:build_error_msg/2, which
is the Worker→Sol §16 builder); Luna’s consumer is
zmq_worker.lua:_handle_frames (error leg: decode_error logs
details, unknown_message_type logs reason (the fixed-catalog echo; a
legacy original_type is still tolerated), anything else
logs reason; a task_id on the frame is CONSUMED —,:
orphan_result_stored drops the matching _pending_results retransmit
entries + terminal-spool row precisely, every other reason logs the
correlation at debug).
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "error" |
reason | binary | yes | Machine-readable cause (vocabulary below) |
details | binary | no | Human-readable auxiliary detail — the ONE auxiliary key. Registration-refusal classes (registration_hmac_failed, protocol_version_mismatch, reserved_identity, identity_banned) carry the refusal detail (the counter_stale class carries the operator hint — host clock skew — instead of the bare atom); the gateway decode_error leg carries the decode-failure detail |
task_id | binary | no | Correlated task — token_too_large, orphan_result_stored, and the gateway_paused NACK when the shed frame carried one |
retry_after_ms | integer | no | Server-paced retry hint — present on the rate/capacity registration refusals (machines_cap_reached and the <registration-rejection atom> arm: registration_rate_limited, registration_limiter_unavailable, cap_reached, worker_id_in_use); Luna’s full-jitter re-registration backoff seeds its base with it (never below the client’s own 1s floor) |
Reason vocabulary as built today (emitter → extras):
reason | Emitter | Extras |
|---|---|---|
decode_error | gateway + recv dispatcher (2-frame payload failed msgpack decode) | details |
missing_type_key | recv dispatcher | — |
unknown_message_type | sol_zmq_handler_default | — |
registration_hmac_failed | sol_zmq_handler_worker (ready credential verification) | details |
protocol_version_mismatch | sol_zmq_handler_worker (ready validation) | details |
malformed_ready | sol_zmq_handler_worker (ready missing worker_id/capabilities) | — |
shared_worker_requires_declaration | sol_zmq_ready_guard | details (remediation hint) |
reserved_identity | sol_zmq_handler_worker (queued/system sentinel identities) | details |
machines_cap_reached | sol_zmq_handler_worker (max_machines license cap) | retry_after_ms |
identity_banned | sol_zmq_handler_worker (duplicate-identity temp-ban ledger) | details |
token_too_large | sol_zmq_handler_worker | task_id |
orphan_result_stored | sol_zmq_handler_worker (orphan-result ack — drains the worker’s retransmit queue) | task_id |
gateway_paused | sol_zmq_send_recovery | task_id (optional) |
<registration-rejection atom> | sol_zmq_handler_worker (register_worker failure — atom_to_binary/1 of the refusal reason) | retry_after_ms |
There is NO code field on this frame either.
26. ready_required
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "ready_required" |
reason | binary | yes | Why registration is required — closed enum: unregistered (no live registration for the sending identity — the post-VM-restart shape), credential_rotated, evicted |
retry_after_ms | integer | no | Reserved server hint for the client’s re-registration backoff (currently emitted only on the error refusal frames above; absent on this frame today) |
Server-initiated control frame: sent as the
CONTROL-CLASS reply to a heartbeat (or other worker-plane frame) from an
identity with no live registration. The previous silent drop left a
fleet orphaned after a full Sol VM restart — the DEALER transport
auto-reconnects, so the worker’s heartbeats kept flowing while its
registration was gone. Luna answers by degrading connected truthfully
and scheduling a full-jitter re-registration (base seeded by
retry_after_ms when present) that sends a proof-carrying ready (§12 —
fresh nonce + monotonic ctr; the tx watermark is never reset). The frame
is rate-bounded on the send lane (control class: +64 reserve, one retry)
and on the client (exponential ceiling 60s, attempt counter reset on a
successful re-registration).
Builder (Erlang): inline sol_zmq_protocol:encode_message/1 at the
heartbeat refusal arm of sol_zmq_handler_worker.erl, sent via the
control class of sol_zmq_sender:send/3
Handler (Lua): zmq_worker.lua:_on_ready_required/1 (dispatched from the
_handle_frames gate; validated by zmq_protocol.validate_incoming —
reason is required)
28. lane_control_ack
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "lane_control_ack" |
request_id | binary | yes | Echo of the lane_control.request_id |
status | binary | yes | "granted" | "queued" | "refused" (closed enum) |
reason | binary | yes | Bounded refusal label — present on EVERY refused ack, absent otherwise: orchestrator labels (sol_lane_orchestrator:reason_label/1: unknown_lane, staged_not_grantable, no_weights, no_engine, mode_not_allowed, engine_unvalidated, queue_full, cpu_busy, lane_busy, loading_timeout, start_failed, no_capacity, not_allowed_on_host, lane_not_reachable, not_a_local_lane, no_model_for_lane, missing_identity, invalid_request, other) plus handler-level labels (invalid_action, invalid_request, not_owner, unknown_task, missing_lease_id, stale_grant, lease_lane_mismatch, not_running, stop_failed, registry_unavailable, internal_error) |
reason_detail | binary | no | Bounded sanitized refusal detail (e.g. over-ctx numbers; omitted when oversized) |
lane | binary | no | Lane name (granted/queued) |
endpoint | binary | no | OpenAI-compatible base URL http://host:port — no trailing slash, no /v1 (granted only) |
wire_format | binary | no | "openai" (granted only) |
caps | map | no | Lane capability map (granted only) |
ctx | integer | no | Context size (granted only) |
lease_id | binary | no | Live lease handle — the stop/switch authority (granted only) |
expires_at | integer | no | Unix-ms lease expiry (granted only; absent = unbounded mode). : superseded by expires_in_ms when present — kept for previous peers |
expires_in_ms | integer | no | **** — the lease’s REMAINING lifetime measured on Sol’s monotonic clock at descriptor-build time. The worker derives its deadline from receipt time (its own monotonic clock), so a skewed wall clock can no longer flip a live grant to expired or the reverse. 0 = already expired (fail closed); absent = unbounded, fall back to expires_at |
holder | binary | no | The per-grant holder nonce — echoes on stop/switch; the stop/switch authority is bound to the CURRENT grant, not to possession of the shared lease id |
retry_after_ms | integer | no | Present on queued + cpu_busy/lane_busy/queue_full — the caller’s retry seed |
Sent on the control lane (sol_zmq_sender:send/3 class control —
reserve + one-shot retry) by a spawned resolver. queued does NOT grant an
endpoint: the caller surfaces it / retries per retry_after_ms; an expired
lease or a revocation means re-resolve before reuse (a refused re-resolve
surfaces typed, never a silent fallback).
Builder (Erlang): sol_zmq_protocol:build_lane_control_ack_msg/3
Handler (Lua): Luna ack dispatch
29. lane_revoke
Direction: Sol → Luna.
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "lane_revoke" |
lane | binary | yes | The lane whose lease died |
lease_id | binary | yes | The dead lease handle — the worker invalidates the matching live grant (keyed by lease_id) |
reason | binary | yes | "stop" (explicit stop/switch release) | "expired" (idle-release expiry sweep) | "failover" (reserved: cross-node failover) |
retry_after_ms | integer | no | Re-resolve pacing hint for the next task boundary |
The G86 vehicle: an advisory early warning, never the authority —
enforcement stays server-side at the lease chokepoint (a revoked lease is
dead regardless of what any worker believes; the next grant attempt
re-resolves). Worker contract: mark the matching grant dead and FINISH the
current turn — no mid-stream interruption; the next task boundary
re-resolves. Safe for mixed fleets by construction: a previous v4 Luna
logs unknown_message_type and continues; a v3 Luna drops the v4 stamp at
its validator; Sol suppresses the push for pre-v4 targets with a visible
counter + log (zmq_frame_suppressed_total, sol_zmq_lane_revoke:push/4
via target_admits/2). Sent on the control lane from the single lease
release funnel (sol_lane_lease:remove_lease/2 — explicit stop/switch AND
the expiry sweep), addressed to the lease’s registered grant holders
.
Builder (Erlang): sol_zmq_protocol:build_lane_revoke_msg/3-4
Handler (Lua): zmq_worker.lua:_on_lane_revoke
30. permission_request
Direction: Luna → Sol.
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "permission_request" |
task_id | binary | yes | The in-flight task this ask blocks. Sol requires the id to be indexed to the SENDING registration (sol_zmq_ownership:allow_result_frame/4); user_uuid/permissions are derived from the task-store snapshot, NEVER from this frame |
request_id | binary | yes | Worker-scoped ask id (1..128 bytes) — echoed verbatim on the reply |
tool_name | binary | yes | Bare tool name (1..128 bytes) |
input_summary | map | no | Bounded summary — command OR path only (<=4096 bytes each); the raw tool input NEVER rides this frame |
analysis | map | no | {level, patterns} — danger level + bounded pattern labels (never raw input) |
expires_in_ms | integer | no | Ask lifetime (clamped server-side to [1000, 300000]); the worker also enforces its own local deadline and denies typed on lapse |
session_id | binary | no | ** (XS-10)** — the worker-local chat session that originated the ask (1..256 bytes; bounded exactly like Sol’s parser). Sol routes the ask to that session’s operator surface; an unknown/absent session falls back to the operator broadcast, so a sessionless ask is never parked without a surface |
Worker-plane frame: registration + per-frame MAC gated
(sol_zmq_frame_mac:worker_plane_type/1) and classified critical (the
shared criticality manifest — a dropped ask parks the task until its
deadline). Sol registers a sol_permission_registry row and replies with
permission_reply (§31) on resolve, on the operator timeout, or when the
task reaches a terminal state (deny task_finished).
Handler (Erlang): sol_zmq_handler_agent.erl
Builder (Lua): zmq_protocol.lua:permission_request_message/7
Worker → Sol
** ownership enforcement:**
token/result/errorframes are accepted only from the worker thetask_idwas dispatched to (sol_zmq_ownership:allow_result_frame/4— index-owner match; on an index miss the sender must equal the RECORDED executor stamped at dispatch bysol_task_store:get_last_executor/1, a bounded WARNING grace; no recorded executor or a foreign one is refused + counted). The previous “currently registered sender” grace is DELETED — a registered worker cannot claim an executor-less index miss;spawnrequires the sender to ownparent_task_id;event/acp/acp_reply/plugin_tool_call/team_*require a registered worker identity and frame-suppliedfrom/member_idfields are never identity. Dropped frames incrementsol_zmq_auth_failures_total. Gate:zmq_ownership_enforced(default true).
12. ready
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "ready" |
version | integer | yes | Protocol version — the current sol_zmq_protocol:protocol_version/0, or, since then and while zmq_wire_skew_window=true, exactly one below it (the N−1 rolling-upgrade window); anything else is refused (version_mismatch) |
min_version | integer | no | : the field is INTEGER-ONLY — a present non-integer (a float such as 4.0, a string, a map) is refused with the typed malformed_ready class before any version arm (the pre-fix exact-version/N−1 arms returned ok for a float, bypassing the future-min check). Lowest protocol version the worker accepts; a value ABOVE Sol’s version fails the handshake (min_version_too_new) on the exact-version arm AND the N−1 skew arm |
worker_id | binary | yes | Worker identity (also the DEALER routing identity). ** (WIRE-02):** a non-empty binary of at most 256 bytes; any other msgpack term is refused with malformed_ready (the row is never persisted — the operator worker view cannot inherit an unencodable term) |
capabilities | array-of-strings | yes | Worker capability list. ** (WIRE-02):** a bounded array (≤ 256 entries) of non-empty binaries (≤ 256 bytes each); a map/list-key/non-binary term is refused with malformed_ready (details invalid_ready_field:capabilities) |
capability_bits | array-of-strings | no | ** (XS-02)** — the explicit capability epoch that replaced the protocol integer as the feature discriminator. Known bits: frame_mac_v3, cancel_reason, attempt_echo, lane_control. Absent = the version-derived defaults (v4 adds lane_control; v3 does not). An explicit array is AUTHORITATIVE in both directions — a v4 peer may decline a feature and a v3 peer may advertise forward. Sol caps the list at 64 binary entries and stores it on the worker; the dispatcher grants a LANE only when lane_control is advertised (otherwise it skips the grant/consumption and counts lane_capability_skipped_total) |
modes | array-of-strings | no | : bounded — at most 64 entries of at most 256 bytes each (the normalizer walks only the cap; a malformed/over-cap-entry advertisement degrades to []). Agent-mode names this worker can resolve — non-empty binaries. Sol normalizes it (a malformed advertisement degrades to [] with a warning, never a registration refusal) and clamps task-frame mode values against it. Absent/[] = nothing advertised (every requested mode falls back) |
hostname | binary | no | Registering machine’s hostname |
task_id | binary | no | In-flight task being resumed on reconnect |
child_depth | integer | no | Child-spawn depth (bound into the HMAC material; absent = 0) |
key_id | binary | no | Per-worker enrollment key name — absent or "fleet-legacy" selects the shared fleet secret while zmq_fleet_legacy_compat=true; unknown/revoked → registration refused |
nonce | binary | conditional | Fresh registration nonce — REQUIRED whenever a fleet secret or enrollment key is configured ({error, missing_nonce} otherwise) |
ctr | integer | conditional | Monotonic ready counter — u64 wall-clock milliseconds, strictly increasing per identity, freshness-bounded; REQUIRED with a secret configured ({error, missing_counter}), bound into the HMAC material (registration_signed_material/5), refused on replay/staleness (counter_replayed / counter_stale). ** (WIRE-03):** the freshness bounds are ONE clock domain with the frame tx: at most 10 minutes in the PAST and at most 24 hours in the FUTURE (sol_zmq_indexes shared ?REPLAY_FUTURE_AHEAD_MS). A value beyond the future window is refused without persisting; recovery is the signed sol_zmq_indexes:retire_identity/2 reset plus a Luna restart with LUNA_RESET_REPLAY_WATERMARKS=1 (a clock sync alone cannot clear a PERSISTED future floor) |
hmac | binary | conditional | Registration HMAC (see docs/zmq-security.md); REQUIRED with a secret configured ({error, missing_hmac} otherwise) |
sandbox_layers_effective | binary | no | APPLIED sandbox-layer composition telemetry — "bwrap" / "landlock" / "none" / "disabled", optionally with +zero_layer_spawns=<N> and/or +mcp_stdio_containment=active:<N>,fallback:<N>,off:<N>,post_hoc:<N> suffixes; additive optional. Consumption is TOTAL: the enrollment verifier’s parser accepts the four postures, both suffix classes, the legacy probe strings (landlock-abi<N> / unavailable(...)), bare decimal layer counts, and unknown future tokens — an unrecognized base maps to the loud inert posture with its raw name preserved in the posture label, and nothing is silently dropped. The gauge is absolute per {sandbox_effective, WorkerId} and SolLunaSandboxInert pages on the inert posture. Server authorization gates never trust this client-declared value |
mcp_servers | integer | no | : the worker’s LIVE MCP server count (connected + protocol-initialized) at READY time. Additive, telemetry only — Sol normalizes a malformed value to 0 (never a registration refusal) and exposes it via GET /api/v1/zmq/workers; no authorization gate reads it |
mcp_tools | integer | no | : the number of registered mcp__* tool specs at READY time (same normalization/exposure as mcp_servers) |
custom_tools | integer | no | : the number of registered custom tools (discovered from ~/.luna/tools + <workspace>/.luna/tools) at READY time |
models | array-of-strings | no | ** (XSV-13)** — the bounded (64 entries × 128 bytes) model aliases this worker’s provider config can serve (core/zmq_model_capability.collect/0). Sol gates dispatch target selection on it: a READY worker advertising a NON-EMPTY inventory missing the task model is skipped, and a fleet with no capable worker returns the typed {no_capable_worker, Model} pre-dispatch refusal. ABSENT/[] = legacy worker (cannot be gated; the dispatch is counted). Additive, not part of the signed registration material |
capability_degradations | array-of-strings | no | : typed reasons a capability is ABSENT — mcp_approval_required:<server> (a project .luna/mcp.json server denied by the hash-keyed approval gate; fail-closed), mcp_start_deferred:<server> (did not fit the bounded boot start budget; completed at the first task boundary), mcp_start_failed:<server> (start/init/discovery failed). A live server that crashes mid-task is tracked by the telemetry.mcp.server_failed event + Luna’s per-server failure counter (mcp_client.server_failure_count) — the READY census carries start-time state only. Sol filters non-binary/empty entries, caps the list at 32 and exposes it on the worker row; absent/[] = no known degradation |
skills_revision | integer | no | **** — the skill-registry revision this worker last materialized (from skill_sync, §6). Sol compares it against the live registry revision and only pushes the full skill_sync on a mismatch or absence (a matching revision skips the resend). Telemetry-grade: it gates re-sending content, never authorization. Additive, malformed = omitted (always resync) |
settings_revision | integer | no | **** — the managed-settings revision this worker last applied (from settings_sync, §32). Sol compares it against sol_managed_settings_owner:revision/0 and pushes the current snapshot on a mismatch or absence (a matching revision skips the resend). Telemetry-grade: it gates re-sending content, never authorization. Additive, malformed = omitted (always resync) |
team_memberships | array-of-maps | no | : bounded — at most 64 entries; an over-cap or non-list/non-map-entry READY is refused with the typed malformed_ready class BEFORE the per-entry HMAC/registry fan (the funnel also slices defensively). ** T2b** — the version-stamped membership-acceptance countersigns: each entry is {"team_id": <binary>, "sig_version": 1, "hmac": <hex>} where hmac = HMAC-SHA256(the worker's SESSION key, zerg-team-member-v1 || u16be(team_id) || u16be(worker_id)) (sol_zmq_frame_mac:membership_countersign_material/2). Only the real credential holder can produce it, so a verified entry IS the worker’s consent: Sol flips the matching PENDING consent row to granted. Fail-closed posture: an OLD worker (no key) or an anonymous session never activates anything — its pending rows simply stay pending (never a registration refusal); wrong sig_version/shape/binding is counted + warned with the row unchanged. Not part of the registration hmac material (each entry carries its own signature). Vectors: docs/fixtures/team_plane_hmac_vectors.json |
Pre-auth refusal addressing + READY shape.
Every pre-auth READY refusal (malformed_ready, registration_hmac_failed,
protocol_version_mismatch) is delivered ONLY to the identity’s READY-bound
delivering pipe — the same bound_pipe_matches transport proof as the
decode-error echo. A refused READY never creates a binding, so a
first-registration failure is silent to the peer (the log + counter are the
operator surface); a foreign pipe can never make Sol emit a refusal toward a
victim identity. READY worker_id/capabilities are type- and
length-validated before any state write (invalid_ready_field:<field> in
details); a hostile shape cannot 500 GET /api/v1/zmq/workers.
Builder (Lua): zmq_protocol.lua:ready_message/2-6 (stamps v + version; material v2 carries ctr when a secret is present)
Handler (Erlang): sol_zmq_handler_worker.erl (registration: HMAC,
enrollment, nonce LRU + monotonic ctr, adoption proof) + sol_zmq_protocol:validate_ready_msg/1
13. heartbeat
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "heartbeat" |
worker_id | binary | yes | Sender identity |
Liveness frame sent every 5s while connected ( — a plain heartbeat;
the ONE config-gated exception is the idle re-ready,
LUNA_ZMQ_REREADY_IDLE_MS, — a fully signed registration,
idle-only, default OFF). Requires CURRENT registration — an unregistered
identity’s heartbeat is refused + counted and, since then
answered with the typed ready_required control frame (§26) —
the pre-fix silent drop left workers orphaned after a Sol VM restart. On
success it refreshes the worker’s last_seen (touch_worker); for a busy
worker it ALSO refreshes the current task’s ownership-index liveness
timestamp (touch_task — a long-running task never ages into the 1h
sweep) and renews the workflow bridge-correlation lease
(sol_workflow_bridge:renew_correlation/1).
Builder (Lua): zmq_protocol.lua:heartbeat_message/1
Handler (Erlang): sol_zmq_handler_worker.erl (heartbeat → liveness touch)
14. token
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "token" |
task_id | binary | yes | Task ID |
content | binary | yes | Token text |
seq | integer | no* | Per-task monotonically increasing token sequence. Stamped at BUILD time by the caller’s per-task counter (zmq_protocol.lua:token_message/3 includes it when non-nil); retransmits re-send the same encoded payload, so seq is monotonic across retransmits. Sol REQUIRES it from a v2 worker — a seq-less token frame is a protocol violation (sol_zmq_handler_worker.erl stores it without gap tracking, never drops it). The gap detector (truncated flag + counters) lives in the token store |
attempt | integer | no | ** (WIRE-05)** — the dispatch retry epoch of the stream (same field/contract as §15/§16). Absent = 1; a frame whose attempt is LOWER than the current dispatch attempt is REFUSED before the lease renewal and the store append (zmq_stale_attempt_dropped_total), so a dead attempt’s text never joins the transcript. Rows are keyed {task_id, attempt, seq} and an attempt reset (seq 0) reaps the prior attempts’ transcript AND expected-seq rows. A higher attempt is not refused |
Builder (Lua): zmq_protocol.lua:token_message/2-3
Handler (Erlang): sol_zmq_handler_worker.erl (result-plane ownership gate allow_result_frame/4; seq rides through to the store)
Token content is server-side bounded at 1 MiB (1048576 bytes,
?TOKEN_MAX_CONTENT_BYTES, ): an oversized token is refused
with an explicit error frame carrying reason: "token_too_large" — never
silently truncated.
15. result
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "result" |
task_id | binary | yes | Task ID |
status | binary | yes | "ok", "cancelled", "completed", "error" — the closed allowlist; anything else is coerced to "error" server-side. "timeout"/"crashed" are SERVER-WRITTEN only, never worker-sent |
content | any | yes | Result content |
user_uuid | binary | no | Worker user identity — never trusted |
attempt | integer | no | ** (WIRE-04)** — the dispatch retry epoch of the execution that produced this terminal (same bounded integer as the task frame, 1..2147483647). Luna stamps it from the executing task context; unknown omits the field (never fabricated). Sol treats absent/malformed as 1 and refuses a terminal whose attempt is LOWER than the current dispatch attempt (stale-attempt result: never stored/counted as completed). A HIGHER attempt is NOT refused (the documented forward-compatible contract); the store’s first-terminal-write rule still governs |
usage | map | no | ** (XSV-03)** — the additive settlement rider {input_tokens, output_tokens, cache_creation_tokens, cache_read_tokens} (non-negative integers; an all-zero block is treated as absent). Sol settles exactly once per {task_id, attempt}. |
model | binary | no | The model that actually served the turn (rides with usage). |
Builder (Lua): zmq_protocol.lua:result_message/4-5 (opts.attempt is the additive stamp; opts.usage/opts.model are the settlement rider)
Handler (Erlang): sol_zmq_handler_worker.erl (result-plane ownership gate allow_result_frame/4)
16. error
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "error" |
task_id | binary | yes | Task ID |
error | any | yes | Error description |
attempt | integer | no | ** (WIRE-04)** — the same executing dispatch attempt as the result frame; Sol’s one current-attempt gate applies identically. Absent = 1; LOWER than the current attempt is stale (refused + counted); a HIGHER attempt is not refused |
usage | map | no | ** ** — the SAME additive settlement rider as the result frame. A failed turn that burned tokens settles even when its row write loses to a server cancel/timeout. |
model | binary | no | The model that actually served the turn (rides with usage). |
There is NO code field on the wire error frame — the builders
(zmq_protocol.lua:error_message/2-3, sol_zmq_protocol:build_error_msg/2)
emit exactly these keys (plus v, and the optional additive attempt/usage/model).
Builder (Lua): zmq_protocol.lua:error_message/2-3
Handler (Erlang): sol_zmq_handler_worker.erl (result-plane ownership gate allow_result_frame/4)
16a. usage (worker → Sol)
** (XSV-03):** the usage-ONLY terminal rider for an attempt
resolved by a server timeout-cancel. The retry owns the task row, so Luna
emits no result/error (which could freeze the row) — just the attempt’s
provider spend. Sol settles it without writing the task row.
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "usage" |
task_id | binary | yes | Task ID |
usage | map | yes | The same sanitized token block as the result/error rider (all-zero blocks are omitted, never sent) |
model | binary | no | The model that served the attempt |
attempt | integer | no | The interrupted dispatch attempt (absent = 1) |
Builder (Lua): zmq_protocol.lua:usage_message/4
Handler (Erlang): sol_zmq_handler_worker.erl:handle(<<"usage">>,...) — ownership-gated, settlement only (no store write)
17. spawn
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "spawn" |
parent_task_id | binary | yes | Parent task ID (ownership-gated: must be dispatched to the sender) |
prompt | binary | yes | Child prompt |
model | binary | no | Model override |
opts | map | no | Spawn options. Carries the parent trust posture additive keys: permission_mode (ceiling-clamped; Sol’s dispatcher forwards it onto the child task frame) and permission_rules |
user_uuid | binary | no | Requesting user identity propagated to the child — Luna ALWAYS emits it (defaulting to "system", zmq_protocol.lua:spawn_message/5); Sol’s builder keeps it only when a non-empty binary (sol_zmq_protocol:build_spawn_msg/3) |
allowed_tools | list | no | Tool restrictions |
cache_context | map | no | Cache context |
permissions | list | no | RBAC permissions for the child — always present (possibly empty) since then |
async | boolean | no | True if background spawn (fire-and-forget) |
There is NO task_id field on the spawn frame (removed from the spec
): the server assigns the child id, which the worker learns
from spawn_ack.child_task_id. Child spawns consume a license seat.
Builder (Lua): zmq_protocol.lua:spawn_message/5, spawn_async_message/5
Handler (Erlang): sol_zmq_handler_agent.erl (spawn parent binding in sol_zmq_bg_task:start/5)
18. cancel_task
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "cancel_task" |
task_id | binary | yes | Task to cancel |
Worker-initiated cancellation of one of its own tasks (own-task-only gate — ).
Builder (Lua): zmq_protocol.lua:cancel_task_message/1
Handler (Erlang): sol_zmq_handler_agent.erl (ownership gate in sol_zmq_bg_task:kill/3)
20. event
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "event" |
event_type | binary | yes | Event type name — namespace CLOSED to telemetry.* and agent.* diagnostics; core state events (task.*, workflow.*, team.*, scheduler.*, model.*) from ZMQ workers are dropped + counted |
data | map | no | Event payload — ALWAYS emitted by Luna (defaults {}, zmq_protocol.lua:event_message/3); caller-supplied user_uuid stripped server-side |
task_id | binary | no | Associated task — ALWAYS emitted by Luna (defaults ""). For agent.child_completed this MUST be the SERVER child task id (a dispatched id), never a client-local background id: Sol resolves the aggregate against the dispatch index. A background child may execute on a DIFFERENT worker than the parent, so the gate also accepts the server-recorded child→parent relationship when the sender owns the parent; a legacy client-local id is accepted only with a frame parent_task_id the sender owns, and the aggregate is re-stamped to that server parent id |
Builder (Lua): zmq_protocol.lua:event_message/3
Handler (Erlang): sol_zmq_handler_agent.erl (event allowlist)
21. acp
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "acp" |
acp_type | binary | yes | "request", "response", "notify" — "notify" is accepted and acknowledged with no reply (sol_acp_router.erl → {ok, notified}) |
request_id | binary | no | Correlates request/response pairs |
from | binary | no | Sender identity — DISCARDED; attribution always uses the socket-bound routing identity |
user_uuid | binary | no | ** (WIRE-06): REFUSED/STRIPPED** — the ACP plane carries no user principal. Sol removes the key at the handler and in the forward builder (sanitize_acp_forward_payload); Luna’s idle agent always runs under its per-connection anonymous scope (anon:<worker_id>). A frame value can never select another user’s memory/audit scope |
| … | map | no | Remaining map keys forwarded as the ACP payload. acp_type=capability: the from AgentId MUST equal the verified routing identity (WIRE-07) — a conflicting claim is refused agent_id_mismatch; the registry refreshes last_seen on every routed/delivered request so a live agent never expires |
Agent-to-agent messaging; dispatched to sol_zmq_handler_agent, which
routes to the target agent (local or remote) and can reply with an
acp_reply or acp_discover_reply.
Builder (Lua): sent raw by the worker (no dedicated builder)
Handler (Erlang): sol_zmq_handler_agent.erl (ACP frame routing; requires registration)
22. acp_reply
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "acp_reply" |
worker_id | binary | yes | Responding worker |
request_id | binary | yes | Original request ID (must match a request actually ZMQ-forwarded to this identity) |
response | any | yes | Response content |
error | any | no | Error description |
timestamp | integer | yes | Unix timestamp |
Builder (Lua): zmq_protocol.lua:acp_reply_message/4
Handler (Erlang): sol_zmq_handler_agent.erl
23. plugin_tool_call
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "plugin_tool_call" |
task_id | binary | yes | Task the tool call belongs to (ownership-gated) |
tool_name | binary | yes | Plugin tool name (plugin__<plugin>__<tool>) |
input | map | yes | Tool input arguments |
Worker requests a Sol-side plugin tool execution (Luerl bridge dispatch).
Builder (Lua): zmq_protocol.lua:plugin_tool_call_message/3
Handler (Erlang): sol_zmq_handler_agent.erl (ownership-gated)
24. team_heartbeat
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "team_heartbeat" |
team_id | binary | yes | Team identifier |
member_id | binary | yes | Worker identity — liveness is recorded for the SENDER’s registered worker, never the frame-supplied member_id |
status | binary | no | "active", "idle", "busy" |
load | number | no | Current load factor |
Requires registration AND team membership of the sender’s registered
worker_id.
Builder (Lua): zmq_protocol.lua:team_heartbeat/4
Handler (Erlang): sol_zmq_handler_team.erl
25. team_mail
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "team_mail" |
team_id | binary | yes | Team identifier |
from | map | no | Sender struct {kind, id} — kind = "worker"|"user", id = binary. ADVISORY on this direction: Sol derives the struct from the verified registration (kind worker); a frame-supplied value is never identity |
to | binary | no | Recipient — member worker_id, member tm_* id, member user_uuid, or "all" (default). Resolved-and-stamped at send time: storage keeps the canonical form (to is ALWAYS a worker_id or all after resolution); unresolvable values are refused loudly |
body | map | no | Mail content |
subject | binary | no | Optional mail subject — Luna stamps it from body.subject (zmq_protocol.lua:team_mail/5); Sol’s ZMQ handler currently ignores it (no server-side consumption) |
priority | binary | no | "normal", "high", "low" |
Requires registration AND team membership.
Sender struct + reply-to semantics: mail is
cross-identity — the stored struct {kind, id} is typed by ORIGIN
(worker = ZMQ registered sender; user = HTTP authenticated caller). A
recipient replies by sending new mail with to = the received struct’s
id; the server resolves it (user uuid → that user’s member row
worker_id; no member row → loud refusal — unroutable_to on HTTP, a
refusal log + drop on ZMQ).
Builder (Lua): zmq_protocol.lua:team_mail/5 (sender_struct/1 pins the
shape)
Handler (Erlang): sol_zmq_handler_team.erl
27. lane_control
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "lane_control" |
request_id | binary | yes | Worker-scoped request id (1..128 bytes; generated per attempt). Idempotency key: namespaced {worker_id, request_id} server-side, so two workers with the same wire id never share a cache row; a replay with the same id while the first is in flight is deduped, a retry with a new id replaces the in-flight resolver |
action | binary | yes | "resolve" | "start" | "stop" | "switch" | "refresh" | "release" — resolve/start run the full sol_lane_orchestrator:request/2 (bounded queue wait + ready budget; start is the explicit-wait alias); stop/switch/refresh/release require a live lease_id |
task_id | binary | no | Required for resolve/start (ownership binding; the id must be indexed to the SENDING registration via sol_zmq_ownership:task_sender/2; user_uuid/permissions come from the task store, NEVER from this frame). Optional echo for refresh/release; their identity comes from the task-anchored grant holder |
lane | binary | no | Explicit lane pin (existing-atom only; unknown → typed refusal). For stop/switch it must match the lease’s lane |
requirements | map | no | Capability-router vocabulary — flat requirements; Sol does the matching, Luna never routes |
mode | binary | no | "on_demand" (default) | "attended" | "duration" | "cron" |
ttl_ms | integer | no | Lease TTL for duration/cron modes |
lease_id | binary | no | REQUIRED for stop/switch/refresh/release — the live grant handle |
holder | binary | conditional | Required for refresh/release and task-less switch/stop — the holder nonce minted with the task-anchored grant. It gates the action; a missing/mismatched holder is not_holder/stale_grant. Never an identity source |
Session actions. An editor holds one lease across turns: the
first resolve/start is task-anchored and records the holder; refresh
renews under the lease’s own mode and replies receipt-relative
expires_in_ms/expires_at; release tombstones the holder and re-arms the
idle clock without stopping a shared lane; task-less switch/stop derive
their identity from the holder. Expiry is a typed stale_grant — the client
re-requests, never silently falls back. Audit actions:
lane_session_refresh|release|switch|stop (acquire keeps
lane_granted/lane_lease_acquired).
Worker-plane frame: registration + per-frame MAC gated (worker_plane_type/1),
and classified critical (never shed — the send lane retransmits it).
The reply is asynchronous (lane_control_ack, §28) — the gateway never
blocks; resolve/start may wait the configured queue/ready budgets in a
spawned resolver.
Handler (Erlang): sol_zmq_handler_lane.erl (frame router)
Builder (Lua): zmq_protocol.lua:lane_control_message/4
31. permission_reply
Direction: Sol → Luna.
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "permission_reply" |
request_id | binary | yes | Echo of the permission_request.request_id |
decision | binary | yes | "allow" | "deny" | "always" (closed enum — always alone may persist in the worker’s 600s cache) |
reason | binary | no | Bounded decision label (operator_allow/operator_deny/operator_always/timeout/client_gone/worker_gone/task_finished) |
Sent on the control lane (sol_zmq_sender:send/3 class control). Luna
validates the closed decision enum and hands the answer to the parked
permission hook by request_id; an unknown/expired id is dropped loudly.
Builder (Erlang): sol_zmq_protocol:build_permission_reply_msg/3-4
Handler (Lua): zmq_worker.lua:_on_permission_reply/1
Status Values (result frames)
| Status | Meaning |
|---|---|
"ok" | Success (worker result frame) |
"error" | Failure — a worker result frame with a non-allowlisted status is coerced to "error" server-side |
"completed" | Success (worker result frame) |
"cancelled" | Task was cancelled (worker result frame) |
"timeout" | Task timed out — server-written only (worker result frames never carry it; the gateway’s task_timeout_ms expiry writes it) |
"crashed" | Worker crashed — server-written only |
Worker result frame status allowlist = ok|cancelled|completed|error
. timeout/crashed are server-side
terminal rows.
Ownership & Registration Semantics
Registration authentication: shared fleet secret
(SOL_ZMQ_WORKER_SECRET, ≥ 16 bytes) or per-worker enrollment keys
(zmq_enrollment_keys + key_id, preferred) — HMAC-SHA256 over
nonce || u16(len(identity)) || identity || u16(len(worker_id)) || worker_id || u32(child_depth) || u64(ctr) with constant-time compare; nonces are
replay-protected (per-identity LRU, 60s TTL, survives gateway restarts).
Full material: docs/zmq-security.md (§Worker Registration).
Non-loopback binds refuse open registration (prod): secret required —
{refuse_boot, zmq_secret_required}; loopback binds keep the dev posture.
Result-plane ownership: allow_result_frame/4 — index-owner match;
on an index miss the sender must match the RECORDED executor stamped at
dispatch (sol_task_store:get_last_executor/1, bounded WARNING grace);
no recorded executor or a foreign executor is refused + counted. The
previous “currently registered sender” grace is DELETED. A registered
worker cannot create synthetic tasks: writes for task ids with no
ownership-index entry, no sol_task_results pending row and no
dispatch-queue seat are rejected. Terminal states reject all later writes.
Event namespace closed: only telemetry.* / agent.* diagnostics
from ZMQ workers; core state events are HTTP/internally sourced.
Spawn parent binding: spawn/plugin_tool_call frames require the
referenced task to have been dispatched to the sending worker; cancel_task
is own-task-only.
Orphan results: a result/error frame for a task the
server no longer knows (post-restart, row + index + queue seat lost) is
stored in the bounded orphan-results store (queryable by task id), counted
in orphan_result_total (CRITICAL log), and acked so the worker’s
retransmit queue drains. Tokens are stored without ack (Luna never
retransmits tokens).
Loss Policy
Version provenance:, shed-set truth; shared manifest.
Under mailbox high-water-mark backpressure only true diagnostics are shed:
Critical frames (sol_zmq_recv_dispatcher:is_critical_type/1) are
never dropped at either the recv dispatcher or the gateway: result,
error, ready, cancel_ack, child_result,
token, heartbeat, spawn, cancel_task, and the coordination set
team_directive, team_mail, team_heartbeat, acp,
plugin_tool_call ( — these were shed as diagnostics
contrary to the documented policy; they are round-trip/liveness frames
and joined the critical set, the fixture, and Luna’s EAGAIN critical
lane; / retired the worker→Sol log + plugin_tool_result
rows with their frames).
Droppable under load: event frames whose event_type has the
telemetry. prefix (no producer emits a bare telemetry type — telemetry
rides event frames, ), and acp_reply (a reply
frame whose caller-side timeout governs — kept shed-eligible so a paused
mailbox is never held for replies the caller has already abandoned).
While the gateway is paused on HWM it synthesizes liveness touches for
registered workers (heartbeat is liveness — dropping it would evict the
fleet); any frame the paused gateway still sheds is NACKed with an
explicit error frame.
Shared send-criticality manifest: the critical /
droppable classification for every worker-sendable frame type is pinned
byte-for-byte by docs/fixtures/zmq_send_criticality.json, consumed by
BOTH sides — Sol’s recv dispatcher boot-refuses on drift from its
hardcoded classes (sol_zmq_recv_dispatcher:verify_send_criticality/0),
and Luna’s EAGAIN send-lane table (client/core/zmq_protocol.lua
SEND_CRITICAL_TYPES, consumed by zmq_worker:_send) is pinned by
client/tests/test_zmq_send_criticality.lua. The manifest’s birth killed
the cancel_task lane omission (a dropped child-cancel under EAGAIN
backpressure stranded the child running silently).
Sender Bounds
Sol’s per-identity app-layer outbound bound (zmq_sender_outbound_bound,
default 512 sends / 60s sliding window) admits every send through a class:
| Class | Budget | Over-budget | Send failure | Frame classes routed here |
|---|---|---|---|---|
data (default) | the bound | dropped LOUD (WARNING + zmq_sender_outbound_dropped_total) | logged + zmq_send_failures_total | task, child_result, team_mail_push, acp_forward, acp_discover_reply, plugin_tool_result replies, generic error replies |
telemetry | the bound | same as data | same as data | diagnostics |
control | bound + 64 reserve | journaled frames are RETAINED and replayed (only the binding outbound counter advances); unjournaled drops are CRITICAL and bump BOTH drop counters | exactly ONE retry (?CONTROL_RETRY_MS); a journaled frame stays outstanding for replay on restart/READY, an unjournaled final failure is a CRITICAL drop (zmq_control_send_dropped_total) | spawn_ack, cancel, cancel_ack, skill_sync, team_directive |
send_sync/2 is intentionally NOT budget-bound: its callers receive
{error, _} and the gateway requeues — flow control exists at that layer.
Per-Frame MAC
Worker→Sol worker-plane frames (token, result, error, heartbeat,
team_directive since then ) AND the extended
agent/team plane (spawn, event, acp, acp_reply, team_heartbeat,
team_mail,; joined by cancel_task,
plugin_tool_call in — same
extended plane, same material-v3 tx binding; the set is pinned
byte-for-byte in docs/fixtures/zmq_frame_mac_sets.json; /
removed log/plugin_tool_result with their frames) from
credentialed sessions carry a trailing multipart MAC frame —
[payload, mac_hex] — over the exact
payload bytes
with the routing identity AND the per-session monotonic tx counter bound
in (material v3, "Z3"); Sol verifies pre-handler in the frame router and
refuses replayed tx values per identity. Full contract (material,
session-key derivation, mode lever zmq_frame_mac, the
zmq_frame_mac_legacy fleet-legacy window,
identity pinning of duplicate-identity conflicts, plane coverage):
docs/zmq-security.md → “Per-Frame MAC
Plane”. ready is covered by its own registration HMAC above. The
tx key is additive on the v3 wire (old peers ignore it); the cross-language
vectors live in docs/fixtures/zmq_frame_mac_vectors.json.
team_directive additionally carries the
enrollment-bound content signature + leader attribution documented in
§7 (Sol→Worker direction).
32. settings_sync
Direction: Sol → Luna.
| Field | Type | Required | Description |
|---|---|---|---|
type | binary | yes | "settings_sync" |
settings | map | yes | The current managed-settings snapshot — the same JSON-safe map the HTTP GET serves |
revision | integer | yes | The Sol managed-settings revision at push time (monotonic per Sol boot, seeded from wall clock so a restart always mismatches) |
The PUB plane is best-effort and a reconnecting worker (slow joiner) can
miss managed_settings_update. READY carries the revision the worker last
applied (settings_revision, §12); Sol pushes this frame over the reliable
ROUTER plane on a mismatch/absence (the skill_sync revision
precedent). Luna applies the snapshot to core.managed_config (cache +
next-task reads) and records the revision, so the next READY matches.
PUB class disposition: managed_settings_update is state
(newest snapshot wins; a full-queue preemption evicts an ephemeral frame
first), circuit.* and workflow.compensation are ephemeral
(in-flight work re-derives them / the server circuit plane is
authoritative), all other topics are telemetry. Per-class drop
counters make a stalled subscriber’s blast radius visible; the PUB HWM and
linger knobs are INERT on chumak 1.5.0 and named once at boot (the real
bound is the bounded queue + per-frame send timeout).
Builder (Erlang): sol_zmq_protocol:build_settings_sync_msg/2-3
Handler (Lua): zmq_worker.lua:_on_settings_sync/1 → core.managed_config.apply_sync/2
Test-Only Messages
These builders exist in sol_zmq_protocol.erl inside -ifdef(TEST). and
are not used in production:
| Message | Builder | Purpose |
|---|---|---|
| team_create | build_team_create_msg/3 | Team creation notification (deprecated — HTTP API) |
| team_mail | build_team_mail_msg/5 | Team mail (deprecated) |
| team_heartbeat | build_team_heartbeat_msg/4 | Server→Worker heartbeat (Luna→Sol heartbeat is #13) |
| plugin_tool_call | build_plugin_tool_call_msg/3 | Server-side plugin dispatch (the Worker→Sol plugin_tool_call is frame #23) |
Protocol Version
Sol constant: sol_zmq_protocol:protocol_version/0 (= 4, since then
the v3 → v4 bump introduced the task-frame
inference_binding lane-grant stamp and the lane_control /
lane_control_ack round-trip (§27/§28); the v2 → v3 bump before it
carried the team_directive leader attribution + content signature
fields and the team_directive MAC-plane extension;
the v1 → v2 bump before that carried the token seq frame,
)
Luna constant: zmq_protocol.lua:M.VERSION (= 4)
ready.version must equal the gateway’s protocol version, or (while
zmq_wire_skew_window=true) exactly one below it; ready.min_version
above it fails the handshake on the exact-version arm (the N−1 arm does
not bound it — ); every frame carries v (absent = v1).
A mismatch is logged and the connection is rejected (never silently
downgraded) — v2 and older are refused loudly; v3 is admitted only
inside the N/N−1 window ( STRICT-FORWARD; skew window;
v4 bump). Upgrade posture for v4 is stop-then-upgrade: a v3
Sol drops lane_control silently, so lane consumption requires both
ends at v4.
The ready-handshake examples in docs/worker-integration.md and
example/python/zmq_worker.py are pinned to the CURRENT constant by
ci/wire_doc_parity_lint.py (the pin parses ?PROTOCOL_VERSION — a
bump without the examples fails CI).