/** * Definitions an object holds as retired (owner, 17 Nov 2026: the old * screenplay tables go; Cotton Story is the one screenwriting app). The kit * ships none of these. On an object that holds one, the keep (src/kit_keep.ts * KEEP_RULE 15) takes its definition out of the served set into the meta key * `KIT_RETIRED`, so nothing serves, draws or offers it over MCP, and no sync * carries its rows; the rows themselves stay in storage, untouched, until the * owner erases them (src/erase.ts; TABLE DROP 1 by POST /v1/admin/retired/erase). A fresh object never has them. * * Twin of crates/cotton-core/src/retired.rs (GONE_TABLES, GONE_TOOLS): a * phone's own copy retires the same in its kit keep, and a cotton-core test * holds the lists equal. live:check reads these lists too: a kit table or a * kit named here leaving the kits is the keep's own way of letting it go. */typeDoc = Record<string, unknown>;/** The meta key holding each retired definition by kind and id (`Retired`, as JSON): held, never served. */exportconst KIT_RETIRED = "kit_retired";/** * The tables an object holds as retired. TABLE DROP 1 (owner, 27 Nov 2026; assets/design/shared/TABLE-INVENTORY.md) * added the dead tables and the parked apps Money, Music, Developer, Journal, the old People suggestions, News, * Thoughts, the old Meetings, the code tables and Podcasts, after "page_highlight". */exportconst GONE_TABLES = ["screenplay", "screenplay_scene", "screenplay_character", "screenplay_place", "screenplay_draft", "screenplay_draft_scene", "screenplay_document", "recipe", "recipe_ingredient", "cook_log", "trip", "trip_item", "page_highlight", "statement_line", "transaction", "evidence", "subscription_charge", "statement", "song", "person_suggestion", "subscription", "artist", "music_album", "page", "listen", "money_account", "machine", "journal_entry", "money_owed", "person_language", "person_note", "news_seen", "pull", "meeting_utterance", "document_page", "repo_comment", "repo_commit", "news_story", "issue", "feedback", "news_edition", "comment", "outage", "thought", "meeting", "repo_runner", "placement_proposal", "mood", "code_runner", "news_topic", "goal", "repository", "alarm", "decision", "location", "news_settings", "release", "account_usage_sample", "agent_account", "assistant_run", "code_credential", "dev_job", "filing_proposal", "message_receipt", "message_settings", "post", "quota", "quota_reading", "repo_bundle", "repo_clone", "repo_job", "repo_label", "repo_merge_queue", "repo_rule", "repo_var", "run", "thought_attachment", "thread_filing", "thread_mark", "episode", "podcast"] asconst;/** The tools an object holds as retired. */exportconst GONE_TOOLS = ["screenplays", "recipes", "trips", "pages", "email", "calling", "money", "subscriptions", "music", "journal", "podcasts", "machines", "artifacts", "agents", "memories"] asconst;/** The kits whose kit.json left the tree with the tables above (live:check). */exportconst GONE_KITS = ["screenplays", "recipes", "trips", "pages", "email", "calling"] asconst;const goneTables: ReadonlySet<string> = newSet(GONE_TABLES);const goneTools: ReadonlySet<string> = newSet(GONE_TOOLS);/** Whether `table` is one an object holds as retired: never served, never synced. */exportconst isGoneTable = (table: string): boolean => goneTables.has(table);/** Whether `tool` is one an object holds as retired. */exportconst isGoneTool = (tool: string): boolean => goneTools.has(tool);/** * The 68 tables the owner approved dropping on 27 Nov 2026 (TABLE DROP 1), each retired above: what * `POST /v1/admin/retired/erase` erases, and nothing else. The 13 tables retired before them are not in it. */exportconst TABLE_DROP_1: readonly string[] = ["statement_line", "transaction", "evidence", "subscription_charge", "statement", "song", "person_suggestion", "subscription", "artist", "music_album", "page", "listen", "money_account", "machine", "journal_entry", "money_owed", "person_language", "person_note", "news_seen", "pull", "meeting_utterance", "document_page", "repo_comment", "repo_commit", "news_story", "issue", "feedback", "news_edition", "comment", "outage", "thought", "meeting", "repo_runner", "placement_proposal", "mood", "code_runner", "news_topic", "goal", "repository", "alarm", "decision", "location", "news_settings", "release", "account_usage_sample", "agent_account", "assistant_run", "code_credential", "dev_job", "filing_proposal", "message_receipt", "message_settings", "post", "quota", "quota_reading", "repo_bundle", "repo_clone", "repo_job", "repo_label", "repo_merge_queue", "repo_rule", "repo_var", "run", "thought_attachment", "thread_filing", "thread_mark", "episode", "podcast"];/** The acts of a retired app (Money, Podcasts, Music): never offered to an assistant (run_act's list and enum); a call still meets its own refusal. */exportconst GONE_ACTS: readonly string[] = ["read_statement", "submit_statement_reading", "book_statement", "settle_expected", "merge_accounts", "match_external", "subscribe_podcast", "refresh_podcast", "import_opml", "export_opml", "find_lyrics", "drop_old_music", "fetch_cover"];const goneActs = newSet(GONE_ACTS);exportconst isGoneAct = (act: string): boolean => goneActs.has(act);/** * A shipped kit as an object is made from and kept to: without the tables and tools held as retired, which the kit * may still list until their definitions leave the tree (TABLE DROP 1). The same kit once they have. */exportfunction served<K extends { tables: Doc[]; tools: Doc[] }>(kit: K): K {return { ...kit, tables: kit.tables.filter((t) => !goneTables.has(String(t.id))), tools: kit.tools.filter((t) => !goneTools.has(String(t.id))).map(keptTablesOnly) };}/** A kept tool still naming a retired table (Passwords' placement_proposal, People's person_note) is served without it. */function keptTablesOnly(tool: Doc): Doc {returnArray.isArray(tool.tables) && tool.tables.some((t) => goneTables.has(String(t))) ? { ...tool, tables: tool.tables.filter((t) => !goneTables.has(String(t))) } : tool;}/** Each retired definition by kind and id. */exporttypeRetired = { table: Record<string, Doc>; tool: Record<string, Doc> };exportfunction readRetired(text: string | null): Retired {const parsed = text ? (JSON.parse(text) asPartial<Retired>) : {};return { table: { ...(parsed.table ?? {}) }, tool: { ...(parsed.tool ?? {}) } };}/** * What a keep retires from `held`: each held table and tool named above, * added to what `before` already holds (a definition held twice keeps the * newer, the one served until now). Pure. */exportfunction retiring(held: { tool: Doc[]; table: Doc[] }, before: Retired): { retired: Retired; tables: string[]; tools: string[] } {const tables = held.table.filter((t) => goneTables.has(String(t.id)));const tools = held.tool.filter((t) => goneTools.has(String(t.id)));const retired: Retired = { table: { ...before.table }, tool: { ...before.tool } };for (const t of tables) retired.table[String(t.id)] = t;for (const t of tools) retired.tool[String(t.id)] = t;return { retired, tables: tables.map((t) => String(t.id)), tools: tools.map((t) => String(t.id)) };}