// People's traffic and money, at the boundary: the read NAMES 4g's screens ask// for, the two non-read methods the surface calls, and the one rule about// money that every reader shares.//// 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`, `minor`, …), 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// `BoundaryContract4gTests` 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 read// takes live beside the screen that sends them.//// **Where this file and `crates/cotton-ffi/src/phone/reads.rs` disagree, the// crate wins.**importFoundationextensionCottonMethod {// ── The reads 4g declares for email ───────────────────────────────────/// `/email` — the folder, both ways round.////// Optional `folder` (`inbox` · `archived` · `bin` · `all`), which/// **defaults to `inbox` in the crate** rather than to the tool's own/// `all`, and an optional `sender` address forwarded to the THREAD list/// only. Answers the folder echoed back, the threads, and the/// same folder counted by sender.////// One read rather than two because the screen's segment control is a LOCAL/// flip between two lists over the same rows — asking for them separately/// would read the mailbox twice for one tap.////// **Both halves are capped at 200 by the crate**, stated rather than/// defaulted. The mailbox used to be unbounded — neither list took a limit/// at all — so a mailbox past two hundred threads, or two hundred senders,/// is short at its old end here.publicstaticlet readEmail = "read.email"}extensionCottonMethod {// ── The one read this family declares ─────────────────────────────────//// The films' library is `read.photos` (one library, `phone/traffic.rs::// photos` answers `videos` beside `photos`); `/videos` redirects onto it./// `/settings#storage` — what CottonDB is using on THIS phone.////// `phone/reads.rs::storage`, a `ReadSource::Controller` because the answer/// is not in the database at all: it is the data directory's own size, read/// through the injected `phone::disk::Disk` seam, plus the device-local/// `_media` ledger's counts and its rows.////// **This is NOT `storage_summary`.** That tool adds up the WORKSPACE's own/// record rows — a true and useful number about the database that says/// nothing about the device the screen is running on. A person opening this/// screen is asking how much of THEIR PHONE Cotton is using.publicstaticlet readStorage = "read.storage"// ── The byte-locating method 4p landed, and where its twin lives ──────// ``CottonMethod/readMediaPath`` is NOT declared here. 4i named it first,// in `Boundary+4i.swift`, for the same reason this file would have — a// read named only beside its screen is invisible to the boundary tests, so// a crate-side rename reaches the app as an `unknown_method` at runtime// instead of as a red test. Two lanes each claiming to be its one home is// a redefinition and does not compile, which is how the merge said so.// `media.ensure` below has no other claimant and stays here./// `media.ensure` — the path, fetching the bytes first if they are not/// here.////// `phone/media.rs::ensure`. Takes `{key}`; answers `{path, fetched}`./// **It refuses by name today**: nothing has filled the crate's/// `MediaFetch` seam, so a key whose bytes are not already on this device/// comes back `no_media_fetch` with the crate's own sentence. That is/// today's behaviour and it ports as is — the screen shows the sentence and/// draws the absent state.////// Declared here for the reason ``readMediaPath`` is declared in/// `Boundary+4i.swift`: a method named only beside its screen is invisible/// to `BoundaryContractTests`.publicstaticlet mediaEnsure = "media.ensure"/// `media.viewed` — a detail view opened an original.////// `phone/media.rs::viewed`. Takes `{key}`; answers `{viewed}`, which is/// `false` for a key the ledger does not have and is not an error.////// **A grid must never call this.** It is the stamp the budgeted cache/// orders by: the phone keeps viewed originals under a budget and takes the/// least recently viewed first, so a stamp written by a scrolling finger/// would make "least recently viewed" mean "least recently scrolled past" —/// and the phone would drop exactly the pictures somebody keeps opening./// The two callers are the full-screen photo viewer, on a tap, and the film/// page, which opening IS the asking.publicstaticlet mediaViewed = "media.viewed"/// `media.uploads` — where each of these files is on its way up.////// `phone/media.rs::uploads` (MEDIA DRAIN 1). Takes `{keys}` (at most/// 10,000); answers `{files: [{key, phase, sent?, total, code?, line?,/// attempts, nextTryAt?, network, askedBy?}], counts}` in the order asked./// `uploaded` is the object's own answer, per file; `failed` carries the/// word the person acts on (`too_big`, `cotton_full`, `file_gone`,/// `refused`). Reads the ledger and the uploads in the air, never the/// network.publicstaticlet mediaUploads = "media.uploads"/// `media.network` — the network the phone is on now.////// `phone/media.rs::network` (MEDIA DRAIN 1 item 2). Takes `{path}`:/// `wifi`, `mobile`, `constrained` (Low Data Mode) or `none`; said at/// launch and on every change. A file queued for Wi-Fi only waits until/// the core has heard `wifi`.publicstaticlet mediaNetwork = "media.network"/// `media.stream` — a film's HLS master or whole file, a book's or a/// song's file, signed at the object.////// `phone/films.rs`. Takes `{key}`; answers `{url, expires_at}`: the/// address Apple's player reads with no bearer, and every playlist and/// segment under it, for twelve hours.publicstaticlet mediaStream = "media.stream"/// `films.here.read` — what this phone keeps of a film's file: the/// bundle a stream was kept as, or a whole file kept in the media store./// `{key}` → `{key, bookmark, state}`. Where a film was stopped is not/// here: it is the record's `position`.publicstaticlet filmsHereRead = "films.here.read"/// `films.here.write` — the same, written: `{key, state, bookmark?,/// from?}`, `state` keeping, kept or `null`; a kept whole file names the/// downloaded file (`from`). Never synced.publicstaticlet filmsHereWrite = "films.here.write"/// `films.remove` — a whole film's Remove download: this phone's copy/// goes (never the last one). `{key}` → `{key, freed_bytes}`.publicstaticlet filmsRemove = "films.remove"/// `films.keeping` — this phone's keeping knobs: `{}` →/// `{keep_everything, cellular, budget_gb}`.publicstaticlet filmsKeeping = "films.keeping"/// `films.onPhone` — what this phone keeps, for On this phone's top/// line: `{}` → `{films, series, bytes}` (a stream's bundle is the/// platform's to measure).publicstaticlet filmsOnPhone = "films.onPhone"/// `films.capture` — films as the phone read them, at most 200 at a time:/// `{films: [{path, sourcePath, minutes?, video?, audio?, height?,/// bitrate?, title?, year?, posterPath?, locked?}], onlyFilms?}` →/// `{films: [{sourcePath, outcome, id?, key?, table?, needsMac?, title,/// line}], said}`.publicstaticlet filmsCapture = "films.capture"/// `episodes.here.read` — what this phone keeps of a podcast episode, by/// its audio address. `{url}` → `{url, state, file}`. Never synced.publicstaticlet episodesHereRead = "episodes.here.read"/// `episodes.here.write` — the same, written: a field given is set,/// `null` clears it; `kept` names its file.publicstaticlet episodesHereWrite = "episodes.here.write"/// `books.here.read` — what this phone keeps of a book, by its file's/// key. `{key}` → `{key, state}`. Never synced.publicstaticlet booksHereRead = "books.here.read"/// `books.here.write` — the same, written: `keeping`, `kept` (the bytes/// are here; the core pins them against the budget), or `null`.publicstaticlet booksHereWrite = "books.here.write"/// `books.remove` — Remove download: this phone's copy of one book's file/// goes (never the last copy), and what it kept of it is forgotten./// `{key}` → `{key, freed_bytes}`.publicstaticlet booksRemove = "books.remove"/// `books.folder` — Add a folder: every file of the picked tree, staged/// (`path`) and named by its path below the folder, `/` between parts/// (`name`). `{files: [{path, name}]}` → `{books: [{id, title, outcome/// (added | already | refused), why?}], skipped: [name], words}`; a/// folder holding no book is refused, in words.publicstaticlet booksFolder = "books.folder"/// `media.share` — a file's Share: its bytes fetched to this phone when/// they are not here. `{key}` → `{platform_action: share_file, path}`.publicstaticlet mediaShare = "media.share"/// `object.act` — an act at the person's own object, through the core/// (which alone holds the bearer): `{act, args}` → the object's answer./// Only the acts the core admits (a podcast's subscribe and refresh).publicstaticlet objectAct = "object.act"publicstaticlet shareFetchLinks = "share.fetchLinks"/// `music.capture` — one album's songs as the phone read them, made in/// one write: `{songs: [{path, sourcePath, tags, coverPath?, entry?}],/// zip?}` → `{songs: [{sourcePath, outcome, id?, key?, title, line}],/// said, album?}`. With `zip` (`music.zip`'s answer) they are one album.publicstaticlet musicCapture = "music.capture"/// `music.zip` — an album ZIP's songs, cover, booklet and notes streamed/// out: `{path, name, into}` → `{songs: [{entry, path, sourcePath}],/// coverPath?, bookletPath?, storeUrl?, storeId?, boughtOn?}` or/// `{refused, line}`.publicstaticlet musicZip = "music.zip"publicstaticlet musicFill = "music.fill"/// `songs.here.read` / `songs.here.write` / `songs.remove` — what this/// phone keeps of one song's file, as `books.here.*` for a book's.publicstaticlet songsHereRead = "songs.here.read"publicstaticlet songsHereWrite = "songs.here.write"publicstaticlet songsRemove = "songs.remove"/// `songs.keepEverything` — this phone's Keep everything: `{on?}` → `{on, said?}`.publicstaticlet songsKeepEverything = "songs.keepEverything"}extensionCottonMethod {/// `/messages` — the inbox, ONE ROW PER THREAD.////// `groupBy: "thread"` is forced below the boundary, so the person-merge is/// the screen's. Takes `archived` (a/// BOOL; anything else reads as `false`) and answers the other half of the/// list plus the count that opens it. The tool's ceiling is 200 threads and/// the archived split happens AFTER it — past two hundred conversations the/// inbox comes back short, which the crate's own comment records.publicstaticlet readThreads = "read.threads"}extensionCottonMethod {/// `/photos` — the whole library, pictures (`photos`) AND films/// (`videos`), each newest first, plus the albums and the two review/// COUNTS the screen's menu offers.publicstaticlet readPhotos = "read.photos"}extensionCottonMethod {/// `meetings.create` — a recording becomes a meeting (`phone/meetings.rs`).////// **The one door.** The MCP surface says meetings "enter by recording or/// import on the phone", and `capture.media` refuses `meeting` by name/// because a meeting's audio belongs to a row with a STATUS the server's/// pipeline walks. This method is that row's only producer.////// Takes `path` (the audio file, which stays on the phone — bytes never/// cross the boundary, and the crate COPIES it into the media store so the/// caller discards its own copy), `source` (`record` or `import`), and the/// optional `title`, `startedAt` (RFC3339), `durationMs` and `mime`./// Answers `{id, route, key}` — the new meeting, the screen to land on/// (`/meetings/meeting/<id>`), and the object its audio went to.////// The row is born at `uploading` and NOTHING waits on the upload: the/// `_media` ledger carries it and the server queues the meeting once the/// bytes are in the store. The container follows the file — a WhatsApp/// voice note is `full.opus`, not an m4a that lies about its own bytes.publicstaticlet meetingsCreate = "meetings.create"}extensionCottonMethod {}