From 0e96396ee79bac9927f4eb3e98d018aec9e91f4b Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:28:23 +0900 Subject: [PATCH 001/183] chore(roadmap): start the m0 and m0b milestones Both root leaves of the rdm meta-roadmap move to inprogress. Their campaigns are planned in this session and run in parallel. Co-Authored-By: Claude Opus 5.5 --- __roadmap__/roadmap-mcp-rework/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/__roadmap__/roadmap-mcp-rework/README.md b/__roadmap__/roadmap-mcp-rework/README.md index 32dfb97..b4189f4 100644 --- a/__roadmap__/roadmap-mcp-rework/README.md +++ b/__roadmap__/roadmap-mcp-rework/README.md @@ -35,9 +35,9 @@ The milestone graph for implementing `__design__/rdm/architecture.md`: the `mana ## Status ```mermaid graph TD - m0_feasibility_spike[M0 Feasibility spike]:::planned + m0_feasibility_spike[M0 Feasibility spike]:::inprogress core[Core]:::planned - m0b_domain_model_spec[M0b Domain model spec]:::amendment + m0b_domain_model_spec[M0b Domain model spec]:::inprogress classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -48,9 +48,9 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `m0_feasibility_spike.md` | 📄 Leaf Task | ⬜ Planned | +| `m0_feasibility_spike.md` | 📄 Leaf Task | 🔄 In Progress | | `core/` | 📁 Directory | ⬜ Planned | -| `m0b_domain_model_spec.md` | 📄 Leaf Task | 🔵 Amendment | +| `m0b_domain_model_spec.md` | 📄 Leaf Task | 🔄 In Progress | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | From af8ad04893fc3e201d005fcdbc454737df184204 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:28:55 +0900 Subject: [PATCH 002/183] docs(design): rename the core crate to rdm-engine rdm-core is taken on crates.io by an unrelated download engine; Eliott chose rdm-engine on 2026-11-16. R01 and the meta-roadmap leaves follow. The M0 leaf also drops a stale premise: writing-release-rework is closed, and the meta-roadmap itself is now the largest and deepest campaign, so its frozen copy is the spike fixture. Co-Authored-By: Claude Opus 5.5 --- __design__/rdm/architecture.md | 6 +++--- __roadmap__/roadmap-mcp-rework/README.md | 4 ++-- __roadmap__/roadmap-mcp-rework/core/README.md | 2 +- __roadmap__/roadmap-mcp-rework/core/engine/README.md | 2 +- .../core/engine/interchange/consumers/README.md | 2 +- .../interchange/consumers/delivery/m7_distribution.md | 4 ++-- .../core/engine/interchange/m3_interchange.md | 8 ++++---- .../roadmap-mcp-rework/core/engine/m2_graph_engine.md | 10 +++++----- .../roadmap-mcp-rework/core/m1_core_foundation.md | 10 +++++----- __roadmap__/roadmap-mcp-rework/m0_feasibility_spike.md | 4 ++-- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/__design__/rdm/architecture.md b/__design__/rdm/architecture.md index d73c4df..acabee6 100644 --- a/__design__/rdm/architecture.md +++ b/__design__/rdm/architecture.md @@ -15,7 +15,7 @@ spec-first milestone M0b. part of what a roadmap needs: no leaf editing, no batch, no amendment or progress writer, no graph walk. Re-planning a long roadmap is therefore hand-editing a grammar. The markdown itself serves a human review that no longer happens. -- **Proposed change.** One Rust library, `rdm-core`, owns the roadmap model, its JSON store and +- **Proposed change.** One Rust library, `rdm-engine`, owns the roadmap model, its JSON store and every graph operation. Two thin consumers sit on it: `rdm-mcp`, a stdio MCP server for agents, and `rdm-cli` (binary `rdm`) for humans. JSON is the stored format; markdown is an export. The server carries a graph view for MCP Apps hosts. The stored types and the read model live in a fourth crate, `rdm-schema`, versioned on its own. All four crates are published to crates.io. @@ -64,7 +64,7 @@ graph TD CLI[rdm-cli: binary rdm, for humans] UI[graph view: Svelte page served as a ui:// resource] end - subgraph Core [rdm-core] + subgraph Core [rdm-engine] OPS[ops: CRUD, structural edits, batch, impact] ORD[order: waves, ready set, status FSM] VAL[validate] @@ -90,7 +90,7 @@ graph TD | Protocol | MCP 2026-07-28 conformance only. `rmcp` pinned exactly (3.9.0 at design time, MSRV 1.88). | | UI | MCP Apps (`io.modelcontextprotocol/ui`, spec 2026-01-26). Svelte 5, one inlined HTML file embedded in the server binary. Read-only in the first version. | | Home | A Cargo workspace in this repository under `crates/`, outside `skills/`. | -| Crates | `rdm-schema` (stored types, read-model types, JSON Schemas, format version), `rdm-core` (library), `rdm-mcp` (server), `rdm-cli` (binary `rdm`). | +| Crates | `rdm-schema` (stored types, read-model types, JSON Schemas, format version), `rdm-engine` (library), `rdm-mcp` (server), `rdm-cli` (binary `rdm`). | **The consumer rule.** `rdm-mcp` and `rdm-cli` hold no roadmap logic. Each maps its inputs to one core call and renders the result. A behaviour that exists in one consumer and not in the core is a diff --git a/__roadmap__/roadmap-mcp-rework/README.md b/__roadmap__/roadmap-mcp-rework/README.md index b4189f4..1baf1a2 100644 --- a/__roadmap__/roadmap-mcp-rework/README.md +++ b/__roadmap__/roadmap-mcp-rework/README.md @@ -1,7 +1,7 @@ # rdm rework — meta-roadmap ## Context -The milestone graph for implementing `__design__/rdm/architecture.md`: the `managing-roadmaps` tooling moves from the `dirtree-rdm` script to a Rust core (`rdm-core`) with an MCP server (`rdm-mcp`) and a CLI (`rdm-cli`). Each node is one milestone. Its detailed roadmap is not here: the milestone's own session, started by Eliott in plan mode with the milestone's reminder (list "Agent Skills") and a link to its leaf, writes it as a separate campaign `__roadmap__//`. +The milestone graph for implementing `__design__/rdm/architecture.md`: the `managing-roadmaps` tooling moves from the `dirtree-rdm` script to a Rust core (`rdm-engine`) with an MCP server (`rdm-mcp`) and a CLI (`rdm-cli`). Each node is one milestone. Its detailed roadmap is not here: the milestone's own session, started by Eliott in plan mode with the milestone's reminder (list "Agent Skills") and a link to its leaf, writes it as a separate campaign `__roadmap__//`. ## Reference Documents - [R01 Architecture](../../__design__/rdm/architecture.md) — the design every milestone implements; updated together with the code when a decision changes @@ -18,7 +18,7 @@ The milestone graph for implementing `__design__/rdm/architecture.md`: the `mana ## Success Gates - ⬜ Every milestone leaf below is `done` -- ⬜ `rdm-schema`, `rdm-core`, `rdm-mcp` and `rdm-cli` are published and the `managing-roadmaps` plugin pins the server it starts +- ⬜ `rdm-schema`, `rdm-engine`, `rdm-mcp` and `rdm-cli` are published and the `managing-roadmaps` plugin pins the server it starts - ⬜ `__design__/rdm/architecture.md` describes what is built, with no decision left marked provisional unless deliberately carried on ## Gotchas diff --git a/__roadmap__/roadmap-mcp-rework/core/README.md b/__roadmap__/roadmap-mcp-rework/core/README.md index 56065c5..99936b6 100644 --- a/__roadmap__/roadmap-mcp-rework/core/README.md +++ b/__roadmap__/roadmap-mcp-rework/core/README.md @@ -4,7 +4,7 @@ Depth 1 of the meta-roadmap. Runs after `m0_feasibility_spike`, which proves the stack and creates the workspace. M1 builds the store every later milestone writes through. ## Goal -`rdm-core` holds a roadmap as JSON files that many processes can read and write safely. +`rdm-engine` holds a roadmap as JSON files that many processes can read and write safely. ## Pre-conditions - [ ] `m0_feasibility_spike.md` is `done` with a go diff --git a/__roadmap__/roadmap-mcp-rework/core/engine/README.md b/__roadmap__/roadmap-mcp-rework/core/engine/README.md index 289180d..fd6a945 100644 --- a/__roadmap__/roadmap-mcp-rework/core/engine/README.md +++ b/__roadmap__/roadmap-mcp-rework/core/engine/README.md @@ -4,7 +4,7 @@ Depth 2. Runs after M1's store. M2 adds everything that understands the tree: validation, order, the status machine and the operations that change it. ## Goal -`rdm-core` can validate, order and restructure a campaign, with every edit recorded as an amendment. +`rdm-engine` can validate, order and restructure a campaign, with every edit recorded as an amendment. ## Pre-conditions - [ ] `m1_core_foundation.md` is `done` diff --git a/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/README.md b/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/README.md index 2c5955b..f221a15 100644 --- a/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/README.md +++ b/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/README.md @@ -1,7 +1,7 @@ # Consumers ## Context -Depth 4. Runs after the core is complete. M4 (MCP server, for agents) and M5 (CLI, for humans) are independent thin layers over `rdm-core` and run in parallel. +Depth 4. Runs after the core is complete. M4 (MCP server, for agents) and M5 (CLI, for humans) are independent thin layers over `rdm-engine` and run in parallel. ## Goal Agents and humans reach every core operation, through MCP tools and through `rdm`, with the same results. diff --git a/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/m7_distribution.md b/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/m7_distribution.md index e82a966..82062e4 100644 --- a/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/m7_distribution.md +++ b/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/m7_distribution.md @@ -6,7 +6,7 @@ - [ ] Reminder `skills-rdm-M7` read - [ ] Eliott has agreed to publish to crates.io **Success Gates**: -- ⬜ A merge to `main` releases the crates (`rdm-schema`, then `rdm-core`, then `rdm-mcp` and `rdm-cli`), attaches prebuilt binaries and checksums to the GitHub release, and only then releases the plugin pinned to that version +- ⬜ A merge to `main` releases the crates (`rdm-schema`, then `rdm-engine`, then `rdm-mcp` and `rdm-cli`), attaches prebuilt binaries and checksums to the GitHub release, and only then releases the plugin pinned to that version - ⬜ A plugin installed from a scratch marketplace starts the pinned server on a clean machine - ⬜ After a plugin update the new server version starts with no manual step - ⬜ With no network, an installed binary of the same major version starts with a warning; otherwise the failure names the exact install command @@ -17,7 +17,7 @@ **Goal**: The campaign `__roadmap__/m7-distribution/` exists and Eliott has approved it. **Implementation Logic**: -In plan mode, author the campaign with `managing-roadmaps`, deciding: the release tool for the crates beside the skills' `multi-semantic-release` (follow the `writing-release` skill: tooling derived from the repository, CI releases after a merge, no local release commands); tag shapes and the two version lines (`rdm-schema` alone; `rdm-core`, `rdm-mcp` and `rdm-cli` on one product version, which the plugin pins) and whether the chosen release tool supports them; the order inside one workflow run, since a push made with the workflow token starts no other workflow; binary targets and checksums; the self-provisioning launch (download, verification, cache location, same-major fallback) or a better scheme if one is found; the MCP entries in `plugin.spec.json` and what `tools/assemble_plugin.py` and `tools/check_plugin.py` must learn; changes to `.github/workflows/release.yml`, `release-config.js`, `.githooks/pre-commit`, `Makefile` and `CONTRIBUTING.md`. +In plan mode, author the campaign with `managing-roadmaps`, deciding: the release tool for the crates beside the skills' `multi-semantic-release` (follow the `writing-release` skill: tooling derived from the repository, CI releases after a merge, no local release commands); tag shapes and the two version lines (`rdm-schema` alone; `rdm-engine`, `rdm-mcp` and `rdm-cli` on one product version, which the plugin pins) and whether the chosen release tool supports them; the order inside one workflow run, since a push made with the workflow token starts no other workflow; binary targets and checksums; the self-provisioning launch (download, verification, cache location, same-major fallback) or a better scheme if one is found; the MCP entries in `plugin.spec.json` and what `tools/assemble_plugin.py` and `tools/check_plugin.py` must learn; changes to `.github/workflows/release.yml`, `release-config.js`, `.githooks/pre-commit`, `Makefile` and `CONTRIBUTING.md`. Adversarial verification is required for the launch (it downloads and runs a binary: checksum handling, cache poisoning, partial downloads). Reviewed-PR lane: this changes CI and release machinery. **Deliverables**: `__roadmap__/m7-distribution/README.md` and its leaves **Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m7-distribution/` (expected: PASS) diff --git a/__roadmap__/roadmap-mcp-rework/core/engine/interchange/m3_interchange.md b/__roadmap__/roadmap-mcp-rework/core/engine/interchange/m3_interchange.md index 6aa40d0..d7e784f 100644 --- a/__roadmap__/roadmap-mcp-rework/core/engine/interchange/m3_interchange.md +++ b/__roadmap__/roadmap-mcp-rework/core/engine/interchange/m3_interchange.md @@ -1,6 +1,6 @@ # M3 Interchange -**Goal**: `rdm-core` exports any node to markdown for a human reader and imports a legacy markdown roadmap into the JSON store. +**Goal**: `rdm-engine` exports any node to markdown for a human reader and imports a legacy markdown roadmap into the JSON store. **Pre-conditions**: - [ ] `../m2_graph_engine.md` is `done` - [ ] Reminder `skills-rdm-M3` read @@ -26,9 +26,9 @@ Adversarial verification is required for the importer (a silent loss of content **Goal**: The milestone campaign is executed and lands on `main`. **Implementation Logic**: Execute the campaign on `feat/m3-interchange`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. -**Deliverables**: `crates/rdm-core` modules for export and import; fixtures of the existing campaigns; golden tests -**Consistency Checks**: `cargo test -p rdm-core` (expected: PASS) -**Commit**: `feat(rdm-core): land export and import` +**Deliverables**: `crates/rdm-engine` modules for export and import; fixtures of the existing campaigns; golden tests +**Consistency Checks**: `cargo test -p rdm-engine` (expected: PASS) +**Commit**: `feat(rdm-engine): land export and import` ## Step 3: Close out diff --git a/__roadmap__/roadmap-mcp-rework/core/engine/m2_graph_engine.md b/__roadmap__/roadmap-mcp-rework/core/engine/m2_graph_engine.md index c1f9374..5caee2d 100644 --- a/__roadmap__/roadmap-mcp-rework/core/engine/m2_graph_engine.md +++ b/__roadmap__/roadmap-mcp-rework/core/engine/m2_graph_engine.md @@ -1,12 +1,12 @@ # M2 Graph engine -**Goal**: `rdm-core` validates a whole campaign, computes its order, enforces the status machine and applies every create, read, update, delete and restructuring operation, singly or as an atomic batch, with amendments recorded. +**Goal**: `rdm-engine` validates a whole campaign, computes its order, enforces the status machine and applies every create, read, update, delete and restructuring operation, singly or as an atomic batch, with amendments recorded. **Pre-conditions**: - [ ] `../m1_core_foundation.md` is `done` - [ ] Reminder `skills-rdm-M2` read **Success Gates**: - ⬜ Whole-campaign validation returns diagnostics with stable codes, and a golden test pins the wave semantics (the ordering rule M0b fixes, checked against `skills/managing-roadmaps/references/dirtree-execution.md`) -- ⬜ The read-model projections of `rdm-schema` are computed by one set of functions in `rdm-core`, and a golden test pins each against the worked examples of M0b +- ⬜ The read-model projections of `rdm-schema` are computed by one set of functions in `rdm-engine`, and a golden test pins each against the worked examples of M0b - ⬜ Property tests: random trees under random operation sequences stay valid, keep ids unique and conserve leaves except on delete - ⬜ Every content or structure edit writes exactly one amendment with a non-empty description; status and progress write none (I5) - ⬜ A batch is atomic: a failing operation leaves the campaign untouched, and a dry-run writes nothing @@ -28,9 +28,9 @@ Adversarial verification is required for the structural operations and impact an **Goal**: The milestone campaign is executed and lands on `main`. **Implementation Logic**: Execute the campaign on `feat/m2-graph-engine`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. -**Deliverables**: `crates/rdm-core` modules for validation, order, the status machine, operations, impact analysis and batch; the property tests -**Consistency Checks**: `cargo test -p rdm-core` (expected: PASS) -**Commit**: `feat(rdm-core): land the graph engine` +**Deliverables**: `crates/rdm-engine` modules for validation, order, the status machine, operations, impact analysis and batch; the property tests +**Consistency Checks**: `cargo test -p rdm-engine` (expected: PASS) +**Commit**: `feat(rdm-engine): land the graph engine` ## Step 3: Close out diff --git a/__roadmap__/roadmap-mcp-rework/core/m1_core_foundation.md b/__roadmap__/roadmap-mcp-rework/core/m1_core_foundation.md index 9e66014..5847df6 100644 --- a/__roadmap__/roadmap-mcp-rework/core/m1_core_foundation.md +++ b/__roadmap__/roadmap-mcp-rework/core/m1_core_foundation.md @@ -1,12 +1,12 @@ # M1 Core foundation -**Goal**: `rdm-core` stores a roadmap as JSON, one file per node, and N processes can read and write one campaign without losing or tearing a write. +**Goal**: `rdm-engine` stores a roadmap as JSON, one file per node, and N processes can read and write one campaign without losing or tearing a write. **Pre-conditions**: - [ ] `../m0_feasibility_spike.md` is `done` with a go - [ ] `../m0b_domain_model_spec.md` is `done` - [ ] Reminder `skills-rdm-M1` read **Success Gates**: -- ⬜ `rdm-core` depends on `rdm-schema` for every stored type and holds none of its own; a file with a newer format major is refused with an upgrade message +- ⬜ `rdm-engine` depends on `rdm-schema` for every stored type and holds none of its own; a file with a newer format major is refused with an upgrade message - ⬜ Canonical serialisation round-trips byte for byte, and unknown fields survive a read and a write (I12) - ⬜ A multi-process test with kill injection at every journal stage passes on macOS, Linux and Windows: no lost update, no state that fails to load (I3) - ⬜ A write presenting a stale revision is refused and changes nothing (I4) @@ -28,9 +28,9 @@ Adversarial verification is required for the store, lock and journal (silent dat **Goal**: The milestone campaign is executed and lands on `main`. **Implementation Logic**: Execute the campaign on `feat/m1-core-foundation`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. -**Deliverables**: `crates/rdm-core` modules for the store (lock, atomic writes, journal, revisions) over the `rdm-schema` types; the multi-process test -**Consistency Checks**: `cargo test -p rdm-core` (expected: PASS) -**Commit**: `feat(rdm-core): land the core foundation` +**Deliverables**: `crates/rdm-engine` modules for the store (lock, atomic writes, journal, revisions) over the `rdm-schema` types; the multi-process test +**Consistency Checks**: `cargo test -p rdm-engine` (expected: PASS) +**Commit**: `feat(rdm-engine): land the core foundation` ## Step 3: Close out diff --git a/__roadmap__/roadmap-mcp-rework/m0_feasibility_spike.md b/__roadmap__/roadmap-mcp-rework/m0_feasibility_spike.md index 72073b8..cbeb7bd 100644 --- a/__roadmap__/roadmap-mcp-rework/m0_feasibility_spike.md +++ b/__roadmap__/roadmap-mcp-rework/m0_feasibility_spike.md @@ -10,7 +10,7 @@ - ⬜ Each host's `hostCapabilities` and `hostContext` are dumped as raw JSON (checked for personal data first), with the protocol version each host speaks and the version the view announces - ⬜ Time to display is measured: a server stamp against a view stamp sent through an app-only tool, cold and warm, median and worst, with the payload size; the report says how many runs were needed and why that number controls the noise - ⬜ The exact allow-rule string of the tool, read from a real session, is written down -- ⬜ The crate names `rdm-schema`, `rdm-core`, `rdm-mcp` and `rdm-cli` are confirmed free on crates.io, or replacements are agreed with Eliott +- ⬜ The crate names `rdm-schema`, `rdm-engine`, `rdm-mcp` and `rdm-cli` are confirmed free on crates.io (`rdm-core` was taken; Eliott chose `rdm-engine` on 2026-11-16) - ⬜ A go/no-go is written for each host; on no-go the later milestones are amended before they start **References**: [R01 §Proposed State, §Graph view, §Risks & Mitigations](../../__design__/rdm/architecture.md) — the pinned stack, the Apps mechanics and the risks this spike settles @@ -18,7 +18,7 @@ **Goal**: The campaign `__roadmap__/m0-feasibility-spike/` exists and Eliott has approved it. **Implementation Logic**: -In plan mode, author the campaign with `managing-roadmaps`, deciding: what the stub contains and nothing more (one tool with structured output, one `ui://` page, two app-only tools: one returns a leaf's content, one records stamps and host data); the fixture (an existing roadmap, filtered to the fields the tests need; the largest legacy campaign is `agent_plugin_nest` by node count and `writing-release-rework` by depth, and the latter is in flight, so use a frozen copy); the exact reading of "full view" (the whole-campaign outline, or the host's fullscreen display mode if it offers one); the message names, checked against the Apps spec; the number of runs (a short pilot to estimate the noise, then enough cold and warm runs for stable medians and a trustworthy worst case); the `basic-host` of the ext-apps repository as an optional baseline; how each host is tested and what counts as rendering; how the `rmcp` version is pinned and which of its calls set tool `_meta`, the Apps MIME type and the `io.modelcontextprotocol/ui` capability; whether the Apps client library fits a small bundle or a hand-written bridge is needed; where the workspace skeleton lives (`crates/`, an empty CI job); what is done if a host does not speak 2026-07-28 (the maintainer wants 2026-07-28 conformance only, so a failing host is a finding to bring back, not a reason to add a fallback). +In plan mode, author the campaign with `managing-roadmaps`, deciding: what the stub contains and nothing more (one tool with structured output, one `ui://` page, two app-only tools: one returns a leaf's content, one records stamps and host data); the fixture (an existing roadmap, filtered to the fields the tests need; the largest and deepest campaign is now this meta-roadmap (10 leaves, depth 6; `writing-release-rework` is closed), so use a frozen copy of it); the exact reading of "full view" (the whole-campaign outline, or the host's fullscreen display mode if it offers one); the message names, checked against the Apps spec; the number of runs (a short pilot to estimate the noise, then enough cold and warm runs for stable medians and a trustworthy worst case); the `basic-host` of the ext-apps repository as an optional baseline; how each host is tested and what counts as rendering; how the `rmcp` version is pinned and which of its calls set tool `_meta`, the Apps MIME type and the `io.modelcontextprotocol/ui` capability; whether the Apps client library fits a small bundle or a hand-written bridge is needed; where the workspace skeleton lives (`crates/`, an empty CI job); what is done if a host does not speak 2026-07-28 (the maintainer wants 2026-07-28 conformance only, so a failing host is a finding to bring back, not a reason to add a fallback). No adversarial verification: the gates are observations on real hosts, made with Eliott. **Deliverables**: `__roadmap__/m0-feasibility-spike/README.md` and its leaves **Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m0-feasibility-spike/` (expected: PASS) From 5b5267f4f5172eb67df84ffdd1658f060d0b88c6 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:32:07 +0900 Subject: [PATCH 003/183] chore(roadmap): plan the m0-feasibility-spike milestone Four levels: - the workspace skeleton, run on the shared base - the stub server with its frozen fixture, and the Svelte graph view, in parallel - the host trials with Eliott - the spike report The plan records the decisions of 2026-11-16: rdm-engine, Desktop as the primary host with VS Code best effort, 2026-07-28 only, and rmcp =3.10.0. It also fixes the fixture shape that the server and the view share. Co-Authored-By: Claude Opus 5.5 --- __roadmap__/m0-feasibility-spike/README.md | 73 +++++++++++++++++++ .../m0-feasibility-spike/build/README.md | 46 ++++++++++++ .../m0-feasibility-spike/build/graph_view.md | 55 ++++++++++++++ .../m0-feasibility-spike/build/stub_server.md | 72 ++++++++++++++++++ .../build/trials/README.md | 43 +++++++++++ .../build/trials/host_trials.md | 50 +++++++++++++ .../build/trials/report/README.md | 40 ++++++++++ .../build/trials/report/spike_report.md | 48 ++++++++++++ .../workspace_skeleton.md | 26 +++++++ 9 files changed, 453 insertions(+) create mode 100644 __roadmap__/m0-feasibility-spike/README.md create mode 100644 __roadmap__/m0-feasibility-spike/build/README.md create mode 100644 __roadmap__/m0-feasibility-spike/build/graph_view.md create mode 100644 __roadmap__/m0-feasibility-spike/build/stub_server.md create mode 100644 __roadmap__/m0-feasibility-spike/build/trials/README.md create mode 100644 __roadmap__/m0-feasibility-spike/build/trials/host_trials.md create mode 100644 __roadmap__/m0-feasibility-spike/build/trials/report/README.md create mode 100644 __roadmap__/m0-feasibility-spike/build/trials/report/spike_report.md create mode 100644 __roadmap__/m0-feasibility-spike/workspace_skeleton.md diff --git a/__roadmap__/m0-feasibility-spike/README.md b/__roadmap__/m0-feasibility-spike/README.md new file mode 100644 index 0000000..ee7679e --- /dev/null +++ b/__roadmap__/m0-feasibility-spike/README.md @@ -0,0 +1,73 @@ +# M0 Feasibility spike + +## Context +Milestone M0 of the rdm meta-roadmap (`__roadmap__/roadmap-mcp-rework/m0_feasibility_spike.md`), run in parallel with M0b. It proves the pinned stack on real hosts before M1 builds on it: a stub `rdm-mcp` on `rmcp`, speaking MCP 2026-07-28 over stdio, with a Svelte `ui://` page that draws a throwaway fixture. Its report gives M4, M6 and M7 a go or no-go per host. + +## Reference Documents +- [R01 Architecture](../../__design__/rdm/architecture.md) — §Proposed State, §Graph view and §Risks & Mitigations: the pinned stack, the Apps mechanics and the risks this spike settles +- [R02 Meta-roadmap leaf](../roadmap-mcp-rework/m0_feasibility_spike.md) — the milestone gates this campaign must meet +- [R03 Domain model gap analysis](../../__reports__/rdm_domain_model_review/01-gap_analysis_v0.md) — why M0 is reduced to a feasibility check and is independent of the schema + +## Goal +Show, on the real hosts, that the stub server and its `ui://` page work: the page renders, opens a full view and one leaf's content, and makes no network request. Record each host's capabilities and context and the time to display, and give a go or no-go per host. + +## Pre-conditions +- [x] Plan approved by Eliott (2026-11-16) +- [ ] `workspace_skeleton.md` is done on the shared base before `feat/m0-feasibility-spike` is cut + +## Success Gates +- ⬜ `cargo build --workspace` and `cargo test -p rdm-mcp` pass on `feat/m0-feasibility-spike` +- ⬜ Every gate of the meta-roadmap leaf is recorded in `__reports__/m0-feasibility-spike/` as PASS, DEVIATION or BLOCKED, with its evidence +- ⬜ The report gives a go or no-go for Claude Code Desktop, VS Code Copilot and the Claude Code CLI + +## Gotchas +- **Decisions already taken (2026-11-16, Eliott):** + - The core crate is `rdm-engine`, because `rdm-core` is taken. + - The primary host is Claude Code Desktop, this app. VS Code Copilot is best effort and is not a blocker. The CLI does not render MCP Apps, so it is tested for tool calls only. + - The server speaks 2026-07-28 only, with no fallback and no diagnostic flag. A host that fails is a finding. +- **Pins:** + - `rmcp = "=3.10.0"` with the features `server`, `macros` and `transport-io`. 3.10.0 came out on 2026-11-12, after R01's 3.9.0. + - `@modelcontextprotocol/ext-apps` is pinned exactly, at 2.0.4 or later, with `vite-plugin-singlefile` 2.3.4. + - Node 26 and npm 11 are local. +- **What rmcp does and does not type:** rmcp has no typed MCP Apps API. The server builds these values by hand: + - the tool's `_meta.ui.resourceUri`, through `Tool::with_meta` + - `_meta.ui.visibility = ["app"]` on the app-only tools + - `capabilities.extensions["io.modelcontextprotocol/ui"] = {"mimeTypes":["text/html;profile=mcp-app"]}` + - the resource MIME type `text/html;profile=mcp-app` +- **The view's protocol:** the view announces Apps `protocolVersion` `2026-01-26` in `ui/initialize`. +- **Known host issues before the spike:** + - VS Code has an open issue saying it does not negotiate 2026-07-28. + - The desktop app has an open report (2026-11-07) that local stdio apps are not rendered. +- **`basic-host` is not a baseline.** The `basic-host` of ext-apps has no stdio transport, and HTTP is a non-goal. +- **The fixture shape is the contract** between `stub_server` and `graph_view`. It is fixed in `build/stub_server.md` Step 1, and neither leaf changes it alone. +- **Shared resources:** + - One shared `CARGO_TARGET_DIR` holds the builds of both M0 and M0b. + - `node_modules/` is deleted once `view/dist/index.html` is committed. + - Probe data goes to `$RDM_PROBE_DIR`, outside the repository. It is checked for personal data before any of it is copied into a report. +- **Budget:** the spike shares a USD 30 budget with M0b. It uses three Sonnet dispatches (`stub_server`, `graph_view`, `spike_report`), and the coordinator runs `host_trials` with Eliott. + +## Status +```mermaid +graph TD + workspace_skeleton[Workspace skeleton]:::planned + build[Build the stub]:::planned + classDef done fill:#166534,color:#bbf7d0 + classDef inprogress fill:#854d0e,color:#fef08a + classDef planned fill:#374151,color:#e5e7eb + classDef amendment fill:#1e3a5f,color:#bfdbfe + classDef blocked fill:#7f1d1d,color:#fecaca +``` + +## Nodes +| Node | Type | Status | +|:-----|:-----|:-------| +| `workspace_skeleton.md` | 📄 Leaf Task | ⬜ Planned | +| `build/` | 📁 Directory | ⬜ Planned | + +## Amendment Log +| ID | Date | Source | Nodes Added | Rationale | +|:---|:-----|:-------|:------------|:----------| + +## Progress +| Node | Branch | Commits | Notes | +|:-----|:-------|:--------|:------| diff --git a/__roadmap__/m0-feasibility-spike/build/README.md b/__roadmap__/m0-feasibility-spike/build/README.md new file mode 100644 index 0000000..640e2ab --- /dev/null +++ b/__roadmap__/m0-feasibility-spike/build/README.md @@ -0,0 +1,46 @@ +# Build the stub + +## Context +Depth 1 of the spike. It runs after the workspace skeleton exists. Two independent leaves build the stub server, with its fixture, and the graph page; they share only the fixture shape fixed in `stub_server.md`. Their output is what `trials/` puts in front of real hosts. + +## Goal +A stub `rdm-mcp` that serves the built graph page and passes its stdio integration test. + +## Pre-conditions +- [ ] `../workspace_skeleton.md` is done + +## Success Gates +- ⬜ `cargo test -p rdm-mcp` passes with the real `view/dist/index.html` embedded, not the placeholder +- ⬜ The coordinator's integration review finds that the server and the view agree on the fixture shape, the tool names and the probe payload + +## Gotchas +- **The two leaves never write each other's files.** `stub_server` owns `crates/rdm-mcp/` except `view/`, and `graph_view` owns `crates/rdm-mcp/view/`. +- **`build.rs` embeds a placeholder** until `view/dist/index.html` exists. Each leaf can therefore build and land alone. + +## Status +```mermaid +graph TD + stub_server[Stub server]:::planned + graph_view[Graph view]:::planned + trials[Host trials]:::planned + classDef done fill:#166534,color:#bbf7d0 + classDef inprogress fill:#854d0e,color:#fef08a + classDef planned fill:#374151,color:#e5e7eb + classDef amendment fill:#1e3a5f,color:#bfdbfe + classDef blocked fill:#7f1d1d,color:#fecaca +``` + +## Nodes +| Node | Type | Status | +|:-----|:-----|:-------| +| `stub_server.md` | 📄 Leaf Task | ⬜ Planned | +| `graph_view.md` | 📄 Leaf Task | ⬜ Planned | +| `trials/` | 📁 Directory | ⬜ Planned | + +## Amendment Log +| ID | Date | Source | Nodes Added | Rationale | +|:---|:-----|:-------|:------------|:----------| + +## Progress +| Node | Branch | Commits | Notes | +|:-----|:-------|:--------|:------| diff --git a/__roadmap__/m0-feasibility-spike/build/graph_view.md b/__roadmap__/m0-feasibility-spike/build/graph_view.md new file mode 100644 index 0000000..cfc0eb3 --- /dev/null +++ b/__roadmap__/m0-feasibility-spike/build/graph_view.md @@ -0,0 +1,55 @@ +# Graph view + +**Goal**: A Svelte 5 page, built into one HTML file with every script and style inlined, draws the fixture as a depth-ordered graph inside an MCP Apps host. It opens a full view and one leaf's content, and records its own display time and the host's data through the app-only tools. +**Pre-conditions**: +- [ ] `../workspace_skeleton.md` is done +- [ ] The fixture shape and tool names in `stub_server.md` Step 1 and Step 2 are read: they are the contract +**Success Gates**: +- ⬜ `npm --prefix crates/rdm-mcp/view ci && npm --prefix crates/rdm-mcp/view run build` produces `crates/rdm-mcp/view/dist/index.html` as one self-contained file, and the size is printed +- ⬜ `npm --prefix crates/rdm-mcp/view run check:offline` passes. It is a script that fails if the built file has any ` + + diff --git a/crates/rdm-mcp/view/package-lock.json b/crates/rdm-mcp/view/package-lock.json new file mode 100644 index 0000000..f24b756 --- /dev/null +++ b/crates/rdm-mcp/view/package-lock.json @@ -0,0 +1,1350 @@ +{ + "name": "rdm-mcp-view", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "rdm-mcp-view", + "version": "0.0.0", + "dependencies": { + "@modelcontextprotocol/ext-apps": "2.0.4", + "@sveltejs/vite-plugin-svelte": "7.3.1", + "svelte": "5.57.3", + "vite": "8.3.8", + "vite-plugin-singlefile": "2.3.4" + } + }, + "node_modules/@emnapi/core": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", + "integrity": "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==", + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "2.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.2.tgz", + "integrity": "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz", + "integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", + "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@modelcontextprotocol/client": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/client/-/client-2.4.0.tgz", + "integrity": "sha512-LgrD2OphHuG12vfKFKz6SOnq7bKHQmhGJIAYdD+MZBn2npHEyry6uD8zvktodtl5CQM85MO0anUyD9JwmUmxww==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@modelcontextprotocol/core": "2.4.0", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.8", + "jose": "^6.1.3", + "pkce-challenge": "^5.0.0", + "zod": "^4.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@modelcontextprotocol/core": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.4.0.tgz", + "integrity": "sha512-z8QBKqdfXLPzkLQuG4xp8hrVEMm1PZ1IgxMN2sMbJiFiAKOWXnAzogXn2W4aqIBlP1ea6U5yiqVquvUNM1Cj6Q==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "zod": "^4.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@modelcontextprotocol/ext-apps": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/ext-apps/-/ext-apps-2.0.4.tgz", + "integrity": "sha512-B+PcbuGiaf0e5I3uy4iO5tS3Abo+5w8JvZFzHMzQdq9yVwP836zJkw2+KCGOQ0r4TM1fuQi4JdnbuWjkS4aBvg==", + "license": "MIT", + "workspaces": [ + "examples/*" + ], + "dependencies": { + "@standard-schema/spec": "^1.1.0" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "@modelcontextprotocol/client": "^2.0.0", + "@modelcontextprotocol/core": "^2.0.0", + "@modelcontextprotocol/server": "^2.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0", + "zod": "^4.2.0" + }, + "peerDependenciesMeta": { + "@modelcontextprotocol/server": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", + "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.19.tgz", + "integrity": "sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.19.tgz", + "integrity": "sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.19.tgz", + "integrity": "sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.19.tgz", + "integrity": "sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.19.tgz", + "integrity": "sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.19.tgz", + "integrity": "sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.19.tgz", + "integrity": "sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.19.tgz", + "integrity": "sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.19.tgz", + "integrity": "sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.19.tgz", + "integrity": "sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.19.tgz", + "integrity": "sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.19.tgz", + "integrity": "sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.19.tgz", + "integrity": "sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.2.19.tgz", + "integrity": "sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==", + "cpu": [ + "wasm32" + ], + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "2.0.0-beta.2", + "@emnapi/runtime": "2.0.0-beta.2", + "@napi-rs/wasm-runtime": "1.2.6" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.19.tgz", + "integrity": "sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.19.tgz", + "integrity": "sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.1.1.tgz", + "integrity": "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA==", + "license": "MIT" + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "license": "MIT" + }, + "node_modules/@sveltejs/acorn-typescript": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.13.tgz", + "integrity": "sha512-wgKggnhZVL9Bfx1OaKKTrYY9BFRk6C8UAkQNUcIv1+llzYrIqy+RZm5HPKzn0NpEBvTVhTqB4kQyllZywsRBRQ==", + "license": "MIT", + "peerDependencies": { + "acorn": "^8.9.0" + } + }, + "node_modules/@sveltejs/vite-plugin-svelte": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.3.1.tgz", + "integrity": "sha512-ZPsLN8B1e/En+Ak5s4V7srFDT532oS0qieLsQwu63NGKsS+iAjoO2Js1BochlHlglcU+Pt7WAO3C5Ee+4f6gVA==", + "license": "MIT", + "dependencies": { + "deepmerge": "^4.3.1", + "magic-string": "^1.0.0", + "obug": "^2.1.0", + "vitefu": "^1.1.2" + }, + "engines": { + "node": "^20.19 || ^22.12 || >=24" + }, + "peerDependencies": { + "svelte": "^5.46.4", + "vite": "^8.0.0-beta.7 || ^8.0.0" + } + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz", + "integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aria-query": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz", + "integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==", + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "peer": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devalue": { + "version": "5.9.4", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.9.4.tgz", + "integrity": "sha512-sPAT4pztbu6586/hrhOnMKS17IJrvg12mXiSPSS3W5qDeN2RGgvZ0diZCm31dBbnevfVmujNO3IM2wrS4Y2Rhg==", + "license": "MIT" + }, + "node_modules/esm-env": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz", + "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==", + "license": "MIT" + }, + "node_modules/esrap": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.4.0.tgz", + "integrity": "sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "peerDependencies": { + "@typescript-eslint/types": "^8.2.0" + }, + "peerDependenciesMeta": { + "@typescript-eslint/types": { + "optional": true + } + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "peer": true, + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.1.1.tgz", + "integrity": "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/is-reference": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz", + "integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.6" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC", + "peer": true + }, + "node_modules/jose": { + "version": "6.2.17", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.17.tgz", + "integrity": "sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-character": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", + "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/postcss": { + "version": "8.5.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz", + "integrity": "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rolldown": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz", + "integrity": "sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==", + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.156.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.19", + "@rolldown/binding-android-arm64": "1.2.19", + "@rolldown/binding-darwin-arm64": "1.2.19", + "@rolldown/binding-darwin-x64": "1.2.19", + "@rolldown/binding-freebsd-x64": "1.2.19", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.19", + "@rolldown/binding-linux-arm64-gnu": "1.2.19", + "@rolldown/binding-linux-arm64-musl": "1.2.19", + "@rolldown/binding-linux-ppc64-gnu": "1.2.19", + "@rolldown/binding-linux-s390x-gnu": "1.2.19", + "@rolldown/binding-linux-x64-gnu": "1.2.19", + "@rolldown/binding-linux-x64-musl": "1.2.19", + "@rolldown/binding-openharmony-arm64": "1.2.19", + "@rolldown/binding-wasm32-wasi": "1.2.19", + "@rolldown/binding-win32-arm64-msvc": "1.2.19", + "@rolldown/binding-win32-x64-msvc": "1.2.19" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "peer": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/svelte": { + "version": "5.57.3", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.57.3.tgz", + "integrity": "sha512-5mAftM3SoDV9X0zdF386F9p2pv8iKOwi/KfBS1XnBAkVCKFzVOLHUoa8iGWAt4buoicLmyWVRpuuD5wplXOQsg==", + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "@jridgewell/sourcemap-codec": "^1.6.0", + "@sveltejs/acorn-typescript": "^1.0.13", + "@types/estree": "^1.0.9", + "acorn": "^8.18.0", + "aria-query": "5.3.1", + "axobject-query": "^4.1.0", + "clsx": "^2.1.1", + "devalue": "^5.9.2", + "esm-env": "^1.2.1", + "esrap": "^2.3.6", + "is-reference": "^3.0.3", + "locate-character": "^3.0.0", + "magic-string": "^0.30.11", + "zimmerframe": "^1.1.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/svelte/node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "license": "0BSD", + "optional": true + }, + "node_modules/vite": { + "version": "8.3.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.8.tgz", + "integrity": "sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==", + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.32", + "rolldown": "~1.2.18", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-plugin-singlefile": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/vite-plugin-singlefile/-/vite-plugin-singlefile-2.3.4.tgz", + "integrity": "sha512-1FAhlTCL6KJDpSUudrVU+gspapvS+tmKCg70vwNaAU6tyXn3E/C6+NnwQIze06byhBRv7VggZ78K0h+J/Rsdrg==", + "license": "MIT", + "dependencies": { + "picomatch": "^4.0.7" + }, + "engines": { + "node": ">18.0.0" + }, + "peerDependencies": { + "rollup": "^4.59.0", + "vite": "^5.4.21 || ^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/vitefu": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", + "license": "MIT", + "workspaces": [ + "tests/deps/*", + "tests/projects/*", + "tests/projects/workspace/packages/*" + ], + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "peer": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/zimmerframe": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.5.tgz", + "integrity": "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA==", + "license": "MIT" + }, + "node_modules/zod": { + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/crates/rdm-mcp/view/package.json b/crates/rdm-mcp/view/package.json new file mode 100644 index 0000000..9a9680c --- /dev/null +++ b/crates/rdm-mcp/view/package.json @@ -0,0 +1,17 @@ +{ + "name": "rdm-mcp-view", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "build": "vite build && node scripts/check-offline.mjs --size", + "check:offline": "node scripts/check-offline.mjs" + }, + "dependencies": { + "@modelcontextprotocol/ext-apps": "2.0.4", + "@sveltejs/vite-plugin-svelte": "7.3.1", + "svelte": "5.57.3", + "vite": "8.3.8", + "vite-plugin-singlefile": "2.3.4" + } +} diff --git a/crates/rdm-mcp/view/scripts/check-offline.mjs b/crates/rdm-mcp/view/scripts/check-offline.mjs new file mode 100644 index 0000000..f1760a6 --- /dev/null +++ b/crates/rdm-mcp/view/scripts/check-offline.mjs @@ -0,0 +1,39 @@ +// Fails if dist/index.html is not self-contained. +// Usage: node scripts/check-offline.mjs [--size] +import { readFileSync, existsSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; + +const file = fileURLToPath(new URL('../dist/index.html', import.meta.url)); +if (!existsSync(file)) { + console.error('check:offline FAIL: dist/index.html is missing, run the build first'); + process.exit(1); +} +const html = readFileSync(file, 'utf8'); +console.log(`dist/index.html: ${Buffer.byteLength(html)} bytes`); +if (process.argv.includes('--size')) process.exit(0); + +// Each allowed URL string is exact and justified. Anything else fails. +const ALLOWED_URLS = new Map([ + // Inert identifiers inside bundled zod / JSON-schema code (@modelcontextprotocol/core). None is ever fetched. + ['https://json-schema.org/draft/2019-09/schema', 'JSON Schema $schema identifier'], + ['http://json-schema.org/draft/2019-09/schema', 'JSON Schema $schema identifier'], + ['https://json-schema.org/draft/2020-12/schema', 'JSON Schema $schema identifier'], + ['http://json-schema.org/draft-07/schema#', 'JSON Schema $schema identifier'], + ['http://json-schema.org/draft-04/schema#', 'JSON Schema $schema identifier'], + ['http://[${e}]', 'zod hostname-validation template literal, used to parse an IPv6 host, not to fetch'], + ['https://github.com/cfworker', 'attribution string in the bundled cfworker JSON-schema validator'], + ['https://*.example.com', 'zod doc/example string'], +]); + +const problems = []; +if (/]*\bsrc\s*=/i.test(html)) problems.push(' + +
+
+ {view?.campaign ?? 'roadmap'} + {#if view}{view.nodes.length} nodes{/if} + + {#if ran}ran: {ran}{/if} + {#if outline}{/if} +
+ {#if error}

{error}

{/if} + {#if !view} +

{host ? 'waiting for the tool result...' : 'connecting...'}

+ {:else if outline} + + {#if selected}{/if} + {:else} +
+ + +
+ {/if} +
+ + diff --git a/crates/rdm-mcp/view/src/Graph.svelte b/crates/rdm-mcp/view/src/Graph.svelte new file mode 100644 index 0000000..c3ae510 --- /dev/null +++ b/crates/rdm-mcp/view/src/Graph.svelte @@ -0,0 +1,49 @@ + + +
+ {#each columns as col, depth} + {#if col} +
+

depth {depth}

+ {#each col as n (n.path)} + {#if n.kind === 'dir'} +
{n.title}
+ {:else} + + {/if} + {/each} +
+ {/if} + {/each} +
+ + diff --git a/crates/rdm-mcp/view/src/LeafPane.svelte b/crates/rdm-mcp/view/src/LeafPane.svelte new file mode 100644 index 0000000..2e31f19 --- /dev/null +++ b/crates/rdm-mcp/view/src/LeafPane.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/crates/rdm-mcp/view/src/Outline.svelte b/crates/rdm-mcp/view/src/Outline.svelte new file mode 100644 index 0000000..a42199d --- /dev/null +++ b/crates/rdm-mcp/view/src/Outline.svelte @@ -0,0 +1,31 @@ + + +
    + {#each ordered as n (n.path)} +
  • + {#if n.kind === 'dir'} + {n.title} + {:else} + + {/if} +
  • + {/each} +
+ + diff --git a/crates/rdm-mcp/view/src/main.ts b/crates/rdm-mcp/view/src/main.ts index 703a9ba..3fcb539 100644 --- a/crates/rdm-mcp/view/src/main.ts +++ b/crates/rdm-mcp/view/src/main.ts @@ -1,17 +1,4 @@ -import { connect } from './bridge'; +import { mount } from 'svelte'; +import App from './App.svelte'; -const el = document.getElementById('app')!; -el.textContent = 'connecting...'; -connect( - (p) => { - el.textContent = 'tool-result received: ' + JSON.stringify(p.structuredContent ?? null).slice(0, 80); - }, - () => {}, -).then( - (h) => { - el.textContent = 'connected, host protocol ' + h.protocolHost; - }, - (e) => { - el.textContent = 'connect failed: ' + String(e); - }, -); +mount(App, { target: document.getElementById('app')! }); diff --git a/crates/rdm-mcp/view/src/probe.ts b/crates/rdm-mcp/view/src/probe.ts new file mode 100644 index 0000000..a999673 --- /dev/null +++ b/crates/rdm-mcp/view/src/probe.ts @@ -0,0 +1,45 @@ +import { callAppTool } from './bridge'; +import type { HostInfo } from './bridge'; +import type { RoadmapView } from './types'; + +export type DisplayModeRan = 'fullscreen' | 'outline' | 'inline'; + +function runKind(): 'cold' | 'warm' | 'unknown' { + const v = new URLSearchParams(window.location.search).get('run'); + return v === 'cold' || v === 'warm' ? v : 'unknown'; +} + +/** Takes t_view_ms in the first animation frame after the graph mounted. */ +export function nextFrameMs(): Promise { + return new Promise((resolve) => requestAnimationFrame(() => resolve(Date.now()))); +} + +async function send(view: RoadmapView, host: HostInfo, tViewMs: number, displayMode: string) { + // Field names are the probe_record contract of build/stub_server.md Step 2. + return callAppTool('probe_record', { + run_kind: runKind(), + t_server_ms: view.t_server_ms, + t_view_ms: tViewMs, + apps_protocol_announced: host.protocolAnnounced, + apps_protocol_host: host.protocolHost ?? 'unknown', + host_capabilities: host.hostCapabilities ?? null, + host_context: host.hostContext ?? null, + display_mode: displayMode, + }); +} + +/** First paint: one probe_record, display_mode taken from the host's current mode. */ +export async function recordFirstPaint(view: RoadmapView, host: HostInfo, tViewMs: number): Promise { + const ctx = host.hostContext as { displayMode?: string } | undefined; + await send(view, host, tViewMs, ctx?.displayMode ?? 'inline'); +} + +/** Full view opened: a second probe_record saying which path ran (fullscreen or outline). */ +export async function recordFullView( + view: RoadmapView, + host: HostInfo, + tViewMs: number, + ran: DisplayModeRan, +): Promise { + await send(view, host, tViewMs, ran); +} diff --git a/crates/rdm-mcp/view/src/types.ts b/crates/rdm-mcp/view/src/types.ts new file mode 100644 index 0000000..ae42a79 --- /dev/null +++ b/crates/rdm-mcp/view/src/types.ts @@ -0,0 +1,28 @@ +export type Status = 'planned' | 'inprogress' | 'done' | 'amendment' | 'blocked'; + +export interface RoadmapNode { + path: string; + parent: string | null; + kind: 'leaf' | 'dir'; + title: string; + status: Status; + depth: number; +} + +/** structuredContent of roadmap_view: the fixture plus the server's own numbers. */ +export interface RoadmapView { + campaign: string; + frozen_at: string; + nodes: RoadmapNode[]; + t_server_ms: number; + payload_bytes: number; +} + +/** The five legacy classDef colours of the roadmap READMEs. */ +export const STATUS_COLORS: Record = { + done: { fill: '#166534', color: '#bbf7d0' }, + inprogress: { fill: '#854d0e', color: '#fef08a' }, + planned: { fill: '#374151', color: '#e5e7eb' }, + amendment: { fill: '#1e3a5f', color: '#bfdbfe' }, + blocked: { fill: '#7f1d1d', color: '#fecaca' }, +}; From 1f735c5b29858fa8feaa12694b92046e567230df Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:38:49 +0900 Subject: [PATCH 011/183] build(rdm-mcp): commit the built graph view Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-mcp/view/dev/mock-host.html | 83 +++++++++++++ .../sample-leaves/core/engine/render/html.md | 7 ++ .../dev/sample-leaves/core/m1_foundation.md | 7 ++ .../view/dev/sample-leaves/design/spec.md | 7 ++ crates/rdm-mcp/view/dev/sample-roadmap.json | 102 ++++++++++++++++ crates/rdm-mcp/view/dist/index.html | 115 ++++++++++++++++++ crates/rdm-mcp/view/src/App.svelte | 4 +- crates/rdm-mcp/view/src/probe.ts | 9 +- 8 files changed, 330 insertions(+), 4 deletions(-) create mode 100644 crates/rdm-mcp/view/dev/mock-host.html create mode 100644 crates/rdm-mcp/view/dev/sample-leaves/core/engine/render/html.md create mode 100644 crates/rdm-mcp/view/dev/sample-leaves/core/m1_foundation.md create mode 100644 crates/rdm-mcp/view/dev/sample-leaves/design/spec.md create mode 100644 crates/rdm-mcp/view/dev/sample-roadmap.json create mode 100644 crates/rdm-mcp/view/dist/index.html diff --git a/crates/rdm-mcp/view/dev/mock-host.html b/crates/rdm-mcp/view/dev/mock-host.html new file mode 100644 index 0000000..6638c96 --- /dev/null +++ b/crates/rdm-mcp/view/dev/mock-host.html @@ -0,0 +1,83 @@ + + + + + +mock MCP Apps host + + + +

mock host

+ +

message log

+

+
+
+
diff --git a/crates/rdm-mcp/view/dev/sample-leaves/core/engine/render/html.md b/crates/rdm-mcp/view/dev/sample-leaves/core/engine/render/html.md
new file mode 100644
index 0000000..e295f08
--- /dev/null
+++ b/crates/rdm-mcp/view/dev/sample-leaves/core/engine/render/html.md
@@ -0,0 +1,7 @@
+# Render html
+
+**Goal**: sample leaf for the mock host.
+**Status**: blocked
+
+## Step 1
+Do the thing.
diff --git a/crates/rdm-mcp/view/dev/sample-leaves/core/m1_foundation.md b/crates/rdm-mcp/view/dev/sample-leaves/core/m1_foundation.md
new file mode 100644
index 0000000..4af2fa3
--- /dev/null
+++ b/crates/rdm-mcp/view/dev/sample-leaves/core/m1_foundation.md
@@ -0,0 +1,7 @@
+# M1 Foundation
+
+**Goal**: sample leaf for the mock host.
+**Status**: inprogress
+
+## Step 1
+Do the thing.
diff --git a/crates/rdm-mcp/view/dev/sample-leaves/design/spec.md b/crates/rdm-mcp/view/dev/sample-leaves/design/spec.md
new file mode 100644
index 0000000..7aa48ef
--- /dev/null
+++ b/crates/rdm-mcp/view/dev/sample-leaves/design/spec.md
@@ -0,0 +1,7 @@
+# Spec
+
+**Goal**: sample leaf for the mock host.
+**Status**: done
+
+## Step 1
+Do the thing.
diff --git a/crates/rdm-mcp/view/dev/sample-roadmap.json b/crates/rdm-mcp/view/dev/sample-roadmap.json
new file mode 100644
index 0000000..f5dc575
--- /dev/null
+++ b/crates/rdm-mcp/view/dev/sample-roadmap.json
@@ -0,0 +1,102 @@
+{
+  "campaign": "sample-roadmap",
+  "frozen_at": "0000000",
+  "nodes": [
+    {
+      "path": "core",
+      "parent": "core",
+      "kind": "dir",
+      "title": "Core",
+      "status": "inprogress",
+      "depth": 0
+    },
+    {
+      "path": "design",
+      "parent": "design",
+      "kind": "dir",
+      "title": "Design",
+      "status": "done",
+      "depth": 0
+    },
+    {
+      "path": "intro.md",
+      "parent": null,
+      "kind": "leaf",
+      "title": "Intro",
+      "status": "planned",
+      "depth": 0
+    },
+    {
+      "path": "core/m1_foundation.md",
+      "parent": "core",
+      "kind": "leaf",
+      "title": "M1 Foundation",
+      "status": "inprogress",
+      "depth": 1
+    },
+    {
+      "path": "core/engine",
+      "parent": "core",
+      "kind": "dir",
+      "title": "Engine",
+      "status": "inprogress",
+      "depth": 1
+    },
+    {
+      "path": "design/spec.md",
+      "parent": "design",
+      "kind": "leaf",
+      "title": "Spec",
+      "status": "done",
+      "depth": 1
+    },
+    {
+      "path": "design/review.md",
+      "parent": "design",
+      "kind": "leaf",
+      "title": "Review",
+      "status": "amendment",
+      "depth": 1
+    },
+    {
+      "path": "design/notes.md",
+      "parent": "design",
+      "kind": "leaf",
+      "title": "Notes",
+      "status": "planned",
+      "depth": 1
+    },
+    {
+      "path": "core/engine/parse.md",
+      "parent": "core/engine",
+      "kind": "leaf",
+      "title": "Parse",
+      "status": "done",
+      "depth": 2
+    },
+    {
+      "path": "core/engine/render",
+      "parent": "core/engine",
+      "kind": "dir",
+      "title": "Render",
+      "status": "blocked",
+      "depth": 2
+    },
+    {
+      "path": "core/engine/render/html.md",
+      "parent": "core/engine/render",
+      "kind": "leaf",
+      "title": "Render html",
+      "status": "blocked",
+      "depth": 3
+    },
+    {
+      "path": "core/engine/render/svg.md",
+      "parent": "core/engine/render",
+      "kind": "leaf",
+      "title": "Render svg",
+      "status": "planned",
+      "depth": 3
+    }
+  ]
+}
\ No newline at end of file
diff --git a/crates/rdm-mcp/view/dist/index.html b/crates/rdm-mcp/view/dist/index.html
new file mode 100644
index 0000000..a4e2183
--- /dev/null
+++ b/crates/rdm-mcp/view/dist/index.html
@@ -0,0 +1,115 @@
+
+
+  
+    
+    
+    rdm graph view
+    
+    
+  
+  
+    
+ + diff --git a/crates/rdm-mcp/view/src/App.svelte b/crates/rdm-mcp/view/src/App.svelte index 193a315..6ab6e8d 100644 --- a/crates/rdm-mcp/view/src/App.svelte +++ b/crates/rdm-mcp/view/src/App.svelte @@ -7,8 +7,8 @@ import Outline from './Outline.svelte'; import type { RoadmapView } from './types'; - let view = $state(null); - let host = $state(null); + let view = $state.raw(null); + let host = $state.raw(null); let error = $state(null); let theme = $state<'light' | 'dark'>('light'); let selected = $state(null); diff --git a/crates/rdm-mcp/view/src/probe.ts b/crates/rdm-mcp/view/src/probe.ts index a999673..4b2fa56 100644 --- a/crates/rdm-mcp/view/src/probe.ts +++ b/crates/rdm-mcp/view/src/probe.ts @@ -14,6 +14,11 @@ export function nextFrameMs(): Promise { return new Promise((resolve) => requestAnimationFrame(() => resolve(Date.now()))); } +// postMessage cannot clone Proxy objects; send plain JSON. +function plain(v: unknown): unknown { + return v === undefined ? null : JSON.parse(JSON.stringify(v)); +} + async function send(view: RoadmapView, host: HostInfo, tViewMs: number, displayMode: string) { // Field names are the probe_record contract of build/stub_server.md Step 2. return callAppTool('probe_record', { @@ -22,8 +27,8 @@ async function send(view: RoadmapView, host: HostInfo, tViewMs: number, displayM t_view_ms: tViewMs, apps_protocol_announced: host.protocolAnnounced, apps_protocol_host: host.protocolHost ?? 'unknown', - host_capabilities: host.hostCapabilities ?? null, - host_context: host.hostContext ?? null, + host_capabilities: plain(host.hostCapabilities), + host_context: plain(host.hostContext), display_mode: displayMode, }); } From f2849c036dd33d80e6be9053ec9d013ea480ca52 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:36:05 +0900 Subject: [PATCH 012/183] test(rdm-mcp): freeze the meta-roadmap as the spike fixture Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-mcp/fixtures/freeze.py | 103 ++++++++++++++ .../consumers/delivery/cutover/m8_cutover.md | 41 ++++++ .../consumers/delivery/m6_apps_view.md | 41 ++++++ .../consumers/delivery/m7_distribution.md | 42 ++++++ .../interchange/consumers/m4_mcp_server.md | 41 ++++++ .../engine/interchange/consumers/m5_cli.md | 40 ++++++ .../core/engine/interchange/m3_interchange.md | 40 ++++++ .../leaves/core/engine/m2_graph_engine.md | 42 ++++++ .../leaves/core/m1_core_foundation.md | 42 ++++++ .../fixtures/leaves/m0_feasibility_spike.md | 43 ++++++ .../fixtures/leaves/m0b_domain_model_spec.md | 42 ++++++ crates/rdm-mcp/fixtures/roadmap.json | 134 ++++++++++++++++++ 12 files changed, 651 insertions(+) create mode 100644 crates/rdm-mcp/fixtures/freeze.py create mode 100644 crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/cutover/m8_cutover.md create mode 100644 crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/m6_apps_view.md create mode 100644 crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/m7_distribution.md create mode 100644 crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/m4_mcp_server.md create mode 100644 crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/m5_cli.md create mode 100644 crates/rdm-mcp/fixtures/leaves/core/engine/interchange/m3_interchange.md create mode 100644 crates/rdm-mcp/fixtures/leaves/core/engine/m2_graph_engine.md create mode 100644 crates/rdm-mcp/fixtures/leaves/core/m1_core_foundation.md create mode 100644 crates/rdm-mcp/fixtures/leaves/m0_feasibility_spike.md create mode 100644 crates/rdm-mcp/fixtures/leaves/m0b_domain_model_spec.md create mode 100644 crates/rdm-mcp/fixtures/roadmap.json diff --git a/crates/rdm-mcp/fixtures/freeze.py b/crates/rdm-mcp/fixtures/freeze.py new file mode 100644 index 0000000..4425673 --- /dev/null +++ b/crates/rdm-mcp/fixtures/freeze.py @@ -0,0 +1,103 @@ +"""Freeze the meta-roadmap at a commit as the spike fixture (stdlib only). + +Usage: uv run --no-project crates/rdm-mcp/fixtures/freeze.py +""" +import json +import re +import shutil +import subprocess +import sys +from pathlib import Path + +ROOT_DIR = "__roadmap__/roadmap-mcp-rework" +OUT_DIR = Path(__file__).resolve().parent + +STATUS_WORDS = { + "planned": "planned", + "in progress": "inprogress", + "done": "done", + "amendment": "amendment", + "blocked": "blocked", +} + + +def git(*args: str) -> str: + return subprocess.run( + ["git", *args], check=True, capture_output=True, text=True + ).stdout + + +def read_tree(commit: str) -> dict[str, str]: + """Return {path relative to the campaign root: file text} for every file.""" + names = git("ls-tree", "-r", "--name-only", commit, ROOT_DIR + "/").splitlines() + return { + n[len(ROOT_DIR) + 1 :]: git("show", f"{commit}:{n}") for n in names + } + + +def parse_nodes_table(readme: str) -> list[tuple[str, str, str]]: + """Return [(name, kind, status)] from a README's Nodes table, in table order.""" + rows = [] + in_nodes = False + for line in readme.splitlines(): + if line.startswith("## "): + in_nodes = line.strip() == "## Nodes" + continue + if not in_nodes or not line.startswith("|"): + continue + cells = [c.strip() for c in line.strip().strip("|").split("|")] + m = re.fullmatch(r"`([^`]+)`", cells[0]) if len(cells) == 3 else None + if not m: + continue + name = m.group(1) + label = re.sub(r"^[^\w]+", "", cells[2]).strip().lower() + rows.append( + ("dir" if name.endswith("/") else "leaf", name.rstrip("/"), STATUS_WORDS[label]) + ) + return [(name, kind, status) for kind, name, status in rows] + + +def title_of(text: str, fallback: str) -> str: + for line in text.splitlines(): + if line.startswith("# "): + return line[2:].strip() + return fallback + + +def main() -> None: + commit = sys.argv[1] + sha = git("rev-parse", commit).strip() + tree = read_tree(sha) + nodes = [] + queue = [""] # directories, breadth first + while queue: + d = queue.pop(0) + readme = tree[(d + "/" if d else "") + "README.md"] + for name, kind, status in parse_nodes_table(readme): + path = f"{d}/{name}" if d else name + text = tree[path + "/README.md"] if kind == "dir" else tree[path] + nodes.append( + { + "path": path, + "parent": d or None, + "kind": kind, + "title": title_of(text, name), + "status": status, + "depth": path.count("/"), + } + ) + if kind == "dir": + queue.append(path) + out = {"campaign": "roadmap-mcp-rework", "frozen_at": sha, "nodes": nodes} + (OUT_DIR / "roadmap.json").write_text(json.dumps(out, indent=2) + "\n") + leaves = OUT_DIR / "leaves" + shutil.rmtree(leaves, ignore_errors=True) + for n in nodes: + if n["kind"] == "leaf": + dest = leaves / n["path"] + dest.parent.mkdir(parents=True, exist_ok=True) + dest.write_text(tree[n["path"]]) + + +if __name__ == "__main__": + main() diff --git a/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/cutover/m8_cutover.md b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/cutover/m8_cutover.md new file mode 100644 index 0000000..36a4552 --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/cutover/m8_cutover.md @@ -0,0 +1,41 @@ +# M8 Cutover + +**Goal**: `managing-roadmaps` ships with the MCP server and no script: the skill teaches the tools through usage patterns, the old crate is gone and this repository's roadmaps are JSON. +**Pre-conditions**: +- [ ] `../m6_apps_view.md` and `../m7_distribution.md` are `done` +- [ ] Reminder `skills-rdm-M8` read +**Success Gates**: +- ⬜ `SKILL.md` is built around usage patterns, each a short tool sequence that produces a named result +- ⬜ `skills/managing-roadmaps/scripts/` and its copy under `plugins/managing-roadmaps/` no longer exist, and no file in the repository refers to `dirtree-rdm` except history +- ⬜ Every campaign under `__roadmap__/` is migrated to JSON, or its exclusion is recorded with the reason +- ⬜ `README.md`, `CONTRIBUTING.md`, `instructions/code-change-phases.instructions.md` and the `writing-reports` handoff text describe the new tooling +- ⬜ A fresh agent session, given only the installed plugin, authors and amends a small roadmap +**References**: [R01 §Executive Summary, §Key Flows, §Deliberately open](../../../../../../../../__design__/rdm/architecture.md) — what the skill must teach and the flows its usage patterns cover + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m8-cutover/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: the usage patterns `SKILL.md` carries (author a campaign, pick and start the next ready leaf, record a step and finish a leaf, insert a milestone between two levels, split an oversized leaf, re-plan a subtree after new information, export a leaf for a human, migrate a legacy roadmap); which references survive, trimmed, and which go (grammar, CLI, schema validation, tier examples); the order of removal so that no commit leaves the plugin without a working tool; the migration of the existing campaigns, including this meta-roadmap and the invalid legacy one; the major version bump of the plugin; skills outside this repository that mention the old tooling (`umbod`), reported to Eliott and not edited. +Adversarial verification is required for the migration of the existing campaigns (they are kept as specification sources) and is done by a fresh-session trial for the skill text. +**Deliverables**: `__roadmap__/m8-cutover/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m8-cutover/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m8-cutover milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m8-cutover`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: the rewritten `skills/managing-roadmaps/SKILL.md` and references; the migrated `__roadmap__/`; updated `README.md`, `CONTRIBUTING.md`, `instructions/code-change-phases.instructions.md`, `skills/writing-reports/` +**Consistency Checks**: `uv run tools/quick_validate.py skills/managing-roadmaps` (expected: PASS) +**Commit**: `feat(managing-roadmaps)!: replace dirtree-rdm with the rdm MCP server` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m8-cutover/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M8` complete; the rework is complete. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m8-cutover/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/cutover/README.md` +**Consistency Checks**: `rdm validate __roadmap__/roadmap-mcp-rework` (expected: PASS) +**Commit**: `docs(reports): close the m8-cutover milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/m6_apps_view.md b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/m6_apps_view.md new file mode 100644 index 0000000..d7d2286 --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/m6_apps_view.md @@ -0,0 +1,41 @@ +# M6 Apps view + +**Goal**: A host that supports MCP Apps shows the roadmap as a graph: waves, statuses, leaf details and the amendment log. +**Pre-conditions**: +- [ ] `../m4_mcp_server.md` is `done` (the tree also waits for `../m5_cli.md`; the reminder needs only M4) +- [ ] Reminder `skills-rdm-M6` read +**Success Gates**: +- ⬜ The view renders in this desktop app from the installed server, for the largest existing campaign +- ⬜ The page makes zero network requests and stays under the size budget set in the plan +- ⬜ The view writes nothing: it only calls the app-only read tool +- ⬜ The built HTML is committed, and CI rebuilds it and fails on a difference +- ⬜ A host without MCP Apps receives the same information as text and structured content +**References**: [R01 §Graph view, §Tool surface (suggestion)](../../../../../../../__design__/rdm/architecture.md) — what the view shows, how it is built and how it degrades + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m6-apps-view/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: the layout (waves as columns, directories as groups, the detail pane, the amendment timeline) and how it reads on a narrow panel; the data contract of the app-only tool and how TypeScript types are generated from the `rdm-schema` JSON Schemas (the app-only tool returns the read model); refresh (polling interval, manual refresh); theming from the host; the Svelte and Vite setup producing one inlined file, the pinned Node version and a deterministic build; the size budget; the headless smoke test. +No adversarial verification; Eliott reviews the view by eye. +**Deliverables**: `__roadmap__/m6-apps-view/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m6-apps-view/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m6-apps-view milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m6-apps-view`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: the Svelte source under `crates/rdm-mcp/ui/`; the built `crates/rdm-mcp/assets/view.html`; the app-only tool; the smoke test and the rebuild check in CI +**Consistency Checks**: `cargo test -p rdm-mcp` (expected: PASS) +**Commit**: `feat(rdm-mcp): land the roadmap graph view` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m6-apps-view/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M6` complete; `skills-rdm-M8` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m6-apps-view/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/` (expected: PASS) +**Commit**: `docs(reports): close the m6-apps-view milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/m7_distribution.md b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/m7_distribution.md new file mode 100644 index 0000000..82062e4 --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/delivery/m7_distribution.md @@ -0,0 +1,42 @@ +# M7 Distribution + +**Goal**: The four crates are published by CI, and an installed plugin starts the server version it pins, on macOS, Linux and Windows, and keeps doing so across plugin updates with no action from the consumer. +**Pre-conditions**: +- [ ] `../m4_mcp_server.md` and `../m5_cli.md` are `done` +- [ ] Reminder `skills-rdm-M7` read +- [ ] Eliott has agreed to publish to crates.io +**Success Gates**: +- ⬜ A merge to `main` releases the crates (`rdm-schema`, then `rdm-engine`, then `rdm-mcp` and `rdm-cli`), attaches prebuilt binaries and checksums to the GitHub release, and only then releases the plugin pinned to that version +- ⬜ A plugin installed from a scratch marketplace starts the pinned server on a clean machine +- ⬜ After a plugin update the new server version starts with no manual step +- ⬜ With no network, an installed binary of the same major version starts with a warning; otherwise the failure names the exact install command +- ⬜ `tools/check_plugin.py` passes with the MCP manifests of `managing-roadmaps`, and the drift job is green +**References**: [R01 §Launch and distribution](../../../../../../../__design__/rdm/architecture.md) — the publication order and the self-provisioning launch + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m7-distribution/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: the release tool for the crates beside the skills' `multi-semantic-release` (follow the `writing-release` skill: tooling derived from the repository, CI releases after a merge, no local release commands); tag shapes and the two version lines (`rdm-schema` alone; `rdm-engine`, `rdm-mcp` and `rdm-cli` on one product version, which the plugin pins) and whether the chosen release tool supports them; the order inside one workflow run, since a push made with the workflow token starts no other workflow; binary targets and checksums; the self-provisioning launch (download, verification, cache location, same-major fallback) or a better scheme if one is found; the MCP entries in `plugin.spec.json` and what `tools/assemble_plugin.py` and `tools/check_plugin.py` must learn; changes to `.github/workflows/release.yml`, `release-config.js`, `.githooks/pre-commit`, `Makefile` and `CONTRIBUTING.md`. +Adversarial verification is required for the launch (it downloads and runs a binary: checksum handling, cache poisoning, partial downloads). Reviewed-PR lane: this changes CI and release machinery. +**Deliverables**: `__roadmap__/m7-distribution/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m7-distribution/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m7-distribution milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m7-distribution`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: the release configuration for the crates; the reworked `.github/workflows/release.yml`; the launch code in `crates/rdm-mcp`; the MCP manifests under `plugins/managing-roadmaps/`; updated `plugin.spec.json`, `tools/`, `CONTRIBUTING.md` +**Consistency Checks**: `uv run tools/check_plugin.py --root . --spec plugin.spec.json` (expected: PASS) +**Commit**: `ci(release): land rdm distribution` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m7-distribution/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M7` complete; `skills-rdm-M8` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m7-distribution/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/delivery/` (expected: PASS) +**Commit**: `docs(reports): close the m7-distribution milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/m4_mcp_server.md b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/m4_mcp_server.md new file mode 100644 index 0000000..a32f6ee --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/m4_mcp_server.md @@ -0,0 +1,41 @@ +# M4 MCP server + +**Goal**: `rdm-mcp` exposes the core to agents as a small set of stdio MCP tools, with no roadmap logic of its own. +**Pre-conditions**: +- [ ] `../m3_interchange.md` is `done` +- [ ] Reminder `skills-rdm-M4` read +**Success Gates**: +- ⬜ The server passes the MCP 2026-07-28 conformance suite over stdio +- ⬜ Every tool returns a text summary and `structuredContent` matching its `outputSchema`, which is the read-model type of `rdm-schema` wherever one exists; read tools are marked read-only; no tool requires user interaction (I11) +- ⬜ An author, execute, amend cycle on a campaign runs from an agent session with no shell call +- ⬜ Every tool handler maps to one core call (I2), and every call names its campaign (I10) +- ⬜ Tool results stay within a stated size budget on the largest existing campaign +**References**: [R01 §Tool surface (suggestion), §Contracts & Invariants](../../../../../../__design__/rdm/architecture.md) — the suggested tools and the constraints that are fixed + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m4-mcp-server/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: the final tool list, names and order (R01's table is a suggestion: keep it small, and keep one tool for every re-branching and move and one for status including `done`); input schemas and the envelope around the read-model types; the error mapping from core errors to tool errors; output size budgets and pagination; which tools are safe to allow-list for unattended runs; how conformance is run in CI; what the server answers a host that lacks MCP Apps. +Adversarial verification is required for the error mapping and the stale-revision path only; the rest is checked by conformance. +**Deliverables**: `__roadmap__/m4-mcp-server/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m4-mcp-server/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m4-mcp-server milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m4-mcp-server`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: `crates/rdm-mcp` with the tool handlers, schemas and error mapping; the conformance job +**Consistency Checks**: `cargo test -p rdm-mcp` (expected: PASS) +**Commit**: `feat(rdm-mcp): land the MCP server` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m4-mcp-server/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M4` complete; `skills-rdm-M6`, `skills-rdm-M7` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m4-mcp-server/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/` (expected: PASS) +**Commit**: `docs(reports): close the m4-mcp-server milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/m5_cli.md b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/m5_cli.md new file mode 100644 index 0000000..fe4be80 --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/consumers/m5_cli.md @@ -0,0 +1,40 @@ +# M5 CLI + +**Goal**: `rdm-cli` (binary `rdm`) gives a human the same operations as the MCP tools: peek at a roadmap, export markdown and make updates, with no roadmap logic of its own. +**Pre-conditions**: +- [ ] `../m3_interchange.md` is `done` +- [ ] Reminder `skills-rdm-M5` read +**Success Gates**: +- ⬜ Every core operation is reachable from a `rdm` verb +- ⬜ `rdm` and the MCP tools give the same result on the same input, checked by a shared test (I2); before M4 lands the test compares against the core directly +- ⬜ Every verb has a `--json` output, and a content or structure edit refuses to run without an amendment description (I5) +- ⬜ `rdm export` prints the markdown of any node, and `rdm` works from any directory given a campaign path +**References**: [R01 §Proposed State, §Key Flows, §Contracts & Invariants](../../../../../../__design__/rdm/architecture.md) — the consumer rule and the flows a human runs + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m5-cli/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: the verbs and their arguments, mirroring the core operations; the human output (tree, waves, colours, `NO_COLOR`) and the `--json` output; how an amendment description is passed; how a structural batch is given (a file, standard input); what `rdm` reuses from the old `dirtree-rdm` rendering; how the shared CLI and MCP equivalence test is built so that neither consumer waits for the other. +No adversarial verification: the gates are mechanical. +**Deliverables**: `__roadmap__/m5-cli/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m5-cli/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m5-cli milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m5-cli`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: `crates/rdm-cli` with the `rdm` binary and its verbs; the equivalence test +**Consistency Checks**: `cargo test -p rdm-cli` (expected: PASS) +**Commit**: `feat(rdm-cli): land the rdm CLI` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m5-cli/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M5` complete; `skills-rdm-M7` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m5-cli/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/` (expected: PASS) +**Commit**: `docs(reports): close the m5-cli milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/m3_interchange.md b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/m3_interchange.md new file mode 100644 index 0000000..d7e784f --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/core/engine/interchange/m3_interchange.md @@ -0,0 +1,40 @@ +# M3 Interchange + +**Goal**: `rdm-engine` exports any node to markdown for a human reader and imports a legacy markdown roadmap into the JSON store. +**Pre-conditions**: +- [ ] `../m2_graph_engine.md` is `done` +- [ ] Reminder `skills-rdm-M3` read +**Success Gates**: +- ⬜ Any leaf, directory or campaign exports to markdown, with the node table and the status graph derived at export time (I6) +- ⬜ Every campaign under `__roadmap__/` that the current `dirtree-rdm validate` accepts imports, pass validation and export with no loss of content, compared as parsed models +- ⬜ `__roadmap__/create-reporting-skill/`, invalid by design, imports to a fixed list of diagnostics and writes nothing +- ⬜ An import into a non-empty target is refused, and a dry-run writes nothing +**References**: [R01 §Data Model, §Key Flows, §Deliberately open](../../../../../__design__/rdm/architecture.md) — what is stored and what is derived, and the migrate flow + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m3-interchange/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: the markdown layout of an exported leaf, directory and campaign (close to today's format, since humans know it); how the existing Amendment Log and Progress rows map to amendments, history and progress; how ids are minted on import; what the importer does with input the old grammar rejects; how the existing campaigns become fixtures without copying their history; the import report. +Adversarial verification is required for the importer (a silent loss of content during migration is found months later). +**Deliverables**: `__roadmap__/m3-interchange/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m3-interchange/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m3-interchange milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m3-interchange`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: `crates/rdm-engine` modules for export and import; fixtures of the existing campaigns; golden tests +**Consistency Checks**: `cargo test -p rdm-engine` (expected: PASS) +**Commit**: `feat(rdm-engine): land export and import` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m3-interchange/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M3` complete; `skills-rdm-M4`, `skills-rdm-M5` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m3-interchange/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/core/engine/interchange/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/core/engine/interchange/` (expected: PASS) +**Commit**: `docs(reports): close the m3-interchange milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/core/engine/m2_graph_engine.md b/crates/rdm-mcp/fixtures/leaves/core/engine/m2_graph_engine.md new file mode 100644 index 0000000..5caee2d --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/core/engine/m2_graph_engine.md @@ -0,0 +1,42 @@ +# M2 Graph engine + +**Goal**: `rdm-engine` validates a whole campaign, computes its order, enforces the status machine and applies every create, read, update, delete and restructuring operation, singly or as an atomic batch, with amendments recorded. +**Pre-conditions**: +- [ ] `../m1_core_foundation.md` is `done` +- [ ] Reminder `skills-rdm-M2` read +**Success Gates**: +- ⬜ Whole-campaign validation returns diagnostics with stable codes, and a golden test pins the wave semantics (the ordering rule M0b fixes, checked against `skills/managing-roadmaps/references/dirtree-execution.md`) +- ⬜ The read-model projections of `rdm-schema` are computed by one set of functions in `rdm-engine`, and a golden test pins each against the worked examples of M0b +- ⬜ Property tests: random trees under random operation sequences stay valid, keep ids unique and conserve leaves except on delete +- ⬜ Every content or structure edit writes exactly one amendment with a non-empty description; status and progress write none (I5) +- ⬜ A batch is atomic: a failing operation leaves the campaign untouched, and a dry-run writes nothing +- ⬜ `done` is refused while a step lacks its commit (I8); deleting or reopening done work and moving work in progress are refused without an acknowledgement (I9) +**References**: [R01 §Graph operations, §Contracts & Invariants](../../../../__design__/rdm/architecture.md) — validation, order, the status machine, the operations, impact analysis and batch + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m2-graph-engine/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: the diagnostic codes; the ready-set and next-leaf rules; the status transitions, taking the meanings and the ordering rule fixed by M0b as given, and how a directory's status is derived; the primitive and composite operations with their pre- and postconditions; how 'run X after Y' is expressed as depth edits and how candidate plans are ranked; what impact analysis reports and which effects need an acknowledgement; batch semantics (aliases for nodes created earlier, limits, dry-run); how an amendment records a change and a removed subtree; whether a cross-worktree claim hint is worth having. +Adversarial verification is required for the structural operations and impact analysis (a wrong edit reorders work silently) and for the status machine. +**Deliverables**: `__roadmap__/m2-graph-engine/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m2-graph-engine/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m2-graph-engine milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m2-graph-engine`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: `crates/rdm-engine` modules for validation, order, the status machine, operations, impact analysis and batch; the property tests +**Consistency Checks**: `cargo test -p rdm-engine` (expected: PASS) +**Commit**: `feat(rdm-engine): land the graph engine` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m2-graph-engine/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M2` complete; `skills-rdm-M3` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m2-graph-engine/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/core/engine/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/core/engine/` (expected: PASS) +**Commit**: `docs(reports): close the m2-graph-engine milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/core/m1_core_foundation.md b/crates/rdm-mcp/fixtures/leaves/core/m1_core_foundation.md new file mode 100644 index 0000000..5847df6 --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/core/m1_core_foundation.md @@ -0,0 +1,42 @@ +# M1 Core foundation + +**Goal**: `rdm-engine` stores a roadmap as JSON, one file per node, and N processes can read and write one campaign without losing or tearing a write. +**Pre-conditions**: +- [ ] `../m0_feasibility_spike.md` is `done` with a go +- [ ] `../m0b_domain_model_spec.md` is `done` +- [ ] Reminder `skills-rdm-M1` read +**Success Gates**: +- ⬜ `rdm-engine` depends on `rdm-schema` for every stored type and holds none of its own; a file with a newer format major is refused with an upgrade message +- ⬜ Canonical serialisation round-trips byte for byte, and unknown fields survive a read and a write (I12) +- ⬜ A multi-process test with kill injection at every journal stage passes on macOS, Linux and Windows: no lost update, no state that fails to load (I3) +- ⬜ A write presenting a stale revision is refused and changes nothing (I4) +- ⬜ A node's `id` is unchanged by a rename or a move (I7) +**References**: [R01 §Data Model, §Concurrency, §Contracts & Invariants](../../../__design__/rdm/architecture.md) — the file layout, the schema sketch, the lock, the journal and the revisions + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m1-core-foundation/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: the id minting, to the format M0b fixes; canonical JSON (field order, line arrays for prose) over the `rdm-schema` types; how the store reads the format version; the lock crate (std's file lock needs a newer toolchain than the MSRV); the journal format and its recovery rule; the revision hash; how the multi-process test injects failures and how it runs on three operating systems; the error type consumers will map. +Adversarial verification is required for the store, lock and journal (silent data loss). The schemas were settled in M0b. +**Deliverables**: `__roadmap__/m1-core-foundation/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m1-core-foundation/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m1-core-foundation milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m1-core-foundation`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: `crates/rdm-engine` modules for the store (lock, atomic writes, journal, revisions) over the `rdm-schema` types; the multi-process test +**Consistency Checks**: `cargo test -p rdm-engine` (expected: PASS) +**Commit**: `feat(rdm-engine): land the core foundation` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m1-core-foundation/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M1` complete; `skills-rdm-M2` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m1-core-foundation/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/core/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/core/` (expected: PASS) +**Commit**: `docs(reports): close the m1-core-foundation milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/m0_feasibility_spike.md b/crates/rdm-mcp/fixtures/leaves/m0_feasibility_spike.md new file mode 100644 index 0000000..cbeb7bd --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/m0_feasibility_spike.md @@ -0,0 +1,43 @@ +# M0 Feasibility spike + +**Goal**: The stack is proven against real hosts before anything depends on it: a stub server on the pinned `rmcp` speaks MCP 2026-07-28 over stdio, its Svelte `ui://` page renders a graph of an existing roadmap, and each host's capabilities and display time are recorded. The payload is a throwaway and does not depend on the new schema (M0b). +**Pre-conditions**: +- [ ] R01 read (`__design__/rdm/architecture.md`) +- [ ] Reminder `skills-rdm-M0` read +**Success Gates**: +- ⬜ A stub `rdm-mcp` with one tool and one `ui://` resource lists and calls its tool from this desktop app, from VS Code Copilot and from the Claude Code CLI +- ⬜ The `ui://` page, a Svelte build inlined into one HTML file, renders a graph of a throwaway fixture cut from an existing roadmap in this desktop app and in VS Code Copilot, opens a full view and one leaf's content through an app-only tool, and makes zero network requests +- ⬜ Each host's `hostCapabilities` and `hostContext` are dumped as raw JSON (checked for personal data first), with the protocol version each host speaks and the version the view announces +- ⬜ Time to display is measured: a server stamp against a view stamp sent through an app-only tool, cold and warm, median and worst, with the payload size; the report says how many runs were needed and why that number controls the noise +- ⬜ The exact allow-rule string of the tool, read from a real session, is written down +- ⬜ The crate names `rdm-schema`, `rdm-engine`, `rdm-mcp` and `rdm-cli` are confirmed free on crates.io (`rdm-core` was taken; Eliott chose `rdm-engine` on 2026-11-16) +- ⬜ A go/no-go is written for each host; on no-go the later milestones are amended before they start +**References**: [R01 §Proposed State, §Graph view, §Risks & Mitigations](../../__design__/rdm/architecture.md) — the pinned stack, the Apps mechanics and the risks this spike settles + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m0-feasibility-spike/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding: what the stub contains and nothing more (one tool with structured output, one `ui://` page, two app-only tools: one returns a leaf's content, one records stamps and host data); the fixture (an existing roadmap, filtered to the fields the tests need; the largest and deepest campaign is now this meta-roadmap (10 leaves, depth 6; `writing-release-rework` is closed), so use a frozen copy of it); the exact reading of "full view" (the whole-campaign outline, or the host's fullscreen display mode if it offers one); the message names, checked against the Apps spec; the number of runs (a short pilot to estimate the noise, then enough cold and warm runs for stable medians and a trustworthy worst case); the `basic-host` of the ext-apps repository as an optional baseline; how each host is tested and what counts as rendering; how the `rmcp` version is pinned and which of its calls set tool `_meta`, the Apps MIME type and the `io.modelcontextprotocol/ui` capability; whether the Apps client library fits a small bundle or a hand-written bridge is needed; where the workspace skeleton lives (`crates/`, an empty CI job); what is done if a host does not speak 2026-07-28 (the maintainer wants 2026-07-28 conformance only, so a failing host is a finding to bring back, not a reason to add a fallback). +No adversarial verification: the gates are observations on real hosts, made with Eliott. +**Deliverables**: `__roadmap__/m0-feasibility-spike/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m0-feasibility-spike/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m0-feasibility-spike milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m0-feasibility-spike`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. If a design decision changed, `__design__/rdm/architecture.md` changes in the same merge. +**Deliverables**: the Cargo workspace skeleton under `crates/` (root manifest with `members = ["crates/*"]`) with a stub `rdm-mcp`; the spike report with the go/no-go per host, the host dumps and the timing data under `__reports__/m0-feasibility-spike/` +**Consistency Checks**: `cargo build --workspace` (expected: PASS) +**Commit**: `feat(rdm-mcp): land the feasibility spike` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m0-feasibility-spike/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M0` complete; `skills-rdm-M1` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m0-feasibility-spike/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/` (expected: PASS) +**Commit**: `docs(reports): close the m0-feasibility-spike milestone` diff --git a/crates/rdm-mcp/fixtures/leaves/m0b_domain_model_spec.md b/crates/rdm-mcp/fixtures/leaves/m0b_domain_model_spec.md new file mode 100644 index 0000000..8d8c9ba --- /dev/null +++ b/crates/rdm-mcp/fixtures/leaves/m0b_domain_model_spec.md @@ -0,0 +1,42 @@ +# M0b Domain model spec + +**Goal**: The meaning of every stored fact and the shape every consumer receives are specified and held in the `rdm-schema` crate, before any milestone builds on them: status meanings, the stored schema inventory and the read model. +**Pre-conditions**: +- [ ] R01 read (`__design__/rdm/architecture.md`) and the gap analysis `__reports__/rdm_domain_model_review/01-gap_analysis_v0.md` +- [ ] Reminder `skills-rdm-M0b` read +**Success Gates**: +- ⬜ `crates/rdm-schema` holds the stored types, the read-model types, the format version (`MAJOR.MINOR`) and the read-model version as constants, with no store and no I/O; JSON Schemas are generated from the types and committed, and CI fails when they drift +- ⬜ The meaning of `blocked` and `amendment` is written as a transition table (who sets each move, its preconditions, its effect on the ready set), and R01 is updated in the same merge +- ⬜ Every production of `leaf.bnf` and `readme.bnf` maps to a stored field, a derived field or a recorded drop, in a committed traceability table +- ⬜ The read model has one worked example per projection, and reports `level` together with where it comes from +- ⬜ Depth stays the only ordering rule for now (Eliott, 2026-11-16): the stored schema has no edge field, the read model derives `level` from depth and reports it, and the open question stays open for a later revisit +**References**: [R01 §Data Model, §Graph operations, §Contracts & Invariants](../../__design__/rdm/architecture.md) — the provisional schema sketch and the status machine this milestone settles; [gap analysis](../../__reports__/rdm_domain_model_review/01-gap_analysis_v0.md) — why the milestone exists and what it owns + +## Step 1: Plan the milestone + +**Goal**: The campaign `__roadmap__/m0b-domain-model-spec/` exists and Eliott has approved it. +**Implementation Logic**: +In plan mode, author the campaign with `managing-roadmaps`, deciding the details this leaf does not: the transition table and the meaning of `blocked` (terminal in the legacy skill, resumable in R01; whether a blocked leaf satisfies its level) and of `amendment` (a birth state in the skill, a reopened state in R01; whether it stays a status); the stored shape of per-criterion state, step title, step timestamp, the breaking mark of a commit, structured references and amendment display ids (a sequential id collides when two branches mint one); the projections of the read model and what each carries; how the format version relates to the crate version (the files carry `MAJOR.MINOR`, a format major forces a crate major, a format minor a crate minor); the ordering rule, which stays depth for now by Eliott's decision of 2026-11-16 (the schema gains no edge field; `__reports__/rdm_domain_model_review/00-open_question_v0.md` keeps the options, and adding an optional edge field later is a minor format bump); where the work splits into leaves. +The crate is `rdm-schema`, published at M7 with the other crates and kept at `0.x` until then. Its root manifest uses `members = ["crates/*"]`, agreed with M0, so the two parallel branches never edit the same line. +No adversarial verification by default: the work is specification and Eliott reviews it. A fresh-session read of the traceability table is optional, with a brief that names what to attack (fields dropped silently). +**Deliverables**: `__roadmap__/m0b-domain-model-spec/README.md` and its leaves +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m0b-domain-model-spec/` (expected: PASS) +**Commit**: `chore(roadmap): plan the m0b-domain-model-spec milestone` + +## Step 2: Build and land + +**Goal**: The milestone campaign is executed and lands on `main`. +**Implementation Logic**: +Execute the campaign on `feat/m0b-domain-model-spec`, then land it on `main` through the lane the `writing-release` skill assigns, as one merge commit. Git management follows the `writing-history` skill. The Success Gates above must pass on `main` after the merge. `__design__/rdm/architecture.md` changes in the same merge: §Data Model, §Deliberately open, the crates list and the launch section; the invariant I1 only if the ordering choice changes it. +**Deliverables**: `crates/rdm-schema` with the stored types, the read-model types, the version constants and the committed JSON Schemas; the traceability table; the updated R01 +**Consistency Checks**: `cargo test -p rdm-schema` (expected: PASS) +**Commit**: `feat(rdm-schema): land the domain model spec` + +## Step 3: Close out + +**Goal**: The milestone is recorded. +**Implementation Logic**: +Write a knowledge-transfer report under `__reports__/m0b-domain-model-spec/`. Mark this leaf `done`. Propose the reminder reconciliation to Eliott: `skills-rdm-M0b` complete; `skills-rdm-M1` startable once their other gates clear. Apply only on his yes, through the scheduling-work writer. +**Deliverables**: `__reports__/m0b-domain-model-spec/` knowledge-transfer report; this leaf's status in `__roadmap__/roadmap-mcp-rework/README.md` +**Consistency Checks**: `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/roadmap-mcp-rework/` (expected: PASS) +**Commit**: `docs(reports): close the m0b-domain-model-spec milestone` diff --git a/crates/rdm-mcp/fixtures/roadmap.json b/crates/rdm-mcp/fixtures/roadmap.json new file mode 100644 index 0000000..d59228a --- /dev/null +++ b/crates/rdm-mcp/fixtures/roadmap.json @@ -0,0 +1,134 @@ +{ + "campaign": "roadmap-mcp-rework", + "frozen_at": "af8ad04893fc3e201d005fcdbc454737df184204", + "nodes": [ + { + "path": "m0_feasibility_spike.md", + "parent": null, + "kind": "leaf", + "title": "M0 Feasibility spike", + "status": "inprogress", + "depth": 0 + }, + { + "path": "core", + "parent": null, + "kind": "dir", + "title": "Core", + "status": "planned", + "depth": 0 + }, + { + "path": "m0b_domain_model_spec.md", + "parent": null, + "kind": "leaf", + "title": "M0b Domain model spec", + "status": "inprogress", + "depth": 0 + }, + { + "path": "core/m1_core_foundation.md", + "parent": "core", + "kind": "leaf", + "title": "M1 Core foundation", + "status": "planned", + "depth": 1 + }, + { + "path": "core/engine", + "parent": "core", + "kind": "dir", + "title": "Engine", + "status": "planned", + "depth": 1 + }, + { + "path": "core/engine/m2_graph_engine.md", + "parent": "core/engine", + "kind": "leaf", + "title": "M2 Graph engine", + "status": "planned", + "depth": 2 + }, + { + "path": "core/engine/interchange", + "parent": "core/engine", + "kind": "dir", + "title": "Interchange", + "status": "planned", + "depth": 2 + }, + { + "path": "core/engine/interchange/m3_interchange.md", + "parent": "core/engine/interchange", + "kind": "leaf", + "title": "M3 Interchange", + "status": "planned", + "depth": 3 + }, + { + "path": "core/engine/interchange/consumers", + "parent": "core/engine/interchange", + "kind": "dir", + "title": "Consumers", + "status": "planned", + "depth": 3 + }, + { + "path": "core/engine/interchange/consumers/m4_mcp_server.md", + "parent": "core/engine/interchange/consumers", + "kind": "leaf", + "title": "M4 MCP server", + "status": "planned", + "depth": 4 + }, + { + "path": "core/engine/interchange/consumers/m5_cli.md", + "parent": "core/engine/interchange/consumers", + "kind": "leaf", + "title": "M5 CLI", + "status": "planned", + "depth": 4 + }, + { + "path": "core/engine/interchange/consumers/delivery", + "parent": "core/engine/interchange/consumers", + "kind": "dir", + "title": "Delivery", + "status": "planned", + "depth": 4 + }, + { + "path": "core/engine/interchange/consumers/delivery/m6_apps_view.md", + "parent": "core/engine/interchange/consumers/delivery", + "kind": "leaf", + "title": "M6 Apps view", + "status": "planned", + "depth": 5 + }, + { + "path": "core/engine/interchange/consumers/delivery/m7_distribution.md", + "parent": "core/engine/interchange/consumers/delivery", + "kind": "leaf", + "title": "M7 Distribution", + "status": "planned", + "depth": 5 + }, + { + "path": "core/engine/interchange/consumers/delivery/cutover", + "parent": "core/engine/interchange/consumers/delivery", + "kind": "dir", + "title": "Cutover", + "status": "planned", + "depth": 5 + }, + { + "path": "core/engine/interchange/consumers/delivery/cutover/m8_cutover.md", + "parent": "core/engine/interchange/consumers/delivery/cutover", + "kind": "leaf", + "title": "M8 Cutover", + "status": "planned", + "depth": 6 + } + ] +} From 90fdb880e0c24ae57e599678749cabdfb4f76474 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:38:45 +0900 Subject: [PATCH 013/183] feat(rdm-mcp): serve the spike tools and the ui page over stdio Co-Authored-By: Claude Sonnet 5.5 --- Cargo.lock | 996 +++++++++++++++++++++++++++++++++++++ crates/rdm-mcp/Cargo.toml | 24 + crates/rdm-mcp/build.rs | 52 ++ crates/rdm-mcp/src/main.rs | 294 +++++++++++ 4 files changed, 1366 insertions(+) create mode 100644 Cargo.lock create mode 100644 crates/rdm-mcp/Cargo.toml create mode 100644 crates/rdm-mcp/build.rs create mode 100644 crates/rdm-mcp/src/main.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..bd15f77 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,996 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cc" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.10", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", + "serde", + "serde_core", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "pastey" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "process-wrap" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f21b97672d2dc848e7b25701ab4535618b92f4861c13cc3f7f7bed52ad3c8da" +dependencies = [ + "futures", + "indexmap", + "nix", + "tokio", + "tracing", + "windows", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rdm-mcp" +version = "0.0.0" +dependencies = [ + "rmcp", + "schemars", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "rmcp" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5949e504d5ab9944a168259afc0c39ac0230627b6ec5367ace194c59bcbe163" +dependencies = [ + "base64", + "chrono", + "futures", + "indexmap", + "libc", + "pastey", + "pin-project-lite", + "process-wrap", + "rmcp-macros", + "schemars", + "serde", + "serde_json", + "sha2", + "thiserror", + "tokio", + "tokio-stream", + "tokio-util", + "tracing", + "uuid", +] + +[[package]] +name = "rmcp-macros" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98a686693ee91b665c6f89f182fca6e141c8a63dc113b11b38c1bf3491606b7" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "serde_json", + "syn 3.0.10", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "chrono", + "dyn-clone", + "ref-cast", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 3.0.10", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_derive_internals" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "sha2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "uuid" +version = "1.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" +dependencies = [ + "getrandom", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/crates/rdm-mcp/Cargo.toml b/crates/rdm-mcp/Cargo.toml new file mode 100644 index 0000000..a23c172 --- /dev/null +++ b/crates/rdm-mcp/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "rdm-mcp" +version = "0.0.0" +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +publish = false +description = "Throwaway MCP Apps feasibility stub for rdm" + +[[bin]] +name = "rdm-mcp" +path = "src/main.rs" + +[dependencies] +rmcp = { version = "=3.10.0", features = ["server", "macros", "transport-io"] } +tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-std"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +schemars = "1" + +[dev-dependencies] +rmcp = { version = "=3.10.0", features = ["client", "transport-child-process"] } +tokio = { version = "1", features = ["macros", "rt-multi-thread", "process"] } diff --git a/crates/rdm-mcp/build.rs b/crates/rdm-mcp/build.rs new file mode 100644 index 0000000..75cd73a --- /dev/null +++ b/crates/rdm-mcp/build.rs @@ -0,0 +1,52 @@ +//! Embeds the built view when it exists, a placeholder page otherwise, and +//! generates the table of fixture leaves that `leaf_get` serves. + +use std::fmt::Write as _; +use std::path::{Path, PathBuf}; +use std::{env, fs}; + +const PLACEHOLDER: &str = "\ +rdm graph

The view is not built: \ +run the build in crates/rdm-mcp/view first.

"; + +fn collect(dir: &Path, root: &Path, out: &mut Vec<(String, PathBuf)>) { + let mut entries: Vec<_> = fs::read_dir(dir) + .expect("fixtures/leaves must exist") + .map(|e| e.expect("readable entry").path()) + .collect(); + entries.sort(); + for p in entries { + if p.is_dir() { + collect(&p, root, out); + } else { + let rel = p.strip_prefix(root).expect("under root"); + out.push((rel.to_string_lossy().replace('\\', "/"), p)); + } + } +} + +fn main() { + let manifest = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("cargo sets it")); + let out = PathBuf::from(env::var("OUT_DIR").expect("cargo sets it")); + + let view = manifest.join("view/dist/index.html"); + println!("cargo:rerun-if-changed={}", view.display()); + let html = fs::read_to_string(&view).unwrap_or_else(|_| PLACEHOLDER.to_owned()); + fs::write(out.join("view.html"), html).expect("write view.html"); + + let leaves = manifest.join("fixtures/leaves"); + println!("cargo:rerun-if-changed={}", leaves.display()); + println!( + "cargo:rerun-if-changed={}", + manifest.join("fixtures/roadmap.json").display() + ); + let mut files = Vec::new(); + collect(&leaves, &leaves, &mut files); + let mut table = String::from("pub static LEAVES: &[(&str, &str)] = &[\n"); + for (rel, abs) in &files { + writeln!(table, " ({rel:?}, include_str!({:?})),", abs.to_string_lossy()) + .expect("write to String"); + } + table.push_str("];\n"); + fs::write(out.join("leaves.rs"), table).expect("write leaves.rs"); +} diff --git a/crates/rdm-mcp/src/main.rs b/crates/rdm-mcp/src/main.rs new file mode 100644 index 0000000..a468af1 --- /dev/null +++ b/crates/rdm-mcp/src/main.rs @@ -0,0 +1,294 @@ +//! Throwaway MCP Apps feasibility stub for rdm: serves a frozen roadmap +//! fixture, a `ui://` page and two app-only tools over stdio, on MCP +//! 2026-07-28 only. + +use std::borrow::Cow; +use std::io::Write as _; +use std::time::{SystemTime, UNIX_EPOCH}; + +use rmcp::{ + ErrorData, RoleServer, ServerHandler, ServiceExt, + handler::server::{ + router::tool::ToolRouter, + tool::schema_for_output, + wrapper::{Json, Parameters}, + }, + model::{ + CallToolResult, ContentBlock, Implementation, ExtensionCapabilities, ListResourcesResult, MetaObject, + PaginatedRequestParams, ProtocolVersion, Resource, ReadResourceRequestParams, + ReadResourceResponse, ReadResourceResult, ResourceContents, ServerCapabilities, + ServerConfig, + }, + schemars, + service::RequestContext, + tool, tool_handler, tool_router, + transport::stdio, +}; +use serde::{Deserialize, Serialize}; +use serde_json::{Value, json}; + +/// URI of the graph page, referenced by `roadmap_view`'s `_meta.ui.resourceUri`. +const UI_URI: &str = "ui://rdm/graph"; +/// MIME type that marks an MCP App page. +const APPS_MIME: &str = "text/html;profile=mcp-app"; +/// Extension identifier of MCP Apps in `capabilities.extensions`. +const APPS_EXTENSION: &str = "io.modelcontextprotocol/ui"; + +const VIEW_HTML: &str = include_str!(concat!(env!("OUT_DIR"), "/view.html")); +const ROADMAP_JSON: &str = include_str!("../fixtures/roadmap.json"); +include!(concat!(env!("OUT_DIR"), "/leaves.rs")); + +/// One node of the frozen roadmap. +#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)] +struct FixtureNode { + path: String, + parent: Option, + kind: String, + title: String, + status: String, + depth: u32, +} + +/// The frozen roadmap as stored in `fixtures/roadmap.json`. +#[derive(Debug, Clone, Serialize, Deserialize)] +struct Fixture { + campaign: String, + frozen_at: String, + nodes: Vec, +} + +/// Structured output of `roadmap_view`: the fixture plus two timing fields. +#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)] +struct RoadmapView { + campaign: String, + frozen_at: String, + nodes: Vec, + /// Milliseconds since the Unix epoch, taken just before the result is returned. + t_server_ms: u64, + /// Byte length of the serialised fixture. + payload_bytes: u64, +} + +#[derive(Debug, Deserialize, schemars::JsonSchema)] +struct LeafGetArgs { + /// Leaf path as listed in the fixture, for example `core/m1_core_foundation.md`. + path: String, +} + +#[derive(Debug, Serialize, schemars::JsonSchema)] +struct LeafGetResult { + path: String, + markdown: String, +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize, schemars::JsonSchema)] +#[serde(rename_all = "lowercase")] +enum RunKind { + Cold, + Warm, +} + +/// One probe measurement sent by the view. +#[derive(Debug, Deserialize, Serialize, schemars::JsonSchema)] +struct ProbeRecord { + run_kind: RunKind, + t_server_ms: u64, + t_view_ms: u64, + apps_protocol_announced: String, + #[serde(default)] + apps_protocol_host: Option, + #[serde(default)] + host_capabilities: Value, + #[serde(default)] + host_context: Value, + #[serde(default)] + display_mode: Option, +} + +#[derive(Debug, Serialize, schemars::JsonSchema)] +struct ProbeAck { + recorded: bool, +} + +fn now_ms() -> u64 { + SystemTime::now() + .duration_since(UNIX_EPOCH) + .map_or(0, |d| u64::try_from(d.as_millis()).unwrap_or(u64::MAX)) +} + +fn meta_from(value: Value) -> MetaObject { + match value { + Value::Object(map) => MetaObject(map), + _ => MetaObject::new(), + } +} + +/// `_meta` of the model-visible tool: points the host at the page. +fn ui_resource_meta() -> MetaObject { + meta_from(json!({ "ui": { "resourceUri": UI_URI } })) +} + +/// `_meta` of the app-only tools: hidden from the model. +fn ui_app_only_meta() -> MetaObject { + meta_from(json!({ "ui": { "visibility": ["app"] } })) +} + +fn internal(e: impl std::fmt::Display) -> ErrorData { + ErrorData::internal_error(e.to_string(), None) +} + +/// The spike server. It keeps no state between calls. +#[derive(Clone)] +struct RdmSpike { + tool_router: ToolRouter, +} + +#[tool_router] +impl RdmSpike { + fn new() -> Self { + Self { + tool_router: Self::tool_router(), + } + } + + #[tool( + description = "Show the frozen roadmap as an interactive graph.", + output_schema = schema_for_output::(), + meta = ui_resource_meta() + )] + async fn roadmap_view(&self) -> Result { + let fixture: Fixture = serde_json::from_str(ROADMAP_JSON).map_err(internal)?; + let payload_bytes = serde_json::to_vec(&fixture).map_err(internal)?.len(); + let summary = format!( + "Roadmap {} at {}: {} nodes.", + fixture.campaign, + fixture.frozen_at, + fixture.nodes.len() + ); + let view = RoadmapView { + campaign: fixture.campaign, + frozen_at: fixture.frozen_at, + nodes: fixture.nodes, + payload_bytes: u64::try_from(payload_bytes).map_err(internal)?, + t_server_ms: now_ms(), + }; + let mut result = + CallToolResult::structured(serde_json::to_value(&view).map_err(internal)?); + result.content = vec![ContentBlock::text(summary)]; + Ok(result) + } + + #[tool( + description = "Return the markdown of one frozen leaf.", + meta = ui_app_only_meta() + )] + async fn leaf_get( + &self, + Parameters(args): Parameters, + ) -> Result, ErrorData> { + let (_, markdown) = LEAVES + .iter() + .find(|(p, _)| *p == args.path) + .ok_or_else(|| ErrorData::invalid_params(format!("unknown leaf: {}", args.path), None))?; + Ok(Json(LeafGetResult { + path: args.path, + markdown: (*markdown).to_owned(), + })) + } + + #[tool( + description = "Append one probe measurement to $RDM_PROBE_DIR/probe.jsonl.", + meta = ui_app_only_meta() + )] + async fn probe_record( + &self, + Parameters(record): Parameters, + context: RequestContext, + ) -> Result, ErrorData> { + let Some(dir) = std::env::var_os("RDM_PROBE_DIR") else { + eprintln!("rdm-mcp: RDM_PROBE_DIR is unset; probe record dropped"); + return Ok(Json(ProbeAck { recorded: false })); + }; + let mut line = serde_json::to_value(&record).map_err(internal)?; + if let Value::Object(map) = &mut line { + map.insert( + "mcp_protocol".into(), + context + .protocol_version() + .map_or(Value::Null, |v| Value::String(v.as_str().to_owned())), + ); + map.insert("t_recorded_ms".into(), json!(now_ms())); + } + let dir = std::path::PathBuf::from(dir); + std::fs::create_dir_all(&dir).map_err(internal)?; + let mut file = std::fs::OpenOptions::new() + .create(true) + .append(true) + .open(dir.join("probe.jsonl")) + .map_err(internal)?; + writeln!(file, "{line}").map_err(internal)?; + Ok(Json(ProbeAck { recorded: true })) + } +} + +#[tool_handler(router = self.tool_router)] +impl ServerHandler for RdmSpike { + fn get_info(&self) -> ServerConfig { + let mut capabilities = ServerCapabilities::builder() + .enable_tools() + .enable_resources() + .build(); + // rmcp has no typed helper for the MCP Apps extension. + let mut extensions = ExtensionCapabilities::new(); + extensions.insert( + APPS_EXTENSION.to_owned(), + json!({ "mimeTypes": [APPS_MIME] }) + .as_object() + .cloned() + .unwrap_or_default(), + ); + capabilities.extensions = Some(extensions); + ServerConfig::new(capabilities) + .with_protocol_version(ProtocolVersion::V_2026_07_28) + .with_server_info(Implementation::new("rdm-mcp", env!("CARGO_PKG_VERSION"))) + } + + /// Accept 2026-07-28 only: any other version, on `initialize` or in a + /// request's `_meta`, is refused with an unsupported-protocol-version error. + fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]> { + Cow::Borrowed(&[ProtocolVersion::V_2026_07_28]) + } + + async fn list_resources( + &self, + _request: Option, + _context: RequestContext, + ) -> Result { + let page = Resource::new(UI_URI, "rdm graph") + .with_description("Interactive roadmap graph") + .with_mime_type(APPS_MIME); + Ok(ListResourcesResult::with_all_items(vec![page])) + } + + async fn read_resource( + &self, + request: ReadResourceRequestParams, + _context: RequestContext, + ) -> Result { + if request.uri != UI_URI { + return Err(ErrorData::invalid_params( + format!("unknown resource: {}", request.uri), + None, + )); + } + let contents = ResourceContents::text(VIEW_HTML, UI_URI).with_mime_type(APPS_MIME); + Ok(ReadResourceResult::new(vec![contents]).into()) + } +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + let service = RdmSpike::new().serve(stdio()).await?; + service.waiting().await?; + Ok(()) +} From b2c18a0f37b24fa837dbfbafd8bf52a7c7b0cdf2 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:39:48 +0900 Subject: [PATCH 014/183] feat(rdm-mcp): accept the unknown probe run kind The graph view reports unknown when it cannot tell a cold run from a warm one. Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-mcp/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/rdm-mcp/src/main.rs b/crates/rdm-mcp/src/main.rs index a468af1..5bf3c6f 100644 --- a/crates/rdm-mcp/src/main.rs +++ b/crates/rdm-mcp/src/main.rs @@ -86,6 +86,7 @@ struct LeafGetResult { enum RunKind { Cold, Warm, + Unknown, } /// One probe measurement sent by the view. From b02458ecdb3cf5295051ef3b58a99521216f1229 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:39:48 +0900 Subject: [PATCH 015/183] test(rdm-mcp): check the spike server contract over stdio Co-Authored-By: Claude Sonnet 5.5 --- Cargo.lock | 644 +++++++++++++++++++++++++++++++++- crates/rdm-mcp/Cargo.toml | 1 + crates/rdm-mcp/tests/stdio.rs | 225 ++++++++++++ 3 files changed, 867 insertions(+), 3 deletions(-) create mode 100644 crates/rdm-mcp/tests/stdio.rs diff --git a/Cargo.lock b/Cargo.lock index bd15f77..7769d65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,29 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "serde", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + [[package]] name = "android_system_properties" version = "0.1.6" @@ -17,12 +40,33 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64" version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + [[package]] name = "bitflags" version = "2.13.2" @@ -38,12 +82,24 @@ dependencies = [ "hybrid-array", ] +[[package]] +name = "borrow-or-share" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0b364ead1874514c8c2855ab558056ebfeb775653e7ae45ff72f28f8f3166c" + [[package]] name = "bumpalo" version = "3.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" +[[package]] +name = "bytecount" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" + [[package]] name = "bytes" version = "1.12.1" @@ -159,12 +215,32 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + [[package]] name = "dyn-clone" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "email_address" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e079f19b08ca6239f47f8ba8509c11cf3ea30095831f7fed61441475edd8c449" +dependencies = [ + "serde", +] + [[package]] name = "equivalent" version = "1.0.3" @@ -181,12 +257,44 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "fancy-regex" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f" +dependencies = [ + "bit-set", + "regex-automata", + "regex-syntax", +] + [[package]] name = "find-msvc-tools" version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" +[[package]] +name = "fluent-uri" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1918b65d96df47d3591bed19c5cca17e3fa5d0707318e4b5ef2eae01764df7e5" +dependencies = [ + "borrow-or-share", + "ref-cast", + "serde", +] + +[[package]] +name = "fraction" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e076045bb43dac435333ed5f04caf35c7463631d0dae2deb2638d94dd0a5b872" +dependencies = [ + "lazy_static", + "num", +] + [[package]] name = "futures" version = "0.3.34" @@ -275,6 +383,18 @@ dependencies = [ "slab", ] +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + [[package]] name = "getrandom" version = "0.4.3" @@ -283,7 +403,7 @@ checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", "libc", - "r-efi", + "r-efi 6.0.0", ] [[package]] @@ -325,12 +445,116 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" version = "2.14.2" @@ -360,12 +584,59 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonschema" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d46662859bc5f60a145b75f4632fbadc84e829e45df6c5de74cfc8e05acb96b5" +dependencies = [ + "ahash", + "base64 0.22.1", + "bytecount", + "email_address", + "fancy-regex", + "fraction", + "idna", + "itoa", + "num-cmp", + "num-traits", + "once_cell", + "percent-encoding", + "referencing", + "regex", + "regex-syntax", + "serde", + "serde_json", + "uuid-simd", +] + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + [[package]] name = "libc" version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.35" @@ -401,6 +672,75 @@ dependencies = [ "libc", ] +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-cmp" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63335b2e2c34fae2fb0aa2cecfd9f0832a1e24b3b32ecec612c3426d46dc8aaa" + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -416,18 +756,62 @@ version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +[[package]] +name = "outref" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + [[package]] name = "pastey" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + [[package]] name = "pin-project-lite" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -460,6 +844,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "r-efi" version = "6.0.0" @@ -470,6 +860,7 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" name = "rdm-mcp" version = "0.0.0" dependencies = [ + "jsonschema", "rmcp", "schemars", "serde", @@ -477,6 +868,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + [[package]] name = "ref-cast" version = "1.0.27" @@ -497,13 +897,56 @@ dependencies = [ "syn 3.0.10", ] +[[package]] +name = "referencing" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9c261f7ce75418b3beadfb3f0eb1299fe8eb9640deba45ffa2cb783098697d" +dependencies = [ + "ahash", + "fluent-uri", + "once_cell", + "parking_lot", + "percent-encoding", + "serde_json", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + [[package]] name = "rmcp" version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5949e504d5ab9944a168259afc0c39ac0230627b6ec5367ace194c59bcbe163" dependencies = [ - "base64", + "base64 0.23.1", "chrono", "futures", "indexmap", @@ -569,6 +1012,12 @@ dependencies = [ "syn 3.0.10", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "serde" version = "1.0.229" @@ -656,6 +1105,12 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" +[[package]] +name = "smallvec" +version = "1.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" + [[package]] name = "socket2" version = "0.6.5" @@ -666,6 +1121,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + [[package]] name = "strsim" version = "0.11.1" @@ -694,6 +1155,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + [[package]] name = "thiserror" version = "2.0.21" @@ -714,6 +1186,16 @@ dependencies = [ "syn 3.0.10", ] +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tokio" version = "1.54.1" @@ -809,23 +1291,70 @@ version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + [[package]] name = "uuid" version = "1.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" dependencies = [ - "getrandom", + "getrandom 0.4.3", "js-sys", "wasm-bindgen", ] +[[package]] +name = "uuid-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b082222b4f6619906941c17eb2297fff4c2fb96cb60164170522942a200bd8" +dependencies = [ + "outref", + "uuid", + "vsimd", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vsimd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.130" @@ -989,6 +1518,115 @@ dependencies = [ "windows-link", ] +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + [[package]] name = "zmij" version = "1.0.23" diff --git a/crates/rdm-mcp/Cargo.toml b/crates/rdm-mcp/Cargo.toml index a23c172..f406d35 100644 --- a/crates/rdm-mcp/Cargo.toml +++ b/crates/rdm-mcp/Cargo.toml @@ -22,3 +22,4 @@ schemars = "1" [dev-dependencies] rmcp = { version = "=3.10.0", features = ["client", "transport-child-process"] } tokio = { version = "1", features = ["macros", "rt-multi-thread", "process"] } +jsonschema = { version = "0.33", default-features = false } diff --git a/crates/rdm-mcp/tests/stdio.rs b/crates/rdm-mcp/tests/stdio.rs new file mode 100644 index 0000000..d353af3 --- /dev/null +++ b/crates/rdm-mcp/tests/stdio.rs @@ -0,0 +1,225 @@ +//! Contract test: spawns the built `rdm-mcp` binary and talks MCP 2026-07-28 +//! to it over stdio, as a host would. + +use std::io::{BufRead, BufReader, Write}; +use std::path::{Path, PathBuf}; +use std::process::{Command as StdCommand, Stdio}; + +use rmcp::{ + ClientHandler, ClientLifecycleMode, ClientServiceExt, RoleClient, + model::{CallToolRequestParams, ProtocolVersion, ReadResourceRequestParams, Tool}, + service::RunningService, + transport::{ConfigureCommandExt, TokioChildProcess}, +}; +use serde_json::{Value, json}; +use tokio::process::Command; + +const BIN: &str = env!("CARGO_BIN_EXE_rdm-mcp"); +const APPS_MIME: &str = "text/html;profile=mcp-app"; + +#[derive(Clone, Default)] +struct TestClient; +impl ClientHandler for TestClient {} + +async fn connect(probe_dir: Option<&Path>) -> RunningService { + let transport = TokioChildProcess::new(Command::new(BIN).configure(|cmd| { + if let Some(dir) = probe_dir { + cmd.env("RDM_PROBE_DIR", dir); + } + })) + .expect("spawn rdm-mcp"); + TestClient + .serve_with_lifecycle( + transport, + ClientLifecycleMode::Discover { + preferred_versions: vec![ProtocolVersion::V_2026_07_28], + }, + ) + .await + .expect("connect at 2026-07-28") +} + +fn tool<'a>(tools: &'a [Tool], name: &str) -> &'a Tool { + tools + .iter() + .find(|t| t.name == name) + .unwrap_or_else(|| panic!("tool {name} is listed")) +} + +fn meta_of(t: &Tool) -> Value { + serde_json::to_value(t.meta.as_ref().expect("tool has _meta")).expect("meta serialises") +} + +#[tokio::test] +async fn lists_three_tools_with_ui_meta() { + let client = connect(None).await; + let tools = client.list_all_tools().await.expect("tools/list"); + let mut names: Vec<_> = tools.iter().map(|t| t.name.to_string()).collect(); + names.sort(); + assert_eq!(names, ["leaf_get", "probe_record", "roadmap_view"]); + + assert_eq!( + meta_of(tool(&tools, "roadmap_view"))["ui"]["resourceUri"], + "ui://rdm/graph" + ); + for app_only in ["leaf_get", "probe_record"] { + assert_eq!( + meta_of(tool(&tools, app_only))["ui"]["visibility"], + json!(["app"]), + "{app_only} is app-only" + ); + } + client.cancel().await.expect("close"); +} + +#[tokio::test] +async fn roadmap_view_structured_content_matches_schema() { + let client = connect(None).await; + let tools = client.list_all_tools().await.expect("tools/list"); + let schema = Value::Object( + tool(&tools, "roadmap_view") + .output_schema + .as_deref() + .expect("roadmap_view has an outputSchema") + .clone(), + ); + let result = client + .call_tool(CallToolRequestParams::new("roadmap_view")) + .await + .expect("call roadmap_view"); + assert_ne!(result.is_error, Some(true)); + let structured = result.structured_content.expect("structuredContent"); + + let validator = jsonschema::validator_for(&schema).expect("outputSchema compiles"); + let errors: Vec = validator + .iter_errors(&structured) + .map(|e| e.to_string()) + .collect(); + assert!(errors.is_empty(), "structuredContent violates outputSchema: {errors:?}"); + + assert_eq!(structured["campaign"], "roadmap-mcp-rework"); + assert_eq!(structured["nodes"].as_array().expect("nodes").len(), 16); + assert!(structured["t_server_ms"].as_u64().expect("t_server_ms") > 0); + assert!(structured["payload_bytes"].as_u64().expect("payload_bytes") > 0); + assert_eq!(result.content.len(), 1, "one text summary"); + client.cancel().await.expect("close"); +} + +#[tokio::test] +async fn reads_ui_resource_with_apps_mime() { + let client = connect(None).await; + let result = client + .read_resource(ReadResourceRequestParams::new("ui://rdm/graph")) + .await + .expect("resources/read"); + let contents = serde_json::to_value(&result.contents[0]).expect("serialises"); + assert_eq!(contents["mimeType"], APPS_MIME); + assert!(contents["text"].as_str().expect("text").contains(" Value { + let mut child = StdCommand::new(BIN) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::null()) + .spawn() + .expect("spawn rdm-mcp"); + let mut stdin = child.stdin.take().expect("stdin"); + for l in lines { + writeln!(stdin, "{l}").expect("write request"); + } + let mut reply = String::new(); + BufReader::new(child.stdout.take().expect("stdout")) + .read_line(&mut reply) + .expect("read reply"); + drop(stdin); + let _ = child.kill(); + let _ = child.wait(); + serde_json::from_str(&reply).expect("reply is JSON") +} + +#[test] +fn refuses_older_protocol() { + // The initialize handshake at 2025-11-25 is refused. + let reply = raw_exchange(&[json!({ + "jsonrpc": "2.0", "id": 1, "method": "initialize", + "params": { + "protocolVersion": "2025-11-25", + "capabilities": {}, + "clientInfo": { "name": "t", "version": "0" } + } + })]); + assert!(reply.get("result").is_none(), "initialize must not succeed: {reply}"); + assert!(reply["error"]["message"].is_string(), "protocol error expected: {reply}"); + + // A request that names 2025-11-25 in its own _meta is refused too. + let reply = raw_exchange(&[json!({ + "jsonrpc": "2.0", "id": 2, "method": "tools/list", + "params": { "_meta": { + "io.modelcontextprotocol/protocolVersion": "2025-11-25", + "io.modelcontextprotocol/clientInfo": { "name": "t", "version": "0" }, + "io.modelcontextprotocol/clientCapabilities": {} + } } + })]); + assert!(reply.get("result").is_none(), "tools/list must not succeed: {reply}"); + assert!(reply["error"]["message"].is_string(), "protocol error expected: {reply}"); + assert!( + reply["error"].to_string().contains("2026-07-28"), + "error names the supported version: {reply}" + ); +} + +fn scratch_dir() -> PathBuf { + let dir = Path::new(env!("CARGO_TARGET_TMPDIR")).join(format!("probe-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + dir +} + +#[tokio::test] +async fn probe_record_appends_one_line() { + let dir = scratch_dir(); + let client = connect(Some(&dir)).await; + let args = json!({ + "run_kind": "cold", + "t_server_ms": 1, + "t_view_ms": 2, + "apps_protocol_announced": "2026-01-26", + "apps_protocol_host": null, + "host_capabilities": { "a": 1 }, + "host_context": {}, + "display_mode": "inline" + }); + let result = client + .call_tool( + CallToolRequestParams::new("probe_record") + .with_arguments(args.as_object().expect("object").clone()), + ) + .await + .expect("call probe_record"); + assert_ne!(result.is_error, Some(true), "{result:?}"); + client.cancel().await.expect("close"); + + let text = std::fs::read_to_string(dir.join("probe.jsonl")).expect("probe.jsonl exists"); + let lines: Vec<&str> = text.lines().collect(); + assert_eq!(lines.len(), 1, "exactly one line: {text:?}"); + let line: Value = serde_json::from_str(lines[0]).expect("valid JSON line"); + assert_eq!(line["mcp_protocol"], "2026-07-28"); + assert_eq!(line["run_kind"], "cold"); + assert!(line["t_recorded_ms"].as_u64().expect("t_recorded_ms") > 0); + let _ = std::fs::remove_dir_all(&dir); +} From fdade126de1b6401a1a4f787a33eedefcac4b8c4 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:39:13 +0900 Subject: [PATCH 016/183] docs(design): specify the rdm status semantics Co-Authored-By: Claude Sonnet 5.5 --- __design__/rdm/statuses.md | 244 +++++++++++++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 __design__/rdm/statuses.md diff --git a/__design__/rdm/statuses.md b/__design__/rdm/statuses.md new file mode 100644 index 0000000..c56f133 --- /dev/null +++ b/__design__/rdm/statuses.md @@ -0,0 +1,244 @@ +# rdm — Status semantics + +What each status of a leaf means, how it may change, and what it does to the order of work. The +vocabulary and the editing rules are Eliott's decisions of 2026-11-16 (M0b README, Gotchas). Where +this document goes beyond them, or disagrees with a default, the text says `OBJECTION` and Eliott +decides. One question is `OPEN`. + +This document settles the meaning. The stored shape of the fields it names (`status`, +`status_reason`, `history`, `comments`) is in [stored-schema.md](stored-schema.md). R01 +(`architecture.md`) is not edited here; section `R01 deltas` lists what `r01_sync` must change. + +## Statuses + +Only a leaf has a stored status. A directory's status is derived (see `Subtrees and directories`). + +| Status | Meaning | Terminal | Sealed | +|:--|:--|:--|:--| +| `planned` | The leaf is written and not started. No step is recorded done. | no | no | +| `ongoing` | Work has started on the leaf. Steps may be recorded done. | no | steps recorded done only | +| `paused` | Work is held and can be resumed: a bug, a decision to wait, or a downstream branch held on purpose. | no | steps recorded done only | +| `cancelled` | The leaf is abandoned. It holds nothing back. Whatever was done stays on record. | yes | yes | +| `done` | Every step is done with its commit recorded. | yes | yes | + +`blocked` and `amendment` are not statuses. A "blocked" situation is `paused` (resumable) or +`cancelled` (abandoned). An "amendment" is an edit recorded in the amendment log, and a node +added by one starts as `planned`. + +A non-terminal leaf (`planned`, `ongoing`, `paused`) holds back deeper leaves. A terminal leaf +(`done`, `cancelled`) holds back nothing. + +## Transitions + +All 25 ordered pairs. "Who" is the actor kind recorded in `history[].actor`: `agent`, `human` or +`both`. "Reason" is the `reason` of the history entry (copied to `status_reason` when the new +status is `paused` or `cancelled`). "Ready set" says what the move does to the set defined in +`Ready set`: ENTER, LEAVE, RELEASE (deeper leaves may become ready) or none. + +| From | To | Allowed | Who | Reason | Precondition | Ready set | +|:--|:--|:--|:--|:--|:--|:--| +| `planned` | `planned` | refused | | | A move to the same status is a no-op and writes no history | none | +| `planned` | `ongoing` | allowed | both | only for an override | The leaf is in the ready set. Outside it, an override with a reason is needed, and the entry records `override: true` | LEAVE | +| `planned` | `paused` | allowed | both | required | none | LEAVE | +| `planned` | `cancelled` | allowed | both | required | none | LEAVE, RELEASE | +| `planned` | `done` | refused | | | Start the leaf first: `done` needs the steps recorded (I8) | none | +| `ongoing` | `planned` | refused | | | Use `paused`, then `planned` while no step is done | none | +| `ongoing` | `ongoing` | refused | | | No-op | none | +| `ongoing` | `paused` | allowed | both | required | none | none | +| `ongoing` | `cancelled` | allowed | both | required | none. Steps already done stay sealed and recorded | RELEASE | +| `ongoing` | `done` | allowed | both | none | Every step is done with its commit recorded (I8). Gate marks are not checked, see `Sealing` | RELEASE | +| `paused` | `planned` | allowed | both | required | No step is recorded done (OBJECTION 1: not in the default) | ENTER if nothing shallower holds it back | +| `paused` | `ongoing` | allowed | both | required | The leaf was `ongoing` before the pause (last pause entry has `from: ongoing`), or it is in the ready set. Otherwise an override with a reason | none | +| `paused` | `paused` | refused | | | No-op | none | +| `paused` | `cancelled` | allowed | both | required | none | RELEASE | +| `paused` | `done` | refused | | | Resume to `ongoing` first | none | +| `cancelled` | `planned` | refused | | | Terminal (OBJECTION 2) | none | +| `cancelled` | `ongoing` | refused | | | Terminal | none | +| `cancelled` | `paused` | refused | | | Terminal | none | +| `cancelled` | `cancelled` | refused | | | No-op | none | +| `cancelled` | `done` | refused | | | Terminal | none | +| `done` | `planned` | refused | | | Terminal: nothing reopens done work, new work is a new node | none | +| `done` | `ongoing` | refused | | | Terminal | none | +| `done` | `paused` | refused | | | Terminal | none | +| `done` | `cancelled` | refused | | | Terminal | none | +| `done` | `done` | refused | | | No-op | none | + +Rules that hold for every row: + +- No move is human-only. `history[].actor` records who made it. +- A move presents the status it expects to leave. A mismatch is refused (R01 §Concurrency). +- A move writes one history entry and never an amendment (I5). +- A move into `done` or `cancelled` may carry the final `progress` in the same operation. After it, only comments are accepted. +- The reason is required text, not blank, for `paused`, `cancelled`, `paused → planned` and `paused → ongoing`. + +**OBJECTION 1: `paused → planned` needs "no step is recorded done".** The default allows the move +with a reason. A step recorded done is sealed with its commit, so a `planned` leaf holding a +recorded commit would contradict "not started". Default kept as stated, with this one added +precondition. Without it, the leaf must go to `ongoing` instead. + +**OBJECTION 2: `cancelled` as terminal is a trap for a mistaken cancel.** The default makes +`cancelled` terminal, like `done`. But `done` is protected by a verified commit, while a cancel is +one call with a reason, and a directory cancel (below) is one call over many leaves. A wrong one +cannot be undone except by writing the leaves again as new nodes. Two cheaper options, neither +taken: a `human`-only `cancelled → planned` with a reason, allowed while no content was changed; +or `human`-only for the directory cancel. Default kept: terminal, both actors. + +**Note: a cancel releases work without saying so.** Because `cancelled` holds nothing back, a +cancelled leaf can release a deeper leaf that really needed it. That is Eliott's intent. The +impact report of a cancel (M2) should list the leaves it makes ready, so the release is never +silent. + +## Ready set + +A leaf is ready when it is `planned` and every leaf that holds it back is `done` or `cancelled`. +So `cancelled` holds nothing back. + +The depth of a leaf is the number of directories between the campaign root and the leaf. A leaf +directly under the campaign root has depth 0. The rule for which leaves hold a given leaf back +has two readings. It is `OPEN`. + +| Reading | Leaves that hold leaf L back | +|:--|:--| +| A. Global (R01) | Every leaf of smaller depth, anywhere in the campaign | +| B. Scoped (legacy, `graph-model.md`) | Every leaf of smaller depth that is a leaf child of the parent of L or of any ancestor directory of L | + +Under B, a leaf also waits for the leaf children that sit above its own directory, and so on up +to the campaign root. Leaves in an unrelated branch never hold it back. + +Both readings use the same rule for the three non-terminal statuses: a `paused` leaf holds back +exactly what a `planned` or `ongoing` one does. The choice is about the ready rule as a whole, not +about `paused` alone. The status is not special: Eliott asked whether a halted upper leaf must +block everything downstream, and that is the same question for any leaf that is not finished. + +An `ongoing` leaf is not in the ready set, because it is not `planned`. A leaf started by an +override (`planned → ongoing` outside the set) is recorded and allowed. + +## Subtrees and directories + +**Pausing or cancelling a directory** is one operation over its leaves. + +- `pause` sets every `planned` and `ongoing` leaf under the directory to `paused`. +- `cancel` sets every `planned`, `ongoing` and `paused` leaf under it to `cancelled`. +- Leaves already terminal are left alone. A leaf where the move is refused is skipped, never an error for the whole operation. +- One reason, one timestamp and one `op_id` are shared by every history entry the operation writes. The operation is one call and one transaction, so it is "recorded once". +- It is a snapshot, not a standing flag. A leaf added to the directory later starts `planned`. +- `resume` of a directory sets each `paused` leaf under it to the `from` of its last pause entry (`planned` or `ongoing`). A leaf whose last pause came from another operation is resumed too, each by its own rule. The reason is required. + +**A directory's status is derived on every read and never stored (I6).** It is computed from all +leaves under it, at any depth. The first matching row wins. + +| # | Leaves under the directory | Derived status | +|:--|:--|:--| +| 1 | none | `planned` | +| 2 | all `cancelled` | `cancelled` | +| 3 | all terminal, at least one `done` | `done` | +| 4 | at least one `ongoing` | `ongoing` | +| 5 | at least one `paused` | `paused` | +| 6 | at least one `done`, the others `planned` or `cancelled` | `ongoing` | +| 7 | otherwise (`planned`, with or without `cancelled`) | `planned` | + +Row 3 reads a directory whose leaves are all finished as `done` even if some were cancelled. A +reader that must tell them apart uses the counts per status, which the read model carries. + +## Sealing + +A node is sealed when its content can no longer change. A sealed node accepts one change: an +append-only comment (`comments[]`). + +| Status | Content edit | Comment | Status move | Progress | +|:--|:--|:--|:--|:--| +| `planned` | allowed, amendment note required | allowed | per `Transitions` | allowed | +| `ongoing` | allowed except sealed steps, amendment note required | allowed | per `Transitions` | allowed | +| `paused` | allowed except sealed steps, amendment note required | allowed | per `Transitions` | allowed | +| `cancelled` | refused | allowed | refused | refused | +| `done` | refused | allowed | refused | refused | + +- **Content** is every stored field except `status`, `status_reason`, `history`, `progress`, `comments` and the state marks. The state marks are a criterion's `met`, and a step's `done`, `commit_sha` and `done_at`. +- **The amendment rule is uniform.** Any content edit to a `planned`, `ongoing` or `paused` node carries the amendment note, whatever the status. The stricter rule applies everywhere, as Eliott decided. +- **Status moves, progress, comments and state marks never produce an amendment (I5).** Setting `met` is a state change like a move, allowed until the leaf is terminal. +- **A step recorded done inside an `ongoing` or `paused` leaf is sealed.** Its commit is on record, so its content (goal, logic, deliverables, checks, commit, references) cannot change and its `done` mark cannot be cleared. The other steps and the leaf's own fields stay editable. A sealed step cannot be removed or reordered. +- **Directories follow their derived status.** A directory (or the campaign root) whose derived status is `done` or `cancelled` is sealed: its own content (title, context, goal, criteria, references, gotchas, notes) cannot change, and it accepts comments. Adding or removing a child is a structure edit of the child, not a content edit of the directory, so it stays allowed with an amendment. A directory in any other derived status takes edits with an amendment note. Weak point: a new `planned` child moves the derived status off `done`, which unseals the directory. The amendment log still records both edits. +- **Nothing reopens done work.** A new piece of work is a new node. There is no `done → ongoing`. +- **Gate marks do not gate `done`.** Real campaigns leave open (`⬜`) gates on most done leaves: 30 of 48 done leaves under `__roadmap__/` carry at least one. So the only precondition of `done` is I8, as in R01. Criteria `met` is information, not a check. +- **Structure edits on sealed nodes.** Deleting a `done` or `cancelled` leaf keeps its acknowledgement (I9) and its snapshot in the amendment. Moving a sealed leaf changes no content. Whether a move that changes the ready set of other leaves needs the acknowledgement is left to M2's impact analysis. + +**Risk: a wrong step record is permanent.** A mistyped `commit_sha` on a sealed step cannot be +corrected. The remedy today is a comment on the leaf. If this bites, a human-only correction with +an amendment is the least invasive fix. Not decided here, since it weakens the seal. + +## Legacy mapping + +For the importer (M3). Counts are from `__roadmap__/` at the date of this document. + +| Legacy status | New status | Reason and provenance | In real campaigns | +|:--|:--|:--|:--| +| `planned` | `planned` | Same meaning | 26 rows | +| `inprogress` | `ongoing` | Rename | 4 rows, all in campaigns being planned now | +| `done` | `done` | Same meaning. Legacy `done` was "immutable; reopen via a new amendment node", which is the sealing rule | 65 rows | +| `blocked` | `cancelled` | The legacy skill defined `blocked` as terminal within a campaign, never auto-resolved, which is how it was used to abandon work. The legacy file holds no reason, so the importer writes `status_reason: "imported from legacy status blocked"` and warns | 0 rows | +| `amendment` | `planned` | Legacy `amendment` was the initial status of a node added by an amendment, never a state an existing node moved to. The provenance stays in the amendment: the importer writes the `A` row as an amendment (`legacy_id`) with a change `op: add` for each filename in its "Nodes Added" cell | 0 rows. The one node added by an amendment (`hub_mode_reconciliation.md`, A1) is `done` | + +Legacy files carry no timestamps and no history of moves. The importer writes no history entries: +the status is set directly and `history` starts empty. + +## R01 deltas + +For `r01_sync`. R01 is not edited by this leaf. + +| R01 location | Change | +|:--|:--| +| §Graph operations, Status FSM diagram | Replace with the five-status machine of `Transitions`: `planned → ongoing, paused, cancelled`; `ongoing → paused, cancelled, done`; `paused → planned, ongoing, cancelled`. Remove `blocked`, `amendment` and the `done → amendment` edge | +| §Graph operations, Order | "not done" becomes "`planned`"; "every leaf of smaller depth is done" becomes "`done` or `cancelled`". The sentence "Wave semantics are global" stands or changes with Eliott's answer in `Open for Eliott` | +| §Graph operations, after the FSM | "Starting a leaf outside the ready set is refused unless an override with a reason is given" stays. Add the directory pause and cancel operation and the derivation table | +| §Graph operations, Impact analysis | Remove "done work reopened". Add "leaves made ready by a cancel" | +| §Contracts, I5 | Add: comments and state marks never produce an amendment. A sealed node accepts no content edit | +| §Contracts, I8 | Unchanged. Add: it is the only precondition of `done` | +| §Contracts, I9 | "Deleting or reopening done work, or moving work in progress, needs an explicit acknowledgement" becomes "Deleting sealed work, or moving work in progress, needs an explicit acknowledgement. Nothing reopens done work". Reopening is replaced by sealing | +| §Data Model, schema sketch | `blocked_reason?` becomes `status_reason?`; history `note?` becomes `reason?`; add `comments[]` (details in stored-schema.md) | +| §Concurrency, last bullet | "records `inprogress`" becomes "records `ongoing`" | +| §Key Flows, Execute | `inprogress` becomes `ongoing` | +| §Alternatives Considered, Mutation policy | "full CRUD with guards on done work" is now "full CRUD, with done and cancelled nodes sealed" | + +## Open for Eliott + +### OPEN: how far does a held leaf hold back deeper leaves? + +Whether a leaf that is not finished (`paused`, and equally `planned` or `ongoing`) holds back every +deeper leaf in the campaign (A, R01's rule) or only those that sit under its own parent (B, the +legacy rule). See `Ready set` for the exact rule. + +**What the real meta-roadmap shows.** `__roadmap__/roadmap-mcp-rework/` is a chain, not a tree: + +| Depth | Leaves | +|:--|:--| +| 0 | M0, M0b | +| 1 | M1 (`core/`) | +| 2 | M2 (`core/engine/`) | +| 3 | M3 (`core/engine/interchange/`) | +| 4 | M4, M5 (`.../consumers/`) | +| 5 | M6, M7 (`.../consumers/delivery/`) | +| 6 | M8 (`.../delivery/cutover/`) | + +Every deeper leaf sits under the parent of every shallower one, so A and B agree on every leaf +today. The readings only differ once a directory has a second branch. Example, per reading: + +- **A. Global.** M5 is paused for a bug. M6, M7 and M8 are all held back. M6 needs only M4 (the meta-roadmap Gotcha: "M6 needs only M4 but also waits on M5"), yet it waits. +- **B. Scoped.** M5 is paused. Its parent is `consumers/`, so the leaves held back are those in `consumers/delivery/` and `consumers/delivery/cutover/`: M6, M7, M8. Same set as A here. The difference needs a hypothetical branch. Add a directory `docs/guide/` at the campaign root with a leaf at depth 2, next to `core/`. Pause M1 (depth 1, parent `core/`). Under A the docs leaf waits for M1. Under B it does not, because it is not under `core/`. + +**Recommendation: B.** + +- It is what the legacy skill did, so the imported campaigns keep the readiness they had. Under A, independent branches become sequenced on import. +- It answers Eliott's remark that a halted upper leaf need not block everything downstream, without a new status or an edge field. To hold a branch on purpose, pause the directory. +- It removes the M6-after-M5 over-sequencing at no cost to the "depth is the only ordering rule" decision. +- It costs a more careful ready computation (ancestors, not a global depth index) and the "wave" of the view becomes a display of `level`, not a readiness fact. R01's sentence "Wave semantics are global" changes, and I1 stays true. + +A mixed reading (global for `planned` and `ongoing`, scoped for `paused` only) is possible and +rejected here: it gives two ordering rules for one tree. + +### Objections raised against the defaults + +| # | Default | Objection | Taken | +|:--|:--|:--|:--| +| 1 | `paused → planned` allowed with a reason | Add: no step recorded done, or `planned` contradicts a sealed commit | Added to `Transitions` | +| 2 | `cancelled` terminal | A mistaken cancel, above all a directory cancel, cannot be undone. Options in the objection text | Default kept, Eliott decides | +| 3 | A step recorded done is sealed (recommended: yes) | A mistyped commit record is permanent | Default kept, risk noted in `Sealing` | From 1bab7966c960188dec2bc243e98b6bb1186c7296 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:41:37 +0900 Subject: [PATCH 017/183] feat(rdm-mcp): tag each probe line with the server process The host loads the ui:// page without the ?run= flag, so run_kind arrives as unknown. With server_pid and server_started_ms on every line, a cold run is the first first-paint probe of each server process. Co-Authored-By: Claude Opus 5.5 --- crates/rdm-mcp/src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/rdm-mcp/src/main.rs b/crates/rdm-mcp/src/main.rs index 5bf3c6f..f871b5f 100644 --- a/crates/rdm-mcp/src/main.rs +++ b/crates/rdm-mcp/src/main.rs @@ -219,6 +219,14 @@ impl RdmSpike { .map_or(Value::Null, |v| Value::String(v.as_str().to_owned())), ); map.insert("t_recorded_ms".into(), json!(now_ms())); + // Tags the server process, so the first first-paint probe of each + // process can be told apart as a cold run when the host gives the + // page no `?run=` flag. + map.insert("server_pid".into(), json!(std::process::id())); + map.insert( + "server_started_ms".into(), + json!(SERVER_STARTED_MS.get().copied()), + ); } let dir = std::path::PathBuf::from(dir); std::fs::create_dir_all(&dir).map_err(internal)?; @@ -287,8 +295,12 @@ impl ServerHandler for RdmSpike { } } +/// When this server process started, in epoch milliseconds (set once in `main`). +static SERVER_STARTED_MS: std::sync::OnceLock = std::sync::OnceLock::new(); + #[tokio::main] async fn main() -> Result<(), Box> { + let _ = SERVER_STARTED_MS.set(now_ms()); let service = RdmSpike::new().serve(stdio()).await?; service.waiting().await?; Ok(()) From a2cafbf8a687e39fe967b05781fec93a19f723c8 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:41:38 +0900 Subject: [PATCH 018/183] chore(roadmap): close the m0 build level and start the host trials Co-Authored-By: Claude Opus 5.5 --- __roadmap__/m0-feasibility-spike/build/README.md | 12 ++++++------ .../m0-feasibility-spike/build/trials/README.md | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/__roadmap__/m0-feasibility-spike/build/README.md b/__roadmap__/m0-feasibility-spike/build/README.md index 519b45f..2cd3ef8 100644 --- a/__roadmap__/m0-feasibility-spike/build/README.md +++ b/__roadmap__/m0-feasibility-spike/build/README.md @@ -20,9 +20,9 @@ A stub `rdm-mcp` that serves the built graph page and passes its stdio integrati ## Status ```mermaid graph TD - stub_server[Stub server]:::inprogress - graph_view[Graph view]:::inprogress - trials[Host trials]:::planned + stub_server[Stub server]:::done + graph_view[Graph view]:::done + trials[Host trials]:::inprogress classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -33,9 +33,9 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `stub_server.md` | 📄 Leaf Task | 🔄 In Progress | -| `graph_view.md` | 📄 Leaf Task | 🔄 In Progress | -| `trials/` | 📁 Directory | ⬜ Planned | +| `stub_server.md` | 📄 Leaf Task | ✅ Done | +| `graph_view.md` | 📄 Leaf Task | ✅ Done | +| `trials/` | 📁 Directory | 🔄 In Progress | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m0-feasibility-spike/build/trials/README.md b/__roadmap__/m0-feasibility-spike/build/trials/README.md index ae28382..7c39fd4 100644 --- a/__roadmap__/m0-feasibility-spike/build/trials/README.md +++ b/__roadmap__/m0-feasibility-spike/build/trials/README.md @@ -19,7 +19,7 @@ Every host-facing gate of M0 is observed on Claude Code Desktop, VS Code Copilot ## Status ```mermaid graph TD - host_trials[Host trials]:::planned + host_trials[Host trials]:::inprogress report[Spike report]:::planned classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a @@ -31,7 +31,7 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `host_trials.md` | 📄 Leaf Task | ⬜ Planned | +| `host_trials.md` | 📄 Leaf Task | 🔄 In Progress | | `report/` | 📁 Directory | ⬜ Planned | ## Amendment Log From 01487b692f6f50c6fd74ff1f80efea335bd724e0 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:42:34 +0900 Subject: [PATCH 019/183] docs(design): specify the rdm stored schema Co-Authored-By: Claude Sonnet 5.5 --- __design__/rdm/stored-schema.md | 354 ++++++++++++++++++++++++++++++++ 1 file changed, 354 insertions(+) create mode 100644 __design__/rdm/stored-schema.md diff --git a/__design__/rdm/stored-schema.md b/__design__/rdm/stored-schema.md new file mode 100644 index 0000000..4dcc112 --- /dev/null +++ b/__design__/rdm/stored-schema.md @@ -0,0 +1,354 @@ +# rdm — Stored schema + +Every fact `rdm` stores, with its name, type, whether it is required, and its meaning. This is the +settled form of R01's provisional schema sketch (`architecture.md` §Data Model). The legacy +grammars it must cover are traced production by production in [traceability.md](traceability.md). +Status meanings are in [statuses.md](statuses.md). The read model that consumers receive is a +separate document (`read-model.md`). + +Where a default of the M0b plan is defective, the text gives the default as the field table says +it, and then an `OBJECTION` with the alternative. The `rdm-schema` crate builds the default unless +Eliott accepts the objection. Fields new against R01 are marked **new**. + +Notation: + +| Type | Meaning | +|:--|:--| +| `string` | One line, no line break | +| `lines` | Array of strings, each one line. Used for all multi-line prose, so git merges it line by line. The API accepts and returns plain strings and splits or joins on `\n` | +| `ts` | UTC instant, RFC 3339, `"2026-11-16T10:20:30Z"` | +| `ulid` | A ULID, 26 characters of Crockford base32 | +| `T[]` | Array of `T` | +| `T?` | Optional: the key is absent when there is no value, never `null` | + +## Files + +``` +__roadmap__// + _dir.json campaign root (Directory, kind: campaign) + _amendments/.json one file per amendment (Amendment) + .json leaf node (Leaf) + /_dir.json directory node (Directory, kind: directory) + /.json + .rdm/ untracked scratch: lock, journal/, staging/ +``` + +| Rule | Detail | +|:--|:--| +| Names are paths | A node's name is its path segment, `^[a-z][a-z0-9_-]*$`. It is not stored in the file | +| Identity | Every node has an immutable `id`. The id format and its minting belong to M1. The schema types it as `string` | +| Version stamp | Every file carries `schema_version` (see `Format version`) | +| Unknown fields | Every object type below keeps the keys it does not know, in order, and writes them back after the known ones. This holds for nested objects too (steps, criteria, references, commits, history and comment entries, changes). It is the stored half of I12 | +| Canonical order | The order of the rows in each field table is the canonical field order. Two-space indent, LF, trailing newline. M1 owns the serialiser | +| Derived, never stored (I6) | Directory status, the nodes table, the mermaid graph, the progress table, waves, the ready set, a step's number if OBJECTION 1 is accepted, the display id of an amendment, a leaf's commit count when the engine recorded the steps | + +## Directory + +`_dir.json`, for the campaign root and for every directory node. A directory has no `status`: it +is derived (`statuses.md`, `Subtrees and directories`). + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `schema_version` | `string` | yes | Format version, `"MAJOR.MINOR"` | +| `id` | `string` | yes | Immutable node id | +| `kind` | `"campaign"` or `"directory"` | yes | `campaign` for the root file only | +| `title` | `string` | yes | The H1 of the legacy README | +| `context` | `lines` | yes | Where the node fits; legacy `## Context`, one or more lines | +| `references` | `Reference[]` | yes | Legacy `## Reference Documents`. May be empty (the section is optional in the legacy grammar) | +| `goal` | `string` | yes | One line. The legacy grammar allows exactly one line | +| `preconditions` | `Criterion[]` | yes | Entry criteria, one or more | +| `success_gates` | `Criterion[]` | yes | Completion criteria, one or more | +| `gotchas` | `lines` | yes | Legacy `## Gotchas`, verbatim markdown lines. May be empty (the section is optional) | +| `notes` | `lines` | yes | **new**: the `Notes` cell of the directory's own row in its parent's Progress table. May be empty | +| `comments` | `Comment[]` | yes | **new**: append-only comments. May be empty | + +Rules for `validate`: `goal` has no line break; `preconditions` and `success_gates` each have at +least one entry; `kind` is `campaign` exactly when the file is at the campaign root. + +A directory carries no branch and no commit count. The legacy Progress row of a directory repeats +the branch of one of its leaves and a count of commits; both are dropped (see `traceability.md`, +`Stretched legacy data`). + +## Leaf + +`.json`. + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `schema_version` | `string` | yes | Format version | +| `id` | `string` | yes | Immutable node id | +| `kind` | `"leaf"` | yes | Discriminates a leaf from a directory when a reader holds only the JSON | +| `title` | `string` | yes | The H1 of the legacy leaf file | +| `status` | `"planned"`, `"ongoing"`, `"paused"`, `"cancelled"` or `"done"` | yes | Meanings and moves in `statuses.md`. A new leaf is `planned` | +| `status_reason` | `string?` | no | **new** (replaces R01's `blocked_reason`). The reason of the move into the current status. Present only while the status is `paused` or `cancelled` | +| `goal` | `string` | yes | One line | +| `preconditions` | `Criterion[]` | yes | Entry criteria, one or more | +| `success_gates` | `Criterion[]` | yes | Completion criteria, one or more | +| `references` | `Reference[]` | yes | Supporting documents of the leaf | +| `steps` | `Step[]` | yes | One to five steps, in order | +| `progress` | `Progress` | yes | Where the work happened | +| `history` | `History[]` | yes | Status moves, oldest first. Empty on a new leaf, and on a leaf imported from legacy markdown | +| `comments` | `Comment[]` | yes | **new**: append-only comments | + +`Progress` is an object, not a separate type section: + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `branch` | `string?` | no | The task branch, for example `task/write-skill-md`. Absent when the legacy cell is `-`, `--`, `---` or `—` | +| `commits` | `integer?` | no | **new**: a commit count written by the importer for a leaf whose steps carry no `commit_sha`. The legacy count can exceed the step count (a fixup commit). The engine never writes it: for an engine-recorded leaf the count is derived from the steps | +| `notes` | `lines` | yes | The legacy `Notes` cell. May be empty | + +Rules for `validate`: + +- `steps` has one to five entries, and entry *i* has `number == i + 1`. +- `goal` has no line break. +- `references` has at least one entry (the legacy grammar requires a non-empty `**References**` line). OBJECTION 6. +- `status == planned` implies every step has `done: false`. +- `status == done` implies every step has `done: true`. +- `status_reason` is present exactly when `status` is `paused` or `cancelled`, and equals the `reason` of the last `history` entry when `history` is not empty. +- A leaf imported as `done` has steps with `done: true` and no `commit_sha`. I8 is checked when a move to `done` is made (see `Changes against R01`). + +## Step + +An element of `Leaf.steps`. + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `number` | `integer` | yes | 1 to 5, sequential from 1. OBJECTION 1 | +| `title` | `string` | yes | The text after `## Step N:` | +| `goal` | `string` | yes | One line: the unique change intent of the step | +| `implementation_logic` | `lines` | yes | Free prose and lists, blank lines allowed. At least one line is not blank | +| `deliverables` | `lines` | yes | Legacy: one line. Import stores it as one element, unsplit. A new step may hold several elements, one per deliverable. M3's export joins them with `; ` | +| `references` | `Reference[]` | yes | Step-level documents. May be empty (optional in the legacy grammar) | +| `checks` | `Check[]` | yes | One or more. The legacy grammar has exactly one per step, so import yields one. OBJECTION 2 | +| `commit` | `Commit` | yes | The commit message the step must produce | +| `requires` | `lines?` | no | Prose prerequisites that are not obvious. **Never an id or an edge**: I1 forbids a stored dependency between siblings. Never used in real campaigns, kept so the grammar's field has a home | +| `done` | `bool` | yes | The step is recorded done. A step recorded done is sealed (`statuses.md`, `Sealing`) | +| `commit_sha` | `string?` | no | The commit that completed the step. Set with `done: true` by the engine | +| `done_at` | `ts?` | no | **new**: when the step was recorded done | + +`Check`: + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `text` | `string` | yes | **new**: the check as written, without the `(expected: …)` trailer. Prose or a command line | +| `expected` | `"PASS"` or `"FAIL"` | yes | The outcome the check expects | +| `command` | `string?` | no | A shell command, when the whole check is one runnable command. Set only by the author of a new check, never guessed by the importer | + +**OBJECTION 1: store a step `id`, derive `number`.** The default stores `number`. A number stored +beside the array position can disagree with it, which is the problem R01 avoided for names by +making the name the path. R01's composite "reorder steps" would have to renumber, and comments or +amendment `changes` that point into a step by number would then point at another step. R01's +sketch had a step `id`, and the plan's list drops it. Alternative: keep an immutable step `id` +(minted like node ids), derive `number` from position, and let `Leaf.steps` order be the only +order. Then the validator rule "numbered in sequence" cannot be violated. If accepted, the field +`number` leaves the table, `id` joins it, and in `traceability.md` the `` row reads `title` as stored and the number as derived. + +**OBJECTION 2: a check is prose, not `{command, expected}`.** The plan's default makes `command` +required. The legacy check is a prose line that ends in `(expected: PASS)` or `(expected: FAIL)`. +Real checks are commands in backticks, several commands joined by `;`, shell loops, or a +sentence. No parser extracts a `command` from all of them without loss or invention. Decision +recorded: `text` is required and lossless, `expected` is parsed from the trailer (the one part +the grammar fixes), and `command` is optional and filled only by an author. Export (M3) writes +`text`, a space, and `(expected: X)`. An agent that wants to run a check uses `command` when it +exists and reads `text` otherwise. + +Rules for `validate`: `title` is not blank; `implementation_logic` has a non-blank line; a step +with `done: true` has `done_at` when the engine recorded it; `commit_sha` and `done_at` appear +only when `done` is `true`. + +## Criterion + +An element of `preconditions` or `success_gates`, at leaf and directory level. + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `text` | `string` | yes | The criterion, one line. Tags such as `[static]` or `[behavioral]` stay in the text | +| `met` | `bool` | yes | Pre-condition: `[x]` is `true`. Gate: `✅` is `true`. A new criterion is `false` | + +`met` is a state mark, not content: setting it produces no amendment and is allowed until the +node is sealed. A `done` leaf may carry unmet gates; `met` informs and gates nothing +(`statuses.md`, `Sealing`). Real campaigns hold 16 checked pre-conditions and 150 `✅` gate marks. + +## Reference + +An element of `references`, at directory, leaf and step level. One shape for all three. + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `label` | `string?` | no | `R01`, `R02`, … The label other text cites. Unique within one `references` array. The legacy directory section requires it, so `validate` requires it there | +| `title` | `string` | yes | The link text without the label | +| `target` | `string?` | no | The link target as written: a path relative to the node file, or a URL. Absent for a reference written as plain text. Not resolved by the schema | +| `note` | `string?` | no | The text after ` — `, one line | + +Legacy forms and how they split: + +| Legacy text | `label` | `title` | `target` | `note` | +|:--|:--|:--|:--|:--| +| `- [R01 Architecture](../a.md) — the design` (directory) | `R01` | `Architecture` | `../a.md` | `the design` | +| `[R01 §Data Model](../a.md) — the sketch` (leaf, in a `; `-separated line) | `R01` | `§Data Model` | `../a.md` | `the sketch` | +| `[Gap analysis](g.md) — why` | none | `Gap analysis` | `g.md` | `why` | +| a segment that is not a link | none | the whole segment | none | none | + +The importer splits a leaf's one-line `**References**` on `; ` outside brackets and parentheses. +A label is the prefix `R` and two digits followed by a space at the start of the link text. A +segment it cannot parse becomes a reference with only `title`, so nothing is dropped. +Note: a relative `target` breaks when a node moves. M2 may normalise targets to repository-relative +paths on `move`; the stored form is as written. + +## Commit + +The commit message a step must produce. Field of `Step.commit`. + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `type` | `string` | yes | Project-defined (`docs`, `feat`, …). The legacy shape is `[^\s()`!:]+` | +| `scope` | `string?` | no | Project-defined. **The legacy grammar requires a scope**; the default makes it optional | +| `breaking` | `bool` | yes | **new**: the `!` mark. `false` when absent | +| `summary` | `string` | yes | The text after `: `. May contain colons | + +The backticks around the legacy line are presentation and are dropped. The message has no body or +trailer; the actor adds trailers at commit time. + +Consequence for M3: a commit with no `scope` cannot be exported to a line the legacy validator +accepts. Export either writes `type: summary`, which the old tool rejects, or refuses. M3 decides. + +## History + +An element of `Leaf.history`: one status move. Written by `transition`; never an amendment (I5). + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `ts` | `ts` | yes | When the move was made | +| `from` | status | yes | The status left | +| `to` | status | yes | The status entered | +| `actor` | `Actor` | yes | Who made it. OBJECTION 3 | +| `reason` | `string?` | no | Required for moves into `paused` and `cancelled`, and for `paused → planned` and `paused → ongoing` (`statuses.md`) | +| `override` | `bool?` | no | `true` when the leaf was started outside the ready set | +| `op_id` | `string?` | no | **new**: shared by every entry that one operation writes, so a directory pause or cancel is recognisable as one operation | + +`Actor` (also used by `Comment` and `Amendment`): + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `kind` | `"agent"`, `"human"` or `"import"` | yes | The actor kind that `statuses.md` names in its `Who` column | +| `name` | `string?` | no | Free identifier: a user, an agent session, a tool | + +**OBJECTION 3: `actor` is an object, not a string.** The plan's list gives `actor` with no type, +and R01 gives none. `statuses.md` states who may set each move, `agent`, `human` or `both`. A +bare string cannot be checked against that. `kind` is the part a rule can test, and `name` is the +part a person reads. If a plain string is wanted, the kind must then be a separate field. + +## Comment + +An element of `comments` on a leaf or a directory. Append-only. The one change a sealed node +accepts. Never an amendment. + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `ts` | `ts` | yes | When it was added | +| `actor` | `Actor` | yes | Who added it | +| `text` | `lines` | yes | The comment, one or more lines (it is prose, so it follows the lines rule) | + +Entries are never edited or removed. A correction is a new comment. + +**OBJECTION 4: comments in the node file will conflict across branches.** R01 chose one file per +leaf so task branches never touch the same file. A comment on a done leaf, added on two branches, +appends at the end of one array on both sides and git reports a conflict. `history` has the same +property, but only the branch that works a leaf writes it. Comments are written by anyone, on +finished nodes. Alternative: one file per comment, `_comments/.json` at the campaign root, +as for amendments, with `node_id` in the entry. A node's comments are then a query, and a comment +never changes the node's `rev`. The default stays in the field tables; M1 should weigh the +alternative before the store fixes the layout. + +## Amendment + +`_amendments/.json`. One file per content or structure edit. Append-only. + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `schema_version` | `string` | yes | Format version | +| `id` | `ulid` | yes | Identity and order. The display id is derived (below) | +| `legacy_id` | `string?` | no | **new**: the legacy `A1`, `A2`, … of an imported amendment | +| `ts` | `ts` | yes | When it was made. For a legacy row: the row's day at `T00:00:00Z` | +| `actor` | `Actor` | yes | Who made it | +| `description` | `string` | yes | Non-empty (I5). The legacy `Rationale` | +| `source` | `string?` | no | The report that justified it. Legacy: a path under `__reports__/` | +| `op_id` | `string?` | no | The retry key of the write that made it | +| `changes` | `Change[]` | yes | What changed, one or more | +| `snapshot` | `object?` | no | The removed subtree of a delete, as stored JSON keyed by path, so it can be restored | + +`Change`: + +| Field | Type | Req | Meaning | +|:--|:--|:--:|:--| +| `node_id` | `string` | yes | The node the change names. A node's amendment log is the set of amendments whose `changes` name its id | +| `op` | `"add"`, `"remove"`, `"set"`, `"rename"` or `"move"` | yes | R01's primitives. Composite operations expand to these. M2 owns any addition | +| `path_before` | `string?` | no | For `rename`, `move`, `remove` | +| `path_after` | `string?` | no | For `rename`, `move`, `add` | +| `field` | `string?` | no | A JSON pointer into the node, for `set` | +| `old` | JSON value? | no | The value before, for `set` | +| `new` | JSON value? | no | The value after, for `set` | + +**Display id.** A sequential id (`A1`, `A2`) collides when two branches mint the next number. The +display id is derived on read: `A-` followed by the shortest suffix of the ULID that is unique in +the campaign, at least 6 characters (`A-7QX3NM`). An imported amendment shows its `legacy_id` +instead (`A1`). The display id is never stored. + +**Legacy rows.** A legacy log row `| A1 | 2026-11-16 | | ["x.md"] | |` becomes one +amendment: `legacy_id: "A1"`, `ts` from the date, `actor.kind: "import"`, `source`, `description` +from the rationale, and one `{node_id, op: "add"}` change per filename in `Nodes Added`, resolved +to node ids after the nodes are imported. The cell is a JSON-like list, written as `["a.md"]` or +`[ "a.md" ]`; the importer reads both. A legacy log sits in the README of the directory that added +the nodes; the amendment is stored once, at the campaign root, and `changes` name the nodes. + +## Format version + +| Item | Decision | +|:--|:--| +| Field | `schema_version`, a string `"MAJOR.MINOR"`, in every file | +| First value | `"0.1"`. The crate stays at `0.x` until M7, so the format does too: a format `1.0` would force crate `1.0` | +| Constant | `FORMAT_VERSION` in `rdm-schema` | +| Bump: minor | A new optional field or a new enum value that old readers can ignore. Adding an optional edge field later is a minor bump | +| Bump: major | A field removed, renamed or given another meaning, or a field made required | +| Reader | Refuses a file with a higher major, with an upgrade message. While the major is `0`, it refuses a higher minor too, since `0.x` minors may break. From `1.0`, a higher minor is read and its unknown fields kept (I12) | +| Writer | Stamps the version it writes. One campaign may hold files of different minors | +| Relation to the crate | A format major forces a crate major, a format minor a crate minor (M0b plan). The read-model version is a separate constant, in `read-model.md` | + +## Changes against R01 + +| Area | R01 sketch | This schema | +|:--|:--|:--| +| Criteria | `preconditions[]`, `success_gates[]` as plain text | `Criterion {text, met}`, at leaf and directory level | +| Step | `{id, goal, implementation_logic, deliverables[], checks[], commit, references[], requires[], done, commit_sha?}` | adds `number`, `title`, `done_at?`; `implementation_logic` and `deliverables` are `lines`; `requires` is optional prose; `id` is dropped, see OBJECTION 1 | +| Check | `{command, expected}` | `{text, expected, command?}`, OBJECTION 2 | +| Commit | `{type, scope, summary}` | `{type, scope?, breaking, summary}` | +| Reference | `references[]`, no shape | `{label?, title, target?, note?}` | +| Status | `blocked_reason?` | `status_reason?`; vocabulary per `statuses.md` | +| History | `{ts, from, to, actor, note?, override?}` | `note` is `reason`; adds `op_id?`; `actor` is an object | +| Comments | none | `comments[]` on leaves and directories | +| Amendment | `{… id, …}` | adds `legacy_id?`; the id is a ULID with a derived display id | +| Directory | no notes | adds `notes` and `comments` | +| Progress | `{branch?, notes}` | adds `commits?` (import only); `notes` is `lines` | +| Gotchas, context | strings or lines unstated | `lines` | +| Unknown fields | I12 stated | Every type keeps them, nested ones too | +| Format version | "every file carries `schema_version`" | `"MAJOR.MINOR"`, first value `"0.1"`, reader rules above | + +**Finding against R01 (invariant I8).** R01 says a leaf is `done` only when every step is done +with its commit recorded. A leaf imported from legacy markdown is `done` and has no `commit_sha` +on any step: the grammar never stored one. If I8 were checked on stored state, every imported done +leaf would fail. Resolution: I8 is checked when the move to `done` is made, and the stored-state +rule is "`done` leaf has every step `done`". The import records the legacy count in +`progress.commits`. `r01_sync` rewrites I8 to say so. This was not in `statuses.md`, whose `R01 +deltas` row for I8 says "unchanged"; this document supersedes that row. + +**OBJECTION 5: `status_reason` is a copy of the last history reason.** It is derived data stored +beside its source, which I6 forbids. The default keeps it because an imported `blocked → cancelled` +leaf has no history entry to hold the reason. Alternative: the importer writes one `history` entry +with `actor.kind: "import"` and `status_reason` is derived. Default kept, with the consistency +rule in `Leaf`. + +**OBJECTION 6: a leaf's `references` need not be non-empty.** The legacy grammar demands a +non-empty `**References**` line, and this document carries that as a `validate` rule. A leaf that +has nothing to cite then has to invent a reference. A warning, not an error, would be kinder. +Left to M2's diagnostics, which assign severities. From 9c325b096a24486d13f27a5a14236f368c0260a7 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:44:50 +0900 Subject: [PATCH 020/183] docs(design): trace the legacy grammar to the rdm stored schema Co-Authored-By: Claude Sonnet 5.5 --- __design__/rdm/traceability.md | 146 ++++++++++++++++++++++++++++++++ tools/check_rdm_traceability.py | 118 ++++++++++++++++++++++++++ 2 files changed, 264 insertions(+) create mode 100644 __design__/rdm/traceability.md create mode 100644 tools/check_rdm_traceability.py diff --git a/__design__/rdm/traceability.md b/__design__/rdm/traceability.md new file mode 100644 index 0000000..5227654 --- /dev/null +++ b/__design__/rdm/traceability.md @@ -0,0 +1,146 @@ +# rdm — Traceability of the legacy grammars + +Every production of `leaf.bnf` and `readme.bnf` has one row, with a disposition: + +| Disposition | Meaning | +|:--|:--| +| `stored` | The fact is a field of the stored schema. The target is the field path in [stored-schema.md](stored-schema.md) | +| `derived` | The fact is computed on every read and never stored (I6). The target says from what | +| `dropped` | The fact is not kept. The target is the reason | + +`uv run --no-project tools/check_rdm_traceability.py` prints each grammar with +`bash skills/managing-roadmaps/scripts/dirtree-rdm.sh grammar leaf` and `grammar readme`, and +fails unless every production appears in the matching table below with a valid disposition and a +non-empty target. It also fails on a row that names no production, so a renamed production cannot +leave a stale row. + +Counts: `leaf.bnf` has 22 productions. `readme.bnf` has 57. The plan says 58; the printer's +header carries one more `::=` in a comment (` ::= production`), which defines nothing. +Four names occur in both grammars (``, ``, ``, +``) and have a row in each table. + +Cells do not contain a pipe character, so the script can split rows on it. "Presentation" means +that the export (M3) re-creates the text from stored fields. + +## Leaf grammar + +| Production | Disposition | Target or reason | +|:--|:--|:--| +| `` | `stored` | One `Leaf` file, `.json`. The order of H1, header and steps is export layout | +| `` | `stored` | Leaf `goal`, `preconditions`, `success_gates`, `references`. The grammar is order-insensitive, so no order is kept | +| `` | `stored` | One of the four header fields below | +| `` | `stored` | `goal`, one line | +| `` | `stored` | `preconditions[]` | +| `` | `stored` | `success_gates[]` | +| `` | `stored` | `references[]`, the line split on a semicolon and a space into `Reference` | +| `` | `stored` | `preconditions[].text` and `.met`; `[x]` is `true`, `[ ]` is `false` | +| `` | `stored` | `success_gates[].text` and `.met`; the check mark is `true`, the empty box is `false` | +| `` | `stored` | One element of `steps[]` | +| `` | `stored` | `steps[].title` is the text after the colon; `steps[].number` is the digit (derived if OBJECTION 1 is accepted) | +| `` | `stored` | One of the step fields below | +| `` | `stored` | `steps[].goal` | +| `` | `stored` | `steps[].implementation_logic`, the body lines with blank lines kept. The header line and trailing blank lines are presentation | +| `` | `stored` | `steps[].references[]` | +| `` | `stored` | `steps[].deliverables`, one element, not split | +| `` | `stored` | `steps[].checks[].text` and `.expected`. The trailer `(expected: X)` becomes `expected`. `command` is not extracted: the check is prose (OBJECTION 2) | +| `` | `stored` | `steps[].commit.type`, `.scope`, `.breaking`, `.summary`. The backticks are presentation and are dropped | +| `` | `stored` | `steps[].requires`, prose lines | +| `` | `stored` | `title` | +| `` | `stored` | One element of `steps[].implementation_logic` | +| `` | `dropped` | A lexical helper. The lines it matches are stored through `implementation_logic[]` | + +Constraints the grammar states outside its productions, and where each one goes: + +| Constraint | Home | +|:--|:--| +| Step count is 1 to 5 | `validate` rule on `Leaf.steps` | +| Step numbers are sequential from 1 | `validate` rule on `steps[].number` (derived, if OBJECTION 1 is accepted) | +| At least one implementation line is not blank | `validate` rule on `Step.implementation_logic` | +| All four header fields and the five required step fields are present | Required fields of `Leaf` and `Step` | +| Header and step field order is free | Dropped: the canonical order is the field table's | +| Pre-conditions and gates have one or more items | `validate` rule on `Leaf` | + +## README grammar + +| Production | Disposition | Target or reason | +|:--|:--|:--| +| `` | `stored` | One `Directory` file, `_dir.json`. Section order is export layout | +| `` | `stored` | `title` | +| `` | `stored` | `context` | +| `` | `dropped` | Heading literal. The field name is `context` | +| `` | `stored` | `context`, the lines | +| `` | `stored` | `references[]`. The section is optional; an absent section is an empty array | +| `` | `dropped` | Heading literal | +| `` | `stored` | `references[]` | +| `` | `stored` | `references[].label` is the `R` and two digits, `.title`, `.target`, `.note` from the text after the dash | +| `` | `stored` | `goal` | +| `` | `dropped` | Heading literal | +| `` | `stored` | `goal`, exactly one line | +| `` | `stored` | `preconditions[]` | +| `` | `dropped` | Heading literal | +| `` | `stored` | `preconditions[]` | +| `` | `stored` | `preconditions[].text` and `.met` | +| `` | `stored` | `success_gates[]` | +| `` | `dropped` | Heading literal | +| `` | `stored` | `success_gates[]` | +| `` | `stored` | `success_gates[].text` and `.met` | +| `` | `stored` | `gotchas`, verbatim lines. The section is optional; absent is an empty array | +| `` | `dropped` | Heading literal | +| `` | `derived` | The status view of the node's children, from their `status` or derived status | +| `` | `dropped` | Heading literal | +| `` | `derived` | The graph of the node's children, rebuilt on each export | +| `MERMAID_OPEN` | `dropped` | Markup; the export emits it | +| `MERMAID_CLOSE` | `dropped` | Markup; the export emits it | +| `` | `dropped` | The fixed line `graph TD`; the export emits it | +| `` | `derived` | One per child: the id is the child's path name, the label is its `title`, the class is its status. 13 of 95 real labels differ from the child's H1; the title wins | +| `` | `dropped` | Colours are presentation; M6 owns the palette | +| `` | `dropped` | Colours are presentation. The class follows the status `ongoing` | +| `` | `dropped` | Colours are presentation | +| `` | `dropped` | Colours are presentation. The status `amendment` no longer exists (`statuses.md`) | +| `` | `dropped` | Colours are presentation. The status `blocked` no longer exists (`statuses.md`) | +| `` | `derived` | The table of the node's children, from the directory listing | +| `` | `dropped` | Heading literal | +| `` | `derived` | One row per child. Row order carries no meaning: siblings are parallel, so readers order by depth, kind and name. The authored row order is not kept | +| `` | `dropped` | Fixed header; the export emits it | +| `` | `dropped` | Markdown table syntax | +| `` | `derived` | A leaf row or a directory row | +| `` | `derived` | Name from the path, type from `kind`, status from `Leaf.status`. The emoji labels are presentation | +| `` | `derived` | Name from the path, status derived from the leaves under it (`statuses.md`). The emoji labels are presentation | +| `` | `stored` | `Amendment` files. The log of a directory is the amendments whose changes name its nodes | +| `` | `dropped` | Heading literal | +| `` | `stored` | `Amendment` files, one per row | +| `` | `dropped` | Fixed header; the export emits it | +| `` | `stored` | `Amendment.legacy_id`, `.ts`, `.source`, `.changes[]` (one add per filename), `.description` | +| `` | `stored` | `Leaf.progress` and `Directory.notes` | +| `` | `dropped` | Heading literal | +| `` | `derived` | Rendered from the progress of every leaf and the notes of every directory | +| `` | `dropped` | Fixed header; the export emits it | +| `` | `stored` | Leaf row: `Leaf.progress.branch`, `.commits`, `.notes`. Directory row: `Directory.notes`; its branch and commit count are dropped as copies of its leaves' | +| `` | `dropped` | A lexical helper. The lines it matches are stored through `context`, `gotchas` and `goal` | +| `` | `stored` | `Leaf.status`, through the mapping in `statuses.md`, `Legacy mapping` | +| `` | `derived` | The path segment of the node. The stored `id` is new and minted by M1 | +| `` | `derived` | The path segment of a leaf plus `.json` | +| `` | `derived` | The path segment of a directory | + +## Stretched legacy data + +Data that the grammar accepts, or that the validator lets through, and that real campaigns bend. +Counts are over `__roadmap__/` at the date of this document. + +| Item | Evidence | Home or drop | Importer rule | +|:--|:--|:--|:--| +| Checked pre-conditions | 16 `[x]` pre-conditions outside the M0 and M0b campaigns; 150 gate check marks; 30 of 48 `done` leaves still carry an unmet gate | `stored`: `Criterion.met`. A `done` leaf may keep unmet gates, so `met` never gates a move | `[x]` and the check mark give `true`. Nothing is inferred from the leaf's status | +| Progress rows on directories | 3 rows: `implement/`, `finalize/` (both with dashes) and `packaging/` (branch, count 1, empty notes). R01 puts progress on leaves only | `stored`: `Directory.notes`. Branch and commit count are `dropped`, copies of the leaves' | A directory row sets `notes` and nothing else | +| Dash cells | 2 rows use an em dash (U+2014). The validator accepts only `-`, `--` and `---` | `dropped` as a value: a dash means absent | `—`, `–`, `-`, `--` and `---` all mean no value | +| Rows the validator never reads | Its row loop stops silently at the first row that does not match. Only 1 of 14 real Progress rows matches: 11 write the branch in backticks, 2 use the em dash, and 5 have an empty Notes cell, which its pattern cannot match either | No fact lost in the schema | The importer reads every row, strips backticks around the branch, and accepts an empty Notes cell. A row it cannot read is kept as text in `Directory.notes` with a warning, never skipped | +| Commit count above the step count | `dirtree-rdm-cli-ux/refine-output-rendering.md`: 5 commits for 4 steps ("4 step commits + 1 clippy fixup") | `stored`: `Leaf.progress.commits`, import only. For an engine-recorded leaf the count is derived from `commit_sha` | A numeric cell is copied. `-` leaves it absent | +| Done leaves without commit shas | Legacy markdown holds no per-step commit | `Step.commit_sha` is absent on imported steps. I8 is checked on the move to `done`, not on stored state (`stored-schema.md`, `Changes against R01`) | Imported steps of a `done` leaf are `done: true` with no sha | +| The `Requires` step field | 0 uses in any campaign | `stored`: `Step.requires`, prose lines, never ids (I1) | The line is copied as one element | +| Amendment log | 2 rows, both `A1`: `agent_plugin_nest` and `roadmap-mcp-rework`. `Nodes Added` holds filenames, written `["x.md"]` or `[ "x.md" ]`. `Source` holds a report path | `stored`: `Amendment` with `legacy_id` | Both list spellings are read. The date becomes midnight UTC. The actor is `import` | +| Amendment log per directory | Each README has its own log; R01 has one `_amendments/` per campaign | `stored` once, at the campaign root | The importer collects every row of every README | +| Node added by an amendment | The one such node, `hub_mode_reconciliation.md`, is `done`. No node carries the status `amendment` | The origin is the amendment's `add` change | Status maps as written; nothing else | +| Statuses in use | 26 planned, 4 in progress, 65 done; 0 blocked; 0 amendment | Mapping in `statuses.md` | None beyond the mapping | +| Reference items without a label | `create-reporting-skill/README.md` lists a reference with no `R01` label, so its validation fails at that line | `Reference.label` is optional in the type | The label is absent and the importer warns. `validate` requires a label in a directory | +| Mermaid labels | 13 of 95 differ from the child's H1 | `dropped`: derived from `title` | The H1 wins; the importer warns on a difference | +| Sibling order | Nodes-table row order | `dropped`: siblings are parallel, order carries no meaning | Readers order by depth, kind and name | +| Step count | 23 leaves with 1 step, 16 with 2, 23 with 3, 3 with 4, 2 with 5 | `validate` rule: 1 to 5 | None needed; none exceeds 5 | diff --git a/tools/check_rdm_traceability.py b/tools/check_rdm_traceability.py new file mode 100644 index 0000000..655e591 --- /dev/null +++ b/tools/check_rdm_traceability.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +"""Check that every production of the legacy rdm grammars is traced. + +Prints each grammar with `dirtree-rdm.sh grammar leaf|readme`, extracts the name of each +production, and checks that `__design__/rdm/traceability.md` has one row for it, in the table of +the same grammar, with a disposition of `stored`, `derived` or `dropped` and a non-empty target. +A row that names no production fails too, so a renamed production cannot leave a stale row. + +Usage: uv run --no-project tools/check_rdm_traceability.py +Exit status: 0 when every production is traced, 1 otherwise, 2 when the grammar printer fails. +Standard library only. +""" + +from __future__ import annotations + +import re +import subprocess +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +PRINTER = "skills/managing-roadmaps/scripts/dirtree-rdm.sh" +TABLE = ROOT / "__design__/rdm/traceability.md" +GRAMMARS = {"leaf": "## Leaf grammar", "readme": "## README grammar"} +DISPOSITIONS = {"stored", "derived", "dropped"} + +# A production starts a line: ::= or TOKEN ::=. Comment lines start with '#'. +PRODUCTION = re.compile(r"^(<[a-z0-9-]+>|[A-Z][A-Z_]*)\s*::=") +# A table row: | `name` | disposition | target | +ROW = re.compile(r"^\|\s*`(<[a-z0-9-]+>|[A-Z][A-Z_]*)`\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*$") + + +def production_names(grammar_text: str) -> list[str]: + """Return the production names of a grammar, in order, comments excluded.""" + names = [] + for line in grammar_text.splitlines(): + if line.lstrip().startswith("#"): + continue + match = PRODUCTION.match(line) + if match: + names.append(match.group(1)) + return names + + +def table_rows(markdown: str, heading: str) -> list[tuple[str, str, str]]: + """Return (name, disposition, target) for each production row under `heading`. + + The section runs to the next line starting with `## `. The disposition has its + backticks removed. A row whose first cell is not a production name is ignored. + """ + rows: list[tuple[str, str, str]] = [] + inside = False + for line in markdown.splitlines(): + if line.startswith("## "): + inside = line.strip() == heading + continue + if not inside: + continue + match = ROW.match(line) + if match: + name, disposition, target = match.groups() + rows.append((name, disposition.strip("` "), target)) + return rows + + +def print_grammar(name: str) -> str: + """Run the grammar printer from the repository root and return its output.""" + result = subprocess.run( + ["bash", PRINTER, "grammar", name], + cwd=ROOT, + capture_output=True, + text=True, + ) + if result.returncode != 0 or not result.stdout.strip(): + sys.stderr.write(f"grammar printer failed for '{name}': {result.stderr.strip()}\n") + raise SystemExit(2) + return result.stdout + + +def main() -> int: + if not TABLE.is_file(): + print(f"FAIL: {TABLE.relative_to(ROOT)} does not exist") + return 1 + markdown = TABLE.read_text(encoding="utf-8") + problems: list[str] = [] + for grammar, heading in GRAMMARS.items(): + names = production_names(print_grammar(grammar)) + rows = table_rows(markdown, heading) + by_name: dict[str, list[tuple[str, str]]] = {} + for name, disposition, target in rows: + by_name.setdefault(name, []).append((disposition, target)) + for name in names: + entries = by_name.get(name) + if not entries: + problems.append(f"{grammar}: {name} has no row under '{heading}'") + continue + if len(entries) > 1: + problems.append(f"{grammar}: {name} has {len(entries)} rows") + disposition, target = entries[0] + if disposition not in DISPOSITIONS: + problems.append(f"{grammar}: {name} has disposition '{disposition}'") + if not target: + problems.append(f"{grammar}: {name} has an empty target or reason") + for name in by_name: + if name not in names: + problems.append(f"{grammar}: row {name} matches no production") + print(f"{grammar}: {len(names)} productions, {len(rows)} rows") + if problems: + print("FAIL") + for problem in problems: + print(" " + problem) + return 1 + print("PASS") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) From 654d011af4facfeb5dcc3e5c2342b10f38d6fbbc Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:48:29 +0900 Subject: [PATCH 021/183] docs(design): record the m0b status and schema decisions Co-Authored-By: Claude Sonnet 5.5 --- __design__/rdm/statuses.md | 160 ++++++++++++++------------------ __design__/rdm/stored-schema.md | 86 ++++++++--------- __design__/rdm/traceability.md | 6 +- 3 files changed, 110 insertions(+), 142 deletions(-) diff --git a/__design__/rdm/statuses.md b/__design__/rdm/statuses.md index c56f133..0b57d49 100644 --- a/__design__/rdm/statuses.md +++ b/__design__/rdm/statuses.md @@ -2,31 +2,31 @@ What each status of a leaf means, how it may change, and what it does to the order of work. The vocabulary and the editing rules are Eliott's decisions of 2026-11-16 (M0b README, Gotchas). Where -this document goes beyond them, or disagrees with a default, the text says `OBJECTION` and Eliott -decides. One question is `OPEN`. +this document goes beyond them, a note says who decided it: Eliott or the coordinator, both on +2026-11-16. No question is open. This document settles the meaning. The stored shape of the fields it names (`status`, -`status_reason`, `history`, `comments`) is in [stored-schema.md](stored-schema.md). R01 +`status_reason`, `history`, and the comment files) is in [stored-schema.md](stored-schema.md). R01 (`architecture.md`) is not edited here; section `R01 deltas` lists what `r01_sync` must change. ## Statuses Only a leaf has a stored status. A directory's status is derived (see `Subtrees and directories`). -| Status | Meaning | Terminal | Sealed | +| Status | Meaning | Finished | Sealed | |:--|:--|:--|:--| | `planned` | The leaf is written and not started. No step is recorded done. | no | no | | `ongoing` | Work has started on the leaf. Steps may be recorded done. | no | steps recorded done only | | `paused` | Work is held and can be resumed: a bug, a decision to wait, or a downstream branch held on purpose. | no | steps recorded done only | -| `cancelled` | The leaf is abandoned. It holds nothing back. Whatever was done stays on record. | yes | yes | -| `done` | Every step is done with its commit recorded. | yes | yes | +| `cancelled` | The leaf is abandoned. It holds nothing back while it is cancelled. Whatever was done stays on record. A mistaken cancel can be undone (`cancelled → planned`). | yes | yes, while cancelled | +| `done` | Every step is done with its commit recorded. The only terminal status. | yes | yes, for good | `blocked` and `amendment` are not statuses. A "blocked" situation is `paused` (resumable) or `cancelled` (abandoned). An "amendment" is an edit recorded in the amendment log, and a node added by one starts as `planned`. -A non-terminal leaf (`planned`, `ongoing`, `paused`) holds back deeper leaves. A terminal leaf -(`done`, `cancelled`) holds back nothing. +An unfinished leaf (`planned`, `ongoing`, `paused`) holds back deeper leaves. A finished leaf +(`done`, `cancelled`) holds back nothing. Only `done` is terminal. ## Transitions @@ -47,16 +47,16 @@ status is `paused` or `cancelled`). "Ready set" says what the move does to the s | `ongoing` | `paused` | allowed | both | required | none | none | | `ongoing` | `cancelled` | allowed | both | required | none. Steps already done stay sealed and recorded | RELEASE | | `ongoing` | `done` | allowed | both | none | Every step is done with its commit recorded (I8). Gate marks are not checked, see `Sealing` | RELEASE | -| `paused` | `planned` | allowed | both | required | No step is recorded done (OBJECTION 1: not in the default) | ENTER if nothing shallower holds it back | +| `paused` | `planned` | allowed | both | required | No step is recorded done (coordinator, 2026-11-16) | ENTER if nothing shallower holds it back | | `paused` | `ongoing` | allowed | both | required | The leaf was `ongoing` before the pause (last pause entry has `from: ongoing`), or it is in the ready set. Otherwise an override with a reason | none | | `paused` | `paused` | refused | | | No-op | none | | `paused` | `cancelled` | allowed | both | required | none | RELEASE | | `paused` | `done` | refused | | | Resume to `ongoing` first | none | -| `cancelled` | `planned` | refused | | | Terminal (OBJECTION 2) | none | -| `cancelled` | `ongoing` | refused | | | Terminal | none | -| `cancelled` | `paused` | refused | | | Terminal | none | +| `cancelled` | `planned` | allowed | both | required | No step is recorded done. Undoes a mistaken cancel, for one leaf or for a directory cancel through its `op_id`. Eliott, 2026-11-16 | ENTER if nothing shallower holds it back | +| `cancelled` | `ongoing` | refused | | | Only `planned` leaves `cancelled` | none | +| `cancelled` | `paused` | refused | | | Only `planned` leaves `cancelled` | none | | `cancelled` | `cancelled` | refused | | | No-op | none | -| `cancelled` | `done` | refused | | | Terminal | none | +| `cancelled` | `done` | refused | | | Only `planned` leaves `cancelled` | none | | `done` | `planned` | refused | | | Terminal: nothing reopens done work, new work is a new node | none | | `done` | `ongoing` | refused | | | Terminal | none | | `done` | `paused` | refused | | | Terminal | none | @@ -68,20 +68,22 @@ Rules that hold for every row: - No move is human-only. `history[].actor` records who made it. - A move presents the status it expects to leave. A mismatch is refused (R01 §Concurrency). - A move writes one history entry and never an amendment (I5). -- A move into `done` or `cancelled` may carry the final `progress` in the same operation. After it, only comments are accepted. -- The reason is required text, not blank, for `paused`, `cancelled`, `paused → planned` and `paused → ongoing`. +- A move into `done` or `cancelled` may carry the final `progress` in the same operation. After it, only comments are accepted, and from `cancelled` only the move to `planned`. +- The reason is required text, not blank, for `paused`, `cancelled`, `paused → planned`, `paused → ongoing` and `cancelled → planned`. -**OBJECTION 1: `paused → planned` needs "no step is recorded done".** The default allows the move -with a reason. A step recorded done is sealed with its commit, so a `planned` leaf holding a -recorded commit would contradict "not started". Default kept as stated, with this one added -precondition. Without it, the leaf must go to `ongoing` instead. +**`paused → planned` needs "no step is recorded done".** A step recorded done is sealed with its +commit, so a `planned` leaf holding a recorded commit would contradict "not started". The same +precondition holds for `cancelled → planned`. A leaf with a recorded step goes to `ongoing` +instead. Decided 2026-11-16 (coordinator). -**OBJECTION 2: `cancelled` as terminal is a trap for a mistaken cancel.** The default makes -`cancelled` terminal, like `done`. But `done` is protected by a verified commit, while a cancel is -one call with a reason, and a directory cancel (below) is one call over many leaves. A wrong one -cannot be undone except by writing the leaves again as new nodes. Two cheaper options, neither -taken: a `human`-only `cancelled → planned` with a reason, allowed while no content was changed; -or `human`-only for the directory cancel. Default kept: terminal, both actors. +**`cancelled` is undoable.** A cancel is one call with a reason, and a directory cancel is one +call over many leaves, so a mistake must be reversible. `cancelled → planned` is allowed with a +required reason, recorded in history. Done work stays sealed: nothing leaves `done`. Decided +2026-11-16 (Eliott). + +**Not covered: a cancelled leaf with a recorded step.** It cannot return to `planned`, and no +move leads from `cancelled` to `paused` or `ongoing`. If Eliott wants those leaves undoable too, +`cancelled → paused` is the smallest addition. **Note: a cancel releases work without saying so.** Because `cancelled` holds nothing back, a cancelled leaf can release a deeper leaf that really needed it. That is Eliott's intent. The @@ -91,24 +93,28 @@ silent. ## Ready set A leaf is ready when it is `planned` and every leaf that holds it back is `done` or `cancelled`. -So `cancelled` holds nothing back. +So `cancelled` holds nothing back while it is cancelled. Undoing a cancel makes the leaf `planned` +and it holds back again; deeper leaves that already started are not stopped. -The depth of a leaf is the number of directories between the campaign root and the leaf. A leaf -directly under the campaign root has depth 0. The rule for which leaves hold a given leaf back -has two readings. It is `OPEN`. +**The rule (scoped, the legacy rule; Eliott, 2026-11-16).** An unfinished leaf holds back only +the deeper leaves under its own parent. Precisely: leaf L is held back by every unfinished leaf +that is a leaf child of the parent of A, for A = L's own directory and each ancestor directory of +L below the campaign root. Leaves in an unrelated branch never hold L back, and sibling leaves are +parallel. -| Reading | Leaves that hold leaf L back | -|:--|:--| -| A. Global (R01) | Every leaf of smaller depth, anywhere in the campaign | -| B. Scoped (legacy, `graph-model.md`) | Every leaf of smaller depth that is a leaf child of the parent of L or of any ancestor directory of L | +Equivalently: a leaf directly under directory P holds back every leaf found in the directories +under P, at any depth, and nothing else. A leaf directly under the campaign root holds back every +leaf in the campaign's directories. -Under B, a leaf also waits for the leaf children that sit above its own directory, and so on up -to the campaign root. Leaves in an unrelated branch never hold it back. +The same rule applies to `planned`, `ongoing` and `paused`: a `paused` leaf holds back exactly what +a `planned` or `ongoing` one does. To hold a branch on purpose, pause its directory. -Both readings use the same rule for the three non-terminal statuses: a `paused` leaf holds back -exactly what a `planned` or `ongoing` one does. The choice is about the ready rule as a whole, not -about `paused` alone. The status is not special: Eliott asked whether a halted upper leaf must -block everything downstream, and that is the same question for any leaf that is not finished. +Worked on `__roadmap__/roadmap-mcp-rework/`, a chain: M5 sits in `consumers/`, so pausing it holds +back M6, M7 and M8 in `consumers/delivery/` and below. A global rule would give the same set +there. The two differ with a second branch. Hypothetical: a directory `docs/guide/` at the +campaign root, with a leaf at depth 2, next to `core/`. Pausing M1 (parent `core/`) holds back M2 +to M8, which sit under `core/`, and does not hold back the docs leaf. The global rule (R01's) +would have. An `ongoing` leaf is not in the ready set, because it is not `planned`. A leaf started by an override (`planned → ongoing` outside the set) is recorded and allowed. @@ -119,10 +125,11 @@ override (`planned → ongoing` outside the set) is recorded and allowed. - `pause` sets every `planned` and `ongoing` leaf under the directory to `paused`. - `cancel` sets every `planned`, `ongoing` and `paused` leaf under it to `cancelled`. -- Leaves already terminal are left alone. A leaf where the move is refused is skipped, never an error for the whole operation. +- Leaves already finished are left alone. A leaf where the move is refused is skipped, never an error for the whole operation. - One reason, one timestamp and one `op_id` are shared by every history entry the operation writes. The operation is one call and one transaction, so it is "recorded once". - It is a snapshot, not a standing flag. A leaf added to the directory later starts `planned`. - `resume` of a directory sets each `paused` leaf under it to the `from` of its last pause entry (`planned` or `ongoing`). A leaf whose last pause came from another operation is resumed too, each by its own rule. The reason is required. +- `uncancel` of a directory sets to `planned` every `cancelled` leaf whose last history entry carries the `op_id` of the cancel being undone, with one reason and one new `op_id`. A leaf that holds a recorded step is skipped and reported. Leaves cancelled by another operation are left alone. **A directory's status is derived on every read and never stored (I6).** It is computed from all leaves under it, at any depth. The first matching row wins. @@ -131,7 +138,7 @@ leaves under it, at any depth. The first matching row wins. |:--|:--|:--| | 1 | none | `planned` | | 2 | all `cancelled` | `cancelled` | -| 3 | all terminal, at least one `done` | `done` | +| 3 | all finished, at least one `done` | `done` | | 4 | at least one `ongoing` | `ongoing` | | 5 | at least one `paused` | `paused` | | 6 | at least one `done`, the others `planned` or `cancelled` | `ongoing` | @@ -143,26 +150,27 @@ reader that must tell them apart uses the counts per status, which the read mode ## Sealing A node is sealed when its content can no longer change. A sealed node accepts one change: an -append-only comment (`comments[]`). +append-only comment (a file `_comments/.json` whose `node_id` names the node). | Status | Content edit | Comment | Status move | Progress | |:--|:--|:--|:--|:--| | `planned` | allowed, amendment note required | allowed | per `Transitions` | allowed | | `ongoing` | allowed except sealed steps, amendment note required | allowed | per `Transitions` | allowed | | `paused` | allowed except sealed steps, amendment note required | allowed | per `Transitions` | allowed | -| `cancelled` | refused | allowed | refused | refused | +| `cancelled` | refused | allowed | only `→ planned` | refused | | `done` | refused | allowed | refused | refused | -- **Content** is every stored field except `status`, `status_reason`, `history`, `progress`, `comments` and the state marks. The state marks are a criterion's `met`, and a step's `done`, `commit_sha` and `done_at`. +- **Content** is every stored field except `status`, `status_reason`, `history`, `progress` and the state marks. The state marks are a criterion's `met`, and a step's `done`, `commit_sha` and `done_at`. - **The amendment rule is uniform.** Any content edit to a `planned`, `ongoing` or `paused` node carries the amendment note, whatever the status. The stricter rule applies everywhere, as Eliott decided. -- **Status moves, progress, comments and state marks never produce an amendment (I5).** Setting `met` is a state change like a move, allowed until the leaf is terminal. +- **Status moves, progress, comments and state marks never produce an amendment (I5).** Setting `met` is a state change like a move, allowed until the leaf is `done` or `cancelled`. - **A step recorded done inside an `ongoing` or `paused` leaf is sealed.** Its commit is on record, so its content (goal, logic, deliverables, checks, commit, references) cannot change and its `done` mark cannot be cleared. The other steps and the leaf's own fields stay editable. A sealed step cannot be removed or reordered. - **Directories follow their derived status.** A directory (or the campaign root) whose derived status is `done` or `cancelled` is sealed: its own content (title, context, goal, criteria, references, gotchas, notes) cannot change, and it accepts comments. Adding or removing a child is a structure edit of the child, not a content edit of the directory, so it stays allowed with an amendment. A directory in any other derived status takes edits with an amendment note. Weak point: a new `planned` child moves the derived status off `done`, which unseals the directory. The amendment log still records both edits. +- **A cancelled node stays sealed while it is cancelled.** Undoing the cancel (`→ planned`) unseals it. A `done` node never unseals. - **Nothing reopens done work.** A new piece of work is a new node. There is no `done → ongoing`. - **Gate marks do not gate `done`.** Real campaigns leave open (`⬜`) gates on most done leaves: 30 of 48 done leaves under `__roadmap__/` carry at least one. So the only precondition of `done` is I8, as in R01. Criteria `met` is information, not a check. - **Structure edits on sealed nodes.** Deleting a `done` or `cancelled` leaf keeps its acknowledgement (I9) and its snapshot in the amendment. Moving a sealed leaf changes no content. Whether a move that changes the ready set of other leaves needs the acknowledgement is left to M2's impact analysis. -**Risk: a wrong step record is permanent.** A mistyped `commit_sha` on a sealed step cannot be +**Recorded objection (coordinator kept the default): a wrong step record is permanent.** A mistyped `commit_sha` on a sealed step cannot be corrected. The remedy today is a comment on the leaf. If this bites, a human-only correction with an amendment is the least invasive fix. Not decided here, since it weakens the seal. @@ -187,58 +195,28 @@ For `r01_sync`. R01 is not edited by this leaf. | R01 location | Change | |:--|:--| -| §Graph operations, Status FSM diagram | Replace with the five-status machine of `Transitions`: `planned → ongoing, paused, cancelled`; `ongoing → paused, cancelled, done`; `paused → planned, ongoing, cancelled`. Remove `blocked`, `amendment` and the `done → amendment` edge | -| §Graph operations, Order | "not done" becomes "`planned`"; "every leaf of smaller depth is done" becomes "`done` or `cancelled`". The sentence "Wave semantics are global" stands or changes with Eliott's answer in `Open for Eliott` | +| §Graph operations, Status FSM diagram | Replace with the five-status machine of `Transitions`: `planned → ongoing, paused, cancelled`; `ongoing → paused, cancelled, done`; `paused → planned, ongoing, cancelled`; `cancelled → planned`. Remove `blocked`, `amendment` and the `done → amendment` edge | +| §Graph operations, Order | "not done" becomes "`planned`"; "every leaf of smaller depth is done" becomes "`done` or `cancelled`". The ready rule becomes the scoped rule of `Ready set`. The sentence "Wave semantics are global: a leaf also waits for shallower leaves in unrelated branches" is replaced: a leaf waits only for shallower leaves under its own ancestors' parents. "Waves" stay a display of depth (`level`), not a readiness fact | | §Graph operations, after the FSM | "Starting a leaf outside the ready set is refused unless an override with a reason is given" stays. Add the directory pause and cancel operation and the derivation table | | §Graph operations, Impact analysis | Remove "done work reopened". Add "leaves made ready by a cancel" | -| §Contracts, I5 | Add: comments and state marks never produce an amendment. A sealed node accepts no content edit | +| §Contracts, I5 | Add: comments (separate append-only files) and state marks never produce an amendment. A sealed node accepts no content edit | | §Contracts, I8 | Unchanged. Add: it is the only precondition of `done` | | §Contracts, I9 | "Deleting or reopening done work, or moving work in progress, needs an explicit acknowledgement" becomes "Deleting sealed work, or moving work in progress, needs an explicit acknowledgement. Nothing reopens done work". Reopening is replaced by sealing | -| §Data Model, schema sketch | `blocked_reason?` becomes `status_reason?`; history `note?` becomes `reason?`; add `comments[]` (details in stored-schema.md) | +| §Data Model, schema sketch | `blocked_reason?` becomes `status_reason?`; history `note?` becomes `reason?`; comments are not a node field: they are files `_comments/.json` (details in stored-schema.md), so the §Data Model tree gains `_comments/` | | §Concurrency, last bullet | "records `inprogress`" becomes "records `ongoing`" | +| §Graph operations, after the FSM | Add a directory `uncancel` through the `op_id` of the cancel | | §Key Flows, Execute | `inprogress` becomes `ongoing` | | §Alternatives Considered, Mutation policy | "full CRUD with guards on done work" is now "full CRUD, with done and cancelled nodes sealed" | -## Open for Eliott - -### OPEN: how far does a held leaf hold back deeper leaves? - -Whether a leaf that is not finished (`paused`, and equally `planned` or `ongoing`) holds back every -deeper leaf in the campaign (A, R01's rule) or only those that sit under its own parent (B, the -legacy rule). See `Ready set` for the exact rule. - -**What the real meta-roadmap shows.** `__roadmap__/roadmap-mcp-rework/` is a chain, not a tree: - -| Depth | Leaves | -|:--|:--| -| 0 | M0, M0b | -| 1 | M1 (`core/`) | -| 2 | M2 (`core/engine/`) | -| 3 | M3 (`core/engine/interchange/`) | -| 4 | M4, M5 (`.../consumers/`) | -| 5 | M6, M7 (`.../consumers/delivery/`) | -| 6 | M8 (`.../delivery/cutover/`) | - -Every deeper leaf sits under the parent of every shallower one, so A and B agree on every leaf -today. The readings only differ once a directory has a second branch. Example, per reading: - -- **A. Global.** M5 is paused for a bug. M6, M7 and M8 are all held back. M6 needs only M4 (the meta-roadmap Gotcha: "M6 needs only M4 but also waits on M5"), yet it waits. -- **B. Scoped.** M5 is paused. Its parent is `consumers/`, so the leaves held back are those in `consumers/delivery/` and `consumers/delivery/cutover/`: M6, M7, M8. Same set as A here. The difference needs a hypothetical branch. Add a directory `docs/guide/` at the campaign root with a leaf at depth 2, next to `core/`. Pause M1 (depth 1, parent `core/`). Under A the docs leaf waits for M1. Under B it does not, because it is not under `core/`. - -**Recommendation: B.** - -- It is what the legacy skill did, so the imported campaigns keep the readiness they had. Under A, independent branches become sequenced on import. -- It answers Eliott's remark that a halted upper leaf need not block everything downstream, without a new status or an edge field. To hold a branch on purpose, pause the directory. -- It removes the M6-after-M5 over-sequencing at no cost to the "depth is the only ordering rule" decision. -- It costs a more careful ready computation (ancestors, not a global depth index) and the "wave" of the view becomes a display of `level`, not a readiness fact. R01's sentence "Wave semantics are global" changes, and I1 stays true. +## Decisions -A mixed reading (global for `planned` and `ongoing`, scoped for `paused` only) is possible and -rejected here: it gives two ordering rules for one tree. +Nothing is open. Who decided what: -### Objections raised against the defaults - -| # | Default | Objection | Taken | -|:--|:--|:--|:--| -| 1 | `paused → planned` allowed with a reason | Add: no step recorded done, or `planned` contradicts a sealed commit | Added to `Transitions` | -| 2 | `cancelled` terminal | A mistaken cancel, above all a directory cancel, cannot be undone. Options in the objection text | Default kept, Eliott decides | -| 3 | A step recorded done is sealed (recommended: yes) | A mistyped commit record is permanent | Default kept, risk noted in `Sealing` | +| # | Decision | Decided | +|:--|:--|:--| +| 1 | Ready rule: an unfinished leaf holds back only the deeper leaves under its own parent (legacy rule). Applies to `planned`, `ongoing` and `paused` alike | Eliott, 2026-11-16 | +| 2 | Comments are one file each, `_comments/.json`, append-only | Eliott, 2026-11-16 | +| 3 | `cancelled → planned` allowed with a required reason; `done` stays terminal and sealed | Eliott, 2026-11-16 | +| 4 | `paused → planned` and `cancelled → planned` need no step recorded done | coordinator, 2026-11-16 | +| 5 | A step recorded done is sealed, so a mistyped `commit_sha` is permanent. Recorded objection: a human-only correction with an amendment would be the least invasive fix | default kept, coordinator, 2026-11-16 | +| 6 | Not covered: undoing the cancel of a leaf that holds a recorded step | for Eliott, if he wants it | diff --git a/__design__/rdm/stored-schema.md b/__design__/rdm/stored-schema.md index 4dcc112..12f39ff 100644 --- a/__design__/rdm/stored-schema.md +++ b/__design__/rdm/stored-schema.md @@ -6,9 +6,9 @@ grammars it must cover are traced production by production in [traceability.md]( Status meanings are in [statuses.md](statuses.md). The read model that consumers receive is a separate document (`read-model.md`). -Where a default of the M0b plan is defective, the text gives the default as the field table says -it, and then an `OBJECTION` with the alternative. The `rdm-schema` crate builds the default unless -Eliott accepts the objection. Fields new against R01 are marked **new**. +Where this document departs from a default of the M0b plan, a one-line note says who decided it +(Eliott or the coordinator, 2026-11-16). Two recorded objections stand, with the default kept. +Fields new against R01 are marked **new**. Notation: @@ -30,6 +30,7 @@ __roadmap__// .json leaf node (Leaf) /_dir.json directory node (Directory, kind: directory) /.json + _comments/.json one file per comment (Comment) .rdm/ untracked scratch: lock, journal/, staging/ ``` @@ -40,7 +41,7 @@ __roadmap__// | Version stamp | Every file carries `schema_version` (see `Format version`) | | Unknown fields | Every object type below keeps the keys it does not know, in order, and writes them back after the known ones. This holds for nested objects too (steps, criteria, references, commits, history and comment entries, changes). It is the stored half of I12 | | Canonical order | The order of the rows in each field table is the canonical field order. Two-space indent, LF, trailing newline. M1 owns the serialiser | -| Derived, never stored (I6) | Directory status, the nodes table, the mermaid graph, the progress table, waves, the ready set, a step's number if OBJECTION 1 is accepted, the display id of an amendment, a leaf's commit count when the engine recorded the steps | +| Derived, never stored (I6) | Directory status, the nodes table, the mermaid graph, the progress table, waves, the ready set, a step's number, the display id of an amendment, a leaf's commit count when the engine recorded the steps | ## Directory @@ -60,7 +61,6 @@ is derived (`statuses.md`, `Subtrees and directories`). | `success_gates` | `Criterion[]` | yes | Completion criteria, one or more | | `gotchas` | `lines` | yes | Legacy `## Gotchas`, verbatim markdown lines. May be empty (the section is optional) | | `notes` | `lines` | yes | **new**: the `Notes` cell of the directory's own row in its parent's Progress table. May be empty | -| `comments` | `Comment[]` | yes | **new**: append-only comments. May be empty | Rules for `validate`: `goal` has no line break; `preconditions` and `success_gates` each have at least one entry; `kind` is `campaign` exactly when the file is at the campaign root. @@ -88,7 +88,6 @@ the branch of one of its leaves and a count of commits; both are dropped (see `t | `steps` | `Step[]` | yes | One to five steps, in order | | `progress` | `Progress` | yes | Where the work happened | | `history` | `History[]` | yes | Status moves, oldest first. Empty on a new leaf, and on a leaf imported from legacy markdown | -| `comments` | `Comment[]` | yes | **new**: append-only comments | `Progress` is an object, not a separate type section: @@ -100,9 +99,9 @@ the branch of one of its leaves and a count of commits; both are dropped (see `t Rules for `validate`: -- `steps` has one to five entries, and entry *i* has `number == i + 1`. +- `steps` has one to five entries. A step's number is its position plus one, so no rule can break it. - `goal` has no line break. -- `references` has at least one entry (the legacy grammar requires a non-empty `**References**` line). OBJECTION 6. +- `references` has at least one entry (the legacy grammar requires a non-empty `**References**` line). An empty array is a warning, not an error. Decided 2026-11-16 (coordinator). - `status == planned` implies every step has `done: false`. - `status == done` implies every step has `done: true`. - `status_reason` is present exactly when `status` is `paused` or `cancelled`, and equals the `reason` of the last `history` entry when `history` is not empty. @@ -114,13 +113,13 @@ An element of `Leaf.steps`. | Field | Type | Req | Meaning | |:--|:--|:--:|:--| -| `number` | `integer` | yes | 1 to 5, sequential from 1. OBJECTION 1 | +| `id` | `string` | yes | **new** (R01 had it): immutable step id, minted like node ids. Anything that points into a step uses it | | `title` | `string` | yes | The text after `## Step N:` | | `goal` | `string` | yes | One line: the unique change intent of the step | | `implementation_logic` | `lines` | yes | Free prose and lists, blank lines allowed. At least one line is not blank | | `deliverables` | `lines` | yes | Legacy: one line. Import stores it as one element, unsplit. A new step may hold several elements, one per deliverable. M3's export joins them with `; ` | | `references` | `Reference[]` | yes | Step-level documents. May be empty (optional in the legacy grammar) | -| `checks` | `Check[]` | yes | One or more. The legacy grammar has exactly one per step, so import yields one. OBJECTION 2 | +| `checks` | `Check[]` | yes | One or more. The legacy grammar has exactly one per step, so import yields one | | `commit` | `Commit` | yes | The commit message the step must produce | | `requires` | `lines?` | no | Prose prerequisites that are not obvious. **Never an id or an edge**: I1 forbids a stored dependency between siblings. Never used in real campaigns, kept so the grammar's field has a home | | `done` | `bool` | yes | The step is recorded done. A step recorded done is sealed (`statuses.md`, `Sealing`) | @@ -135,20 +134,17 @@ An element of `Leaf.steps`. | `expected` | `"PASS"` or `"FAIL"` | yes | The outcome the check expects | | `command` | `string?` | no | A shell command, when the whole check is one runnable command. Set only by the author of a new check, never guessed by the importer | -**OBJECTION 1: store a step `id`, derive `number`.** The default stores `number`. A number stored -beside the array position can disagree with it, which is the problem R01 avoided for names by -making the name the path. R01's composite "reorder steps" would have to renumber, and comments or -amendment `changes` that point into a step by number would then point at another step. R01's -sketch had a step `id`, and the plan's list drops it. Alternative: keep an immutable step `id` -(minted like node ids), derive `number` from position, and let `Leaf.steps` order be the only -order. Then the validator rule "numbered in sequence" cannot be violated. If accepted, the field -`number` leaves the table, `id` joins it, and in `traceability.md` the `` row reads `title` as stored and the number as derived. +**A step has an `id`, and its number is derived.** The number is the step's position plus one, 1 +to 5, never stored. A stored number could disagree with the array position, and R01's composite +"reorder steps" would have to renumber it, so references into a step by number would point at +another step. The export writes the number from the position. In `traceability.md` the +`` row stores `title` and derives the number. Decided 2026-11-16 (coordinator). -**OBJECTION 2: a check is prose, not `{command, expected}`.** The plan's default makes `command` +**A check is prose, not `{command, expected}`.** The plan's default made `command` required. The legacy check is a prose line that ends in `(expected: PASS)` or `(expected: FAIL)`. Real checks are commands in backticks, several commands joined by `;`, shell loops, or a -sentence. No parser extracts a `command` from all of them without loss or invention. Decision -recorded: `text` is required and lossless, `expected` is parsed from the trailer (the one part +sentence. No parser extracts a `command` from all of them without loss or invention. Decided +2026-11-16 (coordinator): `text` is required and lossless, `expected` is parsed from the trailer (the one part the grammar fixes), and `command` is optional and filled only by an author. Export (M3) writes `text`, a space, and `(expected: X)`. An agent that wants to run a check uses `command` when it exists and reads `text` otherwise. @@ -222,8 +218,8 @@ An element of `Leaf.history`: one status move. Written by `transition`; never an | `ts` | `ts` | yes | When the move was made | | `from` | status | yes | The status left | | `to` | status | yes | The status entered | -| `actor` | `Actor` | yes | Who made it. OBJECTION 3 | -| `reason` | `string?` | no | Required for moves into `paused` and `cancelled`, and for `paused → planned` and `paused → ongoing` (`statuses.md`) | +| `actor` | `Actor` | yes | Who made it | +| `reason` | `string?` | no | Required for moves into `paused` and `cancelled`, and for `paused → planned`, `paused → ongoing` and `cancelled → planned` (`statuses.md`) | | `override` | `bool?` | no | `true` when the leaf was started outside the ready set | | `op_id` | `string?` | no | **new**: shared by every entry that one operation writes, so a directory pause or cancel is recognisable as one operation | @@ -234,32 +230,31 @@ An element of `Leaf.history`: one status move. Written by `transition`; never an | `kind` | `"agent"`, `"human"` or `"import"` | yes | The actor kind that `statuses.md` names in its `Who` column | | `name` | `string?` | no | Free identifier: a user, an agent session, a tool | -**OBJECTION 3: `actor` is an object, not a string.** The plan's list gives `actor` with no type, +**`actor` is an object, not a string.** The plan's list gave `actor` with no type, and R01 gives none. `statuses.md` states who may set each move, `agent`, `human` or `both`. A bare string cannot be checked against that. `kind` is the part a rule can test, and `name` is the -part a person reads. If a plain string is wanted, the kind must then be a separate field. +part a person reads. Decided 2026-11-16 (coordinator). ## Comment -An element of `comments` on a leaf or a directory. Append-only. The one change a sealed node -accepts. Never an amendment. +`_comments/.json`, at the campaign root. One file per comment, append-only, like an +amendment. A comment on a leaf, a directory or the campaign root. The one change a sealed node +accepts. Never an amendment. A node's comments are the set of comment files whose `node_id` names +it, so a comment never changes the node's `rev`. Decided 2026-11-16 (Eliott): this replaces a +`comments[]` array in the node file, which two branches would both append to, and conflict. | Field | Type | Req | Meaning | |:--|:--|:--:|:--| +| `schema_version` | `string` | yes | Format version | +| `id` | `ulid` | yes | Identity and order | +| `node_id` | `string` | yes | The node commented on | | `ts` | `ts` | yes | When it was added | | `actor` | `Actor` | yes | Who added it | | `text` | `lines` | yes | The comment, one or more lines (it is prose, so it follows the lines rule) | +| `op_id` | `string?` | no | The retry key of the write that made it | -Entries are never edited or removed. A correction is a new comment. - -**OBJECTION 4: comments in the node file will conflict across branches.** R01 chose one file per -leaf so task branches never touch the same file. A comment on a done leaf, added on two branches, -appends at the end of one array on both sides and git reports a conflict. `history` has the same -property, but only the branch that works a leaf writes it. Comments are written by anyone, on -finished nodes. Alternative: one file per comment, `_comments/.json` at the campaign root, -as for amendments, with `node_id` in the entry. A node's comments are then a query, and a comment -never changes the node's `rev`. The default stays in the field tables; M1 should weigh the -alternative before the store fixes the layout. +Files are never edited or removed. A correction is a new comment. Deleting a node does not delete +its comments; the removing amendment's `snapshot` keeps them with it. ## Amendment @@ -320,15 +315,15 @@ the nodes; the amendment is stored once, at the campaign root, and `changes` nam | Area | R01 sketch | This schema | |:--|:--|:--| | Criteria | `preconditions[]`, `success_gates[]` as plain text | `Criterion {text, met}`, at leaf and directory level | -| Step | `{id, goal, implementation_logic, deliverables[], checks[], commit, references[], requires[], done, commit_sha?}` | adds `number`, `title`, `done_at?`; `implementation_logic` and `deliverables` are `lines`; `requires` is optional prose; `id` is dropped, see OBJECTION 1 | -| Check | `{command, expected}` | `{text, expected, command?}`, OBJECTION 2 | +| Step | `{id, goal, implementation_logic, deliverables[], checks[], commit, references[], requires[], done, commit_sha?}` | adds `title`, `done_at?`; `implementation_logic` and `deliverables` are `lines`; `requires` is optional prose; `id` is kept and the number is derived | +| Check | `{command, expected}` | `{text, expected, command?}` | | Commit | `{type, scope, summary}` | `{type, scope?, breaking, summary}` | | Reference | `references[]`, no shape | `{label?, title, target?, note?}` | | Status | `blocked_reason?` | `status_reason?`; vocabulary per `statuses.md` | | History | `{ts, from, to, actor, note?, override?}` | `note` is `reason`; adds `op_id?`; `actor` is an object | -| Comments | none | `comments[]` on leaves and directories | +| Comments | none | one file each, `_comments/.json`, naming the node | | Amendment | `{… id, …}` | adds `legacy_id?`; the id is a ULID with a derived display id | -| Directory | no notes | adds `notes` and `comments` | +| Directory | no notes | adds `notes` | | Progress | `{branch?, notes}` | adds `commits?` (import only); `notes` is `lines` | | Gotchas, context | strings or lines unstated | `lines` | | Unknown fields | I12 stated | Every type keeps them, nested ones too | @@ -342,13 +337,8 @@ rule is "`done` leaf has every step `done`". The import records the legacy count `progress.commits`. `r01_sync` rewrites I8 to say so. This was not in `statuses.md`, whose `R01 deltas` row for I8 says "unchanged"; this document supersedes that row. -**OBJECTION 5: `status_reason` is a copy of the last history reason.** It is derived data stored +**Recorded objection (coordinator kept the default): `status_reason` is a copy of the last history reason.** It is derived data stored beside its source, which I6 forbids. The default keeps it because an imported `blocked → cancelled` leaf has no history entry to hold the reason. Alternative: the importer writes one `history` entry with `actor.kind: "import"` and `status_reason` is derived. Default kept, with the consistency -rule in `Leaf`. - -**OBJECTION 6: a leaf's `references` need not be non-empty.** The legacy grammar demands a -non-empty `**References**` line, and this document carries that as a `validate` rule. A leaf that -has nothing to cite then has to invent a reference. A warning, not an error, would be kinder. -Left to M2's diagnostics, which assign severities. +rule in `Leaf`. Decided 2026-11-16 (coordinator). diff --git a/__design__/rdm/traceability.md b/__design__/rdm/traceability.md index 5227654..af96c7b 100644 --- a/__design__/rdm/traceability.md +++ b/__design__/rdm/traceability.md @@ -36,13 +36,13 @@ that the export (M3) re-creates the text from stored fields. | `` | `stored` | `preconditions[].text` and `.met`; `[x]` is `true`, `[ ]` is `false` | | `` | `stored` | `success_gates[].text` and `.met`; the check mark is `true`, the empty box is `false` | | `` | `stored` | One element of `steps[]` | -| `` | `stored` | `steps[].title` is the text after the colon; `steps[].number` is the digit (derived if OBJECTION 1 is accepted) | +| `` | `stored` | `steps[].title` is the text after the colon; the digit is dropped: the step number is derived from position | | `` | `stored` | One of the step fields below | | `` | `stored` | `steps[].goal` | | `` | `stored` | `steps[].implementation_logic`, the body lines with blank lines kept. The header line and trailing blank lines are presentation | | `` | `stored` | `steps[].references[]` | | `` | `stored` | `steps[].deliverables`, one element, not split | -| `` | `stored` | `steps[].checks[].text` and `.expected`. The trailer `(expected: X)` becomes `expected`. `command` is not extracted: the check is prose (OBJECTION 2) | +| `` | `stored` | `steps[].checks[].text` and `.expected`. The trailer `(expected: X)` becomes `expected`. `command` is not extracted: the check is prose | | `` | `stored` | `steps[].commit.type`, `.scope`, `.breaking`, `.summary`. The backticks are presentation and are dropped | | `` | `stored` | `steps[].requires`, prose lines | | `` | `stored` | `title` | @@ -54,7 +54,7 @@ Constraints the grammar states outside its productions, and where each one goes: | Constraint | Home | |:--|:--| | Step count is 1 to 5 | `validate` rule on `Leaf.steps` | -| Step numbers are sequential from 1 | `validate` rule on `steps[].number` (derived, if OBJECTION 1 is accepted) | +| Step numbers are sequential from 1 | Derived: a step's number is its position, so the rule cannot break | | At least one implementation line is not blank | `validate` rule on `Step.implementation_logic` | | All four header fields and the five required step fields are present | Required fields of `Leaf` and `Step` | | Header and step field order is free | Dropped: the canonical order is the field table's | From eee3c41295f247725db7ec72f970b70d90cf6c85 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:48:50 +0900 Subject: [PATCH 022/183] chore(roadmap): close the m0b specification level and start the read model Co-Authored-By: Claude Opus 5.5 --- __roadmap__/m0b-domain-model-spec/README.md | 12 ++++++------ __roadmap__/m0b-domain-model-spec/read/README.md | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/__roadmap__/m0b-domain-model-spec/README.md b/__roadmap__/m0b-domain-model-spec/README.md index 71189a0..2b8cf79 100644 --- a/__roadmap__/m0b-domain-model-spec/README.md +++ b/__roadmap__/m0b-domain-model-spec/README.md @@ -48,9 +48,9 @@ The status meanings, the stored schema with its traceability table, and the read ## Status ```mermaid graph TD - status_semantics[Status semantics]:::inprogress - stored_schema[Stored schema]:::inprogress - read[Read model]:::planned + status_semantics[Status semantics]:::done + stored_schema[Stored schema]:::done + read[Read model]:::inprogress classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -61,9 +61,9 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `status_semantics.md` | 📄 Leaf Task | 🔄 In Progress | -| `stored_schema.md` | 📄 Leaf Task | 🔄 In Progress | -| `read/` | 📁 Directory | ⬜ Planned | +| `status_semantics.md` | 📄 Leaf Task | ✅ Done | +| `stored_schema.md` | 📄 Leaf Task | ✅ Done | +| `read/` | 📁 Directory | 🔄 In Progress | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m0b-domain-model-spec/read/README.md b/__roadmap__/m0b-domain-model-spec/read/README.md index ea7a4d4..5420413 100644 --- a/__roadmap__/m0b-domain-model-spec/read/README.md +++ b/__roadmap__/m0b-domain-model-spec/read/README.md @@ -18,7 +18,7 @@ The read model's projections are specified with worked examples, and the crate a ## Status ```mermaid graph TD - read_model[Read model]:::planned + read_model[Read model]:::inprogress crate[Schema crate and R01]:::planned classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a @@ -30,7 +30,7 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `read_model.md` | 📄 Leaf Task | ⬜ Planned | +| `read_model.md` | 📄 Leaf Task | 🔄 In Progress | | `crate/` | 📁 Directory | ⬜ Planned | ## Amendment Log From f1a2bbb5daad60582e8ee30586743bfbd2bec917 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:49:15 +0900 Subject: [PATCH 023/183] feat(rdm-mcp): add host diagnostics to the spike view Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-mcp/view/dev/mock-host.html | 17 +++++- crates/rdm-mcp/view/dist/index.html | 29 ++++----- crates/rdm-mcp/view/src/App.svelte | 30 ++++++++-- crates/rdm-mcp/view/src/Diagnostics.svelte | 69 ++++++++++++++++++++++ crates/rdm-mcp/view/src/bridge.ts | 33 ++++++++++- crates/rdm-mcp/view/src/probe.ts | 12 ++-- 6 files changed, 163 insertions(+), 27 deletions(-) create mode 100644 crates/rdm-mcp/view/src/Diagnostics.svelte diff --git a/crates/rdm-mcp/view/dev/mock-host.html b/crates/rdm-mcp/view/dev/mock-host.html index 6638c96..abbbfbe 100644 --- a/crates/rdm-mcp/view/dev/mock-host.html +++ b/crates/rdm-mcp/view/dev/mock-host.html @@ -1,5 +1,6 @@ - @@ -42,7 +43,16 @@

message log

content: [{ type: 'text', text: `${fixture.nodes.length} nodes` }], structuredContent: sc } }); } +const fail = q.get('fail'); async function callTool(id, p) { + if (fail === 'all' || (fail === 'app' && p.name !== 'roadmap_view')) { + return post({ jsonrpc: '2.0', id, error: { code: -32603, message: 'IPC not available for MCP tool call' } }); + } + if (p.name === 'roadmap_view') { + const fixture = await (await fetch('sample-roadmap.json')).json(); + const sc = { ...fixture, t_server_ms: Date.now(), payload_bytes: JSON.stringify(fixture).length }; + return reply(id, { content: [{ type: 'text', text: 'roadmap' }], structuredContent: sc }); + } if (p.name === 'leaf_get') { const r = await fetch('sample-leaves/' + p.arguments.path); const markdown = r.ok ? await r.text() : '(no sample leaf for ' + p.arguments.path + ')'; @@ -63,11 +73,14 @@

message log

log('view->host', m); if (m.method === 'ui/initialize') { reply(m.id, { protocolVersion: '2026-01-26', hostInfo: { name: 'mock-host', version: '0.0.0' }, - hostCapabilities: { serverTools: {}, openLinks: {} }, hostContext }); + hostCapabilities: { serverTools: {}, openLinks: {}, ...(q.get('mc') === '0' ? {} : { updateModelContext: { text: {} } }) }, hostContext }); } else if (m.method === 'ui/notifications/initialized') { toolResult(); } else if (m.method === 'tools/call') { callTool(m.id, m.params); + } else if (m.method === 'ui/update-model-context') { + window.modelContexts = (window.modelContexts || []).concat([m.params]); + reply(m.id, {}); } else if (m.method === 'ui/request-display-mode') { const mode = modes.includes(m.params.mode) ? m.params.mode : hostContext.displayMode; frame.classList.toggle('fs', mode === 'fullscreen'); diff --git a/crates/rdm-mcp/view/dist/index.html b/crates/rdm-mcp/view/dist/index.html index a4e2183..bfe58bf 100644 --- a/crates/rdm-mcp/view/dist/index.html +++ b/crates/rdm-mcp/view/dist/index.html @@ -4,10 +4,10 @@ rdm graph view - - diff --git a/crates/rdm-mcp/view/src/App.svelte b/crates/rdm-mcp/view/src/App.svelte index 6ab6e8d..a4ba776 100644 --- a/crates/rdm-mcp/view/src/App.svelte +++ b/crates/rdm-mcp/view/src/App.svelte @@ -1,10 +1,11 @@ + +
+ Diagnostics +
+ + + {copied} +
+
{text}
+
+ + diff --git a/crates/rdm-mcp/view/src/bridge.ts b/crates/rdm-mcp/view/src/bridge.ts index b15205b..7b11079 100644 --- a/crates/rdm-mcp/view/src/bridge.ts +++ b/crates/rdm-mcp/view/src/bridge.ts @@ -46,8 +46,37 @@ export async function connect( /** Call a server tool (tools/call) and return its structuredContent, or null. */ export async function callAppTool(name: string, args: Record = {}): Promise { - const res = await app.callServerTool({ name, arguments: args }); - return (res.structuredContent as T | undefined) ?? null; + try { + const res = await app.callServerTool({ name, arguments: args }); + return (res.structuredContent as T | undefined) ?? null; + } catch (e) { + // Surface, never hide: every failed tool call is kept for the diagnostics panel. + toolErrorListener?.(name, String(e)); + throw e; + } +} + +let toolErrorListener: ((tool: string, text: string) => void) | null = null; +/** The diagnostics panel registers here to see the last error of every failed tool call. */ +export function onToolError(fn: (tool: string, text: string) => void): void { + toolErrorListener = fn; +} + +/** ui/update-model-context, only if the host advertises the updateModelContext capability. */ +export async function sendModelContext(structured: Record): Promise { + const caps = app.getHostCapabilities() as { updateModelContext?: unknown } | undefined; + if (!caps?.updateModelContext) return 'skipped: host does not advertise updateModelContext'; + try { + await app.updateModelContext({ + content: [{ type: 'text', text: JSON.stringify(structured) }], + structuredContent: structured, + }); + return 'ok'; + } catch (e) { + const t = String(e); + toolErrorListener?.('ui/update-model-context', t); + return 'failed: ' + t; + } } /** Ask the host for a display mode (ui/request-display-mode). */ diff --git a/crates/rdm-mcp/view/src/probe.ts b/crates/rdm-mcp/view/src/probe.ts index 4b2fa56..eb1a10e 100644 --- a/crates/rdm-mcp/view/src/probe.ts +++ b/crates/rdm-mcp/view/src/probe.ts @@ -19,9 +19,9 @@ function plain(v: unknown): unknown { return v === undefined ? null : JSON.parse(JSON.stringify(v)); } -async function send(view: RoadmapView, host: HostInfo, tViewMs: number, displayMode: string) { - // Field names are the probe_record contract of build/stub_server.md Step 2. - return callAppTool('probe_record', { +/** The probe JSON; field names are the probe_record contract of build/stub_server.md Step 2. */ +export function buildProbe(view: RoadmapView, host: HostInfo, tViewMs: number, displayMode: string) { + return { run_kind: runKind(), t_server_ms: view.t_server_ms, t_view_ms: tViewMs, @@ -30,7 +30,11 @@ async function send(view: RoadmapView, host: HostInfo, tViewMs: number, displayM host_capabilities: plain(host.hostCapabilities), host_context: plain(host.hostContext), display_mode: displayMode, - }); + }; +} + +async function send(view: RoadmapView, host: HostInfo, tViewMs: number, displayMode: string) { + return callAppTool('probe_record', buildProbe(view, host, tViewMs, displayMode)); } /** First paint: one probe_record, display_mode taken from the host's current mode. */ From ec29615bc161debf9d94752ad84d75302d8dc55b Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:49:56 +0900 Subject: [PATCH 024/183] docs(design): restore the pre-cancel status when a cancel is undone Co-Authored-By: Claude Sonnet 5.5 --- __design__/rdm/statuses.md | 48 +++++++++++++++++---------------- __design__/rdm/stored-schema.md | 2 +- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/__design__/rdm/statuses.md b/__design__/rdm/statuses.md index 0b57d49..48301d1 100644 --- a/__design__/rdm/statuses.md +++ b/__design__/rdm/statuses.md @@ -18,7 +18,7 @@ Only a leaf has a stored status. A directory's status is derived (see `Subtrees | `planned` | The leaf is written and not started. No step is recorded done. | no | no | | `ongoing` | Work has started on the leaf. Steps may be recorded done. | no | steps recorded done only | | `paused` | Work is held and can be resumed: a bug, a decision to wait, or a downstream branch held on purpose. | no | steps recorded done only | -| `cancelled` | The leaf is abandoned. It holds nothing back while it is cancelled. Whatever was done stays on record. A mistaken cancel can be undone (`cancelled → planned`). | yes | yes, while cancelled | +| `cancelled` | The leaf is abandoned. It holds nothing back while it is cancelled. Whatever was done stays on record. A mistaken cancel can be undone: the leaf returns to the status it had just before the cancel. | yes | yes, while cancelled | | `done` | Every step is done with its commit recorded. The only terminal status. | yes | yes, for good | `blocked` and `amendment` are not statuses. A "blocked" situation is `paused` (resumable) or @@ -52,11 +52,11 @@ status is `paused` or `cancelled`). "Ready set" says what the move does to the s | `paused` | `paused` | refused | | | No-op | none | | `paused` | `cancelled` | allowed | both | required | none | RELEASE | | `paused` | `done` | refused | | | Resume to `ongoing` first | none | -| `cancelled` | `planned` | allowed | both | required | No step is recorded done. Undoes a mistaken cancel, for one leaf or for a directory cancel through its `op_id`. Eliott, 2026-11-16 | ENTER if nothing shallower holds it back | -| `cancelled` | `ongoing` | refused | | | Only `planned` leaves `cancelled` | none | -| `cancelled` | `paused` | refused | | | Only `planned` leaves `cancelled` | none | +| `cancelled` | `planned` | allowed | both | required | Undo: the status before the cancel, read from history (the `from` of the last cancel entry), is `planned`. Eliott's intent 2026-11-16, ruling (coordinator, 2026-11-16) | ENTER if nothing shallower holds it back | +| `cancelled` | `ongoing` | allowed | both | required | Undo: the status before the cancel was `ongoing`. Any other target is refused (coordinator, 2026-11-16) | none | +| `cancelled` | `paused` | allowed | both | required | Undo: the status before the cancel was `paused`. Any other target is refused (coordinator, 2026-11-16) | none | | `cancelled` | `cancelled` | refused | | | No-op | none | -| `cancelled` | `done` | refused | | | Only `planned` leaves `cancelled` | none | +| `cancelled` | `done` | refused | | | Only an undo leaves `cancelled`, and never to `done` | none | | `done` | `planned` | refused | | | Terminal: nothing reopens done work, new work is a new node | none | | `done` | `ongoing` | refused | | | Terminal | none | | `done` | `paused` | refused | | | Terminal | none | @@ -69,21 +69,23 @@ Rules that hold for every row: - A move presents the status it expects to leave. A mismatch is refused (R01 §Concurrency). - A move writes one history entry and never an amendment (I5). - A move into `done` or `cancelled` may carry the final `progress` in the same operation. After it, only comments are accepted, and from `cancelled` only the move to `planned`. -- The reason is required text, not blank, for `paused`, `cancelled`, `paused → planned`, `paused → ongoing` and `cancelled → planned`. +- The reason is required text, not blank, for `paused`, `cancelled`, `paused → planned`, `paused → ongoing` and every undo out of `cancelled`. **`paused → planned` needs "no step is recorded done".** A step recorded done is sealed with its -commit, so a `planned` leaf holding a recorded commit would contradict "not started". The same -precondition holds for `cancelled → planned`. A leaf with a recorded step goes to `ongoing` +commit, so a `planned` leaf holding a recorded commit would contradict "not started". A leaf with a recorded step goes to `ongoing` instead. Decided 2026-11-16 (coordinator). **`cancelled` is undoable.** A cancel is one call with a reason, and a directory cancel is one -call over many leaves, so a mistake must be reversible. `cancelled → planned` is allowed with a -required reason, recorded in history. Done work stays sealed: nothing leaves `done`. Decided -2026-11-16 (Eliott). +call over many leaves, so a mistake must be reversible. Undoing a cancel restores the status the +node had just before the cancel, with a required reason, recorded in history. That status is read +from history: the `from` of the last cancel entry. It may be `planned`, `ongoing` or `paused`. Any +other target out of `cancelled` is refused. A leaf with no cancel entry in its history (one imported from legacy `blocked`) returns to `planned`, as the importer writes no steps done. Done work stays sealed: nothing leaves `done`. +Eliott's intent 2026-11-16 ("undo a mistaken cancel with a reason"); the restore rule is the +coordinator's ruling, 2026-11-16. -**Not covered: a cancelled leaf with a recorded step.** It cannot return to `planned`, and no -move leads from `cancelled` to `paused` or `ongoing`. If Eliott wants those leaves undoable too, -`cancelled → paused` is the smallest addition. +**Closed gap: a cancelled leaf with a recorded step.** The first form of the undo moved only to +`planned`, which a leaf with a done step cannot take, so such a leaf could never be resumed. The +restore rule fixes it: a leaf cancelled from `ongoing` or `paused` returns there. **Note: a cancel releases work without saying so.** Because `cancelled` holds nothing back, a cancelled leaf can release a deeper leaf that really needed it. That is Eliott's intent. The @@ -93,8 +95,8 @@ silent. ## Ready set A leaf is ready when it is `planned` and every leaf that holds it back is `done` or `cancelled`. -So `cancelled` holds nothing back while it is cancelled. Undoing a cancel makes the leaf `planned` -and it holds back again; deeper leaves that already started are not stopped. +So `cancelled` holds nothing back while it is cancelled. Undoing a cancel returns the leaf to its earlier status; if that is +`planned`, `ongoing` or `paused` it holds back again; deeper leaves that already started are not stopped. **The rule (scoped, the legacy rule; Eliott, 2026-11-16).** An unfinished leaf holds back only the deeper leaves under its own parent. Precisely: leaf L is held back by every unfinished leaf @@ -129,7 +131,7 @@ override (`planned → ongoing` outside the set) is recorded and allowed. - One reason, one timestamp and one `op_id` are shared by every history entry the operation writes. The operation is one call and one transaction, so it is "recorded once". - It is a snapshot, not a standing flag. A leaf added to the directory later starts `planned`. - `resume` of a directory sets each `paused` leaf under it to the `from` of its last pause entry (`planned` or `ongoing`). A leaf whose last pause came from another operation is resumed too, each by its own rule. The reason is required. -- `uncancel` of a directory sets to `planned` every `cancelled` leaf whose last history entry carries the `op_id` of the cancel being undone, with one reason and one new `op_id`. A leaf that holds a recorded step is skipped and reported. Leaves cancelled by another operation are left alone. +- `uncancel` of a directory restores every `cancelled` leaf whose last history entry carries the `op_id` of the cancel being undone. Each leaf returns to the `from` of that entry, so a leaf may come back `planned`, `ongoing` or `paused`. One reason and one new `op_id` are shared. Leaves cancelled by another operation are left alone. **A directory's status is derived on every read and never stored (I6).** It is computed from all leaves under it, at any depth. The first matching row wins. @@ -157,7 +159,7 @@ append-only comment (a file `_comments/.json` whose `node_id` names the no | `planned` | allowed, amendment note required | allowed | per `Transitions` | allowed | | `ongoing` | allowed except sealed steps, amendment note required | allowed | per `Transitions` | allowed | | `paused` | allowed except sealed steps, amendment note required | allowed | per `Transitions` | allowed | -| `cancelled` | refused | allowed | only `→ planned` | refused | +| `cancelled` | refused | allowed | only the undo, to the pre-cancel status | refused | | `done` | refused | allowed | refused | refused | - **Content** is every stored field except `status`, `status_reason`, `history`, `progress` and the state marks. The state marks are a criterion's `met`, and a step's `done`, `commit_sha` and `done_at`. @@ -165,7 +167,7 @@ append-only comment (a file `_comments/.json` whose `node_id` names the no - **Status moves, progress, comments and state marks never produce an amendment (I5).** Setting `met` is a state change like a move, allowed until the leaf is `done` or `cancelled`. - **A step recorded done inside an `ongoing` or `paused` leaf is sealed.** Its commit is on record, so its content (goal, logic, deliverables, checks, commit, references) cannot change and its `done` mark cannot be cleared. The other steps and the leaf's own fields stay editable. A sealed step cannot be removed or reordered. - **Directories follow their derived status.** A directory (or the campaign root) whose derived status is `done` or `cancelled` is sealed: its own content (title, context, goal, criteria, references, gotchas, notes) cannot change, and it accepts comments. Adding or removing a child is a structure edit of the child, not a content edit of the directory, so it stays allowed with an amendment. A directory in any other derived status takes edits with an amendment note. Weak point: a new `planned` child moves the derived status off `done`, which unseals the directory. The amendment log still records both edits. -- **A cancelled node stays sealed while it is cancelled.** Undoing the cancel (`→ planned`) unseals it. A `done` node never unseals. +- **A cancelled node stays sealed while it is cancelled.** Undoing the cancel unseals it, in the status it had before. A `done` node never unseals. - **Nothing reopens done work.** A new piece of work is a new node. There is no `done → ongoing`. - **Gate marks do not gate `done`.** Real campaigns leave open (`⬜`) gates on most done leaves: 30 of 48 done leaves under `__roadmap__/` carry at least one. So the only precondition of `done` is I8, as in R01. Criteria `met` is information, not a check. - **Structure edits on sealed nodes.** Deleting a `done` or `cancelled` leaf keeps its acknowledgement (I9) and its snapshot in the amendment. Moving a sealed leaf changes no content. Whether a move that changes the ready set of other leaves needs the acknowledgement is left to M2's impact analysis. @@ -195,7 +197,7 @@ For `r01_sync`. R01 is not edited by this leaf. | R01 location | Change | |:--|:--| -| §Graph operations, Status FSM diagram | Replace with the five-status machine of `Transitions`: `planned → ongoing, paused, cancelled`; `ongoing → paused, cancelled, done`; `paused → planned, ongoing, cancelled`; `cancelled → planned`. Remove `blocked`, `amendment` and the `done → amendment` edge | +| §Graph operations, Status FSM diagram | Replace with the five-status machine of `Transitions`: `planned → ongoing, paused, cancelled`; `ongoing → paused, cancelled, done`; `paused → planned, ongoing, cancelled`; `cancelled → planned, ongoing, paused` (only the pre-cancel status). Remove `blocked`, `amendment` and the `done → amendment` edge | | §Graph operations, Order | "not done" becomes "`planned`"; "every leaf of smaller depth is done" becomes "`done` or `cancelled`". The ready rule becomes the scoped rule of `Ready set`. The sentence "Wave semantics are global: a leaf also waits for shallower leaves in unrelated branches" is replaced: a leaf waits only for shallower leaves under its own ancestors' parents. "Waves" stay a display of depth (`level`), not a readiness fact | | §Graph operations, after the FSM | "Starting a leaf outside the ready set is refused unless an override with a reason is given" stays. Add the directory pause and cancel operation and the derivation table | | §Graph operations, Impact analysis | Remove "done work reopened". Add "leaves made ready by a cancel" | @@ -216,7 +218,7 @@ Nothing is open. Who decided what: |:--|:--|:--| | 1 | Ready rule: an unfinished leaf holds back only the deeper leaves under its own parent (legacy rule). Applies to `planned`, `ongoing` and `paused` alike | Eliott, 2026-11-16 | | 2 | Comments are one file each, `_comments/.json`, append-only | Eliott, 2026-11-16 | -| 3 | `cancelled → planned` allowed with a required reason; `done` stays terminal and sealed | Eliott, 2026-11-16 | -| 4 | `paused → planned` and `cancelled → planned` need no step recorded done | coordinator, 2026-11-16 | +| 3 | A mistaken cancel can be undone with a required reason; `done` stays terminal and sealed | Eliott, 2026-11-16 | +| 4 | `paused → planned` needs no step recorded done | coordinator, 2026-11-16 | | 5 | A step recorded done is sealed, so a mistyped `commit_sha` is permanent. Recorded objection: a human-only correction with an amendment would be the least invasive fix | default kept, coordinator, 2026-11-16 | -| 6 | Not covered: undoing the cancel of a leaf that holds a recorded step | for Eliott, if he wants it | +| 6 | Undoing a cancel restores the status the node had just before the cancel, read from history, with a required reason: `planned`, `ongoing` or `paused`. A directory undo restores each leaf through the cancel's `op_id`. `done` stays the only terminal status. Replaces the earlier `cancelled → planned` only form and closes its gap (coordinator, 2026-11-16) | coordinator, 2026-11-16 | diff --git a/__design__/rdm/stored-schema.md b/__design__/rdm/stored-schema.md index 12f39ff..63d4825 100644 --- a/__design__/rdm/stored-schema.md +++ b/__design__/rdm/stored-schema.md @@ -219,7 +219,7 @@ An element of `Leaf.history`: one status move. Written by `transition`; never an | `from` | status | yes | The status left | | `to` | status | yes | The status entered | | `actor` | `Actor` | yes | Who made it | -| `reason` | `string?` | no | Required for moves into `paused` and `cancelled`, and for `paused → planned`, `paused → ongoing` and `cancelled → planned` (`statuses.md`) | +| `reason` | `string?` | no | Required for moves into `paused` and `cancelled`, and for `paused → planned`, `paused → ongoing` and every undo out of `cancelled` (`statuses.md`) | | `override` | `bool?` | no | `true` when the leaf was started outside the ready set | | `op_id` | `string?` | no | **new**: shared by every entry that one operation writes, so a directory pause or cancel is recognisable as one operation | From 0b30cbe32995004a9b8f350bdd690135e5cab209 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:53:55 +0900 Subject: [PATCH 025/183] docs(design): specify the rdm read model Co-Authored-By: Claude Sonnet 5.5 --- __design__/rdm/read-model.md | 553 +++++++++++++++++++++++++++++++++++ 1 file changed, 553 insertions(+) create mode 100644 __design__/rdm/read-model.md diff --git a/__design__/rdm/read-model.md b/__design__/rdm/read-model.md new file mode 100644 index 0000000..098b919 --- /dev/null +++ b/__design__/rdm/read-model.md @@ -0,0 +1,553 @@ +# rdm — Read model + +The shape every consumer receives. Four projections over the stored files. Each one has a field +list, the consumer that uses it, and a worked example computed by hand from +`__roadmap__/roadmap-mcp-rework/`. + +The stored facts are in [stored-schema.md](stored-schema.md). The meaning of each status, the +ready rule and the derivation of a directory's status are in [statuses.md](statuses.md). The +legacy campaign is read through its legacy mapping first: `inprogress` is `ongoing`, `planned` is +`planned`. + +## Projections + +| Projection | Section | Consumers | Answers | +|:--|:--|:--|:--| +| Campaign outline with waves | `Campaign outline` | M4 `roadmap_view` and the app-only tool behind it (R01 `ui_snapshot`), M5 `--json`, M6 view | What is in the campaign, in what status, in which wave | +| Node detail | `Node detail` | M4 `roadmap_get`, M5 `--json`, M6 detail pane | Everything about one node | +| Ready set | `Ready set` | M4 `roadmap_next`, M5 `--json` | What may start now, and what holds the rest back | +| Amendment log | `Amendment log` | M4 `roadmap_amendments`, M5 `--json`, M6 timeline | What was changed, by whom, why | + +M4 owns the final tool names; R01's table is a suggestion. The campaign list and the diagnostics +of `validate` are not projections of this document. M2 owns the diagnostics. + +**Every projection field has a source.** The `Source` column of each field table names a stored +field (path in `stored-schema.md`) or a derivation. A field with neither is a defect. + +**Envelope.** Every projection starts with these fields. + +| Field | Type | Source | +|:--|:--|:--| +| `read_model_version` | `string` | The constant `READ_MODEL_VERSION` | +| `format_version` | `string` | The highest `schema_version` among the files read | +| `projection` | `"outline"`, `"node"`, `"ready"` or `"amendments"` | Fixed by the projection | +| `campaign` | `{id, path, title}` | `id` and `title` from the campaign `_dir.json`. `path` is the argument of the call | +| `tree_rev` | `string` | Opaque. Computed by M1 over the campaign | + +**Revisions.** `rev` (one node) and `tree_rev` (the campaign) are opaque strings. A consumer +compares them for equality and sends them back as `expected_rev` and `expected_tree_rev`. It +never parses them. M1 defines how they are computed. A comment never changes a `rev` +(`stored-schema.md`, `Comment`). + +**Order.** Siblings have no stored order. Every list below orders nodes by `level`, then leaves +before directories, then `path`. Lists of amendments and comments order by ULID, oldest first. + +**Types in `rdm-schema`.** The crate leaf holds these as types: + +| Type | Holds | +|:--|:--| +| `Envelope` | The envelope fields, flattened into each view | +| `OutlineView`, `NodeView`, `ReadyView`, `AmendmentsView` | The four projections | +| `LevelSource` | Enum, one value today: `depth` | +| `StatusCounts` | `{planned, ongoing, paused, cancelled, done}`, five integers, all always present | +| `Holder` | `{path, title, status, status_reason?}`, the value of a `holders` map | +| `WaveView`, `OutlineNode`, `StepView`, `AmendmentEntry`, `ChangeView` | Parts named in the field tables | + +**Examples.** Ids are stand-ins (`n_m1`): M1 mints the real ones. Revisions are stand-ins +(`rev-m1`). A string ending in `[cut]` or a string element `"[cut: …]"` marks text left out. It is +not part of the shape. + +## Campaign outline + +One call returns the whole tree, its waves, and the flags a graph needs. + +| Field | Type | Source | +|:--|:--|:--| +| `root` | `OutlineNode` of kind `directory`, `is_campaign: true` | The campaign root, see below. The envelope's `campaign` holds only the identity | +| `waves` | `WaveView[]` | Derived: the leaves grouped by `level`, ascending, one entry per level that has a leaf | + +`OutlineNode`, directory: + +| Field | Type | Source | +|:--|:--|:--| +| `id`, `title` | `string` | `Directory.id`, `.title` | +| `path` | `string` | Derived: the path segments from the campaign root. `""` for the root | +| `kind` | `"directory"` | `Directory.kind`, with `campaign` shown as `is_campaign: true` | +| `is_campaign` | `bool` | `Directory.kind == "campaign"` | +| `goal` | `string` | `Directory.goal`. Root only | +| `status` | status | Derived, `statuses.md` `Subtrees and directories` | +| `counts` | `StatusCounts` | Derived: the leaves under the directory, any depth, counted by `status`. Needed because a directory shows `done` even when some leaves are cancelled | +| `amendment_count` | `integer` | Derived: the `Amendment` files. Root only | +| `rev` | `string` | Opaque, M1 | +| `children` | `OutlineNode[]` | Derived from the directory listing, in the order above | + +`OutlineNode`, leaf: + +| Field | Type | Source | +|:--|:--|:--| +| `id`, `title`, `status` | | `Leaf.id`, `.title`, `.status` | +| `status_reason` | `string?` | `Leaf.status_reason` | +| `path` | `string` | Derived, as above | +| `kind` | `"leaf"` | `Leaf.kind` | +| `level`, `level_source` | `integer`, `"depth"` | `Level and its source` | +| `ready` | `bool` | Derived: the leaf is in the ready set (`Ready set`) | +| `steps` | `{done, total}` | Derived: count of `Leaf.steps[].done`, and of `Leaf.steps` | +| `added_by` | `string?` | Derived: the display id of the amendment with a change `{op: add}` naming this node. Absent when none | +| `rev` | `string` | Opaque, M1 | + +`WaveView`: + +| Field | Type | Source | +|:--|:--|:--| +| `level`, `level_source` | `integer`, `"depth"` | `Level and its source` | +| `leaf_ids` | `string[]` | Derived: ids of the leaves at this level, in the order above | +| `counts` | `StatusCounts` | Derived: those leaves counted by `status` | + +A wave is a display group. It is not a readiness fact: readiness is in `Ready set`. + +### Worked example + +Counts and statuses of `roadmap-mcp-rework`: ten leaves. M0 and M0b are `ongoing` (legacy +`inprogress`). M1 to M8 are `planned`. Every leaf has three steps, none done. The one amendment, +legacy `A1`, added `m0b_domain_model_spec`. The ready set is empty (see `Ready set`), so every +`ready` is `false`. Directory statuses: the root has an `ongoing` leaf, so `ongoing` (row 4). The +six directories hold only `planned` leaves, so `planned` (row 7). + +```json +{ + "read_model_version": "0.1", "format_version": "0.1", "projection": "outline", + "campaign": { "id": "c_rework", "path": "__roadmap__/roadmap-mcp-rework", + "title": "rdm rework — meta-roadmap" }, + "tree_rev": "tree-1", + "root": { + "id": "c_rework", "path": "", "kind": "directory", "is_campaign": true, + "title": "rdm rework — meta-roadmap", + "goal": "`managing-roadmaps` ships as a plugin whose tools are a published Rust MCP server and CLI over one core, with JSON roadmaps, full CRUD under an amendment log, and a graph view.", + "status": "ongoing", + "counts": { "planned": 8, "ongoing": 2, "paused": 0, "cancelled": 0, "done": 0 }, + "amendment_count": 1, "rev": "rev-root", + "children": [ + { "id": "n_m0", "path": "m0_feasibility_spike", "kind": "leaf", "title": "M0 Feasibility spike", + "status": "ongoing", "level": 0, "level_source": "depth", "ready": false, + "steps": { "done": 0, "total": 3 }, "rev": "rev-m0" }, + { "id": "n_m0b", "path": "m0b_domain_model_spec", "kind": "leaf", "title": "M0b Domain model spec", + "status": "ongoing", "level": 0, "level_source": "depth", "ready": false, + "steps": { "done": 0, "total": 3 }, "added_by": "A1", "rev": "rev-m0b" }, + { "id": "d_core", "path": "core", "kind": "directory", "is_campaign": false, "title": "Core", + "status": "planned", + "counts": { "planned": 8, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 }, "rev": "rev-core", + "children": [ + { "id": "n_m1", "path": "core/m1_core_foundation", "kind": "leaf", "title": "M1 Core foundation", + "status": "planned", "level": 1, "level_source": "depth", "ready": false, + "steps": { "done": 0, "total": 3 }, "rev": "rev-m1" }, + { "id": "d_engine", "path": "core/engine", "kind": "directory", "is_campaign": false, "title": "Engine", + "status": "planned", + "counts": { "planned": 7, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 }, "rev": "rev-engine", + "children": [ + { "id": "n_m2", "path": "core/engine/m2_graph_engine", "kind": "leaf", "title": "M2 Graph engine", + "status": "planned", "level": 2, "level_source": "depth", "ready": false, + "steps": { "done": 0, "total": 3 }, "rev": "rev-m2" }, + { "id": "d_interchange", "path": "core/engine/interchange", "kind": "directory", + "is_campaign": false, "title": "Interchange", "status": "planned", + "counts": { "planned": 6, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 }, + "rev": "rev-interchange", + "children": [ + { "id": "n_m3", "path": "core/engine/interchange/m3_interchange", "kind": "leaf", + "title": "M3 Interchange", "status": "planned", "level": 3, "level_source": "depth", + "ready": false, "steps": { "done": 0, "total": 3 }, "rev": "rev-m3" }, + { "id": "d_consumers", "path": "core/engine/interchange/consumers", "kind": "directory", + "is_campaign": false, "title": "Consumers", "status": "planned", + "counts": { "planned": 5, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 }, + "rev": "rev-consumers", + "children": [ + { "id": "n_m4", "path": "core/engine/interchange/consumers/m4_mcp_server", "kind": "leaf", + "title": "M4 MCP server", "status": "planned", "level": 4, "level_source": "depth", + "ready": false, "steps": { "done": 0, "total": 3 }, "rev": "rev-m4" }, + { "id": "n_m5", "path": "core/engine/interchange/consumers/m5_cli", "kind": "leaf", + "title": "M5 CLI", "status": "planned", "level": 4, "level_source": "depth", + "ready": false, "steps": { "done": 0, "total": 3 }, "rev": "rev-m5" }, + { "id": "d_delivery", "path": "core/engine/interchange/consumers/delivery", + "kind": "directory", "is_campaign": false, "title": "Delivery", "status": "planned", + "counts": { "planned": 3, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 }, + "rev": "rev-delivery", + "children": [ + { "id": "n_m6", "path": "core/engine/interchange/consumers/delivery/m6_apps_view", + "kind": "leaf", "title": "M6 Apps view", "status": "planned", "level": 5, + "level_source": "depth", "ready": false, "steps": { "done": 0, "total": 3 }, + "rev": "rev-m6" }, + { "id": "n_m7", "path": "core/engine/interchange/consumers/delivery/m7_distribution", + "kind": "leaf", "title": "M7 Distribution", "status": "planned", "level": 5, + "level_source": "depth", "ready": false, "steps": { "done": 0, "total": 3 }, + "rev": "rev-m7" }, + { "id": "d_cutover", "path": "core/engine/interchange/consumers/delivery/cutover", + "kind": "directory", "is_campaign": false, "title": "Cutover", "status": "planned", + "counts": { "planned": 1, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 }, + "rev": "rev-cutover", + "children": [ + { "id": "n_m8", + "path": "core/engine/interchange/consumers/delivery/cutover/m8_cutover", + "kind": "leaf", "title": "M8 Cutover", "status": "planned", "level": 6, + "level_source": "depth", "ready": false, "steps": { "done": 0, "total": 3 }, + "rev": "rev-m8" } ] } ] } ] } ] } ] } ] } ] + }, + "waves": [ + { "level": 0, "level_source": "depth", "leaf_ids": ["n_m0", "n_m0b"], + "counts": { "planned": 0, "ongoing": 2, "paused": 0, "cancelled": 0, "done": 0 } }, + { "level": 1, "level_source": "depth", "leaf_ids": ["n_m1"], + "counts": { "planned": 1, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 } }, + { "level": 2, "level_source": "depth", "leaf_ids": ["n_m2"], + "counts": { "planned": 1, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 } }, + { "level": 3, "level_source": "depth", "leaf_ids": ["n_m3"], + "counts": { "planned": 1, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 } }, + { "level": 4, "level_source": "depth", "leaf_ids": ["n_m4", "n_m5"], + "counts": { "planned": 2, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 } }, + { "level": 5, "level_source": "depth", "leaf_ids": ["n_m6", "n_m7"], + "counts": { "planned": 2, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 } }, + { "level": 6, "level_source": "depth", "leaf_ids": ["n_m8"], + "counts": { "planned": 1, "ongoing": 0, "paused": 0, "cancelled": 0, "done": 0 } } + ] +} +``` + +## Node detail + +One node, with everything stored about it and what is derived. `kind` says which of two shapes. + +Common to both kinds: + +| Field | Type | Source | +|:--|:--|:--| +| `id`, `title`, `kind` | | `id`, `title`, `kind` of the file | +| `path` | `string` | Derived: path segments from the campaign root | +| `parent` | `string` | Derived: the path of the parent directory. `""` for a node under the root | +| `rev` | `string` | Opaque, M1 | +| `sealed` | `bool` | Derived from `statuses.md` `Sealing`: `true` when the content cannot change (leaf `cancelled` or `done`, directory with derived status `cancelled` or `done`) | +| `comments` | `Comment[]` | The `_comments/` files whose `node_id` is this node, oldest first. The stored `Comment` shape | +| `amendments` | `string[]` | Derived: display ids of the amendments whose `changes` name this node | +| `added_by` | `string?` | As in `Campaign outline` | + +Leaf only: + +| Field | Type | Source | +|:--|:--|:--| +| `status`, `status_reason?` | | `Leaf.status`, `.status_reason` | +| `status_since` | `ts?` | Derived: `ts` of the last `Leaf.history` entry. Absent when `history` is empty, as for an imported leaf | +| `level`, `level_source` | | `Level and its source` | +| `ready` | `bool` | Derived, `Ready set` | +| `held_by` | `string[]` | Derived: ids of the unfinished leaves that hold this leaf back, by the ready rule. Empty when none. Also set for a leaf that is not `planned`, so a reader sees what a paused leaf waits for | +| `goal`, `preconditions`, `success_gates`, `references` | | The stored fields of `Leaf` | +| `steps` | `StepView[]` | `StepView`: every stored `Step` field, plus `number` | +| `progress` | | `Leaf.progress`, as stored | +| `commit_count` | `integer?` | Derived: the number of steps with a `commit_sha`; else `progress.commits`; else absent | +| `step_progress` | `{done, total}` | Derived, as `steps` in `Campaign outline` | +| `history` | `History[]` | `Leaf.history`, as stored, oldest first | + +`StepView.number` is derived: the position in `Leaf.steps` plus one. + +Directory only: + +| Field | Type | Source | +|:--|:--|:--| +| `is_campaign` | `bool` | `Directory.kind == "campaign"` | +| `status` | status | Derived, `statuses.md` | +| `counts` | `StatusCounts` | Derived, as in `Campaign outline` | +| `context`, `goal`, `preconditions`, `success_gates`, `references`, `gotchas`, `notes` | | The stored fields of `Directory` | +| `children` | `{id, path, kind, title, status}[]` | Derived from the directory listing, in the order above | + +Both kinds: a top-level `holders` map, id to `Holder`, holds every id named in `held_by`, so the +caller needs no second read. + +### Worked example + +`core/m1_core_foundation`, a `planned` leaf held back by M0 and M0b. Its three-step file is cut to +step 1. + +```json +{ + "read_model_version": "0.1", "format_version": "0.1", "projection": "node", + "campaign": { "id": "c_rework", "path": "__roadmap__/roadmap-mcp-rework", + "title": "rdm rework — meta-roadmap" }, + "tree_rev": "tree-1", + "node": { + "id": "n_m1", "path": "core/m1_core_foundation", "parent": "core", "kind": "leaf", + "rev": "rev-m1", "title": "M1 Core foundation", + "status": "planned", "level": 1, "level_source": "depth", + "ready": false, "held_by": ["n_m0", "n_m0b"], "sealed": false, + "goal": "`rdm-engine` stores a roadmap as JSON, one file per node, and N processes can read and write one campaign without losing or tearing a write.", + "preconditions": [ + { "text": "`../m0_feasibility_spike.md` is `done` with a go", "met": false }, + { "text": "`../m0b_domain_model_spec.md` is `done`", "met": false }, + { "text": "Reminder `skills-rdm-M1` read", "met": false } ], + "success_gates": [ + { "text": "`rdm-engine` depends on `rdm-schema` for every stored type and holds none of its own; a file with a newer format major is refused with an upgrade message", "met": false }, + "[cut: 4 more gates, same shape]" ], + "references": [ + { "label": "R01", "title": "§Data Model, §Concurrency, §Contracts & Invariants", + "target": "../../../__design__/rdm/architecture.md", + "note": "the file layout, the schema sketch, the lock, the journal and the revisions" } ], + "steps": [ + { "id": "s_m1_1", "number": 1, "title": "Plan the milestone", + "goal": "The campaign `__roadmap__/m1-core-foundation/` exists and Eliott has approved it.", + "implementation_logic": [ + "In plan mode, author the campaign with `managing-roadmaps`, deciding: the id minting, to the format M0b fixes; … [cut]", + "[cut: 1 more line]" ], + "deliverables": [ "`__roadmap__/m1-core-foundation/README.md` and its leaves" ], + "references": [], + "checks": [ { "text": "`bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m1-core-foundation/`", + "expected": "PASS" } ], + "commit": { "type": "chore", "scope": "roadmap", "breaking": false, + "summary": "plan the m1-core-foundation milestone" }, + "done": false }, + "[cut: steps 2 and 3, same shape]" ], + "progress": { "notes": [] }, + "step_progress": { "done": 0, "total": 3 }, + "history": [], "comments": [], "amendments": [] + }, + "holders": { + "n_m0": { "path": "m0_feasibility_spike", "title": "M0 Feasibility spike", "status": "ongoing" }, + "n_m0b": { "path": "m0b_domain_model_spec", "title": "M0b Domain model spec", "status": "ongoing" } + } +} +``` + +The imported leaf has no `history`, no `commit_count`, no `status_since` and no `branch`: the +legacy file held none of them, and its Progress table is empty. + +## Ready set + +**The rule** is the scoped rule of `statuses.md` (Eliott, 2026-11-16). A leaf is ready when it is +`planned` and no leaf holds it back. An unfinished leaf (`planned`, `ongoing`, `paused`) holds +back only the deeper leaves under its own parent. In steps: for a leaf L, take every directory +above L's own directory, up to and including the campaign root. Every unfinished leaf that sits +directly in one of those directories holds L back. Sibling leaves are parallel. `done` and +`cancelled` leaves hold nothing back. + +| Field | Type | Source | +|:--|:--|:--| +| `ready` | `ReadyLeaf[]` | Derived: the leaves that are `planned` and held by none | +| `stalled` | `StalledLeaf[]` | Derived: the `planned` leaves held by at least one leaf | +| `holders` | map id to `Holder` | Derived: every leaf named in a `held_by` | + +`ReadyLeaf`: `id`, `path`, `title` (stored or derived as in the outline), `level` and +`level_source`. `StalledLeaf`: the same, plus `held_by`, the ids of the unfinished leaves that hold +it, in the order above. A leaf that is `ongoing`, `paused` or finished is in neither list. A +`paused` leaf shows in `holders` with its `status_reason`. + +### Worked example: the real campaign + +Statuses: M0, M0b `ongoing`; M1 to M8 `planned`. The campaign is a chain: each leaf sits in a +directory under the previous leaf's directory, so each holds back everything deeper. M0 and M0b +sit at the root and hold back every directory leaf. No `planned` leaf is free: `ready` is empty. +M1 is held by M0 and M0b. M2 adds M1, and so on down the chain. + +```json +{ + "read_model_version": "0.1", "format_version": "0.1", "projection": "ready", + "campaign": { "id": "c_rework", "path": "__roadmap__/roadmap-mcp-rework", + "title": "rdm rework — meta-roadmap" }, + "tree_rev": "tree-1", + "ready": [], + "stalled": [ + { "id": "n_m1", "path": "core/m1_core_foundation", "title": "M1 Core foundation", "level": 1, "level_source": "depth", + "held_by": ["n_m0", "n_m0b"] }, + { "id": "n_m2", "path": "core/engine/m2_graph_engine", "title": "M2 Graph engine", "level": 2, "level_source": "depth", + "held_by": ["n_m0", "n_m0b", "n_m1"] }, + { "id": "n_m3", "path": "core/engine/interchange/m3_interchange", "title": "M3 Interchange", "level": 3, + "level_source": "depth", "held_by": ["n_m0", "n_m0b", "n_m1", "n_m2"] }, + { "id": "n_m4", "path": "core/engine/interchange/consumers/m4_mcp_server", "title": "M4 MCP server", "level": 4, + "level_source": "depth", "held_by": ["n_m0", "n_m0b", "n_m1", "n_m2", "n_m3"] }, + { "id": "n_m5", "path": "core/engine/interchange/consumers/m5_cli", "title": "M5 CLI", "level": 4, + "level_source": "depth", "held_by": ["n_m0", "n_m0b", "n_m1", "n_m2", "n_m3"] }, + { "id": "n_m6", "path": "core/engine/interchange/consumers/delivery/m6_apps_view", "title": "M6 Apps view", + "level": 5, "level_source": "depth", + "held_by": ["n_m0", "n_m0b", "n_m1", "n_m2", "n_m3", "n_m4", "n_m5"] }, + { "id": "n_m7", "path": "core/engine/interchange/consumers/delivery/m7_distribution", "title": "M7 Distribution", + "level": 5, "level_source": "depth", + "held_by": ["n_m0", "n_m0b", "n_m1", "n_m2", "n_m3", "n_m4", "n_m5"] }, + { "id": "n_m8", "path": "core/engine/interchange/consumers/delivery/cutover/m8_cutover", "title": "M8 Cutover", + "level": 6, "level_source": "depth", + "held_by": ["n_m0", "n_m0b", "n_m1", "n_m2", "n_m3", "n_m4", "n_m5", "n_m6", "n_m7"] } + ], + "holders": { + "n_m0": { "path": "m0_feasibility_spike", "title": "M0 Feasibility spike", "status": "ongoing" }, + "n_m0b": { "path": "m0b_domain_model_spec", "title": "M0b Domain model spec", "status": "ongoing" }, + "n_m1": { "path": "core/m1_core_foundation", "title": "M1 Core foundation", "status": "planned" }, + "n_m2": { "path": "core/engine/m2_graph_engine", "title": "M2 Graph engine", "status": "planned" }, + "n_m3": { "path": "core/engine/interchange/m3_interchange", "title": "M3 Interchange", "status": "planned" }, + "n_m4": { "path": "core/engine/interchange/consumers/m4_mcp_server", "title": "M4 MCP server", "status": "planned" }, + "n_m5": { "path": "core/engine/interchange/consumers/m5_cli", "title": "M5 CLI", "status": "planned" }, + "n_m6": { "path": "core/engine/interchange/consumers/delivery/m6_apps_view", "title": "M6 Apps view", "status": "planned" }, + "n_m7": { "path": "core/engine/interchange/consumers/delivery/m7_distribution", "title": "M7 Distribution", "status": "planned" } + } +} +``` + +### Worked example: where the scoped and the global rule differ + +A hypothetical campaign with two branches. Global rule: a leaf waits for every unfinished leaf of +a smaller level, in any branch (R01's first reading). + +| Path | Level | Status | +|:--|:--|:--| +| `a_setup` | 0 | `done` | +| `core/m1_core` | 1 | `paused` | +| `docs/d1_docs` | 1 | `done` | +| `core/engine/m2_engine` | 2 | `planned` | +| `docs/guide/g1_guide` | 2 | `planned` | + +| Leaf | Held by, scoped | Held by, global | +|:--|:--|:--| +| `m2_engine` | `m1_core` (leaf of `core/`, above `core/engine/`) | `m1_core` | +| `g1_guide` | none: `d1_docs` is `done`, `a_setup` is `done` | `m1_core` (paused, in the unrelated branch `core/`) | + +Scoped: `ready` is `[g1_guide]`, `stalled` is `[m2_engine]`. Global: `ready` is empty. The paused +leaf in `core/` halts the whole campaign under the global rule and only its own branch under the +scoped one. The scoped projection: + +```json +{ "ready": [ { "id": "n_g1", "path": "docs/guide/g1_guide", "title": "G1 Guide", "level": 2, "level_source": "depth" } ], + "stalled": [ { "id": "n_m2", "path": "core/engine/m2_engine", "title": "M2 Engine", "level": 2, "level_source": "depth", + "held_by": ["n_m1"] } ], + "holders": { "n_m1": { "path": "core/m1_core", "title": "M1 Core", "status": "paused", + "status_reason": "waiting for the schema review" } } } +``` + +## Amendment log + +The amendments of a campaign, oldest first, optionally filtered. One entry per `Amendment` file. + +Request parameters: `node` (an id or a path: keep amendments whose `changes` name that node), +`since` and `until` (a `ts` range, inclusive). All optional. No parameter gives the whole log. + +| Field | Type | Source | +|:--|:--|:--| +| `amendments` | `AmendmentEntry[]` | The `_amendments/` files that pass the filters, ordered by ULID | +| `total` | `integer` | Derived: the count of all amendments of the campaign, before filtering | + +`AmendmentEntry`: + +| Field | Type | Source | +|:--|:--|:--| +| `id` | `ulid` | `Amendment.id` | +| `display_id` | `string` | Derived: `Amendment.legacy_id` when present, else `A-` and the shortest ULID suffix, at least 6 characters, unique in the campaign (`stored-schema.md`, `Amendment`) | +| `legacy_id` | `string?` | `Amendment.legacy_id` | +| `ts`, `actor`, `description` | | `Amendment.ts`, `.actor`, `.description` | +| `source` | `string?` | `Amendment.source` | +| `op_id` | `string?` | `Amendment.op_id` | +| `has_snapshot` | `bool` | Derived: `Amendment.snapshot` is present. The snapshot itself is not returned | +| `changes` | `ChangeView[]` | `Amendment.changes`, each as below | + +`ChangeView` carries the stored `Change` fields (`node_id`, `op`, `path_before?`, `path_after?`, +`field?`, `old?`, `new?`) and two derived ones: + +| Field | Type | Source | +|:--|:--|:--| +| `node_path` | `string?` | Derived: the current path of `node_id`. Absent when the node no longer exists | +| `node_title` | `string?` | Derived: the current `title` of `node_id`. Absent when the node no longer exists | + +A display id can lengthen when a later amendment shares its suffix. Cite `id` for a stable +reference. + +### Worked example + +The whole log of `roadmap-mcp-rework`: one amendment, imported from the legacy row `A1`. + +```json +{ + "read_model_version": "0.1", "format_version": "0.1", "projection": "amendments", + "campaign": { "id": "c_rework", "path": "__roadmap__/roadmap-mcp-rework", + "title": "rdm rework — meta-roadmap" }, + "tree_rev": "tree-1", + "total": 1, + "amendments": [ + { "id": "am_a1", "display_id": "A1", "legacy_id": "A1", + "ts": "2026-11-16T00:00:00Z", "actor": { "kind": "import" }, + "description": "No milestone owned the domain model; also edits the planned leaves m0, m1, m2, m4, m6, m7 and this README, and Eliott chose to keep the label M0b", + "source": "__reports__/rdm_domain_model_review/01-gap_analysis_v0.md", + "has_snapshot": false, + "changes": [ { "node_id": "n_m0b", "op": "add", "node_path": "m0b_domain_model_spec", + "node_title": "M0b Domain model spec" } ] } + ] +} +``` + +With `node=n_m0b` the call returns the same entry. With `node=n_m1` it returns an empty list and +`total` stays 1. `ts` is the row's date at midnight UTC, `actor.kind` is `import` and the change +has no `path_after`, as `stored-schema.md` says of a legacy row. + +## Level and its source + +`level` is the wave of a leaf. Today it is the depth: the number of directories between the +campaign root and the leaf. A leaf in the root has level 0. It is derived from the path and never +stored. + +Every leaf in every projection carries both fields: + +```json +{ "level": 2, "level_source": "depth" } +``` + +| Field | Type | Meaning | +|:--|:--|:--| +| `level` | `integer` | The position of the leaf in the order, from 0 | +| `level_source` | `LevelSource` | The rule that produced `level`. One value today: `depth` | + +Why the source is reported: depth is the only ordering rule, and the ordering open question +(R04) keeps other rules possible. If a rule other than depth is added later, `level` changes +meaning and `level_source` says which. A consumer groups by `level` only for a `level_source` it +knows, and shows a flat list for another. A new `level_source` value is a minor change of the +read-model version (`Versions`). The ready rule does not read `level`: it reads the directory +tree, so a change of `level_source` alone cannot change the ready set. + +Directories have no level. + +## Versions + +Two version numbers, two constants, both in `rdm-schema`. + +| Item | Format version | Read-model version | +|:--|:--|:--| +| Constant | `FORMAT_VERSION` | `READ_MODEL_VERSION` | +| Form | `"MAJOR.MINOR"` string | `"MAJOR.MINOR"` string | +| First value | `"0.1"` | `"0.1"` | +| Where it appears | `schema_version` in every stored file | `read_model_version` in every projection | +| Format of what it covers | The stored files (`stored-schema.md`) | The four projections of this document | +| Bump: minor | A new optional stored field, or a new enum value old readers can ignore | A new optional field, a new projection, a new request parameter, a new `level_source` value | +| Bump: major | A stored field removed, renamed, retyped, given another meaning, or made required | A projection field removed, renamed, retyped or given another meaning; a changed derivation (the ready rule, the order, a status derivation); a required request parameter added | +| Reader | Refuses a file with a higher major, with an upgrade message | A consumer refuses a payload with a higher major | +| While the major is 0 | A reader refuses a higher minor too | A consumer refuses a higher minor too | +| From major 1 | A higher minor is read, unknown fields kept (I12) | A higher minor is read, unknown fields ignored | +| Crate rule | A format major forces a crate major. A format minor forces a crate minor | A read-model major forces a crate major. A read-model minor forces a crate minor | + +The crate is `rdm-schema`. It stays at `0.x` until M7, so no major change reaches the crate +before then: a bump of the format or read-model major would force crate `1.0.0`, so M0b to M7 +change only minors. "Forces a crate minor" means that at least a minor bump of the crate is made; +the crate may bump more for its own reasons. While the crate is `0.x`, a minor bump is the +breaking one in Rust's own rules. + +A format change can leave the read model alone: a new optional stored field that no projection +shows is a format minor and no read-model change. A format major needs a read-model review, +because a projection may read the field that changed. The read-model version moves only if a +projection field does. + +`format_version` in a projection is not the read-model version. It tells a consumer which stored +format the data came from, as the highest `schema_version` among the files read. + +## Gaps + +No stored field a projection needs is missing. Two limits, neither one blocking: + +| Limit | Effect | +|:--|:--| +| An imported leaf has no history | `status_since` is absent and `commit_count` comes from `progress.commits`. Consumers must treat both as optional | +| A display id is not stable | It can lengthen when a later amendment shares its ULID suffix. `id` is the stable key | + +## Decisions + +| # | Decision | Decided | +|:--|:--|:--| +| 1 | The ready set uses the scoped rule: an unfinished leaf holds back only the deeper leaves under its own parent | Eliott, 2026-11-16 | +| 2 | `level` is reported as `{level, level_source: "depth"}` | Eliott, 2026-11-16 | +| 3 | The read-model version is separate from the format version, with its own bump rule and constant. A read-model major or minor forces a crate major or minor, as the format does | coordinator, 2026-11-16 | +| 4 | `held_by` and `holders`: a ready projection names what stalls each leaf by id, with one map of holders to avoid repeating them | coordinator, 2026-11-16 | +| 5 | Sibling order is not stored. Projections order by level, then leaves before directories, then path (`traceability.md`, `Sibling order`) | Eliott, 2026-11-16 | From 0d557dd6969df7f1b478f9a39a1da04dea709202 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:54:16 +0900 Subject: [PATCH 026/183] chore(roadmap): close the m0b read model and start the crate level Co-Authored-By: Claude Opus 5.5 --- __roadmap__/m0b-domain-model-spec/read/README.md | 8 ++++---- __roadmap__/m0b-domain-model-spec/read/crate/README.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/__roadmap__/m0b-domain-model-spec/read/README.md b/__roadmap__/m0b-domain-model-spec/read/README.md index 5420413..28a40b1 100644 --- a/__roadmap__/m0b-domain-model-spec/read/README.md +++ b/__roadmap__/m0b-domain-model-spec/read/README.md @@ -18,8 +18,8 @@ The read model's projections are specified with worked examples, and the crate a ## Status ```mermaid graph TD - read_model[Read model]:::inprogress - crate[Schema crate and R01]:::planned + read_model[Read model]:::done + crate[Schema crate and R01]:::inprogress classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -30,8 +30,8 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `read_model.md` | 📄 Leaf Task | 🔄 In Progress | -| `crate/` | 📁 Directory | ⬜ Planned | +| `read_model.md` | 📄 Leaf Task | ✅ Done | +| `crate/` | 📁 Directory | 🔄 In Progress | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m0b-domain-model-spec/read/crate/README.md b/__roadmap__/m0b-domain-model-spec/read/crate/README.md index 3b82c47..163d37c 100644 --- a/__roadmap__/m0b-domain-model-spec/read/crate/README.md +++ b/__roadmap__/m0b-domain-model-spec/read/crate/README.md @@ -18,8 +18,8 @@ Depth 2 of M0b, its last level. The crate turns the three spec documents into ty ## Status ```mermaid graph TD - rdm_schema_crate[rdm-schema crate]:::planned - r01_sync[R01 sync]:::planned + rdm_schema_crate[rdm-schema crate]:::inprogress + r01_sync[R01 sync]:::inprogress classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -30,8 +30,8 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `rdm_schema_crate.md` | 📄 Leaf Task | ⬜ Planned | -| `r01_sync.md` | 📄 Leaf Task | ⬜ Planned | +| `rdm_schema_crate.md` | 📄 Leaf Task | 🔄 In Progress | +| `r01_sync.md` | 📄 Leaf Task | 🔄 In Progress | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | From 2c2a3ea151bed33bc15b42bd0f3c2a89c18e30f8 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:59:28 +0900 Subject: [PATCH 027/183] docs(design): bring R01 in line with the m0b domain model R01 now points to statuses.md, stored-schema.md, traceability.md and read-model.md and states their decisions: - the five-status machine and the scoped ready rule - sealing in place of reopening done work - comments as files of their own - I5, I8 and I9 restated (I8 is checked at the move to done, since an imported done leaf has no commit SHA) - the format and read-model version rule in the launch section The M0b items leave Deliberately open. I1 and Proposed State are unchanged. Co-Authored-By: Claude Opus 5.5 --- __design__/rdm/architecture.md | 108 +++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 44 deletions(-) diff --git a/__design__/rdm/architecture.md b/__design__/rdm/architecture.md index acabee6..a2c6b1d 100644 --- a/__design__/rdm/architecture.md +++ b/__design__/rdm/architecture.md @@ -6,7 +6,10 @@ once code meets real hosts; points marked *suggestion* are left to the milestone rest stand unless implementation proves them wrong, and then this document changes together with the code. Decisions were taken with the maintainer on 2026-11-11. Amended on 2026-11-16 (A1 of the meta-roadmap): the domain model and the stored types move to a fourth crate, `rdm-schema`, owned by a -spec-first milestone M0b. +spec-first milestone M0b. M0b settled it on 2026-11-16: status meanings in +[statuses.md](statuses.md), the stored schema in [stored-schema.md](stored-schema.md) with its +[traceability.md](traceability.md), and the read model in [read-model.md](read-model.md). Where +this document and those four differ, they win. ## Executive Summary @@ -102,6 +105,7 @@ defect. __roadmap__// _dir.json campaign root _amendments/.json one file per amendment, append-only + _comments/.json one file per comment, append-only .json leaf node /_dir.json directory node /.json @@ -121,32 +125,33 @@ __roadmap__// - **Canonical form:** fixed field order, two-space indent, LF, trailing newline. Multi-line prose is stored as an array of lines, which git merges far better than one escaped string; the API accepts and returns plain strings. -- **Forward compatibility:** every file carries `schema_version`; unknown fields round-trip; a +- **Forward compatibility:** every file carries `schema_version` (`"MAJOR.MINOR"`, first value `"0.1"`); unknown fields round-trip; a reader refuses a newer major version with an upgrade message. JSON Schemas are generated from the Rust types and committed; CI fails when they drift. -Schema sketch (field names *provisional*, owned by M0b, which holds them as types in `rdm-schema`): +The stored types are settled in [stored-schema.md](stored-schema.md) and held by the +`rdm-schema` crate, whose JSON Schemas are generated and checked for drift. In outline: ``` -_dir.json { schema_version, id, kind: campaign|directory, title, context, goal, - references[], preconditions[], success_gates[], gotchas[] } - -.json { schema_version, id, kind: leaf, title, status, blocked_reason?, - goal, preconditions[], success_gates[], references[], - steps[1..5], progress{branch?, notes}, history[] } - -step { id, goal, implementation_logic, deliverables[], checks[{command, expected}], - commit{type, scope, summary}, references[], requires[], done, commit_sha? } - -history { ts, from, to, actor, note?, override? } - -amendment { schema_version, id, ts, actor, description, source?, op_id?, - changes[{node_id, op, path_before?, path_after?, field?, old?, new?}], - snapshot? } +_dir.json { schema_version, id, kind: campaign|directory, title, context, goal, references[], + preconditions[Criterion], success_gates[Criterion], gotchas, notes } +.json { schema_version, id, kind: leaf, title, status, status_reason?, goal, + preconditions[Criterion], success_gates[Criterion], references[], steps[1..5], + progress{branch?, commits?, notes}, history[] } +step { id, title, goal, implementation_logic, deliverables, references[], + checks[{text, expected, command?}], commit{type, scope?, breaking, summary}, + requires?, done, commit_sha?, done_at? } +Criterion { text, met } Reference { label?, title, target?, note? } +history { ts, from, to, actor{kind: agent|human|import, name?}, reason?, override?, op_id? } +comment { schema_version, id, node_id, ts, actor, text } +amendment { schema_version, id, legacy_id?, ts, actor, description, source?, op_id?, + changes[{node_id, op, path_before?, path_after?, field?, old?, new?}], snapshot? } ``` -The sketch omits facts the legacy grammars carry (per-criterion state, step title, the breaking mark of a -commit, a reference shape, a step timestamp, a readable amendment id). M0b decides whether each is stored. +Every legacy grammar production is stored, derived or dropped with a reason in +[traceability.md](traceability.md). The read model that every consumer receives (MCP outputs, +CLI `--json`, the view) is four projections in [read-model.md](read-model.md); each leaf there +reports its `level` together with `level_source: depth`. The amendment log of a node is the set of amendment files whose `changes` name its id. A delete stores the removed subtree in `snapshot`, so it can be restored. @@ -187,39 +192,53 @@ sequenceDiagram - **Retries:** a write may carry an `op_id`; replaying it returns the first result. - **Worktrees are separate copies.** A lock in one worktree does not coordinate with another. Status written on a task branch reaches the coordinator when that branch merges. The coordinator - records `inprogress` in its own tree when it dispatches a leaf. + records `ongoing` in its own tree when it dispatches a leaf. ## Graph operations - **Load and validate** a whole campaign, returning diagnostics with a stable code, a severity, a path and a JSON pointer. -- **Order.** The wave of a leaf is its depth. A leaf is ready when it is not done and every leaf of - smaller depth is done. Leaves before sibling directories follows from depth. Wave semantics are - global: a leaf also waits for shallower leaves in unrelated branches. +- **Order.** The wave of a leaf is its depth, shown as `level`. A leaf is ready when it is + `planned` and every leaf that holds it back is `done` or `cancelled`. The rule is scoped + (Eliott, 2026-11-16): an unfinished leaf holds back only the deeper leaves under its own + parent, never a leaf in an unrelated branch. Waves are a display of depth, not a readiness + fact. Details and examples in [statuses.md](statuses.md) §Ready set. - **Status FSM.** ```mermaid stateDiagram-v2 [*] --> planned - planned --> inprogress - inprogress --> done - planned --> blocked - inprogress --> blocked - blocked --> inprogress - done --> amendment: content edit - amendment --> inprogress - amendment --> done: re-verified + planned --> ongoing + planned --> paused + planned --> cancelled + ongoing --> paused + ongoing --> cancelled + ongoing --> done + paused --> planned + paused --> ongoing + paused --> cancelled + cancelled --> planned: undo, to the pre-cancel status + cancelled --> ongoing: undo + cancelled --> paused: undo + done --> [*] ``` - `done` requires every step recorded done with its commit. Starting a leaf outside the ready set - is refused unless an override with a reason is given, and the override is recorded. A directory's - status is derived from its descendants. + The full table of moves, who may make them and their reasons is in [statuses.md](statuses.md). + `done` is the only terminal status. Entering `paused` or `cancelled` needs a reason, and undoing + a cancel restores the status before it. Pausing or cancelling a directory applies to every + non-terminal leaf under it as one operation, and a directory cancel is undone through its + `op_id`. `done` requires every step recorded done with its commit. Starting a leaf outside the + ready set is refused unless an override with a reason is given, and the override is recorded. + A directory's status is derived from its leaves. **Sealing:** a `done` node's content never + changes, and a `cancelled` node's content is sealed while it is cancelled; both accept only + appended comments. Every content edit to a `planned`, `ongoing` or `paused` node carries an + amendment description. - **Primitives:** add, remove (subtree), set field, rename, move to another parent. - **Composites,** each expanding to primitives: wrap siblings in a new level, unwrap a level, split a leaf, merge leaves, promote a leaf to a directory, reorder steps, "run X after Y" (expressed as depth edits, with candidate plans ranked by nodes moved). -- **Impact analysis** on every structural edit: wave changes per node, done work reopened, progress - destroyed, in-progress leaves moved. A destructive effect needs an explicit acknowledgement. +- **Impact analysis** on every structural edit: wave changes per node, leaves made ready by a cancel, + progress destroyed, ongoing leaves moved. A destructive effect needs an explicit acknowledgement. - **Batch:** an ordered list of operations, validated one by one and as a whole, applied atomically, with a dry-run. Later operations may refer to nodes created earlier in the batch. @@ -261,7 +280,7 @@ receives the same data as text and structured content. | Flow | Sequence | |:--|:--| | Author a campaign | `init` with a nested tree, then `validate`. | -| Execute | `next` → `transition` to `inprogress` → work → `transition` recording each step's commit → `transition` to `done`. | +| Execute | `next` → `transition` to `ongoing` → work → `transition` recording each step's commit → `transition` to `done`. | | Edit a field | `get` (revision) → `update` with the new value and the amendment description. | | Re-plan | `apply` with dry-run → read the impact report → `apply` with acknowledgements. | | Read as a human | `rdm export ` or `roadmap_export`. | @@ -275,11 +294,11 @@ receives the same data as text and structured content. | I2 | A consumer holds no roadmap logic; the CLI and the MCP tools give the same result on the same input. | | I3 | No write leaves a campaign in a state `validate` rejects, including after a crash at any point. | | I4 | A write based on a stale revision is refused and changes nothing. | -| I5 | Every content or structure edit produces exactly one amendment with a non-empty description. Status and progress never do. | +| I5 | Every content or structure edit produces exactly one amendment with a non-empty description. Status, progress, criterion marks and comments never do. A sealed node accepts no content edit. | | I6 | Derived data is never stored. | | I7 | A node's `id` never changes; a rename or move changes only its path. | -| I8 | A leaf is `done` only when every step is done with its commit recorded. | -| I9 | Deleting or reopening done work, or moving work in progress, needs an explicit acknowledgement. | +| I8 | The move to `done` is allowed only when every step is done with its commit recorded; it is checked at that move. A stored `done` leaf has every step done (a leaf imported from legacy markdown has no commit SHA, and keeps its legacy count in `progress.commits`). | +| I9 | Deleting sealed work, or moving ongoing work, needs an explicit acknowledgement. Nothing reopens done work: new work is a new node. | | I10 | The server keeps no state between calls; every call names its campaign. | | I11 | No tool requires user interaction, and no read tool writes. | | I12 | A reader never drops a field it does not know. | @@ -287,7 +306,8 @@ receives the same data as text and structured content. ## Launch and distribution (*provisional*, owned by M7) - **Publication:** the four crates on crates.io, released by CI after a merge to `main` - (`release-plz`; `rdm-schema` on its own version line, the other three on one product version), beside the existing skill releases. In one workflow run: + (`release-plz`; `rdm-schema` on its own version line, the other three on one product version; a format or + read-model major forces an `rdm-schema` major and a minor a minor, as in [read-model.md](read-model.md) §Versions), beside the existing skill releases. In one workflow run: crates (schema, core, then server and CLI), then prebuilt binaries and checksums on the GitHub release, then the plugin pinned to that version. The plugin never names an unpublished server. - **Launch:** the plugin runs `rdm-mcp serve --require-version X.Y.Z`. A binary of another version @@ -307,7 +327,7 @@ receives the same data as text and structured content. | Revisions | Counter / **content hash** | hash | No base to merge from, so a conflict is refused, never merged | | Lock | Lock file as existence / per file / **one OS lock per campaign** | per campaign | Writers on one campaign are serialised, for milliseconds | | Amendment scope | Every write / **content and structure** | content and structure | Status history is kept apart from the amendment log | -| Mutation policy | Additive only / **full CRUD with guards on done work** | full CRUD | History lives in amendments, not in undeletable nodes | +| Mutation policy | Additive only / **full CRUD, with done and cancelled nodes sealed** | full CRUD | History lives in amendments, not in undeletable nodes | | Consumers | MCP only / **MCP and CLI over one core** | both | A second surface to keep thin | | UI | None / server-rendered image / **Svelte page as an MCP App** | Svelte | A Node build in CI and a committed artefact | | Registry | PyPI wheels / npm / **crates.io** | crates.io | No pinned-run launcher, hence the self-provisioning launch | @@ -330,7 +350,7 @@ receives the same data as text and structured content. ## Deliberately open -Decided by the milestone that owns it: field names, status meanings, the read model and the format version (M0b); the id minting and the journal format (M1); the +Decided by the milestone that owns it: the id minting and the journal format (M1); the exact operation set and its error codes (M2); whether a cross-worktree claim hint is worth having (M2); markdown layout of the export and what the importer does with invalid input (M3); tool names, count and output budgets (M4); CLI verbs and output style (M5); layout and refresh of the view From 770127a6cf48d1db0ebb7b0948df7556b101b687 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 16:02:23 +0900 Subject: [PATCH 028/183] chore(roadmap): name the rdm-schema types after the spec documents The crate leaf listed provisional type names. The crate follows stored-schema.md and read-model.md, and the verifier judged each rename sound. Co-Authored-By: Claude Opus 5.5 --- .../m0b-domain-model-spec/read/crate/rdm_schema_crate.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__roadmap__/m0b-domain-model-spec/read/crate/rdm_schema_crate.md b/__roadmap__/m0b-domain-model-spec/read/crate/rdm_schema_crate.md index cae0a11..335ebfd 100644 --- a/__roadmap__/m0b-domain-model-spec/read/crate/rdm_schema_crate.md +++ b/__roadmap__/m0b-domain-model-spec/read/crate/rdm_schema_crate.md @@ -24,7 +24,7 @@ 6. **Tests:** - Each type deserialises the matching example from the spec documents. - The unknown-field round trip works at every object level. -**Deliverables**: `crates/rdm-schema/Cargo.toml`; `crates/rdm-schema/src/lib.rs`: consts `FORMAT_VERSION`, `READ_MODEL_VERSION`; `crates/rdm-schema/src/stored.rs`: types `Directory`, `Leaf`, `Step`, `Criterion`, `Reference`, `Commit`, `HistoryEntry`, `Comment`, `Amendment`, `Change`, enum `Status`; `crates/rdm-schema/tests/stored.rs`; `Cargo.lock` +**Deliverables**: `crates/rdm-schema/Cargo.toml`; `crates/rdm-schema/src/lib.rs`: consts `FORMAT_VERSION`, `READ_MODEL_VERSION`; `crates/rdm-schema/src/stored.rs`: types `Directory`, `Leaf`, `Step`, `Criterion`, `Reference`, `Commit`, `Check`, `Progress`, `Actor`, `History`, `Comment`, `Amendment`, `Change`, enum `Status` (names follow stored-schema.md); `crates/rdm-schema/tests/stored.rs`; `Cargo.lock` **Consistency Checks**: `cargo test -p rdm-schema` (expected: PASS) **Commit**: `feat(rdm-schema): add the stored types and the format version` @@ -33,7 +33,7 @@ **Implementation Logic**: 1. Add one type per projection of `read-model.md`, with `Level { level, level_source }` where `level_source` is an enum holding only `Depth` for now. 2. The worked examples from `read-model.md`, saved as test fixtures, deserialise and re-serialise to equal JSON. -**Deliverables**: `crates/rdm-schema/src/read.rs`: types `CampaignOutline`, `NodeDetail`, `ReadySet`, `AmendmentLog`, `Level`, enum `LevelSource`; `crates/rdm-schema/tests/read.rs`; `crates/rdm-schema/tests/fixtures/*.json` +**Deliverables**: `crates/rdm-schema/src/read.rs`: types `Envelope`, `OutlineView`, `NodeView`, `ReadyView`, `AmendmentsView`, flat `level` and `level_source` fields, enum `LevelSource` (names follow read-model.md); `crates/rdm-schema/tests/read.rs`; `crates/rdm-schema/tests/fixtures/*.json` **Consistency Checks**: `cargo test -p rdm-schema` (expected: PASS) **Commit**: `feat(rdm-schema): add the read-model types` From 513b6c430b47b419abbf44266f3f59472d7841eb Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:57:00 +0900 Subject: [PATCH 029/183] feat(rdm-schema): add the stored types and the format version Co-Authored-By: Claude Sonnet 5.5 --- Cargo.lock | 170 +++++++++++ crates/rdm-schema/Cargo.toml | 14 + crates/rdm-schema/src/lib.rs | 43 +++ crates/rdm-schema/src/stored.rs | 275 ++++++++++++++++++ crates/rdm-schema/tests/common/mod.rs | 55 ++++ .../tests/fixtures/stored_amendment.json | 35 +++ .../tests/fixtures/stored_comment.json | 15 + .../tests/fixtures/stored_directory.json | 26 ++ .../tests/fixtures/stored_leaf.json | 96 ++++++ crates/rdm-schema/tests/stored.rs | 83 ++++++ 10 files changed, 812 insertions(+) create mode 100644 Cargo.lock create mode 100644 crates/rdm-schema/Cargo.toml create mode 100644 crates/rdm-schema/src/lib.rs create mode 100644 crates/rdm-schema/src/stored.rs create mode 100644 crates/rdm-schema/tests/common/mod.rs create mode 100644 crates/rdm-schema/tests/fixtures/stored_amendment.json create mode 100644 crates/rdm-schema/tests/fixtures/stored_comment.json create mode 100644 crates/rdm-schema/tests/fixtures/stored_directory.json create mode 100644 crates/rdm-schema/tests/fixtures/stored_leaf.json create mode 100644 crates/rdm-schema/tests/stored.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f030af2 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,170 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rdm-schema" +version = "0.1.0" +dependencies = [ + "schemars", + "serde", + "serde_json", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "dyn-clone", + "ref-cast", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_derive_internals" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/crates/rdm-schema/Cargo.toml b/crates/rdm-schema/Cargo.toml new file mode 100644 index 0000000..678ac52 --- /dev/null +++ b/crates/rdm-schema/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "rdm-schema" +version = "0.1.0" +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +description = "Stored types, read-model types and version constants of the rdm roadmap format" +publish = false + +[dependencies] +serde = { version = "1", features = ["derive"] } +serde_json = "1" +schemars = "1" diff --git a/crates/rdm-schema/src/lib.rs b/crates/rdm-schema/src/lib.rs new file mode 100644 index 0000000..f798f61 --- /dev/null +++ b/crates/rdm-schema/src/lib.rs @@ -0,0 +1,43 @@ +//! Stored types, read-model types and version constants of the rdm roadmap format. +//! +//! This crate holds types only. It has no I/O and no store. Canonical serialisation +//! and the store belong to M1. + +pub mod stored; + +/// A `(major, minor)` pair, comparable field by field. +pub type Version = (u16, u16); + +/// Format version of the stored files (`schema_version`), `"0.1"`. +pub const FORMAT_VERSION: Version = (0, 1); + +/// Version of the read model (`read_model_version`), `"0.1"`. Separate from the format. +pub const READ_MODEL_VERSION: Version = (0, 1); + +/// Renders a version as the `"MAJOR.MINOR"` string stored in files and payloads. +#[must_use] +pub fn version_string(v: Version) -> String { + format!("{}.{}", v.0, v.1) +} + +/// Parses `"MAJOR.MINOR"`. Returns `None` for any other form. +#[must_use] +pub fn parse_version(s: &str) -> Option { + let (major, minor) = s.split_once('.')?; + Some((major.parse().ok()?, minor.parse().ok()?)) +} + +/// Whether a reader that supports `supported` may read data stamped `found`. +/// +/// A higher major is refused. While the supported major is 0, a higher minor is refused +/// too. From major 1, a higher minor is read. Lower versions are read. +#[must_use] +pub fn is_readable(found: Version, supported: Version) -> bool { + if found.0 > supported.0 { + return false; + } + if found.0 == supported.0 && supported.0 == 0 && found.1 > supported.1 { + return false; + } + true +} diff --git a/crates/rdm-schema/src/stored.rs b/crates/rdm-schema/src/stored.rs new file mode 100644 index 0000000..8766588 --- /dev/null +++ b/crates/rdm-schema/src/stored.rs @@ -0,0 +1,275 @@ +//! The stored schema (`stored-schema.md`). Field order is the canonical order. + +use schemars::JsonSchema; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_json::{Map, Value}; + +/// A multi-line prose field, stored as one line per element. +pub type Lines = Vec; +/// A UTC instant, RFC 3339. +pub type Ts = String; + +/// Unknown keys of an object, kept in order and written back after the known ones (I12). +pub type Extra = Map; + +/// The five statuses of a leaf (`statuses.md`). +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "lowercase")] +pub enum Status { + Planned, + Ongoing, + Paused, + Cancelled, + Done, +} + +/// `Directory.kind`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "lowercase")] +pub enum DirectoryKind { + Campaign, + Directory, +} + +/// `Leaf.kind`, the one value `leaf`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "lowercase")] +pub enum LeafKind { + Leaf, +} + +/// `Check.expected`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub enum Expected { + #[serde(rename = "PASS")] + Pass, + #[serde(rename = "FAIL")] + Fail, +} + +/// `Actor.kind`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "lowercase")] +pub enum ActorKind { + Agent, + Human, + Import, +} + +/// `Change.op`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "lowercase")] +pub enum ChangeOp { + Add, + Remove, + Set, + Rename, + Move, +} + +/// `_dir.json`: the campaign root and every directory node. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Directory { + pub schema_version: String, + pub id: String, + pub kind: DirectoryKind, + pub title: String, + pub context: Lines, + pub references: Vec, + pub goal: String, + pub preconditions: Vec, + pub success_gates: Vec, + pub gotchas: Lines, + pub notes: Lines, + #[serde(flatten)] + pub extra: Extra, +} + +/// `.json`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Leaf { + pub schema_version: String, + pub id: String, + pub kind: LeafKind, + pub title: String, + pub status: Status, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status_reason: Option, + pub goal: String, + pub preconditions: Vec, + pub success_gates: Vec, + pub references: Vec, + pub steps: Vec, + pub progress: Progress, + pub history: Vec, + #[serde(flatten)] + pub extra: Extra, +} + +/// `Leaf.progress`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Progress { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commits: Option, + pub notes: Lines, + #[serde(flatten)] + pub extra: Extra, +} + +/// An element of `Leaf.steps`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Step { + pub id: String, + pub title: String, + pub goal: String, + pub implementation_logic: Lines, + pub deliverables: Lines, + pub references: Vec, + pub checks: Vec, + pub commit: Commit, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub requires: Option, + pub done: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit_sha: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub done_at: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// An element of `Step.checks`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Check { + pub text: String, + pub expected: Expected, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub command: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// An element of `preconditions` or `success_gates`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Criterion { + pub text: String, + pub met: bool, + #[serde(flatten)] + pub extra: Extra, +} + +/// An element of `references`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Reference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + pub title: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub note: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// `Step.commit`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Commit { + #[serde(rename = "type")] + pub r#type: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + pub breaking: bool, + pub summary: String, + #[serde(flatten)] + pub extra: Extra, +} + +/// An element of `Leaf.history`: one status move. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct History { + pub ts: Ts, + pub from: Status, + pub to: Status, + pub actor: Actor, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub r#override: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub op_id: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// Who made a move, a comment or an amendment. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Actor { + pub kind: ActorKind, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// `_comments/.json`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Comment { + pub schema_version: String, + pub id: String, + pub node_id: String, + pub ts: Ts, + pub actor: Actor, + pub text: Lines, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub op_id: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// `_amendments/.json`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Amendment { + pub schema_version: String, + pub id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub legacy_id: Option, + pub ts: Ts, + pub actor: Actor, + pub description: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub op_id: Option, + pub changes: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// An element of `Amendment.changes`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Change { + pub node_id: String, + pub op: ChangeOp, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path_before: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path_after: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub field: Option, + #[serde(default, deserialize_with = "some_value", skip_serializing_if = "Option::is_none")] + pub old: Option, + #[serde(default, deserialize_with = "some_value", skip_serializing_if = "Option::is_none")] + pub new: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// Keeps a JSON `null` as `Some(Value::Null)`, so "absent" and "null" stay distinct. +fn some_value<'de, D: Deserializer<'de>>(d: D) -> Result, D::Error> { + Value::deserialize(d).map(Some) +} diff --git a/crates/rdm-schema/tests/common/mod.rs b/crates/rdm-schema/tests/common/mod.rs new file mode 100644 index 0000000..91a7980 --- /dev/null +++ b/crates/rdm-schema/tests/common/mod.rs @@ -0,0 +1,55 @@ +#![allow(dead_code)] +use serde::{Serialize, de::DeserializeOwned}; +use serde_json::{Value, json}; + +pub fn fixture(name: &str) -> Value { + let path = format!("{}/tests/fixtures/{name}", env!("CARGO_MANIFEST_DIR")); + let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{path}: {e}")); + serde_json::from_str(&text).unwrap() +} + +/// Deserialise to `T`, serialise back, and require equal JSON values. +pub fn round_trip(v: &Value) { + let t: T = serde_json::from_value(v.clone()).unwrap_or_else(|e| panic!("deserialise: {e}")); + assert_eq!(&serde_json::to_value(&t).unwrap(), v); +} + +/// Adds an unknown key to every object that is a typed object. Maps and opaque JSON values +/// (`holders`, `snapshot`, `old`, `new`) get none themselves; `holders` entries do. +pub fn inject_unknown(v: &mut Value, path: &str) -> usize { + let mut n = 0; + match v { + Value::Array(a) => { + for (i, x) in a.iter_mut().enumerate() { + n += inject_unknown(x, &format!("{path}[{i}]")); + } + } + Value::Object(m) => { + for (k, x) in m.iter_mut() { + match k.as_str() { + "snapshot" | "old" | "new" => {} + "holders" => { + if let Value::Object(h) = x { + for (_, e) in h.iter_mut() { + n += inject_unknown(e, &format!("{path}.holders.*")); + } + } + } + _ => n += inject_unknown(x, &format!("{path}.{k}")), + } + } + m.insert("x_unknown".into(), json!({ "at": path, "keep": [1, "two", null] })); + n += 1; + } + _ => {} + } + n +} + +/// Fixture + unknown field at every object level must survive a round trip. +pub fn unknown_fields_survive(name: &str) -> usize { + let mut v = fixture(name); + let n = inject_unknown(&mut v, "$"); + round_trip::(&v); + n +} diff --git a/crates/rdm-schema/tests/fixtures/stored_amendment.json b/crates/rdm-schema/tests/fixtures/stored_amendment.json new file mode 100644 index 0000000..d09974d --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/stored_amendment.json @@ -0,0 +1,35 @@ +{ + "schema_version": "0.1", + "id": "01JD0000000000000000000002", + "ts": "2026-11-16T12:30:00Z", + "actor": { + "kind": "agent" + }, + "description": "Edit a goal and remove a node", + "source": "__reports__/x.md", + "changes": [ + { + "node_id": "n_m1", + "op": "set", + "field": "/goal", + "old": "before", + "new": null + }, + { + "node_id": "n_m2", + "op": "remove", + "path_before": "core/m2" + }, + { + "node_id": "n_m3", + "op": "move", + "path_before": "a/m3", + "path_after": "b/m3" + } + ], + "snapshot": { + "core/m2.json": { + "id": "n_m2" + } + } +} diff --git a/crates/rdm-schema/tests/fixtures/stored_comment.json b/crates/rdm-schema/tests/fixtures/stored_comment.json new file mode 100644 index 0000000..bda1969 --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/stored_comment.json @@ -0,0 +1,15 @@ +{ + "schema_version": "0.1", + "id": "01JD0000000000000000000001", + "node_id": "n_m1", + "ts": "2026-11-16T12:00:00Z", + "actor": { + "kind": "human", + "name": "eliott" + }, + "text": [ + "A comment.", + "Second line." + ], + "op_id": "op2" +} diff --git a/crates/rdm-schema/tests/fixtures/stored_directory.json b/crates/rdm-schema/tests/fixtures/stored_directory.json new file mode 100644 index 0000000..6547c75 --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/stored_directory.json @@ -0,0 +1,26 @@ +{ + "schema_version": "0.1", + "id": "d_core", + "kind": "directory", + "title": "Core", + "context": [ + "Depth 1 of the meta-roadmap. Runs after `m0_feasibility_spike`, which proves the stack and creates the workspace.", + "M1 builds the store every later milestone writes through." + ], + "references": [], + "goal": "`rdm-engine` holds a roadmap as JSON files that many processes can read and write safely.", + "preconditions": [ + { + "text": "`m0_feasibility_spike.md` is `done` with a go", + "met": false + } + ], + "success_gates": [ + { + "text": "`m1_core_foundation.md` is `done`", + "met": false + } + ], + "gotchas": [], + "notes": [] +} diff --git a/crates/rdm-schema/tests/fixtures/stored_leaf.json b/crates/rdm-schema/tests/fixtures/stored_leaf.json new file mode 100644 index 0000000..4f4684d --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/stored_leaf.json @@ -0,0 +1,96 @@ +{ + "schema_version": "0.1", + "id": "n_m1", + "kind": "leaf", + "title": "M1 Core foundation", + "status": "ongoing", + "goal": "`rdm-engine` stores a roadmap as JSON, one file per node, and N processes can read and write one campaign without losing or tearing a write.", + "preconditions": [ + { + "text": "`../m0_feasibility_spike.md` is `done` with a go", + "met": false + }, + { + "text": "`../m0b_domain_model_spec.md` is `done`", + "met": false + }, + { + "text": "Reminder `skills-rdm-M1` read", + "met": false + } + ], + "success_gates": [ + { + "text": "`rdm-engine` depends on `rdm-schema` for every stored type and holds none of its own; a file with a newer format major is refused with an upgrade message", + "met": false + } + ], + "references": [ + { + "label": "R01", + "title": "§Data Model, §Concurrency, §Contracts & Invariants", + "target": "../../../__design__/rdm/architecture.md", + "note": "the file layout, the schema sketch, the lock, the journal and the revisions" + } + ], + "steps": [ + { + "id": "s_m1_1", + "title": "Plan the milestone", + "goal": "The campaign `__roadmap__/m1-core-foundation/` exists and Eliott has approved it.", + "implementation_logic": [ + "In plan mode, author the campaign with `managing-roadmaps`, deciding: the id minting, to the format M0b fixes; … [cut]" + ], + "deliverables": [ + "`__roadmap__/m1-core-foundation/README.md` and its leaves" + ], + "references": [], + "checks": [ + { + "text": "`bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m1-core-foundation/`", + "expected": "PASS" + } + ], + "commit": { + "type": "chore", + "scope": "roadmap", + "breaking": false, + "summary": "plan the m1-core-foundation milestone" + }, + "done": false, + "requires": [ + "a prose prerequisite" + ] + } + ], + "progress": { + "branch": "task/m1", + "commits": 1, + "notes": [ + "first note" + ] + }, + "history": [ + { + "ts": "2026-11-16T10:20:30Z", + "from": "planned", + "to": "paused", + "actor": { + "kind": "agent", + "name": "session-1" + }, + "reason": "waiting for M0b", + "op_id": "op1" + }, + { + "ts": "2026-11-16T11:00:00Z", + "from": "paused", + "to": "ongoing", + "actor": { + "kind": "human" + }, + "reason": "unblocked", + "override": true + } + ] +} diff --git a/crates/rdm-schema/tests/stored.rs b/crates/rdm-schema/tests/stored.rs new file mode 100644 index 0000000..d4b0d1c --- /dev/null +++ b/crates/rdm-schema/tests/stored.rs @@ -0,0 +1,83 @@ +mod common; +use common::*; +use rdm_schema::stored::*; +use rdm_schema::*; + +#[test] +fn leaf_fixture_round_trips() { + round_trip::(&fixture("stored_leaf.json")); +} +#[test] +fn directory_fixture_round_trips() { + round_trip::(&fixture("stored_directory.json")); +} +#[test] +fn comment_fixture_round_trips() { + round_trip::(&fixture("stored_comment.json")); +} +#[test] +fn amendment_fixture_round_trips_and_keeps_null_new() { + let v = fixture("stored_amendment.json"); + round_trip::(&v); + let a: Amendment = serde_json::from_value(v).unwrap(); + assert_eq!(a.changes[0].new, Some(serde_json::Value::Null)); + assert_eq!(a.changes[1].new, None); +} + +#[test] +fn unknown_fields_survive_at_every_level() { + assert!(unknown_fields_survive::("stored_leaf.json") >= 12); + assert!(unknown_fields_survive::("stored_directory.json") >= 3); + assert!(unknown_fields_survive::("stored_comment.json") >= 2); + assert!(unknown_fields_survive::("stored_amendment.json") >= 5); +} + +#[test] +fn unknown_field_keeps_its_place_after_known_ones() { + let mut v = fixture("stored_comment.json"); + v["zzz"] = serde_json::json!(1); + let c: Comment = serde_json::from_value(v).unwrap(); + let s = serde_json::to_string(&c).unwrap(); + assert!(s.find("\"op_id\"").unwrap() < s.find("\"zzz\"").unwrap()); +} + +#[test] +fn status_is_lowercase_and_has_five_values() { + let all = [Status::Planned, Status::Ongoing, Status::Paused, Status::Cancelled, Status::Done]; + let names: Vec<_> = all.iter().map(|s| serde_json::to_string(s).unwrap()).collect(); + assert_eq!(names, ["\"planned\"", "\"ongoing\"", "\"paused\"", "\"cancelled\"", "\"done\""]); + assert!(serde_json::from_str::("\"blocked\"").is_err()); +} + +#[test] +fn absent_optionals_stay_absent() { + let c: Commit = serde_json::from_str(r#"{"type":"docs","breaking":false,"summary":"x"}"#).unwrap(); + assert_eq!(c.scope, None); + assert_eq!(serde_json::to_string(&c).unwrap(), r#"{"type":"docs","breaking":false,"summary":"x"}"#); +} + +#[test] +fn version_constants_and_strings() { + assert_eq!(FORMAT_VERSION, (0, 1)); + assert_eq!(READ_MODEL_VERSION, (0, 1)); + assert_eq!(version_string(FORMAT_VERSION), "0.1"); + assert_eq!(parse_version("0.1"), Some((0, 1))); + assert_eq!(parse_version("1"), None); + assert_eq!(parse_version("a.b"), None); + assert!(is_readable(parse_version(&version_string(FORMAT_VERSION)).unwrap(), FORMAT_VERSION)); +} + +#[test] +fn reader_refuses_per_the_read_model_rule() { + // Higher major: refused. + assert!(!is_readable((1, 0), (0, 1))); + assert!(!is_readable((2, 0), (1, 5))); + // Major 0: a higher minor is refused too. + assert!(!is_readable((0, 2), (0, 1))); + // Same or lower: read. + assert!(is_readable((0, 1), (0, 1))); + assert!(is_readable((0, 0), (0, 1))); + // From major 1: a higher minor is read. + assert!(is_readable((1, 3), (1, 1))); + assert!(!is_readable((2, 0), (1, 1))); +} From 64b8ba28398bdac3bee00d26f968d40b05790bfe Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:57:41 +0900 Subject: [PATCH 030/183] feat(rdm-schema): add the read-model types Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-schema/src/lib.rs | 1 + crates/rdm-schema/src/read.rs | 340 +++++++++++++++ .../rdm-schema/tests/fixtures/amendments.json | 34 ++ crates/rdm-schema/tests/fixtures/node.json | 107 +++++ crates/rdm-schema/tests/fixtures/outline.json | 393 ++++++++++++++++++ crates/rdm-schema/tests/fixtures/ready.json | 175 ++++++++ .../tests/fixtures/ready_scoped.json | 40 ++ crates/rdm-schema/tests/read.rs | 63 +++ 8 files changed, 1153 insertions(+) create mode 100644 crates/rdm-schema/src/read.rs create mode 100644 crates/rdm-schema/tests/fixtures/amendments.json create mode 100644 crates/rdm-schema/tests/fixtures/node.json create mode 100644 crates/rdm-schema/tests/fixtures/outline.json create mode 100644 crates/rdm-schema/tests/fixtures/ready.json create mode 100644 crates/rdm-schema/tests/fixtures/ready_scoped.json create mode 100644 crates/rdm-schema/tests/read.rs diff --git a/crates/rdm-schema/src/lib.rs b/crates/rdm-schema/src/lib.rs index f798f61..3f5967a 100644 --- a/crates/rdm-schema/src/lib.rs +++ b/crates/rdm-schema/src/lib.rs @@ -3,6 +3,7 @@ //! This crate holds types only. It has no I/O and no store. Canonical serialisation //! and the store belong to M1. +pub mod read; pub mod stored; /// A `(major, minor)` pair, comparable field by field. diff --git a/crates/rdm-schema/src/read.rs b/crates/rdm-schema/src/read.rs new file mode 100644 index 0000000..f162ac3 --- /dev/null +++ b/crates/rdm-schema/src/read.rs @@ -0,0 +1,340 @@ +//! The read model (`read-model.md`): four projections over the stored files. + +use std::collections::BTreeMap; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::stored::{ + Actor, Change, Comment, Criterion, Extra, History, Lines, Progress, Reference, Status, Step, Ts, +}; + +/// The rule that produced a `level`. One value today. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "lowercase")] +pub enum LevelSource { + Depth, +} + +/// Which projection a payload is. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "lowercase")] +pub enum Projection { + Outline, + Node, + Ready, + Amendments, +} + +/// `NodeKind` of a child reference. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "lowercase")] +pub enum NodeKind { + Leaf, + Directory, +} + +/// Identity of the campaign in an envelope. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct CampaignRef { + pub id: String, + pub path: String, + pub title: String, + #[serde(flatten)] + pub extra: Extra, +} + +/// The fields every projection starts with. Flattened into each view, whose own `extra` +/// keeps the unknown fields. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Envelope { + pub read_model_version: String, + pub format_version: String, + pub projection: Projection, + pub campaign: CampaignRef, + pub tree_rev: String, +} + +/// Leaves counted by status. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct StatusCounts { + pub planned: u32, + pub ongoing: u32, + pub paused: u32, + pub cancelled: u32, + pub done: u32, + #[serde(flatten)] + pub extra: Extra, +} + +/// `{done, total}` of a leaf's steps. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct StepCounts { + pub done: u32, + pub total: u32, + #[serde(flatten)] + pub extra: Extra, +} + +/// A leaf that holds another back. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Holder { + pub path: String, + pub title: String, + pub status: Status, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status_reason: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// One wave of the outline. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct WaveView { + pub level: u32, + pub level_source: LevelSource, + pub leaf_ids: Vec, + pub counts: StatusCounts, + #[serde(flatten)] + pub extra: Extra, +} + +/// A directory in the outline. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct OutlineDirectory { + pub id: String, + pub path: String, + pub title: String, + pub is_campaign: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub goal: Option, + pub status: Status, + pub counts: StatusCounts, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub amendment_count: Option, + pub rev: String, + pub children: Vec, + #[serde(flatten)] + pub extra: Extra, +} + +/// A leaf in the outline. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct OutlineLeaf { + pub id: String, + pub path: String, + pub title: String, + pub status: Status, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status_reason: Option, + pub level: u32, + pub level_source: LevelSource, + pub ready: bool, + pub steps: StepCounts, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub added_by: Option, + pub rev: String, + #[serde(flatten)] + pub extra: Extra, +} + +/// A node of the outline, discriminated by `kind`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "kind", rename_all = "lowercase")] +pub enum OutlineNode { + Directory(OutlineDirectory), + Leaf(OutlineLeaf), +} + +/// The campaign outline with waves. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct OutlineView { + #[serde(flatten)] + pub envelope: Envelope, + pub root: OutlineNode, + pub waves: Vec, + #[serde(flatten)] + pub extra: Extra, +} + +/// A stored step plus its derived number. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct StepView { + pub number: u32, + #[serde(flatten)] + pub step: Step, +} + +/// A child in a directory's detail. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct ChildRef { + pub id: String, + pub path: String, + pub kind: NodeKind, + pub title: String, + pub status: Status, + #[serde(flatten)] + pub extra: Extra, +} + +/// Detail of a leaf. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct LeafDetail { + pub id: String, + pub path: String, + pub parent: String, + pub rev: String, + pub title: String, + pub status: Status, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status_reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status_since: Option, + pub level: u32, + pub level_source: LevelSource, + pub ready: bool, + pub held_by: Vec, + pub sealed: bool, + pub goal: String, + pub preconditions: Vec, + pub success_gates: Vec, + pub references: Vec, + pub steps: Vec, + pub progress: Progress, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit_count: Option, + pub step_progress: StepCounts, + pub history: Vec, + pub comments: Vec, + pub amendments: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub added_by: Option, + #[serde(flatten)] + pub extra: Extra, +} + +/// Detail of a directory or the campaign root. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct DirectoryDetail { + pub id: String, + pub path: String, + pub parent: String, + pub rev: String, + pub title: String, + pub sealed: bool, + pub comments: Vec, + pub amendments: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub added_by: Option, + pub is_campaign: bool, + pub status: Status, + pub counts: StatusCounts, + pub context: Lines, + pub goal: String, + pub preconditions: Vec, + pub success_gates: Vec, + pub references: Vec, + pub gotchas: Lines, + pub notes: Lines, + pub children: Vec, + #[serde(flatten)] + pub extra: Extra, +} + +/// The detail of one node, discriminated by `kind`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "kind", rename_all = "lowercase")] +pub enum NodeDetail { + Leaf(LeafDetail), + Directory(DirectoryDetail), +} + +/// Node detail. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct NodeView { + #[serde(flatten)] + pub envelope: Envelope, + pub node: NodeDetail, + pub holders: BTreeMap, + #[serde(flatten)] + pub extra: Extra, +} + +/// A `planned` leaf that nothing holds back. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct ReadyLeaf { + pub id: String, + pub path: String, + pub title: String, + pub level: u32, + pub level_source: LevelSource, + #[serde(flatten)] + pub extra: Extra, +} + +/// A `planned` leaf held back by unfinished leaves. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct StalledLeaf { + pub id: String, + pub path: String, + pub title: String, + pub level: u32, + pub level_source: LevelSource, + pub held_by: Vec, + #[serde(flatten)] + pub extra: Extra, +} + +/// The ready set with what stalls the rest. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct ReadyView { + #[serde(flatten)] + pub envelope: Envelope, + pub ready: Vec, + pub stalled: Vec, + pub holders: BTreeMap, + #[serde(flatten)] + pub extra: Extra, +} + +/// A stored change plus the node's current path and title. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct ChangeView { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub node_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub node_title: Option, + #[serde(flatten)] + pub change: Change, +} + +/// One amendment of the log. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct AmendmentEntry { + pub id: String, + pub display_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub legacy_id: Option, + pub ts: Ts, + pub actor: Actor, + pub description: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub op_id: Option, + pub has_snapshot: bool, + pub changes: Vec, + #[serde(flatten)] + pub extra: Extra, +} + +/// The amendment log. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct AmendmentsView { + #[serde(flatten)] + pub envelope: Envelope, + pub total: u32, + pub amendments: Vec, + #[serde(flatten)] + pub extra: Extra, +} diff --git a/crates/rdm-schema/tests/fixtures/amendments.json b/crates/rdm-schema/tests/fixtures/amendments.json new file mode 100644 index 0000000..e5d551d --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/amendments.json @@ -0,0 +1,34 @@ +{ + "read_model_version": "0.1", + "format_version": "0.1", + "projection": "amendments", + "campaign": { + "id": "c_rework", + "path": "__roadmap__/roadmap-mcp-rework", + "title": "rdm rework — meta-roadmap" + }, + "tree_rev": "tree-1", + "total": 1, + "amendments": [ + { + "id": "am_a1", + "display_id": "A1", + "legacy_id": "A1", + "ts": "2026-11-16T00:00:00Z", + "actor": { + "kind": "import" + }, + "description": "No milestone owned the domain model; also edits the planned leaves m0, m1, m2, m4, m6, m7 and this README, and Eliott chose to keep the label M0b", + "source": "__reports__/rdm_domain_model_review/01-gap_analysis_v0.md", + "has_snapshot": false, + "changes": [ + { + "node_id": "n_m0b", + "op": "add", + "node_path": "m0b_domain_model_spec", + "node_title": "M0b Domain model spec" + } + ] + } + ] +} diff --git a/crates/rdm-schema/tests/fixtures/node.json b/crates/rdm-schema/tests/fixtures/node.json new file mode 100644 index 0000000..e3b7860 --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/node.json @@ -0,0 +1,107 @@ +{ + "read_model_version": "0.1", + "format_version": "0.1", + "projection": "node", + "campaign": { + "id": "c_rework", + "path": "__roadmap__/roadmap-mcp-rework", + "title": "rdm rework — meta-roadmap" + }, + "tree_rev": "tree-1", + "node": { + "id": "n_m1", + "path": "core/m1_core_foundation", + "parent": "core", + "kind": "leaf", + "rev": "rev-m1", + "title": "M1 Core foundation", + "status": "planned", + "level": 1, + "level_source": "depth", + "ready": false, + "held_by": [ + "n_m0", + "n_m0b" + ], + "sealed": false, + "goal": "`rdm-engine` stores a roadmap as JSON, one file per node, and N processes can read and write one campaign without losing or tearing a write.", + "preconditions": [ + { + "text": "`../m0_feasibility_spike.md` is `done` with a go", + "met": false + }, + { + "text": "`../m0b_domain_model_spec.md` is `done`", + "met": false + }, + { + "text": "Reminder `skills-rdm-M1` read", + "met": false + } + ], + "success_gates": [ + { + "text": "`rdm-engine` depends on `rdm-schema` for every stored type and holds none of its own; a file with a newer format major is refused with an upgrade message", + "met": false + } + ], + "references": [ + { + "label": "R01", + "title": "§Data Model, §Concurrency, §Contracts & Invariants", + "target": "../../../__design__/rdm/architecture.md", + "note": "the file layout, the schema sketch, the lock, the journal and the revisions" + } + ], + "steps": [ + { + "id": "s_m1_1", + "number": 1, + "title": "Plan the milestone", + "goal": "The campaign `__roadmap__/m1-core-foundation/` exists and Eliott has approved it.", + "implementation_logic": [ + "In plan mode, author the campaign with `managing-roadmaps`, deciding: the id minting, to the format M0b fixes; … [cut]" + ], + "deliverables": [ + "`__roadmap__/m1-core-foundation/README.md` and its leaves" + ], + "references": [], + "checks": [ + { + "text": "`bash skills/managing-roadmaps/scripts/dirtree-rdm.sh validate __roadmap__/m1-core-foundation/`", + "expected": "PASS" + } + ], + "commit": { + "type": "chore", + "scope": "roadmap", + "breaking": false, + "summary": "plan the m1-core-foundation milestone" + }, + "done": false + } + ], + "progress": { + "notes": [] + }, + "step_progress": { + "done": 0, + "total": 3 + }, + "history": [], + "comments": [], + "amendments": [] + }, + "holders": { + "n_m0": { + "path": "m0_feasibility_spike", + "title": "M0 Feasibility spike", + "status": "ongoing" + }, + "n_m0b": { + "path": "m0b_domain_model_spec", + "title": "M0b Domain model spec", + "status": "ongoing" + } + } +} diff --git a/crates/rdm-schema/tests/fixtures/outline.json b/crates/rdm-schema/tests/fixtures/outline.json new file mode 100644 index 0000000..36c5420 --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/outline.json @@ -0,0 +1,393 @@ +{ + "read_model_version": "0.1", + "format_version": "0.1", + "projection": "outline", + "campaign": { + "id": "c_rework", + "path": "__roadmap__/roadmap-mcp-rework", + "title": "rdm rework — meta-roadmap" + }, + "tree_rev": "tree-1", + "root": { + "id": "c_rework", + "path": "", + "kind": "directory", + "is_campaign": true, + "title": "rdm rework — meta-roadmap", + "goal": "`managing-roadmaps` ships as a plugin whose tools are a published Rust MCP server and CLI over one core, with JSON roadmaps, full CRUD under an amendment log, and a graph view.", + "status": "ongoing", + "counts": { + "planned": 8, + "ongoing": 2, + "paused": 0, + "cancelled": 0, + "done": 0 + }, + "amendment_count": 1, + "rev": "rev-root", + "children": [ + { + "id": "n_m0", + "path": "m0_feasibility_spike", + "kind": "leaf", + "title": "M0 Feasibility spike", + "status": "ongoing", + "level": 0, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m0" + }, + { + "id": "n_m0b", + "path": "m0b_domain_model_spec", + "kind": "leaf", + "title": "M0b Domain model spec", + "status": "ongoing", + "level": 0, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "added_by": "A1", + "rev": "rev-m0b" + }, + { + "id": "d_core", + "path": "core", + "kind": "directory", + "is_campaign": false, + "title": "Core", + "status": "planned", + "counts": { + "planned": 8, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + }, + "rev": "rev-core", + "children": [ + { + "id": "n_m1", + "path": "core/m1_core_foundation", + "kind": "leaf", + "title": "M1 Core foundation", + "status": "planned", + "level": 1, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m1" + }, + { + "id": "d_engine", + "path": "core/engine", + "kind": "directory", + "is_campaign": false, + "title": "Engine", + "status": "planned", + "counts": { + "planned": 7, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + }, + "rev": "rev-engine", + "children": [ + { + "id": "n_m2", + "path": "core/engine/m2_graph_engine", + "kind": "leaf", + "title": "M2 Graph engine", + "status": "planned", + "level": 2, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m2" + }, + { + "id": "d_interchange", + "path": "core/engine/interchange", + "kind": "directory", + "is_campaign": false, + "title": "Interchange", + "status": "planned", + "counts": { + "planned": 6, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + }, + "rev": "rev-interchange", + "children": [ + { + "id": "n_m3", + "path": "core/engine/interchange/m3_interchange", + "kind": "leaf", + "title": "M3 Interchange", + "status": "planned", + "level": 3, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m3" + }, + { + "id": "d_consumers", + "path": "core/engine/interchange/consumers", + "kind": "directory", + "is_campaign": false, + "title": "Consumers", + "status": "planned", + "counts": { + "planned": 5, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + }, + "rev": "rev-consumers", + "children": [ + { + "id": "n_m4", + "path": "core/engine/interchange/consumers/m4_mcp_server", + "kind": "leaf", + "title": "M4 MCP server", + "status": "planned", + "level": 4, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m4" + }, + { + "id": "n_m5", + "path": "core/engine/interchange/consumers/m5_cli", + "kind": "leaf", + "title": "M5 CLI", + "status": "planned", + "level": 4, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m5" + }, + { + "id": "d_delivery", + "path": "core/engine/interchange/consumers/delivery", + "kind": "directory", + "is_campaign": false, + "title": "Delivery", + "status": "planned", + "counts": { + "planned": 3, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + }, + "rev": "rev-delivery", + "children": [ + { + "id": "n_m6", + "path": "core/engine/interchange/consumers/delivery/m6_apps_view", + "kind": "leaf", + "title": "M6 Apps view", + "status": "planned", + "level": 5, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m6" + }, + { + "id": "n_m7", + "path": "core/engine/interchange/consumers/delivery/m7_distribution", + "kind": "leaf", + "title": "M7 Distribution", + "status": "planned", + "level": 5, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m7" + }, + { + "id": "d_cutover", + "path": "core/engine/interchange/consumers/delivery/cutover", + "kind": "directory", + "is_campaign": false, + "title": "Cutover", + "status": "planned", + "counts": { + "planned": 1, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + }, + "rev": "rev-cutover", + "children": [ + { + "id": "n_m8", + "path": "core/engine/interchange/consumers/delivery/cutover/m8_cutover", + "kind": "leaf", + "title": "M8 Cutover", + "status": "planned", + "level": 6, + "level_source": "depth", + "ready": false, + "steps": { + "done": 0, + "total": 3 + }, + "rev": "rev-m8" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + "waves": [ + { + "level": 0, + "level_source": "depth", + "leaf_ids": [ + "n_m0", + "n_m0b" + ], + "counts": { + "planned": 0, + "ongoing": 2, + "paused": 0, + "cancelled": 0, + "done": 0 + } + }, + { + "level": 1, + "level_source": "depth", + "leaf_ids": [ + "n_m1" + ], + "counts": { + "planned": 1, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + } + }, + { + "level": 2, + "level_source": "depth", + "leaf_ids": [ + "n_m2" + ], + "counts": { + "planned": 1, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + } + }, + { + "level": 3, + "level_source": "depth", + "leaf_ids": [ + "n_m3" + ], + "counts": { + "planned": 1, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + } + }, + { + "level": 4, + "level_source": "depth", + "leaf_ids": [ + "n_m4", + "n_m5" + ], + "counts": { + "planned": 2, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + } + }, + { + "level": 5, + "level_source": "depth", + "leaf_ids": [ + "n_m6", + "n_m7" + ], + "counts": { + "planned": 2, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + } + }, + { + "level": 6, + "level_source": "depth", + "leaf_ids": [ + "n_m8" + ], + "counts": { + "planned": 1, + "ongoing": 0, + "paused": 0, + "cancelled": 0, + "done": 0 + } + } + ] +} diff --git a/crates/rdm-schema/tests/fixtures/ready.json b/crates/rdm-schema/tests/fixtures/ready.json new file mode 100644 index 0000000..5658d73 --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/ready.json @@ -0,0 +1,175 @@ +{ + "read_model_version": "0.1", + "format_version": "0.1", + "projection": "ready", + "campaign": { + "id": "c_rework", + "path": "__roadmap__/roadmap-mcp-rework", + "title": "rdm rework — meta-roadmap" + }, + "tree_rev": "tree-1", + "ready": [], + "stalled": [ + { + "id": "n_m1", + "path": "core/m1_core_foundation", + "title": "M1 Core foundation", + "level": 1, + "level_source": "depth", + "held_by": [ + "n_m0", + "n_m0b" + ] + }, + { + "id": "n_m2", + "path": "core/engine/m2_graph_engine", + "title": "M2 Graph engine", + "level": 2, + "level_source": "depth", + "held_by": [ + "n_m0", + "n_m0b", + "n_m1" + ] + }, + { + "id": "n_m3", + "path": "core/engine/interchange/m3_interchange", + "title": "M3 Interchange", + "level": 3, + "level_source": "depth", + "held_by": [ + "n_m0", + "n_m0b", + "n_m1", + "n_m2" + ] + }, + { + "id": "n_m4", + "path": "core/engine/interchange/consumers/m4_mcp_server", + "title": "M4 MCP server", + "level": 4, + "level_source": "depth", + "held_by": [ + "n_m0", + "n_m0b", + "n_m1", + "n_m2", + "n_m3" + ] + }, + { + "id": "n_m5", + "path": "core/engine/interchange/consumers/m5_cli", + "title": "M5 CLI", + "level": 4, + "level_source": "depth", + "held_by": [ + "n_m0", + "n_m0b", + "n_m1", + "n_m2", + "n_m3" + ] + }, + { + "id": "n_m6", + "path": "core/engine/interchange/consumers/delivery/m6_apps_view", + "title": "M6 Apps view", + "level": 5, + "level_source": "depth", + "held_by": [ + "n_m0", + "n_m0b", + "n_m1", + "n_m2", + "n_m3", + "n_m4", + "n_m5" + ] + }, + { + "id": "n_m7", + "path": "core/engine/interchange/consumers/delivery/m7_distribution", + "title": "M7 Distribution", + "level": 5, + "level_source": "depth", + "held_by": [ + "n_m0", + "n_m0b", + "n_m1", + "n_m2", + "n_m3", + "n_m4", + "n_m5" + ] + }, + { + "id": "n_m8", + "path": "core/engine/interchange/consumers/delivery/cutover/m8_cutover", + "title": "M8 Cutover", + "level": 6, + "level_source": "depth", + "held_by": [ + "n_m0", + "n_m0b", + "n_m1", + "n_m2", + "n_m3", + "n_m4", + "n_m5", + "n_m6", + "n_m7" + ] + } + ], + "holders": { + "n_m0": { + "path": "m0_feasibility_spike", + "title": "M0 Feasibility spike", + "status": "ongoing" + }, + "n_m0b": { + "path": "m0b_domain_model_spec", + "title": "M0b Domain model spec", + "status": "ongoing" + }, + "n_m1": { + "path": "core/m1_core_foundation", + "title": "M1 Core foundation", + "status": "planned" + }, + "n_m2": { + "path": "core/engine/m2_graph_engine", + "title": "M2 Graph engine", + "status": "planned" + }, + "n_m3": { + "path": "core/engine/interchange/m3_interchange", + "title": "M3 Interchange", + "status": "planned" + }, + "n_m4": { + "path": "core/engine/interchange/consumers/m4_mcp_server", + "title": "M4 MCP server", + "status": "planned" + }, + "n_m5": { + "path": "core/engine/interchange/consumers/m5_cli", + "title": "M5 CLI", + "status": "planned" + }, + "n_m6": { + "path": "core/engine/interchange/consumers/delivery/m6_apps_view", + "title": "M6 Apps view", + "status": "planned" + }, + "n_m7": { + "path": "core/engine/interchange/consumers/delivery/m7_distribution", + "title": "M7 Distribution", + "status": "planned" + } + } +} diff --git a/crates/rdm-schema/tests/fixtures/ready_scoped.json b/crates/rdm-schema/tests/fixtures/ready_scoped.json new file mode 100644 index 0000000..b9beb54 --- /dev/null +++ b/crates/rdm-schema/tests/fixtures/ready_scoped.json @@ -0,0 +1,40 @@ +{ + "read_model_version": "0.1", + "format_version": "0.1", + "projection": "ready", + "campaign": { + "id": "c_hyp", + "path": "__roadmap__/hypothetical", + "title": "Two branches" + }, + "tree_rev": "tree-h", + "ready": [ + { + "id": "n_g1", + "path": "docs/guide/g1_guide", + "title": "G1 Guide", + "level": 2, + "level_source": "depth" + } + ], + "stalled": [ + { + "id": "n_m2", + "path": "core/engine/m2_engine", + "title": "M2 Engine", + "level": 2, + "level_source": "depth", + "held_by": [ + "n_m1" + ] + } + ], + "holders": { + "n_m1": { + "path": "core/m1_core", + "title": "M1 Core", + "status": "paused", + "status_reason": "waiting for the schema review" + } + } +} diff --git a/crates/rdm-schema/tests/read.rs b/crates/rdm-schema/tests/read.rs new file mode 100644 index 0000000..3e7ad9b --- /dev/null +++ b/crates/rdm-schema/tests/read.rs @@ -0,0 +1,63 @@ +mod common; +use common::*; +use rdm_schema::read::*; +use serde_json::json; + +#[test] +fn outline_example_round_trips() { + round_trip::(&fixture("outline.json")); +} +#[test] +fn node_example_round_trips() { + round_trip::(&fixture("node.json")); +} +#[test] +fn ready_examples_round_trip() { + round_trip::(&fixture("ready.json")); + round_trip::(&fixture("ready_scoped.json")); +} +#[test] +fn amendments_example_round_trips() { + round_trip::(&fixture("amendments.json")); +} + +#[test] +fn directory_detail_round_trips() { + let v = json!({ + "read_model_version": "0.1", "format_version": "0.1", "projection": "node", + "campaign": {"id": "c", "path": "p", "title": "T"}, "tree_rev": "t", + "node": { "kind": "directory", "id": "d", "path": "core", "parent": "", "rev": "r", "title": "Core", + "sealed": false, "comments": [], "amendments": [], "is_campaign": false, "status": "planned", + "counts": {"planned":1,"ongoing":0,"paused":0,"cancelled":0,"done":0}, + "context": ["c"], "goal": "g", "preconditions": [], "success_gates": [], "references": [], + "gotchas": [], "notes": [], + "children": [{"id":"n","path":"core/m1","kind":"leaf","title":"M1","status":"planned"}] }, + "holders": {} + }); + round_trip::(&v); + let mut v2 = v; + assert!(inject_unknown(&mut v2, "$") >= 5); + round_trip::(&v2); +} + +#[test] +fn unknown_fields_survive_in_every_projection() { + assert!(unknown_fields_survive::("outline.json") >= 20); + assert!(unknown_fields_survive::("node.json") >= 10); + assert!(unknown_fields_survive::("ready.json") >= 10); + assert!(unknown_fields_survive::("ready_scoped.json") >= 4); + assert!(unknown_fields_survive::("amendments.json") >= 5); +} + +#[test] +fn level_source_has_only_depth() { + assert_eq!(serde_json::to_string(&LevelSource::Depth).unwrap(), "\"depth\""); + assert!(serde_json::from_str::("\"other\"").is_err()); +} + +#[test] +fn wrong_kind_is_refused() { + let mut v = fixture("outline.json"); + v["root"]["kind"] = json!("leaf"); + assert!(serde_json::from_value::(v).is_err()); +} From 5e689ff225b9603da87cf265f2e9116c25cc52a1 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 15:57:50 +0900 Subject: [PATCH 031/183] feat(rdm-schema): commit the generated json schemas with a drift test Co-Authored-By: Claude Sonnet 5.5 --- .../rdm-schema/schemas/amendment.schema.json | 135 +++ .../schemas/amendments_view.schema.json | 223 +++++ crates/rdm-schema/schemas/comment.schema.json | 74 ++ .../rdm-schema/schemas/directory.schema.json | 131 +++ crates/rdm-schema/schemas/leaf.schema.json | 385 ++++++++ .../rdm-schema/schemas/node_view.schema.json | 844 ++++++++++++++++++ .../schemas/outline_view.schema.json | 331 +++++++ .../rdm-schema/schemas/ready_view.schema.json | 199 +++++ crates/rdm-schema/tests/schemas.rs | 50 ++ 9 files changed, 2372 insertions(+) create mode 100644 crates/rdm-schema/schemas/amendment.schema.json create mode 100644 crates/rdm-schema/schemas/amendments_view.schema.json create mode 100644 crates/rdm-schema/schemas/comment.schema.json create mode 100644 crates/rdm-schema/schemas/directory.schema.json create mode 100644 crates/rdm-schema/schemas/leaf.schema.json create mode 100644 crates/rdm-schema/schemas/node_view.schema.json create mode 100644 crates/rdm-schema/schemas/outline_view.schema.json create mode 100644 crates/rdm-schema/schemas/ready_view.schema.json create mode 100644 crates/rdm-schema/tests/schemas.rs diff --git a/crates/rdm-schema/schemas/amendment.schema.json b/crates/rdm-schema/schemas/amendment.schema.json new file mode 100644 index 0000000..1f97ca3 --- /dev/null +++ b/crates/rdm-schema/schemas/amendment.schema.json @@ -0,0 +1,135 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Amendment", + "description": "`_amendments/.json`.", + "type": "object", + "properties": { + "actor": { + "$ref": "#/$defs/Actor" + }, + "changes": { + "type": "array", + "items": { + "$ref": "#/$defs/Change" + } + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "legacy_id": { + "type": [ + "string", + "null" + ] + }, + "op_id": { + "type": [ + "string", + "null" + ] + }, + "schema_version": { + "type": "string" + }, + "snapshot": true, + "source": { + "type": [ + "string", + "null" + ] + }, + "ts": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "schema_version", + "id", + "ts", + "actor", + "description", + "changes" + ], + "$defs": { + "Actor": { + "description": "Who made a move, a comment or an amendment.", + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ActorKind" + }, + "name": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true, + "required": [ + "kind" + ] + }, + "ActorKind": { + "description": "`Actor.kind`.", + "type": "string", + "enum": [ + "agent", + "human", + "import" + ] + }, + "Change": { + "description": "An element of `Amendment.changes`.", + "type": "object", + "properties": { + "field": { + "type": [ + "string", + "null" + ] + }, + "new": true, + "node_id": { + "type": "string" + }, + "old": true, + "op": { + "$ref": "#/$defs/ChangeOp" + }, + "path_after": { + "type": [ + "string", + "null" + ] + }, + "path_before": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true, + "required": [ + "node_id", + "op" + ] + }, + "ChangeOp": { + "description": "`Change.op`.", + "type": "string", + "enum": [ + "add", + "remove", + "set", + "rename", + "move" + ] + } + } +} diff --git a/crates/rdm-schema/schemas/amendments_view.schema.json b/crates/rdm-schema/schemas/amendments_view.schema.json new file mode 100644 index 0000000..a2d15df --- /dev/null +++ b/crates/rdm-schema/schemas/amendments_view.schema.json @@ -0,0 +1,223 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "AmendmentsView", + "description": "The amendment log.", + "type": "object", + "properties": { + "amendments": { + "type": "array", + "items": { + "$ref": "#/$defs/AmendmentEntry" + } + }, + "campaign": { + "$ref": "#/$defs/CampaignRef" + }, + "format_version": { + "type": "string" + }, + "projection": { + "$ref": "#/$defs/Projection" + }, + "read_model_version": { + "type": "string" + }, + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "tree_rev": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "read_model_version", + "format_version", + "projection", + "campaign", + "tree_rev", + "total", + "amendments" + ], + "$defs": { + "Actor": { + "description": "Who made a move, a comment or an amendment.", + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ActorKind" + }, + "name": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true, + "required": [ + "kind" + ] + }, + "ActorKind": { + "description": "`Actor.kind`.", + "type": "string", + "enum": [ + "agent", + "human", + "import" + ] + }, + "AmendmentEntry": { + "description": "One amendment of the log.", + "type": "object", + "properties": { + "actor": { + "$ref": "#/$defs/Actor" + }, + "changes": { + "type": "array", + "items": { + "$ref": "#/$defs/ChangeView" + } + }, + "description": { + "type": "string" + }, + "display_id": { + "type": "string" + }, + "has_snapshot": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "legacy_id": { + "type": [ + "string", + "null" + ] + }, + "op_id": { + "type": [ + "string", + "null" + ] + }, + "source": { + "type": [ + "string", + "null" + ] + }, + "ts": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "display_id", + "ts", + "actor", + "description", + "has_snapshot", + "changes" + ] + }, + "CampaignRef": { + "description": "Identity of the campaign in an envelope.", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "title" + ] + }, + "ChangeOp": { + "description": "`Change.op`.", + "type": "string", + "enum": [ + "add", + "remove", + "set", + "rename", + "move" + ] + }, + "ChangeView": { + "description": "A stored change plus the node's current path and title.", + "type": "object", + "properties": { + "field": { + "type": [ + "string", + "null" + ] + }, + "new": true, + "node_id": { + "type": "string" + }, + "node_path": { + "type": [ + "string", + "null" + ] + }, + "node_title": { + "type": [ + "string", + "null" + ] + }, + "old": true, + "op": { + "$ref": "#/$defs/ChangeOp" + }, + "path_after": { + "type": [ + "string", + "null" + ] + }, + "path_before": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true, + "required": [ + "node_id", + "op" + ] + }, + "Projection": { + "description": "Which projection a payload is.", + "type": "string", + "enum": [ + "outline", + "node", + "ready", + "amendments" + ] + } + } +} diff --git a/crates/rdm-schema/schemas/comment.schema.json b/crates/rdm-schema/schemas/comment.schema.json new file mode 100644 index 0000000..7d399cf --- /dev/null +++ b/crates/rdm-schema/schemas/comment.schema.json @@ -0,0 +1,74 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Comment", + "description": "`_comments/.json`.", + "type": "object", + "properties": { + "actor": { + "$ref": "#/$defs/Actor" + }, + "id": { + "type": "string" + }, + "node_id": { + "type": "string" + }, + "op_id": { + "type": [ + "string", + "null" + ] + }, + "schema_version": { + "type": "string" + }, + "text": { + "type": "array", + "items": { + "type": "string" + } + }, + "ts": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "schema_version", + "id", + "node_id", + "ts", + "actor", + "text" + ], + "$defs": { + "Actor": { + "description": "Who made a move, a comment or an amendment.", + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ActorKind" + }, + "name": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true, + "required": [ + "kind" + ] + }, + "ActorKind": { + "description": "`Actor.kind`.", + "type": "string", + "enum": [ + "agent", + "human", + "import" + ] + } + } +} diff --git a/crates/rdm-schema/schemas/directory.schema.json b/crates/rdm-schema/schemas/directory.schema.json new file mode 100644 index 0000000..6b776f0 --- /dev/null +++ b/crates/rdm-schema/schemas/directory.schema.json @@ -0,0 +1,131 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Directory", + "description": "`_dir.json`: the campaign root and every directory node.", + "type": "object", + "properties": { + "context": { + "type": "array", + "items": { + "type": "string" + } + }, + "goal": { + "type": "string" + }, + "gotchas": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/DirectoryKind" + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } + }, + "preconditions": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } + }, + "references": { + "type": "array", + "items": { + "$ref": "#/$defs/Reference" + } + }, + "schema_version": { + "type": "string" + }, + "success_gates": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "schema_version", + "id", + "kind", + "title", + "context", + "references", + "goal", + "preconditions", + "success_gates", + "gotchas", + "notes" + ], + "$defs": { + "Criterion": { + "description": "An element of `preconditions` or `success_gates`.", + "type": "object", + "properties": { + "met": { + "type": "boolean" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "text", + "met" + ] + }, + "DirectoryKind": { + "description": "`Directory.kind`.", + "type": "string", + "enum": [ + "campaign", + "directory" + ] + }, + "Reference": { + "description": "An element of `references`.", + "type": "object", + "properties": { + "label": { + "type": [ + "string", + "null" + ] + }, + "note": { + "type": [ + "string", + "null" + ] + }, + "target": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "title" + ] + } + } +} diff --git a/crates/rdm-schema/schemas/leaf.schema.json b/crates/rdm-schema/schemas/leaf.schema.json new file mode 100644 index 0000000..59cea75 --- /dev/null +++ b/crates/rdm-schema/schemas/leaf.schema.json @@ -0,0 +1,385 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Leaf", + "description": "`.json`.", + "type": "object", + "properties": { + "goal": { + "type": "string" + }, + "history": { + "type": "array", + "items": { + "$ref": "#/$defs/History" + } + }, + "id": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/LeafKind" + }, + "preconditions": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } + }, + "progress": { + "$ref": "#/$defs/Progress" + }, + "references": { + "type": "array", + "items": { + "$ref": "#/$defs/Reference" + } + }, + "schema_version": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/$defs/Step" + } + }, + "success_gates": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "schema_version", + "id", + "kind", + "title", + "status", + "goal", + "preconditions", + "success_gates", + "references", + "steps", + "progress", + "history" + ], + "$defs": { + "Actor": { + "description": "Who made a move, a comment or an amendment.", + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ActorKind" + }, + "name": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true, + "required": [ + "kind" + ] + }, + "ActorKind": { + "description": "`Actor.kind`.", + "type": "string", + "enum": [ + "agent", + "human", + "import" + ] + }, + "Check": { + "description": "An element of `Step.checks`.", + "type": "object", + "properties": { + "command": { + "type": [ + "string", + "null" + ] + }, + "expected": { + "$ref": "#/$defs/Expected" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "text", + "expected" + ] + }, + "Commit": { + "description": "`Step.commit`.", + "type": "object", + "properties": { + "breaking": { + "type": "boolean" + }, + "scope": { + "type": [ + "string", + "null" + ] + }, + "summary": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "type", + "breaking", + "summary" + ] + }, + "Criterion": { + "description": "An element of `preconditions` or `success_gates`.", + "type": "object", + "properties": { + "met": { + "type": "boolean" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "text", + "met" + ] + }, + "Expected": { + "description": "`Check.expected`.", + "type": "string", + "enum": [ + "PASS", + "FAIL" + ] + }, + "History": { + "description": "An element of `Leaf.history`: one status move.", + "type": "object", + "properties": { + "actor": { + "$ref": "#/$defs/Actor" + }, + "from": { + "$ref": "#/$defs/Status" + }, + "op_id": { + "type": [ + "string", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ] + }, + "reason": { + "type": [ + "string", + "null" + ] + }, + "to": { + "$ref": "#/$defs/Status" + }, + "ts": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "ts", + "from", + "to", + "actor" + ] + }, + "LeafKind": { + "description": "`Leaf.kind`, the one value `leaf`.", + "type": "string", + "enum": [ + "leaf" + ] + }, + "Progress": { + "description": "`Leaf.progress`.", + "type": "object", + "properties": { + "branch": { + "type": [ + "string", + "null" + ] + }, + "commits": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": true, + "required": [ + "notes" + ] + }, + "Reference": { + "description": "An element of `references`.", + "type": "object", + "properties": { + "label": { + "type": [ + "string", + "null" + ] + }, + "note": { + "type": [ + "string", + "null" + ] + }, + "target": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "title" + ] + }, + "Status": { + "description": "The five statuses of a leaf (`statuses.md`).", + "type": "string", + "enum": [ + "planned", + "ongoing", + "paused", + "cancelled", + "done" + ] + }, + "Step": { + "description": "An element of `Leaf.steps`.", + "type": "object", + "properties": { + "checks": { + "type": "array", + "items": { + "$ref": "#/$defs/Check" + } + }, + "commit": { + "$ref": "#/$defs/Commit" + }, + "commit_sha": { + "type": [ + "string", + "null" + ] + }, + "deliverables": { + "type": "array", + "items": { + "type": "string" + } + }, + "done": { + "type": "boolean" + }, + "done_at": { + "type": [ + "string", + "null" + ] + }, + "goal": { + "type": "string" + }, + "id": { + "type": "string" + }, + "implementation_logic": { + "type": "array", + "items": { + "type": "string" + } + }, + "references": { + "type": "array", + "items": { + "$ref": "#/$defs/Reference" + } + }, + "requires": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "title", + "goal", + "implementation_logic", + "deliverables", + "references", + "checks", + "commit", + "done" + ] + } + } +} diff --git a/crates/rdm-schema/schemas/node_view.schema.json b/crates/rdm-schema/schemas/node_view.schema.json new file mode 100644 index 0000000..f3eab4d --- /dev/null +++ b/crates/rdm-schema/schemas/node_view.schema.json @@ -0,0 +1,844 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "NodeView", + "description": "Node detail.", + "type": "object", + "properties": { + "campaign": { + "$ref": "#/$defs/CampaignRef" + }, + "format_version": { + "type": "string" + }, + "holders": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Holder" + } + }, + "node": { + "$ref": "#/$defs/NodeDetail" + }, + "projection": { + "$ref": "#/$defs/Projection" + }, + "read_model_version": { + "type": "string" + }, + "tree_rev": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "read_model_version", + "format_version", + "projection", + "campaign", + "tree_rev", + "node", + "holders" + ], + "$defs": { + "Actor": { + "description": "Who made a move, a comment or an amendment.", + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ActorKind" + }, + "name": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true, + "required": [ + "kind" + ] + }, + "ActorKind": { + "description": "`Actor.kind`.", + "type": "string", + "enum": [ + "agent", + "human", + "import" + ] + }, + "CampaignRef": { + "description": "Identity of the campaign in an envelope.", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "title" + ] + }, + "Check": { + "description": "An element of `Step.checks`.", + "type": "object", + "properties": { + "command": { + "type": [ + "string", + "null" + ] + }, + "expected": { + "$ref": "#/$defs/Expected" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "text", + "expected" + ] + }, + "ChildRef": { + "description": "A child in a directory's detail.", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/NodeKind" + }, + "path": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "kind", + "title", + "status" + ] + }, + "Comment": { + "description": "`_comments/.json`.", + "type": "object", + "properties": { + "actor": { + "$ref": "#/$defs/Actor" + }, + "id": { + "type": "string" + }, + "node_id": { + "type": "string" + }, + "op_id": { + "type": [ + "string", + "null" + ] + }, + "schema_version": { + "type": "string" + }, + "text": { + "type": "array", + "items": { + "type": "string" + } + }, + "ts": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "schema_version", + "id", + "node_id", + "ts", + "actor", + "text" + ] + }, + "Commit": { + "description": "`Step.commit`.", + "type": "object", + "properties": { + "breaking": { + "type": "boolean" + }, + "scope": { + "type": [ + "string", + "null" + ] + }, + "summary": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "type", + "breaking", + "summary" + ] + }, + "Criterion": { + "description": "An element of `preconditions` or `success_gates`.", + "type": "object", + "properties": { + "met": { + "type": "boolean" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "text", + "met" + ] + }, + "DirectoryDetail": { + "description": "Detail of a directory or the campaign root.", + "type": "object", + "properties": { + "added_by": { + "type": [ + "string", + "null" + ] + }, + "amendments": { + "type": "array", + "items": { + "type": "string" + } + }, + "children": { + "type": "array", + "items": { + "$ref": "#/$defs/ChildRef" + } + }, + "comments": { + "type": "array", + "items": { + "$ref": "#/$defs/Comment" + } + }, + "context": { + "type": "array", + "items": { + "type": "string" + } + }, + "counts": { + "$ref": "#/$defs/StatusCounts" + }, + "goal": { + "type": "string" + }, + "gotchas": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "is_campaign": { + "type": "boolean" + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } + }, + "parent": { + "type": "string" + }, + "path": { + "type": "string" + }, + "preconditions": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } + }, + "references": { + "type": "array", + "items": { + "$ref": "#/$defs/Reference" + } + }, + "rev": { + "type": "string" + }, + "sealed": { + "type": "boolean" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "success_gates": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "parent", + "rev", + "title", + "sealed", + "comments", + "amendments", + "is_campaign", + "status", + "counts", + "context", + "goal", + "preconditions", + "success_gates", + "references", + "gotchas", + "notes", + "children" + ] + }, + "Expected": { + "description": "`Check.expected`.", + "type": "string", + "enum": [ + "PASS", + "FAIL" + ] + }, + "History": { + "description": "An element of `Leaf.history`: one status move.", + "type": "object", + "properties": { + "actor": { + "$ref": "#/$defs/Actor" + }, + "from": { + "$ref": "#/$defs/Status" + }, + "op_id": { + "type": [ + "string", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ] + }, + "reason": { + "type": [ + "string", + "null" + ] + }, + "to": { + "$ref": "#/$defs/Status" + }, + "ts": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "ts", + "from", + "to", + "actor" + ] + }, + "Holder": { + "description": "A leaf that holds another back.", + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "path", + "title", + "status" + ] + }, + "LeafDetail": { + "description": "Detail of a leaf.", + "type": "object", + "properties": { + "added_by": { + "type": [ + "string", + "null" + ] + }, + "amendments": { + "type": "array", + "items": { + "type": "string" + } + }, + "comments": { + "type": "array", + "items": { + "$ref": "#/$defs/Comment" + } + }, + "commit_count": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "goal": { + "type": "string" + }, + "held_by": { + "type": "array", + "items": { + "type": "string" + } + }, + "history": { + "type": "array", + "items": { + "$ref": "#/$defs/History" + } + }, + "id": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "level_source": { + "$ref": "#/$defs/LevelSource" + }, + "parent": { + "type": "string" + }, + "path": { + "type": "string" + }, + "preconditions": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } + }, + "progress": { + "$ref": "#/$defs/Progress" + }, + "ready": { + "type": "boolean" + }, + "references": { + "type": "array", + "items": { + "$ref": "#/$defs/Reference" + } + }, + "rev": { + "type": "string" + }, + "sealed": { + "type": "boolean" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] + }, + "status_since": { + "type": [ + "string", + "null" + ] + }, + "step_progress": { + "$ref": "#/$defs/StepCounts" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/$defs/StepView" + } + }, + "success_gates": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "parent", + "rev", + "title", + "status", + "level", + "level_source", + "ready", + "held_by", + "sealed", + "goal", + "preconditions", + "success_gates", + "references", + "steps", + "progress", + "step_progress", + "history", + "comments", + "amendments" + ] + }, + "LevelSource": { + "description": "The rule that produced a `level`. One value today.", + "type": "string", + "enum": [ + "depth" + ] + }, + "NodeDetail": { + "description": "The detail of one node, discriminated by `kind`.", + "oneOf": [ + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "leaf" + } + }, + "$ref": "#/$defs/LeafDetail", + "required": [ + "kind" + ] + }, + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "directory" + } + }, + "$ref": "#/$defs/DirectoryDetail", + "required": [ + "kind" + ] + } + ] + }, + "NodeKind": { + "description": "`NodeKind` of a child reference.", + "type": "string", + "enum": [ + "leaf", + "directory" + ] + }, + "Progress": { + "description": "`Leaf.progress`.", + "type": "object", + "properties": { + "branch": { + "type": [ + "string", + "null" + ] + }, + "commits": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": true, + "required": [ + "notes" + ] + }, + "Projection": { + "description": "Which projection a payload is.", + "type": "string", + "enum": [ + "outline", + "node", + "ready", + "amendments" + ] + }, + "Reference": { + "description": "An element of `references`.", + "type": "object", + "properties": { + "label": { + "type": [ + "string", + "null" + ] + }, + "note": { + "type": [ + "string", + "null" + ] + }, + "target": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "title" + ] + }, + "Status": { + "description": "The five statuses of a leaf (`statuses.md`).", + "type": "string", + "enum": [ + "planned", + "ongoing", + "paused", + "cancelled", + "done" + ] + }, + "StatusCounts": { + "description": "Leaves counted by status.", + "type": "object", + "properties": { + "cancelled": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "done": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "ongoing": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "paused": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "planned": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "additionalProperties": true, + "required": [ + "planned", + "ongoing", + "paused", + "cancelled", + "done" + ] + }, + "StepCounts": { + "description": "`{done, total}` of a leaf's steps.", + "type": "object", + "properties": { + "done": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "additionalProperties": true, + "required": [ + "done", + "total" + ] + }, + "StepView": { + "description": "A stored step plus its derived number.", + "type": "object", + "properties": { + "checks": { + "type": "array", + "items": { + "$ref": "#/$defs/Check" + } + }, + "commit": { + "$ref": "#/$defs/Commit" + }, + "commit_sha": { + "type": [ + "string", + "null" + ] + }, + "deliverables": { + "type": "array", + "items": { + "type": "string" + } + }, + "done": { + "type": "boolean" + }, + "done_at": { + "type": [ + "string", + "null" + ] + }, + "goal": { + "type": "string" + }, + "id": { + "type": "string" + }, + "implementation_logic": { + "type": "array", + "items": { + "type": "string" + } + }, + "number": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "references": { + "type": "array", + "items": { + "$ref": "#/$defs/Reference" + } + }, + "requires": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "number", + "id", + "title", + "goal", + "implementation_logic", + "deliverables", + "references", + "checks", + "commit", + "done" + ] + } + } +} diff --git a/crates/rdm-schema/schemas/outline_view.schema.json b/crates/rdm-schema/schemas/outline_view.schema.json new file mode 100644 index 0000000..f5b2d69 --- /dev/null +++ b/crates/rdm-schema/schemas/outline_view.schema.json @@ -0,0 +1,331 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "OutlineView", + "description": "The campaign outline with waves.", + "type": "object", + "properties": { + "campaign": { + "$ref": "#/$defs/CampaignRef" + }, + "format_version": { + "type": "string" + }, + "projection": { + "$ref": "#/$defs/Projection" + }, + "read_model_version": { + "type": "string" + }, + "root": { + "$ref": "#/$defs/OutlineNode" + }, + "tree_rev": { + "type": "string" + }, + "waves": { + "type": "array", + "items": { + "$ref": "#/$defs/WaveView" + } + } + }, + "additionalProperties": true, + "required": [ + "read_model_version", + "format_version", + "projection", + "campaign", + "tree_rev", + "root", + "waves" + ], + "$defs": { + "CampaignRef": { + "description": "Identity of the campaign in an envelope.", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "title" + ] + }, + "LevelSource": { + "description": "The rule that produced a `level`. One value today.", + "type": "string", + "enum": [ + "depth" + ] + }, + "OutlineDirectory": { + "description": "A directory in the outline.", + "type": "object", + "properties": { + "amendment_count": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "children": { + "type": "array", + "items": { + "$ref": "#/$defs/OutlineNode" + } + }, + "counts": { + "$ref": "#/$defs/StatusCounts" + }, + "goal": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": "string" + }, + "is_campaign": { + "type": "boolean" + }, + "path": { + "type": "string" + }, + "rev": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "title", + "is_campaign", + "status", + "counts", + "rev", + "children" + ] + }, + "OutlineLeaf": { + "description": "A leaf in the outline.", + "type": "object", + "properties": { + "added_by": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "level_source": { + "$ref": "#/$defs/LevelSource" + }, + "path": { + "type": "string" + }, + "ready": { + "type": "boolean" + }, + "rev": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] + }, + "steps": { + "$ref": "#/$defs/StepCounts" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "title", + "status", + "level", + "level_source", + "ready", + "steps", + "rev" + ] + }, + "OutlineNode": { + "description": "A node of the outline, discriminated by `kind`.", + "oneOf": [ + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "directory" + } + }, + "$ref": "#/$defs/OutlineDirectory", + "required": [ + "kind" + ] + }, + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "leaf" + } + }, + "$ref": "#/$defs/OutlineLeaf", + "required": [ + "kind" + ] + } + ] + }, + "Projection": { + "description": "Which projection a payload is.", + "type": "string", + "enum": [ + "outline", + "node", + "ready", + "amendments" + ] + }, + "Status": { + "description": "The five statuses of a leaf (`statuses.md`).", + "type": "string", + "enum": [ + "planned", + "ongoing", + "paused", + "cancelled", + "done" + ] + }, + "StatusCounts": { + "description": "Leaves counted by status.", + "type": "object", + "properties": { + "cancelled": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "done": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "ongoing": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "paused": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "planned": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "additionalProperties": true, + "required": [ + "planned", + "ongoing", + "paused", + "cancelled", + "done" + ] + }, + "StepCounts": { + "description": "`{done, total}` of a leaf's steps.", + "type": "object", + "properties": { + "done": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "additionalProperties": true, + "required": [ + "done", + "total" + ] + }, + "WaveView": { + "description": "One wave of the outline.", + "type": "object", + "properties": { + "counts": { + "$ref": "#/$defs/StatusCounts" + }, + "leaf_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "level_source": { + "$ref": "#/$defs/LevelSource" + } + }, + "additionalProperties": true, + "required": [ + "level", + "level_source", + "leaf_ids", + "counts" + ] + } + } +} diff --git a/crates/rdm-schema/schemas/ready_view.schema.json b/crates/rdm-schema/schemas/ready_view.schema.json new file mode 100644 index 0000000..b50f352 --- /dev/null +++ b/crates/rdm-schema/schemas/ready_view.schema.json @@ -0,0 +1,199 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ReadyView", + "description": "The ready set with what stalls the rest.", + "type": "object", + "properties": { + "campaign": { + "$ref": "#/$defs/CampaignRef" + }, + "format_version": { + "type": "string" + }, + "holders": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Holder" + } + }, + "projection": { + "$ref": "#/$defs/Projection" + }, + "read_model_version": { + "type": "string" + }, + "ready": { + "type": "array", + "items": { + "$ref": "#/$defs/ReadyLeaf" + } + }, + "stalled": { + "type": "array", + "items": { + "$ref": "#/$defs/StalledLeaf" + } + }, + "tree_rev": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "read_model_version", + "format_version", + "projection", + "campaign", + "tree_rev", + "ready", + "stalled", + "holders" + ], + "$defs": { + "CampaignRef": { + "description": "Identity of the campaign in an envelope.", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "title" + ] + }, + "Holder": { + "description": "A leaf that holds another back.", + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "path", + "title", + "status" + ] + }, + "LevelSource": { + "description": "The rule that produced a `level`. One value today.", + "type": "string", + "enum": [ + "depth" + ] + }, + "Projection": { + "description": "Which projection a payload is.", + "type": "string", + "enum": [ + "outline", + "node", + "ready", + "amendments" + ] + }, + "ReadyLeaf": { + "description": "A `planned` leaf that nothing holds back.", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "level_source": { + "$ref": "#/$defs/LevelSource" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "title", + "level", + "level_source" + ] + }, + "StalledLeaf": { + "description": "A `planned` leaf held back by unfinished leaves.", + "type": "object", + "properties": { + "held_by": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "level_source": { + "$ref": "#/$defs/LevelSource" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "additionalProperties": true, + "required": [ + "id", + "path", + "title", + "level", + "level_source", + "held_by" + ] + }, + "Status": { + "description": "The five statuses of a leaf (`statuses.md`).", + "type": "string", + "enum": [ + "planned", + "ongoing", + "paused", + "cancelled", + "done" + ] + } + } +} diff --git a/crates/rdm-schema/tests/schemas.rs b/crates/rdm-schema/tests/schemas.rs new file mode 100644 index 0000000..7c12bdd --- /dev/null +++ b/crates/rdm-schema/tests/schemas.rs @@ -0,0 +1,50 @@ +use rdm_schema::read::{AmendmentsView, NodeView, OutlineView, ReadyView}; +use rdm_schema::stored::{Amendment, Comment, Directory, Leaf}; +use schemars::{JsonSchema, schema_for}; + +/// One pretty JSON Schema with a trailing newline. +fn generated() -> String { + let mut s = serde_json::to_string_pretty(&schema_for!(T)).expect("schema serialises"); + s.push('\n'); + s +} + +/// Compares `want` with the committed file, or writes it when `RDM_SCHEMA_BLESS=1`. +fn check_or_bless(name: &str, want: &str, failures: &mut Vec) { + let path = format!("{}/schemas/{name}.schema.json", env!("CARGO_MANIFEST_DIR")); + if std::env::var("RDM_SCHEMA_BLESS").as_deref() == Ok("1") { + std::fs::write(&path, want).unwrap_or_else(|e| panic!("{path}: {e}")); + return; + } + match std::fs::read_to_string(&path) { + Err(e) => failures.push(format!("{path}: cannot read ({e}); run RDM_SCHEMA_BLESS=1 cargo test -p rdm-schema")), + Ok(have) if have == want => {} + Ok(have) => { + let line = want + .lines() + .zip(have.lines()) + .position(|(a, b)| a != b) + .unwrap_or_else(|| want.lines().count().min(have.lines().count())); + failures.push(format!( + "{path}: differs from the generated schema, first at line {}\n generated: {:?}\n committed: {:?}", + line + 1, + want.lines().nth(line), + have.lines().nth(line) + )); + } + } +} + +#[test] +fn committed_schemas_match_the_types() { + let mut failures = Vec::new(); + check_or_bless("directory", &generated::(), &mut failures); + check_or_bless("leaf", &generated::(), &mut failures); + check_or_bless("comment", &generated::(), &mut failures); + check_or_bless("amendment", &generated::(), &mut failures); + check_or_bless("outline_view", &generated::(), &mut failures); + check_or_bless("node_view", &generated::(), &mut failures); + check_or_bless("ready_view", &generated::(), &mut failures); + check_or_bless("amendments_view", &generated::(), &mut failures); + assert!(failures.is_empty(), "schema drift:\n{}", failures.join("\n")); +} From e22262c4071c5bc67a801bccf5e11fe38198ec13 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 16:03:06 +0900 Subject: [PATCH 032/183] docs(design): check traceability targets against the crate and note the stored-schema rules The checker now refuses a stored target that names no field of stored.rs, a dropped reason of fewer than three words, and an empty or dash target. The stored schema records the null rule, key order, number range and the Envelope note; the traceability table gains the bulleted References form. Co-Authored-By: Claude Sonnet 5.5 --- __design__/rdm/stored-schema.md | 5 +++-- __design__/rdm/traceability.md | 25 +++++++++++---------- tools/check_rdm_traceability.py | 40 +++++++++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/__design__/rdm/stored-schema.md b/__design__/rdm/stored-schema.md index 63d4825..d04d8d8 100644 --- a/__design__/rdm/stored-schema.md +++ b/__design__/rdm/stored-schema.md @@ -19,7 +19,7 @@ Notation: | `ts` | UTC instant, RFC 3339, `"2026-11-16T10:20:30Z"` | | `ulid` | A ULID, 26 characters of Crockford base32 | | `T[]` | Array of `T` | -| `T?` | Optional: the key is absent when there is no value, never `null` | +| `T?` | Optional: the key is absent when there is no value. A writer never writes `null`. A reader treats `null` as absent. The exception is `Change.old` and `Change.new`, where `null` is a value | ## Files @@ -39,7 +39,7 @@ __roadmap__// | Names are paths | A node's name is its path segment, `^[a-z][a-z0-9_-]*$`. It is not stored in the file | | Identity | Every node has an immutable `id`. The id format and its minting belong to M1. The schema types it as `string` | | Version stamp | Every file carries `schema_version` (see `Format version`) | -| Unknown fields | Every object type below keeps the keys it does not know, in order, and writes them back after the known ones. This holds for nested objects too (steps, criteria, references, commits, history and comment entries, changes). It is the stored half of I12 | +| Unknown fields | Every object type below keeps the keys it does not know, in order, and writes them back after the known ones. This holds for nested objects too (steps, criteria, references, commits, history and comment entries, changes). It is the stored half of I12. Keys keep their order, so the crate enables `serde_json`'s `preserve_order`. Numbers outside the `i64`, `u64` and `f64` range are not preserved exactly, because `arbitrary_precision` is not enabled. `Envelope` (read model) has no `extra` of its own: it is flattened into each view, whose `extra` keeps the unknown keys | | Canonical order | The order of the rows in each field table is the canonical field order. Two-space indent, LF, trailing newline. M1 owns the serialiser | | Derived, never stored (I6) | Directory status, the nodes table, the mermaid graph, the progress table, waves, the ready set, a step's number, the display id of an amendment, a leaf's commit count when the engine recorded the steps | @@ -187,6 +187,7 @@ Legacy forms and how they split: | a segment that is not a link | none | the whole segment | none | none | The importer splits a leaf's one-line `**References**` on `; ` outside brackets and parentheses. +A `**References**:` line followed by bullet lines (`- [text](target) — note`) is the bulleted form: each bullet is one `Reference`, split like a directory item. A label is the prefix `R` and two digits followed by a space at the start of the link text. A segment it cannot parse becomes a reference with only `title`, so nothing is dropped. Note: a relative `target` breaks when a node moves. M2 may normalise targets to repository-relative diff --git a/__design__/rdm/traceability.md b/__design__/rdm/traceability.md index af96c7b..5607732 100644 --- a/__design__/rdm/traceability.md +++ b/__design__/rdm/traceability.md @@ -28,7 +28,7 @@ that the export (M3) re-creates the text from stored fields. |:--|:--|:--| | `` | `stored` | One `Leaf` file, `.json`. The order of H1, header and steps is export layout | | `` | `stored` | Leaf `goal`, `preconditions`, `success_gates`, `references`. The grammar is order-insensitive, so no order is kept | -| `` | `stored` | One of the four header fields below | +| `` | `stored` | Leaf `goal`, `preconditions`, `success_gates` or `references`, the four header fields below | | `` | `stored` | `goal`, one line | | `` | `stored` | `preconditions[]` | | `` | `stored` | `success_gates[]` | @@ -37,7 +37,7 @@ that the export (M3) re-creates the text from stored fields. | `` | `stored` | `success_gates[].text` and `.met`; the check mark is `true`, the empty box is `false` | | `` | `stored` | One element of `steps[]` | | `` | `stored` | `steps[].title` is the text after the colon; the digit is dropped: the step number is derived from position | -| `` | `stored` | One of the step fields below | +| `` | `stored` | `steps[]` fields `goal`, `implementation_logic`, `references`, `deliverables`, `checks` or `commit`, below | | `` | `stored` | `steps[].goal` | | `` | `stored` | `steps[].implementation_logic`, the body lines with blank lines kept. The header line and trailing blank lines are presentation | | `` | `stored` | `steps[].references[]` | @@ -70,24 +70,24 @@ Constraints the grammar states outside its productions, and where each one goes: | `` | `dropped` | Heading literal. The field name is `context` | | `` | `stored` | `context`, the lines | | `` | `stored` | `references[]`. The section is optional; an absent section is an empty array | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `stored` | `references[]` | -| `` | `stored` | `references[].label` is the `R` and two digits, `.title`, `.target`, `.note` from the text after the dash | +| `` | `stored` | `references[].label` is the letter R and two digits, `.title`, `.target`, `.note` from the text after the dash | | `` | `stored` | `goal` | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `stored` | `goal`, exactly one line | | `` | `stored` | `preconditions[]` | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `stored` | `preconditions[]` | | `` | `stored` | `preconditions[].text` and `.met` | | `` | `stored` | `success_gates[]` | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `stored` | `success_gates[]` | | `` | `stored` | `success_gates[].text` and `.met` | | `` | `stored` | `gotchas`, verbatim lines. The section is optional; absent is an empty array | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `derived` | The status view of the node's children, from their `status` or derived status | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `derived` | The graph of the node's children, rebuilt on each export | | `MERMAID_OPEN` | `dropped` | Markup; the export emits it | | `MERMAID_CLOSE` | `dropped` | Markup; the export emits it | @@ -99,7 +99,7 @@ Constraints the grammar states outside its productions, and where each one goes: | `` | `dropped` | Colours are presentation. The status `amendment` no longer exists (`statuses.md`) | | `` | `dropped` | Colours are presentation. The status `blocked` no longer exists (`statuses.md`) | | `` | `derived` | The table of the node's children, from the directory listing | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `derived` | One row per child. Row order carries no meaning: siblings are parallel, so readers order by depth, kind and name. The authored row order is not kept | | `` | `dropped` | Fixed header; the export emits it | | `` | `dropped` | Markdown table syntax | @@ -107,12 +107,12 @@ Constraints the grammar states outside its productions, and where each one goes: | `` | `derived` | Name from the path, type from `kind`, status from `Leaf.status`. The emoji labels are presentation | | `` | `derived` | Name from the path, status derived from the leaves under it (`statuses.md`). The emoji labels are presentation | | `` | `stored` | `Amendment` files. The log of a directory is the amendments whose changes name its nodes | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `stored` | `Amendment` files, one per row | | `` | `dropped` | Fixed header; the export emits it | | `` | `stored` | `Amendment.legacy_id`, `.ts`, `.source`, `.changes[]` (one add per filename), `.description` | | `` | `stored` | `Leaf.progress` and `Directory.notes` | -| `` | `dropped` | Heading literal | +| `` | `dropped` | Heading literal, not a field | | `` | `derived` | Rendered from the progress of every leaf and the notes of every directory | | `` | `dropped` | Fixed header; the export emits it | | `` | `stored` | Leaf row: `Leaf.progress.branch`, `.commits`, `.notes`. Directory row: `Directory.notes`; its branch and commit count are dropped as copies of its leaves' | @@ -143,4 +143,5 @@ Counts are over `__roadmap__/` at the date of this document. | Reference items without a label | `create-reporting-skill/README.md` lists a reference with no `R01` label, so its validation fails at that line | `Reference.label` is optional in the type | The label is absent and the importer warns. `validate` requires a label in a directory | | Mermaid labels | 13 of 95 differ from the child's H1 | `dropped`: derived from `title` | The H1 wins; the importer warns on a difference | | Sibling order | Nodes-table row order | `dropped`: siblings are parallel, order carries no meaning | Readers order by depth, kind and name | +| Bulleted References | `create-reporting-skill/write_test_definition_reference.md` (lines 13-14 and 34-35) and `write_knowledge_transfer_reference.md` (lines 11-12) write `**References**:` followed by bullet lines, not one `; `-separated line | `stored`: `references[]`, one `Reference` per bullet | Each bullet is one `Reference`, split as a directory item (`label`, `title`, `target`, `note`). Bullets and the one-line form give the same array | | Step count | 23 leaves with 1 step, 16 with 2, 23 with 3, 3 with 4, 2 with 5 | `validate` rule: 1 to 5 | None needed; none exceeds 5 | diff --git a/tools/check_rdm_traceability.py b/tools/check_rdm_traceability.py index 655e591..f84ab4f 100644 --- a/tools/check_rdm_traceability.py +++ b/tools/check_rdm_traceability.py @@ -5,6 +5,9 @@ production, and checks that `__design__/rdm/traceability.md` has one row for it, in the table of the same grammar, with a disposition of `stored`, `derived` or `dropped` and a non-empty target. A row that names no production fails too, so a renamed production cannot leave a stale row. +Beyond presence: a `stored` target must name, in backticks, fields that exist in +`crates/rdm-schema/src/stored.rs` (its last path segment, or a type name), a `dropped` row needs a +reason of at least three words, and a target of `-` or nothing is refused. Usage: uv run --no-project tools/check_rdm_traceability.py Exit status: 0 when every production is traced, 1 otherwise, 2 when the grammar printer fails. @@ -23,6 +26,12 @@ TABLE = ROOT / "__design__/rdm/traceability.md" GRAMMARS = {"leaf": "## Leaf grammar", "readme": "## README grammar"} DISPOSITIONS = {"stored", "derived", "dropped"} +STORED_RS = ROOT / "crates/rdm-schema/src/stored.rs" +MIN_REASON_WORDS = 3 +# Backticked tokens that are file names or values, not fields. +LITERALS = {"md", "json", "true", "false"} +# A backticked token that is a field path: steps[].title, Leaf.progress.branch, notes. +FIELD_PATH = re.compile(r"`([A-Za-z_][A-Za-z0-9_]*(?:\[\])?(?:\.[A-Za-z_][A-Za-z0-9_]*(?:\[\])?)*)`") # A production starts a line: ::= or TOKEN ::=. Comment lines start with '#'. PRODUCTION = re.compile(r"^(<[a-z0-9-]+>|[A-Z][A-Z_]*)\s*::=") @@ -63,6 +72,32 @@ def table_rows(markdown: str, heading: str) -> list[tuple[str, str, str]]: return rows +def stored_names() -> set[str]: + """Field names and type names declared in stored.rs (`pub name:`, `struct`, `enum`).""" + text = STORED_RS.read_text(encoding="utf-8") + names = set(re.findall(r"pub\s+(?:r#)?([a-z_][a-z0-9_]*)\s*:", text)) + names |= set(re.findall(r"pub\s+(?:struct|enum|type)\s+([A-Za-z0-9_]+)", text)) + return names + + +def target_problems(disposition: str, target: str, known: set[str]) -> list[str]: + """Return what is wrong with a row's target, or nothing.""" + if target in {"", "-", "--", "—"}: + return ["has an empty target or reason"] + if disposition == "dropped" and len(target.split()) < MIN_REASON_WORDS: + return [f"has a dropped reason of fewer than {MIN_REASON_WORDS} words: '{target}'"] + if disposition == "stored": + paths = [ + p for p in FIELD_PATH.findall(target) if p.split(".")[-1] not in LITERALS + ] + if not paths: + return [f"stored target names no field in backticks: '{target}'"] + bad = [p for p in paths if p.replace("[]", "").split(".")[-1] not in known] + if bad: + return [f"stored target names no field of stored.rs: {', '.join(bad)}"] + return [] + + def print_grammar(name: str) -> str: """Run the grammar printer from the repository root and return its output.""" result = subprocess.run( @@ -83,6 +118,7 @@ def main() -> int: return 1 markdown = TABLE.read_text(encoding="utf-8") problems: list[str] = [] + known = stored_names() for grammar, heading in GRAMMARS.items(): names = production_names(print_grammar(grammar)) rows = table_rows(markdown, heading) @@ -99,8 +135,8 @@ def main() -> int: disposition, target = entries[0] if disposition not in DISPOSITIONS: problems.append(f"{grammar}: {name} has disposition '{disposition}'") - if not target: - problems.append(f"{grammar}: {name} has an empty target or reason") + for issue in target_problems(disposition, target, known): + problems.append(f"{grammar}: {name} {issue}") for name in by_name: if name not in names: problems.append(f"{grammar}: row {name} matches no production") From e66030f1c49ad75ca3a5a5b24569cd81dac6c350 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 16:03:42 +0900 Subject: [PATCH 033/183] fix(rdm-schema): keep unknown key order, pin version strings and reject orphan schemas Enable serde_json preserve_order, make parse_version strict, add a version pattern to the generated schemas, and fail the drift test on a schema file no type generates. Co-Authored-By: Claude Sonnet 5.5 --- Cargo.lock | 30 + crates/rdm-schema/Cargo.toml | 2 +- .../rdm-schema/schemas/amendment.schema.json | 71 +- .../schemas/amendments_view.schema.json | 198 ++-- crates/rdm-schema/schemas/comment.schema.json | 29 +- .../rdm-schema/schemas/directory.schema.json | 95 +- crates/rdm-schema/schemas/leaf.schema.json | 419 +++---- .../rdm-schema/schemas/node_view.schema.json | 1047 +++++++++-------- .../schemas/outline_view.schema.json | 326 ++--- .../rdm-schema/schemas/ready_view.schema.json | 150 +-- crates/rdm-schema/src/lib.rs | 11 +- crates/rdm-schema/src/read.rs | 2 + crates/rdm-schema/src/stored.rs | 4 + crates/rdm-schema/tests/schemas.rs | 40 + crates/rdm-schema/tests/stored.rs | 17 + 15 files changed, 1277 insertions(+), 1164 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f030af2..4a8e6fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,34 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", +] + [[package]] name = "itoa" version = "1.0.19" @@ -139,6 +167,8 @@ version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ + "foldhash", + "indexmap", "itoa", "memchr", "serde", diff --git a/crates/rdm-schema/Cargo.toml b/crates/rdm-schema/Cargo.toml index 678ac52..75fdee8 100644 --- a/crates/rdm-schema/Cargo.toml +++ b/crates/rdm-schema/Cargo.toml @@ -10,5 +10,5 @@ publish = false [dependencies] serde = { version = "1", features = ["derive"] } -serde_json = "1" +serde_json = { version = "1", features = ["preserve_order"] } schemars = "1" diff --git a/crates/rdm-schema/schemas/amendment.schema.json b/crates/rdm-schema/schemas/amendment.schema.json index 1f97ca3..4229f34 100644 --- a/crates/rdm-schema/schemas/amendment.schema.json +++ b/crates/rdm-schema/schemas/amendment.schema.json @@ -4,17 +4,9 @@ "description": "`_amendments/.json`.", "type": "object", "properties": { - "actor": { - "$ref": "#/$defs/Actor" - }, - "changes": { - "type": "array", - "items": { - "$ref": "#/$defs/Change" - } - }, - "description": { - "type": "string" + "schema_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "id": { "type": "string" @@ -25,27 +17,35 @@ "null" ] }, - "op_id": { + "ts": { + "type": "string" + }, + "actor": { + "$ref": "#/$defs/Actor" + }, + "description": { + "type": "string" + }, + "source": { "type": [ "string", "null" ] }, - "schema_version": { - "type": "string" - }, - "snapshot": true, - "source": { + "op_id": { "type": [ "string", "null" ] }, - "ts": { - "type": "string" - } + "changes": { + "type": "array", + "items": { + "$ref": "#/$defs/Change" + } + }, + "snapshot": true }, - "additionalProperties": true, "required": [ "schema_version", "id", @@ -54,6 +54,7 @@ "description", "changes" ], + "additionalProperties": true, "$defs": { "Actor": { "description": "Who made a move, a comment or an amendment.", @@ -69,10 +70,10 @@ ] } }, - "additionalProperties": true, "required": [ "kind" - ] + ], + "additionalProperties": true }, "ActorKind": { "description": "`Actor.kind`.", @@ -87,38 +88,38 @@ "description": "An element of `Amendment.changes`.", "type": "object", "properties": { - "field": { - "type": [ - "string", - "null" - ] - }, - "new": true, "node_id": { "type": "string" }, - "old": true, "op": { "$ref": "#/$defs/ChangeOp" }, + "path_before": { + "type": [ + "string", + "null" + ] + }, "path_after": { "type": [ "string", "null" ] }, - "path_before": { + "field": { "type": [ "string", "null" ] - } + }, + "old": true, + "new": true }, - "additionalProperties": true, "required": [ "node_id", "op" - ] + ], + "additionalProperties": true }, "ChangeOp": { "description": "`Change.op`.", diff --git a/crates/rdm-schema/schemas/amendments_view.schema.json b/crates/rdm-schema/schemas/amendments_view.schema.json index a2d15df..029a3b4 100644 --- a/crates/rdm-schema/schemas/amendments_view.schema.json +++ b/crates/rdm-schema/schemas/amendments_view.schema.json @@ -4,22 +4,21 @@ "description": "The amendment log.", "type": "object", "properties": { - "amendments": { - "type": "array", - "items": { - "$ref": "#/$defs/AmendmentEntry" - } - }, - "campaign": { - "$ref": "#/$defs/CampaignRef" + "read_model_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "format_version": { - "type": "string" + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "projection": { "$ref": "#/$defs/Projection" }, - "read_model_version": { + "campaign": { + "$ref": "#/$defs/CampaignRef" + }, + "tree_rev": { "type": "string" }, "total": { @@ -27,11 +26,13 @@ "format": "uint32", "minimum": 0 }, - "tree_rev": { - "type": "string" + "amendments": { + "type": "array", + "items": { + "$ref": "#/$defs/AmendmentEntry" + } } }, - "additionalProperties": true, "required": [ "read_model_version", "format_version", @@ -41,83 +42,86 @@ "total", "amendments" ], + "additionalProperties": true, "$defs": { - "Actor": { - "description": "Who made a move, a comment or an amendment.", + "Projection": { + "description": "Which projection a payload is.", + "type": "string", + "enum": [ + "outline", + "node", + "ready", + "amendments" + ] + }, + "CampaignRef": { + "description": "Identity of the campaign in an envelope.", "type": "object", "properties": { - "kind": { - "$ref": "#/$defs/ActorKind" + "id": { + "type": "string" }, - "name": { - "type": [ - "string", - "null" - ] + "path": { + "type": "string" + }, + "title": { + "type": "string" } }, - "additionalProperties": true, "required": [ - "kind" - ] - }, - "ActorKind": { - "description": "`Actor.kind`.", - "type": "string", - "enum": [ - "agent", - "human", - "import" - ] + "id", + "path", + "title" + ], + "additionalProperties": true }, "AmendmentEntry": { "description": "One amendment of the log.", "type": "object", "properties": { - "actor": { - "$ref": "#/$defs/Actor" - }, - "changes": { - "type": "array", - "items": { - "$ref": "#/$defs/ChangeView" - } - }, - "description": { + "id": { "type": "string" }, "display_id": { "type": "string" }, - "has_snapshot": { - "type": "boolean" - }, - "id": { - "type": "string" - }, "legacy_id": { "type": [ "string", "null" ] }, - "op_id": { + "ts": { + "type": "string" + }, + "actor": { + "$ref": "#/$defs/Actor" + }, + "description": { + "type": "string" + }, + "source": { "type": [ "string", "null" ] }, - "source": { + "op_id": { "type": [ "string", "null" ] }, - "ts": { - "type": "string" + "has_snapshot": { + "type": "boolean" + }, + "changes": { + "type": "array", + "items": { + "$ref": "#/$defs/ChangeView" + } } }, - "additionalProperties": true, "required": [ "id", "display_id", @@ -126,54 +130,41 @@ "description", "has_snapshot", "changes" - ] + ], + "additionalProperties": true }, - "CampaignRef": { - "description": "Identity of the campaign in an envelope.", + "Actor": { + "description": "Who made a move, a comment or an amendment.", "type": "object", "properties": { - "id": { - "type": "string" - }, - "path": { - "type": "string" + "kind": { + "$ref": "#/$defs/ActorKind" }, - "title": { - "type": "string" + "name": { + "type": [ + "string", + "null" + ] } }, - "additionalProperties": true, "required": [ - "id", - "path", - "title" - ] + "kind" + ], + "additionalProperties": true }, - "ChangeOp": { - "description": "`Change.op`.", + "ActorKind": { + "description": "`Actor.kind`.", "type": "string", "enum": [ - "add", - "remove", - "set", - "rename", - "move" + "agent", + "human", + "import" ] }, "ChangeView": { "description": "A stored change plus the node's current path and title.", "type": "object", "properties": { - "field": { - "type": [ - "string", - "null" - ] - }, - "new": true, - "node_id": { - "type": "string" - }, "node_path": { "type": [ "string", @@ -186,37 +177,48 @@ "null" ] }, - "old": true, + "node_id": { + "type": "string" + }, "op": { "$ref": "#/$defs/ChangeOp" }, + "path_before": { + "type": [ + "string", + "null" + ] + }, "path_after": { "type": [ "string", "null" ] }, - "path_before": { + "field": { "type": [ "string", "null" ] - } + }, + "old": true, + "new": true }, - "additionalProperties": true, "required": [ "node_id", "op" - ] + ], + "additionalProperties": true }, - "Projection": { - "description": "Which projection a payload is.", + "ChangeOp": { + "description": "`Change.op`.", "type": "string", "enum": [ - "outline", - "node", - "ready", - "amendments" + "add", + "remove", + "set", + "rename", + "move" ] } } diff --git a/crates/rdm-schema/schemas/comment.schema.json b/crates/rdm-schema/schemas/comment.schema.json index 7d399cf..1ec9f8c 100644 --- a/crates/rdm-schema/schemas/comment.schema.json +++ b/crates/rdm-schema/schemas/comment.schema.json @@ -4,8 +4,9 @@ "description": "`_comments/.json`.", "type": "object", "properties": { - "actor": { - "$ref": "#/$defs/Actor" + "schema_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "id": { "type": "string" @@ -13,26 +14,25 @@ "node_id": { "type": "string" }, - "op_id": { - "type": [ - "string", - "null" - ] - }, - "schema_version": { + "ts": { "type": "string" }, + "actor": { + "$ref": "#/$defs/Actor" + }, "text": { "type": "array", "items": { "type": "string" } }, - "ts": { - "type": "string" + "op_id": { + "type": [ + "string", + "null" + ] } }, - "additionalProperties": true, "required": [ "schema_version", "id", @@ -41,6 +41,7 @@ "actor", "text" ], + "additionalProperties": true, "$defs": { "Actor": { "description": "Who made a move, a comment or an amendment.", @@ -56,10 +57,10 @@ ] } }, - "additionalProperties": true, "required": [ "kind" - ] + ], + "additionalProperties": true }, "ActorKind": { "description": "`Actor.kind`.", diff --git a/crates/rdm-schema/schemas/directory.schema.json b/crates/rdm-schema/schemas/directory.schema.json index 6b776f0..00390c0 100644 --- a/crates/rdm-schema/schemas/directory.schema.json +++ b/crates/rdm-schema/schemas/directory.schema.json @@ -4,59 +4,59 @@ "description": "`_dir.json`: the campaign root and every directory node.", "type": "object", "properties": { + "schema_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" + }, + "id": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/DirectoryKind" + }, + "title": { + "type": "string" + }, "context": { "type": "array", "items": { "type": "string" } }, - "goal": { - "type": "string" - }, - "gotchas": { + "references": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/Reference" } }, - "id": { + "goal": { "type": "string" }, - "kind": { - "$ref": "#/$defs/DirectoryKind" - }, - "notes": { + "preconditions": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/Criterion" } }, - "preconditions": { + "success_gates": { "type": "array", "items": { "$ref": "#/$defs/Criterion" } }, - "references": { + "gotchas": { "type": "array", "items": { - "$ref": "#/$defs/Reference" + "type": "string" } }, - "schema_version": { - "type": "string" - }, - "success_gates": { + "notes": { "type": "array", "items": { - "$ref": "#/$defs/Criterion" + "type": "string" } - }, - "title": { - "type": "string" } }, - "additionalProperties": true, "required": [ "schema_version", "id", @@ -70,24 +70,8 @@ "gotchas", "notes" ], + "additionalProperties": true, "$defs": { - "Criterion": { - "description": "An element of `preconditions` or `success_gates`.", - "type": "object", - "properties": { - "met": { - "type": "boolean" - }, - "text": { - "type": "string" - } - }, - "additionalProperties": true, - "required": [ - "text", - "met" - ] - }, "DirectoryKind": { "description": "`Directory.kind`.", "type": "string", @@ -106,26 +90,43 @@ "null" ] }, - "note": { + "title": { + "type": "string" + }, + "target": { "type": [ "string", "null" ] }, - "target": { + "note": { "type": [ "string", "null" ] - }, - "title": { - "type": "string" } }, - "additionalProperties": true, "required": [ "title" - ] + ], + "additionalProperties": true + }, + "Criterion": { + "description": "An element of `preconditions` or `success_gates`.", + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "met": { + "type": "boolean" + } + }, + "required": [ + "text", + "met" + ], + "additionalProperties": true } } } diff --git a/crates/rdm-schema/schemas/leaf.schema.json b/crates/rdm-schema/schemas/leaf.schema.json index 59cea75..fc78f56 100644 --- a/crates/rdm-schema/schemas/leaf.schema.json +++ b/crates/rdm-schema/schemas/leaf.schema.json @@ -4,14 +4,9 @@ "description": "`.json`.", "type": "object", "properties": { - "goal": { - "type": "string" - }, - "history": { - "type": "array", - "items": { - "$ref": "#/$defs/History" - } + "schema_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "id": { "type": "string" @@ -19,14 +14,32 @@ "kind": { "$ref": "#/$defs/LeafKind" }, + "title": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] + }, + "goal": { + "type": "string" + }, "preconditions": { "type": "array", "items": { "$ref": "#/$defs/Criterion" } }, - "progress": { - "$ref": "#/$defs/Progress" + "success_gates": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } }, "references": { "type": "array", @@ -34,35 +47,22 @@ "$ref": "#/$defs/Reference" } }, - "schema_version": { - "type": "string" - }, - "status": { - "$ref": "#/$defs/Status" - }, - "status_reason": { - "type": [ - "string", - "null" - ] - }, "steps": { "type": "array", "items": { "$ref": "#/$defs/Step" } }, - "success_gates": { + "progress": { + "$ref": "#/$defs/Progress" + }, + "history": { "type": "array", "items": { - "$ref": "#/$defs/Criterion" + "$ref": "#/$defs/History" } - }, - "title": { - "type": "string" } }, - "additionalProperties": true, "required": [ "schema_version", "id", @@ -77,101 +77,174 @@ "progress", "history" ], + "additionalProperties": true, "$defs": { - "Actor": { - "description": "Who made a move, a comment or an amendment.", + "LeafKind": { + "description": "`Leaf.kind`, the one value `leaf`.", + "type": "string", + "enum": [ + "leaf" + ] + }, + "Status": { + "description": "The five statuses of a leaf (`statuses.md`).", + "type": "string", + "enum": [ + "planned", + "ongoing", + "paused", + "cancelled", + "done" + ] + }, + "Criterion": { + "description": "An element of `preconditions` or `success_gates`.", "type": "object", "properties": { - "kind": { - "$ref": "#/$defs/ActorKind" + "text": { + "type": "string" }, - "name": { - "type": [ - "string", - "null" - ] + "met": { + "type": "boolean" } }, - "additionalProperties": true, "required": [ - "kind" - ] - }, - "ActorKind": { - "description": "`Actor.kind`.", - "type": "string", - "enum": [ - "agent", - "human", - "import" - ] + "text", + "met" + ], + "additionalProperties": true }, - "Check": { - "description": "An element of `Step.checks`.", + "Reference": { + "description": "An element of `references`.", "type": "object", "properties": { - "command": { + "label": { "type": [ "string", "null" ] }, - "expected": { - "$ref": "#/$defs/Expected" - }, - "text": { + "title": { "type": "string" + }, + "target": { + "type": [ + "string", + "null" + ] + }, + "note": { + "type": [ + "string", + "null" + ] } }, - "additionalProperties": true, "required": [ - "text", - "expected" - ] + "title" + ], + "additionalProperties": true }, - "Commit": { - "description": "`Step.commit`.", + "Step": { + "description": "An element of `Leaf.steps`.", "type": "object", "properties": { - "breaking": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "goal": { + "type": "string" + }, + "implementation_logic": { + "type": "array", + "items": { + "type": "string" + } + }, + "deliverables": { + "type": "array", + "items": { + "type": "string" + } + }, + "references": { + "type": "array", + "items": { + "$ref": "#/$defs/Reference" + } + }, + "checks": { + "type": "array", + "items": { + "$ref": "#/$defs/Check" + } + }, + "commit": { + "$ref": "#/$defs/Commit" + }, + "requires": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "done": { "type": "boolean" }, - "scope": { + "commit_sha": { "type": [ "string", "null" ] }, - "summary": { - "type": "string" - }, - "type": { - "type": "string" + "done_at": { + "type": [ + "string", + "null" + ] } }, - "additionalProperties": true, "required": [ - "type", - "breaking", - "summary" - ] + "id", + "title", + "goal", + "implementation_logic", + "deliverables", + "references", + "checks", + "commit", + "done" + ], + "additionalProperties": true }, - "Criterion": { - "description": "An element of `preconditions` or `success_gates`.", + "Check": { + "description": "An element of `Step.checks`.", "type": "object", "properties": { - "met": { - "type": "boolean" - }, "text": { "type": "string" + }, + "expected": { + "$ref": "#/$defs/Expected" + }, + "command": { + "type": [ + "string", + "null" + ] } }, - "additionalProperties": true, "required": [ "text", - "met" - ] + "expected" + ], + "additionalProperties": true }, "Expected": { "description": "`Check.expected`.", @@ -181,55 +254,32 @@ "FAIL" ] }, - "History": { - "description": "An element of `Leaf.history`: one status move.", + "Commit": { + "description": "`Step.commit`.", "type": "object", "properties": { - "actor": { - "$ref": "#/$defs/Actor" - }, - "from": { - "$ref": "#/$defs/Status" - }, - "op_id": { - "type": [ - "string", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ] + "type": { + "type": "string" }, - "reason": { + "scope": { "type": [ "string", "null" ] }, - "to": { - "$ref": "#/$defs/Status" + "breaking": { + "type": "boolean" }, - "ts": { + "summary": { "type": "string" } }, - "additionalProperties": true, "required": [ - "ts", - "from", - "to", - "actor" - ] - }, - "LeafKind": { - "description": "`Leaf.kind`, the one value `leaf`.", - "type": "string", - "enum": [ - "leaf" - ] + "type", + "breaking", + "summary" + ], + "additionalProperties": true }, "Progress": { "description": "`Leaf.progress`.", @@ -256,129 +306,80 @@ } } }, - "additionalProperties": true, "required": [ "notes" - ] + ], + "additionalProperties": true }, - "Reference": { - "description": "An element of `references`.", + "History": { + "description": "An element of `Leaf.history`: one status move.", "type": "object", "properties": { - "label": { + "ts": { + "type": "string" + }, + "from": { + "$ref": "#/$defs/Status" + }, + "to": { + "$ref": "#/$defs/Status" + }, + "actor": { + "$ref": "#/$defs/Actor" + }, + "reason": { "type": [ "string", "null" ] }, - "note": { + "override": { "type": [ - "string", + "boolean", "null" ] }, - "target": { + "op_id": { "type": [ "string", "null" ] - }, - "title": { - "type": "string" } }, - "additionalProperties": true, "required": [ - "title" - ] - }, - "Status": { - "description": "The five statuses of a leaf (`statuses.md`).", - "type": "string", - "enum": [ - "planned", - "ongoing", - "paused", - "cancelled", - "done" - ] + "ts", + "from", + "to", + "actor" + ], + "additionalProperties": true }, - "Step": { - "description": "An element of `Leaf.steps`.", + "Actor": { + "description": "Who made a move, a comment or an amendment.", "type": "object", "properties": { - "checks": { - "type": "array", - "items": { - "$ref": "#/$defs/Check" - } - }, - "commit": { - "$ref": "#/$defs/Commit" - }, - "commit_sha": { - "type": [ - "string", - "null" - ] - }, - "deliverables": { - "type": "array", - "items": { - "type": "string" - } - }, - "done": { - "type": "boolean" + "kind": { + "$ref": "#/$defs/ActorKind" }, - "done_at": { + "name": { "type": [ "string", "null" ] - }, - "goal": { - "type": "string" - }, - "id": { - "type": "string" - }, - "implementation_logic": { - "type": "array", - "items": { - "type": "string" - } - }, - "references": { - "type": "array", - "items": { - "$ref": "#/$defs/Reference" - } - }, - "requires": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "title": { - "type": "string" } }, - "additionalProperties": true, "required": [ - "id", - "title", - "goal", - "implementation_logic", - "deliverables", - "references", - "checks", - "commit", - "done" + "kind" + ], + "additionalProperties": true + }, + "ActorKind": { + "description": "`Actor.kind`.", + "type": "string", + "enum": [ + "agent", + "human", + "import" ] } } diff --git a/crates/rdm-schema/schemas/node_view.schema.json b/crates/rdm-schema/schemas/node_view.schema.json index f3eab4d..22da05e 100644 --- a/crates/rdm-schema/schemas/node_view.schema.json +++ b/crates/rdm-schema/schemas/node_view.schema.json @@ -4,32 +4,33 @@ "description": "Node detail.", "type": "object", "properties": { + "read_model_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" + }, + "format_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" + }, + "projection": { + "$ref": "#/$defs/Projection" + }, "campaign": { "$ref": "#/$defs/CampaignRef" }, - "format_version": { + "tree_rev": { "type": "string" }, + "node": { + "$ref": "#/$defs/NodeDetail" + }, "holders": { "type": "object", "additionalProperties": { "$ref": "#/$defs/Holder" } - }, - "node": { - "$ref": "#/$defs/NodeDetail" - }, - "projection": { - "$ref": "#/$defs/Projection" - }, - "read_model_version": { - "type": "string" - }, - "tree_rev": { - "type": "string" } }, - "additionalProperties": true, "required": [ "read_model_version", "format_version", @@ -39,33 +40,16 @@ "node", "holders" ], + "additionalProperties": true, "$defs": { - "Actor": { - "description": "Who made a move, a comment or an amendment.", - "type": "object", - "properties": { - "kind": { - "$ref": "#/$defs/ActorKind" - }, - "name": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": true, - "required": [ - "kind" - ] - }, - "ActorKind": { - "description": "`Actor.kind`.", + "Projection": { + "description": "Which projection a payload is.", "type": "string", "enum": [ - "agent", - "human", - "import" + "outline", + "node", + "ready", + "amendments" ] }, "CampaignRef": { @@ -82,288 +66,320 @@ "type": "string" } }, - "additionalProperties": true, "required": [ "id", "path", "title" - ] + ], + "additionalProperties": true }, - "Check": { - "description": "An element of `Step.checks`.", - "type": "object", - "properties": { - "command": { - "type": [ - "string", - "null" + "NodeDetail": { + "description": "The detail of one node, discriminated by `kind`.", + "oneOf": [ + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "leaf" + } + }, + "$ref": "#/$defs/LeafDetail", + "required": [ + "kind" ] }, - "expected": { - "$ref": "#/$defs/Expected" - }, - "text": { - "type": "string" + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "directory" + } + }, + "$ref": "#/$defs/DirectoryDetail", + "required": [ + "kind" + ] } - }, - "additionalProperties": true, - "required": [ - "text", - "expected" ] }, - "ChildRef": { - "description": "A child in a directory's detail.", + "Status": { + "description": "The five statuses of a leaf (`statuses.md`).", + "type": "string", + "enum": [ + "planned", + "ongoing", + "paused", + "cancelled", + "done" + ] + }, + "LevelSource": { + "description": "The rule that produced a `level`. One value today.", + "type": "string", + "enum": [ + "depth" + ] + }, + "Criterion": { + "description": "An element of `preconditions` or `success_gates`.", "type": "object", "properties": { - "id": { - "type": "string" - }, - "kind": { - "$ref": "#/$defs/NodeKind" - }, - "path": { + "text": { "type": "string" }, - "status": { - "$ref": "#/$defs/Status" - }, - "title": { - "type": "string" + "met": { + "type": "boolean" } }, - "additionalProperties": true, "required": [ - "id", - "path", - "kind", - "title", - "status" - ] + "text", + "met" + ], + "additionalProperties": true }, - "Comment": { - "description": "`_comments/.json`.", + "Reference": { + "description": "An element of `references`.", "type": "object", "properties": { - "actor": { - "$ref": "#/$defs/Actor" - }, - "id": { - "type": "string" - }, - "node_id": { - "type": "string" - }, - "op_id": { + "label": { "type": [ "string", "null" ] }, - "schema_version": { - "type": "string" - }, - "text": { - "type": "array", - "items": { - "type": "string" - } - }, - "ts": { + "title": { "type": "string" - } - }, - "additionalProperties": true, - "required": [ - "schema_version", - "id", - "node_id", - "ts", - "actor", - "text" - ] - }, - "Commit": { - "description": "`Step.commit`.", - "type": "object", - "properties": { - "breaking": { - "type": "boolean" }, - "scope": { + "target": { "type": [ "string", "null" ] }, - "summary": { - "type": "string" - }, - "type": { - "type": "string" + "note": { + "type": [ + "string", + "null" + ] } }, - "additionalProperties": true, "required": [ - "type", - "breaking", - "summary" - ] + "title" + ], + "additionalProperties": true }, - "Criterion": { - "description": "An element of `preconditions` or `success_gates`.", + "StepView": { + "description": "A stored step plus its derived number.", "type": "object", "properties": { - "met": { - "type": "boolean" + "number": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "text": { + "id": { "type": "string" - } - }, - "additionalProperties": true, - "required": [ - "text", - "met" - ] - }, - "DirectoryDetail": { - "description": "Detail of a directory or the campaign root.", - "type": "object", - "properties": { - "added_by": { - "type": [ - "string", - "null" - ] }, - "amendments": { + "title": { + "type": "string" + }, + "goal": { + "type": "string" + }, + "implementation_logic": { "type": "array", "items": { "type": "string" } }, - "children": { + "deliverables": { "type": "array", "items": { - "$ref": "#/$defs/ChildRef" + "type": "string" } }, - "comments": { + "references": { "type": "array", "items": { - "$ref": "#/$defs/Comment" + "$ref": "#/$defs/Reference" } }, - "context": { + "checks": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/Check" } }, - "counts": { - "$ref": "#/$defs/StatusCounts" - }, - "goal": { - "type": "string" + "commit": { + "$ref": "#/$defs/Commit" }, - "gotchas": { - "type": "array", + "requires": { + "type": [ + "array", + "null" + ], "items": { "type": "string" } }, - "id": { - "type": "string" - }, - "is_campaign": { + "done": { "type": "boolean" }, - "notes": { - "type": "array", - "items": { - "type": "string" - } + "commit_sha": { + "type": [ + "string", + "null" + ] }, - "parent": { + "done_at": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "number", + "id", + "title", + "goal", + "implementation_logic", + "deliverables", + "references", + "checks", + "commit", + "done" + ], + "additionalProperties": true + }, + "Check": { + "description": "An element of `Step.checks`.", + "type": "object", + "properties": { + "text": { "type": "string" }, - "path": { + "expected": { + "$ref": "#/$defs/Expected" + }, + "command": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "text", + "expected" + ], + "additionalProperties": true + }, + "Expected": { + "description": "`Check.expected`.", + "type": "string", + "enum": [ + "PASS", + "FAIL" + ] + }, + "Commit": { + "description": "`Step.commit`.", + "type": "object", + "properties": { + "type": { "type": "string" }, - "preconditions": { - "type": "array", - "items": { - "$ref": "#/$defs/Criterion" - } + "scope": { + "type": [ + "string", + "null" + ] }, - "references": { - "type": "array", - "items": { - "$ref": "#/$defs/Reference" - } + "breaking": { + "type": "boolean" }, - "rev": { + "summary": { "type": "string" + } + }, + "required": [ + "type", + "breaking", + "summary" + ], + "additionalProperties": true + }, + "Progress": { + "description": "`Leaf.progress`.", + "type": "object", + "properties": { + "branch": { + "type": [ + "string", + "null" + ] }, - "sealed": { - "type": "boolean" - }, - "status": { - "$ref": "#/$defs/Status" + "commits": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 }, - "success_gates": { + "notes": { "type": "array", "items": { - "$ref": "#/$defs/Criterion" + "type": "string" } - }, - "title": { - "type": "string" } }, - "additionalProperties": true, "required": [ - "id", - "path", - "parent", - "rev", - "title", - "sealed", - "comments", - "amendments", - "is_campaign", - "status", - "counts", - "context", - "goal", - "preconditions", - "success_gates", - "references", - "gotchas", - "notes", - "children" - ] + "notes" + ], + "additionalProperties": true }, - "Expected": { - "description": "`Check.expected`.", - "type": "string", - "enum": [ - "PASS", - "FAIL" - ] + "StepCounts": { + "description": "`{done, total}` of a leaf's steps.", + "type": "object", + "properties": { + "done": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "done", + "total" + ], + "additionalProperties": true }, "History": { "description": "An element of `Leaf.history`: one status move.", "type": "object", "properties": { - "actor": { - "$ref": "#/$defs/Actor" + "ts": { + "type": "string" }, "from": { "$ref": "#/$defs/Status" }, - "op_id": { + "to": { + "$ref": "#/$defs/Status" + }, + "actor": { + "$ref": "#/$defs/Actor" + }, + "reason": { "type": [ "string", "null" @@ -375,139 +391,110 @@ "null" ] }, - "reason": { + "op_id": { "type": [ "string", "null" ] - }, - "to": { - "$ref": "#/$defs/Status" - }, - "ts": { - "type": "string" } }, - "additionalProperties": true, "required": [ "ts", "from", "to", "actor" - ] + ], + "additionalProperties": true }, - "Holder": { - "description": "A leaf that holds another back.", + "Actor": { + "description": "Who made a move, a comment or an amendment.", "type": "object", "properties": { - "path": { - "type": "string" - }, - "status": { - "$ref": "#/$defs/Status" + "kind": { + "$ref": "#/$defs/ActorKind" }, - "status_reason": { + "name": { "type": [ "string", "null" ] - }, - "title": { - "type": "string" } }, - "additionalProperties": true, "required": [ - "path", - "title", - "status" + "kind" + ], + "additionalProperties": true + }, + "ActorKind": { + "description": "`Actor.kind`.", + "type": "string", + "enum": [ + "agent", + "human", + "import" ] }, - "LeafDetail": { - "description": "Detail of a leaf.", + "Comment": { + "description": "`_comments/.json`.", "type": "object", "properties": { - "added_by": { - "type": [ - "string", - "null" - ] - }, - "amendments": { - "type": "array", - "items": { - "type": "string" - } + "schema_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, - "comments": { - "type": "array", - "items": { - "$ref": "#/$defs/Comment" - } + "id": { + "type": "string" }, - "commit_count": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 + "node_id": { + "type": "string" }, - "goal": { + "ts": { "type": "string" }, - "held_by": { - "type": "array", - "items": { - "type": "string" - } + "actor": { + "$ref": "#/$defs/Actor" }, - "history": { + "text": { "type": "array", "items": { - "$ref": "#/$defs/History" + "type": "string" } }, + "op_id": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "schema_version", + "id", + "node_id", + "ts", + "actor", + "text" + ], + "additionalProperties": true + }, + "LeafDetail": { + "description": "Detail of a leaf.", + "type": "object", + "properties": { "id": { "type": "string" }, - "level": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "level_source": { - "$ref": "#/$defs/LevelSource" - }, - "parent": { - "type": "string" - }, "path": { "type": "string" }, - "preconditions": { - "type": "array", - "items": { - "$ref": "#/$defs/Criterion" - } - }, - "progress": { - "$ref": "#/$defs/Progress" - }, - "ready": { - "type": "boolean" - }, - "references": { - "type": "array", - "items": { - "$ref": "#/$defs/Reference" - } + "parent": { + "type": "string" }, "rev": { "type": "string" }, - "sealed": { - "type": "boolean" + "title": { + "type": "string" }, "status": { "$ref": "#/$defs/Status" @@ -524,288 +511,262 @@ "null" ] }, - "step_progress": { - "$ref": "#/$defs/StepCounts" + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "steps": { + "level_source": { + "$ref": "#/$defs/LevelSource" + }, + "ready": { + "type": "boolean" + }, + "held_by": { "type": "array", "items": { - "$ref": "#/$defs/StepView" + "type": "string" } }, - "success_gates": { + "sealed": { + "type": "boolean" + }, + "goal": { + "type": "string" + }, + "preconditions": { "type": "array", "items": { "$ref": "#/$defs/Criterion" } }, - "title": { - "type": "string" - } - }, - "additionalProperties": true, - "required": [ - "id", - "path", - "parent", - "rev", - "title", - "status", - "level", - "level_source", - "ready", - "held_by", - "sealed", - "goal", - "preconditions", - "success_gates", - "references", - "steps", - "progress", - "step_progress", - "history", - "comments", - "amendments" - ] - }, - "LevelSource": { - "description": "The rule that produced a `level`. One value today.", - "type": "string", - "enum": [ - "depth" - ] - }, - "NodeDetail": { - "description": "The detail of one node, discriminated by `kind`.", - "oneOf": [ - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "const": "leaf" - } - }, - "$ref": "#/$defs/LeafDetail", - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "const": "directory" - } - }, - "$ref": "#/$defs/DirectoryDetail", - "required": [ - "kind" - ] - } - ] - }, - "NodeKind": { - "description": "`NodeKind` of a child reference.", - "type": "string", - "enum": [ - "leaf", - "directory" - ] - }, - "Progress": { - "description": "`Leaf.progress`.", - "type": "object", - "properties": { - "branch": { - "type": [ - "string", - "null" - ] + "success_gates": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } }, - "commits": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 + "references": { + "type": "array", + "items": { + "$ref": "#/$defs/Reference" + } }, - "notes": { + "steps": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/StepView" } - } - }, - "additionalProperties": true, - "required": [ - "notes" - ] - }, - "Projection": { - "description": "Which projection a payload is.", - "type": "string", - "enum": [ - "outline", - "node", - "ready", - "amendments" - ] - }, - "Reference": { - "description": "An element of `references`.", - "type": "object", - "properties": { - "label": { - "type": [ - "string", - "null" - ] }, - "note": { + "progress": { + "$ref": "#/$defs/Progress" + }, + "commit_count": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "uint64", + "minimum": 0 }, - "target": { + "step_progress": { + "$ref": "#/$defs/StepCounts" + }, + "history": { + "type": "array", + "items": { + "$ref": "#/$defs/History" + } + }, + "comments": { + "type": "array", + "items": { + "$ref": "#/$defs/Comment" + } + }, + "amendments": { + "type": "array", + "items": { + "type": "string" + } + }, + "added_by": { "type": [ "string", "null" ] - }, - "title": { - "type": "string" } }, - "additionalProperties": true, "required": [ - "title" - ] - }, - "Status": { - "description": "The five statuses of a leaf (`statuses.md`).", - "type": "string", - "enum": [ - "planned", - "ongoing", - "paused", - "cancelled", - "done" - ] + "id", + "path", + "parent", + "rev", + "title", + "status", + "level", + "level_source", + "ready", + "held_by", + "sealed", + "goal", + "preconditions", + "success_gates", + "references", + "steps", + "progress", + "step_progress", + "history", + "comments", + "amendments" + ], + "additionalProperties": true }, "StatusCounts": { "description": "Leaves counted by status.", "type": "object", "properties": { - "cancelled": { + "planned": { "type": "integer", "format": "uint32", "minimum": 0 }, - "done": { + "ongoing": { "type": "integer", "format": "uint32", "minimum": 0 }, - "ongoing": { + "paused": { "type": "integer", "format": "uint32", "minimum": 0 }, - "paused": { + "cancelled": { "type": "integer", "format": "uint32", "minimum": 0 }, - "planned": { + "done": { "type": "integer", "format": "uint32", "minimum": 0 } }, - "additionalProperties": true, "required": [ "planned", "ongoing", "paused", "cancelled", "done" - ] + ], + "additionalProperties": true }, - "StepCounts": { - "description": "`{done, total}` of a leaf's steps.", + "ChildRef": { + "description": "A child in a directory's detail.", "type": "object", "properties": { - "done": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "id": { + "type": "string" }, - "total": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "path": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/NodeKind" + }, + "title": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" } }, - "additionalProperties": true, "required": [ - "done", - "total" + "id", + "path", + "kind", + "title", + "status" + ], + "additionalProperties": true + }, + "NodeKind": { + "description": "`NodeKind` of a child reference.", + "type": "string", + "enum": [ + "leaf", + "directory" ] }, - "StepView": { - "description": "A stored step plus its derived number.", + "DirectoryDetail": { + "description": "Detail of a directory or the campaign root.", "type": "object", "properties": { - "checks": { + "id": { + "type": "string" + }, + "path": { + "type": "string" + }, + "parent": { + "type": "string" + }, + "rev": { + "type": "string" + }, + "title": { + "type": "string" + }, + "sealed": { + "type": "boolean" + }, + "comments": { "type": "array", "items": { - "$ref": "#/$defs/Check" + "$ref": "#/$defs/Comment" } }, - "commit": { - "$ref": "#/$defs/Commit" + "amendments": { + "type": "array", + "items": { + "type": "string" + } }, - "commit_sha": { + "added_by": { "type": [ "string", "null" ] }, - "deliverables": { + "is_campaign": { + "type": "boolean" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "counts": { + "$ref": "#/$defs/StatusCounts" + }, + "context": { "type": "array", "items": { "type": "string" } }, - "done": { - "type": "boolean" - }, - "done_at": { - "type": [ - "string", - "null" - ] - }, "goal": { "type": "string" }, - "id": { - "type": "string" - }, - "implementation_logic": { + "preconditions": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/Criterion" } }, - "number": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "success_gates": { + "type": "array", + "items": { + "$ref": "#/$defs/Criterion" + } }, "references": { "type": "array", @@ -813,32 +774,74 @@ "$ref": "#/$defs/Reference" } }, - "requires": { - "type": [ - "array", - "null" - ], + "gotchas": { + "type": "array", "items": { "type": "string" } }, - "title": { - "type": "string" + "notes": { + "type": "array", + "items": { + "type": "string" + } + }, + "children": { + "type": "array", + "items": { + "$ref": "#/$defs/ChildRef" + } } }, - "additionalProperties": true, "required": [ - "number", "id", + "path", + "parent", + "rev", "title", + "sealed", + "comments", + "amendments", + "is_campaign", + "status", + "counts", + "context", "goal", - "implementation_logic", - "deliverables", + "preconditions", + "success_gates", "references", - "checks", - "commit", - "done" - ] + "gotchas", + "notes", + "children" + ], + "additionalProperties": true + }, + "Holder": { + "description": "A leaf that holds another back.", + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "title": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "path", + "title", + "status" + ], + "additionalProperties": true } } } diff --git a/crates/rdm-schema/schemas/outline_view.schema.json b/crates/rdm-schema/schemas/outline_view.schema.json index f5b2d69..66e3a1b 100644 --- a/crates/rdm-schema/schemas/outline_view.schema.json +++ b/crates/rdm-schema/schemas/outline_view.schema.json @@ -4,24 +4,26 @@ "description": "The campaign outline with waves.", "type": "object", "properties": { - "campaign": { - "$ref": "#/$defs/CampaignRef" + "read_model_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "format_version": { - "type": "string" + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "projection": { "$ref": "#/$defs/Projection" }, - "read_model_version": { + "campaign": { + "$ref": "#/$defs/CampaignRef" + }, + "tree_rev": { "type": "string" }, "root": { "$ref": "#/$defs/OutlineNode" }, - "tree_rev": { - "type": "string" - }, "waves": { "type": "array", "items": { @@ -29,7 +31,6 @@ } } }, - "additionalProperties": true, "required": [ "read_model_version", "format_version", @@ -39,151 +40,38 @@ "root", "waves" ], + "additionalProperties": true, "$defs": { - "CampaignRef": { - "description": "Identity of the campaign in an envelope.", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "path": { - "type": "string" - }, - "title": { - "type": "string" - } - }, - "additionalProperties": true, - "required": [ - "id", - "path", - "title" - ] - }, - "LevelSource": { - "description": "The rule that produced a `level`. One value today.", + "Projection": { + "description": "Which projection a payload is.", "type": "string", "enum": [ - "depth" - ] - }, - "OutlineDirectory": { - "description": "A directory in the outline.", - "type": "object", - "properties": { - "amendment_count": { - "type": [ - "integer", - "null" - ], - "format": "uint32", - "minimum": 0 - }, - "children": { - "type": "array", - "items": { - "$ref": "#/$defs/OutlineNode" - } - }, - "counts": { - "$ref": "#/$defs/StatusCounts" - }, - "goal": { - "type": [ - "string", - "null" - ] - }, - "id": { - "type": "string" - }, - "is_campaign": { - "type": "boolean" - }, - "path": { - "type": "string" - }, - "rev": { - "type": "string" - }, - "status": { - "$ref": "#/$defs/Status" - }, - "title": { - "type": "string" - } - }, - "additionalProperties": true, - "required": [ - "id", - "path", - "title", - "is_campaign", - "status", - "counts", - "rev", - "children" + "outline", + "node", + "ready", + "amendments" ] }, - "OutlineLeaf": { - "description": "A leaf in the outline.", + "CampaignRef": { + "description": "Identity of the campaign in an envelope.", "type": "object", "properties": { - "added_by": { - "type": [ - "string", - "null" - ] - }, "id": { "type": "string" }, - "level": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "level_source": { - "$ref": "#/$defs/LevelSource" - }, "path": { "type": "string" }, - "ready": { - "type": "boolean" - }, - "rev": { - "type": "string" - }, - "status": { - "$ref": "#/$defs/Status" - }, - "status_reason": { - "type": [ - "string", - "null" - ] - }, - "steps": { - "$ref": "#/$defs/StepCounts" - }, "title": { "type": "string" } }, - "additionalProperties": true, "required": [ "id", "path", - "title", - "status", - "level", - "level_source", - "ready", - "steps", - "rev" - ] + "title" + ], + "additionalProperties": true }, "OutlineNode": { "description": "A node of the outline, discriminated by `kind`.", @@ -216,16 +104,6 @@ } ] }, - "Projection": { - "description": "Which projection a payload is.", - "type": "string", - "enum": [ - "outline", - "node", - "ready", - "amendments" - ] - }, "Status": { "description": "The five statuses of a leaf (`statuses.md`).", "type": "string", @@ -241,39 +119,104 @@ "description": "Leaves counted by status.", "type": "object", "properties": { - "cancelled": { + "planned": { "type": "integer", "format": "uint32", "minimum": 0 }, - "done": { + "ongoing": { "type": "integer", "format": "uint32", "minimum": 0 }, - "ongoing": { + "paused": { "type": "integer", "format": "uint32", "minimum": 0 }, - "paused": { + "cancelled": { "type": "integer", "format": "uint32", "minimum": 0 }, - "planned": { + "done": { "type": "integer", "format": "uint32", "minimum": 0 } }, - "additionalProperties": true, "required": [ "planned", "ongoing", "paused", "cancelled", "done" + ], + "additionalProperties": true + }, + "OutlineDirectory": { + "description": "A directory in the outline.", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + }, + "is_campaign": { + "type": "boolean" + }, + "goal": { + "type": [ + "string", + "null" + ] + }, + "status": { + "$ref": "#/$defs/Status" + }, + "counts": { + "$ref": "#/$defs/StatusCounts" + }, + "amendment_count": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "rev": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/$defs/OutlineNode" + } + } + }, + "required": [ + "id", + "path", + "title", + "is_campaign", + "status", + "counts", + "rev", + "children" + ], + "additionalProperties": true + }, + "LevelSource": { + "description": "The rule that produced a `level`. One value today.", + "type": "string", + "enum": [ + "depth" ] }, "StepCounts": { @@ -291,25 +234,75 @@ "minimum": 0 } }, - "additionalProperties": true, "required": [ "done", "total" - ] + ], + "additionalProperties": true }, - "WaveView": { - "description": "One wave of the outline.", + "OutlineLeaf": { + "description": "A leaf in the outline.", "type": "object", "properties": { - "counts": { - "$ref": "#/$defs/StatusCounts" + "id": { + "type": "string" }, - "leaf_ids": { - "type": "array", - "items": { - "type": "string" - } + "path": { + "type": "string" + }, + "title": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "level_source": { + "$ref": "#/$defs/LevelSource" + }, + "ready": { + "type": "boolean" }, + "steps": { + "$ref": "#/$defs/StepCounts" + }, + "added_by": { + "type": [ + "string", + "null" + ] + }, + "rev": { + "type": "string" + } + }, + "required": [ + "id", + "path", + "title", + "status", + "level", + "level_source", + "ready", + "steps", + "rev" + ], + "additionalProperties": true + }, + "WaveView": { + "description": "One wave of the outline.", + "type": "object", + "properties": { "level": { "type": "integer", "format": "uint32", @@ -317,15 +310,24 @@ }, "level_source": { "$ref": "#/$defs/LevelSource" + }, + "leaf_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "counts": { + "$ref": "#/$defs/StatusCounts" } }, - "additionalProperties": true, "required": [ "level", "level_source", "leaf_ids", "counts" - ] + ], + "additionalProperties": true } } } diff --git a/crates/rdm-schema/schemas/ready_view.schema.json b/crates/rdm-schema/schemas/ready_view.schema.json index b50f352..d881c9a 100644 --- a/crates/rdm-schema/schemas/ready_view.schema.json +++ b/crates/rdm-schema/schemas/ready_view.schema.json @@ -4,22 +4,21 @@ "description": "The ready set with what stalls the rest.", "type": "object", "properties": { - "campaign": { - "$ref": "#/$defs/CampaignRef" + "read_model_version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "format_version": { - "type": "string" - }, - "holders": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/Holder" - } + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" }, "projection": { "$ref": "#/$defs/Projection" }, - "read_model_version": { + "campaign": { + "$ref": "#/$defs/CampaignRef" + }, + "tree_rev": { "type": "string" }, "ready": { @@ -34,11 +33,13 @@ "$ref": "#/$defs/StalledLeaf" } }, - "tree_rev": { - "type": "string" + "holders": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Holder" + } } }, - "additionalProperties": true, "required": [ "read_model_version", "format_version", @@ -49,7 +50,18 @@ "stalled", "holders" ], + "additionalProperties": true, "$defs": { + "Projection": { + "description": "Which projection a payload is.", + "type": "string", + "enum": [ + "outline", + "node", + "ready", + "amendments" + ] + }, "CampaignRef": { "description": "Identity of the campaign in an envelope.", "type": "object", @@ -64,39 +76,43 @@ "type": "string" } }, - "additionalProperties": true, "required": [ "id", "path", "title" - ] + ], + "additionalProperties": true }, - "Holder": { - "description": "A leaf that holds another back.", + "ReadyLeaf": { + "description": "A `planned` leaf that nothing holds back.", "type": "object", "properties": { - "path": { + "id": { "type": "string" }, - "status": { - "$ref": "#/$defs/Status" - }, - "status_reason": { - "type": [ - "string", - "null" - ] + "path": { + "type": "string" }, "title": { "type": "string" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "level_source": { + "$ref": "#/$defs/LevelSource" } }, - "additionalProperties": true, "required": [ + "id", "path", "title", - "status" - ] + "level", + "level_source" + ], + "additionalProperties": true }, "LevelSource": { "description": "The rule that produced a `level`. One value today.", @@ -105,23 +121,19 @@ "depth" ] }, - "Projection": { - "description": "Which projection a payload is.", - "type": "string", - "enum": [ - "outline", - "node", - "ready", - "amendments" - ] - }, - "ReadyLeaf": { - "description": "A `planned` leaf that nothing holds back.", + "StalledLeaf": { + "description": "A `planned` leaf held back by unfinished leaves.", "type": "object", "properties": { "id": { "type": "string" }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + }, "level": { "type": "integer", "format": "uint32", @@ -130,59 +142,49 @@ "level_source": { "$ref": "#/$defs/LevelSource" }, - "path": { - "type": "string" - }, - "title": { - "type": "string" + "held_by": { + "type": "array", + "items": { + "type": "string" + } } }, - "additionalProperties": true, "required": [ "id", "path", "title", "level", - "level_source" - ] + "level_source", + "held_by" + ], + "additionalProperties": true }, - "StalledLeaf": { - "description": "A `planned` leaf held back by unfinished leaves.", + "Holder": { + "description": "A leaf that holds another back.", "type": "object", "properties": { - "held_by": { - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "level_source": { - "$ref": "#/$defs/LevelSource" - }, "path": { "type": "string" }, "title": { "type": "string" + }, + "status": { + "$ref": "#/$defs/Status" + }, + "status_reason": { + "type": [ + "string", + "null" + ] } }, - "additionalProperties": true, "required": [ - "id", "path", "title", - "level", - "level_source", - "held_by" - ] + "status" + ], + "additionalProperties": true }, "Status": { "description": "The five statuses of a leaf (`statuses.md`).", diff --git a/crates/rdm-schema/src/lib.rs b/crates/rdm-schema/src/lib.rs index 3f5967a..d9e1942 100644 --- a/crates/rdm-schema/src/lib.rs +++ b/crates/rdm-schema/src/lib.rs @@ -21,11 +21,18 @@ pub fn version_string(v: Version) -> String { format!("{}.{}", v.0, v.1) } -/// Parses `"MAJOR.MINOR"`. Returns `None` for any other form. +/// Parses `"MAJOR.MINOR"`. Strict: ASCII digits only, no sign, no whitespace, and no leading +/// zero except `0` itself. Returns `None` for any other form. #[must_use] pub fn parse_version(s: &str) -> Option { + fn part(p: &str) -> Option { + let ok = !p.is_empty() + && p.bytes().all(|b| b.is_ascii_digit()) + && (p == "0" || !p.starts_with('0')); + if ok { p.parse().ok() } else { None } + } let (major, minor) = s.split_once('.')?; - Some((major.parse().ok()?, minor.parse().ok()?)) + Some((part(major)?, part(minor)?)) } /// Whether a reader that supports `supported` may read data stamped `found`. diff --git a/crates/rdm-schema/src/read.rs b/crates/rdm-schema/src/read.rs index f162ac3..415108e 100644 --- a/crates/rdm-schema/src/read.rs +++ b/crates/rdm-schema/src/read.rs @@ -48,7 +48,9 @@ pub struct CampaignRef { /// keeps the unknown fields. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] pub struct Envelope { + #[schemars(regex(pattern = r"^[0-9]+\.[0-9]+$"))] pub read_model_version: String, + #[schemars(regex(pattern = r"^[0-9]+\.[0-9]+$"))] pub format_version: String, pub projection: Projection, pub campaign: CampaignRef, diff --git a/crates/rdm-schema/src/stored.rs b/crates/rdm-schema/src/stored.rs index 8766588..55c3e98 100644 --- a/crates/rdm-schema/src/stored.rs +++ b/crates/rdm-schema/src/stored.rs @@ -70,6 +70,7 @@ pub enum ChangeOp { /// `_dir.json`: the campaign root and every directory node. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] pub struct Directory { + #[schemars(regex(pattern = r"^[0-9]+\.[0-9]+$"))] pub schema_version: String, pub id: String, pub kind: DirectoryKind, @@ -88,6 +89,7 @@ pub struct Directory { /// `.json`. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] pub struct Leaf { + #[schemars(regex(pattern = r"^[0-9]+\.[0-9]+$"))] pub schema_version: String, pub id: String, pub kind: LeafKind, @@ -217,6 +219,7 @@ pub struct Actor { /// `_comments/.json`. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] pub struct Comment { + #[schemars(regex(pattern = r"^[0-9]+\.[0-9]+$"))] pub schema_version: String, pub id: String, pub node_id: String, @@ -232,6 +235,7 @@ pub struct Comment { /// `_amendments/.json`. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] pub struct Amendment { + #[schemars(regex(pattern = r"^[0-9]+\.[0-9]+$"))] pub schema_version: String, pub id: String, #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/crates/rdm-schema/tests/schemas.rs b/crates/rdm-schema/tests/schemas.rs index 7c12bdd..90bf460 100644 --- a/crates/rdm-schema/tests/schemas.rs +++ b/crates/rdm-schema/tests/schemas.rs @@ -9,6 +9,28 @@ fn generated() -> String { s } +const NAMES: [&str; 8] = [ + "directory", "leaf", "comment", "amendment", "outline_view", "node_view", "ready_view", "amendments_view", +]; + +/// A file in `schemas/` that no type generates is drift too. Bless removes it. +fn orphans(failures: &mut Vec) { + let dir = format!("{}/schemas", env!("CARGO_MANIFEST_DIR")); + let bless = std::env::var("RDM_SCHEMA_BLESS").as_deref() == Ok("1"); + for entry in std::fs::read_dir(&dir).expect("schemas dir").flatten() { + let file = entry.file_name().to_string_lossy().into_owned(); + let known = file.strip_suffix(".schema.json").is_some_and(|n| NAMES.contains(&n)); + if known { + continue; + } + if bless { + std::fs::remove_file(entry.path()).expect("remove orphan"); + } else { + failures.push(format!("{dir}/{file}: no type generates this file")); + } + } +} + /// Compares `want` with the committed file, or writes it when `RDM_SCHEMA_BLESS=1`. fn check_or_bless(name: &str, want: &str, failures: &mut Vec) { let path = format!("{}/schemas/{name}.schema.json", env!("CARGO_MANIFEST_DIR")); @@ -46,5 +68,23 @@ fn committed_schemas_match_the_types() { check_or_bless("node_view", &generated::(), &mut failures); check_or_bless("ready_view", &generated::(), &mut failures); check_or_bless("amendments_view", &generated::(), &mut failures); + orphans(&mut failures); assert!(failures.is_empty(), "schema drift:\n{}", failures.join("\n")); } + +#[test] +fn version_fields_carry_the_pattern() { + for (file, pointer) in [ + ("leaf", "/properties/schema_version"), + ("directory", "/properties/schema_version"), + ("comment", "/properties/schema_version"), + ("amendment", "/properties/schema_version"), + ("outline_view", "/properties/format_version"), + ("outline_view", "/properties/read_model_version"), + ] { + let path = format!("{}/schemas/{file}.schema.json", env!("CARGO_MANIFEST_DIR")); + let v: serde_json::Value = serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap(); + let pat = v.pointer(&format!("{pointer}/pattern")).and_then(|p| p.as_str()); + assert_eq!(pat, Some(r"^[0-9]+\.[0-9]+$"), "{file} {pointer}"); + } +} diff --git a/crates/rdm-schema/tests/stored.rs b/crates/rdm-schema/tests/stored.rs index d4b0d1c..2afbc9d 100644 --- a/crates/rdm-schema/tests/stored.rs +++ b/crates/rdm-schema/tests/stored.rs @@ -81,3 +81,20 @@ fn reader_refuses_per_the_read_model_rule() { assert!(is_readable((1, 3), (1, 1))); assert!(!is_readable((2, 0), (1, 1))); } + +#[test] +fn parse_version_is_strict() { + for bad in ["01.1", "+1.2", " 1.2", "1.2 ", "1.02", "-1.0", "1", "1.", ".1", "1.2.3", "banana", "", "1.x", "65536.0"] { + assert_eq!(parse_version(bad), None, "{bad:?}"); + } + assert_eq!(parse_version("0.0"), Some((0, 0))); + assert_eq!(parse_version("10.20"), Some((10, 20))); +} + +#[test] +fn unknown_keys_keep_their_order_in_the_output_string() { + // Non-alphabetical unknown keys at two nesting levels, and one known key after them. + let input = r#"{"schema_version":"0.1","id":"c","node_id":"n","ts":"2026-11-16T12:00:00Z","actor":{"kind":"human","zeta":1,"alpha":2},"text":["a"],"zz":{"y":1,"b":2,"m":3},"aa":true}"#; + let c: Comment = serde_json::from_str(input).unwrap(); + assert_eq!(serde_json::to_string(&c).unwrap(), input); +} From 9ade01ff17d9b4efc398de2b4a5fdf8859fbc0e2 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 16:04:10 +0900 Subject: [PATCH 034/183] chore(roadmap): close the m0b crate level Co-Authored-By: Claude Opus 5.5 --- __roadmap__/m0b-domain-model-spec/README.md | 4 ++-- __roadmap__/m0b-domain-model-spec/read/README.md | 4 ++-- __roadmap__/m0b-domain-model-spec/read/crate/README.md | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/__roadmap__/m0b-domain-model-spec/README.md b/__roadmap__/m0b-domain-model-spec/README.md index 2b8cf79..b1c7a2d 100644 --- a/__roadmap__/m0b-domain-model-spec/README.md +++ b/__roadmap__/m0b-domain-model-spec/README.md @@ -50,7 +50,7 @@ The status meanings, the stored schema with its traceability table, and the read graph TD status_semantics[Status semantics]:::done stored_schema[Stored schema]:::done - read[Read model]:::inprogress + read[Read model]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -63,7 +63,7 @@ graph TD |:-----|:-----|:-------| | `status_semantics.md` | 📄 Leaf Task | ✅ Done | | `stored_schema.md` | 📄 Leaf Task | ✅ Done | -| `read/` | 📁 Directory | 🔄 In Progress | +| `read/` | 📁 Directory | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m0b-domain-model-spec/read/README.md b/__roadmap__/m0b-domain-model-spec/read/README.md index 28a40b1..49647f1 100644 --- a/__roadmap__/m0b-domain-model-spec/read/README.md +++ b/__roadmap__/m0b-domain-model-spec/read/README.md @@ -19,7 +19,7 @@ The read model's projections are specified with worked examples, and the crate a ```mermaid graph TD read_model[Read model]:::done - crate[Schema crate and R01]:::inprogress + crate[Schema crate and R01]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -31,7 +31,7 @@ graph TD | Node | Type | Status | |:-----|:-----|:-------| | `read_model.md` | 📄 Leaf Task | ✅ Done | -| `crate/` | 📁 Directory | 🔄 In Progress | +| `crate/` | 📁 Directory | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m0b-domain-model-spec/read/crate/README.md b/__roadmap__/m0b-domain-model-spec/read/crate/README.md index 163d37c..dad3221 100644 --- a/__roadmap__/m0b-domain-model-spec/read/crate/README.md +++ b/__roadmap__/m0b-domain-model-spec/read/crate/README.md @@ -18,8 +18,8 @@ Depth 2 of M0b, its last level. The crate turns the three spec documents into ty ## Status ```mermaid graph TD - rdm_schema_crate[rdm-schema crate]:::inprogress - r01_sync[R01 sync]:::inprogress + rdm_schema_crate[rdm-schema crate]:::done + r01_sync[R01 sync]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -30,8 +30,8 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `rdm_schema_crate.md` | 📄 Leaf Task | 🔄 In Progress | -| `r01_sync.md` | 📄 Leaf Task | 🔄 In Progress | +| `rdm_schema_crate.md` | 📄 Leaf Task | ✅ Done | +| `r01_sync.md` | 📄 Leaf Task | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | From 151c39da2d695f60d785873923d734da6eb2a27c Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 17:10:55 +0900 Subject: [PATCH 035/183] feat(rdm-mcp): serve the roadmap over three data channels roadmap_view takes mode (result, chunks, stream) and scale (1 to 100). Chunks are rdm://chunk resources, the stream is a loopback SSE listener with a page CSP for its port, and rdm://leaf/{path} serves a leaf as markdown. Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-mcp/src/main.rs | 328 +++++++++++++++++++++++++++++++--- crates/rdm-mcp/tests/stdio.rs | 200 +++++++++++++++++++++ 2 files changed, 501 insertions(+), 27 deletions(-) diff --git a/crates/rdm-mcp/src/main.rs b/crates/rdm-mcp/src/main.rs index f871b5f..d874da1 100644 --- a/crates/rdm-mcp/src/main.rs +++ b/crates/rdm-mcp/src/main.rs @@ -15,7 +15,7 @@ use rmcp::{ }, model::{ CallToolResult, ContentBlock, Implementation, ExtensionCapabilities, ListResourcesResult, MetaObject, - PaginatedRequestParams, ProtocolVersion, Resource, ReadResourceRequestParams, + PaginatedRequestParams, ProtocolVersion, ListResourceTemplatesResult, ResourceTemplate, Resource, ReadResourceRequestParams, ReadResourceResponse, ReadResourceResult, ResourceContents, ServerCapabilities, ServerConfig, }, @@ -57,16 +57,68 @@ struct Fixture { nodes: Vec, } -/// Structured output of `roadmap_view`: the fixture plus two timing fields. +/// A node as served to the page: the fixture node plus a leaf's markdown. +#[derive(Debug, Clone, Serialize, schemars::JsonSchema)] +struct ViewNode { + #[serde(flatten)] + node: FixtureNode, + #[serde(skip_serializing_if = "Option::is_none")] + markdown: Option, +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize, schemars::JsonSchema)] +#[serde(rename_all = "lowercase")] +enum Mode { + Result, + Chunks, + Stream, +} + +impl Mode { + fn as_str(self) -> &'static str { + match self { + Self::Result => "result", + Self::Chunks => "chunks", + Self::Stream => "stream", + } + } +} + +/// Arguments of `roadmap_view`; all optional. +#[derive(Debug, Default, Deserialize, schemars::JsonSchema)] +struct RoadmapViewArgs { + /// How the nodes reach the page: `result` (default), `chunks` or `stream`. + #[serde(default)] + mode: Option, + /// Repeat the fixture this many times, 1 to 100 (default 1). + #[serde(default)] + scale: Option, +} + +/// Structured output of `roadmap_view`. Which optional fields are present +/// depends on `mode`. #[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)] struct RoadmapView { campaign: String, frozen_at: String, - nodes: Vec, + mode: String, + scale: u32, /// Milliseconds since the Unix epoch, taken just before the result is returned. t_server_ms: u64, - /// Byte length of the serialised fixture. + /// Total serialised bytes of the scaled node list, markdown included. payload_bytes: u64, + node_count: u64, + /// Present in `result` mode only. + #[serde(default, skip_serializing_if = "Option::is_none")] + nodes: Option>, + /// Present in `chunks` mode only. + #[serde(default, skip_serializing_if = "Option::is_none")] + chunk_count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + chunk_uri_template: Option, + /// Present in `stream` mode only. + #[serde(default, skip_serializing_if = "Option::is_none")] + stream_url: Option, } #[derive(Debug, Deserialize, schemars::JsonSchema)] @@ -138,6 +190,152 @@ fn internal(e: impl std::fmt::Display) -> ErrorData { ErrorData::internal_error(e.to_string(), None) } +/// Largest accepted `scale`. +const MAX_SCALE: u32 = 100; +/// Target size of one chunk, in serialised bytes. +const CHUNK_BYTES: usize = 64 * 1024; +/// Port of the localhost SSE listener, set once in `main`. +static STREAM_PORT: std::sync::OnceLock = std::sync::OnceLock::new(); + +/// Markdown of a leaf; a `copy/` prefix is stripped first. +fn leaf_markdown(path: &str) -> Option<&'static str> { + let base = match path.strip_prefix("copy") { + Some(rest) => match rest.split_once('/') { + Some((k, tail)) if !k.is_empty() && k.bytes().all(|b| b.is_ascii_digit()) => tail, + _ => path, + }, + None => path, + }; + LEAVES.iter().find(|(p, _)| *p == base).map(|(_, m)| *m) +} + +/// The fixture repeated `scale` times, breadth-first within each copy. Copy +/// k > 0 prefixes every path and parent with `copy/`; titles, statuses and +/// depths are unchanged and each leaf carries its markdown. +fn scaled_nodes(scale: u32) -> Result, ErrorData> { + let fixture: Fixture = serde_json::from_str(ROADMAP_JSON).map_err(internal)?; + let mut out = Vec::with_capacity(fixture.nodes.len() * scale as usize); + for k in 0..scale { + for node in &fixture.nodes { + let mut node = node.clone(); + let markdown = (node.kind == "leaf") + .then(|| leaf_markdown(&node.path).map(str::to_owned)) + .flatten(); + if k > 0 { + node.path = format!("copy{k}/{}", node.path); + node.parent = node.parent.map(|p| format!("copy{k}/{p}")); + } + out.push(ViewNode { node, markdown }); + } + } + Ok(out) +} + +/// Splits nodes into chunks of about `CHUNK_BYTES` serialised bytes. +fn chunk_nodes(nodes: &[ViewNode]) -> Vec<&[ViewNode]> { + let mut chunks = Vec::new(); + let (mut start, mut size) = (0, 0); + for (i, n) in nodes.iter().enumerate() { + size += serde_json::to_vec(n).map_or(0, |v| v.len() + 1); + if size >= CHUNK_BYTES { + chunks.push(&nodes[start..=i]); + start = i + 1; + size = 0; + } + } + if start < nodes.len() { + chunks.push(&nodes[start..]); + } + chunks +} + +fn query_scale(query: &str) -> Option { + let v = query.split('&').find_map(|kv| kv.strip_prefix("scale="))?; + v.parse().ok().filter(|s| (1..=MAX_SCALE).contains(s)) +} + +fn percent_decode(s: &str) -> String { + let b = s.as_bytes(); + let mut out = Vec::with_capacity(b.len()); + let mut i = 0; + while i < b.len() { + if b[i] == b'%' + && let Some(h) = s.get(i + 1..i + 3) + && let Ok(v) = u8::from_str_radix(h, 16) + { + out.push(v); + i += 3; + } else { + out.push(b[i]); + i += 1; + } + } + String::from_utf8_lossy(&out).into_owned() +} + +/// Spike-only SSE listener on loopback: one event per node, then `done`. +fn serve_stream(mut conn: std::net::TcpStream) -> std::io::Result<()> { + use std::io::{BufRead, BufReader}; + let mut request_line = String::new(); + { + let mut reader = BufReader::new(&conn); + reader.read_line(&mut request_line)?; + let mut line = String::new(); + while reader.read_line(&mut line)? > 2 { + line.clear(); + } + } + let mut parts = request_line.split_whitespace(); + let (method, target) = (parts.next().unwrap_or(""), parts.next().unwrap_or("")); + let (path, query) = target.split_once('?').unwrap_or((target, "")); + if method != "GET" || path != "/stream" { + return conn.write_all( + b"HTTP/1.1 404 Not Found\r\nContent-Length: 0\r\nConnection: close\r\n\r\n", + ); + } + let Some(scale) = query_scale(query) else { + return conn.write_all( + b"HTTP/1.1 400 Bad Request\r\nContent-Length: 0\r\nConnection: close\r\n\r\n", + ); + }; + conn.write_all( + b"HTTP/1.1 200 OK\r\nContent-Type: text/event-stream\r\n\ + Access-Control-Allow-Origin: *\r\nCache-Control: no-store\r\n\ + Connection: close\r\n\r\n", + )?; + conn.flush()?; + let nodes = scaled_nodes(scale).map_err(|e| std::io::Error::other(e.message.to_string()))?; + for n in &nodes { + let json = serde_json::to_string(n).map_err(std::io::Error::other)?; + write!(conn, "data: {json}\n\n")?; + conn.flush()?; + } + conn.write_all(b"event: done\ndata: {}\n\n")?; + conn.flush() +} + +/// Binds `127.0.0.1:0` and serves the stream on background threads. +fn start_stream_listener() -> std::io::Result { + let listener = std::net::TcpListener::bind("127.0.0.1:0")?; + let port = listener.local_addr()?.port(); + std::thread::spawn(move || { + for conn in listener.incoming().flatten() { + std::thread::spawn(move || { + let _ = serve_stream(conn); + }); + } + }); + Ok(port) +} + +/// Page-level CSP: lets the page connect to the stream listener. +fn ui_page_meta() -> MetaObject { + let origin = STREAM_PORT + .get() + .map_or_else(Vec::new, |p| vec![format!("http://127.0.0.1:{p}")]); + meta_from(json!({ "ui": { "csp": { "connectDomains": origin } } })) +} + /// The spike server. It keeps no state between calls. #[derive(Clone)] struct RdmSpike { @@ -157,22 +355,66 @@ impl RdmSpike { output_schema = schema_for_output::(), meta = ui_resource_meta() )] - async fn roadmap_view(&self) -> Result { + async fn roadmap_view( + &self, + Parameters(args): Parameters, + ) -> Result { + let mode = args.mode.unwrap_or(Mode::Result); + let scale = args.scale.unwrap_or(1); + if !(1..=MAX_SCALE).contains(&scale) { + return Err(ErrorData::invalid_params( + format!("scale must be an integer from 1 to {MAX_SCALE}"), + None, + )); + } + if matches!(mode, Mode::Result) && scale > 1 { + return Err(ErrorData::invalid_params( + "mode \"result\" cannot take scale > 1: the result enters the model context; \ + use mode \"chunks\" or \"stream\"" + .to_owned(), + None, + )); + } let fixture: Fixture = serde_json::from_str(ROADMAP_JSON).map_err(internal)?; - let payload_bytes = serde_json::to_vec(&fixture).map_err(internal)?.len(); - let summary = format!( - "Roadmap {} at {}: {} nodes.", - fixture.campaign, - fixture.frozen_at, - fixture.nodes.len() - ); - let view = RoadmapView { + let nodes = scaled_nodes(scale)?; + let payload_bytes = serde_json::to_vec(&nodes).map_err(internal)?.len(); + let mut view = RoadmapView { campaign: fixture.campaign, frozen_at: fixture.frozen_at, - nodes: fixture.nodes, + mode: mode.as_str().to_owned(), + scale, + t_server_ms: 0, payload_bytes: u64::try_from(payload_bytes).map_err(internal)?, - t_server_ms: now_ms(), + node_count: u64::try_from(nodes.len()).map_err(internal)?, + nodes: None, + chunk_count: None, + chunk_uri_template: None, + stream_url: None, }; + match mode { + Mode::Result => { + view.nodes = Some( + nodes + .iter() + .map(serde_json::to_value) + .collect::>() + .map_err(internal)?, + ); + } + Mode::Chunks => { + view.chunk_count = Some(u64::try_from(chunk_nodes(&nodes).len()).map_err(internal)?); + view.chunk_uri_template = Some(format!("rdm://chunk/{{n}}?scale={scale}")); + } + Mode::Stream => { + let port = STREAM_PORT.get().ok_or_else(|| internal("stream listener is not bound"))?; + view.stream_url = Some(format!("http://127.0.0.1:{port}/stream?scale={scale}")); + } + } + let summary = format!( + "Roadmap {} at {}: {} nodes, mode {}, scale {}.", + view.campaign, view.frozen_at, view.node_count, view.mode, scale + ); + view.t_server_ms = now_ms(); let mut result = CallToolResult::structured(serde_json::to_value(&view).map_err(internal)?); result.content = vec![ContentBlock::text(summary)]; @@ -187,13 +429,11 @@ impl RdmSpike { &self, Parameters(args): Parameters, ) -> Result, ErrorData> { - let (_, markdown) = LEAVES - .iter() - .find(|(p, _)| *p == args.path) + let markdown = leaf_markdown(&args.path) .ok_or_else(|| ErrorData::invalid_params(format!("unknown leaf: {}", args.path), None))?; Ok(Json(LeafGetResult { path: args.path, - markdown: (*markdown).to_owned(), + markdown: markdown.to_owned(), })) } @@ -275,22 +515,55 @@ impl ServerHandler for RdmSpike { ) -> Result { let page = Resource::new(UI_URI, "rdm graph") .with_description("Interactive roadmap graph") - .with_mime_type(APPS_MIME); + .with_mime_type(APPS_MIME) + .with_meta(ui_page_meta()); Ok(ListResourcesResult::with_all_items(vec![page])) } + async fn list_resource_templates( + &self, + _request: Option, + _context: RequestContext, + ) -> Result { + Ok(ListResourceTemplatesResult::with_all_items(vec![ + ResourceTemplate::new("rdm://leaf/{path}", "leaf") + .with_description("Markdown of one frozen leaf") + .with_mime_type("text/markdown"), + ResourceTemplate::new("rdm://chunk/{n}?scale={scale}", "chunk") + .with_description("One chunk of the scaled node list") + .with_mime_type("application/json"), + ])) + } + async fn read_resource( &self, request: ReadResourceRequestParams, _context: RequestContext, ) -> Result { - if request.uri != UI_URI { - return Err(ErrorData::invalid_params( - format!("unknown resource: {}", request.uri), - None, - )); - } - let contents = ResourceContents::text(VIEW_HTML, UI_URI).with_mime_type(APPS_MIME); + let uri = request.uri.as_str(); + let bad = |m: String| ErrorData::invalid_params(m, None); + let contents = if uri == UI_URI { + ResourceContents::text(VIEW_HTML, UI_URI) + .with_mime_type(APPS_MIME) + .with_meta(ui_page_meta()) + } else if let Some(path) = uri.strip_prefix("rdm://leaf/") { + let path = percent_decode(path); + let md = leaf_markdown(&path).ok_or_else(|| bad(format!("unknown leaf: {path}")))?; + ResourceContents::text(md, uri).with_mime_type("text/markdown") + } else if let Some(rest) = uri.strip_prefix("rdm://chunk/") { + let (n, query) = rest.split_once('?').unwrap_or((rest, "")); + let n: usize = n.parse().map_err(|_| bad(format!("bad chunk index: {n}")))?; + let scale = query_scale(query).ok_or_else(|| bad("scale must be 1 to 100".to_owned()))?; + let nodes = scaled_nodes(scale)?; + let chunks = chunk_nodes(&nodes); + let chunk = chunks + .get(n) + .ok_or_else(|| bad(format!("chunk {n} out of range (0..{})", chunks.len())))?; + let body = serde_json::to_string(&json!({ "n": n, "nodes": chunk })).map_err(internal)?; + ResourceContents::text(body, uri).with_mime_type("application/json") + } else { + return Err(bad(format!("unknown resource: {uri}"))); + }; Ok(ReadResourceResult::new(vec![contents]).into()) } } @@ -301,6 +574,7 @@ static SERVER_STARTED_MS: std::sync::OnceLock = std::sync::OnceLock::new(); #[tokio::main] async fn main() -> Result<(), Box> { let _ = SERVER_STARTED_MS.set(now_ms()); + let _ = STREAM_PORT.set(start_stream_listener()?); let service = RdmSpike::new().serve(stdio()).await?; service.waiting().await?; Ok(()) diff --git a/crates/rdm-mcp/tests/stdio.rs b/crates/rdm-mcp/tests/stdio.rs index d353af3..4957482 100644 --- a/crates/rdm-mcp/tests/stdio.rs +++ b/crates/rdm-mcp/tests/stdio.rs @@ -223,3 +223,203 @@ async fn probe_record_appends_one_line() { assert!(line["t_recorded_ms"].as_u64().expect("t_recorded_ms") > 0); let _ = std::fs::remove_dir_all(&dir); } + +// ---- data channels ---- + +async fn view(client: &RunningService, mode: &str, scale: u32) -> Value { + let args = json!({ "mode": mode, "scale": scale }); + let result = client + .call_tool( + CallToolRequestParams::new("roadmap_view") + .with_arguments(args.as_object().expect("object").clone()), + ) + .await + .expect("call roadmap_view"); + result.structured_content.expect("structuredContent") +} + +fn keys(v: &Value) -> Vec<&str> { + let mut k: Vec<&str> = v.as_object().expect("object").keys().map(String::as_str).collect(); + k.sort_unstable(); + k +} + +const COMMON: [&str; 7] = [ + "campaign", "frozen_at", "mode", "node_count", "payload_bytes", "scale", "t_server_ms", +]; + +#[tokio::test] +async fn each_mode_returns_documented_keys() { + let client = connect(None).await; + let result = view(&client, "result", 1).await; + for k in ["nodes", "mode", "scale", "t_server_ms", "payload_bytes", "node_count"] { + assert!(result.get(k).is_some(), "result lacks {k}"); + } + assert!(result.get("stream_url").is_none() && result.get("chunk_count").is_none()); + let dir = result["nodes"].as_array().expect("nodes").iter().find(|n| n["kind"] == "dir").expect("a dir"); + assert!(dir.get("markdown").is_none(), "dir has no markdown"); + let leaf = result["nodes"] + .as_array() + .expect("nodes") + .iter() + .find(|n| n["kind"] == "leaf") + .expect("a leaf"); + assert!(leaf["markdown"].as_str().expect("markdown").starts_with('#')); + + let chunks = view(&client, "chunks", 2).await; + assert!(chunks.get("nodes").is_none()); + assert!(chunks["chunk_count"].as_u64().expect("chunk_count") >= 1); + assert_eq!(chunks["chunk_uri_template"], "rdm://chunk/{n}?scale=2"); + + let stream = view(&client, "stream", 3).await; + assert!(stream.get("nodes").is_none()); + let url = stream["stream_url"].as_str().expect("stream_url"); + assert!(url.starts_with("http://127.0.0.1:") && url.ends_with("/stream?scale=3"), "{url}"); + for v in [&chunks, &stream] { + for k in COMMON { + assert!(v.get(k).is_some(), "missing {k}: {:?}", keys(v)); + } + } + client.cancel().await.expect("close"); +} + +#[tokio::test] +async fn result_mode_refuses_scale() { + let client = connect(None).await; + let args = json!({ "mode": "result", "scale": 10 }); + let err = client + .call_tool( + CallToolRequestParams::new("roadmap_view") + .with_arguments(args.as_object().expect("object").clone()), + ) + .await + .expect_err("scale 10 in result mode is refused"); + let text = err.to_string(); + assert!(text.contains("model context"), "{text}"); + client.cancel().await.expect("close"); +} + +#[tokio::test] +async fn chunks_reassemble_to_scaled_nodes() { + let client = connect(None).await; + let v = view(&client, "chunks", 20).await; + let count = v["chunk_count"].as_u64().expect("chunk_count"); + assert!(count > 1, "scale 20 spans several chunks"); + let mut nodes = Vec::new(); + for n in 0..count { + let r = client + .read_resource(ReadResourceRequestParams::new(format!("rdm://chunk/{n}?scale=20"))) + .await + .expect("read chunk"); + let c = serde_json::to_value(&r.contents[0]).expect("serialises"); + assert_eq!(c["mimeType"], "application/json"); + let body: Value = serde_json::from_str(c["text"].as_str().expect("text")).expect("json"); + assert_eq!(body["n"], n); + nodes.extend(body["nodes"].as_array().expect("nodes").clone()); + } + assert_eq!(nodes.len() as u64, v["node_count"].as_u64().expect("node_count")); + assert_eq!(nodes.len(), 16 * 20); + assert_eq!(nodes[0]["path"], "m0_feasibility_spike.md"); + assert_eq!(nodes[16]["path"], "copy1/m0_feasibility_spike.md"); + assert_eq!(nodes[16]["title"], nodes[0]["title"]); + assert_eq!( + serde_json::to_vec(&nodes).expect("ser").len() as u64, + v["payload_bytes"].as_u64().expect("payload_bytes") + ); + client.cancel().await.expect("close"); +} + +#[tokio::test] +async fn sse_streams_node_count_events_then_done() { + use std::io::Read; + let client = connect(None).await; + let v = view(&client, "stream", 5).await; + let url = v["stream_url"].as_str().expect("stream_url"); + let addr = url + .strip_prefix("http://") + .and_then(|r| r.split_once('/')) + .expect("url") + .0; + let mut tcp = std::net::TcpStream::connect(addr).expect("connect"); + write!(tcp, "GET /stream?scale=5 HTTP/1.1\r\nHost: {addr}\r\n\r\n").expect("send"); + let mut raw = String::new(); + tcp.read_to_string(&mut raw).expect("read to close"); + let (head, body) = raw.split_once("\r\n\r\n").expect("headers"); + let head = head.to_ascii_lowercase(); + assert!(head.contains("text/event-stream"), "{head}"); + assert!(head.contains("access-control-allow-origin: *"), "{head}"); + assert!(head.contains("cache-control: no-store"), "{head}"); + let events: Vec<&str> = body.split("\n\n").filter(|e| !e.is_empty()).collect(); + let n = v["node_count"].as_u64().expect("node_count") as usize; + assert_eq!(n, 80); + assert_eq!(events.len(), n + 1); + assert!(events[..n].iter().all(|e| e.starts_with("data: {"))); + assert!(events[n].starts_with("event: done")); + + let mut other = std::net::TcpStream::connect(addr).expect("connect"); + write!(other, "GET /nope HTTP/1.1\r\n\r\n").expect("send"); + let mut raw = String::new(); + other.read_to_string(&mut raw).expect("read"); + assert!(raw.starts_with("HTTP/1.1 404"), "{raw}"); + client.cancel().await.expect("close"); +} + +#[tokio::test] +async fn csp_domain_carries_the_bound_port() { + let client = connect(None).await; + let v = view(&client, "stream", 1).await; + let port = v["stream_url"] + .as_str() + .expect("stream_url") + .split(':') + .nth(2) + .and_then(|r| r.split('/').next()) + .expect("port") + .to_owned(); + let want = json!([format!("http://127.0.0.1:{port}")]); + + let listed = client.list_all_resources().await.expect("resources/list"); + let page = serde_json::to_value(&listed[0]).expect("ser"); + assert_eq!(page["_meta"]["ui"]["csp"]["connectDomains"], want); + + let read = client + .read_resource(ReadResourceRequestParams::new("ui://rdm/graph")) + .await + .expect("read"); + let c = serde_json::to_value(&read.contents[0]).expect("ser"); + assert_eq!(c["_meta"]["ui"]["csp"]["connectDomains"], want); + client.cancel().await.expect("close"); +} + +#[tokio::test] +async fn leaf_template_serves_markdown_and_refuses_unknown() { + let client = connect(None).await; + let templates = client.list_all_resource_templates().await.expect("templates"); + let t = serde_json::to_value(&templates).expect("ser"); + assert!(t.to_string().contains("rdm://leaf/{path}"), "{t}"); + let r = client + .read_resource(ReadResourceRequestParams::new("rdm://leaf/core/m1_core_foundation.md")) + .await + .expect("read leaf"); + let c = serde_json::to_value(&r.contents[0]).expect("ser"); + assert_eq!(c["mimeType"], "text/markdown"); + assert!(c["text"].as_str().expect("text").starts_with('#')); + client + .read_resource(ReadResourceRequestParams::new("rdm://leaf/nope.md")) + .await + .expect_err("unknown leaf refused"); + client.cancel().await.expect("close"); +} + +#[tokio::test] +async fn payload_sizes_by_scale() { + let client = connect(None).await; + let mut sizes = Vec::new(); + for s in [1, 10, 100] { + let v = view(&client, "chunks", s).await; + sizes.push((s, v["payload_bytes"].as_u64().expect("b"), v["chunk_count"].as_u64().expect("c"))); + } + eprintln!("SIZES (scale, payload_bytes, chunk_count): {sizes:?}"); + assert!(sizes[0].1 < sizes[1].1 && sizes[1].1 < sizes[2].1); + client.cancel().await.expect("close"); +} From bdd6b4f56af22e9d8d0c2eb16f8aab95d6f95ef5 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 17:11:01 +0900 Subject: [PATCH 036/183] feat(rdm-mcp): paint the view progressively and probe over ui/message Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-mcp/view/dev/mock-host.html | 88 ++++++++++----- crates/rdm-mcp/view/dev/mock-server.py | 46 ++++++++ crates/rdm-mcp/view/dist/index.html | 30 ++--- crates/rdm-mcp/view/src/App.svelte | 125 +++++++++++++-------- crates/rdm-mcp/view/src/Diagnostics.svelte | 30 ++--- crates/rdm-mcp/view/src/LeafPane.svelte | 19 +++- crates/rdm-mcp/view/src/bridge.ts | 27 +++++ crates/rdm-mcp/view/src/ingest.ts | 100 +++++++++++++++++ crates/rdm-mcp/view/src/probe.ts | 53 ++++----- crates/rdm-mcp/view/src/types.ts | 25 ++++- 10 files changed, 396 insertions(+), 147 deletions(-) create mode 100644 crates/rdm-mcp/view/dev/mock-server.py create mode 100644 crates/rdm-mcp/view/src/ingest.ts diff --git a/crates/rdm-mcp/view/dev/mock-host.html b/crates/rdm-mcp/view/dev/mock-host.html index abbbfbe..a37da94 100644 --- a/crates/rdm-mcp/view/dev/mock-host.html +++ b/crates/rdm-mcp/view/dev/mock-host.html @@ -1,7 +1,7 @@ - + @@ -33,38 +33,61 @@

message log

theme: q.get('theme') || 'light', displayMode: 'inline', availableDisplayModes: modes, containerDimensions: { width: 900, maxHeight: 600 }, platform: 'web', locale: 'en-US', }; +// Desktop-like capabilities: NO serverTools unless ?serverTools=1. +const hostCapabilities = { openLinks: {}, serverResources: {}, message: { text: {} }, + ...(q.get('serverTools') === '1' ? { serverTools: {} } : {}), + ...(q.get('mc') === '0' ? {} : { updateModelContext: { text: {} } }) }; +if (q.get('msg') === '0') delete hostCapabilities.message; + +const mode = q.get('mode') || 'result'; // result | chunks | stream +const scale = Math.max(1, Math.min(100, +(q.get('scale') || 1))); +const CHUNK = 20; +window.messages = []; window.modelContexts = []; +let base = null; +async function allNodes() { + base ??= (await (await fetch('sample-roadmap.json')).json()).nodes; + if (scale === 1) return base; + const out = []; + for (let i = 0; i < scale; i++) for (const n of base) + out.push({ ...n, path: `s${i}/${n.path}`, parent: n.parent ? `s${i}/${n.parent}` : `s${i}` }); + return out; +} async function toolResult() { - const fixture = await (await fetch('sample-roadmap.json')).json(); - const payload_bytes = JSON.stringify(fixture).length; - const sc = { ...fixture, t_server_ms: Date.now(), payload_bytes }; - post({ jsonrpc: '2.0', method: 'ui/notifications/tool-input', params: { arguments: {} } }); + const nodes = await allNodes(); + const sc = { mode, scale, t_server_ms: Date.now(), payload_bytes: JSON.stringify(nodes).length, node_count: nodes.length }; + if (mode === 'result') { + sc.nodes = nodes.map((n) => n.kind === 'leaf' && scale === 1 ? { ...n, markdown: '# ' + n.title + '\n(inline markdown)' } : n); + } else if (mode === 'chunks') { + sc.chunk_count = Math.ceil(nodes.length / CHUNK); + sc.chunk_uri_template = 'rdm://chunk/{n}?scale=S'; + } else { + sc.stream_url = location.origin + '/stream?scale=' + scale; + } + post({ jsonrpc: '2.0', method: 'ui/notifications/tool-input', params: { arguments: { mode, scale } } }); post({ jsonrpc: '2.0', method: 'ui/notifications/tool-result', params: { - content: [{ type: 'text', text: `${fixture.nodes.length} nodes` }], structuredContent: sc } }); + content: [{ type: 'text', text: `${nodes.length} nodes (${mode})` }], structuredContent: sc } }); } -const fail = q.get('fail'); -async function callTool(id, p) { - if (fail === 'all' || (fail === 'app' && p.name !== 'roadmap_view')) { - return post({ jsonrpc: '2.0', id, error: { code: -32603, message: 'IPC not available for MCP tool call' } }); - } - if (p.name === 'roadmap_view') { - const fixture = await (await fetch('sample-roadmap.json')).json(); - const sc = { ...fixture, t_server_ms: Date.now(), payload_bytes: JSON.stringify(fixture).length }; - return reply(id, { content: [{ type: 'text', text: 'roadmap' }], structuredContent: sc }); +async function readResource(id, uri) { + let m; + if ((m = uri.match(/^rdm:\/\/chunk\/(\d+)\?scale=(\d+)$/))) { + const nodes = await allNodes(); + const n = +m[1]; + const text = JSON.stringify({ n, nodes: nodes.slice(n * CHUNK, (n + 1) * CHUNK) }); + return reply(id, { contents: [{ uri, mimeType: 'application/json', text }] }); } - if (p.name === 'leaf_get') { - const r = await fetch('sample-leaves/' + p.arguments.path); - const markdown = r.ok ? await r.text() : '(no sample leaf for ' + p.arguments.path + ')'; - const sc = { path: p.arguments.path, markdown }; - return reply(id, { content: [{ type: 'text', text: markdown }], structuredContent: sc }); + if ((m = uri.match(/^rdm:\/\/leaf\/(.+)$/))) { + const r = await fetch('sample-leaves/' + m[1]); + const text = r.ok ? await r.text() : '(no sample leaf for ' + m[1] + ')'; + return reply(id, { contents: [{ uri, mimeType: 'text/markdown', text }] }); } - if (p.name === 'probe_record') { - window.probes.push(p.arguments); - stateEl.textContent = window.probes.length + ' probe_record call(s)'; - return reply(id, { content: [{ type: 'text', text: 'recorded' }], structuredContent: { ok: true } }); - } - post({ jsonrpc: '2.0', id, error: { code: -32601, message: 'unknown tool ' + p.name } }); + post({ jsonrpc: '2.0', id, error: { code: -32002, message: 'resource not found: ' + uri } }); +} + +function callTool(id, p) { + // Like Desktop: without serverTools, tools/call is refused. + post({ jsonrpc: '2.0', id, error: { code: -32603, message: hostCapabilities.serverTools ? 'unknown tool ' + p.name : 'IPC not available for MCP tool call' } }); } window.addEventListener('message', (e) => { @@ -73,14 +96,19 @@

message log

log('view->host', m); if (m.method === 'ui/initialize') { reply(m.id, { protocolVersion: '2026-01-26', hostInfo: { name: 'mock-host', version: '0.0.0' }, - hostCapabilities: { serverTools: {}, openLinks: {}, ...(q.get('mc') === '0' ? {} : { updateModelContext: { text: {} } }) }, hostContext }); + hostCapabilities, hostContext }); } else if (m.method === 'ui/notifications/initialized') { toolResult(); } else if (m.method === 'tools/call') { callTool(m.id, m.params); } else if (m.method === 'ui/update-model-context') { - window.modelContexts = (window.modelContexts || []).concat([m.params]); + window.modelContexts.push(m.params); + reply(m.id, {}); + } else if (m.method === 'ui/message') { + window.messages.push(m.params); reply(m.id, {}); + } else if (m.method === 'resources/read') { + readResource(m.id, m.params.uri); } else if (m.method === 'ui/request-display-mode') { const mode = modes.includes(m.params.mode) ? m.params.mode : hostContext.displayMode; frame.classList.toggle('fs', mode === 'fullscreen'); diff --git a/crates/rdm-mcp/view/dev/mock-server.py b/crates/rdm-mcp/view/dev/mock-server.py new file mode 100644 index 0000000..d23bdd6 --- /dev/null +++ b/crates/rdm-mcp/view/dev/mock-server.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""Dev only. Static files for the mock host plus an SSE endpoint /stream?scale=S. +Run from crates/rdm-mcp/view: python3 dev/mock-server.py 8765""" +import json, sys, time +from functools import partial +from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer +from urllib.parse import urlparse, parse_qs + +BASE = json.load(open("dev/sample-roadmap.json"))["nodes"] + + +def scaled(scale): + for i in range(scale): + for n in BASE: + if scale == 1: + yield n + else: + yield {**n, "path": f"s{i}/{n['path']}", "parent": f"s{i}/{n['parent']}" if n["parent"] else f"s{i}"} + + +class H(SimpleHTTPRequestHandler): + def do_GET(self): + u = urlparse(self.path) + if u.path != "/stream": + return super().do_GET() + scale = int(parse_qs(u.query).get("scale", ["1"])[0]) + self.send_response(200) + self.send_header("Content-Type", "text/event-stream") + self.send_header("Cache-Control", "no-cache") + self.end_headers() + try: + for n in scaled(scale): + self.wfile.write(f"data: {json.dumps(n)}\n\n".encode()) + self.wfile.flush() + time.sleep(0.005) + self.wfile.write(b"event: done\ndata: {}\n\n") + self.wfile.flush() + except (BrokenPipeError, ConnectionResetError): + pass + + def log_message(self, *a): + pass + + +if __name__ == "__main__": + ThreadingHTTPServer(("127.0.0.1", int(sys.argv[1])), H).serve_forever() diff --git a/crates/rdm-mcp/view/dist/index.html b/crates/rdm-mcp/view/dist/index.html index bfe58bf..5540b90 100644 --- a/crates/rdm-mcp/view/dist/index.html +++ b/crates/rdm-mcp/view/dist/index.html @@ -4,10 +4,10 @@ rdm graph view - - diff --git a/crates/rdm-mcp/view/src/App.svelte b/crates/rdm-mcp/view/src/App.svelte index a4ba776..6172597 100644 --- a/crates/rdm-mcp/view/src/App.svelte +++ b/crates/rdm-mcp/view/src/App.svelte @@ -1,50 +1,77 @@
- {view?.campaign ?? 'roadmap'} - {#if view}{view.nodes.length} nodes{/if} + roadmap {view ? `(${view.mode} x${view.scale})` : ''} + {#if view}{nodes.length}/{view.node_count} nodes{/if} {#if ran}ran: {ran}{/if} {#if outline}{/if} @@ -116,15 +143,15 @@ {#if !view}

{host ? 'waiting for the tool result...' : 'connecting...'}

{:else if outline} - - {#if selected}{/if} + + {#if selected}{/if} {:else}
- - + +
{/if} - +
diff --git a/crates/rdm-mcp/view/src/bridge.ts b/crates/rdm-mcp/view/src/bridge.ts index 7b11079..45e5fa0 100644 --- a/crates/rdm-mcp/view/src/bridge.ts +++ b/crates/rdm-mcp/view/src/bridge.ts @@ -84,3 +84,30 @@ export async function requestDisplayMode(mode: 'inline' | 'fullscreen' | 'pip'): const r = await app.requestDisplayMode({ mode }); return r.mode; } + +/** resources/read through the host: app.readServerResource({uri}). Returns the first content's text. */ +export async function readResourceText(uri: string): Promise { + try { + const r = await app.readServerResource({ uri }); + const c = r.contents?.[0] as { text?: string } | undefined; + if (typeof c?.text !== 'string') throw new Error('resource has no text content: ' + uri); + return c.text; + } catch (e) { + toolErrorListener?.('resources/read ' + uri, String(e)); + throw e; + } +} + +/** ui/message: one user chat message, only if the host advertises the message capability. */ +export async function sendChatMessage(text: string): Promise { + const caps = app.getHostCapabilities() as { message?: unknown } | undefined; + if (!caps?.message) return 'skipped: host does not advertise message'; + try { + await app.sendMessage({ role: 'user', content: [{ type: 'text', text }] }); + return 'ok'; + } catch (e) { + const t = String(e); + toolErrorListener?.('ui/message', t); + return 'failed: ' + t; + } +} diff --git a/crates/rdm-mcp/view/src/ingest.ts b/crates/rdm-mcp/view/src/ingest.ts new file mode 100644 index 0000000..8fa518c --- /dev/null +++ b/crates/rdm-mcp/view/src/ingest.ts @@ -0,0 +1,100 @@ +import { tick } from 'svelte'; +import { readResourceText } from './bridge'; +import type { RoadmapNode, RoadmapView, Stamps } from './types'; + +const nextFrame = () => new Promise((r) => requestAnimationFrame(() => r())); +const utf8 = (s: string) => new TextEncoder().encode(s).length; + +/** Appends nodes and paints in batches: one DOM update per animation frame. */ +class Painter { + all: RoadmapNode[] = []; + pending: RoadmapNode[] = []; + scheduled = false; + firstPainted = false; + constructor( + private setNodes: (n: RoadmapNode[]) => void, + private stamps: Stamps, + ) {} + push(batch: RoadmapNode[]) { + if (!batch.length) return; + if (!this.stamps.t_first_data_ms) this.stamps.t_first_data_ms = Date.now(); + this.pending.push(...batch); + this.stamps.nodes_received += batch.length; + if (!this.scheduled) { + this.scheduled = true; + requestAnimationFrame(() => { + this.scheduled = false; + this.all = this.all.concat(this.pending); + this.pending = []; + this.setNodes(this.all); + if (!this.firstPainted) { + this.firstPainted = true; + // The rAF after Svelte has rendered the first nodes. + void tick().then(() => requestAnimationFrame(() => (this.stamps.t_first_paint_ms = Date.now()))); + } + }); + } + } + /** Resolves after the rAF that follows the render of the last node. */ + async finish() { + while (this.pending.length || this.scheduled) await nextFrame(); + await tick(); + await nextFrame(); + this.stamps.t_complete_ms = Date.now(); + } +} + +/** + * Ingest by mode. Stamps are written into `stamps` as they happen. + * Throws with the verbatim error text on a read or network failure. + */ +export async function ingest( + sc: RoadmapView, + stamps: Stamps, + setNodes: (n: RoadmapNode[]) => void, +): Promise { + const painter = new Painter(setNodes, stamps); + if (sc.mode === 'result') { + stamps.bytes_received = utf8(JSON.stringify(sc.nodes ?? [])); + painter.push(sc.nodes ?? []); + } else if (sc.mode === 'chunks') { + const tpl = sc.chunk_uri_template ?? ''; + // Chunks are numbered from 0 (the contract does not say; see report). + for (let n = 0; n < (sc.chunk_count ?? 0); n++) { + const uri = tpl.replace('{n}', String(n)).replace(/scale=S\b/, `scale=${sc.scale}`); + const text = await readResourceText(uri); + stamps.bytes_received += utf8(text); + painter.push((JSON.parse(text) as { nodes: RoadmapNode[] }).nodes); + } + } else if (sc.mode === 'stream') { + await new Promise((resolve, reject) => { + let violation = ''; + const onViolation = (e: SecurityPolicyViolationEvent) => { + violation = `CSP violation: ${e.violatedDirective} blocked ${e.blockedURI}`; + }; + document.addEventListener('securitypolicyviolation', onViolation); + const es = new EventSource(sc.stream_url ?? ''); + let done = false; + es.onmessage = (e) => { + stamps.bytes_received += utf8(e.data); + painter.push([JSON.parse(e.data) as RoadmapNode]); + }; + es.addEventListener('done', () => { + done = true; + es.close(); + document.removeEventListener('securitypolicyviolation', onViolation); + resolve(); + }); + es.onerror = () => { + if (done) return; + es.close(); + document.removeEventListener('securitypolicyviolation', onViolation); + // Verbatim: EventSource exposes no text, so give everything the page knows. + reject(new Error(`EventSource error on ${sc.stream_url} (readyState ${es.readyState})${violation ? '; ' + violation : ''}`)); + }; + }); + } else { + throw new Error('unknown mode: ' + String((sc as { mode?: unknown }).mode)); + } + await painter.finish(); +} diff --git a/crates/rdm-mcp/view/src/probe.ts b/crates/rdm-mcp/view/src/probe.ts index eb1a10e..4358de0 100644 --- a/crates/rdm-mcp/view/src/probe.ts +++ b/crates/rdm-mcp/view/src/probe.ts @@ -1,54 +1,41 @@ -import { callAppTool } from './bridge'; import type { HostInfo } from './bridge'; -import type { RoadmapView } from './types'; +import type { RoadmapView, Stamps } from './types'; -export type DisplayModeRan = 'fullscreen' | 'outline' | 'inline'; - -function runKind(): 'cold' | 'warm' | 'unknown' { +export function runKind(): 'cold' | 'warm' | 'unknown' { const v = new URLSearchParams(window.location.search).get('run'); return v === 'cold' || v === 'warm' ? v : 'unknown'; } -/** Takes t_view_ms in the first animation frame after the graph mounted. */ -export function nextFrameMs(): Promise { - return new Promise((resolve) => requestAnimationFrame(() => resolve(Date.now()))); -} - // postMessage cannot clone Proxy objects; send plain JSON. function plain(v: unknown): unknown { return v === undefined ? null : JSON.parse(JSON.stringify(v)); } -/** The probe JSON; field names are the probe_record contract of build/stub_server.md Step 2. */ -export function buildProbe(view: RoadmapView, host: HostInfo, tViewMs: number, displayMode: string) { +/** The probe object. host_context is left out on purpose: it is large and recorded elsewhere. */ +export function buildProbe( + view: RoadmapView, + stamps: Stamps, + host: HostInfo, + displayMode: string, + leafRead: unknown, +) { return { run_kind: runKind(), + mode: view.mode, + scale: view.scale, + node_count: view.node_count, + payload_bytes: view.payload_bytes, t_server_ms: view.t_server_ms, - t_view_ms: tViewMs, + ...plain(stamps) as object, apps_protocol_announced: host.protocolAnnounced, apps_protocol_host: host.protocolHost ?? 'unknown', - host_capabilities: plain(host.hostCapabilities), - host_context: plain(host.hostContext), display_mode: displayMode, + leaf_read: leafRead, + host_capabilities: plain(host.hostCapabilities), }; } -async function send(view: RoadmapView, host: HostInfo, tViewMs: number, displayMode: string) { - return callAppTool('probe_record', buildProbe(view, host, tViewMs, displayMode)); -} - -/** First paint: one probe_record, display_mode taken from the host's current mode. */ -export async function recordFirstPaint(view: RoadmapView, host: HostInfo, tViewMs: number): Promise { - const ctx = host.hostContext as { displayMode?: string } | undefined; - await send(view, host, tViewMs, ctx?.displayMode ?? 'inline'); -} - -/** Full view opened: a second probe_record saying which path ran (fullscreen or outline). */ -export async function recordFullView( - view: RoadmapView, - host: HostInfo, - tViewMs: number, - ran: DisplayModeRan, -): Promise { - await send(view, host, tViewMs, ran); +/** One single-line chat message: RDM_PROBE followed by compact JSON. */ +export function probeLine(probe: object): string { + return 'RDM_PROBE ' + JSON.stringify(probe); } diff --git a/crates/rdm-mcp/view/src/types.ts b/crates/rdm-mcp/view/src/types.ts index ae42a79..cda82cd 100644 --- a/crates/rdm-mcp/view/src/types.ts +++ b/crates/rdm-mcp/view/src/types.ts @@ -7,15 +7,32 @@ export interface RoadmapNode { title: string; status: Status; depth: number; + /** Present only in result mode at scale 1. */ + markdown?: string; } -/** structuredContent of roadmap_view: the fixture plus the server's own numbers. */ +export type Mode = 'result' | 'chunks' | 'stream'; + +/** structuredContent of roadmap_view (round 2 contract). nodes is present in result mode only. */ export interface RoadmapView { - campaign: string; - frozen_at: string; - nodes: RoadmapNode[]; + mode: Mode; + scale: number; t_server_ms: number; payload_bytes: number; + node_count: number; + nodes?: RoadmapNode[]; + chunk_count?: number; + chunk_uri_template?: string; + stream_url?: string; +} + +export interface Stamps { + t_result_ms: number; + t_first_data_ms: number; + t_first_paint_ms: number; + t_complete_ms: number; + bytes_received: number; + nodes_received: number; } /** The five legacy classDef colours of the roadmap READMEs. */ From eaac92104f0b1fba7ece68cac7d622f8d512454d Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 17:19:12 +0900 Subject: [PATCH 037/183] docs(reports): record the m0 desktop host trials Claude Code Desktop renders the page from the tool result. It does not proxy tool calls (no serverTools), its resources/read fails for every URI, and it blocks the localhost domain the page declares in its CSP. Co-Authored-By: Claude Opus 5.5 --- .../m0-feasibility-spike/trials/desktop.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 __reports__/m0-feasibility-spike/trials/desktop.md diff --git a/__reports__/m0-feasibility-spike/trials/desktop.md b/__reports__/m0-feasibility-spike/trials/desktop.md new file mode 100644 index 0000000..c4d66f4 --- /dev/null +++ b/__reports__/m0-feasibility-spike/trials/desktop.md @@ -0,0 +1,30 @@ +# Desktop trials (Claude Code Desktop) + +Host: Claude Code Desktop. The user agent reports `Claude/5.11492.5`, Electron 45.2.1 and Chrome 156. Server: the `rdm-mcp` stub on rmcp =3.10.0, 2026-07-28 only, registered as the project stdio server `rdm`. Observed by Eliott on 2026-11-16. + +## Trial 1: render and app-only tools +- `roadmap_view` is listed and called, and the page renders "rather fast": **PASS**. +- Clicking a leaf (`leaf_get`, app-only) fails with `ProtocolError: IPC not available for MCP tool call`. +- No `probe_record` line reached the server: every call from the page to the server failed. + +## Trial 2: host data (diagnostics panel) +- **`hostCapabilities`:** `openLinks`, `serverResources`, `logging`, `sandbox`, `updateModelContext {text, image}` and `message {text}`. **There is no `serverTools`.** Under the Apps spec a page may proxy tool calls only when the host advertises that, so the IPC error is the host declining by design. +- **Apps protocol:** the page announced `2026-01-26` and the host returned `2026-01-26`. +- **Display:** `displayMode` is `inline`, and `availableDisplayModes` is `["inline", "fullscreen"]`. +- **`hostContext` keys:** `toolInfo`, `theme` (dark), `styles` (host CSS variables, plus `css.fonts`, which loads fonts from `assets.claude.ai`), `displayMode`, `availableDisplayModes`, `containerDimensions` (width 731, maxHeight 5000), `locale`, `timeZone`, `userAgent`, `platform` (desktop), `deviceCapabilities` (hover, no touch) and `safeAreaInsets`. The raw dump is in [desktop-host.json](desktop-host.json), with `styles` left out. +- **`updateModelContext`:** returns ok, but nothing appears in the session transcript. +- **Timing:** the panel showed 46,970 ms, which was Eliott's copy delay. The panel displayed the stamp of the latest probe, not of first paint. Eliott saw the page paint immediately. +- **Allow-rule string (project server):** `mcp__rdm__roadmap_view`, read from the session transcript. +- **macOS install trap:** the trial binary had been overwritten in place. macOS killed it at start (exit 137), so the host reported "Couldn't reconnect rdm: Connection closed". The fix is to install onto a new inode (`rm` then `cp`). + +## Trial 3: data channels (mode × scale) +| Channel | Result | +|:--|:--| +| `result`, scale 1 (43,715 B payload) | Renders. The tool result lands in the model context in full (45,034 chars in the transcript, about 11k tokens). Tool round trip 2.3 s (call 08:14:25.573, result 08:14:27.871). | +| `resources/read` from the page (`rdm://leaf/…`, `rdm://chunk/…`) | `ProtocolError: Resource unavailable: read_failed` for every URI, although `serverResources` is advertised | +| `stream` (SSE from `127.0.0.1:`, declared in `_meta.ui.csp.connectDomains`) | `CSP violation: connect-src blocked http://127.0.0.1:60021/…`. The host does not honour the declared domain | +| Tool call from the page | Still `IPC not available` | +| `ui/message` probe | No `RDM_PROBE` message in the transcript | + +## What this means +In this host the inline page can only show what the tool result carries, and the model's context pays for every byte of it. Leaf content, large roadmaps, streaming and live refresh cannot reach an inline page here. A standalone viewer has none of these limits: Svelte in Tauri, or in a local browser page, talking to the Rust core over IPC or RPC (Eliott's suggestion). From 77f798c952d09a58c257acb692cb6a39d629f25d Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 17:21:26 +0900 Subject: [PATCH 038/183] feat(rdm-mcp): carry the view data in the tool result _meta Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-mcp/src/main.rs | 27 +++++++++++++++++++++++++-- crates/rdm-mcp/tests/stdio.rs | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/crates/rdm-mcp/src/main.rs b/crates/rdm-mcp/src/main.rs index d874da1..ba01848 100644 --- a/crates/rdm-mcp/src/main.rs +++ b/crates/rdm-mcp/src/main.rs @@ -72,6 +72,7 @@ enum Mode { Result, Chunks, Stream, + Meta, } impl Mode { @@ -80,6 +81,7 @@ impl Mode { Self::Result => "result", Self::Chunks => "chunks", Self::Stream => "stream", + Self::Meta => "meta", } } } @@ -192,6 +194,8 @@ fn internal(e: impl std::fmt::Display) -> ErrorData { /// Largest accepted `scale`. const MAX_SCALE: u32 = 100; +/// Largest `scale` in `meta` mode. +const META_MAX_SCALE: u32 = 10; /// Target size of one chunk, in serialised bytes. const CHUNK_BYTES: usize = 64 * 1024; /// Port of the localhost SSE listener, set once in `main`. @@ -367,6 +371,12 @@ impl RdmSpike { None, )); } + if matches!(mode, Mode::Meta) && scale > META_MAX_SCALE { + return Err(ErrorData::invalid_params( + format!("mode \"meta\" takes scale 1 to {META_MAX_SCALE}"), + None, + )); + } if matches!(mode, Mode::Result) && scale > 1 { return Err(ErrorData::invalid_params( "mode \"result\" cannot take scale > 1: the result enters the model context; \ @@ -409,14 +419,27 @@ impl RdmSpike { let port = STREAM_PORT.get().ok_or_else(|| internal("stream listener is not bound"))?; view.stream_url = Some(format!("http://127.0.0.1:{port}/stream?scale={scale}")); } + Mode::Meta => {} } let summary = format!( "Roadmap {} at {}: {} nodes, mode {}, scale {}.", view.campaign, view.frozen_at, view.node_count, view.mode, scale ); view.t_server_ms = now_ms(); - let mut result = - CallToolResult::structured(serde_json::to_value(&view).map_err(internal)?); + let mut value = serde_json::to_value(&view).map_err(internal)?; + let mut result_meta = None; + if matches!(mode, Mode::Meta) { + // structuredContent keeps only the small summary; the nodes ride + // in the result-level `_meta`. + if let Value::Object(map) = &mut value { + for k in ["frozen_at", "nodes", "chunk_count", "chunk_uri_template", "stream_url"] { + map.remove(k); + } + } + let nodes = serde_json::to_value(&nodes).map_err(internal)?; + result_meta = Some(meta_from(json!({ "rdm": { "nodes": nodes } }))); + } + let mut result = CallToolResult::structured(value).with_meta(result_meta); result.content = vec![ContentBlock::text(summary)]; Ok(result) } diff --git a/crates/rdm-mcp/tests/stdio.rs b/crates/rdm-mcp/tests/stdio.rs index 4957482..aac54e9 100644 --- a/crates/rdm-mcp/tests/stdio.rs +++ b/crates/rdm-mcp/tests/stdio.rs @@ -423,3 +423,38 @@ async fn payload_sizes_by_scale() { assert!(sizes[0].1 < sizes[1].1 && sizes[1].1 < sizes[2].1); client.cancel().await.expect("close"); } + +#[tokio::test] +async fn meta_mode_carries_nodes_in_result_meta() { + let client = connect(None).await; + let args = json!({ "mode": "meta", "scale": 3 }); + let result = client + .call_tool( + CallToolRequestParams::new("roadmap_view") + .with_arguments(args.as_object().expect("object").clone()), + ) + .await + .expect("call roadmap_view"); + let sc = result.structured_content.expect("structuredContent"); + assert_eq!( + keys(&sc), + ["campaign", "mode", "node_count", "payload_bytes", "scale", "t_server_ms"] + ); + assert_eq!(sc["mode"], "meta"); + let meta = serde_json::to_value(result.meta.as_ref().expect("result _meta")).expect("ser"); + let nodes = meta["rdm"]["nodes"].as_array().expect("_meta.rdm.nodes"); + assert_eq!(nodes.len() as u64, sc["node_count"].as_u64().expect("node_count")); + assert_eq!(nodes.len(), 48); + assert!(nodes.iter().any(|n| n["markdown"].is_string())); + assert_eq!(result.content.len(), 1); + + let args = json!({ "mode": "meta", "scale": 11 }); + client + .call_tool( + CallToolRequestParams::new("roadmap_view") + .with_arguments(args.as_object().expect("object").clone()), + ) + .await + .expect_err("scale 11 refused in meta mode"); + client.cancel().await.expect("close"); +} From 84ea0feccf0a53ffaaf9f359b79e2e995bb90db3 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Mon, 16 Nov 2026 17:21:22 +0900 Subject: [PATCH 039/183] feat(rdm-mcp): render the view from the tool result _meta Co-Authored-By: Claude Sonnet 5.5 --- crates/rdm-mcp/view/dev/mock-host.html | 8 ++++++-- crates/rdm-mcp/view/dist/index.html | 4 ++-- crates/rdm-mcp/view/src/App.svelte | 14 +++++++++++++- crates/rdm-mcp/view/src/Diagnostics.svelte | 4 +++- crates/rdm-mcp/view/src/ingest.ts | 2 +- crates/rdm-mcp/view/src/types.ts | 3 ++- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/crates/rdm-mcp/view/dev/mock-host.html b/crates/rdm-mcp/view/dev/mock-host.html index a37da94..89d6707 100644 --- a/crates/rdm-mcp/view/dev/mock-host.html +++ b/crates/rdm-mcp/view/dev/mock-host.html @@ -1,5 +1,5 @@ - @@ -55,18 +55,22 @@

message log

async function toolResult() { const nodes = await allNodes(); + let meta; const sc = { mode, scale, t_server_ms: Date.now(), payload_bytes: JSON.stringify(nodes).length, node_count: nodes.length }; if (mode === 'result') { sc.nodes = nodes.map((n) => n.kind === 'leaf' && scale === 1 ? { ...n, markdown: '# ' + n.title + '\n(inline markdown)' } : n); } else if (mode === 'chunks') { sc.chunk_count = Math.ceil(nodes.length / CHUNK); sc.chunk_uri_template = 'rdm://chunk/{n}?scale=S'; + } else if (mode === 'meta') { + sc.campaign = 'sample'; + meta = { rdm: q.get('nometa') ? undefined : { nodes: nodes.map((n) => n.kind === 'leaf' ? { ...n, markdown: '# ' + n.title + '\n(from _meta)' } : n) } }; } else { sc.stream_url = location.origin + '/stream?scale=' + scale; } post({ jsonrpc: '2.0', method: 'ui/notifications/tool-input', params: { arguments: { mode, scale } } }); post({ jsonrpc: '2.0', method: 'ui/notifications/tool-result', params: { - content: [{ type: 'text', text: `${nodes.length} nodes (${mode})` }], structuredContent: sc } }); + content: [{ type: 'text', text: `${nodes.length} nodes (${mode})` }], structuredContent: sc, ...(meta ? { _meta: meta } : {}) } }); } async function readResource(id, uri) { diff --git a/crates/rdm-mcp/view/dist/index.html b/crates/rdm-mcp/view/dist/index.html index 5540b90..06667a4 100644 --- a/crates/rdm-mcp/view/dist/index.html +++ b/crates/rdm-mcp/view/dist/index.html @@ -105,8 +105,8 @@ - omitted: host decides border`)}),K({method:Z(`ui/request-display-mode`),params:K({mode:lb.describe(`The display mode being requested.`)})});var Eb=K({mode:lb.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),Db=J([Z(`model`),Z(`app`)]).describe(`Tool visibility scope - who can access the tool.`);K({resourceUri:B().optional(),visibility:G(Db).optional().describe(`Who can access this tool. Default: ["model", "app"] - "model": Tool visible to and callable by the agent - "app": Tool callable by the app from this server only`),csp:Yf().optional(),permissions:Yf().optional()}),K({mimeTypes:G(B()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),K({method:Z(`ui/download-file`),params:K({contents:G(J([wh,Th])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),K({method:Z(`ui/message`),params:K({role:Z(`user`).describe(`Message role, currently only "user" is supported.`),content:G(Eh).describe(`Message content blocks (text, image, etc.).`)})}),K({method:Z(`ui/notifications/sandbox-resource-ready`),params:K({html:B().describe(`HTML content to load into the inner iframe.`),sandbox:B().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:mb.optional().describe(`CSP configuration from resource metadata.`),permissions:hb.optional().describe(`Sandbox permissions from resource metadata.`)})});var Ob=K({method:Z(`ui/notifications/tool-result`),params:Fh.describe(`Standard MCP tool execution result.`)}),kb=K({toolInfo:K({id:om.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Mh.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:cb.optional().describe(`Current color theme preference.`),styles:bb.optional().describe(`Style configuration for theming the app.`),displayMode:lb.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:G(lb).optional().describe(`Display modes the host supports.`),containerDimensions:J([K({height:H().describe(`Fixed container height in pixels.`)}),K({maxHeight:J([H(),Hf()]).optional().describe(`Maximum container height in pixels.`)})]).and(J([K({width:H().describe(`Fixed container width in pixels.`)}),K({maxWidth:J([H(),Hf()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other -container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:B().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:B().optional().describe(`User's timezone in IANA format.`),userAgent:B().optional().describe(`Host application identifier.`),platform:J([Z(`web`),Z(`desktop`),Z(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:K({touch:U().optional().describe(`Whether the device supports touch input.`),hover:U().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:K({top:H().describe(`Top safe area inset in pixels.`),right:H().describe(`Right safe area inset in pixels.`),bottom:H().describe(`Bottom safe area inset in pixels.`),left:H().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),Ab=K({method:Z(`ui/notifications/host-context-changed`),params:kb.describe(`Partial context update containing only changed fields.`)});K({method:Z(`ui/update-model-context`),params:K({content:G(Eh).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:Y(B(),W().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),K({method:Z(`ui/initialize`),params:K({appInfo:ym.describe(`App identification (name and version).`),appCapabilities:Tb.describe(`Features and capabilities this app provides.`),protocolVersion:B().describe(`Protocol version this app supports.`)})});var jb=K({protocolVersion:B().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:ym.describe(`Host application identification and version.`),hostCapabilities:wb.describe(`Features and capabilities provided by the host.`),hostContext:kb.describe(`Rich context about the host environment.`)}).passthrough(),Mb={target:`draft-2020-12`};async function Nb(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Mb);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Pb(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Fb(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Ib=new class e extends Iy{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new tb;_methods=new nb;setRequestHandler=(...e)=>{let[t,...n]=ib(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=ib(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:gb,toolinputpartial:_b,toolresult:Ob,toolcancelled:vb,hostcontextchanged:Ab};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),n.allowUnsafeEval||Pa({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=Fb(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await Pb(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Pb(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Nb(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Nb(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:xb.shape.params,result:Sb},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},pb,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},pm,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},db,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},fb,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},Eb,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new sb(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:ob}},jb,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}}({name:`rdm-graph-view`,version:`0.0.0`},{},{autoResize:!0});async function Lb(e,t){Ib.ontoolresult=e,Ib.onhostcontextchanged=()=>t(Ib.getHostContext());let n=null,r=new sb(window.parent,window.parent);return window.addEventListener(`message`,e=>{let t=e.data;t&&t.result&&typeof t.result.protocolVersion==`string`&&t.result.hostCapabilities&&(n=t.result.protocolVersion)}),await Ib.connect(r),{protocolAnnounced:ob,protocolHost:n,hostCapabilities:Ib.getHostCapabilities(),hostContext:Ib.getHostContext(),hostInfo:Ib.getHostVersion()}}async function Rb(e,t={}){try{return(await Ib.callServerTool({name:e,arguments:t})).structuredContent??null}catch(t){throw zb?.(e,String(t)),t}}var zb=null;function Bb(e){zb=e}async function Vb(e){if(!Ib.getHostCapabilities()?.updateModelContext)return`skipped: host does not advertise updateModelContext`;try{return await Ib.updateModelContext({content:[{type:`text`,text:JSON.stringify(e)}],structuredContent:e}),`ok`}catch(e){let t=String(e);return zb?.(`ui/update-model-context`,t),`failed: `+t}}async function Hb(e){return(await Ib.requestDisplayMode({mode:e})).mode}async function Ub(e){try{let t=(await Ib.readServerResource({uri:e})).contents?.[0];if(typeof t?.text!=`string`)throw Error(`resource has no text content: `+e);return t.text}catch(t){throw zb?.(`resources/read `+e,String(t)),t}}async function Wb(e){if(!Ib.getHostCapabilities()?.message)return`skipped: host does not advertise message`;try{return await Ib.sendMessage({role:`user`,content:[{type:`text`,text:e}]}),`ok`}catch(e){let t=String(e);return zb?.(`ui/message`,t),`failed: `+t}}function Gb(){let e=new URLSearchParams(window.location.search).get(`run`);return e===`cold`||e===`warm`?e:`unknown`}function Kb(e){return e===void 0?null:JSON.parse(JSON.stringify(e))}function qb(e,t,n,r,i){return{run_kind:Gb(),mode:e.mode,scale:e.scale,node_count:e.node_count,payload_bytes:e.payload_bytes,t_server_ms:e.t_server_ms,...Kb(t),apps_protocol_announced:n.protocolAnnounced,apps_protocol_host:n.protocolHost??`unknown`,display_mode:r,leaf_read:i,host_capabilities:Kb(n.hostCapabilities)}}function Jb(e){return`RDM_PROBE `+JSON.stringify(e)}var Yb=()=>new Promise(e=>requestAnimationFrame(()=>e())),Xb=e=>new TextEncoder().encode(e).length,Zb=class{setNodes;stamps;all=[];pending=[];scheduled=!1;firstPainted=!1;constructor(e,t){this.setNodes=e,this.stamps=t}push(e){e.length&&(this.stamps.t_first_data_ms||(this.stamps.t_first_data_ms=Date.now()),this.pending.push(...e),this.stamps.nodes_received+=e.length,this.scheduled||(this.scheduled=!0,requestAnimationFrame(()=>{this.scheduled=!1,this.all=this.all.concat(this.pending),this.pending=[],this.setNodes(this.all),this.firstPainted||(this.firstPainted=!0,or().then(()=>requestAnimationFrame(()=>this.stamps.t_first_paint_ms=Date.now())))})))}async finish(){for(;this.pending.length||this.scheduled;)await Yb();await or(),await Yb(),this.stamps.t_complete_ms=Date.now()}};async function Qb(e,t,n){let r=new Zb(n,t);if(e.mode===`result`)t.bytes_received=Xb(JSON.stringify(e.nodes??[])),r.push(e.nodes??[]);else if(e.mode===`chunks`){let n=e.chunk_uri_template??``;for(let i=0;i<(e.chunk_count??0);i++){let a=await Ub(n.replace(`{n}`,String(i)).replace(/scale=S\b/,`scale=${e.scale}`));t.bytes_received+=Xb(a),r.push(JSON.parse(a).nodes)}}else if(e.mode===`stream`)await new Promise((n,i)=>{let a=``,o=e=>{a=`CSP violation: ${e.violatedDirective} blocked ${e.blockedURI}`};document.addEventListener(`securitypolicyviolation`,o);let s=new EventSource(e.stream_url??``),c=!1;s.onmessage=e=>{t.bytes_received+=Xb(e.data),r.push([JSON.parse(e.data)])},s.addEventListener(`done`,()=>{c=!0,s.close(),document.removeEventListener(`securitypolicyviolation`,o),n()}),s.onerror=()=>{c||(s.close(),document.removeEventListener(`securitypolicyviolation`,o),i(Error(`EventSource error on ${e.stream_url} (readyState ${s.readyState})${a?`; `+a:``}`)))}});else throw Error(`unknown mode: `+String(e.mode));await r.finish()}var $b={done:{fill:`#166534`,color:`#bbf7d0`},inprogress:{fill:`#854d0e`,color:`#fef08a`},planned:{fill:`#374151`,color:`#e5e7eb`},amendment:{fill:`#1e3a5f`,color:`#bfdbfe`},blocked:{fill:`#7f1d1d`,color:`#fecaca`}},ex=j(`
`),tx=j(``),nx=j(`

`),rx=j(`
`);function ix(e,t){Ge(t,!0);let n=ut(()=>{let e=[];for(let n of t.nodes)(e[n.depth]??=[]).push(n);return e});var r=rx();Br(r,21,()=>A(n),Ir,(e,n,r)=>{var i=wr(),a=nn(i),o=e=>{var i=nx(),a=tn(i);a.textContent=`depth ${r}`,Br(D(a,2),17,()=>A(n),e=>e.path,(e,n)=>{var r=wr(),i=nn(r),a=e=>{var t=ex(),r=rn(t,!0);Sn(()=>{ri(t,`title`,A(n).path),kr(r,A(n).title)}),M(e,t)},o=e=>{var r=tx();let i,a;var o=tn(r),s=rn(D(o),!0);Ee(r),Sn(()=>{i=Zr(r,1,`card svelte-gsm5hf`,null,i,{selected:t.selected===A(n).path}),ri(r,`title`,A(n).path),a=$r(r,``,a,{background:$b[A(n).status].fill,color:$b[A(n).status].color}),kr(o,`${A(n).title??``} `),kr(s,A(n).status)}),hr(`click`,r,()=>t.onselect(A(n).path)),M(e,r)};Fr(i,e=>{A(n).kind===`dir`?e(a):e(o,-1)}),M(e,r)}),Ee(i),M(e,i)};Fr(a,e=>{A(n)&&e(o)}),M(e,i)}),Ee(r),M(e,r),Ke()}gr([`click`]);var ax=j(`

Select a leaf to read it.

`),ox=j(`

`),sx=j(`

loading...

`),cx=j(`
 
`),lx=j(`

`,1),ux=j(``);function dx(e,t){var n=ux(),r=tn(n),i=e=>{M(e,ax())},a=e=>{var n=lx(),r=nn(n),i=rn(r,!0),a=D(r,2),o=tn(a),s=D(o,2);Ee(a);var c=D(a,2),l=e=>{var n=ox(),r=rn(n,!0);Sn(()=>kr(r,t.status)),M(e,n)};Fr(c,e=>{t.status&&e(l)});var u=D(c,2),d=e=>{M(e,sx())},f=e=>{var n=cx(),r=rn(n,!0);Sn(()=>kr(r,t.markdown??`(no markdown in the result: use a button)`)),M(e,n)};Fr(u,e=>{t.loading?e(d):e(f,-1)}),Sn(()=>kr(i,t.path)),hr(`click`,o,function(...e){t.onread?.apply(this,e)}),hr(`click`,s,function(...e){t.ontool?.apply(this,e)}),M(e,n)};Fr(r,e=>{t.path?e(a,-1):e(i)}),Ee(n),M(e,n)}gr([`click`]);var fx=j(` `),px=j(``),mx=j(`
  • `),hx=j(`
      `);function gx(e,t){Ge(t,!0);let n=ut(()=>[...t.nodes].sort((e,t)=>e.path.localeCompare(t.path)));var r=hx();Br(r,21,()=>A(n),e=>e.path,(e,n)=>{var r=mx();let i;var a=tn(r),o=e=>{var t=fx(),r=rn(t,!0);Sn(()=>kr(r,A(n).title)),M(e,t)},s=e=>{var r=px(),i=tn(r);let a;var o=D(i),s=rn(D(o),!0);Ee(r),Sn(()=>{a=$r(i,``,a,{background:$b[A(n).status].fill}),kr(o,`${A(n).title??``} `),kr(s,A(n).status)}),hr(`click`,r,()=>t.onselect(A(n).path)),M(e,r)};Fr(a,e=>{A(n).kind===`dir`?e(o):e(s,-1)}),Ee(r),Sn(()=>i=$r(r,``,i,{"padding-left":`${A(n).depth*16}px`})),M(e,r)}),Ee(r),M(e,r),Ke()}gr([`click`]);var _x=j(`
      Diagnostics
       
      `);function vx(e,t){Ge(t,!0);let n=T(void 0),r=T(``),i=e=>e&&t.view?`${e-t.view.t_server_ms} ms (${e})`:`n/a`,a=ut(()=>[`mode: ${t.view?.mode??`n/a`} scale: ${t.view?.scale??`n/a`} node_count: ${t.view?.node_count??`n/a`}`,`t_server_ms: ${t.view?.t_server_ms??`n/a`} payload_bytes: ${t.view?.payload_bytes??`n/a`}`,`t_result - t_server: ${i(t.stamps.t_result_ms)}`,`t_first_data - t_server: ${i(t.stamps.t_first_data_ms)}`,`t_first_paint - t_server: ${i(t.stamps.t_first_paint_ms)}`,`t_complete - t_server: ${i(t.stamps.t_complete_ms)}`,`bytes_received: ${t.stamps.bytes_received} nodes_received: ${t.stamps.nodes_received}`,`apps protocol announced: ${t.host?.protocolAnnounced??`n/a`}`,`apps protocol host: ${t.host?.protocolHost??`n/a`}`,`display mode: ${t.displayMode()}`,`ui/message: ${t.messageStatus}`,`ui/update-model-context: ${t.modelContext}`,`tool errors: ${Object.keys(t.errors).length?``:`none`}`,...Object.entries(t.errors).map(([e,t])=>` ${e}: ${t}`),`hostCapabilities: ${JSON.stringify(t.host?.hostCapabilities??null,null,2)}`,`hostContext: ${JSON.stringify(t.host?.hostContext??null,null,2)}`].join(` -`));async function o(){try{await navigator.clipboard.writeText(A(a)),E(r,`copied`)}catch{if(A(n)){let e=document.createRange();e.selectNodeContents(A(n));let t=window.getSelection();t?.removeAllRanges(),t?.addRange(e)}E(r,`clipboard blocked: text selected, press Cmd/Ctrl+C`)}}var s=_x(),c=D(tn(s),2),l=tn(c),u=rn(D(l,2),!0);Ee(c);var d=D(c,2),f=rn(d,!0);ci(d,e=>E(n,e),()=>A(n)),Ee(s),Sn(()=>{kr(u,A(r)),kr(f,A(a))}),hr(`click`,l,o),M(e,s),Ke()}gr([`click`]);var yx=j(` `),bx=j(``),xx=j(`

      `),Sx=j(`

      `),Cx=j(` `,1),wx=j(`
      `),Tx=j(`
      `);function Ex(e,t){Ge(t,!0);let n=T(null),r=T(null),i=T([]),a=T(null),o=T(`light`),s=T(null),c=T(null),l=T(``),u=T(null),d=T(!1),f=T(null),p=Kt({}),m=T(`not attempted`),h=T(`not attempted`),g=Kt({t_result_ms:0,t_first_data_ms:0,t_first_paint_ms:0,t_complete_ms:0,bytes_received:0,nodes_received:0}),_=!1;Bb((e,t)=>p[e]=t);function v(e){let t=e?.theme;(t===`light`||t===`dark`)&&E(o,t,!0)}function ee(){return A(f)??A(r)?.hostContext?.displayMode??`inline`}async function te(e){try{await Qb(e,g,e=>E(i,e))}catch(e){E(a,String(e),!0);return}let t=A(r)??await ne(),n=qb(e,g,t,ee(),A(u));Vb(n).then(e=>E(m,e,!0)),Wb(Jb(n)).then(e=>E(h,e,!0))}function ne(){return new Promise(e=>{let t=setInterval(()=>{A(r)&&(clearInterval(t),e(A(r)))},20)})}li(()=>{Lb(e=>{let t=e.structuredContent;t&&t.mode&&!_&&(_=!0,g.t_result_ms=Date.now(),E(n,t),te(t))},v).then(e=>{E(r,e),v(e.hostContext)},e=>E(a,String(e),!0))});function re(e){E(s,e,!0),E(l,``),E(c,A(i).find(t=>t.path===e)?.markdown??null,!0)}async function ie(){if(!A(s))return;let e=`rdm://leaf/`+A(s),t=Date.now();try{E(c,await Ub(e),!0);let n=Date.now()-t;E(l,`resources/read ok in ${n} ms`),E(u,{path:A(s),ok:!0,ms:n})}catch(e){E(l,`resources/read error: `+String(e)),E(u,{path:A(s),ok:!1,error:String(e)})}}async function ae(){if(A(s))try{let e=await Rb(`leaf_get`,{path:A(s)});E(c,e?.markdown??null,!0),E(l,`tool call ok`)}catch(e){E(l,`tool call error: `+String(e))}}async function oe(){if(Ib.getHostContext()?.availableDisplayModes?.includes(`fullscreen`))try{let e=await Hb(`fullscreen`);E(f,e===`fullscreen`?`fullscreen`:`inline`,!0)}catch(e){E(a,String(e),!0)}else E(d,!0),E(f,`outline`)}var se=Tx();let ce;var le=tn(se),ue=tn(le),de=rn(ue),fe=D(ue,2),pe=e=>{var t=yx(),r=rn(t);Sn(()=>kr(r,`${A(i).length??``}/${A(n).node_count??``} nodes`)),M(e,t)};Fr(fe,e=>{A(n)&&e(pe)});var me=D(fe,2),he=D(me,2),ge=e=>{var t=yx(),n=rn(t);Sn(()=>kr(n,`ran: ${A(f)??``}`)),M(e,t)};Fr(he,e=>{A(f)&&e(ge)});var _e=D(he,2),ve=e=>{var t=bx();hr(`click`,t,()=>E(d,!1)),M(e,t)};Fr(_e,e=>{A(d)&&e(ve)}),Ee(le);var y=D(le,2),ye=e=>{var t=xx(),n=rn(t,!0);Sn(()=>kr(n,A(a))),M(e,t)};Fr(y,e=>{A(a)&&e(ye)});var be=D(y,2),xe=e=>{var t=Sx(),n=rn(t,!0);Sn(()=>kr(n,A(r)?`waiting for the tool result...`:`connecting...`)),M(e,t)},Se=e=>{var t=Cx(),n=nn(t);gx(n,{get nodes(){return A(i)},onselect:re});var r=D(n,2),a=e=>{dx(e,{get path(){return A(s)},get markdown(){return A(c)},loading:!1,get status(){return A(l)},onread:ie,ontool:ae})};Fr(r,e=>{A(s)&&e(a)}),M(e,t)},b=e=>{var t=wx(),n=tn(t);ix(n,{get nodes(){return A(i)},get selected(){return A(s)},onselect:re}),dx(D(n,2),{get path(){return A(s)},get markdown(){return A(c)},loading:!1,get status(){return A(l)},onread:ie,ontool:ae}),Ee(t),M(e,t)};Fr(be,e=>{A(n)?A(d)?e(Se,1):e(b,-1):e(xe)}),vx(D(be,2),{get view(){return A(n)},get host(){return A(r)},get stamps(){return g},get errors(){return p},get modelContext(){return A(m)},get messageStatus(){return A(h)},displayMode:ee}),Ee(se),Sn(()=>{ce=Zr(se,1,`svelte-1n46o8q`,null,ce,{dark:A(o)===`dark`}),kr(de,`roadmap ${A(n)?`(${A(n).mode} x${A(n).scale})`:``}`),me.disabled=!A(n)}),hr(`click`,me,oe),M(e,se),Ke()}gr([`click`]),Ar(Ex,{target:document.getElementById(`app`)}); +container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:B().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:B().optional().describe(`User's timezone in IANA format.`),userAgent:B().optional().describe(`Host application identifier.`),platform:J([Z(`web`),Z(`desktop`),Z(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:K({touch:U().optional().describe(`Whether the device supports touch input.`),hover:U().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:K({top:H().describe(`Top safe area inset in pixels.`),right:H().describe(`Right safe area inset in pixels.`),bottom:H().describe(`Bottom safe area inset in pixels.`),left:H().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),Ab=K({method:Z(`ui/notifications/host-context-changed`),params:kb.describe(`Partial context update containing only changed fields.`)});K({method:Z(`ui/update-model-context`),params:K({content:G(Eh).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:Y(B(),W().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),K({method:Z(`ui/initialize`),params:K({appInfo:ym.describe(`App identification (name and version).`),appCapabilities:Tb.describe(`Features and capabilities this app provides.`),protocolVersion:B().describe(`Protocol version this app supports.`)})});var jb=K({protocolVersion:B().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:ym.describe(`Host application identification and version.`),hostCapabilities:wb.describe(`Features and capabilities provided by the host.`),hostContext:kb.describe(`Rich context about the host environment.`)}).passthrough(),Mb={target:`draft-2020-12`};async function Nb(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Mb);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Pb(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Fb(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Ib=new class e extends Iy{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new tb;_methods=new nb;setRequestHandler=(...e)=>{let[t,...n]=ib(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=ib(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:gb,toolinputpartial:_b,toolresult:Ob,toolcancelled:vb,hostcontextchanged:Ab};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),n.allowUnsafeEval||Pa({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=Fb(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await Pb(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Pb(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Nb(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Nb(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:xb.shape.params,result:Sb},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},pb,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},pm,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},db,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},fb,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},Eb,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new sb(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:ob}},jb,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}}({name:`rdm-graph-view`,version:`0.0.0`},{},{autoResize:!0});async function Lb(e,t){Ib.ontoolresult=e,Ib.onhostcontextchanged=()=>t(Ib.getHostContext());let n=null,r=new sb(window.parent,window.parent);return window.addEventListener(`message`,e=>{let t=e.data;t&&t.result&&typeof t.result.protocolVersion==`string`&&t.result.hostCapabilities&&(n=t.result.protocolVersion)}),await Ib.connect(r),{protocolAnnounced:ob,protocolHost:n,hostCapabilities:Ib.getHostCapabilities(),hostContext:Ib.getHostContext(),hostInfo:Ib.getHostVersion()}}async function Rb(e,t={}){try{return(await Ib.callServerTool({name:e,arguments:t})).structuredContent??null}catch(t){throw zb?.(e,String(t)),t}}var zb=null;function Bb(e){zb=e}async function Vb(e){if(!Ib.getHostCapabilities()?.updateModelContext)return`skipped: host does not advertise updateModelContext`;try{return await Ib.updateModelContext({content:[{type:`text`,text:JSON.stringify(e)}],structuredContent:e}),`ok`}catch(e){let t=String(e);return zb?.(`ui/update-model-context`,t),`failed: `+t}}async function Hb(e){return(await Ib.requestDisplayMode({mode:e})).mode}async function Ub(e){try{let t=(await Ib.readServerResource({uri:e})).contents?.[0];if(typeof t?.text!=`string`)throw Error(`resource has no text content: `+e);return t.text}catch(t){throw zb?.(`resources/read `+e,String(t)),t}}async function Wb(e){if(!Ib.getHostCapabilities()?.message)return`skipped: host does not advertise message`;try{return await Ib.sendMessage({role:`user`,content:[{type:`text`,text:e}]}),`ok`}catch(e){let t=String(e);return zb?.(`ui/message`,t),`failed: `+t}}function Gb(){let e=new URLSearchParams(window.location.search).get(`run`);return e===`cold`||e===`warm`?e:`unknown`}function Kb(e){return e===void 0?null:JSON.parse(JSON.stringify(e))}function qb(e,t,n,r,i){return{run_kind:Gb(),mode:e.mode,scale:e.scale,node_count:e.node_count,payload_bytes:e.payload_bytes,t_server_ms:e.t_server_ms,...Kb(t),apps_protocol_announced:n.protocolAnnounced,apps_protocol_host:n.protocolHost??`unknown`,display_mode:r,leaf_read:i,host_capabilities:Kb(n.hostCapabilities)}}function Jb(e){return`RDM_PROBE `+JSON.stringify(e)}var Yb=()=>new Promise(e=>requestAnimationFrame(()=>e())),Xb=e=>new TextEncoder().encode(e).length,Zb=class{setNodes;stamps;all=[];pending=[];scheduled=!1;firstPainted=!1;constructor(e,t){this.setNodes=e,this.stamps=t}push(e){e.length&&(this.stamps.t_first_data_ms||(this.stamps.t_first_data_ms=Date.now()),this.pending.push(...e),this.stamps.nodes_received+=e.length,this.scheduled||(this.scheduled=!0,requestAnimationFrame(()=>{this.scheduled=!1,this.all=this.all.concat(this.pending),this.pending=[],this.setNodes(this.all),this.firstPainted||(this.firstPainted=!0,or().then(()=>requestAnimationFrame(()=>this.stamps.t_first_paint_ms=Date.now())))})))}async finish(){for(;this.pending.length||this.scheduled;)await Yb();await or(),await Yb(),this.stamps.t_complete_ms=Date.now()}};async function Qb(e,t,n){let r=new Zb(n,t);if(e.mode===`result`||e.mode===`meta`)t.bytes_received=Xb(JSON.stringify(e.nodes??[])),r.push(e.nodes??[]);else if(e.mode===`chunks`){let n=e.chunk_uri_template??``;for(let i=0;i<(e.chunk_count??0);i++){let a=await Ub(n.replace(`{n}`,String(i)).replace(/scale=S\b/,`scale=${e.scale}`));t.bytes_received+=Xb(a),r.push(JSON.parse(a).nodes)}}else if(e.mode===`stream`)await new Promise((n,i)=>{let a=``,o=e=>{a=`CSP violation: ${e.violatedDirective} blocked ${e.blockedURI}`};document.addEventListener(`securitypolicyviolation`,o);let s=new EventSource(e.stream_url??``),c=!1;s.onmessage=e=>{t.bytes_received+=Xb(e.data),r.push([JSON.parse(e.data)])},s.addEventListener(`done`,()=>{c=!0,s.close(),document.removeEventListener(`securitypolicyviolation`,o),n()}),s.onerror=()=>{c||(s.close(),document.removeEventListener(`securitypolicyviolation`,o),i(Error(`EventSource error on ${e.stream_url} (readyState ${s.readyState})${a?`; `+a:``}`)))}});else throw Error(`unknown mode: `+String(e.mode));await r.finish()}var $b={done:{fill:`#166534`,color:`#bbf7d0`},inprogress:{fill:`#854d0e`,color:`#fef08a`},planned:{fill:`#374151`,color:`#e5e7eb`},amendment:{fill:`#1e3a5f`,color:`#bfdbfe`},blocked:{fill:`#7f1d1d`,color:`#fecaca`}},ex=j(`
      `),tx=j(``),nx=j(`

      `),rx=j(`
      `);function ix(e,t){Ge(t,!0);let n=ut(()=>{let e=[];for(let n of t.nodes)(e[n.depth]??=[]).push(n);return e});var r=rx();Br(r,21,()=>A(n),Ir,(e,n,r)=>{var i=wr(),a=nn(i),o=e=>{var i=nx(),a=tn(i);a.textContent=`depth ${r}`,Br(D(a,2),17,()=>A(n),e=>e.path,(e,n)=>{var r=wr(),i=nn(r),a=e=>{var t=ex(),r=rn(t,!0);Sn(()=>{ri(t,`title`,A(n).path),kr(r,A(n).title)}),M(e,t)},o=e=>{var r=tx();let i,a;var o=tn(r),s=rn(D(o),!0);Ee(r),Sn(()=>{i=Zr(r,1,`card svelte-gsm5hf`,null,i,{selected:t.selected===A(n).path}),ri(r,`title`,A(n).path),a=$r(r,``,a,{background:$b[A(n).status].fill,color:$b[A(n).status].color}),kr(o,`${A(n).title??``} `),kr(s,A(n).status)}),hr(`click`,r,()=>t.onselect(A(n).path)),M(e,r)};Fr(i,e=>{A(n).kind===`dir`?e(a):e(o,-1)}),M(e,r)}),Ee(i),M(e,i)};Fr(a,e=>{A(n)&&e(o)}),M(e,i)}),Ee(r),M(e,r),Ke()}gr([`click`]);var ax=j(`

      Select a leaf to read it.

      `),ox=j(`

      `),sx=j(`

      loading...

      `),cx=j(`
       
      `),lx=j(`

      `,1),ux=j(``);function dx(e,t){var n=ux(),r=tn(n),i=e=>{M(e,ax())},a=e=>{var n=lx(),r=nn(n),i=rn(r,!0),a=D(r,2),o=tn(a),s=D(o,2);Ee(a);var c=D(a,2),l=e=>{var n=ox(),r=rn(n,!0);Sn(()=>kr(r,t.status)),M(e,n)};Fr(c,e=>{t.status&&e(l)});var u=D(c,2),d=e=>{M(e,sx())},f=e=>{var n=cx(),r=rn(n,!0);Sn(()=>kr(r,t.markdown??`(no markdown in the result: use a button)`)),M(e,n)};Fr(u,e=>{t.loading?e(d):e(f,-1)}),Sn(()=>kr(i,t.path)),hr(`click`,o,function(...e){t.onread?.apply(this,e)}),hr(`click`,s,function(...e){t.ontool?.apply(this,e)}),M(e,n)};Fr(r,e=>{t.path?e(a,-1):e(i)}),Ee(n),M(e,n)}gr([`click`]);var fx=j(` `),px=j(``),mx=j(`
    • `),hx=j(`
        `);function gx(e,t){Ge(t,!0);let n=ut(()=>[...t.nodes].sort((e,t)=>e.path.localeCompare(t.path)));var r=hx();Br(r,21,()=>A(n),e=>e.path,(e,n)=>{var r=mx();let i;var a=tn(r),o=e=>{var t=fx(),r=rn(t,!0);Sn(()=>kr(r,A(n).title)),M(e,t)},s=e=>{var r=px(),i=tn(r);let a;var o=D(i),s=rn(D(o),!0);Ee(r),Sn(()=>{a=$r(i,``,a,{background:$b[A(n).status].fill}),kr(o,`${A(n).title??``} `),kr(s,A(n).status)}),hr(`click`,r,()=>t.onselect(A(n).path)),M(e,r)};Fr(a,e=>{A(n).kind===`dir`?e(o):e(s,-1)}),Ee(r),Sn(()=>i=$r(r,``,i,{"padding-left":`${A(n).depth*16}px`})),M(e,r)}),Ee(r),M(e,r),Ke()}gr([`click`]);var _x=j(`
        Diagnostics
         
        `);function vx(e,t){Ge(t,!0);let n=T(void 0),r=T(``),i=e=>e&&t.view?`${e-t.view.t_server_ms} ms (${e})`:`n/a`,a=ut(()=>[`mode: ${t.view?.mode??`n/a`} scale: ${t.view?.scale??`n/a`} node_count: ${t.view?.node_count??`n/a`}`,...t.metaLine?[t.metaLine]:[],`t_server_ms: ${t.view?.t_server_ms??`n/a`} payload_bytes: ${t.view?.payload_bytes??`n/a`}`,`t_result - t_server: ${i(t.stamps.t_result_ms)}`,`t_first_data - t_server: ${i(t.stamps.t_first_data_ms)}`,`t_first_paint - t_server: ${i(t.stamps.t_first_paint_ms)}`,`t_complete - t_server: ${i(t.stamps.t_complete_ms)}`,`bytes_received: ${t.stamps.bytes_received} nodes_received: ${t.stamps.nodes_received}`,`apps protocol announced: ${t.host?.protocolAnnounced??`n/a`}`,`apps protocol host: ${t.host?.protocolHost??`n/a`}`,`display mode: ${t.displayMode()}`,`ui/message: ${t.messageStatus}`,`ui/update-model-context: ${t.modelContext}`,`tool errors: ${Object.keys(t.errors).length?``:`none`}`,...Object.entries(t.errors).map(([e,t])=>` ${e}: ${t}`),`hostCapabilities: ${JSON.stringify(t.host?.hostCapabilities??null,null,2)}`,`hostContext: ${JSON.stringify(t.host?.hostContext??null,null,2)}`].join(` +`));async function o(){try{await navigator.clipboard.writeText(A(a)),E(r,`copied`)}catch{if(A(n)){let e=document.createRange();e.selectNodeContents(A(n));let t=window.getSelection();t?.removeAllRanges(),t?.addRange(e)}E(r,`clipboard blocked: text selected, press Cmd/Ctrl+C`)}}var s=_x(),c=D(tn(s),2),l=tn(c),u=rn(D(l,2),!0);Ee(c);var d=D(c,2),f=rn(d,!0);ci(d,e=>E(n,e),()=>A(n)),Ee(s),Sn(()=>{kr(u,A(r)),kr(f,A(a))}),hr(`click`,l,o),M(e,s),Ke()}gr([`click`]);var yx=j(` `),bx=j(``),xx=j(`

        `),Sx=j(`

        `),Cx=j(` `,1),wx=j(`
        `),Tx=j(`
        `);function Ex(e,t){Ge(t,!0);let n=T(null),r=T(null),i=T([]),a=T(null),o=T(`light`),s=T(null),c=T(null),l=T(``),u=T(null),d=T(!1),f=T(null),p=Kt({}),m=T(`not attempted`),h=T(`not attempted`),g=Kt({t_result_ms:0,t_first_data_ms:0,t_first_paint_ms:0,t_complete_ms:0,bytes_received:0,nodes_received:0}),_=!1,v=T(``);Bb((e,t)=>p[e]=t);function ee(e){let t=e?.theme;(t===`light`||t===`dark`)&&E(o,t,!0)}function te(){return A(f)??A(r)?.hostContext?.displayMode??`inline`}async function ne(e){try{await Qb(e,g,e=>E(i,e))}catch(e){E(a,String(e),!0);return}let t=A(r)??await re(),n=qb(e,g,t,te(),A(u));Vb(n).then(e=>E(m,e,!0)),Wb(Jb(n)).then(e=>E(h,e,!0))}function re(){return new Promise(e=>{let t=setInterval(()=>{A(r)&&(clearInterval(t),e(A(r)))},20)})}li(()=>{Lb(e=>{let t=e.structuredContent;if(t&&t.mode&&!_){if(_=!0,t.mode===`meta`){let n=e._meta,r=n?.rdm?.nodes;Array.isArray(r)?(t.nodes=r,E(v,`nodes from _meta: ${r.length} of ${t.node_count}`)):E(v,`_meta.rdm missing; result keys: ${Object.keys(e).join(`, `)}; _meta keys: ${n?Object.keys(n).join(`, `)||`(empty)`:`(no _meta)`}`)}g.t_result_ms=Date.now(),E(n,t),ne(t)}},ee).then(e=>{E(r,e),ee(e.hostContext)},e=>E(a,String(e),!0))});function ie(e){E(s,e,!0),E(l,``),E(c,A(i).find(t=>t.path===e)?.markdown??null,!0)}async function ae(){if(!A(s))return;let e=`rdm://leaf/`+A(s),t=Date.now();try{E(c,await Ub(e),!0);let n=Date.now()-t;E(l,`resources/read ok in ${n} ms`),E(u,{path:A(s),ok:!0,ms:n})}catch(e){E(l,`resources/read error: `+String(e)),E(u,{path:A(s),ok:!1,error:String(e)})}}async function oe(){if(A(s))try{let e=await Rb(`leaf_get`,{path:A(s)});E(c,e?.markdown??null,!0),E(l,`tool call ok`)}catch(e){E(l,`tool call error: `+String(e))}}async function se(){if(Ib.getHostContext()?.availableDisplayModes?.includes(`fullscreen`))try{let e=await Hb(`fullscreen`);E(f,e===`fullscreen`?`fullscreen`:`inline`,!0)}catch(e){E(a,String(e),!0)}else E(d,!0),E(f,`outline`)}var ce=Tx();let le;var ue=tn(ce),de=tn(ue),fe=rn(de),pe=D(de,2),me=e=>{var t=yx(),r=rn(t);Sn(()=>kr(r,`${A(i).length??``}/${A(n).node_count??``} nodes`)),M(e,t)};Fr(pe,e=>{A(n)&&e(me)});var he=D(pe,2),ge=D(he,2),_e=e=>{var t=yx(),n=rn(t);Sn(()=>kr(n,`ran: ${A(f)??``}`)),M(e,t)};Fr(ge,e=>{A(f)&&e(_e)});var ve=D(ge,2),y=e=>{var t=bx();hr(`click`,t,()=>E(d,!1)),M(e,t)};Fr(ve,e=>{A(d)&&e(y)}),Ee(ue);var ye=D(ue,2),be=e=>{var t=xx(),n=rn(t,!0);Sn(()=>kr(n,A(a))),M(e,t)};Fr(ye,e=>{A(a)&&e(be)});var xe=D(ye,2),Se=e=>{var t=Sx(),n=rn(t,!0);Sn(()=>kr(n,A(r)?`waiting for the tool result...`:`connecting...`)),M(e,t)},b=e=>{var t=Cx(),n=nn(t);gx(n,{get nodes(){return A(i)},onselect:ie});var r=D(n,2),a=e=>{dx(e,{get path(){return A(s)},get markdown(){return A(c)},loading:!1,get status(){return A(l)},onread:ae,ontool:oe})};Fr(r,e=>{A(s)&&e(a)}),M(e,t)},Ce=e=>{var t=wx(),n=tn(t);ix(n,{get nodes(){return A(i)},get selected(){return A(s)},onselect:ie}),dx(D(n,2),{get path(){return A(s)},get markdown(){return A(c)},loading:!1,get status(){return A(l)},onread:ae,ontool:oe}),Ee(t),M(e,t)};Fr(xe,e=>{A(n)?A(d)?e(b,1):e(Ce,-1):e(Se)}),vx(D(xe,2),{get view(){return A(n)},get host(){return A(r)},get stamps(){return g},get errors(){return p},get modelContext(){return A(m)},get messageStatus(){return A(h)},displayMode:te,get metaLine(){return A(v)}}),Ee(ce),Sn(()=>{le=Zr(ce,1,`svelte-1n46o8q`,null,le,{dark:A(o)===`dark`}),kr(fe,`roadmap ${A(n)?`(${A(n).mode} x${A(n).scale})`:``}`),he.disabled=!A(n)}),hr(`click`,he,se),M(e,ce),Ke()}gr([`click`]),Ar(Ex,{target:document.getElementById(`app`)}); diff --git a/crates/rdm-mcp/view/src/App.svelte b/crates/rdm-mcp/view/src/App.svelte index 6172597..58ba67c 100644 --- a/crates/rdm-mcp/view/src/App.svelte +++ b/crates/rdm-mcp/view/src/App.svelte @@ -27,6 +27,7 @@ t_result_ms: 0, t_first_data_ms: 0, t_first_paint_ms: 0, t_complete_ms: 0, bytes_received: 0, nodes_received: 0, }); let started = false; + let metaLine = $state(''); onToolError((tool, text) => (errors[tool] = text)); function readTheme(ctx: unknown) { @@ -69,6 +70,17 @@ const sc = p.structuredContent as unknown as RoadmapView | undefined; if (!sc || !sc.mode || started) return; started = true; + if (sc.mode === 'meta') { + // CallToolResult._meta arrives on the ontoolresult params as-is. + const meta = (p as { _meta?: { rdm?: { nodes?: RoadmapNode[] } } })._meta; + const n = meta?.rdm?.nodes; + if (Array.isArray(n)) { + sc.nodes = n; + metaLine = `nodes from _meta: ${n.length} of ${sc.node_count}`; + } else { + metaLine = `_meta.rdm missing; result keys: ${Object.keys(p).join(', ')}; _meta keys: ${meta ? Object.keys(meta).join(', ') || '(empty)' : '(no _meta)'}`; + } + } stamps.t_result_ms = Date.now(); view = sc; void run(sc); @@ -151,7 +163,7 @@ {/if} - + - - -

        mock host

        - -

        message log

        -
        
        -
        -
        -
        diff --git a/crates/rdm-mcp/view/dev/mock-server.py b/crates/rdm-mcp/view/dev/mock-server.py
        deleted file mode 100644
        index d23bdd6..0000000
        --- a/crates/rdm-mcp/view/dev/mock-server.py
        +++ /dev/null
        @@ -1,46 +0,0 @@
        -#!/usr/bin/env python3
        -"""Dev only. Static files for the mock host plus an SSE endpoint /stream?scale=S.
        -Run from crates/rdm-mcp/view:  python3 dev/mock-server.py 8765"""
        -import json, sys, time
        -from functools import partial
        -from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
        -from urllib.parse import urlparse, parse_qs
        -
        -BASE = json.load(open("dev/sample-roadmap.json"))["nodes"]
        -
        -
        -def scaled(scale):
        -    for i in range(scale):
        -        for n in BASE:
        -            if scale == 1:
        -                yield n
        -            else:
        -                yield {**n, "path": f"s{i}/{n['path']}", "parent": f"s{i}/{n['parent']}" if n["parent"] else f"s{i}"}
        -
        -
        -class H(SimpleHTTPRequestHandler):
        -    def do_GET(self):
        -        u = urlparse(self.path)
        -        if u.path != "/stream":
        -            return super().do_GET()
        -        scale = int(parse_qs(u.query).get("scale", ["1"])[0])
        -        self.send_response(200)
        -        self.send_header("Content-Type", "text/event-stream")
        -        self.send_header("Cache-Control", "no-cache")
        -        self.end_headers()
        -        try:
        -            for n in scaled(scale):
        -                self.wfile.write(f"data: {json.dumps(n)}\n\n".encode())
        -                self.wfile.flush()
        -                time.sleep(0.005)
        -            self.wfile.write(b"event: done\ndata: {}\n\n")
        -            self.wfile.flush()
        -        except (BrokenPipeError, ConnectionResetError):
        -            pass
        -
        -    def log_message(self, *a):
        -        pass
        -
        -
        -if __name__ == "__main__":
        -    ThreadingHTTPServer(("127.0.0.1", int(sys.argv[1])), H).serve_forever()
        diff --git a/crates/rdm-mcp/view/dev/sample-leaves/core/engine/render/html.md b/crates/rdm-mcp/view/dev/sample-leaves/core/engine/render/html.md
        deleted file mode 100644
        index e295f08..0000000
        --- a/crates/rdm-mcp/view/dev/sample-leaves/core/engine/render/html.md
        +++ /dev/null
        @@ -1,7 +0,0 @@
        -# Render html
        -
        -**Goal**: sample leaf for the mock host.
        -**Status**: blocked
        -
        -## Step 1
        -Do the thing.
        diff --git a/crates/rdm-mcp/view/dev/sample-leaves/core/m1_foundation.md b/crates/rdm-mcp/view/dev/sample-leaves/core/m1_foundation.md
        deleted file mode 100644
        index 4af2fa3..0000000
        --- a/crates/rdm-mcp/view/dev/sample-leaves/core/m1_foundation.md
        +++ /dev/null
        @@ -1,7 +0,0 @@
        -# M1 Foundation
        -
        -**Goal**: sample leaf for the mock host.
        -**Status**: inprogress
        -
        -## Step 1
        -Do the thing.
        diff --git a/crates/rdm-mcp/view/dev/sample-leaves/design/spec.md b/crates/rdm-mcp/view/dev/sample-leaves/design/spec.md
        deleted file mode 100644
        index 7aa48ef..0000000
        --- a/crates/rdm-mcp/view/dev/sample-leaves/design/spec.md
        +++ /dev/null
        @@ -1,7 +0,0 @@
        -# Spec
        -
        -**Goal**: sample leaf for the mock host.
        -**Status**: done
        -
        -## Step 1
        -Do the thing.
        diff --git a/crates/rdm-mcp/view/dev/sample-roadmap.json b/crates/rdm-mcp/view/dev/sample-roadmap.json
        deleted file mode 100644
        index f5dc575..0000000
        --- a/crates/rdm-mcp/view/dev/sample-roadmap.json
        +++ /dev/null
        @@ -1,102 +0,0 @@
        -{
        -  "campaign": "sample-roadmap",
        -  "frozen_at": "0000000",
        -  "nodes": [
        -    {
        -      "path": "core",
        -      "parent": "core",
        -      "kind": "dir",
        -      "title": "Core",
        -      "status": "inprogress",
        -      "depth": 0
        -    },
        -    {
        -      "path": "design",
        -      "parent": "design",
        -      "kind": "dir",
        -      "title": "Design",
        -      "status": "done",
        -      "depth": 0
        -    },
        -    {
        -      "path": "intro.md",
        -      "parent": null,
        -      "kind": "leaf",
        -      "title": "Intro",
        -      "status": "planned",
        -      "depth": 0
        -    },
        -    {
        -      "path": "core/m1_foundation.md",
        -      "parent": "core",
        -      "kind": "leaf",
        -      "title": "M1 Foundation",
        -      "status": "inprogress",
        -      "depth": 1
        -    },
        -    {
        -      "path": "core/engine",
        -      "parent": "core",
        -      "kind": "dir",
        -      "title": "Engine",
        -      "status": "inprogress",
        -      "depth": 1
        -    },
        -    {
        -      "path": "design/spec.md",
        -      "parent": "design",
        -      "kind": "leaf",
        -      "title": "Spec",
        -      "status": "done",
        -      "depth": 1
        -    },
        -    {
        -      "path": "design/review.md",
        -      "parent": "design",
        -      "kind": "leaf",
        -      "title": "Review",
        -      "status": "amendment",
        -      "depth": 1
        -    },
        -    {
        -      "path": "design/notes.md",
        -      "parent": "design",
        -      "kind": "leaf",
        -      "title": "Notes",
        -      "status": "planned",
        -      "depth": 1
        -    },
        -    {
        -      "path": "core/engine/parse.md",
        -      "parent": "core/engine",
        -      "kind": "leaf",
        -      "title": "Parse",
        -      "status": "done",
        -      "depth": 2
        -    },
        -    {
        -      "path": "core/engine/render",
        -      "parent": "core/engine",
        -      "kind": "dir",
        -      "title": "Render",
        -      "status": "blocked",
        -      "depth": 2
        -    },
        -    {
        -      "path": "core/engine/render/html.md",
        -      "parent": "core/engine/render",
        -      "kind": "leaf",
        -      "title": "Render html",
        -      "status": "blocked",
        -      "depth": 3
        -    },
        -    {
        -      "path": "core/engine/render/svg.md",
        -      "parent": "core/engine/render",
        -      "kind": "leaf",
        -      "title": "Render svg",
        -      "status": "planned",
        -      "depth": 3
        -    }
        -  ]
        -}
        \ No newline at end of file
        diff --git a/crates/rdm-mcp/view/dist/index.html b/crates/rdm-mcp/view/dist/index.html
        deleted file mode 100644
        index 06667a4..0000000
        --- a/crates/rdm-mcp/view/dist/index.html
        +++ /dev/null
        @@ -1,116 +0,0 @@
        -
        -
        -  
        -    
        -    
        -    rdm graph view
        -    
        -    
        -  
        -  
        -    
        - - diff --git a/crates/rdm-mcp/view/index.html b/crates/rdm-mcp/view/index.html deleted file mode 100644 index 95b4867..0000000 --- a/crates/rdm-mcp/view/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - rdm graph view - - -
        - - - diff --git a/crates/rdm-mcp/view/package-lock.json b/crates/rdm-mcp/view/package-lock.json deleted file mode 100644 index f24b756..0000000 --- a/crates/rdm-mcp/view/package-lock.json +++ /dev/null @@ -1,1350 +0,0 @@ -{ - "name": "rdm-mcp-view", - "version": "0.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "rdm-mcp-view", - "version": "0.0.0", - "dependencies": { - "@modelcontextprotocol/ext-apps": "2.0.4", - "@sveltejs/vite-plugin-svelte": "7.3.1", - "svelte": "5.57.3", - "vite": "8.3.8", - "vite-plugin-singlefile": "2.3.4" - } - }, - "node_modules/@emnapi/core": { - "version": "2.0.0-beta.2", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", - "integrity": "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==", - "license": "MIT", - "optional": true, - "dependencies": { - "@emnapi/wasi-threads": "2.2.0", - "tslib": "^2.4.0" - } - }, - "node_modules/@emnapi/runtime": { - "version": "2.0.0-beta.2", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.2.tgz", - "integrity": "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@emnapi/wasi-threads": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz", - "integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", - "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", - "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@modelcontextprotocol/client": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@modelcontextprotocol/client/-/client-2.4.0.tgz", - "integrity": "sha512-LgrD2OphHuG12vfKFKz6SOnq7bKHQmhGJIAYdD+MZBn2npHEyry6uD8zvktodtl5CQM85MO0anUyD9JwmUmxww==", - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "@modelcontextprotocol/core": "2.4.0", - "cross-spawn": "^7.0.5", - "eventsource": "^3.0.2", - "eventsource-parser": "^3.0.8", - "jose": "^6.1.3", - "pkce-challenge": "^5.0.0", - "zod": "^4.2.0" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@modelcontextprotocol/core": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.4.0.tgz", - "integrity": "sha512-z8QBKqdfXLPzkLQuG4xp8hrVEMm1PZ1IgxMN2sMbJiFiAKOWXnAzogXn2W4aqIBlP1ea6U5yiqVquvUNM1Cj6Q==", - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "zod": "^4.2.0" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@modelcontextprotocol/ext-apps": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@modelcontextprotocol/ext-apps/-/ext-apps-2.0.4.tgz", - "integrity": "sha512-B+PcbuGiaf0e5I3uy4iO5tS3Abo+5w8JvZFzHMzQdq9yVwP836zJkw2+KCGOQ0r4TM1fuQi4JdnbuWjkS4aBvg==", - "license": "MIT", - "workspaces": [ - "examples/*" - ], - "dependencies": { - "@standard-schema/spec": "^1.1.0" - }, - "engines": { - "node": ">=20" - }, - "peerDependencies": { - "@modelcontextprotocol/client": "^2.0.0", - "@modelcontextprotocol/core": "^2.0.0", - "@modelcontextprotocol/server": "^2.0.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0", - "zod": "^4.2.0" - }, - "peerDependenciesMeta": { - "@modelcontextprotocol/server": { - "optional": true - }, - "react": { - "optional": true - }, - "react-dom": { - "optional": true - } - } - }, - "node_modules/@napi-rs/wasm-runtime": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", - "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", - "license": "MIT", - "optional": true, - "dependencies": { - "@tybys/wasm-util": "^0.10.3" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=23.5.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Brooooooklyn" - }, - "peerDependencies": { - "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", - "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" - } - }, - "node_modules/@oxc-project/types": { - "version": "0.156.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", - "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/oxc-project" - } - }, - "node_modules/@rolldown/binding-android-arm-eabi": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.19.tgz", - "integrity": "sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-android-arm64": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.19.tgz", - "integrity": "sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.19.tgz", - "integrity": "sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.19.tgz", - "integrity": "sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.19.tgz", - "integrity": "sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.19.tgz", - "integrity": "sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.19.tgz", - "integrity": "sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==", - "cpu": [ - "arm64" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.19.tgz", - "integrity": "sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==", - "cpu": [ - "arm64" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.19.tgz", - "integrity": "sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==", - "cpu": [ - "ppc64" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.19.tgz", - "integrity": "sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==", - "cpu": [ - "s390x" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.19.tgz", - "integrity": "sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==", - "cpu": [ - "x64" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.19.tgz", - "integrity": "sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==", - "cpu": [ - "x64" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.19.tgz", - "integrity": "sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-wasm32-wasi": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.2.19.tgz", - "integrity": "sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==", - "cpu": [ - "wasm32" - ], - "license": "MIT", - "optional": true, - "dependencies": { - "@emnapi/core": "2.0.0-beta.2", - "@emnapi/runtime": "2.0.0-beta.2", - "@napi-rs/wasm-runtime": "1.2.6" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=23.5.0" - } - }, - "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.19.tgz", - "integrity": "sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.19.tgz", - "integrity": "sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/pluginutils": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.1.1.tgz", - "integrity": "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA==", - "license": "MIT" - }, - "node_modules/@standard-schema/spec": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", - "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", - "license": "MIT" - }, - "node_modules/@sveltejs/acorn-typescript": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.13.tgz", - "integrity": "sha512-wgKggnhZVL9Bfx1OaKKTrYY9BFRk6C8UAkQNUcIv1+llzYrIqy+RZm5HPKzn0NpEBvTVhTqB4kQyllZywsRBRQ==", - "license": "MIT", - "peerDependencies": { - "acorn": "^8.9.0" - } - }, - "node_modules/@sveltejs/vite-plugin-svelte": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.3.1.tgz", - "integrity": "sha512-ZPsLN8B1e/En+Ak5s4V7srFDT532oS0qieLsQwu63NGKsS+iAjoO2Js1BochlHlglcU+Pt7WAO3C5Ee+4f6gVA==", - "license": "MIT", - "dependencies": { - "deepmerge": "^4.3.1", - "magic-string": "^1.0.0", - "obug": "^2.1.0", - "vitefu": "^1.1.2" - }, - "engines": { - "node": "^20.19 || ^22.12 || >=24" - }, - "peerDependencies": { - "svelte": "^5.46.4", - "vite": "^8.0.0-beta.7 || ^8.0.0" - } - }, - "node_modules/@tybys/wasm-util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz", - "integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@types/estree": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", - "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", - "license": "MIT" - }, - "node_modules/acorn": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", - "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/aria-query": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz", - "integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==", - "license": "Apache-2.0", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/axobject-query": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", - "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", - "license": "Apache-2.0", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "license": "MIT", - "peer": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/detect-libc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", - "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", - "license": "Apache-2.0", - "engines": { - "node": ">=8" - } - }, - "node_modules/devalue": { - "version": "5.9.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.9.4.tgz", - "integrity": "sha512-sPAT4pztbu6586/hrhOnMKS17IJrvg12mXiSPSS3W5qDeN2RGgvZ0diZCm31dBbnevfVmujNO3IM2wrS4Y2Rhg==", - "license": "MIT" - }, - "node_modules/esm-env": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz", - "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==", - "license": "MIT" - }, - "node_modules/esrap": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.4.0.tgz", - "integrity": "sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA==", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" - }, - "peerDependencies": { - "@typescript-eslint/types": "^8.2.0" - }, - "peerDependenciesMeta": { - "@typescript-eslint/types": { - "optional": true - } - } - }, - "node_modules/eventsource": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", - "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", - "license": "MIT", - "peer": true, - "dependencies": { - "eventsource-parser": "^3.0.1" - }, - "engines": { - "node": ">=18.0.0" - } - }, - "node_modules/eventsource-parser": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.1.1.tgz", - "integrity": "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=18.0.0" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/is-reference": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz", - "integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.6" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC", - "peer": true - }, - "node_modules/jose": { - "version": "6.2.17", - "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.17.tgz", - "integrity": "sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==", - "license": "MIT", - "peer": true, - "funding": { - "url": "https://github.com/sponsors/panva" - } - }, - "node_modules/lightningcss": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", - "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", - "license": "MPL-2.0", - "dependencies": { - "detect-libc": "^2.0.3" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-android-arm64": "1.33.0", - "lightningcss-darwin-arm64": "1.33.0", - "lightningcss-darwin-x64": "1.33.0", - "lightningcss-freebsd-x64": "1.33.0", - "lightningcss-linux-arm-gnueabihf": "1.33.0", - "lightningcss-linux-arm64-gnu": "1.33.0", - "lightningcss-linux-arm64-musl": "1.33.0", - "lightningcss-linux-x64-gnu": "1.33.0", - "lightningcss-linux-x64-musl": "1.33.0", - "lightningcss-win32-arm64-msvc": "1.33.0", - "lightningcss-win32-x64-msvc": "1.33.0" - } - }, - "node_modules/lightningcss-android-arm64": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", - "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-arm64": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", - "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", - "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", - "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", - "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", - "cpu": [ - "arm" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", - "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", - "cpu": [ - "arm64" - ], - "libc": [ - "glibc" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", - "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", - "cpu": [ - "arm64" - ], - "libc": [ - "musl" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", - "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", - "cpu": [ - "x64" - ], - "libc": [ - "glibc" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", - "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", - "cpu": [ - "x64" - ], - "libc": [ - "musl" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", - "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", - "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/locate-character": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", - "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", - "license": "MIT" - }, - "node_modules/magic-string": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", - "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.6.0" - } - }, - "node_modules/nanoid": { - "version": "3.3.20", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", - "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/obug": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", - "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", - "funding": [ - "https://github.com/sponsors/sxzz", - "https://opencollective.com/debug" - ], - "license": "MIT", - "engines": { - "node": ">=12.20.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", - "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pkce-challenge": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", - "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=16.20.0" - } - }, - "node_modules/postcss": { - "version": "8.5.33", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz", - "integrity": "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.20", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.2" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/rolldown": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz", - "integrity": "sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==", - "license": "MIT", - "dependencies": { - "@oxc-project/types": "=0.156.0", - "@rolldown/pluginutils": "^1.0.0" - }, - "bin": { - "rolldown": "bin/cli.mjs" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "optionalDependencies": { - "@rolldown/binding-android-arm-eabi": "1.2.19", - "@rolldown/binding-android-arm64": "1.2.19", - "@rolldown/binding-darwin-arm64": "1.2.19", - "@rolldown/binding-darwin-x64": "1.2.19", - "@rolldown/binding-freebsd-x64": "1.2.19", - "@rolldown/binding-linux-arm-gnueabihf": "1.2.19", - "@rolldown/binding-linux-arm64-gnu": "1.2.19", - "@rolldown/binding-linux-arm64-musl": "1.2.19", - "@rolldown/binding-linux-ppc64-gnu": "1.2.19", - "@rolldown/binding-linux-s390x-gnu": "1.2.19", - "@rolldown/binding-linux-x64-gnu": "1.2.19", - "@rolldown/binding-linux-x64-musl": "1.2.19", - "@rolldown/binding-openharmony-arm64": "1.2.19", - "@rolldown/binding-wasm32-wasi": "1.2.19", - "@rolldown/binding-win32-arm64-msvc": "1.2.19", - "@rolldown/binding-win32-x64-msvc": "1.2.19" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "license": "MIT", - "peer": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map-js": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", - "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/svelte": { - "version": "5.57.3", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.57.3.tgz", - "integrity": "sha512-5mAftM3SoDV9X0zdF386F9p2pv8iKOwi/KfBS1XnBAkVCKFzVOLHUoa8iGWAt4buoicLmyWVRpuuD5wplXOQsg==", - "license": "MIT", - "dependencies": { - "@jridgewell/remapping": "^2.3.5", - "@jridgewell/sourcemap-codec": "^1.6.0", - "@sveltejs/acorn-typescript": "^1.0.13", - "@types/estree": "^1.0.9", - "acorn": "^8.18.0", - "aria-query": "5.3.1", - "axobject-query": "^4.1.0", - "clsx": "^2.1.1", - "devalue": "^5.9.2", - "esm-env": "^1.2.1", - "esrap": "^2.3.6", - "is-reference": "^3.0.3", - "locate-character": "^3.0.0", - "magic-string": "^0.30.11", - "zimmerframe": "^1.1.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/svelte/node_modules/magic-string": { - "version": "0.30.21", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", - "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - } - }, - "node_modules/tinyglobby": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", - "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/tslib": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", - "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", - "license": "0BSD", - "optional": true - }, - "node_modules/vite": { - "version": "8.3.8", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.8.tgz", - "integrity": "sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==", - "license": "MIT", - "dependencies": { - "lightningcss": "^1.33.0", - "picomatch": "^4.0.7", - "postcss": "^8.5.32", - "rolldown": "~1.2.18", - "tinyglobby": "^0.2.17" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "@vitejs/devtools": "^0.7.1 || ^0.8.0", - "esbuild": "^0.27.0 || ^0.28.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "@vitejs/devtools": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/vite-plugin-singlefile": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/vite-plugin-singlefile/-/vite-plugin-singlefile-2.3.4.tgz", - "integrity": "sha512-1FAhlTCL6KJDpSUudrVU+gspapvS+tmKCg70vwNaAU6tyXn3E/C6+NnwQIze06byhBRv7VggZ78K0h+J/Rsdrg==", - "license": "MIT", - "dependencies": { - "picomatch": "^4.0.7" - }, - "engines": { - "node": ">18.0.0" - }, - "peerDependencies": { - "rollup": "^4.59.0", - "vite": "^5.4.21 || ^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/vitefu": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", - "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", - "license": "MIT", - "workspaces": [ - "tests/deps/*", - "tests/projects/*", - "tests/projects/workspace/packages/*" - ], - "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "vite": { - "optional": true - } - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "license": "ISC", - "peer": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/zimmerframe": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.5.tgz", - "integrity": "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA==", - "license": "MIT" - }, - "node_modules/zod": { - "version": "4.6.7", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", - "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", - "license": "MIT", - "peer": true, - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - } - } -} diff --git a/crates/rdm-mcp/view/package.json b/crates/rdm-mcp/view/package.json deleted file mode 100644 index 9a9680c..0000000 --- a/crates/rdm-mcp/view/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "rdm-mcp-view", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "build": "vite build && node scripts/check-offline.mjs --size", - "check:offline": "node scripts/check-offline.mjs" - }, - "dependencies": { - "@modelcontextprotocol/ext-apps": "2.0.4", - "@sveltejs/vite-plugin-svelte": "7.3.1", - "svelte": "5.57.3", - "vite": "8.3.8", - "vite-plugin-singlefile": "2.3.4" - } -} diff --git a/crates/rdm-mcp/view/scripts/check-offline.mjs b/crates/rdm-mcp/view/scripts/check-offline.mjs deleted file mode 100644 index 974b700..0000000 --- a/crates/rdm-mcp/view/scripts/check-offline.mjs +++ /dev/null @@ -1,43 +0,0 @@ -// Fails if dist/index.html is not self-contained. -// Usage: node scripts/check-offline.mjs [--size] -import { readFileSync, existsSync } from 'node:fs'; -import { fileURLToPath } from 'node:url'; - -const file = fileURLToPath(new URL('../dist/index.html', import.meta.url)); -if (!existsSync(file)) { - console.error('check:offline FAIL: dist/index.html is missing, run the build first'); - process.exit(1); -} -const html = readFileSync(file, 'utf8'); -console.log(`dist/index.html: ${Buffer.byteLength(html)} bytes`); -if (process.argv.includes('--size')) process.exit(0); - -// Each allowed URL string is exact and justified. Anything else fails. -const ALLOWED_URLS = new Map([ - // Inert identifiers inside bundled zod / JSON-schema code (@modelcontextprotocol/core). None is ever fetched. - ['https://json-schema.org/draft/2019-09/schema', 'JSON Schema $schema identifier'], - ['http://json-schema.org/draft/2019-09/schema', 'JSON Schema $schema identifier'], - ['https://json-schema.org/draft/2020-12/schema', 'JSON Schema $schema identifier'], - ['http://json-schema.org/draft-07/schema#', 'JSON Schema $schema identifier'], - ['http://json-schema.org/draft-04/schema#', 'JSON Schema $schema identifier'], - ['http://[${e}]', 'zod hostname-validation template literal, used to parse an IPv6 host, not to fetch'], - ['https://github.com/cfworker', 'attribution string in the bundled cfworker JSON-schema validator'], - ['https://*.example.com', 'zod doc/example string'], - ['http://www.w3.org/1999/xhtml', 'XHTML namespace constant in the svelte runtime, passed to createElementNS, never fetched'], -]); - -// Allowed by prefix: svelte runtime error messages carry a docs link as text, shown in a thrown Error, never fetched. -const ALLOWED_PREFIXES = [['https://svelte.dev/e/', 'svelte runtime error-message docs links']]; - -const problems = []; -if (/]*\bsrc\s*=/i.test(html)) problems.push(' - -
        -
        - roadmap {view ? `(${view.mode} x${view.scale})` : ''} - {#if view}{nodes.length}/{view.node_count} nodes{/if} - - {#if ran}ran: {ran}{/if} - {#if outline}{/if} -
        - {#if error}

        {error}

        {/if} - {#if !view} -

        {host ? 'waiting for the tool result...' : 'connecting...'}

        - {:else if outline} - - {#if selected}{/if} - {:else} -
        - - -
        - {/if} - -
        - - diff --git a/crates/rdm-mcp/view/src/Diagnostics.svelte b/crates/rdm-mcp/view/src/Diagnostics.svelte deleted file mode 100644 index c03be25..0000000 --- a/crates/rdm-mcp/view/src/Diagnostics.svelte +++ /dev/null @@ -1,75 +0,0 @@ - - -
        - Diagnostics -
        - - {copied} -
        -
        {text}
        -
        - - diff --git a/crates/rdm-mcp/view/src/Graph.svelte b/crates/rdm-mcp/view/src/Graph.svelte deleted file mode 100644 index c3ae510..0000000 --- a/crates/rdm-mcp/view/src/Graph.svelte +++ /dev/null @@ -1,49 +0,0 @@ - - -
        - {#each columns as col, depth} - {#if col} -
        -

        depth {depth}

        - {#each col as n (n.path)} - {#if n.kind === 'dir'} -
        {n.title}
        - {:else} - - {/if} - {/each} -
        - {/if} - {/each} -
        - - diff --git a/crates/rdm-mcp/view/src/LeafPane.svelte b/crates/rdm-mcp/view/src/LeafPane.svelte deleted file mode 100644 index 9dd4795..0000000 --- a/crates/rdm-mcp/view/src/LeafPane.svelte +++ /dev/null @@ -1,32 +0,0 @@ - - - - - diff --git a/crates/rdm-mcp/view/src/Outline.svelte b/crates/rdm-mcp/view/src/Outline.svelte deleted file mode 100644 index a42199d..0000000 --- a/crates/rdm-mcp/view/src/Outline.svelte +++ /dev/null @@ -1,31 +0,0 @@ - - -
          - {#each ordered as n (n.path)} -
        • - {#if n.kind === 'dir'} - {n.title} - {:else} - - {/if} -
        • - {/each} -
        - - diff --git a/crates/rdm-mcp/view/src/bridge.ts b/crates/rdm-mcp/view/src/bridge.ts deleted file mode 100644 index 45e5fa0..0000000 --- a/crates/rdm-mcp/view/src/bridge.ts +++ /dev/null @@ -1,113 +0,0 @@ -// MCP Apps bridge, built on the App class of @modelcontextprotocol/ext-apps. -import { App, PostMessageTransport, LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/ext-apps'; - -export type ToolResultParams = Parameters>[0]; - -export interface HostInfo { - /** Apps protocolVersion this view announced in ui/initialize. */ - protocolAnnounced: string; - /** Apps protocolVersion the host answered with. Not exposed by App, so read from the host reply when available. */ - protocolHost: string | null; - hostCapabilities: unknown; - hostContext: unknown; - hostInfo: unknown; -} - -export const app = new App({ name: 'rdm-graph-view', version: '0.0.0' }, {}, { autoResize: true }); - -/** - * Handshake: ui/initialize, then ui/notifications/initialized (both done by app.connect). - * onToolResult is registered BEFORE connect, as the library requires. - */ -export async function connect( - onToolResult: (p: ToolResultParams) => void, - onHostContext: (ctx: unknown) => void, -): Promise { - app.ontoolresult = onToolResult; - app.onhostcontextchanged = () => onHostContext(app.getHostContext()); - let protocolHost: string | null = null; - const transport = new PostMessageTransport(window.parent, window.parent); - // Observe the host's ui/initialize reply to keep its protocolVersion (App discards it). - window.addEventListener('message', (e) => { - const d = e.data as { result?: { protocolVersion?: string; hostCapabilities?: unknown } } | null; - if (d && d.result && typeof d.result.protocolVersion === 'string' && d.result.hostCapabilities) { - protocolHost = d.result.protocolVersion; - } - }); - await app.connect(transport); - return { - protocolAnnounced: LATEST_PROTOCOL_VERSION, - protocolHost, - hostCapabilities: app.getHostCapabilities(), - hostContext: app.getHostContext(), - hostInfo: app.getHostVersion(), - }; -} - -/** Call a server tool (tools/call) and return its structuredContent, or null. */ -export async function callAppTool(name: string, args: Record = {}): Promise { - try { - const res = await app.callServerTool({ name, arguments: args }); - return (res.structuredContent as T | undefined) ?? null; - } catch (e) { - // Surface, never hide: every failed tool call is kept for the diagnostics panel. - toolErrorListener?.(name, String(e)); - throw e; - } -} - -let toolErrorListener: ((tool: string, text: string) => void) | null = null; -/** The diagnostics panel registers here to see the last error of every failed tool call. */ -export function onToolError(fn: (tool: string, text: string) => void): void { - toolErrorListener = fn; -} - -/** ui/update-model-context, only if the host advertises the updateModelContext capability. */ -export async function sendModelContext(structured: Record): Promise { - const caps = app.getHostCapabilities() as { updateModelContext?: unknown } | undefined; - if (!caps?.updateModelContext) return 'skipped: host does not advertise updateModelContext'; - try { - await app.updateModelContext({ - content: [{ type: 'text', text: JSON.stringify(structured) }], - structuredContent: structured, - }); - return 'ok'; - } catch (e) { - const t = String(e); - toolErrorListener?.('ui/update-model-context', t); - return 'failed: ' + t; - } -} - -/** Ask the host for a display mode (ui/request-display-mode). */ -export async function requestDisplayMode(mode: 'inline' | 'fullscreen' | 'pip'): Promise { - const r = await app.requestDisplayMode({ mode }); - return r.mode; -} - -/** resources/read through the host: app.readServerResource({uri}). Returns the first content's text. */ -export async function readResourceText(uri: string): Promise { - try { - const r = await app.readServerResource({ uri }); - const c = r.contents?.[0] as { text?: string } | undefined; - if (typeof c?.text !== 'string') throw new Error('resource has no text content: ' + uri); - return c.text; - } catch (e) { - toolErrorListener?.('resources/read ' + uri, String(e)); - throw e; - } -} - -/** ui/message: one user chat message, only if the host advertises the message capability. */ -export async function sendChatMessage(text: string): Promise { - const caps = app.getHostCapabilities() as { message?: unknown } | undefined; - if (!caps?.message) return 'skipped: host does not advertise message'; - try { - await app.sendMessage({ role: 'user', content: [{ type: 'text', text }] }); - return 'ok'; - } catch (e) { - const t = String(e); - toolErrorListener?.('ui/message', t); - return 'failed: ' + t; - } -} diff --git a/crates/rdm-mcp/view/src/ingest.ts b/crates/rdm-mcp/view/src/ingest.ts deleted file mode 100644 index ac5a8a5..0000000 --- a/crates/rdm-mcp/view/src/ingest.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { tick } from 'svelte'; -import { readResourceText } from './bridge'; -import type { RoadmapNode, RoadmapView, Stamps } from './types'; - -const nextFrame = () => new Promise((r) => requestAnimationFrame(() => r())); -const utf8 = (s: string) => new TextEncoder().encode(s).length; - -/** Appends nodes and paints in batches: one DOM update per animation frame. */ -class Painter { - all: RoadmapNode[] = []; - pending: RoadmapNode[] = []; - scheduled = false; - firstPainted = false; - constructor( - private setNodes: (n: RoadmapNode[]) => void, - private stamps: Stamps, - ) {} - push(batch: RoadmapNode[]) { - if (!batch.length) return; - if (!this.stamps.t_first_data_ms) this.stamps.t_first_data_ms = Date.now(); - this.pending.push(...batch); - this.stamps.nodes_received += batch.length; - if (!this.scheduled) { - this.scheduled = true; - requestAnimationFrame(() => { - this.scheduled = false; - this.all = this.all.concat(this.pending); - this.pending = []; - this.setNodes(this.all); - if (!this.firstPainted) { - this.firstPainted = true; - // The rAF after Svelte has rendered the first nodes. - void tick().then(() => requestAnimationFrame(() => (this.stamps.t_first_paint_ms = Date.now()))); - } - }); - } - } - /** Resolves after the rAF that follows the render of the last node. */ - async finish() { - while (this.pending.length || this.scheduled) await nextFrame(); - await tick(); - await nextFrame(); - this.stamps.t_complete_ms = Date.now(); - } -} - -/** - * Ingest by mode. Stamps are written into `stamps` as they happen. - * Throws with the verbatim error text on a read or network failure. - */ -export async function ingest( - sc: RoadmapView, - stamps: Stamps, - setNodes: (n: RoadmapNode[]) => void, -): Promise { - const painter = new Painter(setNodes, stamps); - if (sc.mode === 'result' || sc.mode === 'meta') { - stamps.bytes_received = utf8(JSON.stringify(sc.nodes ?? [])); - painter.push(sc.nodes ?? []); - } else if (sc.mode === 'chunks') { - const tpl = sc.chunk_uri_template ?? ''; - // Chunks are numbered from 0 (the contract does not say; see report). - for (let n = 0; n < (sc.chunk_count ?? 0); n++) { - const uri = tpl.replace('{n}', String(n)).replace(/scale=S\b/, `scale=${sc.scale}`); - const text = await readResourceText(uri); - stamps.bytes_received += utf8(text); - painter.push((JSON.parse(text) as { nodes: RoadmapNode[] }).nodes); - } - } else if (sc.mode === 'stream') { - await new Promise((resolve, reject) => { - let violation = ''; - const onViolation = (e: SecurityPolicyViolationEvent) => { - violation = `CSP violation: ${e.violatedDirective} blocked ${e.blockedURI}`; - }; - document.addEventListener('securitypolicyviolation', onViolation); - const es = new EventSource(sc.stream_url ?? ''); - let done = false; - es.onmessage = (e) => { - stamps.bytes_received += utf8(e.data); - painter.push([JSON.parse(e.data) as RoadmapNode]); - }; - es.addEventListener('done', () => { - done = true; - es.close(); - document.removeEventListener('securitypolicyviolation', onViolation); - resolve(); - }); - es.onerror = () => { - if (done) return; - es.close(); - document.removeEventListener('securitypolicyviolation', onViolation); - // Verbatim: EventSource exposes no text, so give everything the page knows. - reject(new Error(`EventSource error on ${sc.stream_url} (readyState ${es.readyState})${violation ? '; ' + violation : ''}`)); - }; - }); - } else { - throw new Error('unknown mode: ' + String((sc as { mode?: unknown }).mode)); - } - await painter.finish(); -} diff --git a/crates/rdm-mcp/view/src/main.ts b/crates/rdm-mcp/view/src/main.ts deleted file mode 100644 index 3fcb539..0000000 --- a/crates/rdm-mcp/view/src/main.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { mount } from 'svelte'; -import App from './App.svelte'; - -mount(App, { target: document.getElementById('app')! }); diff --git a/crates/rdm-mcp/view/src/probe.ts b/crates/rdm-mcp/view/src/probe.ts deleted file mode 100644 index 4358de0..0000000 --- a/crates/rdm-mcp/view/src/probe.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { HostInfo } from './bridge'; -import type { RoadmapView, Stamps } from './types'; - -export function runKind(): 'cold' | 'warm' | 'unknown' { - const v = new URLSearchParams(window.location.search).get('run'); - return v === 'cold' || v === 'warm' ? v : 'unknown'; -} - -// postMessage cannot clone Proxy objects; send plain JSON. -function plain(v: unknown): unknown { - return v === undefined ? null : JSON.parse(JSON.stringify(v)); -} - -/** The probe object. host_context is left out on purpose: it is large and recorded elsewhere. */ -export function buildProbe( - view: RoadmapView, - stamps: Stamps, - host: HostInfo, - displayMode: string, - leafRead: unknown, -) { - return { - run_kind: runKind(), - mode: view.mode, - scale: view.scale, - node_count: view.node_count, - payload_bytes: view.payload_bytes, - t_server_ms: view.t_server_ms, - ...plain(stamps) as object, - apps_protocol_announced: host.protocolAnnounced, - apps_protocol_host: host.protocolHost ?? 'unknown', - display_mode: displayMode, - leaf_read: leafRead, - host_capabilities: plain(host.hostCapabilities), - }; -} - -/** One single-line chat message: RDM_PROBE followed by compact JSON. */ -export function probeLine(probe: object): string { - return 'RDM_PROBE ' + JSON.stringify(probe); -} diff --git a/crates/rdm-mcp/view/src/types.ts b/crates/rdm-mcp/view/src/types.ts deleted file mode 100644 index 2e94fb3..0000000 --- a/crates/rdm-mcp/view/src/types.ts +++ /dev/null @@ -1,46 +0,0 @@ -export type Status = 'planned' | 'inprogress' | 'done' | 'amendment' | 'blocked'; - -export interface RoadmapNode { - path: string; - parent: string | null; - kind: 'leaf' | 'dir'; - title: string; - status: Status; - depth: number; - /** Present only in result mode at scale 1. */ - markdown?: string; -} - -export type Mode = 'result' | 'chunks' | 'stream' | 'meta'; - -/** structuredContent of roadmap_view (round 2 contract). nodes is present in result mode only. */ -export interface RoadmapView { - campaign?: string; - mode: Mode; - scale: number; - t_server_ms: number; - payload_bytes: number; - node_count: number; - nodes?: RoadmapNode[]; - chunk_count?: number; - chunk_uri_template?: string; - stream_url?: string; -} - -export interface Stamps { - t_result_ms: number; - t_first_data_ms: number; - t_first_paint_ms: number; - t_complete_ms: number; - bytes_received: number; - nodes_received: number; -} - -/** The five legacy classDef colours of the roadmap READMEs. */ -export const STATUS_COLORS: Record = { - done: { fill: '#166534', color: '#bbf7d0' }, - inprogress: { fill: '#854d0e', color: '#fef08a' }, - planned: { fill: '#374151', color: '#e5e7eb' }, - amendment: { fill: '#1e3a5f', color: '#bfdbfe' }, - blocked: { fill: '#7f1d1d', color: '#fecaca' }, -}; diff --git a/crates/rdm-mcp/view/vite.config.ts b/crates/rdm-mcp/view/vite.config.ts deleted file mode 100644 index d335bfe..0000000 --- a/crates/rdm-mcp/view/vite.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite'; -import { svelte } from '@sveltejs/vite-plugin-svelte'; -import { viteSingleFile } from 'vite-plugin-singlefile'; - -// One self-contained dist/index.html: every script and style is inlined. -export default defineConfig({ - plugins: [svelte(), viteSingleFile()], - build: { - assetsInlineLimit: Number.MAX_SAFE_INTEGER, - cssCodeSplit: false, - modulePreload: false, - }, -}); From a73b07b4467efbc4b60bc900309b9a7005c54db8 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Thu, 26 Nov 2026 00:28:07 +0900 Subject: [PATCH 178/183] test(rdm-engine): the reverse-index proptest reads the campaign once per step The step helper classified each candidate node with its own `read()`, and every read revalidates every file of the campaign, so each step was quadratic in the campaign's size. One read per step takes the case from 73 ms to 45 ms (macOS, debug). The guard still goes red when a delete leaves the reverse index alone. Co-Authored-By: Claude Opus 5.5 --- crates/rdm-engine/tests/store.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/rdm-engine/tests/store.rs b/crates/rdm-engine/tests/store.rs index 9056124..d1e53c3 100644 --- a/crates/rdm-engine/tests/store.rs +++ b/crates/rdm-engine/tests/store.rs @@ -1668,7 +1668,10 @@ mod reverse { let pick = |x: u8| ids[x as usize % ids.len()].clone(); let number = |id: &NodeId| (1..400).find(|n| nid(*n) == *id).unwrap_or(0); let (kind, a, b) = step; - let mut of = |id: &NodeId| store.read().unwrap().campaign().get(id).cloned(); + // One read per step: each read revalidates every file, so a read per candidate made + // the case quadratic in the campaign's size. + let campaign = store.read().unwrap().campaign().clone(); + let of = |id: &NodeId| campaign.get(id).cloned(); let leaves: Vec = ids .iter() .filter(|i| matches!(of(i), Some(Node::Leaf(_)))) From 513bfddd4ace24e8900b2b157cdf164b8fc95552 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Thu, 26 Nov 2026 00:31:25 +0900 Subject: [PATCH 179/183] docs(reports): record the rdm read path's cost and open its redesign The M1 soak could not finish on Windows: every read stats every file of the campaign, history included, and a cold open processes 12.4 MB/s. The findings read the soak, a profile and the M1 cache probe as throughput; the open question sets the constraints, four options and the measurement that must come before any redesign. Co-Authored-By: Claude Opus 5.5 --- .../00-findings_read_path_v0.md | 131 ++++++++++++++++++ .../00-open_question_read_path_v0.md | 98 +++++++++++++ .../rdm_read_path_efficiency/README.md | 20 +++ 3 files changed, 249 insertions(+) create mode 100644 __reports__/rdm_read_path_efficiency/00-findings_read_path_v0.md create mode 100644 __reports__/rdm_read_path_efficiency/00-open_question_read_path_v0.md create mode 100644 __reports__/rdm_read_path_efficiency/README.md diff --git a/__reports__/rdm_read_path_efficiency/00-findings_read_path_v0.md b/__reports__/rdm_read_path_efficiency/00-findings_read_path_v0.md new file mode 100644 index 0000000..e94a9b6 --- /dev/null +++ b/__reports__/rdm_read_path_efficiency/00-findings_read_path_v0.md @@ -0,0 +1,131 @@ +# rdm read path: findings (v0) + +Date: 2026-11-26 + +--- +type: findings +topic: rdm_read_path_efficiency +date: 2026-11-26 +version: v0 +prior-version: none +key-metric: cold-open throughput: 12.4 MB/s (prior: N/A, delta: N/A) +decision-required: intervene +--- + +## Headline Result + +metric: campaign bytes a cold `open` processes per second (1 600 nodes, 1.68 MB, release build, macOS) +value: 12.4 +unit: MB/s +prior: N/A (first measurement framed as throughput) +direction: new + +The store moves campaign data at about 12 MB/s cold, and every warm read pays one `stat` per file of the +campaign, history included. The M1 soak could not finish on Windows within 45 minutes. Eliott warned during the +architecture setup that reading JSON files would be expensive; the coordinator argued it would not matter and +never measured the claim against agent throughput. This report records what the numbers show. + +## Results Tables + +### Soak run 45621003595 at 813e42f (`PROPTEST_CASES=10000`, `RDM_SOAK_ITERS=1000`) + +| Job | `store` test binary | Kill harness | Job | +|:--|--:|--:|:--| +| ubuntu-latest | 702 s | 95 s | success | +| macos-latest | 1 127 s | 139 s | success | +| windows-latest | not finished at the cap | 100 s | cancelled at `timeout-minutes: 45` | + +In the `store` binary, `reverse_index_equals_brute_force_scan` takes nearly all the time: 240 cases take 17.4 s +locally, and the other 28 tests take about 1 s. + +### Where one proptest case spends its time (macOS `sample`, debug build, 8 s) + +| Part | Share of the test thread | What it is | +|:--|--:|:--| +| Test helper: one `store.read()` per candidate node | about 40 % | each read revalidates every file (test defect, fixed in a73b07b) | +| Cold `open` after each step | about 17 % | the oracle "a cold build agrees" | +| The six store writes | about 13 % | intent, publish, amendment, directory syncs | +| Brute-force scan and `held()` reads | about 9 % | the oracle, plus a revalidation | +| Set-up, tear-down, proptest | about 20 % | temporary campaigns created and removed per case | +| **System calls, after the helper fix** | **80 %** | `open` alone 28 %; decode and hash under 20 % | + +### Experiments (240 cases, local; each was reverted except the first) + +| Change | Time | Per case | +|:--|--:|--:| +| As committed at 6bf8b92 | 17.4 s | 73 ms | +| Helper reads once per step (a73b07b) | 10.9 s | 45 ms | +| plus `RACY_WINDOW` cut from 2 s to 20 ms | 10.1 s | 42 ms | +| plus dependencies built at `opt-level = 2` | 9.8 s | 41 ms | + +### The M1 cache probe, read as throughput (`01-cache_probe_v0.md`, release, macOS) + +| Measure | 160 nodes, 320 files, 163 KB | 1 600 nodes, 3 200 files, 1.68 MB | +|:--|--:|--:| +| Cold open | 12.6 ms: 12.9 MB/s, 39 µs per file | 135 ms: 12.4 MB/s, 42 µs per file | +| Warm read (aged) | 1.34 ms: 4.2 µs per file | 15.1 ms: 4.7 µs per file | +| Reads per second for the whole server (one read mutex) | about 750 | about 66 | + +## Observations + +| Signal | Baseline / Expected | Observed [source] | Interpretation | +|:--|:--|:--|:--| +| Warm read cost | Bounded by what a call needs (one node: nanoseconds) | One `stat` per file of the campaign, nodes, comments and every amendment [source: `cache.rs:237` `sync_kind`, `01-cache_probe_v0.md`] | Read cost grows with campaign size and with history. History only grows: every write adds an amendment. | +| Amendment revalidation | Amendments and comments are append-only, never edited (`store.md` §Layout) | Stat-ed, and re-read when racy, on every read [source: profile, `load_file` under `CachedCampaign::read`] | Wasted work that grows with history. | +| Server throughput | Many agents in parallel against one campaign | `read` takes `&mut self` behind one mutex [source: `cache.rs:600-611`]: 66 reads/s at 1 600 nodes | Agents queue behind each other; per-read cost becomes the fleet's rate limit. | +| Cold throughput | Data processing at disk or parser speed | 12.4 MB/s, flat across 10x size [source: probe] | Per-file overhead (`open`, `stat`, `read`, `close`, hash, decode) dominates, not bytes. Not yet split by stage. | +| `rev` computation | One hash over the canonical bytes | Profile shows `rev` via `to_value` then `to_string_pretty` of the `Value` [source: sample, `rev::rev` → `codec::json_text`] | Encodes each record twice to hash it; to be measured in isolation. | +| Windows | Same algorithm, same order of time | The open-heavy test exceeds the cap; the process-heavy kill harness runs at Linux speed (100 s vs 95 s) [source: CI logs] | Per-file `open` is costlier on Windows (NTFS, real-time scanning of temporary directories), so per-file algorithms hurt most there. | + +## Charts & Visualizations + +Test job duration at soak counts, per OS (seconds, build included; the Windows bar is a lower bound, cut by the +45-minute cap with the `store` binary unfinished): + +``` +ubuntu ████████████████▉ 896 +macOS ██████████████████████████▋ 1407 +windows ███████████████████████████████████████▶ >2 700 + 0 500 1000 1500 2000 2500 s +``` + +Warm read cost against campaign files (release, macOS, minimum of four runs): linear, about 4.5 µs per file. + +``` +ms +15 | ● 1 600 nodes (3 200 files): 15.1 ms + | + 1 | ● 160 nodes (320 files): 1.34 ms + +----------------------------------------------- files stat-ed per read + 320 3 200 +``` + +## Contradictions & Surprises + +- The probe that should have caught this did measure it: 15 ms per read at 1 600 nodes, linear in files. Its + decision weighed that against "a tool call" for one agent, not against a fleet of agents behind one mutex, nor + against history growth, and it ran on a machine at load average 20 to 108 on 12 cores. +- The racy window (2 s) and the debug build together explain under 10 % of the time. The cost is per-file system + calls, not parsing. +- A single-node read costs the same as revalidating the whole campaign. + +## Steering Questions + +- [now] Merge M1 with the Windows soak recorded as a known limit of this implementation (Eliott, 2026-11-26), and + open a dedicated efficiency milestone before M2 builds on the read path? +- [now] Is the metric set right: MB/s for cold load and decode, files/s for revalidation, latency per operation + kind, reads/s for the shared handle, each at 160, 1 600 and 16 000 nodes and at 0x and 10x history, on all + three OS? +- [next run] Instrumented profiling of the hot paths (spans per stage: list, stat, read, hash, decode, build, index) + on an idle machine and on the three CI runners, before choosing any redesign. +- [later] Does history stay in per-write amendment files, or does its storage form change (it is tracked text that + git merges, so this is a format question)? + +## Pointers + +- `__reports__/rdm_read_path_efficiency/00-open_question_read_path_v0.md` +- `__reports__/m1-core-foundation/01-cache_probe_v0.md` +- `__reports__/m1-core-foundation/02-sustainability_review_src_v0.md` (S1, S2, S13) +- https://github.com/CrackingShells/cracking-shells-playbook/actions/runs/45621003595 +- `crates/rdm-engine/src/cache.rs` (`sync_kind`, `load_file`, `RACY_WINDOW`, `CachedCampaign::read`) +- commit a73b07b (the test helper fix) diff --git a/__reports__/rdm_read_path_efficiency/00-open_question_read_path_v0.md b/__reports__/rdm_read_path_efficiency/00-open_question_read_path_v0.md new file mode 100644 index 0000000..064509b --- /dev/null +++ b/__reports__/rdm_read_path_efficiency/00-open_question_read_path_v0.md @@ -0,0 +1,98 @@ +# rdm read path: open question (v0) + +Date: 2026-11-26 + +--- +type: open-question +question: How must rdm store, read, revalidate and process campaign data so an agent's call costs what it touches, not the whole campaign and its history? +domain: code +date-opened: 2026-11-26 +status: open +spawned-from: __reports__/rdm_read_path_efficiency/00-findings_read_path_v0.md (M1 soak cancelled on Windows) +closure-type: both +--- + +## The Question + +How should rdm read, revalidate and process campaign data so that a call's cost follows what it touches, not campaign size and history? + +## Handoff Contract + +- Receiving agent is asked to: build the measurement first (throughput benchmarks and instrumented profiles of + every hot path, on three OS), produce the numbers, then an architecture report that chooses a design from them. +- Receiving agent must NOT: change the stored format, the store's guarantees (I3, I4, I10, I12) or any public + signature before Eliott approves the architecture report; nor tune constants (racy window, opt-level) as a fix. + +## Context + +What M1 built and what it costs (release build, macOS, from `01-cache_probe_v0.md` and the findings report): + +| Path | Algorithm today | Cost grows with | Measured | +|:--|:--|:--|:--| +| Cold `open` | list three directories; `open`, `read`, SHA-256 and decode every file; build campaign, reverse index, op index | files | 12.4 MB/s; 42 µs per file | +| Warm `read` (every tool call) | list three directories; `stat` every file; re-read and hash files younger than 2 s | files, history included | 4.5 µs per file: 15 ms at 1 600 nodes | +| Single-node read | the full warm read, then a map lookup | files | same as warm read; lookup 22 ns | +| Write | refresh, re-read touched nodes, clone whole campaign and plan (S1), intent, publish, amendment, directory syncs | nodes (clone and plan), touched files (I/O) | about 1 ms of syncs per edit; the rest unmeasured | +| Shared handle | `read(&mut self)` behind one mutex (S2, S13) | concurrent agents | 66 reads/s at 1 600 nodes for the whole server | +| `rev` | `to_value`, then pretty-print the `Value`, then SHA-256 | record size | not isolated yet | + +What is fixed and must hold for any design: + +| Constraint | Source | +|:--|:--| +| Tracked campaign data stays text that git merges; a binary form may only be an untracked cache | `00-gap_analysis_v0.md`, plan rulings 2026-11-25 | +| A cached read equals a cold read for every external change class (I10), including in-place same-size edits within one mtime tick | `__design__/rdm/store.md` §Cache | +| Amendments and comments are append-only, never edited; a new write adds a new file | `__design__/rdm/store.md` §Layout (line 31), `stored-schema.md` (line 77) | +| MSRV 1.88; macOS, Linux and Windows | `rust.yml` | +| Many agents share one machine and one campaign | `~/.claude/CLAUDE.md`, "You are never alone" | + +## Option Landscape + +### Option A — Revalidate immutable records by name only +- Description: amendments (and any other append-only record) are checked by the set of names a directory lists, not by a `stat` per file. +- Benefit: warm read cost stops growing with history. +- Cost: an in-place edit of an amendment is no longer seen; I10's wording narrows to "every change a real actor makes". +- Unknown: whether any real actor rewrites an amendment in place (a merge, a rebase, a hand fix). + +### Option B — Change notifications with the stat walk as fallback +- Description: a watcher (FSEvents, inotify, ReadDirectoryChangesW) marks changed paths; a read revalidates only those. +- Benefit: warm read cost follows what changed, not what exists. +- Cost: three OS back-ends, event overflow and lost-event handling, a dependency, and a test harness for each. +- Unknown: whether events arrive reliably for `git checkout` bursts and for network or synced folders. + +### Option C — A cheaper unit of storage for history +- Description: history stored as fewer, larger text files (for example one append-only file per period) instead of one file per write. +- Benefit: fewer files to list, open and hash, on every path and every OS. +- Cost: a format change (version layer), and appends that git must merge on every branch. +- Unknown: how git merges concurrent appends to the same history file from two worktrees. + +### Option D — Faster per-file processing +- Description: one pass per file (read, hash the bytes, decode typed without an intermediate `Value`), `rev` from bytes already canonical. +- Benefit: raises MB/s on cold open and on every re-read, with no format or guarantee change. +- Cost: touches the codec and `rev`, which the drift and jq-hex oracles guard. +- Unknown: the share of the 42 µs per file that is decode and hash rather than system calls. + +## Comparison + +| Option | Reach (which paths gain) | Format change | Guarantee change | Per-OS work | Cost to learn more | +|:--|:--|:--|:--|:--|:--| +| A | warm read | no | I10 wording | none | low: count real actors that edit amendments | +| B | warm read, write refresh | no | none if the fallback is exact | high | medium: prototype on three runners | +| C | all paths | yes | none | none | medium: merge trials in two worktrees | +| D | cold open, re-reads, `rev` | no | none | none | low: the stage-split profile | + +*What this table does not settle:* the size of each gain. Without a per-stage profile (list, stat, open, read, +hash, decode, build, index) and throughput figures per OS, the options cannot be ranked, and they are not +exclusive. + +## What Would Close This Question + +[Both]: a benchmark suite that reports MB/s, files/s, per-operation latency and reads/s at 160, 1 600 and 16 000 +nodes, with 0x and 10x history, on macOS, Linux and Windows. Also an instrumented per-stage profile of each hot +path. Then an architecture report choosing the design from those numbers, approved by Eliott. The question closes +when the soak runs on all three OS within the job's existing cap. + +## Next Step to Reduce Uncertainty + +Build the measurement: a benchmark crate or target with byte and file throughput, and span-level instrumentation +of `open`, `read`, `write` and `rev`, run once on an idle machine and on the three CI runners. diff --git a/__reports__/rdm_read_path_efficiency/README.md b/__reports__/rdm_read_path_efficiency/README.md new file mode 100644 index 0000000..7c33946 --- /dev/null +++ b/__reports__/rdm_read_path_efficiency/README.md @@ -0,0 +1,20 @@ +# rdm read path efficiency + +How fast rdm reads, revalidates and processes a campaign, and the redesign that makes a call cost what it touches. +Opened when the M1 soak could not finish on Windows within 45 minutes (2026-11-26). + +## Documents + +### Round 00 (2026-11-26) + +- [00-findings_read_path_v0.md](00-findings_read_path_v0.md) (latest): what the soak, the profile and the M1 + cache probe show, read as throughput. +- [00-open_question_read_path_v0.md](00-open_question_read_path_v0.md) (latest): the question, the constraints, four + options and the measurement that must come first. + +## Status + +Open. M1 merges with this as a known limit of its implementation (Eliott, 2026-11-26). Before any redesign comes +the measurement: throughput benchmarks (MB/s, files/s, per-operation latency, reads/s) and instrumented +per-stage profiles on macOS, Linux and Windows. This supersedes the "no cost anyone will see" reading in +`__reports__/m1-core-foundation/01-cache_probe_v0.md`. From 5293171050dee2a1234adddd53461da3b60337cb Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Thu, 26 Nov 2026 00:31:25 +0900 Subject: [PATCH 180/183] docs(reports): close out the m1 review with the Windows soak as a known limit The adversarial review records the soak run and names the Windows soak as a gate not met; Eliott ruled that M1 merges with it recorded. The knowledge transfer carries S2 to the read-path redesign and records how the cost of reading JSON was dismissed. Co-Authored-By: Claude Opus 5.5 --- .../02-adversarial_review_v0.md | 71 ++++++++++++++++ .../04-knowledge_transfer_v0.md | 81 +++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 __reports__/m1-core-foundation/02-adversarial_review_v0.md create mode 100644 __reports__/m1-core-foundation/04-knowledge_transfer_v0.md diff --git a/__reports__/m1-core-foundation/02-adversarial_review_v0.md b/__reports__/m1-core-foundation/02-adversarial_review_v0.md new file mode 100644 index 0000000..dec4e84 --- /dev/null +++ b/__reports__/m1-core-foundation/02-adversarial_review_v0.md @@ -0,0 +1,71 @@ +# M1 adversarial review (d6), v0 + +Verdict: the cornerstone guards catch the bugs they name, wherever a mutation was run, and the before-main findings of +every review are fixed on `feat/m1-core-foundation`. Two cornerstone guards (I7, I12) have no recorded mutation: +Eliott ruled on 2026-11-25 that the mutation checks run so far are enough and asked for an open review instead. + +## How the review was run + +The leaf planned one fresh verifier injecting each guard's named mutation. It ran as a sequence instead, each step by +fresh Sonnet agents briefed to assume something was wrong: + +| Round | Agents | Report | Outcome | +|:--|:--|:--|:--| +| Per-leaf verifiers | one per risky leaf | the leaf files' "verifier's fix round" gates | fixes landed per leaf | +| Sustainability review | 2 reviewers (src, tests) | `02-sustainability_review_{src,tests}_v0.md` | S3, S4, S5, S7, S8, S11, T1-T5, T7, T10 fixed (merges 162de9b, a0ae710) | +| Full review | 2 reviewers (harmony, safety) | `03-full_review_{harmony,safety}_v0.md` | before-main items fixed (merge 813e42f), verified by a fresh agent | + +Eliott (2026-11-25): "I think you have already run the mutation checks enough. I am more interested in the open hunt +for full safety", which replaced a second mutation pass with the full review's two lenses. + +## Cornerstone guards: mutation and result + +| Invariant | Guard | Mutation | Red? | Where recorded | +|:--|:--|:--|:--|:--| +| I3 | `every_write_prefix_loads_and_recovers_to_pre_or_post` | node files removed before the amendment is written | yes | `crash_test.md` gate | +| I3 | `killed_workers_lose_no_acknowledged_write` | lock released between the revision check and the write | yes | `crash_test.md` gate | +| I4 | `stale_replace_changes_nothing` (two-row table) | a write judges the touched files against the cache, not the disk | yes | `02-sustainability_review_tests_v0.md`, seen-red script | +| I7 | `move_writes_one_file_and_keeps_ids` | none recorded | not shown | gap, covered by Eliott's ruling | +| I10 | `cached_read_equals_cold_read` | revalidation by directory mtime alone; signature ignoring identity, size or mtime | yes | `hot_cache.md` gate; seen-red script | +| I10 | `write_through_visible_to_cold_reader_on_return` | buffered write | yes | `hot_cache.md` gate | +| I12 | `unknown_keys_survive_in_place_at_every_level` | none recorded | not shown | gap; the safety review read it as sound, and found a separate I12 breach (sS6, integers beyond 64 bits), deferred to M2 | +| Links | `reverse_index_equals_brute_force_scan` | reverse-index update on delete removed | 3 of 3 | `03-full_review_safety_v0.md` | +| Version | `newer_file_refused_before_parsing` | decoder parsing the whole struct first | yes, per the leaf's step | `codec_and_versions.md` step 1, in the implementer's hand-back only | +| C28 | `requests_breaking_a_rule_are_refused`, step and directory rows | step-reference check commented out; directory check skipped | yes | fix round 66372fc | +| S2 (store.md) | `create_on_a_volume_without_hard_links_publishes_and_still_refuses_a_taken_name` | fallback removed; fallback without the absent check | yes (re-run by the verifier) | fix round 80380bc | + +## Leaf gates against what was built; relaxed rules + +The per-leaf verifiers and the two full-review lenses checked each leaf's gates as written. Rules found relaxed and +fixed: step references unchecked (sS1); the hard-link fallback promised by `store.md` but missing (sS2); four silent +serialisation fallbacks (H2); opening a missing root creating a directory tree. None remain open before main. + +## Fixtures and seams + +- Fixtures come from real producers: hand-written canonical files, the store's own writes and their prefixes, and + real-actor transformations (CRLF checkout, `git merge-file`, `jq -S`, `touch -r`, rename-over, `git checkout`). The + test sustainability round culled the cache rows shaped by mutants rather than by actors. +- Seams: `rev` is computed once (codec helpers) and compared by store and cache; `RecordingFs` and `RealFs` share one + `Fs` trait and one effect-apply routine; `StoreError` and its constructors live in rdm-schema and both crates use + them. + +## Deferred, with milestone + +Carried in `04-knowledge_transfer_v0.md`: H6, H11-H14; sS3-sS9 except the items fixed; S1, S2, S6, S9, S10, S12, S13; +T8, T9; the four nits of the fix-round verifier. + +## CI evidence + +- Push run at 813e42f, every job green (ubuntu, macOS, Windows, MSRV 1.88, lint): + https://github.com/CrackingShells/cracking-shells-playbook/actions/runs/45618278562 +- Soak run at 813e42f (`RDM_SOAK_ITERS=1000`, `PROPTEST_CASES=10000`): ubuntu, macOS, MSRV 1.88 and lint green; + Windows cancelled at the job's 45-minute cap with `reverse_index_equals_brute_force_scan` still running. The + kill harness passed on Windows at full count (100 s). + https://github.com/CrackingShells/cracking-shells-playbook/actions/runs/45621003595 +- **Known limit, not met:** the soak gate on Windows. A test helper read the store once per candidate node (fixed in + a73b07b, 37 % faster), and the store itself stats every file of the campaign, history included, on every read. + Eliott ruled on 2026-11-26 that M1 merges with this recorded as a limit of the implementation and that the read + path is redesigned in its own PR, measured first: `__reports__/rdm_read_path_efficiency/`. +- CRLF probe: a Windows checkout with `core.autocrlf=true` did rewrite committed JSON (the schema drift guard went red + on Windows at d9331cd). `.gitattributes` now pins `eol=lf` on the test fixtures and the committed schemas, and the + CI step `git ls-files --eol` prints the fixtures' line ends on every run. diff --git a/__reports__/m1-core-foundation/04-knowledge_transfer_v0.md b/__reports__/m1-core-foundation/04-knowledge_transfer_v0.md new file mode 100644 index 0000000..f94f09d --- /dev/null +++ b/__reports__/m1-core-foundation/04-knowledge_transfer_v0.md @@ -0,0 +1,81 @@ +# M1 core foundation: knowledge transfer, v0 + +M1 froze the contracts in `rdm-schema` and built the store in `rdm-engine`, on `feat/m1-core-foundation`: +- flat `nodes/.json` files; +- a canonical codec and a version chain that refuses newer files; +- ordered writes with a redo-only intent record and recovery under the lock; +- a revalidated hot cache behind one public handle, `CachedCampaign`. + +Every gate in the campaign README holds but one: the soak does not finish on Windows within 45 minutes. The +three-OS matrix, MSRV 1.88 and lint are green, and the soak is green on Linux and macOS (CI evidence in +`02-adversarial_review_v0.md`). Eliott ruled on 2026-11-26 that M1 merges with that limit recorded, and that the +read path is redesigned in its own PR (`__reports__/rdm_read_path_efficiency/`). The milestone is not yet on +`main`: landing it is Step 2 of the M1 leaf, and `FORMAT_VERSION` stays `0.1.0` until then (ruling R5). + +## What worked + +- **Independent oracles.** jq plus SHA-256 for `rev`, a fresh cold `open` for the cache, a brute-force scan for the + reverse index, the prefix-or-full state for crashes, and `statuses.md` parsed for `MOVES`. Every guard that was + mutated went red. +- **Depth as ordering.** Siblings ran in parallel worktrees, and each level merged `--no-ff` after a fresh verifier. +- **Open reviews late.** The two full-review lenses (harmony, safety) found real defects the mutation passes could + not: unchecked step references, a fallback the design promised and the code lacked, and four silent serialisation + fallbacks. + +## What hurt, and the change for M2 + +| Pain | Cost | Change | +|:--|:--|:--| +| Verifiers added a test row per surviving mutant | about 500 lines of cache tests, culled later | Triage survivors by real actor and class before briefing; a mutant is never a row | +| Agents re-read big files and dumped cargo output | up to 300k tokens per leaf | Fresh agent per round; reads by line range; filtered cargo output; batched calls; a tool-call cap in every brief | +| A temp worktree built into the shared target dir | rdm-schema tests ran with stale `CARGO_MANIFEST_DIR` paths | A worktree at another path gets its own target, or `cargo clean -p ` afterwards | +| Windows only seen at push time | three red rounds: backslash snapshot keys, jq CRLF output, autocrlf on committed schemas | `--no-fail-fast` on CI; `.gitattributes` `eol=lf` on every committed JSON that a test compares byte for byte | +| Helpers forked per test file | each cross-cutting fix had to be made 3-4 times | One `tests/common` from the start of M2 | +| Eliott's warning that reading JSON files would be expensive was answered by argument, and the cache probe judged 15 ms per read at 1 600 nodes against one tool call, on a machine at load 20-108 | the soak could not finish on Windows; the read path needs its own redesign PR | A performance claim is a measurement: throughput (MB/s, files/s, reads/s) and a per-stage profile, at 10x the expected size and with history, on an idle machine and the three CI runners, judged against a fleet of agents | + +## Carried forward + +### To M2 (graph engine) + +| Id | Item | Source | +|:--|:--|:--| +| S1 | Whole-campaign clone and O(N) plan and derive per write | `02-sustainability_review_src_v0.md` | +| S9 | ULIDs round-trip through `String` | same | +| S10 | `write.rs` (about 1700 lines) to split by concern | same | +| S12 | "Move" means a status transition and a reparent (`Move`, `move_node`, `op_relocate`) | same, H14 | +| H6 | `Version` is a tuple alias with free functions; one newtype | `03-full_review_harmony_v0.md` | +| H11 | Three hand-written newtype shapes (about 90 duplicated lines) | same | +| H12, H13 | Ownership in signatures, `# Errors` sections, small idioms | same | +| sS3 | Four JSON walkers do not follow `LINKS`; one `introduced_links` | `03-full_review_safety_v0.md` | +| sS4 | No test injects an `Io` error mid-apply; `let _ = self.refresh()` at write.rs | same | +| sS5 | Replay returns the current `rev` and never compares the request payload | same | +| sS6 | Unknown integers beyond 64 bits are rewritten as floats (breaks I12) | same | +| sS9 | Non-`.json` names silently ignored; stale `holder.json` after a kill | same | +| T8 | One red row hides the rest in multi-row tests | `02-sustainability_review_tests_v0.md` | +| T9 | `crash_prefix` copies the whole tree per prefix | same | +| `op_id` | M2 chooses the `op_id`, sets `History.op_id`, and owns the directory `uncancel` lookup; the store owns replay (R4) | `00-gap_analysis_v0.md` §4 | +| Nits | `OpResult` is `#[non_exhaustive]` but mirrors the closed `Op`; `debug_assert!` on the decode at write.rs:905; the hard-link fallback replaces a dangling symlink | fix-round verifier | +| `RecordPath` | The logical-path newtype | sustainability round A | + +### To M4 (MCP server) + +| Id | Item | Source | +|:--|:--|:--| +| S2 | O(N) revalidation per read, history included, single read mutex: moved to the read-path redesign PR, before M2 | `02-sustainability_review_src_v0.md`, `__reports__/rdm_read_path_efficiency/` | +| S13 | Synchronous API and sleep-poll lock in an async server | same | +| sS7 | `diagnostics()` serialises every node per call; `tree_rev` rehashed per receipt | `03-full_review_safety_v0.md` | +| sS8 | A refused recovery wedges writes; a `discard_intent` tool may be wanted (the error now names the intent file) | same | +| F8 (F-d) | Typed ids in the read model | earlier design review, `settle` | +| `rdm-mcp` | The M0 spike was deleted at M1 (6bf8b92); its `rmcp` wiring and Svelte bridge are at 58a4a30 | M4 and M6 leaves | +| `rmcp` pin | Moves from M0 to M4 with the crate | meta README ownership line | + +## Owner decisions taken during M1 + +Recorded in the leaf gates and `__design__/rdm/{store,contracts}.md`: R1-R6 and F-c "refuse all" (Eliott). +The coordinator decided these within those rulings, and Eliott has not yet confirmed them: +- the root-family exemption; +- a rename of a sound root is refused; +- `op_id_reused`; +- the `Current` change; +- the cycle-member delete rule; +- the reading of the expected slug. From 825ea5da34ecbeed13ce6e43da829c9052dcc959 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Thu, 26 Nov 2026 00:31:25 +0900 Subject: [PATCH 181/183] chore(roadmap): mark the m1-core-foundation campaign done Every level's gates are checked, the Windows soak with its recorded limit. The meta-roadmap's M2 and M4 leaves link the M1 knowledge transfer, and its ownership line names where the deleted spike's rmcp pin went. Co-Authored-By: Claude Opus 5.5 --- __roadmap__/m1-core-foundation/README.md | 14 +++++++------- __roadmap__/m1-core-foundation/settle/README.md | 6 +++--- .../m1-core-foundation/settle/build/README.md | 8 ++++---- .../settle/build/codec/README.md | 6 +++--- .../settle/build/codec/store/README.md | 8 ++++---- .../settle/build/codec/store/harden/README.md | 4 ++-- .../build/codec/store/harden/verify/README.md | 6 +++--- .../store/harden/verify/adversarial_review.md | 14 +++++++------- __roadmap__/roadmap-mcp-rework/README.md | 2 +- __roadmap__/roadmap-mcp-rework/core/README.md | 4 ++-- .../engine/interchange/consumers/m4_mcp_server.md | 2 +- .../core/engine/m2_graph_engine.md | 2 +- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/__roadmap__/m1-core-foundation/README.md b/__roadmap__/m1-core-foundation/README.md index a92c57e..66b1d29 100644 --- a/__roadmap__/m1-core-foundation/README.md +++ b/__roadmap__/m1-core-foundation/README.md @@ -19,11 +19,11 @@ Milestone M1 of the rdm meta-roadmap (`__roadmap__/roadmap-mcp-rework/core/m1_co ## Success Gates - ✅ Eliott has reviewed `__design__/rdm/store.md` and `__design__/rdm/contracts.md`, and R01 matches them in the same merge -- ⬜ `cargo test --workspace --locked` and `cargo +1.88 check --workspace --locked` pass on `feat/m1-core-foundation` -- ⬜ The three-OS CI matrix (macOS, Linux, Windows) and the MSRV job are green on `feat/m1-core-foundation`, soak included -- ⬜ `! cargo test --workspace -- --list 2>/dev/null | grep confirm_` passes: no confirm is left -- ⬜ Every leaf's guards were seen red before green, each with its named bug, as recorded in the leaf reports and checked by `settle/build/codec/store/harden/verify/adversarial_review.md` -- ⬜ The rescoped gates of the M1 leaf hold: contracts, version refusal, I3, I4, I7, I10, I12, declared links +- ✅ `cargo test --workspace --locked` and `cargo +1.88 check --workspace --locked` pass on `feat/m1-core-foundation` +- ✅ The three-OS CI matrix (macOS, Linux, Windows) and the MSRV job are green on `feat/m1-core-foundation`, soak included (**not met for the Windows soak**, cancelled at the 45-minute cap; Eliott ruled on 2026-11-26 that M1 merges with this recorded as a limit, and the read path is redesigned in its own PR: `__reports__/rdm_read_path_efficiency/`) +- ✅ `! cargo test --workspace -- --list 2>/dev/null | grep confirm_` passes: no confirm is left +- ✅ Every leaf's guards were seen red before green, each with its named bug, as recorded in the leaf reports and checked by `settle/build/codec/store/harden/verify/adversarial_review.md` (I7 and I12 have no recorded mutation; Eliott ruled the mutation checks sufficient, 2026-11-25) +- ✅ The rescoped gates of the M1 leaf hold: contracts, version refusal, I3, I4, I7, I10, I12, declared links ## Gotchas - **Rulings (Eliott, 2026-11-25), not to be reopened by an implementer:** flat `nodes/.json` with `name`, `parent_id`, an order key, and depth computed from `parent_id`; Rust types are the contract and JSON is derived; a version chain of responsibility; a file newer than the binary is refused with `NewerFormat`; declared links, never a stored value derivable from an id; tracked data stays text; the cache is never the source of truth. A leaf that finds one of these wrong reports it as a finding. **Review rulings (Eliott, 2026-11-25, reply 5):** every newer file is refused, a higher X or a higher Y; unknown keys survive and each one yields an `unknown_key` diagnostic; `open` refuses per-file faults but loads and loudly reports cross-file merge damage, anchored on the root named by the expected slug, and refuses writes that build on an unvalidated node except repairs; `op_id` replay is the store's; `FORMAT_VERSION` stays `0.1.0` until M1 merges to `main`; `Reference.target` is relative to the root and `Change` holds no paths. @@ -55,7 +55,7 @@ Milestone M1 of the rdm meta-roadmap (`__roadmap__/roadmap-mcp-rework/core/m1_co graph TD store_design[Store design]:::done contracts_design[Contracts design]:::done - settle[Settle]:::inprogress + settle[Settle]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -68,7 +68,7 @@ graph TD |:-----|:-----|:-------| | `store_design.md` | 📄 Leaf Task | ✅ Done | | `contracts_design.md` | 📄 Leaf Task | ✅ Done | -| `settle/` | 📁 Directory | 🔄 In Progress | +| `settle/` | 📁 Directory | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m1-core-foundation/settle/README.md b/__roadmap__/m1-core-foundation/settle/README.md index 7b1d3c7..2dc5f2e 100644 --- a/__roadmap__/m1-core-foundation/settle/README.md +++ b/__roadmap__/m1-core-foundation/settle/README.md @@ -11,13 +11,13 @@ R01 and `read-model.md` describe the design of `store.md` and `contracts.md`. - [ ] Eliott has reviewed `__design__/rdm/store.md` and `__design__/rdm/contracts.md` ## Success Gates -- ⬜ R01 has no section that contradicts `store.md` or `contracts.md` +- ✅ R01 has no section that contradicts `store.md` or `contracts.md` ## Status ```mermaid graph TD r01_sync[R01 sync]:::done - build[Build]:::inprogress + build[Build]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -29,7 +29,7 @@ graph TD | Node | Type | Status | |:-----|:-----|:-------| | `r01_sync.md` | 📄 Leaf Task | ✅ Done | -| `build/` | 📁 Directory | 🔄 In Progress | +| `build/` | 📁 Directory | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m1-core-foundation/settle/build/README.md b/__roadmap__/m1-core-foundation/settle/build/README.md index a68e913..1a16fb7 100644 --- a/__roadmap__/m1-core-foundation/settle/build/README.md +++ b/__roadmap__/m1-core-foundation/settle/build/README.md @@ -10,8 +10,8 @@ The contracts exist as types, the primitives survive real processes on three ope - [ ] `../r01_sync.md` is done ## Success Gates -- ⬜ `cargo test --workspace --locked` passes after the three merges -- ⬜ Integration review by the coordinator: the error type `fs_primitives` returns is the one `schema_contracts` defines +- ✅ `cargo test --workspace --locked` passes after the three merges +- ✅ Integration review by the coordinator: the error type `fs_primitives` returns is the one `schema_contracts` defines (`StoreError` and its constructors live in rdm-schema, confirmed by `03-full_review_harmony_v0.md`) ## Gotchas - `fs_primitives` needs the error type from `schema_contracts`. Both start together: `fs_primitives` uses a local placeholder error enum with a `TODO(schema_contracts)` comment and switches to the `rdm_schema` type at rebase, before its merge. @@ -22,7 +22,7 @@ graph TD schema_contracts[Schema contracts]:::done fs_primitives[Filesystem primitives]:::done ci_matrix[CI matrix]:::done - codec[Codec]:::inprogress + codec[Codec]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -36,7 +36,7 @@ graph TD | `schema_contracts.md` | 📄 Leaf Task | ✅ Done | | `fs_primitives.md` | 📄 Leaf Task | ✅ Done | | `ci_matrix.md` | 📄 Leaf Task | ✅ Done | -| `codec/` | 📁 Directory | 🔄 In Progress | +| `codec/` | 📁 Directory | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m1-core-foundation/settle/build/codec/README.md b/__roadmap__/m1-core-foundation/settle/build/codec/README.md index 6527e6a..a5ea3f2 100644 --- a/__roadmap__/m1-core-foundation/settle/build/codec/README.md +++ b/__roadmap__/m1-core-foundation/settle/build/codec/README.md @@ -10,7 +10,7 @@ Bytes in and out of a node file are canonical, lossless and version-aware. - [ ] `../schema_contracts.md`, `../fs_primitives.md` and `../ci_matrix.md` are done ## Success Gates -- ⬜ `cargo test --workspace --locked` passes after the merge +- ✅ `cargo test --workspace --locked` passes after the merge ## Gotchas - One implementer builds `codec_and_versions` and then, resumed, `store/campaign_store.md`: the store is the codec's first consumer. @@ -19,7 +19,7 @@ Bytes in and out of a node file are canonical, lossless and version-aware. ```mermaid graph TD codec_and_versions[Codec and versions]:::done - store[Store]:::inprogress + store[Store]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -31,7 +31,7 @@ graph TD | Node | Type | Status | |:-----|:-----|:-------| | `codec_and_versions.md` | 📄 Leaf Task | ✅ Done | -| `store/` | 📁 Directory | 🔄 In Progress | +| `store/` | 📁 Directory | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m1-core-foundation/settle/build/codec/store/README.md b/__roadmap__/m1-core-foundation/settle/build/codec/store/README.md index bfb288d..8f403a0 100644 --- a/__roadmap__/m1-core-foundation/settle/build/codec/store/README.md +++ b/__roadmap__/m1-core-foundation/settle/build/codec/store/README.md @@ -10,14 +10,14 @@ A campaign opens, validates, and changes through ordered, revision-checked write - [ ] `../codec_and_versions.md` is done ## Success Gates -- ⬜ `cargo test --workspace --locked` passes after the merge -- ⬜ Integration review by the coordinator: `rev` is computed from the codec's canonical encoding, the same bytes the cache will compare +- ✅ `cargo test --workspace --locked` passes after the merge +- ✅ Integration review by the coordinator: `rev` is computed from the codec's canonical encoding, the same bytes the cache will compare (one `codec::json_text` path since 813e42f, confirmed by the fix-round verifier) ## Status ```mermaid graph TD campaign_store[Campaign store]:::done - harden[Harden]:::inprogress + harden[Harden]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -29,7 +29,7 @@ graph TD | Node | Type | Status | |:-----|:-----|:-------| | `campaign_store.md` | 📄 Leaf Task | ✅ Done | -| `harden/` | 📁 Directory | 🔄 In Progress | +| `harden/` | 📁 Directory | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/README.md b/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/README.md index 2a61e9c..141a352 100644 --- a/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/README.md +++ b/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/README.md @@ -19,7 +19,7 @@ No kill loses an acknowledged write, and the long-lived process serves reads fro graph TD crash_test[Crash test]:::done hot_cache[Hot cache]:::done - verify[Verify]:::planned + verify[Verify]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -32,7 +32,7 @@ graph TD |:-----|:-----|:-------| | `crash_test.md` | 📄 Leaf Task | ✅ Done | | `hot_cache.md` | 📄 Leaf Task | ✅ Done | -| `verify/` | 📁 Directory | ⬜ Planned | +| `verify/` | 📁 Directory | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/README.md b/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/README.md index d92b002..9734a8f 100644 --- a/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/README.md +++ b/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/README.md @@ -10,12 +10,12 @@ The milestone's guards are shown to catch the bugs they claim, and the three-OS - [ ] `../crash_test.md` and `../hot_cache.md` are done ## Success Gates -- ⬜ Every finding is fixed by the leaf's original implementer or recorded with Eliott's decision +- ✅ Every finding is fixed by the leaf's original implementer or recorded with Eliott's decision (fixes went to fresh implementers per round; the deferred items and Eliott's ruling on mutation checks are in `02-adversarial_review_v0.md` and `04-knowledge_transfer_v0.md`) ## Status ```mermaid graph TD - adversarial_review[Adversarial review]:::planned + adversarial_review[Adversarial review]:::done classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a classDef planned fill:#374151,color:#e5e7eb @@ -26,7 +26,7 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `adversarial_review.md` | 📄 Leaf Task | ⬜ Planned | +| `adversarial_review.md` | 📄 Leaf Task | ✅ Done | ## Amendment Log | ID | Date | Source | Nodes Added | Rationale | diff --git a/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/adversarial_review.md b/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/adversarial_review.md index abddd6d..90a173a 100644 --- a/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/adversarial_review.md +++ b/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/adversarial_review.md @@ -2,14 +2,14 @@ **Goal**: A fresh verifier, briefed to assume something is wrong, attacks the store, lock, intent record and cache for silent data loss and relaxed rules, and the three-OS CI run is recorded. **Pre-conditions**: -- [ ] `../crash_test.md` and `../hot_cache.md` are done -- [ ] Eliott has allowed the push of `feat/m1-core-foundation` +- [x] `../crash_test.md` and `../hot_cache.md` are done +- [x] Eliott has allowed the push of `feat/m1-core-foundation` **Success Gates**: -- ⬜ [static] `__reports__/m1-core-foundation/02-adversarial_review_v0.md` records, for every cornerstone guard (I3, I4, I7, I10, I12, the reverse index, the newer-file refusal), the mutation injected and that the guard went red -- ⬜ [static] The report checks every leaf's gates as written against what was built, and names any rule an implementer relaxed -- ⬜ [static] The report checks that every fixture comes from a real producer, and that the seams hold: `rev` in the store and in the cache, `RecordingFs` and `RealFs` effects, the error type across crates -- ⬜ [run] `! cargo test --workspace -- --list 2>/dev/null | grep confirm_` passes -- ⬜ [static] The CI run on `feat/m1-core-foundation` is green on macOS, Linux and Windows, soak and MSRV included, and its URL is in the report +- ✅ [static] `__reports__/m1-core-foundation/02-adversarial_review_v0.md` records, for every cornerstone guard (I3, I4, I7, I10, I12, the reverse index, the newer-file refusal), the mutation injected and that the guard went red (all but I7 and I12, whose mutations are not recorded; Eliott ruled the checks sufficient, 2026-11-25) +- ✅ [static] The report checks every leaf's gates as written against what was built, and names any rule an implementer relaxed (two sustainability and two full-review lenses; see the report's table) +- ✅ [static] The report checks that every fixture comes from a real producer, and that the seams hold: `rev` in the store and in the cache, `RecordingFs` and `RealFs` effects, the error type across crates +- ✅ [run] `! cargo test --workspace -- --list 2>/dev/null | grep confirm_` passes +- ✅ [static] The CI run on `feat/m1-core-foundation` is green on macOS, Linux and Windows, soak and MSRV included, and its URL is in the report (**not met for the Windows soak**: recorded in the report as a known limit, Eliott 2026-11-26) **References**: [M0b knowledge transfer](../../../../../../../../__reports__/m0b-domain-model-spec/) — verifiers challenge relaxed rules; [campaign README](../../../../../../../../__roadmap__/m1-core-foundation/README.md) — the test design and the mutations each guard names ## Step 1: Attack diff --git a/__roadmap__/roadmap-mcp-rework/README.md b/__roadmap__/roadmap-mcp-rework/README.md index ab3a018..5d5ac4b 100644 --- a/__roadmap__/roadmap-mcp-rework/README.md +++ b/__roadmap__/roadmap-mcp-rework/README.md @@ -25,7 +25,7 @@ The milestone graph for implementing `__design__/rdm/architecture.md`: the `mana ## Gotchas - Depth is ordering, so the tree over-sequences one edge: M6 needs only M4 but also waits on M5. The reminders' `after:` fields keep the exact edges; a milestone may start early on them if Eliott says so. - The consumer rule: `rdm-mcp` and `rdm-cli` hold no roadmap logic. M1 to M3 complete the core before either consumer starts, which is why M4 and M5 can run in parallel. -- Ownership of shared pieces: M0 owns the workspace skeleton and the pinned `rmcp`; M0b owns the schemas, the read model and the status meanings; M1 owns the contracts beyond the stored types (campaign model, move table as data, store operation types, declared links), the id format and minting, the error type and the version chain; M2 owns amendments and diagnostic codes; M4 owns the tool list (R01's table is a suggestion); M6 owns the app-only tool and the built HTML; M7 owns every release and manifest file; M8 owns the skill text and the removal of `dirtree-rdm`. +- Ownership of shared pieces: M0 owns the workspace skeleton; M4 owns the pinned `rmcp` (the M0 spike crate was deleted at M1, 6bf8b92); M0b owns the schemas, the read model and the status meanings; M1 owns the contracts beyond the stored types (campaign model, move table as data, store operation types, declared links), the id format and minting, the error type and the version chain; M2 owns amendments and diagnostic codes; M4 owns the tool list (R01's table is a suggestion); M6 owns the app-only tool and the built HTML; M7 owns every release and manifest file; M8 owns the skill text and the removal of `dirtree-rdm`. - Each milestone leaf has the same three steps: plan (its campaign, approved by Eliott), build and land (on `feat/`, one merge commit on `main`), close out (knowledge-transfer report, this leaf marked `done`, reminder reconciliation proposed). The milestone's own plan decides how the work inside it is run. - Until M8 lands, roadmaps are authored with `bash skills/managing-roadmaps/scripts/dirtree-rdm.sh` from the repository root; leaf paths passed to `add` need the `.md` suffix. From M8 on, with `rdm`. - Environment: Rust with local `cargo` (1.99; MSRV 1.88 from `rmcp`); Node pinned by the M6 plan for the view; Python tooling through `uv`. This machine is shared: one `CARGO_TARGET_DIR` for all agents of a milestone, removed when the milestone lands. diff --git a/__roadmap__/roadmap-mcp-rework/core/README.md b/__roadmap__/roadmap-mcp-rework/core/README.md index 99936b6..d075595 100644 --- a/__roadmap__/roadmap-mcp-rework/core/README.md +++ b/__roadmap__/roadmap-mcp-rework/core/README.md @@ -16,7 +16,7 @@ Depth 1 of the meta-roadmap. Runs after `m0_feasibility_spike`, which proves the ## Status ```mermaid graph TD - m1_core_foundation[M1 Core foundation]:::planned + m1_core_foundation[M1 Core foundation]:::inprogress engine[Engine]:::planned classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a @@ -28,7 +28,7 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `m1_core_foundation.md` | 📄 Leaf Task | ⬜ Planned | +| `m1_core_foundation.md` | 📄 Leaf Task | 🔄 In Progress | | `engine/` | 📁 Directory | ⬜ Planned | ## Amendment Log diff --git a/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/m4_mcp_server.md b/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/m4_mcp_server.md index 7a03821..27fb72d 100644 --- a/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/m4_mcp_server.md +++ b/__roadmap__/roadmap-mcp-rework/core/engine/interchange/consumers/m4_mcp_server.md @@ -10,7 +10,7 @@ - ⬜ An author, execute, amend cycle on a campaign runs from an agent session with no shell call - ⬜ Every tool handler maps to one core call (I2), and every call names its campaign (I10) - ⬜ Tool results stay within a stated size budget on the largest existing campaign -**References**: [R01 §Tool surface (suggestion), §Contracts & Invariants](../../../../../../__design__/rdm/architecture.md) — the suggested tools and the constraints that are fixed; [M0 spike knowledge transfer](../../../../../../__reports__/m0-feasibility-spike/01-knowledge_transfer_v0.md) — the throwaway `crates/rdm-mcp` was deleted at M1; the `rmcp` 3.10 stdio wiring can be read back with `git show 58a4a30:crates/rdm-mcp/…` +**References**: [R01 §Tool surface (suggestion), §Contracts & Invariants](../../../../../../__design__/rdm/architecture.md) — the suggested tools and the constraints that are fixed; [M0 spike knowledge transfer](../../../../../../__reports__/m0-feasibility-spike/01-knowledge_transfer_v0.md) — the throwaway `crates/rdm-mcp` was deleted at M1; the `rmcp` 3.10 stdio wiring can be read back with `git show 58a4a30:crates/rdm-mcp/…`; [M1 knowledge transfer](../../../../../../__reports__/m1-core-foundation/04-knowledge_transfer_v0.md) — the items M1 carried to M4 (§Carried forward) ## Step 1: Plan the milestone diff --git a/__roadmap__/roadmap-mcp-rework/core/engine/m2_graph_engine.md b/__roadmap__/roadmap-mcp-rework/core/engine/m2_graph_engine.md index 8d0c396..111fc99 100644 --- a/__roadmap__/roadmap-mcp-rework/core/engine/m2_graph_engine.md +++ b/__roadmap__/roadmap-mcp-rework/core/engine/m2_graph_engine.md @@ -11,7 +11,7 @@ - ⬜ Every content or structure edit writes exactly one amendment with a non-empty description; status and progress write none (I5) - ⬜ A batch is atomic: a failing operation leaves the campaign untouched, and a dry-run writes nothing - ⬜ `done` is refused while a step lacks its commit (I8); deleting or reopening done work and moving work in progress are refused without an acknowledgement (I9) -**References**: [R01 §Graph operations, §Contracts & Invariants](../../../../__design__/rdm/architecture.md) — validation, order, the status machine, the operations, impact analysis and batch +**References**: [R01 §Graph operations, §Contracts & Invariants](../../../../__design__/rdm/architecture.md) — validation, order, the status machine, the operations, impact analysis and batch; [M1 knowledge transfer](../../../../__reports__/m1-core-foundation/04-knowledge_transfer_v0.md) — the items M1 carried to M2 (§Carried forward) ## Step 1: Plan the milestone From 1f0f9dd5e72dbd4a8aee116ff6569daf58ea9c65 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Thu, 26 Nov 2026 01:10:20 +0900 Subject: [PATCH 182/183] docs(reports): close the m1-core-foundation milestone The M1 leaf of the meta-roadmap is done: its gates hold, with the Windows soak recorded as a known limit (Eliott, 2026-11-26). The adversarial review records the soak at 825ea5d, green on ubuntu, macOS and MSRV; the Windows job was still running at merge time. Co-Authored-By: Claude Opus 5.5 --- .../02-adversarial_review_v0.md | 3 +++ __roadmap__/roadmap-mcp-rework/core/README.md | 4 ++-- .../core/m1_core_foundation.md | 20 +++++++++---------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/__reports__/m1-core-foundation/02-adversarial_review_v0.md b/__reports__/m1-core-foundation/02-adversarial_review_v0.md index dec4e84..80c9307 100644 --- a/__reports__/m1-core-foundation/02-adversarial_review_v0.md +++ b/__reports__/m1-core-foundation/02-adversarial_review_v0.md @@ -66,6 +66,9 @@ T8, T9; the four nits of the fix-round verifier. a73b07b, 37 % faster), and the store itself stats every file of the campaign, history included, on every read. Eliott ruled on 2026-11-26 that M1 merges with this recorded as a limit of the implementation and that the read path is redesigned in its own PR, measured first: `__reports__/rdm_read_path_efficiency/`. +- Soak run at 825ea5d, after the helper fix: ubuntu (17 min 57 s), macOS (17 min 56 s), MSRV 1.88 and lint + green; the Windows job was still running when M1 merged, and its result goes to + `__reports__/rdm_read_path_efficiency/`. https://github.com/CrackingShells/cracking-shells-playbook/actions/runs/45648611166 - CRLF probe: a Windows checkout with `core.autocrlf=true` did rewrite committed JSON (the schema drift guard went red on Windows at d9331cd). `.gitattributes` now pins `eol=lf` on the test fixtures and the committed schemas, and the CI step `git ls-files --eol` prints the fixtures' line ends on every run. diff --git a/__roadmap__/roadmap-mcp-rework/core/README.md b/__roadmap__/roadmap-mcp-rework/core/README.md index d075595..55b4442 100644 --- a/__roadmap__/roadmap-mcp-rework/core/README.md +++ b/__roadmap__/roadmap-mcp-rework/core/README.md @@ -16,7 +16,7 @@ Depth 1 of the meta-roadmap. Runs after `m0_feasibility_spike`, which proves the ## Status ```mermaid graph TD - m1_core_foundation[M1 Core foundation]:::inprogress + m1_core_foundation[M1 Core foundation]:::done engine[Engine]:::planned classDef done fill:#166534,color:#bbf7d0 classDef inprogress fill:#854d0e,color:#fef08a @@ -28,7 +28,7 @@ graph TD ## Nodes | Node | Type | Status | |:-----|:-----|:-------| -| `m1_core_foundation.md` | 📄 Leaf Task | 🔄 In Progress | +| `m1_core_foundation.md` | 📄 Leaf Task | ✅ Done | | `engine/` | 📁 Directory | ⬜ Planned | ## Amendment Log diff --git a/__roadmap__/roadmap-mcp-rework/core/m1_core_foundation.md b/__roadmap__/roadmap-mcp-rework/core/m1_core_foundation.md index 07bb082..fa1a622 100644 --- a/__roadmap__/roadmap-mcp-rework/core/m1_core_foundation.md +++ b/__roadmap__/roadmap-mcp-rework/core/m1_core_foundation.md @@ -2,17 +2,17 @@ **Goal**: `rdm-schema` holds the contracts every layer consumes (stored types, campaign model, move table as data, store operation types, declared links, version chain), and `rdm-engine` stores a campaign as flat, id-addressed JSON files that N processes read without coordination and write without losing or tearing a write, served hot from memory by a long-lived process. **Pre-conditions**: -- [ ] `../m0_feasibility_spike.md` is `done` with a go -- [ ] `../m0b_domain_model_spec.md` is `done` -- [ ] Reminder `skills-rdm-M1` read +- [x] `../m0_feasibility_spike.md` is `done` with a go +- [x] `../m0b_domain_model_spec.md` is `done` +- [x] Reminder `skills-rdm-M1` read **Success Gates**: -- ⬜ `__design__/rdm/store.md` and `__design__/rdm/contracts.md` are reviewed by Eliott, and R01 matches them in the same merge -- ⬜ `rdm-engine` holds no stored or contract type of its own and depends on `rdm-schema`; `MOVES` matches the move table of `statuses.md` and the declared links cover every id field -- ⬜ Every older format version reads through the version chain; a newer one is refused with `NewerFormat` before anything else is parsed -- ⬜ Canonical files round-trip byte for byte, valid non-canonical input re-encodes canonically, and unknown fields survive (I12) -- ⬜ Every write prefix of every store operation loads and recovers to the state before or after it, and a multi-process kill test on macOS, Linux and Windows loses no acknowledged write (I3) -- ⬜ A write presenting a stale revision is refused and changes nothing (I4); a rename or move writes one file and changes no `id` (I7); the reverse link index always equals a full scan -- ⬜ A cached read equals a cold read at that moment for every kind of external change (I10) +- ✅ `__design__/rdm/store.md` and `__design__/rdm/contracts.md` are reviewed by Eliott, and R01 matches them in the same merge +- ✅ `rdm-engine` holds no stored or contract type of its own and depends on `rdm-schema`; `MOVES` matches the move table of `statuses.md` and the declared links cover every id field +- ✅ Every older format version reads through the version chain; a newer one is refused with `NewerFormat` before anything else is parsed +- ✅ Canonical files round-trip byte for byte, valid non-canonical input re-encodes canonically, and unknown fields survive (I12) +- ✅ Every write prefix of every store operation loads and recovers to the state before or after it, and a multi-process kill test on macOS, Linux and Windows loses no acknowledged write (I3) +- ✅ A write presenting a stale revision is refused and changes nothing (I4); a rename or move writes one file and changes no `id` (I7); the reverse link index always equals a full scan +- ✅ A cached read equals a cold read at that moment for every kind of external change (I10) **References**: [R01 §Data Model, §Concurrency, §Contracts & Invariants](../../../__design__/rdm/architecture.md) — superseded where amendment A2 says so; [A2 gap analysis](../../../__reports__/m1-core-foundation/00-gap_analysis_v0.md) — the rulings of 2026-11-25 this leaf implements ## Step 1: Plan the milestone From 5ee6c6f62cf8f7a1b920c9e51fa48e6e83d8ae68 Mon Sep 17 00:00:00 2001 From: Eliott Jacopin Date: Thu, 26 Nov 2026 01:29:20 +0900 Subject: [PATCH 183/183] docs(reports): record the green m1 soak at 825ea5d The soak run at 825ea5d finished green on every job, Windows in 33 min 6 s against its 45-minute cap, so the soak gate holds after the test-helper fix (a73b07b). The reports and gates that called it unmet now say so, and name the thin Windows margin as the read-path cost the redesign PR addresses. Co-Authored-By: Claude Opus 5.5 --- .../02-adversarial_review_v0.md | 15 ++++++++------- .../04-knowledge_transfer_v0.md | 10 +++++----- __reports__/rdm_read_path_efficiency/README.md | 4 +++- __roadmap__/m1-core-foundation/README.md | 2 +- .../store/harden/verify/adversarial_review.md | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/__reports__/m1-core-foundation/02-adversarial_review_v0.md b/__reports__/m1-core-foundation/02-adversarial_review_v0.md index 80c9307..4cd5ece 100644 --- a/__reports__/m1-core-foundation/02-adversarial_review_v0.md +++ b/__reports__/m1-core-foundation/02-adversarial_review_v0.md @@ -62,13 +62,14 @@ T8, T9; the four nits of the fix-round verifier. Windows cancelled at the job's 45-minute cap with `reverse_index_equals_brute_force_scan` still running. The kill harness passed on Windows at full count (100 s). https://github.com/CrackingShells/cracking-shells-playbook/actions/runs/45621003595 -- **Known limit, not met:** the soak gate on Windows. A test helper read the store once per candidate node (fixed in - a73b07b, 37 % faster), and the store itself stats every file of the campaign, history included, on every read. - Eliott ruled on 2026-11-26 that M1 merges with this recorded as a limit of the implementation and that the read - path is redesigned in its own PR, measured first: `__reports__/rdm_read_path_efficiency/`. -- Soak run at 825ea5d, after the helper fix: ubuntu (17 min 57 s), macOS (17 min 56 s), MSRV 1.88 and lint - green; the Windows job was still running when M1 merged, and its result goes to - `__reports__/rdm_read_path_efficiency/`. https://github.com/CrackingShells/cracking-shells-playbook/actions/runs/45648611166 +- Cause of the Windows cancel: a test helper read the store once per candidate node (fixed in a73b07b, 37 % + faster), on a store that stats every file of the campaign, history included, on every read. +- Soak run at 825ea5d, after the helper fix, every job green. Job durations, build included: ubuntu 18 min 37 s, + macOS 17 min 56 s, Windows 33 min 6 s, MSRV 1.88 10 min 27 s. + https://github.com/CrackingShells/cracking-shells-playbook/actions/runs/45648611166 +- **Thin margin:** Windows finishes 12 minutes under its cap, and the cost behind it is the store's read path, not + the test. Eliott ruled on 2026-11-26 that the read path is redesigned in its own PR, measured first: + `__reports__/rdm_read_path_efficiency/`. - CRLF probe: a Windows checkout with `core.autocrlf=true` did rewrite committed JSON (the schema drift guard went red on Windows at d9331cd). `.gitattributes` now pins `eol=lf` on the test fixtures and the committed schemas, and the CI step `git ls-files --eol` prints the fixtures' line ends on every run. diff --git a/__reports__/m1-core-foundation/04-knowledge_transfer_v0.md b/__reports__/m1-core-foundation/04-knowledge_transfer_v0.md index f94f09d..7ad6284 100644 --- a/__reports__/m1-core-foundation/04-knowledge_transfer_v0.md +++ b/__reports__/m1-core-foundation/04-knowledge_transfer_v0.md @@ -6,10 +6,10 @@ M1 froze the contracts in `rdm-schema` and built the store in `rdm-engine`, on ` - ordered writes with a redo-only intent record and recovery under the lock; - a revalidated hot cache behind one public handle, `CachedCampaign`. -Every gate in the campaign README holds but one: the soak does not finish on Windows within 45 minutes. The -three-OS matrix, MSRV 1.88 and lint are green, and the soak is green on Linux and macOS (CI evidence in -`02-adversarial_review_v0.md`). Eliott ruled on 2026-11-26 that M1 merges with that limit recorded, and that the -read path is redesigned in its own PR (`__reports__/rdm_read_path_efficiency/`). The milestone is not yet on +Every gate in the campaign README holds. The three-OS matrix, MSRV 1.88, lint and the soak are green at 825ea5d +(CI evidence in `02-adversarial_review_v0.md`). The Windows soak passed only after a test-helper fix, in 33 minutes +against a 45-minute cap; the cost behind that margin is the store's read path, which Eliott ruled on 2026-11-26 is +redesigned in its own PR (`__reports__/rdm_read_path_efficiency/`). The milestone is not yet on `main`: landing it is Step 2 of the M1 leaf, and `FORMAT_VERSION` stays `0.1.0` until then (ruling R5). ## What worked @@ -31,7 +31,7 @@ read path is redesigned in its own PR (`__reports__/rdm_read_path_efficiency/`). | A temp worktree built into the shared target dir | rdm-schema tests ran with stale `CARGO_MANIFEST_DIR` paths | A worktree at another path gets its own target, or `cargo clean -p ` afterwards | | Windows only seen at push time | three red rounds: backslash snapshot keys, jq CRLF output, autocrlf on committed schemas | `--no-fail-fast` on CI; `.gitattributes` `eol=lf` on every committed JSON that a test compares byte for byte | | Helpers forked per test file | each cross-cutting fix had to be made 3-4 times | One `tests/common` from the start of M2 | -| Eliott's warning that reading JSON files would be expensive was answered by argument, and the cache probe judged 15 ms per read at 1 600 nodes against one tool call, on a machine at load 20-108 | the soak could not finish on Windows; the read path needs its own redesign PR | A performance claim is a measurement: throughput (MB/s, files/s, reads/s) and a per-stage profile, at 10x the expected size and with history, on an idle machine and the three CI runners, judged against a fleet of agents | +| Eliott's warning that reading JSON files would be expensive was answered by argument, and the cache probe judged 15 ms per read at 1 600 nodes against one tool call, on a machine at load 20-108 | the soak could not finish on Windows until a test-helper fix, and still takes 33 of its 45 minutes there; the read path needs its own redesign PR | A performance claim is a measurement: throughput (MB/s, files/s, reads/s) and a per-stage profile, at 10x the expected size and with history, on an idle machine and the three CI runners, judged against a fleet of agents | ## Carried forward diff --git a/__reports__/rdm_read_path_efficiency/README.md b/__reports__/rdm_read_path_efficiency/README.md index 7c33946..f699dcc 100644 --- a/__reports__/rdm_read_path_efficiency/README.md +++ b/__reports__/rdm_read_path_efficiency/README.md @@ -14,7 +14,9 @@ Opened when the M1 soak could not finish on Windows within 45 minutes (2026-11-2 ## Status -Open. M1 merges with this as a known limit of its implementation (Eliott, 2026-11-26). Before any redesign comes +Open. M1 merges with this as a limit of its implementation (Eliott, 2026-11-26). After the test-helper fix +(a73b07b) the M1 soak passes at 825ea5d, Windows in 33 min 6 s against a 45-minute cap (run 45648611166); the +store's cost per read is unchanged. Before any redesign comes the measurement: throughput benchmarks (MB/s, files/s, per-operation latency, reads/s) and instrumented per-stage profiles on macOS, Linux and Windows. This supersedes the "no cost anyone will see" reading in `__reports__/m1-core-foundation/01-cache_probe_v0.md`. diff --git a/__roadmap__/m1-core-foundation/README.md b/__roadmap__/m1-core-foundation/README.md index 66b1d29..7fc1625 100644 --- a/__roadmap__/m1-core-foundation/README.md +++ b/__roadmap__/m1-core-foundation/README.md @@ -20,7 +20,7 @@ Milestone M1 of the rdm meta-roadmap (`__roadmap__/roadmap-mcp-rework/core/m1_co ## Success Gates - ✅ Eliott has reviewed `__design__/rdm/store.md` and `__design__/rdm/contracts.md`, and R01 matches them in the same merge - ✅ `cargo test --workspace --locked` and `cargo +1.88 check --workspace --locked` pass on `feat/m1-core-foundation` -- ✅ The three-OS CI matrix (macOS, Linux, Windows) and the MSRV job are green on `feat/m1-core-foundation`, soak included (**not met for the Windows soak**, cancelled at the 45-minute cap; Eliott ruled on 2026-11-26 that M1 merges with this recorded as a limit, and the read path is redesigned in its own PR: `__reports__/rdm_read_path_efficiency/`) +- ✅ The three-OS CI matrix (macOS, Linux, Windows) and the MSRV job are green on `feat/m1-core-foundation`, soak included (met at 825ea5d after the test-helper fix a73b07b, Windows in 33 min 6 s of its 45-minute cap; the read path behind that margin is redesigned in its own PR (Eliott, 2026-11-26): `__reports__/rdm_read_path_efficiency/`) - ✅ `! cargo test --workspace -- --list 2>/dev/null | grep confirm_` passes: no confirm is left - ✅ Every leaf's guards were seen red before green, each with its named bug, as recorded in the leaf reports and checked by `settle/build/codec/store/harden/verify/adversarial_review.md` (I7 and I12 have no recorded mutation; Eliott ruled the mutation checks sufficient, 2026-11-25) - ✅ The rescoped gates of the M1 leaf hold: contracts, version refusal, I3, I4, I7, I10, I12, declared links diff --git a/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/adversarial_review.md b/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/adversarial_review.md index 90a173a..cd909d7 100644 --- a/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/adversarial_review.md +++ b/__roadmap__/m1-core-foundation/settle/build/codec/store/harden/verify/adversarial_review.md @@ -9,7 +9,7 @@ - ✅ [static] The report checks every leaf's gates as written against what was built, and names any rule an implementer relaxed (two sustainability and two full-review lenses; see the report's table) - ✅ [static] The report checks that every fixture comes from a real producer, and that the seams hold: `rev` in the store and in the cache, `RecordingFs` and `RealFs` effects, the error type across crates - ✅ [run] `! cargo test --workspace -- --list 2>/dev/null | grep confirm_` passes -- ✅ [static] The CI run on `feat/m1-core-foundation` is green on macOS, Linux and Windows, soak and MSRV included, and its URL is in the report (**not met for the Windows soak**: recorded in the report as a known limit, Eliott 2026-11-26) +- ✅ [static] The CI run on `feat/m1-core-foundation` is green on macOS, Linux and Windows, soak and MSRV included, and its URL is in the report (met at 825ea5d after the test-helper fix a73b07b, Windows in 33 min 6 s of its 45-minute cap; the read path behind that margin is redesigned in its own PR (Eliott, 2026-11-26): `__reports__/rdm_read_path_efficiency/`) **References**: [M0b knowledge transfer](../../../../../../../../__reports__/m0b-domain-model-spec/) — verifiers challenge relaxed rules; [campaign README](../../../../../../../../__roadmap__/m1-core-foundation/README.md) — the test design and the mutations each guard names ## Step 1: Attack