@ai-matrx/records-ui 0.116.50 → 0.116.51

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.
package/CHANGELOG.md CHANGED
@@ -35,7 +35,7 @@
35
35
  - Tests: `vitest.setup.ts` gives jsdom a no-op `performance.mark` / `measure`.
36
36
  - **New subpath `@ai-matrx/records-ui/data-source`:** `recordsDataSource`, `personActor` and the who-changed words (`whenWords`, `actorWords`, `actorBadge`, `lastChangeSentence`, `SOMEBODY`, `THE_SYSTEM`) alone. `/helpers` also carries the field-type words, the colour resolver and the table builders, which read `@ai-matrx/records/core`; this entry reaches `@ai-matrx/kit` only, and shares the one data-source cache with `/helpers` and the root. Additive. Consumer action: a shell-reachable service that only binds its supabase client or says when imports from `/data-source`.
37
37
 
38
- ## 0.116.50
38
+ ## 0.116.51
39
39
 
40
40
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
41
41
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
@@ -4,9 +4,9 @@ import {
4
4
  SAVE_TO_TABLE_TYPES,
5
5
  SaveToTable,
6
6
  shapesOfSource
7
- } from "./chunk-KDD2FZZR.js";
7
+ } from "./chunk-BZ6PLCAR.js";
8
8
  import "./chunk-ABIUJCNS.js";
9
- import "./chunk-P4P4IFM4.js";
9
+ import "./chunk-7LELV7UI.js";
10
10
  import "./chunk-6Z537SLG.js";
11
11
  import "./chunk-LBZZDHV6.js";
12
12
  import "./chunk-4ZS4WEEE.js";
@@ -17,4 +17,4 @@ export {
17
17
  SaveToTable,
18
18
  shapesOfSource
19
19
  };
20
- //# sourceMappingURL=SaveToTable-G7Y4H7SB.js.map
20
+ //# sourceMappingURL=SaveToTable-EM2JT3OS.js.map
@@ -244,7 +244,11 @@ var REMEDY = {
244
244
  // read alike. "Try a smaller page" was written for the page read and was printed to a person adding
245
245
  // one row to a three-row table (clone walk, 2026-10-03; the clock was a lock another lane's
246
246
  // rehearsal held, not the row). A door whose page can shrink says so in its own hint, which wins here.
247
- timed_out: "Nothing was changed. Try again in a moment.",
247
+ // ONE SENTENCE, NOT TWO (lane TIMEOUT-ONE-SENTENCE, 2026-10-19): the shared timed-out sentence ("That took too long.
248
+ // Nothing was lost; try again.") already says what happened and what to do, so the table adds NO second remedy
249
+ // ("Nothing was changed" was also wrong on a read). Empty = the notice prints no remedy line and the one-line
250
+ // form is the sentence alone. A door's own hint still wins.
251
+ timed_out: "",
248
252
  internal: "Nothing you did caused this. Try again, and tell us if it keeps happening."
249
253
  };
250
254
  var ENGINEER_TEXT = [
@@ -532,7 +536,7 @@ function RefusalNotice({
532
536
  /* @__PURE__ */ jsx3(AlertTitle2, { className: "text-xs font-medium", children: plain.storeSaid ? plain.sentence : plain.title }),
533
537
  /* @__PURE__ */ jsxs2(AlertDescription2, { className: "space-y-1 text-xs", children: [
534
538
  plain.storeSaid || plain.sentence.replace(/\.$/, "") === plain.title ? null : /* @__PURE__ */ jsx3("p", { children: plain.sentence }),
535
- /* @__PURE__ */ jsx3("p", { className: "opacity-80", children: plain.remedy }),
539
+ plain.remedy === "" ? null : /* @__PURE__ */ jsx3("p", { className: "opacity-80", children: plain.remedy }),
536
540
  actions,
537
541
  doors
538
542
  ] })
@@ -1432,4 +1436,4 @@ export {
1432
1436
  choiceNudgeOf,
1433
1437
  useChoiceNudge
1434
1438
  };
1435
- //# sourceMappingURL=chunk-P4P4IFM4.js.map
1439
+ //# sourceMappingURL=chunk-7LELV7UI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tableRights.ts","../src/host.tsx","../src/names.ts","../src/plainWords.ts","../src/Refusal.tsx","../src/ArchivedOrganizationNotice.tsx","../src/refusalSaid.ts","../src/PickOrAdd.tsx","../src/personChip.tsx","../src/recordVersions.ts","../src/createTable.ts","../src/tablePickerEntries.ts","../src/tablePicking.tsx","../src/refusals.ts","../src/enumLabels.ts","../src/FilePicker.tsx","../src/choiceNudge.ts","../src/PickOne.tsx"],"sourcesContent":["// src/tableRights.ts — @ai-matrx/records-ui (pure; also served by `@ai-matrx/records-ui/helpers`)\n//\n// What a person may do to one table, as the screens read it. `./host.tsx` (the React context the\n// screens ask) re-exports everything here; a host that builds rights by hand (`tableRightsAt`) at\n// boot reads this file alone and never pulls a screen.\n\nimport type { PermissionLevel } from \"@ai-matrx/records\";\nimport { NOT_ANSWERED_YET, whatYouMayDo, type WhatYouMayDo } from \"./rights\";\n\n/**\n * What a person may do to one table. The four words and the ladder are the\n * store's (`rights.ts`), not ours.\n *\n * `admin`, `comment` and `write` are kept with the names they have always had,\n * because every screen in this package and in the host apps reads them; they\n * are now the store's ANSWER rather than a host's guess.\n */\nexport interface TableRights extends WhatYouMayDo {\n /** SCR-2: holders of `admin` on the table see the \"+\" and the settings panel. */\n admin: boolean;\n /**\n * Why this answer, in one sentence. Kept for callers that show a single\n * reason; `why(what)` is the per-control sentence and is what the screens use.\n */\n reason: string;\n}\n\n/** Internal: the rights record for an answer (`host.tsx` folds the store's answers through it). */\nexport function tableRights(may: WhatYouMayDo, overallReason?: string): TableRights {\n return {\n ...may,\n admin: may.structure,\n reason: overallReason ?? (may.structure ? \"\" : may.why(\"structure\")),\n };\n}\n\n/**\n * Kept so a host that imported it still compiles. It is no longer any screen's\n * default: the store answers this question now, and a package that said \"I\n * assume nothing\" while holding the answer would be hiding controls from the\n * people who hold them.\n */\nexport const NO_RIGHTS: TableRights = tableRights(NOT_ANSWERED_YET);\n\n/**\n * THE ONE WAY TO BUILD A `TableRights` BY HAND — for a host with its own\n * authority, and for a suite that wants to mount one seat's screen. It takes\n * the LEVEL, never six booleans, so nobody can hand a screen a combination the\n * ladder cannot produce (write without read, share without edit).\n */\nexport function tableRightsAt(level: PermissionLevel | null): TableRights {\n return tableRights(whatYouMayDo(level, true));\n}\n","\"use client\";\n\n// src/host.tsx — @ai-matrx/records-ui\n//\n// THE ONE BINDING POINT. A host mounts `<RecordsUiProvider>` once, inside\n// `<RecordsProvider>` from @ai-matrx/records, and every component in this\n// package reads what it needs from here. There is no module-level state: two\n// organizations in two tabs must never share one.\n//\n// WHAT A HOST BINDS, AND WHAT HAPPENS WHEN IT DOES NOT\n// ----------------------------------------------------\n// `rights` USED TO BE the only answer to \"may this person administer this\n// table?\" — a PORT, whose default was `false` with a reason and whose only\n// other honest setting was `storeDecidesRights`: yes to everything, let the door\n// refuse afterwards. The sixth-pass verdict measured what that second answer\n// costs a person: a colleague at viewer got a live cell editor, typed, pressed\n// Enter, and was refused only then.\n//\n// THE STORE ANSWERS THIS NOW, through the door this lane added:\n// `custom.my_levels` says what level the CALLER holds on the subjects they\n// name, one call for a whole page. `rights` stays a PORT for a host whose\n// authority is genuinely its own, but nothing is guessed when it is unbound:\n// the store's own answer is the default, and `rights.why(...)` says, for each\n// thing a person may not do, what level it would take and who can give it.\n//\n// IT IS NOT FREE, AND THE OBVIOUS FREE VERSION IS WRONG. `custom.read_records`\n// answers `level` on every row and `tableList` is a read — but of the Table\n// KERNEL, so that level is the caller's level on the kernel (viewer, for\n// everybody) and not on the table the row describes. Carrying it was measured\n// wrong within the hour: a table's own owner came back \"viewer\". A table is a\n// record, and its level is asked for like any other record's.\n//\n// ABSENT OR HONEST, NEVER DEAD — and never offered-then-refused, which is the\n// same lie with a longer fuse.\n\nimport { createContext, useContext, useMemo, type ComponentType, type KeyboardEvent, type ReactNode } from \"react\";\nimport type { AggregateFilter, Field, PermissionLevel, RecordRead, RowAgentTarget, Table, Uuid } from \"@ai-matrx/records\";\nimport { useMyLevel, useMyLevels } from \"@ai-matrx/records/react\";\nimport type { ReversibleAnnouncement } from \"@ai-matrx/kit/reversible\";\nimport type { TableSettingsAgent } from \"./settingsAgent\";\nimport type { CalendarFeedPort } from \"./calendarFeed\";\n\nimport { NOT_ANSWERED_YET, whatYouMayDo, whatYouMayDoWithTable, type WhatYouMayDo } from \"./rights\";\nimport type { RecordChatContext } from \"./RecordChat\";\nimport type { EnrichAsk, EnrichOutcome } from \"./Enrich\";\nimport type { GridContextSnapshot } from \"./gridAgentContext\";\n\n/** What a host's map painter is given. Pins arrive unclustered; the painter clusters them for its zoom. */\nexport interface MapCanvasProps {\n pins: readonly import(\"./mapPins\").MapPin[];\n /** A pin (or the one record a badge names) was pressed: open that record. */\n onOpen: (recordId: Uuid) => void;\n /** The record the host has open, drawn as the selected pin. */\n selectedId?: Uuid | null | undefined;\n className?: string | undefined;\n}\n\nexport { NO_RIGHTS, tableRightsAt, type TableRights } from \"./tableRights\";\nimport { NO_RIGHTS, tableRights, type TableRights } from \"./tableRights\";\n\n/**\n * The authored-text slots `renderText` is asked to draw. `cell`: a long-text cell of the merged\n * grid and the whole-text dialog's preview — the host may return block content there (the grid\n * clips it to the row); the form slots take phrasing content only.\n */\nexport type RenderTextSlot = \"form-intro\" | \"form-help\" | \"form-thank-you\" | \"cell\";\n\nexport type { GridContextSnapshot } from \"./gridAgentContext\";\n\n/** One reference a chip names (`renderReference`). `record` is a relation's value, read side only. */\n/** What a record page hands the host's rich editor (`editRichText`). */\nexport interface RichTextEditProps {\n /** The stored Markdown. A later value is the store's echo or a colleague's change. */\n value: string;\n /** Every change the person makes, as the whole Markdown text. Saving is the package's. */\n onChange: (text: string) => void;\n readOnly: boolean;\n placeholder: string;\n}\n\n/**\n * What a multi-line text box hands the host's own text box (`textBox`): the words and a setter, and\n * what the box is for. The host draws its platform text box around them, with that box's \"…\" menu.\n */\nexport interface TextBoxProps {\n value: string;\n /** Every change, as the whole text. Saving stays the package's. */\n onChange: (next: string) => void;\n /** The column's name: the box's accessible name and what its menu calls the text. */\n label: string;\n rows: number;\n /** Where the box sits: an open grid cell, the whole-text editor, or a record form. */\n where: \"cell\" | \"whole-text\" | \"form\";\n id?: string | undefined;\n autoFocus?: boolean | undefined;\n readOnly?: boolean | undefined;\n disabled?: boolean | undefined;\n onKeyDown?: ((event: KeyboardEvent<HTMLTextAreaElement>) => void) | undefined;\n}\n\nexport interface ReferenceChipRef {\n token: string;\n id: Uuid;\n label: string | null;\n /** For `token: \"record\"`, the Table the relation points into. */\n tableId?: Uuid | undefined;\n /**\n * The record it names sits in Archived items. An archive keeps every reference to what it\n * archived (chair ruling B3-21), so the chip still names it and draws the archived state.\n */\n archived?: boolean | undefined;\n /** The record's (or its table's) icon — an emoji or short glyph — when the host knows one. */\n icon?: string | null | undefined;\n}\n\n/** One line typed into the table's Ask box, with the view the person was looking at (\"\" = none). */\nexport interface TableAskRequest {\n tableId: Uuid;\n question: string;\n viewId: string;\n}\n\n/** What the platform's `table.ask` agent answers: an answer, or edits it proposes for the person to apply. */\nexport interface TableAskAgentAnswer {\n mode: \"answer\" | \"proposed_edits\";\n /** Markdown. */\n answer: string;\n cited_record_ids: string[];\n proposed_changes: Array<{ record_id: string; field_key: string; from: unknown; to: unknown; reason: string }>;\n could_not: string[];\n}\n\nexport type TableAskOutcome =\n | {\n ok: true;\n answer: TableAskAgentAnswer;\n }\n /** A refusal says the real reason (`message`) and, when the host knows one, what to do (`hint`); no hint, none is invented. */\n | { ok: false; message: string; hint?: string | undefined };\n\n/** What `RecordsUiHost.writeSyncedCell` answers. */\nexport type SyncedCellOutcome =\n | { ok: true; status: \"written\"; version?: number | null }\n | { ok: true; status: \"conflict\"; sheetValue: string | null }\n | { ok: false; message: string };\n\nexport interface RecordsUiHost {\n /**\n * OPTIONAL. THE TABLE'S ASK BOX, ANSWERED BY AN AGENT. Bound, the box sends the typed line here and\n * draws the answer, the records it cites and any edits it proposes (each applied by the person,\n * against the record's version). Unbound, the box answers with the Question runner as before.\n */\n askTable?: ((ask: TableAskRequest) => Promise<TableAskOutcome>) | undefined;\n /**\n * OPTIONAL. WRITE-THROUGH FOR A SYNCED CELL (lane SYNC-AIRTABLE, CFL-058). A column the store keeps\n * from a source (`field.source === \"synced\"`) is written only by that source: bound, an edit of such\n * a cell is sent here (the host's server writes the connected Google Sheet first, then lands it) and\n * answers `written` (with the record's new version) or `conflict` (the sheet changed since the last\n * sync — the cell keeps both and the person picks; Retry sends `force`). A refusal is `{ ok: false }`\n * in the host's own words. Unbound, the store refuses the edit as before.\n */\n writeSyncedCell?:\n | ((cell: { tableId: Uuid; recordId: Uuid; fieldKey: string; value: unknown; force: boolean }) => Promise<SyncedCellOutcome>)\n | undefined;\n /**\n * Draws an icon kept as a NAME (\"Briefcase\" — how the store keeps an icon a person picked from the\n * icon list). A relation cell in an embedded table wears its record's icon; an emoji is drawn as\n * text and a name only through this port. Unbound (or `null` back), the page glyph stands in.\n */\n renderIcon?: ((name: string) => ReactNode) | undefined;\n /**\n * OPTIONAL. THE MAP LAYOUT'S PICTURE (lane AT-VIEWS). The platform has ONE map library (Leaflet, in the\n * host's app), so this package draws no map of its own: the host hands in the component that paints\n * tiles and the pins it is given (`MapCanvasProps`), re-clustering them with `clusterPins` as the zoom\n * moves. Unbound, the Map layout lists the located records beside a plain sentence saying no map is\n * installed here — never an empty rectangle.\n */\n mapCanvas?: ComponentType<MapCanvasProps> | undefined;\n /**\n * OPTIONAL. ADDRESS → PLACE for the Map layout. Resolve a postal address to coordinates through the\n * platform's one geocoder (the server's /geo path), `null` when no place answers to it, and THROW\n * when the lookup could not be made (so the layout says \"could not check\", not \"no such place\").\n * Unbound, a Map built on an address column says so and offers no lookup.\n */\n geocodeAddress?: ((address: string) => Promise<{ lat: number; lng: number } | null>) | undefined;\n /**\n * TEMPORARY (one-grid merge, steps 5-8). Which table grid draws: `classic` — the default Grid\n * as it shipped in 0.86; `merged` — the same grid with the older /data grid's control layer on\n * it (the column header menu, the right-click Cell / Row / Column / Table sections, column\n * settings, column order and hidden columns kept on the view). Left out: `classic`. Removed at\n * merge step 9, when `merged` is the only grid.\n */\n grid?: \"classic\" | \"merged\";\n /**\n * OPTIONAL. CLEAN A PASTED PIECE OF HTML INTO PLAIN TEXT (merge tranche 6m, inventory A7).\n *\n * A cell pasted from a web page or an email carries its tags, entities and inline styles. The\n * platform has ONE cleaner (the host's content-cleanup), so this is a port rather than a second\n * one here. The merged grid offers \"Clean HTML\" in a text cell's right-click Cell section and in\n * the whole-text editor; the cleaned text is written through the grid's own one-cell write (one\n * undo step). Unbound, the item is ABSENT, never dead.\n */\n cleanText?: (text: string) => string;\n /**\n * OPTIONAL. THE PRIVATE CALENDAR LINK (CAL-FEED-UI): the host's create / rotate / revoke / list doors\n * and the address its feed route answers at. Bound, a view with a date field offers \"Subscribe in\n * your calendar…\" in the table's menu. Unbound, the entry is ABSENT, never dead.\n */\n calendarFeed?: CalendarFeedPort;\n /**\n * OPTIONAL. WHERE THE PERSON IS IN THE GRID, told as it changes (merge tranche 6l, inventory H1).\n *\n * An agent in the host's side chat is asked about \"this cell\", \"these rows\", \"the table\". Only\n * the grid knows the table, its columns, the cell the cursor is on, the selected block, the\n * ticked rows, the rows on screen and the search. The merged grid calls this after any of them\n * changes (identical snapshots are not repeated); the host builds its agent scope from it. The\n * snapshot carries the store's own `Field` records and the masked documents exactly as drawn.\n * Unbound, nothing is built.\n */\n onGridContext?: (snapshot: GridContextSnapshot) => void;\n /**\n * OPTIONAL. THE PLATFORM'S ONE ICON PICKER (merge tranche 6j, inventory G2). A row action's\n * button may carry an icon from the canonical icon set; that set and its picker are the host's\n * (this package carries no icon library). Unbound, the row-action editor draws no icon control\n * and keeps whatever icon an action already carries.\n */\n iconPicker?: (props: { value: string; label: string; onChange: (name: string) => void }) => ReactNode;\n /**\n * OPTIONAL. HELP WRITING A FORMULA (Sheet retirement). The formula box hands the host what it\n * holds — the text, the table's other columns and the store's reading of what is wrong — and the\n * host draws its own help control beside the box (matrx-frontend runs its formula-writing job).\n * Whatever formula the help arrives at goes back through `onFormula` into the box, unsaved, for\n * the person to keep or change. Unbound, nothing is drawn.\n */\n formulaHelp?: (ask: FormulaHelpAsk) => ReactNode;\n /**\n * OPTIONAL. THE PLATFORM'S TEXT BOX FOR LONG TEXT (Sheet retirement). The Sheet edited a text cell\n * in the platform's one text box, whose \"…\" menu offers Clean up, Help with this…, Copy, Save to\n * notes and Share. Bound, the long-text cell editor, the whole-text editor and a record form's\n * long-text field draw the host's box with these props (one \"…\", no other chrome). Unbound, the\n * package's plain box.\n */\n textBox?: (props: TextBoxProps) => ReactNode;\n /**\n * OPTIONAL. AN AGENT OVER A TABLE'S SETTINGS (Sheet retirement). While the settings panel is open\n * it wraps itself in what this returns, handing the host a `TableSettingsAgent`: what the panel\n * can see (the description as edited, the row actions and the one being edited, what stops it\n * saving) and three staging calls (a whole row action, one step's formula, the description).\n * Staging never saves; the person presses Save. Unbound, the panel draws bare.\n */\n settingsAgent?: (args: { tableId: Uuid; agent: TableSettingsAgent; children: ReactNode }) => ReactNode;\n /** Answer the rights question for one table. Synchronous: a screen renders now. */\n rights?: (table: Table) => TableRights;\n /** Where a record's own page lives, when the host has one. A peek is used when it does not. */\n hrefForRecord?: (args: { table: Table; recordId: Uuid }) => string | undefined;\n /**\n * OPTIONAL. GO TO A PAGE OF THIS APP WITHOUT RELOADING IT (the router's push). Every \"open\" control that reaches a\n * `hrefForRecord` page goes through it, so the grid's ⤢ is one client-side move instead of a full page load that\n * drops the grid, its scroll and its selection. Unbound, the control assigns the location (a full load).\n */\n navigate?: (href: string) => void;\n /**\n * OPTIONAL. OPEN ONE RECORD WHERE THE HOST OPENS A RECORD, not at its page. A button that adds a row opens the\n * row it made through this port first: a host whose rows open in a peek or a panel of its own (a page of\n * Spaces) keeps the person where they are. Unbound, the press uses `hrefForRecord` + `navigate` as before.\n */\n openRecord?: (args: { table: Table; recordId: Uuid }) => void;\n /**\n * OPTIONAL. WHERE A FILE OPENS. A value too big for one cell is kept as a file and the cell\n * holds its first words (`@ai-matrx/records/core` `wholeValueOf`); this is the host's page for\n * that file. Unbound, the cell shows the words and says the whole text is kept as a file this\n * screen cannot open — never a dead link.\n */\n hrefForFile?: (args: { fileId: Uuid }) => string | undefined;\n /**\n * OPTIONAL. READ A FILE'S WHOLE TEXT, so an export writes a big value's whole content rather\n * than its first words. Unbound, the exported cell carries the words and one sentence naming\n * the file (`wholeValueNotRead`) — never the words passed off as the value.\n */\n readFileText?: (args: { fileId: Uuid }) => Promise<string>;\n /**\n * OPTIONAL. A FILE DRAWN AS A PICTURE — the gallery card's cover when the view's picture column\n * is a File column (lane DATA-V2-VIEWS-1). The host owns how a file becomes pixels (its media\n * lane, its auth), so this is a port: it returns the element that fills the cover box. Unbound,\n * the cover says in words that this screen cannot draw files, never a broken image.\n */\n fileImage?: (args: { fileId: Uuid; alt: string }) => ReactNode;\n /**\n * OPTIONAL. HOW AUTHORED TEXT READS. A form's intro, a question's help and the thank-you body\n * are written by a person and may carry markdown and math (`**bold**`, `\\\\(x^2\\\\)`, links).\n * This package does not parse markdown — the host owns its renderer — so this is a port: the\n * host returns phrasing content (valid inside a `<p>`). `where` names the slot. Unbound, the\n * text shows exactly as written.\n */\n renderText?: (text: string, where: RenderTextSlot) => ReactNode;\n /**\n * OPTIONAL. ONE REFERENCE, DRAWN AS A CHIP THAT OPENS WHAT IT NAMES (lane REFERENCE-CARRY).\n *\n * Every reference this package shows — a relation to a record (`token: \"record\"`, with the\n * Table it points into), an entity reference to a platform thing (`note`, `agent`, `workflow`…)\n * — is drawn through this port, so a person can always reach the thing (the host owns routes,\n * peeks and new tabs). `label` is the store's words, or null when they were withheld from this\n * reader. Unbound, the chip names the thing and opens nothing.\n */\n renderReference?: (ref: ReferenceChipRef) => ReactNode;\n /**\n * OPTIONAL. A VALUE THAT NAMES ITS OWN SHAPE, DRAWN THROUGH THE HOST'S KIND SYSTEM (lane\n * REFERENCE-CARRY). A cell holding `__kind` JSON — or a Matrx directive stored before the Kind\n * Directives merge (```matrx {\"matrx_version\":1,…}```) — is handed over whole (`kindValues.ts`);\n * the host decodes it with its one decoder and returns a compact rendering for `where` (a cell,\n * a panel row) that opens the real view. Unbound, the cell names the kind and shows the raw text\n * on hover — never the fence at eye level.\n */\n renderKind?: (args: { value: Record<string, unknown>; kind: string; where: \"cell\" | \"panel\"; title: string }) => ReactNode;\n /** The host's own link element, so routing stays the host's business. */\n Link?: (props: { href: string; children: ReactNode; className?: string }) => ReactNode;\n /** Toasts. Absent means the screen shows the sentence inline instead — never silence. */\n notify?: {\n /** `action`: one button on the toast (an Undo). A host without actions draws the sentence alone. */\n success: (message: string, action?: { label: string; run: () => void }) => void;\n error: (message: string) => void;\n /**\n * OPTIONAL. THE REVERSIBLE ACTION (`@ai-matrx/kit/reversible`): something this package did\n * that can be undone — a table archived — handed to the host's one announcer, which acts it\n * out at the person's level (taught the first time, a long Undo toast the next few, an ordinary\n * one after) and answers ⌘Z. The package says WHAT happened and HOW to undo it; where the\n * thing went (`foundAt`) is the host's routes. Unbound, the package falls back to `success`\n * with an Undo button.\n */\n reversible?: (announcement: ReversibleAnnouncement) => void;\n };\n /** Density for every table this package renders. */\n density?: \"condensed\" | \"normal\" | \"spacious\";\n /**\n * OPTIONAL. WHETHER A WITHHELD CONTROL SAYS WHAT LEVEL IT TAKES (\"You are Viewer here, and it takes\n * Editor to … Ask somebody who is Admin on it to move you up.\"). Default `true`. A host whose\n * person has no level to be moved up to — a template preview, a public look at a table — sets\n * `false`: the control stays absent exactly as before, without the sentence. It changes words\n * only, never what is offered.\n */\n sayLevelNeeded?: boolean;\n /** Hide record following where there is no signed-in person or durable store, such as a template preview. */\n hideRecordFollow?: boolean;\n /**\n * OPTIONAL. Where a file a person attached actually goes. A File is a record\n * in the kernel File Table (REC-31), but the BYTES are the host's file\n * service, not this package's business — so this is a port.\n *\n * Unbound, an attachment question does NOT draw a file chooser that quietly\n * loses the file: it says, in one sentence, that no file store is bound and\n * names this port. Absent or honest, never dead.\n */\n upload?: (file: File) => Promise<{ ok: true; fileId: Uuid } | { ok: false; reason: string }>;\n /**\n * OPTIONAL. THE HOST'S OWN FILE WINDOW (one-grid merge, inventory: the older grid's\n * AttachmentInput). An attachment cell adds files the person already holds through the host's\n * file picker — Airtable's \"Attach\" over your own files — rather than a second browser this\n * package would invent. `multiple`: the column holds several files; `accept`: the native\n * `accept` list, when the column restricts types. Resolves the host's file ids (the store turns\n * each into its kernel File record at the write door), or `null` when the person canceled.\n *\n * Unbound, the editor offers `upload` alone; with neither bound it says no file store is bound\n * (`NO_UPLOAD_REASON`) — never a dead button.\n */\n pickFiles?: (ask: { multiple: boolean; accept?: string }) => Promise<Uuid[] | null>;\n /**\n * Where this app serves its PUBLIC pages from, when that is not the origin\n * the screen is running on. A form's link is built here, so an owner copying\n * it from an admin host, a preview deployment or a desktop shell gets the\n * address a stranger can actually open — never `http://localhost:3000/f/…`\n * pasted into an email. Unbound, the browser's own origin is used.\n */\n publicOrigin?: string;\n /**\n * OPTIONAL. The organization's saved views as `platform.saved_view` holds\n * them — which is what a subscription points at (DOOR-18). The record store\n * has NO door onto that table, because it is the platform's and not the\n * store's, so this is a port rather than a read this package invents.\n *\n * Unbound, `NotifyRuleEditor` shows the subscriptions that exist and says, in\n * one sentence, that it cannot offer a view to subscribe to. It never renders\n * an empty picker that looks like \"you have no views\".\n */\n savedViews?: () => Promise<Array<{ id: Uuid; name: string }>>;\n /**\n * OPTIONAL. WHO IS IN THIS ORGANIZATION (FLD-11 `member`).\n *\n * A person field must offer PEOPLE. Who the people are is the platform's\n * answer — organization membership lives in `iam`, not in the record store —\n * and the store has no door onto it, so this is a port rather than a read\n * this package invents. `PersonPicker` resolves whoever is picked to their\n * record in the kernel Person Table, which is what the Field actually stores.\n *\n * Unbound, a person question is ABSENT with `NO_MEMBERS_REASON`. It never\n * falls back to listing the kernel Person Table's contents: that Table also\n * holds the Homes this package writes, and offering \"Comments Home\" as a\n * person is exactly what this port exists to stop.\n */\n members?: () => Promise<OrganizationMember[]>;\n /**\n * OPTIONAL. Open a person the screen names (a kept-aside person on a record page): the host\n * opens the Person record it is. Unbound, the name is shown and opens nothing.\n */\n openPerson?: (target: { recordId: string; userId?: string | null; email?: string | null; name?: string }) => void;\n /**\n * OPTIONAL. THE HOST'S OWN CHAT SURFACE (SCR-26).\n *\n * This package ships no chat UI, on purpose: AI Matrx has exactly one, it\n * lives in matrx-frontend (`AgentConversationColumn`), and it reads that app's\n * Redux store — so a second one here would drift within a month and a package\n * that imported the first would stop being a package. `RecordChat` therefore\n * builds the CONTEXT (the record, through the read door, with the masked\n * fields named) and hands it to this port.\n *\n * Unbound, the panel is ABSENT with that reason, never a composer that goes\n * nowhere.\n */\n chat?: (context: RecordChatContext) => ReactNode;\n /**\n * OPTIONAL. MORE SECTIONS ON AN OPEN RECORD — drawn in the record rail after its history,\n * one host-owned block about THIS record (e.g. \"What ran on this record\": the Workflow runs\n * stamped with it). Unbound, nothing is drawn.\n */\n recordSections?: (target: { tableId: Uuid; recordId: Uuid }) => ReactNode;\n /**\n * OPTIONAL. THE PLATFORM'S ONE RICH EDITOR, for a record page's body (lane TABLE-EXPERIENCE,\n * v7 item 1: a record is a page). The host draws its own editor — matrx-frontend's notes editor —\n * reporting every change through `onChange`; this package owns the saving. Unbound, the body is\n * drawn read-only and is edited through the record's form.\n */\n editRichText?: (props: RichTextEditProps) => ReactNode;\n /**\n * OPTIONAL. THE HOST DRAWS A RECORD PAGE'S WHOLE BODY (the \"Spaces\" page layer's block editor).\n * When bound and it returns non-null, the record page draws that in place of the package's own\n * body (the formatted-text column editor and its \"Write on this page\" offer); the host owns\n * saving. Returning `null` (or leaving it unbound) draws today's body unchanged.\n */\n renderRecordBody?: (args: {\n tableId: string;\n recordId: string;\n record: RecordRead;\n readOnly: boolean;\n /** Today's body as an element — return it (or null) where the host has no body of its own. */\n fallback: ReactNode;\n }) => ReactNode | null;\n /**\n * OPTIONAL. \"LINK A RECORD…\" — the HOST opens its one record picker pointed at this record and\n * writes the link through its own reference door; this package draws only the menu entry (a\n * card's ⋯ and right-click, the grid row's right-click). Unbound, the entry says it is not\n * available here.\n */\n linkRecord?: (target: { tableId: Uuid; recordId: Uuid; name: string }) => void;\n /**\n * OPTIONAL. \"TALK TO THIS RECORD\" — the HOST opens its own one chat surface\n * (AGT-N-9, PRODUCTS row 11).\n *\n * `chat` is the port that RENDERS a chat inside a panel this package draws.\n * This one is the other direction: a menu entry in the grid, the cell menu or\n * the record header says \"the person wants to talk about this record\", and the\n * host opens the chat where the host puts chats — full height, the platform's\n * own pattern — and binds the conversation to the record through\n * `conversationScopeBind`. Drawing a chat next to a grid row from inside this\n * package would be the parallel layer the canvas ruling forbids.\n *\n * ABSENT, NEVER DEAD: where neither this nor `chat` is bound, the entries do\n * not render at all.\n */\n talkToRecord?: (target: { tableId: Uuid; recordId: Uuid; title: string }) => void;\n /**\n * OPTIONAL. A TABLE'S AGENT BUTTON, PRESSED (TABLE-PARITY M3, lane DEFAULT-GRID-PARITY).\n *\n * A row action of kind `agent` (\"Ask Dr. Whitfield\") hands the row to an agent with the\n * action's own `prompt`. Only the host can start that conversation — this package ships no\n * chat — so the grid hands the row, the action's name and its prompt here, and the host\n * opens its one chat surface bound to the record with that prompt as the opening ask. It is\n * a separate port from `talkToRecord` because that one carries no prompt: a host that bound\n * only `talkToRecord` would open an empty chat and silently drop what the button was for.\n *\n * ABSENT, NEVER DEAD: unbound, agent buttons are not drawn.\n *\n * NO SECOND READ (lane GRID-TAILS, 2026-09-24). The grid already holds the table, its\n * columns, the row as this reader may see it and this reader's level on the row, so it hands\n * them over: a host needs no `tableList`, `fields`, `recordRead` or `myLevels` to start the\n * job, and the agent is handed exactly what the person was looking at.\n */\n // The target is `@ai-matrx/records`' `RowAgentTarget` — the same shape `createRecords({ rowAgent })` takes\n // (step 10, 2026-10-08), so one runner binds both.\n runAgentAction?: (target: RowAgentTarget) => void;\n /**\n * OPTIONAL. THE AI COLUMN'S RUNNER (SCR-27, custom-data PLAN §4 M2).\n *\n * An AI fill must be written with actor `agent` on behalf of the person, and\n * only the server can honestly say that — a browser stamping itself `agent`\n * is a browser claiming to be one. So `EnrichPanel` asks here, and the host\n * calls the server's one enrichment runner (`POST /v1/tables/{table}/ai-columns/{field}/run`,\n * model = the `table.column_fill` mandate), which lands each value through\n * `custom.enrich_land` as `agent` on the person's behalf.\n *\n * Unbound, no Fill control is drawn at all and the reason names this port.\n */\n enrich?: (ask: EnrichAsk) => Promise<EnrichOutcome>;\n /**\n * OPTIONAL. POINTS PER DOLLAR — the platform's rate. Every cost these screens show is\n * points at this rate (`costInPoints`); unbound, no cost is shown, never the vendor's money.\n */\n pointsRate?: number | null;\n /**\n * OPTIONAL. WHERE AN OFFLINE CAPTURE WAITS (SCR-30).\n *\n * `CaptureSheet` mints the id for a capture BEFORE it tries to send it, so a\n * phone with no signal has already decided what the write will be called.\n * Where that queue physically lives is the host's business — IndexedDB in a\n * browser, a file in a desktop app — so it is a port. Unbound, the sheet\n * keeps its queue in memory for the life of the page AND SAYS SO, because a\n * queue that silently died with the tab is the failure this exists to avoid.\n */\n captureQueue?: CaptureQueuePort;\n /**\n * OPTIONAL. THE HOST'S OWN SHARE DIALOG (SCR-N-5).\n *\n * This package ships no share dialog, ON PURPOSE, and for the same reason it\n * ships no chat: AI Matrx has exactly ONE sharing surface — matrx-frontend's\n * `features/sharing` ShareModal, with its people picker, its level picker, its\n * grant list and its \"who can see this, and why\" panel — and a second one here\n * would be a parallel sharing UI within a month. Sharing is the access model's\n * front door, and two front doors is how a platform ends up with two answers\n * to \"who can see this\".\n *\n * So `ShareControl` draws the BUTTON (which belongs on the record and table\n * screens, beside everything else a person does to a thing) and hands the\n * subject to this port, which returns the host's own dialog.\n *\n * Unbound, the button is ABSENT and `NO_SHARE_REASON` says which port to bind.\n * Never a Share button that opens nothing.\n */\n share?: (subject: ShareSubject) => ReactNode;\n /**\n * OPTIONAL. SHARE ONE SAVED VIEW BY LINK (lane VIEW-LINK). The view menu's \"Share view link…\" hands the view to this\n * port, which returns the host's own panel: make an Anyone link, copy it, see who made each, turn one off. The link\n * is the platform's Anyone link on that one view, read-only, so the sharing rules stay the host's. Unbound, the\n * menu has no such item (never an item that opens nothing).\n */\n shareViewLink?: (subject: ViewLinkSubject) => ReactNode;\n /**\n * OPTIONAL. URL PREVIEW (Airtable's \"Preview links\"). A URL cell shows the page's title, description, site icon and\n * image in a card on hover. `read` asks the host's SERVER for the page's metadata (the browser never fetches the\n * page itself) and answers null when there is nothing to show. Unbound, a URL cell is the plain link chip.\n */\n linkPreview?: {\n read: (url: string) => Promise<{\n title: string | null;\n description: string | null;\n siteName: string | null;\n faviconUrl: string | null;\n imageUrl: string | null;\n } | null>;\n };\n /**\n * OPTIONAL. WHO CAN SEE AND EDIT ONE COLUMN (access-setup PLAN §12, Store Tables). The column header's\n * \"Who can see and edit…\" item hands the column to this port, which returns the host's People involved\n * panel (it says who loses sight before anything is saved; table admins change it, never an agent).\n * Unbound, the item is ABSENT. The grid owns open/closed; the host owns the panel.\n */\n columnAccess?: (subject: ColumnAccessSubject) => ReactNode;\n /**\n * OPTIONAL. WHO ELSE IS LOOKING AT THIS TABLE (AIRTABLE-PARITY row 183). `join` opens the table's presence\n * room and answers the other people in it (name, avatar, color, the cell each has selected); the table's\n * toolbar draws their avatars and the grid outlines each person's selected cell in their color. The host\n * owns the transport - matrx-frontend binds `createRecordsPresencePort` from `@ai-matrx/records/realtime` on its\n * one realtime manager. Unbound, nothing is drawn (never a dead control).\n */\n presence?: import(\"./presence\").RecordsPresencePort;\n /**\n * OPTIONAL. THE ARCHIVED-ORGANIZATION DOOR (lane ARCHIVED-ORG-RESTORE). When the store refuses because the\n * organization is archived, `RefusalNotice` says so and asks this port two things: `state` - may THIS person\n * restore it (an owner or a super admin) - and `restore`, which calls the platform's one restore door. Left\n * unbound, the notice still says the organization is archived and who can restore it, and offers no button.\n */\n archivedOrganization?: {\n state: (organizationId: Uuid) => Promise<{ mayRestore: boolean; name?: string | null } | null>;\n restore: (organizationId: Uuid) => Promise<void>;\n /** Runs after a restore so the screen reloads; unbound, the page reloads. */\n afterRestore?: () => void;\n };\n /**\n * APPLETS ON A PAGE (v7 APPS-ON-DATA item 3). The host's applet system: which applets this person\n * may place (`list`), and the applet itself drawn in place (`render`). Unbound, a page offers no\n * Applet block and an applet block already on the page says it opens inside the app.\n */\n applets?: {\n list: () => Promise<ReadonlyArray<{ id: string; name: string }>>;\n render: (appId: string) => ReactNode;\n };\n /**\n * OPTIONAL. OPEN THE RECORDS BEHIND A NUMBER (SCR-16).\n *\n * Every number on a dashboard is a count of real records, and the whole\n * product row is that a person can get from the number to them: click the\n * \"Awaiting parts\" column and the grid opens on the twenty-eight jobs it\n * counted, with the block's own filter still on. That is one navigation, and\n * WHERE the grid lives is the host's routing — so it is a port, like\n * `hrefForRecord`, rather than a route string this package invents.\n *\n * Unbound, the marks are NOT clickable and the canvas says so in one\n * sentence naming this port. A chart whose bars looked pressable and did\n * nothing is the dead control this package does not ship.\n */\n openRecords?: (ask: OpenRecordsAsk) => void;\n /**\n * OPTIONAL. WHERE A PAGE OPENS (v6 lane 11, wave D). A Page is a dashboard record whose\n * `presentation.kind` is `\"page\"` (`pages.ts`); the host owns its route, so this hands back the\n * address of an existing page, or of the screen that makes a new one on a Table. Unbound, the\n * Dashboards area lists no pages and offers no \"New page\" — absent, never dead.\n */\n pageHref?: (\n target: { pageId: Uuid } | { newOnTable: Uuid } | { interfaceId: Uuid } | { newInterfaceOnTable: Uuid },\n ) => string;\n /**\n * OPTIONAL. ASK THE AGENT TO CHANGE THIS DASHBOARD (SCR-16).\n *\n * \"break it down by owner\" is how a dashboard is actually built — the agent\n * calls `dashboard_propose` on the server's `records` tool with this\n * dashboard's id and re-states it. Only the server can do that honestly (a\n * browser stamping itself `agent` is a browser claiming to be one), which is\n * the same reason `enrich` is a port, so this is one too.\n *\n * Unbound, the box is drawn DISABLED with one sentence naming this port —\n * never a composer that goes nowhere and never silence.\n */\n onReask?: (question: string, context: ReaskContext) => Promise<void>;\n /**\n * OPTIONAL. ASK AN AGENT FOR A WHOLE FORM, BOOKING PAGE, PORTAL OR DIGEST.\n *\n * This is the FASTER of the two ways every builder offers (`BuildOrAsk`), and\n * it is a port for the same reason `onReask` is: the server's `records` tool\n * is what calls `form_propose`, `booking_propose`, `portal_propose` and\n * `subscription_propose`, and a browser stamping itself `agent` would be a\n * browser claiming to be one.\n *\n * `suggestion` is the sentence this package would put in the person's mouth —\n * a host normally opens its composer with it already typed, so the person\n * edits rather than starts.\n *\n * Unbound, the \"Ask an agent\" button is ABSENT — not grayed — and every\n * builder's empty state says so in one sentence naming this port, with the\n * hand-built way still right there. The product walk of 2026-09-21 found the\n * opposite arrangement (the agent named and no builder at all), which left a\n * person who did not know what to say with nothing to press.\n */\n onAskForOne?: (ask: AgentBuildAsk) => void;\n}\n\n/** What the formula box hands the host's help (`formulaHelp`). */\nexport interface FormulaHelpAsk {\n tableId: Uuid;\n /** The formula as it stands in the box (may be empty). */\n text: string;\n /** The table's other columns, the ones the formula may read as {Name}. */\n columns: readonly Field[];\n /** The store's reading of what is wrong with the text, when it does not parse. */\n mistake: string | null;\n /** The functions the store works out, as a person types them. */\n functions: readonly string[];\n /** Put a formula into the box (unsaved). */\n onFormula: (text: string) => void;\n /**\n * What the formula is for, in a person's words, when it is not a formula column: a row action's\n * Work out step says which column it sets. Absent, it is a formula column.\n */\n purpose?: string | undefined;\n}\n\n/** What a person is asking an agent to make, and where they were standing. */\nexport interface AgentBuildAsk {\n /**\n * `column`: a layout needs a column the table lacks (`ViewNeeds`, lane DATA-V2-VIEWS-1) — the\n * agent adds it through the store's field door, held for approval like every agent schema change.\n */\n kind: \"form\" | \"booking\" | \"portal\" | \"digest\" | \"column\";\n tableId: Uuid;\n /** The sentence this package would say. A host opens its composer with it. */\n suggestion: string;\n}\n\n/**\n * WHAT A CLICK ON A NUMBER ASKS FOR. The filter is already merged: the block's\n * own filter (which `custom.dashboard_run` echoes back with the canvas bar\n * folded under it) with the clicked group's key and value over the top. A host\n * that dropped a key would open the grid on more records than the number\n * counted, which is the one way this control can lie.\n */\nexport interface OpenRecordsAsk {\n tableId: Uuid;\n filter: Record<string, AggregateFilter>;\n /** What the person clicked, in words: \"Jobs by stage this month · Awaiting parts\". */\n label: string;\n}\n\n/** Which dashboard a re-ask is about, so the agent re-states it rather than making a second one. */\nexport interface ReaskContext {\n tableId: Uuid;\n /** Null while the canvas has no dashboard yet — the answer is the first one. */\n dashboardId: Uuid | null;\n dashboardName: string | null;\n}\n\n/**\n * What a host's share dialog is being opened ON. A Table is a record in this\n * store (a `custom.record` row whose table is the Table kernel), so ONE subject\n * shape covers both screens and `kind` is what the sentences say, not what the\n * store looks up.\n */\nexport interface ShareSubject {\n kind: \"record\" | \"table\";\n /** The store is keyed (organization_id, id); this package never guesses one. */\n organizationId: Uuid;\n subjectId: Uuid;\n /** What to call it on screen. Never empty — the id's first eight characters at worst. */\n name: string;\n /** Close the dialog. The control owns the open/closed state, the host owns the dialog. */\n onClose: () => void;\n}\n\n/** One saved view, handed to the host's \"Share view link\" panel. */\nexport interface ViewLinkSubject {\n viewId: Uuid;\n tableId: Uuid;\n /** The view's name as the menu shows it. */\n name: string;\n /** Close the panel. The menu owns open/closed, the host owns the panel. */\n onClose: () => void;\n}\n\n/** One column, handed to the host's \"Who can see and edit\" panel. */\nexport interface ColumnAccessSubject {\n tableId: Uuid;\n fieldId: Uuid;\n /** The column's name as the grid shows it. */\n name: string;\n /** Close the panel. */\n onClose: () => void;\n /** Called after the panel saved a change, so the grid re-reads the Table's columns. */\n onChanged: () => void;\n}\n\n/** One member of the organization, in the words a person reads. */\nexport interface OrganizationMember {\n /** The platform's user id. This is what a Person record carries as `user_id`. */\n userId: string;\n /** Their display name, when the platform has one. */\n name?: string | null;\n email?: string | null;\n avatarUrl?: string | null;\n}\n\n/** The durable half of offline capture: read the queue, write it, that is all. */\nexport interface CaptureQueuePort {\n load: () => Promise<PendingCapture[]>;\n save: (pending: PendingCapture[]) => Promise<void>;\n}\n\n/** One capture waiting to be written, with the id the CLIENT minted for it. */\nexport interface PendingCapture {\n /**\n * The client key. Minted offline, before the first attempt, and never\n * re-minted on retry — that is exactly what lets the store's replay ledger\n * tell a retry from a second capture.\n */\n clientKey: string;\n tableId: Uuid;\n payload: Record<string, unknown>;\n capturedAt: string;\n device: string;\n /** How many times sending has been tried, and what the store last said. */\n attempts: number;\n lastRefusal?: string | null;\n}\n\n/**\n * The sentence the notify editor shows when no saved-view port is bound.\n *\n * FOR WHOEVER MAINTAINS THIS APP (never on the screen): bind `savedViews` on\n * `<RecordsUiProvider>` with the host's own list of `platform.saved_view` rows —\n * the record store has no door onto them — and the picker appears.\n */\nexport const NO_SAVED_VIEWS_REASON =\n \"There are no saved views here yet, so there is nothing to be told about. Save a view of this \" +\n \"table first and it will be offered here.\";\n\n/**\n * The sentence a person question shows when no membership port is bound.\n *\n * FOR WHOEVER MAINTAINS THIS APP (never on the screen): bind `members` on\n * `<RecordsUiProvider>` with the host's own roster. Who is in an organization is\n * the platform's answer, not the record store's, so this package will not guess.\n */\nexport const NO_MEMBERS_REASON =\n \"This app cannot offer the people in your organization on this screen yet, so there is nobody to \" +\n \"pick. Type the person's name into a text field for now, and tell us — it is on our list, not \" +\n \"yours.\";\n\n/**\n * The sentence shown when no share dialog is bound.\n *\n * FOR WHOEVER MAINTAINS THIS APP (never on the screen): bind `share` on\n * `<RecordsUiProvider>` with the app's own sharing dialog. AI Matrx has exactly\n * one, and this package deliberately does not ship a second.\n */\nexport const NO_SHARE_REASON =\n \"Sharing is not available on this screen, so there is no Share button here rather than one that \" +\n \"opens nothing. Share this table from the tables list instead.\";\n\n/**\n * The sentence a canvas shows when nothing is bound to open the records behind a number.\n *\n * FOR WHOEVER MAINTAINS THIS APP (never on the screen): bind `openRecords` on\n * `<RecordsUiProvider>`. Where this app puts its grid is the host's routing, not\n * this package's, so it will not guess an address.\n */\nexport const NO_OPEN_RECORDS_REASON =\n \"These numbers do not click through yet. Every one of them is a count of real records — open the \" +\n \"records view and group it by the same field to see them. It is on our list, not yours.\";\n\n/**\n * The sentence the re-ask box shows when no agent is bound.\n *\n * FOR WHOEVER MAINTAINS THIS APP (never on the screen): bind `onReask` on\n * `<RecordsUiProvider>`; it drives `dashboard_propose` on the server's `records`\n * tool with this dashboard's id. Only the server can honestly speak as an agent.\n */\nexport const NO_REASK_REASON =\n \"Changing this dashboard by describing it is not switched on here yet, so this box is off rather \" +\n \"than one that goes nowhere. Add and remove the blocks by hand above. It is on our list, not \" +\n \"yours.\";\n\n/**\n * The sentence an attachment question shows when no file store is bound.\n *\n * FOR WHOEVER MAINTAINS THIS APP (never on the screen): bind `upload` on\n * `<RecordsUiProvider>` with the host's file service and the chooser appears.\n */\nexport const NO_UPLOAD_REASON =\n \"This screen cannot take a file yet, so there is no chooser here rather than one that loses what \" +\n \"you pick. Put a link to the file in a text field for now. It is on our list, not yours.\";\n\nconst HostContext = createContext<RecordsUiHost | null>(null);\n\nexport function RecordsUiProvider({ value, children }: { value: RecordsUiHost; children: ReactNode }) {\n const bound = useMemo(() => value, [value]);\n return <HostContext.Provider value={bound}>{children}</HostContext.Provider>;\n}\n\nexport function useRecordsUi(): RecordsUiHost {\n return useContext(HostContext) ?? {};\n}\n\n/**\n * WHAT THIS PERSON MAY DO TO THIS TABLE — asked, once per table.\n *\n * A host that binds `rights` still wins: a portal, an embed or an app with its\n * own authority is entitled to a narrower answer than the store's. An unbound\n * host no longer gets a guess in either direction — while the door is\n * answering, `known` is false and NOTHING is offered and nothing is claimed.\n */\n/** The same answer, with its level sentences silenced when the host says so (`sayLevelNeeded`). */\nfunction quiet<T extends WhatYouMayDo>(may: T, say: boolean | undefined): T {\n if (say !== false) return may;\n return { ...may, why: () => \"\", ...(\"reason\" in may ? { reason: \"\" } : {}) };\n}\n\nexport function useTableRights(table: Table | null | undefined): TableRights {\n const host = useRecordsUi();\n const asked = useTableRightsAsked(table, host);\n return useMemo(() => quiet(asked, host.sayLevelNeeded), [asked, host.sayLevelNeeded]);\n}\n\nfunction useTableRightsAsked(table: Table | null | undefined, host: RecordsUiHost): TableRights {\n const bound = Boolean(host.rights);\n // A table is a record in this store, so its level is the same question.\n const asked = useMyLevel(bound || !table ? null : table.id);\n return useMemo(() => {\n if (!table) return NO_RIGHTS;\n if (host.rights) return host.rights(table);\n if (asked.loading) return tableRights(NOT_ANSWERED_YET);\n // A refusal is an ANSWER: the door said no, so this person holds nothing.\n const level = asked.error ? null : asked.data;\n return tableRights(whatYouMayDoWithTable(table, level, true));\n }, [host, table, bound, asked.loading, asked.error, asked.data]);\n}\n\n/**\n * WHAT THIS PERSON MAY DO TO ONE RECORD — which is a different question from\n * the table's, and the sixth-pass verdict is the proof: a record shared with a\n * colleague at Editor inside a table she holds at Viewer. The grid used to\n * label that row \"viewer\" while the store let her write to it.\n */\nexport function useRecordRights(recordId: Uuid | null): WhatYouMayDo {\n const asked = useMyLevel(recordId);\n const say = useRecordsUi().sayLevelNeeded;\n return useMemo(() => {\n if (!recordId) return NOT_ANSWERED_YET;\n if (asked.loading) return NOT_ANSWERED_YET;\n // A refusal is an ANSWER: the door said no, so this person holds nothing.\n if (asked.error) return quiet(whatYouMayDo(null, true), say);\n return quiet(whatYouMayDo(asked.data, true), say);\n }, [recordId, asked.loading, asked.error, asked.data, say]);\n}\n\n/**\n * The same question for a whole page of records, in ONE call — the door takes a\n * list precisely so a grid never makes one call per row.\n *\n * `enabled` is how a grid avoids asking at all in the ordinary case: when the\n * table level already admits editing, every row it returned is editable and\n * there is nothing a per-record answer could add.\n */\nexport function useRowRights(\n rowIds: Uuid[],\n enabled: boolean,\n): (rowId: Uuid) => WhatYouMayDo | null {\n const asked = useMyLevels(enabled ? rowIds : []);\n const say = useRecordsUi().sayLevelNeeded;\n return useMemo(() => {\n if (!enabled) return () => null;\n if (asked.loading) return () => NOT_ANSWERED_YET;\n if (asked.error) return () => quiet(whatYouMayDo(null, true), say);\n const held = asked.data ?? {};\n return (rowId: Uuid) => quiet(whatYouMayDo((held[rowId] ?? null) as PermissionLevel | null, true), say);\n }, [enabled, asked.loading, asked.error, asked.data, say]);\n}\n","// src/names.ts — @ai-matrx/records-ui\n//\n// WHAT A PERSON READS, NEVER WHAT THE MACHINE STORES.\n//\n// Measured on the real screens (independent verdict, 19 September): a table row\n// read `Saved views · 9 fields · records_ui_view`, a relation cell read a bare\n// `8f2c…` identifier, a header read `stage` because the Field's label was\n// blank, and the type word on a column tooltip read `long_text`. Airtable,\n// Notion and Linear never show a person an internal name; the verdict called\n// this one of the three things a first-time user feels within a minute.\n//\n// So every place this package prints something a person reads goes through one\n// of these three functions. They are deliberately dumb: they choose the best\n// human string that IS AVAILABLE and, when none is, say what the thing is\n// rather than printing the token. No screen in this package formats a name of\n// its own any more.\n\nimport type { Field, ReadRow, RecordDocument, Table } from \"@ai-matrx/records\";\nimport { isUuidShape } from \"@ai-matrx/kit/uuid\";\nimport { humanizeIdentifier } from \"@ai-matrx/kit/text-case\";\n\n/** The name of one Field, as a header, a form label or a peek's term. */\nexport function fieldName(field: Field): string {\n const label = (field.label ?? \"\").trim();\n // A LABEL THAT IS ONLY A MACHINE KEY is not a name (merged-grid review 2026-09-26): a table made\n // by an import or an agent kept `label: \"job_no\"`, and the header read `job_no`. A key joined by\n // underscores is written the way a person writes it (\"Job no\"). A single lowercase word the\n // owner typed (\"mobile\", \"title\") is their own words and is shown as they wrote it.\n if (label !== \"\" && label === field.key && /^[a-z0-9]+(?:[_.-][a-z0-9]+)+$/.test(label)) return humanizeIdentifier(label);\n if (label !== \"\") return label;\n const name = (field.name ?? \"\").trim();\n if (name !== \"\") return name;\n return humanizeIdentifier(field.key);\n}\n\n/** The name of one Table, as a card, a heading or a breadcrumb. */\nexport function tableName(table: Table): string {\n const name = (table.name ?? \"\").trim();\n if (name !== \"\") return name;\n const singular = (table.label_singular ?? \"\").trim();\n if (singular !== \"\") return singular;\n return humanizeIdentifier(table.slug ?? \"\");\n}\n\n/**\n * The name of one RECORD, for a chip, a card, a relation cell or a peek title.\n *\n * `titleKey` is the Table's own `title_field` when the caller knows the Table —\n * that is the store's answer to \"what makes this record a chip\" (REC-2) — and\n * the conventional keys are tried after it. A record with nothing readable is\n * NOT shown as a truncated uuid: it says it has no name yet, because \"8f2c1b0a\"\n * tells a person nothing and looks like a bug.\n */\nexport function recordName(\n document: RecordDocument | undefined,\n titleKey?: string | null,\n fallback = \"Untitled\",\n): string {\n const data = (document ?? {}) as Record<string, unknown>;\n const keys = [titleKey, \"title\", \"name\", \"label\", \"full_name\", \"subject\", \"summary\"].filter(\n (key): key is string => typeof key === \"string\" && key !== \"\",\n );\n for (const key of keys) {\n const value = data[key];\n // AN ID IS NEVER A NAME, AND THIS FUNCTION USED TO RETURN ONE (TAILS-2, 2026-09-21).\n // A Table's title column may be a RELATION, and a relation's stored value IS the other\n // record's id (FLD-6 / REL-1) — so `recordName` handed every caller a bare uuid for\n // every Table titled that way, which is how the board's unplaced list came to read\n // \"11 records are not in any of these columns — ca5f1ac7-…\". A caller that can resolve\n // the id resolves it (`scalarText` with the label lookup); a caller that cannot is\n // better off reading the next column, and then the fallback, than a hex number.\n if (typeof value === \"string\" && value.trim() !== \"\" && !looksLikeId(value.trim())) {\n return value.trim();\n }\n if (typeof value === \"number\") return String(value);\n }\n return fallback;\n}\n\n\n/**\n * Is this string the store's id for something, rather than words a person wrote?\n *\n * The same question `custom._card_words` asks on the database, with the same regex, so the\n * screen and the store agree about what is a name (TAILS-2, 2026-09-21).\n */\nexport function looksLikeId(value: unknown): boolean {\n return typeof value === \"string\" && isUuidShape(value.trim());\n}\n\n/** The same question for a row the read door returned. */\nexport function rowName(row: ReadRow | undefined, titleKey?: string | null, fallback = \"Untitled\"): string {\n return recordName(row?.document, titleKey, fallback);\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════════════\n// NAMING A RECORD WHOSE TABLE YOU ALREADY HOLD — ONE CALL, NOT A COPY PER SCREEN.\n// ═══════════════════════════════════════════════════════════════════════════════════════\n//\n// 🚨 WHY THESE TWO EXIST (lane RELATION-DISPLAY-2, 2026-09-21).\n//\n// `check:one-reference-builder` shipped with a baseline of SIX, and its own header said the\n// number was not zero because \"moving six surfaces onto the store door is real work\". Three\n// of the six were not asking the store's question at all. `Grid.tsx` names the row a person\n// is looking at for the Talk action; `Peek.tsx` names the record being peeked at;\n// `PortalsPanel.tsx` names the rows of the portal's own client Table; and this repo's\n// `TryEverythingScreen.tsx` does the same in two places. NONE of them is resolving a\n// RELATION — they hold the Table and they hold the document, and there is nothing to ask a\n// door about. What they were each doing by hand was the two-line join between them:\n//\n// recordName(row.document, table.title_field)\n//\n// Written out five times in four files, which is how a Table whose title column is `cname`\n// came to read \"Untitled\" on one screen and correctly on the next. It is the same question\n// as the store's, one rung down the ladder, and the same one answer should serve it — so it\n// lives HERE, in the file the guard exempts BY CONSTRUCTION as the primitive itself, and\n// every screen calls it instead of re-deriving it.\n//\n// WHAT THESE ARE NOT. They are not a second resolver and must never become one. They take a\n// Table a caller ALREADY HAS and a document it ALREADY HAS. The moment a caller is holding\n// an ID and wants words, that is the store's question and the answer is\n// `client.relationWords` / `client.relationWordsMany` — which ask the read-access ladder\n// BEFORE they read a name, apply that column's own display spec, and return the withheld\n// sentence for a record the reader may not open. Nothing in here can do any of that, and\n// nothing in here should try.\n\n/** A Table as far as naming is concerned — its own declared title column (REC-2). */\ntype TitledTable = Pick<Table, \"title_field\"> | null | undefined;\n\n/**\n * THE NAME OF A RECORD WHOSE TABLE YOU ALREADY HOLD.\n *\n * `table` is the Table the record belongs to; its `title_field` is the store's answer to\n * \"what makes this record a chip\" (REC-2) and is tried first, then the conventional keys,\n * then the fallback. A Table that has not loaded yet is `null` and the conventional keys\n * still answer — a name arriving a tick late is better than a screen that shows nothing.\n */\nexport function recordNameIn(\n table: TitledTable,\n document: RecordDocument | undefined,\n fallback = \"Untitled\",\n): string {\n return recordName(document, table?.title_field ?? null, fallback);\n}\n\n/**\n * THE NAME A CHANGE NOTICE USES — the record as it is AFTER the change (merged-grid tails,\n * 2026-09-26). Typing a first name into a row's label column read \"Changed Title on Untitled\":\n * the notice named the row from the document held before the write. The row is called what it is\n * called now; only when the change emptied its name does the notice use the name it had.\n */\nexport function changedRecordName(\n table: TitledTable,\n document: RecordDocument | undefined,\n key: string,\n after: unknown,\n): string {\n const now = recordName({ ...((document ?? {}) as Record<string, unknown>), [key]: after } as RecordDocument, table?.title_field ?? null, \"\");\n return now !== \"\" ? now : recordNameIn(table, document);\n}\n\n/** The same, for a row the read door returned. */\nexport function rowNameIn(table: TitledTable, row: ReadRow | undefined, fallback = \"Untitled\"): string {\n return recordName(row?.document, table?.title_field ?? null, fallback);\n}\n\n/**\n * WHAT A RELATION CHIP SAYS WHEN THE RECORD IT POINTS AT IS NOT YOURS.\n *\n * A relation joins two records in two tables, and holding one end says nothing\n * about the other: a Job shared with you may point at a Client nobody shared.\n * The chip then has three possible answers and only one of them is honest —\n * the target's TITLE is a leak, a bare id is a bug with a hex number in it, and\n * a permanent \"Loading…\" is a lie that never resolves.\n *\n * This is the SAME sentence `platform.relation_withheld_label()` answers on the\n * database, word for word, so a person reads one wording whether the screen or\n * the store worked it out. Changing it changes both (RELATION-DECLARE,\n * 2026-09-20).\n */\nexport const WITHHELD_RECORD_LABEL = \"A record you have not been given access to\";\n/**\n * WHEN THE STORE COULD NOT BE ASKED (a 503, a dropped connection) the name is UNREAD, not\n * withheld: saying \"not given access\" for a failed read lies about the data (W1.1 verifier,\n * 2026-10-02). This is what a reference reads until a later read answers.\n */\nexport const UNREAD_RECORD_LABEL = \"Couldn't load this name\";\n\n/**\n * THE PLURAL A PERSON READS, NEVER A MACHINE'S \"…ss\" (VERIFIER-16 M3 / VERIFIER-17 M3).\n *\n * A table the store or the mover never gave a real plural carries `name + \"s\"` — so a table\n * already named in the plural reads \"Customerss\", \"Status optionss\". That word was made by a\n * machine appending one letter, and it says nothing the name does not; it is never shown.\n * Returns the table's own plural when a person (or the example library) wrote one, and `null`\n * when the only plural on record is that appended letter.\n */\nexport function realPlural(table: { name?: string | null; label_singular?: string | null; label_plural?: string | null }): string | null {\n const plural = (table.label_plural ?? \"\").trim();\n if (plural === \"\") return null;\n for (const base of [table.name, table.label_singular]) {\n const b = (base ?? \"\").trim();\n if (b !== \"\" && plural === `${b}s`) return null;\n }\n return plural;\n}\n\n/**\n * ONE RECORD'S NOUN, IN A SENTENCE (\"Book a 30-minute visit\") — lane HANDOVER, 2026-09-28.\n *\n * Cedar Ridge Physical Therapy's booking page was titled \"Book a 30-minute Visits appointment\":\n * the table's NAME (a plural, a heading) was put where one record's noun goes. The noun is the\n * table's own singular (\"Visit\"), else its name, else the fallback; a Title-case word is written\n * the way a sentence writes it (\"visit\"), an acronym is kept (\"MRI scan\").\n */\nexport function singularNoun(\n table: { name?: string | null; label_singular?: string | null } | null | undefined,\n fallback = \"record\",\n): string {\n const word = (table?.label_singular ?? \"\").trim() || (table?.name ?? \"\").trim() || fallback;\n return word\n .split(/\\s+/)\n .map((w) => (/^[A-Z][a-z'’-]*$/.test(w) ? w.toLowerCase() : w))\n .join(\" \");\n}\n\n/**\n * A plural for a sentence (\"Check in ran on 2 appointments\"): the table's real plural, else the\n * singular with an \"s\" only when that does not double a final \"s\".\n */\nexport function pluralNoun(table: { name?: string | null; label_singular?: string | null; label_plural?: string | null } | null | undefined, fallback = \"record\"): string {\n const real = table ? realPlural(table) : null;\n if (real) return real;\n const singular = (table?.label_singular ?? \"\").trim() || fallback;\n return /s$/i.test(singular) ? singular : `${singular}s`;\n}\n\n\n// ═══════════════════════════════════════════════════════════════════════════════════════\n// WHAT A CARD IS TITLED BY (lane UI-FIX-18, VERIFIER-18 H5).\n// ═══════════════════════════════════════════════════════════════════════════════════════\n//\n// MEASURED 2026-09-24 on production: *ZZZ UI-QUICK-1 Rincon-style Jobs* (title column `title`)\n// grouped by Stage titled every kanban card \"false\" or \"true\". The board took the FIRST Field\n// the read door answered that was not the group column — here the *Urgent* checkbox — as the\n// title. A card is named by what names its record: the Table's own `title_field` first (REC-2),\n// then the conventional name keys, then the first words column in declared order. A yes/no\n// column, the column the board is grouped by and the store's own stamps never title a card.\n\nconst CONVENTIONAL_TITLE_KEYS = [\"title\", \"name\", \"label\", \"full_name\", \"subject\", \"summary\"];\n\nfunction canTitle(field: Field, excluded: ReadonlySet<string>): boolean {\n if (excluded.has(field.key)) return false;\n if (field.type === \"boolean\") return false;\n if (field.type === \"formula\" && (field.config ?? {})[\"system\"]) return false;\n return true;\n}\n\n/**\n * THE FIELD A CARD IS TITLED BY — kanban, calendar, gallery and pipeline alike.\n *\n * Order: the Table's `title_field` → a conventional name key (`title`, `name`, …) → the first\n * text column in declared `sort` order → the first other column that can title (never a\n * checkbox, never the group column, never a system stamp). `undefined` when nothing can, and\n * the card falls back to `rowName`, which says \"Untitled\" rather than \"false\".\n */\nexport function cardTitleField(\n fields: readonly Field[],\n titleKey: string | null | undefined,\n exclude: readonly (string | null | undefined)[] = [],\n): Field | undefined {\n const excluded = new Set(exclude.filter((k): k is string => typeof k === \"string\" && k !== \"\"));\n const ordered = [...fields].sort((a, b) => (a.sort ?? 100) - (b.sort ?? 100) || a.key.localeCompare(b.key));\n const byKey = (key: string) => ordered.find((f) => f.key === key && canTitle(f, excluded));\n if (titleKey) {\n const declared = byKey(titleKey);\n if (declared) return declared;\n }\n for (const key of CONVENTIONAL_TITLE_KEYS) {\n const found = byKey(key);\n if (found) return found;\n }\n return (\n ordered.find((f) => f.type === \"text\" && canTitle(f, excluded)) ?? ordered.find((f) => canTitle(f, excluded))\n );\n}\n","// src/plainWords.ts — @ai-matrx/records-ui\n//\n// THE ONE FORMATTER EVERY REFUSAL PASSES THROUGH.\n//\n// WHAT A PERSON READ (independent verdict, sixth pass, 19-20 September):\n//\n// \"You do not have access to this table, so custom.applicable_fields has\n// nothing to show you.\"\n// \"config.via names a relation Field of this same table, by its key… The\n// store's code for this was 23514.\"\n//\n// The verdict's third measured gap against Airtable, Notion and Linear was\n// exactly this: \"The machinery still shows through… two column types answer\n// with a contract row id and a SQL error number. Airtable, Notion and Linear\n// never show a person an internal name.\"\n//\n// WHY FILTERING THE HINT WAS NOT ENOUGH. The previous pass filtered the store's\n// HINT — the half written for whoever fixes the caller — and printed the\n// MESSAGE verbatim, because the store writes good messages. Most of them are\n// good. But the store's access refusals are built by `format()` from the DOOR'S\n// OWN NAME (`assert_client_may_change`: \"…so % may not write to it\", with the\n// door name substituted in), so the machine identity is IN the sentence a\n// person reads and no amount of hint-filtering reaches it.\n//\n// SO: ONE function, here, and every screen in this package renders what it\n// returns and nothing else. It does three things and refuses to do a fourth:\n//\n// 1. It KEEPS the store's own words wherever they are a person's words. The\n// store writes the best sentences in this feature (\"Being a member of the\n// organization is not by itself permission to rewrite somebody else's\n// row\") and this package does not rewrite them.\n// 2. It DROPS the clause that carries machine identity, by SHAPE — a\n// schema-qualified object, a document path, a contract row id, a SQLSTATE,\n// a uuid, a bare snake_case token. Dropped, never deleted: it joins the\n// SQLSTATE on the notice for whoever has to debug it.\n// 3. It ADDS a REMEDY — the sentence that says what to do now — keyed off the\n// store's own refusal code, because a refusal with nothing to do about it\n// is a dead end with an explanation.\n//\n// 4. It does NOT invent a diagnosis. When every clause of a message is\n// machine identity there is nothing honest left to say about the specifics,\n// so it says what happened in general terms and offers the remedy. Making\n// something up would be worse than the identifier it replaced.\n//\n// The guard for all of this is `demo/plain-words.test.tsx` plus the sweep in\n// `demo/honest.test.tsx`, which reads the RENDERED text of the real screens and\n// fails on any of the shapes below. A formatter nobody is forced through is a\n// formatter somebody bypasses next week.\n\nimport type { RecordsError } from \"@ai-matrx/records\";\n\n/**\n * MACHINE IDENTITY, BY SHAPE — never by a list of the sentences we happen to\n * have seen, because the next refusal is one nobody has read yet.\n *\n * `FLD-11:` / `REC-29:` / `AGT-7:` a contract row id\n * `custom.field_declare` a schema-qualified database object\n * `config.via` / `data.fields` a path inside a stored document\n * `retention_days` a document key, snake_case\n * `8f2c1b0a-…` a uuid\n * `23514` / `PT409` a SQLSTATE\n * `STORE-TAILS-3:` / `UI-FIX-19:` a build lane's tag (UI-FIX-19)\n */\nexport const MACHINE_IDENTITY: RegExp[] = [\n /\\b[A-Z]{2,4}-\\d{1,3}\\b/,\n // A build lane's tag: capital words joined by hyphens, then a colon (\"STORE-TAILS-3:\",\n // \"MOVE-AND-OUTSIDER:\"). A person never reads which lane wrote a sentence.\n /\\b[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+:/,\n /\\b(?:custom|platform|iam|history|public|auth|campaign_watch)\\.[a-z_]+/,\n /\\b(?:config|data|document|spec|patch)\\.[a-z_]+/,\n /\\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\b/i,\n /\\b[a-z][a-z0-9]*(?:_[a-z0-9]+)+\\b/,\n // Five characters of digits and capitals, at least one a digit — so `23514`\n // and `PT409` match and an emphatic `NEVER` does not.\n /\\b(?=[0-9A-Z]{5}\\b)(?=[0-9A-Z]*\\d)[0-9A-Z]{5}\\b/,\n];\n\n/** Whether any shape above appears in this text. */\nexport function isMachineIdentity(text: string): boolean {\n return MACHINE_IDENTITY.some((shape) => shape.test(text));\n}\n\n/**\n * Every fragment of `text` that a person should never have been shown. Used by\n * the suite to say WHAT it found rather than only that it found something.\n */\nexport function machineIdentityIn(text: string): string[] {\n const found: string[] = [];\n for (const shape of MACHINE_IDENTITY) {\n const all = new RegExp(shape.source, shape.flags.includes(\"g\") ? shape.flags : `${shape.flags}g`);\n for (const hit of text.matchAll(all)) if (hit[0]) found.push(hit[0]);\n }\n return [...new Set(found)];\n}\n\n/** What the notice is called. The store's code, in the words of what went wrong. */\nconst TITLE: Record<string, string> = {\n stale_write: \"Someone else wrote first\",\n door: \"You do not have access to this\",\n door_absent: \"That is not built yet\",\n refused_by_rule: \"That value was not accepted\",\n invalid_argument: \"That was not accepted\",\n not_found: \"Not there any more\",\n missing_reference: \"That points at something that is not there\",\n already_exists: \"That already exists\",\n not_supported: \"That cannot be done here\",\n store_limit: \"This has got as big as it can\",\n // 🚨 NOT \"THE SWITCH IS OFF\" (lane 7 W1 fix round 1). PGRST202 / PGRST205 land here, and the\n // commonest cause is a door this screen asks for that the database it talks to does not serve\n // YET — a release in flight. Telling the person her organization has its store switched off was\n // false (the switch is answered by its own door, `platform.unified_data_store_on`). Honest:\n // nothing happened, and it is ours, and it passes.\n store_not_served: \"This isn't available right now\",\n unreachable: \"We could not reach your data\",\n needs_approval: \"This is waiting on someone's approval\",\n stale_read: \"Your view of this is a moment behind\",\n timed_out: \"That took too long to answer\",\n internal: \"Something went wrong at our end\",\n};\n\n/**\n * WHAT TO DO NOW. One sentence per refusal code, and it is the whole reason\n * this file exists rather than a regular expression in `Refusal.tsx`: a\n * sentence that names what went wrong and nothing to do about it is a dead end.\n */\nconst REMEDY: Record<string, string> = {\n stale_write:\n \"Look at what they wrote. Keep theirs, or try again and yours goes on top.\",\n door:\n \"Ask somebody who administers this to share it with you at the level you need.\",\n door_absent:\n \"There is nothing to do here yet. It is on our list, not yours.\",\n refused_by_rule: \"Change the value so it passes, then try again.\",\n invalid_argument: \"Change what you entered, then try again.\",\n not_found:\n \"It may have been deleted. Go back to the list and open it again from there.\",\n missing_reference: \"Pick something that is still there.\",\n already_exists: \"Use a different name.\",\n not_supported: \"There is another way to do this — ask, and we will point you at it.\",\n store_limit: \"Split it up, or ask us to raise the ceiling for your organization.\",\n store_not_served: \"Nothing was changed. Try again in a few minutes.\",\n // 🚨 NOTHING WAS WRITTEN AND NOTHING WAS REFUSED (lane TAILS-6). The call\n // never arrived, so \"try again\" is the honest instruction rather than a\n // consolation — and saying nothing changed is the half a person actually\n // worries about.\n unreachable:\n \"Nothing was changed. Check your connection and open this again.\",\n needs_approval:\n \"Nothing was changed yet. The people who can approve it have been asked.\",\n stale_read: \"Open this again in a moment and it will be up to date.\",\n // 🚨 ONE REMEDY THAT IS TRUE OF EVERY DOOR (lane CHAIR-STORE-PERF, 2026-10-03). The store cancels the\n // WHOLE statement at its clock, so a timed-out door wrote nothing — a create, a column add and a page\n // read alike. \"Try a smaller page\" was written for the page read and was printed to a person adding\n // one row to a three-row table (clone walk, 2026-10-03; the clock was a lock another lane's\n // rehearsal held, not the row). A door whose page can shrink says so in its own hint, which wins here.\n // ONE SENTENCE, NOT TWO (lane TIMEOUT-ONE-SENTENCE, 2026-10-19): the shared timed-out sentence (\"That took too long.\n // Nothing was lost; try again.\") already says what happened and what to do, so the table adds NO second remedy\n // (\"Nothing was changed\" was also wrong on a read). Empty = the notice prints no remedy line and the one-line\n // form is the sentence alone. A door's own hint still wins.\n timed_out: \"\",\n internal:\n \"Nothing you did caused this. Try again, and tell us if it keeps happening.\",\n};\n\n/**\n * 🚨 A HINT THIS PACKAGE OR ITS CLIENT WROTE IS NOT A PERSON'S REMEDY.\n *\n * `refusalForAPerson` prefers the DOOR's own hint over the table above, because\n * the door that refused knows more about the way out than a code does. That is\n * right — but it assumed every hint came from the store. It did not: until\n * `@ai-matrx/records` 0.47.0 the client appended its OWN note to `hint` when it\n * met a SQLSTATE it did not know, and the machine-identity filter let it\n * through whenever the code was not exactly five characters (an empty code from\n * a dropped connection, or an HTTP status like `404`). So the Checklists tab of\n * a plumbing company's jobs table told its owner:\n *\n * @ai-matrx/records did not recognize SQLSTATE from checklistTemplates\n *\n * The client no longer writes there. This is the guard on the other side, by\n * SHAPE and not by that one sentence: a hint that talks about a package, a\n * SQLSTATE, or a `camelCaseDoor` is engineer text wherever it came from, and it\n * joins the engineer's line instead of a person's screen.\n */\nexport const ENGINEER_TEXT: RegExp[] = [\n /@ai-matrx\\//,\n /\\bSQLSTATE\\b/i,\n /\\bPostgREST\\b/i,\n /\\bIndexedDB\\b/i,\n // `<RecordsUiProvider>` — a component, on a screen.\n /<\\/?[A-Z][A-Za-z0-9]*\\s*\\/?>/,\n // `savedViews`, `openRecords`, `onReask` — an identifier, however it is\n // quoted. English does not write camelCase; code does.\n /\\b[a-z][a-z0-9]*[A-Z][A-Za-z0-9]*\\b/,\n // A backticked token is a thing you type into an editor, not a thing you do.\n /`[A-Za-z_][A-Za-z0-9_.]*`/,\n // \"bind X on Y\", \"pass X\", \"import X\" — an instruction to whoever maintains\n // the app, arriving on the screen of somebody who cannot act on it.\n /\\bbind\\s+[`'\"A-Za-z]/i,\n];\n\n/**\n * THE ONE GUARD ON A DOOR'S HINT. True when the hint is developer text and must never be\n * printed at a person: engineer shapes (package, SQLSTATE, component, camelCase, backticked\n * token), a code fence, stack-like lines, or a block too long to be one remedy (over 600).\n * Machine clauses INSIDE an otherwise plain hint are cut by `plainSentence`, not by this.\n */\nexport function isDeveloperHint(hint: string): boolean {\n const text = hint.trim();\n if (text === \"\") return false;\n if (text.includes(\"```\")) return true;\n if (/\\n\\s+at\\s+\\S+/.test(text)) return true;\n if (text.length > 600) return true;\n return isEngineerText(text);\n}\n\n/** The hint a person may read: cleaned to people's sentences, or null. The one place that decides. */\nexport function peopleHint(hint: string | null | undefined): string | null {\n const said = (hint ?? \"\").trim();\n if (said === \"\" || isDeveloperHint(said)) return null;\n return plainSentence(said).kept;\n}\n\n/** Whether this sentence was written for whoever maintains the code. */\nexport function isEngineerText(text: string): boolean {\n return ENGINEER_TEXT.some((shape) => shape.test(text));\n}\n\n/** The one shape every screen in this package renders a refusal from. */\nexport interface PlainRefusal {\n /** The heading. Never the store's code. */\n title: string;\n /**\n * What happened, in the store's own words where they are a person's words\n * and in ours where they are not. Never empty.\n */\n sentence: string;\n /** What to do now. Never empty. */\n remedy: string;\n /**\n * TRUE when `sentence` is the store's own words (UI-FIX-19): a notice is then HEADED by that\n * sentence, never by the generic `title` over it.\n */\n storeSaid: boolean;\n /**\n * Everything a person should not read, kept for whoever has to debug it: the\n * SQLSTATE, the hint written for a caller, and any clause dropped above.\n * Kept on the notice's `data-for-engineers` attribute only (UI-FIX-19): never a\n * tooltip, never text a screen can copy or read aloud; never deleted.\n */\n forEngineers: string;\n}\n\n/**\n * A sentence with its machine clauses taken out — or null when nothing honest\n * is left. Clauses are split on the joins the store's own `format()` templates\n * use (\"…, so custom.x may not write to it\", \"… — FLD-11: …\").\n */\nfunction withoutMachineClauses(sentence: string): { kept: string | null; dropped: string[] } {\n const dropped: string[] = [];\n // 🚨 A PARENTHETICAL ID IS EXCISED, NOT A REASON TO BIN THE SENTENCE AROUND IT\n // (lane LIMITS-FIX-UI, 2026-09-21). The store's own way out for a colleague who\n // is not in the organization — \"Invite them to the organization, share with\n // their organization instead (VIS-23), or, if they are a client rather than a\n // colleague, put them in a portal\" — was thrown away WHOLE because of those\n // eight characters, so a plumbing company trying to show one customer her own\n // jobs was told nothing at all about what to do instead. A contract id in\n // brackets is a footnote: lift it out and the sentence around it is a person's\n // sentence. It is still kept for the engineer, below.\n const footnotes: string[] = [];\n const withoutFootnotes = sentence.replace(/\\s*\\((?:see\\s+)?[A-Z]{2,5}-[A-Z0-9-]{1,8}\\)/g, (hit) => {\n footnotes.push(hit.trim());\n return \"\";\n });\n dropped.push(...footnotes);\n const clauses = withoutFootnotes\n .split(/(?:,\\s+so\\s+|\\s+—\\s+|\\s+--\\s+|\\s*\\|\\s*)/)\n .map((clause) => clause.trim())\n .filter((clause) => clause !== \"\");\n const kept = clauses.filter((clause) => {\n if (!isMachineIdentity(clause)) return true;\n dropped.push(clause);\n return false;\n });\n if (kept.length === 0) return { kept: null, dropped };\n // 🚨 A CLEANER THAT DROPPED NOTHING CHANGES NOTHING (same lane, same day).\n //\n // The split above is on the joins the store's `format()` templates use, and\n // \", so \" is one of them — which is also how ordinary English joins two\n // clauses. So \"That person is not in this organization, so they cannot be\n // given access to this table yet.\" came back out as \"That person is not in\n // this organization. they cannot be given access to this table yet.\" — a\n // sentence nobody wrote, with a lower-case word after a full stop, shown to\n // every person every time. Nothing was dropped from it; there was nothing to\n // clean. When that is true the sentence is returned exactly as the store wrote\n // it, and this function's re-joining only ever runs on a sentence it actually\n // took something out of.\n if (dropped.length === 0) return { kept: sentence.trim(), dropped };\n let joined = kept.join(\". \").replace(/\\.\\.+/g, \".\").trim();\n if (!/[.!?]$/.test(joined)) joined = `${joined}.`;\n return { kept: joined, dropped };\n}\n\n/**\n * THE PEOPLE-FACING SENTENCE OF A STORE MESSAGE, AND NOTHING AFTER IT (lane\n * RECORDS-UI-REFUSAL-TEXT, 2026-10-01). A refusal's message is one plain sentence,\n * then ` — ` and developer detail, or a second sentence written for whoever fixes the\n * caller. A person reads the first sentence only; the rest rides `forEngineers`.\n */\nfunction peopleSentence(message: string): { kept: string | null; dropped: string[] } {\n const [lead = \"\", ...tail] = message.split(/\\s+—\\s+|\\s+--\\s+/);\n // A full stop after an abbreviation or an initial (\"Ask Dr. Whitfield\", \"e.g. a quote\") is not an end.\n const sentences = lead.trim().split(/(?<=(?<!\\b(?:Dr|Mr|Mrs|Ms|St|vs|No|e\\.g|i\\.e|etc|[A-Z]))[.!?])\\s+/);\n const first = sentences[0] ?? \"\";\n const rest = [...sentences.slice(1), ...tail].map((part) => part.trim()).filter((part) => part !== \"\");\n const cleaned = plainSentence(first);\n return { kept: cleaned.kept, dropped: [...cleaned.dropped, ...rest] };\n}\n\n/**\n * THE ONE SENTENCE A PERSON READS FOR A REFUSAL — the store's first sentence, or the\n * title when nothing of it is a person's words. Never the hint, details, code or\n * SQLSTATE. Every place that needs a refusal as a string (a toast, a cell, a banner)\n * calls this and nothing else; `check:records-ui-refusal-text` fails on a raw\n * `error.message` / `error.hint` render anywhere else.\n */\nexport function refusalSentence(error: Pick<RecordsError, \"message\"> & Partial<RecordsError>): string {\n return refusalForAPerson(error as RecordsError).sentence;\n}\n\n/** Every sentence of a message, cleaned; the ones that cannot be cleaned are dropped. */\nfunction plainSentence(message: string): { kept: string | null; dropped: string[] } {\n const dropped: string[] = [];\n const kept: string[] = [];\n for (const raw of message.split(/(?<=[.!?])\\s+/)) {\n const sentence = raw.trim();\n if (sentence === \"\") continue;\n const cleaned = withoutMachineClauses(sentence);\n dropped.push(...cleaned.dropped);\n if (cleaned.kept) kept.push(cleaned.kept);\n }\n return { kept: kept.length === 0 ? null : kept.join(\" \"), dropped };\n}\n\n/** The example a pattern refusal carries in its detail, when it carries one. */\nfunction exampleOf(error: RecordsError): string | null {\n const detail = (error as { detail?: unknown }).detail;\n if (!detail || typeof detail !== \"object\") return null;\n const example = (detail as { example?: unknown }).example;\n return typeof example === \"string\" && example.trim() !== \"\" ? example.trim() : null;\n}\n\n/** What a statement timeout says of itself, in place of the database's own words. */\n// ONE SENTENCE EVERYWHERE: the same words as design-system's `TIMED_OUT_SENTENCE` (what every screen prints through\n// `refusalSaid`) and records' `TIMED_OUT_MESSAGE`. This file is the light helpers door, so it cannot import either\n// (design-system's root is heavy); `a-timeout-reads-as-the-platforms-sentence.test.tsx` fails if the three drift.\nconst TIMED_OUT_SAID = \"That took too long. Nothing was lost; try again.\";\n\n/**\n * THE FORMATTER. Every refusal a screen in this package shows goes through\n * here, and nothing in this package renders `error.message` directly.\n */\nexport function refusalForAPerson(error: RecordsError): PlainRefusal {\n const code = error.code ?? \"internal\";\n // A STATEMENT TIMEOUT is the database's words, never a person's (AT-SNAPJOB-2, 2026-10-19: a base rename showed\n // \"canceling statement due to statement timeout\"). Whatever way it arrived (the package's `timed_out`, SQLSTATE\n // 57014, or only Postgres' sentence on an error with no code) it reads as the timed-out refusal: its title and\n // remedy below, and a sentence of our own in place of the database's.\n const timedOut =\n code === \"timed_out\" ||\n (error as { sqlstate?: string }).sqlstate === \"57014\" ||\n /canceling statement due to statement timeout/i.test(String(error.message ?? \"\"));\n // A refusal THIS package wrote (`refusals.ts` marks it `ours`) is whole people-facing prose, a\n // count then a reason; only a door's message is cut after its first sentence.\n const ours = (error as { ours?: unknown }).ours === true;\n const hint = plainSentence(String(error.hint ?? \"\"));\n const message = ours ? plainSentence(String(error.message ?? \"\")) : peopleSentence(String(error.message ?? \"\"));\n\n const title = timedOut ? TITLE[\"timed_out\"]! : (TITLE[code] ?? \"That was refused\");\n\n // 🚨 ONE REMEDY, AND IT IS THE DOOR'S OWN WHEN THE DOOR HAS ONE (lane\n // LIMITS-FIX-UI, 2026-09-21).\n //\n // The table below is a FALLBACK, not an answer. `custom.share_grant` refuses a\n // colleague who is not in the organization with its own three ways forward —\n // *\"Invite them to the organization, share with their organization instead, or,\n // if they are a client rather than a colleague, put them in a portal\"* — and\n // this formatter used to print that AND then \"Change the value so it passes,\n // then try again\", which is not a thing anybody can do about a membership. Two\n // remedies, one of them wrong, is worse than one: a person follows the last\n // sentence they read. The door that refused knows more about the way out than\n // a table keyed on a code does, so its hint wins whenever it survived the\n // machine-identity filter, and the table answers when it did not.\n // 🚨 THE DOOR'S HINT IS THE REMEDY WHEN IT READS AS A PERSON'S SENTENCE (chair ruling,\n // 2026-10-01, restoring the 2026-09-21 one-remedy ruling). A hint that is developer text (a\n // SQL state, a snake_case name, a uuid, a code fence, a stack, a package or component name)\n // is never printed: it rides `forEngineers` and the code's table sentence is the remedy.\n const hintIsForEngineers = isDeveloperHint(String(error.hint ?? \"\"));\n // STORE-RULE-GAPS: a pattern that carries an example hands it over as DATA\n // (`detail.example`), because an example is the person's own shape of value.\n const example = exampleOf(error);\n const remedy =\n (example ? `Enter it like ${example}.` : null) ??\n (hintIsForEngineers ? null : hint.kept) ??\n (timedOut ? REMEDY[\"timed_out\"] : REMEDY[code]) ??\n REMEDY[\"internal\"]!;\n\n // The store's own sentence for what happened. Its hint is the REMEDY above\n // rather than more of this, so the two halves never say the same thing twice.\n // A STORE MESSAGE IS NEVER ENGINEER TEXT; a stand-in written by a client can\n // be, and a person must not read it. It still reaches the engineer's line.\n const messageIsForEngineers = isEngineerText(String(error.message ?? \"\"));\n const said = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? \"\" : (message.kept ?? \"\")).trim();\n\n const forEngineers = [\n error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,\n // The client's own note about a class it did not recognize, or a call that\n // never reached the store. It is rendered out of sight, never as a sentence.\n error.diagnostic ? error.diagnostic : null,\n messageIsForEngineers || timedOut ? `Message: ${error.message}` : null,\n error.hint && (hintIsForEngineers || hint.kept !== error.hint) ? `Hint: ${error.hint}` : null,\n message.dropped.length > 0 || hint.dropped.length > 0\n ? `Dropped from the person's view: ${[...message.dropped, ...hint.dropped].join(\" | \")}`\n : null,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return {\n title,\n // Nothing invented. When every clause was machine identity the title says\n // what happened and the remedy says what to do; a made-up diagnosis would\n // be worse than the identifier it replaced.\n sentence: said === \"\" ? `${title}.` : said,\n remedy,\n storeSaid: said !== \"\",\n forEngineers,\n };\n}\n\n/**\n * The same answer as one line, for a cell or a field where a block would break\n * the layout. Still one sentence and one remedy — never the sentence alone,\n * because half of this formatter's job is the thing to do next.\n */\nexport function refusalLineForAPerson(error: RecordsError): string {\n const plain = refusalForAPerson(error);\n // TWO SENTENCES, NOT ONE RUN-ON (VERIFIER-15/16): the store's rule message has no\n // full stop (\"Pressure (psi) has to be at least 0\"), and joining it to the remedy\n // read \"…at least 0 Send this column somewhere else\". A line ends its sentence.\n const sentence = plain.sentence.trim();\n const ended = sentence === \"\" || /[.!?…:]$/.test(sentence) ? sentence : `${sentence}.`;\n return `${ended} ${plain.remedy}`.trim();\n}\n\n/** The store refused because the request was missing something (22023 / invalid_argument): a decision, never text to print. */\nexport function refusalIsMissingInput(error: Partial<RecordsError>): boolean {\n return error.sqlstate === \"22023\" || error.code === \"invalid_argument\";\n}\n\n/**\n * A STORED SENTENCE WITHOUT ITS INTERNAL CODES (lane F2, D11). The store's older sentences — a kept-aside\n * reason, a migration note — end with the spec codes they were written against (\"(FLD-4 / T12)\",\n * \"(VAL-1)\"). Those codes are for the people who wrote the store; the store no longer writes them, and the\n * ones already saved come off here, wherever a person reads them.\n */\nexport function withoutInternalCodes(text: string): string {\n return text\n .replace(/\\s*\\((?:[A-Z]{2,}-\\d+[A-Za-z]?|T\\d+)(?:\\s*\\/\\s*(?:[A-Z]{2,}-\\d+[A-Za-z]?|T\\d+))*\\)/g, \"\")\n .replace(/\\s+([.,;])/g, \"$1\")\n .trim();\n}\n","\"use client\";\n\n// src/Refusal.tsx — @ai-matrx/records-ui\n//\n// THE ONE PLACE A REFUSAL IS SHOWN. It renders what `plainWords.ts` returns and\n// NOTHING ELSE — no `error.message`, no `error.hint`, no `error.sqlstate` in a\n// place a person reads. That is deliberate and it is the whole guard: a\n// formatter every screen has to go through is a formatter nobody bypasses, and\n// this component is the only door onto the screen a refusal has.\n//\n// The history, so it is not undone by accident. The fifth pass found the store's\n// HINT — written for whoever fixes the caller — printed at the person (\"FLD-11:\n// a lookup and a rollup both travel along a relation. config.via names a\n// relation Field of this same table, by its key.\"). The pass after it filtered\n// the hint and left the MESSAGE verbatim, on the reasonable grounds that the\n// store writes good messages. The sixth pass then found the machine identity\n// inside the MESSAGE — the access refusals are built by `format()` from the\n// door's own name — and printed at the person again, from the other half.\n//\n// So neither half is trusted by shape of ORIGIN any more. Both go through one\n// filter that judges by the shape of the TEXT, and what it drops is kept for an\n// engineer on the notice and in a screen-reader-only line, never deleted.\n\nimport type { ReactNode } from \"react\";\nimport type { RecordsError, Uuid } from \"@ai-matrx/records\";\nimport { archivedOrganizationId } from \"@ai-matrx/records/core\";\nimport { Alert, AlertDescription, AlertTitle, ErrorBox, TIMED_OUT_SENTENCE, cn } from \"@ai-matrx/design-system\";\n\nimport { ArchivedOrganizationNotice } from \"./ArchivedOrganizationNotice\";\nimport { isMachineIdentity, peopleHint, refusalForAPerson, refusalLineForAPerson } from \"./plainWords\";\nimport { refusalTimedOut } from \"./refusalSaid\";\n\n/**\n * Kept for callers outside this package that already ask the question. The\n * answer is `plainWords.ts`'s, so there is one shape list and not two.\n */\nexport function hintIsMachineIdentity(hint: string): boolean {\n return isMachineIdentity(hint);\n}\n\n/** The hint a PERSON should read, or null when it is written for an engineer. */\nexport function hintForAPerson(hint: string | null | undefined): string | null {\n const said = (hint ?? \"\").trim();\n if (said === \"\") return null;\n if (isMachineIdentity(said)) return null;\n return peopleHint(said) === null ? null : said;\n}\n\nexport function RefusalNotice({\n error,\n className,\n actions,\n onKeepEditing,\n onDiscard,\n onRetry,\n}: {\n error: RecordsError;\n className?: string | undefined;\n actions?: ReactNode | undefined;\n /**\n * KEEP EDITING / DISCARD (lane REFUSAL-SWEEP, 2026-09-23). Pass these ONLY where\n * an editor is open holding what the person typed and the refusal is about that\n * text: the notice then owns the two doors out, so the notice — never a clock —\n * decides how long the typed text is kept. Keep editing hands the person back\n * to their text; Discard throws it away and puts back what was there. A surface\n * with nothing typed to keep passes neither and gets no buttons.\n */\n onKeepEditing?: (() => void) | undefined;\n onDiscard?: (() => void) | undefined;\n /**\n * TRY AGAIN (AT-SLOW-2, 2026-10-19): the press that failed, run again. Pass it where the refused act\n * is safe to repeat as it was (ViewNeeds reads the table first, so a declare that landed is never made twice).\n */\n onRetry?: (() => void) | undefined;\n}) {\n const archivedOrg = archivedOrganizationId(error);\n if (archivedOrg) {\n return <ArchivedOrganizationNotice organizationId={archivedOrg as Uuid} error={error} className={className} />;\n }\n const said = refusalForAPerson(error);\n // A statement timeout reads as the shared \"That took too long…\" sentence, never Postgres' words (AT-SWEEP-2).\n const plain = refusalTimedOut(error) ? { ...said, sentence: TIMED_OUT_SENTENCE, storeSaid: true } : said;\n const doors =\n onKeepEditing || onDiscard || onRetry ? (\n <div className=\"flex flex-wrap items-center gap-1 pt-0.5\" data-refusal-doors=\"\">\n {onRetry ? (\n <button\n type=\"button\"\n data-refusal-retry=\"\"\n className=\"rounded border px-2 py-0.5 text-xs hover:bg-muted\"\n onClick={onRetry}\n >\n Try again\n </button>\n ) : null}\n {onKeepEditing ? (\n <button\n type=\"button\"\n data-refusal-keep-editing=\"\"\n className=\"rounded border px-2 py-0.5 text-xs hover:bg-muted\"\n onClick={onKeepEditing}\n >\n Keep editing\n </button>\n ) : null}\n {onDiscard ? (\n <button\n type=\"button\"\n data-refusal-discard=\"\"\n className=\"rounded border px-2 py-0.5 text-xs hover:bg-muted\"\n onClick={onDiscard}\n >\n Discard\n </button>\n ) : null}\n </div>\n ) : null;\n return (\n <Alert\n variant=\"destructive\"\n role=\"alert\"\n data-refusal-notice=\"\"\n className={cn(\"text-xs\", className)}\n // The host's error actions (copy for AI) get the store's own error — code,\n // SQLSTATE, hint — through the slot, never on the page (UI-FIX-19).\n errorFacts={{ message: plain.sentence, title: plain.title, error, origin: \"records-ui/RefusalNotice\" }}\n // 🚨 ENGINEER TEXT RIDES A DATA ATTRIBUTE, NEVER A TOOLTIP OR A HIDDEN LINE (UI-FIX-19,\n // VERIFIER-20 b). It was the notice's `title` and an `sr-only` paragraph: the Birchwood owner\n // hovering the refusal of her restore read \"SQLSTATE 23514. Hint: STORE-TAILS-3: …\", and a\n // copy of the page carried it. Whoever debugs it reads the attribute.\n {...(plain.forEngineers ? { \"data-for-engineers\": plain.forEngineers } : {})}\n {...(error.sqlstate ? { \"data-sqlstate\": error.sqlstate } : {})}\n >\n {/* THE STORE'S OWN SENTENCE IS THE HEADING when it gave one (UI-FIX-19): \"That value was not\n accepted\" over the real reason read as the reason. The generic title heads a notice only\n when nothing of the store's words survived. */}\n <AlertTitle className=\"text-xs font-medium\">{plain.storeSaid ? plain.sentence : plain.title}</AlertTitle>\n <AlertDescription className=\"space-y-1 text-xs\">\n {/* 🚨 A NOTICE NEVER SAYS THE SAME THING TWICE (lane LIMITS-FIX-UI, 2026-09-21).\n When every clause of the store's message was machine identity there is\n nothing of its own words left, and `refusalForAPerson` honestly falls back to\n the title — which this then printed AGAIN underneath it. A dental practice's\n owner read, on his own record: \"You do not have access to this. You do not\n have access to this. Ask somebody who administers this to share it with you\n at the level you need.\" Twice is not more true; it reads as a stutter, and it\n pushes the one useful line — the remedy — further down the box. */}\n {plain.storeSaid || plain.sentence.replace(/\\.$/, \"\") === plain.title ? null : <p>{plain.sentence}</p>}\n {/* NEVER A DEAD END: what happened, and then what to do about it. */}\n {plain.remedy === \"\" ? null : <p className=\"opacity-80\">{plain.remedy}</p>}\n {actions}\n {doors}\n </AlertDescription>\n </Alert>\n );\n}\n\n/** A small inline one, for a cell or a field where a block would break the layout. */\nexport function RefusalLine({\n error,\n className,\n onRetry,\n}: {\n error: RecordsError;\n className?: string | undefined;\n /** TRY AGAIN (AT-SWEEP-2): the press that failed, run again — shown for a statement timeout, which rolled back whole. */\n onRetry?: (() => void) | undefined;\n}) {\n const plain = refusalForAPerson(error);\n const timedOut = refusalTimedOut(error);\n const line = timedOut ? TIMED_OUT_SENTENCE : refusalLineForAPerson(error);\n return (\n <>\n <ErrorBox\n data-refusal-line=\"\"\n className={cn(\"whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]\", className)}\n message={archivedOrganizationId(error) ? \"This organization is archived. An owner can restore it.\" : line}\n error={error}\n origin=\"records-ui/RefusalLine\"\n // Engineer text on a data attribute, never a tooltip (UI-FIX-19).\n {...(plain.forEngineers ? { \"data-for-engineers\": plain.forEngineers } : {})}\n />\n {timedOut && onRetry ? (\n <button type=\"button\" data-refusal-retry=\"\" className=\"rounded border px-2 py-0.5 text-xs hover:bg-muted\" onClick={onRetry}>\n Try again\n </button>\n ) : null}\n </>\n );\n}\n","\"use client\";\n\n// src/ArchivedOrganizationNotice.tsx - @ai-matrx/records-ui\n//\n// AN ARCHIVED ORGANIZATION SAYS SO (lane ARCHIVED-ORG-RESTORE). The store's refusal for a member of an\n// archived organization carries the organization (`archivedOrganizationId`). `RefusalNotice` - the one place a\n// refusal is shown - draws THIS instead of the generic \"you do not have access\", on every screen at once.\n//\n// It says the organization is archived. An owner (or a super admin: the host's `archivedOrganization.state`\n// answers) gets \"Restore organization\", which calls the platform's one restore door and then reloads; anyone\n// else is told who can restore it. Never a dead end, never a button that does nothing: with no host port bound\n// there is no button, only the sentence.\n\nimport { useEffect, useState } from \"react\";\nimport type { RecordsError, Uuid } from \"@ai-matrx/records\";\nimport { Alert, AlertDescription, AlertTitle, cn } from \"@ai-matrx/design-system\";\n\nimport { useRecordsUi } from \"./host\";\n\nexport function ArchivedOrganizationNotice({\n organizationId,\n error,\n className,\n}: {\n organizationId: Uuid;\n error: RecordsError;\n className?: string | undefined;\n}) {\n const port = useRecordsUi().archivedOrganization;\n const [mayRestore, setMayRestore] = useState<boolean | null>(null);\n const [busy, setBusy] = useState(false);\n const [failed, setFailed] = useState<string | null>(null);\n\n useEffect(() => {\n let live = true;\n if (!port) {\n setMayRestore(false);\n return;\n }\n setMayRestore(null);\n port\n .state(organizationId)\n .then((answer) => {\n if (live) setMayRestore(answer?.mayRestore === true);\n })\n .catch(() => {\n if (live) setMayRestore(false);\n });\n return () => {\n live = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- one ask per organization\n }, [organizationId, port?.state]);\n\n const restore = async () => {\n if (!port || busy) return;\n setBusy(true);\n setFailed(null);\n try {\n await port.restore(organizationId);\n if (port.afterRestore) port.afterRestore();\n else if (typeof window !== \"undefined\") window.location.reload();\n } catch (thrown) {\n setFailed(thrown instanceof Error && thrown.message ? thrown.message : \"The organization could not be restored.\");\n setBusy(false);\n }\n };\n\n return (\n <Alert\n variant=\"destructive\"\n role=\"alert\"\n data-refusal-notice=\"\"\n data-archived-organization={organizationId}\n className={cn(\"text-xs\", className)}\n errorFacts={{ message: \"This organization is archived\", title: \"This organization is archived\", error, origin: \"records-ui/ArchivedOrganizationNotice\" }}\n >\n <AlertTitle className=\"text-xs font-medium\">This organization is archived</AlertTitle>\n <AlertDescription className=\"space-y-1 text-xs\">\n <p className=\"opacity-80\">\n Nothing was deleted. Everything here comes back the moment an owner of the organization, or a super admin, restores it.\n </p>\n {mayRestore === true ? (\n <button\n type=\"button\"\n data-restore-organization=\"\"\n disabled={busy}\n className=\"rounded border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-60\"\n onClick={() => void restore()}\n >\n {busy ? \"Restoring...\" : \"Restore organization\"}\n </button>\n ) : null}\n {mayRestore === false ? (\n <p data-restore-who=\"\" className=\"opacity-80\">\n Ask an owner of this organization to restore it.\n </p>\n ) : null}\n {failed ? <p data-restore-refused=\"\">{failed}</p> : null}\n </AlertDescription>\n </Alert>\n );\n}\n","// src/refusalSaid.ts — @ai-matrx/records-ui · lane AT-SWEEP-2 (2026-10-19)\n//\n// A STATEMENT TIMEOUT NEVER READS AS POSTGRES' WORDS. 57014 — \"canceling statement due to statement timeout\" — is\n// the database talking about itself, and the cancelled call rolled back, so nothing was lost. The sentence and the test\n// for it are @ai-matrx/design-system's (`TIMED_OUT_SENTENCE`, `isTimedOutError`), the SAME ones the host's `sayError`\n// uses; this file owns no copy of either. It is NOT part of the light helpers door (design-system root is heavy),\n// so `plainWords.ts` stays light and every SCREEN that prints a refusal reads it through here.\nimport type { RecordsError } from \"@ai-matrx/records\";\nimport { TIMED_OUT_SENTENCE, isTimedOutError } from \"@ai-matrx/design-system\";\n\nimport { refusalSentence } from \"./plainWords\";\n\n/** True when the store cancelled the call at its statement timeout (SQLSTATE 57014 / `timed_out`). */\nexport function refusalTimedOut(error: Pick<RecordsError, \"message\"> & Partial<RecordsError>): boolean {\n return isTimedOutError(error);\n}\n\n/** The one sentence a screen prints for a refusal: the shared timed-out sentence, else the store's own words made plain. */\nexport function refusalSaid(error: Pick<RecordsError, \"message\"> & Partial<RecordsError>): string {\n return refusalTimedOut(error) ? TIMED_OUT_SENTENCE : refusalSentence(error);\n}\n","\"use client\";\n\n// src/PickOrAdd.tsx — @ai-matrx/records-ui\n//\n// THE ONE \"PICK OR ADD\" BUILDER (lane STORE-RULE-GAPS, 2026-09-23).\n//\n// A button that opens a popover with a search box, the list of what can be picked, and — when\n// what was typed is not there — one line at the foot that makes it: Create “<typed>” for a\n// relation (a new record in the Table it points at), Add “<typed>” for a choice column that\n// takes other values (a new choice, added by the store as typed). The champions (Airtable,\n// Notion, Linear) end a picker's list with exactly that line, and they draw it the same way\n// everywhere, so this package draws it ONCE: `RelationPicker` and the open choice editor in\n// `editors.tsx` are both built from this, and neither carries a copy of the layout.\n//\n// What stays with the caller is what differs: which items there are, what picking one means,\n// what the add line says and does, and any state of its own above the list (a refusal, a\n// \"Reading…\", a ceiling) or at the foot (a name box, a refusal of the add).\n\nimport { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from \"react\";\nimport { PersonAvatar, PersonChip } from \"./personChip\";\nimport { BasicInput, Button, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, cn } from \"@ai-matrx/design-system\";\n\n/** What a list row and its chips need of a glyph: drawn in the text color, never a font. */\nfunction Glyph({ d, className }: { d: string; className?: string }) {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2.5} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className={className}>\n <path d={d} />\n </svg>\n );\n}\nconst TICK = \"m5 12 4 4L19 6\";\nconst CROSS = \"M18 6 6 18M6 6l12 12\";\nconst PLUS = \"M12 5v14M5 12h14\";\n\nexport interface PickOrAddItem {\n id: string;\n label: string;\n /** A second line that tells two same-named items apart. */\n detail?: string | null | undefined;\n picked: boolean;\n /** The tooltip; defaults to the label. */\n title?: string | undefined;\n /**\n * The item drawn AS A CHIP in these classes — a choice in the color its column keeps for it\n * (`choiceChipLookOf`), so the list reads the way the cell does. Absent: plain words.\n */\n chip?: string | undefined;\n /** Attributes a caller's tests and walks select by (e.g. `data-relation-candidate`). */\n attrs?: Record<string, string> | undefined;\n /** The row cannot be picked right now (a pick still being written). */\n disabled?: boolean | undefined;\n /** The row is a PERSON: their initials in a circle before the name (`personChip.tsx`). */\n person?: boolean | undefined;\n}\n\n/** A picked value, drawn at the head of the open list with its × (Airtable, Notion). */\nexport interface PickOrAddChip {\n id: string;\n label: string;\n /** The chip's color classes (`choiceChipLookOf`); absent: the plain record chip. */\n chip?: string | undefined;\n /** Takes it off. Absent: the chip is shown and cannot be taken off here. */\n onRemove?: (() => void) | undefined;\n /** A PERSON: drawn as the person chip, never the record chip. */\n person?: boolean | undefined;\n}\n\nexport interface PickOrAddProps {\n /** The trigger's accessible name, e.g. \"Pick for Category\". */\n triggerLabel: string;\n /**\n * The trigger's height. \"field\" (the default) is the height of the text box beside it in a form\n * (WALK3-FIX, 2026-10-07: Pick/Choose sat 4px shorter than the date box in the same grid row);\n * \"compact\" keeps the small button a filter row or a chooser draws.\n */\n triggerSize?: \"field\" | \"compact\" | undefined;\n /** The trigger's visible word, e.g. \"Pick\", \"Change\", \"Choose\". */\n triggerText: string;\n triggerId?: string | undefined;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n search: string;\n onSearch: (search: string) => void;\n items: PickOrAddItem[];\n onPick: (id: string) => void;\n /** Above the list: a refusal, a \"Reading…\", a ceiling reached. */\n notice?: ReactNode;\n /** When the list is empty. */\n empty?: ReactNode;\n /** The add line at the foot. Absent = no add line. */\n add?: { label: string; onAdd: () => void; disabled?: boolean | undefined } | null | undefined;\n /** The foot's own state, drawn in place of the add line when there is one (a name box, a \"Reading that table…\"). */\n foot?: ReactNode;\n /** Under the add line: a refusal of the add, with its own doors. */\n footNote?: ReactNode;\n /**\n * ENTER WITH NOTHING TO PICK when the foot is the caller's own (a choice cell's Add / Keep as\n * typed / Cancel question): what the question's first answer does (grids review 3, 2026-09-30: a\n * new choice word + Enter did nothing, while Tab then Enter added it). Absent: the add line.\n */\n onEnterWithNoMatch?: (() => void) | undefined;\n /**\n * ESCAPE PUTS EVERYTHING BACK (REVIEW-FIX 2, 2026-10-06). In a grid cell closing the list is the\n * cell's commit, so Escape — which only closed it — wrote whatever the list held, a choice taken\n * off by Backspace included. When given, Escape (from the search box or Radix's own dismiss) calls\n * this INSTEAD of closing: the cell's cancel, which writes nothing and shows what it held.\n */\n onEscape?: (() => void) | undefined;\n /**\n * IN A GRID CELL (lane CELL-EDITORS, 2026-10-06). No trigger button is drawn: the list hangs from\n * `children` — what the cell already shows — the way Airtable's and the old Sheet's lists hang from\n * the cell. Elsewhere (a record form) the trigger button opens it.\n */\n anchored?: boolean | undefined;\n /** What the anchored cell shows under its open list (its chips). */\n children?: ReactNode;\n /** What is picked, at the head of the open list, each with its × (Backspace takes off the last). */\n chips?: PickOrAddChip[] | undefined;\n /**\n * SEVERAL CAN BE PICKED: a pick keeps the list open, and Enter on an empty search — before the\n * arrows chose a row — finishes (the old Sheet's B2-04: Enter used to toggle the first row forever).\n */\n multi?: boolean | undefined;\n}\n\n/**\n * THE LIST'S OWN KEYS (merged-grid review 2, 2026-09-27, A2 — Airtable / Linear / Notion). While a\n * picker is open it owns its keystrokes: the search box takes letters and Space, ArrowUp/ArrowDown\n * move the highlight, Enter picks the highlighted row, Escape closes. TAB IS NOT ITS KEY (lane\n * CELL-EDITORS): it goes on to the cell, which saves and moves to the next one, as in every grid —\n * and in a form it moves to the next question. No other key leaks into the grid or the page behind.\n */\nexport function useListKeys(args: {\n count: number;\n /** Changes whenever what the list shows changes (the search): the highlight goes back to the top. */\n resetOn: unknown;\n onPick: (index: number) => void;\n /** Enter with nothing to pick (no match): the add line, when there is one. */\n onNothing?: (() => void) | undefined;\n onClose: () => void;\n /** Enter before the arrows moved (a several-choice list with an empty search): finish. */\n onFinish?: (() => void) | undefined;\n /** Backspace on an empty search: take off the last picked one. */\n onBackspaceEmpty?: (() => void) | undefined;\n /** Whether the search box is empty (Backspace and the finishing Enter read it). */\n searchEmpty?: boolean | undefined;\n}) {\n const { count, resetOn, onPick, onNothing, onClose, onFinish, onBackspaceEmpty, searchEmpty } = args;\n const [highlight, setHighlight] = useState(0);\n /** The arrows (not the pointer) chose the row: Enter then picks it rather than finishing. */\n const [moved, setMoved] = useState(false);\n useEffect(() => {\n setHighlight(0);\n setMoved(false);\n }, [resetOn]);\n const at = count === 0 ? -1 : Math.min(highlight, count - 1);\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n // Tab belongs to the cell (save and move on) or the form (the next question).\n if (event.key === \"Tab\") return;\n // THE OPEN PICKER OWNS EVERY OTHER KEY: never the grid's shortcut, never the cell's Enter commit.\n event.stopPropagation();\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n setMoved(true);\n if (count > 0) setHighlight((h) => (Math.min(h, count - 1) + 1) % count);\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n setMoved(true);\n if (count > 0) setHighlight((h) => (Math.min(h, count - 1) - 1 + count) % count);\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n if (onFinish && searchEmpty && !moved) onFinish();\n else if (at >= 0) onPick(at);\n else onNothing?.();\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n onClose();\n } else if (event.key === \"Backspace\" && searchEmpty && onBackspaceEmpty) {\n event.preventDefault();\n onBackspaceEmpty();\n }\n };\n return { highlight: at, setHighlight, onKeyDown };\n}\n\n/** One row of an open list: a fill when highlighted (it follows the pointer), a tick when picked. */\nexport function PickRow({\n label,\n detail,\n title,\n chip,\n picked,\n highlighted,\n disabled,\n attrs,\n icon,\n person,\n onPick,\n onPoint,\n}: {\n label: string;\n detail?: string | null | undefined;\n title?: string | undefined;\n chip?: string | undefined;\n picked: boolean;\n highlighted: boolean;\n disabled?: boolean | undefined;\n attrs?: Record<string, string> | undefined;\n /** A glyph in the tick's place (the add line's +). */\n icon?: \"plus\" | undefined;\n /** A person row: their circle before the name. */\n person?: boolean | undefined;\n onPick: () => void;\n onPoint: () => void;\n}) {\n const ref = useRef<HTMLButtonElement | null>(null);\n // THE HIGHLIGHT IS ALWAYS IN VIEW: the arrows walk past the list's visible edge and it follows.\n useEffect(() => {\n if (highlighted) ref.current?.scrollIntoView?.({ block: \"nearest\" });\n }, [highlighted]);\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"option\"\n aria-selected={picked}\n disabled={disabled ?? false}\n onClick={onPick}\n onMouseMove={onPoint}\n title={title ?? label}\n {...(attrs ?? {})}\n data-pick-highlighted={highlighted ? \"\" : undefined}\n className={cn(\n \"flex w-full min-w-0 items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none disabled:opacity-50\",\n highlighted ? \"bg-accent text-accent-foreground\" : \"\",\n )}\n >\n <span className=\"flex size-3.5 shrink-0 items-center justify-center\">\n {picked ? <span data-pick-tick=\"\" className=\"contents\"><Glyph d={TICK} className=\"size-3.5\" /></span> : null}\n {icon === \"plus\" ? <Glyph d={PLUS} className=\"size-3.5 text-muted-foreground\" /> : null}\n </span>\n {person ? <PersonAvatar name={label} size=\"md\" /> : null}\n <span className=\"min-w-0 flex-1\">\n {chip ? (\n <span className={cn(\"inline-flex max-w-full truncate rounded-md border px-1.5 py-0.5 text-xs font-medium\", chip)} data-records-choice-chip=\"\">\n {label}\n </span>\n ) : (\n <span className=\"block truncate\">{label}</span>\n )}\n {detail ? (\n <span className=\"block truncate text-xs text-muted-foreground\" data-tell-apart=\"\">\n {detail}\n </span>\n ) : null}\n </span>\n </button>\n );\n}\n\n/** What is picked, at the head of an open list: each a chip with its ×. */\nexport function PickChips({ chips }: { chips: PickOrAddChip[] }) {\n if (chips.length === 0) return null;\n return (\n <div className=\"flex flex-wrap gap-1 px-1 pb-1\" data-pick-chips=\"\">\n {chips.map((c) =>\n c.person ? (\n <PersonChip key={c.id} name={c.label} onRemove={c.onRemove} />\n ) : (\n <span\n key={c.id}\n data-pick-chip=\"\"\n title={c.label}\n className={cn(\n \"inline-flex max-w-full items-center gap-1 rounded-md border px-1.5 py-0.5 text-xs font-medium\",\n c.chip ?? \"bg-secondary text-secondary-foreground\",\n )}\n >\n <span className=\"min-w-0 truncate\">{c.label}</span>\n {c.onRemove ? (\n <button\n type=\"button\"\n aria-label={`Remove ${c.label}`}\n onClick={c.onRemove}\n className=\"shrink-0 rounded-sm opacity-60 hover:opacity-100\"\n >\n <Glyph d={CROSS} className=\"size-3\" />\n </button>\n ) : null}\n </span>\n ),\n )}\n </div>\n );\n}\n\nexport function PickOrAdd({\n triggerSize = \"field\",\n triggerLabel,\n triggerText,\n triggerId,\n open,\n onOpenChange,\n search,\n onSearch,\n items,\n onPick,\n notice,\n empty,\n add,\n foot,\n footNote,\n onEnterWithNoMatch,\n anchored,\n children,\n chips,\n multi,\n onEscape,\n}: PickOrAddProps) {\n // THE ADD LINE IS THE LIST'S LAST ROW (the old Sheet's \"Use / Add …\", Notion's \"Create\"): ranked\n // after every real match, so it never takes Enter from one, and the arrows reach it.\n const addRow = add && !foot ? add : null;\n const count = items.length + (addRow ? 1 : 0);\n /** Where the add row sits among the rows the keys walk: always after every item (one fixed spot). */\n const addAt = addRow ? items.length : -1;\n const itemAt = (index: number) => index;\n const removable = (chips ?? []).filter((c) => c.onRemove);\n const keys = useListKeys({\n count,\n resetOn: search,\n onPick: (index) => {\n if (index === addAt) {\n if (addRow && !addRow.disabled) addRow.onAdd();\n return;\n }\n const item = items[itemAt(index)];\n if (item && !item.disabled) onPick(item.id);\n },\n onNothing: onEnterWithNoMatch ?? (add && !add.disabled ? add.onAdd : undefined),\n onClose: () => (onEscape ? onEscape() : onOpenChange(false)),\n ...(multi ? { onFinish: () => onOpenChange(false) } : {}),\n ...(removable.length > 0 ? { onBackspaceEmpty: () => removable[removable.length - 1]?.onRemove?.() } : {}),\n searchEmpty: search === \"\",\n });\n const hasFoot = Boolean(foot) || Boolean(footNote);\n const addRowNode = addRow ? (\n <PickRow\n label={addRow.label}\n picked={false}\n icon=\"plus\"\n disabled={addRow.disabled}\n attrs={{ \"data-pick-add\": \"\" }}\n highlighted={addAt === keys.highlight}\n onPick={addRow.onAdd}\n onPoint={() => keys.setHighlight(addAt)}\n />\n ) : null;\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n {anchored ? (\n <PopoverAnchor asChild>\n <div data-pick-anchor=\"\" className=\"flex min-h-6 w-full min-w-0 flex-wrap items-center gap-1\" aria-label={triggerLabel}>\n {children}\n </div>\n </PopoverAnchor>\n ) : (\n <PopoverTrigger asChild>\n <Button id={triggerId} type=\"button\" size=\"sm\" variant=\"outline\" className={triggerSize === \"field\" ? \"h-9\" : undefined} aria-label={triggerLabel}>\n {triggerText}\n </Button>\n </PopoverTrigger>\n )}\n {/*\n * NO WIDTH HERE. The one picker primitive asks the design system for CONTENT sizing\n * and the system decides how wide that is (lane FIX-14): a `w-64` pasted on one\n * surface is what cut `Create “Marisol Okonkwo — 418 Calle Pu` mid-word. Content sizing\n * is never narrower than what it hangs from, so in a cell it is at least the cell's width.\n */}\n <PopoverContent\n sizing=\"content\"\n padding=\"xs\"\n align=\"start\"\n side=\"bottom\"\n sideOffset={anchored ? 2 : 4}\n animated={false}\n data-matrx-cell-editor=\"\"\n // Every key inside the open list is the list's (see `useListKeys`) — except Tab.\n onKeyDown={(event) => {\n if (event.key !== \"Tab\") event.stopPropagation();\n }}\n // Radix dismisses on Escape before the search box hears it: a cell's Escape is its cancel.\n onEscapeKeyDown={(event) => {\n if (!onEscape) return;\n event.preventDefault();\n onEscape();\n }}\n // The cell keeps its own focus story; closing never throws focus back at a trigger.\n onCloseAutoFocus={(event) => {\n if (anchored) event.preventDefault();\n }}\n >\n {chips ? <PickChips chips={chips} /> : null}\n <BasicInput\n value={search}\n onChange={(e) => onSearch(e.target.value)}\n onKeyDown={keys.onKeyDown}\n placeholder=\"Search\"\n aria-label={`Search — ${triggerLabel}`}\n autoFocus\n autoComplete=\"off\"\n className=\"mb-1 h-8 text-sm\"\n />\n {notice}\n <ScrollArea className=\"max-h-64\">\n <div role=\"listbox\" aria-label={triggerLabel} aria-multiselectable={multi ? true : undefined}>\n {items.map((item, index) => (\n <PickRow\n key={item.id}\n label={item.label}\n detail={item.detail}\n title={item.title}\n chip={item.chip}\n picked={item.picked}\n disabled={item.disabled}\n attrs={item.attrs}\n person={item.person}\n highlighted={index === keys.highlight}\n onPick={() => onPick(item.id)}\n onPoint={() => keys.setHighlight(index)}\n />\n ))}\n {addRowNode}\n </div>\n {items.length === 0 && empty ? empty : null}\n </ScrollArea>\n {hasFoot ? (\n <div className=\"mt-1 border-t pt-1\">\n {foot}\n {footNote}\n </div>\n ) : null}\n </PopoverContent>\n </Popover>\n );\n}\n","\"use client\";\n\n// src/personChip.tsx — @ai-matrx/records-ui\n//\n// A PERSON LOOKS LIKE A PERSON (lane CELL-EDITORS, night walk 2026-10-06). A person cell's chip was the\n// same purple chip a link to a record wears, and the person list had no faces, so \"Dr. Maria Chen\" and\n// a linked \"Maria Chen — Rincon\" customer read the same. A person is a round pill with their initials in\n// a circle and their name — never the link chip — in the cell, at the head of the open list, on every\n// row of the list and on the record page. Notion and Airtable draw people this way.\n//\n// THE INK IS BALANCED (DATA-DEFECTS-3, 2026-10-10): the pill padded 2px left (pl-0.5, hugging the circle) and\n// 8px right, and the dev guard read \"pill ink is off-centre: 2.0px left vs 8.0px right\" on every person chip.\n// Both sides take the same padding now (px-1.5), never one side shaved by hand.\n\nimport { cn } from \"@ai-matrx/design-system\";\nimport { getInitials } from \"@ai-matrx/kit/format\";\n\n/** A person's circle reads their name, handle or email the way the platform's one initials rule does. */\nconst PERSON_INITIALS = { splitHandles: true, dropHonorifics: true } as const;\n\n/** The circle with a person's initials. */\nexport function PersonAvatar({ name, size = \"sm\" }: { name: string; size?: \"sm\" | \"md\" }) {\n return (\n <span\n aria-hidden=\"true\"\n data-records-person-avatar=\"\"\n className={cn(\n \"inline-flex shrink-0 items-center justify-center rounded-full bg-foreground/10 font-medium text-foreground/80\",\n size === \"md\" ? \"size-5 text-[10px]\" : \"size-4 text-[9px]\",\n )}\n >\n {getInitials(name, PERSON_INITIALS)}\n </span>\n );\n}\n\n/** A person, as a cell, a list head and a record page show them: a round pill, their circle, their name. */\nexport function PersonChip({ name, onRemove, onOpen, className }: { name: string; onRemove?: (() => void) | undefined; onOpen?: (() => void) | undefined; className?: string | undefined }) {\n return (\n <span\n data-records-person-chip=\"\"\n title={name}\n className={cn(\"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-[11px] text-foreground\", className)}\n >\n <PersonAvatar name={name} />\n {onOpen ? (\n <button type=\"button\" onClick={onOpen} data-records-person-open=\"\" className=\"min-w-0 truncate hover:underline\">\n {name}\n </button>\n ) : (\n <span className=\"min-w-0 truncate\">{name}</span>\n )}\n {onRemove ? (\n <button type=\"button\" onClick={onRemove} aria-label={`Remove ${name}`} className=\"shrink-0 opacity-60 hover:opacity-100\">\n ×\n </button>\n ) : null}\n </span>\n );\n}\n","// src/recordVersions.ts — @ai-matrx/records-ui · moved whole to @ai-matrx/records/versions (2026-10-08); one instance (askOnce's cache) for both packages.\nexport * from \"@ai-matrx/records/versions\";\n","// src/createTable.ts — @ai-matrx/records-ui\n//\n// The one birth of a person-made Table now lives in @ai-matrx/records/core (headless, so the\n// extension and server-side births use it too — lane GRID-PRIMITIVES, 2026-09-24). This module\n// keeps records-ui's own import path and names.\n\n// The light subpath, never /core: this module is on the helpers entry's path, which must not carry the\n// store client. `ensureTable` (a call through the client) is imported from /core by the one screen that\n// makes a table (ReferenceBuilder).\n\nexport {\n declareTable,\n addFields,\n fieldDeclarationFor,\n tokenFor,\n DEFAULT_FIELDS,\n} from \"@ai-matrx/records/field-kinds\";\nexport type { NewTableSpec, NewFieldSpec, DeclareResult } from \"@ai-matrx/records/field-kinds\";\n","// src/tablePickerEntries.ts — @ai-matrx/records-ui (pure; also served by `@ai-matrx/records-ui/helpers`)\n//\n// THE RULE for which tables a \"choose a table\" control offers (the full reasoning heads\n// `./tablePicking.tsx`, which re-exports everything here and adds the hook and the toggle).\n// No React, no store call: a host's picker data and a server read ask the same answer.\n\n/** The facts a picker needs about one table, whichever list it came from. */\nexport interface PickerTable {\n id: string;\n name: string;\n platform_owned?: boolean | null | undefined;\n /** The Table document's own key for the same fact (`tableList()` spreads the document onto the Table). */\n kept_by_the_app?: boolean | null | undefined;\n /** `custom.table_facts`: which feature keeps it (`choices` for a value set). */\n kept_for?: string | null | undefined;\n /** `custom.data_home_tables`: the store's one word for what it is (`list` for a value set). */\n kind?: string | null | undefined;\n /** The table a value set belongs to (`custom.table_facts.used_in_table_id`). */\n used_in_table_id?: string | null | undefined;\n /** A checklist's steps, a booking page's slots, a workflow's states. */\n work_kind?: unknown;\n slug?: string | null | undefined;\n /** When the table was made — what tells two lists apart once their column is gone. */\n created_at?: string | null | undefined;\n}\n\n/** The slug prefix of the tables this package keeps for its own bookkeeping (saved views, forms …). */\nconst PLATFORM_TABLE_PREFIX = \"records_ui_\";\n\n/** The store's flag (`platform_owned`) or the Table document's own key (`kept_by_the_app`) — either says the app keeps it. */\nfunction keptByPlatform(table: PickerTable): boolean {\n return table.platform_owned === true || table.kept_by_the_app === true;\n}\n\n/** A value set: the List a choice column keeps its choices in. */\nexport function isValueSet(table: PickerTable): boolean {\n if (table.kept_for === \"choices\") return true;\n return table.kept_for == null && table.kind === \"list\" && keptByPlatform(table);\n}\n\n/** Anything the app keeps for itself rather than a table a person keeps. */\nexport function isKeptTable(table: PickerTable): boolean {\n return (\n keptByPlatform(table) ||\n isValueSet(table) ||\n Boolean(table.work_kind) ||\n (table.slug ?? \"\").startsWith(PLATFORM_TABLE_PREFIX)\n );\n}\n\nexport interface TablePickerEntry<T extends PickerTable> {\n table: T;\n id: string;\n /** Unique among the entries returned. */\n label: string;\n /** A value set (shown only with \"Show lists\", or because it is the chosen one). */\n isList: boolean;\n}\n\nexport interface TablePickerEntries<T extends PickerTable> {\n entries: TablePickerEntry<T>[];\n /** How many value sets \"Show lists\" would add — 0 means the control is not worth drawing. */\n listCount: number;\n}\n\nconst CHOICES_SUFFIX = / choices$/i;\n\n/**\n * THE ONE RULE. Tables first (by name), then — with `showLists` — the value sets, each named\n * \"<column> — <owning table>\". Any names still equal get \" (2)\", \" (3)\" so no two entries match.\n */\nexport function tablePickerEntries<T extends PickerTable>(\n tables: readonly T[],\n options: { showLists?: boolean; keep?: string | null | undefined } = {},\n): TablePickerEntries<T> {\n const byId = new Map(tables.map((t) => [t.id, t]));\n const lists = tables.filter(isValueSet);\n const listLabel = (t: T): string => {\n const column = t.name.replace(CHOICES_SUFFIX, \"\");\n // A LIST WHOSE COLUMN IS GONE: `custom.table_facts` names the list itself (or nothing) as where\n // it is used. Said so, and told apart by the day it was made — never by a counter.\n if (!t.used_in_table_id || t.used_in_table_id === t.id) {\n const made = madeOn(t.created_at);\n return made ? `${column} — no column · ${made}` : `${column} — no column`;\n }\n const owner = byId.get(t.used_in_table_id);\n // Owned by a table this person cannot see: its own name, as the store gave it.\n if (!owner) return t.name;\n return `${column} — ${owner.name}`;\n };\n const plain = tables\n .filter((t) => !isKeptTable(t) || (t.id === options.keep && !isValueSet(t)))\n .map((t) => ({ table: t, id: t.id, label: t.name, isList: false }))\n .sort((a, b) => a.label.localeCompare(b.label));\n const shownLists = lists\n .filter((t) => options.showLists || t.id === options.keep)\n .map((t) => ({ table: t, id: t.id, label: listLabel(t), isList: true }))\n .sort((a, b) => a.label.localeCompare(b.label));\n const entries = [...plain, ...shownLists];\n const seen = new Map<string, number>();\n for (const entry of entries) {\n const key = entry.label.toLowerCase();\n const n = (seen.get(key) ?? 0) + 1;\n seen.set(key, n);\n if (n > 1) entry.label = `${entry.label} (${n})`;\n }\n return { entries, listCount: lists.length };\n}\n\n/** \"Sep 3, 2026\" in the reader's own locale, or null when the store gave no date. */\nfunction madeOn(stamp: string | null | undefined): string | null {\n if (!stamp) return null;\n const at = new Date(stamp);\n if (Number.isNaN(at.getTime())) return null;\n return new Intl.DateTimeFormat(undefined, { month: \"short\", day: \"numeric\", year: \"numeric\" }).format(at);\n}\n","\"use client\";\n\n// src/tablePicking.tsx — @ai-matrx/records-ui · lane 10 VIEWS-AND-FIELDS W1-A\n//\n// WHICH TABLES A \"CHOOSE A TABLE\" CONTROL OFFERS — ONE RULE FOR EVERY PICKER.\n//\n// Every choice column makes a backing List (`kept_for = 'choices'`, named \"<column> choices\").\n// The link-target picker listed all of them beside the organization's tables: 64 entries on a\n// clinic's account, \"Status choices\" five times, no way to tell them apart. Four other pickers had\n// each grown their own inline filter for the same question (`!platform_owned` here, a lane check\n// there, `work_kind` somewhere else), and the one that had none flooded.\n//\n// THE RULE:\n// · by default a picker offers TABLES — never a value set or anything else the app keeps for\n// itself (the choice lists, checklist steps, booking slots, the app's own bookkeeping);\n// · \"Show lists\" adds the value sets, each named by its column and its owning table\n// (\"Status — Patient Visits\"), so no two visible entries share a name;\n// · the table already chosen is always offered, whatever it is, so a saved choice never vanishes.\n//\n// Which table is a value set, and which table owns it, are the store's facts\n// (`custom.table_facts`: `kept_for`, `used_in_table_id`; `custom.data_home_tables`: `kind`).\n// Nothing here guesses from a name except trimming the store's own \" choices\" suffix for the label.\n\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { withTablePlacement, type Table, type TablePlacementFact } from \"@ai-matrx/records\";\nimport { useRecordsClient, useTables } from \"@ai-matrx/records/react\";\nimport { Checkbox, cn } from \"@ai-matrx/design-system\";\n\nexport {\n isKeptTable,\n isValueSet,\n tablePickerEntries,\n type PickerTable,\n type TablePickerEntries,\n type TablePickerEntry,\n} from \"./tablePickerEntries\";\nimport type { PickerTable } from \"./tablePickerEntries\";\n\n/**\n * The organization's tables with the store's placement facts folded on (`kept_for`,\n * `used_in_table_id`), for a picker that reads `tableList()`. A store with no facts door, or one\n * that did not answer, leaves each table as `tableList()` gave it — its own `platform_owned`.\n */\nexport function usePickerTables(): { loading: boolean; data: Array<Table & PickerTable>; reload: () => void } {\n const client = useRecordsClient();\n const tables = useTables();\n const [facts, setFacts] = useState<TablePlacementFact[] | null | \"reading\">(\"reading\");\n // A table made FROM a picker (\"New table…\" in the link-target picker) is read again, list and\n // facts both, so the picker offers what it just made.\n const [nonce, setNonce] = useState(0);\n const reloadTables = tables.reload;\n const reload = useCallback(() => {\n reloadTables();\n setNonce((n) => n + 1);\n }, [reloadTables]);\n useEffect(() => {\n let alive = true;\n void client.tableFacts().then((answered) => {\n if (alive) setFacts(answered.ok ? ((answered.data as unknown as TablePlacementFact[] | null) ?? null) : null);\n });\n return () => {\n alive = false;\n };\n }, [client, nonce]);\n const data = useMemo(\n () => withTablePlacement(tables.data ?? [], facts === \"reading\" ? null : facts) as Array<Table & PickerTable>,\n [tables.data, facts],\n );\n return { loading: tables.loading || facts === \"reading\", data, reload };\n}\n\n/** The \"Show lists\" control beside a table picker. Drawn only when there are lists to show. */\nexport function ShowListsToggle({\n count,\n on,\n onChange,\n className,\n}: {\n count: number;\n on: boolean;\n onChange: (on: boolean) => void;\n className?: string | undefined;\n}) {\n if (count === 0) return null;\n return (\n <label className={cn(\"flex items-center gap-1.5 text-[11px] text-muted-foreground\", className)}>\n <Checkbox checked={on} onCheckedChange={(next) => onChange(next === true)} aria-label=\"Show lists\" />\n Show lists ({count})\n </label>\n );\n}\n","// src/refusals.ts — @ai-matrx/records-ui · moved whole to @ai-matrx/records/versions (2026-10-08); one instance (askOnce's cache) for both packages.\nexport * from \"@ai-matrx/records/versions\";\n","// src/enumLabels.ts — @ai-matrx/records-ui\n//\n// ONE LABEL MAP PER ENUM. NOTHING ELSE IN THIS PACKAGE OWNS A COPY.\n//\n// Lane FRONT-DOOR's finding (2026-09-21): about twenty sites in this package\n// turned an enum VALUE the store already canonicalizes into a person-facing\n// word, each one on its own — worst example, `ChecklistRunner.tsx` called the\n// work-due state \"finished\" **\"Done\"** while `ActionInbox.tsx`, reading the\n// SAME `WorkDueState` off the SAME `custom.work_inbox`/`checklist_run` doors,\n// called it **\"Finished\"**. A person moving between a table's checklist tab\n// and her inbox saw two different words for one fact about her own work.\n//\n// So every enum this package draws a label for is named ONCE, here, keyed by\n// its canonical values — imported from `@ai-matrx/records` wherever the store\n// exports a named type/const for it, and named locally (with the reason) where\n// it does not. A panel imports the map; it never writes its own.\n//\n// THE GUARD: `enumLabels.test.tsx` renders every converted panel's label\n// function over the FULL canonical value list of its enum (pulled from\n// `@ai-matrx/records`, not retyped) and fails the moment a value has no entry\n// or a caller falls through to the raw token. See that file for RED/GREEN.\n\nimport type {\n ChecklistRequirementKind,\n ContextPolicy,\n FieldSensitivity,\n StageRuleOnFail,\n SubscriptionCadence,\n WorkDueState,\n WorkInboxKind,\n WorkApprovalState,\n} from \"@ai-matrx/records\";\n\n/**\n * An array literal checked, AT COMPILE TIME, to name every member of `T` and no\n * extra one. `WorkDueState`, `WorkInboxKind`, `ChecklistRequirementKind` and\n * `SubscriptionCadence` are typed unions in `@ai-matrx/records` with no\n * runtime array exported alongside them — so this is how the four `*_VALUES`\n * lists below stay tied to the PACKAGE'S OWN TYPE instead of drifting from it\n * by hand: add a sixth `WorkDueState` in `@ai-matrx/records` and `tsc` refuses\n * this file until the array is updated to name it too. The census test below\n * imports these arrays rather than the store's raw union so it is exercising\n * the same list this file's label maps are keyed against.\n */\nfunction exhaustiveValuesOf<T extends string>() {\n return function <const U extends readonly T[]>(values: [T] extends [U[number]] ? U : never): U {\n return values as U;\n };\n}\n\n// ── work due state — WorkDueState (packages/records/src/work.ts) ───────────\n//\n// Shared by a checklist step (`checklist_run().due_state`) and a work-inbox\n// row (`work_inbox().due_state`, `work_list().due_state`) — ONE enum, drawn in\n// both a checklist runner and an approvals inbox. This is the pair the finding\n// named: \"finished\" read \"Done\" in one and \"Finished\" in the other. **\"Done\"\n// wins** — it is the word a non-technical business owner actually says out\n// loud about a piece of work (\"is that job done yet?\"), it is one syllable\n// shorter than the other four words in this set are used to being read\n// alongside (\"Overdue\", \"Today\", \"Scheduled\", \"No date\"), and \"Finished\" reads\n// more like a formal status report than a plain answer to \"is it done\".\nexport const WORK_DUE_STATES = exhaustiveValuesOf<WorkDueState>()([\n \"overdue\",\n \"due_today\",\n \"scheduled\",\n \"undated\",\n \"finished\",\n]);\nexport const DUE_STATE_LABEL: Record<WorkDueState, string> = {\n overdue: \"Overdue\",\n due_today: \"Today\",\n scheduled: \"Scheduled\",\n undated: \"No date\",\n finished: \"Done\",\n};\n\n// ── work inbox kind — WorkInboxKind (packages/records/src/work.ts) ─────────\nexport const WORK_INBOX_KINDS = exhaustiveValuesOf<WorkInboxKind>()([\"assignment\", \"approval\", \"proposal\"]);\n// UI-FIX-19 (VERIFIER-19 #6): a kind is a NOUN. \"Approve\" in the row's bordered kind badge read as\n// a live Approve control on every withdrawn and decided item; only a control may be a verb.\nexport const WORK_INBOX_KIND_LABEL: Record<WorkInboxKind, string> = {\n assignment: \"Assigned\",\n approval: \"Approval\",\n proposal: \"Agent proposal\",\n};\n/** The heading an inbox grouped by kind reads (lane S5-PRIME) — plural, the way Linear groups. */\nexport const WORK_INBOX_KIND_GROUP_LABEL: Record<WorkInboxKind, string> = {\n approval: \"Approvals\",\n proposal: \"Agent proposals\",\n assignment: \"Assigned to you\",\n};\n\n// ── approval state — WorkApprovalState (packages/records/src/work.ts) ──────\n// Lane S5-PRIME: a closed item says what happened to it. `withdrawn` is the store's own close —\n// the thing it would change was archived — never a person's decision.\nexport const WORK_APPROVAL_STATES = exhaustiveValuesOf<WorkApprovalState>()([\"pending\", \"approved\", \"declined\", \"withdrawn\"]);\nexport const WORK_APPROVAL_STATE_LABEL: Record<WorkApprovalState, string> = {\n pending: \"Waiting\",\n approved: \"Approved\",\n declined: \"Declined\",\n withdrawn: \"Withdrawn\",\n};\n\n// ── checklist requirement kind — ChecklistRequirementKind (checklist.ts) ───\nexport const CHECKLIST_REQUIREMENT_KINDS = exhaustiveValuesOf<ChecklistRequirementKind>()([\n \"none\",\n \"note\",\n \"answer\",\n \"record_field\",\n \"form\",\n \"document\",\n]);\nexport const CHECKLIST_REQUIREMENT_LABEL: Record<ChecklistRequirementKind, string> = {\n none: \"\",\n note: \"Say what you did\",\n answer: \"Fill this in\",\n record_field: \"This has to be filled in on the record\",\n form: \"This step is a form\",\n document: \"This step is a document\",\n};\n\n// ── field sensitivity — FieldSensitivity (vocabulary.ts, FLD-12/AGT-7) ─────\nexport const FIELD_SENSITIVITY_LABEL: Record<FieldSensitivity, string> = {\n public: \"Anyone who can open the record\",\n internal: \"People in this organization\",\n confidential: \"People who have been given the record\",\n restricted: \"Owners and administrators only\",\n};\n\n// ── context policy — ContextPolicy (vocabulary.ts, FLD-12) ─────────────────\n// Whether an agent may see a Field's values at all — not `Delivery` (how much\n// of a merge field's value reaches a turn), a different vocabulary entirely.\nexport const CONTEXT_POLICY_LABEL: Record<ContextPolicy, string> = {\n include: \"Yes, an assistant can read it\",\n summarize: \"Only a summary of it\",\n on_request: \"Only on request\",\n exclude: \"No, keep it away from assistants\",\n};\n\n// ── stage-rule on_fail — StageRuleOnFail (pipeline.ts) ──────────────────────\nexport const STAGE_RULE_ON_FAIL_LABEL: Record<StageRuleOnFail, string> = {\n refuse: \"Turn it away\",\n require_approval: \"Ask for approval\",\n};\n\n// ── subscription cadence — SubscriptionCadence (subscription.ts) ───────────\n//\n// `DigestScheduler.tsx` carries its own copy of this enum's words as a\n// grammatical FRAGMENT dropped into a sentence (\"arrives the moment something\n// arrives\") rather than a standalone label (\"hourly summary\") — a different\n// job for the same four values. That file is owned by another lane right now\n// (lane preamble's do-not-touch list) so it is left exactly as it is; this map\n// is the standalone-label form used by every OTHER site that names a cadence.\nexport const SUBSCRIPTION_CADENCES = exhaustiveValuesOf<SubscriptionCadence>()([\"instant\", \"hourly\", \"daily\", \"weekly\"]);\nexport const SUBSCRIPTION_CADENCE_LABEL: Record<SubscriptionCadence, string> = {\n instant: \"as it happens\",\n hourly: \"hourly summary\",\n daily: \"daily summary\",\n weekly: \"weekly summary\",\n};\n\n// ── subscription channel — no named export in @ai-matrx/records ───────────\n//\n// `Subscription.channel` is typed inline as `\"in_app\" | \"email\" | \"sms\"`\n// (subscription.ts) with no exported const array, so the value list below IS\n// the canonical list — the same three literals the store's type carries.\nexport const SUBSCRIPTION_CHANNEL_VALUES = [\"in_app\", \"email\", \"sms\"] as const;\nexport type SubscriptionChannel = (typeof SUBSCRIPTION_CHANNEL_VALUES)[number];\n// `NotifyRuleEditor.tsx` used to say plain \"by email\" / \"by text\" with no\n// caveat; `SubscriptionsPanel.tsx` (and the untouched `DigestScheduler.tsx`)\n// say \"only if an address/number is on the account\". **The caveat wins** — a\n// person choosing email delivery needs to know up front that it silently does\n// nothing without an address on file, the way Linear and Notion surface a\n// precondition next to the control rather than failing quietly later.\nexport const SUBSCRIPTION_CHANNEL_LABEL: Record<SubscriptionChannel, string> = {\n in_app: \"in the app\",\n email: \"by email — only if an address is on the account\",\n sms: \"by text — only if a number is on the account\",\n};\n\n// ── rollup aggregate operation — NewFieldDeclaration[\"agg\"] (field.ts) ─────\n//\n// `field.ts` types this inline (`agg?: \"sum\" | \"count\" | \"min\" | \"max\" |\n// \"avg\"`) with no exported const array, so — same as the channel above — the\n// list below IS the canonical list.\nexport const ROLLUP_AGG_VALUES = [\n \"count\", \"sum\", \"avg\", \"min\", \"max\",\n // AIRTABLE PARITY (lane AT-FORMULA): the aggregates that read the linked values as they are.\n \"countall\", \"counta\", \"and\", \"or\", \"xor\", \"arrayjoin\", \"concatenate\", \"arrayunique\", \"arraycompact\",\n] as const;\nexport type RollupAgg = (typeof ROLLUP_AGG_VALUES)[number];\nexport const ROLLUP_AGG_LABEL: Record<RollupAgg, string> = {\n count: \"How many there are\",\n sum: \"The total of\",\n avg: \"The average of\",\n min: \"The smallest\",\n max: \"The largest\",\n countall: \"How many values, empty ones too\",\n counta: \"How many values are filled in\",\n and: \"Yes when every value is yes\",\n or: \"Yes when any value is yes\",\n xor: \"Yes when an odd number are yes\",\n arrayjoin: \"All the values, joined with commas\",\n concatenate: \"All the values, run together\",\n arrayunique: \"Each different value once\",\n arraycompact: \"The values that are filled in\",\n};\n\n// ── formula operation — the FormulaOperations menu (FieldEditor.tsx) ───────\n//\n// No `@ai-matrx/records` type names this set at all; it is this package's own\n// menu of what a two-column formula field can do, so this file is its one\n// canonical home.\nexport const FORMULA_OP_VALUES = [\"concat\", \"add\", \"sub\", \"mul\", \"div\"] as const;\nexport type FormulaOp = (typeof FORMULA_OP_VALUES)[number];\nexport const FORMULA_OP_LABEL: Record<FormulaOp, string> = {\n concat: \"Join them together\",\n add: \"Add them up\",\n sub: \"Take the second from the first\",\n mul: \"Multiply them\",\n div: \"Divide the first by the second\",\n};\n/** Whether this operation reads naturally as \"X and Y and Z…\" over more than two columns. */\nexport const FORMULA_OP_JOINS: Record<FormulaOp, boolean> = {\n concat: true,\n add: true,\n sub: false,\n mul: true,\n div: false,\n};\n\n// ── field validation-rule kind — FieldRule[\"kind\"] (field.ts) ──────────────\n//\n// `field.ts` types this inline with no exported const array; canonical here.\nexport const FIELD_RULE_KIND_VALUES = [\"min\", \"max\", \"length\", \"pattern\", \"equals_field\", \"differs_from_field\"] as const;\nexport type FieldRuleKindValue = (typeof FIELD_RULE_KIND_VALUES)[number];\nexport const FIELD_RULE_KIND_LABEL: Record<FieldRuleKindValue, string> = {\n min: \"At least\",\n max: \"At most\",\n length: \"Number of characters\",\n pattern: \"Looks like\",\n equals_field: \"Same as the column\",\n differs_from_field: \"Different from the column\",\n};\n\n// ── proposed-change act — `ProposedChange[\"act\"]` (ProposalRow.tsx, package-local) ──\n//\n// This type is not in `@ai-matrx/records` (`ProposalRow.tsx` declares it\n// itself, for an agent's field/table proposal), so it is canonical here.\nexport const PROPOSED_CHANGE_ACT_VALUES = [\"add\", \"update\", \"remove\"] as const;\nexport type ProposedChangeAct = (typeof PROPOSED_CHANGE_ACT_VALUES)[number];\nexport const PROPOSED_CHANGE_ACT_LABEL: Record<ProposedChangeAct, string> = {\n add: \"Add\",\n update: \"Update\",\n remove: \"Remove\",\n};\n\n// ── booking-page state — `FormSummary[\"state\"]` / `BookingSummary` (rule.ts) ──\n//\n// `rule.ts` types this inline (`\"draft\" | \"open\" | \"closed\" | \"full\"`) with no\n// exported const array; canonical here.\nexport const BOOKING_PAGE_STATE_VALUES = [\"draft\", \"open\", \"closed\", \"full\"] as const;\nexport type BookingPageState = (typeof BOOKING_PAGE_STATE_VALUES)[number];\nexport const BOOKING_PAGE_STATE_LABEL: Record<BookingPageState, string> = {\n draft: \"Not open yet — nobody can book until you open it.\",\n open: \"Open. Anyone with the link can book a time.\",\n closed: \"Closed. The link still works and says you are not taking bookings.\",\n full: \"Every time you offered is taken.\",\n};\n\n// ── value-envelope absence word — `ValueEnvelope.absent` (record.ts) ───────\n//\n// Kept for completeness of the census: `values.tsx` mapped each absence word\n// to itself (`\"none\" → \"none\"`), which is a passthrough with a safe fallback\n// rather than a wording decision, so there is no conflict to resolve — this is\n// still its one home so a future word change happens in one place.\nexport const ABSENCE_WORD_VALUES = [\"never asked\", \"none\", \"refused\", \"conflicting\"] as const;\nexport type AbsenceWord = (typeof ABSENCE_WORD_VALUES)[number];\nexport const ABSENCE_WORD_LABEL: Record<AbsenceWord, string> = {\n \"never asked\": \"never asked\",\n none: \"none\",\n refused: \"refused\",\n conflicting: \"conflicting\",\n};\n","\"use client\";\n\n// src/FilePicker.tsx — @ai-matrx/records-ui · FIX-10C F10\n//\n// CHOOSING A FILE, DRAWN THE WAY THIS PLATFORM DRAWS EVERY OTHER CONTROL.\n//\n// WHAT THIS REPLACES, measured (VERIFIER-10 F10, 2026-09-22): pressing Import\n// produced `Import Jobs [Choose File] No file chosen` — the browser's own\n// unstyled control, in the browser's own font, with no instruction, no example\n// of what the file should look like and no way out. Airtable and Notion both\n// open an EXPLAINED import screen at this exact moment; a raw `<input\n// type=file>` is the one control on the screen that did not come from the\n// design system.\n//\n// AND IT IS A CLASS, NOT A SCREEN. Four components in this package drew their\n// own bare file input — the import wizard, the public form runner, the capture\n// sheet and the capture run. Four spellings of \"pick a file\", four different\n// accept lists, four different (absent) instructions. This is the one control,\n// built on `@ai-matrx/design-system`'s Button so it inherits focus rings, sizes,\n// disabled styling and dark mode like everything else, and exported so a host\n// app can use it too.\n//\n// WHAT IT PROMISES:\n// · it says what a good file looks like BEFORE the person opens their finder;\n// · it names the file once chosen, and offers to choose a different one —\n// never a control that silently keeps the old file;\n// · drag and drop works, because the file is usually already in a folder the\n// person is looking at;\n// · the native input is still the mechanism (it is the only thing that can\n// open a file dialog) — it is visually hidden and reached by label, so\n// keyboard and screen readers get the real control, not a div pretending.\n\nimport { useCallback, useId, useRef, useState, type DragEvent, type ReactNode } from \"react\";\nimport { Button, cn } from \"@ai-matrx/design-system\";\n\nexport interface FilePickerProps {\n /** What the button says when nothing is chosen yet. */\n label: string;\n /** The `accept` list, exactly as the native input takes it. */\n accept?: string | undefined;\n /**\n * The accessible name of the file input itself, when it must differ from the\n * button's word — an import screen's input has been called \"Choose a file to\n * import\" since it existed, and every automation and screen-reader script\n * that knows this screen resolves that sentence. A name is a contract.\n */\n inputLabel?: string | undefined;\n /**\n * One sentence describing a good file — the thing the bare input never said.\n * Shown under the control, before anything is chosen.\n */\n hint?: ReactNode;\n disabled?: boolean | undefined;\n /** The chosen file. Called once per choice; re-choosing calls it again. */\n onFile: (file: File) => void;\n /** Forget the chosen file and go back to the empty state. */\n onClear?: (() => void) | undefined;\n /** The name of the file currently in play, when the owner is holding one. */\n chosenName?: string | null | undefined;\n className?: string | undefined;\n}\n\nexport function FilePicker({\n label,\n accept,\n inputLabel,\n hint,\n disabled = false,\n onFile,\n onClear,\n chosenName,\n className,\n}: FilePickerProps) {\n const inputId = useId();\n const input = useRef<HTMLInputElement | null>(null);\n const [over, setOver] = useState(false);\n\n const take = useCallback(\n (file: File | undefined | null) => {\n if (!file || disabled) return;\n onFile(file);\n },\n [disabled, onFile],\n );\n\n const onDrop = useCallback(\n (e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setOver(false);\n take(e.dataTransfer?.files?.[0]);\n },\n [take],\n );\n\n return (\n <div\n data-matrx-file-picker\n className={cn(\"flex min-w-0 flex-col gap-1\", className)}\n onDragOver={(e) => {\n if (disabled) return;\n e.preventDefault();\n setOver(true);\n }}\n onDragLeave={() => setOver(false)}\n onDrop={onDrop}\n >\n <div\n className={cn(\n \"flex min-w-0 flex-wrap items-center gap-2 rounded-md border border-dashed px-2 py-1.5\",\n over ? \"border-primary bg-primary/5\" : \"border-border\",\n disabled && \"opacity-60\",\n )}\n >\n {/* The real control — the only thing that can open a file dialog.\n Visually hidden rather than `display:none`, so it keeps its own\n accessible name and can still be driven; the Button beside it is the\n keyboard and pointer control, so this one is out of the tab order\n rather than a second stop that does the same thing. */}\n <input\n ref={input}\n id={inputId}\n type=\"file\"\n aria-label={inputLabel ?? label}\n tabIndex={-1}\n {...(accept ? { accept } : {})}\n disabled={disabled}\n className=\"sr-only\"\n onChange={(e) => {\n take(e.target.files?.[0]);\n // Choosing THE SAME file twice has to fire again — a person who\n // fixed the file and picked it again would otherwise press a\n // control that does nothing.\n e.target.value = \"\";\n }}\n />\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n onClick={() => input.current?.click()}\n >\n {chosenName ? \"Choose a different file\" : label}\n </Button>\n {chosenName ? (\n <span className=\"min-w-0 flex-1 truncate text-xs\" title={chosenName}>\n {chosenName}\n </span>\n ) : (\n <span className=\"text-xs text-muted-foreground\">or drop it here</span>\n )}\n {chosenName && onClear ? (\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" disabled={disabled} onClick={onClear}>\n Cancel\n </Button>\n ) : null}\n </div>\n {hint && !chosenName ? <p className=\"text-xs text-muted-foreground\">{hint}</p> : null}\n </div>\n );\n}\n","// src/choiceNudge.ts — @ai-matrx/records-ui\n//\n// THE CHOICE NUDGE, READ ONCE PER CLIENT (lane CHOICE-COLUMN-EDIT, 2026-09-27).\n//\n// What a choice cell does with typed words that are not a choice is the Feature Knob\n// `custom/choice_nudge` (`client.choiceNudge()`): ask (the default), always add, or never add.\n// It is the same answer for every cell a client draws, so it is asked ONCE per client — one\n// client is one organization — and every cell after the first reads the cached answer. A door\n// that refuses or is absent answers the knob's own default, `ask`, which is the safe one: the\n// person is asked rather than something being added or refused on their behalf.\n\nimport { useEffect, useState } from \"react\";\nimport type { ChoiceNudge } from \"@ai-matrx/records\";\nimport type { RecordsClient } from \"@ai-matrx/records/core\";\nimport { useOptionalRecordsClient } from \"@ai-matrx/records/react\";\n\nconst asked = new WeakMap<object, Promise<ChoiceNudge>>();\n\n/** The knob for this client, asked once and cached for the life of the client. */\nexport function choiceNudgeOf(client: RecordsClient): Promise<ChoiceNudge> {\n let answer = asked.get(client);\n if (!answer) {\n answer = Promise.resolve()\n .then(() => client.choiceNudge())\n .then(\n (result) => (result.ok ? result.data : \"ask\"),\n () => \"ask\" as const,\n );\n asked.set(client, answer);\n }\n return answer;\n}\n\n/**\n * The knob, for a control that needs it. `null` while it is asked (a control waits rather than\n * deciding on a guess); `ask` when there is no client at all (a public page), since no door can\n * add a choice there anyway.\n */\nexport function useChoiceNudge(enabled = true): ChoiceNudge | null {\n const client = useOptionalRecordsClient();\n const [nudge, setNudge] = useState<ChoiceNudge | null>(null);\n useEffect(() => {\n if (!enabled || !client) return;\n let live = true;\n void choiceNudgeOf(client).then((answer) => {\n if (live) setNudge(answer);\n });\n return () => {\n live = false;\n };\n }, [client, enabled]);\n if (!client) return \"ask\";\n return nudge;\n}\n","\"use client\";\n\n// src/PickOne.tsx — @ai-matrx/records-ui · THE ONE \"PICK ONE OF THESE\" CONTROL (lane VIEWS-AND-FIELDS\n// W1-B, verifier item 4, 2026-10-02 — Airtable, Linear).\n//\n// The package drew about forty-five native <select>s: an OS menu that ignores the theme, cannot be\n// searched, and reads differently from every picker beside it. Every pick of one value from a list\n// now goes through here: the design system's Select for a short list, and past\n// `PICK_ONE_SEARCH_AFTER` options the package's own searchable list (`PickOrAdd`), so a table with\n// thirty columns is typed into, never scrolled. Guard: `no-native-select-in-the-package.test.ts`.\n//\n// An empty value (\"\" — \"no sort\", \"count only\", \"any kind\") is a real option here: Radix refuses an\n// empty item value, so it travels as a sentinel inside and comes back out as \"\".\n\nimport { useState } from \"react\";\nimport { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, cn } from \"@ai-matrx/design-system\";\n\nimport { PickOrAdd } from \"./PickOrAdd\";\n\n/** One option: its value (may be \"\") and the words it reads as. */\nexport interface PickOneOption {\n value: string;\n label: string;\n /** The heading it sits under (a short list draws headings; a searchable one shows it under the item). */\n group?: string | undefined;\n}\n\n/** More options than this and the list is searchable. */\nexport const PICK_ONE_SEARCH_AFTER = 7;\n\nconst EMPTY = \"__records_pick_one_empty__\";\nconst inner = (v: string) => (v === \"\" ? EMPTY : v);\nconst outer = (v: string) => (v === EMPTY ? \"\" : v);\n\nexport function PickOne({\n value,\n onChange,\n options,\n label,\n placeholder,\n id,\n className,\n disabled,\n attrs,\n}: {\n value: string;\n onChange: (value: string) => void;\n options: readonly PickOneOption[];\n /** The control's accessible name. */\n label: string;\n /** What the trigger reads when the value is none of the options. */\n placeholder?: string | undefined;\n id?: string | undefined;\n className?: string | undefined;\n disabled?: boolean | undefined;\n /** Attributes a caller's tests and walks select by (`data-…`), put on the trigger. */\n attrs?: Record<string, string> | undefined;\n}) {\n const [open, setOpen] = useState(false);\n const [search, setSearch] = useState(\"\");\n const current = options.find((o) => o.value === value);\n\n if (options.length > PICK_ONE_SEARCH_AFTER) {\n const q = search.trim().toLowerCase();\n const shown = q === \"\" ? options : options.filter((o) => o.label.toLowerCase().includes(q));\n return (\n <span className={cn(\"inline-flex min-w-0\", className)} data-records-pick-one=\"search\" data-pick-value={value} {...(attrs ?? {})}>\n <PickOrAdd\n triggerSize=\"compact\"\n triggerLabel={label}\n triggerText={current?.label ?? placeholder ?? \"\"}\n triggerId={id}\n open={open && !disabled}\n onOpenChange={(next) => {\n setOpen(next);\n if (!next) setSearch(\"\");\n }}\n search={search}\n onSearch={setSearch}\n items={shown.map((o) => ({\n id: inner(o.value),\n label: o.label,\n detail: o.group,\n picked: o.value === value,\n attrs: { \"data-pick-value\": o.value, ...(o.group ? { \"data-pick-group\": o.group } : {}) },\n }))}\n onPick={(picked) => {\n onChange(outer(picked));\n setOpen(false);\n setSearch(\"\");\n }}\n empty={<p className=\"p-2 text-xs text-muted-foreground\">No match</p>}\n />\n </span>\n );\n }\n return (\n <Select value={current ? inner(current.value) : \"\"} onValueChange={(v) => onChange(outer(v))} disabled={disabled ?? false}>\n <SelectTrigger\n id={id}\n size=\"sm\"\n aria-label={label}\n className={cn(\"h-7 w-auto min-w-[7rem] text-xs\", className)}\n data-records-pick-one=\"list\"\n data-pick-value={value}\n {...(attrs ?? {})}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent>\n {groupsOf(options).map(([group, items]) =>\n group ? (\n <SelectGroup key={group}>\n <SelectLabel>{group}</SelectLabel>\n {items.map((o) => (\n <SelectItem key={inner(o.value)} value={inner(o.value)} data-pick-value={o.value} data-pick-group={group}>\n {o.label}\n </SelectItem>\n ))}\n </SelectGroup>\n ) : (\n items.map((o) => (\n <SelectItem key={inner(o.value)} value={inner(o.value)} data-pick-value={o.value}>\n {o.label}\n </SelectItem>\n ))\n ),\n )}\n </SelectContent>\n </Select>\n );\n}\n\n/** Options in their own order, cut into runs that share a heading. */\nfunction groupsOf(options: readonly PickOneOption[]): Array<[string | undefined, PickOneOption[]]> {\n const out: Array<[string | undefined, PickOneOption[]]> = [];\n for (const o of options) {\n const last = out[out.length - 1];\n if (last && last[0] === o.group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EL,GACF;AAAA,KACF;AAEJ;AAGA,SAAS,SAAS,SAAiF;AACjG,QAAM,MAAoD,CAAC;AAC3D,aAAW,KAAK,SAAS;AACvB,UAAM,OAAO,IAAI,IAAI,SAAS,CAAC;AAC/B,QAAI,QAAQ,KAAK,CAAC,MAAM,EAAE,MAAO,MAAK,CAAC,EAAE,KAAK,CAAC;AAAA,QAC1C,KAAI,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAAA,EAC9B;AACA,SAAO;AACT;","names":["asked","Alert","AlertDescription","AlertTitle","TIMED_OUT_SENTENCE","cn","jsx","jsx","jsxs","TIMED_OUT_SENTENCE","Alert","cn","AlertTitle","AlertDescription","useEffect","useState","cn","jsx","jsxs","cn","jsx","jsxs","useState","useEffect","useEffect","useMemo","useState","cn","jsx","jsxs","versions_star","useCallback","useRef","useState","Button","cn","jsx","jsxs","useEffect","useState","useState","cn","jsx","jsxs","useState","cn"]}
@@ -24,7 +24,7 @@ import {
24
24
  useChoiceNudge,
25
25
  useRecordsUi,
26
26
  useTableRights
27
- } from "./chunk-P4P4IFM4.js";
27
+ } from "./chunk-7LELV7UI.js";
28
28
  import {
29
29
  guessColumn,
30
30
  readTableShapes,
@@ -5093,4 +5093,4 @@ export {
5093
5093
  shapesOfSource,
5094
5094
  SaveToTable
5095
5095
  };
5096
- //# sourceMappingURL=chunk-KDD2FZZR.js.map
5096
+ //# sourceMappingURL=chunk-BZ6PLCAR.js.map