- Reject strict live/file observation destinations before opening a session: a rejected destination no longer writes a partial JSONL stream or snapshot. - Remove a previous `check --emit` artifact when the project cannot be loaded, not only when it has compile errors, so a consumer can never bind a run to a stale Analysis document. - Report the concrete `fs.exists|metadata|list|mkdir|remove|rename` effect operation instead of collapsing all six into `resource.request`. - Preserve the plugin ABI frame codes through the shared worker transport: an over-limit frame is `worker_frame_too_large` and an encode failure is `worker_encode_failed`, not a generic `worker_frame_invalid`. - Give the event and snapshot schemas the same capture `level` enum and document the levels in spec/observation.md. - Add a regression test for each fix.
4.6 KiB
Marqdo Observation
run and call execute once through the interpreter and capability Host.
The Host emits typed observations at execution boundaries. The CLI assigns
one run ID and one sequence and serializes each public event once.
marqdo call index.mq.md calculate --arg n=3 --output jsonl
marqdo call index.mq.md calculate --arg n=3 --output json
marqdo call index.mq.md calculate --arg n=3 --output jsonl --observation-file run.json
marqdo check index.mq.md --emit analysis.json
Text is the default output. JSONL flushes each event to stdout as it occurs.
JSON writes one snapshot to stdout after the run. --observation-file
atomically publishes a snapshot through a private temporary file in the
destination directory. On Unix the published file is private to the caller.
Every destination in one invocation receives the same events. Diagnostics
use OS stderr. Captured program stdout and stderr are byte events, with
standard padded base64 and a decoded byte count. Both may contain sensitive
program output. Machine destinations refuse in-process native plugins.
Strict mode supports text and JSON stdout through its isolation supervisor.
Live and file destinations are rejected in strict mode.
Event contract
Each object has schema: "marqdo.observation", schema_version: 1, an
opaque run_id, zero-based contiguous seq, kind and payload. See
the event schema for the exact
fields. Reject other format identifiers, unknown kinds and invalid payloads.
stream.openedis first, with producer, capture policy and budget limits. The capture level isbase(lifecycle only),structural(frame, branch, loop and effect events) orvalues(explicitly selected names); the snapshotcapturemetadata repeats the same level.run.startedbinds an entry, mode and source.source.root_idandsource.analysis_digestidentify the exact Analysis JSON emitted bycheck --emitfor the same project and static options. The digest is SHA-256 over the file bytes, including formatting. Before highlighting a source span, validate the binding, module source digest and original UTF-8 half-open byte range. A changed source or Analysis invalidates attribution.call.enteridentifies the call instance and its parent.call.exitcloses that same instance. Call carriers belong to the caller module. Parameter spans identify declarations in the called module.branch.eval,loop.iteration,control.break,control.continue,returnandeffectrecord actual execution in order. An effect includes its operation, result code and source location where available.parameter.observedandvariable.assignedcarry names, types and source locations. Values are omitted by default. Select exact names with--observe-parameterand--observe-variable. Selected Text also requires--observe-text-values. The same consent applies to file and stream. Only supported scalars are recorded. Memory, resources and plugin handles are never included.observation.truncatedreports the first exhausted observation budget. Structural and selected-value events may stop at that point. Lifecycle and committed byte chunks remain subject to their own execution and output limits. The interpreter continues under unchanged program limits.run.completedcontains the explicit return using Value Wire. A result containing a non-transferable handle has a null wire value and identifies its type. An explicit result, like a program print, can itself contain sensitive data.run.failedfollows a started run and contains the error.run.rejectedreports failure before start. A complete run has exactly one terminal event, last. EOF or interrupted delivery without a terminal is incomplete.
Snapshot contract
The snapshot schema describes a
JSON object with the same format identifier, run metadata, capture
metadata, and events validated against the event schema. The run.id
matches every event, run.source matches the start event or is null,
and run.status agrees with the terminal. capture.truncated matches
the truncation event or is null. A supervisor that cannot obtain complete
child output may report an incomplete stdout snapshot without a terminal.
An interrupted file write does not replace the previously published file.
EOF during an interrupted stream can leave a partial final line.
Validate schema, sequence, lifecycle and source binding before using the artifact. A structurally truncated run has a terminal but lacks some execution events. An incomplete delivery provides no evidence about the final execution outcome.