A cap’s handler says what it gave, and a run carries it on
A response stream opens with a default label: for a cap’s main output, what its effect gives for its declared input; for another output, that output’s own media URN. A handler may now state a narrower one before the stream starts, saying what it actually gave, such as the shape a file it wrote reads back as:
- Rust
OutputStream::label, GoStreamEmitter.Label, Pythonlabel, Swiftlabel(_:). - The main output of a
declaredcap takes a label inside its declaredout=read complete; another output takes one inside its own media URN. - The main output of an
effect=noneoreffect=patchcap, and an output that carries its input, take none: their type is fixed by what they were fed. - A label outside what the output allows, or stated after the stream started, is refused, naming both labels, and nothing is sent.
- A sequence carries one label for the whole stream.
CapUrn::declared_output_holds (Go DeclaredOutputHolds, Python declared_output_holds,
Objective-C declaredOutputHolds:error:) answers whether a label lies inside what a declared cap
gives, by the same rule.
The in-process host’s emit_response, emit_response_with_meta and emit_list_response take an
optional label in place of a media URN string (Go EmitResponse(label *urn.MediaUrn, …), Python
emit_response(label, …), Swift emitResponse(label:…)). No label sends the default. A label the
served cap does not allow is answered with HANDLER_ERROR naming both.
The engine keeps each value’s label from step to step:
- A step’s output: for a declared output, the label the handler sent, once audited. For an
effect=noneoreffect=patchstep, what its effect makes of the label of what it was fed. - A pipelined hop: checks that label, not the wire’s, against the next step’s input, and hands it on.
- A run’s inputs: each is labelled with the type its input slot states.
- A run’s result: each output names the label of the value that reached it, which must lie inside the plan’s type for that node.
In the Rust library this shows as:
ResponseAudit::value_labelandTerminalOutput::label;CollectedOutputgainslabel, andDagOutputgainsnode_label;- a persisted writer’s
media_urn, which is the label of what it wrote.
A host that opens a live feed through a cartridge sends the opening cap the live reference labelled as itself.
Input and output (13.2), cap URN structure (06), execution (15.2) and the frame protocol’s STREAM_START (12.2) describe the label, in English and Italian.
Saving content whose shape only detection decides
Fabric manifest 15 publishes six save caps:
save-as-json,save-as-yamlandsave-as-ndjsontake JSON, YAML or NDJSON content of any shape.save-as-json-list,save-as-yaml-listandsave-as-ndjson-listtake a list whose items are not records.
Each gives its file type with only what detection reads from the content left open:
- a generic JSON or YAML save gives
…;?list;?record; - a list save gives
…;list;?record, since an empty list is a list of records; - NDJSON always reads back as a list.
A plan from a list of scalars, from repaired JSON or from an LLM text stream therefore ends on each file type the content may be. Content cartridges (16.4) lists every save cap and what it gives.
The data cartridge bundled with this release serves the save caps of one shape, not these six: a
plan through one of them finds no cartridge to run it. The data cartridge that serves them comes
with the next bundle of the CLI, and labels each file it writes with the type it reads back as: a
generic JSON save of [1,2] gives media:enc=utf8;ext=json;fmt=json;list, and of 42
media:enc=utf8;ext=json;fmt=json.
The libraries, and the cartridges capdag dev new scaffolds, are built for fabric manifest 15.
A target is a search over what routes give
A target is read open. Every route whose result is inside it reaches it, and none whose result may fall outside it:
capdag plan rec.yaml --to media:ext=jsonlists the machines that make a JSON file of any shape, a record or a list among them, where a--tothat several file types fit was refused.- From a YAML record,
--to media:enc=utf8;ext=json;fmt=json;recordlists the save of a record and not the save of JSON of any shape, which may write a list. - No file type is chosen among those inside a
--to, andplanno longer says which one a--toof a kind was taken as (thetorecord under--jsonis gone).
The machines, and the routes the planner finds in every library, are listed nearest to what was
asked first, as dispatch ranks caps: a result exactly as specific as the target, then the nearest
more specific, then the nearest less specific. Routes as near come with fewer steps first, then
with the more specific caps. From a YAML record, the routes to media:enc=utf8;ext=json;fmt=json
list the save of JSON of any shape, then the save of a record, then the save of a list of records.
--pick 1 is the nearest. The proved model decides the order: routes_in_order (Go
RoutesInOrder, Python routes_in_order, Objective-C routesInOrderTo:caps:gives:).
Each route found names what it gives, the media its last step gives, as its target media URN: inside the target, and not always the target itself.
The Go, Python and Objective-C planners step through a cap by what it gives for what it is sent, as
the Rust planner does: an effect=patch cap keeps what it does not change, so JSON to YAML sent a
JSON list of records gives a YAML list of records, and a route on to a save of a YAML list of
records is found, where they took the cap’s declared output and found none. The planner (15.4) and the CLI reference (18.1)
describe it, in English and Italian.