Cotton code
78 lines · 4.4 KB · SwiftRaw
// The day and the person, at the boundary: the read NAMES 4e's screens ask// for, and the owner-scope tools they write through.//// The SHAPES are not here any more (I3). A `read.*` answer is a `JSONValue`// tree the screen reads with the scaffold's accessors (`text`, `number`,// `list`, …), and `ReadKeySweepTests` holds every key literal a screen spells// against the `json!` keys the crate writes. A method name is still a wire// string and a typo is still an `unknown_method` at RUNTIME, so// `BoundaryContractTests` reads `phone/reads.rs` by path and refuses a name the// crate does not declare — which is why every name below lives in ONE file// rather than beside its screen.//// WHAT IS NOT HERE, deliberately: the owner-scope WRITES the day surface makes.// Those go through `CottonMethod.write` with a tool name and arguments, which// is the one write method the phone has; a second family of typed requests// would be a second copy of the catalogue's own argument shapes. `DayTool`// below names them so a caller cannot mistype one.import Foundationextension CottonMethod {    /// The shown database's live membership and this device's admitted person.    public static let readMembers = "read.members"    /// `/alarms` — every alarm the owner has set, in clock order.    public static let readAlarms = "read.alarms"    /// Retained while the Rust project-scope seam still accepts these reads.    public static let readDay = "read.day"    /// `/thoughts` — the whole capture ledger and what each one became.    public static let readThoughts = "read.thoughts"    /// `/people/import` — which of this phone's contacts are already people.    public static let readPeopleImport = "read.peopleImport"    /// `/projects` — the workspace's roster. Not one of 4e's reads: the todos    /// tool's bulk Project verb picks from it, and a project-scoped Done or    /// Dropped list takes its NAME from it. Here for the same reason as the one    /// above — a name outside this file is a name `BoundaryContractTests`    /// cannot see.    public static let readProjects = "read.projects"    /// `/todos/todo/[id]` — one todo, and the rule it repeats by.    public static let readTodo = "read.todo"    /// `/notes/note/[id]`, `/thoughts/thought/[id]` and `/memory/[id]` — the    /// store's one "fetch this record by kind and id".    public static let readRecord = "read.record"    /// `/home#backup` and `/database#backup` — the serving Mac's off-Mac    /// backup, which the board's notices turn into one notice when it failed    /// or fell behind (`BackupNotice`). Answered by the Mac, never by silence.    public static let readServingBackup = "read.servingBackup"    // ── Named by the project scope, not by a screen ──────────────────────    //    // 4f's screens ask for their reads through `ScreenRead(read:args:)`, whose    // method is built by interpolation — so those names are held crate-side    // (`READS ∪ DEFERRED ∪ READ_LESS = ROUTES`) rather than here. The Mac's    // project scope (`ProjectScopedCore`) is the first caller to write three of    // them as LITERALS, because the seam decides what to narrow by method name    // before any screen has asked. A literal is a name `BoundaryContractTests`    // cannot see, so the three land in this file for the reason every read    // above did: one file, one name, and a crate-side rename fails as a red    // test instead of as an `unknown_method` under the sidebar's filter.}/// The tool names the day surface writes through.////// Every one of these is `McpScope.owner` in the catalogue: absent from every/// `tools/list`, refused at every dispatch except the phone's own. They are/// named here so a screen cannot mistype one into a runtime refusal, and/// grouped so the set is readable as what it is — the verbs an assistant is/// deliberately not given.public enum DayTool {    // Alarms. There is no `list_alarms` and no `get_alarm`: an alarm is the    // owner's own act, and the list is `read.alarms`.    public static let updateAlarm = "update_alarm"    /// The foreground pass — the app's own half of materialization, run at    /// launch and on every foreground. The server's hourly tick is the    /// guarantee for a phone that is closed; this is why a repeating todo    /// appears the moment somebody opens the app.    public static let materializeTodoRecurrences = "materialize_todo_recurrences"}