diff --git a/pkgs/id/ARCHITECTURE.md b/pkgs/id/ARCHITECTURE.md index 14706c18ec..b83c382f88 100644 --- a/pkgs/id/ARCHITECTURE.md +++ b/pkgs/id/ARCHITECTURE.md @@ -37,16 +37,16 @@ Crates in `pkgs/id/crates/` and the root `id` package, classified by dependents (checked against `Cargo.toml` and a repo-wide grep; no `id-*` crate is consumed outside `pkgs/id/`). -| Crate | Classification | Notes | -|-------|----------------|-------| -| `id` (root, `src/`) | Public surface | The only crate whose `lib.rs` re-exports the API; the CLI and binaries build on it. | -| `id-core` | Public surface (shared core) | Depended on by 10 crates. The root re-exports a subset (`abuse`, `access`, `connectivity`, `discovery`, `frames`, `holders`, `membership`, `rejection`, `residency`, `sync_method`, `tuple`, `waiting`, plus `KEY_FILE`, `CLIENT_KEY_FILE`, `SERVE_LOCK`, `is_node_id`). Modules not re-exported by `id` are internal to the workspace. | -| `id-caps`, `id-store`, `id-events`, `id-groups`, `id-sync`, `id-worlds`, `id-directory`, `id-web` | Internal | Used only by sibling crates and the root. | -| `id-cli` | Internal (binary) | Only the root depends on it. | -| `id-config` | Internal | Only the root depends on it. | -| `id-currency-registry` | Internal | Only the root depends on it. | -| `id-native-shell`, `id-hw-shell` | Internal (app) | Workspace members, but not default members; no dependents. | -| `id-render`, `id-import-notion` | Internal, no dependents | Candidates for removal or for documenting as unused. | +| Crate | Classification | Notes | +| ------------------------------------------------------------------------------------------------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` (root, `src/`) | Public surface | The only crate whose `lib.rs` re-exports the API; the CLI and binaries build on it. | +| `id-core` | Public surface (shared core) | Depended on by 10 crates. The root re-exports a subset (`abuse`, `access`, `connectivity`, `discovery`, `frames`, `holders`, `membership`, `rejection`, `residency`, `sync_method`, `tuple`, `waiting`, plus `KEY_FILE`, `CLIENT_KEY_FILE`, `SERVE_LOCK`, `is_node_id`). Modules not re-exported by `id` are internal to the workspace. | +| `id-caps`, `id-store`, `id-events`, `id-groups`, `id-sync`, `id-worlds`, `id-directory`, `id-web` | Internal | Used only by sibling crates and the root. | +| `id-cli` | Internal (binary) | Only the root depends on it. | +| `id-config` | Internal | Only the root depends on it. | +| `id-currency-registry` | Internal | Only the root depends on it. | +| `id-native-shell`, `id-hw-shell` | Internal (app) | Workspace members, but not default members; no dependents. | +| `id-render`, `id-import-notion` | Internal, no dependents | Candidates for removal or for documenting as unused. | Standalone examples and benchmarks (`examples/`, `benchmarks`) are not public API. Vendored crates (`vendor/p2panda-sync`, `vendor/p2panda-encryption`) diff --git a/pkgs/id/README.md b/pkgs/id/README.md index ad36038f3e..e384348130 100644 --- a/pkgs/id/README.md +++ b/pkgs/id/README.md @@ -262,7 +262,7 @@ it is — a valid world capability, minted by the host's admin with | `migrate-tags` | `migrate` | Add name/file auto-tags to existing files | | `id` | | Print local node public ID | | `key` | | Export or import a passphrase-wrapped identity key | -| `keyset` | | Show or change the identity's admin and device keys | +| `keyset` | | Show or change the identity's admin and device keys | | `peers` | | Discover and list known peers | | `world` | | Mint invites for, and join, multiplayer worlds | | `gallery` | | Administer a program gallery directory | diff --git a/pkgs/id/WEB.md b/pkgs/id/WEB.md index 05a3ccf906..daea6d2738 100644 --- a/pkgs/id/WEB.md +++ b/pkgs/id/WEB.md @@ -276,87 +276,87 @@ program-only router (one listener pinned to one world) registers 10 more. ### Pages -| Route | Method | Description | -| --------------------------------------- | ------ | --------------------------------------------------------- | -| `/` | GET | Index / home: world list, tagged documents, global chat | -| `/.well-known/id-transport-advertisement` | GET | Transport advertisement document | -| `/files` | GET | File browser page | -| `/world` | GET | World page (the hosted world's adapter surface) | -| `/settings` | GET | Settings page | -| `/peers` | GET | Discovered peers (auto-refreshes) | -| `/blocks` | GET | Operator block-list page | -| `/groups` | GET | Groups page | -| `/edit/{*name}` | GET | Editor/viewer for a file by name (wildcard) | -| `/hash/{hash}` | GET | Redirect from a content hash to its named file | -| `/view/{*name}` | GET | Read-only view of a file by name | -| `/blob/{hash}` | GET | Raw blob content with Content-Type | +| Route | Method | Description | +| ----------------------------------------- | ------ | ------------------------------------------------------- | +| `/` | GET | Index / home: world list, tagged documents, global chat | +| `/.well-known/id-transport-advertisement` | GET | Transport advertisement document | +| `/files` | GET | File browser page | +| `/world` | GET | World page (the hosted world's adapter surface) | +| `/settings` | GET | Settings page | +| `/peers` | GET | Discovered peers (auto-refreshes) | +| `/blocks` | GET | Operator block-list page | +| `/groups` | GET | Groups page | +| `/edit/{*name}` | GET | Editor/viewer for a file by name (wildcard) | +| `/hash/{hash}` | GET | Redirect from a content hash to its named file | +| `/view/{*name}` | GET | Read-only view of a file by name | +| `/blob/{hash}` | GET | Raw blob content with Content-Type | ### HTTP API and partials -| Route | Method | Description | -| ----------------------- | ------------- | --------------------------------------------------------- | -| `/api/files` | GET | File list (HTML partial) | -| `/api/home/feed` | GET | Home feed partial | -| `/api/peers` | GET | Peers partial | -| `/api/blocks` | GET, POST | List blocks / create a block | -| `/api/blocks/remove` | POST | Remove a block | -| `/api/save` | POST | Save file content | -| `/api/new` | POST | Create new file | -| `/api/rename` | POST | Rename file (with optional archive) | -| `/api/copy` | POST | Copy file to new name | -| `/api/files/send` | POST | Send file to another server (server-side transfer, #5346) | -| `/api/download` | POST | Download file content | -| `/api/delete` | POST | Soft-delete file | -| `/api/restore` | POST | Restore deleted file (404 if missing, 409 if not deleted) | -| `/api/hard-delete` | POST | Permanently delete file | -| `/api/upload` | POST | Image upload (multipart, route-scoped body limit) | -| `/api/images` | GET | Image listing, paged | -| `/api/tags` | GET | Get tags for a file | -| `/api/tags` | POST | Set a tag | -| `/api/tags` | DELETE | Delete a tag | -| `/api/tags/search` | GET | Search tags | -| `/api/identity/register` | POST | Register a web client identity | -| `/api/identity/me` | GET | The current identity | -| `/api/identity/name` | POST | Update the identity display name | -| `/api/seitan/invite` | POST | Seitan admission: create an invite | -| `/api/seitan/admit` | POST | Seitan admission: admit with an invite | -| `/assets/{*path}` | GET | Static assets | +| Route | Method | Description | +| ------------------------ | --------- | --------------------------------------------------------- | +| `/api/files` | GET | File list (HTML partial) | +| `/api/home/feed` | GET | Home feed partial | +| `/api/peers` | GET | Peers partial | +| `/api/blocks` | GET, POST | List blocks / create a block | +| `/api/blocks/remove` | POST | Remove a block | +| `/api/save` | POST | Save file content | +| `/api/new` | POST | Create new file | +| `/api/rename` | POST | Rename file (with optional archive) | +| `/api/copy` | POST | Copy file to new name | +| `/api/files/send` | POST | Send file to another server (server-side transfer, #5346) | +| `/api/download` | POST | Download file content | +| `/api/delete` | POST | Soft-delete file | +| `/api/restore` | POST | Restore deleted file (404 if missing, 409 if not deleted) | +| `/api/hard-delete` | POST | Permanently delete file | +| `/api/upload` | POST | Image upload (multipart, route-scoped body limit) | +| `/api/images` | GET | Image listing, paged | +| `/api/tags` | GET | Get tags for a file | +| `/api/tags` | POST | Set a tag | +| `/api/tags` | DELETE | Delete a tag | +| `/api/tags/search` | GET | Search tags | +| `/api/identity/register` | POST | Register a web client identity | +| `/api/identity/me` | GET | The current identity | +| `/api/identity/name` | POST | Update the identity display name | +| `/api/seitan/invite` | POST | Seitan admission: create an invite | +| `/api/seitan/admit` | POST | Seitan admission: admit with an invite | +| `/assets/{*path}` | GET | Static assets | ### World bridge -| Route | Method | Description | -| ----------------------- | --------- | --------------------------------------------------------- | -| `/api/world/invite` | POST | Mint a world guest invite | -| `/api/world/host-view` | GET | Host view: snapshot, surface, and paged records | -| `/api/world/metrics` | GET | World host metrics | -| `/api/world/directory` | GET, POST | Directory read / signed directory write action | -| `/explore` | GET | Script-free HTML directory explorer (forms only) | -| `/explore/login` | POST | Explorer login (admin token for the `id_explore` cookie) | -| `/explore/act` | POST | Explorer directory action | -| `/invite` | GET | Invite landing page | -| `/ws/world` | WS | World session bridge (default socket path) | +| Route | Method | Description | +| ---------------------- | --------- | -------------------------------------------------------- | +| `/api/world/invite` | POST | Mint a world guest invite | +| `/api/world/host-view` | GET | Host view: snapshot, surface, and paged records | +| `/api/world/metrics` | GET | World host metrics | +| `/api/world/directory` | GET, POST | Directory read / signed directory write action | +| `/explore` | GET | Script-free HTML directory explorer (forms only) | +| `/explore/login` | POST | Explorer login (admin token for the `id_explore` cookie) | +| `/explore/act` | POST | Explorer directory action | +| `/invite` | GET | Invite landing page | +| `/ws/world` | WS | World session bridge (default socket path) | ### Program gallery Every gallery route answers 404 unless a gallery was wired in with `--gallery-dir` or `ID_GALLERY_DIR`. -| Route | Method | Description | -| ------------------------------------- | ------ | ---------------------------------------------------- | -| `/api/gallery/records` | GET | Signed bundle records list | -| `/api/gallery/bundles/{content_hash}` | GET | Bundle bytes, immutable cache | -| `/api/gallery/search` | GET | Search bundles | -| `/api/gallery/authors/{author}` | GET | Author page by key | -| `/api/gallery/collections` | GET | Operator-signed featured collections | -| `/api/gallery/collections/{operator}/{name}` | GET | One collection | -| `/api/gallery/transparency` | GET | Removals, refusals and reinstatements | +| Route | Method | Description | +| -------------------------------------------- | ------ | ------------------------------------- | +| `/api/gallery/records` | GET | Signed bundle records list | +| `/api/gallery/bundles/{content_hash}` | GET | Bundle bytes, immutable cache | +| `/api/gallery/search` | GET | Search bundles | +| `/api/gallery/authors/{author}` | GET | Author page by key | +| `/api/gallery/collections` | GET | Operator-signed featured collections | +| `/api/gallery/collections/{operator}/{name}` | GET | One collection | +| `/api/gallery/transparency` | GET | Removals, refusals and reinstatements | ### WebSocket -| Route | Method | Description | -| --------------------- | ------ | --------------------------------------------------------- | -| `/ws/collab/{doc_id}` | WS | Collaboration WebSocket | -| `/ws/tags` | WS | Tag change broadcast | +| Route | Method | Description | +| --------------------- | ------ | ----------------------- | +| `/ws/collab/{doc_id}` | WS | Collaboration WebSocket | +| `/ws/tags` | WS | Tag change broadcast | ## Configuration diff --git a/pkgs/id/benches/BASELINES.md b/pkgs/id/benches/BASELINES.md index 7645135999..3b7edf25e9 100644 --- a/pkgs/id/benches/BASELINES.md +++ b/pkgs/id/benches/BASELINES.md @@ -426,8 +426,8 @@ are diagnostic and do not add to the combined percentile, as with storage service. This is the #557 disease in a second form: there, actor tasks -*parked* workers on a blocking journal wait (fixed by -`block_in_place`, #12499); here, guest execution *burns* workers +_parked_ workers on a blocking journal wait (fixed by +`block_in_place`, #12499); here, guest execution _burns_ workers with CPU-bound synchronous calls, so the remedy is placement, not unparking — guest calls must run where they cannot starve the runtime (dedicated execution threads or a bounded blocking pool), diff --git a/pkgs/id/benchmarks/src/adapters/turso.rs b/pkgs/id/benchmarks/src/adapters/turso.rs index cd60cf87e7..527ee5e99d 100644 --- a/pkgs/id/benchmarks/src/adapters/turso.rs +++ b/pkgs/id/benchmarks/src/adapters/turso.rs @@ -57,8 +57,8 @@ //! - `sync_state`: the single-row sync state capture above. use crate::{content_id, physical_key}; -use rusqlite::{params, Connection, OptionalExtension}; -use serde_json::{json, Value}; +use rusqlite::{Connection, OptionalExtension, params}; +use serde_json::{Value, json}; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicU64, Ordering}; diff --git a/pkgs/id/benchmarks/tests/turso_adapter.rs b/pkgs/id/benchmarks/tests/turso_adapter.rs index 2e59ccd055..cc5216bf60 100644 --- a/pkgs/id/benchmarks/tests/turso_adapter.rs +++ b/pkgs/id/benchmarks/tests/turso_adapter.rs @@ -23,8 +23,8 @@ //! //! Run: `cargo test --manifest-path pkgs/id/benchmarks/Cargo.toml --test turso_adapter` -use id_benchmarks::adapters::turso::{TursoStore, NETWORK_LOCAL_ONLY}; -use id_benchmarks::{content_id, support_level, ReferenceStore}; +use id_benchmarks::adapters::turso::{NETWORK_LOCAL_ONLY, TursoStore}; +use id_benchmarks::{ReferenceStore, content_id, support_level}; use serde_json::Value; use std::collections::BTreeMap; use std::path::PathBuf; diff --git a/pkgs/id/book/concepts/architecture.md b/pkgs/id/book/concepts/architecture.md index 0bb66af1da..62ae8c37be 100644 --- a/pkgs/id/book/concepts/architecture.md +++ b/pkgs/id/book/concepts/architecture.md @@ -16,25 +16,25 @@ The split history is recorded in the crate doc headers. The code was one crate a Dependency direction is one-way. `id-core` depends on nothing in the workspace and everything depends on it. The full production edge list, from the library survey §0: -| Crate | Owns | Depends on | -|---|---|---| -| `id-core` | Foundation leaves: hashes, frames, tuple encoding, canonical CBOR, discovery, membership, signed envelopes, the graph record model | nothing | -| `id-caps` | Capability catalog, execution limits, the declarative world manifest | `id-core` | -| `id-store` | Blob store, the signed event-header chain, documents, tags, tag claims, search | `id-core` | -| `id-events` | Event store, group projection and fold, writer sets, sync gating | `id-core`, `id-store` | -| `id-groups` | Group policy and enforcement remainder: blob gate, group encryption, group actions and log | `id-core`, `id-events`, `id-store` | -| `id-sync` | Log sync, the meta protocol wire half, file operations, envelopes, signed artifacts, transfer, federation | `id-core`, `id-events`, `id-store` | -| `id-directory` | Home-server directory, views, auth, mail, invites, seitan admission, keysets and recovery | `id-caps`, `id-core`, `id-events`, `id-sync` | -| `id-worlds` | World runtime, sessions, the wasmtime sandbox, the shell contract, program bundles and gallery | `id-caps`, `id-core`, `id-directory`, `id-events`, `id-groups`, `id-store`, `id-sync` | -| `id-web` | HTTP and WebSocket server, routes, templates, markdown, collaborative editing | `id-caps`, `id-core`, `id-directory`, `id-events`, `id-groups`, `id-store`, `id-sync`, `id-worlds` | -| `id-cli` | The application layer: argument parsing, subcommand implementations, the REPL, server config | `id-caps`, `id-core`, `id-directory`, `id-events`, `id-groups`, `id-store`, `id-sync`, `id-worlds`, optional `id-web` | -| `id` (facade) | The public surface, the `id` binary entry point, and the 26 facade-owned modules | `id-caps`, `id-cli`, `id-core`, `id-currency-registry`, `id-directory`, `id-events`, `id-groups`, `id-store`, `id-sync`, `id-worlds`, optional `id-web` | -| `id-config` | The versioned configuration contract: the V2 `ConfigDocument`, hard invariants, the deterministic resolver | nothing; no production crate depends on it | -| `id-currency-registry` | Currency control-plane registry: the ledger-u32 allocator, currency and account records | nothing | -| `id-render` | Rendering pipeline compiler core: parse, validate, compose, lower, emit | nothing; no dependents | -| `id-import-notion` | Notion importer manifest and inventory primitives | nothing; no dependents | -| `id-native-shell` | Bevy native reference shell for the shell contract | the facade, with features `["world"]` | -| `id-hw-shell` | ESP32-class hardware shell spike: presence, journal head, confirm/act | the facade, with features `["world"]` | +| Crate | Owns | Depends on | +| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id-core` | Foundation leaves: hashes, frames, tuple encoding, canonical CBOR, discovery, membership, signed envelopes, the graph record model | nothing | +| `id-caps` | Capability catalog, execution limits, the declarative world manifest | `id-core` | +| `id-store` | Blob store, the signed event-header chain, documents, tags, tag claims, search | `id-core` | +| `id-events` | Event store, group projection and fold, writer sets, sync gating | `id-core`, `id-store` | +| `id-groups` | Group policy and enforcement remainder: blob gate, group encryption, group actions and log | `id-core`, `id-events`, `id-store` | +| `id-sync` | Log sync, the meta protocol wire half, file operations, envelopes, signed artifacts, transfer, federation | `id-core`, `id-events`, `id-store` | +| `id-directory` | Home-server directory, views, auth, mail, invites, seitan admission, keysets and recovery | `id-caps`, `id-core`, `id-events`, `id-sync` | +| `id-worlds` | World runtime, sessions, the wasmtime sandbox, the shell contract, program bundles and gallery | `id-caps`, `id-core`, `id-directory`, `id-events`, `id-groups`, `id-store`, `id-sync` | +| `id-web` | HTTP and WebSocket server, routes, templates, markdown, collaborative editing | `id-caps`, `id-core`, `id-directory`, `id-events`, `id-groups`, `id-store`, `id-sync`, `id-worlds` | +| `id-cli` | The application layer: argument parsing, subcommand implementations, the REPL, server config | `id-caps`, `id-core`, `id-directory`, `id-events`, `id-groups`, `id-store`, `id-sync`, `id-worlds`, optional `id-web` | +| `id` (facade) | The public surface, the `id` binary entry point, and the 26 facade-owned modules | `id-caps`, `id-cli`, `id-core`, `id-currency-registry`, `id-directory`, `id-events`, `id-groups`, `id-store`, `id-sync`, `id-worlds`, optional `id-web` | +| `id-config` | The versioned configuration contract: the V2 `ConfigDocument`, hard invariants, the deterministic resolver | nothing; no production crate depends on it | +| `id-currency-registry` | Currency control-plane registry: the ledger-u32 allocator, currency and account records | nothing | +| `id-render` | Rendering pipeline compiler core: parse, validate, compose, lower, emit | nothing; no dependents | +| `id-import-notion` | Notion importer manifest and inventory primitives | nothing; no dependents | +| `id-native-shell` | Bevy native reference shell for the shell contract | the facade, with features `["world"]` | +| `id-hw-shell` | ESP32-class hardware shell spike: presence, journal head, confirm/act | the facade, with features `["world"]` | Three boundary facts follow from the map. First, the group model lives in `id-events`, not in `id-groups`: model, fold, policy, friendship and writer-set vocabulary are `id-events` property, and `id-groups` is the enforcement remainder over it (library survey §1.9). Second, `id-directory` never depends on `id-worlds`; the edge runs the other way, because `WorldCore` in `id-worlds` holds a `directory::Directory` as persisted state (library survey §1.7). Third, `id-config` has no production dependent: the facade names it only under `[dev-dependencies]`, for its invariant tests. The configuration contract is a test-enforced contract, not a runtime dependency. The design history of the split is carried in [Design: foundations — objects, graph and the file core](../design/foundations.md). diff --git a/pkgs/id/book/concepts/currency.md b/pkgs/id/book/concepts/currency.md index ea05583234..e270bb9b0a 100644 --- a/pkgs/id/book/concepts/currency.md +++ b/pkgs/id/book/concepts/currency.md @@ -32,11 +32,11 @@ A toy example, with invented data only: a registry operator registers a currency Metering that does ship, and that every operator meets, is the `id serve` budget family in the server configuration TOML (`[budgets]`, in `crates/id-cli/src/server_config/`). Budgets bound inbound traffic per application, per peer and per IP. The surveyed defaults are: -| Key | Default | -|---|---| +| Key | Default | +| ---------------------------- | -------------------------------------- | | `app_inbound_bytes_per_hour` | 20 GiB per hour (21,474,836,480 bytes) | -| `per_peer_bytes_per_hour` | 100 MiB per hour (104,857,600 bytes) | -| `per_ip_bytes_per_hour` | 250 MiB per hour (262,144,000 bytes) | +| `per_peer_bytes_per_hour` | 100 MiB per hour (104,857,600 bytes) | +| `per_ip_bytes_per_hour` | 250 MiB per hour (262,144,000 bytes) | Two further keys are implemented in the parser (`parse.rs`) but missing from the module's own doc table — survey disagreement WEB-14: `app_inbound_bytes_per_second`, default 33,554,432 (32 MiB, 1-second window), and `per_peer_burst_bytes_per_minute`, default 8,388,608 (8 MiB, 60-second window), both from `BudgetPolicy::default` in `crates/id-core/src/abuse.rs` (verified in the source for this book; the reference chapter on configuration is their home). A per-counterparty override table, `[[budgets.counterparty]]` with `peer`, `bytes_per_window`, `window_seconds` and optional `messages_per_window`, replaces — it does not stack on — the per-peer limits for that peer. diff --git a/pkgs/id/book/concepts/hosted.md b/pkgs/id/book/concepts/hosted.md index 91e6474f7c..a979573af8 100644 --- a/pkgs/id/book/concepts/hosted.md +++ b/pkgs/id/book/concepts/hosted.md @@ -29,23 +29,23 @@ The per-user object is `UserDO` in `src/user-do.ts`. Its schema version is 3, st Every route first runs the common guard: routing context present, runtime jurisdiction matches, and the persisted (binding_id, jurisdiction) pair — bound immutably by the first routed request — matches. The object exposes 15 method routes over 13 paths: -| Method and path | Purpose | -|---|---| -| `GET /v1/usage` | Usage, ceiling, and whether the user is at cap (`at_cap`) | -| `GET /v1/export` | Full KV and blob index export; stays available at cap, by design | -| `GET /v1/state` | binding_id, jurisdiction, schema_version, object name | -| `GET /v1/bridge/challenge` | Issue a single-use ID-key proof nonce (bridge, #3818) | -| `GET /v1/bridge/heads` | Bridge chain heads; a fresh ID-key proof is required per call | -| `POST /v1/bridge/push` | Ingest a batch of signed events; outcomes are accepted, duplicate, fork, waiting, refused | -| `POST /v1/bridge/pull` | Pull events beyond per-author positions; binary batch, with `x-bridge-more` and `x-bridge-heads` headers | -| `GET /v1/bridge/export` | Export sets for the native `build_export` (#13157); 502 naming the hash if R2 cannot produce a cited blob | -| `WS /v1/bridge/ws` | Bridge session; in-band CHALLENGE/AUTH, binary frames only | -| `PUT /v1/blobs` | Store a content-addressed blob, keyed by SHA-256 hex; deduplicated across users, with a per-user reference row | -| `GET /v1/blobs/{64-hex}` | Fetch a referenced blob | +| Method and path | Purpose | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `GET /v1/usage` | Usage, ceiling, and whether the user is at cap (`at_cap`) | +| `GET /v1/export` | Full KV and blob index export; stays available at cap, by design | +| `GET /v1/state` | binding_id, jurisdiction, schema_version, object name | +| `GET /v1/bridge/challenge` | Issue a single-use ID-key proof nonce (bridge, #3818) | +| `GET /v1/bridge/heads` | Bridge chain heads; a fresh ID-key proof is required per call | +| `POST /v1/bridge/push` | Ingest a batch of signed events; outcomes are accepted, duplicate, fork, waiting, refused | +| `POST /v1/bridge/pull` | Pull events beyond per-author positions; binary batch, with `x-bridge-more` and `x-bridge-heads` headers | +| `GET /v1/bridge/export` | Export sets for the native `build_export` (#13157); 502 naming the hash if R2 cannot produce a cited blob | +| `WS /v1/bridge/ws` | Bridge session; in-band CHALLENGE/AUTH, binary frames only | +| `PUT /v1/blobs` | Store a content-addressed blob, keyed by SHA-256 hex; deduplicated across users, with a per-user reference row | +| `GET /v1/blobs/{64-hex}` | Fetch a referenced blob | | `DELETE /v1/blobs/{64-hex}` | Drop this user's reference only; the R2 bytes are deliberately not deleted (garbage collection is the #9935 family) | -| `PUT /v1/kv/{key}` | Per-user KV write; the key must match `[A-Za-z0-9._-]{1,128}` | -| `GET /v1/kv/{key}` | KV read | -| `DELETE /v1/kv/{key}` | KV delete; available at cap | +| `PUT /v1/kv/{key}` | Per-user KV write; the key must match `[A-Za-z0-9._-]{1,128}` | +| `GET /v1/kv/{key}` | KV read | +| `DELETE /v1/kv/{key}` | KV delete; available at cap | Any other path or method returns 404 with `{"error":"not_found"}`. Bridge routes additionally fail closed when the binding record names no ID (Iroh root) key. diff --git a/pkgs/id/book/concepts/mcp-and-agents.md b/pkgs/id/book/concepts/mcp-and-agents.md index 6be26513a5..4697433d5d 100644 --- a/pkgs/id/book/concepts/mcp-and-agents.md +++ b/pkgs/id/book/concepts/mcp-and-agents.md @@ -18,16 +18,16 @@ The bridge consumes three kinds of server frame — `view`, `semantic_diff` and `v1_tool_definitions()` pins 8 tools, in this order: -| # | Tool | Maps to | Ceiling key | Behaviour | -|---|---|---|---|---| -| 1 | `world.join` | F13.1 `session.presence` | `presence` | Sends `{type:"join", capability, after, agent_profile:true}`. `capability` is a required string; `after` is an optional `u64`. A second join returns `AlreadyJoined`. | -| 2 | `world.leave` | F13.1 `session.presence` | `presence` | No frame exists for leaving: returns `ToolAction::Close`. Presence is connection-scoped, so closing is leaving. | -| 3 | `screen.read` | `screen.read` | `screen.read` | A local answer: the latest full `view` text plus pending semantic-diff changes, which it drains. No frame is sent. | -| 4 | `screen.subscribe` | `screen.subscribe` | `screen.read` | Sends `{type:"screen_subscribe", …}`. Takes an optional `region` (`x`, `y`, `width`, `height`, each `u64`) and an optional `event_classes` list; at least one of the two is required. | -| 5 | `object.inspect` | `object.inspect` | `screen.read` | A local answer from observed `object_changed` diffs, keyed by the JSON string of the required `entity_ref` (any JSON value). If nothing was observed: `"object not in the observed screen state"`. | -| 6 | `program.invoke` | `input` | `program.invoke` | Sends exactly one `{type:"input", data_hex: hex(arguments), screen_revision?}` frame; no chaining. `program` and `object` are required non-empty strings, `arguments` is a required string, `screen_revision` is optional. The bridge validates the fields; the policy layer enforces the allowlist. | -| 7 | `chat.post` | `chat.post` | `chat.post` | Sends `{type:"chat", text, screen_revision?}`. `text` is a required string; `screen_revision` is optional. | -| 8 | `presence.set` | `presence.set` | `presence` | Listed but unimplemented in v1 — see below. | +| # | Tool | Maps to | Ceiling key | Behaviour | +| --- | ------------------ | ------------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | `world.join` | F13.1 `session.presence` | `presence` | Sends `{type:"join", capability, after, agent_profile:true}`. `capability` is a required string; `after` is an optional `u64`. A second join returns `AlreadyJoined`. | +| 2 | `world.leave` | F13.1 `session.presence` | `presence` | No frame exists for leaving: returns `ToolAction::Close`. Presence is connection-scoped, so closing is leaving. | +| 3 | `screen.read` | `screen.read` | `screen.read` | A local answer: the latest full `view` text plus pending semantic-diff changes, which it drains. No frame is sent. | +| 4 | `screen.subscribe` | `screen.subscribe` | `screen.read` | Sends `{type:"screen_subscribe", …}`. Takes an optional `region` (`x`, `y`, `width`, `height`, each `u64`) and an optional `event_classes` list; at least one of the two is required. | +| 5 | `object.inspect` | `object.inspect` | `screen.read` | A local answer from observed `object_changed` diffs, keyed by the JSON string of the required `entity_ref` (any JSON value). If nothing was observed: `"object not in the observed screen state"`. | +| 6 | `program.invoke` | `input` | `program.invoke` | Sends exactly one `{type:"input", data_hex: hex(arguments), screen_revision?}` frame; no chaining. `program` and `object` are required non-empty strings, `arguments` is a required string, `screen_revision` is optional. The bridge validates the fields; the policy layer enforces the allowlist. | +| 7 | `chat.post` | `chat.post` | `chat.post` | Sends `{type:"chat", text, screen_revision?}`. `text` is a required string; `screen_revision` is optional. | +| 8 | `presence.set` | `presence.set` | `presence` | Listed but unimplemented in v1 — see below. | Five names are explicitly forbidden (`FORBIDDEN_TOOL_NAMES`): `capability.mint`, `credential.read`, `audit.mutate`, `world.export`, `host.exec`. Any name that is neither a v1 tool nor handled returns `BridgeError::UnknownTool`. Every tool except `world.join` requires a joined session and returns `NotJoined` otherwise. diff --git a/pkgs/id/book/design/first-apps.md b/pkgs/id/book/design/first-apps.md index a0e5d76af1..0f36f7c461 100644 --- a/pkgs/id/book/design/first-apps.md +++ b/pkgs/id/book/design/first-apps.md @@ -22,17 +22,17 @@ The did-it data model has its own investigation: `2026-10-29T13-04-50Z_investiga The platform's working first apps are the 9 deployable Roc guest apps in `pkgs/id/examples/`, plus the one packaged app. They run on the shared Plaza platform (`examples/roc-world/`), whose guest shape is fixed: every app provides `init`, `update`, `view`, `layout`, `records`, `wants`, `snapshot` and `restore`; guests are compiled to import-free Wasm modules with no WASI, no filesystem, network, clock or randomness imports; all effects go through the capability protocol, with requests answered as participant-0 events and refusals returned as events with stable error codes (`cap_denied`, `unknown_cap`, `bad_args`, `failed`, `actor_denied`, `outside_ceiling`, `result_too_large`). The full platform treatment is in [Design: worlds and the guest runtime](worlds-runtime.md). -| App | Location | What it is | -|---|---|---| -| tic-tac-toe | `apps/tic-tac-toe/` | The sole packaged app (`app.toml` plus `program/main.roc`): two-player tic-tac-toe, digit `0`–`8` moves, ply parity picks X or O, records publish board, plays and winner. | -| lounge | `examples/lounge/` | Capability-system demo: subscribes to `players` and `time.tick:5000`, greets arrivals through `chat.say` requests, counts refusals, polls `time.now`. | -| roc-counter | `examples/roc-counter/` | Tiny pure counter world: guests send `inc`, all see the count, demonstrates records mirroring and the Screen presentation. | -| roc-text-counter | `examples/roc-text-counter/` | The no-Screen legacy-text twin of roc-counter; keeps the plain-text presentation path covered (#3181). | -| roc-chat | `examples/roc-chat/` | Minimal chat client on `RocCap` with `chat.say` and `chat.history`; typing `hist` shows the newest 8 lines. | -| roc-grid | `examples/roc-grid/` | RocGrid demo: a 4×3 byte grid, `set` claims the centre cell, bounds-checked reads with fallback. | -| roc-screen | `examples/roc-screen/` | Screen and Key demo: a bordered-box counter screen document; presenters render the structured grid. | -| territory | `examples/territory/` | Multiplayer territory game: at most 8 seated players on a 16×8 grid, adjacency-only claiming, seats persist across leave, rejoin and restart. | -| roc-cap-demo | `examples/roc-cap-demo/` | Library-import worked example (#5957): a capability-dependent Roc library over `records.read`, with two compile-must-fail negative tests. | +| App | Location | What it is | +| ---------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| tic-tac-toe | `apps/tic-tac-toe/` | The sole packaged app (`app.toml` plus `program/main.roc`): two-player tic-tac-toe, digit `0`–`8` moves, ply parity picks X or O, records publish board, plays and winner. | +| lounge | `examples/lounge/` | Capability-system demo: subscribes to `players` and `time.tick:5000`, greets arrivals through `chat.say` requests, counts refusals, polls `time.now`. | +| roc-counter | `examples/roc-counter/` | Tiny pure counter world: guests send `inc`, all see the count, demonstrates records mirroring and the Screen presentation. | +| roc-text-counter | `examples/roc-text-counter/` | The no-Screen legacy-text twin of roc-counter; keeps the plain-text presentation path covered (#3181). | +| roc-chat | `examples/roc-chat/` | Minimal chat client on `RocCap` with `chat.say` and `chat.history`; typing `hist` shows the newest 8 lines. | +| roc-grid | `examples/roc-grid/` | RocGrid demo: a 4×3 byte grid, `set` claims the centre cell, bounds-checked reads with fallback. | +| roc-screen | `examples/roc-screen/` | Screen and Key demo: a bordered-box counter screen document; presenters render the structured grid. | +| territory | `examples/territory/` | Multiplayer territory game: at most 8 seated players on a 16×8 grid, adjacency-only claiming, seats persist across leave, rejoin and restart. | +| roc-cap-demo | `examples/roc-cap-demo/` | Library-import worked example (#5957): a capability-dependent Roc library over `records.read`, with two compile-must-fail negative tests. | Two neighbouring directories are not apps: `examples/roc-world/` is the shared platform package, and `examples/roc-import-policy/` is a compile-fixture matrix for the import gate. The Rust twins (`examples/rust-counter/`, `examples/rust-world/`) are the F12.8 guest SDK and its counter example, not Roc apps. `examples/first-app-poc/` is a README only: the sticky-notes and did-it proof of concept of #2031, whose executable artifact is the Rust integration test `tests/first_app_poc.rs`, by design. diff --git a/pkgs/id/book/design/roadmap-and-issue-map.md b/pkgs/id/book/design/roadmap-and-issue-map.md index 9c149b1dc3..fc771e244b 100644 --- a/pkgs/id/book/design/roadmap-and-issue-map.md +++ b/pkgs/id/book/design/roadmap-and-issue-map.md @@ -30,23 +30,23 @@ Every epic and tracker below is named inside the design records, per the archive ### The programme trackers -| Tracker | Programme | Where it is treated in this book | -|---|---|---| -| #5678 | Knowledge layer (parent of #5842 and the #5843–#5848 / #6435 cluster) | [Design: the knowledge layer](knowledge-layer.md) | -| #5685 | DoS suite and performance benchmark programme (children #5891–#5897) | [Design: scale, performance and adversarial hardening](scale-hardening.md) | -| #5686 | Provider model (children include #5898, #5899, #5900, #5902, #5904, #5905) | [Design: capabilities and providers](capabilities-providers.md) | -| #5671 / #5672 | Transport fallback and storage decomposition (children include #5793, #5800, #5807) | [Design: sync, replication and FileOps](sync-fileops.md), [Design: hosted and serverless editions](hosted-editions.md) | -| #5955 | Worlds design programme (Roc libraries, dynamic user functions, presentation assets; children include #5973, #5985, #5986, #6006) | [Design: worlds and the guest runtime](worlds-runtime.md), [Design: the knowledge layer](knowledge-layer.md) | -| #6278 | Program ecosystem (children #6291, #6293, #6294, #6308) | [Design: first apps and the ecosystem](first-apps.md) | -| #6300–#6303 | Agents in worlds, the MCP bridge series (under core topic #6280; registry step #10662) | [Design: agents in worlds and the MCP bridge](agents-mcp.md) | -| #6304 | Scale programme (measurements #13083–#13088; v2 is #6305) | [Design: scale, performance and adversarial hardening](scale-hardening.md) | -| #9078 | Hosted editions programme (components E #9083, F #9084, I #9087 are the ID parts; components A and C are not ID) | [Design: hosted and serverless editions](hosted-editions.md) | -| #3399 → #3400–#3404 | The jurisdiction chain. The #3404 slice (fenced jurisdiction migration control plane) was the charter record's flag-held landing; its core landed on `main` on 2026-11-23 (PR #13347) and the issue stays open on the hosted wiring. | [Design: residency, jurisdiction and boundaries](residency-jurisdiction.md) | -| #3231 / #3232 | One receipt contract, and its Phase 3 audit | [Design: currency, tokens and metering](currency-metering.md), [Design: identity, directory, groups and delegation](identity-directory-groups.md) | -| #2898 | Reconstruction is admission | [Design: capabilities and providers](capabilities-providers.md) | -| #5545 | Writer-set view projection and discovery query | [Design: sync, replication and FileOps](sync-fileops.md) | -| #13240 | The full-investigation and build-out programme that commissioned this book | This chapter | -| #13332 | This book | This chapter | +| Tracker | Programme | Where it is treated in this book | +| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| #5678 | Knowledge layer (parent of #5842 and the #5843–#5848 / #6435 cluster) | [Design: the knowledge layer](knowledge-layer.md) | +| #5685 | DoS suite and performance benchmark programme (children #5891–#5897) | [Design: scale, performance and adversarial hardening](scale-hardening.md) | +| #5686 | Provider model (children include #5898, #5899, #5900, #5902, #5904, #5905) | [Design: capabilities and providers](capabilities-providers.md) | +| #5671 / #5672 | Transport fallback and storage decomposition (children include #5793, #5800, #5807) | [Design: sync, replication and FileOps](sync-fileops.md), [Design: hosted and serverless editions](hosted-editions.md) | +| #5955 | Worlds design programme (Roc libraries, dynamic user functions, presentation assets; children include #5973, #5985, #5986, #6006) | [Design: worlds and the guest runtime](worlds-runtime.md), [Design: the knowledge layer](knowledge-layer.md) | +| #6278 | Program ecosystem (children #6291, #6293, #6294, #6308) | [Design: first apps and the ecosystem](first-apps.md) | +| #6300–#6303 | Agents in worlds, the MCP bridge series (under core topic #6280; registry step #10662) | [Design: agents in worlds and the MCP bridge](agents-mcp.md) | +| #6304 | Scale programme (measurements #13083–#13088; v2 is #6305) | [Design: scale, performance and adversarial hardening](scale-hardening.md) | +| #9078 | Hosted editions programme (components E #9083, F #9084, I #9087 are the ID parts; components A and C are not ID) | [Design: hosted and serverless editions](hosted-editions.md) | +| #3399 → #3400–#3404 | The jurisdiction chain. The #3404 slice (fenced jurisdiction migration control plane) was the charter record's flag-held landing; its core landed on `main` on 2026-11-23 (PR #13347) and the issue stays open on the hosted wiring. | [Design: residency, jurisdiction and boundaries](residency-jurisdiction.md) | +| #3231 / #3232 | One receipt contract, and its Phase 3 audit | [Design: currency, tokens and metering](currency-metering.md), [Design: identity, directory, groups and delegation](identity-directory-groups.md) | +| #2898 | Reconstruction is admission | [Design: capabilities and providers](capabilities-providers.md) | +| #5545 | Writer-set view projection and discovery query | [Design: sync, replication and FileOps](sync-fileops.md) | +| #13240 | The full-investigation and build-out programme that commissioned this book | This chapter | +| #13332 | This book | This chapter | Early threads named in the records: #1793 (tags provenance and listing origin; children include #4973), #2259 (friendly-name references), #2343 and #2344 (MQTT device bridge, speech capabilities), #2380 and #2382 (keyset authorization log, guardian recovery). @@ -72,480 +72,480 @@ Grounding for this chapter is the archive itself. The 408 records exist as files ### Design: foundations — objects, graph and the file core — 32 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 57 | `2026-10-17T15-00-00Z_architecture_next_stage_platform` | 2026-10-17 | Next stage of the platform: foundations, then flexibility | -| 81 | `2026-10-29T12-50-36Z_design_id_app_packaging` | 2026-10-29 | Design: ID app packaging — app manifest, folder layout, TUI/web parity | -| 88 | `2026-10-30T13-25-00Z_design_friendly_name_references.md` | 2026-10-30 | Design: friendly-name reference resolution — local store (spec for the #2259 PoC) | -| 93 | `2026-10-30T19-28-00Z_investigation_bittorrent_chunk_retrieval_for_graph_objects` | 2026-10-30 | Investigation: BitTorrent-Style Chunk Retrieval for Graph Objects (LIST 14b) | -| 103 | `2026-11-01T15-42-00Z_architecture_id_crate_split` | 2026-11-01 | `pkgs/id` crate split: Phase 1 architecture | -| 107 | `2026-11-01T16-53-00Z_design_id_crate_split` | 2026-11-01 | pkgs/id crate split: a workspace of importable crates | -| 123 | `2026-11-01_design_id2146.md` | 2026-11-01 | Design: programs as websites in `id serve` | -| 124 | `2026-11-01_design_id2240.md` | 2026-11-01 | Design: session header + segment checkpoint event kind | -| 125 | `2026-11-01_design_id2259.md` | 2026-11-01 | Design: local friendly-name reference resolution (#2259) | -| 139 | `2026-11-01_design_id560.md` | 2026-11-01 | Design: F12.18 denial-of-service suite in CI | -| 146 | `2026-11-01_design_id805.md` | 2026-11-01 | Design: F12.11 delta and binary frames | -| 157 | `2026-11-02T11-47-29Z_design_web_listeners` | 2026-11-02 | Web listener bindings for `id serve` | -| 166 | `2026-11-04T05-11-11Z_feature_structured_logging` | 2026-11-04 | Structured operational logging for `id` — design record | -| 169 | `2026-11-04T10-46-17Z_design_listing_origin_and_upload_time` | 2026-11-04 | File listing provenance: origin node and upload time in List | -| 170 | `2026-11-04T15-33-00Z_design_friendly_name_fanout.md` | 2026-11-04 | Design: friendly-name reference resolution v2 — cross-store fan-out (first slice) | -| 171 | `2026-11-04T21-50-26Z_feature_dynamic_publications_runtime` | 2026-11-04 | Dynamic publication runtime apply and operator CLI | -| 187 | `2026-11-07T04-33-34Z_architecture_secure_public_web_routers` | 2026-11-07 | Secure public web router constructors | -| 201 | `2026-11-08T09-12-27Z_design_id-self-hosting-interop-stance` | 2026-11-08 | Self-hosting and interop stance | -| 211 | `2026-11-08T10-28-00Z_design_id6009_public_domain_normalization` | 2026-11-08 | Public-domain storage normalization — CC0-1.0 for content, 0BSD for code | -| 218 | `2026-11-08T13-20-00Z_research_id6014_ocapn_captp_watch` | 2026-11-08 | Watch record: OCapN / CapTP stability and the CapTP bridge spike (issue #6014) | -| 229 | `2026-11-08T23-17-06Z_design_id_setup_ceremony` | 2026-11-08 | Native ID creation & setup ceremony — decision record | -| 283 | `2026-11-09T07-20-00Z_design_atlas_id_publication` | 2026-11-09 | Atlas → ID-graph publication format: corpus objects + provenance/lineage relations as ID-graph objects | -| 284 | `2026-11-09_audit_3068-phase3-closing.md` | 2026-11-09 | Phase 3 closing audit — parsed-shape contract (#3068 / #3069) | -| 321 | `2026-11-11T03-19-54Z_refactor_markdown_module_split` | 2026-11-11 | Refactor record: split of `pkgs/id/src/web/markdown.rs` (#4704) | -| 337 | `2026-11-13T00-41-00Z_design_id-atlas-primitives-federation-namespaces` | 2026-11-13 | Design (proto): ID/Atlas extensible primitives, federation, namespaces | -| 338 | `2026-11-13T03-40-00Z_design_id-atlas-summit` | 2026-11-13 | Summit decisions, defaults and owner questions | -| 341 | `2026-11-13T10-15-00Z_design_scaling_technique_comparisons` | 2026-11-13 | Scaling-technique comparisons — design decision record | -| 359 | `2026-11-16_decision_id5753_kdl_fork_section5.md` | 2026-11-16 | Decision record — KDL fork, #5753 §5 design pass (payload grammar, extension marking, serde shape) | -| 369 | `2026-11-17T04-55-00Z_design_id9117_id_uri_scheme.md` | 2026-11-17 | Design — the `id://` URI scheme and per-namespace handlers/encodings (#9117) | -| 374 | `2026-11-17T22-00-00Z_design_id9114_related_path_links.md` | 2026-11-17 | Design — related path links in `hash.metadata` (#9114, S3.21–S3.22) | -| 378 | `2026-11-17_design_id9127_append_list_user_attributes.md` | 2026-11-17 | Status: design record for issue #9127, written 2026-11-17. | -| 405 | `2026-11-23_design_id9128_social_app_reference_model.md` | 2026-11-23 | Status: design record for issue #9128, written 2026-11-23. | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | --------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------ | +| 57 | `2026-10-17T15-00-00Z_architecture_next_stage_platform` | 2026-10-17 | Next stage of the platform: foundations, then flexibility | +| 81 | `2026-10-29T12-50-36Z_design_id_app_packaging` | 2026-10-29 | Design: ID app packaging — app manifest, folder layout, TUI/web parity | +| 88 | `2026-10-30T13-25-00Z_design_friendly_name_references.md` | 2026-10-30 | Design: friendly-name reference resolution — local store (spec for the #2259 PoC) | +| 93 | `2026-10-30T19-28-00Z_investigation_bittorrent_chunk_retrieval_for_graph_objects` | 2026-10-30 | Investigation: BitTorrent-Style Chunk Retrieval for Graph Objects (LIST 14b) | +| 103 | `2026-11-01T15-42-00Z_architecture_id_crate_split` | 2026-11-01 | `pkgs/id` crate split: Phase 1 architecture | +| 107 | `2026-11-01T16-53-00Z_design_id_crate_split` | 2026-11-01 | pkgs/id crate split: a workspace of importable crates | +| 123 | `2026-11-01_design_id2146.md` | 2026-11-01 | Design: programs as websites in `id serve` | +| 124 | `2026-11-01_design_id2240.md` | 2026-11-01 | Design: session header + segment checkpoint event kind | +| 125 | `2026-11-01_design_id2259.md` | 2026-11-01 | Design: local friendly-name reference resolution (#2259) | +| 139 | `2026-11-01_design_id560.md` | 2026-11-01 | Design: F12.18 denial-of-service suite in CI | +| 146 | `2026-11-01_design_id805.md` | 2026-11-01 | Design: F12.11 delta and binary frames | +| 157 | `2026-11-02T11-47-29Z_design_web_listeners` | 2026-11-02 | Web listener bindings for `id serve` | +| 166 | `2026-11-04T05-11-11Z_feature_structured_logging` | 2026-11-04 | Structured operational logging for `id` — design record | +| 169 | `2026-11-04T10-46-17Z_design_listing_origin_and_upload_time` | 2026-11-04 | File listing provenance: origin node and upload time in List | +| 170 | `2026-11-04T15-33-00Z_design_friendly_name_fanout.md` | 2026-11-04 | Design: friendly-name reference resolution v2 — cross-store fan-out (first slice) | +| 171 | `2026-11-04T21-50-26Z_feature_dynamic_publications_runtime` | 2026-11-04 | Dynamic publication runtime apply and operator CLI | +| 187 | `2026-11-07T04-33-34Z_architecture_secure_public_web_routers` | 2026-11-07 | Secure public web router constructors | +| 201 | `2026-11-08T09-12-27Z_design_id-self-hosting-interop-stance` | 2026-11-08 | Self-hosting and interop stance | +| 211 | `2026-11-08T10-28-00Z_design_id6009_public_domain_normalization` | 2026-11-08 | Public-domain storage normalization — CC0-1.0 for content, 0BSD for code | +| 218 | `2026-11-08T13-20-00Z_research_id6014_ocapn_captp_watch` | 2026-11-08 | Watch record: OCapN / CapTP stability and the CapTP bridge spike (issue #6014) | +| 229 | `2026-11-08T23-17-06Z_design_id_setup_ceremony` | 2026-11-08 | Native ID creation & setup ceremony — decision record | +| 283 | `2026-11-09T07-20-00Z_design_atlas_id_publication` | 2026-11-09 | Atlas → ID-graph publication format: corpus objects + provenance/lineage relations as ID-graph objects | +| 284 | `2026-11-09_audit_3068-phase3-closing.md` | 2026-11-09 | Phase 3 closing audit — parsed-shape contract (#3068 / #3069) | +| 321 | `2026-11-11T03-19-54Z_refactor_markdown_module_split` | 2026-11-11 | Refactor record: split of `pkgs/id/src/web/markdown.rs` (#4704) | +| 337 | `2026-11-13T00-41-00Z_design_id-atlas-primitives-federation-namespaces` | 2026-11-13 | Design (proto): ID/Atlas extensible primitives, federation, namespaces | +| 338 | `2026-11-13T03-40-00Z_design_id-atlas-summit` | 2026-11-13 | Summit decisions, defaults and owner questions | +| 341 | `2026-11-13T10-15-00Z_design_scaling_technique_comparisons` | 2026-11-13 | Scaling-technique comparisons — design decision record | +| 359 | `2026-11-16_decision_id5753_kdl_fork_section5.md` | 2026-11-16 | Decision record — KDL fork, #5753 §5 design pass (payload grammar, extension marking, serde shape) | +| 369 | `2026-11-17T04-55-00Z_design_id9117_id_uri_scheme.md` | 2026-11-17 | Design — the `id://` URI scheme and per-namespace handlers/encodings (#9117) | +| 374 | `2026-11-17T22-00-00Z_design_id9114_related_path_links.md` | 2026-11-17 | Design — related path links in `hash.metadata` (#9114, S3.21–S3.22) | +| 378 | `2026-11-17_design_id9127_append_list_user_attributes.md` | 2026-11-17 | Status: design record for issue #9127, written 2026-11-17. | +| 405 | `2026-11-23_design_id9128_social_app_reference_model.md` | 2026-11-23 | Status: design record for issue #9128, written 2026-11-23. | ### Design: worlds and the guest runtime — 20 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 9 | `2026-10-07T00-20-00Z_architecture_roc_worlds` | 2026-10-07 | Roc-Defined Multiplayer Worlds | -| 13 | `2026-10-10T03-56-25Z_feature_world_isolation` | 2026-10-10 | World isolation modes | -| 15 | `2026-10-10T04-59-57Z_feature_cross_world_access` | 2026-10-10 | Cross-world access: writes, force, and file scope | -| 32 | `2026-10-14T19-39-30Z_architecture_portable_world_surfaces` | 2026-10-14 | Portable world surfaces and controlled execution profiles | -| 33 | `2026-10-14T20-00-05Z_feature_source_only_world_installs` | 2026-10-14 | Source-only world module installation | -| 36 | `2026-10-15T09-27-28Z_feature_roc_json` | 2026-10-15 | Pure-Roc JSON for portable world programs | -| 39 | `2026-10-16T09-00-00Z_feature_world_module_provenance` | 2026-10-16 | Observed world module provenance | -| 40 | `2026-10-16T09-30-00Z_feature_world_module_provenance` | 2026-10-16 | World module build provenance | -| 51 | `2026-10-16T18-30-00Z_feature_world_authoring_cli` | 2026-10-16 | Authoring CLI: `id world new` and `id world stats` | -| 56 | `2026-10-17T10-00-00Z_feature_scheduled_events` | 2026-10-17 | Scheduled events: a world can ask for one fire at a set time | -| 60 | `2026-10-18T00-00-00Z_reference_platform_state` | 2026-10-18 | Platform world: current state, findings, and open work | -| 62 | `2026-10-18T18-40-00Z_report_platform_world_state` | 2026-10-18 | Platform world: state report | -| 96 | `2026-10-30T19-36-00Z_investigation_world_vm_wasm_portability` | 2026-10-30 | World-VM Wasm portability audit — what of the worlds runtime runs inside a Worker | -| 106 | `2026-11-01T16-09-48Z_feature_world_json_transcript` | 2026-11-01 | `id world join --command-mode --json` transcript | -| 138 | `2026-11-01_design_id558.md` | 2026-11-01 | Design: `id world dev` authoring loop | -| 152 | `2026-11-02T00-53-51Z_feature_world_host_view` | 2026-11-02 | Authenticated, read-only world host view | -| 161 | `2026-11-03T01-31-11Z_design_recurring_cross_world_schedules` | 2026-11-03 | Recurring and cross-world scheduled events | -| 176 | `2026-11-05T15-08-16Z_research_id5986_agpl_gpl_hosting` | 2026-11-05 | AGPL/GPL hosting: inspectable worlds, uploads, and self-hosting | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | --------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- | +| 9 | `2026-10-07T00-20-00Z_architecture_roc_worlds` | 2026-10-07 | Roc-Defined Multiplayer Worlds | +| 13 | `2026-10-10T03-56-25Z_feature_world_isolation` | 2026-10-10 | World isolation modes | +| 15 | `2026-10-10T04-59-57Z_feature_cross_world_access` | 2026-10-10 | Cross-world access: writes, force, and file scope | +| 32 | `2026-10-14T19-39-30Z_architecture_portable_world_surfaces` | 2026-10-14 | Portable world surfaces and controlled execution profiles | +| 33 | `2026-10-14T20-00-05Z_feature_source_only_world_installs` | 2026-10-14 | Source-only world module installation | +| 36 | `2026-10-15T09-27-28Z_feature_roc_json` | 2026-10-15 | Pure-Roc JSON for portable world programs | +| 39 | `2026-10-16T09-00-00Z_feature_world_module_provenance` | 2026-10-16 | Observed world module provenance | +| 40 | `2026-10-16T09-30-00Z_feature_world_module_provenance` | 2026-10-16 | World module build provenance | +| 51 | `2026-10-16T18-30-00Z_feature_world_authoring_cli` | 2026-10-16 | Authoring CLI: `id world new` and `id world stats` | +| 56 | `2026-10-17T10-00-00Z_feature_scheduled_events` | 2026-10-17 | Scheduled events: a world can ask for one fire at a set time | +| 60 | `2026-10-18T00-00-00Z_reference_platform_state` | 2026-10-18 | Platform world: current state, findings, and open work | +| 62 | `2026-10-18T18-40-00Z_report_platform_world_state` | 2026-10-18 | Platform world: state report | +| 96 | `2026-10-30T19-36-00Z_investigation_world_vm_wasm_portability` | 2026-10-30 | World-VM Wasm portability audit — what of the worlds runtime runs inside a Worker | +| 106 | `2026-11-01T16-09-48Z_feature_world_json_transcript` | 2026-11-01 | `id world join --command-mode --json` transcript | +| 138 | `2026-11-01_design_id558.md` | 2026-11-01 | Design: `id world dev` authoring loop | +| 152 | `2026-11-02T00-53-51Z_feature_world_host_view` | 2026-11-02 | Authenticated, read-only world host view | +| 161 | `2026-11-03T01-31-11Z_design_recurring_cross_world_schedules` | 2026-11-03 | Recurring and cross-world scheduled events | +| 176 | `2026-11-05T15-08-16Z_research_id5986_agpl_gpl_hosting` | 2026-11-05 | AGPL/GPL hosting: inspectable worlds, uploads, and self-hosting | | 199 | `2026-11-08T09-10-00Z_research_worlds_conversation_archaeology` | 2026-11-08 | Conversation archaeology: prior discussions with the user about Second Life and programmable worlds, tied into the worlds program | -| 368 | `2026-11-16_id_world_dev_authoring.md` | 2026-11-16 | Authoring Roc worlds with `id world dev` | +| 368 | `2026-11-16_id_world_dev_authoring.md` | 2026-11-16 | Authoring Roc worlds with `id world dev` | ### Design: capabilities and providers — 44 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 10 | `2026-10-09T09-59-07Z_design_attenuated_capabilities` | 2026-10-09 | Attenuated capabilities for world access | -| 43 | `2026-10-16T11-00-00Z_feature_world_capability_ceilings` | 2026-10-16 | World capability ceilings | -| 44 | `2026-10-16T12-00-00Z_feature_world_cli_controls` | 2026-10-16 | World Operator CLI Controls for Capability Ceilings and Resource Profiles | -| 48 | `2026-10-16T16-00-00Z_feature_roc_cap` | 2026-10-16 | RocCap: shared request bookkeeping for the capability protocol | -| 50 | `2026-10-16T18-00-00Z_feature_records_readback` | 2026-10-16 | Records readback: a `records.read` capability | -| 65 | `2026-10-25T05-37-57Z_design_client_capability_providers` | 2026-10-25 | Client-side capability providers under the ceiling model (F13.7) | -| 83 | `2026-10-29T14-05-00Z_investigation_capability_taxonomy` | 2026-10-29 | Capability taxonomy v0 — interface specialization across web, ESP32/MQTT and text/audio | -| 111 | `2026-11-01T20-45-00Z_feature_admin_audit` | 2026-11-01 | F12.6 slice 1: administrative and provider-use audit | -| 112 | `2026-11-01_design_id2028.md` | 2026-11-01 | Design: ID core v1 — app model and minimum capabilities | -| 131 | `2026-11-01_design_id2898.md` | 2026-11-01 | Design: reconstruction is admission in `pkgs/id` | -| 141 | `2026-11-01_design_id786.md` | 2026-11-01 | Design: F13.4 presentation capability tiers with in-band terminal detection | -| 144 | `2026-11-01_design_id789.md` | 2026-11-01 | Design: Phase 13 F13.7 client-side capability providers | -| 163 | `2026-11-03T10-06-40Z_architecture_provider_registry_slice1` | 2026-11-03 | F12.4 Provider Registry — Slice 1 | -| 168 | `2026-11-04T06-40-00Z_feature_loc-capability.md` | 2026-11-04 | `loc.*` — location capabilities with an accuracy ceiling and per-use consent | -| 179 | `2026-11-05T17-24-09Z_design_id_license_detection_pipeline` | 2026-11-05 | Design: upload-time license detection pipeline | -| 184 | `2026-11-06_decision_id_tagging_triples.md` | 2026-11-06 | Decision: ID tag claims as atomic-triple projections | -| 185 | `2026-11-06_design_id5985.md` | 2026-11-06 | Design: license combination checker — combination events, v1 incompatibility rules, override vs exception-request flows, audit records | -| 190 | `2026-11-08T01-10-24Z_design_id_capability_certification_exceptions` | 2026-11-08 | Design: capability-certification exception policy | -| 192 | `2026-11-08T06-25-00Z_design_tag_scope` | 2026-11-08 | Tag scope: local-only vs shared claims (#1793) | -| 198 | `2026-11-08T09-10-00Z_design_embedded_providers_decision.md` | 2026-11-08 | Decision record: embedded providers — engine & smartphone instantiation of the #5686 provider model | -| 204 | `2026-11-08T09-15-00Z_design_id_capability_model` | 2026-11-08 | Design: the capability model — requested vs discovered-used sets, registry schema, custom-compiled platforms | -| 208 | `2026-11-08T10-12-00Z_design_id_capability_diff_semantics` | 2026-11-08 | Capability-change diff semantics — user-meaningful classes and re-approval triggers | -| 212 | `2026-11-08T10-40-00Z_design_id_capability_observability` | 2026-11-08 | Design: capability observability — who can see which capability facts, where | -| 224 | `2026-11-08T17-12-39Z_design_id_package_import_policy` | 2026-11-08 | Design: pure-package imports and package classes across capability tiers | -| 240 | `2026-11-08_decision_id5904_offline_degraded_providers.md` | 2026-11-08 | Decision: offline & degraded operation for capability providers | -| 242 | `2026-11-08_decision_id5909_sql_pgq_capability.md` | 2026-11-08 | Decision: SQL/PGQ capability boundary for ID triples | -| 271 | `2026-11-08_design_id6015.md` | 2026-11-08 | Design: land/parcel capability domains — per-parcel policy granularity without tokenized land | -| 279 | `2026-11-09T05-00-00Z_feature_mqtt_device_bridge_id_device_v1` | 2026-11-09 | `id.device.v1` MQTT device bridge — schema and PoC (#2343) | -| 282 | `2026-11-09T06-25-00Z_research_id5989_prior_art_capability_systems` | 2026-11-09 | Research: prior art — capability systems, OCAP, Spritely Goblins/OCapN, CRDT shared worlds | -| 313 | `2026-11-10_design_id5977_license_taxonomy.md` | 2026-11-10 | Design: license taxonomy & classifier — the enumerated set, the warning ladder, and the tag format | -| 320 | `2026-11-11T02-55-00Z_design_used-capability-derivation` | 2026-11-11 | Used-capability derivation tool — spec | -| 324 | `2026-11-11T08-50-24Z_design_used_capability_derivation` | 2026-11-11 | Design: used-capability derivation tool — static call-graph scan producing the registry used-set (#5998) | -| 326 | `2026-11-11_decision_id5817_sensitivity_classification.md` | 2026-11-11 | Decision: sensitivity classification model for ID table queries (#5817) | -| 340 | `2026-11-13T09-26-00Z_design_pool_effort_system` | 2026-11-13 | Brief supplement — capabilities: per-capability routing, failover, and pools as models | -| 353 | `2026-11-16T09-03-20Z_decision_id5902_terminal_website_host_providers.md` | 2026-11-16 | Decision record: host providers — terminal & website instantiation of the #5686 provider model | -| 380 | `2026-11-17_runbook_id5532_f13-7_client_file_read_rollout.md` | 2026-11-17 | F13.7 rollout runbook — `client.file.read`, the first client-side capability provider | -| 382 | `2026-11-20T07-30-11Z_feature_speech-capabilities.md` | 2026-11-20 | `speech.*` — conversational audio capabilities | -| 389 | `2026-11-22_design_id1062-blob-provider.md` | 2026-11-22 | F12.5 `blob` provider — design for the second slice of #1062 | -| 390 | `2026-11-22_design_id1062-http-fetch-provider.md` | 2026-11-22 | F12.5 `http.fetch` provider — design for the third slice of #1062 | -| 391 | `2026-11-22_design_id1062-kv-provider.md` | 2026-11-22 | F12.5 `kv` provider — design for the first slice of #1062 | -| 392 | `2026-11-22_design_id1062-notify-provider.md` | 2026-11-22 | F12.5 `notify` provider — design for the fourth slice of #1062 | -| 393 | `2026-11-22_design_id1067-admission.md` | 2026-11-22 | F12.10 guest-burn admission — design for the second slice of #1067 | -| 400 | `2026-11-23T07-06-00Z_design_id_capability_class_assignments` | 2026-11-23 | Capability classes for the post-#5999 registrations — assignment design pass | -| 404 | `2026-11-23_design_id1067-account-quotas.md` | 2026-11-23 | F12.10 per-account quotas — design for the ownership slice of #1067 | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | ------------------------------------------------------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| 10 | `2026-10-09T09-59-07Z_design_attenuated_capabilities` | 2026-10-09 | Attenuated capabilities for world access | +| 43 | `2026-10-16T11-00-00Z_feature_world_capability_ceilings` | 2026-10-16 | World capability ceilings | +| 44 | `2026-10-16T12-00-00Z_feature_world_cli_controls` | 2026-10-16 | World Operator CLI Controls for Capability Ceilings and Resource Profiles | +| 48 | `2026-10-16T16-00-00Z_feature_roc_cap` | 2026-10-16 | RocCap: shared request bookkeeping for the capability protocol | +| 50 | `2026-10-16T18-00-00Z_feature_records_readback` | 2026-10-16 | Records readback: a `records.read` capability | +| 65 | `2026-10-25T05-37-57Z_design_client_capability_providers` | 2026-10-25 | Client-side capability providers under the ceiling model (F13.7) | +| 83 | `2026-10-29T14-05-00Z_investigation_capability_taxonomy` | 2026-10-29 | Capability taxonomy v0 — interface specialization across web, ESP32/MQTT and text/audio | +| 111 | `2026-11-01T20-45-00Z_feature_admin_audit` | 2026-11-01 | F12.6 slice 1: administrative and provider-use audit | +| 112 | `2026-11-01_design_id2028.md` | 2026-11-01 | Design: ID core v1 — app model and minimum capabilities | +| 131 | `2026-11-01_design_id2898.md` | 2026-11-01 | Design: reconstruction is admission in `pkgs/id` | +| 141 | `2026-11-01_design_id786.md` | 2026-11-01 | Design: F13.4 presentation capability tiers with in-band terminal detection | +| 144 | `2026-11-01_design_id789.md` | 2026-11-01 | Design: Phase 13 F13.7 client-side capability providers | +| 163 | `2026-11-03T10-06-40Z_architecture_provider_registry_slice1` | 2026-11-03 | F12.4 Provider Registry — Slice 1 | +| 168 | `2026-11-04T06-40-00Z_feature_loc-capability.md` | 2026-11-04 | `loc.*` — location capabilities with an accuracy ceiling and per-use consent | +| 179 | `2026-11-05T17-24-09Z_design_id_license_detection_pipeline` | 2026-11-05 | Design: upload-time license detection pipeline | +| 184 | `2026-11-06_decision_id_tagging_triples.md` | 2026-11-06 | Decision: ID tag claims as atomic-triple projections | +| 185 | `2026-11-06_design_id5985.md` | 2026-11-06 | Design: license combination checker — combination events, v1 incompatibility rules, override vs exception-request flows, audit records | +| 190 | `2026-11-08T01-10-24Z_design_id_capability_certification_exceptions` | 2026-11-08 | Design: capability-certification exception policy | +| 192 | `2026-11-08T06-25-00Z_design_tag_scope` | 2026-11-08 | Tag scope: local-only vs shared claims (#1793) | +| 198 | `2026-11-08T09-10-00Z_design_embedded_providers_decision.md` | 2026-11-08 | Decision record: embedded providers — engine & smartphone instantiation of the #5686 provider model | +| 204 | `2026-11-08T09-15-00Z_design_id_capability_model` | 2026-11-08 | Design: the capability model — requested vs discovered-used sets, registry schema, custom-compiled platforms | +| 208 | `2026-11-08T10-12-00Z_design_id_capability_diff_semantics` | 2026-11-08 | Capability-change diff semantics — user-meaningful classes and re-approval triggers | +| 212 | `2026-11-08T10-40-00Z_design_id_capability_observability` | 2026-11-08 | Design: capability observability — who can see which capability facts, where | +| 224 | `2026-11-08T17-12-39Z_design_id_package_import_policy` | 2026-11-08 | Design: pure-package imports and package classes across capability tiers | +| 240 | `2026-11-08_decision_id5904_offline_degraded_providers.md` | 2026-11-08 | Decision: offline & degraded operation for capability providers | +| 242 | `2026-11-08_decision_id5909_sql_pgq_capability.md` | 2026-11-08 | Decision: SQL/PGQ capability boundary for ID triples | +| 271 | `2026-11-08_design_id6015.md` | 2026-11-08 | Design: land/parcel capability domains — per-parcel policy granularity without tokenized land | +| 279 | `2026-11-09T05-00-00Z_feature_mqtt_device_bridge_id_device_v1` | 2026-11-09 | `id.device.v1` MQTT device bridge — schema and PoC (#2343) | +| 282 | `2026-11-09T06-25-00Z_research_id5989_prior_art_capability_systems` | 2026-11-09 | Research: prior art — capability systems, OCAP, Spritely Goblins/OCapN, CRDT shared worlds | +| 313 | `2026-11-10_design_id5977_license_taxonomy.md` | 2026-11-10 | Design: license taxonomy & classifier — the enumerated set, the warning ladder, and the tag format | +| 320 | `2026-11-11T02-55-00Z_design_used-capability-derivation` | 2026-11-11 | Used-capability derivation tool — spec | +| 324 | `2026-11-11T08-50-24Z_design_used_capability_derivation` | 2026-11-11 | Design: used-capability derivation tool — static call-graph scan producing the registry used-set (#5998) | +| 326 | `2026-11-11_decision_id5817_sensitivity_classification.md` | 2026-11-11 | Decision: sensitivity classification model for ID table queries (#5817) | +| 340 | `2026-11-13T09-26-00Z_design_pool_effort_system` | 2026-11-13 | Brief supplement — capabilities: per-capability routing, failover, and pools as models | +| 353 | `2026-11-16T09-03-20Z_decision_id5902_terminal_website_host_providers.md` | 2026-11-16 | Decision record: host providers — terminal & website instantiation of the #5686 provider model | +| 380 | `2026-11-17_runbook_id5532_f13-7_client_file_read_rollout.md` | 2026-11-17 | F13.7 rollout runbook — `client.file.read`, the first client-side capability provider | +| 382 | `2026-11-20T07-30-11Z_feature_speech-capabilities.md` | 2026-11-20 | `speech.*` — conversational audio capabilities | +| 389 | `2026-11-22_design_id1062-blob-provider.md` | 2026-11-22 | F12.5 `blob` provider — design for the second slice of #1062 | +| 390 | `2026-11-22_design_id1062-http-fetch-provider.md` | 2026-11-22 | F12.5 `http.fetch` provider — design for the third slice of #1062 | +| 391 | `2026-11-22_design_id1062-kv-provider.md` | 2026-11-22 | F12.5 `kv` provider — design for the first slice of #1062 | +| 392 | `2026-11-22_design_id1062-notify-provider.md` | 2026-11-22 | F12.5 `notify` provider — design for the fourth slice of #1062 | +| 393 | `2026-11-22_design_id1067-admission.md` | 2026-11-22 | F12.10 guest-burn admission — design for the second slice of #1067 | +| 400 | `2026-11-23T07-06-00Z_design_id_capability_class_assignments` | 2026-11-23 | Capability classes for the post-#5999 registrations — assignment design pass | +| 404 | `2026-11-23_design_id1067-account-quotas.md` | 2026-11-23 | F12.10 per-account quotas — design for the ownership slice of #1067 | ### Design: identity, directory, groups and delegation — 56 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 11 | `2026-10-09T12-00-00Z_feature_directory_accounts_groups` | 2026-10-09 | Accounts, groups, contacts and delegation | -| 14 | `2026-10-10T04-58-36Z_design_signed_artifacts` | 2026-10-10 | Signed artifacts, home servers, and cross-world access | -| 17 | `2026-10-10T07-00-00Z_feature_petnames_invites` | 2026-10-10 | Petnames and invite links | -| 18 | `2026-10-11T03-44-33Z_design_groups_events_delegation` | 2026-10-11 | Events, groups, delegation, removal, and history | -| 34 | `2026-10-14T20-10-00Z_feature_world_keyboard_parity` | 2026-10-14 | Browser and SSH keyboard parity for world programs | -| 49 | `2026-10-16T17-00-00Z_feature_chat_history` | 2026-10-16 | Server-observed chat history and grantable platform modules | -| 54 | `2026-10-17T08-00-00Z_feature_world_roles_directory` | 2026-10-17 | Worlds as places, first slice: role-scoped invites and a machine-readable world list | -| 61 | `2026-10-18T04-00-00Z_fix_world_chat_visibility` | 2026-10-18 | Fix: world chat is visible only to participants who may chat or read history | -| 70 | `2026-10-29T10-45-00Z_investigation_ephemeral_live_data_retention` | 2026-10-29 | Ephemeral live data vs the chained event graph — retention and intermittent signing — investigation | -| 90 | `2026-10-30T19-11-04Z_investigation_trust_visibility_model` | 2026-10-30 | Investigation: the ID trust/visibility model — accept-all ingest, writer-set views | -| 94 | `2026-10-30T19-35-00Z_investigation_boards_model` | 2026-10-30 | ID boards — a modern phpBB on ID identity: board model sketch | -| 102 | `2026-10-31T18-03-36Z_investigation_native_tier_tradeoffs` | 2026-10-31 | Investigation: the native tier vs WASM — fuel, trust, and when each is right | -| 105 | `2026-11-01T16-06-00Z_research_in_session_command_toggle` | 2026-11-01 | D1-045 — In-session command toggle (prefix key + visible mode indicator) | -| 109 | `2026-11-01T17-52-12Z_feature_stable_note_revisions` | 2026-11-01 | Stable note identity and revision graph | -| 128 | `2026-11-01_design_id2804.md` | 2026-11-01 | Design: Issuer key rotation and compromise recovery | -| 132 | `2026-11-01_design_id3231.md` | 2026-11-01 | Design: one receipt contract for `pkgs/id` artifacts | -| 142 | `2026-11-01_design_id787.md` | 2026-11-01 | Design: kitty keyboard protocol on the raw input path | -| 148 | `2026-11-01_design_id835.md` | 2026-11-01 | Design: builder and moderator authority through world-session frames | -| 151 | `2026-11-02T00-31-45Z_design_module_trust` | 2026-11-02 | Design: module trust — admin trust list and install-time signature check | -| 153 | `2026-11-02T04-44-00Z_design_group_remove_modes` | 2026-11-02 | Explicit group removal modes | -| 158 | `2026-11-02T12-47-00Z_design_petname_unicode_confusable_skeleton` | 2026-11-02 | Petname anti-mimicry: Unicode UTS #39 confusable skeleton | -| 167 | `2026-11-04T06-07-11Z_feature_local_key_envelope` | 2026-11-04 | Local passphrase-wrapped identity key envelope | -| 172 | `2026-11-04_audit_id3232_receipt_validation.md` | 2026-11-04 | Receipt-validation audit for `pkgs/id` artifacts (#3232) | -| 174 | `2026-11-05T13-36-21Z_design_threat_list_feed_protocol` | 2026-11-05 | Design: shared threat-list feed protocol — versioned, signed, subscribable feeds with local override lists | -| 177 | `2026-11-05T15-10-00Z_architecture_legacy_artifact_receive_cutoff` | 2026-11-05 | Legacy artifact receive cutoff | -| 195 | `2026-11-08T08-19-40Z_design_id_knowledge_sharing_permissions` | 2026-11-08 | Design: Knowledge-layer sharing and permissions | -| 197 | `2026-11-08T09-06-08Z_design_id_permission_ux` | 2026-11-08 | Design: Permission UX for worlds — pre-connect disclosure, grant modes, and memory | -| 207 | `2026-11-08T10-03-00Z_design_id_recovery_codes` | 2026-11-08 | ID recovery codes (custody variant c) — decision record | -| 217 | `2026-11-08T12-50-00Z_design_id6004_lambdamoo_governance_arc` | 2026-11-08 | Design note: reserved admin authority — what LambdaMOO's governance arc says id must keep off the ballot | -| 220 | `2026-11-08T13-45-00Z_design_id_world_governance` | 2026-11-08 | Design: world governance — moderation-as-library, per-world parameterization, pre-approval | -| 223 | `2026-11-08T15-20-00Z_design_sign-request-nonce-domain.md` | 2026-11-08 | sign_request nonce domain — fallible signing contract (2026-11-08) | -| 226 | `2026-11-08T19-52-00Z_feature_groups_page` | 2026-11-08 | Local groups and grants page at /groups — design record | -| 263 | `2026-11-08_design_id5861.md` | 2026-11-08 | Design: board moderation hooks | -| 267 | `2026-11-08_design_id5871.md` | 2026-11-08 | Design: talk-page semantics — lifecycle, permissions, and binding authority | -| 274 | `2026-11-09T00-16-56Z_decision_id5900_provider_capability_grants.md` | 2026-11-09 | Decision: capability grants for providers — grant shape, sensitivity classes, approval flows | -| 280 | `2026-11-09T05-06-00Z_decision_id5801_encrypted_shares_key_distribution.md` | 2026-11-09 | Decision: encrypted shares & key distribution — share shape, key holders, rotation, recipient proofs | -| 287 | `2026-11-09_decision_id5905_provider_security_model.md` | 2026-11-09 | Decision: provider security model — identity, admission, impersonation, rogue providers, bridge compromise, capability confusion, ceiling-composition | -| 294 | `2026-11-09_design_id6005_moderation_pack_format.md` | 2026-11-09 | Design: moderation pack format — data-only packs with a static policy core, feed subscriptions, and per-world parameters | -| 302 | `2026-11-10T21-05-00Z_design_id6007_moderation_presets` | 2026-11-10 | Moderation preset tiers: named presets that compile to concrete rules | -| 311 | `2026-11-10_design_id5881_stepup_escrow.md` | 2026-11-10 | Design: 2FA step-up gates & org-escrowed credential proxying (id) | -| 312 | `2026-11-10_design_id5887.md` | 2026-11-10 | Design: user-held keys — key custody variant (b) for `id` | -| 319 | `2026-11-11T00-18-00Z_decision_id5898_provider_declaration_model.md` | 2026-11-11 | Decision: provider declaration model — manifest contents, signing, versioning, dynamic vs static capabilities | -| 325 | `2026-11-11T19-15-00Z_design_block_lookup` | 2026-11-11 | Design: block-list lookups that can say "the lookup failed" (#8750) | -| 327 | `2026-11-11_design_id5984_licensing_policy.md` | 2026-11-11 | Design: licensing policy — server ToS uploader grant, account-creation defaults, admin license policies | -| 330 | `2026-11-12T19-10-07Z_design_keyset_authorization_log` | 2026-11-12 | ADR: keyset / authorization log for `id` identity (#2380) | -| 332 | `2026-11-12T20-58-00Z_research_id_permission_precedents` | 2026-11-12 | Research: Permission-prompt precedents — how platforms present, remember, and revoke capability grants | -| 333 | `2026-11-12T22-55-00Z_design_seed_phrase_recovery` | 2026-11-12 | Seed-phrase export/restore for the identity key | -| 339 | `2026-11-13T09-00-00Z_design_blob_gate_authorization_wiring.md` | 2026-11-13 | Design: blob gate authorization wiring in `id serve` (#173) | -| 342 | `2026-11-13_design_id5886.md` | 2026-11-13 | Design: service-held keys — key custody variant (a) for `id` | -| 348 | `2026-11-14T18-50-00Z_design_id_invite_delegation` | 2026-11-14 | Design: generic invite delegation — encoding, depth, leakage, and group live-set semantics | -| 357 | `2026-11-16T11-00-00Z_design_guardian_recovery` | 2026-11-16 | Design: guardian social recovery — record formats, successor-key authority, threshold signing (#2382) | -| 361 | `2026-11-16_decision_id5819_owner_override_mechanics.md` | 2026-11-16 | Decision: owner override mechanics & the encryption boundary (#5819) | -| 370 | `2026-11-17T05-15-00Z_design_id9141_peer_trust_classes.md` | 2026-11-17 | Design (#9141): peer trust classes + signed-data acceptance rule | -| 379 | `2026-11-17_design_id_sign_time_refusal.md` | 2026-11-17 | Sign only what receipt would accept — the sign-time refusal contract for `pkgs/id` | -| 384 | `2026-11-21T04-30-00Z_design_id_delegation_cross_signing_ceremony` | 2026-11-21 | Design: delegation, transfer, and cross-signed identity ceremony | -| 399 | `2026-11-23T05-02-30Z_design_id_capability_change_notices` | 2026-11-23 | Design: capability-change notices on reconnect — presentation, choices, re-baselining, invite pinning | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | --------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| 11 | `2026-10-09T12-00-00Z_feature_directory_accounts_groups` | 2026-10-09 | Accounts, groups, contacts and delegation | +| 14 | `2026-10-10T04-58-36Z_design_signed_artifacts` | 2026-10-10 | Signed artifacts, home servers, and cross-world access | +| 17 | `2026-10-10T07-00-00Z_feature_petnames_invites` | 2026-10-10 | Petnames and invite links | +| 18 | `2026-10-11T03-44-33Z_design_groups_events_delegation` | 2026-10-11 | Events, groups, delegation, removal, and history | +| 34 | `2026-10-14T20-10-00Z_feature_world_keyboard_parity` | 2026-10-14 | Browser and SSH keyboard parity for world programs | +| 49 | `2026-10-16T17-00-00Z_feature_chat_history` | 2026-10-16 | Server-observed chat history and grantable platform modules | +| 54 | `2026-10-17T08-00-00Z_feature_world_roles_directory` | 2026-10-17 | Worlds as places, first slice: role-scoped invites and a machine-readable world list | +| 61 | `2026-10-18T04-00-00Z_fix_world_chat_visibility` | 2026-10-18 | Fix: world chat is visible only to participants who may chat or read history | +| 70 | `2026-10-29T10-45-00Z_investigation_ephemeral_live_data_retention` | 2026-10-29 | Ephemeral live data vs the chained event graph — retention and intermittent signing — investigation | +| 90 | `2026-10-30T19-11-04Z_investigation_trust_visibility_model` | 2026-10-30 | Investigation: the ID trust/visibility model — accept-all ingest, writer-set views | +| 94 | `2026-10-30T19-35-00Z_investigation_boards_model` | 2026-10-30 | ID boards — a modern phpBB on ID identity: board model sketch | +| 102 | `2026-10-31T18-03-36Z_investigation_native_tier_tradeoffs` | 2026-10-31 | Investigation: the native tier vs WASM — fuel, trust, and when each is right | +| 105 | `2026-11-01T16-06-00Z_research_in_session_command_toggle` | 2026-11-01 | D1-045 — In-session command toggle (prefix key + visible mode indicator) | +| 109 | `2026-11-01T17-52-12Z_feature_stable_note_revisions` | 2026-11-01 | Stable note identity and revision graph | +| 128 | `2026-11-01_design_id2804.md` | 2026-11-01 | Design: Issuer key rotation and compromise recovery | +| 132 | `2026-11-01_design_id3231.md` | 2026-11-01 | Design: one receipt contract for `pkgs/id` artifacts | +| 142 | `2026-11-01_design_id787.md` | 2026-11-01 | Design: kitty keyboard protocol on the raw input path | +| 148 | `2026-11-01_design_id835.md` | 2026-11-01 | Design: builder and moderator authority through world-session frames | +| 151 | `2026-11-02T00-31-45Z_design_module_trust` | 2026-11-02 | Design: module trust — admin trust list and install-time signature check | +| 153 | `2026-11-02T04-44-00Z_design_group_remove_modes` | 2026-11-02 | Explicit group removal modes | +| 158 | `2026-11-02T12-47-00Z_design_petname_unicode_confusable_skeleton` | 2026-11-02 | Petname anti-mimicry: Unicode UTS #39 confusable skeleton | +| 167 | `2026-11-04T06-07-11Z_feature_local_key_envelope` | 2026-11-04 | Local passphrase-wrapped identity key envelope | +| 172 | `2026-11-04_audit_id3232_receipt_validation.md` | 2026-11-04 | Receipt-validation audit for `pkgs/id` artifacts (#3232) | +| 174 | `2026-11-05T13-36-21Z_design_threat_list_feed_protocol` | 2026-11-05 | Design: shared threat-list feed protocol — versioned, signed, subscribable feeds with local override lists | +| 177 | `2026-11-05T15-10-00Z_architecture_legacy_artifact_receive_cutoff` | 2026-11-05 | Legacy artifact receive cutoff | +| 195 | `2026-11-08T08-19-40Z_design_id_knowledge_sharing_permissions` | 2026-11-08 | Design: Knowledge-layer sharing and permissions | +| 197 | `2026-11-08T09-06-08Z_design_id_permission_ux` | 2026-11-08 | Design: Permission UX for worlds — pre-connect disclosure, grant modes, and memory | +| 207 | `2026-11-08T10-03-00Z_design_id_recovery_codes` | 2026-11-08 | ID recovery codes (custody variant c) — decision record | +| 217 | `2026-11-08T12-50-00Z_design_id6004_lambdamoo_governance_arc` | 2026-11-08 | Design note: reserved admin authority — what LambdaMOO's governance arc says id must keep off the ballot | +| 220 | `2026-11-08T13-45-00Z_design_id_world_governance` | 2026-11-08 | Design: world governance — moderation-as-library, per-world parameterization, pre-approval | +| 223 | `2026-11-08T15-20-00Z_design_sign-request-nonce-domain.md` | 2026-11-08 | sign_request nonce domain — fallible signing contract (2026-11-08) | +| 226 | `2026-11-08T19-52-00Z_feature_groups_page` | 2026-11-08 | Local groups and grants page at /groups — design record | +| 263 | `2026-11-08_design_id5861.md` | 2026-11-08 | Design: board moderation hooks | +| 267 | `2026-11-08_design_id5871.md` | 2026-11-08 | Design: talk-page semantics — lifecycle, permissions, and binding authority | +| 274 | `2026-11-09T00-16-56Z_decision_id5900_provider_capability_grants.md` | 2026-11-09 | Decision: capability grants for providers — grant shape, sensitivity classes, approval flows | +| 280 | `2026-11-09T05-06-00Z_decision_id5801_encrypted_shares_key_distribution.md` | 2026-11-09 | Decision: encrypted shares & key distribution — share shape, key holders, rotation, recipient proofs | +| 287 | `2026-11-09_decision_id5905_provider_security_model.md` | 2026-11-09 | Decision: provider security model — identity, admission, impersonation, rogue providers, bridge compromise, capability confusion, ceiling-composition | +| 294 | `2026-11-09_design_id6005_moderation_pack_format.md` | 2026-11-09 | Design: moderation pack format — data-only packs with a static policy core, feed subscriptions, and per-world parameters | +| 302 | `2026-11-10T21-05-00Z_design_id6007_moderation_presets` | 2026-11-10 | Moderation preset tiers: named presets that compile to concrete rules | +| 311 | `2026-11-10_design_id5881_stepup_escrow.md` | 2026-11-10 | Design: 2FA step-up gates & org-escrowed credential proxying (id) | +| 312 | `2026-11-10_design_id5887.md` | 2026-11-10 | Design: user-held keys — key custody variant (b) for `id` | +| 319 | `2026-11-11T00-18-00Z_decision_id5898_provider_declaration_model.md` | 2026-11-11 | Decision: provider declaration model — manifest contents, signing, versioning, dynamic vs static capabilities | +| 325 | `2026-11-11T19-15-00Z_design_block_lookup` | 2026-11-11 | Design: block-list lookups that can say "the lookup failed" (#8750) | +| 327 | `2026-11-11_design_id5984_licensing_policy.md` | 2026-11-11 | Design: licensing policy — server ToS uploader grant, account-creation defaults, admin license policies | +| 330 | `2026-11-12T19-10-07Z_design_keyset_authorization_log` | 2026-11-12 | ADR: keyset / authorization log for `id` identity (#2380) | +| 332 | `2026-11-12T20-58-00Z_research_id_permission_precedents` | 2026-11-12 | Research: Permission-prompt precedents — how platforms present, remember, and revoke capability grants | +| 333 | `2026-11-12T22-55-00Z_design_seed_phrase_recovery` | 2026-11-12 | Seed-phrase export/restore for the identity key | +| 339 | `2026-11-13T09-00-00Z_design_blob_gate_authorization_wiring.md` | 2026-11-13 | Design: blob gate authorization wiring in `id serve` (#173) | +| 342 | `2026-11-13_design_id5886.md` | 2026-11-13 | Design: service-held keys — key custody variant (a) for `id` | +| 348 | `2026-11-14T18-50-00Z_design_id_invite_delegation` | 2026-11-14 | Design: generic invite delegation — encoding, depth, leakage, and group live-set semantics | +| 357 | `2026-11-16T11-00-00Z_design_guardian_recovery` | 2026-11-16 | Design: guardian social recovery — record formats, successor-key authority, threshold signing (#2382) | +| 361 | `2026-11-16_decision_id5819_owner_override_mechanics.md` | 2026-11-16 | Decision: owner override mechanics & the encryption boundary (#5819) | +| 370 | `2026-11-17T05-15-00Z_design_id9141_peer_trust_classes.md` | 2026-11-17 | Design (#9141): peer trust classes + signed-data acceptance rule | +| 379 | `2026-11-17_design_id_sign_time_refusal.md` | 2026-11-17 | Sign only what receipt would accept — the sign-time refusal contract for `pkgs/id` | +| 384 | `2026-11-21T04-30-00Z_design_id_delegation_cross_signing_ceremony` | 2026-11-21 | Design: delegation, transfer, and cross-signed identity ceremony | +| 399 | `2026-11-23T05-02-30Z_design_id_capability_change_notices` | 2026-11-23 | Design: capability-change notices on reconnect — presentation, choices, re-baselining, invite pinning | ### Design: sync, replication and FileOps — 39 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 3 | `2026-03-22T00-00-00Z_feature_peer-discovery` | 2026-03-22 | Peer Discovery via iroh-gossip + distributed-topic-tracker | -| 12 | `2026-10-10T02-39-03Z_design_directory_sync` | 2026-10-10 | Directory sync: sessions, friend envelopes, and replication | -| 16 | `2026-10-10T06-00-00Z_research_identity_capabilities` | 2026-10-10 | Research: identity, capabilities, petnames, transport | -| 19 | `2026-10-11T04-48-13Z_feature_takeover_idle_connections` | 2026-10-11 | Takeover passes idle keep-alive connections to the successor | -| 21 | `2026-10-11T11-08-42Z_feature_n0_relay_default` | 2026-10-11 | n0 relays by default: one endpoint policy and dial timeouts | -| 73 | `2026-10-29T11-05-00Z_investigation_multi_hop_relay_and_p2p_media` | 2026-10-29 | Multi-hop relay and P2P media paths — investigation | -| 84 | `2026-10-29T16-21-00Z_design_id_sync_alpn_split` | 2026-10-29 | One `/id-sync/1` handshake, and why serve's range flights moved to | -| 85 | `2026-10-29T16-57-03Z_design_id_sync_range_store_seam` | 2026-10-29 | Wiring `SyncMethod::Range` under the `/id-sync/1` handshake: the per-call lock store seam | -| 87 | `2026-10-30T13-15-00Z_design_id_writer_set_view_projection` | 2026-10-30 | Design: writer-set objects, view projection, and the discovery query for `pkgs/id` | -| 98 | `2026-10-30T19-45-00Z_investigation_playable_posts` | 2026-10-30 | Embedded playable posts — HTML5 mini-games, async challenges, forkable succession saves | -| 108 | `2026-11-01T17-30-12Z_design_host_event_export` | 2026-11-01 | Host-event journal export for world fixtures | -| 115 | `2026-11-01_design_id2036.md` | 2026-11-01 | Design: ID messaging and relay protocol v1 | -| 129 | `2026-11-01_design_id2818.md` | 2026-11-01 | Design: Journaled region-seam handoff for ID worlds | -| 140 | `2026-11-01_design_id785.md` | 2026-11-01 | Design: UDP-denied SSH fallback for `id` | -| 147 | `2026-11-01_design_id806.md` | 2026-11-01 | Design: F12.13 journal replication (read replicas over a signed stream) | -| 155 | `2026-11-02T07-00-00Z_design_save_reservations` | 2026-11-02 | Save reservations: in-flight exclusion for same-file saves | -| 156 | `2026-11-02T08-13-35Z_design_peer-announcement-authentication` | 2026-11-02 | Authenticated peer announcements and bounded discovery | -| 162 | `2026-11-03T02-34-54Z_security_world_replication_authorization` | 2026-11-03 | World replication authorization | -| 164 | `2026-11-03T14-55-00Z_design_id4630_oversized_replication_entries.md` | 2026-11-03 | Design: replicating a journal whose `Checkpoint` entry exceeds the payload bound | -| 175 | `2026-11-05T13-38-00Z_design_id5791_transport_negotiation.md` | 2026-11-05 | Design: transport negotiation & fallback ordering for ID | -| 191 | `2026-11-08T05-48-47Z_design_input_event_model` | 2026-11-08 | Input event model for relayed apps (touch, mouse, hover) | -| 200 | `2026-11-08T09-10-14Z_design_id5899_provider_discovery_negotiation` | 2026-11-08 | Provider discovery & negotiation protocols — decision record | -| 214 | `2026-11-08T11-08-53Z_design_id5813_relay_proxy_protocol` | 2026-11-08 | Design: ID relay and proxy protocol | -| 215 | `2026-11-08T11-10-00Z_design_id_writer_sets_v2` | 2026-11-08 | Design: writer sets v2 — view-as-object, set algebra, federation, discovery v2 | -| 264 | `2026-11-08_design_id5862.md` | 2026-11-08 | Design decision record: board subscription, discovery & feed integration | -| 285 | `2026-11-09_decision_id5810_carrier_framing.md` | 2026-11-09 | Decision: framing and fragmentation across ID carrier classes | -| 288 | `2026-11-09_decision_id5908_payload_boundary.md` | 2026-11-09 | Decision: the payload boundary — decompose-vs-attach decision procedure | -| 292 | `2026-11-09_design_id5838.md` | 2026-11-09 | Design: multi-device sync cluster — knowledge layer (local-first sync, conflicts, offline, E2EE, attachments) | -| 298 | `2026-11-10T19-55-00Z_design_id5796_connect_proxy_traversal.md` | 2026-11-10 | Design: HTTP CONNECT proxy traversal for ID | -| 305 | `2026-11-10T21-50-00Z_research_id806_d1-031-journal-replication` | 2026-11-10 | D1-031 — F12.13 journal replication to signed read replicas: research package | -| 307 | `2026-11-10_decision_id5809_versioning_negotiation.md` | 2026-11-10 | Decision: versioning, negotiation & forward-compatibility policy for the ID wire format | -| 317 | `2026-11-10_rendezvous_discovery_udp_denied_design.md` | 2026-11-10 | Decision record: rendezvous & discovery for UDP-denied clients | -| 336 | `2026-11-12_design_id9004.md` | 2026-11-12 | Design: Joplin continuous sync — target/plugin bridge against the #5848 baseline | -| 345 | `2026-11-14T13-20-00Z_design_id5795_relay_trust` | 2026-11-14 | Relay trust model & broker authorization — decision record (#5795) | -| 355 | `2026-11-16T10-39-25Z_design_id5800_partial_replication_protocol` | 2026-11-16 | Partial replication protocol — subset snapshot, scoped updates, existence privacy, dangling references | -| 356 | `2026-11-16T10-40-00Z_design_id5756_multiplexed_streams_seam.md` | 2026-11-16 | Seam record — multiplexed persistent streams over one tunnel (#5756) | -| 360 | `2026-11-16_decision_id5808_postcard_wire_schema_v1.md` | 2026-11-16 | Decision: postcard wire schema v1 — envelope, discriminators, and golden vectors | -| 366 | `2026-11-16_design_id6287_discovery_registry_federation_v1.md` | 2026-11-16 | Discovery, registry & federation — v1 design (#6287) | -| 394 | `2026-11-23T00-24-00Z_design_journal_ack_modes` | 2026-11-23 | Selectable journal acknowledgement modes for world input | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | --------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------- | +| 3 | `2026-03-22T00-00-00Z_feature_peer-discovery` | 2026-03-22 | Peer Discovery via iroh-gossip + distributed-topic-tracker | +| 12 | `2026-10-10T02-39-03Z_design_directory_sync` | 2026-10-10 | Directory sync: sessions, friend envelopes, and replication | +| 16 | `2026-10-10T06-00-00Z_research_identity_capabilities` | 2026-10-10 | Research: identity, capabilities, petnames, transport | +| 19 | `2026-10-11T04-48-13Z_feature_takeover_idle_connections` | 2026-10-11 | Takeover passes idle keep-alive connections to the successor | +| 21 | `2026-10-11T11-08-42Z_feature_n0_relay_default` | 2026-10-11 | n0 relays by default: one endpoint policy and dial timeouts | +| 73 | `2026-10-29T11-05-00Z_investigation_multi_hop_relay_and_p2p_media` | 2026-10-29 | Multi-hop relay and P2P media paths — investigation | +| 84 | `2026-10-29T16-21-00Z_design_id_sync_alpn_split` | 2026-10-29 | One `/id-sync/1` handshake, and why serve's range flights moved to | +| 85 | `2026-10-29T16-57-03Z_design_id_sync_range_store_seam` | 2026-10-29 | Wiring `SyncMethod::Range` under the `/id-sync/1` handshake: the per-call lock store seam | +| 87 | `2026-10-30T13-15-00Z_design_id_writer_set_view_projection` | 2026-10-30 | Design: writer-set objects, view projection, and the discovery query for `pkgs/id` | +| 98 | `2026-10-30T19-45-00Z_investigation_playable_posts` | 2026-10-30 | Embedded playable posts — HTML5 mini-games, async challenges, forkable succession saves | +| 108 | `2026-11-01T17-30-12Z_design_host_event_export` | 2026-11-01 | Host-event journal export for world fixtures | +| 115 | `2026-11-01_design_id2036.md` | 2026-11-01 | Design: ID messaging and relay protocol v1 | +| 129 | `2026-11-01_design_id2818.md` | 2026-11-01 | Design: Journaled region-seam handoff for ID worlds | +| 140 | `2026-11-01_design_id785.md` | 2026-11-01 | Design: UDP-denied SSH fallback for `id` | +| 147 | `2026-11-01_design_id806.md` | 2026-11-01 | Design: F12.13 journal replication (read replicas over a signed stream) | +| 155 | `2026-11-02T07-00-00Z_design_save_reservations` | 2026-11-02 | Save reservations: in-flight exclusion for same-file saves | +| 156 | `2026-11-02T08-13-35Z_design_peer-announcement-authentication` | 2026-11-02 | Authenticated peer announcements and bounded discovery | +| 162 | `2026-11-03T02-34-54Z_security_world_replication_authorization` | 2026-11-03 | World replication authorization | +| 164 | `2026-11-03T14-55-00Z_design_id4630_oversized_replication_entries.md` | 2026-11-03 | Design: replicating a journal whose `Checkpoint` entry exceeds the payload bound | +| 175 | `2026-11-05T13-38-00Z_design_id5791_transport_negotiation.md` | 2026-11-05 | Design: transport negotiation & fallback ordering for ID | +| 191 | `2026-11-08T05-48-47Z_design_input_event_model` | 2026-11-08 | Input event model for relayed apps (touch, mouse, hover) | +| 200 | `2026-11-08T09-10-14Z_design_id5899_provider_discovery_negotiation` | 2026-11-08 | Provider discovery & negotiation protocols — decision record | +| 214 | `2026-11-08T11-08-53Z_design_id5813_relay_proxy_protocol` | 2026-11-08 | Design: ID relay and proxy protocol | +| 215 | `2026-11-08T11-10-00Z_design_id_writer_sets_v2` | 2026-11-08 | Design: writer sets v2 — view-as-object, set algebra, federation, discovery v2 | +| 264 | `2026-11-08_design_id5862.md` | 2026-11-08 | Design decision record: board subscription, discovery & feed integration | +| 285 | `2026-11-09_decision_id5810_carrier_framing.md` | 2026-11-09 | Decision: framing and fragmentation across ID carrier classes | +| 288 | `2026-11-09_decision_id5908_payload_boundary.md` | 2026-11-09 | Decision: the payload boundary — decompose-vs-attach decision procedure | +| 292 | `2026-11-09_design_id5838.md` | 2026-11-09 | Design: multi-device sync cluster — knowledge layer (local-first sync, conflicts, offline, E2EE, attachments) | +| 298 | `2026-11-10T19-55-00Z_design_id5796_connect_proxy_traversal.md` | 2026-11-10 | Design: HTTP CONNECT proxy traversal for ID | +| 305 | `2026-11-10T21-50-00Z_research_id806_d1-031-journal-replication` | 2026-11-10 | D1-031 — F12.13 journal replication to signed read replicas: research package | +| 307 | `2026-11-10_decision_id5809_versioning_negotiation.md` | 2026-11-10 | Decision: versioning, negotiation & forward-compatibility policy for the ID wire format | +| 317 | `2026-11-10_rendezvous_discovery_udp_denied_design.md` | 2026-11-10 | Decision record: rendezvous & discovery for UDP-denied clients | +| 336 | `2026-11-12_design_id9004.md` | 2026-11-12 | Design: Joplin continuous sync — target/plugin bridge against the #5848 baseline | +| 345 | `2026-11-14T13-20-00Z_design_id5795_relay_trust` | 2026-11-14 | Relay trust model & broker authorization — decision record (#5795) | +| 355 | `2026-11-16T10-39-25Z_design_id5800_partial_replication_protocol` | 2026-11-16 | Partial replication protocol — subset snapshot, scoped updates, existence privacy, dangling references | +| 356 | `2026-11-16T10-40-00Z_design_id5756_multiplexed_streams_seam.md` | 2026-11-16 | Seam record — multiplexed persistent streams over one tunnel (#5756) | +| 360 | `2026-11-16_decision_id5808_postcard_wire_schema_v1.md` | 2026-11-16 | Decision: postcard wire schema v1 — envelope, discriminators, and golden vectors | +| 366 | `2026-11-16_design_id6287_discovery_registry_federation_v1.md` | 2026-11-16 | Discovery, registry & federation — v1 design (#6287) | +| 394 | `2026-11-23T00-24-00Z_design_journal_ack_modes` | 2026-11-23 | Selectable journal acknowledgement modes for world input | ### Design: residency, jurisdiction and boundaries — 11 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 76 | `2026-10-29T11-43-02Z_investigation_do_jurisdiction_pinning` | 2026-10-29 | Investigation: Durable Object jurisdiction / data-location pinning for per-user stores | -| 126 | `2026-11-01_design_id2283.md` | 2026-11-01 | Design: jurisdiction-aware per-user hosted stores | -| 133 | `2026-11-01_design_id3397.md` | 2026-11-01 | Design: jurisdiction-partitioned hosted worlds and world blobs | -| 134 | `2026-11-01_design_id3398.md` | 2026-11-01 | Design: residency boundaries for native bridge, federation and relays | -| 149 | `2026-11-01_investigation_shared_world_residency.md` | 2026-11-01 | Investigation: shared-world residency and federation | -| 150 | `2026-11-01_jurisdiction_aware_user_store_design.md` | 2026-11-01 | Design: jurisdiction-aware hosted user stores | -| 203 | `2026-11-08T09-15-00Z_design_boundary_audit_appeals.md` | 2026-11-08 | Design decision record: boundary audit & appeals UX (id) | -| 244 | `2026-11-08_design_id5683.md` | 2026-11-08 | Design: residency & boundaries framework — declarations, evidence, and enforcement skeleton | -| 293 | `2026-11-09_design_id5876_residency_evidence_model.md` | 2026-11-09 | Design decision record: residency evidence model (id) | -| 297 | `2026-11-10T19-52-00Z_design_id_sanctions_boundary` | 2026-11-10 | Sanctions boundary data model — decision record for #5878 | -| 373 | `2026-11-17T21-55-00Z_design_id8851_boundary_inputs.md` | 2026-11-17 | Design: boundary enforcement inputs — declaration residence, evidence sources, verifier (#8851) | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | ------------------------------------------------------------ | ---------- | ----------------------------------------------------------------------------------------------- | +| 76 | `2026-10-29T11-43-02Z_investigation_do_jurisdiction_pinning` | 2026-10-29 | Investigation: Durable Object jurisdiction / data-location pinning for per-user stores | +| 126 | `2026-11-01_design_id2283.md` | 2026-11-01 | Design: jurisdiction-aware per-user hosted stores | +| 133 | `2026-11-01_design_id3397.md` | 2026-11-01 | Design: jurisdiction-partitioned hosted worlds and world blobs | +| 134 | `2026-11-01_design_id3398.md` | 2026-11-01 | Design: residency boundaries for native bridge, federation and relays | +| 149 | `2026-11-01_investigation_shared_world_residency.md` | 2026-11-01 | Investigation: shared-world residency and federation | +| 150 | `2026-11-01_jurisdiction_aware_user_store_design.md` | 2026-11-01 | Design: jurisdiction-aware hosted user stores | +| 203 | `2026-11-08T09-15-00Z_design_boundary_audit_appeals.md` | 2026-11-08 | Design decision record: boundary audit & appeals UX (id) | +| 244 | `2026-11-08_design_id5683.md` | 2026-11-08 | Design: residency & boundaries framework — declarations, evidence, and enforcement skeleton | +| 293 | `2026-11-09_design_id5876_residency_evidence_model.md` | 2026-11-09 | Design decision record: residency evidence model (id) | +| 297 | `2026-11-10T19-52-00Z_design_id_sanctions_boundary` | 2026-11-10 | Sanctions boundary data model — decision record for #5878 | +| 373 | `2026-11-17T21-55-00Z_design_id8851_boundary_inputs.md` | 2026-11-17 | Design: boundary enforcement inputs — declaration residence, evidence sources, verifier (#8851) | ### Design: hosted and serverless editions — 30 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 31 | `2026-10-14T10-18-19Z_design_p7_2_cloudflare_workers.md` | 2026-10-14 | P7.2 design: Cloudflare Workers pkarr option | -| 68 | `2026-10-28T23-34-14Z_investigation_cloudflare_workers_fit` | 2026-10-28 | Investigation: Fitting the ID Platform onto Cloudflare Workers | -| 74 | `2026-10-29T11-27-00Z_investigation_bridge_semantics_hosted_native` | 2026-10-29 | Investigation: Bridge Semantics — Hosted (HTTPS/WS) Edition Syncing with Native Iroh Nodes | -| 75 | `2026-10-29T11-28-18Z_investigation_key_recovery_hosted` | 2026-10-29 | Key recovery for hosted ID users — Google SSO loss vs the ID keypair | -| 99 | `2026-10-30T22-45-00Z_design_hosted_provisioning_sso_binding.md` | 2026-10-30 | Design spec: hosted provisioning + SSO→ID binding | -| 118 | `2026-11-01_design_id2046.md` | 2026-11-01 | Design: ID serverless edition v1 on Cloudflare Workers | -| 178 | `2026-11-05T15-10-00Z_design_cloudflare_workers_rendezvous_relay.md` | 2026-11-05 | Design: Cloudflare Workers rendezvous/relay component (for #5794) | -| 205 | `2026-11-08T09-45-00Z_design_id5811_wss_https_adapter.md` | 2026-11-08 | Design: adapter — WebSocket/WSS + HTTPS fallback (browser / restrictive-network path) | -| 230 | `2026-11-08T23-22-53Z_design_id_adapter-conformance` | 2026-11-08 | Design: adapter conformance harness & interop matrix CI | -| 237 | `2026-11-08_decision_id5868_cost_limits_guardrails.md` | 2026-11-08 | Decision: cost & limits guardrails for serverless storage | -| 249 | `2026-11-08_design_id5803.md` | 2026-11-08 | Design: shared foreign data-store adapter contract for ID | -| 250 | `2026-11-08_design_id5804.md` | 2026-11-08 | Design: IndexedDB adapter for ID — origin-scoped addressing, live vs materialized reads, structured-clone type mapping, storage limits & eviction | -| 252 | `2026-11-08_design_id5824.md` | 2026-11-08 | Design record — id5824: Stage A — Redis hot store + regular-store system of record | -| 265 | `2026-11-08_design_id5866.md` | 2026-11-08 | Design: local-dev parity for the serverless edition | -| 266 | `2026-11-08_design_id5869.md` | 2026-11-08 | Design: backup, recovery & exit for serverless storage | -| 289 | `2026-11-09_design_id5783.md` | 2026-11-09 | Design: ESP32 hardware platform line — boards, provisioning, firmware lifecycle, OTA, power | -| 290 | `2026-11-09_design_id5815_security_binding.md` | 2026-11-09 | Design: security binding review across adapters & relays | -| 306 | `2026-11-10_decision_id5681_serverless_storage.md` | 2026-11-10 | Decision: serverless edition storage — parent synthesis for #5681 | -| 310 | `2026-11-10_design_id5865.md` | 2026-11-10 | Design: Turso/libSQL journal fit — how libSQL replication composes with the signed journal | -| 318 | `2026-11-11T00-16-00Z_design_id5807_redis_sqlite_export` | 2026-11-11 | Design: Redis→SQLite export + query-Redis-get-SQLite (from #5672) | -| 334 | `2026-11-12T23-04-00Z_design_hosted-editions-workers` | 2026-11-12 | Design intake — hosted editions: PM service, ID service, and fleet tool as workable Cloudflare Workers equivalents | -| 335 | `2026-11-12_decision_id5867_backend_migration.md` | 2026-11-12 | Decision: backend selection and migration for #5867 | -| 344 | `2026-11-14T13-10-00Z_design_id5812_adapter_record.md` | 2026-11-14 | Adapter decision record — WebRTC, TCP/TLS, local IPC (#5812) | -| 365 | `2026-11-16_design_id6283_hosted_worlds_v1.md` | 2026-11-16 | Hosted worlds & always-on hosting — v1 design (#6283) | -| 372 | `2026-11-17T16-55-00Z_design_hosted-tenancy-architecture` | 2026-11-17 | Design (component E): hosted tenancy architecture — per-user Turso databases + a central tenancy DB | -| 375 | `2026-11-17_decision_id5863_storage_contract.md` | 2026-11-17 | Decision: the serverless storage contract (journal, world state, indexes) | -| 376 | `2026-11-17_decision_id5864_d1_journal_fit.md` | 2026-11-17 | Design: D1 journal fit — ordering, sessions, and replication against the signed journal | -| 385 | `2026-11-21T21-40-00Z_design_self_hosted-tier-adapters` | 2026-11-21 | Self-hosted tier: storage, transport, and placement adapter design | -| 396 | `2026-11-23T03-04-00Z_design_content-addressed-media-data-plane` | 2026-11-23 | Content-addressed media/data plane: reference-based access and GC (component F) | -| 398 | `2026-11-23T05-00-00Z_design_bridge_v1_implementation` | 2026-11-23 | The hosted signed-object bridge v1 — implementation record (#3818) | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | -------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| 31 | `2026-10-14T10-18-19Z_design_p7_2_cloudflare_workers.md` | 2026-10-14 | P7.2 design: Cloudflare Workers pkarr option | +| 68 | `2026-10-28T23-34-14Z_investigation_cloudflare_workers_fit` | 2026-10-28 | Investigation: Fitting the ID Platform onto Cloudflare Workers | +| 74 | `2026-10-29T11-27-00Z_investigation_bridge_semantics_hosted_native` | 2026-10-29 | Investigation: Bridge Semantics — Hosted (HTTPS/WS) Edition Syncing with Native Iroh Nodes | +| 75 | `2026-10-29T11-28-18Z_investigation_key_recovery_hosted` | 2026-10-29 | Key recovery for hosted ID users — Google SSO loss vs the ID keypair | +| 99 | `2026-10-30T22-45-00Z_design_hosted_provisioning_sso_binding.md` | 2026-10-30 | Design spec: hosted provisioning + SSO→ID binding | +| 118 | `2026-11-01_design_id2046.md` | 2026-11-01 | Design: ID serverless edition v1 on Cloudflare Workers | +| 178 | `2026-11-05T15-10-00Z_design_cloudflare_workers_rendezvous_relay.md` | 2026-11-05 | Design: Cloudflare Workers rendezvous/relay component (for #5794) | +| 205 | `2026-11-08T09-45-00Z_design_id5811_wss_https_adapter.md` | 2026-11-08 | Design: adapter — WebSocket/WSS + HTTPS fallback (browser / restrictive-network path) | +| 230 | `2026-11-08T23-22-53Z_design_id_adapter-conformance` | 2026-11-08 | Design: adapter conformance harness & interop matrix CI | +| 237 | `2026-11-08_decision_id5868_cost_limits_guardrails.md` | 2026-11-08 | Decision: cost & limits guardrails for serverless storage | +| 249 | `2026-11-08_design_id5803.md` | 2026-11-08 | Design: shared foreign data-store adapter contract for ID | +| 250 | `2026-11-08_design_id5804.md` | 2026-11-08 | Design: IndexedDB adapter for ID — origin-scoped addressing, live vs materialized reads, structured-clone type mapping, storage limits & eviction | +| 252 | `2026-11-08_design_id5824.md` | 2026-11-08 | Design record — id5824: Stage A — Redis hot store + regular-store system of record | +| 265 | `2026-11-08_design_id5866.md` | 2026-11-08 | Design: local-dev parity for the serverless edition | +| 266 | `2026-11-08_design_id5869.md` | 2026-11-08 | Design: backup, recovery & exit for serverless storage | +| 289 | `2026-11-09_design_id5783.md` | 2026-11-09 | Design: ESP32 hardware platform line — boards, provisioning, firmware lifecycle, OTA, power | +| 290 | `2026-11-09_design_id5815_security_binding.md` | 2026-11-09 | Design: security binding review across adapters & relays | +| 306 | `2026-11-10_decision_id5681_serverless_storage.md` | 2026-11-10 | Decision: serverless edition storage — parent synthesis for #5681 | +| 310 | `2026-11-10_design_id5865.md` | 2026-11-10 | Design: Turso/libSQL journal fit — how libSQL replication composes with the signed journal | +| 318 | `2026-11-11T00-16-00Z_design_id5807_redis_sqlite_export` | 2026-11-11 | Design: Redis→SQLite export + query-Redis-get-SQLite (from #5672) | +| 334 | `2026-11-12T23-04-00Z_design_hosted-editions-workers` | 2026-11-12 | Design intake — hosted editions: PM service, ID service, and fleet tool as workable Cloudflare Workers equivalents | +| 335 | `2026-11-12_decision_id5867_backend_migration.md` | 2026-11-12 | Decision: backend selection and migration for #5867 | +| 344 | `2026-11-14T13-10-00Z_design_id5812_adapter_record.md` | 2026-11-14 | Adapter decision record — WebRTC, TCP/TLS, local IPC (#5812) | +| 365 | `2026-11-16_design_id6283_hosted_worlds_v1.md` | 2026-11-16 | Hosted worlds & always-on hosting — v1 design (#6283) | +| 372 | `2026-11-17T16-55-00Z_design_hosted-tenancy-architecture` | 2026-11-17 | Design (component E): hosted tenancy architecture — per-user Turso databases + a central tenancy DB | +| 375 | `2026-11-17_decision_id5863_storage_contract.md` | 2026-11-17 | Decision: the serverless storage contract (journal, world state, indexes) | +| 376 | `2026-11-17_decision_id5864_d1_journal_fit.md` | 2026-11-17 | Design: D1 journal fit — ordering, sessions, and replication against the signed journal | +| 385 | `2026-11-21T21-40-00Z_design_self_hosted-tier-adapters` | 2026-11-21 | Self-hosted tier: storage, transport, and placement adapter design | +| 396 | `2026-11-23T03-04-00Z_design_content-addressed-media-data-plane` | 2026-11-23 | Content-addressed media/data plane: reference-based access and GC (component F) | +| 398 | `2026-11-23T05-00-00Z_design_bridge_v1_implementation` | 2026-11-23 | The hosted signed-object bridge v1 — implementation record (#3818) | ### Design: shells and client surfaces — 43 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 7 | `2026-04-01T00-00-00Z_feature_image_upload` | 2026-04-01 | Image Upload: Paste, Drag-Drop, and Toolbar Insert | -| 37 | `2026-10-15T16-00-00Z_feature_world_viewport_and_paste` | 2026-10-15 | Per-session world viewport and paste policy | -| 38 | `2026-10-15T16-30-00Z_feature_terminal_buffer_capture` | 2026-10-15 | Terminal buffer capture interface | -| 45 | `2026-10-16T13-00-00Z_feature_world_apps_structured_migration` | 2026-10-16 | Structured World Apps Migration to RocJson and Screen | -| 46 | `2026-10-16T14-00-00Z_feature_screen_render_alignment` | 2026-10-16 | Portable Screen Rendering for Territory and a Host Allocator Alignment Fix | -| 52 | `2026-10-16T19-00-00Z_feature_guest_reflow` | 2026-10-16 | Guest-aware reflow: a `layout` entry point | -| 53 | `2026-10-16T19-30-00Z_feature_screen_widgets` | 2026-10-16 | Screen widgets and `RocText` | -| 64 | `2026-10-24T20-18-37Z_decision_ssh_input_modes` | 2026-10-24 | SSH input modes: raw by default, `cmd:` line mode, and the username grammar | -| 66 | `2026-10-25T05-54-40Z_reference_shell_contract` | 2026-10-25 | The id shell contract, version 1 | -| 101 | `2026-10-31T17-47-20Z_design_world_presentation_and_fuel` | 2026-10-31 | World presentation, rendering, and fuel: the current model | -| 110 | `2026-11-01T17-54-35Z_design_id_concurrent_world_sessions` | 2026-11-01 | F13.8 concurrent world sessions: client coordinator | -| 121 | `2026-11-01_design_id2054.md` | 2026-11-01 | Design: ID boards v1 — signed boards, portable themes, and playable posts | -| 135 | `2026-11-01_design_id3455.md` | 2026-11-01 | Design: a value cannot act on the terminal — one Cf contract for `pkgs/id` plain output | -| 143 | `2026-11-01_design_id788.md` | 2026-11-01 | Design: Native reference shell for `id` (F13.6) | -| 145 | `2026-11-01_design_id790.md` | 2026-11-01 | Design: F13.8 multi-server and multi-client topology | -| 159 | `2026-11-02T_reference_kitty_disambiguate_v1.md` | — | kitty-disambiguate-v1 profile reference | -| 193 | `2026-11-08T06-45-00Z_design_id_query_local_remote_v1` | 2026-11-08 | Querying local and remote ID servers — v1 design | -| 194 | `2026-11-08T08-10-00Z_design_id5782_graphical_client_tooling.md` | 2026-11-08 | Graphical client & tooling surface — v1 design | -| 209 | `2026-11-08T10-26-00Z_design_id5996_hot_swap_decision` | 2026-11-08 | Design: hot-swap alternatives — decision record for the v1 mechanism | -| 210 | `2026-11-08T10-26-00Z_design_id_per_user_function_mapping` | 2026-11-08 | Design: per-user function mapping — bot battles, strategy hot-switching, human+AI-partner composition | -| 227 | `2026-11-08T22-06-00Z_design_id_android_client` | 2026-11-08 | Design: a native Android client for ID | -| 232 | `2026-11-08_decision_id5849_semantic_markup_vocabulary_v1.md` | 2026-11-08 | Decision: semantic markup vocabulary v1 — element set and authoring syntax | -| 233 | `2026-11-08_decision_id5852_native_rendering_os_standard_controls.md` | 2026-11-08 | Decision: native rendering — assertion → OS-standard controls | -| 234 | `2026-11-08_decision_id5853_custom_gui_rendering_overrides.md` | 2026-11-08 | Decision: custom GUI rendering as first-class overrides | -| 235 | `2026-11-08_decision_id5854_per_target_composition.md` | 2026-11-08 | Decision: per-target composition — themes, overrides, assets, conditional blocks | -| 236 | `2026-11-08_decision_id5855_rendering_pipeline_conformance.md` | 2026-11-08 | Decision: rendering pipeline & conformance suite — compile/runtime split, per-target expected-output tests, author tooling/linting | -| 243 | `2026-11-08_decision_id5910_kdl_presentation_surfaces.md` | 2026-11-08 | Decision: KDL presentation surfaces — export, hand upload, agent statements | -| 246 | `2026-11-08_design_id5781.md` | 2026-11-08 | Design: Bevy incorporation — ID worlds as Bevy applications | -| 247 | `2026-11-08_design_id5785.md` | 2026-11-08 | Design: output safety beyond plain text — markup contexts, safe-plain as a user choice, ingest without evaluation, and the ANSI/OSC disposition | -| 251 | `2026-11-08_design_id5820.md` | 2026-11-08 | Design: client surfaces parity — scripting/API, agent, and CLI front doors over one query model | -| 268 | `2026-11-08_design_id5873.md` | 2026-11-08 | Design: terminal participation in object discussions | -| 270 | `2026-11-08_design_id6012_visual_feature_cost_ranking.md` | 2026-11-08 | Design: visual-feature cost ranking | -| 275 | `2026-11-09T01-10-00Z_design_id_search_ranking` | 2026-11-09 | Personalized search ranking for notes — decision record | -| 286 | `2026-11-09_decision_id5851_assertion_tailwind_mapping.md` | 2026-11-09 | Decision: web rendering — assertion → Tailwind mapping | -| 301 | `2026-11-10T20-40-00Z_design_more_shells_v1` | 2026-11-10 | More shells v1 — first-iteration design (mobile, native, hardware) | -| 308 | `2026-11-10_decision_id5818_remote_filtered_query.md` | 2026-11-10 | Decision: server-side filtered remote query execution | -| 309 | `2026-11-10_design_id5858.md` | 2026-11-10 | Design decision record: portable theme format & precedence | -| 347 | `2026-11-14T13-50-00Z_design_id_roc_library_imports` | 2026-11-14 | Design: Roc library imports for worlds — platform-requirement representation, subset checking, provenance, and import errors | -| 350 | `2026-11-14_decision_id5907_triple_decomposition.md` | 2026-11-14 | Decision: triple decomposition rules for KDL statements | -| 358 | `2026-11-16T13-00-00Z_design_id5964_dynamic_user_functions` | 2026-11-16 | Design: dynamic user functions — interface contract, compile pipeline, and v1 placement | -| 371 | `2026-11-17T15-40-00Z_design_id_federated_query_fanout` | 2026-11-17 | Federated query fan-out — design record (#9144) | -| 377 | `2026-11-17_design_id6010_semantic_cell_tag_model.md` | 2026-11-17 | Design: semantic cell/tag presentation model — one tagged state, many renderers | -| 397 | `2026-11-23T03-17-14Z_design_more_shells_v2` | 2026-11-23 | More shells v2 — outline: native & TUI completion | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | --------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| 7 | `2026-04-01T00-00-00Z_feature_image_upload` | 2026-04-01 | Image Upload: Paste, Drag-Drop, and Toolbar Insert | +| 37 | `2026-10-15T16-00-00Z_feature_world_viewport_and_paste` | 2026-10-15 | Per-session world viewport and paste policy | +| 38 | `2026-10-15T16-30-00Z_feature_terminal_buffer_capture` | 2026-10-15 | Terminal buffer capture interface | +| 45 | `2026-10-16T13-00-00Z_feature_world_apps_structured_migration` | 2026-10-16 | Structured World Apps Migration to RocJson and Screen | +| 46 | `2026-10-16T14-00-00Z_feature_screen_render_alignment` | 2026-10-16 | Portable Screen Rendering for Territory and a Host Allocator Alignment Fix | +| 52 | `2026-10-16T19-00-00Z_feature_guest_reflow` | 2026-10-16 | Guest-aware reflow: a `layout` entry point | +| 53 | `2026-10-16T19-30-00Z_feature_screen_widgets` | 2026-10-16 | Screen widgets and `RocText` | +| 64 | `2026-10-24T20-18-37Z_decision_ssh_input_modes` | 2026-10-24 | SSH input modes: raw by default, `cmd:` line mode, and the username grammar | +| 66 | `2026-10-25T05-54-40Z_reference_shell_contract` | 2026-10-25 | The id shell contract, version 1 | +| 101 | `2026-10-31T17-47-20Z_design_world_presentation_and_fuel` | 2026-10-31 | World presentation, rendering, and fuel: the current model | +| 110 | `2026-11-01T17-54-35Z_design_id_concurrent_world_sessions` | 2026-11-01 | F13.8 concurrent world sessions: client coordinator | +| 121 | `2026-11-01_design_id2054.md` | 2026-11-01 | Design: ID boards v1 — signed boards, portable themes, and playable posts | +| 135 | `2026-11-01_design_id3455.md` | 2026-11-01 | Design: a value cannot act on the terminal — one Cf contract for `pkgs/id` plain output | +| 143 | `2026-11-01_design_id788.md` | 2026-11-01 | Design: Native reference shell for `id` (F13.6) | +| 145 | `2026-11-01_design_id790.md` | 2026-11-01 | Design: F13.8 multi-server and multi-client topology | +| 159 | `2026-11-02T_reference_kitty_disambiguate_v1.md` | — | kitty-disambiguate-v1 profile reference | +| 193 | `2026-11-08T06-45-00Z_design_id_query_local_remote_v1` | 2026-11-08 | Querying local and remote ID servers — v1 design | +| 194 | `2026-11-08T08-10-00Z_design_id5782_graphical_client_tooling.md` | 2026-11-08 | Graphical client & tooling surface — v1 design | +| 209 | `2026-11-08T10-26-00Z_design_id5996_hot_swap_decision` | 2026-11-08 | Design: hot-swap alternatives — decision record for the v1 mechanism | +| 210 | `2026-11-08T10-26-00Z_design_id_per_user_function_mapping` | 2026-11-08 | Design: per-user function mapping — bot battles, strategy hot-switching, human+AI-partner composition | +| 227 | `2026-11-08T22-06-00Z_design_id_android_client` | 2026-11-08 | Design: a native Android client for ID | +| 232 | `2026-11-08_decision_id5849_semantic_markup_vocabulary_v1.md` | 2026-11-08 | Decision: semantic markup vocabulary v1 — element set and authoring syntax | +| 233 | `2026-11-08_decision_id5852_native_rendering_os_standard_controls.md` | 2026-11-08 | Decision: native rendering — assertion → OS-standard controls | +| 234 | `2026-11-08_decision_id5853_custom_gui_rendering_overrides.md` | 2026-11-08 | Decision: custom GUI rendering as first-class overrides | +| 235 | `2026-11-08_decision_id5854_per_target_composition.md` | 2026-11-08 | Decision: per-target composition — themes, overrides, assets, conditional blocks | +| 236 | `2026-11-08_decision_id5855_rendering_pipeline_conformance.md` | 2026-11-08 | Decision: rendering pipeline & conformance suite — compile/runtime split, per-target expected-output tests, author tooling/linting | +| 243 | `2026-11-08_decision_id5910_kdl_presentation_surfaces.md` | 2026-11-08 | Decision: KDL presentation surfaces — export, hand upload, agent statements | +| 246 | `2026-11-08_design_id5781.md` | 2026-11-08 | Design: Bevy incorporation — ID worlds as Bevy applications | +| 247 | `2026-11-08_design_id5785.md` | 2026-11-08 | Design: output safety beyond plain text — markup contexts, safe-plain as a user choice, ingest without evaluation, and the ANSI/OSC disposition | +| 251 | `2026-11-08_design_id5820.md` | 2026-11-08 | Design: client surfaces parity — scripting/API, agent, and CLI front doors over one query model | +| 268 | `2026-11-08_design_id5873.md` | 2026-11-08 | Design: terminal participation in object discussions | +| 270 | `2026-11-08_design_id6012_visual_feature_cost_ranking.md` | 2026-11-08 | Design: visual-feature cost ranking | +| 275 | `2026-11-09T01-10-00Z_design_id_search_ranking` | 2026-11-09 | Personalized search ranking for notes — decision record | +| 286 | `2026-11-09_decision_id5851_assertion_tailwind_mapping.md` | 2026-11-09 | Decision: web rendering — assertion → Tailwind mapping | +| 301 | `2026-11-10T20-40-00Z_design_more_shells_v1` | 2026-11-10 | More shells v1 — first-iteration design (mobile, native, hardware) | +| 308 | `2026-11-10_decision_id5818_remote_filtered_query.md` | 2026-11-10 | Decision: server-side filtered remote query execution | +| 309 | `2026-11-10_design_id5858.md` | 2026-11-10 | Design decision record: portable theme format & precedence | +| 347 | `2026-11-14T13-50-00Z_design_id_roc_library_imports` | 2026-11-14 | Design: Roc library imports for worlds — platform-requirement representation, subset checking, provenance, and import errors | +| 350 | `2026-11-14_decision_id5907_triple_decomposition.md` | 2026-11-14 | Decision: triple decomposition rules for KDL statements | +| 358 | `2026-11-16T13-00-00Z_design_id5964_dynamic_user_functions` | 2026-11-16 | Design: dynamic user functions — interface contract, compile pipeline, and v1 placement | +| 371 | `2026-11-17T15-40-00Z_design_id_federated_query_fanout` | 2026-11-17 | Federated query fan-out — design record (#9144) | +| 377 | `2026-11-17_design_id6010_semantic_cell_tag_model.md` | 2026-11-17 | Design: semantic cell/tag presentation model — one tagged state, many renderers | +| 397 | `2026-11-23T03-17-14Z_design_more_shells_v2` | 2026-11-23 | More shells v2 — outline: native & TUI completion | ### Design: agents in worlds and the MCP bridge — 6 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 295 | `2026-11-09_design_id6300_agents_in_worlds_v1.md` | 2026-11-09 | Agents in worlds (MCP bridge) — v1 design + spike plan (#6300) | -| 315 | `2026-11-10_design_id6301_agents_as_citizens_v2_outline.md` | 2026-11-10 | Agents in worlds (MCP bridge) — v2 outline: agents as citizens (#6301) | -| 352 | `2026-11-14_design_id6302_shared_agent_worlds_v3_outline.md` | 2026-11-14 | Agents in worlds (MCP bridge) — v3 outline: shared agent worlds (#6302) | -| 367 | `2026-11-16_design_id6303_hosted_agent_services_v4_outline.md` | 2026-11-16 | Agents in worlds (MCP bridge) — v4 outline: hosted agent services (#6303) | -| 383 | `2026-11-20T13-35-00Z_design_id10662_hosted_agent_service_listing` | 2026-11-20 | Hosted agent service listings: design record for v4 step 1 | -| 403 | `2026-11-23T12-46-33Z_design_id10662_listing_record` | 2026-11-23 | Listing record + registry protocol — the v4 registry's record family, signing, versioning, suspension/delisting, and discovery query | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | ------------------------------------------------------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| 295 | `2026-11-09_design_id6300_agents_in_worlds_v1.md` | 2026-11-09 | Agents in worlds (MCP bridge) — v1 design + spike plan (#6300) | +| 315 | `2026-11-10_design_id6301_agents_as_citizens_v2_outline.md` | 2026-11-10 | Agents in worlds (MCP bridge) — v2 outline: agents as citizens (#6301) | +| 352 | `2026-11-14_design_id6302_shared_agent_worlds_v3_outline.md` | 2026-11-14 | Agents in worlds (MCP bridge) — v3 outline: shared agent worlds (#6302) | +| 367 | `2026-11-16_design_id6303_hosted_agent_services_v4_outline.md` | 2026-11-16 | Agents in worlds (MCP bridge) — v4 outline: hosted agent services (#6303) | +| 383 | `2026-11-20T13-35-00Z_design_id10662_hosted_agent_service_listing` | 2026-11-20 | Hosted agent service listings: design record for v4 step 1 | +| 403 | `2026-11-23T12-46-33Z_design_id10662_listing_record` | 2026-11-23 | Listing record + registry protocol — the v4 registry's record family, signing, versioning, suspension/delisting, and discovery query | ### Design: currency, tokens and metering — 26 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 2 | `2026-03-21T05-47-48Z_feature_content_modes` | 2026-03-21 | Content Modes, Format Conversion & Media Viewing | -| 69 | `2026-10-28T23-34-15Z_investigation_tigerbeetle_currency_backend` | 2026-10-28 | TigerBeetle as the accounting backend for dynamic ID currencies — investigation | -| 77 | `2026-10-29T11-57-00Z_investigation_tigerbeetle_cluster_topology` | 2026-10-29 | TigerBeetle cluster topology decision — 3 vs 6 replicas, site placement, commit latency | -| 78 | `2026-10-29T12-10-00Z_design_refundable_grants_pending_transfers` | 2026-10-29 | Refundable grants via pending transfers — premium tokens that survive a refund | -| 79 | `2026-10-29T12-20-00Z_design_currency_centralised_exception` | 2026-10-29 | Design: currency as the centralised exception — the hosted edition's boundary to the currency service | -| 80 | `2026-10-29T12-42-21Z_design_currency_control_plane` | 2026-10-29 | Currency control plane — design: registry, account factory, gateway | -| 86 | `2026-10-30T11-55-00Z_design_grant_lifecycle.md` | 2026-10-30 | Grant lifecycle implementation spec — pending holds, fingerprint registry, clawback/shortfall, revocation policy | -| 89 | `2026-10-30T13-25-00Z_design_graph_token_formats_snapshot_anchoring.md` | 2026-10-30 | Design: graph token object formats + snapshot anchoring | -| 91 | `2026-10-30T19-18-00Z_investigation_token_issuance_id_graph` | 2026-10-30 | Token issuance in the ID graph — investigation: per-ID issuance, issuer snapshots, authorized conversion rates | -| 117 | `2026-11-01_design_id2043.md` | 2026-11-01 | Design: ID currencies v1 | -| 122 | `2026-11-01_design_id2063.md` | 2026-11-01 | Design: ID conversion engine — linked transfer pairs and rate authorisation | -| 127 | `2026-11-01_design_id2290.md` | 2026-11-01 | Design: RateAuthorisation as a signed ID-graph object | -| 165 | `2026-11-03T20-36-00Z_design_tigerbeetle_ledger_binding` | 2026-11-03 | Design: TigerBeetle LedgerBackend binding (`tb_ledger`) | -| 180 | `2026-11-05_design_id5828.md` | 2026-11-05 | Design: conversion & RateAuthorisation across the #5676 currency stages | -| 186 | `2026-11-07T03-55-49Z_feature_graph_currency_contracts` | 2026-11-07 | Graph-native currency event contracts | -| 222 | `2026-11-08T14-05-49Z_design_id2043_extension.md` | 2026-11-08 | Design: ID tokens v1 — extension for the user's 2026-11-08 rulings | -| 241 | `2026-11-08_decision_id5906_kdl_json_contract.md` | 2026-11-08 | Decision: KDL ⇄ JSON canonical conversion and round-trip contract | -| 253 | `2026-11-08_design_id5829.md` | 2026-11-08 | Design: currency load & correctness verification programme | -| 273 | `2026-11-09T00-10-25Z_research_id5966_gas_timeouts_multithreading` | 2026-11-09 | Research: per-function gas metering, timeouts, and multithreading for user functions | -| 296 | `2026-11-10T03-10-00Z_design_id_two_level_metering` | 2026-11-10 | Design: two-level metering — burst bucket + hard per-tick ceiling, per function | -| 328 | `2026-11-11_design_id6016_metering_record_flow.md` | 2026-11-11 | Design: per-function metering record shape and flow — where metering data goes if servers charge by function class | -| 343 | `2026-11-14T06-22-00Z_poc_currency_gateway_boundary_results` | 2026-11-14 | PoC results — currency gateway boundary (#2298) | -| 351 | `2026-11-14_design_id5823.md` | 2026-11-14 | Design record — id5823: currency backend port + invariant test-suite contract | -| 362 | `2026-11-16_design_id5825.md` | 2026-11-16 | Design record — id5825: currency autoscaling — stateless front-end, hot-account mitigations, scaling triggers | -| 363 | `2026-11-16_design_id5826.md` | 2026-11-16 | Design record — id5826: Stage B — multi-Turso sharding by currency | -| 364 | `2026-11-16_design_id5827.md` | 2026-11-16 | Design record — id5827: Stage C — TigerBeetle adapter + B→C cutover | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | ----------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------ | +| 2 | `2026-03-21T05-47-48Z_feature_content_modes` | 2026-03-21 | Content Modes, Format Conversion & Media Viewing | +| 69 | `2026-10-28T23-34-15Z_investigation_tigerbeetle_currency_backend` | 2026-10-28 | TigerBeetle as the accounting backend for dynamic ID currencies — investigation | +| 77 | `2026-10-29T11-57-00Z_investigation_tigerbeetle_cluster_topology` | 2026-10-29 | TigerBeetle cluster topology decision — 3 vs 6 replicas, site placement, commit latency | +| 78 | `2026-10-29T12-10-00Z_design_refundable_grants_pending_transfers` | 2026-10-29 | Refundable grants via pending transfers — premium tokens that survive a refund | +| 79 | `2026-10-29T12-20-00Z_design_currency_centralised_exception` | 2026-10-29 | Design: currency as the centralised exception — the hosted edition's boundary to the currency service | +| 80 | `2026-10-29T12-42-21Z_design_currency_control_plane` | 2026-10-29 | Currency control plane — design: registry, account factory, gateway | +| 86 | `2026-10-30T11-55-00Z_design_grant_lifecycle.md` | 2026-10-30 | Grant lifecycle implementation spec — pending holds, fingerprint registry, clawback/shortfall, revocation policy | +| 89 | `2026-10-30T13-25-00Z_design_graph_token_formats_snapshot_anchoring.md` | 2026-10-30 | Design: graph token object formats + snapshot anchoring | +| 91 | `2026-10-30T19-18-00Z_investigation_token_issuance_id_graph` | 2026-10-30 | Token issuance in the ID graph — investigation: per-ID issuance, issuer snapshots, authorized conversion rates | +| 117 | `2026-11-01_design_id2043.md` | 2026-11-01 | Design: ID currencies v1 | +| 122 | `2026-11-01_design_id2063.md` | 2026-11-01 | Design: ID conversion engine — linked transfer pairs and rate authorisation | +| 127 | `2026-11-01_design_id2290.md` | 2026-11-01 | Design: RateAuthorisation as a signed ID-graph object | +| 165 | `2026-11-03T20-36-00Z_design_tigerbeetle_ledger_binding` | 2026-11-03 | Design: TigerBeetle LedgerBackend binding (`tb_ledger`) | +| 180 | `2026-11-05_design_id5828.md` | 2026-11-05 | Design: conversion & RateAuthorisation across the #5676 currency stages | +| 186 | `2026-11-07T03-55-49Z_feature_graph_currency_contracts` | 2026-11-07 | Graph-native currency event contracts | +| 222 | `2026-11-08T14-05-49Z_design_id2043_extension.md` | 2026-11-08 | Design: ID tokens v1 — extension for the user's 2026-11-08 rulings | +| 241 | `2026-11-08_decision_id5906_kdl_json_contract.md` | 2026-11-08 | Decision: KDL ⇄ JSON canonical conversion and round-trip contract | +| 253 | `2026-11-08_design_id5829.md` | 2026-11-08 | Design: currency load & correctness verification programme | +| 273 | `2026-11-09T00-10-25Z_research_id5966_gas_timeouts_multithreading` | 2026-11-09 | Research: per-function gas metering, timeouts, and multithreading for user functions | +| 296 | `2026-11-10T03-10-00Z_design_id_two_level_metering` | 2026-11-10 | Design: two-level metering — burst bucket + hard per-tick ceiling, per function | +| 328 | `2026-11-11_design_id6016_metering_record_flow.md` | 2026-11-11 | Design: per-function metering record shape and flow — where metering data goes if servers charge by function class | +| 343 | `2026-11-14T06-22-00Z_poc_currency_gateway_boundary_results` | 2026-11-14 | PoC results — currency gateway boundary (#2298) | +| 351 | `2026-11-14_design_id5823.md` | 2026-11-14 | Design record — id5823: currency backend port + invariant test-suite contract | +| 362 | `2026-11-16_design_id5825.md` | 2026-11-16 | Design record — id5825: currency autoscaling — stateless front-end, hot-account mitigations, scaling triggers | +| 363 | `2026-11-16_design_id5826.md` | 2026-11-16 | Design record — id5826: Stage B — multi-Turso sharding by currency | +| 364 | `2026-11-16_design_id5827.md` | 2026-11-16 | Design record — id5827: Stage C — TigerBeetle adapter + B→C cutover | ### Design: the knowledge layer — 31 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 5 | `2026-03-23T12-00-00Z_feature_metadata_tags` | 2026-03-23 | Metadata Tag System | -| 104 | `2026-11-01T16-05-00Z_design_documents_session_frames` | 2026-11-01 | D1-040 — Documents as a session frame pair (web/CLI parity) | -| 119 | `2026-11-01_design_id2048.md` | 2026-11-01 | Design: Zettelkasten layer — multiplayer docs/wiki on ID | -| 154 | `2026-11-02T04-52-00Z_feature_note_link_backlink_projection` | 2026-11-02 | Note links and the head-based backlink projection | -| 181 | `2026-11-05_design_id5965.md` | 2026-11-05 | Design: compile economics — compiled-world/DLL caching, compile-cost penalties, premium gating | -| 182 | `2026-11-05_design_id5997.md` | 2026-11-05 | Design: effect-language borrowings — which Koka/Unison properties id tooling emulates, approximates, or skips | -| 188 | `2026-11-08T00-45-00Z_design_id_recommendations` | 2026-11-08 | ID recommendations across all object types — v1 design | -| 196 | `2026-11-08T08-53-12Z_design_onenote_importer` | 2026-11-08 | Design: OneNote import into the ID knowledge layer | -| 213 | `2026-11-08T11-06-39Z_design_id_draft_approval_flow` | 2026-11-08 | Design: Draft approval queues, outcomes, and rejected-draft forks | -| 221 | `2026-11-08T13-55-51Z_design_agent_note_placement` | 2026-11-08 | Design: where agent notes live — scratch, memory, repo, Zettelkasten, or ID graph | -| 225 | `2026-11-08T17-23-00Z_design_id5963_programming_model` | 2026-11-08 | Design: explicit platform contexts for pure libraries | -| 238 | `2026-11-08_decision_id5874_thread_resolution.md` | 2026-11-08 | Decision: thread resolution and the discussion→edit loop (resolved-into links and change proposals) | -| 254 | `2026-11-08_design_id5830.md` | 2026-11-08 | Design: note→board sharing model — embedded live references, version semantics, reply anchoring, backlinks, cross-server case | -| 255 | `2026-11-08_design_id5832.md` | 2026-11-08 | Design: multiplayer edit sessions — UX, lifecycle, and participation (issue #5832) | -| 256 | `2026-11-08_design_id5837.md` | 2026-11-08 | Design: knowledge graph view cluster — local/global, edges, filters, scale, live behaviour | -| 257 | `2026-11-08_design_id5845.md` | 2026-11-08 | Obsidian importer — design record for the #2048 object model | -| 258 | `2026-11-08_design_id5846.md` | 2026-11-08 | Design: Evernote importer into the #2048 object model | -| 259 | `2026-11-08_design_id5847.md` | 2026-11-08 | Design: importer design — Logseq into the #2048 object model | -| 260 | `2026-11-08_design_id5848.md` | 2026-11-08 | Design: importer design — Joplin into the #2048 object model | -| 269 | `2026-11-08_design_id5969.md` | 2026-11-08 | Design: library typing & upload taxonomy — subtypes, entity attachment, DLL vs compile-in, libraries by URL | -| 272 | `2026-11-08_design_id6439_knowledge-interchange-and-export.md` | 2026-11-08 | Design: ID knowledge-layer interchange and full-fidelity export | -| 277 | `2026-11-09T03-57-04Z_design_id_edit_fork_graph` | 2026-11-09 | Edit/fork graph for notes — decision record | -| 291 | `2026-11-09_design_id5821.md` | 2026-11-09 | ID queries: result shaping & cursor pagination — decision record | -| 299 | `2026-11-10T20-00-00Z_design_agent_note_placement.md` | 2026-11-10 | Design: where agent notes live — placement rule for zettel vs repo vs ID graph | -| 300 | `2026-11-10T20-12-00Z_design_id_content_model` | 2026-11-10 | Content model cluster — decision record for #5839 | -| 304 | `2026-11-10T21-45-00Z_design_ai_over_notes` | 2026-11-10 | AI-over-notes: source-grounded Q&A, citations, and read-authority | -| 316 | `2026-11-10_design_id6436.md` | 2026-11-10 | Design: importer design — Notion into the #2048 object model | -| 329 | `2026-11-11_roc_library_evidence_5995.md` | 2026-11-11 | Roc shared-library outputs and host loading: evidence for #5995 | -| 406 | `knowledge-layer-attachments-media-5844.md` | — | Knowledge layer — attachments & media cluster decision record (#5844) | -| 407 | `knowledge-layer-extensibility-5843.md` | — | Knowledge layer — extensibility cluster decision record (#5843) | -| 408 | `knowledge-layer-feature-matrix-6435.md` | — | Knowledge-layer feature matrix — issue #6435 (program #5678) | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | -------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- | +| 5 | `2026-03-23T12-00-00Z_feature_metadata_tags` | 2026-03-23 | Metadata Tag System | +| 104 | `2026-11-01T16-05-00Z_design_documents_session_frames` | 2026-11-01 | D1-040 — Documents as a session frame pair (web/CLI parity) | +| 119 | `2026-11-01_design_id2048.md` | 2026-11-01 | Design: Zettelkasten layer — multiplayer docs/wiki on ID | +| 154 | `2026-11-02T04-52-00Z_feature_note_link_backlink_projection` | 2026-11-02 | Note links and the head-based backlink projection | +| 181 | `2026-11-05_design_id5965.md` | 2026-11-05 | Design: compile economics — compiled-world/DLL caching, compile-cost penalties, premium gating | +| 182 | `2026-11-05_design_id5997.md` | 2026-11-05 | Design: effect-language borrowings — which Koka/Unison properties id tooling emulates, approximates, or skips | +| 188 | `2026-11-08T00-45-00Z_design_id_recommendations` | 2026-11-08 | ID recommendations across all object types — v1 design | +| 196 | `2026-11-08T08-53-12Z_design_onenote_importer` | 2026-11-08 | Design: OneNote import into the ID knowledge layer | +| 213 | `2026-11-08T11-06-39Z_design_id_draft_approval_flow` | 2026-11-08 | Design: Draft approval queues, outcomes, and rejected-draft forks | +| 221 | `2026-11-08T13-55-51Z_design_agent_note_placement` | 2026-11-08 | Design: where agent notes live — scratch, memory, repo, Zettelkasten, or ID graph | +| 225 | `2026-11-08T17-23-00Z_design_id5963_programming_model` | 2026-11-08 | Design: explicit platform contexts for pure libraries | +| 238 | `2026-11-08_decision_id5874_thread_resolution.md` | 2026-11-08 | Decision: thread resolution and the discussion→edit loop (resolved-into links and change proposals) | +| 254 | `2026-11-08_design_id5830.md` | 2026-11-08 | Design: note→board sharing model — embedded live references, version semantics, reply anchoring, backlinks, cross-server case | +| 255 | `2026-11-08_design_id5832.md` | 2026-11-08 | Design: multiplayer edit sessions — UX, lifecycle, and participation (issue #5832) | +| 256 | `2026-11-08_design_id5837.md` | 2026-11-08 | Design: knowledge graph view cluster — local/global, edges, filters, scale, live behaviour | +| 257 | `2026-11-08_design_id5845.md` | 2026-11-08 | Obsidian importer — design record for the #2048 object model | +| 258 | `2026-11-08_design_id5846.md` | 2026-11-08 | Design: Evernote importer into the #2048 object model | +| 259 | `2026-11-08_design_id5847.md` | 2026-11-08 | Design: importer design — Logseq into the #2048 object model | +| 260 | `2026-11-08_design_id5848.md` | 2026-11-08 | Design: importer design — Joplin into the #2048 object model | +| 269 | `2026-11-08_design_id5969.md` | 2026-11-08 | Design: library typing & upload taxonomy — subtypes, entity attachment, DLL vs compile-in, libraries by URL | +| 272 | `2026-11-08_design_id6439_knowledge-interchange-and-export.md` | 2026-11-08 | Design: ID knowledge-layer interchange and full-fidelity export | +| 277 | `2026-11-09T03-57-04Z_design_id_edit_fork_graph` | 2026-11-09 | Edit/fork graph for notes — decision record | +| 291 | `2026-11-09_design_id5821.md` | 2026-11-09 | ID queries: result shaping & cursor pagination — decision record | +| 299 | `2026-11-10T20-00-00Z_design_agent_note_placement.md` | 2026-11-10 | Design: where agent notes live — placement rule for zettel vs repo vs ID graph | +| 300 | `2026-11-10T20-12-00Z_design_id_content_model` | 2026-11-10 | Content model cluster — decision record for #5839 | +| 304 | `2026-11-10T21-45-00Z_design_ai_over_notes` | 2026-11-10 | AI-over-notes: source-grounded Q&A, citations, and read-authority | +| 316 | `2026-11-10_design_id6436.md` | 2026-11-10 | Design: importer design — Notion into the #2048 object model | +| 329 | `2026-11-11_roc_library_evidence_5995.md` | 2026-11-11 | Roc shared-library outputs and host loading: evidence for #5995 | +| 406 | `knowledge-layer-attachments-media-5844.md` | — | Knowledge layer — attachments & media cluster decision record (#5844) | +| 407 | `knowledge-layer-extensibility-5843.md` | — | Knowledge layer — extensibility cluster decision record (#5843) | +| 408 | `knowledge-layer-feature-matrix-6435.md` | — | Knowledge-layer feature matrix — issue #6435 (program #5678) | ### Design: first apps and the ecosystem — 26 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 1 | `2026-03-20T05-30-00Z_feature_collaborative_cursor_enhancements` | 2026-03-20 | Collaborative Cursor Enhancements | -| 4 | `2026-03-23T00:00:00Z_feature_file_list_ui` | 2026-03-23 | File List UI Improvements | -| 8 | `2026-04-01T00-00-00Z_feature_multi_instance` | 2026-04-01 | Multi-Instance Support for `id` | -| 47 | `2026-10-16T15-00-00Z_feature_roc_grid` | 2026-10-16 | RocGrid: a bounds-checked grid library for world programs | -| 55 | `2026-10-17T09-00-00Z_feature_world_fixtures` | 2026-10-17 | Session recording to replayable fixtures | -| 71 | `2026-10-29T10-54-33Z_investigation_match_audit_netcode_replay` | 2026-10-29 | Match audit — netcode log format, replay validation, and cheating signals — investigation | -| 82 | `2026-10-29T13-04-50Z_investigation_didit_tracker_data_model` | 2026-10-29 | Investigation: the did-it tracker data model | -| 92 | `2026-10-30T19-20-40Z_investigation_match_result_attestation` | 2026-10-30 | Match-result attestation — mutual concession, witness adjudication, offline play — investigation | -| 97 | `2026-10-30T19-40-00Z_investigation_irc_first_chat_on_id` | 2026-10-30 | IRC-first chat on ID — channels, graph-linked objects, presence | -| 113 | `2026-11-01_design_id2031.md` | 2026-11-01 | Design: the first ID app — sticky notes + did-it tracker | -| 116 | `2026-11-01_design_id2039.md` | 2026-11-01 | Design: match attestation + audit v1 | -| 120 | `2026-11-01_design_id2051.md` | 2026-11-01 | Design: ID chat v1 | -| 183 | `2026-11-06T00-50-21Z_design_dynamic_world_tick_cost` | 2026-11-06 | Dynamic-world per-tick cost model and bot-battle benchmark | -| 189 | `2026-11-08T00-57-08Z_design_shader_asset_format` | 2026-11-08 | ID shader asset format — v1 design | -| 202 | `2026-11-08T09-14-46Z_research_id5988_prior_art_bot_games_programmable_worlds` | 2026-11-08 | Research: prior art — scripted-bot battle games and user-programmable worlds | -| 219 | `2026-11-08T13-45-00Z_design_id5857_curated_board_submissions` | 2026-11-08 | Design decision record: curated-board submissions — intake queues, intake roles, notifications | -| 261 | `2026-11-08_design_id5856.md` | 2026-11-08 | Design decision record: post-to-board flow & post semantics | -| 262 | `2026-11-08_design_id5859.md` | 2026-11-08 | Decision record: live-object embeds in playable posts | -| 276 | `2026-11-09T01-27-00Z_design_chat_anchor_data_model` | 2026-11-09 | Chat anchor data model: typed links and durable part selectors | -| 278 | `2026-11-09T04-43-05Z_design_id5788_build_variants.md` | 2026-11-09 | Feature-leveled build variants — design record | -| 303 | `2026-11-10T21-24-00Z_design_id_program_ecosystem` | 2026-11-10 | Program ecosystem (share, fork, gallery) — first-pass research + design for #6278 | -| 322 | `2026-11-11T05-01-15Z_design_id_program_ecosystem_v1` | 2026-11-11 | Program ecosystem — v1 design: share/fork basics for #6291 | -| 323 | `2026-11-11T05-24-00Z_design_id_program_ecosystem_v2` | 2026-11-11 | Program ecosystem — v2 design: gallery & updates for #6293 | -| 346 | `2026-11-14T13-33-00Z_design_id_program_ecosystem_v3` | 2026-11-14 | Program ecosystem — v3 design: the public gallery for #6294 | -| 349 | `2026-11-14T19-05-00Z_design_id_build_defaults` | 2026-11-14 | Design: build-time defaults file for id network defaults | -| 381 | `2026-11-18_design_id6308_creator_owner_basics_v1.md` | 2026-11-18 | Creator tooling & insight — owner basics v1 design (#6308) | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | ------------------------------------------------------------------------------ | ---------- | ------------------------------------------------------------------------------------------------ | +| 1 | `2026-03-20T05-30-00Z_feature_collaborative_cursor_enhancements` | 2026-03-20 | Collaborative Cursor Enhancements | +| 4 | `2026-03-23T00:00:00Z_feature_file_list_ui` | 2026-03-23 | File List UI Improvements | +| 8 | `2026-04-01T00-00-00Z_feature_multi_instance` | 2026-04-01 | Multi-Instance Support for `id` | +| 47 | `2026-10-16T15-00-00Z_feature_roc_grid` | 2026-10-16 | RocGrid: a bounds-checked grid library for world programs | +| 55 | `2026-10-17T09-00-00Z_feature_world_fixtures` | 2026-10-17 | Session recording to replayable fixtures | +| 71 | `2026-10-29T10-54-33Z_investigation_match_audit_netcode_replay` | 2026-10-29 | Match audit — netcode log format, replay validation, and cheating signals — investigation | +| 82 | `2026-10-29T13-04-50Z_investigation_didit_tracker_data_model` | 2026-10-29 | Investigation: the did-it tracker data model | +| 92 | `2026-10-30T19-20-40Z_investigation_match_result_attestation` | 2026-10-30 | Match-result attestation — mutual concession, witness adjudication, offline play — investigation | +| 97 | `2026-10-30T19-40-00Z_investigation_irc_first_chat_on_id` | 2026-10-30 | IRC-first chat on ID — channels, graph-linked objects, presence | +| 113 | `2026-11-01_design_id2031.md` | 2026-11-01 | Design: the first ID app — sticky notes + did-it tracker | +| 116 | `2026-11-01_design_id2039.md` | 2026-11-01 | Design: match attestation + audit v1 | +| 120 | `2026-11-01_design_id2051.md` | 2026-11-01 | Design: ID chat v1 | +| 183 | `2026-11-06T00-50-21Z_design_dynamic_world_tick_cost` | 2026-11-06 | Dynamic-world per-tick cost model and bot-battle benchmark | +| 189 | `2026-11-08T00-57-08Z_design_shader_asset_format` | 2026-11-08 | ID shader asset format — v1 design | +| 202 | `2026-11-08T09-14-46Z_research_id5988_prior_art_bot_games_programmable_worlds` | 2026-11-08 | Research: prior art — scripted-bot battle games and user-programmable worlds | +| 219 | `2026-11-08T13-45-00Z_design_id5857_curated_board_submissions` | 2026-11-08 | Design decision record: curated-board submissions — intake queues, intake roles, notifications | +| 261 | `2026-11-08_design_id5856.md` | 2026-11-08 | Design decision record: post-to-board flow & post semantics | +| 262 | `2026-11-08_design_id5859.md` | 2026-11-08 | Decision record: live-object embeds in playable posts | +| 276 | `2026-11-09T01-27-00Z_design_chat_anchor_data_model` | 2026-11-09 | Chat anchor data model: typed links and durable part selectors | +| 278 | `2026-11-09T04-43-05Z_design_id5788_build_variants.md` | 2026-11-09 | Feature-leveled build variants — design record | +| 303 | `2026-11-10T21-24-00Z_design_id_program_ecosystem` | 2026-11-10 | Program ecosystem (share, fork, gallery) — first-pass research + design for #6278 | +| 322 | `2026-11-11T05-01-15Z_design_id_program_ecosystem_v1` | 2026-11-11 | Program ecosystem — v1 design: share/fork basics for #6291 | +| 323 | `2026-11-11T05-24-00Z_design_id_program_ecosystem_v2` | 2026-11-11 | Program ecosystem — v2 design: gallery & updates for #6293 | +| 346 | `2026-11-14T13-33-00Z_design_id_program_ecosystem_v3` | 2026-11-14 | Program ecosystem — v3 design: the public gallery for #6294 | +| 349 | `2026-11-14T19-05-00Z_design_id_build_defaults` | 2026-11-14 | Design: build-time defaults file for id network defaults | +| 381 | `2026-11-18_design_id6308_creator_owner_basics_v1.md` | 2026-11-18 | Creator tooling & insight — owner basics v1 design (#6308) | ### Design: scale, performance and adversarial hardening — 24 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 6 | `2026-03-29T00-00-00Z_reference_testing_architecture` | 2026-03-29 | Testing Architecture | -| 41 | `2026-10-16T10-00-00Z_feature_world_resource_profile` | 2026-10-16 | Per-world resource profiles | -| 42 | `2026-10-16T10-30-00Z_feature_durable_world_resource_profiles` | 2026-10-16 | Durable per-world resource profiles | -| 58 | `2026-10-17T15-30-00Z_feature_world_perf_budgets` | 2026-10-17 | Per-call resource metrics and performance budgets | -| 59 | `2026-10-17T16-30-00Z_fix_territory_view_fuel` | 2026-10-17 | Fix: territory's view ran out of fuel with six or more seats | -| 67 | `2026-10-27T00-00-00Z_baseline_bytes_per_frame.md` | 2026-10-27 | F11.9 — Bytes-per-frame baseline table | -| 72 | `2026-10-29T10-55-00Z_investigation_comms_abuse_controls` | 2026-10-29 | Comms abuse controls for ID — blocks, rate limits and per-counterparty budgets | -| 95 | `2026-10-30T19-35-00Z_investigation_hot_world_sharding` | 2026-10-30 | Hot-world sharding — investigation: when one world outgrows one Durable Object | -| 100 | `2026-10-31T04-00-00Z_design_waiting_pool_total_cap` | 2026-10-31 | Waiting Pool Total Cap — Bounding Memory and Disk Waiting Rows Against Sybil Floods | -| 114 | `2026-11-01_design_id2033.md` | 2026-11-01 | Design: abuse-control primitives v1 for ID comms | -| 130 | `2026-11-01_design_id2819.md` | 2026-11-01 | Design: Native-spill write lease protocol for hot worlds | -| 137 | `2026-11-01_design_id557.md` | 2026-11-01 | Design: F12.12 per-world memory budget and many-world scale | -| 206 | `2026-11-08T09-55-28Z_design_standard_server_baseline` | 2026-11-08 | The standard server baseline — design decision record | -| 216 | `2026-11-08T11-27-00Z_design_shared_workload_generator` | 2026-11-08 | The shared load & workload generator — design decision record | -| 228 | `2026-11-08T23-05-00Z_design_id5797_latency_budget_measurement.md` | 2026-11-08 | Design: per-fallback-tier latency budget & measurement plan for ID | -| 231 | `2026-11-08T23-45-30Z_design_id5897_regression_gates` | 2026-11-08 | Decision: benchmark regression gates, waivers, and result retention | -| 239 | `2026-11-08_decision_id5892_dos_scenario_catalogue.md` | 2026-11-08 | Decision Record: DoS Scenario Catalogue per Interface | -| 245 | `2026-11-08_design_id5779.md` | 2026-11-08 | Design: deterministic testing for ID across time, replay, corpus, and soak | -| 248 | `2026-11-08_design_id5787.md` | 2026-11-08 | Design: Spill v2 — native spill pools, lease failover, and multi-holder fencing | -| 281 | `2026-11-09T05-15-00Z_design_id_server_invariants` | 2026-11-09 | Design: server-side invariants — budgets, observability, exploit resistance, failure containment | -| 314 | `2026-11-10_design_id6002_cooperative_timeout_contract.md` | 2026-11-10 | Contract: cooperative timeout — invocation budget, checkpoint convention, hard-kill outcomes | -| 331 | `2026-11-12T19-35-00Z_feature_world_lease_handoff_actor_boundary` | 2026-11-12 | World lease handoff at the actor boundary | -| 354 | `2026-11-16T09-52-00Z_design_ci_tiering_adversarial_benchmark_suites` | 2026-11-16 | CI tiering for the adversarial and benchmark suites — design decision record | -| 401 | `2026-11-23T07-53-00Z_design_scale_perf_stress_v1` | 2026-11-23 | Scale & performance hardening — v1: large-world stress program design | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | --------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------ | +| 6 | `2026-03-29T00-00-00Z_reference_testing_architecture` | 2026-03-29 | Testing Architecture | +| 41 | `2026-10-16T10-00-00Z_feature_world_resource_profile` | 2026-10-16 | Per-world resource profiles | +| 42 | `2026-10-16T10-30-00Z_feature_durable_world_resource_profiles` | 2026-10-16 | Durable per-world resource profiles | +| 58 | `2026-10-17T15-30-00Z_feature_world_perf_budgets` | 2026-10-17 | Per-call resource metrics and performance budgets | +| 59 | `2026-10-17T16-30-00Z_fix_territory_view_fuel` | 2026-10-17 | Fix: territory's view ran out of fuel with six or more seats | +| 67 | `2026-10-27T00-00-00Z_baseline_bytes_per_frame.md` | 2026-10-27 | F11.9 — Bytes-per-frame baseline table | +| 72 | `2026-10-29T10-55-00Z_investigation_comms_abuse_controls` | 2026-10-29 | Comms abuse controls for ID — blocks, rate limits and per-counterparty budgets | +| 95 | `2026-10-30T19-35-00Z_investigation_hot_world_sharding` | 2026-10-30 | Hot-world sharding — investigation: when one world outgrows one Durable Object | +| 100 | `2026-10-31T04-00-00Z_design_waiting_pool_total_cap` | 2026-10-31 | Waiting Pool Total Cap — Bounding Memory and Disk Waiting Rows Against Sybil Floods | +| 114 | `2026-11-01_design_id2033.md` | 2026-11-01 | Design: abuse-control primitives v1 for ID comms | +| 130 | `2026-11-01_design_id2819.md` | 2026-11-01 | Design: Native-spill write lease protocol for hot worlds | +| 137 | `2026-11-01_design_id557.md` | 2026-11-01 | Design: F12.12 per-world memory budget and many-world scale | +| 206 | `2026-11-08T09-55-28Z_design_standard_server_baseline` | 2026-11-08 | The standard server baseline — design decision record | +| 216 | `2026-11-08T11-27-00Z_design_shared_workload_generator` | 2026-11-08 | The shared load & workload generator — design decision record | +| 228 | `2026-11-08T23-05-00Z_design_id5797_latency_budget_measurement.md` | 2026-11-08 | Design: per-fallback-tier latency budget & measurement plan for ID | +| 231 | `2026-11-08T23-45-30Z_design_id5897_regression_gates` | 2026-11-08 | Decision: benchmark regression gates, waivers, and result retention | +| 239 | `2026-11-08_decision_id5892_dos_scenario_catalogue.md` | 2026-11-08 | Decision Record: DoS Scenario Catalogue per Interface | +| 245 | `2026-11-08_design_id5779.md` | 2026-11-08 | Design: deterministic testing for ID across time, replay, corpus, and soak | +| 248 | `2026-11-08_design_id5787.md` | 2026-11-08 | Design: Spill v2 — native spill pools, lease failover, and multi-holder fencing | +| 281 | `2026-11-09T05-15-00Z_design_id_server_invariants` | 2026-11-09 | Design: server-side invariants — budgets, observability, exploit resistance, failure containment | +| 314 | `2026-11-10_design_id6002_cooperative_timeout_contract.md` | 2026-11-10 | Contract: cooperative timeout — invocation budget, checkpoint convention, hard-kill outcomes | +| 331 | `2026-11-12T19-35-00Z_feature_world_lease_handoff_actor_boundary` | 2026-11-12 | World lease handoff at the actor boundary | +| 354 | `2026-11-16T09-52-00Z_design_ci_tiering_adversarial_benchmark_suites` | 2026-11-16 | CI tiering for the adversarial and benchmark suites — design decision record | +| 401 | `2026-11-23T07-53-00Z_design_scale_perf_stress_v1` | 2026-11-23 | Scale & performance hardening — v1: large-world stress program design | ### Roadmap, issue map and the design-record index — 20 records -| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | -|---|---|---|---| -| 20 | `2026-10-11T11-08-42Z_design_remaining_work` | 2026-10-11 | What is left in the design: decisions, open questions, and status | -| 22 | `2026-10-11T19-04-32Z_phase_0_baseline` | 2026-10-11 | Phase 0: baseline, toolchain, dependencies, and small fixes | -| 23 | `2026-10-11T22-25-52Z_phase_1_events_storage` | 2026-10-11 | Phase 1: events, storage, crash safety, and the identity store | -| 24 | `2026-10-12T04-03-47Z_phase_2_membership` | 2026-10-12 | Phase 2: membership, auth frontier, and delegation | -| 25 | `2026-10-12T08-58-59Z_phase_3_sync_relays` | 2026-10-12 | Phase 3: sync, blobs, and relays | -| 26 | `2026-10-12T14-33-36Z_phase_4_groups_encryption` | 2026-10-12 | Phase 4: groups, encryption, and history | -| 27 | `2026-10-12T14-33-36Z_phase_5_tags_documents` | 2026-10-12 | Phase 5: tags, documents, and search | -| 28 | `2026-10-12T19-11-31Z_phase_6_invites_pull_cli` | 2026-10-12 | Phase 6: invites, pull, and the CLI | -| 29 | `2026-10-12T21-22-53Z_phase_7_connectivity` | 2026-10-12 | Phase 7: connectivity for later servers | -| 30 | `2026-10-13T23-44-27Z_phase_8_open_design_items` | 2026-10-13 | Phase 8: open design items, retention, multi-device, and views | -| 35 | `2026-10-14T_platform_completion` | — | Platform completion: acceptance brief | -| 63 | `2026-10-22T15-25-00Z_handoff_research_workflow_pipeline` | 2026-10-22 | Handoff: the research-to-delivery pipeline and platform backlog | -| 136 | `2026-11-01_design_id534.md` | 2026-11-01 | Design: Run Phase 12 deliverables through the research workflow | -| 160 | `2026-11-03T00-05-09Z_research_phase-12-package-534` | 2026-11-03 | Changes | -| 173 | `2026-11-04_id-program-essay-answers.md` | — | Answers to the user's 2026-11-04 ID program questions | -| 386 | `2026-11-22T07-05-00Z_phase_id_phase12_exit_audit` | 2026-11-22 | Phase 12 exit audit — 2026-11-22 | -| 387 | `2026-11-22T14-45-14Z_phase_id_phase12_exit_audit_rerun` | 2026-11-22 | Phase 12 exit audit — re-run and reconciliation, 2026-11-22 | -| 388 | `2026-11-22T16-13-20Z_design_id-walking-skeleton` | 2026-11-22 | Walking skeleton for #9106: the path through the 126 rows | -| 395 | `2026-11-23T02-02-09Z_reference_authority_boundary_audit` | 2026-11-23 | Authority-boundary audit — Phase 12 exit criterion 9 | +| # | Record (`doc/` entry) | Date | Subject (record's own first heading) | +| --- | ------------------------------------------------------------- | ---------- | --------------------------------------------------------------------- | +| 20 | `2026-10-11T11-08-42Z_design_remaining_work` | 2026-10-11 | What is left in the design: decisions, open questions, and status | +| 22 | `2026-10-11T19-04-32Z_phase_0_baseline` | 2026-10-11 | Phase 0: baseline, toolchain, dependencies, and small fixes | +| 23 | `2026-10-11T22-25-52Z_phase_1_events_storage` | 2026-10-11 | Phase 1: events, storage, crash safety, and the identity store | +| 24 | `2026-10-12T04-03-47Z_phase_2_membership` | 2026-10-12 | Phase 2: membership, auth frontier, and delegation | +| 25 | `2026-10-12T08-58-59Z_phase_3_sync_relays` | 2026-10-12 | Phase 3: sync, blobs, and relays | +| 26 | `2026-10-12T14-33-36Z_phase_4_groups_encryption` | 2026-10-12 | Phase 4: groups, encryption, and history | +| 27 | `2026-10-12T14-33-36Z_phase_5_tags_documents` | 2026-10-12 | Phase 5: tags, documents, and search | +| 28 | `2026-10-12T19-11-31Z_phase_6_invites_pull_cli` | 2026-10-12 | Phase 6: invites, pull, and the CLI | +| 29 | `2026-10-12T21-22-53Z_phase_7_connectivity` | 2026-10-12 | Phase 7: connectivity for later servers | +| 30 | `2026-10-13T23-44-27Z_phase_8_open_design_items` | 2026-10-13 | Phase 8: open design items, retention, multi-device, and views | +| 35 | `2026-10-14T_platform_completion` | — | Platform completion: acceptance brief | +| 63 | `2026-10-22T15-25-00Z_handoff_research_workflow_pipeline` | 2026-10-22 | Handoff: the research-to-delivery pipeline and platform backlog | +| 136 | `2026-11-01_design_id534.md` | 2026-11-01 | Design: Run Phase 12 deliverables through the research workflow | +| 160 | `2026-11-03T00-05-09Z_research_phase-12-package-534` | 2026-11-03 | Changes | +| 173 | `2026-11-04_id-program-essay-answers.md` | — | Answers to the user's 2026-11-04 ID program questions | +| 386 | `2026-11-22T07-05-00Z_phase_id_phase12_exit_audit` | 2026-11-22 | Phase 12 exit audit — 2026-11-22 | +| 387 | `2026-11-22T14-45-14Z_phase_id_phase12_exit_audit_rerun` | 2026-11-22 | Phase 12 exit audit — re-run and reconciliation, 2026-11-22 | +| 388 | `2026-11-22T16-13-20Z_design_id-walking-skeleton` | 2026-11-22 | Walking skeleton for #9106: the path through the 126 rows | +| 395 | `2026-11-23T02-02-09Z_reference_authority_boundary_audit` | 2026-11-23 | Authority-boundary audit — Phase 12 exit criterion 9 | | 402 | `2026-11-23T12-06-42Z_design_id_program_investigation_prompt` | 2026-11-23 | ID Program — Full Investigation, Design Completion & Build-Out Prompt | Index ends. Row count check: 32 + 20 + 44 + 56 + 39 + 11 + 30 + 43 + 6 + 26 + 31 + 26 + 24 + 20 = 408 records, each listed exactly once. diff --git a/pkgs/id/book/design/scale-hardening.md b/pkgs/id/book/design/scale-hardening.md index 3039ec73b0..bdb57f355b 100644 --- a/pkgs/id/book/design/scale-hardening.md +++ b/pkgs/id/book/design/scale-hardening.md @@ -51,12 +51,12 @@ The scale programme is #6304, under Phase 14 core topic #6281, with plan of reco The tier table, from the record: -| Axis | 1x | 10x | 100x | -|---|---|---|---| -| Idle worlds | 1,000 | 10,000 | 100,000 | -| Active worlds | 100 | 1,000 | 10,000 | +| Axis | 1x | 10x | 100x | +| ----------------------------- | ------ | ------- | --------- | +| Idle worlds | 1,000 | 10,000 | 100,000 | +| Active worlds | 100 | 1,000 | 10,000 | | Single-world history (events) | 10,000 | 100,000 | 1,000,000 | -| Members on the hot world | 32 | 320 | 3,200 | +| Members on the hot world | 32 | 320 | 3,200 | A tier is a measurement target, not a promise; the record states that a run hitting a wall — out-of-memory, eviction storm, p99 blowup, fuel exhaustion — is a result, and the wall is recorded as that tier's measured limit. diff --git a/pkgs/id/book/development/add-a-guest.md b/pkgs/id/book/development/add-a-guest.md index 3ae396c624..af2e1065b9 100644 --- a/pkgs/id/book/development/add-a-guest.md +++ b/pkgs/id/book/development/add-a-guest.md @@ -8,19 +8,19 @@ A guest app is a Roc program compiled to an import-free WebAssembly module and r Worked examples live in `pkgs/id/examples/`. Each app is a directory holding its Roc source, a `README.md`, a build script, and — for most apps — a checked-in `.wasm` build of the guest, so the host conformance suites run without a Roc toolchain installed. -| Directory | What it demonstrates | -|---|---| -| `examples/roc-counter/` | The smallest complete world: guests send `inc`, all participants see the count, and `records` mirrors the count to the host. | -| `examples/roc-text-counter/` | The same counter on the legacy plain-text presentation, importing no platform modules. | -| `examples/roc-chat/` | Chat over the capability protocol: `chat.say` and `chat.history` through `RocCap`. | -| `examples/roc-grid/` | The `RocGrid` library: a 4×3 byte grid with bounds-checked reads. | -| `examples/roc-screen/` | The `Screen` and `Key` libraries: a structured screen document instead of text. | -| `examples/lounge/` | The capability system end to end: subscriptions, arrival greetings through `chat.say`, and refusal counting. | -| `examples/territory/` | A complete multiplayer game: at most 8 seated players on a 16×8 grid, adjacency-only claiming, seats that persist across leave, rejoin and restart. | -| `examples/roc-cap-demo/` | A capability-dependent Roc library plus its app, with two compile-must-fail negative tests for the library import gate. | -| `examples/roc-import-policy/` | Not an app: the compile-fixture matrix for the import gate, executed by the `id-caps` integration test `roc_import_policy`. | -| `examples/rust-world/`, `examples/rust-counter/` | Not Roc: the Rust twin SDK (`plaza_sdk`) and its counter example, emitting the same Plaza exports. | -| `apps/tic-tac-toe/` | The one packaged app, outside `examples/`: an `app.toml` plus `program/main.roc`. Packaging is an `app.toml` declaring `[program] kind = "roc-world"` and the `[interfaces.web]` binding where the app takes a web surface. | +| Directory | What it demonstrates | +| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `examples/roc-counter/` | The smallest complete world: guests send `inc`, all participants see the count, and `records` mirrors the count to the host. | +| `examples/roc-text-counter/` | The same counter on the legacy plain-text presentation, importing no platform modules. | +| `examples/roc-chat/` | Chat over the capability protocol: `chat.say` and `chat.history` through `RocCap`. | +| `examples/roc-grid/` | The `RocGrid` library: a 4×3 byte grid with bounds-checked reads. | +| `examples/roc-screen/` | The `Screen` and `Key` libraries: a structured screen document instead of text. | +| `examples/lounge/` | The capability system end to end: subscriptions, arrival greetings through `chat.say`, and refusal counting. | +| `examples/territory/` | A complete multiplayer game: at most 8 seated players on a 16×8 grid, adjacency-only claiming, seats that persist across leave, rejoin and restart. | +| `examples/roc-cap-demo/` | A capability-dependent Roc library plus its app, with two compile-must-fail negative tests for the library import gate. | +| `examples/roc-import-policy/` | Not an app: the compile-fixture matrix for the import gate, executed by the `id-caps` integration test `roc_import_policy`. | +| `examples/rust-world/`, `examples/rust-counter/` | Not Roc: the Rust twin SDK (`plaza_sdk`) and its counter example, emitting the same Plaza exports. | +| `apps/tic-tac-toe/` | The one packaged app, outside `examples/`: an `app.toml` plus `program/main.roc`. Packaging is an `app.toml` declaring `[program] kind = "roc-world"` and the `[interfaces.web]` binding where the app takes a web surface. | ## Scaffold a new app @@ -49,16 +49,16 @@ Every Roc guest builds against the one shared platform package in `examples/roc- A guest program provides all eight entry points the platform requires. Some may be stubs, but all eight must exist: -| Entry point | Signature, in words | Contract | -|---|---|---| -| `init` | seed → model | The seed is the `U64` the host starts the world with. | -| `update` | model, participant id, event text → model | Participant id `0` is reserved for host events, including capability results. | -| `view` | model → text | Legacy text, or a portable screen document. | -| `layout` | model, width, height → text | Viewport-sized rendering. | -| `records` | model → text | A JSON object projection; the host mirrors it and serves it to readers. | -| `wants` | model → text | Subscriptions and one-shot capability requests, as JSON. | -| `snapshot` | model → text | The whole state as text, for journal checkpoints. | -| `restore` | text → model | The inverse of `snapshot`. | +| Entry point | Signature, in words | Contract | +| ----------- | ----------------------------------------- | ----------------------------------------------------------------------------- | +| `init` | seed → model | The seed is the `U64` the host starts the world with. | +| `update` | model, participant id, event text → model | Participant id `0` is reserved for host events, including capability results. | +| `view` | model → text | Legacy text, or a portable screen document. | +| `layout` | model, width, height → text | Viewport-sized rendering. | +| `records` | model → text | A JSON object projection; the host mirrors it and serves it to readers. | +| `wants` | model → text | Subscriptions and one-shot capability requests, as JSON. | +| `snapshot` | model → text | The whole state as text, for journal checkpoints. | +| `restore` | text → model | The inverse of `snapshot`. | `update` and `view` are pure. The platform requires no `Task`, and the guest has no host functions to call: all effects go through the capability protocol below. @@ -78,12 +78,12 @@ In Roc, do not build these documents by hand. `RocCap` is the client library: it Four commands check a guest without a network, a running serve or a second participant. All four are gated on the `sandbox` feature: in a build without it, the subcommands do not exist. See [Building and testing](building.md) for the feature definitions. -| Command | What it does | -|---|---| -| `id world dev ` | Runs the fully offline scratch-world loop over a directory: compile, instantiate, feed inputs and fixtures, and print one JSON report. Its flags include `--platform `, `--roc `, `--seed ` (default `1`), repeatable `--input ` and `--fixture `, `--fuzz ` with `--fuzz-seed ` (default `42`) and `--fuzz-cases ` (default `32`), and a `--watch` mode bounded by `--watch-max-cycles ` (default `1000`) and `--watch-debounce-ms ` (default `150`). | -| `id world doctor` | Checks the authoring environment — the Roc compiler, the platform, a journal, a capability ceiling and an execution profile — and exits non-zero only when a check fails; warnings do not fail it. `--json` prints the report as JSON. | -| `id world replay --module --fixture --seed ` | Replays a recorded fixture against a compiled module. All three flags are required. The verdict line prints first; a record mismatch exits non-zero. `--allow-partial` accepts a partial fixture. | -| `id world verify --module --fixture --seed ` | The double-replay determinism check over the same three required flags: the module is replayed twice and the first divergence exits non-zero. | +| Command | What it does | +| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id world dev ` | Runs the fully offline scratch-world loop over a directory: compile, instantiate, feed inputs and fixtures, and print one JSON report. Its flags include `--platform `, `--roc `, `--seed ` (default `1`), repeatable `--input ` and `--fixture `, `--fuzz ` with `--fuzz-seed ` (default `42`) and `--fuzz-cases ` (default `32`), and a `--watch` mode bounded by `--watch-max-cycles ` (default `1000`) and `--watch-debounce-ms ` (default `150`). | +| `id world doctor` | Checks the authoring environment — the Roc compiler, the platform, a journal, a capability ceiling and an execution profile — and exits non-zero only when a check fails; warnings do not fail it. `--json` prints the report as JSON. | +| `id world replay --module --fixture --seed ` | Replays a recorded fixture against a compiled module. All three flags are required. The verdict line prints first; a record mismatch exits non-zero. `--allow-partial` accepts a partial fixture. | +| `id world verify --module --fixture --seed ` | The double-replay determinism check over the same three required flags: the module is replayed twice and the first divergence exits non-zero. | `id world measure --module ` also runs offline, under the same `sandbox` gate: it measures a compiled module's fuel use and prints one JSON object. diff --git a/pkgs/id/book/development/add-a-verb.md b/pkgs/id/book/development/add-a-verb.md index 523e8bdf6c..4516f5285c 100644 --- a/pkgs/id/book/development/add-a-verb.md +++ b/pkgs/id/book/development/add-a-verb.md @@ -10,16 +10,16 @@ The second binary, `id-native-shell`, has a hand-rolled argument parser in `crat The clap derive parser lives in the `id-cli` crate, in `src/cli/`: -| File | What it declares | -|---|---| -| `cli/mod.rs` | The `Cli` struct with the global flags, the top-level `Command` enum, the `serve` arguments, and the families that have no file of their own. | -| `cli/world.rs` | The `world` family: one argument struct per subcommand. | -| `cli/tag.rs` | The `tag` family. | -| `cli/groups.rs` | The `group` family, plus `delegate` and `revoke`. | -| `cli/gallery.rs` | The `gallery` family. | -| `cli/walk.rs` | The `walk` family. | -| `cli/claim.rs`, `cli/doc.rs`, `cli/writer_sets.rs`, `cli/match_audit.rs` | The `claim`, `doc`, `writer-sets` and `match-audit` families. | -| `cli/tests.rs` | The parser test suite for the whole `cli` module. | +| File | What it declares | +| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | +| `cli/mod.rs` | The `Cli` struct with the global flags, the top-level `Command` enum, the `serve` arguments, and the families that have no file of their own. | +| `cli/world.rs` | The `world` family: one argument struct per subcommand. | +| `cli/tag.rs` | The `tag` family. | +| `cli/groups.rs` | The `group` family, plus `delegate` and `revoke`. | +| `cli/gallery.rs` | The `gallery` family. | +| `cli/walk.rs` | The `walk` family. | +| `cli/claim.rs`, `cli/doc.rs`, `cli/writer_sets.rs`, `cli/match_audit.rs` | The `claim`, `doc`, `writer-sets` and `match-audit` families. | +| `cli/tests.rs` | The parser test suite for the whole `cli` module. | Declare the new command in the file for its family: a variant on the family's command enum, an argument struct with one `#[arg]` field per flag or positional, and doc comments on both. The doc comments are the help text — clap renders them — so each one states what the argument does, its literal default where it has one, and any requirement or conflict a caller would otherwise have to read the handler to learn. Follow the family's existing conventions for the repeated shapes: @@ -34,11 +34,11 @@ If the new syntax interacts with argument rewriting, check `cli::normalize_args` Three gating shapes exist in the current parser, and a new command takes one of them deliberately: -| Shape | Precedent | Behaviour in a build without the feature | -|---|---|---| -| Parser variant gated with `#[cfg(feature = "...")]` | The `sandbox` variants `world dev`, `world measure`, `world replay`, `world verify`, and the whole `match-audit` command. | The command does not exist: clap reports an unrecognized subcommand, and the help tree does not show it. | -| Parser unconditional, dispatch gated | The whole `world` family: the `Command` variant is unconditional, and `src/main.rs` carries a gated dispatch arm plus a fallback arm. | The help tree prints in full, and every invocation fails at runtime with `this build has no world support`. | -| Parser unconditional, handler guard | `serve --web` and `serve --server-config`. | The flag parses, and startup fails with an error that names the missing feature and the rebuild flag. | +| Shape | Precedent | Behaviour in a build without the feature | +| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| Parser variant gated with `#[cfg(feature = "...")]` | The `sandbox` variants `world dev`, `world measure`, `world replay`, `world verify`, and the whole `match-audit` command. | The command does not exist: clap reports an unrecognized subcommand, and the help tree does not show it. | +| Parser unconditional, dispatch gated | The whole `world` family: the `Command` variant is unconditional, and `src/main.rs` carries a gated dispatch arm plus a fallback arm. | The help tree prints in full, and every invocation fails at runtime with `this build has no world support`. | +| Parser unconditional, handler guard | `serve --web` and `serve --server-config`. | The flag parses, and startup fails with an error that names the missing feature and the rebuild flag. | The feature names are defined in the root `Cargo.toml` and mirrored in `crates/id-cli/Cargo.toml`; the definitions and defaults are in [Building and testing](building.md). A command that needs wasmtime takes the first shape. A command in a family that must stay discoverable in help takes the second or third, and its help text states the requirement. diff --git a/pkgs/id/book/development/building.md b/pkgs/id/book/development/building.md index ccf3b1a827..f9d637593b 100644 --- a/pkgs/id/book/development/building.md +++ b/pkgs/id/book/development/building.md @@ -33,17 +33,17 @@ cargo build --release --features web The justfile wraps the same builds and tracks which variant was built last, in `target/.build-variant` (debug) and `target/.build-variant-release` (release): -| Recipe | What it runs | -|---|---| -| `just build` | `./scripts/build.sh web debug` — the web variant, debug profile. Alias: `build-web`. | -| `just build-lib` | `./scripts/build.sh lib debug` — the library variant: a plain `cargo build` with default features. | -| `just release` | `./scripts/build.sh web release`. Aliases: `build-release`, `build-web-release`. | -| `just release-lib` | `./scripts/build.sh lib release`. | -| `just build-web-cargo` | `cargo build --features web`. Alias: `build-cargo`. | -| `just build-lib-cargo` | `cargo build`. | -| `just release-web-cargo` | `cargo build --release --features web`. | -| `just release-lib-cargo` | `cargo build --release`. | -| `just clean` | `cargo clean`. | +| Recipe | What it runs | +| ------------------------ | -------------------------------------------------------------------------------------------------- | +| `just build` | `./scripts/build.sh web debug` — the web variant, debug profile. Alias: `build-web`. | +| `just build-lib` | `./scripts/build.sh lib debug` — the library variant: a plain `cargo build` with default features. | +| `just release` | `./scripts/build.sh web release`. Aliases: `build-release`, `build-web-release`. | +| `just release-lib` | `./scripts/build.sh lib release`. | +| `just build-web-cargo` | `cargo build --features web`. Alias: `build-cargo`. | +| `just build-lib-cargo` | `cargo build`. | +| `just release-web-cargo` | `cargo build --release --features web`. | +| `just release-lib-cargo` | `cargo build --release`. | +| `just clean` | `cargo clean`. | The `-force` recipes (`build-web-force`, `build-lib-force`, `release-web-force`, `release-lib-force`) bypass the build script's freshness checks and rebuild the web assets or the binary directly. @@ -51,15 +51,15 @@ The `-force` recipes (`build-web-force`, `build-lib-force`, `release-web-force`, The root crate's `[features]` table in `pkgs/id/Cargo.toml` is the whole feature system. `id-cli`'s `Cargo.toml` mirrors the same names for the application layer. -| Feature | Definition in the root crate | Default | -|---|---|---| -| `sandbox` | Implies `world`; forwards to `id-core/sandbox`, `id-caps/sandbox`, `id-worlds/sandbox` and `id-cli/sandbox`. It is the wasmtime guest runtime: it gates the parser variants `id world dev`, `id world measure`, `id world replay`, `id world verify` and the whole `id match-audit` command. | On, through `default`. | -| `world` | Forwards to `id-core/world` and `id-cli/world`. Without it, the `id world` parser still prints its full help tree, but every `id world` invocation fails at runtime with the error `this build has no world support`. | On, through `default`. | -| `web` | Implies `world`; links the optional `id-web` dependency and forwards to `id-core/web` and `id-cli/web`. Without it, `id serve --web` fails at startup with an error naming the missing feature. | Off. | -| `ssh` | Implies `world`; forwards to `id-worlds/ssh` and `id-cli/ssh`. It is the world-over-SSH server inside `id serve --world-ssh-port`. The flag itself parses in every build. | Off. | -| `dht` | Forwards to `id-sync/dht` and `id-cli/dht`: mainline DHT address lookup and publishing. The `serve --dht` flag parses in every build; the feature controls the lookup code behind it. | Off. | -| `currency-poc-tb` | Links the optional TigerBeetle Rust client for the currency proof of concept. No command-line surface. | Off. | -| `default` | `["sandbox", "world"]`. | — | +| Feature | Definition in the root crate | Default | +| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | +| `sandbox` | Implies `world`; forwards to `id-core/sandbox`, `id-caps/sandbox`, `id-worlds/sandbox` and `id-cli/sandbox`. It is the wasmtime guest runtime: it gates the parser variants `id world dev`, `id world measure`, `id world replay`, `id world verify` and the whole `id match-audit` command. | On, through `default`. | +| `world` | Forwards to `id-core/world` and `id-cli/world`. Without it, the `id world` parser still prints its full help tree, but every `id world` invocation fails at runtime with the error `this build has no world support`. | On, through `default`. | +| `web` | Implies `world`; links the optional `id-web` dependency and forwards to `id-core/web` and `id-cli/web`. Without it, `id serve --web` fails at startup with an error naming the missing feature. | Off. | +| `ssh` | Implies `world`; forwards to `id-worlds/ssh` and `id-cli/ssh`. It is the world-over-SSH server inside `id serve --world-ssh-port`. The flag itself parses in every build. | Off. | +| `dht` | Forwards to `id-sync/dht` and `id-cli/dht`: mainline DHT address lookup and publishing. The `serve --dht` flag parses in every build; the feature controls the lookup code behind it. | Off. | +| `currency-poc-tb` | Links the optional TigerBeetle Rust client for the currency proof of concept. No command-line surface. | Off. | +| `default` | `["sandbox", "world"]`. | — | ### The CLI-2 split: `--no-default-features` is not the lib build @@ -81,10 +81,10 @@ cd web && bun install && bun run build The `web/package.json` build script is three steps: -| Script | Command | -|---|---| -| `build:js` | `bun build src/main.ts --outdir=dist --minify --sourcemap=external --entry-naming=[name].[hash].js` | -| `build:css` | `node_modules/.bin/tailwindcss -i src/input.css -o dist/styles.css --minify` | +| Script | Command | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| `build:js` | `bun build src/main.ts --outdir=dist --minify --sourcemap=external --entry-naming=[name].[hash].js` | +| `build:css` | `node_modules/.bin/tailwindcss -i src/input.css -o dist/styles.css --minify` | | `build:manifest` | `bun run scripts/build-manifest.ts` — renames the stylesheet to its hashed name and writes the asset manifest the templates consume. | Output lands in `web/dist`. The root package's `build.rs` enforces the ordering: with the `web` feature on, a release-profile build fails when `web/dist` is missing or holds nothing but its `.gitkeep` placeholder, and the failure message names the `bun install && bun run build` command above. A non-release build creates the directory when it is absent, so `cargo check` and `cargo test` compile on a clean checkout. @@ -93,37 +93,37 @@ Output lands in `web/dist`. The root package's `build.rs` enforces the ordering: Tests run under cargo-nextest where the justfile uses it. The recipes: -| Recipe | What it runs | -|---|---| -| `just test-rust` | `cargo nextest run --all-features`, then `cargo test --all-features --doc` for the doc tests nextest does not run. Alias: `test-cargo`. | -| `just test` | `test-rust` plus `test-web-unit` plus `test-web-typecheck`. | -| `just test-sandbox` | `cargo nextest run --all-features -E 'not test(serve_tests)'` — the full Rust suite minus the tests that bind and listen on sockets, which the Nix sandbox forbids. | -| `just test-full` | `cargo nextest run --all-features --no-fail-fast`, then the `regression_replay` test target, then the `tuple_properties` target with `PROPTEST_CASES` defaulting to `4096` and `ID_TUPLE_FUZZ_CASES` defaulting to `20000`. | -| `just test-unit` | `cargo nextest run --all-features --lib`. Alias: `test-lib`. | -| `just test-crate-integration` | Five named integration targets in sub-crates the root shards do not cover: `id-caps` `roc_import_policy`, `id-cli` `aliases`, `id-core` `probe_petname_load`, `id-store` `store_traits`, `id-web` `web_router_security`. | -| `just test-native-shell` | `cargo nextest run -p id-native-shell`. A separate recipe because the crate is not a default member. | -| `just test-hw-shell` | `cargo nextest run -p id-hw-shell`. Same reason. | -| `just test-rust-examples` | `cargo test` against `examples/rust-world/Cargo.toml` and `examples/rust-counter/Cargo.toml` — standalone crates outside the workspace. | -| `just test-integration` | `cargo nextest run --all-features --test cli_integration`. Alias: `test-int`. | -| `just test-web-unit` | `cd web && bun run test` (Vitest), then the build-manifest shell test. | -| `just test-web-typecheck` | `cd web && bun run typecheck` (`tsc --noEmit`). | -| `just roc-test` | `bash scripts/roc-test.sh` — the Roc library `expect` tests with the pinned Roc compiler. | -| `just test-e2e` | A `build` first, then one Playwright invocation per spec file in `e2e/tests/`, each with a fresh ephemeral server. `test-e2e-chromium` and `test-e2e-firefox` run one browser project each. | -| `just crash-gate` | `cargo test --release --features web --test crash`, skipping the `write_corpus` tests. Four split recipes — `crash-gate-sampled`, `crash-gate-sweep`, `crash-gate-control`, `crash-gate-ingest` — partition the same tests by name filter for the pull-request gate. | +| Recipe | What it runs | +| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `just test-rust` | `cargo nextest run --all-features`, then `cargo test --all-features --doc` for the doc tests nextest does not run. Alias: `test-cargo`. | +| `just test` | `test-rust` plus `test-web-unit` plus `test-web-typecheck`. | +| `just test-sandbox` | `cargo nextest run --all-features -E 'not test(serve_tests)'` — the full Rust suite minus the tests that bind and listen on sockets, which the Nix sandbox forbids. | +| `just test-full` | `cargo nextest run --all-features --no-fail-fast`, then the `regression_replay` test target, then the `tuple_properties` target with `PROPTEST_CASES` defaulting to `4096` and `ID_TUPLE_FUZZ_CASES` defaulting to `20000`. | +| `just test-unit` | `cargo nextest run --all-features --lib`. Alias: `test-lib`. | +| `just test-crate-integration` | Five named integration targets in sub-crates the root shards do not cover: `id-caps` `roc_import_policy`, `id-cli` `aliases`, `id-core` `probe_petname_load`, `id-store` `store_traits`, `id-web` `web_router_security`. | +| `just test-native-shell` | `cargo nextest run -p id-native-shell`. A separate recipe because the crate is not a default member. | +| `just test-hw-shell` | `cargo nextest run -p id-hw-shell`. Same reason. | +| `just test-rust-examples` | `cargo test` against `examples/rust-world/Cargo.toml` and `examples/rust-counter/Cargo.toml` — standalone crates outside the workspace. | +| `just test-integration` | `cargo nextest run --all-features --test cli_integration`. Alias: `test-int`. | +| `just test-web-unit` | `cd web && bun run test` (Vitest), then the build-manifest shell test. | +| `just test-web-typecheck` | `cd web && bun run typecheck` (`tsc --noEmit`). | +| `just roc-test` | `bash scripts/roc-test.sh` — the Roc library `expect` tests with the pinned Roc compiler. | +| `just test-e2e` | A `build` first, then one Playwright invocation per spec file in `e2e/tests/`, each with a fresh ephemeral server. `test-e2e-chromium` and `test-e2e-firefox` run one browser project each. | +| `just crash-gate` | `cargo test --release --features web --test crash`, skipping the `write_corpus` tests. Four split recipes — `crash-gate-sampled`, `crash-gate-sweep`, `crash-gate-control`, `crash-gate-ingest` — partition the same tests by name filter for the pull-request gate. | Run one test by name with the recipe `test-one`, which takes the test name as its single argument and runs `cargo nextest run --all-features -E 'test()'` with the name substituted. Example with toy data: `just test-one my_test`. ### Checks: just and Nix -| Recipe or command | What it runs | -|---|---| -| `just cargo-check` | `cargo check --all-targets --all-features`. | -| `just clippy-lint` | `cargo clippy --all-targets --all-features`. `clippy-native-shell` runs clippy for the non-default `id-native-shell` member separately. | -| `just fmt-check` | `cargo-fmt-check` (`cargo fmt -- --check`) plus `web-fmt-check` (Biome format over the web and e2e sources). | -| `just ci` | The read-only CI set, in recipe order: `cargo-fmt-check`, `web-fmt-check`, `cargo-check`, `clippy-lint`, `clippy-native-shell`, `web-lint`, `test-sandbox`, `test-native-shell`, `test-hw-shell`, `test-rust-examples`, `test-web-unit`, `test-web-typecheck`, `roc-test`, `doc`, `build`, `release`. | -| `just check` | `fix` first (auto-fix formatting and lints), then `ci`. Alias: `check-all`. | -| `just doc` | `cargo doc --no-deps --document-private-items`. | -| `just test-nix` | `nix flake check` in `pkgs/id`. Aliases: `check-nix`, `nix-check`. | +| Recipe or command | What it runs | +| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `just cargo-check` | `cargo check --all-targets --all-features`. | +| `just clippy-lint` | `cargo clippy --all-targets --all-features`. `clippy-native-shell` runs clippy for the non-default `id-native-shell` member separately. | +| `just fmt-check` | `cargo-fmt-check` (`cargo fmt -- --check`) plus `web-fmt-check` (Biome format over the web and e2e sources). | +| `just ci` | The read-only CI set, in recipe order: `cargo-fmt-check`, `web-fmt-check`, `cargo-check`, `clippy-lint`, `clippy-native-shell`, `web-lint`, `test-sandbox`, `test-native-shell`, `test-hw-shell`, `test-rust-examples`, `test-web-unit`, `test-web-typecheck`, `roc-test`, `doc`, `build`, `release`. | +| `just check` | `fix` first (auto-fix formatting and lints), then `ci`. Alias: `check-all`. | +| `just doc` | `cargo doc --no-deps --document-private-items`. | +| `just test-nix` | `nix flake check` in `pkgs/id`. Aliases: `check-nix`, `nix-check`. | The flake's `checks` set in `pkgs/id/flake.nix` exposes the CI set as individual named checks — among them `cargo-fmt-check`, `clippy-lint`, `clippy-native-shell`, `web-lint`, `test` (which runs the `test-sandbox` recipe), `test-unit`, `test-crate-integration`, `test-native-shell`, `test-hw-shell`, `test-rust-examples`, `test-int`, the four integration shards `test-shard-0` to `test-shard-3`, `roc-test`, `roc-examples`, `doc`, `cargo-check`, `prod-lines-check`, the five `crash-gate` checks and `just-recipes-drift` — plus NixOS VM checks for serve and end-to-end tests on Linux. The `default` check runs the `ci` recipe. @@ -139,13 +139,13 @@ This book states no standing test totals. A count is a measurement of one run on The serve recipes in the justfile: -| Recipe | What it runs | -|---|---| -| `just serve` | The web assets, then `cargo run --features web -- serve --web` with any extra arguments appended. | -| `just serve-lib` | `cargo run -- serve` with any extra arguments appended — no web UI. | -| `just serve-new` | A new named instance: `cargo run --features web -- --new= serve --web --port 0`. An empty name asks for a random 8-hex-character instance name. | -| `just repl` | `cargo run -- repl`. | -| `just kill-serve` | Kills any running `id serve` processes, waits, then serves. This is also the justfile's default recipe: bare `just` restarts the server. | +| Recipe | What it runs | +| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `just serve` | The web assets, then `cargo run --features web -- serve --web` with any extra arguments appended. | +| `just serve-lib` | `cargo run -- serve` with any extra arguments appended — no web UI. | +| `just serve-new` | A new named instance: `cargo run --features web -- --new= serve --web --port 0`. An empty name asks for a random 8-hex-character instance name. | +| `just repl` | `cargo run -- repl`. | +| `just kill-serve` | Kills any running `id serve` processes, waits, then serves. This is also the justfile's default recipe: bare `just` restarts the server. | `id serve` itself defaults to web port `3000` on bind address `127.0.0.1`; the full flag set is in [serve and publications](../reference/cli-serve.md). diff --git a/pkgs/id/book/development/keeping-this-book-current.md b/pkgs/id/book/development/keeping-this-book-current.md index e9f7f0b970..0dd4d460b3 100644 --- a/pkgs/id/book/development/keeping-this-book-current.md +++ b/pkgs/id/book/development/keeping-this-book-current.md @@ -37,7 +37,7 @@ The contract is enforced by two gates, and they are the whole of its teeth today 1. **`create-missing = false`.** The book's configuration, `pkgs/id/book.toml` (title `id`, sources in `pkgs/id/book/`), sets `create-missing = false` under `[build]`: a chapter listed in `SUMMARY.md` that does not exist is a **build failure, never a generated stub**. A new chapter is therefore a real file, written by its author, or the build is red. 2. **The `.#id-docs` Nix build on `main`.** The workflow `.github/workflows/id-docs.yml` runs `nix build .#id-docs --print-build-logs` on every push to `main` and on manual dispatch, then stages the result and checks that the staged tree contains an `index.html`. The derivation is `pkgs/id/docs.nix`: it renders `book.toml` plus the `book/` tree with the flake-pinned mdBook, with no network access, exactly as the deploy will render it. The workflow builds only; it never deploys — deployment is the combined Pages deploy described in [Deploying this book](../operations/deploying-this-book.md). -An honest limitation, recorded so nobody over-trusts the gates: neither gate checks that a chapter's *contents* still match the code. They prove the book is complete and renders; the same-change rule above, enforced by review, is what keeps it true — which is why this chapter exists in the book itself, where a contributor changing a surface will meet it. +An honest limitation, recorded so nobody over-trusts the gates: neither gate checks that a chapter's _contents_ still match the code. They prove the book is complete and renders; the same-change rule above, enforced by review, is what keeps it true — which is why this chapter exists in the book itself, where a contributor changing a surface will meet it. ## Where the rule is recorded diff --git a/pkgs/id/book/development/layout.md b/pkgs/id/book/development/layout.md index f6fa1114c2..f6ed425873 100644 --- a/pkgs/id/book/development/layout.md +++ b/pkgs/id/book/development/layout.md @@ -8,13 +8,13 @@ ID lives in the `developing-today/code` monorepo, in the directory `pkgs/id/`. T `pkgs/id/Cargo.toml` is two things: the package manifest for the root crate, named `id`, version `0.1.0`, edition 2024, and the workspace root manifest. -| Path | What it holds | -|---|---| -| `src/main.rs` | The `id` binary entry point. It consumes the library through `id::` paths, the same surface an external consumer uses. | -| `src/lib.rs` | The facade crate: 26 modules of first-party code (among them `backup`, `currency`, `fileops`, `grants`, `hosted_binding`, `hosted_export`, `hosted_ingest` and `structured_logging`) plus the re-export surface over the sub-crates. The facade is not a re-export shim only; it owns code. | -| `src/` (rest) | The facade-owned modules, one file or directory per module. Several files at historical paths are thin layers over the split crates that now own the code. | -| `build.rs` | The root package's build script. It handles the web asset directory `web/dist`: a release build with the `web` feature fails when that directory is missing or empty. See [Building and testing](building.md). | -| `build.sh`, `scripts/` | The build and maintenance scripts the justfile recipes call, including `scripts/build.sh`, the Roc test and example rebuild scripts, and the test-sharding script. | +| Path | What it holds | +| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `src/main.rs` | The `id` binary entry point. It consumes the library through `id::` paths, the same surface an external consumer uses. | +| `src/lib.rs` | The facade crate: 26 modules of first-party code (among them `backup`, `currency`, `fileops`, `grants`, `hosted_binding`, `hosted_export`, `hosted_ingest` and `structured_logging`) plus the re-export surface over the sub-crates. The facade is not a re-export shim only; it owns code. | +| `src/` (rest) | The facade-owned modules, one file or directory per module. Several files at historical paths are thin layers over the split crates that now own the code. | +| `build.rs` | The root package's build script. It handles the web asset directory `web/dist`: a release build with the `web` feature fails when that directory is missing or empty. See [Building and testing](building.md). | +| `build.sh`, `scripts/` | The build and maintenance scripts the justfile recipes call, including `scripts/build.sh`, the Roc test and example rebuild scripts, and the test-sharding script. | There is no `src/bin/` directory and no `[[bin]]` section in any workspace `Cargo.toml`. The two binaries exist by Cargo's implicit `src/main.rs` rule: `id` from the root package, and `id-native-shell` from `crates/id-native-shell/src/main.rs`. @@ -22,24 +22,24 @@ There is no `src/bin/` directory and no `[[bin]]` section in any workspace `Carg `crates/` holds the 16 sub-crates. The workspace has 17 members in total: the root plus these 16. `default-members` lists 15 packages — the root plus 14 crates. `id-native-shell` and `id-hw-shell` are members but not default members, so a plain `cargo build` in `pkgs/id/` never builds the desktop shell or the hardware shell. -| Crate | Role in one line | -|---|---| -| `id-core` | Foundation leaf modules: addressing, frames, discovery, membership, the graph record model. Depended on by every other split crate. | -| `id-caps` | Capability catalog, execution limits, the world manifest, and the MCP bridge translator and policy point. | -| `id-config` | The versioned configuration contract: the V2 `ConfigDocument`, its hard invariants, and the deterministic resolver. No production crate depends on it; the facade uses it in dev-dependencies for its tests. | -| `id-store` | Blob store, chains, documents, tags and search. | -| `id-events` | Event store, group projection, writer sets and sync gating. | -| `id-groups` | Group policy and enforcement remainder over the model in `id-events`: blob gate, group encryption, group actions and log. | -| `id-sync` | Log sync, the meta protocol, envelopes, signed artifacts and FileOps transfer. | -| `id-directory` | Home-server directory, views, auth, mail, invites, keysets and seitan admission. | -| `id-worlds` | World runtime, sessions, the wasmtime sandbox, the shell contract and the program gallery. The largest crate in the workspace. | -| `id-web` | The HTTP and WebSocket server: routes, templates and markdown for the web UI. | -| `id-cli` | The application layer: the clap parser in `src/cli/`, the command handlers in `src/commands/`, the REPL, and the server-config loader. | -| `id-currency-registry` | Currency control-plane registry: the ledger allocator, the account factory and the Postgres schema and migrations. | -| `id-render` | Rendering pipeline compiler core: parse and vocabulary validation of semantic markup. No dependents. | -| `id-import-notion` | Notion importer manifest and inventory primitives. No dependents. | -| `id-native-shell` | The Bevy native reference shell. Not a default member. | -| `id-hw-shell` | The ESP32-class hardware shell spike: one file, `src/lib.rs`, frame builders only, no binary. Not a default member. | +| Crate | Role in one line | +| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id-core` | Foundation leaf modules: addressing, frames, discovery, membership, the graph record model. Depended on by every other split crate. | +| `id-caps` | Capability catalog, execution limits, the world manifest, and the MCP bridge translator and policy point. | +| `id-config` | The versioned configuration contract: the V2 `ConfigDocument`, its hard invariants, and the deterministic resolver. No production crate depends on it; the facade uses it in dev-dependencies for its tests. | +| `id-store` | Blob store, chains, documents, tags and search. | +| `id-events` | Event store, group projection, writer sets and sync gating. | +| `id-groups` | Group policy and enforcement remainder over the model in `id-events`: blob gate, group encryption, group actions and log. | +| `id-sync` | Log sync, the meta protocol, envelopes, signed artifacts and FileOps transfer. | +| `id-directory` | Home-server directory, views, auth, mail, invites, keysets and seitan admission. | +| `id-worlds` | World runtime, sessions, the wasmtime sandbox, the shell contract and the program gallery. The largest crate in the workspace. | +| `id-web` | The HTTP and WebSocket server: routes, templates and markdown for the web UI. | +| `id-cli` | The application layer: the clap parser in `src/cli/`, the command handlers in `src/commands/`, the REPL, and the server-config loader. | +| `id-currency-registry` | Currency control-plane registry: the ledger allocator, the account factory and the Postgres schema and migrations. | +| `id-render` | Rendering pipeline compiler core: parse and vocabulary validation of semantic markup. No dependents. | +| `id-import-notion` | Notion importer manifest and inventory primitives. No dependents. | +| `id-native-shell` | The Bevy native reference shell. Not a default member. | +| `id-hw-shell` | The ESP32-class hardware shell spike: one file, `src/lib.rs`, frame builders only, no binary. Not a default member. | Dependency direction runs downward to `id-core`. Nothing in the split family depends on the facade in production code; the two shells depend on the facade, and `id-store` dev-depends on it for tests. The full per-crate surface is [The crates](../library/crates.md). @@ -47,44 +47,44 @@ Two directories sit outside the workspace: `vendor/p2panda-sync` and `vendor/p2p ## Apps, examples and the guest surface -| Path | What it holds | -|---|---| -| `apps/` | Packaged apps. It contains exactly one app: `apps/tic-tac-toe/`, with an `app.toml` declaring `[program] kind = "roc-world"` and the guest source in `program/main.roc`. It contains no Rust. | -| `examples/` | The Roc guest apps, the shared Roc platform package, the Rust guest SDK and its example, the import-policy fixture matrix, and one standalone Rust example file, `examples/session_checkpoint_poc.rs`. The guest apps are listed in [Add a Roc guest app](add-a-guest.md). | -| `contract/` | The machine-readable shell contract, 4 files: `shell-contract.v1.json` (contract `id-shell`, version 1, revision 15), `shell-suite.v1.json`, and the two golden session transcripts `sessions/terminal.jsonl` and `sessions/native.jsonl`. | -| `config/` | The JSON Schema twin of the `id-config` document, `config/id-config-v1.schema.json`. | -| `test-vectors/` | Exactly 3 files: `schema.json` (the ID/Atlas shared conformance test-vector schema), `atlas-content-hash-v1.json` and `legacy-artifact-signatures.json`. | -| `benches/` | The benchmark harness: `world_bench.rs` plus its baseline files. A separate `benchmarks/` directory holds benchmark notes and results. | -| `tests/` | The root package's integration tests, including `cli_integration.rs`, the `config_*` tests for `id-config`, and the MCP bridge and spike end-to-end tests. Each sub-crate also carries its own `tests/` directory. | -| `e2e/` | The Playwright end-to-end suite for the web UI, with its own `package.json`, `bun.lock` and `playwright.config.ts`. | +| Path | What it holds | +| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `apps/` | Packaged apps. It contains exactly one app: `apps/tic-tac-toe/`, with an `app.toml` declaring `[program] kind = "roc-world"` and the guest source in `program/main.roc`. It contains no Rust. | +| `examples/` | The Roc guest apps, the shared Roc platform package, the Rust guest SDK and its example, the import-policy fixture matrix, and one standalone Rust example file, `examples/session_checkpoint_poc.rs`. The guest apps are listed in [Add a Roc guest app](add-a-guest.md). | +| `contract/` | The machine-readable shell contract, 4 files: `shell-contract.v1.json` (contract `id-shell`, version 1, revision 15), `shell-suite.v1.json`, and the two golden session transcripts `sessions/terminal.jsonl` and `sessions/native.jsonl`. | +| `config/` | The JSON Schema twin of the `id-config` document, `config/id-config-v1.schema.json`. | +| `test-vectors/` | Exactly 3 files: `schema.json` (the ID/Atlas shared conformance test-vector schema), `atlas-content-hash-v1.json` and `legacy-artifact-signatures.json`. | +| `benches/` | The benchmark harness: `world_bench.rs` plus its baseline files. A separate `benchmarks/` directory holds benchmark notes and results. | +| `tests/` | The root package's integration tests, including `cli_integration.rs`, the `config_*` tests for `id-config`, and the MCP bridge and spike end-to-end tests. Each sub-crate also carries its own `tests/` directory. | +| `e2e/` | The Playwright end-to-end suite for the web UI, with its own `package.json`, `bun.lock` and `playwright.config.ts`. | ## The web frontend and the hosted scaffold -| Path | What it holds | -|---|---| -| `web/` | The web frontend: Bun plus TypeScript, package name `id-web`. Its build output lands in `web/dist`, which is embedded into the `id-web` crate at compile time with rust-embed. Only a tracked `.gitkeep` file is committed under `web/dist`; the assets are a build product. See [Building and testing](building.md). | -| `hosted-worker/` | The hosted edition's Cloudflare Worker scaffold: `wrangler.toml`, `src/` (front door, routing, the per-user Durable Object, provisioning, the currency gateway proof of concept) and `test/`. It is a local-only scaffold, not a deployed service. See [Release and rollout](release-and-rollout.md). | -| `worker-poc/` | A proof of concept that runs one example world in a Worker isolate, plus its `d1-journal-poc/` subfolder. Not a production path. | +| Path | What it holds | +| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `web/` | The web frontend: Bun plus TypeScript, package name `id-web`. Its build output lands in `web/dist`, which is embedded into the `id-web` crate at compile time with rust-embed. Only a tracked `.gitkeep` file is committed under `web/dist`; the assets are a build product. See [Building and testing](building.md). | +| `hosted-worker/` | The hosted edition's Cloudflare Worker scaffold: `wrangler.toml`, `src/` (front door, routing, the per-user Durable Object, provisioning, the currency gateway proof of concept) and `test/`. It is a local-only scaffold, not a deployed service. See [Release and rollout](release-and-rollout.md). | +| `worker-poc/` | A proof of concept that runs one example world in a Worker isolate, plus its `d1-journal-poc/` subfolder. Not a production path. | ## Build and project files at the package root -| Path | What it is | -|---|---| -| `flake.nix` | The sub-flake: dev shell, the checks set, the packages `id-web` and `id-lib`, and apps generated from `just-recipes.json`. | -| `justfile` | The command runner recipes. Every build, test and serve command in [Building and testing](building.md) is a recipe here or a Cargo command the recipes wrap. | -| `just-recipes.json` | A generated projection of the justfile, regenerated by the `lockfiles` recipe and checked for drift by a flake check. Do not edit it by hand. | -| `rust-toolchain.toml` | The toolchain pin: channel `1.99.1`, with the components `rustfmt`, `clippy`, `rust-analyzer` and `llvm-tools`. The flake reads it through rust-overlay. | -| `Cargo.lock` | The workspace lockfile, consumed by both Cargo and the Nix packages. | -| `default.nix`, `shell.nix`, `nix/`, `nix-common.nix` | The non-flake and shared Nix entry points, and the NixOS VM test definitions under `nix/tests/`. | -| `README.md`, `ARCHITECTURE.md`, `WEB.md`, `TODO.md` | The package's older prose documents. They predate parts of the current tree and disagree with it in places; this book documents the source where they differ. `TODO.md` states in its own text that it is idle planning and not a basis for decisions. | +| Path | What it is | +| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `flake.nix` | The sub-flake: dev shell, the checks set, the packages `id-web` and `id-lib`, and apps generated from `just-recipes.json`. | +| `justfile` | The command runner recipes. Every build, test and serve command in [Building and testing](building.md) is a recipe here or a Cargo command the recipes wrap. | +| `just-recipes.json` | A generated projection of the justfile, regenerated by the `lockfiles` recipe and checked for drift by a flake check. Do not edit it by hand. | +| `rust-toolchain.toml` | The toolchain pin: channel `1.99.1`, with the components `rustfmt`, `clippy`, `rust-analyzer` and `llvm-tools`. The flake reads it through rust-overlay. | +| `Cargo.lock` | The workspace lockfile, consumed by both Cargo and the Nix packages. | +| `default.nix`, `shell.nix`, `nix/`, `nix-common.nix` | The non-flake and shared Nix entry points, and the NixOS VM test definitions under `nix/tests/`. | +| `README.md`, `ARCHITECTURE.md`, `WEB.md`, `TODO.md` | The package's older prose documents. They predate parts of the current tree and disagree with it in places; this book documents the source where they differ. `TODO.md` states in its own text that it is idle planning and not a basis for decisions. | ## Where this book lives -| Path | What it is | -|---|---| -| `book/` | This book's chapters, as plain Markdown, organised by the sections in `book/SUMMARY.md`. The book is readable in the repository exactly as written. | -| `book.toml` | The mdBook configuration at the package root: title `id`, source directory `book`, build directory `rendered`, and `create-missing = false` under `[build]`. That last setting is one of the two build gates in [Keeping this book current](keeping-this-book-current.md). | -| `docs.nix` | The Nix derivation that renders the book: it takes only `book.toml` and the `book/` tree as its source, rewrites links that escape the book tree to their repository URLs in the copied pages only, and bakes in a `siteUrl` argument that defaults to `/`. Its header states that it is exposed as the `.#id-docs` flake output. | +| Path | What it is | +| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `book/` | This book's chapters, as plain Markdown, organised by the sections in `book/SUMMARY.md`. The book is readable in the repository exactly as written. | +| `book.toml` | The mdBook configuration at the package root: title `id`, source directory `book`, build directory `rendered`, and `create-missing = false` under `[build]`. That last setting is one of the two build gates in [Keeping this book current](keeping-this-book-current.md). | +| `docs.nix` | The Nix derivation that renders the book: it takes only `book.toml` and the `book/` tree as its source, rewrites links that escape the book tree to their repository URLs in the copied pages only, and bakes in a `siteUrl` argument that defaults to `/`. Its header states that it is exposed as the `.#id-docs` flake output. | | Repository-root `lib/default.nix` | The root flake's wiring for every sub-flake, ID included: its `make-id` function imports `pkgs/id/flake.nix`, re-keys its inputs, and merges its outputs into the root flake — the packages are inherited as-is, and the apps are exposed with an `id-` name prefix, with the `id` app itself running the sub-flake's default app. This is the wiring that makes the sub-flake's packages and checks reachable from the repository root. | ## The design archive diff --git a/pkgs/id/book/development/release-and-rollout.md b/pkgs/id/book/development/release-and-rollout.md index 087b2bd937..8b97ce859c 100644 --- a/pkgs/id/book/development/release-and-rollout.md +++ b/pkgs/id/book/development/release-and-rollout.md @@ -8,10 +8,10 @@ ID has no versioned release process of its own: no release workflow, no tag-and- The packages live in the `packages` set of `pkgs/id/flake.nix`. Both are `pkgs.rustPlatform.buildRustPackage` derivations over the whole `pkgs/id` source tree, both are version `0.1.0`, and both install the same single binary as `bin/id`. -| Package | Flake name | Feature set | Notes | -|---|---|---|---| -| `id-web` | `pname = "id"` | `buildFeatures = ["web", "sandbox", "ssh", "world"]` | The primary product and the flake's `default` package. Its build installs the web dependencies offline through the bun2nix hook (`bunRoot = "web"`), builds the web assets in its `preBuild` step, and builds the Roc platform's Wasm host. | -| `id-lib` | `pname = "id-lib"` | `buildNoDefaultFeatures = true`, `buildFeatures = ["sandbox", "world"]` | The library variant: no web UI, no Bun in its build inputs, no `ssh`. Its feature set is the Cargo default set; the split between the two builds is explained in [Building and testing](building.md). | +| Package | Flake name | Feature set | Notes | +| -------- | ------------------ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id-web` | `pname = "id"` | `buildFeatures = ["web", "sandbox", "ssh", "world"]` | The primary product and the flake's `default` package. Its build installs the web dependencies offline through the bun2nix hook (`bunRoot = "web"`), builds the web assets in its `preBuild` step, and builds the Roc platform's Wasm host. | +| `id-lib` | `pname = "id-lib"` | `buildNoDefaultFeatures = true`, `buildFeatures = ["sandbox", "world"]` | The library variant: no web UI, no Bun in its build inputs, no `ssh`. Its feature set is the Cargo default set; the split between the two builds is explained in [Building and testing](building.md). | Build either package from `pkgs/id/`: diff --git a/pkgs/id/book/getting-started/installation.md b/pkgs/id/book/getting-started/installation.md index 6181f179b1..992e85a973 100644 --- a/pkgs/id/book/getting-started/installation.md +++ b/pkgs/id/book/getting-started/installation.md @@ -39,10 +39,10 @@ serve recipes are `just serve-lib` (which runs The two Nix packages in `pkgs/id/flake.nix` install the same single `id` binary under two feature sets: -| Nix package | Features | Web UI | World SSH serving | -| --- | --- | --- | --- | -| `id-web` (the default package) | `web`, `sandbox`, `ssh`, `world` | yes | yes | -| `id-lib` | `sandbox`, `world` (built with default features off) | no | no | +| Nix package | Features | Web UI | World SSH serving | +| ------------------------------ | ---------------------------------------------------- | ------ | ----------------- | +| `id-web` (the default package) | `web`, `sandbox`, `ssh`, `world` | yes | yes | +| `id-lib` | `sandbox`, `world` (built with default features off) | no | no | Build them with `just build-nix` (the web variant) and `just build-nix-lib` (which runs `nix build .#id-lib`). @@ -126,15 +126,15 @@ before the subcommand, change it: Inside the data directory, the layout is: -| Path | What it is | -| --- | --- | -| `.iroh-store/` | The Iroh blob store (redb plus data files), with the Iroh docs store under `.iroh-store/docs/`. The constant is `STORE_PATH = ".iroh-store"` in `id-store`. | -| `.iroh-key` | The node's own key file. The client key file is `.iroh-key-client`. | -| `.iroh-serve.lock` | The lock file a running `id serve` holds. Its presence is how the REPL and other commands detect the local serve and proxy operations to it. The constant is `SERVE_LOCK = ".iroh-serve.lock"` in `id-core`. | -| `.iroh-meta/` | The tag-store registry directory; the registry file inside it is `.iroh-meta/registry.json`. | -| `.id-worlds//` | Per-world files for a hosted world, where `` is the world name (default `lobby`). | -| `events/` | The event store directory used by `doc`, `claim`, and `writer-sets`. This is the runtime default of the global `--event-store ` flag; a relative value is relative to the data directory. | -| `groups.jsonl` | The group log used by `group`, `delegate`, and `revoke`. This is the runtime default of the global `--groups-log ` flag; a relative value is relative to the data directory. | +| Path | What it is | +| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `.iroh-store/` | The Iroh blob store (redb plus data files), with the Iroh docs store under `.iroh-store/docs/`. The constant is `STORE_PATH = ".iroh-store"` in `id-store`. | +| `.iroh-key` | The node's own key file. The client key file is `.iroh-key-client`. | +| `.iroh-serve.lock` | The lock file a running `id serve` holds. Its presence is how the REPL and other commands detect the local serve and proxy operations to it. The constant is `SERVE_LOCK = ".iroh-serve.lock"` in `id-core`. | +| `.iroh-meta/` | The tag-store registry directory; the registry file inside it is `.iroh-meta/registry.json`. | +| `.id-worlds//` | Per-world files for a hosted world, where `` is the world name (default `lobby`). | +| `events/` | The event store directory used by `doc`, `claim`, and `writer-sets`. This is the runtime default of the global `--event-store ` flag; a relative value is relative to the data directory. | +| `groups.jsonl` | The group log used by `group`, `delegate`, and `revoke`. This is the runtime default of the global `--groups-log ` flag; a relative value is relative to the data directory. | One disagreement is worth knowing before you go looking for the lock: the module documentation in `crates/id-cli/src/commands/serve.rs` once diff --git a/pkgs/id/book/getting-started/shape.md b/pkgs/id/book/getting-started/shape.md index f20dc25d3a..ae13a76607 100644 --- a/pkgs/id/book/getting-started/shape.md +++ b/pkgs/id/book/getting-started/shape.md @@ -25,15 +25,15 @@ CLI types and command functions through `id::…`. Dependency direction runs one way, from leaves to surfaces: -| Layer | Crates | What each owns | -| --- | --- | --- | -| Foundation | `id-core` | The leaf modules everything depends on (10 production dependents): content IDs, the graph record model, signed envelopes, discovery, the port contract vocabulary, and the constants `KEY_FILE = ".iroh-key"`, `CLIENT_KEY_FILE = ".iroh-key-client"`, `SERVE_LOCK = ".iroh-serve.lock"` | -| Data | `id-store`, `id-events` | `id-store`: the blob store, tags, documents, search, and the signed event-header chain. `id-events`: the event store, the group projection, writer sets, and sync gating | -| Platform services | `id-caps`, `id-groups`, `id-sync`, `id-directory` | `id-caps`: the capability catalog, execution limits, and the world manifest. `id-groups`: group policy and enforcement, the blob gate, group encryption. `id-sync`: log sync, the meta protocol, FileOps, envelopes, and artifacts. `id-directory`: the home-server directory, invites, keysets, recovery, and seitan admission | -| Worlds and web | `id-worlds`, `id-web` | `id-worlds`: the world runtime, sessions, the wasmtime sandbox, and cross-world authority (75 `.rs` files, the largest crate). `id-web`: the HTTP and WebSocket server, routes, templates, and markdown | -| Application | `id-cli` | Argument parsing, command implementations, the REPL, and the server-config loader | -| Standalone | `id-config`, `id-currency-registry`, `id-render`, `id-import-notion` | `id-config`: the versioned configuration contract (no production dependents; the facade names it only in dev-dependencies). `id-currency-registry`: the currency control-plane registry (facade only). `id-render`: the rendering pipeline compiler core (no dependents). `id-import-notion`: the Notion importer inventory primitives (no dependents) | -| Shells | `id-native-shell`, `id-hw-shell` | The Bevy native reference shell and the ESP32-class hardware shell spike. Both consume the facade with `default-features = false, features = ["world"]` | +| Layer | Crates | What each owns | +| ----------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Foundation | `id-core` | The leaf modules everything depends on (10 production dependents): content IDs, the graph record model, signed envelopes, discovery, the port contract vocabulary, and the constants `KEY_FILE = ".iroh-key"`, `CLIENT_KEY_FILE = ".iroh-key-client"`, `SERVE_LOCK = ".iroh-serve.lock"` | +| Data | `id-store`, `id-events` | `id-store`: the blob store, tags, documents, search, and the signed event-header chain. `id-events`: the event store, the group projection, writer sets, and sync gating | +| Platform services | `id-caps`, `id-groups`, `id-sync`, `id-directory` | `id-caps`: the capability catalog, execution limits, and the world manifest. `id-groups`: group policy and enforcement, the blob gate, group encryption. `id-sync`: log sync, the meta protocol, FileOps, envelopes, and artifacts. `id-directory`: the home-server directory, invites, keysets, recovery, and seitan admission | +| Worlds and web | `id-worlds`, `id-web` | `id-worlds`: the world runtime, sessions, the wasmtime sandbox, and cross-world authority (75 `.rs` files, the largest crate). `id-web`: the HTTP and WebSocket server, routes, templates, and markdown | +| Application | `id-cli` | Argument parsing, command implementations, the REPL, and the server-config loader | +| Standalone | `id-config`, `id-currency-registry`, `id-render`, `id-import-notion` | `id-config`: the versioned configuration contract (no production dependents; the facade names it only in dev-dependencies). `id-currency-registry`: the currency control-plane registry (facade only). `id-render`: the rendering pipeline compiler core (no dependents). `id-import-notion`: the Notion importer inventory primitives (no dependents) | +| Shells | `id-native-shell`, `id-hw-shell` | The Bevy native reference shell and the ESP32-class hardware shell spike. Both consume the facade with `default-features = false, features = ["world"]` | The split is recorded history, not a plan: the code was one crate and was divided in numbered steps of umbrella issue #3447 — `id-core` in @@ -159,16 +159,16 @@ There is no MCP server binary; see [The MCP bridge](../reference/mcp.md). ## Where data lives -| Data | Store | Location | -| --- | --- | --- | -| File bytes | Iroh blobs `FsStore` (redb plus data files) | `.iroh-store/` in the data directory; in-memory under `serve --ephemeral` | -| File names and metadata tags | Tag store over Iroh docs namespace pairs (global, node-private, custom) | Under `.iroh-store/docs/`; namespace registry at `.iroh-meta/registry.json`, registry version 1 | -| Signed events (documents, claims, groups, writer sets) | Event store, redb file `events.redb`, format marker `id.events.store.v9` | The `events/` directory in the data directory (the `--event-store` default) | -| Group log | Append-only JSONL | `groups.jsonl` in the data directory (the `--groups-log` default) | -| Directory accounts, groups, invites | Directory journal, one JSON entry per line, 17 entry kinds | `directory.jsonl` beside the server config that provisions it | -| World state | Per-world journal plus content-addressed Wasm modules | `.id-worlds//` in the data directory | -| Node and client keys | Key files | `.iroh-key` and `.iroh-key-client` in the data directory; keysets in `.id-keyset.jsonl` and `.id-keyset-client.jsonl` | -| Hosted user data | One `UserDO` Durable Object per bound user (SQLite schema version 3) plus an R2 bucket for blob bytes | In the hosted Worker scaffold only; no deployment exists | +| Data | Store | Location | +| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| File bytes | Iroh blobs `FsStore` (redb plus data files) | `.iroh-store/` in the data directory; in-memory under `serve --ephemeral` | +| File names and metadata tags | Tag store over Iroh docs namespace pairs (global, node-private, custom) | Under `.iroh-store/docs/`; namespace registry at `.iroh-meta/registry.json`, registry version 1 | +| Signed events (documents, claims, groups, writer sets) | Event store, redb file `events.redb`, format marker `id.events.store.v9` | The `events/` directory in the data directory (the `--event-store` default) | +| Group log | Append-only JSONL | `groups.jsonl` in the data directory (the `--groups-log` default) | +| Directory accounts, groups, invites | Directory journal, one JSON entry per line, 17 entry kinds | `directory.jsonl` beside the server config that provisions it | +| World state | Per-world journal plus content-addressed Wasm modules | `.id-worlds//` in the data directory | +| Node and client keys | Key files | `.iroh-key` and `.iroh-key-client` in the data directory; keysets in `.id-keyset.jsonl` and `.id-keyset-client.jsonl` | +| Hosted user data | One `UserDO` Durable Object per bound user (SQLite schema version 3) plus an R2 bucket for blob bytes | In the hosted Worker scaffold only; no deployment exists | The full inventory is [Data stores and schemas](../reference/data-stores.md). diff --git a/pkgs/id/book/index.md b/pkgs/id/book/index.md index d04cfe8e32..fc42eec61a 100644 --- a/pkgs/id/book/index.md +++ b/pkgs/id/book/index.md @@ -89,15 +89,15 @@ ID is one platform with several surfaces. The map below is the whole system on one page; [The shape of the system](getting-started/shape.md) explains how the pieces fit together. -| Surface | What it is | Where it is covered | -| --- | --- | --- | -| The crates | 17 packages: the `id` facade plus `id-core`, `id-caps`, `id-store`, `id-events`, `id-groups`, `id-sync`, `id-directory`, `id-worlds`, `id-web`, `id-cli`, `id-config`, `id-currency-registry`, `id-render`, `id-import-notion`, `id-native-shell`, and `id-hw-shell` | [The crates](library/crates.md), [The id facade crate](library/facade.md) | -| The `id` binary | The CLI: 32 top-level commands and 113 leaf commands (surveyed 2026-11-23), including `serve`, the only command that hosts files, a world, or the web UI | [The id command line](reference/cli.md) | -| The `id-native-shell` binary | A Bevy desktop client for the world shell contract; a workspace member but not a default member, so a normal `id` build never builds it | [id-native-shell](reference/native-shell.md) | -| The REPL | The interactive shell started by `id repl` or by bare `id`, with its own parser, its own command set, and shell features (command substitution, the `|>` pipe-in operator, here-strings, and heredocs) | [The interactive REPL](reference/repl.md) | -| The web UI | The `id-web` crate served by `id serve --web` (bind default `127.0.0.1`, port default `3000`): file browser, collaborative editor, world pages, program gallery, and the HTTP and WebSocket APIs — 54 distinct paths and 58 method bindings in the main router (surveyed 2026-11-23) | [The web UI: pages and HTTP API](reference/web-ui.md), [WebSocket protocols](reference/websockets.md) | -| The hosted Worker scaffold | `pkgs/id/hosted-worker`: a Cloudflare Worker front door forwarding to one `UserDO` Durable Object per bound user, with 15 method routes; local-only, not deployed | [The hosted Worker API](reference/hosted-worker.md) | -| The MCP bridge | `id_caps::mcp_bridge` and `id_caps::mcp_policy`: a library-level translator from 8 pinned MCP v1 tools to world session frames, plus the host-side policy point; no server binary and no transport of its own | [The MCP bridge](reference/mcp.md) | +| Surface | What it is | Where it is covered | +| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | +| The crates | 17 packages: the `id` facade plus `id-core`, `id-caps`, `id-store`, `id-events`, `id-groups`, `id-sync`, `id-directory`, `id-worlds`, `id-web`, `id-cli`, `id-config`, `id-currency-registry`, `id-render`, `id-import-notion`, `id-native-shell`, and `id-hw-shell` | [The crates](library/crates.md), [The id facade crate](library/facade.md) | +| The `id` binary | The CLI: 32 top-level commands and 113 leaf commands (surveyed 2026-11-23), including `serve`, the only command that hosts files, a world, or the web UI | [The id command line](reference/cli.md) | +| The `id-native-shell` binary | A Bevy desktop client for the world shell contract; a workspace member but not a default member, so a normal `id` build never builds it | [id-native-shell](reference/native-shell.md) | +| The REPL | The interactive shell started by `id repl` or by bare `id`, with its own parser, its own command set, and shell features (command substitution, the ` | >` pipe-in operator, here-strings, and heredocs) | [The interactive REPL](reference/repl.md) | +| The web UI | The `id-web` crate served by `id serve --web` (bind default `127.0.0.1`, port default `3000`): file browser, collaborative editor, world pages, program gallery, and the HTTP and WebSocket APIs — 54 distinct paths and 58 method bindings in the main router (surveyed 2026-11-23) | [The web UI: pages and HTTP API](reference/web-ui.md), [WebSocket protocols](reference/websockets.md) | +| The hosted Worker scaffold | `pkgs/id/hosted-worker`: a Cloudflare Worker front door forwarding to one `UserDO` Durable Object per bound user, with 15 method routes; local-only, not deployed | [The hosted Worker API](reference/hosted-worker.md) | +| The MCP bridge | `id_caps::mcp_bridge` and `id_caps::mcp_policy`: a library-level translator from 8 pinned MCP v1 tools to world session frames, plus the host-side policy point; no server binary and no transport of its own | [The MCP bridge](reference/mcp.md) | ## How to read this book diff --git a/pkgs/id/book/library/facade.md b/pkgs/id/book/library/facade.md index 869a6df390..b2ffa2fb1e 100644 --- a/pkgs/id/book/library/facade.md +++ b/pkgs/id/book/library/facade.md @@ -10,34 +10,34 @@ Two scope warnings belong at the front. First, the crate's self-description is s These are `pub mod` declarations with code in `pkgs/id/src/`. Feature gates are noted; unmarked modules are unconditional. -| Module | Gate | Content | -|---|---|---| -| `artifact` | `world` | Shim over the split artifact owners | -| `backup` | — | Backup and restore | -| `blob_gate` | — | Blob gate at its historical path, over `id-store` / `id-groups` / `id-worlds` owners | -| `boards` | `world` | Game posts; runs guest packages through `id::sandbox` | -| `conversion` | — | Format conversion | -| `currency` | — | Currency surface; composes `id-currency-registry` | -| `currency_poc` | — | TigerBeetle proof-of-concept harness for #2289 | -| `device_bridge` | — | Device bridge | -| `didit` | — | The did-it counted view | -| `encryption` | `world` | Encryption at its historical path | -| `envelope_net` | `world` | Envelope networking, over `id-sync` owners | -| `envelope_outbox` | `world` | Envelope outbox, over `id-sync` owners | -| `fileops` | — | File operations at their historical path, over `id-sync` | -| `foreign_libsql` | — | Foreign libSQL access | -| `grant_service` | — | Grant service | -| `grants` | — | Grants | -| `groups` | — | Group facade: `src/groups/mod.rs` re-exports from `id_events::groups`, `id_groups::groups`, and `id_worlds::groups::worlds` | -| `hosted_binding` | — | Hosted-edition binding ceremony | -| `hosted_export` | — | Hosted export | -| `hosted_ingest` | — | Hosted ingest | -| `input_framing` | — | Input framing | -| `pull_policy` | — | Pull policy at its historical path, over `id-events` | -| `references` | — | References | -| `serve_proxy` | — | Serve proxy | -| `store_traits` | — | Store traits at their historical path, over `id-store` | -| `structured_logging` | — | Structured logging configuration | +| Module | Gate | Content | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| `artifact` | `world` | Shim over the split artifact owners | +| `backup` | — | Backup and restore | +| `blob_gate` | — | Blob gate at its historical path, over `id-store` / `id-groups` / `id-worlds` owners | +| `boards` | `world` | Game posts; runs guest packages through `id::sandbox` | +| `conversion` | — | Format conversion | +| `currency` | — | Currency surface; composes `id-currency-registry` | +| `currency_poc` | — | TigerBeetle proof-of-concept harness for #2289 | +| `device_bridge` | — | Device bridge | +| `didit` | — | The did-it counted view | +| `encryption` | `world` | Encryption at its historical path | +| `envelope_net` | `world` | Envelope networking, over `id-sync` owners | +| `envelope_outbox` | `world` | Envelope outbox, over `id-sync` owners | +| `fileops` | — | File operations at their historical path, over `id-sync` | +| `foreign_libsql` | — | Foreign libSQL access | +| `grant_service` | — | Grant service | +| `grants` | — | Grants | +| `groups` | — | Group facade: `src/groups/mod.rs` re-exports from `id_events::groups`, `id_groups::groups`, and `id_worlds::groups::worlds` | +| `hosted_binding` | — | Hosted-edition binding ceremony | +| `hosted_export` | — | Hosted export | +| `hosted_ingest` | — | Hosted ingest | +| `input_framing` | — | Input framing | +| `pull_policy` | — | Pull policy at its historical path, over `id-events` | +| `references` | — | References | +| `serve_proxy` | — | Serve proxy | +| `store_traits` | — | Store traits at their historical path, over `id-store` | +| `structured_logging` | — | Structured logging configuration | The binary entry point `src/main.rs` also stays in this package and consumes the library through `id::` paths exactly like an external consumer. diff --git a/pkgs/id/book/library/guests-and-shells.md b/pkgs/id/book/library/guests-and-shells.md index 7d1661f44d..2188938163 100644 --- a/pkgs/id/book/library/guests-and-shells.md +++ b/pkgs/id/book/library/guests-and-shells.md @@ -41,17 +41,17 @@ The Roc client library is `RocCap`: a session issuing request ids `r0`, `r1`, an Checked-in `.wasm` artefacts sit beside most apps, so the host conformance suites run without a Roc toolchain. `pkgs/id/apps/tic-tac-toe/` is the sole packaged app; the other eight live in `pkgs/id/examples/`. -| App | Location | What it does | -|---|---|---| -| tic-tac-toe | `apps/tic-tac-toe/` | Packaged two-player tic-tac-toe. Its `app.toml` declares `[program] kind = "roc-world"` and the guest is `program/main.roc`; the directory contains no Rust. Digit `0`–`8` moves, ply parity picks X or O, and `records` publishes `{"board","plays","winner"}`. The install path is serve-time: `id serve --world-module …` or `id world install`. | -| lounge | `examples/lounge/` | Capability-system demo: subscribes to `players` and `time.tick:5000`, greets arrivals through `chat.say` requests with refusals counted as `denied=N`, and polls `time.now`. | -| roc-counter | `examples/roc-counter/` | Tiny pure counter world: guests send `inc`, all participants see `count=N`; demonstrates `records` mirroring and the `Screen` presentation. | -| roc-text-counter | `examples/roc-text-counter/` | The no-`Screen` legacy-text twin of roc-counter: imports no platform modules and keeps the plain-text presentation path covered (#3181). | -| roc-chat | `examples/roc-chat/` | Minimal chat client on `RocCap` with `chat.say` and `chat.history`; typing `hist` shows the newest 8 lines. | -| roc-grid | `examples/roc-grid/` | `RocGrid` demo: a 4×3 byte grid where `set` claims the centre cell; bounds-checked reads with a fallback. | -| roc-screen | `examples/roc-screen/` | `Screen` and `Key` demo: a bordered-box counter screen document, `+` increments; presenters (SSH ANSI, browser DOM) render the structured grid. | -| territory | `examples/territory/` | Multiplayer territory game: at most 8 seated players on a 16×8 grid, adjacency-only claiming, seats persist across leave, rejoin, and restart. | -| roc-cap-demo | `examples/roc-cap-demo/` | Library-import worked example (#5957): a capability-dependent Roc library (`lib/Greeter.roc` over `records.read`) plus its app, with two compile-must-fail negative tests — a missing capability on `platform-no-caps.roc`, and a wrong `RocCap` signature. | +| App | Location | What it does | +| ---------------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| tic-tac-toe | `apps/tic-tac-toe/` | Packaged two-player tic-tac-toe. Its `app.toml` declares `[program] kind = "roc-world"` and the guest is `program/main.roc`; the directory contains no Rust. Digit `0`–`8` moves, ply parity picks X or O, and `records` publishes `{"board","plays","winner"}`. The install path is serve-time: `id serve --world-module …` or `id world install`. | +| lounge | `examples/lounge/` | Capability-system demo: subscribes to `players` and `time.tick:5000`, greets arrivals through `chat.say` requests with refusals counted as `denied=N`, and polls `time.now`. | +| roc-counter | `examples/roc-counter/` | Tiny pure counter world: guests send `inc`, all participants see `count=N`; demonstrates `records` mirroring and the `Screen` presentation. | +| roc-text-counter | `examples/roc-text-counter/` | The no-`Screen` legacy-text twin of roc-counter: imports no platform modules and keeps the plain-text presentation path covered (#3181). | +| roc-chat | `examples/roc-chat/` | Minimal chat client on `RocCap` with `chat.say` and `chat.history`; typing `hist` shows the newest 8 lines. | +| roc-grid | `examples/roc-grid/` | `RocGrid` demo: a 4×3 byte grid where `set` claims the centre cell; bounds-checked reads with a fallback. | +| roc-screen | `examples/roc-screen/` | `Screen` and `Key` demo: a bordered-box counter screen document, `+` increments; presenters (SSH ANSI, browser DOM) render the structured grid. | +| territory | `examples/territory/` | Multiplayer territory game: at most 8 seated players on a 16×8 grid, adjacency-only claiming, seats persist across leave, rejoin, and restart. | +| roc-cap-demo | `examples/roc-cap-demo/` | Library-import worked example (#5957): a capability-dependent Roc library (`lib/Greeter.roc` over `records.read`) plus its app, with two compile-must-fail negative tests — a missing capability on `platform-no-caps.roc`, and a wrong `RocCap` signature. | Two neighbours in `examples/` are not apps. `examples/roc-world/` is the shared platform package itself, and `examples/roc-import-policy/` is a compile-fixture matrix (`fixtures.json`) for the import gate (#5994, #5956), executed by the `id-caps` integration test. diff --git a/pkgs/id/book/operations/backup-and-restore.md b/pkgs/id/book/operations/backup-and-restore.md index fe9e8ced61..eab1a76848 100644 --- a/pkgs/id/book/operations/backup-and-restore.md +++ b/pkgs/id/book/operations/backup-and-restore.md @@ -6,30 +6,30 @@ The store formats themselves are in [Data stores and schemas](../reference/data- ## Where the data directory is -| How the node was started | Data directory | -|---|---| -| No global flags | The current working directory. | -| `--data-dir ` | ``, created if missing. | -| `--new []` | `.iroh//` under the current directory; a random 8-hex name when `` is omitted. | +| How the node was started | Data directory | +| -------------------------- | ------------------------------------------------------------------------------------------ | +| No global flags | The current working directory. | +| `--data-dir ` | ``, created if missing. | +| `--new []` | `.iroh//` under the current directory; a random 8-hex name when `` is omitted. | | `--ephemeral` (serve only) | No store on disk. The store is in memory and is lost at exit. There is nothing to back up. | All paths below are relative to the data directory, because the process changes directory into it at startup. ## The directory, item by item -| Path | What it is | Back it up? | -|---|---|---| -| `.iroh-store/` | The blob and name store: iroh-blobs `FsStore` (redb plus data files). The iroh-docs store sits under `.iroh-store/docs/`. This is the content-addressed store: a name points at an immutable blob hash, and the blob bytes are the file content. | Yes. This is the record for stored files. | -| `.iroh-key` | The node key file. The keypair for this node's identity. A second file, `.iroh-key-client`, holds the client key where a client identity exists. | Yes. Losing the key loses the identity; the store without the key is content under a name nobody can prove is theirs. Keep the copy access-controlled; this book never prints a key value. | -| `.iroh-serve.lock` | The serve lock, present while a serve process owns the directory. Constant `SERVE_LOCK` in `id-core`. | No. It is runtime state, recreated by the next serve. Do not copy it into a backup as a record, and do not expect it in a restored directory. | -| `.iroh-allowed` | Optional plain-text file, one node ID per line, naming nodes allowed to write the store in addition to `--allow-node ` and this machine's own keys. | Yes, if present. It is operator configuration that exists nowhere else. | -| `groups.jsonl` | The default group log for the `group`, `delegate` and `revoke` commands. The global flag `--groups-log ` moves it; a relative path is relative to the data directory. | Yes. Group membership and delegation history live here. | -| `events/` | The default event-store directory for the `doc`, `claim` and `writer-sets` commands. The global flag `--event-store ` moves it; a relative path is relative to the data directory. Inside it, the event store file is `events.redb`, format marker `id.events.store.v9`. | Yes. Documents, claims and writer sets live here. | -| `.iroh-meta/registry.json` | The tag registry: namespace records for the tag store (global, node-private and custom paired namespaces) plus a one-time migration marker. Registry format version `1`. | Yes. Tags themselves live in the iroh-docs namespaces under `.iroh-store/docs/`; the registry records which namespaces exist. Back it up together with `.iroh-store/`, never instead of it. | -| `.id-worlds//` | One directory per hosted world, named by `--world-name ` (default world name `lobby`). Holds the world's journal and its checkpoints: the signed, ordered record of world inputs and the folded state snapshots the host trims to every `--world-checkpoint-every ` events (default `1000`; `0` never trims). | Yes, for every world the node hosts. A world's journal is its record; see below. | -| `.id-keyset.jsonl`, `.id-keyset-client.jsonl` | Keyset records: device enrolment, guardians, rotation and recovery state for the account keyset. | Yes, if present. | -| `directory.jsonl` | The directory journal: one JSON `DirectoryEntry` per line. **Unverified location detail:** the survey records its location as the directory that holds the server-config file given to `--server-config `, not as a fixed data-directory path. Back up the copy that sits next to the server-config file the node actually loads. | Yes, if the node runs with a server config. | -| Gallery directory (`--gallery-dir `, or `ID_GALLERY_DIR`) | Verified `.idpb` bundle files plus an `operator/` subdirectory holding collections, tags and admission decisions. The directory is wherever the operator put it; it is not inside the data directory by default. | Yes, if the node serves a gallery. Back up the directory the flag points at. | +| Path | What it is | Back it up? | +| -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `.iroh-store/` | The blob and name store: iroh-blobs `FsStore` (redb plus data files). The iroh-docs store sits under `.iroh-store/docs/`. This is the content-addressed store: a name points at an immutable blob hash, and the blob bytes are the file content. | Yes. This is the record for stored files. | +| `.iroh-key` | The node key file. The keypair for this node's identity. A second file, `.iroh-key-client`, holds the client key where a client identity exists. | Yes. Losing the key loses the identity; the store without the key is content under a name nobody can prove is theirs. Keep the copy access-controlled; this book never prints a key value. | +| `.iroh-serve.lock` | The serve lock, present while a serve process owns the directory. Constant `SERVE_LOCK` in `id-core`. | No. It is runtime state, recreated by the next serve. Do not copy it into a backup as a record, and do not expect it in a restored directory. | +| `.iroh-allowed` | Optional plain-text file, one node ID per line, naming nodes allowed to write the store in addition to `--allow-node ` and this machine's own keys. | Yes, if present. It is operator configuration that exists nowhere else. | +| `groups.jsonl` | The default group log for the `group`, `delegate` and `revoke` commands. The global flag `--groups-log ` moves it; a relative path is relative to the data directory. | Yes. Group membership and delegation history live here. | +| `events/` | The default event-store directory for the `doc`, `claim` and `writer-sets` commands. The global flag `--event-store ` moves it; a relative path is relative to the data directory. Inside it, the event store file is `events.redb`, format marker `id.events.store.v9`. | Yes. Documents, claims and writer sets live here. | +| `.iroh-meta/registry.json` | The tag registry: namespace records for the tag store (global, node-private and custom paired namespaces) plus a one-time migration marker. Registry format version `1`. | Yes. Tags themselves live in the iroh-docs namespaces under `.iroh-store/docs/`; the registry records which namespaces exist. Back it up together with `.iroh-store/`, never instead of it. | +| `.id-worlds//` | One directory per hosted world, named by `--world-name ` (default world name `lobby`). Holds the world's journal and its checkpoints: the signed, ordered record of world inputs and the folded state snapshots the host trims to every `--world-checkpoint-every ` events (default `1000`; `0` never trims). | Yes, for every world the node hosts. A world's journal is its record; see below. | +| `.id-keyset.jsonl`, `.id-keyset-client.jsonl` | Keyset records: device enrolment, guardians, rotation and recovery state for the account keyset. | Yes, if present. | +| `directory.jsonl` | The directory journal: one JSON `DirectoryEntry` per line. **Unverified location detail:** the survey records its location as the directory that holds the server-config file given to `--server-config `, not as a fixed data-directory path. Back up the copy that sits next to the server-config file the node actually loads. | Yes, if the node runs with a server config. | +| Gallery directory (`--gallery-dir `, or `ID_GALLERY_DIR`) | Verified `.idpb` bundle files plus an `operator/` subdirectory holding collections, tags and admission decisions. The directory is wherever the operator put it; it is not inside the data directory by default. | Yes, if the node serves a gallery. Back up the directory the flag points at. | Files a node writes outside the data directory, and therefore outside a data-directory backup: the log file named by `ID_LOG_FILE` (operator logging, not node state), the compiled-world cache named by `ID_WORLD_COMPILE_CACHE_DIR` (derivable; see below), and the gallery directory above. diff --git a/pkgs/id/book/operations/deploying-this-book.md b/pkgs/id/book/operations/deploying-this-book.md index 3418cb24c1..082d996dac 100644 --- a/pkgs/id/book/operations/deploying-this-book.md +++ b/pkgs/id/book/operations/deploying-this-book.md @@ -4,14 +4,14 @@ This book is one of four books on **one** GitHub Pages site. That single fact de ## The pieces -| Piece | What it is | -|---|---| -| `pkgs/id/book/` | The book sources — the Markdown chapters, in the layout the summary file names | -| `pkgs/id/book.toml` | The mdBook configuration: title `id`, `src = "book"`, `build-dir = "rendered"`, `create-missing = false` — a chapter named in the summary but missing on disk is a build failure, never a silently generated stub | -| `pkgs/id/docs.nix` | The build: an mdBook build of the sources above, sandboxed, with the flake-pinned mdBook from nixpkgs and no network access. It rewrites links that escape the book tree to their repository URLs in the rendered copy only, and takes the base URL as its `siteUrl` argument | -| `lib/default.nix` | Exposes that build to the flake as **`.#id-docs`** | -| `.github/workflows/id-docs.yml` | The build-only workflow for this book (below) | -| `.github/workflows/mcpx-docs.yml` | The combined deploy workflow for the whole Pages site (below) | +| Piece | What it is | +| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `pkgs/id/book/` | The book sources — the Markdown chapters, in the layout the summary file names | +| `pkgs/id/book.toml` | The mdBook configuration: title `id`, `src = "book"`, `build-dir = "rendered"`, `create-missing = false` — a chapter named in the summary but missing on disk is a build failure, never a silently generated stub | +| `pkgs/id/docs.nix` | The build: an mdBook build of the sources above, sandboxed, with the flake-pinned mdBook from nixpkgs and no network access. It rewrites links that escape the book tree to their repository URLs in the rendered copy only, and takes the base URL as its `siteUrl` argument | +| `lib/default.nix` | Exposes that build to the flake as **`.#id-docs`** | +| `.github/workflows/id-docs.yml` | The build-only workflow for this book (below) | +| `.github/workflows/mcpx-docs.yml` | The combined deploy workflow for the whole Pages site (below) | Build the book locally exactly as CI does: @@ -33,12 +33,12 @@ It publishes nothing. Its permissions are `contents: read` only; there is no Pag This is the repository's one Pages deployment. It builds each book and stages them into **one site tree**, then deploys that tree as the site's single artifact. The mcpx book is the site root; the other three books are staged under it: -| Staged path | Book | Site URL | -|---|---|---| -| Site root (`site/`) | The mcpx book | `https://developing-today.github.io/code/` | -| `site/fleet/` | The fleet book | `https://developing-today.github.io/code/fleet/` | -| `site/atlas/` | The atlas book | `https://developing-today.github.io/code/atlas/` | -| `site/id/` | This book | `https://developing-today.github.io/code/id/` | +| Staged path | Book | Site URL | +| ------------------- | -------------- | ------------------------------------------------ | +| Site root (`site/`) | The mcpx book | `https://developing-today.github.io/code/` | +| `site/fleet/` | The fleet book | `https://developing-today.github.io/code/fleet/` | +| `site/atlas/` | The atlas book | `https://developing-today.github.io/code/atlas/` | +| `site/id/` | This book | `https://developing-today.github.io/code/id/` | Each book is built with its own `siteUrl` override — `/code/` for the root mcpx book, `/code/fleet/`, `/code/atlas/` and `/code/id/` for the staged books — the path prefix the rendered links and assets must assume, because those books do not live at the site root. The deploy then publishes the assembled `site/` tree once, through the Pages artifact flow: `actions/configure-pages`, `actions/upload-pages-artifact`, and `actions/deploy-pages` in a separate publish job, serialised so two deploys never interleave. diff --git a/pkgs/id/book/operations/services.md b/pkgs/id/book/operations/services.md index 0b81030ce4..d78a79e865 100644 --- a/pkgs/id/book/operations/services.md +++ b/pkgs/id/book/operations/services.md @@ -24,45 +24,45 @@ Two local nodes that the user runs are recorded in the standing record, not in t The global flags decide where a node lives, and they apply to every command, not only to `serve`: -| Flag | Effect | -|---|---| -| `-d, --data-dir ` | Use `` as the base directory for `.iroh-store`, `.iroh-key` and `.iroh-serve.lock`. The directory is created if missing. The process changes directory into it at startup. Conflicts with `--new`. | -| `--new []` | Create `.iroh//` under the current directory and use it as the data directory. With no name, a random 8-hex name is used. Startup fails if the directory already exists. The name must not contain `/`, `\` or `..`. | +| Flag | Effect | +| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `-d, --data-dir ` | Use `` as the base directory for `.iroh-store`, `.iroh-key` and `.iroh-serve.lock`. The directory is created if missing. The process changes directory into it at startup. Conflicts with `--new`. | +| `--new []` | Create `.iroh//` under the current directory and use it as the data directory. With no name, a random 8-hex name is used. Startup fails if the directory already exists. The name must not contain `/`, `\` or `..`. | Running two nodes on one machine means two data directories. Two serves in one data directory do not work; the second one meets the serve lock and the single-opener store lock (see [Troubleshooting](troubleshooting.md)). ## The web UI -| Flag | Default | Effect | -|---|---|---| -| `--web` | off | Start the HTTP web UI. Startup fails on a build without the `web` feature; see [Troubleshooting](troubleshooting.md). | -| `--port ` | `3000` | Web port. `0` lets the operating system assign the port. | -| `--bind ` | `127.0.0.1` | Web bind address. The default binds loopback only. | -| `--web-listen ` | none | Repeatable. Replaces the `web_bindings` list from `defaults.json`. Startup fails if `--web-listen` is combined with an explicitly set `--bind` or `--port`. | -| `--web-token ` | unset | Gate token for the web UI, accepted as the `id_token` cookie, as `Authorization: Bearer`, or as a `?token=` query parameter that sets the cookie and redirects. The environment variable `ID_WEB_TOKEN` sets the same value. The value is never printed in this book. | -| `--web-cookie-secure` | off | Mark web cookies `Secure`. The environment variable `ID_WEB_COOKIE_SECURE` sets the same flag. | +| Flag | Default | Effect | +| ------------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--web` | off | Start the HTTP web UI. Startup fails on a build without the `web` feature; see [Troubleshooting](troubleshooting.md). | +| `--port ` | `3000` | Web port. `0` lets the operating system assign the port. | +| `--bind ` | `127.0.0.1` | Web bind address. The default binds loopback only. | +| `--web-listen ` | none | Repeatable. Replaces the `web_bindings` list from `defaults.json`. Startup fails if `--web-listen` is combined with an explicitly set `--bind` or `--port`. | +| `--web-token ` | unset | Gate token for the web UI, accepted as the `id_token` cookie, as `Authorization: Bearer`, or as a `?token=` query parameter that sets the cookie and redirects. The environment variable `ID_WEB_TOKEN` sets the same value. The value is never printed in this book. | +| `--web-cookie-secure` | off | Mark web cookies `Secure`. The environment variable `ID_WEB_COOKIE_SECURE` sets the same flag. | Startup prints a warning when a web listener is bound without `--web-token`. On a loopback bind the web layer also enforces a Host allow-list (`localhost`, `127.0.0.1`, `::1`, plus operator extras) and a same-origin check on requests that carry an `Origin` header. Binding to a non-loopback address without a token removes the loopback protection and leaves the token as the only gate; the book states the mechanism and makes no recommendation beyond that fact. The pages and routes themselves are in [The web UI: pages and HTTP API](../reference/web-ui.md). ## Hosting a world -| Flag | Default | Effect | -|---|---|---| -| `--world` | off | Host a multiplayer world. Requires `--world-admin-token `. | -| `--world-admin-token ` | unset | The admin token for the hosted world. The environment variable `ID_WORLD_ADMIN_TOKEN` sets the same value. The value is never printed in this book. | -| `--world-name ` | `lobby` | Name of the default world. Its files live in `.id-worlds//` inside the data directory. The name uses the characters `a-z`, `0-9`, `-` and `_`. | -| `--world-module ` | none | A precompiled Wasm module (Roc ABI) to load into the world. Requires `--world` and a build with the `sandbox` feature. | -| `--world-checkpoint-every ` | `1000` | Journal events between checkpoints. `0` never trims the journal. | -| `--world-max-open ` | `256` | Maximum open worlds. | -| `--world-max-sessions ` | `1024` | Maximum world sessions. | -| `--world-idle-secs ` | `600` | Seconds before an idle world is closed. `0` keeps worlds open. | -| `--world-boot-window-secs ` | `600` | Replay-refusal window after startup, in seconds. `0` disables it. | -| `--world-cap-policy ` | `deny` | Capability policy for the default world's program. The other documented value is `grant-on-use`. | -| `--world-allowed-caps ` | none | Comma-separated server-wide capability ceiling. The value `*` is refused here. | -| `--world-cap ` | none | Repeatable. One capability for the default world's program. `*` means the whole catalog. | -| `--world-ssh-port ` | none | Serve the world over SSH, bound to the `--bind` address. Requires `--world`. Actual SSH serving exists only in a build with the `ssh` feature. | -| `--world-native` | off | Accept native (ELF) module installs, in the OS-sandbox tier. | -| `--world-source-only` | off | Accept Roc-source installs only. Conflicts with `--world-module`. The environment variable `ID_WORLD_SOURCE_ONLY` sets the same flag. | +| Flag | Default | Effect | +| ------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--world` | off | Host a multiplayer world. Requires `--world-admin-token `. | +| `--world-admin-token ` | unset | The admin token for the hosted world. The environment variable `ID_WORLD_ADMIN_TOKEN` sets the same value. The value is never printed in this book. | +| `--world-name ` | `lobby` | Name of the default world. Its files live in `.id-worlds//` inside the data directory. The name uses the characters `a-z`, `0-9`, `-` and `_`. | +| `--world-module ` | none | A precompiled Wasm module (Roc ABI) to load into the world. Requires `--world` and a build with the `sandbox` feature. | +| `--world-checkpoint-every ` | `1000` | Journal events between checkpoints. `0` never trims the journal. | +| `--world-max-open ` | `256` | Maximum open worlds. | +| `--world-max-sessions ` | `1024` | Maximum world sessions. | +| `--world-idle-secs ` | `600` | Seconds before an idle world is closed. `0` keeps worlds open. | +| `--world-boot-window-secs ` | `600` | Replay-refusal window after startup, in seconds. `0` disables it. | +| `--world-cap-policy ` | `deny` | Capability policy for the default world's program. The other documented value is `grant-on-use`. | +| `--world-allowed-caps ` | none | Comma-separated server-wide capability ceiling. The value `*` is refused here. | +| `--world-cap ` | none | Repeatable. One capability for the default world's program. `*` means the whole catalog. | +| `--world-ssh-port ` | none | Serve the world over SSH, bound to the `--bind` address. Requires `--world`. Actual SSH serving exists only in a build with the `ssh` feature. | +| `--world-native` | off | Accept native (ELF) module installs, in the OS-sandbox tier. | +| `--world-source-only` | off | Accept Roc-source installs only. Conflicts with `--world-module`. The environment variable `ID_WORLD_SOURCE_ONLY` sets the same flag. | The runtime limits for guest execution are flags in the same family: `--world-fuel ` (default `10000000`), `--world-memory-mib ` (default `16`), `--world-message-kib ` (default `1024`), `--world-total-memory-mib ` (default `64`), and the native-tier limits `--world-native-memory-mib ` (default `256`), `--world-native-cpu-secs ` (default `10`) and `--world-native-deadline-ms ` (default `10000`). Confirmation mail for world sign-up has three mutually conflicting sinks, all requiring `--world`: `--world-mail-outbox `, `--world-mail-command ` and `--world-mail-smtp ` (SMTP also requires `--world-mail-from ` and must be loopback). @@ -76,45 +76,45 @@ Clients then join with the commands in [World commands: joining and playing](../ ## Discovery: relay, gossip, mDNS and DHT -| Flag | Default | Effect | -|---|---|---| -| `--no-relay` | relay on | Direct connections only; no relay is used. | -| `--no-gossip` | gossip on | No gossip discovery or announcement. | -| `--gossip` | — | Force gossip on. Conflicts with `--no-gossip`. | -| `--no-mdns` | mDNS on | Disable mDNS local discovery. | -| `--dht` | off | Enable mainline DHT address lookup and publishing. The flag parses in every build; the `dht` cargo feature controls the underlying behaviour in `id-sync`. | -| `--bootstrap ` | from `defaults.json` | Comma-separated bootstrap node IDs. Repeatable through the comma delimiter. | -| `--no-default-bootstrap` | — | Ignore bootstrap IDs from `defaults.json`. | -| `--topic ` | see below | Gossip topic. | -| `--topic-secret ` | see below | Gossip topic secret. The value is never printed in this book. | -| `--no-default-topic` | — | Ignore topic and secret from `defaults.json`; fall back to the hardcoded constants. | +| Flag | Default | Effect | +| ------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--no-relay` | relay on | Direct connections only; no relay is used. | +| `--no-gossip` | gossip on | No gossip discovery or announcement. | +| `--gossip` | — | Force gossip on. Conflicts with `--no-gossip`. | +| `--no-mdns` | mDNS on | Disable mDNS local discovery. | +| `--dht` | off | Enable mainline DHT address lookup and publishing. The flag parses in every build; the `dht` cargo feature controls the underlying behaviour in `id-sync`. | +| `--bootstrap ` | from `defaults.json` | Comma-separated bootstrap node IDs. Repeatable through the comma delimiter. | +| `--no-default-bootstrap` | — | Ignore bootstrap IDs from `defaults.json`. | +| `--topic ` | see below | Gossip topic. | +| `--topic-secret ` | see below | Gossip topic secret. The value is never printed in this book. | +| `--no-default-topic` | — | Ignore topic and secret from `defaults.json`; fall back to the hardcoded constants. | The topic defaults need care, because `--help` states them in a way that misleads. The help text gives `--topic` a default of `id-peer-discovery-v1` and `--topic-secret` a default of `id-public-discovery-v1`. Those two strings are the hardcoded fallback constants. The operative default on a stock build comes first from the embedded `defaults.json`, whose shipped content sets `topic` to `id-peer-discovery-v1` and `topic_secret` to `id-public-discovery-v1` — the same strings today, by coincidence of the shipped file, not by the help text's logic. If `defaults.json` changes, serve follows the file, not the constants, unless `--no-default-topic` is passed. The `--version` output reports which defaults source is in force, as a second line naming the file hash and mode (`append` or the built-in equivalent). This is disagreement CLI-6 in the survey record. The full configuration precedence is in [Configuration and environment](../reference/configuration.md). ## Who may write -| Flag | Default | Effect | -|---|---|---| -| `--allow-node ` | none | Repeatable, comma-separated. Node IDs allowed to write the store. The file `.iroh-allowed` in the data directory (one node ID per line) adds more, and this machine's own keys are always allowed. | -| `--open-writes` | off | Any peer may write the store. The help text documents this as insecure. | +| Flag | Default | Effect | +| -------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--allow-node ` | none | Repeatable, comma-separated. Node IDs allowed to write the store. The file `.iroh-allowed` in the data directory (one node ID per line) adds more, and this machine's own keys are always allowed. | +| `--open-writes` | off | Any peer may write the store. The help text documents this as insecure. | With neither flag, writes from other nodes are not accepted beyond this machine's own keys and the `.iroh-allowed` list. ## The gallery -| Flag | Default | Effect | -|---|---|---| -| `--gallery-dir ` | unset | Serve a program gallery from ``: the Iroh registry plus the `/api/gallery/*` routes when `--web` is on. Every bundle file in the directory is verified at startup. The environment variable `ID_GALLERY_DIR` sets the same value. | -| `--gallery-accept-publish` | off | Accept gallery publishes. Requires `--gallery-dir`. The environment variable `ID_GALLERY_ACCEPT_PUBLISH` sets the same flag. | +| Flag | Default | Effect | +| -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--gallery-dir ` | unset | Serve a program gallery from ``: the Iroh registry plus the `/api/gallery/*` routes when `--web` is on. Every bundle file in the directory is verified at startup. The environment variable `ID_GALLERY_DIR` sets the same value. | +| `--gallery-accept-publish` | off | Accept gallery publishes. Requires `--gallery-dir`. The environment variable `ID_GALLERY_ACCEPT_PUBLISH` sets the same flag. | Without a gallery directory, the gallery routes answer 404. Operating the gallery (approval, removal, reinstatement) is in [Gallery, match-audit and walk](../reference/cli-gallery-walk.md). ## Server config and ephemeral mode -| Flag | Default | Effect | -|---|---|---| -| `--server-config ` | none | Load an operator server-config TOML file: provisioned users and groups, create policy, pull policy, budgets, residency and boundaries. A malformed file fails startup and names the parse error. Loading requires a build with the `world` feature. The key list is in [Configuration and environment](../reference/configuration.md). | -| `--ephemeral` | off | Use an in-memory store. All content is lost when the process exits. No `.iroh-store` on disk is the record for an ephemeral node. | +| Flag | Default | Effect | +| ------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--server-config ` | none | Load an operator server-config TOML file: provisioned users and groups, create policy, pull policy, budgets, residency and boundaries. A malformed file fails startup and names the parse error. Loading requires a build with the `world` feature. The key list is in [Configuration and environment](../reference/configuration.md). | +| `--ephemeral` | off | Use an in-memory store. All content is lost when the process exits. No `.iroh-store` on disk is the record for an ephemeral node. | An ephemeral node is the right shape for a throwaway test peer and the wrong shape for anything whose files must survive the terminal closing. Nothing about `--ephemeral` is written to the data directory's store, because there is no store. @@ -122,11 +122,11 @@ An ephemeral node is the right shape for a throwaway test peer and the wrong sha Serve reads three environment variables outside the flag parser: -| Variable | Effect when set | -|---|---| -| `ID_WORLD_COMPILE_CACHE_DIR` | Directory for the shared compiled-world cache. Unset or empty disables that cache. | +| Variable | Effect when set | +| ---------------------------------- | ---------------------------------------------------------------------------------- | +| `ID_WORLD_COMPILE_CACHE_DIR` | Directory for the shared compiled-world cache. Unset or empty disables that cache. | | `ID_WORLD_COMPILE_CACHE_LRU_BYTES` | Size limit for that cache. An unparsable value falls back to the default of 2 GiB. | -| `ID_APPS_DIR` | Apps root for host app discovery. Unset falls back to the built-in apps root. | +| `ID_APPS_DIR` | Apps root for host app discovery. Unset falls back to the built-in apps root. | For `--world-mail-command`, serve sets `ID_MAIL_TO`, `ID_MAIL_SUBJECT` and `ID_MAIL_BODY` in the child process environment. Those are outputs of serve, not settings an operator provides. @@ -161,10 +161,10 @@ A second package, `pkgs/id/worker-poc`, is a proof of concept that runs one exam Serve has no special exit codes of its own. The `id` binary's contract, from [The id command line](../reference/cli.md), is: -| Exit | Meaning | -|---|---| -| `0` | Success, including `--help` and `--version`. | -| `1` | A handler error. The error chain is printed to stderr as `Error: `. Startup failures (malformed `--server-config`, the `--web-listen` conflict, a build without a required feature) are in this class. | -| `2` | A command-line parse error: unknown flag, missing required argument, conflicting flags, bad value. Usage is printed to stderr. | +| Exit | Meaning | +| ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `0` | Success, including `--help` and `--version`. | +| `1` | A handler error. The error chain is printed to stderr as `Error: `. Startup failures (malformed `--server-config`, the `--web-listen` conflict, a build without a required feature) are in this class. | +| `2` | A command-line parse error: unknown flag, missing required argument, conflicting flags, bad value. Usage is printed to stderr. | A script that supervises serve should treat exit `1` at startup as a configuration fault to fix, not a transient fault to retry unchanged. diff --git a/pkgs/id/book/operations/troubleshooting.md b/pkgs/id/book/operations/troubleshooting.md index c89a4c9043..366bf10503 100644 --- a/pkgs/id/book/operations/troubleshooting.md +++ b/pkgs/id/book/operations/troubleshooting.md @@ -86,10 +86,10 @@ The `id` binary's exit contract, because half of scripting against it goes wrong ## Quick checks before filing anything -| Check | What it settles | -|---|---| -| `id --version` prints two lines | The binary is a current-source build, and the second line names the defaults source in force. | -| `id walk --help` exists | The binary is not one of the old store builds (CLI-4). | -| The data directory holds `.iroh-serve.lock` | A serve owns that directory now, or a lock outlived its process (unverified case, above). | -| `id world journal check ` exits `0` | That world's journal is valid and readable by this binary. | -| Exit code is `2` | The command line itself was rejected; fix the flags before investigating the node. | +| Check | What it settles | +| ------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `id --version` prints two lines | The binary is a current-source build, and the second line names the defaults source in force. | +| `id walk --help` exists | The binary is not one of the old store builds (CLI-4). | +| The data directory holds `.iroh-serve.lock` | A serve owns that directory now, or a lock outlived its process (unverified case, above). | +| `id world journal check ` exits `0` | That world's journal is valid and readable by this binary. | +| Exit code is `2` | The command line itself was rejected; fix the flags before investigating the node. | diff --git a/pkgs/id/book/reference/cli-files.md b/pkgs/id/book/reference/cli-files.md index 365260e6fc..f129a1acc3 100644 --- a/pkgs/id/book/reference/cli-files.md +++ b/pkgs/id/book/reference/cli-files.md @@ -26,12 +26,12 @@ id in|add|store|import [FILES]... Aliases: `in`, `add`, `store`, `import`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--content` (visible alias `--data`) | none (switch) | off | Read the content from stdin instead of from file paths. Requires exactly one name argument. Conflicts with `--stdin`. | -| `--stdin` | none (switch) | off | Read more file paths from stdin, split on newline, tab or comma. Conflicts with `--content`. | -| `--hash-only` | none (switch) | off | Store the content without creating a named tag. The content is retrievable by hash only. | -| `--no-relay` | none (switch) | off | Disable relay servers for a remote operation. | +| Flag | Argument | Default | Meaning | +| ------------------------------------ | ------------- | ------- | --------------------------------------------------------------------------------------------------------------------- | +| `--content` (visible alias `--data`) | none (switch) | off | Read the content from stdin instead of from file paths. Requires exactly one name argument. Conflicts with `--stdin`. | +| `--stdin` | none (switch) | off | Read more file paths from stdin, split on newline, tab or comma. Conflicts with `--content`. | +| `--hash-only` | none (switch) | off | Store the content without creating a named tag. The content is retrievable by hash only. | +| `--no-relay` | none (switch) | off | Disable relay servers for a remote operation. | Behaviour notes: @@ -61,9 +61,9 @@ Failure shapes: a missing input file is a handler error (exit 1); `--content` co id put-hash ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| (none) | — | — | `put-hash` defines no flags of its own; the global flags apply. | +| Flag | Argument | Default | Meaning | +| ------ | -------- | ------- | --------------------------------------------------------------- | +| (none) | — | — | `put-hash` defines no flags of its own; the global flags apply. | Behaviour notes: @@ -84,12 +84,12 @@ Failure shapes: a missing source file is a handler error (exit 1). A missing `SO id send --to [--as ] [--replace] [--no-relay] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--to` | `DEST_NODE` | required (no default) | Destination server node ID (64 hex characters). | -| `--as` | `NAME` | the source name | Name to register on the destination. | -| `--replace` | none (switch) | off | Replace an existing, different destination file; the old destination file is archived under an archive name first. | -| `--no-relay` | none (switch) | off | Disable relay servers for the connection to the source. | +| Flag | Argument | Default | Meaning | +| ------------ | ------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------ | +| `--to` | `DEST_NODE` | required (no default) | Destination server node ID (64 hex characters). | +| `--as` | `NAME` | the source name | Name to register on the destination. | +| `--replace` | none (switch) | off | Replace an existing, different destination file; the old destination file is archived under an archive name first. | +| `--no-relay` | none (switch) | off | Disable relay servers for the connection to the source. | Behaviour notes: @@ -113,13 +113,13 @@ id get --hash [SOURCES]... id get --name-only [SOURCES]... ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--stdin` | none (switch) | off | Read more sources from stdin, split on newline, tab or comma. | -| `--hash` | none (switch) | off | Treat all sources as hashes. A source that matches no known hash fails. Conflicts with `--name-only`. | -| `--name-only` | none (switch) | off | Treat all sources as names only; hash interpretation is skipped even for 64-character hex strings. Conflicts with `--hash`. | -| `--stdout` | none (switch) | off | Write all retrieved files to stdout, concatenated. Overrides the per-item output specifications. | -| `--no-relay` | none (switch) | off | Disable relay servers for a remote operation. | +| Flag | Argument | Default | Meaning | +| ------------- | ------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| `--stdin` | none (switch) | off | Read more sources from stdin, split on newline, tab or comma. | +| `--hash` | none (switch) | off | Treat all sources as hashes. A source that matches no known hash fails. Conflicts with `--name-only`. | +| `--name-only` | none (switch) | off | Treat all sources as names only; hash interpretation is skipped even for 64-character hex strings. Conflicts with `--hash`. | +| `--stdout` | none (switch) | off | Write all retrieved files to stdout, concatenated. Overrides the per-item output specifications. | +| `--no-relay` | none (switch) | off | Disable relay servers for a remote operation. | Behaviour notes: @@ -145,9 +145,9 @@ Failure shapes: a name or hash with no stored content fails with `file not found id get-hash ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| (none) | — | — | `get-hash` defines no flags of its own; the global flags apply. | +| Flag | Argument | Default | Meaning | +| ------ | -------- | ------- | --------------------------------------------------------------- | +| (none) | — | — | `get-hash` defines no flags of its own; the global flags apply. | Behaviour notes: @@ -171,12 +171,12 @@ id output|out [SOURCES]... Aliases: `output`, `out`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--stdin` | none (switch) | off | Read more sources from stdin, split on newline, tab or comma. | -| `--hash` | none (switch) | off | Treat all sources as hashes. Conflicts with `--name-only`. | -| `--name-only` | none (switch) | off | Treat all sources as names only, skipping hash interpretation. Conflicts with `--hash`. | -| `--no-relay` | none (switch) | off | Disable relay servers for a remote operation. | +| Flag | Argument | Default | Meaning | +| ------------- | ------------- | ------- | --------------------------------------------------------------------------------------- | +| `--stdin` | none (switch) | off | Read more sources from stdin, split on newline, tab or comma. | +| `--hash` | none (switch) | off | Treat all sources as hashes. Conflicts with `--name-only`. | +| `--name-only` | none (switch) | off | Treat all sources as names only, skipping hash interpretation. Conflicts with `--hash`. | +| `--no-relay` | none (switch) | off | Disable relay servers for a remote operation. | Behaviour notes: @@ -197,9 +197,9 @@ Failure shapes: a missing source fails with `file not found` or `file not found id list [NODE] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--no-relay` | none (switch) | off | Disable relay servers for a remote listing. | +| Flag | Argument | Default | Meaning | +| ------------ | ------------- | ------- | ------------------------------------------- | +| `--no-relay` | none (switch) | off | Disable relay servers for a remote listing. | Behaviour notes: @@ -226,9 +226,9 @@ id migrate Alias: `migrate`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| (none) | — | — | `migrate-tags` takes no arguments and defines no flags of its own; the global flags apply. | +| Flag | Argument | Default | Meaning | +| ------ | -------- | ------- | ------------------------------------------------------------------------------------------ | +| (none) | — | — | `migrate-tags` takes no arguments and defines no flags of its own; the global flags apply. | Behaviour notes: @@ -261,11 +261,11 @@ Failure shapes: a store that cannot be opened is a handler error (exit 1). `--format` exists on `find` and `search` only: -| Value | Meaning | -|---|---| -| `tag` | Each match printed with its query. | -| `group` | Matches grouped by query. | -| `union` | Matches deduplicated by hash. | +| Value | Meaning | +| ------- | ---------------------------------- | +| `tag` | Each match printed with its query. | +| `group` | Matches grouped by query. | +| `union` | Matches deduplicated by hash. | The clap default is `tag`. The REPL's `find` and `search` default to `union`, because the REPL hand parser enters with `union` as its default format. The same query therefore prints tag-grouped output from the command line and union-deduplicated output in the REPL. Each side's help now names the other's default (discrepancy CLI-11, resolved). @@ -275,19 +275,19 @@ The clap default is `tag`. The REPL's `find` and `search` default to `union`, be id find ... ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--name` | none (switch) | off | Prefer name matches over hash matches. | -| `--stdout` | none (switch) | off | Write the best match to stdout instead of to a file. | -| `--all` (visible aliases `--out`, `--export`, `--save`, `--full`) | none (switch) | off | Output all matches instead of only the best match. | -| `--dir` | `DIR` | none | Output directory for `--all`; each match is saved by name. | -| `--format` | `tag`, `group` or `union` | `tag` | Output format (see the `--format` table above). | -| `--first` | `N` (optional) | bare flag = `1` | Return only the first N matches. Conflicts with `--last`. | -| `--last` | `N` (optional) | bare flag = `1` | Return only the last N matches. Conflicts with `--first`. | -| `--count` | none (switch) | off | Print the count of matches instead of the matches. | -| `--exclude` | `PAT` | none | Exclude matches whose name or hash contains `PAT`. Repeatable. | -| `--node` | `NODE_ID` | none | Remote node to search. | -| `--no-relay` | none (switch) | off | Disable relay servers for a remote search. | +| Flag | Argument | Default | Meaning | +| ----------------------------------------------------------------- | ------------------------- | --------------- | -------------------------------------------------------------- | +| `--name` | none (switch) | off | Prefer name matches over hash matches. | +| `--stdout` | none (switch) | off | Write the best match to stdout instead of to a file. | +| `--all` (visible aliases `--out`, `--export`, `--save`, `--full`) | none (switch) | off | Output all matches instead of only the best match. | +| `--dir` | `DIR` | none | Output directory for `--all`; each match is saved by name. | +| `--format` | `tag`, `group` or `union` | `tag` | Output format (see the `--format` table above). | +| `--first` | `N` (optional) | bare flag = `1` | Return only the first N matches. Conflicts with `--last`. | +| `--last` | `N` (optional) | bare flag = `1` | Return only the last N matches. Conflicts with `--first`. | +| `--count` | none (switch) | off | Print the count of matches instead of the matches. | +| `--exclude` | `PAT` | none | Exclude matches whose name or hash contains `PAT`. Repeatable. | +| `--node` | `NODE_ID` | none | Remote node to search. | +| `--no-relay` | none (switch) | off | Disable relay servers for a remote search. | Behaviour notes: @@ -312,18 +312,18 @@ Failure shapes: no matches fails with `no matches found for: ` (exit 1) id search ... ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--name` | none (switch) | off | Prefer name matches over hash matches. | -| `--all` (visible aliases `--out`, `--export`, `--save`, `--full`) | none (switch) | off | Include all matches in the output. | -| `--dir` | `DIR` | none | Output directory for `--all`. | -| `--format` | `tag`, `group` or `union` | `tag` | Output format (see the `--format` table above). | -| `--first` | `N` (optional) | bare flag = `1` | Return only the first N matches. Conflicts with `--last`. | -| `--last` | `N` (optional) | bare flag = `1` | Return only the last N matches. Conflicts with `--first`. | -| `--count` | none (switch) | off | Print the count of matches instead of the matches. | -| `--exclude` | `PAT` | none | Exclude matches whose name or hash contains `PAT`. Repeatable. | -| `--node` | `NODE_ID` | none | Remote node to search. | -| `--no-relay` | none (switch) | off | Disable relay servers for a remote search. | +| Flag | Argument | Default | Meaning | +| ----------------------------------------------------------------- | ------------------------- | --------------- | -------------------------------------------------------------- | +| `--name` | none (switch) | off | Prefer name matches over hash matches. | +| `--all` (visible aliases `--out`, `--export`, `--save`, `--full`) | none (switch) | off | Include all matches in the output. | +| `--dir` | `DIR` | none | Output directory for `--all`. | +| `--format` | `tag`, `group` or `union` | `tag` | Output format (see the `--format` table above). | +| `--first` | `N` (optional) | bare flag = `1` | Return only the first N matches. Conflicts with `--last`. | +| `--last` | `N` (optional) | bare flag = `1` | Return only the last N matches. Conflicts with `--first`. | +| `--count` | none (switch) | off | Print the count of matches instead of the matches. | +| `--exclude` | `PAT` | none | Exclude matches whose name or hash contains `PAT`. Repeatable. | +| `--node` | `NODE_ID` | none | Remote node to search. | +| `--no-relay` | none (switch) | off | Disable relay servers for a remote search. | Behaviour notes: @@ -348,16 +348,16 @@ id view ... Alias: `view`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--name` | none (switch) | off | Prefer name matches over hash matches. | -| `--all` | none (switch) | off | Output all matches instead of only the first. | -| `-o`, `--output` | `FILE` | stdout | Write the matched content to `FILE` instead of stdout. | -| `--first` | `N` (optional) | bare flag = `1` | Return only the first N matches. Conflicts with `--last`. | -| `--last` | `N` (optional) | bare flag = `1` | Return only the last N matches. Conflicts with `--first`. | -| `--exclude` | `PAT` | none | Exclude matches whose name or hash contains `PAT`. Repeatable. | -| `--node` | `NODE_ID` | none | Remote node to search. | -| `--no-relay` | none (switch) | off | Disable relay servers for a remote search. | +| Flag | Argument | Default | Meaning | +| ---------------- | -------------- | --------------- | -------------------------------------------------------------- | +| `--name` | none (switch) | off | Prefer name matches over hash matches. | +| `--all` | none (switch) | off | Output all matches instead of only the first. | +| `-o`, `--output` | `FILE` | stdout | Write the matched content to `FILE` instead of stdout. | +| `--first` | `N` (optional) | bare flag = `1` | Return only the first N matches. Conflicts with `--last`. | +| `--last` | `N` (optional) | bare flag = `1` | Return only the last N matches. Conflicts with `--first`. | +| `--exclude` | `PAT` | none | Exclude matches whose name or hash contains `PAT`. Repeatable. | +| `--node` | `NODE_ID` | none | Remote node to search. | +| `--no-relay` | none (switch) | off | Disable relay servers for a remote search. | Behaviour notes: @@ -380,22 +380,22 @@ Failure shapes: no matches fails with `no matches found for: ` (exit 1) id peek ... ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--name` | none (switch) | off | Prefer name matches over hash matches. | -| `-n`, `--lines` | `N` | `5` | Number of head and tail units to show. Zero is rejected by the value parser. | -| `--head-only` | none (switch) | off | Show only the head. Conflicts with `--tail-only`. | -| `--tail-only` | none (switch) | off | Show only the tail. Conflicts with `--head-only`. | -| `--chars` | none (switch) | off | Count by characters instead of lines. Conflicts with `--words`. | -| `--words` | none (switch) | off | Count by words instead of lines. Conflicts with `--chars`. | -| `-q`, `--quiet` | none (switch) | off | Suppress the header banner; print content only. | -| `-o`, `--output` | `FILE` | stdout | Write the preview to `FILE` instead of stdout. | -| `--all` | none (switch) | off | Peek all matches instead of only the first per query. | -| `--first` | `N` (optional) | bare flag = `1` | Return only the first N matches. Conflicts with `--last`. | -| `--last` | `N` (optional) | bare flag = `1` | Return only the last N matches. Conflicts with `--first`. | -| `--exclude` | `PAT` | none | Exclude matches whose name or hash contains `PAT`. Repeatable. | -| `--node` | `NODE_ID` | none | Remote node to search. | -| `--no-relay` | none (switch) | off | Disable relay servers for a remote search. | +| Flag | Argument | Default | Meaning | +| ---------------- | -------------- | --------------- | ---------------------------------------------------------------------------- | +| `--name` | none (switch) | off | Prefer name matches over hash matches. | +| `-n`, `--lines` | `N` | `5` | Number of head and tail units to show. Zero is rejected by the value parser. | +| `--head-only` | none (switch) | off | Show only the head. Conflicts with `--tail-only`. | +| `--tail-only` | none (switch) | off | Show only the tail. Conflicts with `--head-only`. | +| `--chars` | none (switch) | off | Count by characters instead of lines. Conflicts with `--words`. | +| `--words` | none (switch) | off | Count by words instead of lines. Conflicts with `--chars`. | +| `-q`, `--quiet` | none (switch) | off | Suppress the header banner; print content only. | +| `-o`, `--output` | `FILE` | stdout | Write the preview to `FILE` instead of stdout. | +| `--all` | none (switch) | off | Peek all matches instead of only the first per query. | +| `--first` | `N` (optional) | bare flag = `1` | Return only the first N matches. Conflicts with `--last`. | +| `--last` | `N` (optional) | bare flag = `1` | Return only the last N matches. Conflicts with `--first`. | +| `--exclude` | `PAT` | none | Exclude matches whose name or hash contains `PAT`. Repeatable. | +| `--node` | `NODE_ID` | none | Remote node to search. | +| `--no-relay` | none (switch) | off | Disable relay servers for a remote search. | Behaviour notes: diff --git a/pkgs/id/book/reference/cli-gallery-walk.md b/pkgs/id/book/reference/cli-gallery-walk.md index adf3681206..af5f1c905a 100644 --- a/pkgs/id/book/reference/cli-gallery-walk.md +++ b/pkgs/id/book/reference/cli-gallery-walk.md @@ -14,8 +14,8 @@ Feature gating differs per group. `id gallery` and `id walk` are not feature-gat id gallery --dir ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ------- | -------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--dir` | directory path | required (env `ID_GALLERY_DIR`) | The gallery directory: the one `serve --gallery-dir` serves (see [serve and publications](cli-serve.md)). It is a flag on the `gallery` parent, given before the subcommand. Environment fallback: `ID_GALLERY_DIR`. | Behaviour common to all gallery subcommands: the subcommands edit the directory on disk. A running server reads the directory when it starts, so restart the server to serve a change. Admission is this endpoint's policy only: a removed record keeps verifying, keeps its bundle file here, and stays listed on any other host. Every removal, refusal and reinstatement is appended to the public transparency list. @@ -32,11 +32,11 @@ Stops listing a record here and writes the removal to the public transparency li id gallery --dir remove --reason [--note ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required positional | The record's content hash. | -| `--reason` | `illegal_content\|malware\|spam\|policy` | required | The reason class for the transparency entry. The parser also accepts the hyphen spelling `illegal-content`. Omitting `--reason` is a clap error, exit `2`. | -| `--note` | text | — (none) | A short public note for the transparency list. | +| Flag | Argument | Default | Meaning | +| ---------------- | ---------------------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required positional | The record's content hash. | +| `--reason` | `illegal_content\|malware\|spam\|policy` | required | The reason class for the transparency entry. The parser also accepts the hyphen spelling `illegal-content`. Omitting `--reason` is a clap error, exit `2`. | +| `--note` | text | — (none) | A short public note for the transparency list. | Example: @@ -56,11 +56,11 @@ Refuses a record waiting for review, publicly. The refusal goes on the transpare id gallery --dir refuse --reason [--note ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required positional | The record's content hash. | -| `--reason` | `illegal_content\|malware\|spam\|policy` | required | The reason class for the transparency entry. The parser also accepts the hyphen spelling `illegal-content`. | -| `--note` | text | — (none) | A short public note for the transparency list. | +| Flag | Argument | Default | Meaning | +| ---------------- | ---------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required positional | The record's content hash. | +| `--reason` | `illegal_content\|malware\|spam\|policy` | required | The reason class for the transparency entry. The parser also accepts the hyphen spelling `illegal-content`. | +| `--note` | text | — (none) | A short public note for the transparency list. | Example: @@ -80,10 +80,10 @@ Reverses a removal or refusal (an appeal upheld) and lists the record again. The id gallery --dir reinstate [--note ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required positional | The record's content hash. | -| `--note` | text | — (none) | A short public note for the transparency list. | +| Flag | Argument | Default | Meaning | +| ---------------- | ----------------- | ------------------- | ---------------------------------------------- | +| `` | 64 hex characters | required positional | The record's content hash. | +| `--note` | text | — (none) | A short public note for the transparency list. | Example: @@ -103,8 +103,8 @@ Lists a record waiting for review. Under the `reviewed` posture (see `gallery po id gallery --dir approve ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ---------------- | ----------------- | ------------------- | -------------------------- | | `` | 64 hex characters | required positional | The record's content hash. | This subcommand takes no flags of its own. @@ -126,8 +126,8 @@ Shows the records waiting for review. id gallery --dir pending ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ------- | -------------- | ------------------------------- | --------------------------------------------------------------- | | `--dir` | directory path | required (env `ID_GALLERY_DIR`) | The parent `gallery` flag; the only flag this subcommand takes. | Example: @@ -146,8 +146,8 @@ Shows the transparency list: every removal, refusal and reinstatement, in order, id gallery --dir transparency ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ------- | -------------- | ------------------------------- | --------------------------------------------------------------- | | `--dir` | directory path | required (env `ID_GALLERY_DIR`) | The parent `gallery` flag; the only flag this subcommand takes. | Example: @@ -166,8 +166,8 @@ Sets the admission posture. id gallery --dir posture ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ----------- | ---------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `` | `open\|reviewed` | required positional | `open`: every verified record is listed until it is removed. `reviewed`: a record is listed once the operator approves it. Any other value is a clap error, exit `2`. | Behaviour: the gallery's default posture, before any operator ruling is stored, is `open`. Switching posture changes what is listed at once, because a record's visibility is computed from the posture, the approvals and the transparency list. @@ -188,10 +188,10 @@ States, or withdraws, the response time published for one reason class. id gallery --dir response-hours [HOURS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ---------- | ---------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------- | | `` | `illegal_content\|malware\|spam\|policy` | required positional | The reason class the statement covers. The parser also accepts the hyphen spelling `illegal-content`. | -| `[HOURS]` | integer | — (none) | The published response time in hours. Omit it to withdraw the statement for that reason class. | +| `[HOURS]` | integer | — (none) | The published response time in hours. Omit it to withdraw the statement for that reason class. | Example — publish a 24-hour response statement for malware, then withdraw it: @@ -210,11 +210,11 @@ Sets the operator's own tags for a program or an author. Tags are operator speec id gallery --dir tag [TAGS]... [--program | --author ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `[TAGS]...` | tag strings | — (none) | The tags to set, in the portable form: lower-case letters, digits and `-`. Giving no tags clears the target's tags. | -| `--program` | 64 hex characters | required unless `--author` is given | A program's content hash. Conflicts with `--author`. | -| `--author` | public key | — (none) | An author's public key. Conflicts with `--program`. | +| Flag | Argument | Default | Meaning | +| ----------- | ----------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `[TAGS]...` | tag strings | — (none) | The tags to set, in the portable form: lower-case letters, digits and `-`. Giving no tags clears the target's tags. | +| `--program` | 64 hex characters | required unless `--author` is given | A program's content hash. Conflicts with `--author`. | +| `--author` | public key | — (none) | An author's public key. Conflicts with `--program`. | Example — tag a toy program, then clear its tags: @@ -239,8 +239,8 @@ Exports a reference tic-tac-toe transcript using synthetic demo keys, as a binar id match-audit export-tic-tac-toe --output ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ---------- | --------- | -------- | ---------------------------------------------------------------------------- | | `--output` | file path | required | Write the binary v0 log to this path. Omitting it is a clap error, exit `2`. | Example: @@ -259,8 +259,8 @@ Verifies a v0 log against the pinned bundled tic-tac-toe program. id match-audit verify ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ------- | --------- | ------------------- | -------------------------------------------------------------- | | `` | file path | required positional | Binary match-audit v0 log, as written by `export-tic-tac-toe`. | Example: @@ -287,10 +287,10 @@ Creates a walk node in a directory. id walk init --name ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required positional | The node directory. | -| `--name` | string | required | The node's name: the resolver name in the addresses it mints, and the source label on what it produces. Omitting it is a clap error, exit `2`. | +| Flag | Argument | Default | Meaning | +| -------- | -------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | directory path | required positional | The node directory. | +| `--name` | string | required | The node's name: the resolver name in the addresses it mints, and the source label on what it produces. Omitting it is a clap error, exit `2`. | Behaviour: re-running `init` on an existing node keeps its records. The recorded name must match the `--name` given. @@ -310,12 +310,12 @@ Writes a signed record (a note) on a node, and prints the record's `id://` addre id walk write --as --text [--parent ]... ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required positional | The node directory. | -| `--as` | `alice\|bob` | required | The demo writer signing the record. Writers are demo keys derived from the name; `alice` and `bob` are the two demo writers. The flag is spelled `--as`. | -| `--text` | text | required | The note's text. | -| `--parent` | hex event ID | the node's current heads | A parent version the record follows; repeatable. Omitting it follows the node's current heads for the demo graph. Naming two or more parents resolves the conflict between them. | +| Flag | Argument | Default | Meaning | +| ---------- | -------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | directory path | required positional | The node directory. | +| `--as` | `alice\|bob` | required | The demo writer signing the record. Writers are demo keys derived from the name; `alice` and `bob` are the two demo writers. The flag is spelled `--as`. | +| `--text` | text | required | The note's text. | +| `--parent` | hex event ID | the node's current heads | A parent version the record follows; repeatable. Omitting it follows the node's current heads for the demo graph. Naming two or more parents resolves the conflict between them. | Example — Alice writes a toy note, then Bob writes a follow-up: @@ -336,9 +336,9 @@ Reads the record an `id://` address names, from a node's store. The address may id walk read
``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required positional | The node directory. | +| Flag | Argument | Default | Meaning | +| ----------- | ----------------- | ------------------- | ---------------------------------------- | +| `` | directory path | required positional | The node directory. | | `
` | `id://...` string | required positional | The address, as printed by `walk write`. | Example: @@ -359,8 +359,8 @@ Shows a node's heads and conflict reports for the demo graph. id walk reports ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ------- | -------------- | ------------------- | ----------------------------------------------------------------------- | | `` | directory path | required positional | The node directory. This command takes no flags beyond this positional. | Example: @@ -379,9 +379,9 @@ Serves a node: answers federation exchanges from its directory until interrupted id walk serve ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required positional | The node directory. This command takes no flags beyond this positional. | It runs until interrupted (Ctrl+C). +| Flag | Argument | Default | Meaning | +| ------- | -------------- | ------------------- | ----------------------------------------------------------------------- | +| `` | directory path | required positional | The node directory. This command takes no flags beyond this positional. | It runs until interrupted (Ctrl+C). | Example: @@ -399,10 +399,10 @@ Runs one exchange from a node to a serving peer, and persists what the node admi id walk sync --peer ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required positional | The node directory. | -| `--peer` | peer token | required | The peer token printed by the peer's `walk serve`: `@`. Omitting it is a clap error, exit `2`. | +| Flag | Argument | Default | Meaning | +| -------- | -------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `` | directory path | required positional | The node directory. | +| `--peer` | peer token | required | The peer token printed by the peer's `walk serve`: `@`. Omitting it is a clap error, exit `2`. | Example — sync toy node B from the toy node A that is serving (the token is the invented one printed by that serve): diff --git a/pkgs/id/book/reference/cli-groups-identity.md b/pkgs/id/book/reference/cli-groups-identity.md index bd26675c6b..c747bb0049 100644 --- a/pkgs/id/book/reference/cli-groups-identity.md +++ b/pkgs/id/book/reference/cli-groups-identity.md @@ -6,10 +6,10 @@ This chapter covers the event-backed identity surface of `id`: `group` with `del Two global flags place the stores (see [The id command line](cli.md) and [Configuration and environment](configuration.md)): -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--groups-log` | file path | `groups.jsonl` in the data dir | The group log for `group`, `delegate` and `revoke`. A relative path is relative to the data dir. | -| `--event-store` | directory path | `events` in the data dir | The event store for `doc`, `claim` and `writer-sets`. A relative path is relative to the data dir. | +| Flag | Argument | Default | Meaning | +| --------------- | -------------- | ------------------------------ | -------------------------------------------------------------------------------------------------- | +| `--groups-log` | file path | `groups.jsonl` in the data dir | The group log for `group`, `delegate` and `revoke`. A relative path is relative to the data dir. | +| `--event-store` | directory path | `events` in the data dir | The event store for `doc`, `claim` and `writer-sets`. A relative path is relative to the data dir. | `group`, `doc`, `claim` and `writer-sets` each take a `--json` flag that is global to that parent command: it may appear before or after the subcommand. With `--json`, an action prints one JSON object; `group list`, `doc` lists, `claim list`/`search` and `writer-sets discover` print one JSON array. `delegate` and `revoke` are top-level commands with their own `--json` flag. @@ -29,13 +29,13 @@ Creates a group. A normal group makes its creator Admin. A friendship names its id group create [--template ] [--with ] [--max ] [--admins-on-create] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--template` | `normal\|friendship` | `normal` | The kind of group to create. | -| `--with` | account (64 hex) | — (none) | The other side of a friendship. Required for `--template friendship`. | -| `--max` | integer | — (none; no cap) | The most members the group may have, counting the creator. Normal groups only. | -| `--admins-on-create` | switch | off | Make both friends Admin (friendships). | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| -------------------- | -------------------- | ---------------- | ------------------------------------------------------------------------------ | +| `--template` | `normal\|friendship` | `normal` | The kind of group to create. | +| `--with` | account (64 hex) | — (none) | The other side of a friendship. Required for `--template friendship`. | +| `--max` | integer | — (none; no cap) | The most members the group may have, counting the creator. Normal groups only. | +| `--admins-on-create` | switch | off | Make both friends Admin (friendships). | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | Example — a normal toy group capped at 8 members, and a toy friendship: @@ -55,10 +55,10 @@ Shows a group's policy record. id group policy ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | group ID (64 hex) | required positional | The group. | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| --------- | ----------------- | ------------------- | ----------------------------------------------------- | +| `` | group ID (64 hex) | required positional | The group. | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | This subcommand takes no flags of its own. @@ -78,9 +78,9 @@ Lists the groups in the log, one line each, or one JSON array with `--json`. id group list ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--json` | switch | off | Parent flag: print one JSON array instead of one line per group. | +| Flag | Argument | Default | Meaning | +| -------- | -------- | ------- | ---------------------------------------------------------------- | +| `--json` | switch | off | Parent flag: print one JSON array instead of one line per group. | This subcommand takes no arguments and no flags of its own. @@ -100,12 +100,12 @@ Adds a member with a role. The author must be a manager of the group. id group add [--role ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | group ID (64 hex) | required positional | The group. | -| `` | account (64 hex) | required positional | The account to add. | -| `--role` | `pull\|read\|write\|manage\|admin` | `read` | The member's role. | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| ---------- | ---------------------------------- | ------------------- | ----------------------------------------------------- | +| `` | group ID (64 hex) | required positional | The group. | +| `` | account (64 hex) | required positional | The account to add. | +| `--role` | `pull\|read\|write\|manage\|admin` | `read` | The member's role. | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | Example: @@ -124,14 +124,14 @@ Removes a member. Removing yourself is leaving. The group's default mode is used id group remove [--mode ] [--successor-kind ] [--successor ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | group ID (64 hex) | required positional | The group. | -| `` | account (64 hex) | required positional | The account to remove. | -| `--mode` | `server-default\|revoke\|transfer\|keep-prior\|reassign-to-group` | the group's configured remove default | Grant-disposition mode. `server-default` is resolved to the group's configured default before the event is recorded. `revoke` ends the removed member's grants. `transfer` reissues the grants to a successor. `keep-prior` retains grants under their original grantor (a re-add starts clean: pre-removal grants do not revive and must be re-issued). `reassign-to-group` re-anchors grants at the group. | -| `--successor-kind` | `member\|admin\|designated\|actor` | `member` | The successor category for `--mode transfer`: a named member, a group administrator, a designated account, or the account performing the removal. The successor flags require `--mode transfer`. | -| `--successor` | account (64 hex) | — (none) | The account for a `member` or `designated` transfer successor. Requires `--mode transfer`. | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| ------------------ | ----------------------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `` | group ID (64 hex) | required positional | The group. | +| `` | account (64 hex) | required positional | The account to remove. | +| `--mode` | `server-default\|revoke\|transfer\|keep-prior\|reassign-to-group` | the group's configured remove default | Grant-disposition mode. `server-default` is resolved to the group's configured default before the event is recorded. `revoke` ends the removed member's grants. `transfer` reissues the grants to a successor. `keep-prior` retains grants under their original grantor (a re-add starts clean: pre-removal grants do not revive and must be re-issued). `reassign-to-group` re-anchors grants at the group. | +| `--successor-kind` | `member\|admin\|designated\|actor` | `member` | The successor category for `--mode transfer`: a named member, a group administrator, a designated account, or the account performing the removal. The successor flags require `--mode transfer`. | +| `--successor` | account (64 hex) | — (none) | The account for a `member` or `designated` transfer successor. Requires `--mode transfer`. | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | Example — remove a toy member and transfer the member's grants to a named successor: @@ -152,12 +152,12 @@ Sets a member's role. The subcommand name is `role`. Only an Admin may use it. id group role ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | group ID (64 hex) | required positional | The group. | -| `` | account (64 hex) | required positional | The member whose role changes. | -| `` | `pull\|read\|write\|manage\|admin` | required positional | Its new role. | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| ---------- | ---------------------------------- | ------------------- | ----------------------------------------------------- | +| `` | group ID (64 hex) | required positional | The group. | +| `` | account (64 hex) | required positional | The member whose role changes. | +| `` | `pull\|read\|write\|manage\|admin` | required positional | Its new role. | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | Example: @@ -176,10 +176,10 @@ Parses an invitation ticket, then always fails. Group admission and network join id group join ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| +| Flag | Argument | Default | Meaning | +| ---------- | --------------------- | ------------------- | --------------------------------------------------------------------- | | `` | ticket or link string | required positional | The pasted ticket or link. It is parsed, and nothing further happens. | -| `--json` | switch | off | Parent flag. It does not change the outcome: the command still fails. | +| `--json` | switch | off | Parent flag. It does not change the outcome: the command still fails. | Example — the outcome is the same for every well-formed ticket (`` stands for one): @@ -200,14 +200,14 @@ Grants a delegate a scope in a group, with the group's delegation mode. It print id delegate [--scope ] [--redelegate] [--mode ] [--json] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | group ID (64 hex) | required positional | The group. | -| `` | account (64 hex) | required positional | The account that is granted the scope. | -| `--scope` | `pull\|read\|write\|manage\|admin` | `read` | The scope to grant. | -| `--redelegate` | switch | off | Let the grantee pass the scope on to others. Only a redelegatable grant extends a chain. | -| `--mode` | `keep_prior\|cascade\|transfer` | — (none) | The group's delegation mode, set first if it differs. The spellings use underscores. `cascade` is the delegation default in the group policy layer. | -| `--json` | switch | off | Print JSON instead of a line. | +| Flag | Argument | Default | Meaning | +| -------------- | ---------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | group ID (64 hex) | required positional | The group. | +| `` | account (64 hex) | required positional | The account that is granted the scope. | +| `--scope` | `pull\|read\|write\|manage\|admin` | `read` | The scope to grant. | +| `--redelegate` | switch | off | Let the grantee pass the scope on to others. Only a redelegatable grant extends a chain. | +| `--mode` | `keep_prior\|cascade\|transfer` | — (none) | The group's delegation mode, set first if it differs. The spellings use underscores. `cascade` is the delegation default in the group policy layer. | +| `--json` | switch | off | Print JSON instead of a line. | Example: @@ -227,11 +227,11 @@ Revokes a delegation by its grant's event ID, as `delegate` printed it. id revoke [--json] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | group ID (64 hex) | required positional | The group. | -| `` | event ID | required positional | The grant's event ID, as `id delegate` printed it. | -| `--json` | switch | off | Print JSON instead of a line. | +| Flag | Argument | Default | Meaning | +| --------- | ----------------- | ------------------- | -------------------------------------------------- | +| `` | group ID (64 hex) | required positional | The group. | +| `` | event ID | required positional | The grant's event ID, as `id delegate` printed it. | +| `--json` | switch | off | Print JSON instead of a line. | Example: @@ -256,12 +256,12 @@ Publishes a file as a document, and sets a tag for each `--tag`. id doc publish --media-type [--tag ]... ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | file path | required positional | The file to publish. | -| `--media-type` | media type string, e.g. `text/markdown` | required | The media type of the file. Omitting it is a clap error, exit `2`. | -| `--tag` | `NAME` or `NAME=VALUE` | — (none) | A tag to set on the document; repeatable. The flag name is `--tag`. | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| -------------- | --------------------------------------- | ------------------- | ------------------------------------------------------------------- | +| `` | file path | required positional | The file to publish. | +| `--media-type` | media type string, e.g. `text/markdown` | required | The media type of the file. Omitting it is a clap error, exit `2`. | +| `--tag` | `NAME` or `NAME=VALUE` | — (none) | A tag to set on the document; repeatable. The flag name is `--tag`. | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | Behaviour: prints `publish document=`, the document's event ID. The file's bytes are hashed, and the event names their hash and size. The bytes are not stored in the event: publish stores them in the blob store under their hash, so `doc content` can fetch them back. @@ -284,10 +284,10 @@ Lists the tags and removal on a document, in causal order. id doc events ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The document's event ID, as `publish` printed it. | -| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | +| Flag | Argument | Default | Meaning | +| ------------ | -------- | ------------------- | ---------------------------------------------------- | +| `` | event ID | required positional | The document's event ID, as `publish` printed it. | +| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | Example: @@ -305,9 +305,9 @@ Lists the head of each author's chain: the latest event each author has recorded id doc frontier ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | +| Flag | Argument | Default | Meaning | +| -------- | -------- | ------- | ---------------------------------------------------- | +| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | Example: @@ -325,10 +325,10 @@ Lists a document's events in causal order, its `document.put` first. id doc history ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The document's event ID, as `publish` printed it. | -| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | +| Flag | Argument | Default | Meaning | +| ------------ | -------- | ------------------- | ---------------------------------------------------- | +| `` | event ID | required positional | The document's event ID, as `publish` printed it. | +| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | Example: @@ -346,11 +346,11 @@ Prints a document's blob bytes, by document event ID. It resolves the `document. id doc content [OUTPUT] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The document's event ID, as `publish` printed it. | -| `[OUTPUT]` | file path, or `-` | `-` (stdout) | Output path, or `-` for stdout. | -| `--json` | switch | off | Parent flag (effect on this subcommand's byte output: unverified). | +| Flag | Argument | Default | Meaning | +| ------------ | ----------------- | ------------------- | ------------------------------------------------------------------ | +| `` | event ID | required positional | The document's event ID, as `publish` printed it. | +| `[OUTPUT]` | file path, or `-` | `-` (stdout) | Output path, or `-` for stdout. | +| `--json` | switch | off | Parent flag (effect on this subcommand's byte output: unverified). | Example — write a toy document back out to a file, and to stdout: @@ -375,13 +375,13 @@ Sets a tag on a subject. id claim set [VALUE] [--scope ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The subject's event ID. | -| `` | tag name | required positional | The tag name. A `local:` prefix is shorthand for `--scope local` when `--scope` is absent. | -| `[VALUE]` | string | — (none) | The tag value. Without one, the tag is bare. | -| `--scope` | `shared\|local` | `shared` | Whether the claim is shared with peers or stays on this node. An explicit `--scope` wins over a `local:` name prefix: with `--scope shared`, a name written `local:NAME` is a shared claim whose name keeps the prefix. | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| ----------- | --------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | event ID | required positional | The subject's event ID. | +| `` | tag name | required positional | The tag name. A `local:` prefix is shorthand for `--scope local` when `--scope` is absent. | +| `[VALUE]` | string | — (none) | The tag value. Without one, the tag is bare. | +| `--scope` | `shared\|local` | `shared` | Whether the claim is shared with peers or stays on this node. An explicit `--scope` wins over a `local:` name prefix: with `--scope shared`, a name written `local:NAME` is a shared claim whose name keeps the prefix. | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | Example — a shared toy claim, and the same claim kept local by the prefix shorthand: @@ -400,11 +400,11 @@ Clears the live claims with this name on a subject, whoever set them. id claim clear ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The subject's event ID. | -| `` | tag name | required positional | The tag name. | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| ----------- | -------- | ------------------- | ----------------------------------------------------- | +| `` | event ID | required positional | The subject's event ID. | +| `` | tag name | required positional | The tag name. | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | Behaviour: clearing stops future replication. It cannot unsend copies peers already hold. @@ -424,11 +424,11 @@ Lists the live claims with this name, and value if given, on any subject. id claim search [VALUE] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | tag name | required positional | The tag name. | -| `[VALUE]` | string | — (none) | The tag value to match as a whole. Without one, any value and a bare tag match. | -| `--json` | switch | off | Parent flag: print one JSON array instead of lines. | +| Flag | Argument | Default | Meaning | +| --------- | -------- | ------------------- | ------------------------------------------------------------------------------- | +| `` | tag name | required positional | The tag name. | +| `[VALUE]` | string | — (none) | The tag value to match as a whole. Without one, any value and a bare tag match. | +| `--json` | switch | off | Parent flag: print one JSON array instead of lines. | Example: @@ -446,13 +446,13 @@ Changes the scope of this node's claims with this name on a subject. id claim scope [--yes] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The subject's event ID. | -| `` | tag name | required positional | The tag name. | -| `` | `shared\|local` | required positional | The target scope. It is explicit, so it wins over any `local:` prefix shorthand used when a claim was set. | -| `--yes` | switch | off | Confirm publishing local claims as shared. Required when the move would publish a local claim: publishing cannot be undone. | -| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | +| Flag | Argument | Default | Meaning | +| ----------- | --------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `` | event ID | required positional | The subject's event ID. | +| `` | tag name | required positional | The tag name. | +| `` | `shared\|local` | required positional | The target scope. It is explicit, so it wins over any `local:` prefix shorthand used when a claim was set. | +| `--yes` | switch | off | Confirm publishing local claims as shared. Required when the move would publish a local claim: publishing cannot be undone. | +| `--json` | switch | off | Parent flag: print one JSON object instead of a line. | Behaviour: moving to `local` stops future replication but cannot unsend copies peers already hold. Moving to `shared` publishes this node's local claims and cannot be undone. @@ -472,9 +472,9 @@ Reviews every live claim visible to this node, with its scope. It takes no argum id claim review ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | +| Flag | Argument | Default | Meaning | +| -------- | -------- | ------- | ---------------------------------------------------- | +| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | Example: @@ -492,10 +492,10 @@ Lists the live claims on a subject. id claim list ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The subject's event ID. | -| `--json` | switch | off | Parent flag: print one JSON array instead of lines. | +| Flag | Argument | Default | Meaning | +| ----------- | -------- | ------------------- | --------------------------------------------------- | +| `` | event ID | required positional | The subject's event ID. | +| `--json` | switch | off | Parent flag: print one JSON array instead of lines. | Example: @@ -517,10 +517,10 @@ Shows one stored writer set: its ID, version, owner, scope, and the counts of it id writer-sets show ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The publishing event's ID. | -| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | +| Flag | Argument | Default | Meaning | +| --------- | -------- | ------------------- | ---------------------------------------------------- | +| `` | event ID | required positional | The publishing event's ID. | +| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | Example: @@ -538,12 +538,12 @@ Expands one stored writer set at its publishing frontier: whether the expansion id writer-sets expand [--resolution ] [--retro] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | event ID | required positional | The publishing event's ID. | +| Flag | Argument | Default | Meaning | +| -------------- | ---------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| `` | event ID | required positional | The publishing event's ID. | | `--resolution` | hex string | — (none; the zero hash) | The resolution snapshot to pin the projection under, as hex. Without one, the zero hash names the store's current resolved state. | -| `--retro` | switch | off | Expand retroactively: only entries marked include-history contribute. Exclusions always apply. | -| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | +| `--retro` | switch | off | Expand retroactively: only entries marked include-history contribute. Exclusions always apply. | +| `--json` | switch | off | Parent flag: print one JSON object instead of lines. | Example: @@ -561,11 +561,11 @@ Discovers stored writer sets by scope: one row per set, with the writers it expa id writer-sets discover [--scope ] [--resolution ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--scope` | string | — (none; all sets) | The scope (subject) to match, exactly. Without `--scope`, every stored set matches. | +| Flag | Argument | Default | Meaning | +| -------------- | ---------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| `--scope` | string | — (none; all sets) | The scope (subject) to match, exactly. Without `--scope`, every stored set matches. | | `--resolution` | hex string | — (none; the zero hash) | The resolution snapshot to pin each expansion under, as hex. Without one, the zero hash names the store's current resolved state. | -| `--json` | switch | off | Parent flag: print one JSON array instead of lines. | +| `--json` | switch | off | Parent flag: print one JSON array instead of lines. | Example: @@ -583,9 +583,9 @@ Prints the local node's public ID. The command name collides with the binary nam id id [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--client` | switch | off | Print the client identity instead of the server identity. The client identity is the one this machine uses when connecting to other nodes; a server owner adds it with `id serve --allow-node ` so this machine may write to that server. | +| Flag | Argument | Default | Meaning | +| ---------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--client` | switch | off | Print the client identity instead of the server identity. The client identity is the one this machine uses when connecting to other nodes; a server owner adds it with `id serve --allow-node ` so this machine may write to that server. | Example: @@ -610,10 +610,10 @@ Exports the server identity (or, with `--client`, the client identity) to an enc id key export [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | file path | required positional | Destination for the encrypted key envelope. | -| `--client` | switch | off | Export the client identity instead of the server identity. | +| Flag | Argument | Default | Meaning | +| ---------- | --------- | ------------------- | ---------------------------------------------------------- | +| `` | file path | required positional | Destination for the encrypted key envelope. | +| `--client` | switch | off | Export the client identity instead of the server identity. | Example: @@ -632,11 +632,11 @@ Imports an encrypted key envelope as the server or client identity. The passphra id key import [--client] [--replace] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | file path | required positional | The encrypted key envelope to import. | -| `--client` | switch | off | Import as the client identity instead of the server identity. | -| `--replace` | switch | off | Replace an existing identity key file atomically. | +| Flag | Argument | Default | Meaning | +| ----------- | --------- | ------------------- | ------------------------------------------------------------- | +| `` | file path | required positional | The encrypted key envelope to import. | +| `--client` | switch | off | Import as the client identity instead of the server identity. | +| `--replace` | switch | off | Replace an existing identity key file atomically. | Example: @@ -655,9 +655,9 @@ Prints the server identity (or, with `--client`, the client identity) as a 24-wo id key export-seed [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--client` | switch | off | Export the client identity instead of the server identity. | +| Flag | Argument | Default | Meaning | +| ---------- | -------- | ------- | ---------------------------------------------------------- | +| `--client` | switch | off | Export the client identity instead of the server identity. | Example: @@ -677,10 +677,10 @@ Restores the server or client identity from a 24-word seed phrase entered at a h id key import-seed [--client] [--replace] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--client` | switch | off | Import as the client identity instead of the server identity. | -| `--replace` | switch | off | Replace an existing identity key file atomically. | +| Flag | Argument | Default | Meaning | +| ----------- | -------- | ------- | ------------------------------------------------------------- | +| `--client` | switch | off | Import as the client identity instead of the server identity. | +| `--replace` | switch | off | Replace an existing identity key file atomically. | Example: @@ -707,9 +707,9 @@ Prints the identity ID, admin keys and device keys. id keyset show [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--client` | switch | off | Show the client identity's keyset instead of the server's. | +| Flag | Argument | Default | Meaning | +| ---------- | -------- | ------- | ---------------------------------------------------------- | +| `--client` | switch | off | Show the client identity's keyset instead of the server's. | Example: @@ -727,11 +727,11 @@ Enrols another device key. The device's 32-byte key file is read to countersign id keyset enrol --label [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | file path | required positional | The new device's key file (the `.iroh-key` it was created with). | -| `--label` | string | required | A name for the device, shown by `id keyset show`. Omitting it is a clap error, exit `2`. | -| `--client` | switch | off | Change the client identity's keyset instead of the server's. | +| Flag | Argument | Default | Meaning | +| ------------------- | --------- | ------------------- | ---------------------------------------------------------------------------------------- | +| `` | file path | required positional | The new device's key file (the `.iroh-key` it was created with). | +| `--label` | string | required | A name for the device, shown by `id keyset show`. Omitting it is a clap error, exit `2`. | +| `--client` | switch | off | Change the client identity's keyset instead of the server's. | Example: @@ -749,11 +749,11 @@ Revokes a device key, given as its hex public key. Records it signed before the id keyset revoke [--reason ] [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | hex public key | required positional | The device's hex public key, as `id keyset show` prints it. | -| `--reason` | text | `revoked` | Why it was revoked, kept in the record. | -| `--client` | switch | off | Change the client identity's keyset instead of the server's. | +| Flag | Argument | Default | Meaning | +| -------------- | -------------- | ------------------- | ------------------------------------------------------------ | +| `` | hex public key | required positional | The device's hex public key, as `id keyset show` prints it. | +| `--reason` | text | `revoked` | Why it was revoked, kept in the record. | +| `--client` | switch | off | Change the client identity's keyset instead of the server's. | Example: @@ -772,10 +772,10 @@ Hands admin power to another key. The new key's 32-byte key file is read to coun id keyset rotate [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | file path | required positional | The new admin key's key file. | -| `--client` | switch | off | Change the client identity's keyset instead of the server's. | +| Flag | Argument | Default | Meaning | +| ---------------------- | --------- | ------------------- | ------------------------------------------------------------ | +| `` | file path | required positional | The new admin key's key file. | +| `--client` | switch | off | Change the client identity's keyset instead of the server's. | Example: @@ -793,11 +793,11 @@ Names the guardians who can approve a recovery of this identity, and how many mu id keyset guardians ... --threshold [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `...` | identity IDs (hex public keys) | required positional, at least one | Each guardian's identity ID. | -| `--threshold` | integer | required | How many of the guardians must approve a recovery. Omitting it is a clap error, exit `2`. | -| `--client` | switch | off | Change the client identity's keyset instead of the server's. | +| Flag | Argument | Default | Meaning | +| ---------------- | ------------------------------ | --------------------------------- | ----------------------------------------------------------------------------------------- | +| `...` | identity IDs (hex public keys) | required positional, at least one | Each guardian's identity ID. | +| `--threshold` | integer | required | How many of the guardians must approve a recovery. Omitting it is a clap error, exit `2`. | +| `--client` | switch | off | Change the client identity's keyset instead of the server's. | Behaviour: adding guardians or raising the threshold takes effect at once. Removing a guardian or lowering the threshold waits out the recovery delay, so a stolen admin key cannot swap in guardians of its own. @@ -820,9 +820,9 @@ Checkpoints the current keyset head with this identity's key, which must be an a id keyset checkpoint [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--client` | switch | off | Checkpoint the client identity's keyset instead of the server's. | +| Flag | Argument | Default | Meaning | +| ---------- | -------- | ------- | ---------------------------------------------------------------- | +| `--client` | switch | off | Checkpoint the client identity's keyset instead of the server's. | Example: @@ -844,10 +844,10 @@ Copies this identity's keyset records into the relay, so a successor can pin its id keyset recovery publish --relay [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--relay` | file path | required | The recovery relay file. | -| `--client` | switch | off | Publish the client identity's keyset instead of the server's. | +| Flag | Argument | Default | Meaning | +| ---------- | --------- | -------- | ------------------------------------------------------------- | +| `--relay` | file path | required | The recovery relay file. | +| `--client` | switch | off | Publish the client identity's keyset instead of the server's. | Example: @@ -865,12 +865,12 @@ From a new device, asks the guardians of an identity to recover it. This device' id keyset recovery request --relay [--reason ] [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | hex identity ID | required positional | The identity to recover (its hex identity ID). | -| `--relay` | file path | required | The recovery relay file. | -| `--reason` | text | `lost every key` | Why, shown to every device and guardian told of the request. | -| `--client` | switch | off | Sign with the client key instead of the server key. | +| Flag | Argument | Default | Meaning | +| ------------ | --------------- | ------------------- | ------------------------------------------------------------ | +| `` | hex identity ID | required positional | The identity to recover (its hex identity ID). | +| `--relay` | file path | required | The recovery relay file. | +| `--reason` | text | `lost every key` | Why, shown to every device and guardian told of the request. | +| `--client` | switch | off | Sign with the client key instead of the server key. | The command prints the request ID; that ID is the `` argument of `approve`, `cancel`, `status` and `complete`. @@ -892,11 +892,11 @@ As a guardian, approves a recovery request. Also publishes this guardian identit id keyset recovery approve --relay [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | request ID | required positional | The request ID, as `request` printed it. | -| `--relay` | file path | required | The recovery relay file. | -| `--client` | switch | off | Approve as the client identity instead of the server's. | +| Flag | Argument | Default | Meaning | +| ----------- | ---------- | ------------------- | ------------------------------------------------------- | +| `` | request ID | required positional | The request ID, as `request` printed it. | +| `--relay` | file path | required | The recovery relay file. | +| `--client` | switch | off | Approve as the client identity instead of the server's. | Example: @@ -914,11 +914,11 @@ Cancels a recovery request with any surviving admin or device key of the identit id keyset recovery cancel --relay [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | request ID | required positional | The request ID. | -| `--relay` | file path | required | The recovery relay file. | -| `--client` | switch | off | Sign with the client key instead of the server key. | +| Flag | Argument | Default | Meaning | +| ----------- | ---------- | ------------------- | --------------------------------------------------- | +| `` | request ID | required positional | The request ID. | +| `--relay` | file path | required | The recovery relay file. | +| `--client` | switch | off | Sign with the client key instead of the server key. | Example: @@ -936,10 +936,10 @@ Shows where a recovery request stands. This is the one keyset subcommand with no id keyset recovery status --relay ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | request ID | required positional | The request ID. | -| `--relay` | file path | required | The recovery relay file. | +| Flag | Argument | Default | Meaning | +| ----------- | ---------- | ------------------- | ------------------------ | +| `` | request ID | required positional | The request ID. | +| `--relay` | file path | required | The recovery relay file. | Example: @@ -957,11 +957,11 @@ On the requesting device, completes a recovery that is ready by relaying the rot id keyset recovery complete --relay [--client] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | request ID | required positional | The request ID. | -| `--relay` | file path | required | The recovery relay file. | -| `--client` | switch | off | Sign with the client key instead of the server key. | +| Flag | Argument | Default | Meaning | +| ----------- | ---------- | ------------------- | --------------------------------------------------- | +| `` | request ID | required positional | The request ID. | +| `--relay` | file path | required | The recovery relay file. | +| `--client` | switch | off | Sign with the client key instead of the server key. | Example: @@ -979,22 +979,22 @@ Discovers and lists known peers. It discovers other `id` servers via gossip-base id peers [NODE] [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `[NODE]` | 64 hex characters | — (none; the local serve) | Remote node ID to query. When set, queries this specific node instead of the local serve instance. | -| `--gossip` | switch | off | Gossip-only discovery: join the topic and collect announcements, bypassing RPC entirely. Useful when no local serve is running. | -| `--rpc` | switch | off | RPC-only discovery: query the server's `ListPeers` RPC. Fails if no local serve is running, unless a node ID is given. | -| `--depth` | integer, `0..` | `1` | Recursive depth for peer-of-peer crawling. `0` = no crawl, `1` = query direct peers, `N` = recursively query up to `N` levels deep. A negative value fails: clap's value parser rejects it (the handler also refuses a negative depth). | -| `--max-peers` | integer | `1000` | Maximum total peers to discover. A hard cap to prevent unbounded crawling. | -| `--timeout` | integer (seconds) | `30` | Per-crawl timeout in seconds. | -| `--bootstrap` | comma-separated node IDs | — (none) | Node IDs for gossip bootstrapping, supplementary to DHT auto-discovery. These nodes are contacted first when joining the gossip topic. | -| `--topic` | string | from `defaults.json`, else the constant `id-peer-discovery-v1` | Gossip topic name for peer discovery. Use a custom topic for private networks. | -| `--topic-secret` | string | from `defaults.json`, else the constant `id-public-discovery-v1` | Shared secret for topic access control, used to encrypt DHT bootstrap records. The value is never echoed. | -| `--no-default-bootstrap` | switch | off | Skip default bootstrap node IDs from `defaults.json`; only CLI-provided `--bootstrap` nodes are used. | -| `--no-default-topic` | switch | off | Skip the topic and secret from `defaults.json`; fall back to the hardcoded constant values. | -| `--no-relay` | switch | off | Disable relay servers and use direct connections only. | -| `--no-mdns` | switch | off | Disable mDNS local peer discovery, which is on by default. | -| `--abuse` | switch | off | Show the local serve instance's per-peer abuse counters instead of listing peers: frames and bytes admitted by the abuse evaluator, split by direction, with the policy rates shown alongside. Read-only. Local serve only; cannot be combined with `--gossip` or a remote `[NODE]`. The counters cover world-protocol traffic only: a serve running without `--world` records none and the report is empty. | +| Flag | Argument | Default | Meaning | +| ------------------------ | ------------------------ | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `[NODE]` | 64 hex characters | — (none; the local serve) | Remote node ID to query. When set, queries this specific node instead of the local serve instance. | +| `--gossip` | switch | off | Gossip-only discovery: join the topic and collect announcements, bypassing RPC entirely. Useful when no local serve is running. | +| `--rpc` | switch | off | RPC-only discovery: query the server's `ListPeers` RPC. Fails if no local serve is running, unless a node ID is given. | +| `--depth` | integer, `0..` | `1` | Recursive depth for peer-of-peer crawling. `0` = no crawl, `1` = query direct peers, `N` = recursively query up to `N` levels deep. A negative value fails: clap's value parser rejects it (the handler also refuses a negative depth). | +| `--max-peers` | integer | `1000` | Maximum total peers to discover. A hard cap to prevent unbounded crawling. | +| `--timeout` | integer (seconds) | `30` | Per-crawl timeout in seconds. | +| `--bootstrap` | comma-separated node IDs | — (none) | Node IDs for gossip bootstrapping, supplementary to DHT auto-discovery. These nodes are contacted first when joining the gossip topic. | +| `--topic` | string | from `defaults.json`, else the constant `id-peer-discovery-v1` | Gossip topic name for peer discovery. Use a custom topic for private networks. | +| `--topic-secret` | string | from `defaults.json`, else the constant `id-public-discovery-v1` | Shared secret for topic access control, used to encrypt DHT bootstrap records. The value is never echoed. | +| `--no-default-bootstrap` | switch | off | Skip default bootstrap node IDs from `defaults.json`; only CLI-provided `--bootstrap` nodes are used. | +| `--no-default-topic` | switch | off | Skip the topic and secret from `defaults.json`; fall back to the hardcoded constant values. | +| `--no-relay` | switch | off | Disable relay servers and use direct connections only. | +| `--no-mdns` | switch | off | Disable mDNS local peer discovery, which is on by default. | +| `--abuse` | switch | off | Show the local serve instance's per-peer abuse counters instead of listing peers: frames and bytes admitted by the abuse evaluator, split by direction, with the policy rates shown alongside. Read-only. Local serve only; cannot be combined with `--gossip` or a remote `[NODE]`. The counters cover world-protocol traffic only: a serve running without `--world` records none and the report is empty. | Behaviour: the default mode is RPC-then-gossip: try RPC (query the local serve), then gossip as fallback. `--rpc` and `--gossip` each pin one mode. The topic and topic-secret defaults follow the same resolution as `serve`: file defaults from `defaults.json` are consulted first and the named constants are the fallback, which is why `--no-default-topic` exists (the same pattern as disagreement CLI-6 for `serve`). diff --git a/pkgs/id/book/reference/cli-serve.md b/pkgs/id/book/reference/cli-serve.md index 18fa582f79..6f4d9f300c 100644 --- a/pkgs/id/book/reference/cli-serve.md +++ b/pkgs/id/book/reference/cli-serve.md @@ -12,34 +12,34 @@ id serve [FLAGS] ### Core and discovery flags -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--ephemeral` | none (switch) | off | Use in-memory storage instead of persistent disk storage. Content is lost when the server stops. | -| `--server-config` | `FILE` | none | Operator server-config TOML. A malformed file fails startup, naming the parse error. Loading the config requires a build with the `world` feature (see Feature gates). | -| `--no-relay` | none (switch) | off | Direct connections only; no relay servers. Connections through NATs or firewalls can fail in this mode. | -| `--no-gossip` | none (switch) | off | Disable gossip discovery entirely: the server accepts connections but does not join a gossip topic, does not announce itself, and does not discover peers. Conflicts with `--gossip`. | -| `--gossip` | none (switch) | off | Force gossip discovery on, overriding a build-time disabled default. Conflicts with `--no-gossip`. | -| `--bootstrap` | `IDS` | none | Comma-separated node IDs for manual peer bootstrapping; the flag is repeatable and each occurrence is split on commas. Supplementary to automatic discovery. | -| `--topic` | `TOPIC` | see the topic caveat below | Gossip topic name for peer discovery. All servers on the same topic discover each other. | -| `--topic-secret` | `SECRET` | see the topic caveat below | Shared secret for topic access control, used to encrypt DHT bootstrap records. Only nodes with the same secret discover each other via DHT. The value is a secret: pass it by flag or configuration, never print it. | -| `--no-default-bootstrap` | none (switch) | off | Ignore the bootstrap node IDs from `defaults.json`; only `--bootstrap` nodes are used. | -| `--no-default-topic` | none (switch) | off | Ignore the topic and secret from `defaults.json` and fall back to the hardcoded constants. Explicit `--topic`/`--topic-secret` values still take precedence. | -| `--no-mdns` | none (switch) | off (mDNS on) | Disable mDNS local peer discovery. By default the server uses mDNS on the local network and announces its node ID and addresses to every host there. | -| `--dht` | none (switch) | off | Enable mainline DHT address lookup and publishing for the server's endpoint. The flag exists in the parser regardless of the `dht` cargo feature. | -| `--iroh-port` | `PORT` | `0` | Port for the Iroh QUIC endpoint. `0` lets the OS assign a random available port. | +| Flag | Argument | Default | Meaning | +| ------------------------ | ------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--ephemeral` | none (switch) | off | Use in-memory storage instead of persistent disk storage. Content is lost when the server stops. | +| `--server-config` | `FILE` | none | Operator server-config TOML. A malformed file fails startup, naming the parse error. Loading the config requires a build with the `world` feature (see Feature gates). | +| `--no-relay` | none (switch) | off | Direct connections only; no relay servers. Connections through NATs or firewalls can fail in this mode. | +| `--no-gossip` | none (switch) | off | Disable gossip discovery entirely: the server accepts connections but does not join a gossip topic, does not announce itself, and does not discover peers. Conflicts with `--gossip`. | +| `--gossip` | none (switch) | off | Force gossip discovery on, overriding a build-time disabled default. Conflicts with `--no-gossip`. | +| `--bootstrap` | `IDS` | none | Comma-separated node IDs for manual peer bootstrapping; the flag is repeatable and each occurrence is split on commas. Supplementary to automatic discovery. | +| `--topic` | `TOPIC` | see the topic caveat below | Gossip topic name for peer discovery. All servers on the same topic discover each other. | +| `--topic-secret` | `SECRET` | see the topic caveat below | Shared secret for topic access control, used to encrypt DHT bootstrap records. Only nodes with the same secret discover each other via DHT. The value is a secret: pass it by flag or configuration, never print it. | +| `--no-default-bootstrap` | none (switch) | off | Ignore the bootstrap node IDs from `defaults.json`; only `--bootstrap` nodes are used. | +| `--no-default-topic` | none (switch) | off | Ignore the topic and secret from `defaults.json` and fall back to the hardcoded constants. Explicit `--topic`/`--topic-secret` values still take precedence. | +| `--no-mdns` | none (switch) | off (mDNS on) | Disable mDNS local peer discovery. By default the server uses mDNS on the local network and announces its node ID and addresses to every host there. | +| `--dht` | none (switch) | off | Enable mainline DHT address lookup and publishing for the server's endpoint. The flag exists in the parser regardless of the `dht` cargo feature. | +| `--iroh-port` | `PORT` | `0` | Port for the Iroh QUIC endpoint. `0` lets the OS assign a random available port. | Topic and secret default caveat: the strings `id-peer-discovery-v1` (topic) and `id-public-discovery-v1` (secret) are the hardcoded constants, and the constants are the fallback, not the operative default. On a stock serve, the topic and secret are read first from `defaults.json`; the constants apply only when `defaults.json` supplies neither, or when `--no-default-topic` is passed. The `--version` provenance line (see [The id command line](cli.md)) reports which defaults source is in force. The `--topic`/`--topic-secret` help text once presented the constants as "the default" (discrepancy CLI-6, resolved — the help now describes them as the fallback). ### Web UI flags -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--web` | none (switch) | off | Start the HTTP web UI. On a build without the `web` feature this fails at startup (see Feature gates). The UI itself is covered in [The web UI: pages and HTTP API](web-ui.md). | -| `--bind` | `IP` | `127.0.0.1` | Address the web interface binds to. The loopback default makes the UI reachable only from this machine. Binding `0.0.0.0` exposes it on the network; set `--web-token` when doing so. | -| `--port` | `PORT` | `3000` | Port for the web interface. `0` lets the OS assign a random available port. | -| `--web-listen` | `IP:PORT` | none | Add one web listener, in `IP:PORT` form (IPv6 in brackets, for example `[::1]:3001`). Repeatable. The set of `--web-listen` values replaces the `web_bindings` entries from `defaults.json` entirely. Subject to the explicitness rule below. | -| `--web-token` | `TOKEN` | none; environment fallback `ID_WEB_TOKEN` | Require this token to use the web interface. A browser opens `http://host:port/?token=` once and keeps a cookie; scripts send `Authorization: Bearer `. The value is hidden in clap and is a secret: name it, never print it. | -| `--web-cookie-secure` | none (switch) | off; environment fallback `ID_WEB_COOKIE_SECURE` | Mark the web session cookies `Secure`. Set it only when HTTPS is terminated in front of the server; browsers drop `Secure` cookies over plain HTTP except on localhost. | +| Flag | Argument | Default | Meaning | +| --------------------- | ------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--web` | none (switch) | off | Start the HTTP web UI. On a build without the `web` feature this fails at startup (see Feature gates). The UI itself is covered in [The web UI: pages and HTTP API](web-ui.md). | +| `--bind` | `IP` | `127.0.0.1` | Address the web interface binds to. The loopback default makes the UI reachable only from this machine. Binding `0.0.0.0` exposes it on the network; set `--web-token` when doing so. | +| `--port` | `PORT` | `3000` | Port for the web interface. `0` lets the OS assign a random available port. | +| `--web-listen` | `IP:PORT` | none | Add one web listener, in `IP:PORT` form (IPv6 in brackets, for example `[::1]:3001`). Repeatable. The set of `--web-listen` values replaces the `web_bindings` entries from `defaults.json` entirely. Subject to the explicitness rule below. | +| `--web-token` | `TOKEN` | none; environment fallback `ID_WEB_TOKEN` | Require this token to use the web interface. A browser opens `http://host:port/?token=` once and keeps a cookie; scripts send `Authorization: Bearer `. The value is hidden in clap and is a secret: name it, never print it. | +| `--web-cookie-secure` | none (switch) | off; environment fallback `ID_WEB_COOKIE_SECURE` | Mark the web session cookies `Secure`. Set it only when HTTPS is terminated in front of the server; browsers drop `Secure` cookies over plain HTTP except on localhost. | The `--web-listen` explicitness rule (#2145): combining `--web-listen` with an explicitly set `--bind` or `--port` is a startup error naming the conflict. Explicitness is read from the clap value sources in `src/main.rs`, so the clap defaults for `--bind` and `--port` do not count: `id serve --web-listen 127.0.0.1:8080` is valid, while `id serve --web-listen 127.0.0.1:8080 --port 3000` fails at startup even though `3000` is the default value, because the operator set it explicitly. @@ -53,10 +53,10 @@ $ id serve --web --port 8080 --web-token $ID_WEB_TOKEN ### Gallery flags -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--gallery-dir` | `DIR` | none; environment fallback `ID_GALLERY_DIR` | Serve the program gallery stored in this directory: as a program registry over Iroh, and with `--web` also over the `/api/gallery/*` HTTP routes. Every bundle file in the directory is verified at startup. | -| `--gallery-accept-publish` | none (switch) | off; environment fallback `ID_GALLERY_ACCEPT_PUBLISH` | Accept bundle publishes from any peer over Iroh; each is verified and then goes through the gallery's admission. Requires `--gallery-dir`. | +| Flag | Argument | Default | Meaning | +| -------------------------- | ------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `--gallery-dir` | `DIR` | none; environment fallback `ID_GALLERY_DIR` | Serve the program gallery stored in this directory: as a program registry over Iroh, and with `--web` also over the `/api/gallery/*` HTTP routes. Every bundle file in the directory is verified at startup. | +| `--gallery-accept-publish` | none (switch) | off; environment fallback `ID_GALLERY_ACCEPT_PUBLISH` | Accept bundle publishes from any peer over Iroh; each is verified and then goes through the gallery's admission. Requires `--gallery-dir`. | Gallery administration itself is covered in [Gallery, match-audit and walk](cli-gallery-walk.md). @@ -64,53 +64,53 @@ Gallery administration itself is covered in [Gallery, match-audit and walk](cli- Every flag in this section requires `--world`, except `--world` itself, which requires `--world-admin-token`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--world` | none (switch) | off | Host a multiplayer world over Iroh (and over `/ws/world` with `--web`). Requires `--world-admin-token`. | -| `--world-admin-token` | `TOKEN` | none; environment fallback `ID_WORLD_ADMIN_TOKEN` | Admin secret required to mint world guest capabilities. The value is hidden in clap and is a secret: name it, never print it. | -| `--world-module` | `FILE` | none | Start with this precompiled Wasm world module (Roc platform ABI). Requires `--world`. Loading a module requires a build with the `sandbox` feature (see Feature gates). Conflicts with `--world-source-only`. | -| `--world-name` | `NAME` | `lobby` | Name of the world this server offers (one world per process). The world's files live in `.id-worlds//`. The name may contain `a-z`, `0-9`, `-` and `_`. | -| `--world-ssh-port` | `PORT` | none | Serve the world over SSH on this port, bound to `--bind`. Actual SSH serving exists only in `ssh`-feature builds (see Feature gates). | -| `--world-checkpoint-every` | `N` | `1000` | Trim the world's journal behind a program snapshot every N events. `0` never trims. | -| `--world-max-open` | `N` | `256` | Most worlds open at once; idle durable worlds close to make room. | -| `--world-max-sessions` | `N` | `1024` | Most world sessions at once, across every world. | -| `--world-idle-secs` | `N` | `600` | Close durable worlds that no session used for this many seconds; they reopen from their journal on demand. `0` keeps worlds open. | -| `--world-boot-window-secs` | `N` | `600` | Refuse signed world and directory requests for this many seconds after startup, so a request captured before a restart cannot be replayed into a server with empty replay memory. `0` disables the window. | -| `--world-native` | none (switch) | off | Accept native (ELF) module installs. The guarantee for this tier is the OS sandbox (Landlock, seccomp, rlimits), so the tier is opt-in. | -| `--world-source-only` | none (switch) | off; environment fallback `ID_WORLD_SOURCE_ONLY` | Accept new world programs only as Roc source compiled by this server. Disables raw Wasm and native module uploads and `--world-module`. Conflicts with `--world-module`. | -| `--world-module-trust-key` | `HEX` | none | Ed25519 module-signing public key trusted by this server, in hex. Repeatable. The flag name is singular (`…-key`); the parser field collects multiple keys. | -| `--world-cap` | `NAME` | none | Capability the default world's program may use. Repeatable. `*` grants the whole catalog. | -| `--world-cap-policy` | `POLICY` | `deny` | What an unlisted capability costs the program: `deny`, or `grant-on-use`, which grants a known capability the first time the program uses it. | -| `--world-allowed-caps` | `NAMES` | the whole catalog | Server-wide capability ceiling, comma-separated. A world may grant less, never more. `*` is refused here. | -| `--roc-bin` | `BIN` | `roc` from PATH; environment fallback `ID_ROC_BIN` | The Roc binary used to compile sources sent to `id world compile`. | -| `--roc-platform` | `DIR` | `./examples/roc-world`; environment fallback `ID_ROC_PLATFORM` | The world platform directory used for on-the-fly compilation. | +| Flag | Argument | Default | Meaning | +| -------------------------- | ------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--world` | none (switch) | off | Host a multiplayer world over Iroh (and over `/ws/world` with `--web`). Requires `--world-admin-token`. | +| `--world-admin-token` | `TOKEN` | none; environment fallback `ID_WORLD_ADMIN_TOKEN` | Admin secret required to mint world guest capabilities. The value is hidden in clap and is a secret: name it, never print it. | +| `--world-module` | `FILE` | none | Start with this precompiled Wasm world module (Roc platform ABI). Requires `--world`. Loading a module requires a build with the `sandbox` feature (see Feature gates). Conflicts with `--world-source-only`. | +| `--world-name` | `NAME` | `lobby` | Name of the world this server offers (one world per process). The world's files live in `.id-worlds//`. The name may contain `a-z`, `0-9`, `-` and `_`. | +| `--world-ssh-port` | `PORT` | none | Serve the world over SSH on this port, bound to `--bind`. Actual SSH serving exists only in `ssh`-feature builds (see Feature gates). | +| `--world-checkpoint-every` | `N` | `1000` | Trim the world's journal behind a program snapshot every N events. `0` never trims. | +| `--world-max-open` | `N` | `256` | Most worlds open at once; idle durable worlds close to make room. | +| `--world-max-sessions` | `N` | `1024` | Most world sessions at once, across every world. | +| `--world-idle-secs` | `N` | `600` | Close durable worlds that no session used for this many seconds; they reopen from their journal on demand. `0` keeps worlds open. | +| `--world-boot-window-secs` | `N` | `600` | Refuse signed world and directory requests for this many seconds after startup, so a request captured before a restart cannot be replayed into a server with empty replay memory. `0` disables the window. | +| `--world-native` | none (switch) | off | Accept native (ELF) module installs. The guarantee for this tier is the OS sandbox (Landlock, seccomp, rlimits), so the tier is opt-in. | +| `--world-source-only` | none (switch) | off; environment fallback `ID_WORLD_SOURCE_ONLY` | Accept new world programs only as Roc source compiled by this server. Disables raw Wasm and native module uploads and `--world-module`. Conflicts with `--world-module`. | +| `--world-module-trust-key` | `HEX` | none | Ed25519 module-signing public key trusted by this server, in hex. Repeatable. The flag name is singular (`…-key`); the parser field collects multiple keys. | +| `--world-cap` | `NAME` | none | Capability the default world's program may use. Repeatable. `*` grants the whole catalog. | +| `--world-cap-policy` | `POLICY` | `deny` | What an unlisted capability costs the program: `deny`, or `grant-on-use`, which grants a known capability the first time the program uses it. | +| `--world-allowed-caps` | `NAMES` | the whole catalog | Server-wide capability ceiling, comma-separated. A world may grant less, never more. `*` is refused here. | +| `--roc-bin` | `BIN` | `roc` from PATH; environment fallback `ID_ROC_BIN` | The Roc binary used to compile sources sent to `id world compile`. | +| `--roc-platform` | `DIR` | `./examples/roc-world`; environment fallback `ID_ROC_PLATFORM` | The world platform directory used for on-the-fly compilation. | ### World runtime flags (flattened `WorldRuntimeArgs`) These flags are defined by the flattened `WorldRuntimeArgs` struct and flattened into `ServeArgs`. Each requires `--world`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--world-fuel` | `UNITS` | `10000000` | Wasm fuel (instruction budget) for one world call. | -| `--world-memory-mib` | `MIB` | `16` | Linear memory for a Wasm world program, in MiB (range 1..=2048). | -| `--world-message-kib` | `KIB` | `1024` | Largest Wasm payload (input or output), in KiB (range 1..=1024). | -| `--world-native-memory-mib` | `MIB` | `256` | Address-space cap for a native worker, in MiB (range 16..=65536). | -| `--world-native-cpu-secs` | `SECS` | `10` | CPU seconds a native worker may use in total. | -| `--world-native-deadline-ms` | `MS` | `10000` | Wall-clock budget for one native worker call, in milliseconds. | -| `--world-total-memory-mib` | `MIB` | `64` | Total per-world logical memory budget, in MiB (range 1..=65536). | -| `--world-guest-burn-concurrency` | `COUNT` | `0` | Concurrent synchronous guest burns admitted hub-wide. `0` means auto (parallelism − 2). | -| `--world-guest-burn-per-account-concurrency` | `COUNT` | `0` | Concurrent synchronous guest burns admitted per charged account. `0` means no per-account bound. | +| Flag | Argument | Default | Meaning | +| -------------------------------------------- | -------- | ---------- | ------------------------------------------------------------------------------------------------ | +| `--world-fuel` | `UNITS` | `10000000` | Wasm fuel (instruction budget) for one world call. | +| `--world-memory-mib` | `MIB` | `16` | Linear memory for a Wasm world program, in MiB (range 1..=2048). | +| `--world-message-kib` | `KIB` | `1024` | Largest Wasm payload (input or output), in KiB (range 1..=1024). | +| `--world-native-memory-mib` | `MIB` | `256` | Address-space cap for a native worker, in MiB (range 16..=65536). | +| `--world-native-cpu-secs` | `SECS` | `10` | CPU seconds a native worker may use in total. | +| `--world-native-deadline-ms` | `MS` | `10000` | Wall-clock budget for one native worker call, in milliseconds. | +| `--world-total-memory-mib` | `MIB` | `64` | Total per-world logical memory budget, in MiB (range 1..=65536). | +| `--world-guest-burn-concurrency` | `COUNT` | `0` | Concurrent synchronous guest burns admitted hub-wide. `0` means auto (parallelism − 2). | +| `--world-guest-burn-per-account-concurrency` | `COUNT` | `0` | Concurrent synchronous guest burns admitted per charged account. `0` means no per-account bound. | ### Confirmation-mail sinks A world host can send confirmation mail through exactly one of three sinks. The three sink flags conflict with each other pairwise, and each requires `--world`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--world-mail-outbox` | `DIR` | none | Write confirmation mail into this directory, one private file per message. | -| `--world-mail-command` | `PROG` | none | Run this program for each confirmation mail. `serve` sets `ID_MAIL_TO`, `ID_MAIL_SUBJECT` and `ID_MAIL_BODY` in the program's environment for each message. | -| `--world-mail-smtp` | `IP:PORT` | none | Relay confirmation mail through this SMTP server. The server must be on loopback and must forward with TLS. Requires `--world-mail-from`. | -| `--world-mail-from` | `ADDR` | none | Sender address for mail sent with `--world-mail-smtp`. Requires `--world-mail-smtp`. | +| Flag | Argument | Default | Meaning | +| ---------------------- | --------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--world-mail-outbox` | `DIR` | none | Write confirmation mail into this directory, one private file per message. | +| `--world-mail-command` | `PROG` | none | Run this program for each confirmation mail. `serve` sets `ID_MAIL_TO`, `ID_MAIL_SUBJECT` and `ID_MAIL_BODY` in the program's environment for each message. | +| `--world-mail-smtp` | `IP:PORT` | none | Relay confirmation mail through this SMTP server. The server must be on loopback and must forward with TLS. Requires `--world-mail-from`. | +| `--world-mail-from` | `ADDR` | none | Sender address for mail sent with `--world-mail-smtp`. Requires `--world-mail-smtp`. | Worked example (toy data): @@ -120,10 +120,10 @@ $ id serve --world --world-admin-token $ID_WORLD_ADMIN_TOKEN --world-name toy-lo ### Write access flags -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--allow-node` | `IDS` | none | Allow this node to modify the store. Repeatable and comma-separated. The same list can be supplied by the `.iroh-allowed` file, one node ID per line. This machine's own server and client keys are always allowed. | -| `--open-writes` | none (switch) | off | Let every peer modify the store. The parser documentation labels this flag "insecure" and scopes it to demos and trusted networks. | +| Flag | Argument | Default | Meaning | +| --------------- | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--allow-node` | `IDS` | none | Allow this node to modify the store. Repeatable and comma-separated. The same list can be supplied by the `.iroh-allowed` file, one node ID per line. This machine's own server and client keys are always allowed. | +| `--open-writes` | none (switch) | off | Let every peer modify the store. The parser documentation labels this flag "insecure" and scopes it to demos and trusted networks. | Reading names, hashes and tags is public. Writing — `put`, delete, rename, copy, tag changes and blob pushes — requires the writer's node ID to be listed through `--allow-node` or `.iroh-allowed`, or requires `--open-writes`. @@ -133,12 +133,12 @@ Three environment variables are read by the serve handler outside clap: `ID_WORL ### Feature gates -| Requested surface | Gate | Behaviour when the feature is off | -|---|---|---| -| `--web`, `--web-listen`, explicit `--port`/`--bind` | `web` cargo feature | Startup fails with: "the web interface was requested (--web/--web-listen/--port/--bind), but this id binary was built without the `web` feature; rebuild with `--features web` to serve it". | -| `--server-config` | `world` cargo feature | Startup fails with a message stating the binary was built without the `world` feature. | -| `--world-module` | `sandbox` cargo feature | Startup fails with: "--world-module requires a build with the `sandbox` feature". | -| `--world-ssh-port` | `ssh` cargo feature | The flag parses in every build; SSH serving exists only in `ssh`-feature builds (the Nix `id-web` package has it; `id-lib` does not). | +| Requested surface | Gate | Behaviour when the feature is off | +| --------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--web`, `--web-listen`, explicit `--port`/`--bind` | `web` cargo feature | Startup fails with: "the web interface was requested (--web/--web-listen/--port/--bind), but this id binary was built without the `web` feature; rebuild with `--features web` to serve it". | +| `--server-config` | `world` cargo feature | Startup fails with a message stating the binary was built without the `world` feature. | +| `--world-module` | `sandbox` cargo feature | Startup fails with: "--world-module requires a build with the `sandbox` feature". | +| `--world-ssh-port` | `ssh` cargo feature | The flag parses in every build; SSH serving exists only in `ssh`-feature builds (the Nix `id-web` package has it; `id-lib` does not). | The default Cargo build (`default = [sandbox, world]`) has no web UI and no world SSH serving. The Nix `id-web` package (the default package) is built with `web + sandbox + ssh + world`; the Nix `id-lib` package is built with `sandbox + world` only. @@ -157,11 +157,11 @@ id publish --listen id publish --path [--acknowledge-shadow] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--listen` | `ADDR` | none | Publish on a dedicated listener at this address (for example `127.0.0.1:8080`; port `0` is OS-assigned). Conflicts with `--path`. | -| `--path` | `PATH` | none | Publish as a path mount on the primary Explorer listener (for example `/prog`). Conflicts with `--listen`. | -| `--acknowledge-shadow` | none (switch) | off | Acknowledge that a path mount shadows an Explorer route. Required to publish a mount that shadows one; without it the mount is refused. | +| Flag | Argument | Default | Meaning | +| ---------------------- | ------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| `--listen` | `ADDR` | none | Publish on a dedicated listener at this address (for example `127.0.0.1:8080`; port `0` is OS-assigned). Conflicts with `--path`. | +| `--path` | `PATH` | none | Publish as a path mount on the primary Explorer listener (for example `/prog`). Conflicts with `--listen`. | +| `--acknowledge-shadow` | none (switch) | off | Acknowledge that a path mount shadows an Explorer route. Required to publish a mount that shadows one; without it the mount is refused. | Behaviour notes: @@ -188,10 +188,10 @@ id unpublish --listen id unpublish --path ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--listen` | `ADDR` | none | Unpublish the dedicated listener at this address. Conflicts with `--path` (parser-level conflict). | -| `--path` | `PATH` | none | Unpublish the path mount at this path. | +| Flag | Argument | Default | Meaning | +| ---------- | -------- | ------- | -------------------------------------------------------------------------------------------------- | +| `--listen` | `ADDR` | none | Unpublish the dedicated listener at this address. Conflicts with `--path` (parser-level conflict). | +| `--path` | `PATH` | none | Unpublish the path mount at this path. | Behaviour notes: @@ -212,9 +212,9 @@ Failure shapes: no serve running is a handler error (exit 1). Giving both `--lis id publications ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| (none) | — | — | `publications` takes no arguments and defines no flags of its own; the global flags apply. | +| Flag | Argument | Default | Meaning | +| ------ | -------- | ------- | ------------------------------------------------------------------------------------------ | +| (none) | — | — | `publications` takes no arguments and defines no flags of its own; the global flags apply. | Behaviour notes: diff --git a/pkgs/id/book/reference/cli-tags.md b/pkgs/id/book/reference/cli-tags.md index 757f613feb..27358c4e7b 100644 --- a/pkgs/id/book/reference/cli-tags.md +++ b/pkgs/id/book/reference/cli-tags.md @@ -26,10 +26,10 @@ id tag add [VALUE] Alias: `add`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--value-hex` | `HEX` | none | Tag value as hex-encoded raw bytes (binary-safe). Conflicts with the positional `VALUE` and with `--value-file`. | -| `--value-file` | `PATH` | none | Read the raw tag value from `PATH`; `-` reads stdin. Conflicts with `--value-hex`. | +| Flag | Argument | Default | Meaning | +| -------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------- | +| `--value-hex` | `HEX` | none | Tag value as hex-encoded raw bytes (binary-safe). Conflicts with the positional `VALUE` and with `--value-file`. | +| `--value-file` | `PATH` | none | Read the raw tag value from `PATH`; `-` reads stdin. Conflicts with `--value-hex`. | Behaviour notes: @@ -61,9 +61,9 @@ id tag del [VALUE] Aliases: `rm`, `remove`, `rem`, `delete`, `unset`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--value-hex` | `HEX` | none | Specific value to remove, as hex-encoded raw bytes. Conflicts with the positional `VALUE`. | +| Flag | Argument | Default | Meaning | +| ------------- | -------- | ------- | ------------------------------------------------------------------------------------------ | +| `--value-hex` | `HEX` | none | Specific value to remove, as hex-encoded raw bytes. Conflicts with the positional `VALUE`. | Behaviour notes: @@ -95,11 +95,11 @@ id tag ls [FILE] Alias: `ls`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--hex` | none (switch) | off | Show non-UTF-8 values as hex (`0x...`) instead of ``. | -| `--binary` | none (switch) | off | Show non-UTF-8 values as lossy text instead of ``. | -| `--no-truncate` | none (switch) | off | Do not truncate long values; the display default truncates at 256 bytes. | +| Flag | Argument | Default | Meaning | +| --------------- | ------------- | ------- | ------------------------------------------------------------------------ | +| `--hex` | none (switch) | off | Show non-UTF-8 values as hex (`0x...`) instead of ``. | +| `--binary` | none (switch) | off | Show non-UTF-8 values as lossy text instead of ``. | +| `--no-truncate` | none (switch) | off | Do not truncate long values; the display default truncates at 256 bytes. | Behaviour notes: @@ -128,21 +128,21 @@ id tag find ... Alias: `find`. At least one query term is required. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--hex` | none (switch) | off | Show non-UTF-8 values as hex (`0x...`) instead of ``. | -| `--binary` | none (switch) | off | Show non-UTF-8 values as lossy text instead of ``. | -| `--no-truncate` | none (switch) | off | Do not truncate long values; the display default truncates at 256 bytes. | +| Flag | Argument | Default | Meaning | +| --------------- | ------------- | ------- | ------------------------------------------------------------------------ | +| `--hex` | none (switch) | off | Show non-UTF-8 values as hex (`0x...`) instead of ``. | +| `--binary` | none (switch) | off | Show non-UTF-8 values as lossy text instead of ``. | +| `--no-truncate` | none (switch) | off | Do not truncate long values; the display default truncates at 256 bytes. | Behaviour notes — the structured query syntax. Each query term takes one of five forms: -| Term form | Matches | -|---|---| -| `key:` | Tags whose key is `key` (any value, or key-only). | -| `:value` | Tags whose value is `value` (any key). | -| `key:value` | Tags with exactly that key and that value. | +| Term form | Matches | +| ----------- | ------------------------------------------------------------------------ | +| `key:` | Tags whose key is `key` (any value, or key-only). | +| `:value` | Tags whose value is `value` (any key). | +| `key:value` | Tags with exactly that key and that value. | | `"literal"` | Tags where the literal text occurs in any field (subject, key or value). | -| `bare` | Case-insensitive search across subject, key and value. | +| `bare` | Case-insensitive search across subject, key and value. | - Multiple terms are ANDed: a tag must satisfy every term to be returned. - Quoted strings are accepted in the key and value positions of a `key:value` term: `"key:":":value"` matches the key `key:` with the value `:value`. diff --git a/pkgs/id/book/reference/cli-worlds-admin.md b/pkgs/id/book/reference/cli-worlds-admin.md index 275d7e8913..4735a54de7 100644 --- a/pkgs/id/book/reference/cli-worlds-admin.md +++ b/pkgs/id/book/reference/cli-worlds-admin.md @@ -20,14 +20,14 @@ Changes a world's capabilities. The read form is in [World commands: joining and id world caps [--grant ]... [--revoke ]... [--ceiling ] [--admin-token ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--grant` | capability name | — (none) | Capability to grant; repeatable. `*` grants the whole catalog. | -| `--revoke` | capability name | — (none) | Capability to revoke; repeatable. | -| `--ceiling` | capability names, comma-separated or repeatable | — (none) | Capability ceiling to set. Only known capabilities; `*` is not accepted in a ceiling. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Required for any change. | -| `--capability` | capability string | — (env `ID_WORLD_CAPABILITY`) | A guest capability. Sufficient for reading; never sufficient for a change. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--grant` | capability name | — (none) | Capability to grant; repeatable. `*` grants the whole catalog. | +| `--revoke` | capability name | — (none) | Capability to revoke; repeatable. | +| `--ceiling` | capability names, comma-separated or repeatable | — (none) | Capability ceiling to set. Only known capabilities; `*` is not accepted in a ceiling. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Required for any change. | +| `--capability` | capability string | — (env `ID_WORLD_CAPABILITY`) | A guest capability. Sufficient for reading; never sufficient for a change. | Behaviour: any of `--grant`, `--revoke` or `--ceiling` turns the invocation into a change, and a change needs the admin token. A guest capability alone cannot change anything. The background model is in [Capabilities, ceilings and providers](../concepts/capabilities.md). @@ -49,16 +49,16 @@ Persists a world's requested execution profile bounds. The read form is in [Worl id world profile [--wasm-fuel ] [--wasm-memory-bytes ] [...] [--admin-token ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--wasm-fuel` | integer | — (none) | Requested Wasm fuel limit per transaction/event. Visible alias: `--fuel`. | -| `--wasm-memory-bytes` | integer (bytes) | — (none) | Requested Wasm linear memory in bytes. Visible alias: `--wasm-memory`. | -| `--wasm-message-bytes` | integer (bytes) | — (none) | Requested Wasm message payload limit in bytes. Visible alias: `--wasm-message`. | -| `--native-memory-bytes` | integer (bytes) | — (none) | Requested native address-space cap in bytes. Visible alias: `--native-memory`. | -| `--native-cpu-seconds` | integer (seconds) | — (none) | Requested native CPU cap in seconds. Visible alias: `--native-cpu`. | -| `--native-call-deadline-ms` | integer (milliseconds) | — (none) | Requested native call deadline in milliseconds. Visible alias: `--native-deadline`. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Required when any limit flag is given. | +| Flag | Argument | Default | Meaning | +| --------------------------- | ---------------------- | ------------------------------ | ----------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--wasm-fuel` | integer | — (none) | Requested Wasm fuel limit per transaction/event. Visible alias: `--fuel`. | +| `--wasm-memory-bytes` | integer (bytes) | — (none) | Requested Wasm linear memory in bytes. Visible alias: `--wasm-memory`. | +| `--wasm-message-bytes` | integer (bytes) | — (none) | Requested Wasm message payload limit in bytes. Visible alias: `--wasm-message`. | +| `--native-memory-bytes` | integer (bytes) | — (none) | Requested native address-space cap in bytes. Visible alias: `--native-memory`. | +| `--native-cpu-seconds` | integer (seconds) | — (none) | Requested native CPU cap in seconds. Visible alias: `--native-cpu`. | +| `--native-call-deadline-ms` | integer (milliseconds) | — (none) | Requested native call deadline in milliseconds. Visible alias: `--native-deadline`. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Required when any limit flag is given. | Behaviour: giving any limit flag persists the new profile and requires the admin token. Giving none prints the current persisted profile (the read form). The limit flags take bytes, seconds and milliseconds as raw integers; contrast the serve-side runtime flags in [serve and publications](cli-serve.md), which take MiB and KiB units. @@ -79,14 +79,14 @@ Diagnoses a broken world setup and prints the fix for each problem. It takes no id world doctor [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--roc-bin` | binary | `ID_ROC_BIN`, then the pinned nightly, then `roc` on PATH | Roc compiler binary to check. Environment fallback: `ID_ROC_BIN`. | -| `--platform` | directory | `ID_ROC_PLATFORM`, or `./examples/roc-world` | World platform directory to check. Environment fallback: `ID_ROC_PLATFORM`. | -| `--journal` | file path | — (none) | World journal (`journal.jsonl`) to check for format errors. | -| `--ceiling` | capability names, comma-separated or repeatable | — (none) | Capability ceiling to check. Only known capabilities, no `*`. Without it, the ceiling check reports that none is configured. | -| `--profile` | file path (JSON) | — (none) | Execution profile to check, as a JSON file whose fields are the execution-profile bounds, e.g. `{"wasm_fuel": 0}`. Without it, the profile check reports that none is configured. | -| `--json` | switch | off | Print one machine-readable report instead of text. | +| Flag | Argument | Default | Meaning | +| ------------ | ----------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--roc-bin` | binary | `ID_ROC_BIN`, then the pinned nightly, then `roc` on PATH | Roc compiler binary to check. Environment fallback: `ID_ROC_BIN`. | +| `--platform` | directory | `ID_ROC_PLATFORM`, or `./examples/roc-world` | World platform directory to check. Environment fallback: `ID_ROC_PLATFORM`. | +| `--journal` | file path | — (none) | World journal (`journal.jsonl`) to check for format errors. | +| `--ceiling` | capability names, comma-separated or repeatable | — (none) | Capability ceiling to check. Only known capabilities, no `*`. Without it, the ceiling check reports that none is configured. | +| `--profile` | file path (JSON) | — (none) | Execution profile to check, as a JSON file whose fields are the execution-profile bounds, e.g. `{"wasm_fuel": 0}`. Without it, the profile check reports that none is configured. | +| `--json` | switch | off | Print one machine-readable report instead of text. | Behaviour: checks the Roc toolchain, the platform build, the capability ceiling, the execution profile, the journal format and the clock. Each problem is printed with its fix. @@ -108,13 +108,13 @@ Shows the drift between a `world.toml` file and a live world. Read-only: it chan id world diff --file --capability ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--file` | file path | required | Path to the `world.toml` to compare against. | +| Flag | Argument | Default | Meaning | +| -------------- | ----------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--file` | file path | required | Path to the `world.toml` to compare against. | | `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability, enough to read the world. No admin token is needed or accepted for this command. | -Behaviour: prints the drift report and stays informational: drift alone does not fail the command. If the manifest's plan is one an `apply` would refuse (the schedule-horizon check), `diff` prints `warning: \`world apply\` would refuse this manifest: ` to stderr and still exits `0`. +Behaviour: prints the drift report and stays informational: drift alone does not fail the command. If the manifest's plan is one an `apply` would refuse (the schedule-horizon check), `diff` prints `warning: \`world apply\` would refuse this manifest: `to stderr and still exits`0`. Example: @@ -133,13 +133,13 @@ Reconciles a live world to a `world.toml`. Idempotent and journaled by the host. id world apply --file --admin-token --capability [--dry-run] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--file` | file path | required | Path to the `world.toml` to apply. | -| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | -| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability, used to read the current state. Applying reads before it writes, so both credentials are required. | -| `--dry-run` | switch | off | Print the plan only; change nothing. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--file` | file path | required | Path to the `world.toml` to apply. | +| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability, used to read the current state. Applying reads before it writes, so both credentials are required. | +| `--dry-run` | switch | off | Print the plan only; change nothing. | Behaviour: prints the plan and applies it. Every step — module install, grants, ceiling, profile, schedules — is applied through the admin operations and journaled by the host. When the plan is empty the command prints `no drift` and changes nothing. A full apply prints `applied step(s)`; a partial apply prints `applied of step(s); the rest were reported but not applied`. With `--dry-run` it prints the plan and then `dry run: nothing changed`. Before any step runs, the plan passes the schedule-horizon check: a plan that fails it is refused whole, so no partial apply happens on that account. @@ -162,9 +162,9 @@ Prints the versioned shell contract — the frame protocol every shell speaks id world contract [--check | --check-suite ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--check` | file path | — (none) | Transcript to check. `-` reads stdin. Without `--check` or `--check-suite`, the command prints the shell contract itself. Conflicts with `--check-suite`. | +| Flag | Argument | Default | Meaning | +| --------------- | --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--check` | file path | — (none) | Transcript to check. `-` reads stdin. Without `--check` or `--check-suite`, the command prints the shell contract itself. Conflicts with `--check-suite`. | | `--check-suite` | file path | — (none) | Suite manifest to run (`contract/shell-suite.v1.json`): every shell's capability statement and recorded session, checked in one pass. Conflicts with `--check`. | Behaviour: a transcript has one JSON object per line, of the form `{"from": "client"|"server", "frame": {...}}`. The check prints each violation. @@ -187,13 +187,13 @@ Measures a compiled `.wasm` world program's fuel use, offline. No host is contac id world measure --module [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--module` | file path | required | Wasm module built for the `id` Roc world ABI. | -| `--seed` | integer | `1` | Deterministic seed supplied to the guest initializer. | -| `--input` | hex string | — (none) | Event to apply as participant 1, hex-encoded; repeatable, in order. | -| `--width` | integer | — (none) | Viewport width for the `layout` call. Requires `--height`. | -| `--height` | integer | — (none) | Viewport height for the `layout` call. Requires `--width`. | +| Flag | Argument | Default | Meaning | +| ---------- | ---------- | -------- | ------------------------------------------------------------------- | +| `--module` | file path | required | Wasm module built for the `id` Roc world ABI. | +| `--seed` | integer | `1` | Deterministic seed supplied to the guest initializer. | +| `--input` | hex string | — (none) | Event to apply as participant 1, hex-encoded; repeatable, in order. | +| `--width` | integer | — (none) | Viewport width for the `layout` call. Requires `--height`. | +| `--height` | integer | — (none) | Viewport height for the `layout` call. Requires `--width`. | Behaviour: compiles the module with the default limits, runs `view`, then `layout` (with `--width`/`--height`), `records`, `wants` and `snapshot`, then each `--input` as participant 1 followed by a `view`. It prints one JSON object with, per call kind, the calls made, total and worst fuel, and the worst call as a percent of the fuel limit. @@ -215,11 +215,11 @@ Tails a world's recent events, bounded by retention and a deadline. id world logs --capability [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | -| `--seconds` | integer, `0..=86400` | `5` | Stop after this many seconds. The maximum is `86400` (24 hours); a larger value is a clap error, exit `2`. | +| Flag | Argument | Default | Meaning | +| -------------- | -------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | +| `--seconds` | integer, `0..=86400` | `5` | Stop after this many seconds. The maximum is `86400` (24 hours); a larger value is a clap error, exit `2`. | Example — tail a toy world for 30 seconds: @@ -238,9 +238,9 @@ Prints a world's module, capability and profile state as one JSON object. id world stats --capability ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | +| Flag | Argument | Default | Meaning | +| -------------- | ----------------- | ------------------------------------ | --------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | | `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | Example: @@ -260,11 +260,11 @@ Writes a world's retained journal history and records to a replayable fixture (J id world record --admin-token [--out ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | -| `--out` | file path | stdout | Write the fixture here instead of standard output. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------------- | -------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| `--out` | file path | stdout | Write the fixture here instead of standard output. | Example: @@ -283,12 +283,12 @@ Replays a recorded fixture offline through a module and compares records. No hos id world replay --module --fixture --seed [--allow-partial] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--module` | file path | required | The Wasm module the fixture was recorded under. | -| `--fixture` | file path | required | Fixture written by `world record`. | -| `--seed` | integer | required | The seed the module was installed with. The fixture does not carry it. | -| `--allow-partial` | switch | off | Replay a window that does not start at sequence 1. Its records are not compared. | +| Flag | Argument | Default | Meaning | +| ----------------- | --------- | -------- | -------------------------------------------------------------------------------- | +| `--module` | file path | required | The Wasm module the fixture was recorded under. | +| `--fixture` | file path | required | Fixture written by `world record`. | +| `--seed` | integer | required | The seed the module was installed with. The fixture does not carry it. | +| `--allow-partial` | switch | off | Replay a window that does not start at sequence 1. Its records are not compared. | Behaviour: prints a verdict line first — `records match`, `records differ`, or `records not compared ()` — followed by the replayed records and view. @@ -310,12 +310,12 @@ Verifies a recorded fixture's determinism: replays it twice offline through a mo id world verify --module --fixture --seed [--allow-partial] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--module` | file path | required | The Wasm module the fixture was recorded under. | -| `--fixture` | file path | required | Fixture written by `world record`. | -| `--seed` | integer | required | The seed the module was installed with. The fixture does not carry it. | -| `--allow-partial` | switch | off | Replay a window that does not start at sequence 1. Its records are not compared against the fixture's header, but the two replays are still compared against each other. | +| Flag | Argument | Default | Meaning | +| ----------------- | --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `--module` | file path | required | The Wasm module the fixture was recorded under. | +| `--fixture` | file path | required | Fixture written by `world record`. | +| `--seed` | integer | required | The seed the module was installed with. The fixture does not carry it. | +| `--allow-partial` | switch | off | Replay a window that does not start at sequence 1. Its records are not compared against the fixture's header, but the two replays are still compared against each other. | Behaviour: prints a verdict line first. Verification covers the events captured by the admin-authorized fixture, including host-originated events in their recorded order. It proves determinism for that history, not correctness of host policy. @@ -337,11 +337,11 @@ Lists the worlds a host serves, using the admin listing. The public directory fo id world list --admin-token [--json] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Giving it selects the admin listing; omitting it reads the public directory instead. | -| `--json` | switch | off | Print one JSON object instead of tab-separated lines. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Giving it selects the admin listing; omitting it reads the public directory instead. | +| `--json` | switch | off | Print one JSON object instead of tab-separated lines. | Example: @@ -359,11 +359,11 @@ Sets whether a world's directory may be read from other unisolated worlds. World id world isolation --admin-token ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `` | `isolated\|unisolated` | required positional | `isolated`: no cross-world reads. `unisolated`: readable from other unisolated worlds. Any other value is a clap error, exit `2`. | -| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| Flag | Argument | Default | Meaning | +| --------------- | ---------------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `` | `isolated\|unisolated` | required positional | `isolated`: no cross-world reads. `unisolated`: readable from other unisolated worlds. Any other value is a clap error, exit `2`. | +| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | Example: @@ -382,11 +382,11 @@ Lets other unisolated worlds write into a world, or stops them. id world cross-world-write --admin-token ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `` | `on\|off` | required positional | `on`: other unisolated worlds may write here. `off`: they may not. Any other value is a clap error, exit `2`. | -| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `` | `on\|off` | required positional | `on`: other unisolated worlds may write here. `off`: they may not. Any other value is a clap error, exit `2`. | +| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | Example: @@ -405,10 +405,10 @@ Forces cross-world writes on for an unisolated world, overriding its own setting id world force-cross-world-write --admin-token ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------------- | ------------------------ | +| `` | 64 hex characters | required | The host's node ID. | +| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | Example: @@ -426,12 +426,12 @@ Sets a world's file scope. id world file-scope --admin-token [--write-override ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `` | `confined\|unrestricted` | required positional | `confined`: the world's own sandbox root. `unrestricted`: any path. Any other value is a clap error, exit `2`. | -| `--write-override` | `on\|off` | — (none) | Admin file write override for an isolated world. | -| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| Flag | Argument | Default | Meaning | +| ------------------ | ------------------------ | ------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `` | `confined\|unrestricted` | required positional | `confined`: the world's own sandbox root. `unrestricted`: any path. Any other value is a clap error, exit `2`. | +| `--write-override` | `on\|off` | — (none) | Admin file write override for an isolated world. | +| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | Example: @@ -450,16 +450,16 @@ Follows a pinned writer into a durable replica, opens it under the policy-B admi id world replica --dir --admin-token [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The writer host's node ID. | -| `--dir` | directory path | required | Replica directory: the durable journal lives here and is opened in place on later runs (created on first follow). Omitting it is a clap error, exit `2`. | -| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | Admin secret of the writer host, authorizing the raw journal feed. | -| `--world` | name | `lobby` | World to replicate (the writer's world name). Environment fallback: `ID_WORLD`. This is the only world command where `--world` has a clap default value. | -| `--source` | 64 hex characters | the writer's node ID | Pinned writer source key: the replication stream and the admission lease must both verify against it. The default holds because the writer's node ID is the key the writer signs its replication stream with. | -| `--lease` | file path (JSON) | — (none) | A writer-signed admission lease to hold while serving: new spectators are admitted only while it verifies (policy B). Without one the replica serves gated, admitting no new spectators. | -| `--once` | switch | off | Sync once from the writer, print the replica status as JSON, and exit without serving. Conflicts with `--follow`. | -| `--follow` | switch | off | Keep following the writer (reconnecting across sessions), printing one JSON line per committed cursor; never serves. Conflicts with `--once`. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The writer host's node ID. | +| `--dir` | directory path | required | Replica directory: the durable journal lives here and is opened in place on later runs (created on first follow). Omitting it is a clap error, exit `2`. | +| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | Admin secret of the writer host, authorizing the raw journal feed. | +| `--world` | name | `lobby` | World to replicate (the writer's world name). Environment fallback: `ID_WORLD`. This is the only world command where `--world` has a clap default value. | +| `--source` | 64 hex characters | the writer's node ID | Pinned writer source key: the replication stream and the admission lease must both verify against it. The default holds because the writer's node ID is the key the writer signs its replication stream with. | +| `--lease` | file path (JSON) | — (none) | A writer-signed admission lease to hold while serving: new spectators are admitted only while it verifies (policy B). Without one the replica serves gated, admitting no new spectators. | +| `--once` | switch | off | Sync once from the writer, print the replica status as JSON, and exit without serving. Conflicts with `--follow`. | +| `--follow` | switch | off | Keep following the writer (reconnecting across sessions), printing one JSON line per committed cursor; never serves. Conflicts with `--once`. | Behaviour: in its default mode the command syncs the replica directory from the writer's signed journal feed, prints the replica status (source, world, cursor, staleness) as one JSON object, then serves the replica's world sessions on this node. `--once` stops after the status print. `--follow` keeps the replica journal current without serving. @@ -480,11 +480,11 @@ Creates a world on a host. id world create --admin-token ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `` | string | required positional | Name of the new world. Charset: `a-z`, `0-9`, `-` and `_`. | -| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------------- | ---------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `` | string | required positional | Name of the new world. Charset: `a-z`, `0-9`, `-` and `_`. | +| `--admin-token` | token | required (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | Behaviour: on success the command prints `created`; if the world already exists on the host it prints `exists`. @@ -508,10 +508,10 @@ id world journal backup ### `journal check` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required | Directory of the world to check (the one holding `journal.jsonl`). | -| `--json` | switch | off | Print one JSON object instead of text lines. | +| Flag | Argument | Default | Meaning | +| -------- | -------------- | -------- | ------------------------------------------------------------------ | +| `` | directory path | required | Directory of the world to check (the one holding `journal.jsonl`). | +| `--json` | switch | off | Print one JSON object instead of text lines. | Behaviour: reports the journal's format version and validity, flagging a journal written in a newer format than this binary can read. @@ -525,10 +525,10 @@ $ id world journal check ./toy-world-dir ### `journal backup` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required | Directory of the world to back up (the one holding `journal.jsonl`). | -| `` | file path | required positional | The backup file to write. It must not already exist. | +| Flag | Argument | Default | Meaning | +| ------- | -------------- | ------------------- | -------------------------------------------------------------------- | +| `` | directory path | required | Directory of the world to back up (the one holding `journal.jsonl`). | +| `` | file path | required positional | The backup file to write. It must not already exist. | Behaviour: copies the journal to the backup file, byte for byte, so the copy restores the world exactly. The journal must check valid first: the backup runs the same validity check before copying. diff --git a/pkgs/id/book/reference/cli-worlds.md b/pkgs/id/book/reference/cli-worlds.md index 7165931541..e645b3fd67 100644 --- a/pkgs/id/book/reference/cli-worlds.md +++ b/pkgs/id/book/reference/cli-worlds.md @@ -12,14 +12,14 @@ Exit behaviour, all `world` commands unless a command states otherwise: success The flags below repeat in each world command's argument struct; they are not global flags. They are stated once here. Each command's own table lists only the flags specific to that command, plus its credential requirement where that differs. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required positional | The host's node ID. With `join --via ssh` it is instead the SSH target (see `join`). | -| `--admin-token` | token | — (none) | The host's admin secret, as configured with `serve --world-admin-token`. Environment fallback: `ID_WORLD_ADMIN_TOKEN`. The value is never echoed; clap hides environment values for this flag. | -| `--capability` | capability string | — (none) | A guest capability minted by `world invite`. Environment fallback: `ID_WORLD_CAPABILITY`. The value is never echoed; clap hides environment values for this flag. | -| `--world` | name | host's default world | Which world on the host to use. Environment fallback: `ID_WORLD`. One command overrides this default: `world replica` defaults `--world` to `lobby` (see [World commands: administering and verifying](cli-worlds-admin.md)). | -| `--addr` | `IP:PORT` | — (none) | Direct socket address of the host; repeatable. Giving one skips discovery. | -| `--no-relay` | switch | off | Disable relay servers; direct connections only. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required positional | The host's node ID. With `join --via ssh` it is instead the SSH target (see `join`). | +| `--admin-token` | token | — (none) | The host's admin secret, as configured with `serve --world-admin-token`. Environment fallback: `ID_WORLD_ADMIN_TOKEN`. The value is never echoed; clap hides environment values for this flag. | +| `--capability` | capability string | — (none) | A guest capability minted by `world invite`. Environment fallback: `ID_WORLD_CAPABILITY`. The value is never echoed; clap hides environment values for this flag. | +| `--world` | name | host's default world | Which world on the host to use. Environment fallback: `ID_WORLD`. One command overrides this default: `world replica` defaults `--world` to `lobby` (see [World commands: administering and verifying](cli-worlds-admin.md)). | +| `--addr` | `IP:PORT` | — (none) | Direct socket address of the host; repeatable. Giving one skips discovery. | +| `--no-relay` | switch | off | Disable relay servers; direct connections only. | A command needs the admin token, a capability, both, or neither, as its own section states. Token and capability values are secrets: this chapter names them and never prints a value. In the examples, `toy-cap-0001` and similar strings are invented toy credentials. @@ -33,14 +33,14 @@ Mints a guest capability on a world host. This is the only way a participant cre id world invite --name [--admin-token ] [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--name` | string | required | Display name for the new participant. There is no default; omitting it is a clap error, exit `2`. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Required in effect: the host refuses the mint without it. | -| `--role` | `spectator\|observer\|player\|guest\|delegator\|builder\|moderator` | `guest` | Role preset. `spectator` sees the world but not the chat; `observer` also reads chat; `player` also inputs; `guest` also chats; `delegator` may also mint narrower capabilities. `builder` and `moderator` complete the set of seven accepted values. Any other value is a clap error, exit `2`. | -| `--expires-in` | duration, e.g. `12h`, `3d` | `7 days` | How long the invite works. The maximum is `30 days`. | -| `--uses` | integer | unlimited | How many committed actions the invite may take. Must be at least `1` when given. | +| Flag | Argument | Default | Meaning | +| --------------- | ------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `` | 64 hex characters | required | The host's node ID. | +| `--name` | string | required | Display name for the new participant. There is no default; omitting it is a clap error, exit `2`. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Required in effect: the host refuses the mint without it. | +| `--role` | `spectator\|observer\|player\|guest\|delegator\|builder\|moderator` | `guest` | Role preset. `spectator` sees the world but not the chat; `observer` also reads chat; `player` also inputs; `guest` also chats; `delegator` may also mint narrower capabilities. `builder` and `moderator` complete the set of seven accepted values. Any other value is a clap error, exit `2`. | +| `--expires-in` | duration, e.g. `12h`, `3d` | `7 days` | How long the invite works. The maximum is `30 days`. | +| `--uses` | integer | unlimited | How many committed actions the invite may take. Must be at least `1` when given. | Behaviour: only the capability goes to stdout, so it can be captured into a variable or a file. Give that string to the participant; it is the `--capability` value (or the `ID_WORLD_CAPABILITY` environment value) for `records`, `mirror`, `download` and `join`. Losing it is losing the invite: re-invite rather than trying to recover it. The `--expires-in` and `--uses` bounds are checked locally, before the host is contacted. @@ -61,12 +61,12 @@ Uploads a compiled Wasm module built for the `id` Roc world ABI and activates it id world install [--admin-token ] [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `` | file path | required | The `.wasm` module to upload and activate. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | -| `--seed` | integer | `1` | Deterministic seed supplied to the guest initializer. Record it: `world replay` and `world verify` need the same seed later (see [World commands: administering and verifying](cli-worlds-admin.md)). | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `` | file path | required | The `.wasm` module to upload and activate. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| `--seed` | integer | `1` | Deterministic seed supplied to the guest initializer. Record it: `world replay` and `world verify` need the same seed later (see [World commands: administering and verifying](cli-worlds-admin.md)). | Example — install a toy module with the default seed: @@ -85,11 +85,11 @@ Prints the world's structured records as one JSON object. id world records --capability [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | -| `--prefix` | string | — (none) | Only keys starting with this prefix. | +| Flag | Argument | Default | Meaning | +| -------------- | ----------------- | ------------------------------------ | ------------------------------------ | +| `` | 64 hex characters | required | The host's node ID. | +| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | +| `--prefix` | string | — (none) | Only keys starting with this prefix. | Example — read the records under a toy key prefix: @@ -108,13 +108,13 @@ Replicates the world's records over iroh with an iroh-docs replica. It runs a lo id world mirror --capability [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | -| `-f, --follow` | switch | off | Keep printing whenever the records change, instead of syncing once and printing the current records. | -| `--dir` | path | — (none) | Store the replica on disk so it survives between runs. Without it the replica is in memory for this run only. | -| `--timeout-secs` | integer, `0..=86400` | `30` | Give up after this many seconds without a completed sync. A value above `86400` is a clap error, exit `2`. | +| Flag | Argument | Default | Meaning | +| ---------------- | -------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | +| `-f, --follow` | switch | off | Keep printing whenever the records change, instead of syncing once and printing the current records. | +| `--dir` | path | — (none) | Store the replica on disk so it survives between runs. Without it the replica is in memory for this run only. | +| `--timeout-secs` | integer, `0..=86400` | `30` | Give up after this many seconds without a completed sync. A value above `86400` is a clap error, exit `2`. | Example — keep a persistent toy replica in `./toy-replica` and follow changes: @@ -133,11 +133,11 @@ Downloads the module backing the world's current state, verified by hash. id world download --capability --output ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | -| `--output` | file path | required | Where to write the verified module bytes. Omitting it is a clap error, exit `2`. | +| Flag | Argument | Default | Meaning | +| -------------- | ----------------- | ------------------------------------ | -------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. | +| `--output` | file path | required | Where to write the verified module bytes. Omitting it is a clap error, exit `2`. | Behaviour: the command asks the host for the world's active module hash, downloads the module by that hash (verified by hash), writes the bytes to `--output`, and prints the module hash. @@ -158,15 +158,15 @@ Joins a world and chats. Stdin lines are chat; `/input ` sends opaque input id world join --capability [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters, or an SSH target with `--via ssh` | required | With `iroh`, the host's node ID. With `ssh`, `[user@]host[:port]` of the host's world SSH server. | -| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. With `--via ssh` it is presented over the SSH channel. | -| `--after` | integer (sequence) | — (none) | Replay events after this sequence instead of receiving a full snapshot. | -| `--command-mode` | switch | off | Parse stdin lines as commands (`/chat`, `/records`, `/stats`, `/caps`, `/quit`, and the rest of the in-session command set) instead of sending every line as chat. | -| `--json` | switch | off | Emit local command responses as JSONL records on stdout. Requires `--command-mode`; giving it alone is a clap error, exit `2`. | -| `--via` | `iroh\|ssh` | `iroh` | How to reach the host: an iroh QUIC stream to the node ID, or an exec channel on the host's world SSH server, for networks and jump hosts that only pass SSH. | -| `--ssh-host-key` | fingerprint, `SHA256:...` | — (none) | With `--via ssh`: the host key fingerprint `id serve` prints. Without it, the key must be in `~/.ssh/known_hosts`. | +| Flag | Argument | Default | Meaning | +| ---------------- | ---------------------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `` | 64 hex characters, or an SSH target with `--via ssh` | required | With `iroh`, the host's node ID. With `ssh`, `[user@]host[:port]` of the host's world SSH server. | +| `--capability` | capability string | required (env `ID_WORLD_CAPABILITY`) | A guest capability for the world. With `--via ssh` it is presented over the SSH channel. | +| `--after` | integer (sequence) | — (none) | Replay events after this sequence instead of receiving a full snapshot. | +| `--command-mode` | switch | off | Parse stdin lines as commands (`/chat`, `/records`, `/stats`, `/caps`, `/quit`, and the rest of the in-session command set) instead of sending every line as chat. | +| `--json` | switch | off | Emit local command responses as JSONL records on stdout. Requires `--command-mode`; giving it alone is a clap error, exit `2`. | +| `--via` | `iroh\|ssh` | `iroh` | How to reach the host: an iroh QUIC stream to the node ID, or an exec channel on the host's world SSH server, for networks and jump hosts that only pass SSH. | +| `--ssh-host-key` | fingerprint, `SHA256:...` | — (none) | With `--via ssh`: the host key fingerprint `id serve` prints. Without it, the key must be in `~/.ssh/known_hosts`. | Example — join in command mode with JSONL responses, over SSH: @@ -192,11 +192,11 @@ Reaches a host's world SSH server through iroh, so an ordinary `ssh` client can id world ssh-tunnel [--listen | --stdio] [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--listen` | address | — (none) | Local address to listen on. Loopback only is recommended. Conflicts with `--stdio`. | -| `--stdio` | switch | off | Speak SSH on stdin/stdout, for use as an `ssh -o ProxyCommand`. Conflicts with `--listen`. | +| Flag | Argument | Default | Meaning | +| ---------- | ----------------- | -------- | ------------------------------------------------------------------------------------------ | +| `` | 64 hex characters | required | The host's node ID. | +| `--listen` | address | — (none) | Local address to listen on. Loopback only is recommended. Conflicts with `--stdio`. | +| `--stdio` | switch | off | Speak SSH on stdin/stdout, for use as an `ssh -o ProxyCommand`. Conflicts with `--listen`. | Example — listen locally, then connect with a normal `ssh` client (the password is the guest capability): @@ -216,14 +216,14 @@ Compiles Roc sources on the host and installs the result. The host rewrites the id world compile [--admin-token ] [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `` | file path | required | The app's `main.roc`. | -| `-f, --file` | file path | — (none) | Additional source files; repeatable. Paths become file names on the host. | -| `--seed` | integer | random | Seed for the compiled program's initializer. Omitted means a random seed is chosen; contrast `install` and `dev`, where the seed defaults to `1`. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | -| `--native` | switch | off | Build a native worker (x64musl) instead of Wasm. The host must run with `--world-native` and a platform with native targets. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `` | file path | required | The app's `main.roc`. | +| `-f, --file` | file path | — (none) | Additional source files; repeatable. Paths become file names on the host. | +| `--seed` | integer | random | Seed for the compiled program's initializer. Omitted means a random seed is chosen; contrast `install` and `dev`, where the seed defaults to `1`. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. | +| `--native` | switch | off | Build a native worker (x64musl) instead of Wasm. The host must run with `--world-native` and a platform with native targets. | Example — compile a toy app from its main file plus one extra source: @@ -244,20 +244,20 @@ This command exists only in `sandbox` builds; see the gating note at the top of id world dev [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required | App directory holding the app's `main.roc` and its sibling `.roc` sources. | -| `--platform` | directory | the platform path `main.roc` declares, resolved against the app directory | World platform directory (or its `platform.roc` file). | -| `--roc` | binary | `ID_ROC_BIN`, then the bundled toolchain lookup the host compiler uses | Roc compiler binary. This flag has no clap environment fallback of its own; the default resolution consults `ID_ROC_BIN`. | -| `--seed` | integer | `1` | Deterministic seed for the scratch world's guest initializer. | -| `--input` | text | — (none) | Input to send to the scratch world after launch, as the dev guest; repeatable, in order. The view is reported after each input. | -| `--fixture` | file path | — (none) | Fixture to replay against the compiled candidate before launch; repeatable, in order. A fixture whose replayed records mismatch its recorded expectation blocks promotion: the candidate is not launched and the command fails. Fixtures recorded under an earlier module hash still replay (the cross-module regression mode) and the report says so. | -| `--fuzz` | file path | — (none) | Deterministic fuzz declaration file: a bounded, versioned JSON file naming a generated input alphabet and the invariants the compiled candidate must hold. Given, the command compiles the candidate and runs a fuzz campaign instead of launching a session. | -| `--fuzz-seed` | integer | `42` | Seed for the fuzz campaign's input generator. The same declaration, seed and case budget reproduce the same input sequences and the same first failure. | -| `--fuzz-cases` | integer | `32` | Bounded fuzz case budget. Cases are generated input sequences, each applied to a fresh scratch world. | -| `--watch` | switch | off | Watch the app's declared sources and hot-swap each debounced change into the scratch world. A failed or stale candidate leaves the last-good program running. | -| `--watch-max-cycles` | integer | `1000` | Bounded watch poll budget; the session ends on its own after this many polls. | -| `--watch-debounce-ms` | integer (milliseconds) | `150` | Debounce window for watch polls; change events inside the window coalesce into one candidate. | +| Flag | Argument | Default | Meaning | +| --------------------- | ---------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `` | directory path | required | App directory holding the app's `main.roc` and its sibling `.roc` sources. | +| `--platform` | directory | the platform path `main.roc` declares, resolved against the app directory | World platform directory (or its `platform.roc` file). | +| `--roc` | binary | `ID_ROC_BIN`, then the bundled toolchain lookup the host compiler uses | Roc compiler binary. This flag has no clap environment fallback of its own; the default resolution consults `ID_ROC_BIN`. | +| `--seed` | integer | `1` | Deterministic seed for the scratch world's guest initializer. | +| `--input` | text | — (none) | Input to send to the scratch world after launch, as the dev guest; repeatable, in order. The view is reported after each input. | +| `--fixture` | file path | — (none) | Fixture to replay against the compiled candidate before launch; repeatable, in order. A fixture whose replayed records mismatch its recorded expectation blocks promotion: the candidate is not launched and the command fails. Fixtures recorded under an earlier module hash still replay (the cross-module regression mode) and the report says so. | +| `--fuzz` | file path | — (none) | Deterministic fuzz declaration file: a bounded, versioned JSON file naming a generated input alphabet and the invariants the compiled candidate must hold. Given, the command compiles the candidate and runs a fuzz campaign instead of launching a session. | +| `--fuzz-seed` | integer | `42` | Seed for the fuzz campaign's input generator. The same declaration, seed and case budget reproduce the same input sequences and the same first failure. | +| `--fuzz-cases` | integer | `32` | Bounded fuzz case budget. Cases are generated input sequences, each applied to a fresh scratch world. | +| `--watch` | switch | off | Watch the app's declared sources and hot-swap each debounced change into the scratch world. A failed or stale candidate leaves the last-good program running. | +| `--watch-max-cycles` | integer | `1000` | Bounded watch poll budget; the session ends on its own after this many polls. | +| `--watch-debounce-ms` | integer (milliseconds) | `150` | Debounce window for watch polls; change events inside the window coalesce into one candidate. | Example — compile a toy app, launch it, and send two inputs: @@ -281,11 +281,11 @@ Shows a world's capabilities. The change form (`--grant`, `--revoke`, `--ceiling id world caps [--capability ] [--admin-token ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--capability` | capability string | — (env `ID_WORLD_CAPABILITY`) | A guest capability. Sufficient on its own for the read form. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Optional for the read form. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------ | ------------------------------------------------------------ | +| `` | 64 hex characters | required | The host's node ID. | +| `--capability` | capability string | — (env `ID_WORLD_CAPABILITY`) | A guest capability. Sufficient on its own for the read form. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret. Optional for the read form. | Behaviour: with no `--grant`, `--revoke` or `--ceiling`, the command prints what the world has granted, what its program wants, and what it has used. It needs only a guest capability. @@ -306,11 +306,11 @@ Views a world's requested execution profile bounds. The write form (any limit fl id world profile [--capability ] [--admin-token ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--capability` | capability string | — (env `ID_WORLD_CAPABILITY`) | A guest capability; sufficient to inspect the profile. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret; the alternative credential for the read form. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------ | ---------------------------------------------------------------------- | +| `` | 64 hex characters | required | The host's node ID. | +| `--capability` | capability string | — (env `ID_WORLD_CAPABILITY`) | A guest capability; sufficient to inspect the profile. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | The host's admin secret; the alternative credential for the read form. | Behaviour: with no limit flag, the command prints the current persisted profile. It requires either `--admin-token` or a guest `--capability`. @@ -331,10 +331,10 @@ Scaffolds a new Roc world app directory. Local only; no host is contacted. id world new [--name ] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required | Directory to create. It must be absent or empty. | -| `--name` | string | `world` | App name used in the README and the Wasm output. | +| Flag | Argument | Default | Meaning | +| -------- | -------------- | -------- | ------------------------------------------------ | +| `` | directory path | required | Directory to create. It must be absent or empty. | +| `--name` | string | `world` | App name used in the README and the Wasm output. | Behaviour: writes `main.roc`, `build.sh` and `README.md` into the directory. The platform path in the scaffold points at `../roc-world/platform.roc`, so create the directory next to a checkout of the `examples/roc-world` platform. @@ -354,13 +354,13 @@ Forks a durable world on disk into a new world. Local only; no host is contacted id world fork [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required | Directory of the world to fork (the one holding `journal.jsonl`). | -| `` | directory path | required | Directory to create for the fork. It must be absent or empty. | -| `--name` | string (`a-z`, `0-9`, `-`, `_`) | destination directory's name | The new world's ID. The default is the ID a host serving that directory will open it under. | -| `--template` | switch | off | Mark the fork reusable as a template, recorded in its provenance (see `provenance` below). | -| `--json` | switch | off | Print one JSON object instead of text lines. | +| Flag | Argument | Default | Meaning | +| -------------- | ------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------- | +| `` | directory path | required | Directory of the world to fork (the one holding `journal.jsonl`). | +| `` | directory path | required | Directory to create for the fork. It must be absent or empty. | +| `--name` | string (`a-z`, `0-9`, `-`, `_`) | destination directory's name | The new world's ID. The default is the ID a host serving that directory will open it under. | +| `--template` | switch | off | Mark the fork reusable as a template, recorded in its provenance (see `provenance` below). | +| `--json` | switch | off | Print one JSON object instead of text lines. | Behaviour: copies the source world's journal and modules into the destination directory under a new world ID and records the fork provenance in the new journal. Only the journal and the modules are copied: no seed secret or other source file comes along. On success it prints `forked `. @@ -380,10 +380,10 @@ Prints a durable world's provenance from its journal. Local only; no host is con id world provenance [--json] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required | Directory of the world to inspect (the one holding `journal.jsonl`). | -| `--json` | switch | off | Print one JSON object instead of text lines. | +| Flag | Argument | Default | Meaning | +| -------- | -------------- | -------- | -------------------------------------------------------------------- | +| `` | directory path | required | Directory of the world to inspect (the one holding `journal.jsonl`). | +| `--json` | switch | off | Print one JSON object instead of text lines. | Behaviour: prints the world's ID and, for a fork, the world it was forked from, the module hash at the fork point, and whether it was marked a template. @@ -403,11 +403,11 @@ Prints a durable world's owner report: joins, on-disk storage, and which facts a id world owner [OPTIONS] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | directory path | required | Directory of the world to report on (the one holding `journal.jsonl`). | -| `--since` | duration, e.g. `12h`, `7d` | `7d` | The window the report covers, ending now. | -| `--json` | switch | off | Print one JSON object (schema version `1`) instead of text. | +| Flag | Argument | Default | Meaning | +| --------- | -------------------------- | -------- | ---------------------------------------------------------------------- | +| `` | directory path | required | Directory of the world to report on (the one holding `journal.jsonl`). | +| `--since` | duration, e.g. `12h`, `7d` | `7d` | The window the report covers, ending now. | +| `--json` | switch | off | Print one JSON object (schema version `1`) instead of text. | Example: @@ -425,11 +425,11 @@ Lists the worlds a host serves. The admin form is in [World commands: administer id world list [--json] ``` -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `` | 64 hex characters | required | The host's node ID. | -| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | Optional. Omit it to read the public directory; give it for the admin listing. | -| `--json` | switch | off | Print one JSON object instead of tab-separated lines. | +| Flag | Argument | Default | Meaning | +| --------------- | ----------------- | ------------------------------ | ------------------------------------------------------------------------------ | +| `` | 64 hex characters | required | The host's node ID. | +| `--admin-token` | token | — (env `ID_WORLD_ADMIN_TOKEN`) | Optional. Omit it to read the public directory; give it for the admin listing. | +| `--json` | switch | off | Print one JSON object instead of tab-separated lines. | Behaviour: without `--admin-token` this reads the host's public directory: world names, loaded state and presence counts. It needs no credential. diff --git a/pkgs/id/book/reference/cli.md b/pkgs/id/book/reference/cli.md index 11af006e2b..203ae35326 100644 --- a/pkgs/id/book/reference/cli.md +++ b/pkgs/id/book/reference/cli.md @@ -26,14 +26,14 @@ Three invocation rules decide what a bare or lightly-flagged `id` does: The six global flags are defined with clap `global = true`: each one is accepted at the top level and on every subcommand, before or after the subcommand name. Every command also accepts `-h`/`--help`, and the top level accepts `-V`/`--version`. -| Flag | Argument | Default | Meaning | -|---|---|---|---| -| `--debug` | none (switch) | off | Enable debug logging. Takes precedence over `--log-level` and over every logging environment variable. | -| `--log-level` | `LEVEL` | none | Set the log level. The help text lists `trace`, `debug`, `info`, `warn`, `error`; the value is not a clap value-enum, so any string reaches the tracing filter. Overrides the logging environment variables, but not `--debug`. | -| `-d`, `--data-dir` | `DIR` | current directory | Base directory for `.iroh-store`, `.iroh-key` and `.iroh-serve.lock`. Created if it does not exist. The process changes its working directory into `DIR` at startup. Conflicts with `--new`. | -| `--new` | `NAME` (optional) | none | Create a new instance directory `.iroh//` under the current directory and change into it. A missing value means the empty string, which generates a random 8-hex-character name. Fails if the directory already exists. Conflicts with `--data-dir`. | -| `--groups-log` | `FILE` | `groups.jsonl` in the data directory | The group log read and appended to by `group`, `delegate` and `revoke`. A relative path is resolved relative to the data directory. | -| `--event-store` | `DIR` | `events` in the data directory | The event store read and appended to by `doc`, `claim` and `writer-sets`. A relative path is resolved relative to the data directory. | +| Flag | Argument | Default | Meaning | +| ------------------ | ----------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--debug` | none (switch) | off | Enable debug logging. Takes precedence over `--log-level` and over every logging environment variable. | +| `--log-level` | `LEVEL` | none | Set the log level. The help text lists `trace`, `debug`, `info`, `warn`, `error`; the value is not a clap value-enum, so any string reaches the tracing filter. Overrides the logging environment variables, but not `--debug`. | +| `-d`, `--data-dir` | `DIR` | current directory | Base directory for `.iroh-store`, `.iroh-key` and `.iroh-serve.lock`. Created if it does not exist. The process changes its working directory into `DIR` at startup. Conflicts with `--new`. | +| `--new` | `NAME` (optional) | none | Create a new instance directory `.iroh//` under the current directory and change into it. A missing value means the empty string, which generates a random 8-hex-character name. Fails if the directory already exists. Conflicts with `--data-dir`. | +| `--groups-log` | `FILE` | `groups.jsonl` in the data directory | The group log read and appended to by `group`, `delegate` and `revoke`. A relative path is resolved relative to the data directory. | +| `--event-store` | `DIR` | `events` in the data directory | The event store read and appended to by `doc`, `claim` and `writer-sets`. A relative path is resolved relative to the data directory. | Behaviour notes: @@ -72,12 +72,12 @@ After resolution, `src/main.rs` appends fixed per-module filters that cap a fixe Four further environment variables configure the log output itself. They are read by hand in `src/main.rs` and `src/structured_logging.rs`; none of them is a clap argument. -| Variable | Values | Default | Meaning | -|---|---|---|---| -| `ID_LOG_FORMAT` | `text`, `json` | `text` | Output format. `json` emits one JSON object per line, with span and trace context when present. | -| `ID_LOG_FILE` | path | none (stderr only) | A second destination: events are appended to this file in the same format as the console destination, without ANSI escapes. No size or retention limit is imposed; the writer follows rename-and-create external rotation and must not be used with `copytruncate`. | -| `ID_LOG_FILE_LEVEL` | filter | the console filter | An independent filter for the file destination; it accepts anything a tracing `EnvFilter` accepts, for example `debug` or `id=trace,iroh=info`. | -| `ID_LOG_TZ` | IANA name, `UTC`, `local`, or a fixed offset such as `+05:30` | host local timezone | Timezone for log timestamps. Unset and `local` both mean the host local zone. | +| Variable | Values | Default | Meaning | +| ------------------- | ------------------------------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID_LOG_FORMAT` | `text`, `json` | `text` | Output format. `json` emits one JSON object per line, with span and trace context when present. | +| `ID_LOG_FILE` | path | none (stderr only) | A second destination: events are appended to this file in the same format as the console destination, without ANSI escapes. No size or retention limit is imposed; the writer follows rename-and-create external rotation and must not be used with `copytruncate`. | +| `ID_LOG_FILE_LEVEL` | filter | the console filter | An independent filter for the file destination; it accepts anything a tracing `EnvFilter` accepts, for example `debug` or `id=trace,iroh=info`. | +| `ID_LOG_TZ` | IANA name, `UTC`, `local`, or a fixed offset such as `+05:30` | host local timezone | Timezone for log timestamps. Unset and `local` both mean the host local zone. | Failure behaviour for these variables is warn-and-continue: an unrecognised `ID_LOG_FORMAT` value prints `warning: ID_LOG_FORMAT value not recognized; logs use text format` on stderr and logging continues in text format; an unrecognised `ID_LOG_TZ` value prints `warning: ID_LOG_TZ value not recognized; log timestamps use UTC` and timestamps fall back to UTC; a log file that cannot be opened prints a warning naming the path and the error, and logging continues to stderr only. @@ -85,12 +85,12 @@ Failure behaviour for these variables is warn-and-continue: an unrecognised `ID_ `main` returns an `anyhow::Result<()>`, and the exit code follows from that single fact plus clap's own error handling: -| Outcome | Exit code | Output | -|---|---|---| -| Success | 0 | The command's normal output. | -| `--help`, `help `, `--version` | 0 | Help or version text on stdout. | -| Handler error (any error returned by a command) | 1 | `Error: ` on stderr. | -| Clap parse error (unknown subcommand or flag, missing required argument, conflicting flags, invalid value) | 2 | `error: …` plus usage on stderr. | +| Outcome | Exit code | Output | +| ---------------------------------------------------------------------------------------------------------- | --------- | ---------------------------------- | +| Success | 0 | The command's normal output. | +| `--help`, `help `, `--version` | 0 | Help or version text on stdout. | +| Handler error (any error returned by a command) | 1 | `Error: ` on stderr. | +| Clap parse error (unknown subcommand or flag, missing required argument, conflicting flags, invalid value) | 2 | `error: …` plus usage on stderr. | There is no per-command exit-code table and no `process::exit` call anywhere in the `id` binary or in `id-cli`: every handler error exits 1, whatever the command. Value-parser failures are clap errors and exit 2; for example `--first 0` fails with `zero is not a valid limit: use at least 1`. @@ -113,17 +113,17 @@ $ echo $? The parser defines 32 top-level commands and 113 leaf commands. The reference chapters divide them as follows: -| Family | Commands | Chapter | -|---|---|---| -| File storage and retrieval | `put`, `put-hash`, `send`, `get`, `get-hash`, `cat`, `list`, `migrate-tags` | [File commands: put, get, find and kin](cli-files.md) | -| Search | `find`, `search`, `show`, `peek` | [File commands: put, get, find and kin](cli-files.md) | -| Tags | `tag set`, `tag del`, `tag list`, `tag search` | [The tag family](cli-tags.md) | -| Hosting and publications | `serve`, `publish`, `unpublish`, `publications` | [serve and publications](cli-serve.md) | -| Worlds (playing) | `world invite`, `world join`, `world records`, `world mirror`, `world download`, and kin | [World commands: joining and playing](cli-worlds.md) | -| Worlds (administering) | `world install`, `world compile`, `world caps`, `world doctor`, and kin | [World commands: administering and verifying](cli-worlds-admin.md) | -| Gallery, match-audit, walk | `gallery …`, `match-audit …`, `walk …` | [Gallery, match-audit and walk](cli-gallery-walk.md) | -| Groups, documents, claims, keys | `group …`, `delegate`, `revoke`, `doc …`, `claim …`, `writer-sets …`, `id`, `key …`, `keyset …`, `peers` | [Groups, documents, claims and keys](cli-groups-identity.md) | -| Interactive shell | `repl` (alias `shell`), bare `id` | [The interactive REPL](repl.md) | -| Desktop shell | the separate `id-native-shell` binary | [id-native-shell](native-shell.md) | +| Family | Commands | Chapter | +| ------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | +| File storage and retrieval | `put`, `put-hash`, `send`, `get`, `get-hash`, `cat`, `list`, `migrate-tags` | [File commands: put, get, find and kin](cli-files.md) | +| Search | `find`, `search`, `show`, `peek` | [File commands: put, get, find and kin](cli-files.md) | +| Tags | `tag set`, `tag del`, `tag list`, `tag search` | [The tag family](cli-tags.md) | +| Hosting and publications | `serve`, `publish`, `unpublish`, `publications` | [serve and publications](cli-serve.md) | +| Worlds (playing) | `world invite`, `world join`, `world records`, `world mirror`, `world download`, and kin | [World commands: joining and playing](cli-worlds.md) | +| Worlds (administering) | `world install`, `world compile`, `world caps`, `world doctor`, and kin | [World commands: administering and verifying](cli-worlds-admin.md) | +| Gallery, match-audit, walk | `gallery …`, `match-audit …`, `walk …` | [Gallery, match-audit and walk](cli-gallery-walk.md) | +| Groups, documents, claims, keys | `group …`, `delegate`, `revoke`, `doc …`, `claim …`, `writer-sets …`, `id`, `key …`, `keyset …`, `peers` | [Groups, documents, claims and keys](cli-groups-identity.md) | +| Interactive shell | `repl` (alias `shell`), bare `id` | [The interactive REPL](repl.md) | +| Desktop shell | the separate `id-native-shell` binary | [id-native-shell](native-shell.md) | Cross-cutting configuration — `defaults.json`, the full environment variable list, and feature-gated builds — is covered in [Configuration and environment](configuration.md). The on-disk layout behind `--data-dir`, `--groups-log` and `--event-store` is covered in [Data stores and schemas](data-stores.md). diff --git a/pkgs/id/book/reference/configuration.md b/pkgs/id/book/reference/configuration.md index 94e9778607..00cbab7b21 100644 --- a/pkgs/id/book/reference/configuration.md +++ b/pkgs/id/book/reference/configuration.md @@ -4,51 +4,51 @@ Source: https://github.com/developing-today/code/blob/main/pkgs/id/crates/id-con ID has five distinct configuration surfaces, and they are not interchangeable: -| Surface | Form | Who reads it | -|---|---|---| -| Environment variables | Process environment, 66 named variables | The `id` binary, its crates, benches and tests | -| The `id-config` v1 document | JSON, parsed in memory | The `id-config` crate; no file location, no loader | -| The server-config file | TOML, operator-chosen path | `id serve --server-config ` | -| Embedded `defaults.json` | JSON, compiled into the binary | Serve/peers discovery and web bindings | -| `[interfaces.web]` in `app.toml` | TOML, per app | The web layer, for one app's route and socket | +| Surface | Form | Who reads it | +| -------------------------------- | --------------------------------------- | -------------------------------------------------- | +| Environment variables | Process environment, 66 named variables | The `id` binary, its crates, benches and tests | +| The `id-config` v1 document | JSON, parsed in memory | The `id-config` crate; no file location, no loader | +| The server-config file | TOML, operator-chosen path | `id serve --server-config ` | +| Embedded `defaults.json` | JSON, compiled into the binary | Serve/peers discovery and web bindings | +| `[interfaces.web]` in `app.toml` | TOML, per app | The web layer, for one app's route and socket | ## Environment variables: the complete table -66 named variables are read across the tree: **29 production/build**, **20 bench**, **17 test**. The production set is given in full below, with read site and the behaviour when the variable is unset. Bench and test variables are summarised by family. A further six hosted-Worker bindings, one dynamic credential scheme, and three variables the process *writes* follow the tables; none of those are counted in the 66. +66 named variables are read across the tree: **29 production/build**, **20 bench**, **17 test**. The production set is given in full below, with read site and the behaviour when the variable is unset. Bench and test variables are summarised by family. A further six hosted-Worker bindings, one dynamic credential scheme, and three variables the process _writes_ follow the tables; none of those are counted in the 66. ### Production and build variables (29) -| # | Name | Read site | Default behaviour when unset | -|---|---|---|---| -| 1 | `ID_WEB_TOKEN` | clap env for `--web-token`, `crates/id-cli/src/cli/mod.rs` | No web gate token; the web UI is ungated (and `serve` warns). See [The web UI: pages and HTTP API](web-ui.md). | -| 2 | `ID_WEB_COOKIE_SECURE` | clap env for `--web-cookie-secure`, `cli/mod.rs` | `false`. | -| 3 | `ID_WEB_MAX_IDENTITIES` | `crates/id-web/src/identity.rs` (`MAX_IDENTITIES_ENV`) | `10000`. The value `none` means unbounded. `0` or an unparsable value warns and falls back to `10000`. | -| 4 | `ID_WORLD_ADMIN_TOKEN` | clap env in `cli/mod.rs` and throughout `cli/world.rs` (values hidden) | World admin frames and invites are disabled unless the flag is given. | -| 5 | `ID_WORLD` | clap env in `cli/world.rs`, on many subcommands | Unset. One subcommand (`world replica`) defaults it to `lobby`. | -| 6 | `ID_WORLD_CAPABILITY` | clap env in `cli/world.rs` (values hidden) | The capability must come from the `--capability` flag. | -| 7 | `ID_WORLD_SOURCE_ONLY` | clap env for `--world-source-only`, `cli/mod.rs` | `false`. | -| 8 | `ID_GALLERY_DIR` | clap env in `cli/mod.rs` and `cli/gallery.rs` | No gallery is served. | -| 9 | `ID_GALLERY_ACCEPT_PUBLISH` | clap env, `cli/mod.rs` | `false`. Requires a gallery directory. | -| 10 | `ID_ROC_BIN` | clap env in `cli/mod.rs` and `cli/world.rs`; `env::var` in `id-web` world bridge, `id-worlds` compile, and `serve` | Falls back to a `roc` binary found on `PATH` or in roc-home candidates. | -| 11 | `ID_ROC_PLATFORM` | clap env in `cli/mod.rs` and `cli/world.rs`; `env::var` in world commands and `serve` | Falls back to `./examples/roc-world`. | -| 12 | `ID_WORLD_COMPILE_CACHE_DIR` | `crates/id-cli/src/commands/serve.rs` | Unset or empty: the shared compiled-world cache is disabled. The cache is opt-in. | -| 13 | `ID_WORLD_COMPILE_CACHE_LRU_BYTES` | `commands/serve.rs` | The `id-worlds` cache default, 2 GiB. An unparsable value falls back to the default. | -| 14 | `ID_APPS_DIR` | `commands/serve.rs` (`var_os`) | Falls back to the built-in apps root. | -| 15 | `ID_PUBLICATIONS_FILE` | `crates/id-cli/src/publications.rs` (`var_os`) | Falls back to the default publications file path. | -| 16 | `ID_SHELL_FILE_READ_ROOT` | `crates/id-native-shell/src/main.rs` | The native shell file-read root is not additionally restricted or configured by environment. See [id-native-shell](native-shell.md). | -| 17 | `RUST_LOG` | `src/main.rs` | When no CLI log level is set, the filter is `debug` plus noisy-module filters. Log-level resolution order is in [The id command line](cli.md). | -| 18 | `LOG_LEVEL` | `src/main.rs` | Participates in log-level resolution; unset means ignored. | -| 19 | `DEBUG` | `src/main.rs` | A truthy value raises the log level in resolution; unset means ignored. | -| 20 | `ID_LOG_FORMAT` | `src/main.rs` (structured logging) | Historical plain-text stderr logging. Recognised values: `text`, `json`. | -| 21 | `ID_LOG_FILE` | `src/main.rs` | No log file. | -| 22 | `ID_LOG_FILE_LEVEL` | `src/main.rs` | The log file uses the main level. | -| 23 | `ID_LOG_TZ` | `src/main.rs` | The default timestamp timezone. | -| 24 | `HOME` | `id-worlds` compile, world commands, CLI integration test helper | Used for roc-home candidates and home resolution; the test falls back to `/home/user`. | -| 25 | `PATH` | `id-worlds` compile and world doctor (`split_paths`) | An empty path list. | -| 26 | `TIGERBEETLE_POC_BINARY` | `src/currency_poc/harness.rs` (`BINARY_ENV`, `var_os`) | Proof-of-concept harness only: no external TigerBeetle binary. | -| 27 | `CARGO_MANIFEST_DIR` | `build.rs`, plus compile-time `env!` in tests and helpers | `"."`. | -| 28 | `CARGO_FEATURE_WEB` | `build.rs` | Unset means the web feature is off and the build script skips the web asset step. | -| 29 | `PROFILE` | `build.rs` | `""`. | +| # | Name | Read site | Default behaviour when unset | +| --- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | `ID_WEB_TOKEN` | clap env for `--web-token`, `crates/id-cli/src/cli/mod.rs` | No web gate token; the web UI is ungated (and `serve` warns). See [The web UI: pages and HTTP API](web-ui.md). | +| 2 | `ID_WEB_COOKIE_SECURE` | clap env for `--web-cookie-secure`, `cli/mod.rs` | `false`. | +| 3 | `ID_WEB_MAX_IDENTITIES` | `crates/id-web/src/identity.rs` (`MAX_IDENTITIES_ENV`) | `10000`. The value `none` means unbounded. `0` or an unparsable value warns and falls back to `10000`. | +| 4 | `ID_WORLD_ADMIN_TOKEN` | clap env in `cli/mod.rs` and throughout `cli/world.rs` (values hidden) | World admin frames and invites are disabled unless the flag is given. | +| 5 | `ID_WORLD` | clap env in `cli/world.rs`, on many subcommands | Unset. One subcommand (`world replica`) defaults it to `lobby`. | +| 6 | `ID_WORLD_CAPABILITY` | clap env in `cli/world.rs` (values hidden) | The capability must come from the `--capability` flag. | +| 7 | `ID_WORLD_SOURCE_ONLY` | clap env for `--world-source-only`, `cli/mod.rs` | `false`. | +| 8 | `ID_GALLERY_DIR` | clap env in `cli/mod.rs` and `cli/gallery.rs` | No gallery is served. | +| 9 | `ID_GALLERY_ACCEPT_PUBLISH` | clap env, `cli/mod.rs` | `false`. Requires a gallery directory. | +| 10 | `ID_ROC_BIN` | clap env in `cli/mod.rs` and `cli/world.rs`; `env::var` in `id-web` world bridge, `id-worlds` compile, and `serve` | Falls back to a `roc` binary found on `PATH` or in roc-home candidates. | +| 11 | `ID_ROC_PLATFORM` | clap env in `cli/mod.rs` and `cli/world.rs`; `env::var` in world commands and `serve` | Falls back to `./examples/roc-world`. | +| 12 | `ID_WORLD_COMPILE_CACHE_DIR` | `crates/id-cli/src/commands/serve.rs` | Unset or empty: the shared compiled-world cache is disabled. The cache is opt-in. | +| 13 | `ID_WORLD_COMPILE_CACHE_LRU_BYTES` | `commands/serve.rs` | The `id-worlds` cache default, 2 GiB. An unparsable value falls back to the default. | +| 14 | `ID_APPS_DIR` | `commands/serve.rs` (`var_os`) | Falls back to the built-in apps root. | +| 15 | `ID_PUBLICATIONS_FILE` | `crates/id-cli/src/publications.rs` (`var_os`) | Falls back to the default publications file path. | +| 16 | `ID_SHELL_FILE_READ_ROOT` | `crates/id-native-shell/src/main.rs` | The native shell file-read root is not additionally restricted or configured by environment. See [id-native-shell](native-shell.md). | +| 17 | `RUST_LOG` | `src/main.rs` | When no CLI log level is set, the filter is `debug` plus noisy-module filters. Log-level resolution order is in [The id command line](cli.md). | +| 18 | `LOG_LEVEL` | `src/main.rs` | Participates in log-level resolution; unset means ignored. | +| 19 | `DEBUG` | `src/main.rs` | A truthy value raises the log level in resolution; unset means ignored. | +| 20 | `ID_LOG_FORMAT` | `src/main.rs` (structured logging) | Historical plain-text stderr logging. Recognised values: `text`, `json`. | +| 21 | `ID_LOG_FILE` | `src/main.rs` | No log file. | +| 22 | `ID_LOG_FILE_LEVEL` | `src/main.rs` | The log file uses the main level. | +| 23 | `ID_LOG_TZ` | `src/main.rs` | The default timestamp timezone. | +| 24 | `HOME` | `id-worlds` compile, world commands, CLI integration test helper | Used for roc-home candidates and home resolution; the test falls back to `/home/user`. | +| 25 | `PATH` | `id-worlds` compile and world doctor (`split_paths`) | An empty path list. | +| 26 | `TIGERBEETLE_POC_BINARY` | `src/currency_poc/harness.rs` (`BINARY_ENV`, `var_os`) | Proof-of-concept harness only: no external TigerBeetle binary. | +| 27 | `CARGO_MANIFEST_DIR` | `build.rs`, plus compile-time `env!` in tests and helpers | `"."`. | +| 28 | `CARGO_FEATURE_WEB` | `build.rs` | Unset means the web feature is off and the build script skips the web asset step. | +| 29 | `PROFILE` | `build.rs` | `""`. | Notes on the logging set: an unrecognised `ID_LOG_FORMAT` or `ID_LOG_TZ` value, or a log file that cannot be opened, warns on stderr and logging continues without that piece. Blank flag and environment values count as unset in log-level resolution. @@ -56,33 +56,33 @@ Notes on the logging set: an unrecognised `ID_LOG_FORMAT` or `ID_LOG_TZ` value, All are read only by `benches/world_bench.rs`. -| Family | Variables | Default behaviour | -|---|---|---| -| Guest burn / frames | `ID_BENCH_GUEST_BURN_CONCURRENCY`, `ID_BENCH_FRAME_EVENTS` | Helper-parsed; unset means the committed bench value. | -| Provenance | `ID_BENCH_MACHINE_CLASS` (default `fleet-laptop`), `ID_BENCH_GIT_SHA` (falls back to `GITHUB_SHA`, then a computed value), `GITHUB_SHA`, `ID_BENCH_TOOLCHAIN` (default `unknown`), `ID_BENCH_RESULTS` (default `results.jsonl`) | As stated. | -| Many-worlds | `ID_BENCH_MW_IDLE_WORLDS` (`1000`), `ID_BENCH_MW_ACTIVE_WORLDS` (`100`), `ID_BENCH_MW_EVENTS_PER_SECOND` (`20`), `ID_BENCH_MW_DURATION_SECS` (`10`) | Parsed by one helper with the stated literal defaults. | -| Stress | `ID_BENCH_STRESS_TIER`, `ID_BENCH_STRESS_SEED`, `ID_BENCH_STRESS_OUT`, `ID_BENCH_STRESS_MEM_PART` (`all`), `ID_BENCH_STRESS_IDLE_WORLDS`, `ID_BENCH_STRESS_ACTIVE_WORLDS`, `ID_BENCH_STRESS_ACTIVE_EVENTS`, `ID_BENCH_STRESS_HOT_EVENTS`, `ID_BENCH_STRESS_HOT_MEMBERS` | Parsed by one helper with a per-tier default. | +| Family | Variables | Default behaviour | +| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | +| Guest burn / frames | `ID_BENCH_GUEST_BURN_CONCURRENCY`, `ID_BENCH_FRAME_EVENTS` | Helper-parsed; unset means the committed bench value. | +| Provenance | `ID_BENCH_MACHINE_CLASS` (default `fleet-laptop`), `ID_BENCH_GIT_SHA` (falls back to `GITHUB_SHA`, then a computed value), `GITHUB_SHA`, `ID_BENCH_TOOLCHAIN` (default `unknown`), `ID_BENCH_RESULTS` (default `results.jsonl`) | As stated. | +| Many-worlds | `ID_BENCH_MW_IDLE_WORLDS` (`1000`), `ID_BENCH_MW_ACTIVE_WORLDS` (`100`), `ID_BENCH_MW_EVENTS_PER_SECOND` (`20`), `ID_BENCH_MW_DURATION_SECS` (`10`) | Parsed by one helper with the stated literal defaults. | +| Stress | `ID_BENCH_STRESS_TIER`, `ID_BENCH_STRESS_SEED`, `ID_BENCH_STRESS_OUT`, `ID_BENCH_STRESS_MEM_PART` (`all`), `ID_BENCH_STRESS_IDLE_WORLDS`, `ID_BENCH_STRESS_ACTIVE_WORLDS`, `ID_BENCH_STRESS_ACTIVE_EVENTS`, `ID_BENCH_STRESS_HOT_EVENTS`, `ID_BENCH_STRESS_HOT_MEMBERS` | Parsed by one helper with a per-tier default. | ### Test variables (17), by family Read only in tests, test helpers, or test configuration. None affects a production run. -| Variables | Where | -|---|---| -| `ID_FED_NODE_B` | `id-sync` substrate transport test; unset means the test peer B is absent. | -| `BAKEOFF_RESULTS` | `id-store` graph-encoding bakeoff; unset means no results file is written. | -| `CARGO` | `id-store` store-traits test; default `cargo`. | -| `SCREEN_PARITY_GENERATE` | `id-core` screen parity test; unset means the parity corpus is not regenerated. | -| `ID_TEST_FAKE_SH` | `id-worlds` compile test helper, also set by `flake.nix`; unset means the real shell. | -| `TERRITORY_WASM` | `id-worlds` sandbox test; unset means the test module is not loaded. | -| `ID_IDENTITY_PROBE_PATH` | `id-web` identity tests; unset means the probe is not run. | -| `WORKER_POC_REFERENCE_OUT` | Worker PoC reference test; unset means the reference JSONL is not written. | -| `PROPTEST_CASES`, `PROPTEST_RNG_SEED` | Property tests; unset means the proptest default case count and a random seed. | -| `ID_BINARY`, `ID_TEST_EXAMPLES_DIR`, `ID_TEST_APPS_DIR` | CLI integration tests; unset means the built binary path and the in-tree examples/apps directories. | -| `ID_TUPLE_FUZZ_CASES` | Tuple property tests; unset means the default case count. | -| `ID_E2E_WORLD_ADMIN_TOKEN` | Playwright config (TypeScript); unset means the config-file fallback token. | -| `UPDATE_EXPORT_FIXTURE` | Hosted-worker export test (TypeScript); unset means the fixture is not regenerated. | -| Playwright runner variables: `TEST_PORT` (`4173`), `NIX_BUILD_TOP`, `PLAYWRIGHT_VM_TEST`, `CHROMIUM_BASE_URL`, `FIREFOX_BASE_URL`, `CI` | Read by `e2e/playwright.config.ts`, as coded there. | +| Variables | Where | +| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `ID_FED_NODE_B` | `id-sync` substrate transport test; unset means the test peer B is absent. | +| `BAKEOFF_RESULTS` | `id-store` graph-encoding bakeoff; unset means no results file is written. | +| `CARGO` | `id-store` store-traits test; default `cargo`. | +| `SCREEN_PARITY_GENERATE` | `id-core` screen parity test; unset means the parity corpus is not regenerated. | +| `ID_TEST_FAKE_SH` | `id-worlds` compile test helper, also set by `flake.nix`; unset means the real shell. | +| `TERRITORY_WASM` | `id-worlds` sandbox test; unset means the test module is not loaded. | +| `ID_IDENTITY_PROBE_PATH` | `id-web` identity tests; unset means the probe is not run. | +| `WORKER_POC_REFERENCE_OUT` | Worker PoC reference test; unset means the reference JSONL is not written. | +| `PROPTEST_CASES`, `PROPTEST_RNG_SEED` | Property tests; unset means the proptest default case count and a random seed. | +| `ID_BINARY`, `ID_TEST_EXAMPLES_DIR`, `ID_TEST_APPS_DIR` | CLI integration tests; unset means the built binary path and the in-tree examples/apps directories. | +| `ID_TUPLE_FUZZ_CASES` | Tuple property tests; unset means the default case count. | +| `ID_E2E_WORLD_ADMIN_TOKEN` | Playwright config (TypeScript); unset means the config-file fallback token. | +| `UPDATE_EXPORT_FIXTURE` | Hosted-worker export test (TypeScript); unset means the fixture is not regenerated. | +| Playwright runner variables: `TEST_PORT` (`4173`), `NIX_BUILD_TOP`, `PLAYWRIGHT_VM_TEST`, `CHROMIUM_BASE_URL`, `FIREFOX_BASE_URL`, `CI` | Read by `e2e/playwright.config.ts`, as coded there. | ### Hosted-Worker bindings (not process environment) @@ -96,11 +96,11 @@ One reader names no fixed variable. The `EnvCredentialResolver` in `src/foreign_ Three variables are set by ID, not read by it. When `id serve --world-mail-command ` runs a confirmation-mail command, the child process receives: -| Name | Content | -|---|---| -| `ID_MAIL_TO` | The recipient address for that confirmation. | -| `ID_MAIL_SUBJECT` | The confirmation subject. | -| `ID_MAIL_BODY` | The confirmation body. | +| Name | Content | +| ----------------- | -------------------------------------------- | +| `ID_MAIL_TO` | The recipient address for that confirmation. | +| `ID_MAIL_SUBJECT` | The confirmation subject. | +| `ID_MAIL_BODY` | The confirmation body. | These are set in `crates/id-directory/src/directory_mail.rs` during construction of the child's environment. That construction is the only production `set_var` path in the tree. @@ -112,43 +112,43 @@ The JSON Schema twin lives at `pkgs/id/config/id-config-v1.schema.json` and is k The document has **10 top-level keys and 29 leaf keys**. Every struct is `deny_unknown_fields`: an unknown key rejects the document. Validation is fail-closed throughout. -| Key | Type / values | Default / rule | -|---|---|---| -| `schema_version` | `u32` | **Required.** Must equal `1`, else the document is rejected with `UnsupportedSchemaVersion`. | -| `config_id` | string | **Required**, non-empty. | -| `revision` | `u64` | **Required.** | -| `mode` | `single-node` \| `hosted-tenant` \| `federated-relay` | **Required.** Seeds the behaviour defaults below. | -| `protocol_versions` | string array | **Required**, non-empty, duplicate-free. The resolved form is sorted. | -| `ceilings` | object | **Required.** Every field must be ≥ 1, else `ZeroCeiling`. | -| `ceilings.max_hops` | `u32` | Hard cap on relay hops. | -| `ceilings.max_bytes` | `u64` | Hard cap on a single-operation payload. | -| `ceilings.max_time_ms` | `u64` | Hard cap on single-operation wall-clock time. | -| `ceilings.max_fan_out` | `u32` | Hard cap on delivery targets. | -| `gates` | object | Default: all `true`. Setting any gate to `false` **rejects** the document with `FixedGateDisabled`. | -| `gates.signature_verification` | bool, const `true` | One of the five fixed gate IDs: `signature-verification`, `validation`, `replay-protection`, `authorization`, `tenant-scope`. Gates are mechanism, not behaviour. | -| `gates.validation` | bool, const `true` | As above. | -| `gates.replay_protection` | bool, const `true` | As above. | -| `gates.authorization` | bool, const `true` | As above. | -| `gates.tenant_scope` | bool, const `true` | As above. | -| `behavior` | object | Default: empty. Every field `None` means "inherit the previous plane". | -| `behavior.max_hops` | `u32`, optional | Must fit the applicable (possibly narrowed) ceiling. | -| `behavior.sync_scope` | `metadata` \| `full`, optional | — | -| `behavior.tier` | `cold` \| `warm` \| `hot`, optional | Tier labels never authorise access. | -| `overrides` | array of scoped overrides | Default `[]`. Applied in scope-name order. A duplicate scope rejects the document. | -| `overrides[].scope` | string | Required, non-empty. | -| `overrides[].ceilings` | object: `max_hops?`, `max_bytes?`, `max_time_ms?`, `max_fan_out?` | May only **narrow** a ceiling. Widening is rejected with `CeilingWidened`; it is never clamped. | -| `overrides[].behavior` | object | Same shape and rules as `behavior`. | -| `extensions` | map of string to JSON | Default `{}`. Keys must be namespaced, matching `^[^./\s]+([./][^./\s]+)+$` (for example `example.com/experiment`). Values are retained verbatim in the resolved output and are **never executed**. | +| Key | Type / values | Default / rule | +| ------------------------------ | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `schema_version` | `u32` | **Required.** Must equal `1`, else the document is rejected with `UnsupportedSchemaVersion`. | +| `config_id` | string | **Required**, non-empty. | +| `revision` | `u64` | **Required.** | +| `mode` | `single-node` \| `hosted-tenant` \| `federated-relay` | **Required.** Seeds the behaviour defaults below. | +| `protocol_versions` | string array | **Required**, non-empty, duplicate-free. The resolved form is sorted. | +| `ceilings` | object | **Required.** Every field must be ≥ 1, else `ZeroCeiling`. | +| `ceilings.max_hops` | `u32` | Hard cap on relay hops. | +| `ceilings.max_bytes` | `u64` | Hard cap on a single-operation payload. | +| `ceilings.max_time_ms` | `u64` | Hard cap on single-operation wall-clock time. | +| `ceilings.max_fan_out` | `u32` | Hard cap on delivery targets. | +| `gates` | object | Default: all `true`. Setting any gate to `false` **rejects** the document with `FixedGateDisabled`. | +| `gates.signature_verification` | bool, const `true` | One of the five fixed gate IDs: `signature-verification`, `validation`, `replay-protection`, `authorization`, `tenant-scope`. Gates are mechanism, not behaviour. | +| `gates.validation` | bool, const `true` | As above. | +| `gates.replay_protection` | bool, const `true` | As above. | +| `gates.authorization` | bool, const `true` | As above. | +| `gates.tenant_scope` | bool, const `true` | As above. | +| `behavior` | object | Default: empty. Every field `None` means "inherit the previous plane". | +| `behavior.max_hops` | `u32`, optional | Must fit the applicable (possibly narrowed) ceiling. | +| `behavior.sync_scope` | `metadata` \| `full`, optional | — | +| `behavior.tier` | `cold` \| `warm` \| `hot`, optional | Tier labels never authorise access. | +| `overrides` | array of scoped overrides | Default `[]`. Applied in scope-name order. A duplicate scope rejects the document. | +| `overrides[].scope` | string | Required, non-empty. | +| `overrides[].ceilings` | object: `max_hops?`, `max_bytes?`, `max_time_ms?`, `max_fan_out?` | May only **narrow** a ceiling. Widening is rejected with `CeilingWidened`; it is never clamped. | +| `overrides[].behavior` | object | Same shape and rules as `behavior`. | +| `extensions` | map of string to JSON | Default `{}`. Keys must be namespaced, matching `^[^./\s]+([./][^./\s]+)+$` (for example `example.com/experiment`). Values are retained verbatim in the resolved output and are **never executed**. | Field classes: mechanism fields are `schema_version`, `config_id`, `revision`, `protocol_versions`, `ceilings`, `gates`. Behaviour fields are `mode`, `behavior`, `overrides`, `extensions`. The `ResolvedConfig` adds `provenance`: for each behaviour field, one of `mode:`, `document`, or `override:`. ### Mode behaviour defaults -| Mode | `max_hops` | `sync_scope` | `tier` | -|---|---|---|---| -| `single-node` | `1` | `metadata` | `cold` | -| `hosted-tenant` | `3` | `full` | `warm` | -| `federated-relay` | `5` | `full` | `hot` | +| Mode | `max_hops` | `sync_scope` | `tier` | +| ----------------- | ---------- | ------------ | ------ | +| `single-node` | `1` | `metadata` | `cold` | +| `hosted-tenant` | `3` | `full` | `warm` | +| `federated-relay` | `5` | `full` | `hot` | ### Worked example @@ -161,11 +161,9 @@ A toy document, and what resolution does to it: "revision": 4, "mode": "single-node", "protocol_versions": ["v1"], - "ceilings": {"max_hops": 4, "max_bytes": 1048576, "max_time_ms": 5000, "max_fan_out": 8}, - "behavior": {"tier": "warm"}, - "overrides": [ - {"scope": "relay", "ceilings": {"max_hops": 2}} - ] + "ceilings": { "max_hops": 4, "max_bytes": 1048576, "max_time_ms": 5000, "max_fan_out": 8 }, + "behavior": { "tier": "warm" }, + "overrides": [{ "scope": "relay", "ceilings": { "max_hops": 2 } }] } ``` @@ -177,32 +175,32 @@ Resolution: behaviour starts from the `single-node` defaults (`max_hops 1`, `met The file has **23 named keys**, including 5 `[budgets]` keys. -| Key | Default / rule | -|---|---| -| `[create] users[]` | With `[create]` absent, anyone may create a group. | -| `[create] groups[]` | As above. | -| `[create] min_role` | Unset means any member may create. | -| `[[users]] key` | A provisioned user entry. | -| `[[users]] id` | The user's 64-hex Ed25519 public key. | -| `[[users]] alias` | Optional. Users are provisioned at startup, idempotently. | -| `[[groups]] key` | A provisioned group entry. | -| `[[groups]] name` | The group name. | -| `[[groups]] creator` | A user key; that user becomes Admin. | -| `[[groups]] alias` | Optional. | -| `[[groups.members]] user` | A member entry for the group above it. | -| `[[groups.members]] role` | One of `pull`, `read`, `write`, `manage`, `admin`. | -| `[policy] freshness_window_seconds` | `300` (5 minutes). | -| `[policy] pull_policy` | `open`. The other value is `members`. | -| `[budgets] app_inbound_bytes_per_hour` | 20 GiB/h: `21474836480`. | -| `[budgets] app_inbound_bytes_per_second` | 32 MiB/s: `33554432` (the 1-second window of `BudgetPolicy::default` in `id-core`); see WEB-14 below. | -| `[budgets] per_peer_bytes_per_hour` | 100 MiB/h: `104857600`. | -| `[budgets] per_peer_burst_bytes_per_minute` | 8 MiB/min: `8388608` (the 60-second window of `BudgetPolicy::default` in `id-core`); see WEB-14 below. | -| `[budgets] per_ip_bytes_per_hour` | 250 MiB/h: `262144000`. | -| `[[budgets.counterparty]] peer` | A per-peer override entry. | -| `[[budgets.counterparty]] bytes_per_window` | Replaces — does not stack with — the per-peer limits for that peer. | -| `[[budgets.counterparty]] window_seconds` | The override window. | -| `[[budgets.counterparty]] messages_per_window` | Optional. | -| `[residency]`, `[[boundaries]]` | Optional tables; their shapes are owned by `server_config/boundaries.rs`. | +| Key | Default / rule | +| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------ | +| `[create] users[]` | With `[create]` absent, anyone may create a group. | +| `[create] groups[]` | As above. | +| `[create] min_role` | Unset means any member may create. | +| `[[users]] key` | A provisioned user entry. | +| `[[users]] id` | The user's 64-hex Ed25519 public key. | +| `[[users]] alias` | Optional. Users are provisioned at startup, idempotently. | +| `[[groups]] key` | A provisioned group entry. | +| `[[groups]] name` | The group name. | +| `[[groups]] creator` | A user key; that user becomes Admin. | +| `[[groups]] alias` | Optional. | +| `[[groups.members]] user` | A member entry for the group above it. | +| `[[groups.members]] role` | One of `pull`, `read`, `write`, `manage`, `admin`. | +| `[policy] freshness_window_seconds` | `300` (5 minutes). | +| `[policy] pull_policy` | `open`. The other value is `members`. | +| `[budgets] app_inbound_bytes_per_hour` | 20 GiB/h: `21474836480`. | +| `[budgets] app_inbound_bytes_per_second` | 32 MiB/s: `33554432` (the 1-second window of `BudgetPolicy::default` in `id-core`); see WEB-14 below. | +| `[budgets] per_peer_bytes_per_hour` | 100 MiB/h: `104857600`. | +| `[budgets] per_peer_burst_bytes_per_minute` | 8 MiB/min: `8388608` (the 60-second window of `BudgetPolicy::default` in `id-core`); see WEB-14 below. | +| `[budgets] per_ip_bytes_per_hour` | 250 MiB/h: `262144000`. | +| `[[budgets.counterparty]] peer` | A per-peer override entry. | +| `[[budgets.counterparty]] bytes_per_window` | Replaces — does not stack with — the per-peer limits for that peer. | +| `[[budgets.counterparty]] window_seconds` | The override window. | +| `[[budgets.counterparty]] messages_per_window` | Optional. | +| `[residency]`, `[[boundaries]]` | Optional tables; their shapes are owned by `server_config/boundaries.rs`. | The operator block list is explicitly **not** configuration: it lives in the event store's `blocks` table (see [Data stores and schemas](data-stores.md)), not in this file. @@ -247,20 +245,20 @@ At startup, user `alice` and group `toy-club` are provisioned idempotently, grou `crates/id-core/src/defaults.json` is embedded at compile time with `include_str!`. Its shipped content is: ```json -{"mode":"append","topic":"id-peer-discovery-v1","topic_secret":"id-public-discovery-v1"} +{ "mode": "append", "topic": "id-peer-discovery-v1", "topic_secret": "id-public-discovery-v1" } ``` The schema is the `Defaults` struct in `crates/id-core/src/discovery.rs`, deserialised with `deny_unknown_fields`, so an unknown key fails the parse. Verified against the checkout, it has 7 keys — the survey's count of 6 is one short; the code is the side documented here: -| Key | Type / default | Meaning | -|---|---|---| -| `bootstrap` | string array, default `[]` | Bootstrap node IDs. | -| `topic` | string, optional | The gossip discovery topic. Must be supplied together with `topic_secret`. | -| `topic_secret` | string, optional | The gossip discovery topic secret. Must be supplied together with `topic`. | -| `web_bindings` | string array, default `[]` | Web listener bindings, replaced wholesale by `--web-listen`. | -| `relay` | relay policy selector, default `N0` | The relay policy used for connections. | -| `gossip` | bool, default `true` | Whether gossip discovery is enabled by default. | -| `mode` | `append` or `replace`, default `append` | How these defaults combine with the hardcoded constants: `append` keeps the built-in list defaults and appends the file values; `replace` uses the file lists instead. | +| Key | Type / default | Meaning | +| -------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `bootstrap` | string array, default `[]` | Bootstrap node IDs. | +| `topic` | string, optional | The gossip discovery topic. Must be supplied together with `topic_secret`. | +| `topic_secret` | string, optional | The gossip discovery topic secret. Must be supplied together with `topic`. | +| `web_bindings` | string array, default `[]` | Web listener bindings, replaced wholesale by `--web-listen`. | +| `relay` | relay policy selector, default `N0` | The relay policy used for connections. | +| `gossip` | bool, default `true` | Whether gossip discovery is enabled by default. | +| `mode` | `append` or `replace`, default `append` | How these defaults combine with the hardcoded constants: `append` keeps the built-in list defaults and appends the file values; `replace` uses the file lists instead. | Precedence, lowest to highest: hardcoded constants, then `defaults.json`, then CLI flags, then the runtime skip flags `--no-default-bootstrap` and `--no-default-topic`, which discard the file's bootstrap IDs or topic values and fall back to the constants. The `id --version` long form prints which defaults source is in force, as a provenance line naming the file's SHA-256 and mode. @@ -268,11 +266,11 @@ Precedence, lowest to highest: hardcoded constants, then `defaults.json`, then C Each app's `app.toml` may carry an `[interfaces.web]` table, read by `web_interface_from_app_toml` in `crates/id-web/src/app_interface.rs`. It has 3 keys: -| Key | Default | Rule | -|---|---|---| -| `mode` | — | `adapter`: host surfaces render the app. `direct`: the app ships its own frontend; accepted by the parser but not adapter-bound. | -| `route` | `/world` (for the default world app) | Must start with `/`, be a valid axum pattern, differ from `socket`, and not collide with the host-reserved route list. | -| `socket` | `/ws/world` (for the default world app) | Same rules as `route`. | +| Key | Default | Rule | +| -------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `mode` | — | `adapter`: host surfaces render the app. `direct`: the app ships its own frontend; accepted by the parser but not adapter-bound. | +| `route` | `/world` (for the default world app) | Must start with `/`, be a valid axum pattern, differ from `socket`, and not collide with the host-reserved route list. | +| `socket` | `/ws/world` (for the default world app) | Same rules as `route`. | The host-reserved route list is mirrored against the main router and the world bridge routes in [The web UI: pages and HTTP API](web-ui.md), so an app cannot claim a host path. @@ -282,30 +280,30 @@ The data directory is the current directory by default. `--data-dir ` sele Other on-disk configuration locations: -| File | Location | -|---|---| -| App manifests | `app.toml` per app, under `ID_APPS_DIR` or the built-in apps root. | +| File | Location | +| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| App manifests | `app.toml` per app, under `ID_APPS_DIR` or the built-in apps root. | | Gallery directory | `--gallery-dir` / `ID_GALLERY_DIR`: verified `.idpb` bundle files plus an `operator/` folder holding collections, tags and admission decisions. | -| Directory journal | `directory.jsonl` in the server-config directory. | -| Keysets | `.id-keyset.jsonl` and `.id-keyset-client.jsonl`. | +| Directory journal | `directory.jsonl` in the server-config directory. | +| Keysets | `.id-keyset.jsonl` and `.id-keyset-client.jsonl`. | ## Serve, web and world defaults that act as configuration These CLI defaults are configuration in effect; the flags themselves are specified in [serve and publications](cli-serve.md) and [World commands: administering and verifying](cli-worlds-admin.md). -| Setting | Literal default | -|---|---| -| `--web` | off | -| `--port` | `3000` | -| `--bind` | `127.0.0.1` | -| `--web-token` | unset (no gate) | -| `--web-cookie-secure` | `false` | -| `--world-name` | `lobby` | -| `--world-checkpoint-every` | `1000`; `0` means never trim | -| `--world-max-open` | `256` | -| `--world-max-sessions` | `1024` | -| `--world-idle-secs` | `600` | -| `--world-boot-window-secs` | `600` | -| `--world-cap-policy` | `deny` | -| Gossip topic (hardcoded fallback) | `id-peer-discovery-v1` | -| Gossip topic secret (hardcoded fallback) | `id-public-discovery-v1` | +| Setting | Literal default | +| ---------------------------------------- | ---------------------------- | +| `--web` | off | +| `--port` | `3000` | +| `--bind` | `127.0.0.1` | +| `--web-token` | unset (no gate) | +| `--web-cookie-secure` | `false` | +| `--world-name` | `lobby` | +| `--world-checkpoint-every` | `1000`; `0` means never trim | +| `--world-max-open` | `256` | +| `--world-max-sessions` | `1024` | +| `--world-idle-secs` | `600` | +| `--world-boot-window-secs` | `600` | +| `--world-cap-policy` | `deny` | +| Gossip topic (hardcoded fallback) | `id-peer-discovery-v1` | +| Gossip topic secret (hardcoded fallback) | `id-public-discovery-v1` | diff --git a/pkgs/id/book/reference/data-stores.md b/pkgs/id/book/reference/data-stores.md index 0aa05494b1..9989633139 100644 --- a/pkgs/id/book/reference/data-stores.md +++ b/pkgs/id/book/reference/data-stores.md @@ -6,52 +6,52 @@ This chapter is the inventory of named, versioned formats a reader, operator or ## The blob and name store (id-store) -| Item | Value | -|---|---| -| Implementation | iroh-blobs `FsStore`: a redb database plus data files. | -| Path | `.iroh-store/`; the iroh-docs store lives under `.iroh-store/docs/`. | -| Open rule | Single-opener: the redb file lock admits one process. | +| Item | Value | +| -------------- | ------------------------------------------------------------------------------------ | +| Implementation | iroh-blobs `FsStore`: a redb database plus data files. | +| Path | `.iroh-store/`; the iroh-docs store lives under `.iroh-store/docs/`. | +| Open rule | Single-opener: the redb file lock admits one process. | | Ephemeral form | An in-memory variant backs `id serve --ephemeral` and the other `--ephemeral` paths. | -| Node key | The `.iroh-key` file family sits alongside the store, in the data directory. | +| Node key | The `.iroh-key` file family sits alongside the store, in the data directory. | A "file" in ID is a name (an iroh-blobs tag) pointing at an immutable blob hash, plus TagStore metadata. That model is implemented once, in FileOps (below), and shared by the CLI, the REPL, the meta protocol and the web layer. ## The tag store and registry -| Item | Value | -|---|---| -| Backing | iroh-docs α/Ω namespace pairs: a global namespace, a node-private namespace, and custom paired or single namespaces. | -| Registry file | `.iroh-meta/registry.json` | -| Registry version | `REGISTRY_VERSION = 1` (`crates/id-store/src/tags.rs`). The file records the namespaces and one-time migration completion. | -| Values | Arbitrary bytes. Display and wire forms use lossy UTF-8, plus `value_b64` where binary fidelity is required; see [WebSocket protocols](websockets.md). | +| Item | Value | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Backing | iroh-docs α/Ω namespace pairs: a global namespace, a node-private namespace, and custom paired or single namespaces. | +| Registry file | `.iroh-meta/registry.json` | +| Registry version | `REGISTRY_VERSION = 1` (`crates/id-store/src/tags.rs`). The file records the namespaces and one-time migration completion. | +| Values | Arbitrary bytes. Display and wire forms use lossy UTF-8, plus `value_b64` where binary fidelity is required; see [WebSocket protocols](websockets.md). | Other named hash domains in `id-store`: `id.name-candidate/v1`, `id.name-curation/v1`, `id.location-tombstone/v1`, and `id.local-claim.v1` (the tag-claims hash domain). ## The graph index -| Item | Value | -|---|---| -| Backing | redb. | -| Tables | `graph_spo`, `graph_pos`, `graph_osp`, `graph_index_meta`. | -| Sort profile | `address-asc/v1`. | +| Item | Value | +| ------------ | ---------------------------------------------------------- | +| Backing | redb. | +| Tables | `graph_spo`, `graph_pos`, `graph_osp`, `graph_index_meta`. | +| Sort profile | `address-asc/v1`. | ## Sidecar snapshots -| Item | Value | -|---|---| -| Head file | `hash.metadata`. | +| Item | Value | +| -------------- | ------------------------------------------- | +| Head file | `hash.metadata`. | | Snapshot files | `hash.metadata.`. | -| Record format | CBOR records with `RECORD_VERSION = 1`. | -| Head domain | `id.sidecar-head/v1`. | +| Record format | CBOR records with `RECORD_VERSION = 1`. | +| Head domain | `id.sidecar-head/v1`. | ## The event store (id-events) -| Item | Value | -|---|---| -| File | `events.redb`, in the event-store directory (CLI `--event-store`, default `events` in the data directory). The temporary write name is `events.redb.tmp`. | +| Item | Value | +| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| File | `events.redb`, in the event-store directory (CLI `--event-store`, default `events` in the data directory). The temporary write name is `events.redb.tmp`. | | Format marker | **`id.events.store.v9`**, stored in the `meta` table. `id.events.store.v8` is also accepted: a v8 store is a v9 store with no `bodies` table and nothing else different. | -| Key encoding | Big-endian, so one author's events sort in sequence order. | -| Chain rows | A fixed 41-byte encoding: next sequence (big-endian `u64`) ‖ head hash (32 bytes) ‖ frozen flag (`0`/`1`). | +| Key encoding | Big-endian, so one author's events sort in sequence order. | +| Chain rows | A fixed 41-byte encoding: next sequence (big-endian `u64`) ‖ head hash (32 bytes) ‖ frozen flag (`0`/`1`). | ### Tables: 17 @@ -69,14 +69,14 @@ The `blocks` table holds the operator block list. It is data, not configuration: Every event is a p2panda-core `Header` in **canonical CBOR** (`crates/id-store/src/chain.rs`): -| Field | Rule | -|---|---| -| Domain tag | **`id.events.v1`** | -| Operation ID | BLAKE3 over the received bytes. | -| Signatures | `verify_strict`. | -| `ChainExt` | `{kind, group, after}`. | -| `after` | At most 32 hashes (`MAX_AFTER`). | -| `kind` | 1–64 bytes, NFC-normalised. | +| Field | Rule | +| ------------ | -------------------------------- | +| Domain tag | **`id.events.v1`** | +| Operation ID | BLAKE3 over the received bytes. | +| Signatures | `verify_strict`. | +| `ChainExt` | `{kind, group, after}`. | +| `after` | At most 32 hashes (`MAX_AFTER`). | +| `kind` | 1–64 bytes, NFC-normalised. | Ingest outcomes are `accepted`, `duplicate`, `fork`, `waiting` and `refused` — the same five outcomes the hosted bridge returns in [The hosted Worker API](hosted-worker.md). @@ -99,11 +99,11 @@ In addition, the group operation kinds are carried by `id_events::groups` — gr ## The directory journal (id-directory) -| Item | Value | -|---|---| -| File | `directory.jsonl`, in the server-config directory. | -| Format | One JSON `DirectoryEntry` per line. Serde-tagged on the field `entry`, snake_case. Replayed through the same `apply` path as live changes, so replay and live writes cannot diverge in effect. | -| Secrets rule | Account secrets enter only as SHA-256 digests. The account key domain is `id-account-v1`. | +| Item | Value | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| File | `directory.jsonl`, in the server-config directory. | +| Format | One JSON `DirectoryEntry` per line. Serde-tagged on the field `entry`, snake_case. Replayed through the same `apply` path as live changes, so replay and live writes cannot diverge in effect. | +| Secrets rule | Account secrets enter only as SHA-256 digests. The account key domain is `id-account-v1`. | ### DirectoryEntry kinds: 17 @@ -120,22 +120,22 @@ Supporting enums in the same records: `Member`, tagged on `kind`, with variants ### Keyset files -| File | Content | -|---|---| -| `.id-keyset.jsonl` | JSONL key records for the server identity. | +| File | Content | +| ------------------------- | ------------------------------------------ | +| `.id-keyset.jsonl` | JSONL key records for the server identity. | | `.id-keyset-client.jsonl` | JSONL key records for the client identity. | ## Signed artifacts Envelope wire types live in `id-sync::artifact` and are re-exported by `id-directory`. -| Item | Value | -|---|---| -| Kinds: 4 | `friend_remove`, `home_declared`, `document`, `tag`. Their wire-name constants are `FRIEND_REMOVE`, `HOME_DECLARED`, `DOCUMENT`, `TAG`. | -| Signed-bytes profile | **`id-artifact-serde-json/v1`** (the `LEGACY_PROFILE` constant). | -| Signed body | `SignedBody{author, seq, prev, kind, body, after}` serialised as compact `serde_json`. The `after` field is omitted when empty. | -| Hash | SHA-256, hex. | -| Signature | Ed25519, hex. | +| Item | Value | +| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| Kinds: 4 | `friend_remove`, `home_declared`, `document`, `tag`. Their wire-name constants are `FRIEND_REMOVE`, `HOME_DECLARED`, `DOCUMENT`, `TAG`. | +| Signed-bytes profile | **`id-artifact-serde-json/v1`** (the `LEGACY_PROFILE` constant). | +| Signed body | `SignedBody{author, seq, prev, kind, body, after}` serialised as compact `serde_json`. The `after` field is omitted when empty. | +| Hash | SHA-256, hex. | +| Signature | Ed25519, hex. | The profile is pinned by a conformance vector file; see "Test vectors" below. @@ -143,12 +143,12 @@ The profile is pinned by a conformance vector file; see "Test vectors" below. No listing, suspension or delisting record kind exists in `crates/id-directory`. That family lives in three other places: -| Location | Format | -|---|---| -| `crates/id-sync/src/registry.rs` | Signed registry lists: a canonical-CBOR body with a registry-key Ed25519 signature. Entries are `RegistryEntry{announcement, included_at, registry_seq}`, where `announcement` is verbatim and world-key-signed. Delistings are `Tombstone{world_id, removed_at, reason, registry_seq}`; `reason` is at most 200 characters. The policy statement is at most 2000 characters. Unlisted worlds are refused at inclusion and skipped on import. | -| `crates/id-caps/src/declaration.rs` | Provider declaration lifecycle: `Filed → Admitted → Live → Suspended / Superseded / Stale → Tombstoned`. Suspension is registry state; the provider's contents are unchanged. Signing domains: `id.provider-manifest.v1`, `id.provider-withdrawal.v1`, `id.host-attested-provider:`. | -| `crates/id-worlds/src/program_gallery_admission.rs` | Gallery listing decisions and transparency entries (removal, refusal, reinstatement) behind the routes in [The web UI: pages and HTTP API](web-ui.md). | -| `crates/id-sync/src/federation/slices/b02_key_revocation.rs` | Key suspension records: operator maintenance suspension, bounded or indefinite. | +| Location | Format | +| ------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `crates/id-sync/src/registry.rs` | Signed registry lists: a canonical-CBOR body with a registry-key Ed25519 signature. Entries are `RegistryEntry{announcement, included_at, registry_seq}`, where `announcement` is verbatim and world-key-signed. Delistings are `Tombstone{world_id, removed_at, reason, registry_seq}`; `reason` is at most 200 characters. The policy statement is at most 2000 characters. Unlisted worlds are refused at inclusion and skipped on import. | +| `crates/id-caps/src/declaration.rs` | Provider declaration lifecycle: `Filed → Admitted → Live → Suspended / Superseded / Stale → Tombstoned`. Suspension is registry state; the provider's contents are unchanged. Signing domains: `id.provider-manifest.v1`, `id.provider-withdrawal.v1`, `id.host-attested-provider:`. | +| `crates/id-worlds/src/program_gallery_admission.rs` | Gallery listing decisions and transparency entries (removal, refusal, reinstatement) behind the routes in [The web UI: pages and HTTP API](web-ui.md). | +| `crates/id-sync/src/federation/slices/b02_key_revocation.rs` | Key suspension records: operator maintenance suspension, bounded or indefinite. | ## FileOps and the archive naming rule @@ -167,13 +167,13 @@ When a rename or replace archives the old file, the archive name is: ### Archive and identity metadata keys -| Key | Placed on | Meaning | -|---|---|---| -| `archive.rename` | — | Records a rename archive relationship. | -| `archive.replace` | The live name | Names the archives the live name owns. | -| `archive.owner` | The archive | Names the archive's owner. | -| `name`, `file`, `path` | The file | Identity keys, refreshed on rename and copy. | -| `origin` | The file | Stamped at first write. | +| Key | Placed on | Meaning | +| ---------------------- | ------------- | -------------------------------------------- | +| `archive.rename` | — | Records a rename archive relationship. | +| `archive.replace` | The live name | Names the archives the live name owns. | +| `archive.owner` | The archive | Names the archive's owner. | +| `name`, `file`, `path` | The file | Identity keys, refreshed on rename and copy. | +| `origin` | The file | Stamped at first write. | Archives are dropped only with their owner. There is no per-archive delete. @@ -183,12 +183,12 @@ Archives are dropped only with their owner. There is no per-archive delete. ## Other id-sync formats -| Format | Value | -|---|---| -| Envelope ALPN | `/id-envelope/1` | -| Record-store envelope domain | `id-sync/record-store-envelope/v1` | -| Bridge authentication domain | `id.bridge-auth.v1` (the hosted bridge in [The hosted Worker API](hosted-worker.md)) | -| Federation record store | `federation/record_store.rs`, with `RecordStatus`, and slices B01–B09, B15–B24, B28, B31, B32 covering key lifecycle and revocation, the replay guard, signature suites, signer binding, rejection events, conflict reports, sync scope, anti-entropy, peer priority, fanout budget, query grants and privacy, signed receipts, request identity, result dedup, loop inform, routing state, topology probe, takeover response, peer classes, and the ingest gate. | +| Format | Value | +| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Envelope ALPN | `/id-envelope/1` | +| Record-store envelope domain | `id-sync/record-store-envelope/v1` | +| Bridge authentication domain | `id.bridge-auth.v1` (the hosted bridge in [The hosted Worker API](hosted-worker.md)) | +| Federation record store | `federation/record_store.rs`, with `RecordStatus`, and slices B01–B09, B15–B24, B28, B31, B32 covering key lifecycle and revocation, the replay guard, signature suites, signer binding, rejection events, conflict reports, sync scope, anti-entropy, peer priority, fanout budget, query grants and privacy, signed receipts, request identity, result dedup, loop inform, routing state, topology probe, takeover response, peer classes, and the ingest gate. | ## The tag registry @@ -198,58 +198,58 @@ Covered above with the tag store: `.iroh-meta/registry.json`, format **`registry The hosted Worker's `UserDO` (see [The hosted Worker API](hosted-worker.md)) uses SQLite with **`SCHEMA_VERSION = 3`**: -| Tables | Group | -|---|---| -| `meta`, `kv`, `blobs` | Core object state: metadata, per-user KV, blob references. | +| Tables | Group | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- | +| `meta`, `kv`, `blobs` | Core object state: metadata, per-user KV, blob references. | | `bridge_events`, `bridge_chains`, `bridge_forks`, `bridge_proof_ids`, `bridge_proof_headers`, `bridge_waiting`, `bridge_waiting_by_dep`, `bridge_meta` | The bridge store: the signed-object sync peer state, mirroring the native event store's table roles. | Two related proof-of-concept schemas, neither a production format: -| Schema | Value | -|---|---| -| worker-poc `WorldObject` journal | An unversioned SQLite `journal` table; the source of truth for that PoC. | -| d1-journal-poc journal header | Version `1`; entries include `created` and `caps_granted`. A D1 bookmark is not a stream cursor. | +| Schema | Value | +| -------------------------------- | ------------------------------------------------------------------------------------------------ | +| worker-poc `WorldObject` journal | An unversioned SQLite `journal` table; the source of truth for that PoC. | +| d1-journal-poc journal header | Version `1`; entries include `created` and `caps_granted`. A D1 bookmark is not a stream cursor. | ## Program bundles and world formats -| Format | Magic / version | -|---|---| +| Format | Magic / version | +| ------------------------------ | -------------------------------------------------------------------- | | Program bundle (`.idpb` files) | Magic line `developing-today/id-program-bundle/v1` followed by `\n`. | -| World snapshot | Magic `IDWS`. | -| World replication frame | Magic `id-world-replication/v1` followed by `\n`. | -| World module signature domain | `developing-today/id-world-module/v1` followed by a NUL byte. | -| Program-registry ALPN | `/id-program-registry/1`. | +| World snapshot | Magic `IDWS`. | +| World replication frame | Magic `id-world-replication/v1` followed by `\n`. | +| World module signature domain | `developing-today/id-world-module/v1` followed by a NUL byte. | +| Program-registry ALPN | `/id-program-registry/1`. | ## Keys, invites and presence -| Format | Magic / version | -|---|---| -| Key envelope (also the backup envelope) | Magic `IDKEY`. | -| Invite | Magic `IDINV`, version 2. | -| Presence frame | Magic `id-presence/v1` followed by `\n`. | -| Peer announcement frame | Magic `id-peer-announcement/v2` followed by `\n`. | +| Format | Magic / version | +| --------------------------------------- | ------------------------------------------------- | +| Key envelope (also the backup envelope) | Magic `IDKEY`. | +| Invite | Magic `IDINV`, version 2. | +| Presence frame | Magic `id-presence/v1` followed by `\n`. | +| Peer announcement frame | Magic `id-peer-announcement/v2` followed by `\n`. | ## Remaining named domains and versions -| Format | Value | -|---|---| -| Match-audit format | Version `0`; domains `id.match-audit.v0/header`, `id.match-audit.v0/entry`, `id.match-audit.v0/footer`. | -| Boundary evidence domain | `id.boundary.evidence.v1`. | -| Boundary declaration hash domain | `id.boundary.declaration.v1`. | -| Currency receipt domain | `id.currency.receipt.v1`. | -| Array address format (id-core) | `FORMAT_VERSION 0x01`. | -| Typed value format (id-core) | `FORMAT_VERSION 0x02`. | -| Config schema | `id-config` version `1`, plus the negotiation transcript domain `id-config/negotiation-transcript/v1`; see [Configuration and environment](configuration.md). | +| Format | Value | +| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Match-audit format | Version `0`; domains `id.match-audit.v0/header`, `id.match-audit.v0/entry`, `id.match-audit.v0/footer`. | +| Boundary evidence domain | `id.boundary.evidence.v1`. | +| Boundary declaration hash domain | `id.boundary.declaration.v1`. | +| Currency receipt domain | `id.currency.receipt.v1`. | +| Array address format (id-core) | `FORMAT_VERSION 0x01`. | +| Typed value format (id-core) | `FORMAT_VERSION 0x02`. | +| Config schema | `id-config` version `1`, plus the negotiation transcript domain `id-config/negotiation-transcript/v1`; see [Configuration and environment](configuration.md). | ## Test vectors `pkgs/id/test-vectors/` contains exactly 3 files. They are conformance fixtures, not stores. -| File | Schema / content | -|---|---| -| `schema.json` | A JSON Schema (draft 2020-12) titled "ID/Atlas shared conformance test vectors", with `schema_version` const `1`. `port_kind` is one of `record_store`, `blob_store`, `event_log`, `world_store`, `object_bucket`, `message_stream`, `request_transport`. Operations are `negotiate`, `append`, `read`, `ack`. Negotiation outcomes are `granted`, `unsupported_capability`, `version_mismatch`. | -| `atlas-content-hash-v1.json` | `"schema": "atlas-content-hash-compatibility-v1"`. It records the Atlas `chunks.content_hash` field as `producer_unavailable` with empty vectors, and states the interop claim verbatim: "forbidden: do not equate Atlas chunks.content_hash with any ID ContentId profile". | -| `legacy-artifact-signatures.json` | `"schema": "id-atlas-signed-artifact-profiles/v1"`. It pins the legacy `id-artifact-serde-json` signed-bytes definition, the SHA-256 hash rule and the Ed25519 signature rule, using a test-only Ed25519 key (seed = 32 × `0x07`). The file itself warns that this key is never a production key. | +| File | Schema / content | +| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `schema.json` | A JSON Schema (draft 2020-12) titled "ID/Atlas shared conformance test vectors", with `schema_version` const `1`. `port_kind` is one of `record_store`, `blob_store`, `event_log`, `world_store`, `object_bucket`, `message_stream`, `request_transport`. Operations are `negotiate`, `append`, `read`, `ack`. Negotiation outcomes are `granted`, `unsupported_capability`, `version_mismatch`. | +| `atlas-content-hash-v1.json` | `"schema": "atlas-content-hash-compatibility-v1"`. It records the Atlas `chunks.content_hash` field as `producer_unavailable` with empty vectors, and states the interop claim verbatim: "forbidden: do not equate Atlas chunks.content_hash with any ID ContentId profile". | +| `legacy-artifact-signatures.json` | `"schema": "id-atlas-signed-artifact-profiles/v1"`. It pins the legacy `id-artifact-serde-json` signed-bytes definition, the SHA-256 hash rule and the Ed25519 signature rule, using a test-only Ed25519 key (seed = 32 × `0x07`). The file itself warns that this key is never a production key. | ## Worked example @@ -263,11 +263,11 @@ Toy data: a node stores one file, renames it twice in the same second, and an op What exists afterwards: -| Place | Entry | -|---|---| -| `.iroh-store/` | One blob (the toy bytes), referenced by the live name `report-final`; the redb name index holds the archive names below. | -| Tag store | `report-final` carries the identity keys `name`, `file`, `path` and the first-write `origin` key, plus `archive.replace` naming its archives. | -| Archive names | `report.archive.1700000000` and `report-v2.archive.1700000000`, each carrying `archive.owner`. Because both renames landed in the same second, the second archive's suffix was bumped until free if the first claim collided. | -| Name refusal | A later attempt to store a user file literally named `report.archive.1700000000` is refused with `ReservedArchiveName`; `report.archive.notes` would be accepted. | -| `events.redb` | The `meta` table reads `id.events.store.v9`; the rename operations appear as events whose headers are canonical CBOR under the domain tag `id.events.v1`. | -| `directory.jsonl` | Unchanged by file operations: it records account, group, member, tier and friend entries only — 17 kinds, none of them a file kind. | +| Place | Entry | +| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `.iroh-store/` | One blob (the toy bytes), referenced by the live name `report-final`; the redb name index holds the archive names below. | +| Tag store | `report-final` carries the identity keys `name`, `file`, `path` and the first-write `origin` key, plus `archive.replace` naming its archives. | +| Archive names | `report.archive.1700000000` and `report-v2.archive.1700000000`, each carrying `archive.owner`. Because both renames landed in the same second, the second archive's suffix was bumped until free if the first claim collided. | +| Name refusal | A later attempt to store a user file literally named `report.archive.1700000000` is refused with `ReservedArchiveName`; `report.archive.notes` would be accepted. | +| `events.redb` | The `meta` table reads `id.events.store.v9`; the rename operations appear as events whose headers are canonical CBOR under the domain tag `id.events.v1`. | +| `directory.jsonl` | Unchanged by file operations: it records account, group, member, tier and friend entries only — 17 kinds, none of them a file kind. | diff --git a/pkgs/id/book/reference/hosted-worker.md b/pkgs/id/book/reference/hosted-worker.md index 49a1a6f363..ad65dee1a8 100644 --- a/pkgs/id/book/reference/hosted-worker.md +++ b/pkgs/id/book/reference/hosted-worker.md @@ -4,10 +4,10 @@ Source: https://github.com/developing-today/code/blob/main/pkgs/id/hosted-worker This chapter documents the hosted Worker **as it stands**. Two packages exist, and neither is a live service: -| Package | Status | -|---|---| -| `pkgs/id/hosted-worker` | A local-only scaffold. Not deployed. | -| `pkgs/id/worker-poc` | A completed proof of concept. Not a production path. | +| Package | Status | +| ----------------------- | ---------------------------------------------------- | +| `pkgs/id/hosted-worker` | A local-only scaffold. Not deployed. | +| `pkgs/id/worker-poc` | A completed proof of concept. Not a production path. | ## Disposition: local-only scaffold, not deployed @@ -28,11 +28,11 @@ The hosted data plane for bound hosted-edition users. There is one `UserDO` Dura - per-user key/value store, - blob references (the bytes live in R2), -- a signed-object bridge store that acts as a *sync peer*: it holds signed objects and fork evidence, assigns no order, re-signs nothing, and serves no authoritative snapshot. +- a signed-object bridge store that acts as a _sync peer_: it holds signed objects and fork evidence, assigns no order, re-signs nothing, and serves no authoritative snapshot. ## The front door -`src/worker.ts` (73 lines) is the entry point. It does not authenticate users itself. It consumes an *already-authenticated* resolved context set by an authenticated internal caller; the binding ceremony that produces that context is native code, in `pkgs/id/src/hosted_binding.rs`. +`src/worker.ts` (73 lines) is the entry point. It does not authenticate users itself. It consumes an _already-authenticated_ resolved context set by an authenticated internal caller; the binding ceremony that produces that context is native code, in `pkgs/id/src/hosted_binding.rs`. Request handling, in order: @@ -52,14 +52,14 @@ Routing rules in `src/routing.ts` — the only module that touches the raw `USER From `wrangler.toml`: Worker name `id-hosted-worker`, `compatibility_date` `2025-06-01`. -| Binding / var | Type | Notes | -|---|---|---| -| `USERS` | Durable Object namespace → `UserDO` | Migration tag `v1`, `new_sqlite_classes = ["UserDO"]`. | -| `BLOBS` | R2 bucket `id-hosted-blobs` | Content-addressed blob bytes. Local emulation only. In the `UserDO` interface the binding is optional, and the code that needs it fails closed without it. | -| `USER_CEILING_BYTES` | String var, optional | Per-user storage ceiling. Absent or empty means no ceiling. A malformed value fails writes closed. Also read by the front door for the body limit: `MAX_BODY_BYTES` is a 100 MiB cap. | -| `BRIDGE_WAITING_PER_AUTHOR` | String var, optional | Bridge waiting-pool bound, per author. Absent means the native default in `bridge-store.ts`. A malformed value fails bridge writes closed. | -| `BRIDGE_WAITING_TOTAL` | String var, optional | Bridge waiting-pool bound, total. Same default and failure rule. | -| `BRIDGE_WAITING_MAX_AGE_MS` | String var, optional | Bridge waiting-pool bound, maximum age in milliseconds. Same default and failure rule. | +| Binding / var | Type | Notes | +| --------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `USERS` | Durable Object namespace → `UserDO` | Migration tag `v1`, `new_sqlite_classes = ["UserDO"]`. | +| `BLOBS` | R2 bucket `id-hosted-blobs` | Content-addressed blob bytes. Local emulation only. In the `UserDO` interface the binding is optional, and the code that needs it fails closed without it. | +| `USER_CEILING_BYTES` | String var, optional | Per-user storage ceiling. Absent or empty means no ceiling. A malformed value fails writes closed. Also read by the front door for the body limit: `MAX_BODY_BYTES` is a 100 MiB cap. | +| `BRIDGE_WAITING_PER_AUTHOR` | String var, optional | Bridge waiting-pool bound, per author. Absent means the native default in `bridge-store.ts`. A malformed value fails bridge writes closed. | +| `BRIDGE_WAITING_TOTAL` | String var, optional | Bridge waiting-pool bound, total. Same default and failure rule. | +| `BRIDGE_WAITING_MAX_AGE_MS` | String var, optional | Bridge waiting-pool bound, maximum age in milliseconds. Same default and failure rule. | Test harness: `wrangler.test.toml` defines a separate Worker, name `id-hosted-worker-test`, main `src/test-harness.ts`, with binding `TEST_USERS` → `UserDO`, bucket `id-hosted-blobs-test`, and `USER_CEILING_BYTES = "1073741824"`. It is test-only and is never an application entry point. @@ -75,23 +75,23 @@ Every route first runs a common guard: The object's SQLite schema is `SCHEMA_VERSION = 3`, with tables `meta`, `kv` and `blobs`, plus the bridge schema listed in [Data stores and schemas](data-stores.md). -| Method | Path | Purpose | -|---|---|---| -| GET | `/v1/state` | `binding_id`, `jurisdiction`, `schema_version`, object name. | -| GET | `/v1/usage` | Usage, ceiling, and `at_cap`. | -| GET | `/v1/export` | Full KV plus blob index export. Stays available at cap, by design. | -| PUT | `/v1/kv/{key}` | Per-user KV write. The key must match `[A-Za-z0-9._-]{1,128}`. | -| GET | `/v1/kv/{key}` | KV read. | -| DELETE | `/v1/kv/{key}` | KV delete. Available at cap. | -| PUT | `/v1/blobs` | Store a content-addressed blob. The key is the SHA-256 hex of the content. Bytes are deduplicated across users in R2; each user gets a per-user reference row. | -| GET | `/v1/blobs/{64-hex}` | Fetch a blob this user references. | -| DELETE | `/v1/blobs/{64-hex}` | Drop this user's reference only. The R2 bytes are deliberately not deleted; garbage collection is a separate, unimplemented family of work. | -| GET | `/v1/bridge/challenge` | Issue a single-use ID-key proof nonce for the bridge. | -| GET | `/v1/bridge/heads` | Bridge chain heads. Requires a fresh ID-key proof per call. | -| POST | `/v1/bridge/push` | Ingest a batch of signed events. Per-event outcomes: `accepted`, `duplicate`, `fork`, `waiting`, `refused`. | -| POST | `/v1/bridge/pull` | Pull events beyond per-author positions. Returns a binary batch, with `x-bridge-more` and `x-bridge-heads` headers. | -| GET | `/v1/bridge/export` | Export sets for the native `build_export`. Answers `502` naming the hash if R2 cannot produce a cited blob. | -| WS | `/v1/bridge/ws` | Bridge session: in-band `CHALLENGE`/`AUTH`, binary frames only. | +| Method | Path | Purpose | +| ------ | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| GET | `/v1/state` | `binding_id`, `jurisdiction`, `schema_version`, object name. | +| GET | `/v1/usage` | Usage, ceiling, and `at_cap`. | +| GET | `/v1/export` | Full KV plus blob index export. Stays available at cap, by design. | +| PUT | `/v1/kv/{key}` | Per-user KV write. The key must match `[A-Za-z0-9._-]{1,128}`. | +| GET | `/v1/kv/{key}` | KV read. | +| DELETE | `/v1/kv/{key}` | KV delete. Available at cap. | +| PUT | `/v1/blobs` | Store a content-addressed blob. The key is the SHA-256 hex of the content. Bytes are deduplicated across users in R2; each user gets a per-user reference row. | +| GET | `/v1/blobs/{64-hex}` | Fetch a blob this user references. | +| DELETE | `/v1/blobs/{64-hex}` | Drop this user's reference only. The R2 bytes are deliberately not deleted; garbage collection is a separate, unimplemented family of work. | +| GET | `/v1/bridge/challenge` | Issue a single-use ID-key proof nonce for the bridge. | +| GET | `/v1/bridge/heads` | Bridge chain heads. Requires a fresh ID-key proof per call. | +| POST | `/v1/bridge/push` | Ingest a batch of signed events. Per-event outcomes: `accepted`, `duplicate`, `fork`, `waiting`, `refused`. | +| POST | `/v1/bridge/pull` | Pull events beyond per-author positions. Returns a binary batch, with `x-bridge-more` and `x-bridge-heads` headers. | +| GET | `/v1/bridge/export` | Export sets for the native `build_export`. Answers `502` naming the hash if R2 cannot produce a cited blob. | +| WS | `/v1/bridge/ws` | Bridge session: in-band `CHALLENGE`/`AUTH`, binary frames only. | Failure shapes: @@ -109,13 +109,13 @@ The `hosted-worker` README describes the UserDO routes as `GET /v1/state` and `P These modules exist in the package but are not routed by `worker.ts`: -| Module | What it is | -|---|---| -| `src/provisioning.ts`, `src/provisioning-surface.ts` | The provisioning surface. | -| `src/account-directory.ts` | Account directory. | -| `src/admission-gate.ts` | Admission gate. | -| `src/export.ts` | Export support behind `/v1/bridge/export`. | -| `src/currency/{gateway,ledger,relay,crypto}.ts` | A currency gateway proof of concept. Its own documentation states it is "not the permanent currency service": an in-process ledger stub modelled on TigerBeetle, gateway-signed balance snapshots, and a UserDO relay that reconciles by request-ID lookup. | +| Module | What it is | +| ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `src/provisioning.ts`, `src/provisioning-surface.ts` | The provisioning surface. | +| `src/account-directory.ts` | Account directory. | +| `src/admission-gate.ts` | Admission gate. | +| `src/export.ts` | Export support behind `/v1/bridge/export`. | +| `src/currency/{gateway,ledger,relay,crypto}.ts` | A currency gateway proof of concept. Its own documentation states it is "not the permanent currency service": an in-process ledger stub modelled on TigerBeetle, gateway-signed balance snapshots, and a UserDO relay that reconciles by request-ID lookup. | ## worker-poc: a completed proof, not live @@ -123,22 +123,22 @@ These modules exist in the package but are not routed by `worker.ts`: Its Worker (`src/worker.ts`) exposes a `WorldObject` Durable Object (binding `WORLD`, migration `v1-sqlite`, with a CompiledWasm rule for the prebuilt guest): -| Method | Path | Purpose | -|---|---|---| -| POST | `/step` | Apply one step. Body: `{participant, event}`. | -| POST | `/cold-start` | Cold-start the object. | -| GET | `/state` | Read the state. | +| Method | Path | Purpose | +| ------ | ------------- | --------------------------------------------- | +| POST | `/step` | Apply one step. Body: `{participant, event}`. | +| POST | `/cold-start` | Cold-start the object. | +| GET | `/state` | Read the state. | The SQLite `journal` table is the source of truth. The hosted loader (`src/manifest.ts`) refuses a manifest with `portability=native`, and refuses a manifest declaring more than 64 MB of memory, up front. The `d1-journal-poc/` subfolder is a second, local-only D1 fit probe. It uses a placeholder database ID and always runs `--local`. Binding `DB` (D1): -| Method | Path | Purpose | -|---|---|---| -| GET | `/health` | Health check. | -| POST | `/append` | Append a journal entry. | -| GET | `/snapshot` | Read a snapshot. | -| GET | `/tail` | Read the journal tail. Journal header version is `1`; entries include `created` and `caps_granted`. A D1 bookmark is not a stream cursor. | +| Method | Path | Purpose | +| ------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| GET | `/health` | Health check. | +| POST | `/append` | Append a journal entry. | +| GET | `/snapshot` | Read a snapshot. | +| GET | `/tail` | Read the journal tail. Journal header version is `1`; entries include `created` and `caps_granted`. A D1 bookmark is not a stream cursor. | ## Worked example diff --git a/pkgs/id/book/reference/mcp.md b/pkgs/id/book/reference/mcp.md index 75b2f6a016..0a84e66a70 100644 --- a/pkgs/id/book/reference/mcp.md +++ b/pkgs/id/book/reference/mcp.md @@ -34,16 +34,16 @@ Tool definitions are pinned at session start by SHA-256 over their canonical JSO `v1_tool_definitions()` in `mcp_bridge.rs` defines 8 tools, in this pinned order. -| # | Tool | Maps to | Ceiling key | Parameters | Behaviour | -|---|---|---|---|---|---| -| 1 | `world.join` | `session.presence` | `presence` | `capability: string` (required), `after: u64` (optional) | Sends `{type:"join", capability, after, agent_profile:true}`. A second join returns `AlreadyJoined`. | -| 2 | `world.leave` | `session.presence` | `presence` | none | No frame exists for leaving: returns `ToolAction::Close`. Presence is connection-scoped, so leaving is closing. | -| 3 | `screen.read` | `screen.read` | `screen.read` | none | Local answer: the latest full `view` text plus pending semantic-diff changes. Reading drains the pending changes. Sends no frame. | -| 4 | `screen.subscribe` | `screen.subscribe` | `screen.read` | `region` (optional: `{x, y, width, height}`, all `u64`), `event_classes` (optional string array). At least one of the two is required. | Sends `{type:"screen_subscribe", …}`. | -| 5 | `object.inspect` | `object.inspect` | `screen.read` | `entity_ref` (required, any JSON value; keyed by its JSON string) | Local answer from observed `object_changed` diffs. When nothing is known: `"object not in the observed screen state"`. Sends no frame. | -| 6 | `program.invoke` | `input` | `program.invoke` | `program`: non-empty string, `object`: non-empty string, `arguments`: string, `screen_revision`: optional `u64` | Sends exactly one `{type:"input", data_hex: hex(arguments), screen_revision?}` frame. No chaining: one call, one frame. `program` and `object` are validated here and allowlist-enforced by the policy layer. | -| 7 | `chat.post` | `chat.post` | `chat.post` | `text: string` (required), `screen_revision`: optional `u64` | Sends `{type:"chat", text, screen_revision?}`. | -| 8 | `presence.set` | `presence.set` | `presence` | — | Listed but unimplemented in v1: always refused. See below. | +| # | Tool | Maps to | Ceiling key | Parameters | Behaviour | +| --- | ------------------ | ------------------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | `world.join` | `session.presence` | `presence` | `capability: string` (required), `after: u64` (optional) | Sends `{type:"join", capability, after, agent_profile:true}`. A second join returns `AlreadyJoined`. | +| 2 | `world.leave` | `session.presence` | `presence` | none | No frame exists for leaving: returns `ToolAction::Close`. Presence is connection-scoped, so leaving is closing. | +| 3 | `screen.read` | `screen.read` | `screen.read` | none | Local answer: the latest full `view` text plus pending semantic-diff changes. Reading drains the pending changes. Sends no frame. | +| 4 | `screen.subscribe` | `screen.subscribe` | `screen.read` | `region` (optional: `{x, y, width, height}`, all `u64`), `event_classes` (optional string array). At least one of the two is required. | Sends `{type:"screen_subscribe", …}`. | +| 5 | `object.inspect` | `object.inspect` | `screen.read` | `entity_ref` (required, any JSON value; keyed by its JSON string) | Local answer from observed `object_changed` diffs. When nothing is known: `"object not in the observed screen state"`. Sends no frame. | +| 6 | `program.invoke` | `input` | `program.invoke` | `program`: non-empty string, `object`: non-empty string, `arguments`: string, `screen_revision`: optional `u64` | Sends exactly one `{type:"input", data_hex: hex(arguments), screen_revision?}` frame. No chaining: one call, one frame. `program` and `object` are validated here and allowlist-enforced by the policy layer. | +| 7 | `chat.post` | `chat.post` | `chat.post` | `text: string` (required), `screen_revision`: optional `u64` | Sends `{type:"chat", text, screen_revision?}`. | +| 8 | `presence.set` | `presence.set` | `presence` | — | Listed but unimplemented in v1: always refused. See below. | Session rule: every tool except `world.join` requires a joined session. Calling one before joining returns `NotJoined`. @@ -63,7 +63,7 @@ Any other unrecognised name returns `BridgeError::UnknownTool`. The forbidden li ### `presence.set`: a pinned tool the bridge always refuses (WEB-13) -`presence.set` is one of the 8 pinned `v1_tool_definitions()`, so a client discovering the surface is offered it. Calling it always fails: `tool_action` refuses it unconditionally with `BridgeError::NoFrameMapping`. The reason is structural — presence *is* the join. There is no presence frame in the world session protocol to map the call onto. That is disagreement WEB-13: the v1 surface lists a tool that can never succeed in v1. +`presence.set` is one of the 8 pinned `v1_tool_definitions()`, so a client discovering the surface is offered it. Calling it always fails: `tool_action` refuses it unconditionally with `BridgeError::NoFrameMapping`. The reason is structural — presence _is_ the join. There is no presence frame in the world session protocol to map the call onto. That is disagreement WEB-13: the v1 surface lists a tool that can never succeed in v1. ## The policy layer: PolicySession @@ -82,16 +82,16 @@ Two further rules are enforced in the same layer: The ceiling and quota come from a `RoleGrant`, set by the owner at grant time and never widened by the session: -| Field | Meaning | -|---|---| -| `agent_key` | `[u8; 32]`, the agent's key. | -| `agent_label` | The agent's label. | -| `owner` | The granting owner. | -| `world` | The world the grant covers. | +| Field | Meaning | +| ---------------- | ------------------------------------------------------------- | +| `agent_key` | `[u8; 32]`, the agent's key. | +| `agent_label` | The agent's label. | +| `owner` | The granting owner. | +| `world` | The world the grant covers. | | `capability_ref` | The delegation/grant record ID, stamped on every audit event. | -| `ceiling` | A `CapabilityCeiling`. | -| `quota` | A `Quota`. | -| `rate_limits` | A list of `RateLimit{tool, max_calls, window_secs}`. | +| `ceiling` | A `CapabilityCeiling`. | +| `quota` | A `Quota`. | +| `rate_limits` | A list of `RateLimit{tool, max_calls, window_secs}`. | `CapabilityCeiling` has four sets — `tools`, `worlds`, `object_classes`, `program_allowlist` — all `BTreeSet`. Anything unnamed in the relevant set is outside the ceiling. @@ -99,21 +99,21 @@ The ceiling and quota come from a `RoleGrant`, set by the owner at grant time an `Quota` has three axes: `frames`, `tool_calls`, `program_invocations`. -| Action | tool_calls | frames | program_invocations | -|---|---|---|---| -| Any admitted action | 1 | — | — | -| `world.join` | 1 | 1 | — | -| `screen.subscribe` | 1 | 1 | — | -| `chat.post` | 1 | 1 | — | -| `program.invoke` | 1 | 1 | 1 | -| `screen.read`, `object.inspect` | 1 | 0 | 0 | -| `world.leave` | 0 | 0 | 0 | +| Action | tool_calls | frames | program_invocations | +| ------------------------------- | ---------- | ------ | ------------------- | +| Any admitted action | 1 | — | — | +| `world.join` | 1 | 1 | — | +| `screen.subscribe` | 1 | 1 | — | +| `chat.post` | 1 | 1 | — | +| `program.invoke` | 1 | 1 | 1 | +| `screen.read`, `object.inspect` | 1 | 0 | 0 | +| `world.leave` | 0 | 0 | 0 | `world.leave` is never refused by ceiling or quota and is charged nothing. It is still audited. ### Quota exhaustion parks the agent -When a quota axis is exhausted, the agent is *parked*: the policy layer emits the first-class world event +When a quota axis is exhausted, the agent is _parked_: the policy layer emits the first-class world event ```text QUOTA_PARK_EVENT = "agent parked, quota exhausted" @@ -125,15 +125,15 @@ as a `ParkEvent{kind: "agent_parked", reason: "quota_exhausted", …}`. Parking `AuditOutcome` records what happened to each action: -| Outcome | Meaning | -|---|---| -| `Executed` | The action ran. | -| `RefusedCeiling` | Outside the capability ceiling. | -| `RefusedQuota{axis}` | A quota axis could not pay; `axis` names which one. | -| `RefusedParked` | The agent is already parked. | -| `RefusedStaleInput{token, current}` | The supplied `screen_revision` (`token`) is not the latest observed revision (`current`). | -| `RefusedRateLimit{tool, max_calls, window_secs}` | The tool's sliding-window limit was hit. | -| Bridge-error refusals | The underlying bridge returned an error, for example `NotJoined`, `AlreadyJoined`, `UnknownTool` or `NoFrameMapping`. | +| Outcome | Meaning | +| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- | +| `Executed` | The action ran. | +| `RefusedCeiling` | Outside the capability ceiling. | +| `RefusedQuota{axis}` | A quota axis could not pay; `axis` names which one. | +| `RefusedParked` | The agent is already parked. | +| `RefusedStaleInput{token, current}` | The supplied `screen_revision` (`token`) is not the latest observed revision (`current`). | +| `RefusedRateLimit{tool, max_calls, window_secs}` | The tool's sliding-window limit was hit. | +| Bridge-error refusals | The underlying bridge returned an error, for example `NotJoined`, `AlreadyJoined`, `UnknownTool` or `NoFrameMapping`. | The agent is the audit subject, never its editor: the audit log and the spend figures are exposed to the agent read-only. diff --git a/pkgs/id/book/reference/native-shell.md b/pkgs/id/book/reference/native-shell.md index 872ddd67d6..da6e07c3a1 100644 --- a/pkgs/id/book/reference/native-shell.md +++ b/pkgs/id/book/reference/native-shell.md @@ -16,13 +16,13 @@ usage: id-native-shell [--node --capability ] [--world ] [- ## Arguments -| Argument | Value | Rule | -|---|---|---| -| `--node ` | 64-hex node ID | Must be given together with `--capability`. | -| `--capability ` | Capability string | Must be given together with `--node`. | -| `--world ` | World name | Selects the world on the node. | -| `--addr ` | Socket address | Repeatable. Each occurrence adds a direct address and skips discovery for it. | -| `--no-relay` | Flag, no value | Direct connections only; relay use is disabled. | +| Argument | Value | Rule | +| -------------------- | ----------------- | ----------------------------------------------------------------------------- | +| `--node ` | 64-hex node ID | Must be given together with `--capability`. | +| `--capability ` | Capability string | Must be given together with `--node`. | +| `--world ` | World name | Selects the world on the node. | +| `--addr ` | Socket address | Repeatable. Each occurrence adds a direct address and skips discovery for it. | +| `--no-relay` | Flag, no value | Direct connections only; relay use is disabled. | ### The pairing rule @@ -34,8 +34,8 @@ There is no way to connect with a node ID and no capability, and no way to suppl One environment variable is read by this binary: -| Name | Effect | -|---|---| +| Name | Effect | +| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ID_SHELL_FILE_READ_ROOT` | When set, configures an additional restriction on the native shell's file-read root. When unset, the file-read root is not additionally restricted or configured by environment. | ## There is no `--help` and no `--version` @@ -50,11 +50,11 @@ This is deliberate parser behaviour, not a missing feature flag: the hand-rolled ## Exit behaviour -| Outcome | Exit status | -|---|---| +| Outcome | Exit status | +| -------------------------------------------------------------------------------------- | ------------------------- | | Argument error (unknown flag, `--help`, `--version`, unpaired `--node`/`--capability`) | `2`, usage text on stderr | -| Session-start failure | `2`, error on stderr | -| Clean window close | `0` | +| Session-start failure | `2`, error on stderr | +| Clean window close | `0` | `id-native-shell` is the only binary in the workspace with a hand-coded exit code. The `id` binary exits `1` on handler errors and `2` only on clap parse errors; here both argument errors and session-start failures exit `2`. diff --git a/pkgs/id/book/reference/repl.md b/pkgs/id/book/reference/repl.md index 747d1d7a46..d6cd685c46 100644 --- a/pkgs/id/book/reference/repl.md +++ b/pkgs/id/book/reference/repl.md @@ -6,12 +6,12 @@ The interactive REPL is a second command language inside the `id` binary. It doe ## Entry -| Invocation | Behaviour | -|---|---| -| `id` (no subcommand) | Starts the REPL with no session target. | -| `id repl` | Starts the REPL with no session target. | -| `id repl [NODE]` | Starts the REPL with `NODE` as the session-level remote target. `NODE` must be a 64-character hex node ID. | -| `id shell` | Hidden alias for `id repl`. | +| Invocation | Behaviour | +| -------------------- | ---------------------------------------------------------------------------------------------------------- | +| `id` (no subcommand) | Starts the REPL with no session target. | +| `id repl` | Starts the REPL with no session target. | +| `id repl [NODE]` | Starts the REPL with `NODE` as the session-level remote target. `NODE` must be a 64-character hex node ID. | +| `id shell` | Hidden alias for `id repl`. | An invalid session target fails startup before the prompt appears: @@ -25,11 +25,11 @@ Startup failures of this kind, and failures to open the store, exit with status The mode is detected at startup and printed in the banner as `id repl ()`. -| Mode | Condition | Where operations run | -|---|---|---| -| `Local` | No serve is running for the data directory. | Directly against the local store. | -| `Remote` | The serve lock `.iroh-serve.lock` is present in the data directory. | Proxied to the local `id serve` process. | -| `RemoteNode` | Started as `id repl ` with a valid node ID. | Against that remote node for the whole session. | +| Mode | Condition | Where operations run | +| ------------ | ------------------------------------------------------------------- | ----------------------------------------------- | +| `Local` | No serve is running for the data directory. | Directly against the local store. | +| `Remote` | The serve lock `.iroh-serve.lock` is present in the data directory. | Proxied to the local `id serve` process. | +| `RemoteNode` | Started as `id repl ` with a valid node ID. | Against that remote node for the whole session. | The session target is fixed at startup. In local-serve (`Remote`) mode, individual commands can additionally be aimed at another node with the `@NODE_ID` syntax described below. @@ -47,34 +47,34 @@ The dispatch in `runner.rs` implements 20 command groups, and the banner now nam In the table, ◐ marks the commands that also accept an `@NODE_ID` target as the second token. All other commands run against the session target only. -| Command | Arguments | Behaviour | -|---|---|---| -| `list` / `ls` ◐ | — | List stored files. | -| `put [NAME]` ◐ | File path, optional stored name | Store a file. `NAME` defaults to the file name. Only the `put` spelling accepts `@NODE_ID`; the `in` alias does not. | -| `in [NAME]` | File path, optional stored name | Alias of `put` (no `@NODE_ID` form). | -| `get [OUTPUT]` ◐ | Stored name, optional output path | Fetch a file. `OUTPUT` defaults to `NAME`; `-` writes to stdout. | -| `cat ` ◐ | Stored name | Print a file to stdout. Only the `cat` spelling accepts `@NODE_ID`. | -| `output ` / `out ` | Stored name | Aliases of `cat` (no `@NODE_ID` form). | -| `gethash ` | 64-hex content hash, output path | Fetch by hash. Both arguments are required. `-` writes to stdout. No `@NODE_ID` form. | -| `delete ` / `rm ` ◐ | Stored name | Delete a stored file. REPL-only: the clap CLI has no delete command. | -| `rename ` | Two stored names | Rename a stored file. REPL-only. No `@NODE_ID` form. | -| `copy ` / `cp ` | Two stored names | Copy a stored file to a new name. REPL-only. | -| `send [DEST_NAME]` | Stored name, destination node ID, optional destination name | Server-to-server copy: the source server pushes with its own identity and no bytes pass through this client. | -| `send --replace [DEST_NAME]` | As above | As above, archiving the old destination file first. `--replace` is recognised only in that exact second position. | -| `peers` ◐ | — | List peers. | -| `find ... [flags]` | Queries plus hand-parsed flags | Find and fetch matches; see "Search commands" below. | -| `search ... [flags]` | Queries plus hand-parsed flags | List matches; fetches nothing. | -| `show ... [flags]` / `view ...` | Queries plus hand-parsed flags | Show match content. | -| `peek ... [flags]` | Queries plus hand-parsed flags | Preview match content. | -| `tag set [VALUE]` | File, key, optional value | Set a file metadata tag. The head word may be `tag`, `label` or `link`; `set` may be `add`. | -| `tag del [VALUE]` | File, key, optional value | Delete a tag value, or every value for the key when `VALUE` is omitted. `del` may be `rm`, `remove`, `rem`, `delete` or `unset`. | -| `tag list [FILE]` / `tag ls [FILE]` | Optional file | List tags. | -| `tags [FILE]` / `labels [FILE]` / `links [FILE]` | Optional file | Bare forms of `tag list`. | -| `tag search ...` / `tag find ...` | Structured query terms | Search tags; same structured syntax as the clap `tag search` in [The tag family](cli-tags.md). A bare `tag search` with no query prints usage instead of erroring. | -| `migrate-tags` / `migrate` | — | Add the `name`/`file` auto-tags where missing; never overwrites. | -| `help` / `?` | — | Print the REPL help text. | -| `quit` / `exit` / `q` | — | Leave the REPL; exit status `0`. | -| `!` | Shell command line | Shell escape; see below. | +| Command | Arguments | Behaviour | +| ------------------------------------------------ | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `list` / `ls` ◐ | — | List stored files. | +| `put [NAME]` ◐ | File path, optional stored name | Store a file. `NAME` defaults to the file name. Only the `put` spelling accepts `@NODE_ID`; the `in` alias does not. | +| `in [NAME]` | File path, optional stored name | Alias of `put` (no `@NODE_ID` form). | +| `get [OUTPUT]` ◐ | Stored name, optional output path | Fetch a file. `OUTPUT` defaults to `NAME`; `-` writes to stdout. | +| `cat ` ◐ | Stored name | Print a file to stdout. Only the `cat` spelling accepts `@NODE_ID`. | +| `output ` / `out ` | Stored name | Aliases of `cat` (no `@NODE_ID` form). | +| `gethash ` | 64-hex content hash, output path | Fetch by hash. Both arguments are required. `-` writes to stdout. No `@NODE_ID` form. | +| `delete ` / `rm ` ◐ | Stored name | Delete a stored file. REPL-only: the clap CLI has no delete command. | +| `rename ` | Two stored names | Rename a stored file. REPL-only. No `@NODE_ID` form. | +| `copy ` / `cp ` | Two stored names | Copy a stored file to a new name. REPL-only. | +| `send [DEST_NAME]` | Stored name, destination node ID, optional destination name | Server-to-server copy: the source server pushes with its own identity and no bytes pass through this client. | +| `send --replace [DEST_NAME]` | As above | As above, archiving the old destination file first. `--replace` is recognised only in that exact second position. | +| `peers` ◐ | — | List peers. | +| `find ... [flags]` | Queries plus hand-parsed flags | Find and fetch matches; see "Search commands" below. | +| `search ... [flags]` | Queries plus hand-parsed flags | List matches; fetches nothing. | +| `show ... [flags]` / `view ...` | Queries plus hand-parsed flags | Show match content. | +| `peek ... [flags]` | Queries plus hand-parsed flags | Preview match content. | +| `tag set [VALUE]` | File, key, optional value | Set a file metadata tag. The head word may be `tag`, `label` or `link`; `set` may be `add`. | +| `tag del [VALUE]` | File, key, optional value | Delete a tag value, or every value for the key when `VALUE` is omitted. `del` may be `rm`, `remove`, `rem`, `delete` or `unset`. | +| `tag list [FILE]` / `tag ls [FILE]` | Optional file | List tags. | +| `tags [FILE]` / `labels [FILE]` / `links [FILE]` | Optional file | Bare forms of `tag list`. | +| `tag search ...` / `tag find ...` | Structured query terms | Search tags; same structured syntax as the clap `tag search` in [The tag family](cli-tags.md). A bare `tag search` with no query prints usage instead of erroring. | +| `migrate-tags` / `migrate` | — | Add the `name`/`file` auto-tags where missing; never overwrites. | +| `help` / `?` | — | Print the REPL help text. | +| `quit` / `exit` / `q` | — | Leave the REPL; exit status `0`. | +| `!` | Shell command line | Shell escape; see below. | ### REPL-only commands @@ -90,23 +90,23 @@ The REPL tag commands accept no value-encoding flags. `--value-hex` and `--value `find` and `search` share one hand parser. `show` and `peek` have their own, smaller flag sets. -| Flag | `find` / `search` | `show` / `view` | `peek` | -|---|---|---|---| -| `--name` | yes | yes | — | -| `--all` | yes | yes | yes | -| `--first [N]` | yes | yes | yes | -| `--last [N]` | yes | yes | yes | -| `--count` | yes | — | — | -| `--exclude ` | yes | yes | yes | -| `--dir ` | yes (`find` output directory) | — | — | -| `--format ` | yes | — | — | -| `--file` | yes | — | — | -| `>FILE` redirect token | yes | — | yes | -| `-o ` | — | yes | yes | -| `--lines ` / `-n ` | — | — | yes; default `5` | -| `--head-only` / `--tail-only` | — | — | yes | -| `--chars` / `--words` | — | — | yes | -| `--quiet` / `-q` | — | — | yes | +| Flag | `find` / `search` | `show` / `view` | `peek` | +| ------------------------------ | ----------------------------- | --------------- | ---------------- | +| `--name` | yes | yes | — | +| `--all` | yes | yes | yes | +| `--first [N]` | yes | yes | yes | +| `--last [N]` | yes | yes | yes | +| `--count` | yes | — | — | +| `--exclude ` | yes | yes | yes | +| `--dir ` | yes (`find` output directory) | — | — | +| `--format ` | yes | — | — | +| `--file` | yes | — | — | +| `>FILE` redirect token | yes | — | yes | +| `-o ` | — | yes | yes | +| `--lines ` / `-n ` | — | — | yes; default `5` | +| `--head-only` / `--tail-only` | — | — | yes | +| `--chars` / `--words` | — | — | yes | +| `--quiet` / `-q` | — | — | yes | Queries are case-insensitive. Match quality is exact, then prefix, then contains, over name and hash. There is no glob matching. @@ -148,13 +148,13 @@ Rules: Before dispatch, `preprocess_repl_line` in `input.rs` rewrites a line in this order: heredoc detection, then here-string, then the `|>` pipe, then `$(…)` and backtick substitution. The scans are quote- and nesting-aware: a `<<` or `|>` inside a `$(…)` or backtick span is shell source, not REPL syntax. -| Form | Example | Behaviour | -|---|---|---| -| Command substitution | `put $(date +%F) name` | Runs `sh -c` on the inner command, captures stdout, and stores it under `name`. The captured text travels through the line as a `__STDIN_CONTENT__:` marker token. | -| Backtick substitution | `` put `date +%F` name `` | Same capture as `$(…)`. | -| Pipe-in | `cmd \|> put - name` | Runs the left side as a shell command; its output becomes the `put` content. The `-` placeholder is the content slot. Only the `\|>` spelling exists. | -| Here-string | `put - name <<< 'text'` | Stores the literal text under `name`. Single and double quotes around the text are stripped. | -| Heredoc | `put - name <` marker token. | +| Backtick substitution | ``put `date +%F` name`` | Same capture as `$(…)`. | +| Pipe-in | `cmd \|> put - name` | Runs the left side as a shell command; its output becomes the `put` content. The `-` placeholder is the content slot. Only the `\|>` spelling exists. | +| Here-string | `put - name <<< 'text'` | Stores the literal text under `name`. Single and double quotes around the text are stripped. | +| Heredoc | `put - name <` flag replaces the `web_bindings` list from the embedded `defaults.json`; see [Configuration and environment](configuration.md). Multiple listeners can each be an Explorer listener, a program listener (`program:`), or a document target. @@ -30,20 +30,20 @@ Body limits: a router-wide default body limit applies, and `/api/upload` overrid Full HTML pages in the main router: -| Method | Path | Purpose | -|---|---|---| -| GET | `/` | Index / home: world list, globally-tagged documents, and a global-chat iframe. | -| GET | `/.well-known/id-transport-advertisement` | The transport advertisement document. | -| GET | `/files` | File browser page. | -| GET | `/world` | World page: the adapter surface for the hosted world. The path is the default; `AppState.web_route` parameterises it per app. | -| GET | `/settings` | Settings page. | -| GET | `/peers` | Discovered peers page. | -| GET | `/blocks` | Operator block-list page. | -| GET | `/groups` | Groups page. | -| GET | `/edit/{*name}` | Editor/viewer for a file **by name** (wildcard). | -| GET | `/hash/{hash}` | Redirect from a content hash to its named file. | -| GET | `/view/{*name}` | Read-only view of a file by name. | -| GET | `/blob/{hash}` | Raw blob bytes with a `Content-Type`. | +| Method | Path | Purpose | +| ------ | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| GET | `/` | Index / home: world list, globally-tagged documents, and a global-chat iframe. | +| GET | `/.well-known/id-transport-advertisement` | The transport advertisement document. | +| GET | `/files` | File browser page. | +| GET | `/world` | World page: the adapter surface for the hosted world. The path is the default; `AppState.web_route` parameterises it per app. | +| GET | `/settings` | Settings page. | +| GET | `/peers` | Discovered peers page. | +| GET | `/blocks` | Operator block-list page. | +| GET | `/groups` | Groups page. | +| GET | `/edit/{*name}` | Editor/viewer for a file **by name** (wildcard). | +| GET | `/hash/{hash}` | Redirect from a content hash to its named file. | +| GET | `/view/{*name}` | Read-only view of a file by name. | +| GET | `/blob/{hash}` | Raw blob bytes with a `Content-Type`. | ### Correct route spellings (WEB-1) @@ -57,32 +57,32 @@ The editor and view routes take a **name**, not a hash, and the name is a wildca ## HTTP API and partials -| Method | Path | Purpose | -|---|---|---| -| GET | `/api/files` | File list, as an HTML partial for SPA navigation. | -| GET | `/api/home/feed` | Home feed partial. | -| GET | `/api/peers` | Peers partial. | -| GET, POST | `/api/blocks` | List blocks / create a block. | -| POST | `/api/blocks/remove` | Remove a block. | -| POST | `/api/save` | Save editor content to the blob store. | -| POST | `/api/new` | Create a new named file. | -| POST | `/api/rename` | Rename, with optional archive of the original or replaced file. | -| POST | `/api/copy` | Copy a name to a new name. | -| POST | `/api/files/send` | Server-side send of file references to another server. | -| POST | `/api/download` | Download file content. | -| POST | `/api/delete` | Soft-delete a file. | -| POST | `/api/restore` | Restore a soft-deleted file. Returns `404` when the file is missing and `409` when it is not deleted. | -| POST | `/api/hard-delete` | Permanently delete a file. | -| POST | `/api/upload` | Image upload, multipart, with the route-scoped body limit. | -| GET | `/api/images` | Image listing, paged, with a cursor clamped to the result set. | -| GET, POST, DELETE | `/api/tags` | Get, set or delete tags. DELETE modes: exact match, `all: true`, and `all_values: true`. Binary values travel as `value_b64`. The tag wire protocol is in [WebSocket protocols](websockets.md). | -| GET | `/api/tags/search` | Structured tag search: `q` and `ns` parameters; `key:`, `:value`, `key:value`, quoted and bare terms, ANDed. | -| POST | `/api/identity/register` | Register a web client identity. Bounded by `ID_WEB_MAX_IDENTITIES`; see [Configuration and environment](configuration.md). | -| GET | `/api/identity/me` | The current identity. | -| POST | `/api/identity/name` | Update the identity display name. | -| POST | `/api/seitan/invite` | Seitan admission: create an invite. | -| POST | `/api/seitan/admit` | Seitan admission: admit with an invite. | -| GET | `/assets/{*path}` | Embedded static assets; see "Assets" below. | +| Method | Path | Purpose | +| ----------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| GET | `/api/files` | File list, as an HTML partial for SPA navigation. | +| GET | `/api/home/feed` | Home feed partial. | +| GET | `/api/peers` | Peers partial. | +| GET, POST | `/api/blocks` | List blocks / create a block. | +| POST | `/api/blocks/remove` | Remove a block. | +| POST | `/api/save` | Save editor content to the blob store. | +| POST | `/api/new` | Create a new named file. | +| POST | `/api/rename` | Rename, with optional archive of the original or replaced file. | +| POST | `/api/copy` | Copy a name to a new name. | +| POST | `/api/files/send` | Server-side send of file references to another server. | +| POST | `/api/download` | Download file content. | +| POST | `/api/delete` | Soft-delete a file. | +| POST | `/api/restore` | Restore a soft-deleted file. Returns `404` when the file is missing and `409` when it is not deleted. | +| POST | `/api/hard-delete` | Permanently delete a file. | +| POST | `/api/upload` | Image upload, multipart, with the route-scoped body limit. | +| GET | `/api/images` | Image listing, paged, with a cursor clamped to the result set. | +| GET, POST, DELETE | `/api/tags` | Get, set or delete tags. DELETE modes: exact match, `all: true`, and `all_values: true`. Binary values travel as `value_b64`. The tag wire protocol is in [WebSocket protocols](websockets.md). | +| GET | `/api/tags/search` | Structured tag search: `q` and `ns` parameters; `key:`, `:value`, `key:value`, quoted and bare terms, ANDed. | +| POST | `/api/identity/register` | Register a web client identity. Bounded by `ID_WEB_MAX_IDENTITIES`; see [Configuration and environment](configuration.md). | +| GET | `/api/identity/me` | The current identity. | +| POST | `/api/identity/name` | Update the identity display name. | +| POST | `/api/seitan/invite` | Seitan admission: create an invite. | +| POST | `/api/seitan/admit` | Seitan admission: admit with an invite. | +| GET | `/assets/{*path}` | Embedded static assets; see "Assets" below. | The delete pair is a web-layer construction: `/api/delete` and `/api/restore` implement soft delete on top of the FileOps hard delete described in [Data stores and schemas](data-stores.md). @@ -90,38 +90,38 @@ The delete pair is a web-layer construction: `/api/delete` and `/api/restore` im These 9 paths are merged into the main router always. The WebSocket socket path comes from `[interfaces.web]` in the app's `app.toml` and defaults to `/ws/world`; see [Configuration and environment](configuration.md). -| Method | Path | Purpose | -|---|---|---| -| POST | `/api/world/invite` | Mint a world guest invite. Fields: `display_name`, optional `world`, `expires_in_secs`, `uses`. | -| GET | `/api/world/host-view` | Host view: snapshot, surface, and paged records. Paging uses an `after` cursor; the records revision is an FNV-1a 53-bit value. | -| GET | `/api/world/metrics` | World host metrics. | -| GET, POST | `/api/world/directory` | Directory read / signed directory write action. | -| GET | `/explore` | Script-free HTML directory explorer: forms only, strict CSP `default-src 'none'`. | -| POST | `/explore/login` | Explorer login: an admin token is exchanged for the `id_explore` session cookie, scoped to path `/explore`. | -| POST | `/explore/act` | Explorer directory action. | -| GET | `/invite` | Invite landing page. | -| WS | `/ws/world` (default socket) | World session bridge; the frame protocol is in [WebSocket protocols](websockets.md). | +| Method | Path | Purpose | +| --------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| POST | `/api/world/invite` | Mint a world guest invite. Fields: `display_name`, optional `world`, `expires_in_secs`, `uses`. | +| GET | `/api/world/host-view` | Host view: snapshot, surface, and paged records. Paging uses an `after` cursor; the records revision is an FNV-1a 53-bit value. | +| GET | `/api/world/metrics` | World host metrics. | +| GET, POST | `/api/world/directory` | Directory read / signed directory write action. | +| GET | `/explore` | Script-free HTML directory explorer: forms only, strict CSP `default-src 'none'`. | +| POST | `/explore/login` | Explorer login: an admin token is exchanged for the `id_explore` session cookie, scoped to path `/explore`. | +| POST | `/explore/act` | Explorer directory action. | +| GET | `/invite` | Invite landing page. | +| WS | `/ws/world` (default socket) | World session bridge; the frame protocol is in [WebSocket protocols](websockets.md). | ## Program gallery routes These 7 paths are merged into the main router always. Every one of them answers `404` unless a gallery was wired in with `--gallery-dir` or `ID_GALLERY_DIR`. The operator commands behind them are in [Gallery, match-audit and walk](cli-gallery-walk.md). -| Method | Path | Purpose | -|---|---|---| -| GET | `/api/gallery/records` | Signed bundle records list. Filters: `?author=` and `?name=`. | -| GET | `/api/gallery/bundles/{content_hash}` | Bundle bytes, immutable cache. Answers `410 Gone`, with a transparency entry, when the bundle is unlisted here. | -| GET | `/api/gallery/search` | Search with `?q=`, `?category=`, `?limit=`. Result order: exact-name, then category, then most-recent-version. | -| GET | `/api/gallery/authors/{author}` | Author page by key. | -| GET | `/api/gallery/collections` | Operator-signed featured collections. | -| GET | `/api/gallery/collections/{operator}/{name}` | One collection. | -| GET | `/api/gallery/transparency` | Removals, refusals and reinstatements, plus the admission posture. Paging: `?after=` and `?limit=`. | +| Method | Path | Purpose | +| ------ | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| GET | `/api/gallery/records` | Signed bundle records list. Filters: `?author=` and `?name=`. | +| GET | `/api/gallery/bundles/{content_hash}` | Bundle bytes, immutable cache. Answers `410 Gone`, with a transparency entry, when the bundle is unlisted here. | +| GET | `/api/gallery/search` | Search with `?q=`, `?category=`, `?limit=`. Result order: exact-name, then category, then most-recent-version. | +| GET | `/api/gallery/authors/{author}` | Author page by key. | +| GET | `/api/gallery/collections` | Operator-signed featured collections. | +| GET | `/api/gallery/collections/{operator}/{name}` | One collection. | +| GET | `/api/gallery/transparency` | Removals, refusals and reinstatements, plus the admission posture. Paging: `?after=` and `?limit=`. | ## WebSocket routes -| Path | Protocol | -|---|---| -| `/ws/collab/{doc_id}` | Collaborative editing, binary MessagePack. | -| `/ws/tags` | Tag-change broadcast, JSON text, server to client only. | +| Path | Protocol | +| --------------------- | ------------------------------------------------------- | +| `/ws/collab/{doc_id}` | Collaborative editing, binary MessagePack. | +| `/ws/tags` | Tag-change broadcast, JSON text, server to client only. | Both protocols are specified in full in [WebSocket protocols](websockets.md). @@ -139,14 +139,14 @@ A publication mount serves exactly this router under a mounted prefix. A file's content mode is decided from its extension, and for text modes from its content: -| Mode | Selected for | Wire name | -|---|---|---| -| `Media(Image\|Video\|Audio\|Pdf)` | Media and PDF extensions | `media` | -| `Rich` | `.pm.json` ProseMirror JSON | `rich` | -| `Markdown` | `.md`, `.markdown` | `markdown` | -| `Plain` | `.txt` | `plain` | -| `Raw` | A long list of code and config extensions; also the default for unknown or missing extensions | `raw` | -| `Binary` | Only when a text-mode file is not valid UTF-8 | `binary` | +| Mode | Selected for | Wire name | +| --------------------------------- | --------------------------------------------------------------------------------------------- | ---------- | +| `Media(Image\|Video\|Audio\|Pdf)` | Media and PDF extensions | `media` | +| `Rich` | `.pm.json` ProseMirror JSON | `rich` | +| `Markdown` | `.md`, `.markdown` | `markdown` | +| `Plain` | `.txt` | `plain` | +| `Raw` | A long list of code and config extensions; also the default for unknown or missing extensions | `raw` | +| `Binary` | Only when a text-mode file is not valid UTF-8 | `binary` | Editable modes: Rich, Markdown, Plain, Raw. Toolbar modes: Rich, Markdown, Plain. `get_content_type` maps extensions to MIME types and defaults to `application/octet-stream`. @@ -168,11 +168,11 @@ Serving: `web/dist` is embedded into the binary at compile time with `rust-embed The cache contract is derived from the emitted file name: -| File | Cache header | -|---|---| +| File | Cache header | +| -------------------------------------- | ------------------------------------- | | `main.<8 base36>.js` and its `.js.map` | `public, max-age=31536000, immutable` | -| `styles.<8 lower-hex>.css` | `public, max-age=31536000, immutable` | -| Everything else | `no-cache` | +| `styles.<8 lower-hex>.css` | `public, max-age=31536000, immutable` | +| Everything else | `no-cache` | `WEB.md` names the assets `main.css` and `main.js`. The build never emits either name. That is disagreement WEB-4; the hashed names above are what `assets.rs` recognises. diff --git a/pkgs/id/book/reference/websockets.md b/pkgs/id/book/reference/websockets.md index 4624523e96..0f7a05d98a 100644 --- a/pkgs/id/book/reference/websockets.md +++ b/pkgs/id/book/reference/websockets.md @@ -4,31 +4,31 @@ Source: https://github.com/developing-today/code/blob/main/pkgs/id/crates/id-web `id serve --web` exposes three WebSocket protocols. Their routes are listed in [The web UI: pages and HTTP API](web-ui.md); this chapter is the wire reference for each. -| Socket | Route | Encoding | Direction | -|---|---|---|---| -| Collab | `/ws/collab/{doc_id}` | Binary MessagePack | Both | -| Tags | `/ws/tags` | JSON text | Server to client only | -| World bridge | `/ws/world` (default; from `[interfaces.web]`) | JSON text | Both | +| Socket | Route | Encoding | Direction | +| ------------ | ---------------------------------------------- | ------------------ | --------------------- | +| Collab | `/ws/collab/{doc_id}` | Binary MessagePack | Both | +| Tags | `/ws/tags` | JSON text | Server to client only | +| World bridge | `/ws/world` (default; from `[interfaces.web]`) | JSON text | Both | ## Collab: collaborative editing Implementation: `crates/id-web/src/collab.rs`. Frames are MessagePack arrays of the form `[tag, …fields]`, encoded and decoded with `rmp_serde`. The message type is `CollabMessage`. -| Tag | Name | Direction | Fields | -|---|---|---|---| -| 0 | Init | Server → client | `[0, version, doc, mode]` | -| 1 | Steps | Client → server | `[1, version, steps, clientID]` | -| 2 | Update | Server → client | `[2, steps, clientIDs]` | -| 3 | Ack | Server → client | `[3, version]` | -| 4 | Cursor | Both | `[4, clientID, head, anchor, name?, idleSecs?]` | -| 5 | Error | Server → client | `[5, error]` | -| 6 | CursorRemove | Server → client | `[6, clientID]` | -| 7 | NewVersion | Server → client | `[7, hash, name]` | -| 8 | Auth | Client → server | `[8, token]` — the first message after connect | -| 9 | AuthOk | Server → client | `[9, client_id, name, token?]` — the `token` field carries a refreshed token when one is issued | -| 10 | Checkpoint | Client → server | `[10, text]` — publish a durable note-session checkpoint. Filename sessions refuse this message. | -| 11 | Checkpointed | Server → client | `[11, head]` — `head` is the hex of the new note head revision | -| — | Empty text `""` | Both | Cursor-refresh ping/pong for throttled inactive tabs; see the cadence below | +| Tag | Name | Direction | Fields | +| --- | --------------- | --------------- | ------------------------------------------------------------------------------------------------ | +| 0 | Init | Server → client | `[0, version, doc, mode]` | +| 1 | Steps | Client → server | `[1, version, steps, clientID]` | +| 2 | Update | Server → client | `[2, steps, clientIDs]` | +| 3 | Ack | Server → client | `[3, version]` | +| 4 | Cursor | Both | `[4, clientID, head, anchor, name?, idleSecs?]` | +| 5 | Error | Server → client | `[5, error]` | +| 6 | CursorRemove | Server → client | `[6, clientID]` | +| 7 | NewVersion | Server → client | `[7, hash, name]` | +| 8 | Auth | Client → server | `[8, token]` — the first message after connect | +| 9 | AuthOk | Server → client | `[9, client_id, name, token?]` — the `token` field carries a refreshed token when one is issued | +| 10 | Checkpoint | Client → server | `[10, text]` — publish a durable note-session checkpoint. Filename sessions refuse this message. | +| 11 | Checkpointed | Server → client | `[11, head]` — `head` is the hex of the new note head revision | +| — | Empty text `""` | Both | Cursor-refresh ping/pong for throttled inactive tabs; see the cadence below | Compatibility: a legacy Init frame without the `mode` field still decodes; `mode` defaults to `raw`. @@ -42,17 +42,17 @@ The `web/README` wire table lists tags 0–5 only, and gives Init as `[0, versio ### Keepalive, timeouts and cleanup -| Constant | Value | Behaviour | -|---|---|---| -| `PING_INTERVAL` | 30 s of inactivity | A Ping is sent every 30 s idle cycle. | -| `EMPTY_TEXT_MESSAGE_EVERY_N_PINGS` | `2` | Every 2nd ping cycle sends the empty text message `""` **instead of** a Ping frame. | -| `PONG_TIMEOUT` | 30 min | The connection is closed after 30 min without a pong or message. | -| Cursor removal | 5 min after disconnect | A disconnected client's cursor is removed. | -| Document cleanup | 1 h after the last client leaves | The document's in-memory collab state is cleaned up. | +| Constant | Value | Behaviour | +| ---------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------- | +| `PING_INTERVAL` | 30 s of inactivity | A Ping is sent every 30 s idle cycle. | +| `EMPTY_TEXT_MESSAGE_EVERY_N_PINGS` | `2` | Every 2nd ping cycle sends the empty text message `""` **instead of** a Ping frame. | +| `PONG_TIMEOUT` | 30 min | The connection is closed after 30 min without a pong or message. | +| Cursor removal | 5 min after disconnect | A disconnected client's cursor is removed. | +| Document cleanup | 1 h after the last client leaves | The document's in-memory collab state is cleaned up. | ### The empty-text cadence (WEB-8) -The `web/README` timeout section states that the server sends empty text messages *instead of* Ping frames. The code sends both: a Ping frame on each 30 s idle cycle, with every 2nd cycle's Ping replaced by the empty text message. A client must therefore handle Ping frames and empty text frames on the same socket. That is disagreement WEB-8; the cadence in the table above is the code behaviour. +The `web/README` timeout section states that the server sends empty text messages _instead of_ Ping frames. The code sends both: a Ping frame on each 30 s idle cycle, with every 2nd cycle's Ping replaced by the empty text message. A client must therefore handle Ping frames and empty text frames on the same socket. That is disagreement WEB-8; the cadence in the table above is the code behaviour. ### Worked example @@ -79,12 +79,12 @@ Route: `/ws/tags`. Implementation: `crates/id-web/src/tags_ws.rs`; the event typ `TagEvent` is serialised with `#[serde(tag = "type")]` and lowercase renames. The four kinds are: -| `type` | Fields | Meaning | -|---|---|---| -| `set` | `ns`, `subject`, `key`, `value?` | A tag value was set. | -| `del` | `ns`, `subject`, `key`, `value?` | A tag value was deleted; `value` absent means the key's values were deleted. | -| `del_all` | `ns`, `subject` | All tags for the subject were deleted. | -| `transfer` | `ns`, `from`, `to`, `count` | `count` tags moved from subject `from` to subject `to`. | +| `type` | Fields | Meaning | +| ---------- | -------------------------------- | ---------------------------------------------------------------------------- | +| `set` | `ns`, `subject`, `key`, `value?` | A tag value was set. | +| `del` | `ns`, `subject`, `key`, `value?` | A tag value was deleted; `value` absent means the key's values were deleted. | +| `del_all` | `ns`, `subject` | All tags for the subject were deleted. | +| `transfer` | `ns`, `from`, `to`, `count` | `count` tags moved from subject `from` to subject `to`. | Namespaces: `ns` is `global` (the default), `node`, or a custom paired (α/Ω) namespace. Tag values are arbitrary bytes on the store side; the REST surface in [The web UI: pages and HTTP API](web-ui.md) carries binary values as `value_b64`. @@ -117,91 +117,91 @@ Rules that apply to every frame: ### Client frames: 43 kinds -| Kind | Notes | -|---|---| -| `join` | Fields: `capability`, optional `after`, `screen_patches`, `screen_msgpack`, `resume_token`, `agent_profile`, `device_input`. | -| `info` | Session information request. | -| `metrics` | Metrics request. | -| `records` | Records request. | -| `records_ticket` | Records ticket request. | -| `documents` | Document list request. | -| `document` | Single document request. | -| `download_module` | Module download. | -| `download_module_admin` | Module download, admin form. | -| `event_history_admin` | Event history, admin form. | -| `invite` | Carries an `admin_token`. | -| `directory` | Public directory request; no token. | -| `list_worlds` | List worlds on the host. | -| `create_world` | Create a world. | -| `set_isolation` | Set a world's isolation state. | -| `set_cross_world_write` | Set cross-world write. | -| `force_cross_world_write` | Force cross-world write on. | -| `set_file_scope` | Set file scope. | -| `compile` | Compile a module. | -| `update_caps` | Update capabilities. | -| `set_caps_ceiling` | Set the capability ceiling. | -| `set_schedule` | Set a schedule. | -| `cancel_schedule` | Cancel a schedule. | -| `world_state` | World state request. | -| `set_execution_profile` | Set the execution profile. | -| `execution_profile_info` | Execution profile information request. | -| `caps` | Capability query. | -| `chat` | Chat post. May carry `screen_revision`, the stale-decision token checked by the policy layer in [The MCP bridge](mcp.md). | -| `form_result` | A submitted form result. | -| `attenuate` | Attenuate a capability. | -| `delegate_to_friend` | Delegate to a friend. | -| `input` | Program input; the payload travels as `data_hex`. | -| `resize` | Terminal/surface resize. | -| `paste` | Paste input. | -| `screen_subscribe` | Subscribe to a screen region and/or to event classes. | -| `pointer` | Pointer input. | -| `hover` | Hover input. | -| `install_begin` | Begin a module install upload. | -| `install_chunk` | One install chunk. | -| `install_end` | Finish a module install upload. | -| `revoke` | Revoke a capability. | -| `provider_offer` | Provider offer. | -| `provider_reply` | Provider reply. | +| Kind | Notes | +| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `join` | Fields: `capability`, optional `after`, `screen_patches`, `screen_msgpack`, `resume_token`, `agent_profile`, `device_input`. | +| `info` | Session information request. | +| `metrics` | Metrics request. | +| `records` | Records request. | +| `records_ticket` | Records ticket request. | +| `documents` | Document list request. | +| `document` | Single document request. | +| `download_module` | Module download. | +| `download_module_admin` | Module download, admin form. | +| `event_history_admin` | Event history, admin form. | +| `invite` | Carries an `admin_token`. | +| `directory` | Public directory request; no token. | +| `list_worlds` | List worlds on the host. | +| `create_world` | Create a world. | +| `set_isolation` | Set a world's isolation state. | +| `set_cross_world_write` | Set cross-world write. | +| `force_cross_world_write` | Force cross-world write on. | +| `set_file_scope` | Set file scope. | +| `compile` | Compile a module. | +| `update_caps` | Update capabilities. | +| `set_caps_ceiling` | Set the capability ceiling. | +| `set_schedule` | Set a schedule. | +| `cancel_schedule` | Cancel a schedule. | +| `world_state` | World state request. | +| `set_execution_profile` | Set the execution profile. | +| `execution_profile_info` | Execution profile information request. | +| `caps` | Capability query. | +| `chat` | Chat post. May carry `screen_revision`, the stale-decision token checked by the policy layer in [The MCP bridge](mcp.md). | +| `form_result` | A submitted form result. | +| `attenuate` | Attenuate a capability. | +| `delegate_to_friend` | Delegate to a friend. | +| `input` | Program input; the payload travels as `data_hex`. | +| `resize` | Terminal/surface resize. | +| `paste` | Paste input. | +| `screen_subscribe` | Subscribe to a screen region and/or to event classes. | +| `pointer` | Pointer input. | +| `hover` | Hover input. | +| `install_begin` | Begin a module install upload. | +| `install_chunk` | One install chunk. | +| `install_end` | Finish a module install upload. | +| `revoke` | Revoke a capability. | +| `provider_offer` | Provider offer. | +| `provider_reply` | Provider reply. | ### Server frames: 35 kinds -| Kind | Notes | -|---|---| -| `snapshot` | Full world snapshot. | -| `event` | A world event. | -| `provider_request` | A provider request to the client. | -| `form_result_status` | Status of a form result. | -| `view` | Screen view: `data`/`surface`/`patch`, plus `view_revision` and `resume_token`. | -| `semantic_diff` | A semantic diff of the screen state. | -| `screen_subscription` | A screen subscription delivery. | -| `module_info` | Module information. | -| `metrics` | Metrics reply. | -| `records` | Records reply. | -| `records_ticket` | Records ticket reply. | -| `documents` | Documents reply. | -| `document` | Document reply. | -| `module_begin` | Begin a module download. | -| `module_chunk` | One module chunk. | -| `module_end` | End a module download. | -| `event_history_begin` | Begin an event history download. | -| `event_history_event` | One event history entry. | -| `invite` | Invite reply. | -| `worlds` | World list reply. | -| `world_created` | A world was created. | -| `isolation` | Isolation state. | -| `policy` | Policy state. | -| `caps` | Capability reply. | -| `execution_profile` | Execution profile reply. | -| `caps_ceiling` | Capability ceiling reply. | -| `schedules` | Schedules reply. | -| `world_state` | World state reply. | -| `compiled` | A compile finished. | -| `upload_ready` | The host is ready for an install upload. | -| `module_installed` | A module was installed. | -| `revoked` | A capability was revoked. | -| `program_changed` | The program changed. | -| `error` | An error. May carry a stable `code`, for example `actor_denied`. | -| `input_refused` | An `input` frame was refused. | +| Kind | Notes | +| --------------------- | ------------------------------------------------------------------------------- | +| `snapshot` | Full world snapshot. | +| `event` | A world event. | +| `provider_request` | A provider request to the client. | +| `form_result_status` | Status of a form result. | +| `view` | Screen view: `data`/`surface`/`patch`, plus `view_revision` and `resume_token`. | +| `semantic_diff` | A semantic diff of the screen state. | +| `screen_subscription` | A screen subscription delivery. | +| `module_info` | Module information. | +| `metrics` | Metrics reply. | +| `records` | Records reply. | +| `records_ticket` | Records ticket reply. | +| `documents` | Documents reply. | +| `document` | Document reply. | +| `module_begin` | Begin a module download. | +| `module_chunk` | One module chunk. | +| `module_end` | End a module download. | +| `event_history_begin` | Begin an event history download. | +| `event_history_event` | One event history entry. | +| `invite` | Invite reply. | +| `worlds` | World list reply. | +| `world_created` | A world was created. | +| `isolation` | Isolation state. | +| `policy` | Policy state. | +| `caps` | Capability reply. | +| `execution_profile` | Execution profile reply. | +| `caps_ceiling` | Capability ceiling reply. | +| `schedules` | Schedules reply. | +| `world_state` | World state reply. | +| `compiled` | A compile finished. | +| `upload_ready` | The host is ready for an install upload. | +| `module_installed` | A module was installed. | +| `revoked` | A capability was revoked. | +| `program_changed` | The program changed. | +| `error` | An error. May carry a stable `code`, for example `actor_denied`. | +| `input_refused` | An `input` frame was refused. | ### Contract revisions diff --git a/pkgs/id/browser/package.json b/pkgs/id/browser/package.json index 0a131ca663..949135912c 100644 --- a/pkgs/id/browser/package.json +++ b/pkgs/id/browser/package.json @@ -1 +1,13 @@ -{"description":"Opt-in IndexedDB request-batch adapter for the ID record-store port, checked against the shared conformance fixtures in Chromium (#9082).","devDependencies":{"typescript":"^5.6.0"},"name":"id-browser","private":true,"scripts":{"test":"node --experimental-transform-types --test test/indexeddb_conformance.test.ts","typecheck":"tsc --noEmit"},"type":"module"} \ No newline at end of file +{ + "description": "Opt-in IndexedDB request-batch adapter for the ID record-store port, checked against the shared conformance fixtures in Chromium (#9082).", + "devDependencies": { + "typescript": "^5.6.0" + }, + "name": "id-browser", + "private": true, + "scripts": { + "test": "node --experimental-transform-types --test test/indexeddb_conformance.test.ts", + "typecheck": "tsc --noEmit" + }, + "type": "module" +} diff --git a/pkgs/id/browser/src/indexeddb_store.ts b/pkgs/id/browser/src/indexeddb_store.ts index 90cee344f7..b307b6b405 100644 --- a/pkgs/id/browser/src/indexeddb_store.ts +++ b/pkgs/id/browser/src/indexeddb_store.ts @@ -38,11 +38,7 @@ export interface StoreWrite { value: string | null; } -export type RefusalKind = - | "unsupported-capability" - | "version-mismatch" - | "conditional" - | "limit-exceeded"; +export type RefusalKind = "unsupported-capability" | "version-mismatch" | "conditional" | "limit-exceeded"; /** A contract refusal, mirroring `PortError` in the Rust port. */ export class PortRefusal extends Error { @@ -105,11 +101,7 @@ export const INDEXEDDB_DESCRIPTOR: IndexedDbDescriptor = { contract_version: PORT_CONTRACT_VERSION, scope: "browser", required_capabilities: [], - optional_capabilities: [ - "store.scan", - "store.txn.multi-record", - "store.txn.whole-database", - ], + optional_capabilities: ["store.scan", "store.txn.multi-record", "store.txn.whole-database"], guarantees: { ordered: false, durable: true, @@ -140,10 +132,7 @@ function descriptorAdvertises(capability: string): boolean { * the protocol version is checked first, then every required * capability must be advertised. Refusals happen before any write. */ -export function negotiate( - requiredCapabilities: string[], - protocolVersion: number = PORT_CONTRACT_VERSION, -): string[] { +export function negotiate(requiredCapabilities: string[], protocolVersion: number = PORT_CONTRACT_VERSION): string[] { if (protocolVersion !== INDEXEDDB_DESCRIPTOR.contract_version) { throw new PortRefusal( "version-mismatch", @@ -211,16 +200,14 @@ export function resolveOutcome(reported: string): string { function requestDone(request: IDBRequest): Promise { return new Promise((resolve, reject) => { request.onsuccess = () => resolve(request.result); - request.onerror = () => - reject(request.error ?? new Error("IndexedDB request failed")); + request.onerror = () => reject(request.error ?? new Error("IndexedDB request failed")); }); } function transactionDone(transaction: IDBTransaction): Promise { return new Promise((resolve, reject) => { transaction.oncomplete = () => resolve(); - transaction.onabort = () => - reject(transaction.error ?? new Error("IndexedDB transaction aborted")); + transaction.onabort = () => reject(transaction.error ?? new Error("IndexedDB transaction aborted")); transaction.onerror = () => { // A request error aborts the transaction; onabort reports it. }; @@ -246,16 +233,9 @@ export class IndexedDbStore { * Reopening with a higher version and additional namespaces is * the upgrade path; existing stores and records are preserved. */ - static async open( - name: string, - namespaces: string[], - version = 1, - ): Promise { + static async open(name: string, namespaces: string[], version = 1): Promise { if (namespaces.includes(META_STORE)) { - throw new PortRefusal( - "unsupported-capability", - `namespace ${META_STORE} is reserved for operation-ID records`, - ); + throw new PortRefusal("unsupported-capability", `namespace ${META_STORE} is reserved for operation-ID records`); } const db = await new Promise((resolve, reject) => { const request = indexedDB.open(name, version); @@ -301,8 +281,7 @@ export class IndexedDbStore { await new Promise((resolve, reject) => { const request = indexedDB.deleteDatabase(name); request.onsuccess = () => resolve(); - request.onerror = () => - reject(request.error ?? new Error("IndexedDB delete failed")); + request.onerror = () => reject(request.error ?? new Error("IndexedDB delete failed")); // onblocked is informational: the delete proceeds once the // remaining connections close; it is not a failure. }); @@ -314,10 +293,7 @@ export class IndexedDbStore { private assertNamespace(namespace: string): void { if (!this.namespaces.includes(namespace)) { - throw new PortRefusal( - "unsupported-capability", - `namespace ${namespace} was not declared at open time`, - ); + throw new PortRefusal("unsupported-capability", `namespace ${namespace} was not declared at open time`); } } @@ -333,15 +309,10 @@ export class IndexedDbStore { * Resolves `"committed"` when the transaction completes; rejects * if it aborts. */ - async commitBatch( - opId: string, - writes: StoreWrite[], - ): Promise<"committed"> { + async commitBatch(opId: string, writes: StoreWrite[]): Promise<"committed"> { checkCommit(writes); for (const write of writes) this.assertNamespace(write.namespace); - const stores = [ - ...new Set([...writes.map((write) => write.namespace), META_STORE]), - ]; + const stores = [...new Set([...writes.map((write) => write.namespace), META_STORE])]; const transaction = this.db.transaction(stores, "readwrite"); const done = transactionDone(transaction); const meta = transaction.objectStore(META_STORE); @@ -363,9 +334,7 @@ export class IndexedDbStore { async get(namespace: string, id: string): Promise { this.assertNamespace(namespace); const transaction = this.db.transaction(namespace, "readonly"); - const value = await requestDone( - transaction.objectStore(namespace).get(id), - ); + const value = await requestDone(transaction.objectStore(namespace).get(id)); return value as string | undefined; } @@ -381,9 +350,6 @@ export class IndexedDbStore { const valuesRequest = store.getAll(); const keys = await requestDone(keysRequest); const values = await requestDone(valuesRequest); - return keys.map((key, index) => [ - String(key), - values[index] as string, - ]); + return keys.map((key, index) => [String(key), values[index] as string]); } } diff --git a/pkgs/id/browser/test/browser_driver.ts b/pkgs/id/browser/test/browser_driver.ts index 81a1a85dde..cd30dcd0dd 100644 --- a/pkgs/id/browser/test/browser_driver.ts +++ b/pkgs/id/browser/test/browser_driver.ts @@ -73,10 +73,7 @@ async function runVectors( case "commit_batch": { let observation: string; try { - observation = await store.commitBatch( - step.op_id as string, - parseWrites(step), - ); + observation = await store.commitBatch(step.op_id as string, parseWrites(step)); } catch (error) { observation = commitObservation(error); } @@ -89,28 +86,18 @@ async function runVectors( // accepted and the batch commits normally, exactly as the // Rust state machine models drop-response / drop-request // for the redb profile. - const reported = await store.commitBatch( - step.op_id as string, - parseWrites(step), - ); - trace.push( - `reported:${reported},resolved:${resolveOutcome(reported)}`, - ); + const reported = await store.commitBatch(step.op_id as string, parseWrites(step)); + trace.push(`reported:${reported},resolved:${resolveOutcome(reported)}`); break; } case "get": { - const value = await store.get( - step.namespace as string, - step.id as string, - ); + const value = await store.get(step.namespace as string, step.id as string); trace.push(value === undefined ? "absent" : `value:${value}`); break; } case "scan": { const entries = await store.scan(step.namespace as string); - trace.push( - `entries:${entries.map(([id, v]) => `${id}=${v}`).join(",")}`, - ); + trace.push(`entries:${entries.map(([id, v]) => `${id}=${v}`).join(",")}`); break; } case "negotiate": { @@ -129,8 +116,7 @@ async function runVectors( const finalScans: Record = {}; for (const namespace of namespaces) { const entries = await store.scan(namespace); - finalScans[namespace] = - `entries:${entries.map(([id, v]) => `${id}=${v}`).join(",")}`; + finalScans[namespace] = `entries:${entries.map(([id, v]) => `${id}=${v}`).join(",")}`; } return { trace, finalScans }; } finally { @@ -214,9 +200,7 @@ async function probeReopen(): Promise { const dbName = "id-probe-reopen"; await IndexedDbStore.deleteDatabase(dbName); let store = await IndexedDbStore.open(dbName, ["kv"]); - await store.commitBatch("probe-reopen-1", [ - { namespace: "kv", id: "k", value: "persisted-value" }, - ]); + await store.commitBatch("probe-reopen-1", [{ namespace: "kv", id: "k", value: "persisted-value" }]); store.close(); store = await IndexedDbStore.open(dbName, ["kv"]); try { @@ -234,16 +218,12 @@ async function probeUpgrade(): Promise<{ const dbName = "id-probe-upgrade"; await IndexedDbStore.deleteDatabase(dbName); let store = await IndexedDbStore.open(dbName, ["a"], 1); - await store.commitBatch("probe-upgrade-1", [ - { namespace: "a", id: "k", value: "v1-data" }, - ]); + await store.commitBatch("probe-upgrade-1", [{ namespace: "a", id: "k", value: "v1-data" }]); store.close(); store = await IndexedDbStore.open(dbName, ["a", "b"], 2); try { const preserved = await store.get("a", "k"); - await store.commitBatch("probe-upgrade-2", [ - { namespace: "b", id: "k", value: "v2-data" }, - ]); + await store.commitBatch("probe-upgrade-2", [{ namespace: "b", id: "k", value: "v2-data" }]); const newStoreValue = await store.get("b", "k"); return { preserved, newStoreValue }; } finally { @@ -286,9 +266,7 @@ async function probeStorage(): Promise<{ } } -export async function runInBrowser(fixture: { - vectors: FixtureStep[]; -}): Promise { +export async function runInBrowser(fixture: { vectors: FixtureStep[] }): Promise { const run1 = await runVectors(fixture, "run1"); const run2 = await runVectors(fixture, "run2"); return { diff --git a/pkgs/id/browser/test/indexeddb_conformance.test.ts b/pkgs/id/browser/test/indexeddb_conformance.test.ts index b41d59c6ca..f804785f8e 100644 --- a/pkgs/id/browser/test/indexeddb_conformance.test.ts +++ b/pkgs/id/browser/test/indexeddb_conformance.test.ts @@ -32,13 +32,7 @@ import { test } from "node:test"; import { fileURLToPath } from "node:url"; const PACKAGE_DIR = join(dirname(fileURLToPath(import.meta.url)), ".."); -const FIXTURE_PATH = join( - PACKAGE_DIR, - "..", - "tests", - "fixtures", - "port-v1.json", -); +const FIXTURE_PATH = join(PACKAGE_DIR, "..", "tests", "fixtures", "port-v1.json"); const FIXTURE = JSON.parse(readFileSync(FIXTURE_PATH, "utf8")); /** The verdict under evaluation: the indexeddb capability report @@ -50,11 +44,7 @@ const EXPECTED_REPORT = { scope: "browser", status: "active", required_capabilities: [], - optional_capabilities: [ - "store.scan", - "store.txn.multi-record", - "store.txn.whole-database", - ], + optional_capabilities: ["store.scan", "store.txn.multi-record", "store.txn.whole-database"], guarantees: { ordered: false, durable: true, @@ -178,12 +168,11 @@ function findChromium(): string { } function startServer(): Promise<{ base: string; close: () => void }> { - const adapterJs = stripTypeScriptTypes( - readFileSync(join(PACKAGE_DIR, "src", "indexeddb_store.ts"), "utf8"), + const adapterJs = stripTypeScriptTypes(readFileSync(join(PACKAGE_DIR, "src", "indexeddb_store.ts"), "utf8")); + const driverJs = stripTypeScriptTypes(readFileSync(join(PACKAGE_DIR, "test", "browser_driver.ts"), "utf8")).replace( + "../src/indexeddb_store.ts", + "/src/indexeddb_store.js", ); - const driverJs = stripTypeScriptTypes( - readFileSync(join(PACKAGE_DIR, "test", "browser_driver.ts"), "utf8"), - ).replace("../src/indexeddb_store.ts", "/src/indexeddb_store.js"); const server = createServer((request, response) => { if (request.url === "/") { response.setHeader("content-type", "text/html"); @@ -244,9 +233,7 @@ function connectCdp(wsUrl: string): Promise { const id = nextId++; return new Promise((sendResolve, sendReject) => { pending.set(id, { resolve: sendResolve, reject: sendReject }); - socket.send( - JSON.stringify({ id, method, params: params ?? {}, sessionId }), - ); + socket.send(JSON.stringify({ id, method, params: params ?? {}, sessionId })); }); }, waitEvent(method, sessionId) { @@ -309,9 +296,7 @@ async function launchChromium(): Promise<{ resolve(match[1]); } }); - child.on("exit", (code) => - fail(new Error(`chromium exited early with code ${code}`)), - ); + child.on("exit", (code) => fail(new Error(`chromium exited early with code ${code}`))); }); const cdp = await connectCdp(wsUrl); return { cdp, process: child, userDataDir }; @@ -348,9 +333,7 @@ async function runInEngine(base: string): Promise { sessionId, ); if (result.exceptionDetails) { - throw new Error( - `browser evaluation failed: ${JSON.stringify(result.exceptionDetails).slice(0, 2000)}`, - ); + throw new Error(`browser evaluation failed: ${JSON.stringify(result.exceptionDetails).slice(0, 2000)}`); } return result.result.value; } finally { @@ -363,145 +346,116 @@ async function runInEngine(base: string): Promise { // ---------------------------------------------------------------- test("the shared fixture declares the adopted request-batch profile exactly once", () => { - const reports = FIXTURE.capability_reports.filter( - (entry: any) => entry.resource_id === "indexeddb", - ); + const reports = FIXTURE.capability_reports.filter((entry: any) => entry.resource_id === "indexeddb"); assert.deepEqual(reports, [EXPECTED_REPORT]); }); -test( - "indexeddb conformance: shared vectors + engine probes in Chromium", - { timeout: 180_000 }, - async () => { - const server = await startServer(); - let result: any; - try { - result = await runInEngine(server.base); - } finally { - server.close(); - } +test("indexeddb conformance: shared vectors + engine probes in Chromium", { timeout: 180_000 }, async () => { + const server = await startServer(); + let result: any; + try { + result = await runInEngine(server.base); + } finally { + server.close(); + } - // Determinism: the script runs twice, traces identical. - assert.deepEqual( - result.traceRun2, - result.traceRun1, - "the vector script must be deterministic across runs", - ); + // Determinism: the script runs twice, traces identical. + assert.deepEqual(result.traceRun2, result.traceRun1, "the vector script must be deterministic across runs"); - // Three-way agreement per step: adapter observation, fixture - // expectation, reference model. - const model = new ReferenceModel(); - const vectors = FIXTURE.vectors as any[]; - assert.equal(result.traceRun1.length, vectors.length); - vectors.forEach((step, index) => { - const expect = expectFor(step); - const observation = result.traceRun1[index]; - switch (step.op) { - case "put": - case "delete": - case "commit_batch": { - assert.equal( - observation, - expect, - `step ${index} (${step.op}) diverged`, - ); - if (expect === "committed") model.apply(step.op_id, parseWrites(step)); - break; - } - case "commit_fault": { - assert.equal( - observation, - expect, - `step ${index} (commit_fault) diverged`, - ); - const resolved = observation.split("resolved:")[1]; - if (resolved === "committed") { - model.apply(step.op_id, parseWrites(step)); - } - break; - } - case "get": { - const modelValue = model.get(step.namespace, step.id); - const modelObservation = - modelValue === undefined ? "absent" : `value:${modelValue}`; - assert.equal(observation, modelObservation, `step ${index} (get) vs model`); - assert.equal(observation, expect, `step ${index} (get) vs fixture`); - break; - } - case "scan": { - const modelObservation = scanObservation( - model.scan(step.namespace), - ); - assert.equal(observation, modelObservation, `step ${index} (scan) vs model`); - assert.equal(observation, expect, `step ${index} (scan) vs fixture`); - break; - } - case "negotiate": { - assert.equal( - observation, - expect, - `step ${index} (negotiate) diverged`, - ); - break; + // Three-way agreement per step: adapter observation, fixture + // expectation, reference model. + const model = new ReferenceModel(); + const vectors = FIXTURE.vectors as any[]; + assert.equal(result.traceRun1.length, vectors.length); + vectors.forEach((step, index) => { + const expect = expectFor(step); + const observation = result.traceRun1[index]; + switch (step.op) { + case "put": + case "delete": + case "commit_batch": { + assert.equal(observation, expect, `step ${index} (${step.op}) diverged`); + if (expect === "committed") model.apply(step.op_id, parseWrites(step)); + break; + } + case "commit_fault": { + assert.equal(observation, expect, `step ${index} (commit_fault) diverged`); + const resolved = observation.split("resolved:")[1]; + if (resolved === "committed") { + model.apply(step.op_id, parseWrites(step)); } - default: - assert.fail(`unknown fixture op ${step.op}`); + break; } - }); - - // Final state: the adapter's visible state equals the model's - // in every namespace the script touched. - const namespaces = [ - ...new Set( - vectors - .map((step) => step.namespace) - .filter((ns): ns is string => typeof ns === "string"), - ), - ]; - for (const namespace of namespaces) { - assert.equal( - result.finalScans[namespace], - scanObservation(model.scan(namespace)), - `final state diverged in namespace ${namespace}`, - ); + case "get": { + const modelValue = model.get(step.namespace, step.id); + const modelObservation = modelValue === undefined ? "absent" : `value:${modelValue}`; + assert.equal(observation, modelObservation, `step ${index} (get) vs model`); + assert.equal(observation, expect, `step ${index} (get) vs fixture`); + break; + } + case "scan": { + const modelObservation = scanObservation(model.scan(step.namespace)); + assert.equal(observation, modelObservation, `step ${index} (scan) vs model`); + assert.equal(observation, expect, `step ${index} (scan) vs fixture`); + break; + } + case "negotiate": { + assert.equal(observation, expect, `step ${index} (negotiate) diverged`); + break; + } + default: + assert.fail(`unknown fixture op ${step.op}`); } + }); - // The verdict: the adapter's emitted report is exactly the - // adopted declaration independently pinned by the shared fixture. - assert.deepEqual(result.report, EXPECTED_REPORT); - - // Engine probes (the issue's named evaluation areas). - assert.equal( - result.probes.transactionLifetime, - "InvalidStateError", - "a request placed after its transaction's task ends must be refused by the engine — the fact the request-batch shape is built on", - ); - assert.deepEqual(result.probes.abortedBatch, { - error: "ConstraintError", - afterAbort: [[], [["original", "taken"]]], - afterRetry: [[["note", "kept"]], [["new", "free"], ["original", "taken"]]], - }); - assert.equal(result.probes.reopenValue, "persisted-value"); - assert.deepEqual(result.probes.upgrade, { - preserved: "v1-data", - newStoreValue: "v2-data", - }); - assert.equal(typeof result.probes.storage.quota, "number"); - assert.ok(result.probes.storage.quota > 0); - assert.equal(typeof result.probes.storage.persisted, "boolean"); + // Final state: the adapter's visible state equals the model's + // in every namespace the script touched. + const namespaces = [ + ...new Set(vectors.map((step) => step.namespace).filter((ns): ns is string => typeof ns === "string")), + ]; + for (const namespace of namespaces) { assert.equal( - result.probes.metaNamespace, - "refused:unsupported-capability", - "the internal operation-ID store must not be openable as a user namespace", + result.finalScans[namespace], + scanObservation(model.scan(namespace)), + `final state diverged in namespace ${namespace}`, ); + } - // The evidence record: engine, verdict, probes. - console.log( - JSON.stringify( - { engine: result.engine, report: result.report, probes: result.probes }, - null, - 2, - ), - ); - }, -); + // The verdict: the adapter's emitted report is exactly the + // adopted declaration independently pinned by the shared fixture. + assert.deepEqual(result.report, EXPECTED_REPORT); + + // Engine probes (the issue's named evaluation areas). + assert.equal( + result.probes.transactionLifetime, + "InvalidStateError", + "a request placed after its transaction's task ends must be refused by the engine — the fact the request-batch shape is built on", + ); + assert.deepEqual(result.probes.abortedBatch, { + error: "ConstraintError", + afterAbort: [[], [["original", "taken"]]], + afterRetry: [ + [["note", "kept"]], + [ + ["new", "free"], + ["original", "taken"], + ], + ], + }); + assert.equal(result.probes.reopenValue, "persisted-value"); + assert.deepEqual(result.probes.upgrade, { + preserved: "v1-data", + newStoreValue: "v2-data", + }); + assert.equal(typeof result.probes.storage.quota, "number"); + assert.ok(result.probes.storage.quota > 0); + assert.equal(typeof result.probes.storage.persisted, "boolean"); + assert.equal( + result.probes.metaNamespace, + "refused:unsupported-capability", + "the internal operation-ID store must not be openable as a user namespace", + ); + + // The evidence record: engine, verdict, probes. + console.log(JSON.stringify({ engine: result.engine, report: result.report, probes: result.probes }, null, 2)); +}); diff --git a/pkgs/id/browser/tsconfig.json b/pkgs/id/browser/tsconfig.json index 2105192e26..65a9d2fd72 100644 --- a/pkgs/id/browser/tsconfig.json +++ b/pkgs/id/browser/tsconfig.json @@ -1 +1,12 @@ -{"compilerOptions":{"lib":["ES2022","DOM","DOM.Iterable"],"module":"ESNext","moduleResolution":"bundler","noEmit":true,"skipLibCheck":true,"strict":true,"target":"ES2022"},"include":["src"]} \ No newline at end of file +{ + "compilerOptions": { + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "bundler", + "noEmit": true, + "skipLibCheck": true, + "strict": true, + "target": "ES2022" + }, + "include": ["src"] +} diff --git a/pkgs/id/config/id-config-v1.schema.json b/pkgs/id/config/id-config-v1.schema.json index 2aaf80a7bc..ec70fed54b 100644 --- a/pkgs/id/config/id-config-v1.schema.json +++ b/pkgs/id/config/id-config-v1.schema.json @@ -1 +1,104 @@ -{"$defs":{"behavior":{"additionalProperties":false,"description":"Behavioral values in partial form: an absent field leaves the previous resolution plane's value in place. Resolved behavior must stay within every applicable ceiling.","properties":{"max_hops":{"minimum":0,"type":"integer"},"sync_scope":{"enum":["metadata","full"],"type":"string"},"tier":{"enum":["cold","warm","hot"],"type":"string"}},"type":"object"},"ceiling_override":{"additionalProperties":false,"description":"A scoped narrowing of the hard ceilings. Every present field must be less than or equal to the document ceiling; an attempt to widen rejects the document.","properties":{"max_bytes":{"minimum":1,"type":"integer"},"max_fan_out":{"minimum":1,"type":"integer"},"max_hops":{"minimum":1,"type":"integer"},"max_time_ms":{"minimum":1,"type":"integer"}},"type":"object"},"ceilings":{"additionalProperties":false,"description":"Hard resource ceilings: non-overridable. Lower scopes may only narrow them.","properties":{"max_bytes":{"minimum":1,"type":"integer"},"max_fan_out":{"minimum":1,"type":"integer"},"max_hops":{"minimum":1,"type":"integer"},"max_time_ms":{"minimum":1,"type":"integer"}},"required":["max_hops","max_bytes","max_time_ms","max_fan_out"],"type":"object"},"fixed_gates":{"additionalProperties":false,"description":"The fixed admission gates (mechanism, not behavior). Each gate is const true: a document that attempts to disable one is rejected, never honored.","properties":{"authorization":{"const":true},"replay_protection":{"const":true},"signature_verification":{"const":true},"tenant_scope":{"const":true},"validation":{"const":true}},"type":"object"},"scoped_override":{"additionalProperties":false,"properties":{"behavior":{"$ref":"#/$defs/behavior"},"ceilings":{"$ref":"#/$defs/ceiling_override"},"scope":{"minLength":1,"type":"string"}},"required":["scope"],"type":"object"}},"$id":"https://github.com/developing-today/code/pkgs/id/config/id-config-v1.schema.json","$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"description":"Canonical versioned configuration document for the id V2 program (slice 9111-01, issue #10178). Design basis: doc/2026-11-13T03-40-00Z_design_id-atlas-summit/crosscut/versioned-design.md, section 'Configuration data model and precedence' (statements S7.1, S7.10-S7.13). Kept in lockstep with the Rust contract in pkgs/id/crates/id-config by pkgs/id/tests/config_invariants.rs. Rules stated here and enforced by the reference validator: fixed admission gates cannot be disabled (const true), ceilings are hard and may only narrow at lower scopes, unknown fields reject the document, and extensions must be namespaced and are retained but never executed.","properties":{"behavior":{"$ref":"#/$defs/behavior"},"ceilings":{"$ref":"#/$defs/ceilings"},"config_id":{"description":"Stable configuration identity.","minLength":1,"type":"string"},"extensions":{"additionalProperties":true,"description":"Namespaced optional extensions. Retained verbatim in resolved output; never executed unless understood and authorized by a consumer.","propertyNames":{"description":"Extension keys must be namespaced: at least one '.' or '/' separator, e.g. 'example.com/experiment'.","pattern":"^[^./\\s]+([./][^./\\s]+)+$"},"type":"object"},"gates":{"$ref":"#/$defs/fixed_gates"},"mode":{"description":"Named mode: a coherent behavior bundle that contributes behavioral defaults only. A mode cannot confer identity or privilege.","enum":["single-node","hosted-tenant","federated-relay"],"type":"string"},"overrides":{"description":"Scoped overrides. Applied in scope-name order during resolution; two overrides for the same scope reject the document.","items":{"$ref":"#/$defs/scoped_override"},"type":"array"},"protocol_versions":{"description":"Protocol-version allowlist. Resolved output is sorted; authoring order carries no meaning.","items":{"minLength":1,"type":"string"},"minItems":1,"type":"array","uniqueItems":true},"revision":{"description":"Monotonic revision of this configuration.","minimum":0,"type":"integer"},"schema_version":{"const":1,"description":"Schema version. Only version 1 is accepted; any other version rejects the document.","type":"integer"}},"required":["schema_version","config_id","revision","mode","protocol_versions","ceilings"],"title":"id ConfigDocument v1","type":"object"} \ No newline at end of file +{ + "$defs": { + "behavior": { + "additionalProperties": false, + "description": "Behavioral values in partial form: an absent field leaves the previous resolution plane's value in place. Resolved behavior must stay within every applicable ceiling.", + "properties": { + "max_hops": { "minimum": 0, "type": "integer" }, + "sync_scope": { "enum": ["metadata", "full"], "type": "string" }, + "tier": { "enum": ["cold", "warm", "hot"], "type": "string" } + }, + "type": "object" + }, + "ceiling_override": { + "additionalProperties": false, + "description": "A scoped narrowing of the hard ceilings. Every present field must be less than or equal to the document ceiling; an attempt to widen rejects the document.", + "properties": { + "max_bytes": { "minimum": 1, "type": "integer" }, + "max_fan_out": { "minimum": 1, "type": "integer" }, + "max_hops": { "minimum": 1, "type": "integer" }, + "max_time_ms": { "minimum": 1, "type": "integer" } + }, + "type": "object" + }, + "ceilings": { + "additionalProperties": false, + "description": "Hard resource ceilings: non-overridable. Lower scopes may only narrow them.", + "properties": { + "max_bytes": { "minimum": 1, "type": "integer" }, + "max_fan_out": { "minimum": 1, "type": "integer" }, + "max_hops": { "minimum": 1, "type": "integer" }, + "max_time_ms": { "minimum": 1, "type": "integer" } + }, + "required": ["max_hops", "max_bytes", "max_time_ms", "max_fan_out"], + "type": "object" + }, + "fixed_gates": { + "additionalProperties": false, + "description": "The fixed admission gates (mechanism, not behavior). Each gate is const true: a document that attempts to disable one is rejected, never honored.", + "properties": { + "authorization": { "const": true }, + "replay_protection": { "const": true }, + "signature_verification": { "const": true }, + "tenant_scope": { "const": true }, + "validation": { "const": true } + }, + "type": "object" + }, + "scoped_override": { + "additionalProperties": false, + "properties": { + "behavior": { "$ref": "#/$defs/behavior" }, + "ceilings": { "$ref": "#/$defs/ceiling_override" }, + "scope": { "minLength": 1, "type": "string" } + }, + "required": ["scope"], + "type": "object" + } + }, + "$id": "https://github.com/developing-today/code/pkgs/id/config/id-config-v1.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "additionalProperties": false, + "description": "Canonical versioned configuration document for the id V2 program (slice 9111-01, issue #10178). Design basis: doc/2026-11-13T03-40-00Z_design_id-atlas-summit/crosscut/versioned-design.md, section 'Configuration data model and precedence' (statements S7.1, S7.10-S7.13). Kept in lockstep with the Rust contract in pkgs/id/crates/id-config by pkgs/id/tests/config_invariants.rs. Rules stated here and enforced by the reference validator: fixed admission gates cannot be disabled (const true), ceilings are hard and may only narrow at lower scopes, unknown fields reject the document, and extensions must be namespaced and are retained but never executed.", + "properties": { + "behavior": { "$ref": "#/$defs/behavior" }, + "ceilings": { "$ref": "#/$defs/ceilings" }, + "config_id": { "description": "Stable configuration identity.", "minLength": 1, "type": "string" }, + "extensions": { + "additionalProperties": true, + "description": "Namespaced optional extensions. Retained verbatim in resolved output; never executed unless understood and authorized by a consumer.", + "propertyNames": { + "description": "Extension keys must be namespaced: at least one '.' or '/' separator, e.g. 'example.com/experiment'.", + "pattern": "^[^./\\s]+([./][^./\\s]+)+$" + }, + "type": "object" + }, + "gates": { "$ref": "#/$defs/fixed_gates" }, + "mode": { + "description": "Named mode: a coherent behavior bundle that contributes behavioral defaults only. A mode cannot confer identity or privilege.", + "enum": ["single-node", "hosted-tenant", "federated-relay"], + "type": "string" + }, + "overrides": { + "description": "Scoped overrides. Applied in scope-name order during resolution; two overrides for the same scope reject the document.", + "items": { "$ref": "#/$defs/scoped_override" }, + "type": "array" + }, + "protocol_versions": { + "description": "Protocol-version allowlist. Resolved output is sorted; authoring order carries no meaning.", + "items": { "minLength": 1, "type": "string" }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "revision": { "description": "Monotonic revision of this configuration.", "minimum": 0, "type": "integer" }, + "schema_version": { + "const": 1, + "description": "Schema version. Only version 1 is accepted; any other version rejects the document.", + "type": "integer" + } + }, + "required": ["schema_version", "config_id", "revision", "mode", "protocol_versions", "ceilings"], + "title": "id ConfigDocument v1", + "type": "object" +} diff --git a/pkgs/id/contract/shell-suite.v1.json b/pkgs/id/contract/shell-suite.v1.json index 9e241948b3..9cd01f414c 100644 --- a/pkgs/id/contract/shell-suite.v1.json +++ b/pkgs/id/contract/shell-suite.v1.json @@ -1 +1,58 @@ -{"contract":"shell-contract.v1.json","shells":[{"name":"terminal","session":"sessions/terminal.jsonl","statement":{"presents":["error","event","snapshot","view"],"providers":[],"sends":["chat","info","input","join","paste","records","resize"],"workflow":["join","resize"]}},{"name":"browser","session":null,"statement":{"presents":["compiled","error","event","records","snapshot","view"],"providers":[],"sends":["chat","compile","input","install_begin","install_chunk","install_end","join","paste","records","resize"],"workflow":["join","resize"]}},{"name":"native","session":"sessions/native.jsonl","statement":{"presents":["error","event","snapshot","view"],"providers":["client.file.read"],"sends":["chat","input","join","paste","resize"],"workflow":["chat","input","paste","resize"]}},{"name":"hardware","session":null,"statement":{"presents":["snapshot","view"],"providers":[],"sends":["input","join"],"workflow":["input","join"]}}],"suite":"shell-suite","version":1} \ No newline at end of file +{ + "contract": "shell-contract.v1.json", + "shells": [ + { + "name": "terminal", + "session": "sessions/terminal.jsonl", + "statement": { + "presents": ["error", "event", "snapshot", "view"], + "providers": [], + "sends": ["chat", "info", "input", "join", "paste", "records", "resize"], + "workflow": ["join", "resize"] + } + }, + { + "name": "browser", + "session": null, + "statement": { + "presents": ["compiled", "error", "event", "records", "snapshot", "view"], + "providers": [], + "sends": [ + "chat", + "compile", + "input", + "install_begin", + "install_chunk", + "install_end", + "join", + "paste", + "records", + "resize" + ], + "workflow": ["join", "resize"] + } + }, + { + "name": "native", + "session": "sessions/native.jsonl", + "statement": { + "presents": ["error", "event", "snapshot", "view"], + "providers": ["client.file.read"], + "sends": ["chat", "input", "join", "paste", "resize"], + "workflow": ["chat", "input", "paste", "resize"] + } + }, + { + "name": "hardware", + "session": null, + "statement": { + "presents": ["snapshot", "view"], + "providers": [], + "sends": ["input", "join"], + "workflow": ["input", "join"] + } + } + ], + "suite": "shell-suite", + "version": 1 +} diff --git a/pkgs/id/crates/id-cli/src/commands/petname.rs b/pkgs/id/crates/id-cli/src/commands/petname.rs index a8f3624877..98ac12bea6 100644 --- a/pkgs/id/crates/id-cli/src/commands/petname.rs +++ b/pkgs/id/crates/id-cli/src/commands/petname.rs @@ -60,7 +60,9 @@ mod tests { { let mut store = Petnames::open(&path).unwrap(); store.set(OWNER, ALICE, "Ali", std::iter::empty()).unwrap(); - store.set(OTHER, ALICE, "Alice", std::iter::empty()).unwrap(); + store + .set(OTHER, ALICE, "Alice", std::iter::empty()) + .unwrap(); } let before = std::fs::read(&path).unwrap(); let store = Petnames::open(&path).unwrap(); diff --git a/pkgs/id/crates/id-core/JSON_PARSE_INVENTORY.md b/pkgs/id/crates/id-core/JSON_PARSE_INVENTORY.md index a8a535023d..b464d9f7fa 100644 --- a/pkgs/id/crates/id-core/JSON_PARSE_INVENTORY.md +++ b/pkgs/id/crates/id-core/JSON_PARSE_INVENTORY.md @@ -17,103 +17,103 @@ the mechanism itself / its wiring: 3. ## Dispositions -| Site | Call | Disposition | Reason | -| ------------------------------------------------------------------------------------------------------------- | ---------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `src/boards.rs:428` (`from_artifact`) | from_value | **gate — routed** | (a) Signed-object downstream decode: BoardObject from artifact.body, a Value that cannot hold a duplicate key. Routed at receipt, as #8794 planned: the SignedArtifact receipt parses (id-sync) refuse duplicates, and the artifact's hash and signature cover the re-serialized Value (signed_bytes), so every consumer reads the document decoded here. | -| `src/commands/serve.rs:192` (`get_serve_info`) | from_str | not-a-gate | (b) Self-produced file: the serve lock/info file this binary itself writes; the writer cannot produce a duplicate — refusal would be defence against hand edits only. | -| `crates/id-cli/src/commands/world.rs:2300` (`read_execution_profile`) | helper | **gate — routed** | World doctor: execution-profile file named by a CLI flag, parsed into the profile the ceiling/profile checks consume — a check input. | -| `src/commands/world.rs:983` (`read_world_journal`) | from_slice | not-a-gate | (b) Self-produced file: read_world_journal over a local journal file (diagnostic/replay read). Hand-edit defence only. | -| `src/commands/world.rs:1245` (`current_world_state`) | from_value | not-a-gate | Downstream of a gate: from_value over the session client's caps reply Value; the session frame parse is the gate (world_session, helper-routed). No raw text is parsed here, so no duplicate can be introduced or hidden at this site. | -| `src/commands/world.rs:1247` (`current_world_state`) | from_value | not-a-gate | Downstream of a gate: same caps reply Value as :1245, decoded as WorldExecutionProfile. | -| `src/commands/world.rs:1350` (`apply_steps`) | from_value | not-a-gate | Downstream of a gate: same session caps reply pattern as :1245, in apply_steps. | -| `src/commands/world.rs:1571` (`replay_fixture`) | from_str | not-a-gate | Not a gate: parses the records string produced by the in-process fixture replay, only to pretty-print it. Self-produced round-trip, display only. | -| `src/commands/world.rs:1644` (`verify_fixture`) | from_str | not-a-gate | Not a gate: same self-produced replay records as :1571, in verify_fixture; pretty-print only. | -| `src/currency.rs:144` (`from_body`) | helper | **gate — routed** | (a) RateAuthorisation::from_body: decodes a signed event's body bytes; the decode feeds issuer/rate validation against the verified author. | -| `src/currency.rs:240` (`from_body`) | helper | **gate — routed** | (a) RateRevocation::from_body: decodes a signed event's body bytes; feeds revocation validation. | -| `src/currency_poc/intent.rs:265` (`scan`) | helper | **gate — routed** | Intent scan: reads *.json files from a directory, explicitly including foreign or schema-drifted content, into scanned records that are indexed/reported (PoC scope noted; the scan is a check over untrusted files). | -| `src/directory_log.rs:211` (`load`) | from_str | not-a-gate | (b) Self-produced file: the directory append log this crate writes; lines were gated when appended. Hand-edit defence only. | -| `src/foreign_libsql.rs:1319` (`parse_pipeline_rows`) | helper | **gate — routed** | parse_pipeline_rows: parses a libsql server's response body into rows returned to callers — remote-supplied input feeding a store/forward path. | -| `src/publications.rs:388` (`load`) | from_str | not-a-gate | (b) Self-produced file: the publications registry file this crate writes and reads back (validate_persisted runs after the parse); hand-edit defence only. | -| `crates/id-web/src/collab.rs:154` (`content_to_document`) | helper | **gate — routed** | Document content (ProseMirror JSON) parsed by content_to_document is retained by Document::with_content and forwarded to connected clients as CollabMessage::Init (src/web/collab.rs:911-928) — the contract's forward criterion applies; the empty-document fallback covers only unparseable input, not a duplicate-key collapse. (Reclassified on a verified Codex finding, PR #8796.) | -| `src/web/groups.rs:70` (`read_projection`) | from_str | not-a-gate | (b) Self-produced file: read_projection replays the same GroupLog file as id-groups log.rs:79 for the web projection. Hand-edit defence only. | -| `crates/id-web/src/identity.rs:586` (`decode_token`) | helper | **gate — routed** | (a) decode_token: token payload bytes are signature-verified (verify_strict) before this struct decode; the payload is a signed object — the (a) decision applies (refusal at receipt), noting the signature-first order as the existing mitigation. | -| `src/web/identity.rs:766` (`unseal`) | from_slice | not-a-gate | Not a gate: unseal decodes plaintext produced by AES-256-GCM decryption of this crate's own sealed records — the AEAD check already refuses any altered bytes before this parse; only the key holder can produce the input. | -| `src/web/mod.rs:380` (`load_asset_urls`) | from_str | not-a-gate | Not a gate: manifest.json is an asset embedded in the binary at build time (rust-embed), i.e. self-produced; a parse failure falls back to default asset URLs. | -| `crates/id-web/src/world_ws.rs:462` (`directory_write_handler`) | helper | **gate — routed** | directory_write_handler: HTTP request body from a web client decoded as DirectoryRequest and acted on as a directory write — client-supplied input feeding a store. | -| `crates/id-caps/src/world_caps.rs:837` (`parse_wants`) | helper | **gate — routed** | parse_wants: capability wants documents are checked against the caps schema — a checked gate, routed in Phase 2 (#6499). | -| `crates/id-caps/src/world_caps.rs:2574` (`consent_withdrawal_closes_an_open_watch_with_the_revocation_event`) | from_str | test-only | Inside the #[cfg(test)] module at world_caps.rs:1701 (a #[test] fn); the extraction's naive brace tracker under-counts braces inside string literals in that module — verified test-only by hand and grouped with the test sites below. | -| `crates/id-core/src/json_unique.rs:13` (`parse_json_without_duplicate_keys`) | helper | mechanism | The helper itself: recursive unique-key parse of one JSON text; refuses a repeated object key at any depth, naming the key. | -| `crates/id-core/src/petname.rs:80` (`open`) | from_str | not-a-gate | (b) Self-produced file: the petname record store this crate writes and reads back. Hand-edit defence only. | -| `crates/id-core/src/world_presentation.rs:550` (`parse_surface`) | helper | **gate — routed** | parse_surface: surface documents are checked (version/width/lines/rows) — routed in Phase 2 (#6491). | -| `crates/id-core/src/world_presentation.rs:559` (`parse_surface`) | from_str | not-a-gate | Deliberate exception inside a gate: after the helper at :550 has already REFUSED the document for a duplicate key, this lenient parse is used only to classify the document's kind — if it is a text/screen document (or kind itself is duplicated) the refusal stands and the document is rejected; the collapsed values are never validated, stored, or forwarded. Any other document keeps the legacy plain-text path. | -| `crates/id-core/src/world_presentation.rs:575` (`parse_surface`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :550 in the same function. | -| `crates/id-core/src/world_presentation.rs:592` (`parse_surface`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :550 in the same function. | -| `crates/id-events/src/attestation.rs:112` (`from_body`) | helper | **gate — routed** | (a) GenesisAgreement::from_body: decodes an agreement from a signed event's body bytes; feeds agreement hashing/validation. | -| `crates/id-events/src/attestation.rs:148` (`from_body`) | helper | **gate — routed** | (a) ResultClaim::from_body: decodes a result claim from a signed event's body bytes; feeds claim validation. | -| `crates/id-events/src/local_claims.rs:81` (`open`) | from_str | not-a-gate | (b) Self-produced file: the local claims line store this crate writes and reads back. Hand-edit defence only. | -| `crates/id-groups/src/groups/log.rs:79` (`open`) | from_str | not-a-gate | (b) Self-produced file: GroupLog::open replays the group's own append log; events were gated on the receipt path that appended them. Hand-edit defence only. | -| `crates/id-store/src/tags.rs:1731` (`load_registry`) | from_slice | not-a-gate | (b) Self-produced file: registry.json, the tag registry file this crate writes and reads back. Hand-edit defence only. | -| `crates/id-store/src/tags.rs:1913` (`load_meta`) | from_slice | not-a-gate | (b) Self-produced file: the tag MetaDoc file this crate writes and reads back. Hand-edit defence only. | -| `crates/id-sync/src/artifact.rs:681` (`decode`) | from_value | not-a-gate | (a) Downstream site: SignedArtifact::decode decodes the artifact's body Value into a typed body. No raw text is parsed here; the receipt parse of the artifact (see :1333/:1049) is where duplicates can enter, and that is the gate. | -| `crates/id-sync/src/artifact.rs:1049` (`open`) | from_str | not-a-gate | (b) Self-produced file: ArtifactStore::open replays the store's own artifact log; artifacts were gated at receipt (receive_pushed, :1333). Hand-edit defence only. | -| `crates/id-sync/src/artifact.rs:1076` (`open_read_only`) | from_str | not-a-gate | (b) Self-produced file: read-only replay of the same artifact store log as :1049. Hand-edit defence only. | -| `crates/id-sync/src/artifact.rs:1286` (`accept`) | helper | **gate — routed** | Pull protocol accept: peer-supplied frame decoded as PullRequest and served — peer input feeding a forward. | -| `crates/id-sync/src/artifact.rs:1333` (`receive_pushed`) | helper | **gate — routed** | (a) receive_pushed: peer-pushed bytes decoded as SignedArtifact and stored — THE signed-object receipt gate; the (a) decision (refusal at receipt) lands here. | -| `crates/id-sync/src/artifact.rs:1407` (`fetch_page_within`) | helper | **gate — routed** | fetch_page_within: a Page frame received from a peer server, decoded and consumed — peer input. | -| `crates/id-sync/src/envelope_net.rs:103` (`exchange`) | helper | **gate — routed** | exchange: a peer's Reply frame decoded into the outcome the caller acts on — peer input feeding a decision. | -| `crates/id-sync/src/envelope_net.rs:185` (`receive`) | helper | **gate — routed** | receive: peer-supplied bytes decoded as Envelope and handed to the hub for storage/forwarding — an envelope receipt gate. | -| `crates/id-sync/src/envelope_outbox.rs:173` (`open`) | from_str | not-a-gate | (b) Self-produced file: the envelope outbox record store this crate writes and reads back. Hand-edit defence only. | -| `crates/id-worlds/src/directory.rs:474` (`replay`) | from_str | not-a-gate | (b) Self-produced file: directory replay of the directory's own append log. Hand-edit defence only. | -| `crates/id-worlds/src/directory.rs:528` (`replay_read_only`) | from_str | not-a-gate | (b) Self-produced file: read-only directory replay of the same append log as :474. Hand-edit defence only. | -| `crates/id-directory/src/directory_view.rs:1060` (`action_from_fields`) | helper | **gate — routed** | publish_document action: operator-supplied content text parsed to a JSON Value that is then published (stored/forwarded) — collapse would change what is stored vs what was supplied. | -| `crates/id-directory/src/directory_view.rs:1073` (`action_from_fields`) | helper | **gate — routed** | receive action: operator-supplied envelope text parsed to a JSON Value and forwarded into envelope handling — collapse would change what is received vs what was supplied. | -| `crates/id-worlds/src/shell_contract.rs:173` (`try_from`) | from_value | not-a-gate | Not a gate: decodes a kind from Value::from(name) — a Value constructed in-process from a single string; no object keys exist in the input, so no duplicate is possible. | -| `crates/id-worlds/src/shell_contract.rs:309` (`parse`) | helper | **gate — routed** | ShellContract::parse: a contract document (file supplied to the checker) decoded into the routing/frame contract that checks enforce — a check input. | -| `crates/id-worlds/src/shell_contract.rs:680` (`check_transcript`) | helper | **gate — routed** | check_transcript: transcript lines decoded as part of checking a recorded transcript against the contract — a check. | -| `crates/id-worlds/src/world/core.rs:298` (`validate_import_envelope`) | helper | **gate — routed** | validate_import_envelope: a CHECK — parses a journal import event's envelope and compares protocol/direction/payload_digest; a collapsed duplicate could hide behind the compared fields. | -| `crates/id-worlds/src/world/mod.rs:1972` (`first_oversized_entry`) | from_slice | not-a-gate | (b) Self-produced file: first_oversized_entry measures lines of the world's own journal file. Hand-edit defence only. | -| `crates/id-worlds/src/world/mod.rs:1213` (`presence_change`) | helper | **gate — routed** | Embedded presence document: WorldCore::restore_inner (world/core.rs:1064-1095) passes a RECEIVED replica journal's System event text to presence_change and uses the decoded participant for a capability check (ensure the participant is known) and for presence counts — a check over received data, even though the same producer also builds presence strings in-process. The presence JSON is embedded as a string inside the journal entry, so routing the outer journal parsers through the helper does not cover it; the conversion must refuse duplicates in the embedded document itself. (Reclassified on a verified Codex finding, PR #8796.) | -| `crates/id-worlds/src/world/mod.rs:2145` (`parse_records`) | helper | **gate — routed** | parse_records: world records parse — routed. | -| `crates/id-worlds/src/world/replica.rs:118` (`parse_replica_journal`) | from_slice | not-a-gate | (b) Self-produced file: parse of the replica's own journal file; received journals are checked at receipt by validate_committed_journal (replication_receiver.rs:537, a gate). Hand-edit defence only. | -| `crates/id-worlds/src/world/replication.rs:531` (`chain_payload`) | helper | **gate — routed** | chain_payload: parses journal lines of a signed replication payload to advance the verified cursor — a check over peer-supplied payload bytes. | -| `crates/id-worlds/src/world/replication.rs:582` (`validate_payload_journal_header`) | helper | **gate — routed** | validate_payload_journal_header: checks a signed payload's journal header against its envelope — a check over peer-supplied payload bytes. | -| `crates/id-worlds/src/world/replication_receiver.rs:666` (`validate_committed_journal`) | helper | **gate — routed** | validate_committed_journal: validates a received journal (header/cursor) before restore — a check over received data. | -| `crates/id-worlds/src/world_cache.rs:272` (`open`) | from_str | not-a-gate | (b) Self-produced file: the world cache entry file this crate writes; a parse failure is a cache miss. Hand-edit defence only. | -| `crates/id-worlds/src/world_dev.rs:1033` (`promote`) | from_slice | not-a-gate | (b) Self-produced state: ProgramSnapshot state written by the world itself, decoded during promotion/migration. Hand-edit defence only. | -| `crates/id-worlds/src/world_dev.rs:1740` (`parse_fuzz_decl`) | helper | **gate — routed** | parse_fuzz_decl: a fuzz declaration parsed, then version/bounds-checked — the #6491 pattern (a duplicate version key would collapse before the check). | -| `crates/id-worlds/src/world_doctor.rs:419` (`inspect_journal_file`) | from_slice | not-a-gate | (b) Self-produced file: doctor inspection of a local journal file (diagnostic read). Hand-edit defence only. | -| `crates/id-worlds/src/world_fixture.rs:21` (`?`) | helper | mechanism | Import wiring: brings the helper into world_fixture (used at the two routed sites below). | -| `crates/id-worlds/src/world_fixture.rs:573` (`decode_header`) | helper | **gate — routed** | Fixture header parse — routed in Phase 1 (#6474); see disposition (d). | -| `crates/id-worlds/src/world_fixture.rs:621` (`decode_event`) | helper | **gate — routed** | Fixture event-line parse — routed in Phase 1 (#6474); see disposition (d). | -| `crates/id-worlds/src/world_net.rs:902` (`parse_caps_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["report"] of a frame parsed at world_net.rs:1511 — disposition follows that gate. | -| `crates/id-worlds/src/world_net.rs:922` (`parse_policy_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over a policy Value from a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:996` (`parse_caps_ceiling_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["report"] of a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:1036` (`set_schedule`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["schedules"] of a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:1070` (`cancel_schedule`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["schedules"] of a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:1137` (`parse_world_state_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["schedules"] of a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:1203` (`parse_set_execution_profile_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over a requested-profile Value carried in a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:1529` (`recv_json_with_frame_bytes`) | helper | **gate — routed** | recv_json_with_frame_bytes: THE inbound frame parse of the world host protocol; every world_net reply parser below consumes this Value, so this is the single conversion point for that family. | -| `crates/id-worlds/src/world_net.rs:1686` (`metrics`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["metrics"] of a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:1752` (`parse_module_info_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over module-info Values from a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:1868` (`record_pages`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["records"] of a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:2080` (`admin_event_history`) | from_value | not-a-gate | Downstream of the frame gate: from_value over frame["event"] of a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_net.rs:2104` (`admin_event_history`) | from_value | not-a-gate | Downstream of the frame gate: from_value over frame["records"] of a frame parsed at world_net.rs:1511. | -| `crates/id-worlds/src/world_records.rs:274` (`read_records`) | helper | **gate — routed** | read_records: records documents are counted/compared as written — routed 2026-11-07 (see backlog note on issue #6521). | -| `crates/id-worlds/src/world_replication_net.rs:128` (`serve_stream`) | helper | **gate — routed** | serve_stream: peer-supplied bytes decoded as a replication Request and served — peer input. | -| `crates/id-worlds/src/world_session/mod.rs:33` (`?`) | helper | mechanism | Re-export wiring: `pub(crate) use id_core::json_unique::parse_json_without_duplicate_keys` for the id-worlds crate. | -| `crates/id-worlds/src/world_session/mod.rs:155` (`run_session_with`) | helper | **gate — routed** | Session first frame: client frames are routed and installed from this parse — routed in Phase 1 (#6501, PR #6508). | -| `crates/id-worlds/src/world_session/mod.rs:176` (`run_session_with`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :155. | -| `crates/id-worlds/src/world_session/mod.rs:859` (`query_session`) | helper | **gate — routed** | query_session client frame parse — routed with the session protocol (#6501). | -| `crates/id-worlds/src/world_session/mod.rs:860` (`query_session`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :859. | -| `crates/id-worlds/src/world_session/mod.rs:1370` (`receive_module_upload`) | helper | **gate — routed** | receive_module_upload frame parse — routed with the session protocol (#6501). | -| `crates/id-worlds/src/world_session/mod.rs:1371` (`receive_module_upload`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :1370. | -| `crates/id-worlds/src/world_session/mod.rs:1390` (`receive_module_upload`) | from_value | not-a-gate | Downstream of a gate: the guard itself parses through the helper (same expression) before this from_value over the resulting Value. | -| `crates/id-worlds/src/world_session/mod.rs:2028` (`handle_client_frame`) | helper | **gate — routed** | handle_client_frame frame parse — routed with the session protocol (#6501). | -| `crates/id-worlds/src/world_session/mod.rs:2034` (`handle_client_frame`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :2028. | -| `crates/id-worlds/src/world_ssh.rs:1301` (`send`) | helper | **gate — routed** | SSH session send path: an incoming frame is parsed to a Value and dispatched on type/surface — host-supplied input feeding rendering/state. | -| `crates/id-worlds/src/world_ssh.rs:1055` (`send`) | from_value | not-a-gate | Downstream of a gate: from_value over the surface field of the frame parsed at world_ssh.rs:1040 — disposition follows that gate. | -| `crates/id-worlds/src/world_store.rs:257` (`scan_entries`) | from_slice | not-a-gate | (b) Self-produced file: scan of the world's own journal file. Entries were gated when appended (session/replication receipt paths). Hand-edit defence only. | -| `crates/id-worlds/src/world_store.rs:811` (`read_journal_entries`) | from_slice | not-a-gate | (b) Self-produced file: read_journal_entries over the world's own journal file, as :257. Hand-edit defence only. | +| Site | Call | Disposition | Reason | +| ------------------------------------------------------------------------------------------------------------- | ---------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `src/boards.rs:428` (`from_artifact`) | from_value | **gate — routed** | (a) Signed-object downstream decode: BoardObject from artifact.body, a Value that cannot hold a duplicate key. Routed at receipt, as #8794 planned: the SignedArtifact receipt parses (id-sync) refuse duplicates, and the artifact's hash and signature cover the re-serialized Value (signed_bytes), so every consumer reads the document decoded here. | +| `src/commands/serve.rs:192` (`get_serve_info`) | from_str | not-a-gate | (b) Self-produced file: the serve lock/info file this binary itself writes; the writer cannot produce a duplicate — refusal would be defence against hand edits only. | +| `crates/id-cli/src/commands/world.rs:2300` (`read_execution_profile`) | helper | **gate — routed** | World doctor: execution-profile file named by a CLI flag, parsed into the profile the ceiling/profile checks consume — a check input. | +| `src/commands/world.rs:983` (`read_world_journal`) | from_slice | not-a-gate | (b) Self-produced file: read_world_journal over a local journal file (diagnostic/replay read). Hand-edit defence only. | +| `src/commands/world.rs:1245` (`current_world_state`) | from_value | not-a-gate | Downstream of a gate: from_value over the session client's caps reply Value; the session frame parse is the gate (world_session, helper-routed). No raw text is parsed here, so no duplicate can be introduced or hidden at this site. | +| `src/commands/world.rs:1247` (`current_world_state`) | from_value | not-a-gate | Downstream of a gate: same caps reply Value as :1245, decoded as WorldExecutionProfile. | +| `src/commands/world.rs:1350` (`apply_steps`) | from_value | not-a-gate | Downstream of a gate: same session caps reply pattern as :1245, in apply_steps. | +| `src/commands/world.rs:1571` (`replay_fixture`) | from_str | not-a-gate | Not a gate: parses the records string produced by the in-process fixture replay, only to pretty-print it. Self-produced round-trip, display only. | +| `src/commands/world.rs:1644` (`verify_fixture`) | from_str | not-a-gate | Not a gate: same self-produced replay records as :1571, in verify_fixture; pretty-print only. | +| `src/currency.rs:144` (`from_body`) | helper | **gate — routed** | (a) RateAuthorisation::from_body: decodes a signed event's body bytes; the decode feeds issuer/rate validation against the verified author. | +| `src/currency.rs:240` (`from_body`) | helper | **gate — routed** | (a) RateRevocation::from_body: decodes a signed event's body bytes; feeds revocation validation. | +| `src/currency_poc/intent.rs:265` (`scan`) | helper | **gate — routed** | Intent scan: reads *.json files from a directory, explicitly including foreign or schema-drifted content, into scanned records that are indexed/reported (PoC scope noted; the scan is a check over untrusted files). | +| `src/directory_log.rs:211` (`load`) | from_str | not-a-gate | (b) Self-produced file: the directory append log this crate writes; lines were gated when appended. Hand-edit defence only. | +| `src/foreign_libsql.rs:1319` (`parse_pipeline_rows`) | helper | **gate — routed** | parse_pipeline_rows: parses a libsql server's response body into rows returned to callers — remote-supplied input feeding a store/forward path. | +| `src/publications.rs:388` (`load`) | from_str | not-a-gate | (b) Self-produced file: the publications registry file this crate writes and reads back (validate_persisted runs after the parse); hand-edit defence only. | +| `crates/id-web/src/collab.rs:154` (`content_to_document`) | helper | **gate — routed** | Document content (ProseMirror JSON) parsed by content_to_document is retained by Document::with_content and forwarded to connected clients as CollabMessage::Init (src/web/collab.rs:911-928) — the contract's forward criterion applies; the empty-document fallback covers only unparseable input, not a duplicate-key collapse. (Reclassified on a verified Codex finding, PR #8796.) | +| `src/web/groups.rs:70` (`read_projection`) | from_str | not-a-gate | (b) Self-produced file: read_projection replays the same GroupLog file as id-groups log.rs:79 for the web projection. Hand-edit defence only. | +| `crates/id-web/src/identity.rs:586` (`decode_token`) | helper | **gate — routed** | (a) decode_token: token payload bytes are signature-verified (verify_strict) before this struct decode; the payload is a signed object — the (a) decision applies (refusal at receipt), noting the signature-first order as the existing mitigation. | +| `src/web/identity.rs:766` (`unseal`) | from_slice | not-a-gate | Not a gate: unseal decodes plaintext produced by AES-256-GCM decryption of this crate's own sealed records — the AEAD check already refuses any altered bytes before this parse; only the key holder can produce the input. | +| `src/web/mod.rs:380` (`load_asset_urls`) | from_str | not-a-gate | Not a gate: manifest.json is an asset embedded in the binary at build time (rust-embed), i.e. self-produced; a parse failure falls back to default asset URLs. | +| `crates/id-web/src/world_ws.rs:462` (`directory_write_handler`) | helper | **gate — routed** | directory_write_handler: HTTP request body from a web client decoded as DirectoryRequest and acted on as a directory write — client-supplied input feeding a store. | +| `crates/id-caps/src/world_caps.rs:837` (`parse_wants`) | helper | **gate — routed** | parse_wants: capability wants documents are checked against the caps schema — a checked gate, routed in Phase 2 (#6499). | +| `crates/id-caps/src/world_caps.rs:2574` (`consent_withdrawal_closes_an_open_watch_with_the_revocation_event`) | from_str | test-only | Inside the #[cfg(test)] module at world_caps.rs:1701 (a #[test] fn); the extraction's naive brace tracker under-counts braces inside string literals in that module — verified test-only by hand and grouped with the test sites below. | +| `crates/id-core/src/json_unique.rs:13` (`parse_json_without_duplicate_keys`) | helper | mechanism | The helper itself: recursive unique-key parse of one JSON text; refuses a repeated object key at any depth, naming the key. | +| `crates/id-core/src/petname.rs:80` (`open`) | from_str | not-a-gate | (b) Self-produced file: the petname record store this crate writes and reads back. Hand-edit defence only. | +| `crates/id-core/src/world_presentation.rs:550` (`parse_surface`) | helper | **gate — routed** | parse_surface: surface documents are checked (version/width/lines/rows) — routed in Phase 2 (#6491). | +| `crates/id-core/src/world_presentation.rs:559` (`parse_surface`) | from_str | not-a-gate | Deliberate exception inside a gate: after the helper at :550 has already REFUSED the document for a duplicate key, this lenient parse is used only to classify the document's kind — if it is a text/screen document (or kind itself is duplicated) the refusal stands and the document is rejected; the collapsed values are never validated, stored, or forwarded. Any other document keeps the legacy plain-text path. | +| `crates/id-core/src/world_presentation.rs:575` (`parse_surface`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :550 in the same function. | +| `crates/id-core/src/world_presentation.rs:592` (`parse_surface`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :550 in the same function. | +| `crates/id-events/src/attestation.rs:112` (`from_body`) | helper | **gate — routed** | (a) GenesisAgreement::from_body: decodes an agreement from a signed event's body bytes; feeds agreement hashing/validation. | +| `crates/id-events/src/attestation.rs:148` (`from_body`) | helper | **gate — routed** | (a) ResultClaim::from_body: decodes a result claim from a signed event's body bytes; feeds claim validation. | +| `crates/id-events/src/local_claims.rs:81` (`open`) | from_str | not-a-gate | (b) Self-produced file: the local claims line store this crate writes and reads back. Hand-edit defence only. | +| `crates/id-groups/src/groups/log.rs:79` (`open`) | from_str | not-a-gate | (b) Self-produced file: GroupLog::open replays the group's own append log; events were gated on the receipt path that appended them. Hand-edit defence only. | +| `crates/id-store/src/tags.rs:1731` (`load_registry`) | from_slice | not-a-gate | (b) Self-produced file: registry.json, the tag registry file this crate writes and reads back. Hand-edit defence only. | +| `crates/id-store/src/tags.rs:1913` (`load_meta`) | from_slice | not-a-gate | (b) Self-produced file: the tag MetaDoc file this crate writes and reads back. Hand-edit defence only. | +| `crates/id-sync/src/artifact.rs:681` (`decode`) | from_value | not-a-gate | (a) Downstream site: SignedArtifact::decode decodes the artifact's body Value into a typed body. No raw text is parsed here; the receipt parse of the artifact (see :1333/:1049) is where duplicates can enter, and that is the gate. | +| `crates/id-sync/src/artifact.rs:1049` (`open`) | from_str | not-a-gate | (b) Self-produced file: ArtifactStore::open replays the store's own artifact log; artifacts were gated at receipt (receive_pushed, :1333). Hand-edit defence only. | +| `crates/id-sync/src/artifact.rs:1076` (`open_read_only`) | from_str | not-a-gate | (b) Self-produced file: read-only replay of the same artifact store log as :1049. Hand-edit defence only. | +| `crates/id-sync/src/artifact.rs:1286` (`accept`) | helper | **gate — routed** | Pull protocol accept: peer-supplied frame decoded as PullRequest and served — peer input feeding a forward. | +| `crates/id-sync/src/artifact.rs:1333` (`receive_pushed`) | helper | **gate — routed** | (a) receive_pushed: peer-pushed bytes decoded as SignedArtifact and stored — THE signed-object receipt gate; the (a) decision (refusal at receipt) lands here. | +| `crates/id-sync/src/artifact.rs:1407` (`fetch_page_within`) | helper | **gate — routed** | fetch_page_within: a Page frame received from a peer server, decoded and consumed — peer input. | +| `crates/id-sync/src/envelope_net.rs:103` (`exchange`) | helper | **gate — routed** | exchange: a peer's Reply frame decoded into the outcome the caller acts on — peer input feeding a decision. | +| `crates/id-sync/src/envelope_net.rs:185` (`receive`) | helper | **gate — routed** | receive: peer-supplied bytes decoded as Envelope and handed to the hub for storage/forwarding — an envelope receipt gate. | +| `crates/id-sync/src/envelope_outbox.rs:173` (`open`) | from_str | not-a-gate | (b) Self-produced file: the envelope outbox record store this crate writes and reads back. Hand-edit defence only. | +| `crates/id-worlds/src/directory.rs:474` (`replay`) | from_str | not-a-gate | (b) Self-produced file: directory replay of the directory's own append log. Hand-edit defence only. | +| `crates/id-worlds/src/directory.rs:528` (`replay_read_only`) | from_str | not-a-gate | (b) Self-produced file: read-only directory replay of the same append log as :474. Hand-edit defence only. | +| `crates/id-directory/src/directory_view.rs:1060` (`action_from_fields`) | helper | **gate — routed** | publish_document action: operator-supplied content text parsed to a JSON Value that is then published (stored/forwarded) — collapse would change what is stored vs what was supplied. | +| `crates/id-directory/src/directory_view.rs:1073` (`action_from_fields`) | helper | **gate — routed** | receive action: operator-supplied envelope text parsed to a JSON Value and forwarded into envelope handling — collapse would change what is received vs what was supplied. | +| `crates/id-worlds/src/shell_contract.rs:173` (`try_from`) | from_value | not-a-gate | Not a gate: decodes a kind from Value::from(name) — a Value constructed in-process from a single string; no object keys exist in the input, so no duplicate is possible. | +| `crates/id-worlds/src/shell_contract.rs:309` (`parse`) | helper | **gate — routed** | ShellContract::parse: a contract document (file supplied to the checker) decoded into the routing/frame contract that checks enforce — a check input. | +| `crates/id-worlds/src/shell_contract.rs:680` (`check_transcript`) | helper | **gate — routed** | check_transcript: transcript lines decoded as part of checking a recorded transcript against the contract — a check. | +| `crates/id-worlds/src/world/core.rs:298` (`validate_import_envelope`) | helper | **gate — routed** | validate_import_envelope: a CHECK — parses a journal import event's envelope and compares protocol/direction/payload_digest; a collapsed duplicate could hide behind the compared fields. | +| `crates/id-worlds/src/world/mod.rs:1972` (`first_oversized_entry`) | from_slice | not-a-gate | (b) Self-produced file: first_oversized_entry measures lines of the world's own journal file. Hand-edit defence only. | +| `crates/id-worlds/src/world/mod.rs:1213` (`presence_change`) | helper | **gate — routed** | Embedded presence document: WorldCore::restore_inner (world/core.rs:1064-1095) passes a RECEIVED replica journal's System event text to presence_change and uses the decoded participant for a capability check (ensure the participant is known) and for presence counts — a check over received data, even though the same producer also builds presence strings in-process. The presence JSON is embedded as a string inside the journal entry, so routing the outer journal parsers through the helper does not cover it; the conversion must refuse duplicates in the embedded document itself. (Reclassified on a verified Codex finding, PR #8796.) | +| `crates/id-worlds/src/world/mod.rs:2145` (`parse_records`) | helper | **gate — routed** | parse_records: world records parse — routed. | +| `crates/id-worlds/src/world/replica.rs:118` (`parse_replica_journal`) | from_slice | not-a-gate | (b) Self-produced file: parse of the replica's own journal file; received journals are checked at receipt by validate_committed_journal (replication_receiver.rs:537, a gate). Hand-edit defence only. | +| `crates/id-worlds/src/world/replication.rs:531` (`chain_payload`) | helper | **gate — routed** | chain_payload: parses journal lines of a signed replication payload to advance the verified cursor — a check over peer-supplied payload bytes. | +| `crates/id-worlds/src/world/replication.rs:582` (`validate_payload_journal_header`) | helper | **gate — routed** | validate_payload_journal_header: checks a signed payload's journal header against its envelope — a check over peer-supplied payload bytes. | +| `crates/id-worlds/src/world/replication_receiver.rs:666` (`validate_committed_journal`) | helper | **gate — routed** | validate_committed_journal: validates a received journal (header/cursor) before restore — a check over received data. | +| `crates/id-worlds/src/world_cache.rs:272` (`open`) | from_str | not-a-gate | (b) Self-produced file: the world cache entry file this crate writes; a parse failure is a cache miss. Hand-edit defence only. | +| `crates/id-worlds/src/world_dev.rs:1033` (`promote`) | from_slice | not-a-gate | (b) Self-produced state: ProgramSnapshot state written by the world itself, decoded during promotion/migration. Hand-edit defence only. | +| `crates/id-worlds/src/world_dev.rs:1740` (`parse_fuzz_decl`) | helper | **gate — routed** | parse_fuzz_decl: a fuzz declaration parsed, then version/bounds-checked — the #6491 pattern (a duplicate version key would collapse before the check). | +| `crates/id-worlds/src/world_doctor.rs:419` (`inspect_journal_file`) | from_slice | not-a-gate | (b) Self-produced file: doctor inspection of a local journal file (diagnostic read). Hand-edit defence only. | +| `crates/id-worlds/src/world_fixture.rs:21` (`?`) | helper | mechanism | Import wiring: brings the helper into world_fixture (used at the two routed sites below). | +| `crates/id-worlds/src/world_fixture.rs:573` (`decode_header`) | helper | **gate — routed** | Fixture header parse — routed in Phase 1 (#6474); see disposition (d). | +| `crates/id-worlds/src/world_fixture.rs:621` (`decode_event`) | helper | **gate — routed** | Fixture event-line parse — routed in Phase 1 (#6474); see disposition (d). | +| `crates/id-worlds/src/world_net.rs:902` (`parse_caps_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["report"] of a frame parsed at world_net.rs:1511 — disposition follows that gate. | +| `crates/id-worlds/src/world_net.rs:922` (`parse_policy_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over a policy Value from a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:996` (`parse_caps_ceiling_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["report"] of a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:1036` (`set_schedule`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["schedules"] of a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:1070` (`cancel_schedule`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["schedules"] of a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:1137` (`parse_world_state_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["schedules"] of a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:1203` (`parse_set_execution_profile_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over a requested-profile Value carried in a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:1529` (`recv_json_with_frame_bytes`) | helper | **gate — routed** | recv_json_with_frame_bytes: THE inbound frame parse of the world host protocol; every world_net reply parser below consumes this Value, so this is the single conversion point for that family. | +| `crates/id-worlds/src/world_net.rs:1686` (`metrics`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["metrics"] of a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:1752` (`parse_module_info_reply`) | from_value | not-a-gate | Downstream of the frame gate: from_value over module-info Values from a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:1868` (`record_pages`) | from_value | not-a-gate | Downstream of the frame gate: from_value over reply["records"] of a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:2080` (`admin_event_history`) | from_value | not-a-gate | Downstream of the frame gate: from_value over frame["event"] of a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_net.rs:2104` (`admin_event_history`) | from_value | not-a-gate | Downstream of the frame gate: from_value over frame["records"] of a frame parsed at world_net.rs:1511. | +| `crates/id-worlds/src/world_records.rs:274` (`read_records`) | helper | **gate — routed** | read_records: records documents are counted/compared as written — routed 2026-11-07 (see backlog note on issue #6521). | +| `crates/id-worlds/src/world_replication_net.rs:128` (`serve_stream`) | helper | **gate — routed** | serve_stream: peer-supplied bytes decoded as a replication Request and served — peer input. | +| `crates/id-worlds/src/world_session/mod.rs:33` (`?`) | helper | mechanism | Re-export wiring: `pub(crate) use id_core::json_unique::parse_json_without_duplicate_keys` for the id-worlds crate. | +| `crates/id-worlds/src/world_session/mod.rs:155` (`run_session_with`) | helper | **gate — routed** | Session first frame: client frames are routed and installed from this parse — routed in Phase 1 (#6501, PR #6508). | +| `crates/id-worlds/src/world_session/mod.rs:176` (`run_session_with`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :155. | +| `crates/id-worlds/src/world_session/mod.rs:859` (`query_session`) | helper | **gate — routed** | query_session client frame parse — routed with the session protocol (#6501). | +| `crates/id-worlds/src/world_session/mod.rs:860` (`query_session`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :859. | +| `crates/id-worlds/src/world_session/mod.rs:1370` (`receive_module_upload`) | helper | **gate — routed** | receive_module_upload frame parse — routed with the session protocol (#6501). | +| `crates/id-worlds/src/world_session/mod.rs:1371` (`receive_module_upload`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :1370. | +| `crates/id-worlds/src/world_session/mod.rs:1390` (`receive_module_upload`) | from_value | not-a-gate | Downstream of a gate: the guard itself parses through the helper (same expression) before this from_value over the resulting Value. | +| `crates/id-worlds/src/world_session/mod.rs:2028` (`handle_client_frame`) | helper | **gate — routed** | handle_client_frame frame parse — routed with the session protocol (#6501). | +| `crates/id-worlds/src/world_session/mod.rs:2034` (`handle_client_frame`) | from_value | not-a-gate | Downstream of a gate: from_value over the Value produced by the helper parse at :2028. | +| `crates/id-worlds/src/world_ssh.rs:1301` (`send`) | helper | **gate — routed** | SSH session send path: an incoming frame is parsed to a Value and dispatched on type/surface — host-supplied input feeding rendering/state. | +| `crates/id-worlds/src/world_ssh.rs:1055` (`send`) | from_value | not-a-gate | Downstream of a gate: from_value over the surface field of the frame parsed at world_ssh.rs:1040 — disposition follows that gate. | +| `crates/id-worlds/src/world_store.rs:257` (`scan_entries`) | from_slice | not-a-gate | (b) Self-produced file: scan of the world's own journal file. Entries were gated when appended (session/replication receipt paths). Hand-edit defence only. | +| `crates/id-worlds/src/world_store.rs:811` (`read_journal_entries`) | from_slice | not-a-gate | (b) Self-produced file: read_journal_entries over the world's own journal file, as :257. Hand-edit defence only. | ## Test sites (grouped) diff --git a/pkgs/id/crates/id-core/src/admission_gate.rs b/pkgs/id/crates/id-core/src/admission_gate.rs index ff1af1cee6..fb10cc8e51 100644 --- a/pkgs/id/crates/id-core/src/admission_gate.rs +++ b/pkgs/id/crates/id-core/src/admission_gate.rs @@ -45,7 +45,7 @@ use std::collections::{BTreeMap, BTreeSet}; use std::fmt; -use crate::hash_profile::{ProfileDispatch, DEFAULT_MAX_CONTENT_BYTES}; +use crate::hash_profile::{DEFAULT_MAX_CONTENT_BYTES, ProfileDispatch}; use crate::id_shape::{HashProfile, IdShapeError}; use crate::signed_envelope::{Body, Envelope, EnvelopeError, EnvelopeId, PayloadId}; diff --git a/pkgs/id/crates/id-core/src/graph/attribute.rs b/pkgs/id/crates/id-core/src/graph/attribute.rs index 2bce0e8442..441afdb335 100644 --- a/pkgs/id/crates/id-core/src/graph/attribute.rs +++ b/pkgs/id/crates/id-core/src/graph/attribute.rs @@ -58,9 +58,7 @@ use super::term::{ObjectRef, Term, TermError}; use crate::canonical_cbor::{CborError, Value, decode_canonical, encode_canonical}; use crate::hash_profile::ProfileDispatch; use crate::id_shape::{ContentId, HashProfile}; -use crate::signed_envelope::{ - Body, Envelope, EnvelopeError, EnvelopeId, PayloadId, SUITE_ED25519, -}; +use crate::signed_envelope::{Body, Envelope, EnvelopeError, EnvelopeId, PayloadId, SUITE_ED25519}; /// The payload schema version this reader writes and accepts. pub const SCHEMA_VERSION: u64 = 1; diff --git a/pkgs/id/crates/id-core/src/graph/comment_projection.rs b/pkgs/id/crates/id-core/src/graph/comment_projection.rs index 755b9185f1..a0a84f0109 100644 --- a/pkgs/id/crates/id-core/src/graph/comment_projection.rs +++ b/pkgs/id/crates/id-core/src/graph/comment_projection.rs @@ -19,7 +19,7 @@ use std::collections::{HashMap, HashSet, VecDeque}; use super::social::{SocialObject, SocialObjectKind}; use super::term::ObjectRef; -use super::version::{ref_order_key, VersionDag}; +use super::version::{VersionDag, ref_order_key}; /// Projection-side filters over comment identities. #[derive(Debug, Clone, Default, PartialEq, Eq)] diff --git a/pkgs/id/crates/id-core/src/world_presentation.rs b/pkgs/id/crates/id-core/src/world_presentation.rs index 7d90a0c5ae..39939fbf05 100644 --- a/pkgs/id/crates/id-core/src/world_presentation.rs +++ b/pkgs/id/crates/id-core/src/world_presentation.rs @@ -947,8 +947,7 @@ impl SceneSurface { node.position .iter() .chain(node.size.iter()) - .all(|component| component.is_finite() - && component.abs() <= MAX_SCENE_EXTENT), + .all(|component| component.is_finite() && component.abs() <= MAX_SCENE_EXTENT), "scene geometry out of bounds" ); ensure!( @@ -2631,39 +2630,45 @@ mod tests { serde_json::json!({"kind": "scene", "version": 1, "nodes": nodes}).to_string() }; // Bad versions. - assert!(parse_surface( - &serde_json::json!({"kind": "scene", "version": 2, "nodes": [node("a")]}) - .to_string() - ) - .is_err()); - assert!(parse_surface( - &serde_json::json!({"kind": "scene", "version": 0, "nodes": [node("a")]}) - .to_string() - ) - .is_err()); + assert!( + parse_surface( + &serde_json::json!({"kind": "scene", "version": 2, "nodes": [node("a")]}) + .to_string() + ) + .is_err() + ); + assert!( + parse_surface( + &serde_json::json!({"kind": "scene", "version": 0, "nodes": [node("a")]}) + .to_string() + ) + .is_err() + ); // Unknown fields, top level and per node (deny_unknown_fields). assert!(parse_surface( &serde_json::json!({"kind": "scene", "version": 1, "html": "x", "nodes": [node("a")]}) .to_string() ) .is_err()); - assert!(parse_surface(&scene(serde_json::json!([ - {"id": "a", "label": "A", "shape": "box", "position": [0, 0, 0], - "size": [1, 1, 1], "onclick": "run()"} - ]))) - .is_err()); + assert!( + parse_surface(&scene(serde_json::json!([ + {"id": "a", "label": "A", "shape": "box", "position": [0, 0, 0], + "size": [1, 1, 1], "onclick": "run()"} + ]))) + .is_err() + ); // Unknown shape: the shape set is closed. - assert!(parse_surface(&scene(serde_json::json!([ - {"id": "a", "label": "A", "shape": "mesh", "position": [0, 0, 0], "size": [1, 1, 1]} - ]))) - .is_err()); + assert!( + parse_surface(&scene(serde_json::json!([ + {"id": "a", "label": "A", "shape": "mesh", "position": [0, 0, 0], "size": [1, 1, 1]} + ]))) + .is_err() + ); // Empty and duplicate-id node sets. assert!(parse_surface(&scene(serde_json::json!([]))).is_err()); assert!(parse_surface(&scene(serde_json::json!([node("a"), node("a")]))).is_err()); // Too many nodes: the bound is 256 (MAX_SCENE_NODES). - let many: Vec = (0..257) - .map(|index| node(&format!("n{index}"))) - .collect(); + let many: Vec = (0..257).map(|index| node(&format!("n{index}"))).collect(); assert!(parse_surface(&scene(Value::Array(many))).is_err()); // Unsafe label text (a JSON-escaped ESC). assert!(parse_surface(&scene(serde_json::json!([ @@ -2672,14 +2677,18 @@ mod tests { .is_err()); // Geometry bounds: size must be positive, position and size // components stay within 1_000_000 (MAX_SCENE_EXTENT). - assert!(parse_surface(&scene(serde_json::json!([ - {"id": "a", "label": "A", "shape": "box", "position": [0, 0, 0], "size": [0, 1, 1]} - ]))) - .is_err()); - assert!(parse_surface(&scene(serde_json::json!([ - {"id": "a", "label": "A", "shape": "box", "position": [0, 0, 0], "size": [-1, 1, 1]} - ]))) - .is_err()); + assert!( + parse_surface(&scene(serde_json::json!([ + {"id": "a", "label": "A", "shape": "box", "position": [0, 0, 0], "size": [0, 1, 1]} + ]))) + .is_err() + ); + assert!( + parse_surface(&scene(serde_json::json!([ + {"id": "a", "label": "A", "shape": "box", "position": [0, 0, 0], "size": [-1, 1, 1]} + ]))) + .is_err() + ); assert!(parse_surface(&scene(serde_json::json!([ {"id": "a", "label": "A", "shape": "box", "position": [1000001, 0, 0], "size": [1, 1, 1]} ]))) @@ -2780,16 +2789,18 @@ mod tests { serde_json::json!({"kind": "audio", "version": 1, "cues": cues}).to_string() }; // Bad versions. - assert!(parse_surface( - &serde_json::json!({"kind": "audio", "version": 2, "cues": [cue("a")]}) - .to_string() - ) - .is_err()); - assert!(parse_surface( - &serde_json::json!({"kind": "audio", "version": 0, "cues": [cue("a")]}) - .to_string() - ) - .is_err()); + assert!( + parse_surface( + &serde_json::json!({"kind": "audio", "version": 2, "cues": [cue("a")]}).to_string() + ) + .is_err() + ); + assert!( + parse_surface( + &serde_json::json!({"kind": "audio", "version": 0, "cues": [cue("a")]}).to_string() + ) + .is_err() + ); // Unknown fields, top level and per cue (deny_unknown_fields) — // in particular a cue carries no embedded bytes or URL. assert!(parse_surface( @@ -2797,16 +2808,20 @@ mod tests { .to_string() ) .is_err()); - assert!(parse_surface(&audio(serde_json::json!([ - {"id": "a", "label": "A", "format": "ogg", "duration_ms": 1000, - "repeat": false, "data": "AAAB"} - ]))) - .is_err()); + assert!( + parse_surface(&audio(serde_json::json!([ + {"id": "a", "label": "A", "format": "ogg", "duration_ms": 1000, + "repeat": false, "data": "AAAB"} + ]))) + .is_err() + ); // Unknown format: the format set is closed. - assert!(parse_surface(&audio(serde_json::json!([ - {"id": "a", "label": "A", "format": "flac", "duration_ms": 1000, "repeat": false} - ]))) - .is_err()); + assert!( + parse_surface(&audio(serde_json::json!([ + {"id": "a", "label": "A", "format": "flac", "duration_ms": 1000, "repeat": false} + ]))) + .is_err() + ); // Empty and duplicate-id cue sets. assert!(parse_surface(&audio(serde_json::json!([]))).is_err()); assert!(parse_surface(&audio(serde_json::json!([cue("a"), cue("a")]))).is_err()); @@ -2820,14 +2835,18 @@ mod tests { .is_err()); // Duration bounds: a cue lasts 1..=3_600_000 ms // (MAX_AUDIO_DURATION_MS, one hour). - assert!(parse_surface(&audio(serde_json::json!([ - {"id": "a", "label": "A", "format": "ogg", "duration_ms": 0, "repeat": false} - ]))) - .is_err()); - assert!(parse_surface(&audio(serde_json::json!([ - {"id": "a", "label": "A", "format": "ogg", "duration_ms": 3600001, "repeat": false} - ]))) - .is_err()); + assert!( + parse_surface(&audio(serde_json::json!([ + {"id": "a", "label": "A", "format": "ogg", "duration_ms": 0, "repeat": false} + ]))) + .is_err() + ); + assert!( + parse_surface(&audio(serde_json::json!([ + {"id": "a", "label": "A", "format": "ogg", "duration_ms": 3600001, "repeat": false} + ]))) + .is_err() + ); // Oversize document: the serialized cap is 65536 bytes // (MAX_AUDIO_BYTES); a single huge label trips it. assert!(parse_surface(&audio(serde_json::json!([ @@ -2878,23 +2897,25 @@ mod tests { // parse_surface, which the host turns into an error frame), // never silently dropped to the legacy text path and never // accepted. - let button = |id: &str| { - serde_json::json!({"kind": "button", "id": id, "label": "A", "action": "go"}) - }; + let button = |id: &str| serde_json::json!({"kind": "button", "id": id, "label": "A", "action": "go"}); let widget = |controls: Value| { serde_json::json!({"kind": "widget", "version": 1, "controls": controls}).to_string() }; // Bad versions. - assert!(parse_surface( - &serde_json::json!({"kind": "widget", "version": 2, "controls": [button("a")]}) - .to_string() - ) - .is_err()); - assert!(parse_surface( - &serde_json::json!({"kind": "widget", "version": 0, "controls": [button("a")]}) - .to_string() - ) - .is_err()); + assert!( + parse_surface( + &serde_json::json!({"kind": "widget", "version": 2, "controls": [button("a")]}) + .to_string() + ) + .is_err() + ); + assert!( + parse_surface( + &serde_json::json!({"kind": "widget", "version": 0, "controls": [button("a")]}) + .to_string() + ) + .is_err() + ); // Unknown fields, top level and per control // (deny_unknown_fields) — in particular a control carries no // URL or script. @@ -2903,21 +2924,27 @@ mod tests { .to_string() ) .is_err()); - assert!(parse_surface(&widget(serde_json::json!([ - {"kind": "button", "id": "a", "label": "A", "action": "go", - "script": "run()"} - ]))) - .is_err()); + assert!( + parse_surface(&widget(serde_json::json!([ + {"kind": "button", "id": "a", "label": "A", "action": "go", + "script": "run()"} + ]))) + .is_err() + ); // Unknown control kind: the kind set is closed. - assert!(parse_surface(&widget(serde_json::json!([ - {"kind": "slider", "id": "a", "label": "A", "action": "go"} - ]))) - .is_err()); + assert!( + parse_surface(&widget(serde_json::json!([ + {"kind": "slider", "id": "a", "label": "A", "action": "go"} + ]))) + .is_err() + ); // A link names no action: following it must deliver one. - assert!(parse_surface(&widget(serde_json::json!([ - {"kind": "link", "id": "a", "label": "A"} - ]))) - .is_err()); + assert!( + parse_surface(&widget(serde_json::json!([ + {"kind": "link", "id": "a", "label": "A"} + ]))) + .is_err() + ); // Empty and duplicate-id control sets. assert!(parse_surface(&widget(serde_json::json!([]))).is_err()); assert!(parse_surface(&widget(serde_json::json!([button("a"), button("a")]))).is_err()); @@ -2926,21 +2953,27 @@ mod tests { assert!(parse_surface(&widget(Value::Array(many))).is_err()); // Unsafe label text (a JSON-escaped ESC) and an unsafe action // id (a URL is not an action id). - assert!(parse_surface(&widget(serde_json::json!([ - {"kind": "button", "id": "a", "label": "A\u{001b}[2J", "action": "go"} - ]))) - .is_err()); - assert!(parse_surface(&widget(serde_json::json!([ - {"kind": "button", "id": "a", "label": "A", - "action": "https://example.invalid"} - ]))) - .is_err()); + assert!( + parse_surface(&widget(serde_json::json!([ + {"kind": "button", "id": "a", "label": "A\u{001b}[2J", "action": "go"} + ]))) + .is_err() + ); + assert!( + parse_surface(&widget(serde_json::json!([ + {"kind": "button", "id": "a", "label": "A", + "action": "https://example.invalid"} + ]))) + .is_err() + ); // Oversize document: the serialized cap is 65536 bytes // (MAX_WIDGET_BYTES); a single huge label trips it. - assert!(parse_surface(&widget(serde_json::json!([ - {"kind": "button", "id": "a", "label": "x".repeat(70_000), "action": "go"} - ]))) - .is_err()); + assert!( + parse_surface(&widget(serde_json::json!([ + {"kind": "button", "id": "a", "label": "x".repeat(70_000), "action": "go"} + ]))) + .is_err() + ); } #[test] diff --git a/pkgs/id/crates/id-core/tests/admission_gate.rs b/pkgs/id/crates/id-core/tests/admission_gate.rs index c01c9c16cf..b31288cb1f 100644 --- a/pkgs/id/crates/id-core/tests/admission_gate.rs +++ b/pkgs/id/crates/id-core/tests/admission_gate.rs @@ -49,7 +49,7 @@ use admission_gate::{ use ed25519_dalek::{Signer as _, SigningKey}; use id_shape::HashProfile; use proptest::prelude::*; -use signed_envelope::{signature_preimage, Body, Envelope, PayloadId, SUITE_ED25519}; +use signed_envelope::{Body, Envelope, PayloadId, SUITE_ED25519, signature_preimage}; const RAW: HashProfile = HashProfile::RawBlake3_256; const DOMAIN: &str = "id/atlas"; diff --git a/pkgs/id/crates/id-core/tests/attribute_definition.rs b/pkgs/id/crates/id-core/tests/attribute_definition.rs index 72ca2bc5c4..226b21c020 100644 --- a/pkgs/id/crates/id-core/tests/attribute_definition.rs +++ b/pkgs/id/crates/id-core/tests/attribute_definition.rs @@ -324,7 +324,9 @@ fn explicit_append_modes_are_distinct_states() { .zip(&payloads) { assert_eq!( - AttributeDefinition::from_payload(payload).unwrap().append_mode, + AttributeDefinition::from_payload(payload) + .unwrap() + .append_mode, *mode ); } @@ -345,8 +347,16 @@ fn malformed_scope_and_policy_reject() { "name {bad_name:?}" ); } - for bad_tenant in ["", "0123456789abcdef", "0123456789ABCDEF0123456789abcdef", "zz3456789abcdef0123456789abcdef"] { - assert!(TenantId::parse(bad_tenant).is_err(), "tenant {bad_tenant:?}"); + for bad_tenant in [ + "", + "0123456789abcdef", + "0123456789ABCDEF0123456789abcdef", + "zz3456789abcdef0123456789abcdef", + ] { + assert!( + TenantId::parse(bad_tenant).is_err(), + "tenant {bad_tenant:?}" + ); } // Malformed payloads, one field at a time; the module and the @@ -355,10 +365,20 @@ fn malformed_scope_and_policy_reject() { ("name", Some(Value::Text(String::new()))), ("name", Some(Value::Text("a/b".to_owned()))), ("name", Some(Value::Text("n".repeat(129)))), - ("tenant", Some(Value::Text("0123456789ABCDEF0123456789abcdef".to_owned()))), + ( + "tenant", + Some(Value::Text("0123456789ABCDEF0123456789abcdef".to_owned())), + ), ("tenant", Some(Value::Text("short".to_owned()))), ("owner_space", Some(Value::Bytes(vec![1, 2, 3]))), - ("target", Some(Term::typed(7, b"not a reference".to_vec()).to_value().unwrap())), + ( + "target", + Some( + Term::typed(7, b"not a reference".to_vec()) + .to_value() + .unwrap(), + ), + ), ("kind", Some(Value::Text(String::new()))), ("audience", Some(Value::Text("everyone".to_owned()))), ("append_mode", Some(Value::Text("ajar".to_owned()))), @@ -468,9 +488,7 @@ fn cross_tenant_references_reject() { // A reference homed in the definition's own tenant is fine, and // so is the target when the fixture homes it locally. let mut local = FixtureAuthority::new(&owner, &admin); - local - .homes - .push((candidate.scope.target, tenant_a())); + local.homes.push((candidate.scope.target, tenant_a())); let local_opened = definition(&owner, AppendMode::Open) .sign("owner", &owner, None) .unwrap(); @@ -508,10 +526,7 @@ fn envelope_tenant_binding_and_domain_reject() { payload_length: payload.len() as u64, }; let mismatched = Envelope::sign( - body_for( - attribute::ATTRIBUTE_DEFINITION_DOMAIN, - tenant_b().as_str(), - ), + body_for(attribute::ATTRIBUTE_DEFINITION_DOMAIN, tenant_b().as_str()), payload.clone(), &owner, ) diff --git a/pkgs/id/crates/id-core/tests/carried_comment_projection.rs b/pkgs/id/crates/id-core/tests/carried_comment_projection.rs index a17a95acb2..4b28f4f5d8 100644 --- a/pkgs/id/crates/id-core/tests/carried_comment_projection.rs +++ b/pkgs/id/crates/id-core/tests/carried_comment_projection.rs @@ -11,7 +11,7 @@ use std::collections::HashSet; -use id_core::graph::comment_projection::{carried_comments, CommentFilters}; +use id_core::graph::comment_projection::{CommentFilters, carried_comments}; use id_core::graph::social::{SocialObject, SocialObjectKind}; use id_core::graph::term::{ObjectRef, Term}; use id_core::graph::version::{SucceedsEdge, Version, VersionDag}; diff --git a/pkgs/id/crates/id-core/tests/existence_receipt.rs b/pkgs/id/crates/id-core/tests/existence_receipt.rs index 7bc8820b0e..f14a72062a 100644 --- a/pkgs/id/crates/id-core/tests/existence_receipt.rs +++ b/pkgs/id/crates/id-core/tests/existence_receipt.rs @@ -27,9 +27,9 @@ use ed25519_dalek::{Signature, SigningKey, Verifier, VerifyingKey}; use sha2::{Digest, Sha256}; use existence_receipt::{ - check_presence, presence_response, subject_digest, verify, AckContext, AckError, - CoalescedExistence, ExistenceEvidence, ExistenceResult, ExistsAck, Responder, SignedAck, - StoredUnverifiedObservation, + AckContext, AckError, CoalescedExistence, ExistenceEvidence, ExistenceResult, ExistsAck, + Responder, SignedAck, StoredUnverifiedObservation, check_presence, presence_response, + subject_digest, verify, }; // --------------------------------------------------------------------------- diff --git a/pkgs/id/crates/id-core/tests/social_graph_traversal.rs b/pkgs/id/crates/id-core/tests/social_graph_traversal.rs index df88ec94ff..9d02a5a305 100644 --- a/pkgs/id/crates/id-core/tests/social_graph_traversal.rs +++ b/pkgs/id/crates/id-core/tests/social_graph_traversal.rs @@ -13,8 +13,8 @@ use std::collections::{HashMap, HashSet}; use id_core::graph::social::{ - traverse, FeedError, FeedLedger, FeedScope, SocialObject, SocialObjectKind, SourcePosition, - Traversal, TraversalMark, TraversalProfile, + FeedError, FeedLedger, FeedScope, SocialObject, SocialObjectKind, SourcePosition, Traversal, + TraversalMark, TraversalProfile, traverse, }; use id_core::graph::term::ObjectRef; use id_core::graph::version::ref_order_key; diff --git a/pkgs/id/crates/id-events/src/local_events.rs b/pkgs/id/crates/id-events/src/local_events.rs index 904fd38d26..f59f66bbe6 100644 --- a/pkgs/id/crates/id-events/src/local_events.rs +++ b/pkgs/id/crates/id-events/src/local_events.rs @@ -344,7 +344,9 @@ impl LocalEvents { /// gives for the identity event itself. pub fn ensure_identity_event(&mut self) -> Result> { let author = self.author(); - let chain = self.read_store(|store| store.chain(&author))?.unwrap_or_default(); + let chain = self + .read_store(|store| store.chain(&author))? + .unwrap_or_default(); for seq in 0..chain.next_seq { if let Some(event) = self.read_store(|store| store.event(&author, seq))? { if is_identity_kind(&event.header.extensions.kind) { @@ -468,7 +470,10 @@ impl LocalEvents { pub fn send_chat(&mut self, group: Hash, message: ChatMessage) -> Result { message.check()?; let author = self.author(); - if !self.read_store(|store| store.roster(&group))?.contains(&author) { + if !self + .read_store(|store| store.roster(&group))? + .contains(&author) + { bail!( "the node's key is not a member of the channel group, so its chat write is refused at admission" ); @@ -508,7 +513,10 @@ impl LocalEvents { pub fn send_anchor(&mut self, group: Hash, anchor: ChatAnchor) -> Result { anchor.check()?; let author = self.author(); - if !self.read_store(|store| store.roster(&group))?.contains(&author) { + if !self + .read_store(|store| store.roster(&group))? + .contains(&author) + { bail!( "the node's key is not a member of the channel group, so its anchor write is refused at admission" ); @@ -1160,7 +1168,9 @@ impl LocalEvents { ) -> Result { let author = self.author(); let after = self.bounded_after(required)?; - let chain = self.read_store(|store| store.chain(&author))?.unwrap_or_default(); + let chain = self + .read_store(|store| store.chain(&author))? + .unwrap_or_default(); let ext = ChainExt { kind: kind.to_owned(), group, @@ -1671,8 +1681,16 @@ mod tests { assert_eq!(visible.len(), 1); assert_eq!(visible[0].id, id); assert_eq!(visible[0].scope, TagScope::Local); - assert!(events.read_store(|store| store.tag_claims()).unwrap().is_empty()); - assert_eq!(events.read_store(|store| store.sync_entries()).unwrap(), before); + assert!( + events + .read_store(|store| store.tag_claims()) + .unwrap() + .is_empty() + ); + assert_eq!( + events.read_store(|store| store.sync_entries()).unwrap(), + before + ); assert_eq!(events.review_tags().unwrap(), visible); assert_eq!( events.search("city", Some("Oslo")).unwrap()[0].claims, @@ -1748,7 +1766,10 @@ mod tests { assert_eq!(shared[0].scope, TagScope::Shared); assert_ne!(shared[0].id, local_id); assert!(events.local.claims().is_empty()); - assert_eq!(events.read_store(|store| store.tag_claims()).unwrap(), shared); + assert_eq!( + events.read_store(|store| store.tag_claims()).unwrap(), + shared + ); assert_eq!( events @@ -1759,7 +1780,12 @@ mod tests { let local = events.tags_on(subject).unwrap(); assert_eq!(local.len(), 1); assert_eq!(local[0].scope, TagScope::Local); - assert!(events.read_store(|store| store.tag_claims()).unwrap().is_empty()); + assert!( + events + .read_store(|store| store.tag_claims()) + .unwrap() + .is_empty() + ); } #[test] @@ -1809,7 +1835,10 @@ mod tests { assert_eq!(count, 1); assert!(events.tags_on(subject).unwrap().is_empty()); - assert_eq!(events.read_store(|store| store.sync_entries()).unwrap(), before); + assert_eq!( + events.read_store(|store| store.sync_entries()).unwrap(), + before + ); } fn open_events() -> (tempfile::TempDir, LocalEvents) { @@ -1869,9 +1898,10 @@ mod tests { assert!(matches!(ingested, Ingest::Accepted { .. }), "{ingested:?}"); let frontier = events.frontier().unwrap(); assert!( - frontier.iter().any(|head| head.author - == *key(9).verifying_key().as_bytes() - && head.event == foreign.id), + frontier + .iter() + .any(|head| head.author == *key(9).verifying_key().as_bytes() + && head.event == foreign.id), "the foreign event is missing from the frontier: {frontier:?}" ); } @@ -2014,9 +2044,7 @@ mod chat_tests { /// A node whose store already holds the channel create, as sync would have brought it. fn node(dir: &Path, key: SigningKey, create: &Event, body: &[u8]) -> LocalEvents { let mut node = LocalEvents::open(dir, key).unwrap(); - node.store - .ingest(&create.bytes, Some(body), 0) - .unwrap(); + node.store.ingest(&create.bytes, Some(body), 0).unwrap(); node } @@ -2066,7 +2094,12 @@ mod chat_tests { // A non-member's write is refused at admission: nothing is signed or recorded. let refused = node_c.send_chat(group, ChatMessage::new("carol here", Vec::new()).unwrap()); assert!(refused.is_err()); - assert!(node_c.read_store(|store| store.chat_records(&group)).unwrap().is_empty()); + assert!( + node_c + .read_store(|store| store.chat_records(&group)) + .unwrap() + .is_empty() + ); let first = node_a .send_chat( diff --git a/pkgs/id/crates/id-import-notion/tests/fixtures/database.json b/pkgs/id/crates/id-import-notion/tests/fixtures/database.json index 4684f40bb9..35c7e3c1cb 100644 --- a/pkgs/id/crates/id-import-notion/tests/fixtures/database.json +++ b/pkgs/id/crates/id-import-notion/tests/fixtures/database.json @@ -2,8 +2,5 @@ "object": "database", "id": "db-alpha", "parent": { "type": "workspace", "workspace": true }, - "data_sources": [ - { "id": "source-alpha", "name": "Tasks" }, - { "id": "source-beta", "name": "Archived tasks" } - ] + "data_sources": [{ "id": "source-alpha", "name": "Tasks" }, { "id": "source-beta", "name": "Archived tasks" }] } diff --git a/pkgs/id/crates/id-import-notion/tests/fixtures/search.json b/pkgs/id/crates/id-import-notion/tests/fixtures/search.json index b372893a8c..cf2deba9a7 100644 --- a/pkgs/id/crates/id-import-notion/tests/fixtures/search.json +++ b/pkgs/id/crates/id-import-notion/tests/fixtures/search.json @@ -17,7 +17,13 @@ "object": "page", "id": "page-root", "parent": { "type": "workspace", "workspace": true }, - "cover": { "type": "file", "file": { "url": "https://files.notion.so/signed-secret?token=fixture-secret", "expiry_time": "2026-11-21T00:00:00Z" } }, + "cover": { + "type": "file", + "file": { + "url": "https://files.notion.so/signed-secret?token=fixture-secret", + "expiry_time": "2026-11-21T00:00:00Z" + } + }, "last_edited_time": "2026-11-01T10:00:00.000Z" } ], diff --git a/pkgs/id/crates/id-native-shell/capability-statement.json b/pkgs/id/crates/id-native-shell/capability-statement.json index 9dcd8fa23d..dff89b542f 100644 --- a/pkgs/id/crates/id-native-shell/capability-statement.json +++ b/pkgs/id/crates/id-native-shell/capability-statement.json @@ -1 +1,55 @@ -{"contract":{"file":"pkgs/id/contract/shell-contract.v1.json","name":"id-shell","version":1},"excludes":["rich surfaces (3D, audio, widget) — design steps 3-4, conditional on the F13.6 Q1 decision; not in this shell","frame kinds the contract does not name — the shell adds none and privately extends none","offline reading — not claimed; that is the browser shell's slice-1 surface (issue #10927). This shell presents a live session","mobile-native presentation — deferred to the v2 rung (issue #6297)"],"platform":"linux-desktop","posture":"local-first: the shell is a presentation client of a world host reached directly over iroh; it hosts no world and implements no hosted or quota surface","presentation":{"error":"not presented as content: an error frame refuses the session and surfaces as a session failure","events":"retained as a bounded tail and summarized for presentation (chat_posted, region_changed, object_changed, input_applied, program_changed, system_event)","screen":"styled per-cell grid with the xterm-256 palette (src/render.rs)","semantic_diff":"retained as a bounded tail and rendered as text (agent profile, contract revision 11)","surface_less_view":"the legacy `data` text fallback, the same rule the terminal shell presents","text_and_form":"deterministic text projection; form surfaces render as widget rows with their actions, answered with form_result","view_surfaces":["screen","text","form"]},"presents":["error","event","form_result_status","program_changed","provider_request","screen_subscription","semantic_diff","snapshot","view"],"providers":[{"declaration":"named in the provider_offer frame at session start; the grant is local and per world, bounded by the F12.4 provider manifest (id_caps::world_caps::CLIENT_FILE_READ_MANIFEST) composed by minimum with the shell's local bounds — a provider only ever narrows the session","execution":"reads only beneath the granted root (openat2 RESOLVE_BENEATH on Linux); every request is answered with a provider_reply frame and recorded in the shell's local audit","id":"client.file.read","kind":"client capability provider (F13.7, issue #789)"}],"recorded_for":"shells v1 slice 2 (issue #10928); terms per doc/2026-11-10T20-40-00Z_design_more_shells_v1 (issue #6296), section 2 and 'The one gate'","sends":["chat","form_result","input","join","paste","provider_offer","provider_reply","resize","screen_subscribe"],"shell":"id-native-shell","statement":"shell-capability-statement","transport":"iroh (contract transport 'iroh', alpn /id-world/1)","version":1} \ No newline at end of file +{ + "contract": { "file": "pkgs/id/contract/shell-contract.v1.json", "name": "id-shell", "version": 1 }, + "excludes": [ + "rich surfaces (3D, audio, widget) — design steps 3-4, conditional on the F13.6 Q1 decision; not in this shell", + "frame kinds the contract does not name — the shell adds none and privately extends none", + "offline reading — not claimed; that is the browser shell's slice-1 surface (issue #10927). This shell presents a live session", + "mobile-native presentation — deferred to the v2 rung (issue #6297)" + ], + "platform": "linux-desktop", + "posture": "local-first: the shell is a presentation client of a world host reached directly over iroh; it hosts no world and implements no hosted or quota surface", + "presentation": { + "error": "not presented as content: an error frame refuses the session and surfaces as a session failure", + "events": "retained as a bounded tail and summarized for presentation (chat_posted, region_changed, object_changed, input_applied, program_changed, system_event)", + "screen": "styled per-cell grid with the xterm-256 palette (src/render.rs)", + "semantic_diff": "retained as a bounded tail and rendered as text (agent profile, contract revision 11)", + "surface_less_view": "the legacy `data` text fallback, the same rule the terminal shell presents", + "text_and_form": "deterministic text projection; form surfaces render as widget rows with their actions, answered with form_result", + "view_surfaces": ["screen", "text", "form"] + }, + "presents": [ + "error", + "event", + "form_result_status", + "program_changed", + "provider_request", + "screen_subscription", + "semantic_diff", + "snapshot", + "view" + ], + "providers": [ + { + "declaration": "named in the provider_offer frame at session start; the grant is local and per world, bounded by the F12.4 provider manifest (id_caps::world_caps::CLIENT_FILE_READ_MANIFEST) composed by minimum with the shell's local bounds — a provider only ever narrows the session", + "execution": "reads only beneath the granted root (openat2 RESOLVE_BENEATH on Linux); every request is answered with a provider_reply frame and recorded in the shell's local audit", + "id": "client.file.read", + "kind": "client capability provider (F13.7, issue #789)" + } + ], + "recorded_for": "shells v1 slice 2 (issue #10928); terms per doc/2026-11-10T20-40-00Z_design_more_shells_v1 (issue #6296), section 2 and 'The one gate'", + "sends": [ + "chat", + "form_result", + "input", + "join", + "paste", + "provider_offer", + "provider_reply", + "resize", + "screen_subscribe" + ], + "shell": "id-native-shell", + "statement": "shell-capability-statement", + "transport": "iroh (contract transport 'iroh', alpn /id-world/1)", + "version": 1 +} diff --git a/pkgs/id/crates/id-native-shell/src/providers.rs b/pkgs/id/crates/id-native-shell/src/providers.rs index f9c8760e59..c3d12d389d 100644 --- a/pkgs/id/crates/id-native-shell/src/providers.rs +++ b/pkgs/id/crates/id-native-shell/src/providers.rs @@ -1308,13 +1308,15 @@ mod notify_tests { adapter.offer_frame("world-a"), Some(json!({"type": "provider_offer", "providers": ["client.notify"]})) ); - let reply = adapter.handle_request("world-a", ¬ify_request("n1", json!({"head": 9})), 1_000); + let reply = + adapter.handle_request("world-a", ¬ify_request("n1", json!({"head": 9})), 1_000); assert_eq!(reply["ok"], true); assert_eq!(reply["result_hex"], json!("")); assert_eq!(adapter.audit_entries()[0].outcome, "executed"); // A second world without the grant is still refused, never offered. assert_eq!(adapter.offer_frame("world-b"), None); - let reply = adapter.handle_request("world-b", ¬ify_request("n2", json!({"head": 9})), 1_000); + let reply = + adapter.handle_request("world-b", ¬ify_request("n2", json!({"head": 9})), 1_000); assert_eq!(reply["error"], REFUSAL_NOT_GRANTED); } @@ -1349,7 +1351,8 @@ mod notify_tests { // projection plus the host view (slice 1's catch-up seam, // #10927); this test pins the decision that gates that run. let mut adapter = notified_adapter(); - let reply = adapter.handle_request("world-a", ¬ify_request("n1", json!({"head": 12})), 1_000); + let reply = + adapter.handle_request("world-a", ¬ify_request("n1", json!({"head": 12})), 1_000); assert_eq!(reply["ok"], true); // A shell behind the hint must re-sync on return ... assert!(notify_needs_resync(Some(7), Some(12))); @@ -1362,6 +1365,11 @@ mod notify_tests { assert!(notify_needs_resync(Some(13), None)); // Both deliveries are audited as executions, with no content. assert_eq!(adapter.audit_entries().len(), 2); - assert!(adapter.audit_entries().iter().all(|entry| entry.outcome == "executed")); + assert!( + adapter + .audit_entries() + .iter() + .all(|entry| entry.outcome == "executed") + ); } } diff --git a/pkgs/id/crates/id-store/src/array_query.rs b/pkgs/id/crates/id-store/src/array_query.rs index b4c2d782f3..13afb8a2df 100644 --- a/pkgs/id/crates/id-store/src/array_query.rs +++ b/pkgs/id/crates/id-store/src/array_query.rs @@ -49,12 +49,12 @@ //! file by path. use std::fmt; -use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering}; use id_core::array_address::ArrayAddress; use id_core::array_order::cmp_address; -use id_core::canonical_cbor::{decode_canonical, encode_canonical, Value}; +use id_core::canonical_cbor::{Value, decode_canonical, encode_canonical}; /// The one sort profile this slice issues cursors under: /// ascending A9118 typed lexicographic address order. The diff --git a/pkgs/id/crates/id-store/src/namespace_registry.rs b/pkgs/id/crates/id-store/src/namespace_registry.rs index 666c60c44a..6c815f3c92 100644 --- a/pkgs/id/crates/id-store/src/namespace_registry.rs +++ b/pkgs/id/crates/id-store/src/namespace_registry.rs @@ -695,7 +695,11 @@ impl RegistryState { (text("generation"), Value::UInt(self.generation)), ( text("definitions"), - Value::Array(self.definitions().map(NamespaceDefinition::to_value).collect()), + Value::Array( + self.definitions() + .map(NamespaceDefinition::to_value) + .collect(), + ), ), ( text("audit"), diff --git a/pkgs/id/crates/id-store/src/note_blocks.rs b/pkgs/id/crates/id-store/src/note_blocks.rs index 019cc9e584..83a7738d26 100644 --- a/pkgs/id/crates/id-store/src/note_blocks.rs +++ b/pkgs/id/crates/id-store/src/note_blocks.rs @@ -703,7 +703,9 @@ mod tests { children: vec![block], }; } - let tree = BlockTree { blocks: vec![block] }; + let tree = BlockTree { + blocks: vec![block], + }; assert!(matches!(tree.check(), Err(BlockError::TooDeep))); let bytes = tree.to_bytes().unwrap(); assert!(matches!( diff --git a/pkgs/id/crates/id-store/src/note_checkpoints.rs b/pkgs/id/crates/id-store/src/note_checkpoints.rs index c6b8799613..2cf409ea84 100644 --- a/pkgs/id/crates/id-store/src/note_checkpoints.rs +++ b/pkgs/id/crates/id-store/src/note_checkpoints.rs @@ -1158,8 +1158,12 @@ mod tests { // by another author: the fold lists it first, but the owner is // still the create event's author. let mut log = NoteCheckpoints::new(); - let note = log.create(hash(10), author(1), content(b"first")).unwrap().id; - log.checkpoint(note, hash(9), author(2), content(b"earlier id"), vec![note]).unwrap(); + let note = log + .create(hash(10), author(1), content(b"first")) + .unwrap() + .id; + log.checkpoint(note, hash(9), author(2), content(b"earlier id"), vec![note]) + .unwrap(); assert_eq!( log.notes().unwrap()[0].revisions.first().unwrap().author, author(2), diff --git a/pkgs/id/crates/id-store/src/related_links.rs b/pkgs/id/crates/id-store/src/related_links.rs index c54002a901..9874db095d 100644 --- a/pkgs/id/crates/id-store/src/related_links.rs +++ b/pkgs/id/crates/id-store/src/related_links.rs @@ -157,7 +157,10 @@ impl fmt::Display for LinkError { Self::Field { field, problem } => write!(f, "field {field}: {problem}"), Self::InvalidPathRef { problem } => write!(f, "invalid path reference: {problem}"), Self::ResourceLimit { limit, actual } => { - write!(f, "path reference is {actual} bytes, over the {limit}-byte cap") + write!( + f, + "path reference is {actual} bytes, over the {limit}-byte cap" + ) } Self::UnsupportedTargetKind { kind } => { write!(f, "unsupported link target kind {kind:?}") @@ -213,7 +216,10 @@ fn map(mut entries: Vec<(&'static str, Value)>) -> Value { } /// The entries of a map value, or a field error naming `field`. -fn map_entries<'a>(value: &'a Value, field: &'static str) -> Result<&'a [(Value, Value)], LinkError> { +fn map_entries<'a>( + value: &'a Value, + field: &'static str, +) -> Result<&'a [(Value, Value)], LinkError> { match value { Value::Map(entries) => Ok(entries), _ => Err(LinkError::Field { @@ -276,12 +282,12 @@ fn content_id_from(value: &Value, field: &'static str) -> Result <[u8; 32]>::try_from(bytes.as_slice()).map_err(|_error| { - LinkError::Field { + Value::Bytes(bytes) => { + <[u8; 32]>::try_from(bytes.as_slice()).map_err(|_error| LinkError::Field { field, problem: "has the wrong length", - } - })?, + })? + } _ => { return Err(LinkError::Field { field, @@ -417,10 +423,7 @@ impl LinkTarget { ("id", content_id_value(id.content_id())), ("kind", text("snapshot")), ]), - Self::PathRef(path) => map(vec![ - ("kind", text("path")), - ("path", text(path.as_str())), - ]), + Self::PathRef(path) => map(vec![("kind", text("path")), ("path", text(path.as_str()))]), Self::LocationRef(reference) => map(vec![ ("kind", text("location")), ( @@ -473,17 +476,21 @@ impl LinkTarget { } "path" => { check_known(entries, &["kind", "path"])?; - Ok(Self::PathRef(PathRef::new(&required_text(entries, "path")?)?)) + Ok(Self::PathRef(PathRef::new(&required_text( + entries, "path", + )?)?)) } "location" => { check_known(entries, &["kind", "location"])?; let location = map_entries(required(entries, "location")?, "location")?; check_known(location, &["locator", "namespace", "tenant_scope"])?; let locator = TypedLocator::parse_tagged(&required_text(location, "locator")?)?; - let namespace = NamespaceId::new(required_text(location, "namespace")?) - .map_err(|_error| LinkError::Field { - field: "namespace", - problem: "is not a valid namespace id", + let namespace = + NamespaceId::new(required_text(location, "namespace")?).map_err(|_error| { + LinkError::Field { + field: "namespace", + problem: "is not a valid namespace id", + } })?; Ok(Self::LocationRef(LocationRef::new( locator, @@ -666,10 +673,7 @@ impl LinkResolution { /// cannot vouch for resolves [`LinkResolution::Dangling`], never an /// error. Resolution is read-only: it never rewrites or prunes the /// link (design §5). -pub fn resolve_link( - link: &RelatedLink, - exists: impl Fn(&LinkTarget) -> bool, -) -> LinkResolution { +pub fn resolve_link(link: &RelatedLink, exists: impl Fn(&LinkTarget) -> bool) -> LinkResolution { if exists(&link.target) { LinkResolution::Resolved { target: link.target.clone(), @@ -686,5 +690,8 @@ pub fn resolve_links( links: &[RelatedLink], exists: impl Fn(&LinkTarget) -> bool, ) -> Vec { - links.iter().map(|link| resolve_link(link, &exists)).collect() + links + .iter() + .map(|link| resolve_link(link, &exists)) + .collect() } diff --git a/pkgs/id/crates/id-store/src/store_traits.rs b/pkgs/id/crates/id-store/src/store_traits.rs index 67bf82e1ab..7e785fed2d 100644 --- a/pkgs/id/crates/id-store/src/store_traits.rs +++ b/pkgs/id/crates/id-store/src/store_traits.rs @@ -178,7 +178,6 @@ impl SharedEventStore { } } - /// Verifies and applies one received event, with its body. `body` is the bytes the header /// commits to, or `None` when the event arrived without one. The action of a group operation /// comes from the body. See [`EventStore::ingest_with_body`]. diff --git a/pkgs/id/crates/id-store/src/stream_subscribe.rs b/pkgs/id/crates/id-store/src/stream_subscribe.rs index 4ae2ddc4f8..d70486ec30 100644 --- a/pkgs/id/crates/id-store/src/stream_subscribe.rs +++ b/pkgs/id/crates/id-store/src/stream_subscribe.rs @@ -63,7 +63,7 @@ use std::fmt; -use crate::canonical_cbor::{decode_canonical, encode_canonical, CborError, Value}; +use crate::canonical_cbor::{CborError, Value, decode_canonical, encode_canonical}; use crate::id_shape::{ContentId, HashProfile, IdShapeError}; use crate::signed_envelope::MAX_LABEL_BYTES; use crate::stream_record::{ diff --git a/pkgs/id/crates/id-store/tests/namespace_registry_model.rs b/pkgs/id/crates/id-store/tests/namespace_registry_model.rs index 10dba7d127..27f8c83f36 100644 --- a/pkgs/id/crates/id-store/tests/namespace_registry_model.rs +++ b/pkgs/id/crates/id-store/tests/namespace_registry_model.rs @@ -192,12 +192,7 @@ fn generated_operations_match_the_model() { let name = rng.pick(&NAMES); let namespace = NamespaceId::new(*name).unwrap(); let core = *rng.pick(&[CoreKind::Content, CoreKind::Array]); - let candidate = definition( - name, - core, - rng.pick(&HANDLERS), - 1 + rng.below(2), - ); + let candidate = definition(name, core, rng.pick(&HANDLERS), 1 + rng.below(2)); let context = if rng.below(4) == 0 { reader() } else { admin() }; // Mostly the true generation; sometimes a stale or a // future one (the concurrent-writer case). @@ -210,7 +205,8 @@ fn generated_operations_match_the_model() { MutationKind::Revoke => None, _ => Some(&candidate), }; - let expected_result = model.apply(&context, expected, mutation, definition_arg, &namespace); + let expected_result = + model.apply(&context, expected, mutation, definition_arg, &namespace); let actual_result = match mutation { MutationKind::Create => state.create(&auth, &context, expected, candidate.clone()), MutationKind::Update => state.update(&auth, &context, expected, candidate.clone()), @@ -220,7 +216,11 @@ fn generated_operations_match_the_model() { actual_result, expected_result, "seed {seed} step {step}: {mutation} {name}" ); - assert_eq!(state.generation(), model.generation, "seed {seed} step {step}"); + assert_eq!( + state.generation(), + model.generation, + "seed {seed} step {step}" + ); let actual_definitions: BTreeMap = state .definitions() .map(|d| (d.namespace.as_str().to_owned(), d.clone())) @@ -240,11 +240,21 @@ fn each_successful_mutation_increments_exactly_one_generation() { let auth = authorizer(); assert_eq!(state.generation(), 0); let created = state - .create(&auth, &admin(), 0, definition("main", CoreKind::Content, "files", 1)) + .create( + &auth, + &admin(), + 0, + definition("main", CoreKind::Content, "files", 1), + ) .unwrap(); assert_eq!(created, 1); let updated = state - .update(&auth, &admin(), 1, definition("main", CoreKind::Content, "files", 2)) + .update( + &auth, + &admin(), + 1, + definition("main", CoreKind::Content, "files", 2), + ) .unwrap(); assert_eq!(updated, 2); let revoked = state @@ -253,7 +263,11 @@ fn each_successful_mutation_increments_exactly_one_generation() { assert_eq!(revoked, 3); assert_eq!(state.audit_log().len(), 3); assert_eq!( - state.audit_log().iter().map(|e| e.generation).collect::>(), + state + .audit_log() + .iter() + .map(|e| e.generation) + .collect::>(), vec![1, 2, 3] ); } @@ -263,7 +277,12 @@ fn unauthorized_mutation_changes_nothing() { let mut state = server_state(); let auth = authorizer(); state - .create(&auth, &admin(), 0, definition("main", CoreKind::Content, "files", 1)) + .create( + &auth, + &admin(), + 0, + definition("main", CoreKind::Content, "files", 1), + ) .unwrap(); let before = state.clone(); let refused = state.create( @@ -296,13 +315,23 @@ fn generation_conflict_changes_nothing() { let mut state = server_state(); let auth = authorizer(); state - .create(&auth, &admin(), 0, definition("main", CoreKind::Content, "files", 1)) + .create( + &auth, + &admin(), + 0, + definition("main", CoreKind::Content, "files", 1), + ) .unwrap(); let before = state.clone(); // Two writers both read generation 1; the first lands, the // second conflicts. state - .create(&auth, &admin(), 1, definition("wiki", CoreKind::Array, "docs", 1)) + .create( + &auth, + &admin(), + 1, + definition("wiki", CoreKind::Array, "docs", 1), + ) .unwrap(); let conflict = state.create( &auth, @@ -327,7 +356,12 @@ fn update_cannot_change_core() { let mut state = server_state(); let auth = authorizer(); state - .create(&auth, &admin(), 0, definition("main", CoreKind::Content, "files", 1)) + .create( + &auth, + &admin(), + 0, + definition("main", CoreKind::Content, "files", 1), + ) .unwrap(); let moved = state.update( &auth, @@ -345,7 +379,10 @@ fn update_cannot_change_core() { ); assert_eq!(state.generation(), 1); assert_eq!( - state.resolve(&NamespaceId::new("main").unwrap()).unwrap().core, + state + .resolve(&NamespaceId::new("main").unwrap()) + .unwrap() + .core, CoreKind::Content ); } @@ -355,10 +392,20 @@ fn state_round_trips_through_canonical_bytes() { let mut state = server_state(); let auth = authorizer(); state - .create(&auth, &admin(), 0, definition("main", CoreKind::Content, "files", 1)) + .create( + &auth, + &admin(), + 0, + definition("main", CoreKind::Content, "files", 1), + ) .unwrap(); state - .create(&auth, &admin(), 1, definition("wiki", CoreKind::Array, "docs", 3)) + .create( + &auth, + &admin(), + 1, + definition("wiki", CoreKind::Array, "docs", 3), + ) .unwrap(); state .revoke(&auth, &admin(), 2, &NamespaceId::new("main").unwrap()) @@ -372,7 +419,12 @@ fn state_round_trips_through_canonical_bytes() { // And the decoded state keeps mutating from its generation. let mut decoded = decoded; let next = decoded - .create(&auth, &admin(), 3, definition("lab", CoreKind::Content, "files", 1)) + .create( + &auth, + &admin(), + 3, + definition("lab", CoreKind::Content, "files", 1), + ) .unwrap(); assert_eq!(next, 4); } @@ -407,10 +459,20 @@ fn registries_coexist_with_independent_state() { let auth = authorizer(); let mut one = server_state(); let mut two = RegistryState::new(RegistryId::handle("lab-rig").unwrap()); - one.create(&auth, &admin(), 0, definition("main", CoreKind::Content, "files", 1)) - .unwrap(); - two.create(&auth, &admin(), 0, definition("main", CoreKind::Array, "docs", 1)) - .unwrap(); + one.create( + &auth, + &admin(), + 0, + definition("main", CoreKind::Content, "files", 1), + ) + .unwrap(); + two.create( + &auth, + &admin(), + 0, + definition("main", CoreKind::Array, "docs", 1), + ) + .unwrap(); let name = NamespaceId::new("main").unwrap(); assert_eq!(one.resolve(&name).unwrap().core, CoreKind::Content); assert_eq!(two.resolve(&name).unwrap().core, CoreKind::Array); diff --git a/pkgs/id/crates/id-store/tests/related_links.rs b/pkgs/id/crates/id-store/tests/related_links.rs index 79c45c217c..0a5be92af7 100644 --- a/pkgs/id/crates/id-store/tests/related_links.rs +++ b/pkgs/id/crates/id-store/tests/related_links.rs @@ -81,9 +81,8 @@ fn snapshot( } fn location_ref() -> LocationRef { - let locator = TypedLocator::from( - R2Locator::new("acct-1", "bucket-1", "objects/thing-1").unwrap(), - ); + let locator = + TypedLocator::from(R2Locator::new("acct-1", "bucket-1", "objects/thing-1").unwrap()); // A NamespaceId has its own grammar (a letter followed by // letters, digits or hyphens) — unlike the sidecar body's // free-text namespace label above. @@ -105,10 +104,7 @@ fn sample_links() -> Vec { LinkTarget::PathRef(PathRef::new("docs/guide.md").unwrap()), ), RelatedLink::new("located-at", LinkTarget::LocationRef(location_ref())), - RelatedLink::new( - "part-of", - LinkTarget::ContentRef(content(b"target-other")), - ), + RelatedLink::new("part-of", LinkTarget::ContentRef(content(b"target-other"))), ] } @@ -188,7 +184,10 @@ fn path_ref_rejects_leading_slash_and_bad_segments() { #[test] fn path_ref_cap_is_resource_limit_not_truncation() { let at_cap = "a".repeat(MAX_PATH_REF_BYTES); - assert_eq!(PathRef::new(&at_cap).unwrap().as_str().len(), MAX_PATH_REF_BYTES); + assert_eq!( + PathRef::new(&at_cap).unwrap().as_str().len(), + MAX_PATH_REF_BYTES + ); // A multi-segment path exactly at the cap is also fine. let segmented = format!("{}/{}", "a".repeat(2048), "b".repeat(2047)); @@ -239,10 +238,7 @@ fn unknown_target_kind_is_unsupported_target_kind() { // not path-link changes (design §4, Q1). for kind in ["url", "blob"] { let value = Value::Map(vec![ - ( - Value::Text("kind".to_owned()), - Value::Text(kind.to_owned()), - ), + (Value::Text("kind".to_owned()), Value::Text(kind.to_owned())), ( Value::Text("url".to_owned()), Value::Text("https://example.com/x".to_owned()), @@ -304,7 +300,13 @@ fn canonical_order_sorts_by_relation_then_target_bytes_and_collapses_duplicates( let relations: Vec<&str> = canonical.iter().map(|l| l.relation.as_str()).collect(); assert_eq!( relations, - ["derived-from", "located-at", "part-of", "see-also", "see-also"] + [ + "derived-from", + "located-at", + "part-of", + "see-also", + "see-also" + ] ); assert!(matches!(canonical[3].target, LinkTarget::ContentRef(_))); assert!(matches!(canonical[4].target, LinkTarget::PathRef(_))); @@ -341,7 +343,10 @@ fn adding_a_link_changes_the_snapshot_but_not_the_subject() { assert_eq!(bare.body.subject_content_id, subject()); assert_eq!(linked.body.subject_content_id, subject()); assert_ne!(bare.snapshot_id().unwrap(), linked.snapshot_id().unwrap()); - assert_eq!(envelope_links(&linked).unwrap(), canonical_links(&sample_links()).unwrap()); + assert_eq!( + envelope_links(&linked).unwrap(), + canonical_links(&sample_links()).unwrap() + ); assert!(envelope_links(&bare).unwrap().is_empty()); } @@ -425,14 +430,14 @@ fn dangling_links_survive_rewrite() { fn resolution_is_per_target_and_read_only() { let links = sample_links(); let present = content(b"target-content"); - let resolutions = resolve_links(&links, |target| { - matches!(target, LinkTarget::ContentRef(id) if *id == present) - }); + let resolutions = resolve_links( + &links, + |target| matches!(target, LinkTarget::ContentRef(id) if *id == present), + ); assert_eq!(resolutions.len(), links.len()); for (link, resolution) in links.iter().zip(&resolutions) { assert_eq!(resolution.target(), &link.target); - let should_resolve = - matches!(&link.target, LinkTarget::ContentRef(id) if *id == present); + let should_resolve = matches!(&link.target, LinkTarget::ContentRef(id) if *id == present); assert_eq!(!resolution.is_dangling(), should_resolve, "link {link:?}"); } // Resolution changed nothing: the links still read back whole. diff --git a/pkgs/id/crates/id-store/tests/stream_subscribe.rs b/pkgs/id/crates/id-store/tests/stream_subscribe.rs index 4926ed8731..07ec72a5fb 100644 --- a/pkgs/id/crates/id-store/tests/stream_subscribe.rs +++ b/pkgs/id/crates/id-store/tests/stream_subscribe.rs @@ -649,11 +649,7 @@ impl Rng { } fn below(&mut self, bound: u64) -> u64 { - if bound == 0 { - 0 - } else { - self.next() % bound - } + if bound == 0 { 0 } else { self.next() % bound } } } diff --git a/pkgs/id/crates/id-sync/tests/relay_poc.rs b/pkgs/id/crates/id-sync/tests/relay_poc.rs index 2742e1df4a..1cc0c3b995 100644 --- a/pkgs/id/crates/id-sync/tests/relay_poc.rs +++ b/pkgs/id/crates/id-sync/tests/relay_poc.rs @@ -238,13 +238,7 @@ impl PocNode { async fn five_nodes(extra_bridges: &[(&'static str, u8)]) -> HashMap<&'static str, PocNode> { // Endpoints first: addresses are needed before any sink is built. let mut endpoints: HashMap<&'static str, (u8, Endpoint, EndpointAddr)> = HashMap::new(); - for (name, seed) in [ - ("a", 1u8), - ("b", 2), - ("c", 3), - ("d", 4), - ("e", 5), - ] { + for (name, seed) in [("a", 1u8), ("b", 2), ("c", 3), ("d", 4), ("e", 5)] { let ep = endpoint().await; let addr = loopback_addr(&ep); endpoints.insert(name, (seed, ep, addr)); @@ -273,12 +267,7 @@ async fn five_nodes(extra_bridges: &[(&'static str, u8)]) -> HashMap<&'static st } else if name == "e" { names.extend(bridges.iter().copied()); } - Arc::new( - names - .into_iter() - .map(|n| (id_of(n), addr_of(n))) - .collect(), - ) + Arc::new(names.into_iter().map(|n| (id_of(n), addr_of(n))).collect()) }; let mut nodes = HashMap::new(); @@ -325,7 +314,11 @@ async fn five_node_bridge_delivery_with_latency() { // is environment-dependent); the report records the medians. let nodes = five_nodes(&[]).await; let (a, b, c, d, e) = ( - &nodes["a"], &nodes["b"], &nodes["c"], &nodes["d"], &nodes["e"], + &nodes["a"], + &nodes["b"], + &nodes["c"], + &nodes["d"], + &nodes["e"], ); let mut direct = Vec::new(); let mut bridged = Vec::new(); @@ -442,12 +435,7 @@ async fn tampered_copy_is_refused_in_five_node_topology() { forged.content = ChainedContent::Inline { bytes: b"forged".to_vec(), }; - let outcome = forward_message( - &a.endpoint, - d.addr.clone(), - &RelayedMessage::new(forged), - ) - .await; + let outcome = forward_message(&a.endpoint, d.addr.clone(), &RelayedMessage::new(forged)).await; assert!( matches!(outcome, Outcome::Refused(_)), "tampered copy must be refused at D, got {outcome:?}" diff --git a/pkgs/id/crates/id-worlds/src/world/mod.rs b/pkgs/id/crates/id-worlds/src/world/mod.rs index dae62414f2..8459ce5e2c 100644 --- a/pkgs/id/crates/id-worlds/src/world/mod.rs +++ b/pkgs/id/crates/id-worlds/src/world/mod.rs @@ -88,8 +88,8 @@ pub use journal::{ JOURNAL_VERSION_REGION_HANDOFF, JOURNAL_VERSION_SCHEDULE_RECURRENCE, JOURNAL_VERSION_SIGNED_PLAY, JOURNAL_VERSION_WORLD_BUDGET, JOURNAL_VERSION_WRITE_LEASE, JournalAckMode, JournalAdminHistory, JournalEntry, JournalSignedMove, JournalSnapshot, - JournalSnapshotSource, - MAX_JOURNAL_VERSION, TrustBasis, TrustDecision, WorldJournal, journal_version_required_by, + JournalSnapshotSource, MAX_JOURNAL_VERSION, TrustBasis, TrustDecision, WorldJournal, + journal_version_required_by, }; pub use metrics::{ HistogramSnapshot, MetricsSnapshot, RegionWrites, WorldMetrics, WriteLocalitySnapshot, diff --git a/pkgs/id/crates/id-worlds/src/world/tests.rs b/pkgs/id/crates/id-worlds/src/world/tests.rs index 9e624fce73..a8ee0141a7 100644 --- a/pkgs/id/crates/id-worlds/src/world/tests.rs +++ b/pkgs/id/crates/id-worlds/src/world/tests.rs @@ -13935,7 +13935,7 @@ mod audit_tests { let records = Arc::new(Mutex::new(Vec::new())); let subscriber = tracing_subscriber::registry().with(AuditCapture(records.clone())); let _guard = tracing::subscriber::set_default(subscriber); - crate::test_tracing::rebuild_interest_cache(); + crate::test_tracing::rebuild_interest_cache(); let core = WorldCore::new( "audit-test", diff --git a/pkgs/id/crates/id-worlds/src/world_ssh.rs b/pkgs/id/crates/id-worlds/src/world_ssh.rs index 1c94b9cbc4..a24fb43692 100644 --- a/pkgs/id/crates/id-worlds/src/world_ssh.rs +++ b/pkgs/id/crates/id-worlds/src/world_ssh.rs @@ -5024,7 +5024,8 @@ mod tests { // The initial PTY resize may still be queued after the first view and // correctly forces one more full repaint. Consume that recovery frame // before checking a stable, consecutive update. - let _resize_recovery = read_until_screen_bytes(&mut channel, &mut terminal, "count=1").await; + let _resize_recovery = + read_until_screen_bytes(&mut channel, &mut terminal, "count=1").await; channel.data(&b"inc"[..]).await.unwrap(); let update = read_until_screen_bytes(&mut channel, &mut terminal, "count=2").await; assert!( diff --git a/pkgs/id/hosted-worker/README.md b/pkgs/id/hosted-worker/README.md index f2b10de084..754c6f675e 100644 --- a/pkgs/id/hosted-worker/README.md +++ b/pkgs/id/hosted-worker/README.md @@ -27,8 +27,8 @@ First local-only vertical slice of the hosted data plane (slice 3 of `GET|DELETE /v1/blobs/<64-hex>` (content-addressed blobs in R2, deduplicated across users; DELETE drops only this user's reference); and the signed-object bridge routes (`GET - /v1/bridge/challenge`, `GET /v1/bridge/heads`, `POST - /v1/bridge/push`, `POST /v1/bridge/pull`, `GET /v1/bridge/export`, +/v1/bridge/challenge`, `GET /v1/bridge/heads`, `POST +/v1/bridge/push`, `POST /v1/bridge/pull`, `GET /v1/bridge/export`, `GET /v1/bridge/ws`), covered in the bridge section below. Storage metering and the per-user ceiling (`USER_CEILING_BYTES`) are implemented, not later steps. diff --git a/pkgs/id/hosted-worker/src/admission-gate.ts b/pkgs/id/hosted-worker/src/admission-gate.ts index 42ad0afeb2..0d7367e0af 100644 --- a/pkgs/id/hosted-worker/src/admission-gate.ts +++ b/pkgs/id/hosted-worker/src/admission-gate.ts @@ -24,12 +24,7 @@ // node whose dispatch excludes the profile refuses it; the Rust // core remains the authority for blake3 admissions. -import { - CborError, - decodeCanonical, - encodeCanonical, - type CborValue, -} from "./canonical-cbor.ts"; +import { CborError, decodeCanonical, encodeCanonical, type CborValue } from "./canonical-cbor.ts"; /** The stable failure class of a rejection (mirrors the Rust `class()`). */ export type AdmissionRejectionClass = @@ -79,11 +74,7 @@ function checkContextField(field: string, text: string): void { } /** A validated admission context; throws `malformed` on a bad field. */ -export function admissionContext( - principal: string, - tenantScope: string, - authorizationScope: string, -): AdmissionContext { +export function admissionContext(principal: string, tenantScope: string, authorizationScope: string): AdmissionContext { checkContextField("principal", principal); checkContextField("tenant_scope", tenantScope); checkContextField("authorization_scope", authorizationScope); @@ -296,9 +287,7 @@ function parseEnvelope(decoded: CborValue): ParsedEnvelope { function signaturePreimage(bodyValue: CborValue, domain: string): Uint8Array { const encoded = encodeCanonical(bodyValue); const domainBytes = new TextEncoder().encode(domain); - const out = new Uint8Array( - SIGNATURE_DOMAIN_PREFIX.length + 4 + domainBytes.length + encoded.length, - ); + const out = new Uint8Array(SIGNATURE_DOMAIN_PREFIX.length + 4 + domainBytes.length + encoded.length); let pos = 0; out.set(SIGNATURE_DOMAIN_PREFIX, pos); pos += SIGNATURE_DOMAIN_PREFIX.length; @@ -316,11 +305,7 @@ export class AdmissionGate { readonly #directory: SignerDirectory; readonly #authorizer: AdmissionAuthorizer; - constructor( - policy: GatePolicy, - directory: SignerDirectory, - authorizer: AdmissionAuthorizer, - ) { + constructor(policy: GatePolicy, directory: SignerDirectory, authorizer: AdmissionAuthorizer) { this.#policy = policy; this.#directory = directory; this.#authorizer = authorizer; @@ -331,10 +316,7 @@ export class AdmissionGate { * bytes. Resolves with the receipt on acceptance; rejects with * an {@link AdmissionRejection} naming the failing stage. */ - async admitCanonical( - bytes: Uint8Array, - context: AdmissionContext, - ): Promise { + async admitCanonical(bytes: Uint8Array, context: AdmissionContext): Promise { // Stage 1 — semantic validation: canonical decode, strict // field sets, label bounds, canonical round trip. let decoded: CborValue; @@ -402,10 +384,7 @@ export class AdmissionGate { // Stage 5 — policy: admitted domain and payload budget. const admitted = this.#policy.admittedDomains; if (admitted !== undefined && admitted.size > 0 && !admitted.has(parsed.domain)) { - throw new AdmissionRejection( - "policy", - `domain ${JSON.stringify(parsed.domain)} is not admitted by policy`, - ); + throw new AdmissionRejection("policy", `domain ${JSON.stringify(parsed.domain)} is not admitted by policy`); } const maxPayload = this.#policy.maxPayloadBytes ?? DEFAULT_MAX_PAYLOAD_BYTES; if (parsed.payloadLength > BigInt(maxPayload)) { @@ -415,9 +394,7 @@ export class AdmissionGate { ); } - const envelopeDigest = new Uint8Array( - await crypto.subtle.digest("SHA-256", bytes as BufferSource), - ); + const envelopeDigest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes as BufferSource)); return { signerId: parsed.signerId, tenantScope: parsed.context, @@ -434,14 +411,9 @@ export class AdmissionGate { try { new TextDecoder("utf-8", { fatal: true }).decode(parsed.payload); } catch { - throw new AdmissionRejection( - "payload", - "atlas-chunk-sha256-utf8 is defined over UTF-8 text", - ); + throw new AdmissionRejection("payload", "atlas-chunk-sha256-utf8 is defined over UTF-8 text"); } - const digest = new Uint8Array( - await crypto.subtle.digest("SHA-256", parsed.payload as BufferSource), - ); + const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", parsed.payload as BufferSource)); if (!bytesEqual(digest, parsed.payloadDigest)) { throw new AdmissionRejection("payload", "payload digest does not match the payload ID"); } @@ -449,22 +421,13 @@ export class AdmissionGate { } // raw-blake3-256 has no compiled verifier in this build; an // unknown profile is unsupported on any build. - throw new AdmissionRejection( - "unsupported", - `unsupported content profile ${JSON.stringify(parsed.payloadProfile)}`, - ); + throw new AdmissionRejection("unsupported", `unsupported content profile ${JSON.stringify(parsed.payloadProfile)}`); } async #verifySignature(parsed: ParsedEnvelope): Promise { let key: CryptoKey; try { - key = await crypto.subtle.importKey( - "raw", - parsed.key as BufferSource, - "Ed25519", - false, - ["verify"], - ); + key = await crypto.subtle.importKey("raw", parsed.key as BufferSource, "Ed25519", false, ["verify"]); } catch { throw new AdmissionRejection( "signer_binding", diff --git a/pkgs/id/hosted-worker/src/blake3.ts b/pkgs/id/hosted-worker/src/blake3.ts index 2eb8cf0f52..1a555f9f04 100644 --- a/pkgs/id/hosted-worker/src/blake3.ts +++ b/pkgs/id/hosted-worker/src/blake3.ts @@ -29,15 +29,7 @@ function rotr(x: number, n: number): number { return ((x >>> n) | (x << (32 - n))) >>> 0; } -function g( - state: Uint32Array, - a: number, - b: number, - c: number, - d: number, - mx: number, - my: number, -): void { +function g(state: Uint32Array, a: number, b: number, c: number, d: number, mx: number, my: number): void { state[a] = (state[a] + state[b] + mx) >>> 0; state[d] = rotr(state[d] ^ state[a], 16); state[c] = (state[c] + state[d]) >>> 0; @@ -99,8 +91,7 @@ function wordsFromBlock(block: Uint8Array, offset: number): Uint32Array { const words = new Uint32Array(16); for (let i = 0; i < 16; i++) { const j = offset + i * 4; - words[i] = - (block[j] | (block[j + 1] << 8) | (block[j + 2] << 16) | (block[j + 3] << 24)) >>> 0; + words[i] = (block[j] | (block[j + 1] << 8) | (block[j + 2] << 16) | (block[j + 3] << 24)) >>> 0; } return words; } @@ -124,13 +115,10 @@ interface Output { } function outputChainingValue(output: Output): Uint32Array { - return compress( - output.cv, - wordsFromBlock(output.block, 0), - output.counter, - output.blockLen, - output.flags, - ).slice(0, 8); + return compress(output.cv, wordsFromBlock(output.block, 0), output.counter, output.blockLen, output.flags).slice( + 0, + 8, + ); } function outputRootBytes(output: Output, length: number): Uint8Array { @@ -138,13 +126,7 @@ function outputRootBytes(output: Output, length: number): Uint8Array { let written = 0; let counter = 0n; while (written < length) { - const words = compress( - output.cv, - wordsFromBlock(output.block, 0), - counter, - output.blockLen, - output.flags | ROOT, - ); + const words = compress(output.cv, wordsFromBlock(output.block, 0), counter, output.blockLen, output.flags | ROOT); const block = new Uint8Array(64); wordsToBytes(words, block, 0, 16); const take = Math.min(64, length - written); diff --git a/pkgs/id/hosted-worker/src/bridge-auth.ts b/pkgs/id/hosted-worker/src/bridge-auth.ts index 9d968c99ba..0285038eac 100644 --- a/pkgs/id/hosted-worker/src/bridge-auth.ts +++ b/pkgs/id/hosted-worker/src/bridge-auth.ts @@ -35,9 +35,7 @@ export function authTranscript( context: AuthContext, bodyHashHex: string, ): Uint8Array { - return new TextEncoder().encode( - `id.bridge-auth.v1\n${bindingId}\n${nonceHex}\n${context}\n${bodyHashHex}`, - ); + return new TextEncoder().encode(`id.bridge-auth.v1\n${bindingId}\n${nonceHex}\n${context}\n${bodyHashHex}`); } export function bodyHashHex(body: Uint8Array): string { @@ -103,19 +101,11 @@ export async function verifyProof( * exchange re-derives the truth either way. */ export function issueResumeToken(store: BridgeStore, bindingId: string, nowMs: number): string { const token = randomHex(32); - store.metaSet( - `bridge:resume:${token}`, - JSON.stringify({ bindingId, expiresAt: nowMs + RESUME_TOKEN_TTL_MS }), - ); + store.metaSet(`bridge:resume:${token}`, JSON.stringify({ bindingId, expiresAt: nowMs + RESUME_TOKEN_TTL_MS })); return token; } -export function checkResumeToken( - store: BridgeStore, - token: string, - bindingId: string, - nowMs: number, -): boolean { +export function checkResumeToken(store: BridgeStore, token: string, bindingId: string, nowMs: number): boolean { const raw = store.metaGet(`bridge:resume:${token}`); if (!raw) return false; try { diff --git a/pkgs/id/hosted-worker/src/bridge-session.ts b/pkgs/id/hosted-worker/src/bridge-session.ts index 5e6adc206b..d6f3268500 100644 --- a/pkgs/id/hosted-worker/src/bridge-session.ts +++ b/pkgs/id/hosted-worker/src/bridge-session.ts @@ -426,10 +426,7 @@ export class BridgeSessionServer { batchBytes = 0; }; for (const event of events) { - if ( - batch.length >= this.limits.maxBatchEvents || - batchBytes + event.length > this.limits.maxBatchBytes - ) { + if (batch.length >= this.limits.maxBatchEvents || batchBytes + event.length > this.limits.maxBatchBytes) { flush(); } batch.push(event); @@ -531,7 +528,10 @@ export class BridgeClient { } private async next(): Promise { - const data = this.inbox.length > 0 ? (this.inbox.shift() as Uint8Array | null) : await new Promise((resolve) => this.waiters.push(resolve)); + const data = + this.inbox.length > 0 + ? (this.inbox.shift() as Uint8Array | null) + : await new Promise((resolve) => this.waiters.push(resolve)); if (data === null) throw new Error("the transport closed mid-session"); return data; } @@ -553,16 +553,9 @@ export class BridgeClient { // AUTH: answer the server's challenge with the ID-key proof. const challenge = await this.nextTag(TAG.challenge); const nonce = new TextDecoder().decode(challenge); - const transcriptBytes = authTranscript( - this.opts.bindingId, - nonce, - "ws", - bodyHashHex(new Uint8Array(0)), - ); + const transcriptBytes = authTranscript(this.opts.bindingId, nonce, "ws", bodyHashHex(new Uint8Array(0))); const signature = await this.opts.key.sign(transcriptBytes); - this.transport.send( - jsonFrame(TAG.auth, { nonce, signature: bytesToHex(signature) }), - ); + this.transport.send(jsonFrame(TAG.auth, { nonce, signature: bytesToHex(signature) })); // HELLO or RESUME. let serverHeads: Head[]; @@ -653,7 +646,8 @@ export class BridgeClient { batchBytes = 0; }; for (const eventBytes of answer) { - if (batch.length >= this.limits.maxBatchEvents || batchBytes + eventBytes.length > this.limits.maxBatchBytes) flush(); + if (batch.length >= this.limits.maxBatchEvents || batchBytes + eventBytes.length > this.limits.maxBatchBytes) + flush(); batch.push(eventBytes); batchBytes += eventBytes.length; } diff --git a/pkgs/id/hosted-worker/src/bridge-store.ts b/pkgs/id/hosted-worker/src/bridge-store.ts index ae6e2568b8..55a30a84c9 100644 --- a/pkgs/id/hosted-worker/src/bridge-store.ts +++ b/pkgs/id/hosted-worker/src/bridge-store.ts @@ -143,10 +143,7 @@ export class BridgeStore { // ----- reads ----------------------------------------------------- chainOf(author: string): ChainState { - const rows = this.sql.exec( - "SELECT next_seq, head, frozen FROM bridge_chains WHERE author = ?", - author, - ).toArray(); + const rows = this.sql.exec("SELECT next_seq, head, frozen FROM bridge_chains WHERE author = ?", author).toArray(); if (rows.length === 0) return { next_seq: 0, head: null, frozen: false }; return { next_seq: Number(rows[0].next_seq), @@ -166,29 +163,25 @@ export class BridgeStore { } knownAuthors(): string[] { - const rows = this.sql.exec( - `SELECT author FROM bridge_chains + const rows = this.sql + .exec( + `SELECT author FROM bridge_chains UNION SELECT author FROM bridge_events UNION SELECT author FROM bridge_waiting UNION SELECT author FROM bridge_proof_ids ORDER BY author`, - ).toArray(); + ) + .toArray(); return rows.map((r) => r.author as string); } isStored(id: string): boolean { - return ( - this.sql.exec("SELECT 1 AS x FROM bridge_events WHERE id = ?", id).toArray().length > 0 - ); + return this.sql.exec("SELECT 1 AS x FROM bridge_events WHERE id = ?", id).toArray().length > 0; } isProofHeader(author: string, id: string): boolean { return ( - this.sql.exec( - "SELECT 1 AS x FROM bridge_proof_ids WHERE author = ? AND id = ?", - author, - id, - ).toArray().length > 0 + this.sql.exec("SELECT 1 AS x FROM bridge_proof_ids WHERE author = ? AND id = ?", author, id).toArray().length > 0 ); } @@ -196,17 +189,13 @@ export class BridgeStore { * event is not present. */ isPresent(id: string): boolean { if (this.isStored(id)) return true; - return ( - this.sql.exec("SELECT 1 AS x FROM bridge_proof_ids WHERE id = ?", id).toArray().length > 0 - ); + return this.sql.exec("SELECT 1 AS x FROM bridge_proof_ids WHERE id = ?", id).toArray().length > 0; } storedAt(author: string, seq: number): { id: string; bytes: Uint8Array } | null { - const rows = this.sql.exec( - "SELECT id, bytes FROM bridge_events WHERE author = ? AND seq = ?", - author, - seq, - ).toArray(); + const rows = this.sql + .exec("SELECT id, bytes FROM bridge_events WHERE author = ? AND seq = ?", author, seq) + .toArray(); if (rows.length === 0) return null; return { id: rows[0].id as string, bytes: blobBytes(rows[0].bytes) }; } @@ -236,10 +225,7 @@ export class BridgeStore { } heldEvent(id: string): HeldEvent | null { - let rows = this.sql.exec( - "SELECT author, seq, bytes FROM bridge_events WHERE id = ?", - id, - ).toArray(); + let rows = this.sql.exec("SELECT author, seq, bytes FROM bridge_events WHERE id = ?", id).toArray(); if (rows.length > 0) { return { author: rows[0].author as string, seq: Number(rows[0].seq), id, bytes: blobBytes(rows[0].bytes) }; } @@ -248,10 +234,7 @@ export class BridgeStore { const parsed = parseEvent(blobBytes(rows[0].bytes)); return { author: parsed.authorHex, seq: parsed.seq, id, bytes: parsed.bytes }; } - rows = this.sql.exec( - "SELECT author, seq, bytes FROM bridge_waiting WHERE id = ?", - id, - ).toArray(); + rows = this.sql.exec("SELECT author, seq, bytes FROM bridge_waiting WHERE id = ?", id).toArray(); if (rows.length > 0) { return { author: rows[0].author as string, seq: Number(rows[0].seq), id, bytes: blobBytes(rows[0].bytes) }; } @@ -283,12 +266,14 @@ export class BridgeStore { /** Bytes stored by this store, for the storage ceiling. */ storedBytes(): number { - const rows = this.sql.exec( - `SELECT + const rows = this.sql + .exec( + `SELECT (SELECT COALESCE(SUM(LENGTH(bytes)), 0) FROM bridge_events) AS events, (SELECT COALESCE(SUM(LENGTH(bytes)), 0) FROM bridge_waiting) AS waiting, (SELECT COALESCE(SUM(LENGTH(bytes)), 0) FROM bridge_proof_headers) AS proofs`, - ).toArray(); + ) + .toArray(); return Number(rows[0].events) + Number(rows[0].waiting) + Number(rows[0].proofs); } @@ -313,10 +298,14 @@ export class BridgeStore { } applied[author] = ids; } - const waiting = this.sql.exec("SELECT id FROM bridge_waiting ORDER BY id").toArray().map((r) => r.id as string); - const proofs = this.sql.exec( - "SELECT author, seq, first_id, second_id FROM bridge_forks ORDER BY author, seq", - ).toArray().map((r) => `${r.author}:${Number(r.seq)}:${r.first_id}:${r.second_id}`); + const waiting = this.sql + .exec("SELECT id FROM bridge_waiting ORDER BY id") + .toArray() + .map((r) => r.id as string); + const proofs = this.sql + .exec("SELECT author, seq, first_id, second_id FROM bridge_forks ORDER BY author, seq") + .toArray() + .map((r) => `${r.author}:${Number(r.seq)}:${r.first_id}:${r.second_id}`); return { chains, applied, waiting, proofs }; } @@ -361,12 +350,7 @@ export class BridgeStore { } case "wait": case "park": { - const held = this.hold( - event, - decision.t === "wait" ? decision.deps : [], - decision.t === "park", - nowMs, - ); + const held = this.hold(event, decision.t === "wait" ? decision.deps : [], decision.t === "park", nowMs); if (held === "full") { return { kind: "refused", @@ -443,9 +427,7 @@ export class BridgeStore { storedPrev.author === event.authorHex && storedPrev.header !== null && bytesToHex(storedPrev.header) === bytesToHex(event.checkpoint.headerEncoding); - const previousSegment = - storedPrev.seq !== null && - BigInt(storedPrev.seq) + 1n === event.checkpoint.segmentSeq; + const previousSegment = storedPrev.seq !== null && BigInt(storedPrev.seq) + 1n === event.checkpoint.segmentSeq; if (!sameSession || !previousSegment) { return { t: "refuse", @@ -482,10 +464,12 @@ export class BridgeStore { * Applied ids are collected in application order. */ private drain(nowMs: number, released: string[]): void { for (;;) { - const rows = this.sql.exec( - `SELECT * FROM bridge_waiting WHERE parked = 0 AND deps = '[]' + const rows = this.sql + .exec( + `SELECT * FROM bridge_waiting WHERE parked = 0 AND deps = '[]' ORDER BY arrival ASC LIMIT 1`, - ).toArray(); + ) + .toArray(); if (rows.length === 0) return; const row = this.waitingRow(rows[0]); this.deleteWaiting(row.id); @@ -552,11 +536,7 @@ export class BridgeStore { second.id, ); for (const proofEvent of [first, second]) { - this.sql.exec( - "INSERT OR IGNORE INTO bridge_proof_ids (id, author) VALUES (?, ?)", - proofEvent.id, - author, - ); + this.sql.exec("INSERT OR IGNORE INTO bridge_proof_ids (id, author) VALUES (?, ?)", proofEvent.id, author); this.sql.exec( "INSERT OR IGNORE INTO bridge_proof_headers (id, bytes) VALUES (?, ?)", proofEvent.id, @@ -566,21 +546,12 @@ export class BridgeStore { } } - private hold( - event: SignedEvent, - deps: string[], - parked: boolean, - nowMs: number, - ): "held" | "already" | "full" { - const existing = this.sql.exec( - "SELECT 1 AS x FROM bridge_waiting WHERE id = ?", - event.id, - ).toArray(); + private hold(event: SignedEvent, deps: string[], parked: boolean, nowMs: number): "held" | "already" | "full" { + const existing = this.sql.exec("SELECT 1 AS x FROM bridge_waiting WHERE id = ?", event.id).toArray(); if (existing.length > 0) return "already"; - const byAuthor = this.sql.exec( - "SELECT COUNT(*) AS n FROM bridge_waiting WHERE author = ?", - event.authorHex, - ).toArray(); + const byAuthor = this.sql + .exec("SELECT COUNT(*) AS n FROM bridge_waiting WHERE author = ?", event.authorHex) + .toArray(); if (Number(byAuthor[0].n) >= this.limits.perAuthor) return "full"; const total = this.sql.exec("SELECT COUNT(*) AS n FROM bridge_waiting").toArray(); if (Number(total[0].n) >= this.limits.total) return "full"; @@ -618,11 +589,7 @@ export class BridgeStore { ); this.sql.exec("DELETE FROM bridge_waiting_by_dep WHERE id = ?", row.id); for (const dep of deps) { - this.sql.exec( - "INSERT OR IGNORE INTO bridge_waiting_by_dep (dep, id) VALUES (?, ?)", - dep, - row.id, - ); + this.sql.exec("INSERT OR IGNORE INTO bridge_waiting_by_dep (dep, id) VALUES (?, ?)", dep, row.id); } } @@ -633,23 +600,13 @@ export class BridgeStore { /** An id became present: it stops being a dependency anywhere. */ private markPresent(id: string): void { - const waiting = this.sql.exec( - "SELECT id FROM bridge_waiting_by_dep WHERE dep = ?", - id, - ).toArray(); + const waiting = this.sql.exec("SELECT id FROM bridge_waiting_by_dep WHERE dep = ?", id).toArray(); this.sql.exec("DELETE FROM bridge_waiting_by_dep WHERE dep = ?", id); for (const w of waiting) { - const rows = this.sql.exec( - "SELECT deps FROM bridge_waiting WHERE id = ?", - w.id as string, - ).toArray(); + const rows = this.sql.exec("SELECT deps FROM bridge_waiting WHERE id = ?", w.id as string).toArray(); if (rows.length === 0) continue; const deps = (JSON.parse(rows[0].deps as string) as string[]).filter((d) => d !== id); - this.sql.exec( - "UPDATE bridge_waiting SET deps = ? WHERE id = ?", - JSON.stringify(deps), - w.id as string, - ); + this.sql.exec("UPDATE bridge_waiting SET deps = ? WHERE id = ?", JSON.stringify(deps), w.id as string); } } @@ -677,24 +634,22 @@ export class BridgeStore { } private expire(nowMs: number): void { - const rows = this.sql.exec( - "SELECT id FROM bridge_waiting WHERE arrived_at + ? <= ?", - this.limits.maxAgeMs, - nowMs, - ).toArray(); + const rows = this.sql + .exec("SELECT id FROM bridge_waiting WHERE arrived_at + ? <= ?", this.limits.maxAgeMs, nowMs) + .toArray(); for (const r of rows) this.deleteWaiting(r.id as string); } // ----- helpers --------------------------------------------------- - private lowestProof( - author: string, - ): { seq: number; first_id: string; second_id: string } | null { - const rows = this.sql.exec( - `SELECT seq, first_id, second_id FROM bridge_forks + private lowestProof(author: string): { seq: number; first_id: string; second_id: string } | null { + const rows = this.sql + .exec( + `SELECT seq, first_id, second_id FROM bridge_forks WHERE author = ? ORDER BY seq ASC LIMIT 1`, - author, - ).toArray(); + author, + ) + .toArray(); if (rows.length === 0) return null; return { seq: Number(rows[0].seq), @@ -704,22 +659,16 @@ export class BridgeStore { } private heldRivals(author: string, seq: number, excludeId: string): WaitingRow[] { - const rows = this.sql.exec( - "SELECT * FROM bridge_waiting WHERE author = ? AND seq = ? AND id != ?", - author, - seq, - excludeId, - ).toArray(); + const rows = this.sql + .exec("SELECT * FROM bridge_waiting WHERE author = ? AND seq = ? AND id != ?", author, seq, excludeId) + .toArray(); return rows.map((r) => this.waitingRow(r)); } - private storedCheckpoint( - id: string, - ): { author: string; header: Uint8Array | null; seq: string | null } | null { - const rows = this.sql.exec( - "SELECT author, checkpoint_header, checkpoint_seq FROM bridge_events WHERE id = ?", - id, - ).toArray(); + private storedCheckpoint(id: string): { author: string; header: Uint8Array | null; seq: string | null } | null { + const rows = this.sql + .exec("SELECT author, checkpoint_header, checkpoint_seq FROM bridge_events WHERE id = ?", id) + .toArray(); if (rows.length === 0) return null; return { author: rows[0].author as string, @@ -750,14 +699,9 @@ export class BridgeStore { } private nextArrival(): number { - const rows = this.sql.exec( - "SELECT value FROM bridge_meta WHERE key = 'arrival'", - ).toArray(); + const rows = this.sql.exec("SELECT value FROM bridge_meta WHERE key = 'arrival'").toArray(); const next = (rows.length > 0 ? Number(rows[0].value) : 0) + 1; - this.sql.exec( - "INSERT OR REPLACE INTO bridge_meta (key, value) VALUES ('arrival', ?)", - String(next), - ); + this.sql.exec("INSERT OR REPLACE INTO bridge_meta (key, value) VALUES ('arrival', ?)", String(next)); return next; } @@ -768,11 +712,7 @@ export class BridgeStore { } metaSet(key: string, value: string): void { - this.sql.exec( - "INSERT OR REPLACE INTO bridge_meta (key, value) VALUES (?, ?)", - key, - value, - ); + this.sql.exec("INSERT OR REPLACE INTO bridge_meta (key, value) VALUES (?, ?)", key, value); } metaDelete(key: string): void { diff --git a/pkgs/id/hosted-worker/src/ed25519.ts b/pkgs/id/hosted-worker/src/ed25519.ts index 9fcb742eae..af52b2f0a7 100644 --- a/pkgs/id/hosted-worker/src/ed25519.ts +++ b/pkgs/id/hosted-worker/src/ed25519.ts @@ -32,9 +32,7 @@ function importVerifyKey(publicRaw: Uint8Array): Promise { const cacheKey = bytesToHex(publicRaw); let cached = keyCache.get(cacheKey); if (!cached) { - cached = crypto.subtle.importKey("raw", publicRaw as BufferSource, "Ed25519", false, [ - "verify", - ]); + cached = crypto.subtle.importKey("raw", publicRaw as BufferSource, "Ed25519", false, ["verify"]); keyCache.set(cacheKey, cached); } return cached; @@ -76,9 +74,7 @@ export async function importIdKey(seed: Uint8Array): Promise { const pkcs8 = new Uint8Array(PKCS8_SEED_PREFIX.length + 32); pkcs8.set(PKCS8_SEED_PREFIX); pkcs8.set(seed, PKCS8_SEED_PREFIX.length); - const privateKey = await crypto.subtle.importKey("pkcs8", pkcs8 as BufferSource, "Ed25519", true, [ - "sign", - ]); + const privateKey = await crypto.subtle.importKey("pkcs8", pkcs8 as BufferSource, "Ed25519", true, ["sign"]); const jwk = await crypto.subtle.exportKey("jwk", privateKey); if (!jwk.x) throw new Error("exported key has no public component"); const publicRaw = b64urlToBytes(jwk.x); diff --git a/pkgs/id/hosted-worker/src/event.ts b/pkgs/id/hosted-worker/src/event.ts index 9867db84d1..4a500e4656 100644 --- a/pkgs/id/hosted-worker/src/event.ts +++ b/pkgs/id/hosted-worker/src/event.ts @@ -40,11 +40,7 @@ // treats the signed header as the event. This boundary is recorded // in doc/2026-11-23T05-00-00Z_design_bridge_v1_implementation. -import { - decodeCanonical, - encodeCanonical, - type CborValue, -} from "./canonical-cbor.ts"; +import { decodeCanonical, encodeCanonical, type CborValue } from "./canonical-cbor.ts"; import { blake3 } from "./blake3.ts"; import { bytesToHex, verifyEd25519, type IdKey } from "./ed25519.ts"; diff --git a/pkgs/id/hosted-worker/src/provisioning-surface.ts b/pkgs/id/hosted-worker/src/provisioning-surface.ts index 3f1d48a1f0..ef9b1fde78 100644 --- a/pkgs/id/hosted-worker/src/provisioning-surface.ts +++ b/pkgs/id/hosted-worker/src/provisioning-surface.ts @@ -125,10 +125,7 @@ async function tryGet( * Returns the gate's BucketEvidence: `actualJurisdiction` is what * the API reports ("default" for a bucket outside every supported * jurisdiction), or null when no read could verify the bucket. */ -export async function readBucketEvidence( - client: CloudflareApiClient, - bucketName: string, -): Promise { +export async function readBucketEvidence(client: CloudflareApiClient, bucketName: string): Promise { // A jurisdiction-less read sees default-jurisdiction buckets only. const plain = await tryGet(client, bucketName); if (plain?.status === 200) { diff --git a/pkgs/id/hosted-worker/src/provisioning.ts b/pkgs/id/hosted-worker/src/provisioning.ts index 0cb10e892b..05da599b19 100644 --- a/pkgs/id/hosted-worker/src/provisioning.ts +++ b/pkgs/id/hosted-worker/src/provisioning.ts @@ -101,10 +101,7 @@ export function validateEnablement(config: EnablementConfig, evidence: AccountEv ); } if (!(SUPPORTED_JURISDICTIONS as readonly string[]).includes(rawJurisdiction)) { - refuse( - "unsupported_jurisdiction", - `configured jurisdiction "${rawJurisdiction}" is not supported; failing closed`, - ); + refuse("unsupported_jurisdiction", `configured jurisdiction "${rawJurisdiction}" is not supported; failing closed`); } const jurisdiction = rawJurisdiction as Jurisdiction; @@ -164,10 +161,7 @@ export function validateEnablement(config: EnablementConfig, evidence: AccountEv // binding's declared field — must match the configured one. const bucket = config.bucket; if (!bucket) { - refuse( - "bucket_missing", - `no R2 bucket is configured for jurisdiction "${jurisdiction}"; failing closed`, - ); + refuse("bucket_missing", `no R2 bucket is configured for jurisdiction "${jurisdiction}"; failing closed`); } if (bucket.declaredJurisdiction !== undefined && bucket.declaredJurisdiction !== jurisdiction) { refuse( diff --git a/pkgs/id/hosted-worker/src/range.ts b/pkgs/id/hosted-worker/src/range.ts index 83bce56925..eec73870df 100644 --- a/pkgs/id/hosted-worker/src/range.ts +++ b/pkgs/id/hosted-worker/src/range.ts @@ -43,9 +43,12 @@ export const DEFAULT_RANGE_PARAMS: RangeParams = { export function checkParams(params: RangeParams): RangeParams { if (params.k < 2) throw new Error(`K must be at least 2, or a split makes no progress (got ${params.k})`); - if (params.t < 1) throw new Error(`T must be at least 1, or one mismatched key never ends the sync (got ${params.t})`); + if (params.t < 1) + throw new Error(`T must be at least 1, or one mismatched key never ends the sync (got ${params.t})`); if (params.frameBudget < MIN_FRAME_BUDGET || params.frameBudget > FRAME_CAP) { - throw new Error(`the frame budget must be from ${MIN_FRAME_BUDGET} bytes to the ${FRAME_CAP}-byte frame cap (got ${params.frameBudget})`); + throw new Error( + `the frame budget must be from ${MIN_FRAME_BUDGET} bytes to the ${FRAME_CAP}-byte frame cap (got ${params.frameBudget})`, + ); } if (params.sessionBudget < MIN_FRAME_BUDGET) { throw new Error(`the session budget must be at least ${MIN_FRAME_BUDGET} bytes (got ${params.sessionBudget})`); @@ -224,8 +227,7 @@ export class RangeParty { case "fp": { const mine = this.fp(lo, hi); const equal = - mine.count === entry.mode.count && - mine.fp.every((v, i) => v === (entry.mode as { fp: Uint8Array }).fp[i]); + mine.count === entry.mode.count && mine.fp.every((v, i) => v === (entry.mode as { fp: Uint8Array }).fp[i]); if (equal) { pushSkip(entry.upper); } else if (mine.count <= params.t) { @@ -489,9 +491,7 @@ export function simulateExchange( else bytesB += bytes; const incoming = decodeFlight(wire); if (allSkip(incoming)) break; - msg = aSends - ? b.respond(incoming, receiverParams, learnedB) - : a.respond(incoming, receiverParams, learnedA); + msg = aSends ? b.respond(incoming, receiverParams, learnedB) : a.respond(incoming, receiverParams, learnedA); aSends = !aSends; } return { flights, bytesA, bytesB, learnedA, learnedB, maxFrame }; diff --git a/pkgs/id/hosted-worker/src/test-harness.ts b/pkgs/id/hosted-worker/src/test-harness.ts index 1f6f3d69f1..b0edfb535b 100644 --- a/pkgs/id/hosted-worker/src/test-harness.ts +++ b/pkgs/id/hosted-worker/src/test-harness.ts @@ -34,8 +34,7 @@ export default { let jurisdiction = url.searchParams.get("jurisdiction") ?? ""; let routed = url.searchParams.get("routed"); let pathname = url.pathname; - const prefix = - pathname.match(/^\/__harness\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)(\/.*)?$/); + const prefix = pathname.match(/^\/__harness\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)(\/.*)?$/); if (prefix) { name = prefix[1]; binding = prefix[2]; @@ -51,10 +50,7 @@ export default { // request's own upgrade state — so the DO would see a plain // GET and answer 400 websocket_required. if ((req.headers.get("upgrade") ?? "").toLowerCase() === "websocket") { - const forwarded = new Request( - "https://do" + pathname, - req as unknown as RequestInit, - ); + const forwarded = new Request("https://do" + pathname, req as unknown as RequestInit); forwarded.headers.set(HDR_BINDING, binding); forwarded.headers.set(HDR_JURISDICTION, jurisdiction); if (iroh !== null) forwarded.headers.set(HDR_IROH, iroh); diff --git a/pkgs/id/hosted-worker/src/user-do.ts b/pkgs/id/hosted-worker/src/user-do.ts index eb13c047be..38e4c3ef96 100644 --- a/pkgs/id/hosted-worker/src/user-do.ts +++ b/pkgs/id/hosted-worker/src/user-do.ts @@ -31,12 +31,7 @@ import { type R2BucketLike, } from "./routing.ts"; import { issueNonce, verifyProof, type AuthContext } from "./bridge-auth.ts"; -import { - BRIDGE_SCHEMA, - BridgeStore, - DEFAULT_WAITING_LIMITS, - type WaitingLimits, -} from "./bridge-store.ts"; +import { BRIDGE_SCHEMA, BridgeStore, DEFAULT_WAITING_LIMITS, type WaitingLimits } from "./bridge-store.ts"; import { BridgeSessionServer, decodeBatch, @@ -280,7 +275,11 @@ export class UserDO { return n; }; return { - perAuthor: parse(this.env.BRIDGE_WAITING_PER_AUTHOR, DEFAULT_WAITING_LIMITS.perAuthor, "BRIDGE_WAITING_PER_AUTHOR"), + perAuthor: parse( + this.env.BRIDGE_WAITING_PER_AUTHOR, + DEFAULT_WAITING_LIMITS.perAuthor, + "BRIDGE_WAITING_PER_AUTHOR", + ), total: parse(this.env.BRIDGE_WAITING_TOTAL, DEFAULT_WAITING_LIMITS.total, "BRIDGE_WAITING_TOTAL"), maxAgeMs: parse(this.env.BRIDGE_WAITING_MAX_AGE_MS, DEFAULT_WAITING_LIMITS.maxAgeMs, "BRIDGE_WAITING_MAX_AGE_MS"), }; @@ -438,7 +437,11 @@ export class UserDO { const irohHex = this.requireIroh(req); const body = await readBytesUpTo(req, DEFAULT_BRIDGE_LIMITS.maxBatchBytes); if (body === null) { - throw new FailClosed(413, "batch_too_large", `push body is larger than the ${DEFAULT_BRIDGE_LIMITS.maxBatchBytes}-byte batch bound`); + throw new FailClosed( + 413, + "batch_too_large", + `push body is larger than the ${DEFAULT_BRIDGE_LIMITS.maxBatchBytes}-byte batch bound`, + ); } const store = await this.bridgeProof(req, bindingId, irohHex, "push", body); const rawEvents = decodeBatch(body, DEFAULT_BRIDGE_LIMITS); @@ -459,13 +462,7 @@ export class UserDO { const irohHex = this.requireIroh(req); const text = await readTextUpTo(req, 64 * 1024); if (text === null) throw bodyTooLarge(64 * 1024); - const store = await this.bridgeProof( - req, - bindingId, - irohHex, - "pull", - new TextEncoder().encode(text), - ); + const store = await this.bridgeProof(req, bindingId, irohHex, "pull", new TextEncoder().encode(text)); let positions = new Map(); let maxEvents = DEFAULT_BRIDGE_LIMITS.maxBatchEvents; try { diff --git a/pkgs/id/hosted-worker/test/admission-gate.test.ts b/pkgs/id/hosted-worker/test/admission-gate.test.ts index 639a3cddf3..24432526f5 100644 --- a/pkgs/id/hosted-worker/test/admission-gate.test.ts +++ b/pkgs/id/hosted-worker/test/admission-gate.test.ts @@ -46,10 +46,7 @@ interface Actor { } async function makeActor(signerId: string): Promise { - const pair = (await crypto.subtle.generateKey("Ed25519", true, [ - "sign", - "verify", - ])) as CryptoKeyPair; + const pair = (await crypto.subtle.generateKey("Ed25519", true, ["sign", "verify"])) as CryptoKeyPair; const publicRaw = new Uint8Array(await crypto.subtle.exportKey("raw", pair.publicKey)); return { signerId, pair, publicRaw }; } @@ -176,10 +173,7 @@ test("tampered payload is refused at the payload stage", async () => { payload: encoder.encode("forged payload"), digestOverride: await sha256(payload), }); - assert.equal( - await rejectionClass(gate().admitCanonical(envelope, context("alice", "tenant-a"))), - "payload", - ); + assert.equal(await rejectionClass(gate().admitCanonical(envelope, context("alice", "tenant-a"))), "payload"); }); test("forged and unsigned envelopes are refused as bad signatures", async () => { @@ -190,10 +184,7 @@ test("forged and unsigned envelopes are refused as bad signatures", async () => payload, signWith: bob.pair.privateKey, }); - assert.equal( - await rejectionClass(gate().admitCanonical(forged, context("alice", "tenant-a"))), - "bad_signature", - ); + assert.equal(await rejectionClass(gate().admitCanonical(forged, context("alice", "tenant-a"))), "bad_signature"); // Invariant 1: no unsigned-local exception. const unsigned = await buildEnvelope({ @@ -203,10 +194,7 @@ test("forged and unsigned envelopes are refused as bad signatures", async () => payload, signatureOverride: new Uint8Array(64), }); - assert.equal( - await rejectionClass(gate().admitCanonical(unsigned, context("alice", "tenant-a"))), - "bad_signature", - ); + assert.equal(await rejectionClass(gate().admitCanonical(unsigned, context("alice", "tenant-a"))), "bad_signature"); }); test("unknown signer and wrong principal fail signer binding", async () => { @@ -216,10 +204,7 @@ test("unknown signer and wrong principal fail signer binding", async () => { domain: DOMAIN, payload, }); - assert.equal( - await rejectionClass(gate().admitCanonical(unknown, context("mallory", "tenant-a"))), - "signer_binding", - ); + assert.equal(await rejectionClass(gate().admitCanonical(unknown, context("mallory", "tenant-a"))), "signer_binding"); const alices = await buildEnvelope({ actor: alice, @@ -227,10 +212,7 @@ test("unknown signer and wrong principal fail signer binding", async () => { domain: DOMAIN, payload, }); - assert.equal( - await rejectionClass(gate().admitCanonical(alices, context("bob", "tenant-a"))), - "signer_binding", - ); + assert.equal(await rejectionClass(gate().admitCanonical(alices, context("bob", "tenant-a"))), "signer_binding"); }); test("wrong tenant scope is unauthorized", async () => { @@ -240,10 +222,7 @@ test("wrong tenant scope is unauthorized", async () => { domain: DOMAIN, payload, }); - assert.equal( - await rejectionClass(gate().admitCanonical(envelope, context("alice", "tenant-b"))), - "unauthorized", - ); + assert.equal(await rejectionClass(gate().admitCanonical(envelope, context("alice", "tenant-b"))), "unauthorized"); }); test("oversized payload and unadmitted domain are policy refusals", async () => { @@ -254,10 +233,7 @@ test("oversized payload and unadmitted domain are policy refusals", async () => payload: encoder.encode("123456789"), }); const smallGate = gate({ admittedDomains: new Set([DOMAIN]), maxPayloadBytes: 8 }); - assert.equal( - await rejectionClass(smallGate.admitCanonical(oversized, context("alice", "tenant-a"))), - "policy", - ); + assert.equal(await rejectionClass(smallGate.admitCanonical(oversized, context("alice", "tenant-a"))), "policy"); const otherDomain = await buildEnvelope({ actor: alice, @@ -265,17 +241,12 @@ test("oversized payload and unadmitted domain are policy refusals", async () => domain: OTHER_DOMAIN, payload, }); - assert.equal( - await rejectionClass(gate().admitCanonical(otherDomain, context("alice", "tenant-a"))), - "policy", - ); + assert.equal(await rejectionClass(gate().admitCanonical(otherDomain, context("alice", "tenant-a"))), "policy"); }); test("garbage bytes are malformed; the blake3 profile is unsupported in this build", async () => { assert.equal( - await rejectionClass( - gate().admitCanonical(new Uint8Array(24).fill(0xff), context("alice", "tenant-a")), - ), + await rejectionClass(gate().admitCanonical(new Uint8Array(24).fill(0xff), context("alice", "tenant-a"))), "malformed", ); @@ -287,22 +258,17 @@ test("garbage bytes are malformed; the blake3 profile is unsupported in this bui profile: "raw-blake3-256", digestOverride: new Uint8Array(32), }); - assert.equal( - await rejectionClass(gate().admitCanonical(blake3, context("alice", "tenant-a"))), - "unsupported", - ); + assert.equal(await rejectionClass(gate().admitCanonical(blake3, context("alice", "tenant-a"))), "unsupported"); }); test("context fields are validated", () => { assert.throws( () => admissionContext("", "tenant-a", "admission:write"), - (error: unknown) => - error instanceof AdmissionRejection && error.rejectionClass === "malformed", + (error: unknown) => error instanceof AdmissionRejection && error.rejectionClass === "malformed", ); assert.throws( () => admissionContext("alice", "tenant a", "admission:write"), - (error: unknown) => - error instanceof AdmissionRejection && error.rejectionClass === "malformed", + (error: unknown) => error instanceof AdmissionRejection && error.rejectionClass === "malformed", ); assert.ok(admissionContext("alice", "tenant-a", "x".repeat(255))); }); diff --git a/pkgs/id/hosted-worker/test/bridge-do.test.ts b/pkgs/id/hosted-worker/test/bridge-do.test.ts index deeff57b83..88708791cd 100644 --- a/pkgs/id/hosted-worker/test/bridge-do.test.ts +++ b/pkgs/id/hosted-worker/test/bridge-do.test.ts @@ -11,12 +11,7 @@ import { authTranscript, bodyHashHex } from "../src/bridge-auth.ts"; import { BridgeStore, BRIDGE_SCHEMA } from "../src/bridge-store.ts"; import { bytesToHex, importIdKey, type IdKey } from "../src/ed25519.ts"; import { signEvent, type SignedEvent } from "../src/event.ts"; -import { - BridgeClient, - decodeBatch, - encodeBatch, - type FrameTransport, -} from "../src/bridge-session.ts"; +import { BridgeClient, decodeBatch, encodeBatch, type FrameTransport } from "../src/bridge-session.ts"; const BINDING = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; @@ -132,7 +127,10 @@ test("HTTPS push/pull round trip with per-call proofs", async () => { ); assert.equal(push.status, 200); const pushBody = (await push.json()) as { outcomes: { kind: string }[]; heads: { next_seq: number }[] }; - assert.deepEqual(pushBody.outcomes.map((o) => o.kind), ["accepted", "accepted"]); + assert.deepEqual( + pushBody.outcomes.map((o) => o.kind), + ["accepted", "accepted"], + ); assert.equal(pushBody.heads[0].next_seq, 2); // Pull from position zero replays the store; from the head, nothing. @@ -150,11 +148,17 @@ test("HTTPS push/pull round trip with per-call proofs", async () => { maxBatchBytes: 1 << 20, maxWantIds: 512, }); - assert.deepEqual(pulled, events.map((e) => e.bytes)); + assert.deepEqual( + pulled, + events.map((e) => e.bytes), + ); // Usage counts the bridge bytes. const usage = (await (await doA.fetch(routed("/v1/usage", null))).json()) as { bridge_bytes: number }; - assert.equal(usage.bridge_bytes, events.reduce((sum, e) => sum + e.bytes.length, 0)); + assert.equal( + usage.bridge_bytes, + events.reduce((sum, e) => sum + e.bytes.length, 0), + ); }); test("bridge HTTPS legs fail closed: no key, no proof, wrong key, replayed nonce", async () => { @@ -173,18 +177,30 @@ test("bridge HTTPS legs fail closed: no key, no proof, wrong key, replayed nonce const nonce = await challenge(doA, key.publicHex); const badHeaders = await proofHeaders(wrong, nonce, "push", batch); assert.equal( - (await doA.fetch(routed("/v1/bridge/push", key.publicHex, { method: "POST", headers: badHeaders, body: batch as BodyInit }))).status, + ( + await doA.fetch( + routed("/v1/bridge/push", key.publicHex, { method: "POST", headers: badHeaders, body: batch as BodyInit }), + ) + ).status, 403, ); // A good proof works once; the same nonce replayed is refused. const nonce2 = await challenge(doA, key.publicHex); const good = await proofHeaders(key, nonce2, "push", batch); assert.equal( - (await doA.fetch(routed("/v1/bridge/push", key.publicHex, { method: "POST", headers: good, body: batch as BodyInit }))).status, + ( + await doA.fetch( + routed("/v1/bridge/push", key.publicHex, { method: "POST", headers: good, body: batch as BodyInit }), + ) + ).status, 200, ); assert.equal( - (await doA.fetch(routed("/v1/bridge/push", key.publicHex, { method: "POST", headers: good, body: batch as BodyInit }))).status, + ( + await doA.fetch( + routed("/v1/bridge/push", key.publicHex, { method: "POST", headers: good, body: batch as BodyInit }), + ) + ).status, 403, ); }); diff --git a/pkgs/id/hosted-worker/test/bridge-event.test.ts b/pkgs/id/hosted-worker/test/bridge-event.test.ts index 4c55ee368a..b28e2cb865 100644 --- a/pkgs/id/hosted-worker/test/bridge-event.test.ts +++ b/pkgs/id/hosted-worker/test/bridge-event.test.ts @@ -74,13 +74,7 @@ const U = (v: bigint): CborValue => ({ kind: "uint", value: v }); * structural rule can be exercised in isolation: parseEvent checks * structure without the signature. */ function handBuilt(extPairs: [CborValue, CborValue][], seq = 0n): Uint8Array { - const items: CborValue[] = [ - U(1n), - B(new Uint8Array(32).fill(3)), - B(new Uint8Array(64).fill(4)), - U(0n), - U(seq), - ]; + const items: CborValue[] = [U(1n), B(new Uint8Array(32).fill(3)), B(new Uint8Array(64).fill(4)), U(0n), U(seq)]; if (seq > 0n) items.push(B(new Uint8Array(32).fill(5))); items.push({ kind: "map", value: extPairs }); return encodeCanonical({ kind: "array", value: items }); @@ -121,9 +115,7 @@ test("structural extension rules (parseEvent, signature aside)", () => { // A tag kind without its payload. assert.throws( () => - parseEvent( - handBuilt(baseExt().map(([k, v]) => [k, k.kind === "text" && k.value === "kind" ? T("tag.set") : v])), - ), + parseEvent(handBuilt(baseExt().map(([k, v]) => [k, k.kind === "text" && k.value === "kind" ? T("tag.set") : v]))), /needs its tag payload/, ); // 33 `after` hashes. @@ -131,7 +123,12 @@ test("structural extension rules (parseEvent, signature aside)", () => { assert.throws( () => parseEvent( - handBuilt(baseExt().map(([k, v]) => [k, k.kind === "text" && k.value === "after" ? { kind: "array", value: many } as CborValue : v])), + handBuilt( + baseExt().map(([k, v]) => [ + k, + k.kind === "text" && k.value === "after" ? ({ kind: "array", value: many } as CborValue) : v, + ]), + ), ), /most allowed is 32/, ); @@ -140,7 +137,12 @@ test("structural extension rules (parseEvent, signature aside)", () => { assert.throws( () => parseEvent( - handBuilt(baseExt().map(([k, v]) => [k, k.kind === "text" && k.value === "after" ? { kind: "array", value: dup } as CborValue : v])), + handBuilt( + baseExt().map(([k, v]) => [ + k, + k.kind === "text" && k.value === "after" ? ({ kind: "array", value: dup } as CborValue) : v, + ]), + ), ), /same hash twice/, ); @@ -155,16 +157,22 @@ test("structural extension rules (parseEvent, signature aside)", () => { // A non-NFC kind. assert.throws( () => - parseEvent( - handBuilt(baseExt().map(([k, v]) => [k, k.kind === "text" && k.value === "kind" ? T("café") : v])), - ), + parseEvent(handBuilt(baseExt().map(([k, v]) => [k, k.kind === "text" && k.value === "kind" ? T("café") : v]))), /not NFC/, ); // seq 0 with a backlink-shaped extra field: the extra item is not // the extensions map, so the header is malformed. const withBacklink = encodeCanonical({ kind: "array", - value: [U(1n), B(new Uint8Array(32)), B(new Uint8Array(64)), U(0n), U(0n), B(new Uint8Array(32)), { kind: "map", value: baseExt() }], + value: [ + U(1n), + B(new Uint8Array(32)), + B(new Uint8Array(64)), + U(0n), + U(0n), + B(new Uint8Array(32)), + { kind: "map", value: baseExt() }, + ], }); assert.throws(() => parseEvent(withBacklink), Malformed); }); @@ -220,7 +228,18 @@ test("checkpoint payload extraction", async () => { const cp0 = await signEvent(key, { seq: 0, kind: "session.checkpoint", - extra: [["checkpoint", { kind: "map", value: [[T("header"), header], [T("segment"), segment(0n, { kind: "null" })]] }]], + extra: [ + [ + "checkpoint", + { + kind: "map", + value: [ + [T("header"), header], + [T("segment"), segment(0n, { kind: "null" })], + ], + }, + ], + ], }); assert.equal(cp0.checkpoint?.segmentSeq, 0n); assert.equal(cp0.checkpoint?.prev, null); @@ -228,7 +247,18 @@ test("checkpoint payload extraction", async () => { seq: 1, backlink: cp0.idBytes, kind: "session.checkpoint", - extra: [["checkpoint", { kind: "map", value: [[T("header"), header], [T("segment"), segment(1n, B(cp0.idBytes))]] }]], + extra: [ + [ + "checkpoint", + { + kind: "map", + value: [ + [T("header"), header], + [T("segment"), segment(1n, B(cp0.idBytes))], + ], + }, + ], + ], }); assert.equal(bytesToHex(cp1.checkpoint?.prev as Uint8Array), cp0.id); assert.equal( diff --git a/pkgs/id/hosted-worker/test/bridge-range.test.ts b/pkgs/id/hosted-worker/test/bridge-range.test.ts index 0098b9e287..9e1fc23106 100644 --- a/pkgs/id/hosted-worker/test/bridge-range.test.ts +++ b/pkgs/id/hosted-worker/test/bridge-range.test.ts @@ -67,12 +67,7 @@ test("two parties learn exactly the symmetric difference", () => { const a = base.filter(() => rand() < 0.8); const b = base.filter(() => rand() < 0.8); const truth = symdiff(a, b); - const sim = simulateExchange( - new RangeParty(a), - DEFAULT_RANGE_PARAMS, - new RangeParty(b), - DEFAULT_RANGE_PARAMS, - ); + const sim = simulateExchange(new RangeParty(a), DEFAULT_RANGE_PARAMS, new RangeParty(b), DEFAULT_RANGE_PARAMS); assert.deepEqual(sim.learnedA, truth, `trial ${trial}: A's learned set`); assert.deepEqual(sim.learnedB, truth, `trial ${trial}: B's learned set`); } @@ -91,12 +86,7 @@ test("different local K and T still converge", () => { test("identical sets learn nothing and end on skips", () => { const set = makeSet("same", 30); - const sim = simulateExchange( - new RangeParty(set), - DEFAULT_RANGE_PARAMS, - new RangeParty(set), - DEFAULT_RANGE_PARAMS, - ); + const sim = simulateExchange(new RangeParty(set), DEFAULT_RANGE_PARAMS, new RangeParty(set), DEFAULT_RANGE_PARAMS); assert.equal(sim.learnedA.size, 0); assert.equal(sim.learnedB.size, 0); assert.equal(sim.flights, 2); @@ -106,12 +96,7 @@ test("reconciliation cost is sublinear in the set size", () => { // The #2276 bound: 100 events over 4 authors reconcile in under // 6,400 frame bytes when the sets are identical. const set = makeSet("cost", 100); - const sim = simulateExchange( - new RangeParty(set), - DEFAULT_RANGE_PARAMS, - new RangeParty(set), - DEFAULT_RANGE_PARAMS, - ); + const sim = simulateExchange(new RangeParty(set), DEFAULT_RANGE_PARAMS, new RangeParty(set), DEFAULT_RANGE_PARAMS); assert.ok(sim.bytesA + sim.bytesB < 6400, `cost ${sim.bytesA + sim.bytesB}`); }); @@ -135,9 +120,7 @@ test("frames round-trip and bounds are checked", () => { ]), ); // A bound longer than a key is refused. - assert.throws(() => - checkBounds([{ upper: new Uint8Array(73), mode: { t: "skip" } }]), - ); + assert.throws(() => checkBounds([{ upper: new Uint8Array(73), mode: { t: "skip" } }])); }); test("malformed frames are refused", () => { diff --git a/pkgs/id/hosted-worker/test/bridge-session.test.ts b/pkgs/id/hosted-worker/test/bridge-session.test.ts index 8ee7cab6f5..42f9e99c0e 100644 --- a/pkgs/id/hosted-worker/test/bridge-session.test.ts +++ b/pkgs/id/hosted-worker/test/bridge-session.test.ts @@ -119,7 +119,12 @@ async function chainOf(key: IdKey, count: number, store?: BridgeStore): Promise< return events; } -function serve(store: BridgeStore, boundKey: IdKey, transport: FrameTransport, params = DEFAULT_RANGE_PARAMS): BridgeSessionServer { +function serve( + store: BridgeStore, + boundKey: IdKey, + transport: FrameTransport, + params = DEFAULT_RANGE_PARAMS, +): BridgeSessionServer { return new BridgeSessionServer({ store, bindingId: BINDING, @@ -178,8 +183,18 @@ test("an equal-height fork is detected by proof exchange, not heights", async () const clientStore = makeStore(); const serverStore = makeStore(); const [e0] = await chainOf(alice, 1); - const a1 = await signEvent(alice, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("a") }); - const b1 = await signEvent(alice, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("b") }); + const a1 = await signEvent(alice, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("a"), + }); + const b1 = await signEvent(alice, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("b"), + }); clientStore.ingestBatch([e0, a1], NOW); serverStore.ingestBatch([e0, b1], NOW); await runSession(clientStore, serverStore, bound, bound); @@ -244,8 +259,18 @@ test("replay into empty stores yields identical tables, both directions", async const alice = await importIdKey(new Uint8Array(32).fill(46)); const source = makeStore(); const [e0] = await chainOf(alice, 1, source); - const a1 = await signEvent(alice, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("a") }); - const b1 = await signEvent(alice, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("b") }); + const a1 = await signEvent(alice, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("a"), + }); + const b1 = await signEvent(alice, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("b"), + }); source.ingestBatch([a1, b1], NOW); // A waiting event whose dependency never arrives. const waiting = await signEvent(alice, { seq: 0, kind: "message", after: [new Uint8Array(32).fill(99)] }); @@ -298,7 +323,10 @@ test("a dropped session retries, resumes, and never duplicates", async () => { assert.deepEqual(clientStore.canonical(), serverStore.canonical()); assert.ok(result.token); // Re-delivery of the whole journal is all duplicates. - const again = clientStore.ingestBatch(serverStore.heldEvents().map((h) => parseEvent(h.bytes)), NOW); + const again = clientStore.ingestBatch( + serverStore.heldEvents().map((h) => parseEvent(h.bytes)), + NOW, + ); assert.ok(again.every((o) => o.kind === "duplicate")); }); @@ -345,10 +373,7 @@ test("the wrong ID key is refused at AUTH", async () => { const impostor = await importIdKey(new Uint8Array(32).fill(52)); const clientStore = makeStore(); const serverStore = makeStore(); - await assert.rejects( - () => runSession(clientStore, serverStore, impostor, bound), - /auth_failed/, - ); + await assert.rejects(() => runSession(clientStore, serverStore, impostor, bound), /auth_failed/); }); test("a blown range budget ends the session with a named error", async () => { diff --git a/pkgs/id/hosted-worker/test/bridge-store.test.ts b/pkgs/id/hosted-worker/test/bridge-store.test.ts index b89de23b04..6d74eccee6 100644 --- a/pkgs/id/hosted-worker/test/bridge-store.test.ts +++ b/pkgs/id/hosted-worker/test/bridge-store.test.ts @@ -57,13 +57,19 @@ test("a chain is accepted in order; heads and canonical shape follow", async () const store = makeStore(); const events = await chainOf(key, 3); const outcomes = store.ingestBatch(events, NOW); - assert.deepEqual(outcomes.map((o) => o.kind), ["accepted", "accepted", "accepted"]); + assert.deepEqual( + outcomes.map((o) => o.kind), + ["accepted", "accepted", "accepted"], + ); const chain = store.chainOf(key.publicHex); assert.equal(chain.next_seq, 3); assert.equal(chain.head, events[2].id); assert.equal(chain.frozen, false); const shape = store.canonical(); - assert.deepEqual(shape.applied[key.publicHex], events.map((e) => e.id)); + assert.deepEqual( + shape.applied[key.publicHex], + events.map((e) => e.id), + ); assert.deepEqual(shape.waiting, []); }); @@ -84,7 +90,10 @@ test("out-of-order delivery waits, then releases in chain order", async () => { const store = makeStore(); const [e0, e1, e2] = await chainOf(key, 3); const first = store.ingestBatch([e2, e1], NOW); - assert.deepEqual(first.map((o) => o.kind), ["waiting", "waiting"]); + assert.deepEqual( + first.map((o) => o.kind), + ["waiting", "waiting"], + ); const second = store.ingestBatch([e0], NOW + 1); assert.equal(second[0].kind, "accepted"); if (second[0].kind === "accepted") { @@ -114,8 +123,18 @@ test("an equal-height fork freezes the chain at the fork point", async () => { const key = await importIdKey(new Uint8Array(32).fill(26)); const store = makeStore(); const [e0] = await chainOf(key, 1); - const a1 = await signEvent(key, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("a") }); - const b1 = await signEvent(key, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("b") }); + const a1 = await signEvent(key, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("a"), + }); + const b1 = await signEvent(key, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("b"), + }); store.ingestBatch([e0, a1], NOW); const forkOutcome = store.ingestBatch([b1], NOW + 1); assert.equal(forkOutcome[0].kind, "fork"); @@ -133,7 +152,12 @@ test("an equal-height fork freezes the chain at the fork point", async () => { if (refused[0].kind === "refused") assert.equal(refused[0].reason, "frozen"); // A third rival at the fork point with a lower ID replaces the // proof (the two-lowest rule); with a higher ID it is refused. - const c1 = await signEvent(key, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("c") }); + const c1 = await signEvent(key, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("c"), + }); const third = store.ingestBatch([c1], NOW + 3); const expectedPair = [a1.id, b1.id, c1.id].sort().slice(0, 2); const pairChanged = expectedPair[0] !== first || expectedPair[1] !== second; @@ -154,7 +178,12 @@ test("a held rival forks with the newcomer (proof from the pool)", async () => { const missing = new Uint8Array(32).fill(99); const a1 = await signEvent(key, { seq: 1, backlink: e0.idBytes, kind: "message", after: [missing] }); assert.equal(store.ingestBatch([a1], NOW)[0].kind, "waiting"); - const b1 = await signEvent(key, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("b") }); + const b1 = await signEvent(key, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("b"), + }); const outcome = store.ingestBatch([b1], NOW + 1); assert.equal(outcome[0].kind, "fork"); const [first, second] = [a1.id, b1.id].sort(); @@ -165,8 +194,18 @@ test("a fork proof header is present for dependencies and duplicates", async () const key = await importIdKey(new Uint8Array(32).fill(28)); const store = makeStore(); const [e0] = await chainOf(key, 1); - const a1 = await signEvent(key, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("a") }); - const b1 = await signEvent(key, { seq: 1, backlink: e0.idBytes, kind: "message", body: new TextEncoder().encode("b") }); + const a1 = await signEvent(key, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("a"), + }); + const b1 = await signEvent(key, { + seq: 1, + backlink: e0.idBytes, + kind: "message", + body: new TextEncoder().encode("b"), + }); store.ingestBatch([e0, a1, b1], NOW); // Re-delivering a proof header is a duplicate. assert.equal(store.ingestBatch([a1], NOW + 1)[0].kind, "duplicate"); @@ -185,7 +224,10 @@ test("waiting caps refuse with waiting_full", async () => { for (const k of keys) { outcomes.push(store.ingestBatch([await signEvent(k, { seq: 0, kind: "message", after: [missing] })], NOW)[0]); } - assert.deepEqual(outcomes.map((o) => o.kind), ["waiting", "waiting", "waiting"]); + assert.deepEqual( + outcomes.map((o) => o.kind), + ["waiting", "waiting", "waiting"], + ); // Per-author cap: a second author is fine, the capped author is not. const capped = makeStore({ perAuthor: 1, total: 100, maxAgeMs: 60_000 }); const k1 = await importIdKey(new Uint8Array(32).fill(34)); @@ -230,7 +272,18 @@ function checkpointDraft(segmentSeq: bigint, prev: Uint8Array | null, headerFill [T("root"), B(new Uint8Array(32).fill(2))], ], }; - return [["checkpoint", { kind: "map", value: [[T("header"), header], [T("segment"), segment]] }]] as [string, CborValue][]; + return [ + [ + "checkpoint", + { + kind: "map", + value: [ + [T("header"), header], + [T("segment"), segment], + ], + }, + ], + ] as [string, CborValue][]; } test("checkpoint predecessors: accept the next segment, refuse a skip, wait on a gap", async () => { @@ -238,22 +291,40 @@ test("checkpoint predecessors: accept the next segment, refuse a skip, wait on a const store = makeStore(); const cp0 = await signEvent(key, { seq: 0, kind: "session.checkpoint", extra: checkpointDraft(0n, null) }); assert.equal(store.ingestBatch([cp0], NOW)[0].kind, "accepted"); - const cp1 = await signEvent(key, { seq: 1, backlink: cp0.idBytes, kind: "session.checkpoint", extra: checkpointDraft(1n, cp0.idBytes) }); + const cp1 = await signEvent(key, { + seq: 1, + backlink: cp0.idBytes, + kind: "session.checkpoint", + extra: checkpointDraft(1n, cp0.idBytes), + }); assert.equal(store.ingestBatch([cp1], NOW)[0].kind, "accepted"); // Segment 5 naming cp1 as predecessor: not the previous segment. - const cpSkip = await signEvent(key, { seq: 2, backlink: cp1.idBytes, kind: "session.checkpoint", extra: checkpointDraft(5n, cp1.idBytes) }); + const cpSkip = await signEvent(key, { + seq: 2, + backlink: cp1.idBytes, + kind: "session.checkpoint", + extra: checkpointDraft(5n, cp1.idBytes), + }); const refused = store.ingestBatch([cpSkip], NOW)[0]; assert.equal(refused.kind, "refused"); if (refused.kind === "refused") assert.equal(refused.reason, "malformed"); // A checkpoint naming an unknown predecessor waits. const other = await importIdKey(new Uint8Array(32).fill(37)); - const orphan = await signEvent(other, { seq: 0, kind: "session.checkpoint", extra: checkpointDraft(1n, new Uint8Array(32).fill(55)) }); + const orphan = await signEvent(other, { + seq: 0, + kind: "session.checkpoint", + extra: checkpointDraft(1n, new Uint8Array(32).fill(55)), + }); assert.equal(store.ingestBatch([orphan], NOW)[0].kind, "waiting"); // A checkpoint naming ANOTHER author's checkpoint as predecessor — // even with the same session header copied — is not the previous // segment of its own session chain: refused as malformed. const third = await importIdKey(new Uint8Array(32).fill(38)); - const foreign = await signEvent(third, { seq: 0, kind: "session.checkpoint", extra: checkpointDraft(1n, cp0.idBytes) }); + const foreign = await signEvent(third, { + seq: 0, + kind: "session.checkpoint", + extra: checkpointDraft(1n, cp0.idBytes), + }); const foreignOutcome = store.ingestBatch([foreign], NOW)[0]; assert.equal(foreignOutcome.kind, "refused"); if (foreignOutcome.kind === "refused") assert.equal(foreignOutcome.reason, "malformed"); diff --git a/pkgs/id/hosted-worker/test/export.test.ts b/pkgs/id/hosted-worker/test/export.test.ts index 9b19447a3a..e3771f1e9f 100644 --- a/pkgs/id/hosted-worker/test/export.test.ts +++ b/pkgs/id/hosted-worker/test/export.test.ts @@ -245,10 +245,7 @@ test("export production: seeded DO yields the §6 sets, pinned to the fixture", // Citations resolved by content to the §6 (SHA-256) blob names: // alpha cited by two objects, beta by one; each blob carried once. const docRefs = wire.objects.filter((o) => o.blob_refs.length > 0).map((o) => o.blob_refs[0]); - assert.deepEqual( - docRefs.sort(), - [blobHashes.alpha, blobHashes.alpha, blobHashes.beta].sort(), - ); + assert.deepEqual(docRefs.sort(), [blobHashes.alpha, blobHashes.alpha, blobHashes.beta].sort()); assert.deepEqual(blobHashList, [blobHashes.alpha, blobHashes.beta].sort()); const blobBytes = new Map(wire.blobs.map((b) => [b.hash, b.bytes])); assert.deepEqual(blobBytes.get(blobHashes.alpha), [...BLOB_ALPHA]); @@ -296,10 +293,7 @@ test("a referenced blob R2 cannot produce fails the export loudly, naming the ha assert.equal(res.status, 502); const body = (await res.json()) as { error: string; message: string }; assert.equal(body.error, "export_production_failed"); - assert.ok( - body.message.includes(blobHashes.beta), - `failure names the missing blob hash: ${body.message}`, - ); + assert.ok(body.message.includes(blobHashes.beta), `failure names the missing blob hash: ${body.message}`); }); test("an object citing content no referenced blob produces fails loudly, naming the cited hash", async () => { @@ -324,10 +318,7 @@ test("an object citing content no referenced blob produces fails loudly, naming assert.equal(res.status, 502); const body = (await res.json()) as { error: string; message: string }; assert.equal(body.error, "export_production_failed"); - assert.ok( - body.message.includes(bytesToHex(blake3(ghost))), - `failure names the cited content hash: ${body.message}`, - ); + assert.ok(body.message.includes(bytesToHex(blake3(ghost))), `failure names the cited content hash: ${body.message}`); }); test("the export leg fails closed without a proof, like every bridge leg", async () => { diff --git a/pkgs/id/hosted-worker/test/fixtures/hosted-export-sets.json b/pkgs/id/hosted-worker/test/fixtures/hosted-export-sets.json index 306975195c..97521076f7 100644 --- a/pkgs/id/hosted-worker/test/fixtures/hosted-export-sets.json +++ b/pkgs/id/hosted-worker/test/fixtures/hosted-export-sets.json @@ -4,846 +4,60 @@ "hash": "26ebf41231873c299579abc200fe0fda70e295849e64b7d3b96d84cc5cb97016", "signer": "ea4a6c63e29c520abef5507b132ec5f9954776aebebe7b92421eea691446d22c", "signature": "6735baa4aac7c6411c33d9f31b1b7c1188d9a7111b081479a179810fcb577dc461eef7c4add2e85e52e3c1ddd84ff6bd0f99d7666e05b0a8a7304cfcebb4ec0c", - "blob_refs": [ - "747ad0246b0f6d6b8f3bca9f7b62fea5d16eada3bf50b13c4408dd6fa7478436" - ], + "blob_refs": ["747ad0246b0f6d6b8f3bca9f7b62fea5d16eada3bf50b13c4408dd6fa7478436"], "bytes": [ - 135, - 1, - 88, - 32, - 234, - 74, - 108, - 99, - 226, - 156, - 82, - 10, - 190, - 245, - 80, - 123, - 19, - 46, - 197, - 249, - 149, - 71, - 118, - 174, - 190, - 190, - 123, - 146, - 66, - 30, - 234, - 105, - 20, - 70, - 210, - 44, - 88, - 64, - 103, - 53, - 186, - 164, - 170, - 199, - 198, - 65, - 28, - 51, - 217, - 243, - 27, - 27, - 124, - 17, - 136, - 217, - 167, - 17, - 27, - 8, - 20, - 121, - 161, - 121, - 129, - 15, - 203, - 87, - 125, - 196, - 97, - 238, - 247, - 196, - 173, - 210, - 232, - 94, - 82, - 227, - 193, - 221, - 216, - 79, - 246, - 189, - 15, - 153, - 215, - 102, - 110, - 5, - 176, - 168, - 167, - 48, - 76, - 252, - 235, - 180, - 236, - 12, - 0, - 2, - 88, - 32, - 25, - 194, - 216, - 53, - 0, - 122, - 55, - 177, - 105, - 74, - 94, - 199, - 43, - 200, - 174, - 162, - 29, - 41, - 143, - 202, - 53, - 52, - 228, - 88, - 188, - 150, - 44, - 144, - 172, - 184, - 148, - 241, - 165, - 100, - 107, - 105, - 110, - 100, - 108, - 100, - 111, - 99, - 117, - 109, - 101, - 110, - 116, - 46, - 112, - 117, - 116, - 101, - 97, - 102, - 116, - 101, - 114, - 128, - 101, - 103, - 114, - 111, - 117, - 112, - 246, - 102, - 100, - 111, - 109, - 97, - 105, - 110, - 108, - 105, - 100, - 46, - 101, - 118, - 101, - 110, - 116, - 115, - 46, - 118, - 49, - 104, - 100, - 111, - 99, - 117, - 109, - 101, - 110, - 116, - 163, - 100, - 115, - 105, - 122, - 101, - 24, - 43, - 103, - 99, - 111, - 110, - 116, - 101, - 110, - 116, - 88, - 32, - 126, - 152, - 226, - 250, - 174, - 129, - 182, - 105, - 227, - 157, - 211, - 116, - 117, - 199, - 109, - 92, - 124, - 60, - 139, - 72, - 34, - 227, - 57, - 32, - 49, - 165, - 165, - 196, - 126, - 3, - 101, - 207, - 106, - 109, - 101, - 100, - 105, - 97, - 95, - 116, - 121, - 112, - 101, - 106, - 116, - 101, - 120, - 116, - 47, - 112, - 108, - 97, - 105, - 110 + 135, 1, 88, 32, 234, 74, 108, 99, 226, 156, 82, 10, 190, 245, 80, 123, 19, 46, 197, 249, 149, 71, 118, 174, 190, + 190, 123, 146, 66, 30, 234, 105, 20, 70, 210, 44, 88, 64, 103, 53, 186, 164, 170, 199, 198, 65, 28, 51, 217, + 243, 27, 27, 124, 17, 136, 217, 167, 17, 27, 8, 20, 121, 161, 121, 129, 15, 203, 87, 125, 196, 97, 238, 247, + 196, 173, 210, 232, 94, 82, 227, 193, 221, 216, 79, 246, 189, 15, 153, 215, 102, 110, 5, 176, 168, 167, 48, 76, + 252, 235, 180, 236, 12, 0, 2, 88, 32, 25, 194, 216, 53, 0, 122, 55, 177, 105, 74, 94, 199, 43, 200, 174, 162, + 29, 41, 143, 202, 53, 52, 228, 88, 188, 150, 44, 144, 172, 184, 148, 241, 165, 100, 107, 105, 110, 100, 108, + 100, 111, 99, 117, 109, 101, 110, 116, 46, 112, 117, 116, 101, 97, 102, 116, 101, 114, 128, 101, 103, 114, 111, + 117, 112, 246, 102, 100, 111, 109, 97, 105, 110, 108, 105, 100, 46, 101, 118, 101, 110, 116, 115, 46, 118, 49, + 104, 100, 111, 99, 117, 109, 101, 110, 116, 163, 100, 115, 105, 122, 101, 24, 43, 103, 99, 111, 110, 116, 101, + 110, 116, 88, 32, 126, 152, 226, 250, 174, 129, 182, 105, 227, 157, 211, 116, 117, 199, 109, 92, 124, 60, 139, + 72, 34, 227, 57, 32, 49, 165, 165, 196, 126, 3, 101, 207, 106, 109, 101, 100, 105, 97, 95, 116, 121, 112, 101, + 106, 116, 101, 120, 116, 47, 112, 108, 97, 105, 110 ] }, { "hash": "5a8bd3ac5b961462282634b7113a939884b37913827a3cbe4755ec407bb0ab39", "signer": "ea4a6c63e29c520abef5507b132ec5f9954776aebebe7b92421eea691446d22c", "signature": "0133a0cd6b42f8480ae80a81371312ffc206960eb1a693b0f3c6f32bfbe2889981338cf7e00c87fae580ade9bd1c02bba04e788e53429f2031346c6f36bf0a0f", - "blob_refs": [ - "8b8e421a9547932f90af7f1dd385596349e374a225773638d3e41adb3c6235bc" - ], + "blob_refs": ["8b8e421a9547932f90af7f1dd385596349e374a225773638d3e41adb3c6235bc"], "bytes": [ - 135, - 1, - 88, - 32, - 234, - 74, - 108, - 99, - 226, - 156, - 82, - 10, - 190, - 245, - 80, - 123, - 19, - 46, - 197, - 249, - 149, - 71, - 118, - 174, - 190, - 190, - 123, - 146, - 66, - 30, - 234, - 105, - 20, - 70, - 210, - 44, - 88, - 64, - 1, - 51, - 160, - 205, - 107, - 66, - 248, - 72, - 10, - 232, - 10, - 129, - 55, - 19, - 18, - 255, - 194, - 6, - 150, - 14, - 177, - 166, - 147, - 176, - 243, - 198, - 243, - 43, - 251, - 226, - 136, - 153, - 129, - 51, - 140, - 247, - 224, - 12, - 135, - 250, - 229, - 128, - 173, - 233, - 189, - 28, - 2, - 187, - 160, - 78, - 120, - 142, - 83, - 66, - 159, - 32, - 49, - 52, - 108, - 111, - 54, - 191, - 10, - 15, - 0, - 3, - 88, - 32, - 248, - 255, - 74, - 83, - 64, - 53, - 216, - 157, - 89, - 68, - 212, - 154, - 14, - 66, - 37, - 120, - 29, - 130, - 146, - 126, - 53, - 165, - 248, - 131, - 64, - 176, - 132, - 247, - 92, - 165, - 85, - 187, - 165, - 100, - 107, - 105, - 110, - 100, - 108, - 100, - 111, - 99, - 117, - 109, - 101, - 110, - 116, - 46, - 112, - 117, - 116, - 101, - 97, - 102, - 116, - 101, - 114, - 128, - 101, - 103, - 114, - 111, - 117, - 112, - 246, - 102, - 100, - 111, - 109, - 97, - 105, - 110, - 108, - 105, - 100, - 46, - 101, - 118, - 101, - 110, - 116, - 115, - 46, - 118, - 49, - 104, - 100, - 111, - 99, - 117, - 109, - 101, - 110, - 116, - 163, - 100, - 115, - 105, - 122, - 101, - 24, - 25, - 103, - 99, - 111, - 110, - 116, - 101, - 110, - 116, - 88, - 32, - 18, - 58, - 182, - 5, - 218, - 145, - 230, - 183, - 186, - 232, - 19, - 86, - 166, - 252, - 143, - 238, - 40, - 108, - 205, - 72, - 225, - 66, - 72, - 75, - 153, - 29, - 252, - 77, - 11, - 78, - 112, - 116, - 106, - 109, - 101, - 100, - 105, - 97, - 95, - 116, - 121, - 112, - 101, - 106, - 116, - 101, - 120, - 116, - 47, - 112, - 108, - 97, - 105, - 110 + 135, 1, 88, 32, 234, 74, 108, 99, 226, 156, 82, 10, 190, 245, 80, 123, 19, 46, 197, 249, 149, 71, 118, 174, 190, + 190, 123, 146, 66, 30, 234, 105, 20, 70, 210, 44, 88, 64, 1, 51, 160, 205, 107, 66, 248, 72, 10, 232, 10, 129, + 55, 19, 18, 255, 194, 6, 150, 14, 177, 166, 147, 176, 243, 198, 243, 43, 251, 226, 136, 153, 129, 51, 140, 247, + 224, 12, 135, 250, 229, 128, 173, 233, 189, 28, 2, 187, 160, 78, 120, 142, 83, 66, 159, 32, 49, 52, 108, 111, + 54, 191, 10, 15, 0, 3, 88, 32, 248, 255, 74, 83, 64, 53, 216, 157, 89, 68, 212, 154, 14, 66, 37, 120, 29, 130, + 146, 126, 53, 165, 248, 131, 64, 176, 132, 247, 92, 165, 85, 187, 165, 100, 107, 105, 110, 100, 108, 100, 111, + 99, 117, 109, 101, 110, 116, 46, 112, 117, 116, 101, 97, 102, 116, 101, 114, 128, 101, 103, 114, 111, 117, 112, + 246, 102, 100, 111, 109, 97, 105, 110, 108, 105, 100, 46, 101, 118, 101, 110, 116, 115, 46, 118, 49, 104, 100, + 111, 99, 117, 109, 101, 110, 116, 163, 100, 115, 105, 122, 101, 24, 25, 103, 99, 111, 110, 116, 101, 110, 116, + 88, 32, 18, 58, 182, 5, 218, 145, 230, 183, 186, 232, 19, 86, 166, 252, 143, 238, 40, 108, 205, 72, 225, 66, 72, + 75, 153, 29, 252, 77, 11, 78, 112, 116, 106, 109, 101, 100, 105, 97, 95, 116, 121, 112, 101, 106, 116, 101, 120, + 116, 47, 112, 108, 97, 105, 110 ] }, { "hash": "5c00ef42adf8a1d0ace6f1593bf03a36219c7edb7bd367032559c479e8151df0", "signer": "ea4a6c63e29c520abef5507b132ec5f9954776aebebe7b92421eea691446d22c", "signature": "45b1efcc10fc5d8b6d32cf7bcfafffc3b497fc57324befc9429ac476f20b4faeee04b3b53e20e7d97983775a071f63dfe52ada97088e76f8a837bba2bf0d6c01", - "blob_refs": [ - "8b8e421a9547932f90af7f1dd385596349e374a225773638d3e41adb3c6235bc" - ], + "blob_refs": ["8b8e421a9547932f90af7f1dd385596349e374a225773638d3e41adb3c6235bc"], "bytes": [ - 135, - 1, - 88, - 32, - 234, - 74, - 108, - 99, - 226, - 156, - 82, - 10, - 190, - 245, - 80, - 123, - 19, - 46, - 197, - 249, - 149, - 71, - 118, - 174, - 190, - 190, - 123, - 146, - 66, - 30, - 234, - 105, - 20, - 70, - 210, - 44, - 88, - 64, - 69, - 177, - 239, - 204, - 16, - 252, - 93, - 139, - 109, - 50, - 207, - 123, - 207, - 175, - 255, - 195, - 180, - 151, - 252, - 87, - 50, - 75, - 239, - 201, - 66, - 154, - 196, - 118, - 242, - 11, - 79, - 174, - 238, - 4, - 179, - 181, - 62, - 32, - 231, - 217, - 121, - 131, - 119, - 90, - 7, - 31, - 99, - 223, - 229, - 42, - 218, - 151, - 8, - 142, - 118, - 248, - 168, - 55, - 187, - 162, - 191, - 13, - 108, - 1, - 0, - 1, - 88, - 32, - 229, - 59, - 5, - 24, - 58, - 205, - 51, - 238, - 131, - 119, - 172, - 96, - 23, - 160, - 19, - 234, - 17, - 22, - 82, - 186, - 237, - 137, - 69, - 216, - 77, - 128, - 200, - 203, - 194, - 160, - 98, - 233, - 165, - 100, - 107, - 105, - 110, - 100, - 108, - 100, - 111, - 99, - 117, - 109, - 101, - 110, - 116, - 46, - 112, - 117, - 116, - 101, - 97, - 102, - 116, - 101, - 114, - 128, - 101, - 103, - 114, - 111, - 117, - 112, - 246, - 102, - 100, - 111, - 109, - 97, - 105, - 110, - 108, - 105, - 100, - 46, - 101, - 118, - 101, - 110, - 116, - 115, - 46, - 118, - 49, - 104, - 100, - 111, - 99, - 117, - 109, - 101, - 110, - 116, - 163, - 100, - 115, - 105, - 122, - 101, - 24, - 25, - 103, - 99, - 111, - 110, - 116, - 101, - 110, - 116, - 88, - 32, - 18, - 58, - 182, - 5, - 218, - 145, - 230, - 183, - 186, - 232, - 19, - 86, - 166, - 252, - 143, - 238, - 40, - 108, - 205, - 72, - 225, - 66, - 72, - 75, - 153, - 29, - 252, - 77, - 11, - 78, - 112, - 116, - 106, - 109, - 101, - 100, - 105, - 97, - 95, - 116, - 121, - 112, - 101, - 106, - 116, - 101, - 120, - 116, - 47, - 112, - 108, - 97, - 105, - 110 + 135, 1, 88, 32, 234, 74, 108, 99, 226, 156, 82, 10, 190, 245, 80, 123, 19, 46, 197, 249, 149, 71, 118, 174, 190, + 190, 123, 146, 66, 30, 234, 105, 20, 70, 210, 44, 88, 64, 69, 177, 239, 204, 16, 252, 93, 139, 109, 50, 207, + 123, 207, 175, 255, 195, 180, 151, 252, 87, 50, 75, 239, 201, 66, 154, 196, 118, 242, 11, 79, 174, 238, 4, 179, + 181, 62, 32, 231, 217, 121, 131, 119, 90, 7, 31, 99, 223, 229, 42, 218, 151, 8, 142, 118, 248, 168, 55, 187, + 162, 191, 13, 108, 1, 0, 1, 88, 32, 229, 59, 5, 24, 58, 205, 51, 238, 131, 119, 172, 96, 23, 160, 19, 234, 17, + 22, 82, 186, 237, 137, 69, 216, 77, 128, 200, 203, 194, 160, 98, 233, 165, 100, 107, 105, 110, 100, 108, 100, + 111, 99, 117, 109, 101, 110, 116, 46, 112, 117, 116, 101, 97, 102, 116, 101, 114, 128, 101, 103, 114, 111, 117, + 112, 246, 102, 100, 111, 109, 97, 105, 110, 108, 105, 100, 46, 101, 118, 101, 110, 116, 115, 46, 118, 49, 104, + 100, 111, 99, 117, 109, 101, 110, 116, 163, 100, 115, 105, 122, 101, 24, 25, 103, 99, 111, 110, 116, 101, 110, + 116, 88, 32, 18, 58, 182, 5, 218, 145, 230, 183, 186, 232, 19, 86, 166, 252, 143, 238, 40, 108, 205, 72, 225, + 66, 72, 75, 153, 29, 252, 77, 11, 78, 112, 116, 106, 109, 101, 100, 105, 97, 95, 116, 121, 112, 101, 106, 116, + 101, 120, 116, 47, 112, 108, 97, 105, 110 ] }, { @@ -852,158 +66,13 @@ "signature": "d2734c4edc475ae59e4a0c1564d2d56c947a5745a11875a7a9024d92cc87d8a5ba60585efb192b968346b5ec659f825d8cffc778a1b610e8407eaa7b5dc1ef00", "blob_refs": [], "bytes": [ - 134, - 1, - 88, - 32, - 234, - 74, - 108, - 99, - 226, - 156, - 82, - 10, - 190, - 245, - 80, - 123, - 19, - 46, - 197, - 249, - 149, - 71, - 118, - 174, - 190, - 190, - 123, - 146, - 66, - 30, - 234, - 105, - 20, - 70, - 210, - 44, - 88, - 64, - 210, - 115, - 76, - 78, - 220, - 71, - 90, - 229, - 158, - 74, - 12, - 21, - 100, - 210, - 213, - 108, - 148, - 122, - 87, - 69, - 161, - 24, - 117, - 167, - 169, - 2, - 77, - 146, - 204, - 135, - 216, - 165, - 186, - 96, - 88, - 94, - 251, - 25, - 43, - 150, - 131, - 70, - 181, - 236, - 101, - 159, - 130, - 93, - 140, - 255, - 199, - 120, - 161, - 182, - 16, - 232, - 64, - 126, - 170, - 123, - 93, - 193, - 239, - 0, - 0, - 0, - 164, - 100, - 107, - 105, - 110, - 100, - 103, - 109, - 101, - 115, - 115, - 97, - 103, - 101, - 101, - 97, - 102, - 116, - 101, - 114, - 128, - 101, - 103, - 114, - 111, - 117, - 112, - 246, - 102, - 100, - 111, - 109, - 97, - 105, - 110, - 108, - 105, - 100, - 46, - 101, - 118, - 101, - 110, - 116, - 115, - 46, - 118, - 49 + 134, 1, 88, 32, 234, 74, 108, 99, 226, 156, 82, 10, 190, 245, 80, 123, 19, 46, 197, 249, 149, 71, 118, 174, 190, + 190, 123, 146, 66, 30, 234, 105, 20, 70, 210, 44, 88, 64, 210, 115, 76, 78, 220, 71, 90, 229, 158, 74, 12, 21, + 100, 210, 213, 108, 148, 122, 87, 69, 161, 24, 117, 167, 169, 2, 77, 146, 204, 135, 216, 165, 186, 96, 88, 94, + 251, 25, 43, 150, 131, 70, 181, 236, 101, 159, 130, 93, 140, 255, 199, 120, 161, 182, 16, 232, 64, 126, 170, + 123, 93, 193, 239, 0, 0, 0, 164, 100, 107, 105, 110, 100, 103, 109, 101, 115, 115, 97, 103, 101, 101, 97, 102, + 116, 101, 114, 128, 101, 103, 114, 111, 117, 112, 246, 102, 100, 111, 109, 97, 105, 110, 108, 105, 100, 46, 101, + 118, 101, 110, 116, 115, 46, 118, 49 ] } ], @@ -1011,79 +80,15 @@ { "hash": "747ad0246b0f6d6b8f3bca9f7b62fea5d16eada3bf50b13c4408dd6fa7478436", "bytes": [ - 101, - 120, - 112, - 111, - 114, - 116, - 32, - 102, - 105, - 120, - 116, - 117, - 114, - 101, - 32, - 98, - 108, - 111, - 98, - 32, - 98, - 101, - 116, - 97, - 32, - 226, - 128, - 148, - 32, - 115, - 101, - 99, - 111, - 110, - 100, - 32, - 99, - 111, - 110, - 116, - 101, - 110, - 116 + 101, 120, 112, 111, 114, 116, 32, 102, 105, 120, 116, 117, 114, 101, 32, 98, 108, 111, 98, 32, 98, 101, 116, 97, + 32, 226, 128, 148, 32, 115, 101, 99, 111, 110, 100, 32, 99, 111, 110, 116, 101, 110, 116 ] }, { "hash": "8b8e421a9547932f90af7f1dd385596349e374a225773638d3e41adb3c6235bc", "bytes": [ - 101, - 120, - 112, - 111, - 114, - 116, - 32, - 102, - 105, - 120, - 116, - 117, - 114, - 101, - 32, - 98, - 108, - 111, - 98, - 32, - 97, - 108, - 112, - 104, - 97 + 101, 120, 112, 111, 114, 116, 32, 102, 105, 120, 116, 117, 114, 101, 32, 98, 108, 111, 98, 32, 97, 108, 112, + 104, 97 ] } ], diff --git a/pkgs/id/hosted-worker/test/id-uri-vectors.test.ts b/pkgs/id/hosted-worker/test/id-uri-vectors.test.ts index 2fd6544d55..f5d403e71d 100644 --- a/pkgs/id/hosted-worker/test/id-uri-vectors.test.ts +++ b/pkgs/id/hosted-worker/test/id-uri-vectors.test.ts @@ -36,8 +36,13 @@ const DIGEST = /^[0-9a-f]{64}$/; const HEX = /^[0-9a-fA-F]$/; const isUnreserved = (b: number): boolean => - (b >= 0x30 && b <= 0x39) || (b >= 0x41 && b <= 0x5a) || (b >= 0x61 && b <= 0x7a) || - b === 0x2d || b === 0x2e || b === 0x5f || b === 0x7e; + (b >= 0x30 && b <= 0x39) || + (b >= 0x41 && b <= 0x5a) || + (b >= 0x61 && b <= 0x7a) || + b === 0x2d || + b === 0x2e || + b === 0x5f || + b === 0x7e; function checkAlias(alias: string): void { if (!ALIAS.test(alias)) throw new UriError("invalid_resolver_alias"); @@ -375,7 +380,12 @@ test("malformed corpus and negative content cases reject with the reference clas [`id://local/main/v1/content/raw-blake3-256.${z63}A`, "invalid_digest_text"], ["id://[local/main/v1/array", "uri_parse_error"], ]; - for (const [uri, expected] of bad) assert.equal(errorClass(() => parse(uri)), expected, uri); + for (const [uri, expected] of bad) + assert.equal( + errorClass(() => parse(uri)), + expected, + uri, + ); const base = { kind: "content" as const, resolverHint: "local", namespace: "main" }; assert.equal( @@ -386,6 +396,9 @@ test("malformed corpus and negative content cases reject with the reference clas errorClass(() => formatContent({ ...base, profile: "unknown-profile", digest: new Uint8Array(32) })), "unsupported_hash_profile", ); - assert.equal(errorClass(() => resolveContext("local", "other")), "resolver_context_mismatch"); + assert.equal( + errorClass(() => resolveContext("local", "other")), + "resolver_context_mismatch", + ); assert.equal(resolveContext("local", "local"), "local"); }); diff --git a/pkgs/id/hosted-worker/test/provisioning-surface.test.ts b/pkgs/id/hosted-worker/test/provisioning-surface.test.ts index aa55b140f0..91358134e6 100644 --- a/pkgs/id/hosted-worker/test/provisioning-surface.test.ts +++ b/pkgs/id/hosted-worker/test/provisioning-surface.test.ts @@ -176,7 +176,10 @@ test("provisionAndValidate refuses when the bucket actually resides elsewhere, h // The bucket already exists in "us"; the eu create 409s, and the // read-back — not the create or the declared field — decides. fake.buckets.set("user-blobs-eu", "us"); - assert.equal(await refusalCode(() => provisionAndValidate(fake, EU_CONFIG, EU_CANARY)), "bucket_jurisdiction_mismatch"); + assert.equal( + await refusalCode(() => provisionAndValidate(fake, EU_CONFIG, EU_CANARY)), + "bucket_jurisdiction_mismatch", + ); }); test("provisionAndValidate refuses on the canary's unavailable jurisdiction (explicit US diagnostic)", async () => { diff --git a/pkgs/id/hosted-worker/test/provisioning.test.ts b/pkgs/id/hosted-worker/test/provisioning.test.ts index 7c9f1ccd44..6da58279f3 100644 --- a/pkgs/id/hosted-worker/test/provisioning.test.ts +++ b/pkgs/id/hosted-worker/test/provisioning.test.ts @@ -1,11 +1,7 @@ import { test } from "node:test"; import assert from "node:assert/strict"; import { FailClosed } from "../src/routing.ts"; -import { - validateEnablement, - type AccountEvidence, - type EnablementConfig, -} from "../src/provisioning.ts"; +import { validateEnablement, type AccountEvidence, type EnablementConfig } from "../src/provisioning.ts"; // Configuration tests for the #3403 provisioning gate. Every refusal // case is one of the acceptance failure modes: production must not @@ -27,11 +23,7 @@ const EU_CONFIG: EnablementConfig = { bucket: { binding: "BLOBS_EU", bucketName: "user-blobs-eu", declaredJurisdiction: "eu" }, }; -function evidence( - jurisdiction: "us" | "eu", - bucketName: string, - actualJurisdiction: string | null, -): AccountEvidence { +function evidence(jurisdiction: "us" | "eu", bucketName: string, actualJurisdiction: string | null): AccountEvidence { return { jurisdictions: { [jurisdiction]: { durableObjects: "supported", runtimeTypes: "supported" }, @@ -71,7 +63,10 @@ test("verified eu configuration yields the exact enablement plan", () => { test("missing jurisdiction fails closed (no silent policy default)", () => { const { jurisdiction: _drop, ...noJurisdiction } = US_CONFIG; - assert.equal(refusalCode(() => validateEnablement(noJurisdiction, US_EVIDENCE)), "missing_jurisdiction"); + assert.equal( + refusalCode(() => validateEnablement(noJurisdiction, US_EVIDENCE)), + "missing_jurisdiction", + ); assert.equal( refusalCode(() => validateEnablement({ ...US_CONFIG, jurisdiction: "" }, US_EVIDENCE)), "missing_jurisdiction", @@ -91,12 +86,18 @@ test("no unrestricted fallback: restricted namespace must be required", () => { "unrestricted_fallback_forbidden", ); const { restrictedNamespace: _drop, ...noRestriction } = US_CONFIG; - assert.equal(refusalCode(() => validateEnablement(noRestriction, US_EVIDENCE)), "unrestricted_fallback_forbidden"); + assert.equal( + refusalCode(() => validateEnablement(noRestriction, US_EVIDENCE)), + "unrestricted_fallback_forbidden", + ); }); test("jurisdiction with no deployed-account evidence fails closed as unverified", () => { const empty: AccountEvidence = { jurisdictions: {}, buckets: US_EVIDENCE.buckets }; - assert.equal(refusalCode(() => validateEnablement(US_CONFIG, empty)), "jurisdiction_unverified"); + assert.equal( + refusalCode(() => validateEnablement(US_CONFIG, empty)), + "jurisdiction_unverified", + ); }); test("unavailable US jurisdiction fails closed with an explicit diagnostic", () => { @@ -104,7 +105,10 @@ test("unavailable US jurisdiction fails closed with an explicit diagnostic", () jurisdictions: { us: { durableObjects: "unavailable", runtimeTypes: "supported" } }, buckets: US_EVIDENCE.buckets, }; - assert.equal(refusalCode(() => validateEnablement(US_CONFIG, usUnavailable)), "jurisdiction_unavailable"); + assert.equal( + refusalCode(() => validateEnablement(US_CONFIG, usUnavailable)), + "jurisdiction_unavailable", + ); }); test("unverified restricted-namespace support fails closed", () => { @@ -112,7 +116,10 @@ test("unverified restricted-namespace support fails closed", () => { jurisdictions: { us: { durableObjects: "unverified", runtimeTypes: "supported" } }, buckets: US_EVIDENCE.buckets, }; - assert.equal(refusalCode(() => validateEnablement(US_CONFIG, unverified)), "jurisdiction_unverified"); + assert.equal( + refusalCode(() => validateEnablement(US_CONFIG, unverified)), + "jurisdiction_unverified", + ); }); test("unsupported runtime/types fail closed", () => { @@ -120,7 +127,10 @@ test("unsupported runtime/types fail closed", () => { jurisdictions: { us: { durableObjects: "supported", runtimeTypes: "unavailable" } }, buckets: US_EVIDENCE.buckets, }; - assert.equal(refusalCode(() => validateEnablement(US_CONFIG, unsupported)), "unsupported_runtime_types"); + assert.equal( + refusalCode(() => validateEnablement(US_CONFIG, unsupported)), + "unsupported_runtime_types", + ); }); test("unverified runtime/types fail closed", () => { @@ -128,17 +138,26 @@ test("unverified runtime/types fail closed", () => { jurisdictions: { us: { durableObjects: "supported", runtimeTypes: "unverified" } }, buckets: US_EVIDENCE.buckets, }; - assert.equal(refusalCode(() => validateEnablement(US_CONFIG, unverified)), "runtime_types_unverified"); + assert.equal( + refusalCode(() => validateEnablement(US_CONFIG, unverified)), + "runtime_types_unverified", + ); }); test("missing Durable Object binding fails closed", () => { const { durableObjectBinding: _drop, ...noBinding } = US_CONFIG; - assert.equal(refusalCode(() => validateEnablement(noBinding, US_EVIDENCE)), "missing_do_binding"); + assert.equal( + refusalCode(() => validateEnablement(noBinding, US_EVIDENCE)), + "missing_do_binding", + ); }); test("missing bucket fails closed", () => { const { bucket: _drop, ...noBucket } = US_CONFIG; - assert.equal(refusalCode(() => validateEnablement(noBucket, US_EVIDENCE)), "bucket_missing"); + assert.equal( + refusalCode(() => validateEnablement(noBucket, US_EVIDENCE)), + "bucket_missing", + ); }); test("bucket whose declared jurisdiction disagrees with the configuration fails closed", () => { @@ -146,12 +165,18 @@ test("bucket whose declared jurisdiction disagrees with the configuration fails ...US_CONFIG, bucket: { binding: "BLOBS_EU", bucketName: "user-blobs-eu", declaredJurisdiction: "eu" }, }; - assert.equal(refusalCode(() => validateEnablement(config, US_EVIDENCE)), "bucket_jurisdiction_mismatch"); + assert.equal( + refusalCode(() => validateEnablement(config, US_EVIDENCE)), + "bucket_jurisdiction_mismatch", + ); }); test("bucket with no R2 API read-back fails closed as unverified", () => { const noReadback: AccountEvidence = { jurisdictions: US_EVIDENCE.jurisdictions, buckets: [] }; - assert.equal(refusalCode(() => validateEnablement(US_CONFIG, noReadback)), "bucket_unverified"); + assert.equal( + refusalCode(() => validateEnablement(US_CONFIG, noReadback)), + "bucket_unverified", + ); }); test("bucket whose API metadata cannot be read fails closed as unverified", () => { @@ -174,5 +199,8 @@ test("a declared binding jurisdiction that agrees is still not verification (#22 // The config claims "us" everywhere, but there is no API read-back // for the bucket: the declared field must not substitute for it. const claimsOnly: AccountEvidence = { jurisdictions: US_EVIDENCE.jurisdictions, buckets: [] }; - assert.equal(refusalCode(() => validateEnablement(US_CONFIG, claimsOnly)), "bucket_unverified"); + assert.equal( + refusalCode(() => validateEnablement(US_CONFIG, claimsOnly)), + "bucket_unverified", + ); }); diff --git a/pkgs/id/hosted-worker/test/routing.test.ts b/pkgs/id/hosted-worker/test/routing.test.ts index f9ad07a77d..0561ca6920 100644 --- a/pkgs/id/hosted-worker/test/routing.test.ts +++ b/pkgs/id/hosted-worker/test/routing.test.ts @@ -41,11 +41,12 @@ test("hosted account metadata requires an explicit supported jurisdiction", () = test("hosted account creation fails closed before metadata exists for absent or invalid jurisdiction", () => { for (const jurisdiction of [null, "", "apac"]) { assert.throws( - () => createHostedAccountRecord({ - subjectKey: "provider-subject-hash", - bindingId: BINDING, - jurisdiction, - }), + () => + createHostedAccountRecord({ + subjectKey: "provider-subject-hash", + bindingId: BINDING, + jurisdiction, + }), (error: unknown) => error instanceof FailClosed, ); } @@ -57,7 +58,8 @@ test("hosted account metadata rejects invalid identity inputs", () => { (error: unknown) => error instanceof FailClosed, ); assert.throws( - () => createHostedAccountRecord({ subjectKey: "provider-subject-hash", bindingId: "google:sub", jurisdiction: "us" }), + () => + createHostedAccountRecord({ subjectKey: "provider-subject-hash", bindingId: "google:sub", jurisdiction: "us" }), (error: unknown) => error instanceof FailClosed, ); }); diff --git a/pkgs/id/nix-common.nix b/pkgs/id/nix-common.nix index 7e118d8d0d..38bc8d8063 100644 --- a/pkgs/id/nix-common.nix +++ b/pkgs/id/nix-common.nix @@ -62,7 +62,7 @@ let version = "1.4.5"; src = pkgs.fetchzip { url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.5/${zip.file}"; - hash = zip.hash; + inherit (zip) hash; }; installPhase = '' runHook preInstall diff --git a/pkgs/id/src/currency/conversion.rs b/pkgs/id/src/currency/conversion.rs index 2f4268ca9f..ae65d51240 100644 --- a/pkgs/id/src/currency/conversion.rs +++ b/pkgs/id/src/currency/conversion.rs @@ -169,12 +169,7 @@ pub trait ConversionControl { /// The LP tier `issuer` holds for conversions from /// `source_ledger` to `dest_ledger`, or `None` when the /// issuer is not an eligible LP for the pair. - fn lp_tier( - &self, - issuer: &IssuerId, - source_ledger: &str, - dest_ledger: &str, - ) -> Option; + fn lp_tier(&self, issuer: &IssuerId, source_ledger: &str, dest_ledger: &str) -> Option; /// The binding record for `issuer`'s liquidity account on /// `ledger`, or `None` when no account is bound. @@ -218,18 +213,9 @@ impl FixedConversionControl { } impl ConversionControl for FixedConversionControl { - fn lp_tier( - &self, - issuer: &IssuerId, - source_ledger: &str, - dest_ledger: &str, - ) -> Option { + fn lp_tier(&self, issuer: &IssuerId, source_ledger: &str, dest_ledger: &str) -> Option { self.tiers - .get(&( - *issuer, - source_ledger.to_owned(), - dest_ledger.to_owned(), - )) + .get(&(*issuer, source_ledger.to_owned(), dest_ledger.to_owned())) .copied() } @@ -412,7 +398,9 @@ pub enum FailedPreSubmit { /// re-issued since the quote was issued — the live fold is /// a different version, or a different event, than the one /// the quote pins, so the quote no longer binds. - #[error("quote pins authorisation version {quoted_version}, but version {live_version} is live")] + #[error( + "quote pins authorisation version {quoted_version}, but version {live_version} is live" + )] QuoteStale { /// The version the quote was issued against. quoted_version: u64, @@ -879,8 +867,7 @@ impl ConversionVerifier { quote_expires_at: quote.quote_expires_at, }); } - if quote.authorisation_id != submission.authorisation_id || quote.x != submission.amount - { + if quote.authorisation_id != submission.authorisation_id || quote.x != submission.amount { return Err(FailedPreSubmit::QuoteMismatch); } let folded = self.verify_folded(control, submission)?; @@ -1086,10 +1073,7 @@ mod tests { ); for ledger_id in [SOURCE_LEDGER_ID, DEST_LEDGER_ID] { assert!( - ledger - .try_accounts_on_ledger(ledger_id) - .unwrap() - .is_empty(), + ledger.try_accounts_on_ledger(ledger_id).unwrap().is_empty(), "zero TigerBeetle account writes" ); assert!( @@ -1323,8 +1307,7 @@ mod tests { // ledger writes. The authorisation names a single // counterparty who is not the caller. let mut auth = authorisation(); - auth.authorised_callers = - AuthorisedCallers::Single(super::super::issuer_id(&other_key())); + auth.authorised_callers = AuthorisedCallers::Single(super::super::issuer_id(&other_key())); let mut submission = valid_submission(); submission.authorisations = vec![presented_auth(&auth)]; assert_pre_submit( @@ -1386,14 +1369,7 @@ mod tests { let mut submission = valid_submission(); let v1 = presented_auth(&authorisation()); let v2_event = { - let event = sign_authorisation( - &lp_key(), - 1, - Some(v1.event.id), - &v2, - vec![], - ) - .unwrap(); + let event = sign_authorisation(&lp_key(), 1, Some(v1.event.id), &v2, vec![]).unwrap(); PresentedObject { event, body: v2.body().unwrap(), @@ -1448,10 +1424,7 @@ mod tests { ); for ledger_id in [SOURCE_LEDGER_ID, DEST_LEDGER_ID] { assert!( - ledger - .try_accounts_on_ledger(ledger_id) - .unwrap() - .is_empty(), + ledger.try_accounts_on_ledger(ledger_id).unwrap().is_empty(), "zero TigerBeetle account writes" ); assert!( diff --git a/pkgs/id/src/currency/gateway_service.rs b/pkgs/id/src/currency/gateway_service.rs index de2d217c42..8e207ecf40 100644 --- a/pkgs/id/src/currency/gateway_service.rs +++ b/pkgs/id/src/currency/gateway_service.rs @@ -358,7 +358,10 @@ impl GatewayIntent { currency_id: self.currency_id.clone(), currency: self.currency_key.clone(), ledger_id: self.ledger_id, - transfer_id: self.transfer.as_ref().map(|t| hex_encode(&t.id.to_be_bytes())), + transfer_id: self + .transfer + .as_ref() + .map(|t| hex_encode(&t.id.to_be_bytes())), graph_object: self.graph_object.clone(), } } @@ -673,8 +676,7 @@ fn write_atomic(path: &std::path::Path, bytes: &[u8]) -> Result<(), String> { fs::File::open(&tmp) .and_then(|file| file.sync_all()) .map_err(|error| format!("fsync {}: {error}", tmp.display()))?; - fs::rename(&tmp, path) - .map_err(|error| format!("rename to {}: {error}", path.display()))?; + fs::rename(&tmp, path).map_err(|error| format!("rename to {}: {error}", path.display()))?; if let Some(parent) = path.parent() { fs::File::open(parent) .and_then(|dir| dir.sync_all()) @@ -841,8 +843,7 @@ impl GatewayService { } } "grant_minter" => { - if let (Some(currency_id), Some(minter)) = - (&intent.currency_id, &intent.minter) + if let (Some(currency_id), Some(minter)) = (&intent.currency_id, &intent.minter) { minters .entry(currency_id.clone()) @@ -864,8 +865,7 @@ impl GatewayService { registrations.sort_by_key(|intent| intent.ledger_id.unwrap_or(u32::MAX)); let mut registry = Registry::new(InMemoryStore::new()); for intent in registrations { - let (Some(currency_id), Some(params)) = - (&intent.currency_id, &intent.registration) + let (Some(currency_id), Some(params)) = (&intent.currency_id, &intent.registration) else { continue; }; @@ -1001,10 +1001,7 @@ impl GatewayService { /// The registry record for a currency key, once its /// definition is recorded. #[must_use] - pub fn registry_record( - &self, - key: &[u8; 32], - ) -> Option { + pub fn registry_record(&self, key: &[u8; 32]) -> Option { self.currency_ids .get(key) .and_then(|currency_id| self.registry.resolve(currency_id).cloned()) @@ -1203,7 +1200,10 @@ impl GatewayService { /// transfer under the same ID. Present but different — the /// ID was reused by another writer; that is a conflict to /// surface, never to overwrite. - fn recover_recorded(&mut self, mut intent: GatewayIntent) -> Result { + fn recover_recorded( + &mut self, + mut intent: GatewayIntent, + ) -> Result { let transfer = intent.transfer.clone().ok_or_else(|| { ServiceError::IntentStore(format!( "recorded intent {:032x} carries no transfer", @@ -1211,9 +1211,7 @@ impl GatewayService { )) })?; match self.backend.try_lookup_transfer(transfer.id) { - Ok(Some(found)) if found == transfer => { - self.finalize_posted(&mut intent, true) - } + Ok(Some(found)) if found == transfer => self.finalize_posted(&mut intent, true), Ok(Some(_)) => Err(ServiceError::IntentConflict(format!( "transfer {} exists with contents other than intent {:032x} recorded", transfer.id, intent.idempotency @@ -1249,9 +1247,7 @@ impl GatewayService { fresh: bool, ) -> Result { if intent.op == "issue" && fresh { - if let (Some(currency_id), Some(transfer)) = - (&intent.currency_id, &intent.transfer) - { + if let (Some(currency_id), Some(transfer)) = (&intent.currency_id, &intent.transfer) { *self.issued.entry(currency_id.clone()).or_default() += transfer.amount; } } @@ -1300,7 +1296,12 @@ impl GatewayService { let mut cluster = BackendCluster::new(&mut self.backend); Factory::ensure_currency_accounts(&mut cluster, &record, &authorized.account, &[])? }; - self.index_account(&record, accounts.issuer, &record.issuer_id, AccountKind::Issuer)?; + self.index_account( + &record, + accounts.issuer, + &record.issuer_id, + AccountKind::Issuer, + )?; self.index_account( &record, accounts.fee, @@ -1710,36 +1711,38 @@ impl GatewayService { op: intent.op.clone(), }); } - IntentState::Posted => { - match self.backend.try_lookup_transfer(transfer.id) { - Ok(Some(found)) if found == *transfer => {} - Ok(Some(_)) => { - report.findings.push(IntentFinding::PostedIntentTransferMismatch { + IntentState::Posted => match self.backend.try_lookup_transfer(transfer.id) { + Ok(Some(found)) if found == *transfer => {} + Ok(Some(_)) => { + report + .findings + .push(IntentFinding::PostedIntentTransferMismatch { idempotency: intent.idempotency, transfer_id: transfer.id, }); - } - Ok(None) => { - report.findings.push(IntentFinding::PostedIntentMissingTransfer { + } + Ok(None) => { + report + .findings + .push(IntentFinding::PostedIntentMissingTransfer { idempotency: intent.idempotency, transfer_id: transfer.id, }); - } - Err(error) => return Err(ServiceError::Backend(error.to_string())), } - } - IntentState::Failed => { - match self.backend.try_lookup_transfer(transfer.id) { - Ok(Some(_)) => { - report.findings.push(IntentFinding::FailedIntentTransferPresent { + Err(error) => return Err(ServiceError::Backend(error.to_string())), + }, + IntentState::Failed => match self.backend.try_lookup_transfer(transfer.id) { + Ok(Some(_)) => { + report + .findings + .push(IntentFinding::FailedIntentTransferPresent { idempotency: intent.idempotency, transfer_id: transfer.id, }); - } - Ok(None) => {} - Err(error) => return Err(ServiceError::Backend(error.to_string())), } - } + Ok(None) => {} + Err(error) => return Err(ServiceError::Backend(error.to_string())), + }, } } // The orphan direction: ledger transfers carrying a @@ -1766,11 +1769,13 @@ impl GatewayService { && self.graph.resolve(transfer.user_data_128).is_some() && !intent_transfer_ids.contains(&transfer.id) { - report.findings.push(IntentFinding::LedgerTransferWithoutIntent { - transfer_id: transfer.id, - ledger_id: ledger, - user_data_128: transfer.user_data_128, - }); + report + .findings + .push(IntentFinding::LedgerTransferWithoutIntent { + transfer_id: transfer.id, + ledger_id: ledger, + user_data_128: transfer.user_data_128, + }); } } } @@ -1792,9 +1797,9 @@ impl GatewayService { mod tests { use super::*; use crate::currency::gateway::{ - Balance as GwBalance, CurrencyRequest, Freeze as GwFreeze, - GrantMinter as GwGrantMinter, Issue as GwIssue, RegisterCurrency as GwRegister, - Sunset as GwSunset, Transfer as GwTransfer, sign_request, + Balance as GwBalance, CurrencyRequest, Freeze as GwFreeze, GrantMinter as GwGrantMinter, + Issue as GwIssue, RegisterCurrency as GwRegister, Sunset as GwSunset, + Transfer as GwTransfer, sign_request, }; use crate::currency::gateway_poc::verify_receipt; use crate::currency::graph::{SupplyCap, sign_definition, sign_issue, sign_transfer}; @@ -2139,7 +2144,12 @@ mod tests { // (granted in the previous life) presenting the same // class of object issues successfully. for (device_key, account, is_minter, client_request_id) in [ - (fx.bob.device_key.clone(), fx.bob.account.clone(), false, 9_u128), + ( + fx.bob.device_key.clone(), + fx.bob.account.clone(), + false, + 9_u128, + ), ( fx.alice.device_key.clone(), fx.alice.account.clone(), @@ -2259,10 +2269,18 @@ mod tests { }; let idem = idempotency_id(&fx.alice.account, &request); let record = fx.svc.registry_record(&key).expect("record"); - let from_spec = - id_currency_registry::account_spec(record.ledger_id, AccountKind::Holder, &fx.alice.account, ""); - let to_spec = - id_currency_registry::account_spec(record.ledger_id, AccountKind::Holder, &fx.bob.account, ""); + let from_spec = id_currency_registry::account_spec( + record.ledger_id, + AccountKind::Holder, + &fx.alice.account, + "", + ); + let to_spec = id_currency_registry::account_spec( + record.ledger_id, + AccountKind::Holder, + &fx.bob.account, + "", + ); let stamp = GraphLog::stamp_of(&event); let intent = GatewayIntent { idempotency: idem, @@ -2289,7 +2307,9 @@ mod tests { receipt: None, failure: None, }; - store_handle(&dir).put(&intent).expect("recorded intent writes"); + store_handle(&dir) + .put(&intent) + .expect("recorded intent writes"); // The retry resubmits the stored transfer under the same // ID and finalizes. @@ -2300,7 +2320,10 @@ mod tests { assert_eq!(fx.svc.holder_balance(&key, &fx.alice.account), Some(70)); assert_eq!(fx.svc.holder_balance(&key, &fx.bob.account), Some(30)); let stored = store_handle(&dir).all().expect("intents read"); - let intent = stored.iter().find(|i| i.idempotency == idem).expect("intent"); + let intent = stored + .iter() + .find(|i| i.idempotency == idem) + .expect("intent"); assert_eq!(intent.state, IntentState::Posted); let _ = fs::remove_dir_all(&dir); } @@ -2385,9 +2408,16 @@ mod tests { let mut store = store_handle(&dir); let all = store.all().expect("intents read"); - let issue_intent = all.iter().find(|i| i.op == "issue").expect("issue intent").clone(); - let transfer_intent = - all.iter().find(|i| i.op == "transfer").expect("transfer intent").clone(); + let issue_intent = all + .iter() + .find(|i| i.op == "issue") + .expect("issue intent") + .clone(); + let transfer_intent = all + .iter() + .find(|i| i.op == "transfer") + .expect("transfer intent") + .clone(); // (a) The stored transfer disagrees with the ledger's. let mut tampered = transfer_intent.clone(); diff --git a/pkgs/id/src/lib.rs b/pkgs/id/src/lib.rs index 9345bb63f2..2bcffb83a4 100644 --- a/pkgs/id/src/lib.rs +++ b/pkgs/id/src/lib.rs @@ -255,15 +255,15 @@ pub mod groups; pub mod hosted_binding; pub mod hosted_export; pub mod hosted_ingest; -pub use id_events::idset; -pub use id_worlds::input_framing; pub use id_directory::invite; pub use id_directory::invites; +pub use id_events::idset; pub use id_events::local_claims; pub use id_events::local_events; pub use id_store::issuer_rotation; pub use id_sync::chained_message; pub use id_sync::log_sync; +pub use id_worlds::input_framing; pub mod serve_proxy; pub use id_core::membership; pub use id_core::migration_control; diff --git a/pkgs/id/tests/bridge_fixtures.rs b/pkgs/id/tests/bridge_fixtures.rs index b1bcff1fb7..463829d160 100644 --- a/pkgs/id/tests/bridge_fixtures.rs +++ b/pkgs/id/tests/bridge_fixtures.rs @@ -20,9 +20,7 @@ mod common; use common::ingest::MemStorage; use id::chain::{ChainExt, sign}; use id::event_store::{EventStore, Ingest}; -use id::session_checkpoint::{ - MacScope, SegmentCheckpoint, SessionCheckpoint, SessionHeader, -}; +use id::session_checkpoint::{MacScope, SegmentCheckpoint, SessionCheckpoint, SessionHeader}; use id::waiting::WaitingLimits; use p2panda_core::{Hash, SigningKey}; @@ -46,21 +44,58 @@ fn unhex(text: &str) -> Vec { #[test] fn blake3_vectors_agree_with_the_hosted_bridge() { let cases: [(usize, &str); 11] = [ - (0, "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262"), - (1, "2d3adedff11b61f14c886e35afa036736dcd87a74d27b5c1510225d0f592e213"), - (3, "e1be4d7a8ab5560aa4199eea339849ba8e293d55ca0a81006726d184519e647f"), - (64, "4eed7141ea4a5cd4b788606bd23f46e212af9cacebacdc7d1f4c6dc7f2511b98"), - (65, "de1e5fa0be70df6d2be8fffd0e99ceaa8eb6e8c93a63f2d8d1c30ecb6b263dee"), - (100, "8e2eb1bba3040b8f611a1240a0e111c74b45cfc9caed10b95f6372db1c40b8b5"), - (1023, "10108970eeda3eb932baac1428c7a2163b0e924c9a9e25b35bba72b28f70bd11"), - (1024, "42214739f095a406f3fc83deb889744ac00df831c10daa55189b5d121c855af7"), - (1025, "d00278ae47eb27b34faecf67b4fe263f82d5412916c1ffd97c8cb7fb814b8444"), - (2048, "e776b6028c7cd22a4d0ba182a8bf62205d2ef576467e838ed6f2529b85fba24a"), - (102400, "bc3e3d41a1146b069abffad3c0d44860cf664390afce4d9661f7902e7943e085"), + ( + 0, + "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262", + ), + ( + 1, + "2d3adedff11b61f14c886e35afa036736dcd87a74d27b5c1510225d0f592e213", + ), + ( + 3, + "e1be4d7a8ab5560aa4199eea339849ba8e293d55ca0a81006726d184519e647f", + ), + ( + 64, + "4eed7141ea4a5cd4b788606bd23f46e212af9cacebacdc7d1f4c6dc7f2511b98", + ), + ( + 65, + "de1e5fa0be70df6d2be8fffd0e99ceaa8eb6e8c93a63f2d8d1c30ecb6b263dee", + ), + ( + 100, + "8e2eb1bba3040b8f611a1240a0e111c74b45cfc9caed10b95f6372db1c40b8b5", + ), + ( + 1023, + "10108970eeda3eb932baac1428c7a2163b0e924c9a9e25b35bba72b28f70bd11", + ), + ( + 1024, + "42214739f095a406f3fc83deb889744ac00df831c10daa55189b5d121c855af7", + ), + ( + 1025, + "d00278ae47eb27b34faecf67b4fe263f82d5412916c1ffd97c8cb7fb814b8444", + ), + ( + 2048, + "e776b6028c7cd22a4d0ba182a8bf62205d2ef576467e838ed6f2529b85fba24a", + ), + ( + 102400, + "bc3e3d41a1146b069abffad3c0d44860cf664390afce4d9661f7902e7943e085", + ), ]; for (len, expected) in cases { let input: Vec = (0..len).map(|i| (i % 251) as u8).collect(); - assert_eq!(hex(Hash::digest(&input).as_bytes()), expected, "length {len}"); + assert_eq!( + hex(Hash::digest(&input).as_bytes()), + expected, + "length {len}" + ); } } @@ -82,9 +117,8 @@ fn ts_signed_events_decode_and_ingest_natively() { let decoded_b = id::chain::decode(&b).expect("TS event B decodes natively"); assert_eq!(hex(decoded_b.id.as_bytes()), TS_EVENT_B_ID); - let mut store = - EventStore::open_with(&MemStorage::default(), WaitingLimits::default(), NOW_MS) - .expect("open store"); + let mut store = EventStore::open_with(&MemStorage::default(), WaitingLimits::default(), NOW_MS) + .expect("open store"); let outcomes = store.ingest_batch(&[a, b], NOW_MS).expect("ingest"); assert_eq!(outcomes.len(), 2); assert!( @@ -154,14 +188,18 @@ fn rust_signed_events_for_the_hosted_bridge() { println!("R2 id={} bytes={}", hex(r2.id.as_bytes()), hex(&r2.bytes)); println!("R3 id={} bytes={}", hex(r3.id.as_bytes()), hex(&r3.bytes)); - let mut store = - EventStore::open_with(&MemStorage::default(), WaitingLimits::default(), NOW_MS) - .expect("open store"); + let mut store = EventStore::open_with(&MemStorage::default(), WaitingLimits::default(), NOW_MS) + .expect("open store"); let outcomes = store - .ingest_batch(&[r1.bytes.clone(), r2.bytes.clone(), r3.bytes.clone()], NOW_MS) + .ingest_batch( + &[r1.bytes.clone(), r2.bytes.clone(), r3.bytes.clone()], + NOW_MS, + ) .expect("ingest"); assert!( - outcomes.iter().all(|o| matches!(o, Ingest::Accepted { .. })), + outcomes + .iter() + .all(|o| matches!(o, Ingest::Accepted { .. })), "all three accepted: {outcomes:?}" ); } diff --git a/pkgs/id/tests/config_invariants.rs b/pkgs/id/tests/config_invariants.rs index cbec9c0751..fbd6480299 100644 --- a/pkgs/id/tests/config_invariants.rs +++ b/pkgs/id/tests/config_invariants.rs @@ -258,18 +258,18 @@ fn extension_namespace_keys_match_the_schema_rule() { // canonical schema pattern ^[^./\s]+([./][^./\s]+)+$ rejects, not only // keys with no separator at all. let malformed = [ - ".", // separator only - "/", // separator only - "a..b", // empty segment - "a//b", // empty segment - "a./b", // empty segment across mixed separators - ".a.b", // leading separator - "a.b.", // trailing separator - "a b.c", // whitespace inside a segment - "a/b c", // whitespace inside a later segment + ".", // separator only + "/", // separator only + "a..b", // empty segment + "a//b", // empty segment + "a./b", // empty segment across mixed separators + ".a.b", // leading separator + "a.b.", // trailing separator + "a b.c", // whitespace inside a segment + "a/b c", // whitespace inside a later segment "a\tb.c", // tab whitespace - "a.b ", // trailing whitespace - " example.c", // leading whitespace + "a.b ", // trailing whitespace + " example.c", // leading whitespace ]; for key in malformed { let mut doc = valid_doc(); @@ -286,8 +286,8 @@ fn extension_namespace_keys_match_the_schema_rule() { for key in ["example.com/experiment", "a.b", "a/b", "a.b/c.d"] { let mut doc = valid_doc(); doc["extensions"] = json!({ key: { "enabled": true } }); - let resolved = load(&doc) - .unwrap_or_else(|err| panic!("key {key:?} must resolve, got {err:?}")); + let resolved = + load(&doc).unwrap_or_else(|err| panic!("key {key:?} must resolve, got {err:?}")); assert_eq!( resolved.extensions[key], json!({ "enabled": true }), @@ -305,12 +305,21 @@ fn oracle_resolution_is_deterministic() { let overrides = shuffled["overrides"].as_array().expect("overrides").clone(); shuffled["overrides"] = Value::Array(overrides.into_iter().rev().collect()); - let a = load(&valid_doc()).expect("valid").canonical_json().expect("json"); - let b = load(&shuffled).expect("valid").canonical_json().expect("json"); + let a = load(&valid_doc()) + .expect("valid") + .canonical_json() + .expect("json"); + let b = load(&shuffled) + .expect("valid") + .canonical_json() + .expect("json"); assert_eq!(a, b, "resolution must be authoring-order independent"); // Resolving the same document twice is byte-identical. - let again = load(&valid_doc()).expect("valid").canonical_json().expect("json"); + let again = load(&valid_doc()) + .expect("valid") + .canonical_json() + .expect("json"); assert_eq!(a, again); } diff --git a/pkgs/id/tests/first_app_poc.rs b/pkgs/id/tests/first_app_poc.rs index 10afe81f52..657ee867c8 100644 --- a/pkgs/id/tests/first_app_poc.rs +++ b/pkgs/id/tests/first_app_poc.rs @@ -31,16 +31,16 @@ use std::collections::{BTreeMap, BTreeSet}; use chrono::{NaiveDate, TimeZone}; use chrono_tz::Tz; use id::{ - chain::{sign, ChainExt, Event}, + chain::{ChainExt, Event, sign}, didit::{ - decode_record_body, encode_entity_body, encode_expectation_body, encode_record_body, - evaluate, ActiveWindow, Entity, Expectation, HoursSpan, Period, Record, VerdictState, - Window as DiditWindow, ENTITY_KIND, EXPECTATION_KIND, RECORD_KIND, + ActiveWindow, ENTITY_KIND, EXPECTATION_KIND, Entity, Expectation, HoursSpan, Period, + RECORD_KIND, Record, VerdictState, Window as DiditWindow, decode_record_body, + encode_entity_body, encode_expectation_body, encode_record_body, evaluate, }, - documents::{DocumentRef, DOCUMENT_KIND}, + documents::{DOCUMENT_KIND, DocumentRef}, event_store::{EventStore, Ingest}, - idset::{view::expand_set, Entry, Excludes, WriterSet}, - tag_claims::{TagOp, SET_KIND}, + idset::{Entry, Excludes, WriterSet, view::expand_set}, + tag_claims::{SET_KIND, TagOp}, waiting::WaitingLimits, }; use p2panda_core::{Hash, SeqNum, SigningKey}; @@ -292,8 +292,8 @@ fn walk_record(id_byte: u8, at: i64) -> Record { } #[test] -fn test_first_app_poc_two_identities_exchange_and_a_third_partys_claims_are_excluded_but_retrievable( -) { +fn test_first_app_poc_two_identities_exchange_and_a_third_partys_claims_are_excluded_but_retrievable() + { let mut a = Writer::new(1); let mut b = Writer::new(2); let mut c = Writer::new(3); diff --git a/pkgs/id/tests/fixtures/port-v1.json b/pkgs/id/tests/fixtures/port-v1.json index 1490514142..4971e7527a 100644 --- a/pkgs/id/tests/fixtures/port-v1.json +++ b/pkgs/id/tests/fixtures/port-v1.json @@ -1 +1,148 @@ -{"capability_reports":[{"atomic_scope":"whole-database","commit_ambiguity":"definitive","conditional_atomic_scope":null,"contract_version":2,"guarantees":{"atomic_commit":true,"atomic_outbox":false,"durable":true,"exactly_once":false,"ordered":false},"kind":"record-store","limits":{"max_batch_records":null,"max_message_bytes":null,"max_record_bytes":null},"optional_capabilities":["store.scan","store.txn.multi-record","store.txn.whole-database"],"required_capabilities":[],"resource_id":"redb","retry_rule":"retry-as-new-operation","scope":"local","status":"active"},{"atomic_scope":"single-namespace","commit_ambiguity":"unknown-until-readback","conditional_atomic_scope":{"condition":"explicit interactive transaction on a single session against a single database","scope":"whole-database"},"contract_version":2,"guarantees":{"atomic_commit":true,"atomic_outbox":false,"durable":true,"exactly_once":false,"ordered":false},"kind":"record-store","limits":{"max_batch_records":null,"max_message_bytes":null,"max_record_bytes":null},"optional_capabilities":["store.scan","store.txn.multi-record","store.txn.whole-database"],"required_capabilities":[],"resource_id":"turso-libsql-http","retry_rule":"readback-before-retry","scope":"hosted","status":"active"},{"atomic_scope":"whole-database","commit_ambiguity":"definitive","conditional_atomic_scope":null,"contract_version":2,"guarantees":{"atomic_commit":true,"atomic_outbox":false,"durable":true,"exactly_once":false,"ordered":false},"kind":"record-store","limits":{"max_batch_records":null,"max_message_bytes":null,"max_record_bytes":null},"optional_capabilities":["store.scan","store.txn.multi-record","store.txn.whole-database"],"required_capabilities":[],"resource_id":"indexeddb","retry_rule":"retry-as-new-operation","scope":"browser","status":"active"}],"comment":"Portable record-store conformance vectors (contract version 2). The redb and turso-libsql-http declarations run against the Rust reference suite. The indexeddb declaration runs against the browser request-batch adapter in Chromium. A string expectation is shared; an object maps each resource_id to its expected observation.","contract_version":2,"fixture_version":1,"vectors":[{"expect":"committed","id":"g1","namespace":"groups","op":"put","op_id":"op-001","value":"alpha"},{"expect":"committed","id":"g2","namespace":"groups","op":"put","op_id":"op-002","value":"beta"},{"expect":"value:alpha","id":"g1","namespace":"groups","op":"get"},{"expect":"absent","id":"missing","namespace":"groups","op":"get"},{"expect":"committed","id":"t1","namespace":"tags","op":"put","op_id":"op-003","value":"red"},{"expect":"entries:g1=alpha,g2=beta","namespace":"groups","op":"scan"},{"expect":"entries:t1=red","namespace":"tags","op":"scan"},{"expect":"committed","id":"g2","namespace":"groups","op":"delete","op_id":"op-004"},{"expect":"absent","id":"g2","namespace":"groups","op":"get"},{"expect":"entries:g1=alpha","namespace":"groups","op":"scan"},{"expect":"granted","op":"negotiate","required":["store.scan"]},{"expect":"refused:unsupported-capability","op":"negotiate","required":["transport.signed-receipts"]},{"expect":"granted","op":"negotiate","required":["store.txn.whole-database"]},{"expect":"refused:version-mismatch","op":"negotiate","protocol_version":1,"required":[]},{"expect":{"indexeddb":"committed","redb":"committed","turso-libsql-http":"refused:conditional"},"interactive":false,"op":"commit_batch","op_id":"op-005","writes":[{"id":"g3","namespace":"groups","value":"gamma"},{"id":"t2","namespace":"tags","value":"blue"}]},{"expect":{"indexeddb":"value:blue","redb":"value:blue","turso-libsql-http":"absent"},"id":"t2","namespace":"tags","op":"get"},{"expect":"committed","interactive":true,"op":"commit_batch","op_id":"op-005","writes":[{"id":"g3","namespace":"groups","value":"gamma"},{"id":"t2","namespace":"tags","value":"blue"}]},{"expect":"entries:t1=red,t2=blue","namespace":"tags","op":"scan"},{"expect":{"indexeddb":"reported:committed,resolved:committed","redb":"reported:committed,resolved:committed","turso-libsql-http":"reported:unknown,resolved:committed"},"fault":"drop-response","op":"commit_fault","op_id":"op-006","writes":[{"id":"g4","namespace":"groups","value":"delta"}]},{"expect":"value:delta","id":"g4","namespace":"groups","op":"get"},{"expect":{"indexeddb":"reported:committed,resolved:committed","redb":"reported:committed,resolved:committed","turso-libsql-http":"reported:unknown,resolved:not-committed"},"fault":"drop-request","op":"commit_fault","op_id":"op-007","writes":[{"id":"g5","namespace":"groups","value":"epsilon"}]},{"expect":{"indexeddb":"value:epsilon","redb":"value:epsilon","turso-libsql-http":"absent"},"id":"g5","namespace":"groups","op":"get"},{"expect":"committed","id":"g5","namespace":"groups","op":"put","op_id":"op-007","value":"epsilon"},{"expect":"value:epsilon","id":"g5","namespace":"groups","op":"get"},{"expect":"entries:g1=alpha,g3=gamma,g4=delta,g5=epsilon","namespace":"groups","op":"scan"}]} \ No newline at end of file +{ + "capability_reports": [ + { + "atomic_scope": "whole-database", + "commit_ambiguity": "definitive", + "conditional_atomic_scope": null, + "contract_version": 2, + "guarantees": { + "atomic_commit": true, + "atomic_outbox": false, + "durable": true, + "exactly_once": false, + "ordered": false + }, + "kind": "record-store", + "limits": { "max_batch_records": null, "max_message_bytes": null, "max_record_bytes": null }, + "optional_capabilities": ["store.scan", "store.txn.multi-record", "store.txn.whole-database"], + "required_capabilities": [], + "resource_id": "redb", + "retry_rule": "retry-as-new-operation", + "scope": "local", + "status": "active" + }, + { + "atomic_scope": "single-namespace", + "commit_ambiguity": "unknown-until-readback", + "conditional_atomic_scope": { + "condition": "explicit interactive transaction on a single session against a single database", + "scope": "whole-database" + }, + "contract_version": 2, + "guarantees": { + "atomic_commit": true, + "atomic_outbox": false, + "durable": true, + "exactly_once": false, + "ordered": false + }, + "kind": "record-store", + "limits": { "max_batch_records": null, "max_message_bytes": null, "max_record_bytes": null }, + "optional_capabilities": ["store.scan", "store.txn.multi-record", "store.txn.whole-database"], + "required_capabilities": [], + "resource_id": "turso-libsql-http", + "retry_rule": "readback-before-retry", + "scope": "hosted", + "status": "active" + }, + { + "atomic_scope": "whole-database", + "commit_ambiguity": "definitive", + "conditional_atomic_scope": null, + "contract_version": 2, + "guarantees": { + "atomic_commit": true, + "atomic_outbox": false, + "durable": true, + "exactly_once": false, + "ordered": false + }, + "kind": "record-store", + "limits": { "max_batch_records": null, "max_message_bytes": null, "max_record_bytes": null }, + "optional_capabilities": ["store.scan", "store.txn.multi-record", "store.txn.whole-database"], + "required_capabilities": [], + "resource_id": "indexeddb", + "retry_rule": "retry-as-new-operation", + "scope": "browser", + "status": "active" + } + ], + "comment": "Portable record-store conformance vectors (contract version 2). The redb and turso-libsql-http declarations run against the Rust reference suite. The indexeddb declaration runs against the browser request-batch adapter in Chromium. A string expectation is shared; an object maps each resource_id to its expected observation.", + "contract_version": 2, + "fixture_version": 1, + "vectors": [ + { "expect": "committed", "id": "g1", "namespace": "groups", "op": "put", "op_id": "op-001", "value": "alpha" }, + { "expect": "committed", "id": "g2", "namespace": "groups", "op": "put", "op_id": "op-002", "value": "beta" }, + { "expect": "value:alpha", "id": "g1", "namespace": "groups", "op": "get" }, + { "expect": "absent", "id": "missing", "namespace": "groups", "op": "get" }, + { "expect": "committed", "id": "t1", "namespace": "tags", "op": "put", "op_id": "op-003", "value": "red" }, + { "expect": "entries:g1=alpha,g2=beta", "namespace": "groups", "op": "scan" }, + { "expect": "entries:t1=red", "namespace": "tags", "op": "scan" }, + { "expect": "committed", "id": "g2", "namespace": "groups", "op": "delete", "op_id": "op-004" }, + { "expect": "absent", "id": "g2", "namespace": "groups", "op": "get" }, + { "expect": "entries:g1=alpha", "namespace": "groups", "op": "scan" }, + { "expect": "granted", "op": "negotiate", "required": ["store.scan"] }, + { "expect": "refused:unsupported-capability", "op": "negotiate", "required": ["transport.signed-receipts"] }, + { "expect": "granted", "op": "negotiate", "required": ["store.txn.whole-database"] }, + { "expect": "refused:version-mismatch", "op": "negotiate", "protocol_version": 1, "required": [] }, + { + "expect": { "indexeddb": "committed", "redb": "committed", "turso-libsql-http": "refused:conditional" }, + "interactive": false, + "op": "commit_batch", + "op_id": "op-005", + "writes": [ + { "id": "g3", "namespace": "groups", "value": "gamma" }, + { "id": "t2", "namespace": "tags", "value": "blue" } + ] + }, + { + "expect": { "indexeddb": "value:blue", "redb": "value:blue", "turso-libsql-http": "absent" }, + "id": "t2", + "namespace": "tags", + "op": "get" + }, + { + "expect": "committed", + "interactive": true, + "op": "commit_batch", + "op_id": "op-005", + "writes": [ + { "id": "g3", "namespace": "groups", "value": "gamma" }, + { "id": "t2", "namespace": "tags", "value": "blue" } + ] + }, + { "expect": "entries:t1=red,t2=blue", "namespace": "tags", "op": "scan" }, + { + "expect": { + "indexeddb": "reported:committed,resolved:committed", + "redb": "reported:committed,resolved:committed", + "turso-libsql-http": "reported:unknown,resolved:committed" + }, + "fault": "drop-response", + "op": "commit_fault", + "op_id": "op-006", + "writes": [{ "id": "g4", "namespace": "groups", "value": "delta" }] + }, + { "expect": "value:delta", "id": "g4", "namespace": "groups", "op": "get" }, + { + "expect": { + "indexeddb": "reported:committed,resolved:committed", + "redb": "reported:committed,resolved:committed", + "turso-libsql-http": "reported:unknown,resolved:not-committed" + }, + "fault": "drop-request", + "op": "commit_fault", + "op_id": "op-007", + "writes": [{ "id": "g5", "namespace": "groups", "value": "epsilon" }] + }, + { + "expect": { "indexeddb": "value:epsilon", "redb": "value:epsilon", "turso-libsql-http": "absent" }, + "id": "g5", + "namespace": "groups", + "op": "get" + }, + { "expect": "committed", "id": "g5", "namespace": "groups", "op": "put", "op_id": "op-007", "value": "epsilon" }, + { "expect": "value:epsilon", "id": "g5", "namespace": "groups", "op": "get" }, + { "expect": "entries:g1=alpha,g3=gamma,g4=delta,g5=epsilon", "namespace": "groups", "op": "scan" } + ] +} diff --git a/pkgs/id/tests/store_authority_contract.rs b/pkgs/id/tests/store_authority_contract.rs index 3bae4b7893..2e09d49de7 100644 --- a/pkgs/id/tests/store_authority_contract.rs +++ b/pkgs/id/tests/store_authority_contract.rs @@ -234,11 +234,22 @@ fn identity_profiles_differ_in_facts_not_just_names() { // profiles likewise. Neither pair is interchangeable. let blob = facts("iroh-blob-blake3"); let event = facts("event-payload-blake3"); - assert_eq!(family(&blob.0), family(&event.0), "both profiles are BLAKE3-256"); - assert_ne!(blob, event, "blob and event BLAKE3 commitments differ in input"); + assert_eq!( + family(&blob.0), + family(&event.0), + "both profiles are BLAKE3-256" + ); + assert_ne!( + blob, event, + "blob and event BLAKE3 commitments differ in input" + ); let artifact = facts("artifact-sha256"); let atlas = facts("atlas-content-hash"); - assert_eq!(family(&artifact.0), family(&atlas.0), "both profiles are SHA-256"); + assert_eq!( + family(&artifact.0), + family(&atlas.0), + "both profiles are SHA-256" + ); assert_ne!( artifact, atlas, "artifact SHA-256 over canonical JSON differs from observed Atlas SHA-256 over chunk text" @@ -270,7 +281,10 @@ fn source_evidence_carries_each_identity_mechanism() { &["Hash::digest"], ), ("crates/id-worlds/src/world_store.rs", &["journal.jsonl"]), - ("crates/id-sync/src/artifact.rs", &["signed_bytes", "Sha256"]), + ( + "crates/id-sync/src/artifact.rs", + &["signed_bytes", "Sha256"], + ), ]; for (rel, markers) in cases { let text = std::fs::read_to_string(manifest_dir().join(rel))