Cotton code
70 lines · 4.0 KB · SwiftRaw
// Home, the two decision queues, capture and Mood, at the boundary: the read// NAMES 4d's screens ask for. Everything else 4d's boundary once held — the// Home answer, the asked-of-you rows, the memory review, the open comments, the// mood strip, Take — is a `JSONValue` the screen reads with the scaffold's// accessors (I3), held by `ReadKeySweepTests` against the keys the crate// writes. A method name is still a wire string and a typo is still an// `unknown_method` at RUNTIME, so `BoundaryContract4dTests` 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. The `Encodable` request structs each call sends live beside the// screen or service that sends them.//// **Where this file and `crates/cotton-ffi` disagree, the crate wins.**import Foundationextension CottonMethod {    // ── The reads 4d declares ─────────────────────────────────────────────    public static let readHome = "read.home"    /// One `figure` part of Home's board, said in its own words by the core.    public static let readHomeFigure = "read.homeFigure"    // ── The two methods 4p landed beside them ─────────────────────────────    /// The app's OWN write, and the one capture path.    ///    /// `create_thought` does not exist and its absence is a written refusal    /// (`crates/cotton-core/src/primitives.rs`: a thought is something the person    /// said), so a capture has exactly one author and it is this app.    /// **A capture is a LOCAL write and is finished** — nothing here calls    /// `/v1/route` on send.    public static let captureCreate = "capture.create"    // ── Arranging Home ────────────────────────────────────────────────────    //    // The app never edits itself (owner, 16 Oct 2026): Home's arrangement —    // its tiles' order (`tool/<key>`, `ready/everything`, `<table>/<groupId>`),    // the hidden tools, a database's look — is set over MCP only. The app only    // reads it, in `read.home`'s `arrangement`, and names no method that    // writes it; `NoAppWritesHomeTests` holds that.    // ── The export ────────────────────────────────────────────────────────    /// "Export everything" — one document with the whole file in it.    ///    /// Before the rewrite the app assembled it out of a dozen queries. That    /// shape does not cross: design P4 puts one read per screen below the    /// boundary, and the crate is the only side that can walk the whole file in    /// one pass.    ///    /// **The answer is a PATH and a count, never bytes** — the boundary's own    /// rule, and the reason it is not negotiable is build 106: a 464 MB body    /// read into memory is a jetsam kill with no exception and no Bugsink    /// event, which reads to the person as a white screen. So the crate writes    /// the file and this app hands the OS a `file:` URL it never opens.    ///    /// Optional arg `now` (an ISO instant) names the day in the file name;    /// absent takes the controller's clock, which is what the app sends —    /// there is no clock up here. Answers `path`, `fileName`, `recordCount`    /// and `sizeBytes`. Refuses with    /// `bad_request`, `unreadable` (the walk, "not connected" included) or    /// `unwritable` (the file); each refusal's own sentence is what the    /// footer's toast shows.    ///    /// The file lands in `<dataDir>/cache/exports/` and an earlier export there    /// is removed first, so the folder holds one copy of a life rather than    /// ten. Nothing in this app has to clean up after it.    public static let exportBuild = "export.build"}