@ai-matrx/sharing 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/core.cjs +27 -24
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +6 -6
- package/dist/core.d.ts +6 -6
- package/dist/core.js +27 -24
- package/dist/core.js.map +1 -1
- package/dist/react.cjs +224 -86
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +24 -3
- package/dist/react.d.ts +24 -3
- package/dist/react.js +225 -86
- package/dist/react.js.map +1 -1
- package/package.json +3 -3
package/dist/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts","../src/core/host.ts","../src/core/registry.ts","../src/core/levels.ts","../src/core/types.ts","../src/core/publicLane.ts","../src/core/shareLinks.ts","../src/core/service.ts","../src/core/shownTo.ts","../src/core/shownToWords.ts","../src/core/accessSummary.ts","../src/react/sheet/host.tsx","../src/core/format.ts","../src/core/shareText.ts","../src/core/outsideShareService.ts","../src/core/secureDeliveryService.ts","../src/core/indexedActions.ts","../src/core/orgMemberRows.ts","../src/core/organizationsToCreateIn.ts","../src/core/teams.ts"],"sourcesContent":["// @ai-matrx/sharing/core — the sharing data layer: the shareable-resource registry, permission\n// levels, the share/permission service, share links, access summaries and the share notices.\nexport * from \"./host\";\nexport * from \"./registry\";\nexport * from \"./types\";\nexport * from \"./levels\";\nexport * from \"./publicLane\";\nexport * from \"./shareLinks\";\nexport * from \"./service\";\nexport * from \"./shownTo\";\nexport * from \"./shownToWords\";\nexport * from \"./accessSummary\";\nexport * from \"./format\";\nexport * from \"./shareText\";\nexport * from \"./outsideShareService\";\nexport * from \"./secureDeliveryService\";\nexport * from \"./indexedTypes\";\nexport * from \"./indexedActions\";\nexport * from \"./orgMemberRows\";\nexport * from \"./organizationsToCreateIn\";\nexport * from \"./teams\";\n","/**\n * @ai-matrx/sharing/core — what the sharing data layer needs from its host, injected ONCE at boot:\n *\n * configureSharing({ client: () => supabase, callServer, getActiveOrgId, ensureOrgId, resolveEntityHref, ... });\n *\n * Data goes DIRECT through the host's supabase-js client (RLS decides); real work goes to aidream\n * through `callServer` (the share notices, secure delivery). The package never calls a\n * host-relative `/api/` path and never imports `next/*`.\n *\n * `client` is REQUIRED: reading it before `configureSharing` throws an error naming the field.\n * Every other field has a documented default.\n */\n\nimport type { SupabaseClient } from \"@supabase/supabase-js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ShareDbClient = SupabaseClient<any, any, any>;\n\n/** One aidream call — the shape the web's `callApi` takes. */\nexport interface ShareServerCall {\n path: string;\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n queryParams?: Record<string, string | number | boolean>;\n pathParams?: Record<string, string>;\n body?: unknown;\n expectedErrorStatuses?: number[];\n /** aidream declares the route organization-free: send no organization header. */\n organizationFreeRead?: boolean;\n}\n\n/** The answer of one aidream call (the web's `ApiCallResult` shape). */\nexport interface ShareServerResult {\n data?: unknown;\n error?: { message?: string; status?: number; detail?: unknown; code?: string; [k: string]: unknown } | null;\n status?: number;\n [k: string]: unknown;\n}\n\nexport interface SharingHost {\n /** REQUIRED. The signed-in supabase-js client (RLS applies). */\n client: () => ShareDbClient;\n /** The signed-in person (a token-only client has no `auth` namespace). Default: `client().auth.getUser()`. */\n getUser?: () => Promise<{ id: string; email?: string | null } | null>;\n /** aidream calls. Absent → every server call answers a loud \"not wired\" error. */\n callServer?: (call: ShareServerCall) => Promise<ShareServerResult>;\n /** The organization the person is working in (a write target only, never a filter). */\n getActiveOrgId?: () => string | null;\n /** Resolve an organization to write into (the web asks the person when none is picked). */\n ensureOrgId?: (organizationId?: string | null) => Promise<string>;\n /** The entity registry's route for a token+id (`resolveEntityDoors(...).href`). */\n resolveEntityHref?: (token: string, id: string) => string | null | undefined;\n /** True when the entity registry knows the token (a known token with no href = no route). */\n isKnownEntity?: (token: string) => boolean;\n /** The site origin links are built on (default `window.location.origin`). */\n appUrl?: () => string;\n /** The search-engine-indexed switch (web: a server action that also refreshes its cache). */\n searchEngineIndexed?: {\n get: (resourceType: string, resourceId: string) => Promise<{ state: unknown; error: string | null }>;\n set: (resourceType: string, resourceId: string, indexed: boolean | null) => Promise<{ state: unknown; error: string | null }>;\n };\n}\n\nlet host: Partial<SharingHost> = {};\n\n/** Merge host fields over any earlier call (boot-time; tests may call it again). */\nexport function configureSharing(next: Partial<SharingHost>): void {\n host = { ...host, ...next };\n}\n\nexport function sharingHost(): Partial<SharingHost> {\n return host;\n}\n\n/** The supabase-js client. Throws when the host never supplied one. */\nexport function shareClient(): ShareDbClient {\n if (!host.client) {\n throw new Error(\"@ai-matrx/sharing: configureSharing({ client }) was never called — the share sheet has no database client.\");\n }\n return host.client();\n}\n\n/** web parity: `createClient()` / the `supabase` singleton. */\nexport const createClient = (): ShareDbClient => shareClient();\nexport const supabase: ShareDbClient = new Proxy({} as ShareDbClient, {\n get(_t, prop) {\n const c = shareClient() as unknown as Record<string | symbol, unknown>;\n const v = c[prop];\n return typeof v === \"function\" ? (v as (...a: unknown[]) => unknown).bind(c) : v;\n },\n});\n\nexport async function getClaimsUser(client: ShareDbClient) {\n if (host.getUser) {\n const user = await host.getUser();\n return { data: { user: user ? { ...user, email: user.email ?? undefined } : null }, error: null } as unknown as Awaited<ReturnType<ShareDbClient[\"auth\"][\"getUser\"]>>;\n }\n return client.auth.getUser();\n}\n\nexport function getActiveOrgId(): string | null {\n return host.getActiveOrgId?.() ?? null;\n}\n\nexport async function ensureOrgId(organizationId?: string | null): Promise<string> {\n if (organizationId) return organizationId;\n if (host.ensureOrgId) return host.ensureOrgId(organizationId);\n const active = getActiveOrgId();\n if (active) return active;\n throw new Error(\"Pick an organization first — no organization is active for this share.\");\n}\n\nexport function appUrl(): string {\n if (host.appUrl) return host.appUrl();\n return typeof window !== \"undefined\" ? window.location.origin : \"\";\n}\n\nexport function resolveEntityHref(token: string, id: string): string | null {\n return host.resolveEntityHref?.(token, id) ?? null;\n}\n\nexport function isKnownEntity(token: string): boolean {\n return host.isKnownEntity?.(token) ?? false;\n}\n\n/** web parity: `callApi(...)` — answers a promise of the call's result. */\nexport function callApi(call: ShareServerCall): Promise<ShareServerResult> {\n if (!host.callServer) {\n return Promise.resolve({\n error: { message: \"This app has not connected sharing to the AI Matrx server (configureSharing({ callServer }) is missing).\", status: 0 },\n });\n }\n return host.callServer(call);\n}\nexport type ApiCallResult = ShareServerResult;\n\n/** web parity: `dispatch(callApi(...))` — a dispatch that just hands the promise back. */\nexport type AppDispatch = <T>(action: T) => T;\nexport const passThroughDispatch: AppDispatch = (action) => action;\n\n/** Every scrap of an error, for logs and honest notices — the platform's one extractor. */\nexport { extractErrorMessage } from \"@ai-matrx/api/net\";\n\nexport function isJsonObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** The share sheet's two notices, on aidream (`/sharing/notify`, `/sharing/email-link`). */\nexport interface ShareNoticeAnswer {\n success: boolean;\n msg?: string;\n error?: string;\n}\n\nexport async function sendShareNotice(path: \"/sharing/notify\" | \"/sharing/email-link\", body: Record<string, unknown>): Promise<ShareNoticeAnswer> {\n const result = await callApi({ path, method: \"POST\", body, expectedErrorStatuses: [400, 401, 403, 404, 500] });\n if (result.error) {\n const detail = result.error.detail as { error?: string; msg?: string } | undefined;\n return { success: false, msg: detail?.msg ?? detail?.error ?? result.error.message ?? \"The server refused the notice.\" };\n }\n const data = (result.data ?? {}) as ShareNoticeAnswer;\n return { success: Boolean(data.success), msg: data.msg ?? data.error ?? \"\" };\n}\n","import { isKnownEntity, resolveEntityHref } from \"./host\";\n\n/**\n * Shareable Resource Registry — TypeScript mirror\n *\n * Single source of truth lives in the Postgres\n * `platform.shareable_resource_registry` table. This file mirrors the same data\n * so the FE doesn't have to fetch the registry on every page load. The TS↔DB\n * mirror is verified at test time by\n * `utils/permissions/__tests__/registry.parity.test.ts` — if a row is added to\n * the DB and not here (or vice versa) the test fails.\n *\n * REGENERATE (do not hand-edit rows): after any registry migration run\n * `pnpm tsx scripts/regen-shareable-registry-snapshot.ts`\n * to refresh the DB snapshot, then update the rows below to match it.\n *\n * ── Token vs. table (post-2026-canonicalization) ─────────────────────────────\n * Two distinct canonical values live on every row; DO NOT conflate them:\n * • `resourceType` — the ENTITY TOKEN. This is the object key, the value\n * stored in `iam.permissions.resource_type`, and the `p_resource_type`\n * passed to every share RPC. Reference resources by this, never by table.\n * • `tableName` (+ `schemaName`) — the PHYSICAL table (schema.table) for\n * direct supabase-js `.from()` reads. Equals the DB registry `table_name`.\n * They coincided before the reorg (public tables named after their token) and\n * diverge now (token `note` → `workbench.notes`, token `file` → `files.files`).\n * For permission/RPC/`iam.permissions` work use `resourceType`; for a direct\n * table read use `.schema(schemaName).from(tableName)`.\n */\n\nexport interface ShareableResourceEntry {\n /**\n * The entity TOKEN — public alias used in TS / RPC arguments / UI props and\n * stored in `iam.permissions.resource_type`. This is what you pass to the\n * share RPCs; it is NOT the physical table name.\n */\n resourceType: string;\n\n /**\n * The PHYSICAL Postgres table name (within `schemaName`), mirroring the DB\n * registry `table_name`. Used for direct `.from()` reads. NOT the permissions\n * key — reference resources by `resourceType`. Multiple tokens may share a\n * physical name across schemas (e.g. `definition` in agent/app/skill/workflow).\n */\n tableName: string;\n\n /** Primary-key column on the resource table. Almost always 'id'. */\n idColumn: string;\n\n /** Column holding the owner's auth.uid(). Canonical tables use 'created_by'. */\n ownerColumn: string;\n\n /**\n * Column holding the public-visibility boolean, when the table has one.\n * Null means only “no legacy boolean is declared”; canonical enum tables and\n * types with no public-state column both use null. Call\n * `getShareCapabilities()` to resolve the verified physical state column.\n */\n isPublicColumn: string | null;\n\n /** Human-readable label used in the share modal title and emails. */\n displayLabel: string;\n\n /**\n * Optional signed-in destination pattern. `{id}` is substituted with the\n * resource id. No-login share links use the generic `/s/[token]` route.\n */\n urlPathTemplate: string;\n\n /**\n * When false, the table's RLS does NOT call has_permission()/has_access().\n * A permission grant inserts but does not actually grant the grantee access.\n * Surfaces broken end-to-end states explicitly.\n */\n rlsUsesHasPermission: boolean;\n\n /**\n * Non-`public` Postgres schema the resource table lives in. supabase-js\n * reaches it via `.schema(schemaName)`. Omitted ⇒ `public`. FE-only — not\n * part of the DB-registry parity comparison.\n */\n schemaName?: string | undefined;\n}\n\n/**\n * The canonical client-side mirror of platform.shareable_resource_registry.\n * Verified against the DB by the parity test. Regenerate rows from the DB — do\n * not hand-tune individual fields.\n */\nexport const SHAREABLE_RESOURCE_REGISTRY = {\n /**\n * The unified record store (lane W3-HIST added the DB row 2026-09-18; this\n * mirror followed on 2026-09-19 with lane SHARE, which is what made the one\n * share dialog reach a record at all — until then `getShareableResource`\n * answered undefined and the dialog rendered its \"not a registered shareable\n * resource\" refusal).\n *\n * A TABLE IS A RECORD HERE: `custom.record` holds both, so one token covers\n * the record screen and the table screen. `rlsUsesHasPermission` is false on\n * purpose — schema `custom` is read through its own doors (W4-DOOR), never\n * through the generic has_permission arm. `urlPathTemplate` stays empty: a\n * record's page is /data/{tableId} plus the record, which this one-id\n * template cannot express, and an honest \"no link\" beats a broken one.\n */\n record: {\n resourceType: \"record\",\n tableName: \"record\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Record\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: false,\n },\n browser_profile: {\n resourceType: \"browser_profile\",\n tableName: \"profile\",\n schemaName: \"browser\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cloud Browser Profile\",\n // No `/browser/*` segment exists anywhere in `app/`, so there is no\n // signed-in destination. The DB row advertised `/browser/profiles/{id}`\n // until migration 20260909_shareable_registry_dead_end_urls.sql made the\n // registry honest; both sides now say \"no link\".\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_run: {\n resourceType: \"agent_run\",\n tableName: \"agent_run\",\n schemaName: \"chat\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n comparison_set: {\n resourceType: \"comparison_set\",\n tableName: \"cmp_comparison_sets\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Comparison Set\",\n urlPathTemplate: \"/agents/compare?set={id}\",\n rlsUsesHasPermission: true,\n },\n crm_sending_identity: {\n resourceType: \"crm_sending_identity\",\n tableName: \"sending_identity\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sending mailbox\",\n urlPathTemplate: \"/crm/sending-identities/{id}\",\n rlsUsesHasPermission: true,\n },\n global_request: {\n resourceType: \"global_request\",\n tableName: \"global_request\",\n schemaName: \"runtime\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Runtime Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hindsight_enrollment: {\n resourceType: \"hindsight_enrollment\",\n tableName: \"enrollment\",\n schemaName: \"hindsight\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hindsight Enrollment\",\n urlPathTemplate: \"/administration/agents/hindsight?enrollment={id}\",\n rlsUsesHasPermission: true,\n },\n plan_node: {\n resourceType: \"plan_node\",\n tableName: \"node\",\n schemaName: \"plan\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Plan Page\",\n urlPathTemplate: \"/marketing/content-plan/nodes/{id}\",\n rlsUsesHasPermission: true,\n },\n sch_task: {\n resourceType: \"sch_task\",\n tableName: \"sch_task\",\n schemaName: \"scheduler\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Scheduled Task\",\n urlPathTemplate: \"/administration/automation/scheduling/tasks?task={id}\",\n rlsUsesHasPermission: true,\n },\n seo_rank_target: {\n resourceType: \"seo_rank_target\",\n tableName: \"rank_target\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SEO Rank Target\",\n urlPathTemplate: \"/marketing/ranks?target={id}\",\n rlsUsesHasPermission: true,\n },\n sms_conversation: {\n resourceType: \"sms_conversation\",\n tableName: \"sms_conversations\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SMS Conversation\",\n urlPathTemplate: \"/sms?conversation={id}\",\n rlsUsesHasPermission: true,\n },\n agent: {\n resourceType: \"agent\",\n tableName: \"definition\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent\",\n urlPathTemplate: \"/agents/{id}\",\n rlsUsesHasPermission: true,\n },\n agent_card: {\n resourceType: \"agent_card\",\n tableName: \"card\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Card\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n app: {\n resourceType: \"app\",\n tableName: \"definition\",\n schemaName: \"app\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Applet\",\n urlPathTemplate: \"/applets/manage/{id}\",\n rlsUsesHasPermission: true,\n },\n assessment: {\n resourceType: \"assessment\",\n tableName: \"assessment\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Assessment\",\n urlPathTemplate: \"/education/quizzes/{id}\",\n rlsUsesHasPermission: true,\n },\n // `batch_provider_batch` was here until 2026-08-21. It was registered\n // shareable on 2026-06-03 as \"Auto-ingest Batch\" (owner_column `user_id`),\n // and that registration was the only reason its bespoke\n // `is_resource_owner('batch_provider_batch', id)` RLS policy resolved at all.\n // The whole `batch` schema now runs the canonical `ledger` variant (aidream\n // migrations 0438/0439): the server writes, users read their own org's rows,\n // and there is no grant lane to share through. `provider_batch` also has no\n // real owner — the flusher stamps user_id/created_by from items[0] of a flush\n // group that can span users. The DB row is deactivated, never deleted.\n canvas_item: {\n resourceType: \"canvas_item\",\n tableName: \"canvas_items\",\n schemaName: \"canvas\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Canvas Item\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n context_item: {\n // Mirrors the live platform.shareable_resource_registry row, which still names the retired\n // context.context_items: a context field lives in the record store now, and\n // public.resolve_shareable_resource REFUSES this token BY NAME (\"share the record itself\") —\n // the same decision the generic registry readers take (platform.record_store_kind,\n // SCOPES-CLEANUP 2026-10-09). Not a table any share path may read.\n resourceType: \"context_item\",\n tableName: \"context_items\",\n schemaName: \"context\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n // D193 fixed 2026-08-15 (D117's class). The DB row declared 'visibility' —\n // a column `context.context_items` does not have — which routed ShareModal\n // through make_resource_public at a nonexistent column. NULL is the honest\n // value AND the permanent one: a context item is a COMPONENT of its scope\n // type (it is the \"column\" of a dimension; the cells live in\n // context.context_item_values). It has no organization_id, all four of its\n // RLS policies key on the parent scope type's org and none call\n // has_permission, and iam.permissions has never held a single\n // context_item grant across 203 live rows. Access CONVEYS from the parent,\n // so it is not independently shareable and must never grow a per-item\n // visibility column — that would be a second access authority no policy\n // reads. Do not \"fix\" this back to a column name.\n isPublicColumn: null,\n displayLabel: \"Context Item\",\n // The only id-addressable route needs THREE ids\n // (/organizations/[orgId]/scopes/[typeId]/context-items/[itemId]), which a\n // {id}-only template cannot build. Rather than invent a single-id route for\n // a COMPONENT of a scope type, the door is the all-orgs hub focused on the\n // item (`?item=` — features/scopes/components/pages/ContextItemsHub.tsx),\n // which resolves it, scrolls to it and highlights it, and renders the\n // access gate when the caller cannot reach it. This was `''` under D138\n // until the focus param existed (2026-08-15). `entityRegistry.hrefFor`\n // carries the same destination and is the half `getResourceSharePath`\n // actually reads for this token — move both or neither.\n urlPathTemplate: \"/context-items?item={id}\",\n rlsUsesHasPermission: false,\n },\n code_file: {\n resourceType: \"code_file\",\n tableName: \"code_files\",\n schemaName: \"code\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Code File\",\n urlPathTemplate: \"/code?open={id}\",\n rlsUsesHasPermission: true,\n },\n code_folder: {\n resourceType: \"code_folder\",\n tableName: \"code_file_folders\",\n schemaName: \"code\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Code Folder\",\n urlPathTemplate: \"/code?folder={id}\",\n rlsUsesHasPermission: true,\n },\n code_repository: {\n resourceType: \"code_repository\",\n tableName: \"code_repositories\",\n schemaName: \"code\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Code Repository\",\n urlPathTemplate: \"/knowledge/repositories?repo={id}\",\n rlsUsesHasPermission: true,\n },\n message_template: {\n resourceType: \"message_template\",\n tableName: \"message_template\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Message Template\",\n urlPathTemplate: \"/chat/message-templates/{id}\",\n rlsUsesHasPermission: true,\n },\n marketing_initiative: {\n resourceType: \"marketing_initiative\",\n tableName: \"initiative\",\n schemaName: \"marketing\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Initiative\",\n urlPathTemplate: \"/marketing/initiatives/{id}\",\n rlsUsesHasPermission: true,\n },\n conversation: {\n resourceType: \"conversation\",\n tableName: \"conversation\",\n schemaName: \"chat\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Conversation\",\n urlPathTemplate: \"/chat/{id}\",\n rlsUsesHasPermission: true,\n },\n data_store: {\n resourceType: \"data_store\",\n tableName: \"data_stores\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n // 'visibility' is the canonical enum, not a boolean is_public column — a\n // non-null value here wrongly routes sharing through make_resource_public.\n isPublicColumn: null,\n displayLabel: \"Data Store\",\n urlPathTemplate: \"/knowledge/data-stores?store_id={id}\",\n rlsUsesHasPermission: false,\n },\n dm_conversation: {\n resourceType: \"dm_conversation\",\n tableName: \"dm_conversations\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Direct Conversation\",\n urlPathTemplate: \"/messages/{id}\",\n rlsUsesHasPermission: true,\n },\n fc_card: {\n resourceType: \"fc_card\",\n tableName: \"fc_card\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Flashcard\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n fc_set: {\n resourceType: \"fc_set\",\n tableName: \"fc_set\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Flashcard Deck\",\n urlPathTemplate: \"/education/flashcards/{id}\",\n rlsUsesHasPermission: true,\n },\n feature_doc: {\n resourceType: \"feature_doc\",\n tableName: \"feature_docs\",\n schemaName: \"admin\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Feature Doc\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n file: {\n resourceType: \"file\",\n tableName: \"files\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"File\",\n urlPathTemplate: \"/files/f/{id}\",\n rlsUsesHasPermission: true,\n },\n file_analysis: {\n resourceType: \"file_analysis\",\n tableName: \"analysis\",\n schemaName: \"files\",\n idColumn: \"file_id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"File Analysis\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n file_entities: {\n resourceType: \"file_entities\",\n tableName: \"entities\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"File Entity\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n file_overrides: {\n resourceType: \"file_overrides\",\n tableName: \"overrides\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"File Override\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n file_page_annotations: {\n resourceType: \"file_page_annotations\",\n tableName: \"page_annotations\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"Page Annotation\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n file_pages: {\n resourceType: \"file_pages\",\n tableName: \"pages\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"File Page\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n folder: {\n resourceType: \"folder\",\n tableName: \"folders\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Folder\",\n urlPathTemplate: \"/files/folder/{id}\",\n rlsUsesHasPermission: true,\n },\n learn_doc: {\n resourceType: \"learn_doc\",\n tableName: \"learn_doc\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Guide\",\n urlPathTemplate: \"/education/learn/{slug}\",\n rlsUsesHasPermission: true,\n },\n note: {\n resourceType: \"note\",\n tableName: \"notes\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Note\",\n urlPathTemplate: \"/notes/{id}\",\n rlsUsesHasPermission: true,\n },\n pdf_redaction_audit: {\n resourceType: \"pdf_redaction_audit\",\n tableName: \"pdf_redaction_audits\",\n schemaName: \"pdf\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Redaction Audit\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n project: {\n resourceType: \"project\",\n tableName: \"projects\",\n schemaName: \"projects\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Project\",\n urlPathTemplate: \"/projects/{id}\",\n rlsUsesHasPermission: true,\n },\n quiz_session: {\n resourceType: \"quiz_session\",\n tableName: \"quiz_sessions\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Quiz session\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n research_template: {\n resourceType: \"research_template\",\n tableName: \"rs_template\",\n schemaName: \"research\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Research Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n research_topic: {\n resourceType: \"research_topic\",\n tableName: \"rs_topic\",\n schemaName: \"research\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Research Topic\",\n urlPathTemplate: \"/research/topics/{id}\",\n rlsUsesHasPermission: true,\n },\n sandbox_instance: {\n resourceType: \"sandbox_instance\",\n tableName: \"sandbox_instances\",\n idColumn: \"id\",\n ownerColumn: \"user_id\",\n isPublicColumn: null,\n displayLabel: \"Sandbox\",\n urlPathTemplate: \"/sandbox/{id}\",\n rlsUsesHasPermission: true,\n },\n // `scope_association_suggestion` and `scope_item_value_suggestion` were here\n // until 2026-09-09. Both DB rows are now `is_active = false`, so there is no\n // grant lane to share through and the parity guard's \"no TS entry the active\n // DB does not have\" arm rejects them. Deactivated, never deleted — the same\n // treatment `batch_provider_batch` got above. Reactivating either means\n // flipping the DB row back and re-mirroring it here, in one commit.\n shared_canvas_item: {\n resourceType: \"shared_canvas_item\",\n tableName: \"shared_canvas_items\",\n schemaName: \"canvas\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Shared Canvas\",\n urlPathTemplate: \"/canvas/shared/{id}\",\n rlsUsesHasPermission: true,\n },\n skill: {\n resourceType: \"skill\",\n tableName: \"definition\",\n schemaName: \"skill\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Skill\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n studio_session: {\n resourceType: \"studio_session\",\n tableName: \"studio_sessions\",\n schemaName: \"transcripts\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Transcript Studio session\",\n urlPathTemplate: \"/transcripts/studio?session={id}\",\n rlsUsesHasPermission: true,\n },\n study_media: {\n resourceType: \"study_media\",\n tableName: \"study_media\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Media\",\n urlPathTemplate: \"/education/media/{id}\",\n rlsUsesHasPermission: true,\n },\n task: {\n resourceType: \"task\",\n tableName: \"tasks\",\n schemaName: \"projects\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Task\",\n urlPathTemplate: \"/tasks/{id}\",\n rlsUsesHasPermission: true,\n },\n thread: {\n resourceType: \"thread\",\n tableName: \"threads\",\n schemaName: \"projects\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Thread\",\n urlPathTemplate: \"/war-room/all\",\n rlsUsesHasPermission: true,\n },\n transcript: {\n resourceType: \"transcript\",\n tableName: \"transcripts\",\n schemaName: \"transcripts\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Transcript\",\n urlPathTemplate: \"/transcripts/processor?focus={id}\",\n rlsUsesHasPermission: true,\n },\n // The four workbench UDT entities were canonicalized 2026-08-15: they now\n // carry the `visibility` enum + `created_by`, and their RLS is generated by\n // iam.apply_rls(...,'entity'). `isPublicColumn` is null for the same reason it\n // is null on data_store / scope / content_ir_kind_instance — 'visibility' is\n // the canonical ENUM, and naming a boolean here routes the ShareModal through\n // make_resource_public instead of the enum path.\n udt_document: {\n resourceType: \"udt_document\",\n tableName: \"udt_documents\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cloud document\",\n urlPathTemplate: \"/documents/{id}\",\n rlsUsesHasPermission: true,\n },\n // The Presentations home (2026-10-12): a canonical entity (platform.create_entity_table) whose\n // `deck` column is the presentation_deck kind; `visibility` enum, so no boolean column.\n presentation: {\n resourceType: \"presentation\",\n tableName: \"presentation\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Presentation\",\n urlPathTemplate: \"/presentations/{id}\",\n rlsUsesHasPermission: true,\n },\n // Active DB registry row that predates this mirror; surfaced by the parity\n // snapshot regen during the structured-list rename. Mirrored here so the\n // TS↔DB guard stays green.\n scope: {\n // Mirrors the live registry row (the retired context.scopes). A scope is a record-store Record:\n // public.resolve_shareable_resource REFUSES this token BY NAME, as for context_item above.\n resourceType: \"scope\",\n tableName: \"scopes\",\n schemaName: \"context\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n // 'visibility' is the canonical enum, not a boolean is_public column — a\n // non-null value here wrongly routes sharing through make_resource_public.\n isPublicColumn: null,\n displayLabel: \"Scope\",\n urlPathTemplate: \"/scopes/s/{id}\",\n rlsUsesHasPermission: false,\n },\n workbook: {\n resourceType: \"workbook\",\n tableName: \"udt_workbooks\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n // Canonicalized 2026-08-15 — see the note on `dataset` above.\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workbook\",\n urlPathTemplate: \"/workbooks/{id}\",\n rlsUsesHasPermission: true,\n },\n user_analysis_preference: {\n resourceType: \"user_analysis_preference\",\n tableName: \"user_analysis_preferences\",\n schemaName: \"users\",\n idColumn: \"user_id\",\n ownerColumn: \"user_id\",\n isPublicColumn: null,\n displayLabel: \"Analysis Preferences\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: false,\n },\n web_site: {\n resourceType: \"web_site\",\n tableName: \"site\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Site\",\n urlPathTemplate: \"/marketing/sites/{id}\",\n rlsUsesHasPermission: true,\n },\n web_page: {\n resourceType: \"web_page\",\n tableName: \"page\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Site page\",\n urlPathTemplate: \"/marketing/pages/{id}\",\n rlsUsesHasPermission: true,\n },\n web_property: {\n resourceType: \"web_property\",\n tableName: \"property\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Marketing Property\",\n urlPathTemplate: \"/marketing/properties/{id}\",\n rlsUsesHasPermission: true,\n },\n web_screenshot: {\n resourceType: \"web_screenshot\",\n tableName: \"screenshot\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Web Screenshot\",\n urlPathTemplate: \"/marketing/screenshots/{id}\",\n rlsUsesHasPermission: true,\n },\n web_snapshot: {\n resourceType: \"web_snapshot\",\n tableName: \"snapshot\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Web Snapshot\",\n urlPathTemplate: \"/marketing/snapshots/{id}\",\n rlsUsesHasPermission: true,\n },\n war_room: {\n resourceType: \"war_room\",\n tableName: \"war_rooms\",\n schemaName: \"projects\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"War Room\",\n urlPathTemplate: \"/war-room/{id}\",\n rlsUsesHasPermission: true,\n },\n wc_claim: {\n resourceType: \"wc_claim\",\n tableName: \"wc_claim\",\n schemaName: \"legal\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"WC Claim\",\n urlPathTemplate: \"/legal/ca-wc/pd-ratings-calculator/{id}\",\n rlsUsesHasPermission: true,\n },\n wf_node_data_slot: {\n resourceType: \"wf_node_data_slot\",\n tableName: \"node_data_slot\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Node Data Slot\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: false,\n },\n workflow_run: {\n resourceType: \"workflow_run\",\n tableName: \"run\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow_template: {\n resourceType: \"workflow_template\",\n tableName: \"template\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow_trigger: {\n resourceType: \"workflow_trigger\",\n tableName: \"trigger\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Trigger\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n // Active DB registry row that predated this mirror and was never snapshotted\n // — the exact blind spot registry.parity.test.ts documents (a live registry\n // change nobody regenerated the snapshot for). Mirrored 2026-08-14.\n workflow_plan: {\n resourceType: \"workflow_plan\",\n tableName: \"plan\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Plan\",\n // No signed-in destination: plans are shown inside workflow-studio, which\n // is a separate client with no route in this app.\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow: {\n resourceType: \"workflow\",\n tableName: \"definition\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow\",\n // `/workflows/[id]` is a live route (app/(core)/workflows/[id]/page.tsx).\n // This mirror carried \"\" while the DB carried the real template — the\n // no-link half of a TS<->DB split that hid a working destination from\n // every share surface. The DB value wins because the DB is the authority.\n urlPathTemplate: \"/workflows/{id}\",\n rlsUsesHasPermission: true,\n },\n // Live DB registry rows that predate this mirror — surfaced by the\n // 2026-07-29 snapshot regen (the working_document registration). Mirrored\n // here so the TS↔DB parity guard stays green.\n content_ir_kind_instance: {\n resourceType: \"content_ir_kind_instance\",\n tableName: \"kind_instance\",\n schemaName: \"content_ir\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n // D117 fixed 2026-08-13: the DB row briefly declared 'visibility' (the\n // canonical enum) in the boolean is_public_column slot, which routed\n // ShareModal through make_resource_public. Now NULL in DB and here.\n isPublicColumn: null,\n // What a HUMAN calls it in the share dialog / access gate. \"Kind Instance\"\n // was developer jargon in a non-technical user's face (2026-08-13).\n displayLabel: \"Saved Result\",\n urlPathTemplate: \"/shapes/instances/{id}\",\n rlsUsesHasPermission: true,\n },\n crm_outreach_list: {\n resourceType: \"crm_outreach_list\",\n tableName: \"outreach_list\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Outreach List\",\n urlPathTemplate: \"/crm/outreach-lists/{id}\",\n rlsUsesHasPermission: true,\n },\n party: {\n resourceType: \"party\",\n tableName: \"party\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Contact\",\n urlPathTemplate: \"/crm/{id}\",\n rlsUsesHasPermission: true,\n },\n seo_collection_run: {\n resourceType: \"seo_collection_run\",\n tableName: \"collection_run\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SEO Collection Run\",\n urlPathTemplate: \"/marketing/ai-visibility/runs/{id}\",\n rlsUsesHasPermission: true,\n },\n seo_change_set: {\n resourceType: \"seo_change_set\",\n tableName: \"change_set\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SEO Change\",\n urlPathTemplate: \"/marketing/changes/{id}\",\n rlsUsesHasPermission: false,\n },\n seo_topical_map: {\n resourceType: \"seo_topical_map\",\n tableName: \"topical_map\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Topical map\",\n // The id door shipped 2026-09-17 at app/(core)/marketing/topical-maps/[mapId]:\n // it redirects a caller who can read the brand into the nested workspace and\n // renders the map standalone for a record-only grantee — the two lanes\n // sharing exactly matter.\n urlPathTemplate: \"/marketing/topical-maps/{id}\",\n rlsUsesHasPermission: true,\n },\n seo_keyword: {\n resourceType: \"seo_keyword\",\n tableName: \"keyword\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SEO Keyword\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: false,\n },\n youtube_search: {\n resourceType: \"youtube_search\",\n tableName: \"youtube_search\",\n schemaName: \"research\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"YouTube Search\",\n urlPathTemplate: \"/marketing/discovery/youtube?search={id}\",\n rlsUsesHasPermission: true,\n },\n rulebook: {\n resourceType: \"rulebook\",\n tableName: \"rulebook\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Rulebook\",\n urlPathTemplate: \"/masterwork/{id}\",\n rlsUsesHasPermission: true,\n },\n interview_decision_interview: {\n resourceType: \"interview_decision_interview\",\n tableName: \"decision_interview\",\n schemaName: \"interview\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Decision Interview\",\n urlPathTemplate: \"/administration/question-desk/{id}\",\n rlsUsesHasPermission: true,\n },\n interview_session: {\n resourceType: \"interview_session\",\n tableName: \"session\",\n schemaName: \"interview\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Vision Interview\",\n urlPathTemplate: \"/masterwork/vision-interview/{id}\",\n rlsUsesHasPermission: true,\n },\n workflow_runtime_surface: {\n resourceType: \"workflow_runtime_surface\",\n tableName: \"runtime_surface\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Run Surface\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n growth_loop_run: {\n resourceType: \"growth_loop_run\",\n tableName: \"loop_run\",\n schemaName: \"growth\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Growth Loop Run\",\n urlPathTemplate: \"/marketing/growth-loop/{id}\",\n rlsUsesHasPermission: true,\n },\n web_brand: {\n resourceType: \"web_brand\",\n tableName: \"brand\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Brand\",\n urlPathTemplate: \"/marketing/brands/{id}\",\n rlsUsesHasPermission: true,\n },\n // ── Mirrored 2026-09-09 ──────────────────────────────────────────────────\n // 32 ACTIVE rows that live in platform.shareable_resource_registry and had\n // never reached this file. The parity guard only ever compared this mirror to\n // the COMMITTED snapshot, and the snapshot was itself 31 rows behind the live\n // table — so the drift was invisible from both ends until\n // `pnpm check:shareable-registry` was run during the 2026-09-08 jest triage.\n //\n // The HR rows that read `urlPathTemplate: \"\"` are not oversights: their detail\n // routes do not exist in `app/` (only the module/list page does), and the\n // registry's rule is that a record with no signed-in destination says so with\n // an empty template rather than pointing at a list that cannot show it. The\n // ones with a route carry their real route, verified against the tree by\n // registry.routes.test.ts. See migration\n // 20260909_shareable_registry_dead_end_urls.sql for the DB half.\n crm_deal: {\n resourceType: \"crm_deal\",\n tableName: \"deal\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Deal\",\n urlPathTemplate: \"/crm/deals/{id}\",\n rlsUsesHasPermission: true,\n },\n esign_campaign: {\n resourceType: \"esign_campaign\",\n tableName: \"campaign\",\n schemaName: \"esign\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Signature campaign\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n esign_envelope: {\n resourceType: \"esign_envelope\",\n tableName: \"envelope\",\n schemaName: \"esign\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Signature envelope\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_ai_evidence: {\n resourceType: \"hr_ai_evidence\",\n tableName: \"ai_evidence\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"AI evidence\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_asset: {\n resourceType: \"hr_asset\",\n tableName: \"asset\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Asset\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_background_check: {\n resourceType: \"hr_background_check\",\n tableName: \"background_check\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Background check\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_candidate: {\n resourceType: \"hr_candidate\",\n tableName: \"candidate\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Candidate\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_checklist_template: {\n resourceType: \"hr_checklist_template\",\n tableName: \"checklist_template\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Checklist template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_compensation: {\n resourceType: \"hr_compensation\",\n tableName: \"compensation\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Compensation\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_corrective_action: {\n resourceType: \"hr_corrective_action\",\n tableName: \"corrective_action\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Corrective action\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_course: {\n resourceType: \"hr_course\",\n tableName: \"course\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Course\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_emergency_contact: {\n resourceType: \"hr_emergency_contact\",\n tableName: \"emergency_contact\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Emergency contact\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_employee: {\n resourceType: \"hr_employee\",\n tableName: \"employee\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Employee\",\n urlPathTemplate: \"/hr/people/{id}\",\n rlsUsesHasPermission: true,\n },\n hr_employee_private: {\n resourceType: \"hr_employee_private\",\n tableName: \"employee_private\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Employee private details\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_employer_profile: {\n resourceType: \"hr_employer_profile\",\n tableName: \"employer_profile\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Employer profile\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_employment: {\n resourceType: \"hr_employment\",\n tableName: \"employment\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Employment spell\",\n urlPathTemplate: \"/hr/people/{id}/employment\",\n rlsUsesHasPermission: true,\n },\n hr_i9: {\n resourceType: \"hr_i9\",\n tableName: \"i9\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Form I-9\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_interview: {\n resourceType: \"hr_interview\",\n tableName: \"interview\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Interview\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_leave_policy: {\n resourceType: \"hr_leave_policy\",\n tableName: \"leave_policy\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Leave policy\",\n urlPathTemplate: \"/hr/settings/leave-policies/{id}\",\n rlsUsesHasPermission: true,\n },\n hr_legal_hold: {\n resourceType: \"hr_legal_hold\",\n tableName: \"legal_hold\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Legal hold\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_offer: {\n resourceType: \"hr_offer\",\n tableName: \"offer\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Offer\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_records_request: {\n resourceType: \"hr_records_request\",\n tableName: \"records_request\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Records request\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_reference_check: {\n resourceType: \"hr_reference_check\",\n tableName: \"reference_check\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Reference check\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_requisition: {\n resourceType: \"hr_requisition\",\n tableName: \"requisition\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Requisition\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_restricted_note: {\n resourceType: \"hr_restricted_note\",\n tableName: \"restricted_note\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Restricted note\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_separation: {\n resourceType: \"hr_separation\",\n tableName: \"separation\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Separation\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_survey: {\n resourceType: \"hr_survey\",\n tableName: \"survey\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Survey\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_tax_withholding: {\n resourceType: \"hr_tax_withholding\",\n tableName: \"tax_withholding\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Tax withholding\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_verification_letter_request: {\n resourceType: \"hr_verification_letter_request\",\n tableName: \"verification_letter_request\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Verification letter request\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_workflow_instance: {\n resourceType: \"hr_workflow_instance\",\n tableName: \"workflow_instance\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"HR approval request\",\n urlPathTemplate: \"/hr/tasks/{id}\",\n rlsUsesHasPermission: true,\n },\n processed_document: {\n resourceType: \"processed_document\",\n tableName: \"processed_documents\",\n schemaName: \"docproc\",\n idColumn: \"id\",\n // The DB registry names `created_by` (aidream 1211; the legacy owner_id\n // retires) and the DB is the authority.\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Source\",\n // Empty in the DB registry: no signed-in per-record destination exists.\n // Never invent one here (D138).\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_feedback: {\n resourceType: \"user_feedback\",\n tableName: \"user_feedback\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Feedback item\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow_recovery_audit: {\n resourceType: \"workflow_recovery_audit\",\n tableName: \"recovery_audit\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow recovery audit\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n // Live platform.shareable_resource_registry rows mirrored 2026-09-21.\n // The database is the authority; these entries exist so the client mirror\n // covers every active shareable type the registry already published.\n agent_mandate_note: {\n resourceType: \"agent_mandate_note\",\n tableName: \"mandate_note\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Mandate Note\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_prompt_remediation: {\n resourceType: \"agent_prompt_remediation\",\n tableName: \"prompt_remediation\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Prompt Remediation\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_shortcut: {\n resourceType: \"agent_shortcut\",\n tableName: \"shortcut\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Shortcut\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_template: {\n resourceType: \"agent_template\",\n tableName: \"template\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_form: {\n resourceType: \"anon_form\",\n tableName: \"anon_form\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Form\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_hit: {\n resourceType: \"anon_hit\",\n tableName: \"anon_hit\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Hit\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_inbound: {\n resourceType: \"anon_inbound\",\n tableName: \"anon_inbound\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Inbound\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_replay: {\n resourceType: \"anon_replay\",\n tableName: \"anon_replay\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Replay\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_submission: {\n resourceType: \"anon_submission\",\n tableName: \"anon_submission\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Submission\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_token: {\n resourceType: \"anon_token\",\n tableName: \"anon_token\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Token\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n app_instance: {\n resourceType: \"app_instance\",\n tableName: \"app_instances\",\n schemaName: \"public\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"App Instance\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n app_setting: {\n resourceType: \"app_setting\",\n tableName: \"app_settings\",\n schemaName: \"public\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"App Setting\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n app_sync_status: {\n resourceType: \"app_sync_status\",\n tableName: \"app_sync_status\",\n schemaName: \"public\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"App Sync Status\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n assessment_result: {\n resourceType: \"assessment_result\",\n tableName: \"assessment_result\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Assessment Result\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n assignment_session: {\n resourceType: \"assignment_session\",\n tableName: \"session\",\n schemaName: \"assignment\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Assignment Session\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n assist: {\n resourceType: \"assist\",\n tableName: \"assists\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Assist\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n billing_spend_guardrail: {\n resourceType: \"billing_spend_guardrail\",\n tableName: \"spend_guardrail\",\n schemaName: \"billing\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Billing Spend Guardrail\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n calendar_event: {\n resourceType: \"calendar_event\",\n tableName: \"calendar_event\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Calendar Event\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n canvas_score: {\n resourceType: \"canvas_score\",\n tableName: \"canvas_scores\",\n schemaName: \"canvas\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Canvas Score\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n canvas_view: {\n resourceType: \"canvas_view\",\n tableName: \"canvas_views\",\n schemaName: \"canvas\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Canvas View\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n category: {\n resourceType: \"category\",\n tableName: \"categories\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Category\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n cmp_feedback: {\n resourceType: \"cmp_feedback\",\n tableName: \"cmp_response_feedback\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cmp Feedback\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n comment: {\n resourceType: \"comment\",\n tableName: \"comments\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Comment\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_certified_printer: {\n resourceType: \"commerce_certified_printer\",\n tableName: \"certified_printer\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Certified Printer\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_cloud_sync_connection: {\n resourceType: \"commerce_cloud_sync_connection\",\n tableName: \"cloud_sync_connection\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Cloud Sync Connection\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_intake_batch: {\n resourceType: \"commerce_intake_batch\",\n tableName: \"intake_batch\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Intake Batch\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_label_batch: {\n resourceType: \"commerce_label_batch\",\n tableName: \"label_batch\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Label Batch\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_marketplace_account: {\n resourceType: \"commerce_marketplace_account\",\n tableName: \"marketplace_account\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Marketplace Account\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_print_order: {\n resourceType: \"commerce_print_order\",\n tableName: \"print_order\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Print Order\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_product: {\n resourceType: \"commerce_product\",\n tableName: \"product\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Product\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n contact_medium: {\n resourceType: \"contact_medium\",\n tableName: \"contact_medium\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Contact Medium\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n contact_submission: {\n resourceType: \"contact_submission\",\n tableName: \"contact_submissions\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Contact Submission\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n context_item_suggestion: {\n resourceType: \"context_item_suggestion\",\n tableName: \"context_item_suggestions\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Context Item Suggestion\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n crm_blocklist_entry: {\n resourceType: \"crm_blocklist_entry\",\n tableName: \"blocklist_entry\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Crm Blocklist Entry\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n crm_registry_ingest_run: {\n resourceType: \"crm_registry_ingest_run\",\n tableName: \"registry_ingest_run\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Crm Registry Ingest Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n crm_sending_policy: {\n resourceType: \"crm_sending_policy\",\n tableName: \"sending_policy\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Crm Sending Policy\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n custom_field_definition: {\n resourceType: \"custom_field_definition\",\n tableName: \"custom_field_definition\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Custom Field Definition\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n cx_agent_memory: {\n resourceType: \"cx_agent_memory\",\n tableName: \"agent_memory\",\n schemaName: \"chat\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cx Agent Memory\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n cx_user_request: {\n resourceType: \"cx_user_request\",\n tableName: \"user_request\",\n schemaName: \"chat\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cx User Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n derive_run: {\n resourceType: \"derive_run\",\n tableName: \"derive_runs\",\n schemaName: \"docproc\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Derive Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n dict_entry: {\n resourceType: \"dict_entry\",\n tableName: \"dict_entries\",\n schemaName: \"dictionary\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Dict Entry\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n dict_setting: {\n resourceType: \"dict_setting\",\n tableName: \"dict_settings\",\n schemaName: \"dictionary\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Dict Setting\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n doc_render: {\n resourceType: \"doc_render\",\n tableName: \"doc_render\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Doc Render\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n doc_signature: {\n resourceType: \"doc_signature\",\n tableName: \"doc_signature\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Doc Signature\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n egress_device: {\n resourceType: \"egress_device\",\n tableName: \"egress_device\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Egress Device\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n esign_provider_binding: {\n resourceType: \"esign_provider_binding\",\n tableName: \"provider_binding\",\n schemaName: \"esign\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Esign Provider Binding\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n external_link: {\n resourceType: \"external_link\",\n tableName: \"external_link\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"External Link\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n external_source: {\n resourceType: \"external_source\",\n tableName: \"external_source\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"External Source\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n game_badge: {\n resourceType: \"game_badge\",\n tableName: \"game_badge\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Game Badge\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n game_result: {\n resourceType: \"game_result\",\n tableName: \"game_result\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Game Result\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n game_room: {\n resourceType: \"game_room\",\n tableName: \"game_room\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Game Room\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n google_document: {\n resourceType: \"google_document\",\n tableName: \"google_document\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Google file\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n guided_checklist_run: {\n resourceType: \"guided_checklist_run\",\n tableName: \"guided_checklist_run\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Guided Checklist Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n heatmap_save: {\n resourceType: \"heatmap_save\",\n tableName: \"heatmap_saves\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Heatmap Save\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hindsight_regression_case: {\n resourceType: \"hindsight_regression_case\",\n tableName: \"regression_case\",\n schemaName: \"hindsight\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hindsight Regression Case\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hindsight_replay_step: {\n resourceType: \"hindsight_replay_step\",\n tableName: \"replay_step\",\n schemaName: \"hindsight\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hindsight Replay Step\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_alert_routing_rule: {\n resourceType: \"hr_alert_routing_rule\",\n tableName: \"alert_routing_rule\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Alert Routing Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_auto_close_rule: {\n resourceType: \"hr_auto_close_rule\",\n tableName: \"auto_close_rule\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Auto Close Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_careers_portal: {\n resourceType: \"hr_careers_portal\",\n tableName: \"careers_portal\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Careers Portal\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_crew: {\n resourceType: \"hr_crew\",\n tableName: \"crew\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Crew\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_deduction_code: {\n resourceType: \"hr_deduction_code\",\n tableName: \"deduction_code\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Deduction Code\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_department: {\n resourceType: \"hr_department\",\n tableName: \"department\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Department\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_earning_code: {\n resourceType: \"hr_earning_code\",\n tableName: \"earning_code\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Earning Code\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_holiday_calendar: {\n resourceType: \"hr_holiday_calendar\",\n tableName: \"holiday_calendar\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Holiday Calendar\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_interview_kit: {\n resourceType: \"hr_interview_kit\",\n tableName: \"interview_kit\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Interview Kit\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_job_title: {\n resourceType: \"hr_job_title\",\n tableName: \"job_title\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Job Title\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_jurisdiction_rule_org_decision: {\n resourceType: \"hr_jurisdiction_rule_org_decision\",\n tableName: \"jurisdiction_rule_org_decision\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Jurisdiction Rule Org Decision\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_location: {\n resourceType: \"hr_location\",\n tableName: \"location\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Location\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_overtime_alert_rule: {\n resourceType: \"hr_overtime_alert_rule\",\n tableName: \"overtime_alert_rule\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Overtime Alert Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_pay_group: {\n resourceType: \"hr_pay_group\",\n tableName: \"pay_group\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Pay Group\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_posting: {\n resourceType: \"hr_posting\",\n tableName: \"posting\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Posting\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_provider_binding: {\n resourceType: \"hr_provider_binding\",\n tableName: \"provider_binding\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Provider Binding\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_recalculation_batch: {\n resourceType: \"hr_recalculation_batch\",\n tableName: \"recalculation_batch\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Recalculation Batch\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_schedule: {\n resourceType: \"hr_schedule\",\n tableName: \"schedule\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Schedule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_schedule_guidance: {\n resourceType: \"hr_schedule_guidance\",\n tableName: \"schedule_guidance\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Schedule Guidance\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_schedule_template: {\n resourceType: \"hr_schedule_template\",\n tableName: \"schedule_template\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Schedule Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_workflow_definition: {\n resourceType: \"hr_workflow_definition\",\n tableName: \"workflow_definition\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Workflow Definition\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n iam_api_key: {\n resourceType: \"iam_api_key\",\n tableName: \"api_keys\",\n schemaName: \"iam\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Iam Api Key\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n invitation_code: {\n resourceType: \"invitation_code\",\n tableName: \"invitation_codes\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Invitation Code\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n invitation_request: {\n resourceType: \"invitation_request\",\n tableName: \"invitation_requests\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Invitation Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n io_comment: {\n resourceType: \"io_comment\",\n tableName: \"io_comment\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Io Comment\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n io_import: {\n resourceType: \"io_import\",\n tableName: \"io_import\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Io Import\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n io_outbox: {\n resourceType: \"io_outbox\",\n tableName: \"io_outbox\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Io Outbox\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n item_mastery: {\n resourceType: \"item_mastery\",\n tableName: \"item_mastery\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Item Mastery\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_alert: {\n resourceType: \"kg_alert\",\n tableName: \"kg_alerts\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Alert\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_sweep_queue: {\n resourceType: \"kg_sweep_queue\",\n tableName: \"kg_sweep_queue\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Sweep Queue\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_sweep_run: {\n resourceType: \"kg_sweep_run\",\n tableName: \"kg_sweep_run\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Sweep Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_sweep_state: {\n resourceType: \"kg_sweep_state\",\n tableName: \"kg_sweep_state\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Sweep State\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_value_match: {\n resourceType: \"kg_value_match\",\n tableName: \"kg_value_matches\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Value Match\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n league_membership: {\n resourceType: \"league_membership\",\n tableName: \"league_membership\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"League Membership\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n library_doc: {\n resourceType: \"library_doc\",\n tableName: \"library_docs\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Library Doc\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n /**\n * A user/org-created mandate (`mandate.definition`). Sharing NEVER moves it: a person or\n * organization share is an iam.permissions grant, \"Anyone\" is visibility public, and the\n * creator keeps ownership (mandate_share_without_move.sql, 2026-09-25). No id route —\n * mandate pages are addressed by key — so `urlPathTemplate` stays honestly empty.\n */\n mandate: {\n resourceType: \"mandate\",\n tableName: \"definition\",\n schemaName: \"mandate\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Mandate\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n mandate_binding: {\n resourceType: \"mandate_binding\",\n tableName: \"binding\",\n schemaName: \"mandate\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Mandate Binding\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n mandate_treatment: {\n resourceType: \"mandate_treatment\",\n tableName: \"treatment\",\n schemaName: \"mandate\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Mandate Treatment\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n media_catalog_setting: {\n resourceType: \"media_catalog_setting\",\n tableName: \"catalog_setting\",\n schemaName: \"media\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Media Catalog Setting\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n media_source_library: {\n resourceType: \"media_source_library\",\n tableName: \"source_library\",\n schemaName: \"media\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Media Source Library\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n meet_call_invite: {\n resourceType: \"meet_call_invite\",\n tableName: \"meet_call_invites\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Meet Call Invite\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n meet_meeting: {\n resourceType: \"meet_meeting\",\n tableName: \"meet_meetings\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Meeting\",\n urlPathTemplate: \"/meet/{id}\",\n rlsUsesHasPermission: true,\n },\n merge_field_provenance: {\n resourceType: \"merge_field_provenance\",\n tableName: \"merge_field_provenance\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Merge Field Provenance\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ner_shadow: {\n resourceType: \"ner_shadow\",\n tableName: \"ner_canonicalizer_shadow\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ner Shadow\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification: {\n resourceType: \"notification\",\n tableName: \"notification\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification_event_override: {\n resourceType: \"notification_event_override\",\n tableName: \"notification_event_override\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification Event Override\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification_event_type: {\n resourceType: \"notification_event_type\",\n tableName: \"notification_event_type\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification Event Type\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification_preference: {\n resourceType: \"notification_preference\",\n tableName: \"notification_preference\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification Preference\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ops_proof_check: {\n resourceType: \"ops_proof_check\",\n tableName: \"proof_check\",\n schemaName: \"ops\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ops Proof Check\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ops_proof_scenario: {\n resourceType: \"ops_proof_scenario\",\n tableName: \"proof_scenario\",\n schemaName: \"ops\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ops Proof Scenario\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n org_member_control: {\n resourceType: \"org_member_control\",\n tableName: \"org_member_controls\",\n schemaName: \"iam\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Org Member Control\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n organization: {\n resourceType: \"organization\",\n tableName: \"organizations\",\n schemaName: \"iam\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Organization\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n output_feedback: {\n resourceType: \"output_feedback\",\n tableName: \"output_feedback\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Output Feedback\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n page_extraction_job: {\n resourceType: \"page_extraction_job\",\n tableName: \"page_extraction_jobs\",\n schemaName: \"docproc\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Page Extraction Job\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n page_extraction_page_run: {\n resourceType: \"page_extraction_page_run\",\n tableName: \"page_extraction_page_runs\",\n schemaName: \"docproc\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Page Extraction Page Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n pc_article: {\n resourceType: \"pc_article\",\n tableName: \"pc_articles\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Pc Article\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n pc_episode: {\n resourceType: \"pc_episode\",\n tableName: \"pc_episodes\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Pc Episode\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n pc_show: {\n resourceType: \"pc_show\",\n tableName: \"pc_shows\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Pc Show\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n pc_studio_run: {\n resourceType: \"pc_studio_run\",\n tableName: \"pc_studio_runs\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Pc Studio Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n plan_entity: {\n resourceType: \"plan_entity\",\n tableName: \"entity\",\n schemaName: \"plan\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Plan Entity\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n plan_profile: {\n resourceType: \"plan_profile\",\n tableName: \"profile\",\n schemaName: \"plan\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Plan Profile\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n platform_action_request: {\n resourceType: \"platform_action_request\",\n tableName: \"action_request\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Platform Action Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n platform_outcome_event: {\n resourceType: \"platform_outcome_event\",\n tableName: \"outcome_event\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Platform Outcome Event\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n platform_saved_view: {\n resourceType: \"platform_saved_view\",\n tableName: \"saved_view\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Platform Saved View\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n platform_share_link: {\n resourceType: \"platform_share_link\",\n tableName: \"share_links\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Platform Share Link\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n podcast_race: {\n resourceType: \"podcast_race\",\n tableName: \"pc_race\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Podcast Race\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n product_capture_item: {\n resourceType: \"product_capture_item\",\n tableName: \"product_capture_item\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Product Capture Item\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n purpose: {\n resourceType: \"purpose\",\n tableName: \"purpose\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Purpose\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n research_context_bundle: {\n resourceType: \"research_context_bundle\",\n tableName: \"rs_context_bundle\",\n schemaName: \"research\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Research Context Bundle\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n scope_suggestion: {\n resourceType: \"scope_suggestion\",\n tableName: \"scope_suggestions\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Scope Suggestion\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_engine_schedule: {\n resourceType: \"seo_engine_schedule\",\n tableName: \"engine_schedule\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Engine Schedule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_gsc_dig_rule: {\n resourceType: \"seo_gsc_dig_rule\",\n tableName: \"gsc_dig_rule\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Gsc Dig Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_keyword_class_rule: {\n resourceType: \"seo_keyword_class_rule\",\n tableName: \"keyword_class_rule\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Keyword Class Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n // A news / coverage monitor (aidream migration 1411d): shared directly or by link (name only);\n // its stories follow it as components. No page of its own yet, so no URL template.\n seo_coverage_tracker: {\n resourceType: \"seo_coverage_tracker\",\n tableName: \"coverage_tracker\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"News Monitor\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_source_request: {\n resourceType: \"seo_source_request\",\n tableName: \"source_request\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Source Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_story_angle: {\n resourceType: \"seo_story_angle\",\n tableName: \"story_angle\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Story Angle\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n sms_consent: {\n resourceType: \"sms_consent\",\n tableName: \"sms_consent\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sms Consent\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n sms_notification: {\n resourceType: \"sms_notification\",\n tableName: \"sms_notifications\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sms Notification\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n sms_notification_preference: {\n resourceType: \"sms_notification_preference\",\n tableName: \"sms_notification_preferences\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sms Notification Preference\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n sms_phone_number: {\n resourceType: \"sms_phone_number\",\n tableName: \"sms_phone_numbers\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sms Phone Number\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n studio_recording_chunks: {\n resourceType: \"studio_recording_chunks\",\n tableName: \"studio_recording_chunks\",\n schemaName: \"transcripts\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Studio Recording Chunks\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n studio_run: {\n resourceType: \"studio_run\",\n tableName: \"studio_runs\",\n schemaName: \"transcripts\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Studio Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_attempt: {\n resourceType: \"study_attempt\",\n tableName: \"study_attempt\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Attempt\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_goal: {\n resourceType: \"study_goal\",\n tableName: \"study_goal\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Goal\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_plan: {\n resourceType: \"study_plan\",\n tableName: \"study_plan\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Plan\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_plan_block: {\n resourceType: \"study_plan_block\",\n tableName: \"study_plan_block\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Plan Block\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_plan_day: {\n resourceType: \"study_plan_day\",\n tableName: \"study_plan_day\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Plan Day\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_session: {\n resourceType: \"study_session\",\n tableName: \"study_session\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Session\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n udt_dataset_template: {\n resourceType: \"udt_dataset_template\",\n tableName: \"udt_dataset_templates\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Udt Dataset Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ui_surface_agent_pref: {\n resourceType: \"ui_surface_agent_pref\",\n tableName: \"ui_surface_agent_pref\",\n schemaName: \"ui\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ui Surface Agent Pref\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ui_surface_config: {\n resourceType: \"ui_surface_config\",\n tableName: \"ui_surface_config\",\n schemaName: \"ui\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ui Surface Config\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_achievement: {\n resourceType: \"user_achievement\",\n tableName: \"user_achievements\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Achievement\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_email_preference: {\n resourceType: \"user_email_preference\",\n tableName: \"user_email_preferences\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Email Preference\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_markdown_sample: {\n resourceType: \"user_markdown_sample\",\n tableName: \"user_markdown_samples\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Markdown Sample\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_memory: {\n resourceType: \"user_memory\",\n tableName: \"user_memory\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Memory\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_profile: {\n resourceType: \"user_profile\",\n tableName: \"profiles\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Profile\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_stat: {\n resourceType: \"user_stat\",\n tableName: \"user_stats\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Stat\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_surface_state: {\n resourceType: \"user_surface_state\",\n tableName: \"user_surface_state\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Surface State\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_capture: {\n resourceType: \"wbx_capture\",\n tableName: \"wbx_capture\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Capture\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_demo: {\n resourceType: \"wbx_demo\",\n tableName: \"wbx_demo\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Demo\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_highlight: {\n resourceType: \"wbx_highlight\",\n tableName: \"wbx_highlight\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Highlight\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_pattern: {\n resourceType: \"wbx_pattern\",\n tableName: \"wbx_pattern\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Pattern\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_screenshot: {\n resourceType: \"wbx_screenshot\",\n tableName: \"wbx_screenshot\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Screenshot\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_seo_audit: {\n resourceType: \"wbx_seo_audit\",\n tableName: \"wbx_seo_audit\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Seo Audit\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n web_youtube_video: {\n resourceType: \"web_youtube_video\",\n tableName: \"youtube_video\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Web Youtube Video\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow_comparison: {\n resourceType: \"workflow_comparison\",\n tableName: \"comparison\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Comparison\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_term_list: {\n resourceType: \"agent_term_list\",\n tableName: \"term_list\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Term List\",\n urlPathTemplate: \"/resources/term-lists\",\n rlsUsesHasPermission: true,\n },\n document: {\n resourceType: \"document\",\n tableName: \"document\",\n schemaName: \"content\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Document\",\n urlPathTemplate: \"/documents/{id}\",\n rlsUsesHasPermission: true,\n },\n files_sync_mapping: {\n resourceType: \"files_sync_mapping\",\n tableName: \"sync_mappings\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sync Mapping\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_suggestion_ack: {\n resourceType: \"kg_suggestion_ack\",\n tableName: \"kg_suggestion_ack\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"KG Suggestion Ack\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n mcp_user_conn: {\n resourceType: \"mcp_user_conn\",\n tableName: \"mcp_user_conn\",\n schemaName: \"tool\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"MCP user connection\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification_channel_preference: {\n resourceType: \"notification_channel_preference\",\n tableName: \"notification_channel_preference\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification Channel Preference\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_reminder_context: {\n resourceType: \"study_reminder_context\",\n tableName: \"study_reminder_context\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Reminder Context\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_reminder_delivery: {\n resourceType: \"study_reminder_delivery\",\n tableName: \"study_reminder_delivery\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Reminder Delivery\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n} as const satisfies Record<string, ShareableResourceEntry>;\n\n/**\n * Union of all valid resource-type tokens. Exactly mirrors the registry keys.\n */\nexport type ResourceType = keyof typeof SHAREABLE_RESOURCE_REGISTRY;\n\n/** Ordered list of resource-type tokens (useful for tests, dropdowns, etc.) */\nexport const RESOURCE_TYPES = Object.keys(\n SHAREABLE_RESOURCE_REGISTRY,\n) as ResourceType[];\n\n/**\n * Look up a registry entry by canonical entity token. A physical table name is\n * never accepted as an identity key: names such as `definition` repeat across\n * schemas, so a bare-name lookup cannot be made deterministic.\n */\nexport function getShareableResource(\n resourceType: string,\n): ShareableResourceEntry | undefined {\n if (resourceType in SHAREABLE_RESOURCE_REGISTRY) {\n return SHAREABLE_RESOURCE_REGISTRY[resourceType as ResourceType];\n }\n return undefined;\n}\n\n/**\n * Resolve a resource type to its PHYSICAL Postgres table name. Throws if the\n * type isn't registered. NOTE: for `iam.permissions.resource_type` filters and\n * share-RPC arguments use the TOKEN (`resourceType`) instead — this returns the\n * physical table, which differs from the token on canonical tables.\n */\nexport function resolveTableName(resourceType: string): string {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource type: ${resourceType}. Register it in platform.shareable_resource_registry (see utils/permissions/registry.ts and features/sharing/FEATURE.md).`,\n );\n }\n return entry.tableName;\n}\n\n/**\n * Resolve a resource type to its canonical ENTITY TOKEN — the value stored in\n * `iam.permissions.resource_type` and passed to the share RPCs. Throws if the\n * type isn't registered. Use this (never resolveTableName) for any\n * permissions/grant query or RPC call.\n */\nexport function resolveResourceToken(resourceType: string): string {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource type: ${resourceType}. Register it in platform.shareable_resource_registry (see utils/permissions/registry.ts and features/sharing/FEATURE.md).`,\n );\n }\n return entry.resourceType;\n}\n\n/** Human-readable label for a resource type (replaces the legacy map). */\nexport function getResourceTypeLabel(resourceType: string): string {\n return getShareableResource(resourceType)?.displayLabel ?? resourceType;\n}\n\n/**\n * Build the share path for a resource. Returns a relative path, or `null` when\n * we genuinely cannot open this resource — the caller must handle null and say\n * so honestly rather than rendering a broken link.\n *\n * THE DOOR LAW, and specifically the \"one canonical path per operation\" rule:\n * route truth is the ENTITY REGISTRY (`features/scopes/registry`), so that is\n * consulted first. `url_path_template` in `platform.shareable_resource_registry`\n * is a second, DB-side route authority that had drifted badly — 24 of 73 active\n * rows advertised routes that do not exist (`/apps/{id}` when the real route is\n * `/applets/manage/{id}`; `/skills/{id}`, `/workflows/{id}`, `/quizzes/{id}`,\n * `/canvas/{id}`, `/code/files/{id}`, `/runs/{id}`, `/scopes/{id}` …). Audited\n * and corrected against the live `app/` tree on 2026-08-14\n * (`migrations/sharing_registry_route_truth_d138.sql`): every row now either\n * points at a real route or is EMPTY, and empty means \"no signed-in destination\"\n * — this function returns null and the caller renders no link.\n *\n * It is now only the FALLBACK, used for tokens the entity registry doesn't\n * cover. **Never add a plausible-looking path to a registry row to make a link\n * appear**; that guesswork IS defect D138.\n *\n * Two guesses were removed, both of which produced 404s that reached other\n * people:\n * - the `/${resourceType}/${resourceId}` fabrication for unregistered types;\n * - templates that still contain a placeholder after substitution — either a\n * non-id key (`{slug}`) or a second distinct segment the template can't\n * express (`/workflows/{id}/triggers/{id}`).\n */\nexport function getResourceSharePath(\n resourceType: string,\n resourceId: string,\n): string | null {\n const registryHref = resolveEntityHref(resourceType, resourceId);\n if (registryHref) return registryHref;\n\n // A REGISTERED token with no `hrefFor` is a decision, not a gap: we looked and\n // there is no route (`workflow` lives in workflow-studio; `skill` is\n // admin-only). Falling through to the template here would hand back exactly\n // the stale `/workflows/{id}` and `/skills/{id}` this function exists to stop.\n // Only a resource type the entity registry does not know at all may fall back.\n if (isKnownEntity(resourceType)) return null;\n\n const entry = getShareableResource(resourceType);\n if (!entry?.urlPathTemplate) return null;\n\n const path = entry.urlPathTemplate.replace(\"{id}\", resourceId);\n return /\\{[^}]*\\}/.test(path) ? null : path;\n}\n","/**\n * The ONE permission-level ladder.\n *\n * Every rank map, label map, ordered array and level union in the app derives\n * from `PERMISSION_LEVELS` below. Before this module existed the ladder was\n * hard-coded in eight places as `viewer | editor | admin`, so a fourth level\n * would have been missing from most of them — and missing SILENTLY: a rank\n * lookup returned `undefined`, `undefined >= 2` is `false`, and the holder of\n * the new level was refused with no message anywhere (law 4, nothing fails\n * silently). `getPermissionLevelLabel` was worse: it returned `undefined` and\n * the screen rendered a blank string where the level should be.\n *\n * ## Code ladder vs database enum — deliberately different widths\n *\n * `PERMISSION_LEVELS` (the CODE ladder) is the superset and includes\n * `commenter`. `DB_PERMISSION_LEVELS` (the DATABASE enum, read at runtime from\n * the generated `Constants`, never hand-typed) is what `public.permission_level`\n * actually holds today: `viewer, editor, admin`. `commenter` is NOT there yet.\n *\n * That gap is the whole point and it is safe in one direction only:\n *\n * - READING / COMPARING / LABELING a level: always use the code ladder. It\n * tolerates `commenter` the moment the database gains it, with no code change\n * and no silent refusal in between. Nothing breaks while the value never\n * arrives — the extra rank and label simply go unused.\n * - WRITING a level to the database, or OFFERING it in a picker: narrow through\n * `toDbPermissionLevel` / `DB_PERMISSION_LEVELS` first. Sending `commenter`\n * to Postgres today fails with `invalid input value for enum\n * public.permission_level`, so the ladder refuses it HERE, by name, with the\n * remedy — rather than letting a picker offer a value the save will reject.\n *\n * When `ALTER TYPE public.permission_level ADD VALUE 'commenter' BEFORE 'editor'`\n * is applied and `pnpm db-types` regenerated, `DB_PERMISSION_LEVELS` widens on\n * its own and every picker driven by it gains the option with no further edit.\n *\n * Doctrine: the access levels are `viewer` · `commenter` · `editor` · `admin`\n * (AI Matrx Data Doctrine R18, 2026-09-10;\n * common-docs/systems/platform/access/DECISIONS.md).\n * Guard: `utils/permissions/__tests__/permission-levels.test.ts` fails if any\n * rank map, label map or ordered array omits a level.\n */\n\nimport type { DbPermissionLevel, PermissionLevel } from \"@ai-matrx/data/access\";\nimport { DB_PERMISSION_LEVELS, PERMISSION_LEVEL_RANK as PACKAGE_RANK } from \"@ai-matrx/data/access\";\n\n// ONE-LADDER (Arman 2026-10-10): the ladder is View · Comment · Edit · Full access and lives in the\n// package (`@ai-matrx/data/access`, four levels since 0.8.47); nothing here overrides it.\n// Named, never `export *`: a star re-export of a sibling compiles to a `__reExport(..., star)` that runs\n// before the sibling's import binding exists under a CommonJS transform (jest), and drags the whole\n// access section through this module.\nexport {\n PERMISSION_LEVELS,\n isPermissionLevel,\n PERMISSION_LEVEL_LABELS,\n PERMISSION_LEVEL_HINTS,\n PERMISSION_LEVEL_SHORT_LABELS,\n DB_PERMISSION_LEVELS,\n isDbPermissionLevel,\n toDbPermissionLevel,\n} from \"@ai-matrx/data/access\";\nexport type { DbPermissionLevel, PermissionLevel } from \"@ai-matrx/data/access\";\n\n// normalizePermissionLevel / parsePermissionLevel are the ladder's own (one implementation, identical answers for\n// every input; `edit_content` reads as Edit, an unrecognised value is logged loudly and read as null).\nexport { normalizePermissionLevel, parsePermissionLevel } from \"@ai-matrx/data/access\";\n\n/** The levels a picker may offer: what the database stores, never the retired `edit_content`. */\nexport const OFFERED_DB_PERMISSION_LEVELS: readonly DbPermissionLevel[] = DB_PERMISSION_LEVELS;\n\n/** Rank of every level; a stray stored `edit_content` ranks as Edit so old data never crashes. */\nexport const PERMISSION_LEVEL_RANK: Record<PermissionLevel, number> & { edit_content: number } = {\n ...PACKAGE_RANK,\n edit_content: PACKAGE_RANK.editor,\n};\n\nexport function permissionLevelRank(level: PermissionLevel): number {\n const rank = (PERMISSION_LEVEL_RANK as Record<string, number>)[level];\n if (rank === undefined) {\n console.error(`[permissions] no rank for permission level ${JSON.stringify(level)}. Add it to PERMISSION_LEVELS in @ai-matrx/data/access (permissionLevels.ts).`);\n return Number.NaN;\n }\n return rank;\n}\n","/**\n * Permission System Types\n *\n * The single source of truth for which resource types are shareable lives in\n * the database table `shareable_resource_registry`, mirrored in TypeScript by\n * `./registry.ts`. Do NOT add resource types here — add them to the registry.\n */\n\nexport type { ShareableResourceEntry, ResourceType } from \"./registry\";\nexport {\n SHAREABLE_RESOURCE_REGISTRY,\n RESOURCE_TYPES,\n getShareableResource,\n resolveTableName,\n resolveResourceToken,\n getResourceTypeLabel,\n getResourceSharePath,\n} from \"./registry\";\n\nimport type { ResourceType } from \"./registry\";\n\n// ============================================================================\n// Core Permission Types\n// ============================================================================\n\n// The access levels are `viewer` · `commenter` · `editor` · `admin` — one vocabulary everywhere\n// (AI Matrx Data Doctrine R18, 2026-09-10, recorded in\n// common-docs/systems/platform/access/DECISIONS.md). The ladder is declared ONCE in `./levels.ts`\n// and re-exported here; `commenter` is in the code ladder already and tolerated everywhere, while\n// the live `public.permission_level` enum still holds only `viewer, editor, admin` — see that\n// module's header for which side of the gap each call site belongs on.\n// Register: /projects/data-doctrine-adoption/REGISTER.md#DD-050\nexport type { PermissionLevel, DbPermissionLevel } from \"./levels\";\nexport {\n PERMISSION_LEVELS,\n PERMISSION_LEVEL_RANK,\n PERMISSION_LEVEL_LABELS,\n PERMISSION_LEVEL_SHORT_LABELS,\n DB_PERMISSION_LEVELS,\n isPermissionLevel,\n isDbPermissionLevel,\n toDbPermissionLevel,\n parsePermissionLevel,\n permissionLevelRank,\n} from \"./levels\";\n\nimport {\n PERMISSION_LEVELS,\n PERMISSION_LEVEL_LABELS,\n permissionLevelRank,\n type PermissionLevel,\n} from \"./levels\";\n\n/**\n * Complete permission record from database\n */\nexport interface Permission {\n id: string;\n resourceType: ResourceType;\n resourceId: string;\n grantedToUserId?: string | null | undefined;\n grantedToOrganizationId?: string | null | undefined;\n isPublic?: boolean | undefined;\n permissionLevel: PermissionLevel;\n createdAt?: Date | undefined;\n createdBy?: string | undefined;\n}\n\n/**\n * Enriched permission with user/org details for display\n */\nexport interface PermissionWithDetails extends Permission {\n grantedToUser?: undefined | {\n id: string;\n email: string;\n displayName?: string | undefined;\n avatarUrl?: string | undefined;\n /** Not a member of the thing's organization (the store's answer, `get_resource_permissions`): shown as Guest. */\n isGuest?: boolean | undefined;\n };\n grantedToOrganization?: undefined | {\n id: string;\n name: string;\n slug: string;\n logoUrl?: string | undefined;\n };\n createdByUser?: {\n id: string;\n email: string;\n displayName?: string | undefined;\n };\n}\n\n// ============================================================================\n// Share Operation Types\n// ============================================================================\n\nexport interface ShareWithUserOptions {\n resourceType: ResourceType;\n resourceId: string;\n userId: string;\n permissionLevel: PermissionLevel;\n /**\n * Optional human title of the resource, used for the in-app DM notification\n * card (\"X shared '<title>' with you\"). Falls back to the type label.\n */\n resourceName?: string | undefined;\n /**\n * The organization the SHARED OBJECT lives in, from the page that opened the dialog (the\n * object's own resolver — never the active organization). The in-app notification is filed\n * there. Absent, the notification is filed in the organization the person is working in, and\n * when none is picked it is skipped and said — it never raises \"Which workspace is this for?\"\n * (lane ACCESS-FIX-18, VERIFIER-18 H4).\n */\n organizationId?: string | null | undefined;\n}\n\n/** Organization AVAILABILITY (org configuration), never a share — see grantOrgAvailability. */\nexport interface OrgAvailabilityOptions {\n resourceType: ResourceType;\n resourceId: string;\n organizationId: string;\n /**\n * Explicit level. Omit to let the server apply the org module's\n * `default_permission` (falls back to 'viewer'). Pickers pass a level; the\n * \"contribute\" flow omits it.\n */\n permissionLevel?: PermissionLevel | undefined;\n}\n\nexport interface MakePublicOptions {\n resourceType: ResourceType;\n resourceId: string;\n permissionLevel?: PermissionLevel | undefined;\n}\n\nexport interface UpdatePermissionOptions {\n resourceType: ResourceType;\n resourceId: string;\n userId?: string | undefined;\n organizationId?: string | undefined;\n isPublic?: boolean | undefined;\n newLevel: PermissionLevel;\n}\n\nexport interface RevokeAccessOptions {\n resourceType: ResourceType;\n resourceId: string;\n userId?: string | undefined;\n organizationId?: string | undefined;\n isPublic?: boolean | undefined;\n}\n\n// ============================================================================\n// Permission Check Types\n// ============================================================================\n\nexport interface PermissionCheckResult {\n hasAccess: boolean;\n level?: PermissionLevel | undefined;\n isOwner: boolean;\n reason?: string | undefined;\n}\n\nexport interface CheckPermissionOptions {\n resourceType: ResourceType;\n resourceId: string;\n requiredLevel?: PermissionLevel | undefined;\n}\n\n// ============================================================================\n// Resource Owner Types\n// ============================================================================\n\nexport interface OwnedResource {\n id: string;\n user_id: string;\n [key: string]: unknown;\n}\n\nexport interface OwnerCheckResult {\n isOwner: boolean;\n ownerId: string;\n}\n\n// ============================================================================\n// Sharing UI Types\n// ============================================================================\n\nexport type ShareTargetType = \"user\" | \"organization\" | \"public\";\n\nexport interface SharingState {\n isOpen: boolean;\n activeTab: ShareTargetType;\n permissions: PermissionWithDetails[];\n loading: boolean;\n error: string | null;\n searchQuery: string;\n selectedPermissionLevel: PermissionLevel;\n}\n\nexport interface ShareActionResult {\n success: boolean;\n message?: string | undefined;\n error?: string | undefined;\n permission?: Permission | undefined;\n}\n\n// ============================================================================\n// Permission Helpers\n// ============================================================================\n\n/**\n * Check if a permission level satisfies a required level\n */\nexport function satisfiesPermissionLevel(\n current: PermissionLevel,\n required: PermissionLevel,\n): boolean {\n return permissionLevelRank(current) >= permissionLevelRank(required);\n}\n\n/**\n * Get all permission levels equal to or higher than the given level\n */\nexport function getPermissionLevelsAtOrAbove(\n level: PermissionLevel,\n): PermissionLevel[] {\n const levelIndex = PERMISSION_LEVELS.indexOf(level);\n return [...PERMISSION_LEVELS].slice(levelIndex);\n}\n\n/**\n * Get display label for permission level\n */\nexport function getPermissionLevelLabel(level: PermissionLevel): string {\n // Never `undefined` for a known level, and never a blank string on screen for\n // an unknown one — an unrecognised level names itself instead (law 4).\n return PERMISSION_LEVEL_LABELS[level] ?? `Unknown level (${level})`;\n}\n\n/**\n * Validate permission data\n */\nexport function validatePermission(permission: Partial<Permission>): boolean {\n if (!permission.resourceType) {\n throw new Error(\"Resource type is required\");\n }\n if (!permission.resourceId) {\n throw new Error(\"Resource ID is required\");\n }\n if (!permission.permissionLevel) {\n throw new Error(\"Permission level is required\");\n }\n\n const targetsSet = [\n !!permission.grantedToUserId,\n !!permission.grantedToOrganizationId,\n !!permission.isPublic,\n ].filter(Boolean).length;\n\n if (targetsSet !== 1) {\n throw new Error(\n \"Exactly one of grantedToUserId, grantedToOrganizationId, or isPublic must be set\",\n );\n }\n return true;\n}\n\n// ============================================================================\n// Error Types\n// ============================================================================\n\nexport class PermissionError extends Error {\n constructor(\n message: string,\n public code: string,\n public details?: unknown | undefined,\n ) {\n super(message);\n this.name = \"PermissionError\";\n }\n}\n\nexport enum PermissionErrorCode {\n NOT_FOUND = \"PERMISSION_NOT_FOUND\",\n ALREADY_EXISTS = \"PERMISSION_ALREADY_EXISTS\",\n INVALID_LEVEL = \"INVALID_PERMISSION_LEVEL\",\n INVALID_TARGET = \"INVALID_SHARE_TARGET\",\n UNAUTHORIZED = \"UNAUTHORIZED\",\n DATABASE_ERROR = \"DATABASE_ERROR\",\n VALIDATION_ERROR = \"VALIDATION_ERROR\",\n}\n","/**\n * THE PUBLIC LANE — the ONE list of resource types that have a real\n * anonymous, indexable page at `/p/e/[resourceType]/[id]`.\n *\n * Why this module exists: the list used to live as a private const inside the\n * server loader, so the SHARE UI could not know whether flipping a resource to\n * `visibility='public'` actually produced a reachable page. It therefore told\n * every owner \"anyone with the link can access this\" — for a brand, a site, a\n * workflow, anything — while no such link existed. A share surface that claims\n * access it cannot deliver is a defect (features/sharing/FEATURE.md: \"a share\n * surface that can't act must say why\").\n *\n * Being public is a DATA state (the `pub_read` RLS policy). Having a public\n * PAGE is a product decision, made here. A type joins this lane only when it\n * has a public renderer and genuinely belongs in the SEO/community lane — a\n * public `dm_conversation` or `wc_claim` must never auto-publish to an indexed\n * page. For everything else, anonymous access is the share-link lane\n * (`platform.share_links` → `/s/[token]`, noindex).\n */\n\n/**\n * THE PUBLIC COLUMN LANE — for every type in the lane, the EXACT columns the\n * anonymous viewer reads from its base row.\n *\n * Why names and not `select(\"*\")` (DD-186): a signed-out visitor may read only\n * the columns a relation declares to `anon`, and these tables no longer answer\n * `*` to the publishable key. `workbench.notes` and `agent.message_template`\n * both carry `created_by`, `updated_by`, `organization_id`, `metadata` and\n * `version`, which are nobody's business on an indexed public page — the loader\n * already refused to render them, but PostgREST was serving them to the browser\n * anyway, one HTTP round trip before the projection threw them away.\n *\n * `visibility` is in every list on purpose: the loader re-checks it in JS after\n * the read, and PostgREST cannot even filter on a column the role cannot select.\n *\n * Adding a type here means checking its columns against\n * matrx-frontend `lib/security/public-exposure.ts#ANON_COLUMN_SURFACE`; asking\n * for a column `anon` cannot read returns 42501 for the whole request, which\n * `pnpm check:anon-column-surface` is there to catch before a user does.\n *\n * `fc_set` is absent by design — it never takes this path. Its whole read is a\n * SECURITY DEFINER RPC (`get_public_flashcard_set`) that projects its own\n * columns server-side.\n */\nexport const PUBLIC_LANE_COLUMNS: Readonly<Record<string, readonly string[]>> = {\n fc_set: [],\n // One row of a table (access ladder T-40) — like `fc_set`, its whole read is a SECURITY DEFINER\n // door (`public.record_public_view`) that projects its own fields server-side.\n record: [],\n note: [\"id\", \"label\", \"content\", \"tags\", \"created_at\", \"updated_at\", \"visibility\"],\n message_template: [\n \"id\", \"label\", \"content\", \"role\", \"tags\", \"created_at\", \"updated_at\", \"visibility\",\n ],\n};\n\n/** Types served by the indexable public lane. Add only with a public renderer. */\nexport const PUBLIC_LANE_TYPES: ReadonlySet<string> = new Set(\n Object.keys(PUBLIC_LANE_COLUMNS),\n);\n\n/**\n * The columns the anonymous viewer may ask PostgREST for, as a `select` string.\n * Never falls back to `\"*\"`: a type in the lane with no declared columns is a\n * programming error, and returning `\"*\"` would quietly re-open the surface this\n * register exists to close.\n */\nexport function publicLaneSelect(resourceType: string): string {\n const columns = PUBLIC_LANE_COLUMNS[resourceType];\n if (!columns?.length) {\n throw new Error(\n `[matrx] publicLaneSelect(\"${resourceType}\"): the public lane declares no ` +\n `columns for this type. Add them to PUBLIC_LANE_COLUMNS in ` +\n `utils/permissions/publicLane.ts — a signed-out read must name its ` +\n `columns (DD-186), and \"*\" is refused by the grant.`,\n );\n }\n return columns.join(\",\");\n}\n\n/** Does `visibility='public'` give this type a reachable anonymous page? */\nexport function hasPublicPage(resourceType: string): boolean {\n return PUBLIC_LANE_TYPES.has(resourceType);\n}\n\n/**\n * The absolute public URL for a type in the lane, or null when the type has no\n * public page. Never fabricate a URL for a type outside the lane — that is the\n * exact lie this module was created to kill.\n */\nexport function publicResourceUrl(\n resourceType: string,\n id: string,\n): string | null {\n if (!hasPublicPage(resourceType)) return null;\n const base =\n process.env.NEXT_PUBLIC_APP_URL ||\n (typeof window !== \"undefined\" ? window.location.origin : \"\");\n return `${base}/p/e/${resourceType}/${id}`;\n}\n","/**\n * Share links — the canonical no-login sharing service.\n *\n * A share link is an opaque token that lets ANYONE (no sign-in) view a specific\n * resource. The token is the authorization: the anon-callable\n * `resolve_share_token` RPC (SECURITY DEFINER) bypasses `iam.has_access` and\n * returns the resource content. Minting/listing/revoking are owner-gated.\n *\n * Every write routes through a SECURITY DEFINER RPC — never touch\n * `platform.share_links` directly from the client. See\n * `migrations/share_links_canonical_system.sql` and features/sharing/FEATURE.md.\n */\nimport { shortLinkUrl } from \"@ai-matrx/kit/short-link\";\nimport { supabase } from \"./host\";\nimport type { SupabaseClient } from \"@supabase/supabase-js\";\nimport type { ResourceType } from \"./registry\";\nimport type { PermissionLevel } from \"./types\";\nimport { toDbPermissionLevel } from \"./levels\";\nimport { isJsonObject } from \"./host\";\nimport { operationFailed } from \"@ai-matrx/kit/errors\";\nimport { ensureOrgId } from \"./host\";\n\nexport interface ShareLink {\n id: string;\n token: string;\n /** Token of the /r short alias (platform.short_links) — a URL alias only, never authorization. */\n shortToken: string | null;\n permissionLevel: PermissionLevel;\n label: string | null;\n expiresAt: string | null;\n maxUses: number | null;\n useCount: number;\n isActive: boolean;\n createdAt: string | null;\n lastUsedAt: string | null;\n}\n\nexport interface ResolvedShareToken {\n success: boolean;\n /** Machine error code when success=false (not_found | revoked | expired | exhausted | gone | unknown_type). */\n error?: string | undefined;\n /** Human-readable message when success=false. */\n message?: string | undefined;\n resourceType?: string | undefined;\n resourceId?: string | undefined;\n permissionLevel?: PermissionLevel | undefined;\n displayLabel?: string | undefined;\n urlPathTemplate?: string | undefined;\n /** The resource row as JSON (internal/heavy columns stripped). */\n resource?: Record<string, unknown> | undefined;\n /**\n * What the link holder sees BENEATH the record (children inherit their\n * parent) — a per-type projection from `platform.share_link_children`, e.g.\n * a shared chat's visible messages. Null for types without one.\n */\n children?: Record<string, unknown> | null | undefined;\n}\n\n/** What \"Publish to the web\" writes for a type (access ladder T-13; `get_share_capabilities`). */\nexport type PublishLane = \"published_to_web\" | \"card\" | \"boolean\";\n\nexport interface ShareCapabilities {\n /** Whether this type can be published to the web at all (`publishLane` is not null). */\n supportsPublic: boolean;\n /** Whether the resource type offers no-login share links (admin policy). */\n isLinkShareable: boolean;\n /**\n * The legacy boolean column behind a `boolean` publish lane; null for every other type.\n */\n publicState: { column: string; kind: \"boolean\" } | null;\n /**\n * The column naming the thing's OWN organization (`organization_id`), when its table has one.\n * The Share dialog reads it to tell a thing homed in its owner's own organization — where\n * \"My organization\" and \"Add everyone in …\" name nobody — for every kind (2026-09-26).\n */\n organizationColumn: \"organization_id\" | null;\n /** The type's level: organization · public · confidential · private; null when unregistered. */\n tableLevel: string | null;\n /**\n * The type carries the Words table's row controls — an Organization or Public table, never a\n * child. A Private, Confidential or child record has none (common-docs/policies/access-ladder.md).\n */\n rowControls: boolean;\n /** \"Shown to\" is offered for this type. */\n shownToOffered: boolean;\n /**\n * What \"Publish to the web\" writes: the row's own switch, the card's own publish (agent,\n * workflow — the body is never published), or a legacy boolean. Null: never published.\n */\n publishLane: PublishLane | null;\n /**\n * The column that marks ONE row as a child of another record (`parent_record_type` on files),\n * when the table has one. A child record carries no row control; read it per record.\n */\n rowChildColumn: string | null;\n}\n\n/**\n * What share affordances this resource type supports — drives which controls the\n * ShareModal shows (never render a toggle that would error on click). Admin-\n * editable, so read at runtime (not from the static registry mirror).\n */\nexport async function getShareCapabilities(\n resourceType: ResourceType,\n): Promise<ShareCapabilities> {\n const { data, error } = await supabase.rpc(\"get_share_capabilities\", {\n p_resource_type: resourceType,\n });\n if (error) {\n throw operationFailed(\"check this item's sharing options\", error);\n }\n if (!isJsonObject(data)) {\n throw operationFailed(\"check this item's sharing options\");\n }\n\n const lane = data.publish_lane;\n const publishLane: PublishLane | null =\n lane === \"published_to_web\" || lane === \"card\" || lane === \"boolean\" ? lane : null;\n const column = data.public_state_column;\n const publicState: ShareCapabilities[\"publicState\"] =\n publishLane === \"boolean\" &&\n data.public_state_kind === \"boolean\" &&\n typeof column === \"string\"\n ? { column, kind: \"boolean\" }\n : null;\n\n return {\n supportsPublic: publishLane !== null,\n isLinkShareable: data.is_link_shareable === true,\n publicState,\n organizationColumn:\n data.organization_column === \"organization_id\" ? \"organization_id\" : null,\n tableLevel: typeof data.table_level === \"string\" ? data.table_level : null,\n rowControls: data.row_controls === true,\n shownToOffered: data.shown_to_offered === true,\n publishLane,\n rowChildColumn:\n typeof data.row_child_column === \"string\" ? data.row_child_column : null,\n };\n}\n\ninterface CreateShareLinkOptions {\n resourceType: ResourceType;\n resourceId: string;\n permissionLevel?: PermissionLevel | undefined;\n expiresAt?: string | null | undefined;\n maxUses?: number | null | undefined;\n label?: string | null | undefined;\n}\n\n/** Build the absolute share URL for a token. */\nexport function shareLinkUrl(token: string): string {\n const base =\n process.env.NEXT_PUBLIC_APP_URL ||\n (typeof window !== \"undefined\" ? window.location.origin : \"\");\n return `${base}/s/${token}`;\n}\n\n/**\n * The URL to hand a person for a share link — the short alias when one exists\n * (auto-shorten-every-share-link, owner ruling 2026-08-29), the full /s/ URL\n * otherwise. The alias is a redirect only; the 64-hex share token stays the\n * one authorization either way.\n */\nexport function shareUrlForLink(link: Pick<ShareLink, \"token\" | \"shortToken\">): string {\n const base =\n process.env.NEXT_PUBLIC_APP_URL ||\n (typeof window !== \"undefined\" ? window.location.origin : \"\");\n return link.shortToken ? shortLinkUrl(base, link.shortToken) : shareLinkUrl(link.token);\n}\n\n/** Mint a share link for a resource (owner-only). Returns the token + URL. */\nexport async function createShareLink(\n options: CreateShareLinkOptions,\n): Promise<{\n success: boolean;\n token?: string | undefined;\n shortToken?: string | null | undefined;\n url?: string | undefined;\n error?: string | undefined;\n}> {\n try {\n const { data, error } = await supabase.rpc(\"create_share_link\", {\n p_resource_type: options.resourceType,\n p_resource_id: options.resourceId,\n // Narrowed at the write boundary — see service.ts.\n p_permission_level: toDbPermissionLevel(\n options.permissionLevel ?? \"viewer\",\n ),\n p_expires_at: options.expiresAt ?? undefined,\n p_max_uses: options.maxUses ?? undefined,\n p_label: options.label ?? undefined,\n });\n if (error) return { success: false, error: error.message };\n const res = data as {\n success: boolean;\n token?: string | undefined;\n short_token?: string | null | undefined;\n error?: string | undefined;\n };\n if (!res?.success || !res.token) {\n return { success: false, error: res?.error ?? \"Failed to create link\" };\n }\n const shortToken = res.short_token ?? null;\n return {\n success: true,\n token: res.token,\n shortToken,\n url: shareUrlForLink({ token: res.token, shortToken }),\n };\n } catch (err) {\n return {\n success: false,\n error: err instanceof Error ? err.message : \"Failed to create link\",\n };\n }\n}\n\n/** List a resource's share links (owner-only). */\nexport async function listShareLinks(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<ShareLink[]> {\n const { data, error } = await supabase.rpc(\"list_share_links\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n if (error) {\n throw operationFailed(\"load this item's share links\", error);\n }\n if (!Array.isArray(data)) {\n throw operationFailed(\"load this item's share links\");\n }\n return (data as Record<string, unknown>[]).map((r) => ({\n id: r.id as string,\n token: r.token as string,\n shortToken: (r.short_token as string | null) ?? null,\n permissionLevel: r.permission_level as PermissionLevel,\n label: (r.label as string | null) ?? null,\n expiresAt: (r.expires_at as string | null) ?? null,\n maxUses: (r.max_uses as number | null) ?? null,\n useCount: (r.use_count as number) ?? 0,\n isActive: (r.is_active as boolean) ?? false,\n createdAt: (r.created_at as string | null) ?? null,\n lastUsedAt: (r.last_used_at as string | null) ?? null,\n }));\n}\n\n/** Revoke (deactivate) a share link by id (owner-only). */\nexport async function revokeShareLink(\n linkId: string,\n): Promise<{ success: boolean; error?: string | undefined }> {\n const { data, error } = await supabase.rpc(\"revoke_share_link\", {\n p_link_id: linkId,\n });\n if (error) return { success: false, error: error.message };\n const res = data as { success: boolean; error?: string | undefined };\n return { success: !!res?.success, error: res?.error };\n}\n\nexport interface ForkResult {\n success: boolean;\n error?: string | undefined;\n /** Path to open the caller's new copy in the app. */\n path?: string | undefined;\n}\n\n/**\n * \"Save a copy & use it\" — fork a SHARED resource into the current user's own\n * account so a recipient can continue/use it (chat takeover, study a set, take a\n * quiz). Requires auth.\n *\n * `shareToken` is the no-login share-link token, passed ONLY when the viewer is\n * on the `/s/[token]` link lane. The DB RPCs authorize a link fork solely on a\n * VALID, ACTIVE token for THAT resource (SECURITY FIX — a caller-independent\n * \"any active link exists\" check previously let a stranger fork a private\n * resource the moment its owner had ever minted one link). A record published\n * to the web and explicit grants stay forkable token-less; the token is only\n * needed to authorize a private resource shared purely by no-login link. Returns\n * the path to the copy.\n */\nexport async function forkSharedResource(\n resourceType: string,\n resourceId: string,\n shareToken?: string | undefined,\n organizationId?: string | null | undefined,\n): Promise<ForkResult> {\n try {\n // WHERE THE COPY LANDS IS THE PERSON'S ANSWER, NOT OURS. The source's organization is\n // where the ORIGINAL lives — often somebody else's workspace or a public library — so\n // it cannot be reused for the copy, and until 2026-09-22 all three RPCs answered it\n // with the caller's own own organization (DEFAULT-ORG-4). `ensureOrgId` returns the\n // active organization, or opens the picker and returns what the person selects. It\n // throws `OrganizationSelectionCancelled` when they close it — \"not now\", not an error.\n const orgId = await ensureOrgId(organizationId);\n if (resourceType === \"conversation\") {\n const { data, error } = await supabase.rpc(\"fork_shared_conversation\", {\n p_conversation_id: resourceId,\n p_organization_id: orgId,\n p_token: shareToken ?? undefined,\n });\n if (error) return { success: false, error: error.message };\n const r = data as {\n success: boolean;\n error?: string | undefined;\n conversation_id?: string | undefined;\n };\n return r?.success\n ? { success: true, path: `/chat/${r.conversation_id}` }\n : { success: false, error: r?.error };\n }\n if (resourceType === \"fc_set\") {\n const { data, error } = await supabase.rpc(\"fork_shared_flashcard_set\", {\n p_set_id: resourceId,\n p_organization_id: orgId,\n p_token: shareToken ?? undefined,\n });\n if (error) return { success: false, error: error.message };\n const r = data as { success: boolean; error?: string | undefined; set_id?: string | undefined };\n return r?.success\n ? { success: true, path: `/education/flashcards/${r.set_id}` }\n : { success: false, error: r?.error };\n }\n if (resourceType === \"quiz_session\") {\n const { data, error } = await supabase.rpc(\"fork_shared_quiz\", {\n p_quiz_id: resourceId,\n p_organization_id: orgId,\n p_token: shareToken ?? undefined,\n });\n if (error) return { success: false, error: error.message };\n const r = data as { success: boolean; error?: string | undefined; quiz_id?: string | undefined };\n // `fork_shared_quiz` returns a new `education.quiz_sessions` id, and there\n // is no route that opens one — `/quizzes/<id>` does not exist, and\n // `/education/quizzes/[id]` serves `education.assessment`, a different\n // record. Forking used to drop the user on a 404 immediately after a\n // successful copy; land them on the list until a session route exists\n // (FOUND_DEFECTS D139-adjacent, tracked in the no-dead-ends sweep).\n return r?.success\n ? { success: true, path: `/education/quizzes` }\n : { success: false, error: r?.error };\n }\n return { success: false, error: \"This type can't be copied yet\" };\n } catch (e) {\n return {\n success: false,\n error: e instanceof Error ? e.message : \"Failed to save copy\",\n };\n }\n}\n\n/** Whether a resource type supports \"save a copy & use it\" (fork). */\nexport function isForkable(resourceType: string | undefined): boolean {\n return (\n resourceType === \"conversation\" ||\n resourceType === \"fc_set\" ||\n resourceType === \"quiz_session\"\n );\n}\n\n/**\n * Resolve a share token to its resource. Anon-safe. Pass a server client from a\n * Server Component (public `/s/[token]` route); defaults to the browser client.\n */\nexport async function resolveShareToken(\n token: string,\n client: SupabaseClient = supabase as unknown as SupabaseClient,\n): Promise<ResolvedShareToken> {\n const { data, error } = await client.rpc(\"resolve_share_token\", {\n p_token: token,\n });\n if (error) {\n return {\n success: false,\n error: \"not_found\",\n message: \"This link is invalid.\",\n };\n }\n const res = data as Record<string, unknown>;\n return {\n success: !!res?.success,\n error: res?.error as string | undefined,\n message: res?.message as string | undefined,\n resourceType: res?.resource_type as string | undefined,\n resourceId: res?.resource_id as string | undefined,\n permissionLevel: res?.permission_level as PermissionLevel | undefined,\n displayLabel: res?.display_label as string | undefined,\n urlPathTemplate: res?.url_path_template as string | undefined,\n resource: res?.resource as Record<string, unknown> | undefined,\n children: (res?.children as Record<string, unknown> | null | undefined) ?? null,\n };\n}\n","/**\n * Permission Service\n *\n * Every write operation routes through a SECURITY DEFINER RPC — no client ever\n * writes to the permissions table directly; row controls (\"Shown to\", \"Published to the web\")\n * are written on the resource row under RLS.\n *\n * Full RPC inventory:\n * share_resource_with_user() — grant user access (validates ownership)\n * grant_org_availability() — make a thing AVAILABLE to an organization as org configuration\n * (surface binding, library contribution). Never a share: a share\n * names a person (SHARE-PEOPLE-ONLY, 2026-09-25); the old\n * share_resource_with_org refuses.\n * update_permission_level() — change user or org permission level (validates ownership)\n * revoke_resource_access() — remove a user's grant (validates ownership)\n * revoke_resource_org_access() — remove an organization's availability row (validates ownership)\n * make_resource_public() — set is_public = true on resource row (validates ownership)\n * make_resource_private() — set is_public = false on resource row (validates ownership)\n * get_resource_permissions() — list all grants with user/org details (owner-only)\n * is_resource_owner() — check ownership for any table\n *\n * Which row controls a type carries is resolved by `get_share_capabilities`\n * (`rowControls`, `shownToOffered`, `publishLane`), never guessed from a column name.\n *\n * Access model (common-docs/policies/access-ladder.md):\n * - Who may open a record without a share is its TABLE's level, never a row setting.\n * - \"Published to the web\" (Organization and Public tables) is the only anonymous lane.\n * - \"Shown to\" decides which lists show it — never a lock.\n * - Read both with getResourceVisibility() — never from the permissions table.\n * - The permissions table stores only explicit user/org grants.\n * - check_resource_access() is the single RLS engine: evaluates all access paths\n * (owner, assignee, direct grant, project, workspace, org hierarchy) in one query.\n */\n\nimport { sendShareNotice, supabase } from \"./host\";\nimport { getClaimsUser } from \"./host\";\nimport { getActiveOrgId } from \"./host\";\nimport type { Database, Json } from \"./dbTypes\";\nimport {\n Permission,\n PermissionWithDetails,\n ResourceType,\n PermissionLevel,\n ShareWithUserOptions,\n OrgAvailabilityOptions,\n MakePublicOptions,\n UpdatePermissionOptions,\n RevokeAccessOptions,\n CheckPermissionOptions,\n PermissionCheckResult,\n ShareActionResult,\n satisfiesPermissionLevel,\n toDbPermissionLevel,\n} from \"./types\";\nimport { getShareableResource, getResourceTypeLabel } from \"./registry\";\nimport { getShareCapabilities } from \"./shareLinks\";\nimport { operationFailed } from \"@ai-matrx/kit/errors\";\nimport type { ShownTo } from \"./shownTo\";\n\n/**\n * Minimal query surface used by the dynamic-table helpers below. The registry\n * resolves schema/table names at RUNTIME from resource-type metadata (any of\n * dozens of resource types), so the generated `Database` type — which requires\n * literal schema/table names — cannot express this call shape statically.\n *\n * MATRX-EXCEPTION: `resolveDynamicClient` is the one sanctioned cast site for\n * this pattern in this file; every dynamic-schema table access below routes\n * through it instead of hand-rolling its own `as unknown as` interface.\n */\ninterface DynamicTableClient {\n from: (table: string) => {\n select: (columns: string) => {\n eq: (\n column: string,\n value: string,\n ) => {\n maybeSingle: <T>() => Promise<{ data: T | null; error: unknown }>;\n };\n };\n update: (patch: Record<string, unknown>) => {\n eq: (\n column: string,\n value: string,\n ) => {\n select: (\n columns: string,\n ) => Promise<{ data: unknown[] | null; error: unknown }>;\n };\n };\n };\n}\n\n/** Resolve a client scoped to a dynamically-named schema (or the default public client). */\nfunction resolveDynamicClient(\n schemaName: string | undefined,\n): DynamicTableClient {\n const base = supabase as unknown as { schema: (s: string) => unknown };\n return (schemaName\n ? base.schema(schemaName)\n : supabase) as unknown as DynamicTableClient;\n}\n\ntype RpcPermissionRow =\n Database[\"public\"][\"Functions\"][\"get_resource_permissions\"][\"Returns\"][number];\ntype PermissionsTableRow = Database[\"iam\"][\"Tables\"][\"permissions\"][\"Row\"];\n\nfunction errMessage(error: unknown): string {\n if (error instanceof Error) return error.message;\n if (\n typeof error === \"object\" &&\n error !== null &&\n \"message\" in error &&\n typeof (error as { message: unknown }).message === \"string\"\n ) {\n return (error as { message: string }).message;\n }\n return \"Unknown error\";\n}\n\n/** Share / publish RPCs return `Json` — narrow without assuming shape beyond optional success/error/message. */\nfunction parseShareRpcResult(data: Json | null | undefined): {\n success: boolean;\n error?: string | undefined;\n message?: string | undefined;\n /** What the one person-share writer did: shared · raised · restored · unchanged · removed. */\n outcome?: string | undefined;\n} {\n if (\n data === null ||\n data === undefined ||\n typeof data !== \"object\" ||\n Array.isArray(data)\n ) {\n return { success: false, error: \"Invalid response\" };\n }\n const o = data as Record<string, unknown>;\n const success = o.success === true;\n const err = typeof o.error === \"string\" ? o.error : undefined;\n const message = typeof o.message === \"string\" ? o.message : undefined;\n const outcome = typeof o.outcome === \"string\" ? o.outcome : undefined;\n return { success, error: err, message, outcome };\n}\n\n// ============================================================================\n// The record's row controls — \"Shown to\" and \"Published to the web\"\n// ============================================================================\n//\n// THE WORDS TABLE (common-docs/policies/access-ladder.md, access ladder T-13): a record on an\n// Organization or Public table carries two row controls and nothing else —\n// \"Shown to\" only_me · my_team · everyone · everyone_on_ai_matrx (null = the type's\n// default). Which LISTS show it to people who can already open it; never a lock.\n// \"Published to the web\" on · off. The only way anyone, signed in or not, opens it at its address.\n// A Private, Confidential or child record carries neither; it is still shared by Anyone link, secure\n// link or with people. `get_share_capabilities` names which of them a TYPE carries\n// (`rowControls`, `shownToOffered`, `publishLane`), so no control is ever drawn that could not work.\n\nexport interface ResourceVisibility {\n /**\n * Published to the web: the row's `published_to_web`, the card's own publish (agent, workflow),\n * or a legacy boolean. Always false for a type that is never published.\n */\n isPublic: boolean;\n /**\n * \"Shown to\" — present only when the type carries it (`shownToOffered`); null means the type's\n * \"Shown to by default\" knob decides.\n */\n shownTo?: ShownTo | null | undefined;\n /**\n * This record is a CHILD of another (a file attached to a chat): it follows its parent and carries\n * no row control of its own, whatever its type.\n */\n childRecord?: boolean | undefined;\n /**\n * WHEN MEMBERSHIP ALONE REACHES IT (SHARE-TAILS, chair ruling 2026-09-25). A record-store thing\n * with no sharing choice is the organization's default — every member reaches it at the member\n * default level — and the lane door says so. Absent/null when the owner chose \"Only me\" (hidden\n * from members' lists; members still open it by link, access ladder T-36) or the organization\n * shows members nothing by default, and for every type outside the record store.\n */\n organizationDefault?: {\n level: string;\n organizationName: string;\n /** The organization whose default it is — its own availability row IS this default. */\n organizationId?: string | undefined;\n } | null;\n /**\n * WHO CAN SEE THIS (lane SHARE-LANE-CONTROL, VERIFIER-23 item 3). The owner's lane choice, as the\n * record store's lane door names it in every state. Present only for kinds whose lane has a door\n * (the record store); absent everywhere else, so no control is drawn that could not work.\n */\n whoCanSee?: WhoCanSee | null | undefined;\n /**\n * The thing's OWN organization, read off its row (never the active one). Null when its table\n * names none or the read could not say.\n */\n homeOrganizationId?: string | null | undefined;\n}\n\n/** The three lanes the record store's \"Who can see this\" control offers. */\nexport type LaneChoice = \"mine\" | \"organization\" | \"world\";\n\nexport interface WhoCanSee {\n /** The record store's lane doors — the only kind whose lane is not a row control. */\n source: \"store\";\n choice: LaneChoice;\n /** The object's OWN organization (never the active one). Null when the door names none. */\n organizationId: string | null;\n organizationName: string | null;\n /** What the organization's member default grants on it, whichever lane is chosen. */\n memberDefaultLevel: string | null;\n /** Organization members reach it right now through the member default. */\n membersReachNow: boolean;\n /** \"Anyone with the link\" is offered only when the world lane would accept it. */\n worldOffered: boolean;\n}\n\n/**\n * THE ONE WRITER OF THE RECORD STORE'S LANE. `custom.share_lane_set` needs the object's own\n * organization (the lane door names it) and Admin on the thing; it moves the lane and the\n * record's reach together, and named people are untouched by it.\n */\nexport async function setStoreLane(\n organizationId: string,\n subjectId: string,\n choice: LaneChoice,\n): Promise<ShareActionResult> {\n const door = choice === \"world\" ? \"community\" : choice;\n const { data, error } = await (\n supabase as unknown as {\n schema(name: string): {\n rpc(\n fn: string,\n args: Record<string, unknown>,\n ): PromiseLike<{ data: unknown; error: { message: string } | null }>;\n };\n }\n )\n .schema(\"custom\")\n .rpc(\"share_lane_set\", {\n p_organization_id: organizationId,\n p_subject_id: subjectId,\n p_choice: door,\n });\n if (error) return { success: false, error: errMessage(error) };\n const said = (data as { message?: unknown | undefined } | null)?.message;\n return {\n success: true,\n ...(typeof said === \"string\" ? { message: said } : {}),\n };\n}\n\n/**\n * Direct write of a verified row-control column on one resource row.\n *\n * Publishing is an EDIT-level action, deliberately — anyone with edit access or\n * better may publish, not just the creator. In real companies the publisher is\n * the approver at the end of the line, not whoever clicked \"new\" first (Arman,\n * 2026-08-14). Do NOT re-gate this on ownership; see\n * common-docs/systems/platform/access/SHARE_LEVELS.md.\n *\n * So a zero-row result here does NOT mean \"you're not the owner\" — under RLS it\n * means the row is invisible to this user, deleted, or gone. Never assert a\n * permission reason from an empty result. A genuine refusal (e.g. the\n * governance-column guard on a per-type governed field) arrives as a real\n * Postgres error carrying its own user-facing message, handled below.\n */\nasync function writeRowControl(\n resourceType: ResourceType,\n resourceId: string,\n patch: Record<string, boolean | string | null>,\n): Promise<ShareActionResult> {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource token: ${resourceType}. Bare table names are not accepted.`,\n );\n }\n const scoped = resolveDynamicClient(entry.schemaName);\n const { data, error } = await scoped\n .from(entry.tableName)\n .update(patch)\n .eq(entry.idColumn, resourceId)\n .select(\"id\");\n if (error) {\n // A real DB refusal already carries a message written for a human — pass it\n // through rather than replacing it with a guess about why.\n return { success: false, error: errMessage(error) };\n }\n if (!data || data.length === 0) {\n return {\n success: false,\n error: \"Couldn't update this item — it may have been deleted or moved.\",\n };\n }\n return { success: true };\n}\n\n/**\n * A table row's row controls (\"Shown to\", \"Published to the web\"), written through the record\n * store's one door, `custom.record_row_controls_set` — `authenticated` holds no table privilege on\n * `custom.record`, so the generic row write above cannot reach it. The door needs the row's OWN\n * organization, which the store's read door names (never the active organization).\n */\nasync function writeStoreRowControls(\n resourceType: ResourceType,\n resourceId: string,\n controls: { shown_to?: ShownTo | null | undefined; published_to_web?: boolean | undefined },\n): Promise<ShareActionResult> {\n const { data: lane, error: laneError } = await supabase.rpc(\"store_door_lane\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n if (laneError) return { success: false, error: errMessage(laneError) };\n const organizationId = (lane as { organization_id?: unknown | undefined } | null)?.organization_id;\n if (typeof organizationId !== \"string\") {\n return { success: false, error: \"That record is not here any more.\" };\n }\n const { error } = await (\n supabase as unknown as {\n schema(name: string): {\n rpc(\n fn: string,\n args: Record<string, unknown>,\n ): PromiseLike<{ data: unknown; error: { message: string } | null }>;\n };\n }\n )\n .schema(\"custom\")\n .rpc(\"record_row_controls_set\", {\n p_organization_id: organizationId,\n p_record_id: resourceId,\n p_controls: controls,\n });\n if (error) return { success: false, error: errMessage(error) };\n return { success: true };\n}\n\nconst SHOWN_TO_VALUES: readonly ShownTo[] = [\n \"only_me\",\n \"my_team\",\n \"everyone\",\n \"everyone_on_ai_matrx\",\n];\n\nfunction asShownTo(value: unknown): ShownTo | null {\n return typeof value === \"string\" &&\n (SHOWN_TO_VALUES as readonly string[]).includes(value)\n ? (value as ShownTo)\n : null;\n}\n\n/**\n * Read a record's row controls (\"Shown to\", \"Published to the web\") and its own organization.\n * Single cheap query — safe to call from list-item components like ShareButton.\n *\n * Returns `{ isPublic: false }` without a row query when the type carries no row control and no\n * publish lane; real capability/query failures remain errors.\n */\nexport async function getResourceVisibility(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<ResourceVisibility> {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource token: ${resourceType}. Bare table names are not accepted.`,\n );\n }\n // A RESOURCE WHOSE TABLE NO CLIENT MAY READ ANSWERS THROUGH ITS DOOR.\n // `authenticated` holds no SELECT on `custom.record` (DOOR-N-1a, permanently), so the record\n // store answers through `store_door_lane`, from `iam.content_lane` — the same answer the Access\n // tab beside it gives. The custom data system owns its conversion (T-13 2.3 handover).\n if (entry.schemaName === \"custom\") {\n const { data, error } = await supabase.rpc(\"store_door_lane\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n if (error) throw operationFailed(\"check who can open this item\", error);\n const row = (data ?? {}) as Record<string, unknown>;\n if (row.found !== true) {\n throw operationFailed(\n \"check who can open this item\",\n new Error(\"That record is not here any more.\"),\n );\n }\n const orgDefault = row.organization_default as\n { level?: unknown | undefined; organization_name?: unknown | undefined } | null | undefined;\n const organizationDefault =\n orgDefault && typeof orgDefault.level === \"string\"\n ? {\n level: orgDefault.level,\n organizationName:\n typeof orgDefault.organization_name === \"string\"\n ? orgDefault.organization_name\n : \"this organization\",\n ...(typeof (orgDefault as { organization_id?: unknown | undefined })\n .organization_id === \"string\"\n ? {\n organizationId: (orgDefault as { organization_id: string })\n .organization_id,\n }\n : {}),\n }\n : null;\n // ACCESS LADDER (custom data adoption, 2026-10-03): a table row carries the same two row\n // controls as every other Organization record — \"Shown to\" and \"Published to the web\" — read\n // off the row by the store's door and drawn by RowControls. The old lane control (\"Only me\" /\n // \"Everyone in …\" / \"Anyone with the link\") is not offered for it any more.\n return {\n isPublic: row.published_to_web === true || row.is_public === true,\n shownTo: asShownTo(row.shown_to),\n organizationDefault,\n whoCanSee: null,\n homeOrganizationId:\n typeof row.organization_id === \"string\" ? row.organization_id : null,\n };\n }\n\n const capabilities = await getShareCapabilities(resourceType);\n const publishColumn =\n capabilities.publishLane === \"published_to_web\"\n ? \"published_to_web\"\n : capabilities.publishLane === \"card\"\n ? \"card_visibility\"\n : capabilities.publishLane === \"boolean\" &&\n capabilities.publicState?.kind === \"boolean\"\n ? capabilities.publicState.column\n : null;\n const columns = [\n publishColumn,\n capabilities.shownToOffered ? \"shown_to\" : null,\n capabilities.organizationColumn,\n capabilities.rowChildColumn,\n ].filter((c): c is string => c !== null);\n if (columns.length === 0) {\n return { isPublic: false, homeOrganizationId: null };\n }\n\n const client = resolveDynamicClient(entry.schemaName);\n const { data, error } = await client\n .from(entry.tableName)\n .select(columns.join(\",\"))\n .eq(entry.idColumn, resourceId)\n .maybeSingle<Record<string, boolean | string | null>>();\n\n if (error || !data) {\n throw operationFailed(\"check who can open this item\", error);\n }\n const home = capabilities.organizationColumn\n ? data[capabilities.organizationColumn]\n : null;\n const published = publishColumn ? data[publishColumn] : null;\n const childRecord = capabilities.rowChildColumn\n ? data[capabilities.rowChildColumn] != null\n : false;\n if (childRecord) {\n return {\n isPublic: false,\n childRecord: true,\n homeOrganizationId: typeof home === \"string\" ? home : null,\n };\n }\n return {\n // The card lane is the card's own \"Published to the web\" (owner-session ruling 2026-09-28).\n isPublic: published === true || published === \"public\",\n ...(capabilities.shownToOffered\n ? { shownTo: asShownTo(data.shown_to) }\n : {}),\n homeOrganizationId: typeof home === \"string\" ? home : null,\n };\n}\n\n/**\n * \"Shown to\" — which lists show this record to people who can already open it. Never a lock.\n * Refuses a type that does not carry it rather than writing a column that is not there.\n */\nexport async function setResourceShownTo(\n resourceType: ResourceType,\n resourceId: string,\n shownTo: ShownTo | null,\n): Promise<ShareActionResult> {\n try {\n if (getShareableResource(resourceType)?.schemaName === \"custom\") {\n return await writeStoreRowControls(resourceType, resourceId, { shown_to: shownTo });\n }\n const capabilities = await getShareCapabilities(resourceType);\n if (!capabilities.shownToOffered) {\n return {\n success: false,\n error: `A ${getResourceTypeLabel(resourceType).toLowerCase()} has no \"Shown to\" — it is not listed to anyone it is not shared with.`,\n };\n }\n return await writeRowControl(resourceType, resourceId, { shown_to: shownTo });\n } catch (error: unknown) {\n console.error(\"setResourceShownTo error:\", error);\n return {\n success: false,\n error: errMessage(error) || 'Could not change \"Shown to\"',\n };\n }\n}\n\n/**\n * \"Published to the web\" on or off, through the lane the type carries: the row's own\n * `published_to_web`, the card's own publish (agent, workflow), or a legacy boolean's RPC.\n */\nasync function setPublishedToWeb(\n resourceType: ResourceType,\n resourceId: string,\n on: boolean,\n): Promise<ShareActionResult> {\n if (getShareableResource(resourceType)?.schemaName === \"custom\") {\n return writeStoreRowControls(resourceType, resourceId, { published_to_web: on });\n }\n const capabilities = await getShareCapabilities(resourceType);\n switch (capabilities.publishLane) {\n case \"published_to_web\":\n return writeRowControl(resourceType, resourceId, { published_to_web: on });\n case \"card\":\n // The card's own publish: off returns the card to its organization's lists.\n return writeRowControl(resourceType, resourceId, {\n card_visibility: on ? \"public\" : \"internal\",\n });\n case \"boolean\": {\n const { data, error } = await supabase.rpc(\n on ? \"make_resource_public\" : \"make_resource_private\",\n { p_resource_type: resourceType, p_resource_id: resourceId },\n );\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n return parsed.success\n ? { success: true }\n : { success: false, error: parsed.error || \"Please try again\" };\n }\n default:\n return {\n success: false,\n error: `A ${getResourceTypeLabel(resourceType).toLowerCase()} is never published to the web. Share it with an Anyone link or with people instead.`,\n };\n }\n}\n\n// ============================================================================\n// Share — all routes through SECURITY DEFINER RPCs\n// ============================================================================\n\n/**\n * Grant a user access to a resource.\n * RPC validates: authenticated, valid level, resource exists, caller is owner, no duplicate.\n */\nexport async function shareWithUser(\n options: ShareWithUserOptions,\n): Promise<ShareActionResult> {\n try {\n const {\n resourceType,\n resourceId,\n userId,\n permissionLevel,\n organizationId,\n } = options;\n\n const { data, error } = await supabase.rpc(\"share_resource_with_user\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_user_id: userId,\n // Narrowed at the write boundary: the code ladder is wider than the\n // database enum, so a level Postgres cannot store is refused here by\n // name with the remedy, not swallowed into an opaque enum error.\n p_permission_level: toDbPermissionLevel(permissionLevel),\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error: parsed.error || \"Failed to share with user\",\n };\n\n // The person already held this access (or more): nothing changed, so\n // nobody is told again.\n if (parsed.outcome === \"unchanged\")\n return { success: true, message: parsed.message };\n\n // Fire-and-forget notice — failure doesn't affect the grant. ONE path: the\n // notification spine (`share.resource_shared`) emails the recipient and sends\n // the paired DM (as the sharer, with the resource card), honoring their email\n // switch. It used to be an email route plus a DM sent from here — two paths.\n //\n // 🚨 THE NOTICE IS FILED IN THE SHARED OBJECT'S ORGANIZATION (ACCESS-FIX-18, VERIFIER-18\n // H4). Unnamed, the messaging door fell back to the active organization and, with\n // none picked, raised the organization gate over the Share dialog — \"Which workspace\n // is this for?\" with 44 organizations, for a table that names its own — and the pick\n // closed the Share dialog with it. The share has already landed here; a notification\n // is never a reason to ask anything.\n const noticeOrganizationId =\n organizationId ??\n // object-org-exempt: a share dialog opened with no object organization (a non-record resource) files its notification where the person works, and never prompts\n getActiveOrgId(); // org-filter: write-target the share notification is filed where the person works when the object names no organization\n if (!noticeOrganizationId) {\n console.warn(\n \"[sharing] Nobody was told about this share: the dialog was opened without the \" +\n \"shared object's organization and none is picked. The share itself landed. \" +\n \"Remedy: pass organizationId to <ShareModal>.\",\n );\n } else {\n // aidream `POST /sharing/notify` (was the web's /api/sharing/notify). A refusal is LOUD in the\n // console with the server's own sentence; the share itself has already landed.\n void sendShareNotice(\"/sharing/notify\", {\n recipientUserId: userId,\n resourceType,\n resourceId,\n organizationId: noticeOrganizationId,\n permissionLevel,\n resourceLabel: getResourceTypeLabel(resourceType),\n })\n .then((answer) => {\n if (!answer.success) console.error(`[sharing] The person was NOT told about this share: ${answer.msg ?? \"the server refused\"}`);\n })\n .catch((err) => console.error(\"Sharing notification failed:\", err));\n }\n\n return {\n success: true,\n message: parsed.message || \"Successfully shared with user\",\n };\n } catch (error: unknown) {\n console.error(\"shareWithUser error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Failed to share with user\",\n };\n }\n}\n\n/**\n * Make a thing AVAILABLE to an organization, as organization configuration: an agent bound to\n * the organization's surface, or an item contributed to its library (with moderation). Everyone\n * in the organization, including people who join later, can use it.\n *\n * 🚨 THIS IS NOT SHARING (chair ruling 2026-09-25, owner ruling 2026-09-23 \"access is personal\").\n * A share names a person; the store refuses an organization at every share door with\n * \"Shares name a person, not an organization.\" This door is the only writer of an organization\n * grantee, and the row it writes carries `granted_via = 'availability'`.\n * RPC validates: authenticated, resource exists, caller holds Admin on it, caller is a member of\n * the target organization, the organization's module config (members may add, needs approval).\n */\nexport async function grantOrgAvailability(\n options: OrgAvailabilityOptions,\n): Promise<ShareActionResult> {\n try {\n const { resourceType, resourceId, organizationId, permissionLevel } =\n options;\n\n const { data, error } = await supabase.rpc(\"grant_org_availability\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_org_id: organizationId,\n // omit → server applies the org module's default_permission.\n p_permission_level: permissionLevel\n ? toDbPermissionLevel(permissionLevel)\n : permissionLevel,\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error:\n parsed.error || \"Could not make this available to the organization\",\n };\n\n return {\n success: true,\n message: parsed.message || \"Available to everyone in the organization\",\n };\n } catch (error: unknown) {\n console.error(\"grantOrgAvailability error:\", error);\n return {\n success: false,\n error:\n errMessage(error) ||\n \"Could not make this available to the organization\",\n };\n }\n}\n\n/**\n * Ensure an organization has the requested availability row.\n *\n * The availability door reports an existing row instead of inserting a duplicate. Composition\n * workflows (surface binding) need idempotent \"ensure\" semantics, so the translation of that\n * answer lives here instead of in each caller.\n */\nexport async function ensureOrgAvailability(\n options: OrgAvailabilityOptions,\n): Promise<ShareActionResult> {\n const result = await grantOrgAvailability(options);\n if (!result.success && result.error === \"Organization already has access\") {\n return {\n success: true,\n message: \"Organization already has access\",\n };\n }\n return result;\n}\n\n/**\n * Publish a resource to the web — the one way anyone, signed in or not, opens it at its address.\n * Writes the lane the type carries (published_to_web, the card's own publish, or a legacy boolean).\n * The permissions table is NOT written to.\n */\nexport async function makePublic(\n options: MakePublicOptions,\n): Promise<ShareActionResult> {\n try {\n const res = await setPublishedToWeb(options.resourceType, options.resourceId, true);\n return res.success\n ? { success: true, message: \"Published to the web\" }\n : { success: false, error: res.error || \"Couldn't publish it to the web\" };\n } catch (error: unknown) {\n console.error(\"makePublic error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Couldn't publish it to the web\",\n };\n }\n}\n\n/**\n * Stop publishing a resource to the web. Who in its organization can open it is unchanged —\n * that is its table's level, never a row setting (access ladder).\n */\nexport async function makePrivate(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<ShareActionResult> {\n try {\n const res = await setPublishedToWeb(resourceType, resourceId, false);\n return res.success\n ? { success: true, message: \"No longer published to the web\" }\n : { success: false, error: res.error || \"Couldn't stop publishing it to the web\" };\n } catch (error: unknown) {\n console.error(\"makePrivate error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Couldn't stop publishing it to the web\",\n };\n }\n}\n\n// ============================================================================\n// Revoke — all routes through SECURITY DEFINER RPCs\n// ============================================================================\n\n/**\n * Remove a user's explicit access grant.\n * RPC validates ownership before deleting.\n */\nexport async function revokeUserAccess(\n resourceType: ResourceType,\n resourceId: string,\n userId: string,\n): Promise<ShareActionResult> {\n try {\n const { data, error } = await supabase.rpc(\"revoke_resource_access\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_user_id: userId,\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error: parsed.error || \"Failed to revoke access\",\n };\n\n return { success: true, message: \"Access revoked\" };\n } catch (error: unknown) {\n console.error(\"revokeUserAccess error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Failed to revoke user access\",\n };\n }\n}\n\n/**\n * Remove an organization's explicit access grant.\n * RPC validates ownership before deleting.\n */\nexport async function revokeOrgAccess(\n resourceType: ResourceType,\n resourceId: string,\n organizationId: string,\n): Promise<ShareActionResult> {\n try {\n const { data, error } = await supabase.rpc(\"revoke_resource_org_access\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_org_id: organizationId,\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error: parsed.error || \"Failed to revoke org access\",\n };\n\n return { success: true, message: \"Organization access revoked\" };\n } catch (error: unknown) {\n console.error(\"revokeOrgAccess error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Failed to revoke org access\",\n };\n }\n}\n\n/**\n * Remove public access — alias for makePrivate.\n */\nexport async function revokePublicAccess(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<ShareActionResult> {\n return makePrivate(resourceType, resourceId);\n}\n\n/**\n * Generic dispatcher — routes to the correct revoke function.\n */\nexport async function revokeAccess(\n options: RevokeAccessOptions,\n): Promise<ShareActionResult> {\n const { resourceType, resourceId, userId, organizationId, isPublic } =\n options;\n\n if (userId) return revokeUserAccess(resourceType, resourceId, userId);\n if (organizationId)\n return revokeOrgAccess(resourceType, resourceId, organizationId);\n if (isPublic) return revokePublicAccess(resourceType, resourceId);\n\n return {\n success: false,\n error: \"Must specify userId, organizationId, or isPublic\",\n };\n}\n\n// ============================================================================\n// Update — routes through SECURITY DEFINER RPC\n// ============================================================================\n\n/**\n * Change the permission level for an existing user or org grant.\n * RPC validates ownership before updating.\n */\nexport async function updatePermissionLevel(\n options: UpdatePermissionOptions,\n): Promise<ShareActionResult> {\n try {\n const { resourceType, resourceId, userId, organizationId, newLevel } =\n options;\n\n if (!userId && !organizationId) {\n return { success: false, error: \"Must specify userId or organizationId\" };\n }\n\n const { data, error } = await supabase.rpc(\"update_permission_level\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_user_id: userId,\n p_target_org_id: organizationId,\n p_new_level: newLevel,\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error: parsed.error || \"Failed to update permission level\",\n };\n\n return {\n success: true,\n message: parsed.message || \"Permission level updated\",\n };\n } catch (error: unknown) {\n console.error(\"updatePermissionLevel error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Failed to update permission level\",\n };\n }\n}\n\n// ============================================================================\n// Query Functions\n// ============================================================================\n\n/**\n * List all grants for a resource (owner-only).\n * Uses get_resource_permissions() SECURITY DEFINER RPC — includes resolved\n * user/org display names. Returns empty for non-owners (RPC silently returns nothing).\n *\n * NOTE: Does not include is_public state — use getResourceVisibility() for that.\n */\nexport async function listPermissions(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<PermissionWithDetails[]> {\n try {\n const { data, error } = await supabase.rpc(\"get_resource_permissions\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n\n if (error) throw error;\n\n return (data || []).map(transformPermissionFromRpcRow);\n } catch (error: unknown) {\n // A failed read is not \"no grants\" (RC-B12 r13) — it throws, and every\n // caller's own failure state (usePermissions error, checkPermission's\n // \"Error checking permission\") says so.\n console.error(\"listPermissions error:\", error);\n throw error instanceof Error ? error : new Error(errMessage(error) || \"Could not read the permissions\");\n }\n}\n\n/** Alias kept for compatibility */\nexport const getResourcePermissions = listPermissions;\n\n/**\n * Check if the current user is the owner of a resource.\n * Reads owner_column directly from the resource row — single index scan, no\n * RPC round-trip required.\n *\n * Uses the registry to find the canonical table name, id column, and owner\n * column so tables like flashcard_sets (set_id, not id) work correctly the\n * day they're added to the registry — without a code change here.\n */\nexport interface OwnershipResolution {\n /** True only when the ownership read SUCCEEDED and the caller owns the row. */\n isOwner: boolean;\n /**\n * Non-null when ownership could NOT be determined (unknown resource type,\n * failed read, no session). `isOwner: false` with a non-null `error` means\n * \"unknown\", never \"not the owner\" — UIs must not present it as a denial.\n */\n error: string | null;\n}\n\n/**\n * Resolve whether the current user owns a resource, distinguishing\n * \"not the owner\" from \"could not determine\".\n *\n * LOUD RECOVERY: every failure path returns a message instead of a bare\n * `false`. A silent `false` here is what renders the canonical ShareModal as a\n * dead, empty dialog for a user who actually owns the row — the whole class of\n * bug this function exists to make impossible.\n *\n * Reads owner_column directly from the resource row — single index scan, no\n * RPC round-trip required. Uses the registry to find the canonical table name,\n * id column, and owner column so tables like flashcard_sets (set_id, not id)\n * work correctly the day they're added to the registry.\n */\nexport async function resolveResourceOwnership(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<OwnershipResolution> {\n if (!resourceType || !resourceId) {\n return {\n isOwner: false,\n error: \"Missing resource type or id — cannot resolve ownership.\",\n };\n }\n\n try {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n return {\n isOwner: false,\n error: `Unknown shareable resource type \"${resourceType}\". Register it in shareable_resource_registry.`,\n };\n }\n\n // The registry is authoritative for the owner column (canonical tables use\n // `created_by`; file satellites `owner_id`; udt/legacy `user_id`). Read it\n // directly — no per-type override.\n const ownerColumn = entry.ownerColumn;\n\n // `tableName` is the physical table; `schemaName` its (non-public) schema.\n const tableName = entry.tableName;\n const client = resolveDynamicClient(entry.schemaName);\n const [\n { data: row, error: rowError },\n {\n data: { user },\n error: userError,\n },\n ] = await Promise.all([\n client\n .from(tableName)\n .select(ownerColumn)\n .eq(entry.idColumn, resourceId)\n .maybeSingle<Record<string, string | null>>(),\n getClaimsUser(supabase),\n ]);\n\n if (rowError) {\n const message = errMessage(rowError);\n console.error(\n `[permissions] Ownership read failed for ${resourceType}:${resourceId} ` +\n `(${entry.schemaName ?? \"public\"}.${tableName}.${ownerColumn}): ${message}`,\n );\n return {\n isOwner: false,\n error: `Could not read ${entry.displayLabel}: ${message}`,\n };\n }\n\n if (userError || !user) {\n return {\n isOwner: false,\n error: \"No signed-in user — cannot resolve ownership.\",\n };\n }\n\n if (!row) {\n return {\n isOwner: false,\n error: `${entry.displayLabel} not found, or you do not have access to it.`,\n };\n }\n\n return { isOwner: row[ownerColumn] === user.id, error: null };\n } catch (error) {\n const message = errMessage(error);\n console.error(\n `[permissions] Ownership check threw for ${resourceType}:${resourceId}: ${message}`,\n );\n return { isOwner: false, error: message };\n }\n}\n\n/**\n * \"MAY I DECIDE WHO ELSE SEES THIS?\" — the question a share dialog actually has.\n *\n * `resolveResourceOwnership` above answers a NARROWER one: am I the row's\n * `created_by`. VIS-17's one ladder says `admin` on a thing means \"can change it\n * and decide who else may\", so gating the dialog on ownership made `admin` a\n * level that could not do the one thing its own definition names — and for the\n * record store it could not even be ASKED, because `custom.record` carries no\n * client SELECT grant and the direct read above returns \"Could not read Record\".\n *\n * So this asks the database's own predicate (`public.may_manage_sharing`, lane\n * SHARE 2026-09-19), which is the same one the six sharing RPCs enforce. The\n * screen and the door cannot disagree, because there is one answer.\n *\n * A failure is reported as \"could not determine\", never as a denial — the\n * distinction the dialog needs to tell a stranger from a broken read.\n */\nexport async function resolveSharingAuthority(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<OwnershipResolution> {\n if (!resourceType || !resourceId) {\n return {\n isOwner: false,\n error: \"Missing resource type or id — cannot resolve who may share this.\",\n };\n }\n try {\n const { data, error } = await supabase.rpc(\"may_manage_sharing\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n if (error) throw error;\n return { isOwner: data === true, error: null };\n } catch (error: unknown) {\n const message = errMessage(error);\n console.error(\n `[permissions] may_manage_sharing failed for ${resourceType}:${resourceId}: ${message}`,\n );\n return { isOwner: false, error: message };\n }\n}\n\n/**\n * Boolean convenience wrapper over {@link resolveResourceOwnership}.\n *\n * Prefer `resolveResourceOwnership` anywhere the difference between \"not the\n * owner\" and \"could not determine\" changes what the user sees.\n */\nexport async function isResourceOwner(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<boolean> {\n const { isOwner } = await resolveResourceOwnership(resourceType, resourceId);\n return isOwner;\n}\n\n/**\n * Get all resources explicitly shared with the current user.\n * Reads from the permissions table — reflects direct grants only,\n * not hierarchy-inherited access (project/workspace/org membership).\n */\nexport async function getSharedWithMe(\n resourceType?: ResourceType | undefined,\n): Promise<Permission[]> {\n try {\n const {\n data: { user },\n error: userError,\n } = await getClaimsUser(supabase);\n if (userError || !user) return [];\n\n let query = supabase\n .schema(\"iam\")\n .from(\"permissions\")\n .select(\"*\")\n .eq(\"granted_to_user_id\", user.id);\n\n if (resourceType) query = query.eq(\"resource_type\", resourceType);\n\n const { data, error } = await query.order(\"created_at\", {\n ascending: false,\n });\n if (error) throw error;\n\n return (data || []).map(transformPermissionFromTableRow);\n } catch (error) {\n // A failed read is not \"nothing shared with me\" (RC-B12 r13).\n console.error(\"getSharedWithMe error:\", error);\n throw error instanceof Error ? error : new Error(errMessage(error) || \"Could not read what is shared with you\");\n }\n}\n\n/**\n * Check if current user has a specific permission level on a resource.\n * Used for client-side gating — not a substitute for RLS.\n */\nexport async function checkPermission(\n options: CheckPermissionOptions,\n): Promise<PermissionCheckResult> {\n try {\n const { resourceType, resourceId, requiredLevel = \"viewer\" } = options;\n\n const {\n data: { user },\n error: userError,\n } = await getClaimsUser(supabase);\n if (userError || !user)\n return { hasAccess: false, isOwner: false, reason: \"Not authenticated\" };\n\n const permissions = await listPermissions(resourceType, resourceId);\n\n const userPermission = permissions.find(\n (p) => p.grantedToUserId === user.id,\n );\n if (userPermission) {\n const hasAccess = satisfiesPermissionLevel(\n userPermission.permissionLevel,\n requiredLevel,\n );\n return {\n hasAccess,\n level: userPermission.permissionLevel,\n isOwner: false,\n reason: hasAccess\n ? \"Direct user permission\"\n : \"Insufficient permission level\",\n };\n }\n\n return {\n hasAccess: false,\n isOwner: false,\n reason: \"No direct permission found\",\n };\n } catch (error) {\n console.error(\"checkPermission error:\", error);\n return {\n hasAccess: false,\n isOwner: false,\n reason: \"Error checking permission\",\n };\n }\n}\n\n/**\n * Batch grant access to multiple users in parallel.\n */\nexport async function batchShareWithUsers(\n resourceType: ResourceType,\n resourceId: string,\n userIds: string[],\n permissionLevel: PermissionLevel,\n): Promise<ShareActionResult[]> {\n return Promise.all(\n userIds.map((userId) =>\n shareWithUser({ resourceType, resourceId, userId, permissionLevel }),\n ),\n );\n}\n\n// ============================================================================\n// Internal Helpers\n// ============================================================================\n\nfunction parseNestedUser(\n j: Json,\n): PermissionWithDetails[\"grantedToUser\"] | undefined {\n if (\n j === null ||\n j === undefined ||\n typeof j !== \"object\" ||\n Array.isArray(j)\n )\n return undefined;\n const o = j as Record<string, unknown>;\n if (typeof o.id !== \"string\" || typeof o.email !== \"string\") return undefined;\n return {\n id: o.id,\n email: o.email,\n displayName: typeof o.displayName === \"string\" ? o.displayName : undefined,\n avatarUrl: typeof o.avatarUrl === \"string\" ? o.avatarUrl : undefined,\n isGuest: o.isGuest === true,\n };\n}\n\nfunction parseNestedOrg(\n j: Json,\n): PermissionWithDetails[\"grantedToOrganization\"] | undefined {\n if (\n j === null ||\n j === undefined ||\n typeof j !== \"object\" ||\n Array.isArray(j)\n )\n return undefined;\n const o = j as Record<string, unknown>;\n if (\n typeof o.id !== \"string\" ||\n typeof o.name !== \"string\" ||\n typeof o.slug !== \"string\"\n )\n return undefined;\n return {\n id: o.id,\n name: o.name,\n slug: o.slug,\n logoUrl: typeof o.logoUrl === \"string\" ? o.logoUrl : undefined,\n };\n}\n\nfunction transformPermissionFromRpcRow(\n row: RpcPermissionRow,\n): PermissionWithDetails {\n return {\n id: row.id,\n resourceType: row.resource_type as ResourceType,\n resourceId: row.resource_id,\n grantedToUserId: row.granted_to_user_id || undefined,\n grantedToOrganizationId: row.granted_to_organization_id || undefined,\n isPublic: row.is_public,\n permissionLevel: row.permission_level as PermissionLevel,\n createdAt: row.created_at ? new Date(row.created_at) : undefined,\n createdBy: undefined,\n grantedToUser: parseNestedUser(row.granted_to_user),\n grantedToOrganization: parseNestedOrg(row.granted_to_organization),\n };\n}\n\nfunction transformPermissionFromTableRow(row: PermissionsTableRow): Permission {\n return {\n id: row.id,\n resourceType: row.resource_type as ResourceType,\n resourceId: row.resource_id,\n grantedToUserId: row.granted_to_user_id,\n grantedToOrganizationId: row.granted_to_organization_id,\n isPublic: row.is_public ?? undefined,\n permissionLevel: row.permission_level as PermissionLevel,\n createdAt: row.created_at ? new Date(row.created_at) : undefined,\n createdBy: row.created_by ?? undefined,\n };\n}\n\n// Legacy getTableName() removed — the registry (utils/permissions/registry.ts)\n// is the single source of truth. Use getShareableResource() / resolveTableName()\n// from './registry' if you need the canonical table name on the client.\n","// lib/list-scope/shownTo.ts\n//\n// \"SHOWN TO\" — the per-row list choice (access ladder, common-docs/policies/access-ladder.md\n// \"Organization behavior is knobs and filters, not row security\").\n//\n// A record on an Organization or Public table carries `shown_to`:\n// only_me · my_team · everyone · everyone_on_ai_matrx · NULL (= the type's\n// \"Shown to by default\" knob, access.shown_to_default/<token>, system → organization → person).\n// It decides which LISTS show a record to people who can already open it. It never locks: a coworker\n// who reaches an Only-me record by its address still opens it.\n//\n// The server lists (`*_list_scoped` RPCs) apply `platform.shown_to_lists(...)`. A client list that\n// builds its own PostgREST query applies the same rule with `applyShownTo`, fed by ONE read of\n// `platform.shown_to_context(token)` (the knob per organization + the viewer's teammates).\nimport { supabase } from \"./host\";\n\nexport type ShownTo = \"only_me\" | \"my_team\" | \"everyone\" | \"everyone_on_ai_matrx\";\n\n/** Per organization id: the type's resolved default (`d`) and the viewer's teammates (`t`). */\nexport type ShownToContext = Record<string, { d: ShownTo | null; t: string[] }>;\n\n/** One read per list: the viewer's context for one type. Throws on failure (never guesses wider). */\nexport async function fetchShownToContext(token: string): Promise<ShownToContext> {\n const { data, error } = await supabase\n .schema(\"platform\")\n .rpc(\"shown_to_context\", { p_token: token });\n if (error) {\n throw new Error(`Could not read who \"${token}\" lists are shown to: ${error.message}`);\n }\n return (data ?? {}) as ShownToContext;\n}\n\nexport interface OrCapable<Self> {\n or(filters: string): Self;\n}\n\n/**\n * The PostgREST `or` expression for \"does this row belong in my list of organization X?\":\n * mine always; otherwise the row's own Shown to, else the organization's default. (A row the\n * retiring row column once marked personal carries `shown_to = only_me` — T-13 phase 3 backfilled it\n * and the dual-write trigger keeps it — so no list reads that column any more.)\n */\nexport function shownToFilter(\n ctx: ShownToContext,\n organizationId: string,\n userId: string,\n ownerColumn = \"created_by\",\n): string {\n const org = ctx[organizationId];\n const team = (org?.t?.length ? org.t : [userId]).join(\",\");\n const byDefault = org?.d ?? \"everyone\";\n const arms = [\n `${ownerColumn}.eq.${userId}`,\n \"shown_to.in.(everyone,everyone_on_ai_matrx)\",\n `and(shown_to.eq.my_team,${ownerColumn}.in.(${team}))`,\n ];\n if (byDefault === \"everyone\" || byDefault === \"everyone_on_ai_matrx\") {\n arms.push(\"shown_to.is.null\");\n } else if (byDefault === \"my_team\") {\n arms.push(`and(shown_to.is.null,${ownerColumn}.in.(${team}))`);\n }\n return arms.join(\",\");\n}\n\n/** Narrow a one-organization list query to what Shown to lets this person's list show. */\nexport function applyShownTo<Q extends OrCapable<Q>>(\n query: Q,\n ctx: ShownToContext,\n organizationId: string,\n userId: string,\n ownerColumn = \"created_by\",\n): Q {\n return query.or(shownToFilter(ctx, organizationId, userId, ownerColumn));\n}\n\n/**\n * The same rule across several organizations at once (a blended \"My Orgs\" list): each row is\n * judged by ITS organization's default and ITS organization's teammates.\n */\nexport function shownToBlendedFilter(\n ctx: ShownToContext,\n organizationIds: string[],\n userId: string,\n ownerColumn = \"created_by\",\n orgColumn = \"organization_id\",\n): string {\n return organizationIds\n .map((org) => `and(${orgColumn}.eq.${org},or(${shownToFilter(ctx, org, userId, ownerColumn)}))`)\n .join(\",\");\n}\n\n/**\n * THE SAME RULE ACROSS EVERY ORGANIZATION THE VIEWER BELONGS TO — the filter a client list uses when\n * it opens on \"the organization\" with no one organization picked (access ladder T-11 leak fixes,\n * 2026-09-28: the notes sidebar applied no Shown to at all and listed 57 of a coworker's Only-me\n * notes). Compact on purpose — one arm per distinct rule, not one per organization — because a\n * person may belong to dozens of organizations and the whole expression rides in a URL:\n * mine · shown to everyone · my_team rows of my teammates (per organization that has any) ·\n * unset rows in organizations whose default shows them ·\n * rows outside my organizations (reached by a direct share) or with no organization.\n */\nexport function shownToMyOrgsFilter(\n ctx: ShownToContext,\n userId: string,\n ownerColumn = \"created_by\",\n orgColumn = \"organization_id\",\n): string | null {\n const orgs = Object.keys(ctx);\n if (orgs.length === 0) return null;\n const arms = [`${ownerColumn}.eq.${userId}`, \"shown_to.in.(everyone,everyone_on_ai_matrx)\"];\n const everyoneByDefault: string[] = [];\n for (const org of orgs) {\n const { d, t } = ctx[org] ?? { d: null, t: [] };\n const teammates = (t ?? []).filter((id) => id !== userId);\n if (teammates.length > 0) {\n const team = teammates.join(\",\");\n arms.push(`and(${orgColumn}.eq.${org},shown_to.eq.my_team,${ownerColumn}.in.(${team}))`);\n if (d === \"my_team\") {\n arms.push(\n `and(${orgColumn}.eq.${org},shown_to.is.null,${ownerColumn}.in.(${team}))`,\n );\n }\n }\n if (d === null || d === \"everyone\" || d === \"everyone_on_ai_matrx\") everyoneByDefault.push(org);\n }\n if (everyoneByDefault.length > 0) {\n arms.push(\n `and(${orgColumn}.in.(${everyoneByDefault.join(\",\")}),shown_to.is.null)`,\n );\n }\n arms.push(`${orgColumn}.is.null`, `${orgColumn}.not.in.(${orgs.join(\",\")})`);\n return arms.join(\",\");\n}\n","// lib/list-scope/shownToWords.ts — the words for \"Shown to\" (access ladder Words table).\nimport type { ShownTo } from \"./shownTo\";\n\n/**\n * THE WORDS (access ladder Words table, \"Shown to\"): one label and one sentence per value, used by\n * every surface that shows or sets it. \"Everyone on AI Matrx\" is valid only on a record that is\n * published to the web (a database CHECK refuses it otherwise).\n */\nexport const SHOWN_TO_WORDS: Record<ShownTo, { label: string; says: string }> = {\n only_me: { label: \"Only me\", says: \"Listed for you alone.\" },\n my_team: { label: \"My team\", says: \"Listed for you and your teammates.\" },\n everyone: { label: \"Everyone\", says: \"Listed for everyone in its organization.\" },\n everyone_on_ai_matrx: {\n label: \"Everyone on AI Matrx\",\n says: \"Listed for everyone signed in to AI Matrx.\",\n },\n};\n\nexport const SHOWN_TO_ORDER: readonly ShownTo[] = [\n \"only_me\",\n \"my_team\",\n \"everyone\",\n \"everyone_on_ai_matrx\",\n];\n","/**\n * features/sharing/service/accessSummary.ts\n *\n * THE honest answer to \"who can actually see this, and why?\" for ONE entity.\n *\n * A list surface can only show what a row says about itself, which is only one of\n * the SIX ways `iam.has_access_for_base` grants\n * access: owner, level+org, direct grant, membership, education\n * assignment, and — the one that kept being missed — reachability through a\n * CONTAINER (a scope, project, data store…). A file marked `personal` that is\n * attached to an org-internal scope is readable by that whole org, and saying\n * \"Only you\" about it is a lie.\n *\n * This is deliberately ONE ENTITY AT A TIME. It walks reachability and resolves\n * container titles, so it is not something to run per row of a list. List\n * surfaces stay on cheap bulk signals and simply avoid asserting the specific\n * claim they cannot back up.\n *\n * Direct to Supabase (`public.entity_access_summary`), never through Python —\n * this is a plain DB read the browser is entitled to make.\n */\n\nimport { createClient } from \"./host\";\nimport { operationFailed } from \"@ai-matrx/kit/errors\";\nimport type { EntityTypeToken } from \"@ai-matrx/associations\";\n\nexport type AccessGranteeType = \"user\" | \"organization\";\n\nexport interface AccessDirectGrant {\n granteeType: AccessGranteeType;\n granteeId: string | null;\n granteeLabel: string | null;\n level: string;\n expiresAt: string | null;\n}\n\nexport interface AccessContainer {\n containerType: string;\n containerId: string;\n /** Human label of the container kind, e.g. \"Scope\". */\n containerTypeLabel: string | null;\n /** The container's own name, e.g. \"Web Development\". */\n label: string | null;\n /** Highest permission level conveyed through this container. */\n level: string;\n depth: number;\n organizationId: string | null;\n organizationName: string | null;\n /** True when everyone in the container's org can read the container. */\n orgReadable: boolean;\n /** Explicit members of the container. */\n memberCount: number;\n}\n\nexport interface AccessSummary {\n entityType: string;\n entityId: string;\n ownerId: string | null;\n viewerIsOwner: boolean;\n organizationId: string | null;\n organizationName: string | null;\n /** Caller has admin — only then are grantee identities populated. */\n canManage: boolean;\n isPublic: boolean;\n /** Every member of its organization can open it (its table's level). */\n orgReadable: boolean;\n directGrantCount: number;\n directGrants: AccessDirectGrant[];\n /** Explicit members of the entity itself. */\n memberCount: number;\n containers: AccessContainer[];\n containerCount: number;\n}\n\nfunction str(value: unknown): string | null {\n return typeof value === \"string\" && value.length > 0 ? value : null;\n}\n\nfunction num(value: unknown): number {\n return typeof value === \"number\" && Number.isFinite(value) ? value : 0;\n}\n\nfunction bool(value: unknown): boolean {\n return value === true;\n}\n\nfunction record(value: unknown): Record<string, unknown> | null {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction parseGrant(raw: unknown): AccessDirectGrant | null {\n const row = record(raw);\n if (!row) return null;\n return {\n granteeType: row.grantee_type === \"organization\" ? \"organization\" : \"user\",\n granteeId: str(row.grantee_id),\n granteeLabel: str(row.grantee_label),\n level: str(row.level) ?? \"viewer\",\n expiresAt: str(row.expires_at),\n };\n}\n\nfunction parseContainer(raw: unknown): AccessContainer | null {\n const row = record(raw);\n if (!row) return null;\n const containerId = str(row.container_id);\n const containerType = str(row.container_type);\n if (!containerId || !containerType) return null;\n return {\n containerType,\n containerId,\n containerTypeLabel: str(row.container_type_label),\n label: str(row.label),\n level: str(row.level) ?? \"viewer\",\n depth: num(row.depth),\n organizationId: str(row.organization_id),\n organizationName: str(row.organization_name),\n orgReadable: bool(row.org_readable),\n memberCount: num(row.member_count),\n };\n}\n\nfunction parseSummary(raw: unknown): AccessSummary {\n const row = record(raw);\n if (!row) {\n throw new Error(\"entity_access_summary returned an unexpected shape\");\n }\n const grants = Array.isArray(row.direct_grants) ? row.direct_grants : [];\n const containers = Array.isArray(row.containers) ? row.containers : [];\n return {\n entityType: str(row.entity_type) ?? \"\",\n entityId: str(row.entity_id) ?? \"\",\n ownerId: str(row.owner_id),\n viewerIsOwner: bool(row.viewer_is_owner),\n organizationId: str(row.organization_id),\n organizationName: str(row.organization_name),\n canManage: bool(row.can_manage),\n isPublic: bool(row.is_public),\n orgReadable: bool(row.org_readable),\n directGrantCount: num(row.direct_grant_count),\n directGrants: grants\n .map(parseGrant)\n .filter((g): g is AccessDirectGrant => g !== null),\n memberCount: num(row.member_count),\n containers: containers\n .map(parseContainer)\n .filter((c): c is AccessContainer => c !== null),\n containerCount: num(row.container_count),\n };\n}\n\n/** Full effective-access explanation for one entity. Throws on RPC failure. */\nexport async function fetchAccessSummary(\n entityType: EntityTypeToken,\n entityId: string,\n): Promise<AccessSummary> {\n const supabase = createClient();\n const { data, error } = await supabase.rpc(\"entity_access_summary\", {\n p_type: entityType,\n p_id: entityId,\n });\n if (error) throw operationFailed(\"load the access summary\", error);\n return parseSummary(data);\n}\n\n/**\n * Display titles for a batch of ids of ONE entity token, resolved LIVE from the\n * owning table. Never render a denormalized association label instead — it goes\n * stale the moment the target is renamed. Ids the caller cannot view are\n * omitted by the RPC rather than leaked.\n *\n * DEDUP FLAG (associations W0-P1, 2026-08-29): this is sharing's own copy of a\n * title resolver; the scopes unit has the canonical cached one at\n * `features/scopes/service/entityTitles.ts` (which `AttachedItemsSheet` now\n * uses). The sharing node owns converging this copy onto that resolver (or a\n * shared home) — do not add new consumers here.\n */\nexport async function fetchEntityTitles(\n entityType: EntityTypeToken,\n ids: string[],\n): Promise<Map<string, string | null>> {\n const out = new Map<string, string | null>();\n const unique = Array.from(new Set(ids.filter(Boolean)));\n if (unique.length === 0) return out;\n\n const supabase = createClient();\n const { data, error } = await supabase.rpc(\"entity_titles\", {\n p_type: entityType,\n p_ids: unique,\n });\n if (error) throw operationFailed(\"load those titles\", error);\n for (const raw of Array.isArray(data) ? data : []) {\n const row = record(raw);\n const id = row ? str(row.id) : null;\n if (id) out.set(id, row ? str(row.title) : null);\n }\n return out;\n}\n\n/**\n * The honest one-line headline for an entity, given everything we know.\n * Shared by the info panel and anywhere else that must not overstate privacy.\n */\nexport function describeAccessSummary(summary: AccessSummary): string {\n if (summary.isPublic) return \"Published to the web — anyone can open it at its address\";\n\n const reasons: string[] = [];\n if (summary.orgReadable && summary.organizationName) {\n reasons.push(`everyone in ${summary.organizationName}`);\n }\n if (summary.directGrantCount > 0) {\n reasons.push(\n summary.directGrantCount === 1\n ? \"1 person or org it is shared with\"\n : `${summary.directGrantCount} people or orgs it is shared with`,\n );\n }\n for (const container of summary.containers) {\n const name = container.label ?? container.containerTypeLabel ?? \"a container\";\n if (container.orgReadable && container.organizationName) {\n reasons.push(`everyone in ${container.organizationName} (via ${name})`);\n } else if (container.memberCount > 0) {\n reasons.push(`members of ${name}`);\n } else {\n reasons.push(`anyone who can open ${name}`);\n }\n }\n\n if (reasons.length === 0) return \"Private — only you\";\n return `You, plus ${reasons.join(\", \")}`;\n}\n","\"use client\";\n\n/**\n * @ai-matrx/sharing/react — what the SHARE SHEET needs from its host's UI, injected ONCE at boot:\n *\n * configureShareSheetUi({ toast, useCurrentUserId, useOrganizations, CopyButtons, EntityRef, ... });\n *\n * The data half (database client, aidream calls, routes) is `configureSharing` in\n * `@ai-matrx/sharing/core`. Every field here has a WORKING default, so a host that supplies\n * nothing still gets a usable sheet (plain copy buttons, a plain name for the record, an email\n * field for finding a person, the organization's roster as contacts); a richer host (the web)\n * hands in its own pieces. A default is never a blank: where a host-only feature is absent the\n * default says so on screen.\n */\n\nimport { useCallback, useEffect, useMemo, useState, useSyncExternalStore, type ComponentType, type ReactNode } from \"react\";\nimport { Button, Input } from \"@ai-matrx/design-system\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\nimport { confirm as kitConfirm, type ConfirmOptions } from \"@ai-matrx/kit/confirm-opener\";\nimport { readOrganizationMemberRows } from \"@ai-matrx/sharing/core\";\nimport { shareClient as shareClientForIdentity } from \"@ai-matrx/sharing/core\";\nimport { createSupabaseIdentity } from \"@ai-matrx/vault\";\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype LooseProps = { [key: string]: any };\n\nexport interface ShareSheetOrganization {\n id: string;\n name: string;\n [key: string]: unknown;\n}\n\nexport interface ShareSheetConnection {\n user_id: string;\n email: string | null;\n display_name: string | null;\n avatar_url: string | null;\n source: \"conversation\" | \"organization\" | \"invitation\";\n sourceDetails?: string | undefined;\n}\n\nexport interface ShareSheetConnections {\n connections: ShareSheetConnection[];\n isLoading: boolean;\n error: string | null;\n partialFailures: string[];\n refresh: () => Promise<void> | void;\n}\n\nexport interface ShareSheetToastOptions {\n title?: ReactNode | undefined;\n description?: ReactNode | undefined;\n variant?: \"default\" | \"destructive\" | \"success\" | string | undefined;\n}\n\nexport interface ShareSheetUi {\n /** Messages. Default: `console` + `window.alert` for errors (never swallowed). */\n toast: (options: ShareSheetToastOptions) => void;\n /** The signed-in person's id. Default: read once from the sharing client's session. */\n useCurrentUserId: () => string | null;\n /** The organizations the person belongs to (`{id, name}`). Default: `organizations` read once. */\n useOrganizations: () => ShareSheetOrganization[];\n /** Contacts offered in the People tab. Default: the organization's roster. */\n useUserConnections: (options: { organizationId?: string }) => ShareSheetConnections;\n confirm: (options: ConfirmOptions) => Promise<boolean>;\n CopyButtons: ComponentType<LooseProps>;\n csvExportItem: (...args: any[]) => any;\n jsonExportItem: (...args: any[]) => any;\n usePageCapture: (build: () => unknown, options?: { enabled?: boolean }) => void;\n dialogCapture: (input: any) => unknown;\n PageCaptureButton: ComponentType<LooseProps>;\n ErrorAlchemyMenu: ComponentType<LooseProps>;\n InfoHint: ComponentType<LooseProps>;\n EntityDoorControls: ComponentType<LooseProps>;\n EntityRef: ComponentType<LooseProps>;\n UserAvatarDisplay: ComponentType<LooseProps>;\n ConnectionsReadNotice: ComponentType<LooseProps>;\n UserSearchField: ComponentType<LooseProps>;\n /** The vault identity the secure-link panel seals with (`@ai-matrx/vault`). */\n vaultIdentity: unknown;\n humanLines: (...args: any[]) => string;\n /** Where dialogs portal (the web: its pop-out window container). Default: the document body. */\n usePortalContainer: () => HTMLElement | null | undefined;\n}\n\n/* ─── defaults ───────────────────────────────────────────────────────────── */\n\nfunction DefaultCopyButtons(props: LooseProps) {\n const [done, setDone] = useState(false);\n const text = (): string => {\n const h = props.human ?? props.text;\n const v = typeof h === \"function\" ? h() : h;\n return Array.isArray(v) ? v.join(\"\\n\") : String(v ?? \"\");\n };\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className={props.className}\n onClick={() => {\n void copyText(text()).then(() => {\n setDone(true);\n setTimeout(() => setDone(false), 1500);\n });\n }}\n >\n {done ? \"Copied\" : props.label ? `Copy ${String(props.label).toLowerCase()}` : \"Copy\"}\n </Button>\n );\n}\n\nfunction DefaultErrorMenu(_props: LooseProps) {\n return null;\n}\n\nfunction DefaultInfoHint(props: LooseProps) {\n return (\n <span title={String(props.text ?? \"\")} aria-label={String(props.label ?? \"More info\")} className=\"cursor-help text-muted-foreground\">\n ⓘ\n </span>\n );\n}\n\nfunction DefaultEntityRef(props: LooseProps) {\n const href = typeof props.href === \"string\" ? props.href : null;\n return href ? <a href={href} className=\"underline-offset-2 hover:underline\">{String(props.name ?? \"\")}</a> : <span>{String(props.name ?? \"\")}</span>;\n}\n\nfunction DefaultUserAvatar(props: LooseProps) {\n const u = (props.user ?? {}) as { displayName?: string | undefined; email?: string | undefined; display_name?: string | undefined };\n const name = u.displayName ?? u.display_name ?? u.email ?? \"?\";\n return (\n <span className=\"inline-flex h-7 w-7 items-center justify-center rounded-full bg-muted text-xs font-medium\" aria-label={name}>\n {name.slice(0, 1).toUpperCase()}\n </span>\n );\n}\n\nfunction DefaultConnectionsNotice(props: LooseProps) {\n if (!props.error && !(Array.isArray(props.partialFailures) && props.partialFailures.length)) return null;\n return (\n <div className=\"rounded-md border border-destructive/30 bg-destructive/10 p-2 text-xs text-destructive\">\n {props.error ? `Contacts could not be read: ${String(props.error)}` : `Some contacts could not be read.`}{\" \"}\n {props.onRetry ? ( // ui-exception: moved verbatim from the web share sheet; restyling onto design-system Button is its own UI change\n <button type=\"button\" className=\"underline\" onClick={() => props.onRetry()}>\n Retry\n </button>\n ) : null}\n </div>\n );\n}\n\nfunction DefaultUserSearchField(props: LooseProps) {\n const { onValueChange, onUserSelect: _onUserSelect, value, ...rest } = props;\n return <Input {...rest} value={value ?? \"\"} onChange={(e: { target: { value: string } }) => onValueChange?.(e.target.value)} />;\n}\n\nconst ORGS_EMPTY: ShareSheetOrganization[] = [];\nlet orgsCache: ShareSheetOrganization[] | null = null;\nconst orgListeners = new Set<() => void>();\n\nfunction useDefaultOrganizations(): ShareSheetOrganization[] {\n const snapshot = useSyncExternalStore(\n (cb) => {\n orgListeners.add(cb);\n return () => orgListeners.delete(cb);\n },\n () => orgsCache ?? ORGS_EMPTY,\n () => ORGS_EMPTY,\n );\n useEffect(() => {\n if (orgsCache) return;\n orgsCache = ORGS_EMPTY;\n void import(\"@ai-matrx/sharing/core\").then(async ({ shareClient }) => {\n const { data, error } = await shareClient().from(\"organizations\").select(\"id, name\");\n if (error) console.error(`[share] Your organizations could not be read: ${error.message}`);\n orgsCache = (Array.isArray(data) ? (data as ShareSheetOrganization[]) : []).map((o) => ({ ...o, id: String(o.id), name: String(o.name ?? \"\") }));\n orgListeners.forEach((l) => l());\n }).catch((err: unknown) => console.error(\"[share] Your organizations could not be read:\", err));\n }, []);\n return snapshot;\n}\n\nfunction useDefaultCurrentUserId(): string | null {\n const [id, setId] = useState<string | null>(null);\n useEffect(() => {\n void import(\"@ai-matrx/sharing/core\").then(async ({ shareClient }) => {\n const { getClaimsUser } = await import(\"@ai-matrx/sharing/core\");\n const { data } = await getClaimsUser(shareClient());\n setId(data.user?.id ?? null);\n });\n }, []);\n return id;\n}\n\nfunction useDefaultConnections({ organizationId }: { organizationId?: string }): ShareSheetConnections {\n const [state, setState] = useState<{ rows: ShareSheetConnection[]; loading: boolean; error: string | null }>({ rows: [], loading: Boolean(organizationId), error: null });\n const load = useCallback(\n async (fresh = false) => {\n if (!organizationId) return;\n setState((s) => ({ ...s, loading: true }));\n try {\n const rows = await readOrganizationMemberRows(organizationId, { fresh });\n setState({\n rows: rows.map((r) => ({\n user_id: r.user_id,\n email: r.user_email ?? null,\n display_name: r.user_display_name ?? null,\n avatar_url: r.user_avatar_url ?? null,\n source: \"organization\" as const,\n })),\n loading: false,\n error: null,\n });\n } catch (err) {\n setState({ rows: [], loading: false, error: err instanceof Error ? err.message : String(err) });\n }\n },\n [organizationId],\n );\n useEffect(() => {\n void load();\n }, [load]);\n return useMemo(\n () => ({ connections: state.rows, isLoading: state.loading, error: state.error, partialFailures: [], refresh: () => load(true) }),\n [state, load],\n );\n}\n\nconst DEFAULTS: ShareSheetUi = {\n toast: ({ title, description, variant }) => {\n const text = [title, description].filter((x) => typeof x === \"string\").join(\" — \");\n if (variant === \"destructive\") {\n console.error(`[share] ${text}`);\n if (typeof window !== \"undefined\") window.alert(text);\n } else console.info(`[share] ${text}`);\n },\n useCurrentUserId: useDefaultCurrentUserId,\n useOrganizations: useDefaultOrganizations,\n useUserConnections: useDefaultConnections,\n confirm: (o) => kitConfirm(o),\n CopyButtons: DefaultCopyButtons,\n csvExportItem: () => null,\n jsonExportItem: () => null,\n usePageCapture: () => undefined,\n dialogCapture: (input) => input,\n PageCaptureButton: () => null,\n ErrorAlchemyMenu: DefaultErrorMenu,\n InfoHint: DefaultInfoHint,\n EntityDoorControls: () => null,\n EntityRef: DefaultEntityRef,\n UserAvatarDisplay: DefaultUserAvatar,\n ConnectionsReadNotice: DefaultConnectionsNotice,\n UserSearchField: DefaultUserSearchField,\n vaultIdentity: null,\n humanLines: (...args: unknown[]) => args.flat().filter(Boolean).map(String).join(\"\\n\"),\n usePortalContainer: () => undefined,\n};\n\nlet ui: ShareSheetUi = DEFAULTS;\n\n/** Merge host UI over the defaults (boot-time; tests may call it again). */\nexport function configureShareSheetUi(next: Partial<ShareSheetUi>): void {\n ui = { ...ui, ...next };\n}\n\nexport function shareSheetUi(): ShareSheetUi {\n return ui;\n}\n\n/* ─── the names the sheet's files import (web parity) ─────────────────────── */\n\nexport function useToast() {\n return { toast: (o: ShareSheetToastOptions) => ui.toast(o) };\n}\nexport const toast = {\n success: (message: string) => ui.toast({ title: message }),\n error: (message: string) => ui.toast({ title: message, variant: \"destructive\" }),\n info: (message: string) => ui.toast({ title: message }),\n};\nexport function copyNotify(message: string, kind: \"success\" | \"error\"): void {\n ui.toast({ title: message, ...(kind === \"error\" ? { variant: \"destructive\" } : {}) });\n}\nexport const confirm = (options: ConfirmOptions) => ui.confirm(options);\nexport const useCurrentUserId = () => ui.useCurrentUserId();\nexport const useNavTree = () => ({ orgs: ui.useOrganizations() });\nexport const useOrganizationsToCreateIn = () => ({ orgs: ui.useOrganizations() });\nexport const useUserConnections = (options: { organizationId?: string }) => ui.useUserConnections(options);\nexport type ConnectionUser = ShareSheetConnection;\nexport type UserSearchCandidate = {\n id: string;\n email: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n organizations?: string[] | undefined;\n source?: string | undefined;\n [key: string]: unknown;\n};\nexport const usePageCapture = (build: () => unknown, options?: { enabled?: boolean }) => ui.usePageCapture(build, options);\nexport const dialogCapture = (input: unknown) => ui.dialogCapture(input);\nexport const csvExportItem = (...args: any[]) => ui.csvExportItem(...args);\nexport const jsonExportItem = (...args: any[]) => ui.jsonExportItem(...args);\nexport const humanLines = (...args: any[]) => ui.humanLines(...args);\nexport const CopyButtons = (p: LooseProps) => <ui.CopyButtons {...p} />;\nexport const PageCaptureButton = (p: LooseProps) => <ui.PageCaptureButton {...p} />;\nexport const ErrorAlchemyMenu = (p: LooseProps) => <ui.ErrorAlchemyMenu {...p} />;\nexport const InfoHint = (p: LooseProps) => <ui.InfoHint {...p} />;\nexport const EntityDoorControls = (p: LooseProps) => <ui.EntityDoorControls {...p} />;\nexport const EntityRef = (p: LooseProps) => <ui.EntityRef {...p} />;\nexport const UserAvatarDisplay = (p: LooseProps) => <ui.UserAvatarDisplay {...p} />;\nexport const ConnectionsReadNotice = (p: LooseProps) => <ui.ConnectionsReadNotice {...p} />;\nexport const UserSearchField = (p: LooseProps) => <ui.UserSearchField {...p} />;\nlet defaultIdentity: unknown = null;\n/** The vault identity: the host's, else one built on the sharing client's own auth session. */\nexport const usePortalContainer = () => ui.usePortalContainer();\nexport const vaultIdentity = (): any => {\n if (ui.vaultIdentity) return ui.vaultIdentity;\n if (!defaultIdentity) {\n defaultIdentity = createSupabaseIdentity(shareClientForIdentity().auth as any, {\n redirectTo: () => window.location.href,\n onDifferentPerson: async (message: string) => {\n window.alert(message);\n },\n });\n }\n return defaultIdentity;\n};\n\n/* ─── the sheet's per-tab cache (was the web's redux sharingStatus slice) ─── */\n\ninterface SharingStatusEntry {\n visibility: any;\n loading: boolean;\n error: string | null;\n}\ninterface SharingAuthorityEntry {\n isOwner: boolean;\n loading: boolean;\n error: string | null;\n}\ninterface SharingStatusState {\n sharingStatus: { byKey: Record<string, SharingStatusEntry>; authorityByKey: Record<string, SharingAuthorityEntry> };\n}\ntype Action = { type: string; payload: any };\n\nlet state: SharingStatusState = { sharingStatus: { byKey: {}, authorityByKey: {} } };\nconst listeners = new Set<() => void>();\n\nfunction reduce(s: SharingStatusState[\"sharingStatus\"], a: Action): SharingStatusState[\"sharingStatus\"] {\n const { key } = a.payload as { key: string };\n const byKey = { ...s.byKey };\n const authorityByKey = { ...s.authorityByKey };\n switch (a.type) {\n case \"requested\":\n byKey[key] = { visibility: byKey[key]?.visibility ?? null, loading: true, error: null };\n break;\n case \"loaded\":\n byKey[key] = { visibility: a.payload.visibility, loading: false, error: null };\n break;\n case \"failed\":\n byKey[key] = { visibility: byKey[key]?.visibility ?? null, loading: false, error: a.payload.error };\n break;\n case \"authorityRequested\":\n authorityByKey[key] = { isOwner: authorityByKey[key]?.isOwner ?? false, loading: true, error: authorityByKey[key]?.error ?? null };\n break;\n case \"authorityResolved\":\n authorityByKey[key] = { isOwner: a.payload.isOwner, loading: false, error: a.payload.error };\n break;\n }\n return { byKey, authorityByKey };\n}\n\nconst store = {\n getState: () => state,\n dispatch: (a: Action) => {\n state = { sharingStatus: reduce(state.sharingStatus, a) };\n listeners.forEach((l) => l());\n return a;\n },\n};\n\nexport const useAppStore = () => store;\nexport function useAppSelector<T>(select: (s: SharingStatusState) => T): T {\n return useSyncExternalStore(\n (cb) => {\n listeners.add(cb);\n return () => listeners.delete(cb);\n },\n () => select(state),\n () => select(state),\n );\n}\nexport const sharingStatusKey = (resourceType: string, resourceId: string) => `${resourceType}:${resourceId}`;\nexport const sharingStatusRequested = (payload: { key: string }): Action => ({ type: \"requested\", payload });\nexport const sharingStatusLoaded = (payload: { key: string; visibility: unknown }): Action => ({ type: \"loaded\", payload });\nexport const sharingStatusFailed = (payload: { key: string; error: string }): Action => ({ type: \"failed\", payload });\nexport const sharingAuthorityRequested = (payload: { key: string }): Action => ({ type: \"authorityRequested\", payload });\nexport const sharingAuthorityResolved = (payload: { key: string; isOwner: boolean; error: string | null }): Action => ({ type: \"authorityResolved\", payload });\nexport const selectSharingStatus = (s: SharingStatusState, key: string): SharingStatusEntry | undefined => s.sharingStatus.byKey[key];\nexport const selectSharingAuthority = (s: SharingStatusState, key: string): SharingAuthorityEntry | undefined => s.sharingStatus.authorityByKey[key];\n\n/** Test seam: forget every cached answer. */\nexport function resetShareSheetCache(): void {\n state = { sharingStatus: { byKey: {}, authorityByKey: {} } };\n listeners.forEach((l) => l());\n}\n\n/** web parity: the store-read hook the access summary used (kept per tab, re-read when stale). */\nconst storeReads = new Map<string, { data: unknown; at: number }>();\nexport function useStoreRead<T>(key: string | null, read: () => Promise<T>, options: { enabled?: boolean; staleAfterMs?: number } = {}) {\n const activeKey = options.enabled === false ? null : key;\n const kept = activeKey ? storeReads.get(activeKey) : undefined;\n const [s, setS] = useState<{ data: T | undefined; loading: boolean; error: string | null }>({\n data: kept?.data as T | undefined,\n loading: Boolean(activeKey) && !kept,\n error: null,\n });\n const refresh = useCallback(async () => {\n if (!activeKey) return;\n setS((p) => ({ ...p, loading: true }));\n try {\n const data = await read();\n storeReads.set(activeKey, { data, at: Date.now() });\n setS({ data, loading: false, error: null });\n } catch (err) {\n setS((p) => ({ data: p.data, loading: false, error: err instanceof Error ? err.message : String(err) }));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeKey]);\n useEffect(() => {\n if (!activeKey) return;\n const k = storeReads.get(activeKey);\n const stale = !k || (options.staleAfterMs !== undefined && Date.now() - k.at > options.staleAfterMs);\n if (stale) void refresh();\n else setS({ data: k.data as T, loading: false, error: null });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeKey, refresh]);\n return { data: s.data, isLoading: s.loading, isError: s.error !== null, error: s.error, refresh };\n}\nexport function useRefreshWhenChanged(token: unknown, refresh: () => Promise<void>): void {\n const [first, setFirst] = useState(true);\n useEffect(() => {\n if (first) {\n setFirst(false);\n return;\n }\n void refresh();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [token]);\n}\n\n/** web parity: `useAppDispatch()` for the secure-delivery calls — a dispatch that hands the call back. */\nexport { passThroughDispatch } from \"@ai-matrx/sharing/core\";\nexport const useAppDispatch = () => passThroughDispatchRef;\nimport { passThroughDispatch as passThroughDispatchRef } from \"@ai-matrx/sharing/core\";\n","/**\n * features/sharing/format.ts\n *\n * The ONE set of human summaries + rendered-view extractors for every sharing\n * surface (grant rows, the reachability summary, public state, the whole access\n * panel). Consumed by `PermissionsList`, `AccessSummaryPanel`, the share tabs,\n * and any page that composes them — never duplicated at a callsite.\n *\n * THE WHAT-I-SEE LAW (agent-copy skill): these builders return the RENDERED\n * surface converted to data, not the raw rows behind it. Where the panel shows\n * a sentence, the payload carries that same sentence verbatim — including the\n * red ones. A user copying an access surface is asking an agent \"why can't this\n * person see this, and what do I change?\", so denials and errors are the\n * highest-value content here, not a footnote.\n *\n * `accessReasonRows` is deliberately the SAME function `AccessSummaryPanel`\n * renders from: mirror the view's extractor, never re-derive it beside the view.\n */\n\nimport { humanLines } from \"../react/sheet/host\";\nimport {\n describeAccessSummary,\n type AccessContainer,\n type AccessSummary,\n} from \"./accessSummary\";\nimport type { PermissionWithDetails } from \"./types\";\nimport { getResourceTypeLabel } from \"./registry\";\n\n/** Location line for every sharing payload. */\nexport function sharingLocation(surface: string): string {\n return `AI Matrx — Sharing — ${surface}`;\n}\n\n// ---------------------------------------------------------------------------\n// The page KPIs\n// ---------------------------------------------------------------------------\n\n/**\n * The numbers an access surface LEADS with — the tab counts, the public dot,\n * and (when the reachability summary is on screen) who can open it and its reason\n * count. Every payload from such a surface carries these verbatim, in the body\n * AND the envelope attributes, so the agent never recomputes what the user is\n * already looking at.\n *\n * `null` means \"not resolved / not rendered\", which is itself information: it\n * is the difference between \"nobody owns this\" and \"we could not find out\".\n */\nexport interface AccessKpis {\n user_grants: number;\n org_grants: number;\n public_grants: number;\n total_grants: number;\n is_public: boolean;\n /** null while ownership is loading or failed to resolve. */\n viewer_is_owner: boolean | null;\n /** Who can open it without a share, as the summary line reads, when the summary is on screen. */\n reach: string | null;\n /** True when every member of its organization can open it. */\n org_readable: boolean | null;\n /** How many distinct REASONS grant access (the summary's reason rows). */\n reachability_reasons: number | null;\n /** Containers that convey access (scopes, projects, data stores…). */\n container_count: number | null;\n [key: string]: string | number | boolean | null | undefined;\n}\n\nexport function accessKpis(input: {\n permissions: PermissionWithDetails[];\n isPublic: boolean;\n /** null while unresolved — never coerce an unknown owner to false. */\n viewerIsOwner: boolean | null;\n /** The reachability summary, when this surface renders one. */\n summary?: AccessSummary | null | undefined;\n /** The entity type, needed to phrase the reason rows the way the UI does. */\n entityType?: string | undefined;\n}): AccessKpis {\n const { permissions, isPublic, viewerIsOwner, summary, entityType } = input;\n const userGrants = permissions.filter((p) => p.grantedToUserId).length;\n const orgGrants = permissions.filter(\n (p) => p.grantedToOrganizationId,\n ).length;\n const publicGrants = permissions.filter((p) => p.isPublic).length;\n return {\n user_grants: userGrants,\n org_grants: orgGrants,\n public_grants: publicGrants,\n total_grants: permissions.length,\n is_public: isPublic,\n viewer_is_owner: viewerIsOwner,\n reach: summary ? summaryReachLabel(summary) : null,\n org_readable: summary ? summary.orgReadable : null,\n reachability_reasons: summary\n ? accessReasonRows(summary, entityType ?? summary.entityType).length\n : null,\n container_count: summary ? summary.containers.length : null,\n };\n}\n\n/** Identity + KPIs every sharing payload needs to be interpretable. */\nexport interface SharingCopyContext {\n /** Entity/resource token, e.g. \"web_site\". */\n resourceType: string;\n resourceId: string;\n resourceName?: string | null | undefined;\n /** Where the user is, in words — e.g. \"Site access — example.com\". */\n surface: string;\n /** The page's leading KPIs, mirrored verbatim into every payload. */\n kpis: AccessKpis;\n}\n\n/**\n * A sentence the surface actually RENDERED — a denial, a blocker, a warning, a\n * plain-state note. Captured verbatim; never paraphrased into the payload.\n */\nexport interface AccessNotice {\n tone: \"error\" | \"warning\" | \"info\";\n /** The exact rendered text. */\n text: string;\n /** Which part of the surface rendered it. */\n where: string;\n}\n\nexport function humanNotices(notices: AccessNotice[]): string {\n if (notices.length === 0) return \"No errors or blockers are shown.\";\n return notices\n .map((n) => `[${n.tone.toUpperCase()}] ${n.where}: ${n.text}`)\n .join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Grant rows — what PermissionsList renders\n// ---------------------------------------------------------------------------\n\nexport type GranteeKind = \"user\" | \"organization\" | \"public\";\n\nexport function granteeKind(permission: PermissionWithDetails): GranteeKind {\n if (permission.isPublic) return \"public\";\n if (permission.grantedToOrganization || permission.grantedToOrganizationId)\n return \"organization\";\n return \"user\";\n}\n\n/** The row's primary line, exactly as PermissionsList renders it. */\nexport function granteeLabel(permission: PermissionWithDetails): string {\n if (permission.isPublic) return \"Everyone\";\n if (permission.grantedToUser) {\n return (\n permission.grantedToUser.displayName || permission.grantedToUser.email\n );\n }\n if (permission.grantedToOrganization)\n return permission.grantedToOrganization.name;\n return \"Unknown\";\n}\n\n/** The row's secondary line (the email, when a display name took the first). */\nexport function granteeSecondaryLabel(\n permission: PermissionWithDetails,\n): string | null {\n if (permission.grantedToUser?.displayName) {\n return permission.grantedToUser.email;\n }\n return null;\n}\n\n/**\n * The badge text the row shows a non-owner. Owners see a level SELECT with the\n * same value, so this doubles as the level label in both modes.\n */\nexport function grantLevelLabel(permission: PermissionWithDetails): string {\n if (permission.isPublic) return \"Published to the web\";\n const level = permission.permissionLevel;\n return level.charAt(0).toUpperCase() + level.slice(1);\n}\n\nexport function humanGrantRow(permission: PermissionWithDetails): string {\n return humanLines([\n [\"Grantee\", granteeLabel(permission)],\n [\"Email\", granteeSecondaryLabel(permission)],\n [\"Grantee type\", granteeKind(permission)],\n [\"Level\", grantLevelLabel(permission)],\n [\"Grantee id\", permission.grantedToUserId ?? permission.grantedToOrganizationId],\n [\"Resource\", `${permission.resourceType}:${permission.resourceId}`],\n [\"Granted at\", permission.createdAt ? String(permission.createdAt) : null],\n [\"Grant id\", permission.id],\n ]);\n}\n\n/** One flat row for CSV export. */\nexport function grantCsvRow(\n permission: PermissionWithDetails,\n): Record<string, unknown> {\n return {\n grantee: granteeLabel(permission),\n grantee_email: granteeSecondaryLabel(permission) ?? \"\",\n grantee_type: granteeKind(permission),\n level: permission.permissionLevel,\n is_public: permission.isPublic ?? false,\n grantee_user_id: permission.grantedToUserId ?? \"\",\n grantee_organization_id: permission.grantedToOrganizationId ?? \"\",\n resource_type: permission.resourceType,\n resource_id: permission.resourceId,\n granted_at: permission.createdAt ? String(permission.createdAt) : \"\",\n grant_id: permission.id,\n };\n}\n\nexport function grantCsvRows(\n permissions: PermissionWithDetails[],\n): Array<Record<string, unknown>> {\n return permissions.map(grantCsvRow);\n}\n\n/**\n * The empty state PermissionsList renders — copied verbatim, because \"no one\n * has been granted access here\" is frequently the whole answer to \"why can't\n * they see this?\".\n */\nexport const NO_GRANTS_HEADLINE = \"Not shared with anyone\";\n\n/**\n * 🚨 THE SAME EMPTY STATE WHEN SOMETHING ELSE IS PENDING ON THE SAME SCREEN\n * (FIX-10C, VERIFIER-10 F13, 2026-09-22).\n *\n * \"Not shared with anyone\" stood directly above an invited person's row, and a\n * screen that contradicts itself is worse than either sentence alone. An\n * invitation is genuinely not a grant — it confers nothing until it is\n * accepted — so the list does not start counting invitations. It says the\n * narrower, still-true thing: nobody has access YET.\n */\nexport const NO_GRANTS_YET_HEADLINE = \"Nobody has access yet\";\nexport const NO_GRANTS_DETAIL = \"No one has been granted access here\";\n\n/**\n * A DIRECT-GRANT list can only ever say what was granted HERE. It cannot see\n * its table's level, publishing, org membership, or access conveyed through a container, so every\n * payload it emits says so out loud — otherwise an agent reads \"0 grants\" as\n * \"nobody can see it\" and tells the user to grant access they already have.\n */\nexport const GRANT_LIST_SCOPE_NOTE =\n \"This list covers DIRECT grants on this resource only. Access can also come from ownership, its table's level (every member of an Organization record's organization), publishing to the web, organization membership, or a container (scope, project, data store) that conveys it — see the access summary for the complete picture.\";\n\nexport function humanGrantList(\n permissions: PermissionWithDetails[],\n options: { surface: string; shown?: number | undefined } = { surface: \"Sharing\" },\n): string {\n const header = `Current access — ${permissions.length} direct grant${\n permissions.length === 1 ? \"\" : \"s\"\n } (${options.surface})`;\n if (permissions.length === 0) {\n return [\n header,\n `${NO_GRANTS_HEADLINE} — ${NO_GRANTS_DETAIL}`,\n GRANT_LIST_SCOPE_NOTE,\n ].join(\"\\n\");\n }\n const shownNote =\n options.shown != null && options.shown < permissions.length\n ? `\\n(${options.shown} of ${permissions.length} rows are visible on screen; this copy covers all ${permissions.length}.)`\n : \"\";\n return [\n header,\n permissions\n .map((p) => `- ${humanGrantRow(p).replaceAll(\"\\n\", \" · \")}`)\n .join(\"\\n\"),\n GRANT_LIST_SCOPE_NOTE + shownNote,\n ].join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// The reachability summary — what AccessSummaryPanel renders\n// ---------------------------------------------------------------------------\n\n/**\n * 🚨 WHO CAN OPEN IT, AND THE HEADLINE, ARE ONE TRUTH (lane RECORDS-UI-FIX, guide re-walk\n * 2026-09-23; access ladder T-13). The line reads what the record actually reaches — published to\n * the web, every member of its organization, or only its owner and the people named — from the same\n * summary the headline reads, so the two can never disagree. Who may open a record without a share\n * is its table's level, never a row setting (\"Shown to\" only decides which lists show it).\n */\nexport function summaryReachLabel(summary: AccessSummary): string {\n if (summary.isPublic) return \"Published to the web — anyone can open it at its address\";\n if (summary.orgReadable) {\n return `Every member of ${summary.organizationName ?? \"its organization\"} can open it`;\n }\n return \"Only its owner and the people it is shared with\";\n}\n\nexport function isPrivateSummary(summary: AccessSummary): boolean {\n return (\n !summary.isPublic &&\n !summary.orgReadable &&\n summary.directGrantCount === 0 &&\n summary.containers.length === 0\n );\n}\n\nexport function containerTitle(container: AccessContainer): string {\n const kind = container.containerTypeLabel ?? container.containerType;\n return container.label ? `${container.label} (${kind})` : kind;\n}\n\nexport function containerDetail(container: AccessContainer): string {\n const parts: string[] = [`grants ${container.level}`];\n if (container.orgReadable && container.organizationName) {\n parts.push(`readable by everyone in ${container.organizationName}`);\n } else if (container.memberCount > 0) {\n parts.push(\n container.memberCount === 1\n ? \"1 member\"\n : `${container.memberCount} members`,\n );\n }\n return parts.join(\" · \");\n}\n\n/** One rendered reason row — the part users act on. */\nexport interface AccessReasonRow {\n /** Stable key for React + payload correlation. */\n id: string;\n kind: \"organization\" | \"direct-grants\" | \"container\";\n title: string;\n detail: string;\n /** Present for container reasons, so the agent can name what to detach. */\n containerType?: string | undefined;\n containerId?: string | undefined;\n}\n\n/** The person-facing noun for an entity token (\"udt_document\" reads \"document\", never the raw token). */\nexport function recordNoun(entityType: string): string {\n const label = getResourceTypeLabel(entityType);\n return (label === entityType ? entityType.replace(/^udt_/, \"\").replace(/_/g, \" \") : label).toLowerCase();\n}\n\n/**\n * THE reason list — rendered by `AccessSummaryPanel` AND copied by every\n * payload that includes it. One extractor, two consumers; the export can never\n * drift from the screen.\n */\nexport function accessReasonRows(\n summary: AccessSummary,\n entityType: string,\n): AccessReasonRow[] {\n const rows: AccessReasonRow[] = [];\n\n if (summary.orgReadable && summary.organizationName) {\n rows.push({\n id: \"org-readable\",\n kind: \"organization\",\n title: `Everyone in ${summary.organizationName}`,\n detail: `Every member of that organization can open this ${recordNoun(entityType)}`,\n });\n }\n\n if (summary.directGrantCount > 0) {\n rows.push({\n id: \"direct-grants\",\n kind: \"direct-grants\",\n title:\n summary.directGrantCount === 1\n ? \"1 direct share\"\n : `${summary.directGrantCount} direct shares`,\n detail:\n summary.canManage && summary.directGrants.length > 0\n ? summary.directGrants\n .map((g) => `${g.granteeLabel ?? g.granteeType} · ${g.level}`)\n .join(\", \")\n : \"Open the Share tab to manage\",\n });\n }\n\n for (const container of summary.containers) {\n rows.push({\n id: `${container.containerType}:${container.containerId}`,\n kind: \"container\",\n title: containerTitle(container),\n detail: containerDetail(container),\n containerType: container.containerType,\n containerId: container.containerId,\n });\n }\n\n return rows;\n}\n\n/** The closing line the panel renders when nothing grants access. */\nexport const NOTHING_ELSE_GRANTS = \"Nothing else grants access to this yet.\";\n\n/** The panel's rendered error headline, verbatim. */\nexport const ACCESS_SUMMARY_ERROR_HEADLINE = \"Couldn’t determine access\";\n\n/**\n * The reachability panel as DATA — every line it puts on screen, in order.\n * This is the payload body; the raw `AccessSummary` rides along beside it so\n * nothing is lost.\n */\nexport interface AccessSummaryView {\n reach_label: string;\n headline: string;\n reasons: AccessReasonRow[];\n nothing_else_grants: string | null;\n raw: AccessSummary;\n}\n\nexport function accessSummaryView(\n summary: AccessSummary,\n entityType: string,\n): AccessSummaryView {\n return {\n reach_label: summaryReachLabel(summary),\n headline: describeAccessSummary(summary),\n reasons: accessReasonRows(summary, entityType),\n nothing_else_grants: isPrivateSummary(summary) ? NOTHING_ELSE_GRANTS : null,\n raw: summary,\n };\n}\n\nexport function humanAccessSummary(\n summary: AccessSummary,\n entityType: string,\n): string {\n const view = accessSummaryView(summary, entityType);\n return [\n `Who can see this, and why:`,\n `- Who can open it: ${view.reach_label}`,\n `- ${view.headline}`,\n view.reasons.length\n ? view.reasons\n .map((r) => `- ${r.title}${r.detail ? ` — ${r.detail}` : \"\"}`)\n .join(\"\\n\")\n : null,\n view.nothing_else_grants ? `- ${view.nothing_else_grants}` : null,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\n/** Reason rows as flat CSV rows. */\nexport function reasonCsvRows(\n rows: AccessReasonRow[],\n): Array<Record<string, unknown>> {\n return rows.map((r) => ({\n kind: r.kind,\n reason: r.title,\n detail: r.detail,\n container_type: r.containerType ?? \"\",\n container_id: r.containerId ?? \"\",\n }));\n}\n\n// ---------------------------------------------------------------------------\n// Public state — what PublicAccessTab renders\n// ---------------------------------------------------------------------------\n\n// ---------------------------------------------------------------------------\n// The whole access panel\n// ---------------------------------------------------------------------------\n\n/**\n * Everything an access surface shows, as one payload body. Built by the page\n * that composes the sharing components, from LIVE state at click time.\n */\nexport interface AccessPanelView {\n resource: {\n type: string;\n id: string;\n name?: string | null | undefined;\n };\n kpis: AccessKpis;\n /** The tab the user is actually looking at. */\n active_tab?: string | undefined;\n /** Every error / blocker / notice rendered right now, verbatim. */\n notices: AccessNotice[];\n access_summary: AccessSummaryView | null;\n /** Present instead of `access_summary` when the summary failed to load. */\n access_summary_error: string | null;\n user_grants: PermissionWithDetails[];\n org_grants: PermissionWithDetails[];\n public_grant: PermissionWithDetails | null;\n is_public: boolean;\n scope_note: string;\n}\n\nexport function humanAccessPanel(view: AccessPanelView): string {\n const k = view.kpis;\n return [\n `Access — ${view.resource.name ?? view.resource.type} (${view.resource.type}:${view.resource.id})`,\n view.active_tab ? `Tab on screen: ${view.active_tab}` : null,\n `KPIs: ${k.user_grants} user grant${k.user_grants === 1 ? \"\" : \"s\"} · ${k.org_grants} org grant${k.org_grants === 1 ? \"\" : \"s\"} · ${k.is_public ? \"public\" : \"not public\"} · owner: ${\n k.viewer_is_owner === null ? \"unresolved\" : k.viewer_is_owner ? \"you\" : \"not you\"\n }`,\n \"\",\n \"ERRORS & BLOCKERS ON SCREEN:\",\n humanNotices(view.notices),\n \"\",\n view.access_summary_error\n ? `${ACCESS_SUMMARY_ERROR_HEADLINE}: ${view.access_summary_error}`\n : view.access_summary\n ? humanAccessSummaryFromView(view.access_summary)\n : \"The access summary is not on screen.\",\n \"\",\n humanGrantList(view.user_grants, { surface: \"Users tab\" }),\n \"\",\n humanGrantList(view.org_grants, { surface: \"Organizations tab\" }),\n \"\",\n `Public: ${view.is_public ? \"open to everyone\" : \"not open to everyone\"}`,\n ]\n .filter((line) => line !== null)\n .join(\"\\n\");\n}\n\nfunction humanAccessSummaryFromView(view: AccessSummaryView): string {\n return [\n `Who can see this, and why:`,\n `- Who can open it: ${view.reach_label}`,\n `- ${view.headline}`,\n ...view.reasons.map(\n (r) => `- ${r.title}${r.detail ? ` — ${r.detail}` : \"\"}`,\n ),\n view.nothing_else_grants ? `- ${view.nothing_else_grants}` : null,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n","import type { ShareLink } from \"./shareLinks\";\n\n/** A deliberately title-free message for handing a canonical link to a person. */\nexport function createSafeShareMessage(url: string): string {\n return `I shared an AI Matrx item with you: ${url}`;\n}\n\n/** Refuses links the canonical resolver would reject or exhaust. */\nexport function shareLinkUnavailableReason(\n link: Pick<ShareLink, \"isActive\" | \"expiresAt\" | \"maxUses\" | \"useCount\">,\n now = Date.now(),\n): string | null {\n if (!link.isActive) return \"This link has been turned off.\";\n\n if (link.expiresAt !== null) {\n const expiresAt = Date.parse(link.expiresAt);\n if (!Number.isFinite(expiresAt))\n return \"This link's expiry can't be verified.\";\n if (expiresAt <= now) return \"This link has expired.\";\n }\n\n if (link.maxUses !== null && link.useCount >= link.maxUses) {\n return \"This link has reached its view limit.\";\n }\n\n return null;\n}\n\nexport function shareLinkSecurityStateMatches(\n a: ShareLink,\n b: ShareLink,\n): boolean {\n const expiryMatches =\n a.expiresAt === null || b.expiresAt === null\n ? a.expiresAt === b.expiresAt\n : Date.parse(a.expiresAt) === Date.parse(b.expiresAt);\n\n return (\n a.id === b.id &&\n a.token === b.token &&\n a.shortToken === b.shortToken &&\n a.permissionLevel === b.permissionLevel &&\n a.isActive === b.isActive &&\n expiryMatches &&\n a.maxUses === b.maxUses &&\n a.useCount === b.useCount\n );\n}\n\n/**\n * A refreshed inactive/expired/exhausted link must be rejected before asking\n * the owner to review changed fields; otherwise the dialog can imply access\n * that has already been revoked.\n */\nexport function evaluateShareLinkHandoff(\n reviewed: ShareLink,\n current: ShareLink,\n):\n | { status: \"unavailable\"; reason: string }\n | { status: \"changed\" }\n | { status: \"ready\" } {\n const unavailableReason = shareLinkUnavailableReason(current);\n if (unavailableReason)\n return { status: \"unavailable\", reason: unavailableReason };\n if (!shareLinkSecurityStateMatches(reviewed, current)) {\n return { status: \"changed\" };\n }\n return { status: \"ready\" };\n}\n\nexport function describeShareLinkAccess(\n permissionLevel: ShareLink[\"permissionLevel\"],\n): string {\n return `Anyone with the link: ${permissionLevel} access`;\n}\n\nexport function describeShareLinkExpiry(expiresAt: string | null): string {\n if (expiresAt === null) return \"Does not expire\";\n const date = new Date(expiresAt);\n if (!Number.isFinite(date.getTime())) return \"Expiry could not be verified\";\n return `Expires ${date.toLocaleString()}`;\n}\n","\"use client\";\n\n// features/sharing/outside/outsideShareService.ts\n//\n// SHARING A TABLE WITH SOMEBODY OUTSIDE THE ORGANIZATION — the client half.\n//\n// THE EVERYDAY CASE. A plumber gives ONE customer read-only access to the Jobs\n// table. A lab shares one experiments table with a collaborator at another\n// university. Until 21 September the store refused it, in a good sentence, and\n// the Share dialog offered no way forward from that sentence.\n//\n// 🚨 THIS FILE DECIDES NOTHING. Every one of these is a thin call on a declared\n// client door (`platform.client_callable_door`, declared by SHARE-OUT). The\n// store decides who may invite, at what level, and what an outside person can\n// then see — through THE ONE LADDER, the same one that answers for a colleague.\n// A second opinion here would be a second answer to \"who can see this\", which\n// is the one question a platform may not answer twice.\n//\n// WHY THE DOORS AND NOT `iam.invitations` DIRECTLY: the invitation carries the\n// table grant, and the accept writes it. Reading or writing that table from the\n// browser would put the decision in the client.\n\nimport { createClient } from \"./host\";\n\n/**\n * THE STORE'S SCHEMA IS NOT IN `types/database.types.ts`, AND THAT IS CORRECT —\n * the reasoning is written out in full in `features/forms/service.ts`, and\n * `features/portals/service.ts` and `features/booking/service.ts` reach the\n * store the same way. Schema `custom` is reached through its DOORS, so the cast\n * happens HERE, once, named — and every answer shape is declared above, so a\n * door that changes what it answers shows up as a type error rather than as a\n * wrong screen.\n */\ntype StoreCaller = {\n rpc(\n fn: string,\n args: Record<string, unknown>,\n ): PromiseLike<{\n data: unknown;\n error: { message: string; hint?: string | null | undefined; code?: string | null | undefined } | null;\n }>;\n};\n\n/** One rung this person may actually hand out, in the store's own words. */\nexport interface OutsideShareLevel {\n level: string;\n label: string;\n means: string;\n}\n\n/** One outside person on this table, joined or not. */\nexport interface OutsideShareInvitation {\n invitation_id: string;\n email: string;\n level: string;\n level_label: string;\n status: string;\n /** `false` is the \"invited, not yet joined\" state the dialog draws. */\n joined: boolean;\n say: string;\n expires_at: string | null;\n invited_at: string;\n expired: boolean;\n /**\n * 🚨 THE LINK THE SHARER CAN HAND OVER THEMSELVES — the ordinary case, not a\n * fallback. A plumber texts his customer the link; a lab emails a\n * collaborator from their own address. `null` when the row has been accepted\n * (nothing left to open) or when this viewer may not invite.\n */\n accept_path: string | null;\n}\n\n/**\n * WHETHER THIS SERVER CAN ACTUALLY SEND AN EMAIL — three answers, never two.\n *\n * The browser cannot know whether `RESEND_API_KEY` is set on the server, so the\n * server stamps what its channel adapters found at boot\n * (`communication.channel_readiness`) and the door reads the stamp. `unknown`\n * means NOBODY HAS CHECKED — deliberately not `configured: false`, so \"we could\n * not look\" can never be drawn as \"email is off\".\n */\nexport interface ChannelReadiness {\n channel: string;\n answer: \"yes\" | \"no\" | \"unknown\";\n configured: boolean | null;\n checked_at: string | null;\n detail?: string | undefined;\n say: string;\n}\n\n/** What actually happened to the message, and the link either way. */\nexport interface OutsideShareDelivery {\n accept_path: string;\n queued: string[];\n skipped: { channel: string; why: string }[];\n email_answer: ChannelReadiness[\"answer\"];\n say: string;\n}\n\n/** Everything the dialog needs to draw itself without guessing anything. */\nexport interface OutsideShareState {\n /** False only when an administrator of this organization turned outside sharing off. */\n lane_open: boolean;\n /** May THIS viewer invite an outside person to THIS table? */\n may_invite: boolean;\n /**\n * Still answered by the store; deliberately NOT drawn (SHARE-GATE-OFF). The\n * outside lane is on by default and is an administrator's setting, never a\n * control in the share flow.\n */\n may_open_lane: boolean;\n /** The level this viewer holds on the table. `null` means none. */\n my_level: string | null;\n /** The rungs they may give — already capped at `my_level` by the store. */\n levels: OutsideShareLevel[];\n who: string;\n invitations: OutsideShareInvitation[];\n /** One sentence for the person, whatever the state. Never a knob key. */\n say: string;\n /** What this server can actually do about email, observed and stamped. */\n email_delivery: ChannelReadiness;\n /** That answer as one sentence — and it ALWAYS names the copy-the-link route. */\n email_say: string;\n}\n\nfunction custom(): StoreCaller {\n return (createClient() as unknown as { schema(name: string): StoreCaller }).schema(\"custom\");\n}\n\nexport async function readOutsideShare(\n organizationId: string,\n tableId: string,\n): Promise<OutsideShareState> {\n const { data, error } = await custom().rpc(\"table_share_outside\", {\n p_organization_id: organizationId,\n p_table_id: tableId,\n });\n if (error) throw new Error(error.message);\n return data as unknown as OutsideShareState;\n}\n\n/**\n * What the outside share answered. THREE outcomes, one door (MOVE-AND-OUTSIDER,\n * VERIFIER-19 finding 3).\n *\n * `custom.table_share_outside_grant` (G14) decides who the address is:\n * · an ACCOUNT OUTSIDE the organization — granted at once (`granted: true`,\n * `person: \"outside_account\"`), told so by notification, no link, no\n * \"not yet joined\". Notion and Airtable give an existing account access the\n * moment it is named, and so do we;\n * · a MEMBER of the organization — granted like a colleague (`person: \"member\"`);\n * · an address NOBODY signed up with — the invitation, with its link\n * (`invited: true`, `person: \"no_account\"`): the only case a link is needed.\n * Until this lane the dialog called `table_share_outside_invite` for everyone, so\n * an existing account got an invitation and, opening the table, read \"You have\n * not been given this table\".\n */\nexport interface OutsideInviteAnswer {\n /** An `iam.invitations` row was written and a link minted (no account yet). */\n invited: boolean;\n /** They were given the table outright (an existing account, inside or out). */\n granted: boolean;\n /** Who the store found the address to be. */\n person?: \"outside_account\" | \"member\" | \"no_account\" | undefined;\n say: string;\n /** Null when nobody was invited — an invitation that did not happen has no link. */\n accept_path: string | null;\n delivery: OutsideShareDelivery | null;\n}\n\nexport async function shareWithOutsidePerson(\n organizationId: string,\n tableId: string,\n email: string,\n level: string,\n): Promise<OutsideInviteAnswer> {\n const { data, error } = await custom().rpc(\"table_share_outside_grant\", {\n p_organization_id: organizationId,\n p_table_id: tableId,\n p_person: email,\n p_level: level,\n });\n if (error) throw new Error(error.hint ? `${error.message} ${error.hint}` : error.message);\n const answer = data as unknown as Partial<OutsideInviteAnswer>;\n return {\n invited: answer.invited === true,\n granted: answer.granted === true,\n ...(answer.person ? { person: answer.person } : {}),\n say: answer.say ?? \"\",\n accept_path: answer.accept_path ?? null,\n delivery: answer.delivery ?? null,\n };\n}\n\n/** One table somebody else's organization shared with the person signed in, not yet opened. */\nexport interface MyPendingTableInvitation {\n invitation_id: string;\n organization_id: string;\n organization: string | null;\n table_id: string;\n table_name: string;\n level: string;\n level_label: string;\n token: string;\n expires_at: string | null;\n say: string;\n}\n\n/**\n * The person's own pending table invitations (`custom.table_share_outside_for_me`),\n * so a table page that is not given to her yet can say \"this was shared with you —\n * open it\" instead of \"you have not been given this table\".\n */\nexport async function myPendingTableInvitations(): Promise<MyPendingTableInvitation[]> {\n const { data, error } = await custom().rpc(\"table_share_outside_for_me\", {});\n if (error) throw new Error(error.message);\n return (data ?? []) as MyPendingTableInvitation[];\n}\n\nexport async function resendOutside(\n organizationId: string,\n invitationId: string,\n): Promise<{ say: string; accept_path: string; delivery: OutsideShareDelivery }> {\n const { data, error } = await custom().rpc(\"table_share_outside_resend\", {\n p_organization_id: organizationId,\n p_invitation_id: invitationId,\n });\n if (error) throw new Error(error.message);\n return data as unknown as Awaited<ReturnType<typeof resendOutside>>;\n}\n\nexport async function revokeOutside(\n organizationId: string,\n invitationId: string,\n): Promise<{ say: string; grants_removed: number }> {\n const { data, error } = await custom().rpc(\"table_share_outside_revoke\", {\n p_organization_id: organizationId,\n p_invitation_id: invitationId,\n });\n if (error) throw new Error(error.message);\n return data as unknown as { say: string; grants_removed: number };\n}\n\n/**\n * WHAT THE PERSON HOLDING THE LINK IS BEING OFFERED — read BEFORE they are asked\n * to make an account.\n *\n * 🚨 IT IS THE ONLY CALL ON THIS PAGE THAT A SIGNED-OUT READER CAN MAKE, and\n * that is deliberate: somebody outside an organization usually has no account\n * at all, so a page that redirects to sign-up before it explains anything is\n * asking a stranger to make an account for a reason it never gave them. It\n * lives in schema `public` — beside `inv_peek_invited_email`, which has\n * answered anonymously off a token for far longer — because schema `custom` is\n * revoked from `anon` by design and one door is not worth opening it.\n *\n * `state` is one of: `ready` · `sign_in_needed` · `wrong_account` · `accepted`\n * · `revoked` · `expired` · `lane_closed` · `unknown`. An UNKNOWN token gets\n * one sentence and nothing else, so a link can never be used to learn that\n * something is there.\n */\nexport interface TableSharePeek {\n state:\n | \"ready\"\n | \"sign_in_needed\"\n | \"wrong_account\"\n | \"accepted\"\n | \"revoked\"\n | \"expired\"\n | \"lane_closed\"\n | \"unknown\";\n usable: boolean;\n /** Absent on an unknown token — there is nothing to describe. */\n table?: string | undefined;\n table_id?: string | undefined;\n organization?: string | undefined;\n organization_id?: string | undefined;\n level?: string | undefined;\n level_label?: string | undefined;\n means?: string | undefined;\n inviter?: string | undefined;\n /** Masked (`j••••@example.com`) unless the caller IS that person. */\n invited_email?: string | undefined;\n signed_in_as?: string | null | undefined;\n expires_at?: string | null | undefined;\n /** One sentence naming the table, the organization and who shared it. */\n offer?: string | undefined;\n say: string;\n /** Who to ask. Never absent — a dead link with nobody to ask is a dead end. */\n ask: string;\n}\n\nexport async function peekTableShare(token: string): Promise<TableSharePeek> {\n const { data, error } = await (\n createClient() as unknown as StoreCaller\n ).rpc(\"table_share_peek\", { p_token: token });\n if (error) throw new Error(error.message);\n return data as unknown as TableSharePeek;\n}\n\n/**\n * The link somebody can actually paste into a text message. The store answers a\n * PATH — it has no idea what hostname this app is served on — so the origin is\n * added here, from the browser the sharer is standing in.\n */\nexport function absoluteInviteUrl(acceptPath: string): string {\n if (/^https?:\\/\\//.test(acceptPath)) return acceptPath;\n const origin =\n typeof window !== \"undefined\" && window.location?.origin\n ? window.location.origin\n : (process.env.NEXT_PUBLIC_SITE_URL ?? \"https://www.aimatrx.com\");\n return `${origin}${acceptPath}`;\n}\n\nexport async function acceptOutsideShare(token: string): Promise<{\n say: string;\n organization_id: string;\n organization: string | null;\n table_id: string;\n table: string;\n level: string;\n}> {\n const { data, error } = await custom().rpc(\"table_share_outside_accept\", {\n p_token: token,\n });\n if (error) throw new Error(error.message);\n return data as unknown as Awaited<ReturnType<typeof acceptOutsideShare>>;\n}\n","\"use client\";\n\n// features/sharing/secure/secureDeliveryService.ts — SECURE DELIVERY, the client half.\n//\n// A person sends ONE item (and, optionally, protected fields such as a vault password or an SSN)\n// to ONE recipient who needs no account: a single-use link on one channel, a code on the other,\n// shown once. The server (aidream `services/secure_delivery`, FEATURE.md there) seals the payload\n// on the sender's authority and the database hands it out exactly once — this file decides\n// NOTHING. It carries requests to aidream through `callApi` (so the transport, auth and the\n// selected server are the app's one path) and reads the sender's own list straight from\n// the door `platform.secure_delivery_sent` (the caller's own rows only; the table is closed to clients).\n//\n// 🚨 NO VALUE EVER PASSES THROUGH THE SENDER'S SIDE. `create` returns a receipt; the link secret\n// goes to the recipient only; the payload column is client-excluded in the database.\n\nimport { callApi } from \"./host\";\nimport type { ApiCallResult } from \"./host\";\nimport type { AppDispatch } from \"./host\";\nimport type { components } from \"@ai-matrx/api/types\";\nimport { createClient } from \"./host\";\n\nexport type SecureDeliveryOptions = components[\"schemas\"][\"OptionsResponse\"];\nexport type SecureDeliveryReceipt = components[\"schemas\"][\"CreateResponse\"];\nexport type SecureDeliveryPage = components[\"schemas\"][\"RecipientPage\"];\nexport type SecureDeliveryCreate = components[\"schemas\"][\"CreateBody\"];\n\n/** A refusal the server named, with the remedy it offered. */\nexport class SecureDeliveryRefusal extends Error {\n constructor(\n message: string,\n readonly code: string,\n readonly remedy: string | null,\n ) {\n super(message);\n this.name = \"SecureDeliveryRefusal\";\n }\n}\n\nfunction refusalFrom(result: ApiCallResult): SecureDeliveryRefusal {\n const detail = result.error?.serverDetail as\n | { detail?: { code?: string | undefined; message?: string | undefined; remedy?: string | null | undefined } }\n | { code?: string | undefined; message?: string | undefined; remedy?: string | null | undefined }\n | undefined;\n const inner =\n detail && typeof detail === \"object\" && \"detail\" in detail && detail.detail\n ? detail.detail\n : (detail as { code?: string | undefined; message?: string | undefined; remedy?: string | null | undefined } | undefined);\n return new SecureDeliveryRefusal(\n inner?.message ?? result.error?.message ?? \"The secure link could not be sent.\",\n inner?.code ?? (result.error?.type as string | undefined) ?? \"unknown\",\n inner?.remedy ?? null,\n );\n}\n\nfunction read<T>(result: ApiCallResult): T {\n if (result.error || result.data === undefined) throw refusalFrom(result);\n return result.data as T;\n}\n\n// ─── sender ───────────────────────────────────────────────────────────────────\nexport async function fetchSecureDeliveryOptions(\n dispatch: AppDispatch,\n resourceType: string,\n resourceId: string,\n): Promise<SecureDeliveryOptions> {\n return read<SecureDeliveryOptions>(\n await dispatch(\n callApi({\n path: \"/secure-delivery/options\",\n method: \"GET\",\n queryParams: { resource_type: resourceType, resource_id: resourceId },\n expectedErrorStatuses: [401, 403, 409, 422],\n }),\n ),\n );\n}\n\nexport async function sendSecureDelivery(\n dispatch: AppDispatch,\n body: Omit<SecureDeliveryCreate, \"organization_id\" | \"project_id\" | \"task_id\">,\n): Promise<SecureDeliveryReceipt> {\n return read<SecureDeliveryReceipt>(\n await dispatch(\n callApi({\n path: \"/secure-delivery\",\n method: \"POST\",\n body,\n expectedErrorStatuses: [401, 403, 409, 422],\n }),\n ),\n );\n}\n\nexport async function revokeSecureDelivery(\n dispatch: AppDispatch,\n deliveryId: string,\n): Promise<string> {\n const receipt = read<{ sentence: string }>(\n await dispatch(\n callApi({\n path: \"/secure-delivery/{delivery_id}/revoke\",\n method: \"POST\",\n pathParams: { delivery_id: deliveryId },\n body: {},\n expectedErrorStatuses: [401, 409],\n }),\n ),\n );\n return receipt.sentence;\n}\n\n/** One delivery the signed-in person sent for one record. Addresses are theirs to see. */\nexport interface SentSecureDelivery {\n id: string;\n recipient_name: string | null;\n recipient_email: string | null;\n recipient_phone: string | null;\n link_channel: string;\n code_channel: string;\n field_keys: string[];\n status: string;\n created_at: string;\n expires_at: string;\n viewed_at: string | null;\n}\n\nexport async function listSentSecureDeliveries(\n resourceType: string,\n resourceId: string,\n): Promise<SentSecureDelivery[]> {\n // The delivery table is closed to signed-in clients (aidream 1350g): the list comes from the\n // door that returns only the CALLER's own sent rows for this item — never a coworker's.\n const supabase = createClient();\n const { data, error } = await supabase\n .schema(\"platform\")\n .rpc(\"secure_delivery_sent\", { p_resource_type: resourceType, p_resource_id: resourceId });\n if (error) throw new Error(error.message);\n return (data ?? []) as SentSecureDelivery[];\n}\n\n/**\n * The mobile on file for an existing user with this email — only when that number has agreed to\n * texts (the send path's own gate) and the caller is that person or shares an organization with\n * them. Anyone else, or no consent, is null, and the dialog keeps its both-by-email warning.\n */\nexport async function fetchRecipientPhoneOnFile(email: string): Promise<string | null> {\n const supabase = createClient();\n const { data, error } = await supabase\n .schema(\"platform\")\n .rpc(\"secure_delivery_recipient_phone\", { p_email: email });\n if (error) throw new Error(error.message);\n return typeof data === \"string\" && data !== \"\" ? data : null;\n}\n\n// ─── recipient — no sign-in ──────────────────────────────────────────────────\nasync function recipientCall(\n dispatch: AppDispatch,\n path: \"/secure-delivery/open\" | \"/secure-delivery/code\",\n token: string,\n): Promise<SecureDeliveryPage> {\n return read<SecureDeliveryPage>(\n await dispatch(\n callApi({\n path,\n method: \"POST\",\n body: { token },\n expectedErrorStatuses: [422],\n // The recipient belongs to no organization (aidream declares these routes\n // `organization_free`): a visitor who happens to be signed in with none picked\n // must never be asked to choose one to open a link somebody sent them.\n organizationFreeRead: true,\n }),\n ),\n );\n}\n\nexport const openSecureDelivery = (dispatch: AppDispatch, token: string) =>\n recipientCall(dispatch, \"/secure-delivery/open\", token);\n\nexport const requestSecureDeliveryCode = (dispatch: AppDispatch, token: string) =>\n recipientCall(dispatch, \"/secure-delivery/code\", token);\n\nexport async function viewSecureDelivery(\n dispatch: AppDispatch,\n token: string,\n code: string,\n): Promise<SecureDeliveryPage> {\n return read<SecureDeliveryPage>(\n await dispatch(\n callApi({\n path: \"/secure-delivery/view\",\n method: \"POST\",\n body: { token, code },\n expectedErrorStatuses: [422],\n organizationFreeRead: true,\n }),\n ),\n );\n}\n","/**\n * The search-engine-indexed switch's two reads/writes (`platform.search_engine_indexed_state`,\n * `platform.set_search_engine_indexed`), direct over RLS. A host that also has a page cache to\n * refresh (the web) supplies `configureSharing({ searchEngineIndexed })` and is used instead.\n */\nimport { sharingHost, shareClient } from \"./host\";\nimport type { SearchEngineIndexedState } from \"./indexedTypes\";\n\ntype Answer = { state: SearchEngineIndexedState | null; error: string | null };\n\nasync function platformRpc(fn: string, args: Record<string, unknown>) {\n return shareClient().schema(\"platform\").rpc(fn, args);\n}\n\nexport async function getSearchEngineIndexedState(resourceType: string, resourceId: string): Promise<Answer> {\n const port = sharingHost().searchEngineIndexed;\n if (port) return (await port.get(resourceType, resourceId)) as Answer;\n const { data, error } = await platformRpc(\"search_engine_indexed_state\", { p_resource_type: resourceType, p_resource_id: resourceId });\n if (error) return { state: null, error: error.message };\n return { state: data as SearchEngineIndexedState, error: null };\n}\n\n/** `indexed = null` returns the record to its type's default. */\nexport async function setSearchEngineIndexed(resourceType: string, resourceId: string, indexed: boolean | null): Promise<Answer> {\n const port = sharingHost().searchEngineIndexed;\n if (port) return (await port.set(resourceType, resourceId, indexed)) as Answer;\n const { data, error } = await platformRpc(\"set_search_engine_indexed\", { p_resource_type: resourceType, p_resource_id: resourceId, p_indexed: indexed });\n if (error) return { state: null, error: error.message };\n return { state: data as SearchEngineIndexedState, error: null };\n}\n","// features/organizations/service/orgMemberRows.ts\n//\n// THE ONE READ of an organization's member roster\n// (`get_organization_members_with_users`). Every caller — the members page, the\n// task assignee picker's connections, record stamps, \"add everyone in\", CRM —\n// reads through here, so one page asking for the same roster many times makes\n// ONE request: a read in flight is joined, and an answer is kept for the tab.\n// RC-B6 round 2: the task page fired ~60 identical roster requests in 7 s.\n// The remount law (2026-10-03): it used to be reused for 30 s only, so a task\n// tile that woke from sleep after half a minute read the roster again. A roster\n// change made in this tab forgets it (below); `fresh` is the explicit refresh.\n//\n// Failures are never cached. Anything that changes a roster calls\n// `forgetOrganizationMemberRows(orgId)` so the next read is fresh.\n\nimport { createClient } from \"./host\";\nimport { pgErrorToError } from \"@ai-matrx/data\";\nimport type { Database } from \"./dbTypes\";\n\nexport type OrganizationMemberRow =\n Database[\"public\"][\"Functions\"][\"get_organization_members_with_users\"][\"Returns\"][number];\n\n/** How long a settled roster is kept: for the tab (a change made here forgets it). */\nexport const MEMBER_ROWS_TTL_MS = Number.POSITIVE_INFINITY;\n\ninterface CacheEntry {\n at: number;\n settled: boolean;\n rows: Promise<OrganizationMemberRow[]>;\n}\n\nconst cache = new Map<string, CacheEntry>();\n\ntype RosterClient = Pick<ReturnType<typeof createClient>, \"rpc\">;\n\nexport function readOrganizationMemberRows(\n orgId: string,\n {\n now = Date.now(),\n fresh = false,\n client,\n }: {\n now?: number | undefined;\n /** An explicit refresh: skip a settled answer (an in-flight read is still joined). */\n fresh?: boolean | undefined;\n client?: RosterClient | undefined;\n } = {},\n): Promise<OrganizationMemberRow[]> {\n const hit = cache.get(orgId);\n if (hit && (now - hit.at < MEMBER_ROWS_TTL_MS) && (!fresh || !hit.settled)) return hit.rows;\n const db = client ?? createClient();\n const entry: CacheEntry = { at: now, settled: false, rows: Promise.resolve([]) };\n const rows = (async () => {\n const { data, error } = await db.rpc(\"get_organization_members_with_users\", {\n p_org_id: orgId,\n });\n if (error) throw pgErrorToError(error);\n return (data ?? []) as OrganizationMemberRow[];\n })();\n entry.rows = rows;\n cache.set(orgId, entry);\n rows.then(\n () => {\n entry.settled = true;\n },\n () => {\n if (cache.get(orgId) === entry) cache.delete(orgId);\n },\n );\n return rows;\n}\n\n/** A roster changed (role, removal, join, leave): the next read goes to the server. */\nexport function forgetOrganizationMemberRows(orgId?: string | undefined): void {\n if (orgId) cache.delete(orgId);\n else cache.clear();\n}\n","// features/organizations/organizationsToCreateIn.ts\n//\n// THE ORGANIZATIONS A PERSON MAY CREATE SOMETHING IN. An archived organization is closed\n// (THE ARCHIVED-ITEMS LAW): it is never offered as a place to put new work. The nav tree\n// (`get_user_full_context`) carries no archived flag, so the live-membership list\n// (`useUserOrganizations`, default \"active\") is the authority on which ones are open.\n// Pure helpers here; the hook is `useOrganizationsToCreateIn` in agent-context/hooks/useNavTree.\n\n/** Keep only the organizations whose id is in `openIds`. Order preserved. */\nexport function onlyOpenOrganizations<T extends { id: string }>(\n orgs: readonly T[],\n openIds: ReadonlySet<string>,\n): T[] {\n return orgs.filter((o) => openIds.has(o.id));\n}\n\n/**\n * The text that tells two live organizations with the same visible name apart:\n * their address (slug), else a short id. Null when the name is unique in the list.\n */\nexport function organizationDisambiguators<\n T extends { id: string; name: string; slug?: string | null | undefined },\n>(orgs: readonly T[]): Map<string, string | null> {\n const counts = new Map<string, number>();\n for (const o of orgs) {\n const k = o.name.trim().toLowerCase();\n counts.set(k, (counts.get(k) ?? 0) + 1);\n }\n const out = new Map<string, string | null>();\n for (const o of orgs) {\n const dup = (counts.get(o.name.trim().toLowerCase()) ?? 0) > 1;\n out.set(o.id, dup ? (o.slug || o.id.slice(0, 8)) : null);\n }\n return out;\n}\n","/** The two team reads \"Add everyone in a team\" needs (`team_list`, `team_members`), direct over RLS. */\nimport { pgErrorToError } from \"@ai-matrx/data\";\nimport { shareClient } from \"./host\";\n\nexport type TeamRole = \"admin\" | \"member\";\n\nexport interface Team {\n id: string;\n name: string;\n description: string | null;\n hrDepartmentId: string | null;\n hrDepartmentName: string | null;\n memberCount: number;\n /** The viewer's role on this team, or null when they are not on it. */\n myRole: TeamRole | null;\n /** The viewer may rename it and manage its members (org owner/admin or team admin). */\n canManage: boolean;\n /** Set only on archived teams (listed for organization owners and admins). */\n archivedAt: string | null;\n createdAt: string;\n}\n\nexport interface TeamMember {\n userId: string;\n role: TeamRole;\n /** Added by hand (an iam.memberships row). */\n isListed: boolean;\n /** On the team because of the linked HR department. */\n isFromHr: boolean;\n listedSince: string | null;\n email: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n}\n\nexport interface HrDepartmentOption {\n id: string;\n name: string;\n parentDepartmentId: string | null;\n}\n\nfunction toRole(value: string | null | undefined): TeamRole | null {\n return value === \"admin\" || value === \"member\" ? value : null;\n}\n\n\nexport async function listTeams(organizationId: string, includeArchived = false): Promise<Team[]> {\n const { data, error } = await shareClient().rpc(\"team_list\", { p_organization_id: organizationId, p_include_archived: includeArchived });\n if (error) throw pgErrorToError(error);\n return ((data ?? []) as Array<Record<string, unknown>>).map((row) => ({\n id: String(row.id),\n name: String(row.name ?? \"\"),\n description: (row.description as string | null) ?? null,\n hrDepartmentId: (row.hr_department_id as string | null) ?? null,\n hrDepartmentName: (row.hr_department_name as string | null) ?? null,\n memberCount: Number(row.member_count ?? 0),\n myRole: toRole(row.my_role as string | null),\n canManage: Boolean(row.can_manage),\n archivedAt: (row.archived_at as string | null) ?? null,\n createdAt: String(row.created_at ?? \"\"),\n }));\n}\n\nexport async function listTeamMembers(teamId: string): Promise<TeamMember[]> {\n const { data, error } = await shareClient().rpc(\"team_members\", { p_team_id: teamId });\n if (error) throw pgErrorToError(error);\n return ((data ?? []) as Array<Record<string, unknown>>).map((row) => ({\n userId: String(row.user_id),\n role: toRole(row.role as string | null) ?? \"member\",\n isListed: Boolean(row.is_listed),\n isFromHr: Boolean(row.is_from_hr),\n listedSince: (row.listed_since as string | null) ?? null,\n email: (row.email as string | null) ?? null,\n displayName: (row.display_name as string | null) ?? null,\n avatarUrl: (row.avatar_url as string | null) ?? null,\n }));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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Q,IAAI,SAA2B;AAAA,IACvC,aAAc,IAAI,gBAAkC;AAAA,IACpD,WAAY,IAAI,cAAgC;AAAA,EAClD,EAAE;AACJ;","names":["readOrganizationMemberRows","import_access","PACKAGE_RANK","PermissionErrorCode","import_errors","data","error","import_errors","supabase","import_core","shareClient","getClaimsUser","kitConfirm","supabase","readOrganizationMemberRows","import_data"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts","../src/core/host.ts","../src/core/registry.ts","../src/core/levels.ts","../src/core/types.ts","../src/core/publicLane.ts","../src/core/shareLinks.ts","../src/core/service.ts","../src/core/shownTo.ts","../src/core/shownToWords.ts","../src/core/accessSummary.ts","../src/react/sheet/host.tsx","../src/core/format.ts","../src/core/shareText.ts","../src/core/outsideShareService.ts","../src/core/secureDeliveryService.ts","../src/core/indexedActions.ts","../src/core/orgMemberRows.ts","../src/core/organizationsToCreateIn.ts","../src/core/teams.ts"],"sourcesContent":["// @ai-matrx/sharing/core — the sharing data layer: the shareable-resource registry, permission\n// levels, the share/permission service, share links, access summaries and the share notices.\nexport * from \"./host\";\nexport * from \"./registry\";\nexport * from \"./types\";\nexport * from \"./levels\";\nexport * from \"./publicLane\";\nexport * from \"./shareLinks\";\nexport * from \"./service\";\nexport * from \"./shownTo\";\nexport * from \"./shownToWords\";\nexport * from \"./accessSummary\";\nexport * from \"./format\";\nexport * from \"./shareText\";\nexport * from \"./outsideShareService\";\nexport * from \"./secureDeliveryService\";\nexport * from \"./indexedTypes\";\nexport * from \"./indexedActions\";\nexport * from \"./orgMemberRows\";\nexport * from \"./organizationsToCreateIn\";\nexport * from \"./teams\";\n","/**\n * @ai-matrx/sharing/core — what the sharing data layer needs from its host, injected ONCE at boot:\n *\n * configureSharing({ client: () => supabase, callServer, getActiveOrgId, ensureOrgId, resolveEntityHref, ... });\n *\n * Data goes DIRECT through the host's supabase-js client (RLS decides); real work goes to aidream\n * through `callServer` (the share notices, secure delivery). The package never calls a\n * host-relative `/api/` path and never imports `next/*`.\n *\n * `client` is REQUIRED: reading it before `configureSharing` throws an error naming the field.\n * Every other field has a documented default.\n */\n\nimport type { SupabaseClient } from \"@supabase/supabase-js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ShareDbClient = SupabaseClient<any, any, any>;\n\n/** One aidream call — the shape the web's `callApi` takes. */\nexport interface ShareServerCall {\n path: string;\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n queryParams?: Record<string, string | number | boolean>;\n pathParams?: Record<string, string>;\n body?: unknown;\n expectedErrorStatuses?: number[];\n /** aidream declares the route organization-free: send no organization header. */\n organizationFreeRead?: boolean;\n}\n\n/** The answer of one aidream call (the web's `ApiCallResult` shape). */\nexport interface ShareServerResult {\n data?: unknown;\n error?: { message?: string; status?: number; detail?: unknown; code?: string; [k: string]: unknown } | null;\n status?: number;\n [k: string]: unknown;\n}\n\nexport interface SharingHost {\n /** REQUIRED. The signed-in supabase-js client (RLS applies). */\n client: () => ShareDbClient;\n /** The signed-in person (a token-only client has no `auth` namespace). Default: `client().auth.getUser()`. */\n getUser?: () => Promise<{ id: string; email?: string | null } | null>;\n /** aidream calls. Absent → every server call answers a loud \"not wired\" error. */\n callServer?: (call: ShareServerCall) => Promise<ShareServerResult>;\n /** The organization the person is working in (a write target only, never a filter). */\n getActiveOrgId?: () => string | null;\n /** Resolve an organization to write into (the web asks the person when none is picked). */\n ensureOrgId?: (organizationId?: string | null) => Promise<string>;\n /** The entity registry's route for a token+id (`resolveEntityDoors(...).href`). */\n resolveEntityHref?: (token: string, id: string) => string | null | undefined;\n /** True when the entity registry knows the token (a known token with no href = no route). */\n isKnownEntity?: (token: string) => boolean;\n /** The site origin links are built on (default `window.location.origin`). */\n appUrl?: () => string;\n /** The search-engine-indexed switch (web: a server action that also refreshes its cache). */\n searchEngineIndexed?: {\n get: (resourceType: string, resourceId: string) => Promise<{ state: unknown; error: string | null }>;\n set: (resourceType: string, resourceId: string, indexed: boolean | null) => Promise<{ state: unknown; error: string | null }>;\n };\n}\n\nlet host: Partial<SharingHost> = {};\n\n/** Merge host fields over any earlier call (boot-time; tests may call it again). */\nexport function configureSharing(next: Partial<SharingHost>): void {\n host = { ...host, ...next };\n}\n\nexport function sharingHost(): Partial<SharingHost> {\n return host;\n}\n\n/** The supabase-js client. Throws when the host never supplied one. */\nexport function shareClient(): ShareDbClient {\n if (!host.client) {\n throw new Error(\"@ai-matrx/sharing: configureSharing({ client }) was never called — the share sheet has no database client.\");\n }\n return host.client();\n}\n\n/** web parity: `createClient()` / the `supabase` singleton. */\nexport const createClient = (): ShareDbClient => shareClient();\nexport const supabase: ShareDbClient = new Proxy({} as ShareDbClient, {\n get(_t, prop) {\n const c = shareClient() as unknown as Record<string | symbol, unknown>;\n const v = c[prop];\n return typeof v === \"function\" ? (v as (...a: unknown[]) => unknown).bind(c) : v;\n },\n});\n\nexport async function getClaimsUser(client: ShareDbClient) {\n if (host.getUser) {\n const user = await host.getUser();\n return { data: { user: user ? { ...user, email: user.email ?? undefined } : null }, error: null } as unknown as Awaited<ReturnType<ShareDbClient[\"auth\"][\"getUser\"]>>;\n }\n return client.auth.getUser();\n}\n\nexport function getActiveOrgId(): string | null {\n return host.getActiveOrgId?.() ?? null;\n}\n\nexport async function ensureOrgId(organizationId?: string | null): Promise<string> {\n if (organizationId) return organizationId;\n if (host.ensureOrgId) return host.ensureOrgId(organizationId);\n const active = getActiveOrgId();\n if (active) return active;\n throw new Error(\"Pick an organization first — no organization is active for this share.\");\n}\n\nexport function appUrl(): string {\n if (host.appUrl) return host.appUrl();\n return typeof window !== \"undefined\" ? window.location.origin : \"\";\n}\n\nexport function resolveEntityHref(token: string, id: string): string | null {\n return host.resolveEntityHref?.(token, id) ?? null;\n}\n\nexport function isKnownEntity(token: string): boolean {\n return host.isKnownEntity?.(token) ?? false;\n}\n\n/** web parity: `callApi(...)` — answers a promise of the call's result. */\nexport function callApi(call: ShareServerCall): Promise<ShareServerResult> {\n if (!host.callServer) {\n return Promise.resolve({\n error: { message: \"This app has not connected sharing to the AI Matrx server (configureSharing({ callServer }) is missing).\", status: 0 },\n });\n }\n return host.callServer(call);\n}\nexport type ApiCallResult = ShareServerResult;\n\n/** web parity: `dispatch(callApi(...))` — a dispatch that just hands the promise back. */\nexport type AppDispatch = <T>(action: T) => T;\nexport const passThroughDispatch: AppDispatch = (action) => action;\n\n/** Every scrap of an error, for logs and honest notices — the platform's one extractor. */\nexport { extractErrorMessage } from \"@ai-matrx/api/net\";\n\nexport function isJsonObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** The share sheet's two notices, on aidream (`/sharing/notify`, `/sharing/email-link`). */\nexport interface ShareNoticeAnswer {\n success: boolean;\n msg?: string;\n error?: string;\n}\n\nexport async function sendShareNotice(path: \"/sharing/notify\" | \"/sharing/email-link\", body: Record<string, unknown>): Promise<ShareNoticeAnswer> {\n const result = await callApi({ path, method: \"POST\", body, expectedErrorStatuses: [400, 401, 403, 404, 500] });\n if (result.error) {\n const detail = result.error.detail as { error?: string; msg?: string } | undefined;\n return { success: false, msg: detail?.msg ?? detail?.error ?? result.error.message ?? \"The server refused the notice.\" };\n }\n const data = (result.data ?? {}) as ShareNoticeAnswer;\n return { success: Boolean(data.success), msg: data.msg ?? data.error ?? \"\" };\n}\n","import { isKnownEntity, resolveEntityHref } from \"./host\";\n\n/**\n * Shareable Resource Registry — TypeScript mirror\n *\n * Single source of truth lives in the Postgres\n * `platform.shareable_resource_registry` table. This file mirrors the same data\n * so the FE doesn't have to fetch the registry on every page load. The TS↔DB\n * mirror is verified at test time by\n * `utils/permissions/__tests__/registry.parity.test.ts` — if a row is added to\n * the DB and not here (or vice versa) the test fails.\n *\n * REGENERATE (do not hand-edit rows): after any registry migration run\n * `pnpm tsx scripts/regen-shareable-registry-snapshot.ts`\n * to refresh the DB snapshot, then update the rows below to match it.\n *\n * ── Token vs. table (post-2026-canonicalization) ─────────────────────────────\n * Two distinct canonical values live on every row; DO NOT conflate them:\n * • `resourceType` — the ENTITY TOKEN. This is the object key, the value\n * stored in `iam.permissions.resource_type`, and the `p_resource_type`\n * passed to every share RPC. Reference resources by this, never by table.\n * • `tableName` (+ `schemaName`) — the PHYSICAL table (schema.table) for\n * direct supabase-js `.from()` reads. Equals the DB registry `table_name`.\n * They coincided before the reorg (public tables named after their token) and\n * diverge now (token `note` → `workbench.notes`, token `file` → `files.files`).\n * For permission/RPC/`iam.permissions` work use `resourceType`; for a direct\n * table read use `.schema(schemaName).from(tableName)`.\n */\n\nexport interface ShareableResourceEntry {\n /**\n * The entity TOKEN — public alias used in TS / RPC arguments / UI props and\n * stored in `iam.permissions.resource_type`. This is what you pass to the\n * share RPCs; it is NOT the physical table name.\n */\n resourceType: string;\n\n /**\n * The PHYSICAL Postgres table name (within `schemaName`), mirroring the DB\n * registry `table_name`. Used for direct `.from()` reads. NOT the permissions\n * key — reference resources by `resourceType`. Multiple tokens may share a\n * physical name across schemas (e.g. `definition` in agent/app/skill/workflow).\n */\n tableName: string;\n\n /** Primary-key column on the resource table. Almost always 'id'. */\n idColumn: string;\n\n /** Column holding the owner's auth.uid(). Canonical tables use 'created_by'. */\n ownerColumn: string;\n\n /**\n * Column holding the public-visibility boolean, when the table has one.\n * Null means only “no legacy boolean is declared”; canonical enum tables and\n * types with no public-state column both use null. Call\n * `getShareCapabilities()` to resolve the verified physical state column.\n */\n isPublicColumn: string | null;\n\n /** Human-readable label used in the share modal title and emails. */\n displayLabel: string;\n\n /**\n * Optional signed-in destination pattern. `{id}` is substituted with the\n * resource id. No-login share links use the generic `/s/[token]` route.\n */\n urlPathTemplate: string;\n\n /**\n * When false, the table's RLS does NOT call has_permission()/has_access().\n * A permission grant inserts but does not actually grant the grantee access.\n * Surfaces broken end-to-end states explicitly.\n */\n rlsUsesHasPermission: boolean;\n\n /**\n * Non-`public` Postgres schema the resource table lives in. supabase-js\n * reaches it via `.schema(schemaName)`. Omitted ⇒ `public`. FE-only — not\n * part of the DB-registry parity comparison.\n */\n schemaName?: string | undefined;\n}\n\n/**\n * The canonical client-side mirror of platform.shareable_resource_registry.\n * Verified against the DB by the parity test. Regenerate rows from the DB — do\n * not hand-tune individual fields.\n */\nexport const SHAREABLE_RESOURCE_REGISTRY = {\n /**\n * The unified record store (lane W3-HIST added the DB row 2026-09-18; this\n * mirror followed on 2026-09-19 with lane SHARE, which is what made the one\n * share dialog reach a record at all — until then `getShareableResource`\n * answered undefined and the dialog rendered its \"not a registered shareable\n * resource\" refusal).\n *\n * A TABLE IS A RECORD HERE: `custom.record` holds both, so one token covers\n * the record screen and the table screen. `rlsUsesHasPermission` is false on\n * purpose — schema `custom` is read through its own doors (W4-DOOR), never\n * through the generic has_permission arm. `urlPathTemplate` stays empty: a\n * record's page is /data/{tableId} plus the record, which this one-id\n * template cannot express, and an honest \"no link\" beats a broken one.\n */\n record: {\n resourceType: \"record\",\n tableName: \"record\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Record\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: false,\n },\n browser_profile: {\n resourceType: \"browser_profile\",\n tableName: \"profile\",\n schemaName: \"browser\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cloud Browser Profile\",\n // No `/browser/*` segment exists anywhere in `app/`, so there is no\n // signed-in destination. The DB row advertised `/browser/profiles/{id}`\n // until migration 20260909_shareable_registry_dead_end_urls.sql made the\n // registry honest; both sides now say \"no link\".\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_run: {\n resourceType: \"agent_run\",\n tableName: \"agent_run\",\n schemaName: \"chat\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n comparison_set: {\n resourceType: \"comparison_set\",\n tableName: \"cmp_comparison_sets\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Comparison Set\",\n urlPathTemplate: \"/agents/compare?set={id}\",\n rlsUsesHasPermission: true,\n },\n crm_sending_identity: {\n resourceType: \"crm_sending_identity\",\n tableName: \"sending_identity\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sending mailbox\",\n urlPathTemplate: \"/crm/sending-identities/{id}\",\n rlsUsesHasPermission: true,\n },\n global_request: {\n resourceType: \"global_request\",\n tableName: \"global_request\",\n schemaName: \"runtime\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Runtime Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hindsight_enrollment: {\n resourceType: \"hindsight_enrollment\",\n tableName: \"enrollment\",\n schemaName: \"hindsight\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hindsight Enrollment\",\n urlPathTemplate: \"/administration/agents/hindsight?enrollment={id}\",\n rlsUsesHasPermission: true,\n },\n plan_node: {\n resourceType: \"plan_node\",\n tableName: \"node\",\n schemaName: \"plan\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Plan Page\",\n urlPathTemplate: \"/marketing/content-plan/nodes/{id}\",\n rlsUsesHasPermission: true,\n },\n sch_task: {\n resourceType: \"sch_task\",\n tableName: \"sch_task\",\n schemaName: \"scheduler\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Scheduled Task\",\n urlPathTemplate: \"/administration/automation/scheduling/tasks?task={id}\",\n rlsUsesHasPermission: true,\n },\n seo_rank_target: {\n resourceType: \"seo_rank_target\",\n tableName: \"rank_target\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SEO Rank Target\",\n urlPathTemplate: \"/marketing/ranks?target={id}\",\n rlsUsesHasPermission: true,\n },\n sms_conversation: {\n resourceType: \"sms_conversation\",\n tableName: \"sms_conversations\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SMS Conversation\",\n urlPathTemplate: \"/sms?conversation={id}\",\n rlsUsesHasPermission: true,\n },\n agent: {\n resourceType: \"agent\",\n tableName: \"definition\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent\",\n urlPathTemplate: \"/agents/{id}\",\n rlsUsesHasPermission: true,\n },\n agent_card: {\n resourceType: \"agent_card\",\n tableName: \"card\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Card\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n app: {\n resourceType: \"app\",\n tableName: \"definition\",\n schemaName: \"app\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Applet\",\n urlPathTemplate: \"/applets/manage/{id}\",\n rlsUsesHasPermission: true,\n },\n assessment: {\n resourceType: \"assessment\",\n tableName: \"assessment\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Assessment\",\n urlPathTemplate: \"/education/quizzes/{id}\",\n rlsUsesHasPermission: true,\n },\n // `batch_provider_batch` was here until 2026-08-21. It was registered\n // shareable on 2026-06-03 as \"Auto-ingest Batch\" (owner_column `user_id`),\n // and that registration was the only reason its bespoke\n // `is_resource_owner('batch_provider_batch', id)` RLS policy resolved at all.\n // The whole `batch` schema now runs the canonical `ledger` variant (aidream\n // migrations 0438/0439): the server writes, users read their own org's rows,\n // and there is no grant lane to share through. `provider_batch` also has no\n // real owner — the flusher stamps user_id/created_by from items[0] of a flush\n // group that can span users. The DB row is deactivated, never deleted.\n canvas_item: {\n resourceType: \"canvas_item\",\n tableName: \"canvas_items\",\n schemaName: \"canvas\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Canvas Item\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n context_item: {\n // Mirrors the live platform.shareable_resource_registry row, which still names the retired\n // context.context_items: a context field lives in the record store now, and\n // public.resolve_shareable_resource REFUSES this token BY NAME (\"share the record itself\") —\n // the same decision the generic registry readers take (platform.record_store_kind,\n // SCOPES-CLEANUP 2026-10-09). Not a table any share path may read.\n resourceType: \"context_item\",\n tableName: \"context_items\",\n schemaName: \"context\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n // D193 fixed 2026-08-15 (D117's class). The DB row declared 'visibility' —\n // a column `context.context_items` does not have — which routed ShareModal\n // through make_resource_public at a nonexistent column. NULL is the honest\n // value AND the permanent one: a context item is a COMPONENT of its scope\n // type (it is the \"column\" of a dimension; the cells live in\n // context.context_item_values). It has no organization_id, all four of its\n // RLS policies key on the parent scope type's org and none call\n // has_permission, and iam.permissions has never held a single\n // context_item grant across 203 live rows. Access CONVEYS from the parent,\n // so it is not independently shareable and must never grow a per-item\n // visibility column — that would be a second access authority no policy\n // reads. Do not \"fix\" this back to a column name.\n isPublicColumn: null,\n displayLabel: \"Context Item\",\n // The only id-addressable route needs THREE ids\n // (/organizations/[orgId]/scopes/[typeId]/context-items/[itemId]), which a\n // {id}-only template cannot build. Rather than invent a single-id route for\n // a COMPONENT of a scope type, the door is the all-orgs hub focused on the\n // item (`?item=` — features/scopes/components/pages/ContextItemsHub.tsx),\n // which resolves it, scrolls to it and highlights it, and renders the\n // access gate when the caller cannot reach it. This was `''` under D138\n // until the focus param existed (2026-08-15). `entityRegistry.hrefFor`\n // carries the same destination and is the half `getResourceSharePath`\n // actually reads for this token — move both or neither.\n urlPathTemplate: \"/context-items?item={id}\",\n rlsUsesHasPermission: false,\n },\n code_file: {\n resourceType: \"code_file\",\n tableName: \"code_files\",\n schemaName: \"code\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Code File\",\n urlPathTemplate: \"/code?open={id}\",\n rlsUsesHasPermission: true,\n },\n code_folder: {\n resourceType: \"code_folder\",\n tableName: \"code_file_folders\",\n schemaName: \"code\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Code Folder\",\n urlPathTemplate: \"/code?folder={id}\",\n rlsUsesHasPermission: true,\n },\n code_repository: {\n resourceType: \"code_repository\",\n tableName: \"code_repositories\",\n schemaName: \"code\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Code Repository\",\n urlPathTemplate: \"/knowledge/repositories?repo={id}\",\n rlsUsesHasPermission: true,\n },\n message_template: {\n resourceType: \"message_template\",\n tableName: \"message_template\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Message Template\",\n urlPathTemplate: \"/chat/message-templates/{id}\",\n rlsUsesHasPermission: true,\n },\n marketing_initiative: {\n resourceType: \"marketing_initiative\",\n tableName: \"initiative\",\n schemaName: \"marketing\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Initiative\",\n urlPathTemplate: \"/marketing/initiatives/{id}\",\n rlsUsesHasPermission: true,\n },\n conversation: {\n resourceType: \"conversation\",\n tableName: \"conversation\",\n schemaName: \"chat\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Conversation\",\n urlPathTemplate: \"/chat/{id}\",\n rlsUsesHasPermission: true,\n },\n data_store: {\n resourceType: \"data_store\",\n tableName: \"data_stores\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n // 'visibility' is the canonical enum, not a boolean is_public column — a\n // non-null value here wrongly routes sharing through make_resource_public.\n isPublicColumn: null,\n displayLabel: \"Data Store\",\n urlPathTemplate: \"/knowledge/data-stores?store_id={id}\",\n rlsUsesHasPermission: false,\n },\n dm_conversation: {\n resourceType: \"dm_conversation\",\n tableName: \"dm_conversations\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Direct Conversation\",\n urlPathTemplate: \"/messages/{id}\",\n rlsUsesHasPermission: true,\n },\n fc_card: {\n resourceType: \"fc_card\",\n tableName: \"fc_card\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Flashcard\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n fc_set: {\n resourceType: \"fc_set\",\n tableName: \"fc_set\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Flashcard Deck\",\n urlPathTemplate: \"/education/flashcards/{id}\",\n rlsUsesHasPermission: true,\n },\n feature_doc: {\n resourceType: \"feature_doc\",\n tableName: \"feature_docs\",\n schemaName: \"admin\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Feature Doc\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n file: {\n resourceType: \"file\",\n tableName: \"files\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"File\",\n urlPathTemplate: \"/files/f/{id}\",\n rlsUsesHasPermission: true,\n },\n file_analysis: {\n resourceType: \"file_analysis\",\n tableName: \"analysis\",\n schemaName: \"files\",\n idColumn: \"file_id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"File Analysis\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n file_entities: {\n resourceType: \"file_entities\",\n tableName: \"entities\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"File Entity\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n file_overrides: {\n resourceType: \"file_overrides\",\n tableName: \"overrides\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"File Override\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n file_page_annotations: {\n resourceType: \"file_page_annotations\",\n tableName: \"page_annotations\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"Page Annotation\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n file_pages: {\n resourceType: \"file_pages\",\n tableName: \"pages\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"owner_id\",\n isPublicColumn: null,\n displayLabel: \"File Page\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n folder: {\n resourceType: \"folder\",\n tableName: \"folders\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Folder\",\n urlPathTemplate: \"/files/folder/{id}\",\n rlsUsesHasPermission: true,\n },\n learn_doc: {\n resourceType: \"learn_doc\",\n tableName: \"learn_doc\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Guide\",\n urlPathTemplate: \"/education/learn/{slug}\",\n rlsUsesHasPermission: true,\n },\n note: {\n resourceType: \"note\",\n tableName: \"notes\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Note\",\n urlPathTemplate: \"/notes/{id}\",\n rlsUsesHasPermission: true,\n },\n pdf_redaction_audit: {\n resourceType: \"pdf_redaction_audit\",\n tableName: \"pdf_redaction_audits\",\n schemaName: \"pdf\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Redaction Audit\",\n urlPathTemplate: \"/files/{id}\",\n rlsUsesHasPermission: false,\n },\n project: {\n resourceType: \"project\",\n tableName: \"projects\",\n schemaName: \"projects\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Project\",\n urlPathTemplate: \"/projects/{id}\",\n rlsUsesHasPermission: true,\n },\n quiz_session: {\n resourceType: \"quiz_session\",\n tableName: \"quiz_sessions\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Quiz session\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n research_template: {\n resourceType: \"research_template\",\n tableName: \"rs_template\",\n schemaName: \"research\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Research Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n research_topic: {\n resourceType: \"research_topic\",\n tableName: \"rs_topic\",\n schemaName: \"research\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Research Topic\",\n urlPathTemplate: \"/research/topics/{id}\",\n rlsUsesHasPermission: true,\n },\n sandbox_instance: {\n resourceType: \"sandbox_instance\",\n tableName: \"sandbox_instances\",\n idColumn: \"id\",\n ownerColumn: \"user_id\",\n isPublicColumn: null,\n displayLabel: \"Sandbox\",\n urlPathTemplate: \"/sandbox/{id}\",\n rlsUsesHasPermission: true,\n },\n // `scope_association_suggestion` and `scope_item_value_suggestion` were here\n // until 2026-09-09. Both DB rows are now `is_active = false`, so there is no\n // grant lane to share through and the parity guard's \"no TS entry the active\n // DB does not have\" arm rejects them. Deactivated, never deleted — the same\n // treatment `batch_provider_batch` got above. Reactivating either means\n // flipping the DB row back and re-mirroring it here, in one commit.\n shared_canvas_item: {\n resourceType: \"shared_canvas_item\",\n tableName: \"shared_canvas_items\",\n schemaName: \"canvas\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Shared Canvas\",\n urlPathTemplate: \"/canvas/shared/{id}\",\n rlsUsesHasPermission: true,\n },\n skill: {\n resourceType: \"skill\",\n tableName: \"definition\",\n schemaName: \"skill\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Skill\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n studio_session: {\n resourceType: \"studio_session\",\n tableName: \"studio_sessions\",\n schemaName: \"transcripts\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Transcript Studio session\",\n urlPathTemplate: \"/transcripts/studio?session={id}\",\n rlsUsesHasPermission: true,\n },\n study_media: {\n resourceType: \"study_media\",\n tableName: \"study_media\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Media\",\n urlPathTemplate: \"/education/media/{id}\",\n rlsUsesHasPermission: true,\n },\n task: {\n resourceType: \"task\",\n tableName: \"tasks\",\n schemaName: \"projects\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Task\",\n urlPathTemplate: \"/tasks/{id}\",\n rlsUsesHasPermission: true,\n },\n thread: {\n resourceType: \"thread\",\n tableName: \"threads\",\n schemaName: \"projects\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Thread\",\n urlPathTemplate: \"/war-room/all\",\n rlsUsesHasPermission: true,\n },\n transcript: {\n resourceType: \"transcript\",\n tableName: \"transcripts\",\n schemaName: \"transcripts\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Transcript\",\n urlPathTemplate: \"/transcripts/processor?focus={id}\",\n rlsUsesHasPermission: true,\n },\n // The four workbench UDT entities were canonicalized 2026-08-15: they now\n // carry the `visibility` enum + `created_by`, and their RLS is generated by\n // iam.apply_rls(...,'entity'). `isPublicColumn` is null for the same reason it\n // is null on data_store / scope / content_ir_kind_instance — 'visibility' is\n // the canonical ENUM, and naming a boolean here routes the ShareModal through\n // make_resource_public instead of the enum path.\n udt_document: {\n resourceType: \"udt_document\",\n tableName: \"udt_documents\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cloud document\",\n urlPathTemplate: \"/documents/{id}\",\n rlsUsesHasPermission: true,\n },\n // The Presentations home (2026-10-12): a canonical entity (platform.create_entity_table) whose\n // `deck` column is the presentation_deck kind; `visibility` enum, so no boolean column.\n presentation: {\n resourceType: \"presentation\",\n tableName: \"presentation\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Presentation\",\n urlPathTemplate: \"/presentations/{id}\",\n rlsUsesHasPermission: true,\n },\n // Active DB registry row that predates this mirror; surfaced by the parity\n // snapshot regen during the structured-list rename. Mirrored here so the\n // TS↔DB guard stays green.\n scope: {\n // Mirrors the live registry row (the retired context.scopes). A scope is a record-store Record:\n // public.resolve_shareable_resource REFUSES this token BY NAME, as for context_item above.\n resourceType: \"scope\",\n tableName: \"scopes\",\n schemaName: \"context\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n // 'visibility' is the canonical enum, not a boolean is_public column — a\n // non-null value here wrongly routes sharing through make_resource_public.\n isPublicColumn: null,\n displayLabel: \"Scope\",\n urlPathTemplate: \"/scopes/s/{id}\",\n rlsUsesHasPermission: false,\n },\n workbook: {\n resourceType: \"workbook\",\n tableName: \"udt_workbooks\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n // Canonicalized 2026-08-15 — see the note on `dataset` above.\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workbook\",\n urlPathTemplate: \"/workbooks/{id}\",\n rlsUsesHasPermission: true,\n },\n user_analysis_preference: {\n resourceType: \"user_analysis_preference\",\n tableName: \"user_analysis_preferences\",\n schemaName: \"users\",\n idColumn: \"user_id\",\n ownerColumn: \"user_id\",\n isPublicColumn: null,\n displayLabel: \"Analysis Preferences\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: false,\n },\n web_site: {\n resourceType: \"web_site\",\n tableName: \"site\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Site\",\n urlPathTemplate: \"/marketing/sites/{id}\",\n rlsUsesHasPermission: true,\n },\n web_page: {\n resourceType: \"web_page\",\n tableName: \"page\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Site page\",\n urlPathTemplate: \"/marketing/pages/{id}\",\n rlsUsesHasPermission: true,\n },\n web_property: {\n resourceType: \"web_property\",\n tableName: \"property\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Marketing Property\",\n urlPathTemplate: \"/marketing/properties/{id}\",\n rlsUsesHasPermission: true,\n },\n web_screenshot: {\n resourceType: \"web_screenshot\",\n tableName: \"screenshot\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Web Screenshot\",\n urlPathTemplate: \"/marketing/screenshots/{id}\",\n rlsUsesHasPermission: true,\n },\n web_snapshot: {\n resourceType: \"web_snapshot\",\n tableName: \"snapshot\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Web Snapshot\",\n urlPathTemplate: \"/marketing/snapshots/{id}\",\n rlsUsesHasPermission: true,\n },\n war_room: {\n resourceType: \"war_room\",\n tableName: \"war_rooms\",\n schemaName: \"projects\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"War Room\",\n urlPathTemplate: \"/war-room/{id}\",\n rlsUsesHasPermission: true,\n },\n wc_claim: {\n resourceType: \"wc_claim\",\n tableName: \"wc_claim\",\n schemaName: \"legal\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"WC Claim\",\n urlPathTemplate: \"/legal/ca-wc/pd-ratings-calculator/{id}\",\n rlsUsesHasPermission: true,\n },\n wf_node_data_slot: {\n resourceType: \"wf_node_data_slot\",\n tableName: \"node_data_slot\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Node Data Slot\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: false,\n },\n workflow_run: {\n resourceType: \"workflow_run\",\n tableName: \"run\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow_template: {\n resourceType: \"workflow_template\",\n tableName: \"template\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow_trigger: {\n resourceType: \"workflow_trigger\",\n tableName: \"trigger\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Trigger\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n // Active DB registry row that predated this mirror and was never snapshotted\n // — the exact blind spot registry.parity.test.ts documents (a live registry\n // change nobody regenerated the snapshot for). Mirrored 2026-08-14.\n workflow_plan: {\n resourceType: \"workflow_plan\",\n tableName: \"plan\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Plan\",\n // No signed-in destination: plans are shown inside workflow-studio, which\n // is a separate client with no route in this app.\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow: {\n resourceType: \"workflow\",\n tableName: \"definition\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow\",\n // `/workflows/[id]` is a live route (app/(core)/workflows/[id]/page.tsx).\n // This mirror carried \"\" while the DB carried the real template — the\n // no-link half of a TS<->DB split that hid a working destination from\n // every share surface. The DB value wins because the DB is the authority.\n urlPathTemplate: \"/workflows/{id}\",\n rlsUsesHasPermission: true,\n },\n // Live DB registry rows that predate this mirror — surfaced by the\n // 2026-07-29 snapshot regen (the working_document registration). Mirrored\n // here so the TS↔DB parity guard stays green.\n content_ir_kind_instance: {\n resourceType: \"content_ir_kind_instance\",\n tableName: \"kind_instance\",\n schemaName: \"content_ir\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n // D117 fixed 2026-08-13: the DB row briefly declared 'visibility' (the\n // canonical enum) in the boolean is_public_column slot, which routed\n // ShareModal through make_resource_public. Now NULL in DB and here.\n isPublicColumn: null,\n // What a HUMAN calls it in the share dialog / access gate. \"Kind Instance\"\n // was developer jargon in a non-technical user's face (2026-08-13).\n displayLabel: \"Saved Result\",\n urlPathTemplate: \"/shapes/instances/{id}\",\n rlsUsesHasPermission: true,\n },\n crm_outreach_list: {\n resourceType: \"crm_outreach_list\",\n tableName: \"outreach_list\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Outreach List\",\n urlPathTemplate: \"/crm/outreach-lists/{id}\",\n rlsUsesHasPermission: true,\n },\n party: {\n resourceType: \"party\",\n tableName: \"party\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Contact\",\n urlPathTemplate: \"/crm/{id}\",\n rlsUsesHasPermission: true,\n },\n seo_collection_run: {\n resourceType: \"seo_collection_run\",\n tableName: \"collection_run\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SEO Collection Run\",\n urlPathTemplate: \"/marketing/ai-visibility/runs/{id}\",\n rlsUsesHasPermission: true,\n },\n seo_change_set: {\n resourceType: \"seo_change_set\",\n tableName: \"change_set\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SEO Change\",\n urlPathTemplate: \"/marketing/changes/{id}\",\n rlsUsesHasPermission: false,\n },\n seo_topical_map: {\n resourceType: \"seo_topical_map\",\n tableName: \"topical_map\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Topical map\",\n // The id door shipped 2026-09-17 at app/(core)/marketing/topical-maps/[mapId]:\n // it redirects a caller who can read the brand into the nested workspace and\n // renders the map standalone for a record-only grantee — the two lanes\n // sharing exactly matter.\n urlPathTemplate: \"/marketing/topical-maps/{id}\",\n rlsUsesHasPermission: true,\n },\n seo_keyword: {\n resourceType: \"seo_keyword\",\n tableName: \"keyword\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"SEO Keyword\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: false,\n },\n youtube_search: {\n resourceType: \"youtube_search\",\n tableName: \"youtube_search\",\n schemaName: \"research\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"YouTube Search\",\n urlPathTemplate: \"/marketing/discovery/youtube?search={id}\",\n rlsUsesHasPermission: true,\n },\n rulebook: {\n resourceType: \"rulebook\",\n tableName: \"rulebook\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Rulebook\",\n urlPathTemplate: \"/masterwork/{id}\",\n rlsUsesHasPermission: true,\n },\n interview_decision_interview: {\n resourceType: \"interview_decision_interview\",\n tableName: \"decision_interview\",\n schemaName: \"interview\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Decision Interview\",\n urlPathTemplate: \"/administration/question-desk/{id}\",\n rlsUsesHasPermission: true,\n },\n interview_session: {\n resourceType: \"interview_session\",\n tableName: \"session\",\n schemaName: \"interview\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Vision Interview\",\n urlPathTemplate: \"/masterwork/vision-interview/{id}\",\n rlsUsesHasPermission: true,\n },\n workflow_runtime_surface: {\n resourceType: \"workflow_runtime_surface\",\n tableName: \"runtime_surface\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Run Surface\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n growth_loop_run: {\n resourceType: \"growth_loop_run\",\n tableName: \"loop_run\",\n schemaName: \"growth\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Growth Loop Run\",\n urlPathTemplate: \"/marketing/growth-loop/{id}\",\n rlsUsesHasPermission: true,\n },\n web_brand: {\n resourceType: \"web_brand\",\n tableName: \"brand\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Brand\",\n urlPathTemplate: \"/marketing/brands/{id}\",\n rlsUsesHasPermission: true,\n },\n // ── Mirrored 2026-09-09 ──────────────────────────────────────────────────\n // 32 ACTIVE rows that live in platform.shareable_resource_registry and had\n // never reached this file. The parity guard only ever compared this mirror to\n // the COMMITTED snapshot, and the snapshot was itself 31 rows behind the live\n // table — so the drift was invisible from both ends until\n // `pnpm check:shareable-registry` was run during the 2026-09-08 jest triage.\n //\n // The HR rows that read `urlPathTemplate: \"\"` are not oversights: their detail\n // routes do not exist in `app/` (only the module/list page does), and the\n // registry's rule is that a record with no signed-in destination says so with\n // an empty template rather than pointing at a list that cannot show it. The\n // ones with a route carry their real route, verified against the tree by\n // registry.routes.test.ts. See migration\n // 20260909_shareable_registry_dead_end_urls.sql for the DB half.\n crm_deal: {\n resourceType: \"crm_deal\",\n tableName: \"deal\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Deal\",\n urlPathTemplate: \"/crm/deals/{id}\",\n rlsUsesHasPermission: true,\n },\n esign_campaign: {\n resourceType: \"esign_campaign\",\n tableName: \"campaign\",\n schemaName: \"esign\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Signature campaign\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n esign_envelope: {\n resourceType: \"esign_envelope\",\n tableName: \"envelope\",\n schemaName: \"esign\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Signature envelope\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_ai_evidence: {\n resourceType: \"hr_ai_evidence\",\n tableName: \"ai_evidence\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"AI evidence\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_asset: {\n resourceType: \"hr_asset\",\n tableName: \"asset\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Asset\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_background_check: {\n resourceType: \"hr_background_check\",\n tableName: \"background_check\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Background check\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_candidate: {\n resourceType: \"hr_candidate\",\n tableName: \"candidate\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Candidate\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_checklist_template: {\n resourceType: \"hr_checklist_template\",\n tableName: \"checklist_template\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Checklist template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_compensation: {\n resourceType: \"hr_compensation\",\n tableName: \"compensation\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Compensation\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_corrective_action: {\n resourceType: \"hr_corrective_action\",\n tableName: \"corrective_action\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Corrective action\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_course: {\n resourceType: \"hr_course\",\n tableName: \"course\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Course\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_emergency_contact: {\n resourceType: \"hr_emergency_contact\",\n tableName: \"emergency_contact\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Emergency contact\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_employee: {\n resourceType: \"hr_employee\",\n tableName: \"employee\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Employee\",\n urlPathTemplate: \"/hr/people/{id}\",\n rlsUsesHasPermission: true,\n },\n hr_employee_private: {\n resourceType: \"hr_employee_private\",\n tableName: \"employee_private\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Employee private details\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_employer_profile: {\n resourceType: \"hr_employer_profile\",\n tableName: \"employer_profile\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Employer profile\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_employment: {\n resourceType: \"hr_employment\",\n tableName: \"employment\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Employment spell\",\n urlPathTemplate: \"/hr/people/{id}/employment\",\n rlsUsesHasPermission: true,\n },\n hr_i9: {\n resourceType: \"hr_i9\",\n tableName: \"i9\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Form I-9\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_interview: {\n resourceType: \"hr_interview\",\n tableName: \"interview\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Interview\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_leave_policy: {\n resourceType: \"hr_leave_policy\",\n tableName: \"leave_policy\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Leave policy\",\n urlPathTemplate: \"/hr/settings/leave-policies/{id}\",\n rlsUsesHasPermission: true,\n },\n hr_legal_hold: {\n resourceType: \"hr_legal_hold\",\n tableName: \"legal_hold\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Legal hold\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_offer: {\n resourceType: \"hr_offer\",\n tableName: \"offer\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Offer\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_records_request: {\n resourceType: \"hr_records_request\",\n tableName: \"records_request\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Records request\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_reference_check: {\n resourceType: \"hr_reference_check\",\n tableName: \"reference_check\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Reference check\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_requisition: {\n resourceType: \"hr_requisition\",\n tableName: \"requisition\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Requisition\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_restricted_note: {\n resourceType: \"hr_restricted_note\",\n tableName: \"restricted_note\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Restricted note\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_separation: {\n resourceType: \"hr_separation\",\n tableName: \"separation\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Separation\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_survey: {\n resourceType: \"hr_survey\",\n tableName: \"survey\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Survey\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_tax_withholding: {\n resourceType: \"hr_tax_withholding\",\n tableName: \"tax_withholding\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Tax withholding\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_verification_letter_request: {\n resourceType: \"hr_verification_letter_request\",\n tableName: \"verification_letter_request\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Verification letter request\",\n urlPathTemplate: \"/hr\",\n rlsUsesHasPermission: false,\n },\n hr_workflow_instance: {\n resourceType: \"hr_workflow_instance\",\n tableName: \"workflow_instance\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"HR approval request\",\n urlPathTemplate: \"/hr/tasks/{id}\",\n rlsUsesHasPermission: true,\n },\n processed_document: {\n resourceType: \"processed_document\",\n tableName: \"processed_documents\",\n schemaName: \"docproc\",\n idColumn: \"id\",\n // The DB registry names `created_by` (aidream 1211; the legacy owner_id\n // retires) and the DB is the authority.\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Source\",\n // Empty in the DB registry: no signed-in per-record destination exists.\n // Never invent one here (D138).\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_feedback: {\n resourceType: \"user_feedback\",\n tableName: \"user_feedback\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Feedback item\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow_recovery_audit: {\n resourceType: \"workflow_recovery_audit\",\n tableName: \"recovery_audit\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow recovery audit\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n // Live platform.shareable_resource_registry rows mirrored 2026-09-21.\n // The database is the authority; these entries exist so the client mirror\n // covers every active shareable type the registry already published.\n agent_mandate_note: {\n resourceType: \"agent_mandate_note\",\n tableName: \"mandate_note\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Mandate Note\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_prompt_remediation: {\n resourceType: \"agent_prompt_remediation\",\n tableName: \"prompt_remediation\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Prompt Remediation\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_shortcut: {\n resourceType: \"agent_shortcut\",\n tableName: \"shortcut\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Shortcut\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_template: {\n resourceType: \"agent_template\",\n tableName: \"template\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Agent Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_form: {\n resourceType: \"anon_form\",\n tableName: \"anon_form\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Form\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_hit: {\n resourceType: \"anon_hit\",\n tableName: \"anon_hit\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Hit\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_inbound: {\n resourceType: \"anon_inbound\",\n tableName: \"anon_inbound\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Inbound\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_replay: {\n resourceType: \"anon_replay\",\n tableName: \"anon_replay\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Replay\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_submission: {\n resourceType: \"anon_submission\",\n tableName: \"anon_submission\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Submission\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n anon_token: {\n resourceType: \"anon_token\",\n tableName: \"anon_token\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Anon Token\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n app_instance: {\n resourceType: \"app_instance\",\n tableName: \"app_instances\",\n schemaName: \"public\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"App Instance\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n app_setting: {\n resourceType: \"app_setting\",\n tableName: \"app_settings\",\n schemaName: \"public\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"App Setting\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n app_sync_status: {\n resourceType: \"app_sync_status\",\n tableName: \"app_sync_status\",\n schemaName: \"public\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"App Sync Status\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n assessment_result: {\n resourceType: \"assessment_result\",\n tableName: \"assessment_result\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Assessment Result\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n assignment_session: {\n resourceType: \"assignment_session\",\n tableName: \"session\",\n schemaName: \"assignment\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Assignment Session\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n assist: {\n resourceType: \"assist\",\n tableName: \"assists\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Assist\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n billing_spend_guardrail: {\n resourceType: \"billing_spend_guardrail\",\n tableName: \"spend_guardrail\",\n schemaName: \"billing\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Billing Spend Guardrail\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n calendar_event: {\n resourceType: \"calendar_event\",\n tableName: \"calendar_event\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Calendar Event\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n canvas_score: {\n resourceType: \"canvas_score\",\n tableName: \"canvas_scores\",\n schemaName: \"canvas\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Canvas Score\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n canvas_view: {\n resourceType: \"canvas_view\",\n tableName: \"canvas_views\",\n schemaName: \"canvas\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Canvas View\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n category: {\n resourceType: \"category\",\n tableName: \"categories\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Category\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n cmp_feedback: {\n resourceType: \"cmp_feedback\",\n tableName: \"cmp_response_feedback\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cmp Feedback\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n comment: {\n resourceType: \"comment\",\n tableName: \"comments\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Comment\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_certified_printer: {\n resourceType: \"commerce_certified_printer\",\n tableName: \"certified_printer\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Certified Printer\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_cloud_sync_connection: {\n resourceType: \"commerce_cloud_sync_connection\",\n tableName: \"cloud_sync_connection\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Cloud Sync Connection\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_intake_batch: {\n resourceType: \"commerce_intake_batch\",\n tableName: \"intake_batch\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Intake Batch\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_label_batch: {\n resourceType: \"commerce_label_batch\",\n tableName: \"label_batch\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Label Batch\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_marketplace_account: {\n resourceType: \"commerce_marketplace_account\",\n tableName: \"marketplace_account\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Marketplace Account\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_print_order: {\n resourceType: \"commerce_print_order\",\n tableName: \"print_order\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Print Order\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n commerce_product: {\n resourceType: \"commerce_product\",\n tableName: \"product\",\n schemaName: \"commerce\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Commerce Product\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n contact_medium: {\n resourceType: \"contact_medium\",\n tableName: \"contact_medium\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Contact Medium\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n contact_submission: {\n resourceType: \"contact_submission\",\n tableName: \"contact_submissions\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Contact Submission\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n context_item_suggestion: {\n resourceType: \"context_item_suggestion\",\n tableName: \"context_item_suggestions\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Context Item Suggestion\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n crm_blocklist_entry: {\n resourceType: \"crm_blocklist_entry\",\n tableName: \"blocklist_entry\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Crm Blocklist Entry\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n crm_registry_ingest_run: {\n resourceType: \"crm_registry_ingest_run\",\n tableName: \"registry_ingest_run\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Crm Registry Ingest Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n crm_sending_policy: {\n resourceType: \"crm_sending_policy\",\n tableName: \"sending_policy\",\n schemaName: \"crm\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Crm Sending Policy\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n custom_field_definition: {\n resourceType: \"custom_field_definition\",\n tableName: \"custom_field_definition\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Custom Field Definition\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n cx_agent_memory: {\n resourceType: \"cx_agent_memory\",\n tableName: \"agent_memory\",\n schemaName: \"chat\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cx Agent Memory\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n cx_user_request: {\n resourceType: \"cx_user_request\",\n tableName: \"user_request\",\n schemaName: \"chat\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Cx User Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n derive_run: {\n resourceType: \"derive_run\",\n tableName: \"derive_runs\",\n schemaName: \"docproc\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Derive Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n dict_entry: {\n resourceType: \"dict_entry\",\n tableName: \"dict_entries\",\n schemaName: \"dictionary\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Dict Entry\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n dict_setting: {\n resourceType: \"dict_setting\",\n tableName: \"dict_settings\",\n schemaName: \"dictionary\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Dict Setting\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n doc_render: {\n resourceType: \"doc_render\",\n tableName: \"doc_render\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Doc Render\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n doc_signature: {\n resourceType: \"doc_signature\",\n tableName: \"doc_signature\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Doc Signature\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n egress_device: {\n resourceType: \"egress_device\",\n tableName: \"egress_device\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Egress Device\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n esign_provider_binding: {\n resourceType: \"esign_provider_binding\",\n tableName: \"provider_binding\",\n schemaName: \"esign\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Esign Provider Binding\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n external_link: {\n resourceType: \"external_link\",\n tableName: \"external_link\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"External Link\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n external_source: {\n resourceType: \"external_source\",\n tableName: \"external_source\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"External Source\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n game_badge: {\n resourceType: \"game_badge\",\n tableName: \"game_badge\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Game Badge\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n game_result: {\n resourceType: \"game_result\",\n tableName: \"game_result\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Game Result\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n game_room: {\n resourceType: \"game_room\",\n tableName: \"game_room\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Game Room\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n google_document: {\n resourceType: \"google_document\",\n tableName: \"google_document\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Google file\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n guided_checklist_run: {\n resourceType: \"guided_checklist_run\",\n tableName: \"guided_checklist_run\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Guided Checklist Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n heatmap_save: {\n resourceType: \"heatmap_save\",\n tableName: \"heatmap_saves\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Heatmap Save\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hindsight_regression_case: {\n resourceType: \"hindsight_regression_case\",\n tableName: \"regression_case\",\n schemaName: \"hindsight\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hindsight Regression Case\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hindsight_replay_step: {\n resourceType: \"hindsight_replay_step\",\n tableName: \"replay_step\",\n schemaName: \"hindsight\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hindsight Replay Step\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_alert_routing_rule: {\n resourceType: \"hr_alert_routing_rule\",\n tableName: \"alert_routing_rule\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Alert Routing Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_auto_close_rule: {\n resourceType: \"hr_auto_close_rule\",\n tableName: \"auto_close_rule\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Auto Close Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_careers_portal: {\n resourceType: \"hr_careers_portal\",\n tableName: \"careers_portal\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Careers Portal\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_crew: {\n resourceType: \"hr_crew\",\n tableName: \"crew\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Crew\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_deduction_code: {\n resourceType: \"hr_deduction_code\",\n tableName: \"deduction_code\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Deduction Code\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_department: {\n resourceType: \"hr_department\",\n tableName: \"department\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Department\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_earning_code: {\n resourceType: \"hr_earning_code\",\n tableName: \"earning_code\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Earning Code\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_holiday_calendar: {\n resourceType: \"hr_holiday_calendar\",\n tableName: \"holiday_calendar\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Holiday Calendar\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_interview_kit: {\n resourceType: \"hr_interview_kit\",\n tableName: \"interview_kit\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Interview Kit\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_job_title: {\n resourceType: \"hr_job_title\",\n tableName: \"job_title\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Job Title\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_jurisdiction_rule_org_decision: {\n resourceType: \"hr_jurisdiction_rule_org_decision\",\n tableName: \"jurisdiction_rule_org_decision\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Jurisdiction Rule Org Decision\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_location: {\n resourceType: \"hr_location\",\n tableName: \"location\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Location\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_overtime_alert_rule: {\n resourceType: \"hr_overtime_alert_rule\",\n tableName: \"overtime_alert_rule\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Overtime Alert Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_pay_group: {\n resourceType: \"hr_pay_group\",\n tableName: \"pay_group\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Pay Group\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_posting: {\n resourceType: \"hr_posting\",\n tableName: \"posting\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Posting\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_provider_binding: {\n resourceType: \"hr_provider_binding\",\n tableName: \"provider_binding\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Provider Binding\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_recalculation_batch: {\n resourceType: \"hr_recalculation_batch\",\n tableName: \"recalculation_batch\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Recalculation Batch\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_schedule: {\n resourceType: \"hr_schedule\",\n tableName: \"schedule\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Schedule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_schedule_guidance: {\n resourceType: \"hr_schedule_guidance\",\n tableName: \"schedule_guidance\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Schedule Guidance\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_schedule_template: {\n resourceType: \"hr_schedule_template\",\n tableName: \"schedule_template\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Schedule Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n hr_workflow_definition: {\n resourceType: \"hr_workflow_definition\",\n tableName: \"workflow_definition\",\n schemaName: \"hr\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Hr Workflow Definition\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n iam_api_key: {\n resourceType: \"iam_api_key\",\n tableName: \"api_keys\",\n schemaName: \"iam\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Iam Api Key\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n invitation_code: {\n resourceType: \"invitation_code\",\n tableName: \"invitation_codes\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Invitation Code\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n invitation_request: {\n resourceType: \"invitation_request\",\n tableName: \"invitation_requests\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Invitation Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n io_comment: {\n resourceType: \"io_comment\",\n tableName: \"io_comment\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Io Comment\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n io_import: {\n resourceType: \"io_import\",\n tableName: \"io_import\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Io Import\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n io_outbox: {\n resourceType: \"io_outbox\",\n tableName: \"io_outbox\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Io Outbox\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n item_mastery: {\n resourceType: \"item_mastery\",\n tableName: \"item_mastery\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Item Mastery\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_alert: {\n resourceType: \"kg_alert\",\n tableName: \"kg_alerts\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Alert\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_sweep_queue: {\n resourceType: \"kg_sweep_queue\",\n tableName: \"kg_sweep_queue\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Sweep Queue\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_sweep_run: {\n resourceType: \"kg_sweep_run\",\n tableName: \"kg_sweep_run\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Sweep Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_sweep_state: {\n resourceType: \"kg_sweep_state\",\n tableName: \"kg_sweep_state\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Sweep State\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_value_match: {\n resourceType: \"kg_value_match\",\n tableName: \"kg_value_matches\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Kg Value Match\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n league_membership: {\n resourceType: \"league_membership\",\n tableName: \"league_membership\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"League Membership\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n library_doc: {\n resourceType: \"library_doc\",\n tableName: \"library_docs\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Library Doc\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n /**\n * A user/org-created mandate (`mandate.definition`). Sharing NEVER moves it: a person or\n * organization share is an iam.permissions grant, \"Anyone\" is visibility public, and the\n * creator keeps ownership (mandate_share_without_move.sql, 2026-09-25). No id route —\n * mandate pages are addressed by key — so `urlPathTemplate` stays honestly empty.\n */\n mandate: {\n resourceType: \"mandate\",\n tableName: \"definition\",\n schemaName: \"mandate\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Mandate\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n mandate_binding: {\n resourceType: \"mandate_binding\",\n tableName: \"binding\",\n schemaName: \"mandate\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Mandate Binding\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n mandate_treatment: {\n resourceType: \"mandate_treatment\",\n tableName: \"treatment\",\n schemaName: \"mandate\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Mandate Treatment\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n media_catalog_setting: {\n resourceType: \"media_catalog_setting\",\n tableName: \"catalog_setting\",\n schemaName: \"media\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Media Catalog Setting\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n media_source_library: {\n resourceType: \"media_source_library\",\n tableName: \"source_library\",\n schemaName: \"media\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Media Source Library\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n meet_call_invite: {\n resourceType: \"meet_call_invite\",\n tableName: \"meet_call_invites\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Meet Call Invite\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n meet_meeting: {\n resourceType: \"meet_meeting\",\n tableName: \"meet_meetings\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Meeting\",\n urlPathTemplate: \"/meet/{id}\",\n rlsUsesHasPermission: true,\n },\n merge_field_provenance: {\n resourceType: \"merge_field_provenance\",\n tableName: \"merge_field_provenance\",\n schemaName: \"custom\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Merge Field Provenance\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ner_shadow: {\n resourceType: \"ner_shadow\",\n tableName: \"ner_canonicalizer_shadow\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ner Shadow\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification: {\n resourceType: \"notification\",\n tableName: \"notification\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification_event_override: {\n resourceType: \"notification_event_override\",\n tableName: \"notification_event_override\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification Event Override\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification_event_type: {\n resourceType: \"notification_event_type\",\n tableName: \"notification_event_type\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification Event Type\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification_preference: {\n resourceType: \"notification_preference\",\n tableName: \"notification_preference\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification Preference\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ops_proof_check: {\n resourceType: \"ops_proof_check\",\n tableName: \"proof_check\",\n schemaName: \"ops\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ops Proof Check\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ops_proof_scenario: {\n resourceType: \"ops_proof_scenario\",\n tableName: \"proof_scenario\",\n schemaName: \"ops\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ops Proof Scenario\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n org_member_control: {\n resourceType: \"org_member_control\",\n tableName: \"org_member_controls\",\n schemaName: \"iam\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Org Member Control\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n organization: {\n resourceType: \"organization\",\n tableName: \"organizations\",\n schemaName: \"iam\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Organization\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n output_feedback: {\n resourceType: \"output_feedback\",\n tableName: \"output_feedback\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Output Feedback\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n page_extraction_job: {\n resourceType: \"page_extraction_job\",\n tableName: \"page_extraction_jobs\",\n schemaName: \"docproc\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Page Extraction Job\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n page_extraction_page_run: {\n resourceType: \"page_extraction_page_run\",\n tableName: \"page_extraction_page_runs\",\n schemaName: \"docproc\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Page Extraction Page Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n pc_article: {\n resourceType: \"pc_article\",\n tableName: \"pc_articles\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Pc Article\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n pc_episode: {\n resourceType: \"pc_episode\",\n tableName: \"pc_episodes\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Pc Episode\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n pc_show: {\n resourceType: \"pc_show\",\n tableName: \"pc_shows\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Pc Show\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n pc_studio_run: {\n resourceType: \"pc_studio_run\",\n tableName: \"pc_studio_runs\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Pc Studio Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n plan_entity: {\n resourceType: \"plan_entity\",\n tableName: \"entity\",\n schemaName: \"plan\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Plan Entity\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n plan_profile: {\n resourceType: \"plan_profile\",\n tableName: \"profile\",\n schemaName: \"plan\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Plan Profile\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n platform_action_request: {\n resourceType: \"platform_action_request\",\n tableName: \"action_request\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Platform Action Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n platform_outcome_event: {\n resourceType: \"platform_outcome_event\",\n tableName: \"outcome_event\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Platform Outcome Event\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n platform_saved_view: {\n resourceType: \"platform_saved_view\",\n tableName: \"saved_view\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Platform Saved View\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n platform_share_link: {\n resourceType: \"platform_share_link\",\n tableName: \"share_links\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Platform Share Link\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n podcast_race: {\n resourceType: \"podcast_race\",\n tableName: \"pc_race\",\n schemaName: \"podcast\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Podcast Race\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n product_capture_item: {\n resourceType: \"product_capture_item\",\n tableName: \"product_capture_item\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Product Capture Item\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n purpose: {\n resourceType: \"purpose\",\n tableName: \"purpose\",\n schemaName: \"platform\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Purpose\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n research_context_bundle: {\n resourceType: \"research_context_bundle\",\n tableName: \"rs_context_bundle\",\n schemaName: \"research\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Research Context Bundle\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n scope_suggestion: {\n resourceType: \"scope_suggestion\",\n tableName: \"scope_suggestions\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Scope Suggestion\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_engine_schedule: {\n resourceType: \"seo_engine_schedule\",\n tableName: \"engine_schedule\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Engine Schedule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_gsc_dig_rule: {\n resourceType: \"seo_gsc_dig_rule\",\n tableName: \"gsc_dig_rule\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Gsc Dig Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_keyword_class_rule: {\n resourceType: \"seo_keyword_class_rule\",\n tableName: \"keyword_class_rule\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Keyword Class Rule\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n // A news / coverage monitor (aidream migration 1411d): shared directly or by link (name only);\n // its stories follow it as components. No page of its own yet, so no URL template.\n seo_coverage_tracker: {\n resourceType: \"seo_coverage_tracker\",\n tableName: \"coverage_tracker\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"News Monitor\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_source_request: {\n resourceType: \"seo_source_request\",\n tableName: \"source_request\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Source Request\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n seo_story_angle: {\n resourceType: \"seo_story_angle\",\n tableName: \"story_angle\",\n schemaName: \"seo\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Seo Story Angle\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n sms_consent: {\n resourceType: \"sms_consent\",\n tableName: \"sms_consent\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sms Consent\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n sms_notification: {\n resourceType: \"sms_notification\",\n tableName: \"sms_notifications\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sms Notification\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n sms_notification_preference: {\n resourceType: \"sms_notification_preference\",\n tableName: \"sms_notification_preferences\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sms Notification Preference\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n sms_phone_number: {\n resourceType: \"sms_phone_number\",\n tableName: \"sms_phone_numbers\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sms Phone Number\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n studio_recording_chunks: {\n resourceType: \"studio_recording_chunks\",\n tableName: \"studio_recording_chunks\",\n schemaName: \"transcripts\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Studio Recording Chunks\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n studio_run: {\n resourceType: \"studio_run\",\n tableName: \"studio_runs\",\n schemaName: \"transcripts\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Studio Run\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_attempt: {\n resourceType: \"study_attempt\",\n tableName: \"study_attempt\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Attempt\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_goal: {\n resourceType: \"study_goal\",\n tableName: \"study_goal\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Goal\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_plan: {\n resourceType: \"study_plan\",\n tableName: \"study_plan\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Plan\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_plan_block: {\n resourceType: \"study_plan_block\",\n tableName: \"study_plan_block\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Plan Block\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_plan_day: {\n resourceType: \"study_plan_day\",\n tableName: \"study_plan_day\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Plan Day\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_session: {\n resourceType: \"study_session\",\n tableName: \"study_session\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Session\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n udt_dataset_template: {\n resourceType: \"udt_dataset_template\",\n tableName: \"udt_dataset_templates\",\n schemaName: \"workbench\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Udt Dataset Template\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ui_surface_agent_pref: {\n resourceType: \"ui_surface_agent_pref\",\n tableName: \"ui_surface_agent_pref\",\n schemaName: \"ui\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ui Surface Agent Pref\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n ui_surface_config: {\n resourceType: \"ui_surface_config\",\n tableName: \"ui_surface_config\",\n schemaName: \"ui\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Ui Surface Config\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_achievement: {\n resourceType: \"user_achievement\",\n tableName: \"user_achievements\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Achievement\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_email_preference: {\n resourceType: \"user_email_preference\",\n tableName: \"user_email_preferences\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Email Preference\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_markdown_sample: {\n resourceType: \"user_markdown_sample\",\n tableName: \"user_markdown_samples\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Markdown Sample\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_memory: {\n resourceType: \"user_memory\",\n tableName: \"user_memory\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Memory\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_profile: {\n resourceType: \"user_profile\",\n tableName: \"profiles\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Profile\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_stat: {\n resourceType: \"user_stat\",\n tableName: \"user_stats\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Stat\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n user_surface_state: {\n resourceType: \"user_surface_state\",\n tableName: \"user_surface_state\",\n schemaName: \"users\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"User Surface State\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_capture: {\n resourceType: \"wbx_capture\",\n tableName: \"wbx_capture\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Capture\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_demo: {\n resourceType: \"wbx_demo\",\n tableName: \"wbx_demo\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Demo\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_highlight: {\n resourceType: \"wbx_highlight\",\n tableName: \"wbx_highlight\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Highlight\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_pattern: {\n resourceType: \"wbx_pattern\",\n tableName: \"wbx_pattern\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Pattern\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_screenshot: {\n resourceType: \"wbx_screenshot\",\n tableName: \"wbx_screenshot\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Screenshot\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n wbx_seo_audit: {\n resourceType: \"wbx_seo_audit\",\n tableName: \"wbx_seo_audit\",\n schemaName: \"extend\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Wbx Seo Audit\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n web_youtube_video: {\n resourceType: \"web_youtube_video\",\n tableName: \"youtube_video\",\n schemaName: \"web\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Web Youtube Video\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n workflow_comparison: {\n resourceType: \"workflow_comparison\",\n tableName: \"comparison\",\n schemaName: \"workflow\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Workflow Comparison\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n agent_term_list: {\n resourceType: \"agent_term_list\",\n tableName: \"term_list\",\n schemaName: \"agent\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Term List\",\n urlPathTemplate: \"/resources/term-lists\",\n rlsUsesHasPermission: true,\n },\n document: {\n resourceType: \"document\",\n tableName: \"document\",\n schemaName: \"content\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Document\",\n urlPathTemplate: \"/documents/{id}\",\n rlsUsesHasPermission: true,\n },\n files_sync_mapping: {\n resourceType: \"files_sync_mapping\",\n tableName: \"sync_mappings\",\n schemaName: \"files\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Sync Mapping\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n kg_suggestion_ack: {\n resourceType: \"kg_suggestion_ack\",\n tableName: \"kg_suggestion_ack\",\n schemaName: \"rag\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"KG Suggestion Ack\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n mcp_user_conn: {\n resourceType: \"mcp_user_conn\",\n tableName: \"mcp_user_conn\",\n schemaName: \"tool\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"MCP user connection\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n notification_channel_preference: {\n resourceType: \"notification_channel_preference\",\n tableName: \"notification_channel_preference\",\n schemaName: \"communication\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Notification Channel Preference\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_reminder_context: {\n resourceType: \"study_reminder_context\",\n tableName: \"study_reminder_context\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Reminder Context\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n study_reminder_delivery: {\n resourceType: \"study_reminder_delivery\",\n tableName: \"study_reminder_delivery\",\n schemaName: \"education\",\n idColumn: \"id\",\n ownerColumn: \"created_by\",\n isPublicColumn: null,\n displayLabel: \"Study Reminder Delivery\",\n urlPathTemplate: \"\",\n rlsUsesHasPermission: true,\n },\n} as const satisfies Record<string, ShareableResourceEntry>;\n\n/**\n * Union of all valid resource-type tokens. Exactly mirrors the registry keys.\n */\nexport type ResourceType = keyof typeof SHAREABLE_RESOURCE_REGISTRY;\n\n/** Ordered list of resource-type tokens (useful for tests, dropdowns, etc.) */\nexport const RESOURCE_TYPES = Object.keys(\n SHAREABLE_RESOURCE_REGISTRY,\n) as ResourceType[];\n\n/**\n * Look up a registry entry by canonical entity token. A physical table name is\n * never accepted as an identity key: names such as `definition` repeat across\n * schemas, so a bare-name lookup cannot be made deterministic.\n */\nexport function getShareableResource(\n resourceType: string,\n): ShareableResourceEntry | undefined {\n if (resourceType in SHAREABLE_RESOURCE_REGISTRY) {\n return SHAREABLE_RESOURCE_REGISTRY[resourceType as ResourceType];\n }\n return undefined;\n}\n\n/**\n * Resolve a resource type to its PHYSICAL Postgres table name. Throws if the\n * type isn't registered. NOTE: for `iam.permissions.resource_type` filters and\n * share-RPC arguments use the TOKEN (`resourceType`) instead — this returns the\n * physical table, which differs from the token on canonical tables.\n */\nexport function resolveTableName(resourceType: string): string {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource type: ${resourceType}. Register it in platform.shareable_resource_registry (see utils/permissions/registry.ts and features/sharing/FEATURE.md).`,\n );\n }\n return entry.tableName;\n}\n\n/**\n * Resolve a resource type to its canonical ENTITY TOKEN — the value stored in\n * `iam.permissions.resource_type` and passed to the share RPCs. Throws if the\n * type isn't registered. Use this (never resolveTableName) for any\n * permissions/grant query or RPC call.\n */\nexport function resolveResourceToken(resourceType: string): string {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource type: ${resourceType}. Register it in platform.shareable_resource_registry (see utils/permissions/registry.ts and features/sharing/FEATURE.md).`,\n );\n }\n return entry.resourceType;\n}\n\n/** Human-readable label for a resource type (replaces the legacy map). */\nexport function getResourceTypeLabel(resourceType: string): string {\n return getShareableResource(resourceType)?.displayLabel ?? resourceType;\n}\n\n/**\n * Build the share path for a resource. Returns a relative path, or `null` when\n * we genuinely cannot open this resource — the caller must handle null and say\n * so honestly rather than rendering a broken link.\n *\n * THE DOOR LAW, and specifically the \"one canonical path per operation\" rule:\n * route truth is the ENTITY REGISTRY (`features/scopes/registry`), so that is\n * consulted first. `url_path_template` in `platform.shareable_resource_registry`\n * is a second, DB-side route authority that had drifted badly — 24 of 73 active\n * rows advertised routes that do not exist (`/apps/{id}` when the real route is\n * `/applets/manage/{id}`; `/skills/{id}`, `/workflows/{id}`, `/quizzes/{id}`,\n * `/canvas/{id}`, `/code/files/{id}`, `/runs/{id}`, `/scopes/{id}` …). Audited\n * and corrected against the live `app/` tree on 2026-08-14\n * (`migrations/sharing_registry_route_truth_d138.sql`): every row now either\n * points at a real route or is EMPTY, and empty means \"no signed-in destination\"\n * — this function returns null and the caller renders no link.\n *\n * It is now only the FALLBACK, used for tokens the entity registry doesn't\n * cover. **Never add a plausible-looking path to a registry row to make a link\n * appear**; that guesswork IS defect D138.\n *\n * Two guesses were removed, both of which produced 404s that reached other\n * people:\n * - the `/${resourceType}/${resourceId}` fabrication for unregistered types;\n * - templates that still contain a placeholder after substitution — either a\n * non-id key (`{slug}`) or a second distinct segment the template can't\n * express (`/workflows/{id}/triggers/{id}`).\n */\nexport function getResourceSharePath(\n resourceType: string,\n resourceId: string,\n): string | null {\n const registryHref = resolveEntityHref(resourceType, resourceId);\n if (registryHref) return registryHref;\n\n // A REGISTERED token with no `hrefFor` is a decision, not a gap: we looked and\n // there is no route (`workflow` lives in workflow-studio; `skill` is\n // admin-only). Falling through to the template here would hand back exactly\n // the stale `/workflows/{id}` and `/skills/{id}` this function exists to stop.\n // Only a resource type the entity registry does not know at all may fall back.\n if (isKnownEntity(resourceType)) return null;\n\n const entry = getShareableResource(resourceType);\n if (!entry?.urlPathTemplate) return null;\n\n const path = entry.urlPathTemplate.replace(\"{id}\", resourceId);\n return /\\{[^}]*\\}/.test(path) ? null : path;\n}\n","/**\n * The ONE permission-level ladder.\n *\n * Every rank map, label map, ordered array and level union in the app derives\n * from `PERMISSION_LEVELS` below. Before this module existed the ladder was\n * hard-coded in eight places as `viewer | editor | admin`, so a fourth level\n * would have been missing from most of them — and missing SILENTLY: a rank\n * lookup returned `undefined`, `undefined >= 2` is `false`, and the holder of\n * the new level was refused with no message anywhere (law 4, nothing fails\n * silently). `getPermissionLevelLabel` was worse: it returned `undefined` and\n * the screen rendered a blank string where the level should be.\n *\n * ## Code ladder vs database enum — deliberately different widths\n *\n * `PERMISSION_LEVELS` (the CODE ladder) is the superset and includes\n * `commenter`. `DB_PERMISSION_LEVELS` (the DATABASE enum, read at runtime from\n * the generated `Constants`, never hand-typed) is what `public.permission_level`\n * actually holds today: `viewer, editor, admin`. `commenter` is NOT there yet.\n *\n * That gap is the whole point and it is safe in one direction only:\n *\n * - READING / COMPARING / LABELING a level: always use the code ladder. It\n * tolerates `commenter` the moment the database gains it, with no code change\n * and no silent refusal in between. Nothing breaks while the value never\n * arrives — the extra rank and label simply go unused.\n * - WRITING a level to the database, or OFFERING it in a picker: narrow through\n * `toDbPermissionLevel` / `DB_PERMISSION_LEVELS` first. Sending `commenter`\n * to Postgres today fails with `invalid input value for enum\n * public.permission_level`, so the ladder refuses it HERE, by name, with the\n * remedy — rather than letting a picker offer a value the save will reject.\n *\n * When `ALTER TYPE public.permission_level ADD VALUE 'commenter' BEFORE 'editor'`\n * is applied and `pnpm db-types` regenerated, `DB_PERMISSION_LEVELS` widens on\n * its own and every picker driven by it gains the option with no further edit.\n *\n * Doctrine: the access levels are `viewer` · `commenter` · `editor` · `admin`\n * (AI Matrx Data Doctrine R18, 2026-09-10;\n * common-docs/systems/platform/access/DECISIONS.md).\n * Guard: `utils/permissions/__tests__/permission-levels.test.ts` fails if any\n * rank map, label map or ordered array omits a level.\n */\n\nimport type { DbPermissionLevel, PermissionLevel } from \"@ai-matrx/data/access\";\nimport { DB_PERMISSION_LEVELS, PERMISSION_LEVEL_RANK as PACKAGE_RANK } from \"@ai-matrx/data/access\";\n\n// ONE-LADDER (Arman 2026-10-10): the ladder is View · Comment · Edit · Full access and lives in the\n// package (`@ai-matrx/data/access`, four levels since 0.8.47); nothing here overrides it.\n// Named, never `export *`: a star re-export of a sibling compiles to a `__reExport(..., star)` that runs\n// before the sibling's import binding exists under a CommonJS transform (jest), and drags the whole\n// access section through this module.\nexport {\n PERMISSION_LEVELS,\n isPermissionLevel,\n PERMISSION_LEVEL_LABELS,\n PERMISSION_LEVEL_HINTS,\n PERMISSION_LEVEL_SHORT_LABELS,\n DB_PERMISSION_LEVELS,\n isDbPermissionLevel,\n toDbPermissionLevel,\n} from \"@ai-matrx/data/access\";\nexport type { DbPermissionLevel, PermissionLevel } from \"@ai-matrx/data/access\";\n\n// normalizePermissionLevel / parsePermissionLevel are the ladder's own (one implementation, identical answers for\n// every input; `edit_content` reads as Edit, an unrecognised value is logged loudly and read as null).\nexport { normalizePermissionLevel, parsePermissionLevel } from \"@ai-matrx/data/access\";\n\n/** The levels a picker may offer: what the database stores, never the retired `edit_content`. */\nexport const OFFERED_DB_PERMISSION_LEVELS: readonly DbPermissionLevel[] = DB_PERMISSION_LEVELS;\n\n/** Rank of every level; a stray stored `edit_content` ranks as Edit so old data never crashes. */\nexport const PERMISSION_LEVEL_RANK: Record<PermissionLevel, number> & { edit_content: number } = {\n ...PACKAGE_RANK,\n edit_content: PACKAGE_RANK.editor,\n};\n\nexport function permissionLevelRank(level: PermissionLevel): number {\n const rank = (PERMISSION_LEVEL_RANK as Record<string, number>)[level];\n if (rank === undefined) {\n console.error(`[permissions] no rank for permission level ${JSON.stringify(level)}. Add it to PERMISSION_LEVELS in @ai-matrx/data/access (permissionLevels.ts).`);\n return Number.NaN;\n }\n return rank;\n}\n","/**\n * Permission System Types\n *\n * The single source of truth for which resource types are shareable lives in\n * the database table `shareable_resource_registry`, mirrored in TypeScript by\n * `./registry.ts`. Do NOT add resource types here — add them to the registry.\n */\n\nexport type { ShareableResourceEntry, ResourceType } from \"./registry\";\nexport {\n SHAREABLE_RESOURCE_REGISTRY,\n RESOURCE_TYPES,\n getShareableResource,\n resolveTableName,\n resolveResourceToken,\n getResourceTypeLabel,\n getResourceSharePath,\n} from \"./registry\";\n\nimport type { ResourceType } from \"./registry\";\n\n// ============================================================================\n// Core Permission Types\n// ============================================================================\n\n// The access levels are `viewer` · `commenter` · `editor` · `admin` — one vocabulary everywhere\n// (AI Matrx Data Doctrine R18, 2026-09-10, recorded in\n// common-docs/systems/platform/access/DECISIONS.md). The ladder is declared ONCE in `./levels.ts`\n// and re-exported here; `commenter` is in the code ladder already and tolerated everywhere, while\n// the live `public.permission_level` enum still holds only `viewer, editor, admin` — see that\n// module's header for which side of the gap each call site belongs on.\n// Register: /projects/data-doctrine-adoption/REGISTER.md#DD-050\nexport type { PermissionLevel, DbPermissionLevel } from \"./levels\";\nexport {\n PERMISSION_LEVELS,\n PERMISSION_LEVEL_RANK,\n PERMISSION_LEVEL_LABELS,\n PERMISSION_LEVEL_SHORT_LABELS,\n DB_PERMISSION_LEVELS,\n isPermissionLevel,\n isDbPermissionLevel,\n toDbPermissionLevel,\n parsePermissionLevel,\n permissionLevelRank,\n} from \"./levels\";\n\nimport {\n PERMISSION_LEVELS,\n PERMISSION_LEVEL_LABELS,\n permissionLevelRank,\n type PermissionLevel,\n} from \"./levels\";\n\n/**\n * Complete permission record from database\n */\nexport interface Permission {\n id: string;\n resourceType: ResourceType;\n resourceId: string;\n grantedToUserId?: string | null | undefined;\n grantedToOrganizationId?: string | null | undefined;\n isPublic?: boolean | undefined;\n permissionLevel: PermissionLevel;\n createdAt?: Date | undefined;\n createdBy?: string | undefined;\n}\n\n/**\n * Enriched permission with user/org details for display\n */\nexport interface PermissionWithDetails extends Permission {\n grantedToUser?: undefined | {\n id: string;\n email: string;\n displayName?: string | undefined;\n avatarUrl?: string | undefined;\n /** Not a member of the thing's organization (the store's answer, `get_resource_permissions`): shown as Guest. */\n isGuest?: boolean | undefined;\n };\n grantedToOrganization?: undefined | {\n id: string;\n name: string;\n slug: string;\n logoUrl?: string | undefined;\n };\n createdByUser?: {\n id: string;\n email: string;\n displayName?: string | undefined;\n };\n}\n\n// ============================================================================\n// Share Operation Types\n// ============================================================================\n\nexport interface ShareWithUserOptions {\n resourceType: ResourceType;\n resourceId: string;\n userId: string;\n permissionLevel: PermissionLevel;\n /**\n * Optional human title of the resource, used for the in-app DM notification\n * card (\"X shared '<title>' with you\"). Falls back to the type label.\n */\n resourceName?: string | undefined;\n /**\n * The organization the SHARED OBJECT lives in, from the page that opened the dialog (the\n * object's own resolver — never the active organization). The in-app notification is filed\n * there. Absent, the notification is filed in the organization the person is working in, and\n * when none is picked it is skipped and said — it never raises \"Which workspace is this for?\"\n * (lane ACCESS-FIX-18, VERIFIER-18 H4).\n */\n organizationId?: string | null | undefined;\n}\n\n/** Organization AVAILABILITY (org configuration), never a share — see grantOrgAvailability. */\nexport interface OrgAvailabilityOptions {\n resourceType: ResourceType;\n resourceId: string;\n organizationId: string;\n /**\n * Explicit level. Omit to let the server apply the org module's\n * `default_permission` (falls back to 'viewer'). Pickers pass a level; the\n * \"contribute\" flow omits it.\n */\n permissionLevel?: PermissionLevel | undefined;\n}\n\nexport interface MakePublicOptions {\n resourceType: ResourceType;\n resourceId: string;\n permissionLevel?: PermissionLevel | undefined;\n}\n\nexport interface UpdatePermissionOptions {\n resourceType: ResourceType;\n resourceId: string;\n userId?: string | undefined;\n organizationId?: string | undefined;\n isPublic?: boolean | undefined;\n newLevel: PermissionLevel;\n}\n\nexport interface RevokeAccessOptions {\n resourceType: ResourceType;\n resourceId: string;\n userId?: string | undefined;\n organizationId?: string | undefined;\n isPublic?: boolean | undefined;\n}\n\n// ============================================================================\n// Permission Check Types\n// ============================================================================\n\nexport interface PermissionCheckResult {\n hasAccess: boolean;\n level?: PermissionLevel | undefined;\n isOwner: boolean;\n reason?: string | undefined;\n}\n\nexport interface CheckPermissionOptions {\n resourceType: ResourceType;\n resourceId: string;\n requiredLevel?: PermissionLevel | undefined;\n}\n\n// ============================================================================\n// Resource Owner Types\n// ============================================================================\n\nexport interface OwnedResource {\n id: string;\n user_id: string;\n [key: string]: unknown;\n}\n\nexport interface OwnerCheckResult {\n isOwner: boolean;\n ownerId: string;\n}\n\n// ============================================================================\n// Sharing UI Types\n// ============================================================================\n\nexport type ShareTargetType = \"user\" | \"organization\" | \"public\";\n\nexport interface SharingState {\n isOpen: boolean;\n activeTab: ShareTargetType;\n permissions: PermissionWithDetails[];\n loading: boolean;\n error: string | null;\n searchQuery: string;\n selectedPermissionLevel: PermissionLevel;\n}\n\nexport interface ShareActionResult {\n success: boolean;\n message?: string | undefined;\n error?: string | undefined;\n permission?: Permission | undefined;\n}\n\n// ============================================================================\n// Permission Helpers\n// ============================================================================\n\n/**\n * Check if a permission level satisfies a required level\n */\nexport function satisfiesPermissionLevel(\n current: PermissionLevel,\n required: PermissionLevel,\n): boolean {\n return permissionLevelRank(current) >= permissionLevelRank(required);\n}\n\n/**\n * Get all permission levels equal to or higher than the given level\n */\nexport function getPermissionLevelsAtOrAbove(\n level: PermissionLevel,\n): PermissionLevel[] {\n const levelIndex = PERMISSION_LEVELS.indexOf(level);\n return [...PERMISSION_LEVELS].slice(levelIndex);\n}\n\n/**\n * Get display label for permission level\n */\nexport function getPermissionLevelLabel(level: PermissionLevel): string {\n // Never `undefined` for a known level, and never a blank string on screen for\n // an unknown one — an unrecognised level names itself instead (law 4).\n return PERMISSION_LEVEL_LABELS[level] ?? `Unknown level (${level})`;\n}\n\n/**\n * Validate permission data\n */\nexport function validatePermission(permission: Partial<Permission>): boolean {\n if (!permission.resourceType) {\n throw new Error(\"Resource type is required\");\n }\n if (!permission.resourceId) {\n throw new Error(\"Resource ID is required\");\n }\n if (!permission.permissionLevel) {\n throw new Error(\"Permission level is required\");\n }\n\n const targetsSet = [\n !!permission.grantedToUserId,\n !!permission.grantedToOrganizationId,\n !!permission.isPublic,\n ].filter(Boolean).length;\n\n if (targetsSet !== 1) {\n throw new Error(\n \"Exactly one of grantedToUserId, grantedToOrganizationId, or isPublic must be set\",\n );\n }\n return true;\n}\n\n// ============================================================================\n// Error Types\n// ============================================================================\n\nexport class PermissionError extends Error {\n constructor(\n message: string,\n public code: string,\n public details?: unknown | undefined,\n ) {\n super(message);\n this.name = \"PermissionError\";\n }\n}\n\nexport enum PermissionErrorCode {\n NOT_FOUND = \"PERMISSION_NOT_FOUND\",\n ALREADY_EXISTS = \"PERMISSION_ALREADY_EXISTS\",\n INVALID_LEVEL = \"INVALID_PERMISSION_LEVEL\",\n INVALID_TARGET = \"INVALID_SHARE_TARGET\",\n UNAUTHORIZED = \"UNAUTHORIZED\",\n DATABASE_ERROR = \"DATABASE_ERROR\",\n VALIDATION_ERROR = \"VALIDATION_ERROR\",\n}\n","/**\n * THE PUBLIC LANE — the ONE list of resource types that have a real\n * anonymous, indexable page at `/p/e/[resourceType]/[id]`.\n *\n * Why this module exists: the list used to live as a private const inside the\n * server loader, so the SHARE UI could not know whether flipping a resource to\n * `visibility='public'` actually produced a reachable page. It therefore told\n * every owner \"anyone with the link can access this\" — for a brand, a site, a\n * workflow, anything — while no such link existed. A share surface that claims\n * access it cannot deliver is a defect (features/sharing/FEATURE.md: \"a share\n * surface that can't act must say why\").\n *\n * Being public is a DATA state (the `pub_read` RLS policy). Having a public\n * PAGE is a product decision, made here. A type joins this lane only when it\n * has a public renderer and genuinely belongs in the SEO/community lane — a\n * public `dm_conversation` or `wc_claim` must never auto-publish to an indexed\n * page. For everything else, anonymous access is the share-link lane\n * (`platform.share_links` → `/s/[token]`, noindex).\n */\n\n/**\n * THE PUBLIC COLUMN LANE — for every type in the lane, the EXACT columns the\n * anonymous viewer reads from its base row.\n *\n * Why names and not `select(\"*\")` (DD-186): a signed-out visitor may read only\n * the columns a relation declares to `anon`, and these tables no longer answer\n * `*` to the publishable key. `workbench.notes` and `agent.message_template`\n * both carry `created_by`, `updated_by`, `organization_id`, `metadata` and\n * `version`, which are nobody's business on an indexed public page — the loader\n * already refused to render them, but PostgREST was serving them to the browser\n * anyway, one HTTP round trip before the projection threw them away.\n *\n * `visibility` is in every list on purpose: the loader re-checks it in JS after\n * the read, and PostgREST cannot even filter on a column the role cannot select.\n *\n * Adding a type here means checking its columns against\n * matrx-frontend `lib/security/public-exposure.ts#ANON_COLUMN_SURFACE`; asking\n * for a column `anon` cannot read returns 42501 for the whole request, which\n * `pnpm check:anon-column-surface` is there to catch before a user does.\n *\n * `fc_set` is absent by design — it never takes this path. Its whole read is a\n * SECURITY DEFINER RPC (`get_public_flashcard_set`) that projects its own\n * columns server-side.\n */\nexport const PUBLIC_LANE_COLUMNS: Readonly<Record<string, readonly string[]>> = {\n fc_set: [],\n // One row of a table (access ladder T-40) — like `fc_set`, its whole read is a SECURITY DEFINER\n // door (`public.record_public_view`) that projects its own fields server-side.\n record: [],\n note: [\"id\", \"label\", \"content\", \"tags\", \"created_at\", \"updated_at\", \"visibility\"],\n message_template: [\n \"id\", \"label\", \"content\", \"role\", \"tags\", \"created_at\", \"updated_at\", \"visibility\",\n ],\n};\n\n/** Types served by the indexable public lane. Add only with a public renderer. */\nexport const PUBLIC_LANE_TYPES: ReadonlySet<string> = new Set(\n Object.keys(PUBLIC_LANE_COLUMNS),\n);\n\n/**\n * The columns the anonymous viewer may ask PostgREST for, as a `select` string.\n * Never falls back to `\"*\"`: a type in the lane with no declared columns is a\n * programming error, and returning `\"*\"` would quietly re-open the surface this\n * register exists to close.\n */\nexport function publicLaneSelect(resourceType: string): string {\n const columns = PUBLIC_LANE_COLUMNS[resourceType];\n if (!columns?.length) {\n throw new Error(\n `[matrx] publicLaneSelect(\"${resourceType}\"): the public lane declares no ` +\n `columns for this type. Add them to PUBLIC_LANE_COLUMNS in ` +\n `utils/permissions/publicLane.ts — a signed-out read must name its ` +\n `columns (DD-186), and \"*\" is refused by the grant.`,\n );\n }\n return columns.join(\",\");\n}\n\n/** Does `visibility='public'` give this type a reachable anonymous page? */\nexport function hasPublicPage(resourceType: string): boolean {\n return PUBLIC_LANE_TYPES.has(resourceType);\n}\n\n/**\n * The absolute public URL for a type in the lane, or null when the type has no\n * public page. Never fabricate a URL for a type outside the lane — that is the\n * exact lie this module was created to kill.\n */\nexport function publicResourceUrl(\n resourceType: string,\n id: string,\n): string | null {\n if (!hasPublicPage(resourceType)) return null;\n const base =\n process.env.NEXT_PUBLIC_APP_URL ||\n (typeof window !== \"undefined\" ? window.location.origin : \"\");\n return `${base}/p/e/${resourceType}/${id}`;\n}\n","/**\n * Share links — the canonical no-login sharing service.\n *\n * A share link is an opaque token that lets ANYONE (no sign-in) view a specific\n * resource. The token is the authorization: the anon-callable\n * `resolve_share_token` RPC (SECURITY DEFINER) bypasses `iam.has_access` and\n * returns the resource content. Minting/listing/revoking are owner-gated.\n *\n * Every write routes through a SECURITY DEFINER RPC — never touch\n * `platform.share_links` directly from the client. See\n * `migrations/share_links_canonical_system.sql` and features/sharing/FEATURE.md.\n */\nimport { shortLinkUrl } from \"@ai-matrx/kit/short-link\";\nimport { supabase } from \"./host\";\nimport type { SupabaseClient } from \"@supabase/supabase-js\";\nimport type { ResourceType } from \"./registry\";\nimport type { PermissionLevel } from \"./types\";\nimport { toDbPermissionLevel } from \"./levels\";\nimport { isJsonObject } from \"./host\";\nimport { operationFailed } from \"@ai-matrx/kit/errors\";\nimport { ensureOrgId } from \"./host\";\n\nexport interface ShareLink {\n id: string;\n token: string;\n /** Token of the /r short alias (platform.short_links) — a URL alias only, never authorization. */\n shortToken: string | null;\n permissionLevel: PermissionLevel;\n label: string | null;\n expiresAt: string | null;\n maxUses: number | null;\n useCount: number;\n isActive: boolean;\n createdAt: string | null;\n lastUsedAt: string | null;\n}\n\nexport interface ResolvedShareToken {\n success: boolean;\n /** Machine error code when success=false (not_found | revoked | expired | exhausted | gone | unknown_type). */\n error?: string | undefined;\n /** Human-readable message when success=false. */\n message?: string | undefined;\n resourceType?: string | undefined;\n resourceId?: string | undefined;\n permissionLevel?: PermissionLevel | undefined;\n displayLabel?: string | undefined;\n urlPathTemplate?: string | undefined;\n /** The resource row as JSON (internal/heavy columns stripped). */\n resource?: Record<string, unknown> | undefined;\n /**\n * What the link holder sees BENEATH the record (children inherit their\n * parent) — a per-type projection from `platform.share_link_children`, e.g.\n * a shared chat's visible messages. Null for types without one.\n */\n children?: Record<string, unknown> | null | undefined;\n}\n\n/** What \"Publish to the web\" writes for a type (access ladder T-13; `get_share_capabilities`). */\nexport type PublishLane = \"published_to_web\" | \"card\" | \"boolean\";\n\nexport interface ShareCapabilities {\n /** Whether this type can be published to the web at all (`publishLane` is not null). */\n supportsPublic: boolean;\n /** Whether the resource type offers no-login share links (admin policy). */\n isLinkShareable: boolean;\n /**\n * The legacy boolean column behind a `boolean` publish lane; null for every other type.\n */\n publicState: { column: string; kind: \"boolean\" } | null;\n /**\n * The column naming the thing's OWN organization (`organization_id`), when its table has one.\n * The Share dialog reads it to tell a thing homed in its owner's own organization — where\n * \"My organization\" and \"Add everyone in …\" name nobody — for every kind (2026-09-26).\n */\n organizationColumn: \"organization_id\" | null;\n /** The type's level: organization · public · confidential · private; null when unregistered. */\n tableLevel: string | null;\n /**\n * The type carries the Words table's row controls — an Organization or Public table, never a\n * child. A Private, Confidential or child record has none (common-docs/policies/access-ladder.md).\n */\n rowControls: boolean;\n /** \"Shown to\" is offered for this type. */\n shownToOffered: boolean;\n /**\n * What \"Publish to the web\" writes: the row's own switch, the card's own publish (agent,\n * workflow — the body is never published), or a legacy boolean. Null: never published.\n */\n publishLane: PublishLane | null;\n /**\n * The column that marks ONE row as a child of another record (`parent_record_type` on files),\n * when the table has one. A child record carries no row control; read it per record.\n */\n rowChildColumn: string | null;\n}\n\n/**\n * What share affordances this resource type supports — drives which controls the\n * ShareModal shows (never render a toggle that would error on click). Admin-\n * editable, so read at runtime (not from the static registry mirror).\n */\nexport async function getShareCapabilities(\n resourceType: ResourceType,\n): Promise<ShareCapabilities> {\n const { data, error } = await supabase.rpc(\"get_share_capabilities\", {\n p_resource_type: resourceType,\n });\n if (error) {\n throw operationFailed(\"check this item's sharing options\", error);\n }\n if (!isJsonObject(data)) {\n throw operationFailed(\"check this item's sharing options\");\n }\n\n const lane = data.publish_lane;\n const publishLane: PublishLane | null =\n lane === \"published_to_web\" || lane === \"card\" || lane === \"boolean\" ? lane : null;\n const column = data.public_state_column;\n const publicState: ShareCapabilities[\"publicState\"] =\n publishLane === \"boolean\" &&\n data.public_state_kind === \"boolean\" &&\n typeof column === \"string\"\n ? { column, kind: \"boolean\" }\n : null;\n\n return {\n supportsPublic: publishLane !== null,\n isLinkShareable: data.is_link_shareable === true,\n publicState,\n organizationColumn:\n data.organization_column === \"organization_id\" ? \"organization_id\" : null,\n tableLevel: typeof data.table_level === \"string\" ? data.table_level : null,\n rowControls: data.row_controls === true,\n shownToOffered: data.shown_to_offered === true,\n publishLane,\n rowChildColumn:\n typeof data.row_child_column === \"string\" ? data.row_child_column : null,\n };\n}\n\ninterface CreateShareLinkOptions {\n resourceType: ResourceType;\n resourceId: string;\n permissionLevel?: PermissionLevel | undefined;\n expiresAt?: string | null | undefined;\n maxUses?: number | null | undefined;\n label?: string | null | undefined;\n}\n\n/** The app origin share URLs are built on — `origin` when given, else the configured app URL. */\nfunction shareBase(origin?: string | undefined): string {\n const base =\n origin ||\n process.env.NEXT_PUBLIC_APP_URL ||\n (typeof window !== \"undefined\" ? window.location.origin : \"\");\n return base.replace(/\\/+$/, \"\");\n}\n\n/** Build the absolute share URL for a token (on `origin` when given). */\nexport function shareLinkUrl(token: string, origin?: string | undefined): string {\n return `${shareBase(origin)}/s/${token}`;\n}\n\n/**\n * The URL to hand a person for a share link — the short alias when one exists\n * (auto-shorten-every-share-link, owner ruling 2026-08-29), the full /s/ URL\n * otherwise. The alias is a redirect only; the 64-hex share token stays the\n * one authorization either way.\n */\nexport function shareUrlForLink(\n link: Pick<ShareLink, \"token\" | \"shortToken\">,\n origin?: string | undefined,\n): string {\n const base = shareBase(origin);\n return link.shortToken ? shortLinkUrl(base, link.shortToken) : shareLinkUrl(link.token, base);\n}\n\n/** Mint a share link for a resource (owner-only). Returns the token + URL. */\nexport async function createShareLink(\n options: CreateShareLinkOptions,\n): Promise<{\n success: boolean;\n token?: string | undefined;\n shortToken?: string | null | undefined;\n url?: string | undefined;\n error?: string | undefined;\n}> {\n try {\n const { data, error } = await supabase.rpc(\"create_share_link\", {\n p_resource_type: options.resourceType,\n p_resource_id: options.resourceId,\n // Narrowed at the write boundary — see service.ts.\n p_permission_level: toDbPermissionLevel(\n options.permissionLevel ?? \"viewer\",\n ),\n p_expires_at: options.expiresAt ?? undefined,\n p_max_uses: options.maxUses ?? undefined,\n p_label: options.label ?? undefined,\n });\n if (error) return { success: false, error: error.message };\n const res = data as {\n success: boolean;\n token?: string | undefined;\n short_token?: string | null | undefined;\n error?: string | undefined;\n };\n if (!res?.success || !res.token) {\n return { success: false, error: res?.error ?? \"Failed to create link\" };\n }\n const shortToken = res.short_token ?? null;\n return {\n success: true,\n token: res.token,\n shortToken,\n url: shareUrlForLink({ token: res.token, shortToken }),\n };\n } catch (err) {\n return {\n success: false,\n error: err instanceof Error ? err.message : \"Failed to create link\",\n };\n }\n}\n\n/** List a resource's share links (owner-only). */\nexport async function listShareLinks(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<ShareLink[]> {\n const { data, error } = await supabase.rpc(\"list_share_links\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n if (error) {\n throw operationFailed(\"load this item's share links\", error);\n }\n if (!Array.isArray(data)) {\n throw operationFailed(\"load this item's share links\");\n }\n return (data as Record<string, unknown>[]).map((r) => ({\n id: r.id as string,\n token: r.token as string,\n shortToken: (r.short_token as string | null) ?? null,\n permissionLevel: r.permission_level as PermissionLevel,\n label: (r.label as string | null) ?? null,\n expiresAt: (r.expires_at as string | null) ?? null,\n maxUses: (r.max_uses as number | null) ?? null,\n useCount: (r.use_count as number) ?? 0,\n isActive: (r.is_active as boolean) ?? false,\n createdAt: (r.created_at as string | null) ?? null,\n lastUsedAt: (r.last_used_at as string | null) ?? null,\n }));\n}\n\n/** Revoke (deactivate) a share link by id (owner-only). */\nexport async function revokeShareLink(\n linkId: string,\n): Promise<{ success: boolean; error?: string | undefined }> {\n const { data, error } = await supabase.rpc(\"revoke_share_link\", {\n p_link_id: linkId,\n });\n if (error) return { success: false, error: error.message };\n const res = data as { success: boolean; error?: string | undefined };\n return { success: !!res?.success, error: res?.error };\n}\n\nexport interface ForkResult {\n success: boolean;\n error?: string | undefined;\n /** Path to open the caller's new copy in the app. */\n path?: string | undefined;\n}\n\n/**\n * \"Save a copy & use it\" — fork a SHARED resource into the current user's own\n * account so a recipient can continue/use it (chat takeover, study a set, take a\n * quiz). Requires auth.\n *\n * `shareToken` is the no-login share-link token, passed ONLY when the viewer is\n * on the `/s/[token]` link lane. The DB RPCs authorize a link fork solely on a\n * VALID, ACTIVE token for THAT resource (SECURITY FIX — a caller-independent\n * \"any active link exists\" check previously let a stranger fork a private\n * resource the moment its owner had ever minted one link). A record published\n * to the web and explicit grants stay forkable token-less; the token is only\n * needed to authorize a private resource shared purely by no-login link. Returns\n * the path to the copy.\n */\nexport async function forkSharedResource(\n resourceType: string,\n resourceId: string,\n shareToken?: string | undefined,\n organizationId?: string | null | undefined,\n): Promise<ForkResult> {\n try {\n // WHERE THE COPY LANDS IS THE PERSON'S ANSWER, NOT OURS. The source's organization is\n // where the ORIGINAL lives — often somebody else's workspace or a public library — so\n // it cannot be reused for the copy, and until 2026-09-22 all three RPCs answered it\n // with the caller's own own organization (DEFAULT-ORG-4). `ensureOrgId` returns the\n // active organization, or opens the picker and returns what the person selects. It\n // throws `OrganizationSelectionCancelled` when they close it — \"not now\", not an error.\n const orgId = await ensureOrgId(organizationId);\n if (resourceType === \"conversation\") {\n const { data, error } = await supabase.schema(\"chat\").rpc(\"fork_shared_conversation\", {\n p_conversation_id: resourceId,\n p_organization_id: orgId,\n p_token: shareToken ?? undefined,\n });\n if (error) return { success: false, error: error.message };\n const r = data as {\n success: boolean;\n error?: string | undefined;\n conversation_id?: string | undefined;\n };\n return r?.success\n ? { success: true, path: `/chat/${r.conversation_id}` }\n : { success: false, error: r?.error };\n }\n if (resourceType === \"fc_set\") {\n const { data, error } = await supabase.schema(\"education\").rpc(\"fork_shared_flashcard_set\", {\n p_set_id: resourceId,\n p_organization_id: orgId,\n p_token: shareToken ?? undefined,\n });\n if (error) return { success: false, error: error.message };\n const r = data as { success: boolean; error?: string | undefined; set_id?: string | undefined };\n return r?.success\n ? { success: true, path: `/education/flashcards/${r.set_id}` }\n : { success: false, error: r?.error };\n }\n if (resourceType === \"quiz_session\") {\n const { data, error } = await supabase.schema(\"education\").rpc(\"fork_shared_quiz\", {\n p_quiz_id: resourceId,\n p_organization_id: orgId,\n p_token: shareToken ?? undefined,\n });\n if (error) return { success: false, error: error.message };\n const r = data as { success: boolean; error?: string | undefined; quiz_id?: string | undefined };\n // `fork_shared_quiz` returns a new `education.quiz_sessions` id, and there\n // is no route that opens one — `/quizzes/<id>` does not exist, and\n // `/education/quizzes/[id]` serves `education.assessment`, a different\n // record. Forking used to drop the user on a 404 immediately after a\n // successful copy; land them on the list until a session route exists\n // (FOUND_DEFECTS D139-adjacent, tracked in the no-dead-ends sweep).\n return r?.success\n ? { success: true, path: `/education/quizzes` }\n : { success: false, error: r?.error };\n }\n return { success: false, error: \"This type can't be copied yet\" };\n } catch (e) {\n return {\n success: false,\n error: e instanceof Error ? e.message : \"Failed to save copy\",\n };\n }\n}\n\n/** Whether a resource type supports \"save a copy & use it\" (fork). */\nexport function isForkable(resourceType: string | undefined): boolean {\n return (\n resourceType === \"conversation\" ||\n resourceType === \"fc_set\" ||\n resourceType === \"quiz_session\"\n );\n}\n\n/**\n * Resolve a share token to its resource. Anon-safe. Pass a server client from a\n * Server Component (public `/s/[token]` route); defaults to the browser client.\n */\nexport async function resolveShareToken(\n token: string,\n client: SupabaseClient = supabase as unknown as SupabaseClient,\n): Promise<ResolvedShareToken> {\n const { data, error } = await client.schema(\"iam\").rpc(\"resolve_share_token\", {\n p_token: token,\n });\n if (error) {\n return {\n success: false,\n error: \"not_found\",\n message: \"This link is invalid.\",\n };\n }\n const res = data as Record<string, unknown>;\n return {\n success: !!res?.success,\n error: res?.error as string | undefined,\n message: res?.message as string | undefined,\n resourceType: res?.resource_type as string | undefined,\n resourceId: res?.resource_id as string | undefined,\n permissionLevel: res?.permission_level as PermissionLevel | undefined,\n displayLabel: res?.display_label as string | undefined,\n urlPathTemplate: res?.url_path_template as string | undefined,\n resource: res?.resource as Record<string, unknown> | undefined,\n children: (res?.children as Record<string, unknown> | null | undefined) ?? null,\n };\n}\n","/**\n * Permission Service\n *\n * Every write operation routes through a SECURITY DEFINER RPC — no client ever\n * writes to the permissions table directly; row controls (\"Shown to\", \"Published to the web\")\n * are written on the resource row under RLS.\n *\n * Full RPC inventory:\n * share_resource_with_user() — grant user access (validates ownership)\n * grant_org_availability() — make a thing AVAILABLE to an organization as org configuration\n * (surface binding, library contribution). Never a share: a share\n * names a person (SHARE-PEOPLE-ONLY, 2026-09-25); the old\n * share_resource_with_org refuses.\n * update_permission_level() — change user or org permission level (validates ownership)\n * revoke_resource_access() — remove a user's grant (validates ownership)\n * revoke_resource_org_access() — remove an organization's availability row (validates ownership)\n * make_resource_public() — set is_public = true on resource row (validates ownership)\n * make_resource_private() — set is_public = false on resource row (validates ownership)\n * get_resource_permissions() — list all grants with user/org details (owner-only)\n * is_resource_owner() — check ownership for any table\n *\n * Which row controls a type carries is resolved by `get_share_capabilities`\n * (`rowControls`, `shownToOffered`, `publishLane`), never guessed from a column name.\n *\n * Access model (common-docs/policies/access-ladder.md):\n * - Who may open a record without a share is its TABLE's level, never a row setting.\n * - \"Published to the web\" (Organization and Public tables) is the only anonymous lane.\n * - \"Shown to\" decides which lists show it — never a lock.\n * - Read both with getResourceVisibility() — never from the permissions table.\n * - The permissions table stores only explicit user/org grants.\n * - check_resource_access() is the single RLS engine: evaluates all access paths\n * (owner, assignee, direct grant, project, workspace, org hierarchy) in one query.\n */\n\nimport { sendShareNotice, supabase } from \"./host\";\nimport { getClaimsUser } from \"./host\";\nimport { getActiveOrgId } from \"./host\";\nimport type { Database, Json } from \"./dbTypes\";\nimport {\n Permission,\n PermissionWithDetails,\n ResourceType,\n PermissionLevel,\n ShareWithUserOptions,\n OrgAvailabilityOptions,\n MakePublicOptions,\n UpdatePermissionOptions,\n RevokeAccessOptions,\n CheckPermissionOptions,\n PermissionCheckResult,\n ShareActionResult,\n satisfiesPermissionLevel,\n toDbPermissionLevel,\n} from \"./types\";\nimport { getShareableResource, getResourceTypeLabel } from \"./registry\";\nimport { getShareCapabilities } from \"./shareLinks\";\nimport { operationFailed } from \"@ai-matrx/kit/errors\";\nimport type { ShownTo } from \"./shownTo\";\n\n/**\n * Minimal query surface used by the dynamic-table helpers below. The registry\n * resolves schema/table names at RUNTIME from resource-type metadata (any of\n * dozens of resource types), so the generated `Database` type — which requires\n * literal schema/table names — cannot express this call shape statically.\n *\n * MATRX-EXCEPTION: `resolveDynamicClient` is the one sanctioned cast site for\n * this pattern in this file; every dynamic-schema table access below routes\n * through it instead of hand-rolling its own `as unknown as` interface.\n */\ninterface DynamicTableClient {\n from: (table: string) => {\n select: (columns: string) => {\n eq: (\n column: string,\n value: string,\n ) => {\n maybeSingle: <T>() => Promise<{ data: T | null; error: unknown }>;\n };\n };\n update: (patch: Record<string, unknown>) => {\n eq: (\n column: string,\n value: string,\n ) => {\n select: (\n columns: string,\n ) => Promise<{ data: unknown[] | null; error: unknown }>;\n };\n };\n };\n}\n\n/** Resolve a client scoped to a dynamically-named schema (or the default public client). */\nfunction resolveDynamicClient(\n schemaName: string | undefined,\n): DynamicTableClient {\n const base = supabase as unknown as { schema: (s: string) => unknown };\n return (schemaName\n ? base.schema(schemaName)\n : supabase) as unknown as DynamicTableClient;\n}\n\ntype RpcPermissionRow =\n Database[\"iam\"][\"Functions\"][\"get_resource_permissions\"][\"Returns\"][number];\ntype PermissionsTableRow = Database[\"iam\"][\"Tables\"][\"permissions\"][\"Row\"];\n\nfunction errMessage(error: unknown): string {\n if (error instanceof Error) return error.message;\n if (\n typeof error === \"object\" &&\n error !== null &&\n \"message\" in error &&\n typeof (error as { message: unknown }).message === \"string\"\n ) {\n return (error as { message: string }).message;\n }\n return \"Unknown error\";\n}\n\n/** Share / publish RPCs return `Json` — narrow without assuming shape beyond optional success/error/message. */\nfunction parseShareRpcResult(data: Json | null | undefined): {\n success: boolean;\n error?: string | undefined;\n message?: string | undefined;\n /** What the one person-share writer did: shared · raised · restored · unchanged · removed. */\n outcome?: string | undefined;\n} {\n if (\n data === null ||\n data === undefined ||\n typeof data !== \"object\" ||\n Array.isArray(data)\n ) {\n return { success: false, error: \"Invalid response\" };\n }\n const o = data as Record<string, unknown>;\n const success = o.success === true;\n const err = typeof o.error === \"string\" ? o.error : undefined;\n const message = typeof o.message === \"string\" ? o.message : undefined;\n const outcome = typeof o.outcome === \"string\" ? o.outcome : undefined;\n return { success, error: err, message, outcome };\n}\n\n// ============================================================================\n// The record's row controls — \"Shown to\" and \"Published to the web\"\n// ============================================================================\n//\n// THE WORDS TABLE (common-docs/policies/access-ladder.md, access ladder T-13): a record on an\n// Organization or Public table carries two row controls and nothing else —\n// \"Shown to\" only_me · my_team · everyone · everyone_on_ai_matrx (null = the type's\n// default). Which LISTS show it to people who can already open it; never a lock.\n// \"Published to the web\" on · off. The only way anyone, signed in or not, opens it at its address.\n// A Private, Confidential or child record carries neither; it is still shared by Anyone link, secure\n// link or with people. `get_share_capabilities` names which of them a TYPE carries\n// (`rowControls`, `shownToOffered`, `publishLane`), so no control is ever drawn that could not work.\n\nexport interface ResourceVisibility {\n /**\n * Published to the web: the row's `published_to_web`, the card's own publish (agent, workflow),\n * or a legacy boolean. Always false for a type that is never published.\n */\n isPublic: boolean;\n /**\n * \"Shown to\" — present only when the type carries it (`shownToOffered`); null means the type's\n * \"Shown to by default\" knob decides.\n */\n shownTo?: ShownTo | null | undefined;\n /**\n * This record is a CHILD of another (a file attached to a chat): it follows its parent and carries\n * no row control of its own, whatever its type.\n */\n childRecord?: boolean | undefined;\n /**\n * WHEN MEMBERSHIP ALONE REACHES IT (SHARE-TAILS, chair ruling 2026-09-25). A record-store thing\n * with no sharing choice is the organization's default — every member reaches it at the member\n * default level — and the lane door says so. Absent/null when the owner chose \"Only me\" (hidden\n * from members' lists; members still open it by link, access ladder T-36) or the organization\n * shows members nothing by default, and for every type outside the record store.\n */\n organizationDefault?: {\n level: string;\n organizationName: string;\n /** The organization whose default it is — its own availability row IS this default. */\n organizationId?: string | undefined;\n } | null;\n /**\n * WHO CAN SEE THIS (lane SHARE-LANE-CONTROL, VERIFIER-23 item 3). The owner's lane choice, as the\n * record store's lane door names it in every state. Present only for kinds whose lane has a door\n * (the record store); absent everywhere else, so no control is drawn that could not work.\n */\n whoCanSee?: WhoCanSee | null | undefined;\n /**\n * The thing's OWN organization, read off its row (never the active one). Null when its table\n * names none or the read could not say.\n */\n homeOrganizationId?: string | null | undefined;\n}\n\n/** The three lanes the record store's \"Who can see this\" control offers. */\nexport type LaneChoice = \"mine\" | \"organization\" | \"world\";\n\nexport interface WhoCanSee {\n /** The record store's lane doors — the only kind whose lane is not a row control. */\n source: \"store\";\n choice: LaneChoice;\n /** The object's OWN organization (never the active one). Null when the door names none. */\n organizationId: string | null;\n organizationName: string | null;\n /** What the organization's member default grants on it, whichever lane is chosen. */\n memberDefaultLevel: string | null;\n /** Organization members reach it right now through the member default. */\n membersReachNow: boolean;\n /** \"Anyone with the link\" is offered only when the world lane would accept it. */\n worldOffered: boolean;\n}\n\n/**\n * THE ONE WRITER OF THE RECORD STORE'S LANE. `custom.share_lane_set` needs the object's own\n * organization (the lane door names it) and Admin on the thing; it moves the lane and the\n * record's reach together, and named people are untouched by it.\n */\nexport async function setStoreLane(\n organizationId: string,\n subjectId: string,\n choice: LaneChoice,\n): Promise<ShareActionResult> {\n const door = choice === \"world\" ? \"community\" : choice;\n const { data, error } = await (\n supabase as unknown as {\n schema(name: string): {\n rpc(\n fn: string,\n args: Record<string, unknown>,\n ): PromiseLike<{ data: unknown; error: { message: string } | null }>;\n };\n }\n )\n .schema(\"custom\")\n .rpc(\"share_lane_set\", {\n p_organization_id: organizationId,\n p_subject_id: subjectId,\n p_choice: door,\n });\n if (error) return { success: false, error: errMessage(error) };\n const said = (data as { message?: unknown | undefined } | null)?.message;\n return {\n success: true,\n ...(typeof said === \"string\" ? { message: said } : {}),\n };\n}\n\n/**\n * Direct write of a verified row-control column on one resource row.\n *\n * Publishing is an EDIT-level action, deliberately — anyone with edit access or\n * better may publish, not just the creator. In real companies the publisher is\n * the approver at the end of the line, not whoever clicked \"new\" first (Arman,\n * 2026-08-14). Do NOT re-gate this on ownership; see\n * common-docs/systems/platform/access/SHARE_LEVELS.md.\n *\n * So a zero-row result here does NOT mean \"you're not the owner\" — under RLS it\n * means the row is invisible to this user, deleted, or gone. Never assert a\n * permission reason from an empty result. A genuine refusal (e.g. the\n * governance-column guard on a per-type governed field) arrives as a real\n * Postgres error carrying its own user-facing message, handled below.\n */\nasync function writeRowControl(\n resourceType: ResourceType,\n resourceId: string,\n patch: Record<string, boolean | string | null>,\n): Promise<ShareActionResult> {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource token: ${resourceType}. Bare table names are not accepted.`,\n );\n }\n const scoped = resolveDynamicClient(entry.schemaName);\n const { data, error } = await scoped\n .from(entry.tableName)\n .update(patch)\n .eq(entry.idColumn, resourceId)\n .select(\"id\");\n if (error) {\n // A real DB refusal already carries a message written for a human — pass it\n // through rather than replacing it with a guess about why.\n return { success: false, error: errMessage(error) };\n }\n if (!data || data.length === 0) {\n return {\n success: false,\n error: \"Couldn't update this item — it may have been deleted or moved.\",\n };\n }\n return { success: true };\n}\n\n/**\n * A table row's row controls (\"Shown to\", \"Published to the web\"), written through the record\n * store's one door, `custom.record_row_controls_set` — `authenticated` holds no table privilege on\n * `custom.record`, so the generic row write above cannot reach it. The door needs the row's OWN\n * organization, which the store's read door names (never the active organization).\n */\nasync function writeStoreRowControls(\n resourceType: ResourceType,\n resourceId: string,\n controls: { shown_to?: ShownTo | null | undefined; published_to_web?: boolean | undefined },\n): Promise<ShareActionResult> {\n const { data: lane, error: laneError } = await supabase.schema(\"workbench\").rpc(\"store_door_lane\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n if (laneError) return { success: false, error: errMessage(laneError) };\n const organizationId = (lane as { organization_id?: unknown | undefined } | null)?.organization_id;\n if (typeof organizationId !== \"string\") {\n return { success: false, error: \"That record is not here any more.\" };\n }\n const { error } = await (\n supabase as unknown as {\n schema(name: string): {\n rpc(\n fn: string,\n args: Record<string, unknown>,\n ): PromiseLike<{ data: unknown; error: { message: string } | null }>;\n };\n }\n )\n .schema(\"custom\")\n .rpc(\"record_row_controls_set\", {\n p_organization_id: organizationId,\n p_record_id: resourceId,\n p_controls: controls,\n });\n if (error) return { success: false, error: errMessage(error) };\n return { success: true };\n}\n\nconst SHOWN_TO_VALUES: readonly ShownTo[] = [\n \"only_me\",\n \"my_team\",\n \"everyone\",\n \"everyone_on_ai_matrx\",\n];\n\nfunction asShownTo(value: unknown): ShownTo | null {\n return typeof value === \"string\" &&\n (SHOWN_TO_VALUES as readonly string[]).includes(value)\n ? (value as ShownTo)\n : null;\n}\n\n/**\n * Read a record's row controls (\"Shown to\", \"Published to the web\") and its own organization.\n * Single cheap query — safe to call from list-item components like ShareButton.\n *\n * Returns `{ isPublic: false }` without a row query when the type carries no row control and no\n * publish lane; real capability/query failures remain errors.\n */\nexport async function getResourceVisibility(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<ResourceVisibility> {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource token: ${resourceType}. Bare table names are not accepted.`,\n );\n }\n // A RESOURCE WHOSE TABLE NO CLIENT MAY READ ANSWERS THROUGH ITS DOOR.\n // `authenticated` holds no SELECT on `custom.record` (DOOR-N-1a, permanently), so the record\n // store answers through `store_door_lane`, from `iam.content_lane` — the same answer the Access\n // tab beside it gives. The custom data system owns its conversion (T-13 2.3 handover).\n if (entry.schemaName === \"custom\") {\n const { data, error } = await supabase.schema(\"workbench\").rpc(\"store_door_lane\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n if (error) throw operationFailed(\"check who can open this item\", error);\n const row = (data ?? {}) as Record<string, unknown>;\n if (row.found !== true) {\n throw operationFailed(\n \"check who can open this item\",\n new Error(\"That record is not here any more.\"),\n );\n }\n const orgDefault = row.organization_default as\n { level?: unknown | undefined; organization_name?: unknown | undefined } | null | undefined;\n const organizationDefault =\n orgDefault && typeof orgDefault.level === \"string\"\n ? {\n level: orgDefault.level,\n organizationName:\n typeof orgDefault.organization_name === \"string\"\n ? orgDefault.organization_name\n : \"this organization\",\n ...(typeof (orgDefault as { organization_id?: unknown | undefined })\n .organization_id === \"string\"\n ? {\n organizationId: (orgDefault as { organization_id: string })\n .organization_id,\n }\n : {}),\n }\n : null;\n // ACCESS LADDER (custom data adoption, 2026-10-03): a table row carries the same two row\n // controls as every other Organization record — \"Shown to\" and \"Published to the web\" — read\n // off the row by the store's door and drawn by RowControls. The old lane control (\"Only me\" /\n // \"Everyone in …\" / \"Anyone with the link\") is not offered for it any more.\n return {\n isPublic: row.published_to_web === true || row.is_public === true,\n shownTo: asShownTo(row.shown_to),\n organizationDefault,\n whoCanSee: null,\n homeOrganizationId:\n typeof row.organization_id === \"string\" ? row.organization_id : null,\n };\n }\n\n const capabilities = await getShareCapabilities(resourceType);\n const publishColumn =\n capabilities.publishLane === \"published_to_web\"\n ? \"published_to_web\"\n : capabilities.publishLane === \"card\"\n ? \"card_visibility\"\n : capabilities.publishLane === \"boolean\" &&\n capabilities.publicState?.kind === \"boolean\"\n ? capabilities.publicState.column\n : null;\n const columns = [\n publishColumn,\n capabilities.shownToOffered ? \"shown_to\" : null,\n capabilities.organizationColumn,\n capabilities.rowChildColumn,\n ].filter((c): c is string => c !== null);\n if (columns.length === 0) {\n return { isPublic: false, homeOrganizationId: null };\n }\n\n const client = resolveDynamicClient(entry.schemaName);\n const { data, error } = await client\n .from(entry.tableName)\n .select(columns.join(\",\"))\n .eq(entry.idColumn, resourceId)\n .maybeSingle<Record<string, boolean | string | null>>();\n\n if (error || !data) {\n throw operationFailed(\"check who can open this item\", error);\n }\n const home = capabilities.organizationColumn\n ? data[capabilities.organizationColumn]\n : null;\n const published = publishColumn ? data[publishColumn] : null;\n const childRecord = capabilities.rowChildColumn\n ? data[capabilities.rowChildColumn] != null\n : false;\n if (childRecord) {\n return {\n isPublic: false,\n childRecord: true,\n homeOrganizationId: typeof home === \"string\" ? home : null,\n };\n }\n return {\n // The card lane is the card's own \"Published to the web\" (owner-session ruling 2026-09-28).\n isPublic: published === true || published === \"public\",\n ...(capabilities.shownToOffered\n ? { shownTo: asShownTo(data.shown_to) }\n : {}),\n homeOrganizationId: typeof home === \"string\" ? home : null,\n };\n}\n\n/**\n * \"Shown to\" — which lists show this record to people who can already open it. Never a lock.\n * Refuses a type that does not carry it rather than writing a column that is not there.\n */\nexport async function setResourceShownTo(\n resourceType: ResourceType,\n resourceId: string,\n shownTo: ShownTo | null,\n): Promise<ShareActionResult> {\n try {\n if (getShareableResource(resourceType)?.schemaName === \"custom\") {\n return await writeStoreRowControls(resourceType, resourceId, { shown_to: shownTo });\n }\n const capabilities = await getShareCapabilities(resourceType);\n if (!capabilities.shownToOffered) {\n return {\n success: false,\n error: `A ${getResourceTypeLabel(resourceType).toLowerCase()} has no \"Shown to\" — it is not listed to anyone it is not shared with.`,\n };\n }\n return await writeRowControl(resourceType, resourceId, { shown_to: shownTo });\n } catch (error: unknown) {\n console.error(\"setResourceShownTo error:\", error);\n return {\n success: false,\n error: errMessage(error) || 'Could not change \"Shown to\"',\n };\n }\n}\n\n/**\n * \"Published to the web\" on or off, through the lane the type carries: the row's own\n * `published_to_web`, the card's own publish (agent, workflow), or a legacy boolean's RPC.\n */\nasync function setPublishedToWeb(\n resourceType: ResourceType,\n resourceId: string,\n on: boolean,\n): Promise<ShareActionResult> {\n if (getShareableResource(resourceType)?.schemaName === \"custom\") {\n return writeStoreRowControls(resourceType, resourceId, { published_to_web: on });\n }\n const capabilities = await getShareCapabilities(resourceType);\n switch (capabilities.publishLane) {\n case \"published_to_web\":\n return writeRowControl(resourceType, resourceId, { published_to_web: on });\n case \"card\":\n // The card's own publish: off returns the card to its organization's lists.\n return writeRowControl(resourceType, resourceId, {\n card_visibility: on ? \"public\" : \"internal\",\n });\n case \"boolean\": {\n const { data, error } = await supabase.rpc(\n on ? \"make_resource_public\" : \"make_resource_private\",\n { p_resource_type: resourceType, p_resource_id: resourceId },\n );\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n return parsed.success\n ? { success: true }\n : { success: false, error: parsed.error || \"Please try again\" };\n }\n default:\n return {\n success: false,\n error: `A ${getResourceTypeLabel(resourceType).toLowerCase()} is never published to the web. Share it with an Anyone link or with people instead.`,\n };\n }\n}\n\n// ============================================================================\n// Share — all routes through SECURITY DEFINER RPCs\n// ============================================================================\n\n/**\n * Grant a user access to a resource.\n * RPC validates: authenticated, valid level, resource exists, caller is owner, no duplicate.\n */\nexport async function shareWithUser(\n options: ShareWithUserOptions,\n): Promise<ShareActionResult> {\n try {\n const {\n resourceType,\n resourceId,\n userId,\n permissionLevel,\n organizationId,\n } = options;\n\n const { data, error } = await supabase.schema(\"iam\").rpc(\"share_resource_with_user\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_user_id: userId,\n // Narrowed at the write boundary: the code ladder is wider than the\n // database enum, so a level Postgres cannot store is refused here by\n // name with the remedy, not swallowed into an opaque enum error.\n p_permission_level: toDbPermissionLevel(permissionLevel),\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error: parsed.error || \"Failed to share with user\",\n };\n\n // The person already held this access (or more): nothing changed, so\n // nobody is told again.\n if (parsed.outcome === \"unchanged\")\n return { success: true, message: parsed.message };\n\n // Fire-and-forget notice — failure doesn't affect the grant. ONE path: the\n // notification spine (`share.resource_shared`) emails the recipient and sends\n // the paired DM (as the sharer, with the resource card), honoring their email\n // switch. It used to be an email route plus a DM sent from here — two paths.\n //\n // 🚨 THE NOTICE IS FILED IN THE SHARED OBJECT'S ORGANIZATION (ACCESS-FIX-18, VERIFIER-18\n // H4). Unnamed, the messaging door fell back to the active organization and, with\n // none picked, raised the organization gate over the Share dialog — \"Which workspace\n // is this for?\" with 44 organizations, for a table that names its own — and the pick\n // closed the Share dialog with it. The share has already landed here; a notification\n // is never a reason to ask anything.\n const noticeOrganizationId =\n organizationId ??\n // object-org-exempt: a share dialog opened with no object organization (a non-record resource) files its notification where the person works, and never prompts\n getActiveOrgId(); // org-filter: write-target the share notification is filed where the person works when the object names no organization\n if (!noticeOrganizationId) {\n console.warn(\n \"[sharing] Nobody was told about this share: the dialog was opened without the \" +\n \"shared object's organization and none is picked. The share itself landed. \" +\n \"Remedy: pass organizationId to <ShareModal>.\",\n );\n } else {\n // aidream `POST /sharing/notify` (was the web's /api/sharing/notify). A refusal is LOUD in the\n // console with the server's own sentence; the share itself has already landed.\n void sendShareNotice(\"/sharing/notify\", {\n recipientUserId: userId,\n resourceType,\n resourceId,\n organizationId: noticeOrganizationId,\n permissionLevel,\n resourceLabel: getResourceTypeLabel(resourceType),\n })\n .then((answer) => {\n if (!answer.success) console.error(`[sharing] The person was NOT told about this share: ${answer.msg ?? \"the server refused\"}`);\n })\n .catch((err) => console.error(\"Sharing notification failed:\", err));\n }\n\n return {\n success: true,\n message: parsed.message || \"Successfully shared with user\",\n };\n } catch (error: unknown) {\n console.error(\"shareWithUser error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Failed to share with user\",\n };\n }\n}\n\n/**\n * Make a thing AVAILABLE to an organization, as organization configuration: an agent bound to\n * the organization's surface, or an item contributed to its library (with moderation). Everyone\n * in the organization, including people who join later, can use it.\n *\n * 🚨 THIS IS NOT SHARING (chair ruling 2026-09-25, owner ruling 2026-09-23 \"access is personal\").\n * A share names a person; the store refuses an organization at every share door with\n * \"Shares name a person, not an organization.\" This door is the only writer of an organization\n * grantee, and the row it writes carries `granted_via = 'availability'`.\n * RPC validates: authenticated, resource exists, caller holds Admin on it, caller is a member of\n * the target organization, the organization's module config (members may add, needs approval).\n */\nexport async function grantOrgAvailability(\n options: OrgAvailabilityOptions,\n): Promise<ShareActionResult> {\n try {\n const { resourceType, resourceId, organizationId, permissionLevel } =\n options;\n\n const { data, error } = await supabase.schema(\"iam\").rpc(\"grant_org_availability\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_org_id: organizationId,\n // omit → server applies the org module's default_permission.\n p_permission_level: permissionLevel\n ? toDbPermissionLevel(permissionLevel)\n : permissionLevel,\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error:\n parsed.error || \"Could not make this available to the organization\",\n };\n\n return {\n success: true,\n message: parsed.message || \"Available to everyone in the organization\",\n };\n } catch (error: unknown) {\n console.error(\"grantOrgAvailability error:\", error);\n return {\n success: false,\n error:\n errMessage(error) ||\n \"Could not make this available to the organization\",\n };\n }\n}\n\n/**\n * Ensure an organization has the requested availability row.\n *\n * The availability door reports an existing row instead of inserting a duplicate. Composition\n * workflows (surface binding) need idempotent \"ensure\" semantics, so the translation of that\n * answer lives here instead of in each caller.\n */\nexport async function ensureOrgAvailability(\n options: OrgAvailabilityOptions,\n): Promise<ShareActionResult> {\n const result = await grantOrgAvailability(options);\n if (!result.success && result.error === \"Organization already has access\") {\n return {\n success: true,\n message: \"Organization already has access\",\n };\n }\n return result;\n}\n\n/**\n * Publish a resource to the web — the one way anyone, signed in or not, opens it at its address.\n * Writes the lane the type carries (published_to_web, the card's own publish, or a legacy boolean).\n * The permissions table is NOT written to.\n */\nexport async function makePublic(\n options: MakePublicOptions,\n): Promise<ShareActionResult> {\n try {\n const res = await setPublishedToWeb(options.resourceType, options.resourceId, true);\n return res.success\n ? { success: true, message: \"Published to the web\" }\n : { success: false, error: res.error || \"Couldn't publish it to the web\" };\n } catch (error: unknown) {\n console.error(\"makePublic error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Couldn't publish it to the web\",\n };\n }\n}\n\n/**\n * Stop publishing a resource to the web. Who in its organization can open it is unchanged —\n * that is its table's level, never a row setting (access ladder).\n */\nexport async function makePrivate(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<ShareActionResult> {\n try {\n const res = await setPublishedToWeb(resourceType, resourceId, false);\n return res.success\n ? { success: true, message: \"No longer published to the web\" }\n : { success: false, error: res.error || \"Couldn't stop publishing it to the web\" };\n } catch (error: unknown) {\n console.error(\"makePrivate error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Couldn't stop publishing it to the web\",\n };\n }\n}\n\n// ============================================================================\n// Revoke — all routes through SECURITY DEFINER RPCs\n// ============================================================================\n\n/**\n * Remove a user's explicit access grant.\n * RPC validates ownership before deleting.\n */\nexport async function revokeUserAccess(\n resourceType: ResourceType,\n resourceId: string,\n userId: string,\n): Promise<ShareActionResult> {\n try {\n const { data, error } = await supabase.schema(\"iam\").rpc(\"revoke_resource_access\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_user_id: userId,\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error: parsed.error || \"Failed to revoke access\",\n };\n\n return { success: true, message: \"Access revoked\" };\n } catch (error: unknown) {\n console.error(\"revokeUserAccess error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Failed to revoke user access\",\n };\n }\n}\n\n/**\n * Remove an organization's explicit access grant.\n * RPC validates ownership before deleting.\n */\nexport async function revokeOrgAccess(\n resourceType: ResourceType,\n resourceId: string,\n organizationId: string,\n): Promise<ShareActionResult> {\n try {\n const { data, error } = await supabase.schema(\"iam\").rpc(\"revoke_resource_org_access\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_org_id: organizationId,\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error: parsed.error || \"Failed to revoke org access\",\n };\n\n return { success: true, message: \"Organization access revoked\" };\n } catch (error: unknown) {\n console.error(\"revokeOrgAccess error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Failed to revoke org access\",\n };\n }\n}\n\n/**\n * Remove public access — alias for makePrivate.\n */\nexport async function revokePublicAccess(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<ShareActionResult> {\n return makePrivate(resourceType, resourceId);\n}\n\n/**\n * Generic dispatcher — routes to the correct revoke function.\n */\nexport async function revokeAccess(\n options: RevokeAccessOptions,\n): Promise<ShareActionResult> {\n const { resourceType, resourceId, userId, organizationId, isPublic } =\n options;\n\n if (userId) return revokeUserAccess(resourceType, resourceId, userId);\n if (organizationId)\n return revokeOrgAccess(resourceType, resourceId, organizationId);\n if (isPublic) return revokePublicAccess(resourceType, resourceId);\n\n return {\n success: false,\n error: \"Must specify userId, organizationId, or isPublic\",\n };\n}\n\n// ============================================================================\n// Update — routes through SECURITY DEFINER RPC\n// ============================================================================\n\n/**\n * Change the permission level for an existing user or org grant.\n * RPC validates ownership before updating.\n */\nexport async function updatePermissionLevel(\n options: UpdatePermissionOptions,\n): Promise<ShareActionResult> {\n try {\n const { resourceType, resourceId, userId, organizationId, newLevel } =\n options;\n\n if (!userId && !organizationId) {\n return { success: false, error: \"Must specify userId or organizationId\" };\n }\n\n const { data, error } = await supabase.schema(\"iam\").rpc(\"update_permission_level\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n p_target_user_id: userId,\n p_target_org_id: organizationId,\n p_new_level: newLevel,\n });\n\n if (error) throw error;\n const parsed = parseShareRpcResult(data);\n if (!parsed.success)\n return {\n success: false,\n error: parsed.error || \"Failed to update permission level\",\n };\n\n return {\n success: true,\n message: parsed.message || \"Permission level updated\",\n };\n } catch (error: unknown) {\n console.error(\"updatePermissionLevel error:\", error);\n return {\n success: false,\n error: errMessage(error) || \"Failed to update permission level\",\n };\n }\n}\n\n// ============================================================================\n// Query Functions\n// ============================================================================\n\n/**\n * List all grants for a resource (owner-only).\n * Uses get_resource_permissions() SECURITY DEFINER RPC — includes resolved\n * user/org display names. Returns empty for non-owners (RPC silently returns nothing).\n *\n * NOTE: Does not include is_public state — use getResourceVisibility() for that.\n */\nexport async function listPermissions(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<PermissionWithDetails[]> {\n try {\n const { data, error } = await supabase.schema(\"iam\").rpc(\"get_resource_permissions\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n\n if (error) throw error;\n\n return (data || []).map(transformPermissionFromRpcRow);\n } catch (error: unknown) {\n // A failed read is not \"no grants\" (RC-B12 r13) — it throws, and every\n // caller's own failure state (usePermissions error, checkPermission's\n // \"Error checking permission\") says so.\n console.error(\"listPermissions error:\", error);\n throw error instanceof Error ? error : new Error(errMessage(error) || \"Could not read the permissions\");\n }\n}\n\n/** Alias kept for compatibility */\nexport const getResourcePermissions = listPermissions;\n\n/**\n * Check if the current user is the owner of a resource.\n * Reads owner_column directly from the resource row — single index scan, no\n * RPC round-trip required.\n *\n * Uses the registry to find the canonical table name, id column, and owner\n * column so tables like flashcard_sets (set_id, not id) work correctly the\n * day they're added to the registry — without a code change here.\n */\nexport interface OwnershipResolution {\n /** True only when the ownership read SUCCEEDED and the caller owns the row. */\n isOwner: boolean;\n /**\n * Non-null when ownership could NOT be determined (unknown resource type,\n * failed read, no session). `isOwner: false` with a non-null `error` means\n * \"unknown\", never \"not the owner\" — UIs must not present it as a denial.\n */\n error: string | null;\n}\n\n/**\n * Resolve whether the current user owns a resource, distinguishing\n * \"not the owner\" from \"could not determine\".\n *\n * LOUD RECOVERY: every failure path returns a message instead of a bare\n * `false`. A silent `false` here is what renders the canonical ShareModal as a\n * dead, empty dialog for a user who actually owns the row — the whole class of\n * bug this function exists to make impossible.\n *\n * Reads owner_column directly from the resource row — single index scan, no\n * RPC round-trip required. Uses the registry to find the canonical table name,\n * id column, and owner column so tables like flashcard_sets (set_id, not id)\n * work correctly the day they're added to the registry.\n */\nexport async function resolveResourceOwnership(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<OwnershipResolution> {\n if (!resourceType || !resourceId) {\n return {\n isOwner: false,\n error: \"Missing resource type or id — cannot resolve ownership.\",\n };\n }\n\n try {\n const entry = getShareableResource(resourceType);\n if (!entry) {\n return {\n isOwner: false,\n error: `Unknown shareable resource type \"${resourceType}\". Register it in shareable_resource_registry.`,\n };\n }\n\n // The registry is authoritative for the owner column (canonical tables use\n // `created_by`; file satellites `owner_id`; udt/legacy `user_id`). Read it\n // directly — no per-type override.\n const ownerColumn = entry.ownerColumn;\n\n // `tableName` is the physical table; `schemaName` its (non-public) schema.\n const tableName = entry.tableName;\n const client = resolveDynamicClient(entry.schemaName);\n const [\n { data: row, error: rowError },\n {\n data: { user },\n error: userError,\n },\n ] = await Promise.all([\n client\n .from(tableName)\n .select(ownerColumn)\n .eq(entry.idColumn, resourceId)\n .maybeSingle<Record<string, string | null>>(),\n getClaimsUser(supabase),\n ]);\n\n if (rowError) {\n const message = errMessage(rowError);\n console.error(\n `[permissions] Ownership read failed for ${resourceType}:${resourceId} ` +\n `(${entry.schemaName ?? \"public\"}.${tableName}.${ownerColumn}): ${message}`,\n );\n return {\n isOwner: false,\n error: `Could not read ${entry.displayLabel}: ${message}`,\n };\n }\n\n if (userError || !user) {\n return {\n isOwner: false,\n error: \"No signed-in user — cannot resolve ownership.\",\n };\n }\n\n if (!row) {\n return {\n isOwner: false,\n error: `${entry.displayLabel} not found, or you do not have access to it.`,\n };\n }\n\n return { isOwner: row[ownerColumn] === user.id, error: null };\n } catch (error) {\n const message = errMessage(error);\n console.error(\n `[permissions] Ownership check threw for ${resourceType}:${resourceId}: ${message}`,\n );\n return { isOwner: false, error: message };\n }\n}\n\n/**\n * \"MAY I DECIDE WHO ELSE SEES THIS?\" — the question a share dialog actually has.\n *\n * `resolveResourceOwnership` above answers a NARROWER one: am I the row's\n * `created_by`. VIS-17's one ladder says `admin` on a thing means \"can change it\n * and decide who else may\", so gating the dialog on ownership made `admin` a\n * level that could not do the one thing its own definition names — and for the\n * record store it could not even be ASKED, because `custom.record` carries no\n * client SELECT grant and the direct read above returns \"Could not read Record\".\n *\n * So this asks the database's own predicate (`iam.may_manage_sharing`, lane\n * SHARE 2026-09-19), which is the same one the six sharing RPCs enforce. The\n * screen and the door cannot disagree, because there is one answer.\n *\n * A failure is reported as \"could not determine\", never as a denial — the\n * distinction the dialog needs to tell a stranger from a broken read.\n */\nexport async function resolveSharingAuthority(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<OwnershipResolution> {\n if (!resourceType || !resourceId) {\n return {\n isOwner: false,\n error: \"Missing resource type or id — cannot resolve who may share this.\",\n };\n }\n try {\n const { data, error } = await supabase.schema(\"iam\").rpc(\"may_manage_sharing\", {\n p_resource_type: resourceType,\n p_resource_id: resourceId,\n });\n if (error) throw error;\n return { isOwner: data === true, error: null };\n } catch (error: unknown) {\n const message = errMessage(error);\n console.error(\n `[permissions] may_manage_sharing failed for ${resourceType}:${resourceId}: ${message}`,\n );\n return { isOwner: false, error: message };\n }\n}\n\n/**\n * Boolean convenience wrapper over {@link resolveResourceOwnership}.\n *\n * Prefer `resolveResourceOwnership` anywhere the difference between \"not the\n * owner\" and \"could not determine\" changes what the user sees.\n */\nexport async function isResourceOwner(\n resourceType: ResourceType,\n resourceId: string,\n): Promise<boolean> {\n const { isOwner } = await resolveResourceOwnership(resourceType, resourceId);\n return isOwner;\n}\n\n/**\n * Get all resources explicitly shared with the current user.\n * Reads from the permissions table — reflects direct grants only,\n * not hierarchy-inherited access (project/workspace/org membership).\n */\nexport async function getSharedWithMe(\n resourceType?: ResourceType | undefined,\n): Promise<Permission[]> {\n try {\n const {\n data: { user },\n error: userError,\n } = await getClaimsUser(supabase);\n if (userError || !user) return [];\n\n let query = supabase\n .schema(\"iam\")\n .from(\"permissions\")\n .select(\"*\")\n .eq(\"granted_to_user_id\", user.id);\n\n if (resourceType) query = query.eq(\"resource_type\", resourceType);\n\n const { data, error } = await query.order(\"created_at\", {\n ascending: false,\n });\n if (error) throw error;\n\n return (data || []).map(transformPermissionFromTableRow);\n } catch (error) {\n // A failed read is not \"nothing shared with me\" (RC-B12 r13).\n console.error(\"getSharedWithMe error:\", error);\n throw error instanceof Error ? error : new Error(errMessage(error) || \"Could not read what is shared with you\");\n }\n}\n\n/**\n * Check if current user has a specific permission level on a resource.\n * Used for client-side gating — not a substitute for RLS.\n */\nexport async function checkPermission(\n options: CheckPermissionOptions,\n): Promise<PermissionCheckResult> {\n try {\n const { resourceType, resourceId, requiredLevel = \"viewer\" } = options;\n\n const {\n data: { user },\n error: userError,\n } = await getClaimsUser(supabase);\n if (userError || !user)\n return { hasAccess: false, isOwner: false, reason: \"Not authenticated\" };\n\n const permissions = await listPermissions(resourceType, resourceId);\n\n const userPermission = permissions.find(\n (p) => p.grantedToUserId === user.id,\n );\n if (userPermission) {\n const hasAccess = satisfiesPermissionLevel(\n userPermission.permissionLevel,\n requiredLevel,\n );\n return {\n hasAccess,\n level: userPermission.permissionLevel,\n isOwner: false,\n reason: hasAccess\n ? \"Direct user permission\"\n : \"Insufficient permission level\",\n };\n }\n\n return {\n hasAccess: false,\n isOwner: false,\n reason: \"No direct permission found\",\n };\n } catch (error) {\n console.error(\"checkPermission error:\", error);\n return {\n hasAccess: false,\n isOwner: false,\n reason: \"Error checking permission\",\n };\n }\n}\n\n/**\n * Batch grant access to multiple users in parallel.\n */\nexport async function batchShareWithUsers(\n resourceType: ResourceType,\n resourceId: string,\n userIds: string[],\n permissionLevel: PermissionLevel,\n): Promise<ShareActionResult[]> {\n return Promise.all(\n userIds.map((userId) =>\n shareWithUser({ resourceType, resourceId, userId, permissionLevel }),\n ),\n );\n}\n\n// ============================================================================\n// Internal Helpers\n// ============================================================================\n\nfunction parseNestedUser(\n j: Json,\n): PermissionWithDetails[\"grantedToUser\"] | undefined {\n if (\n j === null ||\n j === undefined ||\n typeof j !== \"object\" ||\n Array.isArray(j)\n )\n return undefined;\n const o = j as Record<string, unknown>;\n if (typeof o.id !== \"string\" || typeof o.email !== \"string\") return undefined;\n return {\n id: o.id,\n email: o.email,\n displayName: typeof o.displayName === \"string\" ? o.displayName : undefined,\n avatarUrl: typeof o.avatarUrl === \"string\" ? o.avatarUrl : undefined,\n isGuest: o.isGuest === true,\n };\n}\n\nfunction parseNestedOrg(\n j: Json,\n): PermissionWithDetails[\"grantedToOrganization\"] | undefined {\n if (\n j === null ||\n j === undefined ||\n typeof j !== \"object\" ||\n Array.isArray(j)\n )\n return undefined;\n const o = j as Record<string, unknown>;\n if (\n typeof o.id !== \"string\" ||\n typeof o.name !== \"string\" ||\n typeof o.slug !== \"string\"\n )\n return undefined;\n return {\n id: o.id,\n name: o.name,\n slug: o.slug,\n logoUrl: typeof o.logoUrl === \"string\" ? o.logoUrl : undefined,\n };\n}\n\nfunction transformPermissionFromRpcRow(\n row: RpcPermissionRow,\n): PermissionWithDetails {\n return {\n id: row.id,\n resourceType: row.resource_type as ResourceType,\n resourceId: row.resource_id,\n grantedToUserId: row.granted_to_user_id || undefined,\n grantedToOrganizationId: row.granted_to_organization_id || undefined,\n isPublic: row.is_public,\n permissionLevel: row.permission_level as PermissionLevel,\n createdAt: row.created_at ? new Date(row.created_at) : undefined,\n createdBy: undefined,\n grantedToUser: parseNestedUser(row.granted_to_user),\n grantedToOrganization: parseNestedOrg(row.granted_to_organization),\n };\n}\n\nfunction transformPermissionFromTableRow(row: PermissionsTableRow): Permission {\n return {\n id: row.id,\n resourceType: row.resource_type as ResourceType,\n resourceId: row.resource_id,\n grantedToUserId: row.granted_to_user_id,\n grantedToOrganizationId: row.granted_to_organization_id,\n isPublic: row.is_public ?? undefined,\n permissionLevel: row.permission_level as PermissionLevel,\n createdAt: row.created_at ? new Date(row.created_at) : undefined,\n createdBy: row.created_by ?? undefined,\n };\n}\n\n// Legacy getTableName() removed — the registry (utils/permissions/registry.ts)\n// is the single source of truth. Use getShareableResource() / resolveTableName()\n// from './registry' if you need the canonical table name on the client.\n","// lib/list-scope/shownTo.ts\n//\n// \"SHOWN TO\" — the per-row list choice (access ladder, common-docs/policies/access-ladder.md\n// \"Organization behavior is knobs and filters, not row security\").\n//\n// A record on an Organization or Public table carries `shown_to`:\n// only_me · my_team · everyone · everyone_on_ai_matrx · NULL (= the type's\n// \"Shown to by default\" knob, access.shown_to_default/<token>, system → organization → person).\n// It decides which LISTS show a record to people who can already open it. It never locks: a coworker\n// who reaches an Only-me record by its address still opens it.\n//\n// The server lists (`*_list_scoped` RPCs) apply `platform.shown_to_lists(...)`. A client list that\n// builds its own PostgREST query applies the same rule with `applyShownTo`, fed by ONE read of\n// `platform.shown_to_context(token)` (the knob per organization + the viewer's teammates).\nimport { supabase } from \"./host\";\n\nexport type ShownTo = \"only_me\" | \"my_team\" | \"everyone\" | \"everyone_on_ai_matrx\";\n\n/** Per organization id: the type's resolved default (`d`) and the viewer's teammates (`t`). */\nexport type ShownToContext = Record<string, { d: ShownTo | null; t: string[] }>;\n\n/** One read per list: the viewer's context for one type. Throws on failure (never guesses wider). */\nexport async function fetchShownToContext(token: string): Promise<ShownToContext> {\n const { data, error } = await supabase\n .schema(\"platform\")\n .rpc(\"shown_to_context\", { p_token: token });\n if (error) {\n throw new Error(`Could not read who \"${token}\" lists are shown to: ${error.message}`);\n }\n return (data ?? {}) as ShownToContext;\n}\n\nexport interface OrCapable<Self> {\n or(filters: string): Self;\n}\n\n/**\n * The PostgREST `or` expression for \"does this row belong in my list of organization X?\":\n * mine always; otherwise the row's own Shown to, else the organization's default. (A row the\n * retiring row column once marked personal carries `shown_to = only_me` — T-13 phase 3 backfilled it\n * and the dual-write trigger keeps it — so no list reads that column any more.)\n */\nexport function shownToFilter(\n ctx: ShownToContext,\n organizationId: string,\n userId: string,\n ownerColumn = \"created_by\",\n): string {\n const org = ctx[organizationId];\n const team = (org?.t?.length ? org.t : [userId]).join(\",\");\n const byDefault = org?.d ?? \"everyone\";\n const arms = [\n `${ownerColumn}.eq.${userId}`,\n \"shown_to.in.(everyone,everyone_on_ai_matrx)\",\n `and(shown_to.eq.my_team,${ownerColumn}.in.(${team}))`,\n ];\n if (byDefault === \"everyone\" || byDefault === \"everyone_on_ai_matrx\") {\n arms.push(\"shown_to.is.null\");\n } else if (byDefault === \"my_team\") {\n arms.push(`and(shown_to.is.null,${ownerColumn}.in.(${team}))`);\n }\n return arms.join(\",\");\n}\n\n/** Narrow a one-organization list query to what Shown to lets this person's list show. */\nexport function applyShownTo<Q extends OrCapable<Q>>(\n query: Q,\n ctx: ShownToContext,\n organizationId: string,\n userId: string,\n ownerColumn = \"created_by\",\n): Q {\n return query.or(shownToFilter(ctx, organizationId, userId, ownerColumn));\n}\n\n/**\n * The same rule across several organizations at once (a blended \"My Orgs\" list): each row is\n * judged by ITS organization's default and ITS organization's teammates.\n */\nexport function shownToBlendedFilter(\n ctx: ShownToContext,\n organizationIds: string[],\n userId: string,\n ownerColumn = \"created_by\",\n orgColumn = \"organization_id\",\n): string {\n return organizationIds\n .map((org) => `and(${orgColumn}.eq.${org},or(${shownToFilter(ctx, org, userId, ownerColumn)}))`)\n .join(\",\");\n}\n\n/**\n * THE SAME RULE ACROSS EVERY ORGANIZATION THE VIEWER BELONGS TO — the filter a client list uses when\n * it opens on \"the organization\" with no one organization picked (access ladder T-11 leak fixes,\n * 2026-09-28: the notes sidebar applied no Shown to at all and listed 57 of a coworker's Only-me\n * notes). Compact on purpose — one arm per distinct rule, not one per organization — because a\n * person may belong to dozens of organizations and the whole expression rides in a URL:\n * mine · shown to everyone · my_team rows of my teammates (per organization that has any) ·\n * unset rows in organizations whose default shows them ·\n * rows outside my organizations (reached by a direct share) or with no organization.\n */\nexport function shownToMyOrgsFilter(\n ctx: ShownToContext,\n userId: string,\n ownerColumn = \"created_by\",\n orgColumn = \"organization_id\",\n): string | null {\n const orgs = Object.keys(ctx);\n if (orgs.length === 0) return null;\n const arms = [`${ownerColumn}.eq.${userId}`, \"shown_to.in.(everyone,everyone_on_ai_matrx)\"];\n const everyoneByDefault: string[] = [];\n for (const org of orgs) {\n const { d, t } = ctx[org] ?? { d: null, t: [] };\n const teammates = (t ?? []).filter((id) => id !== userId);\n if (teammates.length > 0) {\n const team = teammates.join(\",\");\n arms.push(`and(${orgColumn}.eq.${org},shown_to.eq.my_team,${ownerColumn}.in.(${team}))`);\n if (d === \"my_team\") {\n arms.push(\n `and(${orgColumn}.eq.${org},shown_to.is.null,${ownerColumn}.in.(${team}))`,\n );\n }\n }\n if (d === null || d === \"everyone\" || d === \"everyone_on_ai_matrx\") everyoneByDefault.push(org);\n }\n if (everyoneByDefault.length > 0) {\n arms.push(\n `and(${orgColumn}.in.(${everyoneByDefault.join(\",\")}),shown_to.is.null)`,\n );\n }\n arms.push(`${orgColumn}.is.null`, `${orgColumn}.not.in.(${orgs.join(\",\")})`);\n return arms.join(\",\");\n}\n","// lib/list-scope/shownToWords.ts — the words for \"Shown to\" (access ladder Words table).\nimport type { ShownTo } from \"./shownTo\";\n\n/**\n * THE WORDS (access ladder Words table, \"Shown to\"): one label and one sentence per value, used by\n * every surface that shows or sets it. \"Everyone on AI Matrx\" is valid only on a record that is\n * published to the web (a database CHECK refuses it otherwise).\n */\nexport const SHOWN_TO_WORDS: Record<ShownTo, { label: string; says: string }> = {\n only_me: { label: \"Only me\", says: \"Listed for you alone.\" },\n my_team: { label: \"My team\", says: \"Listed for you and your teammates.\" },\n everyone: { label: \"Everyone\", says: \"Listed for everyone in its organization.\" },\n everyone_on_ai_matrx: {\n label: \"Everyone on AI Matrx\",\n says: \"Listed for everyone signed in to AI Matrx.\",\n },\n};\n\nexport const SHOWN_TO_ORDER: readonly ShownTo[] = [\n \"only_me\",\n \"my_team\",\n \"everyone\",\n \"everyone_on_ai_matrx\",\n];\n","/**\n * features/sharing/service/accessSummary.ts\n *\n * THE honest answer to \"who can actually see this, and why?\" for ONE entity.\n *\n * A list surface can only show what a row says about itself, which is only one of\n * the SIX ways `iam.has_access_for_base` grants\n * access: owner, level+org, direct grant, membership, education\n * assignment, and — the one that kept being missed — reachability through a\n * CONTAINER (a scope, project, data store…). A file marked `personal` that is\n * attached to an org-internal scope is readable by that whole org, and saying\n * \"Only you\" about it is a lie.\n *\n * This is deliberately ONE ENTITY AT A TIME. It walks reachability and resolves\n * container titles, so it is not something to run per row of a list. List\n * surfaces stay on cheap bulk signals and simply avoid asserting the specific\n * claim they cannot back up.\n *\n * Direct to Supabase (`public.entity_access_summary`), never through Python —\n * this is a plain DB read the browser is entitled to make.\n */\n\nimport { createClient } from \"./host\";\nimport { operationFailed } from \"@ai-matrx/kit/errors\";\nimport type { EntityTypeToken } from \"@ai-matrx/associations\";\n\nexport type AccessGranteeType = \"user\" | \"organization\";\n\nexport interface AccessDirectGrant {\n granteeType: AccessGranteeType;\n granteeId: string | null;\n granteeLabel: string | null;\n level: string;\n expiresAt: string | null;\n}\n\nexport interface AccessContainer {\n containerType: string;\n containerId: string;\n /** Human label of the container kind, e.g. \"Scope\". */\n containerTypeLabel: string | null;\n /** The container's own name, e.g. \"Web Development\". */\n label: string | null;\n /** Highest permission level conveyed through this container. */\n level: string;\n depth: number;\n organizationId: string | null;\n organizationName: string | null;\n /** True when everyone in the container's org can read the container. */\n orgReadable: boolean;\n /** Explicit members of the container. */\n memberCount: number;\n}\n\nexport interface AccessSummary {\n entityType: string;\n entityId: string;\n ownerId: string | null;\n viewerIsOwner: boolean;\n organizationId: string | null;\n organizationName: string | null;\n /** Caller has admin — only then are grantee identities populated. */\n canManage: boolean;\n isPublic: boolean;\n /** Every member of its organization can open it (its table's level). */\n orgReadable: boolean;\n directGrantCount: number;\n directGrants: AccessDirectGrant[];\n /** Explicit members of the entity itself. */\n memberCount: number;\n containers: AccessContainer[];\n containerCount: number;\n}\n\nfunction str(value: unknown): string | null {\n return typeof value === \"string\" && value.length > 0 ? value : null;\n}\n\nfunction num(value: unknown): number {\n return typeof value === \"number\" && Number.isFinite(value) ? value : 0;\n}\n\nfunction bool(value: unknown): boolean {\n return value === true;\n}\n\nfunction record(value: unknown): Record<string, unknown> | null {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction parseGrant(raw: unknown): AccessDirectGrant | null {\n const row = record(raw);\n if (!row) return null;\n return {\n granteeType: row.grantee_type === \"organization\" ? \"organization\" : \"user\",\n granteeId: str(row.grantee_id),\n granteeLabel: str(row.grantee_label),\n level: str(row.level) ?? \"viewer\",\n expiresAt: str(row.expires_at),\n };\n}\n\nfunction parseContainer(raw: unknown): AccessContainer | null {\n const row = record(raw);\n if (!row) return null;\n const containerId = str(row.container_id);\n const containerType = str(row.container_type);\n if (!containerId || !containerType) return null;\n return {\n containerType,\n containerId,\n containerTypeLabel: str(row.container_type_label),\n label: str(row.label),\n level: str(row.level) ?? \"viewer\",\n depth: num(row.depth),\n organizationId: str(row.organization_id),\n organizationName: str(row.organization_name),\n orgReadable: bool(row.org_readable),\n memberCount: num(row.member_count),\n };\n}\n\nfunction parseSummary(raw: unknown): AccessSummary {\n const row = record(raw);\n if (!row) {\n throw new Error(\"entity_access_summary returned an unexpected shape\");\n }\n const grants = Array.isArray(row.direct_grants) ? row.direct_grants : [];\n const containers = Array.isArray(row.containers) ? row.containers : [];\n return {\n entityType: str(row.entity_type) ?? \"\",\n entityId: str(row.entity_id) ?? \"\",\n ownerId: str(row.owner_id),\n viewerIsOwner: bool(row.viewer_is_owner),\n organizationId: str(row.organization_id),\n organizationName: str(row.organization_name),\n canManage: bool(row.can_manage),\n isPublic: bool(row.is_public),\n orgReadable: bool(row.org_readable),\n directGrantCount: num(row.direct_grant_count),\n directGrants: grants\n .map(parseGrant)\n .filter((g): g is AccessDirectGrant => g !== null),\n memberCount: num(row.member_count),\n containers: containers\n .map(parseContainer)\n .filter((c): c is AccessContainer => c !== null),\n containerCount: num(row.container_count),\n };\n}\n\n/** Full effective-access explanation for one entity. Throws on RPC failure. */\nexport async function fetchAccessSummary(\n entityType: EntityTypeToken,\n entityId: string,\n): Promise<AccessSummary> {\n const supabase = createClient();\n const { data, error } = await supabase.rpc(\"entity_access_summary\", {\n p_type: entityType,\n p_id: entityId,\n });\n if (error) throw operationFailed(\"load the access summary\", error);\n return parseSummary(data);\n}\n\n/**\n * Display titles for a batch of ids of ONE entity token, resolved LIVE from the\n * owning table. Never render a denormalized association label instead — it goes\n * stale the moment the target is renamed. Ids the caller cannot view are\n * omitted by the RPC rather than leaked.\n *\n * DEDUP FLAG (associations W0-P1, 2026-08-29): this is sharing's own copy of a\n * title resolver; the scopes unit has the canonical cached one at\n * `features/scopes/service/entityTitles.ts` (which `AttachedItemsSheet` now\n * uses). The sharing node owns converging this copy onto that resolver (or a\n * shared home) — do not add new consumers here.\n */\nexport async function fetchEntityTitles(\n entityType: EntityTypeToken,\n ids: string[],\n): Promise<Map<string, string | null>> {\n const out = new Map<string, string | null>();\n const unique = Array.from(new Set(ids.filter(Boolean)));\n if (unique.length === 0) return out;\n\n const supabase = createClient();\n const { data, error } = await supabase.schema(\"platform\").rpc(\"entity_titles\", {\n p_type: entityType,\n p_ids: unique,\n });\n if (error) throw operationFailed(\"load those titles\", error);\n for (const raw of Array.isArray(data) ? data : []) {\n const row = record(raw);\n const id = row ? str(row.id) : null;\n if (id) out.set(id, row ? str(row.title) : null);\n }\n return out;\n}\n\n/**\n * The honest one-line headline for an entity, given everything we know.\n * Shared by the info panel and anywhere else that must not overstate privacy.\n */\nexport function describeAccessSummary(summary: AccessSummary): string {\n if (summary.isPublic) return \"Published to the web — anyone can open it at its address\";\n\n const reasons: string[] = [];\n if (summary.orgReadable && summary.organizationName) {\n reasons.push(`everyone in ${summary.organizationName}`);\n }\n if (summary.directGrantCount > 0) {\n reasons.push(\n summary.directGrantCount === 1\n ? \"1 person or org it is shared with\"\n : `${summary.directGrantCount} people or orgs it is shared with`,\n );\n }\n for (const container of summary.containers) {\n const name = container.label ?? container.containerTypeLabel ?? \"a container\";\n if (container.orgReadable && container.organizationName) {\n reasons.push(`everyone in ${container.organizationName} (via ${name})`);\n } else if (container.memberCount > 0) {\n reasons.push(`members of ${name}`);\n } else {\n reasons.push(`anyone who can open ${name}`);\n }\n }\n\n if (reasons.length === 0) return \"Private — only you\";\n return `You, plus ${reasons.join(\", \")}`;\n}\n","\"use client\";\n\n/**\n * @ai-matrx/sharing/react — what the SHARE SHEET needs from its host's UI, injected ONCE at boot:\n *\n * configureShareSheetUi({ toast, useCurrentUserId, useOrganizations, CopyButtons, EntityRef, ... });\n *\n * The data half (database client, aidream calls, routes) is `configureSharing` in\n * `@ai-matrx/sharing/core`. Every field here has a WORKING default, so a host that supplies\n * nothing still gets a usable sheet (plain copy buttons, a plain name for the record, an email\n * field for finding a person, the organization's roster as contacts); a richer host (the web)\n * hands in its own pieces. A default is never a blank: where a host-only feature is absent the\n * default says so on screen.\n */\n\nimport { useCallback, useEffect, useMemo, useState, useSyncExternalStore, type ComponentType, type ReactNode } from \"react\";\nimport { Button, Input } from \"@ai-matrx/design-system\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\nimport { confirm as kitConfirm, type ConfirmOptions } from \"@ai-matrx/kit/confirm-opener\";\nimport { readOrganizationMemberRows } from \"@ai-matrx/sharing/core\";\nimport { shareClient as shareClientForIdentity } from \"@ai-matrx/sharing/core\";\nimport { createSupabaseIdentity } from \"@ai-matrx/vault\";\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype LooseProps = { [key: string]: any };\n\nexport interface ShareSheetOrganization {\n id: string;\n name: string;\n [key: string]: unknown;\n}\n\nexport interface ShareSheetConnection {\n user_id: string;\n email: string | null;\n display_name: string | null;\n avatar_url: string | null;\n source: \"conversation\" | \"organization\" | \"invitation\";\n sourceDetails?: string | undefined;\n}\n\nexport interface ShareSheetConnections {\n connections: ShareSheetConnection[];\n isLoading: boolean;\n error: string | null;\n partialFailures: string[];\n refresh: () => Promise<void> | void;\n}\n\nexport interface ShareSheetToastOptions {\n title?: ReactNode | undefined;\n description?: ReactNode | undefined;\n variant?: \"default\" | \"destructive\" | \"success\" | string | undefined;\n}\n\nexport interface ShareSheetUi {\n /** Messages. Default: `console` + `window.alert` for errors (never swallowed). */\n toast: (options: ShareSheetToastOptions) => void;\n /** The signed-in person's id. Default: read once from the sharing client's session. */\n useCurrentUserId: () => string | null;\n /** The organizations the person belongs to (`{id, name}`). Default: `organizations` read once. */\n useOrganizations: () => ShareSheetOrganization[];\n /** Contacts offered in the People tab. Default: the organization's roster. */\n useUserConnections: (options: { organizationId?: string }) => ShareSheetConnections;\n confirm: (options: ConfirmOptions) => Promise<boolean>;\n CopyButtons: ComponentType<LooseProps>;\n csvExportItem: (...args: any[]) => any;\n jsonExportItem: (...args: any[]) => any;\n usePageCapture: (build: () => unknown, options?: { enabled?: boolean }) => void;\n dialogCapture: (input: any) => unknown;\n PageCaptureButton: ComponentType<LooseProps>;\n ErrorAlchemyMenu: ComponentType<LooseProps>;\n InfoHint: ComponentType<LooseProps>;\n EntityDoorControls: ComponentType<LooseProps>;\n EntityRef: ComponentType<LooseProps>;\n UserAvatarDisplay: ComponentType<LooseProps>;\n ConnectionsReadNotice: ComponentType<LooseProps>;\n UserSearchField: ComponentType<LooseProps>;\n /** The vault identity the secure-link panel seals with (`@ai-matrx/vault`). */\n vaultIdentity: unknown;\n humanLines: (...args: any[]) => string;\n /** Where dialogs portal (the web: its pop-out window container). Default: the document body. */\n usePortalContainer: () => HTMLElement | null | undefined;\n}\n\n/* ─── defaults ───────────────────────────────────────────────────────────── */\n\nfunction DefaultCopyButtons(props: LooseProps) {\n const [done, setDone] = useState(false);\n const text = (): string => {\n const h = props.human ?? props.text;\n const v = typeof h === \"function\" ? h() : h;\n return Array.isArray(v) ? v.join(\"\\n\") : String(v ?? \"\");\n };\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className={props.className}\n onClick={() => {\n void copyText(text()).then(() => {\n setDone(true);\n setTimeout(() => setDone(false), 1500);\n });\n }}\n >\n {done ? \"Copied\" : props.label ? `Copy ${String(props.label).toLowerCase()}` : \"Copy\"}\n </Button>\n );\n}\n\nfunction DefaultErrorMenu(_props: LooseProps) {\n return null;\n}\n\nfunction DefaultInfoHint(props: LooseProps) {\n return (\n <span title={String(props.text ?? \"\")} aria-label={String(props.label ?? \"More info\")} className=\"cursor-help text-muted-foreground\">\n ⓘ\n </span>\n );\n}\n\nfunction DefaultEntityRef(props: LooseProps) {\n const href = typeof props.href === \"string\" ? props.href : null;\n return href ? <a href={href} className=\"underline-offset-2 hover:underline\">{String(props.name ?? \"\")}</a> : <span>{String(props.name ?? \"\")}</span>;\n}\n\nfunction DefaultUserAvatar(props: LooseProps) {\n const u = (props.user ?? {}) as { displayName?: string | undefined; email?: string | undefined; display_name?: string | undefined };\n const name = u.displayName ?? u.display_name ?? u.email ?? \"?\";\n return (\n <span className=\"inline-flex h-7 w-7 items-center justify-center rounded-full bg-muted text-xs font-medium\" aria-label={name}>\n {name.slice(0, 1).toUpperCase()}\n </span>\n );\n}\n\nfunction DefaultConnectionsNotice(props: LooseProps) {\n if (!props.error && !(Array.isArray(props.partialFailures) && props.partialFailures.length)) return null;\n return (\n <div className=\"rounded-md border border-destructive/30 bg-destructive/10 p-2 text-xs text-destructive\">\n {props.error ? `Contacts could not be read: ${String(props.error)}` : `Some contacts could not be read.`}{\" \"}\n {props.onRetry ? ( // ui-exception: moved verbatim from the web share sheet; restyling onto design-system Button is its own UI change\n <button type=\"button\" className=\"underline\" onClick={() => props.onRetry()}>\n Retry\n </button>\n ) : null}\n </div>\n );\n}\n\nfunction DefaultUserSearchField(props: LooseProps) {\n const { onValueChange, onUserSelect: _onUserSelect, value, ...rest } = props;\n return <Input {...rest} value={value ?? \"\"} onChange={(e: { target: { value: string } }) => onValueChange?.(e.target.value)} />;\n}\n\nconst ORGS_EMPTY: ShareSheetOrganization[] = [];\nlet orgsCache: ShareSheetOrganization[] | null = null;\nconst orgListeners = new Set<() => void>();\n\nfunction useDefaultOrganizations(): ShareSheetOrganization[] {\n const snapshot = useSyncExternalStore(\n (cb) => {\n orgListeners.add(cb);\n return () => orgListeners.delete(cb);\n },\n () => orgsCache ?? ORGS_EMPTY,\n () => ORGS_EMPTY,\n );\n useEffect(() => {\n if (orgsCache) return;\n orgsCache = ORGS_EMPTY;\n void import(\"@ai-matrx/sharing/core\").then(async ({ shareClient }) => {\n const { data, error } = await shareClient().from(\"organizations\").select(\"id, name\");\n if (error) console.error(`[share] Your organizations could not be read: ${error.message}`);\n orgsCache = (Array.isArray(data) ? (data as ShareSheetOrganization[]) : []).map((o) => ({ ...o, id: String(o.id), name: String(o.name ?? \"\") }));\n orgListeners.forEach((l) => l());\n }).catch((err: unknown) => console.error(\"[share] Your organizations could not be read:\", err));\n }, []);\n return snapshot;\n}\n\nfunction useDefaultCurrentUserId(): string | null {\n const [id, setId] = useState<string | null>(null);\n useEffect(() => {\n void import(\"@ai-matrx/sharing/core\").then(async ({ shareClient }) => {\n const { getClaimsUser } = await import(\"@ai-matrx/sharing/core\");\n const { data } = await getClaimsUser(shareClient());\n setId(data.user?.id ?? null);\n });\n }, []);\n return id;\n}\n\nfunction useDefaultConnections({ organizationId }: { organizationId?: string }): ShareSheetConnections {\n const [state, setState] = useState<{ rows: ShareSheetConnection[]; loading: boolean; error: string | null }>({ rows: [], loading: Boolean(organizationId), error: null });\n const load = useCallback(\n async (fresh = false) => {\n if (!organizationId) return;\n setState((s) => ({ ...s, loading: true }));\n try {\n const rows = await readOrganizationMemberRows(organizationId, { fresh });\n setState({\n rows: rows.map((r) => ({\n user_id: r.user_id,\n email: r.user_email ?? null,\n display_name: r.user_display_name ?? null,\n avatar_url: r.user_avatar_url ?? null,\n source: \"organization\" as const,\n })),\n loading: false,\n error: null,\n });\n } catch (err) {\n setState({ rows: [], loading: false, error: err instanceof Error ? err.message : String(err) });\n }\n },\n [organizationId],\n );\n useEffect(() => {\n void load();\n }, [load]);\n return useMemo(\n () => ({ connections: state.rows, isLoading: state.loading, error: state.error, partialFailures: [], refresh: () => load(true) }),\n [state, load],\n );\n}\n\nconst DEFAULTS: ShareSheetUi = {\n toast: ({ title, description, variant }) => {\n const text = [title, description].filter((x) => typeof x === \"string\").join(\" — \");\n if (variant === \"destructive\") {\n console.error(`[share] ${text}`);\n if (typeof window !== \"undefined\") window.alert(text);\n } else console.info(`[share] ${text}`);\n },\n useCurrentUserId: useDefaultCurrentUserId,\n useOrganizations: useDefaultOrganizations,\n useUserConnections: useDefaultConnections,\n confirm: (o) => kitConfirm(o),\n CopyButtons: DefaultCopyButtons,\n csvExportItem: () => null,\n jsonExportItem: () => null,\n usePageCapture: () => undefined,\n dialogCapture: (input) => input,\n PageCaptureButton: () => null,\n ErrorAlchemyMenu: DefaultErrorMenu,\n InfoHint: DefaultInfoHint,\n EntityDoorControls: () => null,\n EntityRef: DefaultEntityRef,\n UserAvatarDisplay: DefaultUserAvatar,\n ConnectionsReadNotice: DefaultConnectionsNotice,\n UserSearchField: DefaultUserSearchField,\n vaultIdentity: null,\n humanLines: (...args: unknown[]) => args.flat().filter(Boolean).map(String).join(\"\\n\"),\n usePortalContainer: () => undefined,\n};\n\nlet ui: ShareSheetUi = DEFAULTS;\n\n/** Merge host UI over the defaults (boot-time; tests may call it again). */\nexport function configureShareSheetUi(next: Partial<ShareSheetUi>): void {\n ui = { ...ui, ...next };\n}\n\nexport function shareSheetUi(): ShareSheetUi {\n return ui;\n}\n\n/* ─── the names the sheet's files import (web parity) ─────────────────────── */\n\nexport function useToast() {\n return { toast: (o: ShareSheetToastOptions) => ui.toast(o) };\n}\nexport const toast = {\n success: (message: string) => ui.toast({ title: message }),\n error: (message: string) => ui.toast({ title: message, variant: \"destructive\" }),\n info: (message: string) => ui.toast({ title: message }),\n};\nexport function copyNotify(message: string, kind: \"success\" | \"error\"): void {\n ui.toast({ title: message, ...(kind === \"error\" ? { variant: \"destructive\" } : {}) });\n}\nexport const confirm = (options: ConfirmOptions) => ui.confirm(options);\nexport const useCurrentUserId = () => ui.useCurrentUserId();\nexport const useNavTree = () => ({ orgs: ui.useOrganizations() });\nexport const useOrganizationsToCreateIn = () => ({ orgs: ui.useOrganizations() });\nexport const useUserConnections = (options: { organizationId?: string }) => ui.useUserConnections(options);\nexport type ConnectionUser = ShareSheetConnection;\nexport type UserSearchCandidate = {\n id: string;\n email: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n organizations?: string[] | undefined;\n source?: string | undefined;\n [key: string]: unknown;\n};\nexport const usePageCapture = (build: () => unknown, options?: { enabled?: boolean }) => ui.usePageCapture(build, options);\nexport const dialogCapture = (input: unknown) => ui.dialogCapture(input);\nexport const csvExportItem = (...args: any[]) => ui.csvExportItem(...args);\nexport const jsonExportItem = (...args: any[]) => ui.jsonExportItem(...args);\nexport const humanLines = (...args: any[]) => ui.humanLines(...args);\nexport const CopyButtons = (p: LooseProps) => <ui.CopyButtons {...p} />;\nexport const PageCaptureButton = (p: LooseProps) => <ui.PageCaptureButton {...p} />;\nexport const ErrorAlchemyMenu = (p: LooseProps) => <ui.ErrorAlchemyMenu {...p} />;\nexport const InfoHint = (p: LooseProps) => <ui.InfoHint {...p} />;\nexport const EntityDoorControls = (p: LooseProps) => <ui.EntityDoorControls {...p} />;\nexport const EntityRef = (p: LooseProps) => <ui.EntityRef {...p} />;\nexport const UserAvatarDisplay = (p: LooseProps) => <ui.UserAvatarDisplay {...p} />;\nexport const ConnectionsReadNotice = (p: LooseProps) => <ui.ConnectionsReadNotice {...p} />;\nexport const UserSearchField = (p: LooseProps) => <ui.UserSearchField {...p} />;\nlet defaultIdentity: unknown = null;\n/** The vault identity: the host's, else one built on the sharing client's own auth session. */\nexport const usePortalContainer = () => ui.usePortalContainer();\nexport const vaultIdentity = (): any => {\n if (ui.vaultIdentity) return ui.vaultIdentity;\n if (!defaultIdentity) {\n defaultIdentity = createSupabaseIdentity(shareClientForIdentity().auth as any, {\n redirectTo: () => window.location.href,\n onDifferentPerson: async (message: string) => {\n window.alert(message);\n },\n });\n }\n return defaultIdentity;\n};\n\n/* ─── the sheet's per-tab cache (was the web's redux sharingStatus slice) ─── */\n\ninterface SharingStatusEntry {\n visibility: any;\n loading: boolean;\n error: string | null;\n}\ninterface SharingAuthorityEntry {\n isOwner: boolean;\n loading: boolean;\n error: string | null;\n}\ninterface SharingStatusState {\n sharingStatus: { byKey: Record<string, SharingStatusEntry>; authorityByKey: Record<string, SharingAuthorityEntry> };\n}\ntype Action = { type: string; payload: any };\n\nlet state: SharingStatusState = { sharingStatus: { byKey: {}, authorityByKey: {} } };\nconst listeners = new Set<() => void>();\n\nfunction reduce(s: SharingStatusState[\"sharingStatus\"], a: Action): SharingStatusState[\"sharingStatus\"] {\n const { key } = a.payload as { key: string };\n const byKey = { ...s.byKey };\n const authorityByKey = { ...s.authorityByKey };\n switch (a.type) {\n case \"requested\":\n byKey[key] = { visibility: byKey[key]?.visibility ?? null, loading: true, error: null };\n break;\n case \"loaded\":\n byKey[key] = { visibility: a.payload.visibility, loading: false, error: null };\n break;\n case \"failed\":\n byKey[key] = { visibility: byKey[key]?.visibility ?? null, loading: false, error: a.payload.error };\n break;\n case \"authorityRequested\":\n authorityByKey[key] = { isOwner: authorityByKey[key]?.isOwner ?? false, loading: true, error: authorityByKey[key]?.error ?? null };\n break;\n case \"authorityResolved\":\n authorityByKey[key] = { isOwner: a.payload.isOwner, loading: false, error: a.payload.error };\n break;\n }\n return { byKey, authorityByKey };\n}\n\nconst store = {\n getState: () => state,\n dispatch: (a: Action) => {\n state = { sharingStatus: reduce(state.sharingStatus, a) };\n listeners.forEach((l) => l());\n return a;\n },\n};\n\nexport const useAppStore = () => store;\nexport function useAppSelector<T>(select: (s: SharingStatusState) => T): T {\n return useSyncExternalStore(\n (cb) => {\n listeners.add(cb);\n return () => listeners.delete(cb);\n },\n () => select(state),\n () => select(state),\n );\n}\nexport const sharingStatusKey = (resourceType: string, resourceId: string) => `${resourceType}:${resourceId}`;\nexport const sharingStatusRequested = (payload: { key: string }): Action => ({ type: \"requested\", payload });\nexport const sharingStatusLoaded = (payload: { key: string; visibility: unknown }): Action => ({ type: \"loaded\", payload });\nexport const sharingStatusFailed = (payload: { key: string; error: string }): Action => ({ type: \"failed\", payload });\nexport const sharingAuthorityRequested = (payload: { key: string }): Action => ({ type: \"authorityRequested\", payload });\nexport const sharingAuthorityResolved = (payload: { key: string; isOwner: boolean; error: string | null }): Action => ({ type: \"authorityResolved\", payload });\nexport const selectSharingStatus = (s: SharingStatusState, key: string): SharingStatusEntry | undefined => s.sharingStatus.byKey[key];\nexport const selectSharingAuthority = (s: SharingStatusState, key: string): SharingAuthorityEntry | undefined => s.sharingStatus.authorityByKey[key];\n\n/** Test seam: forget every cached answer. */\nexport function resetShareSheetCache(): void {\n state = { sharingStatus: { byKey: {}, authorityByKey: {} } };\n listeners.forEach((l) => l());\n}\n\n/** web parity: the store-read hook the access summary used (kept per tab, re-read when stale). */\nconst storeReads = new Map<string, { data: unknown; at: number }>();\nexport function useStoreRead<T>(key: string | null, read: () => Promise<T>, options: { enabled?: boolean; staleAfterMs?: number } = {}) {\n const activeKey = options.enabled === false ? null : key;\n const kept = activeKey ? storeReads.get(activeKey) : undefined;\n const [s, setS] = useState<{ data: T | undefined; loading: boolean; error: string | null }>({\n data: kept?.data as T | undefined,\n loading: Boolean(activeKey) && !kept,\n error: null,\n });\n const refresh = useCallback(async () => {\n if (!activeKey) return;\n setS((p) => ({ ...p, loading: true }));\n try {\n const data = await read();\n storeReads.set(activeKey, { data, at: Date.now() });\n setS({ data, loading: false, error: null });\n } catch (err) {\n setS((p) => ({ data: p.data, loading: false, error: err instanceof Error ? err.message : String(err) }));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeKey]);\n useEffect(() => {\n if (!activeKey) return;\n const k = storeReads.get(activeKey);\n const stale = !k || (options.staleAfterMs !== undefined && Date.now() - k.at > options.staleAfterMs);\n if (stale) void refresh();\n else setS({ data: k.data as T, loading: false, error: null });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeKey, refresh]);\n return { data: s.data, isLoading: s.loading, isError: s.error !== null, error: s.error, refresh };\n}\nexport function useRefreshWhenChanged(token: unknown, refresh: () => Promise<void>): void {\n const [first, setFirst] = useState(true);\n useEffect(() => {\n if (first) {\n setFirst(false);\n return;\n }\n void refresh();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [token]);\n}\n\n/** web parity: `useAppDispatch()` for the secure-delivery calls — a dispatch that hands the call back. */\nexport { passThroughDispatch } from \"@ai-matrx/sharing/core\";\nexport const useAppDispatch = () => passThroughDispatchRef;\nimport { passThroughDispatch as passThroughDispatchRef } from \"@ai-matrx/sharing/core\";\n","/**\n * features/sharing/format.ts\n *\n * The ONE set of human summaries + rendered-view extractors for every sharing\n * surface (grant rows, the reachability summary, public state, the whole access\n * panel). Consumed by `PermissionsList`, `AccessSummaryPanel`, the share tabs,\n * and any page that composes them — never duplicated at a callsite.\n *\n * THE WHAT-I-SEE LAW (agent-copy skill): these builders return the RENDERED\n * surface converted to data, not the raw rows behind it. Where the panel shows\n * a sentence, the payload carries that same sentence verbatim — including the\n * red ones. A user copying an access surface is asking an agent \"why can't this\n * person see this, and what do I change?\", so denials and errors are the\n * highest-value content here, not a footnote.\n *\n * `accessReasonRows` is deliberately the SAME function `AccessSummaryPanel`\n * renders from: mirror the view's extractor, never re-derive it beside the view.\n */\n\nimport { humanLines } from \"../react/sheet/host\";\nimport {\n describeAccessSummary,\n type AccessContainer,\n type AccessSummary,\n} from \"./accessSummary\";\nimport type { PermissionWithDetails } from \"./types\";\nimport { getResourceTypeLabel } from \"./registry\";\n\n/** Location line for every sharing payload. */\nexport function sharingLocation(surface: string): string {\n return `AI Matrx — Sharing — ${surface}`;\n}\n\n// ---------------------------------------------------------------------------\n// The page KPIs\n// ---------------------------------------------------------------------------\n\n/**\n * The numbers an access surface LEADS with — the tab counts, the public dot,\n * and (when the reachability summary is on screen) who can open it and its reason\n * count. Every payload from such a surface carries these verbatim, in the body\n * AND the envelope attributes, so the agent never recomputes what the user is\n * already looking at.\n *\n * `null` means \"not resolved / not rendered\", which is itself information: it\n * is the difference between \"nobody owns this\" and \"we could not find out\".\n */\nexport interface AccessKpis {\n user_grants: number;\n org_grants: number;\n public_grants: number;\n total_grants: number;\n is_public: boolean;\n /** null while ownership is loading or failed to resolve. */\n viewer_is_owner: boolean | null;\n /** Who can open it without a share, as the summary line reads, when the summary is on screen. */\n reach: string | null;\n /** True when every member of its organization can open it. */\n org_readable: boolean | null;\n /** How many distinct REASONS grant access (the summary's reason rows). */\n reachability_reasons: number | null;\n /** Containers that convey access (scopes, projects, data stores…). */\n container_count: number | null;\n [key: string]: string | number | boolean | null | undefined;\n}\n\nexport function accessKpis(input: {\n permissions: PermissionWithDetails[];\n isPublic: boolean;\n /** null while unresolved — never coerce an unknown owner to false. */\n viewerIsOwner: boolean | null;\n /** The reachability summary, when this surface renders one. */\n summary?: AccessSummary | null | undefined;\n /** The entity type, needed to phrase the reason rows the way the UI does. */\n entityType?: string | undefined;\n}): AccessKpis {\n const { permissions, isPublic, viewerIsOwner, summary, entityType } = input;\n const userGrants = permissions.filter((p) => p.grantedToUserId).length;\n const orgGrants = permissions.filter(\n (p) => p.grantedToOrganizationId,\n ).length;\n const publicGrants = permissions.filter((p) => p.isPublic).length;\n return {\n user_grants: userGrants,\n org_grants: orgGrants,\n public_grants: publicGrants,\n total_grants: permissions.length,\n is_public: isPublic,\n viewer_is_owner: viewerIsOwner,\n reach: summary ? summaryReachLabel(summary) : null,\n org_readable: summary ? summary.orgReadable : null,\n reachability_reasons: summary\n ? accessReasonRows(summary, entityType ?? summary.entityType).length\n : null,\n container_count: summary ? summary.containers.length : null,\n };\n}\n\n/** Identity + KPIs every sharing payload needs to be interpretable. */\nexport interface SharingCopyContext {\n /** Entity/resource token, e.g. \"web_site\". */\n resourceType: string;\n resourceId: string;\n resourceName?: string | null | undefined;\n /** Where the user is, in words — e.g. \"Site access — example.com\". */\n surface: string;\n /** The page's leading KPIs, mirrored verbatim into every payload. */\n kpis: AccessKpis;\n}\n\n/**\n * A sentence the surface actually RENDERED — a denial, a blocker, a warning, a\n * plain-state note. Captured verbatim; never paraphrased into the payload.\n */\nexport interface AccessNotice {\n tone: \"error\" | \"warning\" | \"info\";\n /** The exact rendered text. */\n text: string;\n /** Which part of the surface rendered it. */\n where: string;\n}\n\nexport function humanNotices(notices: AccessNotice[]): string {\n if (notices.length === 0) return \"No errors or blockers are shown.\";\n return notices\n .map((n) => `[${n.tone.toUpperCase()}] ${n.where}: ${n.text}`)\n .join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Grant rows — what PermissionsList renders\n// ---------------------------------------------------------------------------\n\nexport type GranteeKind = \"user\" | \"organization\" | \"public\";\n\nexport function granteeKind(permission: PermissionWithDetails): GranteeKind {\n if (permission.isPublic) return \"public\";\n if (permission.grantedToOrganization || permission.grantedToOrganizationId)\n return \"organization\";\n return \"user\";\n}\n\n/** The row's primary line, exactly as PermissionsList renders it. */\nexport function granteeLabel(permission: PermissionWithDetails): string {\n if (permission.isPublic) return \"Everyone\";\n if (permission.grantedToUser) {\n return (\n permission.grantedToUser.displayName || permission.grantedToUser.email\n );\n }\n if (permission.grantedToOrganization)\n return permission.grantedToOrganization.name;\n return \"Unknown\";\n}\n\n/** The row's secondary line (the email, when a display name took the first). */\nexport function granteeSecondaryLabel(\n permission: PermissionWithDetails,\n): string | null {\n if (permission.grantedToUser?.displayName) {\n return permission.grantedToUser.email;\n }\n return null;\n}\n\n/**\n * The badge text the row shows a non-owner. Owners see a level SELECT with the\n * same value, so this doubles as the level label in both modes.\n */\nexport function grantLevelLabel(permission: PermissionWithDetails): string {\n if (permission.isPublic) return \"Published to the web\";\n const level = permission.permissionLevel;\n return level.charAt(0).toUpperCase() + level.slice(1);\n}\n\nexport function humanGrantRow(permission: PermissionWithDetails): string {\n return humanLines([\n [\"Grantee\", granteeLabel(permission)],\n [\"Email\", granteeSecondaryLabel(permission)],\n [\"Grantee type\", granteeKind(permission)],\n [\"Level\", grantLevelLabel(permission)],\n [\"Grantee id\", permission.grantedToUserId ?? permission.grantedToOrganizationId],\n [\"Resource\", `${permission.resourceType}:${permission.resourceId}`],\n [\"Granted at\", permission.createdAt ? String(permission.createdAt) : null],\n [\"Grant id\", permission.id],\n ]);\n}\n\n/** One flat row for CSV export. */\nexport function grantCsvRow(\n permission: PermissionWithDetails,\n): Record<string, unknown> {\n return {\n grantee: granteeLabel(permission),\n grantee_email: granteeSecondaryLabel(permission) ?? \"\",\n grantee_type: granteeKind(permission),\n level: permission.permissionLevel,\n is_public: permission.isPublic ?? false,\n grantee_user_id: permission.grantedToUserId ?? \"\",\n grantee_organization_id: permission.grantedToOrganizationId ?? \"\",\n resource_type: permission.resourceType,\n resource_id: permission.resourceId,\n granted_at: permission.createdAt ? String(permission.createdAt) : \"\",\n grant_id: permission.id,\n };\n}\n\nexport function grantCsvRows(\n permissions: PermissionWithDetails[],\n): Array<Record<string, unknown>> {\n return permissions.map(grantCsvRow);\n}\n\n/**\n * The empty state PermissionsList renders — copied verbatim, because \"no one\n * has been granted access here\" is frequently the whole answer to \"why can't\n * they see this?\".\n */\nexport const NO_GRANTS_HEADLINE = \"Not shared with anyone\";\n\n/**\n * 🚨 THE SAME EMPTY STATE WHEN SOMETHING ELSE IS PENDING ON THE SAME SCREEN\n * (FIX-10C, VERIFIER-10 F13, 2026-09-22).\n *\n * \"Not shared with anyone\" stood directly above an invited person's row, and a\n * screen that contradicts itself is worse than either sentence alone. An\n * invitation is genuinely not a grant — it confers nothing until it is\n * accepted — so the list does not start counting invitations. It says the\n * narrower, still-true thing: nobody has access YET.\n */\nexport const NO_GRANTS_YET_HEADLINE = \"Nobody has access yet\";\nexport const NO_GRANTS_DETAIL = \"No one has been granted access here\";\n\n/**\n * A DIRECT-GRANT list can only ever say what was granted HERE. It cannot see\n * its table's level, publishing, org membership, or access conveyed through a container, so every\n * payload it emits says so out loud — otherwise an agent reads \"0 grants\" as\n * \"nobody can see it\" and tells the user to grant access they already have.\n */\nexport const GRANT_LIST_SCOPE_NOTE =\n \"This list covers DIRECT grants on this resource only. Access can also come from ownership, its table's level (every member of an Organization record's organization), publishing to the web, organization membership, or a container (scope, project, data store) that conveys it — see the access summary for the complete picture.\";\n\nexport function humanGrantList(\n permissions: PermissionWithDetails[],\n options: { surface: string; shown?: number | undefined } = { surface: \"Sharing\" },\n): string {\n const header = `Current access — ${permissions.length} direct grant${\n permissions.length === 1 ? \"\" : \"s\"\n } (${options.surface})`;\n if (permissions.length === 0) {\n return [\n header,\n `${NO_GRANTS_HEADLINE} — ${NO_GRANTS_DETAIL}`,\n GRANT_LIST_SCOPE_NOTE,\n ].join(\"\\n\");\n }\n const shownNote =\n options.shown != null && options.shown < permissions.length\n ? `\\n(${options.shown} of ${permissions.length} rows are visible on screen; this copy covers all ${permissions.length}.)`\n : \"\";\n return [\n header,\n permissions\n .map((p) => `- ${humanGrantRow(p).replaceAll(\"\\n\", \" · \")}`)\n .join(\"\\n\"),\n GRANT_LIST_SCOPE_NOTE + shownNote,\n ].join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// The reachability summary — what AccessSummaryPanel renders\n// ---------------------------------------------------------------------------\n\n/**\n * 🚨 WHO CAN OPEN IT, AND THE HEADLINE, ARE ONE TRUTH (lane RECORDS-UI-FIX, guide re-walk\n * 2026-09-23; access ladder T-13). The line reads what the record actually reaches — published to\n * the web, every member of its organization, or only its owner and the people named — from the same\n * summary the headline reads, so the two can never disagree. Who may open a record without a share\n * is its table's level, never a row setting (\"Shown to\" only decides which lists show it).\n */\nexport function summaryReachLabel(summary: AccessSummary): string {\n if (summary.isPublic) return \"Published to the web — anyone can open it at its address\";\n if (summary.orgReadable) {\n return `Every member of ${summary.organizationName ?? \"its organization\"} can open it`;\n }\n return \"Only its owner and the people it is shared with\";\n}\n\nexport function isPrivateSummary(summary: AccessSummary): boolean {\n return (\n !summary.isPublic &&\n !summary.orgReadable &&\n summary.directGrantCount === 0 &&\n summary.containers.length === 0\n );\n}\n\nexport function containerTitle(container: AccessContainer): string {\n const kind = container.containerTypeLabel ?? container.containerType;\n return container.label ? `${container.label} (${kind})` : kind;\n}\n\nexport function containerDetail(container: AccessContainer): string {\n const parts: string[] = [`grants ${container.level}`];\n if (container.orgReadable && container.organizationName) {\n parts.push(`readable by everyone in ${container.organizationName}`);\n } else if (container.memberCount > 0) {\n parts.push(\n container.memberCount === 1\n ? \"1 member\"\n : `${container.memberCount} members`,\n );\n }\n return parts.join(\" · \");\n}\n\n/** One rendered reason row — the part users act on. */\nexport interface AccessReasonRow {\n /** Stable key for React + payload correlation. */\n id: string;\n kind: \"organization\" | \"direct-grants\" | \"container\";\n title: string;\n detail: string;\n /** Present for container reasons, so the agent can name what to detach. */\n containerType?: string | undefined;\n containerId?: string | undefined;\n}\n\n/** The person-facing noun for an entity token (\"udt_document\" reads \"document\", never the raw token). */\nexport function recordNoun(entityType: string): string {\n const label = getResourceTypeLabel(entityType);\n return (label === entityType ? entityType.replace(/^udt_/, \"\").replace(/_/g, \" \") : label).toLowerCase();\n}\n\n/**\n * THE reason list — rendered by `AccessSummaryPanel` AND copied by every\n * payload that includes it. One extractor, two consumers; the export can never\n * drift from the screen.\n */\nexport function accessReasonRows(\n summary: AccessSummary,\n entityType: string,\n): AccessReasonRow[] {\n const rows: AccessReasonRow[] = [];\n\n if (summary.orgReadable && summary.organizationName) {\n rows.push({\n id: \"org-readable\",\n kind: \"organization\",\n title: `Everyone in ${summary.organizationName}`,\n detail: `Every member of that organization can open this ${recordNoun(entityType)}`,\n });\n }\n\n if (summary.directGrantCount > 0) {\n rows.push({\n id: \"direct-grants\",\n kind: \"direct-grants\",\n title:\n summary.directGrantCount === 1\n ? \"1 direct share\"\n : `${summary.directGrantCount} direct shares`,\n detail:\n summary.canManage && summary.directGrants.length > 0\n ? summary.directGrants\n .map((g) => `${g.granteeLabel ?? g.granteeType} · ${g.level}`)\n .join(\", \")\n : \"Open the Share tab to manage\",\n });\n }\n\n for (const container of summary.containers) {\n rows.push({\n id: `${container.containerType}:${container.containerId}`,\n kind: \"container\",\n title: containerTitle(container),\n detail: containerDetail(container),\n containerType: container.containerType,\n containerId: container.containerId,\n });\n }\n\n return rows;\n}\n\n/** The closing line the panel renders when nothing grants access. */\nexport const NOTHING_ELSE_GRANTS = \"Nothing else grants access to this yet.\";\n\n/** The panel's rendered error headline, verbatim. */\nexport const ACCESS_SUMMARY_ERROR_HEADLINE = \"Couldn’t determine access\";\n\n/**\n * The reachability panel as DATA — every line it puts on screen, in order.\n * This is the payload body; the raw `AccessSummary` rides along beside it so\n * nothing is lost.\n */\nexport interface AccessSummaryView {\n reach_label: string;\n headline: string;\n reasons: AccessReasonRow[];\n nothing_else_grants: string | null;\n raw: AccessSummary;\n}\n\nexport function accessSummaryView(\n summary: AccessSummary,\n entityType: string,\n): AccessSummaryView {\n return {\n reach_label: summaryReachLabel(summary),\n headline: describeAccessSummary(summary),\n reasons: accessReasonRows(summary, entityType),\n nothing_else_grants: isPrivateSummary(summary) ? NOTHING_ELSE_GRANTS : null,\n raw: summary,\n };\n}\n\nexport function humanAccessSummary(\n summary: AccessSummary,\n entityType: string,\n): string {\n const view = accessSummaryView(summary, entityType);\n return [\n `Who can see this, and why:`,\n `- Who can open it: ${view.reach_label}`,\n `- ${view.headline}`,\n view.reasons.length\n ? view.reasons\n .map((r) => `- ${r.title}${r.detail ? ` — ${r.detail}` : \"\"}`)\n .join(\"\\n\")\n : null,\n view.nothing_else_grants ? `- ${view.nothing_else_grants}` : null,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\n/** Reason rows as flat CSV rows. */\nexport function reasonCsvRows(\n rows: AccessReasonRow[],\n): Array<Record<string, unknown>> {\n return rows.map((r) => ({\n kind: r.kind,\n reason: r.title,\n detail: r.detail,\n container_type: r.containerType ?? \"\",\n container_id: r.containerId ?? \"\",\n }));\n}\n\n// ---------------------------------------------------------------------------\n// Public state — what PublicAccessTab renders\n// ---------------------------------------------------------------------------\n\n// ---------------------------------------------------------------------------\n// The whole access panel\n// ---------------------------------------------------------------------------\n\n/**\n * Everything an access surface shows, as one payload body. Built by the page\n * that composes the sharing components, from LIVE state at click time.\n */\nexport interface AccessPanelView {\n resource: {\n type: string;\n id: string;\n name?: string | null | undefined;\n };\n kpis: AccessKpis;\n /** The tab the user is actually looking at. */\n active_tab?: string | undefined;\n /** Every error / blocker / notice rendered right now, verbatim. */\n notices: AccessNotice[];\n access_summary: AccessSummaryView | null;\n /** Present instead of `access_summary` when the summary failed to load. */\n access_summary_error: string | null;\n user_grants: PermissionWithDetails[];\n org_grants: PermissionWithDetails[];\n public_grant: PermissionWithDetails | null;\n is_public: boolean;\n scope_note: string;\n}\n\nexport function humanAccessPanel(view: AccessPanelView): string {\n const k = view.kpis;\n return [\n `Access — ${view.resource.name ?? view.resource.type} (${view.resource.type}:${view.resource.id})`,\n view.active_tab ? `Tab on screen: ${view.active_tab}` : null,\n `KPIs: ${k.user_grants} user grant${k.user_grants === 1 ? \"\" : \"s\"} · ${k.org_grants} org grant${k.org_grants === 1 ? \"\" : \"s\"} · ${k.is_public ? \"public\" : \"not public\"} · owner: ${\n k.viewer_is_owner === null ? \"unresolved\" : k.viewer_is_owner ? \"you\" : \"not you\"\n }`,\n \"\",\n \"ERRORS & BLOCKERS ON SCREEN:\",\n humanNotices(view.notices),\n \"\",\n view.access_summary_error\n ? `${ACCESS_SUMMARY_ERROR_HEADLINE}: ${view.access_summary_error}`\n : view.access_summary\n ? humanAccessSummaryFromView(view.access_summary)\n : \"The access summary is not on screen.\",\n \"\",\n humanGrantList(view.user_grants, { surface: \"Users tab\" }),\n \"\",\n humanGrantList(view.org_grants, { surface: \"Organizations tab\" }),\n \"\",\n `Public: ${view.is_public ? \"open to everyone\" : \"not open to everyone\"}`,\n ]\n .filter((line) => line !== null)\n .join(\"\\n\");\n}\n\nfunction humanAccessSummaryFromView(view: AccessSummaryView): string {\n return [\n `Who can see this, and why:`,\n `- Who can open it: ${view.reach_label}`,\n `- ${view.headline}`,\n ...view.reasons.map(\n (r) => `- ${r.title}${r.detail ? ` — ${r.detail}` : \"\"}`,\n ),\n view.nothing_else_grants ? `- ${view.nothing_else_grants}` : null,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n","import type { ShareLink } from \"./shareLinks\";\n\n/** A deliberately title-free message for handing a canonical link to a person. */\nexport function createSafeShareMessage(url: string): string {\n return `I shared an AI Matrx item with you: ${url}`;\n}\n\n/** Refuses links the canonical resolver would reject or exhaust. */\nexport function shareLinkUnavailableReason(\n link: Pick<ShareLink, \"isActive\" | \"expiresAt\" | \"maxUses\" | \"useCount\">,\n now = Date.now(),\n): string | null {\n if (!link.isActive) return \"This link has been turned off.\";\n\n if (link.expiresAt !== null) {\n const expiresAt = Date.parse(link.expiresAt);\n if (!Number.isFinite(expiresAt))\n return \"This link's expiry can't be verified.\";\n if (expiresAt <= now) return \"This link has expired.\";\n }\n\n if (link.maxUses !== null && link.useCount >= link.maxUses) {\n return \"This link has reached its view limit.\";\n }\n\n return null;\n}\n\nexport function shareLinkSecurityStateMatches(\n a: ShareLink,\n b: ShareLink,\n): boolean {\n const expiryMatches =\n a.expiresAt === null || b.expiresAt === null\n ? a.expiresAt === b.expiresAt\n : Date.parse(a.expiresAt) === Date.parse(b.expiresAt);\n\n return (\n a.id === b.id &&\n a.token === b.token &&\n a.shortToken === b.shortToken &&\n a.permissionLevel === b.permissionLevel &&\n a.isActive === b.isActive &&\n expiryMatches &&\n a.maxUses === b.maxUses &&\n a.useCount === b.useCount\n );\n}\n\n/**\n * A refreshed inactive/expired/exhausted link must be rejected before asking\n * the owner to review changed fields; otherwise the dialog can imply access\n * that has already been revoked.\n */\nexport function evaluateShareLinkHandoff(\n reviewed: ShareLink,\n current: ShareLink,\n):\n | { status: \"unavailable\"; reason: string }\n | { status: \"changed\" }\n | { status: \"ready\" } {\n const unavailableReason = shareLinkUnavailableReason(current);\n if (unavailableReason)\n return { status: \"unavailable\", reason: unavailableReason };\n if (!shareLinkSecurityStateMatches(reviewed, current)) {\n return { status: \"changed\" };\n }\n return { status: \"ready\" };\n}\n\nexport function describeShareLinkAccess(\n permissionLevel: ShareLink[\"permissionLevel\"],\n): string {\n return `Anyone with the link: ${permissionLevel} access`;\n}\n\nexport function describeShareLinkExpiry(expiresAt: string | null): string {\n if (expiresAt === null) return \"Does not expire\";\n const date = new Date(expiresAt);\n if (!Number.isFinite(date.getTime())) return \"Expiry could not be verified\";\n return `Expires ${date.toLocaleString()}`;\n}\n","\"use client\";\n\n// features/sharing/outside/outsideShareService.ts\n//\n// SHARING A TABLE WITH SOMEBODY OUTSIDE THE ORGANIZATION — the client half.\n//\n// THE EVERYDAY CASE. A plumber gives ONE customer read-only access to the Jobs\n// table. A lab shares one experiments table with a collaborator at another\n// university. Until 21 September the store refused it, in a good sentence, and\n// the Share dialog offered no way forward from that sentence.\n//\n// 🚨 THIS FILE DECIDES NOTHING. Every one of these is a thin call on a declared\n// client door (`platform.client_callable_door`, declared by SHARE-OUT). The\n// store decides who may invite, at what level, and what an outside person can\n// then see — through THE ONE LADDER, the same one that answers for a colleague.\n// A second opinion here would be a second answer to \"who can see this\", which\n// is the one question a platform may not answer twice.\n//\n// WHY THE DOORS AND NOT `iam.invitations` DIRECTLY: the invitation carries the\n// table grant, and the accept writes it. Reading or writing that table from the\n// browser would put the decision in the client.\n\nimport { createClient } from \"./host\";\n\n/**\n * THE STORE'S SCHEMA IS NOT IN `types/database.types.ts`, AND THAT IS CORRECT —\n * the reasoning is written out in full in `features/forms/service.ts`, and\n * `features/portals/service.ts` and `features/booking/service.ts` reach the\n * store the same way. Schema `custom` is reached through its DOORS, so the cast\n * happens HERE, once, named — and every answer shape is declared above, so a\n * door that changes what it answers shows up as a type error rather than as a\n * wrong screen.\n */\ntype StoreCaller = {\n rpc(\n fn: string,\n args: Record<string, unknown>,\n ): PromiseLike<{\n data: unknown;\n error: { message: string; hint?: string | null | undefined; code?: string | null | undefined } | null;\n }>;\n};\n\n/** One rung this person may actually hand out, in the store's own words. */\nexport interface OutsideShareLevel {\n level: string;\n label: string;\n means: string;\n}\n\n/** One outside person on this table, joined or not. */\nexport interface OutsideShareInvitation {\n invitation_id: string;\n email: string;\n level: string;\n level_label: string;\n status: string;\n /** `false` is the \"invited, not yet joined\" state the dialog draws. */\n joined: boolean;\n say: string;\n expires_at: string | null;\n invited_at: string;\n expired: boolean;\n /**\n * 🚨 THE LINK THE SHARER CAN HAND OVER THEMSELVES — the ordinary case, not a\n * fallback. A plumber texts his customer the link; a lab emails a\n * collaborator from their own address. `null` when the row has been accepted\n * (nothing left to open) or when this viewer may not invite.\n */\n accept_path: string | null;\n}\n\n/**\n * WHETHER THIS SERVER CAN ACTUALLY SEND AN EMAIL — three answers, never two.\n *\n * The browser cannot know whether `RESEND_API_KEY` is set on the server, so the\n * server stamps what its channel adapters found at boot\n * (`communication.channel_readiness`) and the door reads the stamp. `unknown`\n * means NOBODY HAS CHECKED — deliberately not `configured: false`, so \"we could\n * not look\" can never be drawn as \"email is off\".\n */\nexport interface ChannelReadiness {\n channel: string;\n answer: \"yes\" | \"no\" | \"unknown\";\n configured: boolean | null;\n checked_at: string | null;\n detail?: string | undefined;\n say: string;\n}\n\n/** What actually happened to the message, and the link either way. */\nexport interface OutsideShareDelivery {\n accept_path: string;\n queued: string[];\n skipped: { channel: string; why: string }[];\n email_answer: ChannelReadiness[\"answer\"];\n say: string;\n}\n\n/** Everything the dialog needs to draw itself without guessing anything. */\nexport interface OutsideShareState {\n /** False only when an administrator of this organization turned outside sharing off. */\n lane_open: boolean;\n /** May THIS viewer invite an outside person to THIS table? */\n may_invite: boolean;\n /**\n * Still answered by the store; deliberately NOT drawn (SHARE-GATE-OFF). The\n * outside lane is on by default and is an administrator's setting, never a\n * control in the share flow.\n */\n may_open_lane: boolean;\n /** The level this viewer holds on the table. `null` means none. */\n my_level: string | null;\n /** The rungs they may give — already capped at `my_level` by the store. */\n levels: OutsideShareLevel[];\n who: string;\n invitations: OutsideShareInvitation[];\n /** One sentence for the person, whatever the state. Never a knob key. */\n say: string;\n /** What this server can actually do about email, observed and stamped. */\n email_delivery: ChannelReadiness;\n /** That answer as one sentence — and it ALWAYS names the copy-the-link route. */\n email_say: string;\n}\n\nfunction custom(): StoreCaller {\n return (createClient() as unknown as { schema(name: string): StoreCaller }).schema(\"custom\");\n}\n\nexport async function readOutsideShare(\n organizationId: string,\n tableId: string,\n): Promise<OutsideShareState> {\n const { data, error } = await custom().rpc(\"table_share_outside\", {\n p_organization_id: organizationId,\n p_table_id: tableId,\n });\n if (error) throw new Error(error.message);\n return data as unknown as OutsideShareState;\n}\n\n/**\n * What the outside share answered. THREE outcomes, one door (MOVE-AND-OUTSIDER,\n * VERIFIER-19 finding 3).\n *\n * `custom.table_share_outside_grant` (G14) decides who the address is:\n * · an ACCOUNT OUTSIDE the organization — granted at once (`granted: true`,\n * `person: \"outside_account\"`), told so by notification, no link, no\n * \"not yet joined\". Notion and Airtable give an existing account access the\n * moment it is named, and so do we;\n * · a MEMBER of the organization — granted like a colleague (`person: \"member\"`);\n * · an address NOBODY signed up with — the invitation, with its link\n * (`invited: true`, `person: \"no_account\"`): the only case a link is needed.\n * Until this lane the dialog called `table_share_outside_invite` for everyone, so\n * an existing account got an invitation and, opening the table, read \"You have\n * not been given this table\".\n */\nexport interface OutsideInviteAnswer {\n /** An `iam.invitations` row was written and a link minted (no account yet). */\n invited: boolean;\n /** They were given the table outright (an existing account, inside or out). */\n granted: boolean;\n /** Who the store found the address to be. */\n person?: \"outside_account\" | \"member\" | \"no_account\" | undefined;\n say: string;\n /** Null when nobody was invited — an invitation that did not happen has no link. */\n accept_path: string | null;\n delivery: OutsideShareDelivery | null;\n}\n\nexport async function shareWithOutsidePerson(\n organizationId: string,\n tableId: string,\n email: string,\n level: string,\n): Promise<OutsideInviteAnswer> {\n const { data, error } = await custom().rpc(\"table_share_outside_grant\", {\n p_organization_id: organizationId,\n p_table_id: tableId,\n p_person: email,\n p_level: level,\n });\n if (error) throw new Error(error.hint ? `${error.message} ${error.hint}` : error.message);\n const answer = data as unknown as Partial<OutsideInviteAnswer>;\n return {\n invited: answer.invited === true,\n granted: answer.granted === true,\n ...(answer.person ? { person: answer.person } : {}),\n say: answer.say ?? \"\",\n accept_path: answer.accept_path ?? null,\n delivery: answer.delivery ?? null,\n };\n}\n\n/** One table somebody else's organization shared with the person signed in, not yet opened. */\nexport interface MyPendingTableInvitation {\n invitation_id: string;\n organization_id: string;\n organization: string | null;\n table_id: string;\n table_name: string;\n level: string;\n level_label: string;\n token: string;\n expires_at: string | null;\n say: string;\n}\n\n/**\n * The person's own pending table invitations (`custom.table_share_outside_for_me`),\n * so a table page that is not given to her yet can say \"this was shared with you —\n * open it\" instead of \"you have not been given this table\".\n */\nexport async function myPendingTableInvitations(): Promise<MyPendingTableInvitation[]> {\n const { data, error } = await custom().rpc(\"table_share_outside_for_me\", {});\n if (error) throw new Error(error.message);\n return (data ?? []) as MyPendingTableInvitation[];\n}\n\nexport async function resendOutside(\n organizationId: string,\n invitationId: string,\n): Promise<{ say: string; accept_path: string; delivery: OutsideShareDelivery }> {\n const { data, error } = await custom().rpc(\"table_share_outside_resend\", {\n p_organization_id: organizationId,\n p_invitation_id: invitationId,\n });\n if (error) throw new Error(error.message);\n return data as unknown as Awaited<ReturnType<typeof resendOutside>>;\n}\n\nexport async function revokeOutside(\n organizationId: string,\n invitationId: string,\n): Promise<{ say: string; grants_removed: number }> {\n const { data, error } = await custom().rpc(\"table_share_outside_revoke\", {\n p_organization_id: organizationId,\n p_invitation_id: invitationId,\n });\n if (error) throw new Error(error.message);\n return data as unknown as { say: string; grants_removed: number };\n}\n\n/**\n * WHAT THE PERSON HOLDING THE LINK IS BEING OFFERED — read BEFORE they are asked\n * to make an account.\n *\n * 🚨 IT IS THE ONLY CALL ON THIS PAGE THAT A SIGNED-OUT READER CAN MAKE, and\n * that is deliberate: somebody outside an organization usually has no account\n * at all, so a page that redirects to sign-up before it explains anything is\n * asking a stranger to make an account for a reason it never gave them. It\n * lives in schema `public` — beside `inv_peek_invited_email`, which has\n * answered anonymously off a token for far longer — because schema `custom` is\n * revoked from `anon` by design and one door is not worth opening it.\n *\n * `state` is one of: `ready` · `sign_in_needed` · `wrong_account` · `accepted`\n * · `revoked` · `expired` · `lane_closed` · `unknown`. An UNKNOWN token gets\n * one sentence and nothing else, so a link can never be used to learn that\n * something is there.\n */\nexport interface TableSharePeek {\n state:\n | \"ready\"\n | \"sign_in_needed\"\n | \"wrong_account\"\n | \"accepted\"\n | \"revoked\"\n | \"expired\"\n | \"lane_closed\"\n | \"unknown\";\n usable: boolean;\n /** Absent on an unknown token — there is nothing to describe. */\n table?: string | undefined;\n table_id?: string | undefined;\n organization?: string | undefined;\n organization_id?: string | undefined;\n level?: string | undefined;\n level_label?: string | undefined;\n means?: string | undefined;\n inviter?: string | undefined;\n /** Masked (`j••••@example.com`) unless the caller IS that person. */\n invited_email?: string | undefined;\n signed_in_as?: string | null | undefined;\n expires_at?: string | null | undefined;\n /** One sentence naming the table, the organization and who shared it. */\n offer?: string | undefined;\n say: string;\n /** Who to ask. Never absent — a dead link with nobody to ask is a dead end. */\n ask: string;\n}\n\nexport async function peekTableShare(token: string): Promise<TableSharePeek> {\n const { data, error } = await (\n createClient() as unknown as { schema(name: string): StoreCaller }\n ).schema(\"iam\").rpc(\"table_share_peek\", { p_token: token });\n if (error) throw new Error(error.message);\n return data as unknown as TableSharePeek;\n}\n\n/**\n * The link somebody can actually paste into a text message. The store answers a\n * PATH — it has no idea what hostname this app is served on — so the origin is\n * added here, from the browser the sharer is standing in.\n */\nexport function absoluteInviteUrl(acceptPath: string): string {\n if (/^https?:\\/\\//.test(acceptPath)) return acceptPath;\n const origin =\n typeof window !== \"undefined\" && window.location?.origin\n ? window.location.origin\n : (process.env.NEXT_PUBLIC_SITE_URL ?? \"https://www.aimatrx.com\");\n return `${origin}${acceptPath}`;\n}\n\nexport async function acceptOutsideShare(token: string): Promise<{\n say: string;\n organization_id: string;\n organization: string | null;\n table_id: string;\n table: string;\n level: string;\n}> {\n const { data, error } = await custom().rpc(\"table_share_outside_accept\", {\n p_token: token,\n });\n if (error) throw new Error(error.message);\n return data as unknown as Awaited<ReturnType<typeof acceptOutsideShare>>;\n}\n","\"use client\";\n\n// features/sharing/secure/secureDeliveryService.ts — SECURE DELIVERY, the client half.\n//\n// A person sends ONE item (and, optionally, protected fields such as a vault password or an SSN)\n// to ONE recipient who needs no account: a single-use link on one channel, a code on the other,\n// shown once. The server (aidream `services/secure_delivery`, FEATURE.md there) seals the payload\n// on the sender's authority and the database hands it out exactly once — this file decides\n// NOTHING. It carries requests to aidream through `callApi` (so the transport, auth and the\n// selected server are the app's one path) and reads the sender's own list straight from\n// the door `platform.secure_delivery_sent` (the caller's own rows only; the table is closed to clients).\n//\n// 🚨 NO VALUE EVER PASSES THROUGH THE SENDER'S SIDE. `create` returns a receipt; the link secret\n// goes to the recipient only; the payload column is client-excluded in the database.\n\nimport { callApi } from \"./host\";\nimport type { ApiCallResult } from \"./host\";\nimport type { AppDispatch } from \"./host\";\nimport type { components } from \"@ai-matrx/api/types\";\nimport { createClient } from \"./host\";\n\nexport type SecureDeliveryOptions = components[\"schemas\"][\"OptionsResponse\"];\nexport type SecureDeliveryReceipt = components[\"schemas\"][\"CreateResponse\"];\nexport type SecureDeliveryPage = components[\"schemas\"][\"RecipientPage\"];\nexport type SecureDeliveryCreate = components[\"schemas\"][\"CreateBody\"];\n\n/** A refusal the server named, with the remedy it offered. */\nexport class SecureDeliveryRefusal extends Error {\n constructor(\n message: string,\n readonly code: string,\n readonly remedy: string | null,\n ) {\n super(message);\n this.name = \"SecureDeliveryRefusal\";\n }\n}\n\nfunction refusalFrom(result: ApiCallResult): SecureDeliveryRefusal {\n const detail = result.error?.serverDetail as\n | { detail?: { code?: string | undefined; message?: string | undefined; remedy?: string | null | undefined } }\n | { code?: string | undefined; message?: string | undefined; remedy?: string | null | undefined }\n | undefined;\n const inner =\n detail && typeof detail === \"object\" && \"detail\" in detail && detail.detail\n ? detail.detail\n : (detail as { code?: string | undefined; message?: string | undefined; remedy?: string | null | undefined } | undefined);\n return new SecureDeliveryRefusal(\n inner?.message ?? result.error?.message ?? \"The secure link could not be sent.\",\n inner?.code ?? (result.error?.type as string | undefined) ?? \"unknown\",\n inner?.remedy ?? null,\n );\n}\n\nfunction read<T>(result: ApiCallResult): T {\n if (result.error || result.data === undefined) throw refusalFrom(result);\n return result.data as T;\n}\n\n// ─── sender ───────────────────────────────────────────────────────────────────\nexport async function fetchSecureDeliveryOptions(\n dispatch: AppDispatch,\n resourceType: string,\n resourceId: string,\n): Promise<SecureDeliveryOptions> {\n return read<SecureDeliveryOptions>(\n await dispatch(\n callApi({\n path: \"/secure-delivery/options\",\n method: \"GET\",\n queryParams: { resource_type: resourceType, resource_id: resourceId },\n expectedErrorStatuses: [401, 403, 409, 422],\n }),\n ),\n );\n}\n\nexport async function sendSecureDelivery(\n dispatch: AppDispatch,\n body: Omit<SecureDeliveryCreate, \"organization_id\" | \"project_id\" | \"task_id\">,\n): Promise<SecureDeliveryReceipt> {\n return read<SecureDeliveryReceipt>(\n await dispatch(\n callApi({\n path: \"/secure-delivery\",\n method: \"POST\",\n body,\n expectedErrorStatuses: [401, 403, 409, 422],\n }),\n ),\n );\n}\n\nexport async function revokeSecureDelivery(\n dispatch: AppDispatch,\n deliveryId: string,\n): Promise<string> {\n const receipt = read<{ sentence: string }>(\n await dispatch(\n callApi({\n path: \"/secure-delivery/{delivery_id}/revoke\",\n method: \"POST\",\n pathParams: { delivery_id: deliveryId },\n body: {},\n expectedErrorStatuses: [401, 409],\n }),\n ),\n );\n return receipt.sentence;\n}\n\n/** One delivery the signed-in person sent for one record. Addresses are theirs to see. */\nexport interface SentSecureDelivery {\n id: string;\n recipient_name: string | null;\n recipient_email: string | null;\n recipient_phone: string | null;\n link_channel: string;\n code_channel: string;\n field_keys: string[];\n status: string;\n created_at: string;\n expires_at: string;\n viewed_at: string | null;\n}\n\nexport async function listSentSecureDeliveries(\n resourceType: string,\n resourceId: string,\n): Promise<SentSecureDelivery[]> {\n // The delivery table is closed to signed-in clients (aidream 1350g): the list comes from the\n // door that returns only the CALLER's own sent rows for this item — never a coworker's.\n const supabase = createClient();\n const { data, error } = await supabase\n .schema(\"platform\")\n .rpc(\"secure_delivery_sent\", { p_resource_type: resourceType, p_resource_id: resourceId });\n if (error) throw new Error(error.message);\n return (data ?? []) as SentSecureDelivery[];\n}\n\n/**\n * The mobile on file for an existing user with this email — only when that number has agreed to\n * texts (the send path's own gate) and the caller is that person or shares an organization with\n * them. Anyone else, or no consent, is null, and the dialog keeps its both-by-email warning.\n */\nexport async function fetchRecipientPhoneOnFile(email: string): Promise<string | null> {\n const supabase = createClient();\n const { data, error } = await supabase\n .schema(\"platform\")\n .rpc(\"secure_delivery_recipient_phone\", { p_email: email });\n if (error) throw new Error(error.message);\n return typeof data === \"string\" && data !== \"\" ? data : null;\n}\n\n// ─── recipient — no sign-in ──────────────────────────────────────────────────\nasync function recipientCall(\n dispatch: AppDispatch,\n path: \"/secure-delivery/open\" | \"/secure-delivery/code\",\n token: string,\n): Promise<SecureDeliveryPage> {\n return read<SecureDeliveryPage>(\n await dispatch(\n callApi({\n path,\n method: \"POST\",\n body: { token },\n expectedErrorStatuses: [422],\n // The recipient belongs to no organization (aidream declares these routes\n // `organization_free`): a visitor who happens to be signed in with none picked\n // must never be asked to choose one to open a link somebody sent them.\n organizationFreeRead: true,\n }),\n ),\n );\n}\n\nexport const openSecureDelivery = (dispatch: AppDispatch, token: string) =>\n recipientCall(dispatch, \"/secure-delivery/open\", token);\n\nexport const requestSecureDeliveryCode = (dispatch: AppDispatch, token: string) =>\n recipientCall(dispatch, \"/secure-delivery/code\", token);\n\nexport async function viewSecureDelivery(\n dispatch: AppDispatch,\n token: string,\n code: string,\n): Promise<SecureDeliveryPage> {\n return read<SecureDeliveryPage>(\n await dispatch(\n callApi({\n path: \"/secure-delivery/view\",\n method: \"POST\",\n body: { token, code },\n expectedErrorStatuses: [422],\n organizationFreeRead: true,\n }),\n ),\n );\n}\n","/**\n * The search-engine-indexed switch's two reads/writes (`platform.search_engine_indexed_state`,\n * `platform.set_search_engine_indexed`), direct over RLS. A host that also has a page cache to\n * refresh (the web) supplies `configureSharing({ searchEngineIndexed })` and is used instead.\n */\nimport { sharingHost, shareClient } from \"./host\";\nimport type { SearchEngineIndexedState } from \"./indexedTypes\";\n\ntype Answer = { state: SearchEngineIndexedState | null; error: string | null };\n\nasync function platformRpc(fn: string, args: Record<string, unknown>) {\n return shareClient().schema(\"platform\").rpc(fn, args);\n}\n\nexport async function getSearchEngineIndexedState(resourceType: string, resourceId: string): Promise<Answer> {\n const port = sharingHost().searchEngineIndexed;\n if (port) return (await port.get(resourceType, resourceId)) as Answer;\n const { data, error } = await platformRpc(\"search_engine_indexed_state\", { p_resource_type: resourceType, p_resource_id: resourceId });\n if (error) return { state: null, error: error.message };\n return { state: data as SearchEngineIndexedState, error: null };\n}\n\n/** `indexed = null` returns the record to its type's default. */\nexport async function setSearchEngineIndexed(resourceType: string, resourceId: string, indexed: boolean | null): Promise<Answer> {\n const port = sharingHost().searchEngineIndexed;\n if (port) return (await port.set(resourceType, resourceId, indexed)) as Answer;\n const { data, error } = await platformRpc(\"set_search_engine_indexed\", { p_resource_type: resourceType, p_resource_id: resourceId, p_indexed: indexed });\n if (error) return { state: null, error: error.message };\n return { state: data as SearchEngineIndexedState, error: null };\n}\n","// features/organizations/service/orgMemberRows.ts\n//\n// THE ONE READ of an organization's member roster\n// (`get_organization_members_with_users`). Every caller — the members page, the\n// task assignee picker's connections, record stamps, \"add everyone in\", CRM —\n// reads through here, so one page asking for the same roster many times makes\n// ONE request: a read in flight is joined, and an answer is kept for the tab.\n// RC-B6 round 2: the task page fired ~60 identical roster requests in 7 s.\n// The remount law (2026-10-03): it used to be reused for 30 s only, so a task\n// tile that woke from sleep after half a minute read the roster again. A roster\n// change made in this tab forgets it (below); `fresh` is the explicit refresh.\n//\n// Failures are never cached. Anything that changes a roster calls\n// `forgetOrganizationMemberRows(orgId)` so the next read is fresh.\n\nimport { createClient } from \"./host\";\nimport { pgErrorToError } from \"@ai-matrx/data\";\nimport type { Database } from \"./dbTypes\";\n\nexport type OrganizationMemberRow =\n Database[\"iam\"][\"Functions\"][\"get_organization_members_with_users\"][\"Returns\"][number];\n\n/** How long a settled roster is kept: for the tab (a change made here forgets it). */\nexport const MEMBER_ROWS_TTL_MS = Number.POSITIVE_INFINITY;\n\ninterface CacheEntry {\n at: number;\n settled: boolean;\n rows: Promise<OrganizationMemberRow[]>;\n}\n\nconst cache = new Map<string, CacheEntry>();\n\ntype RosterClient = Pick<ReturnType<typeof createClient>, \"rpc\" | \"schema\">;\n\nexport function readOrganizationMemberRows(\n orgId: string,\n {\n now = Date.now(),\n fresh = false,\n client,\n }: {\n now?: number | undefined;\n /** An explicit refresh: skip a settled answer (an in-flight read is still joined). */\n fresh?: boolean | undefined;\n client?: RosterClient | undefined;\n } = {},\n): Promise<OrganizationMemberRow[]> {\n const hit = cache.get(orgId);\n if (hit && (now - hit.at < MEMBER_ROWS_TTL_MS) && (!fresh || !hit.settled)) return hit.rows;\n const db = client ?? createClient();\n const entry: CacheEntry = { at: now, settled: false, rows: Promise.resolve([]) };\n const rows = (async () => {\n const { data, error } = await db.schema(\"iam\").rpc(\"get_organization_members_with_users\", {\n p_org_id: orgId,\n });\n if (error) throw pgErrorToError(error);\n return (data ?? []) as OrganizationMemberRow[];\n })();\n entry.rows = rows;\n cache.set(orgId, entry);\n rows.then(\n () => {\n entry.settled = true;\n },\n () => {\n if (cache.get(orgId) === entry) cache.delete(orgId);\n },\n );\n return rows;\n}\n\n/** A roster changed (role, removal, join, leave): the next read goes to the server. */\nexport function forgetOrganizationMemberRows(orgId?: string | undefined): void {\n if (orgId) cache.delete(orgId);\n else cache.clear();\n}\n","// features/organizations/organizationsToCreateIn.ts\n//\n// THE ORGANIZATIONS A PERSON MAY CREATE SOMETHING IN. An archived organization is closed\n// (THE ARCHIVED-ITEMS LAW): it is never offered as a place to put new work. The nav tree\n// (`get_user_full_context`) carries no archived flag, so the live-membership list\n// (`useUserOrganizations`, default \"active\") is the authority on which ones are open.\n// Pure helpers here; the hook is `useOrganizationsToCreateIn` in agent-context/hooks/useNavTree.\n\n/** Keep only the organizations whose id is in `openIds`. Order preserved. */\nexport function onlyOpenOrganizations<T extends { id: string }>(\n orgs: readonly T[],\n openIds: ReadonlySet<string>,\n): T[] {\n return orgs.filter((o) => openIds.has(o.id));\n}\n\n/**\n * The text that tells two live organizations with the same visible name apart:\n * their address (slug), else a short id. Null when the name is unique in the list.\n */\nexport function organizationDisambiguators<\n T extends { id: string; name: string; slug?: string | null | undefined },\n>(orgs: readonly T[]): Map<string, string | null> {\n const counts = new Map<string, number>();\n for (const o of orgs) {\n const k = o.name.trim().toLowerCase();\n counts.set(k, (counts.get(k) ?? 0) + 1);\n }\n const out = new Map<string, string | null>();\n for (const o of orgs) {\n const dup = (counts.get(o.name.trim().toLowerCase()) ?? 0) > 1;\n out.set(o.id, dup ? (o.slug || o.id.slice(0, 8)) : null);\n }\n return out;\n}\n","/** The two team reads \"Add everyone in a team\" needs (`team_list`, `team_members`), direct over RLS. */\nimport { pgErrorToError } from \"@ai-matrx/data\";\nimport { shareClient } from \"./host\";\n\nexport type TeamRole = \"admin\" | \"member\";\n\nexport interface Team {\n id: string;\n name: string;\n description: string | null;\n hrDepartmentId: string | null;\n hrDepartmentName: string | null;\n memberCount: number;\n /** The viewer's role on this team, or null when they are not on it. */\n myRole: TeamRole | null;\n /** The viewer may rename it and manage its members (org owner/admin or team admin). */\n canManage: boolean;\n /** Set only on archived teams (listed for organization owners and admins). */\n archivedAt: string | null;\n createdAt: string;\n}\n\nexport interface TeamMember {\n userId: string;\n role: TeamRole;\n /** Added by hand (an iam.memberships row). */\n isListed: boolean;\n /** On the team because of the linked HR department. */\n isFromHr: boolean;\n listedSince: string | null;\n email: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n}\n\nexport interface HrDepartmentOption {\n id: string;\n name: string;\n parentDepartmentId: string | null;\n}\n\nfunction toRole(value: string | null | undefined): TeamRole | null {\n return value === \"admin\" || value === \"member\" ? value : null;\n}\n\n\nexport async function listTeams(organizationId: string, includeArchived = false): Promise<Team[]> {\n const { data, error } = await shareClient().schema(\"iam\").rpc(\"team_list\", { p_organization_id: organizationId, p_include_archived: includeArchived });\n if (error) throw pgErrorToError(error);\n return ((data ?? []) as Array<Record<string, unknown>>).map((row) => ({\n id: String(row.id),\n name: String(row.name ?? \"\"),\n description: (row.description as string | null) ?? null,\n hrDepartmentId: (row.hr_department_id as string | null) ?? null,\n hrDepartmentName: (row.hr_department_name as string | null) ?? null,\n memberCount: Number(row.member_count ?? 0),\n myRole: toRole(row.my_role as string | null),\n canManage: Boolean(row.can_manage),\n archivedAt: (row.archived_at as string | null) ?? null,\n createdAt: String(row.created_at ?? \"\"),\n }));\n}\n\nexport async function listTeamMembers(teamId: string): Promise<TeamMember[]> {\n const { data, error } = await shareClient().schema(\"iam\").rpc(\"team_members\", { p_team_id: teamId });\n if (error) throw pgErrorToError(error);\n return ((data ?? []) as Array<Record<string, unknown>>).map((row) => ({\n userId: String(row.user_id),\n role: toRole(row.role as string | null) ?? \"member\",\n isListed: Boolean(row.is_listed),\n isFromHr: Boolean(row.is_from_hr),\n listedSince: (row.listed_since as string | null) ?? null,\n email: (row.email as string | null) ?? null,\n displayName: (row.display_name as string | null) ?? null,\n avatarUrl: (row.avatar_url as string | null) ?? null,\n }));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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W,OAAO,IAAI,cAAc,EAAE;AAAA,EACxC,EAAE;AACJ;AAEA,eAAsB,gBAAgB,QAAuC;AAC3E,QAAM,EAAE,MAAM,MAAM,IAAI,MAAM,YAAY,EAAE,OAAO,KAAK,EAAE,IAAI,gBAAgB,EAAE,WAAW,OAAO,CAAC;AACnG,MAAI,MAAO,WAAM,6BAAe,KAAK;AACrC,UAAS,QAAQ,CAAC,GAAsC,IAAI,CAAC,SAAS;AAAA,IACpE,QAAQ,OAAO,IAAI,OAAO;AAAA,IAC1B,MAAM,OAAO,IAAI,IAAqB,KAAK;AAAA,IAC3C,UAAU,QAAQ,IAAI,SAAS;AAAA,IAC/B,UAAU,QAAQ,IAAI,UAAU;AAAA,IAChC,aAAc,IAAI,gBAAkC;AAAA,IACpD,OAAQ,IAAI,SAA2B;AAAA,IACvC,aAAc,IAAI,gBAAkC;AAAA,IACpD,WAAY,IAAI,cAAgC;AAAA,EAClD,EAAE;AACJ;","names":["readOrganizationMemberRows","import_access","PACKAGE_RANK","PermissionErrorCode","import_errors","data","error","import_errors","supabase","import_core","shareClient","getClaimsUser","kitConfirm","supabase","readOrganizationMemberRows","import_data"]}
|