// OPEN ACCESS (the owner, 17 Nov 2026): an assistant's unlock window, once// allowed, no longer stands as a banner at the foot over the fan. Account// lists the windows open now on one card — who (the assistant), what (the// tables) and the time left, each row the core's words — and its fan holds// End for each. No window open draws no card.//// Every word is the core's (`unlock.windows`: `windows[].said`, `client`,// `heading`, and End as `acts` names it); this file decides nothing about// what a window is. The time left counts down as Account reads the answer// again (`AccountPage`, every sync pass and `HomeSyncKnobs.every`).importCottonFacesimportCottonKitimportCottonValuesimportFoundation/// The windows open now, as Account's Open access card draws them.structOpenAccess: Equatable, Sendable {structRow: Equatable, Sendable {let grantId: String/// The assistant holding it, as the core names it.let client: String?/// The tables and the time left, in the core's words.let said: String }/// End, as the core names it, and the receipt it says.structEnd: Equatable, Sendable {let label: Stringlet receipt: String? }let heading: Stringlet rows: [Row]let end: End?/// The card, or nil when no window is open: an empty list draws nothing.init?(_ answer: JSONValue?) {guardlet answer else { returnnil }let rows: [Row] = answer.list("windows").compactMap { window inguardlet grant = window.text("grantId"), let said = window.text("said") else { returnnil }returnRow(grantId: grant, client: window.text("client"), said: said) }guard !rows.isEmpty else { returnnil }self.rows = rows heading = answer.text("heading") ?? "" end = answer.list("acts").first.flatMap { act in act.text("label").map { End(label: $0, receipt: act.text("receipt")) } } }/// The card on the plain face: the heading, then each window under its/// assistant's name.var drawn: DeckCard {DeckCard(face: "plain", corner: nil, pressing: false, pace: nil, plate: nil, fields: ["title": .text(heading),"subtitle": .text(""),"facts": .list(rows.map { .object(["label": .text($0.client ?? ""), "said": .text($0.said)]) }), ]) }/// End's word on the fan for one window: named by its assistant.func endWord(_ row: Row) -> String? {guardlet end else { returnnil }return row.client.map { "\(end.label) · \($0)" } ?? end.label }/// End one window: `unlock.end` for its grant. The receipt is the/// caller's to say; a refusal throws.staticfunc end(_ row: Row, core: any CottonCalling) asyncthrows { _ = tryawait core.callJSON(CottonMethod.unlockEnd, UnlockEndRequest(grantId: row.grantId)) }}