Skip to main content

Module data

Module data 

Source
Expand description

/v1/data/* endpoints (v9 Big Response handling, Store-owner direct path). HTTP /v1/data/* endpoints (v9 Data path, for Big Response handling).

Thin HTTP wrapper that lets SubAgents push Big Responses (4k-token-scale bodies / intermediate artifacts / file paths) directly to the Store owner, bypassing the MainAgent. The Store implements mlua_swarm::store::output::OutputStore (default = InMemoryOutputStore). This module never touches the Engine core or the Domain path (/v1/worker/result / submit_output / output_tail / dispatch verdict) — it is the boundary point that physically wires the Data / Domain separation axis. For the canonical narrative, see mlua_swarm::store::output module docs.

§Routes

  • POST /v1/data/emit — body {task_id, attempt, producer_agent, event, parent_refs?} → calls OutputStore.append and returns {out_id}. The MainAgent only needs to receive an out_id ref (avoids context bloat).
  • POST /v1/data/:name — same body minus producer_agent (the path segment is the producer name); the write-side twin of name addressing.
  • GET /v1/data/:keykey is an out_id (out-<10hex>) or an out_name (producer agent name → latest emit). Id lookup first, name fallback. Used by the next Spawn’s $IN_REFS to fetch.

§Auth (single-mouth contract)

Every emit requires a worker CapToken, carried either as Authorization: Bearer <token> or ?token=<token> (same token material — the transport is the caller’s choice). The token passes the Verb::EmitOutput gate and is verified against the body’s task_id. The former split surface (/v1/data/emit unauthenticated + /v1/data/emit-auth Bearer) was collapsed into this single mouth (the emit-auth API consolidation): expressing auth as endpoint forks multiplies the API surface without adding capability. How far to tighten GET (and token scoping in general) is deferred to the security-hardening pass after dogfooding.

Structs§

DataEmitNamedReq
Input for POST /v1/data/:name (name addressing — producer_agent comes from the path segment, not the body).
DataEmitReq
Input for POST /v1/data/emit.
DataEmitResp
Response for the emit endpoints.
TokenQuery
Auth-carrying query params (?token= — the header-less twin of Bearer).

Functions§

data_emit
Handler for POST /v1/data/emit (single mouth, auth required).
data_emit_named
Handler for POST /v1/data/:name (name addressing, auth required).
data_get
Handler for GET /v1/data/:key (key = out_id, falling back to out_name).