@ai-matrx/records 0.57.1 → 0.57.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/use-cases/alvarado-chen-kitchen-weekly-cooking.ts","../../src/use-cases/birchwood-avenue-renovation-budget.ts","../../src/use-cases/harbor-dental-new-patient-intake.ts","../../src/use-cases/ridgeline-physical-therapy-plan-of-care.ts","../../src/use-cases/registry.ts","../../src/vocabulary.ts","../../src/archive.ts","../../src/level.ts","../../src/field.ts","../../src/choice.ts","../../src/coerce.ts","../../src/pipeline.ts","../../src/rule.ts","../../src/portal.ts","../../src/aggregate.ts","../../src/grid.ts","../../src/capture-queue.ts","../../src/results.ts","../../src/ops.ts","../../src/store.generated.ts","../../src/record-scope.ts","../../src/core/doors.ts","../../src/core/pgError.ts","../../src/core/recordChanges.ts","../../src/core/query.ts","../../src/core/client.ts","../../src/core/supabase.ts","../../src/core/validation.ts","../../src/core/io.ts"],"sourcesContent":["// src/use-cases/alvarado-chen-kitchen-weekly-cooking.ts — @ai-matrx/records/use-cases\n//\n// THE USE CASE: Priya and Daniel Alvarado-Chen cook for a family of five, and\n// they use this to keep the recipes they actually make, what goes into each one,\n// and the week's shopping list that falls out of the meals they have planned —\n// instead of three notebooks, a photo of a card and a text message at the shop.\n//\n// The law welcomes personal life, and a household is the honest test of a\n// platform that claims anyone can model their own work: nobody here has a job\n// title, a CRM or a pipeline consultant.\n//\n// PROVENANCE. Tables, fields and rows come from the data crew's dataset\n// `matrx-frontend/scripts/campaign-tests/use-cases/family-recipe-collection.json`.\n// Fixed on adoption: the household was \"The Alvarado-Chen Kitchen (test\n// fixture)\" — a test organization carries the use case's own name and is found\n// for cleanup by its tag, never by a junk suffix. Relations pointed at a\n// recipe's TITLE rather than at the row. The business identity, relationships,\n// form, pipeline, dashboard question, document and notification rule were\n// written for this file.\n//\n// Everyone here is invented.\n\nimport type { UseCase } from \"./types\";\n\nexport const useCase: UseCase = {\n id: \"alvarado-chen-kitchen-weekly-cooking\",\n useCase:\n \"Priya and Daniel Alvarado-Chen cook for a family of five, and they use this to keep the recipes they actually make, the ingredients each one needs, and the weekly shopping list that falls out of the meals they have planned, instead of three notebooks and a text message at the shop.\",\n industry: \"Household cooking\",\n cleanupTag: \"use-case:alvarado-chen-kitchen-weekly-cooking\",\n\n business: {\n name: \"The Alvarado-Chen Kitchen\",\n describes: \"A household of five that cooks most nights and shops once a week across three shops.\",\n address: {\n line1: \"68 Winterbourne Road\",\n city: \"Oak Park\",\n region: \"IL\",\n postalCode: \"60302\",\n country: \"US\",\n },\n phone: \"+1 708 555 0126\",\n email: \"kitchen@alvaradochen.net\",\n timezone: \"America/Chicago\",\n },\n\n tables: [\n {\n token: \"recipes\",\n name: \"Recipes\",\n labelSingular: \"Recipe\",\n labelPlural: \"Recipes\",\n type: \"entity\",\n display: \"grid\",\n weight: \"heavy\",\n ordered: false,\n icon: \"chef-hat\",\n titleField: \"title\",\n describes: \"Every dish the household actually cooks, with who brought it in and how long it takes.\",\n fields: [\n { key: \"title\", label: \"Recipe\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"category\", label: \"Course\", parityType: \"select\", choices: [\"Breakfast\", \"Main Course\", \"Side Dish\", \"Soup\", \"Dessert\", \"Sauce/Condiment\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"cuisine\", label: \"Cuisine\", parityType: \"select\", choices: [\"Mexican\", \"Chinese\", \"Italian\", \"American\", \"Middle Eastern\", \"Indian\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"prep_minutes\", label: \"Prep time\", parityType: \"integer\", unit: \"min\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"cook_minutes\", label: \"Cook time\", parityType: \"integer\", unit: \"min\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"servings\", label: \"Serves\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"source\", label: \"Where it came from\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"contributed_by\", label: \"Brought in by\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"date_added\", label: \"Added\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"recipe-chilaquiles-verdes\", values: {\"title\": \"Chilaquiles Verdes\", \"category\": \"Breakfast\", \"cuisine\": \"Mexican\", \"prep_minutes\": 15, \"cook_minutes\": 20, \"servings\": 4, \"source\": \"Grandma Alvarado's recipe box, card #12\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-01-08\"} },\n { key: \"recipe-kung-pao-chicken\", values: {\"title\": \"Kung Pao Chicken\", \"category\": \"Main Course\", \"cuisine\": \"Chinese\", \"prep_minutes\": 20, \"cook_minutes\": 15, \"servings\": 4, \"source\": \"Adapted from Fuchsia Dunlop's Land of Fish and Rice\", \"contributed_by\": \"Wei Chen\", \"date_added\": \"2026-01-15\"} },\n { key: \"recipe-slow-braised-short-rib-ragu\", values: {\"title\": \"Slow-Braised Short Rib Ragu\", \"category\": \"Main Course\", \"cuisine\": \"Italian\", \"prep_minutes\": 25, \"cook_minutes\": 210, \"servings\": 6, \"source\": \"Sunday dinner tradition, no written source\", \"contributed_by\": \"Marco Alvarado\", \"date_added\": \"2026-02-02\"} },\n { key: \"recipe-mapo-tofu\", values: {\"title\": \"Mapo Tofu\", \"category\": \"Main Course\", \"cuisine\": \"Chinese\", \"prep_minutes\": 10, \"cook_minutes\": 15, \"servings\": 3, \"source\": \"Wei's mother, dictated over the phone\", \"contributed_by\": \"Wei Chen\", \"date_added\": \"2026-02-10\"} },\n { key: \"recipe-elote-street-corn-salad\", values: {\"title\": \"Elote Street Corn Salad\", \"category\": \"Side Dish\", \"cuisine\": \"Mexican\", \"prep_minutes\": 15, \"cook_minutes\": 10, \"servings\": 6, \"source\": \"Farmers market recipe card\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-03-01\"} },\n { key: \"recipe-pozole-rojo\", values: {\"title\": \"Pozole Rojo\", \"category\": \"Soup\", \"cuisine\": \"Mexican\", \"prep_minutes\": 30, \"cook_minutes\": 180, \"servings\": 8, \"source\": \"Family recipe, three generations\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-03-14\"} },\n { key: \"recipe-hot-and-sour-soup\", values: {\"title\": \"Hot and Sour Soup\", \"category\": \"Soup\", \"cuisine\": \"Chinese\", \"prep_minutes\": 15, \"cook_minutes\": 20, \"servings\": 4, \"source\": \"Wei Chen's own recipe\", \"contributed_by\": \"Wei Chen\", \"date_added\": \"2026-03-22\"} },\n { key: \"recipe-tres-leches-cake\", values: {\"title\": \"Tres Leches Cake\", \"category\": \"Dessert\", \"cuisine\": \"Mexican\", \"prep_minutes\": 30, \"cook_minutes\": 35, \"servings\": 12, \"source\": \"Grandma Alvarado's recipe box, card #4\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-04-05\"} },\n { key: \"recipe-cacio-e-pepe\", values: {\"title\": \"Cacio e Pepe\", \"category\": \"Main Course\", \"cuisine\": \"Italian\", \"prep_minutes\": 5, \"cook_minutes\": 15, \"servings\": 2, \"source\": \"Weeknight standby, no written source\", \"contributed_by\": \"Marco Alvarado\", \"date_added\": \"2026-04-12\"} },\n { key: \"recipe-chana-masala\", values: {\"title\": \"Chana Masala\", \"category\": \"Main Course\", \"cuisine\": \"Indian\", \"prep_minutes\": 15, \"cook_minutes\": 30, \"servings\": 4, \"source\": \"Learned from neighbor Priya\", \"contributed_by\": \"Wei Chen\", \"date_added\": \"2026-05-01\"} },\n { key: \"recipe-salsa-verde-cruda\", values: {\"title\": \"Salsa Verde Cruda\", \"category\": \"Sauce/Condiment\", \"cuisine\": \"Mexican\", \"prep_minutes\": 10, \"cook_minutes\": 0, \"servings\": 8, \"source\": \"Grandma Alvarado's recipe box, card #1\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-05-10\"} },\n { key: \"recipe-shakshuka\", values: {\"title\": \"Shakshuka\", \"category\": \"Breakfast\", \"cuisine\": \"Middle Eastern\", \"prep_minutes\": 10, \"cook_minutes\": 25, \"servings\": 4, \"source\": \"Ottolenghi's Jerusalem, adapted\", \"contributed_by\": \"Marco Alvarado\", \"date_added\": \"2026-05-18\"} },\n ],\n },\n {\n token: \"ingredients\",\n name: \"Ingredients\",\n labelSingular: \"Ingredient\",\n labelPlural: \"Ingredients\",\n type: \"detail\",\n display: \"list\",\n weight: \"light\",\n ordered: true,\n icon: \"carrot\",\n titleField: \"ingredient_name\",\n describes: \"What goes into each recipe, in the amounts the recipe is written for.\",\n fields: [\n { key: \"recipe\", label: \"Recipe\", parityType: \"relation\", required: true, relationTarget: \"recipes\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"ingredient_name\", label: \"Ingredient\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"quantity\", label: \"Quantity\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"unit\", label: \"Unit\", parityType: \"select\", choices: [\"cup\", \"tbsp\", \"tsp\", \"oz\", \"lb\", \"clove\", \"whole\", \"can\", \"pinch\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"notes\", label: \"Notes\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"ingredient-corn-tortillas-cut-into-wedges-and-fried\", values: {\"recipe\": \"recipe-chilaquiles-verdes\", \"ingredient_name\": \"corn tortillas, cut into wedges and fried\", \"quantity\": 12, \"unit\": \"whole\", \"notes\": \"day-old tortillas fry crisper\"} },\n { key: \"ingredient-tomatillos\", values: {\"recipe\": \"recipe-chilaquiles-verdes\", \"ingredient_name\": \"tomatillos\", \"quantity\": 1, \"unit\": \"lb\", \"notes\": \"husked and rinsed\"} },\n { key: \"ingredient-serrano-peppers\", values: {\"recipe\": \"recipe-chilaquiles-verdes\", \"ingredient_name\": \"serrano peppers\", \"quantity\": 2, \"unit\": \"whole\", \"notes\": \"seeds removed for less heat\"} },\n { key: \"ingredient-queso-fresco\", values: {\"recipe\": \"recipe-chilaquiles-verdes\", \"ingredient_name\": \"queso fresco\", \"quantity\": 4, \"unit\": \"oz\", \"notes\": \"crumbled for topping\"} },\n { key: \"ingredient-chicken-thighs-diced\", values: {\"recipe\": \"recipe-kung-pao-chicken\", \"ingredient_name\": \"chicken thighs, diced\", \"quantity\": 1.5, \"unit\": \"lb\", \"notes\": \"boneless, skinless\"} },\n { key: \"ingredient-dried-red-chilies\", values: {\"recipe\": \"recipe-kung-pao-chicken\", \"ingredient_name\": \"dried red chilies\", \"quantity\": 8, \"unit\": \"whole\", \"notes\": \"adjust to taste\"} },\n { key: \"ingredient-roasted-peanuts\", values: {\"recipe\": \"recipe-kung-pao-chicken\", \"ingredient_name\": \"roasted peanuts\", \"quantity\": 0.5, \"unit\": \"cup\", \"notes\": \"\"} },\n { key: \"ingredient-sichuan-peppercorns\", values: {\"recipe\": \"recipe-kung-pao-chicken\", \"ingredient_name\": \"Sichuan peppercorns\", \"quantity\": 1, \"unit\": \"tsp\", \"notes\": \"toasted and cracked\"} },\n { key: \"ingredient-bone-in-short-ribs\", values: {\"recipe\": \"recipe-slow-braised-short-rib-ragu\", \"ingredient_name\": \"bone-in short ribs\", \"quantity\": 3, \"unit\": \"lb\", \"notes\": \"trimmed of excess fat\"} },\n { key: \"ingredient-san-marzano-tomatoes\", values: {\"recipe\": \"recipe-slow-braised-short-rib-ragu\", \"ingredient_name\": \"San Marzano tomatoes\", \"quantity\": 1, \"unit\": \"can\", \"notes\": \"28 oz can, crushed by hand\"} },\n { key: \"ingredient-red-wine\", values: {\"recipe\": \"recipe-slow-braised-short-rib-ragu\", \"ingredient_name\": \"red wine\", \"quantity\": 1, \"unit\": \"cup\", \"notes\": \"something drinkable\"} },\n { key: \"ingredient-soft-tofu-cubed\", values: {\"recipe\": \"recipe-mapo-tofu\", \"ingredient_name\": \"soft tofu, cubed\", \"quantity\": 14, \"unit\": \"oz\", \"notes\": \"one package\"} },\n { key: \"ingredient-doubanjiang-fermented-chili-bean-paste\", values: {\"recipe\": \"recipe-mapo-tofu\", \"ingredient_name\": \"doubanjiang (fermented chili bean paste)\", \"quantity\": 2, \"unit\": \"tbsp\", \"notes\": \"Pixian brand preferred\"} },\n { key: \"ingredient-ground-pork\", values: {\"recipe\": \"recipe-mapo-tofu\", \"ingredient_name\": \"ground pork\", \"quantity\": 0.5, \"unit\": \"lb\", \"notes\": \"\"} },\n { key: \"ingredient-corn-kernels-charred\", values: {\"recipe\": \"recipe-elote-street-corn-salad\", \"ingredient_name\": \"corn kernels, charred\", \"quantity\": 4, \"unit\": \"cup\", \"notes\": \"grilled or pan-charred\"} },\n { key: \"ingredient-cotija-cheese\", values: {\"recipe\": \"recipe-elote-street-corn-salad\", \"ingredient_name\": \"cotija cheese\", \"quantity\": 0.5, \"unit\": \"cup\", \"notes\": \"crumbled\"} },\n { key: \"ingredient-lime\", values: {\"recipe\": \"recipe-elote-street-corn-salad\", \"ingredient_name\": \"lime\", \"quantity\": 2, \"unit\": \"whole\", \"notes\": \"juiced\"} },\n { key: \"ingredient-pork-shoulder\", values: {\"recipe\": \"recipe-pozole-rojo\", \"ingredient_name\": \"pork shoulder\", \"quantity\": 3, \"unit\": \"lb\", \"notes\": \"cut into large chunks\"} },\n { key: \"ingredient-hominy\", values: {\"recipe\": \"recipe-pozole-rojo\", \"ingredient_name\": \"hominy\", \"quantity\": 2, \"unit\": \"can\", \"notes\": \"29 oz cans, drained\"} },\n { key: \"ingredient-guajillo-chilies\", values: {\"recipe\": \"recipe-pozole-rojo\", \"ingredient_name\": \"guajillo chilies\", \"quantity\": 6, \"unit\": \"whole\", \"notes\": \"stemmed and seeded\"} },\n { key: \"ingredient-wood-ear-mushrooms-dried\", values: {\"recipe\": \"recipe-hot-and-sour-soup\", \"ingredient_name\": \"wood ear mushrooms, dried\", \"quantity\": 0.25, \"unit\": \"cup\", \"notes\": \"rehydrated and sliced\"} },\n { key: \"ingredient-white-pepper\", values: {\"recipe\": \"recipe-hot-and-sour-soup\", \"ingredient_name\": \"white pepper\", \"quantity\": 1, \"unit\": \"tsp\", \"notes\": \"the 'hot' in hot and sour\"} },\n { key: \"ingredient-evaporated-milk\", values: {\"recipe\": \"recipe-tres-leches-cake\", \"ingredient_name\": \"evaporated milk\", \"quantity\": 1, \"unit\": \"can\", \"notes\": \"12 oz can\"} },\n { key: \"ingredient-sweetened-condensed-milk\", values: {\"recipe\": \"recipe-tres-leches-cake\", \"ingredient_name\": \"sweetened condensed milk\", \"quantity\": 1, \"unit\": \"can\", \"notes\": \"14 oz can\"} },\n { key: \"ingredient-pecorino-romano-grated\", values: {\"recipe\": \"recipe-cacio-e-pepe\", \"ingredient_name\": \"pecorino romano, grated\", \"quantity\": 1.5, \"unit\": \"cup\", \"notes\": \"finely grated, not shredded\"} },\n { key: \"ingredient-chickpeas\", values: {\"recipe\": \"recipe-chana-masala\", \"ingredient_name\": \"chickpeas\", \"quantity\": 2, \"unit\": \"can\", \"notes\": \"15 oz cans, drained\"} },\n { key: \"ingredient-garam-masala\", values: {\"recipe\": \"recipe-chana-masala\", \"ingredient_name\": \"garam masala\", \"quantity\": 1, \"unit\": \"tbsp\", \"notes\": \"\"} },\n { key: \"ingredient-tomatillos-raw\", values: {\"recipe\": \"recipe-salsa-verde-cruda\", \"ingredient_name\": \"tomatillos, raw\", \"quantity\": 1, \"unit\": \"lb\", \"notes\": \"quartered\"} },\n { key: \"ingredient-eggs\", values: {\"recipe\": \"recipe-shakshuka\", \"ingredient_name\": \"eggs\", \"quantity\": 6, \"unit\": \"whole\", \"notes\": \"cracked directly into sauce\"} },\n { key: \"ingredient-crushed-tomatoes\", values: {\"recipe\": \"recipe-shakshuka\", \"ingredient_name\": \"crushed tomatoes\", \"quantity\": 1, \"unit\": \"can\", \"notes\": \"28 oz can\"} },\n ],\n },\n {\n token: \"shopping_lists\",\n name: \"Shopping lists\",\n labelSingular: \"Shopping list\",\n labelPlural: \"Shopping lists\",\n type: \"entity\",\n display: \"board\",\n weight: \"heavy\",\n ordered: false,\n icon: \"shopping-cart\",\n titleField: \"list_name\",\n describes: \"One list per shop per week, built from the recipes planned for that week.\",\n fields: [\n { key: \"list_name\", label: \"List\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"week_of\", label: \"Week of\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"store\", label: \"Shop\", parityType: \"select\", choices: [\"Fresh Market Co-op\", \"Lucky Star Asian Grocery\", \"Mercado Alvarado\", \"Costco\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Planning\", \"Ready to Shop\", \"Shopping\", \"Done\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"list-week-of-jun-1-mexican-night-weekday-soup\", values: {\"list_name\": \"Week of Jun 1 — Mexican night + weekday soup\", \"week_of\": \"2026-06-01\", \"store\": \"Mercado Alvarado\", \"status\": \"Done\"} },\n { key: \"list-week-of-jun-8-chinese-takeout-at-home\", values: {\"list_name\": \"Week of Jun 8 — Chinese takeout-at-home\", \"week_of\": \"2026-06-08\", \"store\": \"Lucky Star Asian Grocery\", \"status\": \"Done\"} },\n { key: \"list-week-of-jun-15-sunday-ragu-easy-weeknights\", values: {\"list_name\": \"Week of Jun 15 — Sunday ragu + easy weeknights\", \"week_of\": \"2026-06-15\", \"store\": \"Fresh Market Co-op\", \"status\": \"Done\"} },\n { key: \"list-week-of-jun-22-birthday-cake-week\", values: {\"list_name\": \"Week of Jun 22 — Birthday cake week\", \"week_of\": \"2026-06-22\", \"store\": \"Costco\", \"status\": \"Ready to Shop\"} },\n { key: \"list-week-of-jun-29-pozole-for-the-in-laws\", values: {\"list_name\": \"Week of Jun 29 — Pozole for the in-laws\", \"week_of\": \"2026-06-29\", \"store\": \"Mercado Alvarado\", \"status\": \"Planning\"} },\n ],\n },\n {\n token: \"shopping_list_items\",\n name: \"List items\",\n labelSingular: \"List item\",\n labelPlural: \"List items\",\n type: \"detail\",\n display: \"list\",\n weight: \"light\",\n ordered: true,\n icon: \"list-checks\",\n titleField: \"ingredient_name\",\n describes: \"What is actually on a list, by aisle, and whether it is already in the trolley.\",\n fields: [\n { key: \"shopping_list\", label: \"Shopping list\", parityType: \"relation\", required: true, relationTarget: \"shopping_lists\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"ingredient_name\", label: \"Ingredient\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"quantity\", label: \"Quantity\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"unit\", label: \"Unit\", parityType: \"select\", choices: [\"cup\", \"tbsp\", \"tsp\", \"oz\", \"lb\", \"clove\", \"whole\", \"can\", \"pinch\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"aisle\", label: \"Aisle\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"checked\", label: \"In the trolley\", parityType: \"select\", choices: [\"Yes\", \"No\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"item-tomatillos\", values: {\"shopping_list\": \"list-week-of-jun-1-mexican-night-weekday-soup\", \"ingredient_name\": \"tomatillos\", \"quantity\": 2, \"unit\": \"lb\", \"aisle\": \"Produce\", \"checked\": \"Yes\"} },\n { key: \"item-corn-tortillas\", values: {\"shopping_list\": \"list-week-of-jun-1-mexican-night-weekday-soup\", \"ingredient_name\": \"corn tortillas\", \"quantity\": 2, \"unit\": \"whole\", \"aisle\": \"Bakery\", \"checked\": \"Yes\"} },\n { key: \"item-queso-fresco\", values: {\"shopping_list\": \"list-week-of-jun-1-mexican-night-weekday-soup\", \"ingredient_name\": \"queso fresco\", \"quantity\": 8, \"unit\": \"oz\", \"aisle\": \"Dairy\", \"checked\": \"Yes\"} },\n { key: \"item-chicken-thighs\", values: {\"shopping_list\": \"list-week-of-jun-8-chinese-takeout-at-home\", \"ingredient_name\": \"chicken thighs\", \"quantity\": 1.5, \"unit\": \"lb\", \"aisle\": \"Meat\", \"checked\": \"Yes\"} },\n { key: \"item-dried-red-chilies\", values: {\"shopping_list\": \"list-week-of-jun-8-chinese-takeout-at-home\", \"ingredient_name\": \"dried red chilies\", \"quantity\": 1, \"unit\": \"oz\", \"aisle\": \"International\", \"checked\": \"Yes\"} },\n { key: \"item-sichuan-peppercorns\", values: {\"shopping_list\": \"list-week-of-jun-8-chinese-takeout-at-home\", \"ingredient_name\": \"Sichuan peppercorns\", \"quantity\": 1, \"unit\": \"oz\", \"aisle\": \"International\", \"checked\": \"No\"} },\n { key: \"item-bone-in-short-ribs\", values: {\"shopping_list\": \"list-week-of-jun-15-sunday-ragu-easy-weeknights\", \"ingredient_name\": \"bone-in short ribs\", \"quantity\": 3, \"unit\": \"lb\", \"aisle\": \"Meat\", \"checked\": \"Yes\"} },\n { key: \"item-san-marzano-tomatoes\", values: {\"shopping_list\": \"list-week-of-jun-15-sunday-ragu-easy-weeknights\", \"ingredient_name\": \"San Marzano tomatoes\", \"quantity\": 2, \"unit\": \"can\", \"aisle\": \"Canned Goods\", \"checked\": \"Yes\"} },\n { key: \"item-pecorino-romano\", values: {\"shopping_list\": \"list-week-of-jun-15-sunday-ragu-easy-weeknights\", \"ingredient_name\": \"pecorino romano\", \"quantity\": 1, \"unit\": \"lb\", \"aisle\": \"Dairy\", \"checked\": \"No\"} },\n { key: \"item-evaporated-milk\", values: {\"shopping_list\": \"list-week-of-jun-22-birthday-cake-week\", \"ingredient_name\": \"evaporated milk\", \"quantity\": 2, \"unit\": \"can\", \"aisle\": \"Baking\", \"checked\": \"No\"} },\n { key: \"item-sweetened-condensed-milk\", values: {\"shopping_list\": \"list-week-of-jun-22-birthday-cake-week\", \"ingredient_name\": \"sweetened condensed milk\", \"quantity\": 2, \"unit\": \"can\", \"aisle\": \"Baking\", \"checked\": \"No\"} },\n { key: \"item-pork-shoulder\", values: {\"shopping_list\": \"list-week-of-jun-29-pozole-for-the-in-laws\", \"ingredient_name\": \"pork shoulder\", \"quantity\": 3, \"unit\": \"lb\", \"aisle\": \"Meat\", \"checked\": \"No\"} },\n { key: \"item-hominy\", values: {\"shopping_list\": \"list-week-of-jun-29-pozole-for-the-in-laws\", \"ingredient_name\": \"hominy\", \"quantity\": 4, \"unit\": \"can\", \"aisle\": \"Canned Goods\", \"checked\": \"No\"} },\n { key: \"item-guajillo-chilies\", values: {\"shopping_list\": \"list-week-of-jun-29-pozole-for-the-in-laws\", \"ingredient_name\": \"guajillo chilies\", \"quantity\": 6, \"unit\": \"oz\", \"aisle\": \"International\", \"checked\": \"No\"} },\n ],\n },\n ],\n\n relationships: [\n {\n describes: \"An ingredient belongs to the recipe it is part of and means nothing without it.\",\n fromTable: \"ingredients\",\n fromField: \"recipe\",\n toTable: \"recipes\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"ingredients\",\n },\n {\n describes: \"A line on the shopping list belongs to the list it is written on.\",\n fromTable: \"shopping_list_items\",\n fromField: \"shopping_list\",\n toTable: \"shopping_lists\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"items\",\n },\n ],\n\n form: {\n token: \"alvarado_chen_add_a_recipe\",\n name: \"Add a recipe to the family collection\",\n describes:\n \"What anyone in the family fills in when a dish is worth keeping — including the grandparents, which is why it asks who brought it in.\",\n audience: \"member\",\n table: \"recipes\",\n fields: [\n { fieldKey: \"title\", label: \"What is it called?\", required: true },\n { fieldKey: \"category\", label: \"Course\", required: true },\n { fieldKey: \"cuisine\", label: \"Cuisine\" },\n { fieldKey: \"prep_minutes\", label: \"Prep time in minutes\", help: \"Chopping and mixing — everything before it goes on the heat.\" },\n { fieldKey: \"cook_minutes\", label: \"Cook time in minutes\" },\n { fieldKey: \"servings\", label: \"How many does it serve?\", required: true },\n { fieldKey: \"source\", label: \"Where did it come from?\", help: \"A book, a website, or a person. We like knowing.\" },\n { fieldKey: \"contributed_by\", label: \"Who brought it in?\", required: true },\n ],\n submitLabel: \"Add it to the collection\",\n confirmation:\n \"Added. Put the ingredients in next, and it will start showing up on the shopping list when you plan it for a week.\",\n },\n\n pipeline: {\n token: \"alvarado_chen_weekly_shop\",\n name: \"The weekly shop\",\n describes:\n \"A list's life is four days long and everybody in the house touches it. The stages exist so nobody buys the same bag of rice twice.\",\n table: \"shopping_lists\",\n stageField: \"status\",\n stages: [\n { key: \"Planning\", label: \"Planning\", describes: \"Meals are still being chosen, so the list is still growing. Nobody shops from it yet.\", typicalDurationDays: 3 },\n { key: \"Ready to Shop\", label: \"Ready to shop\", describes: \"The meals are settled and the list is complete. This is the state it is in when somebody picks up their keys.\", typicalDurationDays: 1 },\n { key: \"Shopping\", label: \"Shopping\", describes: \"Somebody is in the shop ticking things off. Anything added now is a genuine omission, not a change of plan.\", typicalDurationDays: 1 },\n { key: \"Done\", label: \"Done\", describes: \"Everything is home. Unticked items roll onto next week rather than being lost.\" },\n ],\n },\n\n dashboardQuestion: {\n question: \"Which of our recipes can we actually cook on a Tuesday?\",\n whyItMatters:\n \"Weeknight cooking fails on time, not on ideas. Knowing the average cook time by course is what stops a two-hour braise being planned for a school night, and it is the number that decides what goes on the list.\",\n table: \"recipes\",\n aggregate: \"avg\",\n of: \"cook_minutes\",\n groupBy: \"category\",\n answerUnit: \"minutes\",\n },\n\n documentTemplate: {\n token: \"alvarado_chen_recipe_card\",\n name: \"Printable recipe card\",\n describes:\n \"What gets printed and stuck to the fridge door, or sent to someone who asked for the recipe after dinner. It keeps the attribution, because half the collection came from somebody's mother.\",\n table: \"recipes\",\n title: \"{{recipe_title}} — serves {{servings}}\",\n body: [\n \"{{recipe_title}}\",\n \"\",\n \"{{course}} · {{cuisine}} · serves {{servings}}\",\n \"Prep {{prep_time}} minutes, cook {{cook_time}} minutes.\",\n \"\",\n \"From {{source}}, brought into the family by {{contributed_by}}.\",\n \"\",\n \"Ingredients are on the back. If you halve it, do not halve the salt by the same amount — taste it instead.\",\n \"\",\n \"{{household}} · printed {{today}}\",\n ].join(\"\\n\"),\n mergeFields: [\n { key: \"recipe_title\", from: \"title\", describes: \"The dish.\" },\n { key: \"course\", from: \"category\", describes: \"Which part of the meal it is.\" },\n { key: \"cuisine\", from: \"cuisine\", describes: \"Where it comes from.\" },\n { key: \"servings\", from: \"servings\", describes: \"How many it feeds, so it can be scaled.\" },\n { key: \"prep_time\", from: \"prep_minutes\", describes: \"Minutes before it goes on the heat.\" },\n { key: \"cook_time\", from: \"cook_minutes\", describes: \"Minutes on the heat.\" },\n { key: \"source\", from: \"source\", describes: \"The book, site or person it came from.\" },\n { key: \"contributed_by\", from: \"contributed_by\", describes: \"Who brought it into the family.\" },\n { key: \"household\", from: \"business\", describes: \"Whose kitchen this is.\" },\n { key: \"today\", from: \"today\", describes: \"When the card was printed.\" },\n ],\n },\n\n notificationRule: {\n token: \"alvarado_chen_list_is_ready\",\n name: \"The list is ready to shop\",\n describes:\n \"The one message this household would genuinely set up: whoever is going to the shop needs to know the list stopped changing, because the whole failure mode is leaving with a list somebody was still editing.\",\n when: {\n table: \"shopping_lists\",\n event: \"stage_entered\",\n stage: \"Ready to Shop\",\n },\n audience: \"whoever is doing the shop this week\",\n channel: \"in_app\",\n message:\n \"{{list_name}} for the week of {{week_of}} is finished and ready — {{store}}. Tick things off as you go so nobody buys them twice.\",\n },\n\n provenance: {\n kind: \"synthesized\",\n authoredBy: \"data crew (dataset) + lane REAL-DATA (business identity, relationships, form, pipeline, dashboard question, document, notification rule)\",\n authoredOn: \"2026-09-21\",\n noRealPeople: true,\n },\n};\n\nexport default useCase;\n","// src/use-cases/birchwood-avenue-renovation-budget.ts — @ai-matrx/records/use-cases\n//\n// THE USE CASE: Marguerite Oyelowo is renovating a 1920s house one room at a\n// time, and she uses this to hold every contractor quote against the room it is\n// for and every receipt against the budget she set — so that \"are we over?\" has\n// an answer instead of an argument.\n//\n// A homeowner is not a company, and that is the point: the platform is only\n// true to its claim if somebody with no staff and no software budget can model\n// their own project in it.\n//\n// PROVENANCE. Tables, fields and rows come from the data crew's dataset\n// `matrx-frontend/scripts/campaign-tests/use-cases/home-renovation.json`.\n// Fixed on adoption: the project was \"Birchwood Ave Renovation (test fixture)\";\n// relations pointed at a room's NAME and a contractor's COMPANY NAME rather than\n// at the row; and the crew's `insured` boolean became a two-way choice, because\n// THE STORE HAS NO BOOLEAN — its thirteen parity types are closed and none of\n// them is a checkbox, so a yes/no is a choice of two. The business identity,\n// relationships, form, pipeline, dashboard question, document and notification\n// rule were written for this file.\n//\n// Every contractor, licence number and mailbox here is invented.\n\nimport type { UseCase } from \"./types\";\n\nexport const useCase: UseCase = {\n id: \"birchwood-avenue-renovation-budget\",\n useCase:\n \"Marguerite Oyelowo is renovating a 1920s house one room at a time, and she uses this to hold every contractor quote against the room it is for and every receipt against the budget she set, so that whether the job is over budget has an answer instead of an argument.\",\n industry: \"Home renovation\",\n cleanupTag: \"use-case:birchwood-avenue-renovation-budget\",\n\n business: {\n name: \"Birchwood Avenue Renovation\",\n describes: \"A owner-managed whole-house renovation of a 1920s four-bedroom, run room by room over about a year.\",\n address: {\n line1: \"417 Birchwood Avenue\",\n city: \"Providence\",\n region: \"RI\",\n postalCode: \"02906\",\n country: \"US\",\n },\n phone: \"+1 401 555 0188\",\n email: \"marguerite@birchwoodreno.net\",\n timezone: \"America/New_York\",\n },\n\n tables: [\n {\n token: \"rooms\",\n name: \"Rooms\",\n labelSingular: \"Room\",\n labelPlural: \"Rooms\",\n type: \"entity\",\n display: \"board\",\n weight: \"heavy\",\n ordered: true,\n icon: \"door-open\",\n titleField: \"room_name\",\n describes: \"The house, room by room: what is being done to each one, when, and for how much.\",\n fields: [\n { key: \"room_name\", label: \"Room\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"project_scope\", label: \"Scope of work\", parityType: \"long_text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"target_start\", label: \"Target start\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"target_end\", label: \"Target finish\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Planning\", \"Quoting\", \"In Progress\", \"Complete\", \"On Hold\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"budget\", label: \"Budget\", parityType: \"currency\", unit: \"USD\", format: \"currency\", sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n ],\n rows: [\n { key: \"room-kitchen\", values: {\"room_name\": \"Kitchen\", \"project_scope\": \"Full gut renovation: new cabinets, quartz counters, relocate island, new appliances.\", \"target_start\": \"2026-04-01\", \"target_end\": \"2026-06-15\", \"status\": \"Complete\", \"budget\": 48000.0} },\n { key: \"room-primary-bathroom\", values: {\"room_name\": \"Primary Bathroom\", \"project_scope\": \"Replace tub with walk-in shower, new vanity, heated tile floor.\", \"target_start\": \"2026-06-20\", \"target_end\": \"2026-08-01\", \"status\": \"In Progress\", \"budget\": 22500.0} },\n { key: \"room-basement\", values: {\"room_name\": \"Basement\", \"project_scope\": \"Finish unfinished basement into family room and home office, add egress window.\", \"target_start\": \"2026-08-10\", \"target_end\": \"2026-11-15\", \"status\": \"Quoting\", \"budget\": 61000.0} },\n { key: \"room-guest-bathroom\", values: {\"room_name\": \"Guest Bathroom\", \"project_scope\": \"Cosmetic refresh: new vanity, paint, light fixtures.\", \"target_start\": \"2026-09-01\", \"target_end\": \"2026-09-20\", \"status\": \"Planning\", \"budget\": 6500.0} },\n { key: \"room-backyard-deck\", values: {\"room_name\": \"Backyard Deck\", \"project_scope\": \"Tear off old wood deck, build composite deck with pergola.\", \"target_start\": \"2026-05-01\", \"target_end\": \"2026-06-01\", \"status\": \"Complete\", \"budget\": 18000.0} },\n { key: \"room-garage\", values: {\"room_name\": \"Garage\", \"project_scope\": \"Epoxy floor, built-in storage, new insulated door.\", \"target_start\": \"2026-10-01\", \"target_end\": \"2026-10-20\", \"status\": \"On Hold\", \"budget\": 9500.0} },\n ],\n },\n {\n token: \"contractors\",\n name: \"Contractors\",\n labelSingular: \"Contractor\",\n labelPlural: \"Contractors\",\n type: \"entity\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"hard-hat\",\n titleField: \"company_name\",\n describes: \"Everyone quoting or working on the job, with the licence and insurance details that matter if something goes wrong.\",\n fields: [\n { key: \"company_name\", label: \"Company\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"trade\", label: \"Trade\", parityType: \"select\", choices: [\"General Contractor\", \"Plumbing\", \"Electrical\", \"Flooring\", \"Painting\", \"HVAC\", \"Carpentry\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"contact_name\", label: \"Contact\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"phone\", label: \"Phone\", parityType: \"phone\", format: \"phone\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"email\", label: \"Email\", parityType: \"email\", format: \"email\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"license_number\", label: \"Licence number\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"insured\", label: \"Insured\", parityType: \"select\", choices: [\"Yes\", \"No\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"contractor-ferro-sons-construction\", values: {\"company_name\": \"Ferro & Sons Construction\", \"trade\": \"General Contractor\", \"contact_name\": \"Dominic Ferro\", \"phone\": \"555-330-1001\", \"email\": \"dominic@northshoremail.com\", \"license_number\": \"GC-88213-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-redline-plumbing-co\", values: {\"company_name\": \"Redline Plumbing Co.\", \"trade\": \"Plumbing\", \"contact_name\": \"Tanya Iversen\", \"phone\": \"555-330-1002\", \"email\": \"tanya@northshoremail.com\", \"license_number\": \"PL-44029-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-voltway-electric\", values: {\"company_name\": \"Voltway Electric\", \"trade\": \"Electrical\", \"contact_name\": \"Emeka Osayande\", \"phone\": \"555-330-1003\", \"email\": \"emeka@northshoremail.com\", \"license_number\": \"EL-90117-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-hearthstone-flooring\", values: {\"company_name\": \"Hearthstone Flooring\", \"trade\": \"Flooring\", \"contact_name\": \"Bianca Moretti\", \"phone\": \"555-330-1004\", \"email\": \"bianca@northshoremail.com\", \"license_number\": \"FL-22850-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-clearcoat-painting\", values: {\"company_name\": \"Clearcoat Painting\", \"trade\": \"Painting\", \"contact_name\": \"Sam Delacroix\", \"phone\": \"555-330-1005\", \"email\": \"sam@northshoremail.com\", \"license_number\": \"PT-10442-OH\", \"insured\": \"No\"} },\n { key: \"contractor-northgate-hvac\", values: {\"company_name\": \"Northgate HVAC\", \"trade\": \"HVAC\", \"contact_name\": \"Renata Kowalczyk\", \"phone\": \"555-330-1006\", \"email\": \"renata@northshoremail.com\", \"license_number\": \"HV-77302-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-millbrook-carpentry\", values: {\"company_name\": \"Millbrook Carpentry\", \"trade\": \"Carpentry\", \"contact_name\": \"Julius Wexford\", \"phone\": \"555-330-1007\", \"email\": \"julius@northshoremail.com\", \"license_number\": \"CP-55671-OH\", \"insured\": \"Yes\"} },\n ],\n },\n {\n token: \"quotes\",\n name: \"Quotes\",\n labelSingular: \"Quote\",\n labelPlural: \"Quotes\",\n type: \"ledger\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"file-text\",\n titleField: \"quote_amount\",\n describes: \"What each trade said each room would cost, and whether that price is still good.\",\n fields: [\n { key: \"room\", label: \"Room\", parityType: \"relation\", required: true, relationTarget: \"rooms\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"contractor\", label: \"Contractor\", parityType: \"relation\", required: true, relationTarget: \"contractors\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"quote_amount\", label: \"Quote\", parityType: \"currency\", unit: \"USD\", format: \"currency\", required: true, sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"quote_date\", label: \"Quoted on\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Pending\", \"Accepted\", \"Rejected\", \"Expired\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"valid_until\", label: \"Valid until\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"quote-46500-0\", values: {\"room\": \"room-kitchen\", \"contractor\": \"contractor-ferro-sons-construction\", \"quote_amount\": 46500.0, \"quote_date\": \"2026-02-14\", \"status\": \"Accepted\", \"valid_until\": \"2026-03-14\"} },\n { key: \"quote-3200-0\", values: {\"room\": \"room-kitchen\", \"contractor\": \"contractor-redline-plumbing-co\", \"quote_amount\": 3200.0, \"quote_date\": \"2026-02-20\", \"status\": \"Accepted\", \"valid_until\": \"2026-03-20\"} },\n { key: \"quote-2800-0\", values: {\"room\": \"room-kitchen\", \"contractor\": \"contractor-voltway-electric\", \"quote_amount\": 2800.0, \"quote_date\": \"2026-02-20\", \"status\": \"Accepted\", \"valid_until\": \"2026-03-20\"} },\n { key: \"quote-21000-0\", values: {\"room\": \"room-primary-bathroom\", \"contractor\": \"contractor-ferro-sons-construction\", \"quote_amount\": 21000.0, \"quote_date\": \"2026-05-10\", \"status\": \"Accepted\", \"valid_until\": \"2026-06-10\"} },\n { key: \"quote-4100-0\", values: {\"room\": \"room-primary-bathroom\", \"contractor\": \"contractor-redline-plumbing-co\", \"quote_amount\": 4100.0, \"quote_date\": \"2026-05-11\", \"status\": \"Accepted\", \"valid_until\": \"2026-06-11\"} },\n { key: \"quote-58000-0\", values: {\"room\": \"room-basement\", \"contractor\": \"contractor-ferro-sons-construction\", \"quote_amount\": 58000.0, \"quote_date\": \"2026-07-20\", \"status\": \"Pending\", \"valid_until\": \"2026-08-20\"} },\n { key: \"quote-12500-0\", values: {\"room\": \"room-basement\", \"contractor\": \"contractor-millbrook-carpentry\", \"quote_amount\": 12500.0, \"quote_date\": \"2026-07-22\", \"status\": \"Pending\", \"valid_until\": \"2026-08-22\"} },\n { key: \"quote-6800-0\", values: {\"room\": \"room-basement\", \"contractor\": \"contractor-northgate-hvac\", \"quote_amount\": 6800.0, \"quote_date\": \"2026-07-25\", \"status\": \"Pending\", \"valid_until\": \"2026-08-25\"} },\n { key: \"quote-1800-0\", values: {\"room\": \"room-guest-bathroom\", \"contractor\": \"contractor-hearthstone-flooring\", \"quote_amount\": 1800.0, \"quote_date\": \"2026-07-28\", \"status\": \"Pending\", \"valid_until\": \"2026-08-28\"} },\n { key: \"quote-17200-0\", values: {\"room\": \"room-backyard-deck\", \"contractor\": \"contractor-millbrook-carpentry\", \"quote_amount\": 17200.0, \"quote_date\": \"2026-03-05\", \"status\": \"Accepted\", \"valid_until\": \"2026-04-05\"} },\n { key: \"quote-19800-0\", values: {\"room\": \"room-backyard-deck\", \"contractor\": \"contractor-ferro-sons-construction\", \"quote_amount\": 19800.0, \"quote_date\": \"2026-03-02\", \"status\": \"Rejected\", \"valid_until\": \"2026-04-02\"} },\n { key: \"quote-2100-0\", values: {\"room\": \"room-garage\", \"contractor\": \"contractor-clearcoat-painting\", \"quote_amount\": 2100.0, \"quote_date\": \"2026-01-15\", \"status\": \"Expired\", \"valid_until\": \"2026-02-15\"} },\n ],\n },\n {\n token: \"purchases\",\n name: \"Purchases\",\n labelSingular: \"Purchase\",\n labelPlural: \"Purchases\",\n type: \"ledger\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"receipt\",\n titleField: \"item_description\",\n describes: \"Every pound spent against the project, so the budget is a fact rather than a feeling.\",\n fields: [\n { key: \"room\", label: \"Room\", parityType: \"relation\", required: true, relationTarget: \"rooms\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"item_description\", label: \"What was bought\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"vendor\", label: \"Vendor\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"purchase_date\", label: \"Bought on\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"amount\", label: \"Amount\", parityType: \"currency\", unit: \"USD\", format: \"currency\", sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"category\", label: \"Category\", parityType: \"select\", choices: [\"Materials\", \"Fixtures\", \"Labor\", \"Permits\", \"Appliances\", \"Design/Design Fees\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"receipt_number\", label: \"Receipt\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"purchase-custom-shaker-cabinets-painted-alabaster\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Custom shaker cabinets, painted 'Alabaster'\", \"vendor\": \"Millbrook Cabinetry Supply\", \"purchase_date\": \"2026-04-05\", \"amount\": 14200.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10021\"} },\n { key: \"purchase-quartz-countertop-calacatta-gold-42-sq-ft\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Quartz countertop, 'Calacatta Gold' 42 sq ft\", \"vendor\": \"Stone Depot\", \"purchase_date\": \"2026-04-18\", \"amount\": 5900.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10022\"} },\n { key: \"purchase-range-refrigerator-dishwasher-package\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Range, refrigerator, dishwasher package\", \"vendor\": \"Coldstream Appliance Center\", \"purchase_date\": \"2026-04-22\", \"amount\": 8700.0, \"category\": \"Appliances\", \"receipt_number\": \"RCT-10023\"} },\n { key: \"purchase-building-permit-kitchen-remodel\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Building permit — kitchen remodel\", \"vendor\": \"City of Fairmont Permits Office\", \"purchase_date\": \"2026-03-28\", \"amount\": 450.0, \"category\": \"Permits\", \"receipt_number\": \"RCT-10024\"} },\n { key: \"purchase-ferro-sons-final-labor-invoice\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Ferro & Sons — final labor invoice\", \"vendor\": \"Ferro & Sons Construction\", \"purchase_date\": \"2026-06-15\", \"amount\": 15800.0, \"category\": \"Labor\", \"receipt_number\": \"RCT-10025\"} },\n { key: \"purchase-walk-in-shower-kit-with-frameless-glass\", values: {\"room\": \"room-primary-bathroom\", \"item_description\": \"Walk-in shower kit with frameless glass\", \"vendor\": \"Stone Depot\", \"purchase_date\": \"2026-06-25\", \"amount\": 4300.0, \"category\": \"Fixtures\", \"receipt_number\": \"RCT-10026\"} },\n { key: \"purchase-heated-floor-mat-system-45-sq-ft\", values: {\"room\": \"room-primary-bathroom\", \"item_description\": \"Heated floor mat system, 45 sq ft\", \"vendor\": \"WarmFloor Direct\", \"purchase_date\": \"2026-06-28\", \"amount\": 1650.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10027\"} },\n { key: \"purchase-floating-double-vanity-60-inch\", values: {\"room\": \"room-primary-bathroom\", \"item_description\": \"Floating double vanity, 60 inch\", \"vendor\": \"Millbrook Cabinetry Supply\", \"purchase_date\": \"2026-07-02\", \"amount\": 2200.0, \"category\": \"Fixtures\", \"receipt_number\": \"RCT-10028\"} },\n { key: \"purchase-composite-decking-600-sq-ft-weathered-teak\", values: {\"room\": \"room-backyard-deck\", \"item_description\": \"Composite decking, 600 sq ft, 'Weathered Teak'\", \"vendor\": \"Deckmaster Supply\", \"purchase_date\": \"2026-05-05\", \"amount\": 8900.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10029\"} },\n { key: \"purchase-cedar-pergola-kit-12x14\", values: {\"room\": \"room-backyard-deck\", \"item_description\": \"Cedar pergola kit, 12x14\", \"vendor\": \"Deckmaster Supply\", \"purchase_date\": \"2026-05-08\", \"amount\": 3200.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10030\"} },\n { key: \"purchase-millbrook-carpentry-labor-and-install\", values: {\"room\": \"room-backyard-deck\", \"item_description\": \"Millbrook Carpentry — labor and install\", \"vendor\": \"Millbrook Carpentry\", \"purchase_date\": \"2026-06-01\", \"amount\": 4900.0, \"category\": \"Labor\", \"receipt_number\": \"RCT-10031\"} },\n { key: \"purchase-design-consultation-fixture-layout\", values: {\"room\": \"room-guest-bathroom\", \"item_description\": \"Design consultation — fixture layout\", \"vendor\": \"Bianca Moretti Interiors\", \"purchase_date\": \"2026-07-30\", \"amount\": 350.0, \"category\": \"Design/Design Fees\", \"receipt_number\": \"RCT-10032\"} },\n ],\n },\n ],\n\n relationships: [\n {\n describes: \"A quote is for exactly one room, and it is meaningless once that room is out of scope.\",\n fromTable: \"quotes\",\n fromField: \"room\",\n toTable: \"rooms\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"quotes\",\n },\n {\n describes: \"A quote comes from one contractor, who goes on existing after the quote is rejected.\",\n fromTable: \"quotes\",\n fromField: \"contractor\",\n toTable: \"contractors\",\n flavor: \"referenced\",\n cardinality: \"one\",\n onDelete: \"restrict\",\n inverseKey: \"quotes_given\",\n },\n {\n describes: \"A purchase is charged against the room it was bought for, which is how the budget stays honest.\",\n fromTable: \"purchases\",\n fromField: \"room\",\n toTable: \"rooms\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"purchases\",\n },\n ],\n\n form: {\n token: \"birchwood_contractor_details\",\n name: \"Contractor details and insurance\",\n describes:\n \"What a trade fills in before they are allowed to quote. It asks for the licence number and the insurance because those are the two things nobody can produce after something goes wrong.\",\n audience: \"public\",\n table: \"contractors\",\n fields: [\n { fieldKey: \"company_name\", label: \"Company name\", required: true },\n { fieldKey: \"trade\", label: \"Trade\", required: true },\n { fieldKey: \"contact_name\", label: \"Who should I ask for?\", required: true },\n { fieldKey: \"phone\", label: \"Best number\", required: true },\n { fieldKey: \"email\", label: \"Email\", required: true },\n { fieldKey: \"license_number\", label: \"Licence number\", required: true, help: \"I check this with the state board before accepting a quote.\" },\n { fieldKey: \"insured\", label: \"Do you carry liability insurance?\", required: true, help: \"I will ask for the certificate before work starts.\" },\n ],\n submitLabel: \"Send my details\",\n confirmation:\n \"Thank you. I will check the licence and come back to you about which rooms I would like quoted, usually within a few days.\",\n },\n\n pipeline: {\n token: \"birchwood_room_progress\",\n name: \"Room by room\",\n describes:\n \"Where each room stands. The board exists because a whole-house renovation is really five small projects at different stages, and the only way to stay sane is to look at them side by side.\",\n table: \"rooms\",\n stageField: \"status\",\n stages: [\n { key: \"Planning\", label: \"Planning\", describes: \"Scope is still being decided. Nothing has been priced, so the budget figure is a guess.\", typicalDurationDays: 21 },\n { key: \"Quoting\", label: \"Quoting\", describes: \"Trades are pricing it. Leaves when a quote is accepted — or when every quote comes back over budget and the scope goes back to Planning.\", typicalDurationDays: 21 },\n { key: \"In Progress\", label: \"In progress\", describes: \"Work has started and receipts are landing against this room. This is where the budget is actually won or lost.\", typicalDurationDays: 45 },\n { key: \"On Hold\", label: \"On hold\", describes: \"Stopped for money, a permit or a lead time. Named honestly so it is not mistaken for progress.\", typicalDurationDays: 30 },\n { key: \"Complete\", label: \"Complete\", describes: \"Finished, paid and signed off. The room's spend is final and can be compared against what was budgeted.\" },\n ],\n },\n\n dashboardQuestion: {\n question: \"What have I actually spent on each room so far?\",\n whyItMatters:\n \"The budget was set room by room, so the only useful comparison is room by room. This is the number that decides whether the next room starts on schedule or waits, and it is the one thing a spreadsheet stops being trusted for once there are more than about thirty receipts.\",\n table: \"purchases\",\n aggregate: \"sum\",\n of: \"amount\",\n groupBy: \"room\",\n answerUnit: \"USD\",\n },\n\n documentTemplate: {\n token: \"birchwood_quote_acceptance\",\n name: \"Quote acceptance\",\n describes:\n \"Sent to a contractor when their price is accepted. It restates the number, the room and the date the quote was given, because a renovation dispute is almost always about which version of the price was agreed.\",\n table: \"quotes\",\n title: \"Accepting your quote of {{amount}}\",\n body: [\n \"Thank you for quoting.\",\n \"\",\n \"I am accepting your price of {{amount}}, quoted on {{quoted_on}} and valid until {{valid_until}}, for the work we discussed.\",\n \"\",\n \"Before anything starts I will need a copy of your certificate of insurance. Materials I have bought myself are already on site; anything else is yours to supply and appears on your invoice, not on my receipts.\",\n \"\",\n \"If the scope changes once the wall is open — and on a house this age it usually does — please price the change and send it to me before carrying it out. I would rather approve a second number than argue about a bigger one later.\",\n \"\",\n \"{{project}}\",\n \"{{project_phone}}\",\n \"{{today}}\",\n ].join(\"\\n\"),\n mergeFields: [\n { key: \"amount\", from: \"quote_amount\", describes: \"The accepted price, restated so there is one version of it.\" },\n { key: \"quoted_on\", from: \"quote_date\", describes: \"Which quote this is, when a trade has given several.\" },\n { key: \"valid_until\", from: \"valid_until\", describes: \"The date the price was good until.\" },\n { key: \"project\", from: \"business\", describes: \"The project name.\" },\n { key: \"project_phone\", from: \"business\", describes: \"The number to call back on.\" },\n { key: \"today\", from: \"today\", describes: \"The date of acceptance.\" },\n ],\n },\n\n notificationRule: {\n token: \"birchwood_quote_expiring\",\n name: \"A quote is about to expire\",\n describes:\n \"Quotes are good for thirty days and a renovation moves slower than that, so the default outcome is re-pricing everything at a worse number. A week's warning is what prevents it, and it is the first thing any homeowner would automate.\",\n when: {\n table: \"quotes\",\n event: \"due\",\n field: \"valid_until\",\n daysBefore: 7,\n },\n audience: \"the homeowner\",\n channel: \"email\",\n message:\n \"The quote of {{quote_amount}} expires on {{valid_until}} — about a week from now. Accept it, or ask for it to be held, before it has to be re-priced.\",\n },\n\n provenance: {\n kind: \"synthesized\",\n authoredBy: \"data crew (dataset) + lane REAL-DATA (business identity, relationships, form, pipeline, dashboard question, document, notification rule)\",\n authoredOn: \"2026-09-21\",\n noRealPeople: true,\n },\n};\n\nexport default useCase;\n","// src/use-cases/harbor-dental-new-patient-intake.ts — @ai-matrx/records/use-cases\n//\n// THE USE CASE: Renata Okonkwo runs the front desk at Harbor Dental Group, a\n// six-chair family dental practice, and she uses this to take a new patient\n// from the first phone call through forms, insurance verification and a booked\n// first visit without anything falling between the cracks.\n//\n// Every person, address, phone number, mailbox and member id below is invented.\n// Nothing here is copied from a real patient, a real practice or a real inbox.\n\nimport type { UseCase } from \"./types\";\n\nexport const useCase: UseCase = {\n id: \"harbor-dental-new-patient-intake\",\n useCase:\n \"Renata Okonkwo runs the front desk at Harbor Dental Group, a six-chair family dental practice, and she uses this to take a new patient from the first phone call through forms, insurance verification and a booked first visit without anything falling between the cracks.\",\n industry: \"Dentistry\",\n cleanupTag: \"use-case:harbor-dental-new-patient-intake\",\n\n business: {\n name: \"Harbor Dental Group\",\n legalName: \"Harbor Dental Group, PLLC\",\n describes: \"A six-chair family dental practice doing general dentistry, hygiene and same-day crowns.\",\n address: {\n line1: \"1840 Waterfront Parkway\",\n line2: \"Suite 210\",\n city: \"Bellingham\",\n region: \"WA\",\n postalCode: \"98225\",\n country: \"US\",\n },\n phone: \"+1 360 555 0142\",\n website: \"https://harbordentalgroup.com\",\n email: \"frontdesk@harbordentalgroup.com\",\n timezone: \"America/Los_Angeles\",\n },\n\n tables: [\n {\n token: \"patient\",\n name: \"Patients\",\n labelSingular: \"Patient\",\n labelPlural: \"Patients\",\n type: \"entity\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"user-round\",\n titleField: \"full_name\",\n describes: \"Everyone the practice treats, from the first enquiry through to an active chart.\",\n fields: [\n {\n key: \"full_name\",\n label: \"Patient name\",\n parityType: \"text\",\n required: true,\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"chart_number\",\n label: \"Chart number\",\n parityType: \"text\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n help: \"Assigned when the chart is opened. Printed on every claim and referral.\",\n },\n {\n key: \"date_of_birth\",\n label: \"Date of birth\",\n parityType: \"datetime\",\n format: \"date\",\n sensitivity: \"confidential\",\n contextPolicy: \"exclude\",\n help: \"Carriers verify eligibility on name plus date of birth, so it has to be exact.\",\n },\n {\n key: \"phone\",\n label: \"Mobile phone\",\n parityType: \"phone\",\n format: \"phone\",\n sensitivity: \"confidential\",\n contextPolicy: \"exclude\",\n },\n {\n key: \"email\",\n label: \"Email\",\n parityType: \"email\",\n format: \"email\",\n sensitivity: \"confidential\",\n contextPolicy: \"exclude\",\n },\n {\n key: \"street\",\n label: \"Street address\",\n parityType: \"text\",\n sensitivity: \"confidential\",\n contextPolicy: \"exclude\",\n },\n {\n key: \"city\",\n label: \"City\",\n parityType: \"text\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"region\",\n label: \"State\",\n parityType: \"text\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"postal_code\",\n label: \"ZIP\",\n parityType: \"text\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"intake_stage\",\n label: \"Intake stage\",\n parityType: \"select\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\n \"Enquiry\",\n \"Forms sent\",\n \"Forms received\",\n \"Insurance verified\",\n \"First visit booked\",\n \"Active patient\",\n ],\n help: \"Where this person is between the first call and a chart the hygienist can work from.\",\n },\n {\n key: \"insurance_carrier\",\n label: \"Insurance carrier\",\n parityType: \"select\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n choices: [\"Delta Dental\", \"Cigna Dental\", \"MetLife\", \"Guardian\", \"Aetna\", \"Self-pay\"],\n },\n {\n key: \"member_id\",\n label: \"Member ID\",\n parityType: \"text\",\n sensitivity: \"restricted\",\n contextPolicy: \"exclude\",\n help: \"Never leaves the practice. Needed to verify eligibility before the first visit.\",\n },\n {\n key: \"primary_dentist\",\n label: \"Primary dentist\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Dr. Alina Reyes\", \"Dr. Marcus Webb\"],\n },\n {\n key: \"allergies\",\n label: \"Known allergies\",\n parityType: \"multi_select\",\n multi: true,\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n choices: [\n \"Penicillin\",\n \"Latex\",\n \"Codeine\",\n \"Sulfa drugs\",\n \"Local anaesthetic\",\n \"None reported\",\n ],\n help: \"Read out loud at chairside before any injection.\",\n },\n {\n key: \"balance_due\",\n label: \"Balance due\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"referred_by\",\n label: \"How they found us\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\n \"Existing patient referral\",\n \"Insurance directory\",\n \"Web search\",\n \"Walk-in\",\n \"Employer benefits fair\",\n ],\n },\n {\n key: \"front_desk_notes\",\n label: \"Front desk notes\",\n parityType: \"long_text\",\n sensitivity: \"confidential\",\n contextPolicy: \"on_request\",\n },\n ],\n rows: [\n {\n key: \"patient-rivera-marisol\",\n values: {\n full_name: \"Marisol Rivera\",\n chart_number: \"HD-10428\",\n date_of_birth: \"1988-03-17\",\n phone: \"+1 360 555 0184\",\n email: \"m.rivera@northshoremail.com\",\n street: \"4417 Chuckanut Ridge Road\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98229\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Delta Dental\",\n member_id: \"DD-884201773\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"Penicillin\"],\n balance_due: 0,\n referred_by: \"Existing patient referral\",\n front_desk_notes: \"Prefers early morning. Two children also seen here.\",\n },\n },\n {\n key: \"patient-oyelaran-tunde\",\n values: {\n full_name: \"Tunde Oyelaran\",\n chart_number: \"HD-10431\",\n date_of_birth: \"1975-11-02\",\n phone: \"+1 360 555 0219\",\n email: \"toyelaran@baysidedesignco.com\",\n street: \"902 Eldridge Avenue\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Cigna Dental\",\n member_id: \"CG-4471209\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"None reported\"],\n balance_due: 142.5,\n referred_by: \"Insurance directory\",\n front_desk_notes: \"Travels for work; wants visits batched into one afternoon.\",\n },\n },\n {\n key: \"patient-halvorsen-britt\",\n values: {\n full_name: \"Britt Halvorsen\",\n chart_number: \"HD-10455\",\n date_of_birth: \"1992-07-26\",\n phone: \"+1 360 555 0177\",\n email: \"britt.halvorsen@cascadiaoutfitters.com\",\n street: \"215 Harris Avenue\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"First visit booked\",\n insurance_carrier: \"MetLife\",\n member_id: \"ML-63902118\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"Latex\"],\n balance_due: 0,\n referred_by: \"Web search\",\n front_desk_notes: \"Latex allergy flagged to the back office; nitrile only.\",\n },\n },\n {\n key: \"patient-nakamura-kenji\",\n values: {\n full_name: \"Kenji Nakamura\",\n chart_number: \"HD-10460\",\n date_of_birth: \"1964-01-09\",\n phone: \"+1 360 555 0263\",\n email: \"k.nakamura@harborviewcpa.com\",\n street: \"1130 Yew Street\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98229\",\n intake_stage: \"Insurance verified\",\n insurance_carrier: \"Guardian\",\n member_id: \"GD-20117744\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"Codeine\"],\n balance_due: 0,\n referred_by: \"Employer benefits fair\",\n front_desk_notes: \"Eligibility confirmed through December. Waiting on his schedule to book.\",\n },\n },\n {\n key: \"patient-abadi-leila\",\n values: {\n full_name: \"Leila Abadi\",\n chart_number: \"HD-10462\",\n date_of_birth: \"1997-05-30\",\n phone: \"+1 360 555 0308\",\n email: \"leila.abadi@westwindstudio.com\",\n street: \"77 Fairhaven Parkway\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Forms received\",\n insurance_carrier: \"Aetna\",\n member_id: \"AE-55823094\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Existing patient referral\",\n front_desk_notes: \"Forms in. Needs eligibility checked before we offer a slot.\",\n },\n },\n {\n key: \"patient-delacroix-yvon\",\n values: {\n full_name: \"Yvon Delacroix\",\n chart_number: \"HD-10466\",\n date_of_birth: \"1981-09-14\",\n phone: \"+1 360 555 0341\",\n email: \"yvon.delacroix@pugetsoundfreight.com\",\n street: \"3320 Northwest Avenue\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Forms sent\",\n insurance_carrier: \"Delta Dental\",\n member_id: \"DD-884977120\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Insurance directory\",\n front_desk_notes: \"Packet emailed Tuesday. Follow up if nothing back by Friday.\",\n },\n },\n {\n key: \"patient-strand-ingrid\",\n values: {\n full_name: \"Ingrid Strand\",\n chart_number: \"HD-10470\",\n date_of_birth: \"1955-12-04\",\n phone: \"+1 360 555 0392\",\n email: \"ingrid.strand@northshoremail.com\",\n street: \"618 Alabama Street\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Self-pay\",\n member_id: \"\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"Sulfa drugs\", \"Local anaesthetic\"],\n balance_due: 880,\n referred_by: \"Walk-in\",\n front_desk_notes: \"On a payment plan for the crown. Anaesthetic sensitivity — Dr. Reyes is aware.\",\n },\n },\n {\n key: \"patient-mbeki-sipho\",\n values: {\n full_name: \"Sipho Mbeki\",\n chart_number: \"HD-10473\",\n date_of_birth: \"2001-02-21\",\n phone: \"+1 360 555 0415\",\n email: \"sipho.mbeki@wwu-alumni.com\",\n street: \"1502 Indian Street\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Enquiry\",\n insurance_carrier: \"Self-pay\",\n member_id: \"\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Web search\",\n front_desk_notes: \"Called about a chipped incisor. Quoted the emergency exam fee.\",\n },\n },\n {\n key: \"patient-kowalczyk-agata\",\n values: {\n full_name: \"Agata Kowalczyk\",\n chart_number: \"HD-10477\",\n date_of_birth: \"1986-06-11\",\n phone: \"+1 360 555 0448\",\n email: \"a.kowalczyk@evergreenlabsupply.com\",\n street: \"2245 Cornwall Avenue\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Cigna Dental\",\n member_id: \"CG-4488317\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"None reported\"],\n balance_due: 64,\n referred_by: \"Existing patient referral\",\n front_desk_notes: \"Night guard impressions taken; lab case out.\",\n },\n },\n {\n key: \"patient-ferreira-joao\",\n values: {\n full_name: \"João Ferreira\",\n chart_number: \"HD-10481\",\n date_of_birth: \"1970-08-19\",\n phone: \"+1 360 555 0472\",\n email: \"joao.ferreira@harborlinemarine.com\",\n street: \"840 Marine Drive\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Insurance verified\",\n insurance_carrier: \"MetLife\",\n member_id: \"ML-63988402\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"Penicillin\", \"Latex\"],\n balance_due: 0,\n referred_by: \"Employer benefits fair\",\n front_desk_notes: \"Two allergies on file. Wants the first available Thursday.\",\n },\n },\n {\n key: \"patient-whitehorse-dara\",\n values: {\n full_name: \"Dara Whitehorse\",\n chart_number: \"HD-10484\",\n date_of_birth: \"1994-04-07\",\n phone: \"+1 360 555 0501\",\n email: \"dara.whitehorse@salishseaarts.com\",\n street: \"506 Girard Street\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"First visit booked\",\n insurance_carrier: \"Guardian\",\n member_id: \"GD-20166018\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Web search\",\n front_desk_notes: \"Booked for the new patient exam and a cleaning back to back.\",\n },\n },\n {\n key: \"patient-oconnell-brigid\",\n values: {\n full_name: \"Brigid O'Connell\",\n chart_number: \"HD-10489\",\n date_of_birth: \"1959-10-23\",\n phone: \"+1 360 555 0533\",\n email: \"brigid.oconnell@northshoremail.com\",\n street: \"3901 Sunset Drive\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98229\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Delta Dental\",\n member_id: \"DD-885013366\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"Codeine\"],\n balance_due: 310.75,\n referred_by: \"Existing patient referral\",\n front_desk_notes: \"Crown seat next month. Balance is the patient portion from the last claim.\",\n },\n },\n {\n key: \"patient-tran-hieu\",\n values: {\n full_name: \"Hieu Tran\",\n chart_number: \"HD-10492\",\n date_of_birth: \"1990-12-15\",\n phone: \"+1 360 555 0566\",\n email: \"hieu.tran@baysidedesignco.com\",\n street: \"1215 Lakeway Drive\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98229\",\n intake_stage: \"Forms received\",\n insurance_carrier: \"Aetna\",\n member_id: \"AE-55901287\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Insurance directory\",\n front_desk_notes: \"Medical history mentions a heart murmur — confirm premedication with Dr. Reyes.\",\n },\n },\n {\n key: \"patient-bergstrom-annika\",\n values: {\n full_name: \"Annika Bergström\",\n chart_number: \"HD-10496\",\n date_of_birth: \"1983-02-08\",\n phone: \"+1 360 555 0590\",\n email: \"annika.bergstrom@cascadiaoutfitters.com\",\n street: \"705 Samish Way\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Enquiry\",\n insurance_carrier: \"Cigna Dental\",\n member_id: \"CG-4491550\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Walk-in\",\n front_desk_notes: \"Came in over lunch asking about whitening. Packet not sent yet.\",\n },\n },\n ],\n },\n\n {\n token: \"visit\",\n name: \"Visits\",\n labelSingular: \"Visit\",\n labelPlural: \"Visits\",\n type: \"entity\",\n display: \"calendar\",\n weight: \"heavy\",\n ordered: true,\n icon: \"calendar-clock\",\n titleField: \"summary\",\n describes: \"Every booked chair appointment, what it is for, who is in the chair and who is treating.\",\n fields: [\n {\n key: \"summary\",\n label: \"Appointment\",\n parityType: \"text\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"patient\",\n label: \"Patient\",\n parityType: \"relation\",\n required: true,\n relationTarget: \"patient\",\n relationMax: 1,\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"appointment_at\",\n label: \"Date and time\",\n parityType: \"datetime\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"duration_minutes\",\n label: \"Chair time\",\n parityType: \"integer\",\n unit: \"min\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"procedure\",\n label: \"Procedure\",\n parityType: \"select\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n choices: [\n \"New patient exam\",\n \"Adult prophylaxis\",\n \"Child prophylaxis\",\n \"Composite filling\",\n \"Crown preparation\",\n \"Crown seat\",\n \"Root canal\",\n \"Extraction\",\n \"Emergency exam\",\n ],\n },\n {\n key: \"provider\",\n label: \"Provider\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\n \"Dr. Alina Reyes\",\n \"Dr. Marcus Webb\",\n \"Priya Chandra, RDH\",\n \"Tomas Lindgren, RDH\",\n ],\n },\n {\n key: \"operatory\",\n label: \"Operatory\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Op A\", \"Op B\", \"Op C\", \"Op D\", \"Op E\", \"Op F\"],\n },\n {\n key: \"visit_status\",\n label: \"Status\",\n parityType: \"select\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Scheduled\", \"Confirmed\", \"Checked in\", \"Completed\", \"No-show\", \"Cancelled\"],\n },\n {\n key: \"fee\",\n label: \"Fee\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n ],\n rows: [\n {\n key: \"visit-rivera-prophy-sep\",\n values: {\n summary: \"Adult cleaning — M. Rivera\",\n patient: \"patient-rivera-marisol\",\n appointment_at: \"2026-09-08T08:00:00-07:00\",\n duration_minutes: 50,\n procedure: \"Adult prophylaxis\",\n provider: \"Priya Chandra, RDH\",\n operatory: \"Op B\",\n visit_status: \"Completed\",\n fee: 138,\n },\n },\n {\n key: \"visit-oyelaran-crown-prep\",\n values: {\n summary: \"Crown prep, lower right — T. Oyelaran\",\n patient: \"patient-oyelaran-tunde\",\n appointment_at: \"2026-09-10T13:30:00-07:00\",\n duration_minutes: 90,\n procedure: \"Crown preparation\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op D\",\n visit_status: \"Completed\",\n fee: 1240,\n },\n },\n {\n key: \"visit-strand-crown-seat\",\n values: {\n summary: \"Crown seat — I. Strand\",\n patient: \"patient-strand-ingrid\",\n appointment_at: \"2026-09-14T10:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"Crown seat\",\n provider: \"Dr. Alina Reyes\",\n operatory: \"Op A\",\n visit_status: \"Completed\",\n fee: 880,\n },\n },\n {\n key: \"visit-kowalczyk-prophy\",\n values: {\n summary: \"Adult cleaning — A. Kowalczyk\",\n patient: \"patient-kowalczyk-agata\",\n appointment_at: \"2026-09-15T09:00:00-07:00\",\n duration_minutes: 50,\n procedure: \"Adult prophylaxis\",\n provider: \"Tomas Lindgren, RDH\",\n operatory: \"Op C\",\n visit_status: \"Completed\",\n fee: 138,\n },\n },\n {\n key: \"visit-oconnell-filling\",\n values: {\n summary: \"Composite filling, upper left — B. O'Connell\",\n patient: \"patient-oconnell-brigid\",\n appointment_at: \"2026-09-16T14:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"Composite filling\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op D\",\n visit_status: \"Completed\",\n fee: 412,\n },\n },\n {\n key: \"visit-mbeki-emergency\",\n values: {\n summary: \"Emergency exam, chipped incisor — S. Mbeki\",\n patient: \"patient-mbeki-sipho\",\n appointment_at: \"2026-09-17T16:30:00-07:00\",\n duration_minutes: 30,\n procedure: \"Emergency exam\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op E\",\n visit_status: \"No-show\",\n fee: 95,\n },\n },\n {\n key: \"visit-rivera-filling\",\n values: {\n summary: \"Composite filling, lower left — M. Rivera\",\n patient: \"patient-rivera-marisol\",\n appointment_at: \"2026-09-18T08:30:00-07:00\",\n duration_minutes: 60,\n procedure: \"Composite filling\",\n provider: \"Dr. Alina Reyes\",\n operatory: \"Op A\",\n visit_status: \"Completed\",\n fee: 386,\n },\n },\n {\n key: \"visit-halvorsen-new-patient\",\n values: {\n summary: \"New patient exam — B. Halvorsen\",\n patient: \"patient-halvorsen-britt\",\n appointment_at: \"2026-09-23T09:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"New patient exam\",\n provider: \"Dr. Alina Reyes\",\n operatory: \"Op A\",\n visit_status: \"Confirmed\",\n fee: 215,\n },\n },\n {\n key: \"visit-halvorsen-prophy\",\n values: {\n summary: \"Adult cleaning — B. Halvorsen\",\n patient: \"patient-halvorsen-britt\",\n appointment_at: \"2026-09-23T10:00:00-07:00\",\n duration_minutes: 50,\n procedure: \"Adult prophylaxis\",\n provider: \"Priya Chandra, RDH\",\n operatory: \"Op B\",\n visit_status: \"Confirmed\",\n fee: 138,\n },\n },\n {\n key: \"visit-whitehorse-new-patient\",\n values: {\n summary: \"New patient exam — D. Whitehorse\",\n patient: \"patient-whitehorse-dara\",\n appointment_at: \"2026-09-24T11:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"New patient exam\",\n provider: \"Dr. Alina Reyes\",\n operatory: \"Op A\",\n visit_status: \"Scheduled\",\n fee: 215,\n },\n },\n {\n key: \"visit-whitehorse-prophy\",\n values: {\n summary: \"Adult cleaning — D. Whitehorse\",\n patient: \"patient-whitehorse-dara\",\n appointment_at: \"2026-09-24T12:00:00-07:00\",\n duration_minutes: 50,\n procedure: \"Adult prophylaxis\",\n provider: \"Tomas Lindgren, RDH\",\n operatory: \"Op C\",\n visit_status: \"Scheduled\",\n fee: 138,\n },\n },\n {\n key: \"visit-oconnell-crown-seat\",\n values: {\n summary: \"Crown seat — B. O'Connell\",\n patient: \"patient-oconnell-brigid\",\n appointment_at: \"2026-10-06T14:30:00-07:00\",\n duration_minutes: 60,\n procedure: \"Crown seat\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op D\",\n visit_status: \"Scheduled\",\n fee: 1180,\n },\n },\n {\n key: \"visit-ferreira-new-patient\",\n values: {\n summary: \"New patient exam — J. Ferreira\",\n patient: \"patient-ferreira-joao\",\n appointment_at: \"2026-10-08T15:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"New patient exam\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op E\",\n visit_status: \"Scheduled\",\n fee: 215,\n },\n },\n {\n key: \"visit-nakamura-new-patient\",\n values: {\n summary: \"New patient exam — K. Nakamura\",\n patient: \"patient-nakamura-kenji\",\n appointment_at: \"2026-10-09T08:30:00-07:00\",\n duration_minutes: 60,\n procedure: \"New patient exam\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op D\",\n visit_status: \"Scheduled\",\n fee: 215,\n },\n },\n {\n key: \"visit-tran-child-prophy\",\n values: {\n summary: \"Child cleaning — H. Tran, daughter\",\n patient: \"patient-tran-hieu\",\n appointment_at: \"2026-10-13T16:00:00-07:00\",\n duration_minutes: 40,\n procedure: \"Child prophylaxis\",\n provider: \"Priya Chandra, RDH\",\n operatory: \"Op B\",\n visit_status: \"Scheduled\",\n fee: 112,\n },\n },\n {\n key: \"visit-kowalczyk-cancelled\",\n values: {\n summary: \"Night guard delivery — A. Kowalczyk\",\n patient: \"patient-kowalczyk-agata\",\n appointment_at: \"2026-09-19T11:30:00-07:00\",\n duration_minutes: 30,\n procedure: \"Adult prophylaxis\",\n provider: \"Tomas Lindgren, RDH\",\n operatory: \"Op C\",\n visit_status: \"Cancelled\",\n fee: 0,\n },\n },\n ],\n },\n\n {\n token: \"insurance_claim\",\n name: \"Insurance claims\",\n labelSingular: \"Claim\",\n labelPlural: \"Claims\",\n type: \"ledger\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"file-text\",\n titleField: \"claim_number\",\n describes: \"What was billed to a carrier for a completed visit, and what came back.\",\n fields: [\n {\n key: \"claim_number\",\n label: \"Claim number\",\n parityType: \"text\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"visit\",\n label: \"Visit\",\n parityType: \"relation\",\n required: true,\n relationTarget: \"visit\",\n relationMax: 1,\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"carrier\",\n label: \"Carrier\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Delta Dental\", \"Cigna Dental\", \"MetLife\", \"Guardian\", \"Aetna\"],\n },\n {\n key: \"submitted_on\",\n label: \"Submitted\",\n parityType: \"datetime\",\n format: \"date\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"billed_amount\",\n label: \"Billed\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"allowed_amount\",\n label: \"Carrier allowed\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"patient_portion\",\n label: \"Patient portion\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"claim_status\",\n label: \"Claim status\",\n parityType: \"select\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Prepared\", \"Submitted\", \"In review\", \"Paid\", \"Denied\", \"Appealed\"],\n },\n ],\n rows: [\n {\n key: \"claim-rivera-prophy\",\n values: {\n claim_number: \"HD-CLM-24118\",\n visit: \"visit-rivera-prophy-sep\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-09\",\n billed_amount: 138,\n allowed_amount: 138,\n patient_portion: 0,\n claim_status: \"Paid\",\n },\n },\n {\n key: \"claim-oyelaran-crown-prep\",\n values: {\n claim_number: \"HD-CLM-24123\",\n visit: \"visit-oyelaran-crown-prep\",\n carrier: \"Cigna Dental\",\n submitted_on: \"2026-09-11\",\n billed_amount: 1240,\n allowed_amount: 1097.5,\n patient_portion: 142.5,\n claim_status: \"Paid\",\n },\n },\n {\n key: \"claim-kowalczyk-prophy\",\n values: {\n claim_number: \"HD-CLM-24131\",\n visit: \"visit-kowalczyk-prophy\",\n carrier: \"Cigna Dental\",\n submitted_on: \"2026-09-16\",\n billed_amount: 138,\n allowed_amount: 74,\n patient_portion: 64,\n claim_status: \"Paid\",\n },\n },\n {\n key: \"claim-oconnell-filling\",\n values: {\n claim_number: \"HD-CLM-24136\",\n visit: \"visit-oconnell-filling\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-17\",\n billed_amount: 412,\n allowed_amount: 310.75,\n patient_portion: 310.75,\n claim_status: \"In review\",\n },\n },\n {\n key: \"claim-rivera-filling\",\n values: {\n claim_number: \"HD-CLM-24140\",\n visit: \"visit-rivera-filling\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-19\",\n billed_amount: 386,\n allowed_amount: 386,\n patient_portion: 0,\n claim_status: \"Submitted\",\n },\n },\n {\n key: \"claim-strand-crown-seat\",\n values: {\n claim_number: \"HD-CLM-24127\",\n visit: \"visit-strand-crown-seat\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-15\",\n billed_amount: 880,\n allowed_amount: 0,\n patient_portion: 880,\n claim_status: \"Denied\",\n },\n },\n {\n key: \"claim-oyelaran-resubmit\",\n values: {\n claim_number: \"HD-CLM-24144\",\n visit: \"visit-oyelaran-crown-prep\",\n carrier: \"Cigna Dental\",\n submitted_on: \"2026-09-20\",\n billed_amount: 142.5,\n allowed_amount: 0,\n patient_portion: 142.5,\n claim_status: \"Appealed\",\n },\n },\n {\n key: \"claim-oconnell-crown-predetermination\",\n values: {\n claim_number: \"HD-CLM-24149\",\n visit: \"visit-oconnell-crown-seat\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-21\",\n billed_amount: 1180,\n allowed_amount: 0,\n patient_portion: 0,\n claim_status: \"Prepared\",\n },\n },\n ],\n },\n ],\n\n relationships: [\n {\n describes: \"A visit belongs to the patient who sits in the chair, and it dies with their chart.\",\n fromTable: \"visit\",\n fromField: \"patient\",\n toTable: \"patient\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"visits\",\n },\n {\n describes: \"A claim bills exactly one completed visit, and it cannot outlive the visit it bills.\",\n fromTable: \"insurance_claim\",\n fromField: \"visit\",\n toTable: \"visit\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"claims\",\n },\n ],\n\n form: {\n token: \"harbor_dental_new_patient_intake\",\n name: \"Harbor Dental new-patient intake\",\n describes:\n \"The packet the front desk emails after the first call. The patient fills it in before they arrive so the hygienist is not taking a medical history in the chair.\",\n audience: \"public\",\n table: \"patient\",\n fields: [\n { fieldKey: \"full_name\", label: \"Your full legal name\", required: true, help: \"As it appears on your insurance card.\" },\n { fieldKey: \"date_of_birth\", label: \"Date of birth\", required: true },\n { fieldKey: \"phone\", label: \"Mobile number\", required: true, help: \"We text appointment reminders to this number.\" },\n { fieldKey: \"email\", label: \"Email\", required: true },\n { fieldKey: \"street\", label: \"Street address\", required: true },\n { fieldKey: \"city\", label: \"City\", required: true },\n { fieldKey: \"region\", label: \"State\", required: true },\n { fieldKey: \"postal_code\", label: \"ZIP\", required: true },\n { fieldKey: \"insurance_carrier\", label: \"Dental insurance carrier\", help: \"Choose Self-pay if you do not have dental coverage.\" },\n { fieldKey: \"member_id\", label: \"Member ID\", help: \"On the front of your card. We use it to check your benefits before your visit.\" },\n { fieldKey: \"allergies\", label: \"Any known allergies\", help: \"Select all that apply. We read this out before any injection.\" },\n { fieldKey: \"referred_by\", label: \"How did you hear about us?\" },\n ],\n submitLabel: \"Send my intake form\",\n confirmation:\n \"Thank you — we have your forms. We will check your benefits with your carrier and call you within two business days to find a first appointment that works.\",\n },\n\n pipeline: {\n token: \"harbor_dental_intake_pipeline\",\n name: \"New-patient intake\",\n describes:\n \"The six steps between a stranger calling and a chart the hygienist can work from. Renata works this board every morning.\",\n table: \"patient\",\n stageField: \"intake_stage\",\n stages: [\n {\n key: \"Enquiry\",\n label: \"Enquiry\",\n describes: \"They called or walked in. Nothing has been sent yet. Moves on when the intake packet goes out.\",\n typicalDurationDays: 1,\n },\n {\n key: \"Forms sent\",\n label: \"Forms sent\",\n describes: \"The packet is with them. Chase at three days; most people fill it in the evening they get it.\",\n typicalDurationDays: 3,\n },\n {\n key: \"Forms received\",\n label: \"Forms received\",\n describes: \"Medical history is in. Anything flagged goes to the treating dentist before we book.\",\n typicalDurationDays: 1,\n },\n {\n key: \"Insurance verified\",\n label: \"Insurance verified\",\n describes: \"Eligibility and remaining annual maximum confirmed with the carrier, so nobody is surprised by a bill.\",\n typicalDurationDays: 2,\n },\n {\n key: \"First visit booked\",\n label: \"First visit booked\",\n describes: \"Exam and cleaning are on the schedule and confirmed. Moves on the day they are seen.\",\n typicalDurationDays: 14,\n },\n {\n key: \"Active patient\",\n label: \"Active patient\",\n describes: \"Seen at least once and on recall. They leave this stage only if they transfer out.\",\n },\n ],\n },\n\n dashboardQuestion: {\n question: \"How many people have sent their forms back but still are not on the schedule?\",\n whyItMatters:\n \"Everyone sitting between 'Forms received' and 'First visit booked' is someone who already chose us and is quietly going cold. If the number climbs above about six, Renata blocks an hour to call them before the week gets away.\",\n table: \"patient\",\n aggregate: \"count\",\n groupBy: \"intake_stage\",\n filter: \"intake_stage is 'Forms received' or 'Insurance verified'\",\n answerUnit: \"patients\",\n },\n\n documentTemplate: {\n token: \"harbor_dental_welcome_letter\",\n name: \"New patient welcome letter\",\n describes:\n \"Goes out the moment a first visit is booked. It confirms who they will see, what to bring and what the first appointment actually involves, which is the single biggest reason people no-show.\",\n table: \"patient\",\n title: \"Welcome to {{practice_name}}, {{patient_name}}\",\n body: [\n \"Dear {{patient_name}},\",\n \"\",\n \"Thank you for choosing {{practice_name}}. Your chart is open under number {{chart_number}} and you will be seeing {{dentist}}.\",\n \"\",\n \"Your first appointment is a full examination with digital x-rays, followed by a cleaning with one of our hygienists. Together they take about two hours, so please allow for that.\",\n \"\",\n \"Please bring a photo ID and your {{carrier}} card. We have already checked your benefits, so we can tell you what is covered before any work is agreed — we do not start treatment you have not said yes to.\",\n \"\",\n \"If anything about your health has changed since you filled in your forms, tell the front desk when you arrive. It matters more than people expect.\",\n \"\",\n \"We look forward to meeting you.\",\n \"\",\n \"{{practice_name}}\",\n \"{{practice_phone}}\",\n \"{{today}}\",\n ].join(\"\\n\"),\n mergeFields: [\n { key: \"patient_name\", from: \"full_name\", describes: \"How we address them in the letter.\" },\n { key: \"chart_number\", from: \"chart_number\", describes: \"So the letter and the chart agree if they call about it.\" },\n { key: \"dentist\", from: \"primary_dentist\", describes: \"The dentist they are assigned to.\" },\n { key: \"carrier\", from: \"insurance_carrier\", describes: \"Tells them which card to bring.\" },\n { key: \"practice_name\", from: \"business\", describes: \"The practice name.\" },\n { key: \"practice_phone\", from: \"business\", describes: \"The front desk number.\" },\n { key: \"today\", from: \"today\", describes: \"The date the letter went out.\" },\n ],\n },\n\n notificationRule: {\n token: \"harbor_dental_visit_reminder\",\n name: \"Day-before appointment reminder\",\n describes:\n \"A no-show costs the practice the whole chair hour and the hygienist's time. A text the day before is the cheapest thing that prevents it, and it is the first automation any practice turns on.\",\n when: {\n table: \"visit\",\n event: \"due\",\n field: \"appointment_at\",\n daysBefore: 1,\n },\n audience: \"the patient in the chair\",\n channel: \"sms\",\n message:\n \"Harbor Dental: a reminder that you are booked with {{provider}} tomorrow at {{appointment_time}}. Reply C to confirm or call 360 555 0142 if you need to move it.\",\n },\n\n provenance: {\n kind: \"synthesized\",\n authoredBy: \"lane REAL-DATA (records use-case library)\",\n authoredOn: \"2026-09-21\",\n noRealPeople: true,\n },\n};\n\nexport default useCase;\n","// src/use-cases/ridgeline-physical-therapy-plan-of-care.ts — @ai-matrx/records/use-cases\n//\n// THE USE CASE: Sasha Lindqvist runs Ridgeline Physical Therapy single-handed,\n// and she uses this to carry a patient from a physician's referral through a\n// course of visits to a treatment goal that is either met or honestly written\n// off — without losing track of who is overdue for a re-evaluation.\n//\n// PROVENANCE. The tables, fields and rows come from the data crew's dataset\n// `matrx-frontend/scripts/campaign-tests/use-cases/physical-therapy-clinic.json`.\n// Three things were fixed on adoption, each a law the crew's file broke:\n// · the organization was \"Ridgeline Physical Therapy (test fixture)\" — a test\n// organization carries the use case's own name and is found for cleanup by\n// its tag, never by a junk suffix;\n// · patient mailboxes were on `@example-mail.test`, which reads as fake on the\n// screen the owner is looking at;\n// · relations pointed at a patient's NAME, which is not a handle — they now\n// point at the row.\n// Everything the crew's format has no room for — the business identity, the\n// relationship declarations, the form, the pipeline, the dashboard question, the\n// document and the notification rule — was written for this file.\n//\n// Every person, mailbox and phone number below is invented and belongs to nobody.\n\nimport type { UseCase } from \"./types\";\n\nexport const useCase: UseCase = {\n id: \"ridgeline-physical-therapy-plan-of-care\",\n useCase:\n \"Sasha Lindqvist runs Ridgeline Physical Therapy single-handed, and she uses this to carry a patient from a physician's referral through a course of visits to a treatment goal that is either met or honestly written off, without losing track of who is overdue for a re-evaluation.\",\n industry: \"Physical therapy\",\n cleanupTag: \"use-case:ridgeline-physical-therapy-plan-of-care\",\n\n business: {\n name: \"Ridgeline Physical Therapy\",\n legalName: \"Ridgeline Physical Therapy, LLC\",\n describes: \"A solo outpatient physical therapy practice doing orthopaedic and post-surgical rehabilitation.\",\n address: {\n line1: \"3114 Foothill Boulevard\",\n line2: \"Suite B\",\n city: \"Boise\",\n region: \"ID\",\n postalCode: \"83702\",\n country: \"US\",\n },\n phone: \"+1 208 555 0173\",\n website: \"https://ridgelinept.com\",\n email: \"frontdesk@ridgelinept.com\",\n timezone: \"America/Boise\",\n },\n\n tables: [\n {\n token: \"patients\",\n name: \"Patients\",\n labelSingular: \"Patient\",\n labelPlural: \"Patients\",\n type: \"entity\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"user-round\",\n titleField: \"full_name\",\n describes: \"Everyone on the caseload, from referral through discharge.\",\n fields: [\n { key: \"full_name\", label: \"Patient name\", parityType: \"text\", required: true, sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"date_of_birth\", label: \"Date of birth\", parityType: \"datetime\", format: \"date\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"phone\", label: \"Phone\", parityType: \"phone\", format: \"phone\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"email\", label: \"Email\", parityType: \"email\", format: \"email\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"referring_physician\", label: \"Referring physician\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"primary_diagnosis\", label: \"Primary diagnosis\", parityType: \"text\", sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"insurance_provider\", label: \"Insurance\", parityType: \"select\", choices: [\"Aetna\", \"Blue Cross Blue Shield\", \"UnitedHealthcare\", \"Cigna\", \"Medicare\", \"Self-pay\"], sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"intake_date\", label: \"Intake date\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Active\", \"Discharged\", \"On Hold\", \"Referred Out\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"patient-nora-castellan\", values: {\"full_name\": \"Nora Castellan\", \"date_of_birth\": \"1978-03-14\", \"phone\": \"555-201-3341\", \"email\": \"nora.castellan@northshoremail.com\", \"referring_physician\": \"Dr. Amina Reyes\", \"primary_diagnosis\": \"Rotator cuff tendinopathy, right shoulder\", \"insurance_provider\": \"Aetna\", \"intake_date\": \"2026-06-02\", \"status\": \"Active\"} },\n { key: \"patient-devon-ashworth\", values: {\"full_name\": \"Devon Ashworth\", \"date_of_birth\": \"1991-11-02\", \"phone\": \"555-201-3342\", \"email\": \"devon.ashworth@northshoremail.com\", \"referring_physician\": \"Dr. Marcus Feld\", \"primary_diagnosis\": \"ACL reconstruction, post-op (6 weeks)\", \"insurance_provider\": \"Blue Cross Blue Shield\", \"intake_date\": \"2026-06-05\", \"status\": \"Active\"} },\n { key: \"patient-priya-vantana\", values: {\"full_name\": \"Priya Vantana\", \"date_of_birth\": \"1965-07-22\", \"phone\": \"555-201-3343\", \"email\": \"priya.vantana@northshoremail.com\", \"referring_physician\": \"Dr. Amina Reyes\", \"primary_diagnosis\": \"Chronic low back pain, L4-L5 disc bulge\", \"insurance_provider\": \"Medicare\", \"intake_date\": \"2026-05-19\", \"status\": \"Active\"} },\n { key: \"patient-isaiah-broome\", values: {\"full_name\": \"Isaiah Broome\", \"date_of_birth\": \"2002-01-30\", \"phone\": \"555-201-3344\", \"email\": \"isaiah.broome@northshoremail.com\", \"referring_physician\": \"Dr. Lena Ostrowski\", \"primary_diagnosis\": \"Grade II ankle sprain, left\", \"insurance_provider\": \"UnitedHealthcare\", \"intake_date\": \"2026-07-01\", \"status\": \"Discharged\"} },\n { key: \"patient-marguerite-solano\", values: {\"full_name\": \"Marguerite Solano\", \"date_of_birth\": \"1954-09-08\", \"phone\": \"555-201-3345\", \"email\": \"marguerite.solano@northshoremail.com\", \"referring_physician\": \"Dr. Marcus Feld\", \"primary_diagnosis\": \"Total knee replacement, post-op (3 weeks)\", \"insurance_provider\": \"Medicare\", \"intake_date\": \"2026-06-20\", \"status\": \"Active\"} },\n { key: \"patient-tobias-reinholt\", values: {\"full_name\": \"Tobias Reinholt\", \"date_of_birth\": \"1988-04-17\", \"phone\": \"555-201-3346\", \"email\": \"tobias.reinholt@northshoremail.com\", \"referring_physician\": \"Dr. Lena Ostrowski\", \"primary_diagnosis\": \"Cervical radiculopathy, C6\", \"insurance_provider\": \"Cigna\", \"intake_date\": \"2026-07-10\", \"status\": \"Active\"} },\n { key: \"patient-odalys-fenmore\", values: {\"full_name\": \"Odalys Fenmore\", \"date_of_birth\": \"1997-12-25\", \"phone\": \"555-201-3347\", \"email\": \"odalys.fenmore@northshoremail.com\", \"referring_physician\": \"Dr. Amina Reyes\", \"primary_diagnosis\": \"Patellofemoral pain syndrome, bilateral\", \"insurance_provider\": \"Self-pay\", \"intake_date\": \"2026-07-15\", \"status\": \"On Hold\"} },\n { key: \"patient-wendell-okafor\", values: {\"full_name\": \"Wendell Okafor\", \"date_of_birth\": \"1972-02-11\", \"phone\": \"555-201-3348\", \"email\": \"wendell.okafor@northshoremail.com\", \"referring_physician\": \"Dr. Marcus Feld\", \"primary_diagnosis\": \"Plantar fasciitis, right heel\", \"insurance_provider\": \"Aetna\", \"intake_date\": \"2026-06-28\", \"status\": \"Active\"} },\n { key: \"patient-camille-duprez\", values: {\"full_name\": \"Camille Duprez\", \"date_of_birth\": \"1983-06-04\", \"phone\": \"555-201-3349\", \"email\": \"camille.duprez@northshoremail.com\", \"referring_physician\": \"Dr. Lena Ostrowski\", \"primary_diagnosis\": \"Lumbar spinal stenosis\", \"insurance_provider\": \"Blue Cross Blue Shield\", \"intake_date\": \"2026-05-30\", \"status\": \"Active\"} },\n { key: \"patient-griffin-alderete\", values: {\"full_name\": \"Griffin Alderete\", \"date_of_birth\": \"1995-10-19\", \"phone\": \"555-201-3350\", \"email\": \"griffin.alderete@northshoremail.com\", \"referring_physician\": \"Dr. Amina Reyes\", \"primary_diagnosis\": \"Achilles tendinopathy, left\", \"insurance_provider\": \"UnitedHealthcare\", \"intake_date\": \"2026-07-18\", \"status\": \"Referred Out\"} },\n ],\n },\n {\n token: \"appointments\",\n name: \"Visits\",\n labelSingular: \"Visit\",\n labelPlural: \"Visits\",\n type: \"entity\",\n display: \"calendar\",\n weight: \"heavy\",\n ordered: true,\n icon: \"calendar-clock\",\n titleField: \"visit_type\",\n describes: \"Every booked appointment, what kind of visit it is and whether it happened.\",\n fields: [\n { key: \"patient\", label: \"Patient\", parityType: \"relation\", required: true, relationTarget: \"patients\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"appointment_date\", label: \"Date\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"appointment_time\", label: \"Time\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"visit_type\", label: \"Visit type\", parityType: \"select\", required: true, choices: [\"Initial Evaluation\", \"Follow-up\", \"Re-evaluation\", \"Discharge Visit\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"therapist_name\", label: \"Therapist\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"duration_minutes\", label: \"Length\", parityType: \"integer\", unit: \"min\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Scheduled\", \"Completed\", \"No-show\", \"Cancelled\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"notes\", label: \"Visit notes\", parityType: \"long_text\", sensitivity: \"confidential\", contextPolicy: \"on_request\" },\n ],\n rows: [\n { key: \"appointment-01\", values: {\"patient\": \"patient-nora-castellan\", \"appointment_date\": \"2026-06-02\", \"appointment_time\": \"09:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"AROM shoulder flexion limited to 110 deg, pain 6/10 with overhead reach.\"} },\n { key: \"appointment-02\", values: {\"patient\": \"patient-nora-castellan\", \"appointment_date\": \"2026-06-09\", \"appointment_time\": \"09:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Completed\", \"notes\": \"Progressing isometrics, pain down to 4/10.\"} },\n { key: \"appointment-03\", values: {\"patient\": \"patient-nora-castellan\", \"appointment_date\": \"2026-06-16\", \"appointment_time\": \"09:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Scheduled\", \"notes\": \"\"} },\n { key: \"appointment-04\", values: {\"patient\": \"patient-devon-ashworth\", \"appointment_date\": \"2026-06-05\", \"appointment_time\": \"13:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Quad lag present, effusion mild. Cleared for closed-chain work.\"} },\n { key: \"appointment-05\", values: {\"patient\": \"patient-devon-ashworth\", \"appointment_date\": \"2026-06-12\", \"appointment_time\": \"13:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Completed\", \"notes\": \"Quad lag resolving, full passive extension achieved.\"} },\n { key: \"appointment-06\", values: {\"patient\": \"patient-devon-ashworth\", \"appointment_date\": \"2026-06-19\", \"appointment_time\": \"13:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"No-show\", \"notes\": \"Patient did not call.\"} },\n { key: \"appointment-07\", values: {\"patient\": \"patient-priya-vantana\", \"appointment_date\": \"2026-05-19\", \"appointment_time\": \"10:30\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Positive slump test on right, centralization with extension.\"} },\n { key: \"appointment-08\", values: {\"patient\": \"patient-priya-vantana\", \"appointment_date\": \"2026-06-02\", \"appointment_time\": \"10:30\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 45, \"status\": \"Completed\", \"notes\": \"Symptoms centralizing, tolerating prone press-ups.\"} },\n { key: \"appointment-09\", values: {\"patient\": \"patient-isaiah-broome\", \"appointment_date\": \"2026-07-01\", \"appointment_time\": \"15:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Grade II sprain, moderate swelling, weight-bearing as tolerated.\"} },\n { key: \"appointment-10\", values: {\"patient\": \"patient-isaiah-broome\", \"appointment_date\": \"2026-07-22\", \"appointment_time\": \"15:00\", \"visit_type\": \"Discharge Visit\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 30, \"status\": \"Completed\", \"notes\": \"Full ROM restored, single-leg balance 30s, discharged to home program.\"} },\n { key: \"appointment-11\", values: {\"patient\": \"patient-marguerite-solano\", \"appointment_date\": \"2026-06-20\", \"appointment_time\": \"11:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Knee flexion 85 deg, using front-wheel walker.\"} },\n { key: \"appointment-12\", values: {\"patient\": \"patient-marguerite-solano\", \"appointment_date\": \"2026-06-27\", \"appointment_time\": \"11:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Completed\", \"notes\": \"Flexion improved to 100 deg.\"} },\n { key: \"appointment-13\", values: {\"patient\": \"patient-marguerite-solano\", \"appointment_date\": \"2026-07-04\", \"appointment_time\": \"11:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Scheduled\", \"notes\": \"\"} },\n { key: \"appointment-14\", values: {\"patient\": \"patient-tobias-reinholt\", \"appointment_date\": \"2026-07-10\", \"appointment_time\": \"08:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Positive Spurling's test right, numbness in C6 dermatome.\"} },\n { key: \"appointment-15\", values: {\"patient\": \"patient-wendell-okafor\", \"appointment_date\": \"2026-06-28\", \"appointment_time\": \"16:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Point tenderness at medial calcaneal tubercle, worse first step in AM.\"} },\n { key: \"appointment-16\", values: {\"patient\": \"patient-camille-duprez\", \"appointment_date\": \"2026-05-30\", \"appointment_time\": \"09:30\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Symptoms improve with flexion-biased posture, neurogenic claudication at 2 blocks.\"} },\n { key: \"appointment-17\", values: {\"patient\": \"patient-griffin-alderete\", \"appointment_date\": \"2026-07-18\", \"appointment_time\": \"14:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Referred to orthopedic surgeon for imaging before continuing PT.\"} },\n ],\n },\n {\n token: \"treatment_plans\",\n name: \"Treatment plans\",\n labelSingular: \"Treatment plan\",\n labelPlural: \"Treatment plans\",\n type: \"entity\",\n display: \"board\",\n weight: \"heavy\",\n ordered: false,\n icon: \"clipboard-list\",\n titleField: \"diagnosis\",\n describes: \"The goal each patient is working toward, and whether they have met it.\",\n fields: [\n { key: \"patient\", label: \"Patient\", parityType: \"relation\", required: true, relationTarget: \"patients\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"diagnosis\", label: \"Diagnosis\", parityType: \"text\", required: true, sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"goal\", label: \"Goal\", parityType: \"long_text\", sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"start_date\", label: \"Start date\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"target_date\", label: \"Target date\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Active\", \"Met\", \"Modified\", \"Discontinued\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"plan-nora-castellan\", values: {\"patient\": \"patient-nora-castellan\", \"diagnosis\": \"Rotator cuff tendinopathy, right shoulder\", \"goal\": \"Restore pain-free overhead reach to 160 deg flexion within 6 weeks.\", \"start_date\": \"2026-06-02\", \"target_date\": \"2026-07-14\", \"status\": \"Active\"} },\n { key: \"plan-devon-ashworth\", values: {\"patient\": \"patient-devon-ashworth\", \"diagnosis\": \"ACL reconstruction, post-op\", \"goal\": \"Return to single-leg squat and stair descent without compensation by week 12.\", \"start_date\": \"2026-06-05\", \"target_date\": \"2026-08-28\", \"status\": \"Active\"} },\n { key: \"plan-priya-vantana\", values: {\"patient\": \"patient-priya-vantana\", \"diagnosis\": \"Chronic low back pain, L4-L5 disc bulge\", \"goal\": \"Centralize symptoms and tolerate 30-minute walk without radiating pain.\", \"start_date\": \"2026-05-19\", \"target_date\": \"2026-07-19\", \"status\": \"Active\"} },\n { key: \"plan-isaiah-broome\", values: {\"patient\": \"patient-isaiah-broome\", \"diagnosis\": \"Grade II ankle sprain, left\", \"goal\": \"Full weight-bearing, return to recreational basketball.\", \"start_date\": \"2026-07-01\", \"target_date\": \"2026-07-22\", \"status\": \"Met\"} },\n { key: \"plan-marguerite-solano\", values: {\"patient\": \"patient-marguerite-solano\", \"diagnosis\": \"Total knee replacement, post-op\", \"goal\": \"Achieve 110 deg flexion and walk without assistive device by week 8.\", \"start_date\": \"2026-06-20\", \"target_date\": \"2026-08-15\", \"status\": \"Active\"} },\n { key: \"plan-tobias-reinholt\", values: {\"patient\": \"patient-tobias-reinholt\", \"diagnosis\": \"Cervical radiculopathy, C6\", \"goal\": \"Resolve numbness, restore full cervical rotation.\", \"start_date\": \"2026-07-10\", \"target_date\": \"2026-08-21\", \"status\": \"Active\"} },\n { key: \"plan-wendell-okafor\", values: {\"patient\": \"patient-wendell-okafor\", \"diagnosis\": \"Plantar fasciitis, right heel\", \"goal\": \"Pain-free first step in the morning, return to daily 3-mile walk.\", \"start_date\": \"2026-06-28\", \"target_date\": \"2026-08-09\", \"status\": \"Active\"} },\n { key: \"plan-camille-duprez\", values: {\"patient\": \"patient-camille-duprez\", \"diagnosis\": \"Lumbar spinal stenosis\", \"goal\": \"Increase walking tolerance to 6 blocks without claudication.\", \"start_date\": \"2026-05-30\", \"target_date\": \"2026-08-01\", \"status\": \"Active\"} },\n ],\n },\n {\n token: \"exercises_prescribed\",\n name: \"Home exercises\",\n labelSingular: \"Home exercise\",\n labelPlural: \"Home exercises\",\n type: \"detail\",\n display: \"list\",\n weight: \"light\",\n ordered: true,\n icon: \"dumbbell\",\n titleField: \"exercise_name\",\n describes: \"What each patient was told to do between visits, and how it progresses.\",\n fields: [\n { key: \"treatment_plan\", label: \"Treatment plan\", parityType: \"relation\", required: true, relationTarget: \"treatment_plans\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"exercise_name\", label: \"Exercise\", parityType: \"select\", required: true, choices: [\"Pendulum Exercise\", \"Scapular Retraction\", \"Straight Leg Raise\", \"Quadriceps Sets\", \"Heel Slides\", \"Terminal Knee Extension\", \"Prone Press-ups (McKenzie)\", \"Cat-Camel Stretch\", \"Clamshells\", \"Bridging\", \"Standing Hip Abduction\", \"Wall Sits\", \"Calf Raises\", \"Hamstring Curls\", \"Ankle Pumps\", \"Chin Tucks\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"sets\", label: \"Sets\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"reps\", label: \"Reps\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"frequency_per_week\", label: \"Times per week\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"progression_notes\", label: \"Progression notes\", parityType: \"long_text\", sensitivity: \"confidential\", contextPolicy: \"on_request\" },\n ],\n rows: [\n { key: \"exercises_prescribed-01\", values: {\"treatment_plan\": \"plan-nora-castellan\", \"exercise_name\": \"Pendulum Exercise\", \"sets\": 3, \"reps\": 15, \"frequency_per_week\": 7, \"progression_notes\": \"Started week 1, pain-free arc, add light weight at week 3.\"} },\n { key: \"exercises_prescribed-02\", values: {\"treatment_plan\": \"plan-nora-castellan\", \"exercise_name\": \"Scapular Retraction\", \"sets\": 3, \"reps\": 12, \"frequency_per_week\": 5, \"progression_notes\": \"Using resistance band, increase band tension at week 4.\"} },\n { key: \"exercises_prescribed-03\", values: {\"treatment_plan\": \"plan-devon-ashworth\", \"exercise_name\": \"Quadriceps Sets\", \"sets\": 3, \"reps\": 10, \"frequency_per_week\": 7, \"progression_notes\": \"Hold 5 seconds, progressing to straight leg raise next visit.\"} },\n { key: \"exercises_prescribed-04\", values: {\"treatment_plan\": \"plan-devon-ashworth\", \"exercise_name\": \"Straight Leg Raise\", \"sets\": 3, \"reps\": 10, \"frequency_per_week\": 6, \"progression_notes\": \"No lag observed, add ankle weight 2lb.\"} },\n { key: \"exercises_prescribed-05\", values: {\"treatment_plan\": \"plan-devon-ashworth\", \"exercise_name\": \"Terminal Knee Extension\", \"sets\": 3, \"reps\": 12, \"frequency_per_week\": 5, \"progression_notes\": \"Using resistance band anchored behind knee.\"} },\n { key: \"exercises_prescribed-06\", values: {\"treatment_plan\": \"plan-priya-vantana\", \"exercise_name\": \"Prone Press-ups (McKenzie)\", \"sets\": 2, \"reps\": 10, \"frequency_per_week\": 6, \"progression_notes\": \"Symptoms centralizing, hold end range 2 seconds.\"} },\n { key: \"exercises_prescribed-07\", values: {\"treatment_plan\": \"plan-priya-vantana\", \"exercise_name\": \"Cat-Camel Stretch\", \"sets\": 2, \"reps\": 10, \"frequency_per_week\": 7, \"progression_notes\": \"Morning stiffness reduced.\"} },\n { key: \"exercises_prescribed-08\", values: {\"treatment_plan\": \"plan-isaiah-broome\", \"exercise_name\": \"Ankle Pumps\", \"sets\": 3, \"reps\": 20, \"frequency_per_week\": 7, \"progression_notes\": \"Early edema control, progressed to standing balance week 2.\"} },\n { key: \"exercises_prescribed-09\", values: {\"treatment_plan\": \"plan-marguerite-solano\", \"exercise_name\": \"Heel Slides\", \"sets\": 3, \"reps\": 10, \"frequency_per_week\": 7, \"progression_notes\": \"Flexion improving 5 deg/week.\"} },\n { key: \"exercises_prescribed-10\", values: {\"treatment_plan\": \"plan-marguerite-solano\", \"exercise_name\": \"Quadriceps Sets\", \"sets\": 4, \"reps\": 10, \"frequency_per_week\": 7, \"progression_notes\": \"Hold 5 seconds, no extensor lag.\"} },\n { key: \"exercises_prescribed-11\", values: {\"treatment_plan\": \"plan-tobias-reinholt\", \"exercise_name\": \"Chin Tucks\", \"sets\": 3, \"reps\": 10, \"frequency_per_week\": 6, \"progression_notes\": \"Reduces referred symptoms into arm during session.\"} },\n { key: \"exercises_prescribed-12\", values: {\"treatment_plan\": \"plan-wendell-okafor\", \"exercise_name\": \"Calf Raises\", \"sets\": 3, \"reps\": 15, \"frequency_per_week\": 5, \"progression_notes\": \"Eccentric emphasis, 3-second lower.\"} },\n { key: \"exercises_prescribed-13\", values: {\"treatment_plan\": \"plan-camille-duprez\", \"exercise_name\": \"Bridging\", \"sets\": 3, \"reps\": 12, \"frequency_per_week\": 5, \"progression_notes\": \"Flexion-biased, tolerating well.\"} },\n { key: \"exercises_prescribed-14\", values: {\"treatment_plan\": \"plan-camille-duprez\", \"exercise_name\": \"Standing Hip Abduction\", \"sets\": 3, \"reps\": 12, \"frequency_per_week\": 5, \"progression_notes\": \"Added ankle weight this week.\"} },\n ],\n },\n ],\n\n relationships: [\n {\n describes: \"A visit belongs to the patient who attends it, and it dies with their chart.\",\n fromTable: \"appointments\",\n fromField: \"patient\",\n toTable: \"patients\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"visits\",\n },\n {\n describes: \"A treatment plan belongs to the patient it sets a goal for.\",\n fromTable: \"treatment_plans\",\n fromField: \"patient\",\n toTable: \"patients\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"treatment_plans\",\n },\n {\n describes: \"A home exercise is prescribed under exactly one treatment plan and ends with it.\",\n fromTable: \"exercises_prescribed\",\n fromField: \"treatment_plan\",\n toTable: \"treatment_plans\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"exercises\",\n },\n ],\n\n form: {\n token: \"ridgeline_new_patient_referral\",\n name: \"Ridgeline new-patient referral intake\",\n describes:\n \"What a referred patient fills in before the initial evaluation, so the first visit is spent examining them rather than typing.\",\n audience: \"public\",\n table: \"patients\",\n fields: [\n { fieldKey: \"full_name\", label: \"Your full name\", required: true },\n { fieldKey: \"date_of_birth\", label: \"Date of birth\", required: true },\n { fieldKey: \"phone\", label: \"Best number to reach you\", required: true },\n { fieldKey: \"email\", label: \"Email\", required: true },\n { fieldKey: \"referring_physician\", label: \"Who referred you?\", required: true, help: \"The doctor's name on your referral, so we can send them your plan of care.\" },\n { fieldKey: \"primary_diagnosis\", label: \"What are you coming in for?\", help: \"In your own words is fine — we will write the clinical version.\" },\n { fieldKey: \"insurance_provider\", label: \"Insurance\", help: \"Choose Self-pay if you would rather not bill insurance.\" },\n ],\n submitLabel: \"Send my referral details\",\n confirmation:\n \"Thank you — we have your details. We will verify your benefits and call you within one business day to book your initial evaluation, which takes about an hour.\",\n },\n\n pipeline: {\n token: \"ridgeline_plan_of_care\",\n name: \"Plan of care\",\n describes:\n \"What happens to a treatment goal once it is written. Sasha reviews this board every Friday, because a plan that sits in Active past its target date is the one that quietly fails.\",\n table: \"treatment_plans\",\n stageField: \"status\",\n stages: [\n { key: \"Active\", label: \"Active\", describes: \"The patient is working toward the goal and attending visits. Leaves when the goal is met, changed or abandoned.\", typicalDurationDays: 42 },\n { key: \"Modified\", label: \"Modified\", describes: \"Re-evaluation changed the goal or the timeline — progress was faster or slower than predicted.\", typicalDurationDays: 21 },\n { key: \"Met\", label: \"Met\", describes: \"The measured goal was reached. This is what discharge is built on and what the referring physician is told.\" },\n { key: \"Discontinued\", label: \"Discontinued\", describes: \"Stopped without meeting the goal — the patient withdrew, was referred out, or their insurance ran out. Written down honestly rather than left Active.\" },\n ],\n },\n\n dashboardQuestion: {\n question: \"How many plans are still Active past the date I said they would be finished?\",\n whyItMatters:\n \"A plan sitting Active past its target date means a patient is being treated without anyone re-checking whether the treatment is working. Every one of those needs a re-evaluation booked this week, or a decision to change the goal.\",\n table: \"treatment_plans\",\n aggregate: \"count\",\n groupBy: \"status\",\n filter: \"status is 'Active' and target_date is before today\",\n answerUnit: \"treatment plans\",\n },\n\n documentTemplate: {\n token: \"ridgeline_plan_of_care_letter\",\n name: \"Plan of care letter to the referring physician\",\n describes:\n \"Goes back to the doctor who made the referral, at the start of care and again at discharge. Physicians refer again when they hear what happened to the last patient they sent, which makes this letter the practice's whole marketing plan.\",\n table: \"treatment_plans\",\n title: \"Plan of care — {{diagnosis}}\",\n body: [\n \"Thank you for the referral.\",\n \"\",\n \"Following evaluation I have started a course of treatment for {{diagnosis}}.\",\n \"\",\n \"Goal: {{goal}}\",\n \"\",\n \"Care began on {{start_date}} and I expect to reach that goal by {{target_date}}. The plan is currently {{status}}. The patient is on a home exercise programme between visits, and I re-evaluate objectively rather than by report.\",\n \"\",\n \"I will write again at discharge with the measured outcome. If anything in the history changes at your end, please tell me — it usually changes the plan.\",\n \"\",\n \"{{practice_name}}\",\n \"{{practice_phone}}\",\n \"{{today}}\",\n ].join(\"\\n\"),\n mergeFields: [\n { key: \"diagnosis\", from: \"diagnosis\", describes: \"What is being treated.\" },\n { key: \"goal\", from: \"goal\", describes: \"The measurable goal, in the words the physician will be told at discharge.\" },\n { key: \"start_date\", from: \"start_date\", describes: \"When care began.\" },\n { key: \"target_date\", from: \"target_date\", describes: \"When the goal is expected to be met.\" },\n { key: \"status\", from: \"status\", describes: \"Where the plan stands today.\" },\n { key: \"practice_name\", from: \"business\", describes: \"The practice name.\" },\n { key: \"practice_phone\", from: \"business\", describes: \"The number the physician's office calls back on.\" },\n { key: \"today\", from: \"today\", describes: \"The date the letter went out.\" },\n ],\n },\n\n notificationRule: {\n token: \"ridgeline_plan_past_target\",\n name: \"A plan has passed its target date\",\n describes:\n \"The one automation a solo therapist genuinely needs: nobody else is watching the caseload, so a goal that quietly slips past its date has to come and find her.\",\n when: {\n table: \"treatment_plans\",\n event: \"overdue\",\n field: \"target_date\",\n },\n audience: \"the treating therapist\",\n channel: \"in_app\",\n message:\n \"{{diagnosis}} has passed its target date of {{target_date}} and is still {{status}}. Book a re-evaluation or change the goal.\",\n },\n\n provenance: {\n kind: \"synthesized\",\n authoredBy: \"data crew (dataset) + lane REAL-DATA (business identity, relationships, form, pipeline, dashboard question, document, notification rule)\",\n authoredOn: \"2026-09-21\",\n noRealPeople: true,\n },\n};\n\nexport default useCase;\n","// src/use-cases/registry.ts — @ai-matrx/records/use-cases\n//\n// THE REGISTER OF REAL USE CASES.\n//\n// One line per use case, and that line is the ONLY thing a crew adds besides\n// its own file. There is deliberately no duplicated metadata here — no industry\n// column, no business name, no row counts — because a second copy of a fact is\n// a second copy that goes stale. Everything a caller wants to list is derived\n// by loading the file (`listUseCases`).\n//\n// The loaders are dynamic imports so a consumer that shows ONE business does not\n// pull fourteen of them into its bundle. `loadAllUseCases` is for the suite, the\n// seeders and the census — all of which run in Node and want the lot.\n\nimport type { UseCase, UseCaseSummary } from \"./types\";\n\n/**\n * Every registered use case, by id. ADD YOUR LINE HERE and nowhere else.\n *\n * Keep it alphabetical — it is read by people looking for an industry.\n */\nexport const USE_CASE_LOADERS: Record<string, () => Promise<{ useCase: UseCase }>> = {\n \"alvarado-chen-kitchen-weekly-cooking\": () => import(\"./alvarado-chen-kitchen-weekly-cooking\"),\n \"birchwood-avenue-renovation-budget\": () => import(\"./birchwood-avenue-renovation-budget\"),\n \"harbor-dental-new-patient-intake\": () => import(\"./harbor-dental-new-patient-intake\"),\n \"ridgeline-physical-therapy-plan-of-care\": () => import(\"./ridgeline-physical-therapy-plan-of-care\"),\n};\n\n/** The ids, sorted, so any listing is stable. */\nexport function useCaseIds(): string[] {\n return Object.keys(USE_CASE_LOADERS).sort();\n}\n\n/** Load one by id. Throws by name when it is not registered. */\nexport async function loadUseCase(id: string): Promise<UseCase> {\n const loader = USE_CASE_LOADERS[id];\n if (!loader) {\n throw new Error(\n `There is no use case registered as \"${id}\". Registered: ${useCaseIds().join(\", \")}.`,\n );\n }\n const module = await loader();\n return module.useCase;\n}\n\n/** Load all of them. For the suite, the seeders and the census. */\nexport async function loadAllUseCases(): Promise<UseCase[]> {\n return Promise.all(useCaseIds().map((id) => loadUseCase(id)));\n}\n\n/** Summarize one without the caller walking its tables. */\nexport function summarize(useCase: UseCase): UseCaseSummary {\n return {\n id: useCase.id,\n useCase: useCase.useCase,\n industry: useCase.industry,\n businessName: useCase.business.name,\n tableCount: useCase.tables.length,\n rowCount: useCase.tables.reduce((total, table) => total + table.rows.length, 0),\n };\n}\n\n/** Every use case, summarized. Loads all of them, so call it server-side. */\nexport async function listUseCases(): Promise<UseCaseSummary[]> {\n return (await loadAllUseCases()).map(summarize);\n}\n\n/**\n * Pick the use case for a given consumer, deterministically.\n *\n * The law says to ROTATE across industries so the platform is exercised by many\n * kinds of business rather than one toy. A suite, a demo or a screenshot script\n * passes a stable name for itself and always gets the same business — stable\n * enough to assert on, different enough across consumers that the platform gets\n * exercised broadly.\n */\nexport function useCaseFor(consumer: string): string {\n const ids = useCaseIds();\n let hash = 0;\n for (let i = 0; i < consumer.length; i += 1) {\n hash = (hash * 31 + consumer.charCodeAt(i)) >>> 0;\n }\n const id = ids[hash % ids.length];\n if (!id) {\n throw new Error(\n `No use cases are registered, so there is nothing to give \"${consumer}\". Add one to USE_CASE_LOADERS.`,\n );\n }\n return id;\n}\n","// src/vocabulary.ts — @ai-matrx/records\n//\n// THE CLOSED VOCABULARIES. Every list here is a word set the STORE enforces,\n// and the store is the only place any of them is decided. The literal values\n// are not typed by hand: `src/store.generated.ts` is regenerated from the live\n// catalogue by `pnpm records:generate`, and `pnpm check:store-registry` fails\n// the build the moment this package and the database disagree. What lives HERE\n// is the type layer over those literals, so a wrong word is a compile error in\n// a consumer rather than a `23514` at three in the morning.\n\nimport {\n ACTOR_VOCABULARY,\n ABSENCE_REASONS,\n VALUE_ENVELOPE_KEYS,\n VALUE_ALTERNATE_KEYS,\n STORAGE_MODES,\n RULE_USES,\n PER_VALUE_ACCESS_WORDS,\n PARITY_FIELD_TYPES,\n DECLARABLE_FIELD_KINDS,\n RULE_NODE_KINDS,\n RETIRED_ACTOR_WORDS,\n} from \"./store.generated\";\n\n/**\n * VAL-8. Who wrote a value. `user`, `agent`, `system` — enforced by every write\n * door, and the three retired words (`human`, `ai`, `code`) are translated by\n * the store's own `custom.actor_word`, never by a caller.\n */\nexport type Actor = (typeof ACTOR_VOCABULARY)[number];\n\n/** The words the store still accepts and rewrites, mapped to what they become. */\nexport type RetiredActorWord = keyof typeof RETIRED_ACTOR_WORDS;\n\n/**\n * VAL-2. Why a value is missing. A value is never blank for an unexplained\n * reason: it either holds something or it says one of these four words.\n */\nexport type AbsenceReason = (typeof ABSENCE_REASONS)[number];\n\n/** The closed key set of one value envelope (VAL-1 … VAL-4). */\nexport type ValueEnvelopeKey = (typeof VALUE_ENVELOPE_KEYS)[number];\n\n/** The closed key set of one ranked alternate (VAL-3). */\nexport type ValueAlternateKey = (typeof VALUE_ALTERNATE_KEYS)[number];\n\n/**\n * REC-4. `heavy` is indexed storage with Rules on write; `light` is\n * whole-document storage with Rules on read. Per Table, one store.\n */\nexport type StorageMode = (typeof STORAGE_MODES)[number];\n\n/** REC-15. One Rule object, four uses. */\nexport type RuleUse = (typeof RULE_USES)[number];\n\n/**\n * VAL-5 / VAL-6. The words that may NOT appear inside a value envelope:\n * visibility and access belong to a Field and to a Record, never to a value.\n * The store refuses each of them by name and so does this package's mirror.\n */\nexport type PerValueAccessWord = (typeof PER_VALUE_ACCESS_WORDS)[number];\n\n/** FLD-11. The parity floor: the field type a person picks in the UI. */\nexport type ParityFieldType = (typeof PARITY_FIELD_TYPES)[number][\"parity_type\"];\n\n/**\n * THE ONE REGISTRY, as a type: every kind a column can be DECLARED as.\n *\n * `ParityFieldType` above is the parity FLOOR — the answer to \"which of the fourteen\n * is this field\". It is not the answer to \"what may somebody pick\", and reading it as\n * though it were is exactly how `signature` came to be a field shape the store accepted\n * (`custom.doc_sign` takes no other) and no screen could offer: VERIFIER-10, F6.\n * `custom.field_kinds()` is the registry, and this is generated from it.\n */\nexport type DeclarableFieldKind = (typeof DECLARABLE_FIELD_KINDS)[number][\"kind\"];\n\n/** FLD-1. The five behaviours a Field can have. One, exactly, and closed. */\nexport type FieldBehavior = (typeof PARITY_FIELD_TYPES)[number][\"behavior\"];\n\n/** The node kinds `custom.rule_eval` evaluates. */\nexport type RuleNodeKind = (typeof RULE_NODE_KINDS)[number][\"node\"];\n\n/**\n * REC-32. The seven table types, closed. The parenthesised names are the\n * retired ones the doctrine records; never coin an eighth.\n */\nexport const TABLE_TYPES = [\n \"entity\",\n \"detail\",\n \"reference\",\n \"ledger\",\n \"restricted\",\n \"system\",\n \"deprecated\",\n] as const;\nexport type TableType = (typeof TABLE_TYPES)[number];\n\n/** REC-33. The two origins. A table we ship in schema `custom` is `standard`. */\nexport const TABLE_ORIGINS = [\"standard\", \"custom\"] as const;\nexport type TableOrigin = (typeof TABLE_ORIGINS)[number];\n\n/** REL-1. Ownership is one fact, stored once, read from the field's side. */\nexport const RELATION_FLAVORS = [\"owned\", \"referenced\"] as const;\nexport type RelationFlavor = (typeof RELATION_FLAVORS)[number];\n\n/** REL-2. What happens to the far side, separate from flavour. */\nexport const ON_DELETE = [\"cascade\", \"set_null\", \"restrict\"] as const;\nexport type OnDelete = (typeof ON_DELETE)[number];\n\n/** REL-3. A snapshot is a frozen copy in the relation's payload, never a pointer. */\nexport const RELATION_BINDINGS = [\"live\", \"snapshot\"] as const;\nexport type RelationBinding = (typeof RELATION_BINDINGS)[number];\n\n/** REL-7. */\nexport const RELATION_CARDINALITIES = [\"one\", \"many\"] as const;\nexport type RelationCardinality = (typeof RELATION_CARDINALITIES)[number];\n\n/** FLD-7. Where a Field's values come from. */\nexport const FIELD_SOURCES = [\"manual\", \"formula\", \"agent\", \"synced\"] as const;\nexport type FieldSource = (typeof FIELD_SOURCES)[number];\n\n/** FLD-9. A Formula declares whether it computes on read or on write. */\nexport const COMPUTE_ON = [\"read\", \"write\"] as const;\nexport type ComputeOn = (typeof COMPUTE_ON)[number];\n\n/**\n * AGT-7 / FLD-12. A Field's sensitivity sets a ceiling a merge field can never\n * widen — and these are THE STORE'S four words, checked against its own guard.\n *\n * This list used to read `standard · sensitive · secret`, which the store has\n * never accepted: writing a Field with `sensitivity: \"standard\"` is refused\n * with \"the field <name> has to say how sensitive its values are, and it says\n * standard\". The knob `custom/field_sensitivity_levels` keys off these same\n * four words to decide which level may read and edit each one, so a package\n * carrying three different words could never have agreed with it. Corrected\n * against the live store, 2026-09-18.\n */\nexport const FIELD_SENSITIVITIES = [\"public\", \"internal\", \"confidential\", \"restricted\"] as const;\nexport type FieldSensitivity = (typeof FIELD_SENSITIVITIES)[number];\n\n/** DYN-17 / §D. Which tier a MERGE FIELD's value is delivered in. */\nexport const DELIVERIES = [\"inline\", \"on_demand\", \"auto\"] as const;\nexport type Delivery = (typeof DELIVERIES)[number];\n\n/**\n * FLD-12. WHETHER AN AGENT MAY SEE A FIELD'S VALUES, and these are the STORE'S\n * four words — not the merge field's delivery tiers.\n *\n * `Field.context_policy` used to be typed as `Delivery` here, which is a\n * different question with a different vocabulary: writing a Field with\n * `context_policy: \"inline\"` is refused with \"the field <name> has to say\n * whether an agent may see its values, and it says inline\". Delivery is about\n * HOW MUCH of a value a merge field carries into a turn; this is about WHETHER\n * the value reaches an agent at all, and conflating them let a screen offer a\n * word the store has never accepted. Corrected against the live store,\n * 2026-09-18.\n */\nexport const CONTEXT_POLICIES = [\"include\", \"summarize\", \"exclude\", \"on_request\"] as const;\nexport type ContextPolicy = (typeof CONTEXT_POLICIES)[number];\n\n/** DYN-3. The eight sources, closed. Relationships and rules are not sources. */\nexport const MERGE_FIELD_SOURCES = [\n \"literal\",\n \"record\",\n \"state\",\n \"actor\",\n \"platform\",\n \"user_input\",\n \"tool\",\n \"derived\",\n] as const;\nexport type MergeFieldSource = (typeof MERGE_FIELD_SOURCES)[number];\n\n/** DYN-4. What a merge field resolves INTO. The consumer never learns which. */\nexport const MERGE_FIELD_SEMANTIC_TYPES = [\n \"value\",\n \"reference\",\n \"resolver\",\n \"computed\",\n \"collection\",\n] as const;\nexport type MergeFieldSemanticType = (typeof MERGE_FIELD_SEMANTIC_TYPES)[number];\n\n/** DYNAMIC-VALUES §A. Any number of these; never fused into the source. */\nexport const MERGE_FIELD_MODIFIERS = [\n \"scoped\",\n \"temporal\",\n \"collection\",\n \"live\",\n \"fallback\",\n \"formatted\",\n \"required\",\n] as const;\nexport type MergeFieldModifier = (typeof MERGE_FIELD_MODIFIERS)[number];\n\n/** DYN-12. The five override policies. Exactly one, and it outranks the ladder. */\nexport const OVERRIDE_POLICIES = [\n \"must_supply\",\n \"shown_overridable\",\n \"shown_locked\",\n \"server_fixed\",\n \"derived\",\n] as const;\nexport type OverridePolicy = (typeof OVERRIDE_POLICIES)[number];\n\n/** DYNAMIC-VALUES §C. What a resolved merge field's freshness was. */\nexport const FRESHNESS = [\"live\", \"cached\", \"snapshot\"] as const;\nexport type Freshness = (typeof FRESHNESS)[number];\n\n/** REC-1. How a Table shows itself. */\nexport const TABLE_DISPLAYS = [\"list\", \"grid\", \"board\", \"calendar\", \"timeline\"] as const;\nexport type TableDisplay = (typeof TABLE_DISPLAYS)[number];\n","// src/archive.ts — @ai-matrx/records · THE ARCHIVE, HEADLESS\n//\n// 🚨 THE DEFECT THIS EXISTS FOR (VERIFIER-10 F4, measured 2026-09-22 on Rincon\n// Plumbing Co's \"Truck 1 dispatch backlog\" as admin@admin.com):\n//\n// \"The grid's row action is Delete… Pressing it soft-deletes correctly:\n// deleted_at set, version 1 → 2, nothing removed, and the row leaves the\n// grid. Then it is gone for good as far as any screen is concerned. The\n// store's own custom.record_restore exists and does exactly the right thing.\n// The door is there; nothing reaches it.\"\n//\n// It could not have been reached. Every read door this store had answered LIVE\n// ROWS ONLY — `custom.read_records`, `read_records_by_ids` and\n// `read_records_matching` each hard-code `and r.deleted_at is null` — so no\n// screen could list an archived record however it was written. The store grew\n// `custom.read_records_archived` (migration\n// `fix10a_the_archive_has_a_read_door.sql`) and this module is its client half:\n// the vocabulary, the row shape, and the sentences a screen says about it.\n//\n// WHY THE SENTENCES LIVE HERE AND NOT IN THE UI. \"Archived by Maria Delgado on\n// 22 September\" is an answer about STORED FACTS, not a layout, and the desktop\n// app, the extension, an agent's reply and the web grid must all say it the\n// same way. A screen that composed its own would be a second answer to one\n// question, reached by knowing which client you are using.\n\nimport type { RecordDocument, ReadRow, Timestamp, Uuid } from \"./record\";\n\n/**\n * THE TWO LANES THE ARCHIVED-ITEMS LAW NAMES (Arman, 2026-09-09) — the same\n * split every other list in the platform makes between what is mine and what\n * is the organization's.\n *\n * · `mine` — what I archived.\n * · `org` — what anybody in this organization archived.\n *\n * `mine` is by construction a SUBSET of `org`: the store applies it as a\n * narrowing conjunct beside the visibility ladder, so a lane can never show a\n * record the ladder would have refused.\n */\nexport const ARCHIVE_LANES = [\"mine\", \"org\"] as const;\nexport type ArchiveLane = (typeof ARCHIVE_LANES)[number];\n\n/** THE DEFAULT LANE. The organization's archive, because \"where did that job go?\" is almost never a question about yourself. */\nexport const DEFAULT_ARCHIVE_LANE: ArchiveLane = \"org\";\n\n/** What each lane is called on a screen, and what it actually answers. */\nexport const ARCHIVE_LANE_LABEL: Record<ArchiveLane, string> = {\n mine: \"Archived by me\",\n org: \"Archived by anyone\",\n};\n\nexport const ARCHIVE_LANE_MEANS: Record<ArchiveLane, string> = {\n mine: \"The records you archived yourself.\",\n org: \"Everything anybody in this organization archived, including you.\",\n};\n\n/** A word that is not a lane is not silently answered as one. */\nexport function isArchiveLane(word: unknown): word is ArchiveLane {\n return typeof word === \"string\" && (ARCHIVE_LANES as readonly string[]).includes(word);\n}\n\n/**\n * One archived record, as `custom.read_records_archived` answers it: an\n * ordinary `ReadRow` — same id, same masked document, same level, same hidden\n * notices as it had while it was live — plus the two facts that only an archive\n * needs.\n *\n * `archivedBy` is null when the archiver is not a member of this organization\n * any more (their name is not this screen's to learn) or when the history\n * partition that held the SOFT_DELETE has rolled away. Null is an ANSWER and\n * gets its own sentence; it is never printed as an empty space.\n */\nexport interface ArchivedRow extends ReadRow {\n archivedAt: Timestamp;\n archivedBy: Uuid | null;\n archivedByName: string | null;\n}\n\n/** The row shape the door returns over the wire, before it is folded. */\nexport interface ArchivedDoorRow {\n id: Uuid;\n document: unknown;\n level: string;\n archived_at: Timestamp;\n archived_by: Uuid | null;\n archived_by_name: string | null;\n}\n\n/**\n * WHEN IT WAS ARCHIVED, THE WAY A PERSON SAYS IT — \"22 September 2026 at 01:53\".\n * Not an ISO string, and never a bare relative word like \"yesterday\" on its\n * own: somebody deciding whether to bring a record back is deciding about a\n * particular day's work.\n */\nexport function archivedWhen(at: Timestamp, locale = \"en-GB\"): string {\n const when = new Date(at);\n if (Number.isNaN(when.getTime())) return \"a moment nobody recorded\";\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n }).format(when);\n}\n\n/**\n * THE WHOLE SENTENCE A ROW IN THE ARCHIVE CARRIES. Both halves of the question\n * the archived-items law asks — who, and when — and an honest sentence when the\n * store could not answer the first half, rather than a blank where a name goes.\n */\nexport function archivedByLine(row: Pick<ArchivedRow, \"archivedAt\" | \"archivedByName\">, locale = \"en-GB\"): string {\n const when = archivedWhen(row.archivedAt, locale);\n const who = (row.archivedByName ?? \"\").trim();\n if (who === \"\") {\n return `Archived on ${when}. The store does not know who archived it — whoever did is no longer in this organization, or it happened before this table kept that.`;\n }\n return `Archived by ${who} on ${when}.`;\n}\n\n/**\n * WHAT AN EMPTY ARCHIVE SAYS, PER LANE. An empty list is an answer and it names\n * the lane it is empty for, so \"nothing here\" can never be read as \"nothing was\n * ever archived\" while the other lane holds twenty records.\n */\nexport function emptyArchiveLine(lane: ArchiveLane): string {\n return lane === \"mine\"\n ? \"You have not archived anything in this table. Switch to “Archived by anyone” to see what the rest of the organization has.\"\n : \"Nothing in this table has been archived. Records you remove from the grid arrive here, and nothing is ever destroyed.\";\n}\n\n/** A document that survived the round trip is the same document — used by the guard. */\nexport function sameDocument(a: RecordDocument, b: RecordDocument): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n}\n","// src/level.ts — @ai-matrx/records\n//\n// THE FOUR WORDS, AND THEIR ORDER. `public.permission_level` is a closed enum —\n// viewer < commenter < editor < admin — and the store says so in its own\n// refusals (\"This needs the admin level (viewer < commenter < editor < admin)\").\n//\n// It lives here, in the headless package, for one reason: a screen that has to\n// decide whether to DRAW a control needs the same ordering the door uses to\n// decide whether to accept the call. Two orderings is two answers to one\n// question, and the second one is always the wrong one.\n//\n// Nothing here decides policy. `atLeast` compares two words the store defined;\n// which word a door requires is the door's business and is never restated here.\n\n/** `public.permission_level`, in the store's own order. */\nexport type PermissionLevel = \"viewer\" | \"commenter\" | \"editor\" | \"admin\";\n\n/** The order the store writes them in, lowest first. */\nexport const PERMISSION_LEVELS: readonly PermissionLevel[] = [\n \"viewer\",\n \"commenter\",\n \"editor\",\n \"admin\",\n] as const;\n\nconst ORDINAL: Record<PermissionLevel, number> = {\n viewer: 1,\n commenter: 2,\n editor: 3,\n admin: 4,\n};\n\n/** Whether `held` is the same rung as `needed` or a higher one. Nothing held is never enough. */\nexport function atLeast(held: PermissionLevel | null | undefined, needed: PermissionLevel): boolean {\n if (!held) return false;\n const have = ORDINAL[held];\n return have !== undefined && have >= ORDINAL[needed];\n}\n\n/** A level word the store sent, or null when it sent something this package does not know. */\nexport function asPermissionLevel(word: unknown): PermissionLevel | null {\n return typeof word === \"string\" && word in ORDINAL ? (word as PermissionLevel) : null;\n}\n\n/** The higher of two levels — what a person holds when two ways in both let them through. */\nexport function highestLevel(\n left: PermissionLevel | null | undefined,\n right: PermissionLevel | null | undefined,\n): PermissionLevel | null {\n if (!left) return right ?? null;\n if (!right) return left;\n return ORDINAL[left] >= ORDINAL[right] ? left : right;\n}\n\n/**\n * What one subject's level is, as `custom.my_levels` answers it. `null` is an\n * ANSWER — \"you hold nothing on this\" — and never a missing row: a screen that\n * could not tell \"no access\" from \"not asked yet\" would draw one of them as the\n * other.\n */\nexport interface MyLevel {\n id: string;\n level: PermissionLevel | null;\n}\n","// src/field.ts — @ai-matrx/records\n//\n// THE FIELD. FLD-1 … FLD-13, FLD-N-1.\n//\n// One behaviour from a closed set of five; modifiers SEPARATE from behaviour; a\n// constraint is a Rule and never a behaviour; a parity type on top that says\n// which of the thirteen things a person picked in the UI and what it is MADE OF.\n// Unit and format live here and not in presentation, because they change what\n// the value MEANS and they reach the agent's context (FLD-N-1).\n\nimport type { Timestamp, Uuid } from \"./record\";\nimport type {\n ComputeOn,\n ContextPolicy,\n DeclarableFieldKind,\n FieldBehavior,\n FieldSensitivity,\n FieldSource,\n OnDelete,\n ParityFieldType,\n} from \"./vocabulary\";\n\n/** FLD-3. A constraint attached to a Field. A Rule, never a behaviour. */\nexport interface FieldRule {\n kind: \"min\" | \"max\" | \"length\" | \"pattern\" | \"equals_field\" | \"differs_from_field\";\n /**\n * The rule's own number or word: the least / the most for `min` / `max`, the\n * LONGEST for `length`, the pattern for `pattern`, the other column's key for\n * `equals_field` / `differs_from_field`. A `length` rule that only says how\n * SHORT a value may be carries `min` and no `value`.\n */\n value?: string | number;\n /**\n * STORE-RULE-GAPS (the older grid's `patternHint`). On a `pattern` rule only:\n * how a person writes it, e.g. `\"949-555-0142\"`. The store refuses an example\n * its own pattern would refuse, and a refused value is told \"Enter it like\n * 949-555-0142.\" (the hint, and `detail.example`).\n */\n example?: string;\n /**\n * STORE-RULE-GAPS (the older grid's `minLength`). On a `length` rule only: the\n * fewest characters. A blank is `required`'s question, never \"too short\".\n */\n min?: number;\n /** FLD-10. Empty means \"wherever the Field applies\". */\n applies_to_types?: string[];\n}\n\n/**\n * `custom.field` — the ONE definitions table (FLD-8), organization-scoped, so\n * two organizations add different fields to the same standard table.\n */\n/**\n * WHICH OF THE OTHER RECORD'S COLUMNS A RELATION SHOWS (REL-DISP, 2026-09-21).\n *\n * A Table has ONE stored default reference column — its `title_field` — and until\n * this existed every relation pointing at that Table could display that column and\n * nothing else. A Jobs board could read \"Maria Chen\" but never \"Maria Chen —\n * Rincon\", and two columns could not be joined into one string at all.\n *\n * ABSENT MEANS THE TABLE'S OWN COLUMN. A field with no `display` resolves exactly\n * as it did before, so nothing changes for a column nobody has given a spec to.\n *\n * The store judges it once, in `custom._display_spec_for`: every column named must\n * exist on the target Table, and the refusal names the one that does not. It is\n * resolved by ONE body, `custom._words_for`, which `custom.record_words`,\n * `custom._card_words`, `custom.relation_words` and `custom.relation_words_many`\n * are all one-liners onto — so the thirteen store-side readers inherit it too.\n *\n * A display column that is itself a relation resolves ONE hop and never a second.\n */\nexport interface RelationDisplay {\n /** The target's columns, in the order they are shown. */\n columns: string[];\n /** What goes between them. Defaults to a single space. */\n separator: string;\n}\n\nexport interface Field {\n id: Uuid;\n organization_id: Uuid;\n /** Set when this Field extends a standard entity rather than a custom Table. */\n entity_definition_id: Uuid | null;\n /** The token of the Table this Field belongs to. */\n table_token: string | null;\n key: string;\n label: string;\n name: string | null;\n\n // ── behaviour and modifiers, which are different questions ────────────────\n /** FLD-1. Exactly one of five. */\n type: FieldBehavior;\n /** FLD-2. The shape of the value, never a second behaviour. */\n multi: boolean;\n /** FLD-2. The values carry their own dates — the world clock, not History. */\n dated: boolean;\n /** FLD-3. Any number of attached validation Rules. */\n rules: FieldRule[];\n config: Record<string, unknown>;\n required: boolean;\n default: unknown;\n sort: number | null;\n\n // ── relation properties (REL-1 … REL-8), on the field's side ──────────────\n /** The Table this relation points at. */\n relation_target: Uuid | null;\n relation_max: number | null;\n on_target_delete: OnDelete | null;\n /** REL-9. The reverse is visible from both ends and is NOT a second Field. */\n inverse_key: string | null;\n /** REL-DISP. Which of the target's columns this one shows. Null = the Table's own. */\n display: RelationDisplay | null;\n\n // ── where values come from (FLD-7, FLD-9) ─────────────────────────────────\n source: FieldSource;\n source_config: Record<string, unknown>;\n /** FLD-9. A Formula declares whether it computes on read or on write. */\n compute_on: ComputeOn | null;\n\n // ── what the value MEANS (FLD-N-1) ────────────────────────────────────────\n /** The unit, on the Field, because it changes the meaning. Never presentation. */\n unit: string | null;\n format: string | null;\n\n // ── the agent-facing properties (FLD-12, AGT-6, AGT-7) ────────────────────\n /** AGT-7. A ceiling a merge field's delivery can never widen. */\n sensitivity: FieldSensitivity | null;\n /** FLD-12. Whether an agent may see this Field's values: include · summarize · exclude · on_request. */\n context_policy: ContextPolicy | null;\n /** AGT-6. How often a `source = agent` Field is refilled. */\n review_interval_days: number | null;\n /**\n * §D says this is on the wrong object and moves to the merge field. It is\n * still carried here because the live column is, and the client reads what\n * the store holds — never what the plan wishes it held.\n */\n depends_on: Uuid[] | null;\n\n /** FLD-10. Which record types this Field applies to. Empty means all of them. */\n applies_to_types: string[];\n /** FLD-5 / FLD-6. A list field's choices are the records of THIS Table. */\n options_table_id: Uuid | null;\n\n created_by: Uuid | null;\n updated_by: Uuid | null;\n created_at: Timestamp;\n updated_at: Timestamp;\n version: number;\n metadata: Record<string, unknown>;\n visibility: string;\n}\n\n/**\n * FLD-11. What the person picked, and what the store says it is made of. The\n * list itself is generated from `custom.parity_field_types()`; this is its type.\n */\nexport interface ParityFieldTypeDescriptor {\n parity_type: ParityFieldType;\n behavior: FieldBehavior;\n made_of: string;\n}\n\n/** AGT-8 / AGT-4. What an agent (or a person) proposes when a Field is missing. */\nexport interface FieldProposal {\n table_id: Uuid;\n key: string;\n label: string;\n type: FieldBehavior;\n multi?: boolean;\n required?: boolean;\n config?: Record<string, unknown>;\n relation_target?: Uuid;\n /** Why this Field should exist — what an approver reads before approving. */\n because: string;\n}\n\n/** AGT-8. What a table proposal looks like, same shape of question. */\nexport interface TableProposal {\n name: string;\n slug: string;\n title_field: string;\n fields: Array<Omit<FieldProposal, \"table_id\" | \"because\">>;\n because: string;\n}\n\n/**\n * WHAT A PERSON SAYS WHEN THEY ADD A COLUMN — the argument of\n * `custom.field_declare`, and deliberately NOT a `Field`.\n *\n * A `Field` is what the store STORES: a behaviour from a closed set of five,\n * modifiers beside it, a format, a unit, a relation target, a relation maximum,\n * an on-delete word, a compute_on, and the attached Rules that make a format\n * enforceable. A person adding a column knows none of that. They know they want\n * a date, or a person, or a list with these three choices in it.\n *\n * Every client that tried to bridge that gap itself got it wrong — the field\n * panel picked \"Person\" and the store read a Formula — so the bridge is the\n * STORE's, once, and this is the shape it takes.\n */\nexport interface NewFieldDeclaration {\n /** What a person reads on the column. The only thing that is always required. */\n label: string;\n /** One of the thirteen. Absent means one of the three plain behaviours below. */\n parity_type?: ParityFieldType;\n /** Plain text, a long text or a plain number — the three that carry no parity type. */\n plain?: \"text\" | \"long_text\" | \"number\";\n /**\n * THE ONE WORD EVERY OTHER CALLER REACHES FOR. An agent, a script, an import\n * and this package's own table-declaring path all say `type`, and until\n * 2026-09-20 `custom._field_document_for` threw it away — a `number` became a\n * text column in silence. It now resolves all three vocabularies, so this is\n * named here rather than left as a shape only the store knows about.\n */\n type?: FieldTypeWord;\n /** Derived from the label when absent, which is why the panel never asks for it. */\n key?: string;\n required?: boolean;\n multi?: boolean;\n dated?: boolean;\n sort?: number;\n sensitivity?: FieldSensitivity;\n context_policy?: ContextPolicy;\n rules?: FieldRule[];\n /** A choice list's choices, as words. The store keeps them as a Table (FLD-5 / FLD-6). */\n options?: string[];\n /** …or the Table they already come from, when a person picked an existing list. */\n options_table_id?: Uuid;\n /** The currency symbol or code a currency field's numbers are in (FLD-N-1). */\n unit?: string;\n /** A date field: a day, or a day and a time. */\n kind?: \"date\" | \"datetime\";\n /** A lookup or a rollup: the key of the relation Field on THIS table it travels along. */\n via?: string;\n /** A lookup: the key of the value it reads on the far side. */\n pick?: string;\n /** A rollup: what it works out, and of which far-side field (`count` needs none). */\n agg?: \"sum\" | \"count\" | \"min\" | \"max\" | \"avg\";\n of?: string;\n /** A formula: the expression, in the same shape a Rule uses (REC-15). */\n expr?: Record<string, unknown>;\n compute_on?: ComputeOn;\n relation_max?: number;\n /**\n * REL / FLD-11. The Table this column points at, when it is neither a Person\n * (`member`) nor a File (`attachment`). The store has taken it since\n * 2026-09-20 and no client type named it, so a person with an Invoice table\n * and a Line table could not declare the link through this package at all.\n */\n relation_target?: Uuid;\n /** REL-2. What happens to this record when the thing it points at goes. */\n on_target_delete?: OnDelete;\n /**\n * REL-DISP. Which of the target's columns this one shows, and what joins them.\n * A bare column name and a plain list are both accepted by the door and\n * normalised; leaving it out keeps the target Table's own reference column.\n */\n display?: RelationDisplay | string[] | string;\n /**\n * Presentation and behaviour settings the store carries verbatim — a long\n * text's `multiline`, a list's existing options table. The door has always\n * read it (`p_spec -> 'config'`) and this interface never offered it, so a\n * package-owned table could not declare its own multi-line column.\n */\n config?: Record<string, unknown>;\n /** A text column that holds a signature (`custom.doc_sign` accepts no other). */\n format?: string;\n /**\n * STORE-RULE-GAPS (the older grid's `allowOther`). A choice list only: a value\n * that is none of the choices is ADDED to the list as typed instead of\n * refused. Stored as `config.allow_other`; absent means off.\n */\n allow_other?: boolean;\n}\n\n/**\n * Every word `custom._field_document_for` resolves for `type`: any parity type\n * in `PARITY_FIELD_TYPES`, any behaviour those types are made of, or one of the\n * plain synonyms a person or an agent actually writes. No count is written down\n * here on purpose — the parity floor is regenerated from\n * `custom.parity_field_types()` and grew from thirteen to fourteen the day\n * `checkbox` landed, which is how the store's own refusals came to name a list\n * that no longer matched it.\n */\nexport type FieldTypeWord =\n // THE ONE REGISTRY (FIX-10B-F6). Every kind `custom.field_kinds()` publishes: the parity\n // floor plus plain text, long text, number, a person-aimed relation and a signature. This\n // union named only the parity floor and three plain synonyms, so `signature` — the one\n // shape `custom.doc_sign` accepts — was not a word any typed caller could send, which is\n // half of why no screen offered it.\n | DeclarableFieldKind\n | FieldBehavior\n | \"number\"\n | \"integer\"\n | \"decimal\"\n | \"float\"\n | \"long_text\"\n | \"string\";\n\n/**\n * What `custom.field_update` accepts.\n *\n * THE SETTINGS **AND** THE BEHAVIOUR. The door has had a behaviour arm since\n * T12 — say `parity_type`, `plain` or `type` and every value of the column is\n * converted (or kept in `_retired` with its reason) by\n * `custom._field_type_converts_values`. This interface named only the settings,\n * so the one client that needed to move a field back onto the behaviour it is\n * written against had no door and reached for `custom.record_update` instead,\n * which writes the document under the guards rather than through them.\n */\nexport interface FieldPatch {\n label?: string;\n required?: boolean;\n dated?: boolean;\n sort?: number;\n sensitivity?: FieldSensitivity;\n context_policy?: ContextPolicy;\n unit?: string;\n rules?: FieldRule[];\n /** The choices of a choice list, rewritten. A choice still wanted keeps its id. */\n options?: string[];\n /** One of the thirteen — a change of what this column HOLDS, not of a setting. */\n parity_type?: ParityFieldType;\n /** …or one of the three plain behaviours, …*/\n plain?: \"text\" | \"long_text\" | \"number\";\n /** …or the one word every other caller reaches for (see `NewFieldDeclaration`). */\n type?: FieldTypeWord;\n /**\n * FLD-2. The shape of the value — one, or several.\n *\n * This comment used to say that a patch moving `multi` ALONE changed nothing\n * and that the behaviour word had to be sent with it. That was true, and it\n * was a description of a silent failure rather than a contract: the door\n * answered \"saved\" and the column still held one. `custom.field_update` has\n * had a real settings arm for it since 2026-09-20 (matrx-frontend\n * `migrations/campaign/fix7b_field_multi_arm.sql`), which also moves a\n * relation's `relation_max` beside it — `custom.validate_values` counts links\n * against that number, so moving `multi` without it would tick a box and\n * still refuse the second record.\n *\n * A CHOICE LIST IS THE ONE EXCEPTION, and it is refused by name rather than\n * ignored: for `select` / `multi_select`, \"one answer or several\" IS the\n * parity type, so send the type instead.\n */\n multi?: boolean;\n /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */\n relation_target?: Uuid;\n on_target_delete?: OnDelete;\n /**\n * REL-DISP. Which of the target's columns this one shows. `null` REMOVES the\n * spec and the column goes back to whatever the table it points at is titled by;\n * the door refuses it by name on a column that points at nothing.\n */\n display?: RelationDisplay | string[] | string | null;\n /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */\n promoted?: boolean;\n unique?: boolean;\n /**\n * STORE-RULE-GAPS. A choice list's \"other values allowed\" setting — see\n * `NewFieldDeclaration.allow_other`. Refused by name on any other column; a\n * retype that stays a list keeps it.\n */\n allow_other?: boolean;\n /** §D / T7: which fields a worked-out column reads. */\n depends_on?: Uuid[];\n /**\n * FLD-9. WHEN a worked-out column works its answer out: when somebody reads the record,\n * or when somebody saves it.\n *\n * This door accepted the word, answered success and threw it away until 2026-09-21\n * (matrx-frontend `migrations/campaign/tails2_a_formula_says_when_it_works_itself_out.sql`)\n * — its spec builder used a fixed key list that did not carry it, so a person declaring a\n * write-stamped formula through this door silently got a read-time one. It is applied now,\n * in both arms, and the records already saved are brought with it.\n *\n * TWO THINGS IT REFUSES BY NAME rather than forcing quietly: a column that is not worked\n * out by the store has no moment to be worked out at, and a ROLL-UP adds up OTHER records,\n * so an answer stamped when this record was last saved would be wrong the moment one of\n * them changed — a roll-up is always `read`.\n */\n compute_on?: ComputeOn;\n /**\n * FLD-11 / REC-15. RE-AIMING A WORKED-OUT COLUMN: the expression, in the same\n * shape a Rule uses and read by the same evaluator — `{\"op\":\"concat\",\"args\":\n * [{\"field\":\"note\"}]}`. Every `{\"field\": …}` in it names a live Field of this\n * organization, or `custom._field_document_for` refuses the whole patch by\n * name and writes nothing.\n *\n * `custom.field_update` carries this in its BEHAVIOUR arm — the arm a type\n * word opens — so send it WITH the word for what the column is\n * (`type: \"formula\"`, or `parity_type` / `plain`). The door's spec builder\n * reads `coalesce(p_patch -> 'expr', v_old -> 'config' -> 'expr')`, so a\n * re-type that does not carry one deliberately keeps the expression the\n * column already had; the settings arm has no `expr` key at all, so `expr`\n * alone is not a change this door makes. `STORE-TAILS-2` asked for the field\n * because the one client that needed to re-aim an existing formula had no\n * typed way to say it and reached for `custom.record_update`, which writes the\n * Field document under the guards rather than through them.\n */\n expr?: Record<string, unknown>;\n}\n\n/**\n * Whether a choice column takes values that are not one of its choices\n * (`config.allow_other`, STORE-RULE-GAPS). Off unless the column says so.\n */\nexport function allowsOtherValues(field: Pick<Field, \"type\" | \"config\">): boolean {\n return field.type === \"list\" && field.config?.[\"allow_other\"] === true;\n}\n","// src/choice.ts — @ai-matrx/records\n//\n// WHAT A CHOICE VALUE IS, in one place, for every screen and every caller.\n//\n// A pick-list is a Table and an option is a Record of it (FLD-5 / FLD-6) — that part is\n// unchanged and is the store being right. What a CELL holds is not the option record's id: it\n// is the option's own stable key, a short word derived from its title when the option is born,\n// unique within its list and never rewritten. So renaming \"Circle\" to \"Round\" rewrites no row,\n// and nothing — no person, no agent, no import — is ever asked to know a uuid for a word the\n// product showed them.\n//\n// The read doors hand back the LABEL in the cell and name the key beside it in `_choices`:\n//\n// { \"kind\": \"Circle\",\n// \"_choices\": { \"kind\": { \"key\": \"circle\", \"label\": \"Circle\", \"id\": \"…\",\n// \"retired\": false, \"reason\": null } } }\n//\n// A multi-choice cell reads as an array of labels and its `_choices` entry is an array in the\n// same order. A RETIRED option is in there too, with `retired: true` and the reason — a value\n// whose choice was retired reads as its label and says what happened rather than vanishing.\n//\n// WRITING takes the label, the key, or (so nothing that worked yesterday breaks) the option\n// record's id. The store normalises all three to the key on the way in and refuses a word that\n// names no choice, naming the choices themselves.\n\nimport type { RecordDocument, StoredRecord } from \"./record\";\n\n/** One option, as `_choices` names it and as `optionsOf` returns it. */\nexport interface ChoiceOption {\n /** The stable key the cell actually holds. */\n key: string;\n /** What a person reads. */\n label: string;\n /** The option RECORD's id, for a caller that needs the row itself. */\n id?: string;\n /** True when the option was retired: still readable, no longer pickable. */\n retired?: boolean;\n /** Why it is no longer offered, in a sentence, when it is retired. */\n reason?: string | null;\n}\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * The stable key of an option RECORD as `custom.field_options` returns it.\n *\n * It lives in `metadata.option_key`, not in the document: FLD-5 keeps a category to one title\n * field, and the key is the store's own bookkeeping rather than a column anybody declared.\n * The fallback is the same slug the store derives, so an option written by something that has\n * not caught up still answers.\n */\nexport function optionKey(option: StoredRecord): string {\n const stored = option.metadata?.[\"option_key\"];\n if (typeof stored === \"string\" && stored.trim() !== \"\") return stored;\n return choiceSlug(optionLabel(option));\n}\n\n/** What a person reads on an option record. */\nexport function optionLabel(option: StoredRecord): string {\n const doc = option.data as RecordDocument | undefined;\n const title = doc?.[\"title\"] ?? doc?.[\"name\"];\n if (typeof title === \"string\" && title.trim() !== \"\") return title;\n return \"Unnamed choice\";\n}\n\n/**\n * The store's own slug, mirrored so a client can predict a key without a round trip.\n * `custom.choice_slug` is the original; a title with nothing a-z0-9 in it gets a short hash of\n * itself there, and this returns the empty-ish fallback rather than guessing a hash — a caller\n * that needs the real key for such a title reads it off the option.\n */\nexport function choiceSlug(word: string): string {\n const slug = word\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\")\n .replace(/^_+|_+$/g, \"\")\n .slice(0, 55);\n return slug === \"\" ? \"choice\" : slug;\n}\n\n/**\n * Does this stored (or typed) value name this option? The key, the label and the option's own\n * id all name the same choice, and a control has to recognise every one of them: what the read\n * door hands it is the LABEL, what the store holds is the KEY, and what a screen written before\n * this contract sends is the ID.\n */\nexport function isTheChosen(option: StoredRecord, value: unknown): boolean {\n if (typeof value !== \"string\") return false;\n const asked = value.trim().toLowerCase();\n if (asked === \"\") return false;\n return (\n asked === optionKey(option).toLowerCase() ||\n asked === optionLabel(option).toLowerCase() ||\n asked === option.id.toLowerCase()\n );\n}\n\n/** Every value of one cell, as strings, whether the Field is multi or not. */\nexport function choiceValuesOf(value: unknown): string[] {\n if (Array.isArray(value)) return value.filter((v): v is string => typeof v === \"string\");\n if (typeof value === \"string\" && value !== \"\") return [value];\n return [];\n}\n\n/**\n * What the read door said about one column's choices: the key behind the label, and whether the\n * option was retired and why. Returns an empty array when the document carries no `_choices`\n * entry for that column, which is also what a document written before this contract looks like.\n */\nexport function choicesOf(document: RecordDocument | undefined, fieldKeyOrId: string): ChoiceOption[] {\n const block = document?.[\"_choices\"];\n if (!block || typeof block !== \"object\") return [];\n const entry = (block as Record<string, unknown>)[fieldKeyOrId];\n if (!entry) return [];\n const list = Array.isArray(entry) ? entry : [entry];\n return list.filter((x): x is ChoiceOption => !!x && typeof x === \"object\" && typeof (x as ChoiceOption).key === \"string\");\n}\n\n/** True when this cell's value points at a choice that has since been retired. */\nexport function holdsARetiredChoice(document: RecordDocument | undefined, fieldKeyOrId: string): boolean {\n return choicesOf(document, fieldKeyOrId).some((c) => c.retired === true);\n}\n\n/** True when a token looks like a uuid — which a choice value is no longer allowed to be. */\nexport function looksLikeAnId(value: unknown): boolean {\n return typeof value === \"string\" && UUID.test(value);\n}\n","// src/coerce.ts — @ai-matrx/records\n//\n// WHAT A TYPED-IN ANSWER MEANS TO A FIELD, WORKED OUT IN ONE PLACE.\n//\n// Every door into this store that a person types into hands over STRINGS. A\n// browser input is a string. A clipboard cell is a string. A CSV column is a\n// string. A public form's answer is a string. A Field does not take strings —\n// it takes a number, a tick, a day, the id of an option — and until the string\n// has been turned into one of those, the store refuses it.\n//\n// 🚨 WHY THIS FILE EXISTS (AGENT-BUILDS-2's closing walk, 2026-09-21). A real\n// customer picked a time on Ironclad Mobile Mechanic's public booking page,\n// typed their name, phone, email and vehicle, pressed \"Book it\", and the page\n// answered:\n//\n// \"Vehicle Year takes a number, and it was given a string\"\n//\n// The appointment was not made. `BookingPicker` kept its answers as\n// `Record<string, string>` and the confirm route passed them through\n// uncoerced, so a booking page over ANY table with a number field was\n// unbookable by anybody. The store was right and said so plainly; nothing\n// between the person and the store had done the one job that stood between\n// them.\n//\n// AND IT WAS ALREADY SOLVED, TWICE, IN THE WRONG PLACE. The grid's paste\n// (`@ai-matrx/records-ui` `valueFromPastedText`) and the import wizard each\n// carried their own coercion — good ones — while the two PUBLIC doors, the\n// ones a stranger uses, carried none. That is the shape the platform-primitive\n// rule exists to stop: a capability scoped to the feature that surfaced it.\n// So the coercion lives HERE, headless, in the package both the screens and\n// the servers already depend on, and every one of those five doors calls it.\n//\n// THREE RULES IT KEEPS:\n//\n// 1. A VALUE IS COERCED, NEVER GUESSED. Writing 0 for \"about twelve\" or\n// today's date for \"soon\" is how a table quietly becomes untrue. A string\n// that is not the thing is REFUSED, by name, in words the person can act\n// on — \"Vehicle Year holds a number, and “twenty nineteen” is not one\".\n// 2. THE REFUSAL NAMES THE FIELD IN PLAIN WORDS, never its key, because the\n// person reading it is looking at a label on a screen.\n// 3. IT DECIDES NOTHING ELSE. Required, the Rules, the cap, the rate window\n// and every wall are the store's. This turns a string into a value and\n// stops.\n\nimport type { Field } from \"./field\";\n\n/**\n * EVERYTHING THIS FILE NEEDS TO KNOW ABOUT A FIELD, AND NOTHING ELSE.\n *\n * A full `Field` satisfies it, and so does every narrower shape the store\n * hands to a screen — `CaptureField` on a phone with no network, the Field\n * documents `custom.form_public` and `custom.booking_public` publish to a\n * stranger. Asking for the whole `Field` would have meant the capture sheet\n * keeping its own `Number(raw)`, which is exactly the duplication this file\n * exists to end.\n */\nexport interface CoercibleField {\n /** Named so the doc above is checkable: a full {@link Field} satisfies this. */\n key: string;\n label?: string | null;\n name?: string | null;\n /** FLD-1. One of five behaviours; an unknown word is treated as text. */\n type?: string | null;\n multi?: boolean | null;\n unit?: string | null;\n format?: string | null;\n config?: Record<string, unknown> | null | undefined;\n relation_target?: string | null;\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// WHICH KIND OF THING A FIELD HOLDS\n// ───────────────────────────────────────────────────────────────────────────\n\n/**\n * The kind of value one Field holds, resolved from its DECLARATION only — the\n * behaviour, the modifiers, the format, the relation target and the config,\n * because those are what the store stores. A screen that guessed from a value\n * would answer differently for an empty record.\n *\n * `plain_text`, `long_text`, `number` and `boolean` are behaviours that carry\n * no parity type of their own; every other word here is a parity type.\n */\nexport const FIELD_KINDS = [\n \"attachment\",\n \"checkbox\",\n \"currency\",\n \"datetime\",\n \"email\",\n \"formula\",\n \"json\",\n \"long_text\",\n \"lookup\",\n \"member\",\n \"multi_select\",\n \"number\",\n \"percent\",\n \"phone\",\n \"relation\",\n \"rollup\",\n \"select\",\n \"text\",\n \"url\",\n] as const;\n\n/**\n * 🚨 THE UNION IS DERIVED FROM THE LIST ABOVE, and the list is what the\n * coverage test walks. Add a kind here and the test drives it; give it no arm\n * in `coerceTypedAnswer` and the test says so, instead of the new kind falling\n * quietly through `default:` and a value of the wrong shape reaching the store\n * — which is the whole defect this file closes.\n */\nexport type FieldKind = (typeof FIELD_KINDS)[number];\n\n/** The kernel Table ids REC-31 pins the two special relations to. */\nexport interface KernelTargets {\n /** The kernel `File` Table — a relation pointing here is an attachment. */\n file?: string | undefined;\n /** The kernel `Person` Table — a relation pointing here names a person. */\n person?: string | undefined;\n}\n\n/**\n * Which kind of value this Field holds.\n *\n * This is the ONE classifier. `@ai-matrx/records-ui`'s `editorKindFor` — which\n * decides which editor to DRAW — delegates to it, so the editor a person types\n * into and the coercion applied to what they typed can never disagree about\n * the same column. They did disagree before this moved here; that is the whole\n * class of grid defect September was spent closing.\n */\nexport function fieldKindFor(field: CoercibleField, kernel?: KernelTargets): FieldKind {\n const format = (field.format ?? \"\").toLowerCase();\n const config = field.config ?? {};\n switch (field.type) {\n case \"boolean\":\n return \"checkbox\";\n case \"text\":\n if (format === \"email\") return \"email\";\n if (format === \"phone\") return \"phone\";\n if (format === \"url\") return \"url\";\n if (format === \"json\" || config[\"json\"] === true) return \"json\";\n if (format === \"long\" || config[\"multiline\"] === true) return \"long_text\";\n return \"text\";\n case \"range\": {\n const kind = String(config[\"kind\"] ?? \"number\");\n if (kind === \"date\" || kind === \"datetime\") return \"datetime\";\n // THE FORMAT, AND ONLY THE FORMAT. A unit is not a currency: a quantity\n // in `units` drawn as money is how three of something rendered \"units3\".\n if (format === \"currency\") return \"currency\";\n if (format === \"percent\" || field.unit === \"%\") return \"percent\";\n return \"number\";\n }\n case \"list\":\n return field.multi ? \"multi_select\" : \"select\";\n case \"relation\": {\n const parity = String(config[\"parity\"] ?? \"\");\n if (parity === \"attachment\" || parity === \"member\") return parity;\n if (kernel?.file && field.relation_target === kernel.file) return \"attachment\";\n if (kernel?.person && field.relation_target === kernel.person) return \"member\";\n return \"relation\";\n }\n case \"formula\": {\n const via = config[\"via\"];\n if (via && config[\"agg\"]) return \"rollup\";\n if (via) return \"lookup\";\n return \"formula\";\n }\n default:\n return \"text\";\n }\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// THE COERCION\n// ───────────────────────────────────────────────────────────────────────────\n\n/** One Field's options, indexed the way a typed word has to be looked up. */\nexport interface ChoiceOptions {\n /**\n * Lower-cased label, option key and option id, each pointing at the OPTION\n * RECORD'S ID — which is what a list Field stores (FLD-5/FLD-6).\n */\n byWord: Map<string, string>;\n /** The labels, in order, so a refusal can say what is on offer. */\n labels: string[];\n}\n\n/** What one answer became, or the sentence saying why it did not. */\nexport type Coerced =\n | { value: unknown }\n | { refusal: string; unmatched?: string[] };\n\nexport interface CoerceOptions {\n /** This Field's choices, when the caller has loaded them. */\n options?: ChoiceOptions | undefined;\n /** The kernel File/Person Table ids, for classifying relations. */\n kernel?: KernelTargets | undefined;\n /**\n * The Field's name as this caller writes it. Defaults to the Field's own\n * label. A screen passes the same words it printed above the box.\n */\n label?: string | undefined;\n}\n\n/** One id, written the way the store writes one (REC-51's shape test). */\nconst UUID_TEXT = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nconst TRUE_WORDS = new Set([\"true\", \"yes\", \"y\", \"1\", \"✓\", \"x\", \"checked\", \"on\"]);\nconst FALSE_WORDS = new Set([\"false\", \"no\", \"n\", \"0\", \"\", \"unchecked\", \"off\"]);\n\n/** The Field's name in plain words — never its key on a screen. */\nexport function coercionLabel(field: CoercibleField): string {\n const label = (field.label ?? \"\").trim();\n if (label !== \"\") return label;\n const name = (field.name ?? \"\").trim();\n if (name !== \"\") return name;\n return field.key\n .replace(/[_-]+/g, \" \")\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n .trim();\n}\n\n/**\n * Turn ONE typed-in string into the value this Field holds — or say, in a\n * sentence a person can act on, why it is not one.\n *\n * An empty answer is `null` for every kind: a blank means \"no answer here\",\n * and clearing a value is a thing a person means to do. Whether the Field may\n * be blank is the store's question, asked with the Field's `required` and its\n * Rules, not this one's.\n */\nexport function coerceTypedAnswer(\n field: CoercibleField,\n raw: string,\n opts: CoerceOptions = {},\n): Coerced {\n const label = opts.label ?? coercionLabel(field);\n const text = raw.trim();\n const kind = fieldKindFor(field, opts.kernel);\n\n if (text === \"\" && kind !== \"checkbox\") return { value: null };\n\n switch (kind) {\n case \"checkbox\": {\n const word = text.toLowerCase();\n if (TRUE_WORDS.has(word)) return { value: true };\n if (FALSE_WORDS.has(word)) return { value: word === \"\" ? null : false };\n return {\n refusal: `${label} is a tick box, so it takes yes or no — “${raw}” is neither. Write TRUE/FALSE, yes/no or 1/0.`,\n };\n }\n case \"number\":\n case \"currency\":\n case \"percent\": {\n // PEOPLE WRITE NUMBERS THE WAY PEOPLE WRITE NUMBERS. \"$1,250.50\",\n // \"(300)\" for a negative, \"12%\", \"2019\" — all of them are the number\n // that was meant, and refusing them makes the column people use most\n // the one the product cannot take.\n const negative = /^\\(.*\\)$/.test(text);\n const bare = text\n .replace(/^\\(|\\)$/g, \"\")\n .replace(/[\\s,]/g, \"\")\n .replace(/^[^\\d.\\-+]+/, \"\")\n .replace(/[^\\d.\\-+eE]+$/, \"\");\n const n = Number(bare);\n if (bare === \"\" || Number.isNaN(n)) {\n return {\n refusal: `${label} holds a number, and “${raw}” is not one. Write digits — a currency symbol, a percent sign, commas and brackets for a negative are all fine.`,\n };\n }\n return { value: negative ? -n : n };\n }\n case \"datetime\": {\n // A DAY IS NOT AN INSTANT, AND TREATING IT AS ONE MOVES IT. `2026-09-01`\n // parsed as an instant is midnight UTC, and a screen west of Greenwich\n // then draws it as 31 August — measured on fifty pasted invoice dates,\n // all one day early, systematically. A date Field holds a DAY.\n const wantsTime = String(field.config?.[\"kind\"] ?? \"date\") === \"datetime\";\n const plainDay = /^\\s*(\\d{4})-(\\d{2})-(\\d{2})\\s*$/.exec(raw);\n if (!wantsTime && plainDay) return { value: `${plainDay[1]}-${plainDay[2]}-${plainDay[3]}` };\n const at = Date.parse(text);\n if (Number.isNaN(at)) {\n return {\n refusal: `${label} holds a date, and “${raw}” is not one this can read. Write it as 2026-09-21, or the way your spreadsheet writes dates.`,\n };\n }\n const parsed = new Date(at);\n if (wantsTime) return { value: parsed.toISOString() };\n const y = parsed.getFullYear();\n const m = String(parsed.getMonth() + 1).padStart(2, \"0\");\n const d = String(parsed.getDate()).padStart(2, \"0\");\n return { value: `${y}-${m}-${d}` };\n }\n case \"json\": {\n try {\n return { value: JSON.parse(text) };\n } catch {\n return {\n refusal: `${label} holds a document, and “${raw}” is not valid JSON. Write the whole object, braces and all.`,\n };\n }\n }\n case \"select\":\n case \"multi_select\": {\n // A LIST IS AN IDENTITY, AND A WORD IS HOW A PERSON NAMES ONE. The store\n // keeps the option's id; the person types its label. Matching the two is\n // the whole job, and it is case-insensitive because \"COMPLETED\" and\n // \"Completed\" are one option.\n if (!opts.options) {\n return {\n refusal: `${label} is a list and its options have not been read yet, so nothing can be matched to “${raw}”. Try again once the column's choices have loaded.`,\n };\n }\n const wanted = kind === \"multi_select\"\n ? text.split(/[,;]/).map((w) => w.trim()).filter((w) => w.length > 0)\n : [text];\n if (wanted.length === 0) return { value: kind === \"multi_select\" ? [] : null };\n const matched: string[] = [];\n const unmatched: string[] = [];\n for (const word of wanted) {\n const hit = opts.options.byWord.get(word.toLowerCase());\n if (hit === undefined) unmatched.push(word);\n else matched.push(hit);\n }\n if (unmatched.length > 0) {\n const offered = opts.options.labels.length > 0\n ? opts.options.labels.join(\", \")\n : \"it has none yet\";\n return {\n refusal:\n `${label} does not have ${unmatched.map((w) => `“${w}”`).join(\" or \")} among its options. ` +\n `It offers: ${offered}.`,\n unmatched,\n };\n }\n return { value: kind === \"multi_select\" ? matched : matched[0] };\n }\n // AN IDENTITY IS NOT A WORD. Writing the word would put a string where an\n // id belongs, and every filter, colour and rollup built on that column\n // would stop agreeing with it. So it is refused and the person is told\n // which control does hold it.\n //\n // BUT AN ID IS AN IDENTITY (RELATION-TARGETS, 2026-09-23). A Person or File\n // column holds the kernel Person / File record, and the store itself now\n // turns the id a writer actually holds — a member's user id, an uploaded\n // file's id, or the record's own id — into that record at every write door\n // (`custom.relation_kernel_record`), refusing anything else in its own\n // words (\"… names someone who is not a member of …\"). So an import column\n // of member ids, or an agent handing over the file it just uploaded, is a\n // value and not a refusal; the store, not this mirror, decides whether the\n // id is somebody here.\n case \"member\":\n if (UUID_TEXT.test(text)) return { value: text.toLowerCase() };\n return {\n refusal: `${label} names a person in this organization, so it is chosen rather than typed. Open it and pick them.`,\n };\n case \"attachment\":\n if (UUID_TEXT.test(text)) return { value: text.toLowerCase() };\n return {\n refusal: `${label} holds a file, which cannot arrive as typed-in text. Open it and attach the file.`,\n };\n case \"relation\":\n return {\n refusal: `${label} points at another record, so it is chosen rather than typed. Open it and pick the record.`,\n };\n case \"formula\":\n case \"lookup\":\n case \"rollup\":\n return {\n refusal: `${label} is worked out by the system, so nothing can be written into it.`,\n };\n default:\n // text, long_text, email, phone, url — the string IS the value, and the\n // format Rules on it are the store's to judge.\n return { value: raw };\n }\n}\n\n/** What a whole set of typed-in answers became. */\nexport interface CoercedAnswers {\n /** Ready to send to the store. Only the keys that coerced cleanly. */\n values: Record<string, unknown>;\n /** Field key → the sentence saying why that answer was not written. */\n refusals: Record<string, string>;\n /** The field keys the caller sent that this table has no Field for. */\n unknownKeys: string[];\n}\n\n/**\n * Every typed-in answer on one screen, coerced together — the shape the two\n * public doors and the import wizard actually need.\n *\n * Keys the table has no Field for are reported rather than dropped: the store\n * refuses an unknown key by name and a caller that quietly deleted it would\n * hide a real mismatch between a page and its table.\n */\nexport function coerceTypedAnswers(\n fields: readonly CoercibleField[],\n answers: Readonly<Record<string, unknown>>,\n opts: {\n kernel?: KernelTargets | undefined;\n /** Choices per Field key, for the list columns. */\n options?: ReadonlyMap<string, ChoiceOptions> | undefined;\n /** Field key → the words that screen printed above the box. */\n labels?: Readonly<Record<string, string>> | undefined;\n } = {},\n): CoercedAnswers {\n const byKey = new Map(fields.map((f) => [f.key, f]));\n const values: Record<string, unknown> = {};\n const refusals: Record<string, string> = {};\n const unknownKeys: string[] = [];\n\n for (const [key, given] of Object.entries(answers)) {\n const field = byKey.get(key);\n if (!field) {\n unknownKeys.push(key);\n // Passed through untouched: it is the STORE's job to say it does not\n // know this key, in its own words, naming it.\n values[key] = given;\n continue;\n }\n // ALREADY THE RIGHT SHAPE IS LEFT ALONE. A screen with real editors hands\n // over a number, a boolean or an array already; only a STRING needs this.\n if (typeof given !== \"string\") {\n values[key] = given;\n continue;\n }\n const opt: CoerceOptions = {};\n const choices = opts.options?.get(key);\n if (choices) opt.options = choices;\n if (opts.kernel) opt.kernel = opts.kernel;\n const label = opts.labels?.[key];\n if (label) opt.label = label;\n\n const answered = coerceTypedAnswer(field, given, opt);\n if (\"refusal\" in answered) refusals[key] = answered.refusal;\n else values[key] = answered.value;\n }\n\n return { values, refusals, unknownKeys };\n}\n","// src/pipeline.ts — @ai-matrx/records · PRODUCTS row 7\n//\n// A PIPELINE IS NOT A NEW KIND OF THING, and this module adds none. A pipeline is a\n// Choice Field that a Table names as its STAGE field, plus transition Rules of the ONE\n// Rule object (REC-15) about that Table. A move is an ORDINARY record write: the validate\n// use judges it, History records it because it is a write, and the entry effects are the\n// applicability use's own declared consequence.\n//\n// SO THIS PACKAGE ENFORCES NOTHING. Every type below is the shape of a door's answer, and\n// every judgement comes from the store. A board that decided in the browser which column a\n// card may enter would be a second opinion with nothing keeping it equal to the first —\n// and it would be the comfortable one, because it is the one nobody can be refused by.\n\nimport type { Uuid } from \"./record\";\n\n/** One stage of a board: the KEY the store keeps, and the LABEL a person reads. */\nexport interface PipelineStage {\n /** The option's stable key — what a cell holds, and what a move is written with. */\n key: string;\n /** What the column heading says. Renaming a stage rewrites no record. */\n label: string;\n /** A retired choice can still be READ on a record that holds it; it cannot be picked anew. */\n retired: boolean;\n}\n\n/** What each Rule of a pipeline is about. Closed, and the store is the authority. */\nexport const PIPELINE_RULE_KINDS = [\"moves\", \"requires\", \"who\", \"limit\", \"entry\"] as const;\n/**\n * A GATE is the general form under `requires`, `who` and `limit`, and the store spells it\n * `gate:1`, `gate:2` … so several gates can sit on one stage without one overwriting the\n * next. It is matched as a prefix rather than listed, because the number is open.\n */\nexport type PipelineRuleKind = (typeof PIPELINE_RULE_KINDS)[number] | `gate:${number}`;\n\n/**\n * WHAT A GATE DOES WHEN IT SAYS NO. The closed list `custom.stage_rule_on_fail_kinds()`\n * answers — a screen offering a third answer would be offering something no Rule can carry.\n */\nexport const STAGE_RULE_ON_FAIL = [\"refuse\", \"require_approval\"] as const;\nexport type StageRuleOnFail = (typeof STAGE_RULE_ON_FAIL)[number];\n\n/**\n * THE ORGANIZATION'S ONE KNOB (`custom/stage_rule_enforcement`). `refuse` is the default and\n * what a gate is for; `warn` lets the move through and hands the same sentence back. It never\n * softens `require_approval` — \"ask somebody\" and \"carry on with a note\" are different answers.\n */\nexport const STAGE_RULE_ENFORCEMENT = [\"refuse\", \"warn\"] as const;\nexport type StageRuleEnforcement = (typeof STAGE_RULE_ENFORCEMENT)[number];\n\n/**\n * One transition Rule, as `custom.pipeline_read` hands it back — WITH the sentence it says\n * when it refuses, because a screen that knows a rule exists but not what it refuses in\n * cannot warn anybody before they drag.\n */\nexport interface PipelineRule {\n id: Uuid;\n name: string;\n /** The exact words a person is shown when this Rule stops a move. */\n message: string;\n kind: PipelineRuleKind | null;\n /** The stage this Rule is about; `null` on the one Rule about the moves themselves. */\n stage: string | null;\n uses: string[];\n /** What happens when a card ARRIVES in this stage — assign, notify, start a checklist. */\n on_entry: Record<string, unknown> | null;\n /**\n * What this Rule does when it STOPS a move. `refuse` is the default and what every\n * pipeline Rule did before gates existed; `require_approval` files the change in the\n * approvals queue with this Rule's sentence as the reason and leaves the record alone.\n */\n on_fail?: StageRuleOnFail;\n /**\n * THE GATE AS IT WAS WRITTEN, which is the only thing that makes it EDITABLE.\n *\n * A gate is saved as one Rule whose expression is an `or` of four arms — not this\n * stage, OR not a move, OR the gate is not about this card, OR the demand holds. That\n * compiled form used to be the only copy, so a settings screen could read a gate's name\n * and its sentence and nothing else: it would open every existing rule with a blank\n * condition and overwrite it the first time somebody pressed Save.\n *\n * Absent on the four sugar rules (`moves`, `requires`, `who`, `limit`), which nobody\n * writes in a condition builder, and on any gate declared before the store started\n * keeping them. Absent means \"this one was not written here\" — never \"it has no\n * condition\", which is a different and dangerous thing to draw.\n */\n when?: Record<string, unknown> | null;\n /** @see {@link PipelineRule.when} — the condition that has to hold, as it was written. */\n demands?: Record<string, unknown> | null;\n version: number;\n}\n\n/**\n * WHAT A GATE WOULD DO TO THIS BOARD TODAY, from `custom.pipeline_gate_preview`.\n *\n * The one question somebody writing a rule that will refuse their colleagues' work\n * actually has, answered while they are still typing it — the gate is judged as an\n * argument, nothing is saved, and nothing is written. The store compiles it with the\n * SAME compiler `pipeline_declare` uses, so this count and the refusal at the door are\n * the same rule.\n */\nexport interface PipelineGatePreview {\n is_pipeline: boolean;\n /** Present, and it says what would make a board exist, when `is_pipeline` is false. */\n why?: string;\n /** The stage key the gate was tried against. */\n stage?: string;\n /** Live cards of this board this person may see that are not already in that stage. */\n considered: number;\n /** How many of them this gate would turn away. */\n refused: number;\n /**\n * Up to three of them, BY NAME. A count with no names is a number nobody can check, and\n * checking it is the whole reason to show it before saving.\n */\n examples: { record_id: Uuid; title: string }[];\n /** True when the board is larger than the preview will walk, so the count is a floor. */\n truncated?: boolean;\n on_fail?: StageRuleOnFail;\n /** The word this board uses for one of its cards — \"quote\", \"deal\" — for the sentence. */\n noun?: string;\n}\n\n/** The whole board's definition, from `custom.pipeline_read`. */\nexport interface Pipeline {\n is_pipeline: boolean;\n /** Present, and it says what would make a board exist, when `is_pipeline` is false. */\n why?: string;\n table_id?: Uuid;\n /** The Field KEY that holds the stage — the twin of a Table's `type_field`. */\n stage_field?: string;\n field_id?: Uuid;\n /** What that column is called, e.g. \"Stage\". */\n stage_label?: string;\n /** In the order they were declared, which is the order the board draws them. */\n stages?: PipelineStage[];\n rules?: PipelineRule[];\n}\n\n/** One column of the board, with the store's own numbers over what this person may see. */\nexport interface PipelineColumn {\n stage_key: string;\n stage_label: string;\n /** 1-based, the declared order. */\n stage_position: number;\n cards: number;\n /** The total of the chosen measure, or null when no measure was asked for. */\n total: number | null;\n /** How many cards this column takes at once, or null when it takes any number. */\n wip_limit: number | null;\n /** True when the column already holds MORE than its limit — a state a board must show. */\n over_limit: boolean;\n}\n\n/** One column this stage demands before a card may land in it. */\nexport interface PipelineMissingField {\n field_id: Uuid;\n key: string;\n /** What the column is called, so a screen can ASK for it rather than only refuse. */\n label: string;\n}\n\n/**\n * Whether a card may go to a column, answered BEFORE the finger lets go — by the same\n * Rules, through the same evaluator, on the document the move WOULD produce.\n *\n * A board greys a column, and snaps a card back, from this. It never decides for itself.\n */\nexport interface PipelineVerdict {\n allowed: boolean;\n is_pipeline: boolean;\n /**\n * The THREE answers a board has to draw differently, and the reason `allowed` alone is\n * not enough: a card that is going for approval has not been refused, and a card that\n * moved under `warn` has not been waved through silently.\n */\n outcome?: \"allowed\" | \"refused\" | \"needs_approval\" | \"warned\";\n /** What this organization's one knob says right now. */\n enforcement?: StageRuleEnforcement;\n /** Set on `needs_approval`: what pressing on will actually do, in plain words. */\n what_happens?: string;\n /** Set on `warned`: the gates this organization asked to be told about, not stopped by. */\n warnings?: StageRuleWarning[];\n /** Approvals already filed against this card's own stage column that nobody has decided. */\n pending?: StagePending[];\n /** The stage key the move was asked about. */\n to?: string;\n /** The store's own sentence — shown verbatim, never paraphrased by a screen. */\n why: string;\n rule?: string;\n rule_id?: Uuid;\n rule_version?: number;\n kind?: PipelineRuleKind;\n /** What this Rule does when it stops a move. */\n on_fail?: StageRuleOnFail;\n /**\n * When a stage demands columns that are empty, exactly which ones — so the screen can\n * prompt for them on entry instead of sending the person away to find them.\n */\n missing?: PipelineMissingField[];\n}\n\n/** What `custom.pipeline_declare` says it made or changed. */\nexport interface PipelineDeclared {\n table_id: Uuid;\n stage_field: string;\n field_id: Uuid;\n stages: string[];\n rules: Record<string, Uuid>;\n /** Plain sentences naming each thing this declaration wrote. */\n said: string[];\n}\n\n/** The declaration a person (or an agent) writes. Everything is optional but the stages. */\nexport interface PipelineSpec {\n stage_field: { key: string; label?: string; options?: string[]; sort?: number };\n transitions?: { from: string; to: string }[];\n /** Stage name → the column keys that must be filled in to land there. */\n requires?: Record<string, string[]>;\n /** Stage name → the rung somebody needs on the record to move a card INTO it. */\n who?: Record<string, \"viewer\" | \"commenter\" | \"editor\" | \"admin\">;\n /** Stage name → how many cards may sit there at once. The mover is not counted. */\n limits?: Record<string, number>;\n /** Stage name → what happens when a card arrives: assign, notify, start a checklist. */\n on_entry?: Record<string, Record<string, unknown>>;\n /**\n * Stage name → the gates a card has to get past to land there. The general form under\n * `requires`, `who` and `limits`, and the only one that can say `require_approval`.\n */\n gates?: Record<string, PipelineGate[]>;\n moves_message?: string;\n requires_messages?: Record<string, string>;\n}\n\n/**\n * A gate the organization's own knob overruled. NOTHING FAILS SILENTLY: the move happened\n * and the sentence comes back WITH it, together with what to do about it.\n */\nexport interface StageRuleWarning {\n rule_id: Uuid;\n rule: string;\n /** The gate's own sentence, shown verbatim. */\n why: string;\n what_to_do: string;\n}\n\n/** An approval filed against this card's stage column that nobody has decided yet. */\nexport interface StagePending {\n approval_id: Uuid;\n /** The stage key the card is waiting to go to. */\n to: string;\n why: string | null;\n requested_at: string;\n state: string;\n}\n\n/**\n * The same wait, asked for a WHOLE BOARD in one question (`custom.pipeline_pending`), so a\n * board can badge every card that is waiting without a round trip per card — and therefore\n * actually does it, instead of drawing a filed card as if nobody had ever dragged it.\n */\nexport interface StagePendingOnBoard extends StagePending {\n record_id: Uuid;\n}\n\n/** What `custom.pipeline_move` answers — an OBJECT on every path, never a bare number. */\nexport interface PipelineMoveResult {\n applied: boolean;\n moved: boolean;\n outcome: \"moved\" | \"moved_with_warnings\" | \"needs_approval\";\n to: string;\n version: number;\n /** Set on `moved_with_warnings`. */\n warnings?: StageRuleWarning[];\n /** Set on `needs_approval`: the gate's sentence, the wait that was filed, and who has it. */\n why?: string;\n rule?: string;\n rule_id?: Uuid;\n approval_id?: Uuid;\n approvers?: { user_id: Uuid; name: string | null; why: string }[];\n what_happens?: string;\n}\n\n/**\n * ONE GATE ON A STAGE, as the condition builder on the stage settings screen writes it.\n * `requires`, `who` and `limits` are sugar over this shape; this is the general form, and\n * it speaks the SAME condition language as filters and formulas — never a second one.\n */\nexport interface PipelineGate {\n /** What the gate is called in the settings list. */\n name?: string;\n /** The sentence a person reads when it stops them. Required: a refusal with no words is a dead end. */\n message: string;\n /** WHEN this gate is about this record at all. Absent means always. */\n when?: Record<string, unknown>;\n /** What has to hold. One condition node of the one Rule language. */\n demands: Record<string, unknown>;\n /** Default `refuse`. */\n on_fail?: StageRuleOnFail;\n}\n\n/**\n * THE ONE PLACE A SCREEN DECIDES WHETHER A CARD LOOKS DRAGGABLE — and it decides on the\n * PERSON, not on the rules. Whether a particular move is allowed is\n * `pipelineTransitionRefusal`, which is the store's answer; whether this person may move\n * anything at all is their level on the record, which the read door already told us.\n *\n * Absent rather than dead: a viewer's card carries no drag handle at all, instead of one\n * that looks live and snaps back every time.\n */\nexport function mayDrag(level: string | null | undefined): boolean {\n return level === \"editor\" || level === \"admin\" || level === \"owner\";\n}\n","// src/rule.ts — @ai-matrx/records\n//\n// THE RULE. REC-15 … REC-19. ONE object with FOUR uses — validate, compute,\n// define membership, decide applicability — and no fifth. A Rule references\n// Fields BY ID, never by name (REC-17), and it has versions, so History knows\n// which version produced a Value (REC-19).\n\nimport type { Timestamp, Uuid } from \"./record\";\nimport type { RuleNodeKind, RuleUse } from \"./vocabulary\";\n\n/**\n * A rule expression as `custom.rule_eval` ACTUALLY evaluates it — read off the\n * door's own body, not invented here. A leaf is the node's name carrying its\n * payload (`{\"const\": 3}`, `{\"field\": \"<uuid>\"}`); an operator is\n * `{\"op\": \"eq\", \"args\": [...]}`.\n *\n * `field` / `parent_field` name a Field BY ID (REC-17 — the door refuses\n * `field_name`, `field_key` and `field_label` by name), and `merge_field` is\n * the resolver's seam, storable today and refused `0A000` until W5-MERGE-B.\n *\n * `p_values` is keyed by the Field's KEY: the door resolves the id to a key\n * (`custom.rule_field_key`) and then reads `p_values -> key`.\n */\nexport type RuleExpression =\n | { const: unknown }\n | { field: Uuid }\n | { parent_field: Uuid }\n | { merge_field: string }\n | { op: RuleNodeKind; args: RuleExpression[] };\n\n/** REC-15. One Rule, four uses; a Rule may serve more than one. */\nexport interface Rule {\n id: Uuid;\n organization_id: Uuid;\n name: string;\n kind: string | null;\n /** The Table this Rule is scoped to. */\n scope_table_id: Uuid | null;\n uses: RuleUse[];\n validates: boolean;\n computes: boolean;\n defines_membership: boolean;\n /**\n * REC-16. An applicability Rule reads the record's own Values and its\n * parent's, ONE level up, and no further.\n */\n decides_applicability: boolean;\n applies_to_types: string[];\n use_types: string[];\n expr: RuleExpression;\n /** Which Field this Rule's answer is about (REC-17: by id). */\n target_field_id: Uuid | null;\n /** What a person reads when this Rule refuses. */\n message: string | null;\n sort: number | null;\n created_by: Uuid | null;\n updated_by: Uuid | null;\n created_at: Timestamp;\n updated_at: Timestamp;\n /** REC-19. Rules have versions, and History knows which one produced a Value. */\n version: number;\n metadata: Record<string, unknown>;\n visibility: string;\n}\n\n/** What the store answers when a Rule is run: the answer and the version that gave it. */\nexport interface RuleAnswer {\n rule_id: Uuid;\n rule_name: string;\n rule_version: number;\n applies: boolean;\n answer: unknown;\n}\n\n// ── PRODUCTS row 1: a form is a VIEW ON A REAL TABLE ─────────────────────────\n//\n// A form lives beside the Rules because that is what it is MADE of: an accept\n// Rule decides what counts as a complete answer, and a subscription Rule (DOOR-18)\n// decides who hears about one. The questions are Fields of the subject Table and\n// the answers are ordinary records in it — there is no form silo anywhere.\n\n/** One form as `custom.forms` reports it to its owner. */\nexport interface FormSummary {\n form_id: string;\n table_id: string;\n title: string | null;\n slug: string;\n published_at: string | null;\n closed_at: string | null;\n submission_cap: number | null;\n /** Every answer that arrived, rejected ones excluded from `in_table` and `held`. */\n responses: number;\n /** Answers that became records — the only number that means \"it is in the table\". */\n in_table: number;\n /** Answers waiting for a person, because the form's accept Rule did not clear them. */\n held: number;\n /** Answers the accept Rule or the decoy turned away. */\n rejected: number;\n /** draft · open · closed · full — the store's own word, never derived on a screen. */\n state: \"draft\" | \"open\" | \"closed\" | \"full\";\n quarantine_rule_id: string | null;\n notify_rule_id: string | null;\n presentation: Record<string, unknown>;\n}\n\n/**\n * ONE BOOKING PAGE, AS ITS OWNER SEES IT — `custom.bookings` (PRODUCTS row 14).\n *\n * A booking page is an `anon_form` whose `presentation -> 'booking'` carries the\n * availability and the id of a slots Table, so it is the SAME object a form is and\n * this is the same list `forms()` is, asked for the booking half. The numbers are\n * the store's own: a screen that counted appointments in the browser would drift\n * from the index that actually protects a slot.\n */\nexport interface BookingSummary {\n form_id: string;\n /** The Table the appointments land in — a booking is an ordinary record in it. */\n table_id: string;\n title: string | null;\n slug: string;\n published_at: string | null;\n closed_at: string | null;\n /** How long one appointment is. The offer is the store's, never the browser's. */\n slot_minutes: number;\n /** The organization's own zone, which is what the visitor's times are drawn in. */\n timezone: string;\n /** The ONE slots Table `custom.booking_declare` finds-or-makes for this page. */\n slot_table_id: string;\n booked: number;\n cancelled: number;\n /** Booked and still ahead of now — the number that answers \"what is coming\". */\n upcoming: number;\n /** Slots a visitor is holding right now, before they have given their details. */\n held: number;\n /** The next appointment, or null when there is none. */\n next_at: string | null;\n /** draft · open · closed — the store's own word, never derived on a screen. */\n state: string;\n}\n\n/**\n * ONE WINDOW OF AN ORGANIZATION'S WEEK, in the shape `custom._booking_availability`\n * normalises to and `custom._booking_slots` generates from. `weekday` is 0 for Sunday\n * and 6 for Saturday — the database's own numbering, so a picker and the store cannot\n * disagree about which day Monday is. A window may name ONE member, which is the \"with\n * whom\" of an appointment; naming somebody who is not a member is refused BY NAME.\n */\nexport interface BookingWindow {\n weekday: number;\n /** \"09:00\" */\n from: string;\n /** \"17:00\" — later in the day than `from`, or the store refuses it by name. */\n to: string;\n member_user_id?: string | null;\n}\n\n/**\n * WHAT IS ON OFFER. Every field is the store's to default: a page declared with an\n * empty availability comes back with the organization's timezone, a 30-minute slot and\n * Monday-to-Friday nine-to-five, because a booking page that offered nothing would look\n * broken rather than unconfigured. A screen shows what came BACK, never what it sent.\n */\nexport interface BookingAvailability {\n timezone: string;\n slot_minutes: number;\n /** Dead time kept after each appointment, so two never touch. */\n buffer_minutes: number;\n /** How far ahead of now the earliest bookable slot is. */\n lead_minutes: number;\n /** Most appointments in one day, across every window. */\n max_per_day: number;\n /** How many days ahead the page offers. */\n days: number;\n windows: BookingWindow[];\n}\n\n/**\n * WHAT `custom.booking_declare` ANSWERS. `availability` is the NORMALISED offer —\n * show that, not the draft — and `questions_filled_in` is how many questions the store\n * took over (`slot`, `status`, `booked_with`), which a visitor is never asked.\n *\n * It does NOT publish. `anonPublish` is still the one act that opens the link, exactly\n * as it is for a form, so there is one act and one word for opening a public surface.\n */\nexport interface BookingDeclared {\n form_id: string;\n slot_table_id: string;\n availability: BookingAvailability;\n questions_asked: number;\n questions_filled_in: number;\n ms: number;\n}\n\n/**\n * THE VISITOR'S OWN LINK to a booking page. The page id IS the capability, exactly\n * as it is for a form; `custom.anon_submission.booking_ref` is the separate secret\n * that lets ONE visitor manage the appointment they made.\n */\nexport function bookingPath(formId: string): string {\n return `/b/${formId}`;\n}\n\n/**\n * THE PUBLIC LINK, and the one place its shape is written down.\n *\n * The form's own id IS the capability — 122 bits of UUIDv4, exactly as\n * Typeform's form id in `/to/<id>` is and as an unguessable meeting slug is\n * here. There is no second secret to keep, and revoking it is closing the form.\n */\nexport function publicFormPath(formId: string): string {\n return `/f/${formId}`;\n}\n","// src/portal.ts — @ai-matrx/records\n//\n// THE CLIENT PORTAL, FROM THE OWNER'S SIDE.\n//\n// A portal is the one way somebody with no membership of an organization is\n// let in to see the records that name them — their jobs, their invoices —\n// and nothing else. The store holds it in three tables (`custom.portal`,\n// `custom.portal_table`, `custom.portal_principal`) and answers about it\n// through six doors. These are the shapes those doors answer with, written\n// from the doors' own bodies and never from a screen's convenience.\n//\n// TWO FACTS THIS FILE EXISTS TO KEEP STRAIGHT, because a screen that gets\n// either of them wrong tells somebody a comforting lie:\n//\n// · AN INVITATION CONFERS NOTHING. `custom.portal_invite` writes a row and\n// says so in its own `say` sentence: the person gets access the moment\n// they follow the sign-in link and the platform gives them an identity,\n// and until then the row holds nothing at all. That is why\n// `PortalPrincipal` carries `signed_in` separately from `is_active` —\n// \"invited\" and \"can see their records\" are two different states and one\n// number for both is how an owner comes to believe a client is looking at\n// something they cannot reach.\n//\n// · \"VIEW AS THIS CLIENT\" IS NOT A PORTAL-SHAPED QUERY.\n// `custom.portal_preview` asks `custom.visible_set` for HER user id — the\n// exact call `custom.read_records` makes when she opens the page — so the\n// preview cannot disagree with what she sees. When she has not signed in\n// yet it REFUSES with `02000` and a sentence, rather than answering an\n// empty list that would read as \"she sees nothing\".\n\nimport type { Timestamp, Uuid } from \"./record\";\n\n/** One portal as `custom.portals` reports it to its organization. */\nexport interface PortalSummary {\n portal_id: Uuid;\n title: string;\n slug: string;\n /** The Table whose records ARE the clients. A principal is one of its rows. */\n client_table_id: Uuid;\n /** That Table's name, so a list never has to read a second door to draw a row. */\n client_table: string;\n is_active: boolean;\n /** How many Tables this portal exposes. */\n tables: number;\n /** Everybody invited and not revoked — NOT everybody who can see anything. */\n invited: number;\n /** Of those, how many have followed the link and hold an identity. */\n signed_in: number;\n /** `magic_link` today, and the door refuses every other word by name. */\n sign_in_method: string;\n opened_at: Timestamp | null;\n}\n\n/**\n * ONE (portal, Table) PAIR, as `custom.portal_tables` reports it.\n *\n * 🚨 WHY THIS EXISTS (TAILS-3, 2026-09-21). The Portals rail sits on a Table's\n * page beside Forms, Bookings and Dashboards — all table-scoped — while\n * `custom.portals` takes no table at all. On Rincon Plumbing Co's **Parts**\n * table the rail read \"Portals 10\" and listed ten cards titled \"Your jobs and\n * invoices\", which belong to **Jobs**; the empty state never rendered, so the\n * \"Build it / Ask an agent\" offer was unreachable on EVERY table of any\n * organization that already had one portal.\n *\n * This is the whole of what a table-scoped rail needs: is the table I am\n * standing on in any portal, and if not, which portals could take it.\n */\nexport interface PortalTableRef {\n portal_id: Uuid;\n table_id: Uuid;\n /** That Table's name, so a rail never reads a second door to draw a row. */\n name: string;\n}\n\n/** One Table a portal exposes, as `custom.portal_card` reports it. */\nexport interface PortalTableExposure {\n table_id: Uuid;\n /** The Table's own name. */\n name: string;\n /**\n * The key of the relation Field that says WHOSE a record is. This is the\n * whole of \"only theirs\": the association that Field writes is what carries\n * the record to the client, so a portal cannot exist without one.\n */\n names_via: string;\n /** The field keys a client sees. Empty is impossible — the door fills it. */\n visible_fields: string[];\n /** The subset a client may change. Always a subset of `visible_fields`. */\n editable_fields: string[];\n comments: boolean;\n /**\n * The most a client is ever conveyed on this Table — `viewer`, `commenter`\n * or `editor` — worked out by the door from the two lists above, never by a\n * screen.\n */\n conveys: string;\n}\n\n/** One person a portal was opened to, as `custom.portal_card` reports them. */\nexport interface PortalPrincipal {\n principal_id: Uuid;\n email: string;\n /** The record of the client Table this person IS, for the portal's purposes. */\n client_record_id: Uuid;\n /** That record's title — what an owner calls this client. */\n client: string;\n /** They followed the link and hold an identity. Until then this is false. */\n signed_in: boolean;\n /** Not revoked. An invitation that was never followed is still active. */\n is_active: boolean;\n invited_at: Timestamp;\n revoked_at: Timestamp | null;\n /**\n * THE LINK THE OFFICE COPIES FOR THIS PERSON — `/invitations/portal/accept/<token>`, the\n * path `custom.portal_invite` handed back when they were asked, read off the same\n * `iam.invitations` row and never re-templated.\n *\n * 🚨 `null` IS AN ANSWER, NOT AN ABSENCE, and a screen must say which. It is null when they\n * have already followed the link, when the office took it back (a revoke withdraws the\n * invitation in the same statement), when it has expired, or when they were let in through\n * the server's own magic-link route, which binds without an invitation at all. In every one\n * of those cases there is genuinely no link to copy — so draw a sentence, never a dead\n * control. (TAILS-5, 2026-09-21; the gap PORTAL-BIND left named.)\n */\n accept_path: string | null;\n}\n\n/** Everything about ONE portal: what it shows, and who it was opened to. */\nexport interface PortalCard {\n portal_id: Uuid;\n title: string;\n slug: string;\n is_active: boolean;\n sign_in_method: string;\n client_table_id: Uuid;\n tables: PortalTableExposure[];\n principals: PortalPrincipal[];\n /**\n * Whether this organization's outside lane is open\n * (`custom/external_principal_enabled`). Declaring a portal opens it; while\n * it is false every door refuses an outsider BY NAME, and a screen that drew\n * the people as reachable anyway would be lying about the one thing that\n * decides whether they can sign in at all.\n */\n external_lane_open: boolean;\n}\n\n/** What `custom.portal_invite` answers. `say` is the door's own sentence. */\nexport interface PortalInvitation {\n invited: boolean;\n principal_id: Uuid;\n portal_id: Uuid;\n slug: string;\n email: string;\n client_record_id: Uuid;\n client: string;\n /** They already hold an identity. From a screen this is false: the door is passed no user. */\n bound: boolean;\n /**\n * The door's own words, and the ONLY correct summary of what just happened —\n * it says outright that an invitation confers nothing until the link is\n * followed. Show it; never paraphrase it.\n */\n say: string;\n}\n\n/** What `custom.portal_revoke` answers. `say` names the consequence, past tense. */\nexport interface PortalRevocation {\n revoked: boolean;\n principal_id: Uuid;\n email: string;\n /** The door's own sentence: they can no longer sign in, and their records stop reaching them. */\n say: string;\n}\n\n/** One row of \"what this client sees\", from `custom.portal_preview`. */\nexport interface PortalPreviewRow {\n record_id: Uuid;\n title: string;\n}\n\n/**\n * THE PUBLIC ADDRESS OF A PORTAL, and the one place its shape is written down.\n *\n * Unlike a form's link, a portal's slug is NOT the capability: the page it\n * serves asks who you are and emails a one-time link, so the slug is a name and\n * nothing more. That is why it is readable and why copying it is safe.\n */\nexport function portalPath(slug: string): string {\n return `/portal/c/${slug}`;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// A PORTAL IS ARCHIVED, NEVER DELETED (ORG-CLEANUP, 2026-09-22)\n//\n// The store grew `custom.portal_archive`, `custom.portal_restore` and the\n// archive-aware `custom.list_portals` because Rincon Plumbing Co carried TEN\n// portals all titled \"Your jobs and invoices\" — nine of them the residue of one\n// walk repeated nine times — and there was no door to put any of them away.\n// `is_active = false` is not it: CLOSED is a state an organization chooses about\n// a portal it still has, and its clients are told so by name. ARCHIVED means it\n// is out of the way, and nothing is deleted: every exposed Table and every\n// invited person is handed back exactly as it was.\n//\n// These are the words a screen says about that, written once here so the rail,\n// the guard and any other client say the same thing.\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * The platform archive filter's own three values, and no fourth. `custom.list_portals`\n * refuses anything else with `22023` rather than quietly treating it as one of them.\n */\nexport const PORTAL_ARCHIVE_FILTERS = [\"active\", \"archived\", \"all\"] as const;\nexport type PortalArchiveFilter = (typeof PORTAL_ARCHIVE_FILTERS)[number];\n\n/** THE LAW'S DEFAULT IS TO HIDE. A list nobody narrowed is the live things. */\nexport const DEFAULT_PORTAL_ARCHIVE_FILTER: PortalArchiveFilter = \"active\";\n\nexport function isPortalArchiveFilter(word: unknown): word is PortalArchiveFilter {\n return typeof word === \"string\" && (PORTAL_ARCHIVE_FILTERS as readonly string[]).includes(word);\n}\n\n/** What `custom.portal_archive` and `custom.portal_restore` answer with. */\nexport interface PortalArchiveAnswer {\n /** Where the portal stands NOW — true after an archive, false after a restore. */\n archived: boolean;\n /** False when it was already in that state; the sentence says so rather than lying about an act. */\n changed: boolean;\n portal_id: Uuid;\n archived_at?: Timestamp | null;\n /** The store's own sentence, in plain English. Show it verbatim; never a constraint name. */\n sentence: string;\n}\n\n/**\n * THE CONSEQUENCE, SAID BEFORE THE CLICK — never a generic \"are you sure?\".\n *\n * What actually changes is two things: nobody can sign in to it any more, and it\n * leaves the organization's portal list. What does NOT change is everything\n * else, and saying so is the difference between an archive somebody dares to\n * press and one they avoid.\n */\nexport function portalArchiveConsequence(title: string, signedIn: number, invited: number): string {\n const people =\n invited === 0\n ? \"Nobody is invited to it\"\n : signedIn === 0\n ? `The ${invited} ${invited === 1 ? \"person\" : \"people\"} invited to it will not be able to sign in`\n : `The ${signedIn} ${signedIn === 1 ? \"person\" : \"people\"} signed in to it, and the ${invited - signedIn} still invited, will not be able to sign in`;\n return (\n `“${title}” will leave your portal list. ${people}, and their invitation links will say this ` +\n `portal was archived and can be restored. Nothing is deleted — every Table it shows and ` +\n `everyone invited to it is kept exactly as it is, and you can restore it at any time.`\n );\n}\n\n/**\n * WHY THE TITLE HAS TO BE TYPED BACK, in the store's own reasoning. Ten portals\n * can carry one title, so the title is not what PICKS this one — the portal you\n * opened is. Typing it back is how you say you meant this one.\n */\nexport function portalConfirmLine(title: string): string {\n return `Type the portal’s title — ${title} — to confirm you mean this one.`;\n}\n\n/** True when what the person typed is what the door will accept. The door decides; this only spares them a round trip. */\nexport function portalTitleTypedBack(typed: string, title: string): boolean {\n return typed.trim() === (title ?? \"\").trim();\n}\n\n/**\n * WHAT AN EMPTY ARCHIVE LANE SAYS. An empty list is an answer: it says nothing\n * has been archived, so \"none here\" can never be read as \"the archive is broken\"\n * or as \"this organization has no portals at all\".\n */\nexport function emptyPortalArchiveLine(): string {\n return \"No portal of this organization has been archived. A portal you put away waits here until somebody restores it, and nothing is ever destroyed.\";\n}\n","// src/aggregate.ts — @ai-matrx/records\n//\n// THE EIGHTH VERB (AGT-N-8). `custom.record_aggregate` groups, buckets, filters\n// and measures INSIDE the read door's own query: the aggregate node sits above\n// the join to `custom.query_visible_ids`, so a chart is computed over the rows\n// this principal may see and the rest are never fetched at all.\n//\n// That is why a chart in this platform is not \"read everything, then sum in the\n// browser\". Summing in the browser would either read rows a person may not see\n// or quietly under-count them, and both of those are a screen telling a lie.\n\n/** The measures the store offers. Asked of `custom.agg_operations()` at run time too. */\nexport type AggregateOperation =\n | \"count\" | \"sum\" | \"avg\" | \"min\" | \"max\"\n /** GRID-PRIMITIVES G1: the summary bar's other four. Blank = no value, JSON null or \"\". */\n | \"median\" | \"filled\" | \"empty\" | \"unique\";\n\n/** The periods a date Field can be bucketed into (`custom.agg_buckets()`). */\nexport type AggregateBucket = \"day\" | \"week\" | \"month\" | \"quarter\" | \"year\";\n\n/**\n * A HALF-OPEN MOMENT WINDOW: `from` is inclusive, `to` is exclusive. Half-open\n * is the only shape that makes \"September\" and \"October\" meet exactly once —\n * an inclusive `to` either double-counts the boundary moment or drops it,\n * depending on the reader, and both of those are a chart telling a lie.\n */\nexport interface AggregateWindow {\n from?: string | null;\n to?: string | null;\n}\n\n/**\n * ONE FILTER VALUE, as `custom.record_aggregate` and `custom.dashboard_run`\n * both read it: a SCALAR is an equality, and an OBJECT is a window. It is not\n * `unknown` on purpose — a filter value the store cannot read is a refusal a\n * caller should get from the compiler, not from the database.\n */\nexport type AggregateFilter = string | number | boolean | null | AggregateWindow;\n\n/**\n * 🚨 THE STORE'S ONE FILTER SHAPE, AND THE ONLY NAME FOR IT.\n *\n * An object of Field key -> value. A scalar is an equality, `null` is UNSET\n * (the third state of a tick box), an object is a half-open time window.\n *\n * It is not the aggregate's private shape and never was. `platform.saved_view`\n * has carried exactly this as `definition -> 'filters'` across five live\n * surface keys since DOOR-18; `custom.view_declare` writes it;\n * `custom.agg_view_admits` reads it to decide whether a change belongs to a\n * saved view; `custom.record_aggregate` takes it as `p_filter` to COMPUTE a\n * dashboard number; and `custom.read_records_matching` takes it to OPEN the\n * rows behind that number. One `custom.record_filter_sql` in the database turns\n * it into SQL for the last two, so the number and the rows cannot disagree.\n *\n * Invent a second one and a chart can compute a total whose drill-through\n * lands somewhere else, which is the only way a drill-through can lie.\n */\nexport type RecordFilter = Record<string, AggregateFilter>;\n\n/** One measure. `count` counts rows and needs no Field; the rest read one. */\nexport interface AggregateMeasure {\n op: AggregateOperation;\n /** The Field's key. Required for every operation except `count`. */\n key?: string;\n}\n\n/**\n * One row of an aggregate: which group it is, what each measure came to, and\n * how many records it was worked out from. The measure keys are the store's\n * own (`count`, `sum_amount`, `avg_amount`, …), never renamed on the way out.\n */\nexport interface AggregateRow {\n groups: Record<string, string | null>;\n measures: Record<string, number | null>;\n row_count: number;\n}\n\n/** The measure key the store answers with, so a chart can find its own series. */\nexport function measureKey(measure: AggregateMeasure): string {\n return measure.op === \"count\" ? \"count\" : `${measure.op}_${measure.key ?? \"\"}`;\n}\n\n/**\n * THE QUESTION, AS A STABLE STRING — key-sorted JSON of a `RecordFilter`.\n *\n * A React parent that rebuilds `{ status: \"Cancelled\" }` on every render hands\n * a NEW object every time, and a hook that depends on the object re-reads the\n * whole page on every render forever. Depending on this instead means the page\n * is re-read exactly when the QUESTION changed, which is what a person means.\n *\n * Nested window objects are sorted too, so `{from, to}` and `{to, from}` are\n * one question. `undefined` and an empty filter are both `\"{}\"` — the caller\n * asked nothing, and there is only one way to ask nothing.\n */\nexport function stableFilterKey(filter: RecordFilter | null | undefined): string {\n if (!filter) return \"{}\";\n const keys = Object.keys(filter).sort();\n if (keys.length === 0) return \"{}\";\n const parts = keys.map((key) => {\n const value = filter[key];\n if (value !== null && typeof value === \"object\") {\n const window = value as AggregateWindow;\n return `${JSON.stringify(key)}:{\"from\":${JSON.stringify(window.from ?? null)},\"to\":${JSON.stringify(window.to ?? null)}}`;\n }\n return `${JSON.stringify(key)}:${JSON.stringify(value ?? null)}`;\n });\n return `{${parts.join(\",\")}}`;\n}\n","// src/grid.ts — @ai-matrx/records\n//\n// THE GRID'S STORE PRIMITIVES (lane GRID-PRIMITIVES, 2026-09-22).\n//\n// The /data grid is being rebuilt on the record store with its UI and behaviour unchanged. The\n// older grid kept five things the store could not say; each is now a door, and these are the\n// shapes those doors answer:\n//\n// G1 a Table's colors (row color by a choice column, ordered color rules, hand highlights),\n// its layout (organization default + per-view override) and the summary bar's nine\n// measures → custom.table_decorate / table_decorations,\n// custom.grid_layout, custom.record_aggregate\n// G2 row actions, run on a whole selection in one transaction\n// → custom.action_declare / row_actions / action_run\n// G3 the formula language a person types, worked out by the store\n// → custom.formula_parse (+ formula_text on a Field)\n// G4 every record change out to a signed webhook\n// → custom.table_webhook_declare / table_webhooks /\n// table_webhook_archive\n// G5 autonumber / created / modified time columns, display formats, example tables, Excel\n// → field kinds, custom.autonumber_backfill,\n// custom.table_from_example, custom.io_export\n//\n// Fields and records are named BY ID everywhere here (REC-17): a column renamed keeps its\n// color, its width and its place in a formula.\n\nimport type { Uuid } from \"./record\";\nimport type { RecordsError } from \"./results\";\nimport type { UseCase } from \"./use-cases/types\";\n\n// ── G1: colors ──────────────────────────────────────────────────────────────────────────\n\n/** `custom.decoration_colors()` — the palette, in the order an uncolored choice takes. */\nexport type DecorationColor = \"slate\" | \"green\" | \"amber\" | \"red\" | \"blue\" | \"violet\" | \"teal\";\n\n/** `custom.decoration_rule_ops()` — the tests a color rule may ask. */\nexport type DecorationRuleOp =\n | \"is\" | \"is_not\" | \"contains\" | \"is_empty\" | \"not_empty\" | \"is_true\" | \"is_false\"\n | \"gt\" | \"gte\" | \"lt\" | \"lte\";\n\nexport type DecorationTarget = \"row\" | \"cell\";\n\nexport interface DecorationRule {\n /** Given by the store when omitted; keep it to edit the rule in place. */\n id?: string;\n /** The Field id the rule reads. */\n field: Uuid;\n op: DecorationRuleOp;\n /** Compared as text for is / is_not / contains, as a number for gt / gte / lt / lte. */\n value?: string | number;\n color: DecorationColor;\n target: DecorationTarget;\n}\n\nexport interface TableDecorations {\n version: 1;\n colors: DecorationColor[];\n rule_ops: Array<{ op: DecorationRuleOp; takes_value: boolean; label: string }>;\n color_by?: { field: Uuid; target: DecorationTarget };\n rules: DecorationRule[];\n /** Hand highlights: record id → color. */\n rows: Record<Uuid, DecorationColor>;\n /** Hand highlights: Field id → color. */\n columns: Record<Uuid, DecorationColor>;\n /** Hand highlights: record id → Field id → color. */\n cells: Record<Uuid, Record<Uuid, DecorationColor>>;\n /** What stopped painting because its column is gone — said, never silently dropped. */\n stale: Array<{ part: string; field?: Uuid; rule_id?: string; record_id?: Uuid; says: string }>;\n}\n\n/**\n * ONE LEAF of a Table's colors — the older door's own path shape\n * (`public.udt_set_table_style`), so two people highlighting two rows never overwrite each other.\n */\nexport type DecorationPath =\n | [\"color_by\"]\n | [\"rules\"]\n | [\"rows\", Uuid]\n | [\"columns\", Uuid]\n | [\"cells\", Uuid, Uuid];\n\n// ── G1: layout ──────────────────────────────────────────────────────────────────────────\n\nexport type GridLayoutMode = \"auto\" | \"fit\" | \"scroll\";\nexport type GridRowHeight = \"compact\" | \"normal\" | \"tall\";\n\n/** A saved view's own grid choices, kept at `definition.grid` (custom.view_declare judges them). `definition.layout` is the view's KIND (grid / kanban / calendar / gallery), never these. */\nexport interface ViewLayout {\n mode?: GridLayoutMode;\n row_height?: GridRowHeight;\n freeze_first_column?: boolean;\n wrap?: boolean;\n /** Field id → pixels, 60–1200. */\n widths?: Record<Uuid, number>;\n}\n\nexport interface GridLayout {\n layout: Required<Omit<ViewLayout, \"widths\">> & { fit_max_columns: number; widths?: Record<Uuid, number> };\n /** Where each choice came from. */\n source: Record<string, \"platform\" | \"organization\" | \"view\">;\n view_id: Uuid | null;\n /** A stored choice the grid cannot honour, named. */\n refused: Array<{ from: \"organization\" | \"view\"; choice: string; value: unknown; says: string }>;\n}\n\n// ── G2: row actions ─────────────────────────────────────────────────────────────────────\n\nexport type RowActionStep =\n | { field: Uuid; set: \"value\"; value: unknown }\n | { field: Uuid; set: \"clear\" }\n /** Worked out by the store on each record: the older grid's formula text, or an expression. */\n | { field: Uuid; set: \"compute\"; formula_text?: string; expr?: Record<string, unknown> };\n\nexport interface RowAction {\n /** Given by the store when omitted. */\n id?: Uuid;\n name: string;\n kind?: \"update\" | \"agent\";\n color?: DecorationColor | null;\n icon?: string;\n /** Ask before running. */\n confirm?: boolean;\n steps?: RowActionStep[];\n /** `agent` only: what the record chat opens with. */\n prompt?: string;\n /** On read: whether custom.action_run can run it. */\n runnable?: boolean;\n}\n\nexport interface ActionRunResult {\n action_id: Uuid;\n action: string;\n table_id: Uuid;\n ran: number;\n records: Array<{ record_id: Uuid; version: number }>;\n}\n\n/** One record (and, when it can be named, one field) that refused a row action. */\nexport interface ActionRefusal {\n record_id: Uuid;\n record: string | null;\n field_id: Uuid | null;\n field: string | null;\n code?: string;\n says: string;\n}\n\n/**\n * Every refusal of an action run, read off the store's refusal. A run that any record refused\n * changed NOTHING; this is the list a screen shows so the person can fix those and run again.\n */\nexport function actionRefusals(error: RecordsError): ActionRefusal[] {\n return Array.isArray(error.detail) ? (error.detail as ActionRefusal[]) : [];\n}\n\n// ── G3: formulas ────────────────────────────────────────────────────────────────────────\n\nexport type FormulaParse =\n | {\n ok: true;\n text: string;\n /** The store's expression shape — what `config.expr` holds. */\n expr: Record<string, unknown>;\n references: Array<{ name: string; field_id: Uuid }>;\n result_type: \"number\" | \"text\" | \"boolean\" | \"date\" | \"unknown\";\n }\n | { ok: false; text: string; error: string; position: number };\n\n// ── G4: webhooks ────────────────────────────────────────────────────────────────────────\n\nexport type RecordEvent = \"record.created\" | \"record.updated\" | \"record.archived\" | \"record.restored\" | \"record.purged\";\n\nexport interface TableWebhookDeclared {\n webhook_id: Uuid;\n table_id: Uuid;\n target_url: string;\n events: RecordEvent[];\n /** Shown this once: X-Matrx-Signature is sha256=HMAC-SHA256(secret, body). */\n secret: string;\n says: string;\n}\n\nexport interface TableWebhook {\n webhook_id: Uuid;\n target_url: string;\n description: string | null;\n events: RecordEvent[] | null;\n is_active: boolean;\n last_attempt_at: string | null;\n last_success_at: string | null;\n consecutive_failures: number;\n owner_id: Uuid;\n created_at: string;\n}\n\n// ── G5: examples, export ────────────────────────────────────────────────────────────────\n\n/** What `custom.table_from_example` builds from. */\nexport interface ExampleSpec {\n business: string;\n tables: Array<Record<string, unknown>>;\n}\n\nexport interface ExampleBuilt {\n business: string;\n tables: Array<{ token: string; table_id: Uuid; name: string; records?: number; note?: string }>;\n says: string;\n}\n\n/**\n * ONE REAL USE CASE → the example door's spec. The use case is validated by this package's own\n * suite (`use-cases/validate.ts`); the door refuses placeholder names again as a second line.\n */\nexport function exampleSpec(useCase: UseCase): ExampleSpec {\n return {\n business: useCase.business.name,\n tables: useCase.tables.map((t) => ({\n token: t.token,\n name: t.name,\n labelSingular: t.labelSingular,\n labelPlural: t.labelPlural,\n type: t.type,\n display: t.display,\n weight: t.weight,\n ordered: t.ordered,\n titleField: t.titleField,\n describes: t.describes,\n fields: t.fields.map((f) => ({\n key: f.key,\n label: f.label,\n parityType: f.parityType,\n multi: f.multi,\n dated: f.dated,\n required: f.required,\n unit: f.unit ?? undefined,\n rules: f.rules,\n choices: f.choices,\n source: f.source,\n computeOn: f.computeOn,\n relationTarget: f.relationTarget,\n relationMax: f.relationMax,\n sensitivity: f.sensitivity,\n contextPolicy: f.contextPolicy,\n })),\n rows: t.rows,\n })),\n };\n}\n\n/** One page of `custom.io_export`: exactly what the read door serves this person. */\nexport interface IoExportPage {\n table_id: Uuid;\n token: string;\n columns: string[];\n rows: Array<Record<string, unknown>>;\n /** A column the store withheld from this reader, with the store's reason. */\n withheld: Record<string, unknown>;\n page: { requested: number; returned: number; ceiling: number; next: number | null };\n choices: unknown;\n}\n\nfunction exportCellText(value: unknown): string | number | boolean {\n if (value === null || value === undefined) return \"\";\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") return value;\n return JSON.stringify(value);\n}\n\n/**\n * THE .XLSX OF AN EXPORT PAGE. Numbers stay numbers and booleans stay booleans in the sheet; a\n * column the store withheld is NAMED on a second sheet with the store's reason, so a person\n * never mistakes a withheld column for an empty one. `labels` maps a column key to its header\n * (the Field's label); a key with no label is its own header.\n */\nexport async function exportPageXlsx(\n page: IoExportPage,\n labels: Record<string, string> = {},\n sheetLabel = \"Records\",\n): Promise<Uint8Array> {\n const XLSX = await import(\"xlsx\");\n const header = page.columns.map((c) => labels[c] ?? c);\n const body = page.rows.map((row) => page.columns.map((c) => exportCellText(row[c])));\n const workbook = XLSX.utils.book_new();\n const name = sheetLabel.replace(/[\\\\/?*[\\]:]/g, \" \").trim().slice(0, 31) || \"Records\";\n XLSX.utils.book_append_sheet(workbook, XLSX.utils.aoa_to_sheet([header, ...body]), name);\n const withheld = Object.entries(page.withheld ?? {});\n if (withheld.length > 0) {\n XLSX.utils.book_append_sheet(\n workbook,\n XLSX.utils.aoa_to_sheet([\n [\"Column\", \"Why it is empty in this export\"],\n ...withheld.map(([k, v]) => [labels[k] ?? k, typeof v === \"string\" ? v : JSON.stringify(v)]),\n ]),\n \"Withheld columns\",\n );\n }\n if (page.page?.next !== null && page.page?.next !== undefined) {\n XLSX.utils.book_append_sheet(\n workbook,\n XLSX.utils.aoa_to_sheet([[\n `This file holds the first ${page.page.returned} rows. The table has more; export again from row ${page.page.next + 1}.`,\n ]]),\n \"More rows\",\n );\n }\n return XLSX.write(workbook, { type: \"array\", bookType: \"xlsx\", compression: true }) as Uint8Array;\n}\n\n// ── G8: \"when a row changes, run an agent\" on a record-store table ──────────────────────\n\n/** A record-store row event, as the activity spine carries it (and a schedule matches it). */\nexport type RecordChangeAction = RecordEvent;\n\n/**\n * THE SCHEDULE TRIGGER for \"when a row of this record-store table changes, run …\" — the same\n * `event` trigger the older store's tables use, pointed at this store's events:\n * `entity_type` `custom_record:<table id>`, actions `record.*`, `changed_fields` by column KEY.\n * `scheduler.sch_match_event` matches it against the event\n * `custom._record_events_to_activity` writes (GRID-PRIMITIVES G8), so one matcher serves both\n * stores. Omit `actions` to hear every change; omit `changedFields` to hear every column.\n */\nexport function recordChangeTrigger(\n tableId: Uuid,\n options: { actions?: RecordChangeAction[]; changedFields?: string[] } = {},\n): {\n type: \"event\";\n entity_type: string;\n table_id: Uuid;\n actions?: RecordChangeAction[];\n changed_fields?: string[];\n} {\n return {\n type: \"event\",\n entity_type: `custom_record:${tableId}`,\n table_id: tableId,\n ...(options.actions && options.actions.length > 0 ? { actions: options.actions } : {}),\n ...(options.changedFields && options.changedFields.length > 0 ? { changed_fields: options.changedFields } : {}),\n };\n}\n","// src/capture-queue.ts — @ai-matrx/records · PRODUCTS row 15, primitive P13\n//\n// THE QUEUE THAT MAKES A PHONE WITH NO BARS AS GOOD AS A PHONE WITH FIVE.\n//\n// Fulcrum's field client is the bar: a crew captures all day in a yard with no signal and\n// nothing is lost, nothing is doubled, and nobody has to think about it. Four decisions\n// carry that, and each one is a thing this file refuses to do rather than a feature:\n//\n// 1. THE CAPTURE IS WRITTEN TO DISK BEFORE THE NETWORK IS EVEN ASKED. `enqueue` returns\n// after IndexedDB has the answers AND the photograph's bytes. A queue that holds\n// captures in memory until it can send them loses the day when the screen locks.\n//\n// 2. THE IDEMPOTENCY KEY IS MINTED WHEN THE CAPTURE IS TAKEN, NOT WHEN IT IS SENT. It is\n// the row's own primary key here and `p_client_key` at the door. A lost acknowledgement\n// — the commonest failure on a bad signal, because the write SUCCEEDED and the answer\n// never came back — is then a replay that returns the first record's id, not a second\n// bin.\n//\n// 3. THEY GO UP IN THE ORDER THEY HAPPENED, ONE AT A TIME. A crew's day is a sequence and\n// a foreman reads it as one. Parallel uploads would also mean six photographs sharing\n// one thin signal and all six timing out.\n//\n// 4. A REFUSAL IS NOT A RETRY. A required answer missing, a field the sheet does not ask\n// for, a level the person does not hold — the door has decided, and sending it again\n// every thirty seconds forever is how a queue becomes a silent hole. The item stays,\n// marked `refused`, carrying the door's own sentence for the screen to show. The person\n// fixes it or throws it away; nothing decides that for them.\n//\n// The bytes never go through this file twice: `uploadFile` is called once per file and its\n// reference is written back into the queued row, so a retry after a failed SUBMIT re-sends\n// the reference rather than the photograph.\n\nimport type { CaptureFileRef, CaptureOutcome } from \"./capture\";\n\n/** One file waiting to go up, with its bytes until they have. */\nexport interface QueuedCaptureFile {\n field: string;\n name: string;\n mime_type: string;\n size_bytes: number;\n duration_ms?: number | null | undefined;\n /** The bytes. Dropped once `uploaded` is set, so the queue does not hold them twice. */\n blob?: Blob | null | undefined;\n /** Set once the platform's byte store has them. */\n uploaded?: { file_id?: string | null | undefined; url?: string | null | undefined } | null | undefined;\n}\n\n/** `waiting` → `sending` → `landed`, or `refused` when the door has decided. */\nexport type QueuedCaptureState = \"waiting\" | \"sending\" | \"landed\" | \"refused\";\n\nexport interface QueuedCapture {\n /** Minted on the phone when the capture was taken. The row's key AND the door's. */\n client_key: string;\n organization_id: string;\n sheet_id: string;\n sheet_title?: string | undefined;\n answers: Record<string, unknown>;\n files: QueuedCaptureFile[];\n device: string | null;\n /** The moment the PHONE took it — never the moment the signal came back. */\n captured_at: string;\n location: Record<string, unknown> | null;\n state: QueuedCaptureState;\n attempts: number;\n /** The door's own words, or the network's. Always something a person can act on. */\n last_error: string | null;\n record_id: string | null;\n replayed: boolean;\n queued_at: string;\n landed_at: string | null;\n}\n\nexport interface CaptureQueueCounts {\n waiting: number;\n sending: number;\n refused: number;\n landed: number;\n}\n\n/** What one pass of `sync` did, item by item. Never a single boolean. */\nexport interface CaptureSyncReport {\n attempted: number;\n landed: number;\n replayed: number;\n refused: number;\n deferred: number;\n outcomes: Array<{\n client_key: string;\n state: QueuedCaptureState;\n record_id: string | null;\n replay: boolean;\n says: string | null;\n }>;\n /** Set when the pass stopped early because the network went away again. */\n stopped_because?: string;\n}\n\n/** The two calls the queue makes on the outside world. Injected, so this file is headless. */\nexport interface CaptureQueuePorts {\n /** Put the bytes in the platform's ONE byte store and answer with the reference. */\n uploadFile(\n file: QueuedCaptureFile,\n item: QueuedCapture,\n ): Promise<{ file_id?: string | null; url?: string | null }>;\n /** `client.captureSubmit`. */\n submit(args: {\n sheet_id: string;\n client_key: string;\n answers: Record<string, unknown>;\n files: CaptureFileRef[];\n device?: string | null;\n captured_at?: string | null;\n location?: Record<string, unknown> | null;\n }): Promise<{ ok: boolean; data?: CaptureOutcome | null; error?: { message?: string; code?: string } | null }>;\n}\n\n/** The smallest store the queue needs. IndexedDB in a browser, a Map in a test. */\nexport interface CaptureQueueStore {\n all(): Promise<QueuedCapture[]>;\n put(item: QueuedCapture): Promise<void>;\n remove(clientKey: string): Promise<void>;\n meta(key: string): Promise<string | null>;\n setMeta(key: string, value: string): Promise<void>;\n}\n\nconst DB_NAME = \"matrx-capture\";\nconst DB_VERSION = 1;\nconst ITEMS = \"captures\";\nconst META = \"meta\";\n\n/**\n * THE TWO REFUSALS WORTH REPEATING, and they are the package's own list, not a guess.\n * `results.ts` says it in as many words: `stale_read` (40001) and `timed_out` (57014) are\n * \"the only two refusals in this list worth repeating\"; `store_limit` (53400) is the third\n * — the store ran out of something and the same call works in a quieter moment.\n *\n * EVERYTHING ELSE THE DOOR NAMES IS A DECISION. This was the other way round until a real\n * browser ran it (2026-09-20): the check listed SQLSTATEs, and `RecordsClient` hands back\n * its own WORD — `invalid_argument`, `door` — with the sqlstate beside it. So a capture the\n * store had refused by name was filed as a hiccup and queued again forever, which is the\n * exact silent hole this file's decision 4 exists to prevent. The unit suite passed because\n * it fed the check SQLSTATEs: it was testing the assumption, not the client.\n */\nexport const REFUSALS_WORTH_REPEATING: ReadonlySet<string> = new Set([\n \"stale_read\", \"timed_out\", \"store_limit\",\n]);\nconst SQLSTATES_WORTH_REPEATING: ReadonlySet<string> = new Set([\"40001\", \"57014\", \"53400\"]);\n\n/**\n * Did the door DECIDE, or did the attempt merely fail? A failure with no code at all is a\n * network failure and waits; a refusal the store named is a decision and stays.\n */\nexport function isDecided(\n error: { code?: string | null; sqlstate?: string | null } | null | undefined,\n): boolean {\n if (!error) return false;\n const { code, sqlstate } = error;\n if (code && REFUSALS_WORTH_REPEATING.has(code)) return false;\n if (sqlstate && SQLSTATES_WORTH_REPEATING.has(sqlstate)) return false;\n return !!(code || sqlstate);\n}\n\n/**\n * A key that is unique on a phone that has been offline for a day and has never spoken to\n * a server. `crypto.randomUUID` where it exists; otherwise random bytes, and only then the\n * clock — because two captures in the same millisecond on two phones is exactly the case\n * that must not collide.\n */\nexport function mintClientKey(): string {\n const c: Crypto | undefined = typeof crypto !== \"undefined\" ? crypto : undefined;\n if (c && typeof c.randomUUID === \"function\") return `cap-${c.randomUUID()}`;\n if (c && typeof c.getRandomValues === \"function\") {\n const b = c.getRandomValues(new Uint8Array(16));\n return `cap-${Array.from(b, (x) => x.toString(16).padStart(2, \"0\")).join(\"\")}`;\n }\n return `cap-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;\n}\n\n/** The IndexedDB store. Returns null where there is no IndexedDB at all. */\nexport function indexedDbStore(name = DB_NAME): CaptureQueueStore | null {\n const idb: IDBFactory | undefined =\n typeof globalThis !== \"undefined\" ? (globalThis as { indexedDB?: IDBFactory }).indexedDB : undefined;\n if (!idb) return null;\n\n const open = (): Promise<IDBDatabase> =>\n new Promise((resolve, reject) => {\n const req = idb.open(name, DB_VERSION);\n req.onupgradeneeded = () => {\n const db = req.result;\n if (!db.objectStoreNames.contains(ITEMS)) db.createObjectStore(ITEMS, { keyPath: \"client_key\" });\n if (!db.objectStoreNames.contains(META)) db.createObjectStore(META);\n };\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n\n const run = <T>(store: string, mode: IDBTransactionMode, fn: (s: IDBObjectStore) => IDBRequest<T>): Promise<T> =>\n open().then(\n (db) =>\n new Promise<T>((resolve, reject) => {\n const tx = db.transaction(store, mode);\n const req = fn(tx.objectStore(store));\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n tx.oncomplete = () => db.close();\n }),\n );\n\n return {\n all: () => run<QueuedCapture[]>(ITEMS, \"readonly\", (s) => s.getAll() as IDBRequest<QueuedCapture[]>),\n put: (item) => run<IDBValidKey>(ITEMS, \"readwrite\", (s) => s.put(item)).then(() => undefined),\n remove: (key) => run<undefined>(ITEMS, \"readwrite\", (s) => s.delete(key)).then(() => undefined),\n meta: (key) => run<string | undefined>(META, \"readonly\", (s) => s.get(key) as IDBRequest<string | undefined>)\n .then((v) => v ?? null),\n setMeta: (key, value) =>\n run<IDBValidKey>(META, \"readwrite\", (s) => s.put(value, key)).then(() => undefined),\n };\n}\n\n/** The in-memory store — for a test, and for a browser with storage switched off. */\nexport function memoryStore(): CaptureQueueStore {\n const rows = new Map<string, QueuedCapture>();\n const meta = new Map<string, string>();\n return {\n all: async () => Array.from(rows.values()),\n put: async (item) => void rows.set(item.client_key, item),\n remove: async (key) => void rows.delete(key),\n meta: async (key) => meta.get(key) ?? null,\n setMeta: async (key, value) => void meta.set(key, value),\n };\n}\n\nexport interface CaptureQueueOptions {\n ports: CaptureQueuePorts;\n store?: CaptureQueueStore | null;\n /** Watch `online` and drain when the signal comes back. Default true in a browser. */\n autoSync?: boolean;\n /** Told when anything changes, so a badge can say how many are waiting. */\n onChange?: (counts: CaptureQueueCounts, items: QueuedCapture[]) => void;\n now?: () => Date;\n}\n\nexport interface CaptureQueue {\n /** Write one capture to disk. Returns its client key; the network is not asked here. */\n enqueue(input: {\n organization_id: string;\n sheet_id: string;\n sheet_title?: string;\n answers: Record<string, unknown>;\n files?: Array<Omit<QueuedCaptureFile, \"uploaded\">>;\n device?: string | null;\n captured_at?: string | null;\n location?: Record<string, unknown> | null;\n client_key?: string;\n }): Promise<string>;\n list(): Promise<QueuedCapture[]>;\n counts(): Promise<CaptureQueueCounts>;\n /** Send everything waiting, oldest first, one at a time. Safe to call at any moment. */\n sync(): Promise<CaptureSyncReport>;\n /** Try one refused item again — after the person has fixed what the door named. */\n retry(clientKey: string, patch?: { answers?: Record<string, unknown> }): Promise<void>;\n /** Throw one away. The only thing that ever removes a capture nobody sent. */\n discard(clientKey: string): Promise<void>;\n /** Forget what has already landed. Never touches anything still waiting. */\n clearLanded(): Promise<number>;\n lastSyncedAt(): Promise<string | null>;\n isOnline(): boolean;\n dispose(): void;\n}\n\nfunction countOf(items: QueuedCapture[]): CaptureQueueCounts {\n const c: CaptureQueueCounts = { waiting: 0, sending: 0, refused: 0, landed: 0 };\n for (const i of items) c[i.state] += 1;\n return c;\n}\n\nexport function openCaptureQueue(opts: CaptureQueueOptions): CaptureQueue {\n const now = opts.now ?? (() => new Date());\n const store = opts.store ?? indexedDbStore() ?? memoryStore();\n let syncing: Promise<CaptureSyncReport> | null = null;\n let disposed = false;\n\n const online = (): boolean => {\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined;\n return nav ? nav.onLine !== false : true;\n };\n\n const announce = async () => {\n if (!opts.onChange) return;\n const items = await store.all();\n opts.onChange(countOf(items), items);\n };\n\n const oldestFirst = (items: QueuedCapture[]) =>\n items.slice().sort((a, b) => a.captured_at.localeCompare(b.captured_at));\n\n const queue: CaptureQueue = {\n async enqueue(input) {\n const key = input.client_key ?? mintClientKey();\n const item: QueuedCapture = {\n client_key: key,\n organization_id: input.organization_id,\n sheet_id: input.sheet_id,\n sheet_title: input.sheet_title,\n answers: input.answers ?? {},\n files: (input.files ?? []).map((f) => ({ ...f, uploaded: null })),\n device: input.device ?? null,\n captured_at: input.captured_at ?? now().toISOString(),\n location: input.location ?? null,\n state: \"waiting\",\n attempts: 0,\n last_error: null,\n record_id: null,\n replayed: false,\n queued_at: now().toISOString(),\n landed_at: null,\n };\n await store.put(item);\n await announce();\n return key;\n },\n\n list: () => store.all().then(oldestFirst),\n counts: () => store.all().then(countOf),\n\n async sync() {\n if (syncing) return syncing;\n syncing = (async (): Promise<CaptureSyncReport> => {\n const report: CaptureSyncReport = {\n attempted: 0, landed: 0, replayed: 0, refused: 0, deferred: 0, outcomes: [],\n };\n const pending = oldestFirst(await store.all()).filter((i) => i.state === \"waiting\" || i.state === \"sending\");\n if (!online()) {\n report.deferred = pending.length;\n report.stopped_because = \"There is no signal, so nothing was sent. Everything is still here.\";\n return report;\n }\n\n for (const item of pending) {\n report.attempted += 1;\n item.state = \"sending\";\n item.attempts += 1;\n await store.put(item);\n await announce();\n\n try {\n // THE BYTES FIRST, AND ONLY ONCE. A file whose reference is already written\n // back is not uploaded again, so a failure at the SUBMIT step does not send\n // the photograph twice.\n for (const f of item.files) {\n if (f.uploaded) continue;\n f.uploaded = await opts.ports.uploadFile(f, item);\n f.blob = null;\n await store.put(item);\n }\n\n const refs: CaptureFileRef[] = item.files.map((f) => ({\n field: f.field,\n name: f.name,\n mime_type: f.mime_type,\n size_bytes: f.size_bytes,\n duration_ms: f.duration_ms ?? null,\n file_id: f.uploaded?.file_id ?? null,\n url: f.uploaded?.url ?? null,\n }));\n\n const res = await opts.ports.submit({\n sheet_id: item.sheet_id,\n client_key: item.client_key,\n answers: item.answers,\n files: refs,\n device: item.device,\n captured_at: item.captured_at,\n location: item.location,\n });\n\n if (res.ok && res.data && res.data.record_id) {\n item.state = \"landed\";\n item.record_id = res.data.record_id;\n item.replayed = !!res.data.replay;\n item.landed_at = now().toISOString();\n item.last_error = null;\n report.landed += 1;\n if (item.replayed) report.replayed += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state,\n record_id: item.record_id, replay: item.replayed,\n says: res.data.message ?? null,\n });\n } else if (res.ok && res.data && !res.data.record_id) {\n // The door answered in words — closed, not open yet. It is not a failure of\n // this phone and it is not something a retry loop can fix.\n item.state = \"refused\";\n item.last_error = res.data.message ?? `This sheet is ${res.data.state}.`;\n report.refused += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state, record_id: null,\n replay: false, says: item.last_error,\n });\n } else if (isDecided(res.error)) {\n item.state = \"refused\";\n item.last_error = res.error?.message ?? \"The store refused this capture.\";\n report.refused += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state, record_id: null,\n replay: false, says: item.last_error,\n });\n } else {\n item.state = \"waiting\";\n item.last_error = res.error?.message ?? \"It could not be sent just now.\";\n report.deferred += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state, record_id: null,\n replay: false, says: item.last_error,\n });\n }\n } catch (err) {\n // A thrown error is the NETWORK, not a decision: it waits.\n item.state = \"waiting\";\n item.last_error =\n err instanceof Error ? err.message : \"It could not be sent just now.\";\n report.deferred += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state, record_id: null,\n replay: false, says: item.last_error,\n });\n }\n\n await store.put(item);\n await announce();\n\n if (!online()) {\n report.stopped_because =\n \"The signal went away again. Everything still on the phone is still here.\";\n break;\n }\n }\n\n await store.setMeta(\"last_synced_at\", now().toISOString());\n return report;\n })();\n try {\n return await syncing;\n } finally {\n syncing = null;\n }\n },\n\n async retry(clientKey, patch) {\n const items = await store.all();\n const item = items.find((i) => i.client_key === clientKey);\n if (!item) return;\n if (patch?.answers) item.answers = { ...item.answers, ...patch.answers };\n item.state = \"waiting\";\n item.last_error = null;\n await store.put(item);\n await announce();\n },\n\n async discard(clientKey) {\n await store.remove(clientKey);\n await announce();\n },\n\n async clearLanded() {\n const items = await store.all();\n const landed = items.filter((i) => i.state === \"landed\");\n for (const i of landed) await store.remove(i.client_key);\n await announce();\n return landed.length;\n },\n\n lastSyncedAt: () => store.meta(\"last_synced_at\"),\n isOnline: online,\n\n dispose() {\n disposed = true;\n if (typeof window !== \"undefined\" && handler) window.removeEventListener(\"online\", handler);\n },\n };\n\n let handler: (() => void) | null = null;\n const auto = opts.autoSync ?? typeof window !== \"undefined\";\n if (auto && typeof window !== \"undefined\") {\n handler = () => {\n if (!disposed) void queue.sync();\n };\n window.addEventListener(\"online\", handler);\n }\n\n return queue;\n}\n","// src/results.ts — @ai-matrx/records\n//\n// THE NEVER-THROW RESULT ENVELOPE, and the refusal vocabulary behind it.\n//\n// This package's whole posture toward the store is in one sentence: THE CLIENT\n// MIRRORS THE STORE'S CONTRACT AND NEVER RE-IMPLEMENTS A RULE THE STORE\n// ENFORCES. When the store refuses, the client hands back the store's OWN\n// message, the store's OWN hint and the store's OWN SQLSTATE, under a code a\n// screen can branch on. It never rewrites the sentence, never swallows it, and\n// never invents a friendlier one — the store's refusals were written to be read\n// by a person, and a client that paraphrases them is lying about what happened.\n\nimport type { PerValueAccessWord } from \"./vocabulary\";\nimport type { Uuid } from \"./record\";\n\n/**\n * What KIND of refusal it was. The mapping from SQLSTATE to code lives in\n * `/core`, and it is checked against `STORE_REFUSAL_CODES` — the list of every\n * SQLSTATE the store's own bodies raise, generated from the live catalogue. A\n * code the store can raise and this union cannot name is a hole, and the\n * real-door suite fails on it.\n */\nexport type RecordsErrorCode =\n /** `PT409` — somebody else's write won. The record clock moved under you. */\n | \"stale_write\"\n /** `42501` — a door. Either the schema is revoked, or the store is switched off, or this principal may not pass. */\n | \"door\"\n /** `23514` — a Rule, a shape guard, or a validation the store enforces refused it. */\n | \"refused_by_rule\"\n /**\n * `22004` / `22023` / `22P02` — the call itself was malformed: a missing id, a\n * patch that is not an object, or a value that does not fit the type the\n * store holds for that Field. The store's own message names the value and the\n * type it could not be read as.\n */\n | \"invalid_argument\"\n /** `02000` — the record is not here (deleted, never existed, or another organization's). */\n | \"not_found\"\n /** `23503` — something it points at is not there. */\n | \"missing_reference\"\n /** `23505` — that thing is already here. */\n | \"already_exists\"\n /** `0A000` — the store does not do this yet, and says which part. */\n | \"not_supported\"\n /** `53400` / `22012` — the store ran out of something, or the arithmetic could not be done. */\n | \"store_limit\"\n /**\n * `40001` — the visibility snapshot this connection carries is older than a\n * write the reader has already observed, so the store refused to answer at\n * all rather than hand back something they just lost. Retry on a fresh\n * connection; it is the one refusal in this list that is worth repeating.\n */\n | \"stale_read\"\n /**\n * `57014` — the store cancelled the statement at its own timeout. Nothing was\n * refused on its merits and nothing was written; the same call can succeed on\n * a smaller page or a quieter moment. With `stale_read`, one of the only two\n * refusals in this list worth repeating.\n */\n | \"timed_out\"\n /**\n * THE DOOR THAT DOES NOT EXIST YET. Not an error condition in the database —\n * this package asked for a door that is not in the live catalogue, so it\n * refused to guess. `door_absent` always names the door and the lane that\n * owns it; it is never a silent no-op and never an empty list.\n */\n | \"door_absent\"\n /**\n * `PGRST202` / `PGRST205` — PostgREST could not find the function or the\n * schema. The database this client is pointed at is not serving the record\n * store: the schema is not exposed, or the grants are not there.\n */\n | \"store_not_served\"\n /**\n * `PT428` — the move was not refused and it did not happen: a stage gate whose\n * `on_fail` is `require_approval` filed a request with the people who can\n * answer it, and left the record exactly where it was. The store's own\n * sentence is the gate's own sentence, and the DETAIL carries the approval.\n *\n * It is the one code in this list that is not a failure. A screen that drew it\n * as one would tell somebody their work was rejected when it is being\n * considered; a screen that drew it as success would move the card while\n * somebody is still deciding. `custom.pipeline_move` answers an object on this\n * path rather than raising, so a caller only meets PT428 when the move went\n * through the ORDINARY write door — which is most of them.\n */\n | \"needs_approval\"\n /**\n * THE CALL NEVER REACHED THE STORE. Not a refusal — a transport failure: the\n * browser lost the network, the gateway answered with an HTTP status and no\n * body, the request was cancelled. supabase-js hands these back with an EMPTY\n * `code` (a `FetchError`) or with the HTTP status in it (`\"404\"`, `\"502\"`),\n * neither of which is a SQLSTATE, and until 2026-09-22 they all landed in\n * `internal` — which is the one classification that tells a screen nothing,\n * and which made the package print a sentence about ITSELF to the person\n * (lane TAILS-6). Nothing was written, and the same call can simply be made\n * again, which is what separates it from `internal`.\n */\n | \"unreachable\"\n /** Anything the mapper could not place. It still carries the store's own words. */\n | \"internal\";\n\n/** A refusal, in the store's own words. */\nexport interface RecordsError {\n code: RecordsErrorCode;\n /** THE STORE'S message, verbatim. Never paraphrased. */\n message: string;\n /** THE STORE'S hint, verbatim — this is where the remedy is written. */\n hint?: string;\n /** The SQLSTATE, so a caller can be exact when a code is not exact enough. */\n sqlstate?: string;\n /** Whatever the store put in DETAIL, parsed when it was json. */\n detail?: unknown;\n /**\n * TRUE when this package did not recognise the class it was handed, so a\n * caller can say so instead of reading the silence as \"handled\".\n *\n * 🚨 IT IS A FLAG AND A SEPARATE SENTENCE, NEVER AN APPENDIX TO `hint`\n * (lane TAILS-6, 2026-09-22). `mapPgError` used to append \"@ai-matrx/records\n * did not recognise SQLSTATE … from checklistTemplates\" ONTO `hint`, and\n * `hint` is the field every screen treats as THE REMEDY — the sentence a\n * person is told to act on. So a dropped connection on the Checklists tab\n * showed a plumbing company \"Something went wrong at our end\" over a line\n * about a TypeScript package and a SQLSTATE. A note this package writes about\n * ITSELF is for whoever debugs it and belongs nowhere a person reads.\n */\n unmapped?: boolean;\n /**\n * THIS PACKAGE'S OWN NOTE, for an engineer. Never the store's words and never\n * a person's: screens render it out of sight (a `title` attribute, a\n * screen-reader line) or not at all.\n */\n diagnostic?: string;\n}\n\nexport type RecordsResult<T> = { ok: true; data: T } | { ok: false; error: RecordsError };\n\n/** Narrowing helper for hosts compiled without `strictNullChecks`. */\nexport function isRecordsErr<T>(\n result: RecordsResult<T>,\n): result is { ok: false; error: RecordsError } {\n return result.ok === false;\n}\n\nexport const ok = <T>(data: T): RecordsResult<T> => ({ ok: true, data });\nexport const err = <T>(error: RecordsError): RecordsResult<T> => ({ ok: false, error });\n\n/**\n * A `stale_write` carries everything the screen needs to show the conflict\n * rather than a toast: which version you wrote against, which one won, and the\n * value of every field you touched as it stands now. The store builds this and\n * this type is its shape — nothing is reconstructed on the client.\n */\nexport interface StaleWriteDetail {\n expected_version: number;\n current_version: number;\n contested_fields: Record<string, unknown>;\n}\n\n/** The parsed form of a `stale_write`, for `useRecordMutation`'s conflict state. */\nexport interface WriteConflict extends StaleWriteDetail {\n record_id: Uuid;\n /** The store's own sentence — what the screen shows. */\n message: string;\n /** The store's own remedy. */\n hint: string;\n}\n\n/**\n * The structural shape of a PostgREST failure as supabase-js resolves it: a\n * PLAIN OBJECT parsed from the response body, NOT an `Error`. Reading\n * `.message` off `instanceof Error` discards the real database message on every\n * genuine failure.\n */\nexport interface PgError {\n code?: string | null;\n message: string;\n details?: string | null;\n hint?: string | null;\n}\n\n/** What the validation mirror answers: the same sentence the trigger would raise. */\nexport interface PredictedRefusal {\n /** The field key the store would name, when it names one. */\n field_key?: string;\n /** The message the store's own body would raise, word for word. */\n message: string;\n hint?: string;\n /** The store's structured detail, when its refusal carries one (e.g. `{ example }`). */\n detail?: Record<string, unknown>;\n sqlstate: string;\n /**\n * Which of the store's bodies would raise it, so a reader can go and check\n * that this mirror still tells the truth.\n */\n predicted_by: string;\n}\n\n/** VAL-5 / VAL-6, named so a caller can say which word was the problem. */\nexport interface ForbiddenEnvelopeWord {\n field_key: string;\n word: PerValueAccessWord;\n}\n","/**\n * THE CLIENT OPERATION LEDGER — how a browser recognises the echo of its own write.\n *\n * Every private-channel notice the record store broadcasts reaches EVERY browser watching that\n * Table, including the one that caused it. Until now the writer had no way to tell its own\n * change from a colleague's: the notice carried ids and nothing about who moved them, so\n * `recordsRealtimePort.ts` declared `acceptEchoFromSelf: true` and the writer re-read a page it\n * had already updated. It was named honestly rather than faked, and this is the other half.\n *\n * THE SHAPE. Every write through `RecordsClient` mints a uuid, sends it to the store as the\n * platform envelope key `_op_id`, and remembers it here. The store lifts that key out before\n * storage — it is never written onto the record — carries it on the change-feed row, and puts\n * it in the notice as `op_id`. A notice whose `op_id` is in this ledger is this browser's own\n * echo and is dropped.\n *\n * WHY A TIME WINDOW RATHER THAN A DELETE-ON-MATCH. One write can produce MORE THAN ONE notice:\n * a record write that also moves a column produces a `record` notice and a `field` notice, and\n * a statement touching two Tables produces one per Table. Forgetting an op the first time it\n * came back would make the second notice look like somebody else's and cost the re-read this\n * exists to avoid. So an op is remembered for a window and expires on its own.\n *\n * 🚨 THE WINDOW IS A CORRECTNESS BOUNDARY, NOT A TUNING KNOB, AND IT FAILS IN THE SAFE\n * DIRECTION BY CONSTRUCTION. Too SHORT and a late echo is treated as a stranger's change: one\n * extra read of a page that is already correct — invisible. Too LONG and a stranger's change\n * that happened to reuse our uuid would be dropped — which cannot happen, because it is a v4\n * uuid nobody else has ever seen. The only real cost of a long window is memory, so it is\n * bounded by COUNT as well as by time.\n *\n * WHAT THIS IS NOT. It is not a replacement for the store's optimistic concurrency, and it\n * never decides what is true — a dropped echo means \"I already know about this\", and every\n * path that could be wrong about that (a reconnect, a tab wake, a notice with no `op_id` at\n * all) re-reads through the door as it always did.\n */\nimport type { Uuid } from \"./core/index\";\n\n/** How long an operation stays recognisable as ours. See the header: it fails safe both ways. */\nconst REMEMBER_MS = 30_000;\n\n/** A ceiling so a long-lived tab that writes constantly cannot grow this without bound. */\nconst REMEMBER_MAX = 500;\n\n/** op id → the moment it was minted. Insertion-ordered, which is what makes the trim cheap. */\nconst ours = new Map<string, number>();\n\nfunction trim(now: number): void {\n // A Map iterates in insertion order and ids are minted in time order, so the first entry\n // that is still inside the window means every entry after it is too.\n for (const [id, at] of ours) {\n if (now - at <= REMEMBER_MS) break;\n ours.delete(id);\n }\n // Then the ceiling, oldest first, for a tab that writes faster than the window expires.\n while (ours.size > REMEMBER_MAX) {\n const oldest = ours.keys().next();\n if (oldest.done === true) break;\n ours.delete(oldest.value);\n }\n}\n\n/**\n * Mint the id for one client operation and remember it as ours.\n *\n * ONE CALL IS ONE OPERATION. A fifty-row paste through `recordWriteMany` is ONE op id, because\n * the store announces one statement once — and it REFUSES a batch carrying two different ones\n * by name, for exactly that reason.\n */\nexport function mintOpId(): Uuid {\n const id = crypto.randomUUID();\n const now = Date.now();\n ours.set(id, now);\n trim(now);\n return id as Uuid;\n}\n\n/**\n * Is this notice the echo of a write this browser made?\n *\n * `undefined`/`null` is NOT ours and never has been: a notice with no `op_id` came from a\n * server-side write, an agent tool, another client, or a store older than this mechanism —\n * all of which are changes this browser has not seen and must read.\n */\nexport function isOwnOp(opId: string | null | undefined): boolean {\n if (!opId) return false;\n const at = ours.get(opId);\n if (at === undefined) return false;\n if (Date.now() - at > REMEMBER_MS) {\n ours.delete(opId);\n return false;\n }\n return true;\n}\n\n/** Test seam: forget everything. Never called by product code. */\nexport function forgetAllOps(): void {\n ours.clear();\n}\n\n/** Test seam: how many operations are currently remembered. */\nexport function rememberedOpCount(): number {\n return ours.size;\n}\n","// src/store.generated.ts — @ai-matrx/records\n//\n// GENERATED. Do not edit by hand: `pnpm records:generate` rewrites it from the\n// live record store, and `pnpm check:store-registry` fails the build when this\n// file and the store disagree. Every literal below was read from the database's\n// own catalogue — the vocabularies from the store's vocabulary functions, the\n// parity types from `custom.parity_field_types()`, the doors from `pg_proc`,\n// the kernel ids from the kernel rows themselves, the tokens from\n// `platform.entity_types`.\n//\n// Counts at generation: 3 actor words, 4 absence\n// reasons, 14 parity field types, 19 declarable field kinds,\n// 67 rule node kinds,\n// 9 kernel Tables, 605 doors, 56 knobs,\n// 1026 entity tokens.\n\nexport const ACTOR_VOCABULARY = [\"user\", \"agent\", \"system\"] as const;\n\n/** The three words the store still accepts and rewrites, and what each becomes. */\nexport const RETIRED_ACTOR_WORDS = {\"ai\": \"agent\", \"code\": \"system\", \"human\": \"user\"} as const;\n\nexport const ABSENCE_REASONS = [\"never asked\", \"none\", \"refused\", \"conflicting\"] as const;\n\nexport const VALUE_ENVELOPE_KEYS = [\"ver\", \"src\", \"actor\", \"on_behalf_of\", \"at\", \"absent\", \"alternates\", \"dated\", \"pinned\"] as const;\n\nexport const VALUE_ALTERNATE_KEYS = [\"value\", \"src\", \"rank\"] as const;\n\nexport const STORAGE_MODES = [\"light\", \"heavy\"] as const;\n\nexport const RULE_USES = [\"validate\", \"compute\", \"membership\", \"applicability\"] as const;\n\nexport const PER_VALUE_ACCESS_WORDS = [\"visibility\", \"access\", \"share\", \"acl\", \"permission\", \"permissions\", \"secret\"] as const;\n\n/** FLD-11's parity floor, each with the behaviour it is MADE OF (FLD-1). */\nexport const PARITY_FIELD_TYPES = [\n { parity_type: \"attachment\", behavior: \"relation\", made_of: \"REC-31: a File record reached through a relation, target the kernel `File` Table\" },\n { parity_type: \"checkbox\", behavior: \"boolean\", made_of: \"a ticked or unticked answer, stored as a REAL boolean — and a record that never answered holds neither, so filters and group-by see three states, not two\" },\n { parity_type: \"currency\", behavior: \"range\", made_of: \"FLD-N-1: a number whose UNIT is the currency and whose format is currency — on the Field, never in presentation\" },\n { parity_type: \"datetime\", behavior: \"range\", made_of: \"a range of kind date or datetime — the dated modifier says the VALUES are dated, which is a different question\" },\n { parity_type: \"email\", behavior: \"text\", made_of: \"text whose format is email\" },\n { parity_type: \"formula\", behavior: \"formula\", made_of: \"FLD-9: a declared computation, on read or on write, evaluated by custom.rule_eval\" },\n { parity_type: \"lookup\", behavior: \"formula\", made_of: \"a Value read THROUGH a relation — config.via names the relation field, config.pick the Value on the far side\" },\n { parity_type: \"member\", behavior: \"relation\", made_of: \"a person: a relation whose target is the kernel `Person` Table\" },\n { parity_type: \"multi_select\", behavior: \"list\", made_of: \"many choices from the same Table — the multi modifier, never a second behaviour\" },\n { parity_type: \"percent\", behavior: \"range\", made_of: \"a number whose unit is % and whose format is percent\" },\n { parity_type: \"phone\", behavior: \"text\", made_of: \"text whose format is phone\" },\n { parity_type: \"rollup\", behavior: \"formula\", made_of: \"an aggregate ALONG a relation — config.via, config.of, config.agg; far-side ids are taken DISTINCT, so nothing is counted twice\" },\n { parity_type: \"select\", behavior: \"list\", made_of: \"one choice from a Table shown as a list (FLD-5/FLD-6)\" },\n { parity_type: \"url\", behavior: \"text\", made_of: \"text whose format is url, with the pattern Rule that makes the format enforceable\" },\n] as const;\n\n/**\n * THE ONE REGISTRY: every kind a column can be DECLARED as, from\n * `custom.field_kinds()`. `parity` says whether the kind is one of FLD-11's parity\n * floor; the rest are the behaviours and formats the declaration door answers to and\n * nothing else enumerated — which is how `signature` came to be a shape\n * `custom.doc_sign` accepted and no screen could offer.\n */\nexport const DECLARABLE_FIELD_KINDS = [\n { kind: \"attachment\", behavior: \"relation\", parity: true, made_of: \"REC-31: a File record reached through a relation, target the kernel `File` Table\" },\n { kind: \"checkbox\", behavior: \"boolean\", parity: true, made_of: \"a ticked or unticked answer, stored as a REAL boolean — and a record that never answered holds neither, so filters and group-by see three states, not two\" },\n { kind: \"currency\", behavior: \"range\", parity: true, made_of: \"FLD-N-1: a number whose UNIT is the currency and whose format is currency — on the Field, never in presentation\" },\n { kind: \"datetime\", behavior: \"range\", parity: true, made_of: \"a range of kind date or datetime — the dated modifier says the VALUES are dated, which is a different question\" },\n { kind: \"email\", behavior: \"text\", parity: true, made_of: \"text whose format is email\" },\n { kind: \"formula\", behavior: \"formula\", parity: true, made_of: \"FLD-9: a declared computation, on read or on write, evaluated by custom.rule_eval\" },\n { kind: \"long_text\", behavior: \"text\", parity: false, made_of: \"behaviour text with format long and config.multiline, for several lines rather than one\" },\n { kind: \"lookup\", behavior: \"formula\", parity: true, made_of: \"a Value read THROUGH a relation — config.via names the relation field, config.pick the Value on the far side\" },\n { kind: \"member\", behavior: \"relation\", parity: true, made_of: \"a person: a relation whose target is the kernel `Person` Table\" },\n { kind: \"multi_select\", behavior: \"list\", parity: true, made_of: \"many choices from the same Table — the multi modifier, never a second behaviour\" },\n { kind: \"number\", behavior: \"range\", parity: false, made_of: \"a plain number: behaviour range with no date kind and neither the currency nor the percent format\" },\n { kind: \"percent\", behavior: \"range\", parity: true, made_of: \"a number whose unit is % and whose format is percent\" },\n { kind: \"phone\", behavior: \"text\", parity: true, made_of: \"text whose format is phone\" },\n { kind: \"relation\", behavior: \"relation\", parity: false, made_of: \"REL / FLD-11: a relation a person aims themselves — relation_target names a Table of this organization, and it is a BEHAVIOUR, never a parity type of its own\" },\n { kind: \"rollup\", behavior: \"formula\", parity: true, made_of: \"an aggregate ALONG a relation — config.via, config.of, config.agg; far-side ids are taken DISTINCT, so nothing is counted twice\" },\n { kind: \"select\", behavior: \"list\", parity: true, made_of: \"one choice from a Table shown as a list (FLD-5/FLD-6)\" },\n { kind: \"signature\", behavior: \"text\", parity: false, made_of: \"VAL-10: behaviour text whose format is signature — the one shape custom.doc_sign accepts, sealed by custom.doc_signature_write and checked by custom.doc_signature_intact\" },\n { kind: \"text\", behavior: \"text\", parity: false, made_of: \"plain text: behaviour text with no format — it carries no parity type, which is exactly what custom.parity_type answers for it\" },\n { kind: \"url\", behavior: \"text\", parity: true, made_of: \"text whose format is url, with the pattern Rule that makes the format enforceable\" },\n] as const;\n\n/** The node kinds `custom.rule_eval` evaluates, and the lane that owns each. */\nexport const RULE_NODE_KINDS = [\n { node: \"actor_at_least\", evaluated_by: \"PIPELINES\" },\n { node: \"add\", evaluated_by: \"W1-RULE\" },\n { node: \"and\", evaluated_by: \"W1-RULE\" },\n { node: \"concat\", evaluated_by: \"W1-RULE\" },\n { node: \"const\", evaluated_by: \"W1-RULE\" },\n { node: \"div\", evaluated_by: \"W1-RULE\" },\n { node: \"eq\", evaluated_by: \"W1-RULE\" },\n { node: \"field\", evaluated_by: \"W1-RULE\" },\n { node: \"fx.abs\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.add\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.and\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.autonumber\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.average\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.blank\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.concatenate\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.contains\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.created_time\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.dateadd\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.datediff\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.day\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.div\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.eq\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.gt\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.gte\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.if\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.isblank\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.left\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.len\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.lower\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.lt\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.lte\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.max\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.min\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.mod\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.modified_time\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.month\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.mul\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.ne\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.neg\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.not\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.now\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.or\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.right\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.round\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.sub\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.sum\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.today\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.trim\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.upper\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.year\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"gt\", evaluated_by: \"W1-RULE\" },\n { node: \"gte\", evaluated_by: \"W1-RULE\" },\n { node: \"length\", evaluated_by: \"W1-RULE\" },\n { node: \"lt\", evaluated_by: \"W1-RULE\" },\n { node: \"lte\", evaluated_by: \"W1-RULE\" },\n { node: \"matches\", evaluated_by: \"W1-RULE\" },\n { node: \"merge_field\", evaluated_by: \"W5-MERGE-B\" },\n { node: \"mul\", evaluated_by: \"W1-RULE\" },\n { node: \"ne\", evaluated_by: \"W1-RULE\" },\n { node: \"not\", evaluated_by: \"W1-RULE\" },\n { node: \"or\", evaluated_by: \"W1-RULE\" },\n { node: \"parent_field\", evaluated_by: \"W1-RULE-APPLY\" },\n { node: \"present\", evaluated_by: \"W1-RULE\" },\n { node: \"previous\", evaluated_by: \"PIPELINES\" },\n { node: \"sibling_count\", evaluated_by: \"STAGE-RULES\" },\n { node: \"stage_count\", evaluated_by: \"PIPELINES\" },\n { node: \"sub\", evaluated_by: \"W1-RULE\" },\n] as const;\n\n/** REC-27. The kernel, by name and by id, as the store holds it. */\nexport const KERNEL_TABLES = [\n { id: \"11111111-0000-4000-8000-000000000002\", name: \"Field\" },\n { id: \"11111111-0000-4000-8000-000000000006\", name: \"File\" },\n { id: \"11111111-0000-4000-8000-000000000009\", name: \"Merge Field\" },\n { id: \"11111111-0000-4000-8000-000000000004\", name: \"Organization\" },\n { id: \"11111111-0000-4000-8000-000000000005\", name: \"Person\" },\n { id: \"11111111-0000-4000-8000-000000000007\", name: \"Presentation\" },\n { id: \"11111111-0000-4000-8000-000000000003\", name: \"Rule\" },\n { id: \"11111111-0000-4000-8000-000000000001\", name: \"Table\" },\n { id: \"11111111-0000-4000-8000-000000000008\", name: \"Widget\" },\n] as const;\n\n/**\n * Every door the store actually has, with the argument list and the result the\n * catalogue reports. A client call whose door is not in this list is answered\n * `door_absent` by name — never a guess, never a silent no-op.\n */\nexport const STORE_DOORS = [\n { name: \"absence_reasons\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"action_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_actions jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"action_run\", args: \"p_organization_id uuid, p_action_id uuid, p_record_ids uuid[]\", returns: \"jsonb\", security: \"definer\" },\n { name: \"actor_vocabulary\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"actor_word\", args: \"p_declared text\", returns: \"text\", security: \"invoker\" },\n { name: \"addressed_cap\", args: \"p_user_id uuid, p_type text, p_id uuid, p_organization_id uuid DEFAULT NULL::uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"permission_level\", security: \"definer\" },\n { name: \"addressed_cap_specific\", args: \"p_user_id uuid, p_type text, p_id uuid, p_organization_id uuid DEFAULT NULL::uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"permission_level\", security: \"definer\" },\n { name: \"agent_change_approval\", args: \"p_organization uuid, p_conversation uuid DEFAULT NULL::uuid, p_table uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"agent_context\", args: \"p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 50\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"agent_table_claim\", args: \"p_organization uuid, p_table uuid, p_conversation uuid DEFAULT NULL::uuid\", returns: \"void\", security: \"definer\" },\n { name: \"agg_assert_key\", args: \"p_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_buckets\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"agg_cadence_normalize\", args: \"p_cadence text\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_deliver\", args: \"p_organization_id uuid, p_rule_id uuid, p_record_id uuid, p_channel text, p_recipient_user_id uuid, p_event_key text, p_subject text, p_body text, p_payload jsonb DEFAULT '{}'::jsonb, p_dedupe_suffix text DEFAULT NULL::text\", returns: \"uuid\", security: \"invoker\" },\n { name: \"agg_deliver_quietly\", args: \"p_organization_id uuid, p_rule_id uuid, p_subject_id uuid, p_channel text, p_recipient_user_id uuid, p_event_key text, p_subject text, p_body text, p_payload jsonb, p_quiet_hours jsonb, p_link text, p_dedupe_suffix text DEFAULT NULL::text\", returns: \"uuid\", security: \"invoker\" },\n { name: \"agg_digest_assemble\", args: \"p_organization_id uuid, p_rule_id uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone, p_until timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"agg_digest_due_at\", args: \"p_cadence text, p_schedule text, p_quiet jsonb, p_after timestamp with time zone\", returns: \"timestamp with time zone\", security: \"invoker\" },\n { name: \"agg_digest_run\", args: \"p_organization_id uuid, p_rule_id uuid DEFAULT NULL::uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_digest_tick\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_explain\", args: \"p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_required text DEFAULT 'viewer'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"agg_last_digest_at\", args: \"p_organization_id uuid, p_rule_id uuid\", returns: \"timestamp with time zone\", security: \"invoker\" },\n { name: \"agg_operations\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"agg_quiet_until\", args: \"p_quiet jsonb, p_at timestamp with time zone\", returns: \"timestamp with time zone\", security: \"invoker\" },\n { name: \"agg_record_name\", args: \"p_organization_id uuid, p_record_id uuid, p_state jsonb DEFAULT NULL::jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_sql\", args: \"p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 200, p_required text DEFAULT 'viewer'::text\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_subscription_cadences\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"agg_subscription_fire\", args: \"p_organization_id uuid, p_record_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_changed_field_ids jsonb DEFAULT '[]'::jsonb\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_subscription_fire_entered\", args: \"p_organization_id uuid, p_record_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_subscription_tick\", args: \"p_window interval DEFAULT '00:15:00'::interval\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_subscriptions\", args: \"p_organization_id uuid, p_saved_view_id uuid DEFAULT NULL::uuid, p_cadence text DEFAULT NULL::text\", returns: \"TABLE(rule_id uuid, saved_view_id uuid, table_id uuid, cadence text, schedule text, quiet_hours jsonb, channel text, recipient_user_id uuid, event_key text, name text)\", security: \"invoker\" },\n { name: \"agg_value_sql\", args: \"p_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_view_admits\", args: \"p_organization_id uuid, p_saved_view_id uuid, p_record_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"agg_view_admits_state\", args: \"p_definition jsonb, p_state jsonb\", returns: \"boolean\", security: \"invoker\" },\n { name: \"anon_capture\", args: \"p_organization_id uuid, p_client_key text, p_table_id uuid, p_payload jsonb, p_device text DEFAULT NULL::text, p_captured_at timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"uuid\", security: \"definer\" },\n { name: \"anon_clear\", args: \"p_organization_id uuid, p_submission_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"anon_inbound_land\", args: \"p_address text, p_secret text, p_payload jsonb, p_raw_payload jsonb DEFAULT '{}'::jsonb, p_client_key text DEFAULT NULL::text\", returns: \"uuid\", security: \"definer\" },\n { name: \"anon_publish\", args: \"p_organization_id uuid, p_form_id uuid, p_published boolean DEFAULT true\", returns: \"timestamp with time zone\", security: \"definer\" },\n { name: \"anon_rate_take\", args: \"p_organization_id uuid, p_form_id uuid, p_bucket text, p_token_id uuid DEFAULT NULL::uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"anon_submissions\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_state text DEFAULT NULL::text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0\", returns: \"TABLE(id uuid, form_id uuid, inbound_id uuid, table_id uuid, source text, state text, payload jsonb, raw_payload jsonb, client_key text, record_id uuid, remote_origin text, rejection_reason text, created_at timestamp with time zone, cleared_at timestamp with time zone)\", security: \"definer\" },\n { name: \"anon_token_issue\", args: \"p_organization_id uuid, p_mode text, p_allowed_origins jsonb, p_form_id uuid DEFAULT NULL::uuid, p_saved_view_id uuid DEFAULT NULL::uuid, p_record_id uuid DEFAULT NULL::uuid, p_expires_at timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"TABLE(token_id uuid, secret text)\", security: \"definer\" },\n { name: \"anon_token_revoke\", args: \"p_organization_id uuid, p_token_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"anon_token_verify\", args: \"p_secret text, p_origin text, p_required_mode text\", returns: \"TABLE(token_id uuid, organization_id uuid, form_id uuid, saved_view_id uuid, record_id uuid, mode text)\", security: \"definer\" },\n { name: \"anon_write\", args: \"p_secret text, p_origin text, p_payload jsonb, p_client_key text DEFAULT NULL::text, p_raw_payload jsonb DEFAULT '{}'::jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"applicable_fields\", args: \"p_organization_id uuid, p_table_id uuid, p_record_type text DEFAULT NULL::text\", returns: \"SETOF custom.record\", security: \"definer\" },\n { name: \"assert_client_may_change\", args: \"p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'editor'::permission_level, p_subject_word text DEFAULT 'record'::text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_client_may_open\", args: \"p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'viewer'::permission_level, p_subject_word text DEFAULT 'record'::text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_client_may_reach\", args: \"p_organization_id uuid, p_door text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_columns_are_defined\", args: \"p_organization_id uuid, p_record_id uuid, p_patch jsonb\", returns: \"void\", security: \"definer\" },\n { name: \"assert_entity_door\", args: \"p_organization_id uuid, p_door text\", returns: \"void\", security: \"definer\" },\n { name: \"assert_entity_is_organization_scoped\", args: \"p_token text, p_label text, p_scoped boolean\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_may_know_table\", args: \"p_organization_id uuid, p_table_id uuid, p_door text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_organization_admin\", args: \"p_organization_id uuid, p_door text, p_what text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_organization_wall\", args: \"p_kind text, p_organization_id uuid, p_row jsonb\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_store_door\", args: \"p_organization_id uuid, p_door text\", returns: \"void\", security: \"invoker\" },\n { name: \"autonumber_backfill\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"booking_cancel\", args: \"p_booking_ref text, p_origin text DEFAULT NULL::text\", returns: \"TABLE(booking_ref text, record_id uuid, slot_key text, state text, message text)\", security: \"definer\" },\n { name: \"booking_confirm\", args: \"p_form_id uuid, p_hold_id uuid, p_origin text, p_payload jsonb, p_bucket text, p_honeypot text DEFAULT NULL::text, p_client_key text DEFAULT NULL::text\", returns: \"TABLE(booking_ref text, record_id uuid, submission_id uuid, slot_key text, slot_at timestamp with time zone, state text, message text)\", security: \"definer\" },\n { name: \"booking_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_availability jsonb DEFAULT '{}'::jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_submission_cap integer DEFAULT NULL::integer, p_quarantine_rule_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid, p_form_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text, p_home_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"booking_hold\", args: \"p_form_id uuid, p_slot_key text, p_origin text, p_bucket text, p_client_key text DEFAULT NULL::text\", returns: \"TABLE(hold_id uuid, slot_key text, expires_at timestamp with time zone, member_user_id uuid, state text, message text)\", security: \"definer\" },\n { name: \"booking_manage\", args: \"p_booking_ref text, p_days integer DEFAULT NULL::integer\", returns: \"TABLE(booking_ref text, form_id uuid, title text, slot_key text, slot_at timestamp with time zone, status text, slots jsonb, availability jsonb, state text, message text)\", security: \"definer\" },\n { name: \"booking_notify\", args: \"p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid, p_event text, p_when text\", returns: \"uuid\", security: \"invoker\" },\n { name: \"booking_public\", args: \"p_form_id uuid, p_days integer DEFAULT NULL::integer\", returns: \"TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, availability jsonb, slots jsonb, state text, message text)\", security: \"definer\" },\n { name: \"booking_reschedule\", args: \"p_booking_ref text, p_slot_key text, p_origin text, p_bucket text DEFAULT NULL::text\", returns: \"TABLE(booking_ref text, record_id uuid, slot_key text, slot_at timestamp with time zone, state text, message text)\", security: \"definer\" },\n { name: \"bookings\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(form_id uuid, table_id uuid, title text, slug text, published_at timestamp with time zone, closed_at timestamp with time zone, slot_minutes integer, timezone text, slot_table_id uuid, booked bigint, cancelled bigint, upcoming bigint, held bigint, next_at timestamp with time zone, state text)\", security: \"definer\" },\n { name: \"bump_epoch\", args: \"p_entity_type text, p_entity_id uuid, p_organization_id uuid DEFAULT NULL::uuid\", returns: \"bigint\", security: \"definer\" },\n { name: \"cache_lookup\", args: \"p_container_type text, p_container_id uuid, p_item_type text, p_item_id uuid\", returns: \"permission_level\", security: \"definer\" },\n { name: \"caller_role\", args: \"\", returns: \"name\", security: \"invoker\" },\n { name: \"capture_open\", args: \"p_organization_id uuid, p_sheet_id uuid\", returns: \"TABLE(sheet_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, state text, may_capture boolean, message text)\", security: \"definer\" },\n { name: \"capture_publish\", args: \"p_organization_id uuid, p_sheet_id uuid, p_open boolean DEFAULT true\", returns: \"timestamp with time zone\", security: \"definer\" },\n { name: \"capture_sheet_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_sheet_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"capture_sheets\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(sheet_id uuid, table_id uuid, title text, slug text, state text, opened_at timestamp with time zone, captures bigint, replays bigint, last_capture_at timestamp with time zone, presentation jsonb)\", security: \"definer\" },\n { name: \"capture_submit\", args: \"p_organization_id uuid, p_sheet_id uuid, p_client_key text, p_payload jsonb, p_files jsonb DEFAULT '[]'::jsonb, p_device text DEFAULT NULL::text, p_captured_at timestamp with time zone DEFAULT NULL::timestamp with time zone, p_location jsonb DEFAULT NULL::jsonb\", returns: \"TABLE(record_id uuid, state text, message text, replay boolean, file_ids uuid[])\", security: \"definer\" },\n { name: \"carry_unchanged_value_stamps\", args: \"p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"carrying_edges_in\", args: \"p_organization_id uuid\", returns: \"TABLE(container_type text, container_id uuid, item_type text, item_id uuid, conveys_max permission_level)\", security: \"definer\" },\n { name: \"carrying_edges_of\", args: \"p_item_type text, p_item_id uuid\", returns: \"TABLE(container_type text, container_id uuid, conveys_max permission_level)\", security: \"definer\" },\n { name: \"checklist_declare\", args: \"p_organization_id uuid, p_spec jsonb, p_template_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"checklist_refusal\", args: \"p_spec jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"checklist_run\", args: \"p_organization_id uuid, p_run_id uuid\", returns: \"TABLE(step_id uuid, step_order integer, ref text, title text, role text, assignee_name text, assignee_user_id uuid, due_on timestamp with time zone, due_state text, status text, finished boolean, requires text, requires_key text, requires_label text, requires_id uuid, evidence jsonb, blocked_by text[], may_complete boolean, refusal text)\", security: \"definer\" },\n { name: \"checklist_runs\", args: \"p_organization_id uuid, p_about_table_id uuid DEFAULT NULL::uuid, p_about_record_id uuid DEFAULT NULL::uuid, p_include_closed boolean DEFAULT true, p_limit integer DEFAULT 100\", returns: \"TABLE(run_id uuid, name text, template_id uuid, template text, about_record_id uuid, about text, about_table_id uuid, started_at timestamp with time zone, started_by uuid, origin text, step_count integer, done integer, overdue integer, next_step text, next_due timestamp with time zone, closed_at timestamp with time zone)\", security: \"definer\" },\n { name: \"checklist_start\", args: \"p_organization_id uuid, p_template_id uuid, p_about_record_id uuid DEFAULT NULL::uuid, p_roles jsonb DEFAULT '{}'::jsonb, p_starting_at timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"jsonb\", security: \"definer\" },\n { name: \"checklist_step_complete\", args: \"p_organization_id uuid, p_step_id uuid, p_evidence jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"checklist_step_refusal\", args: \"p_organization_id uuid, p_step_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"checklist_steps_table\", args: \"p_organization_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"checklist_template_shape\", args: \"p_organization_id uuid, p_template_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"checklist_templates\", args: \"p_organization_id uuid, p_about_table_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 100\", returns: \"TABLE(template_id uuid, name text, about_table_id uuid, about_table text, steps integer, roles integer, trigger_kind text, trigger_status text, open_runs integer, total_runs integer, updated_at timestamp with time zone)\", security: \"definer\" },\n { name: \"choice_census\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"choice_field_map\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_filter_normalize\", args: \"p_map jsonb, p_filter jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_key_for\", args: \"p_organization_id uuid, p_options_table_id uuid, p_title text, p_exclude uuid DEFAULT NULL::uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"choice_key_of\", args: \"p_field jsonb, p_token text\", returns: \"text\", security: \"invoker\" },\n { name: \"choice_options\", args: \"p_organization_id uuid, p_options_table_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_render\", args: \"p_organization_id uuid, p_table_id uuid, p_doc jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_render_groups\", args: \"p_map jsonb, p_groups jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_render_note\", args: \"p_field jsonb, p_value jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_render_value\", args: \"p_field jsonb, p_value jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_slug\", args: \"p_word text\", returns: \"text\", security: \"invoker\" },\n { name: \"choice_synonyms\", args: \"p_organization_id uuid, p_table_id uuid, p_token text\", returns: \"text[]\", security: \"invoker\" },\n { name: \"choice_synonyms_in\", args: \"p_map jsonb, p_token text\", returns: \"text[]\", security: \"invoker\" },\n { name: \"choice_words\", args: \"p_field jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"client_write_grants\", args: \"\", returns: \"TABLE(role_name text, object_name text, privilege text)\", security: \"invoker\" },\n { name: \"comment_mention_deliver\", args: \"p_organization_id uuid, p_record_id uuid, p_table_id uuid, p_comment_id uuid, p_recipient uuid, p_author_name text, p_record_title text, p_body text\", returns: \"uuid\", security: \"definer\" },\n { name: \"comment_thread\", args: \"p_organization_id uuid, p_record_id uuid, p_include_resolved boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"comment_write\", args: \"p_organization_id uuid, p_record_id uuid, p_body text, p_anchor jsonb DEFAULT '{}'::jsonb, p_parent_comment_id uuid DEFAULT NULL::uuid, p_mentions uuid[] DEFAULT NULL::uuid[]\", returns: \"jsonb\", security: \"definer\" },\n { name: \"computed_block\", args: \"p_block jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"computed_provenance\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(field_key text, field_id uuid, value jsonb, rule_id uuid, rule_version integer, computed_at timestamp with time zone)\", security: \"definer\" },\n { name: \"containment_chain\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(ancestor_id uuid, depth integer)\", security: \"invoker\" },\n { name: \"containment_depth_ceiling\", args: \"p_organization_id uuid DEFAULT NULL::uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"containment_edges\", args: \"p_organization_id uuid\", returns: \"TABLE(parent_id uuid, child_id uuid, via text)\", security: \"invoker\" },\n { name: \"containment_parent\", args: \"p_data jsonb\", returns: \"uuid\", security: \"invoker\" },\n { name: \"context_resolve\", args: \"p_organization_id uuid, p_bindings jsonb, p_scope_slug text DEFAULT 'scopes'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"conversation_scope\", args: \"p_organization_id uuid, p_conversation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"conversation_scope_bind\", args: \"p_organization_id uuid, p_conversation_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"conversation_scope_context\", args: \"p_organization_id uuid, p_conversation_id uuid, p_relations integer DEFAULT 12, p_history integer DEFAULT 15, p_siblings integer DEFAULT 8\", returns: \"jsonb\", security: \"definer\" },\n { name: \"conversation_scope_unbind\", args: \"p_organization_id uuid, p_conversation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"cross_organization_links_open\", args: \"p_source_organization_id uuid, p_target_organization_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"custom_fields_tables\", args: \"\", returns: \"TABLE(token text, schema_name text, table_name text)\", security: \"invoker\" },\n { name: \"dashboard_block_normalize\", args: \"p_organization_id uuid, p_subject_table_id uuid, p_block jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"dashboard_class\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"dashboard_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_name text, p_blocks jsonb DEFAULT '[]'::jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_dashboard_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"dashboard_delete\", args: \"p_organization_id uuid, p_dashboard_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"dashboard_field_keys\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text[]\", security: \"definer\" },\n { name: \"dashboard_kinds\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"dashboard_moment_sql\", args: \"p_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"dashboard_run\", args: \"p_organization_id uuid, p_dashboard_id uuid, p_filter jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"dashboard_stuck\", args: \"p_organization_id uuid, p_table_id uuid, p_state_key text, p_days integer DEFAULT 14, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 50, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, title text, state text, last_changed_at timestamp with time zone, days_unchanged numeric, measured_from text)\", security: \"definer\" },\n { name: \"dashboard_window_sql\", args: \"p_key text, p_window jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"dashboards\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(dashboard_id uuid, table_id uuid, name text, blocks jsonb, presentation jsonb, block_count integer, version integer, created_at timestamp with time zone, updated_at timestamp with time zone)\", security: \"definer\" },\n { name: \"decoration_colors\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"decoration_rule_ops\", args: \"\", returns: \"TABLE(op text, takes_value boolean, label text)\", security: \"invoker\" },\n { name: \"delete_cascade_closure\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"uuid[]\", security: \"invoker\" },\n { name: \"delete_preview\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"delete_rule\", args: \"p_organization_id uuid, p_record_id uuid, p_apply boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"dependency_cycle\", args: \"p_organization_id uuid, p_row custom.record\", returns: \"text[]\", security: \"invoker\" },\n { name: \"dependency_label\", args: \"p_organization_id uuid, p_node text\", returns: \"text\", security: \"invoker\" },\n { name: \"derive_visibility\", args: \"p_container_type text, p_container_id uuid\", returns: \"TABLE(item_type text, item_id uuid, depth integer, max_level permission_level)\", security: \"definer\" },\n { name: \"derived_value\", args: \"p_organization_id uuid, p_record_id uuid, p_field_data jsonb, p_values jsonb DEFAULT NULL::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"derived_values\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"derived_values_of\", args: \"v_rec custom.record\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"display_format_ids\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"doc_content_hash\", args: \"p_body text\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_format_value\", args: \"p_field_data jsonb, p_value jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_letterhead\", args: \"p_organization_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"doc_name_token_pattern\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_name_tokens\", args: \"p_body text\", returns: \"TABLE(ordinal integer, raw text)\", security: \"invoker\" },\n { name: \"doc_render_body\", args: \"p_organization_id uuid, p_template_id uuid, p_record_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_render_document\", args: \"p_organization_id uuid, p_template_id uuid, p_record_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_render_read\", args: \"p_organization_id uuid, p_render_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"doc_render_write\", args: \"p_organization_id uuid, p_template_id uuid, p_record_id uuid, p_table_id uuid, p_template_version integer, p_body text, p_content_hash text\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_renders\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(render_id uuid, template_id uuid, record_id uuid, table_id uuid, template_version integer, body text, content_hash text, rendered_at timestamp with time zone)\", security: \"definer\" },\n { name: \"doc_sign\", args: \"p_organization_id uuid, p_render_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_signature_field_ok\", args: \"p_field_data jsonb\", returns: \"boolean\", security: \"invoker\" },\n { name: \"doc_signature_intact\", args: \"p_organization_id uuid, p_signature_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"doc_signature_read\", args: \"p_organization_id uuid, p_signature_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"doc_signature_write\", args: \"p_organization_id uuid, p_render_id uuid, p_record_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid, p_document_hash text, p_document_version integer\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_signatures\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(signature_id uuid, render_id uuid, record_id uuid, field_key text, signer_name text, signer_user_id uuid, signed_at timestamp with time zone, document_hash text, document_version integer)\", security: \"definer\" },\n { name: \"doc_template_delete\", args: \"p_organization_id uuid, p_template_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"doc_template_read\", args: \"p_organization_id uuid, p_template_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"doc_template_save\", args: \"p_organization_id uuid, p_table_id uuid, p_name text, p_body text, p_template_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_templates\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(template_id uuid, renders_table_id uuid, name text, body text, template_version integer, token_count bigint, updated_at timestamp with time zone)\", security: \"definer\" },\n { name: \"doc_token_pattern\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_tokens\", args: \"p_body text\", returns: \"TABLE(ordinal integer, raw text, field_id uuid)\", security: \"invoker\" },\n { name: \"doc_unresolved_tokens\", args: \"p_organization_id uuid, p_table_id uuid, p_body text\", returns: \"TABLE(raw text, field_id uuid, why text)\", security: \"invoker\" },\n { name: \"doors_not_deciding_the_caller\", args: \"\", returns: \"TABLE(function_name text, identity_args text)\", security: \"invoker\" },\n { name: \"doors_not_deciding_the_record\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"doors_not_masking_fields\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"doors_not_on_one_ladder\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"doors_refusing_in_another_doors_name\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"effective_level\", args: \"p_user_id uuid, p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text\", returns: \"permission_level\", security: \"definer\" },\n { name: \"enrich_cells\", args: \"p_organization_id uuid, p_table_id uuid, p_field_keys text[] DEFAULT NULL::text[], p_record_ids uuid[] DEFAULT NULL::uuid[]\", returns: \"TABLE(record_id uuid, field_key text, agent_owned boolean, value jsonb, value_version integer, actor text, on_behalf_of text, written_at timestamp with time zone, source jsonb, absent_reason text, alternates jsonb, pinned boolean, stale boolean, due_at timestamp with time zone)\", security: \"definer\" },\n { name: \"enrich_declare\", args: \"p_organization_id uuid, p_field_id uuid, p_spec jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"enrich_due\", args: \"p_organization_id uuid, p_field_id uuid, p_limit integer DEFAULT 50, p_include_fresh boolean DEFAULT false\", returns: \"TABLE(record_id uuid, title text, inputs jsonb, current_value jsonb, written_at timestamp with time zone, reason text, trimmed_to integer)\", security: \"definer\" },\n { name: \"enrich_land\", args: \"p_organization_id uuid, p_field_id uuid, p_results jsonb, p_run jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"enrich_normalize\", args: \"p_organization_id uuid, p_table_id uuid, p_field_key text, p_spec jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"enrich_pin\", args: \"p_organization_id uuid, p_record_id uuid, p_field_key text, p_pinned boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"enrich_run_class\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"enrich_runs\", args: \"p_organization_id uuid, p_field_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 50\", returns: \"TABLE(run_id uuid, field_id uuid, field_key text, model text, trigger_word text, rows_seen integer, rows_written integer, rows_absent integer, rows_below_floor integer, rows_pinned integer, rows_refused integer, cost_cents numeric, cost_per_row_cents numeric, ran_at timestamp with time zone)\", security: \"definer\" },\n { name: \"enrich_sensitivity_rank\", args: \"p_word text\", returns: \"integer\", security: \"invoker\" },\n { name: \"enrich_triggers\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"enrichments\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(field_id uuid, table_id uuid, field_key text, label text, enrichment jsonb, enabled boolean, review_interval_days integer, rows_total integer, rows_filled integer, rows_stale integer, rows_pinned integer, rows_absent integer, runs integer, cost_cents numeric, cost_per_row_cents numeric, last_run_at timestamp with time zone, last_run jsonb)\", security: \"definer\" },\n { name: \"entity_field_declare\", args: \"p_organization_id uuid, p_token text, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"entity_field_retire\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"entity_field_rights\", args: \"p_organization_id uuid, p_token text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"entity_field_update\", args: \"p_organization_id uuid, p_field_id uuid, p_patch jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"entity_fields\", args: \"p_organization_id uuid, p_token text\", returns: \"SETOF custom.record\", security: \"definer\" },\n { name: \"entity_record_read\", args: \"p_organization_id uuid, p_token text, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"entity_records_find\", args: \"p_organization_id uuid, p_token text, p_key text, p_value jsonb DEFAULT NULL::jsonb, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"entity_table\", args: \"p_token text\", returns: \"TABLE(token text, schema_name text, table_name text, type text, title_column text, label text, has_organization boolean, has_deleted_at boolean)\", security: \"invoker\" },\n { name: \"entity_value_write\", args: \"p_organization_id uuid, p_token text, p_record_id uuid, p_patch jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"export_ceiling\", args: \"p_organization_id uuid DEFAULT NULL::uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"export_records\", args: \"p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000\", returns: \"TABLE(id uuid, document jsonb)\", security: \"invoker\" },\n { name: \"external_foreign_table_findings\", args: \"\", returns: \"SETOF text\", security: \"definer\" },\n { name: \"external_history_event\", args: \"p_organization_id uuid, p_link_id uuid, p_operation text\", returns: \"bigint\", security: \"definer\" },\n { name: \"external_rows\", args: \"p_organization_id uuid, p_source_id uuid\", returns: \"SETOF jsonb\", security: \"definer\" },\n { name: \"external_source_declare\", args: \"p_organization_id uuid, p_tier text, p_connection_token text, p_external_schema text, p_external_table text, p_link_template text\", returns: \"uuid\", security: \"definer\" },\n { name: \"external_stub_upsert\", args: \"p_organization_id uuid, p_source_id uuid, p_table_id uuid, p_external_key text, p_link_url text, p_cached_title text\", returns: \"uuid\", security: \"definer\" },\n { name: \"external_tier_contract\", args: \"\", returns: \"jsonb\", security: \"definer\" },\n { name: \"external_write_through\", args: \"p_organization_id uuid, p_record_id uuid, p_patch jsonb\", returns: \"void\", security: \"definer\" },\n { name: \"external_writes_set\", args: \"p_organization_id uuid, p_source_id uuid, p_enabled boolean\", returns: \"boolean\", security: \"definer\" },\n { name: \"field_behaviour\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"field_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"field_dependants\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"TABLE(kind text, dependant_id uuid, label text, how text)\", security: \"definer\" },\n { name: \"field_history\", args: \"p_organization_id uuid, p_table_id uuid, p_field_key text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0, p_record_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(record_id uuid, record_title text, version integer, occurred_at timestamp with time zone, operation_label text, actor jsonb, before jsonb, after jsonb)\", security: \"definer\" },\n { name: \"field_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"field_kinds\", args: \"\", returns: \"TABLE(kind text, behavior text, parity boolean, made_of text)\", security: \"invoker\" },\n { name: \"field_options\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"SETOF custom.record\", security: \"definer\" },\n { name: \"field_retire\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"field_rules\", args: \"p_field_data jsonb\", returns: \"TABLE(kind text, spec jsonb)\", security: \"invoker\" },\n { name: \"field_update\", args: \"p_organization_id uuid, p_field_id uuid, p_patch jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"field_value_convert\", args: \"p_to jsonb, p_value jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"field_words\", args: \"p_organization_id uuid, p_field_id uuid, p_value jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"file_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"form_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_submission_cap integer DEFAULT NULL::integer, p_quarantine_rule_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid, p_form_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text\", returns: \"uuid\", security: \"definer\" },\n { name: \"form_notify\", args: \"p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid\", returns: \"uuid\", security: \"invoker\" },\n { name: \"form_public\", args: \"p_form_id uuid\", returns: \"TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, state text, message text)\", security: \"definer\" },\n { name: \"form_slug\", args: \"p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"form_submit\", args: \"p_form_id uuid, p_origin text, p_payload jsonb, p_bucket text, p_honeypot text DEFAULT NULL::text, p_client_key text DEFAULT NULL::text\", returns: \"TABLE(submission_id uuid, record_id uuid, state text, message text)\", security: \"definer\" },\n { name: \"forms\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(form_id uuid, table_id uuid, title text, slug text, published_at timestamp with time zone, closed_at timestamp with time zone, submission_cap integer, responses bigint, in_table bigint, held bigint, rejected bigint, state text, quarantine_rule_id uuid, notify_rule_id uuid, presentation jsonb)\", security: \"definer\" },\n { name: \"formula_eval\", args: \"p_organization_id uuid, p_expr jsonb, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"formula_node_kinds\", args: \"\", returns: \"TABLE(node text, min_args integer, max_args integer, result text, signature text, says text)\", security: \"invoker\" },\n { name: \"formula_parse\", args: \"p_organization_id uuid, p_table_id uuid, p_text text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"formula_value\", args: \"p_organization_id uuid, p_record_id uuid, p_field_data jsonb, p_values jsonb DEFAULT NULL::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"freshness_verdict\", args: \"p_written_at timestamp with time zone, p_ceiling_seconds numeric\", returns: \"jsonb\", security: \"definer\" },\n { name: \"grid_layout\", args: \"p_organization_id uuid, p_table_id uuid, p_view_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"grid_layout_check\", args: \"p_layout jsonb, p_scope text DEFAULT 'view'::text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"guard_refusals_are_complete\", args: \"\", returns: \"TABLE(guard text, said text)\", security: \"invoker\" },\n { name: \"has_visibility\", args: \"p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level\", returns: \"boolean\", security: \"definer\" },\n { name: \"has_visibility_at\", args: \"p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, p_organization_id uuid DEFAULT NULL::uuid, p_min_version bigint DEFAULT NULL::bigint\", returns: \"boolean\", security: \"definer\" },\n { name: \"hidden_field_notice\", args: \"p_field custom.record, p_action text DEFAULT 'read'::text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_actor\", args: \"p_tier text, p_document jsonb, p_actor_id uuid, p_people jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_changes\", args: \"p_organization_id uuid, p_table_id uuid, p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_people\", args: \"p_organization_id uuid, p_ids uuid[]\", returns: \"jsonb\", security: \"definer\" },\n { name: \"history_prune\", args: \"p_organization_id uuid, p_scope text DEFAULT 'values'::text, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"history_restore_body\", args: \"p_current jsonb, p_target jsonb, p_field_key text DEFAULT NULL::text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_restore_body\", args: \"p_current jsonb, p_target jsonb, p_field_key text, p_author jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_retention\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"history_retention_floor_raise\", args: \"p_organization_id uuid, p_days integer\", returns: \"integer\", security: \"definer\" },\n { name: \"history_retention_set\", args: \"p_organization_id uuid, p_table_id uuid, p_days integer\", returns: \"integer\", security: \"definer\" },\n { name: \"home_add\", args: \"p_organization_id uuid, p_table_id uuid, p_home_record_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"home_relations\", args: \"\", returns: \"TABLE(table_id uuid, home_record_id uuid, organization_id uuid, relation_id uuid)\", security: \"invoker\" },\n { name: \"hub_changed_by\", args: \"p_organization_id uuid, p_kind text, p_ids uuid[]\", returns: \"TABLE(id uuid, at timestamp with time zone, who text)\", security: \"definer\" },\n { name: \"inbound_addresses\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"inbound_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_label text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"inbound_domain\", args: \"p_organization_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"inbound_mail_land\", args: \"p_address text, p_mail jsonb, p_secret text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"inbound_mail_map\", args: \"p_organization_id uuid, p_table_id uuid, p_mail jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"inbound_set\", args: \"p_organization_id uuid, p_inbound_id uuid, p_enabled boolean\", returns: \"jsonb\", security: \"definer\" },\n { name: \"index_payload\", args: \"p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000\", returns: \"TABLE(id uuid, searchable text)\", security: \"invoker\" },\n { name: \"intern_provenance\", args: \"p_data jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"io_cell\", args: \"p_organization_id uuid, p_field jsonb, p_word text, p_date_order text DEFAULT 'mdy'::text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"io_changed_field_ids\", args: \"p_organization_id uuid, p_table_id uuid, p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"io_changed_keys\", args: \"p_old jsonb, p_new jsonb\", returns: \"text[]\", security: \"invoker\" },\n { name: \"io_comment_resolve\", args: \"p_organization_id uuid, p_comment_id uuid, p_resolved boolean DEFAULT true\", returns: \"boolean\", security: \"definer\" },\n { name: \"io_comment_write\", args: \"p_organization_id uuid, p_record_id uuid, p_body text, p_anchor jsonb DEFAULT '{}'::jsonb, p_parent_comment_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"io_comments\", args: \"p_organization_id uuid, p_record_id uuid, p_include_resolved boolean DEFAULT false\", returns: \"TABLE(id uuid, body text, anchor jsonb, parent_comment_id uuid, created_by uuid, created_at timestamp with time zone, resolved_at timestamp with time zone, resolved_by uuid)\", security: \"definer\" },\n { name: \"io_csv_escape\", args: \"p_value text, p_delimiter text DEFAULT ','::text\", returns: \"text\", security: \"invoker\" },\n { name: \"io_csv_parse\", args: \"p_text text, p_delimiter text DEFAULT NULL::text\", returns: \"TABLE(row_number integer, cells text[])\", security: \"invoker\" },\n { name: \"io_export\", args: \"p_organization_id uuid, p_table_id uuid, p_columns text[] DEFAULT NULL::text[], p_limit integer DEFAULT 10000, p_required text DEFAULT 'viewer'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_export_csv\", args: \"p_organization_id uuid, p_table_id uuid, p_columns text[] DEFAULT NULL::text[], p_limit integer DEFAULT 10000, p_delimiter text DEFAULT chr(44), p_required text DEFAULT 'viewer'::text\", returns: \"text\", security: \"definer\" },\n { name: \"io_import_begin\", args: \"p_organization_id uuid, p_table_id uuid, p_format text DEFAULT 'csv'::text, p_source_name text DEFAULT NULL::text, p_source_columns jsonb DEFAULT '[]'::jsonb, p_file_hash text DEFAULT NULL::text, p_policy jsonb DEFAULT '{}'::jsonb, p_dedupe_key text DEFAULT NULL::text, p_file_bytes bigint DEFAULT NULL::bigint, p_force boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_declare_columns\", args: \"p_organization_id uuid, p_table_id uuid, p_rows jsonb, p_mapping jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_finish\", args: \"p_organization_id uuid, p_import_id uuid, p_unmapped text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_forget\", args: \"p_organization_id uuid, p_import_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"io_import_open\", args: \"p_organization_id uuid, p_table_id uuid, p_format text DEFAULT 'csv'::text, p_source_name text DEFAULT NULL::text, p_source_columns jsonb DEFAULT '[]'::jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"io_import_plan\", args: \"p_organization_id uuid, p_table_id uuid, p_columns jsonb DEFAULT '[]'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_report\", args: \"p_organization_id uuid, p_import_id uuid, p_state text DEFAULT NULL::text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_rows\", args: \"p_organization_id uuid, p_import_id uuid, p_rows jsonb, p_mapping jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_imports\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 25\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_infer_column\", args: \"p_organization_id uuid, p_table_id uuid, p_header text, p_samples jsonb DEFAULT '[]'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_infer_type\", args: \"p_samples jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"io_money_unit\", args: \"p_word text\", returns: \"text\", security: \"invoker\" },\n { name: \"io_outbox_announce\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_outbox_broadcast_stmt\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_outbox_drain\", args: \"p_organization_id uuid, p_consumer text, p_limit integer DEFAULT 100, p_event_key text DEFAULT 'records.changed'::text\", returns: \"TABLE(outbox_id uuid, record_id uuid, table_id uuid, operation text, changed_field_ids jsonb, actor jsonb, occurred_at timestamp with time zone)\", security: \"definer\" },\n { name: \"io_outbox_release\", args: \"p_organization_id uuid, p_consumer text, p_older_than interval DEFAULT '00:15:00'::interval\", returns: \"integer\", security: \"definer\" },\n { name: \"io_proposal_accept\", args: \"p_organization_id uuid, p_import_id uuid, p_column text, p_type text DEFAULT NULL::text, p_label text DEFAULT NULL::text\", returns: \"uuid\", security: \"definer\" },\n { name: \"io_proposal_reject\", args: \"p_organization_id uuid, p_import_id uuid, p_column text\", returns: \"boolean\", security: \"definer\" },\n { name: \"io_proposal_spec\", args: \"p_proposal jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"io_record_changed\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_record_changed_stmt_delete\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_record_changed_stmt_insert\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_record_changed_stmt_update\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_relation_candidate\", args: \"p_organization_id uuid, p_table_id uuid, p_words text[]\", returns: \"uuid\", security: \"invoker\" },\n { name: \"io_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer\", returns: \"integer\", security: \"definer\" },\n { name: \"io_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer, p_author jsonb\", returns: \"integer\", security: \"definer\" },\n { name: \"io_revisions\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(version integer, changed_at timestamp with time zone, changed_by uuid, summary text, operation text, changed_fields jsonb)\", security: \"definer\" },\n { name: \"io_sample_words\", args: \"p_samples jsonb\", returns: \"TABLE(word text)\", security: \"invoker\" },\n { name: \"io_value_shape\", args: \"p_envelope jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"is_a_retirement\", args: \"p_old_deleted timestamp with time zone, p_new_deleted timestamp with time zone, p_old_data jsonb, p_new_data jsonb, p_old_table uuid, p_new_table uuid, p_old_org uuid, p_new_org uuid, p_old_class text, p_new_class text\", returns: \"boolean\", security: \"invoker\" },\n { name: \"ladder_replanners\", args: \"p_roots text[] DEFAULT ARRAY['custom.has_visibility'::text, 'custom.effective_level'::text, 'custom.reaches_directly'::text, 'custom.visible_set'::text]\", returns: \"TABLE(fn text, lang text, why text, remedy text)\", security: \"definer\" },\n { name: \"level_floor\", args: \"\", returns: \"permission_level\", security: \"definer\" },\n { name: \"levels_raised_by_a_less_specific_rung\", args: \"\", returns: \"TABLE(organization_id uuid, organization_name text, member_id uuid, member_email text, record_id uuid, addressed_level permission_level, answered_level permission_level)\", security: \"definer\" },\n { name: \"list_door_disagreements\", args: \"p_pretend text DEFAULT NULL::text, p_only_organization uuid DEFAULT NULL::uuid, p_sample integer DEFAULT 200\", returns: \"TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)\", security: \"invoker\" },\n { name: \"list_door_disagreements\", args: \"p_pretend text, p_only_organization uuid, p_sample integer, p_exhaustive boolean\", returns: \"TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)\", security: \"invoker\" },\n { name: \"list_portals\", args: \"p_organization_id uuid, p_archived text DEFAULT 'active'::text\", returns: \"TABLE(portal_id uuid, title text, slug text, client_table_id uuid, client_table text, is_active boolean, tables integer, invited integer, signed_in integer, sign_in_method text, opened_at timestamp with time zone)\", security: \"definer\" },\n { name: \"lookup_value\", args: \"p_organization_id uuid, p_record_id uuid, p_field_data jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"mask_document\", args: \"p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"mask_document\", args: \"p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb, p_declared_keys text[] DEFAULT NULL::text[]\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"mask_says_withheld\", args: \"p_mask jsonb, p_key text\", returns: \"boolean\", security: \"invoker\" },\n { name: \"may_invite_outside\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"merge_field_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"migrate_choice_keys\", args: \"p_organization_id uuid, p_table_id uuid, p_dry_run boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_delete\", args: \"p_organization_id uuid, p_record_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_demote\", args: \"p_organization_id uuid, p_table_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_extract_parent\", args: \"p_organization_id uuid, p_id uuid, p_parent_table_id uuid, p_moved_keys text[], p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_merge\", args: \"p_organization_id uuid, p_winner_id uuid, p_loser_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_promote\", args: \"p_organization_id uuid, p_table_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_purge\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_purge_hard\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_compliance_reason text DEFAULT NULL::text, p_chunk integer DEFAULT 200, p_dry_run boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_purge_hard_request\", args: \"p_organization_id uuid, p_table_id uuid, p_compliance_reason text\", returns: \"void\", security: \"definer\" },\n { name: \"migrate_reclass\", args: \"p_organization_id uuid, p_id uuid, p_to text DEFAULT 'field'::text, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_rename\", args: \"p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_reparent\", args: \"p_organization_id uuid, p_id uuid, p_parent_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_retype\", args: \"p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_split\", args: \"p_organization_id uuid, p_record_id uuid, p_moved_keys text[], p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_undo\", args: \"p_organization_id uuid, p_log_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrations\", args: \"p_organization_id uuid, p_target_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 100\", returns: \"TABLE(id uuid, verb text, target_kind text, target_id uuid, note text, applied_at timestamp with time zone, applied_by uuid, undone_at timestamp with time zone)\", security: \"definer\" },\n { name: \"mirror_asks_the_whole_database\", args: \"\", returns: \"TABLE(schema_name text, table_name text, policy_name text, why text)\", security: \"invoker\" },\n { name: \"my_level\", args: \"p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text\", returns: \"permission_level\", security: \"definer\" },\n { name: \"my_levels\", args: \"p_organization_id uuid, p_ids jsonb, p_type text DEFAULT 'record'::text\", returns: \"TABLE(id uuid, level permission_level)\", security: \"definer\" },\n { name: \"organization_clear\", args: \"p_organization_id uuid, p_confirm text, p_and_destroy boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"organization_contents\", args: \"p_organization_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"organization_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"organization_references\", args: \"p_kind text, p_organization_id uuid, p_row jsonb\", returns: \"TABLE(site text, what text, ref_id uuid, openable boolean)\", security: \"invoker\" },\n { name: \"owning_table\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"uuid\", security: \"invoker\" },\n { name: \"owning_table_gone\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"page_ceiling\", args: \"p_organization_id uuid DEFAULT NULL::uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"page_contract\", args: \"p_organization_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"page_size\", args: \"p_organization_id uuid, p_door text, p_limit integer, p_default integer DEFAULT NULL::integer, p_ceiling integer DEFAULT NULL::integer\", returns: \"integer\", security: \"invoker\" },\n { name: \"parity_field_types\", args: \"\", returns: \"TABLE(parity_type text, behavior text, made_of text)\", security: \"invoker\" },\n { name: \"parity_type\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"parity_values\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(field_key text, field_id uuid, parity_type text, behavior text, unit text, format text, value jsonb, value_version integer, actor text, written_at timestamp with time zone)\", security: \"invoker\" },\n { name: \"per_value_access_words\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"person_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"phone_canonical\", args: \"p_text text\", returns: \"text\", security: \"invoker\" },\n { name: \"phone_display\", args: \"p_text text\", returns: \"text\", security: \"invoker\" },\n { name: \"phone_pattern\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"pin_agent_cells\", args: \"p_new jsonb, p_old jsonb, p_agent_keys text[]\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"pipeline_board\", args: \"p_organization_id uuid, p_table_id uuid, p_measure text DEFAULT NULL::text\", returns: \"TABLE(stage_key text, stage_label text, stage_position integer, cards bigint, total numeric, wip_limit integer, over_limit boolean)\", security: \"definer\" },\n { name: \"pipeline_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_spec jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_gate_preview\", args: \"p_organization_id uuid, p_table_id uuid, p_stage text, p_gate jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_move\", args: \"p_organization_id uuid, p_record_id uuid, p_to text, p_also jsonb DEFAULT '{}'::jsonb, p_expected_version integer DEFAULT NULL::integer\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_pending\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_read\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_transition_refusal\", args: \"p_organization_id uuid, p_record_id uuid, p_to text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipelines\", args: \"p_organization_id uuid\", returns: \"TABLE(table_id uuid, table_name text, stage_field text, stage_label text, stages integer, rules integer, broken text, updated_at timestamp with time zone, updated_by uuid)\", security: \"definer\" },\n { name: \"portal_admits\", args: \"p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"portal_archive\", args: \"p_organization_id uuid, p_portal_id uuid, p_confirm_title text, p_reason text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_card\", args: \"p_organization_id uuid, p_portal_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_declare\", args: \"p_organization_id uuid, p_title text, p_client_table_id uuid, p_tables jsonb, p_portal_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text, p_sign_in_method text DEFAULT 'magic_link'::text\", returns: \"uuid\", security: \"definer\" },\n { name: \"portal_field_map\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(field_id uuid, field_key text, field_type text, points_at uuid)\", security: \"definer\" },\n { name: \"portal_invitation\", args: \"p_slug text, p_email text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_invite\", args: \"p_organization_id uuid, p_portal_id uuid, p_client_record_id uuid, p_email text, p_user_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_invite_accept\", args: \"p_token text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_me\", args: \"\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_preview\", args: \"p_organization_id uuid, p_portal_id uuid, p_principal_id uuid, p_table_id uuid\", returns: \"TABLE(record_id uuid, title text)\", security: \"definer\" },\n { name: \"portal_principal_bind\", args: \"p_organization_id uuid, p_principal_id uuid, p_user_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_public\", args: \"p_slug text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_record_title\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"portal_restore\", args: \"p_organization_id uuid, p_portal_id uuid, p_confirm_title text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_revoke\", args: \"p_organization_id uuid, p_portal_id uuid, p_principal_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_slug\", args: \"p_organization_id uuid, p_title text, p_portal_id uuid DEFAULT NULL::uuid\", returns: \"text\", security: \"definer\" },\n { name: \"portal_tables\", args: \"p_organization_id uuid\", returns: \"TABLE(portal_id uuid, table_id uuid, name text)\", security: \"definer\" },\n { name: \"portals\", args: \"p_organization_id uuid\", returns: \"TABLE(portal_id uuid, title text, slug text, client_table_id uuid, client_table text, is_active boolean, tables integer, invited integer, signed_in integer, sign_in_method text, opened_at timestamp with time zone)\", security: \"definer\" },\n { name: \"presentation_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"promote_field\", args: \"p_organization_id uuid, p_table_id uuid, p_field_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"promote_table\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"promoted_field_cap\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"promoted_fields\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(field_id uuid, field_key text, parity_type text, is_unique boolean, value_path text, index_arm text, index_expr text, index_name text, indexable boolean, why_not text)\", security: \"invoker\" },\n { name: \"promoted_index_arm\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"promoted_index_ddl\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(step integer, purpose text, statement text)\", security: \"invoker\" },\n { name: \"promoted_index_expr\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"promoted_index_name\", args: \"p_table_id uuid, p_field_key text, p_unique boolean\", returns: \"text\", security: \"invoker\" },\n { name: \"promoted_query_sql\", args: \"p_organization_id uuid, p_table_id uuid, p_field_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"promoted_read\", args: \"p_organization_id uuid, p_table_id uuid, p_field_key text, p_value text\", returns: \"SETOF uuid\", security: \"invoker\" },\n { name: \"promoted_value_path\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"promotion_inline_ceiling\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"provenance_prune\", args: \"p_organization_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true, p_limit integer DEFAULT 200000\", returns: \"jsonb\", security: \"definer\" },\n { name: \"provenance_retention_days\", args: \"p_organization_id uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"provenance_write\", args: \"p_organization_id uuid, p_conversation_id uuid, p_turn_id text, p_rows jsonb\", returns: \"integer\", security: \"definer\" },\n { name: \"query_access_ids\", args: \"p_organization_id uuid, p_required text DEFAULT 'viewer'::text\", returns: \"uuid[]\", security: \"invoker\" },\n { name: \"query_across_homes\", args: \"p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, home_record_id uuid, data jsonb, created_at timestamp with time zone)\", security: \"definer\" },\n { name: \"query_by_coordinates\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_coordinates jsonb DEFAULT '[]'::jsonb, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, table_id uuid, data jsonb, coordinates_matched integer)\", security: \"definer\" },\n { name: \"query_can_see\", args: \"p_organization_id uuid, p_record_id uuid, p_required text DEFAULT 'viewer'::text\", returns: \"boolean\", security: \"definer\" },\n { name: \"query_hot_paths\", args: \"\", returns: \"TABLE(name text, statement text)\", security: \"invoker\" },\n { name: \"query_hot_paths_prepared\", args: \"\", returns: \"TABLE(name text, prepared boolean, generic_plans bigint)\", security: \"invoker\" },\n { name: \"query_is_store_owner\", args: \"\", returns: \"boolean\", security: \"invoker\" },\n { name: \"query_prepare_hot\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"query_principal\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"query_record_as_of\", args: \"p_organization_id uuid, p_record_id uuid, p_recorded_at timestamp with time zone DEFAULT NULL::timestamp with time zone, p_world_on date DEFAULT NULL::date, p_required text DEFAULT 'viewer'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"query_relation_edges\", args: \"p_organization_id uuid, p_flavor text DEFAULT NULL::text, p_role text DEFAULT NULL::text\", returns: \"TABLE(parent_id uuid, child_id uuid, role text, flavor text)\", security: \"definer\" },\n { name: \"query_rollup\", args: \"p_organization_id uuid, p_roots uuid[], p_flavor text DEFAULT NULL::text, p_role text DEFAULT NULL::text, p_max_depth integer DEFAULT 33, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, depth integer)\", security: \"definer\" },\n { name: \"query_rollup_sum\", args: \"p_organization_id uuid, p_roots uuid[], p_field_key text, p_flavor text DEFAULT NULL::text, p_role text DEFAULT NULL::text, p_max_depth integer DEFAULT 33, p_required text DEFAULT 'viewer'::text\", returns: \"numeric\", security: \"definer\" },\n { name: \"query_table_as_of\", args: \"p_organization_id uuid, p_table_id uuid, p_recorded_at timestamp with time zone DEFAULT NULL::timestamp with time zone, p_world_on date DEFAULT NULL::date, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, data jsonb)\", security: \"definer\" },\n { name: \"query_table_homes\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"SETOF uuid\", security: \"definer\" },\n { name: \"query_visibility_parity\", args: \"p_organization_id uuid\", returns: \"TABLE(side text, container_type text, container_id uuid, item_type text, item_id uuid, stored_level permission_level, derived_level permission_level, reason text)\", security: \"definer\" },\n { name: \"query_visible_ids\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_required text DEFAULT 'viewer'::text\", returns: \"SETOF uuid\", security: \"definer\" },\n { name: \"reachable_from\", args: \"p_organization_id uuid, p_roots uuid[]\", returns: \"TABLE(record_id uuid, depth integer, via text)\", security: \"invoker\" },\n { name: \"reaches_directly\", args: \"p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level\", returns: \"boolean\", security: \"definer\" },\n { name: \"read_door_carried_ids\", args: \"p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level, OUT o_ids uuid[], OUT o_containers integer\", returns: \"record\", security: \"definer\" },\n { name: \"read_door_granted_ids\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"uuid[]\", security: \"definer\" },\n { name: \"read_door_ladder_ceiling\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"read_door_parity\", args: \"p_organization_id uuid, p_table_id uuid, p_user uuid, p_required permission_level, p_sample integer\", returns: \"TABLE(record_id uuid, set_based boolean, per_row boolean, verdict text)\", security: \"definer\" },\n { name: \"read_mask\", args: \"p_organization_id uuid, p_record_id uuid, p_action text DEFAULT 'read'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"read_paths_outside_the_door\", args: \"\", returns: \"TABLE(object_name text, why text)\", security: \"invoker\" },\n { name: \"read_record\", args: \"p_organization_id uuid, p_record_id uuid, p_by_id boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"read_records\", args: \"p_organization_id uuid, p_table_id uuid, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0\", returns: \"TABLE(id uuid, document jsonb, level permission_level)\", security: \"definer\" },\n { name: \"read_records_archived\", args: \"p_organization_id uuid, p_table_id uuid, p_lane text DEFAULT 'org'::text, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0\", returns: \"TABLE(id uuid, document jsonb, level permission_level, archived_at timestamp with time zone, archived_by uuid, archived_by_name text)\", security: \"definer\" },\n { name: \"read_records_by_ids\", args: \"p_organization_id uuid, p_table_id uuid, p_record_ids uuid[], p_by_id boolean DEFAULT false\", returns: \"TABLE(id uuid, document jsonb, level permission_level)\", security: \"definer\" },\n { name: \"read_records_matching\", args: \"p_organization_id uuid, p_table_id uuid, p_filter jsonb DEFAULT '{}'::jsonb, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0\", returns: \"TABLE(id uuid, document jsonb, level permission_level)\", security: \"definer\" },\n { name: \"realtime_topic_admits\", args: \"p_topic text\", returns: \"boolean\", security: \"definer\" },\n { name: \"record_aggregate\", args: \"p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 200, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(groups jsonb, measures jsonb, row_count bigint)\", security: \"definer\" },\n { name: \"record_applicability\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(rule_id uuid, rule_name text, rule_version integer, applies boolean, answer jsonb)\", security: \"invoker\" },\n { name: \"record_archiver\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"record_as_of\", args: \"p_organization_id uuid, p_record_id uuid, p_at timestamp with time zone\", returns: \"TABLE(state jsonb, replayed boolean)\", security: \"definer\" },\n { name: \"record_card\", args: \"p_viewer uuid, p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_carrying_edges\", args: \"p_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone\", returns: \"TABLE(container_id uuid, item_id uuid, edge_role text)\", security: \"invoker\" },\n { name: \"record_delete\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"timestamp with time zone\", security: \"definer\" },\n { name: \"record_filter_sql\", args: \"p_filter jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"record_history\", args: \"p_organization_id uuid, p_record_id uuid, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0\", returns: \"TABLE(version integer, occurred_at timestamp with time zone, operation text, operation_label text, actor jsonb, changes jsonb, migration_id uuid, undoable boolean)\", security: \"definer\" },\n { name: \"record_platform_keys\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"record_relation_edges\", args: \"p_organization_id uuid, p_id uuid, p_table_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone\", returns: \"TABLE(target_id uuid, edge_role text, field_id uuid, ord integer)\", security: \"invoker\" },\n { name: \"record_reparent\", args: \"p_organization_id uuid, p_record_id uuid, p_parent_id uuid\", returns: \"void\", security: \"definer\" },\n { name: \"record_resolve\", args: \"p_organization_id uuid, p_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_restore\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"void\", security: \"definer\" },\n { name: \"record_restore_preview\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer, p_field_key text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_restore_version\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_restore_version\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer, p_author jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_scope_context\", args: \"p_organization_id uuid, p_record_id uuid, p_relations integer DEFAULT 12, p_history integer DEFAULT 15, p_siblings integer DEFAULT 8\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_stage_pending\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_state_as_of\", args: \"p_record_id uuid, p_at timestamp with time zone\", returns: \"TABLE(state jsonb, replayed boolean)\", security: \"definer\" },\n { name: \"record_table\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"record_update\", args: \"p_organization_id uuid, p_record_id uuid, p_patch jsonb, p_expected_version integer DEFAULT NULL::integer\", returns: \"integer\", security: \"definer\" },\n { name: \"record_values\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"record_values_of\", args: \"p_row custom.record\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"record_values_versioned\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)\", security: \"definer\" },\n { name: \"record_words\", args: \"p_organization_id uuid, p_record_id uuid, p_noun text DEFAULT NULL::text\", returns: \"text\", security: \"definer\" },\n { name: \"record_write\", args: \"p_organization_id uuid, p_table_id uuid, p_data jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"record_write_graph\", args: \"p_organization_id uuid, p_table_id uuid, p_parent jsonb, p_edges jsonb DEFAULT '[]'::jsonb, p_children jsonb DEFAULT '[]'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_write_many\", args: \"p_organization_id uuid, p_table_id uuid, p_rows jsonb[], p_ids uuid[] DEFAULT NULL::uuid[]\", returns: \"uuid[]\", security: \"definer\" },\n { name: \"refusals_claiming_a_level_never_asked\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"relation_carry\", args: \"p_organization_id uuid, p_container_id uuid, p_item_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"relation_edges_withdraw\", args: \"p_organization_id uuid, p_field_ids uuid[], p_why text\", returns: \"integer\", security: \"definer\" },\n { name: \"relation_halves_disagreements\", args: \"p_organization_id uuid DEFAULT NULL::uuid, p_record_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(organization_id uuid, record_id uuid, field_key text, field_id uuid, target_id uuid, direction text, remedy text, why text)\", security: \"definer\" },\n { name: \"relation_halves_repair\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"relation_kernel_record\", args: \"p_organization_id uuid, p_kernel_table_id uuid, p_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"relation_own\", args: \"p_organization_id uuid, p_owner_id uuid, p_target_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"relation_target_card\", args: \"p_organization_id uuid, p_record_id uuid, p_via_key text DEFAULT NULL::text\", returns: \"TABLE(target_id uuid, target_organization_id uuid, is_foreign boolean, masked boolean, reader_level permission_level, card jsonb, why text)\", security: \"definer\" },\n { name: \"relation_target_external\", args: \"p_connection_token text, p_external_table text, p_external_key text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"relation_target_ours\", args: \"p_entity_token text, p_row_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"relation_targets\", args: \"p_organization_id uuid, p_record_id uuid, p_via_key text\", returns: \"SETOF uuid\", security: \"definer\" },\n { name: \"relation_uncarry\", args: \"p_organization_id uuid, p_container_id uuid, p_item_id uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"relation_value_target_ok\", args: \"p_organization_id uuid, p_field_id uuid, p_field_data jsonb, p_target_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"relation_words\", args: \"p_organization_id uuid, p_field_id uuid, p_value text\", returns: \"text\", security: \"definer\" },\n { name: \"relation_words_many\", args: \"p_organization_id uuid, p_field_id uuid, p_record_ids uuid[]\", returns: \"TABLE(record_id uuid, words text)\", security: \"definer\" },\n { name: \"reopen_declared_doors\", args: \"\", returns: \"TABLE(reopened text)\", security: \"definer\" },\n { name: \"required_epoch\", args: \"p_container_type text, p_container_id uuid, p_item_type text, p_item_id uuid\", returns: \"bigint\", security: \"definer\" },\n { name: \"resolve_first_match\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"resolve_id\", args: \"p_organization_id uuid, p_id uuid\", returns: \"uuid\", security: \"invoker\" },\n { name: \"retired_actor_words\", args: \"\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rollup_value\", args: \"p_organization_id uuid, p_record_id uuid, p_field_data jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"row_actions\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"rule_applies\", args: \"p_organization_id uuid, p_rule_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_context\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_declare\", args: \"p_organization_id uuid, p_spec jsonb, p_rule_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"rule_dependency_edges\", args: \"p_organization_id uuid, p_row custom.record DEFAULT NULL::custom.record\", returns: \"TABLE(needs text, needed text)\", security: \"invoker\" },\n { name: \"rule_eval\", args: \"p_organization_id uuid, p_expr jsonb, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_field_key\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"rule_field_label\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"rule_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"rule_members\", args: \"p_organization_id uuid, p_rule_id uuid\", returns: \"SETOF custom.record\", security: \"invoker\" },\n { name: \"rule_membership\", args: \"p_organization_id uuid, p_rule_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_node_kinds\", args: \"\", returns: \"TABLE(node text, evaluated_by text, note text)\", security: \"invoker\" },\n { name: \"rule_run\", args: \"p_organization_id uuid, p_rule_id uuid, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_truth\", args: \"p_answer jsonb\", returns: \"boolean\", security: \"invoker\" },\n { name: \"rule_uses\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"rule_version\", args: \"p_organization_id uuid, p_rule_id uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"said\", args: \"p_value text, p_when_there_is_none text\", returns: \"text\", security: \"invoker\" },\n { name: \"share_access\", args: \"p_organization_id uuid, p_subject_id uuid\", returns: \"TABLE(principal_kind text, principal_id uuid, principal_label text, level permission_level, reason text, reason_detail text, via_type text, via_id uuid, revocable boolean)\", security: \"definer\" },\n { name: \"share_grant\", args: \"p_organization_id uuid, p_subject_id uuid, p_principal_kind text, p_principal_id uuid, p_level permission_level DEFAULT 'viewer'::permission_level\", returns: \"jsonb\", security: \"definer\" },\n { name: \"share_lane_set\", args: \"p_organization_id uuid, p_subject_id uuid, p_choice text, p_level permission_level DEFAULT NULL::permission_level\", returns: \"jsonb\", security: \"definer\" },\n { name: \"share_lanes\", args: \"\", returns: \"TABLE(choice text, lane text, discoverable boolean, label text, means text)\", security: \"definer\" },\n { name: \"share_levels\", args: \"\", returns: \"TABLE(level permission_level, ordinal integer, label text, means text)\", security: \"definer\" },\n { name: \"share_people\", args: \"p_organization_id uuid, p_subject_id uuid DEFAULT NULL::uuid, p_query text DEFAULT NULL::text, p_limit integer DEFAULT 25\", returns: \"TABLE(user_id uuid, email text, display_name text, membership text, already_at permission_level, already_why text)\", security: \"definer\" },\n { name: \"share_revoke\", args: \"p_organization_id uuid, p_subject_id uuid, p_principal_kind text, p_principal_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"share_subject_name\", args: \"p_organization_id uuid, p_type text, p_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"shared_only_disagreements\", args: \"p_pretend text DEFAULT NULL::text\", returns: \"TABLE(organization_id uuid, organization_name text, member_id uuid, record_id uuid, table_id uuid, ladder boolean, read_door boolean, rls_mirror boolean, why text)\", security: \"invoker\" },\n { name: \"shares_outside\", args: \"p_organization_id uuid\", returns: \"TABLE(invitation_id uuid, table_id uuid, table_name text, email text, level text, level_label text, status text, joined boolean, expired boolean, invited_at timestamp with time zone, expires_at timestamp with time zone, say text)\", security: \"definer\" },\n { name: \"sign_request_cancel\", args: \"p_organization_id uuid, p_request_id uuid, p_reason text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_create\", args: \"p_organization_id uuid, p_render_id uuid, p_field_key text, p_signer_email text, p_signer_name text, p_expires_in interval DEFAULT '14 days'::interval\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_decline\", args: \"p_token text, p_reason text DEFAULT NULL::text, p_ip text DEFAULT NULL::text, p_user_agent text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_public\", args: \"p_token text, p_origin text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_remind\", args: \"p_organization_id uuid, p_request_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_sentence\", args: \"p_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"sign_request_sign\", args: \"p_token text, p_signed_name text, p_mark text, p_image text DEFAULT NULL::text, p_ip text DEFAULT NULL::text, p_user_agent text DEFAULT NULL::text, p_origin text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_state\", args: \"p_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"sign_request_unchanged\", args: \"p_organization_id uuid, p_request_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"sign_requests\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(request_id uuid, render_id uuid, record_id uuid, field_key text, document_title text, signer_name text, signer_email text, signer_has_account boolean, state text, sentence text, document_version integer, document_hash text, sent_at timestamp with time zone, expires_at timestamp with time zone, viewed_at timestamp with time zone, signed_at timestamp with time zone, declined_at timestamp with time zone, invalidated_at timestamp with time zone, signature_id uuid, signature_mark text, reminder_count integer)\", security: \"definer\" },\n { name: \"sign_token_decode\", args: \"p_token text\", returns: \"bytea\", security: \"invoker\" },\n { name: \"sign_token_encode\", args: \"p_bytes bytea\", returns: \"text\", security: \"invoker\" },\n { name: \"silent_page_doors\", args: \"\", returns: \"TABLE(door text, why text)\", security: \"definer\" },\n { name: \"size_refusal\", args: \"p_organization_id uuid, p_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"source_next_pointer\", args: \"p_sources jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"source_pointer\", args: \"p_sources jsonb, p_source jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"stage_rule_enforcement\", args: \"p_organization_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"stage_rule_on_fail_kinds\", args: \"\", returns: \"TABLE(behaviour text, note text)\", security: \"invoker\" },\n { name: \"stamp_value_envelopes\", args: \"p_data jsonb, p_actor text, p_on_behalf_of text, p_at timestamp with time zone\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"storage_modes\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"store_is_open\", args: \"p_organization_id uuid DEFAULT NULL::uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"store_off_sentence\", args: \"p_organization_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"subscription_cadences\", args: \"p_organization_id uuid\", returns: \"text[]\", security: \"definer\" },\n { name: \"subscription_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"subscription_mute\", args: \"p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true\", returns: \"boolean\", security: \"definer\" },\n { name: \"subscription_preview\", args: \"p_organization_id uuid, p_rule_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"subscriptions\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(rule_id uuid, name text, table_id uuid, saved_view_id uuid, cadence text, schedule text, quiet_hours jsonb, channel text, recipient_user_id uuid, event_key text, muted boolean, mine boolean, i_may_mute boolean, last_sent_at timestamp with time zone, next_digest_at timestamp with time zone)\", security: \"definer\" },\n { name: \"table_archive\", args: \"p_organization_id uuid, p_table_id uuid, p_chunk integer DEFAULT 50, p_include_table boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_capacity\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_carries_its_rows\", args: \"p_user_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level\", returns: \"boolean\", security: \"definer\" },\n { name: \"table_column_source\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"table_contents\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(record_id uuid, kind text, goes_at integer)\", security: \"invoker\" },\n { name: \"table_declare\", args: \"p_organization_id uuid, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"table_decorate\", args: \"p_organization_id uuid, p_table_id uuid, p_path text[], p_value jsonb DEFAULT NULL::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_decorations\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_from_example\", args: \"p_organization_id uuid, p_home_id uuid, p_example jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_has_a_visible_record\", args: \"p_user uuid, p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"table_is_live\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"table_is_options_table\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"table_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"table_record_ceiling\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"table_record_ceiling\", args: \"p_organization_id uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"table_rules\", args: \"p_organization_id uuid, p_table_id uuid, p_use text, p_record_type text DEFAULT NULL::text\", returns: \"SETOF custom.record\", security: \"invoker\" },\n { name: \"table_share_outside\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_share_outside_accept\", args: \"p_token text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_share_outside_for_me\", args: \"\", returns: \"TABLE(invitation_id uuid, organization_id uuid, organization text, table_id uuid, table_name text, level text, level_label text, token text, expires_at timestamp with time zone, say text)\", security: \"definer\" },\n { name: \"table_share_outside_invite\", args: \"p_organization_id uuid, p_table_id uuid, p_email text, p_level permission_level DEFAULT 'viewer'::permission_level\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_share_outside_resend\", args: \"p_organization_id uuid, p_invitation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_share_outside_revoke\", args: \"p_organization_id uuid, p_invitation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_stage_field\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"table_storage\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"table_type_field\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"table_unique_rule_fields\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"table_webhook_archive\", args: \"p_organization_id uuid, p_webhook_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"table_webhook_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_target_url text, p_events text[] DEFAULT NULL::text[], p_description text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_webhooks\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(webhook_id uuid, target_url text, description text, events text[], is_active boolean, last_attempt_at timestamp with time zone, last_success_at timestamp with time zone, consecutive_failures integer, owner_id uuid, created_at timestamp with time zone)\", security: \"definer\" },\n { name: \"table_work_kind\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"tables_at_home\", args: \"p_organization_id uuid, p_home_ids uuid[]\", returns: \"TABLE(table_id uuid, home_record_id uuid, kind text)\", security: \"definer\" },\n { name: \"tables_described_without_asking\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"tables_shared_with_me\", args: \"\", returns: \"TABLE(table_id uuid, organization_id uuid, organization text, table_name text, level text, level_label text, shared_at timestamp with time zone, opens boolean, say text)\", security: \"definer\" },\n { name: \"trg_associations_bump_visibility\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"undeclared_keys\", args: \"p_organization_id uuid, p_table_id uuid, p_data jsonb\", returns: \"text[]\", security: \"invoker\" },\n { name: \"validate_custom_fields\", args: \"p_token text, p_organization_id uuid, p_values jsonb\", returns: \"void\", security: \"invoker\" },\n { name: \"validate_value_envelope\", args: \"p_organization_id uuid, p_fields custom.record[], p_data jsonb\", returns: \"void\", security: \"invoker\" },\n { name: \"validate_values\", args: \"p_organization_id uuid, p_fields custom.record[], p_values jsonb, p_record_type text DEFAULT NULL::text\", returns: \"void\", security: \"invoker\" },\n { name: \"value_alternate_keys\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"value_envelope_keys\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"value_envelope_ok\", args: \"p_data jsonb\", returns: \"boolean\", security: \"invoker\" },\n { name: \"value_envelope_refusal\", args: \"p_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"value_read\", args: \"p_organization_id uuid, p_record_id uuid, p_key text\", returns: \"TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)\", security: \"definer\" },\n { name: \"value_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_field_key text, p_version integer\", returns: \"jsonb\", security: \"definer\" },\n { name: \"value_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_field_key text, p_version integer, p_author jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"value_versions\", args: \"p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"view_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"views\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(view_id uuid, name text, table_id uuid, filters jsonb, definition jsonb, created_at timestamp with time zone)\", security: \"definer\" },\n { name: \"visibility_ancestors\", args: \"p_item_type text, p_item_id uuid\", returns: \"TABLE(container_type text, container_id uuid, depth integer, max_level permission_level)\", security: \"definer\" },\n { name: \"visibility_as_of\", args: \"p_organization_id uuid, p_record_id uuid, p_at timestamp with time zone\", returns: \"TABLE(principal_kind text, principal_id uuid, level permission_level, through_kind text, through_id uuid, reason text, replayed boolean, held_from timestamp with time zone, held_to timestamp with time zone)\", security: \"definer\" },\n { name: \"visibility_cache_rebuild\", args: \"\", returns: \"integer\", security: \"definer\" },\n { name: \"visibility_parity\", args: \"\", returns: \"TABLE(side text, container_type text, container_id uuid, item_type text, item_id uuid, stored_level permission_level, derived_level permission_level, reason text)\", security: \"definer\" },\n { name: \"visibility_warm\", args: \"p_container_type text, p_container_id uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"visible_predicate_sql\", args: \"p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, p_alias text DEFAULT 'r'::text\", returns: \"text\", security: \"definer\" },\n { name: \"visible_record_ids\", args: \"p_user_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level\", returns: \"TABLE(id uuid)\", security: \"definer\" },\n { name: \"visible_set\", args: \"p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, OUT o_all_visible boolean, OUT o_true_visibility platform.visibility[], OUT o_granted_all uuid[], OUT o_granted_visible uuid[], OUT o_carried_visible uuid[], OUT o_ladder_calls integer, OUT o_fallback boolean, OUT o_note text\", returns: \"record\", security: \"definer\" },\n { name: \"widget_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"withheld_marker\", args: \"p_mask jsonb, p_key text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"withheld_sentence\", args: \"p_mask jsonb, p_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"work_approval_approvers\", args: \"p_organization_id uuid, p_subject_id uuid, p_approver_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(user_id uuid, name text, why text)\", security: \"definer\" },\n { name: \"work_approval_decide\", args: \"p_organization_id uuid, p_approval_id uuid, p_approve boolean, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_approval_kinds\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"work_approval_may_decide\", args: \"p_organization_id uuid, p_approval_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"work_approval_read\", args: \"p_organization_id uuid, p_approval_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_approval_request\", args: \"p_organization_id uuid, p_subject_id uuid, p_change jsonb, p_note text DEFAULT NULL::text, p_approver_id uuid DEFAULT NULL::uuid, p_origin text DEFAULT 'person'::text, p_conversation_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_assign\", args: \"p_organization_id uuid, p_record_id uuid, p_assignee_user_id uuid, p_due_date timestamp with time zone DEFAULT NULL::timestamp with time zone, p_clear_due boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_assignment_fields\", args: \"p_options_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(key text, label text, spec jsonb)\", security: \"invoker\" },\n { name: \"work_has_assignment\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"work_inbox\", args: \"p_organization_id uuid, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_include_decided boolean DEFAULT false\", returns: \"TABLE(item_id uuid, kind text, origin text, title text, subject_id uuid, subject_kind text, summary text, state text, due_on timestamp with time zone, due_state text, actionable boolean, requested_by uuid, requested_by_name text, at timestamp with time zone)\", security: \"definer\" },\n { name: \"work_instantiation_shape\", args: \"p_organization_id uuid, p_instantiation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_list\", args: \"p_organization_id uuid, p_flavour text DEFAULT 'mine'::text, p_include_finished boolean DEFAULT false, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0\", returns: \"TABLE(record_id uuid, table_id uuid, table_name text, title text, assignee_id uuid, assignee_name text, assignee_user_id uuid, due_on timestamp with time zone, due_state text, status text, terminal boolean, assigned_by uuid, updated_at timestamp with time zone)\", security: \"definer\" },\n { name: \"work_person\", args: \"p_organization_id uuid, p_user_id uuid, p_create boolean DEFAULT true\", returns: \"uuid\", security: \"definer\" },\n { name: \"work_record_states\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(state_id uuid, name text, sort integer, terminal boolean, is_current boolean, allowed boolean, refusal text)\", security: \"definer\" },\n { name: \"work_relation_kinds\", args: \"\", returns: \"TABLE(kind text, available boolean, why text)\", security: \"invoker\" },\n { name: \"work_set_state\", args: \"p_organization_id uuid, p_record_id uuid, p_state_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_slot_expire\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"work_slot_hold\", args: \"p_organization_id uuid, p_table_id uuid, p_slot_key text, p_holder text, p_ttl interval DEFAULT '00:15:00'::interval\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_slot_holds\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(hold_id uuid, slot_key text, holder text, expires_at timestamp with time zone, expired boolean)\", security: \"definer\" },\n { name: \"work_slot_index_name\", args: \"p_table_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"work_slot_release\", args: \"p_organization_id uuid, p_hold_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"work_slots_declare\", args: \"p_organization_id uuid, p_name text, p_slug text, p_home_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_state_id\", args: \"p_organization_id uuid, p_table_id uuid, p_value text\", returns: \"uuid\", security: \"invoker\" },\n { name: \"work_states\", args: \"\", returns: \"TABLE(sort integer, name text, terminal boolean, next text[])\", security: \"invoker\" },\n { name: \"work_take_assignment\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_template_declare\", args: \"p_organization_id uuid, p_name text, p_graph jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"work_template_instantiate\", args: \"p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_template_refusal\", args: \"p_graph jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"work_template_shape\", args: \"p_organization_id uuid, p_template_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_templates\", args: \"p_organization_id uuid, p_limit integer DEFAULT 100\", returns: \"TABLE(template_id uuid, name text, nodes integer, relations integer, created_at timestamp with time zone)\", security: \"definer\" },\n { name: \"work_transition_refusal\", args: \"p_organization_id uuid, p_from_state_id uuid, p_to_state_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"work_whose_turn\", args: \"p_organization_id uuid, p_table_id uuid, p_include_finished boolean DEFAULT false\", returns: \"TABLE(record_id uuid, title text, assignee_id uuid, turn text, due_on timestamp with time zone, state text, status text, terminal boolean)\", security: \"definer\" },\n] as const;\n\n/** The campaign's own knobs, with the value the store resolves them to today. */\nexport const STORE_KNOBS = [\n { key: \"accessible_entity_ids_guard\", value: \"true\", type: \"boolean\" },\n { key: \"action_run_records_max\", value: \"5000\", type: \"integer\" },\n { key: \"agent_schema_changes\", value: \"\\\"ask\\\"\", type: \"string\" },\n { key: \"associations_guard\", value: \"true\", type: \"boolean\" },\n { key: \"code_paths_enabled\", value: \"true\", type: \"boolean\" },\n { key: \"consumer_chat_seeding_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_checkout_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_context_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_education_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_extension_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_grid_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_retirement_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_saved_ai_outputs_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_scopes_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"containment_depth_ceiling\", value: \"16\", type: \"integer\" },\n { key: \"cross_organization_links\", value: \"false\", type: \"boolean\" },\n { key: \"decoration_rules_max\", value: \"50\", type: \"integer\" },\n { key: \"decorations_max_bytes\", value: \"262144\", type: \"integer\" },\n { key: \"document_letterhead\", value: \"{}\", type: \"json\" },\n { key: \"document_max_bytes\", value: \"1048576\", type: \"integer\" },\n { key: \"emergency_door_guard\", value: \"false\", type: \"boolean\" },\n { key: \"emergency_door_sweep_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"enrichment_batch_ceiling\", value: \"200\", type: \"integer\" },\n { key: \"enrichment_confidence_floor\", value: \"0.6\", type: \"number\" },\n { key: \"enrichment_cost_cap_cents\", value: \"2000\", type: \"integer\" },\n { key: \"enrichment_model\", value: \"\\\"claude-fable-5-latest\\\"\", type: \"string\" },\n { key: \"enrichment_sensitivity_ceiling\", value: \"\\\"internal\\\"\", type: \"string\" },\n { key: \"entity_custom_fields_guard\", value: \"false\", type: \"boolean\" },\n { key: \"entity_types_guard\", value: \"false\", type: \"boolean\" },\n { key: \"example_rows_max\", value: \"500\", type: \"integer\" },\n { key: \"export_rows_ceiling\", value: \"100000\", type: \"integer\" },\n { key: \"external_principal_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"field_index_guard\", value: \"false\", type: \"boolean\" },\n { key: \"field_sensitivity_levels\", value: \"{\\\"edit\\\": {\\\"public\\\": \\\"editor\\\", \\\"internal\\\": \\\"editor\\\", \\\"restricted\\\": \\\"admin\\\", \\\"confidential\\\": \\\"admin\\\"}, \\\"read\\\": {\\\"public\\\": \\\"viewer\\\", \\\"internal\\\": \\\"viewer\\\", \\\"restricted\\\": \\\"admin\\\", \\\"confidential\\\": \\\"editor\\\"}}\", type: \"json\" },\n { key: \"grid_layout\", value: \"{\\\"mode\\\": \\\"auto\\\", \\\"wrap\\\": false, \\\"row_height\\\": \\\"normal\\\", \\\"fit_max_columns\\\": 8, \\\"freeze_first_column\\\": false}\", type: \"json\" },\n { key: \"inbound_domain\", value: \"\\\"inbound.matrxserver.com\\\"\", type: \"string\" },\n { key: \"member_default_level\", value: \"\\\"viewer\\\"\", type: \"enum\" },\n { key: \"member_default_visibility\", value: \"\\\"all_records\\\"\", type: \"enum\" },\n { key: \"outside_invite_who\", value: \"\\\"org_admins_and_table_owners\\\"\", type: \"string\" },\n { key: \"page_size_ceiling\", value: \"1000\", type: \"integer\" },\n { key: \"provenance_retention_days\", value: \"30\", type: \"number\" },\n { key: \"records_tool_default\", value: \"true\", type: \"boolean\" },\n { key: \"row_action_steps_max\", value: \"60\", type: \"integer\" },\n { key: \"row_actions_max\", value: \"24\", type: \"integer\" },\n { key: \"row_versions_guard\", value: \"false\", type: \"boolean\" },\n { key: \"sandbox_expanded_frame_height_px\", value: \"20000\", type: \"integer\" },\n { key: \"sandbox_frame_height_px\", value: \"4000\", type: \"integer\" },\n { key: \"sandbox_message_bytes\", value: \"65536\", type: \"integer\" },\n { key: \"sandbox_org_components\", value: \"true\", type: \"boolean\" },\n { key: \"signup_provisioning_guard\", value: \"false\", type: \"boolean\" },\n { key: \"stage_rule_enforcement\", value: \"\\\"refuse\\\"\", type: \"enum\" },\n { key: \"system_enabled\", value: \"true\", type: \"boolean\" },\n { key: \"table_record_ceiling\", value: \"150000\", type: \"integer\" },\n { key: \"table_webhooks_max\", value: \"10\", type: \"integer\" },\n { key: \"value_max_bytes\", value: \"100000\", type: \"integer\" },\n { key: \"world_publish_enabled\", value: \"false\", type: \"boolean\" },\n] as const;\n\n/**\n * Every SQLSTATE the store's own function bodies raise, with the functions that\n * raise it. This is the list the client's refusal mapper is checked against: a\n * code the store can raise and the package cannot name is a hole, and the\n * real-door suite says so by name.\n */\nexport const STORE_REFUSAL_CODES = [\n { code: \"02000\", raised_by: \"_checklist_instantiate,_portal_invite_payload,_share_write_person,_table_share_invite_payload,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_archive,portal_card,portal_declare,portal_invite,portal_invite_accept,portal_preview,portal_principal_bind,portal_restore,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_halves_repair,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_archive,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state\" },\n { code: \"0A000\", raised_by: \"checklist_step_complete,external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign\" },\n { code: \"22003\", raised_by: \"context_resolve\" },\n { code: \"22004\", raised_by: \"_entity_custom_fields_guard,_share_write_person,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_purge_hard,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_graph,record_write_many,relation_carry,relation_halves_repair,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_archive,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare\" },\n { code: \"22007\", raised_by: \"dashboard_window_sql\" },\n { code: \"22012\", raised_by: \"formula_eval,rule_eval\" },\n { code: \"22023\", raised_by: \"_action_check,_booking_availability,_decorations_check,_entity_custom_fields_guard,_fx_date,_fx_num,_fx_unit,_fxp_level,_fxp_resolve,_fxp_tokens,_take_op_id,_value_envelope,_work_shape_guard,action_run,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,field_update,formula_eval,formula_parse,grid_layout_check,hub_changed_by,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,list_portals,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,read_records_archived,record_update,record_write_graph,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_from_example,table_rules,table_webhook_declare,visibility_as_of,work_approval_request,work_list,work_slot_hold\" },\n { code: \"23503\", raised_by: \"_action_check,_booking_availability,_checklist_instantiate,_containment_guard,_decorations_check,_display_spec_for,_field_document_for,_field_type_parity_guard,_pipeline_stage_key,_record_rule_uses,action_declare,action_run,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,autonumber_backfill,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,grid_layout,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,table_decorate,table_from_example,table_webhook_archive,table_webhook_declare,view_declare,work_set_state,work_take_assignment,work_template_instantiate\" },\n { code: \"23505\", raised_by: \"_share_write_person,_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,sign_request_cancel,sign_request_create,table_share_outside_resend,work_approval_decide,work_slot_hold\" },\n { code: \"23514\", raised_by: \"_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_format_check,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_relation_halves_agree,_relation_kernel_targets,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,action_run,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_comment_write,io_import_rows,migrate_merge,migrate_purge_hard,portal_archive,portal_restore,record_write_graph,relation_carry,relation_halves_repair,relation_own,sign_request_create,sign_request_sign,table_declare,table_from_example,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate\" },\n { code: \"40001\", raised_by: \"has_visibility_at\" },\n { code: \"42501\", raised_by: \"_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,agent_table_claim,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,doc_sign,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_purge_hard,migrate_purge_hard_request,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_invite_accept,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_archived,read_records_by_ids,read_records_matching,record_table,record_write_graph,relation_halves_disagreements,relation_halves_repair,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_webhook_declare,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person\" },\n { code: \"42703\", raised_by: \"entity_table,portal_declare\" },\n { code: \"53400\", raised_by: \"anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field\" },\n { code: \"54000\", raised_by: \"action_run,hub_changed_by,table_decorate,table_from_example,table_webhook_declare\" },\n { code: \"54001\", raised_by: \"record_delete\" },\n { code: \"P0001\", raised_by: \"action_run\" },\n { code: \"PT409\", raised_by: \"record_update\" },\n { code: \"PT428\", raised_by: \"_record_rule_uses\" },\n] as const;\n\n/** `platform.entity_types` — the registered tokens a Table or relation may name. */\nexport const ENTITY_TOKENS = [\n \"access_delta_probe\",\n \"access_delta_run\",\n \"access_request\",\n \"account_addon\",\n \"acquisition_block\",\n \"activity\",\n \"admin_audit_log\",\n \"admin_email_log\",\n \"admin_markdown_sample\",\n \"admin_user\",\n \"admission_config\",\n \"agent\",\n \"agent_card\",\n \"agent_definition_version\",\n \"agent_drift_alert\",\n \"agent_exemplar\",\n \"agent_mandate_note\",\n \"agent_prompt_remediation\",\n \"agent_provision_legacy\",\n \"agent_run\",\n \"agent_run_stage\",\n \"agent_schedule\",\n \"agent_schedule_claim\",\n \"agent_shortcut\",\n \"agent_surface_binding\",\n \"agent_template\",\n \"agent_term_list\",\n \"agent_usage\",\n \"agent_user_kv\",\n \"ai_api\",\n \"ai_endpoint\",\n \"ai_model\",\n \"ai_model_alias\",\n \"ai_offering\",\n \"ai_provider\",\n \"ai_setting\",\n \"analysis_result\",\n \"anon_form\",\n \"anon_function_birth_grandfather\",\n \"anon_hit\",\n \"anon_inbound\",\n \"anon_replay\",\n \"anon_submission\",\n \"anon_token\",\n \"api_field_warning\",\n \"api_request_log\",\n \"app\",\n \"app_config\",\n \"app_config_history\",\n \"app_definition_version\",\n \"app_error\",\n \"app_execution\",\n \"app_instance\",\n \"app_log\",\n \"app_log_muted_pattern\",\n \"app_log_norm_exception\",\n \"app_rate_limit\",\n \"app_setting\",\n \"app_sync_status\",\n \"approach\",\n \"artifact\",\n \"assessment\",\n \"assessment_item\",\n \"assessment_result\",\n \"assignment_session\",\n \"assist\",\n \"assist_producer_policy\",\n \"assist_producer_policy_history\",\n \"association_type\",\n \"assurance_level\",\n \"attempt\",\n \"audit_broken_functions\",\n \"audit_canonical_findings\",\n \"audit_exemption\",\n \"audit_function_deps\",\n \"audit_function_runtime_probe\",\n \"audit_m2m_candidates\",\n \"audit_refresh_log\",\n \"audit_stale_registry\",\n \"audit_unregistered_candidates\",\n \"bak_assoc_file_processed_document_20260812\",\n \"bak_assoc_type_file_processed_document_20260812\",\n \"bak_organization_name_dd043\",\n \"base_entity_template\",\n \"batch_cost_event\",\n \"batch_provider_batch\",\n \"batch_work_item\",\n \"billing_capability\",\n \"billing_capability_limit\",\n \"billing_connect_account\",\n \"billing_customer\",\n \"billing_plan\",\n \"billing_plan_limit\",\n \"billing_price\",\n \"billing_product\",\n \"billing_spend_guardrail\",\n \"billing_stripe_event\",\n \"billing_subscription\",\n \"billing_usage_ledger\",\n \"billing_user_plan\",\n \"browser_account_binding\",\n \"browser_action_event\",\n \"browser_authenticator_window\",\n \"browser_capture\",\n \"browser_control_request\",\n \"browser_handoff\",\n \"browser_login_attempt\",\n \"browser_login_recipe\",\n \"browser_profile\",\n \"browser_profile_checkpoint\",\n \"browser_run\",\n \"browser_site_observation\",\n \"browser_site_policy\",\n \"browser_stream_ticket\",\n \"build_lock\",\n \"calendar_event\",\n \"canvas_comment\",\n \"canvas_comment_like\",\n \"canvas_item\",\n \"canvas_item_state\",\n \"canvas_like\",\n \"canvas_score\",\n \"canvas_view\",\n \"capture_window\",\n \"carrying_rule\",\n \"catalog_entries_history\",\n \"catalog_entry\",\n \"category\",\n \"change_type_default\",\n \"chat_user_usage_summary\",\n \"citations\",\n \"class_purchase\",\n \"classifier_revision_ledger\",\n \"client_callable_door\",\n \"client_callable_door_retirement\",\n \"client_excluded_column_unregistered\",\n \"cmp_entry\",\n \"cmp_feedback\",\n \"code_file\",\n \"code_folder\",\n \"code_repository\",\n \"coding_session\",\n \"coding_session_entry\",\n \"comment\",\n \"commerce_asset_allocation\",\n \"commerce_asset_grading\",\n \"commerce_asset_identifier\",\n \"commerce_asset_lot_event\",\n \"commerce_asset_mandate_result\",\n \"commerce_asset_price_factor\",\n \"commerce_asset_reshoot_request\",\n \"commerce_asset_review\",\n \"commerce_asset_unknown\",\n \"commerce_certified_printer\",\n \"commerce_cloud_sync_connection\",\n \"commerce_ebay_business_policy\",\n \"commerce_ebay_category\",\n \"commerce_ebay_category_aspect\",\n \"commerce_ebay_category_tree\",\n \"commerce_ebay_custom_policy\",\n \"commerce_ebay_inventory_item\",\n \"commerce_ebay_inventory_item_group\",\n \"commerce_ebay_inventory_item_group_member\",\n \"commerce_ebay_inventory_location\",\n \"commerce_ebay_listing\",\n \"commerce_ebay_marketplace_policy\",\n \"commerce_ebay_media_asset\",\n \"commerce_ebay_notification_destination\",\n \"commerce_ebay_notification_event\",\n \"commerce_ebay_notification_subscription\",\n \"commerce_ebay_notification_topic\",\n \"commerce_ebay_offer\",\n \"commerce_ebay_order\",\n \"commerce_ebay_order_line_item\",\n \"commerce_ebay_shipping_fulfillment\",\n \"commerce_ebay_store_category\",\n \"commerce_human_correction\",\n \"commerce_intake_artifact\",\n \"commerce_intake_asset\",\n \"commerce_intake_batch\",\n \"commerce_label_batch\",\n \"commerce_label_code\",\n \"commerce_marketplace_account\",\n \"commerce_marketplace_account_deletion_audit\",\n \"commerce_marketplace_api_call\",\n \"commerce_marketplace_rate_budget\",\n \"commerce_marketplace_site\",\n \"commerce_marketplace_sync_run\",\n \"commerce_prediction_outcome\",\n \"commerce_print_order\",\n \"commerce_product\",\n \"commerce_product_channel_ref\",\n \"commerce_product_media\",\n \"commerce_product_variant\",\n \"commerce_recall_audit\",\n \"comparison_set\",\n \"component_group\",\n \"contact_medium\",\n \"contact_submission\",\n \"content_certification\",\n \"content_ir_kind\",\n \"content_ir_kind_component\",\n \"content_ir_kind_component_incident\",\n \"content_ir_kind_conformance\",\n \"content_ir_kind_edge\",\n \"content_ir_kind_example\",\n \"content_ir_kind_instance\",\n \"content_ir_kind_surface\",\n \"content_lane\",\n \"context_access_log\",\n \"context_item\",\n \"context_item_suggestion\",\n \"context_item_value\",\n \"context_value_refs\",\n \"conversation\",\n \"conversation_value\",\n \"courts\",\n \"credential_attachment\",\n \"credential_item\",\n \"credential_mutation_receipt\",\n \"crm_address\",\n \"crm_affiliation\",\n \"crm_blocklist_entry\",\n \"crm_contact_candidate\",\n \"crm_deal\",\n \"crm_deal_stage_event\",\n \"crm_enrichment_call\",\n \"crm_interaction\",\n \"crm_merge_candidate\",\n \"crm_outreach_list\",\n \"crm_outreach_list_member\",\n \"crm_party_merge\",\n \"crm_registry_ingest_run\",\n \"crm_registry_source\",\n \"crm_saved_view\",\n \"crm_sending_event\",\n \"crm_sending_identity\",\n \"crm_sending_identity_check\",\n \"crm_sending_policy\",\n \"custom_entity_definition\",\n \"custom_field_definition\",\n \"custom_field_target\",\n \"custom_record\",\n \"cx_agent_memory\",\n \"cx_agent_plan\",\n \"cx_agent_task\",\n \"cx_code_edit\",\n \"cx_code_message_file\",\n \"cx_conversation_documents\",\n \"cx_media\",\n \"cx_observational_memory\",\n \"cx_observational_memory_event\",\n \"cx_pending_injection\",\n \"cx_request\",\n \"cx_request_snapshot\",\n \"cx_tool_trace\",\n \"cx_user_request\",\n \"cx_user_todo\",\n \"dashboard_saved_view\",\n \"data_rights_event\",\n \"data_store\",\n \"data_store_members\",\n \"dataset\",\n \"dd171_containment_baseline\",\n \"dd175_cast\",\n \"dd175_component_lane_baseline\",\n \"ddl_guard_log\",\n \"deck_suggestion\",\n \"definer_class_exemption\",\n \"definer_client_grant_grandfather\",\n \"definer_grant_baseline\",\n \"deprecated_relation\",\n \"derive_run\",\n \"dev_login_audit\",\n \"dict_entry\",\n \"dict_provider_publication\",\n \"dict_setting\",\n \"dm_conversation\",\n \"dm_message\",\n \"dm_participant\",\n \"doc_render\",\n \"doc_signature\",\n \"dockets\",\n \"domain_classification\",\n \"edge_payload_kind\",\n \"egress_device\",\n \"egress_pairing\",\n \"egress_ticket\",\n \"emails\",\n \"embedding_cache\",\n \"embeddings_google_gemini_2_1536\",\n \"embeddings_oai_3_small_1536\",\n \"embeddings_voyage_4_large_1024\",\n \"embeddings_voyage_code_3_1024\",\n \"endpoint_family_sweep_state\",\n \"engine_owner_task\",\n \"entity_grant\",\n \"entity_relationship\",\n \"entity_type\",\n \"esign_campaign\",\n \"esign_campaign_member\",\n \"esign_consent_disclosure\",\n \"esign_envelope\",\n \"esign_envelope_certificate\",\n \"esign_envelope_document\",\n \"esign_envelope_event\",\n \"esign_envelope_external_ref\",\n \"esign_envelope_signer\",\n \"esign_provider\",\n \"esign_provider_binding\",\n \"esign_signing_key\",\n \"execution_event_cursor\",\n \"extension_auth_code\",\n \"external_link\",\n \"external_source\",\n \"extract_sweep_state\",\n \"fc_card\",\n \"fc_detail\",\n \"fc_set\",\n \"feature_doc\",\n \"feature_knob\",\n \"feedback_comments\",\n \"feedback_user_messages\",\n \"field_component\",\n \"file\",\n \"file_analysis\",\n \"file_entities\",\n \"file_overrides\",\n \"file_page_annotations\",\n \"file_pages\",\n \"file_rag_job\",\n \"file_version\",\n \"files_account_tier\",\n \"files_machine_written_prefix\",\n \"files_sync_mapping\",\n \"files_user_account\",\n \"flashcard_data\",\n \"flashcard_history\",\n \"flashcard_review\",\n \"flashcard_set\",\n \"flashcard_sets\",\n \"flexible_data\",\n \"folder\",\n \"function_contract\",\n \"game_badge\",\n \"game_result\",\n \"game_room\",\n \"global_execution\",\n \"global_execution_checkpoint\",\n \"global_execution_control\",\n \"global_execution_event\",\n \"global_meter_entry\",\n \"global_origin\",\n \"global_request\",\n \"google_document\",\n \"growth_loop_event\",\n \"growth_loop_run\",\n \"growth_loop_stage_run\",\n \"guardian_link\",\n \"guest_conversion_audit\",\n \"guest_execution_log\",\n \"guest_executions\",\n \"guided_checklist_run\",\n \"heatmap_save\",\n \"hindsight_enrollment\",\n \"hindsight_finding\",\n \"hindsight_regression_case\",\n \"hindsight_replay\",\n \"hindsight_replay_step\",\n \"hindsight_review\",\n \"hr_access_audit\",\n \"hr_access_role\",\n \"hr_accommodation_request\",\n \"hr_ai_evidence\",\n \"hr_alert_routing_rule\",\n \"hr_application\",\n \"hr_approval_authority\",\n \"hr_approval_delegation\",\n \"hr_asset\",\n \"hr_asset_assignment\",\n \"hr_attendance_exception\",\n \"hr_auto_close_rule\",\n \"hr_availability\",\n \"hr_background_check\",\n \"hr_benefits_event\",\n \"hr_calculation_snapshot\",\n \"hr_candidate\",\n \"hr_candidate_conversion\",\n \"hr_candidate_message\",\n \"hr_careers_portal\",\n \"hr_checklist_item\",\n \"hr_checklist_run\",\n \"hr_checklist_template\",\n \"hr_checklist_template_item\",\n \"hr_compensation\",\n \"hr_corrective_action\",\n \"hr_course\",\n \"hr_course_version\",\n \"hr_credential\",\n \"hr_crew\",\n \"hr_deduction_code\",\n \"hr_department\",\n \"hr_derived_grant\",\n \"hr_disposition_event\",\n \"hr_earning_code\",\n \"hr_eeo_response\",\n \"hr_emergency_contact\",\n \"hr_employee\",\n \"hr_employee_private\",\n \"hr_employer_profile\",\n \"hr_employment\",\n \"hr_employment_pin\",\n \"hr_engagement\",\n \"hr_establishment\",\n \"hr_external_identity\",\n \"hr_field_policy\",\n \"hr_holiday\",\n \"hr_holiday_calendar\",\n \"hr_i9\",\n \"hr_i9_document\",\n \"hr_incident\",\n \"hr_incident_party\",\n \"hr_interview\",\n \"hr_interview_kit\",\n \"hr_job_title\",\n \"hr_jurisdiction\",\n \"hr_jurisdiction_rule\",\n \"hr_jurisdiction_rule_class\",\n \"hr_jurisdiction_rule_org_decision\",\n \"hr_jurisdiction_rule_test\",\n \"hr_kiosk_device\",\n \"hr_kiosk_session\",\n \"hr_labor_target\",\n \"hr_leave_case\",\n \"hr_leave_enrollment\",\n \"hr_leave_ledger\",\n \"hr_leave_policy\",\n \"hr_leave_request\",\n \"hr_legal_hold\",\n \"hr_legal_hold_item\",\n \"hr_location\",\n \"hr_new_hire_report\",\n \"hr_offer\",\n \"hr_opening\",\n \"hr_overtime_alert\",\n \"hr_overtime_alert_rule\",\n \"hr_overtime_preapproval\",\n \"hr_pay_group\",\n \"hr_pay_period\",\n \"hr_pay_period_employment\",\n \"hr_payroll_export\",\n \"hr_payroll_export_line\",\n \"hr_position_assignment\",\n \"hr_posting\",\n \"hr_posting_publication\",\n \"hr_provider_binding\",\n \"hr_provider_event\",\n \"hr_provisioning_result\",\n \"hr_punch\",\n \"hr_recalculation_batch\",\n \"hr_record_class\",\n \"hr_records_request\",\n \"hr_reference_check\",\n \"hr_reporting_line\",\n \"hr_requisition\",\n \"hr_restricted_note\",\n \"hr_retention_rule\",\n \"hr_role_assignment\",\n \"hr_schedule\",\n \"hr_schedule_change\",\n \"hr_schedule_guidance\",\n \"hr_schedule_template\",\n \"hr_schedule_template_shift\",\n \"hr_scorecard\",\n \"hr_separation\",\n \"hr_shift\",\n \"hr_shift_claim\",\n \"hr_staffing_requirement\",\n \"hr_survey\",\n \"hr_survey_invitation\",\n \"hr_survey_question\",\n \"hr_survey_response\",\n \"hr_tax_registration\",\n \"hr_tax_withholding\",\n \"hr_time_adjustment\",\n \"hr_training_assignment\",\n \"hr_training_attempt\",\n \"hr_transcript_entry\",\n \"hr_verification_letter_request\",\n \"hr_work_interval\",\n \"hr_workflow_binding\",\n \"hr_workflow_decision\",\n \"hr_workflow_definition\",\n \"hr_workflow_event\",\n \"hr_workflow_failure\",\n \"hr_workflow_flow_type\",\n \"hr_workflow_instance\",\n \"hr_workflow_step\",\n \"hr_workflow_step_definition\",\n \"hr_workweek\",\n \"html_extraction\",\n \"iam_access_audit\",\n \"iam_api_key\",\n \"iam_emergency_door_request\",\n \"idempotency\",\n \"industry\",\n \"industry_curator\",\n \"infra_status\",\n \"ingest_runs\",\n \"integration_connection\",\n \"integration_connection_resource\",\n \"interview_decision_interview\",\n \"interview_decision_question\",\n \"interview_document_revision\",\n \"interview_hole\",\n \"interview_question\",\n \"interview_session\",\n \"interview_turn\",\n \"invitation\",\n \"invitation_code\",\n \"invitation_request\",\n \"io_comment\",\n \"io_contract\",\n \"io_import\",\n \"io_outbox\",\n \"item\",\n \"item_mastery\",\n \"judge_verdict\",\n \"jurisdiction_policy\",\n \"keyword_classification_queue\",\n \"kg_alert\",\n \"kg_chunk_entities\",\n \"kg_chunks\",\n \"kg_clusters\",\n \"kg_edges\",\n \"kg_entities\",\n \"kg_entity_aliases\",\n \"kg_suggestion_ack\",\n \"kg_sweep_queue\",\n \"kg_sweep_run\",\n \"kg_sweep_state\",\n \"kg_value_match\",\n \"knob_override\",\n \"knob_override_audit\",\n \"knob_rung_lock\",\n \"knob_scope_kind\",\n \"knob_write_door\",\n \"league_membership\",\n \"learn_doc\",\n \"library_doc\",\n \"lifecycle_archive\",\n \"lifecycle_archive_row\",\n \"lifecycle_audit\",\n \"lifecycle_entity_plan\",\n \"lifecycle_map_build\",\n \"lifecycle_reference_map\",\n \"lifecycle_run\",\n \"lifecycle_tier_ledger\",\n \"location\",\n \"mandate\",\n \"mandate_advance_batch_row\",\n \"mandate_binding\",\n \"mandate_binding_legacy\",\n \"mandate_goal_clauses\",\n \"mandate_legacy\",\n \"mandate_observation\",\n \"mandate_reference\",\n \"mandate_scan\",\n \"mandate_treatment\",\n \"marketing_initiative\",\n \"masterwork_corpus_item\",\n \"masterwork_run\",\n \"masterwork_run_kind\",\n \"masterwork_source\",\n \"math_course_structure\",\n \"math_problem\",\n \"matrx_action_ledger\",\n \"mcp_config\",\n \"mcp_server\",\n \"mcp_user_conn\",\n \"media_capture_handoff\",\n \"media_catalog_setting\",\n \"media_library_item\",\n \"media_selection_item\",\n \"media_selection_job\",\n \"media_source_library\",\n \"meet_call_invite\",\n \"meet_meeting\",\n \"meet_note\",\n \"meet_participant\",\n \"meet_recording\",\n \"meet_transcript_segment\",\n \"membership\",\n \"membership_grant\",\n \"merge_field_provenance\",\n \"message\",\n \"message_template\",\n \"meta_excluded_schema\",\n \"meta_table_stats_history\",\n \"metadata_reserved_keys\",\n \"microservice_project\",\n \"migration_log\",\n \"mtx_media_heal_queue\",\n \"mtx_public_url_guard\",\n \"ner_shadow\",\n \"note\",\n \"note_folder\",\n \"notification\",\n \"notification_channel_preference\",\n \"notification_event_override\",\n \"notification_event_type\",\n \"notification_preference\",\n \"notification_submission\",\n \"notify_outsider_door_baseline\",\n \"oauth_handoff_claim\",\n \"opinion_clusters\",\n \"opinions\",\n \"ops_issue_class\",\n \"ops_issue_event\",\n \"ops_proof_check\",\n \"ops_proof_run\",\n \"ops_proof_scenario\",\n \"org_admin_audit\",\n \"org_change_policy\",\n \"org_context_ledger\",\n \"org_industries\",\n \"org_member_control\",\n \"org_module_config\",\n \"org_plan\",\n \"org_repair_0253_backup\",\n \"organization\",\n \"organization_preferences\",\n \"organization_visibility_version\",\n \"output_feedback\",\n \"outreach_acceptance\",\n \"page_extraction_job\",\n \"page_extraction_page_run\",\n \"page_extraction_results\",\n \"page_extraction_runs\",\n \"page_intent_queue\",\n \"page_mapping_queue\",\n \"part_config\",\n \"part_config_sub\",\n \"party\",\n \"party_contact_point\",\n \"passkey_credential\",\n \"path_drift_repair_2026_09\",\n \"pc_article\",\n \"pc_episode\",\n \"pc_show\",\n \"pc_studio_run\",\n \"pc_studio_run_asset\",\n \"pdf_consolidation_log\",\n \"pdf_redaction_audit\",\n \"pdf_redaction_key_escrow\",\n \"permission_grant\",\n \"plan_cms_fill_item\",\n \"plan_cms_fill_job\",\n \"plan_entity\",\n \"plan_node\",\n \"plan_node_artifact\",\n \"plan_node_step\",\n \"plan_profile\",\n \"platform_action_request\",\n \"platform_actor_session\",\n \"platform_actor_token\",\n \"platform_actor_token_event\",\n \"platform_continued_access\",\n \"platform_org_knob_override\",\n \"platform_outcome_event\",\n \"platform_outsider_consumer\",\n \"platform_reachability\",\n \"platform_reference_category\",\n \"platform_reference_declaration\",\n \"platform_repo\",\n \"platform_saved_view\",\n \"platform_schema\",\n \"platform_share_link\",\n \"platform_user_knob_override\",\n \"podcast_race\",\n \"policy_overlap_backup\",\n \"policy_overlap_probe\",\n \"processed_document\",\n \"processed_document_page\",\n \"product_capture_file\",\n \"product_capture_item\",\n \"product_capture_payload\",\n \"product_capture_product\",\n \"product_capture_question\",\n \"profile\",\n \"project\",\n \"prompt\",\n \"provider_account\",\n \"provider_account_credential\",\n \"provision\",\n \"provision_generate_target\",\n \"provision_grant\",\n \"provision_marker\",\n \"provision_rule_message\",\n \"provision_schema\",\n \"provision_shape_debt\",\n \"provision_spec\",\n \"provision_spec_grandfather\",\n \"provision_vocabulary\",\n \"purpose\",\n \"quiz_session\",\n \"rag_ingest_run\",\n \"rag_library_audit_log\",\n \"rate_limit_buckets\",\n \"recompute_queue\",\n \"record\",\n \"record_alias\",\n \"redaction_mapping\",\n \"research_analysis\",\n \"research_content\",\n \"research_context_bundle\",\n \"research_document\",\n \"research_intent\",\n \"research_keyword\",\n \"research_media\",\n \"research_source\",\n \"research_synthesis\",\n \"research_tag\",\n \"research_template\",\n \"research_topic\",\n \"retention_policy\",\n \"retrieval_audit\",\n \"review_queue\",\n \"route_manifest_entry\",\n \"row_version\",\n \"rulebook\",\n \"runtime_operation_stream\",\n \"runtime_operation_stream_batch\",\n \"sandbox_instance\",\n \"sch_agent_task\",\n \"sch_run\",\n \"sch_task\",\n \"sch_trigger\",\n \"schema_client_exposure\",\n \"schema_migration_ledger\",\n \"schema_migration_legacy\",\n \"schema_migration_slot_grandfather\",\n \"schema_templates\",\n \"scope\",\n \"scope_association_suggestion\",\n \"scope_dataset_instance\",\n \"scope_door_registry\",\n \"scope_item_value_suggestion\",\n \"scope_suggestion\",\n \"scope_type\",\n \"scrape_domain\",\n \"scrape_domain_settings\",\n \"scrape_failure_log\",\n \"scrape_parsed_page\",\n \"scrape_path_override\",\n \"scrape_path_pattern\",\n \"scrape_retry_queue\",\n \"seo_ai_capability\",\n \"seo_ai_visibility_citation\",\n \"seo_ai_visibility_claim\",\n \"seo_ai_visibility_panel\",\n \"seo_ai_visibility_response\",\n \"seo_ai_visibility_signal\",\n \"seo_backlink\",\n \"seo_backlink_change_event\",\n \"seo_backlink_dimension_snapshot\",\n \"seo_backlink_observation\",\n \"seo_backlink_snapshot\",\n \"seo_change_assessment\",\n \"seo_change_event\",\n \"seo_change_item\",\n \"seo_change_metric\",\n \"seo_change_set\",\n \"seo_change_theory\",\n \"seo_collection_run\",\n \"seo_competitor\",\n \"seo_competitor_observation\",\n \"seo_competitor_opportunity\",\n \"seo_coverage_mention\",\n \"seo_coverage_tracker\",\n \"seo_dimension_value_matcher\",\n \"seo_engine_schedule\",\n \"seo_geo_place\",\n \"seo_gsc_dig_rule\",\n \"seo_keyword\",\n \"seo_keyword_class_rule\",\n \"seo_keyword_edge\",\n \"seo_keyword_facet\",\n \"seo_keyword_market\",\n \"seo_keyword_market_observation\",\n \"seo_keyword_place\",\n \"seo_keyword_saved_view\",\n \"seo_keyword_topic\",\n \"seo_landscape_brief\",\n \"seo_link_gap_domain\",\n \"seo_link_gap_match\",\n \"seo_map_facet\",\n \"seo_map_facet_value\",\n \"seo_map_topic\",\n \"seo_page_measurement_health\",\n \"seo_page_performance\",\n \"seo_provider_call\",\n \"seo_provider_task\",\n \"seo_rank_observation\",\n \"seo_rank_target\",\n \"seo_raw_payload\",\n \"seo_referring_domain_profile\",\n \"seo_reputation_case\",\n \"seo_search_performance_daily\",\n \"seo_serp_mention\",\n \"seo_serp_opportunity\",\n \"seo_serp_result\",\n \"seo_serp_snapshot\",\n \"seo_site_geo_area\",\n \"seo_site_keyword_offering\",\n \"seo_site_keyword_value\",\n \"seo_site_offering_value\",\n \"seo_site_topic_value\",\n \"seo_site_value_combo\",\n \"seo_site_value_worth\",\n \"seo_site_vocabulary\",\n \"seo_source_request\",\n \"seo_starter_pack\",\n \"seo_starter_pack_item\",\n \"seo_story_angle\",\n \"seo_topic\",\n \"seo_topical_map\",\n \"seo_web_analytics_daily\",\n \"share_link\",\n \"shareable_resource_registry\",\n \"shared_canvas_item\",\n \"short_link\",\n \"shortcut_category\",\n \"skill\",\n \"skill_category\",\n \"skill_render_definition\",\n \"sms_consent\",\n \"sms_conversation\",\n \"sms_message\",\n \"sms_message_media\",\n \"sms_notification\",\n \"sms_notification_preference\",\n \"sms_phone_number\",\n \"sms_rate_limits\",\n \"sms_webhook_logs\",\n \"soft_delete_edge\",\n \"source_authority\",\n \"stage_dockets_966c18eca7\",\n \"stage_ref_kind\",\n \"stamped_write_table\",\n \"structure\",\n \"structured_list\",\n \"studio_cleaned_segments\",\n \"studio_concept_items\",\n \"studio_documents\",\n \"studio_module_segments\",\n \"studio_raw_segments\",\n \"studio_recording_chunks\",\n \"studio_recording_segments\",\n \"studio_run\",\n \"studio_session\",\n \"studio_session_settings\",\n \"study_attempt\",\n \"study_goal\",\n \"study_media\",\n \"study_plan\",\n \"study_plan_block\",\n \"study_plan_day\",\n \"study_reminder_context\",\n \"study_reminder_delivery\",\n \"study_session\",\n \"study_source_chunk\",\n \"study_streak\",\n \"study_structured_section\",\n \"superseded_policy\",\n \"surface\",\n \"system_announcement\",\n \"system_context_item\",\n \"system_error\",\n \"system_orgs\",\n \"system_personal_org_failure\",\n \"system_write_failure\",\n \"task\",\n \"task_user_state\",\n \"taxonomy_node\",\n \"template_context_items\",\n \"template_scope_types\",\n \"templates\",\n \"test_handset_inbox\",\n \"test_handset_verification\",\n \"thread\",\n \"tool\",\n \"tool_binding\",\n \"tool_bundle\",\n \"tool_call\",\n \"tool_definition_version\",\n \"tool_executor\",\n \"tool_surface_defaults\",\n \"tool_test_sample\",\n \"tool_ui\",\n \"tool_ui_incident\",\n \"tool_ui_version\",\n \"topic_placement_queue\",\n \"transcript\",\n \"trigger_event\",\n \"udt_dataset_fields\",\n \"udt_dataset_row_versions\",\n \"udt_dataset_rows\",\n \"udt_dataset_template\",\n \"udt_dataset_template_fields\",\n \"udt_document\",\n \"udt_document_snapshot\",\n \"udt_structured_list_items\",\n \"udt_workbook_snapshot\",\n \"ui_client\",\n \"ui_surface_agent_pref\",\n \"ui_surface_agent_role\",\n \"ui_surface_client_tool\",\n \"ui_surface_config\",\n \"ui_surface_value\",\n \"ui_surface_write_target\",\n \"unsubscribe_token\",\n \"uploads_inflight\",\n \"user_achievement\",\n \"user_active_context\",\n \"user_analysis_preference\",\n \"user_bookmark\",\n \"user_email_preference\",\n \"user_entity_state\",\n \"user_feedback\",\n \"user_follows\",\n \"user_form_profile\",\n \"user_markdown_sample\",\n \"user_memory\",\n \"user_preference\",\n \"user_profile\",\n \"user_secret\",\n \"user_secret_audit\",\n \"user_secret_grant\",\n \"user_stat\",\n \"user_storage_usage\",\n \"user_surface_state\",\n \"visibility_cache\",\n \"visibility_epoch\",\n \"voice\",\n \"war_room\",\n \"wbx_capture\",\n \"wbx_demo\",\n \"wbx_guidance\",\n \"wbx_highlight\",\n \"wbx_pattern\",\n \"wbx_recipe\",\n \"wbx_screenshot\",\n \"wbx_seo_audit\",\n \"wc_claim\",\n \"wc_impairment_definition\",\n \"wc_injury\",\n \"wc_report\",\n \"web_analysis_item\",\n \"web_brand\",\n \"web_brand_asset\",\n \"web_brand_offering\",\n \"web_business_fact\",\n \"web_business_location\",\n \"web_channel_analytics_daily\",\n \"web_crawl_event\",\n \"web_crawl_preset\",\n \"web_crawl_schedule\",\n \"web_crawl_session\",\n \"web_crawl_url\",\n \"web_discovered_item\",\n \"web_finding\",\n \"web_gsc_page_stat\",\n \"web_link_edge\",\n \"web_listing_publisher\",\n \"web_location_listing\",\n \"web_offering_template\",\n \"web_page\",\n \"web_page_content\",\n \"web_page_evidence\",\n \"web_page_sitemap\",\n \"web_property\",\n \"web_provider\",\n \"web_result\",\n \"web_screenshot\",\n \"web_site\",\n \"web_site_endpoint_rule\",\n \"web_site_item_config\",\n \"web_site_offering\",\n \"web_sitemap\",\n \"web_snapshot\",\n \"web_tag_manager_snapshot\",\n \"web_youtube_video\",\n \"webhook_deliveries\",\n \"webhook_dispatch_state\",\n \"webhooks\",\n \"wf_node_data_slot\",\n \"work_claim\",\n \"work_item\",\n \"workbook\",\n \"worker_heartbeat\",\n \"workflow\",\n \"workflow_card\",\n \"workflow_checkpoint\",\n \"workflow_comparison\",\n \"workflow_definition_version\",\n \"workflow_idempotency\",\n \"workflow_job\",\n \"workflow_node_events\",\n \"workflow_node_outcome\",\n \"workflow_plan\",\n \"workflow_plan_event\",\n \"workflow_plan_sample\",\n \"workflow_recovery_audit\",\n \"workflow_run\",\n \"workflow_run_log\",\n \"workflow_runtime_surface\",\n \"workflow_template\",\n \"workflow_trigger\",\n \"workflow_trigger_fire\",\n \"workflow_work_item\",\n \"working_document\",\n \"write_guard_key\",\n \"youtube_quota_day\",\n \"youtube_search\",\n \"youtube_video\",\n] as const;\n\nexport type StoreRefusalCode = (typeof STORE_REFUSAL_CODES)[number][\"code\"];\nexport type StoreDoorName = (typeof STORE_DOORS)[number][\"name\"];\nexport type EntityToken = (typeof ENTITY_TOKENS)[number];\nexport type KernelTableName = (typeof KERNEL_TABLES)[number][\"name\"];\n","// src/record-scope.ts — @ai-matrx/records · AGT-N-9 · PRODUCTS row 11\n//\n// A CONVERSATION THAT IS ABOUT ONE RECORD.\n//\n// These are the shapes `custom.record_scope_context` and its three siblings answer. They\n// are types over ONE door, not a model of their own: the assembly happens inside the\n// database, through `custom.read_record`, under the operating person's own field-level\n// security, and this file only says what comes back.\n//\n// TWO ABSENCES, NEVER ONE. `withheld[].because` is `\"masked\"` when the STORE kept a Field\n// from this reader, and `\"policy\"` when the ORGANIZATION keeps it out of conversations.\n// A screen that collapsed them would tell somebody \"you may not see this\" about a field\n// they can read on the record two inches away.\n\nimport type { PermissionLevel } from \"./level\";\nimport type { Uuid } from \"./record\";\n\n/** One value the agent was given, with the triple that makes it citable. */\nexport interface RecordScopeField {\n key: string;\n label: string;\n type: string;\n value: unknown;\n /** DYN: a merge field resolves to a TRIPLE, not a string. */\n cite: {\n record_id: Uuid;\n field_id: Uuid;\n value_version: number;\n written_at: string | null;\n };\n}\n\n/** A Field the agent was NOT given, and which of the two reasons it is. */\nexport interface RecordScopeWithheld {\n key: string;\n label: string;\n because: \"masked\" | \"policy\";\n reason: string;\n needs?: string;\n /** The whole sentence, already written — a screen prints it rather than composing one. */\n says: string;\n}\n\nexport interface RecordScopeRelation {\n via: string;\n target_id: Uuid;\n foreign: boolean;\n masked: boolean;\n your_level: PermissionLevel | null;\n card: Record<string, unknown> | null;\n why: string | null;\n}\n\nexport interface RecordScopeHistoryEntry {\n version: number;\n at: string;\n what: string;\n who: string | null;\n changes: Array<Record<string, unknown>>;\n}\n\nexport interface RecordScopeComment {\n id: Uuid;\n body: string;\n created_at: string;\n created_by_name: string;\n field_key: string | null;\n}\n\nexport interface RecordScopeContext {\n record: {\n id: Uuid;\n title: string;\n table_id: Uuid;\n table_name: string | null;\n scope_type: string;\n plural: string;\n version: number;\n updated_at: string;\n your_level: PermissionLevel;\n };\n fields: RecordScopeField[];\n withheld: RecordScopeWithheld[];\n relations: RecordScopeRelation[];\n history: RecordScopeHistoryEntry[];\n comments: RecordScopeComment[];\n may_comment: boolean;\n siblings: {\n shown: Array<{ id: Uuid; title: string }>;\n more_than_shown: boolean;\n says: string;\n };\n /** Questions derived from THIS record's shape — never a fixed list. */\n suggested: string[];\n /** One sentence naming what is not in the conversation. Printed verbatim. */\n says: string;\n assembled_at: string;\n}\n\n/** What a conversation is about. `readable` false means the person lost access to it. */\nexport interface ConversationScope {\n bound: boolean;\n readable?: boolean;\n record_id?: Uuid;\n table_id?: Uuid;\n scope_type?: string;\n title?: string;\n bound_at?: string;\n bound_by?: Uuid;\n because?: string;\n}\n\nexport interface ConversationScopeContext {\n scope: ConversationScope;\n context: RecordScopeContext | null;\n}\n\n/** `About: Acme Industrial` — the chip a bound chat wears. */\nexport function scopeChip(scope: ConversationScope): string {\n return scope.title ? `About: ${scope.title}` : \"About: this record\";\n}\n","// src/core/doors.ts — @ai-matrx/records\n//\n// THE DOOR TABLE. Every call this package can make names a door, and every door\n// it names is checked against `STORE_DOORS` — which is generated from `pg_proc`\n// on the live store, not written by a person.\n//\n// A door that is not there yet is answered `door_absent`, naming the door AND\n// the lane that owns it. That is the whole of \"nothing fails silently\" for this\n// package: there is no empty array standing in for a search nobody built, and\n// no `true` standing in for a proposal nobody can approve.\n\nimport { STORE_DOORS } from \"../store.generated\";\nimport type { RecordsError } from \"../results\";\n\n/** Which lane owes each door that does not exist yet (BUILD-BOOK \"Packages\"). */\nconst OWED_BY: Record<string, string> = {\n metadata_search: \"W5-SRV / W5-AGENT — the agent surface's eight verbs\",\n record_aggregate: \"W5-SRV / W5-AGENT — `record_aggregate` is one of the eight verbs\",\n field_propose: \"W5-AGENT — AGT-4/AGT-8, the proposal and its approvers\",\n table_propose: \"W5-AGENT — AGT-8, the proposal and its approvers\",\n merge_field_resolve: \"W5-MERGE-B — the resolver's server half\",\n record_query: \"W1-INDEX / W5-SRV — the promoted-field query path\",\n // Lane GRID-PRIMITIVES (2026-09-22): on the rehearsal branch; they reach the main database at\n // the chair's 01:00–04:00 PT apply, and `pnpm records:generate` then lists them in\n // STORE_DOORS. Until then each call answers door_absent naming this line — never a guess.\n table_decorate: \"GRID-PRIMITIVES G1 — gridprim_a_table_wears_its_colors_and_its_layout.sql (chair's production apply)\",\n table_decorations: \"GRID-PRIMITIVES G1 — gridprim_a_table_wears_its_colors_and_its_layout.sql (chair's production apply)\",\n grid_layout: \"GRID-PRIMITIVES G1 — gridprim_a_table_wears_its_colors_and_its_layout.sql (chair's production apply)\",\n formula_parse: \"GRID-PRIMITIVES G3 — gridprim_a_formula_is_typed_and_the_store_works_it_out.sql (chair's production apply)\",\n action_declare: \"GRID-PRIMITIVES G2 — gridprim_a_row_action_runs_the_whole_selection_at_once.sql (chair's production apply)\",\n row_actions: \"GRID-PRIMITIVES G2 — gridprim_a_row_action_runs_the_whole_selection_at_once.sql (chair's production apply)\",\n action_run: \"GRID-PRIMITIVES G2 — gridprim_a_row_action_runs_the_whole_selection_at_once.sql (chair's production apply)\",\n table_webhook_declare: \"GRID-PRIMITIVES G4 — gridprim_every_row_change_reaches_the_webhook.sql (chair's production apply)\",\n table_webhooks: \"GRID-PRIMITIVES G4 — gridprim_every_row_change_reaches_the_webhook.sql (chair's production apply)\",\n table_webhook_archive: \"GRID-PRIMITIVES G4 — gridprim_every_row_change_reaches_the_webhook.sql (chair's production apply)\",\n table_from_example: \"GRID-PRIMITIVES G5 — gridprim_a_table_can_start_from_a_real_example.sql (chair's production apply)\",\n autonumber_backfill: \"GRID-PRIMITIVES G5 — gridprim_a_table_can_start_from_a_real_example.sql (chair's production apply)\",\n rule_declare:\n \"W1-RULE — `custom.record_write` writes `data_class = 'record'`, so the ONE write door cannot \" +\n \"make a Rule record; declaring a Rule (and therefore a DOOR-18 subscription) needs a door of its own\",\n};\n\n/**\n * THE TRUST DOORS, AND WHY THEY ARE A SEPARATE TABLE.\n *\n * `iam.is_external_principal`, the publish binding and the world lane are NOT\n * the record store's. They are the platform's answer to \"who is this person to\n * us?\" and \"does this thing have a public address?\", and W2-TRUST owns them.\n * They live in schema `iam`, so `pnpm records:generate` — which reads `custom`\n * and only `custom` — does not and should not see them.\n *\n * They are therefore named here by hand, once, with the schema they belong to\n * said out loud. A client that pretended they were store doors would be lying\n * about which system answered it: when the world lane is closed, the sentence a\n * person reads is `iam`'s, not the store's.\n */\nexport const TRUST_SCHEMA = \"iam\";\n\nexport const TRUST_DOORS = {\n /** VIS-31. A signed-in outsider: an account with no NON-personal organization. */\n isExternalPrincipal: \"is_external_principal\",\n /** The same answer with the plain-English reason attached. */\n externalPrincipalCard: \"external_principal_card\",\n /** EXACTLY the resources Visibility gave that outsider — never \"their organization's\". */\n externalPrincipalReach: \"external_principal_reach\",\n /** VIS-32. A record or a view bound to a public address with a declared render mode. */\n publishBindingCreate: \"publish_binding_create\",\n publishBindingRevoke: \"publish_binding_revoke\",\n /** What a SIGNED-OUT visitor resolves. Returns nothing for an invented or revoked address. */\n resolvePublishBinding: \"resolve_publish_binding\",\n /** D-15. The one sentence that admits nothing was scanned — one function, so it cannot drift. */\n worldPublishGapNotice: \"world_publish_gap_notice\",\n publishToWorld: \"publish_to_world\",\n worldPublishAdmit: \"world_publish_admit\",\n claimWorldNamespace: \"claim_world_namespace\",\n} as const;\n\nexport type TrustDoorKey = keyof typeof TRUST_DOORS;\n\n/**\n * THE OLDER STORE'S DOORS, AND WHY THEY ARE A THIRD TABLE.\n *\n * Most people's data does not live in `custom.record` yet. It lives in the\n * OLDER user-data tables — `workbench.udt_*`, one jsonb document per row — and\n * 14 of the 16 organizations holding any of it have ZERO tables in the unified\n * store. A relation column there resolves through a door of that store's own,\n * `workbench.udt_row_words_many` (lane OLD-TABLES-2, 2026-09-22), because\n * `custom._words_for` sits behind thirteen live screens and a second store's\n * ladder does not belong inside it.\n *\n * They are named here BY HAND, with their schema said out loud, for exactly the\n * reason `TRUST_DOORS` is: `pnpm records:generate` reads `custom` and only\n * `custom`, so the generated catalogue says nothing true about `workbench` and\n * a client that pretended these were store doors would be lying about which\n * system answered it.\n */\nexport const WORKBENCH_SCHEMA = \"workbench\";\n\nexport const WORKBENCH_DOORS = {\n /**\n * What a page of the OLDER store's relation cells reads, in one round trip.\n * Same answer shape as `custom.relation_words_many`, same withheld sentence,\n * and the ladder is asked per record inside it — so batching buys a round\n * trip and never a disclosure. An id that names nothing comes back as\n * NOTHING rather than as the withheld sentence, which is what makes an\n * unresolvable cell distinguishable from a refused one in that store.\n */\n udtRowWordsMany: \"udt_row_words_many\",\n} as const;\n\nexport type WorkbenchDoorKey = keyof typeof WORKBENCH_DOORS;\n\nconst DOOR_NAMES = new Set<string>(STORE_DOORS.map((d) => d.name));\n\nexport function doorExists(name: string): boolean {\n return DOOR_NAMES.has(name);\n}\n\n/** The refusal a missing door gets. It always says who owes it. */\nexport function doorAbsent(name: string): RecordsError {\n const owed = OWED_BY[name];\n return {\n code: \"door_absent\",\n message:\n `The record store has no door \\`custom.${name}\\` yet, so this call was not made. ` +\n `Nothing was read and nothing was written.`,\n hint: owed\n ? `That door is ${owed}. Until it lands, this call refuses rather than guessing: ` +\n `an empty answer here would read like \"there is nothing\", which is a different sentence.`\n : `No lane in the build book claims this door. Either the name is wrong, or the door was ` +\n `removed from the store and this package has not been regenerated — run \\`pnpm records:generate\\`.`,\n };\n}\n\n/** The doors this package calls, one place, so the suite can walk them. */\nexport const DOORS = {\n // THE READ DOOR (DOOR-1). Every read of a record's values goes through these\n // two and nothing else: they resolve the reader from the session, ask\n // visibility once per set, and mask the fields this reader may not see with a\n // notice under `_hidden`. Selecting `custom.record` directly is the thing\n // they exist to replace — it returns rows and fields the store never agreed\n // this person could see.\n readRecord: \"read_record\",\n readRecords: \"read_records\",\n // THE SAME READ DOOR, ADDRESSED BY AN ID SET. A realtime notice names the exact ids that\n // moved; before this existed the only door that took them was the PAGE door, so a\n // three-cell change re-read fifty rows in every watching browser. It is a separate NAME\n // rather than a sixth argument to `read_records` because adding a defaulted argument to a\n // live Postgres function makes every existing call ambiguous — `is not unique`. Same\n // ladder, same level, same masking, same page ceiling.\n readRecordsByIds: \"read_records_by_ids\",\n // THE SAME READ DOOR, ADDRESSED BY A QUESTION. `custom.read_records_matching`\n // takes the store's one filter shape (`RecordFilter` — the object\n // `platform.saved_view` carries as `filters` and `custom.record_aggregate`\n // takes as `p_filter`) and narrows the page INSIDE its own query, in the same\n // WHERE as Visibility. A separate NAME for the same reason as above. It is\n // what makes a number on a dashboard walkable: the filter is evaluated by\n // `custom.record_filter_sql`, the one body `custom.agg_sql` also calls, so the\n // rows it opens are the rows the number counted.\n readRecordsMatching: \"read_records_matching\",\n // THE SAME READ DOOR, ADDRESSED BY ABSENCE. Every door above answers LIVE rows\n // only — each of them hard-codes `and r.deleted_at is null` — so until this one\n // existed no screen could list an archived record however it was written, and\n // `record_restore` below had nothing that could reach it (VERIFIER-10 F4).\n // `custom.read_records_archived` is that body with the sign of one comparison\n // flipped, plus the two facts only an archive needs: who archived it and when.\n // A separate NAME for the same reason as its two siblings above.\n readRecordsArchived: \"read_records_archived\",\n // DOOR-8, the two clocks. `p_recorded_at` is what the store SAID then;\n // `p_world_on` is what was TRUE of the world on that date, read out of dated\n // values. A client that answered either one itself would be guessing.\n queryRecordAsOf: \"query_record_as_of\",\n queryTableAsOf: \"query_table_as_of\",\n recordWrite: \"record_write\",\n recordWriteMany: \"record_write_many\",\n // A PARENT, THE EDGES IT STANDS ON AND THE ROWS THAT BELONG TO IT — ALL OR NOTHING.\n // `recordWrite` and `recordWriteMany` are each ONE statement, so a caller that needs a\n // parent, its provenance edge and its child rows to land together had no door at all: a\n // loop is N transactions, and a failure on child nineteen leaves a parent standing without\n // the lines it promised. `custom.record_write_graph` is one statement, so it is one\n // transaction — and it is not a second write path: it CALLS `custom.record_write_many` for\n // the rows, `public.assoc_add` for an edge that points out of the store, and\n // `platform.relation_set` for the parent's own declared relation to its children. Every\n // guard, every trigger and the same editor rung, once. A refusal anywhere refuses the whole\n // graph, by name, and nothing is written.\n recordWriteGraph: \"record_write_graph\",\n recordUpdate: \"record_update\",\n recordDelete: \"record_delete\",\n recordRestore: \"record_restore\",\n recordValues: \"record_values\",\n recordValuesVersioned: \"record_values_versioned\",\n valueRead: \"value_read\",\n computedProvenance: \"computed_provenance\",\n recordApplicability: \"record_applicability\",\n applicableFields: \"applicable_fields\",\n fieldOptions: \"field_options\",\n parityValues: \"parity_values\",\n tableDeclare: \"table_declare\",\n // GETTING RID OF A TABLE — which is a JOB, NOT A STATEMENT (VERIFIER-11 F3).\n // `record_delete` above is the store's one soft-delete door and it is right\n // for a record; aimed at a TABLE it recurses through everything the Table\n // contains inside one transaction, and that is unbounded by construction. A\n // person pressing \"Delete this table\" on 1,430 records the product itself\n // had just imported waited twelve seconds and was told `57014`, \"canceling\n // statement due to statement timeout … Nothing was changed. Try a smaller\n // page\" — advice that means nothing when what you are doing is getting rid\n // of a table. `custom.table_archive` does the same work in passes and\n // answers each one with numbers, so a screen shows a sentence and a count\n // instead of a spinner and an SQLSTATE. It is STATELESS, so a run cut in\n // half resumes exactly where it stopped: there is no job row to lose.\n tableArchive: \"table_archive\",\n // ADDING A COLUMN — the first thing anybody does with a table, and until\n // 2026-09-19 there was no door for it. A Field is a record (REC-25), so a\n // screen wrote one with `record_write`; that door writes ONE row with\n // `data_class = 'record'` and cannot also add the key to the Table record's\n // `fields` array, which the field guard requires before it accepts any\n // definition at all. So every \"Add field\" ended on \"the table does not\n // declare a field called … — declare it there first\". These three doors take\n // what a person knows — a field type, a name, and for a choice list the\n // choices themselves — and the STORE turns that into the document its own\n // guards demand, so every client inherits one answer instead of each one\n // re-deriving thirteen and getting them wrong.\n fieldDeclare: \"field_declare\",\n fieldUpdate: \"field_update\",\n fieldRetire: \"field_retire\",\n // CUSTOM FIELDS ON A STANDARD BUSINESS TABLE. Every door above is keyed by a\n // custom Table's uuid, and a standard table has no Table record - so until\n // 2026-09-20 `custom.applicable_fields(org, 'party', null)` answered `22P02\n // invalid input syntax for uuid` and there was no other way in. These are\n // keyed by the REGISTRY TOKEN instead, and they are one set for all 643\n // tables the registry types Entity or Detail. The three value doors are\n // SECURITY INVOKER in the database on purpose: the standard table's own\n // row-level security is what decides who may read and write its rows, and a\n // definer wrapper would replace it with a second access system.\n entityTable: \"entity_table\",\n entityFields: \"entity_fields\",\n entityFieldDeclare: \"entity_field_declare\",\n entityFieldUpdate: \"entity_field_update\",\n entityFieldRetire: \"entity_field_retire\",\n entityFieldRights: \"entity_field_rights\",\n entityRecordRead: \"entity_record_read\",\n entityValueWrite: \"entity_value_write\",\n entityRecordsFind: \"entity_records_find\",\n tableCapacity: \"table_capacity\",\n tableStorage: \"table_storage\",\n promoteTable: \"promote_table\",\n promoteField: \"promote_field\",\n promotedFields: \"promoted_fields\",\n promotedRead: \"promoted_read\",\n relationTargets: \"relation_targets\",\n relationOwn: \"relation_own\",\n // REL-DISP, 2026-09-21. WHAT A RELATION CELL READS, through that column's own\n // display spec. `custom.record_words` is declared server_only — it takes a bare\n // record id with no field to scope it — so these are how a screen gets the\n // words, and they are the ONE way in: three separate copies of \"read tableList,\n // find title_field, call rowName\" lived in labels.tsx, RelationPicker.tsx and\n // PortalsPanel.tsx, and none of them could ever have shown two columns joined.\n // The `_many` door is the batch TAILS-2 recorded as missing (\"there is still no\n // batch door on the store\"), which is why the browser resolved labels one id at\n // a time. The ladder is NOT batched: the store asks it per record inside\n // `custom._words_for`, so batching buys a round trip and never a disclosure.\n relationWords: \"relation_words\",\n relationWordsMany: \"relation_words_many\",\n homeAdd: \"home_add\",\n recordReparent: \"record_reparent\",\n containmentChain: \"containment_chain\",\n storeIsOpen: \"store_is_open\",\n // DOOR-1, from the screen's side. What level the CALLER holds on the subjects\n // they name — the one question a screen has to answer BEFORE it draws a\n // control, and the only one the store had no client answer to.\n myLevels: \"my_levels\",\n // DOOR-11. The record's own revision list. A screen that offers an optimistic\n // save needs the version it LOADED, and the read door answers documents, not\n // versions — so the version comes from here, once, for the one record being\n // edited, and never for a whole list.\n ioRevisions: \"io_revisions\",\n resolveFirstMatch: \"resolve_first_match\",\n // The kernels a package-owned Table needs to exist at all: a Home is a record\n // in the person kernel, a Field is a record in the field kernel (REC-1).\n personKernelId: \"person_kernel_id\",\n fieldKernelId: \"field_kernel_id\",\n ruleKernelId: \"rule_kernel_id\",\n // And the Table kernel, which is how `tableList` asks the READ DOOR for this\n // organization's Tables: a Table is a record like any other, so listing them\n // is `read_records(org, table_kernel_id())` and never a select on a table.\n tableKernelId: \"table_kernel_id\",\n // A saved view references its membership Rule, and the STORE decides who is\n // in it — the screen never re-implements the predicate.\n pipelineDeclare: \"pipeline_declare\",\n pipelineRead: \"pipeline_read\",\n pipelineBoard: \"pipeline_board\",\n pipelineTransitionRefusal: \"pipeline_transition_refusal\",\n pipelineMove: \"pipeline_move\",\n tableStageField: \"table_stage_field\",\n // STAGE-RULES. A gate can refuse or it can hand the change to the approvals queue; the\n // closed list is the store's, the knob is the organization's, and what is WAITING on a\n // card has to be askable or a card that did not move looks like a card nobody dragged.\n stageRuleOnFailKinds: \"stage_rule_on_fail_kinds\",\n stageRuleEnforcement: \"stage_rule_enforcement\",\n recordStagePending: \"record_stage_pending\",\n pipelinePending: \"pipeline_pending\",\n pipelineGatePreview: \"pipeline_gate_preview\",\n ruleMembers: \"rule_members\",\n ruleMembership: \"rule_membership\",\n ruleRun: \"rule_run\",\n ruleEval: \"rule_eval\",\n // REC-15: the door that makes a Rule a RULE. `custom.record_write` into the\n // Rule kernel produces a valid Rule document carrying `data_class = 'record'`,\n // and every reader that goes LOOKING for a Rule looks for the class — so a\n // subscription written that way was invisible to DOOR-18 and nothing fired.\n // PRODUCTS row 1 — a form is a view on a real Table. `forms` lists an\n // organization's own, `formDeclare` writes one, and `anonPublish` is the one\n // act that opens it to people with no account. The PUBLIC pair\n // (`custom.form_public`, `custom.form_submit`) is deliberately absent: those\n // are server-lane doors and a browser never calls them.\n forms: \"forms\",\n formDeclare: \"form_declare\",\n // PRODUCTS row 14 — \"let clients book a 30-minute consult\". A booking page IS an\n // `anon_form`, so it is opened and closed by `anonPublish` like any other; this is\n // the owner's list of them with the numbers that make it worth opening. The\n // VISITOR's three (`booking_public`, `booking_hold`, `booking_confirm`) are\n // deliberately absent: they are server-lane and a browser never calls them.\n bookings: \"bookings\",\n // The OWNER's side of a booking page, and the door that had no client method at\n // all until 2026-09-21: without it the only way to get a booking page was to ask\n // an agent, which made the agent the ONLY path rather than the faster one.\n bookingDeclare: \"booking_declare\",\n // PRODUCTS row 9 — \"pull my spreadsheet in\". W4-IO built `io_import_open` and\n // `io_import_rows`; lane IMPORT gave a run an IDENTITY (the file's sha-256, so\n // a re-import doubles nothing), a duplicate key, a policy, per-row outcomes\n // with the source row on them, and the type inference that reads THIS\n // organization — an address that belongs to a member is a person, a few\n // repeating words are a dropdown, a column of names that are all records of\n // another Table points at it. `importOpen` (the older, narrower way in) is\n // deliberately absent from this catalogue: `importBegin` is a superset and two\n // ways to start an import from one client is how they drift.\n importPlan: \"io_import_plan\",\n importBegin: \"io_import_begin\",\n importDeclareColumns: \"io_import_declare_columns\",\n importRows: \"io_import_rows\",\n importFinish: \"io_import_finish\",\n importReport: \"io_import_report\",\n imports: \"io_imports\",\n importForget: \"io_import_forget\",\n inferColumn: \"io_infer_column\",\n // DOOR-19 (P8) — the address a Table owns. `inboundMailLand` is deliberately\n // absent: it is the mail gateway's door, granted to `service_role` alone and\n // declared `non_client_lane`, and a browser that could land mail at an\n // arbitrary address would be writing into any table of any organization.\n inboundDeclare: \"inbound_declare\",\n inboundAddresses: \"inbound_addresses\",\n inboundSet: \"inbound_set\",\n // THE CLIENT PORTAL, OWNER'S SIDE (VIS-31 / PORTAL). A portal is how somebody\n // with NO membership is let in to see the records that name them. `portals`\n // lists them, `portalCard` opens one, `portalDeclare` states what it exposes,\n // `portalInvite` and `portalRevoke` are the two acts on a person, and\n // `portalPreview` is \"view as this client\" — it asks `custom.visible_set` for\n // HER user id, the same call `custom.read_records` makes when she opens the\n // page, so the preview cannot disagree with what she sees. The CLIENT-side\n // pair (`custom.portal_public`, `custom.portal_invitation`, `custom.portal_me`)\n // is deliberately absent here: those belong to the outsider's own shell.\n portals: \"portals\",\n // WHICH TABLES EACH PORTAL SHOWS (TAILS-3). The Portals RAIL lives on a\n // Table's page beside Forms, Bookings and Dashboards, all of which are\n // table-scoped; `custom.portals` takes no table, so an organization with one\n // portal over Jobs saw that portal's cards on its Parts table, the empty\n // state never rendered, and the whole build/ask offer was unreachable\n // everywhere in that organization. This is the one question the rail has to\n // ask, under the same wall and visibility gate as `portals` itself.\n portalTables: \"portal_tables\",\n portalCard: \"portal_card\",\n portalDeclare: \"portal_declare\",\n portalInvite: \"portal_invite\",\n portalRevoke: \"portal_revoke\",\n portalPreview: \"portal_preview\",\n // ORG-CLEANUP, 2026-09-22 — A PORTAL IS ARCHIVED, NEVER DELETED.\n // `portals` keeps its signature and HIDES archived portals (the law's default\n // is to hide); `list_portals(org, 'active'|'archived'|'all')` is the\n // archive-aware reader, taking the platform archive filter's own three values\n // so one door serves both lanes and no screen has to invent a second control.\n // `portal_archive` / `portal_restore` are the way out and the way back; both\n // take the portal's own title typed back, because ten portals can carry one\n // title and the title alone is not what picks this one.\n listPortals: \"list_portals\",\n portalArchive: \"portal_archive\",\n portalRestore: \"portal_restore\",\n // SCR-16 — the canvas. A dashboard is a record in the presentation kernel\n // whose blocks are saved SPECS for the eighth verb; `dashboardRun` walks them\n // under the CALLER'S principal, so nothing here is precomputed and nothing is\n // summed in a browser. `dashboardStuck` is the seventh block kind on its own,\n // because \"what has not moved in fourteen days\" is a question a screen asks\n // outside a canvas too.\n dashboards: \"dashboards\",\n dashboardDeclare: \"dashboard_declare\",\n dashboardRun: \"dashboard_run\",\n dashboardStuck: \"dashboard_stuck\",\n dashboardDelete: \"dashboard_delete\",\n // PRODUCTS row 10 — \"fill in each company's industry and headcount, and keep\n // it fresh\". An Enrichment is not an object of its own: it is a Field saying\n // `source = agent`, with its instruction, inputs, model, confidence floor and\n // freshness in `source_config` (AGT-6). `enrichCells` is the one a GRID calls —\n // the badge data for a whole page in one round trip, because a badge asked per\n // cell is fifty round trips to draw fifty badges. `enrichPin` is the half of\n // this product that decides whether anybody ever trusts it: the moment a\n // person types over an agent-owned cell the store pins it, and the next run\n // leaves it exactly as they left it.\n // PRODUCTS row 15 — \"let my crew photograph each bin and log the weight on\n // site\". A capture sheet is the ONE Form object saying `audience = 'crew'`,\n // opened by `capture_opened_at`; these five are SIGNED-IN doors granted to\n // `authenticated`, unlike the public form's two, because a crew member has an\n // account and their own level on the Table is the whole access decision.\n captureSheetDeclare: \"capture_sheet_declare\",\n capturePublish: \"capture_publish\",\n captureSheets: \"capture_sheets\",\n captureOpen: \"capture_open\",\n captureSubmit: \"capture_submit\",\n enrichments: \"enrichments\",\n enrichDeclare: \"enrich_declare\",\n enrichDue: \"enrich_due\",\n enrichCells: \"enrich_cells\",\n enrichLand: \"enrich_land\",\n enrichPin: \"enrich_pin\",\n enrichRuns: \"enrich_runs\",\n // PRODUCTS row 4 — \"Who changed this price, and can I put it back?\" The\n // history has been in the store since W3-HIST; until 2026-09-20 the only way\n // to ask for it was `io_revisions`, which answers a raw uuid for the author\n // and a list of KEYS for what moved. `recordHistory` answers the person (or\n // the agent AND the person it acted for), the operation in the word somebody\n // used, and every field with its before, its after, the Rule version that\n // produced it and its source. `fieldHistory` is the other half nobody ships:\n // one column's history across the whole Table.\n recordHistory: \"record_history\",\n fieldHistory: \"field_history\",\n // THE PUT-IT-BACK THREE. `restorePreview` names what will change BEFORE it\n // does; `restoreVersion` puts the whole record back and `valueRestore` puts\n // one column back (HIS-N-2). All three write a NEW version through the\n // record's own write path — no stored version is ever altered.\n restorePreview: \"record_restore_preview\",\n restoreVersion: \"record_restore_version\",\n valueRestore: \"value_restore\",\n // SCR-18. The store has had comment doors at the `commenter` rung all along;\n // these two add the people's NAMES and a mention that reaches somebody.\n // AGT-N-9 / PRODUCTS row 11 — \"What's the history with this customer?\" A\n // conversation can be ABOUT one record, and `recordScopeContext` is the ONE\n // door that answers everything such a chat is allowed to know in a single\n // round trip: the Fields with their (record, field, value version) triples,\n // the relations one hop out, the history, the comments and the Table's other\n // records — every piece assembled INSIDE the database through the read door\n // under this person's own field-level security. A Field the store masks is\n // named as withheld with the store's reason and never valued.\n recordScopeContext: \"record_scope_context\",\n conversationScope: \"conversation_scope\",\n conversationScopeBind: \"conversation_scope_bind\",\n conversationScopeUnbind: \"conversation_scope_unbind\",\n conversationScopeContext: \"conversation_scope_context\",\n commentThread: \"comment_thread\",\n commentWrite: \"comment_write\",\n commentResolve: \"io_comment_resolve\",\n // The eighth verb (AGT-N-8): a grouped, bucketed, filtered count/sum/avg/\n // min/max computed INSIDE the read door's own query, so a chart shows exactly\n // the rows this person may see and never fetches the ones they may not.\n recordAggregate: \"record_aggregate\",\n aggOperations: \"agg_operations\",\n aggBuckets: \"agg_buckets\",\n // DOOR-18: a subscription is a Rule record carrying a `subscription` block\n // over a saved view. There is no subscription TABLE and no second notifier.\n aggSubscriptions: \"agg_subscriptions\",\n aggSubscriptionCadences: \"agg_subscription_cadences\",\n // The OWNER's side of DOOR-18. `agg_subscriptions` is the notifier's reader\n // and is not client-callable; these two are what a person reaches: what am I\n // being told about, and switch this one off. A form's notify Rule is one of\n // these rows, so \"tell me when a patient arrives\" can also be un-told.\n subscriptions: \"subscriptions\",\n subscriptionMute: \"subscription_mute\",\n // The two DOOR-18 acts that had no door at all until 2026-09-20: WRITE a\n // subscription (a Rule is declared, never written as a record — REC-72) and SEE\n // the summary it would send right now without sending it.\n subscriptionDeclare: \"subscription_declare\",\n subscriptionPreview: \"subscription_preview\",\n // A SUBSCRIPTION IS OVER A SAVED VIEW, so a person who has never saved one has\n // nothing to subscribe to. These two are the saved-view pair (lane DIGESTS'\n // `digests_a_saved_view_has_a_door.sql`), unreachable from this client until\n // 2026-09-21: `views` lists this Table's, `viewDeclare` writes one. A LIST IS A\n // DOOR, never a grant on `platform.saved_view` behind it.\n views: \"views\",\n viewDeclare: \"view_declare\",\n // The cadence CATALOGUE a person's screen may ask for. `agg_subscription_cadences`\n // above is the notifier's own and holds no client grant; this door delegates to\n // it, so a picker and the digest runner can never offer different words.\n subscriptionCadences: \"subscription_cadences\",\n // The doc doors: a template is saved, a render is written once and frozen,\n // and a signature is checked against the exact bytes that were signed.\n docTemplateSave: \"doc_template_save\",\n docRenderBody: \"doc_render_body\",\n docRenderDocument: \"doc_render_document\",\n docTokens: \"doc_tokens\",\n docUnresolvedTokens: \"doc_unresolved_tokens\",\n docSign: \"doc_sign\",\n // THE SEAL IS ASKED THROUGH ITS OWN DOOR. `custom.doc_signature_intact` is the INTERNAL\n // half of this pair — SECURITY INVOKER over a doors-only table, so a browser that calls it\n // gets `42501 permission denied for table doc_signature`, which is what every SignBlock\n // seal check got until 2026-09-22 (FIX-10B). `custom.doc_signature_read` is the definer\n // door built for a client: it asks may_reach and may_open on the RECORD by name and\n // returns the seal AND the verdict in one answer, because a seal a person can read and a\n // verdict they cannot is how a changed agreement keeps wearing somebody's signature.\n docSignatureRead: \"doc_signature_read\",\n // THE PLURAL ACTS. Until 2026-09-20 this package read `custom.doc_template`,\n // `custom.doc_render` and `custom.doc_signature` with a direct PostgREST\n // `.from()`, and all three hold NO client SELECT — so every list in product #5\n // opened on \"permission denied for view doc_template\". A list is a DOOR, never\n // a grant on the thing behind it (DOORS-TWO).\n docTemplates: \"doc_templates\",\n docTemplateDelete: \"doc_template_delete\",\n docRenders: \"doc_renders\",\n docSignatures: \"doc_signatures\",\n // THE ANONYMOUS LANE (W4-ANON). It landed, and it landed as SEVEN doors\n // rather than the one this package had guessed at: a token is issued and\n // verified separately from the write it authorises, a form is published\n // separately from being declared, and an offline capture by a SIGNED-IN\n // person is a different door from a write by a stranger.\n //\n // This package used to name a door `anon_record_write`, which never existed —\n // so `FormRunner` told every person that the public link was \"pending\" for a\n // lane that had already shipped. A screen calling a live feature pending is\n // the same silent failure as a screen calling a missing one live, and the fix\n // is to name the doors the store actually has.\n anonTokenIssue: \"anon_token_issue\",\n anonTokenVerify: \"anon_token_verify\",\n anonTokenRevoke: \"anon_token_revoke\",\n /** The stranger's write. The TOKEN names the organization; a caller never does. */\n anonWrite: \"anon_write\",\n /** SCR-30. The signed-in OFFLINE path: the client mints the key, the store dedupes on it. */\n anonCapture: \"anon_capture\",\n anonPublish: \"anon_publish\",\n\n // WORK (W4-WORK): a template instantiated as real records, whose turn it is,\n // and a slot somebody is holding. `ChecklistRunner` and `BookingSlots` are\n // screens over these and hold no state of their own.\n workStates: \"work_states\",\n workTemplateDeclare: \"work_template_declare\",\n workTemplateInstantiate: \"work_template_instantiate\",\n workTemplateShape: \"work_template_shape\",\n /** Why a graph would be refused — asked BEFORE it is written, never after. */\n workTemplateRefusal: \"work_template_refusal\",\n workWhoseTurn: \"work_whose_turn\",\n workTakeAssignment: \"work_take_assignment\",\n workHasAssignment: \"work_has_assignment\",\n workAssignmentFields: \"work_assignment_fields\",\n workTransitionRefusal: \"work_transition_refusal\",\n workInstantiationShape: \"work_instantiation_shape\",\n workSlotsDeclare: \"work_slots_declare\",\n workSlotHold: \"work_slot_hold\",\n workSlotRelease: \"work_slot_release\",\n workSlotHolds: \"work_slot_holds\",\n workSlotExpire: \"work_slot_expire\",\n\n // THE WORK LAYER'S OWN DOORS (lane WORK-DOORS, 2026-09-20). Until this lane\n // all nineteen `custom.work_*` functions were SECURITY INVOKER with no client\n // grant: REC-69, REC-70 and REC-71 were live in the store and unreachable\n // from a browser. These are the verbs a person actually uses.\n workPerson: \"work_person\",\n workAssign: \"work_assign\",\n workRecordStates: \"work_record_states\",\n workSetState: \"work_set_state\",\n workList: \"work_list\",\n workTemplates: \"work_templates\",\n /** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */\n workInbox: \"work_inbox\",\n workApprovalApprovers: \"work_approval_approvers\",\n workApprovalRequest: \"work_approval_request\",\n workApprovalMayDecide: \"work_approval_may_decide\",\n workApprovalDecide: \"work_approval_decide\",\n workApprovalRead: \"work_approval_read\",\n\n // PRODUCTS row 13 — checklists and SOP runs.\n checklistRefusal: \"checklist_refusal\",\n checklistDeclare: \"checklist_declare\",\n checklistTemplates: \"checklist_templates\",\n checklistTemplateShape: \"checklist_template_shape\",\n checklistStart: \"checklist_start\",\n checklistRun: \"checklist_run\",\n checklistRuns: \"checklist_runs\",\n checklistStepComplete: \"checklist_step_complete\",\n checklistStepRefusal: \"checklist_step_refusal\",\n\n // THE GRID (lane GRID-PRIMITIVES, 2026-09-22) — what the /data grid rebuild calls. See ../grid.ts.\n tableDecorate: \"table_decorate\",\n tableDecorations: \"table_decorations\",\n gridLayout: \"grid_layout\",\n formulaParse: \"formula_parse\",\n actionDeclare: \"action_declare\",\n rowActions: \"row_actions\",\n actionRun: \"action_run\",\n tableWebhookDeclare: \"table_webhook_declare\",\n tableWebhooks: \"table_webhooks\",\n tableWebhookArchive: \"table_webhook_archive\",\n tableFromExample: \"table_from_example\",\n autonumberBackfill: \"autonumber_backfill\",\n ioExport: \"io_export\",\n\n // Declared here BECAUSE they do not exist yet: naming them is what makes the\n // absence visible to `pnpm check:store-registry` and to the suite.\n metadataSearch: \"metadata_search\",\n ruleDeclare: \"rule_declare\",\n fieldPropose: \"field_propose\",\n tablePropose: \"table_propose\",\n mergeFieldResolve: \"merge_field_resolve\",\n} as const;\n\nexport type DoorKey = keyof typeof DOORS;\n\n/** Which of this package's doors the live store actually has, and which it does not. */\nexport function doorCensus(): { present: string[]; absent: string[] } {\n const present: string[] = [];\n const absent: string[] = [];\n for (const name of Object.values(DOORS)) {\n (doorExists(name) ? present : absent).push(name);\n }\n return { present: present.sort(), absent: absent.sort() };\n}\n","// src/core/pgError.ts — @ai-matrx/records\n//\n// THE ONE FUNNEL from what the database said to what a caller reads. Every\n// method in this package's client goes through it, and it does exactly three\n// things: it classifies the SQLSTATE, it carries the store's message and hint\n// VERBATIM, and it parses the DETAIL when the store put json there.\n//\n// It never writes a sentence of its own about a refusal the store already\n// explained. The store's messages were written to be read by the person who hit\n// them — \"Someone else changed this record while you were working on it\" is the\n// screen's text, not a code the screen has to translate.\n\nimport type { PgError, RecordsError, RecordsErrorCode, StaleWriteDetail } from \"../results\";\n\n/**\n * SQLSTATE -> code. Every entry here answers one of the codes\n * `STORE_REFUSAL_CODES` reports the store raising; the real-door suite asserts\n * that this map covers all of them, so a new refusal class in the store shows\n * up as a red test rather than an `internal` in somebody's console.\n */\nconst BY_SQLSTATE: Record<string, RecordsErrorCode> = {\n PT409: \"stale_write\",\n \"42501\": \"door\",\n \"23514\": \"refused_by_rule\",\n \"22004\": \"invalid_argument\",\n \"22023\": \"invalid_argument\",\n // 22P02 — a value does not fit the type the store holds for it. The class is\n // real and was hit live: an organization whose copy of a package table grew\n // `status` as a uuid-valued Field was sent the text \"open\", and the store\n // answered `invalid input syntax for type uuid: \"open\"`. It is the CALL that\n // is wrong for the shape the store holds, which is what `invalid_argument`\n // already means — the store's own sentence names the value and the type.\n \"22P02\": \"invalid_argument\",\n // 42703 — a column that is not there. The store raises it from\n // `custom.entity_table`, which is asked for a column by NAME, so the class is\n // exactly \"the call named something the shape does not have\": the same thing\n // `invalid_argument` already means, and the store's own sentence names the\n // column. Added 2026-09-20 (lane FORMS) because the package's live-door suite\n // caught it raised by a door this package did not know about — which is the\n // suite working, and is why the map is a census rather than a guess.\n \"42703\": \"invalid_argument\",\n // 22007 — a date or a time the store could not read as one. It is raised by\n // `custom.dashboard_window_sql`, which is handed a window a caller wrote\n // (\"last 30 days\", a literal date), so the class is again \"the call named\n // something the shape does not accept\" and the store's own sentence names the\n // text it could not read. Added 2026-09-20 (lane SCREEN-BREAK) after the\n // live-door census caught it — the same way 42703 arrived, which is the\n // census working rather than a guess.\n \"22007\": \"invalid_argument\",\n // 22003 — a number the store could not hold at the size it was handed. It is\n // raised by `custom.context_resolve`, which is given a window or a depth a\n // caller wrote, so the class is the same one 22P02, 42703 and 22007 already\n // are: the CALL named a value the shape does not accept, and the store's own\n // sentence names the number and the range. Added 2026-09-20 (lane GRID-TWO)\n // when the live-door census caught the release gate red on it — which is the\n // census working, and the fourth time it has been the thing that found a new\n // refusal class rather than a person guessing one.\n \"22003\": \"invalid_argument\",\n \"02000\": \"not_found\",\n \"23503\": \"missing_reference\",\n \"23505\": \"already_exists\",\n \"0A000\": \"not_supported\",\n \"53400\": \"store_limit\",\n \"22012\": \"store_limit\",\n // 54001 — `custom.record_delete` stops a cascade that nests past sixty-four\n // levels of containment, because that is a loop somebody built rather than a\n // hierarchy, and saying so beats recursing until the server runs out of\n // stack. It is a LIMIT of the store, and the store's own sentence names what\n // to do about it, so it reads as one.\n \"54001\": \"store_limit\",\n // 54000 — the grid primitives' organization ceilings (GRID-PRIMITIVES, 2026-09-23):\n // `custom.action_run` on a selection past its knob, `custom.table_decorate` past the\n // rule count, `custom.table_from_example` past `custom/example_rows_max`,\n // `custom.table_webhook_declare` past `custom/table_webhooks_max`, and\n // `custom.hub_changed_by`. Each names its knob in the hint and writes nothing, so it\n // reads exactly like 54001: a limit of the store, in the store's own sentence.\n \"54000\": \"store_limit\",\n // VIS: `custom.has_visibility_at` refuses to answer from a snapshot older\n // than a write this reader has already seen, rather than returning something\n // they just lost access to. It is retryable on a fresher connection, which is\n // a different instruction from every other refusal here.\n \"40001\": \"stale_read\",\n // 57014 — the store cancelled the statement at its own timeout. Like\n // `stale_read` and unlike every other refusal here, the call was never\n // refused on its merits: the same call on a smaller page, or once the\n // organization's kernel is not being rewritten, can succeed. It gets its own\n // code so a screen can offer \"try again\" honestly instead of showing a\n // failure sentence the caller cannot act on.\n \"57014\": \"timed_out\",\n // PostgREST's own two: the store is not being SERVED, which is a different\n // thing from the store refusing. `custom` absent from `pgrst.db_schemas`, or\n // the grants not copied, land here.\n PGRST202: \"store_not_served\",\n PGRST205: \"store_not_served\",\n PGRST301: \"door\",\n // PT428 — NOT A FAILURE, and the release gate's live census is what found it\n // missing: the store raises it and this package answered `internal`, which is\n // the one classification that tells a screen nothing. A stage gate whose\n // `on_fail` is `require_approval` files the request and leaves the record\n // where it was; the transaction is rolled back to the pipeline's own block, so\n // \"nothing was written\" is a fact rather than a promise. Landed by lane\n // STAGE-RULES; mapped here by STAGE-RULES-2 the day after, when the census\n // caught it — the sixth time that census has been the thing that found a\n // refusal class rather than a person guessing one.\n PT428: \"needs_approval\",\n};\n\n/** The SQLSTATEs this package claims to understand. Exported for the guard. */\nexport const MAPPED_SQLSTATES = Object.keys(BY_SQLSTATE);\n\nfunction parseDetail(details: string | null | undefined): unknown {\n if (!details) return undefined;\n const trimmed = details.trim();\n if (!trimmed.startsWith(\"{\") && !trimmed.startsWith(\"[\")) return details;\n try {\n return JSON.parse(trimmed) as unknown;\n } catch {\n return details;\n }\n}\n\n/**\n * A CODE THAT IS NOT A SQLSTATE AT ALL — so it is not read as one.\n *\n * A SQLSTATE is five characters. supabase-js puts something else in `code` in\n * exactly two situations, and BOTH of them mean the call never reached the\n * store rather than the store refusing it:\n *\n * `\"\"` a `FetchError` — no network, a cancelled request, CORS.\n * `\"404\"`… an HTTP status, when the gateway answered with no JSON body.\n *\n * Lane TAILS-6 (2026-09-22) found both landing in `internal`, which is the one\n * classification that tells a screen nothing: a person on the Checklists tab of\n * a plumbing company's jobs table was shown \"Something went wrong at our end\"\n * with nothing to do about it, over a sentence naming this package. They are\n * `unreachable`, which a screen can honestly offer \"try again\" for.\n */\nfunction isNotASqlstate(code: string | undefined): boolean {\n if (!code) return true;\n return /^[0-9]{3}$/.test(code);\n}\n\n/** Map a PostgREST/supabase-js failure into the package's refusal shape. */\nexport function mapPgError(error: PgError, where: string): RecordsError {\n // `code: \"\"` is supabase-js's own value for a transport failure, and `\"\"` is\n // not nullish — so it has to be emptied deliberately or it becomes a SQLSTATE\n // nobody can look up.\n const raw = error.code ?? undefined;\n const sqlstate = raw && raw !== \"\" ? raw : undefined;\n const mapped: RecordsError = {\n code: \"internal\",\n message: error.message,\n ...(error.hint ? { hint: error.hint } : {}),\n ...(sqlstate ? { sqlstate } : {}),\n };\n if (isNotASqlstate(sqlstate)) {\n mapped.code = \"unreachable\";\n } else {\n mapped.code = BY_SQLSTATE[sqlstate!] ?? \"internal\";\n }\n const detail = parseDetail(error.details);\n if (detail !== undefined) mapped.detail = detail;\n if (mapped.code === \"internal\") {\n // 🚨 THE NOTE GOES IN ITS OWN FIELD, NEVER ONTO `hint` (lane TAILS-6).\n // `hint` is THE REMEDY — the sentence screens hand a person to act on — so\n // a note this package writes about ITSELF being surprised belonged nowhere\n // near it. It is still said out loud, so nobody reads the silence as\n // \"handled\"; it is said to whoever debugs this and to nobody else.\n mapped.unmapped = true;\n mapped.diagnostic =\n `@ai-matrx/records did not recognise SQLSTATE ${sqlstate ?? \"(none)\"} from ${where}; ` +\n `the store's own message is the thing to act on.`;\n } else if (mapped.code === \"unreachable\") {\n mapped.unmapped = true;\n mapped.diagnostic =\n `@ai-matrx/records never reached the store from ${where}: ` +\n `${raw ? `the transport answered ${raw}` : \"no response\"} — ${error.message}`;\n // 🚨 THE ONE PLACE THIS PACKAGE WRITES A MESSAGE OF ITS OWN, and it is the\n // one place where there is no store message to carry: the store never\n // answered. `TypeError: Failed to fetch` is the browser talking to itself,\n // not a sentence anybody should read, so it goes to the engineer's line\n // above and the person gets what actually happened.\n mapped.message = \"We could not reach your data.\";\n // Whatever the transport said was never a remedy either.\n delete mapped.hint;\n }\n return mapped;\n}\n\n/** Pull the conflict out of a `stale_write`, when the store sent one. */\nexport function staleWriteDetail(error: RecordsError): StaleWriteDetail | null {\n if (error.code !== \"stale_write\") return null;\n const detail = error.detail as Partial<StaleWriteDetail> | undefined;\n if (\n !detail ||\n typeof detail.expected_version !== \"number\" ||\n typeof detail.current_version !== \"number\"\n ) {\n return null;\n }\n return {\n expected_version: detail.expected_version,\n current_version: detail.current_version,\n contested_fields: detail.contested_fields ?? {},\n };\n}\n","// src/core/recordChanges.ts — @ai-matrx/records · lane RECORDS-UI-FIX (2026-09-23)\n//\n// EVERY SCREEN SHOWING A RECORD HEARS EVERY WRITE TO IT MADE THROUGH THIS PACKAGE.\n//\n// 🚨 WHAT A PERSON MET (VERIFIER-16 LOW, guide re-walk 2026-09-23): the record panel read\n// \"History 3 versions\" after its fourth write, while the store held four. The history\n// panel read the chain once, when it opened, and nothing told it the grid cell or the\n// form beside it had just written a new version. It is not the no-op-version class (the\n// store's history had the row; the screen never asked again) — it is a screen that\n// cannot hear the writes made on the same page.\n//\n// So every successful write door of the client announces the record it wrote, and any\n// screen showing that record re-reads on the announcement. Page-local and synchronous;\n// a write from another tab or person is realtime's job, not this one's.\n\ntype Listener = (recordId: string) => void;\n\nconst listeners = new Set<Listener>();\n\n/** Called by the client after a write door answered yes. */\nexport function announceRecordChanged(recordId: string): void {\n for (const listener of [...listeners]) {\n try {\n listener(recordId);\n } catch (thrown) {\n // A listener that throws must not take the write's answer with it.\n console.error(\"[@ai-matrx/records] a record-change listener threw\", thrown);\n }\n }\n}\n\n/** Hear every record this page writes. Returns the unsubscribe. */\nexport function onRecordChanged(listener: Listener): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n","// src/core/query.ts — @ai-matrx/records\n//\n// THE QUERY. DOOR-6 … DOOR-10.\n//\n// Query by any combination of relation coordinates and any subset of them; as-of\n// a date on EITHER clock; promoted-field predicates. DOOR-10 is the one that\n// shapes this module: every query is filtered by Visibility INSIDE the query,\n// never post-filtered — which is why nothing here ever reads rows and then drops\n// some. The filtering happens in the store's own policies and in the doors; this\n// builder only describes what to ask for.\n//\n// DOOR-N-3: every hot read runs as a PREPARED statement. A client cannot prepare\n// anything itself, so the builder never concatenates a value into SQL: relation\n// coordinates resolve through `custom.relation_targets`, promoted predicates\n// through `custom.promoted_read`, and both are functions with typed parameters —\n// which is what \"prepared\" means on this side of the wire.\n\nimport type { RelationCoordinate } from \"../relation\";\nimport type { Timestamp, Uuid } from \"../record\";\n\n/**\n * DOOR-8. As-of on EITHER clock, and they are different questions:\n * · `record` — the record clock: what this record looked like at version time.\n * · `world` — the world clock: which values were true of the world then\n * (the Field's `dated` modifier).\n */\nexport interface AsOf {\n clock: \"record\" | \"world\";\n at: Timestamp;\n}\n\n/** A predicate over a PROMOTED field (REC-5: promotion light -> heavy). */\nexport interface PromotedPredicate {\n field_key: string;\n /** The value as text, exactly as `custom.promoted_read` takes it. */\n equals: string;\n}\n\nexport interface RecordQuery {\n table_id: Uuid;\n /** DOOR-6. Any combination, any subset. An empty list means \"no relation constraint\". */\n relations?: RelationCoordinate[];\n /** Predicates the store can answer from an index. */\n promoted?: PromotedPredicate[];\n /** DOOR-8. */\n asOf?: AsOf;\n /** DOOR-9. Ask across EVERY Home of this Table in one answer. */\n acrossHomes?: boolean;\n /** REC-23. Soft-deleted rows are out unless you say otherwise. */\n includeDeleted?: boolean;\n /** FLD-10. */\n recordType?: string;\n orderBy?: { column: \"created_at\" | \"updated_at\"; ascending?: boolean };\n limit?: number;\n offset?: number;\n}\n\n/**\n * What a query decomposes into: a set of door calls whose answers INTERSECT,\n * then one filtered read. Kept as data rather than hidden inside the client so\n * the suite can assert the plan as well as the answer — a query that quietly\n * stopped applying one of its coordinates is otherwise invisible.\n */\nexport interface QueryPlan {\n /** One `relation_targets` call per coordinate; the id sets are intersected. */\n relationCalls: Array<{ door: \"relation_targets\"; record_id: Uuid; via_key: string | null }>;\n /** One `promoted_read` call per predicate; intersected with the above. */\n promotedCalls: Array<{ door: \"promoted_read\"; field_key: string; value: string }>;\n /** The filtered read over `custom.record`, which the store's policies gate. */\n read: {\n table_id: Uuid;\n includeDeleted: boolean;\n recordType: string | null;\n asOf: AsOf | null;\n acrossHomes: boolean;\n orderBy: { column: string; ascending: boolean };\n limit: number;\n offset: number;\n };\n /**\n * Stated so nobody has to guess: when this is true the answer is the\n * intersection of the id sets above, and when it is false the read stands\n * alone.\n */\n intersects: boolean;\n}\n\nexport const DEFAULT_PAGE_SIZE = 50;\n\nexport function planQuery(query: RecordQuery): QueryPlan {\n const relationCalls = (query.relations ?? []).map((coordinate) => ({\n door: \"relation_targets\" as const,\n record_id: coordinate.record_id,\n via_key: coordinate.role ?? null,\n }));\n const promotedCalls = (query.promoted ?? []).map((predicate) => ({\n door: \"promoted_read\" as const,\n field_key: predicate.field_key,\n value: predicate.equals,\n }));\n return {\n relationCalls,\n promotedCalls,\n read: {\n table_id: query.table_id,\n includeDeleted: query.includeDeleted ?? false,\n recordType: query.recordType ?? null,\n asOf: query.asOf ?? null,\n acrossHomes: query.acrossHomes ?? false,\n orderBy: {\n column: query.orderBy?.column ?? \"created_at\",\n ascending: query.orderBy?.ascending ?? false,\n },\n limit: query.limit ?? DEFAULT_PAGE_SIZE,\n offset: query.offset ?? 0,\n },\n intersects: relationCalls.length + promotedCalls.length > 0,\n };\n}\n\n/** The intersection of the id sets a plan's calls produced. Order is preserved from the first set. */\nexport function intersectIds(sets: Uuid[][]): Uuid[] {\n if (sets.length === 0) return [];\n const [first, ...rest] = sets as [Uuid[], ...Uuid[][]];\n const others = rest.map((s) => new Set(s));\n return first.filter((id) => others.every((set) => set.has(id)));\n}\n","// src/core/client.ts — @ai-matrx/records\n//\n// THE TYPED CLIENT OVER THE STORE'S DOORS, AND NOTHING ELSE.\n//\n// Every write in this file goes through `custom.record_write`,\n// `custom.record_update`, `custom.record_delete` or `custom.record_restore`.\n// There is no `insert`, no `update` and no `delete` against `custom.record`\n// anywhere in this package, and there is no code path that adds one: DOOR-N-1\n// says there is exactly one write door and `authenticated` holds no direct\n// INSERT, UPDATE or DELETE grant on the store — a client that tried would be\n// refused, and a client that TRIES is a defect even when it is refused.\n//\n// Reads go through the read door too (DOOR-1, DOOR-10): the filtered select over\n// `custom.record` is gated by the store's own policies, and this file never\n// takes rows and then drops some of them. Where it needs an id set it asks a\n// door for one.\n//\n// Nothing here throws. Every method answers `RecordsResult`, and every refusal\n// carries the store's own sentence.\n\nimport type { ArchivedDoorRow, ArchivedRow, ArchiveLane } from \"../archive\";\nimport { DEFAULT_ARCHIVE_LANE } from \"../archive\";\nimport type {\n AggregateBucket,\n AggregateFilter,\n AggregateMeasure,\n AggregateRow,\n RecordFilter,\n} from \"../aggregate\";\nimport type {\n CaptureFileRef,\n CaptureOutcome,\n CaptureSheetFace,\n CaptureSheetSummary,\n} from \"../capture\";\nimport type {\n DashboardBlock,\n DashboardRunResult,\n DashboardSummary,\n StuckRow,\n} from \"../dashboard\";\nimport type { DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken } from \"../doc\";\nimport type {\n EnrichCell,\n EnrichDeclared,\n EnrichDueRow,\n EnrichRun,\n EnrichmentSummary,\n} from \"../enrich\";\nimport type {\n CommentThreadRead,\n CommentWritten,\n FieldHistoryEntry,\n RecordHistoryEntry,\n RestorePreview,\n RestoreResult,\n} from \"../history\";\nimport type {\n DigestPreview,\n MySubscription,\n SavedViewRow,\n SavedViewSpecIn,\n Subscription,\n SubscriptionSpec,\n} from \"../subscription\";\nimport type {\n AnonTokenBinding,\n WorkApprovalDecision,\n WorkApprovalFiled,\n WorkApprover,\n WorkAssignment,\n WorkAssignmentField,\n WorkChange,\n WorkInboxItem,\n WorkListFlavour,\n WorkListItem,\n WorkRecordState,\n WorkGraph,\n WorkInstantiation,\n WorkSlotHold,\n WorkState,\n WorkTurn,\n} from \"../work\";\nimport type {\n ChecklistDeclared,\n ChecklistRunStarted,\n ChecklistRunStep,\n ChecklistRunSummary,\n ChecklistSpec,\n ChecklistStepCompleted,\n ChecklistTemplateShape,\n ChecklistTemplateSummary,\n} from \"../checklist\";\nimport type { ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding } from \"../trust\";\nimport type { RelationWordsManyArgs } from \"../relation\";\nimport { mintOpId } from \"../ops\";\nimport type { Field } from \"../field\";\nimport type {\n Pipeline,\n PipelineColumn,\n PipelineDeclared,\n PipelineMoveResult,\n PipelineSpec,\n PipelineVerdict,\n StagePending,\n StagePendingOnBoard,\n PipelineGate,\n PipelineGatePreview,\n StageRuleEnforcement,\n StageRuleOnFail,\n} from \"../pipeline\";\nimport type {\n EntityFieldRights,\n EntityRecordRead,\n EntityRecordsFound,\n EntityTableFacts,\n NewEntityFieldDeclaration,\n} from \"../entity-field\";\nimport type { BookingAvailability, BookingDeclared, BookingSummary, FormSummary } from \"../rule\";\nimport type {\n ImportColumnsDeclared,\n ImportBatchResult,\n ImportFinished,\n ImportOpened,\n ImportPlan,\n ImportPolicy,\n ImportReport,\n ImportRun,\n InboundAddress,\n InboundDeclared,\n} from \"../import\";\nimport type {\n ConversationScope,\n ConversationScopeContext,\n RecordScopeContext,\n} from \"../record-scope\";\nimport type {\n PortalArchiveAnswer,\n PortalArchiveFilter,\n PortalCard,\n PortalInvitation,\n PortalPreviewRow,\n PortalRevocation,\n PortalSummary,\n PortalTableRef,\n} from \"../portal\";\nimport { asPermissionLevel, type MyLevel } from \"../level\";\nimport type { FieldPatch, FieldProposal, NewFieldDeclaration, TableProposal } from \"../field\";\nimport type {\n HiddenFieldNotice,\n ReadRow,\n RecordRevision,\n ReadValue,\n RecordDocument,\n RecordGraphWritten,\n RecordRead,\n StoredRecord,\n Timestamp,\n Uuid,\n} from \"../record\";\nimport type { RecordsConfig, RecordsErrorSink } from \"../ports\";\nimport type { RecordsError, RecordsErrorCode, RecordsResult, WriteConflict } from \"../results\";\nimport { err, ok } from \"../results\";\nimport type { Table, TableArchiveProgress, TableCapacity } from \"../table\";\nimport type {\n ActionRunResult,\n DecorationPath,\n ExampleBuilt,\n FormulaParse,\n GridLayout,\n IoExportPage,\n RecordEvent,\n RowAction,\n TableDecorations,\n TableWebhook,\n TableWebhookDeclared,\n} from \"../grid\";\nimport { exampleSpec, exportPageXlsx } from \"../grid\";\nimport {\n DOORS,\n TRUST_DOORS,\n TRUST_SCHEMA,\n WORKBENCH_DOORS,\n WORKBENCH_SCHEMA,\n doorAbsent,\n doorExists,\n} from \"./doors\";\nimport { mapPgError, staleWriteDetail } from \"./pgError\";\nimport { announceRecordChanged } from \"./recordChanges\";\nimport { intersectIds, planQuery, type RecordQuery } from \"./query\";\n\nconst DEFAULT_SCHEMA = \"custom\";\n\n/**\n * 🚨 A REFUSAL IS NOT AN APP ERROR (lane RECORDS-UI-FIX, guide re-walk 2026-09-23).\n *\n * A person typing `-3` into a column that takes \"at least 0\" is the store WORKING: the\n * rule said no, the screen said so in the one notice, and the person fixed it. The default\n * sink printed every one of those through `console.error`, and the app's error capture\n * (matrx-frontend `lib/diagnostics/globalErrorCapture.ts`) counts every `console.error` —\n * so one refused value lit a red \"2 errors\" pill in the corner, telling an admin the\n * product had failed when a person had simply been told no.\n *\n * These are the codes a PERSON causes by what they typed or when they typed it; each one\n * is already drawn on the screen that asked. They are still said (`console.info`), never\n * silenced. Everything else — a door, the store switched off, a timeout, a class this\n * package did not recognise — is a failure of the system and stays `console.error`.\n */\nexport const A_PERSONS_REFUSAL: ReadonlySet<RecordsErrorCode> = new Set<RecordsErrorCode>([\n \"refused_by_rule\",\n \"stale_write\",\n \"invalid_argument\",\n \"already_exists\",\n \"missing_reference\",\n]);\n\nexport function isAPersonsRefusal(code: RecordsErrorCode | string): boolean {\n return A_PERSONS_REFUSAL.has(code as RecordsErrorCode);\n}\n\nfunction sink(config: RecordsConfig): RecordsErrorSink {\n return (\n config.onError ??\n ((e) => {\n // The defined degradation, stated: with the store's own words, and naming where it\n // happened. Never silence — but a person's refusal is information, not an error.\n const line = `[@ai-matrx/records] ${e.where}: ${e.code} — ${e.message}${e.hint ? ` (${e.hint})` : \"\"}`;\n if (isAPersonsRefusal(e.code)) console.info(line);\n else console.error(line);\n })\n );\n}\n\nexport interface RecordsClient {\n /** The config this client was built with, so a screen can show who it is acting as. */\n readonly config: RecordsConfig;\n\n // ── writes: the one door each ────────────────────────────────────────────\n recordWrite(args: { table_id: Uuid; data: RecordDocument }): Promise<RecordsResult<Uuid>>;\n /**\n * Write MANY new records of one Table in one call.\n *\n * `custom.record_write_many` asks the switch, the organization and the Table\n * ONCE for the whole batch and inserts the rows in one statement — which is\n * why a paste of 120 lines is one round trip per chunk instead of 120. It\n * CREATES only: there is no bulk update door, because an update carries a\n * per-row optimistic version and a batch would have to either drop that or\n * fail the whole batch for one stale row.\n *\n * It returns the new ids IN THE ORDER THE ROWS WERE HANDED IN, so a caller\n * can tie each id back to the line of the spreadsheet it came from. Hand in\n * `ids` to choose them yourself; hand in none and the door mints them.\n */\n recordWriteMany(args: {\n table_id: Uuid;\n rows: RecordDocument[];\n ids?: Uuid[];\n }): Promise<RecordsResult<Uuid[]>>;\n /**\n * A PARENT, THE EDGES IT STANDS ON AND THE ROWS THAT BELONG TO IT — ALL OR NOTHING.\n *\n * `recordWrite` and `recordWriteMany` are each ONE statement. A screen or a\n * server path whose unit of work is a GRAPH — an AI artifact and the lines\n * it produced, an order and its items, a research note and its citations —\n * could therefore not save it as one thing: a loop is N transactions, and a\n * failure on row nineteen leaves a parent standing without the lines it\n * promised.\n *\n * `custom.record_write_graph` is one statement, so it is one transaction. It\n * is NOT a second write path: it calls `custom.record_write_many` for the\n * rows, `public.assoc_add` for an edge that points OUT of the store (the\n * message a record was produced by), and `platform.relation_set` for the\n * parent's own declared relation to its children. Same store switch, same\n * editor rung on the Table, same value envelope, same undeclared-key guard,\n * same history rows, same realtime notice.\n *\n * ONE REFUSAL REFUSES THE WHOLE GRAPH, BY NAME — the answer says which member\n * failed and carries the store's own sentence about it, and nothing is\n * written.\n *\n * Every child MUST name a `role`: it is the key of a declared RELATION field\n * on the parent's Table, and an edge out of a record that names no field is\n * refused by the store (REL-10 / T7) because without it nothing can read the\n * relation's delete rule, its cardinality or its organization wall. The order\n * children are handed in IS the order of the relation.\n */\n recordWriteGraph(args: {\n table_id: Uuid;\n parent: RecordDocument;\n /** Each child: its document, the parent FIELD it fills, and optionally its own Table. */\n children?: Array<{\n data: RecordDocument;\n role: string;\n table_id?: Uuid;\n position?: number;\n }>;\n /** Edges to things OUTSIDE the store. `direction` defaults to `\"in\"` — that thing produced this record. */\n edges?: Array<{\n entity: string;\n id: Uuid;\n direction?: \"in\" | \"out\";\n label?: string;\n role?: string;\n position?: number;\n metadata?: Record<string, unknown>;\n }>;\n }): Promise<RecordsResult<RecordGraphWritten>>;\n recordUpdate(args: {\n record_id: Uuid;\n patch: Record<string, unknown>;\n /** Leave it out and the last writer wins; supply it and a loser is TOLD. */\n expectedVersion?: number;\n }): Promise<RecordsResult<number>>;\n /**\n * REC-23. Soft, and reversible within `retention`.\n *\n * 🚨 NOT FOR A TABLE. A Table is a record, so this door accepts one — and\n * then recurses through every record the Table contains inside a single\n * transaction, which is unbounded by construction and dies on `57014` at a\n * size the product's own import reaches in half a minute. Use\n * `tableArchive` below, which does the same work in resumable passes.\n */\n recordDelete(args: { record_id: Uuid }): Promise<RecordsResult<Timestamp>>;\n recordRestore(args: { record_id: Uuid }): Promise<RecordsResult<void>>;\n /**\n * ARCHIVING A WHOLE TABLE — ONE PASS OF IT (VERIFIER-11 F3).\n *\n * One call archives at most `chunk` of the table's live records through\n * `custom.record_delete` (so every guard, history capture and outbox row\n * still happens; nothing is hard-deleted) and comes back with the numbers a\n * screen draws progress from. The CALLER LOOPS until `done` — that loop is\n * the fix, because the one thing a single statement cannot be made to do is\n * finish.\n *\n * `chunk: 0` changes nothing and only reports, so a screen can say \"1,430\n * records will be archived\" BEFORE a person commits to it. `includeTable:\n * false` empties the table and leaves it standing.\n *\n * RESUMABLE, WITHOUT A JOB ROW: what remains is read off the records\n * themselves every call. A pass that fails, a closed tab or a deploy mid-run\n * leaves a half-archived table and a next call that continues from exactly\n * there. A caller must therefore never report \"nothing happened\" after a\n * failed pass — `archived_total` says what really landed.\n */\n tableArchive(args: {\n table_id: Uuid;\n /**\n * How many records this pass takes on. The door clamps it; it answers with what it\n * took. Default 50 — measured: ~35ms a record against an 8s statement timeout, so\n * 200 dies on `57014` and is the original defect one level up.\n */\n chunk?: number;\n /** Archive the Table record itself once nothing live is left in it. Default true. */\n includeTable?: boolean;\n }): Promise<RecordsResult<TableArchiveProgress>>;\n\n // ── reads ────────────────────────────────────────────────────────────────\n recordRead(args: { record_id: Uuid; withComputed?: boolean }): Promise<RecordsResult<RecordRead>>;\n /**\n * DOOR-1. A page of one Table's records THROUGH `custom.read_records`: the\n * store decides which rows this reader may see and which fields of them, and\n * a field it masked comes back present-and-null with its reason in `hidden`.\n * `total` is null because the door counts nothing it has not read — a count\n * of rows a person may not see is a leak with a number on it.\n */\n list(args: {\n table_id: Uuid;\n /**\n * THE STORE'S ONE FILTER SHAPE (`RecordFilter`). Left out, this is the\n * whole page. Supplied, the store narrows INSIDE its own query — never the\n * browser, which can only ever filter the rows it was already allowed to\n * see and would silently drop the rest of the answer.\n *\n * It is the same object a saved view stores as `filters` and the same one\n * `recordAggregate` counts with, so the rows a drill-through opens are the\n * rows the number on the dashboard counted.\n */\n filter?: RecordFilter;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<{ rows: ReadRow[]; total: number | null }>>;\n /**\n * DOOR-1 FOR AN ID SET. Exactly these records of this Table, through\n * `custom.read_records_by_ids` — the same ladder, the same level, the same\n * field masking and the same page ceiling as `list`, addressed by id instead\n * of by page. An id the reader may not see simply does not come back, which\n * is the same answer `list` gives by omission.\n *\n * It exists because a realtime notice has always named the exact ids that\n * moved and no door could take them: three cells changing re-read a fifty-row\n * page in every watching browser.\n */\n listByIds(args: { table_id: Uuid; ids: readonly Uuid[] }): Promise<RecordsResult<ReadRow[]>>;\n /**\n * DOOR-1 FOR THE ROWS THAT LEFT: a page of one Table's ARCHIVED records,\n * through `custom.read_records_archived` — the same ladder, the same level,\n * the same field masking and the same page ceiling as `list`, with the sign\n * of the `deleted_at` test flipped, plus who archived each one and when.\n *\n * 🚨 IT EXISTS BECAUSE ARCHIVING WAS A ONE-WAY DOOR (VERIFIER-10 F4). The\n * store has always had `record_restore`, and it has always done exactly the\n * right thing; what it did not have was any door that could LIST the records\n * it would act on, because every read door answers live rows only. So an\n * archived record was unreachable from every screen in the platform.\n *\n * `lane` is the archived-items law's two lanes — \"mine\" (what I archived) and\n * \"org\" (what anybody in this organization archived), which is the default.\n */\n listArchived(args: {\n table_id: Uuid;\n lane?: ArchiveLane;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<{ rows: ArchivedRow[]; total: number | null }>>;\n query(query: RecordQuery): Promise<RecordsResult<{ rows: ReadRow[]; total: number | null }>>;\n tableList(): Promise<RecordsResult<Table[]>>;\n /**\n * IS THIS TABLE IN THE ARCHIVE? (lane HUB-FIX, 2026-09-23.) The archived row for one\n * Table of this organization, or `null` when the archive does not hold it — which\n * is an ANSWER, never \"it may have been deleted\". A table page that cannot find a\n * Table asks this before saying anything: an archived Table's own address used to\n * read \"…or it may have been deleted\" when it was archived and one click from back.\n */\n tableArchived(args: { table_id: Uuid }): Promise<RecordsResult<ArchivedRow | null>>;\n fields(args: { table_id: Uuid; recordType?: string }): Promise<RecordsResult<Field[]>>;\n /**\n * FLD-5 / FLD-6: a list field stores the id of an option RECORD, because\n * every pick-list is already a Table. These are that Table's records — the\n * store resolves which Table from the Field's own config, so no caller has to\n * know it.\n */\n fieldOptions(args: { field_id: Uuid }): Promise<RecordsResult<StoredRecord[]>>;\n tableCapacity(args: { table_id: Uuid }): Promise<RecordsResult<TableCapacity>>;\n\n // ── declaring a Table, and the kernels a Table needs to exist ────────────\n /**\n * REC-1: a Table has to live somewhere, so a Home comes first — and a Home is\n * an ordinary record in the person kernel. `homeId` is therefore required and\n * `personKernelId()` is how a caller gets a Table to write one into.\n */\n tableDeclare(args: { spec: Record<string, unknown>; homeId: Uuid }): Promise<RecordsResult<Uuid>>;\n /**\n * ADD A FIELD TO A TABLE. One call, and the store does the three things no\n * client can do for itself: it turns a parity type into the behaviour,\n * modifiers, format, unit, relation target and Rules its own guards demand;\n * it tells the TABLE about the field (REC-1 / FLD-8 — a definition for a\n * field the table never declared is refused, which is the sentence every\n * \"Add field\" used to end on); and it stores the definition as a FIELD\n * rather than as a plain record, so the delete rules and the\n * formula-dependency check can see it.\n *\n * A choice list carries its `options` as words. The store keeps them the only\n * way FLD-5 / FLD-6 allows — as the records of a Table it declares for them —\n * so nobody is made to build a table before they can have a dropdown.\n */\n fieldDeclare(args: { table_id: Uuid; spec: NewFieldDeclaration }): Promise<RecordsResult<Uuid>>;\n /** One field's own settings. What it HOLDS is a conversion and is refused here by name. */\n fieldUpdate(args: { field_id: Uuid; patch: FieldPatch }): Promise<RecordsResult<Uuid>>;\n /**\n * REL-DISP. THE WORDS ONE RELATION CELL SHOWS, resolved by the store through\n * that column's own display spec — one column or several, joined by its\n * separator. Never resolve a relation label any other way: the store's\n * `custom._words_for` is the one body that decides what a record is called, it\n * asks the visibility ladder BEFORE it reads the name, and a record this reader\n * may not open comes back as the withheld sentence rather than its name or id.\n * A value that is not an id is handed straight back — it is already words.\n */\n relationWords(args: { field_id: Uuid; value: string }): Promise<RecordsResult<string | null>>;\n /**\n * The same answer for a WHOLE PAGE of cells in one round trip. Prefer this\n * wherever a grid, board, list or picker resolves more than one chip: the\n * per-id lane is what made a page of relation cells a page of requests.\n */\n relationWordsMany(\n args: RelationWordsManyArgs,\n ): Promise<RecordsResult<Record<string, string>>>;\n /** Take a field off a table. Refuses the title field, the last field, and one another field reads through. */\n fieldRetire(args: { field_id: Uuid }): Promise<RecordsResult<boolean>>;\n // ── CUSTOM FIELDS ON A STANDARD BUSINESS TABLE (REC-34 / REC-40 / FLD-8) ──\n // Named by the registry TOKEN, because a standard table has no Table record.\n // One set for all 643 tables the registry types Entity or Detail, and no\n // per-table code anywhere in this package or in any screen that uses it.\n /** What the registry says about a token, and whether it can hold a value at all. */\n entityTable(args: { token: string }): Promise<RecordsResult<EntityTableFacts>>;\n /** The fields THIS organization added to that standard table. */\n entityFields(args: { token: string }): Promise<RecordsResult<Field[]>>;\n /** Add a column to a standard table. An organization admin's right - it changes the table for everybody. */\n entityFieldDeclare(args: { token: string; spec: NewEntityFieldDeclaration }): Promise<RecordsResult<Uuid>>;\n /** One field's own settings. A TYPE change is refused here by name, as it is on a custom table. */\n entityFieldUpdate(args: { field_id: Uuid; patch: Record<string, unknown> }): Promise<RecordsResult<Uuid>>;\n /** Take a custom field off a standard table. The values already written stay in each row. */\n entityFieldRetire(args: { field_id: Uuid }): Promise<RecordsResult<Uuid>>;\n /** May this person add a column here - and if not, the store's own sentence saying why. */\n entityFieldRights(args: { token: string }): Promise<RecordsResult<EntityFieldRights>>;\n /** REC-53 in one answer: the row's real columns AND its custom values AND the definitions. */\n entityRecordRead(args: { token: string; record_id: Uuid }): Promise<RecordsResult<EntityRecordRead>>;\n /** A patch: a key left out is left alone, a key set to null is cleared with its envelope. */\n entityValueWrite(args: {\n token: string;\n record_id: Uuid;\n patch: Record<string, unknown>;\n }): Promise<RecordsResult<EntityRecordRead>>;\n /** Rows of that standard table with this custom value. Refuses a field nobody declared. */\n entityRecordsFind(args: {\n token: string;\n key: string;\n value?: unknown;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<EntityRecordsFound>>;\n\n /** The kernel Tables a caller writes a Home, a Field or a Rule into. */\n personKernelId(): Promise<RecordsResult<Uuid>>;\n fieldKernelId(): Promise<RecordsResult<Uuid>>;\n ruleKernelId(): Promise<RecordsResult<Uuid>>;\n\n // ── Rules: the STORE decides membership, never a screen ──────────────────\n /** Every record the Rule says is a member. A saved view's list is this, not a filter a screen ran. */\n /** PRODUCTS row 7 — the whole board: its stage column, its stages in the declared\n * order, and every Rule WITH the sentence it says when it refuses. */\n pipelineRead(args: { table_id: Uuid }): Promise<RecordsResult<Pipeline>>;\n /** The store's own count and total per column, over what this person may see. */\n pipelineBoard(args: {\n table_id: Uuid;\n measure?: string | null;\n }): Promise<RecordsResult<PipelineColumn[]>>;\n /** Whether this card may go to that column — asked BEFORE the finger lets go. */\n pipelineTransitionRefusal(args: {\n record_id: Uuid;\n to: string;\n }): Promise<RecordsResult<PipelineVerdict>>;\n /**\n * Move a record to a stage. An ORDINARY record write, judged by the same Rules.\n *\n * It answers an OBJECT on every path. A gate whose `on_fail` is `require_approval`\n * comes back `applied: false` with the wait it filed — the record has NOT moved, and a\n * screen that treated the call's success as the move's success would show the card in\n * the wrong column while somebody is still deciding.\n */\n pipelineMove(args: {\n record_id: Uuid;\n to: string;\n also?: Record<string, unknown>;\n expected_version?: number | null;\n }): Promise<RecordsResult<PipelineMoveResult>>;\n /** Declare (or re-state) a pipeline: the stage column and its transition Rules. */\n pipelineDeclare(args: {\n table_id: Uuid;\n spec: PipelineSpec;\n }): Promise<RecordsResult<PipelineDeclared>>;\n /** Which column of this table holds its stage, or null when it is not a board. */\n tableStageField(args: { table_id: Uuid }): Promise<RecordsResult<string | null>>;\n /** The closed list of what a gate does when it says no — the store is the authority. */\n stageRuleOnFailKinds(): Promise<RecordsResult<{ behaviour: StageRuleOnFail; note: string }[]>>;\n /** Whether this organization's gates refuse or warn. One opinion, asked once. */\n stageRuleEnforcement(): Promise<RecordsResult<StageRuleEnforcement>>;\n /** What is waiting on this card: approvals filed against its own stage column. */\n recordStagePending(args: { record_id: Uuid }): Promise<RecordsResult<StagePending[]>>;\n /** The same question for a whole board, in ONE call — what a Kanban badges cards from. */\n pipelinePending(args: { table_id: Uuid }): Promise<RecordsResult<StagePendingOnBoard[]>>;\n /**\n * WHAT THIS GATE WOULD DO TO THIS BOARD TODAY — for a gate that has not been saved.\n *\n * The settings screen calls it on every edit of the condition, which is why it takes\n * the gate rather than a rule id: no saved-rule door can answer about a rule that does\n * not exist yet. The store compiles it with the same compiler `pipelineDeclare` uses,\n * so the number here and the refusal at the door are the same rule — a preview with its\n * own compiler would be wrong exactly at the edge of the condition, which is the only\n * place anybody looks.\n *\n * A gate that does not say what it demands is REFUSED, not answered zero: \"no cards\n * would be stopped\" beside a half-written rule is the sentence that gets it saved.\n */\n pipelineGatePreview(args: {\n table_id: Uuid;\n stage: string;\n gate: PipelineGate | Record<string, unknown>;\n }): Promise<RecordsResult<PipelineGatePreview>>;\n ruleMembers(args: { rule_id: Uuid }): Promise<RecordsResult<StoredRecord[]>>;\n /** Is this one record a member, and WHY — the store's own answer. */\n ruleMembership(args: { rule_id: Uuid; record_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Run a stored Rule against a document. */\n ruleRun(args: { rule_id: Uuid; values: Record<string, unknown>; context?: Record<string, unknown> }): Promise<RecordsResult<unknown>>;\n /** Evaluate a Rule expression that has not been stored — the conditional logic a form runner asks about. */\n ruleEval(args: { expr: unknown; values: Record<string, unknown>; context?: Record<string, unknown> }): Promise<RecordsResult<unknown>>;\n /**\n * Write ONE Rule as a real Rule. `recordWrite` into the Rule kernel makes a\n * valid Rule document that carries `data_class = 'record'`, and every reader\n * that looks for a Rule looks for the class — `custom.agg_subscriptions`\n * selects `where data_class = 'rule'` — so a subscription written that way\n * fires at nobody. This is the door that closes it.\n */\n // ── Forms: a form is a VIEW ON A REAL TABLE (SCR-13, PRODUCTS row 1) ──────\n /** This organization's forms, with how many answers arrived and how many are in the table. */\n forms(args?: { table_id?: Uuid | null }): Promise<RecordsResult<FormSummary[]>>;\n /**\n * THIS ORGANIZATION'S BOOKING PAGES (PRODUCTS row 14), with the numbers that make\n * the list worth opening: how many are booked, cancelled, still ahead, and how many\n * slots somebody is holding right now. A booking page is an `anon_form`, so it is\n * opened and closed with `anonPublish` exactly as a form is.\n */\n bookings(args?: { table_id?: Uuid | null }): Promise<RecordsResult<BookingSummary[]>>;\n /**\n * CREATE OR RE-STATE ONE BOOKING PAGE over one Table. `admin` on the Table,\n * because a booking page decides what a stranger may write into it and which\n * hours of the organization's week are on offer.\n *\n * `slot`, `status` and `booked_with` are the store's to fill in: a question\n * naming any of the three is refused BY NAME, so a page cannot be built that\n * lets a visitor choose their own status. It does NOT publish — `anonPublish`\n * is the one act that opens a public surface, for a booking page exactly as\n * for a form.\n *\n * Until 2026-09-21 this door had no client method, so the ONLY way to a\n * booking page was to ask an agent for one. The agent path is the faster one,\n * never the only one.\n */\n bookingDeclare(args: {\n table_id: Uuid;\n title: string;\n questions: unknown[];\n availability?: Partial<BookingAvailability> | null;\n presentation?: Record<string, unknown> | null;\n submission_cap?: number | null;\n quarantine_rule_id?: Uuid | null;\n notify_rule_id?: Uuid | null;\n form_id?: Uuid | null;\n slug?: string | null;\n home_id?: Uuid | null;\n }): Promise<RecordsResult<BookingDeclared>>;\n /** Create or re-state one form. A question naming no Field of that Table is refused BY NAME. */\n formDeclare(args: {\n table_id: Uuid;\n title: string;\n questions: unknown[];\n presentation?: Record<string, unknown> | null;\n submission_cap?: number | null;\n quarantine_rule_id?: Uuid | null;\n notify_rule_id?: Uuid | null;\n form_id?: Uuid | null;\n slug?: string | null;\n }): Promise<RecordsResult<Uuid>>;\n\n // ── PULLING A SPREADSHEET IN (PRODUCTS row 9) ────────────────────────────\n // The BYTES are parsed here (`importCsv` / `importXlsx` in `core/io.ts`,\n // because Postgres cannot unzip a workbook). EVERYTHING after the parse is\n // the store's: the mapping, the type inference, the coercion of `$1,250.00`\n // into money and of an email into the person it belongs to, the duplicate\n // check, the provenance and the per-row outcome. There is no second importer\n // in this package and there is no place for one to drift to.\n /**\n * What the store makes of a file's columns, before anything is written.\n * `columns` is `[{header, samples}]` — the first page of the file is plenty.\n */\n importPlan(args: {\n table_id: Uuid;\n columns: Array<{ header: string; samples: unknown[] }>;\n }): Promise<RecordsResult<ImportPlan>>;\n /**\n * Open a run. `file_hash` is the run's IDENTITY: the same bytes into the same\n * table a second time answer the FIRST run with `already: true` and write\n * nothing, so a re-import doubles nothing. `force` re-opens deliberately.\n */\n importBegin(args: {\n table_id: Uuid;\n format?: \"csv\" | \"xlsx\";\n source_name?: string | null;\n source_columns?: unknown[];\n file_hash?: string | null;\n policy?: ImportPolicy;\n /** A Field key. A row whose value for it is already here is a duplicate. */\n dedupe_key?: string | null;\n file_bytes?: number | null;\n force?: boolean;\n }): Promise<RecordsResult<ImportOpened>>;\n /**\n * IMPORT-2. ADD THE COLUMNS THIS FILE HAS AND THIS TABLE HAS NOT — a step of\n * its own, BEFORE the run is opened, so the screen can show \"8 columns added\"\n * and the person can then name one of them as the file's duplicate key\n * (`importBegin` refuses a key naming a column that does not exist yet).\n * Answers the mapping the file should be sent with. Admin on the Table.\n */\n importDeclareColumns(args: {\n table_id: Uuid;\n rows: Array<Record<string, unknown>>;\n /** Header -> Field key the person already mapped by hand; never declared. */\n mapping?: Record<string, string>;\n }): Promise<RecordsResult<ImportColumnsDeclared>>;\n /**\n * One BATCH of rows. The batch is PLANNED and then written as ONE statement\n * through the batched write door, so 250 round trips became one; a batch a\n * guard refuses falls back to one write a row, and the answer says which it\n * was. Send `ImportOpened.rows_per_call` the first time and\n * `ImportBatchResult.rows_per_call` — measured — every time after that.\n */\n importRows(args: {\n import_id: Uuid;\n rows: Array<Record<string, unknown>>;\n /** Header -> Field key. A header that already spells a key needs no entry. */\n mapping?: Record<string, string>;\n }): Promise<RecordsResult<ImportBatchResult>>;\n /**\n * Close the run and decide the columns the file had and the table did not:\n * `propose` (the ONE approvals inbox, and the only choice a non-admin has),\n * `create` (an admin adds them outright) or `ignore`.\n */\n importFinish(args: {\n import_id: Uuid;\n unmapped?: \"propose\" | \"create\" | \"ignore\";\n }): Promise<RecordsResult<ImportFinished>>;\n /** The refused rows, or the ones already here, WITH the source row on each. */\n importReport(args: {\n import_id: Uuid;\n state?: \"refused\" | \"duplicate\";\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<ImportReport>>;\n /** This organization's import runs, newest first. How you find yesterday's. */\n imports(args?: { table_id?: Uuid | null; limit?: number }): Promise<RecordsResult<ImportRun[]>>;\n /**\n * Forget the RECEIPT for a file so the same bytes can be imported again\n * deliberately. Never touches the records that import wrote.\n */\n importForget(args: { import_id: Uuid }): Promise<RecordsResult<boolean>>;\n\n // ── THE ADDRESS A TABLE OWNS (DOOR-19, P8) ───────────────────────────────\n /**\n * Give a table its own address. The answer carries `mail_route`: the one\n * sentence saying what has to exist in DNS before anything arrives. Show it\n * wherever the address is shown — an address that silently swallows mail is\n * the failure this whole door is against.\n */\n inboundDeclare(args: { table_id: Uuid; label?: string | null }): Promise<RecordsResult<InboundDeclared>>;\n inboundAddresses(args?: { table_id?: Uuid | null }): Promise<RecordsResult<InboundAddress[]>>;\n inboundSet(args: { inbound_id: Uuid; enabled: boolean }): Promise<RecordsResult<{ inbound_id: Uuid; address: string; enabled: boolean; message: string }>>;\n\n // ── Portals: the OWNER's side of the client portal (VIS-31 / PORTAL) ──────\n /** Every portal over this organization the caller may know about, with its numbers. */\n portals(): Promise<RecordsResult<PortalSummary[]>>;\n /**\n * The SAME list, archive-aware. `custom.portals` keeps its signature and hides\n * archived portals, because the archived-items law's default is to hide;\n * this is the one door that also answers the other lane, so a rail gets the\n * law's one-click reveal without inventing a second control or a second door.\n * A fourth word is refused `22023` — there is no fourth answer on any surface.\n */\n listPortals(args?: { archived?: PortalArchiveFilter }): Promise<RecordsResult<PortalSummary[]>>;\n /**\n * PUT ONE PORTAL AWAY. Nothing is deleted and there is no purge: every Table\n * it exposes and every person invited to it is kept exactly as it is, and\n * `portalRestore` hands it all back. `confirm_title` is the portal's own title\n * typed back — ten portals can carry one title, so the title is not what picks\n * this one and the door refuses `23514` when it does not match.\n */\n portalArchive(args: {\n portal_id: Uuid;\n confirm_title: string;\n reason?: string | null;\n }): Promise<RecordsResult<PortalArchiveAnswer>>;\n /** The way back. Everyone invited signs in exactly as before, and it shows the same Tables. */\n portalRestore(args: {\n portal_id: Uuid;\n confirm_title: string;\n }): Promise<RecordsResult<PortalArchiveAnswer>>;\n /**\n * Which Tables each portal of this organization exposes.\n *\n * The one question a TABLE-scoped Portals rail has to ask: \"is the table I\n * am standing on in any portal?\" Same wall and same visibility gate as\n * `portals`, so a pair here is always a portal `portals` also returned.\n */\n portalTables(): Promise<RecordsResult<PortalTableRef[]>>;\n /** ONE portal in full: what it shows, and who it was opened to. */\n portalCard(args: { portal_id: Uuid }): Promise<RecordsResult<PortalCard>>;\n /**\n * Create or RE-STATE one portal. Re-stating REPLACES what it exposes — a\n * Table left out of `tables` stops being exposed in the same act — and leaves\n * the people alone: who is invited is not part of what the portal shows.\n */\n portalDeclare(args: {\n title: string;\n client_table_id: Uuid;\n tables: Array<{\n table_id: Uuid;\n names_via: string;\n visible_fields?: string[];\n editable_fields?: string[];\n comments?: boolean;\n }>;\n portal_id?: Uuid | null;\n slug?: string | null;\n sign_in_method?: string | null;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * Invite one person, as one record of the portal's client Table.\n *\n * `user_id` is deliberately NOT a parameter here. From a screen it is always\n * null: an invitation confers NOTHING until the person follows their sign-in\n * link and the platform gives them an identity, and the door's own `say`\n * sentence states exactly that. A screen that passed an id would be granting\n * access on somebody else's behalf.\n */\n portalInvite(args: {\n portal_id: Uuid;\n client_record_id: Uuid;\n email: string;\n }): Promise<RecordsResult<PortalInvitation>>;\n /** Take one person's way in away. The answer's `say` names the consequence. */\n portalRevoke(args: { portal_id: Uuid; principal_id: Uuid }): Promise<RecordsResult<PortalRevocation>>;\n /**\n * VIEW AS THIS CLIENT. The door asks `custom.visible_set` for HER user id —\n * the same call `custom.read_records` makes when she opens the page — so this\n * cannot disagree with what she sees. It REFUSES with `02000` and a sentence\n * when she has not signed in yet; show the sentence, never an empty list.\n */\n portalPreview(args: {\n portal_id: Uuid;\n principal_id: Uuid;\n table_id: Uuid;\n }): Promise<RecordsResult<PortalPreviewRow[]>>;\n\n // ── dashboards (SCR-16): saved blocks, run under the caller's principal ──\n /** This organization's dashboards, optionally only those whose subject is one Table. */\n dashboards(args?: { table_id?: Uuid | null }): Promise<RecordsResult<DashboardSummary[]>>;\n /**\n * Create or re-state one dashboard. Every block is judged on the way IN —\n * a block naming a field this Table does not have is refused BY NAME, with\n * the table's own field list in the hint — so a canvas cannot be saved broken.\n */\n dashboardDeclare(args: {\n table_id: Uuid;\n name: string;\n blocks?: DashboardBlock[];\n presentation?: Record<string, unknown> | null;\n dashboard_id?: Uuid | null;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * Run every block and answer the numbers. `filter` is the ONE filter bar\n * across the canvas: it is merged UNDER each block's own filter, so a block\n * deliberately scoped to one stage stays scoped while the bar moves the rest.\n * A block that refuses carries the store's sentence and the others still answer.\n */\n dashboardRun(args: {\n dashboard_id: Uuid;\n filter?: RecordFilter;\n }): Promise<RecordsResult<DashboardRunResult>>;\n /** The seventh block kind on its own: records that have sat on the same value too long. */\n dashboardStuck(args: {\n table_id: Uuid;\n state_key: string;\n days?: number;\n filter?: RecordFilter;\n limit?: number;\n }): Promise<RecordsResult<StuckRow[]>>;\n // ── a crew, a phone and no signal (PRODUCTS row 15 / SCR-30) ─────────────\n /**\n * Declare or re-state a crew capture sheet over a Table. Admin on the Table.\n * Closed to the crew until `capturePublish`, like every publishing act here.\n */\n captureSheetDeclare(args: {\n table_id: Uuid;\n title: string;\n questions: Array<Record<string, unknown>>;\n presentation?: Record<string, unknown> | null;\n sheet_id?: Uuid | null;\n notify_rule_id?: Uuid | null;\n }): Promise<RecordsResult<Uuid>>;\n /** Open the sheet to the crew, or close it. Admin on the Table. */\n capturePublish(args: { sheet_id: Uuid; open?: boolean }): Promise<RecordsResult<string | null>>;\n /** The crew sheets of this organization, with what has come in through each. */\n captureSheets(args?: { table_id?: Uuid | null }): Promise<RecordsResult<CaptureSheetSummary[]>>;\n /**\n * Everything a phone needs to run one sheet OFFLINE — the questions, the Fields\n * with their ids and parity types, and an honest `may_capture` with a sentence.\n * Load it once on a signal; it is the last network call before the walk.\n */\n captureOpen(args: { sheet_id: Uuid }): Promise<RecordsResult<CaptureSheetFace | null>>;\n /**\n * One capture: the answers, the file references, the device, the moment the phone\n * took it and the place. Idempotent on `client_key`, which the PHONE mints when\n * the capture is taken, offline, before its first attempt — send the same key on\n * every retry and the answer comes back `replay: true` with the first record's id.\n */\n captureSubmit(args: {\n sheet_id: Uuid;\n client_key: string;\n answers: Record<string, unknown>;\n files?: CaptureFileRef[];\n device?: string | null;\n captured_at?: string | null;\n location?: Record<string, unknown> | null;\n }): Promise<RecordsResult<CaptureOutcome | null>>;\n\n // ── a column a model owns (PRODUCTS row 10 / AGT-6) ──────────────────────\n /** Every agent-owned column, with how many cells are filled, stale or pinned, and what it has cost. */\n enrichments(args?: { table_id?: Uuid | null }): Promise<RecordsResult<EnrichmentSummary[]>>;\n /**\n * Define, change or TURN ON an Enrichment on one Field. Admin on the Table.\n * `{enabled: true}` on its own turns an existing one on without resetting it —\n * and turning it on is what authorises every value it writes afterwards.\n */\n enrichDeclare(args: {\n field_id: Uuid;\n spec: Record<string, unknown>;\n }): Promise<RecordsResult<EnrichDeclared>>;\n /**\n * The rows that need this column filled in, each with what the instruction may\n * read. A cell somebody pinned is never returned. This is what a PREVIEW shows\n * before anybody enables anything.\n */\n enrichDue(args: {\n field_id: Uuid;\n limit?: number;\n include_fresh?: boolean;\n }): Promise<RecordsResult<EnrichDueRow[]>>;\n /**\n * THE BADGE DATA FOR A WHOLE PAGE, in one call. Who wrote each value, when, out\n * of what source, its candidates, whether a person pinned it and whether it is\n * past its freshness date. Asked per cell this would be one round trip per badge.\n */\n enrichCells(args: {\n table_id: Uuid;\n field_keys?: string[] | null;\n record_ids?: Uuid[] | null;\n }): Promise<RecordsResult<EnrichCell[]>>;\n /** Hold one cell against the model that fills its column, or hand it back. */\n enrichPin(args: {\n record_id: Uuid;\n field_key: string;\n pinned?: boolean;\n }): Promise<RecordsResult<{ pinned: boolean; says: string }>>;\n /** What this column has cost, run by run. */\n enrichRuns(args?: { field_id?: Uuid | null; limit?: number }): Promise<RecordsResult<EnrichRun[]>>;\n /** Take a dashboard away. The records it counted are untouched — a canvas owns nothing. */\n dashboardDelete(args: { dashboard_id: Uuid }): Promise<RecordsResult<boolean>>;\n\n // ── the eighth verb (AGT-N-8): the aggregate, computed in the read door ──\n /**\n * Group, bucket, filter and measure INSIDE `custom.record_aggregate`. The\n * aggregate node sits above the visibility join, so what a chart draws is\n * exactly what this person may see — the rest is never fetched, let alone\n * summed and then hidden.\n */\n recordAggregate(args: {\n table_id: Uuid;\n /** Field keys whose values become the groups. */\n groupBy?: string[];\n /** `count` needs no key; every other operation reads one Field. */\n measures?: AggregateMeasure[];\n /** A date Field truncated to a period — a group whose expression is a date_trunc. */\n bucket?: { key: string; by: AggregateBucket } | null;\n /**\n * A scalar is an equality and an object is a half-open moment window, and\n * either way it lands in the SAME WHERE as visibility.\n */\n filter?: RecordFilter;\n limit?: number;\n }): Promise<RecordsResult<AggregateRow[]>>;\n /** The measures the store itself offers. Asked, never hardcoded in a picker. */\n aggOperations(): Promise<RecordsResult<string[]>>;\n /** The periods the store itself buckets by. */\n aggBuckets(): Promise<RecordsResult<string[]>>;\n\n // ── subscriptions (DOOR-18): a Rule record over a saved view ─────────────\n /**\n * Every subscription in this organization, optionally narrowed to one saved\n * view or one cadence. There is no subscription table: each one is a Rule\n * record carrying a `subscription` block, so a subscription is readable,\n * historied and agent-writable like anything else.\n */\n aggSubscriptions(args?: {\n saved_view_id?: Uuid | null;\n cadence?: string | null;\n }): Promise<RecordsResult<Subscription[]>>;\n /** The cadences the store itself offers. Asked, never hardcoded in a picker. */\n aggSubscriptionCadences(): Promise<RecordsResult<string[]>>;\n /**\n * The same cadences, through the door a PERSON may call.\n * `aggSubscriptionCadences` is the notifier's own and holds no client grant,\n * so a screen that asked for it was refused and fell back to a list typed\n * into the picker — which drifts from what the digest runner honours. This\n * one delegates to the same array, so there is exactly one list.\n */\n subscriptionCadences(): Promise<RecordsResult<string[]>>;\n /**\n * WHAT THIS PERSON IS BEING TOLD ABOUT, and what they may switch off.\n *\n * Mine, plus anyone's over a Table I hold admin on — narrowed to Tables I can\n * already open, so the list never reveals one. `aggSubscriptions` above is the\n * NOTIFIER's reader and no client can call it; this is the owner's.\n */\n subscriptions(args?: { table_id?: Uuid | null }): Promise<RecordsResult<MySubscription[]>>;\n /**\n * Switch one on or off. Muting is honoured in ONE place — the reader every\n * consumer goes through — so a screen can never say a subscription is off\n * while it keeps firing.\n */\n subscriptionMute(args: { rule_id: Uuid; muted: boolean }): Promise<RecordsResult<boolean>>;\n /**\n * WRITE ONE. The store refuses a cadence no runner acts on, a channel this\n * platform does not send on and quiet hours nobody can parse — by name — then\n * declares the Rule through `rule_declare`, because a Rule written as a record\n * carries `data_class = 'record'` and every reader that goes looking for a Rule\n * steps straight past it (REC-72).\n */\n subscriptionDeclare(args: {\n table_id: Uuid;\n spec: SubscriptionSpec;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * SHOW ME ONE NOW. The summary this subscription would send at this moment, with\n * what entered, left and changed NAMED. It assembles only: nothing is delivered,\n * nothing is recorded and the watermark does not move.\n */\n subscriptionPreview(args: { rule_id: Uuid }): Promise<RecordsResult<DigestPreview>>;\n /**\n * THE SAVED VIEWS OF A TABLE — what a subscription may be written over. Narrowed\n * in SQL as the definer to Tables this caller can already open, so the list can\n * never reveal a Table.\n */\n views(args?: { table_id?: Uuid | null }): Promise<RecordsResult<SavedViewRow[]>>;\n /**\n * SAVE ONE VIEW. VIEWER on the Table, not editor: writing down a question about a\n * Table is not changing it, and requiring editor would mean the people who read a\n * Table could not subscribe to anything in it.\n */\n viewDeclare(args: { table_id: Uuid; spec: SavedViewSpecIn }): Promise<RecordsResult<Uuid>>;\n\n // ── documents (W3-DOC): save, render once, sign the exact bytes ──────────\n docTemplateSave(args: {\n table_id: Uuid;\n name: string;\n body: string;\n template_id?: Uuid | null;\n }): Promise<RecordsResult<Uuid>>;\n /** The body with every token resolved against one record. Read-only, no render row. */\n docRenderBody(args: { template_id: Uuid; record_id: Uuid }): Promise<RecordsResult<string>>;\n /** Write the render — frozen bytes a signature can be checked against. */\n docRenderDocument(args: { template_id: Uuid; record_id: Uuid }): Promise<RecordsResult<Uuid>>;\n /** Every token in a body, in order, with the Field id each one points at. */\n docTokens(args: { body: string }): Promise<RecordsResult<DocToken[]>>;\n /** The tokens this Table cannot answer, each with the store's own reason. */\n docUnresolvedTokens(args: { table_id: Uuid; body: string }): Promise<RecordsResult<DocUnresolvedToken[]>>;\n docSign(args: {\n render_id: Uuid;\n field_key: string;\n signer_name: string;\n signer_user_id?: Uuid | null;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * One signature: the seal AND whether what was signed is still what is there.\n * The store answers both, in one call, never the screen. Viewer on the record.\n */\n docSignatureRead(args: { signature_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Every template that renders one Table. Viewer on the Table. */\n docTemplates(args: { table_id: Uuid }): Promise<RecordsResult<DocTemplateRow[]>>;\n /**\n * Retire one template. EDITOR on the Table it renders, because a template is\n * that Table's wording. Documents already rendered keep their frozen bytes\n * and their seals, so this can never invalidate a signature.\n */\n docTemplateDelete(args: { template_id: Uuid }): Promise<RecordsResult<boolean>>;\n /** Every frozen render of one record, newest first. Viewer on the record. */\n docRenders(args: { record_id: Uuid }): Promise<RecordsResult<DocRenderRow[]>>;\n /** Every signature on one record. Viewer on the record. */\n docSignatures(args: { record_id: Uuid }): Promise<RecordsResult<DocSignatureRow[]>>;\n /**\n * DOOR-11. One record's revisions, newest first. The read door answers\n * documents and deliberately not versions, so a screen that wants to save\n * optimistically reads the version of the record it LOADED from here — for\n * the one record being edited, never for a list.\n */\n revisions(args: { record_id: Uuid }): Promise<RecordsResult<RecordRevision[]>>;\n /**\n * PRODUCTS row 4. One record's version list, newest first: who (a person, or\n * an agent AND the person it acted for), when, the operation in the word\n * somebody used, and every field that moved with its before, its after, the\n * Rule version that produced a derived value and its source pointer. Viewer\n * on the record — reading how something got to be the way it is is reading.\n */\n recordHistory(args: {\n record_id: Uuid;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<RecordHistoryEntry[]>>;\n /**\n * AGT-N-9 — EVERYTHING A CHAT OPENED ON THIS RECORD MAY KNOW, IN ONE ROUND TRIP.\n *\n * The Fields with their `(record, field, value version)` triples, the relations one hop\n * out, the history, the comments and the Table's other records — assembled INSIDE the\n * database, every piece through the read door, under this person's own field-level\n * security. A Field the store masks comes back in `withheld` with the store's own\n * sentence and no value; a Field the organization keeps out of conversations comes back\n * there too, saying which of the two it is.\n */\n recordScopeContext(args: {\n record_id: Uuid;\n relations?: number;\n history?: number;\n siblings?: number;\n }): Promise<RecordsResult<RecordScopeContext>>;\n /** What is this conversation about? */\n conversationScope(args: { conversation_id: Uuid }): Promise<RecordsResult<ConversationScope>>;\n /** Point a conversation at one record. Refused unless this person may open it. */\n conversationScopeBind(args: {\n conversation_id: Uuid;\n record_id: Uuid;\n }): Promise<RecordsResult<ConversationScope>>;\n /** This conversation is no longer about a particular record. */\n conversationScopeUnbind(args: {\n conversation_id: Uuid;\n }): Promise<RecordsResult<ConversationScope>>;\n /** The binding AND the context of a bound conversation, in one round trip. */\n conversationScopeContext(args: {\n conversation_id: Uuid;\n relations?: number;\n history?: number;\n siblings?: number;\n }): Promise<RecordsResult<ConversationScopeContext>>;\n /**\n * \"Who changed the price on ANY record?\" One column's history across a whole\n * Table, narrowed to the records this person may see by a predicate in the\n * same statement. A column that names no Field is refused BY NAME, never\n * answered empty.\n */\n fieldHistory(args: {\n table_id: Uuid;\n field_key: string;\n limit?: number;\n offset?: number;\n record_id?: Uuid;\n }): Promise<RecordsResult<FieldHistoryEntry[]>>;\n /**\n * WHAT A RESTORE WOULD CHANGE, BEFORE IT DOES. Editor on the record: this is\n * the first half of an act, and somebody who may not perform it is not shown\n * its preview. Pass `field_key` for one column.\n */\n restorePreview(args: {\n record_id: Uuid;\n version: number;\n field_key?: string;\n }): Promise<RecordsResult<RestorePreview>>;\n /** Put the whole record back to a version, as a NEW version. Editor. */\n restoreVersion(args: { record_id: Uuid; version: number }): Promise<RecordsResult<RestoreResult>>;\n /** Put ONE column back to what it said at a version, as a NEW version (HIS-N-2). Editor. */\n valueRestore(args: {\n record_id: Uuid;\n field_key: string;\n version: number;\n }): Promise<RecordsResult<RestoreResult>>;\n /**\n * SCR-18. The record's comment thread with everybody named, plus what THIS\n * person may do in it — decided by the store, in the same call, so a screen\n * never draws a composer the write door will refuse.\n */\n commentThread(args: {\n record_id: Uuid;\n include_resolved?: boolean;\n }): Promise<RecordsResult<CommentThreadRead>>;\n /**\n * Write a comment at the `commenter` rung, optionally naming people. A\n * mention is a reference and not a regex over the body: the ids come from the\n * picker and the store refuses one who is not in the organization, or who\n * cannot open the record — because that notification would be a dead end.\n */\n commentWrite(args: {\n record_id: Uuid;\n body: string;\n field_key?: string;\n parent_comment_id?: Uuid;\n mentions?: Uuid[];\n }): Promise<RecordsResult<CommentWritten>>;\n /** Resolve (or re-open) a thread. `commenter` — resolution is not a delete. */\n commentResolve(args: { comment_id: Uuid; resolved?: boolean }): Promise<RecordsResult<boolean>>;\n /**\n * Every value of one record WITH its envelope — its own version, who wrote\n * it, who they were acting for and when. The timeline IS the record (REC-19);\n * there is no second history table.\n */\n recordValuesVersioned(args: { record_id: Uuid }): Promise<RecordsResult<ReadValue[]>>;\n\n // ── the doors that do not exist yet, named rather than faked ─────────────\n metadataSearch(args: { text: string }): Promise<RecordsResult<never>>;\n // ── the anonymous lane (W4-ANON) ─────────────────────────────────────────\n /**\n * Mint an embed token. `mode` is `read` OR `write` and never both — the store\n * refuses a token carrying two decisions. The secret comes back ONCE, because\n * only its digest is stored: a database read cannot produce a working token.\n * `allowedOrigins` is required and matched EXACTLY, so `example.com.evil.test`\n * fails a check that a suffix match would pass.\n */\n anonTokenIssue(args: {\n mode: \"read\" | \"write\";\n allowedOrigins: string[];\n formId?: Uuid | null;\n savedViewId?: Uuid | null;\n recordId?: Uuid | null;\n expiresAt?: Timestamp | null;\n }): Promise<RecordsResult<{ token_id: Uuid; secret: string }>>;\n /** What a secret is good for, from an origin. The store's sentence when it is not. */\n anonTokenVerify(args: {\n secret: string;\n origin: string;\n requiredMode?: \"read\" | \"write\" | null;\n }): Promise<RecordsResult<AnonTokenBinding>>;\n anonTokenRevoke(args: { token_id: Uuid }): Promise<RecordsResult<boolean>>;\n /**\n * A STRANGER'S WRITE. The token supplies the organization, so this call names\n * none — and what it produces is a QUARANTINED SUBMISSION, not a record:\n * `custom.record` is never touched here. `clientKey` makes a replay free and\n * idempotent, which is what lets a flaky phone retry safely.\n */\n anonWrite(args: {\n secret: string;\n origin: string;\n payload: Record<string, unknown>;\n clientKey?: string | null;\n rawPayload?: Record<string, unknown>;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * SCR-30, and it is the SIGNED-IN offline path, not the stranger's. The client\n * mints `clientKey` BEFORE the first attempt, offline, and the store's own\n * replay ledger dedupes on it — so a reconnect that fires the same capture\n * thirty times writes one record and returns the same id every time.\n */\n anonCapture(args: {\n table_id: Uuid;\n clientKey: string;\n payload: Record<string, unknown>;\n device?: string | null;\n capturedAt?: Timestamp | null;\n }): Promise<RecordsResult<Uuid>>;\n /** Open or close a form to strangers. An admin act on the Table, never an editor one. */\n anonPublish(args: { form_id: Uuid; published?: boolean }): Promise<RecordsResult<Timestamp | null>>;\n\n // ── checklists and SOP runs (PRODUCTS row 13) ────────────────────────────\n /**\n * What is wrong with a checklist somebody is writing, in the words they would\n * use. `null` means it is fine. Pure — it reads no row and writes nothing —\n * so an editor may ask it on every keystroke and the refusal arrives BEFORE\n * the save rather than after it.\n */\n checklistRefusal(args: { spec: ChecklistSpec }): Promise<RecordsResult<string | null>>;\n /**\n * Store a checklist, whole: ordered steps, who each belongs to by role, how\n * many days in each is due, what each waits for, what each asks for, and what\n * starts a run. Pass `template_id` to change the checklist that already\n * exists rather than making a second one.\n */\n checklistDeclare(args: {\n spec: ChecklistSpec;\n template_id?: Uuid | null;\n }): Promise<RecordsResult<ChecklistDeclared>>;\n checklistTemplates(args?: {\n about_table_id?: Uuid | null;\n limit?: number;\n }): Promise<RecordsResult<ChecklistTemplateSummary[]>>;\n checklistTemplateShape(args: { template_id: Uuid }): Promise<RecordsResult<ChecklistTemplateShape>>;\n /**\n * Run a checklist for one record: one work item per step in the ONE work\n * layer, assigned by role to real people, dated from the offsets,\n * dependencies carried across. `roles` names who stands in each role for THIS\n * run, over whatever the checklist says by default.\n */\n checklistStart(args: {\n template_id: Uuid;\n about_record_id?: Uuid | null;\n roles?: Record<string, Uuid>;\n startingAt?: Timestamp | null;\n }): Promise<RecordsResult<ChecklistRunStarted>>;\n checklistRun(args: { run_id: Uuid }): Promise<RecordsResult<ChecklistRunStep[]>>;\n checklistRuns(args?: {\n about_table_id?: Uuid | null;\n about_record_id?: Uuid | null;\n includeClosed?: boolean;\n limit?: number;\n }): Promise<RecordsResult<ChecklistRunSummary[]>>;\n /**\n * Tick a step off with whatever it asked for. Refused by name while a step it\n * waits for is open, or while what it asks for is missing — and the same\n * refusal meets `workSetState`, because the rule lives in the store and not\n * in this door.\n */\n checklistStepComplete(args: {\n step_id: Uuid;\n evidence?: Record<string, unknown>;\n }): Promise<RecordsResult<ChecklistStepCompleted>>;\n /** Why this step cannot be finished right now. `null` means it can. */\n checklistStepRefusal(args: { step_id: Uuid }): Promise<RecordsResult<string | null>>;\n\n // ── work (W4-WORK): templates, turns and slots ───────────────────────────\n /** The five states and what each one may become. Asked, never hardcoded in a picker. */\n workStates(): Promise<RecordsResult<WorkState[]>>;\n /** Why this graph would be refused — asked BEFORE it is written. `null` means it is fine. */\n workTemplateRefusal(args: { graph: WorkGraph }): Promise<RecordsResult<string | null>>;\n workTemplateDeclare(args: { name: string; graph: WorkGraph }): Promise<RecordsResult<Uuid>>;\n /**\n * REC-70: the WHOLE graph is created in one act, judged before any of it is\n * written, so a half-made checklist is not a state this store can be in.\n */\n workTemplateInstantiate(args: {\n template_id: Uuid;\n overrides?: Record<string, Record<string, unknown>>;\n }): Promise<RecordsResult<WorkInstantiation>>;\n workTemplateShape(args: { template_id: Uuid }): Promise<RecordsResult<unknown>>;\n workInstantiationShape(args: { instantiation_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Whose turn each record is, with its state and whether that state is terminal. */\n workWhoseTurn(args: { table_id: Uuid; includeFinished?: boolean }): Promise<RecordsResult<WorkTurn[]>>;\n /** Does this Table carry assignment at all? A screen asks before it offers one. */\n workHasAssignment(args: { table_id: Uuid }): Promise<RecordsResult<boolean>>;\n /** The Fields assignment is made of, so nothing here invents a column name. */\n workAssignmentFields(args?: { options_table_id?: Uuid | null }): Promise<RecordsResult<WorkAssignmentField[]>>;\n /** Add assignment to a Table. */\n workTakeAssignment(args: { table_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Why this move would be refused. `null` means it is allowed. */\n workTransitionRefusal(args: { from_state_id: Uuid; to_state_id: Uuid }): Promise<RecordsResult<string | null>>;\n /** Declare the Table slots are held in. Idempotent — a second call finds the first. */\n workSlotsDeclare(args: { name: string; slug: string; homeId?: Uuid | null }): Promise<RecordsResult<unknown>>;\n /**\n * SCR-29. Take a slot for a while. THE STORE decides, under a unique index —\n * two people racing for the same slot do not both get it, whatever either\n * screen believed a moment earlier.\n */\n workSlotHold(args: {\n table_id: Uuid;\n slotKey: string;\n holder: string;\n ttl?: string;\n }): Promise<RecordsResult<unknown>>;\n workSlotRelease(args: { hold_id: Uuid }): Promise<RecordsResult<boolean>>;\n /** Every hold on this Table, with whether it has already lapsed. */\n workSlotHolds(args: { table_id: Uuid }): Promise<RecordsResult<WorkSlotHold[]>>;\n workSlotExpire(args: { table_id: Uuid }): Promise<RecordsResult<number>>;\n\n // ── the work layer a person actually uses (lane WORK-DOORS, 2026-09-20) ──\n /**\n * THE ONE INBOX. Assignments, approvals and the agent's proposals, in one\n * ordered list with ONE row shape — PRODUCTS.md row 6. A second queue for the\n * agent's suggestions is the thing this replaces.\n */\n workInbox(args?: {\n limit?: number;\n offset?: number;\n includeDecided?: boolean;\n }): Promise<RecordsResult<WorkInboxItem[]>>;\n /** \"My work\", \"work I assigned\", \"waiting on somebody being chosen\". */\n workList(args?: {\n flavour?: WorkListFlavour;\n includeFinished?: boolean;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<WorkListItem[]>>;\n /**\n * Give one record to one person: the Assignee value AND editor access, in one\n * transaction. Passing no `user_id` un-assigns and says plainly that nobody's\n * access was taken away.\n */\n workAssign(args: {\n record_id: Uuid;\n user_id?: Uuid | null;\n dueDate?: string | null;\n clearDue?: boolean;\n }): Promise<RecordsResult<WorkAssignment>>;\n /** The states this record may be moved to, and the sentence for each it may not. */\n workRecordStates(args: { record_id: Uuid }): Promise<RecordsResult<WorkRecordState[]>>;\n /** Move it. The store refuses a move the model forbids, in its own words. */\n workSetState(args: { record_id: Uuid; state_id: Uuid | null }): Promise<RecordsResult<unknown>>;\n /** The person-kernel record standing for a signed-in person here. */\n workPerson(args: { user_id: Uuid; create?: boolean }): Promise<RecordsResult<Uuid | null>>;\n /** The templates this person may run, so a picker has ids to offer. */\n workTemplates(args?: { limit?: number }): Promise<RecordsResult<Array<{\n template_id: Uuid;\n name: string;\n nodes: number;\n relations: number;\n created_at: string;\n }>>>;\n /** Who may decide a change about this subject, and why each of them may. */\n workApprovalApprovers(args: {\n subject_id: Uuid | null;\n approver_id?: Uuid | null;\n }): Promise<RecordsResult<WorkApprover[]>>;\n /** Ask for a change instead of making it. Viewer on the subject is enough to ASK. */\n workApprovalRequest(args: {\n subject_id: Uuid;\n change: WorkChange;\n note?: string | null;\n approver_id?: Uuid | null;\n origin?: \"person\" | \"agent\";\n conversation_id?: Uuid | null;\n }): Promise<RecordsResult<WorkApprovalFiled>>;\n /** Whether THIS person may decide THIS one — so a screen never draws a dead button. */\n workApprovalMayDecide(args: { approval_id: Uuid }): Promise<RecordsResult<boolean>>;\n /** Approve or decline. Approving APPLIES the change, as the person approving. */\n workApprovalDecide(args: {\n approval_id: Uuid;\n approve: boolean;\n note?: string | null;\n }): Promise<RecordsResult<WorkApprovalDecision>>;\n /** One waiting change in full, for the person deciding it or the one who asked. */\n workApprovalRead(args: { approval_id: Uuid }): Promise<RecordsResult<Record<string, unknown>>>;\n\n // ── the trust doors: `iam`'s, not the store's ────────────────────────────\n /** VIS-31. Is this account a signed-in outsider — no NON-personal organization? */\n isExternalPrincipal(args?: { user_id?: Uuid | null }): Promise<RecordsResult<boolean>>;\n /** The same answer WITH the plain-English reason a screen shows. */\n externalPrincipalCard(args?: { user_id?: Uuid | null }): Promise<RecordsResult<ExternalPrincipalCard>>;\n /** Exactly the resource ids Visibility gave that outsider. Never an organization's list. */\n externalPrincipalReach(args: {\n resourceType: string;\n user_id?: Uuid | null;\n }): Promise<RecordsResult<Array<{ resource_id: Uuid }>>>;\n /** VIS-32. Bind a record or a view to a public address with a declared render mode. */\n publishBindingCreate(args: {\n slug: string;\n resourceType: string;\n resource_id: Uuid;\n renderMode?: string;\n }): Promise<RecordsResult<PublishBinding>>;\n publishBindingRevoke(args: { slug: string }): Promise<RecordsResult<unknown>>;\n /** What a SIGNED-OUT visitor resolves. Empty for an invented, revoked or unpublished address. */\n resolvePublishBinding(args: { slug: string }): Promise<RecordsResult<ResolvedPublishBinding[]>>;\n /** D-15. The ONE sentence admitting nothing was scanned, so four surfaces cannot drift. */\n worldPublishGapNotice(): Promise<RecordsResult<string>>;\n /** Put a resource in the world lane. Refuses by name while the lane is closed. */\n publishToWorld(args: {\n resourceType: string;\n resource_id: Uuid;\n discoverable?: boolean;\n }): Promise<RecordsResult<unknown>>;\n /**\n * Declare a Rule. It is NOT `recordWrite` into the rule kernel, and that is\n * the whole point: `custom.record_write` inserts `data_class = 'record'`, so a\n * document written that way is not a Rule and the store's own rule doors\n * (`custom.rule_members`, `custom.agg_subscriptions`) never see it. Writing\n * one through the record door and calling it a Rule would be a silent\n * failure — a screen that looked like it had subscribed you to something.\n */\n ruleDeclare(args: { spec: Record<string, unknown>; rule_id?: Uuid | null }): Promise<RecordsResult<Uuid>>;\n fieldPropose(proposal: FieldProposal): Promise<RecordsResult<never>>;\n tablePropose(proposal: TableProposal): Promise<RecordsResult<never>>;\n\n // ── promotion (REC-5) ────────────────────────────────────────────────────\n promoteTable(args: { table_id: Uuid }): Promise<RecordsResult<unknown>>;\n promoteField(args: { table_id: Uuid; field_id: Uuid }): Promise<RecordsResult<unknown>>;\n\n /** Is the store switched on for this organization? A product switch, never the boundary. */\n storeIsOpen(): Promise<RecordsResult<boolean>>;\n /**\n * WHAT THIS PERSON MAY DO TO THESE THINGS — asked once, for a whole page.\n *\n * There is no principal argument, on purpose: the door resolves the caller\n * from the session, so a person can ask about their OWN access and about\n * nobody else's. A subject they hold nothing on answers `level: null`, which\n * is an answer; the row is never omitted, because a screen that could not\n * tell \"no access\" from \"not asked yet\" would draw one of them as the other.\n */\n myLevels(args: { ids: Uuid[]; subject?: \"record\" }): Promise<RecordsResult<MyLevel[]>>;\n\n // ── THE GRID (lane GRID-PRIMITIVES) — see ../grid.ts for every shape ─────\n /** G1. Write ONE leaf of a Table's colors, or clear it with `null`. Editor on the Table. */\n tableDecorate(args: { table_id: Uuid; path: DecorationPath; value: unknown }): Promise<RecordsResult<TableDecorations>>;\n /** G1. A Table's colors as a screen paints them, with what went stale named. */\n tableDecorations(args: { table_id: Uuid }): Promise<RecordsResult<TableDecorations>>;\n /** G1. The layout a grid opens with: platform → organization knob → the view's own. */\n gridLayout(args: { table_id: Uuid; view_id?: Uuid | null }): Promise<RecordsResult<GridLayout>>;\n /** G3. The older grid's formula text → the store's expression. Never refuses a typo: answers ok:false. */\n formulaParse(args: { table_id: Uuid; text: string }): Promise<RecordsResult<FormulaParse>>;\n /** G2. Declare a Table's row actions — the whole list. Editor on the Table. */\n actionDeclare(args: { table_id: Uuid; actions: RowAction[] }): Promise<RecordsResult<RowAction[]>>;\n /** G2. A Table's row actions, each saying whether it can run here. */\n rowActions(args: { table_id: Uuid }): Promise<RecordsResult<{ actions: RowAction[]; stale: unknown[] }>>;\n /**\n * G2. Run one action on a selection, in ONE transaction. A refusal changed NOTHING; read\n * every record and field that refused with `actionRefusals(result.error)`.\n */\n actionRun(args: { action_id: Uuid; record_ids: Uuid[] }): Promise<RecordsResult<ActionRunResult>>;\n /** G4. Send every change to this Table's records to an https webhook. Admin. The secret is shown once. */\n tableWebhookDeclare(args: {\n table_id: Uuid;\n target_url: string;\n events?: RecordEvent[] | null;\n description?: string | null;\n }): Promise<RecordsResult<TableWebhookDeclared>>;\n /** G4. The webhooks a Table sends to, with their delivery health — never the secret. */\n tableWebhooks(args: { table_id: Uuid }): Promise<RecordsResult<TableWebhook[]>>;\n /** G4. Switch one off. It is never deleted. */\n tableWebhookArchive(args: { webhook_id: Uuid }): Promise<RecordsResult<boolean>>;\n /**\n * G5. Build one real use case's tables here, rows and relations included, in one\n * transaction. `useCaseId` is one of `useCaseIds()` from `@ai-matrx/records/use-cases`.\n */\n tableFromExample(args: { home_id: Uuid; useCaseId: string }): Promise<RecordsResult<ExampleBuilt>>;\n /** G5. Number the records an autonumber column found already there, in creation order. */\n autonumberBackfill(args: { field_id: Uuid }): Promise<RecordsResult<{ numbered: number; highest: number | null; says: string }>>;\n /** G5. One page of the export door — exactly the rows and columns the read door serves this person. */\n ioExport(args: { table_id: Uuid; columns?: string[] | null; limit?: number }): Promise<RecordsResult<IoExportPage>>;\n /** G5. That page as an .xlsx; a withheld column is named on its own sheet. */\n exportXlsx(args: {\n table_id: Uuid;\n columns?: string[] | null;\n limit?: number;\n labels?: Record<string, string>;\n sheetLabel?: string;\n }): Promise<RecordsResult<Uint8Array>>;\n}\n\nexport function createRecordsClient(config: RecordsConfig): RecordsClient {\n const schema = config.schema ?? DEFAULT_SCHEMA;\n const org = config.organizationId;\n const scream = sink(config);\n\n async function callDoor<T>(\n door: string,\n args: Record<string, unknown>,\n where: string,\n ): Promise<RecordsResult<T>> {\n if (!doorExists(door)) {\n const refusal = doorAbsent(door);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where });\n return err(refusal);\n }\n // THE SCHEMA IS SAID OUT LOUD. A door of the store is `custom.<name>`, and\n // a host's supabase client resolves an unqualified `rpc()` against its own\n // default PostgREST profile — `public` in every client we ship. Leaving it\n // off therefore asked `public.store_is_open`, which the browser extension\n // found for us on its first real turn (2026-09-18, W6-EXT): \"Could not find\n // the function public.store_is_open(p_organization_id) in the schema cache\".\n // The package knows which schema it lives in, so it is the package that\n // says so, once, here — never every host remembering to.\n const response = await config.dataSource.rpc(`${door}`, args, { schema });\n if (response.error) {\n const refusal = mapPgError(response.error, where);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where });\n return err(refusal);\n }\n return ok(response.data as T);\n }\n\n /**\n * A TRUST DOOR — `iam`'s, not the store's.\n *\n * There is no `doorExists` check here on purpose: the store's generated\n * catalogue reads `custom` and only `custom`, so a census of it says nothing\n * true about `iam`. A trust door that is not there answers with Postgres's\n * own `42883`, which arrives through the same refusal funnel carrying the\n * name that was called — an honest \"no such function\", never an empty array\n * standing in for \"there is nothing\".\n */\n async function trustDoor<T>(\n door: string,\n args: Record<string, unknown>,\n where: string,\n ): Promise<RecordsResult<T>> {\n const response = await config.dataSource.rpc(door, args, { schema: TRUST_SCHEMA });\n if (response.error) {\n const refusal = mapPgError(response.error, where);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where });\n return err(refusal);\n }\n return ok(response.data as T);\n }\n\n /**\n * A DOOR OF THE OLDER STORE — `workbench`'s, not this store's.\n *\n * Same reasoning as `trustDoor`: the generated catalogue reads `custom` and\n * only `custom`, so `doorExists` says nothing true about `workbench` and\n * there is deliberately no census check here. A door that is not there\n * arrives as Postgres's own `42883` through the same refusal funnel, carrying\n * the name that was called — an honest \"no such function\", never an empty map\n * standing in for \"these cells have no words\".\n */\n async function workbenchDoor<T>(\n door: string,\n args: Record<string, unknown>,\n where: string,\n ): Promise<RecordsResult<T>> {\n const response = await config.dataSource.rpc(door, args, { schema: WORKBENCH_SCHEMA });\n if (response.error) {\n const refusal = mapPgError(response.error, where);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where });\n return err(refusal);\n }\n return ok(response.data as T);\n }\n\n /**\n * The read door returns ONE masked document with the notices folded in under\n * `_hidden` (`custom.mask_document`). A screen wants them apart: the values it\n * draws, and the reasons it shows where a value is missing. This splits them\n * and nothing else — it never decides what is hidden, it only reads what the\n * store already decided.\n */\n function unfold(document: unknown): { document: RecordDocument; hidden: Record<string, HiddenFieldNotice> } {\n const raw = (document ?? {}) as Record<string, unknown>;\n const hidden = (raw._hidden ?? {}) as Record<string, HiddenFieldNotice>;\n const values: RecordDocument = {};\n for (const [key, value] of Object.entries(raw)) {\n if (key === \"_hidden\") continue;\n values[key] = value;\n }\n return { document: values, hidden };\n }\n\n async function readValues(recordId: Uuid): Promise<RecordsResult<ReadValue[]>> {\n return callDoor<ReadValue[]>(\n DOORS.recordValuesVersioned,\n { p_organization_id: org, p_record_id: recordId },\n \"recordRead\",\n );\n }\n\n const client: RecordsClient = {\n config,\n\n async recordWrite({ table_id, data }) {\n // THE OP ID RIDES THE ENVELOPE. `_op_id` is a platform envelope key — the same class as\n // `_actor` — which the store lifts out BEFORE its undeclared-key guard and BEFORE\n // storage, so it never lands on the record. It comes back in the realtime notice, which\n // is how this browser recognises the echo of its own write and does not re-read a page\n // it has already updated. See `../ops.ts`.\n return callDoor<Uuid>(\n DOORS.recordWrite,\n { p_organization_id: org, p_table_id: table_id, p_data: { ...data, _op_id: mintOpId() } },\n \"recordWrite\",\n );\n },\n\n async recordWriteMany({ table_id, rows, ids }) {\n // ONE CALL IS ONE OPERATION, so one op id for the whole batch: the store announces one\n // statement once, and it REFUSES a batch carrying two different ids by name.\n const opId = mintOpId();\n return callDoor<Uuid[]>(\n DOORS.recordWriteMany,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_rows: rows.map((row) => ({ ...row, _op_id: opId })),\n ...(ids === undefined ? {} : { p_ids: ids }),\n },\n \"recordWriteMany\",\n );\n },\n\n async recordWriteGraph({ table_id, parent, children, edges }) {\n // ONE GRAPH IS ONE OPERATION, so one op id for the whole thing: the door copies the\n // parent's onto every child, and the store announces the statement once.\n const opId = mintOpId();\n return callDoor<RecordGraphWritten>(\n DOORS.recordWriteGraph,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_parent: { ...parent, _op_id: opId },\n p_edges: edges ?? [],\n p_children: (children ?? []).map((child) => ({\n data: child.data,\n role: child.role,\n ...(child.table_id === undefined ? {} : { table_id: child.table_id }),\n ...(child.position === undefined ? {} : { position: child.position }),\n })),\n },\n \"recordWriteGraph\",\n );\n },\n\n async recordUpdate({ record_id, patch, expectedVersion }) {\n const result = await callDoor<number>(\n DOORS.recordUpdate,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_patch: { ...patch, _op_id: mintOpId() },\n ...(expectedVersion === undefined ? {} : { p_expected_version: expectedVersion }),\n },\n \"recordUpdate\",\n );\n if (result.ok) announceRecordChanged(record_id);\n return result;\n },\n\n async recordDelete({ record_id }) {\n const result = await callDoor<Timestamp>(\n DOORS.recordDelete,\n { p_organization_id: org, p_record_id: record_id },\n \"recordDelete\",\n );\n if (result.ok) announceRecordChanged(record_id);\n return result;\n },\n\n async recordRestore({ record_id }) {\n const result = await callDoor<void>(\n DOORS.recordRestore,\n { p_organization_id: org, p_record_id: record_id },\n \"recordRestore\",\n );\n if (result.ok) announceRecordChanged(record_id);\n return result;\n },\n\n async tableArchive({ table_id, chunk, includeTable }) {\n // EVERY ARGUMENT IS SAID OUT LOUD, including the two the function\n // defaults. A caller that leaves `p_chunk` off is agreeing to a number it\n // cannot see, and a loop's pass size is the one thing a loop actually has\n // an opinion about. So the package states it — and the door still clamps\n // it and reports what it actually took.\n //\n // WHY 50 AND NOT 200. Measured against the live store on 2026-09-22, one\n // record costs about 35ms to archive: `custom.record_delete` runs a delete\n // rule, an access check, a history capture and an outbox row for each one.\n // A pass of 200 is therefore ~7s against a PostgREST statement timeout of\n // 8 — it DIED on `57014` on the first real table it was pointed at, which\n // is the very defect this door exists to fix, moved one level up. 50 is\n // ~1.8s: four times the headroom, and the same number the live function\n // chose for itself.\n return callDoor<TableArchiveProgress>(\n DOORS.tableArchive,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_chunk: chunk ?? 50,\n p_include_table: includeTable ?? true,\n },\n \"tableArchive\",\n );\n },\n\n async recordRead({ record_id, withComputed = false }) {\n // DOOR-1: `custom.read_record` resolves the reader from the session,\n // refuses a record they have no visibility on in the store's own sentence,\n // and masks the fields their level does not reach. This client no longer\n // selects `custom.record` for a read — that path returned rows and fields\n // the store had not agreed this person could see.\n const door = await callDoor<unknown>(\n DOORS.readRecord,\n { p_organization_id: org, p_record_id: record_id },\n \"recordRead\",\n );\n if (!door.ok) return err(door.error);\n const { document, hidden } = unfold(door.data);\n\n // 🚨 A DECORATION NEVER TAKES THE RECORD AWAY (lane LIMITS-FIX-UI, 2026-09-21).\n //\n // `custom.computed_provenance` answers WHICH RULE produced a worked-out value\n // (FLD-9). It is a footnote beside the record — and it has NO EXECUTE grant to\n // `authenticated`, measured on the live catalogue:\n //\n // read_record authenticated may: t\n // record_history authenticated may: t\n // field_history authenticated may: t\n // computed_provenance authenticated may: f\n //\n // `Peek` asks for the record WITH provenance, so this line returned that door's\n // refusal AS THE RECORD'S: the owner of an organization opened a record in it and\n // was told \"You do not have access to this\", above a history, a running checklist\n // and a comment box that all loaded perfectly. Reported twice — by the SCREENS-2\n // lane on a dental practice, and by crew E2, who checked at the doors and found\n // the record read itself answering correctly from that very seat.\n //\n // So the record comes back. The footnote's absence is REPORTED rather than\n // swallowed (nothing fails silently): `computedUnavailable` carries the refusal,\n // and a screen that draws rule provenance says it could not read it instead of\n // drawing nothing and meaning two different things by it.\n let computed: RecordRead[\"computed\"] = [];\n let computedUnavailable: RecordsError | null = null;\n if (withComputed) {\n const provenance = await callDoor<RecordRead[\"computed\"]>(\n DOORS.computedProvenance,\n { p_organization_id: org, p_record_id: record_id },\n \"recordRead.computed\",\n );\n if (provenance.ok) computed = provenance.data ?? [];\n else computedUnavailable = provenance.error;\n }\n return ok({ record_id, document, hidden, computed, computedUnavailable });\n },\n\n async listByIds({ table_id, ids }) {\n // NOTHING ASKED FOR IS AN EMPTY ANSWER, not a round trip. The door says the same, but\n // a call that cannot return a row should not cost one.\n if (ids.length === 0) return ok([]);\n const door = await callDoor<Array<{ id: Uuid; document: unknown; level: string }>>(\n DOORS.readRecordsByIds,\n { p_organization_id: org, p_table_id: table_id, p_record_ids: ids },\n \"listByIds\",\n );\n if (!door.ok) return err(door.error);\n return ok(\n (door.data ?? []).map((row) => {\n const { document, hidden } = unfold(row.document);\n return { id: row.id, document, level: row.level, hidden };\n }),\n );\n },\n\n async tableArchived({ table_id }) {\n // Through the SAME archived door a table's own archive uses, addressed at\n // the Table kernel (every Table is a record in it). Paged until the door\n // answers short, so a Table past the first page is still found.\n const kernel = await callDoor<Uuid>(DOORS.tableKernelId, {}, \"tableArchived.kernel\");\n if (!kernel.ok) return err(kernel.error);\n const PAGE = 200;\n for (let page = 0; page < 25; page += 1) {\n const answered = await this.listArchived({\n table_id: kernel.data,\n lane: \"org\",\n limit: PAGE,\n offset: page * PAGE,\n });\n if (!answered.ok) return err(answered.error);\n const hit = answered.data.rows.find((row) => row.id === table_id);\n if (hit) return ok(hit);\n if (answered.data.total !== null) return ok(null);\n }\n return ok(null);\n },\n\n async listArchived({ table_id, lane = DEFAULT_ARCHIVE_LANE, limit = 50, offset = 0 }) {\n // THE ROWS THAT LEFT, THROUGH THE STORE. The lane is handed to the door\n // rather than applied here, for the reason every filter in this client is:\n // a browser can only ever narrow the rows it was already given, so a lane\n // decided on this side would silently drop the rest of the answer and call\n // it \"mine\".\n const door = await callDoor<ArchivedDoorRow[]>(\n DOORS.readRecordsArchived,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_lane: lane,\n p_limit: limit,\n p_offset: offset,\n },\n \"listArchived\",\n );\n if (!door.ok) return err(door.error);\n const rows: ArchivedRow[] = (door.data ?? []).map((row) => {\n const { document, hidden } = unfold(row.document);\n return {\n id: row.id,\n document,\n level: row.level,\n hidden,\n archivedAt: row.archived_at,\n archivedBy: row.archived_by ?? null,\n archivedByName: row.archived_by_name ?? null,\n };\n });\n // The same honest arithmetic `list` does, for the same reason: a short\n // page has reached the end of the set this reader may see, so its size is\n // known; a full page says only \"at least this many\", which is not a total.\n const total = rows.length < limit ? offset + rows.length : null;\n return ok({ rows, total });\n },\n\n async list({ table_id, filter, limit = 50, offset = 0 }) {\n // ONE DOOR FOR ALL FOUR SURFACES. The grid, the board, the record list\n // and a dashboard drill-through all arrive here, and they all ask\n // `custom.read_records_matching` — with `{}` when nobody asked a\n // question. The filtered and the unfiltered page are then the SAME body\n // in the database, decided by the same ladder, so a narrowed screen can\n // never be a differently-judged screen.\n const door = await callDoor<Array<{ id: Uuid; document: unknown; level: string }>>(\n DOORS.readRecordsMatching,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_filter: filter ?? {},\n p_limit: limit,\n p_offset: offset,\n },\n \"list\",\n );\n if (!door.ok) return err(door.error);\n const rows: ReadRow[] = (door.data ?? []).map((row) => {\n const { document, hidden } = unfold(row.document);\n return { id: row.id, document, level: row.level, hidden };\n });\n // WHAT THE TOTAL HONESTLY IS, AND WHEN IT IS KNOWN FOR NOTHING.\n //\n // The door reads live records only — a deleted record is not in its set —\n // and it counts nothing, so a total taken from the table would be a count\n // of rows this reader may not see, with a number on it. That stays true\n // and no count is ever asked for.\n //\n // But a SHORT PAGE already answers the question. If the door was asked\n // for `limit` and handed back fewer, the reader has reached the end of\n // the set it is allowed to see, so the size of that set is exactly\n // `offset + rows.length` — the visible total, arrived at by arithmetic on\n // a page that had to be read anyway, with no second query and no leak.\n // Until 2026-09-21 this answered null unconditionally and a table holding\n // ten records told its owner \"Unknown total — showing the 10 records\n // loaded so far\", which is a screen refusing to say a thing it knows.\n //\n // 🚨 THIS RESTS ON ONE FACT ABOUT THE DOOR, AND THE FACT IS NOT THE\n // OBVIOUS ONE. `custom.read_records_matching` DOES clamp through\n // `custom.page_size(org, door, limit, 200)` — the first draft of this\n // comment said it did not, and the live clause below caught that while it\n // was being written. What makes the inference safe is what that helper\n // does at the ceiling: measured on the live store 2026-09-21, a request\n // over it is REFUSED BY NAME — \"custom.read_records_matching was asked for 1001\n // rows; this store serves at most 1000 rows in one page, so nothing was\n // read rather than quietly reading fewer\" — and 1, 50, 200 and 1000 each\n // come back as themselves. A page is therefore never quietly made\n // smaller, so a successful call that returns fewer rows than it asked for\n // has reached the end of the set and nothing else.\n //\n // If that ever changed — if the door began shrinking a page instead of\n // refusing it — a clamped FULL page would read as a short one and a\n // person with two hundred records would be told they have fifty. So the\n // live suite asserts the refusal, not the absence of a clamp; that clause\n // is what makes this inference safe to keep rather than a thing that\n // quietly rots.\n //\n // A FULL page says only \"at least this many\", which is not a total, so it\n // stays null and the screen keeps saying what it is actually showing.\n const total = rows.length < limit ? offset + rows.length : null;\n return ok({ rows, total });\n },\n\n async query(input) {\n const plan = planQuery(input);\n const sets: Uuid[][] = [];\n for (const call of plan.relationCalls) {\n const result = await callDoor<Array<{ relation_targets: Uuid } | Uuid>>(\n DOORS.relationTargets,\n { p_organization_id: org, p_record_id: call.record_id, p_via_key: call.via_key },\n \"query.relations\",\n );\n if (!result.ok) return err(result.error);\n sets.push(\n (result.data ?? []).map((row) =>\n typeof row === \"string\" ? row : (row as { relation_targets: Uuid }).relation_targets,\n ),\n );\n }\n for (const call of plan.promotedCalls) {\n const result = await callDoor<Array<{ promoted_read: Uuid } | Uuid>>(\n DOORS.promotedRead,\n {\n p_organization_id: org,\n p_table_id: plan.read.table_id,\n p_field_key: call.field_key,\n p_value: call.value,\n },\n \"query.promoted\",\n );\n if (!result.ok) return err(result.error);\n sets.push(\n (result.data ?? []).map((row) =>\n typeof row === \"string\" ? row : (row as { promoted_read: Uuid }).promoted_read,\n ),\n );\n }\n\n const ids = plan.intersects ? intersectIds(sets) : null;\n if (ids !== null && ids.length === 0) {\n return ok({ rows: [], total: 0 });\n }\n\n // DOOR-8: an as-of read is the STORE'S question, on the store's two\n // clocks — `p_recorded_at` is what the store said at that moment, and\n // `p_world_on` is what was true of the world on that date. This client\n // used to answer the record clock itself with `updated_at <= at` and\n // refuse the world clock by name; both were workarounds for doors that\n // now exist (`custom.query_table_as_of` / `custom.query_record_as_of`),\n // and neither ever looked at a dated value.\n if (plan.read.asOf) {\n const clock = plan.read.asOf.clock === \"world\"\n ? { p_world_on: plan.read.asOf.at.slice(0, 10) }\n : { p_recorded_at: plan.read.asOf.at };\n if (ids !== null) {\n const answers = await Promise.all(\n ids.slice(0, plan.read.limit).map((id) =>\n callDoor<unknown>(\n DOORS.queryRecordAsOf,\n { p_organization_id: org, p_record_id: id, ...clock },\n \"query.asOf\",\n ).then((result) => ({ id, result })),\n ),\n );\n const rows: ReadRow[] = [];\n for (const { id, result } of answers) {\n if (!result.ok) return err(result.error);\n // A null answer is the door saying \"not visible to you at that\n // time\", which is an absence, not an empty record.\n if (result.data === null) continue;\n const { document, hidden } = unfold(result.data);\n rows.push({ id, document, level: \"viewer\", hidden });\n }\n return ok({ rows, total: rows.length });\n }\n const page = await callDoor<Array<{ record_id: Uuid; data: unknown }>>(\n DOORS.queryTableAsOf,\n {\n p_organization_id: org,\n p_table_id: plan.read.table_id,\n ...clock,\n p_limit: plan.read.limit,\n p_offset: plan.read.offset,\n },\n \"query.asOf\",\n );\n if (!page.ok) return err(page.error);\n const rows: ReadRow[] = (page.data ?? [])\n .filter((row) => row.data !== null)\n .map((row) => {\n const { document, hidden } = unfold(row.data);\n return { id: row.record_id, document, level: \"viewer\", hidden };\n });\n return ok({ rows, total: null });\n }\n\n // The live read, through the read door and nothing else. With a planned\n // id set the door is asked one record at a time (it is keyed by record),\n // bounded by the page size; without one it is asked for the page.\n if (ids !== null) {\n const answers = await Promise.all(\n ids.slice(0, plan.read.limit).map((id) =>\n callDoor<unknown>(\n DOORS.readRecord,\n { p_organization_id: org, p_record_id: id },\n \"query\",\n ).then((result) => ({ id, result })),\n ),\n );\n const rows: ReadRow[] = [];\n for (const { id, result } of answers) {\n if (!result.ok) {\n // `02000` is \"that record is not here (any more)\" — a planned id\n // that has since been deleted is an absence, not a failed query.\n if (result.error.sqlstate === \"02000\") continue;\n return err(result.error);\n }\n const { document, hidden } = unfold(result.data);\n rows.push({ id, document, level: \"viewer\", hidden });\n }\n return ok({ rows, total: rows.length });\n }\n\n return client.list({\n table_id: plan.read.table_id,\n limit: plan.read.limit,\n offset: plan.read.offset,\n });\n },\n\n async tableList() {\n // THROUGH THE READ DOOR, like everything else. A Table is a RECORD in the\n // Table kernel, so listing this organization's Tables is\n // `read_records(org, table_kernel_id())` — the store decides which of them\n // this reader may see. Until 2026-09-18 this method selected\n // `custom.table` directly, which (a) is the raw table access this package\n // exists to make impossible and (b) could never have worked from a client:\n // `authenticated` holds no privilege on ANY table in `custom`, by design.\n // The browser extension found it on its first real turn (W6-EXT).\n const kernel = await callDoor<Uuid>(DOORS.tableKernelId, {}, \"tableList.kernel\");\n if (!kernel.ok) return err(kernel.error);\n const door = await callDoor<Array<{ id: Uuid; document: unknown; level: string }>>(\n DOORS.readRecords,\n { p_organization_id: org, p_table_id: kernel.data, p_limit: 500, p_offset: 0 },\n \"tableList\",\n );\n if (!door.ok) return err(door.error);\n const tables = (door.data ?? []).map((row) => {\n const { document } = unfold(row.document);\n // The kernel record IS the Table's declaration; `id` is the Table's id.\n // `row.level` IS NOT THIS TABLE'S LEVEL AND MUST NOT BE CARRIED AS ONE.\n // `read_records` answers the caller's level on the table it was ASKED\n // about, and this call asks about the Table KERNEL — so `row.level` here\n // is the caller's level on the kernel (viewer, for everybody) and not on\n // the table the row describes. Carrying it looked free and was measured\n // wrong within the hour: a table's own owner came back \"viewer\".\n // The level a screen needs is `custom.my_levels`, asked per subject.\n return { ...(document as Record<string, unknown>), id: row.id, organization_id: org } as unknown as Table;\n });\n tables.sort((a, b) => (a.name ?? \"\").localeCompare(b.name ?? \"\"));\n return ok(tables);\n },\n\n async fields({ table_id, recordType }) {\n // FLD-10: the store decides which Fields APPLY, from the record type. The\n // client asks the door rather than filtering a full list, because the\n // applicability Rule reads Values this client has not got.\n const applicable = await callDoor<Array<{ id: Uuid; data: unknown }>>(\n DOORS.applicableFields,\n {\n p_organization_id: org,\n p_table_id: table_id,\n ...(recordType === undefined ? {} : { p_record_type: recordType }),\n },\n \"fields\",\n );\n if (!applicable.ok) return err(applicable.error);\n const rows = applicable.data ?? [];\n const fields = rows.map((row) => ({ id: row.id, ...(row.data as object) }) as Field);\n // IN THE ORDER A PERSON PUT THEM IN. `custom.applicable_fields` answers a\n // set, not a sequence — its order is whatever the plan gives it, and it\n // moves between calls — so a grid that mapped it straight to columns drew\n // them in an arbitrary order and a reorder in the settings panel appeared\n // to do nothing. `sort` is the Field's own declared position (and what\n // `custom.field_update` writes when somebody moves one), so it is applied\n // ONCE, here, and every consumer of this client inherits it. Measured\n // 2026-09-20: a table declared Title, Day rate, Due came back Day rate,\n // Title, Due.\n fields.sort(\n (a, b) => (a.sort ?? 0) - (b.sort ?? 0) || (a.label ?? \"\").localeCompare(b.label ?? \"\"),\n );\n return ok(fields);\n },\n\n async fieldOptions({ field_id }) {\n return callDoor<StoredRecord[]>(\n DOORS.fieldOptions,\n { p_organization_id: org, p_field_id: field_id },\n \"fieldOptions\",\n );\n },\n\n async tableCapacity({ table_id }) {\n return callDoor<TableCapacity>(\n DOORS.tableCapacity,\n { p_organization_id: org, p_table_id: table_id },\n \"tableCapacity\",\n );\n },\n\n async fieldDeclare({ table_id, spec }) {\n // `allow_other` is a choice list's own setting and the store keeps it in\n // the column's config (STORE-RULE-GAPS); the declaration names it plainly.\n const { allow_other, ...rest } = spec;\n const p_spec =\n allow_other === undefined\n ? rest\n : { ...rest, config: { ...(rest.config ?? {}), allow_other } };\n return callDoor<Uuid>(\n DOORS.fieldDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec },\n \"fieldDeclare\",\n );\n },\n\n async entityTable({ token }) {\n // The door answers one row; `callDoor` hands back the array PostgREST\n // returns for a set-returning function, so the ONE row is taken here\n // rather than in every caller.\n const answer = await callDoor<EntityTableFacts[] | EntityTableFacts>(\n DOORS.entityTable,\n { p_token: token },\n \"entityTable\",\n );\n if (!answer.ok) return err(answer.error);\n const row = Array.isArray(answer.data) ? answer.data[0] : answer.data;\n if (!row) {\n return err({\n code: \"not_found\",\n message: `The registry answered nothing for the table \"${token}\".`,\n hint: \"REC-33: a standard table is named by its registry token. Nothing was read.\",\n });\n }\n return ok(row);\n },\n\n async entityFields({ token }) {\n const rows = await callDoor<Array<{ id: Uuid; data: unknown }>>(\n DOORS.entityFields,\n { p_organization_id: org, p_token: token },\n \"entityFields\",\n );\n if (!rows.ok) return err(rows.error);\n return ok((rows.data ?? []).map((row) => ({ id: row.id, ...(row.data as object) }) as Field));\n },\n\n async entityFieldDeclare({ token, spec }) {\n return callDoor<Uuid>(\n DOORS.entityFieldDeclare,\n { p_organization_id: org, p_token: token, p_spec: spec },\n \"entityFieldDeclare\",\n );\n },\n\n async entityFieldUpdate({ field_id, patch }) {\n return callDoor<Uuid>(\n DOORS.entityFieldUpdate,\n { p_organization_id: org, p_field_id: field_id, p_patch: patch },\n \"entityFieldUpdate\",\n );\n },\n\n async entityFieldRetire({ field_id }) {\n return callDoor<Uuid>(\n DOORS.entityFieldRetire,\n { p_organization_id: org, p_field_id: field_id },\n \"entityFieldRetire\",\n );\n },\n\n async entityFieldRights({ token }) {\n return callDoor<EntityFieldRights>(\n DOORS.entityFieldRights,\n { p_organization_id: org, p_token: token },\n \"entityFieldRights\",\n );\n },\n\n async entityRecordRead({ token, record_id }) {\n return callDoor<EntityRecordRead>(\n DOORS.entityRecordRead,\n { p_organization_id: org, p_token: token, p_record_id: record_id },\n \"entityRecordRead\",\n );\n },\n\n async entityValueWrite({ token, record_id, patch }) {\n return callDoor<EntityRecordRead>(\n DOORS.entityValueWrite,\n { p_organization_id: org, p_token: token, p_record_id: record_id, p_patch: patch },\n \"entityValueWrite\",\n );\n },\n\n async entityRecordsFind({ token, key, value, limit, offset }) {\n return callDoor<EntityRecordsFound>(\n DOORS.entityRecordsFind,\n {\n p_organization_id: org,\n p_token: token,\n p_key: key,\n p_value: value === undefined ? null : value,\n ...(limit === undefined ? {} : { p_limit: limit }),\n ...(offset === undefined ? {} : { p_offset: offset }),\n },\n \"entityRecordsFind\",\n );\n },\n\n async fieldUpdate({ field_id, patch }) {\n return callDoor<Uuid>(\n DOORS.fieldUpdate,\n { p_organization_id: org, p_field_id: field_id, p_patch: patch },\n \"fieldUpdate\",\n );\n },\n\n async fieldRetire({ field_id }) {\n return callDoor<boolean>(\n DOORS.fieldRetire,\n { p_organization_id: org, p_field_id: field_id },\n \"fieldRetire\",\n );\n },\n\n async relationWords({ field_id, value }) {\n return callDoor<string | null>(\n DOORS.relationWords,\n { p_organization_id: org, p_field_id: field_id, p_value: value },\n \"relationWords\",\n );\n },\n\n async relationWordsMany(args) {\n // ONE PRIMITIVE, TWO STORE DOORS. The `store` decides which door answers,\n // and the answer SHAPE is identical either way — a lookup from id to the\n // words that id reads. Every screen that resolved a relation chip before\n // OLD-TABLES-2 passes no `store` at all and reaches exactly the door it\n // always reached.\n //\n // The door returns one row per id — `(id, words)` — and a caller wants a\n // lookup, so the shape is turned here rather than in every screen. An id\n // the store answered nothing for is simply ABSENT from the map, and the\n // caller decides what an absent chip says; inventing \"Untitled\" here\n // would hide the difference between \"no answer yet\" and \"no words\", and\n // in the older store it would hide the difference between a cell that\n // points at nothing (absent — an unresolvable reference, shown with its\n // identifier) and one the reader may not open (present, carrying the\n // withheld sentence and no id).\n const older = args.store === \"older\";\n const result = older\n ? await workbenchDoor<Array<{ row_id: Uuid; words: string | null }>>(\n WORKBENCH_DOORS.udtRowWordsMany,\n {\n p_organization_id: org,\n p_display: args.display ?? null,\n p_row_ids: args.record_ids,\n },\n \"relationWordsMany(older)\",\n )\n : await callDoor<Array<{ record_id: Uuid; words: string | null }>>(\n DOORS.relationWordsMany,\n { p_organization_id: org, p_field_id: args.field_id, p_record_ids: args.record_ids },\n \"relationWordsMany\",\n );\n if (!result.ok) return result;\n const map: Record<string, string> = {};\n for (const row of (result.data ?? []) as Array<{\n record_id?: Uuid;\n row_id?: Uuid;\n words: string | null;\n }>) {\n const id = row?.record_id ?? row?.row_id;\n if (id && typeof row.words === \"string\") map[id] = row.words;\n }\n return { ok: true, data: map };\n },\n\n async tableDeclare({ spec, homeId }) {\n return callDoor<Uuid>(\n DOORS.tableDeclare,\n { p_organization_id: org, p_spec: { ...spec, parent_id: homeId } },\n \"tableDeclare\",\n );\n },\n\n async personKernelId() {\n return callDoor<Uuid>(DOORS.personKernelId, {}, \"personKernelId\");\n },\n\n async fieldKernelId() {\n return callDoor<Uuid>(DOORS.fieldKernelId, {}, \"fieldKernelId\");\n },\n\n async ruleKernelId() {\n return callDoor<Uuid>(DOORS.ruleKernelId, {}, \"ruleKernelId\");\n },\n\n async pipelineRead({ table_id }) {\n return callDoor<Pipeline>(\n DOORS.pipelineRead,\n { p_organization_id: org, p_table_id: table_id },\n \"pipelineRead\",\n );\n },\n\n async pipelineBoard({ table_id, measure }) {\n return callDoor<PipelineColumn[]>(\n DOORS.pipelineBoard,\n { p_organization_id: org, p_table_id: table_id, p_measure: measure ?? null },\n \"pipelineBoard\",\n );\n },\n\n async pipelineTransitionRefusal({ record_id, to }) {\n return callDoor<PipelineVerdict>(\n DOORS.pipelineTransitionRefusal,\n { p_organization_id: org, p_record_id: record_id, p_to: to },\n \"pipelineTransitionRefusal\",\n );\n },\n\n async pipelineMove({ record_id, to, also, expected_version }) {\n return callDoor<PipelineMoveResult>(\n DOORS.pipelineMove,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_to: to,\n p_also: also ?? {},\n p_expected_version: expected_version ?? null,\n },\n \"pipelineMove\",\n );\n },\n\n async pipelineDeclare({ table_id, spec }) {\n return callDoor<PipelineDeclared>(\n DOORS.pipelineDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec: spec },\n \"pipelineDeclare\",\n );\n },\n\n async tableStageField({ table_id }) {\n return callDoor<string | null>(\n DOORS.tableStageField,\n { p_organization_id: org, p_table_id: table_id },\n \"tableStageField\",\n );\n },\n\n async stageRuleOnFailKinds() {\n return callDoor<{ behaviour: StageRuleOnFail; note: string }[]>(\n DOORS.stageRuleOnFailKinds,\n {},\n \"stageRuleOnFailKinds\",\n );\n },\n\n async stageRuleEnforcement() {\n return callDoor<StageRuleEnforcement>(\n DOORS.stageRuleEnforcement,\n { p_organization_id: org },\n \"stageRuleEnforcement\",\n );\n },\n\n async recordStagePending({ record_id }) {\n return callDoor<StagePending[]>(\n DOORS.recordStagePending,\n { p_organization_id: org, p_record_id: record_id },\n \"recordStagePending\",\n );\n },\n\n async pipelinePending({ table_id }) {\n return callDoor<StagePendingOnBoard[]>(\n DOORS.pipelinePending,\n { p_organization_id: org, p_table_id: table_id },\n \"pipelinePending\",\n );\n },\n\n async pipelineGatePreview({ table_id, stage, gate }) {\n return callDoor<PipelineGatePreview>(\n DOORS.pipelineGatePreview,\n { p_organization_id: org, p_table_id: table_id, p_stage: stage, p_gate: gate },\n \"pipelineGatePreview\",\n );\n },\n\n async ruleMembers({ rule_id }) {\n return callDoor<StoredRecord[]>(\n DOORS.ruleMembers,\n { p_organization_id: org, p_rule_id: rule_id },\n \"ruleMembers\",\n );\n },\n\n async ruleMembership({ rule_id, record_id }) {\n return callDoor<unknown>(\n DOORS.ruleMembership,\n { p_organization_id: org, p_rule_id: rule_id, p_record_id: record_id },\n \"ruleMembership\",\n );\n },\n\n async forms(args) {\n return callDoor<FormSummary[]>(\n DOORS.forms,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"forms\",\n );\n },\n\n async bookings(args) {\n return callDoor<BookingSummary[]>(\n DOORS.bookings,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"bookings\",\n );\n },\n\n async bookingDeclare(args) {\n return callDoor<BookingDeclared>(\n DOORS.bookingDeclare,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_title: args.title,\n p_questions: args.questions,\n // AN EMPTY OBJECT IS NOT A MISTAKE. The store owns every default, so a\n // page declared with no availability comes back Monday-to-Friday,\n // nine-to-five, in the organization's own zone — and the screen draws\n // what came BACK rather than what it sent.\n p_availability: args.availability ?? {},\n p_presentation: args.presentation ?? {},\n p_submission_cap: args.submission_cap ?? null,\n p_quarantine_rule_id: args.quarantine_rule_id ?? null,\n p_notify_rule_id: args.notify_rule_id ?? null,\n p_form_id: args.form_id ?? null,\n p_slug: args.slug ?? null,\n p_home_id: args.home_id ?? null,\n },\n \"bookingDeclare\",\n );\n },\n\n async formDeclare(args) {\n return callDoor<Uuid>(\n DOORS.formDeclare,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_title: args.title,\n p_questions: args.questions,\n p_presentation: args.presentation ?? {},\n p_submission_cap: args.submission_cap ?? null,\n p_quarantine_rule_id: args.quarantine_rule_id ?? null,\n p_notify_rule_id: args.notify_rule_id ?? null,\n p_form_id: args.form_id ?? null,\n p_slug: args.slug ?? null,\n },\n \"formDeclare\",\n );\n },\n\n async importPlan(args) {\n return callDoor<ImportPlan>(\n DOORS.importPlan,\n { p_organization_id: org, p_table_id: args.table_id, p_columns: args.columns },\n \"importPlan\",\n );\n },\n\n async importBegin(args) {\n return callDoor<ImportOpened>(\n DOORS.importBegin,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_format: args.format ?? \"csv\",\n p_source_name: args.source_name ?? null,\n p_source_columns: args.source_columns ?? [],\n p_file_hash: args.file_hash ?? null,\n p_policy: args.policy ?? {},\n p_dedupe_key: args.dedupe_key ?? null,\n p_file_bytes: args.file_bytes ?? null,\n p_force: args.force ?? false,\n },\n \"importBegin\",\n );\n },\n\n async importDeclareColumns(args) {\n return callDoor<ImportColumnsDeclared>(\n DOORS.importDeclareColumns,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_rows: args.rows,\n p_mapping: args.mapping ?? {},\n },\n \"importDeclareColumns\",\n );\n },\n\n async importRows(args) {\n return callDoor<ImportBatchResult>(\n DOORS.importRows,\n {\n p_organization_id: org,\n p_import_id: args.import_id,\n p_rows: args.rows,\n p_mapping: args.mapping ?? {},\n },\n \"importRows\",\n );\n },\n\n async importFinish(args) {\n return callDoor<ImportFinished>(\n DOORS.importFinish,\n { p_organization_id: org, p_import_id: args.import_id, p_unmapped: args.unmapped ?? null },\n \"importFinish\",\n );\n },\n\n async importReport(args) {\n return callDoor<ImportReport>(\n DOORS.importReport,\n {\n p_organization_id: org,\n p_import_id: args.import_id,\n p_state: args.state ?? \"refused\",\n p_limit: args.limit ?? 100,\n p_offset: args.offset ?? 0,\n },\n \"importReport\",\n );\n },\n\n async imports(args) {\n return callDoor<ImportRun[]>(\n DOORS.imports,\n { p_organization_id: org, p_table_id: args?.table_id ?? null, p_limit: args?.limit ?? 25 },\n \"imports\",\n );\n },\n\n async importForget(args) {\n return callDoor<boolean>(\n DOORS.importForget,\n { p_organization_id: org, p_import_id: args.import_id },\n \"importForget\",\n );\n },\n\n async inboundDeclare(args) {\n return callDoor<InboundDeclared>(\n DOORS.inboundDeclare,\n { p_organization_id: org, p_table_id: args.table_id, p_label: args.label ?? null },\n \"inboundDeclare\",\n );\n },\n\n async inboundAddresses(args) {\n return callDoor<InboundAddress[]>(\n DOORS.inboundAddresses,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"inboundAddresses\",\n );\n },\n\n async inboundSet(args) {\n return callDoor<{ inbound_id: Uuid; address: string; enabled: boolean; message: string }>(\n DOORS.inboundSet,\n { p_organization_id: org, p_inbound_id: args.inbound_id, p_enabled: args.enabled },\n \"inboundSet\",\n );\n },\n\n async portals() {\n return callDoor<PortalSummary[]>(DOORS.portals, { p_organization_id: org }, \"portals\");\n },\n\n async listPortals(args) {\n return callDoor<PortalSummary[]>(\n DOORS.listPortals,\n { p_organization_id: org, p_archived: args?.archived ?? \"active\" },\n \"listPortals\",\n );\n },\n\n async portalArchive(args) {\n return callDoor<PortalArchiveAnswer>(\n DOORS.portalArchive,\n {\n p_organization_id: org,\n p_portal_id: args.portal_id,\n p_confirm_title: args.confirm_title,\n p_reason: args.reason ?? null,\n },\n \"portalArchive\",\n );\n },\n\n async portalRestore(args) {\n return callDoor<PortalArchiveAnswer>(\n DOORS.portalRestore,\n {\n p_organization_id: org,\n p_portal_id: args.portal_id,\n p_confirm_title: args.confirm_title,\n },\n \"portalRestore\",\n );\n },\n\n async portalTables() {\n return callDoor<PortalTableRef[]>(DOORS.portalTables, { p_organization_id: org }, \"portalTables\");\n },\n\n async portalCard({ portal_id }) {\n return callDoor<PortalCard>(\n DOORS.portalCard,\n { p_organization_id: org, p_portal_id: portal_id },\n \"portalCard\",\n );\n },\n\n async portalDeclare(args) {\n return callDoor<Uuid>(\n DOORS.portalDeclare,\n {\n p_organization_id: org,\n p_title: args.title,\n p_client_table_id: args.client_table_id,\n p_tables: args.tables,\n p_portal_id: args.portal_id ?? null,\n p_slug: args.slug ?? null,\n p_sign_in_method: args.sign_in_method ?? \"magic_link\",\n },\n \"portalDeclare\",\n );\n },\n\n async portalInvite(args) {\n return callDoor<PortalInvitation>(\n DOORS.portalInvite,\n {\n p_organization_id: org,\n p_portal_id: args.portal_id,\n p_client_record_id: args.client_record_id,\n p_email: args.email,\n // ALWAYS null from a client. See the interface comment: an invitation\n // confers nothing until the person follows their own sign-in link.\n p_user_id: null,\n },\n \"portalInvite\",\n );\n },\n\n async portalRevoke({ portal_id, principal_id }) {\n return callDoor<PortalRevocation>(\n DOORS.portalRevoke,\n { p_organization_id: org, p_portal_id: portal_id, p_principal_id: principal_id },\n \"portalRevoke\",\n );\n },\n\n async portalPreview({ portal_id, principal_id, table_id }) {\n return callDoor<PortalPreviewRow[]>(\n DOORS.portalPreview,\n {\n p_organization_id: org,\n p_portal_id: portal_id,\n p_principal_id: principal_id,\n p_table_id: table_id,\n },\n \"portalPreview\",\n );\n },\n\n async ruleRun({ rule_id, values, context }) {\n return callDoor<unknown>(\n DOORS.ruleRun,\n {\n p_organization_id: org,\n p_rule_id: rule_id,\n p_values: values,\n ...(context === undefined ? {} : { p_context: context }),\n },\n \"ruleRun\",\n );\n },\n\n async ruleEval({ expr, values, context }) {\n return callDoor<unknown>(\n DOORS.ruleEval,\n {\n p_organization_id: org,\n p_expr: expr,\n p_values: values,\n ...(context === undefined ? {} : { p_context: context }),\n },\n \"ruleEval\",\n );\n },\n\n async captureSheetDeclare(args) {\n return callDoor<Uuid>(\n DOORS.captureSheetDeclare,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_title: args.title,\n p_questions: args.questions,\n p_presentation: args.presentation ?? {},\n p_sheet_id: args.sheet_id ?? null,\n p_notify_rule_id: args.notify_rule_id ?? null,\n },\n \"captureSheetDeclare\",\n );\n },\n\n async capturePublish(args) {\n return callDoor<string | null>(\n DOORS.capturePublish,\n { p_organization_id: org, p_sheet_id: args.sheet_id, p_open: args.open ?? true },\n \"capturePublish\",\n );\n },\n\n async captureSheets(args) {\n return callDoor<CaptureSheetSummary[]>(\n DOORS.captureSheets,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"captureSheets\",\n );\n },\n\n async captureOpen(args) {\n const out = await callDoor<CaptureSheetFace[] | CaptureSheetFace | null>(\n DOORS.captureOpen,\n { p_organization_id: org, p_sheet_id: args.sheet_id },\n \"captureOpen\",\n );\n if (!out.ok) return out as RecordsResult<CaptureSheetFace | null>;\n const rows = Array.isArray(out.data) ? out.data : out.data ? [out.data] : [];\n // NO ROW is the answer for a sheet below `viewer` AND for a sheet that is not\n // there — the same answer the Table itself gives. It is not an error.\n return { ...out, data: rows[0] ?? null } as RecordsResult<CaptureSheetFace | null>;\n },\n\n async captureSubmit(args) {\n const out = await callDoor<CaptureOutcome[] | CaptureOutcome | null>(\n DOORS.captureSubmit,\n {\n p_organization_id: org,\n p_sheet_id: args.sheet_id,\n p_client_key: args.client_key,\n p_payload: args.answers ?? {},\n p_files: args.files ?? [],\n p_device: args.device ?? null,\n p_captured_at: args.captured_at ?? null,\n p_location: args.location ?? null,\n },\n \"captureSubmit\",\n );\n if (!out.ok) return out as RecordsResult<CaptureOutcome | null>;\n const rows = Array.isArray(out.data) ? out.data : out.data ? [out.data] : [];\n return { ...out, data: rows[0] ?? null } as RecordsResult<CaptureOutcome | null>;\n },\n\n async enrichments(args) {\n return callDoor<EnrichmentSummary[]>(\n DOORS.enrichments,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"enrichments\",\n );\n },\n\n async enrichDeclare(args) {\n return callDoor<EnrichDeclared>(\n DOORS.enrichDeclare,\n { p_organization_id: org, p_field_id: args.field_id, p_spec: args.spec },\n \"enrichDeclare\",\n );\n },\n\n async enrichDue(args) {\n return callDoor<EnrichDueRow[]>(\n DOORS.enrichDue,\n {\n p_organization_id: org,\n p_field_id: args.field_id,\n p_limit: args.limit ?? 50,\n p_include_fresh: args.include_fresh ?? false,\n },\n \"enrichDue\",\n );\n },\n\n async enrichCells(args) {\n return callDoor<EnrichCell[]>(\n DOORS.enrichCells,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_field_keys: args.field_keys ?? null,\n p_record_ids: args.record_ids ?? null,\n },\n \"enrichCells\",\n );\n },\n\n async enrichPin(args) {\n return callDoor<{ pinned: boolean; says: string }>(\n DOORS.enrichPin,\n {\n p_organization_id: org,\n p_record_id: args.record_id,\n p_field_key: args.field_key,\n p_pinned: args.pinned ?? true,\n },\n \"enrichPin\",\n );\n },\n\n async enrichRuns(args) {\n return callDoor<EnrichRun[]>(\n DOORS.enrichRuns,\n {\n p_organization_id: org,\n p_field_id: args?.field_id ?? null,\n p_limit: args?.limit ?? 50,\n },\n \"enrichRuns\",\n );\n },\n\n async dashboards(args) {\n return callDoor<DashboardSummary[]>(\n DOORS.dashboards,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"dashboards\",\n );\n },\n\n async dashboardDeclare(args) {\n return callDoor<Uuid>(\n DOORS.dashboardDeclare,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_name: args.name,\n p_blocks: args.blocks ?? [],\n p_presentation: args.presentation ?? {},\n p_dashboard_id: args.dashboard_id ?? null,\n },\n \"dashboardDeclare\",\n );\n },\n\n async dashboardRun({ dashboard_id, filter }) {\n return callDoor<DashboardRunResult>(\n DOORS.dashboardRun,\n { p_organization_id: org, p_dashboard_id: dashboard_id, p_filter: filter ?? {} },\n \"dashboardRun\",\n );\n },\n\n async dashboardStuck({ table_id, state_key, days, filter, limit }) {\n return callDoor<StuckRow[]>(\n DOORS.dashboardStuck,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_state_key: state_key,\n p_days: days ?? 14,\n p_filter: filter ?? {},\n p_limit: limit ?? 50,\n },\n \"dashboardStuck\",\n );\n },\n\n async dashboardDelete({ dashboard_id }) {\n return callDoor<boolean>(\n DOORS.dashboardDelete,\n { p_organization_id: org, p_dashboard_id: dashboard_id },\n \"dashboardDelete\",\n );\n },\n\n async recordAggregate({ table_id, groupBy, measures, bucket, filter, limit }) {\n return callDoor<AggregateRow[]>(\n DOORS.recordAggregate,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_group_by: groupBy ?? [],\n p_measures: measures ?? [],\n p_bucket: bucket ?? null,\n p_filter: filter ?? {},\n p_limit: limit ?? 200,\n },\n \"recordAggregate\",\n );\n },\n\n async aggOperations() {\n return callDoor<string[]>(DOORS.aggOperations, {}, \"aggOperations\");\n },\n\n async aggBuckets() {\n return callDoor<string[]>(DOORS.aggBuckets, {}, \"aggBuckets\");\n },\n\n async aggSubscriptions(args) {\n return callDoor<Subscription[]>(\n DOORS.aggSubscriptions,\n {\n p_organization_id: org,\n p_saved_view_id: args?.saved_view_id ?? null,\n p_cadence: args?.cadence ?? null,\n },\n \"aggSubscriptions\",\n );\n },\n\n async aggSubscriptionCadences() {\n return callDoor<string[]>(DOORS.aggSubscriptionCadences, {}, \"aggSubscriptionCadences\");\n },\n\n async subscriptionCadences() {\n return callDoor<string[]>(\n DOORS.subscriptionCadences,\n { p_organization_id: org },\n \"subscriptionCadences\",\n );\n },\n\n async subscriptions(args) {\n return callDoor<MySubscription[]>(\n DOORS.subscriptions,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"subscriptions\",\n );\n },\n\n async subscriptionDeclare({ table_id, spec }) {\n return callDoor<Uuid>(\n DOORS.subscriptionDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec: spec },\n \"subscriptionDeclare\",\n );\n },\n\n async subscriptionPreview({ rule_id }) {\n return callDoor<DigestPreview>(\n DOORS.subscriptionPreview,\n { p_organization_id: org, p_rule_id: rule_id },\n \"subscriptionPreview\",\n );\n },\n\n async views(args) {\n return callDoor<SavedViewRow[]>(\n DOORS.views,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"views\",\n );\n },\n\n async viewDeclare({ table_id, spec }) {\n return callDoor<Uuid>(\n DOORS.viewDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec: spec },\n \"viewDeclare\",\n );\n },\n\n async subscriptionMute({ rule_id, muted }) {\n return callDoor<boolean>(\n DOORS.subscriptionMute,\n { p_organization_id: org, p_rule_id: rule_id, p_muted: muted },\n \"subscriptionMute\",\n );\n },\n\n async docTemplateSave({ table_id, name, body, template_id }) {\n return callDoor<Uuid>(\n DOORS.docTemplateSave,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_name: name,\n p_body: body,\n p_template_id: template_id ?? null,\n },\n \"docTemplateSave\",\n );\n },\n\n async docRenderBody({ template_id, record_id }) {\n return callDoor<string>(\n DOORS.docRenderBody,\n { p_organization_id: org, p_template_id: template_id, p_record_id: record_id },\n \"docRenderBody\",\n );\n },\n\n async docRenderDocument({ template_id, record_id }) {\n return callDoor<Uuid>(\n DOORS.docRenderDocument,\n { p_organization_id: org, p_template_id: template_id, p_record_id: record_id },\n \"docRenderDocument\",\n );\n },\n\n async docTokens({ body }) {\n return callDoor<DocToken[]>(DOORS.docTokens, { p_body: body }, \"docTokens\");\n },\n\n async docUnresolvedTokens({ table_id, body }) {\n return callDoor<DocUnresolvedToken[]>(\n DOORS.docUnresolvedTokens,\n { p_organization_id: org, p_table_id: table_id, p_body: body },\n \"docUnresolvedTokens\",\n );\n },\n\n async docSign({ render_id, field_key, signer_name, signer_user_id }) {\n return callDoor<Uuid>(\n DOORS.docSign,\n {\n p_organization_id: org,\n p_render_id: render_id,\n p_field_key: field_key,\n p_signer_name: signer_name,\n p_signer_user_id: signer_user_id ?? null,\n },\n \"docSign\",\n );\n },\n\n // A LIST IS A DOOR, NEVER A GRANT ON THE THING BEHIND IT. These three used to\n // read `custom.doc_template`, `custom.doc_render` and `custom.doc_signature`\n // with a direct PostgREST `.from()`, and none of the three holds a client\n // SELECT — so a person could save a template they could never list and\n // render a document they could never find again, and every document screen\n // opened on \"permission denied for view doc_template\". The doors below\n // narrow inside the definer, after the ladder has spoken (DOORS-TWO).\n async docTemplates({ table_id }) {\n // The door names its key `template_id`, because a door answers about the\n // thing it is a door to. The package's row keeps `id`, which is what every\n // screen already holds — one rename, here, rather than in four screens.\n const answered = await callDoor<Array<Record<string, unknown>>>(\n DOORS.docTemplates,\n { p_organization_id: org, p_table_id: table_id },\n \"docTemplates\",\n );\n if (!answered.ok) return answered;\n return ok(\n answered.data.map((row) => ({ ...row, id: row[\"template_id\"] })) as unknown as DocTemplateRow[],\n );\n },\n\n async docTemplateDelete({ template_id }) {\n return callDoor<boolean>(\n DOORS.docTemplateDelete,\n { p_organization_id: org, p_template_id: template_id },\n \"docTemplateDelete\",\n );\n },\n\n async docRenders({ record_id }) {\n const answered = await callDoor<Array<Record<string, unknown>>>(\n DOORS.docRenders,\n { p_organization_id: org, p_record_id: record_id },\n \"docRenders\",\n );\n if (!answered.ok) return answered;\n return ok(\n answered.data.map((row) => ({ ...row, id: row[\"render_id\"] })) as unknown as DocRenderRow[],\n );\n },\n\n async docSignatures({ record_id }) {\n const answered = await callDoor<Array<Record<string, unknown>>>(\n DOORS.docSignatures,\n { p_organization_id: org, p_record_id: record_id },\n \"docSignatures\",\n );\n if (!answered.ok) return answered;\n return ok(\n answered.data.map((row) => ({ ...row, id: row[\"signature_id\"] })) as unknown as DocSignatureRow[],\n );\n },\n\n async recordValuesVersioned({ record_id }) {\n return readValues(record_id);\n },\n\n async revisions({ record_id }) {\n return callDoor<RecordRevision[]>(\n DOORS.ioRevisions,\n { p_organization_id: org, p_record_id: record_id },\n \"revisions\",\n );\n },\n\n async recordScopeContext({ record_id, relations, history, siblings }) {\n return callDoor<RecordScopeContext>(\n DOORS.recordScopeContext,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_relations: relations ?? 12,\n p_history: history ?? 15,\n p_siblings: siblings ?? 8,\n },\n \"recordScopeContext\",\n );\n },\n\n async conversationScope({ conversation_id }) {\n return callDoor<ConversationScope>(\n DOORS.conversationScope,\n { p_organization_id: org, p_conversation_id: conversation_id },\n \"conversationScope\",\n );\n },\n\n async conversationScopeBind({ conversation_id, record_id }) {\n return callDoor<ConversationScope>(\n DOORS.conversationScopeBind,\n {\n p_organization_id: org,\n p_conversation_id: conversation_id,\n p_record_id: record_id,\n },\n \"conversationScopeBind\",\n );\n },\n\n async conversationScopeUnbind({ conversation_id }) {\n return callDoor<ConversationScope>(\n DOORS.conversationScopeUnbind,\n { p_organization_id: org, p_conversation_id: conversation_id },\n \"conversationScopeUnbind\",\n );\n },\n\n async conversationScopeContext({ conversation_id, relations, history, siblings }) {\n return callDoor<ConversationScopeContext>(\n DOORS.conversationScopeContext,\n {\n p_organization_id: org,\n p_conversation_id: conversation_id,\n p_relations: relations ?? 12,\n p_history: history ?? 15,\n p_siblings: siblings ?? 8,\n },\n \"conversationScopeContext\",\n );\n },\n\n async recordHistory({ record_id, limit, offset }) {\n return callDoor<RecordHistoryEntry[]>(\n DOORS.recordHistory,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_limit: limit ?? 200,\n p_offset: offset ?? 0,\n },\n \"recordHistory\",\n );\n },\n\n async fieldHistory({ table_id, field_key, limit, offset, record_id }) {\n return callDoor<FieldHistoryEntry[]>(\n DOORS.fieldHistory,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_field_key: field_key,\n p_limit: limit ?? 100,\n p_offset: offset ?? 0,\n p_record_id: record_id ?? null,\n },\n \"fieldHistory\",\n );\n },\n\n async restorePreview({ record_id, version, field_key }) {\n return callDoor<RestorePreview>(\n DOORS.restorePreview,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_version: version,\n p_field_key: field_key ?? null,\n },\n \"restorePreview\",\n );\n },\n\n async restoreVersion({ record_id, version }) {\n const result = await callDoor<RestoreResult>(\n DOORS.restoreVersion,\n { p_organization_id: org, p_record_id: record_id, p_version: version },\n \"restoreVersion\",\n );\n if (result.ok) announceRecordChanged(record_id);\n return result;\n },\n\n async valueRestore({ record_id, field_key, version }) {\n const answered = await callDoor<RestoreResult>(\n DOORS.valueRestore,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_field_key: field_key,\n p_version: version,\n },\n \"valueRestore\",\n );\n if (answered.ok) announceRecordChanged(record_id);\n return answered;\n },\n\n async commentThread({ record_id, include_resolved }) {\n return callDoor<CommentThreadRead>(\n DOORS.commentThread,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_include_resolved: include_resolved ?? false,\n },\n \"commentThread\",\n );\n },\n\n async commentWrite({ record_id, body, field_key, parent_comment_id, mentions }) {\n return callDoor<CommentWritten>(\n DOORS.commentWrite,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_body: body,\n // THE ANCHOR IS WHERE A FIELD COMMENT LIVES. `custom.io_comment` has\n // always carried it; nothing was ever putting a Field in it.\n p_anchor: field_key ? { field_key } : {},\n p_parent_comment_id: parent_comment_id ?? null,\n p_mentions: mentions && mentions.length > 0 ? mentions : null,\n },\n \"commentWrite\",\n );\n },\n\n async commentResolve({ comment_id, resolved }) {\n return callDoor<boolean>(\n DOORS.commentResolve,\n {\n p_organization_id: org,\n p_comment_id: comment_id,\n p_resolved: resolved ?? true,\n },\n \"commentResolve\",\n );\n },\n\n async docSignatureRead({ signature_id }) {\n return callDoor<unknown>(\n DOORS.docSignatureRead,\n { p_organization_id: org, p_signature_id: signature_id },\n \"docSignatureRead\",\n );\n },\n\n // ── the anonymous lane ───────────────────────────────────────────────\n async anonTokenIssue({ mode, allowedOrigins, formId, savedViewId, recordId, expiresAt }) {\n // The door answers a one-row TABLE, so the array is unwrapped here rather\n // than in every caller. An empty answer is impossible — the door either\n // returns the pair or raises — so `[0]` is not a guess.\n const answered = await callDoor<Array<{ token_id: Uuid; secret: string }>>(\n DOORS.anonTokenIssue,\n {\n p_organization_id: org,\n p_mode: mode,\n p_allowed_origins: allowedOrigins,\n p_form_id: formId ?? null,\n p_saved_view_id: savedViewId ?? null,\n p_record_id: recordId ?? null,\n p_expires_at: expiresAt ?? null,\n },\n \"anonTokenIssue\",\n );\n if (!answered.ok) return answered;\n const pair = answered.data[0];\n if (!pair) {\n return err({\n code: \"internal\",\n message: \"custom.anon_token_issue returned no token, which it cannot do — it either mints one or raises.\",\n hint: \"Nothing was issued. Do not retry blindly: something between this client and the store changed the answer's shape.\",\n });\n }\n return ok(pair);\n },\n\n async anonTokenVerify({ secret, origin, requiredMode }) {\n const answered = await callDoor<AnonTokenBinding[]>(\n DOORS.anonTokenVerify,\n { p_secret: secret, p_origin: origin, p_required_mode: requiredMode ?? null },\n \"anonTokenVerify\",\n );\n if (!answered.ok) return answered;\n const binding = answered.data[0];\n if (!binding) {\n return err({\n code: \"internal\",\n message: \"custom.anon_token_verify returned no binding, which it cannot do — it either answers or raises.\",\n hint: \"Treat this as unverified. It is reported rather than read as 'not valid', because those are different sentences.\",\n });\n }\n return ok(binding);\n },\n\n async anonTokenRevoke({ token_id }) {\n return callDoor<boolean>(\n DOORS.anonTokenRevoke,\n { p_organization_id: org, p_token_id: token_id },\n \"anonTokenRevoke\",\n );\n },\n\n async anonWrite({ secret, origin, payload, clientKey, rawPayload }) {\n // No `p_organization_id`: the TOKEN supplies the organization. A stranger\n // naming one would be choosing which tenant to write into.\n return callDoor<Uuid>(\n DOORS.anonWrite,\n {\n p_secret: secret,\n p_origin: origin,\n p_payload: payload,\n p_client_key: clientKey ?? null,\n p_raw_payload: rawPayload ?? {},\n },\n \"anonWrite\",\n );\n },\n\n async anonCapture({ table_id, clientKey, payload, device, capturedAt }) {\n return callDoor<Uuid>(\n DOORS.anonCapture,\n {\n p_organization_id: org,\n p_client_key: clientKey,\n p_table_id: table_id,\n p_payload: payload,\n p_device: device ?? null,\n p_captured_at: capturedAt ?? null,\n },\n \"anonCapture\",\n );\n },\n\n async anonPublish({ form_id, published = true }) {\n return callDoor<Timestamp | null>(\n DOORS.anonPublish,\n { p_organization_id: org, p_form_id: form_id, p_published: published },\n \"anonPublish\",\n );\n },\n\n // ── work ─────────────────────────────────────────────────────────────\n async workStates() {\n return callDoor<WorkState[]>(DOORS.workStates, {}, \"workStates\");\n },\n\n async workTemplateRefusal({ graph }) {\n return callDoor<string | null>(DOORS.workTemplateRefusal, { p_graph: graph }, \"workTemplateRefusal\");\n },\n\n async workTemplateDeclare({ name, graph }) {\n return callDoor<Uuid>(\n DOORS.workTemplateDeclare,\n { p_organization_id: org, p_name: name, p_graph: graph },\n \"workTemplateDeclare\",\n );\n },\n\n async workTemplateInstantiate({ template_id, overrides }) {\n return callDoor<WorkInstantiation>(\n DOORS.workTemplateInstantiate,\n { p_organization_id: org, p_template_id: template_id, p_overrides: overrides ?? {} },\n \"workTemplateInstantiate\",\n );\n },\n\n async workTemplateShape({ template_id }) {\n return callDoor<unknown>(\n DOORS.workTemplateShape,\n { p_organization_id: org, p_template_id: template_id },\n \"workTemplateShape\",\n );\n },\n\n async workInstantiationShape({ instantiation_id }) {\n return callDoor<unknown>(\n DOORS.workInstantiationShape,\n { p_organization_id: org, p_instantiation_id: instantiation_id },\n \"workInstantiationShape\",\n );\n },\n\n async workWhoseTurn({ table_id, includeFinished = false }) {\n return callDoor<WorkTurn[]>(\n DOORS.workWhoseTurn,\n { p_organization_id: org, p_table_id: table_id, p_include_finished: includeFinished },\n \"workWhoseTurn\",\n );\n },\n\n async workHasAssignment({ table_id }) {\n return callDoor<boolean>(\n DOORS.workHasAssignment,\n { p_organization_id: org, p_table_id: table_id },\n \"workHasAssignment\",\n );\n },\n\n async workAssignmentFields(args) {\n return callDoor<WorkAssignmentField[]>(\n DOORS.workAssignmentFields,\n { p_options_table_id: args?.options_table_id ?? null },\n \"workAssignmentFields\",\n );\n },\n\n async workTakeAssignment({ table_id }) {\n return callDoor<unknown>(\n DOORS.workTakeAssignment,\n { p_organization_id: org, p_table_id: table_id },\n \"workTakeAssignment\",\n );\n },\n\n async workTransitionRefusal({ from_state_id, to_state_id }) {\n return callDoor<string | null>(\n DOORS.workTransitionRefusal,\n { p_organization_id: org, p_from_state_id: from_state_id, p_to_state_id: to_state_id },\n \"workTransitionRefusal\",\n );\n },\n\n async workSlotsDeclare({ name, slug, homeId }) {\n return callDoor<unknown>(\n DOORS.workSlotsDeclare,\n { p_organization_id: org, p_name: name, p_slug: slug, p_home_id: homeId ?? null },\n \"workSlotsDeclare\",\n );\n },\n\n async workSlotHold({ table_id, slotKey, holder, ttl }) {\n return callDoor<unknown>(\n DOORS.workSlotHold,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_slot_key: slotKey,\n p_holder: holder,\n ...(ttl ? { p_ttl: ttl } : {}),\n },\n \"workSlotHold\",\n );\n },\n\n async workSlotRelease({ hold_id }) {\n return callDoor<boolean>(\n DOORS.workSlotRelease,\n { p_organization_id: org, p_hold_id: hold_id },\n \"workSlotRelease\",\n );\n },\n\n async workSlotHolds({ table_id }) {\n return callDoor<WorkSlotHold[]>(\n DOORS.workSlotHolds,\n { p_organization_id: org, p_table_id: table_id },\n \"workSlotHolds\",\n );\n },\n\n async workSlotExpire({ table_id }) {\n return callDoor<number>(\n DOORS.workSlotExpire,\n { p_organization_id: org, p_table_id: table_id },\n \"workSlotExpire\",\n );\n },\n\n // ── checklists and SOP runs ──────────────────────────────────────────\n async checklistRefusal({ spec }) {\n return callDoor<string | null>(\n DOORS.checklistRefusal,\n { p_spec: spec },\n \"checklistRefusal\",\n );\n },\n\n async checklistDeclare({ spec, template_id = null }) {\n return callDoor<ChecklistDeclared>(\n DOORS.checklistDeclare,\n { p_organization_id: org, p_spec: spec, p_template_id: template_id },\n \"checklistDeclare\",\n );\n },\n\n async checklistTemplates(args) {\n return callDoor<ChecklistTemplateSummary[]>(\n DOORS.checklistTemplates,\n {\n p_organization_id: org,\n p_about_table_id: args?.about_table_id ?? null,\n p_limit: args?.limit ?? 100,\n },\n \"checklistTemplates\",\n );\n },\n\n async checklistTemplateShape({ template_id }) {\n return callDoor<ChecklistTemplateShape>(\n DOORS.checklistTemplateShape,\n { p_organization_id: org, p_template_id: template_id },\n \"checklistTemplateShape\",\n );\n },\n\n async checklistStart({ template_id, about_record_id = null, roles = {}, startingAt = null }) {\n return callDoor<ChecklistRunStarted>(\n DOORS.checklistStart,\n {\n p_organization_id: org,\n p_template_id: template_id,\n p_about_record_id: about_record_id,\n p_roles: roles,\n p_starting_at: startingAt,\n },\n \"checklistStart\",\n );\n },\n\n async checklistRun({ run_id }) {\n return callDoor<ChecklistRunStep[]>(\n DOORS.checklistRun,\n { p_organization_id: org, p_run_id: run_id },\n \"checklistRun\",\n );\n },\n\n async checklistRuns(args) {\n return callDoor<ChecklistRunSummary[]>(\n DOORS.checklistRuns,\n {\n p_organization_id: org,\n p_about_table_id: args?.about_table_id ?? null,\n p_about_record_id: args?.about_record_id ?? null,\n p_include_closed: args?.includeClosed ?? true,\n p_limit: args?.limit ?? 100,\n },\n \"checklistRuns\",\n );\n },\n\n async checklistStepComplete({ step_id, evidence = {} }) {\n return callDoor<ChecklistStepCompleted>(\n DOORS.checklistStepComplete,\n { p_organization_id: org, p_step_id: step_id, p_evidence: evidence },\n \"checklistStepComplete\",\n );\n },\n\n async checklistStepRefusal({ step_id }) {\n return callDoor<string | null>(\n DOORS.checklistStepRefusal,\n { p_organization_id: org, p_step_id: step_id },\n \"checklistStepRefusal\",\n );\n },\n\n // ── the work layer a person actually uses ────────────────────────────\n async workInbox(args) {\n return callDoor<WorkInboxItem[]>(\n DOORS.workInbox,\n {\n p_organization_id: org,\n p_limit: args?.limit ?? 50,\n p_offset: args?.offset ?? 0,\n p_include_decided: args?.includeDecided ?? false,\n },\n \"workInbox\",\n );\n },\n\n async workList(args) {\n return callDoor<WorkListItem[]>(\n DOORS.workList,\n {\n p_organization_id: org,\n p_flavour: args?.flavour ?? \"mine\",\n p_include_finished: args?.includeFinished ?? false,\n p_limit: args?.limit ?? 100,\n p_offset: args?.offset ?? 0,\n },\n \"workList\",\n );\n },\n\n async workAssign({ record_id, user_id = null, dueDate = null, clearDue = false }) {\n return callDoor<WorkAssignment>(\n DOORS.workAssign,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_assignee_user_id: user_id,\n p_due_date: dueDate,\n p_clear_due: clearDue,\n },\n \"workAssign\",\n );\n },\n\n async workRecordStates({ record_id }) {\n return callDoor<WorkRecordState[]>(\n DOORS.workRecordStates,\n { p_organization_id: org, p_record_id: record_id },\n \"workRecordStates\",\n );\n },\n\n async workSetState({ record_id, state_id }) {\n return callDoor<unknown>(\n DOORS.workSetState,\n { p_organization_id: org, p_record_id: record_id, p_state_id: state_id },\n \"workSetState\",\n );\n },\n\n async workPerson({ user_id, create = true }) {\n return callDoor<Uuid | null>(\n DOORS.workPerson,\n { p_organization_id: org, p_user_id: user_id, p_create: create },\n \"workPerson\",\n );\n },\n\n async workTemplates(args) {\n return callDoor<Array<{\n template_id: Uuid;\n name: string;\n nodes: number;\n relations: number;\n created_at: string;\n }>>(\n DOORS.workTemplates,\n { p_organization_id: org, p_limit: args?.limit ?? 100 },\n \"workTemplates\",\n );\n },\n\n async workApprovalApprovers({ subject_id, approver_id = null }) {\n return callDoor<WorkApprover[]>(\n DOORS.workApprovalApprovers,\n { p_organization_id: org, p_subject_id: subject_id, p_approver_id: approver_id },\n \"workApprovalApprovers\",\n );\n },\n\n async workApprovalRequest({\n subject_id,\n change,\n note = null,\n approver_id = null,\n origin = \"person\",\n conversation_id = null,\n }) {\n return callDoor<WorkApprovalFiled>(\n DOORS.workApprovalRequest,\n {\n p_organization_id: org,\n p_subject_id: subject_id,\n p_change: change,\n p_note: note,\n p_approver_id: approver_id,\n p_origin: origin,\n p_conversation_id: conversation_id,\n },\n \"workApprovalRequest\",\n );\n },\n\n async workApprovalMayDecide({ approval_id }) {\n return callDoor<boolean>(\n DOORS.workApprovalMayDecide,\n { p_organization_id: org, p_approval_id: approval_id },\n \"workApprovalMayDecide\",\n );\n },\n\n async workApprovalDecide({ approval_id, approve, note = null }) {\n return callDoor<WorkApprovalDecision>(\n DOORS.workApprovalDecide,\n {\n p_organization_id: org,\n p_approval_id: approval_id,\n p_approve: approve,\n p_note: note,\n },\n \"workApprovalDecide\",\n );\n },\n\n async workApprovalRead({ approval_id }) {\n return callDoor<Record<string, unknown>>(\n DOORS.workApprovalRead,\n { p_organization_id: org, p_approval_id: approval_id },\n \"workApprovalRead\",\n );\n },\n\n // ── the trust doors ──────────────────────────────────────────────────\n async isExternalPrincipal(args) {\n return trustDoor<boolean>(\n TRUST_DOORS.isExternalPrincipal,\n { p_user_id: args?.user_id ?? null },\n \"isExternalPrincipal\",\n );\n },\n\n async externalPrincipalCard(args) {\n return trustDoor<ExternalPrincipalCard>(\n TRUST_DOORS.externalPrincipalCard,\n { p_user_id: args?.user_id ?? null },\n \"externalPrincipalCard\",\n );\n },\n\n async externalPrincipalReach({ resourceType, user_id }) {\n return trustDoor<Array<{ resource_id: Uuid }>>(\n TRUST_DOORS.externalPrincipalReach,\n { p_resource_type: resourceType, p_user_id: user_id ?? null },\n \"externalPrincipalReach\",\n );\n },\n\n async publishBindingCreate({ slug, resourceType, resource_id, renderMode = \"page\" }) {\n return trustDoor<PublishBinding>(\n TRUST_DOORS.publishBindingCreate,\n {\n p_slug: slug,\n p_resource_type: resourceType,\n p_resource_id: resource_id,\n p_organization_id: org,\n p_render_mode: renderMode,\n },\n \"publishBindingCreate\",\n );\n },\n\n async publishBindingRevoke({ slug }) {\n return trustDoor<unknown>(TRUST_DOORS.publishBindingRevoke, { p_slug: slug }, \"publishBindingRevoke\");\n },\n\n async resolvePublishBinding({ slug }) {\n return trustDoor<ResolvedPublishBinding[]>(\n TRUST_DOORS.resolvePublishBinding,\n { p_slug: slug },\n \"resolvePublishBinding\",\n );\n },\n\n async worldPublishGapNotice() {\n return trustDoor<string>(TRUST_DOORS.worldPublishGapNotice, {}, \"worldPublishGapNotice\");\n },\n\n async publishToWorld({ resourceType, resource_id, discoverable = false }) {\n return trustDoor<unknown>(\n TRUST_DOORS.publishToWorld,\n {\n p_resource_type: resourceType,\n p_resource_id: resource_id,\n p_organization_id: org,\n p_discoverable: discoverable,\n },\n \"publishToWorld\",\n );\n },\n\n async ruleDeclare({ spec, rule_id }) {\n // THE DOOR LANDED (lane FORMS, 2026-09-20). This used to be a refusing\n // stub, and the refusal was right: until `custom.rule_declare` existed\n // there was NO way to write a Rule that the store's own rule doors could\n // see, and pretending otherwise would have been the silent failure the\n // comment on the interface describes.\n return callDoor<Uuid>(\n DOORS.ruleDeclare,\n { p_organization_id: org, p_spec: spec, p_rule_id: rule_id ?? null },\n \"ruleDeclare\",\n );\n },\n\n async metadataSearch() {\n const refusal = doorAbsent(DOORS.metadataSearch);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"metadataSearch\" });\n return err(refusal);\n },\n\n async fieldPropose() {\n const refusal = doorAbsent(DOORS.fieldPropose);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"fieldPropose\" });\n return err(refusal);\n },\n\n async tablePropose() {\n const refusal = doorAbsent(DOORS.tablePropose);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"tablePropose\" });\n return err(refusal);\n },\n\n async promoteTable({ table_id }) {\n return callDoor<unknown>(\n DOORS.promoteTable,\n { p_organization_id: org, p_table_id: table_id },\n \"promoteTable\",\n );\n },\n\n async promoteField({ table_id, field_id }) {\n return callDoor<unknown>(\n DOORS.promoteField,\n { p_organization_id: org, p_table_id: table_id, p_field_id: field_id },\n \"promoteField\",\n );\n },\n\n async storeIsOpen() {\n return callDoor<boolean>(DOORS.storeIsOpen, { p_organization_id: org }, \"storeIsOpen\");\n },\n\n // ── THE GRID (lane GRID-PRIMITIVES) ──────────────────────────────────────\n async tableDecorate({ table_id, path, value }) {\n return callDoor<TableDecorations>(\n DOORS.tableDecorate,\n { p_organization_id: org, p_table_id: table_id, p_path: path, p_value: value ?? null },\n \"tableDecorate\",\n );\n },\n\n async tableDecorations({ table_id }) {\n return callDoor<TableDecorations>(\n DOORS.tableDecorations,\n { p_organization_id: org, p_table_id: table_id },\n \"tableDecorations\",\n );\n },\n\n async gridLayout({ table_id, view_id }) {\n return callDoor<GridLayout>(\n DOORS.gridLayout,\n { p_organization_id: org, p_table_id: table_id, p_view_id: view_id ?? null },\n \"gridLayout\",\n );\n },\n\n async formulaParse({ table_id, text }) {\n return callDoor<FormulaParse>(\n DOORS.formulaParse,\n { p_organization_id: org, p_table_id: table_id, p_text: text },\n \"formulaParse\",\n );\n },\n\n async actionDeclare({ table_id, actions }) {\n return callDoor<RowAction[]>(\n DOORS.actionDeclare,\n { p_organization_id: org, p_table_id: table_id, p_actions: actions },\n \"actionDeclare\",\n );\n },\n\n async rowActions({ table_id }) {\n return callDoor<{ actions: RowAction[]; stale: unknown[] }>(\n DOORS.rowActions,\n { p_organization_id: org, p_table_id: table_id },\n \"rowActions\",\n );\n },\n\n async actionRun({ action_id, record_ids }) {\n return callDoor<ActionRunResult>(\n DOORS.actionRun,\n { p_organization_id: org, p_action_id: action_id, p_record_ids: record_ids },\n \"actionRun\",\n );\n },\n\n async tableWebhookDeclare({ table_id, target_url, events, description }) {\n return callDoor<TableWebhookDeclared>(\n DOORS.tableWebhookDeclare,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_target_url: target_url,\n p_events: events ?? null,\n p_description: description ?? null,\n },\n \"tableWebhookDeclare\",\n );\n },\n\n async tableWebhooks({ table_id }) {\n return callDoor<TableWebhook[]>(\n DOORS.tableWebhooks,\n { p_organization_id: org, p_table_id: table_id },\n \"tableWebhooks\",\n );\n },\n\n async tableWebhookArchive({ webhook_id }) {\n return callDoor<boolean>(\n DOORS.tableWebhookArchive,\n { p_organization_id: org, p_webhook_id: webhook_id },\n \"tableWebhookArchive\",\n );\n },\n\n async tableFromExample({ home_id, useCaseId }) {\n // The use case is loaded from this package's own library — the one place real template\n // data lives — so a screen can only offer an example that library carries.\n const { loadUseCase } = await import(\"../use-cases/registry\");\n let spec;\n try {\n spec = exampleSpec(await loadUseCase(useCaseId));\n } catch (e) {\n const refusal: RecordsError = {\n code: \"invalid_argument\",\n message: e instanceof Error ? e.message : String(e),\n hint: \"Offer an example from useCaseIds() in @ai-matrx/records/use-cases. Nothing was created.\",\n };\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"tableFromExample\" });\n return err(refusal);\n }\n return callDoor<ExampleBuilt>(\n DOORS.tableFromExample,\n { p_organization_id: org, p_home_id: home_id, p_example: spec },\n \"tableFromExample\",\n );\n },\n\n async autonumberBackfill({ field_id }) {\n return callDoor<{ numbered: number; highest: number | null; says: string }>(\n DOORS.autonumberBackfill,\n { p_organization_id: org, p_field_id: field_id },\n \"autonumberBackfill\",\n );\n },\n\n async ioExport({ table_id, columns, limit }) {\n return callDoor<IoExportPage>(\n DOORS.ioExport,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_columns: columns ?? null,\n p_limit: limit ?? null,\n p_required: \"viewer\",\n },\n \"ioExport\",\n );\n },\n\n async exportXlsx({ table_id, columns, limit, labels, sheetLabel }) {\n const page = await client.ioExport({\n table_id,\n ...(columns !== undefined ? { columns } : {}),\n ...(limit !== undefined ? { limit } : {}),\n });\n if (!page.ok) return err(page.error);\n return ok(await exportPageXlsx(page.data, labels ?? {}, sheetLabel ?? \"Records\"));\n },\n\n async myLevels({ ids, subject }) {\n if (ids.length === 0) return ok([]);\n const answered = await callDoor<Array<{ id: Uuid; level: string | null }>>(\n DOORS.myLevels,\n { p_organization_id: org, p_ids: ids, p_type: subject ?? \"record\" },\n \"myLevels\",\n );\n if (!answered.ok) return err(answered.error);\n return ok(\n (answered.data ?? []).map((row) => ({ id: row.id, level: asPermissionLevel(row.level) })),\n );\n },\n };\n\n return client;\n}\n\n/**\n * Turn a refusal into the conflict a screen can SHOW: which version you wrote\n * against, which one won, and every field you touched as it stands now. Returns\n * null when the refusal was not a stale write.\n */\nexport function asWriteConflict(error: RecordsError, recordId: Uuid): WriteConflict | null {\n const detail = staleWriteDetail(error);\n if (!detail) return null;\n return {\n ...detail,\n record_id: recordId,\n message: error.message,\n hint: error.hint ?? \"\",\n };\n}\n","// src/core/supabase.ts — @ai-matrx/records (HEADLESS)\n//\n// THE ONE ADAPTER FROM A SUPABASE CLIENT TO THIS PACKAGE'S DATA SEAM.\n//\n// Why it exists, and what it cost to learn (2026-09-19, the independent verdict\n// on /data-v2): `RecordsDataSource.rpc(fn, args, { schema })` says the schema\n// out loud, because every door of this store is `custom.<name>` and every door\n// of the trust layer is `iam.<name>`. supabase-js's own\n// `rpc(fn, args, options)` HAS NO `schema` OPTION — its third argument is\n// `{ head, get, count }`, and an unknown key is dropped in silence. So a\n// supabase client handed straight to `config.dataSource` as a structural cast\n// asked its default PostgREST profile, `public`, for every door, and the store\n// answered correctly and uselessly:\n//\n// PGRST202 — Could not find the function public.table_kernel_id(...) in the\n// schema cache\n//\n// Every screen in the record store was dead from a browser because of it, while\n// the desktop app and the browser extension each grew their own way of asking.\n// The class fix is ONE adapter, here, in the headless core, that every host\n// inherits — never three hosts remembering the same thing.\n//\n// The schema is chosen the ONE way supabase-js offers: `client.schema(name)`\n// returns a client bound to that PostgREST profile (it sets the\n// `Accept-Profile` / `Content-Profile` headers), and `.rpc()` on THAT is the\n// call. There is no per-call option that does it.\n//\n// This file holds no key and opens no connection: the host hands in a client\n// that already carries the operating person's session, which is what makes\n// DOOR-5 and AGT-N-4 true — the store sees the person, not us.\n\nimport type { PgError } from \"../results\";\nimport type { RecordsDataSource } from \"../ports\";\n\n/**\n * The structural shape of the supabase client this adapter needs. Deliberately\n * NOT `SupabaseClient<Database>`: a generated `Database` type makes\n * `schema().from().select()` enormous, and a host app that passed its typed\n * client in got `TS2589: Type instantiation is excessively deep and possibly\n * infinite` in its own build (matrx-frontend, 2026-09-18, on all three campaign\n * routes at once). The cast lives here, once, where it is explained.\n */\nexport interface SupabaseLike {\n schema(name: string): {\n rpc(\n fn: string,\n args?: Record<string, unknown>,\n ): PromiseLike<{ data: unknown; error: PgError | null }>;\n from(table: string): unknown;\n };\n}\n\n/** The refusal a caller sees rather than a silent call to the wrong schema. */\nfunction refuse(code: string, message: string, hint: string): { data: null; error: PgError } {\n return { data: null, error: { code, message, hint, details: \"\" } as unknown as PgError };\n}\n\n/**\n * Bind a supabase-js client (or anything with the same `schema(name).rpc()`\n * shape) as this package's data seam.\n *\n * Two things never happen here, both of them loudly:\n *\n * - A call with NO schema is never sent. It is refused by name, because\n * sending it would reach `public` and get the store's PGRST202 several\n * layers away from the mistake.\n * - A client with no `.schema()` is never used. supabase-js has had it since\n * v2.0; a host that binds something else is told exactly what is missing\n * instead of throwing `undefined is not a function` inside a render.\n */\nexport function supabaseDataSource(client: object): RecordsDataSource {\n const supabase = client as unknown as Partial<SupabaseLike>;\n const hasSchema = typeof supabase.schema === \"function\";\n\n return {\n rpc(fn, args, options) {\n if (!hasSchema) {\n return Promise.resolve(\n refuse(\n \"data_source_unbound\",\n `The records client was given something that is not a supabase client: it has no schema() ` +\n `method, so the door ${fn} cannot be called in the schema it lives in.`,\n \"Pass a supabase-js v2 client (createClient(...)) to supabaseDataSource().\",\n ),\n );\n }\n const name = options?.schema;\n if (!name) {\n return Promise.resolve(\n refuse(\n \"schema_unsaid\",\n `The door ${fn} was called without saying which schema it lives in. ` +\n `Every door of this store is custom.${fn} and every trust door is iam.${fn}; ` +\n `an unqualified call reaches PostgREST's default profile (public) and is refused there.`,\n \"This is a bug in the caller, not in your data: /core says the schema on every call.\",\n ),\n );\n }\n return (supabase as SupabaseLike).schema(name).rpc(fn, args) as ReturnType<\n RecordsDataSource[\"rpc\"]\n >;\n },\n schema(name) {\n return (supabase as SupabaseLike).schema(name) as ReturnType<RecordsDataSource[\"schema\"]>;\n },\n };\n}\n","// src/core/validation.ts — @ai-matrx/records\n//\n// THE MIRROR. It predicts ONLY what the store's own triggers will refuse, and it\n// says it in the store's own words.\n//\n// Read this next sentence before changing anything here: THIS IS NOT\n// VALIDATION. The store validates. `custom.validate_values`,\n// `custom.validate_value_envelope` and `custom.size_refusal` are the truth, they\n// run inside the write door, and they cannot be bypassed by a client. What this\n// module buys is the half-second between a person typing and a round trip — it\n// tells a form what the store is ABOUT to say, so the form can say it first.\n//\n// Two rules keep it honest:\n// 1. Every prediction names the store body that would raise it\n// (`predicted_by`), so the next reader can go and check.\n// 2. A prediction the store would NOT make is a defect, and so is a message\n// that differs from the store's by one word. The real-door suite plants\n// each of these against the live store and compares the sentences.\n//\n// Where the mirror cannot see — option membership, relation targets, anything\n// that needs a query — it says nothing at all and lets the door answer. Silence\n// here means \"ask the store\", never \"it is fine\".\n\nimport type { Field, FieldRule } from \"../field\";\nimport type { RecordDocument, ValueEnvelope } from \"../record\";\nimport type { PredictedRefusal } from \"../results\";\nimport {\n ABSENCE_REASONS,\n PER_VALUE_ACCESS_WORDS,\n VALUE_ALTERNATE_KEYS,\n VALUE_ENVELOPE_KEYS,\n} from \"../store.generated\";\n\n/** The published defaults, which are also what the store falls back to when it cannot read a knob. */\nexport const DEFAULT_VALUE_MAX_BYTES = 100_000;\nexport const DEFAULT_DOCUMENT_MAX_BYTES = 1_048_576;\n\nexport interface MirrorLimits {\n value_max_bytes?: number;\n document_max_bytes?: number;\n}\n\nconst jsonType = (value: unknown): string => {\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"array\";\n switch (typeof value) {\n case \"string\":\n return \"string\";\n case \"number\":\n return \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"object\":\n return \"object\";\n default:\n return \"null\";\n }\n};\n\n/**\n * `octet_length(x::text)` — the store measures the JSONB TEXT, and jsonb does\n * not render the way `JSON.stringify` does: it puts a space after every `:` and\n * every `,`. On an 18-key document that is 35 bytes the mirror used to miss, and\n * the real-door suite caught it by holding the two sentences side by side\n * (\"this record is 1080242 bytes\" vs the mirror's 1080207). So the mirror\n * renders the way Postgres does.\n */\nfunction pgJsonbText(value: unknown): string {\n if (value === null || value === undefined) return \"null\";\n if (Array.isArray(value)) return `[${value.map(pgJsonbText).join(\", \")}]`;\n if (typeof value === \"object\") {\n // jsonb keeps the LAST of duplicate keys and drops nothing else; an object\n // literal in TypeScript cannot carry duplicates, so entries are the set.\n const parts = Object.entries(value as Record<string, unknown>).map(\n ([k, v]) => `${JSON.stringify(k)}: ${pgJsonbText(v)}`,\n );\n return `{${parts.join(\", \")}}`;\n }\n return JSON.stringify(value);\n}\n\nconst jsonBytes = (value: unknown): number => new TextEncoder().encode(pgJsonbText(value)).length;\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * `custom.validate_values`. The label the store uses is the Field's label, or\n * its key when the label is empty — the same `coalesce(nullif(...))`.\n */\nfunction labelOf(field: Field): string {\n return field.label && field.label.length > 0 ? field.label : field.key;\n}\n\nfunction ruleRefusal(\n field: Field,\n rule: FieldRule,\n item: unknown,\n values: Record<string, unknown>,\n): PredictedRefusal | null {\n const label = labelOf(field);\n const base = { sqlstate: \"23514\", predicted_by: \"custom.validate_values\", field_key: field.key };\n const num = typeof item === \"number\" ? item : null;\n switch (rule.kind) {\n case \"min\":\n if (num !== null && num < Number(rule.value)) {\n return { ...base, message: `${label} has to be at least ${rule.value}`, hint: \"FLD-3: an attached validation Rule, not a behavior.\" };\n }\n return null;\n case \"max\":\n if (num !== null && num > Number(rule.value)) {\n return { ...base, message: `${label} cannot be more than ${rule.value}`, hint: \"FLD-3: an attached validation Rule, not a behavior.\" };\n }\n return null;\n case \"length\":\n if (typeof item !== \"string\") return null;\n if (rule.value !== undefined && rule.value !== null && rule.value !== \"\" && item.length > Number(rule.value)) {\n return { ...base, message: `${label} is longer than ${rule.value} characters`, hint: \"FLD-3.\" };\n }\n // STORE-RULE-GAPS: the shortest. A blank is `required`'s question.\n if (typeof rule.min === \"number\" && item !== \"\" && item.length < rule.min) {\n return {\n ...base,\n message: `${label} has to be at least ${rule.min} characters long`,\n hint: \"FLD-3.\",\n detail: { field_key: field.key, rule: \"length\", min: rule.min },\n };\n }\n return null;\n case \"pattern\":\n if (typeof item === \"string\" && !new RegExp(String(rule.value)).test(item)) {\n const example = typeof rule.example === \"string\" ? rule.example.trim() : \"\";\n if (example !== \"\") {\n return {\n ...base,\n message: `${label} is not written the way this field expects`,\n hint: `Enter it like ${example}.`,\n detail: { field_key: field.key, rule: \"pattern\", example },\n };\n }\n return { ...base, message: `${label} is not written the way this field expects`, hint: \"FLD-3.\" };\n }\n return null;\n case \"equals_field\": {\n const other = values[String(rule.value)];\n if (other !== undefined && other !== null && JSON.stringify(other) !== JSON.stringify(item)) {\n return {\n ...base,\n message: `${label} and ${rule.value} have to be the same`,\n hint: \"FLD-3 / T8: a constraint across two fields is a Rule attached to one of them, never a behavior.\",\n };\n }\n return null;\n }\n case \"differs_from_field\": {\n const other = values[String(rule.value)];\n if (other !== undefined && JSON.stringify(other) === JSON.stringify(item)) {\n return { ...base, message: `${label} and ${rule.value} have to be different`, hint: \"FLD-3.\" };\n }\n return null;\n }\n default:\n return null;\n }\n}\n\n/**\n * Predict `custom.validate_values`. Everything it checks WITHOUT a query is\n * mirrored; option membership and relation targets are deliberately left to the\n * door, and the mirror says nothing about them.\n */\nexport function predictValueRefusals(\n fields: Field[],\n values: Record<string, unknown>,\n recordType?: string,\n): PredictedRefusal[] {\n const found: PredictedRefusal[] = [];\n for (const field of fields) {\n const label = labelOf(field);\n const base = { sqlstate: \"23514\", predicted_by: \"custom.validate_values\", field_key: field.key };\n const raw = values[field.key];\n const isEmpty =\n raw === undefined ||\n raw === null ||\n (field.multi && Array.isArray(raw) && raw.length === 0);\n\n if (isEmpty) {\n if (field.required) {\n found.push({\n ...base,\n message: `${label} is required`,\n hint: `REC-51: the field ${field.key} of this table.`,\n });\n }\n continue;\n }\n\n if (field.type === \"formula\") {\n found.push({\n ...base,\n message: `${label} is worked out by the system, so it cannot be typed in`,\n hint: `FLD-9: this formula computes on ${field.compute_on ?? \"write\"}.`,\n });\n continue;\n }\n\n let items: unknown[];\n if (field.multi) {\n if (!Array.isArray(raw)) {\n found.push({ ...base, message: `${label} holds many values, so it takes a list`, hint: \"FLD-2: the multi modifier.\" });\n continue;\n }\n items = raw;\n } else {\n if (Array.isArray(raw)) {\n found.push({ ...base, message: `${label} holds one value, and it was given a list`, hint: \"FLD-2: multi is off for this field.\" });\n continue;\n }\n items = [raw];\n }\n\n for (const item of items) {\n if (field.type === \"text\" && typeof item !== \"string\") {\n found.push({ ...base, message: `${label} takes words, and it was given a ${jsonType(item)}`, hint: \"FLD-1: text.\" });\n } else if (field.type === \"range\") {\n const kind = (field.config?.[\"kind\"] as string | undefined) ?? \"number\";\n if (typeof item === \"number\") {\n /* fine */\n } else if (typeof item === \"string\" && (kind === \"date\" || kind === \"datetime\")) {\n if (Number.isNaN(Date.parse(item))) {\n found.push({ ...base, message: `${label} takes a date, and ${item} is not one`, hint: \"FLD-1: range, of kind date.\" });\n }\n } else {\n found.push({ ...base, message: `${label} takes a number, and it was given a ${jsonType(item)}`, hint: \"FLD-1: range.\" });\n }\n } else if (field.type === \"list\") {\n if (typeof item !== \"string\") {\n found.push({\n ...base,\n message: `${label} takes one of its choices, and it was given a ${jsonType(item)}`,\n hint: \"FLD-5 / FLD-6: a list field stores the id of the option RECORD, because every pick-list is already a Table.\",\n });\n }\n // MEMBERSHIP needs the store: the mirror stops here on purpose. A list\n // cell holds the option's KEY (CHOICE-VALUE) and the door also takes its\n // label or id, so no shape of string is predictably wrong here — and a\n // column that takes other values (STORE-RULE-GAPS `allow_other`) ADDS an\n // unknown word. This used to refuse every value that was not a uuid,\n // which the store has not required since option keys landed.\n } else if (field.type === \"relation\") {\n if (typeof item !== \"string\") {\n found.push({ ...base, message: `${label} points at a record, and it was given a ${jsonType(item)}`, hint: \"FLD-1: relation.\" });\n } else if (!UUID.test(item)) {\n found.push({\n ...base,\n message: `${label} points at something that is not there`,\n hint: `REC-51: ${label} stores the id of a record, and what it was given is not an id at all.`,\n });\n }\n // EXISTENCE needs the store: the mirror stops here on purpose.\n }\n\n for (const rule of field.rules ?? []) {\n const applies =\n !rule.applies_to_types ||\n rule.applies_to_types.length === 0 ||\n (recordType !== undefined && rule.applies_to_types.includes(recordType));\n if (!applies) continue;\n const refusal = ruleRefusal(field, rule, item, values);\n if (refusal) found.push(refusal);\n }\n }\n\n if (field.type === \"relation\" && field.multi && field.relation_max !== null) {\n const n = items.length;\n if (n > field.relation_max) {\n found.push({\n ...base,\n message: `${label} points at ${n} things, and it can point at ${field.relation_max} at most`,\n hint: \"REC-51: relation_max.\",\n });\n }\n }\n }\n return found;\n}\n\n/** Predict `custom.size_refusal`, with the same two ceilings and the same sentences. */\nexport function predictSizeRefusal(\n document: RecordDocument,\n limits: MirrorLimits = {},\n): PredictedRefusal | null {\n const valueMax = limits.value_max_bytes ?? DEFAULT_VALUE_MAX_BYTES;\n const docMax = limits.document_max_bytes ?? DEFAULT_DOCUMENT_MAX_BYTES;\n for (const [key, value] of Object.entries(document)) {\n if (key.startsWith(\"_\")) continue;\n const bytes = jsonBytes(value);\n if (bytes > valueMax) {\n return {\n field_key: key,\n sqlstate: \"23514\",\n predicted_by: \"custom.size_refusal\",\n message:\n `${key} is ${bytes} bytes, and one value in a record holds at most ${valueMax}. ` +\n `Put the big thing in a file record and point the value at it - this store has a File table for exactly that.`,\n };\n }\n }\n const total = jsonBytes(document);\n if (total > docMax) {\n return {\n sqlstate: \"23514\",\n predicted_by: \"custom.size_refusal\",\n message:\n `this record is ${total} bytes, and one record holds at most ${docMax}. ` +\n `Put the big things in file records and point the values at them - this store has a File table for exactly that.`,\n };\n }\n return null;\n}\n\n/**\n * Predict `custom.value_envelope_refusal`. The store returns the FIRST problem\n * it finds and stops; so does this, key order included, so the two agree on\n * which sentence a person sees.\n */\nexport function predictEnvelopeRefusal(document: RecordDocument): PredictedRefusal | null {\n const say = (message: string): PredictedRefusal => ({\n message,\n sqlstate: \"23514\",\n predicted_by: \"custom.value_envelope_refusal\",\n });\n\n let sources: Record<string, unknown> = {};\n if (Object.prototype.hasOwnProperty.call(document, \"_sources\")) {\n const block = document._sources as unknown;\n if (jsonType(block) !== \"object\") {\n return say(\n `this record's provenance block (_sources) must be an object of pointer -> source, and it is a ${jsonType(block)}.`,\n );\n }\n sources = block as Record<string, unknown>;\n for (const pointer of Object.keys(sources)) {\n if (!/^s[0-9]+$/.test(pointer)) {\n return say(\n `\"${pointer}\" is not a provenance pointer. A pointer is interned by this store and looks like s1, s2, s3 — it is never a name a writer chooses.`,\n );\n }\n if (jsonType(sources[pointer]) !== \"object\") {\n return say(\n `the source at ${pointer} must be an object describing where the value came from, and it is a ${jsonType(sources[pointer])}.`,\n );\n }\n }\n const distinct = new Set(Object.values(sources).map((v) => JSON.stringify(v)));\n if (distinct.size !== Object.keys(sources).length) {\n return say(\n `the same source is written twice in this record's provenance block. A source is interned once per save and every value that came from it points at the one entry.`,\n );\n }\n }\n\n if (!Object.prototype.hasOwnProperty.call(document, \"_values\")) return null;\n const block = document._values as unknown;\n if (jsonType(block) !== \"object\") {\n return say(\n `this record's value block (_values) must be an object of field key -> envelope, and it is a ${jsonType(block)}.`,\n );\n }\n\n for (const [key, envUnknown] of Object.entries(block as Record<string, unknown>)) {\n if (jsonType(envUnknown) !== \"object\") {\n return say(`the envelope for ${key} must be an object, and it is a ${jsonType(envUnknown)}.`);\n }\n const env = envUnknown as Record<string, unknown> & Partial<ValueEnvelope>;\n\n for (const k of Object.keys(env)) {\n if (!(VALUE_ENVELOPE_KEYS as readonly string[]).includes(k)) {\n if ((PER_VALUE_ACCESS_WORDS as readonly string[]).includes(k)) {\n return say(\n `${key} cannot carry \"${k}\": visibility and access belong to a Field and to a Record, never to a single value. A value that must be secret goes in a contained record with its own visibility.`,\n );\n }\n return say(\n `${key} carries \"${k}\", which is not part of a value envelope. An envelope holds ${VALUE_ENVELOPE_KEYS.join(\", \")}.`,\n );\n }\n }\n\n // ver, actor, on_behalf_of and at ARE NOT PREDICTED, and that is not an\n // omission. `custom._value_envelope` runs `custom.stamp_value_envelopes`\n // (which overwrites actor, on_behalf_of and at with the caller's real\n // identity) and `custom.value_versions` (which writes ver) BEFORE\n // `custom.value_envelope_refusal` ever looks. A caller who sends\n // `{\"actor\":\"wizard\"}` or no `ver` at all is not refused — the store simply\n // writes the truth over it. The mirror used to predict a refusal here; the\n // real-door suite planted those five envelopes at the live door, the store\n // accepted every one, and the prediction came out. Silence here is the\n // store's behaviour, not a gap.\n\n if (\"absent\" in env && env.absent !== null) {\n const absent = String(env.absent);\n if (!(ABSENCE_REASONS as readonly string[]).includes(absent)) {\n return say(\n `${key}: \"${absent}\" is not a reason a value can be missing. The reasons are ${ABSENCE_REASONS.join(\", \")}.`,\n );\n }\n if (key in document && document[key] !== null) {\n return say(`${key} both holds a value and says why it is missing (\"${absent}\"). It can be one or the other.`);\n }\n }\n\n if (\"src\" in env && env.src !== null) {\n if (typeof env.src !== \"string\") {\n return say(\n `${key}: its source must be a provenance pointer this store interned. Write the source itself and the store interns it; ${jsonType(env.src)} is not a pointer.`,\n );\n }\n if (!(env.src in sources)) {\n return say(`${key} points at the source ${env.src}, and this record's provenance block has no such entry.`);\n }\n }\n\n if (\"alternates\" in env && env.alternates !== null) {\n if (!Array.isArray(env.alternates)) {\n return say(`${key}: its other candidate values must be a list, and it is a ${jsonType(env.alternates)}.`);\n }\n const ranks: number[] = [];\n for (const altUnknown of env.alternates) {\n if (jsonType(altUnknown) !== \"object\") {\n return say(`${key}: every other candidate is a value, a source and a rank, and one of them is a ${jsonType(altUnknown)}.`);\n }\n const alt = altUnknown as unknown as Record<string, unknown>;\n for (const k of Object.keys(alt)) {\n if (!(VALUE_ALTERNATE_KEYS as readonly string[]).includes(k)) {\n if ((PER_VALUE_ACCESS_WORDS as readonly string[]).includes(k)) {\n return say(\n `${key}: an alternate cannot carry \"${k}\" — visibility and access belong to a Field and to a Record, never to a single value.`,\n );\n }\n return say(\n `${key}: an alternate carries \"${k}\", which is not part of one. An alternate holds ${VALUE_ALTERNATE_KEYS.join(\", \")} — a rank, which is the order an organization's sources are trusted in, and never a score or a confidence a machine invented.`,\n );\n }\n }\n if (!(\"value\" in alt)) {\n return say(`${key}: an alternate with no value is not a candidate for anything.`);\n }\n const rank = alt[\"rank\"];\n if (typeof rank !== \"number\" || !Number.isInteger(rank) || rank < 1) {\n return say(`${key}: every alternate carries a whole rank of 1 or more — the order its source is trusted in.`);\n }\n if (ranks.includes(rank)) {\n return say(`${key}: two alternates claim rank ${rank}. A rank is an order, so it is held by one candidate.`);\n }\n ranks.push(rank);\n if (\"src\" in alt && alt[\"src\"] !== null) {\n if (typeof alt[\"src\"] !== \"string\") {\n return say(`${key}: an alternate's source must be a provenance pointer this store interned, and it is a ${jsonType(alt[\"src\"])}.`);\n }\n if (!(String(alt[\"src\"]) in sources)) {\n return say(`${key}: an alternate points at the source ${String(alt[\"src\"])}, and this record's provenance block has no such entry.`);\n }\n }\n }\n }\n }\n return null;\n}\n\n/** Everything the mirror can see about one write, in the order the store sees it. */\nexport function predictWriteRefusals(args: {\n fields: Field[];\n document: RecordDocument;\n recordType?: string;\n limits?: MirrorLimits;\n}): PredictedRefusal[] {\n const { fields, document, recordType, limits } = args;\n const values: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(document)) {\n if (!k.startsWith(\"_\")) values[k] = v;\n }\n const found: PredictedRefusal[] = [];\n const envelope = predictEnvelopeRefusal(document);\n if (envelope) found.push(envelope);\n const size = predictSizeRefusal(document, limits);\n if (size) found.push(size);\n found.push(...predictValueRefusals(fields, values, recordType));\n return found;\n}\n","// src/core/io.ts — @ai-matrx/records\n//\n// DOOR-11. CSV and XLSX, import and export — headless: bytes in, bytes out, no\n// `document`, no `Blob`, no download. The browser half (the anchor click, the\n// object URL) already exists and is not duplicated here: the design system's\n// `@ai-matrx/design-system/data-table/xlsx` owns it, and `records-ui` hands\n// these bytes to it.\n//\n// The column selection and the cell stringification are the SAME ones the\n// canonical table's CSV export uses (`rowsToCsvFromColumns` in that package):\n// same quoting rule, same header row, same order. Two independent row builders\n// is how a user's CSV and their Excel file start disagreeing.\n//\n// DOOR-4 is why export takes READ VALUES rather than raw rows: exports store\n// only what the reading principal may see, and a ReadValue is what came back\n// THROUGH the read door. Handing this function a row it read around the door\n// would be the leak DOOR-4 forbids, and there is no overload that accepts one.\n\nimport type { Field } from \"../field\";\nimport type { ReadValue } from \"../record\";\n\n/** One exportable row: the values of one record, keyed by field key. */\nexport type ExportRow = Record<string, ReadValue | undefined>;\n\n/** The same escaping the canonical table uses. */\nconst escape = (value: string): string =>\n /[\",\\n\\r]/.test(value) ? `\"${value.replace(/\"/g, '\"\"')}\"` : value;\n\n/**\n * The same stringification: a string stays itself, everything else becomes its\n * JSON, and an absent value becomes the store's own absence WORD rather than an\n * empty cell. A blank cell would be the silent failure VAL-2 exists to prevent —\n * \"we never asked\" and \"they refused\" are different facts and the export says\n * which.\n */\nexport function cellText(value: ReadValue | undefined): string {\n if (!value) return \"\";\n if (value.absent_reason) return `(${value.absent_reason})`;\n const raw = value.value;\n if (raw === null || raw === undefined) return \"\";\n if (typeof raw === \"string\") return raw;\n return JSON.stringify(raw);\n}\n\nfunction headerFor(field: Field): string {\n return field.label && field.label.length > 0 ? field.label : field.key;\n}\n\nexport function exportCsv(fields: Field[], rows: ExportRow[]): string {\n const lines = [fields.map((f) => escape(headerFor(f))).join(\",\")];\n for (const row of rows) {\n lines.push(fields.map((f) => escape(cellText(row[f.key]))).join(\",\"));\n }\n return lines.join(\"\\n\");\n}\n\n/** The header row plus every cell, as the sheet writer takes it. */\nexport function toAoa(fields: Field[], rows: ExportRow[]): string[][] {\n return [fields.map(headerFor), ...rows.map((row) => fields.map((f) => cellText(row[f.key])))];\n}\n\n/**\n * The XLSX bytes. The `xlsx` import is dynamic so a consumer that only ever\n * exports CSV never pays for the library — the design-system module is loaded\n * the same way, and for the same reason.\n */\nexport async function exportXlsx(\n fields: Field[],\n rows: ExportRow[],\n sheetLabel = \"Records\",\n): Promise<Uint8Array> {\n const XLSX = await import(\"xlsx\");\n const worksheet = XLSX.utils.aoa_to_sheet(toAoa(fields, rows));\n const workbook = XLSX.utils.book_new();\n const name = sheetLabel.replace(/[\\\\/?*[\\]:]/g, \" \").trim().slice(0, 31) || \"Data\";\n XLSX.utils.book_append_sheet(workbook, worksheet, name);\n return XLSX.write(workbook, { type: \"array\", bookType: \"xlsx\", compression: true }) as Uint8Array;\n}\n\n/**\n * A PARSED FILE, AND NOTHING ELSE: its headings, and every row keyed by them.\n *\n * 🚨 THERE IS NO `field`, NO `unmapped` AND NO WAY TO ASK FOR ONE, and that is\n * the point. Until 2026-09-20 this parse ALSO decided which Field each heading\n * meant — it took `fields`, matched each header by key or label, keyed the rows\n * by whatever it matched, and **dropped every column it did not**. That cannot\n * be the input to `custom.io_import_plan` / `custom.io_import_rows`, whose whole\n * job is to decide the mapping and to OFFER what they could not match as a new\n * column: the store can only offer a column whose values reached it.\n *\n * Measured by looking at the screen: every unmapped column's samples came back\n * empty and its proposal read \"every row in this column is empty, so there is\n * nothing to go on\" — for columns plainly full of values.\n *\n * The fix is the SHAPE, not a second field beside the first. These functions no\n * longer take `fields`, so a parse cannot decide a mapping even by accident, and\n * there is no safe path left beside the unsafe one.\n */\nexport interface ParsedImport {\n /** The file's own headings, in the file's own order and spelling. */\n headers: string[];\n /** Every row, keyed by heading. Every column is here; nothing is dropped. */\n rows: Array<Record<string, string>>;\n}\n\n/** RFC-4180 enough for what the canonical table writes, quotes and embedded newlines included. */\nexport function parseCsv(text: string): string[][] {\n const rows: string[][] = [];\n let row: string[] = [];\n let cell = \"\";\n let quoted = false;\n for (let i = 0; i < text.length; i += 1) {\n const ch = text[i];\n if (quoted) {\n if (ch === '\"') {\n if (text[i + 1] === '\"') {\n cell += '\"';\n i += 1;\n } else quoted = false;\n } else cell += ch;\n continue;\n }\n if (ch === '\"') quoted = true;\n else if (ch === \",\") {\n row.push(cell);\n cell = \"\";\n } else if (ch === \"\\n\" || ch === \"\\r\") {\n if (ch === \"\\r\" && text[i + 1] === \"\\n\") i += 1;\n row.push(cell);\n rows.push(row);\n row = [];\n cell = \"\";\n } else cell += ch;\n }\n if (cell.length > 0 || row.length > 0) {\n row.push(cell);\n rows.push(row);\n }\n return rows;\n}\n\nexport function importCsv(text: string): ParsedImport {\n return fromMatrix(parseCsv(text));\n}\n\nexport async function importXlsx(bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport> {\n const XLSX = await import(\"xlsx\");\n const workbook = XLSX.read(bytes, { type: \"array\" });\n const first = workbook.SheetNames[0];\n if (!first) return { headers: [], rows: [] };\n const sheet = workbook.Sheets[first];\n if (!sheet) return { headers: [], rows: [] };\n const matrix = XLSX.utils.sheet_to_json<string[]>(sheet, { header: 1, raw: false, defval: \"\" });\n return fromMatrix(matrix);\n}\n\nfunction fromMatrix(matrix: string[][]): ParsedImport {\n const [header, ...body] = matrix;\n if (!header) return { headers: [], rows: [] };\n const headers = header.map((text) => String(text ?? \"\"));\n const rows = body\n .filter((line) => line.some((cell) => String(cell ?? \"\").trim().length > 0))\n .map((line) => {\n const record: Record<string, string> = {};\n headers.forEach((heading, index) => {\n if (heading.trim().length > 0) record[heading] = String(line[index] ?? \"\");\n });\n return record;\n });\n return { headers, rows };\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAwBa,SAkTN;AA1UP;AAAA;AAAA;AAwBO,IAAM,UAAmB;AAAA,MAC9B,IAAI;AAAA,MACJ,SACE;AAAA,MACF,UAAU;AAAA,MACV,YAAY;AAAA,MAEZ,UAAU;AAAA,QACR,MAAM;AAAA,QACN,WAAW;AAAA,QACX,SAAS;AAAA,UACP,OAAO;AAAA,UACP,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ,SAAS;AAAA,QACX;AAAA,QACA,OAAO;AAAA,QACP,OAAO;AAAA,QACP,UAAU;AAAA,MACZ;AAAA,MAEA,QAAQ;AAAA,QACN;AAAA,UACE,OAAO;AAAA,UACP,MAAM;AAAA,UACN,eAAe;AAAA,UACf,aAAa;AAAA,UACb,MAAM;AAAA,UACN,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,MAAM;AAAA,UACN,YAAY;AAAA,UACZ,WAAW;AAAA,UACX,QAAQ;AAAA,YACN,EAAE,KAAK,SAAS,OAAO,UAAU,YAAY,QAAQ,UAAU,MAAM,aAAa,YAAY,eAAe,UAAU;AAAA,YACvH,EAAE,KAAK,YAAY,OAAO,UAAU,YAAY,UAAU,SAAS,CAAC,aAAa,eAAe,aAAa,QAAQ,WAAW,iBAAiB,GAAG,aAAa,YAAY,eAAe,UAAU;AAAA,YACtM,EAAE,KAAK,WAAW,OAAO,WAAW,YAAY,UAAU,SAAS,CAAC,WAAW,WAAW,WAAW,YAAY,kBAAkB,QAAQ,GAAG,aAAa,YAAY,eAAe,UAAU;AAAA,YAChM,EAAE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ACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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,CAAC;AAC9F,SAAO,WAAW,MAAM;AAC1B;AAEA,SAAS,WAAW,QAAkC;AACpD,QAAM,CAAC,QAAQ,GAAG,IAAI,IAAI;AAC1B,MAAI,CAAC,OAAQ,QAAO,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC,EAAE;AAC5C,QAAM,UAAU,OAAO,IAAI,CAAC,SAAS,OAAO,QAAQ,EAAE,CAAC;AACvD,QAAM,OAAO,KACV,OAAO,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,OAAO,QAAQ,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,EAC1E,IAAI,CAAC,SAAS;AACb,UAAM,SAAiC,CAAC;AACxC,YAAQ,QAAQ,CAAC,SAAS,UAAU;AAClC,UAAI,QAAQ,KAAK,EAAE,SAAS,EAAG,QAAO,OAAO,IAAI,OAAO,KAAK,KAAK,KAAK,EAAE;AAAA,IAC3E,CAAC;AACD,WAAO;AAAA,EACT,CAAC;AACH,SAAO,EAAE,SAAS,KAAK;AACzB;","names":["useCase","useCase","useCase","useCase","window","useCase","err","rows","loadUseCase","UUID","block"]}
1
+ {"version":3,"sources":["../../src/use-cases/alvarado-chen-kitchen-weekly-cooking.ts","../../src/use-cases/birchwood-avenue-renovation-budget.ts","../../src/use-cases/harbor-dental-new-patient-intake.ts","../../src/use-cases/ridgeline-physical-therapy-plan-of-care.ts","../../src/use-cases/registry.ts","../../src/vocabulary.ts","../../src/archive.ts","../../src/level.ts","../../src/field.ts","../../src/choice.ts","../../src/coerce.ts","../../src/pipeline.ts","../../src/rule.ts","../../src/portal.ts","../../src/aggregate.ts","../../src/grid.ts","../../src/capture-queue.ts","../../src/results.ts","../../src/ops.ts","../../src/store.generated.ts","../../src/record-scope.ts","../../src/core/doors.ts","../../src/core/pgError.ts","../../src/core/recordChanges.ts","../../src/core/query.ts","../../src/core/client.ts","../../src/core/supabase.ts","../../src/core/validation.ts","../../src/core/io.ts"],"sourcesContent":["// src/use-cases/alvarado-chen-kitchen-weekly-cooking.ts — @ai-matrx/records/use-cases\n//\n// THE USE CASE: Priya and Daniel Alvarado-Chen cook for a family of five, and\n// they use this to keep the recipes they actually make, what goes into each one,\n// and the week's shopping list that falls out of the meals they have planned —\n// instead of three notebooks, a photo of a card and a text message at the shop.\n//\n// The law welcomes personal life, and a household is the honest test of a\n// platform that claims anyone can model their own work: nobody here has a job\n// title, a CRM or a pipeline consultant.\n//\n// PROVENANCE. Tables, fields and rows come from the data crew's dataset\n// `matrx-frontend/scripts/campaign-tests/use-cases/family-recipe-collection.json`.\n// Fixed on adoption: the household was \"The Alvarado-Chen Kitchen (test\n// fixture)\" — a test organization carries the use case's own name and is found\n// for cleanup by its tag, never by a junk suffix. Relations pointed at a\n// recipe's TITLE rather than at the row. The business identity, relationships,\n// form, pipeline, dashboard question, document and notification rule were\n// written for this file.\n//\n// Everyone here is invented.\n\nimport type { UseCase } from \"./types\";\n\nexport const useCase: UseCase = {\n id: \"alvarado-chen-kitchen-weekly-cooking\",\n useCase:\n \"Priya and Daniel Alvarado-Chen cook for a family of five, and they use this to keep the recipes they actually make, the ingredients each one needs, and the weekly shopping list that falls out of the meals they have planned, instead of three notebooks and a text message at the shop.\",\n industry: \"Household cooking\",\n cleanupTag: \"use-case:alvarado-chen-kitchen-weekly-cooking\",\n\n business: {\n name: \"The Alvarado-Chen Kitchen\",\n describes: \"A household of five that cooks most nights and shops once a week across three shops.\",\n address: {\n line1: \"68 Winterbourne Road\",\n city: \"Oak Park\",\n region: \"IL\",\n postalCode: \"60302\",\n country: \"US\",\n },\n phone: \"+1 708 555 0126\",\n email: \"kitchen@alvaradochen.net\",\n timezone: \"America/Chicago\",\n },\n\n tables: [\n {\n token: \"recipes\",\n name: \"Recipes\",\n labelSingular: \"Recipe\",\n labelPlural: \"Recipes\",\n type: \"entity\",\n display: \"grid\",\n weight: \"heavy\",\n ordered: false,\n icon: \"chef-hat\",\n titleField: \"title\",\n describes: \"Every dish the household actually cooks, with who brought it in and how long it takes.\",\n fields: [\n { key: \"title\", label: \"Recipe\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"category\", label: \"Course\", parityType: \"select\", choices: [\"Breakfast\", \"Main Course\", \"Side Dish\", \"Soup\", \"Dessert\", \"Sauce/Condiment\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"cuisine\", label: \"Cuisine\", parityType: \"select\", choices: [\"Mexican\", \"Chinese\", \"Italian\", \"American\", \"Middle Eastern\", \"Indian\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"prep_minutes\", label: \"Prep time\", parityType: \"integer\", unit: \"min\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"cook_minutes\", label: \"Cook time\", parityType: \"integer\", unit: \"min\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"servings\", label: \"Serves\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"source\", label: \"Where it came from\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"contributed_by\", label: \"Brought in by\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"date_added\", label: \"Added\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"recipe-chilaquiles-verdes\", values: {\"title\": \"Chilaquiles Verdes\", \"category\": \"Breakfast\", \"cuisine\": \"Mexican\", \"prep_minutes\": 15, \"cook_minutes\": 20, \"servings\": 4, \"source\": \"Grandma Alvarado's recipe box, card #12\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-01-08\"} },\n { key: \"recipe-kung-pao-chicken\", values: {\"title\": \"Kung Pao Chicken\", \"category\": \"Main Course\", \"cuisine\": \"Chinese\", \"prep_minutes\": 20, \"cook_minutes\": 15, \"servings\": 4, \"source\": \"Adapted from Fuchsia Dunlop's Land of Fish and Rice\", \"contributed_by\": \"Wei Chen\", \"date_added\": \"2026-01-15\"} },\n { key: \"recipe-slow-braised-short-rib-ragu\", values: {\"title\": \"Slow-Braised Short Rib Ragu\", \"category\": \"Main Course\", \"cuisine\": \"Italian\", \"prep_minutes\": 25, \"cook_minutes\": 210, \"servings\": 6, \"source\": \"Sunday dinner tradition, no written source\", \"contributed_by\": \"Marco Alvarado\", \"date_added\": \"2026-02-02\"} },\n { key: \"recipe-mapo-tofu\", values: {\"title\": \"Mapo Tofu\", \"category\": \"Main Course\", \"cuisine\": \"Chinese\", \"prep_minutes\": 10, \"cook_minutes\": 15, \"servings\": 3, \"source\": \"Wei's mother, dictated over the phone\", \"contributed_by\": \"Wei Chen\", \"date_added\": \"2026-02-10\"} },\n { key: \"recipe-elote-street-corn-salad\", values: {\"title\": \"Elote Street Corn Salad\", \"category\": \"Side Dish\", \"cuisine\": \"Mexican\", \"prep_minutes\": 15, \"cook_minutes\": 10, \"servings\": 6, \"source\": \"Farmers market recipe card\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-03-01\"} },\n { key: \"recipe-pozole-rojo\", values: {\"title\": \"Pozole Rojo\", \"category\": \"Soup\", \"cuisine\": \"Mexican\", \"prep_minutes\": 30, \"cook_minutes\": 180, \"servings\": 8, \"source\": \"Family recipe, three generations\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-03-14\"} },\n { key: \"recipe-hot-and-sour-soup\", values: {\"title\": \"Hot and Sour Soup\", \"category\": \"Soup\", \"cuisine\": \"Chinese\", \"prep_minutes\": 15, \"cook_minutes\": 20, \"servings\": 4, \"source\": \"Wei Chen's own recipe\", \"contributed_by\": \"Wei Chen\", \"date_added\": \"2026-03-22\"} },\n { key: \"recipe-tres-leches-cake\", values: {\"title\": \"Tres Leches Cake\", \"category\": \"Dessert\", \"cuisine\": \"Mexican\", \"prep_minutes\": 30, \"cook_minutes\": 35, \"servings\": 12, \"source\": \"Grandma Alvarado's recipe box, card #4\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-04-05\"} },\n { key: \"recipe-cacio-e-pepe\", values: {\"title\": \"Cacio e Pepe\", \"category\": \"Main Course\", \"cuisine\": \"Italian\", \"prep_minutes\": 5, \"cook_minutes\": 15, \"servings\": 2, \"source\": \"Weeknight standby, no written source\", \"contributed_by\": \"Marco Alvarado\", \"date_added\": \"2026-04-12\"} },\n { key: \"recipe-chana-masala\", values: {\"title\": \"Chana Masala\", \"category\": \"Main Course\", \"cuisine\": \"Indian\", \"prep_minutes\": 15, \"cook_minutes\": 30, \"servings\": 4, \"source\": \"Learned from neighbor Priya\", \"contributed_by\": \"Wei Chen\", \"date_added\": \"2026-05-01\"} },\n { key: \"recipe-salsa-verde-cruda\", values: {\"title\": \"Salsa Verde Cruda\", \"category\": \"Sauce/Condiment\", \"cuisine\": \"Mexican\", \"prep_minutes\": 10, \"cook_minutes\": 0, \"servings\": 8, \"source\": \"Grandma Alvarado's recipe box, card #1\", \"contributed_by\": \"Rosa Alvarado\", \"date_added\": \"2026-05-10\"} },\n { key: \"recipe-shakshuka\", values: {\"title\": \"Shakshuka\", \"category\": \"Breakfast\", \"cuisine\": \"Middle Eastern\", \"prep_minutes\": 10, \"cook_minutes\": 25, \"servings\": 4, \"source\": \"Ottolenghi's Jerusalem, adapted\", \"contributed_by\": \"Marco Alvarado\", \"date_added\": \"2026-05-18\"} },\n ],\n },\n {\n token: \"ingredients\",\n name: \"Ingredients\",\n labelSingular: \"Ingredient\",\n labelPlural: \"Ingredients\",\n type: \"detail\",\n display: \"list\",\n weight: \"light\",\n ordered: true,\n icon: \"carrot\",\n titleField: \"ingredient_name\",\n describes: \"What goes into each recipe, in the amounts the recipe is written for.\",\n fields: [\n { key: \"recipe\", label: \"Recipe\", parityType: \"relation\", required: true, relationTarget: \"recipes\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"ingredient_name\", label: \"Ingredient\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"quantity\", label: \"Quantity\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"unit\", label: \"Unit\", parityType: \"select\", choices: [\"cup\", \"tbsp\", \"tsp\", \"oz\", \"lb\", \"clove\", \"whole\", \"can\", \"pinch\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"notes\", label: \"Notes\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"ingredient-corn-tortillas-cut-into-wedges-and-fried\", values: {\"recipe\": \"recipe-chilaquiles-verdes\", \"ingredient_name\": \"corn tortillas, cut into wedges and fried\", \"quantity\": 12, \"unit\": \"whole\", \"notes\": \"day-old tortillas fry crisper\"} },\n { key: \"ingredient-tomatillos\", values: {\"recipe\": \"recipe-chilaquiles-verdes\", \"ingredient_name\": \"tomatillos\", \"quantity\": 1, \"unit\": \"lb\", \"notes\": \"husked and rinsed\"} },\n { key: \"ingredient-serrano-peppers\", values: {\"recipe\": \"recipe-chilaquiles-verdes\", \"ingredient_name\": \"serrano peppers\", \"quantity\": 2, \"unit\": \"whole\", \"notes\": \"seeds removed for less heat\"} },\n { key: \"ingredient-queso-fresco\", values: {\"recipe\": \"recipe-chilaquiles-verdes\", \"ingredient_name\": \"queso fresco\", \"quantity\": 4, \"unit\": \"oz\", \"notes\": \"crumbled for topping\"} },\n { key: \"ingredient-chicken-thighs-diced\", values: {\"recipe\": \"recipe-kung-pao-chicken\", \"ingredient_name\": \"chicken thighs, diced\", \"quantity\": 1.5, \"unit\": \"lb\", \"notes\": \"boneless, skinless\"} },\n { key: \"ingredient-dried-red-chilies\", values: {\"recipe\": \"recipe-kung-pao-chicken\", \"ingredient_name\": \"dried red chilies\", \"quantity\": 8, \"unit\": \"whole\", \"notes\": \"adjust to taste\"} },\n { key: \"ingredient-roasted-peanuts\", values: {\"recipe\": \"recipe-kung-pao-chicken\", \"ingredient_name\": \"roasted peanuts\", \"quantity\": 0.5, \"unit\": \"cup\", \"notes\": \"\"} },\n { key: \"ingredient-sichuan-peppercorns\", values: {\"recipe\": \"recipe-kung-pao-chicken\", \"ingredient_name\": \"Sichuan peppercorns\", \"quantity\": 1, \"unit\": \"tsp\", \"notes\": \"toasted and cracked\"} },\n { key: \"ingredient-bone-in-short-ribs\", values: {\"recipe\": \"recipe-slow-braised-short-rib-ragu\", \"ingredient_name\": \"bone-in short ribs\", \"quantity\": 3, \"unit\": \"lb\", \"notes\": \"trimmed of excess fat\"} },\n { key: \"ingredient-san-marzano-tomatoes\", values: {\"recipe\": \"recipe-slow-braised-short-rib-ragu\", \"ingredient_name\": \"San Marzano tomatoes\", \"quantity\": 1, \"unit\": \"can\", \"notes\": \"28 oz can, crushed by hand\"} },\n { key: \"ingredient-red-wine\", values: {\"recipe\": \"recipe-slow-braised-short-rib-ragu\", \"ingredient_name\": \"red wine\", \"quantity\": 1, \"unit\": \"cup\", \"notes\": \"something drinkable\"} },\n { key: \"ingredient-soft-tofu-cubed\", values: {\"recipe\": \"recipe-mapo-tofu\", \"ingredient_name\": \"soft tofu, cubed\", \"quantity\": 14, \"unit\": \"oz\", \"notes\": \"one package\"} },\n { key: \"ingredient-doubanjiang-fermented-chili-bean-paste\", values: {\"recipe\": \"recipe-mapo-tofu\", \"ingredient_name\": \"doubanjiang (fermented chili bean paste)\", \"quantity\": 2, \"unit\": \"tbsp\", \"notes\": \"Pixian brand preferred\"} },\n { key: \"ingredient-ground-pork\", values: {\"recipe\": \"recipe-mapo-tofu\", \"ingredient_name\": \"ground pork\", \"quantity\": 0.5, \"unit\": \"lb\", \"notes\": \"\"} },\n { key: \"ingredient-corn-kernels-charred\", values: {\"recipe\": \"recipe-elote-street-corn-salad\", \"ingredient_name\": \"corn kernels, charred\", \"quantity\": 4, \"unit\": \"cup\", \"notes\": \"grilled or pan-charred\"} },\n { key: \"ingredient-cotija-cheese\", values: {\"recipe\": \"recipe-elote-street-corn-salad\", \"ingredient_name\": \"cotija cheese\", \"quantity\": 0.5, \"unit\": \"cup\", \"notes\": \"crumbled\"} },\n { key: \"ingredient-lime\", values: {\"recipe\": \"recipe-elote-street-corn-salad\", \"ingredient_name\": \"lime\", \"quantity\": 2, \"unit\": \"whole\", \"notes\": \"juiced\"} },\n { key: \"ingredient-pork-shoulder\", values: {\"recipe\": \"recipe-pozole-rojo\", \"ingredient_name\": \"pork shoulder\", \"quantity\": 3, \"unit\": \"lb\", \"notes\": \"cut into large chunks\"} },\n { key: \"ingredient-hominy\", values: {\"recipe\": \"recipe-pozole-rojo\", \"ingredient_name\": \"hominy\", \"quantity\": 2, \"unit\": \"can\", \"notes\": \"29 oz cans, drained\"} },\n { key: \"ingredient-guajillo-chilies\", values: {\"recipe\": \"recipe-pozole-rojo\", \"ingredient_name\": \"guajillo chilies\", \"quantity\": 6, \"unit\": \"whole\", \"notes\": \"stemmed and seeded\"} },\n { key: \"ingredient-wood-ear-mushrooms-dried\", values: {\"recipe\": \"recipe-hot-and-sour-soup\", \"ingredient_name\": \"wood ear mushrooms, dried\", \"quantity\": 0.25, \"unit\": \"cup\", \"notes\": \"rehydrated and sliced\"} },\n { key: \"ingredient-white-pepper\", values: {\"recipe\": \"recipe-hot-and-sour-soup\", \"ingredient_name\": \"white pepper\", \"quantity\": 1, \"unit\": \"tsp\", \"notes\": \"the 'hot' in hot and sour\"} },\n { key: \"ingredient-evaporated-milk\", values: {\"recipe\": \"recipe-tres-leches-cake\", \"ingredient_name\": \"evaporated milk\", \"quantity\": 1, \"unit\": \"can\", \"notes\": \"12 oz can\"} },\n { key: \"ingredient-sweetened-condensed-milk\", values: {\"recipe\": \"recipe-tres-leches-cake\", \"ingredient_name\": \"sweetened condensed milk\", \"quantity\": 1, \"unit\": \"can\", \"notes\": \"14 oz can\"} },\n { key: \"ingredient-pecorino-romano-grated\", values: {\"recipe\": \"recipe-cacio-e-pepe\", \"ingredient_name\": \"pecorino romano, grated\", \"quantity\": 1.5, \"unit\": \"cup\", \"notes\": \"finely grated, not shredded\"} },\n { key: \"ingredient-chickpeas\", values: {\"recipe\": \"recipe-chana-masala\", \"ingredient_name\": \"chickpeas\", \"quantity\": 2, \"unit\": \"can\", \"notes\": \"15 oz cans, drained\"} },\n { key: \"ingredient-garam-masala\", values: {\"recipe\": \"recipe-chana-masala\", \"ingredient_name\": \"garam masala\", \"quantity\": 1, \"unit\": \"tbsp\", \"notes\": \"\"} },\n { key: \"ingredient-tomatillos-raw\", values: {\"recipe\": \"recipe-salsa-verde-cruda\", \"ingredient_name\": \"tomatillos, raw\", \"quantity\": 1, \"unit\": \"lb\", \"notes\": \"quartered\"} },\n { key: \"ingredient-eggs\", values: {\"recipe\": \"recipe-shakshuka\", \"ingredient_name\": \"eggs\", \"quantity\": 6, \"unit\": \"whole\", \"notes\": \"cracked directly into sauce\"} },\n { key: \"ingredient-crushed-tomatoes\", values: {\"recipe\": \"recipe-shakshuka\", \"ingredient_name\": \"crushed tomatoes\", \"quantity\": 1, \"unit\": \"can\", \"notes\": \"28 oz can\"} },\n ],\n },\n {\n token: \"shopping_lists\",\n name: \"Shopping lists\",\n labelSingular: \"Shopping list\",\n labelPlural: \"Shopping lists\",\n type: \"entity\",\n display: \"board\",\n weight: \"heavy\",\n ordered: false,\n icon: \"shopping-cart\",\n titleField: \"list_name\",\n describes: \"One list per shop per week, built from the recipes planned for that week.\",\n fields: [\n { key: \"list_name\", label: \"List\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"week_of\", label: \"Week of\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"store\", label: \"Shop\", parityType: \"select\", choices: [\"Fresh Market Co-op\", \"Lucky Star Asian Grocery\", \"Mercado Alvarado\", \"Costco\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Planning\", \"Ready to Shop\", \"Shopping\", \"Done\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"list-week-of-jun-1-mexican-night-weekday-soup\", values: {\"list_name\": \"Week of Jun 1 — Mexican night + weekday soup\", \"week_of\": \"2026-06-01\", \"store\": \"Mercado Alvarado\", \"status\": \"Done\"} },\n { key: \"list-week-of-jun-8-chinese-takeout-at-home\", values: {\"list_name\": \"Week of Jun 8 — Chinese takeout-at-home\", \"week_of\": \"2026-06-08\", \"store\": \"Lucky Star Asian Grocery\", \"status\": \"Done\"} },\n { key: \"list-week-of-jun-15-sunday-ragu-easy-weeknights\", values: {\"list_name\": \"Week of Jun 15 — Sunday ragu + easy weeknights\", \"week_of\": \"2026-06-15\", \"store\": \"Fresh Market Co-op\", \"status\": \"Done\"} },\n { key: \"list-week-of-jun-22-birthday-cake-week\", values: {\"list_name\": \"Week of Jun 22 — Birthday cake week\", \"week_of\": \"2026-06-22\", \"store\": \"Costco\", \"status\": \"Ready to Shop\"} },\n { key: \"list-week-of-jun-29-pozole-for-the-in-laws\", values: {\"list_name\": \"Week of Jun 29 — Pozole for the in-laws\", \"week_of\": \"2026-06-29\", \"store\": \"Mercado Alvarado\", \"status\": \"Planning\"} },\n ],\n },\n {\n token: \"shopping_list_items\",\n name: \"List items\",\n labelSingular: \"List item\",\n labelPlural: \"List items\",\n type: \"detail\",\n display: \"list\",\n weight: \"light\",\n ordered: true,\n icon: \"list-checks\",\n titleField: \"ingredient_name\",\n describes: \"What is actually on a list, by aisle, and whether it is already in the trolley.\",\n fields: [\n { key: \"shopping_list\", label: \"Shopping list\", parityType: \"relation\", required: true, relationTarget: \"shopping_lists\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"ingredient_name\", label: \"Ingredient\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"quantity\", label: \"Quantity\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"unit\", label: \"Unit\", parityType: \"select\", choices: [\"cup\", \"tbsp\", \"tsp\", \"oz\", \"lb\", \"clove\", \"whole\", \"can\", \"pinch\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"aisle\", label: \"Aisle\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"checked\", label: \"In the trolley\", parityType: \"select\", choices: [\"Yes\", \"No\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"item-tomatillos\", values: {\"shopping_list\": \"list-week-of-jun-1-mexican-night-weekday-soup\", \"ingredient_name\": \"tomatillos\", \"quantity\": 2, \"unit\": \"lb\", \"aisle\": \"Produce\", \"checked\": \"Yes\"} },\n { key: \"item-corn-tortillas\", values: {\"shopping_list\": \"list-week-of-jun-1-mexican-night-weekday-soup\", \"ingredient_name\": \"corn tortillas\", \"quantity\": 2, \"unit\": \"whole\", \"aisle\": \"Bakery\", \"checked\": \"Yes\"} },\n { key: \"item-queso-fresco\", values: {\"shopping_list\": \"list-week-of-jun-1-mexican-night-weekday-soup\", \"ingredient_name\": \"queso fresco\", \"quantity\": 8, \"unit\": \"oz\", \"aisle\": \"Dairy\", \"checked\": \"Yes\"} },\n { key: \"item-chicken-thighs\", values: {\"shopping_list\": \"list-week-of-jun-8-chinese-takeout-at-home\", \"ingredient_name\": \"chicken thighs\", \"quantity\": 1.5, \"unit\": \"lb\", \"aisle\": \"Meat\", \"checked\": \"Yes\"} },\n { key: \"item-dried-red-chilies\", values: {\"shopping_list\": \"list-week-of-jun-8-chinese-takeout-at-home\", \"ingredient_name\": \"dried red chilies\", \"quantity\": 1, \"unit\": \"oz\", \"aisle\": \"International\", \"checked\": \"Yes\"} },\n { key: \"item-sichuan-peppercorns\", values: {\"shopping_list\": \"list-week-of-jun-8-chinese-takeout-at-home\", \"ingredient_name\": \"Sichuan peppercorns\", \"quantity\": 1, \"unit\": \"oz\", \"aisle\": \"International\", \"checked\": \"No\"} },\n { key: \"item-bone-in-short-ribs\", values: {\"shopping_list\": \"list-week-of-jun-15-sunday-ragu-easy-weeknights\", \"ingredient_name\": \"bone-in short ribs\", \"quantity\": 3, \"unit\": \"lb\", \"aisle\": \"Meat\", \"checked\": \"Yes\"} },\n { key: \"item-san-marzano-tomatoes\", values: {\"shopping_list\": \"list-week-of-jun-15-sunday-ragu-easy-weeknights\", \"ingredient_name\": \"San Marzano tomatoes\", \"quantity\": 2, \"unit\": \"can\", \"aisle\": \"Canned Goods\", \"checked\": \"Yes\"} },\n { key: \"item-pecorino-romano\", values: {\"shopping_list\": \"list-week-of-jun-15-sunday-ragu-easy-weeknights\", \"ingredient_name\": \"pecorino romano\", \"quantity\": 1, \"unit\": \"lb\", \"aisle\": \"Dairy\", \"checked\": \"No\"} },\n { key: \"item-evaporated-milk\", values: {\"shopping_list\": \"list-week-of-jun-22-birthday-cake-week\", \"ingredient_name\": \"evaporated milk\", \"quantity\": 2, \"unit\": \"can\", \"aisle\": \"Baking\", \"checked\": \"No\"} },\n { key: \"item-sweetened-condensed-milk\", values: {\"shopping_list\": \"list-week-of-jun-22-birthday-cake-week\", \"ingredient_name\": \"sweetened condensed milk\", \"quantity\": 2, \"unit\": \"can\", \"aisle\": \"Baking\", \"checked\": \"No\"} },\n { key: \"item-pork-shoulder\", values: {\"shopping_list\": \"list-week-of-jun-29-pozole-for-the-in-laws\", \"ingredient_name\": \"pork shoulder\", \"quantity\": 3, \"unit\": \"lb\", \"aisle\": \"Meat\", \"checked\": \"No\"} },\n { key: \"item-hominy\", values: {\"shopping_list\": \"list-week-of-jun-29-pozole-for-the-in-laws\", \"ingredient_name\": \"hominy\", \"quantity\": 4, \"unit\": \"can\", \"aisle\": \"Canned Goods\", \"checked\": \"No\"} },\n { key: \"item-guajillo-chilies\", values: {\"shopping_list\": \"list-week-of-jun-29-pozole-for-the-in-laws\", \"ingredient_name\": \"guajillo chilies\", \"quantity\": 6, \"unit\": \"oz\", \"aisle\": \"International\", \"checked\": \"No\"} },\n ],\n },\n ],\n\n relationships: [\n {\n describes: \"An ingredient belongs to the recipe it is part of and means nothing without it.\",\n fromTable: \"ingredients\",\n fromField: \"recipe\",\n toTable: \"recipes\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"ingredients\",\n },\n {\n describes: \"A line on the shopping list belongs to the list it is written on.\",\n fromTable: \"shopping_list_items\",\n fromField: \"shopping_list\",\n toTable: \"shopping_lists\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"items\",\n },\n ],\n\n form: {\n token: \"alvarado_chen_add_a_recipe\",\n name: \"Add a recipe to the family collection\",\n describes:\n \"What anyone in the family fills in when a dish is worth keeping — including the grandparents, which is why it asks who brought it in.\",\n audience: \"member\",\n table: \"recipes\",\n fields: [\n { fieldKey: \"title\", label: \"What is it called?\", required: true },\n { fieldKey: \"category\", label: \"Course\", required: true },\n { fieldKey: \"cuisine\", label: \"Cuisine\" },\n { fieldKey: \"prep_minutes\", label: \"Prep time in minutes\", help: \"Chopping and mixing — everything before it goes on the heat.\" },\n { fieldKey: \"cook_minutes\", label: \"Cook time in minutes\" },\n { fieldKey: \"servings\", label: \"How many does it serve?\", required: true },\n { fieldKey: \"source\", label: \"Where did it come from?\", help: \"A book, a website, or a person. We like knowing.\" },\n { fieldKey: \"contributed_by\", label: \"Who brought it in?\", required: true },\n ],\n submitLabel: \"Add it to the collection\",\n confirmation:\n \"Added. Put the ingredients in next, and it will start showing up on the shopping list when you plan it for a week.\",\n },\n\n pipeline: {\n token: \"alvarado_chen_weekly_shop\",\n name: \"The weekly shop\",\n describes:\n \"A list's life is four days long and everybody in the house touches it. The stages exist so nobody buys the same bag of rice twice.\",\n table: \"shopping_lists\",\n stageField: \"status\",\n stages: [\n { key: \"Planning\", label: \"Planning\", describes: \"Meals are still being chosen, so the list is still growing. Nobody shops from it yet.\", typicalDurationDays: 3 },\n { key: \"Ready to Shop\", label: \"Ready to shop\", describes: \"The meals are settled and the list is complete. This is the state it is in when somebody picks up their keys.\", typicalDurationDays: 1 },\n { key: \"Shopping\", label: \"Shopping\", describes: \"Somebody is in the shop ticking things off. Anything added now is a genuine omission, not a change of plan.\", typicalDurationDays: 1 },\n { key: \"Done\", label: \"Done\", describes: \"Everything is home. Unticked items roll onto next week rather than being lost.\" },\n ],\n },\n\n dashboardQuestion: {\n question: \"Which of our recipes can we actually cook on a Tuesday?\",\n whyItMatters:\n \"Weeknight cooking fails on time, not on ideas. Knowing the average cook time by course is what stops a two-hour braise being planned for a school night, and it is the number that decides what goes on the list.\",\n table: \"recipes\",\n aggregate: \"avg\",\n of: \"cook_minutes\",\n groupBy: \"category\",\n answerUnit: \"minutes\",\n },\n\n documentTemplate: {\n token: \"alvarado_chen_recipe_card\",\n name: \"Printable recipe card\",\n describes:\n \"What gets printed and stuck to the fridge door, or sent to someone who asked for the recipe after dinner. It keeps the attribution, because half the collection came from somebody's mother.\",\n table: \"recipes\",\n title: \"{{recipe_title}} — serves {{servings}}\",\n body: [\n \"{{recipe_title}}\",\n \"\",\n \"{{course}} · {{cuisine}} · serves {{servings}}\",\n \"Prep {{prep_time}} minutes, cook {{cook_time}} minutes.\",\n \"\",\n \"From {{source}}, brought into the family by {{contributed_by}}.\",\n \"\",\n \"Ingredients are on the back. If you halve it, do not halve the salt by the same amount — taste it instead.\",\n \"\",\n \"{{household}} · printed {{today}}\",\n ].join(\"\\n\"),\n mergeFields: [\n { key: \"recipe_title\", from: \"title\", describes: \"The dish.\" },\n { key: \"course\", from: \"category\", describes: \"Which part of the meal it is.\" },\n { key: \"cuisine\", from: \"cuisine\", describes: \"Where it comes from.\" },\n { key: \"servings\", from: \"servings\", describes: \"How many it feeds, so it can be scaled.\" },\n { key: \"prep_time\", from: \"prep_minutes\", describes: \"Minutes before it goes on the heat.\" },\n { key: \"cook_time\", from: \"cook_minutes\", describes: \"Minutes on the heat.\" },\n { key: \"source\", from: \"source\", describes: \"The book, site or person it came from.\" },\n { key: \"contributed_by\", from: \"contributed_by\", describes: \"Who brought it into the family.\" },\n { key: \"household\", from: \"business\", describes: \"Whose kitchen this is.\" },\n { key: \"today\", from: \"today\", describes: \"When the card was printed.\" },\n ],\n },\n\n notificationRule: {\n token: \"alvarado_chen_list_is_ready\",\n name: \"The list is ready to shop\",\n describes:\n \"The one message this household would genuinely set up: whoever is going to the shop needs to know the list stopped changing, because the whole failure mode is leaving with a list somebody was still editing.\",\n when: {\n table: \"shopping_lists\",\n event: \"stage_entered\",\n stage: \"Ready to Shop\",\n },\n audience: \"whoever is doing the shop this week\",\n channel: \"in_app\",\n message:\n \"{{list_name}} for the week of {{week_of}} is finished and ready — {{store}}. Tick things off as you go so nobody buys them twice.\",\n },\n\n provenance: {\n kind: \"synthesized\",\n authoredBy: \"data crew (dataset) + lane REAL-DATA (business identity, relationships, form, pipeline, dashboard question, document, notification rule)\",\n authoredOn: \"2026-09-21\",\n noRealPeople: true,\n },\n};\n\nexport default useCase;\n","// src/use-cases/birchwood-avenue-renovation-budget.ts — @ai-matrx/records/use-cases\n//\n// THE USE CASE: Marguerite Oyelowo is renovating a 1920s house one room at a\n// time, and she uses this to hold every contractor quote against the room it is\n// for and every receipt against the budget she set — so that \"are we over?\" has\n// an answer instead of an argument.\n//\n// A homeowner is not a company, and that is the point: the platform is only\n// true to its claim if somebody with no staff and no software budget can model\n// their own project in it.\n//\n// PROVENANCE. Tables, fields and rows come from the data crew's dataset\n// `matrx-frontend/scripts/campaign-tests/use-cases/home-renovation.json`.\n// Fixed on adoption: the project was \"Birchwood Ave Renovation (test fixture)\";\n// relations pointed at a room's NAME and a contractor's COMPANY NAME rather than\n// at the row; and the crew's `insured` boolean became a two-way choice, because\n// THE STORE HAS NO BOOLEAN — its thirteen parity types are closed and none of\n// them is a checkbox, so a yes/no is a choice of two. The business identity,\n// relationships, form, pipeline, dashboard question, document and notification\n// rule were written for this file.\n//\n// Every contractor, licence number and mailbox here is invented.\n\nimport type { UseCase } from \"./types\";\n\nexport const useCase: UseCase = {\n id: \"birchwood-avenue-renovation-budget\",\n useCase:\n \"Marguerite Oyelowo is renovating a 1920s house one room at a time, and she uses this to hold every contractor quote against the room it is for and every receipt against the budget she set, so that whether the job is over budget has an answer instead of an argument.\",\n industry: \"Home renovation\",\n cleanupTag: \"use-case:birchwood-avenue-renovation-budget\",\n\n business: {\n name: \"Birchwood Avenue Renovation\",\n describes: \"A owner-managed whole-house renovation of a 1920s four-bedroom, run room by room over about a year.\",\n address: {\n line1: \"417 Birchwood Avenue\",\n city: \"Providence\",\n region: \"RI\",\n postalCode: \"02906\",\n country: \"US\",\n },\n phone: \"+1 401 555 0188\",\n email: \"marguerite@birchwoodreno.net\",\n timezone: \"America/New_York\",\n },\n\n tables: [\n {\n token: \"rooms\",\n name: \"Rooms\",\n labelSingular: \"Room\",\n labelPlural: \"Rooms\",\n type: \"entity\",\n display: \"board\",\n weight: \"heavy\",\n ordered: true,\n icon: \"door-open\",\n titleField: \"room_name\",\n describes: \"The house, room by room: what is being done to each one, when, and for how much.\",\n fields: [\n { key: \"room_name\", label: \"Room\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"project_scope\", label: \"Scope of work\", parityType: \"long_text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"target_start\", label: \"Target start\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"target_end\", label: \"Target finish\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Planning\", \"Quoting\", \"In Progress\", \"Complete\", \"On Hold\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"budget\", label: \"Budget\", parityType: \"currency\", unit: \"USD\", format: \"currency\", sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n ],\n rows: [\n { key: \"room-kitchen\", values: {\"room_name\": \"Kitchen\", \"project_scope\": \"Full gut renovation: new cabinets, quartz counters, relocate island, new appliances.\", \"target_start\": \"2026-04-01\", \"target_end\": \"2026-06-15\", \"status\": \"Complete\", \"budget\": 48000.0} },\n { key: \"room-primary-bathroom\", values: {\"room_name\": \"Primary Bathroom\", \"project_scope\": \"Replace tub with walk-in shower, new vanity, heated tile floor.\", \"target_start\": \"2026-06-20\", \"target_end\": \"2026-08-01\", \"status\": \"In Progress\", \"budget\": 22500.0} },\n { key: \"room-basement\", values: {\"room_name\": \"Basement\", \"project_scope\": \"Finish unfinished basement into family room and home office, add egress window.\", \"target_start\": \"2026-08-10\", \"target_end\": \"2026-11-15\", \"status\": \"Quoting\", \"budget\": 61000.0} },\n { key: \"room-guest-bathroom\", values: {\"room_name\": \"Guest Bathroom\", \"project_scope\": \"Cosmetic refresh: new vanity, paint, light fixtures.\", \"target_start\": \"2026-09-01\", \"target_end\": \"2026-09-20\", \"status\": \"Planning\", \"budget\": 6500.0} },\n { key: \"room-backyard-deck\", values: {\"room_name\": \"Backyard Deck\", \"project_scope\": \"Tear off old wood deck, build composite deck with pergola.\", \"target_start\": \"2026-05-01\", \"target_end\": \"2026-06-01\", \"status\": \"Complete\", \"budget\": 18000.0} },\n { key: \"room-garage\", values: {\"room_name\": \"Garage\", \"project_scope\": \"Epoxy floor, built-in storage, new insulated door.\", \"target_start\": \"2026-10-01\", \"target_end\": \"2026-10-20\", \"status\": \"On Hold\", \"budget\": 9500.0} },\n ],\n },\n {\n token: \"contractors\",\n name: \"Contractors\",\n labelSingular: \"Contractor\",\n labelPlural: \"Contractors\",\n type: \"entity\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"hard-hat\",\n titleField: \"company_name\",\n describes: \"Everyone quoting or working on the job, with the licence and insurance details that matter if something goes wrong.\",\n fields: [\n { key: \"company_name\", label: \"Company\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"trade\", label: \"Trade\", parityType: \"select\", choices: [\"General Contractor\", \"Plumbing\", \"Electrical\", \"Flooring\", \"Painting\", \"HVAC\", \"Carpentry\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"contact_name\", label: \"Contact\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"phone\", label: \"Phone\", parityType: \"phone\", format: \"phone\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"email\", label: \"Email\", parityType: \"email\", format: \"email\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"license_number\", label: \"Licence number\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"insured\", label: \"Insured\", parityType: \"select\", choices: [\"Yes\", \"No\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"contractor-ferro-sons-construction\", values: {\"company_name\": \"Ferro & Sons Construction\", \"trade\": \"General Contractor\", \"contact_name\": \"Dominic Ferro\", \"phone\": \"555-330-1001\", \"email\": \"dominic@northshoremail.com\", \"license_number\": \"GC-88213-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-redline-plumbing-co\", values: {\"company_name\": \"Redline Plumbing Co.\", \"trade\": \"Plumbing\", \"contact_name\": \"Tanya Iversen\", \"phone\": \"555-330-1002\", \"email\": \"tanya@northshoremail.com\", \"license_number\": \"PL-44029-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-voltway-electric\", values: {\"company_name\": \"Voltway Electric\", \"trade\": \"Electrical\", \"contact_name\": \"Emeka Osayande\", \"phone\": \"555-330-1003\", \"email\": \"emeka@northshoremail.com\", \"license_number\": \"EL-90117-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-hearthstone-flooring\", values: {\"company_name\": \"Hearthstone Flooring\", \"trade\": \"Flooring\", \"contact_name\": \"Bianca Moretti\", \"phone\": \"555-330-1004\", \"email\": \"bianca@northshoremail.com\", \"license_number\": \"FL-22850-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-clearcoat-painting\", values: {\"company_name\": \"Clearcoat Painting\", \"trade\": \"Painting\", \"contact_name\": \"Sam Delacroix\", \"phone\": \"555-330-1005\", \"email\": \"sam@northshoremail.com\", \"license_number\": \"PT-10442-OH\", \"insured\": \"No\"} },\n { key: \"contractor-northgate-hvac\", values: {\"company_name\": \"Northgate HVAC\", \"trade\": \"HVAC\", \"contact_name\": \"Renata Kowalczyk\", \"phone\": \"555-330-1006\", \"email\": \"renata@northshoremail.com\", \"license_number\": \"HV-77302-OH\", \"insured\": \"Yes\"} },\n { key: \"contractor-millbrook-carpentry\", values: {\"company_name\": \"Millbrook Carpentry\", \"trade\": \"Carpentry\", \"contact_name\": \"Julius Wexford\", \"phone\": \"555-330-1007\", \"email\": \"julius@northshoremail.com\", \"license_number\": \"CP-55671-OH\", \"insured\": \"Yes\"} },\n ],\n },\n {\n token: \"quotes\",\n name: \"Quotes\",\n labelSingular: \"Quote\",\n labelPlural: \"Quotes\",\n type: \"ledger\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"file-text\",\n titleField: \"quote_amount\",\n describes: \"What each trade said each room would cost, and whether that price is still good.\",\n fields: [\n { key: \"room\", label: \"Room\", parityType: \"relation\", required: true, relationTarget: \"rooms\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"contractor\", label: \"Contractor\", parityType: \"relation\", required: true, relationTarget: \"contractors\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"quote_amount\", label: \"Quote\", parityType: \"currency\", unit: \"USD\", format: \"currency\", required: true, sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"quote_date\", label: \"Quoted on\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Pending\", \"Accepted\", \"Rejected\", \"Expired\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"valid_until\", label: \"Valid until\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"quote-46500-0\", values: {\"room\": \"room-kitchen\", \"contractor\": \"contractor-ferro-sons-construction\", \"quote_amount\": 46500.0, \"quote_date\": \"2026-02-14\", \"status\": \"Accepted\", \"valid_until\": \"2026-03-14\"} },\n { key: \"quote-3200-0\", values: {\"room\": \"room-kitchen\", \"contractor\": \"contractor-redline-plumbing-co\", \"quote_amount\": 3200.0, \"quote_date\": \"2026-02-20\", \"status\": \"Accepted\", \"valid_until\": \"2026-03-20\"} },\n { key: \"quote-2800-0\", values: {\"room\": \"room-kitchen\", \"contractor\": \"contractor-voltway-electric\", \"quote_amount\": 2800.0, \"quote_date\": \"2026-02-20\", \"status\": \"Accepted\", \"valid_until\": \"2026-03-20\"} },\n { key: \"quote-21000-0\", values: {\"room\": \"room-primary-bathroom\", \"contractor\": \"contractor-ferro-sons-construction\", \"quote_amount\": 21000.0, \"quote_date\": \"2026-05-10\", \"status\": \"Accepted\", \"valid_until\": \"2026-06-10\"} },\n { key: \"quote-4100-0\", values: {\"room\": \"room-primary-bathroom\", \"contractor\": \"contractor-redline-plumbing-co\", \"quote_amount\": 4100.0, \"quote_date\": \"2026-05-11\", \"status\": \"Accepted\", \"valid_until\": \"2026-06-11\"} },\n { key: \"quote-58000-0\", values: {\"room\": \"room-basement\", \"contractor\": \"contractor-ferro-sons-construction\", \"quote_amount\": 58000.0, \"quote_date\": \"2026-07-20\", \"status\": \"Pending\", \"valid_until\": \"2026-08-20\"} },\n { key: \"quote-12500-0\", values: {\"room\": \"room-basement\", \"contractor\": \"contractor-millbrook-carpentry\", \"quote_amount\": 12500.0, \"quote_date\": \"2026-07-22\", \"status\": \"Pending\", \"valid_until\": \"2026-08-22\"} },\n { key: \"quote-6800-0\", values: {\"room\": \"room-basement\", \"contractor\": \"contractor-northgate-hvac\", \"quote_amount\": 6800.0, \"quote_date\": \"2026-07-25\", \"status\": \"Pending\", \"valid_until\": \"2026-08-25\"} },\n { key: \"quote-1800-0\", values: {\"room\": \"room-guest-bathroom\", \"contractor\": \"contractor-hearthstone-flooring\", \"quote_amount\": 1800.0, \"quote_date\": \"2026-07-28\", \"status\": \"Pending\", \"valid_until\": \"2026-08-28\"} },\n { key: \"quote-17200-0\", values: {\"room\": \"room-backyard-deck\", \"contractor\": \"contractor-millbrook-carpentry\", \"quote_amount\": 17200.0, \"quote_date\": \"2026-03-05\", \"status\": \"Accepted\", \"valid_until\": \"2026-04-05\"} },\n { key: \"quote-19800-0\", values: {\"room\": \"room-backyard-deck\", \"contractor\": \"contractor-ferro-sons-construction\", \"quote_amount\": 19800.0, \"quote_date\": \"2026-03-02\", \"status\": \"Rejected\", \"valid_until\": \"2026-04-02\"} },\n { key: \"quote-2100-0\", values: {\"room\": \"room-garage\", \"contractor\": \"contractor-clearcoat-painting\", \"quote_amount\": 2100.0, \"quote_date\": \"2026-01-15\", \"status\": \"Expired\", \"valid_until\": \"2026-02-15\"} },\n ],\n },\n {\n token: \"purchases\",\n name: \"Purchases\",\n labelSingular: \"Purchase\",\n labelPlural: \"Purchases\",\n type: \"ledger\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"receipt\",\n titleField: \"item_description\",\n describes: \"Every pound spent against the project, so the budget is a fact rather than a feeling.\",\n fields: [\n { key: \"room\", label: \"Room\", parityType: \"relation\", required: true, relationTarget: \"rooms\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"item_description\", label: \"What was bought\", parityType: \"text\", required: true, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"vendor\", label: \"Vendor\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"purchase_date\", label: \"Bought on\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"amount\", label: \"Amount\", parityType: \"currency\", unit: \"USD\", format: \"currency\", sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"category\", label: \"Category\", parityType: \"select\", choices: [\"Materials\", \"Fixtures\", \"Labor\", \"Permits\", \"Appliances\", \"Design/Design Fees\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"receipt_number\", label: \"Receipt\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"purchase-custom-shaker-cabinets-painted-alabaster\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Custom shaker cabinets, painted 'Alabaster'\", \"vendor\": \"Millbrook Cabinetry Supply\", \"purchase_date\": \"2026-04-05\", \"amount\": 14200.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10021\"} },\n { key: \"purchase-quartz-countertop-calacatta-gold-42-sq-ft\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Quartz countertop, 'Calacatta Gold' 42 sq ft\", \"vendor\": \"Stone Depot\", \"purchase_date\": \"2026-04-18\", \"amount\": 5900.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10022\"} },\n { key: \"purchase-range-refrigerator-dishwasher-package\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Range, refrigerator, dishwasher package\", \"vendor\": \"Coldstream Appliance Center\", \"purchase_date\": \"2026-04-22\", \"amount\": 8700.0, \"category\": \"Appliances\", \"receipt_number\": \"RCT-10023\"} },\n { key: \"purchase-building-permit-kitchen-remodel\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Building permit — kitchen remodel\", \"vendor\": \"City of Fairmont Permits Office\", \"purchase_date\": \"2026-03-28\", \"amount\": 450.0, \"category\": \"Permits\", \"receipt_number\": \"RCT-10024\"} },\n { key: \"purchase-ferro-sons-final-labor-invoice\", values: {\"room\": \"room-kitchen\", \"item_description\": \"Ferro & Sons — final labor invoice\", \"vendor\": \"Ferro & Sons Construction\", \"purchase_date\": \"2026-06-15\", \"amount\": 15800.0, \"category\": \"Labor\", \"receipt_number\": \"RCT-10025\"} },\n { key: \"purchase-walk-in-shower-kit-with-frameless-glass\", values: {\"room\": \"room-primary-bathroom\", \"item_description\": \"Walk-in shower kit with frameless glass\", \"vendor\": \"Stone Depot\", \"purchase_date\": \"2026-06-25\", \"amount\": 4300.0, \"category\": \"Fixtures\", \"receipt_number\": \"RCT-10026\"} },\n { key: \"purchase-heated-floor-mat-system-45-sq-ft\", values: {\"room\": \"room-primary-bathroom\", \"item_description\": \"Heated floor mat system, 45 sq ft\", \"vendor\": \"WarmFloor Direct\", \"purchase_date\": \"2026-06-28\", \"amount\": 1650.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10027\"} },\n { key: \"purchase-floating-double-vanity-60-inch\", values: {\"room\": \"room-primary-bathroom\", \"item_description\": \"Floating double vanity, 60 inch\", \"vendor\": \"Millbrook Cabinetry Supply\", \"purchase_date\": \"2026-07-02\", \"amount\": 2200.0, \"category\": \"Fixtures\", \"receipt_number\": \"RCT-10028\"} },\n { key: \"purchase-composite-decking-600-sq-ft-weathered-teak\", values: {\"room\": \"room-backyard-deck\", \"item_description\": \"Composite decking, 600 sq ft, 'Weathered Teak'\", \"vendor\": \"Deckmaster Supply\", \"purchase_date\": \"2026-05-05\", \"amount\": 8900.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10029\"} },\n { key: \"purchase-cedar-pergola-kit-12x14\", values: {\"room\": \"room-backyard-deck\", \"item_description\": \"Cedar pergola kit, 12x14\", \"vendor\": \"Deckmaster Supply\", \"purchase_date\": \"2026-05-08\", \"amount\": 3200.0, \"category\": \"Materials\", \"receipt_number\": \"RCT-10030\"} },\n { key: \"purchase-millbrook-carpentry-labor-and-install\", values: {\"room\": \"room-backyard-deck\", \"item_description\": \"Millbrook Carpentry — labor and install\", \"vendor\": \"Millbrook Carpentry\", \"purchase_date\": \"2026-06-01\", \"amount\": 4900.0, \"category\": \"Labor\", \"receipt_number\": \"RCT-10031\"} },\n { key: \"purchase-design-consultation-fixture-layout\", values: {\"room\": \"room-guest-bathroom\", \"item_description\": \"Design consultation — fixture layout\", \"vendor\": \"Bianca Moretti Interiors\", \"purchase_date\": \"2026-07-30\", \"amount\": 350.0, \"category\": \"Design/Design Fees\", \"receipt_number\": \"RCT-10032\"} },\n ],\n },\n ],\n\n relationships: [\n {\n describes: \"A quote is for exactly one room, and it is meaningless once that room is out of scope.\",\n fromTable: \"quotes\",\n fromField: \"room\",\n toTable: \"rooms\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"quotes\",\n },\n {\n describes: \"A quote comes from one contractor, who goes on existing after the quote is rejected.\",\n fromTable: \"quotes\",\n fromField: \"contractor\",\n toTable: \"contractors\",\n flavor: \"referenced\",\n cardinality: \"one\",\n onDelete: \"restrict\",\n inverseKey: \"quotes_given\",\n },\n {\n describes: \"A purchase is charged against the room it was bought for, which is how the budget stays honest.\",\n fromTable: \"purchases\",\n fromField: \"room\",\n toTable: \"rooms\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"purchases\",\n },\n ],\n\n form: {\n token: \"birchwood_contractor_details\",\n name: \"Contractor details and insurance\",\n describes:\n \"What a trade fills in before they are allowed to quote. It asks for the licence number and the insurance because those are the two things nobody can produce after something goes wrong.\",\n audience: \"public\",\n table: \"contractors\",\n fields: [\n { fieldKey: \"company_name\", label: \"Company name\", required: true },\n { fieldKey: \"trade\", label: \"Trade\", required: true },\n { fieldKey: \"contact_name\", label: \"Who should I ask for?\", required: true },\n { fieldKey: \"phone\", label: \"Best number\", required: true },\n { fieldKey: \"email\", label: \"Email\", required: true },\n { fieldKey: \"license_number\", label: \"Licence number\", required: true, help: \"I check this with the state board before accepting a quote.\" },\n { fieldKey: \"insured\", label: \"Do you carry liability insurance?\", required: true, help: \"I will ask for the certificate before work starts.\" },\n ],\n submitLabel: \"Send my details\",\n confirmation:\n \"Thank you. I will check the licence and come back to you about which rooms I would like quoted, usually within a few days.\",\n },\n\n pipeline: {\n token: \"birchwood_room_progress\",\n name: \"Room by room\",\n describes:\n \"Where each room stands. The board exists because a whole-house renovation is really five small projects at different stages, and the only way to stay sane is to look at them side by side.\",\n table: \"rooms\",\n stageField: \"status\",\n stages: [\n { key: \"Planning\", label: \"Planning\", describes: \"Scope is still being decided. Nothing has been priced, so the budget figure is a guess.\", typicalDurationDays: 21 },\n { key: \"Quoting\", label: \"Quoting\", describes: \"Trades are pricing it. Leaves when a quote is accepted — or when every quote comes back over budget and the scope goes back to Planning.\", typicalDurationDays: 21 },\n { key: \"In Progress\", label: \"In progress\", describes: \"Work has started and receipts are landing against this room. This is where the budget is actually won or lost.\", typicalDurationDays: 45 },\n { key: \"On Hold\", label: \"On hold\", describes: \"Stopped for money, a permit or a lead time. Named honestly so it is not mistaken for progress.\", typicalDurationDays: 30 },\n { key: \"Complete\", label: \"Complete\", describes: \"Finished, paid and signed off. The room's spend is final and can be compared against what was budgeted.\" },\n ],\n },\n\n dashboardQuestion: {\n question: \"What have I actually spent on each room so far?\",\n whyItMatters:\n \"The budget was set room by room, so the only useful comparison is room by room. This is the number that decides whether the next room starts on schedule or waits, and it is the one thing a spreadsheet stops being trusted for once there are more than about thirty receipts.\",\n table: \"purchases\",\n aggregate: \"sum\",\n of: \"amount\",\n groupBy: \"room\",\n answerUnit: \"USD\",\n },\n\n documentTemplate: {\n token: \"birchwood_quote_acceptance\",\n name: \"Quote acceptance\",\n describes:\n \"Sent to a contractor when their price is accepted. It restates the number, the room and the date the quote was given, because a renovation dispute is almost always about which version of the price was agreed.\",\n table: \"quotes\",\n title: \"Accepting your quote of {{amount}}\",\n body: [\n \"Thank you for quoting.\",\n \"\",\n \"I am accepting your price of {{amount}}, quoted on {{quoted_on}} and valid until {{valid_until}}, for the work we discussed.\",\n \"\",\n \"Before anything starts I will need a copy of your certificate of insurance. Materials I have bought myself are already on site; anything else is yours to supply and appears on your invoice, not on my receipts.\",\n \"\",\n \"If the scope changes once the wall is open — and on a house this age it usually does — please price the change and send it to me before carrying it out. I would rather approve a second number than argue about a bigger one later.\",\n \"\",\n \"{{project}}\",\n \"{{project_phone}}\",\n \"{{today}}\",\n ].join(\"\\n\"),\n mergeFields: [\n { key: \"amount\", from: \"quote_amount\", describes: \"The accepted price, restated so there is one version of it.\" },\n { key: \"quoted_on\", from: \"quote_date\", describes: \"Which quote this is, when a trade has given several.\" },\n { key: \"valid_until\", from: \"valid_until\", describes: \"The date the price was good until.\" },\n { key: \"project\", from: \"business\", describes: \"The project name.\" },\n { key: \"project_phone\", from: \"business\", describes: \"The number to call back on.\" },\n { key: \"today\", from: \"today\", describes: \"The date of acceptance.\" },\n ],\n },\n\n notificationRule: {\n token: \"birchwood_quote_expiring\",\n name: \"A quote is about to expire\",\n describes:\n \"Quotes are good for thirty days and a renovation moves slower than that, so the default outcome is re-pricing everything at a worse number. A week's warning is what prevents it, and it is the first thing any homeowner would automate.\",\n when: {\n table: \"quotes\",\n event: \"due\",\n field: \"valid_until\",\n daysBefore: 7,\n },\n audience: \"the homeowner\",\n channel: \"email\",\n message:\n \"The quote of {{quote_amount}} expires on {{valid_until}} — about a week from now. Accept it, or ask for it to be held, before it has to be re-priced.\",\n },\n\n provenance: {\n kind: \"synthesized\",\n authoredBy: \"data crew (dataset) + lane REAL-DATA (business identity, relationships, form, pipeline, dashboard question, document, notification rule)\",\n authoredOn: \"2026-09-21\",\n noRealPeople: true,\n },\n};\n\nexport default useCase;\n","// src/use-cases/harbor-dental-new-patient-intake.ts — @ai-matrx/records/use-cases\n//\n// THE USE CASE: Renata Okonkwo runs the front desk at Harbor Dental Group, a\n// six-chair family dental practice, and she uses this to take a new patient\n// from the first phone call through forms, insurance verification and a booked\n// first visit without anything falling between the cracks.\n//\n// Every person, address, phone number, mailbox and member id below is invented.\n// Nothing here is copied from a real patient, a real practice or a real inbox.\n\nimport type { UseCase } from \"./types\";\n\nexport const useCase: UseCase = {\n id: \"harbor-dental-new-patient-intake\",\n useCase:\n \"Renata Okonkwo runs the front desk at Harbor Dental Group, a six-chair family dental practice, and she uses this to take a new patient from the first phone call through forms, insurance verification and a booked first visit without anything falling between the cracks.\",\n industry: \"Dentistry\",\n cleanupTag: \"use-case:harbor-dental-new-patient-intake\",\n\n business: {\n name: \"Harbor Dental Group\",\n legalName: \"Harbor Dental Group, PLLC\",\n describes: \"A six-chair family dental practice doing general dentistry, hygiene and same-day crowns.\",\n address: {\n line1: \"1840 Waterfront Parkway\",\n line2: \"Suite 210\",\n city: \"Bellingham\",\n region: \"WA\",\n postalCode: \"98225\",\n country: \"US\",\n },\n phone: \"+1 360 555 0142\",\n website: \"https://harbordentalgroup.com\",\n email: \"frontdesk@harbordentalgroup.com\",\n timezone: \"America/Los_Angeles\",\n },\n\n tables: [\n {\n token: \"patient\",\n name: \"Patients\",\n labelSingular: \"Patient\",\n labelPlural: \"Patients\",\n type: \"entity\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"user-round\",\n titleField: \"full_name\",\n describes: \"Everyone the practice treats, from the first enquiry through to an active chart.\",\n fields: [\n {\n key: \"full_name\",\n label: \"Patient name\",\n parityType: \"text\",\n required: true,\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"chart_number\",\n label: \"Chart number\",\n parityType: \"text\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n help: \"Assigned when the chart is opened. Printed on every claim and referral.\",\n },\n {\n key: \"date_of_birth\",\n label: \"Date of birth\",\n parityType: \"datetime\",\n format: \"date\",\n sensitivity: \"confidential\",\n contextPolicy: \"exclude\",\n help: \"Carriers verify eligibility on name plus date of birth, so it has to be exact.\",\n },\n {\n key: \"phone\",\n label: \"Mobile phone\",\n parityType: \"phone\",\n format: \"phone\",\n sensitivity: \"confidential\",\n contextPolicy: \"exclude\",\n },\n {\n key: \"email\",\n label: \"Email\",\n parityType: \"email\",\n format: \"email\",\n sensitivity: \"confidential\",\n contextPolicy: \"exclude\",\n },\n {\n key: \"street\",\n label: \"Street address\",\n parityType: \"text\",\n sensitivity: \"confidential\",\n contextPolicy: \"exclude\",\n },\n {\n key: \"city\",\n label: \"City\",\n parityType: \"text\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"region\",\n label: \"State\",\n parityType: \"text\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"postal_code\",\n label: \"ZIP\",\n parityType: \"text\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"intake_stage\",\n label: \"Intake stage\",\n parityType: \"select\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\n \"Enquiry\",\n \"Forms sent\",\n \"Forms received\",\n \"Insurance verified\",\n \"First visit booked\",\n \"Active patient\",\n ],\n help: \"Where this person is between the first call and a chart the hygienist can work from.\",\n },\n {\n key: \"insurance_carrier\",\n label: \"Insurance carrier\",\n parityType: \"select\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n choices: [\"Delta Dental\", \"Cigna Dental\", \"MetLife\", \"Guardian\", \"Aetna\", \"Self-pay\"],\n },\n {\n key: \"member_id\",\n label: \"Member ID\",\n parityType: \"text\",\n sensitivity: \"restricted\",\n contextPolicy: \"exclude\",\n help: \"Never leaves the practice. Needed to verify eligibility before the first visit.\",\n },\n {\n key: \"primary_dentist\",\n label: \"Primary dentist\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Dr. Alina Reyes\", \"Dr. Marcus Webb\"],\n },\n {\n key: \"allergies\",\n label: \"Known allergies\",\n parityType: \"multi_select\",\n multi: true,\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n choices: [\n \"Penicillin\",\n \"Latex\",\n \"Codeine\",\n \"Sulfa drugs\",\n \"Local anaesthetic\",\n \"None reported\",\n ],\n help: \"Read out loud at chairside before any injection.\",\n },\n {\n key: \"balance_due\",\n label: \"Balance due\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"referred_by\",\n label: \"How they found us\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\n \"Existing patient referral\",\n \"Insurance directory\",\n \"Web search\",\n \"Walk-in\",\n \"Employer benefits fair\",\n ],\n },\n {\n key: \"front_desk_notes\",\n label: \"Front desk notes\",\n parityType: \"long_text\",\n sensitivity: \"confidential\",\n contextPolicy: \"on_request\",\n },\n ],\n rows: [\n {\n key: \"patient-rivera-marisol\",\n values: {\n full_name: \"Marisol Rivera\",\n chart_number: \"HD-10428\",\n date_of_birth: \"1988-03-17\",\n phone: \"+1 360 555 0184\",\n email: \"m.rivera@northshoremail.com\",\n street: \"4417 Chuckanut Ridge Road\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98229\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Delta Dental\",\n member_id: \"DD-884201773\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"Penicillin\"],\n balance_due: 0,\n referred_by: \"Existing patient referral\",\n front_desk_notes: \"Prefers early morning. Two children also seen here.\",\n },\n },\n {\n key: \"patient-oyelaran-tunde\",\n values: {\n full_name: \"Tunde Oyelaran\",\n chart_number: \"HD-10431\",\n date_of_birth: \"1975-11-02\",\n phone: \"+1 360 555 0219\",\n email: \"toyelaran@baysidedesignco.com\",\n street: \"902 Eldridge Avenue\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Cigna Dental\",\n member_id: \"CG-4471209\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"None reported\"],\n balance_due: 142.5,\n referred_by: \"Insurance directory\",\n front_desk_notes: \"Travels for work; wants visits batched into one afternoon.\",\n },\n },\n {\n key: \"patient-halvorsen-britt\",\n values: {\n full_name: \"Britt Halvorsen\",\n chart_number: \"HD-10455\",\n date_of_birth: \"1992-07-26\",\n phone: \"+1 360 555 0177\",\n email: \"britt.halvorsen@cascadiaoutfitters.com\",\n street: \"215 Harris Avenue\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"First visit booked\",\n insurance_carrier: \"MetLife\",\n member_id: \"ML-63902118\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"Latex\"],\n balance_due: 0,\n referred_by: \"Web search\",\n front_desk_notes: \"Latex allergy flagged to the back office; nitrile only.\",\n },\n },\n {\n key: \"patient-nakamura-kenji\",\n values: {\n full_name: \"Kenji Nakamura\",\n chart_number: \"HD-10460\",\n date_of_birth: \"1964-01-09\",\n phone: \"+1 360 555 0263\",\n email: \"k.nakamura@harborviewcpa.com\",\n street: \"1130 Yew Street\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98229\",\n intake_stage: \"Insurance verified\",\n insurance_carrier: \"Guardian\",\n member_id: \"GD-20117744\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"Codeine\"],\n balance_due: 0,\n referred_by: \"Employer benefits fair\",\n front_desk_notes: \"Eligibility confirmed through December. Waiting on his schedule to book.\",\n },\n },\n {\n key: \"patient-abadi-leila\",\n values: {\n full_name: \"Leila Abadi\",\n chart_number: \"HD-10462\",\n date_of_birth: \"1997-05-30\",\n phone: \"+1 360 555 0308\",\n email: \"leila.abadi@westwindstudio.com\",\n street: \"77 Fairhaven Parkway\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Forms received\",\n insurance_carrier: \"Aetna\",\n member_id: \"AE-55823094\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Existing patient referral\",\n front_desk_notes: \"Forms in. Needs eligibility checked before we offer a slot.\",\n },\n },\n {\n key: \"patient-delacroix-yvon\",\n values: {\n full_name: \"Yvon Delacroix\",\n chart_number: \"HD-10466\",\n date_of_birth: \"1981-09-14\",\n phone: \"+1 360 555 0341\",\n email: \"yvon.delacroix@pugetsoundfreight.com\",\n street: \"3320 Northwest Avenue\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Forms sent\",\n insurance_carrier: \"Delta Dental\",\n member_id: \"DD-884977120\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Insurance directory\",\n front_desk_notes: \"Packet emailed Tuesday. Follow up if nothing back by Friday.\",\n },\n },\n {\n key: \"patient-strand-ingrid\",\n values: {\n full_name: \"Ingrid Strand\",\n chart_number: \"HD-10470\",\n date_of_birth: \"1955-12-04\",\n phone: \"+1 360 555 0392\",\n email: \"ingrid.strand@northshoremail.com\",\n street: \"618 Alabama Street\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Self-pay\",\n member_id: \"\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"Sulfa drugs\", \"Local anaesthetic\"],\n balance_due: 880,\n referred_by: \"Walk-in\",\n front_desk_notes: \"On a payment plan for the crown. Anaesthetic sensitivity — Dr. Reyes is aware.\",\n },\n },\n {\n key: \"patient-mbeki-sipho\",\n values: {\n full_name: \"Sipho Mbeki\",\n chart_number: \"HD-10473\",\n date_of_birth: \"2001-02-21\",\n phone: \"+1 360 555 0415\",\n email: \"sipho.mbeki@wwu-alumni.com\",\n street: \"1502 Indian Street\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Enquiry\",\n insurance_carrier: \"Self-pay\",\n member_id: \"\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Web search\",\n front_desk_notes: \"Called about a chipped incisor. Quoted the emergency exam fee.\",\n },\n },\n {\n key: \"patient-kowalczyk-agata\",\n values: {\n full_name: \"Agata Kowalczyk\",\n chart_number: \"HD-10477\",\n date_of_birth: \"1986-06-11\",\n phone: \"+1 360 555 0448\",\n email: \"a.kowalczyk@evergreenlabsupply.com\",\n street: \"2245 Cornwall Avenue\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Cigna Dental\",\n member_id: \"CG-4488317\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"None reported\"],\n balance_due: 64,\n referred_by: \"Existing patient referral\",\n front_desk_notes: \"Night guard impressions taken; lab case out.\",\n },\n },\n {\n key: \"patient-ferreira-joao\",\n values: {\n full_name: \"João Ferreira\",\n chart_number: \"HD-10481\",\n date_of_birth: \"1970-08-19\",\n phone: \"+1 360 555 0472\",\n email: \"joao.ferreira@harborlinemarine.com\",\n street: \"840 Marine Drive\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Insurance verified\",\n insurance_carrier: \"MetLife\",\n member_id: \"ML-63988402\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"Penicillin\", \"Latex\"],\n balance_due: 0,\n referred_by: \"Employer benefits fair\",\n front_desk_notes: \"Two allergies on file. Wants the first available Thursday.\",\n },\n },\n {\n key: \"patient-whitehorse-dara\",\n values: {\n full_name: \"Dara Whitehorse\",\n chart_number: \"HD-10484\",\n date_of_birth: \"1994-04-07\",\n phone: \"+1 360 555 0501\",\n email: \"dara.whitehorse@salishseaarts.com\",\n street: \"506 Girard Street\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"First visit booked\",\n insurance_carrier: \"Guardian\",\n member_id: \"GD-20166018\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Web search\",\n front_desk_notes: \"Booked for the new patient exam and a cleaning back to back.\",\n },\n },\n {\n key: \"patient-oconnell-brigid\",\n values: {\n full_name: \"Brigid O'Connell\",\n chart_number: \"HD-10489\",\n date_of_birth: \"1959-10-23\",\n phone: \"+1 360 555 0533\",\n email: \"brigid.oconnell@northshoremail.com\",\n street: \"3901 Sunset Drive\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98229\",\n intake_stage: \"Active patient\",\n insurance_carrier: \"Delta Dental\",\n member_id: \"DD-885013366\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"Codeine\"],\n balance_due: 310.75,\n referred_by: \"Existing patient referral\",\n front_desk_notes: \"Crown seat next month. Balance is the patient portion from the last claim.\",\n },\n },\n {\n key: \"patient-tran-hieu\",\n values: {\n full_name: \"Hieu Tran\",\n chart_number: \"HD-10492\",\n date_of_birth: \"1990-12-15\",\n phone: \"+1 360 555 0566\",\n email: \"hieu.tran@baysidedesignco.com\",\n street: \"1215 Lakeway Drive\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98229\",\n intake_stage: \"Forms received\",\n insurance_carrier: \"Aetna\",\n member_id: \"AE-55901287\",\n primary_dentist: \"Dr. Alina Reyes\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Insurance directory\",\n front_desk_notes: \"Medical history mentions a heart murmur — confirm premedication with Dr. Reyes.\",\n },\n },\n {\n key: \"patient-bergstrom-annika\",\n values: {\n full_name: \"Annika Bergström\",\n chart_number: \"HD-10496\",\n date_of_birth: \"1983-02-08\",\n phone: \"+1 360 555 0590\",\n email: \"annika.bergstrom@cascadiaoutfitters.com\",\n street: \"705 Samish Way\",\n city: \"Bellingham\",\n region: \"WA\",\n postal_code: \"98225\",\n intake_stage: \"Enquiry\",\n insurance_carrier: \"Cigna Dental\",\n member_id: \"CG-4491550\",\n primary_dentist: \"Dr. Marcus Webb\",\n allergies: [\"None reported\"],\n balance_due: 0,\n referred_by: \"Walk-in\",\n front_desk_notes: \"Came in over lunch asking about whitening. Packet not sent yet.\",\n },\n },\n ],\n },\n\n {\n token: \"visit\",\n name: \"Visits\",\n labelSingular: \"Visit\",\n labelPlural: \"Visits\",\n type: \"entity\",\n display: \"calendar\",\n weight: \"heavy\",\n ordered: true,\n icon: \"calendar-clock\",\n titleField: \"summary\",\n describes: \"Every booked chair appointment, what it is for, who is in the chair and who is treating.\",\n fields: [\n {\n key: \"summary\",\n label: \"Appointment\",\n parityType: \"text\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"patient\",\n label: \"Patient\",\n parityType: \"relation\",\n required: true,\n relationTarget: \"patient\",\n relationMax: 1,\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"appointment_at\",\n label: \"Date and time\",\n parityType: \"datetime\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"duration_minutes\",\n label: \"Chair time\",\n parityType: \"integer\",\n unit: \"min\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"procedure\",\n label: \"Procedure\",\n parityType: \"select\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n choices: [\n \"New patient exam\",\n \"Adult prophylaxis\",\n \"Child prophylaxis\",\n \"Composite filling\",\n \"Crown preparation\",\n \"Crown seat\",\n \"Root canal\",\n \"Extraction\",\n \"Emergency exam\",\n ],\n },\n {\n key: \"provider\",\n label: \"Provider\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\n \"Dr. Alina Reyes\",\n \"Dr. Marcus Webb\",\n \"Priya Chandra, RDH\",\n \"Tomas Lindgren, RDH\",\n ],\n },\n {\n key: \"operatory\",\n label: \"Operatory\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Op A\", \"Op B\", \"Op C\", \"Op D\", \"Op E\", \"Op F\"],\n },\n {\n key: \"visit_status\",\n label: \"Status\",\n parityType: \"select\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Scheduled\", \"Confirmed\", \"Checked in\", \"Completed\", \"No-show\", \"Cancelled\"],\n },\n {\n key: \"fee\",\n label: \"Fee\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n ],\n rows: [\n {\n key: \"visit-rivera-prophy-sep\",\n values: {\n summary: \"Adult cleaning — M. Rivera\",\n patient: \"patient-rivera-marisol\",\n appointment_at: \"2026-09-08T08:00:00-07:00\",\n duration_minutes: 50,\n procedure: \"Adult prophylaxis\",\n provider: \"Priya Chandra, RDH\",\n operatory: \"Op B\",\n visit_status: \"Completed\",\n fee: 138,\n },\n },\n {\n key: \"visit-oyelaran-crown-prep\",\n values: {\n summary: \"Crown prep, lower right — T. Oyelaran\",\n patient: \"patient-oyelaran-tunde\",\n appointment_at: \"2026-09-10T13:30:00-07:00\",\n duration_minutes: 90,\n procedure: \"Crown preparation\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op D\",\n visit_status: \"Completed\",\n fee: 1240,\n },\n },\n {\n key: \"visit-strand-crown-seat\",\n values: {\n summary: \"Crown seat — I. Strand\",\n patient: \"patient-strand-ingrid\",\n appointment_at: \"2026-09-14T10:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"Crown seat\",\n provider: \"Dr. Alina Reyes\",\n operatory: \"Op A\",\n visit_status: \"Completed\",\n fee: 880,\n },\n },\n {\n key: \"visit-kowalczyk-prophy\",\n values: {\n summary: \"Adult cleaning — A. Kowalczyk\",\n patient: \"patient-kowalczyk-agata\",\n appointment_at: \"2026-09-15T09:00:00-07:00\",\n duration_minutes: 50,\n procedure: \"Adult prophylaxis\",\n provider: \"Tomas Lindgren, RDH\",\n operatory: \"Op C\",\n visit_status: \"Completed\",\n fee: 138,\n },\n },\n {\n key: \"visit-oconnell-filling\",\n values: {\n summary: \"Composite filling, upper left — B. O'Connell\",\n patient: \"patient-oconnell-brigid\",\n appointment_at: \"2026-09-16T14:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"Composite filling\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op D\",\n visit_status: \"Completed\",\n fee: 412,\n },\n },\n {\n key: \"visit-mbeki-emergency\",\n values: {\n summary: \"Emergency exam, chipped incisor — S. Mbeki\",\n patient: \"patient-mbeki-sipho\",\n appointment_at: \"2026-09-17T16:30:00-07:00\",\n duration_minutes: 30,\n procedure: \"Emergency exam\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op E\",\n visit_status: \"No-show\",\n fee: 95,\n },\n },\n {\n key: \"visit-rivera-filling\",\n values: {\n summary: \"Composite filling, lower left — M. Rivera\",\n patient: \"patient-rivera-marisol\",\n appointment_at: \"2026-09-18T08:30:00-07:00\",\n duration_minutes: 60,\n procedure: \"Composite filling\",\n provider: \"Dr. Alina Reyes\",\n operatory: \"Op A\",\n visit_status: \"Completed\",\n fee: 386,\n },\n },\n {\n key: \"visit-halvorsen-new-patient\",\n values: {\n summary: \"New patient exam — B. Halvorsen\",\n patient: \"patient-halvorsen-britt\",\n appointment_at: \"2026-09-23T09:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"New patient exam\",\n provider: \"Dr. Alina Reyes\",\n operatory: \"Op A\",\n visit_status: \"Confirmed\",\n fee: 215,\n },\n },\n {\n key: \"visit-halvorsen-prophy\",\n values: {\n summary: \"Adult cleaning — B. Halvorsen\",\n patient: \"patient-halvorsen-britt\",\n appointment_at: \"2026-09-23T10:00:00-07:00\",\n duration_minutes: 50,\n procedure: \"Adult prophylaxis\",\n provider: \"Priya Chandra, RDH\",\n operatory: \"Op B\",\n visit_status: \"Confirmed\",\n fee: 138,\n },\n },\n {\n key: \"visit-whitehorse-new-patient\",\n values: {\n summary: \"New patient exam — D. Whitehorse\",\n patient: \"patient-whitehorse-dara\",\n appointment_at: \"2026-09-24T11:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"New patient exam\",\n provider: \"Dr. Alina Reyes\",\n operatory: \"Op A\",\n visit_status: \"Scheduled\",\n fee: 215,\n },\n },\n {\n key: \"visit-whitehorse-prophy\",\n values: {\n summary: \"Adult cleaning — D. Whitehorse\",\n patient: \"patient-whitehorse-dara\",\n appointment_at: \"2026-09-24T12:00:00-07:00\",\n duration_minutes: 50,\n procedure: \"Adult prophylaxis\",\n provider: \"Tomas Lindgren, RDH\",\n operatory: \"Op C\",\n visit_status: \"Scheduled\",\n fee: 138,\n },\n },\n {\n key: \"visit-oconnell-crown-seat\",\n values: {\n summary: \"Crown seat — B. O'Connell\",\n patient: \"patient-oconnell-brigid\",\n appointment_at: \"2026-10-06T14:30:00-07:00\",\n duration_minutes: 60,\n procedure: \"Crown seat\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op D\",\n visit_status: \"Scheduled\",\n fee: 1180,\n },\n },\n {\n key: \"visit-ferreira-new-patient\",\n values: {\n summary: \"New patient exam — J. Ferreira\",\n patient: \"patient-ferreira-joao\",\n appointment_at: \"2026-10-08T15:00:00-07:00\",\n duration_minutes: 60,\n procedure: \"New patient exam\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op E\",\n visit_status: \"Scheduled\",\n fee: 215,\n },\n },\n {\n key: \"visit-nakamura-new-patient\",\n values: {\n summary: \"New patient exam — K. Nakamura\",\n patient: \"patient-nakamura-kenji\",\n appointment_at: \"2026-10-09T08:30:00-07:00\",\n duration_minutes: 60,\n procedure: \"New patient exam\",\n provider: \"Dr. Marcus Webb\",\n operatory: \"Op D\",\n visit_status: \"Scheduled\",\n fee: 215,\n },\n },\n {\n key: \"visit-tran-child-prophy\",\n values: {\n summary: \"Child cleaning — H. Tran, daughter\",\n patient: \"patient-tran-hieu\",\n appointment_at: \"2026-10-13T16:00:00-07:00\",\n duration_minutes: 40,\n procedure: \"Child prophylaxis\",\n provider: \"Priya Chandra, RDH\",\n operatory: \"Op B\",\n visit_status: \"Scheduled\",\n fee: 112,\n },\n },\n {\n key: \"visit-kowalczyk-cancelled\",\n values: {\n summary: \"Night guard delivery — A. Kowalczyk\",\n patient: \"patient-kowalczyk-agata\",\n appointment_at: \"2026-09-19T11:30:00-07:00\",\n duration_minutes: 30,\n procedure: \"Adult prophylaxis\",\n provider: \"Tomas Lindgren, RDH\",\n operatory: \"Op C\",\n visit_status: \"Cancelled\",\n fee: 0,\n },\n },\n ],\n },\n\n {\n token: \"insurance_claim\",\n name: \"Insurance claims\",\n labelSingular: \"Claim\",\n labelPlural: \"Claims\",\n type: \"ledger\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"file-text\",\n titleField: \"claim_number\",\n describes: \"What was billed to a carrier for a completed visit, and what came back.\",\n fields: [\n {\n key: \"claim_number\",\n label: \"Claim number\",\n parityType: \"text\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"visit\",\n label: \"Visit\",\n parityType: \"relation\",\n required: true,\n relationTarget: \"visit\",\n relationMax: 1,\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"carrier\",\n label: \"Carrier\",\n parityType: \"select\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Delta Dental\", \"Cigna Dental\", \"MetLife\", \"Guardian\", \"Aetna\"],\n },\n {\n key: \"submitted_on\",\n label: \"Submitted\",\n parityType: \"datetime\",\n format: \"date\",\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n },\n {\n key: \"billed_amount\",\n label: \"Billed\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"allowed_amount\",\n label: \"Carrier allowed\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"patient_portion\",\n label: \"Patient portion\",\n parityType: \"currency\",\n unit: \"USD\",\n format: \"currency\",\n sensitivity: \"confidential\",\n contextPolicy: \"summarize\",\n },\n {\n key: \"claim_status\",\n label: \"Claim status\",\n parityType: \"select\",\n required: true,\n sensitivity: \"internal\",\n contextPolicy: \"include\",\n choices: [\"Prepared\", \"Submitted\", \"In review\", \"Paid\", \"Denied\", \"Appealed\"],\n },\n ],\n rows: [\n {\n key: \"claim-rivera-prophy\",\n values: {\n claim_number: \"HD-CLM-24118\",\n visit: \"visit-rivera-prophy-sep\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-09\",\n billed_amount: 138,\n allowed_amount: 138,\n patient_portion: 0,\n claim_status: \"Paid\",\n },\n },\n {\n key: \"claim-oyelaran-crown-prep\",\n values: {\n claim_number: \"HD-CLM-24123\",\n visit: \"visit-oyelaran-crown-prep\",\n carrier: \"Cigna Dental\",\n submitted_on: \"2026-09-11\",\n billed_amount: 1240,\n allowed_amount: 1097.5,\n patient_portion: 142.5,\n claim_status: \"Paid\",\n },\n },\n {\n key: \"claim-kowalczyk-prophy\",\n values: {\n claim_number: \"HD-CLM-24131\",\n visit: \"visit-kowalczyk-prophy\",\n carrier: \"Cigna Dental\",\n submitted_on: \"2026-09-16\",\n billed_amount: 138,\n allowed_amount: 74,\n patient_portion: 64,\n claim_status: \"Paid\",\n },\n },\n {\n key: \"claim-oconnell-filling\",\n values: {\n claim_number: \"HD-CLM-24136\",\n visit: \"visit-oconnell-filling\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-17\",\n billed_amount: 412,\n allowed_amount: 310.75,\n patient_portion: 310.75,\n claim_status: \"In review\",\n },\n },\n {\n key: \"claim-rivera-filling\",\n values: {\n claim_number: \"HD-CLM-24140\",\n visit: \"visit-rivera-filling\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-19\",\n billed_amount: 386,\n allowed_amount: 386,\n patient_portion: 0,\n claim_status: \"Submitted\",\n },\n },\n {\n key: \"claim-strand-crown-seat\",\n values: {\n claim_number: \"HD-CLM-24127\",\n visit: \"visit-strand-crown-seat\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-15\",\n billed_amount: 880,\n allowed_amount: 0,\n patient_portion: 880,\n claim_status: \"Denied\",\n },\n },\n {\n key: \"claim-oyelaran-resubmit\",\n values: {\n claim_number: \"HD-CLM-24144\",\n visit: \"visit-oyelaran-crown-prep\",\n carrier: \"Cigna Dental\",\n submitted_on: \"2026-09-20\",\n billed_amount: 142.5,\n allowed_amount: 0,\n patient_portion: 142.5,\n claim_status: \"Appealed\",\n },\n },\n {\n key: \"claim-oconnell-crown-predetermination\",\n values: {\n claim_number: \"HD-CLM-24149\",\n visit: \"visit-oconnell-crown-seat\",\n carrier: \"Delta Dental\",\n submitted_on: \"2026-09-21\",\n billed_amount: 1180,\n allowed_amount: 0,\n patient_portion: 0,\n claim_status: \"Prepared\",\n },\n },\n ],\n },\n ],\n\n relationships: [\n {\n describes: \"A visit belongs to the patient who sits in the chair, and it dies with their chart.\",\n fromTable: \"visit\",\n fromField: \"patient\",\n toTable: \"patient\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"visits\",\n },\n {\n describes: \"A claim bills exactly one completed visit, and it cannot outlive the visit it bills.\",\n fromTable: \"insurance_claim\",\n fromField: \"visit\",\n toTable: \"visit\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"claims\",\n },\n ],\n\n form: {\n token: \"harbor_dental_new_patient_intake\",\n name: \"Harbor Dental new-patient intake\",\n describes:\n \"The packet the front desk emails after the first call. The patient fills it in before they arrive so the hygienist is not taking a medical history in the chair.\",\n audience: \"public\",\n table: \"patient\",\n fields: [\n { fieldKey: \"full_name\", label: \"Your full legal name\", required: true, help: \"As it appears on your insurance card.\" },\n { fieldKey: \"date_of_birth\", label: \"Date of birth\", required: true },\n { fieldKey: \"phone\", label: \"Mobile number\", required: true, help: \"We text appointment reminders to this number.\" },\n { fieldKey: \"email\", label: \"Email\", required: true },\n { fieldKey: \"street\", label: \"Street address\", required: true },\n { fieldKey: \"city\", label: \"City\", required: true },\n { fieldKey: \"region\", label: \"State\", required: true },\n { fieldKey: \"postal_code\", label: \"ZIP\", required: true },\n { fieldKey: \"insurance_carrier\", label: \"Dental insurance carrier\", help: \"Choose Self-pay if you do not have dental coverage.\" },\n { fieldKey: \"member_id\", label: \"Member ID\", help: \"On the front of your card. We use it to check your benefits before your visit.\" },\n { fieldKey: \"allergies\", label: \"Any known allergies\", help: \"Select all that apply. We read this out before any injection.\" },\n { fieldKey: \"referred_by\", label: \"How did you hear about us?\" },\n ],\n submitLabel: \"Send my intake form\",\n confirmation:\n \"Thank you — we have your forms. We will check your benefits with your carrier and call you within two business days to find a first appointment that works.\",\n },\n\n pipeline: {\n token: \"harbor_dental_intake_pipeline\",\n name: \"New-patient intake\",\n describes:\n \"The six steps between a stranger calling and a chart the hygienist can work from. Renata works this board every morning.\",\n table: \"patient\",\n stageField: \"intake_stage\",\n stages: [\n {\n key: \"Enquiry\",\n label: \"Enquiry\",\n describes: \"They called or walked in. Nothing has been sent yet. Moves on when the intake packet goes out.\",\n typicalDurationDays: 1,\n },\n {\n key: \"Forms sent\",\n label: \"Forms sent\",\n describes: \"The packet is with them. Chase at three days; most people fill it in the evening they get it.\",\n typicalDurationDays: 3,\n },\n {\n key: \"Forms received\",\n label: \"Forms received\",\n describes: \"Medical history is in. Anything flagged goes to the treating dentist before we book.\",\n typicalDurationDays: 1,\n },\n {\n key: \"Insurance verified\",\n label: \"Insurance verified\",\n describes: \"Eligibility and remaining annual maximum confirmed with the carrier, so nobody is surprised by a bill.\",\n typicalDurationDays: 2,\n },\n {\n key: \"First visit booked\",\n label: \"First visit booked\",\n describes: \"Exam and cleaning are on the schedule and confirmed. Moves on the day they are seen.\",\n typicalDurationDays: 14,\n },\n {\n key: \"Active patient\",\n label: \"Active patient\",\n describes: \"Seen at least once and on recall. They leave this stage only if they transfer out.\",\n },\n ],\n },\n\n dashboardQuestion: {\n question: \"How many people have sent their forms back but still are not on the schedule?\",\n whyItMatters:\n \"Everyone sitting between 'Forms received' and 'First visit booked' is someone who already chose us and is quietly going cold. If the number climbs above about six, Renata blocks an hour to call them before the week gets away.\",\n table: \"patient\",\n aggregate: \"count\",\n groupBy: \"intake_stage\",\n filter: \"intake_stage is 'Forms received' or 'Insurance verified'\",\n answerUnit: \"patients\",\n },\n\n documentTemplate: {\n token: \"harbor_dental_welcome_letter\",\n name: \"New patient welcome letter\",\n describes:\n \"Goes out the moment a first visit is booked. It confirms who they will see, what to bring and what the first appointment actually involves, which is the single biggest reason people no-show.\",\n table: \"patient\",\n title: \"Welcome to {{practice_name}}, {{patient_name}}\",\n body: [\n \"Dear {{patient_name}},\",\n \"\",\n \"Thank you for choosing {{practice_name}}. Your chart is open under number {{chart_number}} and you will be seeing {{dentist}}.\",\n \"\",\n \"Your first appointment is a full examination with digital x-rays, followed by a cleaning with one of our hygienists. Together they take about two hours, so please allow for that.\",\n \"\",\n \"Please bring a photo ID and your {{carrier}} card. We have already checked your benefits, so we can tell you what is covered before any work is agreed — we do not start treatment you have not said yes to.\",\n \"\",\n \"If anything about your health has changed since you filled in your forms, tell the front desk when you arrive. It matters more than people expect.\",\n \"\",\n \"We look forward to meeting you.\",\n \"\",\n \"{{practice_name}}\",\n \"{{practice_phone}}\",\n \"{{today}}\",\n ].join(\"\\n\"),\n mergeFields: [\n { key: \"patient_name\", from: \"full_name\", describes: \"How we address them in the letter.\" },\n { key: \"chart_number\", from: \"chart_number\", describes: \"So the letter and the chart agree if they call about it.\" },\n { key: \"dentist\", from: \"primary_dentist\", describes: \"The dentist they are assigned to.\" },\n { key: \"carrier\", from: \"insurance_carrier\", describes: \"Tells them which card to bring.\" },\n { key: \"practice_name\", from: \"business\", describes: \"The practice name.\" },\n { key: \"practice_phone\", from: \"business\", describes: \"The front desk number.\" },\n { key: \"today\", from: \"today\", describes: \"The date the letter went out.\" },\n ],\n },\n\n notificationRule: {\n token: \"harbor_dental_visit_reminder\",\n name: \"Day-before appointment reminder\",\n describes:\n \"A no-show costs the practice the whole chair hour and the hygienist's time. A text the day before is the cheapest thing that prevents it, and it is the first automation any practice turns on.\",\n when: {\n table: \"visit\",\n event: \"due\",\n field: \"appointment_at\",\n daysBefore: 1,\n },\n audience: \"the patient in the chair\",\n channel: \"sms\",\n message:\n \"Harbor Dental: a reminder that you are booked with {{provider}} tomorrow at {{appointment_time}}. Reply C to confirm or call 360 555 0142 if you need to move it.\",\n },\n\n provenance: {\n kind: \"synthesized\",\n authoredBy: \"lane REAL-DATA (records use-case library)\",\n authoredOn: \"2026-09-21\",\n noRealPeople: true,\n },\n};\n\nexport default useCase;\n","// src/use-cases/ridgeline-physical-therapy-plan-of-care.ts — @ai-matrx/records/use-cases\n//\n// THE USE CASE: Sasha Lindqvist runs Ridgeline Physical Therapy single-handed,\n// and she uses this to carry a patient from a physician's referral through a\n// course of visits to a treatment goal that is either met or honestly written\n// off — without losing track of who is overdue for a re-evaluation.\n//\n// PROVENANCE. The tables, fields and rows come from the data crew's dataset\n// `matrx-frontend/scripts/campaign-tests/use-cases/physical-therapy-clinic.json`.\n// Three things were fixed on adoption, each a law the crew's file broke:\n// · the organization was \"Ridgeline Physical Therapy (test fixture)\" — a test\n// organization carries the use case's own name and is found for cleanup by\n// its tag, never by a junk suffix;\n// · patient mailboxes were on `@example-mail.test`, which reads as fake on the\n// screen the owner is looking at;\n// · relations pointed at a patient's NAME, which is not a handle — they now\n// point at the row.\n// Everything the crew's format has no room for — the business identity, the\n// relationship declarations, the form, the pipeline, the dashboard question, the\n// document and the notification rule — was written for this file.\n//\n// Every person, mailbox and phone number below is invented and belongs to nobody.\n\nimport type { UseCase } from \"./types\";\n\nexport const useCase: UseCase = {\n id: \"ridgeline-physical-therapy-plan-of-care\",\n useCase:\n \"Sasha Lindqvist runs Ridgeline Physical Therapy single-handed, and she uses this to carry a patient from a physician's referral through a course of visits to a treatment goal that is either met or honestly written off, without losing track of who is overdue for a re-evaluation.\",\n industry: \"Physical therapy\",\n cleanupTag: \"use-case:ridgeline-physical-therapy-plan-of-care\",\n\n business: {\n name: \"Ridgeline Physical Therapy\",\n legalName: \"Ridgeline Physical Therapy, LLC\",\n describes: \"A solo outpatient physical therapy practice doing orthopaedic and post-surgical rehabilitation.\",\n address: {\n line1: \"3114 Foothill Boulevard\",\n line2: \"Suite B\",\n city: \"Boise\",\n region: \"ID\",\n postalCode: \"83702\",\n country: \"US\",\n },\n phone: \"+1 208 555 0173\",\n website: \"https://ridgelinept.com\",\n email: \"frontdesk@ridgelinept.com\",\n timezone: \"America/Boise\",\n },\n\n tables: [\n {\n token: \"patients\",\n name: \"Patients\",\n labelSingular: \"Patient\",\n labelPlural: \"Patients\",\n type: \"entity\",\n display: \"list\",\n weight: \"heavy\",\n ordered: false,\n icon: \"user-round\",\n titleField: \"full_name\",\n describes: \"Everyone on the caseload, from referral through discharge.\",\n fields: [\n { key: \"full_name\", label: \"Patient name\", parityType: \"text\", required: true, sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"date_of_birth\", label: \"Date of birth\", parityType: \"datetime\", format: \"date\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"phone\", label: \"Phone\", parityType: \"phone\", format: \"phone\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"email\", label: \"Email\", parityType: \"email\", format: \"email\", sensitivity: \"confidential\", contextPolicy: \"exclude\" },\n { key: \"referring_physician\", label: \"Referring physician\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"primary_diagnosis\", label: \"Primary diagnosis\", parityType: \"text\", sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"insurance_provider\", label: \"Insurance\", parityType: \"select\", choices: [\"Aetna\", \"Blue Cross Blue Shield\", \"UnitedHealthcare\", \"Cigna\", \"Medicare\", \"Self-pay\"], sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"intake_date\", label: \"Intake date\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Active\", \"Discharged\", \"On Hold\", \"Referred Out\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"patient-nora-castellan\", values: {\"full_name\": \"Nora Castellan\", \"date_of_birth\": \"1978-03-14\", \"phone\": \"555-201-3341\", \"email\": \"nora.castellan@northshoremail.com\", \"referring_physician\": \"Dr. Amina Reyes\", \"primary_diagnosis\": \"Rotator cuff tendinopathy, right shoulder\", \"insurance_provider\": \"Aetna\", \"intake_date\": \"2026-06-02\", \"status\": \"Active\"} },\n { key: \"patient-devon-ashworth\", values: {\"full_name\": \"Devon Ashworth\", \"date_of_birth\": \"1991-11-02\", \"phone\": \"555-201-3342\", \"email\": \"devon.ashworth@northshoremail.com\", \"referring_physician\": \"Dr. Marcus Feld\", \"primary_diagnosis\": \"ACL reconstruction, post-op (6 weeks)\", \"insurance_provider\": \"Blue Cross Blue Shield\", \"intake_date\": \"2026-06-05\", \"status\": \"Active\"} },\n { key: \"patient-priya-vantana\", values: {\"full_name\": \"Priya Vantana\", \"date_of_birth\": \"1965-07-22\", \"phone\": \"555-201-3343\", \"email\": \"priya.vantana@northshoremail.com\", \"referring_physician\": \"Dr. Amina Reyes\", \"primary_diagnosis\": \"Chronic low back pain, L4-L5 disc bulge\", \"insurance_provider\": \"Medicare\", \"intake_date\": \"2026-05-19\", \"status\": \"Active\"} },\n { key: \"patient-isaiah-broome\", values: {\"full_name\": \"Isaiah Broome\", \"date_of_birth\": \"2002-01-30\", \"phone\": \"555-201-3344\", \"email\": \"isaiah.broome@northshoremail.com\", \"referring_physician\": \"Dr. Lena Ostrowski\", \"primary_diagnosis\": \"Grade II ankle sprain, left\", \"insurance_provider\": \"UnitedHealthcare\", \"intake_date\": \"2026-07-01\", \"status\": \"Discharged\"} },\n { key: \"patient-marguerite-solano\", values: {\"full_name\": \"Marguerite Solano\", \"date_of_birth\": \"1954-09-08\", \"phone\": \"555-201-3345\", \"email\": \"marguerite.solano@northshoremail.com\", \"referring_physician\": \"Dr. Marcus Feld\", \"primary_diagnosis\": \"Total knee replacement, post-op (3 weeks)\", \"insurance_provider\": \"Medicare\", \"intake_date\": \"2026-06-20\", \"status\": \"Active\"} },\n { key: \"patient-tobias-reinholt\", values: {\"full_name\": \"Tobias Reinholt\", \"date_of_birth\": \"1988-04-17\", \"phone\": \"555-201-3346\", \"email\": \"tobias.reinholt@northshoremail.com\", \"referring_physician\": \"Dr. Lena Ostrowski\", \"primary_diagnosis\": \"Cervical radiculopathy, C6\", \"insurance_provider\": \"Cigna\", \"intake_date\": \"2026-07-10\", \"status\": \"Active\"} },\n { key: \"patient-odalys-fenmore\", values: {\"full_name\": \"Odalys Fenmore\", \"date_of_birth\": \"1997-12-25\", \"phone\": \"555-201-3347\", \"email\": \"odalys.fenmore@northshoremail.com\", \"referring_physician\": \"Dr. Amina Reyes\", \"primary_diagnosis\": \"Patellofemoral pain syndrome, bilateral\", \"insurance_provider\": \"Self-pay\", \"intake_date\": \"2026-07-15\", \"status\": \"On Hold\"} },\n { key: \"patient-wendell-okafor\", values: {\"full_name\": \"Wendell Okafor\", \"date_of_birth\": \"1972-02-11\", \"phone\": \"555-201-3348\", \"email\": \"wendell.okafor@northshoremail.com\", \"referring_physician\": \"Dr. Marcus Feld\", \"primary_diagnosis\": \"Plantar fasciitis, right heel\", \"insurance_provider\": \"Aetna\", \"intake_date\": \"2026-06-28\", \"status\": \"Active\"} },\n { key: \"patient-camille-duprez\", values: {\"full_name\": \"Camille Duprez\", \"date_of_birth\": \"1983-06-04\", \"phone\": \"555-201-3349\", \"email\": \"camille.duprez@northshoremail.com\", \"referring_physician\": \"Dr. Lena Ostrowski\", \"primary_diagnosis\": \"Lumbar spinal stenosis\", \"insurance_provider\": \"Blue Cross Blue Shield\", \"intake_date\": \"2026-05-30\", \"status\": \"Active\"} },\n { key: \"patient-griffin-alderete\", values: {\"full_name\": \"Griffin Alderete\", \"date_of_birth\": \"1995-10-19\", \"phone\": \"555-201-3350\", \"email\": \"griffin.alderete@northshoremail.com\", \"referring_physician\": \"Dr. Amina Reyes\", \"primary_diagnosis\": \"Achilles tendinopathy, left\", \"insurance_provider\": \"UnitedHealthcare\", \"intake_date\": \"2026-07-18\", \"status\": \"Referred Out\"} },\n ],\n },\n {\n token: \"appointments\",\n name: \"Visits\",\n labelSingular: \"Visit\",\n labelPlural: \"Visits\",\n type: \"entity\",\n display: \"calendar\",\n weight: \"heavy\",\n ordered: true,\n icon: \"calendar-clock\",\n titleField: \"visit_type\",\n describes: \"Every booked appointment, what kind of visit it is and whether it happened.\",\n fields: [\n { key: \"patient\", label: \"Patient\", parityType: \"relation\", required: true, relationTarget: \"patients\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"appointment_date\", label: \"Date\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"appointment_time\", label: \"Time\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"visit_type\", label: \"Visit type\", parityType: \"select\", required: true, choices: [\"Initial Evaluation\", \"Follow-up\", \"Re-evaluation\", \"Discharge Visit\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"therapist_name\", label: \"Therapist\", parityType: \"text\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"duration_minutes\", label: \"Length\", parityType: \"integer\", unit: \"min\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Scheduled\", \"Completed\", \"No-show\", \"Cancelled\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"notes\", label: \"Visit notes\", parityType: \"long_text\", sensitivity: \"confidential\", contextPolicy: \"on_request\" },\n ],\n rows: [\n { key: \"appointment-01\", values: {\"patient\": \"patient-nora-castellan\", \"appointment_date\": \"2026-06-02\", \"appointment_time\": \"09:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"AROM shoulder flexion limited to 110 deg, pain 6/10 with overhead reach.\"} },\n { key: \"appointment-02\", values: {\"patient\": \"patient-nora-castellan\", \"appointment_date\": \"2026-06-09\", \"appointment_time\": \"09:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Completed\", \"notes\": \"Progressing isometrics, pain down to 4/10.\"} },\n { key: \"appointment-03\", values: {\"patient\": \"patient-nora-castellan\", \"appointment_date\": \"2026-06-16\", \"appointment_time\": \"09:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Scheduled\", \"notes\": \"\"} },\n { key: \"appointment-04\", values: {\"patient\": \"patient-devon-ashworth\", \"appointment_date\": \"2026-06-05\", \"appointment_time\": \"13:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Quad lag present, effusion mild. Cleared for closed-chain work.\"} },\n { key: \"appointment-05\", values: {\"patient\": \"patient-devon-ashworth\", \"appointment_date\": \"2026-06-12\", \"appointment_time\": \"13:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Completed\", \"notes\": \"Quad lag resolving, full passive extension achieved.\"} },\n { key: \"appointment-06\", values: {\"patient\": \"patient-devon-ashworth\", \"appointment_date\": \"2026-06-19\", \"appointment_time\": \"13:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"No-show\", \"notes\": \"Patient did not call.\"} },\n { key: \"appointment-07\", values: {\"patient\": \"patient-priya-vantana\", \"appointment_date\": \"2026-05-19\", \"appointment_time\": \"10:30\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Positive slump test on right, centralization with extension.\"} },\n { key: \"appointment-08\", values: {\"patient\": \"patient-priya-vantana\", \"appointment_date\": \"2026-06-02\", \"appointment_time\": \"10:30\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 45, \"status\": \"Completed\", \"notes\": \"Symptoms centralizing, tolerating prone press-ups.\"} },\n { key: \"appointment-09\", values: {\"patient\": \"patient-isaiah-broome\", \"appointment_date\": \"2026-07-01\", \"appointment_time\": \"15:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Grade II sprain, moderate swelling, weight-bearing as tolerated.\"} },\n { key: \"appointment-10\", values: {\"patient\": \"patient-isaiah-broome\", \"appointment_date\": \"2026-07-22\", \"appointment_time\": \"15:00\", \"visit_type\": \"Discharge Visit\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 30, \"status\": \"Completed\", \"notes\": \"Full ROM restored, single-leg balance 30s, discharged to home program.\"} },\n { key: \"appointment-11\", values: {\"patient\": \"patient-marguerite-solano\", \"appointment_date\": \"2026-06-20\", \"appointment_time\": \"11:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Knee flexion 85 deg, using front-wheel walker.\"} },\n { key: \"appointment-12\", values: {\"patient\": \"patient-marguerite-solano\", \"appointment_date\": \"2026-06-27\", \"appointment_time\": \"11:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Completed\", \"notes\": \"Flexion improved to 100 deg.\"} },\n { key: \"appointment-13\", values: {\"patient\": \"patient-marguerite-solano\", \"appointment_date\": \"2026-07-04\", \"appointment_time\": \"11:00\", \"visit_type\": \"Follow-up\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 45, \"status\": \"Scheduled\", \"notes\": \"\"} },\n { key: \"appointment-14\", values: {\"patient\": \"patient-tobias-reinholt\", \"appointment_date\": \"2026-07-10\", \"appointment_time\": \"08:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Positive Spurling's test right, numbness in C6 dermatome.\"} },\n { key: \"appointment-15\", values: {\"patient\": \"patient-wendell-okafor\", \"appointment_date\": \"2026-06-28\", \"appointment_time\": \"16:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Sasha Lindqvist, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Point tenderness at medial calcaneal tubercle, worse first step in AM.\"} },\n { key: \"appointment-16\", values: {\"patient\": \"patient-camille-duprez\", \"appointment_date\": \"2026-05-30\", \"appointment_time\": \"09:30\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Symptoms improve with flexion-biased posture, neurogenic claudication at 2 blocks.\"} },\n { key: \"appointment-17\", values: {\"patient\": \"patient-griffin-alderete\", \"appointment_date\": \"2026-07-18\", \"appointment_time\": \"14:00\", \"visit_type\": \"Initial Evaluation\", \"therapist_name\": \"Dr. Marcus Reid, DPT\", \"duration_minutes\": 60, \"status\": \"Completed\", \"notes\": \"Referred to orthopedic surgeon for imaging before continuing PT.\"} },\n ],\n },\n {\n token: \"treatment_plans\",\n name: \"Treatment plans\",\n labelSingular: \"Treatment plan\",\n labelPlural: \"Treatment plans\",\n type: \"entity\",\n display: \"board\",\n weight: \"heavy\",\n ordered: false,\n icon: \"clipboard-list\",\n titleField: \"diagnosis\",\n describes: \"The goal each patient is working toward, and whether they have met it.\",\n fields: [\n { key: \"patient\", label: \"Patient\", parityType: \"relation\", required: true, relationTarget: \"patients\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"diagnosis\", label: \"Diagnosis\", parityType: \"text\", required: true, sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"goal\", label: \"Goal\", parityType: \"long_text\", sensitivity: \"confidential\", contextPolicy: \"summarize\" },\n { key: \"start_date\", label: \"Start date\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"target_date\", label: \"Target date\", parityType: \"datetime\", format: \"date\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"status\", label: \"Status\", parityType: \"select\", choices: [\"Active\", \"Met\", \"Modified\", \"Discontinued\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n ],\n rows: [\n { key: \"plan-nora-castellan\", values: {\"patient\": \"patient-nora-castellan\", \"diagnosis\": \"Rotator cuff tendinopathy, right shoulder\", \"goal\": \"Restore pain-free overhead reach to 160 deg flexion within 6 weeks.\", \"start_date\": \"2026-06-02\", \"target_date\": \"2026-07-14\", \"status\": \"Active\"} },\n { key: \"plan-devon-ashworth\", values: {\"patient\": \"patient-devon-ashworth\", \"diagnosis\": \"ACL reconstruction, post-op\", \"goal\": \"Return to single-leg squat and stair descent without compensation by week 12.\", \"start_date\": \"2026-06-05\", \"target_date\": \"2026-08-28\", \"status\": \"Active\"} },\n { key: \"plan-priya-vantana\", values: {\"patient\": \"patient-priya-vantana\", \"diagnosis\": \"Chronic low back pain, L4-L5 disc bulge\", \"goal\": \"Centralize symptoms and tolerate 30-minute walk without radiating pain.\", \"start_date\": \"2026-05-19\", \"target_date\": \"2026-07-19\", \"status\": \"Active\"} },\n { key: \"plan-isaiah-broome\", values: {\"patient\": \"patient-isaiah-broome\", \"diagnosis\": \"Grade II ankle sprain, left\", \"goal\": \"Full weight-bearing, return to recreational basketball.\", \"start_date\": \"2026-07-01\", \"target_date\": \"2026-07-22\", \"status\": \"Met\"} },\n { key: \"plan-marguerite-solano\", values: {\"patient\": \"patient-marguerite-solano\", \"diagnosis\": \"Total knee replacement, post-op\", \"goal\": \"Achieve 110 deg flexion and walk without assistive device by week 8.\", \"start_date\": \"2026-06-20\", \"target_date\": \"2026-08-15\", \"status\": \"Active\"} },\n { key: \"plan-tobias-reinholt\", values: {\"patient\": \"patient-tobias-reinholt\", \"diagnosis\": \"Cervical radiculopathy, C6\", \"goal\": \"Resolve numbness, restore full cervical rotation.\", \"start_date\": \"2026-07-10\", \"target_date\": \"2026-08-21\", \"status\": \"Active\"} },\n { key: \"plan-wendell-okafor\", values: {\"patient\": \"patient-wendell-okafor\", \"diagnosis\": \"Plantar fasciitis, right heel\", \"goal\": \"Pain-free first step in the morning, return to daily 3-mile walk.\", \"start_date\": \"2026-06-28\", \"target_date\": \"2026-08-09\", \"status\": \"Active\"} },\n { key: \"plan-camille-duprez\", values: {\"patient\": \"patient-camille-duprez\", \"diagnosis\": \"Lumbar spinal stenosis\", \"goal\": \"Increase walking tolerance to 6 blocks without claudication.\", \"start_date\": \"2026-05-30\", \"target_date\": \"2026-08-01\", \"status\": \"Active\"} },\n ],\n },\n {\n token: \"exercises_prescribed\",\n name: \"Home exercises\",\n labelSingular: \"Home exercise\",\n labelPlural: \"Home exercises\",\n type: \"detail\",\n display: \"list\",\n weight: \"light\",\n ordered: true,\n icon: \"dumbbell\",\n titleField: \"exercise_name\",\n describes: \"What each patient was told to do between visits, and how it progresses.\",\n fields: [\n { key: \"treatment_plan\", label: \"Treatment plan\", parityType: \"relation\", required: true, relationTarget: \"treatment_plans\", relationMax: 1, sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"exercise_name\", label: \"Exercise\", parityType: \"select\", required: true, choices: [\"Pendulum Exercise\", \"Scapular Retraction\", \"Straight Leg Raise\", \"Quadriceps Sets\", \"Heel Slides\", \"Terminal Knee Extension\", \"Prone Press-ups (McKenzie)\", \"Cat-Camel Stretch\", \"Clamshells\", \"Bridging\", \"Standing Hip Abduction\", \"Wall Sits\", \"Calf Raises\", \"Hamstring Curls\", \"Ankle Pumps\", \"Chin Tucks\"], sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"sets\", label: \"Sets\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"reps\", label: \"Reps\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"frequency_per_week\", label: \"Times per week\", parityType: \"integer\", sensitivity: \"internal\", contextPolicy: \"include\" },\n { key: \"progression_notes\", label: \"Progression notes\", parityType: \"long_text\", sensitivity: \"confidential\", contextPolicy: \"on_request\" },\n ],\n rows: [\n { key: \"exercises_prescribed-01\", values: {\"treatment_plan\": \"plan-nora-castellan\", \"exercise_name\": \"Pendulum Exercise\", \"sets\": 3, \"reps\": 15, \"frequency_per_week\": 7, \"progression_notes\": \"Started week 1, pain-free arc, add light weight at week 3.\"} },\n { key: \"exercises_prescribed-02\", values: {\"treatment_plan\": \"plan-nora-castellan\", \"exercise_name\": \"Scapular Retraction\", \"sets\": 3, \"reps\": 12, \"frequency_per_week\": 5, \"progression_notes\": \"Using resistance band, increase band tension at week 4.\"} },\n { key: \"exercises_prescribed-03\", values: {\"treatment_plan\": \"plan-devon-ashworth\", \"exercise_name\": \"Quadriceps Sets\", \"sets\": 3, \"reps\": 10, \"frequency_per_week\": 7, \"progression_notes\": \"Hold 5 seconds, progressing to straight leg raise next visit.\"} },\n { key: \"exercises_prescribed-04\", values: {\"treatment_plan\": \"plan-devon-ashworth\", \"exercise_name\": \"Straight Leg Raise\", \"sets\": 3, \"reps\": 10, \"frequency_per_week\": 6, \"progression_notes\": \"No lag observed, add ankle weight 2lb.\"} },\n { key: \"exercises_prescribed-05\", values: {\"treatment_plan\": \"plan-devon-ashworth\", \"exercise_name\": \"Terminal Knee Extension\", \"sets\": 3, \"reps\": 12, \"frequency_per_week\": 5, \"progression_notes\": \"Using resistance band anchored behind knee.\"} },\n { key: \"exercises_prescribed-06\", values: {\"treatment_plan\": \"plan-priya-vantana\", \"exercise_name\": \"Prone Press-ups (McKenzie)\", \"sets\": 2, \"reps\": 10, \"frequency_per_week\": 6, \"progression_notes\": \"Symptoms centralizing, hold end range 2 seconds.\"} },\n { key: \"exercises_prescribed-07\", values: {\"treatment_plan\": \"plan-priya-vantana\", \"exercise_name\": \"Cat-Camel Stretch\", \"sets\": 2, \"reps\": 10, \"frequency_per_week\": 7, \"progression_notes\": \"Morning stiffness reduced.\"} },\n { key: \"exercises_prescribed-08\", values: {\"treatment_plan\": \"plan-isaiah-broome\", \"exercise_name\": \"Ankle Pumps\", \"sets\": 3, \"reps\": 20, \"frequency_per_week\": 7, \"progression_notes\": \"Early edema control, progressed to standing balance week 2.\"} },\n { key: \"exercises_prescribed-09\", values: {\"treatment_plan\": \"plan-marguerite-solano\", \"exercise_name\": \"Heel Slides\", \"sets\": 3, \"reps\": 10, \"frequency_per_week\": 7, \"progression_notes\": \"Flexion improving 5 deg/week.\"} },\n { key: \"exercises_prescribed-10\", values: {\"treatment_plan\": \"plan-marguerite-solano\", \"exercise_name\": \"Quadriceps Sets\", \"sets\": 4, \"reps\": 10, \"frequency_per_week\": 7, \"progression_notes\": \"Hold 5 seconds, no extensor lag.\"} },\n { key: \"exercises_prescribed-11\", values: {\"treatment_plan\": \"plan-tobias-reinholt\", \"exercise_name\": \"Chin Tucks\", \"sets\": 3, \"reps\": 10, \"frequency_per_week\": 6, \"progression_notes\": \"Reduces referred symptoms into arm during session.\"} },\n { key: \"exercises_prescribed-12\", values: {\"treatment_plan\": \"plan-wendell-okafor\", \"exercise_name\": \"Calf Raises\", \"sets\": 3, \"reps\": 15, \"frequency_per_week\": 5, \"progression_notes\": \"Eccentric emphasis, 3-second lower.\"} },\n { key: \"exercises_prescribed-13\", values: {\"treatment_plan\": \"plan-camille-duprez\", \"exercise_name\": \"Bridging\", \"sets\": 3, \"reps\": 12, \"frequency_per_week\": 5, \"progression_notes\": \"Flexion-biased, tolerating well.\"} },\n { key: \"exercises_prescribed-14\", values: {\"treatment_plan\": \"plan-camille-duprez\", \"exercise_name\": \"Standing Hip Abduction\", \"sets\": 3, \"reps\": 12, \"frequency_per_week\": 5, \"progression_notes\": \"Added ankle weight this week.\"} },\n ],\n },\n ],\n\n relationships: [\n {\n describes: \"A visit belongs to the patient who attends it, and it dies with their chart.\",\n fromTable: \"appointments\",\n fromField: \"patient\",\n toTable: \"patients\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"visits\",\n },\n {\n describes: \"A treatment plan belongs to the patient it sets a goal for.\",\n fromTable: \"treatment_plans\",\n fromField: \"patient\",\n toTable: \"patients\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"treatment_plans\",\n },\n {\n describes: \"A home exercise is prescribed under exactly one treatment plan and ends with it.\",\n fromTable: \"exercises_prescribed\",\n fromField: \"treatment_plan\",\n toTable: \"treatment_plans\",\n flavor: \"owned\",\n cardinality: \"one\",\n onDelete: \"cascade\",\n inverseKey: \"exercises\",\n },\n ],\n\n form: {\n token: \"ridgeline_new_patient_referral\",\n name: \"Ridgeline new-patient referral intake\",\n describes:\n \"What a referred patient fills in before the initial evaluation, so the first visit is spent examining them rather than typing.\",\n audience: \"public\",\n table: \"patients\",\n fields: [\n { fieldKey: \"full_name\", label: \"Your full name\", required: true },\n { fieldKey: \"date_of_birth\", label: \"Date of birth\", required: true },\n { fieldKey: \"phone\", label: \"Best number to reach you\", required: true },\n { fieldKey: \"email\", label: \"Email\", required: true },\n { fieldKey: \"referring_physician\", label: \"Who referred you?\", required: true, help: \"The doctor's name on your referral, so we can send them your plan of care.\" },\n { fieldKey: \"primary_diagnosis\", label: \"What are you coming in for?\", help: \"In your own words is fine — we will write the clinical version.\" },\n { fieldKey: \"insurance_provider\", label: \"Insurance\", help: \"Choose Self-pay if you would rather not bill insurance.\" },\n ],\n submitLabel: \"Send my referral details\",\n confirmation:\n \"Thank you — we have your details. We will verify your benefits and call you within one business day to book your initial evaluation, which takes about an hour.\",\n },\n\n pipeline: {\n token: \"ridgeline_plan_of_care\",\n name: \"Plan of care\",\n describes:\n \"What happens to a treatment goal once it is written. Sasha reviews this board every Friday, because a plan that sits in Active past its target date is the one that quietly fails.\",\n table: \"treatment_plans\",\n stageField: \"status\",\n stages: [\n { key: \"Active\", label: \"Active\", describes: \"The patient is working toward the goal and attending visits. Leaves when the goal is met, changed or abandoned.\", typicalDurationDays: 42 },\n { key: \"Modified\", label: \"Modified\", describes: \"Re-evaluation changed the goal or the timeline — progress was faster or slower than predicted.\", typicalDurationDays: 21 },\n { key: \"Met\", label: \"Met\", describes: \"The measured goal was reached. This is what discharge is built on and what the referring physician is told.\" },\n { key: \"Discontinued\", label: \"Discontinued\", describes: \"Stopped without meeting the goal — the patient withdrew, was referred out, or their insurance ran out. Written down honestly rather than left Active.\" },\n ],\n },\n\n dashboardQuestion: {\n question: \"How many plans are still Active past the date I said they would be finished?\",\n whyItMatters:\n \"A plan sitting Active past its target date means a patient is being treated without anyone re-checking whether the treatment is working. Every one of those needs a re-evaluation booked this week, or a decision to change the goal.\",\n table: \"treatment_plans\",\n aggregate: \"count\",\n groupBy: \"status\",\n filter: \"status is 'Active' and target_date is before today\",\n answerUnit: \"treatment plans\",\n },\n\n documentTemplate: {\n token: \"ridgeline_plan_of_care_letter\",\n name: \"Plan of care letter to the referring physician\",\n describes:\n \"Goes back to the doctor who made the referral, at the start of care and again at discharge. Physicians refer again when they hear what happened to the last patient they sent, which makes this letter the practice's whole marketing plan.\",\n table: \"treatment_plans\",\n title: \"Plan of care — {{diagnosis}}\",\n body: [\n \"Thank you for the referral.\",\n \"\",\n \"Following evaluation I have started a course of treatment for {{diagnosis}}.\",\n \"\",\n \"Goal: {{goal}}\",\n \"\",\n \"Care began on {{start_date}} and I expect to reach that goal by {{target_date}}. The plan is currently {{status}}. The patient is on a home exercise programme between visits, and I re-evaluate objectively rather than by report.\",\n \"\",\n \"I will write again at discharge with the measured outcome. If anything in the history changes at your end, please tell me — it usually changes the plan.\",\n \"\",\n \"{{practice_name}}\",\n \"{{practice_phone}}\",\n \"{{today}}\",\n ].join(\"\\n\"),\n mergeFields: [\n { key: \"diagnosis\", from: \"diagnosis\", describes: \"What is being treated.\" },\n { key: \"goal\", from: \"goal\", describes: \"The measurable goal, in the words the physician will be told at discharge.\" },\n { key: \"start_date\", from: \"start_date\", describes: \"When care began.\" },\n { key: \"target_date\", from: \"target_date\", describes: \"When the goal is expected to be met.\" },\n { key: \"status\", from: \"status\", describes: \"Where the plan stands today.\" },\n { key: \"practice_name\", from: \"business\", describes: \"The practice name.\" },\n { key: \"practice_phone\", from: \"business\", describes: \"The number the physician's office calls back on.\" },\n { key: \"today\", from: \"today\", describes: \"The date the letter went out.\" },\n ],\n },\n\n notificationRule: {\n token: \"ridgeline_plan_past_target\",\n name: \"A plan has passed its target date\",\n describes:\n \"The one automation a solo therapist genuinely needs: nobody else is watching the caseload, so a goal that quietly slips past its date has to come and find her.\",\n when: {\n table: \"treatment_plans\",\n event: \"overdue\",\n field: \"target_date\",\n },\n audience: \"the treating therapist\",\n channel: \"in_app\",\n message:\n \"{{diagnosis}} has passed its target date of {{target_date}} and is still {{status}}. Book a re-evaluation or change the goal.\",\n },\n\n provenance: {\n kind: \"synthesized\",\n authoredBy: \"data crew (dataset) + lane REAL-DATA (business identity, relationships, form, pipeline, dashboard question, document, notification rule)\",\n authoredOn: \"2026-09-21\",\n noRealPeople: true,\n },\n};\n\nexport default useCase;\n","// src/use-cases/registry.ts — @ai-matrx/records/use-cases\n//\n// THE REGISTER OF REAL USE CASES.\n//\n// One line per use case, and that line is the ONLY thing a crew adds besides\n// its own file. There is deliberately no duplicated metadata here — no industry\n// column, no business name, no row counts — because a second copy of a fact is\n// a second copy that goes stale. Everything a caller wants to list is derived\n// by loading the file (`listUseCases`).\n//\n// The loaders are dynamic imports so a consumer that shows ONE business does not\n// pull fourteen of them into its bundle. `loadAllUseCases` is for the suite, the\n// seeders and the census — all of which run in Node and want the lot.\n\nimport type { UseCase, UseCaseSummary } from \"./types\";\n\n/**\n * Every registered use case, by id. ADD YOUR LINE HERE and nowhere else.\n *\n * Keep it alphabetical — it is read by people looking for an industry.\n */\nexport const USE_CASE_LOADERS: Record<string, () => Promise<{ useCase: UseCase }>> = {\n \"alvarado-chen-kitchen-weekly-cooking\": () => import(\"./alvarado-chen-kitchen-weekly-cooking\"),\n \"birchwood-avenue-renovation-budget\": () => import(\"./birchwood-avenue-renovation-budget\"),\n \"harbor-dental-new-patient-intake\": () => import(\"./harbor-dental-new-patient-intake\"),\n \"ridgeline-physical-therapy-plan-of-care\": () => import(\"./ridgeline-physical-therapy-plan-of-care\"),\n};\n\n/** The ids, sorted, so any listing is stable. */\nexport function useCaseIds(): string[] {\n return Object.keys(USE_CASE_LOADERS).sort();\n}\n\n/** Load one by id. Throws by name when it is not registered. */\nexport async function loadUseCase(id: string): Promise<UseCase> {\n const loader = USE_CASE_LOADERS[id];\n if (!loader) {\n throw new Error(\n `There is no use case registered as \"${id}\". Registered: ${useCaseIds().join(\", \")}.`,\n );\n }\n const module = await loader();\n return module.useCase;\n}\n\n/** Load all of them. For the suite, the seeders and the census. */\nexport async function loadAllUseCases(): Promise<UseCase[]> {\n return Promise.all(useCaseIds().map((id) => loadUseCase(id)));\n}\n\n/** Summarize one without the caller walking its tables. */\nexport function summarize(useCase: UseCase): UseCaseSummary {\n return {\n id: useCase.id,\n useCase: useCase.useCase,\n industry: useCase.industry,\n businessName: useCase.business.name,\n tableCount: useCase.tables.length,\n rowCount: useCase.tables.reduce((total, table) => total + table.rows.length, 0),\n };\n}\n\n/** Every use case, summarized. Loads all of them, so call it server-side. */\nexport async function listUseCases(): Promise<UseCaseSummary[]> {\n return (await loadAllUseCases()).map(summarize);\n}\n\n/**\n * Pick the use case for a given consumer, deterministically.\n *\n * The law says to ROTATE across industries so the platform is exercised by many\n * kinds of business rather than one toy. A suite, a demo or a screenshot script\n * passes a stable name for itself and always gets the same business — stable\n * enough to assert on, different enough across consumers that the platform gets\n * exercised broadly.\n */\nexport function useCaseFor(consumer: string): string {\n const ids = useCaseIds();\n let hash = 0;\n for (let i = 0; i < consumer.length; i += 1) {\n hash = (hash * 31 + consumer.charCodeAt(i)) >>> 0;\n }\n const id = ids[hash % ids.length];\n if (!id) {\n throw new Error(\n `No use cases are registered, so there is nothing to give \"${consumer}\". Add one to USE_CASE_LOADERS.`,\n );\n }\n return id;\n}\n","// src/vocabulary.ts — @ai-matrx/records\n//\n// THE CLOSED VOCABULARIES. Every list here is a word set the STORE enforces,\n// and the store is the only place any of them is decided. The literal values\n// are not typed by hand: `src/store.generated.ts` is regenerated from the live\n// catalogue by `pnpm records:generate`, and `pnpm check:store-registry` fails\n// the build the moment this package and the database disagree. What lives HERE\n// is the type layer over those literals, so a wrong word is a compile error in\n// a consumer rather than a `23514` at three in the morning.\n\nimport {\n ACTOR_VOCABULARY,\n ABSENCE_REASONS,\n VALUE_ENVELOPE_KEYS,\n VALUE_ALTERNATE_KEYS,\n STORAGE_MODES,\n RULE_USES,\n PER_VALUE_ACCESS_WORDS,\n PARITY_FIELD_TYPES,\n DECLARABLE_FIELD_KINDS,\n RULE_NODE_KINDS,\n RETIRED_ACTOR_WORDS,\n} from \"./store.generated\";\n\n/**\n * VAL-8. Who wrote a value. `user`, `agent`, `system` — enforced by every write\n * door, and the three retired words (`human`, `ai`, `code`) are translated by\n * the store's own `custom.actor_word`, never by a caller.\n */\nexport type Actor = (typeof ACTOR_VOCABULARY)[number];\n\n/** The words the store still accepts and rewrites, mapped to what they become. */\nexport type RetiredActorWord = keyof typeof RETIRED_ACTOR_WORDS;\n\n/**\n * VAL-2. Why a value is missing. A value is never blank for an unexplained\n * reason: it either holds something or it says one of these four words.\n */\nexport type AbsenceReason = (typeof ABSENCE_REASONS)[number];\n\n/** The closed key set of one value envelope (VAL-1 … VAL-4). */\nexport type ValueEnvelopeKey = (typeof VALUE_ENVELOPE_KEYS)[number];\n\n/** The closed key set of one ranked alternate (VAL-3). */\nexport type ValueAlternateKey = (typeof VALUE_ALTERNATE_KEYS)[number];\n\n/**\n * REC-4. `heavy` is indexed storage with Rules on write; `light` is\n * whole-document storage with Rules on read. Per Table, one store.\n */\nexport type StorageMode = (typeof STORAGE_MODES)[number];\n\n/** REC-15. One Rule object, four uses. */\nexport type RuleUse = (typeof RULE_USES)[number];\n\n/**\n * VAL-5 / VAL-6. The words that may NOT appear inside a value envelope:\n * visibility and access belong to a Field and to a Record, never to a value.\n * The store refuses each of them by name and so does this package's mirror.\n */\nexport type PerValueAccessWord = (typeof PER_VALUE_ACCESS_WORDS)[number];\n\n/** FLD-11. The parity floor: the field type a person picks in the UI. */\nexport type ParityFieldType = (typeof PARITY_FIELD_TYPES)[number][\"parity_type\"];\n\n/**\n * THE ONE REGISTRY, as a type: every kind a column can be DECLARED as.\n *\n * `ParityFieldType` above is the parity FLOOR — the answer to \"which of the fourteen\n * is this field\". It is not the answer to \"what may somebody pick\", and reading it as\n * though it were is exactly how `signature` came to be a field shape the store accepted\n * (`custom.doc_sign` takes no other) and no screen could offer: VERIFIER-10, F6.\n * `custom.field_kinds()` is the registry, and this is generated from it.\n */\nexport type DeclarableFieldKind = (typeof DECLARABLE_FIELD_KINDS)[number][\"kind\"];\n\n/** FLD-1. The five behaviours a Field can have. One, exactly, and closed. */\nexport type FieldBehavior = (typeof PARITY_FIELD_TYPES)[number][\"behavior\"];\n\n/** The node kinds `custom.rule_eval` evaluates. */\nexport type RuleNodeKind = (typeof RULE_NODE_KINDS)[number][\"node\"];\n\n/**\n * REC-32. The seven table types, closed. The parenthesised names are the\n * retired ones the doctrine records; never coin an eighth.\n */\nexport const TABLE_TYPES = [\n \"entity\",\n \"detail\",\n \"reference\",\n \"ledger\",\n \"restricted\",\n \"system\",\n \"deprecated\",\n] as const;\nexport type TableType = (typeof TABLE_TYPES)[number];\n\n/** REC-33. The two origins. A table we ship in schema `custom` is `standard`. */\nexport const TABLE_ORIGINS = [\"standard\", \"custom\"] as const;\nexport type TableOrigin = (typeof TABLE_ORIGINS)[number];\n\n/** REL-1. Ownership is one fact, stored once, read from the field's side. */\nexport const RELATION_FLAVORS = [\"owned\", \"referenced\"] as const;\nexport type RelationFlavor = (typeof RELATION_FLAVORS)[number];\n\n/** REL-2. What happens to the far side, separate from flavour. */\nexport const ON_DELETE = [\"cascade\", \"set_null\", \"restrict\"] as const;\nexport type OnDelete = (typeof ON_DELETE)[number];\n\n/** REL-3. A snapshot is a frozen copy in the relation's payload, never a pointer. */\nexport const RELATION_BINDINGS = [\"live\", \"snapshot\"] as const;\nexport type RelationBinding = (typeof RELATION_BINDINGS)[number];\n\n/** REL-7. */\nexport const RELATION_CARDINALITIES = [\"one\", \"many\"] as const;\nexport type RelationCardinality = (typeof RELATION_CARDINALITIES)[number];\n\n/** FLD-7. Where a Field's values come from. */\nexport const FIELD_SOURCES = [\"manual\", \"formula\", \"agent\", \"synced\"] as const;\nexport type FieldSource = (typeof FIELD_SOURCES)[number];\n\n/** FLD-9. A Formula declares whether it computes on read or on write. */\nexport const COMPUTE_ON = [\"read\", \"write\"] as const;\nexport type ComputeOn = (typeof COMPUTE_ON)[number];\n\n/**\n * AGT-7 / FLD-12. A Field's sensitivity sets a ceiling a merge field can never\n * widen — and these are THE STORE'S four words, checked against its own guard.\n *\n * This list used to read `standard · sensitive · secret`, which the store has\n * never accepted: writing a Field with `sensitivity: \"standard\"` is refused\n * with \"the field <name> has to say how sensitive its values are, and it says\n * standard\". The knob `custom/field_sensitivity_levels` keys off these same\n * four words to decide which level may read and edit each one, so a package\n * carrying three different words could never have agreed with it. Corrected\n * against the live store, 2026-09-18.\n */\nexport const FIELD_SENSITIVITIES = [\"public\", \"internal\", \"confidential\", \"restricted\"] as const;\nexport type FieldSensitivity = (typeof FIELD_SENSITIVITIES)[number];\n\n/** DYN-17 / §D. Which tier a MERGE FIELD's value is delivered in. */\nexport const DELIVERIES = [\"inline\", \"on_demand\", \"auto\"] as const;\nexport type Delivery = (typeof DELIVERIES)[number];\n\n/**\n * FLD-12. WHETHER AN AGENT MAY SEE A FIELD'S VALUES, and these are the STORE'S\n * four words — not the merge field's delivery tiers.\n *\n * `Field.context_policy` used to be typed as `Delivery` here, which is a\n * different question with a different vocabulary: writing a Field with\n * `context_policy: \"inline\"` is refused with \"the field <name> has to say\n * whether an agent may see its values, and it says inline\". Delivery is about\n * HOW MUCH of a value a merge field carries into a turn; this is about WHETHER\n * the value reaches an agent at all, and conflating them let a screen offer a\n * word the store has never accepted. Corrected against the live store,\n * 2026-09-18.\n */\nexport const CONTEXT_POLICIES = [\"include\", \"summarize\", \"exclude\", \"on_request\"] as const;\nexport type ContextPolicy = (typeof CONTEXT_POLICIES)[number];\n\n/** DYN-3. The eight sources, closed. Relationships and rules are not sources. */\nexport const MERGE_FIELD_SOURCES = [\n \"literal\",\n \"record\",\n \"state\",\n \"actor\",\n \"platform\",\n \"user_input\",\n \"tool\",\n \"derived\",\n] as const;\nexport type MergeFieldSource = (typeof MERGE_FIELD_SOURCES)[number];\n\n/** DYN-4. What a merge field resolves INTO. The consumer never learns which. */\nexport const MERGE_FIELD_SEMANTIC_TYPES = [\n \"value\",\n \"reference\",\n \"resolver\",\n \"computed\",\n \"collection\",\n] as const;\nexport type MergeFieldSemanticType = (typeof MERGE_FIELD_SEMANTIC_TYPES)[number];\n\n/** DYNAMIC-VALUES §A. Any number of these; never fused into the source. */\nexport const MERGE_FIELD_MODIFIERS = [\n \"scoped\",\n \"temporal\",\n \"collection\",\n \"live\",\n \"fallback\",\n \"formatted\",\n \"required\",\n] as const;\nexport type MergeFieldModifier = (typeof MERGE_FIELD_MODIFIERS)[number];\n\n/** DYN-12. The five override policies. Exactly one, and it outranks the ladder. */\nexport const OVERRIDE_POLICIES = [\n \"must_supply\",\n \"shown_overridable\",\n \"shown_locked\",\n \"server_fixed\",\n \"derived\",\n] as const;\nexport type OverridePolicy = (typeof OVERRIDE_POLICIES)[number];\n\n/** DYNAMIC-VALUES §C. What a resolved merge field's freshness was. */\nexport const FRESHNESS = [\"live\", \"cached\", \"snapshot\"] as const;\nexport type Freshness = (typeof FRESHNESS)[number];\n\n/** REC-1. How a Table shows itself. */\nexport const TABLE_DISPLAYS = [\"list\", \"grid\", \"board\", \"calendar\", \"timeline\"] as const;\nexport type TableDisplay = (typeof TABLE_DISPLAYS)[number];\n","// src/archive.ts — @ai-matrx/records · THE ARCHIVE, HEADLESS\n//\n// 🚨 THE DEFECT THIS EXISTS FOR (VERIFIER-10 F4, measured 2026-09-22 on Rincon\n// Plumbing Co's \"Truck 1 dispatch backlog\" as admin@admin.com):\n//\n// \"The grid's row action is Delete… Pressing it soft-deletes correctly:\n// deleted_at set, version 1 → 2, nothing removed, and the row leaves the\n// grid. Then it is gone for good as far as any screen is concerned. The\n// store's own custom.record_restore exists and does exactly the right thing.\n// The door is there; nothing reaches it.\"\n//\n// It could not have been reached. Every read door this store had answered LIVE\n// ROWS ONLY — `custom.read_records`, `read_records_by_ids` and\n// `read_records_matching` each hard-code `and r.deleted_at is null` — so no\n// screen could list an archived record however it was written. The store grew\n// `custom.read_records_archived` (migration\n// `fix10a_the_archive_has_a_read_door.sql`) and this module is its client half:\n// the vocabulary, the row shape, and the sentences a screen says about it.\n//\n// WHY THE SENTENCES LIVE HERE AND NOT IN THE UI. \"Archived by Maria Delgado on\n// 22 September\" is an answer about STORED FACTS, not a layout, and the desktop\n// app, the extension, an agent's reply and the web grid must all say it the\n// same way. A screen that composed its own would be a second answer to one\n// question, reached by knowing which client you are using.\n\nimport type { RecordDocument, ReadRow, Timestamp, Uuid } from \"./record\";\n\n/**\n * THE TWO LANES THE ARCHIVED-ITEMS LAW NAMES (Arman, 2026-09-09) — the same\n * split every other list in the platform makes between what is mine and what\n * is the organization's.\n *\n * · `mine` — what I archived.\n * · `org` — what anybody in this organization archived.\n *\n * `mine` is by construction a SUBSET of `org`: the store applies it as a\n * narrowing conjunct beside the visibility ladder, so a lane can never show a\n * record the ladder would have refused.\n */\nexport const ARCHIVE_LANES = [\"mine\", \"org\"] as const;\nexport type ArchiveLane = (typeof ARCHIVE_LANES)[number];\n\n/** THE DEFAULT LANE. The organization's archive, because \"where did that job go?\" is almost never a question about yourself. */\nexport const DEFAULT_ARCHIVE_LANE: ArchiveLane = \"org\";\n\n/** What each lane is called on a screen, and what it actually answers. */\nexport const ARCHIVE_LANE_LABEL: Record<ArchiveLane, string> = {\n mine: \"Archived by me\",\n org: \"Archived by anyone\",\n};\n\nexport const ARCHIVE_LANE_MEANS: Record<ArchiveLane, string> = {\n mine: \"The records you archived yourself.\",\n org: \"Everything anybody in this organization archived, including you.\",\n};\n\n/** A word that is not a lane is not silently answered as one. */\nexport function isArchiveLane(word: unknown): word is ArchiveLane {\n return typeof word === \"string\" && (ARCHIVE_LANES as readonly string[]).includes(word);\n}\n\n/**\n * One archived record, as `custom.read_records_archived` answers it: an\n * ordinary `ReadRow` — same id, same masked document, same level, same hidden\n * notices as it had while it was live — plus the two facts that only an archive\n * needs.\n *\n * `archivedBy` is null when the archiver is not a member of this organization\n * any more (their name is not this screen's to learn) or when the history\n * partition that held the SOFT_DELETE has rolled away. Null is an ANSWER and\n * gets its own sentence; it is never printed as an empty space.\n */\nexport interface ArchivedRow extends ReadRow {\n archivedAt: Timestamp;\n archivedBy: Uuid | null;\n archivedByName: string | null;\n}\n\n/** The row shape the door returns over the wire, before it is folded. */\nexport interface ArchivedDoorRow {\n id: Uuid;\n document: unknown;\n level: string;\n archived_at: Timestamp;\n archived_by: Uuid | null;\n archived_by_name: string | null;\n}\n\n/**\n * WHEN IT WAS ARCHIVED, THE WAY A PERSON SAYS IT — \"22 September 2026 at 01:53\".\n * Not an ISO string, and never a bare relative word like \"yesterday\" on its\n * own: somebody deciding whether to bring a record back is deciding about a\n * particular day's work.\n */\nexport function archivedWhen(at: Timestamp, locale = \"en-GB\"): string {\n const when = new Date(at);\n if (Number.isNaN(when.getTime())) return \"a moment nobody recorded\";\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n }).format(when);\n}\n\n/**\n * THE WHOLE SENTENCE A ROW IN THE ARCHIVE CARRIES. Both halves of the question\n * the archived-items law asks — who, and when — and an honest sentence when the\n * store could not answer the first half, rather than a blank where a name goes.\n */\nexport function archivedByLine(row: Pick<ArchivedRow, \"archivedAt\" | \"archivedByName\">, locale = \"en-GB\"): string {\n const when = archivedWhen(row.archivedAt, locale);\n const who = (row.archivedByName ?? \"\").trim();\n if (who === \"\") {\n return `Archived on ${when}. The store does not know who archived it — whoever did is no longer in this organization, or it happened before this table kept that.`;\n }\n return `Archived by ${who} on ${when}.`;\n}\n\n/**\n * WHAT AN EMPTY ARCHIVE SAYS, PER LANE. An empty list is an answer and it names\n * the lane it is empty for, so \"nothing here\" can never be read as \"nothing was\n * ever archived\" while the other lane holds twenty records.\n */\nexport function emptyArchiveLine(lane: ArchiveLane): string {\n return lane === \"mine\"\n ? \"You have not archived anything in this table. Switch to “Archived by anyone” to see what the rest of the organization has.\"\n : \"Nothing in this table has been archived. Records you remove from the grid arrive here, and nothing is ever destroyed.\";\n}\n\n/** A document that survived the round trip is the same document — used by the guard. */\nexport function sameDocument(a: RecordDocument, b: RecordDocument): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n}\n","// src/level.ts — @ai-matrx/records\n//\n// THE FOUR WORDS, AND THEIR ORDER. `public.permission_level` is a closed enum —\n// viewer < commenter < editor < admin — and the store says so in its own\n// refusals (\"This needs the admin level (viewer < commenter < editor < admin)\").\n//\n// It lives here, in the headless package, for one reason: a screen that has to\n// decide whether to DRAW a control needs the same ordering the door uses to\n// decide whether to accept the call. Two orderings is two answers to one\n// question, and the second one is always the wrong one.\n//\n// Nothing here decides policy. `atLeast` compares two words the store defined;\n// which word a door requires is the door's business and is never restated here.\n\n/** `public.permission_level`, in the store's own order. */\nexport type PermissionLevel = \"viewer\" | \"commenter\" | \"editor\" | \"admin\";\n\n/** The order the store writes them in, lowest first. */\nexport const PERMISSION_LEVELS: readonly PermissionLevel[] = [\n \"viewer\",\n \"commenter\",\n \"editor\",\n \"admin\",\n] as const;\n\nconst ORDINAL: Record<PermissionLevel, number> = {\n viewer: 1,\n commenter: 2,\n editor: 3,\n admin: 4,\n};\n\n/** Whether `held` is the same rung as `needed` or a higher one. Nothing held is never enough. */\nexport function atLeast(held: PermissionLevel | null | undefined, needed: PermissionLevel): boolean {\n if (!held) return false;\n const have = ORDINAL[held];\n return have !== undefined && have >= ORDINAL[needed];\n}\n\n/** A level word the store sent, or null when it sent something this package does not know. */\nexport function asPermissionLevel(word: unknown): PermissionLevel | null {\n return typeof word === \"string\" && word in ORDINAL ? (word as PermissionLevel) : null;\n}\n\n/** The higher of two levels — what a person holds when two ways in both let them through. */\nexport function highestLevel(\n left: PermissionLevel | null | undefined,\n right: PermissionLevel | null | undefined,\n): PermissionLevel | null {\n if (!left) return right ?? null;\n if (!right) return left;\n return ORDINAL[left] >= ORDINAL[right] ? left : right;\n}\n\n/**\n * What one subject's level is, as `custom.my_levels` answers it. `null` is an\n * ANSWER — \"you hold nothing on this\" — and never a missing row: a screen that\n * could not tell \"no access\" from \"not asked yet\" would draw one of them as the\n * other.\n */\nexport interface MyLevel {\n id: string;\n level: PermissionLevel | null;\n}\n","// src/field.ts — @ai-matrx/records\n//\n// THE FIELD. FLD-1 … FLD-13, FLD-N-1.\n//\n// One behaviour from a closed set of five; modifiers SEPARATE from behaviour; a\n// constraint is a Rule and never a behaviour; a parity type on top that says\n// which of the thirteen things a person picked in the UI and what it is MADE OF.\n// Unit and format live here and not in presentation, because they change what\n// the value MEANS and they reach the agent's context (FLD-N-1).\n\nimport type { Timestamp, Uuid } from \"./record\";\nimport type {\n ComputeOn,\n ContextPolicy,\n DeclarableFieldKind,\n FieldBehavior,\n FieldSensitivity,\n FieldSource,\n OnDelete,\n ParityFieldType,\n} from \"./vocabulary\";\n\n/** FLD-3. A constraint attached to a Field. A Rule, never a behaviour. */\nexport interface FieldRule {\n kind: \"min\" | \"max\" | \"length\" | \"pattern\" | \"equals_field\" | \"differs_from_field\";\n /**\n * The rule's own number or word: the least / the most for `min` / `max`, the\n * LONGEST for `length`, the pattern for `pattern`, the other column's key for\n * `equals_field` / `differs_from_field`. A `length` rule that only says how\n * SHORT a value may be carries `min` and no `value`.\n */\n value?: string | number;\n /**\n * STORE-RULE-GAPS (the older grid's `patternHint`). On a `pattern` rule only:\n * how a person writes it, e.g. `\"949-555-0142\"`. The store refuses an example\n * its own pattern would refuse, and a refused value is told \"Enter it like\n * 949-555-0142.\" (the hint, and `detail.example`).\n */\n example?: string;\n /**\n * STORE-RULE-GAPS (the older grid's `minLength`). On a `length` rule only: the\n * fewest characters. A blank is `required`'s question, never \"too short\".\n */\n min?: number;\n /** FLD-10. Empty means \"wherever the Field applies\". */\n applies_to_types?: string[];\n}\n\n/**\n * `custom.field` — the ONE definitions table (FLD-8), organization-scoped, so\n * two organizations add different fields to the same standard table.\n */\n/**\n * WHICH OF THE OTHER RECORD'S COLUMNS A RELATION SHOWS (REL-DISP, 2026-09-21).\n *\n * A Table has ONE stored default reference column — its `title_field` — and until\n * this existed every relation pointing at that Table could display that column and\n * nothing else. A Jobs board could read \"Maria Chen\" but never \"Maria Chen —\n * Rincon\", and two columns could not be joined into one string at all.\n *\n * ABSENT MEANS THE TABLE'S OWN COLUMN. A field with no `display` resolves exactly\n * as it did before, so nothing changes for a column nobody has given a spec to.\n *\n * The store judges it once, in `custom._display_spec_for`: every column named must\n * exist on the target Table, and the refusal names the one that does not. It is\n * resolved by ONE body, `custom._words_for`, which `custom.record_words`,\n * `custom._card_words`, `custom.relation_words` and `custom.relation_words_many`\n * are all one-liners onto — so the thirteen store-side readers inherit it too.\n *\n * A display column that is itself a relation resolves ONE hop and never a second.\n */\nexport interface RelationDisplay {\n /** The target's columns, in the order they are shown. */\n columns: string[];\n /** What goes between them. Defaults to a single space. */\n separator: string;\n}\n\nexport interface Field {\n id: Uuid;\n organization_id: Uuid;\n /** Set when this Field extends a standard entity rather than a custom Table. */\n entity_definition_id: Uuid | null;\n /** The token of the Table this Field belongs to. */\n table_token: string | null;\n key: string;\n label: string;\n name: string | null;\n\n // ── behaviour and modifiers, which are different questions ────────────────\n /** FLD-1. Exactly one of five. */\n type: FieldBehavior;\n /** FLD-2. The shape of the value, never a second behaviour. */\n multi: boolean;\n /** FLD-2. The values carry their own dates — the world clock, not History. */\n dated: boolean;\n /** FLD-3. Any number of attached validation Rules. */\n rules: FieldRule[];\n config: Record<string, unknown>;\n required: boolean;\n default: unknown;\n sort: number | null;\n\n // ── relation properties (REL-1 … REL-8), on the field's side ──────────────\n /** The Table this relation points at. */\n relation_target: Uuid | null;\n relation_max: number | null;\n on_target_delete: OnDelete | null;\n /** REL-9. The reverse is visible from both ends and is NOT a second Field. */\n inverse_key: string | null;\n /** REL-DISP. Which of the target's columns this one shows. Null = the Table's own. */\n display: RelationDisplay | null;\n\n // ── where values come from (FLD-7, FLD-9) ─────────────────────────────────\n source: FieldSource;\n source_config: Record<string, unknown>;\n /** FLD-9. A Formula declares whether it computes on read or on write. */\n compute_on: ComputeOn | null;\n\n // ── what the value MEANS (FLD-N-1) ────────────────────────────────────────\n /** The unit, on the Field, because it changes the meaning. Never presentation. */\n unit: string | null;\n format: string | null;\n\n // ── the agent-facing properties (FLD-12, AGT-6, AGT-7) ────────────────────\n /** AGT-7. A ceiling a merge field's delivery can never widen. */\n sensitivity: FieldSensitivity | null;\n /** FLD-12. Whether an agent may see this Field's values: include · summarize · exclude · on_request. */\n context_policy: ContextPolicy | null;\n /** AGT-6. How often a `source = agent` Field is refilled. */\n review_interval_days: number | null;\n /**\n * §D says this is on the wrong object and moves to the merge field. It is\n * still carried here because the live column is, and the client reads what\n * the store holds — never what the plan wishes it held.\n */\n depends_on: Uuid[] | null;\n\n /** FLD-10. Which record types this Field applies to. Empty means all of them. */\n applies_to_types: string[];\n /** FLD-5 / FLD-6. A list field's choices are the records of THIS Table. */\n options_table_id: Uuid | null;\n\n created_by: Uuid | null;\n updated_by: Uuid | null;\n created_at: Timestamp;\n updated_at: Timestamp;\n version: number;\n metadata: Record<string, unknown>;\n visibility: string;\n}\n\n/**\n * FLD-11. What the person picked, and what the store says it is made of. The\n * list itself is generated from `custom.parity_field_types()`; this is its type.\n */\nexport interface ParityFieldTypeDescriptor {\n parity_type: ParityFieldType;\n behavior: FieldBehavior;\n made_of: string;\n}\n\n/** AGT-8 / AGT-4. What an agent (or a person) proposes when a Field is missing. */\nexport interface FieldProposal {\n table_id: Uuid;\n key: string;\n label: string;\n type: FieldBehavior;\n multi?: boolean;\n required?: boolean;\n config?: Record<string, unknown>;\n relation_target?: Uuid;\n /** Why this Field should exist — what an approver reads before approving. */\n because: string;\n}\n\n/** AGT-8. What a table proposal looks like, same shape of question. */\nexport interface TableProposal {\n name: string;\n slug: string;\n title_field: string;\n fields: Array<Omit<FieldProposal, \"table_id\" | \"because\">>;\n because: string;\n}\n\n/**\n * WHAT A PERSON SAYS WHEN THEY ADD A COLUMN — the argument of\n * `custom.field_declare`, and deliberately NOT a `Field`.\n *\n * A `Field` is what the store STORES: a behaviour from a closed set of five,\n * modifiers beside it, a format, a unit, a relation target, a relation maximum,\n * an on-delete word, a compute_on, and the attached Rules that make a format\n * enforceable. A person adding a column knows none of that. They know they want\n * a date, or a person, or a list with these three choices in it.\n *\n * Every client that tried to bridge that gap itself got it wrong — the field\n * panel picked \"Person\" and the store read a Formula — so the bridge is the\n * STORE's, once, and this is the shape it takes.\n */\nexport interface NewFieldDeclaration {\n /** What a person reads on the column. The only thing that is always required. */\n label: string;\n /** One of the thirteen. Absent means one of the three plain behaviours below. */\n parity_type?: ParityFieldType;\n /** Plain text, a long text or a plain number — the three that carry no parity type. */\n plain?: \"text\" | \"long_text\" | \"number\";\n /**\n * THE ONE WORD EVERY OTHER CALLER REACHES FOR. An agent, a script, an import\n * and this package's own table-declaring path all say `type`, and until\n * 2026-09-20 `custom._field_document_for` threw it away — a `number` became a\n * text column in silence. It now resolves all three vocabularies, so this is\n * named here rather than left as a shape only the store knows about.\n */\n type?: FieldTypeWord;\n /** Derived from the label when absent, which is why the panel never asks for it. */\n key?: string;\n required?: boolean;\n multi?: boolean;\n dated?: boolean;\n sort?: number;\n sensitivity?: FieldSensitivity;\n context_policy?: ContextPolicy;\n rules?: FieldRule[];\n /** A choice list's choices, as words. The store keeps them as a Table (FLD-5 / FLD-6). */\n options?: string[];\n /** …or the Table they already come from, when a person picked an existing list. */\n options_table_id?: Uuid;\n /** The currency symbol or code a currency field's numbers are in (FLD-N-1). */\n unit?: string;\n /** A date field: a day, or a day and a time. */\n kind?: \"date\" | \"datetime\";\n /** A lookup or a rollup: the key of the relation Field on THIS table it travels along. */\n via?: string;\n /** A lookup: the key of the value it reads on the far side. */\n pick?: string;\n /** A rollup: what it works out, and of which far-side field (`count` needs none). */\n agg?: \"sum\" | \"count\" | \"min\" | \"max\" | \"avg\";\n of?: string;\n /** A formula: the expression, in the same shape a Rule uses (REC-15). */\n expr?: Record<string, unknown>;\n compute_on?: ComputeOn;\n relation_max?: number;\n /**\n * REL / FLD-11. The Table this column points at, when it is neither a Person\n * (`member`) nor a File (`attachment`). The store has taken it since\n * 2026-09-20 and no client type named it, so a person with an Invoice table\n * and a Line table could not declare the link through this package at all.\n */\n relation_target?: Uuid;\n /** REL-2. What happens to this record when the thing it points at goes. */\n on_target_delete?: OnDelete;\n /**\n * REL-DISP. Which of the target's columns this one shows, and what joins them.\n * A bare column name and a plain list are both accepted by the door and\n * normalised; leaving it out keeps the target Table's own reference column.\n */\n display?: RelationDisplay | string[] | string;\n /**\n * Presentation and behaviour settings the store carries verbatim — a long\n * text's `multiline`, a list's existing options table. The door has always\n * read it (`p_spec -> 'config'`) and this interface never offered it, so a\n * package-owned table could not declare its own multi-line column.\n */\n config?: Record<string, unknown>;\n /** A text column that holds a signature (`custom.doc_sign` accepts no other). */\n format?: string;\n /**\n * STORE-RULE-GAPS (the older grid's `allowOther`). A choice list only: a value\n * that is none of the choices is ADDED to the list as typed instead of\n * refused. Stored as `config.allow_other`; absent means off.\n */\n allow_other?: boolean;\n}\n\n/**\n * Every word `custom._field_document_for` resolves for `type`: any parity type\n * in `PARITY_FIELD_TYPES`, any behaviour those types are made of, or one of the\n * plain synonyms a person or an agent actually writes. No count is written down\n * here on purpose — the parity floor is regenerated from\n * `custom.parity_field_types()` and grew from thirteen to fourteen the day\n * `checkbox` landed, which is how the store's own refusals came to name a list\n * that no longer matched it.\n */\nexport type FieldTypeWord =\n // THE ONE REGISTRY (FIX-10B-F6). Every kind `custom.field_kinds()` publishes: the parity\n // floor plus plain text, long text, number, a person-aimed relation and a signature. This\n // union named only the parity floor and three plain synonyms, so `signature` — the one\n // shape `custom.doc_sign` accepts — was not a word any typed caller could send, which is\n // half of why no screen offered it.\n | DeclarableFieldKind\n | FieldBehavior\n | \"number\"\n | \"integer\"\n | \"decimal\"\n | \"float\"\n | \"long_text\"\n | \"string\";\n\n/**\n * What `custom.field_update` accepts.\n *\n * THE SETTINGS **AND** THE BEHAVIOUR. The door has had a behaviour arm since\n * T12 — say `parity_type`, `plain` or `type` and every value of the column is\n * converted (or kept in `_retired` with its reason) by\n * `custom._field_type_converts_values`. This interface named only the settings,\n * so the one client that needed to move a field back onto the behaviour it is\n * written against had no door and reached for `custom.record_update` instead,\n * which writes the document under the guards rather than through them.\n */\nexport interface FieldPatch {\n label?: string;\n required?: boolean;\n dated?: boolean;\n sort?: number;\n sensitivity?: FieldSensitivity;\n context_policy?: ContextPolicy;\n unit?: string;\n rules?: FieldRule[];\n /** The choices of a choice list, rewritten. A choice still wanted keeps its id. */\n options?: string[];\n /** One of the thirteen — a change of what this column HOLDS, not of a setting. */\n parity_type?: ParityFieldType;\n /** …or one of the three plain behaviours, …*/\n plain?: \"text\" | \"long_text\" | \"number\";\n /** …or the one word every other caller reaches for (see `NewFieldDeclaration`). */\n type?: FieldTypeWord;\n /**\n * FLD-2. The shape of the value — one, or several.\n *\n * This comment used to say that a patch moving `multi` ALONE changed nothing\n * and that the behaviour word had to be sent with it. That was true, and it\n * was a description of a silent failure rather than a contract: the door\n * answered \"saved\" and the column still held one. `custom.field_update` has\n * had a real settings arm for it since 2026-09-20 (matrx-frontend\n * `migrations/campaign/fix7b_field_multi_arm.sql`), which also moves a\n * relation's `relation_max` beside it — `custom.validate_values` counts links\n * against that number, so moving `multi` without it would tick a box and\n * still refuse the second record.\n *\n * A CHOICE LIST IS THE ONE EXCEPTION, and it is refused by name rather than\n * ignored: for `select` / `multi_select`, \"one answer or several\" IS the\n * parity type, so send the type instead.\n */\n multi?: boolean;\n /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */\n relation_target?: Uuid;\n on_target_delete?: OnDelete;\n /**\n * REL-DISP. Which of the target's columns this one shows. `null` REMOVES the\n * spec and the column goes back to whatever the table it points at is titled by;\n * the door refuses it by name on a column that points at nothing.\n */\n display?: RelationDisplay | string[] | string | null;\n /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */\n promoted?: boolean;\n unique?: boolean;\n /**\n * STORE-RULE-GAPS. A choice list's \"other values allowed\" setting — see\n * `NewFieldDeclaration.allow_other`. Refused by name on any other column; a\n * retype that stays a list keeps it.\n */\n allow_other?: boolean;\n /** §D / T7: which fields a worked-out column reads. */\n depends_on?: Uuid[];\n /**\n * FLD-9. WHEN a worked-out column works its answer out: when somebody reads the record,\n * or when somebody saves it.\n *\n * This door accepted the word, answered success and threw it away until 2026-09-21\n * (matrx-frontend `migrations/campaign/tails2_a_formula_says_when_it_works_itself_out.sql`)\n * — its spec builder used a fixed key list that did not carry it, so a person declaring a\n * write-stamped formula through this door silently got a read-time one. It is applied now,\n * in both arms, and the records already saved are brought with it.\n *\n * TWO THINGS IT REFUSES BY NAME rather than forcing quietly: a column that is not worked\n * out by the store has no moment to be worked out at, and a ROLL-UP adds up OTHER records,\n * so an answer stamped when this record was last saved would be wrong the moment one of\n * them changed — a roll-up is always `read`.\n */\n compute_on?: ComputeOn;\n /**\n * FLD-11 / REC-15. RE-AIMING A WORKED-OUT COLUMN: the expression, in the same\n * shape a Rule uses and read by the same evaluator — `{\"op\":\"concat\",\"args\":\n * [{\"field\":\"note\"}]}`. Every `{\"field\": …}` in it names a live Field of this\n * organization, or `custom._field_document_for` refuses the whole patch by\n * name and writes nothing.\n *\n * `custom.field_update` carries this in its BEHAVIOUR arm — the arm a type\n * word opens — so send it WITH the word for what the column is\n * (`type: \"formula\"`, or `parity_type` / `plain`). The door's spec builder\n * reads `coalesce(p_patch -> 'expr', v_old -> 'config' -> 'expr')`, so a\n * re-type that does not carry one deliberately keeps the expression the\n * column already had; the settings arm has no `expr` key at all, so `expr`\n * alone is not a change this door makes. `STORE-TAILS-2` asked for the field\n * because the one client that needed to re-aim an existing formula had no\n * typed way to say it and reached for `custom.record_update`, which writes the\n * Field document under the guards rather than through them.\n */\n expr?: Record<string, unknown>;\n}\n\n/**\n * Whether a choice column takes values that are not one of its choices\n * (`config.allow_other`, STORE-RULE-GAPS). Off unless the column says so.\n */\nexport function allowsOtherValues(field: Pick<Field, \"type\" | \"config\">): boolean {\n return field.type === \"list\" && field.config?.[\"allow_other\"] === true;\n}\n","// src/choice.ts — @ai-matrx/records\n//\n// WHAT A CHOICE VALUE IS, in one place, for every screen and every caller.\n//\n// A pick-list is a Table and an option is a Record of it (FLD-5 / FLD-6) — that part is\n// unchanged and is the store being right. What a CELL holds is not the option record's id: it\n// is the option's own stable key, a short word derived from its title when the option is born,\n// unique within its list and never rewritten. So renaming \"Circle\" to \"Round\" rewrites no row,\n// and nothing — no person, no agent, no import — is ever asked to know a uuid for a word the\n// product showed them.\n//\n// The read doors hand back the LABEL in the cell and name the key beside it in `_choices`:\n//\n// { \"kind\": \"Circle\",\n// \"_choices\": { \"kind\": { \"key\": \"circle\", \"label\": \"Circle\", \"id\": \"…\",\n// \"retired\": false, \"reason\": null } } }\n//\n// A multi-choice cell reads as an array of labels and its `_choices` entry is an array in the\n// same order. A RETIRED option is in there too, with `retired: true` and the reason — a value\n// whose choice was retired reads as its label and says what happened rather than vanishing.\n//\n// WRITING takes the label, the key, or (so nothing that worked yesterday breaks) the option\n// record's id. The store normalises all three to the key on the way in and refuses a word that\n// names no choice, naming the choices themselves.\n\nimport type { RecordDocument, StoredRecord } from \"./record\";\n\n/** One option, as `_choices` names it and as `optionsOf` returns it. */\nexport interface ChoiceOption {\n /** The stable key the cell actually holds. */\n key: string;\n /** What a person reads. */\n label: string;\n /** The option RECORD's id, for a caller that needs the row itself. */\n id?: string;\n /** True when the option was retired: still readable, no longer pickable. */\n retired?: boolean;\n /** Why it is no longer offered, in a sentence, when it is retired. */\n reason?: string | null;\n}\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * The stable key of an option RECORD as `custom.field_options` returns it.\n *\n * It lives in `metadata.option_key`, not in the document: FLD-5 keeps a category to one title\n * field, and the key is the store's own bookkeeping rather than a column anybody declared.\n * The fallback is the same slug the store derives, so an option written by something that has\n * not caught up still answers.\n */\nexport function optionKey(option: StoredRecord): string {\n const stored = option.metadata?.[\"option_key\"];\n if (typeof stored === \"string\" && stored.trim() !== \"\") return stored;\n return choiceSlug(optionLabel(option));\n}\n\n/** What a person reads on an option record. */\nexport function optionLabel(option: StoredRecord): string {\n const doc = option.data as RecordDocument | undefined;\n const title = doc?.[\"title\"] ?? doc?.[\"name\"];\n if (typeof title === \"string\" && title.trim() !== \"\") return title;\n return \"Unnamed choice\";\n}\n\n/**\n * The store's own slug, mirrored so a client can predict a key without a round trip.\n * `custom.choice_slug` is the original; a title with nothing a-z0-9 in it gets a short hash of\n * itself there, and this returns the empty-ish fallback rather than guessing a hash — a caller\n * that needs the real key for such a title reads it off the option.\n */\nexport function choiceSlug(word: string): string {\n const slug = word\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\")\n .replace(/^_+|_+$/g, \"\")\n .slice(0, 55);\n return slug === \"\" ? \"choice\" : slug;\n}\n\n/**\n * Does this stored (or typed) value name this option? The key, the label and the option's own\n * id all name the same choice, and a control has to recognise every one of them: what the read\n * door hands it is the LABEL, what the store holds is the KEY, and what a screen written before\n * this contract sends is the ID.\n */\nexport function isTheChosen(option: StoredRecord, value: unknown): boolean {\n if (typeof value !== \"string\") return false;\n const asked = value.trim().toLowerCase();\n if (asked === \"\") return false;\n return (\n asked === optionKey(option).toLowerCase() ||\n asked === optionLabel(option).toLowerCase() ||\n asked === option.id.toLowerCase()\n );\n}\n\n/** Every value of one cell, as strings, whether the Field is multi or not. */\nexport function choiceValuesOf(value: unknown): string[] {\n if (Array.isArray(value)) return value.filter((v): v is string => typeof v === \"string\");\n if (typeof value === \"string\" && value !== \"\") return [value];\n return [];\n}\n\n/**\n * What the read door said about one column's choices: the key behind the label, and whether the\n * option was retired and why. Returns an empty array when the document carries no `_choices`\n * entry for that column, which is also what a document written before this contract looks like.\n */\nexport function choicesOf(document: RecordDocument | undefined, fieldKeyOrId: string): ChoiceOption[] {\n const block = document?.[\"_choices\"];\n if (!block || typeof block !== \"object\") return [];\n const entry = (block as Record<string, unknown>)[fieldKeyOrId];\n if (!entry) return [];\n const list = Array.isArray(entry) ? entry : [entry];\n return list.filter((x): x is ChoiceOption => !!x && typeof x === \"object\" && typeof (x as ChoiceOption).key === \"string\");\n}\n\n/** True when this cell's value points at a choice that has since been retired. */\nexport function holdsARetiredChoice(document: RecordDocument | undefined, fieldKeyOrId: string): boolean {\n return choicesOf(document, fieldKeyOrId).some((c) => c.retired === true);\n}\n\n/** True when a token looks like a uuid — which a choice value is no longer allowed to be. */\nexport function looksLikeAnId(value: unknown): boolean {\n return typeof value === \"string\" && UUID.test(value);\n}\n","// src/coerce.ts — @ai-matrx/records\n//\n// WHAT A TYPED-IN ANSWER MEANS TO A FIELD, WORKED OUT IN ONE PLACE.\n//\n// Every door into this store that a person types into hands over STRINGS. A\n// browser input is a string. A clipboard cell is a string. A CSV column is a\n// string. A public form's answer is a string. A Field does not take strings —\n// it takes a number, a tick, a day, the id of an option — and until the string\n// has been turned into one of those, the store refuses it.\n//\n// 🚨 WHY THIS FILE EXISTS (AGENT-BUILDS-2's closing walk, 2026-09-21). A real\n// customer picked a time on Ironclad Mobile Mechanic's public booking page,\n// typed their name, phone, email and vehicle, pressed \"Book it\", and the page\n// answered:\n//\n// \"Vehicle Year takes a number, and it was given a string\"\n//\n// The appointment was not made. `BookingPicker` kept its answers as\n// `Record<string, string>` and the confirm route passed them through\n// uncoerced, so a booking page over ANY table with a number field was\n// unbookable by anybody. The store was right and said so plainly; nothing\n// between the person and the store had done the one job that stood between\n// them.\n//\n// AND IT WAS ALREADY SOLVED, TWICE, IN THE WRONG PLACE. The grid's paste\n// (`@ai-matrx/records-ui` `valueFromPastedText`) and the import wizard each\n// carried their own coercion — good ones — while the two PUBLIC doors, the\n// ones a stranger uses, carried none. That is the shape the platform-primitive\n// rule exists to stop: a capability scoped to the feature that surfaced it.\n// So the coercion lives HERE, headless, in the package both the screens and\n// the servers already depend on, and every one of those five doors calls it.\n//\n// THREE RULES IT KEEPS:\n//\n// 1. A VALUE IS COERCED, NEVER GUESSED. Writing 0 for \"about twelve\" or\n// today's date for \"soon\" is how a table quietly becomes untrue. A string\n// that is not the thing is REFUSED, by name, in words the person can act\n// on — \"Vehicle Year holds a number, and “twenty nineteen” is not one\".\n// 2. THE REFUSAL NAMES THE FIELD IN PLAIN WORDS, never its key, because the\n// person reading it is looking at a label on a screen.\n// 3. IT DECIDES NOTHING ELSE. Required, the Rules, the cap, the rate window\n// and every wall are the store's. This turns a string into a value and\n// stops.\n\nimport type { Field } from \"./field\";\n\n/**\n * EVERYTHING THIS FILE NEEDS TO KNOW ABOUT A FIELD, AND NOTHING ELSE.\n *\n * A full `Field` satisfies it, and so does every narrower shape the store\n * hands to a screen — `CaptureField` on a phone with no network, the Field\n * documents `custom.form_public` and `custom.booking_public` publish to a\n * stranger. Asking for the whole `Field` would have meant the capture sheet\n * keeping its own `Number(raw)`, which is exactly the duplication this file\n * exists to end.\n */\nexport interface CoercibleField {\n /** Named so the doc above is checkable: a full {@link Field} satisfies this. */\n key: string;\n label?: string | null;\n name?: string | null;\n /** FLD-1. One of five behaviours; an unknown word is treated as text. */\n type?: string | null;\n multi?: boolean | null;\n unit?: string | null;\n format?: string | null;\n config?: Record<string, unknown> | null | undefined;\n relation_target?: string | null;\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// WHICH KIND OF THING A FIELD HOLDS\n// ───────────────────────────────────────────────────────────────────────────\n\n/**\n * The kind of value one Field holds, resolved from its DECLARATION only — the\n * behaviour, the modifiers, the format, the relation target and the config,\n * because those are what the store stores. A screen that guessed from a value\n * would answer differently for an empty record.\n *\n * `plain_text`, `long_text`, `number` and `boolean` are behaviours that carry\n * no parity type of their own; every other word here is a parity type.\n */\nexport const FIELD_KINDS = [\n \"attachment\",\n \"checkbox\",\n \"currency\",\n \"datetime\",\n \"email\",\n \"formula\",\n \"json\",\n \"long_text\",\n \"lookup\",\n \"member\",\n \"multi_select\",\n \"number\",\n \"percent\",\n \"phone\",\n \"relation\",\n \"rollup\",\n \"select\",\n \"text\",\n \"url\",\n] as const;\n\n/**\n * 🚨 THE UNION IS DERIVED FROM THE LIST ABOVE, and the list is what the\n * coverage test walks. Add a kind here and the test drives it; give it no arm\n * in `coerceTypedAnswer` and the test says so, instead of the new kind falling\n * quietly through `default:` and a value of the wrong shape reaching the store\n * — which is the whole defect this file closes.\n */\nexport type FieldKind = (typeof FIELD_KINDS)[number];\n\n/** The kernel Table ids REC-31 pins the two special relations to. */\nexport interface KernelTargets {\n /** The kernel `File` Table — a relation pointing here is an attachment. */\n file?: string | undefined;\n /** The kernel `Person` Table — a relation pointing here names a person. */\n person?: string | undefined;\n}\n\n/**\n * Which kind of value this Field holds.\n *\n * This is the ONE classifier. `@ai-matrx/records-ui`'s `editorKindFor` — which\n * decides which editor to DRAW — delegates to it, so the editor a person types\n * into and the coercion applied to what they typed can never disagree about\n * the same column. They did disagree before this moved here; that is the whole\n * class of grid defect September was spent closing.\n */\nexport function fieldKindFor(field: CoercibleField, kernel?: KernelTargets): FieldKind {\n const format = (field.format ?? \"\").toLowerCase();\n const config = field.config ?? {};\n switch (field.type) {\n case \"boolean\":\n return \"checkbox\";\n case \"text\":\n if (format === \"email\") return \"email\";\n if (format === \"phone\") return \"phone\";\n if (format === \"url\") return \"url\";\n if (format === \"json\" || config[\"json\"] === true) return \"json\";\n if (format === \"long\" || config[\"multiline\"] === true) return \"long_text\";\n return \"text\";\n case \"range\": {\n const kind = String(config[\"kind\"] ?? \"number\");\n if (kind === \"date\" || kind === \"datetime\") return \"datetime\";\n // THE FORMAT, AND ONLY THE FORMAT. A unit is not a currency: a quantity\n // in `units` drawn as money is how three of something rendered \"units3\".\n if (format === \"currency\") return \"currency\";\n if (format === \"percent\" || field.unit === \"%\") return \"percent\";\n return \"number\";\n }\n case \"list\":\n return field.multi ? \"multi_select\" : \"select\";\n case \"relation\": {\n const parity = String(config[\"parity\"] ?? \"\");\n if (parity === \"attachment\" || parity === \"member\") return parity;\n if (kernel?.file && field.relation_target === kernel.file) return \"attachment\";\n if (kernel?.person && field.relation_target === kernel.person) return \"member\";\n return \"relation\";\n }\n case \"formula\": {\n const via = config[\"via\"];\n if (via && config[\"agg\"]) return \"rollup\";\n if (via) return \"lookup\";\n return \"formula\";\n }\n default:\n return \"text\";\n }\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// THE COERCION\n// ───────────────────────────────────────────────────────────────────────────\n\n/** One Field's options, indexed the way a typed word has to be looked up. */\nexport interface ChoiceOptions {\n /**\n * Lower-cased label, option key and option id, each pointing at the OPTION\n * RECORD'S ID — which is what a list Field stores (FLD-5/FLD-6).\n */\n byWord: Map<string, string>;\n /** The labels, in order, so a refusal can say what is on offer. */\n labels: string[];\n}\n\n/** What one answer became, or the sentence saying why it did not. */\nexport type Coerced =\n | { value: unknown }\n | { refusal: string; unmatched?: string[] };\n\nexport interface CoerceOptions {\n /** This Field's choices, when the caller has loaded them. */\n options?: ChoiceOptions | undefined;\n /** The kernel File/Person Table ids, for classifying relations. */\n kernel?: KernelTargets | undefined;\n /**\n * The Field's name as this caller writes it. Defaults to the Field's own\n * label. A screen passes the same words it printed above the box.\n */\n label?: string | undefined;\n}\n\n/** One id, written the way the store writes one (REC-51's shape test). */\nconst UUID_TEXT = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nconst TRUE_WORDS = new Set([\"true\", \"yes\", \"y\", \"1\", \"✓\", \"x\", \"checked\", \"on\"]);\nconst FALSE_WORDS = new Set([\"false\", \"no\", \"n\", \"0\", \"\", \"unchecked\", \"off\"]);\n\n/** The Field's name in plain words — never its key on a screen. */\nexport function coercionLabel(field: CoercibleField): string {\n const label = (field.label ?? \"\").trim();\n if (label !== \"\") return label;\n const name = (field.name ?? \"\").trim();\n if (name !== \"\") return name;\n return field.key\n .replace(/[_-]+/g, \" \")\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n .trim();\n}\n\n/**\n * Turn ONE typed-in string into the value this Field holds — or say, in a\n * sentence a person can act on, why it is not one.\n *\n * An empty answer is `null` for every kind: a blank means \"no answer here\",\n * and clearing a value is a thing a person means to do. Whether the Field may\n * be blank is the store's question, asked with the Field's `required` and its\n * Rules, not this one's.\n */\nexport function coerceTypedAnswer(\n field: CoercibleField,\n raw: string,\n opts: CoerceOptions = {},\n): Coerced {\n const label = opts.label ?? coercionLabel(field);\n const text = raw.trim();\n const kind = fieldKindFor(field, opts.kernel);\n\n if (text === \"\" && kind !== \"checkbox\") return { value: null };\n\n switch (kind) {\n case \"checkbox\": {\n const word = text.toLowerCase();\n if (TRUE_WORDS.has(word)) return { value: true };\n if (FALSE_WORDS.has(word)) return { value: word === \"\" ? null : false };\n return {\n refusal: `${label} is a tick box, so it takes yes or no — “${raw}” is neither. Write TRUE/FALSE, yes/no or 1/0.`,\n };\n }\n case \"number\":\n case \"currency\":\n case \"percent\": {\n // PEOPLE WRITE NUMBERS THE WAY PEOPLE WRITE NUMBERS. \"$1,250.50\",\n // \"(300)\" for a negative, \"12%\", \"2019\" — all of them are the number\n // that was meant, and refusing them makes the column people use most\n // the one the product cannot take.\n const negative = /^\\(.*\\)$/.test(text);\n const bare = text\n .replace(/^\\(|\\)$/g, \"\")\n .replace(/[\\s,]/g, \"\")\n .replace(/^[^\\d.\\-+]+/, \"\")\n .replace(/[^\\d.\\-+eE]+$/, \"\");\n const n = Number(bare);\n if (bare === \"\" || Number.isNaN(n)) {\n return {\n refusal: `${label} holds a number, and “${raw}” is not one. Write digits — a currency symbol, a percent sign, commas and brackets for a negative are all fine.`,\n };\n }\n return { value: negative ? -n : n };\n }\n case \"datetime\": {\n // A DAY IS NOT AN INSTANT, AND TREATING IT AS ONE MOVES IT. `2026-09-01`\n // parsed as an instant is midnight UTC, and a screen west of Greenwich\n // then draws it as 31 August — measured on fifty pasted invoice dates,\n // all one day early, systematically. A date Field holds a DAY.\n const wantsTime = String(field.config?.[\"kind\"] ?? \"date\") === \"datetime\";\n const plainDay = /^\\s*(\\d{4})-(\\d{2})-(\\d{2})\\s*$/.exec(raw);\n if (!wantsTime && plainDay) return { value: `${plainDay[1]}-${plainDay[2]}-${plainDay[3]}` };\n const at = Date.parse(text);\n if (Number.isNaN(at)) {\n return {\n refusal: `${label} holds a date, and “${raw}” is not one this can read. Write it as 2026-09-21, or the way your spreadsheet writes dates.`,\n };\n }\n const parsed = new Date(at);\n if (wantsTime) return { value: parsed.toISOString() };\n const y = parsed.getFullYear();\n const m = String(parsed.getMonth() + 1).padStart(2, \"0\");\n const d = String(parsed.getDate()).padStart(2, \"0\");\n return { value: `${y}-${m}-${d}` };\n }\n case \"json\": {\n try {\n return { value: JSON.parse(text) };\n } catch {\n return {\n refusal: `${label} holds a document, and “${raw}” is not valid JSON. Write the whole object, braces and all.`,\n };\n }\n }\n case \"select\":\n case \"multi_select\": {\n // A LIST IS AN IDENTITY, AND A WORD IS HOW A PERSON NAMES ONE. The store\n // keeps the option's id; the person types its label. Matching the two is\n // the whole job, and it is case-insensitive because \"COMPLETED\" and\n // \"Completed\" are one option.\n if (!opts.options) {\n return {\n refusal: `${label} is a list and its options have not been read yet, so nothing can be matched to “${raw}”. Try again once the column's choices have loaded.`,\n };\n }\n const wanted = kind === \"multi_select\"\n ? text.split(/[,;]/).map((w) => w.trim()).filter((w) => w.length > 0)\n : [text];\n if (wanted.length === 0) return { value: kind === \"multi_select\" ? [] : null };\n const matched: string[] = [];\n const unmatched: string[] = [];\n for (const word of wanted) {\n const hit = opts.options.byWord.get(word.toLowerCase());\n if (hit === undefined) unmatched.push(word);\n else matched.push(hit);\n }\n if (unmatched.length > 0) {\n const offered = opts.options.labels.length > 0\n ? opts.options.labels.join(\", \")\n : \"it has none yet\";\n return {\n refusal:\n `${label} does not have ${unmatched.map((w) => `“${w}”`).join(\" or \")} among its options. ` +\n `It offers: ${offered}.`,\n unmatched,\n };\n }\n return { value: kind === \"multi_select\" ? matched : matched[0] };\n }\n // AN IDENTITY IS NOT A WORD. Writing the word would put a string where an\n // id belongs, and every filter, colour and rollup built on that column\n // would stop agreeing with it. So it is refused and the person is told\n // which control does hold it.\n //\n // BUT AN ID IS AN IDENTITY (RELATION-TARGETS, 2026-09-23). A Person or File\n // column holds the kernel Person / File record, and the store itself now\n // turns the id a writer actually holds — a member's user id, an uploaded\n // file's id, or the record's own id — into that record at every write door\n // (`custom.relation_kernel_record`), refusing anything else in its own\n // words (\"… names someone who is not a member of …\"). So an import column\n // of member ids, or an agent handing over the file it just uploaded, is a\n // value and not a refusal; the store, not this mirror, decides whether the\n // id is somebody here.\n case \"member\":\n if (UUID_TEXT.test(text)) return { value: text.toLowerCase() };\n return {\n refusal: `${label} names a person in this organization, so it is chosen rather than typed. Open it and pick them.`,\n };\n case \"attachment\":\n if (UUID_TEXT.test(text)) return { value: text.toLowerCase() };\n return {\n refusal: `${label} holds a file, which cannot arrive as typed-in text. Open it and attach the file.`,\n };\n case \"relation\":\n return {\n refusal: `${label} points at another record, so it is chosen rather than typed. Open it and pick the record.`,\n };\n case \"formula\":\n case \"lookup\":\n case \"rollup\":\n return {\n refusal: `${label} is worked out by the system, so nothing can be written into it.`,\n };\n default:\n // text, long_text, email, phone, url — the string IS the value, and the\n // format Rules on it are the store's to judge.\n return { value: raw };\n }\n}\n\n/** What a whole set of typed-in answers became. */\nexport interface CoercedAnswers {\n /** Ready to send to the store. Only the keys that coerced cleanly. */\n values: Record<string, unknown>;\n /** Field key → the sentence saying why that answer was not written. */\n refusals: Record<string, string>;\n /** The field keys the caller sent that this table has no Field for. */\n unknownKeys: string[];\n}\n\n/**\n * Every typed-in answer on one screen, coerced together — the shape the two\n * public doors and the import wizard actually need.\n *\n * Keys the table has no Field for are reported rather than dropped: the store\n * refuses an unknown key by name and a caller that quietly deleted it would\n * hide a real mismatch between a page and its table.\n */\nexport function coerceTypedAnswers(\n fields: readonly CoercibleField[],\n answers: Readonly<Record<string, unknown>>,\n opts: {\n kernel?: KernelTargets | undefined;\n /** Choices per Field key, for the list columns. */\n options?: ReadonlyMap<string, ChoiceOptions> | undefined;\n /** Field key → the words that screen printed above the box. */\n labels?: Readonly<Record<string, string>> | undefined;\n } = {},\n): CoercedAnswers {\n const byKey = new Map(fields.map((f) => [f.key, f]));\n const values: Record<string, unknown> = {};\n const refusals: Record<string, string> = {};\n const unknownKeys: string[] = [];\n\n for (const [key, given] of Object.entries(answers)) {\n const field = byKey.get(key);\n if (!field) {\n unknownKeys.push(key);\n // Passed through untouched: it is the STORE's job to say it does not\n // know this key, in its own words, naming it.\n values[key] = given;\n continue;\n }\n // ALREADY THE RIGHT SHAPE IS LEFT ALONE. A screen with real editors hands\n // over a number, a boolean or an array already; only a STRING needs this.\n if (typeof given !== \"string\") {\n values[key] = given;\n continue;\n }\n const opt: CoerceOptions = {};\n const choices = opts.options?.get(key);\n if (choices) opt.options = choices;\n if (opts.kernel) opt.kernel = opts.kernel;\n const label = opts.labels?.[key];\n if (label) opt.label = label;\n\n const answered = coerceTypedAnswer(field, given, opt);\n if (\"refusal\" in answered) refusals[key] = answered.refusal;\n else values[key] = answered.value;\n }\n\n return { values, refusals, unknownKeys };\n}\n","// src/pipeline.ts — @ai-matrx/records · PRODUCTS row 7\n//\n// A PIPELINE IS NOT A NEW KIND OF THING, and this module adds none. A pipeline is a\n// Choice Field that a Table names as its STAGE field, plus transition Rules of the ONE\n// Rule object (REC-15) about that Table. A move is an ORDINARY record write: the validate\n// use judges it, History records it because it is a write, and the entry effects are the\n// applicability use's own declared consequence.\n//\n// SO THIS PACKAGE ENFORCES NOTHING. Every type below is the shape of a door's answer, and\n// every judgement comes from the store. A board that decided in the browser which column a\n// card may enter would be a second opinion with nothing keeping it equal to the first —\n// and it would be the comfortable one, because it is the one nobody can be refused by.\n\nimport type { Uuid } from \"./record\";\n\n/** One stage of a board: the KEY the store keeps, and the LABEL a person reads. */\nexport interface PipelineStage {\n /** The option's stable key — what a cell holds, and what a move is written with. */\n key: string;\n /** What the column heading says. Renaming a stage rewrites no record. */\n label: string;\n /** A retired choice can still be READ on a record that holds it; it cannot be picked anew. */\n retired: boolean;\n}\n\n/** What each Rule of a pipeline is about. Closed, and the store is the authority. */\nexport const PIPELINE_RULE_KINDS = [\"moves\", \"requires\", \"who\", \"limit\", \"entry\"] as const;\n/**\n * A GATE is the general form under `requires`, `who` and `limit`, and the store spells it\n * `gate:1`, `gate:2` … so several gates can sit on one stage without one overwriting the\n * next. It is matched as a prefix rather than listed, because the number is open.\n */\nexport type PipelineRuleKind = (typeof PIPELINE_RULE_KINDS)[number] | `gate:${number}`;\n\n/**\n * WHAT A GATE DOES WHEN IT SAYS NO. The closed list `custom.stage_rule_on_fail_kinds()`\n * answers — a screen offering a third answer would be offering something no Rule can carry.\n */\nexport const STAGE_RULE_ON_FAIL = [\"refuse\", \"require_approval\"] as const;\nexport type StageRuleOnFail = (typeof STAGE_RULE_ON_FAIL)[number];\n\n/**\n * THE ORGANIZATION'S ONE KNOB (`custom/stage_rule_enforcement`). `refuse` is the default and\n * what a gate is for; `warn` lets the move through and hands the same sentence back. It never\n * softens `require_approval` — \"ask somebody\" and \"carry on with a note\" are different answers.\n */\nexport const STAGE_RULE_ENFORCEMENT = [\"refuse\", \"warn\"] as const;\nexport type StageRuleEnforcement = (typeof STAGE_RULE_ENFORCEMENT)[number];\n\n/**\n * One transition Rule, as `custom.pipeline_read` hands it back — WITH the sentence it says\n * when it refuses, because a screen that knows a rule exists but not what it refuses in\n * cannot warn anybody before they drag.\n */\nexport interface PipelineRule {\n id: Uuid;\n name: string;\n /** The exact words a person is shown when this Rule stops a move. */\n message: string;\n kind: PipelineRuleKind | null;\n /** The stage this Rule is about; `null` on the one Rule about the moves themselves. */\n stage: string | null;\n uses: string[];\n /** What happens when a card ARRIVES in this stage — assign, notify, start a checklist. */\n on_entry: Record<string, unknown> | null;\n /**\n * What this Rule does when it STOPS a move. `refuse` is the default and what every\n * pipeline Rule did before gates existed; `require_approval` files the change in the\n * approvals queue with this Rule's sentence as the reason and leaves the record alone.\n */\n on_fail?: StageRuleOnFail;\n /**\n * THE GATE AS IT WAS WRITTEN, which is the only thing that makes it EDITABLE.\n *\n * A gate is saved as one Rule whose expression is an `or` of four arms — not this\n * stage, OR not a move, OR the gate is not about this card, OR the demand holds. That\n * compiled form used to be the only copy, so a settings screen could read a gate's name\n * and its sentence and nothing else: it would open every existing rule with a blank\n * condition and overwrite it the first time somebody pressed Save.\n *\n * Absent on the four sugar rules (`moves`, `requires`, `who`, `limit`), which nobody\n * writes in a condition builder, and on any gate declared before the store started\n * keeping them. Absent means \"this one was not written here\" — never \"it has no\n * condition\", which is a different and dangerous thing to draw.\n */\n when?: Record<string, unknown> | null;\n /** @see {@link PipelineRule.when} — the condition that has to hold, as it was written. */\n demands?: Record<string, unknown> | null;\n version: number;\n}\n\n/**\n * WHAT A GATE WOULD DO TO THIS BOARD TODAY, from `custom.pipeline_gate_preview`.\n *\n * The one question somebody writing a rule that will refuse their colleagues' work\n * actually has, answered while they are still typing it — the gate is judged as an\n * argument, nothing is saved, and nothing is written. The store compiles it with the\n * SAME compiler `pipeline_declare` uses, so this count and the refusal at the door are\n * the same rule.\n */\nexport interface PipelineGatePreview {\n is_pipeline: boolean;\n /** Present, and it says what would make a board exist, when `is_pipeline` is false. */\n why?: string;\n /** The stage key the gate was tried against. */\n stage?: string;\n /** Live cards of this board this person may see that are not already in that stage. */\n considered: number;\n /** How many of them this gate would turn away. */\n refused: number;\n /**\n * Up to three of them, BY NAME. A count with no names is a number nobody can check, and\n * checking it is the whole reason to show it before saving.\n */\n examples: { record_id: Uuid; title: string }[];\n /** True when the board is larger than the preview will walk, so the count is a floor. */\n truncated?: boolean;\n on_fail?: StageRuleOnFail;\n /** The word this board uses for one of its cards — \"quote\", \"deal\" — for the sentence. */\n noun?: string;\n}\n\n/** The whole board's definition, from `custom.pipeline_read`. */\nexport interface Pipeline {\n is_pipeline: boolean;\n /** Present, and it says what would make a board exist, when `is_pipeline` is false. */\n why?: string;\n table_id?: Uuid;\n /** The Field KEY that holds the stage — the twin of a Table's `type_field`. */\n stage_field?: string;\n field_id?: Uuid;\n /** What that column is called, e.g. \"Stage\". */\n stage_label?: string;\n /** In the order they were declared, which is the order the board draws them. */\n stages?: PipelineStage[];\n rules?: PipelineRule[];\n}\n\n/** One column of the board, with the store's own numbers over what this person may see. */\nexport interface PipelineColumn {\n stage_key: string;\n stage_label: string;\n /** 1-based, the declared order. */\n stage_position: number;\n cards: number;\n /** The total of the chosen measure, or null when no measure was asked for. */\n total: number | null;\n /** How many cards this column takes at once, or null when it takes any number. */\n wip_limit: number | null;\n /** True when the column already holds MORE than its limit — a state a board must show. */\n over_limit: boolean;\n}\n\n/** One column this stage demands before a card may land in it. */\nexport interface PipelineMissingField {\n field_id: Uuid;\n key: string;\n /** What the column is called, so a screen can ASK for it rather than only refuse. */\n label: string;\n}\n\n/**\n * Whether a card may go to a column, answered BEFORE the finger lets go — by the same\n * Rules, through the same evaluator, on the document the move WOULD produce.\n *\n * A board greys a column, and snaps a card back, from this. It never decides for itself.\n */\nexport interface PipelineVerdict {\n allowed: boolean;\n is_pipeline: boolean;\n /**\n * The THREE answers a board has to draw differently, and the reason `allowed` alone is\n * not enough: a card that is going for approval has not been refused, and a card that\n * moved under `warn` has not been waved through silently.\n */\n outcome?: \"allowed\" | \"refused\" | \"needs_approval\" | \"warned\";\n /** What this organization's one knob says right now. */\n enforcement?: StageRuleEnforcement;\n /** Set on `needs_approval`: what pressing on will actually do, in plain words. */\n what_happens?: string;\n /** Set on `warned`: the gates this organization asked to be told about, not stopped by. */\n warnings?: StageRuleWarning[];\n /** Approvals already filed against this card's own stage column that nobody has decided. */\n pending?: StagePending[];\n /** The stage key the move was asked about. */\n to?: string;\n /** The store's own sentence — shown verbatim, never paraphrased by a screen. */\n why: string;\n rule?: string;\n rule_id?: Uuid;\n rule_version?: number;\n kind?: PipelineRuleKind;\n /** What this Rule does when it stops a move. */\n on_fail?: StageRuleOnFail;\n /**\n * When a stage demands columns that are empty, exactly which ones — so the screen can\n * prompt for them on entry instead of sending the person away to find them.\n */\n missing?: PipelineMissingField[];\n}\n\n/** What `custom.pipeline_declare` says it made or changed. */\nexport interface PipelineDeclared {\n table_id: Uuid;\n stage_field: string;\n field_id: Uuid;\n stages: string[];\n rules: Record<string, Uuid>;\n /** Plain sentences naming each thing this declaration wrote. */\n said: string[];\n}\n\n/** The declaration a person (or an agent) writes. Everything is optional but the stages. */\nexport interface PipelineSpec {\n stage_field: { key: string; label?: string; options?: string[]; sort?: number };\n transitions?: { from: string; to: string }[];\n /** Stage name → the column keys that must be filled in to land there. */\n requires?: Record<string, string[]>;\n /** Stage name → the rung somebody needs on the record to move a card INTO it. */\n who?: Record<string, \"viewer\" | \"commenter\" | \"editor\" | \"admin\">;\n /** Stage name → how many cards may sit there at once. The mover is not counted. */\n limits?: Record<string, number>;\n /** Stage name → what happens when a card arrives: assign, notify, start a checklist. */\n on_entry?: Record<string, Record<string, unknown>>;\n /**\n * Stage name → the gates a card has to get past to land there. The general form under\n * `requires`, `who` and `limits`, and the only one that can say `require_approval`.\n */\n gates?: Record<string, PipelineGate[]>;\n moves_message?: string;\n requires_messages?: Record<string, string>;\n}\n\n/**\n * A gate the organization's own knob overruled. NOTHING FAILS SILENTLY: the move happened\n * and the sentence comes back WITH it, together with what to do about it.\n */\nexport interface StageRuleWarning {\n rule_id: Uuid;\n rule: string;\n /** The gate's own sentence, shown verbatim. */\n why: string;\n what_to_do: string;\n}\n\n/** An approval filed against this card's stage column that nobody has decided yet. */\nexport interface StagePending {\n approval_id: Uuid;\n /** The stage key the card is waiting to go to. */\n to: string;\n why: string | null;\n requested_at: string;\n state: string;\n}\n\n/**\n * The same wait, asked for a WHOLE BOARD in one question (`custom.pipeline_pending`), so a\n * board can badge every card that is waiting without a round trip per card — and therefore\n * actually does it, instead of drawing a filed card as if nobody had ever dragged it.\n */\nexport interface StagePendingOnBoard extends StagePending {\n record_id: Uuid;\n}\n\n/** What `custom.pipeline_move` answers — an OBJECT on every path, never a bare number. */\nexport interface PipelineMoveResult {\n applied: boolean;\n moved: boolean;\n outcome: \"moved\" | \"moved_with_warnings\" | \"needs_approval\";\n to: string;\n version: number;\n /** Set on `moved_with_warnings`. */\n warnings?: StageRuleWarning[];\n /** Set on `needs_approval`: the gate's sentence, the wait that was filed, and who has it. */\n why?: string;\n rule?: string;\n rule_id?: Uuid;\n approval_id?: Uuid;\n approvers?: { user_id: Uuid; name: string | null; why: string }[];\n what_happens?: string;\n}\n\n/**\n * ONE GATE ON A STAGE, as the condition builder on the stage settings screen writes it.\n * `requires`, `who` and `limits` are sugar over this shape; this is the general form, and\n * it speaks the SAME condition language as filters and formulas — never a second one.\n */\nexport interface PipelineGate {\n /** What the gate is called in the settings list. */\n name?: string;\n /** The sentence a person reads when it stops them. Required: a refusal with no words is a dead end. */\n message: string;\n /** WHEN this gate is about this record at all. Absent means always. */\n when?: Record<string, unknown>;\n /** What has to hold. One condition node of the one Rule language. */\n demands: Record<string, unknown>;\n /** Default `refuse`. */\n on_fail?: StageRuleOnFail;\n}\n\n/**\n * THE ONE PLACE A SCREEN DECIDES WHETHER A CARD LOOKS DRAGGABLE — and it decides on the\n * PERSON, not on the rules. Whether a particular move is allowed is\n * `pipelineTransitionRefusal`, which is the store's answer; whether this person may move\n * anything at all is their level on the record, which the read door already told us.\n *\n * Absent rather than dead: a viewer's card carries no drag handle at all, instead of one\n * that looks live and snaps back every time.\n */\nexport function mayDrag(level: string | null | undefined): boolean {\n return level === \"editor\" || level === \"admin\" || level === \"owner\";\n}\n","// src/rule.ts — @ai-matrx/records\n//\n// THE RULE. REC-15 … REC-19. ONE object with FOUR uses — validate, compute,\n// define membership, decide applicability — and no fifth. A Rule references\n// Fields BY ID, never by name (REC-17), and it has versions, so History knows\n// which version produced a Value (REC-19).\n\nimport type { Timestamp, Uuid } from \"./record\";\nimport type { RuleNodeKind, RuleUse } from \"./vocabulary\";\n\n/**\n * A rule expression as `custom.rule_eval` ACTUALLY evaluates it — read off the\n * door's own body, not invented here. A leaf is the node's name carrying its\n * payload (`{\"const\": 3}`, `{\"field\": \"<uuid>\"}`); an operator is\n * `{\"op\": \"eq\", \"args\": [...]}`.\n *\n * `field` / `parent_field` name a Field BY ID (REC-17 — the door refuses\n * `field_name`, `field_key` and `field_label` by name), and `merge_field` is\n * the resolver's seam, storable today and refused `0A000` until W5-MERGE-B.\n *\n * `p_values` is keyed by the Field's KEY: the door resolves the id to a key\n * (`custom.rule_field_key`) and then reads `p_values -> key`.\n */\nexport type RuleExpression =\n | { const: unknown }\n | { field: Uuid }\n | { parent_field: Uuid }\n | { merge_field: string }\n | { op: RuleNodeKind; args: RuleExpression[] };\n\n/** REC-15. One Rule, four uses; a Rule may serve more than one. */\nexport interface Rule {\n id: Uuid;\n organization_id: Uuid;\n name: string;\n kind: string | null;\n /** The Table this Rule is scoped to. */\n scope_table_id: Uuid | null;\n uses: RuleUse[];\n validates: boolean;\n computes: boolean;\n defines_membership: boolean;\n /**\n * REC-16. An applicability Rule reads the record's own Values and its\n * parent's, ONE level up, and no further.\n */\n decides_applicability: boolean;\n applies_to_types: string[];\n use_types: string[];\n expr: RuleExpression;\n /** Which Field this Rule's answer is about (REC-17: by id). */\n target_field_id: Uuid | null;\n /** What a person reads when this Rule refuses. */\n message: string | null;\n sort: number | null;\n created_by: Uuid | null;\n updated_by: Uuid | null;\n created_at: Timestamp;\n updated_at: Timestamp;\n /** REC-19. Rules have versions, and History knows which one produced a Value. */\n version: number;\n metadata: Record<string, unknown>;\n visibility: string;\n}\n\n/** What the store answers when a Rule is run: the answer and the version that gave it. */\nexport interface RuleAnswer {\n rule_id: Uuid;\n rule_name: string;\n rule_version: number;\n applies: boolean;\n answer: unknown;\n}\n\n// ── PRODUCTS row 1: a form is a VIEW ON A REAL TABLE ─────────────────────────\n//\n// A form lives beside the Rules because that is what it is MADE of: an accept\n// Rule decides what counts as a complete answer, and a subscription Rule (DOOR-18)\n// decides who hears about one. The questions are Fields of the subject Table and\n// the answers are ordinary records in it — there is no form silo anywhere.\n\n/** One form as `custom.forms` reports it to its owner. */\nexport interface FormSummary {\n form_id: string;\n table_id: string;\n title: string | null;\n slug: string;\n published_at: string | null;\n closed_at: string | null;\n submission_cap: number | null;\n /** Every answer that arrived, rejected ones excluded from `in_table` and `held`. */\n responses: number;\n /** Answers that became records — the only number that means \"it is in the table\". */\n in_table: number;\n /** Answers waiting for a person, because the form's accept Rule did not clear them. */\n held: number;\n /** Answers the accept Rule or the decoy turned away. */\n rejected: number;\n /** draft · open · closed · full — the store's own word, never derived on a screen. */\n state: \"draft\" | \"open\" | \"closed\" | \"full\";\n quarantine_rule_id: string | null;\n notify_rule_id: string | null;\n presentation: Record<string, unknown>;\n}\n\n/**\n * ONE BOOKING PAGE, AS ITS OWNER SEES IT — `custom.bookings` (PRODUCTS row 14).\n *\n * A booking page is an `anon_form` whose `presentation -> 'booking'` carries the\n * availability and the id of a slots Table, so it is the SAME object a form is and\n * this is the same list `forms()` is, asked for the booking half. The numbers are\n * the store's own: a screen that counted appointments in the browser would drift\n * from the index that actually protects a slot.\n */\nexport interface BookingSummary {\n form_id: string;\n /** The Table the appointments land in — a booking is an ordinary record in it. */\n table_id: string;\n title: string | null;\n slug: string;\n published_at: string | null;\n closed_at: string | null;\n /** How long one appointment is. The offer is the store's, never the browser's. */\n slot_minutes: number;\n /** The organization's own zone, which is what the visitor's times are drawn in. */\n timezone: string;\n /** The ONE slots Table `custom.booking_declare` finds-or-makes for this page. */\n slot_table_id: string;\n booked: number;\n cancelled: number;\n /** Booked and still ahead of now — the number that answers \"what is coming\". */\n upcoming: number;\n /** Slots a visitor is holding right now, before they have given their details. */\n held: number;\n /** The next appointment, or null when there is none. */\n next_at: string | null;\n /** draft · open · closed — the store's own word, never derived on a screen. */\n state: string;\n}\n\n/**\n * ONE WINDOW OF AN ORGANIZATION'S WEEK, in the shape `custom._booking_availability`\n * normalises to and `custom._booking_slots` generates from. `weekday` is 0 for Sunday\n * and 6 for Saturday — the database's own numbering, so a picker and the store cannot\n * disagree about which day Monday is. A window may name ONE member, which is the \"with\n * whom\" of an appointment; naming somebody who is not a member is refused BY NAME.\n */\nexport interface BookingWindow {\n weekday: number;\n /** \"09:00\" */\n from: string;\n /** \"17:00\" — later in the day than `from`, or the store refuses it by name. */\n to: string;\n member_user_id?: string | null;\n}\n\n/**\n * WHAT IS ON OFFER. Every field is the store's to default: a page declared with an\n * empty availability comes back with the organization's timezone, a 30-minute slot and\n * Monday-to-Friday nine-to-five, because a booking page that offered nothing would look\n * broken rather than unconfigured. A screen shows what came BACK, never what it sent.\n */\nexport interface BookingAvailability {\n timezone: string;\n slot_minutes: number;\n /** Dead time kept after each appointment, so two never touch. */\n buffer_minutes: number;\n /** How far ahead of now the earliest bookable slot is. */\n lead_minutes: number;\n /** Most appointments in one day, across every window. */\n max_per_day: number;\n /** How many days ahead the page offers. */\n days: number;\n windows: BookingWindow[];\n}\n\n/**\n * WHAT `custom.booking_declare` ANSWERS. `availability` is the NORMALISED offer —\n * show that, not the draft — and `questions_filled_in` is how many questions the store\n * took over (`slot`, `status`, `booked_with`), which a visitor is never asked.\n *\n * It does NOT publish. `anonPublish` is still the one act that opens the link, exactly\n * as it is for a form, so there is one act and one word for opening a public surface.\n */\nexport interface BookingDeclared {\n form_id: string;\n slot_table_id: string;\n availability: BookingAvailability;\n questions_asked: number;\n questions_filled_in: number;\n ms: number;\n}\n\n/**\n * THE VISITOR'S OWN LINK to a booking page. The page id IS the capability, exactly\n * as it is for a form; `custom.anon_submission.booking_ref` is the separate secret\n * that lets ONE visitor manage the appointment they made.\n */\nexport function bookingPath(formId: string): string {\n return `/b/${formId}`;\n}\n\n/**\n * THE PUBLIC LINK, and the one place its shape is written down.\n *\n * The form's own id IS the capability — 122 bits of UUIDv4, exactly as\n * Typeform's form id in `/to/<id>` is and as an unguessable meeting slug is\n * here. There is no second secret to keep, and revoking it is closing the form.\n */\nexport function publicFormPath(formId: string): string {\n return `/f/${formId}`;\n}\n","// src/portal.ts — @ai-matrx/records\n//\n// THE CLIENT PORTAL, FROM THE OWNER'S SIDE.\n//\n// A portal is the one way somebody with no membership of an organization is\n// let in to see the records that name them — their jobs, their invoices —\n// and nothing else. The store holds it in three tables (`custom.portal`,\n// `custom.portal_table`, `custom.portal_principal`) and answers about it\n// through six doors. These are the shapes those doors answer with, written\n// from the doors' own bodies and never from a screen's convenience.\n//\n// TWO FACTS THIS FILE EXISTS TO KEEP STRAIGHT, because a screen that gets\n// either of them wrong tells somebody a comforting lie:\n//\n// · AN INVITATION CONFERS NOTHING. `custom.portal_invite` writes a row and\n// says so in its own `say` sentence: the person gets access the moment\n// they follow the sign-in link and the platform gives them an identity,\n// and until then the row holds nothing at all. That is why\n// `PortalPrincipal` carries `signed_in` separately from `is_active` —\n// \"invited\" and \"can see their records\" are two different states and one\n// number for both is how an owner comes to believe a client is looking at\n// something they cannot reach.\n//\n// · \"VIEW AS THIS CLIENT\" IS NOT A PORTAL-SHAPED QUERY.\n// `custom.portal_preview` asks `custom.visible_set` for HER user id — the\n// exact call `custom.read_records` makes when she opens the page — so the\n// preview cannot disagree with what she sees. When she has not signed in\n// yet it REFUSES with `02000` and a sentence, rather than answering an\n// empty list that would read as \"she sees nothing\".\n\nimport type { Timestamp, Uuid } from \"./record\";\n\n/** One portal as `custom.portals` reports it to its organization. */\nexport interface PortalSummary {\n portal_id: Uuid;\n title: string;\n slug: string;\n /** The Table whose records ARE the clients. A principal is one of its rows. */\n client_table_id: Uuid;\n /** That Table's name, so a list never has to read a second door to draw a row. */\n client_table: string;\n is_active: boolean;\n /** How many Tables this portal exposes. */\n tables: number;\n /** Everybody invited and not revoked — NOT everybody who can see anything. */\n invited: number;\n /** Of those, how many have followed the link and hold an identity. */\n signed_in: number;\n /** `magic_link` today, and the door refuses every other word by name. */\n sign_in_method: string;\n opened_at: Timestamp | null;\n}\n\n/**\n * ONE (portal, Table) PAIR, as `custom.portal_tables` reports it.\n *\n * 🚨 WHY THIS EXISTS (TAILS-3, 2026-09-21). The Portals rail sits on a Table's\n * page beside Forms, Bookings and Dashboards — all table-scoped — while\n * `custom.portals` takes no table at all. On Rincon Plumbing Co's **Parts**\n * table the rail read \"Portals 10\" and listed ten cards titled \"Your jobs and\n * invoices\", which belong to **Jobs**; the empty state never rendered, so the\n * \"Build it / Ask an agent\" offer was unreachable on EVERY table of any\n * organization that already had one portal.\n *\n * This is the whole of what a table-scoped rail needs: is the table I am\n * standing on in any portal, and if not, which portals could take it.\n */\nexport interface PortalTableRef {\n portal_id: Uuid;\n table_id: Uuid;\n /** That Table's name, so a rail never reads a second door to draw a row. */\n name: string;\n}\n\n/** One Table a portal exposes, as `custom.portal_card` reports it. */\nexport interface PortalTableExposure {\n table_id: Uuid;\n /** The Table's own name. */\n name: string;\n /**\n * The key of the relation Field that says WHOSE a record is. This is the\n * whole of \"only theirs\": the association that Field writes is what carries\n * the record to the client, so a portal cannot exist without one.\n */\n names_via: string;\n /** The field keys a client sees. Empty is impossible — the door fills it. */\n visible_fields: string[];\n /** The subset a client may change. Always a subset of `visible_fields`. */\n editable_fields: string[];\n comments: boolean;\n /**\n * The most a client is ever conveyed on this Table — `viewer`, `commenter`\n * or `editor` — worked out by the door from the two lists above, never by a\n * screen.\n */\n conveys: string;\n}\n\n/** One person a portal was opened to, as `custom.portal_card` reports them. */\nexport interface PortalPrincipal {\n principal_id: Uuid;\n email: string;\n /** The record of the client Table this person IS, for the portal's purposes. */\n client_record_id: Uuid;\n /** That record's title — what an owner calls this client. */\n client: string;\n /** They followed the link and hold an identity. Until then this is false. */\n signed_in: boolean;\n /** Not revoked. An invitation that was never followed is still active. */\n is_active: boolean;\n invited_at: Timestamp;\n revoked_at: Timestamp | null;\n /**\n * THE LINK THE OFFICE COPIES FOR THIS PERSON — `/invitations/portal/accept/<token>`, the\n * path `custom.portal_invite` handed back when they were asked, read off the same\n * `iam.invitations` row and never re-templated.\n *\n * 🚨 `null` IS AN ANSWER, NOT AN ABSENCE, and a screen must say which. It is null when they\n * have already followed the link, when the office took it back (a revoke withdraws the\n * invitation in the same statement), when it has expired, or when they were let in through\n * the server's own magic-link route, which binds without an invitation at all. In every one\n * of those cases there is genuinely no link to copy — so draw a sentence, never a dead\n * control. (TAILS-5, 2026-09-21; the gap PORTAL-BIND left named.)\n */\n accept_path: string | null;\n}\n\n/** Everything about ONE portal: what it shows, and who it was opened to. */\nexport interface PortalCard {\n portal_id: Uuid;\n title: string;\n slug: string;\n is_active: boolean;\n sign_in_method: string;\n client_table_id: Uuid;\n tables: PortalTableExposure[];\n principals: PortalPrincipal[];\n /**\n * Whether this organization's outside lane is open\n * (`custom/external_principal_enabled`). Declaring a portal opens it; while\n * it is false every door refuses an outsider BY NAME, and a screen that drew\n * the people as reachable anyway would be lying about the one thing that\n * decides whether they can sign in at all.\n */\n external_lane_open: boolean;\n}\n\n/** What `custom.portal_invite` answers. `say` is the door's own sentence. */\nexport interface PortalInvitation {\n invited: boolean;\n principal_id: Uuid;\n portal_id: Uuid;\n slug: string;\n email: string;\n client_record_id: Uuid;\n client: string;\n /** They already hold an identity. From a screen this is false: the door is passed no user. */\n bound: boolean;\n /**\n * The door's own words, and the ONLY correct summary of what just happened —\n * it says outright that an invitation confers nothing until the link is\n * followed. Show it; never paraphrase it.\n */\n say: string;\n}\n\n/** What `custom.portal_revoke` answers. `say` names the consequence, past tense. */\nexport interface PortalRevocation {\n revoked: boolean;\n principal_id: Uuid;\n email: string;\n /** The door's own sentence: they can no longer sign in, and their records stop reaching them. */\n say: string;\n}\n\n/** One row of \"what this client sees\", from `custom.portal_preview`. */\nexport interface PortalPreviewRow {\n record_id: Uuid;\n title: string;\n}\n\n/**\n * THE PUBLIC ADDRESS OF A PORTAL, and the one place its shape is written down.\n *\n * Unlike a form's link, a portal's slug is NOT the capability: the page it\n * serves asks who you are and emails a one-time link, so the slug is a name and\n * nothing more. That is why it is readable and why copying it is safe.\n */\nexport function portalPath(slug: string): string {\n return `/portal/c/${slug}`;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// A PORTAL IS ARCHIVED, NEVER DELETED (ORG-CLEANUP, 2026-09-22)\n//\n// The store grew `custom.portal_archive`, `custom.portal_restore` and the\n// archive-aware `custom.list_portals` because Rincon Plumbing Co carried TEN\n// portals all titled \"Your jobs and invoices\" — nine of them the residue of one\n// walk repeated nine times — and there was no door to put any of them away.\n// `is_active = false` is not it: CLOSED is a state an organization chooses about\n// a portal it still has, and its clients are told so by name. ARCHIVED means it\n// is out of the way, and nothing is deleted: every exposed Table and every\n// invited person is handed back exactly as it was.\n//\n// These are the words a screen says about that, written once here so the rail,\n// the guard and any other client say the same thing.\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * The platform archive filter's own three values, and no fourth. `custom.list_portals`\n * refuses anything else with `22023` rather than quietly treating it as one of them.\n */\nexport const PORTAL_ARCHIVE_FILTERS = [\"active\", \"archived\", \"all\"] as const;\nexport type PortalArchiveFilter = (typeof PORTAL_ARCHIVE_FILTERS)[number];\n\n/** THE LAW'S DEFAULT IS TO HIDE. A list nobody narrowed is the live things. */\nexport const DEFAULT_PORTAL_ARCHIVE_FILTER: PortalArchiveFilter = \"active\";\n\nexport function isPortalArchiveFilter(word: unknown): word is PortalArchiveFilter {\n return typeof word === \"string\" && (PORTAL_ARCHIVE_FILTERS as readonly string[]).includes(word);\n}\n\n/** What `custom.portal_archive` and `custom.portal_restore` answer with. */\nexport interface PortalArchiveAnswer {\n /** Where the portal stands NOW — true after an archive, false after a restore. */\n archived: boolean;\n /** False when it was already in that state; the sentence says so rather than lying about an act. */\n changed: boolean;\n portal_id: Uuid;\n archived_at?: Timestamp | null;\n /** The store's own sentence, in plain English. Show it verbatim; never a constraint name. */\n sentence: string;\n}\n\n/**\n * THE CONSEQUENCE, SAID BEFORE THE CLICK — never a generic \"are you sure?\".\n *\n * What actually changes is two things: nobody can sign in to it any more, and it\n * leaves the organization's portal list. What does NOT change is everything\n * else, and saying so is the difference between an archive somebody dares to\n * press and one they avoid.\n */\nexport function portalArchiveConsequence(title: string, signedIn: number, invited: number): string {\n const people =\n invited === 0\n ? \"Nobody is invited to it\"\n : signedIn === 0\n ? `The ${invited} ${invited === 1 ? \"person\" : \"people\"} invited to it will not be able to sign in`\n : `The ${signedIn} ${signedIn === 1 ? \"person\" : \"people\"} signed in to it, and the ${invited - signedIn} still invited, will not be able to sign in`;\n return (\n `“${title}” will leave your portal list. ${people}, and their invitation links will say this ` +\n `portal was archived and can be restored. Nothing is deleted — every Table it shows and ` +\n `everyone invited to it is kept exactly as it is, and you can restore it at any time.`\n );\n}\n\n/**\n * WHY THE TITLE HAS TO BE TYPED BACK, in the store's own reasoning. Ten portals\n * can carry one title, so the title is not what PICKS this one — the portal you\n * opened is. Typing it back is how you say you meant this one.\n */\nexport function portalConfirmLine(title: string): string {\n return `Type the portal’s title — ${title} — to confirm you mean this one.`;\n}\n\n/** True when what the person typed is what the door will accept. The door decides; this only spares them a round trip. */\nexport function portalTitleTypedBack(typed: string, title: string): boolean {\n return typed.trim() === (title ?? \"\").trim();\n}\n\n/**\n * WHAT AN EMPTY ARCHIVE LANE SAYS. An empty list is an answer: it says nothing\n * has been archived, so \"none here\" can never be read as \"the archive is broken\"\n * or as \"this organization has no portals at all\".\n */\nexport function emptyPortalArchiveLine(): string {\n return \"No portal of this organization has been archived. A portal you put away waits here until somebody restores it, and nothing is ever destroyed.\";\n}\n","// src/aggregate.ts — @ai-matrx/records\n//\n// THE EIGHTH VERB (AGT-N-8). `custom.record_aggregate` groups, buckets, filters\n// and measures INSIDE the read door's own query: the aggregate node sits above\n// the join to `custom.query_visible_ids`, so a chart is computed over the rows\n// this principal may see and the rest are never fetched at all.\n//\n// That is why a chart in this platform is not \"read everything, then sum in the\n// browser\". Summing in the browser would either read rows a person may not see\n// or quietly under-count them, and both of those are a screen telling a lie.\n\n/** The measures the store offers. Asked of `custom.agg_operations()` at run time too. */\nexport type AggregateOperation =\n | \"count\" | \"sum\" | \"avg\" | \"min\" | \"max\"\n /** GRID-PRIMITIVES G1: the summary bar's other four. Blank = no value, JSON null or \"\". */\n | \"median\" | \"filled\" | \"empty\" | \"unique\";\n\n/** The periods a date Field can be bucketed into (`custom.agg_buckets()`). */\nexport type AggregateBucket = \"day\" | \"week\" | \"month\" | \"quarter\" | \"year\";\n\n/**\n * A HALF-OPEN MOMENT WINDOW: `from` is inclusive, `to` is exclusive. Half-open\n * is the only shape that makes \"September\" and \"October\" meet exactly once —\n * an inclusive `to` either double-counts the boundary moment or drops it,\n * depending on the reader, and both of those are a chart telling a lie.\n */\nexport interface AggregateWindow {\n from?: string | null;\n to?: string | null;\n}\n\n/**\n * ONE FILTER VALUE, as `custom.record_aggregate` and `custom.dashboard_run`\n * both read it: a SCALAR is an equality, and an OBJECT is a window. It is not\n * `unknown` on purpose — a filter value the store cannot read is a refusal a\n * caller should get from the compiler, not from the database.\n */\nexport type AggregateFilter = string | number | boolean | null | AggregateWindow;\n\n/**\n * 🚨 THE STORE'S ONE FILTER SHAPE, AND THE ONLY NAME FOR IT.\n *\n * An object of Field key -> value. A scalar is an equality, `null` is UNSET\n * (the third state of a tick box), an object is a half-open time window.\n *\n * It is not the aggregate's private shape and never was. `platform.saved_view`\n * has carried exactly this as `definition -> 'filters'` across five live\n * surface keys since DOOR-18; `custom.view_declare` writes it;\n * `custom.agg_view_admits` reads it to decide whether a change belongs to a\n * saved view; `custom.record_aggregate` takes it as `p_filter` to COMPUTE a\n * dashboard number; and `custom.read_records_matching` takes it to OPEN the\n * rows behind that number. One `custom.record_filter_sql` in the database turns\n * it into SQL for the last two, so the number and the rows cannot disagree.\n *\n * Invent a second one and a chart can compute a total whose drill-through\n * lands somewhere else, which is the only way a drill-through can lie.\n */\nexport type RecordFilter = Record<string, AggregateFilter>;\n\n/** One measure. `count` counts rows and needs no Field; the rest read one. */\nexport interface AggregateMeasure {\n op: AggregateOperation;\n /** The Field's key. Required for every operation except `count`. */\n key?: string;\n}\n\n/**\n * One row of an aggregate: which group it is, what each measure came to, and\n * how many records it was worked out from. The measure keys are the store's\n * own (`count`, `sum_amount`, `avg_amount`, …), never renamed on the way out.\n */\nexport interface AggregateRow {\n groups: Record<string, string | null>;\n measures: Record<string, number | null>;\n row_count: number;\n}\n\n/** The measure key the store answers with, so a chart can find its own series. */\nexport function measureKey(measure: AggregateMeasure): string {\n return measure.op === \"count\" ? \"count\" : `${measure.op}_${measure.key ?? \"\"}`;\n}\n\n/**\n * THE QUESTION, AS A STABLE STRING — key-sorted JSON of a `RecordFilter`.\n *\n * A React parent that rebuilds `{ status: \"Cancelled\" }` on every render hands\n * a NEW object every time, and a hook that depends on the object re-reads the\n * whole page on every render forever. Depending on this instead means the page\n * is re-read exactly when the QUESTION changed, which is what a person means.\n *\n * Nested window objects are sorted too, so `{from, to}` and `{to, from}` are\n * one question. `undefined` and an empty filter are both `\"{}\"` — the caller\n * asked nothing, and there is only one way to ask nothing.\n */\nexport function stableFilterKey(filter: RecordFilter | null | undefined): string {\n if (!filter) return \"{}\";\n const keys = Object.keys(filter).sort();\n if (keys.length === 0) return \"{}\";\n const parts = keys.map((key) => {\n const value = filter[key];\n if (value !== null && typeof value === \"object\") {\n const window = value as AggregateWindow;\n return `${JSON.stringify(key)}:{\"from\":${JSON.stringify(window.from ?? null)},\"to\":${JSON.stringify(window.to ?? null)}}`;\n }\n return `${JSON.stringify(key)}:${JSON.stringify(value ?? null)}`;\n });\n return `{${parts.join(\",\")}}`;\n}\n","// src/grid.ts — @ai-matrx/records\n//\n// THE GRID'S STORE PRIMITIVES (lane GRID-PRIMITIVES, 2026-09-22).\n//\n// The /data grid is being rebuilt on the record store with its UI and behaviour unchanged. The\n// older grid kept five things the store could not say; each is now a door, and these are the\n// shapes those doors answer:\n//\n// G1 a Table's colors (row color by a choice column, ordered color rules, hand highlights),\n// its layout (organization default + per-view override) and the summary bar's nine\n// measures → custom.table_decorate / table_decorations,\n// custom.grid_layout, custom.record_aggregate\n// G2 row actions, run on a whole selection in one transaction\n// → custom.action_declare / row_actions / action_run\n// G3 the formula language a person types, worked out by the store\n// → custom.formula_parse (+ formula_text on a Field)\n// G4 every record change out to a signed webhook\n// → custom.table_webhook_declare / table_webhooks /\n// table_webhook_archive\n// G5 autonumber / created / modified time columns, display formats, example tables, Excel\n// → field kinds, custom.autonumber_backfill,\n// custom.table_from_example, custom.io_export\n//\n// Fields and records are named BY ID everywhere here (REC-17): a column renamed keeps its\n// color, its width and its place in a formula.\n\nimport type { Uuid } from \"./record\";\nimport type { RecordsError } from \"./results\";\nimport type { UseCase } from \"./use-cases/types\";\n\n// ── G1: colors ──────────────────────────────────────────────────────────────────────────\n\n/** `custom.decoration_colors()` — the palette, in the order an uncolored choice takes. */\nexport type DecorationColor = \"slate\" | \"green\" | \"amber\" | \"red\" | \"blue\" | \"violet\" | \"teal\";\n\n/** `custom.decoration_rule_ops()` — the tests a color rule may ask. */\nexport type DecorationRuleOp =\n | \"is\" | \"is_not\" | \"contains\" | \"is_empty\" | \"not_empty\" | \"is_true\" | \"is_false\"\n | \"gt\" | \"gte\" | \"lt\" | \"lte\";\n\nexport type DecorationTarget = \"row\" | \"cell\";\n\nexport interface DecorationRule {\n /** Given by the store when omitted; keep it to edit the rule in place. */\n id?: string;\n /** The Field id the rule reads. */\n field: Uuid;\n op: DecorationRuleOp;\n /** Compared as text for is / is_not / contains, as a number for gt / gte / lt / lte. */\n value?: string | number;\n color: DecorationColor;\n target: DecorationTarget;\n}\n\nexport interface TableDecorations {\n version: 1;\n colors: DecorationColor[];\n rule_ops: Array<{ op: DecorationRuleOp; takes_value: boolean; label: string }>;\n color_by?: { field: Uuid; target: DecorationTarget };\n rules: DecorationRule[];\n /** Hand highlights: record id → color. */\n rows: Record<Uuid, DecorationColor>;\n /** Hand highlights: Field id → color. */\n columns: Record<Uuid, DecorationColor>;\n /** Hand highlights: record id → Field id → color. */\n cells: Record<Uuid, Record<Uuid, DecorationColor>>;\n /** What stopped painting because its column is gone — said, never silently dropped. */\n stale: Array<{ part: string; field?: Uuid; rule_id?: string; record_id?: Uuid; says: string }>;\n}\n\n/**\n * ONE LEAF of a Table's colors — the older door's own path shape\n * (`public.udt_set_table_style`), so two people highlighting two rows never overwrite each other.\n */\nexport type DecorationPath =\n | [\"color_by\"]\n | [\"rules\"]\n | [\"rows\", Uuid]\n | [\"columns\", Uuid]\n | [\"cells\", Uuid, Uuid];\n\n// ── G1: layout ──────────────────────────────────────────────────────────────────────────\n\nexport type GridLayoutMode = \"auto\" | \"fit\" | \"scroll\";\nexport type GridRowHeight = \"compact\" | \"normal\" | \"tall\";\n\n/** A saved view's own grid choices, kept at `definition.grid` (custom.view_declare judges them). `definition.layout` is the view's KIND (grid / kanban / calendar / gallery), never these. */\nexport interface ViewLayout {\n mode?: GridLayoutMode;\n row_height?: GridRowHeight;\n freeze_first_column?: boolean;\n wrap?: boolean;\n /** Field id → pixels, 60–1200. */\n widths?: Record<Uuid, number>;\n}\n\nexport interface GridLayout {\n layout: Required<Omit<ViewLayout, \"widths\">> & { fit_max_columns: number; widths?: Record<Uuid, number> };\n /** Where each choice came from. */\n source: Record<string, \"platform\" | \"organization\" | \"view\">;\n view_id: Uuid | null;\n /** A stored choice the grid cannot honour, named. */\n refused: Array<{ from: \"organization\" | \"view\"; choice: string; value: unknown; says: string }>;\n}\n\n// ── G2: row actions ─────────────────────────────────────────────────────────────────────\n\nexport type RowActionStep =\n | { field: Uuid; set: \"value\"; value: unknown }\n | { field: Uuid; set: \"clear\" }\n /** Worked out by the store on each record: the older grid's formula text, or an expression. */\n | { field: Uuid; set: \"compute\"; formula_text?: string; expr?: Record<string, unknown> };\n\nexport interface RowAction {\n /** Given by the store when omitted. */\n id?: Uuid;\n name: string;\n kind?: \"update\" | \"agent\";\n color?: DecorationColor | null;\n icon?: string;\n /** Ask before running. */\n confirm?: boolean;\n steps?: RowActionStep[];\n /** `agent` only: what the record chat opens with. */\n prompt?: string;\n /** On read: whether custom.action_run can run it. */\n runnable?: boolean;\n}\n\nexport interface ActionRunResult {\n action_id: Uuid;\n action: string;\n table_id: Uuid;\n ran: number;\n records: Array<{ record_id: Uuid; version: number }>;\n}\n\n/** One record (and, when it can be named, one field) that refused a row action. */\nexport interface ActionRefusal {\n record_id: Uuid;\n record: string | null;\n field_id: Uuid | null;\n field: string | null;\n code?: string;\n says: string;\n}\n\n/**\n * Every refusal of an action run, read off the store's refusal. A run that any record refused\n * changed NOTHING; this is the list a screen shows so the person can fix those and run again.\n */\nexport function actionRefusals(error: RecordsError): ActionRefusal[] {\n return Array.isArray(error.detail) ? (error.detail as ActionRefusal[]) : [];\n}\n\n// ── G3: formulas ────────────────────────────────────────────────────────────────────────\n\nexport type FormulaParse =\n | {\n ok: true;\n text: string;\n /** The store's expression shape — what `config.expr` holds. */\n expr: Record<string, unknown>;\n references: Array<{ name: string; field_id: Uuid }>;\n result_type: \"number\" | \"text\" | \"boolean\" | \"date\" | \"unknown\";\n }\n | { ok: false; text: string; error: string; position: number };\n\n// ── G4: webhooks ────────────────────────────────────────────────────────────────────────\n\nexport type RecordEvent = \"record.created\" | \"record.updated\" | \"record.archived\" | \"record.restored\" | \"record.purged\";\n\nexport interface TableWebhookDeclared {\n webhook_id: Uuid;\n table_id: Uuid;\n target_url: string;\n events: RecordEvent[];\n /** Shown this once: X-Matrx-Signature is sha256=HMAC-SHA256(secret, body). */\n secret: string;\n says: string;\n}\n\nexport interface TableWebhook {\n webhook_id: Uuid;\n target_url: string;\n description: string | null;\n events: RecordEvent[] | null;\n is_active: boolean;\n last_attempt_at: string | null;\n last_success_at: string | null;\n consecutive_failures: number;\n owner_id: Uuid;\n created_at: string;\n}\n\n// ── G5: examples, export ────────────────────────────────────────────────────────────────\n\n/** What `custom.table_from_example` builds from. */\nexport interface ExampleSpec {\n business: string;\n tables: Array<Record<string, unknown>>;\n}\n\nexport interface ExampleBuilt {\n business: string;\n tables: Array<{ token: string; table_id: Uuid; name: string; records?: number; note?: string }>;\n says: string;\n}\n\n/**\n * ONE REAL USE CASE → the example door's spec. The use case is validated by this package's own\n * suite (`use-cases/validate.ts`); the door refuses placeholder names again as a second line.\n */\nexport function exampleSpec(useCase: UseCase): ExampleSpec {\n return {\n business: useCase.business.name,\n tables: useCase.tables.map((t) => ({\n token: t.token,\n name: t.name,\n labelSingular: t.labelSingular,\n labelPlural: t.labelPlural,\n type: t.type,\n display: t.display,\n weight: t.weight,\n ordered: t.ordered,\n titleField: t.titleField,\n describes: t.describes,\n fields: t.fields.map((f) => ({\n key: f.key,\n label: f.label,\n parityType: f.parityType,\n multi: f.multi,\n dated: f.dated,\n required: f.required,\n unit: f.unit ?? undefined,\n rules: f.rules,\n choices: f.choices,\n source: f.source,\n computeOn: f.computeOn,\n relationTarget: f.relationTarget,\n relationMax: f.relationMax,\n sensitivity: f.sensitivity,\n contextPolicy: f.contextPolicy,\n })),\n rows: t.rows,\n })),\n };\n}\n\n/** One page of `custom.io_export`: exactly what the read door serves this person. */\nexport interface IoExportPage {\n table_id: Uuid;\n token: string;\n columns: string[];\n rows: Array<Record<string, unknown>>;\n /** A column the store withheld from this reader, with the store's reason. */\n withheld: Record<string, unknown>;\n page: { requested: number; returned: number; ceiling: number; next: number | null };\n choices: unknown;\n}\n\nfunction exportCellText(value: unknown): string | number | boolean {\n if (value === null || value === undefined) return \"\";\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") return value;\n return JSON.stringify(value);\n}\n\n/**\n * THE .XLSX OF AN EXPORT PAGE. Numbers stay numbers and booleans stay booleans in the sheet; a\n * column the store withheld is NAMED on a second sheet with the store's reason, so a person\n * never mistakes a withheld column for an empty one. `labels` maps a column key to its header\n * (the Field's label); a key with no label is its own header.\n */\nexport async function exportPageXlsx(\n page: IoExportPage,\n labels: Record<string, string> = {},\n sheetLabel = \"Records\",\n): Promise<Uint8Array> {\n const XLSX = await import(\"xlsx\");\n const header = page.columns.map((c) => labels[c] ?? c);\n const body = page.rows.map((row) => page.columns.map((c) => exportCellText(row[c])));\n const workbook = XLSX.utils.book_new();\n const name = sheetLabel.replace(/[\\\\/?*[\\]:]/g, \" \").trim().slice(0, 31) || \"Records\";\n XLSX.utils.book_append_sheet(workbook, XLSX.utils.aoa_to_sheet([header, ...body]), name);\n const withheld = Object.entries(page.withheld ?? {});\n if (withheld.length > 0) {\n XLSX.utils.book_append_sheet(\n workbook,\n XLSX.utils.aoa_to_sheet([\n [\"Column\", \"Why it is empty in this export\"],\n ...withheld.map(([k, v]) => [labels[k] ?? k, typeof v === \"string\" ? v : JSON.stringify(v)]),\n ]),\n \"Withheld columns\",\n );\n }\n if (page.page?.next !== null && page.page?.next !== undefined) {\n XLSX.utils.book_append_sheet(\n workbook,\n XLSX.utils.aoa_to_sheet([[\n `This file holds the first ${page.page.returned} rows. The table has more; export again from row ${page.page.next + 1}.`,\n ]]),\n \"More rows\",\n );\n }\n return XLSX.write(workbook, { type: \"array\", bookType: \"xlsx\", compression: true }) as Uint8Array;\n}\n\n// ── G8: \"when a row changes, run an agent\" on a record-store table ──────────────────────\n\n/** A record-store row event, as the activity spine carries it (and a schedule matches it). */\nexport type RecordChangeAction = RecordEvent;\n\n/**\n * THE SCHEDULE TRIGGER for \"when a row of this record-store table changes, run …\" — the same\n * `event` trigger the older store's tables use, pointed at this store's events:\n * `entity_type` `custom_record:<table id>`, actions `record.*`, `changed_fields` by column KEY.\n * `scheduler.sch_match_event` matches it against the event\n * `custom._record_events_to_activity` writes (GRID-PRIMITIVES G8), so one matcher serves both\n * stores. Omit `actions` to hear every change; omit `changedFields` to hear every column.\n */\nexport function recordChangeTrigger(\n tableId: Uuid,\n options: { actions?: RecordChangeAction[]; changedFields?: string[] } = {},\n): {\n type: \"event\";\n entity_type: string;\n table_id: Uuid;\n actions?: RecordChangeAction[];\n changed_fields?: string[];\n} {\n return {\n type: \"event\",\n entity_type: `custom_record:${tableId}`,\n table_id: tableId,\n ...(options.actions && options.actions.length > 0 ? { actions: options.actions } : {}),\n ...(options.changedFields && options.changedFields.length > 0 ? { changed_fields: options.changedFields } : {}),\n };\n}\n","// src/capture-queue.ts — @ai-matrx/records · PRODUCTS row 15, primitive P13\n//\n// THE QUEUE THAT MAKES A PHONE WITH NO BARS AS GOOD AS A PHONE WITH FIVE.\n//\n// Fulcrum's field client is the bar: a crew captures all day in a yard with no signal and\n// nothing is lost, nothing is doubled, and nobody has to think about it. Four decisions\n// carry that, and each one is a thing this file refuses to do rather than a feature:\n//\n// 1. THE CAPTURE IS WRITTEN TO DISK BEFORE THE NETWORK IS EVEN ASKED. `enqueue` returns\n// after IndexedDB has the answers AND the photograph's bytes. A queue that holds\n// captures in memory until it can send them loses the day when the screen locks.\n//\n// 2. THE IDEMPOTENCY KEY IS MINTED WHEN THE CAPTURE IS TAKEN, NOT WHEN IT IS SENT. It is\n// the row's own primary key here and `p_client_key` at the door. A lost acknowledgement\n// — the commonest failure on a bad signal, because the write SUCCEEDED and the answer\n// never came back — is then a replay that returns the first record's id, not a second\n// bin.\n//\n// 3. THEY GO UP IN THE ORDER THEY HAPPENED, ONE AT A TIME. A crew's day is a sequence and\n// a foreman reads it as one. Parallel uploads would also mean six photographs sharing\n// one thin signal and all six timing out.\n//\n// 4. A REFUSAL IS NOT A RETRY. A required answer missing, a field the sheet does not ask\n// for, a level the person does not hold — the door has decided, and sending it again\n// every thirty seconds forever is how a queue becomes a silent hole. The item stays,\n// marked `refused`, carrying the door's own sentence for the screen to show. The person\n// fixes it or throws it away; nothing decides that for them.\n//\n// The bytes never go through this file twice: `uploadFile` is called once per file and its\n// reference is written back into the queued row, so a retry after a failed SUBMIT re-sends\n// the reference rather than the photograph.\n\nimport type { CaptureFileRef, CaptureOutcome } from \"./capture\";\n\n/** One file waiting to go up, with its bytes until they have. */\nexport interface QueuedCaptureFile {\n field: string;\n name: string;\n mime_type: string;\n size_bytes: number;\n duration_ms?: number | null | undefined;\n /** The bytes. Dropped once `uploaded` is set, so the queue does not hold them twice. */\n blob?: Blob | null | undefined;\n /** Set once the platform's byte store has them. */\n uploaded?: { file_id?: string | null | undefined; url?: string | null | undefined } | null | undefined;\n}\n\n/** `waiting` → `sending` → `landed`, or `refused` when the door has decided. */\nexport type QueuedCaptureState = \"waiting\" | \"sending\" | \"landed\" | \"refused\";\n\nexport interface QueuedCapture {\n /** Minted on the phone when the capture was taken. The row's key AND the door's. */\n client_key: string;\n organization_id: string;\n sheet_id: string;\n sheet_title?: string | undefined;\n answers: Record<string, unknown>;\n files: QueuedCaptureFile[];\n device: string | null;\n /** The moment the PHONE took it — never the moment the signal came back. */\n captured_at: string;\n location: Record<string, unknown> | null;\n state: QueuedCaptureState;\n attempts: number;\n /** The door's own words, or the network's. Always something a person can act on. */\n last_error: string | null;\n record_id: string | null;\n replayed: boolean;\n queued_at: string;\n landed_at: string | null;\n}\n\nexport interface CaptureQueueCounts {\n waiting: number;\n sending: number;\n refused: number;\n landed: number;\n}\n\n/** What one pass of `sync` did, item by item. Never a single boolean. */\nexport interface CaptureSyncReport {\n attempted: number;\n landed: number;\n replayed: number;\n refused: number;\n deferred: number;\n outcomes: Array<{\n client_key: string;\n state: QueuedCaptureState;\n record_id: string | null;\n replay: boolean;\n says: string | null;\n }>;\n /** Set when the pass stopped early because the network went away again. */\n stopped_because?: string;\n}\n\n/** The two calls the queue makes on the outside world. Injected, so this file is headless. */\nexport interface CaptureQueuePorts {\n /** Put the bytes in the platform's ONE byte store and answer with the reference. */\n uploadFile(\n file: QueuedCaptureFile,\n item: QueuedCapture,\n ): Promise<{ file_id?: string | null; url?: string | null }>;\n /** `client.captureSubmit`. */\n submit(args: {\n sheet_id: string;\n client_key: string;\n answers: Record<string, unknown>;\n files: CaptureFileRef[];\n device?: string | null;\n captured_at?: string | null;\n location?: Record<string, unknown> | null;\n }): Promise<{ ok: boolean; data?: CaptureOutcome | null; error?: { message?: string; code?: string } | null }>;\n}\n\n/** The smallest store the queue needs. IndexedDB in a browser, a Map in a test. */\nexport interface CaptureQueueStore {\n all(): Promise<QueuedCapture[]>;\n put(item: QueuedCapture): Promise<void>;\n remove(clientKey: string): Promise<void>;\n meta(key: string): Promise<string | null>;\n setMeta(key: string, value: string): Promise<void>;\n}\n\nconst DB_NAME = \"matrx-capture\";\nconst DB_VERSION = 1;\nconst ITEMS = \"captures\";\nconst META = \"meta\";\n\n/**\n * THE TWO REFUSALS WORTH REPEATING, and they are the package's own list, not a guess.\n * `results.ts` says it in as many words: `stale_read` (40001) and `timed_out` (57014) are\n * \"the only two refusals in this list worth repeating\"; `store_limit` (53400) is the third\n * — the store ran out of something and the same call works in a quieter moment.\n *\n * EVERYTHING ELSE THE DOOR NAMES IS A DECISION. This was the other way round until a real\n * browser ran it (2026-09-20): the check listed SQLSTATEs, and `RecordsClient` hands back\n * its own WORD — `invalid_argument`, `door` — with the sqlstate beside it. So a capture the\n * store had refused by name was filed as a hiccup and queued again forever, which is the\n * exact silent hole this file's decision 4 exists to prevent. The unit suite passed because\n * it fed the check SQLSTATEs: it was testing the assumption, not the client.\n */\nexport const REFUSALS_WORTH_REPEATING: ReadonlySet<string> = new Set([\n \"stale_read\", \"timed_out\", \"store_limit\",\n]);\nconst SQLSTATES_WORTH_REPEATING: ReadonlySet<string> = new Set([\"40001\", \"57014\", \"53400\"]);\n\n/**\n * Did the door DECIDE, or did the attempt merely fail? A failure with no code at all is a\n * network failure and waits; a refusal the store named is a decision and stays.\n */\nexport function isDecided(\n error: { code?: string | null; sqlstate?: string | null } | null | undefined,\n): boolean {\n if (!error) return false;\n const { code, sqlstate } = error;\n if (code && REFUSALS_WORTH_REPEATING.has(code)) return false;\n if (sqlstate && SQLSTATES_WORTH_REPEATING.has(sqlstate)) return false;\n return !!(code || sqlstate);\n}\n\n/**\n * A key that is unique on a phone that has been offline for a day and has never spoken to\n * a server. `crypto.randomUUID` where it exists; otherwise random bytes, and only then the\n * clock — because two captures in the same millisecond on two phones is exactly the case\n * that must not collide.\n */\nexport function mintClientKey(): string {\n const c: Crypto | undefined = typeof crypto !== \"undefined\" ? crypto : undefined;\n if (c && typeof c.randomUUID === \"function\") return `cap-${c.randomUUID()}`;\n if (c && typeof c.getRandomValues === \"function\") {\n const b = c.getRandomValues(new Uint8Array(16));\n return `cap-${Array.from(b, (x) => x.toString(16).padStart(2, \"0\")).join(\"\")}`;\n }\n return `cap-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;\n}\n\n/** The IndexedDB store. Returns null where there is no IndexedDB at all. */\nexport function indexedDbStore(name = DB_NAME): CaptureQueueStore | null {\n const idb: IDBFactory | undefined =\n typeof globalThis !== \"undefined\" ? (globalThis as { indexedDB?: IDBFactory }).indexedDB : undefined;\n if (!idb) return null;\n\n const open = (): Promise<IDBDatabase> =>\n new Promise((resolve, reject) => {\n const req = idb.open(name, DB_VERSION);\n req.onupgradeneeded = () => {\n const db = req.result;\n if (!db.objectStoreNames.contains(ITEMS)) db.createObjectStore(ITEMS, { keyPath: \"client_key\" });\n if (!db.objectStoreNames.contains(META)) db.createObjectStore(META);\n };\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n\n const run = <T>(store: string, mode: IDBTransactionMode, fn: (s: IDBObjectStore) => IDBRequest<T>): Promise<T> =>\n open().then(\n (db) =>\n new Promise<T>((resolve, reject) => {\n const tx = db.transaction(store, mode);\n const req = fn(tx.objectStore(store));\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n tx.oncomplete = () => db.close();\n }),\n );\n\n return {\n all: () => run<QueuedCapture[]>(ITEMS, \"readonly\", (s) => s.getAll() as IDBRequest<QueuedCapture[]>),\n put: (item) => run<IDBValidKey>(ITEMS, \"readwrite\", (s) => s.put(item)).then(() => undefined),\n remove: (key) => run<undefined>(ITEMS, \"readwrite\", (s) => s.delete(key)).then(() => undefined),\n meta: (key) => run<string | undefined>(META, \"readonly\", (s) => s.get(key) as IDBRequest<string | undefined>)\n .then((v) => v ?? null),\n setMeta: (key, value) =>\n run<IDBValidKey>(META, \"readwrite\", (s) => s.put(value, key)).then(() => undefined),\n };\n}\n\n/** The in-memory store — for a test, and for a browser with storage switched off. */\nexport function memoryStore(): CaptureQueueStore {\n const rows = new Map<string, QueuedCapture>();\n const meta = new Map<string, string>();\n return {\n all: async () => Array.from(rows.values()),\n put: async (item) => void rows.set(item.client_key, item),\n remove: async (key) => void rows.delete(key),\n meta: async (key) => meta.get(key) ?? null,\n setMeta: async (key, value) => void meta.set(key, value),\n };\n}\n\nexport interface CaptureQueueOptions {\n ports: CaptureQueuePorts;\n store?: CaptureQueueStore | null;\n /** Watch `online` and drain when the signal comes back. Default true in a browser. */\n autoSync?: boolean;\n /** Told when anything changes, so a badge can say how many are waiting. */\n onChange?: (counts: CaptureQueueCounts, items: QueuedCapture[]) => void;\n now?: () => Date;\n}\n\nexport interface CaptureQueue {\n /** Write one capture to disk. Returns its client key; the network is not asked here. */\n enqueue(input: {\n organization_id: string;\n sheet_id: string;\n sheet_title?: string;\n answers: Record<string, unknown>;\n files?: Array<Omit<QueuedCaptureFile, \"uploaded\">>;\n device?: string | null;\n captured_at?: string | null;\n location?: Record<string, unknown> | null;\n client_key?: string;\n }): Promise<string>;\n list(): Promise<QueuedCapture[]>;\n counts(): Promise<CaptureQueueCounts>;\n /** Send everything waiting, oldest first, one at a time. Safe to call at any moment. */\n sync(): Promise<CaptureSyncReport>;\n /** Try one refused item again — after the person has fixed what the door named. */\n retry(clientKey: string, patch?: { answers?: Record<string, unknown> }): Promise<void>;\n /** Throw one away. The only thing that ever removes a capture nobody sent. */\n discard(clientKey: string): Promise<void>;\n /** Forget what has already landed. Never touches anything still waiting. */\n clearLanded(): Promise<number>;\n lastSyncedAt(): Promise<string | null>;\n isOnline(): boolean;\n dispose(): void;\n}\n\nfunction countOf(items: QueuedCapture[]): CaptureQueueCounts {\n const c: CaptureQueueCounts = { waiting: 0, sending: 0, refused: 0, landed: 0 };\n for (const i of items) c[i.state] += 1;\n return c;\n}\n\nexport function openCaptureQueue(opts: CaptureQueueOptions): CaptureQueue {\n const now = opts.now ?? (() => new Date());\n const store = opts.store ?? indexedDbStore() ?? memoryStore();\n let syncing: Promise<CaptureSyncReport> | null = null;\n let disposed = false;\n\n const online = (): boolean => {\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined;\n return nav ? nav.onLine !== false : true;\n };\n\n const announce = async () => {\n if (!opts.onChange) return;\n const items = await store.all();\n opts.onChange(countOf(items), items);\n };\n\n const oldestFirst = (items: QueuedCapture[]) =>\n items.slice().sort((a, b) => a.captured_at.localeCompare(b.captured_at));\n\n const queue: CaptureQueue = {\n async enqueue(input) {\n const key = input.client_key ?? mintClientKey();\n const item: QueuedCapture = {\n client_key: key,\n organization_id: input.organization_id,\n sheet_id: input.sheet_id,\n sheet_title: input.sheet_title,\n answers: input.answers ?? {},\n files: (input.files ?? []).map((f) => ({ ...f, uploaded: null })),\n device: input.device ?? null,\n captured_at: input.captured_at ?? now().toISOString(),\n location: input.location ?? null,\n state: \"waiting\",\n attempts: 0,\n last_error: null,\n record_id: null,\n replayed: false,\n queued_at: now().toISOString(),\n landed_at: null,\n };\n await store.put(item);\n await announce();\n return key;\n },\n\n list: () => store.all().then(oldestFirst),\n counts: () => store.all().then(countOf),\n\n async sync() {\n if (syncing) return syncing;\n syncing = (async (): Promise<CaptureSyncReport> => {\n const report: CaptureSyncReport = {\n attempted: 0, landed: 0, replayed: 0, refused: 0, deferred: 0, outcomes: [],\n };\n const pending = oldestFirst(await store.all()).filter((i) => i.state === \"waiting\" || i.state === \"sending\");\n if (!online()) {\n report.deferred = pending.length;\n report.stopped_because = \"There is no signal, so nothing was sent. Everything is still here.\";\n return report;\n }\n\n for (const item of pending) {\n report.attempted += 1;\n item.state = \"sending\";\n item.attempts += 1;\n await store.put(item);\n await announce();\n\n try {\n // THE BYTES FIRST, AND ONLY ONCE. A file whose reference is already written\n // back is not uploaded again, so a failure at the SUBMIT step does not send\n // the photograph twice.\n for (const f of item.files) {\n if (f.uploaded) continue;\n f.uploaded = await opts.ports.uploadFile(f, item);\n f.blob = null;\n await store.put(item);\n }\n\n const refs: CaptureFileRef[] = item.files.map((f) => ({\n field: f.field,\n name: f.name,\n mime_type: f.mime_type,\n size_bytes: f.size_bytes,\n duration_ms: f.duration_ms ?? null,\n file_id: f.uploaded?.file_id ?? null,\n url: f.uploaded?.url ?? null,\n }));\n\n const res = await opts.ports.submit({\n sheet_id: item.sheet_id,\n client_key: item.client_key,\n answers: item.answers,\n files: refs,\n device: item.device,\n captured_at: item.captured_at,\n location: item.location,\n });\n\n if (res.ok && res.data && res.data.record_id) {\n item.state = \"landed\";\n item.record_id = res.data.record_id;\n item.replayed = !!res.data.replay;\n item.landed_at = now().toISOString();\n item.last_error = null;\n report.landed += 1;\n if (item.replayed) report.replayed += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state,\n record_id: item.record_id, replay: item.replayed,\n says: res.data.message ?? null,\n });\n } else if (res.ok && res.data && !res.data.record_id) {\n // The door answered in words — closed, not open yet. It is not a failure of\n // this phone and it is not something a retry loop can fix.\n item.state = \"refused\";\n item.last_error = res.data.message ?? `This sheet is ${res.data.state}.`;\n report.refused += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state, record_id: null,\n replay: false, says: item.last_error,\n });\n } else if (isDecided(res.error)) {\n item.state = \"refused\";\n item.last_error = res.error?.message ?? \"The store refused this capture.\";\n report.refused += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state, record_id: null,\n replay: false, says: item.last_error,\n });\n } else {\n item.state = \"waiting\";\n item.last_error = res.error?.message ?? \"It could not be sent just now.\";\n report.deferred += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state, record_id: null,\n replay: false, says: item.last_error,\n });\n }\n } catch (err) {\n // A thrown error is the NETWORK, not a decision: it waits.\n item.state = \"waiting\";\n item.last_error =\n err instanceof Error ? err.message : \"It could not be sent just now.\";\n report.deferred += 1;\n report.outcomes.push({\n client_key: item.client_key, state: item.state, record_id: null,\n replay: false, says: item.last_error,\n });\n }\n\n await store.put(item);\n await announce();\n\n if (!online()) {\n report.stopped_because =\n \"The signal went away again. Everything still on the phone is still here.\";\n break;\n }\n }\n\n await store.setMeta(\"last_synced_at\", now().toISOString());\n return report;\n })();\n try {\n return await syncing;\n } finally {\n syncing = null;\n }\n },\n\n async retry(clientKey, patch) {\n const items = await store.all();\n const item = items.find((i) => i.client_key === clientKey);\n if (!item) return;\n if (patch?.answers) item.answers = { ...item.answers, ...patch.answers };\n item.state = \"waiting\";\n item.last_error = null;\n await store.put(item);\n await announce();\n },\n\n async discard(clientKey) {\n await store.remove(clientKey);\n await announce();\n },\n\n async clearLanded() {\n const items = await store.all();\n const landed = items.filter((i) => i.state === \"landed\");\n for (const i of landed) await store.remove(i.client_key);\n await announce();\n return landed.length;\n },\n\n lastSyncedAt: () => store.meta(\"last_synced_at\"),\n isOnline: online,\n\n dispose() {\n disposed = true;\n if (typeof window !== \"undefined\" && handler) window.removeEventListener(\"online\", handler);\n },\n };\n\n let handler: (() => void) | null = null;\n const auto = opts.autoSync ?? typeof window !== \"undefined\";\n if (auto && typeof window !== \"undefined\") {\n handler = () => {\n if (!disposed) void queue.sync();\n };\n window.addEventListener(\"online\", handler);\n }\n\n return queue;\n}\n","// src/results.ts — @ai-matrx/records\n//\n// THE NEVER-THROW RESULT ENVELOPE, and the refusal vocabulary behind it.\n//\n// This package's whole posture toward the store is in one sentence: THE CLIENT\n// MIRRORS THE STORE'S CONTRACT AND NEVER RE-IMPLEMENTS A RULE THE STORE\n// ENFORCES. When the store refuses, the client hands back the store's OWN\n// message, the store's OWN hint and the store's OWN SQLSTATE, under a code a\n// screen can branch on. It never rewrites the sentence, never swallows it, and\n// never invents a friendlier one — the store's refusals were written to be read\n// by a person, and a client that paraphrases them is lying about what happened.\n\nimport type { PerValueAccessWord } from \"./vocabulary\";\nimport type { Uuid } from \"./record\";\n\n/**\n * What KIND of refusal it was. The mapping from SQLSTATE to code lives in\n * `/core`, and it is checked against `STORE_REFUSAL_CODES` — the list of every\n * SQLSTATE the store's own bodies raise, generated from the live catalogue. A\n * code the store can raise and this union cannot name is a hole, and the\n * real-door suite fails on it.\n */\nexport type RecordsErrorCode =\n /** `PT409` — somebody else's write won. The record clock moved under you. */\n | \"stale_write\"\n /** `42501` — a door. Either the schema is revoked, or the store is switched off, or this principal may not pass. */\n | \"door\"\n /** `23514` — a Rule, a shape guard, or a validation the store enforces refused it. */\n | \"refused_by_rule\"\n /**\n * `22004` / `22023` / `22P02` — the call itself was malformed: a missing id, a\n * patch that is not an object, or a value that does not fit the type the\n * store holds for that Field. The store's own message names the value and the\n * type it could not be read as.\n */\n | \"invalid_argument\"\n /** `02000` — the record is not here (deleted, never existed, or another organization's). */\n | \"not_found\"\n /** `23503` — something it points at is not there. */\n | \"missing_reference\"\n /** `23505` — that thing is already here. */\n | \"already_exists\"\n /** `0A000` — the store does not do this yet, and says which part. */\n | \"not_supported\"\n /** `53400` / `22012` — the store ran out of something, or the arithmetic could not be done. */\n | \"store_limit\"\n /**\n * `40001` — the visibility snapshot this connection carries is older than a\n * write the reader has already observed, so the store refused to answer at\n * all rather than hand back something they just lost. Retry on a fresh\n * connection; it is the one refusal in this list that is worth repeating.\n */\n | \"stale_read\"\n /**\n * `57014` — the store cancelled the statement at its own timeout. Nothing was\n * refused on its merits and nothing was written; the same call can succeed on\n * a smaller page or a quieter moment. With `stale_read`, one of the only two\n * refusals in this list worth repeating.\n */\n | \"timed_out\"\n /**\n * THE DOOR THAT DOES NOT EXIST YET. Not an error condition in the database —\n * this package asked for a door that is not in the live catalogue, so it\n * refused to guess. `door_absent` always names the door and the lane that\n * owns it; it is never a silent no-op and never an empty list.\n */\n | \"door_absent\"\n /**\n * `PGRST202` / `PGRST205` — PostgREST could not find the function or the\n * schema. The database this client is pointed at is not serving the record\n * store: the schema is not exposed, or the grants are not there.\n */\n | \"store_not_served\"\n /**\n * `PT428` — the move was not refused and it did not happen: a stage gate whose\n * `on_fail` is `require_approval` filed a request with the people who can\n * answer it, and left the record exactly where it was. The store's own\n * sentence is the gate's own sentence, and the DETAIL carries the approval.\n *\n * It is the one code in this list that is not a failure. A screen that drew it\n * as one would tell somebody their work was rejected when it is being\n * considered; a screen that drew it as success would move the card while\n * somebody is still deciding. `custom.pipeline_move` answers an object on this\n * path rather than raising, so a caller only meets PT428 when the move went\n * through the ORDINARY write door — which is most of them.\n */\n | \"needs_approval\"\n /**\n * THE CALL NEVER REACHED THE STORE. Not a refusal — a transport failure: the\n * browser lost the network, the gateway answered with an HTTP status and no\n * body, the request was cancelled. supabase-js hands these back with an EMPTY\n * `code` (a `FetchError`) or with the HTTP status in it (`\"404\"`, `\"502\"`),\n * neither of which is a SQLSTATE, and until 2026-09-22 they all landed in\n * `internal` — which is the one classification that tells a screen nothing,\n * and which made the package print a sentence about ITSELF to the person\n * (lane TAILS-6). Nothing was written, and the same call can simply be made\n * again, which is what separates it from `internal`.\n */\n | \"unreachable\"\n /** Anything the mapper could not place. It still carries the store's own words. */\n | \"internal\";\n\n/** A refusal, in the store's own words. */\nexport interface RecordsError {\n code: RecordsErrorCode;\n /** THE STORE'S message, verbatim. Never paraphrased. */\n message: string;\n /** THE STORE'S hint, verbatim — this is where the remedy is written. */\n hint?: string;\n /** The SQLSTATE, so a caller can be exact when a code is not exact enough. */\n sqlstate?: string;\n /** Whatever the store put in DETAIL, parsed when it was json. */\n detail?: unknown;\n /**\n * TRUE when this package did not recognise the class it was handed, so a\n * caller can say so instead of reading the silence as \"handled\".\n *\n * 🚨 IT IS A FLAG AND A SEPARATE SENTENCE, NEVER AN APPENDIX TO `hint`\n * (lane TAILS-6, 2026-09-22). `mapPgError` used to append \"@ai-matrx/records\n * did not recognise SQLSTATE … from checklistTemplates\" ONTO `hint`, and\n * `hint` is the field every screen treats as THE REMEDY — the sentence a\n * person is told to act on. So a dropped connection on the Checklists tab\n * showed a plumbing company \"Something went wrong at our end\" over a line\n * about a TypeScript package and a SQLSTATE. A note this package writes about\n * ITSELF is for whoever debugs it and belongs nowhere a person reads.\n */\n unmapped?: boolean;\n /**\n * THIS PACKAGE'S OWN NOTE, for an engineer. Never the store's words and never\n * a person's: screens render it out of sight (a `title` attribute, a\n * screen-reader line) or not at all.\n */\n diagnostic?: string;\n}\n\nexport type RecordsResult<T> = { ok: true; data: T } | { ok: false; error: RecordsError };\n\n/** Narrowing helper for hosts compiled without `strictNullChecks`. */\nexport function isRecordsErr<T>(\n result: RecordsResult<T>,\n): result is { ok: false; error: RecordsError } {\n return result.ok === false;\n}\n\nexport const ok = <T>(data: T): RecordsResult<T> => ({ ok: true, data });\nexport const err = <T>(error: RecordsError): RecordsResult<T> => ({ ok: false, error });\n\n/**\n * A `stale_write` carries everything the screen needs to show the conflict\n * rather than a toast: which version you wrote against, which one won, and the\n * value of every field you touched as it stands now. The store builds this and\n * this type is its shape — nothing is reconstructed on the client.\n */\nexport interface StaleWriteDetail {\n expected_version: number;\n current_version: number;\n contested_fields: Record<string, unknown>;\n}\n\n/** The parsed form of a `stale_write`, for `useRecordMutation`'s conflict state. */\nexport interface WriteConflict extends StaleWriteDetail {\n record_id: Uuid;\n /** The store's own sentence — what the screen shows. */\n message: string;\n /** The store's own remedy. */\n hint: string;\n}\n\n/**\n * The structural shape of a PostgREST failure as supabase-js resolves it: a\n * PLAIN OBJECT parsed from the response body, NOT an `Error`. Reading\n * `.message` off `instanceof Error` discards the real database message on every\n * genuine failure.\n */\nexport interface PgError {\n code?: string | null;\n message: string;\n details?: string | null;\n hint?: string | null;\n}\n\n/** What the validation mirror answers: the same sentence the trigger would raise. */\nexport interface PredictedRefusal {\n /** The field key the store would name, when it names one. */\n field_key?: string;\n /** The message the store's own body would raise, word for word. */\n message: string;\n hint?: string;\n /** The store's structured detail, when its refusal carries one (e.g. `{ example }`). */\n detail?: Record<string, unknown>;\n sqlstate: string;\n /**\n * Which of the store's bodies would raise it, so a reader can go and check\n * that this mirror still tells the truth.\n */\n predicted_by: string;\n}\n\n/** VAL-5 / VAL-6, named so a caller can say which word was the problem. */\nexport interface ForbiddenEnvelopeWord {\n field_key: string;\n word: PerValueAccessWord;\n}\n","/**\n * THE CLIENT OPERATION LEDGER — how a browser recognises the echo of its own write.\n *\n * Every private-channel notice the record store broadcasts reaches EVERY browser watching that\n * Table, including the one that caused it. Until now the writer had no way to tell its own\n * change from a colleague's: the notice carried ids and nothing about who moved them, so\n * `recordsRealtimePort.ts` declared `acceptEchoFromSelf: true` and the writer re-read a page it\n * had already updated. It was named honestly rather than faked, and this is the other half.\n *\n * THE SHAPE. Every write through `RecordsClient` mints a uuid, sends it to the store as the\n * platform envelope key `_op_id`, and remembers it here. The store lifts that key out before\n * storage — it is never written onto the record — carries it on the change-feed row, and puts\n * it in the notice as `op_id`. A notice whose `op_id` is in this ledger is this browser's own\n * echo and is dropped.\n *\n * WHY A TIME WINDOW RATHER THAN A DELETE-ON-MATCH. One write can produce MORE THAN ONE notice:\n * a record write that also moves a column produces a `record` notice and a `field` notice, and\n * a statement touching two Tables produces one per Table. Forgetting an op the first time it\n * came back would make the second notice look like somebody else's and cost the re-read this\n * exists to avoid. So an op is remembered for a window and expires on its own.\n *\n * 🚨 THE WINDOW IS A CORRECTNESS BOUNDARY, NOT A TUNING KNOB, AND IT FAILS IN THE SAFE\n * DIRECTION BY CONSTRUCTION. Too SHORT and a late echo is treated as a stranger's change: one\n * extra read of a page that is already correct — invisible. Too LONG and a stranger's change\n * that happened to reuse our uuid would be dropped — which cannot happen, because it is a v4\n * uuid nobody else has ever seen. The only real cost of a long window is memory, so it is\n * bounded by COUNT as well as by time.\n *\n * WHAT THIS IS NOT. It is not a replacement for the store's optimistic concurrency, and it\n * never decides what is true — a dropped echo means \"I already know about this\", and every\n * path that could be wrong about that (a reconnect, a tab wake, a notice with no `op_id` at\n * all) re-reads through the door as it always did.\n */\nimport type { Uuid } from \"./core/index\";\n\n/** How long an operation stays recognisable as ours. See the header: it fails safe both ways. */\nconst REMEMBER_MS = 30_000;\n\n/** A ceiling so a long-lived tab that writes constantly cannot grow this without bound. */\nconst REMEMBER_MAX = 500;\n\n/** op id → the moment it was minted. Insertion-ordered, which is what makes the trim cheap. */\nconst ours = new Map<string, number>();\n\nfunction trim(now: number): void {\n // A Map iterates in insertion order and ids are minted in time order, so the first entry\n // that is still inside the window means every entry after it is too.\n for (const [id, at] of ours) {\n if (now - at <= REMEMBER_MS) break;\n ours.delete(id);\n }\n // Then the ceiling, oldest first, for a tab that writes faster than the window expires.\n while (ours.size > REMEMBER_MAX) {\n const oldest = ours.keys().next();\n if (oldest.done === true) break;\n ours.delete(oldest.value);\n }\n}\n\n/**\n * Mint the id for one client operation and remember it as ours.\n *\n * ONE CALL IS ONE OPERATION. A fifty-row paste through `recordWriteMany` is ONE op id, because\n * the store announces one statement once — and it REFUSES a batch carrying two different ones\n * by name, for exactly that reason.\n */\nexport function mintOpId(): Uuid {\n const id = crypto.randomUUID();\n const now = Date.now();\n ours.set(id, now);\n trim(now);\n return id as Uuid;\n}\n\n/**\n * Is this notice the echo of a write this browser made?\n *\n * `undefined`/`null` is NOT ours and never has been: a notice with no `op_id` came from a\n * server-side write, an agent tool, another client, or a store older than this mechanism —\n * all of which are changes this browser has not seen and must read.\n */\nexport function isOwnOp(opId: string | null | undefined): boolean {\n if (!opId) return false;\n const at = ours.get(opId);\n if (at === undefined) return false;\n if (Date.now() - at > REMEMBER_MS) {\n ours.delete(opId);\n return false;\n }\n return true;\n}\n\n/** Test seam: forget everything. Never called by product code. */\nexport function forgetAllOps(): void {\n ours.clear();\n}\n\n/** Test seam: how many operations are currently remembered. */\nexport function rememberedOpCount(): number {\n return ours.size;\n}\n","// src/store.generated.ts — @ai-matrx/records\n//\n// GENERATED. Do not edit by hand: `pnpm records:generate` rewrites it from the\n// live record store, and `pnpm check:store-registry` fails the build when this\n// file and the store disagree. Every literal below was read from the database's\n// own catalogue — the vocabularies from the store's vocabulary functions, the\n// parity types from `custom.parity_field_types()`, the doors from `pg_proc`,\n// the kernel ids from the kernel rows themselves, the tokens from\n// `platform.entity_types`.\n//\n// Counts at generation: 3 actor words, 4 absence\n// reasons, 14 parity field types, 19 declarable field kinds,\n// 67 rule node kinds,\n// 9 kernel Tables, 606 doors, 56 knobs,\n// 1026 entity tokens.\n\nexport const ACTOR_VOCABULARY = [\"user\", \"agent\", \"system\"] as const;\n\n/** The three words the store still accepts and rewrites, and what each becomes. */\nexport const RETIRED_ACTOR_WORDS = {\"ai\": \"agent\", \"code\": \"system\", \"human\": \"user\"} as const;\n\nexport const ABSENCE_REASONS = [\"never asked\", \"none\", \"refused\", \"conflicting\"] as const;\n\nexport const VALUE_ENVELOPE_KEYS = [\"ver\", \"src\", \"actor\", \"on_behalf_of\", \"at\", \"absent\", \"alternates\", \"dated\", \"pinned\"] as const;\n\nexport const VALUE_ALTERNATE_KEYS = [\"value\", \"src\", \"rank\"] as const;\n\nexport const STORAGE_MODES = [\"light\", \"heavy\"] as const;\n\nexport const RULE_USES = [\"validate\", \"compute\", \"membership\", \"applicability\"] as const;\n\nexport const PER_VALUE_ACCESS_WORDS = [\"visibility\", \"access\", \"share\", \"acl\", \"permission\", \"permissions\", \"secret\"] as const;\n\n/** FLD-11's parity floor, each with the behaviour it is MADE OF (FLD-1). */\nexport const PARITY_FIELD_TYPES = [\n { parity_type: \"attachment\", behavior: \"relation\", made_of: \"REC-31: a File record reached through a relation, target the kernel `File` Table\" },\n { parity_type: \"checkbox\", behavior: \"boolean\", made_of: \"a ticked or unticked answer, stored as a REAL boolean — and a record that never answered holds neither, so filters and group-by see three states, not two\" },\n { parity_type: \"currency\", behavior: \"range\", made_of: \"FLD-N-1: a number whose UNIT is the currency and whose format is currency — on the Field, never in presentation\" },\n { parity_type: \"datetime\", behavior: \"range\", made_of: \"a range of kind date or datetime — the dated modifier says the VALUES are dated, which is a different question\" },\n { parity_type: \"email\", behavior: \"text\", made_of: \"text whose format is email\" },\n { parity_type: \"formula\", behavior: \"formula\", made_of: \"FLD-9: a declared computation, on read or on write, evaluated by custom.rule_eval\" },\n { parity_type: \"lookup\", behavior: \"formula\", made_of: \"a Value read THROUGH a relation — config.via names the relation field, config.pick the Value on the far side\" },\n { parity_type: \"member\", behavior: \"relation\", made_of: \"a person: a relation whose target is the kernel `Person` Table\" },\n { parity_type: \"multi_select\", behavior: \"list\", made_of: \"many choices from the same Table — the multi modifier, never a second behaviour\" },\n { parity_type: \"percent\", behavior: \"range\", made_of: \"a number whose unit is % and whose format is percent\" },\n { parity_type: \"phone\", behavior: \"text\", made_of: \"text whose format is phone\" },\n { parity_type: \"rollup\", behavior: \"formula\", made_of: \"an aggregate ALONG a relation — config.via, config.of, config.agg; far-side ids are taken DISTINCT, so nothing is counted twice\" },\n { parity_type: \"select\", behavior: \"list\", made_of: \"one choice from a Table shown as a list (FLD-5/FLD-6)\" },\n { parity_type: \"url\", behavior: \"text\", made_of: \"text whose format is url, with the pattern Rule that makes the format enforceable\" },\n] as const;\n\n/**\n * THE ONE REGISTRY: every kind a column can be DECLARED as, from\n * `custom.field_kinds()`. `parity` says whether the kind is one of FLD-11's parity\n * floor; the rest are the behaviours and formats the declaration door answers to and\n * nothing else enumerated — which is how `signature` came to be a shape\n * `custom.doc_sign` accepted and no screen could offer.\n */\nexport const DECLARABLE_FIELD_KINDS = [\n { kind: \"attachment\", behavior: \"relation\", parity: true, made_of: \"REC-31: a File record reached through a relation, target the kernel `File` Table\" },\n { kind: \"checkbox\", behavior: \"boolean\", parity: true, made_of: \"a ticked or unticked answer, stored as a REAL boolean — and a record that never answered holds neither, so filters and group-by see three states, not two\" },\n { kind: \"currency\", behavior: \"range\", parity: true, made_of: \"FLD-N-1: a number whose UNIT is the currency and whose format is currency — on the Field, never in presentation\" },\n { kind: \"datetime\", behavior: \"range\", parity: true, made_of: \"a range of kind date or datetime — the dated modifier says the VALUES are dated, which is a different question\" },\n { kind: \"email\", behavior: \"text\", parity: true, made_of: \"text whose format is email\" },\n { kind: \"formula\", behavior: \"formula\", parity: true, made_of: \"FLD-9: a declared computation, on read or on write, evaluated by custom.rule_eval\" },\n { kind: \"long_text\", behavior: \"text\", parity: false, made_of: \"behaviour text with format long and config.multiline, for several lines rather than one\" },\n { kind: \"lookup\", behavior: \"formula\", parity: true, made_of: \"a Value read THROUGH a relation — config.via names the relation field, config.pick the Value on the far side\" },\n { kind: \"member\", behavior: \"relation\", parity: true, made_of: \"a person: a relation whose target is the kernel `Person` Table\" },\n { kind: \"multi_select\", behavior: \"list\", parity: true, made_of: \"many choices from the same Table — the multi modifier, never a second behaviour\" },\n { kind: \"number\", behavior: \"range\", parity: false, made_of: \"a plain number: behaviour range with no date kind and neither the currency nor the percent format\" },\n { kind: \"percent\", behavior: \"range\", parity: true, made_of: \"a number whose unit is % and whose format is percent\" },\n { kind: \"phone\", behavior: \"text\", parity: true, made_of: \"text whose format is phone\" },\n { kind: \"relation\", behavior: \"relation\", parity: false, made_of: \"REL / FLD-11: a relation a person aims themselves — relation_target names a Table of this organization, and it is a BEHAVIOUR, never a parity type of its own\" },\n { kind: \"rollup\", behavior: \"formula\", parity: true, made_of: \"an aggregate ALONG a relation — config.via, config.of, config.agg; far-side ids are taken DISTINCT, so nothing is counted twice\" },\n { kind: \"select\", behavior: \"list\", parity: true, made_of: \"one choice from a Table shown as a list (FLD-5/FLD-6)\" },\n { kind: \"signature\", behavior: \"text\", parity: false, made_of: \"VAL-10: behaviour text whose format is signature — the one shape custom.doc_sign accepts, sealed by custom.doc_signature_write and checked by custom.doc_signature_intact\" },\n { kind: \"text\", behavior: \"text\", parity: false, made_of: \"plain text: behaviour text with no format — it carries no parity type, which is exactly what custom.parity_type answers for it\" },\n { kind: \"url\", behavior: \"text\", parity: true, made_of: \"text whose format is url, with the pattern Rule that makes the format enforceable\" },\n] as const;\n\n/** The node kinds `custom.rule_eval` evaluates, and the lane that owns each. */\nexport const RULE_NODE_KINDS = [\n { node: \"actor_at_least\", evaluated_by: \"PIPELINES\" },\n { node: \"add\", evaluated_by: \"W1-RULE\" },\n { node: \"and\", evaluated_by: \"W1-RULE\" },\n { node: \"concat\", evaluated_by: \"W1-RULE\" },\n { node: \"const\", evaluated_by: \"W1-RULE\" },\n { node: \"div\", evaluated_by: \"W1-RULE\" },\n { node: \"eq\", evaluated_by: \"W1-RULE\" },\n { node: \"field\", evaluated_by: \"W1-RULE\" },\n { node: \"fx.abs\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.add\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.and\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.autonumber\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.average\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.blank\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.concatenate\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.contains\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.created_time\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.dateadd\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.datediff\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.day\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.div\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.eq\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.gt\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.gte\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.if\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.isblank\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.left\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.len\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.lower\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.lt\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.lte\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.max\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.min\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.mod\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.modified_time\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.month\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.mul\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.ne\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.neg\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.not\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.now\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.or\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.right\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.round\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.sub\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.sum\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.today\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.trim\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.upper\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"fx.year\", evaluated_by: \"GRID-PRIMITIVES G3 (custom.formula_eval)\" },\n { node: \"gt\", evaluated_by: \"W1-RULE\" },\n { node: \"gte\", evaluated_by: \"W1-RULE\" },\n { node: \"length\", evaluated_by: \"W1-RULE\" },\n { node: \"lt\", evaluated_by: \"W1-RULE\" },\n { node: \"lte\", evaluated_by: \"W1-RULE\" },\n { node: \"matches\", evaluated_by: \"W1-RULE\" },\n { node: \"merge_field\", evaluated_by: \"W5-MERGE-B\" },\n { node: \"mul\", evaluated_by: \"W1-RULE\" },\n { node: \"ne\", evaluated_by: \"W1-RULE\" },\n { node: \"not\", evaluated_by: \"W1-RULE\" },\n { node: \"or\", evaluated_by: \"W1-RULE\" },\n { node: \"parent_field\", evaluated_by: \"W1-RULE-APPLY\" },\n { node: \"present\", evaluated_by: \"W1-RULE\" },\n { node: \"previous\", evaluated_by: \"PIPELINES\" },\n { node: \"sibling_count\", evaluated_by: \"STAGE-RULES\" },\n { node: \"stage_count\", evaluated_by: \"PIPELINES\" },\n { node: \"sub\", evaluated_by: \"W1-RULE\" },\n] as const;\n\n/** REC-27. The kernel, by name and by id, as the store holds it. */\nexport const KERNEL_TABLES = [\n { id: \"11111111-0000-4000-8000-000000000002\", name: \"Field\" },\n { id: \"11111111-0000-4000-8000-000000000006\", name: \"File\" },\n { id: \"11111111-0000-4000-8000-000000000009\", name: \"Merge Field\" },\n { id: \"11111111-0000-4000-8000-000000000004\", name: \"Organization\" },\n { id: \"11111111-0000-4000-8000-000000000005\", name: \"Person\" },\n { id: \"11111111-0000-4000-8000-000000000007\", name: \"Presentation\" },\n { id: \"11111111-0000-4000-8000-000000000003\", name: \"Rule\" },\n { id: \"11111111-0000-4000-8000-000000000001\", name: \"Table\" },\n { id: \"11111111-0000-4000-8000-000000000008\", name: \"Widget\" },\n] as const;\n\n/**\n * Every door the store actually has, with the argument list and the result the\n * catalogue reports. A client call whose door is not in this list is answered\n * `door_absent` by name — never a guess, never a silent no-op.\n */\nexport const STORE_DOORS = [\n { name: \"absence_reasons\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"action_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_actions jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"action_run\", args: \"p_organization_id uuid, p_action_id uuid, p_record_ids uuid[]\", returns: \"jsonb\", security: \"definer\" },\n { name: \"actor_vocabulary\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"actor_word\", args: \"p_declared text\", returns: \"text\", security: \"invoker\" },\n { name: \"addressed_cap\", args: \"p_user_id uuid, p_type text, p_id uuid, p_organization_id uuid DEFAULT NULL::uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"permission_level\", security: \"definer\" },\n { name: \"addressed_cap_specific\", args: \"p_user_id uuid, p_type text, p_id uuid, p_organization_id uuid DEFAULT NULL::uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"permission_level\", security: \"definer\" },\n { name: \"agent_change_approval\", args: \"p_organization uuid, p_conversation uuid DEFAULT NULL::uuid, p_table uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"agent_context\", args: \"p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 50\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"agent_table_claim\", args: \"p_organization uuid, p_table uuid, p_conversation uuid DEFAULT NULL::uuid\", returns: \"void\", security: \"definer\" },\n { name: \"agg_assert_key\", args: \"p_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_buckets\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"agg_cadence_normalize\", args: \"p_cadence text\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_deliver\", args: \"p_organization_id uuid, p_rule_id uuid, p_record_id uuid, p_channel text, p_recipient_user_id uuid, p_event_key text, p_subject text, p_body text, p_payload jsonb DEFAULT '{}'::jsonb, p_dedupe_suffix text DEFAULT NULL::text\", returns: \"uuid\", security: \"invoker\" },\n { name: \"agg_deliver_quietly\", args: \"p_organization_id uuid, p_rule_id uuid, p_subject_id uuid, p_channel text, p_recipient_user_id uuid, p_event_key text, p_subject text, p_body text, p_payload jsonb, p_quiet_hours jsonb, p_link text, p_dedupe_suffix text DEFAULT NULL::text\", returns: \"uuid\", security: \"invoker\" },\n { name: \"agg_digest_assemble\", args: \"p_organization_id uuid, p_rule_id uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone, p_until timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"agg_digest_due_at\", args: \"p_cadence text, p_schedule text, p_quiet jsonb, p_after timestamp with time zone\", returns: \"timestamp with time zone\", security: \"invoker\" },\n { name: \"agg_digest_run\", args: \"p_organization_id uuid, p_rule_id uuid DEFAULT NULL::uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_digest_tick\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_explain\", args: \"p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_required text DEFAULT 'viewer'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"agg_last_digest_at\", args: \"p_organization_id uuid, p_rule_id uuid\", returns: \"timestamp with time zone\", security: \"invoker\" },\n { name: \"agg_operations\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"agg_quiet_until\", args: \"p_quiet jsonb, p_at timestamp with time zone\", returns: \"timestamp with time zone\", security: \"invoker\" },\n { name: \"agg_record_name\", args: \"p_organization_id uuid, p_record_id uuid, p_state jsonb DEFAULT NULL::jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_sql\", args: \"p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 200, p_required text DEFAULT 'viewer'::text\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_subscription_cadences\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"agg_subscription_fire\", args: \"p_organization_id uuid, p_record_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_changed_field_ids jsonb DEFAULT '[]'::jsonb\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_subscription_fire_entered\", args: \"p_organization_id uuid, p_record_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_subscription_tick\", args: \"p_window interval DEFAULT '00:15:00'::interval\", returns: \"integer\", security: \"invoker\" },\n { name: \"agg_subscriptions\", args: \"p_organization_id uuid, p_saved_view_id uuid DEFAULT NULL::uuid, p_cadence text DEFAULT NULL::text\", returns: \"TABLE(rule_id uuid, saved_view_id uuid, table_id uuid, cadence text, schedule text, quiet_hours jsonb, channel text, recipient_user_id uuid, event_key text, name text)\", security: \"invoker\" },\n { name: \"agg_value_sql\", args: \"p_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"agg_view_admits\", args: \"p_organization_id uuid, p_saved_view_id uuid, p_record_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"agg_view_admits_state\", args: \"p_definition jsonb, p_state jsonb\", returns: \"boolean\", security: \"invoker\" },\n { name: \"anon_capture\", args: \"p_organization_id uuid, p_client_key text, p_table_id uuid, p_payload jsonb, p_device text DEFAULT NULL::text, p_captured_at timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"uuid\", security: \"definer\" },\n { name: \"anon_clear\", args: \"p_organization_id uuid, p_submission_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"anon_inbound_land\", args: \"p_address text, p_secret text, p_payload jsonb, p_raw_payload jsonb DEFAULT '{}'::jsonb, p_client_key text DEFAULT NULL::text\", returns: \"uuid\", security: \"definer\" },\n { name: \"anon_publish\", args: \"p_organization_id uuid, p_form_id uuid, p_published boolean DEFAULT true\", returns: \"timestamp with time zone\", security: \"definer\" },\n { name: \"anon_rate_take\", args: \"p_organization_id uuid, p_form_id uuid, p_bucket text, p_token_id uuid DEFAULT NULL::uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"anon_submissions\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_state text DEFAULT NULL::text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0\", returns: \"TABLE(id uuid, form_id uuid, inbound_id uuid, table_id uuid, source text, state text, payload jsonb, raw_payload jsonb, client_key text, record_id uuid, remote_origin text, rejection_reason text, created_at timestamp with time zone, cleared_at timestamp with time zone)\", security: \"definer\" },\n { name: \"anon_token_issue\", args: \"p_organization_id uuid, p_mode text, p_allowed_origins jsonb, p_form_id uuid DEFAULT NULL::uuid, p_saved_view_id uuid DEFAULT NULL::uuid, p_record_id uuid DEFAULT NULL::uuid, p_expires_at timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"TABLE(token_id uuid, secret text)\", security: \"definer\" },\n { name: \"anon_token_revoke\", args: \"p_organization_id uuid, p_token_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"anon_token_verify\", args: \"p_secret text, p_origin text, p_required_mode text\", returns: \"TABLE(token_id uuid, organization_id uuid, form_id uuid, saved_view_id uuid, record_id uuid, mode text)\", security: \"definer\" },\n { name: \"anon_write\", args: \"p_secret text, p_origin text, p_payload jsonb, p_client_key text DEFAULT NULL::text, p_raw_payload jsonb DEFAULT '{}'::jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"applicable_fields\", args: \"p_organization_id uuid, p_table_id uuid, p_record_type text DEFAULT NULL::text\", returns: \"SETOF custom.record\", security: \"definer\" },\n { name: \"assert_client_may_change\", args: \"p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'editor'::permission_level, p_subject_word text DEFAULT 'record'::text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_client_may_open\", args: \"p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'viewer'::permission_level, p_subject_word text DEFAULT 'record'::text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_client_may_reach\", args: \"p_organization_id uuid, p_door text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_columns_are_defined\", args: \"p_organization_id uuid, p_record_id uuid, p_patch jsonb\", returns: \"void\", security: \"definer\" },\n { name: \"assert_entity_door\", args: \"p_organization_id uuid, p_door text\", returns: \"void\", security: \"definer\" },\n { name: \"assert_entity_is_organization_scoped\", args: \"p_token text, p_label text, p_scoped boolean\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_may_know_table\", args: \"p_organization_id uuid, p_table_id uuid, p_door text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_organization_admin\", args: \"p_organization_id uuid, p_door text, p_what text\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_organization_wall\", args: \"p_kind text, p_organization_id uuid, p_row jsonb\", returns: \"void\", security: \"invoker\" },\n { name: \"assert_store_door\", args: \"p_organization_id uuid, p_door text\", returns: \"void\", security: \"invoker\" },\n { name: \"autonumber_backfill\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"booking_cancel\", args: \"p_booking_ref text, p_origin text DEFAULT NULL::text\", returns: \"TABLE(booking_ref text, record_id uuid, slot_key text, state text, message text)\", security: \"definer\" },\n { name: \"booking_confirm\", args: \"p_form_id uuid, p_hold_id uuid, p_origin text, p_payload jsonb, p_bucket text, p_honeypot text DEFAULT NULL::text, p_client_key text DEFAULT NULL::text\", returns: \"TABLE(booking_ref text, record_id uuid, submission_id uuid, slot_key text, slot_at timestamp with time zone, state text, message text)\", security: \"definer\" },\n { name: \"booking_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_availability jsonb DEFAULT '{}'::jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_submission_cap integer DEFAULT NULL::integer, p_quarantine_rule_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid, p_form_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text, p_home_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"booking_hold\", args: \"p_form_id uuid, p_slot_key text, p_origin text, p_bucket text, p_client_key text DEFAULT NULL::text\", returns: \"TABLE(hold_id uuid, slot_key text, expires_at timestamp with time zone, member_user_id uuid, state text, message text)\", security: \"definer\" },\n { name: \"booking_manage\", args: \"p_booking_ref text, p_days integer DEFAULT NULL::integer\", returns: \"TABLE(booking_ref text, form_id uuid, title text, slot_key text, slot_at timestamp with time zone, status text, slots jsonb, availability jsonb, state text, message text)\", security: \"definer\" },\n { name: \"booking_notify\", args: \"p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid, p_event text, p_when text\", returns: \"uuid\", security: \"invoker\" },\n { name: \"booking_public\", args: \"p_form_id uuid, p_days integer DEFAULT NULL::integer\", returns: \"TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, availability jsonb, slots jsonb, state text, message text)\", security: \"definer\" },\n { name: \"booking_reschedule\", args: \"p_booking_ref text, p_slot_key text, p_origin text, p_bucket text DEFAULT NULL::text\", returns: \"TABLE(booking_ref text, record_id uuid, slot_key text, slot_at timestamp with time zone, state text, message text)\", security: \"definer\" },\n { name: \"bookings\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(form_id uuid, table_id uuid, title text, slug text, published_at timestamp with time zone, closed_at timestamp with time zone, slot_minutes integer, timezone text, slot_table_id uuid, booked bigint, cancelled bigint, upcoming bigint, held bigint, next_at timestamp with time zone, state text)\", security: \"definer\" },\n { name: \"bump_epoch\", args: \"p_entity_type text, p_entity_id uuid, p_organization_id uuid DEFAULT NULL::uuid\", returns: \"bigint\", security: \"definer\" },\n { name: \"cache_lookup\", args: \"p_container_type text, p_container_id uuid, p_item_type text, p_item_id uuid\", returns: \"permission_level\", security: \"definer\" },\n { name: \"caller_role\", args: \"\", returns: \"name\", security: \"invoker\" },\n { name: \"capture_open\", args: \"p_organization_id uuid, p_sheet_id uuid\", returns: \"TABLE(sheet_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, state text, may_capture boolean, message text)\", security: \"definer\" },\n { name: \"capture_publish\", args: \"p_organization_id uuid, p_sheet_id uuid, p_open boolean DEFAULT true\", returns: \"timestamp with time zone\", security: \"definer\" },\n { name: \"capture_sheet_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_sheet_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"capture_sheets\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(sheet_id uuid, table_id uuid, title text, slug text, state text, opened_at timestamp with time zone, captures bigint, replays bigint, last_capture_at timestamp with time zone, presentation jsonb)\", security: \"definer\" },\n { name: \"capture_submit\", args: \"p_organization_id uuid, p_sheet_id uuid, p_client_key text, p_payload jsonb, p_files jsonb DEFAULT '[]'::jsonb, p_device text DEFAULT NULL::text, p_captured_at timestamp with time zone DEFAULT NULL::timestamp with time zone, p_location jsonb DEFAULT NULL::jsonb\", returns: \"TABLE(record_id uuid, state text, message text, replay boolean, file_ids uuid[])\", security: \"definer\" },\n { name: \"carry_unchanged_value_stamps\", args: \"p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"carrying_edges_in\", args: \"p_organization_id uuid\", returns: \"TABLE(container_type text, container_id uuid, item_type text, item_id uuid, conveys_max permission_level)\", security: \"definer\" },\n { name: \"carrying_edges_of\", args: \"p_item_type text, p_item_id uuid\", returns: \"TABLE(container_type text, container_id uuid, conveys_max permission_level)\", security: \"definer\" },\n { name: \"checklist_declare\", args: \"p_organization_id uuid, p_spec jsonb, p_template_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"checklist_refusal\", args: \"p_spec jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"checklist_run\", args: \"p_organization_id uuid, p_run_id uuid\", returns: \"TABLE(step_id uuid, step_order integer, ref text, title text, role text, assignee_name text, assignee_user_id uuid, due_on timestamp with time zone, due_state text, status text, finished boolean, requires text, requires_key text, requires_label text, requires_id uuid, evidence jsonb, blocked_by text[], may_complete boolean, refusal text)\", security: \"definer\" },\n { name: \"checklist_runs\", args: \"p_organization_id uuid, p_about_table_id uuid DEFAULT NULL::uuid, p_about_record_id uuid DEFAULT NULL::uuid, p_include_closed boolean DEFAULT true, p_limit integer DEFAULT 100\", returns: \"TABLE(run_id uuid, name text, template_id uuid, template text, about_record_id uuid, about text, about_table_id uuid, started_at timestamp with time zone, started_by uuid, origin text, step_count integer, done integer, overdue integer, next_step text, next_due timestamp with time zone, closed_at timestamp with time zone)\", security: \"definer\" },\n { name: \"checklist_start\", args: \"p_organization_id uuid, p_template_id uuid, p_about_record_id uuid DEFAULT NULL::uuid, p_roles jsonb DEFAULT '{}'::jsonb, p_starting_at timestamp with time zone DEFAULT NULL::timestamp with time zone\", returns: \"jsonb\", security: \"definer\" },\n { name: \"checklist_step_complete\", args: \"p_organization_id uuid, p_step_id uuid, p_evidence jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"checklist_step_refusal\", args: \"p_organization_id uuid, p_step_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"checklist_steps_table\", args: \"p_organization_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"checklist_template_shape\", args: \"p_organization_id uuid, p_template_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"checklist_templates\", args: \"p_organization_id uuid, p_about_table_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 100\", returns: \"TABLE(template_id uuid, name text, about_table_id uuid, about_table text, steps integer, roles integer, trigger_kind text, trigger_status text, open_runs integer, total_runs integer, updated_at timestamp with time zone)\", security: \"definer\" },\n { name: \"choice_census\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"choice_field_map\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_filter_normalize\", args: \"p_map jsonb, p_filter jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_key_for\", args: \"p_organization_id uuid, p_options_table_id uuid, p_title text, p_exclude uuid DEFAULT NULL::uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"choice_key_of\", args: \"p_field jsonb, p_token text\", returns: \"text\", security: \"invoker\" },\n { name: \"choice_options\", args: \"p_organization_id uuid, p_options_table_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_render\", args: \"p_organization_id uuid, p_table_id uuid, p_doc jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_render_groups\", args: \"p_map jsonb, p_groups jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_render_note\", args: \"p_field jsonb, p_value jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_render_value\", args: \"p_field jsonb, p_value jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"choice_slug\", args: \"p_word text\", returns: \"text\", security: \"invoker\" },\n { name: \"choice_synonyms\", args: \"p_organization_id uuid, p_table_id uuid, p_token text\", returns: \"text[]\", security: \"invoker\" },\n { name: \"choice_synonyms_in\", args: \"p_map jsonb, p_token text\", returns: \"text[]\", security: \"invoker\" },\n { name: \"choice_words\", args: \"p_field jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"client_write_grants\", args: \"\", returns: \"TABLE(role_name text, object_name text, privilege text)\", security: \"invoker\" },\n { name: \"comment_mention_deliver\", args: \"p_organization_id uuid, p_record_id uuid, p_table_id uuid, p_comment_id uuid, p_recipient uuid, p_author_name text, p_record_title text, p_body text\", returns: \"uuid\", security: \"definer\" },\n { name: \"comment_thread\", args: \"p_organization_id uuid, p_record_id uuid, p_include_resolved boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"comment_write\", args: \"p_organization_id uuid, p_record_id uuid, p_body text, p_anchor jsonb DEFAULT '{}'::jsonb, p_parent_comment_id uuid DEFAULT NULL::uuid, p_mentions uuid[] DEFAULT NULL::uuid[]\", returns: \"jsonb\", security: \"definer\" },\n { name: \"computed_block\", args: \"p_block jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"computed_provenance\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(field_key text, field_id uuid, value jsonb, rule_id uuid, rule_version integer, computed_at timestamp with time zone)\", security: \"definer\" },\n { name: \"containment_chain\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(ancestor_id uuid, depth integer)\", security: \"invoker\" },\n { name: \"containment_depth_ceiling\", args: \"p_organization_id uuid DEFAULT NULL::uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"containment_edges\", args: \"p_organization_id uuid\", returns: \"TABLE(parent_id uuid, child_id uuid, via text)\", security: \"invoker\" },\n { name: \"containment_parent\", args: \"p_data jsonb\", returns: \"uuid\", security: \"invoker\" },\n { name: \"context_resolve\", args: \"p_organization_id uuid, p_bindings jsonb, p_scope_slug text DEFAULT 'scopes'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"conversation_scope\", args: \"p_organization_id uuid, p_conversation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"conversation_scope_bind\", args: \"p_organization_id uuid, p_conversation_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"conversation_scope_context\", args: \"p_organization_id uuid, p_conversation_id uuid, p_relations integer DEFAULT 12, p_history integer DEFAULT 15, p_siblings integer DEFAULT 8\", returns: \"jsonb\", security: \"definer\" },\n { name: \"conversation_scope_unbind\", args: \"p_organization_id uuid, p_conversation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"cross_organization_links_open\", args: \"p_source_organization_id uuid, p_target_organization_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"custom_fields_tables\", args: \"\", returns: \"TABLE(token text, schema_name text, table_name text)\", security: \"invoker\" },\n { name: \"dashboard_block_normalize\", args: \"p_organization_id uuid, p_subject_table_id uuid, p_block jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"dashboard_class\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"dashboard_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_name text, p_blocks jsonb DEFAULT '[]'::jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_dashboard_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"dashboard_delete\", args: \"p_organization_id uuid, p_dashboard_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"dashboard_field_keys\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text[]\", security: \"definer\" },\n { name: \"dashboard_kinds\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"dashboard_moment_sql\", args: \"p_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"dashboard_run\", args: \"p_organization_id uuid, p_dashboard_id uuid, p_filter jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"dashboard_stuck\", args: \"p_organization_id uuid, p_table_id uuid, p_state_key text, p_days integer DEFAULT 14, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 50, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, title text, state text, last_changed_at timestamp with time zone, days_unchanged numeric, measured_from text)\", security: \"definer\" },\n { name: \"dashboard_window_sql\", args: \"p_key text, p_window jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"dashboards\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(dashboard_id uuid, table_id uuid, name text, blocks jsonb, presentation jsonb, block_count integer, version integer, created_at timestamp with time zone, updated_at timestamp with time zone)\", security: \"definer\" },\n { name: \"decoration_colors\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"decoration_rule_ops\", args: \"\", returns: \"TABLE(op text, takes_value boolean, label text)\", security: \"invoker\" },\n { name: \"delete_cascade_closure\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"uuid[]\", security: \"invoker\" },\n { name: \"delete_preview\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"delete_rule\", args: \"p_organization_id uuid, p_record_id uuid, p_apply boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"dependency_cycle\", args: \"p_organization_id uuid, p_row custom.record\", returns: \"text[]\", security: \"invoker\" },\n { name: \"dependency_label\", args: \"p_organization_id uuid, p_node text\", returns: \"text\", security: \"invoker\" },\n { name: \"derive_visibility\", args: \"p_container_type text, p_container_id uuid\", returns: \"TABLE(item_type text, item_id uuid, depth integer, max_level permission_level)\", security: \"definer\" },\n { name: \"derived_value\", args: \"p_organization_id uuid, p_record_id uuid, p_field_data jsonb, p_values jsonb DEFAULT NULL::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"derived_values\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"derived_values_of\", args: \"v_rec custom.record\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"display_format_ids\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"doc_content_hash\", args: \"p_body text\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_format_value\", args: \"p_field_data jsonb, p_value jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_letterhead\", args: \"p_organization_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"doc_name_token_pattern\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_name_tokens\", args: \"p_body text\", returns: \"TABLE(ordinal integer, raw text)\", security: \"invoker\" },\n { name: \"doc_render_body\", args: \"p_organization_id uuid, p_template_id uuid, p_record_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_render_document\", args: \"p_organization_id uuid, p_template_id uuid, p_record_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_render_read\", args: \"p_organization_id uuid, p_render_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"doc_render_write\", args: \"p_organization_id uuid, p_template_id uuid, p_record_id uuid, p_table_id uuid, p_template_version integer, p_body text, p_content_hash text\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_renders\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(render_id uuid, template_id uuid, record_id uuid, table_id uuid, template_version integer, body text, content_hash text, rendered_at timestamp with time zone)\", security: \"definer\" },\n { name: \"doc_sign\", args: \"p_organization_id uuid, p_render_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_signature_field_ok\", args: \"p_field_data jsonb\", returns: \"boolean\", security: \"invoker\" },\n { name: \"doc_signature_intact\", args: \"p_organization_id uuid, p_signature_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"doc_signature_read\", args: \"p_organization_id uuid, p_signature_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"doc_signature_write\", args: \"p_organization_id uuid, p_render_id uuid, p_record_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid, p_document_hash text, p_document_version integer\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_signatures\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(signature_id uuid, render_id uuid, record_id uuid, field_key text, signer_name text, signer_user_id uuid, signed_at timestamp with time zone, document_hash text, document_version integer)\", security: \"definer\" },\n { name: \"doc_template_delete\", args: \"p_organization_id uuid, p_template_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"doc_template_read\", args: \"p_organization_id uuid, p_template_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"doc_template_save\", args: \"p_organization_id uuid, p_table_id uuid, p_name text, p_body text, p_template_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"doc_templates\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(template_id uuid, renders_table_id uuid, name text, body text, template_version integer, token_count bigint, updated_at timestamp with time zone)\", security: \"definer\" },\n { name: \"doc_token_pattern\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"doc_tokens\", args: \"p_body text\", returns: \"TABLE(ordinal integer, raw text, field_id uuid)\", security: \"invoker\" },\n { name: \"doc_unresolved_tokens\", args: \"p_organization_id uuid, p_table_id uuid, p_body text\", returns: \"TABLE(raw text, field_id uuid, why text)\", security: \"invoker\" },\n { name: \"doors_not_deciding_the_caller\", args: \"\", returns: \"TABLE(function_name text, identity_args text)\", security: \"invoker\" },\n { name: \"doors_not_deciding_the_record\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"doors_not_masking_fields\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"doors_not_on_one_ladder\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"doors_refusing_in_another_doors_name\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"effective_level\", args: \"p_user_id uuid, p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text\", returns: \"permission_level\", security: \"definer\" },\n { name: \"enrich_cells\", args: \"p_organization_id uuid, p_table_id uuid, p_field_keys text[] DEFAULT NULL::text[], p_record_ids uuid[] DEFAULT NULL::uuid[]\", returns: \"TABLE(record_id uuid, field_key text, agent_owned boolean, value jsonb, value_version integer, actor text, on_behalf_of text, written_at timestamp with time zone, source jsonb, absent_reason text, alternates jsonb, pinned boolean, stale boolean, due_at timestamp with time zone)\", security: \"definer\" },\n { name: \"enrich_declare\", args: \"p_organization_id uuid, p_field_id uuid, p_spec jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"enrich_due\", args: \"p_organization_id uuid, p_field_id uuid, p_limit integer DEFAULT 50, p_include_fresh boolean DEFAULT false\", returns: \"TABLE(record_id uuid, title text, inputs jsonb, current_value jsonb, written_at timestamp with time zone, reason text, trimmed_to integer)\", security: \"definer\" },\n { name: \"enrich_land\", args: \"p_organization_id uuid, p_field_id uuid, p_results jsonb, p_run jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"enrich_normalize\", args: \"p_organization_id uuid, p_table_id uuid, p_field_key text, p_spec jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"enrich_pin\", args: \"p_organization_id uuid, p_record_id uuid, p_field_key text, p_pinned boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"enrich_run_class\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"enrich_runs\", args: \"p_organization_id uuid, p_field_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 50\", returns: \"TABLE(run_id uuid, field_id uuid, field_key text, model text, trigger_word text, rows_seen integer, rows_written integer, rows_absent integer, rows_below_floor integer, rows_pinned integer, rows_refused integer, cost_cents numeric, cost_per_row_cents numeric, ran_at timestamp with time zone)\", security: \"definer\" },\n { name: \"enrich_sensitivity_rank\", args: \"p_word text\", returns: \"integer\", security: \"invoker\" },\n { name: \"enrich_triggers\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"enrichments\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(field_id uuid, table_id uuid, field_key text, label text, enrichment jsonb, enabled boolean, review_interval_days integer, rows_total integer, rows_filled integer, rows_stale integer, rows_pinned integer, rows_absent integer, runs integer, cost_cents numeric, cost_per_row_cents numeric, last_run_at timestamp with time zone, last_run jsonb)\", security: \"definer\" },\n { name: \"entity_field_declare\", args: \"p_organization_id uuid, p_token text, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"entity_field_retire\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"entity_field_rights\", args: \"p_organization_id uuid, p_token text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"entity_field_update\", args: \"p_organization_id uuid, p_field_id uuid, p_patch jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"entity_fields\", args: \"p_organization_id uuid, p_token text\", returns: \"SETOF custom.record\", security: \"definer\" },\n { name: \"entity_record_read\", args: \"p_organization_id uuid, p_token text, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"entity_records_find\", args: \"p_organization_id uuid, p_token text, p_key text, p_value jsonb DEFAULT NULL::jsonb, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"entity_table\", args: \"p_token text\", returns: \"TABLE(token text, schema_name text, table_name text, type text, title_column text, label text, has_organization boolean, has_deleted_at boolean)\", security: \"invoker\" },\n { name: \"entity_value_write\", args: \"p_organization_id uuid, p_token text, p_record_id uuid, p_patch jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"export_ceiling\", args: \"p_organization_id uuid DEFAULT NULL::uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"export_records\", args: \"p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000\", returns: \"TABLE(id uuid, document jsonb)\", security: \"invoker\" },\n { name: \"external_foreign_table_findings\", args: \"\", returns: \"SETOF text\", security: \"definer\" },\n { name: \"external_history_event\", args: \"p_organization_id uuid, p_link_id uuid, p_operation text\", returns: \"bigint\", security: \"definer\" },\n { name: \"external_rows\", args: \"p_organization_id uuid, p_source_id uuid\", returns: \"SETOF jsonb\", security: \"definer\" },\n { name: \"external_source_declare\", args: \"p_organization_id uuid, p_tier text, p_connection_token text, p_external_schema text, p_external_table text, p_link_template text\", returns: \"uuid\", security: \"definer\" },\n { name: \"external_stub_upsert\", args: \"p_organization_id uuid, p_source_id uuid, p_table_id uuid, p_external_key text, p_link_url text, p_cached_title text\", returns: \"uuid\", security: \"definer\" },\n { name: \"external_tier_contract\", args: \"\", returns: \"jsonb\", security: \"definer\" },\n { name: \"external_write_through\", args: \"p_organization_id uuid, p_record_id uuid, p_patch jsonb\", returns: \"void\", security: \"definer\" },\n { name: \"external_writes_set\", args: \"p_organization_id uuid, p_source_id uuid, p_enabled boolean\", returns: \"boolean\", security: \"definer\" },\n { name: \"field_behaviour\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"field_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"field_dependants\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"TABLE(kind text, dependant_id uuid, label text, how text)\", security: \"definer\" },\n { name: \"field_history\", args: \"p_organization_id uuid, p_table_id uuid, p_field_key text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0, p_record_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(record_id uuid, record_title text, version integer, occurred_at timestamp with time zone, operation_label text, actor jsonb, before jsonb, after jsonb)\", security: \"definer\" },\n { name: \"field_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"field_kinds\", args: \"\", returns: \"TABLE(kind text, behavior text, parity boolean, made_of text)\", security: \"invoker\" },\n { name: \"field_options\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"SETOF custom.record\", security: \"definer\" },\n { name: \"field_retire\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"field_rules\", args: \"p_field_data jsonb\", returns: \"TABLE(kind text, spec jsonb)\", security: \"invoker\" },\n { name: \"field_update\", args: \"p_organization_id uuid, p_field_id uuid, p_patch jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"field_value_convert\", args: \"p_to jsonb, p_value jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"field_words\", args: \"p_organization_id uuid, p_field_id uuid, p_value jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"file_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"form_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_submission_cap integer DEFAULT NULL::integer, p_quarantine_rule_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid, p_form_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text\", returns: \"uuid\", security: \"definer\" },\n { name: \"form_notify\", args: \"p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid\", returns: \"uuid\", security: \"invoker\" },\n { name: \"form_public\", args: \"p_form_id uuid\", returns: \"TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, state text, message text)\", security: \"definer\" },\n { name: \"form_slug\", args: \"p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"form_submit\", args: \"p_form_id uuid, p_origin text, p_payload jsonb, p_bucket text, p_honeypot text DEFAULT NULL::text, p_client_key text DEFAULT NULL::text\", returns: \"TABLE(submission_id uuid, record_id uuid, state text, message text)\", security: \"definer\" },\n { name: \"forms\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(form_id uuid, table_id uuid, title text, slug text, published_at timestamp with time zone, closed_at timestamp with time zone, submission_cap integer, responses bigint, in_table bigint, held bigint, rejected bigint, state text, quarantine_rule_id uuid, notify_rule_id uuid, presentation jsonb)\", security: \"definer\" },\n { name: \"formula_eval\", args: \"p_organization_id uuid, p_expr jsonb, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"formula_node_kinds\", args: \"\", returns: \"TABLE(node text, min_args integer, max_args integer, result text, signature text, says text)\", security: \"invoker\" },\n { name: \"formula_parse\", args: \"p_organization_id uuid, p_table_id uuid, p_text text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"formula_value\", args: \"p_organization_id uuid, p_record_id uuid, p_field_data jsonb, p_values jsonb DEFAULT NULL::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"freshness_verdict\", args: \"p_written_at timestamp with time zone, p_ceiling_seconds numeric\", returns: \"jsonb\", security: \"definer\" },\n { name: \"grid_layout\", args: \"p_organization_id uuid, p_table_id uuid, p_view_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"grid_layout_check\", args: \"p_layout jsonb, p_scope text DEFAULT 'view'::text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"guard_refusals_are_complete\", args: \"\", returns: \"TABLE(guard text, said text)\", security: \"invoker\" },\n { name: \"has_visibility\", args: \"p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level\", returns: \"boolean\", security: \"definer\" },\n { name: \"has_visibility_at\", args: \"p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, p_organization_id uuid DEFAULT NULL::uuid, p_min_version bigint DEFAULT NULL::bigint\", returns: \"boolean\", security: \"definer\" },\n { name: \"hidden_field_notice\", args: \"p_field custom.record, p_action text DEFAULT 'read'::text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_actor\", args: \"p_tier text, p_document jsonb, p_actor_id uuid, p_people jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_changes\", args: \"p_organization_id uuid, p_table_id uuid, p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_people\", args: \"p_organization_id uuid, p_ids uuid[]\", returns: \"jsonb\", security: \"definer\" },\n { name: \"history_prune\", args: \"p_organization_id uuid, p_scope text DEFAULT 'values'::text, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"history_restore_body\", args: \"p_current jsonb, p_target jsonb, p_field_key text DEFAULT NULL::text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_restore_body\", args: \"p_current jsonb, p_target jsonb, p_field_key text, p_author jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"history_retention\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"history_retention_floor_raise\", args: \"p_organization_id uuid, p_days integer\", returns: \"integer\", security: \"definer\" },\n { name: \"history_retention_set\", args: \"p_organization_id uuid, p_table_id uuid, p_days integer\", returns: \"integer\", security: \"definer\" },\n { name: \"home_add\", args: \"p_organization_id uuid, p_table_id uuid, p_home_record_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"home_relations\", args: \"\", returns: \"TABLE(table_id uuid, home_record_id uuid, organization_id uuid, relation_id uuid)\", security: \"invoker\" },\n { name: \"hub_changed_by\", args: \"p_organization_id uuid, p_kind text, p_ids uuid[]\", returns: \"TABLE(id uuid, at timestamp with time zone, who text)\", security: \"definer\" },\n { name: \"inbound_addresses\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"inbound_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_label text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"inbound_domain\", args: \"p_organization_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"inbound_mail_land\", args: \"p_address text, p_mail jsonb, p_secret text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"inbound_mail_map\", args: \"p_organization_id uuid, p_table_id uuid, p_mail jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"inbound_set\", args: \"p_organization_id uuid, p_inbound_id uuid, p_enabled boolean\", returns: \"jsonb\", security: \"definer\" },\n { name: \"index_payload\", args: \"p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000\", returns: \"TABLE(id uuid, searchable text)\", security: \"invoker\" },\n { name: \"intern_provenance\", args: \"p_data jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"io_cell\", args: \"p_organization_id uuid, p_field jsonb, p_word text, p_date_order text DEFAULT 'mdy'::text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"io_changed_field_ids\", args: \"p_organization_id uuid, p_table_id uuid, p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"io_changed_keys\", args: \"p_old jsonb, p_new jsonb\", returns: \"text[]\", security: \"invoker\" },\n { name: \"io_comment_resolve\", args: \"p_organization_id uuid, p_comment_id uuid, p_resolved boolean DEFAULT true\", returns: \"boolean\", security: \"definer\" },\n { name: \"io_comment_write\", args: \"p_organization_id uuid, p_record_id uuid, p_body text, p_anchor jsonb DEFAULT '{}'::jsonb, p_parent_comment_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"io_comments\", args: \"p_organization_id uuid, p_record_id uuid, p_include_resolved boolean DEFAULT false\", returns: \"TABLE(id uuid, body text, anchor jsonb, parent_comment_id uuid, created_by uuid, created_at timestamp with time zone, resolved_at timestamp with time zone, resolved_by uuid)\", security: \"definer\" },\n { name: \"io_csv_escape\", args: \"p_value text, p_delimiter text DEFAULT ','::text\", returns: \"text\", security: \"invoker\" },\n { name: \"io_csv_parse\", args: \"p_text text, p_delimiter text DEFAULT NULL::text\", returns: \"TABLE(row_number integer, cells text[])\", security: \"invoker\" },\n { name: \"io_export\", args: \"p_organization_id uuid, p_table_id uuid, p_columns text[] DEFAULT NULL::text[], p_limit integer DEFAULT 10000, p_required text DEFAULT 'viewer'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_export_csv\", args: \"p_organization_id uuid, p_table_id uuid, p_columns text[] DEFAULT NULL::text[], p_limit integer DEFAULT 10000, p_delimiter text DEFAULT chr(44), p_required text DEFAULT 'viewer'::text\", returns: \"text\", security: \"definer\" },\n { name: \"io_import_begin\", args: \"p_organization_id uuid, p_table_id uuid, p_format text DEFAULT 'csv'::text, p_source_name text DEFAULT NULL::text, p_source_columns jsonb DEFAULT '[]'::jsonb, p_file_hash text DEFAULT NULL::text, p_policy jsonb DEFAULT '{}'::jsonb, p_dedupe_key text DEFAULT NULL::text, p_file_bytes bigint DEFAULT NULL::bigint, p_force boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_declare_columns\", args: \"p_organization_id uuid, p_table_id uuid, p_rows jsonb, p_mapping jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_finish\", args: \"p_organization_id uuid, p_import_id uuid, p_unmapped text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_forget\", args: \"p_organization_id uuid, p_import_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"io_import_open\", args: \"p_organization_id uuid, p_table_id uuid, p_format text DEFAULT 'csv'::text, p_source_name text DEFAULT NULL::text, p_source_columns jsonb DEFAULT '[]'::jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"io_import_plan\", args: \"p_organization_id uuid, p_table_id uuid, p_columns jsonb DEFAULT '[]'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_report\", args: \"p_organization_id uuid, p_import_id uuid, p_state text DEFAULT NULL::text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_import_rows\", args: \"p_organization_id uuid, p_import_id uuid, p_rows jsonb, p_mapping jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_imports\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 25\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_infer_column\", args: \"p_organization_id uuid, p_table_id uuid, p_header text, p_samples jsonb DEFAULT '[]'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"io_infer_type\", args: \"p_samples jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"io_money_unit\", args: \"p_word text\", returns: \"text\", security: \"invoker\" },\n { name: \"io_outbox_announce\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_outbox_broadcast_stmt\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_outbox_drain\", args: \"p_organization_id uuid, p_consumer text, p_limit integer DEFAULT 100, p_event_key text DEFAULT 'records.changed'::text\", returns: \"TABLE(outbox_id uuid, record_id uuid, table_id uuid, operation text, changed_field_ids jsonb, actor jsonb, occurred_at timestamp with time zone)\", security: \"definer\" },\n { name: \"io_outbox_release\", args: \"p_organization_id uuid, p_consumer text, p_older_than interval DEFAULT '00:15:00'::interval\", returns: \"integer\", security: \"definer\" },\n { name: \"io_proposal_accept\", args: \"p_organization_id uuid, p_import_id uuid, p_column text, p_type text DEFAULT NULL::text, p_label text DEFAULT NULL::text\", returns: \"uuid\", security: \"definer\" },\n { name: \"io_proposal_reject\", args: \"p_organization_id uuid, p_import_id uuid, p_column text\", returns: \"boolean\", security: \"definer\" },\n { name: \"io_proposal_spec\", args: \"p_proposal jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"io_record_changed\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_record_changed_stmt_delete\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_record_changed_stmt_insert\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_record_changed_stmt_update\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_relation_candidate\", args: \"p_organization_id uuid, p_table_id uuid, p_words text[]\", returns: \"uuid\", security: \"invoker\" },\n { name: \"io_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer\", returns: \"integer\", security: \"definer\" },\n { name: \"io_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer, p_author jsonb\", returns: \"integer\", security: \"definer\" },\n { name: \"io_revisions\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(version integer, changed_at timestamp with time zone, changed_by uuid, summary text, operation text, changed_fields jsonb)\", security: \"definer\" },\n { name: \"io_sample_words\", args: \"p_samples jsonb\", returns: \"TABLE(word text)\", security: \"invoker\" },\n { name: \"io_value_shape\", args: \"p_envelope jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"is_a_retirement\", args: \"p_old_deleted timestamp with time zone, p_new_deleted timestamp with time zone, p_old_data jsonb, p_new_data jsonb, p_old_table uuid, p_new_table uuid, p_old_org uuid, p_new_org uuid, p_old_class text, p_new_class text\", returns: \"boolean\", security: \"invoker\" },\n { name: \"ladder_replanners\", args: \"p_roots text[] DEFAULT ARRAY['custom.has_visibility'::text, 'custom.effective_level'::text, 'custom.reaches_directly'::text, 'custom.visible_set'::text]\", returns: \"TABLE(fn text, lang text, why text, remedy text)\", security: \"definer\" },\n { name: \"level_floor\", args: \"\", returns: \"permission_level\", security: \"definer\" },\n { name: \"levels_raised_by_a_less_specific_rung\", args: \"\", returns: \"TABLE(organization_id uuid, organization_name text, member_id uuid, member_email text, record_id uuid, addressed_level permission_level, answered_level permission_level)\", security: \"definer\" },\n { name: \"list_door_disagreements\", args: \"p_pretend text DEFAULT NULL::text, p_only_organization uuid DEFAULT NULL::uuid, p_sample integer DEFAULT 200\", returns: \"TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)\", security: \"invoker\" },\n { name: \"list_door_disagreements\", args: \"p_pretend text, p_only_organization uuid, p_sample integer, p_exhaustive boolean\", returns: \"TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)\", security: \"invoker\" },\n { name: \"list_portals\", args: \"p_organization_id uuid, p_archived text DEFAULT 'active'::text\", returns: \"TABLE(portal_id uuid, title text, slug text, client_table_id uuid, client_table text, is_active boolean, tables integer, invited integer, signed_in integer, sign_in_method text, opened_at timestamp with time zone)\", security: \"definer\" },\n { name: \"lookup_value\", args: \"p_organization_id uuid, p_record_id uuid, p_field_data jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"mask_document\", args: \"p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"mask_document\", args: \"p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb, p_declared_keys text[] DEFAULT NULL::text[]\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"mask_says_withheld\", args: \"p_mask jsonb, p_key text\", returns: \"boolean\", security: \"invoker\" },\n { name: \"may_invite_outside\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"merge_field_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"migrate_choice_keys\", args: \"p_organization_id uuid, p_table_id uuid, p_dry_run boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_delete\", args: \"p_organization_id uuid, p_record_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_demote\", args: \"p_organization_id uuid, p_table_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_extract_parent\", args: \"p_organization_id uuid, p_id uuid, p_parent_table_id uuid, p_moved_keys text[], p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_merge\", args: \"p_organization_id uuid, p_winner_id uuid, p_loser_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_promote\", args: \"p_organization_id uuid, p_table_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_purge\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_purge_hard\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_compliance_reason text DEFAULT NULL::text, p_chunk integer DEFAULT 200, p_dry_run boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_purge_hard_request\", args: \"p_organization_id uuid, p_table_id uuid, p_compliance_reason text\", returns: \"void\", security: \"definer\" },\n { name: \"migrate_reclass\", args: \"p_organization_id uuid, p_id uuid, p_to text DEFAULT 'field'::text, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_rename\", args: \"p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_reparent\", args: \"p_organization_id uuid, p_id uuid, p_parent_id uuid, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_retype\", args: \"p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_split\", args: \"p_organization_id uuid, p_record_id uuid, p_moved_keys text[], p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrate_undo\", args: \"p_organization_id uuid, p_log_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"migrations\", args: \"p_organization_id uuid, p_target_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 100\", returns: \"TABLE(id uuid, verb text, target_kind text, target_id uuid, note text, applied_at timestamp with time zone, applied_by uuid, undone_at timestamp with time zone)\", security: \"definer\" },\n { name: \"mirror_asks_the_whole_database\", args: \"\", returns: \"TABLE(schema_name text, table_name text, policy_name text, why text)\", security: \"invoker\" },\n { name: \"my_level\", args: \"p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text\", returns: \"permission_level\", security: \"definer\" },\n { name: \"my_levels\", args: \"p_organization_id uuid, p_ids jsonb, p_type text DEFAULT 'record'::text\", returns: \"TABLE(id uuid, level permission_level)\", security: \"definer\" },\n { name: \"organization_clear\", args: \"p_organization_id uuid, p_confirm text, p_and_destroy boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"organization_contents\", args: \"p_organization_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"organization_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"organization_references\", args: \"p_kind text, p_organization_id uuid, p_row jsonb\", returns: \"TABLE(site text, what text, ref_id uuid, openable boolean)\", security: \"invoker\" },\n { name: \"owning_table\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"uuid\", security: \"invoker\" },\n { name: \"owning_table_gone\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"page_ceiling\", args: \"p_organization_id uuid DEFAULT NULL::uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"page_contract\", args: \"p_organization_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"page_size\", args: \"p_organization_id uuid, p_door text, p_limit integer, p_default integer DEFAULT NULL::integer, p_ceiling integer DEFAULT NULL::integer\", returns: \"integer\", security: \"invoker\" },\n { name: \"parity_field_types\", args: \"\", returns: \"TABLE(parity_type text, behavior text, made_of text)\", security: \"invoker\" },\n { name: \"parity_type\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"parity_values\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(field_key text, field_id uuid, parity_type text, behavior text, unit text, format text, value jsonb, value_version integer, actor text, written_at timestamp with time zone)\", security: \"invoker\" },\n { name: \"per_value_access_words\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"person_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"phone_canonical\", args: \"p_text text\", returns: \"text\", security: \"invoker\" },\n { name: \"phone_display\", args: \"p_text text\", returns: \"text\", security: \"invoker\" },\n { name: \"phone_pattern\", args: \"\", returns: \"text\", security: \"invoker\" },\n { name: \"pin_agent_cells\", args: \"p_new jsonb, p_old jsonb, p_agent_keys text[]\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"pipeline_board\", args: \"p_organization_id uuid, p_table_id uuid, p_measure text DEFAULT NULL::text\", returns: \"TABLE(stage_key text, stage_label text, stage_position integer, cards bigint, total numeric, wip_limit integer, over_limit boolean)\", security: \"definer\" },\n { name: \"pipeline_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_spec jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_gate_preview\", args: \"p_organization_id uuid, p_table_id uuid, p_stage text, p_gate jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_move\", args: \"p_organization_id uuid, p_record_id uuid, p_to text, p_also jsonb DEFAULT '{}'::jsonb, p_expected_version integer DEFAULT NULL::integer\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_pending\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_read\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipeline_transition_refusal\", args: \"p_organization_id uuid, p_record_id uuid, p_to text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"pipelines\", args: \"p_organization_id uuid\", returns: \"TABLE(table_id uuid, table_name text, stage_field text, stage_label text, stages integer, rules integer, broken text, updated_at timestamp with time zone, updated_by uuid)\", security: \"definer\" },\n { name: \"portal_admits\", args: \"p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"portal_archive\", args: \"p_organization_id uuid, p_portal_id uuid, p_confirm_title text, p_reason text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_card\", args: \"p_organization_id uuid, p_portal_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_declare\", args: \"p_organization_id uuid, p_title text, p_client_table_id uuid, p_tables jsonb, p_portal_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text, p_sign_in_method text DEFAULT 'magic_link'::text\", returns: \"uuid\", security: \"definer\" },\n { name: \"portal_field_map\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(field_id uuid, field_key text, field_type text, points_at uuid)\", security: \"definer\" },\n { name: \"portal_invitation\", args: \"p_slug text, p_email text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_invite\", args: \"p_organization_id uuid, p_portal_id uuid, p_client_record_id uuid, p_email text, p_user_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_invite_accept\", args: \"p_token text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_me\", args: \"\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_preview\", args: \"p_organization_id uuid, p_portal_id uuid, p_principal_id uuid, p_table_id uuid\", returns: \"TABLE(record_id uuid, title text)\", security: \"definer\" },\n { name: \"portal_principal_bind\", args: \"p_organization_id uuid, p_principal_id uuid, p_user_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_public\", args: \"p_slug text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_record_title\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"portal_restore\", args: \"p_organization_id uuid, p_portal_id uuid, p_confirm_title text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_revoke\", args: \"p_organization_id uuid, p_portal_id uuid, p_principal_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"portal_slug\", args: \"p_organization_id uuid, p_title text, p_portal_id uuid DEFAULT NULL::uuid\", returns: \"text\", security: \"definer\" },\n { name: \"portal_tables\", args: \"p_organization_id uuid\", returns: \"TABLE(portal_id uuid, table_id uuid, name text)\", security: \"definer\" },\n { name: \"portals\", args: \"p_organization_id uuid\", returns: \"TABLE(portal_id uuid, title text, slug text, client_table_id uuid, client_table text, is_active boolean, tables integer, invited integer, signed_in integer, sign_in_method text, opened_at timestamp with time zone)\", security: \"definer\" },\n { name: \"presentation_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"promote_field\", args: \"p_organization_id uuid, p_table_id uuid, p_field_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"promote_table\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"promoted_field_cap\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"promoted_fields\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(field_id uuid, field_key text, parity_type text, is_unique boolean, value_path text, index_arm text, index_expr text, index_name text, indexable boolean, why_not text)\", security: \"invoker\" },\n { name: \"promoted_index_arm\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"promoted_index_ddl\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(step integer, purpose text, statement text)\", security: \"invoker\" },\n { name: \"promoted_index_expr\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"promoted_index_name\", args: \"p_table_id uuid, p_field_key text, p_unique boolean\", returns: \"text\", security: \"invoker\" },\n { name: \"promoted_query_sql\", args: \"p_organization_id uuid, p_table_id uuid, p_field_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"promoted_read\", args: \"p_organization_id uuid, p_table_id uuid, p_field_key text, p_value text\", returns: \"SETOF uuid\", security: \"invoker\" },\n { name: \"promoted_value_path\", args: \"p_field_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"promotion_inline_ceiling\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"provenance_prune\", args: \"p_organization_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true, p_limit integer DEFAULT 200000\", returns: \"jsonb\", security: \"definer\" },\n { name: \"provenance_retention_days\", args: \"p_organization_id uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"provenance_write\", args: \"p_organization_id uuid, p_conversation_id uuid, p_turn_id text, p_rows jsonb\", returns: \"integer\", security: \"definer\" },\n { name: \"query_access_ids\", args: \"p_organization_id uuid, p_required text DEFAULT 'viewer'::text\", returns: \"uuid[]\", security: \"invoker\" },\n { name: \"query_across_homes\", args: \"p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, home_record_id uuid, data jsonb, created_at timestamp with time zone)\", security: \"definer\" },\n { name: \"query_by_coordinates\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_coordinates jsonb DEFAULT '[]'::jsonb, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, table_id uuid, data jsonb, coordinates_matched integer)\", security: \"definer\" },\n { name: \"query_can_see\", args: \"p_organization_id uuid, p_record_id uuid, p_required text DEFAULT 'viewer'::text\", returns: \"boolean\", security: \"definer\" },\n { name: \"query_hot_paths\", args: \"\", returns: \"TABLE(name text, statement text)\", security: \"invoker\" },\n { name: \"query_hot_paths_prepared\", args: \"\", returns: \"TABLE(name text, prepared boolean, generic_plans bigint)\", security: \"invoker\" },\n { name: \"query_is_store_owner\", args: \"\", returns: \"boolean\", security: \"invoker\" },\n { name: \"query_prepare_hot\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"query_principal\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"query_record_as_of\", args: \"p_organization_id uuid, p_record_id uuid, p_recorded_at timestamp with time zone DEFAULT NULL::timestamp with time zone, p_world_on date DEFAULT NULL::date, p_required text DEFAULT 'viewer'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"query_relation_edges\", args: \"p_organization_id uuid, p_flavor text DEFAULT NULL::text, p_role text DEFAULT NULL::text\", returns: \"TABLE(parent_id uuid, child_id uuid, role text, flavor text)\", security: \"definer\" },\n { name: \"query_rollup\", args: \"p_organization_id uuid, p_roots uuid[], p_flavor text DEFAULT NULL::text, p_role text DEFAULT NULL::text, p_max_depth integer DEFAULT 33, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, depth integer)\", security: \"definer\" },\n { name: \"query_rollup_sum\", args: \"p_organization_id uuid, p_roots uuid[], p_field_key text, p_flavor text DEFAULT NULL::text, p_role text DEFAULT NULL::text, p_max_depth integer DEFAULT 33, p_required text DEFAULT 'viewer'::text\", returns: \"numeric\", security: \"definer\" },\n { name: \"query_table_as_of\", args: \"p_organization_id uuid, p_table_id uuid, p_recorded_at timestamp with time zone DEFAULT NULL::timestamp with time zone, p_world_on date DEFAULT NULL::date, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(record_id uuid, data jsonb)\", security: \"definer\" },\n { name: \"query_table_homes\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"SETOF uuid\", security: \"definer\" },\n { name: \"query_visibility_parity\", args: \"p_organization_id uuid\", returns: \"TABLE(side text, container_type text, container_id uuid, item_type text, item_id uuid, stored_level permission_level, derived_level permission_level, reason text)\", security: \"definer\" },\n { name: \"query_visible_ids\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_required text DEFAULT 'viewer'::text\", returns: \"SETOF uuid\", security: \"definer\" },\n { name: \"reachable_from\", args: \"p_organization_id uuid, p_roots uuid[]\", returns: \"TABLE(record_id uuid, depth integer, via text)\", security: \"invoker\" },\n { name: \"reaches_directly\", args: \"p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level\", returns: \"boolean\", security: \"definer\" },\n { name: \"read_door_carried_ids\", args: \"p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level, OUT o_ids uuid[], OUT o_containers integer\", returns: \"record\", security: \"definer\" },\n { name: \"read_door_granted_ids\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"uuid[]\", security: \"definer\" },\n { name: \"read_door_ladder_ceiling\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"read_door_parity\", args: \"p_organization_id uuid, p_table_id uuid, p_user uuid, p_required permission_level, p_sample integer\", returns: \"TABLE(record_id uuid, set_based boolean, per_row boolean, verdict text)\", security: \"definer\" },\n { name: \"read_mask\", args: \"p_organization_id uuid, p_record_id uuid, p_action text DEFAULT 'read'::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"read_paths_outside_the_door\", args: \"\", returns: \"TABLE(object_name text, why text)\", security: \"invoker\" },\n { name: \"read_record\", args: \"p_organization_id uuid, p_record_id uuid, p_by_id boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"read_records\", args: \"p_organization_id uuid, p_table_id uuid, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0\", returns: \"TABLE(id uuid, document jsonb, level permission_level)\", security: \"definer\" },\n { name: \"read_records_archived\", args: \"p_organization_id uuid, p_table_id uuid, p_lane text DEFAULT 'org'::text, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0\", returns: \"TABLE(id uuid, document jsonb, level permission_level, archived_at timestamp with time zone, archived_by uuid, archived_by_name text)\", security: \"definer\" },\n { name: \"read_records_by_ids\", args: \"p_organization_id uuid, p_table_id uuid, p_record_ids uuid[], p_by_id boolean DEFAULT false\", returns: \"TABLE(id uuid, document jsonb, level permission_level)\", security: \"definer\" },\n { name: \"read_records_matching\", args: \"p_organization_id uuid, p_table_id uuid, p_filter jsonb DEFAULT '{}'::jsonb, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0\", returns: \"TABLE(id uuid, document jsonb, level permission_level)\", security: \"definer\" },\n { name: \"realtime_topic_admits\", args: \"p_topic text\", returns: \"boolean\", security: \"definer\" },\n { name: \"record_aggregate\", args: \"p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 200, p_required text DEFAULT 'viewer'::text\", returns: \"TABLE(groups jsonb, measures jsonb, row_count bigint)\", security: \"definer\" },\n { name: \"record_applicability\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(rule_id uuid, rule_name text, rule_version integer, applies boolean, answer jsonb)\", security: \"invoker\" },\n { name: \"record_archiver\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"record_as_of\", args: \"p_organization_id uuid, p_record_id uuid, p_at timestamp with time zone\", returns: \"TABLE(state jsonb, replayed boolean)\", security: \"definer\" },\n { name: \"record_card\", args: \"p_viewer uuid, p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_carrying_edges\", args: \"p_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone\", returns: \"TABLE(container_id uuid, item_id uuid, edge_role text)\", security: \"invoker\" },\n { name: \"record_delete\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"timestamp with time zone\", security: \"definer\" },\n { name: \"record_filter_sql\", args: \"p_filter jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"record_history\", args: \"p_organization_id uuid, p_record_id uuid, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0\", returns: \"TABLE(version integer, occurred_at timestamp with time zone, operation text, operation_label text, actor jsonb, changes jsonb, migration_id uuid, undoable boolean)\", security: \"definer\" },\n { name: \"record_platform_keys\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"record_relation_edges\", args: \"p_organization_id uuid, p_id uuid, p_table_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone\", returns: \"TABLE(target_id uuid, edge_role text, field_id uuid, ord integer)\", security: \"invoker\" },\n { name: \"record_reparent\", args: \"p_organization_id uuid, p_record_id uuid, p_parent_id uuid\", returns: \"void\", security: \"definer\" },\n { name: \"record_resolve\", args: \"p_organization_id uuid, p_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_restore\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"void\", security: \"definer\" },\n { name: \"record_restore_preview\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer, p_field_key text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_restore_version\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_restore_version\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer, p_author jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_scope_context\", args: \"p_organization_id uuid, p_record_id uuid, p_relations integer DEFAULT 12, p_history integer DEFAULT 15, p_siblings integer DEFAULT 8\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_stage_pending\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_state_as_of\", args: \"p_record_id uuid, p_at timestamp with time zone\", returns: \"TABLE(state jsonb, replayed boolean)\", security: \"definer\" },\n { name: \"record_table\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"record_update\", args: \"p_organization_id uuid, p_record_id uuid, p_patch jsonb, p_expected_version integer DEFAULT NULL::integer\", returns: \"integer\", security: \"definer\" },\n { name: \"record_values\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"record_values_of\", args: \"p_row custom.record\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"record_values_versioned\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)\", security: \"definer\" },\n { name: \"record_words\", args: \"p_organization_id uuid, p_record_id uuid, p_noun text DEFAULT NULL::text\", returns: \"text\", security: \"definer\" },\n { name: \"record_write\", args: \"p_organization_id uuid, p_table_id uuid, p_data jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"record_write_graph\", args: \"p_organization_id uuid, p_table_id uuid, p_parent jsonb, p_edges jsonb DEFAULT '[]'::jsonb, p_children jsonb DEFAULT '[]'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"record_write_many\", args: \"p_organization_id uuid, p_table_id uuid, p_rows jsonb[], p_ids uuid[] DEFAULT NULL::uuid[]\", returns: \"uuid[]\", security: \"definer\" },\n { name: \"refusals_claiming_a_level_never_asked\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"relation_carry\", args: \"p_organization_id uuid, p_container_id uuid, p_item_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"relation_edges_withdraw\", args: \"p_organization_id uuid, p_field_ids uuid[], p_why text\", returns: \"integer\", security: \"definer\" },\n { name: \"relation_halves_disagreements\", args: \"p_organization_id uuid DEFAULT NULL::uuid, p_record_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(organization_id uuid, record_id uuid, field_key text, field_id uuid, target_id uuid, direction text, remedy text, why text)\", security: \"definer\" },\n { name: \"relation_halves_repair\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"relation_kernel_record\", args: \"p_organization_id uuid, p_kernel_table_id uuid, p_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"relation_own\", args: \"p_organization_id uuid, p_owner_id uuid, p_target_id uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"relation_target_card\", args: \"p_organization_id uuid, p_record_id uuid, p_via_key text DEFAULT NULL::text\", returns: \"TABLE(target_id uuid, target_organization_id uuid, is_foreign boolean, masked boolean, reader_level permission_level, card jsonb, why text)\", security: \"definer\" },\n { name: \"relation_target_external\", args: \"p_connection_token text, p_external_table text, p_external_key text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"relation_target_ours\", args: \"p_entity_token text, p_row_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"relation_targets\", args: \"p_organization_id uuid, p_record_id uuid, p_via_key text\", returns: \"SETOF uuid\", security: \"definer\" },\n { name: \"relation_uncarry\", args: \"p_organization_id uuid, p_container_id uuid, p_item_id uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"relation_value_target_ok\", args: \"p_organization_id uuid, p_field_id uuid, p_field_data jsonb, p_target_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"relation_words\", args: \"p_organization_id uuid, p_field_id uuid, p_value text\", returns: \"text\", security: \"definer\" },\n { name: \"relation_words_many\", args: \"p_organization_id uuid, p_field_id uuid, p_record_ids uuid[]\", returns: \"TABLE(record_id uuid, words text)\", security: \"definer\" },\n { name: \"reopen_declared_doors\", args: \"\", returns: \"TABLE(reopened text)\", security: \"definer\" },\n { name: \"required_epoch\", args: \"p_container_type text, p_container_id uuid, p_item_type text, p_item_id uuid\", returns: \"bigint\", security: \"definer\" },\n { name: \"resolve_first_match\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"resolve_id\", args: \"p_organization_id uuid, p_id uuid\", returns: \"uuid\", security: \"invoker\" },\n { name: \"retired_actor_words\", args: \"\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rollup_value\", args: \"p_organization_id uuid, p_record_id uuid, p_field_data jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"row_actions\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"rule_applies\", args: \"p_organization_id uuid, p_rule_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_context\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_declare\", args: \"p_organization_id uuid, p_spec jsonb, p_rule_id uuid DEFAULT NULL::uuid\", returns: \"uuid\", security: \"definer\" },\n { name: \"rule_dependency_edges\", args: \"p_organization_id uuid, p_row custom.record DEFAULT NULL::custom.record\", returns: \"TABLE(needs text, needed text)\", security: \"invoker\" },\n { name: \"rule_eval\", args: \"p_organization_id uuid, p_expr jsonb, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_field_key\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"rule_field_label\", args: \"p_organization_id uuid, p_field_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"rule_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"rule_members\", args: \"p_organization_id uuid, p_rule_id uuid\", returns: \"SETOF custom.record\", security: \"invoker\" },\n { name: \"rule_membership\", args: \"p_organization_id uuid, p_rule_id uuid, p_record_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_node_kinds\", args: \"\", returns: \"TABLE(node text, evaluated_by text, note text)\", security: \"invoker\" },\n { name: \"rule_run\", args: \"p_organization_id uuid, p_rule_id uuid, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"rule_truth\", args: \"p_answer jsonb\", returns: \"boolean\", security: \"invoker\" },\n { name: \"rule_uses\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"rule_version\", args: \"p_organization_id uuid, p_rule_id uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"said\", args: \"p_value text, p_when_there_is_none text\", returns: \"text\", security: \"invoker\" },\n { name: \"share_access\", args: \"p_organization_id uuid, p_subject_id uuid\", returns: \"TABLE(principal_kind text, principal_id uuid, principal_label text, level permission_level, reason text, reason_detail text, via_type text, via_id uuid, revocable boolean)\", security: \"definer\" },\n { name: \"share_grant\", args: \"p_organization_id uuid, p_subject_id uuid, p_principal_kind text, p_principal_id uuid, p_level permission_level DEFAULT 'viewer'::permission_level\", returns: \"jsonb\", security: \"definer\" },\n { name: \"share_lane_set\", args: \"p_organization_id uuid, p_subject_id uuid, p_choice text, p_level permission_level DEFAULT NULL::permission_level\", returns: \"jsonb\", security: \"definer\" },\n { name: \"share_lanes\", args: \"\", returns: \"TABLE(choice text, lane text, discoverable boolean, label text, means text)\", security: \"definer\" },\n { name: \"share_levels\", args: \"\", returns: \"TABLE(level permission_level, ordinal integer, label text, means text)\", security: \"definer\" },\n { name: \"share_people\", args: \"p_organization_id uuid, p_subject_id uuid DEFAULT NULL::uuid, p_query text DEFAULT NULL::text, p_limit integer DEFAULT 25\", returns: \"TABLE(user_id uuid, email text, display_name text, membership text, already_at permission_level, already_why text)\", security: \"definer\" },\n { name: \"share_revoke\", args: \"p_organization_id uuid, p_subject_id uuid, p_principal_kind text, p_principal_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"share_subject_name\", args: \"p_organization_id uuid, p_type text, p_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"shared_only_disagreements\", args: \"p_pretend text DEFAULT NULL::text\", returns: \"TABLE(organization_id uuid, organization_name text, member_id uuid, record_id uuid, table_id uuid, ladder boolean, read_door boolean, rls_mirror boolean, why text)\", security: \"invoker\" },\n { name: \"shares_outside\", args: \"p_organization_id uuid\", returns: \"TABLE(invitation_id uuid, table_id uuid, table_name text, email text, level text, level_label text, status text, joined boolean, expired boolean, invited_at timestamp with time zone, expires_at timestamp with time zone, say text)\", security: \"definer\" },\n { name: \"sign_request_cancel\", args: \"p_organization_id uuid, p_request_id uuid, p_reason text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_create\", args: \"p_organization_id uuid, p_render_id uuid, p_field_key text, p_signer_email text, p_signer_name text, p_expires_in interval DEFAULT '14 days'::interval\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_decline\", args: \"p_token text, p_reason text DEFAULT NULL::text, p_ip text DEFAULT NULL::text, p_user_agent text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_public\", args: \"p_token text, p_origin text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_remind\", args: \"p_organization_id uuid, p_request_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_sentence\", args: \"p_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"sign_request_sign\", args: \"p_token text, p_signed_name text, p_mark text, p_image text DEFAULT NULL::text, p_ip text DEFAULT NULL::text, p_user_agent text DEFAULT NULL::text, p_origin text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"sign_request_state\", args: \"p_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"sign_request_unchanged\", args: \"p_organization_id uuid, p_request_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"sign_requests\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(request_id uuid, render_id uuid, record_id uuid, field_key text, document_title text, signer_name text, signer_email text, signer_has_account boolean, state text, sentence text, document_version integer, document_hash text, sent_at timestamp with time zone, expires_at timestamp with time zone, viewed_at timestamp with time zone, signed_at timestamp with time zone, declined_at timestamp with time zone, invalidated_at timestamp with time zone, signature_id uuid, signature_mark text, reminder_count integer)\", security: \"definer\" },\n { name: \"sign_token_decode\", args: \"p_token text\", returns: \"bytea\", security: \"invoker\" },\n { name: \"sign_token_encode\", args: \"p_bytes bytea\", returns: \"text\", security: \"invoker\" },\n { name: \"silent_page_doors\", args: \"\", returns: \"TABLE(door text, why text)\", security: \"definer\" },\n { name: \"size_refusal\", args: \"p_organization_id uuid, p_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"source_next_pointer\", args: \"p_sources jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"source_pointer\", args: \"p_sources jsonb, p_source jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"stage_rule_enforcement\", args: \"p_organization_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"stage_rule_on_fail_kinds\", args: \"\", returns: \"TABLE(behaviour text, note text)\", security: \"invoker\" },\n { name: \"stamp_value_envelopes\", args: \"p_data jsonb, p_actor text, p_on_behalf_of text, p_at timestamp with time zone\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"storage_modes\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"store_is_open\", args: \"p_organization_id uuid DEFAULT NULL::uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"store_off_sentence\", args: \"p_organization_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"subscription_cadences\", args: \"p_organization_id uuid\", returns: \"text[]\", security: \"definer\" },\n { name: \"subscription_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"subscription_mute\", args: \"p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true\", returns: \"boolean\", security: \"definer\" },\n { name: \"subscription_preview\", args: \"p_organization_id uuid, p_rule_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"subscriptions\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(rule_id uuid, name text, table_id uuid, saved_view_id uuid, cadence text, schedule text, quiet_hours jsonb, channel text, recipient_user_id uuid, event_key text, muted boolean, mine boolean, i_may_mute boolean, last_sent_at timestamp with time zone, next_digest_at timestamp with time zone)\", security: \"definer\" },\n { name: \"table_archive\", args: \"p_organization_id uuid, p_table_id uuid, p_chunk integer DEFAULT 50, p_include_table boolean DEFAULT true\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_capacity\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_carries_its_rows\", args: \"p_user_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level\", returns: \"boolean\", security: \"definer\" },\n { name: \"table_column_source\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"table_contents\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(record_id uuid, kind text, goes_at integer)\", security: \"invoker\" },\n { name: \"table_declare\", args: \"p_organization_id uuid, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"table_decorate\", args: \"p_organization_id uuid, p_table_id uuid, p_path text[], p_value jsonb DEFAULT NULL::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_decorations\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_facts\", args: \"p_organization_id uuid\", returns: \"TABLE(table_id uuid, visibility text, mine boolean)\", security: \"definer\" },\n { name: \"table_from_example\", args: \"p_organization_id uuid, p_home_id uuid, p_example jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_has_a_visible_record\", args: \"p_user uuid, p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"table_is_live\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"table_is_options_table\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"invoker\" },\n { name: \"table_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"table_record_ceiling\", args: \"\", returns: \"integer\", security: \"invoker\" },\n { name: \"table_record_ceiling\", args: \"p_organization_id uuid\", returns: \"integer\", security: \"invoker\" },\n { name: \"table_rules\", args: \"p_organization_id uuid, p_table_id uuid, p_use text, p_record_type text DEFAULT NULL::text\", returns: \"SETOF custom.record\", security: \"invoker\" },\n { name: \"table_share_outside\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_share_outside_accept\", args: \"p_token text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_share_outside_for_me\", args: \"\", returns: \"TABLE(invitation_id uuid, organization_id uuid, organization text, table_id uuid, table_name text, level text, level_label text, token text, expires_at timestamp with time zone, say text)\", security: \"definer\" },\n { name: \"table_share_outside_invite\", args: \"p_organization_id uuid, p_table_id uuid, p_email text, p_level permission_level DEFAULT 'viewer'::permission_level\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_share_outside_resend\", args: \"p_organization_id uuid, p_invitation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_share_outside_revoke\", args: \"p_organization_id uuid, p_invitation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_stage_field\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"table_storage\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"table_type_field\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"table_unique_rule_fields\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"table_webhook_archive\", args: \"p_organization_id uuid, p_webhook_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"table_webhook_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_target_url text, p_events text[] DEFAULT NULL::text[], p_description text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"table_webhooks\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(webhook_id uuid, target_url text, description text, events text[], is_active boolean, last_attempt_at timestamp with time zone, last_success_at timestamp with time zone, consecutive_failures integer, owner_id uuid, created_at timestamp with time zone)\", security: \"definer\" },\n { name: \"table_work_kind\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"tables_at_home\", args: \"p_organization_id uuid, p_home_ids uuid[]\", returns: \"TABLE(table_id uuid, home_record_id uuid, kind text)\", security: \"definer\" },\n { name: \"tables_described_without_asking\", args: \"\", returns: \"TABLE(function_name text, identity_args text, why text)\", security: \"invoker\" },\n { name: \"tables_shared_with_me\", args: \"\", returns: \"TABLE(table_id uuid, organization_id uuid, organization text, table_name text, level text, level_label text, shared_at timestamp with time zone, opens boolean, say text)\", security: \"definer\" },\n { name: \"trg_associations_bump_visibility\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"undeclared_keys\", args: \"p_organization_id uuid, p_table_id uuid, p_data jsonb\", returns: \"text[]\", security: \"invoker\" },\n { name: \"validate_custom_fields\", args: \"p_token text, p_organization_id uuid, p_values jsonb\", returns: \"void\", security: \"invoker\" },\n { name: \"validate_value_envelope\", args: \"p_organization_id uuid, p_fields custom.record[], p_data jsonb\", returns: \"void\", security: \"invoker\" },\n { name: \"validate_values\", args: \"p_organization_id uuid, p_fields custom.record[], p_values jsonb, p_record_type text DEFAULT NULL::text\", returns: \"void\", security: \"invoker\" },\n { name: \"value_alternate_keys\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"value_envelope_keys\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"value_envelope_ok\", args: \"p_data jsonb\", returns: \"boolean\", security: \"invoker\" },\n { name: \"value_envelope_refusal\", args: \"p_data jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"value_read\", args: \"p_organization_id uuid, p_record_id uuid, p_key text\", returns: \"TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)\", security: \"definer\" },\n { name: \"value_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_field_key text, p_version integer\", returns: \"jsonb\", security: \"definer\" },\n { name: \"value_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_field_key text, p_version integer, p_author jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"value_versions\", args: \"p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"view_declare\", args: \"p_organization_id uuid, p_table_id uuid, p_spec jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"views\", args: \"p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(view_id uuid, name text, table_id uuid, filters jsonb, definition jsonb, created_at timestamp with time zone)\", security: \"definer\" },\n { name: \"visibility_ancestors\", args: \"p_item_type text, p_item_id uuid\", returns: \"TABLE(container_type text, container_id uuid, depth integer, max_level permission_level)\", security: \"definer\" },\n { name: \"visibility_as_of\", args: \"p_organization_id uuid, p_record_id uuid, p_at timestamp with time zone\", returns: \"TABLE(principal_kind text, principal_id uuid, level permission_level, through_kind text, through_id uuid, reason text, replayed boolean, held_from timestamp with time zone, held_to timestamp with time zone)\", security: \"definer\" },\n { name: \"visibility_cache_rebuild\", args: \"\", returns: \"integer\", security: \"definer\" },\n { name: \"visibility_parity\", args: \"\", returns: \"TABLE(side text, container_type text, container_id uuid, item_type text, item_id uuid, stored_level permission_level, derived_level permission_level, reason text)\", security: \"definer\" },\n { name: \"visibility_warm\", args: \"p_container_type text, p_container_id uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"visible_predicate_sql\", args: \"p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, p_alias text DEFAULT 'r'::text\", returns: \"text\", security: \"definer\" },\n { name: \"visible_record_ids\", args: \"p_user_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level\", returns: \"TABLE(id uuid)\", security: \"definer\" },\n { name: \"visible_set\", args: \"p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, OUT o_all_visible boolean, OUT o_true_visibility platform.visibility[], OUT o_granted_all uuid[], OUT o_granted_visible uuid[], OUT o_carried_visible uuid[], OUT o_ladder_calls integer, OUT o_fallback boolean, OUT o_note text\", returns: \"record\", security: \"definer\" },\n { name: \"widget_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\n { name: \"withheld_marker\", args: \"p_mask jsonb, p_key text\", returns: \"jsonb\", security: \"invoker\" },\n { name: \"withheld_sentence\", args: \"p_mask jsonb, p_key text\", returns: \"text\", security: \"invoker\" },\n { name: \"work_approval_approvers\", args: \"p_organization_id uuid, p_subject_id uuid, p_approver_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(user_id uuid, name text, why text)\", security: \"definer\" },\n { name: \"work_approval_decide\", args: \"p_organization_id uuid, p_approval_id uuid, p_approve boolean, p_note text DEFAULT NULL::text\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_approval_kinds\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"work_approval_may_decide\", args: \"p_organization_id uuid, p_approval_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"work_approval_read\", args: \"p_organization_id uuid, p_approval_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_approval_request\", args: \"p_organization_id uuid, p_subject_id uuid, p_change jsonb, p_note text DEFAULT NULL::text, p_approver_id uuid DEFAULT NULL::uuid, p_origin text DEFAULT 'person'::text, p_conversation_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_assign\", args: \"p_organization_id uuid, p_record_id uuid, p_assignee_user_id uuid, p_due_date timestamp with time zone DEFAULT NULL::timestamp with time zone, p_clear_due boolean DEFAULT false\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_assignment_fields\", args: \"p_options_table_id uuid DEFAULT NULL::uuid\", returns: \"TABLE(key text, label text, spec jsonb)\", security: \"invoker\" },\n { name: \"work_has_assignment\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"work_inbox\", args: \"p_organization_id uuid, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_include_decided boolean DEFAULT false\", returns: \"TABLE(item_id uuid, kind text, origin text, title text, subject_id uuid, subject_kind text, summary text, state text, due_on timestamp with time zone, due_state text, actionable boolean, requested_by uuid, requested_by_name text, at timestamp with time zone)\", security: \"definer\" },\n { name: \"work_instantiation_shape\", args: \"p_organization_id uuid, p_instantiation_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_list\", args: \"p_organization_id uuid, p_flavour text DEFAULT 'mine'::text, p_include_finished boolean DEFAULT false, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0\", returns: \"TABLE(record_id uuid, table_id uuid, table_name text, title text, assignee_id uuid, assignee_name text, assignee_user_id uuid, due_on timestamp with time zone, due_state text, status text, terminal boolean, assigned_by uuid, updated_at timestamp with time zone)\", security: \"definer\" },\n { name: \"work_person\", args: \"p_organization_id uuid, p_user_id uuid, p_create boolean DEFAULT true\", returns: \"uuid\", security: \"definer\" },\n { name: \"work_record_states\", args: \"p_organization_id uuid, p_record_id uuid\", returns: \"TABLE(state_id uuid, name text, sort integer, terminal boolean, is_current boolean, allowed boolean, refusal text)\", security: \"definer\" },\n { name: \"work_relation_kinds\", args: \"\", returns: \"TABLE(kind text, available boolean, why text)\", security: \"invoker\" },\n { name: \"work_set_state\", args: \"p_organization_id uuid, p_record_id uuid, p_state_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_slot_expire\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"integer\", security: \"definer\" },\n { name: \"work_slot_hold\", args: \"p_organization_id uuid, p_table_id uuid, p_slot_key text, p_holder text, p_ttl interval DEFAULT '00:15:00'::interval\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_slot_holds\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"TABLE(hold_id uuid, slot_key text, holder text, expires_at timestamp with time zone, expired boolean)\", security: \"definer\" },\n { name: \"work_slot_index_name\", args: \"p_table_id uuid\", returns: \"text\", security: \"invoker\" },\n { name: \"work_slot_release\", args: \"p_organization_id uuid, p_hold_id uuid\", returns: \"boolean\", security: \"definer\" },\n { name: \"work_slots_declare\", args: \"p_organization_id uuid, p_name text, p_slug text, p_home_id uuid DEFAULT NULL::uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_state_id\", args: \"p_organization_id uuid, p_table_id uuid, p_value text\", returns: \"uuid\", security: \"invoker\" },\n { name: \"work_states\", args: \"\", returns: \"TABLE(sort integer, name text, terminal boolean, next text[])\", security: \"invoker\" },\n { name: \"work_take_assignment\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_template_declare\", args: \"p_organization_id uuid, p_name text, p_graph jsonb\", returns: \"uuid\", security: \"definer\" },\n { name: \"work_template_instantiate\", args: \"p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_template_refusal\", args: \"p_graph jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"work_template_shape\", args: \"p_organization_id uuid, p_template_id uuid\", returns: \"jsonb\", security: \"definer\" },\n { name: \"work_templates\", args: \"p_organization_id uuid, p_limit integer DEFAULT 100\", returns: \"TABLE(template_id uuid, name text, nodes integer, relations integer, created_at timestamp with time zone)\", security: \"definer\" },\n { name: \"work_transition_refusal\", args: \"p_organization_id uuid, p_from_state_id uuid, p_to_state_id uuid\", returns: \"text\", security: \"definer\" },\n { name: \"work_whose_turn\", args: \"p_organization_id uuid, p_table_id uuid, p_include_finished boolean DEFAULT false\", returns: \"TABLE(record_id uuid, title text, assignee_id uuid, turn text, due_on timestamp with time zone, state text, status text, terminal boolean)\", security: \"definer\" },\n] as const;\n\n/** The campaign's own knobs, with the value the store resolves them to today. */\nexport const STORE_KNOBS = [\n { key: \"accessible_entity_ids_guard\", value: \"true\", type: \"boolean\" },\n { key: \"action_run_records_max\", value: \"5000\", type: \"integer\" },\n { key: \"agent_schema_changes\", value: \"\\\"ask\\\"\", type: \"string\" },\n { key: \"associations_guard\", value: \"true\", type: \"boolean\" },\n { key: \"code_paths_enabled\", value: \"true\", type: \"boolean\" },\n { key: \"consumer_chat_seeding_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_checkout_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_context_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_education_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_extension_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_grid_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_retirement_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_saved_ai_outputs_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_scopes_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"containment_depth_ceiling\", value: \"16\", type: \"integer\" },\n { key: \"cross_organization_links\", value: \"false\", type: \"boolean\" },\n { key: \"decoration_rules_max\", value: \"50\", type: \"integer\" },\n { key: \"decorations_max_bytes\", value: \"262144\", type: \"integer\" },\n { key: \"document_letterhead\", value: \"{}\", type: \"json\" },\n { key: \"document_max_bytes\", value: \"1048576\", type: \"integer\" },\n { key: \"emergency_door_guard\", value: \"false\", type: \"boolean\" },\n { key: \"emergency_door_sweep_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"enrichment_batch_ceiling\", value: \"200\", type: \"integer\" },\n { key: \"enrichment_confidence_floor\", value: \"0.6\", type: \"number\" },\n { key: \"enrichment_cost_cap_cents\", value: \"2000\", type: \"integer\" },\n { key: \"enrichment_model\", value: \"\\\"claude-fable-5-latest\\\"\", type: \"string\" },\n { key: \"enrichment_sensitivity_ceiling\", value: \"\\\"internal\\\"\", type: \"string\" },\n { key: \"entity_custom_fields_guard\", value: \"false\", type: \"boolean\" },\n { key: \"entity_types_guard\", value: \"false\", type: \"boolean\" },\n { key: \"example_rows_max\", value: \"500\", type: \"integer\" },\n { key: \"export_rows_ceiling\", value: \"100000\", type: \"integer\" },\n { key: \"external_principal_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"field_index_guard\", value: \"false\", type: \"boolean\" },\n { key: \"field_sensitivity_levels\", value: \"{\\\"edit\\\": {\\\"public\\\": \\\"editor\\\", \\\"internal\\\": \\\"editor\\\", \\\"restricted\\\": \\\"admin\\\", \\\"confidential\\\": \\\"admin\\\"}, \\\"read\\\": {\\\"public\\\": \\\"viewer\\\", \\\"internal\\\": \\\"viewer\\\", \\\"restricted\\\": \\\"admin\\\", \\\"confidential\\\": \\\"editor\\\"}}\", type: \"json\" },\n { key: \"grid_layout\", value: \"{\\\"mode\\\": \\\"auto\\\", \\\"wrap\\\": false, \\\"row_height\\\": \\\"normal\\\", \\\"fit_max_columns\\\": 8, \\\"freeze_first_column\\\": false}\", type: \"json\" },\n { key: \"inbound_domain\", value: \"\\\"inbound.matrxserver.com\\\"\", type: \"string\" },\n { key: \"member_default_level\", value: \"\\\"viewer\\\"\", type: \"enum\" },\n { key: \"member_default_visibility\", value: \"\\\"all_records\\\"\", type: \"enum\" },\n { key: \"outside_invite_who\", value: \"\\\"org_admins_and_table_owners\\\"\", type: \"string\" },\n { key: \"page_size_ceiling\", value: \"1000\", type: \"integer\" },\n { key: \"provenance_retention_days\", value: \"30\", type: \"number\" },\n { key: \"records_tool_default\", value: \"true\", type: \"boolean\" },\n { key: \"row_action_steps_max\", value: \"60\", type: \"integer\" },\n { key: \"row_actions_max\", value: \"24\", type: \"integer\" },\n { key: \"row_versions_guard\", value: \"false\", type: \"boolean\" },\n { key: \"sandbox_expanded_frame_height_px\", value: \"20000\", type: \"integer\" },\n { key: \"sandbox_frame_height_px\", value: \"4000\", type: \"integer\" },\n { key: \"sandbox_message_bytes\", value: \"65536\", type: \"integer\" },\n { key: \"sandbox_org_components\", value: \"true\", type: \"boolean\" },\n { key: \"signup_provisioning_guard\", value: \"false\", type: \"boolean\" },\n { key: \"stage_rule_enforcement\", value: \"\\\"refuse\\\"\", type: \"enum\" },\n { key: \"system_enabled\", value: \"true\", type: \"boolean\" },\n { key: \"table_record_ceiling\", value: \"150000\", type: \"integer\" },\n { key: \"table_webhooks_max\", value: \"10\", type: \"integer\" },\n { key: \"value_max_bytes\", value: \"100000\", type: \"integer\" },\n { key: \"world_publish_enabled\", value: \"false\", type: \"boolean\" },\n] as const;\n\n/**\n * Every SQLSTATE the store's own function bodies raise, with the functions that\n * raise it. This is the list the client's refusal mapper is checked against: a\n * code the store can raise and the package cannot name is a hole, and the\n * real-door suite says so by name.\n */\nexport const STORE_REFUSAL_CODES = [\n { code: \"02000\", raised_by: \"_checklist_instantiate,_portal_invite_payload,_share_write_person,_table_share_invite_payload,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_archive,portal_card,portal_declare,portal_invite,portal_invite_accept,portal_preview,portal_principal_bind,portal_restore,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_halves_repair,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_archive,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state\" },\n { code: \"0A000\", raised_by: \"checklist_step_complete,external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign\" },\n { code: \"22003\", raised_by: \"context_resolve\" },\n { code: \"22004\", raised_by: \"_entity_custom_fields_guard,_share_write_person,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_purge_hard,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_graph,record_write_many,relation_carry,relation_halves_repair,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_archive,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare\" },\n { code: \"22007\", raised_by: \"dashboard_window_sql\" },\n { code: \"22012\", raised_by: \"formula_eval,rule_eval\" },\n { code: \"22023\", raised_by: \"_action_check,_booking_availability,_decorations_check,_entity_custom_fields_guard,_fx_date,_fx_num,_fx_unit,_fxp_level,_fxp_resolve,_fxp_tokens,_take_op_id,_value_envelope,_work_shape_guard,action_run,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,field_update,formula_eval,formula_parse,grid_layout_check,hub_changed_by,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,list_portals,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,read_records_archived,record_update,record_write_graph,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_from_example,table_rules,table_webhook_declare,visibility_as_of,work_approval_request,work_list,work_slot_hold\" },\n { code: \"23503\", raised_by: \"_action_check,_booking_availability,_checklist_instantiate,_containment_guard,_decorations_check,_display_spec_for,_field_document_for,_field_type_parity_guard,_pipeline_stage_key,_record_rule_uses,action_declare,action_run,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,autonumber_backfill,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,grid_layout,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,table_decorate,table_from_example,table_webhook_archive,table_webhook_declare,view_declare,work_set_state,work_take_assignment,work_template_instantiate\" },\n { code: \"23505\", raised_by: \"_share_write_person,_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,sign_request_cancel,sign_request_create,table_share_outside_resend,work_approval_decide,work_slot_hold\" },\n { code: \"23514\", raised_by: \"_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_format_check,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_relation_halves_agree,_relation_kernel_targets,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,action_run,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_comment_write,io_import_rows,migrate_merge,migrate_purge_hard,portal_archive,portal_restore,record_write_graph,relation_carry,relation_halves_repair,relation_own,sign_request_create,sign_request_sign,table_declare,table_from_example,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate\" },\n { code: \"40001\", raised_by: \"has_visibility_at\" },\n { code: \"42501\", raised_by: \"_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,agent_table_claim,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,doc_sign,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_purge_hard,migrate_purge_hard_request,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_invite_accept,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_archived,read_records_by_ids,read_records_matching,record_table,record_write_graph,relation_halves_disagreements,relation_halves_repair,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_webhook_declare,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person\" },\n { code: \"42703\", raised_by: \"entity_table,portal_declare\" },\n { code: \"53400\", raised_by: \"anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field\" },\n { code: \"54000\", raised_by: \"action_run,hub_changed_by,table_decorate,table_from_example,table_webhook_declare\" },\n { code: \"54001\", raised_by: \"record_delete\" },\n { code: \"P0001\", raised_by: \"action_run\" },\n { code: \"PT409\", raised_by: \"record_update\" },\n { code: \"PT428\", raised_by: \"_record_rule_uses\" },\n] as const;\n\n/** `platform.entity_types` — the registered tokens a Table or relation may name. */\nexport const ENTITY_TOKENS = [\n \"access_delta_probe\",\n \"access_delta_run\",\n \"access_request\",\n \"account_addon\",\n \"acquisition_block\",\n \"activity\",\n \"admin_audit_log\",\n \"admin_email_log\",\n \"admin_markdown_sample\",\n \"admin_user\",\n \"admission_config\",\n \"agent\",\n \"agent_card\",\n \"agent_definition_version\",\n \"agent_drift_alert\",\n \"agent_exemplar\",\n \"agent_mandate_note\",\n \"agent_prompt_remediation\",\n \"agent_provision_legacy\",\n \"agent_run\",\n \"agent_run_stage\",\n \"agent_schedule\",\n \"agent_schedule_claim\",\n \"agent_shortcut\",\n \"agent_surface_binding\",\n \"agent_template\",\n \"agent_term_list\",\n \"agent_usage\",\n \"agent_user_kv\",\n \"ai_api\",\n \"ai_endpoint\",\n \"ai_model\",\n \"ai_model_alias\",\n \"ai_offering\",\n \"ai_provider\",\n \"ai_setting\",\n \"analysis_result\",\n \"anon_form\",\n \"anon_function_birth_grandfather\",\n \"anon_hit\",\n \"anon_inbound\",\n \"anon_replay\",\n \"anon_submission\",\n \"anon_token\",\n \"api_field_warning\",\n \"api_request_log\",\n \"app\",\n \"app_config\",\n \"app_config_history\",\n \"app_definition_version\",\n \"app_error\",\n \"app_execution\",\n \"app_instance\",\n \"app_log\",\n \"app_log_muted_pattern\",\n \"app_log_norm_exception\",\n \"app_rate_limit\",\n \"app_setting\",\n \"app_sync_status\",\n \"approach\",\n \"artifact\",\n \"assessment\",\n \"assessment_item\",\n \"assessment_result\",\n \"assignment_session\",\n \"assist\",\n \"assist_producer_policy\",\n \"assist_producer_policy_history\",\n \"association_type\",\n \"assurance_level\",\n \"attempt\",\n \"audit_broken_functions\",\n \"audit_canonical_findings\",\n \"audit_exemption\",\n \"audit_function_deps\",\n \"audit_function_runtime_probe\",\n \"audit_m2m_candidates\",\n \"audit_refresh_log\",\n \"audit_stale_registry\",\n \"audit_unregistered_candidates\",\n \"bak_assoc_file_processed_document_20260812\",\n \"bak_assoc_type_file_processed_document_20260812\",\n \"bak_organization_name_dd043\",\n \"base_entity_template\",\n \"batch_cost_event\",\n \"batch_provider_batch\",\n \"batch_work_item\",\n \"billing_capability\",\n \"billing_capability_limit\",\n \"billing_connect_account\",\n \"billing_customer\",\n \"billing_plan\",\n \"billing_plan_limit\",\n \"billing_price\",\n \"billing_product\",\n \"billing_spend_guardrail\",\n \"billing_stripe_event\",\n \"billing_subscription\",\n \"billing_usage_ledger\",\n \"billing_user_plan\",\n \"browser_account_binding\",\n \"browser_action_event\",\n \"browser_authenticator_window\",\n \"browser_capture\",\n \"browser_control_request\",\n \"browser_handoff\",\n \"browser_login_attempt\",\n \"browser_login_recipe\",\n \"browser_profile\",\n \"browser_profile_checkpoint\",\n \"browser_run\",\n \"browser_site_observation\",\n \"browser_site_policy\",\n \"browser_stream_ticket\",\n \"build_lock\",\n \"calendar_event\",\n \"canvas_comment\",\n \"canvas_comment_like\",\n \"canvas_item\",\n \"canvas_item_state\",\n \"canvas_like\",\n \"canvas_score\",\n \"canvas_view\",\n \"capture_window\",\n \"carrying_rule\",\n \"catalog_entries_history\",\n \"catalog_entry\",\n \"category\",\n \"change_type_default\",\n \"chat_user_usage_summary\",\n \"citations\",\n \"class_purchase\",\n \"classifier_revision_ledger\",\n \"client_callable_door\",\n \"client_callable_door_retirement\",\n \"client_excluded_column_unregistered\",\n \"cmp_entry\",\n \"cmp_feedback\",\n \"code_file\",\n \"code_folder\",\n \"code_repository\",\n \"coding_session\",\n \"coding_session_entry\",\n \"comment\",\n \"commerce_asset_allocation\",\n \"commerce_asset_grading\",\n \"commerce_asset_identifier\",\n \"commerce_asset_lot_event\",\n \"commerce_asset_mandate_result\",\n \"commerce_asset_price_factor\",\n \"commerce_asset_reshoot_request\",\n \"commerce_asset_review\",\n \"commerce_asset_unknown\",\n \"commerce_certified_printer\",\n \"commerce_cloud_sync_connection\",\n \"commerce_ebay_business_policy\",\n \"commerce_ebay_category\",\n \"commerce_ebay_category_aspect\",\n \"commerce_ebay_category_tree\",\n \"commerce_ebay_custom_policy\",\n \"commerce_ebay_inventory_item\",\n \"commerce_ebay_inventory_item_group\",\n \"commerce_ebay_inventory_item_group_member\",\n \"commerce_ebay_inventory_location\",\n \"commerce_ebay_listing\",\n \"commerce_ebay_marketplace_policy\",\n \"commerce_ebay_media_asset\",\n \"commerce_ebay_notification_destination\",\n \"commerce_ebay_notification_event\",\n \"commerce_ebay_notification_subscription\",\n \"commerce_ebay_notification_topic\",\n \"commerce_ebay_offer\",\n \"commerce_ebay_order\",\n \"commerce_ebay_order_line_item\",\n \"commerce_ebay_shipping_fulfillment\",\n \"commerce_ebay_store_category\",\n \"commerce_human_correction\",\n \"commerce_intake_artifact\",\n \"commerce_intake_asset\",\n \"commerce_intake_batch\",\n \"commerce_label_batch\",\n \"commerce_label_code\",\n \"commerce_marketplace_account\",\n \"commerce_marketplace_account_deletion_audit\",\n \"commerce_marketplace_api_call\",\n \"commerce_marketplace_rate_budget\",\n \"commerce_marketplace_site\",\n \"commerce_marketplace_sync_run\",\n \"commerce_prediction_outcome\",\n \"commerce_print_order\",\n \"commerce_product\",\n \"commerce_product_channel_ref\",\n \"commerce_product_media\",\n \"commerce_product_variant\",\n \"commerce_recall_audit\",\n \"comparison_set\",\n \"component_group\",\n \"contact_medium\",\n \"contact_submission\",\n \"content_certification\",\n \"content_ir_kind\",\n \"content_ir_kind_component\",\n \"content_ir_kind_component_incident\",\n \"content_ir_kind_conformance\",\n \"content_ir_kind_edge\",\n \"content_ir_kind_example\",\n \"content_ir_kind_instance\",\n \"content_ir_kind_surface\",\n \"content_lane\",\n \"context_access_log\",\n \"context_item\",\n \"context_item_suggestion\",\n \"context_item_value\",\n \"context_value_refs\",\n \"conversation\",\n \"conversation_value\",\n \"courts\",\n \"credential_attachment\",\n \"credential_item\",\n \"credential_mutation_receipt\",\n \"crm_address\",\n \"crm_affiliation\",\n \"crm_blocklist_entry\",\n \"crm_contact_candidate\",\n \"crm_deal\",\n \"crm_deal_stage_event\",\n \"crm_enrichment_call\",\n \"crm_interaction\",\n \"crm_merge_candidate\",\n \"crm_outreach_list\",\n \"crm_outreach_list_member\",\n \"crm_party_merge\",\n \"crm_registry_ingest_run\",\n \"crm_registry_source\",\n \"crm_saved_view\",\n \"crm_sending_event\",\n \"crm_sending_identity\",\n \"crm_sending_identity_check\",\n \"crm_sending_policy\",\n \"custom_entity_definition\",\n \"custom_field_definition\",\n \"custom_field_target\",\n \"custom_record\",\n \"cx_agent_memory\",\n \"cx_agent_plan\",\n \"cx_agent_task\",\n \"cx_code_edit\",\n \"cx_code_message_file\",\n \"cx_conversation_documents\",\n \"cx_media\",\n \"cx_observational_memory\",\n \"cx_observational_memory_event\",\n \"cx_pending_injection\",\n \"cx_request\",\n \"cx_request_snapshot\",\n \"cx_tool_trace\",\n \"cx_user_request\",\n \"cx_user_todo\",\n \"dashboard_saved_view\",\n \"data_rights_event\",\n \"data_store\",\n \"data_store_members\",\n \"dataset\",\n \"dd171_containment_baseline\",\n \"dd175_cast\",\n \"dd175_component_lane_baseline\",\n \"ddl_guard_log\",\n \"deck_suggestion\",\n \"definer_class_exemption\",\n \"definer_client_grant_grandfather\",\n \"definer_grant_baseline\",\n \"deprecated_relation\",\n \"derive_run\",\n \"dev_login_audit\",\n \"dict_entry\",\n \"dict_provider_publication\",\n \"dict_setting\",\n \"dm_conversation\",\n \"dm_message\",\n \"dm_participant\",\n \"doc_render\",\n \"doc_signature\",\n \"dockets\",\n \"domain_classification\",\n \"edge_payload_kind\",\n \"egress_device\",\n \"egress_pairing\",\n \"egress_ticket\",\n \"emails\",\n \"embedding_cache\",\n \"embeddings_google_gemini_2_1536\",\n \"embeddings_oai_3_small_1536\",\n \"embeddings_voyage_4_large_1024\",\n \"embeddings_voyage_code_3_1024\",\n \"endpoint_family_sweep_state\",\n \"engine_owner_task\",\n \"entity_grant\",\n \"entity_relationship\",\n \"entity_type\",\n \"esign_campaign\",\n \"esign_campaign_member\",\n \"esign_consent_disclosure\",\n \"esign_envelope\",\n \"esign_envelope_certificate\",\n \"esign_envelope_document\",\n \"esign_envelope_event\",\n \"esign_envelope_external_ref\",\n \"esign_envelope_signer\",\n \"esign_provider\",\n \"esign_provider_binding\",\n \"esign_signing_key\",\n \"execution_event_cursor\",\n \"extension_auth_code\",\n \"external_link\",\n \"external_source\",\n \"extract_sweep_state\",\n \"fc_card\",\n \"fc_detail\",\n \"fc_set\",\n \"feature_doc\",\n \"feature_knob\",\n \"feedback_comments\",\n \"feedback_user_messages\",\n \"field_component\",\n \"file\",\n \"file_analysis\",\n \"file_entities\",\n \"file_overrides\",\n \"file_page_annotations\",\n \"file_pages\",\n \"file_rag_job\",\n \"file_version\",\n \"files_account_tier\",\n \"files_machine_written_prefix\",\n \"files_sync_mapping\",\n \"files_user_account\",\n \"flashcard_data\",\n \"flashcard_history\",\n \"flashcard_review\",\n \"flashcard_set\",\n \"flashcard_sets\",\n \"flexible_data\",\n \"folder\",\n \"function_contract\",\n \"game_badge\",\n \"game_result\",\n \"game_room\",\n \"global_execution\",\n \"global_execution_checkpoint\",\n \"global_execution_control\",\n \"global_execution_event\",\n \"global_meter_entry\",\n \"global_origin\",\n \"global_request\",\n \"google_document\",\n \"growth_loop_event\",\n \"growth_loop_run\",\n \"growth_loop_stage_run\",\n \"guardian_link\",\n \"guest_conversion_audit\",\n \"guest_execution_log\",\n \"guest_executions\",\n \"guided_checklist_run\",\n \"heatmap_save\",\n \"hindsight_enrollment\",\n \"hindsight_finding\",\n \"hindsight_regression_case\",\n \"hindsight_replay\",\n \"hindsight_replay_step\",\n \"hindsight_review\",\n \"hr_access_audit\",\n \"hr_access_role\",\n \"hr_accommodation_request\",\n \"hr_ai_evidence\",\n \"hr_alert_routing_rule\",\n \"hr_application\",\n \"hr_approval_authority\",\n \"hr_approval_delegation\",\n \"hr_asset\",\n \"hr_asset_assignment\",\n \"hr_attendance_exception\",\n \"hr_auto_close_rule\",\n \"hr_availability\",\n \"hr_background_check\",\n \"hr_benefits_event\",\n \"hr_calculation_snapshot\",\n \"hr_candidate\",\n \"hr_candidate_conversion\",\n \"hr_candidate_message\",\n \"hr_careers_portal\",\n \"hr_checklist_item\",\n \"hr_checklist_run\",\n \"hr_checklist_template\",\n \"hr_checklist_template_item\",\n \"hr_compensation\",\n \"hr_corrective_action\",\n \"hr_course\",\n \"hr_course_version\",\n \"hr_credential\",\n \"hr_crew\",\n \"hr_deduction_code\",\n \"hr_department\",\n \"hr_derived_grant\",\n \"hr_disposition_event\",\n \"hr_earning_code\",\n \"hr_eeo_response\",\n \"hr_emergency_contact\",\n \"hr_employee\",\n \"hr_employee_private\",\n \"hr_employer_profile\",\n \"hr_employment\",\n \"hr_employment_pin\",\n \"hr_engagement\",\n \"hr_establishment\",\n \"hr_external_identity\",\n \"hr_field_policy\",\n \"hr_holiday\",\n \"hr_holiday_calendar\",\n \"hr_i9\",\n \"hr_i9_document\",\n \"hr_incident\",\n \"hr_incident_party\",\n \"hr_interview\",\n \"hr_interview_kit\",\n \"hr_job_title\",\n \"hr_jurisdiction\",\n \"hr_jurisdiction_rule\",\n \"hr_jurisdiction_rule_class\",\n \"hr_jurisdiction_rule_org_decision\",\n \"hr_jurisdiction_rule_test\",\n \"hr_kiosk_device\",\n \"hr_kiosk_session\",\n \"hr_labor_target\",\n \"hr_leave_case\",\n \"hr_leave_enrollment\",\n \"hr_leave_ledger\",\n \"hr_leave_policy\",\n \"hr_leave_request\",\n \"hr_legal_hold\",\n \"hr_legal_hold_item\",\n \"hr_location\",\n \"hr_new_hire_report\",\n \"hr_offer\",\n \"hr_opening\",\n \"hr_overtime_alert\",\n \"hr_overtime_alert_rule\",\n \"hr_overtime_preapproval\",\n \"hr_pay_group\",\n \"hr_pay_period\",\n \"hr_pay_period_employment\",\n \"hr_payroll_export\",\n \"hr_payroll_export_line\",\n \"hr_position_assignment\",\n \"hr_posting\",\n \"hr_posting_publication\",\n \"hr_provider_binding\",\n \"hr_provider_event\",\n \"hr_provisioning_result\",\n \"hr_punch\",\n \"hr_recalculation_batch\",\n \"hr_record_class\",\n \"hr_records_request\",\n \"hr_reference_check\",\n \"hr_reporting_line\",\n \"hr_requisition\",\n \"hr_restricted_note\",\n \"hr_retention_rule\",\n \"hr_role_assignment\",\n \"hr_schedule\",\n \"hr_schedule_change\",\n \"hr_schedule_guidance\",\n \"hr_schedule_template\",\n \"hr_schedule_template_shift\",\n \"hr_scorecard\",\n \"hr_separation\",\n \"hr_shift\",\n \"hr_shift_claim\",\n \"hr_staffing_requirement\",\n \"hr_survey\",\n \"hr_survey_invitation\",\n \"hr_survey_question\",\n \"hr_survey_response\",\n \"hr_tax_registration\",\n \"hr_tax_withholding\",\n \"hr_time_adjustment\",\n \"hr_training_assignment\",\n \"hr_training_attempt\",\n \"hr_transcript_entry\",\n \"hr_verification_letter_request\",\n \"hr_work_interval\",\n \"hr_workflow_binding\",\n \"hr_workflow_decision\",\n \"hr_workflow_definition\",\n \"hr_workflow_event\",\n \"hr_workflow_failure\",\n \"hr_workflow_flow_type\",\n \"hr_workflow_instance\",\n \"hr_workflow_step\",\n \"hr_workflow_step_definition\",\n \"hr_workweek\",\n \"html_extraction\",\n \"iam_access_audit\",\n \"iam_api_key\",\n \"iam_emergency_door_request\",\n \"idempotency\",\n \"industry\",\n \"industry_curator\",\n \"infra_status\",\n \"ingest_runs\",\n \"integration_connection\",\n \"integration_connection_resource\",\n \"interview_decision_interview\",\n \"interview_decision_question\",\n \"interview_document_revision\",\n \"interview_hole\",\n \"interview_question\",\n \"interview_session\",\n \"interview_turn\",\n \"invitation\",\n \"invitation_code\",\n \"invitation_request\",\n \"io_comment\",\n \"io_contract\",\n \"io_import\",\n \"io_outbox\",\n \"item\",\n \"item_mastery\",\n \"judge_verdict\",\n \"jurisdiction_policy\",\n \"keyword_classification_queue\",\n \"kg_alert\",\n \"kg_chunk_entities\",\n \"kg_chunks\",\n \"kg_clusters\",\n \"kg_edges\",\n \"kg_entities\",\n \"kg_entity_aliases\",\n \"kg_suggestion_ack\",\n \"kg_sweep_queue\",\n \"kg_sweep_run\",\n \"kg_sweep_state\",\n \"kg_value_match\",\n \"knob_override\",\n \"knob_override_audit\",\n \"knob_rung_lock\",\n \"knob_scope_kind\",\n \"knob_write_door\",\n \"league_membership\",\n \"learn_doc\",\n \"library_doc\",\n \"lifecycle_archive\",\n \"lifecycle_archive_row\",\n \"lifecycle_audit\",\n \"lifecycle_entity_plan\",\n \"lifecycle_map_build\",\n \"lifecycle_reference_map\",\n \"lifecycle_run\",\n \"lifecycle_tier_ledger\",\n \"location\",\n \"mandate\",\n \"mandate_advance_batch_row\",\n \"mandate_binding\",\n \"mandate_binding_legacy\",\n \"mandate_goal_clauses\",\n \"mandate_legacy\",\n \"mandate_observation\",\n \"mandate_reference\",\n \"mandate_scan\",\n \"mandate_treatment\",\n \"marketing_initiative\",\n \"masterwork_corpus_item\",\n \"masterwork_run\",\n \"masterwork_run_kind\",\n \"masterwork_source\",\n \"math_course_structure\",\n \"math_problem\",\n \"matrx_action_ledger\",\n \"mcp_config\",\n \"mcp_server\",\n \"mcp_user_conn\",\n \"media_capture_handoff\",\n \"media_catalog_setting\",\n \"media_library_item\",\n \"media_selection_item\",\n \"media_selection_job\",\n \"media_source_library\",\n \"meet_call_invite\",\n \"meet_meeting\",\n \"meet_note\",\n \"meet_participant\",\n \"meet_recording\",\n \"meet_transcript_segment\",\n \"membership\",\n \"membership_grant\",\n \"merge_field_provenance\",\n \"message\",\n \"message_template\",\n \"meta_excluded_schema\",\n \"meta_table_stats_history\",\n \"metadata_reserved_keys\",\n \"microservice_project\",\n \"migration_log\",\n \"mtx_media_heal_queue\",\n \"mtx_public_url_guard\",\n \"ner_shadow\",\n \"note\",\n \"note_folder\",\n \"notification\",\n \"notification_channel_preference\",\n \"notification_event_override\",\n \"notification_event_type\",\n \"notification_preference\",\n \"notification_submission\",\n \"notify_outsider_door_baseline\",\n \"oauth_handoff_claim\",\n \"opinion_clusters\",\n \"opinions\",\n \"ops_issue_class\",\n \"ops_issue_event\",\n \"ops_proof_check\",\n \"ops_proof_run\",\n \"ops_proof_scenario\",\n \"org_admin_audit\",\n \"org_change_policy\",\n \"org_context_ledger\",\n \"org_industries\",\n \"org_member_control\",\n \"org_module_config\",\n \"org_plan\",\n \"org_repair_0253_backup\",\n \"organization\",\n \"organization_preferences\",\n \"organization_visibility_version\",\n \"output_feedback\",\n \"outreach_acceptance\",\n \"page_extraction_job\",\n \"page_extraction_page_run\",\n \"page_extraction_results\",\n \"page_extraction_runs\",\n \"page_intent_queue\",\n \"page_mapping_queue\",\n \"part_config\",\n \"part_config_sub\",\n \"party\",\n \"party_contact_point\",\n \"passkey_credential\",\n \"path_drift_repair_2026_09\",\n \"pc_article\",\n \"pc_episode\",\n \"pc_show\",\n \"pc_studio_run\",\n \"pc_studio_run_asset\",\n \"pdf_consolidation_log\",\n \"pdf_redaction_audit\",\n \"pdf_redaction_key_escrow\",\n \"permission_grant\",\n \"plan_cms_fill_item\",\n \"plan_cms_fill_job\",\n \"plan_entity\",\n \"plan_node\",\n \"plan_node_artifact\",\n \"plan_node_step\",\n \"plan_profile\",\n \"platform_action_request\",\n \"platform_actor_session\",\n \"platform_actor_token\",\n \"platform_actor_token_event\",\n \"platform_continued_access\",\n \"platform_org_knob_override\",\n \"platform_outcome_event\",\n \"platform_outsider_consumer\",\n \"platform_reachability\",\n \"platform_reference_category\",\n \"platform_reference_declaration\",\n \"platform_repo\",\n \"platform_saved_view\",\n \"platform_schema\",\n \"platform_share_link\",\n \"platform_user_knob_override\",\n \"podcast_race\",\n \"policy_overlap_backup\",\n \"policy_overlap_probe\",\n \"processed_document\",\n \"processed_document_page\",\n \"product_capture_file\",\n \"product_capture_item\",\n \"product_capture_payload\",\n \"product_capture_product\",\n \"product_capture_question\",\n \"profile\",\n \"project\",\n \"prompt\",\n \"provider_account\",\n \"provider_account_credential\",\n \"provision\",\n \"provision_generate_target\",\n \"provision_grant\",\n \"provision_marker\",\n \"provision_rule_message\",\n \"provision_schema\",\n \"provision_shape_debt\",\n \"provision_spec\",\n \"provision_spec_grandfather\",\n \"provision_vocabulary\",\n \"purpose\",\n \"quiz_session\",\n \"rag_ingest_run\",\n \"rag_library_audit_log\",\n \"rate_limit_buckets\",\n \"recompute_queue\",\n \"record\",\n \"record_alias\",\n \"redaction_mapping\",\n \"research_analysis\",\n \"research_content\",\n \"research_context_bundle\",\n \"research_document\",\n \"research_intent\",\n \"research_keyword\",\n \"research_media\",\n \"research_source\",\n \"research_synthesis\",\n \"research_tag\",\n \"research_template\",\n \"research_topic\",\n \"retention_policy\",\n \"retrieval_audit\",\n \"review_queue\",\n \"route_manifest_entry\",\n \"row_version\",\n \"rulebook\",\n \"runtime_operation_stream\",\n \"runtime_operation_stream_batch\",\n \"sandbox_instance\",\n \"sch_agent_task\",\n \"sch_run\",\n \"sch_task\",\n \"sch_trigger\",\n \"schema_client_exposure\",\n \"schema_migration_ledger\",\n \"schema_migration_legacy\",\n \"schema_migration_slot_grandfather\",\n \"schema_templates\",\n \"scope\",\n \"scope_association_suggestion\",\n \"scope_dataset_instance\",\n \"scope_door_registry\",\n \"scope_item_value_suggestion\",\n \"scope_suggestion\",\n \"scope_type\",\n \"scrape_domain\",\n \"scrape_domain_settings\",\n \"scrape_failure_log\",\n \"scrape_parsed_page\",\n \"scrape_path_override\",\n \"scrape_path_pattern\",\n \"scrape_retry_queue\",\n \"seo_ai_capability\",\n \"seo_ai_visibility_citation\",\n \"seo_ai_visibility_claim\",\n \"seo_ai_visibility_panel\",\n \"seo_ai_visibility_response\",\n \"seo_ai_visibility_signal\",\n \"seo_backlink\",\n \"seo_backlink_change_event\",\n \"seo_backlink_dimension_snapshot\",\n \"seo_backlink_observation\",\n \"seo_backlink_snapshot\",\n \"seo_change_assessment\",\n \"seo_change_event\",\n \"seo_change_item\",\n \"seo_change_metric\",\n \"seo_change_set\",\n \"seo_change_theory\",\n \"seo_collection_run\",\n \"seo_competitor\",\n \"seo_competitor_observation\",\n \"seo_competitor_opportunity\",\n \"seo_coverage_mention\",\n \"seo_coverage_tracker\",\n \"seo_dimension_value_matcher\",\n \"seo_engine_schedule\",\n \"seo_geo_place\",\n \"seo_gsc_dig_rule\",\n \"seo_keyword\",\n \"seo_keyword_class_rule\",\n \"seo_keyword_edge\",\n \"seo_keyword_facet\",\n \"seo_keyword_market\",\n \"seo_keyword_market_observation\",\n \"seo_keyword_place\",\n \"seo_keyword_saved_view\",\n \"seo_keyword_topic\",\n \"seo_landscape_brief\",\n \"seo_link_gap_domain\",\n \"seo_link_gap_match\",\n \"seo_map_facet\",\n \"seo_map_facet_value\",\n \"seo_map_topic\",\n \"seo_page_measurement_health\",\n \"seo_page_performance\",\n \"seo_provider_call\",\n \"seo_provider_task\",\n \"seo_rank_observation\",\n \"seo_rank_target\",\n \"seo_raw_payload\",\n \"seo_referring_domain_profile\",\n \"seo_reputation_case\",\n \"seo_search_performance_daily\",\n \"seo_serp_mention\",\n \"seo_serp_opportunity\",\n \"seo_serp_result\",\n \"seo_serp_snapshot\",\n \"seo_site_geo_area\",\n \"seo_site_keyword_offering\",\n \"seo_site_keyword_value\",\n \"seo_site_offering_value\",\n \"seo_site_topic_value\",\n \"seo_site_value_combo\",\n \"seo_site_value_worth\",\n \"seo_site_vocabulary\",\n \"seo_source_request\",\n \"seo_starter_pack\",\n \"seo_starter_pack_item\",\n \"seo_story_angle\",\n \"seo_topic\",\n \"seo_topical_map\",\n \"seo_web_analytics_daily\",\n \"share_link\",\n \"shareable_resource_registry\",\n \"shared_canvas_item\",\n \"short_link\",\n \"shortcut_category\",\n \"skill\",\n \"skill_category\",\n \"skill_render_definition\",\n \"sms_consent\",\n \"sms_conversation\",\n \"sms_message\",\n \"sms_message_media\",\n \"sms_notification\",\n \"sms_notification_preference\",\n \"sms_phone_number\",\n \"sms_rate_limits\",\n \"sms_webhook_logs\",\n \"soft_delete_edge\",\n \"source_authority\",\n \"stage_dockets_966c18eca7\",\n \"stage_ref_kind\",\n \"stamped_write_table\",\n \"structure\",\n \"structured_list\",\n \"studio_cleaned_segments\",\n \"studio_concept_items\",\n \"studio_documents\",\n \"studio_module_segments\",\n \"studio_raw_segments\",\n \"studio_recording_chunks\",\n \"studio_recording_segments\",\n \"studio_run\",\n \"studio_session\",\n \"studio_session_settings\",\n \"study_attempt\",\n \"study_goal\",\n \"study_media\",\n \"study_plan\",\n \"study_plan_block\",\n \"study_plan_day\",\n \"study_reminder_context\",\n \"study_reminder_delivery\",\n \"study_session\",\n \"study_source_chunk\",\n \"study_streak\",\n \"study_structured_section\",\n \"superseded_policy\",\n \"surface\",\n \"system_announcement\",\n \"system_context_item\",\n \"system_error\",\n \"system_orgs\",\n \"system_personal_org_failure\",\n \"system_write_failure\",\n \"task\",\n \"task_user_state\",\n \"taxonomy_node\",\n \"template_context_items\",\n \"template_scope_types\",\n \"templates\",\n \"test_handset_inbox\",\n \"test_handset_verification\",\n \"thread\",\n \"tool\",\n \"tool_binding\",\n \"tool_bundle\",\n \"tool_call\",\n \"tool_definition_version\",\n \"tool_executor\",\n \"tool_surface_defaults\",\n \"tool_test_sample\",\n \"tool_ui\",\n \"tool_ui_incident\",\n \"tool_ui_version\",\n \"topic_placement_queue\",\n \"transcript\",\n \"trigger_event\",\n \"udt_dataset_fields\",\n \"udt_dataset_row_versions\",\n \"udt_dataset_rows\",\n \"udt_dataset_template\",\n \"udt_dataset_template_fields\",\n \"udt_document\",\n \"udt_document_snapshot\",\n \"udt_structured_list_items\",\n \"udt_workbook_snapshot\",\n \"ui_client\",\n \"ui_surface_agent_pref\",\n \"ui_surface_agent_role\",\n \"ui_surface_client_tool\",\n \"ui_surface_config\",\n \"ui_surface_value\",\n \"ui_surface_write_target\",\n \"unsubscribe_token\",\n \"uploads_inflight\",\n \"user_achievement\",\n \"user_active_context\",\n \"user_analysis_preference\",\n \"user_bookmark\",\n \"user_email_preference\",\n \"user_entity_state\",\n \"user_feedback\",\n \"user_follows\",\n \"user_form_profile\",\n \"user_markdown_sample\",\n \"user_memory\",\n \"user_preference\",\n \"user_profile\",\n \"user_secret\",\n \"user_secret_audit\",\n \"user_secret_grant\",\n \"user_stat\",\n \"user_storage_usage\",\n \"user_surface_state\",\n \"visibility_cache\",\n \"visibility_epoch\",\n \"voice\",\n \"war_room\",\n \"wbx_capture\",\n \"wbx_demo\",\n \"wbx_guidance\",\n \"wbx_highlight\",\n \"wbx_pattern\",\n \"wbx_recipe\",\n \"wbx_screenshot\",\n \"wbx_seo_audit\",\n \"wc_claim\",\n \"wc_impairment_definition\",\n \"wc_injury\",\n \"wc_report\",\n \"web_analysis_item\",\n \"web_brand\",\n \"web_brand_asset\",\n \"web_brand_offering\",\n \"web_business_fact\",\n \"web_business_location\",\n \"web_channel_analytics_daily\",\n \"web_crawl_event\",\n \"web_crawl_preset\",\n \"web_crawl_schedule\",\n \"web_crawl_session\",\n \"web_crawl_url\",\n \"web_discovered_item\",\n \"web_finding\",\n \"web_gsc_page_stat\",\n \"web_link_edge\",\n \"web_listing_publisher\",\n \"web_location_listing\",\n \"web_offering_template\",\n \"web_page\",\n \"web_page_content\",\n \"web_page_evidence\",\n \"web_page_sitemap\",\n \"web_property\",\n \"web_provider\",\n \"web_result\",\n \"web_screenshot\",\n \"web_site\",\n \"web_site_endpoint_rule\",\n \"web_site_item_config\",\n \"web_site_offering\",\n \"web_sitemap\",\n \"web_snapshot\",\n \"web_tag_manager_snapshot\",\n \"web_youtube_video\",\n \"webhook_deliveries\",\n \"webhook_dispatch_state\",\n \"webhooks\",\n \"wf_node_data_slot\",\n \"work_claim\",\n \"work_item\",\n \"workbook\",\n \"worker_heartbeat\",\n \"workflow\",\n \"workflow_card\",\n \"workflow_checkpoint\",\n \"workflow_comparison\",\n \"workflow_definition_version\",\n \"workflow_idempotency\",\n \"workflow_job\",\n \"workflow_node_events\",\n \"workflow_node_outcome\",\n \"workflow_plan\",\n \"workflow_plan_event\",\n \"workflow_plan_sample\",\n \"workflow_recovery_audit\",\n \"workflow_run\",\n \"workflow_run_log\",\n \"workflow_runtime_surface\",\n \"workflow_template\",\n \"workflow_trigger\",\n \"workflow_trigger_fire\",\n \"workflow_work_item\",\n \"working_document\",\n \"write_guard_key\",\n \"youtube_quota_day\",\n \"youtube_search\",\n \"youtube_video\",\n] as const;\n\nexport type StoreRefusalCode = (typeof STORE_REFUSAL_CODES)[number][\"code\"];\nexport type StoreDoorName = (typeof STORE_DOORS)[number][\"name\"];\nexport type EntityToken = (typeof ENTITY_TOKENS)[number];\nexport type KernelTableName = (typeof KERNEL_TABLES)[number][\"name\"];\n","// src/record-scope.ts — @ai-matrx/records · AGT-N-9 · PRODUCTS row 11\n//\n// A CONVERSATION THAT IS ABOUT ONE RECORD.\n//\n// These are the shapes `custom.record_scope_context` and its three siblings answer. They\n// are types over ONE door, not a model of their own: the assembly happens inside the\n// database, through `custom.read_record`, under the operating person's own field-level\n// security, and this file only says what comes back.\n//\n// TWO ABSENCES, NEVER ONE. `withheld[].because` is `\"masked\"` when the STORE kept a Field\n// from this reader, and `\"policy\"` when the ORGANIZATION keeps it out of conversations.\n// A screen that collapsed them would tell somebody \"you may not see this\" about a field\n// they can read on the record two inches away.\n\nimport type { PermissionLevel } from \"./level\";\nimport type { Uuid } from \"./record\";\n\n/** One value the agent was given, with the triple that makes it citable. */\nexport interface RecordScopeField {\n key: string;\n label: string;\n type: string;\n value: unknown;\n /** DYN: a merge field resolves to a TRIPLE, not a string. */\n cite: {\n record_id: Uuid;\n field_id: Uuid;\n value_version: number;\n written_at: string | null;\n };\n}\n\n/** A Field the agent was NOT given, and which of the two reasons it is. */\nexport interface RecordScopeWithheld {\n key: string;\n label: string;\n because: \"masked\" | \"policy\";\n reason: string;\n needs?: string;\n /** The whole sentence, already written — a screen prints it rather than composing one. */\n says: string;\n}\n\nexport interface RecordScopeRelation {\n via: string;\n target_id: Uuid;\n foreign: boolean;\n masked: boolean;\n your_level: PermissionLevel | null;\n card: Record<string, unknown> | null;\n why: string | null;\n}\n\nexport interface RecordScopeHistoryEntry {\n version: number;\n at: string;\n what: string;\n who: string | null;\n changes: Array<Record<string, unknown>>;\n}\n\nexport interface RecordScopeComment {\n id: Uuid;\n body: string;\n created_at: string;\n created_by_name: string;\n field_key: string | null;\n}\n\nexport interface RecordScopeContext {\n record: {\n id: Uuid;\n title: string;\n table_id: Uuid;\n table_name: string | null;\n scope_type: string;\n plural: string;\n version: number;\n updated_at: string;\n your_level: PermissionLevel;\n };\n fields: RecordScopeField[];\n withheld: RecordScopeWithheld[];\n relations: RecordScopeRelation[];\n history: RecordScopeHistoryEntry[];\n comments: RecordScopeComment[];\n may_comment: boolean;\n siblings: {\n shown: Array<{ id: Uuid; title: string }>;\n more_than_shown: boolean;\n says: string;\n };\n /** Questions derived from THIS record's shape — never a fixed list. */\n suggested: string[];\n /** One sentence naming what is not in the conversation. Printed verbatim. */\n says: string;\n assembled_at: string;\n}\n\n/** What a conversation is about. `readable` false means the person lost access to it. */\nexport interface ConversationScope {\n bound: boolean;\n readable?: boolean;\n record_id?: Uuid;\n table_id?: Uuid;\n scope_type?: string;\n title?: string;\n bound_at?: string;\n bound_by?: Uuid;\n because?: string;\n}\n\nexport interface ConversationScopeContext {\n scope: ConversationScope;\n context: RecordScopeContext | null;\n}\n\n/** `About: Acme Industrial` — the chip a bound chat wears. */\nexport function scopeChip(scope: ConversationScope): string {\n return scope.title ? `About: ${scope.title}` : \"About: this record\";\n}\n","// src/core/doors.ts — @ai-matrx/records\n//\n// THE DOOR TABLE. Every call this package can make names a door, and every door\n// it names is checked against `STORE_DOORS` — which is generated from `pg_proc`\n// on the live store, not written by a person.\n//\n// A door that is not there yet is answered `door_absent`, naming the door AND\n// the lane that owns it. That is the whole of \"nothing fails silently\" for this\n// package: there is no empty array standing in for a search nobody built, and\n// no `true` standing in for a proposal nobody can approve.\n\nimport { STORE_DOORS } from \"../store.generated\";\nimport type { RecordsError } from \"../results\";\n\n/** Which lane owes each door that does not exist yet (BUILD-BOOK \"Packages\"). */\nconst OWED_BY: Record<string, string> = {\n metadata_search: \"W5-SRV / W5-AGENT — the agent surface's eight verbs\",\n record_aggregate: \"W5-SRV / W5-AGENT — `record_aggregate` is one of the eight verbs\",\n field_propose: \"W5-AGENT — AGT-4/AGT-8, the proposal and its approvers\",\n table_propose: \"W5-AGENT — AGT-8, the proposal and its approvers\",\n merge_field_resolve: \"W5-MERGE-B — the resolver's server half\",\n record_query: \"W1-INDEX / W5-SRV — the promoted-field query path\",\n // Lane GRID-PRIMITIVES (2026-09-22): on the rehearsal branch; they reach the main database at\n // the chair's 01:00–04:00 PT apply, and `pnpm records:generate` then lists them in\n // STORE_DOORS. Until then each call answers door_absent naming this line — never a guess.\n table_decorate: \"GRID-PRIMITIVES G1 — gridprim_a_table_wears_its_colors_and_its_layout.sql (chair's production apply)\",\n table_decorations: \"GRID-PRIMITIVES G1 — gridprim_a_table_wears_its_colors_and_its_layout.sql (chair's production apply)\",\n grid_layout: \"GRID-PRIMITIVES G1 — gridprim_a_table_wears_its_colors_and_its_layout.sql (chair's production apply)\",\n formula_parse: \"GRID-PRIMITIVES G3 — gridprim_a_formula_is_typed_and_the_store_works_it_out.sql (chair's production apply)\",\n action_declare: \"GRID-PRIMITIVES G2 — gridprim_a_row_action_runs_the_whole_selection_at_once.sql (chair's production apply)\",\n row_actions: \"GRID-PRIMITIVES G2 — gridprim_a_row_action_runs_the_whole_selection_at_once.sql (chair's production apply)\",\n action_run: \"GRID-PRIMITIVES G2 — gridprim_a_row_action_runs_the_whole_selection_at_once.sql (chair's production apply)\",\n table_webhook_declare: \"GRID-PRIMITIVES G4 — gridprim_every_row_change_reaches_the_webhook.sql (chair's production apply)\",\n table_webhooks: \"GRID-PRIMITIVES G4 — gridprim_every_row_change_reaches_the_webhook.sql (chair's production apply)\",\n table_webhook_archive: \"GRID-PRIMITIVES G4 — gridprim_every_row_change_reaches_the_webhook.sql (chair's production apply)\",\n table_from_example: \"GRID-PRIMITIVES G5 — gridprim_a_table_can_start_from_a_real_example.sql (chair's production apply)\",\n autonumber_backfill: \"GRID-PRIMITIVES G5 — gridprim_a_table_can_start_from_a_real_example.sql (chair's production apply)\",\n rule_declare:\n \"W1-RULE — `custom.record_write` writes `data_class = 'record'`, so the ONE write door cannot \" +\n \"make a Rule record; declaring a Rule (and therefore a DOOR-18 subscription) needs a door of its own\",\n};\n\n/**\n * THE TRUST DOORS, AND WHY THEY ARE A SEPARATE TABLE.\n *\n * `iam.is_external_principal`, the publish binding and the world lane are NOT\n * the record store's. They are the platform's answer to \"who is this person to\n * us?\" and \"does this thing have a public address?\", and W2-TRUST owns them.\n * They live in schema `iam`, so `pnpm records:generate` — which reads `custom`\n * and only `custom` — does not and should not see them.\n *\n * They are therefore named here by hand, once, with the schema they belong to\n * said out loud. A client that pretended they were store doors would be lying\n * about which system answered it: when the world lane is closed, the sentence a\n * person reads is `iam`'s, not the store's.\n */\nexport const TRUST_SCHEMA = \"iam\";\n\nexport const TRUST_DOORS = {\n /** VIS-31. A signed-in outsider: an account with no NON-personal organization. */\n isExternalPrincipal: \"is_external_principal\",\n /** The same answer with the plain-English reason attached. */\n externalPrincipalCard: \"external_principal_card\",\n /** EXACTLY the resources Visibility gave that outsider — never \"their organization's\". */\n externalPrincipalReach: \"external_principal_reach\",\n /** VIS-32. A record or a view bound to a public address with a declared render mode. */\n publishBindingCreate: \"publish_binding_create\",\n publishBindingRevoke: \"publish_binding_revoke\",\n /** What a SIGNED-OUT visitor resolves. Returns nothing for an invented or revoked address. */\n resolvePublishBinding: \"resolve_publish_binding\",\n /** D-15. The one sentence that admits nothing was scanned — one function, so it cannot drift. */\n worldPublishGapNotice: \"world_publish_gap_notice\",\n publishToWorld: \"publish_to_world\",\n worldPublishAdmit: \"world_publish_admit\",\n claimWorldNamespace: \"claim_world_namespace\",\n} as const;\n\nexport type TrustDoorKey = keyof typeof TRUST_DOORS;\n\n/**\n * THE OLDER STORE'S DOORS, AND WHY THEY ARE A THIRD TABLE.\n *\n * Most people's data does not live in `custom.record` yet. It lives in the\n * OLDER user-data tables — `workbench.udt_*`, one jsonb document per row — and\n * 14 of the 16 organizations holding any of it have ZERO tables in the unified\n * store. A relation column there resolves through a door of that store's own,\n * `workbench.udt_row_words_many` (lane OLD-TABLES-2, 2026-09-22), because\n * `custom._words_for` sits behind thirteen live screens and a second store's\n * ladder does not belong inside it.\n *\n * They are named here BY HAND, with their schema said out loud, for exactly the\n * reason `TRUST_DOORS` is: `pnpm records:generate` reads `custom` and only\n * `custom`, so the generated catalogue says nothing true about `workbench` and\n * a client that pretended these were store doors would be lying about which\n * system answered it.\n */\nexport const WORKBENCH_SCHEMA = \"workbench\";\n\nexport const WORKBENCH_DOORS = {\n /**\n * What a page of the OLDER store's relation cells reads, in one round trip.\n * Same answer shape as `custom.relation_words_many`, same withheld sentence,\n * and the ladder is asked per record inside it — so batching buys a round\n * trip and never a disclosure. An id that names nothing comes back as\n * NOTHING rather than as the withheld sentence, which is what makes an\n * unresolvable cell distinguishable from a refused one in that store.\n */\n udtRowWordsMany: \"udt_row_words_many\",\n} as const;\n\nexport type WorkbenchDoorKey = keyof typeof WORKBENCH_DOORS;\n\nconst DOOR_NAMES = new Set<string>(STORE_DOORS.map((d) => d.name));\n\nexport function doorExists(name: string): boolean {\n return DOOR_NAMES.has(name);\n}\n\n/** The refusal a missing door gets. It always says who owes it. */\nexport function doorAbsent(name: string): RecordsError {\n const owed = OWED_BY[name];\n return {\n code: \"door_absent\",\n message:\n `The record store has no door \\`custom.${name}\\` yet, so this call was not made. ` +\n `Nothing was read and nothing was written.`,\n hint: owed\n ? `That door is ${owed}. Until it lands, this call refuses rather than guessing: ` +\n `an empty answer here would read like \"there is nothing\", which is a different sentence.`\n : `No lane in the build book claims this door. Either the name is wrong, or the door was ` +\n `removed from the store and this package has not been regenerated — run \\`pnpm records:generate\\`.`,\n };\n}\n\n/** The doors this package calls, one place, so the suite can walk them. */\nexport const DOORS = {\n // THE READ DOOR (DOOR-1). Every read of a record's values goes through these\n // two and nothing else: they resolve the reader from the session, ask\n // visibility once per set, and mask the fields this reader may not see with a\n // notice under `_hidden`. Selecting `custom.record` directly is the thing\n // they exist to replace — it returns rows and fields the store never agreed\n // this person could see.\n readRecord: \"read_record\",\n readRecords: \"read_records\",\n // THE SAME READ DOOR, ADDRESSED BY AN ID SET. A realtime notice names the exact ids that\n // moved; before this existed the only door that took them was the PAGE door, so a\n // three-cell change re-read fifty rows in every watching browser. It is a separate NAME\n // rather than a sixth argument to `read_records` because adding a defaulted argument to a\n // live Postgres function makes every existing call ambiguous — `is not unique`. Same\n // ladder, same level, same masking, same page ceiling.\n readRecordsByIds: \"read_records_by_ids\",\n // THE SAME READ DOOR, ADDRESSED BY A QUESTION. `custom.read_records_matching`\n // takes the store's one filter shape (`RecordFilter` — the object\n // `platform.saved_view` carries as `filters` and `custom.record_aggregate`\n // takes as `p_filter`) and narrows the page INSIDE its own query, in the same\n // WHERE as Visibility. A separate NAME for the same reason as above. It is\n // what makes a number on a dashboard walkable: the filter is evaluated by\n // `custom.record_filter_sql`, the one body `custom.agg_sql` also calls, so the\n // rows it opens are the rows the number counted.\n readRecordsMatching: \"read_records_matching\",\n // THE SAME READ DOOR, ADDRESSED BY ABSENCE. Every door above answers LIVE rows\n // only — each of them hard-codes `and r.deleted_at is null` — so until this one\n // existed no screen could list an archived record however it was written, and\n // `record_restore` below had nothing that could reach it (VERIFIER-10 F4).\n // `custom.read_records_archived` is that body with the sign of one comparison\n // flipped, plus the two facts only an archive needs: who archived it and when.\n // A separate NAME for the same reason as its two siblings above.\n readRecordsArchived: \"read_records_archived\",\n // DOOR-8, the two clocks. `p_recorded_at` is what the store SAID then;\n // `p_world_on` is what was TRUE of the world on that date, read out of dated\n // values. A client that answered either one itself would be guessing.\n queryRecordAsOf: \"query_record_as_of\",\n queryTableAsOf: \"query_table_as_of\",\n recordWrite: \"record_write\",\n recordWriteMany: \"record_write_many\",\n // A PARENT, THE EDGES IT STANDS ON AND THE ROWS THAT BELONG TO IT — ALL OR NOTHING.\n // `recordWrite` and `recordWriteMany` are each ONE statement, so a caller that needs a\n // parent, its provenance edge and its child rows to land together had no door at all: a\n // loop is N transactions, and a failure on child nineteen leaves a parent standing without\n // the lines it promised. `custom.record_write_graph` is one statement, so it is one\n // transaction — and it is not a second write path: it CALLS `custom.record_write_many` for\n // the rows, `public.assoc_add` for an edge that points out of the store, and\n // `platform.relation_set` for the parent's own declared relation to its children. Every\n // guard, every trigger and the same editor rung, once. A refusal anywhere refuses the whole\n // graph, by name, and nothing is written.\n recordWriteGraph: \"record_write_graph\",\n recordUpdate: \"record_update\",\n recordDelete: \"record_delete\",\n recordRestore: \"record_restore\",\n recordValues: \"record_values\",\n recordValuesVersioned: \"record_values_versioned\",\n valueRead: \"value_read\",\n computedProvenance: \"computed_provenance\",\n recordApplicability: \"record_applicability\",\n applicableFields: \"applicable_fields\",\n fieldOptions: \"field_options\",\n parityValues: \"parity_values\",\n tableDeclare: \"table_declare\",\n // GETTING RID OF A TABLE — which is a JOB, NOT A STATEMENT (VERIFIER-11 F3).\n // `record_delete` above is the store's one soft-delete door and it is right\n // for a record; aimed at a TABLE it recurses through everything the Table\n // contains inside one transaction, and that is unbounded by construction. A\n // person pressing \"Delete this table\" on 1,430 records the product itself\n // had just imported waited twelve seconds and was told `57014`, \"canceling\n // statement due to statement timeout … Nothing was changed. Try a smaller\n // page\" — advice that means nothing when what you are doing is getting rid\n // of a table. `custom.table_archive` does the same work in passes and\n // answers each one with numbers, so a screen shows a sentence and a count\n // instead of a spinner and an SQLSTATE. It is STATELESS, so a run cut in\n // half resumes exactly where it stopped: there is no job row to lose.\n tableArchive: \"table_archive\",\n // ADDING A COLUMN — the first thing anybody does with a table, and until\n // 2026-09-19 there was no door for it. A Field is a record (REC-25), so a\n // screen wrote one with `record_write`; that door writes ONE row with\n // `data_class = 'record'` and cannot also add the key to the Table record's\n // `fields` array, which the field guard requires before it accepts any\n // definition at all. So every \"Add field\" ended on \"the table does not\n // declare a field called … — declare it there first\". These three doors take\n // what a person knows — a field type, a name, and for a choice list the\n // choices themselves — and the STORE turns that into the document its own\n // guards demand, so every client inherits one answer instead of each one\n // re-deriving thirteen and getting them wrong.\n fieldDeclare: \"field_declare\",\n fieldUpdate: \"field_update\",\n fieldRetire: \"field_retire\",\n // CUSTOM FIELDS ON A STANDARD BUSINESS TABLE. Every door above is keyed by a\n // custom Table's uuid, and a standard table has no Table record - so until\n // 2026-09-20 `custom.applicable_fields(org, 'party', null)` answered `22P02\n // invalid input syntax for uuid` and there was no other way in. These are\n // keyed by the REGISTRY TOKEN instead, and they are one set for all 643\n // tables the registry types Entity or Detail. The three value doors are\n // SECURITY INVOKER in the database on purpose: the standard table's own\n // row-level security is what decides who may read and write its rows, and a\n // definer wrapper would replace it with a second access system.\n entityTable: \"entity_table\",\n entityFields: \"entity_fields\",\n entityFieldDeclare: \"entity_field_declare\",\n entityFieldUpdate: \"entity_field_update\",\n entityFieldRetire: \"entity_field_retire\",\n entityFieldRights: \"entity_field_rights\",\n entityRecordRead: \"entity_record_read\",\n entityValueWrite: \"entity_value_write\",\n entityRecordsFind: \"entity_records_find\",\n tableCapacity: \"table_capacity\",\n tableStorage: \"table_storage\",\n promoteTable: \"promote_table\",\n promoteField: \"promote_field\",\n promotedFields: \"promoted_fields\",\n promotedRead: \"promoted_read\",\n relationTargets: \"relation_targets\",\n relationOwn: \"relation_own\",\n // REL-DISP, 2026-09-21. WHAT A RELATION CELL READS, through that column's own\n // display spec. `custom.record_words` is declared server_only — it takes a bare\n // record id with no field to scope it — so these are how a screen gets the\n // words, and they are the ONE way in: three separate copies of \"read tableList,\n // find title_field, call rowName\" lived in labels.tsx, RelationPicker.tsx and\n // PortalsPanel.tsx, and none of them could ever have shown two columns joined.\n // The `_many` door is the batch TAILS-2 recorded as missing (\"there is still no\n // batch door on the store\"), which is why the browser resolved labels one id at\n // a time. The ladder is NOT batched: the store asks it per record inside\n // `custom._words_for`, so batching buys a round trip and never a disclosure.\n relationWords: \"relation_words\",\n relationWordsMany: \"relation_words_many\",\n homeAdd: \"home_add\",\n recordReparent: \"record_reparent\",\n containmentChain: \"containment_chain\",\n storeIsOpen: \"store_is_open\",\n // DOOR-1, from the screen's side. What level the CALLER holds on the subjects\n // they name — the one question a screen has to answer BEFORE it draws a\n // control, and the only one the store had no client answer to.\n myLevels: \"my_levels\",\n // DOOR-11. The record's own revision list. A screen that offers an optimistic\n // save needs the version it LOADED, and the read door answers documents, not\n // versions — so the version comes from here, once, for the one record being\n // edited, and never for a whole list.\n ioRevisions: \"io_revisions\",\n resolveFirstMatch: \"resolve_first_match\",\n // The kernels a package-owned Table needs to exist at all: a Home is a record\n // in the person kernel, a Field is a record in the field kernel (REC-1).\n personKernelId: \"person_kernel_id\",\n fieldKernelId: \"field_kernel_id\",\n ruleKernelId: \"rule_kernel_id\",\n // And the Table kernel, which is how `tableList` asks the READ DOOR for this\n // organization's Tables: a Table is a record like any other, so listing them\n // is `read_records(org, table_kernel_id())` and never a select on a table.\n tableKernelId: \"table_kernel_id\",\n // A saved view references its membership Rule, and the STORE decides who is\n // in it — the screen never re-implements the predicate.\n pipelineDeclare: \"pipeline_declare\",\n pipelineRead: \"pipeline_read\",\n pipelineBoard: \"pipeline_board\",\n pipelineTransitionRefusal: \"pipeline_transition_refusal\",\n pipelineMove: \"pipeline_move\",\n tableStageField: \"table_stage_field\",\n // STAGE-RULES. A gate can refuse or it can hand the change to the approvals queue; the\n // closed list is the store's, the knob is the organization's, and what is WAITING on a\n // card has to be askable or a card that did not move looks like a card nobody dragged.\n stageRuleOnFailKinds: \"stage_rule_on_fail_kinds\",\n stageRuleEnforcement: \"stage_rule_enforcement\",\n recordStagePending: \"record_stage_pending\",\n pipelinePending: \"pipeline_pending\",\n pipelineGatePreview: \"pipeline_gate_preview\",\n ruleMembers: \"rule_members\",\n ruleMembership: \"rule_membership\",\n ruleRun: \"rule_run\",\n ruleEval: \"rule_eval\",\n // REC-15: the door that makes a Rule a RULE. `custom.record_write` into the\n // Rule kernel produces a valid Rule document carrying `data_class = 'record'`,\n // and every reader that goes LOOKING for a Rule looks for the class — so a\n // subscription written that way was invisible to DOOR-18 and nothing fired.\n // PRODUCTS row 1 — a form is a view on a real Table. `forms` lists an\n // organization's own, `formDeclare` writes one, and `anonPublish` is the one\n // act that opens it to people with no account. The PUBLIC pair\n // (`custom.form_public`, `custom.form_submit`) is deliberately absent: those\n // are server-lane doors and a browser never calls them.\n forms: \"forms\",\n formDeclare: \"form_declare\",\n // PRODUCTS row 14 — \"let clients book a 30-minute consult\". A booking page IS an\n // `anon_form`, so it is opened and closed by `anonPublish` like any other; this is\n // the owner's list of them with the numbers that make it worth opening. The\n // VISITOR's three (`booking_public`, `booking_hold`, `booking_confirm`) are\n // deliberately absent: they are server-lane and a browser never calls them.\n bookings: \"bookings\",\n // The OWNER's side of a booking page, and the door that had no client method at\n // all until 2026-09-21: without it the only way to get a booking page was to ask\n // an agent, which made the agent the ONLY path rather than the faster one.\n bookingDeclare: \"booking_declare\",\n // PRODUCTS row 9 — \"pull my spreadsheet in\". W4-IO built `io_import_open` and\n // `io_import_rows`; lane IMPORT gave a run an IDENTITY (the file's sha-256, so\n // a re-import doubles nothing), a duplicate key, a policy, per-row outcomes\n // with the source row on them, and the type inference that reads THIS\n // organization — an address that belongs to a member is a person, a few\n // repeating words are a dropdown, a column of names that are all records of\n // another Table points at it. `importOpen` (the older, narrower way in) is\n // deliberately absent from this catalogue: `importBegin` is a superset and two\n // ways to start an import from one client is how they drift.\n importPlan: \"io_import_plan\",\n importBegin: \"io_import_begin\",\n importDeclareColumns: \"io_import_declare_columns\",\n importRows: \"io_import_rows\",\n importFinish: \"io_import_finish\",\n importReport: \"io_import_report\",\n imports: \"io_imports\",\n importForget: \"io_import_forget\",\n inferColumn: \"io_infer_column\",\n // DOOR-19 (P8) — the address a Table owns. `inboundMailLand` is deliberately\n // absent: it is the mail gateway's door, granted to `service_role` alone and\n // declared `non_client_lane`, and a browser that could land mail at an\n // arbitrary address would be writing into any table of any organization.\n inboundDeclare: \"inbound_declare\",\n inboundAddresses: \"inbound_addresses\",\n inboundSet: \"inbound_set\",\n // THE CLIENT PORTAL, OWNER'S SIDE (VIS-31 / PORTAL). A portal is how somebody\n // with NO membership is let in to see the records that name them. `portals`\n // lists them, `portalCard` opens one, `portalDeclare` states what it exposes,\n // `portalInvite` and `portalRevoke` are the two acts on a person, and\n // `portalPreview` is \"view as this client\" — it asks `custom.visible_set` for\n // HER user id, the same call `custom.read_records` makes when she opens the\n // page, so the preview cannot disagree with what she sees. The CLIENT-side\n // pair (`custom.portal_public`, `custom.portal_invitation`, `custom.portal_me`)\n // is deliberately absent here: those belong to the outsider's own shell.\n portals: \"portals\",\n // WHICH TABLES EACH PORTAL SHOWS (TAILS-3). The Portals RAIL lives on a\n // Table's page beside Forms, Bookings and Dashboards, all of which are\n // table-scoped; `custom.portals` takes no table, so an organization with one\n // portal over Jobs saw that portal's cards on its Parts table, the empty\n // state never rendered, and the whole build/ask offer was unreachable\n // everywhere in that organization. This is the one question the rail has to\n // ask, under the same wall and visibility gate as `portals` itself.\n portalTables: \"portal_tables\",\n tableFacts: \"table_facts\",\n portalCard: \"portal_card\",\n portalDeclare: \"portal_declare\",\n portalInvite: \"portal_invite\",\n portalRevoke: \"portal_revoke\",\n portalPreview: \"portal_preview\",\n // ORG-CLEANUP, 2026-09-22 — A PORTAL IS ARCHIVED, NEVER DELETED.\n // `portals` keeps its signature and HIDES archived portals (the law's default\n // is to hide); `list_portals(org, 'active'|'archived'|'all')` is the\n // archive-aware reader, taking the platform archive filter's own three values\n // so one door serves both lanes and no screen has to invent a second control.\n // `portal_archive` / `portal_restore` are the way out and the way back; both\n // take the portal's own title typed back, because ten portals can carry one\n // title and the title alone is not what picks this one.\n listPortals: \"list_portals\",\n portalArchive: \"portal_archive\",\n portalRestore: \"portal_restore\",\n // SCR-16 — the canvas. A dashboard is a record in the presentation kernel\n // whose blocks are saved SPECS for the eighth verb; `dashboardRun` walks them\n // under the CALLER'S principal, so nothing here is precomputed and nothing is\n // summed in a browser. `dashboardStuck` is the seventh block kind on its own,\n // because \"what has not moved in fourteen days\" is a question a screen asks\n // outside a canvas too.\n dashboards: \"dashboards\",\n dashboardDeclare: \"dashboard_declare\",\n dashboardRun: \"dashboard_run\",\n dashboardStuck: \"dashboard_stuck\",\n dashboardDelete: \"dashboard_delete\",\n // PRODUCTS row 10 — \"fill in each company's industry and headcount, and keep\n // it fresh\". An Enrichment is not an object of its own: it is a Field saying\n // `source = agent`, with its instruction, inputs, model, confidence floor and\n // freshness in `source_config` (AGT-6). `enrichCells` is the one a GRID calls —\n // the badge data for a whole page in one round trip, because a badge asked per\n // cell is fifty round trips to draw fifty badges. `enrichPin` is the half of\n // this product that decides whether anybody ever trusts it: the moment a\n // person types over an agent-owned cell the store pins it, and the next run\n // leaves it exactly as they left it.\n // PRODUCTS row 15 — \"let my crew photograph each bin and log the weight on\n // site\". A capture sheet is the ONE Form object saying `audience = 'crew'`,\n // opened by `capture_opened_at`; these five are SIGNED-IN doors granted to\n // `authenticated`, unlike the public form's two, because a crew member has an\n // account and their own level on the Table is the whole access decision.\n captureSheetDeclare: \"capture_sheet_declare\",\n capturePublish: \"capture_publish\",\n captureSheets: \"capture_sheets\",\n captureOpen: \"capture_open\",\n captureSubmit: \"capture_submit\",\n enrichments: \"enrichments\",\n enrichDeclare: \"enrich_declare\",\n enrichDue: \"enrich_due\",\n enrichCells: \"enrich_cells\",\n enrichLand: \"enrich_land\",\n enrichPin: \"enrich_pin\",\n enrichRuns: \"enrich_runs\",\n // PRODUCTS row 4 — \"Who changed this price, and can I put it back?\" The\n // history has been in the store since W3-HIST; until 2026-09-20 the only way\n // to ask for it was `io_revisions`, which answers a raw uuid for the author\n // and a list of KEYS for what moved. `recordHistory` answers the person (or\n // the agent AND the person it acted for), the operation in the word somebody\n // used, and every field with its before, its after, the Rule version that\n // produced it and its source. `fieldHistory` is the other half nobody ships:\n // one column's history across the whole Table.\n recordHistory: \"record_history\",\n fieldHistory: \"field_history\",\n // THE PUT-IT-BACK THREE. `restorePreview` names what will change BEFORE it\n // does; `restoreVersion` puts the whole record back and `valueRestore` puts\n // one column back (HIS-N-2). All three write a NEW version through the\n // record's own write path — no stored version is ever altered.\n restorePreview: \"record_restore_preview\",\n restoreVersion: \"record_restore_version\",\n valueRestore: \"value_restore\",\n // SCR-18. The store has had comment doors at the `commenter` rung all along;\n // these two add the people's NAMES and a mention that reaches somebody.\n // AGT-N-9 / PRODUCTS row 11 — \"What's the history with this customer?\" A\n // conversation can be ABOUT one record, and `recordScopeContext` is the ONE\n // door that answers everything such a chat is allowed to know in a single\n // round trip: the Fields with their (record, field, value version) triples,\n // the relations one hop out, the history, the comments and the Table's other\n // records — every piece assembled INSIDE the database through the read door\n // under this person's own field-level security. A Field the store masks is\n // named as withheld with the store's reason and never valued.\n recordScopeContext: \"record_scope_context\",\n conversationScope: \"conversation_scope\",\n conversationScopeBind: \"conversation_scope_bind\",\n conversationScopeUnbind: \"conversation_scope_unbind\",\n conversationScopeContext: \"conversation_scope_context\",\n commentThread: \"comment_thread\",\n commentWrite: \"comment_write\",\n commentResolve: \"io_comment_resolve\",\n // The eighth verb (AGT-N-8): a grouped, bucketed, filtered count/sum/avg/\n // min/max computed INSIDE the read door's own query, so a chart shows exactly\n // the rows this person may see and never fetches the ones they may not.\n recordAggregate: \"record_aggregate\",\n aggOperations: \"agg_operations\",\n aggBuckets: \"agg_buckets\",\n // DOOR-18: a subscription is a Rule record carrying a `subscription` block\n // over a saved view. There is no subscription TABLE and no second notifier.\n aggSubscriptions: \"agg_subscriptions\",\n aggSubscriptionCadences: \"agg_subscription_cadences\",\n // The OWNER's side of DOOR-18. `agg_subscriptions` is the notifier's reader\n // and is not client-callable; these two are what a person reaches: what am I\n // being told about, and switch this one off. A form's notify Rule is one of\n // these rows, so \"tell me when a patient arrives\" can also be un-told.\n subscriptions: \"subscriptions\",\n subscriptionMute: \"subscription_mute\",\n // The two DOOR-18 acts that had no door at all until 2026-09-20: WRITE a\n // subscription (a Rule is declared, never written as a record — REC-72) and SEE\n // the summary it would send right now without sending it.\n subscriptionDeclare: \"subscription_declare\",\n subscriptionPreview: \"subscription_preview\",\n // A SUBSCRIPTION IS OVER A SAVED VIEW, so a person who has never saved one has\n // nothing to subscribe to. These two are the saved-view pair (lane DIGESTS'\n // `digests_a_saved_view_has_a_door.sql`), unreachable from this client until\n // 2026-09-21: `views` lists this Table's, `viewDeclare` writes one. A LIST IS A\n // DOOR, never a grant on `platform.saved_view` behind it.\n views: \"views\",\n viewDeclare: \"view_declare\",\n // The cadence CATALOGUE a person's screen may ask for. `agg_subscription_cadences`\n // above is the notifier's own and holds no client grant; this door delegates to\n // it, so a picker and the digest runner can never offer different words.\n subscriptionCadences: \"subscription_cadences\",\n // The doc doors: a template is saved, a render is written once and frozen,\n // and a signature is checked against the exact bytes that were signed.\n docTemplateSave: \"doc_template_save\",\n docRenderBody: \"doc_render_body\",\n docRenderDocument: \"doc_render_document\",\n docTokens: \"doc_tokens\",\n docUnresolvedTokens: \"doc_unresolved_tokens\",\n docSign: \"doc_sign\",\n // THE SEAL IS ASKED THROUGH ITS OWN DOOR. `custom.doc_signature_intact` is the INTERNAL\n // half of this pair — SECURITY INVOKER over a doors-only table, so a browser that calls it\n // gets `42501 permission denied for table doc_signature`, which is what every SignBlock\n // seal check got until 2026-09-22 (FIX-10B). `custom.doc_signature_read` is the definer\n // door built for a client: it asks may_reach and may_open on the RECORD by name and\n // returns the seal AND the verdict in one answer, because a seal a person can read and a\n // verdict they cannot is how a changed agreement keeps wearing somebody's signature.\n docSignatureRead: \"doc_signature_read\",\n // THE PLURAL ACTS. Until 2026-09-20 this package read `custom.doc_template`,\n // `custom.doc_render` and `custom.doc_signature` with a direct PostgREST\n // `.from()`, and all three hold NO client SELECT — so every list in product #5\n // opened on \"permission denied for view doc_template\". A list is a DOOR, never\n // a grant on the thing behind it (DOORS-TWO).\n docTemplates: \"doc_templates\",\n docTemplateDelete: \"doc_template_delete\",\n docRenders: \"doc_renders\",\n docSignatures: \"doc_signatures\",\n // THE ANONYMOUS LANE (W4-ANON). It landed, and it landed as SEVEN doors\n // rather than the one this package had guessed at: a token is issued and\n // verified separately from the write it authorises, a form is published\n // separately from being declared, and an offline capture by a SIGNED-IN\n // person is a different door from a write by a stranger.\n //\n // This package used to name a door `anon_record_write`, which never existed —\n // so `FormRunner` told every person that the public link was \"pending\" for a\n // lane that had already shipped. A screen calling a live feature pending is\n // the same silent failure as a screen calling a missing one live, and the fix\n // is to name the doors the store actually has.\n anonTokenIssue: \"anon_token_issue\",\n anonTokenVerify: \"anon_token_verify\",\n anonTokenRevoke: \"anon_token_revoke\",\n /** The stranger's write. The TOKEN names the organization; a caller never does. */\n anonWrite: \"anon_write\",\n /** SCR-30. The signed-in OFFLINE path: the client mints the key, the store dedupes on it. */\n anonCapture: \"anon_capture\",\n anonPublish: \"anon_publish\",\n\n // WORK (W4-WORK): a template instantiated as real records, whose turn it is,\n // and a slot somebody is holding. `ChecklistRunner` and `BookingSlots` are\n // screens over these and hold no state of their own.\n workStates: \"work_states\",\n workTemplateDeclare: \"work_template_declare\",\n workTemplateInstantiate: \"work_template_instantiate\",\n workTemplateShape: \"work_template_shape\",\n /** Why a graph would be refused — asked BEFORE it is written, never after. */\n workTemplateRefusal: \"work_template_refusal\",\n workWhoseTurn: \"work_whose_turn\",\n workTakeAssignment: \"work_take_assignment\",\n workHasAssignment: \"work_has_assignment\",\n workAssignmentFields: \"work_assignment_fields\",\n workTransitionRefusal: \"work_transition_refusal\",\n workInstantiationShape: \"work_instantiation_shape\",\n workSlotsDeclare: \"work_slots_declare\",\n workSlotHold: \"work_slot_hold\",\n workSlotRelease: \"work_slot_release\",\n workSlotHolds: \"work_slot_holds\",\n workSlotExpire: \"work_slot_expire\",\n\n // THE WORK LAYER'S OWN DOORS (lane WORK-DOORS, 2026-09-20). Until this lane\n // all nineteen `custom.work_*` functions were SECURITY INVOKER with no client\n // grant: REC-69, REC-70 and REC-71 were live in the store and unreachable\n // from a browser. These are the verbs a person actually uses.\n workPerson: \"work_person\",\n workAssign: \"work_assign\",\n workRecordStates: \"work_record_states\",\n workSetState: \"work_set_state\",\n workList: \"work_list\",\n workTemplates: \"work_templates\",\n /** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */\n workInbox: \"work_inbox\",\n workApprovalApprovers: \"work_approval_approvers\",\n workApprovalRequest: \"work_approval_request\",\n workApprovalMayDecide: \"work_approval_may_decide\",\n workApprovalDecide: \"work_approval_decide\",\n workApprovalRead: \"work_approval_read\",\n\n // PRODUCTS row 13 — checklists and SOP runs.\n checklistRefusal: \"checklist_refusal\",\n checklistDeclare: \"checklist_declare\",\n checklistTemplates: \"checklist_templates\",\n checklistTemplateShape: \"checklist_template_shape\",\n checklistStart: \"checklist_start\",\n checklistRun: \"checklist_run\",\n checklistRuns: \"checklist_runs\",\n checklistStepComplete: \"checklist_step_complete\",\n checklistStepRefusal: \"checklist_step_refusal\",\n\n // THE GRID (lane GRID-PRIMITIVES, 2026-09-22) — what the /data grid rebuild calls. See ../grid.ts.\n tableDecorate: \"table_decorate\",\n tableDecorations: \"table_decorations\",\n gridLayout: \"grid_layout\",\n formulaParse: \"formula_parse\",\n actionDeclare: \"action_declare\",\n rowActions: \"row_actions\",\n actionRun: \"action_run\",\n tableWebhookDeclare: \"table_webhook_declare\",\n tableWebhooks: \"table_webhooks\",\n tableWebhookArchive: \"table_webhook_archive\",\n tableFromExample: \"table_from_example\",\n autonumberBackfill: \"autonumber_backfill\",\n ioExport: \"io_export\",\n\n // Declared here BECAUSE they do not exist yet: naming them is what makes the\n // absence visible to `pnpm check:store-registry` and to the suite.\n metadataSearch: \"metadata_search\",\n ruleDeclare: \"rule_declare\",\n fieldPropose: \"field_propose\",\n tablePropose: \"table_propose\",\n mergeFieldResolve: \"merge_field_resolve\",\n} as const;\n\nexport type DoorKey = keyof typeof DOORS;\n\n/** Which of this package's doors the live store actually has, and which it does not. */\nexport function doorCensus(): { present: string[]; absent: string[] } {\n const present: string[] = [];\n const absent: string[] = [];\n for (const name of Object.values(DOORS)) {\n (doorExists(name) ? present : absent).push(name);\n }\n return { present: present.sort(), absent: absent.sort() };\n}\n","// src/core/pgError.ts — @ai-matrx/records\n//\n// THE ONE FUNNEL from what the database said to what a caller reads. Every\n// method in this package's client goes through it, and it does exactly three\n// things: it classifies the SQLSTATE, it carries the store's message and hint\n// VERBATIM, and it parses the DETAIL when the store put json there.\n//\n// It never writes a sentence of its own about a refusal the store already\n// explained. The store's messages were written to be read by the person who hit\n// them — \"Someone else changed this record while you were working on it\" is the\n// screen's text, not a code the screen has to translate.\n\nimport type { PgError, RecordsError, RecordsErrorCode, StaleWriteDetail } from \"../results\";\n\n/**\n * SQLSTATE -> code. Every entry here answers one of the codes\n * `STORE_REFUSAL_CODES` reports the store raising; the real-door suite asserts\n * that this map covers all of them, so a new refusal class in the store shows\n * up as a red test rather than an `internal` in somebody's console.\n */\nconst BY_SQLSTATE: Record<string, RecordsErrorCode> = {\n PT409: \"stale_write\",\n \"42501\": \"door\",\n \"23514\": \"refused_by_rule\",\n \"22004\": \"invalid_argument\",\n \"22023\": \"invalid_argument\",\n // 22P02 — a value does not fit the type the store holds for it. The class is\n // real and was hit live: an organization whose copy of a package table grew\n // `status` as a uuid-valued Field was sent the text \"open\", and the store\n // answered `invalid input syntax for type uuid: \"open\"`. It is the CALL that\n // is wrong for the shape the store holds, which is what `invalid_argument`\n // already means — the store's own sentence names the value and the type.\n \"22P02\": \"invalid_argument\",\n // 42703 — a column that is not there. The store raises it from\n // `custom.entity_table`, which is asked for a column by NAME, so the class is\n // exactly \"the call named something the shape does not have\": the same thing\n // `invalid_argument` already means, and the store's own sentence names the\n // column. Added 2026-09-20 (lane FORMS) because the package's live-door suite\n // caught it raised by a door this package did not know about — which is the\n // suite working, and is why the map is a census rather than a guess.\n \"42703\": \"invalid_argument\",\n // 22007 — a date or a time the store could not read as one. It is raised by\n // `custom.dashboard_window_sql`, which is handed a window a caller wrote\n // (\"last 30 days\", a literal date), so the class is again \"the call named\n // something the shape does not accept\" and the store's own sentence names the\n // text it could not read. Added 2026-09-20 (lane SCREEN-BREAK) after the\n // live-door census caught it — the same way 42703 arrived, which is the\n // census working rather than a guess.\n \"22007\": \"invalid_argument\",\n // 22003 — a number the store could not hold at the size it was handed. It is\n // raised by `custom.context_resolve`, which is given a window or a depth a\n // caller wrote, so the class is the same one 22P02, 42703 and 22007 already\n // are: the CALL named a value the shape does not accept, and the store's own\n // sentence names the number and the range. Added 2026-09-20 (lane GRID-TWO)\n // when the live-door census caught the release gate red on it — which is the\n // census working, and the fourth time it has been the thing that found a new\n // refusal class rather than a person guessing one.\n \"22003\": \"invalid_argument\",\n \"02000\": \"not_found\",\n \"23503\": \"missing_reference\",\n \"23505\": \"already_exists\",\n \"0A000\": \"not_supported\",\n \"53400\": \"store_limit\",\n \"22012\": \"store_limit\",\n // 54001 — `custom.record_delete` stops a cascade that nests past sixty-four\n // levels of containment, because that is a loop somebody built rather than a\n // hierarchy, and saying so beats recursing until the server runs out of\n // stack. It is a LIMIT of the store, and the store's own sentence names what\n // to do about it, so it reads as one.\n \"54001\": \"store_limit\",\n // 54000 — the grid primitives' organization ceilings (GRID-PRIMITIVES, 2026-09-23):\n // `custom.action_run` on a selection past its knob, `custom.table_decorate` past the\n // rule count, `custom.table_from_example` past `custom/example_rows_max`,\n // `custom.table_webhook_declare` past `custom/table_webhooks_max`, and\n // `custom.hub_changed_by`. Each names its knob in the hint and writes nothing, so it\n // reads exactly like 54001: a limit of the store, in the store's own sentence.\n \"54000\": \"store_limit\",\n // VIS: `custom.has_visibility_at` refuses to answer from a snapshot older\n // than a write this reader has already seen, rather than returning something\n // they just lost access to. It is retryable on a fresher connection, which is\n // a different instruction from every other refusal here.\n \"40001\": \"stale_read\",\n // 57014 — the store cancelled the statement at its own timeout. Like\n // `stale_read` and unlike every other refusal here, the call was never\n // refused on its merits: the same call on a smaller page, or once the\n // organization's kernel is not being rewritten, can succeed. It gets its own\n // code so a screen can offer \"try again\" honestly instead of showing a\n // failure sentence the caller cannot act on.\n \"57014\": \"timed_out\",\n // PostgREST's own two: the store is not being SERVED, which is a different\n // thing from the store refusing. `custom` absent from `pgrst.db_schemas`, or\n // the grants not copied, land here.\n PGRST202: \"store_not_served\",\n PGRST205: \"store_not_served\",\n PGRST301: \"door\",\n // PT428 — NOT A FAILURE, and the release gate's live census is what found it\n // missing: the store raises it and this package answered `internal`, which is\n // the one classification that tells a screen nothing. A stage gate whose\n // `on_fail` is `require_approval` files the request and leaves the record\n // where it was; the transaction is rolled back to the pipeline's own block, so\n // \"nothing was written\" is a fact rather than a promise. Landed by lane\n // STAGE-RULES; mapped here by STAGE-RULES-2 the day after, when the census\n // caught it — the sixth time that census has been the thing that found a\n // refusal class rather than a person guessing one.\n PT428: \"needs_approval\",\n};\n\n/** The SQLSTATEs this package claims to understand. Exported for the guard. */\nexport const MAPPED_SQLSTATES = Object.keys(BY_SQLSTATE);\n\nfunction parseDetail(details: string | null | undefined): unknown {\n if (!details) return undefined;\n const trimmed = details.trim();\n if (!trimmed.startsWith(\"{\") && !trimmed.startsWith(\"[\")) return details;\n try {\n return JSON.parse(trimmed) as unknown;\n } catch {\n return details;\n }\n}\n\n/**\n * A CODE THAT IS NOT A SQLSTATE AT ALL — so it is not read as one.\n *\n * A SQLSTATE is five characters. supabase-js puts something else in `code` in\n * exactly two situations, and BOTH of them mean the call never reached the\n * store rather than the store refusing it:\n *\n * `\"\"` a `FetchError` — no network, a cancelled request, CORS.\n * `\"404\"`… an HTTP status, when the gateway answered with no JSON body.\n *\n * Lane TAILS-6 (2026-09-22) found both landing in `internal`, which is the one\n * classification that tells a screen nothing: a person on the Checklists tab of\n * a plumbing company's jobs table was shown \"Something went wrong at our end\"\n * with nothing to do about it, over a sentence naming this package. They are\n * `unreachable`, which a screen can honestly offer \"try again\" for.\n */\nfunction isNotASqlstate(code: string | undefined): boolean {\n if (!code) return true;\n return /^[0-9]{3}$/.test(code);\n}\n\n/** Map a PostgREST/supabase-js failure into the package's refusal shape. */\nexport function mapPgError(error: PgError, where: string): RecordsError {\n // `code: \"\"` is supabase-js's own value for a transport failure, and `\"\"` is\n // not nullish — so it has to be emptied deliberately or it becomes a SQLSTATE\n // nobody can look up.\n const raw = error.code ?? undefined;\n const sqlstate = raw && raw !== \"\" ? raw : undefined;\n const mapped: RecordsError = {\n code: \"internal\",\n message: error.message,\n ...(error.hint ? { hint: error.hint } : {}),\n ...(sqlstate ? { sqlstate } : {}),\n };\n if (isNotASqlstate(sqlstate)) {\n mapped.code = \"unreachable\";\n } else {\n mapped.code = BY_SQLSTATE[sqlstate!] ?? \"internal\";\n }\n const detail = parseDetail(error.details);\n if (detail !== undefined) mapped.detail = detail;\n if (mapped.code === \"internal\") {\n // 🚨 THE NOTE GOES IN ITS OWN FIELD, NEVER ONTO `hint` (lane TAILS-6).\n // `hint` is THE REMEDY — the sentence screens hand a person to act on — so\n // a note this package writes about ITSELF being surprised belonged nowhere\n // near it. It is still said out loud, so nobody reads the silence as\n // \"handled\"; it is said to whoever debugs this and to nobody else.\n mapped.unmapped = true;\n mapped.diagnostic =\n `@ai-matrx/records did not recognise SQLSTATE ${sqlstate ?? \"(none)\"} from ${where}; ` +\n `the store's own message is the thing to act on.`;\n } else if (mapped.code === \"unreachable\") {\n mapped.unmapped = true;\n mapped.diagnostic =\n `@ai-matrx/records never reached the store from ${where}: ` +\n `${raw ? `the transport answered ${raw}` : \"no response\"} — ${error.message}`;\n // 🚨 THE ONE PLACE THIS PACKAGE WRITES A MESSAGE OF ITS OWN, and it is the\n // one place where there is no store message to carry: the store never\n // answered. `TypeError: Failed to fetch` is the browser talking to itself,\n // not a sentence anybody should read, so it goes to the engineer's line\n // above and the person gets what actually happened.\n mapped.message = \"We could not reach your data.\";\n // Whatever the transport said was never a remedy either.\n delete mapped.hint;\n }\n return mapped;\n}\n\n/** Pull the conflict out of a `stale_write`, when the store sent one. */\nexport function staleWriteDetail(error: RecordsError): StaleWriteDetail | null {\n if (error.code !== \"stale_write\") return null;\n const detail = error.detail as Partial<StaleWriteDetail> | undefined;\n if (\n !detail ||\n typeof detail.expected_version !== \"number\" ||\n typeof detail.current_version !== \"number\"\n ) {\n return null;\n }\n return {\n expected_version: detail.expected_version,\n current_version: detail.current_version,\n contested_fields: detail.contested_fields ?? {},\n };\n}\n","// src/core/recordChanges.ts — @ai-matrx/records · lane RECORDS-UI-FIX (2026-09-23)\n//\n// EVERY SCREEN SHOWING A RECORD HEARS EVERY WRITE TO IT MADE THROUGH THIS PACKAGE.\n//\n// 🚨 WHAT A PERSON MET (VERIFIER-16 LOW, guide re-walk 2026-09-23): the record panel read\n// \"History 3 versions\" after its fourth write, while the store held four. The history\n// panel read the chain once, when it opened, and nothing told it the grid cell or the\n// form beside it had just written a new version. It is not the no-op-version class (the\n// store's history had the row; the screen never asked again) — it is a screen that\n// cannot hear the writes made on the same page.\n//\n// So every successful write door of the client announces the record it wrote, and any\n// screen showing that record re-reads on the announcement. Page-local and synchronous;\n// a write from another tab or person is realtime's job, not this one's.\n\ntype Listener = (recordId: string) => void;\n\nconst listeners = new Set<Listener>();\n\n/** Called by the client after a write door answered yes. */\nexport function announceRecordChanged(recordId: string): void {\n for (const listener of [...listeners]) {\n try {\n listener(recordId);\n } catch (thrown) {\n // A listener that throws must not take the write's answer with it.\n console.error(\"[@ai-matrx/records] a record-change listener threw\", thrown);\n }\n }\n}\n\n/** Hear every record this page writes. Returns the unsubscribe. */\nexport function onRecordChanged(listener: Listener): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n","// src/core/query.ts — @ai-matrx/records\n//\n// THE QUERY. DOOR-6 … DOOR-10.\n//\n// Query by any combination of relation coordinates and any subset of them; as-of\n// a date on EITHER clock; promoted-field predicates. DOOR-10 is the one that\n// shapes this module: every query is filtered by Visibility INSIDE the query,\n// never post-filtered — which is why nothing here ever reads rows and then drops\n// some. The filtering happens in the store's own policies and in the doors; this\n// builder only describes what to ask for.\n//\n// DOOR-N-3: every hot read runs as a PREPARED statement. A client cannot prepare\n// anything itself, so the builder never concatenates a value into SQL: relation\n// coordinates resolve through `custom.relation_targets`, promoted predicates\n// through `custom.promoted_read`, and both are functions with typed parameters —\n// which is what \"prepared\" means on this side of the wire.\n\nimport type { RelationCoordinate } from \"../relation\";\nimport type { Timestamp, Uuid } from \"../record\";\n\n/**\n * DOOR-8. As-of on EITHER clock, and they are different questions:\n * · `record` — the record clock: what this record looked like at version time.\n * · `world` — the world clock: which values were true of the world then\n * (the Field's `dated` modifier).\n */\nexport interface AsOf {\n clock: \"record\" | \"world\";\n at: Timestamp;\n}\n\n/** A predicate over a PROMOTED field (REC-5: promotion light -> heavy). */\nexport interface PromotedPredicate {\n field_key: string;\n /** The value as text, exactly as `custom.promoted_read` takes it. */\n equals: string;\n}\n\nexport interface RecordQuery {\n table_id: Uuid;\n /** DOOR-6. Any combination, any subset. An empty list means \"no relation constraint\". */\n relations?: RelationCoordinate[];\n /** Predicates the store can answer from an index. */\n promoted?: PromotedPredicate[];\n /** DOOR-8. */\n asOf?: AsOf;\n /** DOOR-9. Ask across EVERY Home of this Table in one answer. */\n acrossHomes?: boolean;\n /** REC-23. Soft-deleted rows are out unless you say otherwise. */\n includeDeleted?: boolean;\n /** FLD-10. */\n recordType?: string;\n orderBy?: { column: \"created_at\" | \"updated_at\"; ascending?: boolean };\n limit?: number;\n offset?: number;\n}\n\n/**\n * What a query decomposes into: a set of door calls whose answers INTERSECT,\n * then one filtered read. Kept as data rather than hidden inside the client so\n * the suite can assert the plan as well as the answer — a query that quietly\n * stopped applying one of its coordinates is otherwise invisible.\n */\nexport interface QueryPlan {\n /** One `relation_targets` call per coordinate; the id sets are intersected. */\n relationCalls: Array<{ door: \"relation_targets\"; record_id: Uuid; via_key: string | null }>;\n /** One `promoted_read` call per predicate; intersected with the above. */\n promotedCalls: Array<{ door: \"promoted_read\"; field_key: string; value: string }>;\n /** The filtered read over `custom.record`, which the store's policies gate. */\n read: {\n table_id: Uuid;\n includeDeleted: boolean;\n recordType: string | null;\n asOf: AsOf | null;\n acrossHomes: boolean;\n orderBy: { column: string; ascending: boolean };\n limit: number;\n offset: number;\n };\n /**\n * Stated so nobody has to guess: when this is true the answer is the\n * intersection of the id sets above, and when it is false the read stands\n * alone.\n */\n intersects: boolean;\n}\n\nexport const DEFAULT_PAGE_SIZE = 50;\n\nexport function planQuery(query: RecordQuery): QueryPlan {\n const relationCalls = (query.relations ?? []).map((coordinate) => ({\n door: \"relation_targets\" as const,\n record_id: coordinate.record_id,\n via_key: coordinate.role ?? null,\n }));\n const promotedCalls = (query.promoted ?? []).map((predicate) => ({\n door: \"promoted_read\" as const,\n field_key: predicate.field_key,\n value: predicate.equals,\n }));\n return {\n relationCalls,\n promotedCalls,\n read: {\n table_id: query.table_id,\n includeDeleted: query.includeDeleted ?? false,\n recordType: query.recordType ?? null,\n asOf: query.asOf ?? null,\n acrossHomes: query.acrossHomes ?? false,\n orderBy: {\n column: query.orderBy?.column ?? \"created_at\",\n ascending: query.orderBy?.ascending ?? false,\n },\n limit: query.limit ?? DEFAULT_PAGE_SIZE,\n offset: query.offset ?? 0,\n },\n intersects: relationCalls.length + promotedCalls.length > 0,\n };\n}\n\n/** The intersection of the id sets a plan's calls produced. Order is preserved from the first set. */\nexport function intersectIds(sets: Uuid[][]): Uuid[] {\n if (sets.length === 0) return [];\n const [first, ...rest] = sets as [Uuid[], ...Uuid[][]];\n const others = rest.map((s) => new Set(s));\n return first.filter((id) => others.every((set) => set.has(id)));\n}\n","// src/core/client.ts — @ai-matrx/records\n//\n// THE TYPED CLIENT OVER THE STORE'S DOORS, AND NOTHING ELSE.\n//\n// Every write in this file goes through `custom.record_write`,\n// `custom.record_update`, `custom.record_delete` or `custom.record_restore`.\n// There is no `insert`, no `update` and no `delete` against `custom.record`\n// anywhere in this package, and there is no code path that adds one: DOOR-N-1\n// says there is exactly one write door and `authenticated` holds no direct\n// INSERT, UPDATE or DELETE grant on the store — a client that tried would be\n// refused, and a client that TRIES is a defect even when it is refused.\n//\n// Reads go through the read door too (DOOR-1, DOOR-10): the filtered select over\n// `custom.record` is gated by the store's own policies, and this file never\n// takes rows and then drops some of them. Where it needs an id set it asks a\n// door for one.\n//\n// Nothing here throws. Every method answers `RecordsResult`, and every refusal\n// carries the store's own sentence.\n\nimport type { ArchivedDoorRow, ArchivedRow, ArchiveLane } from \"../archive\";\nimport { DEFAULT_ARCHIVE_LANE } from \"../archive\";\nimport type {\n AggregateBucket,\n AggregateFilter,\n AggregateMeasure,\n AggregateRow,\n RecordFilter,\n} from \"../aggregate\";\nimport type {\n CaptureFileRef,\n CaptureOutcome,\n CaptureSheetFace,\n CaptureSheetSummary,\n} from \"../capture\";\nimport type {\n DashboardBlock,\n DashboardRunResult,\n DashboardSummary,\n StuckRow,\n} from \"../dashboard\";\nimport type { DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken } from \"../doc\";\nimport type {\n EnrichCell,\n EnrichDeclared,\n EnrichDueRow,\n EnrichRun,\n EnrichmentSummary,\n} from \"../enrich\";\nimport type {\n CommentThreadRead,\n CommentWritten,\n FieldHistoryEntry,\n RecordHistoryEntry,\n RestorePreview,\n RestoreResult,\n} from \"../history\";\nimport type {\n DigestPreview,\n MySubscription,\n SavedViewRow,\n SavedViewSpecIn,\n Subscription,\n SubscriptionSpec,\n} from \"../subscription\";\nimport type {\n AnonTokenBinding,\n WorkApprovalDecision,\n WorkApprovalFiled,\n WorkApprover,\n WorkAssignment,\n WorkAssignmentField,\n WorkChange,\n WorkInboxItem,\n WorkListFlavour,\n WorkListItem,\n WorkRecordState,\n WorkGraph,\n WorkInstantiation,\n WorkSlotHold,\n WorkState,\n WorkTurn,\n} from \"../work\";\nimport type {\n ChecklistDeclared,\n ChecklistRunStarted,\n ChecklistRunStep,\n ChecklistRunSummary,\n ChecklistSpec,\n ChecklistStepCompleted,\n ChecklistTemplateShape,\n ChecklistTemplateSummary,\n} from \"../checklist\";\nimport type { ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding } from \"../trust\";\nimport type { RelationWordsManyArgs } from \"../relation\";\nimport { mintOpId } from \"../ops\";\nimport type { Field } from \"../field\";\nimport type {\n Pipeline,\n PipelineColumn,\n PipelineDeclared,\n PipelineMoveResult,\n PipelineSpec,\n PipelineVerdict,\n StagePending,\n StagePendingOnBoard,\n PipelineGate,\n PipelineGatePreview,\n StageRuleEnforcement,\n StageRuleOnFail,\n} from \"../pipeline\";\nimport type {\n EntityFieldRights,\n EntityRecordRead,\n EntityRecordsFound,\n EntityTableFacts,\n NewEntityFieldDeclaration,\n} from \"../entity-field\";\nimport type { BookingAvailability, BookingDeclared, BookingSummary, FormSummary } from \"../rule\";\nimport type {\n ImportColumnsDeclared,\n ImportBatchResult,\n ImportFinished,\n ImportOpened,\n ImportPlan,\n ImportPolicy,\n ImportReport,\n ImportRun,\n InboundAddress,\n InboundDeclared,\n} from \"../import\";\nimport type {\n ConversationScope,\n ConversationScopeContext,\n RecordScopeContext,\n} from \"../record-scope\";\nimport type {\n PortalArchiveAnswer,\n PortalArchiveFilter,\n PortalCard,\n PortalInvitation,\n PortalPreviewRow,\n PortalRevocation,\n PortalSummary,\n PortalTableRef,\n} from \"../portal\";\nimport { asPermissionLevel, type MyLevel } from \"../level\";\nimport type { FieldPatch, FieldProposal, NewFieldDeclaration, TableProposal } from \"../field\";\nimport type {\n HiddenFieldNotice,\n ReadRow,\n RecordRevision,\n ReadValue,\n RecordDocument,\n RecordGraphWritten,\n RecordRead,\n StoredRecord,\n Timestamp,\n Uuid,\n} from \"../record\";\nimport type { RecordsConfig, RecordsErrorSink } from \"../ports\";\nimport type { RecordsError, RecordsErrorCode, RecordsResult, WriteConflict } from \"../results\";\nimport { err, ok } from \"../results\";\nimport type { Table, TableArchiveProgress, TableCapacity } from \"../table\";\nimport type {\n ActionRunResult,\n DecorationPath,\n ExampleBuilt,\n FormulaParse,\n GridLayout,\n IoExportPage,\n RecordEvent,\n RowAction,\n TableDecorations,\n TableWebhook,\n TableWebhookDeclared,\n} from \"../grid\";\nimport { exampleSpec, exportPageXlsx } from \"../grid\";\nimport {\n DOORS,\n TRUST_DOORS,\n TRUST_SCHEMA,\n WORKBENCH_DOORS,\n WORKBENCH_SCHEMA,\n doorAbsent,\n doorExists,\n} from \"./doors\";\nimport { mapPgError, staleWriteDetail } from \"./pgError\";\nimport { announceRecordChanged } from \"./recordChanges\";\nimport { intersectIds, planQuery, type RecordQuery } from \"./query\";\n\nconst DEFAULT_SCHEMA = \"custom\";\n\n/**\n * 🚨 A REFUSAL IS NOT AN APP ERROR (lane RECORDS-UI-FIX, guide re-walk 2026-09-23).\n *\n * A person typing `-3` into a column that takes \"at least 0\" is the store WORKING: the\n * rule said no, the screen said so in the one notice, and the person fixed it. The default\n * sink printed every one of those through `console.error`, and the app's error capture\n * (matrx-frontend `lib/diagnostics/globalErrorCapture.ts`) counts every `console.error` —\n * so one refused value lit a red \"2 errors\" pill in the corner, telling an admin the\n * product had failed when a person had simply been told no.\n *\n * These are the codes a PERSON causes by what they typed or when they typed it; each one\n * is already drawn on the screen that asked. They are still said (`console.info`), never\n * silenced. Everything else — a door, the store switched off, a timeout, a class this\n * package did not recognise — is a failure of the system and stays `console.error`.\n */\nexport const A_PERSONS_REFUSAL: ReadonlySet<RecordsErrorCode> = new Set<RecordsErrorCode>([\n \"refused_by_rule\",\n \"stale_write\",\n \"invalid_argument\",\n \"already_exists\",\n \"missing_reference\",\n]);\n\nexport function isAPersonsRefusal(code: RecordsErrorCode | string): boolean {\n return A_PERSONS_REFUSAL.has(code as RecordsErrorCode);\n}\n\nfunction sink(config: RecordsConfig): RecordsErrorSink {\n return (\n config.onError ??\n ((e) => {\n // The defined degradation, stated: with the store's own words, and naming where it\n // happened. Never silence — but a person's refusal is information, not an error.\n const line = `[@ai-matrx/records] ${e.where}: ${e.code} — ${e.message}${e.hint ? ` (${e.hint})` : \"\"}`;\n if (isAPersonsRefusal(e.code)) console.info(line);\n else console.error(line);\n })\n );\n}\n\nexport interface RecordsClient {\n /** The config this client was built with, so a screen can show who it is acting as. */\n readonly config: RecordsConfig;\n\n // ── writes: the one door each ────────────────────────────────────────────\n recordWrite(args: { table_id: Uuid; data: RecordDocument }): Promise<RecordsResult<Uuid>>;\n /**\n * Write MANY new records of one Table in one call.\n *\n * `custom.record_write_many` asks the switch, the organization and the Table\n * ONCE for the whole batch and inserts the rows in one statement — which is\n * why a paste of 120 lines is one round trip per chunk instead of 120. It\n * CREATES only: there is no bulk update door, because an update carries a\n * per-row optimistic version and a batch would have to either drop that or\n * fail the whole batch for one stale row.\n *\n * It returns the new ids IN THE ORDER THE ROWS WERE HANDED IN, so a caller\n * can tie each id back to the line of the spreadsheet it came from. Hand in\n * `ids` to choose them yourself; hand in none and the door mints them.\n */\n recordWriteMany(args: {\n table_id: Uuid;\n rows: RecordDocument[];\n ids?: Uuid[];\n }): Promise<RecordsResult<Uuid[]>>;\n /**\n * A PARENT, THE EDGES IT STANDS ON AND THE ROWS THAT BELONG TO IT — ALL OR NOTHING.\n *\n * `recordWrite` and `recordWriteMany` are each ONE statement. A screen or a\n * server path whose unit of work is a GRAPH — an AI artifact and the lines\n * it produced, an order and its items, a research note and its citations —\n * could therefore not save it as one thing: a loop is N transactions, and a\n * failure on row nineteen leaves a parent standing without the lines it\n * promised.\n *\n * `custom.record_write_graph` is one statement, so it is one transaction. It\n * is NOT a second write path: it calls `custom.record_write_many` for the\n * rows, `public.assoc_add` for an edge that points OUT of the store (the\n * message a record was produced by), and `platform.relation_set` for the\n * parent's own declared relation to its children. Same store switch, same\n * editor rung on the Table, same value envelope, same undeclared-key guard,\n * same history rows, same realtime notice.\n *\n * ONE REFUSAL REFUSES THE WHOLE GRAPH, BY NAME — the answer says which member\n * failed and carries the store's own sentence about it, and nothing is\n * written.\n *\n * Every child MUST name a `role`: it is the key of a declared RELATION field\n * on the parent's Table, and an edge out of a record that names no field is\n * refused by the store (REL-10 / T7) because without it nothing can read the\n * relation's delete rule, its cardinality or its organization wall. The order\n * children are handed in IS the order of the relation.\n */\n recordWriteGraph(args: {\n table_id: Uuid;\n parent: RecordDocument;\n /** Each child: its document, the parent FIELD it fills, and optionally its own Table. */\n children?: Array<{\n data: RecordDocument;\n role: string;\n table_id?: Uuid;\n position?: number;\n }>;\n /** Edges to things OUTSIDE the store. `direction` defaults to `\"in\"` — that thing produced this record. */\n edges?: Array<{\n entity: string;\n id: Uuid;\n direction?: \"in\" | \"out\";\n label?: string;\n role?: string;\n position?: number;\n metadata?: Record<string, unknown>;\n }>;\n }): Promise<RecordsResult<RecordGraphWritten>>;\n recordUpdate(args: {\n record_id: Uuid;\n patch: Record<string, unknown>;\n /** Leave it out and the last writer wins; supply it and a loser is TOLD. */\n expectedVersion?: number;\n }): Promise<RecordsResult<number>>;\n /**\n * REC-23. Soft, and reversible within `retention`.\n *\n * 🚨 NOT FOR A TABLE. A Table is a record, so this door accepts one — and\n * then recurses through every record the Table contains inside a single\n * transaction, which is unbounded by construction and dies on `57014` at a\n * size the product's own import reaches in half a minute. Use\n * `tableArchive` below, which does the same work in resumable passes.\n */\n recordDelete(args: { record_id: Uuid }): Promise<RecordsResult<Timestamp>>;\n recordRestore(args: { record_id: Uuid }): Promise<RecordsResult<void>>;\n /**\n * ARCHIVING A WHOLE TABLE — ONE PASS OF IT (VERIFIER-11 F3).\n *\n * One call archives at most `chunk` of the table's live records through\n * `custom.record_delete` (so every guard, history capture and outbox row\n * still happens; nothing is hard-deleted) and comes back with the numbers a\n * screen draws progress from. The CALLER LOOPS until `done` — that loop is\n * the fix, because the one thing a single statement cannot be made to do is\n * finish.\n *\n * `chunk: 0` changes nothing and only reports, so a screen can say \"1,430\n * records will be archived\" BEFORE a person commits to it. `includeTable:\n * false` empties the table and leaves it standing.\n *\n * RESUMABLE, WITHOUT A JOB ROW: what remains is read off the records\n * themselves every call. A pass that fails, a closed tab or a deploy mid-run\n * leaves a half-archived table and a next call that continues from exactly\n * there. A caller must therefore never report \"nothing happened\" after a\n * failed pass — `archived_total` says what really landed.\n */\n tableArchive(args: {\n table_id: Uuid;\n /**\n * How many records this pass takes on. The door clamps it; it answers with what it\n * took. Default 50 — measured: ~35ms a record against an 8s statement timeout, so\n * 200 dies on `57014` and is the original defect one level up.\n */\n chunk?: number;\n /** Archive the Table record itself once nothing live is left in it. Default true. */\n includeTable?: boolean;\n }): Promise<RecordsResult<TableArchiveProgress>>;\n\n // ── reads ────────────────────────────────────────────────────────────────\n recordRead(args: { record_id: Uuid; withComputed?: boolean }): Promise<RecordsResult<RecordRead>>;\n /**\n * DOOR-1. A page of one Table's records THROUGH `custom.read_records`: the\n * store decides which rows this reader may see and which fields of them, and\n * a field it masked comes back present-and-null with its reason in `hidden`.\n * `total` is null because the door counts nothing it has not read — a count\n * of rows a person may not see is a leak with a number on it.\n */\n list(args: {\n table_id: Uuid;\n /**\n * THE STORE'S ONE FILTER SHAPE (`RecordFilter`). Left out, this is the\n * whole page. Supplied, the store narrows INSIDE its own query — never the\n * browser, which can only ever filter the rows it was already allowed to\n * see and would silently drop the rest of the answer.\n *\n * It is the same object a saved view stores as `filters` and the same one\n * `recordAggregate` counts with, so the rows a drill-through opens are the\n * rows the number on the dashboard counted.\n */\n filter?: RecordFilter;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<{ rows: ReadRow[]; total: number | null }>>;\n /**\n * DOOR-1 FOR AN ID SET. Exactly these records of this Table, through\n * `custom.read_records_by_ids` — the same ladder, the same level, the same\n * field masking and the same page ceiling as `list`, addressed by id instead\n * of by page. An id the reader may not see simply does not come back, which\n * is the same answer `list` gives by omission.\n *\n * It exists because a realtime notice has always named the exact ids that\n * moved and no door could take them: three cells changing re-read a fifty-row\n * page in every watching browser.\n */\n listByIds(args: { table_id: Uuid; ids: readonly Uuid[] }): Promise<RecordsResult<ReadRow[]>>;\n /**\n * DOOR-1 FOR THE ROWS THAT LEFT: a page of one Table's ARCHIVED records,\n * through `custom.read_records_archived` — the same ladder, the same level,\n * the same field masking and the same page ceiling as `list`, with the sign\n * of the `deleted_at` test flipped, plus who archived each one and when.\n *\n * 🚨 IT EXISTS BECAUSE ARCHIVING WAS A ONE-WAY DOOR (VERIFIER-10 F4). The\n * store has always had `record_restore`, and it has always done exactly the\n * right thing; what it did not have was any door that could LIST the records\n * it would act on, because every read door answers live rows only. So an\n * archived record was unreachable from every screen in the platform.\n *\n * `lane` is the archived-items law's two lanes — \"mine\" (what I archived) and\n * \"org\" (what anybody in this organization archived), which is the default.\n */\n listArchived(args: {\n table_id: Uuid;\n lane?: ArchiveLane;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<{ rows: ArchivedRow[]; total: number | null }>>;\n query(query: RecordQuery): Promise<RecordsResult<{ rows: ReadRow[]; total: number | null }>>;\n tableList(): Promise<RecordsResult<Table[]>>;\n /**\n * IS THIS TABLE IN THE ARCHIVE? (lane HUB-FIX, 2026-09-23.) The archived row for one\n * Table of this organization, or `null` when the archive does not hold it — which\n * is an ANSWER, never \"it may have been deleted\". A table page that cannot find a\n * Table asks this before saying anything: an archived Table's own address used to\n * read \"…or it may have been deleted\" when it was archived and one click from back.\n */\n tableArchived(args: { table_id: Uuid }): Promise<RecordsResult<ArchivedRow | null>>;\n fields(args: { table_id: Uuid; recordType?: string }): Promise<RecordsResult<Field[]>>;\n /**\n * FLD-5 / FLD-6: a list field stores the id of an option RECORD, because\n * every pick-list is already a Table. These are that Table's records — the\n * store resolves which Table from the Field's own config, so no caller has to\n * know it.\n */\n fieldOptions(args: { field_id: Uuid }): Promise<RecordsResult<StoredRecord[]>>;\n tableCapacity(args: { table_id: Uuid }): Promise<RecordsResult<TableCapacity>>;\n\n // ── declaring a Table, and the kernels a Table needs to exist ────────────\n /**\n * REC-1: a Table has to live somewhere, so a Home comes first — and a Home is\n * an ordinary record in the person kernel. `homeId` is therefore required and\n * `personKernelId()` is how a caller gets a Table to write one into.\n */\n tableDeclare(args: { spec: Record<string, unknown>; homeId: Uuid }): Promise<RecordsResult<Uuid>>;\n /**\n * ADD A FIELD TO A TABLE. One call, and the store does the three things no\n * client can do for itself: it turns a parity type into the behaviour,\n * modifiers, format, unit, relation target and Rules its own guards demand;\n * it tells the TABLE about the field (REC-1 / FLD-8 — a definition for a\n * field the table never declared is refused, which is the sentence every\n * \"Add field\" used to end on); and it stores the definition as a FIELD\n * rather than as a plain record, so the delete rules and the\n * formula-dependency check can see it.\n *\n * A choice list carries its `options` as words. The store keeps them the only\n * way FLD-5 / FLD-6 allows — as the records of a Table it declares for them —\n * so nobody is made to build a table before they can have a dropdown.\n */\n fieldDeclare(args: { table_id: Uuid; spec: NewFieldDeclaration }): Promise<RecordsResult<Uuid>>;\n /** One field's own settings. What it HOLDS is a conversion and is refused here by name. */\n fieldUpdate(args: { field_id: Uuid; patch: FieldPatch }): Promise<RecordsResult<Uuid>>;\n /**\n * REL-DISP. THE WORDS ONE RELATION CELL SHOWS, resolved by the store through\n * that column's own display spec — one column or several, joined by its\n * separator. Never resolve a relation label any other way: the store's\n * `custom._words_for` is the one body that decides what a record is called, it\n * asks the visibility ladder BEFORE it reads the name, and a record this reader\n * may not open comes back as the withheld sentence rather than its name or id.\n * A value that is not an id is handed straight back — it is already words.\n */\n relationWords(args: { field_id: Uuid; value: string }): Promise<RecordsResult<string | null>>;\n /**\n * The same answer for a WHOLE PAGE of cells in one round trip. Prefer this\n * wherever a grid, board, list or picker resolves more than one chip: the\n * per-id lane is what made a page of relation cells a page of requests.\n */\n relationWordsMany(\n args: RelationWordsManyArgs,\n ): Promise<RecordsResult<Record<string, string>>>;\n /** Take a field off a table. Refuses the title field, the last field, and one another field reads through. */\n fieldRetire(args: { field_id: Uuid }): Promise<RecordsResult<boolean>>;\n // ── CUSTOM FIELDS ON A STANDARD BUSINESS TABLE (REC-34 / REC-40 / FLD-8) ──\n // Named by the registry TOKEN, because a standard table has no Table record.\n // One set for all 643 tables the registry types Entity or Detail, and no\n // per-table code anywhere in this package or in any screen that uses it.\n /** What the registry says about a token, and whether it can hold a value at all. */\n entityTable(args: { token: string }): Promise<RecordsResult<EntityTableFacts>>;\n /** The fields THIS organization added to that standard table. */\n entityFields(args: { token: string }): Promise<RecordsResult<Field[]>>;\n /** Add a column to a standard table. An organization admin's right - it changes the table for everybody. */\n entityFieldDeclare(args: { token: string; spec: NewEntityFieldDeclaration }): Promise<RecordsResult<Uuid>>;\n /** One field's own settings. A TYPE change is refused here by name, as it is on a custom table. */\n entityFieldUpdate(args: { field_id: Uuid; patch: Record<string, unknown> }): Promise<RecordsResult<Uuid>>;\n /** Take a custom field off a standard table. The values already written stay in each row. */\n entityFieldRetire(args: { field_id: Uuid }): Promise<RecordsResult<Uuid>>;\n /** May this person add a column here - and if not, the store's own sentence saying why. */\n entityFieldRights(args: { token: string }): Promise<RecordsResult<EntityFieldRights>>;\n /** REC-53 in one answer: the row's real columns AND its custom values AND the definitions. */\n entityRecordRead(args: { token: string; record_id: Uuid }): Promise<RecordsResult<EntityRecordRead>>;\n /** A patch: a key left out is left alone, a key set to null is cleared with its envelope. */\n entityValueWrite(args: {\n token: string;\n record_id: Uuid;\n patch: Record<string, unknown>;\n }): Promise<RecordsResult<EntityRecordRead>>;\n /** Rows of that standard table with this custom value. Refuses a field nobody declared. */\n entityRecordsFind(args: {\n token: string;\n key: string;\n value?: unknown;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<EntityRecordsFound>>;\n\n /** The kernel Tables a caller writes a Home, a Field or a Rule into. */\n personKernelId(): Promise<RecordsResult<Uuid>>;\n fieldKernelId(): Promise<RecordsResult<Uuid>>;\n ruleKernelId(): Promise<RecordsResult<Uuid>>;\n\n // ── Rules: the STORE decides membership, never a screen ──────────────────\n /** Every record the Rule says is a member. A saved view's list is this, not a filter a screen ran. */\n /** PRODUCTS row 7 — the whole board: its stage column, its stages in the declared\n * order, and every Rule WITH the sentence it says when it refuses. */\n pipelineRead(args: { table_id: Uuid }): Promise<RecordsResult<Pipeline>>;\n /** The store's own count and total per column, over what this person may see. */\n pipelineBoard(args: {\n table_id: Uuid;\n measure?: string | null;\n }): Promise<RecordsResult<PipelineColumn[]>>;\n /** Whether this card may go to that column — asked BEFORE the finger lets go. */\n pipelineTransitionRefusal(args: {\n record_id: Uuid;\n to: string;\n }): Promise<RecordsResult<PipelineVerdict>>;\n /**\n * Move a record to a stage. An ORDINARY record write, judged by the same Rules.\n *\n * It answers an OBJECT on every path. A gate whose `on_fail` is `require_approval`\n * comes back `applied: false` with the wait it filed — the record has NOT moved, and a\n * screen that treated the call's success as the move's success would show the card in\n * the wrong column while somebody is still deciding.\n */\n pipelineMove(args: {\n record_id: Uuid;\n to: string;\n also?: Record<string, unknown>;\n expected_version?: number | null;\n }): Promise<RecordsResult<PipelineMoveResult>>;\n /** Declare (or re-state) a pipeline: the stage column and its transition Rules. */\n pipelineDeclare(args: {\n table_id: Uuid;\n spec: PipelineSpec;\n }): Promise<RecordsResult<PipelineDeclared>>;\n /** Which column of this table holds its stage, or null when it is not a board. */\n tableStageField(args: { table_id: Uuid }): Promise<RecordsResult<string | null>>;\n /** The closed list of what a gate does when it says no — the store is the authority. */\n stageRuleOnFailKinds(): Promise<RecordsResult<{ behaviour: StageRuleOnFail; note: string }[]>>;\n /** Whether this organization's gates refuse or warn. One opinion, asked once. */\n stageRuleEnforcement(): Promise<RecordsResult<StageRuleEnforcement>>;\n /** What is waiting on this card: approvals filed against its own stage column. */\n recordStagePending(args: { record_id: Uuid }): Promise<RecordsResult<StagePending[]>>;\n /** The same question for a whole board, in ONE call — what a Kanban badges cards from. */\n pipelinePending(args: { table_id: Uuid }): Promise<RecordsResult<StagePendingOnBoard[]>>;\n /**\n * WHAT THIS GATE WOULD DO TO THIS BOARD TODAY — for a gate that has not been saved.\n *\n * The settings screen calls it on every edit of the condition, which is why it takes\n * the gate rather than a rule id: no saved-rule door can answer about a rule that does\n * not exist yet. The store compiles it with the same compiler `pipelineDeclare` uses,\n * so the number here and the refusal at the door are the same rule — a preview with its\n * own compiler would be wrong exactly at the edge of the condition, which is the only\n * place anybody looks.\n *\n * A gate that does not say what it demands is REFUSED, not answered zero: \"no cards\n * would be stopped\" beside a half-written rule is the sentence that gets it saved.\n */\n pipelineGatePreview(args: {\n table_id: Uuid;\n stage: string;\n gate: PipelineGate | Record<string, unknown>;\n }): Promise<RecordsResult<PipelineGatePreview>>;\n ruleMembers(args: { rule_id: Uuid }): Promise<RecordsResult<StoredRecord[]>>;\n /** Is this one record a member, and WHY — the store's own answer. */\n ruleMembership(args: { rule_id: Uuid; record_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Run a stored Rule against a document. */\n ruleRun(args: { rule_id: Uuid; values: Record<string, unknown>; context?: Record<string, unknown> }): Promise<RecordsResult<unknown>>;\n /** Evaluate a Rule expression that has not been stored — the conditional logic a form runner asks about. */\n ruleEval(args: { expr: unknown; values: Record<string, unknown>; context?: Record<string, unknown> }): Promise<RecordsResult<unknown>>;\n /**\n * Write ONE Rule as a real Rule. `recordWrite` into the Rule kernel makes a\n * valid Rule document that carries `data_class = 'record'`, and every reader\n * that looks for a Rule looks for the class — `custom.agg_subscriptions`\n * selects `where data_class = 'rule'` — so a subscription written that way\n * fires at nobody. This is the door that closes it.\n */\n // ── Forms: a form is a VIEW ON A REAL TABLE (SCR-13, PRODUCTS row 1) ──────\n /** This organization's forms, with how many answers arrived and how many are in the table. */\n forms(args?: { table_id?: Uuid | null }): Promise<RecordsResult<FormSummary[]>>;\n /**\n * THIS ORGANIZATION'S BOOKING PAGES (PRODUCTS row 14), with the numbers that make\n * the list worth opening: how many are booked, cancelled, still ahead, and how many\n * slots somebody is holding right now. A booking page is an `anon_form`, so it is\n * opened and closed with `anonPublish` exactly as a form is.\n */\n bookings(args?: { table_id?: Uuid | null }): Promise<RecordsResult<BookingSummary[]>>;\n /**\n * CREATE OR RE-STATE ONE BOOKING PAGE over one Table. `admin` on the Table,\n * because a booking page decides what a stranger may write into it and which\n * hours of the organization's week are on offer.\n *\n * `slot`, `status` and `booked_with` are the store's to fill in: a question\n * naming any of the three is refused BY NAME, so a page cannot be built that\n * lets a visitor choose their own status. It does NOT publish — `anonPublish`\n * is the one act that opens a public surface, for a booking page exactly as\n * for a form.\n *\n * Until 2026-09-21 this door had no client method, so the ONLY way to a\n * booking page was to ask an agent for one. The agent path is the faster one,\n * never the only one.\n */\n bookingDeclare(args: {\n table_id: Uuid;\n title: string;\n questions: unknown[];\n availability?: Partial<BookingAvailability> | null;\n presentation?: Record<string, unknown> | null;\n submission_cap?: number | null;\n quarantine_rule_id?: Uuid | null;\n notify_rule_id?: Uuid | null;\n form_id?: Uuid | null;\n slug?: string | null;\n home_id?: Uuid | null;\n }): Promise<RecordsResult<BookingDeclared>>;\n /** Create or re-state one form. A question naming no Field of that Table is refused BY NAME. */\n formDeclare(args: {\n table_id: Uuid;\n title: string;\n questions: unknown[];\n presentation?: Record<string, unknown> | null;\n submission_cap?: number | null;\n quarantine_rule_id?: Uuid | null;\n notify_rule_id?: Uuid | null;\n form_id?: Uuid | null;\n slug?: string | null;\n }): Promise<RecordsResult<Uuid>>;\n\n // ── PULLING A SPREADSHEET IN (PRODUCTS row 9) ────────────────────────────\n // The BYTES are parsed here (`importCsv` / `importXlsx` in `core/io.ts`,\n // because Postgres cannot unzip a workbook). EVERYTHING after the parse is\n // the store's: the mapping, the type inference, the coercion of `$1,250.00`\n // into money and of an email into the person it belongs to, the duplicate\n // check, the provenance and the per-row outcome. There is no second importer\n // in this package and there is no place for one to drift to.\n /**\n * What the store makes of a file's columns, before anything is written.\n * `columns` is `[{header, samples}]` — the first page of the file is plenty.\n */\n importPlan(args: {\n table_id: Uuid;\n columns: Array<{ header: string; samples: unknown[] }>;\n }): Promise<RecordsResult<ImportPlan>>;\n /**\n * Open a run. `file_hash` is the run's IDENTITY: the same bytes into the same\n * table a second time answer the FIRST run with `already: true` and write\n * nothing, so a re-import doubles nothing. `force` re-opens deliberately.\n */\n importBegin(args: {\n table_id: Uuid;\n format?: \"csv\" | \"xlsx\";\n source_name?: string | null;\n source_columns?: unknown[];\n file_hash?: string | null;\n policy?: ImportPolicy;\n /** A Field key. A row whose value for it is already here is a duplicate. */\n dedupe_key?: string | null;\n file_bytes?: number | null;\n force?: boolean;\n }): Promise<RecordsResult<ImportOpened>>;\n /**\n * IMPORT-2. ADD THE COLUMNS THIS FILE HAS AND THIS TABLE HAS NOT — a step of\n * its own, BEFORE the run is opened, so the screen can show \"8 columns added\"\n * and the person can then name one of them as the file's duplicate key\n * (`importBegin` refuses a key naming a column that does not exist yet).\n * Answers the mapping the file should be sent with. Admin on the Table.\n */\n importDeclareColumns(args: {\n table_id: Uuid;\n rows: Array<Record<string, unknown>>;\n /** Header -> Field key the person already mapped by hand; never declared. */\n mapping?: Record<string, string>;\n }): Promise<RecordsResult<ImportColumnsDeclared>>;\n /**\n * One BATCH of rows. The batch is PLANNED and then written as ONE statement\n * through the batched write door, so 250 round trips became one; a batch a\n * guard refuses falls back to one write a row, and the answer says which it\n * was. Send `ImportOpened.rows_per_call` the first time and\n * `ImportBatchResult.rows_per_call` — measured — every time after that.\n */\n importRows(args: {\n import_id: Uuid;\n rows: Array<Record<string, unknown>>;\n /** Header -> Field key. A header that already spells a key needs no entry. */\n mapping?: Record<string, string>;\n }): Promise<RecordsResult<ImportBatchResult>>;\n /**\n * Close the run and decide the columns the file had and the table did not:\n * `propose` (the ONE approvals inbox, and the only choice a non-admin has),\n * `create` (an admin adds them outright) or `ignore`.\n */\n importFinish(args: {\n import_id: Uuid;\n unmapped?: \"propose\" | \"create\" | \"ignore\";\n }): Promise<RecordsResult<ImportFinished>>;\n /** The refused rows, or the ones already here, WITH the source row on each. */\n importReport(args: {\n import_id: Uuid;\n state?: \"refused\" | \"duplicate\";\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<ImportReport>>;\n /** This organization's import runs, newest first. How you find yesterday's. */\n imports(args?: { table_id?: Uuid | null; limit?: number }): Promise<RecordsResult<ImportRun[]>>;\n /**\n * Forget the RECEIPT for a file so the same bytes can be imported again\n * deliberately. Never touches the records that import wrote.\n */\n importForget(args: { import_id: Uuid }): Promise<RecordsResult<boolean>>;\n\n // ── THE ADDRESS A TABLE OWNS (DOOR-19, P8) ───────────────────────────────\n /**\n * Give a table its own address. The answer carries `mail_route`: the one\n * sentence saying what has to exist in DNS before anything arrives. Show it\n * wherever the address is shown — an address that silently swallows mail is\n * the failure this whole door is against.\n */\n inboundDeclare(args: { table_id: Uuid; label?: string | null }): Promise<RecordsResult<InboundDeclared>>;\n inboundAddresses(args?: { table_id?: Uuid | null }): Promise<RecordsResult<InboundAddress[]>>;\n inboundSet(args: { inbound_id: Uuid; enabled: boolean }): Promise<RecordsResult<{ inbound_id: Uuid; address: string; enabled: boolean; message: string }>>;\n\n // ── Portals: the OWNER's side of the client portal (VIS-31 / PORTAL) ──────\n /** Every portal over this organization the caller may know about, with its numbers. */\n portals(): Promise<RecordsResult<PortalSummary[]>>;\n /**\n * The SAME list, archive-aware. `custom.portals` keeps its signature and hides\n * archived portals, because the archived-items law's default is to hide;\n * this is the one door that also answers the other lane, so a rail gets the\n * law's one-click reveal without inventing a second control or a second door.\n * A fourth word is refused `22023` — there is no fourth answer on any surface.\n */\n listPortals(args?: { archived?: PortalArchiveFilter }): Promise<RecordsResult<PortalSummary[]>>;\n /**\n * PUT ONE PORTAL AWAY. Nothing is deleted and there is no purge: every Table\n * it exposes and every person invited to it is kept exactly as it is, and\n * `portalRestore` hands it all back. `confirm_title` is the portal's own title\n * typed back — ten portals can carry one title, so the title is not what picks\n * this one and the door refuses `23514` when it does not match.\n */\n portalArchive(args: {\n portal_id: Uuid;\n confirm_title: string;\n reason?: string | null;\n }): Promise<RecordsResult<PortalArchiveAnswer>>;\n /** The way back. Everyone invited signs in exactly as before, and it shows the same Tables. */\n portalRestore(args: {\n portal_id: Uuid;\n confirm_title: string;\n }): Promise<RecordsResult<PortalArchiveAnswer>>;\n /**\n * Which Tables each portal of this organization exposes.\n *\n * The one question a TABLE-scoped Portals rail has to ask: \"is the table I\n * am standing on in any portal?\" Same wall and same visibility gate as\n * `portals`, so a pair here is always a portal `portals` also returned.\n */\n portalTables(): Promise<RecordsResult<PortalTableRef[]>>;\n /** ONE portal in full: what it shows, and who it was opened to. */\n portalCard(args: { portal_id: Uuid }): Promise<RecordsResult<PortalCard>>;\n /**\n * Create or RE-STATE one portal. Re-stating REPLACES what it exposes — a\n * Table left out of `tables` stops being exposed in the same act — and leaves\n * the people alone: who is invited is not part of what the portal shows.\n */\n portalDeclare(args: {\n title: string;\n client_table_id: Uuid;\n tables: Array<{\n table_id: Uuid;\n names_via: string;\n visible_fields?: string[];\n editable_fields?: string[];\n comments?: boolean;\n }>;\n portal_id?: Uuid | null;\n slug?: string | null;\n sign_in_method?: string | null;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * Invite one person, as one record of the portal's client Table.\n *\n * `user_id` is deliberately NOT a parameter here. From a screen it is always\n * null: an invitation confers NOTHING until the person follows their sign-in\n * link and the platform gives them an identity, and the door's own `say`\n * sentence states exactly that. A screen that passed an id would be granting\n * access on somebody else's behalf.\n */\n portalInvite(args: {\n portal_id: Uuid;\n client_record_id: Uuid;\n email: string;\n }): Promise<RecordsResult<PortalInvitation>>;\n /** Take one person's way in away. The answer's `say` names the consequence. */\n portalRevoke(args: { portal_id: Uuid; principal_id: Uuid }): Promise<RecordsResult<PortalRevocation>>;\n /**\n * VIEW AS THIS CLIENT. The door asks `custom.visible_set` for HER user id —\n * the same call `custom.read_records` makes when she opens the page — so this\n * cannot disagree with what she sees. It REFUSES with `02000` and a sentence\n * when she has not signed in yet; show the sentence, never an empty list.\n */\n portalPreview(args: {\n portal_id: Uuid;\n principal_id: Uuid;\n table_id: Uuid;\n }): Promise<RecordsResult<PortalPreviewRow[]>>;\n\n // ── dashboards (SCR-16): saved blocks, run under the caller's principal ──\n /** This organization's dashboards, optionally only those whose subject is one Table. */\n dashboards(args?: { table_id?: Uuid | null }): Promise<RecordsResult<DashboardSummary[]>>;\n /**\n * Create or re-state one dashboard. Every block is judged on the way IN —\n * a block naming a field this Table does not have is refused BY NAME, with\n * the table's own field list in the hint — so a canvas cannot be saved broken.\n */\n dashboardDeclare(args: {\n table_id: Uuid;\n name: string;\n blocks?: DashboardBlock[];\n presentation?: Record<string, unknown> | null;\n dashboard_id?: Uuid | null;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * Run every block and answer the numbers. `filter` is the ONE filter bar\n * across the canvas: it is merged UNDER each block's own filter, so a block\n * deliberately scoped to one stage stays scoped while the bar moves the rest.\n * A block that refuses carries the store's sentence and the others still answer.\n */\n dashboardRun(args: {\n dashboard_id: Uuid;\n filter?: RecordFilter;\n }): Promise<RecordsResult<DashboardRunResult>>;\n /** The seventh block kind on its own: records that have sat on the same value too long. */\n dashboardStuck(args: {\n table_id: Uuid;\n state_key: string;\n days?: number;\n filter?: RecordFilter;\n limit?: number;\n }): Promise<RecordsResult<StuckRow[]>>;\n // ── a crew, a phone and no signal (PRODUCTS row 15 / SCR-30) ─────────────\n /**\n * Declare or re-state a crew capture sheet over a Table. Admin on the Table.\n * Closed to the crew until `capturePublish`, like every publishing act here.\n */\n captureSheetDeclare(args: {\n table_id: Uuid;\n title: string;\n questions: Array<Record<string, unknown>>;\n presentation?: Record<string, unknown> | null;\n sheet_id?: Uuid | null;\n notify_rule_id?: Uuid | null;\n }): Promise<RecordsResult<Uuid>>;\n /** Open the sheet to the crew, or close it. Admin on the Table. */\n capturePublish(args: { sheet_id: Uuid; open?: boolean }): Promise<RecordsResult<string | null>>;\n /** The crew sheets of this organization, with what has come in through each. */\n captureSheets(args?: { table_id?: Uuid | null }): Promise<RecordsResult<CaptureSheetSummary[]>>;\n /**\n * Everything a phone needs to run one sheet OFFLINE — the questions, the Fields\n * with their ids and parity types, and an honest `may_capture` with a sentence.\n * Load it once on a signal; it is the last network call before the walk.\n */\n captureOpen(args: { sheet_id: Uuid }): Promise<RecordsResult<CaptureSheetFace | null>>;\n /**\n * One capture: the answers, the file references, the device, the moment the phone\n * took it and the place. Idempotent on `client_key`, which the PHONE mints when\n * the capture is taken, offline, before its first attempt — send the same key on\n * every retry and the answer comes back `replay: true` with the first record's id.\n */\n captureSubmit(args: {\n sheet_id: Uuid;\n client_key: string;\n answers: Record<string, unknown>;\n files?: CaptureFileRef[];\n device?: string | null;\n captured_at?: string | null;\n location?: Record<string, unknown> | null;\n }): Promise<RecordsResult<CaptureOutcome | null>>;\n\n // ── a column a model owns (PRODUCTS row 10 / AGT-6) ──────────────────────\n /** Every agent-owned column, with how many cells are filled, stale or pinned, and what it has cost. */\n enrichments(args?: { table_id?: Uuid | null }): Promise<RecordsResult<EnrichmentSummary[]>>;\n /**\n * Define, change or TURN ON an Enrichment on one Field. Admin on the Table.\n * `{enabled: true}` on its own turns an existing one on without resetting it —\n * and turning it on is what authorises every value it writes afterwards.\n */\n enrichDeclare(args: {\n field_id: Uuid;\n spec: Record<string, unknown>;\n }): Promise<RecordsResult<EnrichDeclared>>;\n /**\n * The rows that need this column filled in, each with what the instruction may\n * read. A cell somebody pinned is never returned. This is what a PREVIEW shows\n * before anybody enables anything.\n */\n enrichDue(args: {\n field_id: Uuid;\n limit?: number;\n include_fresh?: boolean;\n }): Promise<RecordsResult<EnrichDueRow[]>>;\n /**\n * THE BADGE DATA FOR A WHOLE PAGE, in one call. Who wrote each value, when, out\n * of what source, its candidates, whether a person pinned it and whether it is\n * past its freshness date. Asked per cell this would be one round trip per badge.\n */\n enrichCells(args: {\n table_id: Uuid;\n field_keys?: string[] | null;\n record_ids?: Uuid[] | null;\n }): Promise<RecordsResult<EnrichCell[]>>;\n /** Hold one cell against the model that fills its column, or hand it back. */\n enrichPin(args: {\n record_id: Uuid;\n field_key: string;\n pinned?: boolean;\n }): Promise<RecordsResult<{ pinned: boolean; says: string }>>;\n /** What this column has cost, run by run. */\n enrichRuns(args?: { field_id?: Uuid | null; limit?: number }): Promise<RecordsResult<EnrichRun[]>>;\n /** Take a dashboard away. The records it counted are untouched — a canvas owns nothing. */\n dashboardDelete(args: { dashboard_id: Uuid }): Promise<RecordsResult<boolean>>;\n\n // ── the eighth verb (AGT-N-8): the aggregate, computed in the read door ──\n /**\n * Group, bucket, filter and measure INSIDE `custom.record_aggregate`. The\n * aggregate node sits above the visibility join, so what a chart draws is\n * exactly what this person may see — the rest is never fetched, let alone\n * summed and then hidden.\n */\n recordAggregate(args: {\n table_id: Uuid;\n /** Field keys whose values become the groups. */\n groupBy?: string[];\n /** `count` needs no key; every other operation reads one Field. */\n measures?: AggregateMeasure[];\n /** A date Field truncated to a period — a group whose expression is a date_trunc. */\n bucket?: { key: string; by: AggregateBucket } | null;\n /**\n * A scalar is an equality and an object is a half-open moment window, and\n * either way it lands in the SAME WHERE as visibility.\n */\n filter?: RecordFilter;\n limit?: number;\n }): Promise<RecordsResult<AggregateRow[]>>;\n /** The measures the store itself offers. Asked, never hardcoded in a picker. */\n aggOperations(): Promise<RecordsResult<string[]>>;\n /** The periods the store itself buckets by. */\n aggBuckets(): Promise<RecordsResult<string[]>>;\n\n // ── subscriptions (DOOR-18): a Rule record over a saved view ─────────────\n /**\n * Every subscription in this organization, optionally narrowed to one saved\n * view or one cadence. There is no subscription table: each one is a Rule\n * record carrying a `subscription` block, so a subscription is readable,\n * historied and agent-writable like anything else.\n */\n aggSubscriptions(args?: {\n saved_view_id?: Uuid | null;\n cadence?: string | null;\n }): Promise<RecordsResult<Subscription[]>>;\n /** The cadences the store itself offers. Asked, never hardcoded in a picker. */\n aggSubscriptionCadences(): Promise<RecordsResult<string[]>>;\n /**\n * The same cadences, through the door a PERSON may call.\n * `aggSubscriptionCadences` is the notifier's own and holds no client grant,\n * so a screen that asked for it was refused and fell back to a list typed\n * into the picker — which drifts from what the digest runner honours. This\n * one delegates to the same array, so there is exactly one list.\n */\n subscriptionCadences(): Promise<RecordsResult<string[]>>;\n /**\n * WHAT THIS PERSON IS BEING TOLD ABOUT, and what they may switch off.\n *\n * Mine, plus anyone's over a Table I hold admin on — narrowed to Tables I can\n * already open, so the list never reveals one. `aggSubscriptions` above is the\n * NOTIFIER's reader and no client can call it; this is the owner's.\n */\n subscriptions(args?: { table_id?: Uuid | null }): Promise<RecordsResult<MySubscription[]>>;\n /**\n * Switch one on or off. Muting is honoured in ONE place — the reader every\n * consumer goes through — so a screen can never say a subscription is off\n * while it keeps firing.\n */\n subscriptionMute(args: { rule_id: Uuid; muted: boolean }): Promise<RecordsResult<boolean>>;\n /**\n * WRITE ONE. The store refuses a cadence no runner acts on, a channel this\n * platform does not send on and quiet hours nobody can parse — by name — then\n * declares the Rule through `rule_declare`, because a Rule written as a record\n * carries `data_class = 'record'` and every reader that goes looking for a Rule\n * steps straight past it (REC-72).\n */\n subscriptionDeclare(args: {\n table_id: Uuid;\n spec: SubscriptionSpec;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * SHOW ME ONE NOW. The summary this subscription would send at this moment, with\n * what entered, left and changed NAMED. It assembles only: nothing is delivered,\n * nothing is recorded and the watermark does not move.\n */\n subscriptionPreview(args: { rule_id: Uuid }): Promise<RecordsResult<DigestPreview>>;\n /**\n * THE SAVED VIEWS OF A TABLE — what a subscription may be written over. Narrowed\n * in SQL as the definer to Tables this caller can already open, so the list can\n * never reveal a Table.\n */\n views(args?: { table_id?: Uuid | null }): Promise<RecordsResult<SavedViewRow[]>>;\n /**\n * SAVE ONE VIEW. VIEWER on the Table, not editor: writing down a question about a\n * Table is not changing it, and requiring editor would mean the people who read a\n * Table could not subscribe to anything in it.\n */\n viewDeclare(args: { table_id: Uuid; spec: SavedViewSpecIn }): Promise<RecordsResult<Uuid>>;\n\n // ── documents (W3-DOC): save, render once, sign the exact bytes ──────────\n docTemplateSave(args: {\n table_id: Uuid;\n name: string;\n body: string;\n template_id?: Uuid | null;\n }): Promise<RecordsResult<Uuid>>;\n /** The body with every token resolved against one record. Read-only, no render row. */\n docRenderBody(args: { template_id: Uuid; record_id: Uuid }): Promise<RecordsResult<string>>;\n /** Write the render — frozen bytes a signature can be checked against. */\n docRenderDocument(args: { template_id: Uuid; record_id: Uuid }): Promise<RecordsResult<Uuid>>;\n /** Every token in a body, in order, with the Field id each one points at. */\n docTokens(args: { body: string }): Promise<RecordsResult<DocToken[]>>;\n /** The tokens this Table cannot answer, each with the store's own reason. */\n docUnresolvedTokens(args: { table_id: Uuid; body: string }): Promise<RecordsResult<DocUnresolvedToken[]>>;\n docSign(args: {\n render_id: Uuid;\n field_key: string;\n signer_name: string;\n signer_user_id?: Uuid | null;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * One signature: the seal AND whether what was signed is still what is there.\n * The store answers both, in one call, never the screen. Viewer on the record.\n */\n docSignatureRead(args: { signature_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Every template that renders one Table. Viewer on the Table. */\n docTemplates(args: { table_id: Uuid }): Promise<RecordsResult<DocTemplateRow[]>>;\n /**\n * Retire one template. EDITOR on the Table it renders, because a template is\n * that Table's wording. Documents already rendered keep their frozen bytes\n * and their seals, so this can never invalidate a signature.\n */\n docTemplateDelete(args: { template_id: Uuid }): Promise<RecordsResult<boolean>>;\n /** Every frozen render of one record, newest first. Viewer on the record. */\n docRenders(args: { record_id: Uuid }): Promise<RecordsResult<DocRenderRow[]>>;\n /** Every signature on one record. Viewer on the record. */\n docSignatures(args: { record_id: Uuid }): Promise<RecordsResult<DocSignatureRow[]>>;\n /**\n * DOOR-11. One record's revisions, newest first. The read door answers\n * documents and deliberately not versions, so a screen that wants to save\n * optimistically reads the version of the record it LOADED from here — for\n * the one record being edited, never for a list.\n */\n revisions(args: { record_id: Uuid }): Promise<RecordsResult<RecordRevision[]>>;\n /**\n * PRODUCTS row 4. One record's version list, newest first: who (a person, or\n * an agent AND the person it acted for), when, the operation in the word\n * somebody used, and every field that moved with its before, its after, the\n * Rule version that produced a derived value and its source pointer. Viewer\n * on the record — reading how something got to be the way it is is reading.\n */\n recordHistory(args: {\n record_id: Uuid;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<RecordHistoryEntry[]>>;\n /**\n * AGT-N-9 — EVERYTHING A CHAT OPENED ON THIS RECORD MAY KNOW, IN ONE ROUND TRIP.\n *\n * The Fields with their `(record, field, value version)` triples, the relations one hop\n * out, the history, the comments and the Table's other records — assembled INSIDE the\n * database, every piece through the read door, under this person's own field-level\n * security. A Field the store masks comes back in `withheld` with the store's own\n * sentence and no value; a Field the organization keeps out of conversations comes back\n * there too, saying which of the two it is.\n */\n recordScopeContext(args: {\n record_id: Uuid;\n relations?: number;\n history?: number;\n siblings?: number;\n }): Promise<RecordsResult<RecordScopeContext>>;\n /** What is this conversation about? */\n conversationScope(args: { conversation_id: Uuid }): Promise<RecordsResult<ConversationScope>>;\n /** Point a conversation at one record. Refused unless this person may open it. */\n conversationScopeBind(args: {\n conversation_id: Uuid;\n record_id: Uuid;\n }): Promise<RecordsResult<ConversationScope>>;\n /** This conversation is no longer about a particular record. */\n conversationScopeUnbind(args: {\n conversation_id: Uuid;\n }): Promise<RecordsResult<ConversationScope>>;\n /** The binding AND the context of a bound conversation, in one round trip. */\n conversationScopeContext(args: {\n conversation_id: Uuid;\n relations?: number;\n history?: number;\n siblings?: number;\n }): Promise<RecordsResult<ConversationScopeContext>>;\n /**\n * \"Who changed the price on ANY record?\" One column's history across a whole\n * Table, narrowed to the records this person may see by a predicate in the\n * same statement. A column that names no Field is refused BY NAME, never\n * answered empty.\n */\n fieldHistory(args: {\n table_id: Uuid;\n field_key: string;\n limit?: number;\n offset?: number;\n record_id?: Uuid;\n }): Promise<RecordsResult<FieldHistoryEntry[]>>;\n /**\n * WHAT A RESTORE WOULD CHANGE, BEFORE IT DOES. Editor on the record: this is\n * the first half of an act, and somebody who may not perform it is not shown\n * its preview. Pass `field_key` for one column.\n */\n restorePreview(args: {\n record_id: Uuid;\n version: number;\n field_key?: string;\n }): Promise<RecordsResult<RestorePreview>>;\n /** Put the whole record back to a version, as a NEW version. Editor. */\n restoreVersion(args: { record_id: Uuid; version: number }): Promise<RecordsResult<RestoreResult>>;\n /** Put ONE column back to what it said at a version, as a NEW version (HIS-N-2). Editor. */\n valueRestore(args: {\n record_id: Uuid;\n field_key: string;\n version: number;\n }): Promise<RecordsResult<RestoreResult>>;\n /**\n * SCR-18. The record's comment thread with everybody named, plus what THIS\n * person may do in it — decided by the store, in the same call, so a screen\n * never draws a composer the write door will refuse.\n */\n commentThread(args: {\n record_id: Uuid;\n include_resolved?: boolean;\n }): Promise<RecordsResult<CommentThreadRead>>;\n /**\n * Write a comment at the `commenter` rung, optionally naming people. A\n * mention is a reference and not a regex over the body: the ids come from the\n * picker and the store refuses one who is not in the organization, or who\n * cannot open the record — because that notification would be a dead end.\n */\n commentWrite(args: {\n record_id: Uuid;\n body: string;\n field_key?: string;\n parent_comment_id?: Uuid;\n mentions?: Uuid[];\n }): Promise<RecordsResult<CommentWritten>>;\n /** Resolve (or re-open) a thread. `commenter` — resolution is not a delete. */\n commentResolve(args: { comment_id: Uuid; resolved?: boolean }): Promise<RecordsResult<boolean>>;\n /**\n * Every value of one record WITH its envelope — its own version, who wrote\n * it, who they were acting for and when. The timeline IS the record (REC-19);\n * there is no second history table.\n */\n recordValuesVersioned(args: { record_id: Uuid }): Promise<RecordsResult<ReadValue[]>>;\n\n // ── the doors that do not exist yet, named rather than faked ─────────────\n metadataSearch(args: { text: string }): Promise<RecordsResult<never>>;\n // ── the anonymous lane (W4-ANON) ─────────────────────────────────────────\n /**\n * Mint an embed token. `mode` is `read` OR `write` and never both — the store\n * refuses a token carrying two decisions. The secret comes back ONCE, because\n * only its digest is stored: a database read cannot produce a working token.\n * `allowedOrigins` is required and matched EXACTLY, so `example.com.evil.test`\n * fails a check that a suffix match would pass.\n */\n anonTokenIssue(args: {\n mode: \"read\" | \"write\";\n allowedOrigins: string[];\n formId?: Uuid | null;\n savedViewId?: Uuid | null;\n recordId?: Uuid | null;\n expiresAt?: Timestamp | null;\n }): Promise<RecordsResult<{ token_id: Uuid; secret: string }>>;\n /** What a secret is good for, from an origin. The store's sentence when it is not. */\n anonTokenVerify(args: {\n secret: string;\n origin: string;\n requiredMode?: \"read\" | \"write\" | null;\n }): Promise<RecordsResult<AnonTokenBinding>>;\n anonTokenRevoke(args: { token_id: Uuid }): Promise<RecordsResult<boolean>>;\n /**\n * A STRANGER'S WRITE. The token supplies the organization, so this call names\n * none — and what it produces is a QUARANTINED SUBMISSION, not a record:\n * `custom.record` is never touched here. `clientKey` makes a replay free and\n * idempotent, which is what lets a flaky phone retry safely.\n */\n anonWrite(args: {\n secret: string;\n origin: string;\n payload: Record<string, unknown>;\n clientKey?: string | null;\n rawPayload?: Record<string, unknown>;\n }): Promise<RecordsResult<Uuid>>;\n /**\n * SCR-30, and it is the SIGNED-IN offline path, not the stranger's. The client\n * mints `clientKey` BEFORE the first attempt, offline, and the store's own\n * replay ledger dedupes on it — so a reconnect that fires the same capture\n * thirty times writes one record and returns the same id every time.\n */\n anonCapture(args: {\n table_id: Uuid;\n clientKey: string;\n payload: Record<string, unknown>;\n device?: string | null;\n capturedAt?: Timestamp | null;\n }): Promise<RecordsResult<Uuid>>;\n /** Open or close a form to strangers. An admin act on the Table, never an editor one. */\n anonPublish(args: { form_id: Uuid; published?: boolean }): Promise<RecordsResult<Timestamp | null>>;\n\n // ── checklists and SOP runs (PRODUCTS row 13) ────────────────────────────\n /**\n * What is wrong with a checklist somebody is writing, in the words they would\n * use. `null` means it is fine. Pure — it reads no row and writes nothing —\n * so an editor may ask it on every keystroke and the refusal arrives BEFORE\n * the save rather than after it.\n */\n checklistRefusal(args: { spec: ChecklistSpec }): Promise<RecordsResult<string | null>>;\n /**\n * Store a checklist, whole: ordered steps, who each belongs to by role, how\n * many days in each is due, what each waits for, what each asks for, and what\n * starts a run. Pass `template_id` to change the checklist that already\n * exists rather than making a second one.\n */\n checklistDeclare(args: {\n spec: ChecklistSpec;\n template_id?: Uuid | null;\n }): Promise<RecordsResult<ChecklistDeclared>>;\n checklistTemplates(args?: {\n about_table_id?: Uuid | null;\n limit?: number;\n }): Promise<RecordsResult<ChecklistTemplateSummary[]>>;\n checklistTemplateShape(args: { template_id: Uuid }): Promise<RecordsResult<ChecklistTemplateShape>>;\n /**\n * Run a checklist for one record: one work item per step in the ONE work\n * layer, assigned by role to real people, dated from the offsets,\n * dependencies carried across. `roles` names who stands in each role for THIS\n * run, over whatever the checklist says by default.\n */\n checklistStart(args: {\n template_id: Uuid;\n about_record_id?: Uuid | null;\n roles?: Record<string, Uuid>;\n startingAt?: Timestamp | null;\n }): Promise<RecordsResult<ChecklistRunStarted>>;\n checklistRun(args: { run_id: Uuid }): Promise<RecordsResult<ChecklistRunStep[]>>;\n checklistRuns(args?: {\n about_table_id?: Uuid | null;\n about_record_id?: Uuid | null;\n includeClosed?: boolean;\n limit?: number;\n }): Promise<RecordsResult<ChecklistRunSummary[]>>;\n /**\n * Tick a step off with whatever it asked for. Refused by name while a step it\n * waits for is open, or while what it asks for is missing — and the same\n * refusal meets `workSetState`, because the rule lives in the store and not\n * in this door.\n */\n checklistStepComplete(args: {\n step_id: Uuid;\n evidence?: Record<string, unknown>;\n }): Promise<RecordsResult<ChecklistStepCompleted>>;\n /** Why this step cannot be finished right now. `null` means it can. */\n checklistStepRefusal(args: { step_id: Uuid }): Promise<RecordsResult<string | null>>;\n\n // ── work (W4-WORK): templates, turns and slots ───────────────────────────\n /** The five states and what each one may become. Asked, never hardcoded in a picker. */\n workStates(): Promise<RecordsResult<WorkState[]>>;\n /** Why this graph would be refused — asked BEFORE it is written. `null` means it is fine. */\n workTemplateRefusal(args: { graph: WorkGraph }): Promise<RecordsResult<string | null>>;\n workTemplateDeclare(args: { name: string; graph: WorkGraph }): Promise<RecordsResult<Uuid>>;\n /**\n * REC-70: the WHOLE graph is created in one act, judged before any of it is\n * written, so a half-made checklist is not a state this store can be in.\n */\n workTemplateInstantiate(args: {\n template_id: Uuid;\n overrides?: Record<string, Record<string, unknown>>;\n }): Promise<RecordsResult<WorkInstantiation>>;\n workTemplateShape(args: { template_id: Uuid }): Promise<RecordsResult<unknown>>;\n workInstantiationShape(args: { instantiation_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Whose turn each record is, with its state and whether that state is terminal. */\n workWhoseTurn(args: { table_id: Uuid; includeFinished?: boolean }): Promise<RecordsResult<WorkTurn[]>>;\n /** Does this Table carry assignment at all? A screen asks before it offers one. */\n workHasAssignment(args: { table_id: Uuid }): Promise<RecordsResult<boolean>>;\n /** The Fields assignment is made of, so nothing here invents a column name. */\n workAssignmentFields(args?: { options_table_id?: Uuid | null }): Promise<RecordsResult<WorkAssignmentField[]>>;\n /** Add assignment to a Table. */\n workTakeAssignment(args: { table_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Why this move would be refused. `null` means it is allowed. */\n workTransitionRefusal(args: { from_state_id: Uuid; to_state_id: Uuid }): Promise<RecordsResult<string | null>>;\n /** Declare the Table slots are held in. Idempotent — a second call finds the first. */\n workSlotsDeclare(args: { name: string; slug: string; homeId?: Uuid | null }): Promise<RecordsResult<unknown>>;\n /**\n * SCR-29. Take a slot for a while. THE STORE decides, under a unique index —\n * two people racing for the same slot do not both get it, whatever either\n * screen believed a moment earlier.\n */\n workSlotHold(args: {\n table_id: Uuid;\n slotKey: string;\n holder: string;\n ttl?: string;\n }): Promise<RecordsResult<unknown>>;\n workSlotRelease(args: { hold_id: Uuid }): Promise<RecordsResult<boolean>>;\n /** Every hold on this Table, with whether it has already lapsed. */\n workSlotHolds(args: { table_id: Uuid }): Promise<RecordsResult<WorkSlotHold[]>>;\n workSlotExpire(args: { table_id: Uuid }): Promise<RecordsResult<number>>;\n\n // ── the work layer a person actually uses (lane WORK-DOORS, 2026-09-20) ──\n /**\n * THE ONE INBOX. Assignments, approvals and the agent's proposals, in one\n * ordered list with ONE row shape — PRODUCTS.md row 6. A second queue for the\n * agent's suggestions is the thing this replaces.\n */\n workInbox(args?: {\n limit?: number;\n offset?: number;\n includeDecided?: boolean;\n }): Promise<RecordsResult<WorkInboxItem[]>>;\n /** \"My work\", \"work I assigned\", \"waiting on somebody being chosen\". */\n workList(args?: {\n flavour?: WorkListFlavour;\n includeFinished?: boolean;\n limit?: number;\n offset?: number;\n }): Promise<RecordsResult<WorkListItem[]>>;\n /**\n * Give one record to one person: the Assignee value AND editor access, in one\n * transaction. Passing no `user_id` un-assigns and says plainly that nobody's\n * access was taken away.\n */\n workAssign(args: {\n record_id: Uuid;\n user_id?: Uuid | null;\n dueDate?: string | null;\n clearDue?: boolean;\n }): Promise<RecordsResult<WorkAssignment>>;\n /** The states this record may be moved to, and the sentence for each it may not. */\n workRecordStates(args: { record_id: Uuid }): Promise<RecordsResult<WorkRecordState[]>>;\n /** Move it. The store refuses a move the model forbids, in its own words. */\n workSetState(args: { record_id: Uuid; state_id: Uuid | null }): Promise<RecordsResult<unknown>>;\n /** The person-kernel record standing for a signed-in person here. */\n workPerson(args: { user_id: Uuid; create?: boolean }): Promise<RecordsResult<Uuid | null>>;\n /** The templates this person may run, so a picker has ids to offer. */\n workTemplates(args?: { limit?: number }): Promise<RecordsResult<Array<{\n template_id: Uuid;\n name: string;\n nodes: number;\n relations: number;\n created_at: string;\n }>>>;\n /** Who may decide a change about this subject, and why each of them may. */\n workApprovalApprovers(args: {\n subject_id: Uuid | null;\n approver_id?: Uuid | null;\n }): Promise<RecordsResult<WorkApprover[]>>;\n /** Ask for a change instead of making it. Viewer on the subject is enough to ASK. */\n workApprovalRequest(args: {\n subject_id: Uuid;\n change: WorkChange;\n note?: string | null;\n approver_id?: Uuid | null;\n origin?: \"person\" | \"agent\";\n conversation_id?: Uuid | null;\n }): Promise<RecordsResult<WorkApprovalFiled>>;\n /** Whether THIS person may decide THIS one — so a screen never draws a dead button. */\n workApprovalMayDecide(args: { approval_id: Uuid }): Promise<RecordsResult<boolean>>;\n /** Approve or decline. Approving APPLIES the change, as the person approving. */\n workApprovalDecide(args: {\n approval_id: Uuid;\n approve: boolean;\n note?: string | null;\n }): Promise<RecordsResult<WorkApprovalDecision>>;\n /** One waiting change in full, for the person deciding it or the one who asked. */\n workApprovalRead(args: { approval_id: Uuid }): Promise<RecordsResult<Record<string, unknown>>>;\n\n // ── the trust doors: `iam`'s, not the store's ────────────────────────────\n /** VIS-31. Is this account a signed-in outsider — no NON-personal organization? */\n isExternalPrincipal(args?: { user_id?: Uuid | null }): Promise<RecordsResult<boolean>>;\n /** The same answer WITH the plain-English reason a screen shows. */\n externalPrincipalCard(args?: { user_id?: Uuid | null }): Promise<RecordsResult<ExternalPrincipalCard>>;\n /** Exactly the resource ids Visibility gave that outsider. Never an organization's list. */\n externalPrincipalReach(args: {\n resourceType: string;\n user_id?: Uuid | null;\n }): Promise<RecordsResult<Array<{ resource_id: Uuid }>>>;\n /** VIS-32. Bind a record or a view to a public address with a declared render mode. */\n publishBindingCreate(args: {\n slug: string;\n resourceType: string;\n resource_id: Uuid;\n renderMode?: string;\n }): Promise<RecordsResult<PublishBinding>>;\n publishBindingRevoke(args: { slug: string }): Promise<RecordsResult<unknown>>;\n /** What a SIGNED-OUT visitor resolves. Empty for an invented, revoked or unpublished address. */\n resolvePublishBinding(args: { slug: string }): Promise<RecordsResult<ResolvedPublishBinding[]>>;\n /** D-15. The ONE sentence admitting nothing was scanned, so four surfaces cannot drift. */\n worldPublishGapNotice(): Promise<RecordsResult<string>>;\n /** Put a resource in the world lane. Refuses by name while the lane is closed. */\n publishToWorld(args: {\n resourceType: string;\n resource_id: Uuid;\n discoverable?: boolean;\n }): Promise<RecordsResult<unknown>>;\n /**\n * Declare a Rule. It is NOT `recordWrite` into the rule kernel, and that is\n * the whole point: `custom.record_write` inserts `data_class = 'record'`, so a\n * document written that way is not a Rule and the store's own rule doors\n * (`custom.rule_members`, `custom.agg_subscriptions`) never see it. Writing\n * one through the record door and calling it a Rule would be a silent\n * failure — a screen that looked like it had subscribed you to something.\n */\n ruleDeclare(args: { spec: Record<string, unknown>; rule_id?: Uuid | null }): Promise<RecordsResult<Uuid>>;\n fieldPropose(proposal: FieldProposal): Promise<RecordsResult<never>>;\n tablePropose(proposal: TableProposal): Promise<RecordsResult<never>>;\n\n // ── promotion (REC-5) ────────────────────────────────────────────────────\n promoteTable(args: { table_id: Uuid }): Promise<RecordsResult<unknown>>;\n promoteField(args: { table_id: Uuid; field_id: Uuid }): Promise<RecordsResult<unknown>>;\n\n /** Is the store switched on for this organization? A product switch, never the boundary. */\n storeIsOpen(): Promise<RecordsResult<boolean>>;\n /**\n * WHAT THIS PERSON MAY DO TO THESE THINGS — asked once, for a whole page.\n *\n * There is no principal argument, on purpose: the door resolves the caller\n * from the session, so a person can ask about their OWN access and about\n * nobody else's. A subject they hold nothing on answers `level: null`, which\n * is an answer; the row is never omitted, because a screen that could not\n * tell \"no access\" from \"not asked yet\" would draw one of them as the other.\n */\n myLevels(args: { ids: Uuid[]; subject?: \"record\" }): Promise<RecordsResult<MyLevel[]>>;\n\n // ── THE GRID (lane GRID-PRIMITIVES) — see ../grid.ts for every shape ─────\n /** G1. Write ONE leaf of a Table's colors, or clear it with `null`. Editor on the Table. */\n tableDecorate(args: { table_id: Uuid; path: DecorationPath; value: unknown }): Promise<RecordsResult<TableDecorations>>;\n /** G1. A Table's colors as a screen paints them, with what went stale named. */\n tableDecorations(args: { table_id: Uuid }): Promise<RecordsResult<TableDecorations>>;\n /** G1. The layout a grid opens with: platform → organization knob → the view's own. */\n gridLayout(args: { table_id: Uuid; view_id?: Uuid | null }): Promise<RecordsResult<GridLayout>>;\n /** G3. The older grid's formula text → the store's expression. Never refuses a typo: answers ok:false. */\n formulaParse(args: { table_id: Uuid; text: string }): Promise<RecordsResult<FormulaParse>>;\n /** G2. Declare a Table's row actions — the whole list. Editor on the Table. */\n actionDeclare(args: { table_id: Uuid; actions: RowAction[] }): Promise<RecordsResult<RowAction[]>>;\n /** G2. A Table's row actions, each saying whether it can run here. */\n rowActions(args: { table_id: Uuid }): Promise<RecordsResult<{ actions: RowAction[]; stale: unknown[] }>>;\n /**\n * G2. Run one action on a selection, in ONE transaction. A refusal changed NOTHING; read\n * every record and field that refused with `actionRefusals(result.error)`.\n */\n actionRun(args: { action_id: Uuid; record_ids: Uuid[] }): Promise<RecordsResult<ActionRunResult>>;\n /** G4. Send every change to this Table's records to an https webhook. Admin. The secret is shown once. */\n tableWebhookDeclare(args: {\n table_id: Uuid;\n target_url: string;\n events?: RecordEvent[] | null;\n description?: string | null;\n }): Promise<RecordsResult<TableWebhookDeclared>>;\n /** G4. The webhooks a Table sends to, with their delivery health — never the secret. */\n tableWebhooks(args: { table_id: Uuid }): Promise<RecordsResult<TableWebhook[]>>;\n /** G4. Switch one off. It is never deleted. */\n tableWebhookArchive(args: { webhook_id: Uuid }): Promise<RecordsResult<boolean>>;\n /**\n * G5. Build one real use case's tables here, rows and relations included, in one\n * transaction. `useCaseId` is one of `useCaseIds()` from `@ai-matrx/records/use-cases`.\n */\n tableFromExample(args: { home_id: Uuid; useCaseId: string }): Promise<RecordsResult<ExampleBuilt>>;\n /** G5. Number the records an autonumber column found already there, in creation order. */\n autonumberBackfill(args: { field_id: Uuid }): Promise<RecordsResult<{ numbered: number; highest: number | null; says: string }>>;\n /** G5. One page of the export door — exactly the rows and columns the read door serves this person. */\n ioExport(args: { table_id: Uuid; columns?: string[] | null; limit?: number }): Promise<RecordsResult<IoExportPage>>;\n /** G5. That page as an .xlsx; a withheld column is named on its own sheet. */\n exportXlsx(args: {\n table_id: Uuid;\n columns?: string[] | null;\n limit?: number;\n labels?: Record<string, string>;\n sheetLabel?: string;\n }): Promise<RecordsResult<Uint8Array>>;\n}\n\nexport function createRecordsClient(config: RecordsConfig): RecordsClient {\n const schema = config.schema ?? DEFAULT_SCHEMA;\n const org = config.organizationId;\n const scream = sink(config);\n\n async function callDoor<T>(\n door: string,\n args: Record<string, unknown>,\n where: string,\n ): Promise<RecordsResult<T>> {\n if (!doorExists(door)) {\n const refusal = doorAbsent(door);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where });\n return err(refusal);\n }\n // THE SCHEMA IS SAID OUT LOUD. A door of the store is `custom.<name>`, and\n // a host's supabase client resolves an unqualified `rpc()` against its own\n // default PostgREST profile — `public` in every client we ship. Leaving it\n // off therefore asked `public.store_is_open`, which the browser extension\n // found for us on its first real turn (2026-09-18, W6-EXT): \"Could not find\n // the function public.store_is_open(p_organization_id) in the schema cache\".\n // The package knows which schema it lives in, so it is the package that\n // says so, once, here — never every host remembering to.\n const response = await config.dataSource.rpc(`${door}`, args, { schema });\n if (response.error) {\n const refusal = mapPgError(response.error, where);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where });\n return err(refusal);\n }\n return ok(response.data as T);\n }\n\n /**\n * A TRUST DOOR — `iam`'s, not the store's.\n *\n * There is no `doorExists` check here on purpose: the store's generated\n * catalogue reads `custom` and only `custom`, so a census of it says nothing\n * true about `iam`. A trust door that is not there answers with Postgres's\n * own `42883`, which arrives through the same refusal funnel carrying the\n * name that was called — an honest \"no such function\", never an empty array\n * standing in for \"there is nothing\".\n */\n async function trustDoor<T>(\n door: string,\n args: Record<string, unknown>,\n where: string,\n ): Promise<RecordsResult<T>> {\n const response = await config.dataSource.rpc(door, args, { schema: TRUST_SCHEMA });\n if (response.error) {\n const refusal = mapPgError(response.error, where);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where });\n return err(refusal);\n }\n return ok(response.data as T);\n }\n\n /**\n * A DOOR OF THE OLDER STORE — `workbench`'s, not this store's.\n *\n * Same reasoning as `trustDoor`: the generated catalogue reads `custom` and\n * only `custom`, so `doorExists` says nothing true about `workbench` and\n * there is deliberately no census check here. A door that is not there\n * arrives as Postgres's own `42883` through the same refusal funnel, carrying\n * the name that was called — an honest \"no such function\", never an empty map\n * standing in for \"these cells have no words\".\n */\n async function workbenchDoor<T>(\n door: string,\n args: Record<string, unknown>,\n where: string,\n ): Promise<RecordsResult<T>> {\n const response = await config.dataSource.rpc(door, args, { schema: WORKBENCH_SCHEMA });\n if (response.error) {\n const refusal = mapPgError(response.error, where);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where });\n return err(refusal);\n }\n return ok(response.data as T);\n }\n\n /**\n * The read door returns ONE masked document with the notices folded in under\n * `_hidden` (`custom.mask_document`). A screen wants them apart: the values it\n * draws, and the reasons it shows where a value is missing. This splits them\n * and nothing else — it never decides what is hidden, it only reads what the\n * store already decided.\n */\n function unfold(document: unknown): { document: RecordDocument; hidden: Record<string, HiddenFieldNotice> } {\n const raw = (document ?? {}) as Record<string, unknown>;\n const hidden = (raw._hidden ?? {}) as Record<string, HiddenFieldNotice>;\n const values: RecordDocument = {};\n for (const [key, value] of Object.entries(raw)) {\n if (key === \"_hidden\") continue;\n values[key] = value;\n }\n return { document: values, hidden };\n }\n\n async function readValues(recordId: Uuid): Promise<RecordsResult<ReadValue[]>> {\n return callDoor<ReadValue[]>(\n DOORS.recordValuesVersioned,\n { p_organization_id: org, p_record_id: recordId },\n \"recordRead\",\n );\n }\n\n const client: RecordsClient = {\n config,\n\n async recordWrite({ table_id, data }) {\n // THE OP ID RIDES THE ENVELOPE. `_op_id` is a platform envelope key — the same class as\n // `_actor` — which the store lifts out BEFORE its undeclared-key guard and BEFORE\n // storage, so it never lands on the record. It comes back in the realtime notice, which\n // is how this browser recognises the echo of its own write and does not re-read a page\n // it has already updated. See `../ops.ts`.\n return callDoor<Uuid>(\n DOORS.recordWrite,\n { p_organization_id: org, p_table_id: table_id, p_data: { ...data, _op_id: mintOpId() } },\n \"recordWrite\",\n );\n },\n\n async recordWriteMany({ table_id, rows, ids }) {\n // ONE CALL IS ONE OPERATION, so one op id for the whole batch: the store announces one\n // statement once, and it REFUSES a batch carrying two different ids by name.\n const opId = mintOpId();\n return callDoor<Uuid[]>(\n DOORS.recordWriteMany,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_rows: rows.map((row) => ({ ...row, _op_id: opId })),\n ...(ids === undefined ? {} : { p_ids: ids }),\n },\n \"recordWriteMany\",\n );\n },\n\n async recordWriteGraph({ table_id, parent, children, edges }) {\n // ONE GRAPH IS ONE OPERATION, so one op id for the whole thing: the door copies the\n // parent's onto every child, and the store announces the statement once.\n const opId = mintOpId();\n return callDoor<RecordGraphWritten>(\n DOORS.recordWriteGraph,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_parent: { ...parent, _op_id: opId },\n p_edges: edges ?? [],\n p_children: (children ?? []).map((child) => ({\n data: child.data,\n role: child.role,\n ...(child.table_id === undefined ? {} : { table_id: child.table_id }),\n ...(child.position === undefined ? {} : { position: child.position }),\n })),\n },\n \"recordWriteGraph\",\n );\n },\n\n async recordUpdate({ record_id, patch, expectedVersion }) {\n const result = await callDoor<number>(\n DOORS.recordUpdate,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_patch: { ...patch, _op_id: mintOpId() },\n ...(expectedVersion === undefined ? {} : { p_expected_version: expectedVersion }),\n },\n \"recordUpdate\",\n );\n if (result.ok) announceRecordChanged(record_id);\n return result;\n },\n\n async recordDelete({ record_id }) {\n const result = await callDoor<Timestamp>(\n DOORS.recordDelete,\n { p_organization_id: org, p_record_id: record_id },\n \"recordDelete\",\n );\n if (result.ok) announceRecordChanged(record_id);\n return result;\n },\n\n async recordRestore({ record_id }) {\n const result = await callDoor<void>(\n DOORS.recordRestore,\n { p_organization_id: org, p_record_id: record_id },\n \"recordRestore\",\n );\n if (result.ok) announceRecordChanged(record_id);\n return result;\n },\n\n async tableArchive({ table_id, chunk, includeTable }) {\n // EVERY ARGUMENT IS SAID OUT LOUD, including the two the function\n // defaults. A caller that leaves `p_chunk` off is agreeing to a number it\n // cannot see, and a loop's pass size is the one thing a loop actually has\n // an opinion about. So the package states it — and the door still clamps\n // it and reports what it actually took.\n //\n // WHY 50 AND NOT 200. Measured against the live store on 2026-09-22, one\n // record costs about 35ms to archive: `custom.record_delete` runs a delete\n // rule, an access check, a history capture and an outbox row for each one.\n // A pass of 200 is therefore ~7s against a PostgREST statement timeout of\n // 8 — it DIED on `57014` on the first real table it was pointed at, which\n // is the very defect this door exists to fix, moved one level up. 50 is\n // ~1.8s: four times the headroom, and the same number the live function\n // chose for itself.\n return callDoor<TableArchiveProgress>(\n DOORS.tableArchive,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_chunk: chunk ?? 50,\n p_include_table: includeTable ?? true,\n },\n \"tableArchive\",\n );\n },\n\n async recordRead({ record_id, withComputed = false }) {\n // DOOR-1: `custom.read_record` resolves the reader from the session,\n // refuses a record they have no visibility on in the store's own sentence,\n // and masks the fields their level does not reach. This client no longer\n // selects `custom.record` for a read — that path returned rows and fields\n // the store had not agreed this person could see.\n const door = await callDoor<unknown>(\n DOORS.readRecord,\n { p_organization_id: org, p_record_id: record_id },\n \"recordRead\",\n );\n if (!door.ok) return err(door.error);\n const { document, hidden } = unfold(door.data);\n\n // 🚨 A DECORATION NEVER TAKES THE RECORD AWAY (lane LIMITS-FIX-UI, 2026-09-21).\n //\n // `custom.computed_provenance` answers WHICH RULE produced a worked-out value\n // (FLD-9). It is a footnote beside the record — and it has NO EXECUTE grant to\n // `authenticated`, measured on the live catalogue:\n //\n // read_record authenticated may: t\n // record_history authenticated may: t\n // field_history authenticated may: t\n // computed_provenance authenticated may: f\n //\n // `Peek` asks for the record WITH provenance, so this line returned that door's\n // refusal AS THE RECORD'S: the owner of an organization opened a record in it and\n // was told \"You do not have access to this\", above a history, a running checklist\n // and a comment box that all loaded perfectly. Reported twice — by the SCREENS-2\n // lane on a dental practice, and by crew E2, who checked at the doors and found\n // the record read itself answering correctly from that very seat.\n //\n // So the record comes back. The footnote's absence is REPORTED rather than\n // swallowed (nothing fails silently): `computedUnavailable` carries the refusal,\n // and a screen that draws rule provenance says it could not read it instead of\n // drawing nothing and meaning two different things by it.\n let computed: RecordRead[\"computed\"] = [];\n let computedUnavailable: RecordsError | null = null;\n if (withComputed) {\n const provenance = await callDoor<RecordRead[\"computed\"]>(\n DOORS.computedProvenance,\n { p_organization_id: org, p_record_id: record_id },\n \"recordRead.computed\",\n );\n if (provenance.ok) computed = provenance.data ?? [];\n else computedUnavailable = provenance.error;\n }\n return ok({ record_id, document, hidden, computed, computedUnavailable });\n },\n\n async listByIds({ table_id, ids }) {\n // NOTHING ASKED FOR IS AN EMPTY ANSWER, not a round trip. The door says the same, but\n // a call that cannot return a row should not cost one.\n if (ids.length === 0) return ok([]);\n const door = await callDoor<Array<{ id: Uuid; document: unknown; level: string }>>(\n DOORS.readRecordsByIds,\n { p_organization_id: org, p_table_id: table_id, p_record_ids: ids },\n \"listByIds\",\n );\n if (!door.ok) return err(door.error);\n return ok(\n (door.data ?? []).map((row) => {\n const { document, hidden } = unfold(row.document);\n return { id: row.id, document, level: row.level, hidden };\n }),\n );\n },\n\n async tableArchived({ table_id }) {\n // Through the SAME archived door a table's own archive uses, addressed at\n // the Table kernel (every Table is a record in it). Paged until the door\n // answers short, so a Table past the first page is still found.\n const kernel = await callDoor<Uuid>(DOORS.tableKernelId, {}, \"tableArchived.kernel\");\n if (!kernel.ok) return err(kernel.error);\n const PAGE = 200;\n for (let page = 0; page < 25; page += 1) {\n const answered = await this.listArchived({\n table_id: kernel.data,\n lane: \"org\",\n limit: PAGE,\n offset: page * PAGE,\n });\n if (!answered.ok) return err(answered.error);\n const hit = answered.data.rows.find((row) => row.id === table_id);\n if (hit) return ok(hit);\n if (answered.data.total !== null) return ok(null);\n }\n return ok(null);\n },\n\n async listArchived({ table_id, lane = DEFAULT_ARCHIVE_LANE, limit = 50, offset = 0 }) {\n // THE ROWS THAT LEFT, THROUGH THE STORE. The lane is handed to the door\n // rather than applied here, for the reason every filter in this client is:\n // a browser can only ever narrow the rows it was already given, so a lane\n // decided on this side would silently drop the rest of the answer and call\n // it \"mine\".\n const door = await callDoor<ArchivedDoorRow[]>(\n DOORS.readRecordsArchived,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_lane: lane,\n p_limit: limit,\n p_offset: offset,\n },\n \"listArchived\",\n );\n if (!door.ok) return err(door.error);\n const rows: ArchivedRow[] = (door.data ?? []).map((row) => {\n const { document, hidden } = unfold(row.document);\n return {\n id: row.id,\n document,\n level: row.level,\n hidden,\n archivedAt: row.archived_at,\n archivedBy: row.archived_by ?? null,\n archivedByName: row.archived_by_name ?? null,\n };\n });\n // The same honest arithmetic `list` does, for the same reason: a short\n // page has reached the end of the set this reader may see, so its size is\n // known; a full page says only \"at least this many\", which is not a total.\n const total = rows.length < limit ? offset + rows.length : null;\n return ok({ rows, total });\n },\n\n async list({ table_id, filter, limit = 50, offset = 0 }) {\n // ONE DOOR FOR ALL FOUR SURFACES. The grid, the board, the record list\n // and a dashboard drill-through all arrive here, and they all ask\n // `custom.read_records_matching` — with `{}` when nobody asked a\n // question. The filtered and the unfiltered page are then the SAME body\n // in the database, decided by the same ladder, so a narrowed screen can\n // never be a differently-judged screen.\n const door = await callDoor<Array<{ id: Uuid; document: unknown; level: string }>>(\n DOORS.readRecordsMatching,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_filter: filter ?? {},\n p_limit: limit,\n p_offset: offset,\n },\n \"list\",\n );\n if (!door.ok) return err(door.error);\n const rows: ReadRow[] = (door.data ?? []).map((row) => {\n const { document, hidden } = unfold(row.document);\n return { id: row.id, document, level: row.level, hidden };\n });\n // WHAT THE TOTAL HONESTLY IS, AND WHEN IT IS KNOWN FOR NOTHING.\n //\n // The door reads live records only — a deleted record is not in its set —\n // and it counts nothing, so a total taken from the table would be a count\n // of rows this reader may not see, with a number on it. That stays true\n // and no count is ever asked for.\n //\n // But a SHORT PAGE already answers the question. If the door was asked\n // for `limit` and handed back fewer, the reader has reached the end of\n // the set it is allowed to see, so the size of that set is exactly\n // `offset + rows.length` — the visible total, arrived at by arithmetic on\n // a page that had to be read anyway, with no second query and no leak.\n // Until 2026-09-21 this answered null unconditionally and a table holding\n // ten records told its owner \"Unknown total — showing the 10 records\n // loaded so far\", which is a screen refusing to say a thing it knows.\n //\n // 🚨 THIS RESTS ON ONE FACT ABOUT THE DOOR, AND THE FACT IS NOT THE\n // OBVIOUS ONE. `custom.read_records_matching` DOES clamp through\n // `custom.page_size(org, door, limit, 200)` — the first draft of this\n // comment said it did not, and the live clause below caught that while it\n // was being written. What makes the inference safe is what that helper\n // does at the ceiling: measured on the live store 2026-09-21, a request\n // over it is REFUSED BY NAME — \"custom.read_records_matching was asked for 1001\n // rows; this store serves at most 1000 rows in one page, so nothing was\n // read rather than quietly reading fewer\" — and 1, 50, 200 and 1000 each\n // come back as themselves. A page is therefore never quietly made\n // smaller, so a successful call that returns fewer rows than it asked for\n // has reached the end of the set and nothing else.\n //\n // If that ever changed — if the door began shrinking a page instead of\n // refusing it — a clamped FULL page would read as a short one and a\n // person with two hundred records would be told they have fifty. So the\n // live suite asserts the refusal, not the absence of a clamp; that clause\n // is what makes this inference safe to keep rather than a thing that\n // quietly rots.\n //\n // A FULL page says only \"at least this many\", which is not a total, so it\n // stays null and the screen keeps saying what it is actually showing.\n const total = rows.length < limit ? offset + rows.length : null;\n return ok({ rows, total });\n },\n\n async query(input) {\n const plan = planQuery(input);\n const sets: Uuid[][] = [];\n for (const call of plan.relationCalls) {\n const result = await callDoor<Array<{ relation_targets: Uuid } | Uuid>>(\n DOORS.relationTargets,\n { p_organization_id: org, p_record_id: call.record_id, p_via_key: call.via_key },\n \"query.relations\",\n );\n if (!result.ok) return err(result.error);\n sets.push(\n (result.data ?? []).map((row) =>\n typeof row === \"string\" ? row : (row as { relation_targets: Uuid }).relation_targets,\n ),\n );\n }\n for (const call of plan.promotedCalls) {\n const result = await callDoor<Array<{ promoted_read: Uuid } | Uuid>>(\n DOORS.promotedRead,\n {\n p_organization_id: org,\n p_table_id: plan.read.table_id,\n p_field_key: call.field_key,\n p_value: call.value,\n },\n \"query.promoted\",\n );\n if (!result.ok) return err(result.error);\n sets.push(\n (result.data ?? []).map((row) =>\n typeof row === \"string\" ? row : (row as { promoted_read: Uuid }).promoted_read,\n ),\n );\n }\n\n const ids = plan.intersects ? intersectIds(sets) : null;\n if (ids !== null && ids.length === 0) {\n return ok({ rows: [], total: 0 });\n }\n\n // DOOR-8: an as-of read is the STORE'S question, on the store's two\n // clocks — `p_recorded_at` is what the store said at that moment, and\n // `p_world_on` is what was true of the world on that date. This client\n // used to answer the record clock itself with `updated_at <= at` and\n // refuse the world clock by name; both were workarounds for doors that\n // now exist (`custom.query_table_as_of` / `custom.query_record_as_of`),\n // and neither ever looked at a dated value.\n if (plan.read.asOf) {\n const clock = plan.read.asOf.clock === \"world\"\n ? { p_world_on: plan.read.asOf.at.slice(0, 10) }\n : { p_recorded_at: plan.read.asOf.at };\n if (ids !== null) {\n const answers = await Promise.all(\n ids.slice(0, plan.read.limit).map((id) =>\n callDoor<unknown>(\n DOORS.queryRecordAsOf,\n { p_organization_id: org, p_record_id: id, ...clock },\n \"query.asOf\",\n ).then((result) => ({ id, result })),\n ),\n );\n const rows: ReadRow[] = [];\n for (const { id, result } of answers) {\n if (!result.ok) return err(result.error);\n // A null answer is the door saying \"not visible to you at that\n // time\", which is an absence, not an empty record.\n if (result.data === null) continue;\n const { document, hidden } = unfold(result.data);\n rows.push({ id, document, level: \"viewer\", hidden });\n }\n return ok({ rows, total: rows.length });\n }\n const page = await callDoor<Array<{ record_id: Uuid; data: unknown }>>(\n DOORS.queryTableAsOf,\n {\n p_organization_id: org,\n p_table_id: plan.read.table_id,\n ...clock,\n p_limit: plan.read.limit,\n p_offset: plan.read.offset,\n },\n \"query.asOf\",\n );\n if (!page.ok) return err(page.error);\n const rows: ReadRow[] = (page.data ?? [])\n .filter((row) => row.data !== null)\n .map((row) => {\n const { document, hidden } = unfold(row.data);\n return { id: row.record_id, document, level: \"viewer\", hidden };\n });\n return ok({ rows, total: null });\n }\n\n // The live read, through the read door and nothing else. With a planned\n // id set the door is asked one record at a time (it is keyed by record),\n // bounded by the page size; without one it is asked for the page.\n if (ids !== null) {\n const answers = await Promise.all(\n ids.slice(0, plan.read.limit).map((id) =>\n callDoor<unknown>(\n DOORS.readRecord,\n { p_organization_id: org, p_record_id: id },\n \"query\",\n ).then((result) => ({ id, result })),\n ),\n );\n const rows: ReadRow[] = [];\n for (const { id, result } of answers) {\n if (!result.ok) {\n // `02000` is \"that record is not here (any more)\" — a planned id\n // that has since been deleted is an absence, not a failed query.\n if (result.error.sqlstate === \"02000\") continue;\n return err(result.error);\n }\n const { document, hidden } = unfold(result.data);\n rows.push({ id, document, level: \"viewer\", hidden });\n }\n return ok({ rows, total: rows.length });\n }\n\n return client.list({\n table_id: plan.read.table_id,\n limit: plan.read.limit,\n offset: plan.read.offset,\n });\n },\n\n async tableList() {\n // THROUGH THE READ DOOR, like everything else. A Table is a RECORD in the\n // Table kernel, so listing this organization's Tables is\n // `read_records(org, table_kernel_id())` — the store decides which of them\n // this reader may see. Until 2026-09-18 this method selected\n // `custom.table` directly, which (a) is the raw table access this package\n // exists to make impossible and (b) could never have worked from a client:\n // `authenticated` holds no privilege on ANY table in `custom`, by design.\n // The browser extension found it on its first real turn (W6-EXT).\n const kernel = await callDoor<Uuid>(DOORS.tableKernelId, {}, \"tableList.kernel\");\n if (!kernel.ok) return err(kernel.error);\n const door = await callDoor<Array<{ id: Uuid; document: unknown; level: string }>>(\n DOORS.readRecords,\n { p_organization_id: org, p_table_id: kernel.data, p_limit: 500, p_offset: 0 },\n \"tableList\",\n );\n if (!door.ok) return err(door.error);\n const tables = (door.data ?? []).map((row) => {\n const { document } = unfold(row.document);\n // The kernel record IS the Table's declaration; `id` is the Table's id.\n // `row.level` IS NOT THIS TABLE'S LEVEL AND MUST NOT BE CARRIED AS ONE.\n // `read_records` answers the caller's level on the table it was ASKED\n // about, and this call asks about the Table KERNEL — so `row.level` here\n // is the caller's level on the kernel (viewer, for everybody) and not on\n // the table the row describes. Carrying it looked free and was measured\n // wrong within the hour: a table's own owner came back \"viewer\".\n // The level a screen needs is `custom.my_levels`, asked per subject.\n return { ...(document as Record<string, unknown>), id: row.id, organization_id: org } as unknown as Table;\n });\n // 🚨 WHO CAN SEE EACH TABLE, AND WHETHER THE CALLER MADE IT (lane HUB-FIX,\n // 2026-09-23). `visibility` and `created_by` are COLUMNS of `custom.record`, and\n // the document above never carried them — so every Table this method returned\n // had neither, `laneFor` filed every one under the organization, and \"Mine\"\n // read 0 on every seat (VERIFIER-16 M6). `custom.table_facts` answers the two\n // facts for exactly the Tables the caller can open; `created_by` is filled ONLY\n // with the caller's own id, only on the Tables the caller made.\n //\n // THE DOOR-PRESENCE PATTERN: asked only when the store's own catalogue\n // (STORE_DOORS, generated from pg_proc) carries it. Before the chair's apply\n // it is simply not asked — no refusal on every table list — and the Tables\n // come back exactly as they did before this change.\n if (doorExists(DOORS.tableFacts)) {\n const facts = await callDoor<Array<{ table_id: Uuid; visibility: string; mine: boolean }>>(\n DOORS.tableFacts,\n { p_organization_id: org },\n \"tableList.facts\",\n );\n if (facts.ok) {\n const byId = new Map((facts.data ?? []).map((f) => [f.table_id, f]));\n const me = config.actor.user_id ?? null;\n for (const table of tables) {\n const fact = byId.get(table.id);\n if (!fact) continue;\n (table as { visibility: string }).visibility = fact.visibility;\n if (fact.mine && me) (table as { created_by: Uuid | null }).created_by = me;\n }\n }\n }\n tables.sort((a, b) => (a.name ?? \"\").localeCompare(b.name ?? \"\"));\n return ok(tables);\n },\n\n async fields({ table_id, recordType }) {\n // FLD-10: the store decides which Fields APPLY, from the record type. The\n // client asks the door rather than filtering a full list, because the\n // applicability Rule reads Values this client has not got.\n const applicable = await callDoor<Array<{ id: Uuid; data: unknown }>>(\n DOORS.applicableFields,\n {\n p_organization_id: org,\n p_table_id: table_id,\n ...(recordType === undefined ? {} : { p_record_type: recordType }),\n },\n \"fields\",\n );\n if (!applicable.ok) return err(applicable.error);\n const rows = applicable.data ?? [];\n const fields = rows.map((row) => ({ id: row.id, ...(row.data as object) }) as Field);\n // IN THE ORDER A PERSON PUT THEM IN. `custom.applicable_fields` answers a\n // set, not a sequence — its order is whatever the plan gives it, and it\n // moves between calls — so a grid that mapped it straight to columns drew\n // them in an arbitrary order and a reorder in the settings panel appeared\n // to do nothing. `sort` is the Field's own declared position (and what\n // `custom.field_update` writes when somebody moves one), so it is applied\n // ONCE, here, and every consumer of this client inherits it. Measured\n // 2026-09-20: a table declared Title, Day rate, Due came back Day rate,\n // Title, Due.\n fields.sort(\n (a, b) => (a.sort ?? 0) - (b.sort ?? 0) || (a.label ?? \"\").localeCompare(b.label ?? \"\"),\n );\n return ok(fields);\n },\n\n async fieldOptions({ field_id }) {\n return callDoor<StoredRecord[]>(\n DOORS.fieldOptions,\n { p_organization_id: org, p_field_id: field_id },\n \"fieldOptions\",\n );\n },\n\n async tableCapacity({ table_id }) {\n return callDoor<TableCapacity>(\n DOORS.tableCapacity,\n { p_organization_id: org, p_table_id: table_id },\n \"tableCapacity\",\n );\n },\n\n async fieldDeclare({ table_id, spec }) {\n // `allow_other` is a choice list's own setting and the store keeps it in\n // the column's config (STORE-RULE-GAPS); the declaration names it plainly.\n const { allow_other, ...rest } = spec;\n const p_spec =\n allow_other === undefined\n ? rest\n : { ...rest, config: { ...(rest.config ?? {}), allow_other } };\n return callDoor<Uuid>(\n DOORS.fieldDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec },\n \"fieldDeclare\",\n );\n },\n\n async entityTable({ token }) {\n // The door answers one row; `callDoor` hands back the array PostgREST\n // returns for a set-returning function, so the ONE row is taken here\n // rather than in every caller.\n const answer = await callDoor<EntityTableFacts[] | EntityTableFacts>(\n DOORS.entityTable,\n { p_token: token },\n \"entityTable\",\n );\n if (!answer.ok) return err(answer.error);\n const row = Array.isArray(answer.data) ? answer.data[0] : answer.data;\n if (!row) {\n return err({\n code: \"not_found\",\n message: `The registry answered nothing for the table \"${token}\".`,\n hint: \"REC-33: a standard table is named by its registry token. Nothing was read.\",\n });\n }\n return ok(row);\n },\n\n async entityFields({ token }) {\n const rows = await callDoor<Array<{ id: Uuid; data: unknown }>>(\n DOORS.entityFields,\n { p_organization_id: org, p_token: token },\n \"entityFields\",\n );\n if (!rows.ok) return err(rows.error);\n return ok((rows.data ?? []).map((row) => ({ id: row.id, ...(row.data as object) }) as Field));\n },\n\n async entityFieldDeclare({ token, spec }) {\n return callDoor<Uuid>(\n DOORS.entityFieldDeclare,\n { p_organization_id: org, p_token: token, p_spec: spec },\n \"entityFieldDeclare\",\n );\n },\n\n async entityFieldUpdate({ field_id, patch }) {\n return callDoor<Uuid>(\n DOORS.entityFieldUpdate,\n { p_organization_id: org, p_field_id: field_id, p_patch: patch },\n \"entityFieldUpdate\",\n );\n },\n\n async entityFieldRetire({ field_id }) {\n return callDoor<Uuid>(\n DOORS.entityFieldRetire,\n { p_organization_id: org, p_field_id: field_id },\n \"entityFieldRetire\",\n );\n },\n\n async entityFieldRights({ token }) {\n return callDoor<EntityFieldRights>(\n DOORS.entityFieldRights,\n { p_organization_id: org, p_token: token },\n \"entityFieldRights\",\n );\n },\n\n async entityRecordRead({ token, record_id }) {\n return callDoor<EntityRecordRead>(\n DOORS.entityRecordRead,\n { p_organization_id: org, p_token: token, p_record_id: record_id },\n \"entityRecordRead\",\n );\n },\n\n async entityValueWrite({ token, record_id, patch }) {\n return callDoor<EntityRecordRead>(\n DOORS.entityValueWrite,\n { p_organization_id: org, p_token: token, p_record_id: record_id, p_patch: patch },\n \"entityValueWrite\",\n );\n },\n\n async entityRecordsFind({ token, key, value, limit, offset }) {\n return callDoor<EntityRecordsFound>(\n DOORS.entityRecordsFind,\n {\n p_organization_id: org,\n p_token: token,\n p_key: key,\n p_value: value === undefined ? null : value,\n ...(limit === undefined ? {} : { p_limit: limit }),\n ...(offset === undefined ? {} : { p_offset: offset }),\n },\n \"entityRecordsFind\",\n );\n },\n\n async fieldUpdate({ field_id, patch }) {\n return callDoor<Uuid>(\n DOORS.fieldUpdate,\n { p_organization_id: org, p_field_id: field_id, p_patch: patch },\n \"fieldUpdate\",\n );\n },\n\n async fieldRetire({ field_id }) {\n return callDoor<boolean>(\n DOORS.fieldRetire,\n { p_organization_id: org, p_field_id: field_id },\n \"fieldRetire\",\n );\n },\n\n async relationWords({ field_id, value }) {\n return callDoor<string | null>(\n DOORS.relationWords,\n { p_organization_id: org, p_field_id: field_id, p_value: value },\n \"relationWords\",\n );\n },\n\n async relationWordsMany(args) {\n // ONE PRIMITIVE, TWO STORE DOORS. The `store` decides which door answers,\n // and the answer SHAPE is identical either way — a lookup from id to the\n // words that id reads. Every screen that resolved a relation chip before\n // OLD-TABLES-2 passes no `store` at all and reaches exactly the door it\n // always reached.\n //\n // The door returns one row per id — `(id, words)` — and a caller wants a\n // lookup, so the shape is turned here rather than in every screen. An id\n // the store answered nothing for is simply ABSENT from the map, and the\n // caller decides what an absent chip says; inventing \"Untitled\" here\n // would hide the difference between \"no answer yet\" and \"no words\", and\n // in the older store it would hide the difference between a cell that\n // points at nothing (absent — an unresolvable reference, shown with its\n // identifier) and one the reader may not open (present, carrying the\n // withheld sentence and no id).\n const older = args.store === \"older\";\n const result = older\n ? await workbenchDoor<Array<{ row_id: Uuid; words: string | null }>>(\n WORKBENCH_DOORS.udtRowWordsMany,\n {\n p_organization_id: org,\n p_display: args.display ?? null,\n p_row_ids: args.record_ids,\n },\n \"relationWordsMany(older)\",\n )\n : await callDoor<Array<{ record_id: Uuid; words: string | null }>>(\n DOORS.relationWordsMany,\n { p_organization_id: org, p_field_id: args.field_id, p_record_ids: args.record_ids },\n \"relationWordsMany\",\n );\n if (!result.ok) return result;\n const map: Record<string, string> = {};\n for (const row of (result.data ?? []) as Array<{\n record_id?: Uuid;\n row_id?: Uuid;\n words: string | null;\n }>) {\n const id = row?.record_id ?? row?.row_id;\n if (id && typeof row.words === \"string\") map[id] = row.words;\n }\n return { ok: true, data: map };\n },\n\n async tableDeclare({ spec, homeId }) {\n return callDoor<Uuid>(\n DOORS.tableDeclare,\n { p_organization_id: org, p_spec: { ...spec, parent_id: homeId } },\n \"tableDeclare\",\n );\n },\n\n async personKernelId() {\n return callDoor<Uuid>(DOORS.personKernelId, {}, \"personKernelId\");\n },\n\n async fieldKernelId() {\n return callDoor<Uuid>(DOORS.fieldKernelId, {}, \"fieldKernelId\");\n },\n\n async ruleKernelId() {\n return callDoor<Uuid>(DOORS.ruleKernelId, {}, \"ruleKernelId\");\n },\n\n async pipelineRead({ table_id }) {\n return callDoor<Pipeline>(\n DOORS.pipelineRead,\n { p_organization_id: org, p_table_id: table_id },\n \"pipelineRead\",\n );\n },\n\n async pipelineBoard({ table_id, measure }) {\n return callDoor<PipelineColumn[]>(\n DOORS.pipelineBoard,\n { p_organization_id: org, p_table_id: table_id, p_measure: measure ?? null },\n \"pipelineBoard\",\n );\n },\n\n async pipelineTransitionRefusal({ record_id, to }) {\n return callDoor<PipelineVerdict>(\n DOORS.pipelineTransitionRefusal,\n { p_organization_id: org, p_record_id: record_id, p_to: to },\n \"pipelineTransitionRefusal\",\n );\n },\n\n async pipelineMove({ record_id, to, also, expected_version }) {\n return callDoor<PipelineMoveResult>(\n DOORS.pipelineMove,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_to: to,\n p_also: also ?? {},\n p_expected_version: expected_version ?? null,\n },\n \"pipelineMove\",\n );\n },\n\n async pipelineDeclare({ table_id, spec }) {\n return callDoor<PipelineDeclared>(\n DOORS.pipelineDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec: spec },\n \"pipelineDeclare\",\n );\n },\n\n async tableStageField({ table_id }) {\n return callDoor<string | null>(\n DOORS.tableStageField,\n { p_organization_id: org, p_table_id: table_id },\n \"tableStageField\",\n );\n },\n\n async stageRuleOnFailKinds() {\n return callDoor<{ behaviour: StageRuleOnFail; note: string }[]>(\n DOORS.stageRuleOnFailKinds,\n {},\n \"stageRuleOnFailKinds\",\n );\n },\n\n async stageRuleEnforcement() {\n return callDoor<StageRuleEnforcement>(\n DOORS.stageRuleEnforcement,\n { p_organization_id: org },\n \"stageRuleEnforcement\",\n );\n },\n\n async recordStagePending({ record_id }) {\n return callDoor<StagePending[]>(\n DOORS.recordStagePending,\n { p_organization_id: org, p_record_id: record_id },\n \"recordStagePending\",\n );\n },\n\n async pipelinePending({ table_id }) {\n return callDoor<StagePendingOnBoard[]>(\n DOORS.pipelinePending,\n { p_organization_id: org, p_table_id: table_id },\n \"pipelinePending\",\n );\n },\n\n async pipelineGatePreview({ table_id, stage, gate }) {\n return callDoor<PipelineGatePreview>(\n DOORS.pipelineGatePreview,\n { p_organization_id: org, p_table_id: table_id, p_stage: stage, p_gate: gate },\n \"pipelineGatePreview\",\n );\n },\n\n async ruleMembers({ rule_id }) {\n return callDoor<StoredRecord[]>(\n DOORS.ruleMembers,\n { p_organization_id: org, p_rule_id: rule_id },\n \"ruleMembers\",\n );\n },\n\n async ruleMembership({ rule_id, record_id }) {\n return callDoor<unknown>(\n DOORS.ruleMembership,\n { p_organization_id: org, p_rule_id: rule_id, p_record_id: record_id },\n \"ruleMembership\",\n );\n },\n\n async forms(args) {\n return callDoor<FormSummary[]>(\n DOORS.forms,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"forms\",\n );\n },\n\n async bookings(args) {\n return callDoor<BookingSummary[]>(\n DOORS.bookings,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"bookings\",\n );\n },\n\n async bookingDeclare(args) {\n return callDoor<BookingDeclared>(\n DOORS.bookingDeclare,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_title: args.title,\n p_questions: args.questions,\n // AN EMPTY OBJECT IS NOT A MISTAKE. The store owns every default, so a\n // page declared with no availability comes back Monday-to-Friday,\n // nine-to-five, in the organization's own zone — and the screen draws\n // what came BACK rather than what it sent.\n p_availability: args.availability ?? {},\n p_presentation: args.presentation ?? {},\n p_submission_cap: args.submission_cap ?? null,\n p_quarantine_rule_id: args.quarantine_rule_id ?? null,\n p_notify_rule_id: args.notify_rule_id ?? null,\n p_form_id: args.form_id ?? null,\n p_slug: args.slug ?? null,\n p_home_id: args.home_id ?? null,\n },\n \"bookingDeclare\",\n );\n },\n\n async formDeclare(args) {\n return callDoor<Uuid>(\n DOORS.formDeclare,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_title: args.title,\n p_questions: args.questions,\n p_presentation: args.presentation ?? {},\n p_submission_cap: args.submission_cap ?? null,\n p_quarantine_rule_id: args.quarantine_rule_id ?? null,\n p_notify_rule_id: args.notify_rule_id ?? null,\n p_form_id: args.form_id ?? null,\n p_slug: args.slug ?? null,\n },\n \"formDeclare\",\n );\n },\n\n async importPlan(args) {\n return callDoor<ImportPlan>(\n DOORS.importPlan,\n { p_organization_id: org, p_table_id: args.table_id, p_columns: args.columns },\n \"importPlan\",\n );\n },\n\n async importBegin(args) {\n return callDoor<ImportOpened>(\n DOORS.importBegin,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_format: args.format ?? \"csv\",\n p_source_name: args.source_name ?? null,\n p_source_columns: args.source_columns ?? [],\n p_file_hash: args.file_hash ?? null,\n p_policy: args.policy ?? {},\n p_dedupe_key: args.dedupe_key ?? null,\n p_file_bytes: args.file_bytes ?? null,\n p_force: args.force ?? false,\n },\n \"importBegin\",\n );\n },\n\n async importDeclareColumns(args) {\n return callDoor<ImportColumnsDeclared>(\n DOORS.importDeclareColumns,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_rows: args.rows,\n p_mapping: args.mapping ?? {},\n },\n \"importDeclareColumns\",\n );\n },\n\n async importRows(args) {\n return callDoor<ImportBatchResult>(\n DOORS.importRows,\n {\n p_organization_id: org,\n p_import_id: args.import_id,\n p_rows: args.rows,\n p_mapping: args.mapping ?? {},\n },\n \"importRows\",\n );\n },\n\n async importFinish(args) {\n return callDoor<ImportFinished>(\n DOORS.importFinish,\n { p_organization_id: org, p_import_id: args.import_id, p_unmapped: args.unmapped ?? null },\n \"importFinish\",\n );\n },\n\n async importReport(args) {\n return callDoor<ImportReport>(\n DOORS.importReport,\n {\n p_organization_id: org,\n p_import_id: args.import_id,\n p_state: args.state ?? \"refused\",\n p_limit: args.limit ?? 100,\n p_offset: args.offset ?? 0,\n },\n \"importReport\",\n );\n },\n\n async imports(args) {\n return callDoor<ImportRun[]>(\n DOORS.imports,\n { p_organization_id: org, p_table_id: args?.table_id ?? null, p_limit: args?.limit ?? 25 },\n \"imports\",\n );\n },\n\n async importForget(args) {\n return callDoor<boolean>(\n DOORS.importForget,\n { p_organization_id: org, p_import_id: args.import_id },\n \"importForget\",\n );\n },\n\n async inboundDeclare(args) {\n return callDoor<InboundDeclared>(\n DOORS.inboundDeclare,\n { p_organization_id: org, p_table_id: args.table_id, p_label: args.label ?? null },\n \"inboundDeclare\",\n );\n },\n\n async inboundAddresses(args) {\n return callDoor<InboundAddress[]>(\n DOORS.inboundAddresses,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"inboundAddresses\",\n );\n },\n\n async inboundSet(args) {\n return callDoor<{ inbound_id: Uuid; address: string; enabled: boolean; message: string }>(\n DOORS.inboundSet,\n { p_organization_id: org, p_inbound_id: args.inbound_id, p_enabled: args.enabled },\n \"inboundSet\",\n );\n },\n\n async portals() {\n return callDoor<PortalSummary[]>(DOORS.portals, { p_organization_id: org }, \"portals\");\n },\n\n async listPortals(args) {\n return callDoor<PortalSummary[]>(\n DOORS.listPortals,\n { p_organization_id: org, p_archived: args?.archived ?? \"active\" },\n \"listPortals\",\n );\n },\n\n async portalArchive(args) {\n return callDoor<PortalArchiveAnswer>(\n DOORS.portalArchive,\n {\n p_organization_id: org,\n p_portal_id: args.portal_id,\n p_confirm_title: args.confirm_title,\n p_reason: args.reason ?? null,\n },\n \"portalArchive\",\n );\n },\n\n async portalRestore(args) {\n return callDoor<PortalArchiveAnswer>(\n DOORS.portalRestore,\n {\n p_organization_id: org,\n p_portal_id: args.portal_id,\n p_confirm_title: args.confirm_title,\n },\n \"portalRestore\",\n );\n },\n\n async portalTables() {\n return callDoor<PortalTableRef[]>(DOORS.portalTables, { p_organization_id: org }, \"portalTables\");\n },\n\n async portalCard({ portal_id }) {\n return callDoor<PortalCard>(\n DOORS.portalCard,\n { p_organization_id: org, p_portal_id: portal_id },\n \"portalCard\",\n );\n },\n\n async portalDeclare(args) {\n return callDoor<Uuid>(\n DOORS.portalDeclare,\n {\n p_organization_id: org,\n p_title: args.title,\n p_client_table_id: args.client_table_id,\n p_tables: args.tables,\n p_portal_id: args.portal_id ?? null,\n p_slug: args.slug ?? null,\n p_sign_in_method: args.sign_in_method ?? \"magic_link\",\n },\n \"portalDeclare\",\n );\n },\n\n async portalInvite(args) {\n return callDoor<PortalInvitation>(\n DOORS.portalInvite,\n {\n p_organization_id: org,\n p_portal_id: args.portal_id,\n p_client_record_id: args.client_record_id,\n p_email: args.email,\n // ALWAYS null from a client. See the interface comment: an invitation\n // confers nothing until the person follows their own sign-in link.\n p_user_id: null,\n },\n \"portalInvite\",\n );\n },\n\n async portalRevoke({ portal_id, principal_id }) {\n return callDoor<PortalRevocation>(\n DOORS.portalRevoke,\n { p_organization_id: org, p_portal_id: portal_id, p_principal_id: principal_id },\n \"portalRevoke\",\n );\n },\n\n async portalPreview({ portal_id, principal_id, table_id }) {\n return callDoor<PortalPreviewRow[]>(\n DOORS.portalPreview,\n {\n p_organization_id: org,\n p_portal_id: portal_id,\n p_principal_id: principal_id,\n p_table_id: table_id,\n },\n \"portalPreview\",\n );\n },\n\n async ruleRun({ rule_id, values, context }) {\n return callDoor<unknown>(\n DOORS.ruleRun,\n {\n p_organization_id: org,\n p_rule_id: rule_id,\n p_values: values,\n ...(context === undefined ? {} : { p_context: context }),\n },\n \"ruleRun\",\n );\n },\n\n async ruleEval({ expr, values, context }) {\n return callDoor<unknown>(\n DOORS.ruleEval,\n {\n p_organization_id: org,\n p_expr: expr,\n p_values: values,\n ...(context === undefined ? {} : { p_context: context }),\n },\n \"ruleEval\",\n );\n },\n\n async captureSheetDeclare(args) {\n return callDoor<Uuid>(\n DOORS.captureSheetDeclare,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_title: args.title,\n p_questions: args.questions,\n p_presentation: args.presentation ?? {},\n p_sheet_id: args.sheet_id ?? null,\n p_notify_rule_id: args.notify_rule_id ?? null,\n },\n \"captureSheetDeclare\",\n );\n },\n\n async capturePublish(args) {\n return callDoor<string | null>(\n DOORS.capturePublish,\n { p_organization_id: org, p_sheet_id: args.sheet_id, p_open: args.open ?? true },\n \"capturePublish\",\n );\n },\n\n async captureSheets(args) {\n return callDoor<CaptureSheetSummary[]>(\n DOORS.captureSheets,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"captureSheets\",\n );\n },\n\n async captureOpen(args) {\n const out = await callDoor<CaptureSheetFace[] | CaptureSheetFace | null>(\n DOORS.captureOpen,\n { p_organization_id: org, p_sheet_id: args.sheet_id },\n \"captureOpen\",\n );\n if (!out.ok) return out as RecordsResult<CaptureSheetFace | null>;\n const rows = Array.isArray(out.data) ? out.data : out.data ? [out.data] : [];\n // NO ROW is the answer for a sheet below `viewer` AND for a sheet that is not\n // there — the same answer the Table itself gives. It is not an error.\n return { ...out, data: rows[0] ?? null } as RecordsResult<CaptureSheetFace | null>;\n },\n\n async captureSubmit(args) {\n const out = await callDoor<CaptureOutcome[] | CaptureOutcome | null>(\n DOORS.captureSubmit,\n {\n p_organization_id: org,\n p_sheet_id: args.sheet_id,\n p_client_key: args.client_key,\n p_payload: args.answers ?? {},\n p_files: args.files ?? [],\n p_device: args.device ?? null,\n p_captured_at: args.captured_at ?? null,\n p_location: args.location ?? null,\n },\n \"captureSubmit\",\n );\n if (!out.ok) return out as RecordsResult<CaptureOutcome | null>;\n const rows = Array.isArray(out.data) ? out.data : out.data ? [out.data] : [];\n return { ...out, data: rows[0] ?? null } as RecordsResult<CaptureOutcome | null>;\n },\n\n async enrichments(args) {\n return callDoor<EnrichmentSummary[]>(\n DOORS.enrichments,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"enrichments\",\n );\n },\n\n async enrichDeclare(args) {\n return callDoor<EnrichDeclared>(\n DOORS.enrichDeclare,\n { p_organization_id: org, p_field_id: args.field_id, p_spec: args.spec },\n \"enrichDeclare\",\n );\n },\n\n async enrichDue(args) {\n return callDoor<EnrichDueRow[]>(\n DOORS.enrichDue,\n {\n p_organization_id: org,\n p_field_id: args.field_id,\n p_limit: args.limit ?? 50,\n p_include_fresh: args.include_fresh ?? false,\n },\n \"enrichDue\",\n );\n },\n\n async enrichCells(args) {\n return callDoor<EnrichCell[]>(\n DOORS.enrichCells,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_field_keys: args.field_keys ?? null,\n p_record_ids: args.record_ids ?? null,\n },\n \"enrichCells\",\n );\n },\n\n async enrichPin(args) {\n return callDoor<{ pinned: boolean; says: string }>(\n DOORS.enrichPin,\n {\n p_organization_id: org,\n p_record_id: args.record_id,\n p_field_key: args.field_key,\n p_pinned: args.pinned ?? true,\n },\n \"enrichPin\",\n );\n },\n\n async enrichRuns(args) {\n return callDoor<EnrichRun[]>(\n DOORS.enrichRuns,\n {\n p_organization_id: org,\n p_field_id: args?.field_id ?? null,\n p_limit: args?.limit ?? 50,\n },\n \"enrichRuns\",\n );\n },\n\n async dashboards(args) {\n return callDoor<DashboardSummary[]>(\n DOORS.dashboards,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"dashboards\",\n );\n },\n\n async dashboardDeclare(args) {\n return callDoor<Uuid>(\n DOORS.dashboardDeclare,\n {\n p_organization_id: org,\n p_table_id: args.table_id,\n p_name: args.name,\n p_blocks: args.blocks ?? [],\n p_presentation: args.presentation ?? {},\n p_dashboard_id: args.dashboard_id ?? null,\n },\n \"dashboardDeclare\",\n );\n },\n\n async dashboardRun({ dashboard_id, filter }) {\n return callDoor<DashboardRunResult>(\n DOORS.dashboardRun,\n { p_organization_id: org, p_dashboard_id: dashboard_id, p_filter: filter ?? {} },\n \"dashboardRun\",\n );\n },\n\n async dashboardStuck({ table_id, state_key, days, filter, limit }) {\n return callDoor<StuckRow[]>(\n DOORS.dashboardStuck,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_state_key: state_key,\n p_days: days ?? 14,\n p_filter: filter ?? {},\n p_limit: limit ?? 50,\n },\n \"dashboardStuck\",\n );\n },\n\n async dashboardDelete({ dashboard_id }) {\n return callDoor<boolean>(\n DOORS.dashboardDelete,\n { p_organization_id: org, p_dashboard_id: dashboard_id },\n \"dashboardDelete\",\n );\n },\n\n async recordAggregate({ table_id, groupBy, measures, bucket, filter, limit }) {\n return callDoor<AggregateRow[]>(\n DOORS.recordAggregate,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_group_by: groupBy ?? [],\n p_measures: measures ?? [],\n p_bucket: bucket ?? null,\n p_filter: filter ?? {},\n p_limit: limit ?? 200,\n },\n \"recordAggregate\",\n );\n },\n\n async aggOperations() {\n return callDoor<string[]>(DOORS.aggOperations, {}, \"aggOperations\");\n },\n\n async aggBuckets() {\n return callDoor<string[]>(DOORS.aggBuckets, {}, \"aggBuckets\");\n },\n\n async aggSubscriptions(args) {\n return callDoor<Subscription[]>(\n DOORS.aggSubscriptions,\n {\n p_organization_id: org,\n p_saved_view_id: args?.saved_view_id ?? null,\n p_cadence: args?.cadence ?? null,\n },\n \"aggSubscriptions\",\n );\n },\n\n async aggSubscriptionCadences() {\n return callDoor<string[]>(DOORS.aggSubscriptionCadences, {}, \"aggSubscriptionCadences\");\n },\n\n async subscriptionCadences() {\n return callDoor<string[]>(\n DOORS.subscriptionCadences,\n { p_organization_id: org },\n \"subscriptionCadences\",\n );\n },\n\n async subscriptions(args) {\n return callDoor<MySubscription[]>(\n DOORS.subscriptions,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"subscriptions\",\n );\n },\n\n async subscriptionDeclare({ table_id, spec }) {\n return callDoor<Uuid>(\n DOORS.subscriptionDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec: spec },\n \"subscriptionDeclare\",\n );\n },\n\n async subscriptionPreview({ rule_id }) {\n return callDoor<DigestPreview>(\n DOORS.subscriptionPreview,\n { p_organization_id: org, p_rule_id: rule_id },\n \"subscriptionPreview\",\n );\n },\n\n async views(args) {\n return callDoor<SavedViewRow[]>(\n DOORS.views,\n { p_organization_id: org, p_table_id: args?.table_id ?? null },\n \"views\",\n );\n },\n\n async viewDeclare({ table_id, spec }) {\n return callDoor<Uuid>(\n DOORS.viewDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec: spec },\n \"viewDeclare\",\n );\n },\n\n async subscriptionMute({ rule_id, muted }) {\n return callDoor<boolean>(\n DOORS.subscriptionMute,\n { p_organization_id: org, p_rule_id: rule_id, p_muted: muted },\n \"subscriptionMute\",\n );\n },\n\n async docTemplateSave({ table_id, name, body, template_id }) {\n return callDoor<Uuid>(\n DOORS.docTemplateSave,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_name: name,\n p_body: body,\n p_template_id: template_id ?? null,\n },\n \"docTemplateSave\",\n );\n },\n\n async docRenderBody({ template_id, record_id }) {\n return callDoor<string>(\n DOORS.docRenderBody,\n { p_organization_id: org, p_template_id: template_id, p_record_id: record_id },\n \"docRenderBody\",\n );\n },\n\n async docRenderDocument({ template_id, record_id }) {\n return callDoor<Uuid>(\n DOORS.docRenderDocument,\n { p_organization_id: org, p_template_id: template_id, p_record_id: record_id },\n \"docRenderDocument\",\n );\n },\n\n async docTokens({ body }) {\n return callDoor<DocToken[]>(DOORS.docTokens, { p_body: body }, \"docTokens\");\n },\n\n async docUnresolvedTokens({ table_id, body }) {\n return callDoor<DocUnresolvedToken[]>(\n DOORS.docUnresolvedTokens,\n { p_organization_id: org, p_table_id: table_id, p_body: body },\n \"docUnresolvedTokens\",\n );\n },\n\n async docSign({ render_id, field_key, signer_name, signer_user_id }) {\n return callDoor<Uuid>(\n DOORS.docSign,\n {\n p_organization_id: org,\n p_render_id: render_id,\n p_field_key: field_key,\n p_signer_name: signer_name,\n p_signer_user_id: signer_user_id ?? null,\n },\n \"docSign\",\n );\n },\n\n // A LIST IS A DOOR, NEVER A GRANT ON THE THING BEHIND IT. These three used to\n // read `custom.doc_template`, `custom.doc_render` and `custom.doc_signature`\n // with a direct PostgREST `.from()`, and none of the three holds a client\n // SELECT — so a person could save a template they could never list and\n // render a document they could never find again, and every document screen\n // opened on \"permission denied for view doc_template\". The doors below\n // narrow inside the definer, after the ladder has spoken (DOORS-TWO).\n async docTemplates({ table_id }) {\n // The door names its key `template_id`, because a door answers about the\n // thing it is a door to. The package's row keeps `id`, which is what every\n // screen already holds — one rename, here, rather than in four screens.\n const answered = await callDoor<Array<Record<string, unknown>>>(\n DOORS.docTemplates,\n { p_organization_id: org, p_table_id: table_id },\n \"docTemplates\",\n );\n if (!answered.ok) return answered;\n return ok(\n answered.data.map((row) => ({ ...row, id: row[\"template_id\"] })) as unknown as DocTemplateRow[],\n );\n },\n\n async docTemplateDelete({ template_id }) {\n return callDoor<boolean>(\n DOORS.docTemplateDelete,\n { p_organization_id: org, p_template_id: template_id },\n \"docTemplateDelete\",\n );\n },\n\n async docRenders({ record_id }) {\n const answered = await callDoor<Array<Record<string, unknown>>>(\n DOORS.docRenders,\n { p_organization_id: org, p_record_id: record_id },\n \"docRenders\",\n );\n if (!answered.ok) return answered;\n return ok(\n answered.data.map((row) => ({ ...row, id: row[\"render_id\"] })) as unknown as DocRenderRow[],\n );\n },\n\n async docSignatures({ record_id }) {\n const answered = await callDoor<Array<Record<string, unknown>>>(\n DOORS.docSignatures,\n { p_organization_id: org, p_record_id: record_id },\n \"docSignatures\",\n );\n if (!answered.ok) return answered;\n return ok(\n answered.data.map((row) => ({ ...row, id: row[\"signature_id\"] })) as unknown as DocSignatureRow[],\n );\n },\n\n async recordValuesVersioned({ record_id }) {\n return readValues(record_id);\n },\n\n async revisions({ record_id }) {\n return callDoor<RecordRevision[]>(\n DOORS.ioRevisions,\n { p_organization_id: org, p_record_id: record_id },\n \"revisions\",\n );\n },\n\n async recordScopeContext({ record_id, relations, history, siblings }) {\n return callDoor<RecordScopeContext>(\n DOORS.recordScopeContext,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_relations: relations ?? 12,\n p_history: history ?? 15,\n p_siblings: siblings ?? 8,\n },\n \"recordScopeContext\",\n );\n },\n\n async conversationScope({ conversation_id }) {\n return callDoor<ConversationScope>(\n DOORS.conversationScope,\n { p_organization_id: org, p_conversation_id: conversation_id },\n \"conversationScope\",\n );\n },\n\n async conversationScopeBind({ conversation_id, record_id }) {\n return callDoor<ConversationScope>(\n DOORS.conversationScopeBind,\n {\n p_organization_id: org,\n p_conversation_id: conversation_id,\n p_record_id: record_id,\n },\n \"conversationScopeBind\",\n );\n },\n\n async conversationScopeUnbind({ conversation_id }) {\n return callDoor<ConversationScope>(\n DOORS.conversationScopeUnbind,\n { p_organization_id: org, p_conversation_id: conversation_id },\n \"conversationScopeUnbind\",\n );\n },\n\n async conversationScopeContext({ conversation_id, relations, history, siblings }) {\n return callDoor<ConversationScopeContext>(\n DOORS.conversationScopeContext,\n {\n p_organization_id: org,\n p_conversation_id: conversation_id,\n p_relations: relations ?? 12,\n p_history: history ?? 15,\n p_siblings: siblings ?? 8,\n },\n \"conversationScopeContext\",\n );\n },\n\n async recordHistory({ record_id, limit, offset }) {\n return callDoor<RecordHistoryEntry[]>(\n DOORS.recordHistory,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_limit: limit ?? 200,\n p_offset: offset ?? 0,\n },\n \"recordHistory\",\n );\n },\n\n async fieldHistory({ table_id, field_key, limit, offset, record_id }) {\n return callDoor<FieldHistoryEntry[]>(\n DOORS.fieldHistory,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_field_key: field_key,\n p_limit: limit ?? 100,\n p_offset: offset ?? 0,\n p_record_id: record_id ?? null,\n },\n \"fieldHistory\",\n );\n },\n\n async restorePreview({ record_id, version, field_key }) {\n return callDoor<RestorePreview>(\n DOORS.restorePreview,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_version: version,\n p_field_key: field_key ?? null,\n },\n \"restorePreview\",\n );\n },\n\n async restoreVersion({ record_id, version }) {\n const result = await callDoor<RestoreResult>(\n DOORS.restoreVersion,\n { p_organization_id: org, p_record_id: record_id, p_version: version },\n \"restoreVersion\",\n );\n if (result.ok) announceRecordChanged(record_id);\n return result;\n },\n\n async valueRestore({ record_id, field_key, version }) {\n const answered = await callDoor<RestoreResult>(\n DOORS.valueRestore,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_field_key: field_key,\n p_version: version,\n },\n \"valueRestore\",\n );\n if (answered.ok) announceRecordChanged(record_id);\n return answered;\n },\n\n async commentThread({ record_id, include_resolved }) {\n return callDoor<CommentThreadRead>(\n DOORS.commentThread,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_include_resolved: include_resolved ?? false,\n },\n \"commentThread\",\n );\n },\n\n async commentWrite({ record_id, body, field_key, parent_comment_id, mentions }) {\n return callDoor<CommentWritten>(\n DOORS.commentWrite,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_body: body,\n // THE ANCHOR IS WHERE A FIELD COMMENT LIVES. `custom.io_comment` has\n // always carried it; nothing was ever putting a Field in it.\n p_anchor: field_key ? { field_key } : {},\n p_parent_comment_id: parent_comment_id ?? null,\n p_mentions: mentions && mentions.length > 0 ? mentions : null,\n },\n \"commentWrite\",\n );\n },\n\n async commentResolve({ comment_id, resolved }) {\n return callDoor<boolean>(\n DOORS.commentResolve,\n {\n p_organization_id: org,\n p_comment_id: comment_id,\n p_resolved: resolved ?? true,\n },\n \"commentResolve\",\n );\n },\n\n async docSignatureRead({ signature_id }) {\n return callDoor<unknown>(\n DOORS.docSignatureRead,\n { p_organization_id: org, p_signature_id: signature_id },\n \"docSignatureRead\",\n );\n },\n\n // ── the anonymous lane ───────────────────────────────────────────────\n async anonTokenIssue({ mode, allowedOrigins, formId, savedViewId, recordId, expiresAt }) {\n // The door answers a one-row TABLE, so the array is unwrapped here rather\n // than in every caller. An empty answer is impossible — the door either\n // returns the pair or raises — so `[0]` is not a guess.\n const answered = await callDoor<Array<{ token_id: Uuid; secret: string }>>(\n DOORS.anonTokenIssue,\n {\n p_organization_id: org,\n p_mode: mode,\n p_allowed_origins: allowedOrigins,\n p_form_id: formId ?? null,\n p_saved_view_id: savedViewId ?? null,\n p_record_id: recordId ?? null,\n p_expires_at: expiresAt ?? null,\n },\n \"anonTokenIssue\",\n );\n if (!answered.ok) return answered;\n const pair = answered.data[0];\n if (!pair) {\n return err({\n code: \"internal\",\n message: \"custom.anon_token_issue returned no token, which it cannot do — it either mints one or raises.\",\n hint: \"Nothing was issued. Do not retry blindly: something between this client and the store changed the answer's shape.\",\n });\n }\n return ok(pair);\n },\n\n async anonTokenVerify({ secret, origin, requiredMode }) {\n const answered = await callDoor<AnonTokenBinding[]>(\n DOORS.anonTokenVerify,\n { p_secret: secret, p_origin: origin, p_required_mode: requiredMode ?? null },\n \"anonTokenVerify\",\n );\n if (!answered.ok) return answered;\n const binding = answered.data[0];\n if (!binding) {\n return err({\n code: \"internal\",\n message: \"custom.anon_token_verify returned no binding, which it cannot do — it either answers or raises.\",\n hint: \"Treat this as unverified. It is reported rather than read as 'not valid', because those are different sentences.\",\n });\n }\n return ok(binding);\n },\n\n async anonTokenRevoke({ token_id }) {\n return callDoor<boolean>(\n DOORS.anonTokenRevoke,\n { p_organization_id: org, p_token_id: token_id },\n \"anonTokenRevoke\",\n );\n },\n\n async anonWrite({ secret, origin, payload, clientKey, rawPayload }) {\n // No `p_organization_id`: the TOKEN supplies the organization. A stranger\n // naming one would be choosing which tenant to write into.\n return callDoor<Uuid>(\n DOORS.anonWrite,\n {\n p_secret: secret,\n p_origin: origin,\n p_payload: payload,\n p_client_key: clientKey ?? null,\n p_raw_payload: rawPayload ?? {},\n },\n \"anonWrite\",\n );\n },\n\n async anonCapture({ table_id, clientKey, payload, device, capturedAt }) {\n return callDoor<Uuid>(\n DOORS.anonCapture,\n {\n p_organization_id: org,\n p_client_key: clientKey,\n p_table_id: table_id,\n p_payload: payload,\n p_device: device ?? null,\n p_captured_at: capturedAt ?? null,\n },\n \"anonCapture\",\n );\n },\n\n async anonPublish({ form_id, published = true }) {\n return callDoor<Timestamp | null>(\n DOORS.anonPublish,\n { p_organization_id: org, p_form_id: form_id, p_published: published },\n \"anonPublish\",\n );\n },\n\n // ── work ─────────────────────────────────────────────────────────────\n async workStates() {\n return callDoor<WorkState[]>(DOORS.workStates, {}, \"workStates\");\n },\n\n async workTemplateRefusal({ graph }) {\n return callDoor<string | null>(DOORS.workTemplateRefusal, { p_graph: graph }, \"workTemplateRefusal\");\n },\n\n async workTemplateDeclare({ name, graph }) {\n return callDoor<Uuid>(\n DOORS.workTemplateDeclare,\n { p_organization_id: org, p_name: name, p_graph: graph },\n \"workTemplateDeclare\",\n );\n },\n\n async workTemplateInstantiate({ template_id, overrides }) {\n return callDoor<WorkInstantiation>(\n DOORS.workTemplateInstantiate,\n { p_organization_id: org, p_template_id: template_id, p_overrides: overrides ?? {} },\n \"workTemplateInstantiate\",\n );\n },\n\n async workTemplateShape({ template_id }) {\n return callDoor<unknown>(\n DOORS.workTemplateShape,\n { p_organization_id: org, p_template_id: template_id },\n \"workTemplateShape\",\n );\n },\n\n async workInstantiationShape({ instantiation_id }) {\n return callDoor<unknown>(\n DOORS.workInstantiationShape,\n { p_organization_id: org, p_instantiation_id: instantiation_id },\n \"workInstantiationShape\",\n );\n },\n\n async workWhoseTurn({ table_id, includeFinished = false }) {\n return callDoor<WorkTurn[]>(\n DOORS.workWhoseTurn,\n { p_organization_id: org, p_table_id: table_id, p_include_finished: includeFinished },\n \"workWhoseTurn\",\n );\n },\n\n async workHasAssignment({ table_id }) {\n return callDoor<boolean>(\n DOORS.workHasAssignment,\n { p_organization_id: org, p_table_id: table_id },\n \"workHasAssignment\",\n );\n },\n\n async workAssignmentFields(args) {\n return callDoor<WorkAssignmentField[]>(\n DOORS.workAssignmentFields,\n { p_options_table_id: args?.options_table_id ?? null },\n \"workAssignmentFields\",\n );\n },\n\n async workTakeAssignment({ table_id }) {\n return callDoor<unknown>(\n DOORS.workTakeAssignment,\n { p_organization_id: org, p_table_id: table_id },\n \"workTakeAssignment\",\n );\n },\n\n async workTransitionRefusal({ from_state_id, to_state_id }) {\n return callDoor<string | null>(\n DOORS.workTransitionRefusal,\n { p_organization_id: org, p_from_state_id: from_state_id, p_to_state_id: to_state_id },\n \"workTransitionRefusal\",\n );\n },\n\n async workSlotsDeclare({ name, slug, homeId }) {\n return callDoor<unknown>(\n DOORS.workSlotsDeclare,\n { p_organization_id: org, p_name: name, p_slug: slug, p_home_id: homeId ?? null },\n \"workSlotsDeclare\",\n );\n },\n\n async workSlotHold({ table_id, slotKey, holder, ttl }) {\n return callDoor<unknown>(\n DOORS.workSlotHold,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_slot_key: slotKey,\n p_holder: holder,\n ...(ttl ? { p_ttl: ttl } : {}),\n },\n \"workSlotHold\",\n );\n },\n\n async workSlotRelease({ hold_id }) {\n return callDoor<boolean>(\n DOORS.workSlotRelease,\n { p_organization_id: org, p_hold_id: hold_id },\n \"workSlotRelease\",\n );\n },\n\n async workSlotHolds({ table_id }) {\n return callDoor<WorkSlotHold[]>(\n DOORS.workSlotHolds,\n { p_organization_id: org, p_table_id: table_id },\n \"workSlotHolds\",\n );\n },\n\n async workSlotExpire({ table_id }) {\n return callDoor<number>(\n DOORS.workSlotExpire,\n { p_organization_id: org, p_table_id: table_id },\n \"workSlotExpire\",\n );\n },\n\n // ── checklists and SOP runs ──────────────────────────────────────────\n async checklistRefusal({ spec }) {\n return callDoor<string | null>(\n DOORS.checklistRefusal,\n { p_spec: spec },\n \"checklistRefusal\",\n );\n },\n\n async checklistDeclare({ spec, template_id = null }) {\n return callDoor<ChecklistDeclared>(\n DOORS.checklistDeclare,\n { p_organization_id: org, p_spec: spec, p_template_id: template_id },\n \"checklistDeclare\",\n );\n },\n\n async checklistTemplates(args) {\n return callDoor<ChecklistTemplateSummary[]>(\n DOORS.checklistTemplates,\n {\n p_organization_id: org,\n p_about_table_id: args?.about_table_id ?? null,\n p_limit: args?.limit ?? 100,\n },\n \"checklistTemplates\",\n );\n },\n\n async checklistTemplateShape({ template_id }) {\n return callDoor<ChecklistTemplateShape>(\n DOORS.checklistTemplateShape,\n { p_organization_id: org, p_template_id: template_id },\n \"checklistTemplateShape\",\n );\n },\n\n async checklistStart({ template_id, about_record_id = null, roles = {}, startingAt = null }) {\n return callDoor<ChecklistRunStarted>(\n DOORS.checklistStart,\n {\n p_organization_id: org,\n p_template_id: template_id,\n p_about_record_id: about_record_id,\n p_roles: roles,\n p_starting_at: startingAt,\n },\n \"checklistStart\",\n );\n },\n\n async checklistRun({ run_id }) {\n return callDoor<ChecklistRunStep[]>(\n DOORS.checklistRun,\n { p_organization_id: org, p_run_id: run_id },\n \"checklistRun\",\n );\n },\n\n async checklistRuns(args) {\n return callDoor<ChecklistRunSummary[]>(\n DOORS.checklistRuns,\n {\n p_organization_id: org,\n p_about_table_id: args?.about_table_id ?? null,\n p_about_record_id: args?.about_record_id ?? null,\n p_include_closed: args?.includeClosed ?? true,\n p_limit: args?.limit ?? 100,\n },\n \"checklistRuns\",\n );\n },\n\n async checklistStepComplete({ step_id, evidence = {} }) {\n return callDoor<ChecklistStepCompleted>(\n DOORS.checklistStepComplete,\n { p_organization_id: org, p_step_id: step_id, p_evidence: evidence },\n \"checklistStepComplete\",\n );\n },\n\n async checklistStepRefusal({ step_id }) {\n return callDoor<string | null>(\n DOORS.checklistStepRefusal,\n { p_organization_id: org, p_step_id: step_id },\n \"checklistStepRefusal\",\n );\n },\n\n // ── the work layer a person actually uses ────────────────────────────\n async workInbox(args) {\n return callDoor<WorkInboxItem[]>(\n DOORS.workInbox,\n {\n p_organization_id: org,\n p_limit: args?.limit ?? 50,\n p_offset: args?.offset ?? 0,\n p_include_decided: args?.includeDecided ?? false,\n },\n \"workInbox\",\n );\n },\n\n async workList(args) {\n return callDoor<WorkListItem[]>(\n DOORS.workList,\n {\n p_organization_id: org,\n p_flavour: args?.flavour ?? \"mine\",\n p_include_finished: args?.includeFinished ?? false,\n p_limit: args?.limit ?? 100,\n p_offset: args?.offset ?? 0,\n },\n \"workList\",\n );\n },\n\n async workAssign({ record_id, user_id = null, dueDate = null, clearDue = false }) {\n return callDoor<WorkAssignment>(\n DOORS.workAssign,\n {\n p_organization_id: org,\n p_record_id: record_id,\n p_assignee_user_id: user_id,\n p_due_date: dueDate,\n p_clear_due: clearDue,\n },\n \"workAssign\",\n );\n },\n\n async workRecordStates({ record_id }) {\n return callDoor<WorkRecordState[]>(\n DOORS.workRecordStates,\n { p_organization_id: org, p_record_id: record_id },\n \"workRecordStates\",\n );\n },\n\n async workSetState({ record_id, state_id }) {\n return callDoor<unknown>(\n DOORS.workSetState,\n { p_organization_id: org, p_record_id: record_id, p_state_id: state_id },\n \"workSetState\",\n );\n },\n\n async workPerson({ user_id, create = true }) {\n return callDoor<Uuid | null>(\n DOORS.workPerson,\n { p_organization_id: org, p_user_id: user_id, p_create: create },\n \"workPerson\",\n );\n },\n\n async workTemplates(args) {\n return callDoor<Array<{\n template_id: Uuid;\n name: string;\n nodes: number;\n relations: number;\n created_at: string;\n }>>(\n DOORS.workTemplates,\n { p_organization_id: org, p_limit: args?.limit ?? 100 },\n \"workTemplates\",\n );\n },\n\n async workApprovalApprovers({ subject_id, approver_id = null }) {\n return callDoor<WorkApprover[]>(\n DOORS.workApprovalApprovers,\n { p_organization_id: org, p_subject_id: subject_id, p_approver_id: approver_id },\n \"workApprovalApprovers\",\n );\n },\n\n async workApprovalRequest({\n subject_id,\n change,\n note = null,\n approver_id = null,\n origin = \"person\",\n conversation_id = null,\n }) {\n return callDoor<WorkApprovalFiled>(\n DOORS.workApprovalRequest,\n {\n p_organization_id: org,\n p_subject_id: subject_id,\n p_change: change,\n p_note: note,\n p_approver_id: approver_id,\n p_origin: origin,\n p_conversation_id: conversation_id,\n },\n \"workApprovalRequest\",\n );\n },\n\n async workApprovalMayDecide({ approval_id }) {\n return callDoor<boolean>(\n DOORS.workApprovalMayDecide,\n { p_organization_id: org, p_approval_id: approval_id },\n \"workApprovalMayDecide\",\n );\n },\n\n async workApprovalDecide({ approval_id, approve, note = null }) {\n return callDoor<WorkApprovalDecision>(\n DOORS.workApprovalDecide,\n {\n p_organization_id: org,\n p_approval_id: approval_id,\n p_approve: approve,\n p_note: note,\n },\n \"workApprovalDecide\",\n );\n },\n\n async workApprovalRead({ approval_id }) {\n return callDoor<Record<string, unknown>>(\n DOORS.workApprovalRead,\n { p_organization_id: org, p_approval_id: approval_id },\n \"workApprovalRead\",\n );\n },\n\n // ── the trust doors ──────────────────────────────────────────────────\n async isExternalPrincipal(args) {\n return trustDoor<boolean>(\n TRUST_DOORS.isExternalPrincipal,\n { p_user_id: args?.user_id ?? null },\n \"isExternalPrincipal\",\n );\n },\n\n async externalPrincipalCard(args) {\n return trustDoor<ExternalPrincipalCard>(\n TRUST_DOORS.externalPrincipalCard,\n { p_user_id: args?.user_id ?? null },\n \"externalPrincipalCard\",\n );\n },\n\n async externalPrincipalReach({ resourceType, user_id }) {\n return trustDoor<Array<{ resource_id: Uuid }>>(\n TRUST_DOORS.externalPrincipalReach,\n { p_resource_type: resourceType, p_user_id: user_id ?? null },\n \"externalPrincipalReach\",\n );\n },\n\n async publishBindingCreate({ slug, resourceType, resource_id, renderMode = \"page\" }) {\n return trustDoor<PublishBinding>(\n TRUST_DOORS.publishBindingCreate,\n {\n p_slug: slug,\n p_resource_type: resourceType,\n p_resource_id: resource_id,\n p_organization_id: org,\n p_render_mode: renderMode,\n },\n \"publishBindingCreate\",\n );\n },\n\n async publishBindingRevoke({ slug }) {\n return trustDoor<unknown>(TRUST_DOORS.publishBindingRevoke, { p_slug: slug }, \"publishBindingRevoke\");\n },\n\n async resolvePublishBinding({ slug }) {\n return trustDoor<ResolvedPublishBinding[]>(\n TRUST_DOORS.resolvePublishBinding,\n { p_slug: slug },\n \"resolvePublishBinding\",\n );\n },\n\n async worldPublishGapNotice() {\n return trustDoor<string>(TRUST_DOORS.worldPublishGapNotice, {}, \"worldPublishGapNotice\");\n },\n\n async publishToWorld({ resourceType, resource_id, discoverable = false }) {\n return trustDoor<unknown>(\n TRUST_DOORS.publishToWorld,\n {\n p_resource_type: resourceType,\n p_resource_id: resource_id,\n p_organization_id: org,\n p_discoverable: discoverable,\n },\n \"publishToWorld\",\n );\n },\n\n async ruleDeclare({ spec, rule_id }) {\n // THE DOOR LANDED (lane FORMS, 2026-09-20). This used to be a refusing\n // stub, and the refusal was right: until `custom.rule_declare` existed\n // there was NO way to write a Rule that the store's own rule doors could\n // see, and pretending otherwise would have been the silent failure the\n // comment on the interface describes.\n return callDoor<Uuid>(\n DOORS.ruleDeclare,\n { p_organization_id: org, p_spec: spec, p_rule_id: rule_id ?? null },\n \"ruleDeclare\",\n );\n },\n\n async metadataSearch() {\n const refusal = doorAbsent(DOORS.metadataSearch);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"metadataSearch\" });\n return err(refusal);\n },\n\n async fieldPropose() {\n const refusal = doorAbsent(DOORS.fieldPropose);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"fieldPropose\" });\n return err(refusal);\n },\n\n async tablePropose() {\n const refusal = doorAbsent(DOORS.tablePropose);\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"tablePropose\" });\n return err(refusal);\n },\n\n async promoteTable({ table_id }) {\n return callDoor<unknown>(\n DOORS.promoteTable,\n { p_organization_id: org, p_table_id: table_id },\n \"promoteTable\",\n );\n },\n\n async promoteField({ table_id, field_id }) {\n return callDoor<unknown>(\n DOORS.promoteField,\n { p_organization_id: org, p_table_id: table_id, p_field_id: field_id },\n \"promoteField\",\n );\n },\n\n async storeIsOpen() {\n return callDoor<boolean>(DOORS.storeIsOpen, { p_organization_id: org }, \"storeIsOpen\");\n },\n\n // ── THE GRID (lane GRID-PRIMITIVES) ──────────────────────────────────────\n async tableDecorate({ table_id, path, value }) {\n return callDoor<TableDecorations>(\n DOORS.tableDecorate,\n { p_organization_id: org, p_table_id: table_id, p_path: path, p_value: value ?? null },\n \"tableDecorate\",\n );\n },\n\n async tableDecorations({ table_id }) {\n return callDoor<TableDecorations>(\n DOORS.tableDecorations,\n { p_organization_id: org, p_table_id: table_id },\n \"tableDecorations\",\n );\n },\n\n async gridLayout({ table_id, view_id }) {\n return callDoor<GridLayout>(\n DOORS.gridLayout,\n { p_organization_id: org, p_table_id: table_id, p_view_id: view_id ?? null },\n \"gridLayout\",\n );\n },\n\n async formulaParse({ table_id, text }) {\n return callDoor<FormulaParse>(\n DOORS.formulaParse,\n { p_organization_id: org, p_table_id: table_id, p_text: text },\n \"formulaParse\",\n );\n },\n\n async actionDeclare({ table_id, actions }) {\n return callDoor<RowAction[]>(\n DOORS.actionDeclare,\n { p_organization_id: org, p_table_id: table_id, p_actions: actions },\n \"actionDeclare\",\n );\n },\n\n async rowActions({ table_id }) {\n return callDoor<{ actions: RowAction[]; stale: unknown[] }>(\n DOORS.rowActions,\n { p_organization_id: org, p_table_id: table_id },\n \"rowActions\",\n );\n },\n\n async actionRun({ action_id, record_ids }) {\n return callDoor<ActionRunResult>(\n DOORS.actionRun,\n { p_organization_id: org, p_action_id: action_id, p_record_ids: record_ids },\n \"actionRun\",\n );\n },\n\n async tableWebhookDeclare({ table_id, target_url, events, description }) {\n return callDoor<TableWebhookDeclared>(\n DOORS.tableWebhookDeclare,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_target_url: target_url,\n p_events: events ?? null,\n p_description: description ?? null,\n },\n \"tableWebhookDeclare\",\n );\n },\n\n async tableWebhooks({ table_id }) {\n return callDoor<TableWebhook[]>(\n DOORS.tableWebhooks,\n { p_organization_id: org, p_table_id: table_id },\n \"tableWebhooks\",\n );\n },\n\n async tableWebhookArchive({ webhook_id }) {\n return callDoor<boolean>(\n DOORS.tableWebhookArchive,\n { p_organization_id: org, p_webhook_id: webhook_id },\n \"tableWebhookArchive\",\n );\n },\n\n async tableFromExample({ home_id, useCaseId }) {\n // The use case is loaded from this package's own library — the one place real template\n // data lives — so a screen can only offer an example that library carries.\n const { loadUseCase } = await import(\"../use-cases/registry\");\n let spec;\n try {\n spec = exampleSpec(await loadUseCase(useCaseId));\n } catch (e) {\n const refusal: RecordsError = {\n code: \"invalid_argument\",\n message: e instanceof Error ? e.message : String(e),\n hint: \"Offer an example from useCaseIds() in @ai-matrx/records/use-cases. Nothing was created.\",\n };\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"tableFromExample\" });\n return err(refusal);\n }\n return callDoor<ExampleBuilt>(\n DOORS.tableFromExample,\n { p_organization_id: org, p_home_id: home_id, p_example: spec },\n \"tableFromExample\",\n );\n },\n\n async autonumberBackfill({ field_id }) {\n return callDoor<{ numbered: number; highest: number | null; says: string }>(\n DOORS.autonumberBackfill,\n { p_organization_id: org, p_field_id: field_id },\n \"autonumberBackfill\",\n );\n },\n\n async ioExport({ table_id, columns, limit }) {\n return callDoor<IoExportPage>(\n DOORS.ioExport,\n {\n p_organization_id: org,\n p_table_id: table_id,\n p_columns: columns ?? null,\n p_limit: limit ?? null,\n p_required: \"viewer\",\n },\n \"ioExport\",\n );\n },\n\n async exportXlsx({ table_id, columns, limit, labels, sheetLabel }) {\n const page = await client.ioExport({\n table_id,\n ...(columns !== undefined ? { columns } : {}),\n ...(limit !== undefined ? { limit } : {}),\n });\n if (!page.ok) return err(page.error);\n return ok(await exportPageXlsx(page.data, labels ?? {}, sheetLabel ?? \"Records\"));\n },\n\n async myLevels({ ids, subject }) {\n if (ids.length === 0) return ok([]);\n const answered = await callDoor<Array<{ id: Uuid; level: string | null }>>(\n DOORS.myLevels,\n { p_organization_id: org, p_ids: ids, p_type: subject ?? \"record\" },\n \"myLevels\",\n );\n if (!answered.ok) return err(answered.error);\n return ok(\n (answered.data ?? []).map((row) => ({ id: row.id, level: asPermissionLevel(row.level) })),\n );\n },\n };\n\n return client;\n}\n\n/**\n * Turn a refusal into the conflict a screen can SHOW: which version you wrote\n * against, which one won, and every field you touched as it stands now. Returns\n * null when the refusal was not a stale write.\n */\nexport function asWriteConflict(error: RecordsError, recordId: Uuid): WriteConflict | null {\n const detail = staleWriteDetail(error);\n if (!detail) return null;\n return {\n ...detail,\n record_id: recordId,\n message: error.message,\n hint: error.hint ?? \"\",\n };\n}\n","// src/core/supabase.ts — @ai-matrx/records (HEADLESS)\n//\n// THE ONE ADAPTER FROM A SUPABASE CLIENT TO THIS PACKAGE'S DATA SEAM.\n//\n// Why it exists, and what it cost to learn (2026-09-19, the independent verdict\n// on /data-v2): `RecordsDataSource.rpc(fn, args, { schema })` says the schema\n// out loud, because every door of this store is `custom.<name>` and every door\n// of the trust layer is `iam.<name>`. supabase-js's own\n// `rpc(fn, args, options)` HAS NO `schema` OPTION — its third argument is\n// `{ head, get, count }`, and an unknown key is dropped in silence. So a\n// supabase client handed straight to `config.dataSource` as a structural cast\n// asked its default PostgREST profile, `public`, for every door, and the store\n// answered correctly and uselessly:\n//\n// PGRST202 — Could not find the function public.table_kernel_id(...) in the\n// schema cache\n//\n// Every screen in the record store was dead from a browser because of it, while\n// the desktop app and the browser extension each grew their own way of asking.\n// The class fix is ONE adapter, here, in the headless core, that every host\n// inherits — never three hosts remembering the same thing.\n//\n// The schema is chosen the ONE way supabase-js offers: `client.schema(name)`\n// returns a client bound to that PostgREST profile (it sets the\n// `Accept-Profile` / `Content-Profile` headers), and `.rpc()` on THAT is the\n// call. There is no per-call option that does it.\n//\n// This file holds no key and opens no connection: the host hands in a client\n// that already carries the operating person's session, which is what makes\n// DOOR-5 and AGT-N-4 true — the store sees the person, not us.\n\nimport type { PgError } from \"../results\";\nimport type { RecordsDataSource } from \"../ports\";\n\n/**\n * The structural shape of the supabase client this adapter needs. Deliberately\n * NOT `SupabaseClient<Database>`: a generated `Database` type makes\n * `schema().from().select()` enormous, and a host app that passed its typed\n * client in got `TS2589: Type instantiation is excessively deep and possibly\n * infinite` in its own build (matrx-frontend, 2026-09-18, on all three campaign\n * routes at once). The cast lives here, once, where it is explained.\n */\nexport interface SupabaseLike {\n schema(name: string): {\n rpc(\n fn: string,\n args?: Record<string, unknown>,\n ): PromiseLike<{ data: unknown; error: PgError | null }>;\n from(table: string): unknown;\n };\n}\n\n/** The refusal a caller sees rather than a silent call to the wrong schema. */\nfunction refuse(code: string, message: string, hint: string): { data: null; error: PgError } {\n return { data: null, error: { code, message, hint, details: \"\" } as unknown as PgError };\n}\n\n/**\n * Bind a supabase-js client (or anything with the same `schema(name).rpc()`\n * shape) as this package's data seam.\n *\n * Two things never happen here, both of them loudly:\n *\n * - A call with NO schema is never sent. It is refused by name, because\n * sending it would reach `public` and get the store's PGRST202 several\n * layers away from the mistake.\n * - A client with no `.schema()` is never used. supabase-js has had it since\n * v2.0; a host that binds something else is told exactly what is missing\n * instead of throwing `undefined is not a function` inside a render.\n */\nexport function supabaseDataSource(client: object): RecordsDataSource {\n const supabase = client as unknown as Partial<SupabaseLike>;\n const hasSchema = typeof supabase.schema === \"function\";\n\n return {\n rpc(fn, args, options) {\n if (!hasSchema) {\n return Promise.resolve(\n refuse(\n \"data_source_unbound\",\n `The records client was given something that is not a supabase client: it has no schema() ` +\n `method, so the door ${fn} cannot be called in the schema it lives in.`,\n \"Pass a supabase-js v2 client (createClient(...)) to supabaseDataSource().\",\n ),\n );\n }\n const name = options?.schema;\n if (!name) {\n return Promise.resolve(\n refuse(\n \"schema_unsaid\",\n `The door ${fn} was called without saying which schema it lives in. ` +\n `Every door of this store is custom.${fn} and every trust door is iam.${fn}; ` +\n `an unqualified call reaches PostgREST's default profile (public) and is refused there.`,\n \"This is a bug in the caller, not in your data: /core says the schema on every call.\",\n ),\n );\n }\n return (supabase as SupabaseLike).schema(name).rpc(fn, args) as ReturnType<\n RecordsDataSource[\"rpc\"]\n >;\n },\n schema(name) {\n return (supabase as SupabaseLike).schema(name) as ReturnType<RecordsDataSource[\"schema\"]>;\n },\n };\n}\n","// src/core/validation.ts — @ai-matrx/records\n//\n// THE MIRROR. It predicts ONLY what the store's own triggers will refuse, and it\n// says it in the store's own words.\n//\n// Read this next sentence before changing anything here: THIS IS NOT\n// VALIDATION. The store validates. `custom.validate_values`,\n// `custom.validate_value_envelope` and `custom.size_refusal` are the truth, they\n// run inside the write door, and they cannot be bypassed by a client. What this\n// module buys is the half-second between a person typing and a round trip — it\n// tells a form what the store is ABOUT to say, so the form can say it first.\n//\n// Two rules keep it honest:\n// 1. Every prediction names the store body that would raise it\n// (`predicted_by`), so the next reader can go and check.\n// 2. A prediction the store would NOT make is a defect, and so is a message\n// that differs from the store's by one word. The real-door suite plants\n// each of these against the live store and compares the sentences.\n//\n// Where the mirror cannot see — option membership, relation targets, anything\n// that needs a query — it says nothing at all and lets the door answer. Silence\n// here means \"ask the store\", never \"it is fine\".\n\nimport type { Field, FieldRule } from \"../field\";\nimport type { RecordDocument, ValueEnvelope } from \"../record\";\nimport type { PredictedRefusal } from \"../results\";\nimport {\n ABSENCE_REASONS,\n PER_VALUE_ACCESS_WORDS,\n VALUE_ALTERNATE_KEYS,\n VALUE_ENVELOPE_KEYS,\n} from \"../store.generated\";\n\n/** The published defaults, which are also what the store falls back to when it cannot read a knob. */\nexport const DEFAULT_VALUE_MAX_BYTES = 100_000;\nexport const DEFAULT_DOCUMENT_MAX_BYTES = 1_048_576;\n\nexport interface MirrorLimits {\n value_max_bytes?: number;\n document_max_bytes?: number;\n}\n\nconst jsonType = (value: unknown): string => {\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"array\";\n switch (typeof value) {\n case \"string\":\n return \"string\";\n case \"number\":\n return \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"object\":\n return \"object\";\n default:\n return \"null\";\n }\n};\n\n/**\n * `octet_length(x::text)` — the store measures the JSONB TEXT, and jsonb does\n * not render the way `JSON.stringify` does: it puts a space after every `:` and\n * every `,`. On an 18-key document that is 35 bytes the mirror used to miss, and\n * the real-door suite caught it by holding the two sentences side by side\n * (\"this record is 1080242 bytes\" vs the mirror's 1080207). So the mirror\n * renders the way Postgres does.\n */\nfunction pgJsonbText(value: unknown): string {\n if (value === null || value === undefined) return \"null\";\n if (Array.isArray(value)) return `[${value.map(pgJsonbText).join(\", \")}]`;\n if (typeof value === \"object\") {\n // jsonb keeps the LAST of duplicate keys and drops nothing else; an object\n // literal in TypeScript cannot carry duplicates, so entries are the set.\n const parts = Object.entries(value as Record<string, unknown>).map(\n ([k, v]) => `${JSON.stringify(k)}: ${pgJsonbText(v)}`,\n );\n return `{${parts.join(\", \")}}`;\n }\n return JSON.stringify(value);\n}\n\nconst jsonBytes = (value: unknown): number => new TextEncoder().encode(pgJsonbText(value)).length;\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * `custom.validate_values`. The label the store uses is the Field's label, or\n * its key when the label is empty — the same `coalesce(nullif(...))`.\n */\nfunction labelOf(field: Field): string {\n return field.label && field.label.length > 0 ? field.label : field.key;\n}\n\nfunction ruleRefusal(\n field: Field,\n rule: FieldRule,\n item: unknown,\n values: Record<string, unknown>,\n): PredictedRefusal | null {\n const label = labelOf(field);\n const base = { sqlstate: \"23514\", predicted_by: \"custom.validate_values\", field_key: field.key };\n const num = typeof item === \"number\" ? item : null;\n switch (rule.kind) {\n case \"min\":\n if (num !== null && num < Number(rule.value)) {\n return { ...base, message: `${label} has to be at least ${rule.value}`, hint: \"FLD-3: an attached validation Rule, not a behavior.\" };\n }\n return null;\n case \"max\":\n if (num !== null && num > Number(rule.value)) {\n return { ...base, message: `${label} cannot be more than ${rule.value}`, hint: \"FLD-3: an attached validation Rule, not a behavior.\" };\n }\n return null;\n case \"length\":\n if (typeof item !== \"string\") return null;\n if (rule.value !== undefined && rule.value !== null && rule.value !== \"\" && item.length > Number(rule.value)) {\n return { ...base, message: `${label} is longer than ${rule.value} characters`, hint: \"FLD-3.\" };\n }\n // STORE-RULE-GAPS: the shortest. A blank is `required`'s question.\n if (typeof rule.min === \"number\" && item !== \"\" && item.length < rule.min) {\n return {\n ...base,\n message: `${label} has to be at least ${rule.min} characters long`,\n hint: \"FLD-3.\",\n detail: { field_key: field.key, rule: \"length\", min: rule.min },\n };\n }\n return null;\n case \"pattern\":\n if (typeof item === \"string\" && !new RegExp(String(rule.value)).test(item)) {\n const example = typeof rule.example === \"string\" ? rule.example.trim() : \"\";\n if (example !== \"\") {\n return {\n ...base,\n message: `${label} is not written the way this field expects`,\n hint: `Enter it like ${example}.`,\n detail: { field_key: field.key, rule: \"pattern\", example },\n };\n }\n return { ...base, message: `${label} is not written the way this field expects`, hint: \"FLD-3.\" };\n }\n return null;\n case \"equals_field\": {\n const other = values[String(rule.value)];\n if (other !== undefined && other !== null && JSON.stringify(other) !== JSON.stringify(item)) {\n return {\n ...base,\n message: `${label} and ${rule.value} have to be the same`,\n hint: \"FLD-3 / T8: a constraint across two fields is a Rule attached to one of them, never a behavior.\",\n };\n }\n return null;\n }\n case \"differs_from_field\": {\n const other = values[String(rule.value)];\n if (other !== undefined && JSON.stringify(other) === JSON.stringify(item)) {\n return { ...base, message: `${label} and ${rule.value} have to be different`, hint: \"FLD-3.\" };\n }\n return null;\n }\n default:\n return null;\n }\n}\n\n/**\n * Predict `custom.validate_values`. Everything it checks WITHOUT a query is\n * mirrored; option membership and relation targets are deliberately left to the\n * door, and the mirror says nothing about them.\n */\nexport function predictValueRefusals(\n fields: Field[],\n values: Record<string, unknown>,\n recordType?: string,\n): PredictedRefusal[] {\n const found: PredictedRefusal[] = [];\n for (const field of fields) {\n const label = labelOf(field);\n const base = { sqlstate: \"23514\", predicted_by: \"custom.validate_values\", field_key: field.key };\n const raw = values[field.key];\n const isEmpty =\n raw === undefined ||\n raw === null ||\n (field.multi && Array.isArray(raw) && raw.length === 0);\n\n if (isEmpty) {\n if (field.required) {\n found.push({\n ...base,\n message: `${label} is required`,\n hint: `REC-51: the field ${field.key} of this table.`,\n });\n }\n continue;\n }\n\n if (field.type === \"formula\") {\n found.push({\n ...base,\n message: `${label} is worked out by the system, so it cannot be typed in`,\n hint: `FLD-9: this formula computes on ${field.compute_on ?? \"write\"}.`,\n });\n continue;\n }\n\n let items: unknown[];\n if (field.multi) {\n if (!Array.isArray(raw)) {\n found.push({ ...base, message: `${label} holds many values, so it takes a list`, hint: \"FLD-2: the multi modifier.\" });\n continue;\n }\n items = raw;\n } else {\n if (Array.isArray(raw)) {\n found.push({ ...base, message: `${label} holds one value, and it was given a list`, hint: \"FLD-2: multi is off for this field.\" });\n continue;\n }\n items = [raw];\n }\n\n for (const item of items) {\n if (field.type === \"text\" && typeof item !== \"string\") {\n found.push({ ...base, message: `${label} takes words, and it was given a ${jsonType(item)}`, hint: \"FLD-1: text.\" });\n } else if (field.type === \"range\") {\n const kind = (field.config?.[\"kind\"] as string | undefined) ?? \"number\";\n if (typeof item === \"number\") {\n /* fine */\n } else if (typeof item === \"string\" && (kind === \"date\" || kind === \"datetime\")) {\n if (Number.isNaN(Date.parse(item))) {\n found.push({ ...base, message: `${label} takes a date, and ${item} is not one`, hint: \"FLD-1: range, of kind date.\" });\n }\n } else {\n found.push({ ...base, message: `${label} takes a number, and it was given a ${jsonType(item)}`, hint: \"FLD-1: range.\" });\n }\n } else if (field.type === \"list\") {\n if (typeof item !== \"string\") {\n found.push({\n ...base,\n message: `${label} takes one of its choices, and it was given a ${jsonType(item)}`,\n hint: \"FLD-5 / FLD-6: a list field stores the id of the option RECORD, because every pick-list is already a Table.\",\n });\n }\n // MEMBERSHIP needs the store: the mirror stops here on purpose. A list\n // cell holds the option's KEY (CHOICE-VALUE) and the door also takes its\n // label or id, so no shape of string is predictably wrong here — and a\n // column that takes other values (STORE-RULE-GAPS `allow_other`) ADDS an\n // unknown word. This used to refuse every value that was not a uuid,\n // which the store has not required since option keys landed.\n } else if (field.type === \"relation\") {\n if (typeof item !== \"string\") {\n found.push({ ...base, message: `${label} points at a record, and it was given a ${jsonType(item)}`, hint: \"FLD-1: relation.\" });\n } else if (!UUID.test(item)) {\n found.push({\n ...base,\n message: `${label} points at something that is not there`,\n hint: `REC-51: ${label} stores the id of a record, and what it was given is not an id at all.`,\n });\n }\n // EXISTENCE needs the store: the mirror stops here on purpose.\n }\n\n for (const rule of field.rules ?? []) {\n const applies =\n !rule.applies_to_types ||\n rule.applies_to_types.length === 0 ||\n (recordType !== undefined && rule.applies_to_types.includes(recordType));\n if (!applies) continue;\n const refusal = ruleRefusal(field, rule, item, values);\n if (refusal) found.push(refusal);\n }\n }\n\n if (field.type === \"relation\" && field.multi && field.relation_max !== null) {\n const n = items.length;\n if (n > field.relation_max) {\n found.push({\n ...base,\n message: `${label} points at ${n} things, and it can point at ${field.relation_max} at most`,\n hint: \"REC-51: relation_max.\",\n });\n }\n }\n }\n return found;\n}\n\n/** Predict `custom.size_refusal`, with the same two ceilings and the same sentences. */\nexport function predictSizeRefusal(\n document: RecordDocument,\n limits: MirrorLimits = {},\n): PredictedRefusal | null {\n const valueMax = limits.value_max_bytes ?? DEFAULT_VALUE_MAX_BYTES;\n const docMax = limits.document_max_bytes ?? DEFAULT_DOCUMENT_MAX_BYTES;\n for (const [key, value] of Object.entries(document)) {\n if (key.startsWith(\"_\")) continue;\n const bytes = jsonBytes(value);\n if (bytes > valueMax) {\n return {\n field_key: key,\n sqlstate: \"23514\",\n predicted_by: \"custom.size_refusal\",\n message:\n `${key} is ${bytes} bytes, and one value in a record holds at most ${valueMax}. ` +\n `Put the big thing in a file record and point the value at it - this store has a File table for exactly that.`,\n };\n }\n }\n const total = jsonBytes(document);\n if (total > docMax) {\n return {\n sqlstate: \"23514\",\n predicted_by: \"custom.size_refusal\",\n message:\n `this record is ${total} bytes, and one record holds at most ${docMax}. ` +\n `Put the big things in file records and point the values at them - this store has a File table for exactly that.`,\n };\n }\n return null;\n}\n\n/**\n * Predict `custom.value_envelope_refusal`. The store returns the FIRST problem\n * it finds and stops; so does this, key order included, so the two agree on\n * which sentence a person sees.\n */\nexport function predictEnvelopeRefusal(document: RecordDocument): PredictedRefusal | null {\n const say = (message: string): PredictedRefusal => ({\n message,\n sqlstate: \"23514\",\n predicted_by: \"custom.value_envelope_refusal\",\n });\n\n let sources: Record<string, unknown> = {};\n if (Object.prototype.hasOwnProperty.call(document, \"_sources\")) {\n const block = document._sources as unknown;\n if (jsonType(block) !== \"object\") {\n return say(\n `this record's provenance block (_sources) must be an object of pointer -> source, and it is a ${jsonType(block)}.`,\n );\n }\n sources = block as Record<string, unknown>;\n for (const pointer of Object.keys(sources)) {\n if (!/^s[0-9]+$/.test(pointer)) {\n return say(\n `\"${pointer}\" is not a provenance pointer. A pointer is interned by this store and looks like s1, s2, s3 — it is never a name a writer chooses.`,\n );\n }\n if (jsonType(sources[pointer]) !== \"object\") {\n return say(\n `the source at ${pointer} must be an object describing where the value came from, and it is a ${jsonType(sources[pointer])}.`,\n );\n }\n }\n const distinct = new Set(Object.values(sources).map((v) => JSON.stringify(v)));\n if (distinct.size !== Object.keys(sources).length) {\n return say(\n `the same source is written twice in this record's provenance block. A source is interned once per save and every value that came from it points at the one entry.`,\n );\n }\n }\n\n if (!Object.prototype.hasOwnProperty.call(document, \"_values\")) return null;\n const block = document._values as unknown;\n if (jsonType(block) !== \"object\") {\n return say(\n `this record's value block (_values) must be an object of field key -> envelope, and it is a ${jsonType(block)}.`,\n );\n }\n\n for (const [key, envUnknown] of Object.entries(block as Record<string, unknown>)) {\n if (jsonType(envUnknown) !== \"object\") {\n return say(`the envelope for ${key} must be an object, and it is a ${jsonType(envUnknown)}.`);\n }\n const env = envUnknown as Record<string, unknown> & Partial<ValueEnvelope>;\n\n for (const k of Object.keys(env)) {\n if (!(VALUE_ENVELOPE_KEYS as readonly string[]).includes(k)) {\n if ((PER_VALUE_ACCESS_WORDS as readonly string[]).includes(k)) {\n return say(\n `${key} cannot carry \"${k}\": visibility and access belong to a Field and to a Record, never to a single value. A value that must be secret goes in a contained record with its own visibility.`,\n );\n }\n return say(\n `${key} carries \"${k}\", which is not part of a value envelope. An envelope holds ${VALUE_ENVELOPE_KEYS.join(\", \")}.`,\n );\n }\n }\n\n // ver, actor, on_behalf_of and at ARE NOT PREDICTED, and that is not an\n // omission. `custom._value_envelope` runs `custom.stamp_value_envelopes`\n // (which overwrites actor, on_behalf_of and at with the caller's real\n // identity) and `custom.value_versions` (which writes ver) BEFORE\n // `custom.value_envelope_refusal` ever looks. A caller who sends\n // `{\"actor\":\"wizard\"}` or no `ver` at all is not refused — the store simply\n // writes the truth over it. The mirror used to predict a refusal here; the\n // real-door suite planted those five envelopes at the live door, the store\n // accepted every one, and the prediction came out. Silence here is the\n // store's behaviour, not a gap.\n\n if (\"absent\" in env && env.absent !== null) {\n const absent = String(env.absent);\n if (!(ABSENCE_REASONS as readonly string[]).includes(absent)) {\n return say(\n `${key}: \"${absent}\" is not a reason a value can be missing. The reasons are ${ABSENCE_REASONS.join(\", \")}.`,\n );\n }\n if (key in document && document[key] !== null) {\n return say(`${key} both holds a value and says why it is missing (\"${absent}\"). It can be one or the other.`);\n }\n }\n\n if (\"src\" in env && env.src !== null) {\n if (typeof env.src !== \"string\") {\n return say(\n `${key}: its source must be a provenance pointer this store interned. Write the source itself and the store interns it; ${jsonType(env.src)} is not a pointer.`,\n );\n }\n if (!(env.src in sources)) {\n return say(`${key} points at the source ${env.src}, and this record's provenance block has no such entry.`);\n }\n }\n\n if (\"alternates\" in env && env.alternates !== null) {\n if (!Array.isArray(env.alternates)) {\n return say(`${key}: its other candidate values must be a list, and it is a ${jsonType(env.alternates)}.`);\n }\n const ranks: number[] = [];\n for (const altUnknown of env.alternates) {\n if (jsonType(altUnknown) !== \"object\") {\n return say(`${key}: every other candidate is a value, a source and a rank, and one of them is a ${jsonType(altUnknown)}.`);\n }\n const alt = altUnknown as unknown as Record<string, unknown>;\n for (const k of Object.keys(alt)) {\n if (!(VALUE_ALTERNATE_KEYS as readonly string[]).includes(k)) {\n if ((PER_VALUE_ACCESS_WORDS as readonly string[]).includes(k)) {\n return say(\n `${key}: an alternate cannot carry \"${k}\" — visibility and access belong to a Field and to a Record, never to a single value.`,\n );\n }\n return say(\n `${key}: an alternate carries \"${k}\", which is not part of one. An alternate holds ${VALUE_ALTERNATE_KEYS.join(\", \")} — a rank, which is the order an organization's sources are trusted in, and never a score or a confidence a machine invented.`,\n );\n }\n }\n if (!(\"value\" in alt)) {\n return say(`${key}: an alternate with no value is not a candidate for anything.`);\n }\n const rank = alt[\"rank\"];\n if (typeof rank !== \"number\" || !Number.isInteger(rank) || rank < 1) {\n return say(`${key}: every alternate carries a whole rank of 1 or more — the order its source is trusted in.`);\n }\n if (ranks.includes(rank)) {\n return say(`${key}: two alternates claim rank ${rank}. A rank is an order, so it is held by one candidate.`);\n }\n ranks.push(rank);\n if (\"src\" in alt && alt[\"src\"] !== null) {\n if (typeof alt[\"src\"] !== \"string\") {\n return say(`${key}: an alternate's source must be a provenance pointer this store interned, and it is a ${jsonType(alt[\"src\"])}.`);\n }\n if (!(String(alt[\"src\"]) in sources)) {\n return say(`${key}: an alternate points at the source ${String(alt[\"src\"])}, and this record's provenance block has no such entry.`);\n }\n }\n }\n }\n }\n return null;\n}\n\n/** Everything the mirror can see about one write, in the order the store sees it. */\nexport function predictWriteRefusals(args: {\n fields: Field[];\n document: RecordDocument;\n recordType?: string;\n limits?: MirrorLimits;\n}): PredictedRefusal[] {\n const { fields, document, recordType, limits } = args;\n const values: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(document)) {\n if (!k.startsWith(\"_\")) values[k] = v;\n }\n const found: PredictedRefusal[] = [];\n const envelope = predictEnvelopeRefusal(document);\n if (envelope) found.push(envelope);\n const size = predictSizeRefusal(document, limits);\n if (size) found.push(size);\n found.push(...predictValueRefusals(fields, values, recordType));\n return found;\n}\n","// src/core/io.ts — @ai-matrx/records\n//\n// DOOR-11. CSV and XLSX, import and export — headless: bytes in, bytes out, no\n// `document`, no `Blob`, no download. The browser half (the anchor click, the\n// object URL) already exists and is not duplicated here: the design system's\n// `@ai-matrx/design-system/data-table/xlsx` owns it, and `records-ui` hands\n// these bytes to it.\n//\n// The column selection and the cell stringification are the SAME ones the\n// canonical table's CSV export uses (`rowsToCsvFromColumns` in that package):\n// same quoting rule, same header row, same order. Two independent row builders\n// is how a user's CSV and their Excel file start disagreeing.\n//\n// DOOR-4 is why export takes READ VALUES rather than raw rows: exports store\n// only what the reading principal may see, and a ReadValue is what came back\n// THROUGH the read door. Handing this function a row it read around the door\n// would be the leak DOOR-4 forbids, and there is no overload that accepts one.\n\nimport type { Field } from \"../field\";\nimport type { ReadValue } from \"../record\";\n\n/** One exportable row: the values of one record, keyed by field key. */\nexport type ExportRow = Record<string, ReadValue | undefined>;\n\n/** The same escaping the canonical table uses. */\nconst escape = (value: string): string =>\n /[\",\\n\\r]/.test(value) ? `\"${value.replace(/\"/g, '\"\"')}\"` : value;\n\n/**\n * The same stringification: a string stays itself, everything else becomes its\n * JSON, and an absent value becomes the store's own absence WORD rather than an\n * empty cell. A blank cell would be the silent failure VAL-2 exists to prevent —\n * \"we never asked\" and \"they refused\" are different facts and the export says\n * which.\n */\nexport function cellText(value: ReadValue | undefined): string {\n if (!value) return \"\";\n if (value.absent_reason) return `(${value.absent_reason})`;\n const raw = value.value;\n if (raw === null || raw === undefined) return \"\";\n if (typeof raw === \"string\") return raw;\n return JSON.stringify(raw);\n}\n\nfunction headerFor(field: Field): string {\n return field.label && field.label.length > 0 ? field.label : field.key;\n}\n\nexport function exportCsv(fields: Field[], rows: ExportRow[]): string {\n const lines = [fields.map((f) => escape(headerFor(f))).join(\",\")];\n for (const row of rows) {\n lines.push(fields.map((f) => escape(cellText(row[f.key]))).join(\",\"));\n }\n return lines.join(\"\\n\");\n}\n\n/** The header row plus every cell, as the sheet writer takes it. */\nexport function toAoa(fields: Field[], rows: ExportRow[]): string[][] {\n return [fields.map(headerFor), ...rows.map((row) => fields.map((f) => cellText(row[f.key])))];\n}\n\n/**\n * The XLSX bytes. The `xlsx` import is dynamic so a consumer that only ever\n * exports CSV never pays for the library — the design-system module is loaded\n * the same way, and for the same reason.\n */\nexport async function exportXlsx(\n fields: Field[],\n rows: ExportRow[],\n sheetLabel = \"Records\",\n): Promise<Uint8Array> {\n const XLSX = await import(\"xlsx\");\n const worksheet = XLSX.utils.aoa_to_sheet(toAoa(fields, rows));\n const workbook = XLSX.utils.book_new();\n const name = sheetLabel.replace(/[\\\\/?*[\\]:]/g, \" \").trim().slice(0, 31) || \"Data\";\n XLSX.utils.book_append_sheet(workbook, worksheet, name);\n return XLSX.write(workbook, { type: \"array\", bookType: \"xlsx\", compression: true }) as Uint8Array;\n}\n\n/**\n * A PARSED FILE, AND NOTHING ELSE: its headings, and every row keyed by them.\n *\n * 🚨 THERE IS NO `field`, NO `unmapped` AND NO WAY TO ASK FOR ONE, and that is\n * the point. Until 2026-09-20 this parse ALSO decided which Field each heading\n * meant — it took `fields`, matched each header by key or label, keyed the rows\n * by whatever it matched, and **dropped every column it did not**. That cannot\n * be the input to `custom.io_import_plan` / `custom.io_import_rows`, whose whole\n * job is to decide the mapping and to OFFER what they could not match as a new\n * column: the store can only offer a column whose values reached it.\n *\n * Measured by looking at the screen: every unmapped column's samples came back\n * empty and its proposal read \"every row in this column is empty, so there is\n * nothing to go on\" — for columns plainly full of values.\n *\n * The fix is the SHAPE, not a second field beside the first. These functions no\n * longer take `fields`, so a parse cannot decide a mapping even by accident, and\n * there is no safe path left beside the unsafe one.\n */\nexport interface ParsedImport {\n /** The file's own headings, in the file's own order and spelling. */\n headers: string[];\n /** Every row, keyed by heading. Every column is here; nothing is dropped. */\n rows: Array<Record<string, string>>;\n}\n\n/** RFC-4180 enough for what the canonical table writes, quotes and embedded newlines included. */\nexport function parseCsv(text: string): string[][] {\n const rows: string[][] = [];\n let row: string[] = [];\n let cell = \"\";\n let quoted = false;\n for (let i = 0; i < text.length; i += 1) {\n const ch = text[i];\n if (quoted) {\n if (ch === '\"') {\n if (text[i + 1] === '\"') {\n cell += '\"';\n i += 1;\n } else quoted = false;\n } else cell += ch;\n continue;\n }\n if (ch === '\"') quoted = true;\n else if (ch === \",\") {\n row.push(cell);\n cell = \"\";\n } else if (ch === \"\\n\" || ch === \"\\r\") {\n if (ch === \"\\r\" && text[i + 1] === \"\\n\") i += 1;\n row.push(cell);\n rows.push(row);\n row = [];\n cell = \"\";\n } else cell += ch;\n }\n if (cell.length > 0 || row.length > 0) {\n row.push(cell);\n rows.push(row);\n }\n return rows;\n}\n\nexport function importCsv(text: string): ParsedImport {\n return fromMatrix(parseCsv(text));\n}\n\nexport async function importXlsx(bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport> {\n const XLSX = await import(\"xlsx\");\n const workbook = XLSX.read(bytes, { type: \"array\" });\n const first = workbook.SheetNames[0];\n if (!first) return { headers: [], rows: [] };\n const sheet = workbook.Sheets[first];\n if (!sheet) return { headers: [], rows: [] };\n const matrix = XLSX.utils.sheet_to_json<string[]>(sheet, { header: 1, raw: false, defval: \"\" });\n return fromMatrix(matrix);\n}\n\nfunction fromMatrix(matrix: string[][]): ParsedImport {\n const [header, ...body] = matrix;\n if (!header) return { headers: [], rows: [] };\n const headers = header.map((text) => String(text ?? \"\"));\n const rows = body\n .filter((line) => line.some((cell) => String(cell ?? \"\").trim().length > 0))\n .map((line) => {\n const record: Record<string, string> = {};\n headers.forEach((heading, index) => {\n if (heading.trim().length > 0) record[heading] = String(line[index] ?? \"\");\n });\n return record;\n });\n return { headers, rows };\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAwBa,SAkTN;AA1UP;AAAA;AAAA;AAwBO,IAAM,UAAmB;AAAA,MAC9B,IAAI;AAAA,MACJ,SACE;AAAA,MACF,UAAU;AAAA,MACV,YAAY;AAAA,MAEZ,UAAU;AAAA,QACR,MAAM;AAAA,QACN,WAAW;AAAA,QACX,SAAS;AAAA,UACP,OAAO;AAAA,UACP,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ,SAAS;AAAA,QACX;AAAA,QACA,OAAO;AAAA,QACP,OAAO;AAAA,QACP,UAAU;AAAA,MACZ;AAAA,MAEA,QAAQ;AAAA,QACN;AAAA,UACE,OAAO;AAAA,UACP,MAAM;AAAA,UACN,eAAe;AAAA,UACf,aAAa;AAAA,UACb,MAAM;AAAA,UACN,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,MAAM;AAAA,UACN,YAAY;AAAA,UACZ,WAAW;AAAA,UACX,QAAQ;AAAA,YACN,EAAE,KAAK,SAAS,OAAO,UAAU,YAAY,QAAQ,UAAU,MAAM,aAAa,YAAY,eAAe,UAAU;AAAA,YACvH,EAAE,KAAK,YAAY,OAAO,UAAU,YAAY,UAAU,SAAS,CAAC,aAAa,eAAe,aAAa,QAAQ,WAAW,iBAAiB,GAAG,aAAa,Y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A,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;AChvDO,SAAS,UAAU,OAAkC;AAC1D,SAAO,MAAM,QAAQ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