diff --git a/README.md b/README.md index 2404f1e..5b25cf9 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ release policy. > [release](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-beta.1), > source `2c7c4f31e7a388d3fcfa717a77067e696ed13854`. The public beta target is **Linux x86_64 (glibc)**; macOS and Windows are experimental and not claimed, and the > C ABI plugin/provider paths are Linux-only in this beta. The language -> (RFC-LANG-0002), lock v4, Analysis v2, Trace v2, Tool v1, Plugin ABI v1 +> (RFC-LANG-0002), lock v4, Analysis, Observation, CLI Tool, Plugin ABI v1 > (native + worker), pinned Foreign providers and Resource Provider v2 are > implemented and covered by tests. **`strict` OS isolation is Linux-only and > probe-gated**; unsupported hosts must fail closed, and strict L2 diff --git a/docs/developers/README.md b/docs/developers/README.md index ad11e2c..eea4376 100644 --- a/docs/developers/README.md +++ b/docs/developers/README.md @@ -7,16 +7,17 @@ core checkout, or host memory layout. Adding a new domain function must not require a core commit. Product version for these docs: **`3.0.0-rc.2`** (Linux x86_64 candidate). -Protocol versions are independent: Analysis v2, Trace v2, Execution Events v1, -Tool v1, Plugin ABI v1, Foreign wire v1, Provider manifest v2, lock v4, -markdown profile `marqdo.md.v1`. +Current protocol contracts: Analysis, Observation, CLI Tool, Plugin ABI v1, +Foreign wire v1, Provider manifest v2, lock v4 and markdown profile +`marqdo.md.v1`. Product, protocol and package versions are independent; see +[compatibility.md](compatibility.md). ## Pick your entry point | Goal | Use | Deliverable | |---|---|---| | AI/math/data/quantum/SKILL libraries, pure algorithms | `.mq.md` package | `index.mq.md`, `marqdo.yaml`, README, tests | -| Knowledge/Proof/View/IDE/lint/analysis tools | CLI Tool Protocol v1 | standalone executable + `tool.json` + Analysis/Trace consumer | +| Knowledge/Proof/View/IDE/lint/analysis tools | CLI Tool protocol | standalone executable + `tool.json` + Analysis/Observation consumer | | High-performance native callable functions | Callable Plugin ABI v1 | `plugin.yaml`, host-targeted library, SDK/header | | New foreign language backend (R/Python/Julia/…) | Foreign Kernel | `kernel.json`, executable provider, pinned environment | | Hardware/device/external-stream resources | Resource Provider v2 | `provider.json`, C ABI library, worker helper | @@ -28,12 +29,12 @@ markdown profile `marqdo.md.v1`. project. 2. [libraries.md](libraries.md) — publish a pure `.mq.md` library and consume it through a pinned Git dependency. -3. [tools.md](tools.md) — build an external Tool that consumes Analysis v2 and - Trace v2. +3. [tools.md](tools.md) — build an external Tool that consumes the current + Analysis and Observation contracts. 4. [extensions.md](extensions.md) — plugins, foreign kernels, resource providers, extension selection and lock v4. 5. [analysis-observation.md](analysis-observation.md) — the public static/dynamic data - contracts, Execution Events v1 and digest binding. + contracts and digest binding. 6. [compatibility.md](compatibility.md) — version axes, platform matrix and the prerelease policy. 7. [release-limits.md](release-limits.md) — the honest beta limitations (this diff --git a/docs/developers/release-limits.md b/docs/developers/release-limits.md index 3ca0437..5956136 100644 --- a/docs/developers/release-limits.md +++ b/docs/developers/release-limits.md @@ -57,10 +57,10 @@ Even when available: ## Compatibility and versioning -* `3.0.0-rc.2` is a **prerelease**. The changelog lists changes from the beta. -* The product version is independent of protocol versions: Analysis v2, Trace - v2, Execution Events v1, Tool v1, Plugin ABI v1, Foreign wire v1, Provider - manifest v2 and lock v4 keep their own major numbers. +* `3.0.0-rc.3` is a **prerelease**. The changelog lists changes from the beta. +* The product version is independent of protocol versions: Analysis, + Observation, CLI Tool, Plugin ABI v1, Foreign wire v1, Provider manifest v2 + and lock v4 keep their own identifiers. * The official bundled stdlib keeps its independent package version `0.1.0`. A plugin `.mq.md` package version such as `0.1.0` is also independent. * `project.marqdo` in `marqdo.yaml` is enforced in this release. SemVer diff --git a/docs/developers/tools.md b/docs/developers/tools.md index a3b693a..c2f9dc8 100644 --- a/docs/developers/tools.md +++ b/docs/developers/tools.md @@ -1,12 +1,12 @@ -# External tools: CLI Tool Protocol v1 +# External tools: current CLI Tool protocol The core does not contain `view`, `knowledge`, `prove`, `lint` or any other 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/cli-tool.md`](../../spec/cli-tool.md) -(implemented and frozen for protocol v1). +Normative contract: [`../../spec/cli-tool.md`](../../spec/cli-tool.md) and +[`../../spec/schemas/cli-tool.schema.json`](../../spec/schemas/cli-tool.schema.json). ## 1. Package layout @@ -20,7 +20,7 @@ marqdo-view/ examples/ ``` -`tool.json` for the `3.0.0-rc.2` candidate: +`tool.json` for the `3.0.0-rc.3` candidate: ```json { @@ -30,22 +30,19 @@ marqdo-view/ "version": "0.1.0", "command": "view", "entrypoint": "bin/marqdo-view", - "compatibility": { - "marqdo": ">=3.0.0-beta.1,<4.0.0", - "analysis": [2], - "trace": [2] - } + "requires": {"api_revision": 1, "analysis": 3, "observation": 1} } ``` -- `version` is the **tool's** SemVer. -- `compatibility.marqdo` is the **core product** range. A stable-only - `>=3.0.0,<4.0.0` does not match a beta core; opt in explicitly. The CLI - rejects a mismatched range at install and dispatch time with a - `requires marqdo …` diagnostic. -- `analysis`/`trace` are declared only if the tool consumes them; the current - development branch provides Analysis v2/v3 and Trace v2. Declare - `analysis: [2, 3]` when the reader handles both versions. +- `version` is the **tool's** SemVer. It identifies the artifact; it does not + promise compatibility with retired core protocols. +- `requires.api_revision` is required and must equal the current core revision. +- `requires.analysis` and `requires.observation` are optional. Declare one only + when the tool consumes that contract, and declare it as a **single exact + integer**; arrays, ranges and "highest shared version" negotiation do not + exist. +- A mismatched requirement fails install and dispatch with + `tool.protocol_incompatible`; there is no negotiation and no fallback. - `command` must match `^[a-z][a-z0-9-]*$` and must not collide with a built-in command (`init`, `run`, `call`, `check`, `inspect`, `fmt`, `plugin`, `add`, `remove`, `lock`, `sync`, `tool`, `help`). @@ -72,11 +69,13 @@ The tool receives: | Variable | Meaning | |---|---| | `MARQDO_BIN` | absolute path of the running `marqdo` executable | -| `MARQDO_TOOL_PROTOCOL` | `1` | -| `MARQDO_PROTOCOL_ANALYSIS` | Highest shared Analysis version. Read the artifact envelope for its actual version. | -| `MARQDO_PROTOCOL_TRACE` | `2` when Trace v2 was negotiated | +| `MARQDO_API_REVISION` | the single current tool API revision (`1`) | Call `$MARQDO_BIN` with an argv array; do not assume `marqdo` is on `PATH`. +The retired `MARQDO_TOOL_PROTOCOL`, `MARQDO_PROTOCOL_ANALYSIS` and +`MARQDO_PROTOCOL_TRACE` variables are not exported: version selection is not +negotiated. A registration written by a retired manifest/record format is +rejected with a "remove and reinstall" diagnostic and is never rewritten. ## 3. Consume the public protocols @@ -86,28 +85,37 @@ Static input (View/Knowledge/Proof): "$MARQDO_BIN" check index.mq.md --refs --emit ./analysis.json ``` -Dynamic input: +Dynamic input uses the single Observation contract. The same run can deliver +the event stream on stdout and an atomic JSON snapshot in one invocation: ```bash -"$MARQDO_BIN" run index.mq.md --trace-file ./trace.json +# live JSONL events +"$MARQDO_BIN" run index.mq.md --output jsonl +"$MARQDO_BIN" call index.mq.md main --arg n=5 --output jsonl + +# one JSON snapshot, from the same execution +"$MARQDO_BIN" run index.mq.md --output json --observation-file ./observation.json + +# both destinations, still one execution +"$MARQDO_BIN" call index.mq.md main --arg n=5 --output jsonl \ + --observation-file ./observation.json ``` -Live dynamic input (Execution Events v1): +Consume the stdout line stream as NDJSON; do not pass another `--output` in the +same invocation. Every event carries `schema: "marqdo.observation"` and +`schema_version: 1`; read `stream.opened` for the capture policy and reject any +other format identifier. The JSON snapshot wraps the same events, so a consumer +must not treat it as a second protocol or renumber them. A tool server may +convert the stream to its own SSE/websocket transport; the CLI never implements +HTTP/SSE. Live and file destinations are rejected under `--mode strict` in the +current tree; the tool must surface that refusal instead of pretending +real-time support. The retired `--json`, `--trace-file` and `--event-stream` +options are rejected, not aliased. -```bash -"$MARQDO_BIN" run index.mq.md --event-stream jsonl -"$MARQDO_BIN" call index.mq.md main --arg n=5 --event-stream jsonl -``` - -Consume the stdout line stream as NDJSON; do not pass `--json` in the same -invocation. Negotiate by reading `stream.opened` (`marqdo.execution-events`, -`schema_version: 1`) and reject unknown majors. A tool server may convert the -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-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. +See [analysis-observation.md](analysis-observation.md) for fields and digest rules. A +consumer must verify the exact Analysis bytes (SHA-256) and each module source +digest before attributing a span. 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. @@ -122,13 +130,16 @@ Checksums verify bundle integrity only; they are not publisher authentication. - Test against a **frozen** `marqdo` binary: hash it before/after the suite and fail if it changes. -- Cover the negative paths: unknown schema major, incompatible `marqdo` range, - reserved command, traversal/symlink entrypoint, tampered bundle file, missing - entrypoint, tool crash/exit-status propagation. -- Match a real Analysis v2/Trace v2 schema (`spec/schemas/`) and check - `source.analysis_digest`. -- Include README, minimal example, supported CLI product range, protocol - versions, platform matrix, reproducible artifact hashes and limitations. +- Cover the negative paths: unknown schema/schema_version, incompatible + `api_revision`/`analysis`/`observation` requirement, array requirements, + retired record format, reserved command, traversal/symlink entrypoint, + tampered bundle file, missing entrypoint, tool crash/exit-status propagation. +- Validate against the current Analysis and Observation schemas + (`spec/schemas/`) and check `source.analysis_digest` plus the module source + digest before using event spans. +- Include README, minimal example, supported CLI product range, the exact + protocol requirements, platform matrix, reproducible artifact hashes and + limitations. - The archive ships `examples/tool-samples/{sample-view,sample-knowledge,sample-proof}` as independent source examples and `examples/tool-unknown-name/` as a runnable dispatch fixture. diff --git a/docs/releasing.md b/docs/releasing.md index 14c57bc..efb57f3 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -57,7 +57,7 @@ requires re-running every gate. On that SHA: environment and limits; the 9 correctness workloads must still pass. Never report TCG/QEMU or development-container timings as G4. 8. `README`, `CHANGELOG`, `COMPATIBILITY`, `docs/STATUS`, this file, - `spec/tool-v1.md`, `spec/plugin-abi.md` and the developer docs are on the + `spec/cli-tool.md`, `spec/plugin-abi.md` and the developer docs are on the same fact baseline. No "implemented but says Proposed", no "released but says DO NOT RELEASE", no product/protocol/package version confusion. 9. Every shipped binary was actually built and smoke-tested on its claimed @@ -150,7 +150,7 @@ python3 tools/release/smoke.py \ It verifies the `.sha256`, `RELEASE_INFO.json`/`SOURCE_SHA`, both stdlib digests against `stdlib/stdlib.json` and the staged tree, offline -`--version`/`--help`, `check`/`run`/`call`, lock/sync, Analysis v2/v3 and Trace v2 +`--version`/`--help`, `check`/`run`/`call`, lock/sync, Analysis and Observation consumers, Tool install/dispatch, native + worker plugin transports, a foreign kernel, Resource Provider v2 through the shipped worker (positive, unauthorized and missing-helper fail-closed), the pure math package and optional