@ai-matrx/records-ui 0.116.113 → 0.116.114
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 +4 -0
- package/dist/entity-doors.cjs +3 -4
- package/dist/entity-doors.cjs.map +1 -1
- package/dist/entity-doors.js +3 -4
- package/dist/entity-doors.js.map +1 -1
- package/dist/entity-ref.cjs +3 -4
- package/dist/entity-ref.cjs.map +1 -1
- package/dist/entity-ref.js +3 -4
- package/dist/entity-ref.js.map +1 -1
- package/package.json +2 -2
package/dist/entity-ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entity-ref/slot.ts","../src/entity-ref/doors.ts","../src/entity-ref/EntityRef.tsx","../src/entity-ref/useEntityHref.ts","../src/entity-ref/host.tsx","../src/entity-ref/EntityDoorControls.tsx","../src/entity-ref/NewTabLink.tsx","../src/entity-ref/TextWithDoors.tsx","../src/entity-ref/toastDoor.tsx","../src/entity-ref/RecordStamps.tsx"],"sourcesContent":["/**\n * src/entity-ref/slot.ts — @ai-matrx/records-ui/entity-doors (no \"use client\": pure, server-safe)\n *\n * THE ENTITY-REF HOST: what a reference to another record needs from the app that draws it.\n *\n * A reference (`EntityRef`, `EntityDoorControls`, `TextWithDoors`, `toastDoor`, `NewTabLink`) is\n * drawn EVERYWHERE — table cells, chat bubbles, toasts, sentences — far outside any\n * `<RecordsUiProvider>`. So, unlike the screens' host, this one is bound ONCE per page through\n * `configureEntityRefs(...)` (a module-level slot on `globalThis`, so every module-graph copy of the\n * package reads the same binding) before anything renders.\n *\n * The ports, each with a default that ANNOUNCES ITSELF instead of pretending:\n *\n * registry token → label, icon, route, title column (the app's scopes/entity registry).\n * Default: knows no token — every reference draws its name with no door.\n * adminHref the admin-shell twin of a record's route. Default: none.\n * hasPeek whether a quick-look exists for a kind. Default: none.\n * openPeek opens the app's ONE quick-look host. Default: opens `fallbackHref` in a new tab.\n * useAddress a HOOK resolving tokens whose address depends on more than the id (an agent's kind,\n * a team's organization). Default: none — the registry route is used.\n * Link the app's router link. Default: design-system's registered tap-target link, else <a>.\n * ErrorMenu the actions drawn beside a KNOWN refusal. Default: none.\n *\n * Unconfigured, every reference carries `data-entity-ref-host=\"unconfigured\"` and the first draw\n * warns once in the console, naming `configureEntityRefs`.\n *\n * The host MUST be configured before the first render: `useAddress` is a hook, and the number of\n * hooks a component calls cannot change between renders.\n */\n\nimport type { ComponentType, MouseEvent, ReactNode, Ref } from \"react\";\nimport { globalSlot } from \"@ai-matrx/kit/global-slot\";\nimport { openOutbound } from \"@ai-matrx/kit/outbound\";\n\n/** One registered entity type, as a reference draws it. */\nexport interface EntityRefDescriptor {\n /** Singular display label (\"Agent\", \"Note\"). */\n label: string;\n /** The type's icon. */\n Icon: ComponentType<{ className?: string }> | null;\n /** Canonical route to one record, or null when the type has no page. */\n hrefFor: ((id: string) => string) | null;\n /** The column a generic quick-look reads the title from; null = no generic quick-look. */\n titleColumn: string | null;\n /**\n * True when the type's table is NOT browser-readable (a candidates lister stands in), so a\n * generic quick-look would always fail and is not offered.\n */\n listCandidatesOnly: boolean;\n}\n\n/** The entity registry as a reference needs it. */\nexport interface EntityRefRegistry {\n /** Raw token (a kind column owned by another system) → canonical token. */\n canonical(token: string): string;\n /** Canonical token → descriptor, or null for a token nobody registered. */\n describe(token: string): EntityRefDescriptor | null;\n}\n\n/** A quick-look request. */\nexport interface EntityRefPeekAsk {\n /** Peek catalog key. */\n kind: string;\n id: string;\n /** The destination the CALLER resolved, when a token alone cannot name it. */\n href?: string | null | undefined;\n anchor?: Element | null | undefined;\n trigger?: \"hover\" | \"click\" | undefined;\n /** Where the record opens when the host has no quick-look surface mounted. */\n fallbackHref?: string | null | undefined;\n}\n\n/** An address resolved by the host's `useAddress` hook. */\nexport type EntityAddress =\n | { state: \"ready\"; href: string }\n /** A REAL href that works while resolving (a server-side redirect route). */\n | { state: \"resolving\"; href: string }\n /** The record genuinely cannot be reached; `reason` is the sentence the UI says. */\n | { state: \"refused\"; reason: string };\n\nexport interface EntityRefLinkProps {\n href: string;\n target?: string | undefined;\n rel?: string | undefined;\n prefetch?: boolean | undefined;\n title?: string | undefined;\n className?: string | undefined;\n onClick?: ((event: MouseEvent<HTMLAnchorElement>) => void) | undefined;\n \"aria-label\"?: string | undefined;\n \"data-tap-target\"?: boolean | undefined;\n children?: ReactNode;\n ref?: Ref<HTMLAnchorElement> | undefined;\n}\n\n/** A person as an identity resolver answers them (UserIdentity-compatible). */\nexport interface EntityRefPerson {\n id?: string | null;\n email?: string | null;\n displayName?: string | null;\n avatarUrl?: string | null;\n}\n\nexport interface EntityRefHost {\n registry: EntityRefRegistry;\n adminHref?: ((token: string, id: string) => string | null) | undefined;\n hasPeek?: ((kind: string) => boolean) | undefined;\n openPeek?: ((ask: EntityRefPeekAsk) => void) | undefined;\n /**\n * A HOOK, called on every render of every reference: `id` is null for the tokens the host does\n * not resolve itself, and the hook returns null for them. Must call the same hooks every time.\n */\n useAddress?: ((token: string, id: string | null, context: string) => EntityAddress | null) | undefined;\n Link?: ComponentType<EntityRefLinkProps> | undefined;\n ErrorMenu?: ComponentType<{ error: string }> | undefined;\n /** Draws one person (avatar + name), compact. Default: the name as text. */\n Person?: ComponentType<{ user: EntityRefPerson; className?: string }> | undefined;\n}\n\n// One binding for every module-graph copy of the package (kit's globalSlot, like the person's zone).\nconst bound = globalSlot(\"ai-matrx.records-ui.entity-ref-host\", () => ({ host: null as EntityRefHost | null }));\n\n/** Bind the app's entity-ref host. Call once, at module load, before anything renders. */\nexport function configureEntityRefs(host: EntityRefHost | null): void {\n bound.host = host;\n}\n\n/** True once a host has been bound. */\nexport function entityRefsConfigured(): boolean {\n return Boolean(bound.host);\n}\n\nlet warned = false;\nfunction announceUnconfigured(): void {\n if (warned) return;\n warned = true;\n if (typeof console !== \"undefined\") {\n console.warn(\n \"[@ai-matrx/records-ui/entity-ref] Entity reference host is not configured. \" +\n \"Call configureEntityRefs(...) before rendering references.\",\n );\n }\n}\n\nconst UNCONFIGURED_REGISTRY: EntityRefRegistry = {\n canonical: (token) => token,\n describe: () => null,\n};\n\nexport function fallbackOpenPeek(ask: EntityRefPeekAsk): void {\n const href = ask.fallbackHref ?? ask.href;\n if (href) openOutbound(href, \"_blank\", \"noopener\");\n}\n\n/** The bound host's non-drawing ports, defaults filled (defaults announce themselves). */\nexport interface EntityRefPorts {\n configured: boolean;\n registry: EntityRefRegistry;\n adminHref: (token: string, id: string) => string | null;\n hasPeek: (kind: string) => boolean;\n openPeek: (ask: EntityRefPeekAsk) => void;\n useAddress: (token: string, id: string | null, context: string) => EntityAddress | null;\n}\n\nconst noAddress = () => null;\n\n/** The raw bound host, or null. */\nexport function boundEntityRefHost(): EntityRefHost | null {\n return bound.host;\n}\n\nexport function entityRefPorts(): EntityRefPorts {\n const host = boundEntityRefHost();\n if (!host) announceUnconfigured();\n return {\n configured: Boolean(host),\n registry: host?.registry ?? UNCONFIGURED_REGISTRY,\n adminHref: host?.adminHref ?? (() => null),\n hasPeek: host?.hasPeek ?? (() => false),\n openPeek: host?.openPeek ?? fallbackOpenPeek,\n useAddress: host?.useAddress ?? noAddress,\n };\n}\n\n/** A modified click (new tab/window, middle button) keeps the browser's native behavior. */\nexport function isNativeNewTabClick(e: {\n metaKey?: boolean;\n ctrlKey?: boolean;\n shiftKey?: boolean;\n altKey?: boolean;\n button?: number;\n}): boolean {\n return Boolean(e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button === 1);\n}\n\n","/**\n * Door resolution — the ONE place a (token, id) pair becomes reachable doors.\n *\n * THE DOOR LAW (common-docs/policies/no-dead-ends.md): if the UI names a thing\n * that has an identity in our system, the UI must let the user reach it. Two\n * different presentations need the same answer:\n *\n * `EntityRef` — a NAME with doors (the default; prefer it always)\n * `MatrxUuidCell` — an ID with doors (only when the name genuinely isn't\n * loaded — a raw FK column in a dense admin table)\n *\n * Both call `resolveEntityDoors`, so a registry edit lights up both at once and\n * neither can drift from the other. This module is deliberately component-free\n * and cheap to import: it pulls the entity registry (icons + `hrefFor`) and the\n * peek KIND LIST — never `features/organizations/peek/registry.ts`, which\n * statically imports all 19 peek components (THE FRAGMENTATION LAW).\n *\n * Adding a door for a new entity type is a registry edit, never a change here:\n * route → `hrefFor` in `features/scopes/registry/entityRegistry.ts`\n * peek → `features/organizations/peek/registry.ts` + `kinds-list.ts` for a\n * BESPOKE preview. Every registered entity with a readable title\n * column already gets the generic `RegistryPeek` for free, so a new\n * entity is previewable the moment it is registered — write a bespoke\n * one only when the kind deserves more than title/description/dates.\n */\n\nimport type { ComponentType } from \"react\";\nimport { entityRefPorts, type EntityRefDescriptor } from \"./slot\";\nimport { codeSpanText, findCodeRanges } from \"@ai-matrx/content-ir/source\";\nimport { isUuidValue } from \"@ai-matrx/kit/uuid\";\n\n// The one isUuidValue (kit): shape after trim. Re-exported so `/entity-doors` keeps offering it.\nexport { isUuidValue };\n\n/**\n * True when a value is a real uuid — the guard a surface needs BEFORE handing an\n * id to `EntityRef` / `EntityDoorControls`.\n *\n * Door resolution deliberately does not validate ids (a token's `hrefFor` is\n * free to use slugs), so any surface that DERIVES an id — parsing it out of a\n * surface key, reading an untyped column — must check first, or it mints a link\n * to `/agents/<junk>`: a door that opens on nothing, which the doctrine ranks\n * worse than no door at all.\n *\n * It lives here, beside `resolveEntityDoors`, because this module is the one\n * component-free entry point on the door path. It used to live only inside\n * `MatrxUuidCell`, which meant guarding an id dragged a table cell (and its\n * tooltip/toast/peek-host graph) into whatever chunk needed the check —\n * THE FRAGMENTATION LAW, paid for a three-line regex. Every importer was moved\n * to this module in the same change — there is deliberately no re-export left\n * behind in `MatrxUuidCell`, because that tripped `no-barrel-files` and the\n * rule is right.\n */\n\n/**\n * Entity tokens whose peek is registered under a different catalog key.\n * Keep this at zero entries wherever possible — the real fix is aligning the\n * peek registry key with the canonical token.\n */\nconst PEEK_KEY_BY_TOKEN: Record<string, string> = {\n app: \"agent_app\",\n pick_list: \"pick_list\",\n structured_list: \"pick_list\",\n};\n\n/**\n * True when `RegistryPeek` can preview this entity even though no bespoke peek\n * is registered — it reads the registry's own schema/table/title column, so it\n * needs a title column and a table the BROWSER can actually read.\n *\n * `listCandidates` is the marker for the exception: a token only carries one\n * because its schema isn't PostgREST-exposed (`data_store` → `rag`), and\n * offering a preview button that always fails is its own dead end.\n */\nfunction hasRegistryPeek(info: EntityRefDescriptor | null): boolean {\n return Boolean(info?.titleColumn) && !info?.listCandidatesOnly;\n}\n\nexport interface EntityDoors {\n /** Canonical route to the record, or null when the token has no `hrefFor`. */\n href: string | null;\n /** True when a peek is registered for this token. */\n canPeek: boolean;\n /** Catalog key to hand `<ResourcePeekHost kind=…>`. */\n peekKind: string;\n /** Registry icon for the entity type, when one is registered. */\n Icon: ComponentType<{ className?: string }> | null;\n /** Singular display label (\"Agent\", \"Note\"), or null for unknown tokens. */\n label: string | null;\n}\n\n/**\n * Resolve every door we can open for one record.\n *\n * `hrefOverride` wins over the registry route — for records that live in two\n * shells (a system agent under `/administration/…` vs a personal one under\n * `/agents/…`). It is honored EXACTLY: an explicit `null` means \"this\n * particular record has no door\" and must not fall through to the registry,\n * which would send the user somewhere the caller deliberately ruled out. Only\n * `undefined` (no opinion) defers.\n *\n * Unknown tokens degrade to \"no doors\", never throw: a surface passing a token\n * we don't register yet must still render its text.\n */\nexport function resolveEntityDoors(\n token: string,\n id: string,\n hrefOverride?: string | null,\n): EntityDoors {\n const host = entityRefPorts();\n const info = host.registry.describe(token);\n const peekKind = PEEK_KEY_BY_TOKEN[token] ?? token;\n return {\n href:\n hrefOverride !== undefined\n ? hrefOverride\n : (host.adminHref(token, id) ?? info?.hrefFor?.(id) ?? null),\n canPeek: host.hasPeek(peekKind) || hasRegistryPeek(info),\n peekKind,\n Icon: info?.Icon ?? null,\n label: info?.label ?? null,\n };\n}\n\n/**\n * Resolve an FK COLUMN NAME to a canonical entity token — `agent_id` → `agent`,\n * `task_id` → `task`. Deliberately strict: exact `<token>_id` only, and only\n * for tokens that actually have a door. Anything else returns null rather than\n * guessing, because a wrong link is worse than no link (a `<token>_id` that\n * points somewhere else would send the user to another record entirely).\n *\n * Used by generic surfaces that render a row's raw columns (the data-table row\n * inspector) and therefore can't be told each column's target by hand.\n */\nexport function doorTokenFromColumnName(column: string): string | null {\n const name = column.trim().toLowerCase();\n if (!name.endsWith(\"_id\")) return null;\n const token = name.slice(0, -3);\n if (!token) return null;\n return hasAnyDoor(token) ? token : null;\n}\n\n/**\n * True when the platform can open this token at all (route or peek).\n * Use it to decide whether a bare id is worth rendering as a door — never to\n * decide whether to render the record at all.\n */\nexport function hasAnyDoor(token: string): boolean {\n const host = entityRefPorts();\n const info = host.registry.describe(token);\n return (\n Boolean(info?.hrefFor) ||\n host.hasPeek(PEEK_KEY_BY_TOKEN[token] ?? token) ||\n hasRegistryPeek(info)\n );\n}\n\n// ── Ids inside SENTENCES ─────────────────────────────────────────────────────\n//\n// 🚨 THE DEFECT THIS CLOSES: our servers write refusals for people —\n// \"resolved system agent 8f0bbfc2-… breaks the mandate contract\" — and every\n// screen printed them as flat text. The sentence NAMES a record that has an\n// identity in our system, so THE DOOR LAW applies to it exactly as it does to\n// a table cell: the person reading the refusal must be able to open the agent\n// it is accusing, without hand-copying a uuid into a URL bar.\n//\n// A server sentence is verbatim by policy (`ServerNotes`, `RunFailureCard`),\n// so nothing here rewrites, shortens or re-orders a word — the only change is\n// that the ids inside it become reachable.\n\n/**\n * Everyday nouns that name a registered entity by a different word than its\n * canonical token. Only add an entry you have VERIFIED points at the same\n * record type — a wrong door is worse than no door.\n */\nconst NOUN_ALIASES: Record<string, string> = {\n org: \"organization\",\n organisation: \"organization\",\n bot: \"agent\",\n workflow_definition: \"workflow\",\n // scheduler.sch_task — the scheduler's own sentences say \"scheduled task\".\n schedule: \"sch_task\",\n scheduled_task: \"sch_task\",\n};\n\n/** A word as it appears in prose → a candidate entity token. */\nfunction nounToToken(word: string): string {\n const bare = word.toLowerCase().replace(/[^a-z0-9_]/g, \"\");\n // \"agents\" / \"mandates\" — prose pluralises, tokens don't.\n const singular =\n bare.length > 3 && bare.endsWith(\"s\") && !bare.endsWith(\"ss\")\n ? bare.slice(0, -1)\n : bare;\n return NOUN_ALIASES[singular] ?? singular;\n}\n\n/**\n * The entity token a sentence was talking about right before it printed an id.\n *\n * Deliberately conservative — it reads at most the four words in front of the\n * id, nearest first, and accepts only a word that resolves to a token the\n * platform can actually OPEN (`hasAnyDoor`). Anything else returns null and\n * the caller prints the id as it always did. Guessing here would mint links to\n * `/agents/<a workflow id>`: a door onto the wrong record, which reads as a\n * fact and is a lie.\n */\nexport function tokenFromPrecedingWords(preceding: string): string | null {\n const words = preceding.trim().split(/\\s+/).filter(Boolean).slice(-4);\n // The compound ending at the id first, longest first (\"scheduled task\" →\n // `sch_task`, \"agent version\" → `agent_version`). A bare noun that is ALSO a\n // token must not win over the compound it closes: \"scheduled task <id>\"\n // resolved to `task` and minted a door onto /tasks/<a schedule id> — the\n // wrong record, which reads as a fact and is a lie (2026-09-11).\n for (let len = words.length; len >= 2; len--) {\n const joined = words.slice(-len).map(nounToToken).filter(Boolean).join(\"_\");\n const phrase = NOUN_ALIASES[joined] ?? joined;\n if (phrase && hasAnyDoor(phrase)) return phrase;\n }\n // Then the nearest single noun that opens.\n for (let i = words.length - 1; i >= 0; i--) {\n const single = nounToToken(words[i] ?? \"\");\n if (single && hasAnyDoor(single)) return single;\n }\n return null;\n}\n\n/**\n * One piece of a sentence: plain prose, an id we can open a door on, or a run\n * the author marked as CODE with markdown backticks.\n */\nexport type SentenceSegment =\n | { kind: \"text\"; text: string }\n | { kind: \"code\"; text: string }\n | { kind: \"ref\"; id: string; token: string };\n\nconst UUID_IN_TEXT_RE =\n /\\b[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\\b/gi;\n\n/**\n * INLINE CODE, THE WAY ITS AUTHOR WROTE IT.\n *\n * 🚨 THE DEFECT (V-PARITY/UX R-O2, both walk rounds). Sentences that name a\n * field, a key or a variable mark it the one way every author on this platform\n * marks it — markdown backticks:\n *\n * Its structured output is missing `title`, `slides` — whatever reads this\n * job's result requires them.\n *\n * Printed through a plain `<span>` the backtick CHARACTERS land on a subject\n * matter expert's screen. There is no second renderer for this: every sentence\n * somebody else wrote already reaches a person through `TextWithDoors`, so the\n * marks are understood HERE, beside the ids, and every one of its ~10 adopting\n * surfaces is fixed by the same three lines.\n *\n * Deliberately ONLY single-backtick spans, and never across a newline: this is\n * a sentence renderer, not a markdown engine. Anything else — an unmatched\n * backtick, a fenced block — stays exactly as it was typed.\n */\n\n/**\n * Split a server-authored sentence into prose, inline code and openable ids.\n *\n * `defaultToken` is what the CALL SITE knows that the sentence does not — a\n * mandate-resolution refusal is always about an agent, so its screen may say\n * so. It is used only when the prose itself names nothing openable.\n *\n * Every character of the input survives into the output in order — apart from\n * the two backticks delimiting an inline-code run, which are MARKUP the author\n * wrote to say \"this is code\" and were never words meant to be read. A caller\n * that joins the segments back together gets the server's words unchanged.\n */\nexport function segmentSentenceIds(\n text: string,\n defaultToken?: string | null,\n): SentenceSegment[] {\n const out: SentenceSegment[] = [];\n let prose = 0;\n // Inline code by THE one code-range rule (@ai-matrx/content-ir/source).\n for (const range of text.includes(\"`\") ? findCodeRanges(text) : []) {\n if (range.kind !== \"span\" || range.start < prose) continue;\n if (range.start > prose) {\n out.push(...segmentIdsOnly(text.slice(prose, range.start), defaultToken));\n }\n out.push({ kind: \"code\", text: codeSpanText(text.slice(range.start, range.end)) });\n prose = range.end;\n }\n if (out.length === 0) return segmentIdsOnly(text, defaultToken);\n if (prose < text.length) {\n out.push(...segmentIdsOnly(text.slice(prose), defaultToken));\n }\n return out;\n}\n\n/** The id half, run over one run of prose that carries no code marks. */\nfunction segmentIdsOnly(\n text: string,\n defaultToken?: string | null,\n): SentenceSegment[] {\n const segments: SentenceSegment[] = [];\n let cursor = 0;\n UUID_IN_TEXT_RE.lastIndex = 0;\n for (\n let match = UUID_IN_TEXT_RE.exec(text);\n match !== null;\n match = UUID_IN_TEXT_RE.exec(text)\n ) {\n const id = match[0];\n const start = match.index;\n const token =\n tokenFromPrecedingWords(text.slice(cursor, start)) ??\n (defaultToken && hasAnyDoor(defaultToken) ? defaultToken : null);\n if (token === null) continue; // No door we trust — leave it in the prose.\n if (start > cursor) {\n segments.push({ kind: \"text\", text: text.slice(cursor, start) });\n }\n segments.push({ kind: \"ref\", id, token });\n cursor = start + id.length;\n }\n if (segments.length === 0) return [{ kind: \"text\", text }];\n if (cursor < text.length) {\n segments.push({ kind: \"text\", text: text.slice(cursor) });\n }\n return segments;\n}\n","\"use client\";\n\n/**\n * EntityRef — THE way to render a reference to another record.\n *\n * THE DOOR LAW (common-docs/policies/no-dead-ends.md): if the UI names a thing\n * that has an identity in our system, the UI must let the user reach it. This\n * component is that law made importable — drop it anywhere a name, a title, or\n * (worse) a bare id is being printed, and the user gets every door we can open:\n *\n * Open → click the name; canonical route from the entity registry\n * New tab → explicit control, so a user deep inside a console/modal never\n * has to trade their current state for an answer\n * Peek → non-blocking preview via the peek registry, when one exists\n * (Window) → surfaces pass their own opener through `extraActions`\n *\n * It composes primitives, it does not duplicate them:\n * - route + icon + label → `getEntityInfo(token)` (features/scopes/registry)\n * - preview → `openResourcePeek` + `hasPeek` (features/organizations/peek) —\n * the app's ONE peek host draws it; a reference never mounts one\n *\n * Safe inside clickable table rows: every control stops propagation, and the\n * peek renders in the app's one host, outside this reference's React tree.\n *\n * Adding a door for a new entity type is a registry edit, never a change here:\n * give the token an `hrefFor` in `entityRegistry.ts`, and/or a peek in\n * `features/organizations/peek/registry.ts` + `kinds-list.ts`.\n */\n\nimport React from \"react\";\nimport { ExternalLinkIcon, LightbulbIcon } from \"@ai-matrx/design-system/icons\";\nimport { Button as ControlButton } from \"@ai-matrx/design-system/controls\";\nimport { cn, displayId } from \"@ai-matrx/design-system\";\nimport { useEntityHref } from \"./useEntityHref\";\nimport { entityRefHost, hostMark, isNativeNewTabClick } from \"./host\";\n\ninterface EntityRefProps {\n /** Canonical entity token (`agent`, `note`, `task`, …). */\n token: string;\n /** The record's id. */\n id: string;\n /**\n * Display name. When omitted the id is shown truncated — acceptable only\n * when the name genuinely isn't loaded; prefer passing it.\n */\n name?: string | null;\n /** Override the registry route (e.g. an admin-side route for the same record). */\n href?: string;\n /** Show the entity's registry icon before the name. Default true. */\n showIcon?: boolean;\n /** Hide the peek control even when one is registered. */\n disablePeek?: boolean;\n /**\n * Hide the new-tab CONTROL (rare — only when the row is already a link).\n *\n * It does NOT make the name inert: the label stays a real `Link` whenever a\n * route resolves, so a plain click still navigates and a modified click\n * still opens a tab. If what you actually want is \"name this record but do\n * not offer a door\" — the record is already open, so every door leads back\n * to where the user is standing — then don't use `EntityRef` for that row at\n * all. Render the text, and say in a comment why the door is absent.\n */\n disableNewTab?: boolean;\n /**\n * The name itself opens in a NEW TAB.\n *\n * Set this on any surface embedded in something the user would lose by\n * navigating — a side panel, a workspace rail, a sheet over an editor, a\n * dialog. In-place navigation there is the data-loss THE DOOR LAW's new-tab\n * door exists to prevent, and it is the single easiest regression to\n * introduce when replacing a hand-rolled `window.open` with this component\n * (it has already been caught twice in review).\n *\n * Implemented as a real `target=\"_blank\"` on the anchor — no JS interception,\n * so modified clicks and middle-clicks keep behaving natively. The separate\n * new-tab control is suppressed automatically, since it would be a duplicate.\n */\n openInNewTab?: boolean;\n /**\n * Let the label WRAP instead of truncating.\n *\n * `EntityRef` truncates by default because its home is a table cell. That is\n * wrong for a detail panel or an audit row that prints a full id — there the\n * id IS the information, and an ellipsis silently destroys the thing the user\n * came to copy. Set this wherever the old markup wrapped (`break-all`,\n * `whitespace-normal`) so the conversion doesn't quietly shorten the content.\n *\n * A call-site `className` cannot substitute: it lands on the outer wrapper,\n * while `truncate` is on the label element itself.\n *\n * `\"lines\"`: a title a person reads (a list of found items) wraps at word boundaries, at most\n * two lines, then ellipsis — never cut to a few characters, never broken mid-word.\n */\n wrap?: boolean | \"lines\";\n /**\n * The NAME control stretches to fill the width, instead of hugging its text.\n *\n * Set this whenever you replace a full-width `<button>`/`<a>` with an\n * `EntityRef`. A `className` of `flex-1` on the component only stretches the\n * outer WRAPPER — the clickable label inside it still ends where the text\n * does, so every pixel of the old control's padding silently stops opening\n * the record. On a short name in a wide row that is most of the hit target.\n *\n * Combines with `truncate` (the default) exactly as the markup it replaces\n * did: fill the space, ellipsise if the name outgrows it. It also pushes the\n * hover controls to the far edge, which is why it is opt-in — inside a table\n * cell you usually want them beside the name.\n */\n fill?: boolean;\n /**\n * Classes for the clickable LABEL itself, not the wrapper.\n *\n * `className` lands on the outer wrapper, which is right for layout and\n * wrong for anything that must apply to the text: `line-through` on a\n * completed task, a font weight, a decoration. Whether such a style reaches\n * the label by inheritance depends on the box type and fights the label's\n * own `hover:underline` — so it is passed explicitly rather than hoped for.\n * This is the third call-site need of this shape; `wrap` and `fill` stay as\n * named props because they encode a DECISION, while this is plain styling.\n */\n labelClassName?: string;\n /** Backward-compatible name-label class used by existing Door Law callers. */\n nameClassName?: string;\n /** Controls stay visible instead of appearing on hover/focus. */\n alwaysShowActions?: boolean;\n /** Surface-specific extra doors (open in window, jump to versions, …). */\n extraActions?: React.ReactNode;\n /**\n * Intercept the plain left-click on the name — for surfaces that open the\n * record their OWN way (in a window, in a side panel, via a container's\n * `openEntity` handler) instead of navigating the tab.\n *\n * Cmd/Ctrl/Shift/Alt/middle clicks are NOT intercepted: they keep the\n * browser's native new-tab behavior via the real `href`, so a surface that\n * takes over the click can never cost the user their current state. The\n * explicit new-tab control stays visible regardless.\n *\n * CONTRACT — pass `undefined` when the handler cannot actually open\n * anything. With no registry route AND an `onOpen`, the name renders as a\n * link-styled BUTTON; if that handler then no-ops (because it too was\n * gated on a route that doesn't exist), the user gets a control that looks\n * openable and does nothing — a dead end with extra steps, which is the\n * precise thing this component exists to kill. Gate at the call site:\n * `onOpen={canOpen ? handler : undefined}`.\n */\n onOpen?: () => void;\n className?: string;\n /**\n * Render arbitrary content as the label instead of the name text.\n *\n * The doors are the point of this component; the label is incidental. A\n * table cell renders `<span>{title}</span><Badge>Draft</Badge>`, a card\n * renders a title over a subtitle — neither is a string, and before this\n * existed those surfaces could not adopt `EntityRef` at all without\n * flattening what they show. That is how a shell ends up with its OWN\n * Open-only door beside this one (`MatrxDataTable.href`) and every column\n * that names a record loses new-tab and peek.\n *\n * `name` is still required-ish when you pass children: it supplies the\n * `title`/`aria-label` text, so a screen reader and a tooltip still say\n * which record this is.\n */\n children?: React.ReactNode;\n}\n\nconst CONTROL_CLASS =\n \"flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground \" +\n \"transition-colors hover:bg-accent hover:text-foreground\";\n\nexport function EntityRef({\n token,\n id,\n name,\n href,\n showIcon = true,\n disablePeek = false,\n disableNewTab = false,\n openInNewTab = false,\n wrap = false,\n fill = false,\n labelClassName,\n nameClassName,\n alwaysShowActions = false,\n extraActions,\n onOpen,\n className,\n children,\n}: EntityRefProps) {\n\n // Canonicalise ONCE, up front. A surface often passes a `kind` column owned\n // by another system (`source_kind='cld_file'` from the ingest pipeline), and\n // resolving the route from the canonical token while looking the peek up by\n // the raw string is how a record ends up with one door and not the other.\n const host = entityRefHost();\n const AppLink = host.Link;\n const ErrorAlchemyMenu = host.ErrorMenu;\n const canonicalToken = host.registry.canonical(token);\n const info = host.registry.describe(canonicalToken);\n // NOT `info.hrefFor(id)` directly: an agent's address depends on its KIND\n // (a builtin opens only in the admin System Agents shell) and the id may be\n // a VERSION id. See useEntityHref.ts — one seam, ~65 agent call sites fixed\n // at once instead of ~65 chances to guess wrong.\n const {\n href: resolvedHref,\n refusal,\n resolving: hrefResolving,\n } = useEntityHref(token, id, href);\n // The peek registry is keyed by canonical token, so there is nothing to\n // translate — `peekKeyForToken` existed only to bridge the legacy\n // catalog vocabulary and is deleted.\n const canPeek = !disablePeek && host.hasPeek(canonicalToken);\n const label = name?.trim() || `${displayId(id)}…`;\n // `label` stays the ACCESSIBLE name (title/aria) even when children\n // replace what is drawn — a tooltip reading \"Open\" tells nobody anything.\n const labelBody = children ?? label;\n const Icon = info?.Icon ?? null;\n\n const showNewTab = Boolean(resolvedHref) && !disableNewTab && !openInNewTab;\n const hasControls = canPeek || showNewTab || Boolean(extraActions);\n\n const stop = (e: React.MouseEvent) => e.stopPropagation();\n // One string carries BOTH label decisions so the three label branches\n // (link / button / inert span) cannot drift apart — they already did once.\n const labelFit = cn(\n wrap === \"lines\" ? \"line-clamp-2 break-words\" : wrap ? \"break-all\" : \"truncate\",\n fill && \"grow\",\n labelClassName,\n nameClassName,\n );\n\n return (\n <span\n className={cn(\n \"entity-ref group/entity-ref inline-flex min-w-0 max-w-full items-center gap-1\",\n className,\n )}\n data-entity-ref-host={hostMark(host)}\n >\n {showIcon && Icon && (\n <Icon className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n )}\n\n {resolvedHref ? (\n <AppLink\n href={resolvedHref}\n target={openInNewTab ? \"_blank\" : undefined}\n rel={openInNewTab ? \"noopener noreferrer\" : undefined}\n // A `_blank` navigation is a fresh document load — it cannot read the\n // client router cache, so prefetching it is a request that can never\n // be used. `EntityRef` lives in lists; at 50 rows that is 50 wasted\n // round trips.\n // Also false while an agent address is still resolving: the href is\n // then `/agents/go/<id>`, which REDIRECTS — and an RSC prefetch of a\n // redirect to the sibling deployment is the exact preflight the\n // cross-deployment link door exists to prevent.\n prefetch={openInNewTab || hrefResolving ? false : undefined}\n onClick={(e) => {\n stop(e);\n // A modified click keeps the browser's native new-tab behavior —\n // an interceptor must never cost the user their current state.\n if (!onOpen || isNativeNewTabClick(e)) return;\n e.preventDefault();\n onOpen();\n }}\n title={openInNewTab ? `Open ${label} in a new tab` : `Open ${label}`}\n // THE DOOR IS A CONTROL, NOT PROSE. `.matrx-touch-targets`\n // (app/globals.css) deliberately skips bare anchors so a sentence's\n // link does not become a 44px block, and opts real controls in by\n // this attribute. An EntityRef is never prose — it is the record's\n // door — so it opts in here, once, for every surface that declared\n // the floor. Outside such a subtree the attribute does nothing, so\n // desktop density is untouched everywhere.\n data-tap-target\n className={cn(\n \"min-w-0 text-inherit underline-offset-2 hover:text-primary hover:underline\",\n labelFit,\n )}\n >\n {labelBody}\n </AppLink>\n ) : onOpen ? (\n <ControlButton\n type=\"button\"\n variant=\"link\"\n onClick={(e) => {\n stop(e);\n onOpen();\n }}\n title={`Open ${label}`}\n className={cn(\"min-w-0 text-left\", labelFit)}\n >\n {labelBody}\n </ControlButton>\n ) : (\n /* No door. NOTHING FAILS SILENTLY: when we KNOW the record cannot be\n reached (`refusal`), the title says so in a sentence naming the id\n — a name with no explanation reads as a broken page. While an\n address is still resolving there is nothing to confess yet. */\n <span\n className={cn(\"min-w-0\", refusal && \"cursor-help\", labelFit)}\n title={refusal ?? label}\n aria-describedby={undefined}\n data-agent-link-refused={refusal ? \"true\" : undefined}\n data-agent-link-resolving={hrefResolving ? \"true\" : undefined}\n >\n {labelBody}\n {/* The error's actions ride only a KNOWN refusal: a plain name that\n simply has no door is not an error, and a copy-error button on it\n was a control that said something went wrong when nothing had. */}\n {refusal && ErrorAlchemyMenu ? <ErrorAlchemyMenu error={refusal} /> : null}\n </span>\n )}\n\n {/* An EMPTY controls span is not free: it is still a flex child, so the\n wrapper's `gap-1` reserves a space after the label. In a table cell\n that is invisible; inside a SENTENCE (`TextWithDoors`) it opens a\n hole in the middle of the server's words. Render nothing when there\n is nothing to render. */}\n {hasControls && (\n <span\n data-entity-ref-controls\n data-reveal-on-hover={alwaysShowActions ? undefined : \"true\"}\n className={cn(\n \"entity-ref-controls inline-flex shrink-0 items-center gap-0.5\",\n )}\n >\n {canPeek && (\n <ControlButton\n type=\"button\"\n variant=\"quiet\"\n icon={<LightbulbIcon />}\n title={`Quick look at ${label}`}\n aria-label={`Quick look at ${label}`}\n onClick={(e) => {\n stop(e);\n host.openPeek({\n kind: canonicalToken,\n id,\n // Keep the peek's footer aligned with the door that opened it.\n // `AppletRef`, for example, deliberately overrides the generic\n // app route with the administration editor route.\n href,\n anchor: e.currentTarget,\n trigger: \"click\",\n fallbackHref: resolvedHref,\n });\n }}\n className={CONTROL_CLASS}\n />\n )}\n {resolvedHref && showNewTab && (\n <AppLink\n href={resolvedHref}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n prefetch={false}\n onClick={stop}\n title={`Open ${label} in a new tab`}\n aria-label={`Open ${label} in a new tab`}\n className={CONTROL_CLASS}\n >\n <ExternalLinkIcon className=\"h-3 w-3\" />\n </AppLink>\n )}\n {extraActions}\n </span>\n )}\n\n {/* No peek mounts here: the app's ONE host (`ResourcePeekRoot`, app/Providers.tsx) draws it\n OUTSIDE this reference's React tree, so a click inside an open peek can no longer reach\n the clickable row or popover this reference sits in, and a popover that closes no\n longer takes the peek with it. */}\n </span>\n );\n}\n","\"use client\";\n\n/**\n * @ai-matrx/records-ui/entity-ref — useEntityHref\n *\n * WHERE AN ENTITY-REF LINK ACTUALLY POINTS.\n *\n * For almost every token, the entity registry's `hrefFor(id)` is the whole\n * answer: one id, one canonical route. AGENTS and TEAMS are the exceptions,\n * and they are the reason this seam exists.\n *\n * An agent's address depends on facts the caller does not hold (see\n * `features/agents/addressing/agentAddress.ts`): a builtin agent opens ONLY\n * under the admin System Agents tree, and the id might not be an agent id at\n * all — the platform stores VERSION ids in agent-shaped columns. Until\n * 2026-09-08 the registry answered `/agents/${id}` for every one of the ~65\n * `EntityRef token=\"agent\"` call sites, so every system agent named anywhere\n * in the app was a link into the wrong shell.\n *\n * A team's address depends on a fact the caller does not hold either (see\n * `features/organizations/addressing/teamAddress.ts`): a team has no page of\n * its own — it opens on its ORGANIZATION's settings page — and an id-only\n * caller does not know which organization that is.\n *\n * Fixing it HERE fixes all of them at once, which is the only fix worth\n * making: a per-call-site fix would be re-broken by the next call site.\n *\n * The host's `useAddress` hook resolves both (see ./host.tsx). It is called unconditionally with a null id for non-matching tokens,\n * so there is no conditional-hook hazard and no cost for the other tokens.\n */\n\nimport { entityRefPorts } from \"./slot\";\n\nexport interface EntityHrefResult {\n /** The href, or null while resolving / when the record cannot be placed. */\n href: string | null;\n /**\n * Set only when the record genuinely cannot be reached. The UI must SAY\n * this, not render a link that 404s and not render a dead-looking control\n * with no explanation.\n */\n refusal: string | null;\n /** True while an address is still being resolved — not a refusal. */\n resolving: boolean;\n}\n\nexport function useEntityHref(\n token: string,\n id: string,\n hrefOverride?: string,\n): EntityHrefResult {\n const host = entityRefPorts();\n const canonicalToken = host.registry.canonical(token);\n\n // Unconditional: the host's address hook runs on every render with a null id for every token\n // it does not resolve itself (an agent's kind, a team's organization live in the host).\n const door = host.useAddress(\n canonicalToken,\n hrefOverride ? null : id,\n `EntityRef token=\"${token}\"`,\n );\n\n if (hrefOverride) return { href: hrefOverride, refusal: null, resolving: false };\n\n if (door) {\n if (door.state === \"ready\") return { href: door.href, refusal: null, resolving: false };\n // A REAL href, not null: a resolving address is a server-side redirect route, so the link\n // works on the very first paint and keeps working if the resolver never answers.\n if (door.state === \"resolving\") return { href: door.href, refusal: null, resolving: true };\n return { href: null, refusal: door.reason, resolving: false };\n }\n\n const info = host.registry.describe(canonicalToken);\n return {\n href: host.adminHref(canonicalToken, id) ?? info?.hrefFor?.(id) ?? null,\n refusal: null,\n resolving: false,\n };\n}\n","\"use client\";\n\n// src/entity-ref/host.tsx — the drawing half of the entity-ref host (see ./slot.ts for every port).\n\nimport React, { type ComponentType } from \"react\";\nimport { getTapTargetLinkComponent } from \"@ai-matrx/design-system/tap-target\";\nimport { boundEntityRefHost, entityRefPorts, type EntityRefLinkProps, type EntityRefPerson, type EntityRefPorts } from \"./slot\";\n\nexport * from \"./slot\";\n\nfunction PlainLink({ href, prefetch: _prefetch, children, ref, ...rest }: EntityRefLinkProps) {\n const Registered = getTapTargetLinkComponent();\n if (Registered) {\n const R = Registered as unknown as ComponentType<EntityRefLinkProps>;\n return <R href={href} ref={ref} {...rest}>{children}</R>;\n }\n return (\n <a href={href} ref={ref} {...(rest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}>\n {children}\n </a>\n );\n}\n\n/** The bound host with every port filled (defaults announce themselves). */\nexport interface ResolvedEntityRefHost extends EntityRefPorts {\n Link: ComponentType<EntityRefLinkProps>;\n ErrorMenu: ComponentType<{ error: string }> | null;\n Person: ComponentType<{ user: EntityRefPerson; className?: string }>;\n}\n\nfunction PlainPerson({ user, className }: { user: EntityRefPerson; className?: string }) {\n return <span className={className}>{user.displayName || user.email || \"Unknown person\"}</span>;\n}\n\nexport function entityRefHost(): ResolvedEntityRefHost {\n const host = boundEntityRefHost();\n return { ...entityRefPorts(), Link: host?.Link ?? PlainLink, ErrorMenu: host?.ErrorMenu ?? null, Person: host?.Person ?? PlainPerson };\n}\n\n/** `data-entity-ref-host` value for a reference's wrapper. */\nexport function hostMark(host: ResolvedEntityRefHost): \"unconfigured\" | undefined {\n return host.configured ? undefined : \"unconfigured\";\n}\n\n/** lucide `arrow-up-right` (design-system's icon set has no such glyph yet). */\nexport function ArrowUpRightGlyph({ className }: { className?: string }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className ? `lucide-arrow-up-right ${className}` : \"lucide-arrow-up-right\"}\n aria-hidden\n >\n <path d=\"M7 7h10v10\" />\n <path d=\"M7 17 17 7\" />\n </svg>\n );\n}\n","\"use client\";\n\n/**\n * EntityDoorControls — the DOORS, without the name.\n *\n * `EntityRef` is the default: it renders a record's name AS the door. But some\n * surfaces genuinely cannot make the name an anchor:\n *\n * - the name is an inline EDITOR (`AssociationEntitySelect` — click to rename)\n * - the name sits inside a `<button>` whose click means something else\n * (a picker row, where clicking = attach). An `<a>` inside a `<button>` is\n * invalid DOM and a hydration error, and a stray click that navigated away\n * would cost the user the picker they are standing in.\n *\n * Those surfaces render this cluster as a SIBLING of the name. It is the same\n * implementation `EntityRef` uses (EntityRef composes it), so a registry edit\n * lights up both and neither can drift.\n *\n * Same-tab \"Open\" is OPT-IN (`showOpen`) precisely because the callers above are\n * mid-task surfaces: peek + new tab answer \"which one is that?\" without\n * destroying what the user is doing. Pass `showOpen` when the surface is a plain\n * list the user can safely leave.\n *\n * Standalone controls are visible by default. Hover reveal is opt-in through\n * `revealOnHover`; when enabled, controls fade in on hover of EITHER the named `group/entity-ref`\n * (what `EntityRef` puts on its own wrapper) OR a plain Tailwind `group`, which\n * is what almost every row in this codebase already carries for its other\n * hover-revealed affordances.\n *\n * Accepting both is deliberate and load-bearing. The named group alone made a\n * silent, invisible failure the DEFAULT for standalone callers: forget the\n * class and the doors render at `opacity-0`, so the surface looks finished, the\n * markup is right, type-check and lint are green — and the user simply cannot\n * see the door. That is the exact dead end this module exists to remove, and it\n * shipped twice (the two debug-window sidebars, 2026-08-09) before Bugbot\n * caught it. A primitive whose correct use depends on remembering an invisible\n * convention will be misused; make the common case work instead.\n *\n * `alwaysShowActions` remains as a compatibility override that pins them visible\n * (a window title bar, a touch-first list). **Reach for it in any popover or\n * transient panel too**: `opacity-0` does not disable hit-testing, so on touch\n * the hover form is the worst case — invisible controls that are still\n * tappable. The row reserves their width either way (this cluster is\n * `shrink-0`), so pinning them costs no layout.\n *\n * Link doors carry `data-tap-target` so a host's `matrx-touch-targets` scope\n * can raise these intentionally compact desktop controls to the 44px\n * coarse-pointer floor without treating prose links as controls.\n *\n * The peek opens through `openResourcePeek` and renders in the app's ONE host\n * (`ResourcePeekRoot`, app/Providers.tsx), outside this component's tree — so a\n * popover that closes because the person clicked into the peek no longer\n * unmounts the peek with it (the \"door that deletes itself\" trap, 2026-08-09).\n * The popover still closes; a container that should stay open must ignore\n * events whose target is inside a dialog:\n *\n * if (target?.closest?.('[role=\"dialog\"], [role=\"alertdialog\"]')) return;\n *\n * Adding a door for a new entity type is a registry edit, never a change here:\n * route → `hrefFor` in `features/scopes/registry/entityRegistry.ts`\n * peek → `features/organizations/peek/registry.ts` + `kinds-list.ts`\n */\n\nimport React from \"react\";\nimport { ExternalLinkIcon as ExternalLink, LightbulbIcon as Lightbulb } from \"@ai-matrx/design-system/icons\";\nimport { Button } from \"@ai-matrx/design-system/controls\";\nimport { cn, displayId } from \"@ai-matrx/design-system\";\nimport { resolveEntityDoors } from \"./doors\";\nimport { ArrowUpRightGlyph as ArrowUpRight, entityRefHost } from \"./host\";\n\nexport const ENTITY_DOOR_CONTROL_CLASS =\n \"flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground \" +\n \"transition-colors hover:bg-accent hover:text-foreground\";\n\nexport interface EntityDoorControlsProps {\n /** Canonical entity token (`agent`, `note`, `task`, …). */\n token: string;\n /** The record's id. */\n id: string;\n /** Display name — used only for the control labels/tooltips. */\n name?: string | null;\n /**\n * Override the registry route. Honored exactly: `null` means \"this record\n * has no door\" and must not fall through to the registry; omit to defer.\n */\n href?: string | null;\n /** Hide the peek control even when one is registered. */\n disablePeek?: boolean;\n /** Hide the new-tab control. */\n disableNewTab?: boolean;\n /** Also render a same-tab Open control (off by default — see the header). */\n showOpen?: boolean;\n /** Controls stay visible instead of appearing on hover/focus. */\n alwaysShowActions?: boolean;\n /** Opt into hover/focus reveal. Standalone controls are visible by default. */\n revealOnHover?: boolean;\n /** Surface-specific extra doors (open in window, jump to versions, …). */\n extraActions?: React.ReactNode;\n /**\n * `md` = THE control (`Button` variant=\"quiet\", 28px, 16px glyph) — use it in\n * any bar of 28px controls (card hover bars, attach-menu rows) so the bar\n * never mixes sizes. `sm` = the compact inline 20px door beside text.\n */\n size?: \"sm\" | \"md\";\n className?: string;\n}\n\nexport function EntityDoorControls({\n token,\n id,\n name,\n href,\n disablePeek = false,\n disableNewTab = false,\n showOpen = false,\n alwaysShowActions = false,\n revealOnHover = false,\n extraActions,\n size = \"sm\",\n className,\n}: EntityDoorControlsProps) {\n const glyph = \"h-3 w-3\";\n\n const host = entityRefHost();\n const Link = host.Link;\n const doors = resolveEntityDoors(token, id, href);\n const resolvedHref = doors.href;\n const canPeek = !disablePeek && doors.canPeek;\n const label = name?.trim() || `${displayId(id)}…`;\n\n // Nothing to offer → render no chrome at all. A control that goes nowhere is\n // the dead end this whole module exists to kill.\n if (!canPeek && !resolvedHref && !extraActions) return null;\n\n const stop = (e: React.MouseEvent) => e.stopPropagation();\n const openPeek = (anchor: Element) =>\n host.openPeek({\n kind: doors.peekKind,\n id,\n // Forward the CALLER's `href`, not our resolved one. When a caller\n // overrode it — because the token alone cannot say which surface\n // this record opens on — the dialog would otherwise send \"Open\"\n // somewhere our new-tab link does not go. Passing `resolvedHref`\n // here instead would set the override on EVERY peek, including the\n // ones where nobody overrode anything, and would then suppress the\n // hardcoded href a token-less bespoke peek supplies for itself.\n // `undefined` (no caller opinion) is the correct default.\n href,\n anchor,\n trigger: \"click\",\n fallbackHref: resolvedHref,\n });\n\n return (\n <>\n <span\n className={cn(\n // THE control carries its own 3px half-gap, so a `md` cluster adds none.\n \"inline-flex shrink-0 items-center\",\n size !== \"md\" && \"gap-0.5\",\n revealOnHover &&\n !alwaysShowActions &&\n \"opacity-0 transition-opacity group-hover/entity-ref:opacity-100 group-hover:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100\",\n className,\n )}\n >\n {size === \"md\" ? (\n <>\n {canPeek && (\n <Button\n variant=\"quiet\"\n icon={<Lightbulb />}\n title={`Quick look at ${label}`}\n aria-label={`Quick look at ${label}`}\n onClick={(e) => {\n stop(e);\n openPeek(e.currentTarget);\n }}\n />\n )}\n {resolvedHref && showOpen && (\n <Button variant=\"quiet\" icon={<ArrowUpRight />} asChild>\n <Link\n href={resolvedHref}\n data-tap-target\n onClick={stop}\n title={`Open ${label}`}\n aria-label={`Open ${label}`}\n />\n </Button>\n )}\n {resolvedHref && !disableNewTab && (\n <Button variant=\"quiet\" icon={<ExternalLink />} asChild>\n <Link\n href={resolvedHref}\n data-tap-target\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={stop}\n title={`Open ${label} in a new tab`}\n aria-label={`Open ${label} in a new tab`}\n />\n </Button>\n )}\n </>\n ) : (\n <>\n {canPeek && (\n <Button\n type=\"button\"\n variant=\"quiet\"\n icon={<Lightbulb />}\n title={`Quick look at ${label}`}\n aria-label={`Quick look at ${label}`}\n onClick={(e) => {\n stop(e);\n openPeek(e.currentTarget);\n }}\n className={ENTITY_DOOR_CONTROL_CLASS}\n />\n )}\n {resolvedHref && showOpen && (\n <Link\n href={resolvedHref}\n data-tap-target\n onClick={stop}\n title={`Open ${label}`}\n aria-label={`Open ${label}`}\n className={ENTITY_DOOR_CONTROL_CLASS}\n >\n <ArrowUpRight className={glyph} />\n </Link>\n )}\n {resolvedHref && !disableNewTab && (\n <Link\n href={resolvedHref}\n data-tap-target\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={stop}\n title={`Open ${label} in a new tab`}\n aria-label={`Open ${label} in a new tab`}\n className={ENTITY_DOOR_CONTROL_CLASS}\n >\n <ExternalLink className={glyph} />\n </Link>\n )}\n </>\n )}\n {extraActions}\n </span>\n\n </>\n );\n}\n","\"use client\";\n\n/**\n * NewTabLink — THE box-with-arrow (lucide `ExternalLink`) control.\n *\n * Arman, 2026-09-26: the ExternalLink icon means ONE thing platform-wide —\n * \"open this in a new tab\". It was being drawn on same-tab links and rendered\n * disabled beside names that had nothing to open. So the icon has one home:\n *\n * - it is always a real anchor with `target=\"_blank\"` + `rel=\"noopener\n * noreferrer\"` (modified clicks and middle-clicks stay native);\n * - it is never disabled — with no `href` it renders NOTHING;\n * - it stops propagation, so it is safe inside clickable rows and cards.\n *\n * A same-tab \"open\" uses `ArrowUpRight` (see `EntityDoorControls`), never this\n * icon. The Lightbulb means Peek. Guard: `pnpm check:new-tab-icon`.\n */\n\nimport React from \"react\";\nimport { ExternalLinkIcon as ExternalLink } from \"@ai-matrx/design-system/icons\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { entityRefHost } from \"./host\";\n\nexport const NEW_TAB_CONTROL_CLASS =\n \"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground \" +\n \"transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none \" +\n \"focus-visible:ring-1 focus-visible:ring-ring\";\n\nexport interface NewTabLinkProps {\n /** Where the new tab goes. Absent/empty → the control is absent. */\n href: string | null | undefined;\n /** What opens, for the tooltip and screen readers (\"Deep Research\"). */\n label: string;\n className?: string;\n iconClassName?: string;\n /** Text beside the icon (\"New tab\"). Icon-only when omitted. */\n children?: React.ReactNode;\n /** Runs after the tab opens (e.g. close the palette that held the link). */\n onOpen?: () => void;\n}\n\nexport function NewTabLink({\n href,\n label,\n className,\n iconClassName,\n children,\n onOpen,\n}: NewTabLinkProps) {\n const AppLink = entityRefHost().Link;\n if (!href) return null;\n const words = `Open ${label} in a new tab`;\n return (\n <AppLink\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n prefetch={false}\n data-tap-target\n onClick={(event) => {\n event.stopPropagation();\n onOpen?.();\n }}\n title={words}\n aria-label={children ? undefined : words}\n className={cn(children ? \"inline-flex items-center gap-1.5\" : NEW_TAB_CONTROL_CLASS, className)}\n >\n <ExternalLink className={cn(\"h-3.5 w-3.5\", iconClassName)} aria-hidden />\n {children}\n </AppLink>\n );\n}\n","\"use client\";\n\n/**\n * TextWithDoors — THE way to print a sentence somebody else wrote.\n *\n * THE DOOR LAW (common-docs/policies/no-dead-ends.md) does not stop at table\n * cells: if the UI NAMES a thing that has an identity in our system, the UI\n * must let the user reach it. A server refusal that says\n *\n * resolved system agent <agent uuid> breaks the\n * mandate contract: declares no structured output_schema\n *\n * names an agent. Printed as flat text it is a dead end with extra steps — the\n * person is told which record is wrong and then made to hand-copy a uuid into\n * a URL bar to go look at it. That is the defect this component closes, and it\n * closes it for the whole class: every surface that prints a server sentence\n * (`ServerNotes`, refusal banners, dropped-rung reasons, run failures) renders\n * it through here instead of through a bare `{message}`.\n *\n * VERBATIM. The server is the authority on what it just said, so nothing here\n * rewrites, shortens or re-orders a word — `segmentSentenceIds` preserves every\n * character in order. The only change is that the ids become openable, with the\n * full id still on screen (`name={id}`), never truncated to `8f0bbfc2…`.\n *\n * THE AUTHOR'S OWN MARKS ARE HONORED, NOT PRINTED. A sentence that says its\n * field names in markdown backticks meant them as code; this is the one place\n * that renders them as `<code>`, so no surface needs — or is allowed to grow —\n * a second inline-markdown renderer of its own. See `doors.ts`\n * § INLINE CODE, THE WAY ITS AUTHOR WROTE IT.\n *\n * CONSERVATIVE. An id becomes a door only when the sentence's own words name an\n * entity type the platform can actually open, or the call site declares one via\n * `defaultToken`. Anything else stays plain text: a link to the wrong record\n * reads as a fact and is a lie, which the doctrine ranks below no link at all.\n */\n\nimport React from \"react\";\nimport { EntityRef } from \"./EntityRef\";\nimport { segmentSentenceIds } from \"./doors\";\n\nexport interface TextWithDoorsProps {\n /** The sentence, exactly as its author wrote it. */\n text: string | null | undefined;\n /**\n * The entity type this surface KNOWS its sentences are about, used only when\n * the prose names nothing openable — a mandate-resolution refusal is always\n * about an agent, and its screen may say so.\n */\n defaultToken?: string | null;\n /**\n * Ids open in a NEW TAB (default). These sentences live in banners, panels\n * and sheets over work in progress; navigating the tab away to go read the\n * accused record is the data loss the new-tab door exists to prevent.\n */\n openInNewTab?: boolean;\n /** Classes for each id's `EntityRef` wrapper. */\n refClassName?: string;\n}\n\nexport function TextWithDoors({\n text,\n defaultToken,\n openInNewTab = true,\n refClassName,\n}: TextWithDoorsProps) {\n if (!text) return null;\n const segments = segmentSentenceIds(text, defaultToken);\n return (\n <>\n {segments.map((segment, index) =>\n segment.kind === \"text\" ? (\n // Position IS the identity of a prose run — the segments are a\n // deterministic split of one immutable string, never a reorderable list.\n <React.Fragment key={`t${index}`}>{segment.text}</React.Fragment>\n ) : segment.kind === \"code\" ? (\n // 🚨 THE AUTHOR'S BACKTICKS ARE MARKUP, NOT WORDS (R-O2). A sentence\n // naming `title` and `slides` reaches a subject matter expert, and\n // the marks are how its author said \"these are field names\" — so\n // they become a `<code>`, not two stray punctuation characters on\n // the screen. Same font treatment as an id, one class of thing.\n <code\n key={`c${index}`}\n className=\"rounded bg-muted px-1 py-px font-mono text-[0.95em]\"\n >\n {segment.text}\n </code>\n ) : (\n <EntityRef\n key={`r${index}:${segment.id}`}\n token={segment.token}\n id={segment.id}\n // The full id stays on screen: the sentence is verbatim, and an\n // ellipsis would destroy the very string the reader came to copy.\n name={segment.id}\n showIcon={false}\n // NO HOVER CONTROLS MID-SENTENCE. `EntityRef`'s peek/new-tab\n // controls are laid out inline and reserve their width even while\n // invisible, which opens a hole in the middle of the server's\n // sentence — the one thing this component promises not to do. The\n // label itself is the door here, and it opens in a new tab.\n disablePeek\n disableNewTab\n wrap\n openInNewTab={openInNewTab}\n className={refClassName ?? \"align-baseline font-mono text-[0.95em]\"}\n />\n ),\n )}\n </>\n );\n}\n","\"use client\";\n\n/**\n * toastDoor — the door for a record a TOAST just told you about.\n *\n * THE DEAD END this kills: \"Note created\", \"Duplicated\", \"Reassigned 5\n * resources\". The app just made or changed a specific record, had its id in\n * hand, and the only thing the user can do about it is watch the toast fade.\n * Finding the thing again means going back to a list and hunting for it.\n *\n * Sonner's `action` accepts a ReactNode as well as `{label, onClick}`, so the\n * door is a real `<Link>`, NOT a button with an onClick. That matters: an\n * anchor gives same-tab Open, cmd-click and middle-click new-tab, and a\n * copyable target — three of the four doors — where an onClick gives exactly\n * one and steals the rest. Never \"fix\" this into a button.\n *\n * toast.success(\"Note created\", { action: toastDoor(\"note\", id) })\n *\n * Returns `undefined` when the token has no route, so the spread above is safe\n * everywhere: a toast about an unreachable record simply has no action, rather\n * than a control that goes nowhere.\n *\n * Peek is deliberately NOT offered. A toast is transient and usually\n * off-center; a preview that outlives its trigger is a worse affordance than a\n * link. Adding a door for a new entity type is a registry edit\n * (`hrefFor` in `features/scopes/registry/entityRegistry.ts`), never a change\n * here.\n */\n\nimport React from \"react\";\nimport { entityRefHost } from \"./host\";\nimport { resolveEntityDoors } from \"./doors\";\n\nexport interface ToastDoorOptions {\n /** Button text. Defaults to \"Open\". */\n label?: string;\n /**\n * Override the registry route. Honored exactly: `null` means \"no door\" and\n * must not fall through to the registry.\n */\n href?: string | null;\n}\n\nexport function toastDoor(\n token: string,\n id: string | null | undefined,\n options: ToastDoorOptions = {},\n): React.ReactNode | undefined {\n if (!id) return undefined;\n\n const { href } = resolveEntityDoors(token, id, options.href);\n if (!href) return undefined;\n const Link = entityRefHost().Link;\n\n return (\n <Link\n href={href}\n className=\"shrink-0 rounded bg-primary px-2 py-1 type-secondary font-medium text-primary-foreground transition-colors hover:bg-primary/90\"\n >\n {options.label ?? \"Open\"}\n </Link>\n );\n}\n","\"use client\";\n\n/**\n * RecordStamps — the platform-standard footer for \"who touched this row, when\".\n *\n * EVERY entity in this platform carries the same six columns (`created_at`,\n * `created_by`, `updated_at`, `updated_by`, `deleted_at`, `version`), and\n * before this component every detail surface either dropped them entirely or\n * printed the actor as a raw uuid. Both are DOOR LAW failures: the first hides\n * stored data the user paid for, the second shows an id nobody can open.\n *\n * Built as a primitive rather than inline (PRINCIPLES.md — build the platform,\n * not the artifact): the marketing finding/snapshot/asset inspectors are its\n * first three consumers, and every other record detail in the app should be\n * its next.\n *\n * Actor resolution lives in `useRecordActors` and costs NOTHING when both\n * actor ids are null — the normal shape of a server-written row, where\n * \"System\" is the true answer rather than a missing one.\n */\n\nimport { cn, RecordId } from \"@ai-matrx/design-system\";\nimport { entityRefHost } from \"./host\";\nimport type { EntityRefPerson } from \"./slot\";\n\n/** One actor as `resolveActor` answers it (the host's identity resolver, e.g. the app's `useRecordActors`). */\nexport interface RecordStampActor {\n id: string;\n /** Non-null once we know who this is. */\n user: EntityRefPerson | null;\n /** True while the directory read is still in flight. */\n loading: boolean;\n}\n\nexport interface RecordStampsProps {\n organizationId?: string | null;\n createdAt?: string | null;\n /**\n * The row's creator. OMIT for a COMPONENT row (one that takes its access\n * from a parent): there the database rewrites `created_by` to the PARENT's\n * owner (db-rules §6d-1), so it is not who created this row — pass\n * `component` instead and the Created stamp shows the time only.\n */\n createdBy?: string | null;\n /** A component row: the Created stamp carries no actor (see `createdBy`). */\n component?: boolean;\n updatedAt?: string | null;\n updatedBy?: string | null;\n deletedAt?: string | null;\n version?: number | null;\n /** Formatter for a timestamp — pass the surface's own (e.g. `formatDate`). */\n formatTimestamp: (value: string | null) => string;\n /** Resolver from `useRecordActors` — call the hook in the parent. */\n resolveActor: ((id: string | null | undefined) => RecordStampActor | null) | null;\n className?: string;\n}\n\nfunction Stamp({\n label,\n at,\n actorId,\n formatTimestamp,\n resolveActor,\n tone,\n showActor = true,\n}: {\n label: string;\n at?: string | null | undefined;\n actorId?: string | null | undefined;\n formatTimestamp: (value: string | null) => string;\n resolveActor: RecordStampsProps[\"resolveActor\"];\n tone?: \"warning\" | undefined;\n /** False when no actor is recorded for this stamp (a component's Created). */\n showActor?: boolean | undefined;\n}) {\n if (!at) return null;\n const actor = resolveActor?.(actorId) ?? null;\n const Person = entityRefHost().Person;\n return (\n <div className=\"min-w-0\">\n <dt className=\"type-meta font-semibold uppercase tracking-wide text-muted-foreground\">\n {label}\n </dt>\n <dd\n className={cn(\n \"mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 type-secondary text-foreground\",\n tone === \"warning\" && \"text-warning\",\n )}\n >\n <span className=\"whitespace-nowrap\">{formatTimestamp(at)}</span>\n {!showActor ? null : actor ? (\n actor.user ? (\n <Person user={actor.user} className=\"min-w-0 gap-1.5 type-secondary\" />\n ) : actor.loading ? (\n <span className=\"text-muted-foreground\">resolving…</span>\n ) : (\n // Honest: we know an account acted, and we cannot name it (they\n // are not a current member of this organization). Showing the id\n // as a door would be a lie — it is offered as a support handle.\n <span\n className=\"truncate font-mono type-meta text-muted-foreground\"\n title={`Account ${actor.id} — no longer a member of this organization`}\n >\n a former member · <RecordId value={actor.id} label=\"Account\" />\n </span>\n )\n ) : (\n <span className=\"text-muted-foreground\">Automatically</span>\n )}\n </dd>\n </div>\n );\n}\n\nexport function RecordStamps({\n createdAt,\n createdBy,\n component = false,\n updatedAt,\n updatedBy,\n deletedAt,\n version,\n formatTimestamp,\n resolveActor,\n className,\n}: RecordStampsProps) {\n return (\n <dl\n className={cn(\n \"grid grid-cols-2 gap-x-4 gap-y-2.5 type-secondary sm:grid-cols-4\",\n className,\n )}\n >\n <Stamp\n label=\"Created\"\n at={createdAt}\n actorId={component ? null : createdBy}\n showActor={!component}\n formatTimestamp={formatTimestamp}\n resolveActor={resolveActor}\n />\n <Stamp\n label=\"Last updated\"\n at={updatedAt}\n actorId={updatedBy}\n formatTimestamp={formatTimestamp}\n resolveActor={resolveActor}\n />\n <Stamp\n label=\"Moved to trash\"\n at={deletedAt}\n formatTimestamp={formatTimestamp}\n resolveActor={resolveActor}\n tone=\"warning\"\n />\n {typeof version === \"number\" ? (\n <div className=\"min-w-0\">\n <dt className=\"type-meta font-semibold uppercase tracking-wide text-muted-foreground\">\n Row version\n </dt>\n <dd className=\"mt-0.5 type-secondary tabular-nums text-foreground\">\n {version}\n </dd>\n </div>\n ) : null}\n </dl>\n );\n}\n"],"mappings":";;;;AA+BA,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAuF7B,IAAM,QAAQ,WAAW,uCAAuC,OAAO,EAAE,MAAM,KAA6B,EAAE;AAGvG,SAAS,oBAAoB,MAAkC;AACpE,QAAM,OAAO;AACf;AAGO,SAAS,uBAAgC;AAC9C,SAAO,QAAQ,MAAM,IAAI;AAC3B;AAEA,IAAI,SAAS;AACb,SAAS,uBAA6B;AACpC,MAAI,OAAQ;AACZ,WAAS;AACT,MAAI,OAAO,YAAY,aAAa;AAClC,YAAQ;AAAA,MACN;AAAA,IAEF;AAAA,EACF;AACF;AAEA,IAAM,wBAA2C;AAAA,EAC/C,WAAW,CAAC,UAAU;AAAA,EACtB,UAAU,MAAM;AAClB;AAEO,SAAS,iBAAiB,KAA6B;AAC5D,QAAM,OAAO,IAAI,gBAAgB,IAAI;AACrC,MAAI,KAAM,cAAa,MAAM,UAAU,UAAU;AACnD;AAYA,IAAM,YAAY,MAAM;AAGjB,SAAS,qBAA2C;AACz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EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,SACE,gBAAAC;AAAA,IAAC;AAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MAEA;AAAA,wBAAAF;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,IAAI;AAAA,YACJ,SAAS,YAAY,OAAO;AAAA,YAC5B,WAAW,CAAC;AAAA,YACZ;AAAA,YACA;AAAA;AAAA,QACF;AAAA,QACA,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,IAAI;AAAA,YACJ,SAAS;AAAA,YACT;AAAA,YACA;AAAA;AAAA,QACF;AAAA,QACA,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,IAAI;AAAA,YACJ;AAAA,YACA;AAAA,YACA,MAAK;AAAA;AAAA,QACP;AAAA,QACC,OAAO,YAAY,WAClB,gBAAAC,MAAC,SAAI,WAAU,WACb;AAAA,0BAAAD,KAAC,QAAG,WAAU,yEAAwE,yBAEtF;AAAA,UACA,gBAAAA,KAAC,QAAG,WAAU,sDACX,mBACH;AAAA,WACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;","names":["jsx","jsxs","cn","displayId","jsx","jsxs","displayId","cn","ExternalLink","cn","jsx","jsxs","cn","ExternalLink","Fragment","jsx","jsx","cn","jsx","jsxs","cn"]}
|
|
1
|
+
{"version":3,"sources":["../src/entity-ref/slot.ts","../src/entity-ref/doors.ts","../src/entity-ref/EntityRef.tsx","../src/entity-ref/useEntityHref.ts","../src/entity-ref/host.tsx","../src/entity-ref/EntityDoorControls.tsx","../src/entity-ref/NewTabLink.tsx","../src/entity-ref/TextWithDoors.tsx","../src/entity-ref/toastDoor.tsx","../src/entity-ref/RecordStamps.tsx"],"sourcesContent":["/**\n * src/entity-ref/slot.ts — @ai-matrx/records-ui/entity-doors (no \"use client\": pure, server-safe)\n *\n * THE ENTITY-REF HOST: what a reference to another record needs from the app that draws it.\n *\n * A reference (`EntityRef`, `EntityDoorControls`, `TextWithDoors`, `toastDoor`, `NewTabLink`) is\n * drawn EVERYWHERE — table cells, chat bubbles, toasts, sentences — far outside any\n * `<RecordsUiProvider>`. So, unlike the screens' host, this one is bound ONCE per page through\n * `configureEntityRefs(...)` (a module-level slot on `globalThis`, so every module-graph copy of the\n * package reads the same binding) before anything renders.\n *\n * The ports, each with a default that ANNOUNCES ITSELF instead of pretending:\n *\n * registry token → label, icon, route, title column (the app's scopes/entity registry).\n * Default: knows no token — every reference draws its name with no door.\n * adminHref the admin-shell twin of a record's route. Default: none.\n * hasPeek whether a quick-look exists for a kind. Default: none.\n * openPeek opens the app's ONE quick-look host. Default: opens `fallbackHref` in a new tab.\n * useAddress a HOOK resolving tokens whose address depends on more than the id (an agent's kind,\n * a team's organization). Default: none — the registry route is used.\n * Link the app's router link. Default: design-system's registered tap-target link, else <a>.\n * ErrorMenu the actions drawn beside a KNOWN refusal. Default: none.\n *\n * Unconfigured, every reference carries `data-entity-ref-host=\"unconfigured\"` and the first draw\n * warns once in the console, naming `configureEntityRefs`.\n *\n * The host MUST be configured before the first render: `useAddress` is a hook, and the number of\n * hooks a component calls cannot change between renders.\n */\n\nimport type { ComponentType, MouseEvent, ReactNode, Ref } from \"react\";\nimport { globalSlot } from \"@ai-matrx/kit/global-slot\";\nimport { openOutbound } from \"@ai-matrx/kit/outbound\";\n\n/** One registered entity type, as a reference draws it. */\nexport interface EntityRefDescriptor {\n /** Singular display label (\"Agent\", \"Note\"). */\n label: string;\n /** The type's icon. */\n Icon: ComponentType<{ className?: string }> | null;\n /** Canonical route to one record, or null when the type has no page. */\n hrefFor: ((id: string) => string) | null;\n /** The column a generic quick-look reads the title from; null = no generic quick-look. */\n titleColumn: string | null;\n /**\n * True when the type's table is NOT browser-readable (a candidates lister stands in), so a\n * generic quick-look would always fail and is not offered.\n */\n listCandidatesOnly: boolean;\n}\n\n/** The entity registry as a reference needs it. */\nexport interface EntityRefRegistry {\n /** Raw token (a kind column owned by another system) → canonical token. */\n canonical(token: string): string;\n /** Canonical token → descriptor, or null for a token nobody registered. */\n describe(token: string): EntityRefDescriptor | null;\n}\n\n/** A quick-look request. */\nexport interface EntityRefPeekAsk {\n /** Peek catalog key. */\n kind: string;\n id: string;\n /** The destination the CALLER resolved, when a token alone cannot name it. */\n href?: string | null | undefined;\n anchor?: Element | null | undefined;\n trigger?: \"hover\" | \"click\" | undefined;\n /** Where the record opens when the host has no quick-look surface mounted. */\n fallbackHref?: string | null | undefined;\n}\n\n/** An address resolved by the host's `useAddress` hook. */\nexport type EntityAddress =\n | { state: \"ready\"; href: string }\n /** A REAL href that works while resolving (a server-side redirect route). */\n | { state: \"resolving\"; href: string }\n /** The record genuinely cannot be reached; `reason` is the sentence the UI says. */\n | { state: \"refused\"; reason: string };\n\nexport interface EntityRefLinkProps {\n href: string;\n target?: string | undefined;\n rel?: string | undefined;\n prefetch?: boolean | undefined;\n title?: string | undefined;\n className?: string | undefined;\n onClick?: ((event: MouseEvent<HTMLAnchorElement>) => void) | undefined;\n \"aria-label\"?: string | undefined;\n \"data-tap-target\"?: boolean | undefined;\n children?: ReactNode;\n ref?: Ref<HTMLAnchorElement> | undefined;\n}\n\n/** A person as an identity resolver answers them (UserIdentity-compatible). */\nexport interface EntityRefPerson {\n id?: string | null;\n email?: string | null;\n displayName?: string | null;\n avatarUrl?: string | null;\n}\n\nexport interface EntityRefHost {\n registry: EntityRefRegistry;\n adminHref?: ((token: string, id: string) => string | null) | undefined;\n hasPeek?: ((kind: string) => boolean) | undefined;\n openPeek?: ((ask: EntityRefPeekAsk) => void) | undefined;\n /**\n * A HOOK, called on every render of every reference: `id` is null for the tokens the host does\n * not resolve itself, and the hook returns null for them. Must call the same hooks every time.\n */\n useAddress?: ((token: string, id: string | null, context: string) => EntityAddress | null) | undefined;\n Link?: ComponentType<EntityRefLinkProps> | undefined;\n ErrorMenu?: ComponentType<{ error: string }> | undefined;\n /** Draws one person (avatar + name), compact. Default: the name as text. */\n Person?: ComponentType<{ user: EntityRefPerson; className?: string }> | undefined;\n}\n\n// One binding for every module-graph copy of the package (kit's globalSlot, like the person's zone).\n// `warned` rides the same slot: /entity-doors and /entity-ref each bundle this module, so a module-level\n// flag would warn once per copy (check-ships-once --state).\nconst bound = globalSlot(\"ai-matrx.records-ui.entity-ref-host\", () => ({ host: null as EntityRefHost | null, warned: false }));\n\n/** Bind the app's entity-ref host. Call once, at module load, before anything renders. */\nexport function configureEntityRefs(host: EntityRefHost | null): void {\n bound.host = host;\n}\n\n/** True once a host has been bound. */\nexport function entityRefsConfigured(): boolean {\n return Boolean(bound.host);\n}\n\nfunction announceUnconfigured(): void {\n if (bound.warned) return;\n bound.warned = true;\n if (typeof console !== \"undefined\") {\n console.warn(\n \"[@ai-matrx/records-ui/entity-ref] Entity reference host is not configured. \" +\n \"Call configureEntityRefs(...) before rendering references.\",\n );\n }\n}\n\nconst UNCONFIGURED_REGISTRY: EntityRefRegistry = {\n canonical: (token) => token,\n describe: () => null,\n};\n\nexport function fallbackOpenPeek(ask: EntityRefPeekAsk): void {\n const href = ask.fallbackHref ?? ask.href;\n if (href) openOutbound(href, \"_blank\", \"noopener\");\n}\n\n/** The bound host's non-drawing ports, defaults filled (defaults announce themselves). */\nexport interface EntityRefPorts {\n configured: boolean;\n registry: EntityRefRegistry;\n adminHref: (token: string, id: string) => string | null;\n hasPeek: (kind: string) => boolean;\n openPeek: (ask: EntityRefPeekAsk) => void;\n useAddress: (token: string, id: string | null, context: string) => EntityAddress | null;\n}\n\nconst noAddress = () => null;\n\n/** The raw bound host, or null. */\nexport function boundEntityRefHost(): EntityRefHost | null {\n return bound.host;\n}\n\nexport function entityRefPorts(): EntityRefPorts {\n const host = boundEntityRefHost();\n if (!host) announceUnconfigured();\n return {\n configured: Boolean(host),\n registry: host?.registry ?? UNCONFIGURED_REGISTRY,\n adminHref: host?.adminHref ?? (() => null),\n hasPeek: host?.hasPeek ?? (() => false),\n openPeek: host?.openPeek ?? fallbackOpenPeek,\n useAddress: host?.useAddress ?? noAddress,\n };\n}\n\n/** A modified click (new tab/window, middle button) keeps the browser's native behavior. */\nexport function isNativeNewTabClick(e: {\n metaKey?: boolean;\n ctrlKey?: boolean;\n shiftKey?: boolean;\n altKey?: boolean;\n button?: number;\n}): boolean {\n return Boolean(e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button === 1);\n}\n\n","/**\n * Door resolution — the ONE place a (token, id) pair becomes reachable doors.\n *\n * THE DOOR LAW (common-docs/policies/no-dead-ends.md): if the UI names a thing\n * that has an identity in our system, the UI must let the user reach it. Two\n * different presentations need the same answer:\n *\n * `EntityRef` — a NAME with doors (the default; prefer it always)\n * `MatrxUuidCell` — an ID with doors (only when the name genuinely isn't\n * loaded — a raw FK column in a dense admin table)\n *\n * Both call `resolveEntityDoors`, so a registry edit lights up both at once and\n * neither can drift from the other. This module is deliberately component-free\n * and cheap to import: it pulls the entity registry (icons + `hrefFor`) and the\n * peek KIND LIST — never `features/organizations/peek/registry.ts`, which\n * statically imports all 19 peek components (THE FRAGMENTATION LAW).\n *\n * Adding a door for a new entity type is a registry edit, never a change here:\n * route → `hrefFor` in `features/scopes/registry/entityRegistry.ts`\n * peek → `features/organizations/peek/registry.ts` + `kinds-list.ts` for a\n * BESPOKE preview. Every registered entity with a readable title\n * column already gets the generic `RegistryPeek` for free, so a new\n * entity is previewable the moment it is registered — write a bespoke\n * one only when the kind deserves more than title/description/dates.\n */\n\nimport type { ComponentType } from \"react\";\nimport { entityRefPorts, type EntityRefDescriptor } from \"./slot\";\nimport { codeSpanText, findCodeRanges } from \"@ai-matrx/content-ir/source\";\nimport { isUuidValue } from \"@ai-matrx/kit/uuid\";\n\n// The one isUuidValue (kit): shape after trim. Re-exported so `/entity-doors` keeps offering it.\nexport { isUuidValue };\n\n/**\n * True when a value is a real uuid — the guard a surface needs BEFORE handing an\n * id to `EntityRef` / `EntityDoorControls`.\n *\n * Door resolution deliberately does not validate ids (a token's `hrefFor` is\n * free to use slugs), so any surface that DERIVES an id — parsing it out of a\n * surface key, reading an untyped column — must check first, or it mints a link\n * to `/agents/<junk>`: a door that opens on nothing, which the doctrine ranks\n * worse than no door at all.\n *\n * It lives here, beside `resolveEntityDoors`, because this module is the one\n * component-free entry point on the door path. It used to live only inside\n * `MatrxUuidCell`, which meant guarding an id dragged a table cell (and its\n * tooltip/toast/peek-host graph) into whatever chunk needed the check —\n * THE FRAGMENTATION LAW, paid for a three-line regex. Every importer was moved\n * to this module in the same change — there is deliberately no re-export left\n * behind in `MatrxUuidCell`, because that tripped `no-barrel-files` and the\n * rule is right.\n */\n\n/**\n * Entity tokens whose peek is registered under a different catalog key.\n * Keep this at zero entries wherever possible — the real fix is aligning the\n * peek registry key with the canonical token.\n */\nconst PEEK_KEY_BY_TOKEN: Record<string, string> = {\n app: \"agent_app\",\n pick_list: \"pick_list\",\n structured_list: \"pick_list\",\n};\n\n/**\n * True when `RegistryPeek` can preview this entity even though no bespoke peek\n * is registered — it reads the registry's own schema/table/title column, so it\n * needs a title column and a table the BROWSER can actually read.\n *\n * `listCandidates` is the marker for the exception: a token only carries one\n * because its schema isn't PostgREST-exposed (`data_store` → `rag`), and\n * offering a preview button that always fails is its own dead end.\n */\nfunction hasRegistryPeek(info: EntityRefDescriptor | null): boolean {\n return Boolean(info?.titleColumn) && !info?.listCandidatesOnly;\n}\n\nexport interface EntityDoors {\n /** Canonical route to the record, or null when the token has no `hrefFor`. */\n href: string | null;\n /** True when a peek is registered for this token. */\n canPeek: boolean;\n /** Catalog key to hand `<ResourcePeekHost kind=…>`. */\n peekKind: string;\n /** Registry icon for the entity type, when one is registered. */\n Icon: ComponentType<{ className?: string }> | null;\n /** Singular display label (\"Agent\", \"Note\"), or null for unknown tokens. */\n label: string | null;\n}\n\n/**\n * Resolve every door we can open for one record.\n *\n * `hrefOverride` wins over the registry route — for records that live in two\n * shells (a system agent under `/administration/…` vs a personal one under\n * `/agents/…`). It is honored EXACTLY: an explicit `null` means \"this\n * particular record has no door\" and must not fall through to the registry,\n * which would send the user somewhere the caller deliberately ruled out. Only\n * `undefined` (no opinion) defers.\n *\n * Unknown tokens degrade to \"no doors\", never throw: a surface passing a token\n * we don't register yet must still render its text.\n */\nexport function resolveEntityDoors(\n token: string,\n id: string,\n hrefOverride?: string | null,\n): EntityDoors {\n const host = entityRefPorts();\n const info = host.registry.describe(token);\n const peekKind = PEEK_KEY_BY_TOKEN[token] ?? token;\n return {\n href:\n hrefOverride !== undefined\n ? hrefOverride\n : (host.adminHref(token, id) ?? info?.hrefFor?.(id) ?? null),\n canPeek: host.hasPeek(peekKind) || hasRegistryPeek(info),\n peekKind,\n Icon: info?.Icon ?? null,\n label: info?.label ?? null,\n };\n}\n\n/**\n * Resolve an FK COLUMN NAME to a canonical entity token — `agent_id` → `agent`,\n * `task_id` → `task`. Deliberately strict: exact `<token>_id` only, and only\n * for tokens that actually have a door. Anything else returns null rather than\n * guessing, because a wrong link is worse than no link (a `<token>_id` that\n * points somewhere else would send the user to another record entirely).\n *\n * Used by generic surfaces that render a row's raw columns (the data-table row\n * inspector) and therefore can't be told each column's target by hand.\n */\nexport function doorTokenFromColumnName(column: string): string | null {\n const name = column.trim().toLowerCase();\n if (!name.endsWith(\"_id\")) return null;\n const token = name.slice(0, -3);\n if (!token) return null;\n return hasAnyDoor(token) ? token : null;\n}\n\n/**\n * True when the platform can open this token at all (route or peek).\n * Use it to decide whether a bare id is worth rendering as a door — never to\n * decide whether to render the record at all.\n */\nexport function hasAnyDoor(token: string): boolean {\n const host = entityRefPorts();\n const info = host.registry.describe(token);\n return (\n Boolean(info?.hrefFor) ||\n host.hasPeek(PEEK_KEY_BY_TOKEN[token] ?? token) ||\n hasRegistryPeek(info)\n );\n}\n\n// ── Ids inside SENTENCES ─────────────────────────────────────────────────────\n//\n// 🚨 THE DEFECT THIS CLOSES: our servers write refusals for people —\n// \"resolved system agent 8f0bbfc2-… breaks the mandate contract\" — and every\n// screen printed them as flat text. The sentence NAMES a record that has an\n// identity in our system, so THE DOOR LAW applies to it exactly as it does to\n// a table cell: the person reading the refusal must be able to open the agent\n// it is accusing, without hand-copying a uuid into a URL bar.\n//\n// A server sentence is verbatim by policy (`ServerNotes`, `RunFailureCard`),\n// so nothing here rewrites, shortens or re-orders a word — the only change is\n// that the ids inside it become reachable.\n\n/**\n * Everyday nouns that name a registered entity by a different word than its\n * canonical token. Only add an entry you have VERIFIED points at the same\n * record type — a wrong door is worse than no door.\n */\nconst NOUN_ALIASES: Record<string, string> = {\n org: \"organization\",\n organisation: \"organization\",\n bot: \"agent\",\n workflow_definition: \"workflow\",\n // scheduler.sch_task — the scheduler's own sentences say \"scheduled task\".\n schedule: \"sch_task\",\n scheduled_task: \"sch_task\",\n};\n\n/** A word as it appears in prose → a candidate entity token. */\nfunction nounToToken(word: string): string {\n const bare = word.toLowerCase().replace(/[^a-z0-9_]/g, \"\");\n // \"agents\" / \"mandates\" — prose pluralises, tokens don't.\n const singular =\n bare.length > 3 && bare.endsWith(\"s\") && !bare.endsWith(\"ss\")\n ? bare.slice(0, -1)\n : bare;\n return NOUN_ALIASES[singular] ?? singular;\n}\n\n/**\n * The entity token a sentence was talking about right before it printed an id.\n *\n * Deliberately conservative — it reads at most the four words in front of the\n * id, nearest first, and accepts only a word that resolves to a token the\n * platform can actually OPEN (`hasAnyDoor`). Anything else returns null and\n * the caller prints the id as it always did. Guessing here would mint links to\n * `/agents/<a workflow id>`: a door onto the wrong record, which reads as a\n * fact and is a lie.\n */\nexport function tokenFromPrecedingWords(preceding: string): string | null {\n const words = preceding.trim().split(/\\s+/).filter(Boolean).slice(-4);\n // The compound ending at the id first, longest first (\"scheduled task\" →\n // `sch_task`, \"agent version\" → `agent_version`). A bare noun that is ALSO a\n // token must not win over the compound it closes: \"scheduled task <id>\"\n // resolved to `task` and minted a door onto /tasks/<a schedule id> — the\n // wrong record, which reads as a fact and is a lie (2026-09-11).\n for (let len = words.length; len >= 2; len--) {\n const joined = words.slice(-len).map(nounToToken).filter(Boolean).join(\"_\");\n const phrase = NOUN_ALIASES[joined] ?? joined;\n if (phrase && hasAnyDoor(phrase)) return phrase;\n }\n // Then the nearest single noun that opens.\n for (let i = words.length - 1; i >= 0; i--) {\n const single = nounToToken(words[i] ?? \"\");\n if (single && hasAnyDoor(single)) return single;\n }\n return null;\n}\n\n/**\n * One piece of a sentence: plain prose, an id we can open a door on, or a run\n * the author marked as CODE with markdown backticks.\n */\nexport type SentenceSegment =\n | { kind: \"text\"; text: string }\n | { kind: \"code\"; text: string }\n | { kind: \"ref\"; id: string; token: string };\n\nconst UUID_IN_TEXT_RE =\n /\\b[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\\b/gi;\n\n/**\n * INLINE CODE, THE WAY ITS AUTHOR WROTE IT.\n *\n * 🚨 THE DEFECT (V-PARITY/UX R-O2, both walk rounds). Sentences that name a\n * field, a key or a variable mark it the one way every author on this platform\n * marks it — markdown backticks:\n *\n * Its structured output is missing `title`, `slides` — whatever reads this\n * job's result requires them.\n *\n * Printed through a plain `<span>` the backtick CHARACTERS land on a subject\n * matter expert's screen. There is no second renderer for this: every sentence\n * somebody else wrote already reaches a person through `TextWithDoors`, so the\n * marks are understood HERE, beside the ids, and every one of its ~10 adopting\n * surfaces is fixed by the same three lines.\n *\n * Deliberately ONLY single-backtick spans, and never across a newline: this is\n * a sentence renderer, not a markdown engine. Anything else — an unmatched\n * backtick, a fenced block — stays exactly as it was typed.\n */\n\n/**\n * Split a server-authored sentence into prose, inline code and openable ids.\n *\n * `defaultToken` is what the CALL SITE knows that the sentence does not — a\n * mandate-resolution refusal is always about an agent, so its screen may say\n * so. It is used only when the prose itself names nothing openable.\n *\n * Every character of the input survives into the output in order — apart from\n * the two backticks delimiting an inline-code run, which are MARKUP the author\n * wrote to say \"this is code\" and were never words meant to be read. A caller\n * that joins the segments back together gets the server's words unchanged.\n */\nexport function segmentSentenceIds(\n text: string,\n defaultToken?: string | null,\n): SentenceSegment[] {\n const out: SentenceSegment[] = [];\n let prose = 0;\n // Inline code by THE one code-range rule (@ai-matrx/content-ir/source).\n for (const range of text.includes(\"`\") ? findCodeRanges(text) : []) {\n if (range.kind !== \"span\" || range.start < prose) continue;\n if (range.start > prose) {\n out.push(...segmentIdsOnly(text.slice(prose, range.start), defaultToken));\n }\n out.push({ kind: \"code\", text: codeSpanText(text.slice(range.start, range.end)) });\n prose = range.end;\n }\n if (out.length === 0) return segmentIdsOnly(text, defaultToken);\n if (prose < text.length) {\n out.push(...segmentIdsOnly(text.slice(prose), defaultToken));\n }\n return out;\n}\n\n/** The id half, run over one run of prose that carries no code marks. */\nfunction segmentIdsOnly(\n text: string,\n defaultToken?: string | null,\n): SentenceSegment[] {\n const segments: SentenceSegment[] = [];\n let cursor = 0;\n UUID_IN_TEXT_RE.lastIndex = 0;\n for (\n let match = UUID_IN_TEXT_RE.exec(text);\n match !== null;\n match = UUID_IN_TEXT_RE.exec(text)\n ) {\n const id = match[0];\n const start = match.index;\n const token =\n tokenFromPrecedingWords(text.slice(cursor, start)) ??\n (defaultToken && hasAnyDoor(defaultToken) ? defaultToken : null);\n if (token === null) continue; // No door we trust — leave it in the prose.\n if (start > cursor) {\n segments.push({ kind: \"text\", text: text.slice(cursor, start) });\n }\n segments.push({ kind: \"ref\", id, token });\n cursor = start + id.length;\n }\n if (segments.length === 0) return [{ kind: \"text\", text }];\n if (cursor < text.length) {\n segments.push({ kind: \"text\", text: text.slice(cursor) });\n }\n return segments;\n}\n","\"use client\";\n\n/**\n * EntityRef — THE way to render a reference to another record.\n *\n * THE DOOR LAW (common-docs/policies/no-dead-ends.md): if the UI names a thing\n * that has an identity in our system, the UI must let the user reach it. This\n * component is that law made importable — drop it anywhere a name, a title, or\n * (worse) a bare id is being printed, and the user gets every door we can open:\n *\n * Open → click the name; canonical route from the entity registry\n * New tab → explicit control, so a user deep inside a console/modal never\n * has to trade their current state for an answer\n * Peek → non-blocking preview via the peek registry, when one exists\n * (Window) → surfaces pass their own opener through `extraActions`\n *\n * It composes primitives, it does not duplicate them:\n * - route + icon + label → `getEntityInfo(token)` (features/scopes/registry)\n * - preview → `openResourcePeek` + `hasPeek` (features/organizations/peek) —\n * the app's ONE peek host draws it; a reference never mounts one\n *\n * Safe inside clickable table rows: every control stops propagation, and the\n * peek renders in the app's one host, outside this reference's React tree.\n *\n * Adding a door for a new entity type is a registry edit, never a change here:\n * give the token an `hrefFor` in `entityRegistry.ts`, and/or a peek in\n * `features/organizations/peek/registry.ts` + `kinds-list.ts`.\n */\n\nimport React from \"react\";\nimport { ExternalLinkIcon, LightbulbIcon } from \"@ai-matrx/design-system/icons\";\nimport { Button as ControlButton } from \"@ai-matrx/design-system/controls\";\nimport { cn, displayId } from \"@ai-matrx/design-system\";\nimport { useEntityHref } from \"./useEntityHref\";\nimport { entityRefHost, hostMark, isNativeNewTabClick } from \"./host\";\n\ninterface EntityRefProps {\n /** Canonical entity token (`agent`, `note`, `task`, …). */\n token: string;\n /** The record's id. */\n id: string;\n /**\n * Display name. When omitted the id is shown truncated — acceptable only\n * when the name genuinely isn't loaded; prefer passing it.\n */\n name?: string | null;\n /** Override the registry route (e.g. an admin-side route for the same record). */\n href?: string;\n /** Show the entity's registry icon before the name. Default true. */\n showIcon?: boolean;\n /** Hide the peek control even when one is registered. */\n disablePeek?: boolean;\n /**\n * Hide the new-tab CONTROL (rare — only when the row is already a link).\n *\n * It does NOT make the name inert: the label stays a real `Link` whenever a\n * route resolves, so a plain click still navigates and a modified click\n * still opens a tab. If what you actually want is \"name this record but do\n * not offer a door\" — the record is already open, so every door leads back\n * to where the user is standing — then don't use `EntityRef` for that row at\n * all. Render the text, and say in a comment why the door is absent.\n */\n disableNewTab?: boolean;\n /**\n * The name itself opens in a NEW TAB.\n *\n * Set this on any surface embedded in something the user would lose by\n * navigating — a side panel, a workspace rail, a sheet over an editor, a\n * dialog. In-place navigation there is the data-loss THE DOOR LAW's new-tab\n * door exists to prevent, and it is the single easiest regression to\n * introduce when replacing a hand-rolled `window.open` with this component\n * (it has already been caught twice in review).\n *\n * Implemented as a real `target=\"_blank\"` on the anchor — no JS interception,\n * so modified clicks and middle-clicks keep behaving natively. The separate\n * new-tab control is suppressed automatically, since it would be a duplicate.\n */\n openInNewTab?: boolean;\n /**\n * Let the label WRAP instead of truncating.\n *\n * `EntityRef` truncates by default because its home is a table cell. That is\n * wrong for a detail panel or an audit row that prints a full id — there the\n * id IS the information, and an ellipsis silently destroys the thing the user\n * came to copy. Set this wherever the old markup wrapped (`break-all`,\n * `whitespace-normal`) so the conversion doesn't quietly shorten the content.\n *\n * A call-site `className` cannot substitute: it lands on the outer wrapper,\n * while `truncate` is on the label element itself.\n *\n * `\"lines\"`: a title a person reads (a list of found items) wraps at word boundaries, at most\n * two lines, then ellipsis — never cut to a few characters, never broken mid-word.\n */\n wrap?: boolean | \"lines\";\n /**\n * The NAME control stretches to fill the width, instead of hugging its text.\n *\n * Set this whenever you replace a full-width `<button>`/`<a>` with an\n * `EntityRef`. A `className` of `flex-1` on the component only stretches the\n * outer WRAPPER — the clickable label inside it still ends where the text\n * does, so every pixel of the old control's padding silently stops opening\n * the record. On a short name in a wide row that is most of the hit target.\n *\n * Combines with `truncate` (the default) exactly as the markup it replaces\n * did: fill the space, ellipsise if the name outgrows it. It also pushes the\n * hover controls to the far edge, which is why it is opt-in — inside a table\n * cell you usually want them beside the name.\n */\n fill?: boolean;\n /**\n * Classes for the clickable LABEL itself, not the wrapper.\n *\n * `className` lands on the outer wrapper, which is right for layout and\n * wrong for anything that must apply to the text: `line-through` on a\n * completed task, a font weight, a decoration. Whether such a style reaches\n * the label by inheritance depends on the box type and fights the label's\n * own `hover:underline` — so it is passed explicitly rather than hoped for.\n * This is the third call-site need of this shape; `wrap` and `fill` stay as\n * named props because they encode a DECISION, while this is plain styling.\n */\n labelClassName?: string;\n /** Backward-compatible name-label class used by existing Door Law callers. */\n nameClassName?: string;\n /** Controls stay visible instead of appearing on hover/focus. */\n alwaysShowActions?: boolean;\n /** Surface-specific extra doors (open in window, jump to versions, …). */\n extraActions?: React.ReactNode;\n /**\n * Intercept the plain left-click on the name — for surfaces that open the\n * record their OWN way (in a window, in a side panel, via a container's\n * `openEntity` handler) instead of navigating the tab.\n *\n * Cmd/Ctrl/Shift/Alt/middle clicks are NOT intercepted: they keep the\n * browser's native new-tab behavior via the real `href`, so a surface that\n * takes over the click can never cost the user their current state. The\n * explicit new-tab control stays visible regardless.\n *\n * CONTRACT — pass `undefined` when the handler cannot actually open\n * anything. With no registry route AND an `onOpen`, the name renders as a\n * link-styled BUTTON; if that handler then no-ops (because it too was\n * gated on a route that doesn't exist), the user gets a control that looks\n * openable and does nothing — a dead end with extra steps, which is the\n * precise thing this component exists to kill. Gate at the call site:\n * `onOpen={canOpen ? handler : undefined}`.\n */\n onOpen?: () => void;\n className?: string;\n /**\n * Render arbitrary content as the label instead of the name text.\n *\n * The doors are the point of this component; the label is incidental. A\n * table cell renders `<span>{title}</span><Badge>Draft</Badge>`, a card\n * renders a title over a subtitle — neither is a string, and before this\n * existed those surfaces could not adopt `EntityRef` at all without\n * flattening what they show. That is how a shell ends up with its OWN\n * Open-only door beside this one (`MatrxDataTable.href`) and every column\n * that names a record loses new-tab and peek.\n *\n * `name` is still required-ish when you pass children: it supplies the\n * `title`/`aria-label` text, so a screen reader and a tooltip still say\n * which record this is.\n */\n children?: React.ReactNode;\n}\n\nconst CONTROL_CLASS =\n \"flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground \" +\n \"transition-colors hover:bg-accent hover:text-foreground\";\n\nexport function EntityRef({\n token,\n id,\n name,\n href,\n showIcon = true,\n disablePeek = false,\n disableNewTab = false,\n openInNewTab = false,\n wrap = false,\n fill = false,\n labelClassName,\n nameClassName,\n alwaysShowActions = false,\n extraActions,\n onOpen,\n className,\n children,\n}: EntityRefProps) {\n\n // Canonicalise ONCE, up front. A surface often passes a `kind` column owned\n // by another system (`source_kind='cld_file'` from the ingest pipeline), and\n // resolving the route from the canonical token while looking the peek up by\n // the raw string is how a record ends up with one door and not the other.\n const host = entityRefHost();\n const AppLink = host.Link;\n const ErrorAlchemyMenu = host.ErrorMenu;\n const canonicalToken = host.registry.canonical(token);\n const info = host.registry.describe(canonicalToken);\n // NOT `info.hrefFor(id)` directly: an agent's address depends on its KIND\n // (a builtin opens only in the admin System Agents shell) and the id may be\n // a VERSION id. See useEntityHref.ts — one seam, ~65 agent call sites fixed\n // at once instead of ~65 chances to guess wrong.\n const {\n href: resolvedHref,\n refusal,\n resolving: hrefResolving,\n } = useEntityHref(token, id, href);\n // The peek registry is keyed by canonical token, so there is nothing to\n // translate — `peekKeyForToken` existed only to bridge the legacy\n // catalog vocabulary and is deleted.\n const canPeek = !disablePeek && host.hasPeek(canonicalToken);\n const label = name?.trim() || `${displayId(id)}…`;\n // `label` stays the ACCESSIBLE name (title/aria) even when children\n // replace what is drawn — a tooltip reading \"Open\" tells nobody anything.\n const labelBody = children ?? label;\n const Icon = info?.Icon ?? null;\n\n const showNewTab = Boolean(resolvedHref) && !disableNewTab && !openInNewTab;\n const hasControls = canPeek || showNewTab || Boolean(extraActions);\n\n const stop = (e: React.MouseEvent) => e.stopPropagation();\n // One string carries BOTH label decisions so the three label branches\n // (link / button / inert span) cannot drift apart — they already did once.\n const labelFit = cn(\n wrap === \"lines\" ? \"line-clamp-2 break-words\" : wrap ? \"break-all\" : \"truncate\",\n fill && \"grow\",\n labelClassName,\n nameClassName,\n );\n\n return (\n <span\n className={cn(\n \"entity-ref group/entity-ref inline-flex min-w-0 max-w-full items-center gap-1\",\n className,\n )}\n data-entity-ref-host={hostMark(host)}\n >\n {showIcon && Icon && (\n <Icon className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n )}\n\n {resolvedHref ? (\n <AppLink\n href={resolvedHref}\n target={openInNewTab ? \"_blank\" : undefined}\n rel={openInNewTab ? \"noopener noreferrer\" : undefined}\n // A `_blank` navigation is a fresh document load — it cannot read the\n // client router cache, so prefetching it is a request that can never\n // be used. `EntityRef` lives in lists; at 50 rows that is 50 wasted\n // round trips.\n // Also false while an agent address is still resolving: the href is\n // then `/agents/go/<id>`, which REDIRECTS — and an RSC prefetch of a\n // redirect to the sibling deployment is the exact preflight the\n // cross-deployment link door exists to prevent.\n prefetch={openInNewTab || hrefResolving ? false : undefined}\n onClick={(e) => {\n stop(e);\n // A modified click keeps the browser's native new-tab behavior —\n // an interceptor must never cost the user their current state.\n if (!onOpen || isNativeNewTabClick(e)) return;\n e.preventDefault();\n onOpen();\n }}\n title={openInNewTab ? `Open ${label} in a new tab` : `Open ${label}`}\n // THE DOOR IS A CONTROL, NOT PROSE. `.matrx-touch-targets`\n // (app/globals.css) deliberately skips bare anchors so a sentence's\n // link does not become a 44px block, and opts real controls in by\n // this attribute. An EntityRef is never prose — it is the record's\n // door — so it opts in here, once, for every surface that declared\n // the floor. Outside such a subtree the attribute does nothing, so\n // desktop density is untouched everywhere.\n data-tap-target\n className={cn(\n \"min-w-0 text-inherit underline-offset-2 hover:text-primary hover:underline\",\n labelFit,\n )}\n >\n {labelBody}\n </AppLink>\n ) : onOpen ? (\n <ControlButton\n type=\"button\"\n variant=\"link\"\n onClick={(e) => {\n stop(e);\n onOpen();\n }}\n title={`Open ${label}`}\n className={cn(\"min-w-0 text-left\", labelFit)}\n >\n {labelBody}\n </ControlButton>\n ) : (\n /* No door. NOTHING FAILS SILENTLY: when we KNOW the record cannot be\n reached (`refusal`), the title says so in a sentence naming the id\n — a name with no explanation reads as a broken page. While an\n address is still resolving there is nothing to confess yet. */\n <span\n className={cn(\"min-w-0\", refusal && \"cursor-help\", labelFit)}\n title={refusal ?? label}\n aria-describedby={undefined}\n data-agent-link-refused={refusal ? \"true\" : undefined}\n data-agent-link-resolving={hrefResolving ? \"true\" : undefined}\n >\n {labelBody}\n {/* The error's actions ride only a KNOWN refusal: a plain name that\n simply has no door is not an error, and a copy-error button on it\n was a control that said something went wrong when nothing had. */}\n {refusal && ErrorAlchemyMenu ? <ErrorAlchemyMenu error={refusal} /> : null}\n </span>\n )}\n\n {/* An EMPTY controls span is not free: it is still a flex child, so the\n wrapper's `gap-1` reserves a space after the label. In a table cell\n that is invisible; inside a SENTENCE (`TextWithDoors`) it opens a\n hole in the middle of the server's words. Render nothing when there\n is nothing to render. */}\n {hasControls && (\n <span\n data-entity-ref-controls\n data-reveal-on-hover={alwaysShowActions ? undefined : \"true\"}\n className={cn(\n \"entity-ref-controls inline-flex shrink-0 items-center gap-0.5\",\n )}\n >\n {canPeek && (\n <ControlButton\n type=\"button\"\n variant=\"quiet\"\n icon={<LightbulbIcon />}\n title={`Quick look at ${label}`}\n aria-label={`Quick look at ${label}`}\n onClick={(e) => {\n stop(e);\n host.openPeek({\n kind: canonicalToken,\n id,\n // Keep the peek's footer aligned with the door that opened it.\n // `AppletRef`, for example, deliberately overrides the generic\n // app route with the administration editor route.\n href,\n anchor: e.currentTarget,\n trigger: \"click\",\n fallbackHref: resolvedHref,\n });\n }}\n className={CONTROL_CLASS}\n />\n )}\n {resolvedHref && showNewTab && (\n <AppLink\n href={resolvedHref}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n prefetch={false}\n onClick={stop}\n title={`Open ${label} in a new tab`}\n aria-label={`Open ${label} in a new tab`}\n className={CONTROL_CLASS}\n >\n <ExternalLinkIcon className=\"h-3 w-3\" />\n </AppLink>\n )}\n {extraActions}\n </span>\n )}\n\n {/* No peek mounts here: the app's ONE host (`ResourcePeekRoot`, app/Providers.tsx) draws it\n OUTSIDE this reference's React tree, so a click inside an open peek can no longer reach\n the clickable row or popover this reference sits in, and a popover that closes no\n longer takes the peek with it. */}\n </span>\n );\n}\n","\"use client\";\n\n/**\n * @ai-matrx/records-ui/entity-ref — useEntityHref\n *\n * WHERE AN ENTITY-REF LINK ACTUALLY POINTS.\n *\n * For almost every token, the entity registry's `hrefFor(id)` is the whole\n * answer: one id, one canonical route. AGENTS and TEAMS are the exceptions,\n * and they are the reason this seam exists.\n *\n * An agent's address depends on facts the caller does not hold (see\n * `features/agents/addressing/agentAddress.ts`): a builtin agent opens ONLY\n * under the admin System Agents tree, and the id might not be an agent id at\n * all — the platform stores VERSION ids in agent-shaped columns. Until\n * 2026-09-08 the registry answered `/agents/${id}` for every one of the ~65\n * `EntityRef token=\"agent\"` call sites, so every system agent named anywhere\n * in the app was a link into the wrong shell.\n *\n * A team's address depends on a fact the caller does not hold either (see\n * `features/organizations/addressing/teamAddress.ts`): a team has no page of\n * its own — it opens on its ORGANIZATION's settings page — and an id-only\n * caller does not know which organization that is.\n *\n * Fixing it HERE fixes all of them at once, which is the only fix worth\n * making: a per-call-site fix would be re-broken by the next call site.\n *\n * The host's `useAddress` hook resolves both (see ./host.tsx). It is called unconditionally with a null id for non-matching tokens,\n * so there is no conditional-hook hazard and no cost for the other tokens.\n */\n\nimport { entityRefPorts } from \"./slot\";\n\nexport interface EntityHrefResult {\n /** The href, or null while resolving / when the record cannot be placed. */\n href: string | null;\n /**\n * Set only when the record genuinely cannot be reached. The UI must SAY\n * this, not render a link that 404s and not render a dead-looking control\n * with no explanation.\n */\n refusal: string | null;\n /** True while an address is still being resolved — not a refusal. */\n resolving: boolean;\n}\n\nexport function useEntityHref(\n token: string,\n id: string,\n hrefOverride?: string,\n): EntityHrefResult {\n const host = entityRefPorts();\n const canonicalToken = host.registry.canonical(token);\n\n // Unconditional: the host's address hook runs on every render with a null id for every token\n // it does not resolve itself (an agent's kind, a team's organization live in the host).\n const door = host.useAddress(\n canonicalToken,\n hrefOverride ? null : id,\n `EntityRef token=\"${token}\"`,\n );\n\n if (hrefOverride) return { href: hrefOverride, refusal: null, resolving: false };\n\n if (door) {\n if (door.state === \"ready\") return { href: door.href, refusal: null, resolving: false };\n // A REAL href, not null: a resolving address is a server-side redirect route, so the link\n // works on the very first paint and keeps working if the resolver never answers.\n if (door.state === \"resolving\") return { href: door.href, refusal: null, resolving: true };\n return { href: null, refusal: door.reason, resolving: false };\n }\n\n const info = host.registry.describe(canonicalToken);\n return {\n href: host.adminHref(canonicalToken, id) ?? info?.hrefFor?.(id) ?? null,\n refusal: null,\n resolving: false,\n };\n}\n","\"use client\";\n\n// src/entity-ref/host.tsx — the drawing half of the entity-ref host (see ./slot.ts for every port).\n\nimport React, { type ComponentType } from \"react\";\nimport { getTapTargetLinkComponent } from \"@ai-matrx/design-system/tap-target\";\nimport { boundEntityRefHost, entityRefPorts, type EntityRefLinkProps, type EntityRefPerson, type EntityRefPorts } from \"./slot\";\n\nexport * from \"./slot\";\n\nfunction PlainLink({ href, prefetch: _prefetch, children, ref, ...rest }: EntityRefLinkProps) {\n const Registered = getTapTargetLinkComponent();\n if (Registered) {\n const R = Registered as unknown as ComponentType<EntityRefLinkProps>;\n return <R href={href} ref={ref} {...rest}>{children}</R>;\n }\n return (\n <a href={href} ref={ref} {...(rest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}>\n {children}\n </a>\n );\n}\n\n/** The bound host with every port filled (defaults announce themselves). */\nexport interface ResolvedEntityRefHost extends EntityRefPorts {\n Link: ComponentType<EntityRefLinkProps>;\n ErrorMenu: ComponentType<{ error: string }> | null;\n Person: ComponentType<{ user: EntityRefPerson; className?: string }>;\n}\n\nfunction PlainPerson({ user, className }: { user: EntityRefPerson; className?: string }) {\n return <span className={className}>{user.displayName || user.email || \"Unknown person\"}</span>;\n}\n\nexport function entityRefHost(): ResolvedEntityRefHost {\n const host = boundEntityRefHost();\n return { ...entityRefPorts(), Link: host?.Link ?? PlainLink, ErrorMenu: host?.ErrorMenu ?? null, Person: host?.Person ?? PlainPerson };\n}\n\n/** `data-entity-ref-host` value for a reference's wrapper. */\nexport function hostMark(host: ResolvedEntityRefHost): \"unconfigured\" | undefined {\n return host.configured ? undefined : \"unconfigured\";\n}\n\n/** lucide `arrow-up-right` (design-system's icon set has no such glyph yet). */\nexport function ArrowUpRightGlyph({ className }: { className?: string }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className ? `lucide-arrow-up-right ${className}` : \"lucide-arrow-up-right\"}\n aria-hidden\n >\n <path d=\"M7 7h10v10\" />\n <path d=\"M7 17 17 7\" />\n </svg>\n );\n}\n","\"use client\";\n\n/**\n * EntityDoorControls — the DOORS, without the name.\n *\n * `EntityRef` is the default: it renders a record's name AS the door. But some\n * surfaces genuinely cannot make the name an anchor:\n *\n * - the name is an inline EDITOR (`AssociationEntitySelect` — click to rename)\n * - the name sits inside a `<button>` whose click means something else\n * (a picker row, where clicking = attach). An `<a>` inside a `<button>` is\n * invalid DOM and a hydration error, and a stray click that navigated away\n * would cost the user the picker they are standing in.\n *\n * Those surfaces render this cluster as a SIBLING of the name. It is the same\n * implementation `EntityRef` uses (EntityRef composes it), so a registry edit\n * lights up both and neither can drift.\n *\n * Same-tab \"Open\" is OPT-IN (`showOpen`) precisely because the callers above are\n * mid-task surfaces: peek + new tab answer \"which one is that?\" without\n * destroying what the user is doing. Pass `showOpen` when the surface is a plain\n * list the user can safely leave.\n *\n * Standalone controls are visible by default. Hover reveal is opt-in through\n * `revealOnHover`; when enabled, controls fade in on hover of EITHER the named `group/entity-ref`\n * (what `EntityRef` puts on its own wrapper) OR a plain Tailwind `group`, which\n * is what almost every row in this codebase already carries for its other\n * hover-revealed affordances.\n *\n * Accepting both is deliberate and load-bearing. The named group alone made a\n * silent, invisible failure the DEFAULT for standalone callers: forget the\n * class and the doors render at `opacity-0`, so the surface looks finished, the\n * markup is right, type-check and lint are green — and the user simply cannot\n * see the door. That is the exact dead end this module exists to remove, and it\n * shipped twice (the two debug-window sidebars, 2026-08-09) before Bugbot\n * caught it. A primitive whose correct use depends on remembering an invisible\n * convention will be misused; make the common case work instead.\n *\n * `alwaysShowActions` remains as a compatibility override that pins them visible\n * (a window title bar, a touch-first list). **Reach for it in any popover or\n * transient panel too**: `opacity-0` does not disable hit-testing, so on touch\n * the hover form is the worst case — invisible controls that are still\n * tappable. The row reserves their width either way (this cluster is\n * `shrink-0`), so pinning them costs no layout.\n *\n * Link doors carry `data-tap-target` so a host's `matrx-touch-targets` scope\n * can raise these intentionally compact desktop controls to the 44px\n * coarse-pointer floor without treating prose links as controls.\n *\n * The peek opens through `openResourcePeek` and renders in the app's ONE host\n * (`ResourcePeekRoot`, app/Providers.tsx), outside this component's tree — so a\n * popover that closes because the person clicked into the peek no longer\n * unmounts the peek with it (the \"door that deletes itself\" trap, 2026-08-09).\n * The popover still closes; a container that should stay open must ignore\n * events whose target is inside a dialog:\n *\n * if (target?.closest?.('[role=\"dialog\"], [role=\"alertdialog\"]')) return;\n *\n * Adding a door for a new entity type is a registry edit, never a change here:\n * route → `hrefFor` in `features/scopes/registry/entityRegistry.ts`\n * peek → `features/organizations/peek/registry.ts` + `kinds-list.ts`\n */\n\nimport React from \"react\";\nimport { ExternalLinkIcon as ExternalLink, LightbulbIcon as Lightbulb } from \"@ai-matrx/design-system/icons\";\nimport { Button } from \"@ai-matrx/design-system/controls\";\nimport { cn, displayId } from \"@ai-matrx/design-system\";\nimport { resolveEntityDoors } from \"./doors\";\nimport { ArrowUpRightGlyph as ArrowUpRight, entityRefHost } from \"./host\";\n\nexport const ENTITY_DOOR_CONTROL_CLASS =\n \"flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground \" +\n \"transition-colors hover:bg-accent hover:text-foreground\";\n\nexport interface EntityDoorControlsProps {\n /** Canonical entity token (`agent`, `note`, `task`, …). */\n token: string;\n /** The record's id. */\n id: string;\n /** Display name — used only for the control labels/tooltips. */\n name?: string | null;\n /**\n * Override the registry route. Honored exactly: `null` means \"this record\n * has no door\" and must not fall through to the registry; omit to defer.\n */\n href?: string | null;\n /** Hide the peek control even when one is registered. */\n disablePeek?: boolean;\n /** Hide the new-tab control. */\n disableNewTab?: boolean;\n /** Also render a same-tab Open control (off by default — see the header). */\n showOpen?: boolean;\n /** Controls stay visible instead of appearing on hover/focus. */\n alwaysShowActions?: boolean;\n /** Opt into hover/focus reveal. Standalone controls are visible by default. */\n revealOnHover?: boolean;\n /** Surface-specific extra doors (open in window, jump to versions, …). */\n extraActions?: React.ReactNode;\n /**\n * `md` = THE control (`Button` variant=\"quiet\", 28px, 16px glyph) — use it in\n * any bar of 28px controls (card hover bars, attach-menu rows) so the bar\n * never mixes sizes. `sm` = the compact inline 20px door beside text.\n */\n size?: \"sm\" | \"md\";\n className?: string;\n}\n\nexport function EntityDoorControls({\n token,\n id,\n name,\n href,\n disablePeek = false,\n disableNewTab = false,\n showOpen = false,\n alwaysShowActions = false,\n revealOnHover = false,\n extraActions,\n size = \"sm\",\n className,\n}: EntityDoorControlsProps) {\n const glyph = \"h-3 w-3\";\n\n const host = entityRefHost();\n const Link = host.Link;\n const doors = resolveEntityDoors(token, id, href);\n const resolvedHref = doors.href;\n const canPeek = !disablePeek && doors.canPeek;\n const label = name?.trim() || `${displayId(id)}…`;\n\n // Nothing to offer → render no chrome at all. A control that goes nowhere is\n // the dead end this whole module exists to kill.\n if (!canPeek && !resolvedHref && !extraActions) return null;\n\n const stop = (e: React.MouseEvent) => e.stopPropagation();\n const openPeek = (anchor: Element) =>\n host.openPeek({\n kind: doors.peekKind,\n id,\n // Forward the CALLER's `href`, not our resolved one. When a caller\n // overrode it — because the token alone cannot say which surface\n // this record opens on — the dialog would otherwise send \"Open\"\n // somewhere our new-tab link does not go. Passing `resolvedHref`\n // here instead would set the override on EVERY peek, including the\n // ones where nobody overrode anything, and would then suppress the\n // hardcoded href a token-less bespoke peek supplies for itself.\n // `undefined` (no caller opinion) is the correct default.\n href,\n anchor,\n trigger: \"click\",\n fallbackHref: resolvedHref,\n });\n\n return (\n <>\n <span\n className={cn(\n // THE control carries its own 3px half-gap, so a `md` cluster adds none.\n \"inline-flex shrink-0 items-center\",\n size !== \"md\" && \"gap-0.5\",\n revealOnHover &&\n !alwaysShowActions &&\n \"opacity-0 transition-opacity group-hover/entity-ref:opacity-100 group-hover:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100\",\n className,\n )}\n >\n {size === \"md\" ? (\n <>\n {canPeek && (\n <Button\n variant=\"quiet\"\n icon={<Lightbulb />}\n title={`Quick look at ${label}`}\n aria-label={`Quick look at ${label}`}\n onClick={(e) => {\n stop(e);\n openPeek(e.currentTarget);\n }}\n />\n )}\n {resolvedHref && showOpen && (\n <Button variant=\"quiet\" icon={<ArrowUpRight />} asChild>\n <Link\n href={resolvedHref}\n data-tap-target\n onClick={stop}\n title={`Open ${label}`}\n aria-label={`Open ${label}`}\n />\n </Button>\n )}\n {resolvedHref && !disableNewTab && (\n <Button variant=\"quiet\" icon={<ExternalLink />} asChild>\n <Link\n href={resolvedHref}\n data-tap-target\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={stop}\n title={`Open ${label} in a new tab`}\n aria-label={`Open ${label} in a new tab`}\n />\n </Button>\n )}\n </>\n ) : (\n <>\n {canPeek && (\n <Button\n type=\"button\"\n variant=\"quiet\"\n icon={<Lightbulb />}\n title={`Quick look at ${label}`}\n aria-label={`Quick look at ${label}`}\n onClick={(e) => {\n stop(e);\n openPeek(e.currentTarget);\n }}\n className={ENTITY_DOOR_CONTROL_CLASS}\n />\n )}\n {resolvedHref && showOpen && (\n <Link\n href={resolvedHref}\n data-tap-target\n onClick={stop}\n title={`Open ${label}`}\n aria-label={`Open ${label}`}\n className={ENTITY_DOOR_CONTROL_CLASS}\n >\n <ArrowUpRight className={glyph} />\n </Link>\n )}\n {resolvedHref && !disableNewTab && (\n <Link\n href={resolvedHref}\n data-tap-target\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={stop}\n title={`Open ${label} in a new tab`}\n aria-label={`Open ${label} in a new tab`}\n className={ENTITY_DOOR_CONTROL_CLASS}\n >\n <ExternalLink className={glyph} />\n </Link>\n )}\n </>\n )}\n {extraActions}\n </span>\n\n </>\n );\n}\n","\"use client\";\n\n/**\n * NewTabLink — THE box-with-arrow (lucide `ExternalLink`) control.\n *\n * Arman, 2026-09-26: the ExternalLink icon means ONE thing platform-wide —\n * \"open this in a new tab\". It was being drawn on same-tab links and rendered\n * disabled beside names that had nothing to open. So the icon has one home:\n *\n * - it is always a real anchor with `target=\"_blank\"` + `rel=\"noopener\n * noreferrer\"` (modified clicks and middle-clicks stay native);\n * - it is never disabled — with no `href` it renders NOTHING;\n * - it stops propagation, so it is safe inside clickable rows and cards.\n *\n * A same-tab \"open\" uses `ArrowUpRight` (see `EntityDoorControls`), never this\n * icon. The Lightbulb means Peek. Guard: `pnpm check:new-tab-icon`.\n */\n\nimport React from \"react\";\nimport { ExternalLinkIcon as ExternalLink } from \"@ai-matrx/design-system/icons\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { entityRefHost } from \"./host\";\n\nexport const NEW_TAB_CONTROL_CLASS =\n \"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground \" +\n \"transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none \" +\n \"focus-visible:ring-1 focus-visible:ring-ring\";\n\nexport interface NewTabLinkProps {\n /** Where the new tab goes. Absent/empty → the control is absent. */\n href: string | null | undefined;\n /** What opens, for the tooltip and screen readers (\"Deep Research\"). */\n label: string;\n className?: string;\n iconClassName?: string;\n /** Text beside the icon (\"New tab\"). Icon-only when omitted. */\n children?: React.ReactNode;\n /** Runs after the tab opens (e.g. close the palette that held the link). */\n onOpen?: () => void;\n}\n\nexport function NewTabLink({\n href,\n label,\n className,\n iconClassName,\n children,\n onOpen,\n}: NewTabLinkProps) {\n const AppLink = entityRefHost().Link;\n if (!href) return null;\n const words = `Open ${label} in a new tab`;\n return (\n <AppLink\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n prefetch={false}\n data-tap-target\n onClick={(event) => {\n event.stopPropagation();\n onOpen?.();\n }}\n title={words}\n aria-label={children ? undefined : words}\n className={cn(children ? \"inline-flex items-center gap-1.5\" : NEW_TAB_CONTROL_CLASS, className)}\n >\n <ExternalLink className={cn(\"h-3.5 w-3.5\", iconClassName)} aria-hidden />\n {children}\n </AppLink>\n );\n}\n","\"use client\";\n\n/**\n * TextWithDoors — THE way to print a sentence somebody else wrote.\n *\n * THE DOOR LAW (common-docs/policies/no-dead-ends.md) does not stop at table\n * cells: if the UI NAMES a thing that has an identity in our system, the UI\n * must let the user reach it. A server refusal that says\n *\n * resolved system agent <agent uuid> breaks the\n * mandate contract: declares no structured output_schema\n *\n * names an agent. Printed as flat text it is a dead end with extra steps — the\n * person is told which record is wrong and then made to hand-copy a uuid into\n * a URL bar to go look at it. That is the defect this component closes, and it\n * closes it for the whole class: every surface that prints a server sentence\n * (`ServerNotes`, refusal banners, dropped-rung reasons, run failures) renders\n * it through here instead of through a bare `{message}`.\n *\n * VERBATIM. The server is the authority on what it just said, so nothing here\n * rewrites, shortens or re-orders a word — `segmentSentenceIds` preserves every\n * character in order. The only change is that the ids become openable, with the\n * full id still on screen (`name={id}`), never truncated to `8f0bbfc2…`.\n *\n * THE AUTHOR'S OWN MARKS ARE HONORED, NOT PRINTED. A sentence that says its\n * field names in markdown backticks meant them as code; this is the one place\n * that renders them as `<code>`, so no surface needs — or is allowed to grow —\n * a second inline-markdown renderer of its own. See `doors.ts`\n * § INLINE CODE, THE WAY ITS AUTHOR WROTE IT.\n *\n * CONSERVATIVE. An id becomes a door only when the sentence's own words name an\n * entity type the platform can actually open, or the call site declares one via\n * `defaultToken`. Anything else stays plain text: a link to the wrong record\n * reads as a fact and is a lie, which the doctrine ranks below no link at all.\n */\n\nimport React from \"react\";\nimport { EntityRef } from \"./EntityRef\";\nimport { segmentSentenceIds } from \"./doors\";\n\nexport interface TextWithDoorsProps {\n /** The sentence, exactly as its author wrote it. */\n text: string | null | undefined;\n /**\n * The entity type this surface KNOWS its sentences are about, used only when\n * the prose names nothing openable — a mandate-resolution refusal is always\n * about an agent, and its screen may say so.\n */\n defaultToken?: string | null;\n /**\n * Ids open in a NEW TAB (default). These sentences live in banners, panels\n * and sheets over work in progress; navigating the tab away to go read the\n * accused record is the data loss the new-tab door exists to prevent.\n */\n openInNewTab?: boolean;\n /** Classes for each id's `EntityRef` wrapper. */\n refClassName?: string;\n}\n\nexport function TextWithDoors({\n text,\n defaultToken,\n openInNewTab = true,\n refClassName,\n}: TextWithDoorsProps) {\n if (!text) return null;\n const segments = segmentSentenceIds(text, defaultToken);\n return (\n <>\n {segments.map((segment, index) =>\n segment.kind === \"text\" ? (\n // Position IS the identity of a prose run — the segments are a\n // deterministic split of one immutable string, never a reorderable list.\n <React.Fragment key={`t${index}`}>{segment.text}</React.Fragment>\n ) : segment.kind === \"code\" ? (\n // 🚨 THE AUTHOR'S BACKTICKS ARE MARKUP, NOT WORDS (R-O2). A sentence\n // naming `title` and `slides` reaches a subject matter expert, and\n // the marks are how its author said \"these are field names\" — so\n // they become a `<code>`, not two stray punctuation characters on\n // the screen. Same font treatment as an id, one class of thing.\n <code\n key={`c${index}`}\n className=\"rounded bg-muted px-1 py-px font-mono text-[0.95em]\"\n >\n {segment.text}\n </code>\n ) : (\n <EntityRef\n key={`r${index}:${segment.id}`}\n token={segment.token}\n id={segment.id}\n // The full id stays on screen: the sentence is verbatim, and an\n // ellipsis would destroy the very string the reader came to copy.\n name={segment.id}\n showIcon={false}\n // NO HOVER CONTROLS MID-SENTENCE. `EntityRef`'s peek/new-tab\n // controls are laid out inline and reserve their width even while\n // invisible, which opens a hole in the middle of the server's\n // sentence — the one thing this component promises not to do. The\n // label itself is the door here, and it opens in a new tab.\n disablePeek\n disableNewTab\n wrap\n openInNewTab={openInNewTab}\n className={refClassName ?? \"align-baseline font-mono text-[0.95em]\"}\n />\n ),\n )}\n </>\n );\n}\n","\"use client\";\n\n/**\n * toastDoor — the door for a record a TOAST just told you about.\n *\n * THE DEAD END this kills: \"Note created\", \"Duplicated\", \"Reassigned 5\n * resources\". The app just made or changed a specific record, had its id in\n * hand, and the only thing the user can do about it is watch the toast fade.\n * Finding the thing again means going back to a list and hunting for it.\n *\n * Sonner's `action` accepts a ReactNode as well as `{label, onClick}`, so the\n * door is a real `<Link>`, NOT a button with an onClick. That matters: an\n * anchor gives same-tab Open, cmd-click and middle-click new-tab, and a\n * copyable target — three of the four doors — where an onClick gives exactly\n * one and steals the rest. Never \"fix\" this into a button.\n *\n * toast.success(\"Note created\", { action: toastDoor(\"note\", id) })\n *\n * Returns `undefined` when the token has no route, so the spread above is safe\n * everywhere: a toast about an unreachable record simply has no action, rather\n * than a control that goes nowhere.\n *\n * Peek is deliberately NOT offered. A toast is transient and usually\n * off-center; a preview that outlives its trigger is a worse affordance than a\n * link. Adding a door for a new entity type is a registry edit\n * (`hrefFor` in `features/scopes/registry/entityRegistry.ts`), never a change\n * here.\n */\n\nimport React from \"react\";\nimport { entityRefHost } from \"./host\";\nimport { resolveEntityDoors } from \"./doors\";\n\nexport interface ToastDoorOptions {\n /** Button text. Defaults to \"Open\". */\n label?: string;\n /**\n * Override the registry route. Honored exactly: `null` means \"no door\" and\n * must not fall through to the registry.\n */\n href?: string | null;\n}\n\nexport function toastDoor(\n token: string,\n id: string | null | undefined,\n options: ToastDoorOptions = {},\n): React.ReactNode | undefined {\n if (!id) return undefined;\n\n const { href } = resolveEntityDoors(token, id, options.href);\n if (!href) return undefined;\n const Link = entityRefHost().Link;\n\n return (\n <Link\n href={href}\n className=\"shrink-0 rounded bg-primary px-2 py-1 type-secondary font-medium text-primary-foreground transition-colors hover:bg-primary/90\"\n >\n {options.label ?? \"Open\"}\n </Link>\n );\n}\n","\"use client\";\n\n/**\n * RecordStamps — the platform-standard footer for \"who touched this row, when\".\n *\n * EVERY entity in this platform carries the same six columns (`created_at`,\n * `created_by`, `updated_at`, `updated_by`, `deleted_at`, `version`), and\n * before this component every detail surface either dropped them entirely or\n * printed the actor as a raw uuid. Both are DOOR LAW failures: the first hides\n * stored data the user paid for, the second shows an id nobody can open.\n *\n * Built as a primitive rather than inline (PRINCIPLES.md — build the platform,\n * not the artifact): the marketing finding/snapshot/asset inspectors are its\n * first three consumers, and every other record detail in the app should be\n * its next.\n *\n * Actor resolution lives in `useRecordActors` and costs NOTHING when both\n * actor ids are null — the normal shape of a server-written row, where\n * \"System\" is the true answer rather than a missing one.\n */\n\nimport { cn, RecordId } from \"@ai-matrx/design-system\";\nimport { entityRefHost } from \"./host\";\nimport type { EntityRefPerson } from \"./slot\";\n\n/** One actor as `resolveActor` answers it (the host's identity resolver, e.g. the app's `useRecordActors`). */\nexport interface RecordStampActor {\n id: string;\n /** Non-null once we know who this is. */\n user: EntityRefPerson | null;\n /** True while the directory read is still in flight. */\n loading: boolean;\n}\n\nexport interface RecordStampsProps {\n organizationId?: string | null;\n createdAt?: string | null;\n /**\n * The row's creator. OMIT for a COMPONENT row (one that takes its access\n * from a parent): there the database rewrites `created_by` to the PARENT's\n * owner (db-rules §6d-1), so it is not who created this row — pass\n * `component` instead and the Created stamp shows the time only.\n */\n createdBy?: string | null;\n /** A component row: the Created stamp carries no actor (see `createdBy`). */\n component?: boolean;\n updatedAt?: string | null;\n updatedBy?: string | null;\n deletedAt?: string | null;\n version?: number | null;\n /** Formatter for a timestamp — pass the surface's own (e.g. `formatDate`). */\n formatTimestamp: (value: string | null) => string;\n /** Resolver from `useRecordActors` — call the hook in the parent. */\n resolveActor: ((id: string | null | undefined) => RecordStampActor | null) | null;\n className?: string;\n}\n\nfunction Stamp({\n label,\n at,\n actorId,\n formatTimestamp,\n resolveActor,\n tone,\n showActor = true,\n}: {\n label: string;\n at?: string | null | undefined;\n actorId?: string | null | undefined;\n formatTimestamp: (value: string | null) => string;\n resolveActor: RecordStampsProps[\"resolveActor\"];\n tone?: \"warning\" | undefined;\n /** False when no actor is recorded for this stamp (a component's Created). */\n showActor?: boolean | undefined;\n}) {\n if (!at) return null;\n const actor = resolveActor?.(actorId) ?? null;\n const Person = entityRefHost().Person;\n return (\n <div className=\"min-w-0\">\n <dt className=\"type-meta font-semibold uppercase tracking-wide text-muted-foreground\">\n {label}\n </dt>\n <dd\n className={cn(\n \"mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 type-secondary text-foreground\",\n tone === \"warning\" && \"text-warning\",\n )}\n >\n <span className=\"whitespace-nowrap\">{formatTimestamp(at)}</span>\n {!showActor ? null : actor ? (\n actor.user ? (\n <Person user={actor.user} className=\"min-w-0 gap-1.5 type-secondary\" />\n ) : actor.loading ? (\n <span className=\"text-muted-foreground\">resolving…</span>\n ) : (\n // Honest: we know an account acted, and we cannot name it (they\n // are not a current member of this organization). Showing the id\n // as a door would be a lie — it is offered as a support handle.\n <span\n className=\"truncate font-mono type-meta text-muted-foreground\"\n title={`Account ${actor.id} — no longer a member of this organization`}\n >\n a former member · <RecordId value={actor.id} label=\"Account\" />\n </span>\n )\n ) : (\n <span className=\"text-muted-foreground\">Automatically</span>\n )}\n </dd>\n </div>\n );\n}\n\nexport function RecordStamps({\n createdAt,\n createdBy,\n component = false,\n updatedAt,\n updatedBy,\n deletedAt,\n version,\n formatTimestamp,\n resolveActor,\n className,\n}: RecordStampsProps) {\n return (\n <dl\n className={cn(\n \"grid grid-cols-2 gap-x-4 gap-y-2.5 type-secondary sm:grid-cols-4\",\n className,\n )}\n >\n <Stamp\n label=\"Created\"\n at={createdAt}\n actorId={component ? null : createdBy}\n showActor={!component}\n formatTimestamp={formatTimestamp}\n resolveActor={resolveActor}\n />\n <Stamp\n label=\"Last updated\"\n at={updatedAt}\n actorId={updatedBy}\n formatTimestamp={formatTimestamp}\n resolveActor={resolveActor}\n />\n <Stamp\n label=\"Moved to trash\"\n at={deletedAt}\n formatTimestamp={formatTimestamp}\n resolveActor={resolveActor}\n tone=\"warning\"\n />\n {typeof version === \"number\" ? (\n <div className=\"min-w-0\">\n <dt className=\"type-meta font-semibold uppercase tracking-wide text-muted-foreground\">\n Row version\n </dt>\n <dd className=\"mt-0.5 type-secondary tabular-nums text-foreground\">\n {version}\n </dd>\n </div>\n ) : null}\n </dl>\n );\n}\n"],"mappings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YACA,MAAK;AAAA;AAAA,QACP;AAAA,QACC,OAAO,YAAY,WAClB,gBAAAC,MAAC,SAAI,WAAU,WACb;AAAA,0BAAAD,KAAC,QAAG,WAAU,yEAAwE,yBAEtF;AAAA,UACA,gBAAAA,KAAC,QAAG,WAAU,sDACX,mBACH;AAAA,WACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;","names":["jsx","jsxs","cn","displayId","jsx","jsxs","displayId","cn","ExternalLink","cn","jsx","jsxs","cn","ExternalLink","Fragment","jsx","jsx","cn","jsx","jsxs","cn"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/records-ui",
|
|
3
|
-
"version": "0.116.
|
|
3
|
+
"version": "0.116.114",
|
|
4
4
|
"description": "The thirty-one canonical screens of the AI Matrx record store: grid, generated record form, field editor, table settings, relation picker, peek, views, import/export, custom fields, action inbox, history, comments, forms, charts, documents, record chat, AI field fill, checklists, bookings, offline capture, portals, public pages and embeds. Built on @ai-matrx/design-system's data table, carrying @ai-matrx/alchemy's menu, and reading and writing ONLY through @ai-matrx/records.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"node": ">=20"
|
|
173
173
|
},
|
|
174
174
|
"sideEffects": false,
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "0ae7a6af0cf61deddcad19fa56312518bc0bc10e"
|
|
176
176
|
}
|