observation: deliver one execution event sequence to stream and snapshot
This commit is contained in:
1 parent
f83d992c61
commit
404d559b86
97 files changed
+2672
-3128
No files matched your search
+11
-3
@@ -32,6 +32,14 @@ minimum. Linux x86_64 on glibc 2.39 is the candidate platform. The
|
||||
candidate SHA before publication. The release record below refers to the
|
||||
published beta.
|
||||
|
||||
## Current protocol integration
|
||||
|
||||
[ADR-0068](adr/0068-single-current-public-contracts.md) governs the work
|
||||
for [issue #8](https://git.cflmy.cn/cflmy/marqdo-cli/issues/8). Current
|
||||
developer inputs are [Analysis](../spec/analysis.md),
|
||||
[Observation](../spec/observation.md) and the [CLI Tool](../spec/cli-tool.md).
|
||||
The earlier release records below describe their tagged binaries.
|
||||
|
||||
## 0. Beta release record — `3.0.0-beta.1`
|
||||
|
||||
### 0.1 Product, version axes and scope
|
||||
@@ -107,7 +115,7 @@ historical and superseded by the release-SHA manifest.
|
||||
This section records work **after** the `v3.0.0-beta.1` tag. It is not part of
|
||||
the tagged beta archive and no new release tag has been created. The design
|
||||
input is RFC-OBS-0001 (issue `#1`), the frozen decision is ADR-0059 and the
|
||||
normative contract is [`spec/execution-events-v1.md`](../spec/execution-events-v1.md).
|
||||
normative contract is [the beta-era event contract](https://git.cflmy.cn/cflmy/marqdo-cli/src/tag/v3.0.0-rc.2/spec/execution-events-v1.md).
|
||||
Executed evidence for this section is
|
||||
[`evidence/2026-11-22-execution-events-v1.md`](evidence/2026-11-22-execution-events-v1.md).
|
||||
|
||||
@@ -273,7 +281,7 @@ execution segment. Binding inference joins only reachable control exits.
|
||||
The [runnable example](../examples/control-flow.mq.md) uses ordinary Markdown
|
||||
list containers.
|
||||
|
||||
[Analysis v3](../spec/analysis-v3.md) represents the loop transfer statements.
|
||||
[the shipped rc.2 Analysis contract](https://git.cflmy.cn/cflmy/marqdo-cli/src/tag/v3.0.0-rc.2/spec/analysis-v3.md) represents the loop transfer statements.
|
||||
Other documents continue to emit v2. Trace v2 and Execution Events v1 expose
|
||||
the new control events. The published beta evidence applies to its original
|
||||
SHA. The maintainer selected phase A for RC.2. List iteration
|
||||
@@ -672,7 +680,7 @@ Consumer evidence:
|
||||
|
||||
```bash
|
||||
./target/debug/marqdo check examples/multi-module/index.mq.md --refs --emit /tmp/a.json
|
||||
./target/debug/marqdo run examples/multi-module/index.mq.md --trace-file /tmp/t.json
|
||||
./target/debug/marqdo run examples/multi-module/index.mq.md --observation-file /tmp/observation.json
|
||||
python3 tests/consumers/analysis_consumer.py /tmp/a.json
|
||||
python3 tests/consumers/trace_consumer.py /tmp/a.json /tmp/t.json
|
||||
```
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# ADR-0006: CLI output, exit-code and JSON contract
|
||||
|
||||
> Historical public protocol sections. Current Analysis, runtime output and
|
||||
> Tool contracts are specified by [ADR-0068](0068-single-current-public-contracts.md).
|
||||
|
||||
Status: **Accepted**
|
||||
Date: 2026-11-20
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# ADR-0013: Generic external CLI Tool Protocol v1
|
||||
|
||||
> Historical. [ADR-0068](0068-single-current-public-contracts.md) supersedes
|
||||
> the public contracts described in this record.
|
||||
|
||||
Status: **Accepted**
|
||||
Date: 2026-11-20
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# ADR-0015: Public Analysis v1 and Trace v1
|
||||
|
||||
> Historical. [ADR-0068](0068-single-current-public-contracts.md) supersedes
|
||||
> the public contracts described in this record.
|
||||
|
||||
Status: **Accepted**
|
||||
Date: 2026-11-20
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# ADR-0059: Runtime observability and Execution Events v1
|
||||
|
||||
> Historical. [ADR-0068](0068-single-current-public-contracts.md) supersedes
|
||||
> the public contracts described in this record.
|
||||
|
||||
- **Status:** Accepted
|
||||
- **Date:** 2026-11-22
|
||||
- **Decision owners:** CLI, runtime and host maintainers
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# ADR-0067 — Multi-arm branches and nearest-loop control
|
||||
|
||||
> Historical public protocol sections. Current Analysis, runtime output and
|
||||
> Tool contracts are specified by [ADR-0068](0068-single-current-public-contracts.md).
|
||||
|
||||
Status: Accepted for development. Release inclusion requires a maintainer
|
||||
decision and the applicable same-SHA release gates.
|
||||
|
||||
|
||||
@@ -27,14 +27,6 @@ replace `spec/` or a recorded test log.
|
||||
> [`spec/extension-selection.md`](../../spec/extension-selection.md),
|
||||
> [`spec/resource-provider-v2.md`](../../spec/resource-provider-v2.md).
|
||||
>
|
||||
> **Post-baseline observability (ADR-0059, RFC-OBS-0001).** After the tagged
|
||||
> baseline the tree adds Execution Events v1: a typed host observation facade,
|
||||
> real-commit stdout/stderr chunks, run-unique call frames and explicitly
|
||||
> selected bounded values over `run/call --event-stream jsonl`. Analysis v2 and
|
||||
> Trace v2 are unchanged. This is locally tested on the post-baseline tree
|
||||
> ([`../STATUS.md`](../STATUS.md) §0.5) and is not part of the tagged beta
|
||||
> archive or its same-SHA evidence.
|
||||
>
|
||||
> **Post-baseline core/extension boundary (RFC-EXT-0003, ADR-0060–0063).** The
|
||||
> core call surface no longer owns the domain math kernel (`math.*` removed;
|
||||
> `crates/marqdo-math` deleted; ADR-0061), sibling heading mode inheritance is
|
||||
@@ -58,13 +50,36 @@ replace `spec/` or a recorded test log.
|
||||
> **Structured control flow (RFC-CTRL-0005).**
|
||||
> [ADR-0067](../adr/0067-structured-control-flow.md) extends the payload parser
|
||||
> and branch mapper, adds nearest-loop execution transfers and makes binding
|
||||
> inference path-sensitive. Analysis chooses v2 or v3 according to the
|
||||
> statements it emits. The interpreter owns the transfers and reports them
|
||||
> through the existing observation facade.
|
||||
> inference path-sensitive. Analysis projects the same branch and loop
|
||||
> structure for every module. The interpreter reports transfers through Host
|
||||
> observation.
|
||||
|
||||
Protocol architecture and pre-stable replacement rules are recorded in
|
||||
[ADR-0068](../adr/0068-single-current-public-contracts.md). Check the
|
||||
[implementation status](../STATUS.md) for rollout and release evidence.
|
||||
## Public boundaries and pre-stable changes
|
||||
|
||||
[ADR-0068](../adr/0068-single-current-public-contracts.md) records the policy
|
||||
for replacing public interfaces before the first stable release.
|
||||
|
||||
| Boundary | Owner | Current contract |
|
||||
|---|---|---|
|
||||
| Static facts | CLI Analysis projection of the prepared project | [Analysis](../../spec/analysis.md) |
|
||||
| Runtime facts | Interpreter and Host observation sink | [Observation](../../spec/observation.md) |
|
||||
| Installed CLI commands | Generic Tool registry | [CLI Tool](../../spec/cli-tool.md) |
|
||||
| Runtime extensions | Plugin, Resource Provider and Foreign each enforce their own grants | [Plugin ABI](../../spec/plugin-abi.md), [Resource Provider](../../spec/resource-provider-v2.md), [Foreign](../../spec/foreign.md) |
|
||||
| Values and package identities | Value Wire and project lock | [Value Wire](../../spec/value-wire.md), [Extension selection and lock](../../spec/extension-selection.md) |
|
||||
|
||||
`check --emit analysis.json` projects static facts from the prepared project.
|
||||
`run` and `call` execute the same prepared program through the CapabilityHost.
|
||||
`--output jsonl` provides live events and `--observation-file run.json` saves
|
||||
the same event sequence from that invocation. Consumers verify the exact
|
||||
Analysis bytes before marking execution spans in source.
|
||||
|
||||
When replacing a contract, update its producer, specification, schema, real
|
||||
consumers, fixtures and CI in one integration. Every required field and format
|
||||
identifier should correspond to a check at the boundary. Reject obsolete
|
||||
inputs with a corrective action. Keep historical formats in Git. Review
|
||||
grants, budgets, file integrity, source attribution and privacy independently
|
||||
of the transport change. Check the [implementation status](../STATUS.md)
|
||||
for executed evidence and release gates.
|
||||
|
||||
## 1. Four state dimensions
|
||||
|
||||
@@ -74,7 +89,7 @@ platform".
|
||||
|
||||
| Dimension | Current state | Source |
|
||||
|---|---|---|
|
||||
| Implemented | Rust workspace `3.0.0-beta.1`: RFC-LANG-0002 Markdown/frontend/IR, v2 statement parser, tree-walk runtime, `Memory`, capability host, Tool/Analysis/Trace, Plugin ABI, Foreign kernels, migrated bundled stdlib, CLI composition root; post-baseline Execution Events v1 (ADR-0059), core/extension boundary RFC-EXT-0003 (ADR-0060–0063: math domain API removed, one core resource-kind registry, reviewed `resource_request`, F-A foreign retained), heading annotations only **Proposed** | `Cargo.toml`, `crates/`, `stdlib/` |
|
||||
| Implemented | Rust workspace: RFC-LANG-0002 Markdown/frontend/IR, v2 statement parser, tree-walk runtime, `Memory`, capability host, Tool, Analysis and Observation, Plugin ABI, Foreign kernels, migrated bundled stdlib, CLI composition root; core/extension boundary RFC-EXT-0003 (ADR-0060–0063: math domain API removed, one core resource-kind registry, reviewed `resource_request`, F-A foreign retained), heading annotations only **Proposed** | `Cargo.toml`, `crates/`, `stdlib/` |
|
||||
| Tested locally | `cargo test --workspace --locked`, `cargo fmt --all -- --check`, `clippy -D warnings`, release archive smoke and an independent `ubuntu:24.04` cold-install run on the RFC-EXT-0003 tree (Linux x86_64); exact counts and logs are in `docs/STATUS.md` §0.6 and the RFC-EXT-0003 evidence file. Historical baselines stay in earlier sections. | `docs/STATUS.md` §0.6, `docs/evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md` |
|
||||
| Bundled stdlib released | In-repo bundle `marqdo-stdlib@0.1.0`, SHA-256 digest verified before loading; it is **not** an external registry package | `stdlib/stdlib.json`, `stdlib/README.md` |
|
||||
| Multi-platform verified | Linux local gate is the only executed lane here; Windows/macOS native lanes are **UNVERIFIED**, and the GitHub security lane remains a **VM-only** gate | `docs/STATUS.md` §1, §4 |
|
||||
@@ -96,7 +111,7 @@ execution: Value / MemoryStore / evaluator / budgets
|
||||
(computes; does not own stdout or file handles)
|
||||
|
|
||||
controlled platform API: open/read/write/close + non-streaming requests
|
||||
capability / budget / audit / trace
|
||||
capability / budget / audit / observation
|
||||
stdio / file / tcp / OS adapters
|
||||
explicitly registered providers (in-process / worker / C ABI)
|
||||
|
|
||||
@@ -127,8 +142,8 @@ Layer rules:
|
||||
5. Callable Plugin and Resource Provider share one registry/authorization/audit
|
||||
mechanism, but keep different capability types.
|
||||
6. CLI policy/commands are `commands/{sandbox,run,check,inspect,init,package,tool}.rs`;
|
||||
host open-path/providers/effects/dispatch are
|
||||
`host/{resource_ops,providers,effects,dispatch}.rs`; process execution is
|
||||
host open-path/providers/dispatch are
|
||||
`host/{resource_ops,providers,dispatch}.rs`; process execution is
|
||||
`process.rs`. These are child modules, not new crates or a second backend.
|
||||
|
||||
## 3. Dependency direction and public contracts
|
||||
@@ -150,7 +165,7 @@ review RFC, not a new crate per provider.
|
||||
| Public contract | API (`.mq.md`) | State | Tests |
|
||||
|---|---|---|---|
|
||||
| stdio stdin | `resource.open("stdio","stdin",["read"])`, `resource.read`, `resource.close`; one run-scoped cursor | implemented, read-only | `resource_streams`, `p2_closure`, `tests/conformance` |
|
||||
| Execution Events v1 | `run/call --event-stream jsonl`; `--observe-variable`, `--observe-parameter`, `--observe-text-values` | implemented P0/P1 (post-beta); P2 memory metadata deferred; strict refuses the option | `execution_events` CLI, `observation` host/runtime, `execution_events_consumer.py` |
|
||||
| Observation | `run/call --output jsonl`, `--output json` or `--observation-file PATH` | one event sequence and capture policy | `observation`, `analysis_observation`, `observation_consumer.py` |
|
||||
| stdio stdout | `resource.open("stdio","stdout",["write"])`, `resource.write`, `resource.close`; separate output budget | implemented | `stdlib_bundle`, `print_routing`, `resource_streams` |
|
||||
| stdio stderr | `resource.open("stdio","stderr",["write"])`; separate from stdout and CLI diagnostics | implemented | `resource_streams`, `stdlib_product` |
|
||||
| project file read | `resource.open("file", path, ["read"])`; path/grant checked; bounded | implemented, project mode | `resource_streams`, `stdlib_product` |
|
||||
@@ -205,7 +220,7 @@ that a phase is complete.
|
||||
| P1 | `std:fs/file` read/write/copy, metadata/directory, append/read_at/walk are implemented; watch and binary offset reads remain open | open |
|
||||
| P1 | No file watch or binary `read_at` | open; future Resource Operation extension |
|
||||
| P1 | JSON/CSV product parsers are implemented with depth bound and multi-value/multi-row; no incremental streaming parser | open |
|
||||
| P1 | CLI split into `commands/{sandbox,run,check,inspect,init,package,tool}.rs`; host split into `host/{resource_ops,providers,effects,dispatch}.rs` plus `process.rs`; `commands.rs` keeps shared project/runtime helpers and `host.rs` keeps the `Host` trait methods and capability checks | split; shared helpers and trait methods remain by design |
|
||||
| P1 | CLI split into `commands/{sandbox,run,check,inspect,init,package,tool}.rs`; host split into `host/{resource_ops,providers,dispatch}.rs` plus `process.rs`; `commands.rs` keeps shared project/runtime helpers and `host.rs` keeps the `Host` trait methods and capability checks | split; shared helpers and trait methods remain by design |
|
||||
| P2 | HTTP/1.1 framing is byte-exact; HTTP/2, trailers and transfer decoding remain open | open |
|
||||
| P2 | DNS, UDP, TCP listener and TLS client endpoints are implemented; no TLS server/mTLS or custom-CA CLI | open |
|
||||
| P2 | `std:path`, pure+host regex, `std:datetime`, `std:clock`, `std:env`, `std:process`, `std:random` and gzip compression are implemented; no streaming/zstd/brotli | open |
|
||||
|
||||
@@ -47,11 +47,9 @@ marqdo-cli/
|
||||
│ ├── plugin-abi.md C ABI v1, SDK, host lifecycle
|
||||
│ ├── math.md removed core math outlook + migration (ADR-0061)
|
||||
│ ├── foreign.md Python/Node kernel protocol
|
||||
│ ├── tool-v1.md generic external Tool Protocol v1
|
||||
│ ├── analysis-v2.md public Analysis v2 projection (v1 historical)
|
||||
│ ├── analysis-v3.md projection for projects with loop transfers
|
||||
│ ├── trace-v2.md public Trace v2 projection (v1 historical)
|
||||
│ └── trace-v1.md public Trace v1 event stream
|
||||
│ ├── cli-tool.md external command registration and dispatch
|
||||
│ ├── analysis.md current static projection
|
||||
│ └── observation.md live events and snapshots
|
||||
├── crates/
|
||||
│ ├── marqdo-span/ Span, LineCol, LineIndex (leaf)
|
||||
│ ├── marqdo-value/ Value, diagnostics, errors, wire encoding
|
||||
@@ -310,9 +308,8 @@ capability flags shown above). See [`STATUS.md`](STATUS.md).
|
||||
`docs/NEXT_RELEASE_CI_CONVERGENCE.md` are **Historical/Superseded** planning
|
||||
input (their banners link the RFC); `docs/STABLE_RELEASE_IMPLEMENTATION.md` is
|
||||
the authoritative next-phase/release plan. None describes implemented
|
||||
behavior. `spec/tool-v1.md` is a candidate protocol until an ADR and
|
||||
implementation tests land. Never cite a proposed or historical document as
|
||||
evidence that a feature exists.
|
||||
behavior. Use the current contracts and [ADR-0068](adr/0068-single-current-public-contracts.md)
|
||||
when replacing a public interface.
|
||||
* Changes to language semantics, AST mapping, wire format, plugin ABI,
|
||||
package/lock format, authorization defaults or public CLI behavior require an
|
||||
**Accepted ADR** (or superseding one) plus spec updates and tests. Use the
|
||||
|
||||
@@ -32,7 +32,7 @@ markdown profile `marqdo.md.v1`.
|
||||
Trace v2.
|
||||
4. [extensions.md](extensions.md) — plugins, foreign kernels, resource
|
||||
providers, extension selection and lock v4.
|
||||
5. [analysis-trace.md](analysis-trace.md) — the public static/dynamic data
|
||||
5. [analysis-observation.md](analysis-observation.md) — the public static/dynamic data
|
||||
contracts, Execution Events v1 and digest binding.
|
||||
6. [compatibility.md](compatibility.md) — version axes, platform matrix and the
|
||||
prerelease policy.
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# Analysis and Observation
|
||||
|
||||
Run the same public CLI that users install.
|
||||
|
||||
```sh
|
||||
marqdo check index.mq.md --emit ./analysis.json
|
||||
marqdo call index.mq.md main --output jsonl --observation-file ./run.json
|
||||
```
|
||||
|
||||
A tool can use [Analysis](../../spec/analysis.md) to locate functions, imports,
|
||||
references, resources and calls. Validate its identifier before walking the
|
||||
module and statement arrays. Use the original UTF-8 bytes for offsets and
|
||||
digest checks. The format is the same for a simple document and one using
|
||||
structured loop transfers.
|
||||
|
||||
[Observation](../../spec/observation.md) carries frames, control flow, committed
|
||||
output and the final result. Consume JSONL for live updates, or use
|
||||
`--output json` for one JSON snapshot on stdout. The snapshot's `events`
|
||||
array has the same objects as the live stream. The first event opens the run
|
||||
and the terminal event gives its outcome. Treat a stream that ends before a
|
||||
terminal as incomplete. Base64 decode each stdout and stderr chunk and verify
|
||||
its byte count. Read the typed return from `run.completed.payload.value`.
|
||||
|
||||
Before highlighting source locations, compare the `run.started` root and
|
||||
SHA-256 of the exact Analysis artifact, then check the source file digest.
|
||||
A different report or edited source requires a fresh check and run.
|
||||
The repository's independent consumer implements both delivery modes.
|
||||
|
||||
```sh
|
||||
python3 tests/consumers/observation_consumer.py ./run.json --snapshot \
|
||||
--analysis ./analysis.json --source-root .
|
||||
```
|
||||
|
||||
Value capture uses exact names and explicit Text consent. Use
|
||||
`--observe-variable NAME` and `--observe-parameter NAME` only for the
|
||||
values the feature needs. Request `--observe-text-values` when the caller
|
||||
has opted into this disclosure. Program output and explicit returned values
|
||||
can themselves contain sensitive data.
|
||||
|
||||
Update integrations that previously used the retired run/call JSON,
|
||||
Trace or Execution Events options. Use the commands above, remove the old
|
||||
reader, and rebuild and reinstall the Tool with the
|
||||
[current manifest](../../spec/cli-tool.md).
|
||||
@@ -1,121 +0,0 @@
|
||||
# Analysis and Trace v2 consumers
|
||||
|
||||
Both are public, versioned JSON artifacts. A consumer must read them as files,
|
||||
never link Marqdo's Rust internals or depend on `inspect --ir`.
|
||||
|
||||
## Analysis v2 and v3 (static)
|
||||
|
||||
```bash
|
||||
marqdo check index.mq.md --emit ./analysis.json
|
||||
```
|
||||
|
||||
- Write atomically; only publish after `check` exits 0. `--refs` is an
|
||||
independent Markdown-link check and can make `check` fail; on failure the emit
|
||||
target is removed. Do not generate a consumer artifact with
|
||||
`check --refs --emit` without checking the exit code.
|
||||
- `schema: "marqdo.analysis"`. The writer emits `schema_version: 2` for
|
||||
projects without loop transfers and `3` when a function body contains
|
||||
`break` or `continue`. Check the version before walking function bodies.
|
||||
Both versions encode `else if` in the ordered `branch.arms` array.
|
||||
- Top level: `producer` (`name`, `version` = product version,
|
||||
`markdown_profile`), `project`, `modules`, `diagnostics`.
|
||||
- `project`: `root_id` (`root:<name>@<version>` for manifest projects),
|
||||
`identity_kind`, `lock_digest` (`""` without a lock), `stdlib`
|
||||
(`version`, `digest`, `instance_id`; may be null).
|
||||
- `modules[]`: `id`, `package_instance_id`, `relative_path`, `source_digest`,
|
||||
`units`, `functions`, `imports`, `references`, `calls`, `resources`.
|
||||
Diagnostics are top-level, not per-module.
|
||||
- Byte offsets are UTF-8 source offsets. Stable index keys are logical package
|
||||
instance ids, never absolute paths.
|
||||
- `check` does not load plugin libraries, start kernels/providers or execute the
|
||||
program.
|
||||
- Contracts: [Analysis v2](../../spec/analysis-v2.md) and
|
||||
[Analysis v3](../../spec/analysis-v3.md). Each links to its schema.
|
||||
The independent consumers in `tests/consumers/` check the version and
|
||||
decode the public nodes.
|
||||
|
||||
View must render the **original Markdown** and use Analysis only to correlate
|
||||
source offsets/heading units/callable mapping. Knowledge must use heading
|
||||
anchors, links, resources, package identity and source digests; it must not
|
||||
assume a `@knowledge` unit has runtime effects. Prove must map only the public
|
||||
proveable subset and distinguish `proved / disproved / unknown / unsupported`;
|
||||
a proof certificate needs matching source digest, semantics and contract
|
||||
identity.
|
||||
|
||||
## Trace v2 (dynamic)
|
||||
|
||||
```bash
|
||||
marqdo run index.mq.md --trace-file ./trace.json
|
||||
```
|
||||
|
||||
- `schema: "marqdo.trace"`, `schema_version: 2`.
|
||||
- `source.analysis_digest` must equal SHA-256 of the **Analysis JSON bytes** for
|
||||
the same project/projection configuration. A mismatch means the trace is
|
||||
stale; do not bind it to the new source. `run --trace-file` does not emit
|
||||
Analysis itself.
|
||||
- Event kinds: `call.enter`, `call.exit`, `branch.eval`, `loop.iteration`,
|
||||
`control.break`, `control.continue`, `return`, `effect` and possibly
|
||||
`trace.truncated`. Sourced events carry a
|
||||
module id and a UTF-8 span.
|
||||
- Defaults are 100,000 events / 32 MiB; `--trace-max-events` and
|
||||
`--trace-max-bytes` adjust them (`0` = unlimited). A consumer must tolerate
|
||||
truncation and must not assume the trace is complete.
|
||||
- Trace records no argument values, secrets or file contents.
|
||||
- Contract: `spec/trace-v2.md`; schema:
|
||||
`spec/schemas/trace-v2.schema.json`; consumer:
|
||||
`tests/consumers/trace_consumer.py`.
|
||||
|
||||
## Execution Events v1 (live)
|
||||
|
||||
```bash
|
||||
marqdo run index.mq.md --event-stream jsonl
|
||||
marqdo call index.mq.md main --arg n=5 --event-stream jsonl
|
||||
marqdo run index.mq.md --event-stream jsonl --trace-file ./trace.json
|
||||
```
|
||||
|
||||
- `schema: "marqdo.execution-events"`, `schema_version: 1`. This is a separate
|
||||
protocol from Analysis/Trace and has its own version axis.
|
||||
- While active, the CLI stdout is a **pure NDJSON channel**: one JSON object per
|
||||
line, `seq` starts at 0 and is strictly increasing. Program stdout/stderr are
|
||||
only `stdout.chunk`/`stderr.chunk` events with `encoding: "base64"`,
|
||||
`data_base64` and a matching `byte_count`. Concatenated decoded bytes equal a
|
||||
normal run's output; invalid UTF-8/NUL/binary bytes are preserved.
|
||||
- `stream.opened` is always seq 0. A run then has at most one `run.started` and
|
||||
exactly one terminal event (`run.completed`, `run.failed`, `run.rejected`) on
|
||||
a complete stream. An EOF without a terminal event is `incomplete`
|
||||
(SIGKILL/crash/broken pipe); never synthesize success.
|
||||
- `run.started.source` contains `root_id` and the `sha256:` digest of the exact
|
||||
Analysis bytes. `--trace-file` may be combined; both writers share one
|
||||
opaque run id, and Trace v2 remains atomic and value-free.
|
||||
- Structural events: `call.enter`/`call.exit` (`frame_id`, `parent_frame_id`),
|
||||
`return`, `branch.eval`, `loop.iteration`, `control.break`,
|
||||
`control.continue` and `effect`. Frames identify call
|
||||
instances, not functions; a failed argument binding creates no frame.
|
||||
- Values are off by default (`value_state: not_requested`).
|
||||
`--observe-variable NAME` and `--observe-parameter NAME` are exact-name
|
||||
selections. `Int`/`Float`/`Bool` are bounded by
|
||||
`--observe-max-value-bytes` (default 256); selected `Text` is `redacted` until
|
||||
`--observe-text-values` is also passed. Containers, `Memory`, resources and
|
||||
plugin handles are `unsupported`; handles are never serialized.
|
||||
- Structural/value events have a separate budget
|
||||
(`--observe-max-events`, `--observe-max-bytes`; defaults 100 000 / 16 MiB).
|
||||
Exhaustion emits one `observation.truncated` and still delivers stdout/stderr
|
||||
and the terminal event. A broken output pipe fails the run with
|
||||
`observe.transport_failed`; it never keeps executing side effects silently.
|
||||
- `--event-stream` is mutually exclusive with `--json`, rejected by
|
||||
`check`/`inspect`/`fmt`/`tool`, and currently rejected by `--mode strict`
|
||||
(fail-closed, no downgrade). It is not a capability grant.
|
||||
- Contract: [`../../spec/execution-events-v1.md`](../../spec/execution-events-v1.md);
|
||||
schema: `spec/schemas/execution-events-v1.schema.json`; consumer:
|
||||
`tests/consumers/execution_events_consumer.py`; fixtures and Rust gate:
|
||||
`tests/consumers/fixtures/execution-events/` and
|
||||
`crates/cli/tests/execution_events.rs`.
|
||||
|
||||
## Consumer rules
|
||||
|
||||
1. Reject unknown schema majors; there is no silent "use latest" fallback.
|
||||
2. Verify `source.analysis_digest` against the actual Analysis file bytes.
|
||||
3. Verify `source.root_id`/package identity; do not key on absolute paths.
|
||||
4. Be deterministic and offline; never execute `.mq.md` yourself, never invent
|
||||
host effects, and never inherit Marqdo grants.
|
||||
5. Report an unsupported/stale artifact explicitly; do not silently downgrade.
|
||||
@@ -38,7 +38,7 @@ Strict is Linux-only and probe-gated. Plugin/provider worker transports are not
|
||||
OS sandboxes. `pure`/`project` are execution modes, not security boundaries.
|
||||
Execution Events v1 is a live observation protocol: it is not a capability
|
||||
grant, values are off by default, and `--mode strict` currently refuses
|
||||
`--event-stream` explicitly (no downgrade).
|
||||
`--output jsonl` explicitly (no downgrade).
|
||||
|
||||
## Language compatibility
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ marqdo call index.mq.md main
|
||||
```
|
||||
|
||||
`run` executes the entry function (`main` by default) and prints program output;
|
||||
`call` prints the returned value. Use `--json` for machine-readable
|
||||
`call` prints the returned value. Use `--output json` for machine-readable
|
||||
results (`{"command":"run","success":true,...}`), including embedded program
|
||||
stdout and diagnostics.
|
||||
|
||||
@@ -76,8 +76,8 @@ stdout and diagnostics.
|
||||
|
||||
```bash
|
||||
marqdo check index.mq.md --json
|
||||
marqdo run index.mq.md --json
|
||||
marqdo call index.mq.md main --json
|
||||
marqdo run index.mq.md --output json
|
||||
marqdo call index.mq.md main --output json
|
||||
```
|
||||
|
||||
## 5. Where next
|
||||
@@ -85,6 +85,6 @@ marqdo call index.mq.md main --json
|
||||
- Publish/consume a pure library: [libraries.md](libraries.md).
|
||||
- Build an external tool: [tools.md](tools.md).
|
||||
- Plugins, kernels, providers: [extensions.md](extensions.md).
|
||||
- Analysis/Trace consumers: [analysis-trace.md](analysis-trace.md).
|
||||
- Analysis/Trace consumers: [analysis-observation.md](analysis-observation.md).
|
||||
- Version axes and platform support: [compatibility.md](compatibility.md).
|
||||
- Beta limitations: [release-limits.md](release-limits.md).
|
||||
@@ -84,7 +84,7 @@ an untrusted Git URL does not make the code trustworthy.
|
||||
* Not implemented: memory region/budget metadata (OBS-06/P2), raw memory
|
||||
content, breakpoints/stepping/time travel, and a bidirectional debug
|
||||
protocol. Do not infer a debugger from this protocol.
|
||||
* `--mode strict` currently rejects `--event-stream` explicitly; there is no
|
||||
* `--mode strict` currently rejects `--output jsonl` explicitly; there is no
|
||||
silent fallback to `project`.
|
||||
* The live lane is tested on Linux x86_64; macOS/Windows are unverified for
|
||||
this option for this candidate.
|
||||
|
||||
@@ -5,7 +5,7 @@ product command. A tool is a **separate executable** registered by the user; the
|
||||
CLI only dispatches unknown top-level commands to registered tools and never
|
||||
scans `PATH` for a guessed name.
|
||||
|
||||
Normative contract: [`../../spec/tool-v1.md`](../../spec/tool-v1.md)
|
||||
Normative contract: [`../../spec/cli-tool.md`](../../spec/cli-tool.md)
|
||||
(implemented and frozen for protocol v1).
|
||||
|
||||
## 1. Package layout
|
||||
@@ -106,7 +106,7 @@ stream to its own SSE/websocket transport; the CLI never implements HTTP/SSE.
|
||||
This option is unavailable under `--mode strict` in the current tree and the
|
||||
tool must surface that refusal instead of pretending real-time support.
|
||||
|
||||
See [analysis-trace.md](analysis-trace.md) for fields and digest rules. Do not
|
||||
See [analysis-observation.md](analysis-observation.md) for fields and digest rules. Do not
|
||||
depend on `inspect --ir`: that JSON is not a frozen cross-repository protocol.
|
||||
The `view` tool renders the **original Markdown**, not the Analysis JSON; the
|
||||
Analysis is an index, not a replacement for the source text.
|
||||
|
||||
Reference in new issue
Block a user