diff --git a/pkgs/id/ARCHITECTURE.md b/pkgs/id/ARCHITECTURE.md index 14706c18ec..8e2fff2c5a 100644 --- a/pkgs/id/ARCHITECTURE.md +++ b/pkgs/id/ARCHITECTURE.md @@ -1,10 +1,10 @@ # Architecture -System architecture for the `id` peer-to-peer file sharing CLI. +System architecture for the `id` peer-to-peer platform and Rust facade. ## Overview -`id` is built on [Iroh](https://iroh.computer), a peer-to-peer networking library that provides content-addressed blob storage and document synchronization. The application layers a CLI interface, interactive REPL, and optional web UI on top of Iroh's primitives. +`id` is built on [Iroh](https://iroh.computer). The workspace separates the facade and command application from core, capability/policy, sync, world, directory, web, and other service crates. The facade retains historical `id::` paths by re-exporting the split modules. ``` ┌──────────────────────────────────────────────────────────────────┐ @@ -39,14 +39,15 @@ 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` (root, `src/`) | Public facade and binary | Re-exports the workspace API at historical `id::` paths; command parsing and dispatch are implemented in `id-cli`. | +| `id-core` | Shared core | Depended on by workspace crates. The facade re-exports a selected subset; it also includes `admission_gate`, `migration_control`, `petname`, `world_presentation`, and feature-gated `qr`. See `src/lib.rs` for the authoritative list. | | `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-config` | Internal | The facade lists it as a dev-dependency for invariant tests; it has no production dependent. | | `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. | +| `id-native-shell`, `id-hw-shell` | Internal (app) | Workspace members, not default members; both production-depend on the facade. `id-native-shell` rejects `--help` and unknown flags; it has no `--version` option. | +| `id-render` | Internal compiler library | Rendering-pipeline compiler core: semantic-markup parsing and vocabulary validation, with composition/lowering/emission stages. | +| `id-import-notion` | Internal importer library | Notion importer manifest and inventory primitives, with maintained integration tests. | Standalone examples and benchmarks (`examples/`, `benchmarks`) are not public API. Vendored crates (`vendor/p2panda-sync`, `vendor/p2panda-encryption`) @@ -59,7 +60,7 @@ crate. `missing_docs = "warn"` is set in both `Cargo.toml` files. ### Entry Point (`main.rs`, `lib.rs`) -`main.rs` parses CLI args and dispatches to command handlers. `lib.rs` exports the library API and contains `start_node()` which bootstraps an Iroh node with blob storage, document sync, and peer discovery. +`main.rs` starts the facade binary; command parsing and dispatch are implemented in `id-cli` and re-exported at the historical facade paths. Node services are composed by the current command/server layers. ### CLI (`cli.rs`) diff --git a/pkgs/id/Cargo.toml b/pkgs/id/Cargo.toml index cd85d5a79b..c6d287618d 100644 --- a/pkgs/id/Cargo.toml +++ b/pkgs/id/Cargo.toml @@ -3,7 +3,7 @@ name = "id" version = "0.1.0" edition = "2024" rust-version = "1.96" -description = "A peer-to-peer file sharing CLI built with Iroh" +description = "Peer-to-peer platform and Rust facade built with Iroh" license = "MIT OR Apache-2.0" repository = "https://github.com/developing-today/code" keywords = ["p2p", "file-sharing", "iroh", "cli"] @@ -74,7 +74,7 @@ sandbox = [ world = ["id-core/world", "id-cli/world"] ssh = ["world", "id-worlds/ssh", "id-cli/ssh"] web = ["world", "dep:id-web", "id-core/web", "id-cli/web"] -# Mainline DHT address lookup (P7.3, decision 15). Off in the default build; src/dht.rs decides per server. +# Mainline DHT address lookup (P7.3, decision 15). Off in the default build; the implementation is in id-sync and the command wiring is in id-cli. dht = ["id-sync/dht", "id-cli/dht"] # Live-cluster binding for the currency PoC (#2289): the official TigerBeetle # Rust client, pinned to the harness server version (harness.rs). Off by diff --git a/pkgs/id/README.md b/pkgs/id/README.md index 2554cf5162..0db51cddcd 100644 --- a/pkgs/id/README.md +++ b/pkgs/id/README.md @@ -1,6 +1,6 @@ # id -A peer-to-peer file sharing CLI built with [Iroh](https://iroh.computer). Store, retrieve, and share files across a decentralized network with optional collaborative web editing. +The `id` platform and Rust facade, built with [Iroh](https://iroh.computer). It includes peer-to-peer file sharing, a sandboxed world runtime, directory and group services, sync, currency registry, and optional web editing. The command layer lives in `id-cli` and is re-exported by the facade. ## The book diff --git a/pkgs/id/book/reference/cli-worlds-admin.md b/pkgs/id/book/reference/cli-worlds-admin.md index 275d7e8913..d4cdebad85 100644 --- a/pkgs/id/book/reference/cli-worlds-admin.md +++ b/pkgs/id/book/reference/cli-worlds-admin.md @@ -114,7 +114,7 @@ id world diff --file --capability | `--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: diff --git a/pkgs/id/crates/id-caps/src/lib.rs b/pkgs/id/crates/id-caps/src/lib.rs index 98746af08b..7e7f911fd8 100644 --- a/pkgs/id/crates/id-caps/src/lib.rs +++ b/pkgs/id/crates/id-caps/src/lib.rs @@ -1,9 +1,10 @@ -//! Capability data model of the `id` crate: the capability catalog, -//! execution limits and the declarative world manifest. +//! Capability and policy layer of the `id` crate: capability catalog, +//! execution limits, declarative world manifest, library gates, and +//! MCP bridge and policy modules. //! -//! Step 1 of the pkgs/id crate split (#3447 umbrella, #4403): these three -//! modules moved here from `id-core` (`world_caps`, `world_limits`) and -//! from the facade package (`world_manifest`). The facade re-exports each +//! Step 1 of the pkgs/id crate split (#3447 umbrella, #4403): the initial +//! capability modules moved here from `id-core` (`world_caps`, `world_limits`) and +//! from the facade package (`world_manifest`); the crate has since grown. The facade re-exports each //! module at its historical `id::` path, so no call site outside the //! moved modules changed. //! diff --git a/pkgs/id/crates/id-cli/src/lib.rs b/pkgs/id/crates/id-cli/src/lib.rs index 73da926e61..ca77cf0285 100644 --- a/pkgs/id/crates/id-cli/src/lib.rs +++ b/pkgs/id/crates/id-cli/src/lib.rs @@ -1,4 +1,4 @@ -//! The id command-line application layer: `cli` (argument parsing), +//! The id command-line application layer and command dispatch: `cli` (argument parsing), //! `commands` (subcommand implementations), `repl`, and //! `server_config`, plus the support modules they share (`local`, //! `protocol`, `meta_client`, `helpers`, `chat_presence`, diff --git a/pkgs/id/crates/id-cli/src/meta_client.rs b/pkgs/id/crates/id-cli/src/meta_client.rs index 8e0c8008fd..92ad1b184c 100644 --- a/pkgs/id/crates/id-cli/src/meta_client.rs +++ b/pkgs/id/crates/id-cli/src/meta_client.rs @@ -6,7 +6,7 @@ //! What stays in the facade is the composition: [`MetaClient`] chooses //! between a running `id serve` (found through the CLI layer's serve //! lock) and the in-process [`LocalNode`], both of which are facade -//! concerns until step 7 extracts the CLI layer. +//! concerns now composed by `id-cli` after split step 7b. use anyhow::Result; use iroh::{ diff --git a/pkgs/id/crates/id-config/src/lib.rs b/pkgs/id/crates/id-config/src/lib.rs index 49353e5dd2..f3bf092d4a 100644 --- a/pkgs/id/crates/id-config/src/lib.rs +++ b/pkgs/id/crates/id-config/src/lib.rs @@ -22,6 +22,8 @@ //! executed by this crate. Resolution is deterministic: the same document //! always resolves to the same [`ResolvedConfig`], regardless of the order //! overrides or allowlist entries were written in. +//! The historical `negotiation.rs` file is not declared as a crate module; +//! it is included by path only from the facade's downgrade integration test. use std::collections::BTreeMap; use std::collections::BTreeSet; diff --git a/pkgs/id/crates/id-groups/Cargo.toml b/pkgs/id/crates/id-groups/Cargo.toml index 032224048a..c0f78d217b 100644 --- a/pkgs/id/crates/id-groups/Cargo.toml +++ b/pkgs/id/crates/id-groups/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" # does not move again). Contents: the groups remainder (`groups`: # actions, the group log, local warnings), the blob gate's enforcement # logic (`blob_gate`; the `FoldedWorlds` adapter over `groups::worlds` -# stays in the facade with worlds.rs until step 5 extracts id-worlds), +# is implemented by id-worlds and re-exported by the facade), # and the DataScheme group encryption (`encryption`). Dependencies per # the design map: id-core, id-store, id-events. diff --git a/pkgs/id/crates/id-groups/src/blob_gate.rs b/pkgs/id/crates/id-groups/src/blob_gate.rs index 18c74a355f..9b2b9cf347 100644 --- a/pkgs/id/crates/id-groups/src/blob_gate.rs +++ b/pkgs/id/crates/id-groups/src/blob_gate.rs @@ -50,7 +50,7 @@ use id_events::event_store::{BlockList, BlockLookup}; /// sync-gating vocabulary owned by the events layer since step 2b of /// the crate split (#4405); it is re-exported here at its historical /// path. The implementation over the folded worlds (`FoldedWorlds`) -/// stays in the facade with `groups::worlds` until step 5. +/// is implemented in `id-worlds` and re-exported at the facade path. pub use id_events::world_access::WorldAccess; /// The server's blob policy. diff --git a/pkgs/id/crates/id-groups/src/lib.rs b/pkgs/id/crates/id-groups/src/lib.rs index 08704a8699..ee6452115e 100644 --- a/pkgs/id/crates/id-groups/src/lib.rs +++ b/pkgs/id/crates/id-groups/src/lib.rs @@ -14,8 +14,8 @@ //! - [`blob_gate`]: who may fetch or observe a blob — the gate's //! policy, verdicts and provider event wiring over the //! [`blob_gate::WorldAccess`] trait from `id-events`. The -//! `FoldedWorlds` implementation of that trait stays in the facade -//! with `groups::worlds` until step 5 extracts `id-worlds`. +//! `FoldedWorlds` implementation of that trait lives in `id-worlds` +//! (`id_worlds::blob_gate`) and is re-exported at the facade path. //! - [`encryption`]: group encryption on the `DataScheme` of //! `p2panda-encryption` — the session adapter, causal ordering, //! history modes and welcome chunking. Its one upward reference was diff --git a/pkgs/id/crates/id-sync/Cargo.toml b/pkgs/id/crates/id-sync/Cargo.toml index 773abee097..6ebfe11608 100644 --- a/pkgs/id/crates/id-sync/Cargo.toml +++ b/pkgs/id/crates/id-sync/Cargo.toml @@ -15,7 +15,7 @@ license = "MIT OR Apache-2.0" # `connectivity` already live in id-core (landed drift from the design # map, which had them here). Composition stays in the facade: the # `MetaClient` enum (remote-or-local) and the `LocalNode`-backed tests -# remain there until step 7. +# are composed by id-cli (split step 7b); only the request/response plumbing lives here. [features] default = [] diff --git a/pkgs/id/crates/id-sync/src/lib.rs b/pkgs/id/crates/id-sync/src/lib.rs index 2fe5418d63..c09d9f2e90 100644 --- a/pkgs/id/crates/id-sync/src/lib.rs +++ b/pkgs/id/crates/id-sync/src/lib.rs @@ -16,10 +16,9 @@ //! [`artifact::ArtifactSink`], both implemented facade-side. //! //! The facade re-exports each module at its historical `id::` path, so -//! no call site outside the moved modules changed. Composition stays -//! in the facade until step 7: the `MetaClient` enum that chooses -//! between a running server and the in-process local node is defined -//! there, over this crate's [`meta_client`] plumbing. +//! no call site outside the moved modules changed. The `MetaClient` +//! enum composition is in `id-cli` (`meta_client`), over this crate's +//! [`meta_client`] request/response plumbing. pub mod announcement; pub mod artifact; diff --git a/pkgs/id/crates/id-worlds/Cargo.toml b/pkgs/id/crates/id-worlds/Cargo.toml index 67cd166a33..7cc3e4f93e 100644 --- a/pkgs/id/crates/id-worlds/Cargo.toml +++ b/pkgs/id/crates/id-worlds/Cargo.toml @@ -23,11 +23,9 @@ license = "MIT OR Apache-2.0" # `WorldCore` holds it, the world actor executes directory actions # against it, and `world_store` persists it beside the journal, so # the cluster moves as the consumer side of the relationship (the -# seam-6 pattern). Seam 10's remaining half is unchanged by this: -# step 6's `id-directory` extraction must still invert or re-home -# `WorldCore`'s hold on the directory, exactly as it would have had -# to from the facade. The facade re-exports the directory modules at -# their historical `id::` paths until then. +# seam-6 pattern). Directory ownership is now in id-directory; +# id-worlds uses and re-exports its modules for compatibility. The +# facade likewise preserves the historical `id::` paths. # # `session_host` also lands here: it implements `id_sync::host:: # SessionHost` for the hub and `id_sync::artifact::ArtifactSink` for diff --git a/pkgs/id/crates/id-worlds/src/lib.rs b/pkgs/id/crates/id-worlds/src/lib.rs index 1abe1a7daf..7ac1a0578f 100644 --- a/pkgs/id/crates/id-worlds/src/lib.rs +++ b/pkgs/id/crates/id-worlds/src/lib.rs @@ -24,15 +24,9 @@ //! to move together with the bridge; it cannot live in `id-groups`, //! which is below this crate and must not name world types). //! - The directory cluster — [`directory`], [`directory_auth`], -//! [`directory_view`], [`directory_mail`] — the world runtime's own -//! state: `WorldCore` holds the directory, the world actor executes -//! directory actions against it, and `world_store` persists it -//! beside the journal, so the cluster moves as the consumer side -//! (the seam-6 pattern). Seam 10's remaining half is unchanged: -//! step 6's `id-directory` extraction must still invert or re-home -//! `WorldCore`'s hold on the directory, exactly as it would have -//! had to from the facade. The facade re-exports these modules at -//! their historical `id::` paths until then. +//! [`directory_view`], [`directory_mail`] — is owned by `id-directory`. +//! This crate re-exports those modules for compatibility; `WorldCore` +//! persists directory state as part of the world runtime. //! //! The facade re-exports each module at its historical `id::` path, //! so no call site outside the moved modules changed. The module diff --git a/pkgs/id/examples/roc-world/ABI.md b/pkgs/id/examples/roc-world/ABI.md index 652f1dbdf3..a708c84daf 100644 --- a/pkgs/id/examples/roc-world/ABI.md +++ b/pkgs/id/examples/roc-world/ABI.md @@ -3,7 +3,7 @@ This document specifies the byte-level boundary between an `id` world host and a Roc world compiled for Wasm32. Version 1 is the interface implemented by [`host/src/host.zig`](host/src/host.zig), [`platform.roc`](platform.roc), and -the import-free guest runner in [`../../src/sandbox.rs`](../../src/sandbox.rs). +the import-free guest runner in [`../../crates/id-worlds/src/sandbox.rs`](../../crates/id-worlds/src/sandbox.rs). The Roc platform's module-level functions are described in the [world-platform README](README.md). @@ -145,7 +145,7 @@ outstanding requests after replay. - Export implementation and memory/output ownership: [`host/src/host.zig`](host/src/host.zig). - Wasm export list and Roc-to-host declarations: [`platform.roc`](platform.roc). - Required/optional export checks, memory marshalling, and result handling: - [`../../src/sandbox.rs`](../../src/sandbox.rs). + [`../../crates/id-worlds/src/sandbox.rs`](../../crates/id-worlds/src/sandbox.rs). - Capability schema, limits, and catalog: [`../../crates/id-core/src/world_caps.rs`](../../crates/id-core/src/world_caps.rs). - Capability execution and result values: diff --git a/pkgs/id/examples/rust-counter/README.md b/pkgs/id/examples/rust-counter/README.md index 41ef995e71..1e7401db58 100644 --- a/pkgs/id/examples/rust-counter/README.md +++ b/pkgs/id/examples/rust-counter/README.md @@ -17,7 +17,7 @@ rustup target add wasm32-unknown-unknown ``` `build.sh` refreshes the checked-in `counter.wasm`, which the host's -F12.7 conformance suite (`pkgs/id/src/sandbox.rs`) loads as the +F12.7 conformance suite (`pkgs/id/crates/id-worlds/src/sandbox.rs`) loads as the `rust-counter` fixture — no Rust toolchain is needed to run the suite. ## Run a hosted world diff --git a/pkgs/id/examples/rust-world/README.md b/pkgs/id/examples/rust-world/README.md index 95d7d9aa19..029e7df4cb 100644 --- a/pkgs/id/examples/rust-world/README.md +++ b/pkgs/id/examples/rust-world/README.md @@ -17,7 +17,7 @@ arrive in `plaza_alloc` memory the host frees with `plaza_free`. `../rust-counter` is the playable example built on this SDK — the Rust twin of `../roc-counter`, with the same events, screen, records, and snapshot text, and its checked-in module runs in the host's F12.7 -conformance suite (`pkgs/id/src/sandbox.rs`). +conformance suite (`pkgs/id/crates/id-worlds/src/sandbox.rs`). ## Component model / WIT diff --git a/pkgs/id/src/lib.rs b/pkgs/id/src/lib.rs index 8506ef7864..7000b50d20 100644 --- a/pkgs/id/src/lib.rs +++ b/pkgs/id/src/lib.rs @@ -1,8 +1,10 @@ -//! # ID - Peer-to-Peer File Sharing with Iroh +//! # ID — peer-to-peer platform and Rust facade //! -//! `id` is a peer-to-peer file sharing tool and library built on the [Iroh](https://iroh.computer) -//! networking stack. It provides content-addressed blob storage with human-readable naming via tags, -//! enabling secure, decentralized file sharing between peers. +//! `id` is a peer-to-peer platform and Rust facade built on the +//! [Iroh](https://iroh.computer) networking stack. Its workspace includes +//! content-addressed file sharing, a sandboxed world runtime, directory, +//! group, sync, currency, and optional web layers. The command application +//! is implemented by `id-cli`; this facade preserves the public `id::` paths. //! //! ## Overview //! @@ -22,10 +24,10 @@ //! ```text //! ┌─────────────────────────────────────────────────────────────────┐ //! │ CLI / REPL │ -//! │ (main.rs - command dispatch, repl/runner.rs - interactive) │ +//! │ id-cli command layer (facade re-exports) │ //! ├─────────────────────────────────────────────────────────────────┤ //! │ Command Handlers │ -//! │ put.rs │ get.rs │ find.rs │ list.rs │ serve.rs │ id.rs │ tag.rs│ +//! │ commands, protocol, store, tags, worlds, directory, sync │ //! ├─────────────────────────────────────────────────────────────────┤ //! │ Protocol Layer (protocol.rs) │ //! │ MetaRequest/Response │ FindMatch │ MetaProtocol │ @@ -41,15 +43,12 @@ //! └─────────────────────────────────────────────────────────────────┘ //! ``` //! -//! ## Modules +//! ## Facade modules //! -//! - [`cli`] - Command-line argument parsing with clap -//! - [`commands`] - Command implementations (put, get, find, list, serve, tag, etc.) -//! - [`protocol`] - Network protocol types for metadata exchange -//! - [`store`] - Blob storage and keypair management -//! - [`tags`] - Metadata tag storage using iroh-docs CRDT documents -//! - [`repl`] - Interactive REPL with shell-like features -//! - [`helpers`] - Utility functions for parsing and formatting +//! The root crate contains platform services and re-exports modules from +//! workspace members, including `id-cli`, `id-core`, `id-caps`, `id-sync`, +//! `id-worlds`, `id-directory`, and `id-web` (feature-gated). The facade's +//! `cli`, `commands`, and `repl` paths are provided by `id-cli`. //! //! ## Signing contract — sign only what receipt would accept //!