@ai-matrx/records 0.11.0 → 0.16.0

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/core/index.ts","../../src/vocabulary.ts","../../src/level.ts","../../src/rule.ts","../../src/aggregate.ts","../../src/results.ts","../../src/store.generated.ts","../../src/core/doors.ts","../../src/core/pgError.ts","../../src/core/query.ts","../../src/core/client.ts","../../src/core/supabase.ts","../../src/core/validation.ts","../../src/core/io.ts"],"sourcesContent":["// src/core/index.ts — @ai-matrx/records (HEADLESS)\n//\n// Zero React, zero DOM. Everything here runs in a node script, a worker, a\n// server component and a browser alike.\n\nexport * from \"../index\";\nexport { createRecordsClient, asWriteConflict, type RecordsClient } from \"./client\";\nexport { DOORS, doorExists, doorAbsent, doorCensus, type DoorKey } from \"./doors\";\nexport { supabaseDataSource, type SupabaseLike } from \"./supabase\";\nexport { mapPgError, staleWriteDetail, MAPPED_SQLSTATES } from \"./pgError\";\nexport {\n planQuery,\n intersectIds,\n DEFAULT_PAGE_SIZE,\n type RecordQuery,\n type QueryPlan,\n type AsOf,\n type PromotedPredicate,\n} from \"./query\";\nexport {\n predictWriteRefusals,\n predictValueRefusals,\n predictSizeRefusal,\n predictEnvelopeRefusal,\n DEFAULT_VALUE_MAX_BYTES,\n DEFAULT_DOCUMENT_MAX_BYTES,\n type MirrorLimits,\n} from \"./validation\";\nexport {\n exportCsv,\n exportXlsx,\n importCsv,\n importXlsx,\n parseCsv,\n toAoa,\n cellText,\n type ExportRow,\n type ParsedImport,\n} from \"./io\";\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 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/** 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/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/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 * 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/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 = \"count\" | \"sum\" | \"avg\" | \"min\" | \"max\";\n\n/** The periods a date Field can be bucketed into (`custom.agg_buckets()`). */\nexport type AggregateBucket = \"day\" | \"week\" | \"month\" | \"quarter\" | \"year\";\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","// 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 /** 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\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 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","// 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, 13 parity field types, 21 rule node kinds,\n// 9 kernel Tables, 337 doors, 35 knobs,\n// 1020 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\"] 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: \"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/** The node kinds `custom.rule_eval` evaluates, and the lane that owns each. */\nexport const RULE_NODE_KINDS = [\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: \"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: \"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: \"actor_vocabulary\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"actor_word\", args: \"p_declared text\", returns: \"text\", security: \"invoker\" },\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_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\", returns: \"uuid\", 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_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_operations\", args: \"\", 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_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, cadence text, schedule text, 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: \"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_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: \"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: \"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: \"client_write_grants\", args: \"\", returns: \"TABLE(role_name text, object_name text, privilege text)\", 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: \"invoker\" },\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: \"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: \"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: \"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_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_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_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_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_on_one_ladder\", 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: \"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_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_kernel_id\", args: \"\", returns: \"uuid\", 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: \"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_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: \"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_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_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: \"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_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_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_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_infer_type\", args: \"p_samples jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"io_outbox_announce\", 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_record_changed\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer\", 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: \"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: \"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: \"merge_field_kernel_id\", args: \"\", returns: \"uuid\", security: \"invoker\" },\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_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: \"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: \"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: \"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: \"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_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: \"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_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_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_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_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_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_write\", args: \"p_organization_id uuid, p_table_id uuid, p_data jsonb\", returns: \"uuid\", security: \"definer\" },\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_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: \"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: \"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: \"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: \"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: \"table_capacity\", args: \"p_organization_id uuid, p_table_id uuid\", returns: \"jsonb\", security: \"definer\" },\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_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_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_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: \"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: \"trg_associations_bump_visibility\", args: \"\", returns: \"trigger\", security: \"definer\" },\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_versions\", args: \"p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\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: \"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_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_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: \"agent_schema_changes\", value: \"\\\"ask\\\"\", type: \"string\" },\n { key: \"associations_guard\", value: \"true\", type: \"boolean\" },\n { key: \"code_paths_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_chat_seeding_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_checkout_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: \"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: \"entity_custom_fields_guard\", value: \"false\", type: \"boolean\" },\n { key: \"entity_types_guard\", value: \"false\", type: \"boolean\" },\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: \"member_default_level\", value: \"\\\"viewer\\\"\", type: \"enum\" },\n { key: \"member_default_visibility\", value: \"\\\"all_records\\\"\", type: \"enum\" },\n { key: \"records_tool_default\", value: \"true\", type: \"boolean\" },\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: \"system_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"table_record_ceiling\", value: \"150000\", 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: \"doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_read,doc_template_save,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,migrate_delete,migrate_extract_parent,migrate_merge,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,read_record,record_delete,record_restore,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_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: \"external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign,work_slots_declare\" },\n { code: \"22004\", raised_by: \"_entity_custom_fields_guard,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,doc_render_write,doc_sign,doc_signature_write,doc_template_save,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,form_declare,form_submit,home_add,io_comment_write,io_import_open,io_outbox_drain,io_restore,migrate_purge,migrate_split,migrate_undo,organization_clear,organization_contents,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,relation_carry,relation_own,rule_declare,share_grant,table_declare,work_approval_decide,work_approval_request,work_template_declare\" },\n { code: \"22012\", raised_by: \"rule_eval\" },\n { code: \"22023\", raised_by: \"_entity_custom_fields_guard,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,containment_parent,doc_render_body,doc_render_write,doc_signature_write,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,io_import_open,io_proposal_accept,migrate_merge,my_levels,organization_clear,query_by_coordinates,query_rollup,record_update,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold\" },\n { code: \"23503\", raised_by: \"_containment_guard,_field_document_for,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,delete_rule,doc_sign,doc_template_save,form_declare,form_submit,home_add,io_comment_write,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,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,work_set_state,work_take_assignment,work_template_instantiate\" },\n { code: \"23505\", raised_by: \"_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,io_proposal_accept,relation_carry,relation_own,share_grant,work_approval_decide,work_slot_hold\" },\n { code: \"23514\", raised_by: \"_containment_guard,_dated_values_guard,_derived_fields,_entity_custom_fields_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,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_shape_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_entity_is_organization_scoped,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,migrate_merge,relation_carry,relation_own,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,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,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,io_comment_resolve,io_comment_write,io_restore,migrate_purge,my_levels,organization_clear,promote_table,query_visibility_parity,read_record,read_records,share_grant,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person\" },\n { code: \"42703\", raised_by: \"entity_table\" },\n { code: \"53400\", raised_by: \"anon_rate_take,delete_cascade_closure,promote_field\" },\n { code: \"54001\", raised_by: \"record_delete\" },\n { code: \"PT409\", raised_by: \"record_update\" },\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_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_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 \"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_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 \"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/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 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\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 // 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 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 // 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 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 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 // 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 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 docSignatureIntact: \"doc_signature_intact\",\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 // 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 \"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 // 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};\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/** Map a PostgREST/supabase-js failure into the package's refusal shape. */\nexport function mapPgError(error: PgError, where: string): RecordsError {\n const sqlstate = error.code ?? undefined;\n const code: RecordsErrorCode = (sqlstate ? BY_SQLSTATE[sqlstate] : undefined) ?? \"internal\";\n const mapped: RecordsError = {\n code,\n message: error.message,\n ...(error.hint ? { hint: error.hint } : {}),\n ...(sqlstate ? { sqlstate } : {}),\n };\n const detail = parseDetail(error.details);\n if (detail !== undefined) mapped.detail = detail;\n if (code === \"internal\") {\n // Still the store's own words — but say out loud that this package did not\n // recognise the class, so nobody reads the silence as \"handled\".\n mapped.hint =\n (mapped.hint ? `${mapped.hint} ` : \"\") +\n `(@ai-matrx/records did not recognise SQLSTATE ${sqlstate ?? \"(none)\"} from ${where}; ` +\n `the message above is the store's own and is the thing to act on.)`;\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/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 { AggregateBucket, AggregateMeasure, AggregateRow } from \"../aggregate\";\nimport type { DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken } from \"../doc\";\nimport type { Subscription } 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 { ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding } from \"../trust\";\nimport type { Field } from \"../field\";\nimport type {\n EntityFieldRights,\n EntityRecordRead,\n EntityRecordsFound,\n EntityTableFacts,\n NewEntityFieldDeclaration,\n} from \"../entity-field\";\nimport type { FormSummary } from \"../rule\";\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 RecordRead,\n StoredRecord,\n Timestamp,\n Uuid,\n} from \"../record\";\nimport type { RecordsConfig, RecordsErrorSink } from \"../ports\";\nimport type { RecordsError, RecordsResult, WriteConflict } from \"../results\";\nimport { err, ok } from \"../results\";\nimport type { Table, TableCapacity } from \"../table\";\nimport { DOORS, TRUST_DOORS, TRUST_SCHEMA, doorAbsent, doorExists } from \"./doors\";\nimport { mapPgError, staleWriteDetail } from \"./pgError\";\nimport { intersectIds, planQuery, type RecordQuery } from \"./query\";\n\nconst DEFAULT_SCHEMA = \"custom\";\n\nfunction sink(config: RecordsConfig): RecordsErrorSink {\n return (\n config.onError ??\n ((e) =>\n // The defined degradation, stated: loud, with the store's own words, and\n // naming where it happened. Never silence.\n console.error(`[@ai-matrx/records] ${e.where}: ${e.code} — ${e.message}${e.hint ? ` (${e.hint})` : \"\"}`))\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 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 /** REC-23. Soft, and reversible within `retention`. */\n recordDelete(args: { record_id: Uuid }): Promise<RecordsResult<Timestamp>>;\n recordRestore(args: { record_id: Uuid }): Promise<RecordsResult<void>>;\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 limit?: number;\n offset?: number;\n }): Promise<RecordsResult<{ rows: ReadRow[]; total: number | null }>>;\n query(query: RecordQuery): Promise<RecordsResult<{ rows: ReadRow[]; total: number | null }>>;\n tableList(): Promise<RecordsResult<Table[]>>;\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 /** 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 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 /** 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 // ── 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 /** Equality only, and it lands in the SAME WHERE as visibility. */\n filter?: Record<string, string>;\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 // ── 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 /** Is what was signed still what is there? The store answers, never the screen. */\n docSignatureIntact(args: { signature_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Every template that renders one Table. */\n docTemplates(args: { table_id: Uuid }): Promise<RecordsResult<DocTemplateRow[]>>;\n /** Every frozen render of one record, newest first. */\n docRenders(args: { record_id: Uuid }): Promise<RecordsResult<DocRenderRow[]>>;\n /** Every signature on one 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 * 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 // ── 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\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 * 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 return callDoor<Uuid>(\n DOORS.recordWrite,\n { p_organization_id: org, p_table_id: table_id, p_data: data },\n \"recordWrite\",\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,\n ...(expectedVersion === undefined ? {} : { p_expected_version: expectedVersion }),\n },\n \"recordUpdate\",\n );\n return result;\n },\n\n async recordDelete({ record_id }) {\n return callDoor<Timestamp>(\n DOORS.recordDelete,\n { p_organization_id: org, p_record_id: record_id },\n \"recordDelete\",\n );\n },\n\n async recordRestore({ record_id }) {\n return callDoor<void>(\n DOORS.recordRestore,\n { p_organization_id: org, p_record_id: record_id },\n \"recordRestore\",\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 let computed: RecordRead[\"computed\"] = [];\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) return err(provenance.error);\n computed = provenance.data ?? [];\n }\n return ok({ record_id, document, hidden, computed });\n },\n\n async list({ table_id, limit = 50, offset = 0 }) {\n const door = await callDoor<Array<{ id: Uuid; document: unknown; level: string }>>(\n DOORS.readRecords,\n {\n p_organization_id: org,\n p_table_id: table_id,\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 // The door reads live records only — a deleted record is not in its set —\n // and it counts nothing, so `total` is honestly null rather than a number\n // taken from a table this reader may not see all of.\n return ok({ rows, total: null });\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 return ok(\n rows.map((row) => ({ id: row.id, ...(row.data as object) }) as Field),\n );\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 return callDoor<Uuid>(\n DOORS.fieldDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec: 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 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 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 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 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 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 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 async docTemplates({ table_id }) {\n const response = await config.dataSource\n .schema(schema)\n .from(\"doc_template\")\n .select(\"*\")\n .eq(\"organization_id\", org)\n .eq(\"renders_table_id\", table_id)\n .order(\"name\");\n if (response.error) {\n const refusal = mapPgError(response.error, \"docTemplates\");\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"docTemplates\" });\n return err(refusal);\n }\n return ok((response.data ?? []) as DocTemplateRow[]);\n },\n\n async docRenders({ record_id }) {\n const response = await config.dataSource\n .schema(schema)\n .from(\"doc_render\")\n .select(\"*\")\n .eq(\"organization_id\", org)\n .eq(\"record_id\", record_id)\n .is(\"deleted_at\", null)\n .order(\"rendered_at\", { ascending: false });\n if (response.error) {\n const refusal = mapPgError(response.error, \"docRenders\");\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"docRenders\" });\n return err(refusal);\n }\n return ok((response.data ?? []) as DocRenderRow[]);\n },\n\n async docSignatures({ record_id }) {\n const response = await config.dataSource\n .schema(schema)\n .from(\"doc_signature\")\n .select(\"*\")\n .eq(\"organization_id\", org)\n .eq(\"record_id\", record_id)\n .is(\"deleted_at\", null)\n .order(\"signed_at\", { ascending: false });\n if (response.error) {\n const refusal = mapPgError(response.error, \"docSignatures\");\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"docSignatures\" });\n return err(refusal);\n }\n return ok((response.data ?? []) as DocSignatureRow[]);\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 docSignatureIntact({ signature_id }) {\n return callDoor<unknown>(\n DOORS.docSignatureIntact,\n { p_organization_id: org, p_signature_id: signature_id },\n \"docSignatureIntact\",\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 // ── 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 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\" && item.length > Number(rule.value)) {\n return { ...base, message: `${label} is longer than ${rule.value} characters`, hint: \"FLD-3.\" };\n }\n return null;\n case \"pattern\":\n if (typeof item === \"string\" && !new RegExp(String(rule.value)).test(item)) {\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 } else if (!UUID.test(item)) {\n found.push({\n ...base,\n message: `${label} was given a choice that is not one of its choices`,\n hint: `REC-51: option membership. ${label} stores the id of an option record, and what it was given is not an id at all.`,\n });\n }\n // MEMBERSHIP itself needs the store: the mirror stops here on purpose.\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/** A parsed import: the header row mapped onto field keys, and the rows. */\nexport interface ParsedImport {\n /** Header text -> the Field it matched, or null when nothing matched. */\n columns: Array<{ header: string; field: Field | null }>;\n rows: Array<Record<string, string>>;\n /**\n * DOOR-14 / AGT-N-7. Headers that matched no Field. They are NEVER dropped\n * quietly: an unmapped key becomes a field proposal a person approves, and the\n * import surface shows this list.\n */\n unmapped: string[];\n}\n\nfunction matchField(header: string, fields: Field[]): Field | null {\n const wanted = header.trim().toLowerCase();\n return (\n fields.find((f) => f.key.toLowerCase() === wanted) ??\n fields.find((f) => (f.label ?? \"\").toLowerCase() === wanted) ??\n null\n );\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(fields: Field[], text: string): ParsedImport {\n return fromMatrix(fields, parseCsv(text));\n}\n\nexport async function importXlsx(fields: Field[], 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 { columns: [], rows: [], unmapped: [] };\n const sheet = workbook.Sheets[first];\n if (!sheet) return { columns: [], rows: [], unmapped: [] };\n const matrix = XLSX.utils.sheet_to_json<string[]>(sheet, { header: 1, raw: false, defval: \"\" });\n return fromMatrix(fields, matrix);\n}\n\nfunction fromMatrix(fields: Field[], matrix: string[][]): ParsedImport {\n const [header, ...body] = matrix;\n if (!header) return { columns: [], rows: [], unmapped: [] };\n const columns = header.map((text) => ({ header: text, field: matchField(text, fields) }));\n const unmapped = columns.filter((c) => c.field === null).map((c) => c.header).filter((h) => h.trim().length > 0);\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 columns.forEach((column, index) => {\n if (column.field) record[column.field.key] = String(line[index] ?? \"\");\n });\n return record;\n });\n return { columns, rows, unmapped };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0EO,IAAM,cAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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A;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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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,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,QAAQ,UAAU;AACjC,UAAI,OAAO,MAAO,QAAO,OAAO,MAAM,GAAG,IAAI,OAAO,KAAK,KAAK,KAAK,EAAE;AAAA,IACvE,CAAC;AACD,WAAO;AAAA,EACT,CAAC;AACH,SAAO,EAAE,SAAS,MAAM,SAAS;AACnC;","names":["rows","block"]}
1
+ {"version":3,"sources":["../../src/core/index.ts","../../src/vocabulary.ts","../../src/level.ts","../../src/choice.ts","../../src/rule.ts","../../src/portal.ts","../../src/aggregate.ts","../../src/results.ts","../../src/store.generated.ts","../../src/core/doors.ts","../../src/core/pgError.ts","../../src/core/query.ts","../../src/core/client.ts","../../src/core/supabase.ts","../../src/core/validation.ts","../../src/core/io.ts"],"sourcesContent":["// src/core/index.ts — @ai-matrx/records (HEADLESS)\n//\n// Zero React, zero DOM. Everything here runs in a node script, a worker, a\n// server component and a browser alike.\n\nexport * from \"../index\";\nexport { createRecordsClient, asWriteConflict, type RecordsClient } from \"./client\";\nexport { DOORS, doorExists, doorAbsent, doorCensus, type DoorKey } from \"./doors\";\nexport { supabaseDataSource, type SupabaseLike } from \"./supabase\";\nexport { mapPgError, staleWriteDetail, MAPPED_SQLSTATES } from \"./pgError\";\nexport {\n planQuery,\n intersectIds,\n DEFAULT_PAGE_SIZE,\n type RecordQuery,\n type QueryPlan,\n type AsOf,\n type PromotedPredicate,\n} from \"./query\";\nexport {\n predictWriteRefusals,\n predictValueRefusals,\n predictSizeRefusal,\n predictEnvelopeRefusal,\n DEFAULT_VALUE_MAX_BYTES,\n DEFAULT_DOCUMENT_MAX_BYTES,\n type MirrorLimits,\n} from \"./validation\";\nexport {\n exportCsv,\n exportXlsx,\n importCsv,\n importXlsx,\n parseCsv,\n toAoa,\n cellText,\n type ExportRow,\n type ParsedImport,\n} from \"./io\";\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 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/** 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/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/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/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 * 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/** 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\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","// 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 = \"count\" | \"sum\" | \"avg\" | \"min\" | \"max\";\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/** 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","// 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 /** 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\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 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","// 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, 13 parity field types, 21 rule node kinds,\n// 9 kernel Tables, 387 doors, 35 knobs,\n// 1020 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\"] 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: \"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/** The node kinds `custom.rule_eval` evaluates, and the lane that owns each. */\nexport const RULE_NODE_KINDS = [\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: \"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: \"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: \"actor_vocabulary\", args: \"\", returns: \"text[]\", security: \"invoker\" },\n { name: \"actor_word\", args: \"p_declared text\", returns: \"text\", security: \"invoker\" },\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_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\", returns: \"uuid\", 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_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_operations\", args: \"\", 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_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, cadence text, schedule text, 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: \"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_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: \"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: \"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: \"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: \"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: \"invoker\" },\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: \"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: \"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: \"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_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_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_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_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_on_one_ladder\", 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: \"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_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_kernel_id\", args: \"\", returns: \"uuid\", 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: \"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_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: \"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_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_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: \"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_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_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_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_infer_type\", args: \"p_samples jsonb\", returns: \"text\", security: \"invoker\" },\n { name: \"io_outbox_announce\", 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_record_changed\", args: \"\", returns: \"trigger\", security: \"definer\" },\n { name: \"io_restore\", args: \"p_organization_id uuid, p_record_id uuid, p_version integer\", 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: \"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: \"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: \"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: \"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_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: \"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: \"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: \"portal_admits\", args: \"p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid\", returns: \"boolean\", 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_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_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: \"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: \"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_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: \"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_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_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_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_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_write\", args: \"p_organization_id uuid, p_table_id uuid, p_data jsonb\", 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_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: \"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: \"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: \"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: \"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: \"subscription_mute\", args: \"p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true\", returns: \"boolean\", 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, channel text, recipient_user_id uuid, event_key text, muted boolean, mine boolean, i_may_mute boolean)\", 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_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_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_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_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: \"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: \"trg_associations_bump_visibility\", args: \"\", returns: \"trigger\", security: \"definer\" },\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_versions\", args: \"p_old jsonb, p_new jsonb\", returns: \"jsonb\", security: \"invoker\" },\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: \"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: \"agent_schema_changes\", value: \"\\\"ask\\\"\", type: \"string\" },\n { key: \"associations_guard\", value: \"true\", type: \"boolean\" },\n { key: \"code_paths_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_chat_seeding_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"consumer_checkout_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: \"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: \"entity_custom_fields_guard\", value: \"false\", type: \"boolean\" },\n { key: \"entity_types_guard\", value: \"false\", type: \"boolean\" },\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: \"member_default_level\", value: \"\\\"viewer\\\"\", type: \"enum\" },\n { key: \"member_default_visibility\", value: \"\\\"all_records\\\"\", type: \"enum\" },\n { key: \"records_tool_default\", value: \"true\", type: \"boolean\" },\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: \"system_enabled\", value: \"false\", type: \"boolean\" },\n { key: \"table_record_ceiling\", value: \"150000\", 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: \"dashboard_delete,dashboard_run,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_read,doc_template_save,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_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: \"external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign\" },\n { code: \"22004\", raised_by: \"_entity_custom_fields_guard,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,form_declare,form_submit,home_add,io_comment_write,io_import_open,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,portal_declare,portal_invite,portal_principal_bind,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,relation_carry,relation_own,rule_declare,share_grant,table_declare,work_approval_decide,work_approval_request,work_template_declare\" },\n { code: \"22007\", raised_by: \"dashboard_window_sql\" },\n { code: \"22012\", raised_by: \"rule_eval\" },\n { code: \"22023\", raised_by: \"_entity_custom_fields_guard,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,io_import_open,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,portal_declare,query_by_coordinates,query_rollup,record_update,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold\" },\n { code: \"23503\", raised_by: \"_containment_guard,_field_document_for,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,dashboard_declare,delete_rule,doc_sign,doc_template_save,form_declare,form_submit,home_add,io_comment_write,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,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,subscription_mute,work_set_state,work_take_assignment,work_template_instantiate\" },\n { code: \"23505\", raised_by: \"_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,io_proposal_accept,relation_carry,relation_own,share_grant,work_approval_decide,work_slot_hold\" },\n { code: \"23514\", raised_by: \"_containment_guard,_dated_values_guard,_derived_fields,_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,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_shape_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_entity_is_organization_scoped,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,migrate_merge,relation_carry,relation_own,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,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,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,io_comment_resolve,io_comment_write,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,share_grant,subscription_mute,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,promote_field\" },\n { code: \"54001\", raised_by: \"record_delete\" },\n { code: \"PT409\", raised_by: \"record_update\" },\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_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_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 \"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_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 \"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/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 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\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 // 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 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 // 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 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 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 // 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 portalCard: \"portal_card\",\n portalDeclare: \"portal_declare\",\n portalInvite: \"portal_invite\",\n portalRevoke: \"portal_revoke\",\n portalPreview: \"portal_preview\",\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 // 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 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 docSignatureIntact: \"doc_signature_intact\",\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 // 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 \"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 // 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};\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/** Map a PostgREST/supabase-js failure into the package's refusal shape. */\nexport function mapPgError(error: PgError, where: string): RecordsError {\n const sqlstate = error.code ?? undefined;\n const code: RecordsErrorCode = (sqlstate ? BY_SQLSTATE[sqlstate] : undefined) ?? \"internal\";\n const mapped: RecordsError = {\n code,\n message: error.message,\n ...(error.hint ? { hint: error.hint } : {}),\n ...(sqlstate ? { sqlstate } : {}),\n };\n const detail = parseDetail(error.details);\n if (detail !== undefined) mapped.detail = detail;\n if (code === \"internal\") {\n // Still the store's own words — but say out loud that this package did not\n // recognise the class, so nobody reads the silence as \"handled\".\n mapped.hint =\n (mapped.hint ? `${mapped.hint} ` : \"\") +\n `(@ai-matrx/records did not recognise SQLSTATE ${sqlstate ?? \"(none)\"} from ${where}; ` +\n `the message above is the store's own and is the thing to act on.)`;\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/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 { AggregateBucket, AggregateFilter, AggregateMeasure, AggregateRow } from \"../aggregate\";\nimport type {\n DashboardBlock,\n DashboardRunResult,\n DashboardSummary,\n StuckRow,\n} from \"../dashboard\";\nimport type { DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken } from \"../doc\";\nimport type { MySubscription, Subscription } 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 { ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding } from \"../trust\";\nimport type { Field } from \"../field\";\nimport type {\n EntityFieldRights,\n EntityRecordRead,\n EntityRecordsFound,\n EntityTableFacts,\n NewEntityFieldDeclaration,\n} from \"../entity-field\";\nimport type { FormSummary } from \"../rule\";\nimport type {\n PortalCard,\n PortalInvitation,\n PortalPreviewRow,\n PortalRevocation,\n PortalSummary,\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 RecordRead,\n StoredRecord,\n Timestamp,\n Uuid,\n} from \"../record\";\nimport type { RecordsConfig, RecordsErrorSink } from \"../ports\";\nimport type { RecordsError, RecordsResult, WriteConflict } from \"../results\";\nimport { err, ok } from \"../results\";\nimport type { Table, TableCapacity } from \"../table\";\nimport { DOORS, TRUST_DOORS, TRUST_SCHEMA, doorAbsent, doorExists } from \"./doors\";\nimport { mapPgError, staleWriteDetail } from \"./pgError\";\nimport { intersectIds, planQuery, type RecordQuery } from \"./query\";\n\nconst DEFAULT_SCHEMA = \"custom\";\n\nfunction sink(config: RecordsConfig): RecordsErrorSink {\n return (\n config.onError ??\n ((e) =>\n // The defined degradation, stated: loud, with the store's own words, and\n // naming where it happened. Never silence.\n console.error(`[@ai-matrx/records] ${e.where}: ${e.code} — ${e.message}${e.hint ? ` (${e.hint})` : \"\"}`))\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 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 /** REC-23. Soft, and reversible within `retention`. */\n recordDelete(args: { record_id: Uuid }): Promise<RecordsResult<Timestamp>>;\n recordRestore(args: { record_id: Uuid }): Promise<RecordsResult<void>>;\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 limit?: number;\n offset?: number;\n }): Promise<RecordsResult<{ rows: ReadRow[]; total: number | null }>>;\n query(query: RecordQuery): Promise<RecordsResult<{ rows: ReadRow[]; total: number | null }>>;\n tableList(): Promise<RecordsResult<Table[]>>;\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 /** 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 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 /** 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 // ── 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 /** 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?: Record<string, AggregateFilter>;\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?: Record<string, AggregateFilter>;\n limit?: number;\n }): Promise<RecordsResult<StuckRow[]>>;\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?: Record<string, AggregateFilter>;\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 * 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 // ── 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 /** Is what was signed still what is there? The store answers, never the screen. */\n docSignatureIntact(args: { signature_id: Uuid }): Promise<RecordsResult<unknown>>;\n /** Every template that renders one Table. */\n docTemplates(args: { table_id: Uuid }): Promise<RecordsResult<DocTemplateRow[]>>;\n /** Every frozen render of one record, newest first. */\n docRenders(args: { record_id: Uuid }): Promise<RecordsResult<DocRenderRow[]>>;\n /** Every signature on one 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 * 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 // ── 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\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 * 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 return callDoor<Uuid>(\n DOORS.recordWrite,\n { p_organization_id: org, p_table_id: table_id, p_data: data },\n \"recordWrite\",\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,\n ...(expectedVersion === undefined ? {} : { p_expected_version: expectedVersion }),\n },\n \"recordUpdate\",\n );\n return result;\n },\n\n async recordDelete({ record_id }) {\n return callDoor<Timestamp>(\n DOORS.recordDelete,\n { p_organization_id: org, p_record_id: record_id },\n \"recordDelete\",\n );\n },\n\n async recordRestore({ record_id }) {\n return callDoor<void>(\n DOORS.recordRestore,\n { p_organization_id: org, p_record_id: record_id },\n \"recordRestore\",\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 let computed: RecordRead[\"computed\"] = [];\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) return err(provenance.error);\n computed = provenance.data ?? [];\n }\n return ok({ record_id, document, hidden, computed });\n },\n\n async list({ table_id, limit = 50, offset = 0 }) {\n const door = await callDoor<Array<{ id: Uuid; document: unknown; level: string }>>(\n DOORS.readRecords,\n {\n p_organization_id: org,\n p_table_id: table_id,\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 // The door reads live records only — a deleted record is not in its set —\n // and it counts nothing, so `total` is honestly null rather than a number\n // taken from a table this reader may not see all of.\n return ok({ rows, total: null });\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 return callDoor<Uuid>(\n DOORS.fieldDeclare,\n { p_organization_id: org, p_table_id: table_id, p_spec: 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 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 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 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 portals() {\n return callDoor<PortalSummary[]>(DOORS.portals, { p_organization_id: org }, \"portals\");\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 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 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 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 async docTemplates({ table_id }) {\n const response = await config.dataSource\n .schema(schema)\n .from(\"doc_template\")\n .select(\"*\")\n .eq(\"organization_id\", org)\n .eq(\"renders_table_id\", table_id)\n .order(\"name\");\n if (response.error) {\n const refusal = mapPgError(response.error, \"docTemplates\");\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"docTemplates\" });\n return err(refusal);\n }\n return ok((response.data ?? []) as DocTemplateRow[]);\n },\n\n async docRenders({ record_id }) {\n const response = await config.dataSource\n .schema(schema)\n .from(\"doc_render\")\n .select(\"*\")\n .eq(\"organization_id\", org)\n .eq(\"record_id\", record_id)\n .is(\"deleted_at\", null)\n .order(\"rendered_at\", { ascending: false });\n if (response.error) {\n const refusal = mapPgError(response.error, \"docRenders\");\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"docRenders\" });\n return err(refusal);\n }\n return ok((response.data ?? []) as DocRenderRow[]);\n },\n\n async docSignatures({ record_id }) {\n const response = await config.dataSource\n .schema(schema)\n .from(\"doc_signature\")\n .select(\"*\")\n .eq(\"organization_id\", org)\n .eq(\"record_id\", record_id)\n .is(\"deleted_at\", null)\n .order(\"signed_at\", { ascending: false });\n if (response.error) {\n const refusal = mapPgError(response.error, \"docSignatures\");\n scream({ code: refusal.code, message: refusal.message, ...(refusal.hint ? { hint: refusal.hint } : {}), where: \"docSignatures\" });\n return err(refusal);\n }\n return ok((response.data ?? []) as DocSignatureRow[]);\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 docSignatureIntact({ signature_id }) {\n return callDoor<unknown>(\n DOORS.docSignatureIntact,\n { p_organization_id: org, p_signature_id: signature_id },\n \"docSignatureIntact\",\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 // ── 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 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\" && item.length > Number(rule.value)) {\n return { ...base, message: `${label} is longer than ${rule.value} characters`, hint: \"FLD-3.\" };\n }\n return null;\n case \"pattern\":\n if (typeof item === \"string\" && !new RegExp(String(rule.value)).test(item)) {\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 } else if (!UUID.test(item)) {\n found.push({\n ...base,\n message: `${label} was given a choice that is not one of its choices`,\n hint: `REC-51: option membership. ${label} stores the id of an option record, and what it was given is not an id at all.`,\n });\n }\n // MEMBERSHIP itself needs the store: the mirror stops here on purpose.\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/** A parsed import: the header row mapped onto field keys, and the rows. */\nexport interface ParsedImport {\n /** Header text -> the Field it matched, or null when nothing matched. */\n columns: Array<{ header: string; field: Field | null }>;\n rows: Array<Record<string, string>>;\n /**\n * DOOR-14 / AGT-N-7. Headers that matched no Field. They are NEVER dropped\n * quietly: an unmapped key becomes a field proposal a person approves, and the\n * import surface shows this list.\n */\n unmapped: string[];\n}\n\nfunction matchField(header: string, fields: Field[]): Field | null {\n const wanted = header.trim().toLowerCase();\n return (\n fields.find((f) => f.key.toLowerCase() === wanted) ??\n fields.find((f) => (f.label ?? \"\").toLowerCase() === wanted) ??\n null\n );\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(fields: Field[], text: string): ParsedImport {\n return fromMatrix(fields, parseCsv(text));\n}\n\nexport async function importXlsx(fields: Field[], 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 { columns: [], rows: [], unmapped: [] };\n const sheet = workbook.Sheets[first];\n if (!sheet) return { columns: [], rows: [], unmapped: [] };\n const matrix = XLSX.utils.sheet_to_json<string[]>(sheet, { header: 1, raw: false, defval: \"\" });\n return fromMatrix(fields, matrix);\n}\n\nfunction fromMatrix(fields: Field[], matrix: string[][]): ParsedImport {\n const [header, ...body] = matrix;\n if (!header) return { columns: [], rows: [], unmapped: [] };\n const columns = header.map((text) => ({ header: text, field: matchField(text, fields) }));\n const unmapped = columns.filter((c) => c.field === null).map((c) => c.header).filter((h) => h.trim().length > 0);\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 columns.forEach((column, index) => {\n if (column.field) record[column.field.key] = String(line[index] ?? \"\");\n });\n return record;\n });\n return { columns, rows, unmapped };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0EO,IAAM,cAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,gBAAgB,CAAC,YAAY,QAAQ;AAI3C,IAAM,mBAAmB,CAAC,SAAS,Y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AA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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