Cotton code
81 lines · 3.2 KB · RustRaw
//! CottonDB's tool surface — 228 MCP tools, 187 of them assistant-facing, as a//! library every surface links.//!//! Step 4 of the Rust core, decision P3. The handlers used to live inside//! `cotton-server`, which was fine while the server was their only caller. It//! stopped being fine the moment the PHONE started authoring through them: a//! phone that linked the server would link axum, hyper, `reqwest`'s http2 stack//! and mupdf's vendored C tree to write a todo.//!//! So the tools are here, and this crate depends on `cotton-store` and//! `cotton-core` and NOTHING ELSE. That is a load-bearing rule, not a//! preference — `no-server-deps.rs` in `__tests__` asserts it, and//! `cargo tree -p cotton-tools -e normal` is the proof a reader can run.//!//! WHAT LIVES HERE: the handler groups (`mcp::handlers`), the dispatch table//! (`mcp::dispatch`, which also owns [`mcp::dispatch::Ctx`], `ToolServices`//! and the rails), the writer, the read layer, the protocol shapes, the verb//! grid gate, the language sweep, the prompts, and the generated catalogue.//! With them come the four things a handler cannot run without and that are//! not the server's: the injected clock, the injected randomness, the fold//! chokepoint the writer commits through, and the small domain modules the//! handlers read (`sharing::expiry`, `messages::sink`,//! `embed::state`).//!//! WHAT DOES NOT: the HTTP transport (`cotton_server::mcp::server`), the token//! store and OAuth binding, the audit row writer, and every rail's//! IMPLEMENTATION. A rail is declared here as a trait and filled in by whoever//! is running — the server fills them all, a worker fills none//! ([`mcp::dispatch::ToolServices::none`]), and the phone fills the two it can.//!//! `cotton_server::mcp` re-exports every module of this crate's `mcp`, so a//! reader who knows the old paths still finds them where they were.// Every refusal a tool makes is a sentence, and the errors that carry one are// wide for the same reason `cotton-server`'s are: the sentence IS the contract.#![allow(clippy::result_large_err)]#[cfg(feature = "test-fixtures")]pub mod test_fixtures;pub mod clock;// What Cotton keeps reading from outside: the pure half of the MCP bridge// (decision note 7767ed9c) — judging a server, reading a mapping, the Domains// tool as data. The fetching half is the server's.pub mod connections;pub mod definitions;pub mod kit;pub mod kit_keep;pub mod presentation;pub mod activity;pub mod derive;pub mod money_run;pub mod dictation;/// The device row in the person's own database — who may open this file.pub mod devices;pub mod embed;pub mod feedback;pub mod mcp;pub mod messages;pub mod rails;pub mod random;pub mod relay_name;pub mod session_birth;pub mod session_words;pub mod session_echo;pub mod sharing;pub mod sync;#[cfg(feature = "test-fixtures")]pub mod synthetic;pub mod todo_labels;pub mod toolkits;pub mod tool_pictures;pub mod founding;pub mod home_arrangement;pub mod tool_figures;pub mod household_address;pub mod imports;/// Where each contact came from (`person_source`, PEOPLE BUILD 1): every import and sync matches by source first.pub mod people_sources;pub mod tool_export;