Cotton code
186 lines · 10.4 KB · RustRaw
//! THE CATALOGUE WORDS — one line per record kind, in plain software terms.//!//! Two sentences per kind and no more://!//! * [`meaning`] — what a row of this kind IS;//! * [`feeds`] — what CREATES rows of it: the tools by name, the screen, the//!   worker or the import source.//!//! ## Why they live here and not on the screen that draws them//!//! `read.catalogue` draws them, and so does the Home surface's collapsed "Not//! started" row — two readers already, on one device, and the Mac's browser is//! a third. A sentence written on a screen is a sentence the next screen writes//! again, slightly differently, and a person reading both learns that Cotton//! does not know what its own kinds are.//!//! They sit beside [`super::primitive`] because that is where a kind's other//! declarations are, and for the same reason: the match below is EXHAUSTIVE//! over [`PrimitiveKind`], so a kind added to the enum without its two//! sentences fails the BUILD rather than drawing an empty row.//!//! ## Where the sentences came from//!//! `crates/cotton-core/src/primitives.rs`, the tool docs under//! `apps/cotton/docs/tools/`, `SUPPORTING_TABLES`' own reasons and the verb//! grid (`toolSurface.ts`) — never invention. Where a kind has no create verb//! that is what its line SAYS, because "nothing an assistant can call mints//! one" is the most useful fact about half of these.//!use crate::constants::PrimitiveKind;/// What a row of this kind is.pub const fn meaning(kind: PrimitiveKind) -> &'static str {    use PrimitiveKind::*;    match kind {        MoneyAccount => "An account in the money ledger.",        StatementLine => "One printed movement on a bank or card statement.",        Evidence => "The source that proves a transaction.",        Todo => "A single obligation with a title, status and optional due date.",        TodoRecurrence => {            "A repeat rule that mints todo occurrences — machinery behind its todos, never a \             result search returns."        }        Event => {            "A calendar entry: a title, a time and a place, expanded from its series when it \             repeats."        }        Note => "A row of prose: versioned, commentable, linkable and filable into a project.",        Journal => {            "The day in the owner's own words — a note whose identity is its date, append-only."        }        Person => "A contact row that anchors money, links, conversations and calls.",        Transaction => "One money movement, pointing at the statement line it came from.",        Statement => {            "A filed bank or card statement's header — period, balances, line count — and the \             source every transaction on it derives from."        }        Document => "A filed file with its extracted pages and summary; the bytes live in the media store.",        Memory => "One sentence of at most 280 characters, in the owner's own words, belonging to a project.",        EmailThread => {            "A mail conversation with a subject, an address set and a summary; it is the half \             that carries project membership."        }        Email => {            "One archived message, written once when it arrived. Read, starred, inbox and bin are \             state on the message itself."        }        Thread => "A chat conversation: a name, its participants and a summary.",        Message => "One chat message — somebody's words, hidden per reader and never binned.",        Session => "An append-and-close log of one assistant run: title, summary, machine and project.",        SessionMessage => {            "One instruction or report on the bus between sessions, claimed by exactly one of them."        }        Project => "The working context that gathers the records and the memory filed under it.",        Prompt => {            "What the owner typed, kept verbatim with its session; private, and surfacing only as \             its session's hit."        }        Photo => "A reference to picture bytes the person already holds, addressed by the bytes' own hash.",        Video => "A picture's row plus a duration and a poster frame.",        Album => "A titled set of pictures the server proposed, open until the person keeps or dismisses it.",        Call => "A call log entry a device read off the phone: handle, direction, outcome and duration.",        Secret => {            "A password, key, secure note, card or identity document, sealed so that only the \             person's own paired devices can open it. The name, site and username are plain; \             everything else is encrypted and no tool can read it back."        }        Device => {            "One phone or Mac the owner has approved to open this database: its name, what it \             is, the version it runs, when it joined and whether it has been revoked."        }        Repository => {            "One code repository the owner holds: its owner and name on the host, its default \             branch, its description, whether Cotton holds its bytes and who accepts pushes."        }        Pull => {            "One pull request: its title and body, the branch it merges from and into, the \             host's combined status for its head commit, and whether it is open, closed or \             merged."        }        Issue => {            "One issue on a repository: its title, body, author, labels and whether it is open \             or closed."        }        RepoComment => {            "One entry in a pull request's or an issue's timeline: a plain comment, a review \             with its verdict, or a review comment with the file and line it sits on."        }        Release => {            "One release of a repository: its tag, name and notes, the commit it marks, and the \             files published with it."        }        Run => {            "One workflow run on a repository: which workflow, what started it, the branch and \             commit it ran on, and how each of its jobs ended."        }        // gen-kind: meaning    }}/// What creates rows of this kind.pub const fn feeds(kind: PrimitiveKind) -> &'static str {    use PrimitiveKind::*;    match kind {        MoneyAccount => "The money engine creates accounts when book_statement files paper.",        StatementLine => "The statement import writes its printed lines.",        Evidence => "record_transaction and book_statement attach the sources that prove money.",        Todo => "create_todo, update_todo and update_todos; the router filing a capture; the Todos screen.",        TodoRecurrence => {            "Born from create_todo's repeat rule and reshaped only on its own record page in the app — \             there is no create verb for one."        }        Event => "create_event, update_event and delete_event; the router filing a capture; the calendar screen.",        Note => "create_note, update_note and upsert_managed_note; the router filing a capture; the Notes screen.",        Journal => "append_journal, and the app's journal screens.",        Person => "create_person, update_person and merge_people; contact and message imports; the person page.",        Transaction => "record_transaction, book_statement, set_tag, set_person and set_period, and the money screens.",        Statement => "read_statement and submit_statement_reading over a document that was filed first.",        Document => "file_document and request_document_upload; the share sheet; the documents import screen.",        Memory => "remember, memory_update and memory_archive; read back by brief and recall.",        EmailThread => "ingest_emails, which mints one from the conversation key it reads.",        Email => "ingest_emails from a mail connector; the state moves through update_email and update_emails.",        Thread => "the Mac importing Messages, call history or a WhatsApp backup — nothing else starts a conversation.",        Message => "the Mac importing a conversation — the archive is read-only and Cotton sends nothing.",        Session => "log_session at the end of a turn, and the session-start registration.",        SessionMessage => "Nothing over MCP: the session inbox was retired on 15 Nov 2026. The messages already written are kept and read; no tool writes or claims one.",        Project => "create_project, update_project and link_to_project; project templates; the projects screen.",        Prompt => "Written beside log_session when a turn ends. No tools read or write one directly.",        Photo => "The app's picker and share sheet; the sweep that indexes chat attachments; the Mac's library import.",        Video => "The picker, the share sheet, the chat media sweep and the Mac's library import. No create verb.",        Album => "The server's own pass proposes one; create_album, decide_album and update_album settle it.",        Call => "The Mac reading call history off a machine on the same Apple ID; list_calls and get_call read it.",        Secret => {            "create_secret and update_secret store one; list_secrets names them and answers the \             last four characters, never a value; delete_secret moves one to the bin. The apps \             also write them, and the reveal is theirs alone."        }        Device => {            "Joining: a device asks, and a person already in compares six digits and approves it. \             No tool creates, approves, renames or revokes one — list_devices reads them and \             that is the whole surface."        }        Repository => {            "Retired (TABLE DROP 1, 27 Nov 2026): no longer served, and no tool reads or writes it."        }        Pull => {            "Retired (TABLE DROP 1, 27 Nov 2026): no longer served, and no tool reads or writes it."        }        Issue => {            "Retired (TABLE DROP 1, 27 Nov 2026): no longer served, and no tool reads or writes it."        }        RepoComment => {            "Retired (TABLE DROP 1, 27 Nov 2026): no longer served, and no tool reads or writes it."        }        Release => {            "Retired (TABLE DROP 1, 27 Nov 2026): no longer served, and no tool reads or writes it."        }        Run => {            "The ci worker on the serving Mac, when a ref moves, a pull request opens, a cron \             tick lands or the owner dispatches one. No tool creates, cancels or re-runs one — \             the runs screen and `pnpm forge run` are the whole surface."        }        // gen-kind: feeds    }}