{"version":3,"sources":["../../src/react/index.ts","../../src/react/context.tsx","../../src/react/sharedContext.ts","../../src/react/hooks/useAssociations.ts","../../src/results.ts","../../src/entity-types.generated.ts","../../src/core/rpcResult.ts","../../src/association-types.generated.ts","../../src/core/titles.ts","../../src/core/store.ts","../../src/react/hooks/useContainerLinks.ts","../../src/edges.ts","../../src/react/hooks/useEntityTitles.ts","../../src/react/hooks/useCategories.ts","../../src/react/hooks/useUniversalEntitySearch.ts","../../src/react/components/SearchFailureNotice.tsx","../../src/react/hooks/useAssociationCandidates.ts","../../src/react/hooks/useComments.ts","../../src/react/hooks/useAssociationEntitySelect.ts","../../src/react/components/PrimaryEntityContext.tsx","../../src/react/components/AssociationWindow.tsx","../../src/react/components/DefaultWindowShell.tsx","../../src/react/icons.tsx","../../src/react/components/AssociationPicker.tsx","../../src/react/components/UniversalAssociationPicker.tsx","../../src/react/components/entityDoors.tsx","../../src/react/components/AttachedItemsSheet.tsx","../../src/react/components/AssociationCard.tsx","../../src/react/contentRoles.ts","../../src/react/components/AssociationCardGrid.tsx","../../src/react/components/AssociationList.tsx","../../src/react/components/AssociationCaptureToolbar.tsx","../../src/react/lazyPorts.tsx","../../src/react/hooks/useAssociationPickerBridge.ts","../../src/react/components/AssociationEntitySelect.tsx","../../src/react/components/CategorySelect.tsx","../../src/core/categoryHierarchy.ts","../../src/react/components/CategoryTagPicker.tsx","../../src/react/components/CommentThread.tsx","../../src/comments.ts","../../src/react/components/CommentBody.tsx"],"sourcesContent":["\"use client\";\n\n// @ai-matrx/associations/react — the React binding (W3 hooks + W4 faces).\n//\n// THE BANNER GROUP: this entry (and only this entry) ships with a\n// `\"use client\"` directive stamped on its dist chunks — everything here\n// touches React state/effects/DOM. The types root and /core stay PURE.\n//\n// Bind once per host:\n//\n//   const store = createAssociationsStore({ dataSource, identity, errorSink, … });\n//   <AssociationsProvider store={store} notifier={…} windowShell={…}\n//                         capture={…} pickerOverrides={…} entityDoors={…}>\n//\n// The seven hooks keep the matrx-frontend originals' EXACT public\n// signatures (the W5 swap is a mechanical re-export flip + Redux-fragment\n// deletion), riding the /core store via useSyncExternalStore.\n//\n// W4 status: COMPLETE. The three faces that were gated on design-system\n// primitives (`AssociationEntitySelect`, `CategorySelect`,\n// `CategoryTagPicker`) landed with design-system 0.3.0 (the Command family,\n// the Select family, the CreatablePicker composite) — the peer floor is\n// `>=0.3.0`.\n\nexport {\n  AssociationsProvider,\n  useAssociationsStore,\n  useAssociationsUiPorts,\n  useNotifier,\n  type AssociationsProviderProps,\n  type AssociationsUiPorts,\n} from \"./context\";\n\n// ── hooks (W3 — signature-compatible with the matrx-frontend originals) ──\nexport {\n  useAssociations,\n  useEntityRelationships,\n  type AssociationWriteResult,\n  type UseAssociationsArgs,\n  type UseAssociationsReturn,\n} from \"./hooks/useAssociations\";\nexport {\n  useContainerLinks,\n  containerLinksArgs,\n  linkDirection,\n  type ContainerLink,\n  type UseContainerLinksArgs,\n  type UseContainerLinksReturn,\n} from \"./hooks/useContainerLinks\";\nexport {\n  useEntityTitles,\n  type EntityTitleRef,\n  type UseEntityTitlesReturn,\n} from \"./hooks/useEntityTitles\";\nexport {\n  useCategories,\n  type CategoryCreateResult,\n  type CategoryMutationResult,\n  type UseCategoriesArgs,\n  type UseCategoriesReturn,\n} from \"./hooks/useCategories\";\nexport {\n  useUniversalEntitySearch,\n  type UniversalCandidate,\n  type UniversalSearchFailure,\n  type UniversalSearchStatus,\n  type UseUniversalEntitySearchArgs,\n  type UseUniversalEntitySearchReturn,\n  type UniversalSearchSource,\n} from \"./hooks/useUniversalEntitySearch\";\nexport {\n  SearchFailureNotice,\n  describeSearchFailures,\n  type SearchFailureNoticeProps,\n} from \"./components/SearchFailureNotice\";\nexport {\n  useAssociationCandidates,\n  type CandidateRecord,\n  type UseAssociationCandidatesArgs,\n  type UseAssociationCandidatesReturn,\n} from \"./hooks/useAssociationCandidates\";\nexport {\n  useComments,\n  type UseCommentsArgs,\n  type UseCommentsReturn,\n} from \"./hooks/useComments\";\nexport {\n  useAssociationEntitySelectAdapter,\n  type AssociationEntitySelectAdapter,\n  type AssociationEntitySelectItem,\n  type UseAssociationEntitySelectAdapterArgs,\n} from \"./hooks/useAssociationEntitySelect\";\n\n// ── faces (W4) ───────────────────────────────────────────────────────────\nexport {\n  PrimaryEntityProvider,\n  usePrimaryEntity,\n  type PrimaryEntity,\n  type PrimaryContainerEntity,\n  type PrimaryFiledEntity,\n} from \"./components/PrimaryEntityContext\";\nexport {\n  AssociationWindow,\n  type AssociationWindowProps,\n} from \"./components/AssociationWindow\";\nexport {\n  AssociationPicker,\n  AssociationCandidateBody,\n  type AssociationCandidateBodyProps,\n  type AssociationPickerProps,\n} from \"./components/AssociationPicker\";\nexport {\n  UniversalAssociationPicker,\n  attachedKey,\n  type UniversalAssociationPickerProps,\n} from \"./components/UniversalAssociationPicker\";\nexport {\n  AttachedItemsSheet,\n  type AttachedItemsSheetProps,\n} from \"./components/AttachedItemsSheet\";\nexport {\n  AssociationCard,\n  type AssociationCardProps,\n  type AssociationCardLook,\n} from \"./components/AssociationCard\";\nexport {\n  AssociationCardGrid,\n  type AssociationCardGridProps,\n} from \"./components/AssociationCardGrid\";\nexport {\n  AssociationList,\n  useContainerLinksAdapter,\n  type AssociationListProps,\n  type ContainerResourceRow,\n  type ContainerResourcesAdapter,\n} from \"./components/AssociationList\";\nexport {\n  AssociationCaptureToolbar,\n  CaptureToolbarAction,\n  type AssociationCaptureToolbarProps,\n  type CaptureAttach,\n  type CaptureAttachResult,\n} from \"./components/AssociationCaptureToolbar\";\nexport {\n  DoorRef,\n  DoorControlsSlot,\n  UnresolvedRef,\n} from \"./components/entityDoors\";\nexport {\n  DefaultWindowShell,\n  type DefaultWindowShellProps,\n} from \"./components/DefaultWindowShell\";\nexport {\n  lazyPickerOverride,\n  lazyWindowShell,\n  type WindowShellComponentProps,\n} from \"./lazyPorts\";\nexport {\n  useAssociationPickerBridge,\n  type AssociationPickerBridge,\n  type AssociationPickerBridgeOptions,\n  type PickerBridgeItem,\n} from \"./hooks/useAssociationPickerBridge\";\nexport {\n  AssociationEntitySelect,\n  type AssociationEntitySelectProps,\n} from \"./components/AssociationEntitySelect\";\nexport {\n  CategorySelect,\n  type CategorySelectProps,\n} from \"./components/CategorySelect\";\nexport {\n  CategoryTagPicker,\n  type CategoryTagPickerProps,\n  type TagPickerIcon,\n} from \"./components/CategoryTagPicker\";\n\n// ── comments (W6 — the canonical comments UI, ruling C4) ─────────────────\nexport {\n  CommentThread,\n  CommentComposer,\n  buildCommentTree,\n  type CommentThreadProps,\n  type PostedComment,\n  type CommentComposerProps,\n} from \"./components/CommentThread\";\nexport { CommentBody, type CommentBodyProps } from \"./components/CommentBody\";\n// `formatRelativeTime` is NO LONGER exported here — it moved to\n// `@ai-matrx/kit/format` (census H1: this package and `@ai-matrx/diff` each\n// defined one, so no host twin had a correct owner). The comments face's\n// voice is `{ style: \"intl\", fallbackToInput: true }`. See the CHANGELOG's\n// \"Consumer action (C28)\".\n\n// ── chrome shared by the faces ───────────────────────────────────────────\nexport {\n  CONTENT_ROLES,\n  getContentRoleMeta,\n  type ContentRoleMeta,\n} from \"./contentRoles\";\nexport { DefaultEntityIcon } from \"./icons\";\n","// react/context.tsx — @ai-matrx/associations/react\n//\n// The ONE React binding point (design Decision 2): a host constructs the\n// /core store once (`createAssociationsStore(cfg)`) in its binding module and\n// mounts `<AssociationsProvider store={store} …>` at the top of the tree. The\n// UI ports (notifier / windowShell / capture / pickerOverrides / entityDoors\n// / authorDisplay) are /react concerns and bind HERE — the headless store\n// never sees them.\n//\n// Required-port failures stay loud: every hook/face reaches the store through\n// `useAssociationsStore()`, which THROWS with a precise message when no\n// provider is mounted — never a silently-empty surface.\n//\n// MOUNTING IS INERT (0.9.0). This provider issues NO network call of its own.\n// The demanded-schema boot probe it carried from 0.6.0 asked whether each of\n// the 26 demanded RPCs existed by CALLING it with sentinel arguments —\n// fourteen of them WRITES — so every consumer fired ~25 POSTs that answered\n// 400 on every page load. Worse, its `process.env.NODE_ENV === \"development\"`\n// gate is BAKED TO TRUE by our own build (esbuild substitutes that expression\n// under `platform: \"browser\"`), so \"dev-only\" ran in production too. The probe\n// is deleted; PGRST202 at any real call site still screams\n// `demanded_schema_violation` with a remedy.\n//\n// 🚨 NEVER gate runtime behavior in this package on `process.env.NODE_ENV`.\n// The build inlines it. `src/__tests__/no-node-env-gating.test.ts` holds it.\n//\n// Notifier degradation (design Decision 2 table): when the host binds no\n// notifier, /react warns ONCE through the store's errorSink and every\n// user-facing failure still reaches the errorSink — the create-then-associate\n// loud-outcome law is satisfied structurally, not by toast availability.\n\nimport { useContext, useRef, type ComponentType, type ReactNode } from \"react\";\n\nimport { sharedContext } from \"./sharedContext\";\n\nimport type {\n  AssociationsNotifier,\n  AuthorDisplayPort,\n  CapturePort,\n  EntityDoorsPort,\n  PickerOverrideMap,\n  WindowShellPort,\n} from \"../ports\";\nimport type { AssociationsStore } from \"../core/store\";\n\nexport interface AssociationsUiPorts {\n  notifier?: AssociationsNotifier;\n  windowShell?: WindowShellPort;\n  capture?: CapturePort;\n  pickerOverrides?: PickerOverrideMap;\n  entityDoors?: EntityDoorsPort;\n  authorDisplay?: AuthorDisplayPort;\n  /**\n   * The host's compact markdown renderer for a comment body (an edit thread's\n   * quoted \"Was:/Now:\" blocks). Absent → the package's built-in renderer.\n   */\n  commentBody?: ComponentType<{ body: string; className?: string | undefined }>;\n  /**\n   * Sign in again (a signed-out tab). Shown as the action beside a signed-out\n   * failure; absent → the sentence alone, with Retry. The host opens its login\n   * in a NEW tab so the words typed here stay for Retry.\n   */\n  signIn?: () => void;\n}\n\ninterface AssociationsReactBinding extends AssociationsUiPorts {\n  store: AssociationsStore;\n  /** ONE warn-once latch per provider instance (never module state). */\n  notifierWarned: { current: boolean };\n}\n\n// Shared across copies of this package (`sharedContext.ts`): two installed copies must not mean two contexts.\nconst AssociationsReactContext = sharedContext<AssociationsReactBinding | null>(\n  \"AssociationsReactContext\",\n  null,\n);\n\nexport interface AssociationsProviderProps extends AssociationsUiPorts {\n  /** The /core store the host constructed with `createAssociationsStore`. */\n  store: AssociationsStore;\n  children: ReactNode;\n}\n\nexport function AssociationsProvider({\n  store,\n  notifier,\n  windowShell,\n  capture,\n  pickerOverrides,\n  entityDoors,\n  authorDisplay,\n  commentBody,\n  signIn,\n  children,\n}: AssociationsProviderProps) {\n  const notifierWarned = useRef(false);\n\n  return (\n    <AssociationsReactContext.Provider\n      value={{\n        store,\n        notifierWarned,\n        ...(notifier !== undefined ? { notifier } : {}),\n        ...(windowShell !== undefined ? { windowShell } : {}),\n        ...(capture !== undefined ? { capture } : {}),\n        ...(pickerOverrides !== undefined ? { pickerOverrides } : {}),\n        ...(entityDoors !== undefined ? { entityDoors } : {}),\n        ...(authorDisplay !== undefined ? { authorDisplay } : {}),\n        ...(commentBody !== undefined ? { commentBody } : {}),\n        ...(signIn !== undefined ? { signIn } : {}),\n      }}\n    >\n      {children}\n    </AssociationsReactContext.Provider>\n  );\n}\n\nfunction requireBinding(): AssociationsReactBinding {\n  const binding = useContext(AssociationsReactContext);\n  if (!binding) {\n    throw new Error(\n      \"@ai-matrx/associations/react: no <AssociationsProvider> above this \" +\n        \"component. Construct the store once with createAssociationsStore(cfg) \" +\n        \"in your host binding and mount <AssociationsProvider store={store}> \" +\n        \"at the top of the tree.\",\n    );\n  }\n  return binding;\n}\n\n/** The /core store bound by the nearest provider. Throws when unmounted. */\nexport function useAssociationsStore(): AssociationsStore {\n  return requireBinding().store;\n}\n\n/** The UI ports the host bound (each optional, each degradable). */\nexport function useAssociationsUiPorts(): AssociationsUiPorts {\n  const { store: _store, notifierWarned: _warned, ...ports } = requireBinding();\n  return ports;\n}\n\n/**\n * The notifier, degraded per contract: absent → warn once via errorSink,\n * then route every user-facing failure to the errorSink so no outcome is\n * silent. Success messages without a notifier are dropped (the surface's own\n * state change is the confirmation); failures always scream.\n */\nexport function useNotifier(): AssociationsNotifier {\n  const binding = requireBinding();\n  if (binding.notifier) return binding.notifier;\n  const { store, notifierWarned } = binding;\n  const warnOnce = () => {\n    if (notifierWarned.current) return;\n    notifierWarned.current = true;\n    store.errorSink({\n      code: \"notifier_missing\",\n      message:\n        \"@ai-matrx/associations/react: no notifier port bound — user-facing \" +\n        \"failures are routed to the errorSink only. Bind `notifier` on \" +\n        \"AssociationsProvider for toasts.\",\n    });\n  };\n  return {\n    success() {\n      warnOnce();\n    },\n    error(msg, opts) {\n      warnOnce();\n      store.errorSink({\n        code: \"user_facing_error\",\n        message: msg,\n        ...(opts?.description !== undefined\n          ? { context: { description: opts.description } }\n          : {}),\n      });\n    },\n  };\n}\n","// react/sharedContext.ts — a React context that survives TWO COPIES of this package.\n//\n// This package republishes a patch version many times a day, and a host's `node_modules` can briefly hold two\n// (the app's own copy, and the one a sibling package such as @ai-matrx/chat resolved after a partial install).\n// A plain module-level `createContext` then makes TWO contexts: the host mounts <AssociationsProvider> through\n// copy A while a chat tile reads through copy B, and B throws \"no <AssociationsProvider> above this component\"\n// — a defect no code in either place can see. Registering the context on `globalThis` under a `Symbol.for` key\n// makes every copy read and write the SAME one (the pattern @ai-matrx/records uses for its registries).\n// Precondition: the copies agree on the value's shape (a minor bump that changes it must change the key).\n\nimport { createContext, type Context } from \"react\";\n\nexport function sharedContext<T>(name: string, initial: T): Context<T> {\n  const key = Symbol.for(`@ai-matrx/associations/react/${name}`);\n  const registry = globalThis as unknown as Record<symbol, Context<T> | undefined>;\n  return (registry[key] ??= createContext<T>(initial));\n}\n","// react/hooks/useAssociations.ts — @ai-matrx/associations/react\n//\n// Public hook for the unified association edge (`platform.associations`) — the\n// canonical attach/detach primitive any UI consumes to read and mutate an\n// entity's relationships (in BOTH directions) to any other entity.\n//\n// Ported SIGNATURE-BYTE-COMPATIBLE from matrx-frontend\n// `features/scopes/hooks/useAssociations.ts` (W3, 2026-08-29): same args,\n// same return shape, same lazy auto-load semantics. The seam inverted: the\n// Redux selector/thunk cache becomes the package store ridden via\n// `useSyncExternalStore` (design Decision 3) — adoption is a re-export flip\n// plus DELETION of the slice fragments, with call sites unchanged.\n//\n// This is what components reach for; they should never touch the store's raw\n// chokepoint services directly.\n\nimport { useEffect, useRef, useSyncExternalStore } from \"react\";\n\nimport type {\n  AssociationEdge,\n  AssociationsEntry,\n  AssociationTargetType,\n} from \"../../edges\";\nimport {\n  associationsKey,\n  type AssociationWriteResult,\n} from \"../../core/store\";\nimport { useAssociationsStore } from \"../context\";\n\nexport interface UseAssociationsArgs {\n  /** The entity whose relationships to read/manage (the cache endpoint). */\n  type: string;\n  id: string | null;\n  /** Disable the auto-load on mount. Defaults to false (auto-load). */\n  autoLoad?: boolean;\n}\n\n// Single declaration lives in the store; re-export so consumers can keep\n// importing it from the hook (doctrine forbids the duplicate definition).\nexport type { AssociationWriteResult };\n\nexport interface UseAssociationsReturn {\n  /** Every edge touching this entity, both directions. */\n  edges: AssociationEdge[];\n  status: AssociationsEntry[\"status\"];\n  error: string | null;\n  fetchedAt: number | null;\n  /** Attach this entity (as source) → a target. */\n  add: (args: {\n    targetType: AssociationTargetType;\n    targetId: string;\n    orgId?: string;\n    label?: string;\n    /** Typed edge role (e.g. 'theme' for a folder/tag) — omit for a role-less edge. */\n    role?: string;\n  }) => Promise<AssociationWriteResult>;\n  /** Detach this entity (as source) → a target. */\n  remove: (args: {\n    targetType: string;\n    targetId: string;\n    role?: string;\n  }) => Promise<AssociationWriteResult>;\n  /** Replace this entity's edges of one target type with exactly `targetIds`. */\n  setTargets: (args: {\n    targetType: AssociationTargetType;\n    targetIds: string[];\n    orgId?: string;\n    role?: string;\n  }) => Promise<AssociationWriteResult>;\n  /** Force a refetch of this entity's edges. */\n  reload: () => Promise<void>;\n}\n\nconst noopSubscribe = () => () => {};\n\nexport function useAssociations(\n  args: UseAssociationsArgs,\n): UseAssociationsReturn {\n  const { type, id, autoLoad = true } = args;\n  const store = useAssociationsStore();\n\n  const key = type && id ? associationsKey(type, id) : null;\n  const entry = useSyncExternalStore(\n    key ? (cb) => store.subscribe(key, cb) : noopSubscribe,\n    () => store.getEdges(type, id ?? \"\"),\n    () => store.getEdges(type, id ?? \"\"),\n  );\n\n  const loadedKey = useRef<string | null>(null);\n  useEffect(() => {\n    if (!autoLoad || !type || !id) return;\n    const k = associationsKey(type, id);\n    if (loadedKey.current === k) return;\n    loadedKey.current = k;\n    void store.load(type, id);\n  }, [autoLoad, store, type, id]);\n\n  return {\n    edges: entry.edges,\n    status: entry.status,\n    error: entry.error,\n    fetchedAt: entry.fetchedAt,\n    add: async ({ targetType, targetId, orgId, label, role }) => {\n      if (!id) return { ok: false, error: \"Missing entity id\" };\n      return store.add({\n        sourceType: type,\n        sourceId: id,\n        targetType,\n        targetId,\n        ...(orgId !== undefined ? { orgId } : {}),\n        ...(label !== undefined ? { label } : {}),\n        ...(role !== undefined ? { role } : {}),\n      });\n    },\n    remove: async ({ targetType, targetId, role }) => {\n      if (!id) return { ok: false, error: \"Missing entity id\" };\n      return store.remove({\n        sourceType: type,\n        sourceId: id,\n        targetType,\n        targetId,\n        ...(role !== undefined ? { role } : {}),\n      });\n    },\n    setTargets: async ({ targetType, targetIds, orgId, role }) => {\n      if (!id) return { ok: false, error: \"Missing entity id\" };\n      return store.setTargets({\n        sourceType: type,\n        sourceId: id,\n        targetType,\n        targetIds,\n        ...(orgId !== undefined ? { orgId } : {}),\n        ...(role !== undefined ? { role } : {}),\n      });\n    },\n    reload: async () => {\n      if (!type || !id) return;\n      await store.load(type, id, { force: true });\n    },\n  };\n}\n\n/**\n * Convenience alias — same hook, a name that reads naturally on relationship\n * surfaces (\"the things this entity is related to\"). Identical contract.\n */\nexport const useEntityRelationships = useAssociations;\n","// src/results.ts — @ai-matrx/associations\n//\n// The typed never-throw result envelope every service method in this package\n// returns — ported from matrx-frontend `features/scopes/types.ts`\n// (`ScopesRpcError*`, associations extraction W1, 2026-08-29) and renamed to\n// the package vocabulary. The runtime builders/mappers (`ok`/`err`/\n// `mapPgError` — the loud PG-error funnel) arrive with `/core` in W2; the\n// TYPES live at the root so ports and consumers can speak them with zero\n// runtime dependency.\n\nexport type AssociationsRpcErrorCode =\n  | \"unauthorized\"\n  | \"forbidden_org\"\n  | \"forbidden_role\"\n  | \"not_found\"\n  | \"conflict_in_use\"\n  | \"invalid_argument\"\n  | \"version_conflict\"\n  | \"quota_exceeded\"\n  /**\n   * THE DEMANDED-SCHEMA SCREAM. A PostgREST missing-function error (PGRST202)\n   * on any demanded RPC maps to this code: the database this client is\n   * pointed at does not run the schema this package demands (README front\n   * door). It always reaches the errorSink — one unambiguous scream, never a\n   * mystery toast — PGRST202 arrives as `demanded_schema_violation`.\n   */\n  | \"demanded_schema_violation\"\n  | \"internal\";\n\nexport interface AssociationsRpcError {\n  code: AssociationsRpcErrorCode;\n  message: string;\n  hint?: string;\n  detail?: unknown;\n}\n\nexport type AssociationsRpcResult<T> =\n  | { ok: true; data: T }\n  | { ok: false; error: AssociationsRpcError };\n\n/**\n * Type-guard narrowing helper for {@link AssociationsRpcResult}. Hosts running\n * with `strictNullChecks: false` lose TypeScript's default control-flow\n * narrowing for boolean discriminants (`if (!res.ok)` reverts to the wide\n * union) — this guard keeps both branches typed everywhere.\n */\nexport function isAssociationsRpcErr<T>(\n  r: AssociationsRpcResult<T>,\n): r is { ok: false; error: AssociationsRpcError } {\n  return r.ok === false;\n}\n\n/**\n * The structural shape of a PostgREST failure as supabase-js resolves it: a\n * PLAIN OBJECT parsed from the response body — NOT an `Error` instance.\n * (Reading `.message` off `instanceof Error` discards the real database\n * message on every genuine failure; `/core`'s mapper reads these fields.)\n */\nexport interface PgError {\n  code?: string | null;\n  message: string;\n  details?: string | null;\n  hint?: string | null;\n}\n","// ─────────────────────────────────────────────────────────────────────────\n// AUTOGENERATED — DO NOT EDIT BY HAND.\n//\n// Source of truth: `platform.entity_types` (Supabase project brsgrqvjdzwihsvnfqkf).\n// Regenerate:      pnpm gen:entity-types   (in @ai-matrx/associations)\n// Verify drift:    pnpm check:entity-types\n//\n// 1269 active entity tokens. A token here is FK-valid for\n// `platform.associations.source_type` / `target_type` and any other column\n// referencing `platform.entity_types.token`. Add/retire tokens in the DB via a\n// migration, then regenerate and ship a PATCH release — NEVER hand-edit this\n// file (the next generate overwrites it) and NEVER widen a callsite to a raw\n// string to dodge a token that isn't here yet (writes are STRICT against the\n// installed vocabulary; upgrade the package instead).\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Metadata mirrored from one `platform.entity_types` row. */\nexport interface EntityTypeMeta {\n  readonly token: EntityTypeToken;\n  /** Postgres schema the backing table lives in. */\n  readonly schema: string;\n  /** Backing table name. */\n  readonly table: string;\n  /** Human label from the registry. */\n  readonly label: string;\n  readonly baseTier: number;\n  /** A child/detail row (not a standalone first-class entity). */\n  readonly isComponent: boolean;\n  readonly isModule: boolean;\n  readonly isListed: boolean;\n  /** Whether the registry marks this type scopeable by default. */\n  readonly scopeable: boolean;\n  readonly category: string | null;\n  /** Offered as an allowed type for reference context items. */\n  readonly referencePickable: boolean;\n  /** Human title column for generic candidate pickers (null = not generically listable). */\n  readonly titleColumn: string | null;\n  /** Knowledge-model bucket: utility | source | destination | hybrid | container. */\n  readonly contentRole: string | null;\n  /** Admin-assigned chooser bucket (platform.reference_categories.slug); null = bucket by schema. */\n  readonly referenceCategory: string | null;\n}\n\n/**\n * EVERY registered entity token (the FK-valid set). Use this for any\n * `source_type` / `target_type` argument so an invalid token is a COMPILE error.\n */\nexport type EntityTypeToken =\n  | \"access_delta_probe\"\n  | \"access_delta_run\"\n  | \"access_request\"\n  | \"access_shadow_log\"\n  | \"access_version\"\n  | \"access_version_event\"\n  | \"account_addon\"\n  | \"account_closure\"\n  | \"account_facts\"\n  | \"acquisition_block\"\n  | \"activity\"\n  | \"admin_audit_log\"\n  | \"admin_email_log\"\n  | \"admin_markdown_sample\"\n  | \"admin_user\"\n  | \"admin_user_owned_resources_cache\"\n  | \"admission_config\"\n  | \"agent\"\n  | \"agent_card\"\n  | \"agent_definition_version\"\n  | \"agent_drift_alert\"\n  | \"agent_exemplar\"\n  | \"agent_mandate_note\"\n  | \"agent_prompt_block\"\n  | \"agent_prompt_block_variant\"\n  | \"agent_prompt_remediation\"\n  | \"agent_required_flag_change\"\n  | \"agent_run\"\n  | \"agent_run_stage\"\n  | \"agent_schedule\"\n  | \"agent_schedule_claim\"\n  | \"agent_shortcut\"\n  | \"agent_surface_binding\"\n  | \"agent_template\"\n  | \"agent_term_list\"\n  | \"agent_test_result\"\n  | \"agent_test_run\"\n  | \"agent_usage\"\n  | \"ai_api\"\n  | \"ai_calls\"\n  | \"ai_device_model_file\"\n  | \"ai_device_model_root\"\n  | \"ai_endpoint\"\n  | \"ai_media_generation_cache\"\n  | \"ai_model\"\n  | \"ai_model_alias\"\n  | \"ai_model_artifact\"\n  | \"ai_model_candidate\"\n  | \"ai_model_presentation\"\n  | \"ai_model_upstream\"\n  | \"ai_model_variant\"\n  | \"ai_model_verification_run\"\n  | \"ai_model_want\"\n  | \"ai_offering\"\n  | \"ai_person_model_want\"\n  | \"ai_provider\"\n  | \"ai_request_latency\"\n  | \"ai_runtime\"\n  | \"ai_runtime_build\"\n  | \"ai_runtime_compat\"\n  | \"ai_setting\"\n  | \"ai_setting_profile\"\n  | \"ai_translation_cell\"\n  | \"ai_usage_execution_facts\"\n  | \"ai_usage_executions\"\n  | \"ai_usage_hourly\"\n  | \"ai_usage_hourly_watermark\"\n  | \"analysis_result\"\n  | \"anon_form\"\n  | \"anon_form_password\"\n  | \"anon_form_visit\"\n  | \"anon_function_birth_grandfather\"\n  | \"anon_hit\"\n  | \"anon_inbound\"\n  | \"anon_replay\"\n  | \"anon_submission\"\n  | \"anon_token\"\n  | \"api_field_warning\"\n  | \"api_request_log\"\n  | \"app\"\n  | \"app_config\"\n  | \"app_config_history\"\n  | \"app_definition_version\"\n  | \"app_error\"\n  | \"app_execution\"\n  | \"app_instance\"\n  | \"app_log\"\n  | \"app_log_hourly\"\n  | \"app_log_hourly_watermark\"\n  | \"app_log_lines\"\n  | \"app_log_muted_pattern\"\n  | \"app_log_norm_exception\"\n  | \"app_log_requests_hourly\"\n  | \"app_rate_limit\"\n  | \"app_setting\"\n  | \"app_sync_status\"\n  | \"applet_visitor_binding\"\n  | \"approach\"\n  | \"artifact\"\n  | \"assessment\"\n  | \"assessment_item\"\n  | \"assessment_result\"\n  | \"assignment_session\"\n  | \"assist\"\n  | \"assist_producer_policy\"\n  | \"assist_producer_policy_history\"\n  | \"association_type\"\n  | \"assurance_level\"\n  | \"attempt\"\n  | \"attention_audience_rule\"\n  | \"attention_audit\"\n  | \"attention_item_state\"\n  | \"attention_showing\"\n  | \"audit_broken_functions\"\n  | \"audit_canonical_findings\"\n  | \"audit_exemption\"\n  | \"audit_function_deps\"\n  | \"audit_function_runtime_probe\"\n  | \"audit_m2m_candidates\"\n  | \"audit_refresh_log\"\n  | \"audit_stale_registry\"\n  | \"audit_unregistered_candidates\"\n  | \"automation_delivery\"\n  | \"automation_fired\"\n  | \"base_entity_template\"\n  | \"batch_cost_event\"\n  | \"batch_provider_batch\"\n  | \"batch_work_item\"\n  | \"billing_capability\"\n  | \"billing_capability_limit\"\n  | \"billing_ci_package_build\"\n  | \"billing_connect_account\"\n  | \"billing_coupon\"\n  | \"billing_coupon_redemption\"\n  | \"billing_customer\"\n  | \"billing_external_call_vendor\"\n  | \"billing_free_network_counter\"\n  | \"billing_free_period_grant\"\n  | \"billing_free_use_counter\"\n  | \"billing_hard_cost_reconciliation\"\n  | \"billing_held_run\"\n  | \"billing_org_payment_account\"\n  | \"billing_payment\"\n  | \"billing_payment_ask\"\n  | \"billing_plan\"\n  | \"billing_plan_limit\"\n  | \"billing_price\"\n  | \"billing_product\"\n  | \"billing_provider_balance_snapshot\"\n  | \"billing_spend_alarm\"\n  | \"billing_spend_alarm_occurrence\"\n  | \"billing_spend_approval\"\n  | \"billing_spend_guardrail\"\n  | \"billing_spend_hold\"\n  | \"billing_stripe_event\"\n  | \"billing_subscription\"\n  | \"billing_usage_ledger\"\n  | \"billing_usage_reset\"\n  | \"billing_user_plan\"\n  | \"block_state\"\n  | \"board\"\n  | \"browser_account_binding\"\n  | \"browser_action_event\"\n  | \"browser_authenticator_window\"\n  | \"browser_capture\"\n  | \"browser_control_request\"\n  | \"browser_handoff\"\n  | \"browser_login_attempt\"\n  | \"browser_login_recipe\"\n  | \"browser_profile\"\n  | \"browser_profile_checkpoint\"\n  | \"browser_run\"\n  | \"browser_site_observation\"\n  | \"browser_site_policy\"\n  | \"browser_stream_ticket\"\n  | \"build_lock\"\n  | \"calendar_event\"\n  | \"campaign_watch_ramp_gate_run\"\n  | \"campaign_watch_switch_outbox\"\n  | \"campaign_watch_switch_window\"\n  | \"canvas_comment\"\n  | \"canvas_comment_like\"\n  | \"canvas_item\"\n  | \"canvas_item_state\"\n  | \"canvas_like\"\n  | \"canvas_score\"\n  | \"canvas_view\"\n  | \"capture_window\"\n  | \"carrying_rule\"\n  | \"catalog_entries_history\"\n  | \"catalog_entry\"\n  | \"category\"\n  | \"change_item\"\n  | \"change_job\"\n  | \"change_job_row\"\n  | \"change_plan\"\n  | \"change_type_default\"\n  | \"change_work\"\n  | \"chat_user_usage_summary\"\n  | \"citations\"\n  | \"class_purchase\"\n  | \"classifier_revision_ledger\"\n  | \"client_callable_door\"\n  | \"client_callable_door_retirement\"\n  | \"client_excluded_column_unregistered\"\n  | \"cmp_entry\"\n  | \"cmp_feedback\"\n  | \"code_file\"\n  | \"code_folder\"\n  | \"code_repository\"\n  | \"coding_session\"\n  | \"coding_session_entry\"\n  | \"collab_checkpoint\"\n  | \"collab_op\"\n  | \"collab_room\"\n  | \"comment\"\n  | \"commerce_asset_allocation\"\n  | \"commerce_asset_grading\"\n  | \"commerce_asset_identifier\"\n  | \"commerce_asset_lot_event\"\n  | \"commerce_asset_mandate_result\"\n  | \"commerce_asset_price_factor\"\n  | \"commerce_asset_reshoot_request\"\n  | \"commerce_asset_review\"\n  | \"commerce_asset_unknown\"\n  | \"commerce_certified_printer\"\n  | \"commerce_cloud_sync_connection\"\n  | \"commerce_ebay_business_policy\"\n  | \"commerce_ebay_category\"\n  | \"commerce_ebay_category_aspect\"\n  | \"commerce_ebay_category_tree\"\n  | \"commerce_ebay_custom_policy\"\n  | \"commerce_ebay_inventory_item\"\n  | \"commerce_ebay_inventory_item_group\"\n  | \"commerce_ebay_inventory_item_group_member\"\n  | \"commerce_ebay_inventory_location\"\n  | \"commerce_ebay_listing\"\n  | \"commerce_ebay_marketplace_policy\"\n  | \"commerce_ebay_media_asset\"\n  | \"commerce_ebay_notification_destination\"\n  | \"commerce_ebay_notification_event\"\n  | \"commerce_ebay_notification_subscription\"\n  | \"commerce_ebay_notification_topic\"\n  | \"commerce_ebay_offer\"\n  | \"commerce_ebay_order\"\n  | \"commerce_ebay_order_line_item\"\n  | \"commerce_ebay_shipping_fulfillment\"\n  | \"commerce_ebay_store_category\"\n  | \"commerce_human_correction\"\n  | \"commerce_intake_artifact\"\n  | \"commerce_intake_asset\"\n  | \"commerce_intake_batch\"\n  | \"commerce_label_batch\"\n  | \"commerce_label_code\"\n  | \"commerce_marketplace_account\"\n  | \"commerce_marketplace_account_deletion_audit\"\n  | \"commerce_marketplace_api_call\"\n  | \"commerce_marketplace_rate_budget\"\n  | \"commerce_marketplace_site\"\n  | \"commerce_marketplace_sync_run\"\n  | \"commerce_prediction_outcome\"\n  | \"commerce_print_order\"\n  | \"commerce_product\"\n  | \"commerce_product_channel_ref\"\n  | \"commerce_product_media\"\n  | \"commerce_product_variant\"\n  | \"commerce_recall_audit\"\n  | \"communication_calendar_selected_snapshot_state\"\n  | \"communication_channel_readiness\"\n  | \"comparison_set\"\n  | \"computed_org_mark\"\n  | \"computed_reader_cols\"\n  | \"computed_reader_judgement\"\n  | \"config_manifest\"\n  | \"config_read_bucket\"\n  | \"contact_medium\"\n  | \"contact_submission\"\n  | \"content_certification\"\n  | \"content_ir_converter_definition\"\n  | \"content_ir_converter_run\"\n  | \"content_ir_kind\"\n  | \"content_ir_kind_component\"\n  | \"content_ir_kind_component_incident\"\n  | \"content_ir_kind_component_layer\"\n  | \"content_ir_kind_conformance\"\n  | \"content_ir_kind_edge\"\n  | \"content_ir_kind_example\"\n  | \"content_ir_kind_instance\"\n  | \"content_ir_kind_surface\"\n  | \"content_ir_render_inspection\"\n  | \"content_lane\"\n  | \"context_access_log\"\n  | \"context_item\"\n  | \"context_item_suggestion\"\n  | \"conversation\"\n  | \"conversation_value\"\n  | \"courts\"\n  | \"credential_attachment\"\n  | \"credential_item\"\n  | \"credential_mutation_receipt\"\n  | \"crm_address\"\n  | \"crm_affiliation\"\n  | \"crm_blocklist_entry\"\n  | \"crm_contact_candidate\"\n  | \"crm_deal\"\n  | \"crm_deal_stage_event\"\n  | \"crm_enrichment_call\"\n  | \"crm_interaction\"\n  | \"crm_merge_candidate\"\n  | \"crm_outreach_list\"\n  | \"crm_outreach_list_member\"\n  | \"crm_party_merge\"\n  | \"crm_party_research\"\n  | \"crm_registry_ingest_run\"\n  | \"crm_registry_source\"\n  | \"crm_sending_claim\"\n  | \"crm_sending_event\"\n  | \"crm_sending_identity\"\n  | \"crm_sending_identity_check\"\n  | \"crm_sending_policy\"\n  | \"custom_agent_table_origin\"\n  | \"custom_agent_table_trust\"\n  | \"custom_agg_digest_checked\"\n  | \"custom_anon_form_draft\"\n  | \"custom_base\"\n  | \"custom_base_snapshot\"\n  | \"custom_field_definition\"\n  | \"custom_field_target\"\n  | \"custom_inbox_item_state\"\n  | \"custom_io_outbox_consumer\"\n  | \"custom_io_outbox_consumption\"\n  | \"custom_portal\"\n  | \"custom_portal_principal\"\n  | \"custom_portal_table\"\n  | \"custom_share_tails_mine_repair\"\n  | \"custom_synced_source\"\n  | \"custom_template\"\n  | \"custom_template_install\"\n  | \"custom_whole_value_parked\"\n  | \"cx_agent_memory\"\n  | \"cx_agent_plan\"\n  | \"cx_agent_task\"\n  | \"cx_code_edit\"\n  | \"cx_code_message_file\"\n  | \"cx_media\"\n  | \"cx_observational_memory\"\n  | \"cx_observational_memory_event\"\n  | \"cx_pending_injection\"\n  | \"cx_request\"\n  | \"cx_request_snapshot\"\n  | \"cx_request_values\"\n  | \"cx_tool_trace\"\n  | \"cx_user_request\"\n  | \"cx_user_todo\"\n  | \"data_rights_event\"\n  | \"data_store\"\n  | \"data_store_members\"\n  | \"ddl_guard_log\"\n  | \"deck_suggestion\"\n  | \"definer_class_exemption\"\n  | \"definer_client_grant_grandfather\"\n  | \"definer_grant_baseline\"\n  | \"deprecated_relation\"\n  | \"derive_run\"\n  | \"desktop_app_account\"\n  | \"desktop_app_instance\"\n  | \"desktop_app_profile\"\n  | \"dev_login_audit\"\n  | \"device_handoff\"\n  | \"dict_entry\"\n  | \"dict_provider_publication\"\n  | \"dict_setting\"\n  | \"dm_conversation\"\n  | \"dm_message\"\n  | \"dm_participant\"\n  | \"dm_session_member\"\n  | \"doc_render\"\n  | \"doc_signature\"\n  | \"dockets\"\n  | \"document\"\n  | \"document_version\"\n  | \"domain_classification\"\n  | \"edge_payload_kind\"\n  | \"egress_device\"\n  | \"egress_pairing\"\n  | \"egress_ticket\"\n  | \"emails\"\n  | \"embedding_cache\"\n  | \"embeddings_google_gemini_2_1536\"\n  | \"embeddings_oai_3_small_1536\"\n  | \"embeddings_voyage_4_large_1024\"\n  | \"embeddings_voyage_code_3_1024\"\n  | \"endpoint_family_sweep_state\"\n  | \"engine_owner_task\"\n  | \"entity_grant\"\n  | \"entity_protected_value\"\n  | \"entity_protected_value_version\"\n  | \"entity_relationship\"\n  | \"entity_type\"\n  | \"esign_campaign\"\n  | \"esign_campaign_member\"\n  | \"esign_consent_disclosure\"\n  | \"esign_envelope\"\n  | \"esign_envelope_certificate\"\n  | \"esign_envelope_document\"\n  | \"esign_envelope_draft\"\n  | \"esign_envelope_event\"\n  | \"esign_envelope_external_ref\"\n  | \"esign_envelope_signer\"\n  | \"esign_provider\"\n  | \"esign_provider_binding\"\n  | \"esign_saved_signature\"\n  | \"esign_signing_key\"\n  | \"esign_template\"\n  | \"execution_event_cursor\"\n  | \"extension_auth_code\"\n  | \"external_api_reservation\"\n  | \"external_conversation\"\n  | \"external_delivery_event\"\n  | \"external_inbox\"\n  | \"external_link\"\n  | \"external_message\"\n  | \"external_provider_receipt\"\n  | \"external_source\"\n  | \"extract_sweep_state\"\n  | \"fc_card\"\n  | \"fc_detail\"\n  | \"fc_set\"\n  | \"feature_doc\"\n  | \"feature_knob\"\n  | \"feedback_comments\"\n  | \"feedback_user_messages\"\n  | \"file\"\n  | \"file_analysis\"\n  | \"file_entities\"\n  | \"file_overrides\"\n  | \"file_page_annotations\"\n  | \"file_pages\"\n  | \"file_rag_job\"\n  | \"file_template\"\n  | \"file_version\"\n  | \"files_account_tier\"\n  | \"files_machine_written_prefix\"\n  | \"files_sync_mapping\"\n  | \"files_user_account\"\n  | \"folder\"\n  | \"function_contract\"\n  | \"game_badge\"\n  | \"game_result\"\n  | \"game_room\"\n  | \"global_execution\"\n  | \"global_execution_checkpoint\"\n  | \"global_execution_control\"\n  | \"global_execution_event\"\n  | \"global_meter_entry\"\n  | \"global_origin\"\n  | \"global_request\"\n  | \"google_document\"\n  | \"growth_loop_event\"\n  | \"growth_loop_run\"\n  | \"growth_loop_stage_run\"\n  | \"guardian_link\"\n  | \"guest_conversion_audit\"\n  | \"guest_execution_log\"\n  | \"guest_executions\"\n  | \"guided_checklist_run\"\n  | \"heatmap_save\"\n  | \"hindsight_enrollment\"\n  | \"hindsight_finding\"\n  | \"hindsight_regression_case\"\n  | \"hindsight_replay\"\n  | \"hindsight_replay_step\"\n  | \"hindsight_review\"\n  | \"hr_access_audit\"\n  | \"hr_access_role\"\n  | \"hr_accommodation_request\"\n  | \"hr_ai_evidence\"\n  | \"hr_alert_routing_rule\"\n  | \"hr_application\"\n  | \"hr_approval_authority\"\n  | \"hr_approval_delegation\"\n  | \"hr_asset\"\n  | \"hr_asset_assignment\"\n  | \"hr_attendance_exception\"\n  | \"hr_auto_close_rule\"\n  | \"hr_availability\"\n  | \"hr_background_check\"\n  | \"hr_benefits_event\"\n  | \"hr_calculation_snapshot\"\n  | \"hr_candidate\"\n  | \"hr_candidate_conversion\"\n  | \"hr_candidate_message\"\n  | \"hr_careers_portal\"\n  | \"hr_checklist_item\"\n  | \"hr_checklist_run\"\n  | \"hr_checklist_template\"\n  | \"hr_checklist_template_item\"\n  | \"hr_compensation\"\n  | \"hr_corrective_action\"\n  | \"hr_course\"\n  | \"hr_course_version\"\n  | \"hr_credential\"\n  | \"hr_crew\"\n  | \"hr_deduction_code\"\n  | \"hr_department\"\n  | \"hr_derived_grant\"\n  | \"hr_disposition_event\"\n  | \"hr_earning_code\"\n  | \"hr_eeo_response\"\n  | \"hr_emergency_contact\"\n  | \"hr_employee\"\n  | \"hr_employee_private\"\n  | \"hr_employer_profile\"\n  | \"hr_employment\"\n  | \"hr_employment_pin\"\n  | \"hr_engagement\"\n  | \"hr_establishment\"\n  | \"hr_external_identity\"\n  | \"hr_field_policy\"\n  | \"hr_goal\"\n  | \"hr_holiday\"\n  | \"hr_holiday_calendar\"\n  | \"hr_i9\"\n  | \"hr_i9_document\"\n  | \"hr_incident\"\n  | \"hr_incident_party\"\n  | \"hr_interview\"\n  | \"hr_interview_kit\"\n  | \"hr_job_title\"\n  | \"hr_jurisdiction\"\n  | \"hr_jurisdiction_rule\"\n  | \"hr_jurisdiction_rule_class\"\n  | \"hr_jurisdiction_rule_org_decision\"\n  | \"hr_jurisdiction_rule_test\"\n  | \"hr_kiosk_device\"\n  | \"hr_kiosk_session\"\n  | \"hr_labor_target\"\n  | \"hr_leave_case\"\n  | \"hr_leave_enrollment\"\n  | \"hr_leave_ledger\"\n  | \"hr_leave_policy\"\n  | \"hr_leave_request\"\n  | \"hr_legal_hold\"\n  | \"hr_legal_hold_item\"\n  | \"hr_location\"\n  | \"hr_new_hire_report\"\n  | \"hr_offer\"\n  | \"hr_opening\"\n  | \"hr_overtime_alert\"\n  | \"hr_overtime_alert_rule\"\n  | \"hr_overtime_preapproval\"\n  | \"hr_pay_group\"\n  | \"hr_pay_period\"\n  | \"hr_pay_period_employment\"\n  | \"hr_payroll_export\"\n  | \"hr_payroll_export_line\"\n  | \"hr_position_assignment\"\n  | \"hr_posting\"\n  | \"hr_posting_publication\"\n  | \"hr_provider_binding\"\n  | \"hr_provider_event\"\n  | \"hr_provisioning_result\"\n  | \"hr_punch\"\n  | \"hr_recalculation_batch\"\n  | \"hr_record_class\"\n  | \"hr_records_request\"\n  | \"hr_reference_check\"\n  | \"hr_reporting_line\"\n  | \"hr_requisition\"\n  | \"hr_restricted_note\"\n  | \"hr_retention_rule\"\n  | \"hr_review\"\n  | \"hr_review_cycle\"\n  | \"hr_review_peer_nomination\"\n  | \"hr_review_response\"\n  | \"hr_review_template\"\n  | \"hr_role_assignment\"\n  | \"hr_schedule\"\n  | \"hr_schedule_change\"\n  | \"hr_schedule_guidance\"\n  | \"hr_schedule_template\"\n  | \"hr_schedule_template_shift\"\n  | \"hr_scorecard\"\n  | \"hr_separation\"\n  | \"hr_shift\"\n  | \"hr_shift_claim\"\n  | \"hr_staffing_requirement\"\n  | \"hr_survey\"\n  | \"hr_survey_invitation\"\n  | \"hr_survey_question\"\n  | \"hr_survey_response\"\n  | \"hr_tax_registration\"\n  | \"hr_tax_withholding\"\n  | \"hr_time_adjustment\"\n  | \"hr_training_assignment\"\n  | \"hr_training_attempt\"\n  | \"hr_transcript_entry\"\n  | \"hr_verification_letter_request\"\n  | \"hr_work_interval\"\n  | \"hr_workflow_binding\"\n  | \"hr_workflow_decision\"\n  | \"hr_workflow_definition\"\n  | \"hr_workflow_event\"\n  | \"hr_workflow_failure\"\n  | \"hr_workflow_flow_type\"\n  | \"hr_workflow_instance\"\n  | \"hr_workflow_step\"\n  | \"hr_workflow_step_definition\"\n  | \"hr_workweek\"\n  | \"html_extraction\"\n  | \"iam_access_audit\"\n  | \"iam_access_setup\"\n  | \"iam_api_key\"\n  | \"iam_emergency_door_request\"\n  | \"iam_oauth_app\"\n  | \"iam_org_availability_key\"\n  | \"iam_org_domain\"\n  | \"iam_org_domain_route\"\n  | \"iam_publish_binding\"\n  | \"iam_publisher_verification\"\n  | \"iam_read_lane_v2_rollout\"\n  | \"iam_record_seat_change\"\n  | \"iam_sign_in_event\"\n  | \"iam_world_namespace\"\n  | \"iam_world_publish_admission\"\n  | \"idempotency\"\n  | \"industry\"\n  | \"industry_curator\"\n  | \"infra_status\"\n  | \"ingest_runs\"\n  | \"integration_connection\"\n  | \"integration_connection_resource\"\n  | \"interview_decision_interview\"\n  | \"interview_decision_question\"\n  | \"interview_document_revision\"\n  | \"interview_hole\"\n  | \"interview_question\"\n  | \"interview_session\"\n  | \"interview_turn\"\n  | \"invitation\"\n  | \"invitation_code\"\n  | \"invitation_request\"\n  | \"io_comment\"\n  | \"io_contract\"\n  | \"io_import\"\n  | \"io_outbox\"\n  | \"item\"\n  | \"item_mastery\"\n  | \"judge_verdict\"\n  | \"jurisdiction_policy\"\n  | \"keyword_classification_queue\"\n  | \"kg_alert\"\n  | \"kg_chunk_entities\"\n  | \"kg_chunks\"\n  | \"kg_clusters\"\n  | \"kg_edges\"\n  | \"kg_entities\"\n  | \"kg_entity_aliases\"\n  | \"kg_suggestion_ack\"\n  | \"kg_sweep_queue\"\n  | \"kg_sweep_run\"\n  | \"kg_sweep_state\"\n  | \"kg_value_match\"\n  | \"knob_override\"\n  | \"knob_override_audit\"\n  | \"knob_rung_lock\"\n  | \"knob_scope_kind\"\n  | \"knob_write_door\"\n  | \"league_membership\"\n  | \"learn_doc\"\n  | \"library_doc\"\n  | \"lifecycle_archive\"\n  | \"lifecycle_archive_row\"\n  | \"lifecycle_audit\"\n  | \"lifecycle_entity_plan\"\n  | \"lifecycle_map_build\"\n  | \"lifecycle_reference_map\"\n  | \"lifecycle_run\"\n  | \"lifecycle_tier_ledger\"\n  | \"location\"\n  | \"mandate\"\n  | \"mandate_advance_batch_row\"\n  | \"mandate_binding\"\n  | \"mandate_candidate\"\n  | \"mandate_candidate_run\"\n  | \"mandate_candidate_run_payload\"\n  | \"mandate_goal_clauses\"\n  | \"mandate_observation\"\n  | \"mandate_proposal\"\n  | \"mandate_readiness_verdict\"\n  | \"mandate_reference\"\n  | \"mandate_scan\"\n  | \"mandate_treatment\"\n  | \"marketing_initiative\"\n  | \"masterwork_corpus_item\"\n  | \"masterwork_run\"\n  | \"masterwork_run_kind\"\n  | \"masterwork_source\"\n  | \"math_course_structure\"\n  | \"math_problem\"\n  | \"matrx_action_ledger\"\n  | \"mcp_config\"\n  | \"mcp_server\"\n  | \"mcp_user_conn\"\n  | \"media_capture_handoff\"\n  | \"media_catalog_setting\"\n  | \"media_library_item\"\n  | \"media_selection_item\"\n  | \"media_selection_job\"\n  | \"media_source_library\"\n  | \"meet_call_invite\"\n  | \"meet_chat_message\"\n  | \"meet_connection\"\n  | \"meet_invitee\"\n  | \"meet_meeting\"\n  | \"meet_note\"\n  | \"meet_occurrence_override\"\n  | \"meet_participant\"\n  | \"meet_recording\"\n  | \"meet_session\"\n  | \"meet_transcript_segment\"\n  | \"membership\"\n  | \"membership_grant\"\n  | \"memory_trial\"\n  | \"memory_trial_step\"\n  | \"merge_field_provenance\"\n  | \"message\"\n  | \"message_template\"\n  | \"message_template_detail\"\n  | \"meta_excluded_schema\"\n  | \"meta_table_stats_history\"\n  | \"metadata_reserved_keys\"\n  | \"migration_log\"\n  | \"mtx_media_heal_queue\"\n  | \"mtx_public_url_guard\"\n  | \"ner_shadow\"\n  | \"note\"\n  | \"notification\"\n  | \"notification_channel_preference\"\n  | \"notification_event_override\"\n  | \"notification_event_type\"\n  | \"notification_preference\"\n  | \"notification_submission\"\n  | \"notify_outsider_door_baseline\"\n  | \"oauth_handoff_claim\"\n  | \"opinion_clusters\"\n  | \"opinions\"\n  | \"ops_auth_lock_watchdog_log\"\n  | \"ops_check_item\"\n  | \"ops_check_run\"\n  | \"ops_db_host_sample\"\n  | \"ops_issue_class\"\n  | \"ops_issue_event\"\n  | \"ops_perf_client_event\"\n  | \"ops_perf_sample\"\n  | \"ops_perf_statement_snapshot\"\n  | \"ops_proof_check\"\n  | \"ops_proof_run\"\n  | \"ops_proof_scenario\"\n  | \"ops_source_read_cache\"\n  | \"ops_test_replay_cache\"\n  | \"org_admin_audit\"\n  | \"org_change_policy\"\n  | \"org_chart_publication\"\n  | \"org_context_ledger\"\n  | \"org_industries\"\n  | \"org_member_control\"\n  | \"org_module_config\"\n  | \"org_move_txn\"\n  | \"org_plan\"\n  | \"org_sweep_list\"\n  | \"organization\"\n  | \"organization_preferences\"\n  | \"organization_visibility_version\"\n  | \"output_feedback\"\n  | \"outreach_acceptance\"\n  | \"page_extraction_job\"\n  | \"page_extraction_page_run\"\n  | \"page_extraction_results\"\n  | \"page_extraction_runs\"\n  | \"page_intent_queue\"\n  | \"page_mapping_queue\"\n  | \"page_vitals\"\n  | \"part_config\"\n  | \"part_config_sub\"\n  | \"party\"\n  | \"party_contact_point\"\n  | \"passkey_credential\"\n  | \"pc_article\"\n  | \"pc_episode\"\n  | \"pc_show\"\n  | \"pc_studio_run\"\n  | \"pc_studio_run_asset\"\n  | \"pdf_consolidation_log\"\n  | \"pdf_redaction_audit\"\n  | \"pdf_redaction_key_escrow\"\n  | \"permission_grant\"\n  | \"personal_data_column\"\n  | \"plan_cms_fill_item\"\n  | \"plan_cms_fill_job\"\n  | \"plan_entity\"\n  | \"plan_node\"\n  | \"plan_node_artifact\"\n  | \"plan_node_step\"\n  | \"plan_profile\"\n  | \"platform_action_request\"\n  | \"platform_actor_session\"\n  | \"platform_actor_token\"\n  | \"platform_actor_token_event\"\n  | \"platform_class_approval_by_arman\"\n  | \"platform_class_approval_by_org_admin\"\n  | \"platform_continued_access\"\n  | \"platform_cutover_census_run\"\n  | \"platform_cutover_evaluation_replaced\"\n  | \"platform_cutover_evaluation_write\"\n  | \"platform_cutover_seam\"\n  | \"platform_cutover_seam_measure\"\n  | \"platform_cutover_seam_press\"\n  | \"platform_dated_change\"\n  | \"platform_doors_only_pending_cutover\"\n  | \"platform_google_calendar_event_create_intent\"\n  | \"platform_google_task_create_intent\"\n  | \"platform_hidden_item\"\n  | \"platform_kernel_fingerprint_record\"\n  | \"platform_outcome_event\"\n  | \"platform_outsider_consumer\"\n  | \"platform_provision_base_contract_pending\"\n  | \"platform_reachability\"\n  | \"platform_reachability_rebuild_pending\"\n  | \"platform_realtime_topic_prefix\"\n  | \"platform_reference_category\"\n  | \"platform_reference_declaration\"\n  | \"platform_repo\"\n  | \"platform_saved_view\"\n  | \"platform_schema\"\n  | \"platform_secure_delivery\"\n  | \"platform_share_link\"\n  | \"platform_strict_class_probe\"\n  | \"podcast_race\"\n  | \"position\"\n  | \"presentation\"\n  | \"processed_document\"\n  | \"processed_document_page\"\n  | \"product_capture_file\"\n  | \"product_capture_item\"\n  | \"product_capture_payload\"\n  | \"product_capture_product\"\n  | \"product_capture_question\"\n  | \"project\"\n  | \"provider_account\"\n  | \"provider_account_credential\"\n  | \"provision\"\n  | \"provision_generate_target\"\n  | \"provision_grant\"\n  | \"provision_marker\"\n  | \"provision_rule_message\"\n  | \"provision_schema\"\n  | \"provision_shape_debt\"\n  | \"provision_snapshot\"\n  | \"provision_spec\"\n  | \"provision_spec_grandfather\"\n  | \"provision_vocabulary\"\n  | \"public_compat_wrapper\"\n  | \"public_placement_baseline\"\n  | \"public_placement_census\"\n  | \"public_placement_domain\"\n  | \"public_restore_permit\"\n  | \"purpose\"\n  | \"quiz_session\"\n  | \"rag_ingest_run\"\n  | \"rag_library_audit_log\"\n  | \"rate_limit_buckets\"\n  | \"reachability_pending\"\n  | \"read_mask_kept\"\n  | \"recompute_queue\"\n  | \"record\"\n  | \"record_alias\"\n  | \"record_computed\"\n  | \"record_follow\"\n  | \"redaction_mapping\"\n  | \"relationship_rule\"\n  | \"research_analysis\"\n  | \"research_content\"\n  | \"research_context_bundle\"\n  | \"research_document\"\n  | \"research_intent\"\n  | \"research_keyword\"\n  | \"research_media\"\n  | \"research_source\"\n  | \"research_synthesis\"\n  | \"research_tag\"\n  | \"research_template\"\n  | \"research_topic\"\n  | \"retention_policy\"\n  | \"retrieval_audit\"\n  | \"review_queue\"\n  | \"route_manifest_entry\"\n  | \"row_version\"\n  | \"rulebook\"\n  | \"run_approval\"\n  | \"run_approval_event\"\n  | \"runtime_operation_stream\"\n  | \"runtime_operation_stream_batch\"\n  | \"sandbox_instance\"\n  | \"sch_agent_task\"\n  | \"sch_run\"\n  | \"sch_task\"\n  | \"sch_trigger\"\n  | \"scheduler_automation_run_subject\"\n  | \"schema_client_exposure\"\n  | \"schema_migration_ledger\"\n  | \"schema_migration_legacy\"\n  | \"schema_migration_slot_grandfather\"\n  | \"schema_templates\"\n  | \"scope\"\n  | \"scope_association_suggestion\"\n  | \"scope_door_registry\"\n  | \"scope_item_value_suggestion\"\n  | \"scope_suggestion\"\n  | \"scope_type\"\n  | \"scrape_domain\"\n  | \"scrape_domain_settings\"\n  | \"scrape_failure_log\"\n  | \"scrape_parsed_page\"\n  | \"scrape_path_override\"\n  | \"scrape_path_pattern\"\n  | \"scrape_retry_queue\"\n  | \"scraper_comparison_run\"\n  | \"scraper_data_fetch_job\"\n  | \"scraper_data_fetch_job_row\"\n  | \"scraper_data_source\"\n  | \"search_item\"\n  | \"seo_ai_capability\"\n  | \"seo_ai_visibility_brand_check\"\n  | \"seo_ai_visibility_citation\"\n  | \"seo_ai_visibility_claim\"\n  | \"seo_ai_visibility_design_artifact\"\n  | \"seo_ai_visibility_panel\"\n  | \"seo_ai_visibility_panel_version\"\n  | \"seo_ai_visibility_response\"\n  | \"seo_ai_visibility_signal\"\n  | \"seo_backlink\"\n  | \"seo_backlink_change_event\"\n  | \"seo_backlink_dimension_snapshot\"\n  | \"seo_backlink_observation\"\n  | \"seo_backlink_snapshot\"\n  | \"seo_change_assessment\"\n  | \"seo_change_event\"\n  | \"seo_change_item\"\n  | \"seo_change_metric\"\n  | \"seo_change_set\"\n  | \"seo_change_theory\"\n  | \"seo_collection_run\"\n  | \"seo_competitor\"\n  | \"seo_competitor_observation\"\n  | \"seo_competitor_opportunity\"\n  | \"seo_coverage_mention\"\n  | \"seo_coverage_tracker\"\n  | \"seo_dimension_value_matcher\"\n  | \"seo_engine_schedule\"\n  | \"seo_geo_place\"\n  | \"seo_gsc_dig_rule\"\n  | \"seo_keyword\"\n  | \"seo_keyword_class_rule\"\n  | \"seo_keyword_edge\"\n  | \"seo_keyword_facet\"\n  | \"seo_keyword_market\"\n  | \"seo_keyword_market_observation\"\n  | \"seo_keyword_place\"\n  | \"seo_keyword_saved_view\"\n  | \"seo_keyword_topic\"\n  | \"seo_landscape_brief\"\n  | \"seo_link_gap_domain\"\n  | \"seo_link_gap_match\"\n  | \"seo_map_facet\"\n  | \"seo_map_facet_value\"\n  | \"seo_map_topic\"\n  | \"seo_page_measurement_health\"\n  | \"seo_page_performance\"\n  | \"seo_pr_moment\"\n  | \"seo_provider_call\"\n  | \"seo_provider_task\"\n  | \"seo_rank_observation\"\n  | \"seo_rank_target\"\n  | \"seo_raw_payload\"\n  | \"seo_referring_domain_profile\"\n  | \"seo_reputation_case\"\n  | \"seo_search_performance_daily\"\n  | \"seo_serp_mention\"\n  | \"seo_serp_opportunity\"\n  | \"seo_serp_result\"\n  | \"seo_serp_snapshot\"\n  | \"seo_site_geo_area\"\n  | \"seo_site_keyword_offering\"\n  | \"seo_site_keyword_value\"\n  | \"seo_site_offering_value\"\n  | \"seo_site_topic_value\"\n  | \"seo_site_value_combo\"\n  | \"seo_site_value_worth\"\n  | \"seo_site_vocabulary\"\n  | \"seo_source_request\"\n  | \"seo_starter_pack\"\n  | \"seo_starter_pack_item\"\n  | \"seo_story_angle\"\n  | \"seo_topic\"\n  | \"seo_topical_map\"\n  | \"seo_tracker_story\"\n  | \"seo_web_analytics_daily\"\n  | \"share_link_password\"\n  | \"shareable_resource_registry\"\n  | \"shared_canvas_item\"\n  | \"short_link\"\n  | \"sign_in_fk_legacy\"\n  | \"skill\"\n  | \"skill_detail\"\n  | \"sms_consent\"\n  | \"sms_conversation\"\n  | \"sms_message\"\n  | \"sms_message_media\"\n  | \"sms_notification\"\n  | \"sms_notification_preference\"\n  | \"sms_phone_number\"\n  | \"sms_rate_limits\"\n  | \"sms_webhook_logs\"\n  | \"social_account_insight_daily\"\n  | \"social_ad\"\n  | \"social_captured_post\"\n  | \"social_kpi_goal\"\n  | \"social_own_post_metric\"\n  | \"social_post\"\n  | \"social_post_analysis\"\n  | \"social_post_comment\"\n  | \"social_post_metric_snapshot\"\n  | \"social_post_stat\"\n  | \"social_post_transcript\"\n  | \"social_profile\"\n  | \"social_profile_snapshot\"\n  | \"social_remix_output\"\n  | \"social_swipe_collection\"\n  | \"social_tracked_account\"\n  | \"social_video_composition_version\"\n  | \"social_video_project\"\n  | \"social_video_variant\"\n  | \"social_watchlist_hit\"\n  | \"soft_delete_cascade_job\"\n  | \"soft_delete_edge\"\n  | \"source_authority\"\n  | \"space_payload\"\n  | \"stage_ref_kind\"\n  | \"stamped_write_table\"\n  | \"structure\"\n  | \"studio_cleaned_segments\"\n  | \"studio_concept_items\"\n  | \"studio_documents\"\n  | \"studio_module_segments\"\n  | \"studio_raw_segments\"\n  | \"studio_recording_chunks\"\n  | \"studio_recording_segments\"\n  | \"studio_run\"\n  | \"studio_session\"\n  | \"studio_session_settings\"\n  | \"study_attempt\"\n  | \"study_goal\"\n  | \"study_media\"\n  | \"study_plan\"\n  | \"study_plan_block\"\n  | \"study_plan_day\"\n  | \"study_reminder_context\"\n  | \"study_reminder_delivery\"\n  | \"study_session\"\n  | \"study_source_chunk\"\n  | \"study_streak\"\n  | \"study_structured_section\"\n  | \"superseded_policy\"\n  | \"support_session\"\n  | \"support_session_event\"\n  | \"surface\"\n  | \"system_announcement\"\n  | \"system_context_item\"\n  | \"system_context_item_org_value\"\n  | \"system_error\"\n  | \"system_orgs\"\n  | \"system_write_failure\"\n  | \"t13_backfill_ledger\"\n  | \"t13_default_ledger\"\n  | \"t13_row_column_events\"\n  | \"tag\"\n  | \"task\"\n  | \"task_user_state\"\n  | \"taxonomy_node\"\n  | \"team\"\n  | \"template_context_items\"\n  | \"template_scope_types\"\n  | \"templates\"\n  | \"test_handset_inbox\"\n  | \"test_handset_verification\"\n  | \"thread\"\n  | \"tool\"\n  | \"tool_battle\"\n  | \"tool_battle_cell\"\n  | \"tool_binding\"\n  | \"tool_bundle\"\n  | \"tool_call\"\n  | \"tool_call_facts\"\n  | \"tool_canary_run\"\n  | \"tool_catalog_cache\"\n  | \"tool_catalog_call\"\n  | \"tool_catalog_call_attempt\"\n  | \"tool_catalog_call_detail\"\n  | \"tool_catalog_endpoint\"\n  | \"tool_catalog_entry\"\n  | \"tool_catalog_provider\"\n  | \"tool_definition_version\"\n  | \"tool_executor\"\n  | \"tool_feature_scorecard\"\n  | \"tool_surface_defaults\"\n  | \"tool_test_sample\"\n  | \"tool_ui\"\n  | \"tool_ui_incident\"\n  | \"tool_ui_version\"\n  | \"topic_placement_queue\"\n  | \"transcript\"\n  | \"trigger_event\"\n  | \"udt_document\"\n  | \"udt_document_snapshot\"\n  | \"udt_workbook_snapshot\"\n  | \"ui_client\"\n  | \"ui_decision_pick\"\n  | \"ui_surface_action\"\n  | \"ui_surface_agent_pref\"\n  | \"ui_surface_agent_role\"\n  | \"ui_surface_client_tool\"\n  | \"ui_surface_config\"\n  | \"ui_surface_item_type\"\n  | \"ui_surface_value\"\n  | \"ui_surface_write_target\"\n  | \"univer_payload\"\n  | \"unsubscribe_token\"\n  | \"uploads_inflight\"\n  | \"user\"\n  | \"user_achievement\"\n  | \"user_acquisition_facts\"\n  | \"user_acquisition_facts_stored\"\n  | \"user_acquisition_facts_stored_watermark\"\n  | \"user_active_context\"\n  | \"user_analysis_preference\"\n  | \"user_email_preference\"\n  | \"user_entity_state\"\n  | \"user_feedback\"\n  | \"user_follows\"\n  | \"user_form_profile\"\n  | \"user_markdown_sample\"\n  | \"user_memory\"\n  | \"user_preference\"\n  | \"user_profile\"\n  | \"user_secret\"\n  | \"user_secret_audit\"\n  | \"user_secret_grant\"\n  | \"user_stat\"\n  | \"user_storage_usage\"\n  | \"user_surface_state\"\n  | \"users_calendar_feed\"\n  | \"vault_fill_approvals\"\n  | \"vault_fill_devices\"\n  | \"vault_fill_nonces\"\n  | \"visibility_cache\"\n  | \"visibility_epoch\"\n  | \"voice\"\n  | \"war_room\"\n  | \"wbx_demo\"\n  | \"wbx_guidance\"\n  | \"wbx_highlight\"\n  | \"wbx_pattern\"\n  | \"wbx_recipe\"\n  | \"wbx_screenshot\"\n  | \"wbx_seo_audit\"\n  | \"wc_claim\"\n  | \"wc_impairment_definition\"\n  | \"wc_injury\"\n  | \"wc_report\"\n  | \"web_analysis_item\"\n  | \"web_brand\"\n  | \"web_brand_asset\"\n  | \"web_brand_choice\"\n  | \"web_brand_exclusion\"\n  | \"web_brand_offering\"\n  | \"web_brand_persona\"\n  | \"web_brand_relation_kind\"\n  | \"web_brand_review\"\n  | \"web_brand_testimony\"\n  | \"web_business_fact\"\n  | \"web_business_location\"\n  | \"web_channel_analytics_daily\"\n  | \"web_crawl_event\"\n  | \"web_crawl_preset\"\n  | \"web_crawl_schedule\"\n  | \"web_crawl_session\"\n  | \"web_crawl_url\"\n  | \"web_discovered_item\"\n  | \"web_domain_category\"\n  | \"web_domain_category_observation\"\n  | \"web_finding\"\n  | \"web_gsc_page_stat\"\n  | \"web_link_edge\"\n  | \"web_listing_publisher\"\n  | \"web_location_listing\"\n  | \"web_news_item\"\n  | \"web_offering_template\"\n  | \"web_page\"\n  | \"web_page_content\"\n  | \"web_page_evidence\"\n  | \"web_page_sitemap\"\n  | \"web_property\"\n  | \"web_provider\"\n  | \"web_result\"\n  | \"web_screenshot\"\n  | \"web_search_review\"\n  | \"web_site\"\n  | \"web_site_endpoint_rule\"\n  | \"web_site_item_config\"\n  | \"web_site_offering\"\n  | \"web_sitemap\"\n  | \"web_snapshot\"\n  | \"web_tag_manager_snapshot\"\n  | \"web_temp_brand_firmographic\"\n  | \"web_temp_brand_presence\"\n  | \"web_temp_brand_recognition\"\n  | \"web_voice_fingerprint\"\n  | \"web_youtube_video\"\n  | \"webhook_deliveries\"\n  | \"webhook_dispatch_state\"\n  | \"webhook_test_receipt\"\n  | \"webhooks\"\n  | \"wf_node_data_slot\"\n  | \"work_claim\"\n  | \"work_item\"\n  | \"workbook\"\n  | \"worker_heartbeat\"\n  | \"workflow\"\n  | \"workflow_card\"\n  | \"workflow_checkpoint\"\n  | \"workflow_checkpoint_value\"\n  | \"workflow_comparison\"\n  | \"workflow_definition_overview\"\n  | \"workflow_definition_version\"\n  | \"workflow_idempotency\"\n  | \"workflow_job\"\n  | \"workflow_node_events\"\n  | \"workflow_node_outcome\"\n  | \"workflow_plan\"\n  | \"workflow_plan_event\"\n  | \"workflow_plan_sample\"\n  | \"workflow_recovery_audit\"\n  | \"workflow_review_issue\"\n  | \"workflow_run\"\n  | \"workflow_run_cost\"\n  | \"workflow_run_facts\"\n  | \"workflow_run_log\"\n  | \"workflow_runtime_surface\"\n  | \"workflow_step_facts\"\n  | \"workflow_step_result\"\n  | \"workflow_template\"\n  | \"workflow_trigger\"\n  | \"workflow_trigger_fire\"\n  | \"workflow_work_item\"\n  | \"write_guard_key\"\n  | \"youtube_quota_day\"\n  | \"youtube_search\"\n  | \"youtube_video\";\n\n/** Tokens flagged `reference_pickable` — offered in reference \"Allowed types\" choosers. */\nexport type ReferencePickableEntityToken =\n  | \"agent\"\n  | \"agent_prompt_block\"\n  | \"agent_shortcut\"\n  | \"agent_surface_binding\"\n  | \"agent_template\"\n  | \"ai_api\"\n  | \"ai_endpoint\"\n  | \"ai_model\"\n  | \"ai_provider\"\n  | \"ai_setting\"\n  | \"anon_form\"\n  | \"app\"\n  | \"assessment\"\n  | \"canvas_comment\"\n  | \"canvas_item\"\n  | \"canvas_score\"\n  | \"category\"\n  | \"code_file\"\n  | \"code_folder\"\n  | \"code_repository\"\n  | \"comparison_set\"\n  | \"contact_submission\"\n  | \"content_ir_kind\"\n  | \"content_ir_kind_instance\"\n  | \"context_item\"\n  | \"conversation\"\n  | \"crm_deal\"\n  | \"crm_outreach_list\"\n  | \"cx_agent_memory\"\n  | \"data_store\"\n  | \"document\"\n  | \"fc_card\"\n  | \"fc_set\"\n  | \"feature_doc\"\n  | \"file\"\n  | \"folder\"\n  | \"game_result\"\n  | \"heatmap_save\"\n  | \"hr_asset\"\n  | \"hr_candidate\"\n  | \"hr_careers_portal\"\n  | \"hr_checklist_template\"\n  | \"hr_course\"\n  | \"hr_crew\"\n  | \"hr_deduction_code\"\n  | \"hr_department\"\n  | \"hr_earning_code\"\n  | \"hr_employee\"\n  | \"hr_holiday_calendar\"\n  | \"hr_interview_kit\"\n  | \"hr_job_title\"\n  | \"hr_jurisdiction\"\n  | \"hr_jurisdiction_rule_class\"\n  | \"hr_leave_policy\"\n  | \"hr_location\"\n  | \"hr_pay_group\"\n  | \"hr_posting\"\n  | \"hr_record_class\"\n  | \"hr_requisition\"\n  | \"hr_schedule\"\n  | \"hr_schedule_template\"\n  | \"hr_survey\"\n  | \"league_membership\"\n  | \"learn_doc\"\n  | \"mandate\"\n  | \"marketing_initiative\"\n  | \"meet_meeting\"\n  | \"message_template\"\n  | \"note\"\n  | \"organization\"\n  | \"page_extraction_job\"\n  | \"party\"\n  | \"pc_article\"\n  | \"pc_episode\"\n  | \"pc_show\"\n  | \"pc_studio_run\"\n  | \"processed_document\"\n  | \"project\"\n  | \"quiz_session\"\n  | \"research_template\"\n  | \"research_topic\"\n  | \"rulebook\"\n  | \"sch_task\"\n  | \"scope\"\n  | \"scope_type\"\n  | \"seo_topic\"\n  | \"shared_canvas_item\"\n  | \"skill\"\n  | \"studio_session\"\n  | \"study_goal\"\n  | \"study_media\"\n  | \"study_plan\"\n  | \"study_plan_block\"\n  | \"surface\"\n  | \"task\"\n  | \"thread\"\n  | \"tool\"\n  | \"tool_bundle\"\n  | \"transcript\"\n  | \"udt_document\"\n  | \"user_markdown_sample\"\n  | \"user_profile\"\n  | \"voice\"\n  | \"war_room\"\n  | \"wbx_pattern\"\n  | \"web_analysis_item\"\n  | \"web_brand\"\n  | \"web_provider\"\n  | \"web_site\"\n  | \"workbook\"\n  | \"workflow\"\n  | \"workflow_plan\"\n  | \"workflow_template\"\n  | \"workflow_trigger\";\n\n/** Tokens flagged `is_component` — child/detail rows, not standalone entities. */\nexport type ComponentEntityToken =\n  | \"agent_card\"\n  | \"agent_definition_version\"\n  | \"agent_drift_alert\"\n  | \"agent_prompt_block_variant\"\n  | \"agent_run_stage\"\n  | \"agent_test_result\"\n  | \"agent_usage\"\n  | \"ai_model_artifact\"\n  | \"ai_model_presentation\"\n  | \"ai_model_upstream\"\n  | \"ai_model_variant\"\n  | \"analysis_result\"\n  | \"app_definition_version\"\n  | \"app_error\"\n  | \"app_execution\"\n  | \"app_rate_limit\"\n  | \"artifact\"\n  | \"assessment_item\"\n  | \"attempt\"\n  | \"billing_spend_alarm_occurrence\"\n  | \"browser_account_binding\"\n  | \"browser_action_event\"\n  | \"browser_capture\"\n  | \"browser_control_request\"\n  | \"browser_handoff\"\n  | \"browser_login_attempt\"\n  | \"browser_run\"\n  | \"browser_site_observation\"\n  | \"canvas_item_state\"\n  | \"cmp_entry\"\n  | \"coding_session_entry\"\n  | \"collab_checkpoint\"\n  | \"collab_op\"\n  | \"collab_room\"\n  | \"commerce_asset_allocation\"\n  | \"commerce_asset_grading\"\n  | \"commerce_asset_identifier\"\n  | \"commerce_asset_lot_event\"\n  | \"commerce_asset_mandate_result\"\n  | \"commerce_asset_price_factor\"\n  | \"commerce_asset_reshoot_request\"\n  | \"commerce_asset_review\"\n  | \"commerce_asset_unknown\"\n  | \"commerce_ebay_business_policy\"\n  | \"commerce_ebay_custom_policy\"\n  | \"commerce_ebay_inventory_item\"\n  | \"commerce_ebay_inventory_item_group\"\n  | \"commerce_ebay_inventory_item_group_member\"\n  | \"commerce_ebay_inventory_location\"\n  | \"commerce_ebay_listing\"\n  | \"commerce_ebay_media_asset\"\n  | \"commerce_ebay_notification_subscription\"\n  | \"commerce_ebay_offer\"\n  | \"commerce_ebay_order\"\n  | \"commerce_ebay_order_line_item\"\n  | \"commerce_ebay_shipping_fulfillment\"\n  | \"commerce_ebay_store_category\"\n  | \"commerce_human_correction\"\n  | \"commerce_intake_artifact\"\n  | \"commerce_intake_asset\"\n  | \"commerce_label_code\"\n  | \"commerce_marketplace_site\"\n  | \"commerce_marketplace_sync_run\"\n  | \"commerce_prediction_outcome\"\n  | \"commerce_product_channel_ref\"\n  | \"commerce_product_media\"\n  | \"commerce_product_variant\"\n  | \"commerce_recall_audit\"\n  | \"content_ir_kind_component\"\n  | \"content_ir_kind_component_incident\"\n  | \"content_ir_kind_conformance\"\n  | \"content_ir_kind_edge\"\n  | \"content_ir_kind_example\"\n  | \"content_ir_kind_surface\"\n  | \"conversation_value\"\n  | \"credential_attachment\"\n  | \"crm_address\"\n  | \"crm_affiliation\"\n  | \"crm_contact_candidate\"\n  | \"crm_deal_stage_event\"\n  | \"crm_interaction\"\n  | \"crm_merge_candidate\"\n  | \"crm_outreach_list_member\"\n  | \"crm_party_merge\"\n  | \"crm_sending_event\"\n  | \"crm_sending_identity_check\"\n  | \"cx_agent_plan\"\n  | \"cx_agent_task\"\n  | \"cx_code_edit\"\n  | \"cx_code_message_file\"\n  | \"cx_media\"\n  | \"cx_observational_memory\"\n  | \"cx_observational_memory_event\"\n  | \"cx_pending_injection\"\n  | \"cx_request\"\n  | \"cx_request_snapshot\"\n  | \"cx_request_values\"\n  | \"cx_tool_trace\"\n  | \"cx_user_request\"\n  | \"cx_user_todo\"\n  | \"data_store_members\"\n  | \"dm_message\"\n  | \"dm_participant\"\n  | \"dm_session_member\"\n  | \"document_version\"\n  | \"embeddings_google_gemini_2_1536\"\n  | \"embeddings_oai_3_small_1536\"\n  | \"embeddings_voyage_4_large_1024\"\n  | \"embeddings_voyage_code_3_1024\"\n  | \"esign_campaign_member\"\n  | \"esign_envelope_certificate\"\n  | \"esign_envelope_document\"\n  | \"esign_envelope_draft\"\n  | \"esign_envelope_event\"\n  | \"esign_envelope_external_ref\"\n  | \"esign_envelope_signer\"\n  | \"external_conversation\"\n  | \"external_delivery_event\"\n  | \"external_message\"\n  | \"external_provider_receipt\"\n  | \"fc_detail\"\n  | \"feedback_comments\"\n  | \"feedback_user_messages\"\n  | \"file_analysis\"\n  | \"file_entities\"\n  | \"file_overrides\"\n  | \"file_page_annotations\"\n  | \"file_pages\"\n  | \"file_rag_job\"\n  | \"file_version\"\n  | \"global_execution\"\n  | \"global_execution_checkpoint\"\n  | \"global_execution_control\"\n  | \"global_execution_event\"\n  | \"global_meter_entry\"\n  | \"growth_loop_event\"\n  | \"growth_loop_stage_run\"\n  | \"hindsight_finding\"\n  | \"hindsight_replay\"\n  | \"hindsight_review\"\n  | \"hr_application\"\n  | \"hr_asset_assignment\"\n  | \"hr_attendance_exception\"\n  | \"hr_availability\"\n  | \"hr_benefits_event\"\n  | \"hr_candidate_conversion\"\n  | \"hr_candidate_message\"\n  | \"hr_checklist_item\"\n  | \"hr_checklist_run\"\n  | \"hr_checklist_template_item\"\n  | \"hr_course_version\"\n  | \"hr_credential\"\n  | \"hr_engagement\"\n  | \"hr_establishment\"\n  | \"hr_external_identity\"\n  | \"hr_holiday\"\n  | \"hr_i9_document\"\n  | \"hr_incident_party\"\n  | \"hr_interview\"\n  | \"hr_jurisdiction_rule_test\"\n  | \"hr_labor_target\"\n  | \"hr_leave_enrollment\"\n  | \"hr_leave_ledger\"\n  | \"hr_leave_request\"\n  | \"hr_legal_hold_item\"\n  | \"hr_new_hire_report\"\n  | \"hr_opening\"\n  | \"hr_overtime_alert\"\n  | \"hr_overtime_preapproval\"\n  | \"hr_pay_period\"\n  | \"hr_pay_period_employment\"\n  | \"hr_payroll_export\"\n  | \"hr_payroll_export_line\"\n  | \"hr_position_assignment\"\n  | \"hr_posting_publication\"\n  | \"hr_provider_event\"\n  | \"hr_provisioning_result\"\n  | \"hr_punch\"\n  | \"hr_reporting_line\"\n  | \"hr_schedule_change\"\n  | \"hr_schedule_template_shift\"\n  | \"hr_scorecard\"\n  | \"hr_shift\"\n  | \"hr_shift_claim\"\n  | \"hr_staffing_requirement\"\n  | \"hr_survey_invitation\"\n  | \"hr_survey_question\"\n  | \"hr_survey_response\"\n  | \"hr_tax_registration\"\n  | \"hr_time_adjustment\"\n  | \"hr_training_assignment\"\n  | \"hr_training_attempt\"\n  | \"hr_transcript_entry\"\n  | \"hr_work_interval\"\n  | \"hr_workflow_binding\"\n  | \"hr_workflow_failure\"\n  | \"hr_workflow_step\"\n  | \"hr_workflow_step_definition\"\n  | \"hr_workweek\"\n  | \"iam_org_domain_route\"\n  | \"integration_connection_resource\"\n  | \"interview_decision_question\"\n  | \"interview_document_revision\"\n  | \"interview_hole\"\n  | \"interview_question\"\n  | \"interview_turn\"\n  | \"item\"\n  | \"keyword_classification_queue\"\n  | \"kg_chunk_entities\"\n  | \"kg_edges\"\n  | \"kg_entity_aliases\"\n  | \"mandate_candidate\"\n  | \"mandate_candidate_run\"\n  | \"mandate_candidate_run_payload\"\n  | \"mandate_observation\"\n  | \"masterwork_corpus_item\"\n  | \"masterwork_run\"\n  | \"masterwork_source\"\n  | \"media_library_item\"\n  | \"media_selection_item\"\n  | \"media_selection_job\"\n  | \"meet_chat_message\"\n  | \"meet_connection\"\n  | \"meet_invitee\"\n  | \"meet_note\"\n  | \"meet_occurrence_override\"\n  | \"meet_participant\"\n  | \"meet_recording\"\n  | \"meet_session\"\n  | \"meet_transcript_segment\"\n  | \"memory_trial_step\"\n  | \"message\"\n  | \"message_template_detail\"\n  | \"ops_proof_run\"\n  | \"org_industries\"\n  | \"organization_preferences\"\n  | \"page_extraction_results\"\n  | \"page_extraction_runs\"\n  | \"party_contact_point\"\n  | \"pc_studio_run_asset\"\n  | \"plan_cms_fill_item\"\n  | \"plan_cms_fill_job\"\n  | \"plan_node_artifact\"\n  | \"plan_node_step\"\n  | \"processed_document_page\"\n  | \"product_capture_file\"\n  | \"product_capture_payload\"\n  | \"product_capture_product\"\n  | \"product_capture_question\"\n  | \"redaction_mapping\"\n  | \"research_analysis\"\n  | \"research_content\"\n  | \"research_document\"\n  | \"research_keyword\"\n  | \"research_media\"\n  | \"research_source\"\n  | \"research_synthesis\"\n  | \"research_tag\"\n  | \"run_approval_event\"\n  | \"sch_agent_task\"\n  | \"sch_run\"\n  | \"sch_trigger\"\n  | \"seo_ai_visibility_brand_check\"\n  | \"seo_ai_visibility_citation\"\n  | \"seo_ai_visibility_claim\"\n  | \"seo_ai_visibility_design_artifact\"\n  | \"seo_ai_visibility_panel\"\n  | \"seo_ai_visibility_panel_version\"\n  | \"seo_ai_visibility_response\"\n  | \"seo_ai_visibility_signal\"\n  | \"seo_backlink\"\n  | \"seo_backlink_change_event\"\n  | \"seo_backlink_dimension_snapshot\"\n  | \"seo_backlink_observation\"\n  | \"seo_backlink_snapshot\"\n  | \"seo_change_assessment\"\n  | \"seo_change_event\"\n  | \"seo_change_item\"\n  | \"seo_change_metric\"\n  | \"seo_change_set\"\n  | \"seo_change_theory\"\n  | \"seo_competitor\"\n  | \"seo_competitor_observation\"\n  | \"seo_competitor_opportunity\"\n  | \"seo_coverage_mention\"\n  | \"seo_coverage_tracker\"\n  | \"seo_dimension_value_matcher\"\n  | \"seo_gsc_dig_rule\"\n  | \"seo_keyword_market_observation\"\n  | \"seo_keyword_saved_view\"\n  | \"seo_landscape_brief\"\n  | \"seo_link_gap_domain\"\n  | \"seo_link_gap_match\"\n  | \"seo_map_topic\"\n  | \"seo_page_measurement_health\"\n  | \"seo_page_performance\"\n  | \"seo_pr_moment\"\n  | \"seo_provider_call\"\n  | \"seo_provider_task\"\n  | \"seo_rank_observation\"\n  | \"seo_raw_payload\"\n  | \"seo_referring_domain_profile\"\n  | \"seo_reputation_case\"\n  | \"seo_search_performance_daily\"\n  | \"seo_serp_mention\"\n  | \"seo_serp_opportunity\"\n  | \"seo_serp_result\"\n  | \"seo_serp_snapshot\"\n  | \"seo_site_geo_area\"\n  | \"seo_site_keyword_offering\"\n  | \"seo_site_keyword_value\"\n  | \"seo_site_offering_value\"\n  | \"seo_site_topic_value\"\n  | \"seo_site_value_combo\"\n  | \"seo_site_value_worth\"\n  | \"seo_site_vocabulary\"\n  | \"seo_starter_pack_item\"\n  | \"seo_tracker_story\"\n  | \"seo_web_analytics_daily\"\n  | \"skill_detail\"\n  | \"sms_message\"\n  | \"sms_message_media\"\n  | \"social_post_comment\"\n  | \"social_post_stat\"\n  | \"social_post_transcript\"\n  | \"social_video_composition_version\"\n  | \"social_video_variant\"\n  | \"social_watchlist_hit\"\n  | \"space_payload\"\n  | \"structure\"\n  | \"studio_cleaned_segments\"\n  | \"studio_concept_items\"\n  | \"studio_documents\"\n  | \"studio_module_segments\"\n  | \"studio_raw_segments\"\n  | \"studio_recording_segments\"\n  | \"studio_session_settings\"\n  | \"study_plan_block\"\n  | \"study_plan_day\"\n  | \"support_session_event\"\n  | \"tool_battle_cell\"\n  | \"tool_binding\"\n  | \"tool_call\"\n  | \"tool_definition_version\"\n  | \"tool_test_sample\"\n  | \"tool_ui\"\n  | \"tool_ui_incident\"\n  | \"tool_ui_version\"\n  | \"topic_placement_queue\"\n  | \"trigger_event\"\n  | \"udt_document_snapshot\"\n  | \"udt_workbook_snapshot\"\n  | \"ui_surface_action\"\n  | \"univer_payload\"\n  | \"user_follows\"\n  | \"wc_injury\"\n  | \"wc_report\"\n  | \"web_brand_asset\"\n  | \"web_brand_choice\"\n  | \"web_brand_offering\"\n  | \"web_brand_review\"\n  | \"web_brand_testimony\"\n  | \"web_business_fact\"\n  | \"web_business_location\"\n  | \"web_crawl_event\"\n  | \"web_crawl_preset\"\n  | \"web_crawl_schedule\"\n  | \"web_crawl_session\"\n  | \"web_crawl_url\"\n  | \"web_discovered_item\"\n  | \"web_finding\"\n  | \"web_gsc_page_stat\"\n  | \"web_link_edge\"\n  | \"web_location_listing\"\n  | \"web_page\"\n  | \"web_page_content\"\n  | \"web_page_evidence\"\n  | \"web_page_sitemap\"\n  | \"web_property\"\n  | \"web_result\"\n  | \"web_screenshot\"\n  | \"web_site_endpoint_rule\"\n  | \"web_site_item_config\"\n  | \"web_site_offering\"\n  | \"web_sitemap\"\n  | \"web_snapshot\"\n  | \"web_tag_manager_snapshot\"\n  | \"webhook_deliveries\"\n  | \"wf_node_data_slot\"\n  | \"work_item\"\n  | \"workflow_card\"\n  | \"workflow_checkpoint\"\n  | \"workflow_definition_overview\"\n  | \"workflow_definition_version\"\n  | \"workflow_idempotency\"\n  | \"workflow_job\"\n  | \"workflow_node_events\"\n  | \"workflow_node_outcome\"\n  | \"workflow_plan\"\n  | \"workflow_plan_event\"\n  | \"workflow_plan_sample\"\n  | \"workflow_recovery_audit\"\n  | \"workflow_review_issue\"\n  | \"workflow_run_log\"\n  | \"workflow_trigger_fire\"\n  | \"workflow_work_item\";\n\n/** Tokens flagged `default_scopeable` — can carry scope tags by default. */\nexport type ScopeableEntityToken =\n  | \"access_delta_probe\"\n  | \"access_delta_run\"\n  | \"access_request\"\n  | \"access_shadow_log\"\n  | \"access_version\"\n  | \"access_version_event\"\n  | \"account_addon\"\n  | \"account_closure\"\n  | \"account_facts\"\n  | \"acquisition_block\"\n  | \"activity\"\n  | \"admin_audit_log\"\n  | \"admin_email_log\"\n  | \"admin_markdown_sample\"\n  | \"admin_user\"\n  | \"admin_user_owned_resources_cache\"\n  | \"admission_config\"\n  | \"agent\"\n  | \"agent_card\"\n  | \"agent_definition_version\"\n  | \"agent_drift_alert\"\n  | \"agent_exemplar\"\n  | \"agent_mandate_note\"\n  | \"agent_prompt_block\"\n  | \"agent_prompt_block_variant\"\n  | \"agent_prompt_remediation\"\n  | \"agent_required_flag_change\"\n  | \"agent_run\"\n  | \"agent_run_stage\"\n  | \"agent_schedule\"\n  | \"agent_schedule_claim\"\n  | \"agent_shortcut\"\n  | \"agent_surface_binding\"\n  | \"agent_template\"\n  | \"agent_term_list\"\n  | \"agent_test_result\"\n  | \"agent_test_run\"\n  | \"agent_usage\"\n  | \"ai_api\"\n  | \"ai_calls\"\n  | \"ai_device_model_file\"\n  | \"ai_device_model_root\"\n  | \"ai_endpoint\"\n  | \"ai_media_generation_cache\"\n  | \"ai_model\"\n  | \"ai_model_alias\"\n  | \"ai_model_artifact\"\n  | \"ai_model_candidate\"\n  | \"ai_model_presentation\"\n  | \"ai_model_upstream\"\n  | \"ai_model_variant\"\n  | \"ai_model_verification_run\"\n  | \"ai_model_want\"\n  | \"ai_offering\"\n  | \"ai_person_model_want\"\n  | \"ai_provider\"\n  | \"ai_request_latency\"\n  | \"ai_runtime\"\n  | \"ai_runtime_build\"\n  | \"ai_runtime_compat\"\n  | \"ai_setting\"\n  | \"ai_setting_profile\"\n  | \"ai_translation_cell\"\n  | \"ai_usage_execution_facts\"\n  | \"ai_usage_executions\"\n  | \"ai_usage_hourly\"\n  | \"ai_usage_hourly_watermark\"\n  | \"analysis_result\"\n  | \"anon_form\"\n  | \"anon_form_password\"\n  | \"anon_form_visit\"\n  | \"anon_function_birth_grandfather\"\n  | \"anon_hit\"\n  | \"anon_inbound\"\n  | \"anon_replay\"\n  | \"anon_submission\"\n  | \"anon_token\"\n  | \"api_field_warning\"\n  | \"api_request_log\"\n  | \"app\"\n  | \"app_config\"\n  | \"app_config_history\"\n  | \"app_definition_version\"\n  | \"app_error\"\n  | \"app_execution\"\n  | \"app_instance\"\n  | \"app_log\"\n  | \"app_log_hourly\"\n  | \"app_log_hourly_watermark\"\n  | \"app_log_lines\"\n  | \"app_log_muted_pattern\"\n  | \"app_log_norm_exception\"\n  | \"app_log_requests_hourly\"\n  | \"app_rate_limit\"\n  | \"app_setting\"\n  | \"app_sync_status\"\n  | \"applet_visitor_binding\"\n  | \"approach\"\n  | \"artifact\"\n  | \"assessment\"\n  | \"assessment_item\"\n  | \"assessment_result\"\n  | \"assignment_session\"\n  | \"assist\"\n  | \"assist_producer_policy\"\n  | \"assist_producer_policy_history\"\n  | \"association_type\"\n  | \"assurance_level\"\n  | \"attempt\"\n  | \"attention_audience_rule\"\n  | \"attention_audit\"\n  | \"attention_item_state\"\n  | \"attention_showing\"\n  | \"audit_broken_functions\"\n  | \"audit_canonical_findings\"\n  | \"audit_exemption\"\n  | \"audit_function_deps\"\n  | \"audit_function_runtime_probe\"\n  | \"audit_m2m_candidates\"\n  | \"audit_refresh_log\"\n  | \"audit_stale_registry\"\n  | \"audit_unregistered_candidates\"\n  | \"automation_delivery\"\n  | \"automation_fired\"\n  | \"base_entity_template\"\n  | \"batch_cost_event\"\n  | \"batch_provider_batch\"\n  | \"batch_work_item\"\n  | \"billing_capability\"\n  | \"billing_capability_limit\"\n  | \"billing_ci_package_build\"\n  | \"billing_connect_account\"\n  | \"billing_coupon\"\n  | \"billing_coupon_redemption\"\n  | \"billing_customer\"\n  | \"billing_external_call_vendor\"\n  | \"billing_free_network_counter\"\n  | \"billing_free_period_grant\"\n  | \"billing_free_use_counter\"\n  | \"billing_hard_cost_reconciliation\"\n  | \"billing_held_run\"\n  | \"billing_org_payment_account\"\n  | \"billing_payment\"\n  | \"billing_payment_ask\"\n  | \"billing_plan\"\n  | \"billing_plan_limit\"\n  | \"billing_price\"\n  | \"billing_product\"\n  | \"billing_provider_balance_snapshot\"\n  | \"billing_spend_alarm\"\n  | \"billing_spend_alarm_occurrence\"\n  | \"billing_spend_approval\"\n  | \"billing_spend_guardrail\"\n  | \"billing_spend_hold\"\n  | \"billing_stripe_event\"\n  | \"billing_subscription\"\n  | \"billing_usage_ledger\"\n  | \"billing_usage_reset\"\n  | \"billing_user_plan\"\n  | \"block_state\"\n  | \"board\"\n  | \"browser_account_binding\"\n  | \"browser_action_event\"\n  | \"browser_authenticator_window\"\n  | \"browser_capture\"\n  | \"browser_control_request\"\n  | \"browser_handoff\"\n  | \"browser_login_attempt\"\n  | \"browser_login_recipe\"\n  | \"browser_profile\"\n  | \"browser_profile_checkpoint\"\n  | \"browser_run\"\n  | \"browser_site_observation\"\n  | \"browser_site_policy\"\n  | \"browser_stream_ticket\"\n  | \"build_lock\"\n  | \"calendar_event\"\n  | \"campaign_watch_ramp_gate_run\"\n  | \"campaign_watch_switch_outbox\"\n  | \"campaign_watch_switch_window\"\n  | \"canvas_comment\"\n  | \"canvas_comment_like\"\n  | \"canvas_item\"\n  | \"canvas_item_state\"\n  | \"canvas_like\"\n  | \"canvas_score\"\n  | \"canvas_view\"\n  | \"capture_window\"\n  | \"carrying_rule\"\n  | \"catalog_entries_history\"\n  | \"catalog_entry\"\n  | \"category\"\n  | \"change_item\"\n  | \"change_job\"\n  | \"change_job_row\"\n  | \"change_plan\"\n  | \"change_type_default\"\n  | \"change_work\"\n  | \"chat_user_usage_summary\"\n  | \"citations\"\n  | \"class_purchase\"\n  | \"classifier_revision_ledger\"\n  | \"client_callable_door\"\n  | \"client_callable_door_retirement\"\n  | \"client_excluded_column_unregistered\"\n  | \"cmp_entry\"\n  | \"cmp_feedback\"\n  | \"code_file\"\n  | \"code_folder\"\n  | \"code_repository\"\n  | \"coding_session\"\n  | \"coding_session_entry\"\n  | \"collab_checkpoint\"\n  | \"collab_op\"\n  | \"collab_room\"\n  | \"comment\"\n  | \"commerce_asset_allocation\"\n  | \"commerce_asset_grading\"\n  | \"commerce_asset_identifier\"\n  | \"commerce_asset_lot_event\"\n  | \"commerce_asset_mandate_result\"\n  | \"commerce_asset_price_factor\"\n  | \"commerce_asset_reshoot_request\"\n  | \"commerce_asset_review\"\n  | \"commerce_asset_unknown\"\n  | \"commerce_certified_printer\"\n  | \"commerce_cloud_sync_connection\"\n  | \"commerce_ebay_business_policy\"\n  | \"commerce_ebay_category\"\n  | \"commerce_ebay_category_aspect\"\n  | \"commerce_ebay_category_tree\"\n  | \"commerce_ebay_custom_policy\"\n  | \"commerce_ebay_inventory_item\"\n  | \"commerce_ebay_inventory_item_group\"\n  | \"commerce_ebay_inventory_item_group_member\"\n  | \"commerce_ebay_inventory_location\"\n  | \"commerce_ebay_listing\"\n  | \"commerce_ebay_marketplace_policy\"\n  | \"commerce_ebay_media_asset\"\n  | \"commerce_ebay_notification_destination\"\n  | \"commerce_ebay_notification_event\"\n  | \"commerce_ebay_notification_subscription\"\n  | \"commerce_ebay_notification_topic\"\n  | \"commerce_ebay_offer\"\n  | \"commerce_ebay_order\"\n  | \"commerce_ebay_order_line_item\"\n  | \"commerce_ebay_shipping_fulfillment\"\n  | \"commerce_ebay_store_category\"\n  | \"commerce_human_correction\"\n  | \"commerce_intake_artifact\"\n  | \"commerce_intake_asset\"\n  | \"commerce_intake_batch\"\n  | \"commerce_label_batch\"\n  | \"commerce_label_code\"\n  | \"commerce_marketplace_account\"\n  | \"commerce_marketplace_account_deletion_audit\"\n  | \"commerce_marketplace_api_call\"\n  | \"commerce_marketplace_rate_budget\"\n  | \"commerce_marketplace_site\"\n  | \"commerce_marketplace_sync_run\"\n  | \"commerce_prediction_outcome\"\n  | \"commerce_print_order\"\n  | \"commerce_product\"\n  | \"commerce_product_channel_ref\"\n  | \"commerce_product_media\"\n  | \"commerce_product_variant\"\n  | \"commerce_recall_audit\"\n  | \"communication_calendar_selected_snapshot_state\"\n  | \"communication_channel_readiness\"\n  | \"comparison_set\"\n  | \"computed_org_mark\"\n  | \"computed_reader_cols\"\n  | \"computed_reader_judgement\"\n  | \"config_manifest\"\n  | \"config_read_bucket\"\n  | \"contact_medium\"\n  | \"contact_submission\"\n  | \"content_certification\"\n  | \"content_ir_converter_definition\"\n  | \"content_ir_converter_run\"\n  | \"content_ir_kind\"\n  | \"content_ir_kind_component\"\n  | \"content_ir_kind_component_incident\"\n  | \"content_ir_kind_component_layer\"\n  | \"content_ir_kind_conformance\"\n  | \"content_ir_kind_edge\"\n  | \"content_ir_kind_example\"\n  | \"content_ir_kind_instance\"\n  | \"content_ir_kind_surface\"\n  | \"content_ir_render_inspection\"\n  | \"content_lane\"\n  | \"context_access_log\"\n  | \"context_item\"\n  | \"context_item_suggestion\"\n  | \"conversation\"\n  | \"courts\"\n  | \"credential_attachment\"\n  | \"credential_item\"\n  | \"credential_mutation_receipt\"\n  | \"crm_address\"\n  | \"crm_affiliation\"\n  | \"crm_blocklist_entry\"\n  | \"crm_contact_candidate\"\n  | \"crm_deal\"\n  | \"crm_deal_stage_event\"\n  | \"crm_enrichment_call\"\n  | \"crm_interaction\"\n  | \"crm_merge_candidate\"\n  | \"crm_outreach_list\"\n  | \"crm_outreach_list_member\"\n  | \"crm_party_merge\"\n  | \"crm_party_research\"\n  | \"crm_registry_ingest_run\"\n  | \"crm_registry_source\"\n  | \"crm_sending_claim\"\n  | \"crm_sending_event\"\n  | \"crm_sending_identity\"\n  | \"crm_sending_identity_check\"\n  | \"crm_sending_policy\"\n  | \"custom_agent_table_origin\"\n  | \"custom_agent_table_trust\"\n  | \"custom_agg_digest_checked\"\n  | \"custom_anon_form_draft\"\n  | \"custom_base\"\n  | \"custom_base_snapshot\"\n  | \"custom_field_definition\"\n  | \"custom_field_target\"\n  | \"custom_inbox_item_state\"\n  | \"custom_io_outbox_consumer\"\n  | \"custom_io_outbox_consumption\"\n  | \"custom_portal\"\n  | \"custom_portal_principal\"\n  | \"custom_portal_table\"\n  | \"custom_share_tails_mine_repair\"\n  | \"custom_synced_source\"\n  | \"custom_template\"\n  | \"custom_template_install\"\n  | \"custom_whole_value_parked\"\n  | \"cx_request_values\"\n  | \"data_rights_event\"\n  | \"data_store\"\n  | \"data_store_members\"\n  | \"ddl_guard_log\"\n  | \"deck_suggestion\"\n  | \"definer_class_exemption\"\n  | \"definer_client_grant_grandfather\"\n  | \"definer_grant_baseline\"\n  | \"deprecated_relation\"\n  | \"derive_run\"\n  | \"desktop_app_account\"\n  | \"desktop_app_instance\"\n  | \"desktop_app_profile\"\n  | \"dev_login_audit\"\n  | \"device_handoff\"\n  | \"dict_entry\"\n  | \"dict_provider_publication\"\n  | \"dict_setting\"\n  | \"dm_conversation\"\n  | \"dm_message\"\n  | \"dm_participant\"\n  | \"dm_session_member\"\n  | \"doc_render\"\n  | \"doc_signature\"\n  | \"dockets\"\n  | \"document\"\n  | \"document_version\"\n  | \"domain_classification\"\n  | \"edge_payload_kind\"\n  | \"egress_device\"\n  | \"egress_pairing\"\n  | \"egress_ticket\"\n  | \"emails\"\n  | \"embedding_cache\"\n  | \"embeddings_google_gemini_2_1536\"\n  | \"embeddings_oai_3_small_1536\"\n  | \"embeddings_voyage_4_large_1024\"\n  | \"embeddings_voyage_code_3_1024\"\n  | \"endpoint_family_sweep_state\"\n  | \"engine_owner_task\"\n  | \"entity_grant\"\n  | \"entity_protected_value\"\n  | \"entity_protected_value_version\"\n  | \"entity_relationship\"\n  | \"entity_type\"\n  | \"esign_campaign\"\n  | \"esign_campaign_member\"\n  | \"esign_consent_disclosure\"\n  | \"esign_envelope\"\n  | \"esign_envelope_certificate\"\n  | \"esign_envelope_document\"\n  | \"esign_envelope_draft\"\n  | \"esign_envelope_event\"\n  | \"esign_envelope_external_ref\"\n  | \"esign_envelope_signer\"\n  | \"esign_provider\"\n  | \"esign_provider_binding\"\n  | \"esign_saved_signature\"\n  | \"esign_signing_key\"\n  | \"esign_template\"\n  | \"execution_event_cursor\"\n  | \"extension_auth_code\"\n  | \"external_api_reservation\"\n  | \"external_conversation\"\n  | \"external_delivery_event\"\n  | \"external_inbox\"\n  | \"external_link\"\n  | \"external_message\"\n  | \"external_provider_receipt\"\n  | \"external_source\"\n  | \"extract_sweep_state\"\n  | \"fc_card\"\n  | \"fc_detail\"\n  | \"fc_set\"\n  | \"feature_doc\"\n  | \"feature_knob\"\n  | \"feedback_comments\"\n  | \"feedback_user_messages\"\n  | \"file\"\n  | \"file_analysis\"\n  | \"file_entities\"\n  | \"file_overrides\"\n  | \"file_page_annotations\"\n  | \"file_pages\"\n  | \"file_rag_job\"\n  | \"file_template\"\n  | \"files_account_tier\"\n  | \"files_machine_written_prefix\"\n  | \"files_sync_mapping\"\n  | \"files_user_account\"\n  | \"folder\"\n  | \"function_contract\"\n  | \"game_badge\"\n  | \"game_result\"\n  | \"game_room\"\n  | \"global_execution\"\n  | \"global_execution_checkpoint\"\n  | \"global_execution_control\"\n  | \"global_execution_event\"\n  | \"global_meter_entry\"\n  | \"global_origin\"\n  | \"global_request\"\n  | \"google_document\"\n  | \"growth_loop_event\"\n  | \"growth_loop_run\"\n  | \"growth_loop_stage_run\"\n  | \"guardian_link\"\n  | \"guest_conversion_audit\"\n  | \"guest_execution_log\"\n  | \"guest_executions\"\n  | \"guided_checklist_run\"\n  | \"heatmap_save\"\n  | \"hindsight_enrollment\"\n  | \"hindsight_finding\"\n  | \"hindsight_regression_case\"\n  | \"hindsight_replay\"\n  | \"hindsight_replay_step\"\n  | \"hindsight_review\"\n  | \"hr_access_audit\"\n  | \"hr_access_role\"\n  | \"hr_accommodation_request\"\n  | \"hr_ai_evidence\"\n  | \"hr_alert_routing_rule\"\n  | \"hr_application\"\n  | \"hr_approval_authority\"\n  | \"hr_approval_delegation\"\n  | \"hr_asset\"\n  | \"hr_asset_assignment\"\n  | \"hr_attendance_exception\"\n  | \"hr_auto_close_rule\"\n  | \"hr_availability\"\n  | \"hr_background_check\"\n  | \"hr_benefits_event\"\n  | \"hr_calculation_snapshot\"\n  | \"hr_candidate\"\n  | \"hr_candidate_conversion\"\n  | \"hr_candidate_message\"\n  | \"hr_careers_portal\"\n  | \"hr_checklist_item\"\n  | \"hr_checklist_run\"\n  | \"hr_checklist_template\"\n  | \"hr_checklist_template_item\"\n  | \"hr_compensation\"\n  | \"hr_corrective_action\"\n  | \"hr_course\"\n  | \"hr_course_version\"\n  | \"hr_credential\"\n  | \"hr_crew\"\n  | \"hr_deduction_code\"\n  | \"hr_department\"\n  | \"hr_derived_grant\"\n  | \"hr_disposition_event\"\n  | \"hr_earning_code\"\n  | \"hr_eeo_response\"\n  | \"hr_emergency_contact\"\n  | \"hr_employee\"\n  | \"hr_employee_private\"\n  | \"hr_employer_profile\"\n  | \"hr_employment\"\n  | \"hr_employment_pin\"\n  | \"hr_engagement\"\n  | \"hr_establishment\"\n  | \"hr_external_identity\"\n  | \"hr_field_policy\"\n  | \"hr_goal\"\n  | \"hr_holiday\"\n  | \"hr_holiday_calendar\"\n  | \"hr_i9\"\n  | \"hr_i9_document\"\n  | \"hr_incident\"\n  | \"hr_incident_party\"\n  | \"hr_interview\"\n  | \"hr_interview_kit\"\n  | \"hr_job_title\"\n  | \"hr_jurisdiction\"\n  | \"hr_jurisdiction_rule\"\n  | \"hr_jurisdiction_rule_class\"\n  | \"hr_jurisdiction_rule_org_decision\"\n  | \"hr_jurisdiction_rule_test\"\n  | \"hr_kiosk_device\"\n  | \"hr_kiosk_session\"\n  | \"hr_labor_target\"\n  | \"hr_leave_case\"\n  | \"hr_leave_enrollment\"\n  | \"hr_leave_ledger\"\n  | \"hr_leave_policy\"\n  | \"hr_leave_request\"\n  | \"hr_legal_hold\"\n  | \"hr_legal_hold_item\"\n  | \"hr_location\"\n  | \"hr_new_hire_report\"\n  | \"hr_offer\"\n  | \"hr_opening\"\n  | \"hr_overtime_alert\"\n  | \"hr_overtime_alert_rule\"\n  | \"hr_overtime_preapproval\"\n  | \"hr_pay_group\"\n  | \"hr_pay_period\"\n  | \"hr_pay_period_employment\"\n  | \"hr_payroll_export\"\n  | \"hr_payroll_export_line\"\n  | \"hr_position_assignment\"\n  | \"hr_posting\"\n  | \"hr_posting_publication\"\n  | \"hr_provider_binding\"\n  | \"hr_provider_event\"\n  | \"hr_provisioning_result\"\n  | \"hr_punch\"\n  | \"hr_recalculation_batch\"\n  | \"hr_record_class\"\n  | \"hr_records_request\"\n  | \"hr_reference_check\"\n  | \"hr_reporting_line\"\n  | \"hr_requisition\"\n  | \"hr_restricted_note\"\n  | \"hr_retention_rule\"\n  | \"hr_review\"\n  | \"hr_review_cycle\"\n  | \"hr_review_peer_nomination\"\n  | \"hr_review_response\"\n  | \"hr_review_template\"\n  | \"hr_role_assignment\"\n  | \"hr_schedule\"\n  | \"hr_schedule_change\"\n  | \"hr_schedule_guidance\"\n  | \"hr_schedule_template\"\n  | \"hr_schedule_template_shift\"\n  | \"hr_scorecard\"\n  | \"hr_separation\"\n  | \"hr_shift\"\n  | \"hr_shift_claim\"\n  | \"hr_staffing_requirement\"\n  | \"hr_survey\"\n  | \"hr_survey_invitation\"\n  | \"hr_survey_question\"\n  | \"hr_survey_response\"\n  | \"hr_tax_registration\"\n  | \"hr_tax_withholding\"\n  | \"hr_time_adjustment\"\n  | \"hr_training_assignment\"\n  | \"hr_training_attempt\"\n  | \"hr_transcript_entry\"\n  | \"hr_verification_letter_request\"\n  | \"hr_work_interval\"\n  | \"hr_workflow_binding\"\n  | \"hr_workflow_decision\"\n  | \"hr_workflow_definition\"\n  | \"hr_workflow_event\"\n  | \"hr_workflow_failure\"\n  | \"hr_workflow_flow_type\"\n  | \"hr_workflow_instance\"\n  | \"hr_workflow_step\"\n  | \"hr_workflow_step_definition\"\n  | \"hr_workweek\"\n  | \"html_extraction\"\n  | \"iam_access_audit\"\n  | \"iam_access_setup\"\n  | \"iam_api_key\"\n  | \"iam_emergency_door_request\"\n  | \"iam_oauth_app\"\n  | \"iam_org_availability_key\"\n  | \"iam_org_domain\"\n  | \"iam_org_domain_route\"\n  | \"iam_publish_binding\"\n  | \"iam_publisher_verification\"\n  | \"iam_read_lane_v2_rollout\"\n  | \"iam_record_seat_change\"\n  | \"iam_sign_in_event\"\n  | \"iam_world_namespace\"\n  | \"iam_world_publish_admission\"\n  | \"idempotency\"\n  | \"industry\"\n  | \"industry_curator\"\n  | \"infra_status\"\n  | \"ingest_runs\"\n  | \"integration_connection\"\n  | \"integration_connection_resource\"\n  | \"interview_decision_interview\"\n  | \"interview_decision_question\"\n  | \"interview_document_revision\"\n  | \"interview_hole\"\n  | \"interview_question\"\n  | \"interview_session\"\n  | \"interview_turn\"\n  | \"invitation\"\n  | \"invitation_code\"\n  | \"invitation_request\"\n  | \"io_comment\"\n  | \"io_contract\"\n  | \"io_import\"\n  | \"io_outbox\"\n  | \"item\"\n  | \"item_mastery\"\n  | \"judge_verdict\"\n  | \"jurisdiction_policy\"\n  | \"keyword_classification_queue\"\n  | \"kg_alert\"\n  | \"kg_chunk_entities\"\n  | \"kg_chunks\"\n  | \"kg_clusters\"\n  | \"kg_edges\"\n  | \"kg_entities\"\n  | \"kg_entity_aliases\"\n  | \"kg_suggestion_ack\"\n  | \"kg_sweep_queue\"\n  | \"kg_sweep_run\"\n  | \"kg_sweep_state\"\n  | \"kg_value_match\"\n  | \"knob_override\"\n  | \"knob_override_audit\"\n  | \"knob_rung_lock\"\n  | \"knob_scope_kind\"\n  | \"knob_write_door\"\n  | \"league_membership\"\n  | \"learn_doc\"\n  | \"library_doc\"\n  | \"lifecycle_archive\"\n  | \"lifecycle_archive_row\"\n  | \"lifecycle_audit\"\n  | \"lifecycle_entity_plan\"\n  | \"lifecycle_map_build\"\n  | \"lifecycle_reference_map\"\n  | \"lifecycle_run\"\n  | \"lifecycle_tier_ledger\"\n  | \"location\"\n  | \"mandate\"\n  | \"mandate_advance_batch_row\"\n  | \"mandate_binding\"\n  | \"mandate_candidate\"\n  | \"mandate_candidate_run\"\n  | \"mandate_candidate_run_payload\"\n  | \"mandate_goal_clauses\"\n  | \"mandate_observation\"\n  | \"mandate_proposal\"\n  | \"mandate_readiness_verdict\"\n  | \"mandate_reference\"\n  | \"mandate_scan\"\n  | \"mandate_treatment\"\n  | \"marketing_initiative\"\n  | \"masterwork_corpus_item\"\n  | \"masterwork_run\"\n  | \"masterwork_run_kind\"\n  | \"masterwork_source\"\n  | \"math_course_structure\"\n  | \"math_problem\"\n  | \"matrx_action_ledger\"\n  | \"mcp_config\"\n  | \"mcp_server\"\n  | \"mcp_user_conn\"\n  | \"media_capture_handoff\"\n  | \"media_catalog_setting\"\n  | \"media_library_item\"\n  | \"media_selection_item\"\n  | \"media_selection_job\"\n  | \"media_source_library\"\n  | \"meet_call_invite\"\n  | \"meet_chat_message\"\n  | \"meet_connection\"\n  | \"meet_invitee\"\n  | \"meet_meeting\"\n  | \"meet_note\"\n  | \"meet_occurrence_override\"\n  | \"meet_participant\"\n  | \"meet_recording\"\n  | \"meet_session\"\n  | \"meet_transcript_segment\"\n  | \"membership\"\n  | \"membership_grant\"\n  | \"memory_trial\"\n  | \"memory_trial_step\"\n  | \"merge_field_provenance\"\n  | \"message\"\n  | \"message_template\"\n  | \"message_template_detail\"\n  | \"meta_excluded_schema\"\n  | \"meta_table_stats_history\"\n  | \"metadata_reserved_keys\"\n  | \"migration_log\"\n  | \"mtx_media_heal_queue\"\n  | \"mtx_public_url_guard\"\n  | \"ner_shadow\"\n  | \"note\"\n  | \"notification\"\n  | \"notification_channel_preference\"\n  | \"notification_event_override\"\n  | \"notification_event_type\"\n  | \"notification_preference\"\n  | \"notification_submission\"\n  | \"notify_outsider_door_baseline\"\n  | \"oauth_handoff_claim\"\n  | \"opinion_clusters\"\n  | \"opinions\"\n  | \"ops_auth_lock_watchdog_log\"\n  | \"ops_check_item\"\n  | \"ops_check_run\"\n  | \"ops_db_host_sample\"\n  | \"ops_issue_class\"\n  | \"ops_issue_event\"\n  | \"ops_perf_client_event\"\n  | \"ops_perf_sample\"\n  | \"ops_perf_statement_snapshot\"\n  | \"ops_proof_check\"\n  | \"ops_proof_run\"\n  | \"ops_proof_scenario\"\n  | \"ops_source_read_cache\"\n  | \"ops_test_replay_cache\"\n  | \"org_admin_audit\"\n  | \"org_change_policy\"\n  | \"org_chart_publication\"\n  | \"org_context_ledger\"\n  | \"org_industries\"\n  | \"org_member_control\"\n  | \"org_module_config\"\n  | \"org_move_txn\"\n  | \"org_plan\"\n  | \"org_sweep_list\"\n  | \"organization\"\n  | \"organization_preferences\"\n  | \"organization_visibility_version\"\n  | \"output_feedback\"\n  | \"outreach_acceptance\"\n  | \"page_extraction_job\"\n  | \"page_extraction_page_run\"\n  | \"page_extraction_results\"\n  | \"page_extraction_runs\"\n  | \"page_intent_queue\"\n  | \"page_mapping_queue\"\n  | \"page_vitals\"\n  | \"part_config\"\n  | \"part_config_sub\"\n  | \"party\"\n  | \"party_contact_point\"\n  | \"passkey_credential\"\n  | \"pc_article\"\n  | \"pc_episode\"\n  | \"pc_show\"\n  | \"pc_studio_run\"\n  | \"pc_studio_run_asset\"\n  | \"pdf_consolidation_log\"\n  | \"pdf_redaction_audit\"\n  | \"pdf_redaction_key_escrow\"\n  | \"permission_grant\"\n  | \"personal_data_column\"\n  | \"plan_cms_fill_item\"\n  | \"plan_cms_fill_job\"\n  | \"plan_entity\"\n  | \"plan_node\"\n  | \"plan_node_artifact\"\n  | \"plan_node_step\"\n  | \"plan_profile\"\n  | \"platform_action_request\"\n  | \"platform_actor_session\"\n  | \"platform_actor_token\"\n  | \"platform_actor_token_event\"\n  | \"platform_class_approval_by_arman\"\n  | \"platform_class_approval_by_org_admin\"\n  | \"platform_continued_access\"\n  | \"platform_cutover_census_run\"\n  | \"platform_cutover_evaluation_replaced\"\n  | \"platform_cutover_evaluation_write\"\n  | \"platform_cutover_seam\"\n  | \"platform_cutover_seam_measure\"\n  | \"platform_cutover_seam_press\"\n  | \"platform_dated_change\"\n  | \"platform_doors_only_pending_cutover\"\n  | \"platform_google_calendar_event_create_intent\"\n  | \"platform_google_task_create_intent\"\n  | \"platform_hidden_item\"\n  | \"platform_kernel_fingerprint_record\"\n  | \"platform_outcome_event\"\n  | \"platform_outsider_consumer\"\n  | \"platform_provision_base_contract_pending\"\n  | \"platform_reachability\"\n  | \"platform_reachability_rebuild_pending\"\n  | \"platform_realtime_topic_prefix\"\n  | \"platform_reference_category\"\n  | \"platform_reference_declaration\"\n  | \"platform_repo\"\n  | \"platform_saved_view\"\n  | \"platform_schema\"\n  | \"platform_secure_delivery\"\n  | \"platform_share_link\"\n  | \"platform_strict_class_probe\"\n  | \"podcast_race\"\n  | \"position\"\n  | \"presentation\"\n  | \"processed_document\"\n  | \"processed_document_page\"\n  | \"product_capture_file\"\n  | \"product_capture_item\"\n  | \"product_capture_payload\"\n  | \"product_capture_product\"\n  | \"product_capture_question\"\n  | \"project\"\n  | \"provider_account\"\n  | \"provider_account_credential\"\n  | \"provision\"\n  | \"provision_generate_target\"\n  | \"provision_grant\"\n  | \"provision_marker\"\n  | \"provision_rule_message\"\n  | \"provision_schema\"\n  | \"provision_shape_debt\"\n  | \"provision_snapshot\"\n  | \"provision_spec\"\n  | \"provision_spec_grandfather\"\n  | \"provision_vocabulary\"\n  | \"public_compat_wrapper\"\n  | \"public_placement_baseline\"\n  | \"public_placement_census\"\n  | \"public_placement_domain\"\n  | \"public_restore_permit\"\n  | \"purpose\"\n  | \"quiz_session\"\n  | \"rag_ingest_run\"\n  | \"rag_library_audit_log\"\n  | \"rate_limit_buckets\"\n  | \"reachability_pending\"\n  | \"read_mask_kept\"\n  | \"recompute_queue\"\n  | \"record\"\n  | \"record_alias\"\n  | \"record_computed\"\n  | \"record_follow\"\n  | \"redaction_mapping\"\n  | \"relationship_rule\"\n  | \"research_analysis\"\n  | \"research_content\"\n  | \"research_context_bundle\"\n  | \"research_document\"\n  | \"research_intent\"\n  | \"research_keyword\"\n  | \"research_media\"\n  | \"research_source\"\n  | \"research_synthesis\"\n  | \"research_tag\"\n  | \"research_template\"\n  | \"research_topic\"\n  | \"retention_policy\"\n  | \"retrieval_audit\"\n  | \"review_queue\"\n  | \"route_manifest_entry\"\n  | \"row_version\"\n  | \"rulebook\"\n  | \"run_approval\"\n  | \"run_approval_event\"\n  | \"runtime_operation_stream\"\n  | \"runtime_operation_stream_batch\"\n  | \"sandbox_instance\"\n  | \"sch_agent_task\"\n  | \"sch_run\"\n  | \"sch_task\"\n  | \"sch_trigger\"\n  | \"scheduler_automation_run_subject\"\n  | \"schema_client_exposure\"\n  | \"schema_migration_ledger\"\n  | \"schema_migration_legacy\"\n  | \"schema_migration_slot_grandfather\"\n  | \"schema_templates\"\n  | \"scope\"\n  | \"scope_association_suggestion\"\n  | \"scope_door_registry\"\n  | \"scope_item_value_suggestion\"\n  | \"scope_suggestion\"\n  | \"scope_type\"\n  | \"scrape_domain\"\n  | \"scrape_domain_settings\"\n  | \"scrape_failure_log\"\n  | \"scrape_parsed_page\"\n  | \"scrape_path_override\"\n  | \"scrape_path_pattern\"\n  | \"scrape_retry_queue\"\n  | \"scraper_comparison_run\"\n  | \"scraper_data_fetch_job\"\n  | \"scraper_data_fetch_job_row\"\n  | \"scraper_data_source\"\n  | \"search_item\"\n  | \"seo_ai_capability\"\n  | \"seo_ai_visibility_brand_check\"\n  | \"seo_ai_visibility_citation\"\n  | \"seo_ai_visibility_claim\"\n  | \"seo_ai_visibility_design_artifact\"\n  | \"seo_ai_visibility_panel\"\n  | \"seo_ai_visibility_panel_version\"\n  | \"seo_ai_visibility_response\"\n  | \"seo_ai_visibility_signal\"\n  | \"seo_backlink\"\n  | \"seo_backlink_change_event\"\n  | \"seo_backlink_dimension_snapshot\"\n  | \"seo_backlink_observation\"\n  | \"seo_backlink_snapshot\"\n  | \"seo_change_assessment\"\n  | \"seo_change_event\"\n  | \"seo_change_item\"\n  | \"seo_change_metric\"\n  | \"seo_change_set\"\n  | \"seo_change_theory\"\n  | \"seo_collection_run\"\n  | \"seo_competitor\"\n  | \"seo_competitor_observation\"\n  | \"seo_competitor_opportunity\"\n  | \"seo_coverage_mention\"\n  | \"seo_coverage_tracker\"\n  | \"seo_dimension_value_matcher\"\n  | \"seo_engine_schedule\"\n  | \"seo_geo_place\"\n  | \"seo_gsc_dig_rule\"\n  | \"seo_keyword\"\n  | \"seo_keyword_class_rule\"\n  | \"seo_keyword_edge\"\n  | \"seo_keyword_facet\"\n  | \"seo_keyword_market\"\n  | \"seo_keyword_market_observation\"\n  | \"seo_keyword_place\"\n  | \"seo_keyword_saved_view\"\n  | \"seo_keyword_topic\"\n  | \"seo_landscape_brief\"\n  | \"seo_link_gap_domain\"\n  | \"seo_link_gap_match\"\n  | \"seo_map_facet\"\n  | \"seo_map_facet_value\"\n  | \"seo_map_topic\"\n  | \"seo_page_measurement_health\"\n  | \"seo_page_performance\"\n  | \"seo_pr_moment\"\n  | \"seo_provider_call\"\n  | \"seo_provider_task\"\n  | \"seo_rank_observation\"\n  | \"seo_rank_target\"\n  | \"seo_raw_payload\"\n  | \"seo_referring_domain_profile\"\n  | \"seo_reputation_case\"\n  | \"seo_search_performance_daily\"\n  | \"seo_serp_mention\"\n  | \"seo_serp_opportunity\"\n  | \"seo_serp_result\"\n  | \"seo_serp_snapshot\"\n  | \"seo_site_geo_area\"\n  | \"seo_site_keyword_offering\"\n  | \"seo_site_keyword_value\"\n  | \"seo_site_offering_value\"\n  | \"seo_site_topic_value\"\n  | \"seo_site_value_combo\"\n  | \"seo_site_value_worth\"\n  | \"seo_site_vocabulary\"\n  | \"seo_source_request\"\n  | \"seo_starter_pack\"\n  | \"seo_starter_pack_item\"\n  | \"seo_story_angle\"\n  | \"seo_topic\"\n  | \"seo_topical_map\"\n  | \"seo_tracker_story\"\n  | \"seo_web_analytics_daily\"\n  | \"share_link_password\"\n  | \"shareable_resource_registry\"\n  | \"shared_canvas_item\"\n  | \"short_link\"\n  | \"sign_in_fk_legacy\"\n  | \"skill\"\n  | \"skill_detail\"\n  | \"sms_consent\"\n  | \"sms_conversation\"\n  | \"sms_message\"\n  | \"sms_message_media\"\n  | \"sms_notification\"\n  | \"sms_notification_preference\"\n  | \"sms_phone_number\"\n  | \"sms_rate_limits\"\n  | \"sms_webhook_logs\"\n  | \"social_account_insight_daily\"\n  | \"social_ad\"\n  | \"social_captured_post\"\n  | \"social_kpi_goal\"\n  | \"social_own_post_metric\"\n  | \"social_post\"\n  | \"social_post_analysis\"\n  | \"social_post_comment\"\n  | \"social_post_metric_snapshot\"\n  | \"social_post_stat\"\n  | \"social_post_transcript\"\n  | \"social_profile\"\n  | \"social_profile_snapshot\"\n  | \"social_remix_output\"\n  | \"social_swipe_collection\"\n  | \"social_tracked_account\"\n  | \"social_video_composition_version\"\n  | \"social_video_project\"\n  | \"social_video_variant\"\n  | \"social_watchlist_hit\"\n  | \"soft_delete_cascade_job\"\n  | \"soft_delete_edge\"\n  | \"source_authority\"\n  | \"space_payload\"\n  | \"stage_ref_kind\"\n  | \"stamped_write_table\"\n  | \"structure\"\n  | \"studio_cleaned_segments\"\n  | \"studio_concept_items\"\n  | \"studio_documents\"\n  | \"studio_module_segments\"\n  | \"studio_raw_segments\"\n  | \"studio_recording_chunks\"\n  | \"studio_recording_segments\"\n  | \"studio_run\"\n  | \"studio_session\"\n  | \"studio_session_settings\"\n  | \"study_attempt\"\n  | \"study_goal\"\n  | \"study_media\"\n  | \"study_plan\"\n  | \"study_plan_block\"\n  | \"study_plan_day\"\n  | \"study_reminder_context\"\n  | \"study_reminder_delivery\"\n  | \"study_session\"\n  | \"study_source_chunk\"\n  | \"study_streak\"\n  | \"study_structured_section\"\n  | \"superseded_policy\"\n  | \"support_session\"\n  | \"support_session_event\"\n  | \"surface\"\n  | \"system_announcement\"\n  | \"system_context_item\"\n  | \"system_context_item_org_value\"\n  | \"system_error\"\n  | \"system_orgs\"\n  | \"system_write_failure\"\n  | \"t13_backfill_ledger\"\n  | \"t13_default_ledger\"\n  | \"t13_row_column_events\"\n  | \"tag\"\n  | \"task\"\n  | \"task_user_state\"\n  | \"taxonomy_node\"\n  | \"template_context_items\"\n  | \"template_scope_types\"\n  | \"templates\"\n  | \"test_handset_inbox\"\n  | \"test_handset_verification\"\n  | \"thread\"\n  | \"tool\"\n  | \"tool_battle\"\n  | \"tool_battle_cell\"\n  | \"tool_binding\"\n  | \"tool_bundle\"\n  | \"tool_call\"\n  | \"tool_call_facts\"\n  | \"tool_canary_run\"\n  | \"tool_catalog_cache\"\n  | \"tool_catalog_call\"\n  | \"tool_catalog_call_attempt\"\n  | \"tool_catalog_call_detail\"\n  | \"tool_catalog_endpoint\"\n  | \"tool_catalog_entry\"\n  | \"tool_catalog_provider\"\n  | \"tool_definition_version\"\n  | \"tool_executor\"\n  | \"tool_feature_scorecard\"\n  | \"tool_surface_defaults\"\n  | \"tool_test_sample\"\n  | \"tool_ui\"\n  | \"tool_ui_incident\"\n  | \"tool_ui_version\"\n  | \"topic_placement_queue\"\n  | \"transcript\"\n  | \"trigger_event\"\n  | \"udt_document\"\n  | \"udt_document_snapshot\"\n  | \"udt_workbook_snapshot\"\n  | \"ui_client\"\n  | \"ui_decision_pick\"\n  | \"ui_surface_action\"\n  | \"ui_surface_agent_pref\"\n  | \"ui_surface_agent_role\"\n  | \"ui_surface_client_tool\"\n  | \"ui_surface_config\"\n  | \"ui_surface_item_type\"\n  | \"ui_surface_value\"\n  | \"ui_surface_write_target\"\n  | \"univer_payload\"\n  | \"unsubscribe_token\"\n  | \"uploads_inflight\"\n  | \"user\"\n  | \"user_achievement\"\n  | \"user_acquisition_facts\"\n  | \"user_acquisition_facts_stored\"\n  | \"user_acquisition_facts_stored_watermark\"\n  | \"user_active_context\"\n  | \"user_analysis_preference\"\n  | \"user_email_preference\"\n  | \"user_entity_state\"\n  | \"user_feedback\"\n  | \"user_follows\"\n  | \"user_form_profile\"\n  | \"user_markdown_sample\"\n  | \"user_memory\"\n  | \"user_preference\"\n  | \"user_profile\"\n  | \"user_secret\"\n  | \"user_secret_audit\"\n  | \"user_secret_grant\"\n  | \"user_stat\"\n  | \"user_storage_usage\"\n  | \"user_surface_state\"\n  | \"users_calendar_feed\"\n  | \"vault_fill_approvals\"\n  | \"vault_fill_devices\"\n  | \"vault_fill_nonces\"\n  | \"visibility_cache\"\n  | \"visibility_epoch\"\n  | \"voice\"\n  | \"war_room\"\n  | \"wbx_demo\"\n  | \"wbx_guidance\"\n  | \"wbx_highlight\"\n  | \"wbx_pattern\"\n  | \"wbx_recipe\"\n  | \"wbx_screenshot\"\n  | \"wbx_seo_audit\"\n  | \"wc_claim\"\n  | \"wc_impairment_definition\"\n  | \"wc_injury\"\n  | \"wc_report\"\n  | \"web_analysis_item\"\n  | \"web_brand\"\n  | \"web_brand_asset\"\n  | \"web_brand_choice\"\n  | \"web_brand_exclusion\"\n  | \"web_brand_offering\"\n  | \"web_brand_persona\"\n  | \"web_brand_relation_kind\"\n  | \"web_brand_review\"\n  | \"web_brand_testimony\"\n  | \"web_business_fact\"\n  | \"web_business_location\"\n  | \"web_channel_analytics_daily\"\n  | \"web_crawl_event\"\n  | \"web_crawl_preset\"\n  | \"web_crawl_schedule\"\n  | \"web_crawl_session\"\n  | \"web_crawl_url\"\n  | \"web_discovered_item\"\n  | \"web_domain_category\"\n  | \"web_domain_category_observation\"\n  | \"web_finding\"\n  | \"web_gsc_page_stat\"\n  | \"web_link_edge\"\n  | \"web_listing_publisher\"\n  | \"web_location_listing\"\n  | \"web_news_item\"\n  | \"web_offering_template\"\n  | \"web_page\"\n  | \"web_page_content\"\n  | \"web_page_evidence\"\n  | \"web_page_sitemap\"\n  | \"web_property\"\n  | \"web_provider\"\n  | \"web_result\"\n  | \"web_screenshot\"\n  | \"web_search_review\"\n  | \"web_site\"\n  | \"web_site_endpoint_rule\"\n  | \"web_site_item_config\"\n  | \"web_site_offering\"\n  | \"web_sitemap\"\n  | \"web_snapshot\"\n  | \"web_tag_manager_snapshot\"\n  | \"web_temp_brand_firmographic\"\n  | \"web_temp_brand_presence\"\n  | \"web_temp_brand_recognition\"\n  | \"web_voice_fingerprint\"\n  | \"web_youtube_video\"\n  | \"webhook_deliveries\"\n  | \"webhook_dispatch_state\"\n  | \"webhook_test_receipt\"\n  | \"webhooks\"\n  | \"wf_node_data_slot\"\n  | \"work_claim\"\n  | \"work_item\"\n  | \"workbook\"\n  | \"worker_heartbeat\"\n  | \"workflow\"\n  | \"workflow_card\"\n  | \"workflow_checkpoint\"\n  | \"workflow_checkpoint_value\"\n  | \"workflow_comparison\"\n  | \"workflow_definition_overview\"\n  | \"workflow_definition_version\"\n  | \"workflow_idempotency\"\n  | \"workflow_job\"\n  | \"workflow_node_events\"\n  | \"workflow_node_outcome\"\n  | \"workflow_recovery_audit\"\n  | \"workflow_review_issue\"\n  | \"workflow_run\"\n  | \"workflow_run_cost\"\n  | \"workflow_run_facts\"\n  | \"workflow_run_log\"\n  | \"workflow_runtime_surface\"\n  | \"workflow_step_facts\"\n  | \"workflow_step_result\"\n  | \"workflow_template\"\n  | \"workflow_trigger\"\n  | \"workflow_trigger_fire\"\n  | \"workflow_work_item\"\n  | \"write_guard_key\"\n  | \"youtube_quota_day\"\n  | \"youtube_search\"\n  | \"youtube_video\";\n\n/** Tokens flagged `is_listed` — surfaced in list/nav UIs. */\nexport type ListedEntityToken =\n  | \"agent\"\n  | \"agent_exemplar\"\n  | \"agent_prompt_block\"\n  | \"ai_model\"\n  | \"ai_model_alias\"\n  | \"ai_provider\"\n  | \"ai_setting\"\n  | \"assist\"\n  | \"board\"\n  | \"browser_login_recipe\"\n  | \"browser_profile\"\n  | \"browser_site_policy\"\n  | \"calendar_event\"\n  | \"commerce_certified_printer\"\n  | \"commerce_cloud_sync_connection\"\n  | \"commerce_intake_batch\"\n  | \"commerce_label_batch\"\n  | \"commerce_marketplace_account\"\n  | \"commerce_print_order\"\n  | \"commerce_product\"\n  | \"content_ir_converter_definition\"\n  | \"content_ir_kind\"\n  | \"content_ir_kind_instance\"\n  | \"crm_blocklist_entry\"\n  | \"crm_deal\"\n  | \"crm_outreach_list\"\n  | \"crm_registry_source\"\n  | \"crm_sending_identity\"\n  | \"custom_field_definition\"\n  | \"custom_field_target\"\n  | \"document\"\n  | \"esign_campaign\"\n  | \"esign_consent_disclosure\"\n  | \"esign_envelope\"\n  | \"esign_provider_binding\"\n  | \"esign_template\"\n  | \"file_template\"\n  | \"files_machine_written_prefix\"\n  | \"files_sync_mapping\"\n  | \"google_document\"\n  | \"growth_loop_run\"\n  | \"hindsight_regression_case\"\n  | \"hindsight_replay_step\"\n  | \"hr_asset\"\n  | \"hr_candidate\"\n  | \"hr_careers_portal\"\n  | \"hr_checklist_template\"\n  | \"hr_course\"\n  | \"hr_crew\"\n  | \"hr_deduction_code\"\n  | \"hr_department\"\n  | \"hr_earning_code\"\n  | \"hr_employee\"\n  | \"hr_holiday_calendar\"\n  | \"hr_interview_kit\"\n  | \"hr_job_title\"\n  | \"hr_leave_policy\"\n  | \"hr_location\"\n  | \"hr_pay_group\"\n  | \"hr_posting\"\n  | \"hr_provider_binding\"\n  | \"hr_requisition\"\n  | \"hr_schedule\"\n  | \"hr_schedule_guidance\"\n  | \"hr_schedule_template\"\n  | \"hr_survey\"\n  | \"hr_workflow_definition\"\n  | \"hr_workflow_flow_type\"\n  | \"hr_workflow_instance\"\n  | \"iam_api_key\"\n  | \"interview_decision_interview\"\n  | \"interview_session\"\n  | \"learn_doc\"\n  | \"mandate\"\n  | \"mandate_binding\"\n  | \"mandate_readiness_verdict\"\n  | \"marketing_initiative\"\n  | \"media_source_library\"\n  | \"ops_proof_check\"\n  | \"ops_proof_scenario\"\n  | \"org_chart_publication\"\n  | \"party\"\n  | \"plan_entity\"\n  | \"plan_node\"\n  | \"platform_outcome_event\"\n  | \"platform_saved_view\"\n  | \"position\"\n  | \"presentation\"\n  | \"purpose\"\n  | \"research_context_bundle\"\n  | \"rulebook\"\n  | \"seo_ai_visibility_brand_check\"\n  | \"seo_dimension_value_matcher\"\n  | \"seo_geo_place\"\n  | \"seo_keyword_saved_view\"\n  | \"seo_map_facet\"\n  | \"seo_map_facet_value\"\n  | \"seo_site_value_combo\"\n  | \"seo_site_value_worth\"\n  | \"seo_starter_pack\"\n  | \"seo_topical_map\"\n  | \"surface\"\n  | \"system_context_item\"\n  | \"team\"\n  | \"ui_decision_pick\"\n  | \"web_brand_exclusion\"\n  | \"web_search_review\"\n  | \"web_youtube_video\"\n  | \"workbook\"\n  | \"workflow_runtime_surface\";\n\n/** Tokens flagged `is_module`. */\nexport type ModuleEntityToken =\n  | \"agent\"\n  | \"conversation\"\n  | \"file\"\n  | \"folder\"\n  | \"note\"\n  | \"project\"\n  | \"task\"\n  | \"transcript\";\n\n/** Every token, sorted — the iteration/validation source. */\nexport const ENTITY_TYPE_TOKENS: readonly EntityTypeToken[] = [\n  \"access_delta_probe\",\n  \"access_delta_run\",\n  \"access_request\",\n  \"access_shadow_log\",\n  \"access_version\",\n  \"access_version_event\",\n  \"account_addon\",\n  \"account_closure\",\n  \"account_facts\",\n  \"acquisition_block\",\n  \"activity\",\n  \"admin_audit_log\",\n  \"admin_email_log\",\n  \"admin_markdown_sample\",\n  \"admin_user\",\n  \"admin_user_owned_resources_cache\",\n  \"admission_config\",\n  \"agent\",\n  \"agent_card\",\n  \"agent_definition_version\",\n  \"agent_drift_alert\",\n  \"agent_exemplar\",\n  \"agent_mandate_note\",\n  \"agent_prompt_block\",\n  \"agent_prompt_block_variant\",\n  \"agent_prompt_remediation\",\n  \"agent_required_flag_change\",\n  \"agent_run\",\n  \"agent_run_stage\",\n  \"agent_schedule\",\n  \"agent_schedule_claim\",\n  \"agent_shortcut\",\n  \"agent_surface_binding\",\n  \"agent_template\",\n  \"agent_term_list\",\n  \"agent_test_result\",\n  \"agent_test_run\",\n  \"agent_usage\",\n  \"ai_api\",\n  \"ai_calls\",\n  \"ai_device_model_file\",\n  \"ai_device_model_root\",\n  \"ai_endpoint\",\n  \"ai_media_generation_cache\",\n  \"ai_model\",\n  \"ai_model_alias\",\n  \"ai_model_artifact\",\n  \"ai_model_candidate\",\n  \"ai_model_presentation\",\n  \"ai_model_upstream\",\n  \"ai_model_variant\",\n  \"ai_model_verification_run\",\n  \"ai_model_want\",\n  \"ai_offering\",\n  \"ai_person_model_want\",\n  \"ai_provider\",\n  \"ai_request_latency\",\n  \"ai_runtime\",\n  \"ai_runtime_build\",\n  \"ai_runtime_compat\",\n  \"ai_setting\",\n  \"ai_setting_profile\",\n  \"ai_translation_cell\",\n  \"ai_usage_execution_facts\",\n  \"ai_usage_executions\",\n  \"ai_usage_hourly\",\n  \"ai_usage_hourly_watermark\",\n  \"analysis_result\",\n  \"anon_form\",\n  \"anon_form_password\",\n  \"anon_form_visit\",\n  \"anon_function_birth_grandfather\",\n  \"anon_hit\",\n  \"anon_inbound\",\n  \"anon_replay\",\n  \"anon_submission\",\n  \"anon_token\",\n  \"api_field_warning\",\n  \"api_request_log\",\n  \"app\",\n  \"app_config\",\n  \"app_config_history\",\n  \"app_definition_version\",\n  \"app_error\",\n  \"app_execution\",\n  \"app_instance\",\n  \"app_log\",\n  \"app_log_hourly\",\n  \"app_log_hourly_watermark\",\n  \"app_log_lines\",\n  \"app_log_muted_pattern\",\n  \"app_log_norm_exception\",\n  \"app_log_requests_hourly\",\n  \"app_rate_limit\",\n  \"app_setting\",\n  \"app_sync_status\",\n  \"applet_visitor_binding\",\n  \"approach\",\n  \"artifact\",\n  \"assessment\",\n  \"assessment_item\",\n  \"assessment_result\",\n  \"assignment_session\",\n  \"assist\",\n  \"assist_producer_policy\",\n  \"assist_producer_policy_history\",\n  \"association_type\",\n  \"assurance_level\",\n  \"attempt\",\n  \"attention_audience_rule\",\n  \"attention_audit\",\n  \"attention_item_state\",\n  \"attention_showing\",\n  \"audit_broken_functions\",\n  \"audit_canonical_findings\",\n  \"audit_exemption\",\n  \"audit_function_deps\",\n  \"audit_function_runtime_probe\",\n  \"audit_m2m_candidates\",\n  \"audit_refresh_log\",\n  \"audit_stale_registry\",\n  \"audit_unregistered_candidates\",\n  \"automation_delivery\",\n  \"automation_fired\",\n  \"base_entity_template\",\n  \"batch_cost_event\",\n  \"batch_provider_batch\",\n  \"batch_work_item\",\n  \"billing_capability\",\n  \"billing_capability_limit\",\n  \"billing_ci_package_build\",\n  \"billing_connect_account\",\n  \"billing_coupon\",\n  \"billing_coupon_redemption\",\n  \"billing_customer\",\n  \"billing_external_call_vendor\",\n  \"billing_free_network_counter\",\n  \"billing_free_period_grant\",\n  \"billing_free_use_counter\",\n  \"billing_hard_cost_reconciliation\",\n  \"billing_held_run\",\n  \"billing_org_payment_account\",\n  \"billing_payment\",\n  \"billing_payment_ask\",\n  \"billing_plan\",\n  \"billing_plan_limit\",\n  \"billing_price\",\n  \"billing_product\",\n  \"billing_provider_balance_snapshot\",\n  \"billing_spend_alarm\",\n  \"billing_spend_alarm_occurrence\",\n  \"billing_spend_approval\",\n  \"billing_spend_guardrail\",\n  \"billing_spend_hold\",\n  \"billing_stripe_event\",\n  \"billing_subscription\",\n  \"billing_usage_ledger\",\n  \"billing_usage_reset\",\n  \"billing_user_plan\",\n  \"block_state\",\n  \"board\",\n  \"browser_account_binding\",\n  \"browser_action_event\",\n  \"browser_authenticator_window\",\n  \"browser_capture\",\n  \"browser_control_request\",\n  \"browser_handoff\",\n  \"browser_login_attempt\",\n  \"browser_login_recipe\",\n  \"browser_profile\",\n  \"browser_profile_checkpoint\",\n  \"browser_run\",\n  \"browser_site_observation\",\n  \"browser_site_policy\",\n  \"browser_stream_ticket\",\n  \"build_lock\",\n  \"calendar_event\",\n  \"campaign_watch_ramp_gate_run\",\n  \"campaign_watch_switch_outbox\",\n  \"campaign_watch_switch_window\",\n  \"canvas_comment\",\n  \"canvas_comment_like\",\n  \"canvas_item\",\n  \"canvas_item_state\",\n  \"canvas_like\",\n  \"canvas_score\",\n  \"canvas_view\",\n  \"capture_window\",\n  \"carrying_rule\",\n  \"catalog_entries_history\",\n  \"catalog_entry\",\n  \"category\",\n  \"change_item\",\n  \"change_job\",\n  \"change_job_row\",\n  \"change_plan\",\n  \"change_type_default\",\n  \"change_work\",\n  \"chat_user_usage_summary\",\n  \"citations\",\n  \"class_purchase\",\n  \"classifier_revision_ledger\",\n  \"client_callable_door\",\n  \"client_callable_door_retirement\",\n  \"client_excluded_column_unregistered\",\n  \"cmp_entry\",\n  \"cmp_feedback\",\n  \"code_file\",\n  \"code_folder\",\n  \"code_repository\",\n  \"coding_session\",\n  \"coding_session_entry\",\n  \"collab_checkpoint\",\n  \"collab_op\",\n  \"collab_room\",\n  \"comment\",\n  \"commerce_asset_allocation\",\n  \"commerce_asset_grading\",\n  \"commerce_asset_identifier\",\n  \"commerce_asset_lot_event\",\n  \"commerce_asset_mandate_result\",\n  \"commerce_asset_price_factor\",\n  \"commerce_asset_reshoot_request\",\n  \"commerce_asset_review\",\n  \"commerce_asset_unknown\",\n  \"commerce_certified_printer\",\n  \"commerce_cloud_sync_connection\",\n  \"commerce_ebay_business_policy\",\n  \"commerce_ebay_category\",\n  \"commerce_ebay_category_aspect\",\n  \"commerce_ebay_category_tree\",\n  \"commerce_ebay_custom_policy\",\n  \"commerce_ebay_inventory_item\",\n  \"commerce_ebay_inventory_item_group\",\n  \"commerce_ebay_inventory_item_group_member\",\n  \"commerce_ebay_inventory_location\",\n  \"commerce_ebay_listing\",\n  \"commerce_ebay_marketplace_policy\",\n  \"commerce_ebay_media_asset\",\n  \"commerce_ebay_notification_destination\",\n  \"commerce_ebay_notification_event\",\n  \"commerce_ebay_notification_subscription\",\n  \"commerce_ebay_notification_topic\",\n  \"commerce_ebay_offer\",\n  \"commerce_ebay_order\",\n  \"commerce_ebay_order_line_item\",\n  \"commerce_ebay_shipping_fulfillment\",\n  \"commerce_ebay_store_category\",\n  \"commerce_human_correction\",\n  \"commerce_intake_artifact\",\n  \"commerce_intake_asset\",\n  \"commerce_intake_batch\",\n  \"commerce_label_batch\",\n  \"commerce_label_code\",\n  \"commerce_marketplace_account\",\n  \"commerce_marketplace_account_deletion_audit\",\n  \"commerce_marketplace_api_call\",\n  \"commerce_marketplace_rate_budget\",\n  \"commerce_marketplace_site\",\n  \"commerce_marketplace_sync_run\",\n  \"commerce_prediction_outcome\",\n  \"commerce_print_order\",\n  \"commerce_product\",\n  \"commerce_product_channel_ref\",\n  \"commerce_product_media\",\n  \"commerce_product_variant\",\n  \"commerce_recall_audit\",\n  \"communication_calendar_selected_snapshot_state\",\n  \"communication_channel_readiness\",\n  \"comparison_set\",\n  \"computed_org_mark\",\n  \"computed_reader_cols\",\n  \"computed_reader_judgement\",\n  \"config_manifest\",\n  \"config_read_bucket\",\n  \"contact_medium\",\n  \"contact_submission\",\n  \"content_certification\",\n  \"content_ir_converter_definition\",\n  \"content_ir_converter_run\",\n  \"content_ir_kind\",\n  \"content_ir_kind_component\",\n  \"content_ir_kind_component_incident\",\n  \"content_ir_kind_component_layer\",\n  \"content_ir_kind_conformance\",\n  \"content_ir_kind_edge\",\n  \"content_ir_kind_example\",\n  \"content_ir_kind_instance\",\n  \"content_ir_kind_surface\",\n  \"content_ir_render_inspection\",\n  \"content_lane\",\n  \"context_access_log\",\n  \"context_item\",\n  \"context_item_suggestion\",\n  \"conversation\",\n  \"conversation_value\",\n  \"courts\",\n  \"credential_attachment\",\n  \"credential_item\",\n  \"credential_mutation_receipt\",\n  \"crm_address\",\n  \"crm_affiliation\",\n  \"crm_blocklist_entry\",\n  \"crm_contact_candidate\",\n  \"crm_deal\",\n  \"crm_deal_stage_event\",\n  \"crm_enrichment_call\",\n  \"crm_interaction\",\n  \"crm_merge_candidate\",\n  \"crm_outreach_list\",\n  \"crm_outreach_list_member\",\n  \"crm_party_merge\",\n  \"crm_party_research\",\n  \"crm_registry_ingest_run\",\n  \"crm_registry_source\",\n  \"crm_sending_claim\",\n  \"crm_sending_event\",\n  \"crm_sending_identity\",\n  \"crm_sending_identity_check\",\n  \"crm_sending_policy\",\n  \"custom_agent_table_origin\",\n  \"custom_agent_table_trust\",\n  \"custom_agg_digest_checked\",\n  \"custom_anon_form_draft\",\n  \"custom_base\",\n  \"custom_base_snapshot\",\n  \"custom_field_definition\",\n  \"custom_field_target\",\n  \"custom_inbox_item_state\",\n  \"custom_io_outbox_consumer\",\n  \"custom_io_outbox_consumption\",\n  \"custom_portal\",\n  \"custom_portal_principal\",\n  \"custom_portal_table\",\n  \"custom_share_tails_mine_repair\",\n  \"custom_synced_source\",\n  \"custom_template\",\n  \"custom_template_install\",\n  \"custom_whole_value_parked\",\n  \"cx_agent_memory\",\n  \"cx_agent_plan\",\n  \"cx_agent_task\",\n  \"cx_code_edit\",\n  \"cx_code_message_file\",\n  \"cx_media\",\n  \"cx_observational_memory\",\n  \"cx_observational_memory_event\",\n  \"cx_pending_injection\",\n  \"cx_request\",\n  \"cx_request_snapshot\",\n  \"cx_request_values\",\n  \"cx_tool_trace\",\n  \"cx_user_request\",\n  \"cx_user_todo\",\n  \"data_rights_event\",\n  \"data_store\",\n  \"data_store_members\",\n  \"ddl_guard_log\",\n  \"deck_suggestion\",\n  \"definer_class_exemption\",\n  \"definer_client_grant_grandfather\",\n  \"definer_grant_baseline\",\n  \"deprecated_relation\",\n  \"derive_run\",\n  \"desktop_app_account\",\n  \"desktop_app_instance\",\n  \"desktop_app_profile\",\n  \"dev_login_audit\",\n  \"device_handoff\",\n  \"dict_entry\",\n  \"dict_provider_publication\",\n  \"dict_setting\",\n  \"dm_conversation\",\n  \"dm_message\",\n  \"dm_participant\",\n  \"dm_session_member\",\n  \"doc_render\",\n  \"doc_signature\",\n  \"dockets\",\n  \"document\",\n  \"document_version\",\n  \"domain_classification\",\n  \"edge_payload_kind\",\n  \"egress_device\",\n  \"egress_pairing\",\n  \"egress_ticket\",\n  \"emails\",\n  \"embedding_cache\",\n  \"embeddings_google_gemini_2_1536\",\n  \"embeddings_oai_3_small_1536\",\n  \"embeddings_voyage_4_large_1024\",\n  \"embeddings_voyage_code_3_1024\",\n  \"endpoint_family_sweep_state\",\n  \"engine_owner_task\",\n  \"entity_grant\",\n  \"entity_protected_value\",\n  \"entity_protected_value_version\",\n  \"entity_relationship\",\n  \"entity_type\",\n  \"esign_campaign\",\n  \"esign_campaign_member\",\n  \"esign_consent_disclosure\",\n  \"esign_envelope\",\n  \"esign_envelope_certificate\",\n  \"esign_envelope_document\",\n  \"esign_envelope_draft\",\n  \"esign_envelope_event\",\n  \"esign_envelope_external_ref\",\n  \"esign_envelope_signer\",\n  \"esign_provider\",\n  \"esign_provider_binding\",\n  \"esign_saved_signature\",\n  \"esign_signing_key\",\n  \"esign_template\",\n  \"execution_event_cursor\",\n  \"extension_auth_code\",\n  \"external_api_reservation\",\n  \"external_conversation\",\n  \"external_delivery_event\",\n  \"external_inbox\",\n  \"external_link\",\n  \"external_message\",\n  \"external_provider_receipt\",\n  \"external_source\",\n  \"extract_sweep_state\",\n  \"fc_card\",\n  \"fc_detail\",\n  \"fc_set\",\n  \"feature_doc\",\n  \"feature_knob\",\n  \"feedback_comments\",\n  \"feedback_user_messages\",\n  \"file\",\n  \"file_analysis\",\n  \"file_entities\",\n  \"file_overrides\",\n  \"file_page_annotations\",\n  \"file_pages\",\n  \"file_rag_job\",\n  \"file_template\",\n  \"file_version\",\n  \"files_account_tier\",\n  \"files_machine_written_prefix\",\n  \"files_sync_mapping\",\n  \"files_user_account\",\n  \"folder\",\n  \"function_contract\",\n  \"game_badge\",\n  \"game_result\",\n  \"game_room\",\n  \"global_execution\",\n  \"global_execution_checkpoint\",\n  \"global_execution_control\",\n  \"global_execution_event\",\n  \"global_meter_entry\",\n  \"global_origin\",\n  \"global_request\",\n  \"google_document\",\n  \"growth_loop_event\",\n  \"growth_loop_run\",\n  \"growth_loop_stage_run\",\n  \"guardian_link\",\n  \"guest_conversion_audit\",\n  \"guest_execution_log\",\n  \"guest_executions\",\n  \"guided_checklist_run\",\n  \"heatmap_save\",\n  \"hindsight_enrollment\",\n  \"hindsight_finding\",\n  \"hindsight_regression_case\",\n  \"hindsight_replay\",\n  \"hindsight_replay_step\",\n  \"hindsight_review\",\n  \"hr_access_audit\",\n  \"hr_access_role\",\n  \"hr_accommodation_request\",\n  \"hr_ai_evidence\",\n  \"hr_alert_routing_rule\",\n  \"hr_application\",\n  \"hr_approval_authority\",\n  \"hr_approval_delegation\",\n  \"hr_asset\",\n  \"hr_asset_assignment\",\n  \"hr_attendance_exception\",\n  \"hr_auto_close_rule\",\n  \"hr_availability\",\n  \"hr_background_check\",\n  \"hr_benefits_event\",\n  \"hr_calculation_snapshot\",\n  \"hr_candidate\",\n  \"hr_candidate_conversion\",\n  \"hr_candidate_message\",\n  \"hr_careers_portal\",\n  \"hr_checklist_item\",\n  \"hr_checklist_run\",\n  \"hr_checklist_template\",\n  \"hr_checklist_template_item\",\n  \"hr_compensation\",\n  \"hr_corrective_action\",\n  \"hr_course\",\n  \"hr_course_version\",\n  \"hr_credential\",\n  \"hr_crew\",\n  \"hr_deduction_code\",\n  \"hr_department\",\n  \"hr_derived_grant\",\n  \"hr_disposition_event\",\n  \"hr_earning_code\",\n  \"hr_eeo_response\",\n  \"hr_emergency_contact\",\n  \"hr_employee\",\n  \"hr_employee_private\",\n  \"hr_employer_profile\",\n  \"hr_employment\",\n  \"hr_employment_pin\",\n  \"hr_engagement\",\n  \"hr_establishment\",\n  \"hr_external_identity\",\n  \"hr_field_policy\",\n  \"hr_goal\",\n  \"hr_holiday\",\n  \"hr_holiday_calendar\",\n  \"hr_i9\",\n  \"hr_i9_document\",\n  \"hr_incident\",\n  \"hr_incident_party\",\n  \"hr_interview\",\n  \"hr_interview_kit\",\n  \"hr_job_title\",\n  \"hr_jurisdiction\",\n  \"hr_jurisdiction_rule\",\n  \"hr_jurisdiction_rule_class\",\n  \"hr_jurisdiction_rule_org_decision\",\n  \"hr_jurisdiction_rule_test\",\n  \"hr_kiosk_device\",\n  \"hr_kiosk_session\",\n  \"hr_labor_target\",\n  \"hr_leave_case\",\n  \"hr_leave_enrollment\",\n  \"hr_leave_ledger\",\n  \"hr_leave_policy\",\n  \"hr_leave_request\",\n  \"hr_legal_hold\",\n  \"hr_legal_hold_item\",\n  \"hr_location\",\n  \"hr_new_hire_report\",\n  \"hr_offer\",\n  \"hr_opening\",\n  \"hr_overtime_alert\",\n  \"hr_overtime_alert_rule\",\n  \"hr_overtime_preapproval\",\n  \"hr_pay_group\",\n  \"hr_pay_period\",\n  \"hr_pay_period_employment\",\n  \"hr_payroll_export\",\n  \"hr_payroll_export_line\",\n  \"hr_position_assignment\",\n  \"hr_posting\",\n  \"hr_posting_publication\",\n  \"hr_provider_binding\",\n  \"hr_provider_event\",\n  \"hr_provisioning_result\",\n  \"hr_punch\",\n  \"hr_recalculation_batch\",\n  \"hr_record_class\",\n  \"hr_records_request\",\n  \"hr_reference_check\",\n  \"hr_reporting_line\",\n  \"hr_requisition\",\n  \"hr_restricted_note\",\n  \"hr_retention_rule\",\n  \"hr_review\",\n  \"hr_review_cycle\",\n  \"hr_review_peer_nomination\",\n  \"hr_review_response\",\n  \"hr_review_template\",\n  \"hr_role_assignment\",\n  \"hr_schedule\",\n  \"hr_schedule_change\",\n  \"hr_schedule_guidance\",\n  \"hr_schedule_template\",\n  \"hr_schedule_template_shift\",\n  \"hr_scorecard\",\n  \"hr_separation\",\n  \"hr_shift\",\n  \"hr_shift_claim\",\n  \"hr_staffing_requirement\",\n  \"hr_survey\",\n  \"hr_survey_invitation\",\n  \"hr_survey_question\",\n  \"hr_survey_response\",\n  \"hr_tax_registration\",\n  \"hr_tax_withholding\",\n  \"hr_time_adjustment\",\n  \"hr_training_assignment\",\n  \"hr_training_attempt\",\n  \"hr_transcript_entry\",\n  \"hr_verification_letter_request\",\n  \"hr_work_interval\",\n  \"hr_workflow_binding\",\n  \"hr_workflow_decision\",\n  \"hr_workflow_definition\",\n  \"hr_workflow_event\",\n  \"hr_workflow_failure\",\n  \"hr_workflow_flow_type\",\n  \"hr_workflow_instance\",\n  \"hr_workflow_step\",\n  \"hr_workflow_step_definition\",\n  \"hr_workweek\",\n  \"html_extraction\",\n  \"iam_access_audit\",\n  \"iam_access_setup\",\n  \"iam_api_key\",\n  \"iam_emergency_door_request\",\n  \"iam_oauth_app\",\n  \"iam_org_availability_key\",\n  \"iam_org_domain\",\n  \"iam_org_domain_route\",\n  \"iam_publish_binding\",\n  \"iam_publisher_verification\",\n  \"iam_read_lane_v2_rollout\",\n  \"iam_record_seat_change\",\n  \"iam_sign_in_event\",\n  \"iam_world_namespace\",\n  \"iam_world_publish_admission\",\n  \"idempotency\",\n  \"industry\",\n  \"industry_curator\",\n  \"infra_status\",\n  \"ingest_runs\",\n  \"integration_connection\",\n  \"integration_connection_resource\",\n  \"interview_decision_interview\",\n  \"interview_decision_question\",\n  \"interview_document_revision\",\n  \"interview_hole\",\n  \"interview_question\",\n  \"interview_session\",\n  \"interview_turn\",\n  \"invitation\",\n  \"invitation_code\",\n  \"invitation_request\",\n  \"io_comment\",\n  \"io_contract\",\n  \"io_import\",\n  \"io_outbox\",\n  \"item\",\n  \"item_mastery\",\n  \"judge_verdict\",\n  \"jurisdiction_policy\",\n  \"keyword_classification_queue\",\n  \"kg_alert\",\n  \"kg_chunk_entities\",\n  \"kg_chunks\",\n  \"kg_clusters\",\n  \"kg_edges\",\n  \"kg_entities\",\n  \"kg_entity_aliases\",\n  \"kg_suggestion_ack\",\n  \"kg_sweep_queue\",\n  \"kg_sweep_run\",\n  \"kg_sweep_state\",\n  \"kg_value_match\",\n  \"knob_override\",\n  \"knob_override_audit\",\n  \"knob_rung_lock\",\n  \"knob_scope_kind\",\n  \"knob_write_door\",\n  \"league_membership\",\n  \"learn_doc\",\n  \"library_doc\",\n  \"lifecycle_archive\",\n  \"lifecycle_archive_row\",\n  \"lifecycle_audit\",\n  \"lifecycle_entity_plan\",\n  \"lifecycle_map_build\",\n  \"lifecycle_reference_map\",\n  \"lifecycle_run\",\n  \"lifecycle_tier_ledger\",\n  \"location\",\n  \"mandate\",\n  \"mandate_advance_batch_row\",\n  \"mandate_binding\",\n  \"mandate_candidate\",\n  \"mandate_candidate_run\",\n  \"mandate_candidate_run_payload\",\n  \"mandate_goal_clauses\",\n  \"mandate_observation\",\n  \"mandate_proposal\",\n  \"mandate_readiness_verdict\",\n  \"mandate_reference\",\n  \"mandate_scan\",\n  \"mandate_treatment\",\n  \"marketing_initiative\",\n  \"masterwork_corpus_item\",\n  \"masterwork_run\",\n  \"masterwork_run_kind\",\n  \"masterwork_source\",\n  \"math_course_structure\",\n  \"math_problem\",\n  \"matrx_action_ledger\",\n  \"mcp_config\",\n  \"mcp_server\",\n  \"mcp_user_conn\",\n  \"media_capture_handoff\",\n  \"media_catalog_setting\",\n  \"media_library_item\",\n  \"media_selection_item\",\n  \"media_selection_job\",\n  \"media_source_library\",\n  \"meet_call_invite\",\n  \"meet_chat_message\",\n  \"meet_connection\",\n  \"meet_invitee\",\n  \"meet_meeting\",\n  \"meet_note\",\n  \"meet_occurrence_override\",\n  \"meet_participant\",\n  \"meet_recording\",\n  \"meet_session\",\n  \"meet_transcript_segment\",\n  \"membership\",\n  \"membership_grant\",\n  \"memory_trial\",\n  \"memory_trial_step\",\n  \"merge_field_provenance\",\n  \"message\",\n  \"message_template\",\n  \"message_template_detail\",\n  \"meta_excluded_schema\",\n  \"meta_table_stats_history\",\n  \"metadata_reserved_keys\",\n  \"migration_log\",\n  \"mtx_media_heal_queue\",\n  \"mtx_public_url_guard\",\n  \"ner_shadow\",\n  \"note\",\n  \"notification\",\n  \"notification_channel_preference\",\n  \"notification_event_override\",\n  \"notification_event_type\",\n  \"notification_preference\",\n  \"notification_submission\",\n  \"notify_outsider_door_baseline\",\n  \"oauth_handoff_claim\",\n  \"opinion_clusters\",\n  \"opinions\",\n  \"ops_auth_lock_watchdog_log\",\n  \"ops_check_item\",\n  \"ops_check_run\",\n  \"ops_db_host_sample\",\n  \"ops_issue_class\",\n  \"ops_issue_event\",\n  \"ops_perf_client_event\",\n  \"ops_perf_sample\",\n  \"ops_perf_statement_snapshot\",\n  \"ops_proof_check\",\n  \"ops_proof_run\",\n  \"ops_proof_scenario\",\n  \"ops_source_read_cache\",\n  \"ops_test_replay_cache\",\n  \"org_admin_audit\",\n  \"org_change_policy\",\n  \"org_chart_publication\",\n  \"org_context_ledger\",\n  \"org_industries\",\n  \"org_member_control\",\n  \"org_module_config\",\n  \"org_move_txn\",\n  \"org_plan\",\n  \"org_sweep_list\",\n  \"organization\",\n  \"organization_preferences\",\n  \"organization_visibility_version\",\n  \"output_feedback\",\n  \"outreach_acceptance\",\n  \"page_extraction_job\",\n  \"page_extraction_page_run\",\n  \"page_extraction_results\",\n  \"page_extraction_runs\",\n  \"page_intent_queue\",\n  \"page_mapping_queue\",\n  \"page_vitals\",\n  \"part_config\",\n  \"part_config_sub\",\n  \"party\",\n  \"party_contact_point\",\n  \"passkey_credential\",\n  \"pc_article\",\n  \"pc_episode\",\n  \"pc_show\",\n  \"pc_studio_run\",\n  \"pc_studio_run_asset\",\n  \"pdf_consolidation_log\",\n  \"pdf_redaction_audit\",\n  \"pdf_redaction_key_escrow\",\n  \"permission_grant\",\n  \"personal_data_column\",\n  \"plan_cms_fill_item\",\n  \"plan_cms_fill_job\",\n  \"plan_entity\",\n  \"plan_node\",\n  \"plan_node_artifact\",\n  \"plan_node_step\",\n  \"plan_profile\",\n  \"platform_action_request\",\n  \"platform_actor_session\",\n  \"platform_actor_token\",\n  \"platform_actor_token_event\",\n  \"platform_class_approval_by_arman\",\n  \"platform_class_approval_by_org_admin\",\n  \"platform_continued_access\",\n  \"platform_cutover_census_run\",\n  \"platform_cutover_evaluation_replaced\",\n  \"platform_cutover_evaluation_write\",\n  \"platform_cutover_seam\",\n  \"platform_cutover_seam_measure\",\n  \"platform_cutover_seam_press\",\n  \"platform_dated_change\",\n  \"platform_doors_only_pending_cutover\",\n  \"platform_google_calendar_event_create_intent\",\n  \"platform_google_task_create_intent\",\n  \"platform_hidden_item\",\n  \"platform_kernel_fingerprint_record\",\n  \"platform_outcome_event\",\n  \"platform_outsider_consumer\",\n  \"platform_provision_base_contract_pending\",\n  \"platform_reachability\",\n  \"platform_reachability_rebuild_pending\",\n  \"platform_realtime_topic_prefix\",\n  \"platform_reference_category\",\n  \"platform_reference_declaration\",\n  \"platform_repo\",\n  \"platform_saved_view\",\n  \"platform_schema\",\n  \"platform_secure_delivery\",\n  \"platform_share_link\",\n  \"platform_strict_class_probe\",\n  \"podcast_race\",\n  \"position\",\n  \"presentation\",\n  \"processed_document\",\n  \"processed_document_page\",\n  \"product_capture_file\",\n  \"product_capture_item\",\n  \"product_capture_payload\",\n  \"product_capture_product\",\n  \"product_capture_question\",\n  \"project\",\n  \"provider_account\",\n  \"provider_account_credential\",\n  \"provision\",\n  \"provision_generate_target\",\n  \"provision_grant\",\n  \"provision_marker\",\n  \"provision_rule_message\",\n  \"provision_schema\",\n  \"provision_shape_debt\",\n  \"provision_snapshot\",\n  \"provision_spec\",\n  \"provision_spec_grandfather\",\n  \"provision_vocabulary\",\n  \"public_compat_wrapper\",\n  \"public_placement_baseline\",\n  \"public_placement_census\",\n  \"public_placement_domain\",\n  \"public_restore_permit\",\n  \"purpose\",\n  \"quiz_session\",\n  \"rag_ingest_run\",\n  \"rag_library_audit_log\",\n  \"rate_limit_buckets\",\n  \"reachability_pending\",\n  \"read_mask_kept\",\n  \"recompute_queue\",\n  \"record\",\n  \"record_alias\",\n  \"record_computed\",\n  \"record_follow\",\n  \"redaction_mapping\",\n  \"relationship_rule\",\n  \"research_analysis\",\n  \"research_content\",\n  \"research_context_bundle\",\n  \"research_document\",\n  \"research_intent\",\n  \"research_keyword\",\n  \"research_media\",\n  \"research_source\",\n  \"research_synthesis\",\n  \"research_tag\",\n  \"research_template\",\n  \"research_topic\",\n  \"retention_policy\",\n  \"retrieval_audit\",\n  \"review_queue\",\n  \"route_manifest_entry\",\n  \"row_version\",\n  \"rulebook\",\n  \"run_approval\",\n  \"run_approval_event\",\n  \"runtime_operation_stream\",\n  \"runtime_operation_stream_batch\",\n  \"sandbox_instance\",\n  \"sch_agent_task\",\n  \"sch_run\",\n  \"sch_task\",\n  \"sch_trigger\",\n  \"scheduler_automation_run_subject\",\n  \"schema_client_exposure\",\n  \"schema_migration_ledger\",\n  \"schema_migration_legacy\",\n  \"schema_migration_slot_grandfather\",\n  \"schema_templates\",\n  \"scope\",\n  \"scope_association_suggestion\",\n  \"scope_door_registry\",\n  \"scope_item_value_suggestion\",\n  \"scope_suggestion\",\n  \"scope_type\",\n  \"scrape_domain\",\n  \"scrape_domain_settings\",\n  \"scrape_failure_log\",\n  \"scrape_parsed_page\",\n  \"scrape_path_override\",\n  \"scrape_path_pattern\",\n  \"scrape_retry_queue\",\n  \"scraper_comparison_run\",\n  \"scraper_data_fetch_job\",\n  \"scraper_data_fetch_job_row\",\n  \"scraper_data_source\",\n  \"search_item\",\n  \"seo_ai_capability\",\n  \"seo_ai_visibility_brand_check\",\n  \"seo_ai_visibility_citation\",\n  \"seo_ai_visibility_claim\",\n  \"seo_ai_visibility_design_artifact\",\n  \"seo_ai_visibility_panel\",\n  \"seo_ai_visibility_panel_version\",\n  \"seo_ai_visibility_response\",\n  \"seo_ai_visibility_signal\",\n  \"seo_backlink\",\n  \"seo_backlink_change_event\",\n  \"seo_backlink_dimension_snapshot\",\n  \"seo_backlink_observation\",\n  \"seo_backlink_snapshot\",\n  \"seo_change_assessment\",\n  \"seo_change_event\",\n  \"seo_change_item\",\n  \"seo_change_metric\",\n  \"seo_change_set\",\n  \"seo_change_theory\",\n  \"seo_collection_run\",\n  \"seo_competitor\",\n  \"seo_competitor_observation\",\n  \"seo_competitor_opportunity\",\n  \"seo_coverage_mention\",\n  \"seo_coverage_tracker\",\n  \"seo_dimension_value_matcher\",\n  \"seo_engine_schedule\",\n  \"seo_geo_place\",\n  \"seo_gsc_dig_rule\",\n  \"seo_keyword\",\n  \"seo_keyword_class_rule\",\n  \"seo_keyword_edge\",\n  \"seo_keyword_facet\",\n  \"seo_keyword_market\",\n  \"seo_keyword_market_observation\",\n  \"seo_keyword_place\",\n  \"seo_keyword_saved_view\",\n  \"seo_keyword_topic\",\n  \"seo_landscape_brief\",\n  \"seo_link_gap_domain\",\n  \"seo_link_gap_match\",\n  \"seo_map_facet\",\n  \"seo_map_facet_value\",\n  \"seo_map_topic\",\n  \"seo_page_measurement_health\",\n  \"seo_page_performance\",\n  \"seo_pr_moment\",\n  \"seo_provider_call\",\n  \"seo_provider_task\",\n  \"seo_rank_observation\",\n  \"seo_rank_target\",\n  \"seo_raw_payload\",\n  \"seo_referring_domain_profile\",\n  \"seo_reputation_case\",\n  \"seo_search_performance_daily\",\n  \"seo_serp_mention\",\n  \"seo_serp_opportunity\",\n  \"seo_serp_result\",\n  \"seo_serp_snapshot\",\n  \"seo_site_geo_area\",\n  \"seo_site_keyword_offering\",\n  \"seo_site_keyword_value\",\n  \"seo_site_offering_value\",\n  \"seo_site_topic_value\",\n  \"seo_site_value_combo\",\n  \"seo_site_value_worth\",\n  \"seo_site_vocabulary\",\n  \"seo_source_request\",\n  \"seo_starter_pack\",\n  \"seo_starter_pack_item\",\n  \"seo_story_angle\",\n  \"seo_topic\",\n  \"seo_topical_map\",\n  \"seo_tracker_story\",\n  \"seo_web_analytics_daily\",\n  \"share_link_password\",\n  \"shareable_resource_registry\",\n  \"shared_canvas_item\",\n  \"short_link\",\n  \"sign_in_fk_legacy\",\n  \"skill\",\n  \"skill_detail\",\n  \"sms_consent\",\n  \"sms_conversation\",\n  \"sms_message\",\n  \"sms_message_media\",\n  \"sms_notification\",\n  \"sms_notification_preference\",\n  \"sms_phone_number\",\n  \"sms_rate_limits\",\n  \"sms_webhook_logs\",\n  \"social_account_insight_daily\",\n  \"social_ad\",\n  \"social_captured_post\",\n  \"social_kpi_goal\",\n  \"social_own_post_metric\",\n  \"social_post\",\n  \"social_post_analysis\",\n  \"social_post_comment\",\n  \"social_post_metric_snapshot\",\n  \"social_post_stat\",\n  \"social_post_transcript\",\n  \"social_profile\",\n  \"social_profile_snapshot\",\n  \"social_remix_output\",\n  \"social_swipe_collection\",\n  \"social_tracked_account\",\n  \"social_video_composition_version\",\n  \"social_video_project\",\n  \"social_video_variant\",\n  \"social_watchlist_hit\",\n  \"soft_delete_cascade_job\",\n  \"soft_delete_edge\",\n  \"source_authority\",\n  \"space_payload\",\n  \"stage_ref_kind\",\n  \"stamped_write_table\",\n  \"structure\",\n  \"studio_cleaned_segments\",\n  \"studio_concept_items\",\n  \"studio_documents\",\n  \"studio_module_segments\",\n  \"studio_raw_segments\",\n  \"studio_recording_chunks\",\n  \"studio_recording_segments\",\n  \"studio_run\",\n  \"studio_session\",\n  \"studio_session_settings\",\n  \"study_attempt\",\n  \"study_goal\",\n  \"study_media\",\n  \"study_plan\",\n  \"study_plan_block\",\n  \"study_plan_day\",\n  \"study_reminder_context\",\n  \"study_reminder_delivery\",\n  \"study_session\",\n  \"study_source_chunk\",\n  \"study_streak\",\n  \"study_structured_section\",\n  \"superseded_policy\",\n  \"support_session\",\n  \"support_session_event\",\n  \"surface\",\n  \"system_announcement\",\n  \"system_context_item\",\n  \"system_context_item_org_value\",\n  \"system_error\",\n  \"system_orgs\",\n  \"system_write_failure\",\n  \"t13_backfill_ledger\",\n  \"t13_default_ledger\",\n  \"t13_row_column_events\",\n  \"tag\",\n  \"task\",\n  \"task_user_state\",\n  \"taxonomy_node\",\n  \"team\",\n  \"template_context_items\",\n  \"template_scope_types\",\n  \"templates\",\n  \"test_handset_inbox\",\n  \"test_handset_verification\",\n  \"thread\",\n  \"tool\",\n  \"tool_battle\",\n  \"tool_battle_cell\",\n  \"tool_binding\",\n  \"tool_bundle\",\n  \"tool_call\",\n  \"tool_call_facts\",\n  \"tool_canary_run\",\n  \"tool_catalog_cache\",\n  \"tool_catalog_call\",\n  \"tool_catalog_call_attempt\",\n  \"tool_catalog_call_detail\",\n  \"tool_catalog_endpoint\",\n  \"tool_catalog_entry\",\n  \"tool_catalog_provider\",\n  \"tool_definition_version\",\n  \"tool_executor\",\n  \"tool_feature_scorecard\",\n  \"tool_surface_defaults\",\n  \"tool_test_sample\",\n  \"tool_ui\",\n  \"tool_ui_incident\",\n  \"tool_ui_version\",\n  \"topic_placement_queue\",\n  \"transcript\",\n  \"trigger_event\",\n  \"udt_document\",\n  \"udt_document_snapshot\",\n  \"udt_workbook_snapshot\",\n  \"ui_client\",\n  \"ui_decision_pick\",\n  \"ui_surface_action\",\n  \"ui_surface_agent_pref\",\n  \"ui_surface_agent_role\",\n  \"ui_surface_client_tool\",\n  \"ui_surface_config\",\n  \"ui_surface_item_type\",\n  \"ui_surface_value\",\n  \"ui_surface_write_target\",\n  \"univer_payload\",\n  \"unsubscribe_token\",\n  \"uploads_inflight\",\n  \"user\",\n  \"user_achievement\",\n  \"user_acquisition_facts\",\n  \"user_acquisition_facts_stored\",\n  \"user_acquisition_facts_stored_watermark\",\n  \"user_active_context\",\n  \"user_analysis_preference\",\n  \"user_email_preference\",\n  \"user_entity_state\",\n  \"user_feedback\",\n  \"user_follows\",\n  \"user_form_profile\",\n  \"user_markdown_sample\",\n  \"user_memory\",\n  \"user_preference\",\n  \"user_profile\",\n  \"user_secret\",\n  \"user_secret_audit\",\n  \"user_secret_grant\",\n  \"user_stat\",\n  \"user_storage_usage\",\n  \"user_surface_state\",\n  \"users_calendar_feed\",\n  \"vault_fill_approvals\",\n  \"vault_fill_devices\",\n  \"vault_fill_nonces\",\n  \"visibility_cache\",\n  \"visibility_epoch\",\n  \"voice\",\n  \"war_room\",\n  \"wbx_demo\",\n  \"wbx_guidance\",\n  \"wbx_highlight\",\n  \"wbx_pattern\",\n  \"wbx_recipe\",\n  \"wbx_screenshot\",\n  \"wbx_seo_audit\",\n  \"wc_claim\",\n  \"wc_impairment_definition\",\n  \"wc_injury\",\n  \"wc_report\",\n  \"web_analysis_item\",\n  \"web_brand\",\n  \"web_brand_asset\",\n  \"web_brand_choice\",\n  \"web_brand_exclusion\",\n  \"web_brand_offering\",\n  \"web_brand_persona\",\n  \"web_brand_relation_kind\",\n  \"web_brand_review\",\n  \"web_brand_testimony\",\n  \"web_business_fact\",\n  \"web_business_location\",\n  \"web_channel_analytics_daily\",\n  \"web_crawl_event\",\n  \"web_crawl_preset\",\n  \"web_crawl_schedule\",\n  \"web_crawl_session\",\n  \"web_crawl_url\",\n  \"web_discovered_item\",\n  \"web_domain_category\",\n  \"web_domain_category_observation\",\n  \"web_finding\",\n  \"web_gsc_page_stat\",\n  \"web_link_edge\",\n  \"web_listing_publisher\",\n  \"web_location_listing\",\n  \"web_news_item\",\n  \"web_offering_template\",\n  \"web_page\",\n  \"web_page_content\",\n  \"web_page_evidence\",\n  \"web_page_sitemap\",\n  \"web_property\",\n  \"web_provider\",\n  \"web_result\",\n  \"web_screenshot\",\n  \"web_search_review\",\n  \"web_site\",\n  \"web_site_endpoint_rule\",\n  \"web_site_item_config\",\n  \"web_site_offering\",\n  \"web_sitemap\",\n  \"web_snapshot\",\n  \"web_tag_manager_snapshot\",\n  \"web_temp_brand_firmographic\",\n  \"web_temp_brand_presence\",\n  \"web_temp_brand_recognition\",\n  \"web_voice_fingerprint\",\n  \"web_youtube_video\",\n  \"webhook_deliveries\",\n  \"webhook_dispatch_state\",\n  \"webhook_test_receipt\",\n  \"webhooks\",\n  \"wf_node_data_slot\",\n  \"work_claim\",\n  \"work_item\",\n  \"workbook\",\n  \"worker_heartbeat\",\n  \"workflow\",\n  \"workflow_card\",\n  \"workflow_checkpoint\",\n  \"workflow_checkpoint_value\",\n  \"workflow_comparison\",\n  \"workflow_definition_overview\",\n  \"workflow_definition_version\",\n  \"workflow_idempotency\",\n  \"workflow_job\",\n  \"workflow_node_events\",\n  \"workflow_node_outcome\",\n  \"workflow_plan\",\n  \"workflow_plan_event\",\n  \"workflow_plan_sample\",\n  \"workflow_recovery_audit\",\n  \"workflow_review_issue\",\n  \"workflow_run\",\n  \"workflow_run_cost\",\n  \"workflow_run_facts\",\n  \"workflow_run_log\",\n  \"workflow_runtime_surface\",\n  \"workflow_step_facts\",\n  \"workflow_step_result\",\n  \"workflow_template\",\n  \"workflow_trigger\",\n  \"workflow_trigger_fire\",\n  \"workflow_work_item\",\n  \"write_guard_key\",\n  \"youtube_quota_day\",\n  \"youtube_search\",\n  \"youtube_video\",\n];\n\n/**\n * Pretty display metadata for DB schemas, mirrored from `platform.schemas`\n * (admin-writable via `admin_upsert_schema`). Tier-1 buckets for reference\n * type choosers and admin surfaces.\n */\nexport const SCHEMA_DISPLAY: Record<\n  string,\n  { readonly label: string; readonly sortOrder: number; readonly isActive: boolean }\n> = {\n  \"public\": { label: \"General\", sortOrder: 10, isActive: true },\n  \"agent\": { label: \"Agents\", sortOrder: 20, isActive: true },\n  \"app\": { label: \"Apps\", sortOrder: 25, isActive: true },\n  \"skill\": { label: \"Skills\", sortOrder: 30, isActive: true },\n  \"workflow\": { label: \"Workflows\", sortOrder: 35, isActive: true },\n  \"chat\": { label: \"Chat\", sortOrder: 40, isActive: true },\n  \"files\": { label: \"Files\", sortOrder: 45, isActive: true },\n  \"code\": { label: \"Code\", sortOrder: 50, isActive: true },\n  \"workbench\": { label: \"Workbench\", sortOrder: 55, isActive: true },\n  \"projects\": { label: \"Workspace\", sortOrder: 60, isActive: true },\n  \"transcripts\": { label: \"Transcripts\", sortOrder: 65, isActive: true },\n  \"podcast\": { label: \"Podcasts\", sortOrder: 70, isActive: true },\n  \"education\": { label: \"Education\", sortOrder: 75, isActive: true },\n  \"research\": { label: \"Research\", sortOrder: 80, isActive: true },\n  \"rag\": { label: \"Knowledge\", sortOrder: 85, isActive: true },\n  \"crm\": { label: \"CRM\", sortOrder: 87, isActive: true },\n  \"plan\": { label: \"Content Planning\", sortOrder: 88, isActive: true },\n  \"web\": { label: \"Marketing & Web\", sortOrder: 90, isActive: true },\n  \"scraper\": { label: \"Web Scraper\", sortOrder: 95, isActive: true },\n  \"docproc\": { label: \"Document Processing\", sortOrder: 100, isActive: true },\n  \"pdf\": { label: \"PDF\", sortOrder: 105, isActive: true },\n  \"canvas\": { label: \"Canvas\", sortOrder: 110, isActive: true },\n  \"content_ir\": { label: \"Structured Content\", sortOrder: 115, isActive: true },\n  \"context\": { label: \"Context\", sortOrder: 120, isActive: true },\n  \"communication\": { label: \"Communication\", sortOrder: 125, isActive: true },\n  \"legal\": { label: \"Legal\", sortOrder: 130, isActive: true },\n  \"scheduler\": { label: \"Scheduling\", sortOrder: 135, isActive: true },\n  \"ai\": { label: \"AI Models\", sortOrder: 140, isActive: true },\n  \"tool\": { label: \"Tools\", sortOrder: 145, isActive: true },\n  \"extend\": { label: \"Browser Extension\", sortOrder: 150, isActive: true },\n  \"users\": { label: \"Users\", sortOrder: 155, isActive: true },\n  \"user\": { label: \"User Data\", sortOrder: 160, isActive: true },\n  \"iam\": { label: \"Access & Identity\", sortOrder: 165, isActive: true },\n  \"platform\": { label: \"Platform\", sortOrder: 170, isActive: true },\n  \"reg\": { label: \"Registry\", sortOrder: 175, isActive: true },\n  \"runtime\": { label: \"Runtime\", sortOrder: 180, isActive: true },\n  \"ui\": { label: \"UI\", sortOrder: 185, isActive: true },\n  \"admin\": { label: \"Admin\", sortOrder: 190, isActive: true },\n  \"deprecated\": { label: \"Graveyard\", sortOrder: 900, isActive: false },\n};\n\n/**\n * Admin-defined reference chooser buckets, mirrored from\n * `platform.reference_categories` (`admin_upsert_reference_category`).\n * An entity type's `referenceCategory` points here; unassigned types\n * bucket by schema via `SCHEMA_DISPLAY`.\n */\nexport const REFERENCE_CATEGORY_DISPLAY: Record<\n  string,\n  { readonly label: string; readonly sortOrder: number; readonly isActive: boolean }\n> = {\n\n};\n\n// Pure: a host that never calls the guard must not pay for the set (importing a file does no work).\nconst ENTITY_TYPE_TOKEN_SET: ReadonlySet<string> = /* @__PURE__ */ new Set(ENTITY_TYPE_TOKENS);\n\n/** Runtime guard: is `value` a registered entity token? Narrows to the union. */\nexport function isEntityTypeToken(value: unknown): value is EntityTypeToken {\n  return typeof value === \"string\" && ENTITY_TYPE_TOKEN_SET.has(value);\n}\n","// core/rpcResult.ts — @ai-matrx/associations/core\n//\n// The never-throw result funnel every service method in this package builds\n// through — ported behavior-verbatim from matrx-frontend\n// `features/scopes/service/rpcResult.ts` (associations extraction W2,\n// 2026-08-29), with the seams inverted:\n//\n//   • console.warn / console.error → the REQUIRED errorSink port (the scream\n//     seam). `createPgErrorMapper(errorSink)` binds the sink once; services\n//     receive the bound mapper.\n//   • `isTransportFailure` is the one body in `@ai-matrx/api/net` (its\n//     NetError-class branches never fire here — /core makes no resilientFetch\n//     calls — and every plain-object/TypeError/offline shape is identical).\n//   • NEW (the demanded-schema scream, design Decision 4): a PostgREST\n//     PGRST202 — \"could not find the function\" — on any demanded RPC maps to\n//     the `demanded_schema_violation` code, names this package's contract in\n//     its message, and ALWAYS reaches the errorSink. A consumer pointed at a\n//     database without our schema gets one unambiguous scream, not a mystery\n//     toast.\n//\n// 🚨 A POSTGREST ERROR IS NOT AN `Error`. supabase-js resolves a failed\n// request with a PLAIN OBJECT (`{ code, message, details, hint }`) parsed\n// straight from the response body — `PostgrestError` is only ever *thrown*\n// when `shouldThrowOnError` is set, which this package never sets. So an\n// `e instanceof Error ? e.message : <generic>` ternary discards the real\n// message on EVERY genuine database failure. Read the fields off the OBJECT,\n// and keep the Postgres/PostgREST code in `detail` so the next failure is\n// attributable instead of anonymous. (Incident: CRM record page 2026-08-14 —\n// a real `57014 statement timeout` reached the UI as \"Unexpected error\n// talking to Supabase\".)\n//\n// Sink policy (mirrors the original's console split):\n//   • transport failures (browser offline/asleep/mid-handoff) report with\n//     code \"transport_failure\" and `context.transient: true` — they carry no\n//     database refusal an engineer can act on, and filing them as errors\n//     buries real failures;\n//   • THROWN application errors (identity port refusals, bugs) report with\n//     their mapped code — the original console.error'ed these;\n//   • plain PostgREST result errors do NOT reach the sink (the host's\n//     dataSource layer is presumed to capture them with richer call-site\n//     context, exactly as matrx-frontend's supabaseErrorCapture does — a\n//     second sink event per request is a duplicate repair-queue row) —\n//     EXCEPT PGRST202, which always screams.\n\nimport type {\n  AssociationsRpcError,\n} from \"../results\";\nimport { isTransportFailure } from \"@ai-matrx/api/net\";\nimport type { ErrorSink } from \"../ports\";\n\nexport function err(\n  code: AssociationsRpcError[\"code\"],\n  message: string,\n  detail?: unknown,\n  hint?: string,\n): { ok: false; error: AssociationsRpcError } {\n  const error: AssociationsRpcError = { code, message };\n  if (detail !== undefined) error.detail = detail;\n  if (hint !== undefined) error.hint = hint;\n  return { ok: false, error };\n}\n\nexport function ok<T>(data: T): { ok: true; data: T } {\n  return { ok: true, data };\n}\n\nfunction isPostgrestResultError(e: unknown): boolean {\n  if (!e || typeof e !== \"object\") return false;\n  const value = e as { code?: unknown; message?: unknown };\n  return typeof value.code === \"string\" && typeof value.message === \"string\";\n}\n\n/**\n * Pull `code` / `message` / `hint` off whatever the dataSource handed us.\n *\n * Three shapes reach here and only the first is common:\n *   1. a PLAIN object from PostgREST — `{ code, message, details, hint }`\n *   2. a thrown `Error` (network stack, the identity port's refusal, a bug)\n *   3. something else entirely (a string, null) from a path we don't own\n */\nfunction readPgFields(e: unknown): {\n  pgCode: string | null;\n  pgMessage: string | null;\n  pgHint: string | undefined;\n} {\n  if (e && typeof e === \"object\") {\n    const o = e as { code?: unknown; message?: unknown; hint?: unknown };\n    return {\n      pgCode: typeof o.code === \"string\" && o.code ? o.code : null,\n      // `Error` instances land here too — `message` is an own/inherited\n      // string property either way, so one read covers both shapes.\n      pgMessage: typeof o.message === \"string\" && o.message ? o.message : null,\n      pgHint: typeof o.hint === \"string\" && o.hint ? o.hint : undefined,\n    };\n  }\n  return { pgCode: null, pgMessage: null, pgHint: undefined };\n}\n\nexport type PgErrorMapper = (e: unknown) => AssociationsRpcError;\nexport type PgErrorPairMapper = (\n  e: unknown,\n) => [AssociationsRpcError[\"code\"], string, unknown, string | undefined];\n\nexport interface RpcResultHelpers {\n  ok: typeof ok;\n  err: typeof err;\n  mapPgError: PgErrorMapper;\n  mapPgErrorPair: PgErrorPairMapper;\n}\n\n/**\n * Bind the loud funnel to the host's errorSink. Every failure in this\n * package's services passes through the returned `mapPgError` exactly once.\n */\n/**\n * How every signed-out sentence starts (the host app's annotations speak the\n * same words), so a kept error string still says which remedy it needs.\n */\nexport const SIGNED_OUT_LEAD = \"You're signed out\";\nexport const SIGNED_OUT_MESSAGE = `${SIGNED_OUT_LEAD}. Sign in again — your text is kept here.`;\n\nexport function isSignedOutMessage(text: string | null | undefined): boolean {\n  return typeof text === \"string\" && text.startsWith(SIGNED_OUT_LEAD);\n}\n\nexport function createRpcResultHelpers(\n  errorSink: ErrorSink,\n  sessionAttached?: () => boolean,\n): RpcResultHelpers {\n  function mapPgError(e: unknown): AssociationsRpcError {\n    // A signed-out visitor is a state, not a fault: the identity port's own\n    // \"not authenticated\" refusal (matched by name, as the host's catchers do)\n    // answers `unauthorized` and never reaches the error sink or the console.\n    if ((e as { name?: unknown } | null)?.name === \"NotAuthenticatedError\")\n      return { code: \"unauthorized\", message: SIGNED_OUT_MESSAGE };\n    const { pgCode, pgMessage, pgHint } = readPgFields(e);\n\n    // THE DEMANDED-SCHEMA SCREAM (design Decision 4). Checked FIRST and\n    // always sunk — a database that cannot answer a demanded function is not\n    // this package's database, and nothing downstream may soften that.\n    if (pgCode === \"PGRST202\") {\n      const message =\n        \"demanded schema violation: the database this client is pointed at \" +\n        \"cannot answer a demanded @ai-matrx/associations RPC (PostgREST \" +\n        \"PGRST202 — function not found). This package DEMANDS the platform \" +\n        `schema (README § The demanded schema). ${pgMessage ?? \"\"}`.trim();\n      errorSink({\n        code: \"demanded_schema_violation\",\n        message,\n        context: { pgCode, detail: e },\n      });\n      const out: AssociationsRpcError = {\n        code: \"demanded_schema_violation\",\n        message,\n        detail: e,\n      };\n      if (pgHint !== undefined) out.hint = pgHint;\n      return out;\n    }\n\n    // Loud before lossy — but through the SINK, per the header's policy.\n    if (isTransportFailure(e)) {\n      errorSink({\n        code: \"transport_failure\",\n        message: \"network unreachable (browser offline?)\",\n        context: { transient: true, detail: e },\n      });\n    } else if (!isPostgrestResultError(e)) {\n      errorSink({\n        code: \"internal\",\n        message: pgMessage ?? \"Unexpected error talking to the data source\",\n        context: { detail: e },\n      });\n    }\n\n    if (pgCode === \"PGRST116\")\n      return { code: \"not_found\", message: \"Not found\" };\n    // The session's JWT is gone or expired — the user is signed out, not broken.\n    if (pgCode === \"PGRST301\" || pgCode === \"PGRST303\" || pgCode === \"28000\")\n      return { code: \"unauthorized\", message: SIGNED_OUT_MESSAGE };\n    if (pgCode === \"42501\") {\n      // An anonymous caller meets \"permission denied for function\" on every\n      // demanded door (authenticated holds EXECUTE on them): a long-lived tab\n      // whose session ended (measured on live 2026-10-17, cmt_list). With the\n      // session attached it is a real grant gap and stays a permission verdict.\n      const anonymous =\n        /permission denied for function/i.test(pgMessage ?? \"\") &&\n        !(sessionAttached?.() ?? false);\n      if (anonymous) return { code: \"unauthorized\", message: SIGNED_OUT_MESSAGE };\n      // Postgres 42501 (insufficient_privilege) — the server's own explicit\n      // verdict, not a zero-row guess.\n      return { code: \"forbidden_org\", message: \"Permission denied\" };\n    }\n    // Postgres killed the statement at the role's `statement_timeout`. The\n    // database is up and the query is valid; it ran out of time. Say so,\n    // because \"unexpected error\" sends the reader hunting for the wrong fault.\n    if (pgCode === \"57014\") {\n      const out: AssociationsRpcError = {\n        code: \"internal\",\n        message: \"The database took too long to respond\",\n        detail: e,\n      };\n      if (pgHint !== undefined) out.hint = pgHint;\n      return out;\n    }\n\n    const out: AssociationsRpcError = {\n      // A real message from PostgREST beats our generic string every time;\n      // the generic one is the LAST resort, not the default.\n      message: pgMessage ?? \"Unexpected error talking to the data source\",\n      code: \"internal\",\n      detail: e,\n    };\n    if (pgHint !== undefined) out.hint = pgHint;\n    return out;\n  }\n\n  function mapPgErrorPair(\n    e: unknown,\n  ): [AssociationsRpcError[\"code\"], string, unknown, string | undefined] {\n    const mapped = mapPgError(e);\n    return [mapped.code, mapped.message, mapped.detail, mapped.hint];\n  }\n\n  return { ok, err, mapPgError, mapPgErrorPair };\n}\n","// AUTO-GENERATED by scripts/generate-entity-types.ts from the live\n// platform.association_types registry — DO NOT EDIT. Regenerate with\n// `pnpm gen:entity-types`; `pnpm check:entity-types` fails when it drifts.\n//\n// The registered LABELS of every named association pair. The database accepts\n// an edge of a named pair only with one of these labels\n// (platform.enforce_known_association), so the association service writes one\n// of them instead of any display name. A pair may register several labels\n// (e.g. document>document: mentions, sub_page). Pairs registered without a\n// label are absent: any label is accepted for them.\n\nexport const ASSOCIATION_TYPE_LABELS: Readonly<Record<string, readonly string[]>> = {\n  \"artifact>processed_document\": [\"source\"],\n  \"assessment>processed_document\": [\"source\"],\n  \"board>board\": [\"board_page\"],\n  \"board>category\": [\"labeled\"],\n  \"board>record\": [\"board_table\"],\n  \"calendar_event>conversation\": [\"conversation_attached_resource\"],\n  \"calendar_event>party\": [\"attendee\"],\n  \"code_file>code_repository\": [\"in_repository\"],\n  \"content_ir_kind_instance>content_ir_kind_instance\": [\"part_of\"],\n  \"conversation>party\": [\"produced_by\"],\n  \"document>category\": [\"labeled\"],\n  \"document>document\": [\"mentions\",\"sub_page\"],\n  \"document>record\": [\"embeds\",\"page_database\"],\n  \"fc_set>processed_document\": [\"source\"],\n  \"file>hr_application\": [\"evidence\"],\n  \"file>hr_employee\": [\"personnel_document\"],\n  \"file>hr_employment\": [\"evidence\"],\n  \"file>hr_incident\": [\"evidence\"],\n  \"file>hr_leave_case\": [\"evidence\"],\n  \"google_document>crm_deal\": [\"attached_to\"],\n  \"google_document>party\": [\"attached_to\"],\n  \"google_document>project\": [\"attached_to\"],\n  \"google_document>task\": [\"attached_to\"],\n  \"hr_candidate>party\": [\"candidate_party\"],\n  \"hr_course>hr_job_title\": [\"role_curriculum\"],\n  \"hr_credential>hr_job_title\": [\"required_credential\"],\n  \"hr_employee>record\": [\"scope_member\"],\n  \"hr_employee>scope\": [\"scope_member\"],\n  \"integration_connection_resource>conversation\": [\"conversation_attached_resource\"],\n  \"media_source_library>social_profile\": [\"catalogs_channel\"],\n  \"media_source_library>youtube_video\": [\"catalogued_source\"],\n  \"message>content_ir_kind_instance\": [\"produced_by\"],\n  \"note>calendar_event\": [\"about\"],\n  \"note>hr_candidate\": [\"hr_note\"],\n  \"note>hr_employee\": [\"hr_note\"],\n  \"note>processed_document\": [\"source\"],\n  \"organization>seo_keyword\": [\"keyword_library\"],\n  \"pc_episode>processed_document\": [\"source\"],\n  \"plan_node>web_brand\": [\"built_from\"],\n  \"processed_document>code_repository\": [\"in_repository\"],\n  \"processed_document>media_source_library\": [\"catalogued_source\"],\n  \"processed_document>record\": [\"about\"],\n  \"processed_document>research_topic\": [\"research_source\"],\n  \"processed_document>scope\": [\"about\"],\n  \"processed_document>social_post\": [\"captured page\"],\n  \"processed_document>social_profile\": [\"captured page\"],\n  \"processed_document>social_tracked_account\": [\"captured page\"],\n  \"processed_document>tag\": [\"about\"],\n  \"processed_document>web_property\": [\"captured page\"],\n  \"processed_document>web_site\": [\"crawled_page\"],\n  \"quiz_session>processed_document\": [\"source\"],\n  \"record>document\": [\"row_body\"],\n  \"research_source>youtube_video\": [\"Canonical YouTube video\"],\n  \"seo_landscape_brief>web_brand\": [\"built_from\"],\n  \"seo_topical_map>web_brand\": [\"built_from\"],\n  \"social_ad>file\": [\"stored media\"],\n  \"social_post>file\": [\"stored media\"],\n  \"social_post>transcript\": [\"post_transcript\"],\n  \"social_post>web_brand\": [\"built_from\"],\n  \"social_profile>file\": [\"stored media\"],\n  \"social_remix_output>social_ad\": [\"source ad\"],\n  \"social_remix_output>social_post\": [\"source post\"],\n  \"social_swipe_collection>social_ad\": [\"saved ad\"],\n  \"social_swipe_collection>social_post\": [\"saved post\"],\n  \"social_swipe_collection>social_profile\": [\"saved profile\"],\n  \"social_tracked_account>party\": [\"crm party\"],\n  \"social_tracked_account>seo_competitor\": [\"website competitor\"],\n  \"social_video_project>agent_run\": [\"Render run\"],\n  \"social_video_project>file\": [\"Output file\"],\n  \"social_video_project>social_post\": [\"Reference post\"],\n  \"social_video_project>web_brand\": [\"Brand\"],\n  \"study_media>processed_document\": [\"source\"],\n  \"transcript>transcript\": [\"corrects\"],\n  \"web_brand_choice>category\": [\"about\"],\n  \"web_brand_choice>seo_ai_visibility_claim\": [\"grew_from\"],\n  \"web_brand_choice>seo_ai_visibility_signal\": [\"grew_from\"],\n  \"web_brand_choice>social_post\": [\"grew_from\"],\n  \"web_brand_choice>web_brand_asset\": [\"grew_from\"],\n  \"web_brand_choice>web_brand_choice\": [\"grew_from\",\"superseded_by\"],\n  \"web_brand_choice>web_brand_offering\": [\"about\",\"grew_from\"],\n  \"web_brand_choice>web_brand_persona\": [\"about\"],\n  \"web_brand_choice>web_brand_review\": [\"grew_from\"],\n  \"web_brand_choice>web_brand_testimony\": [\"grew_from\"],\n  \"web_brand_choice>web_business_fact\": [\"about\",\"grew_from\"],\n  \"web_brand_choice>web_discovered_item\": [\"grew_from\"],\n  \"web_brand_choice>web_gsc_page_stat\": [\"grew_from\"],\n  \"web_brand_choice>web_temp_brand_recognition\": [\"about\"],\n  \"web_discovered_item>party\": [\"caused\"],\n  \"web_discovered_item>web_site\": [\"caused\"],\n  \"web_page>web_brand\": [\"built_from\"],\n  \"web_youtube_video>seo_map_topic\": [\"covers\"],\n  \"youtube_video>transcript\": [\"video_transcript\"],\n};\n\n/** Every registered label for (source → target); empty when the pair names none. */\nexport function registeredEdgeLabels(sourceType: string, targetType: string): readonly string[] {\n  return ASSOCIATION_TYPE_LABELS[`${sourceType}>${targetType}`] ?? [];\n}\n\n/**\n * The label to write for (source → target): the pair's only label; or, when the\n * pair registers several, `preferred` if it is one of them; otherwise undefined\n * (the pair names none, or the caller must name which one).\n */\nexport function registeredEdgeLabel(\n  sourceType: string,\n  targetType: string,\n  preferred?: string | null,\n): string | undefined {\n  const labels = registeredEdgeLabels(sourceType, targetType);\n  if (labels.length === 1) return labels[0];\n  if (preferred && labels.includes(preferred)) return preferred;\n  return undefined;\n}\n\n/**\n * EVERY registered pair, labeled or not, as \"source>target\". The database\n * accepts an edge only in a registered direction (`enforce_known_association`):\n * \"Party attached to a task\" is `party>task`, and `task>party` is refused. A\n * surface reads and writes each kind in the direction registered here — never a\n * hard-coded one.\n */\nexport const ASSOCIATION_PAIRS: ReadonlySet<string> = /* @__PURE__ */ new Set([\n  \"agent>agent\",\n  \"agent>context_item\",\n  \"agent>membership\",\n  \"agent>organization\",\n  \"agent>position\",\n  \"agent>project\",\n  \"agent>record\",\n  \"agent>scope\",\n  \"agent>scope_type\",\n  \"agent>surface\",\n  \"agent>tag\",\n  \"agent>task\",\n  \"agent>team\",\n  \"agent>web_page\",\n  \"agent>workflow\",\n  \"agent_shortcut>project\",\n  \"agent_shortcut>task\",\n  \"agent_shortcut>web_page\",\n  \"agent_term_list>agent\",\n  \"app>record\",\n  \"app>scope\",\n  \"app>tag\",\n  \"app>web_page\",\n  \"artifact>processed_document\",\n  \"artifact>tag\",\n  \"assessment>assessment\",\n  \"assessment>content_ir_kind_instance\",\n  \"assessment>conversation\",\n  \"assessment>dataset\",\n  \"assessment>document\",\n  \"assessment>fc_set\",\n  \"assessment>file\",\n  \"assessment>note\",\n  \"assessment>processed_document\",\n  \"assessment>record\",\n  \"assessment>scope\",\n  \"assessment>scope_type\",\n  \"assessment>structured_list\",\n  \"assessment>study_media\",\n  \"assessment>tag\",\n  \"assessment>transcript\",\n  \"assessment>udt_document\",\n  \"assessment>workbook\",\n  \"board>board\",\n  \"board>category\",\n  \"board>record\",\n  \"board>tag\",\n  \"board>web_brand\",\n  \"calendar_event>conversation\",\n  \"calendar_event>party\",\n  \"canvas_item>tag\",\n  \"code_file>agent\",\n  \"code_file>code_repository\",\n  \"code_file>data_store\",\n  \"code_file>web_page\",\n  \"contact_medium>web_page\",\n  \"content_ir_kind>tag\",\n  \"content_ir_kind_instance>content_ir_kind_instance\",\n  \"content_ir_kind_instance>note\",\n  \"content_ir_kind_instance>project\",\n  \"content_ir_kind_instance>record\",\n  \"content_ir_kind_instance>scope\",\n  \"content_ir_kind_instance>scope_type\",\n  \"content_ir_kind_instance>tag\",\n  \"content_ir_kind_instance>task\",\n  \"content_ir_kind_instance>web_site\",\n  \"conversation>agent\",\n  \"conversation>board\",\n  \"conversation>custom_record\",\n  \"conversation>document\",\n  \"conversation>note\",\n  \"conversation>party\",\n  \"conversation>project\",\n  \"conversation>record\",\n  \"conversation>rulebook\",\n  \"conversation>scope\",\n  \"conversation>scope_type\",\n  \"conversation>tag\",\n  \"conversation>task\",\n  \"conversation>thread\",\n  \"conversation>war_room\",\n  \"conversation>web_brand\",\n  \"conversation>web_page\",\n  \"credential_item>record\",\n  \"credential_item>scope\",\n  \"credential_item>tag\",\n  \"crm_deal>party\",\n  \"crm_deal>tag\",\n  \"crm_deal>task\",\n  \"crm_interaction>crm_deal\",\n  \"crm_interaction>party\",\n  \"crm_interaction>project\",\n  \"custom_record>custom_record\",\n  \"custom_record>hr_candidate\",\n  \"custom_record>hr_employee\",\n  \"custom_record>hr_position_assignment\",\n  \"custom_record>hr_requisition\",\n  \"custom_record>hr_training_assignment\",\n  \"data_store>agent\",\n  \"data_store>project\",\n  \"data_store>task\",\n  \"data_store>war_room\",\n  \"data_store>web_page\",\n  \"dm_message>record\",\n  \"document>agent\",\n  \"document>category\",\n  \"document>conversation\",\n  \"document>document\",\n  \"document>message\",\n  \"document>note\",\n  \"document>project\",\n  \"document>record\",\n  \"document>research_analysis\",\n  \"document>research_content\",\n  \"document>research_document\",\n  \"document>research_synthesis\",\n  \"document>tag\",\n  \"document>task\",\n  \"document>war_room\",\n  \"document>web_page\",\n  \"esign_envelope>tag\",\n  \"esign_template>tag\",\n  \"fc_card>document\",\n  \"fc_card>fc_set\",\n  \"fc_card>file\",\n  \"fc_card>message\",\n  \"fc_card>note\",\n  \"fc_card>research_analysis\",\n  \"fc_card>research_content\",\n  \"fc_card>research_document\",\n  \"fc_card>research_synthesis\",\n  \"fc_set>agent\",\n  \"fc_set>assessment\",\n  \"fc_set>content_ir_kind_instance\",\n  \"fc_set>conversation\",\n  \"fc_set>dataset\",\n  \"fc_set>document\",\n  \"fc_set>fc_set\",\n  \"fc_set>file\",\n  \"fc_set>note\",\n  \"fc_set>processed_document\",\n  \"fc_set>record\",\n  \"fc_set>rulebook\",\n  \"fc_set>scope\",\n  \"fc_set>scope_type\",\n  \"fc_set>structured_list\",\n  \"fc_set>study_media\",\n  \"fc_set>tag\",\n  \"fc_set>transcript\",\n  \"fc_set>udt_document\",\n  \"fc_set>workbook\",\n  \"file>agent\",\n  \"file>agent_term_list\",\n  \"file>conversation\",\n  \"file>crm_deal\",\n  \"file>data_store\",\n  \"file>file\",\n  \"file>hr_application\",\n  \"file>hr_employee\",\n  \"file>hr_employment\",\n  \"file>hr_incident\",\n  \"file>hr_leave_case\",\n  \"file>party\",\n  \"file>project\",\n  \"file>record\",\n  \"file>rulebook\",\n  \"file>scope\",\n  \"file>scope_type\",\n  \"file>tag\",\n  \"file>task\",\n  \"file>thread\",\n  \"file>war_room\",\n  \"file>web_page\",\n  \"file>web_screenshot\",\n  \"folder>web_page\",\n  \"google_document>crm_deal\",\n  \"google_document>party\",\n  \"google_document>project\",\n  \"google_document>task\",\n  \"hr_candidate>custom_record\",\n  \"hr_candidate>party\",\n  \"hr_course>hr_job_title\",\n  \"hr_credential>hr_job_title\",\n  \"hr_employee>custom_record\",\n  \"hr_employee>record\",\n  \"hr_employee>scope\",\n  \"hr_employee>scope_type\",\n  \"hr_position_assignment>custom_record\",\n  \"hr_requisition>custom_record\",\n  \"hr_training_assignment>custom_record\",\n  \"integration_connection_resource>conversation\",\n  \"interview_session>conversation\",\n  \"interview_session>tag\",\n  \"library_doc>data_store\",\n  \"mandate>tag\",\n  \"marketing_initiative>tag\",\n  \"media_source_library>social_profile\",\n  \"media_source_library>youtube_video\",\n  \"membership>agent\",\n  \"membership>membership\",\n  \"membership>position\",\n  \"membership>team\",\n  \"membership>workflow\",\n  \"message>content_ir_kind_instance\",\n  \"message>record\",\n  \"message>task\",\n  \"message_template>record\",\n  \"message_template>scope\",\n  \"message_template>tag\",\n  \"message_template>web_page\",\n  \"note>agent\",\n  \"note>assessment\",\n  \"note>calendar_event\",\n  \"note>crm_deal\",\n  \"note>data_store\",\n  \"note>fc_set\",\n  \"note>file\",\n  \"note>hr_candidate\",\n  \"note>hr_employee\",\n  \"note>message\",\n  \"note>note\",\n  \"note>party\",\n  \"note>processed_document\",\n  \"note>project\",\n  \"note>record\",\n  \"note>research_analysis\",\n  \"note>research_content\",\n  \"note>research_document\",\n  \"note>research_synthesis\",\n  \"note>rulebook\",\n  \"note>scope\",\n  \"note>scope_type\",\n  \"note>study_media\",\n  \"note>tag\",\n  \"note>task\",\n  \"note>thread\",\n  \"note>user\",\n  \"note>war_room\",\n  \"note>web_page\",\n  \"note>web_screenshot\",\n  \"organization>seo_keyword\",\n  \"page_extraction_job>file\",\n  \"page_extraction_job>processed_document\",\n  \"party>category\",\n  \"party>data_store\",\n  \"party>organization\",\n  \"party>party\",\n  \"party>project\",\n  \"party>record\",\n  \"party>research_source\",\n  \"party>research_topic\",\n  \"party>scope\",\n  \"party>scope_type\",\n  \"party>seo_link_gap_domain\",\n  \"party>seo_referring_domain_profile\",\n  \"party>seo_reputation_case\",\n  \"party>seo_serp_opportunity\",\n  \"party>seo_topic\",\n  \"party>tag\",\n  \"party>task\",\n  \"party>transcript\",\n  \"party>war_room\",\n  \"party>web_brand\",\n  \"party>web_page\",\n  \"party>web_site\",\n  \"pc_episode>assessment\",\n  \"pc_episode>content_ir_kind_instance\",\n  \"pc_episode>conversation\",\n  \"pc_episode>dataset\",\n  \"pc_episode>document\",\n  \"pc_episode>fc_set\",\n  \"pc_episode>file\",\n  \"pc_episode>note\",\n  \"pc_episode>processed_document\",\n  \"pc_episode>rulebook\",\n  \"pc_episode>structured_list\",\n  \"pc_episode>study_media\",\n  \"pc_episode>transcript\",\n  \"pc_episode>udt_document\",\n  \"pc_episode>workbook\",\n  \"pc_show>rulebook\",\n  \"pc_studio_run>rulebook\",\n  \"plan_entity>category\",\n  \"plan_entity>plan_entity\",\n  \"plan_entity>seo_topic\",\n  \"plan_entity>web_site\",\n  \"plan_node>agent_run\",\n  \"plan_node>party\",\n  \"plan_node>plan_entity\",\n  \"plan_node>plan_node\",\n  \"plan_node>seo_keyword\",\n  \"plan_node>seo_map_topic\",\n  \"plan_node>seo_topic\",\n  \"plan_node>web_brand\",\n  \"plan_node>web_page\",\n  \"plan_node>web_site\",\n  \"position>agent\",\n  \"position>membership\",\n  \"position>position\",\n  \"position>team\",\n  \"position>workflow\",\n  \"processed_document>agent\",\n  \"processed_document>code_repository\",\n  \"processed_document>conversation\",\n  \"processed_document>data_store\",\n  \"processed_document>file\",\n  \"processed_document>media_source_library\",\n  \"processed_document>project\",\n  \"processed_document>record\",\n  \"processed_document>research_topic\",\n  \"processed_document>scope\",\n  \"processed_document>social_post\",\n  \"processed_document>social_profile\",\n  \"processed_document>social_tracked_account\",\n  \"processed_document>tag\",\n  \"processed_document>task\",\n  \"processed_document>war_room\",\n  \"processed_document>web_property\",\n  \"processed_document>web_site\",\n  \"project>record\",\n  \"project>scope\",\n  \"project>scope_type\",\n  \"project>tag\",\n  \"project>thread\",\n  \"project>war_room\",\n  \"purpose>agent\",\n  \"purpose>mandate\",\n  \"purpose>tool\",\n  \"purpose>workflow\",\n  \"quiz_session>agent\",\n  \"quiz_session>processed_document\",\n  \"quiz_session>web_page\",\n  \"record>access_delta_run\",\n  \"record>access_request\",\n  \"record>access_shadow_log\",\n  \"record>account_addon\",\n  \"record>account_closure\",\n  \"record>acquisition_block\",\n  \"record>activity\",\n  \"record>admin_audit_log\",\n  \"record>admin_email_log\",\n  \"record>admin_markdown_sample\",\n  \"record>agent\",\n  \"record>agent_card\",\n  \"record>agent_definition_version\",\n  \"record>agent_drift_alert\",\n  \"record>agent_exemplar\",\n  \"record>agent_mandate_note\",\n  \"record>agent_prompt_block\",\n  \"record>agent_prompt_block_variant\",\n  \"record>agent_prompt_remediation\",\n  \"record>agent_required_flag_change\",\n  \"record>agent_run\",\n  \"record>agent_run_stage\",\n  \"record>agent_schedule\",\n  \"record>agent_schedule_claim\",\n  \"record>agent_shortcut\",\n  \"record>agent_surface_binding\",\n  \"record>agent_template\",\n  \"record>agent_term_list\",\n  \"record>agent_test_result\",\n  \"record>agent_test_run\",\n  \"record>agent_usage\",\n  \"record>ai_api\",\n  \"record>ai_device_model_file\",\n  \"record>ai_device_model_root\",\n  \"record>ai_endpoint\",\n  \"record>ai_media_generation_cache\",\n  \"record>ai_model\",\n  \"record>ai_model_alias\",\n  \"record>ai_model_artifact\",\n  \"record>ai_model_candidate\",\n  \"record>ai_model_presentation\",\n  \"record>ai_model_upstream\",\n  \"record>ai_model_variant\",\n  \"record>ai_model_verification_run\",\n  \"record>ai_model_want\",\n  \"record>ai_offering\",\n  \"record>ai_person_model_want\",\n  \"record>ai_provider\",\n  \"record>ai_request_latency\",\n  \"record>ai_runtime\",\n  \"record>ai_runtime_build\",\n  \"record>ai_runtime_compat\",\n  \"record>ai_setting\",\n  \"record>ai_setting_profile\",\n  \"record>ai_translation_cell\",\n  \"record>ai_usage_hourly\",\n  \"record>analysis_result\",\n  \"record>anon_form\",\n  \"record>anon_form_visit\",\n  \"record>anon_hit\",\n  \"record>anon_inbound\",\n  \"record>anon_replay\",\n  \"record>anon_submission\",\n  \"record>anon_token\",\n  \"record>api_field_warning\",\n  \"record>api_request_log\",\n  \"record>app\",\n  \"record>app_config\",\n  \"record>app_config_history\",\n  \"record>app_definition_version\",\n  \"record>app_error\",\n  \"record>app_execution\",\n  \"record>app_instance\",\n  \"record>app_log\",\n  \"record>app_log_hourly\",\n  \"record>app_log_lines\",\n  \"record>app_log_muted_pattern\",\n  \"record>app_log_norm_exception\",\n  \"record>app_log_requests_hourly\",\n  \"record>app_rate_limit\",\n  \"record>app_setting\",\n  \"record>app_sync_status\",\n  \"record>applet_visitor_binding\",\n  \"record>approach\",\n  \"record>artifact\",\n  \"record>assessment\",\n  \"record>assessment_item\",\n  \"record>assessment_result\",\n  \"record>assignment_session\",\n  \"record>assist\",\n  \"record>assist_producer_policy\",\n  \"record>assist_producer_policy_history\",\n  \"record>association_type\",\n  \"record>assurance_level\",\n  \"record>attempt\",\n  \"record>attention_audit\",\n  \"record>attention_showing\",\n  \"record>audit_canonical_findings\",\n  \"record>audit_exemption\",\n  \"record>base_entity_template\",\n  \"record>batch_cost_event\",\n  \"record>batch_provider_batch\",\n  \"record>batch_work_item\",\n  \"record>billing_capability\",\n  \"record>billing_capability_limit\",\n  \"record>billing_ci_package_build\",\n  \"record>billing_connect_account\",\n  \"record>billing_coupon\",\n  \"record>billing_coupon_redemption\",\n  \"record>billing_customer\",\n  \"record>billing_external_call_vendor\",\n  \"record>billing_free_period_grant\",\n  \"record>billing_hard_cost_reconciliation\",\n  \"record>billing_held_run\",\n  \"record>billing_org_payment_account\",\n  \"record>billing_payment\",\n  \"record>billing_payment_ask\",\n  \"record>billing_plan\",\n  \"record>billing_plan_limit\",\n  \"record>billing_price\",\n  \"record>billing_product\",\n  \"record>billing_provider_balance_snapshot\",\n  \"record>billing_spend_alarm\",\n  \"record>billing_spend_alarm_occurrence\",\n  \"record>billing_spend_approval\",\n  \"record>billing_spend_guardrail\",\n  \"record>billing_spend_hold\",\n  \"record>billing_stripe_event\",\n  \"record>billing_subscription\",\n  \"record>billing_usage_ledger\",\n  \"record>billing_usage_reset\",\n  \"record>block_state\",\n  \"record>board\",\n  \"record>browser_account_binding\",\n  \"record>browser_action_event\",\n  \"record>browser_authenticator_window\",\n  \"record>browser_capture\",\n  \"record>browser_control_request\",\n  \"record>browser_handoff\",\n  \"record>browser_login_attempt\",\n  \"record>browser_login_recipe\",\n  \"record>browser_profile\",\n  \"record>browser_profile_checkpoint\",\n  \"record>browser_run\",\n  \"record>browser_site_observation\",\n  \"record>browser_site_policy\",\n  \"record>browser_stream_ticket\",\n  \"record>calendar_event\",\n  \"record>campaign_watch_ramp_gate_run\",\n  \"record>campaign_watch_switch_outbox\",\n  \"record>campaign_watch_switch_window\",\n  \"record>canvas_comment\",\n  \"record>canvas_comment_like\",\n  \"record>canvas_item\",\n  \"record>canvas_item_state\",\n  \"record>canvas_like\",\n  \"record>canvas_score\",\n  \"record>canvas_view\",\n  \"record>catalog_entries_history\",\n  \"record>catalog_entry\",\n  \"record>category\",\n  \"record>change_job\",\n  \"record>change_plan\",\n  \"record>change_type_default\",\n  \"record>change_work\",\n  \"record>citations\",\n  \"record>class_purchase\",\n  \"record>client_callable_door\",\n  \"record>client_callable_door_retirement\",\n  \"record>cmp_entry\",\n  \"record>cmp_feedback\",\n  \"record>code_file\",\n  \"record>code_folder\",\n  \"record>code_repository\",\n  \"record>coding_session\",\n  \"record>coding_session_entry\",\n  \"record>collab_checkpoint\",\n  \"record>collab_op\",\n  \"record>collab_room\",\n  \"record>comment\",\n  \"record>commerce_asset_allocation\",\n  \"record>commerce_asset_grading\",\n  \"record>commerce_asset_identifier\",\n  \"record>commerce_asset_lot_event\",\n  \"record>commerce_asset_mandate_result\",\n  \"record>commerce_asset_price_factor\",\n  \"record>commerce_asset_reshoot_request\",\n  \"record>commerce_asset_review\",\n  \"record>commerce_asset_unknown\",\n  \"record>commerce_certified_printer\",\n  \"record>commerce_cloud_sync_connection\",\n  \"record>commerce_ebay_business_policy\",\n  \"record>commerce_ebay_category\",\n  \"record>commerce_ebay_category_aspect\",\n  \"record>commerce_ebay_category_tree\",\n  \"record>commerce_ebay_custom_policy\",\n  \"record>commerce_ebay_inventory_item\",\n  \"record>commerce_ebay_inventory_item_group\",\n  \"record>commerce_ebay_inventory_item_group_member\",\n  \"record>commerce_ebay_inventory_location\",\n  \"record>commerce_ebay_listing\",\n  \"record>commerce_ebay_marketplace_policy\",\n  \"record>commerce_ebay_media_asset\",\n  \"record>commerce_ebay_notification_destination\",\n  \"record>commerce_ebay_notification_event\",\n  \"record>commerce_ebay_notification_subscription\",\n  \"record>commerce_ebay_notification_topic\",\n  \"record>commerce_ebay_offer\",\n  \"record>commerce_ebay_order\",\n  \"record>commerce_ebay_order_line_item\",\n  \"record>commerce_ebay_shipping_fulfillment\",\n  \"record>commerce_ebay_store_category\",\n  \"record>commerce_human_correction\",\n  \"record>commerce_intake_artifact\",\n  \"record>commerce_intake_asset\",\n  \"record>commerce_intake_batch\",\n  \"record>commerce_label_batch\",\n  \"record>commerce_label_code\",\n  \"record>commerce_marketplace_account\",\n  \"record>commerce_marketplace_account_deletion_audit\",\n  \"record>commerce_marketplace_api_call\",\n  \"record>commerce_marketplace_rate_budget\",\n  \"record>commerce_marketplace_site\",\n  \"record>commerce_marketplace_sync_run\",\n  \"record>commerce_prediction_outcome\",\n  \"record>commerce_print_order\",\n  \"record>commerce_product\",\n  \"record>commerce_product_channel_ref\",\n  \"record>commerce_product_media\",\n  \"record>commerce_product_variant\",\n  \"record>commerce_recall_audit\",\n  \"record>communication_calendar_selected_snapshot_state\",\n  \"record>comparison_set\",\n  \"record>computed_org_mark\",\n  \"record>config_manifest\",\n  \"record>config_read_bucket\",\n  \"record>contact_medium\",\n  \"record>contact_submission\",\n  \"record>content_certification\",\n  \"record>content_ir_converter_definition\",\n  \"record>content_ir_converter_run\",\n  \"record>content_ir_kind\",\n  \"record>content_ir_kind_component\",\n  \"record>content_ir_kind_component_incident\",\n  \"record>content_ir_kind_component_layer\",\n  \"record>content_ir_kind_conformance\",\n  \"record>content_ir_kind_edge\",\n  \"record>content_ir_kind_example\",\n  \"record>content_ir_kind_instance\",\n  \"record>content_ir_kind_surface\",\n  \"record>content_ir_render_inspection\",\n  \"record>context_access_log\",\n  \"record>context_item\",\n  \"record>context_item_suggestion\",\n  \"record>conversation\",\n  \"record>conversation_value\",\n  \"record>courts\",\n  \"record>credential_attachment\",\n  \"record>credential_item\",\n  \"record>credential_mutation_receipt\",\n  \"record>crm_address\",\n  \"record>crm_affiliation\",\n  \"record>crm_blocklist_entry\",\n  \"record>crm_contact_candidate\",\n  \"record>crm_deal\",\n  \"record>crm_deal_stage_event\",\n  \"record>crm_enrichment_call\",\n  \"record>crm_interaction\",\n  \"record>crm_merge_candidate\",\n  \"record>crm_outreach_list\",\n  \"record>crm_outreach_list_member\",\n  \"record>crm_party_merge\",\n  \"record>crm_party_research\",\n  \"record>crm_registry_ingest_run\",\n  \"record>crm_registry_source\",\n  \"record>crm_sending_claim\",\n  \"record>crm_sending_event\",\n  \"record>crm_sending_identity\",\n  \"record>crm_sending_identity_check\",\n  \"record>crm_sending_policy\",\n  \"record>custom_anon_form_draft\",\n  \"record>custom_base\",\n  \"record>custom_base_snapshot\",\n  \"record>custom_field_definition\",\n  \"record>custom_field_target\",\n  \"record>custom_portal\",\n  \"record>custom_portal_principal\",\n  \"record>custom_portal_table\",\n  \"record>custom_synced_source\",\n  \"record>custom_template\",\n  \"record>custom_template_install\",\n  \"record>custom_whole_value_parked\",\n  \"record>cx_agent_memory\",\n  \"record>cx_agent_plan\",\n  \"record>cx_agent_task\",\n  \"record>cx_code_edit\",\n  \"record>cx_code_message_file\",\n  \"record>cx_media\",\n  \"record>cx_observational_memory\",\n  \"record>cx_observational_memory_event\",\n  \"record>cx_pending_injection\",\n  \"record>cx_request\",\n  \"record>cx_request_snapshot\",\n  \"record>cx_request_values\",\n  \"record>cx_tool_trace\",\n  \"record>cx_user_request\",\n  \"record>cx_user_todo\",\n  \"record>data_rights_event\",\n  \"record>data_store\",\n  \"record>data_store_members\",\n  \"record>ddl_guard_log\",\n  \"record>deck_suggestion\",\n  \"record>definer_class_exemption\",\n  \"record>definer_grant_baseline\",\n  \"record>derive_run\",\n  \"record>desktop_app_account\",\n  \"record>desktop_app_instance\",\n  \"record>desktop_app_profile\",\n  \"record>dev_login_audit\",\n  \"record>device_handoff\",\n  \"record>dict_entry\",\n  \"record>dict_provider_publication\",\n  \"record>dict_setting\",\n  \"record>dm_conversation\",\n  \"record>dm_message\",\n  \"record>dm_participant\",\n  \"record>dm_session_member\",\n  \"record>doc_render\",\n  \"record>doc_signature\",\n  \"record>dockets\",\n  \"record>document\",\n  \"record>document_version\",\n  \"record>domain_classification\",\n  \"record>egress_device\",\n  \"record>egress_pairing\",\n  \"record>egress_ticket\",\n  \"record>emails\",\n  \"record>entity_grant\",\n  \"record>entity_protected_value_version\",\n  \"record>entity_type\",\n  \"record>esign_campaign\",\n  \"record>esign_campaign_member\",\n  \"record>esign_consent_disclosure\",\n  \"record>esign_envelope\",\n  \"record>esign_envelope_certificate\",\n  \"record>esign_envelope_document\",\n  \"record>esign_envelope_draft\",\n  \"record>esign_envelope_event\",\n  \"record>esign_envelope_external_ref\",\n  \"record>esign_envelope_signer\",\n  \"record>esign_provider\",\n  \"record>esign_provider_binding\",\n  \"record>esign_saved_signature\",\n  \"record>esign_signing_key\",\n  \"record>esign_template\",\n  \"record>extension_auth_code\",\n  \"record>external_api_reservation\",\n  \"record>external_conversation\",\n  \"record>external_delivery_event\",\n  \"record>external_inbox\",\n  \"record>external_link\",\n  \"record>external_message\",\n  \"record>external_provider_receipt\",\n  \"record>external_source\",\n  \"record>extract_sweep_state\",\n  \"record>fc_card\",\n  \"record>fc_detail\",\n  \"record>fc_set\",\n  \"record>feature_doc\",\n  \"record>feedback_comments\",\n  \"record>feedback_user_messages\",\n  \"record>file\",\n  \"record>file_analysis\",\n  \"record>file_entities\",\n  \"record>file_overrides\",\n  \"record>file_page_annotations\",\n  \"record>file_pages\",\n  \"record>file_rag_job\",\n  \"record>file_template\",\n  \"record>file_version\",\n  \"record>files_account_tier\",\n  \"record>files_machine_written_prefix\",\n  \"record>files_sync_mapping\",\n  \"record>files_user_account\",\n  \"record>folder\",\n  \"record>function_contract\",\n  \"record>game_badge\",\n  \"record>game_result\",\n  \"record>game_room\",\n  \"record>global_execution\",\n  \"record>global_execution_checkpoint\",\n  \"record>global_execution_event\",\n  \"record>global_meter_entry\",\n  \"record>global_origin\",\n  \"record>global_request\",\n  \"record>google_document\",\n  \"record>growth_loop_event\",\n  \"record>growth_loop_run\",\n  \"record>growth_loop_stage_run\",\n  \"record>guardian_link\",\n  \"record>guest_conversion_audit\",\n  \"record>guest_execution_log\",\n  \"record>guest_executions\",\n  \"record>guided_checklist_run\",\n  \"record>heatmap_save\",\n  \"record>hindsight_enrollment\",\n  \"record>hindsight_finding\",\n  \"record>hindsight_regression_case\",\n  \"record>hindsight_replay\",\n  \"record>hindsight_replay_step\",\n  \"record>hindsight_review\",\n  \"record>hr_access_audit\",\n  \"record>hr_access_role\",\n  \"record>hr_accommodation_request\",\n  \"record>hr_ai_evidence\",\n  \"record>hr_alert_routing_rule\",\n  \"record>hr_application\",\n  \"record>hr_approval_authority\",\n  \"record>hr_approval_delegation\",\n  \"record>hr_asset\",\n  \"record>hr_asset_assignment\",\n  \"record>hr_attendance_exception\",\n  \"record>hr_auto_close_rule\",\n  \"record>hr_availability\",\n  \"record>hr_background_check\",\n  \"record>hr_benefits_event\",\n  \"record>hr_calculation_snapshot\",\n  \"record>hr_candidate\",\n  \"record>hr_candidate_conversion\",\n  \"record>hr_candidate_message\",\n  \"record>hr_careers_portal\",\n  \"record>hr_checklist_item\",\n  \"record>hr_checklist_run\",\n  \"record>hr_checklist_template\",\n  \"record>hr_checklist_template_item\",\n  \"record>hr_compensation\",\n  \"record>hr_corrective_action\",\n  \"record>hr_course\",\n  \"record>hr_course_version\",\n  \"record>hr_credential\",\n  \"record>hr_crew\",\n  \"record>hr_deduction_code\",\n  \"record>hr_department\",\n  \"record>hr_derived_grant\",\n  \"record>hr_disposition_event\",\n  \"record>hr_earning_code\",\n  \"record>hr_eeo_response\",\n  \"record>hr_emergency_contact\",\n  \"record>hr_employee\",\n  \"record>hr_employee_private\",\n  \"record>hr_employer_profile\",\n  \"record>hr_employment\",\n  \"record>hr_employment_pin\",\n  \"record>hr_engagement\",\n  \"record>hr_establishment\",\n  \"record>hr_external_identity\",\n  \"record>hr_field_policy\",\n  \"record>hr_goal\",\n  \"record>hr_holiday\",\n  \"record>hr_holiday_calendar\",\n  \"record>hr_i9\",\n  \"record>hr_i9_document\",\n  \"record>hr_incident\",\n  \"record>hr_incident_party\",\n  \"record>hr_interview\",\n  \"record>hr_interview_kit\",\n  \"record>hr_job_title\",\n  \"record>hr_jurisdiction\",\n  \"record>hr_jurisdiction_rule\",\n  \"record>hr_jurisdiction_rule_class\",\n  \"record>hr_jurisdiction_rule_org_decision\",\n  \"record>hr_jurisdiction_rule_test\",\n  \"record>hr_kiosk_device\",\n  \"record>hr_kiosk_session\",\n  \"record>hr_labor_target\",\n  \"record>hr_leave_case\",\n  \"record>hr_leave_enrollment\",\n  \"record>hr_leave_ledger\",\n  \"record>hr_leave_policy\",\n  \"record>hr_leave_request\",\n  \"record>hr_legal_hold\",\n  \"record>hr_legal_hold_item\",\n  \"record>hr_location\",\n  \"record>hr_new_hire_report\",\n  \"record>hr_offer\",\n  \"record>hr_opening\",\n  \"record>hr_overtime_alert\",\n  \"record>hr_overtime_alert_rule\",\n  \"record>hr_overtime_preapproval\",\n  \"record>hr_pay_group\",\n  \"record>hr_pay_period\",\n  \"record>hr_pay_period_employment\",\n  \"record>hr_payroll_export\",\n  \"record>hr_payroll_export_line\",\n  \"record>hr_position_assignment\",\n  \"record>hr_posting\",\n  \"record>hr_posting_publication\",\n  \"record>hr_provider_binding\",\n  \"record>hr_provider_event\",\n  \"record>hr_provisioning_result\",\n  \"record>hr_punch\",\n  \"record>hr_recalculation_batch\",\n  \"record>hr_record_class\",\n  \"record>hr_records_request\",\n  \"record>hr_reference_check\",\n  \"record>hr_reporting_line\",\n  \"record>hr_requisition\",\n  \"record>hr_restricted_note\",\n  \"record>hr_retention_rule\",\n  \"record>hr_review\",\n  \"record>hr_review_cycle\",\n  \"record>hr_review_peer_nomination\",\n  \"record>hr_review_response\",\n  \"record>hr_review_template\",\n  \"record>hr_role_assignment\",\n  \"record>hr_schedule\",\n  \"record>hr_schedule_change\",\n  \"record>hr_schedule_guidance\",\n  \"record>hr_schedule_template\",\n  \"record>hr_schedule_template_shift\",\n  \"record>hr_scorecard\",\n  \"record>hr_separation\",\n  \"record>hr_shift\",\n  \"record>hr_shift_claim\",\n  \"record>hr_staffing_requirement\",\n  \"record>hr_survey\",\n  \"record>hr_survey_invitation\",\n  \"record>hr_survey_question\",\n  \"record>hr_survey_response\",\n  \"record>hr_tax_registration\",\n  \"record>hr_tax_withholding\",\n  \"record>hr_time_adjustment\",\n  \"record>hr_training_assignment\",\n  \"record>hr_training_attempt\",\n  \"record>hr_transcript_entry\",\n  \"record>hr_verification_letter_request\",\n  \"record>hr_work_interval\",\n  \"record>hr_workflow_binding\",\n  \"record>hr_workflow_decision\",\n  \"record>hr_workflow_definition\",\n  \"record>hr_workflow_event\",\n  \"record>hr_workflow_failure\",\n  \"record>hr_workflow_flow_type\",\n  \"record>hr_workflow_instance\",\n  \"record>hr_workflow_step\",\n  \"record>hr_workflow_step_definition\",\n  \"record>hr_workweek\",\n  \"record>html_extraction\",\n  \"record>iam_access_audit\",\n  \"record>iam_api_key\",\n  \"record>iam_emergency_door_request\",\n  \"record>iam_oauth_app\",\n  \"record>iam_org_domain\",\n  \"record>iam_org_domain_route\",\n  \"record>iam_publish_binding\",\n  \"record>iam_record_seat_change\",\n  \"record>iam_sign_in_event\",\n  \"record>iam_world_publish_admission\",\n  \"record>industry\",\n  \"record>ingest_runs\",\n  \"record>integration_connection\",\n  \"record>integration_connection_resource\",\n  \"record>interview_decision_interview\",\n  \"record>interview_decision_question\",\n  \"record>interview_document_revision\",\n  \"record>interview_hole\",\n  \"record>interview_question\",\n  \"record>interview_session\",\n  \"record>interview_turn\",\n  \"record>invitation\",\n  \"record>invitation_code\",\n  \"record>invitation_request\",\n  \"record>io_comment\",\n  \"record>io_contract\",\n  \"record>io_import\",\n  \"record>io_outbox\",\n  \"record>item\",\n  \"record>item_mastery\",\n  \"record>judge_verdict\",\n  \"record>jurisdiction_policy\",\n  \"record>kg_alert\",\n  \"record>kg_chunk_entities\",\n  \"record>kg_chunks\",\n  \"record>kg_clusters\",\n  \"record>kg_edges\",\n  \"record>kg_entities\",\n  \"record>kg_entity_aliases\",\n  \"record>kg_suggestion_ack\",\n  \"record>kg_sweep_queue\",\n  \"record>kg_sweep_run\",\n  \"record>kg_sweep_state\",\n  \"record>kg_value_match\",\n  \"record>knob_override\",\n  \"record>knob_override_audit\",\n  \"record>knob_rung_lock\",\n  \"record>knob_scope_kind\",\n  \"record>knob_write_door\",\n  \"record>league_membership\",\n  \"record>learn_doc\",\n  \"record>library_doc\",\n  \"record>lifecycle_archive\",\n  \"record>lifecycle_audit\",\n  \"record>lifecycle_map_build\",\n  \"record>lifecycle_reference_map\",\n  \"record>lifecycle_run\",\n  \"record>lifecycle_tier_ledger\",\n  \"record>location\",\n  \"record>mandate\",\n  \"record>mandate_advance_batch_row\",\n  \"record>mandate_binding\",\n  \"record>mandate_candidate\",\n  \"record>mandate_candidate_run\",\n  \"record>mandate_candidate_run_payload\",\n  \"record>mandate_goal_clauses\",\n  \"record>mandate_observation\",\n  \"record>mandate_proposal\",\n  \"record>mandate_readiness_verdict\",\n  \"record>mandate_reference\",\n  \"record>mandate_scan\",\n  \"record>mandate_treatment\",\n  \"record>marketing_initiative\",\n  \"record>masterwork_corpus_item\",\n  \"record>masterwork_run\",\n  \"record>masterwork_run_kind\",\n  \"record>masterwork_source\",\n  \"record>math_course_structure\",\n  \"record>math_problem\",\n  \"record>matrx_action_ledger\",\n  \"record>mcp_config\",\n  \"record>mcp_server\",\n  \"record>mcp_user_conn\",\n  \"record>media_capture_handoff\",\n  \"record>media_catalog_setting\",\n  \"record>media_library_item\",\n  \"record>media_selection_item\",\n  \"record>media_selection_job\",\n  \"record>media_source_library\",\n  \"record>meet_call_invite\",\n  \"record>meet_chat_message\",\n  \"record>meet_connection\",\n  \"record>meet_invitee\",\n  \"record>meet_meeting\",\n  \"record>meet_note\",\n  \"record>meet_occurrence_override\",\n  \"record>meet_participant\",\n  \"record>meet_recording\",\n  \"record>meet_session\",\n  \"record>meet_transcript_segment\",\n  \"record>membership\",\n  \"record>memory_trial\",\n  \"record>memory_trial_step\",\n  \"record>merge_field_provenance\",\n  \"record>message\",\n  \"record>message_template\",\n  \"record>message_template_detail\",\n  \"record>migration_log\",\n  \"record>mtx_media_heal_queue\",\n  \"record>mtx_public_url_guard\",\n  \"record>ner_shadow\",\n  \"record>note\",\n  \"record>note_folder\",\n  \"record>notification\",\n  \"record>notification_channel_preference\",\n  \"record>notification_event_override\",\n  \"record>notification_event_type\",\n  \"record>notification_preference\",\n  \"record>notification_submission\",\n  \"record>notify_outsider_door_baseline\",\n  \"record>opinion_clusters\",\n  \"record>opinions\",\n  \"record>ops_auth_lock_watchdog_log\",\n  \"record>ops_check_item\",\n  \"record>ops_check_run\",\n  \"record>ops_db_host_sample\",\n  \"record>ops_issue_class\",\n  \"record>ops_issue_event\",\n  \"record>ops_perf_client_event\",\n  \"record>ops_perf_sample\",\n  \"record>ops_perf_statement_snapshot\",\n  \"record>ops_proof_check\",\n  \"record>ops_proof_run\",\n  \"record>ops_proof_scenario\",\n  \"record>ops_source_read_cache\",\n  \"record>ops_test_replay_cache\",\n  \"record>org_admin_audit\",\n  \"record>org_change_policy\",\n  \"record>org_chart_publication\",\n  \"record>org_context_ledger\",\n  \"record>org_industries\",\n  \"record>org_member_control\",\n  \"record>org_module_config\",\n  \"record>org_plan\",\n  \"record>organization\",\n  \"record>organization_preferences\",\n  \"record>output_feedback\",\n  \"record>outreach_acceptance\",\n  \"record>page_extraction_job\",\n  \"record>page_extraction_page_run\",\n  \"record>page_extraction_results\",\n  \"record>page_extraction_runs\",\n  \"record>page_vitals\",\n  \"record>party\",\n  \"record>party_contact_point\",\n  \"record>passkey_credential\",\n  \"record>pc_article\",\n  \"record>pc_episode\",\n  \"record>pc_show\",\n  \"record>pc_studio_run\",\n  \"record>pc_studio_run_asset\",\n  \"record>pdf_consolidation_log\",\n  \"record>pdf_redaction_audit\",\n  \"record>pdf_redaction_key_escrow\",\n  \"record>permission_grant\",\n  \"record>personal_data_column\",\n  \"record>plan_cms_fill_item\",\n  \"record>plan_cms_fill_job\",\n  \"record>plan_entity\",\n  \"record>plan_node\",\n  \"record>plan_node_artifact\",\n  \"record>plan_node_step\",\n  \"record>plan_profile\",\n  \"record>platform_action_request\",\n  \"record>platform_actor_session\",\n  \"record>platform_actor_token\",\n  \"record>platform_actor_token_event\",\n  \"record>platform_class_approval_by_arman\",\n  \"record>platform_class_approval_by_org_admin\",\n  \"record>platform_continued_access\",\n  \"record>platform_cutover_census_run\",\n  \"record>platform_cutover_evaluation_replaced\",\n  \"record>platform_cutover_evaluation_write\",\n  \"record>platform_cutover_seam\",\n  \"record>platform_cutover_seam_measure\",\n  \"record>platform_cutover_seam_press\",\n  \"record>platform_dated_change\",\n  \"record>platform_google_calendar_event_create_intent\",\n  \"record>platform_google_task_create_intent\",\n  \"record>platform_hidden_item\",\n  \"record>platform_kernel_fingerprint_record\",\n  \"record>platform_outcome_event\",\n  \"record>platform_outsider_consumer\",\n  \"record>platform_reference_declaration\",\n  \"record>platform_saved_view\",\n  \"record>platform_secure_delivery\",\n  \"record>platform_share_link\",\n  \"record>platform_strict_class_probe\",\n  \"record>podcast_race\",\n  \"record>position\",\n  \"record>presentation\",\n  \"record>processed_document\",\n  \"record>processed_document_page\",\n  \"record>product_capture_file\",\n  \"record>product_capture_item\",\n  \"record>product_capture_payload\",\n  \"record>product_capture_product\",\n  \"record>product_capture_question\",\n  \"record>project\",\n  \"record>provider_account\",\n  \"record>provider_account_credential\",\n  \"record>provision\",\n  \"record>provision_snapshot\",\n  \"record>provision_spec_grandfather\",\n  \"record>purpose\",\n  \"record>quiz_session\",\n  \"record>rag_ingest_run\",\n  \"record>rag_library_audit_log\",\n  \"record>recompute_queue\",\n  \"record>record\",\n  \"record>redaction_mapping\",\n  \"record>relationship_rule\",\n  \"record>research_analysis\",\n  \"record>research_content\",\n  \"record>research_context_bundle\",\n  \"record>research_document\",\n  \"record>research_intent\",\n  \"record>research_keyword\",\n  \"record>research_media\",\n  \"record>research_source\",\n  \"record>research_synthesis\",\n  \"record>research_tag\",\n  \"record>research_template\",\n  \"record>research_topic\",\n  \"record>retention_policy\",\n  \"record>retrieval_audit\",\n  \"record>review_queue\",\n  \"record>route_manifest_entry\",\n  \"record>row_version\",\n  \"record>rulebook\",\n  \"record>run_approval\",\n  \"record>run_approval_event\",\n  \"record>runtime_operation_stream\",\n  \"record>runtime_operation_stream_batch\",\n  \"record>sandbox_instance\",\n  \"record>sch_agent_task\",\n  \"record>sch_run\",\n  \"record>sch_task\",\n  \"record>sch_trigger\",\n  \"record>scheduler_automation_run_subject\",\n  \"record>schema_templates\",\n  \"record>scope_association_suggestion\",\n  \"record>scope_item_value_suggestion\",\n  \"record>scope_suggestion\",\n  \"record>scope_type\",\n  \"record>scrape_domain\",\n  \"record>scrape_domain_settings\",\n  \"record>scrape_failure_log\",\n  \"record>scrape_parsed_page\",\n  \"record>scrape_path_override\",\n  \"record>scrape_path_pattern\",\n  \"record>scrape_retry_queue\",\n  \"record>scraper_comparison_run\",\n  \"record>scraper_data_fetch_job\",\n  \"record>scraper_data_source\",\n  \"record>seo_ai_capability\",\n  \"record>seo_ai_visibility_brand_check\",\n  \"record>seo_ai_visibility_citation\",\n  \"record>seo_ai_visibility_claim\",\n  \"record>seo_ai_visibility_design_artifact\",\n  \"record>seo_ai_visibility_panel\",\n  \"record>seo_ai_visibility_panel_version\",\n  \"record>seo_ai_visibility_response\",\n  \"record>seo_ai_visibility_signal\",\n  \"record>seo_backlink\",\n  \"record>seo_backlink_change_event\",\n  \"record>seo_backlink_dimension_snapshot\",\n  \"record>seo_backlink_observation\",\n  \"record>seo_backlink_snapshot\",\n  \"record>seo_change_assessment\",\n  \"record>seo_change_event\",\n  \"record>seo_change_item\",\n  \"record>seo_change_metric\",\n  \"record>seo_change_set\",\n  \"record>seo_change_theory\",\n  \"record>seo_competitor\",\n  \"record>seo_competitor_observation\",\n  \"record>seo_competitor_opportunity\",\n  \"record>seo_coverage_mention\",\n  \"record>seo_coverage_tracker\",\n  \"record>seo_dimension_value_matcher\",\n  \"record>seo_engine_schedule\",\n  \"record>seo_geo_place\",\n  \"record>seo_gsc_dig_rule\",\n  \"record>seo_keyword\",\n  \"record>seo_keyword_class_rule\",\n  \"record>seo_keyword_edge\",\n  \"record>seo_keyword_facet\",\n  \"record>seo_keyword_market\",\n  \"record>seo_keyword_market_observation\",\n  \"record>seo_keyword_place\",\n  \"record>seo_keyword_saved_view\",\n  \"record>seo_keyword_topic\",\n  \"record>seo_landscape_brief\",\n  \"record>seo_link_gap_domain\",\n  \"record>seo_link_gap_match\",\n  \"record>seo_map_facet\",\n  \"record>seo_map_facet_value\",\n  \"record>seo_map_topic\",\n  \"record>seo_page_measurement_health\",\n  \"record>seo_page_performance\",\n  \"record>seo_pr_moment\",\n  \"record>seo_provider_call\",\n  \"record>seo_provider_task\",\n  \"record>seo_rank_observation\",\n  \"record>seo_rank_target\",\n  \"record>seo_raw_payload\",\n  \"record>seo_referring_domain_profile\",\n  \"record>seo_reputation_case\",\n  \"record>seo_search_performance_daily\",\n  \"record>seo_serp_mention\",\n  \"record>seo_serp_opportunity\",\n  \"record>seo_serp_result\",\n  \"record>seo_serp_snapshot\",\n  \"record>seo_site_geo_area\",\n  \"record>seo_site_keyword_offering\",\n  \"record>seo_site_keyword_value\",\n  \"record>seo_site_offering_value\",\n  \"record>seo_site_topic_value\",\n  \"record>seo_site_value_combo\",\n  \"record>seo_site_value_worth\",\n  \"record>seo_site_vocabulary\",\n  \"record>seo_source_request\",\n  \"record>seo_starter_pack\",\n  \"record>seo_starter_pack_item\",\n  \"record>seo_story_angle\",\n  \"record>seo_topic\",\n  \"record>seo_topical_map\",\n  \"record>seo_tracker_story\",\n  \"record>seo_web_analytics_daily\",\n  \"record>shareable_resource_registry\",\n  \"record>shared_canvas_item\",\n  \"record>short_link\",\n  \"record>skill\",\n  \"record>skill_detail\",\n  \"record>sms_consent\",\n  \"record>sms_conversation\",\n  \"record>sms_message\",\n  \"record>sms_message_media\",\n  \"record>sms_notification\",\n  \"record>sms_notification_preference\",\n  \"record>sms_phone_number\",\n  \"record>sms_rate_limits\",\n  \"record>sms_webhook_logs\",\n  \"record>social_account_insight_daily\",\n  \"record>social_ad\",\n  \"record>social_captured_post\",\n  \"record>social_kpi_goal\",\n  \"record>social_own_post_metric\",\n  \"record>social_post\",\n  \"record>social_post_analysis\",\n  \"record>social_post_comment\",\n  \"record>social_post_metric_snapshot\",\n  \"record>social_post_stat\",\n  \"record>social_post_transcript\",\n  \"record>social_profile\",\n  \"record>social_profile_snapshot\",\n  \"record>social_remix_output\",\n  \"record>social_swipe_collection\",\n  \"record>social_tracked_account\",\n  \"record>social_video_composition_version\",\n  \"record>social_video_project\",\n  \"record>social_video_variant\",\n  \"record>social_watchlist_hit\",\n  \"record>soft_delete_cascade_job\",\n  \"record>soft_delete_edge\",\n  \"record>source_authority\",\n  \"record>space_payload\",\n  \"record>stage_ref_kind\",\n  \"record>structure\",\n  \"record>structured_list\",\n  \"record>studio_cleaned_segments\",\n  \"record>studio_concept_items\",\n  \"record>studio_documents\",\n  \"record>studio_module_segments\",\n  \"record>studio_raw_segments\",\n  \"record>studio_recording_chunks\",\n  \"record>studio_recording_segments\",\n  \"record>studio_run\",\n  \"record>studio_session\",\n  \"record>studio_session_settings\",\n  \"record>study_attempt\",\n  \"record>study_goal\",\n  \"record>study_media\",\n  \"record>study_plan\",\n  \"record>study_plan_block\",\n  \"record>study_plan_day\",\n  \"record>study_reminder_context\",\n  \"record>study_reminder_delivery\",\n  \"record>study_session\",\n  \"record>study_source_chunk\",\n  \"record>study_streak\",\n  \"record>study_structured_section\",\n  \"record>superseded_policy\",\n  \"record>support_session\",\n  \"record>support_session_event\",\n  \"record>surface\",\n  \"record>system_announcement\",\n  \"record>system_context_item\",\n  \"record>system_context_item_org_value\",\n  \"record>system_error\",\n  \"record>system_write_failure\",\n  \"record>t13_backfill_ledger\",\n  \"record>tag\",\n  \"record>task\",\n  \"record>task_user_state\",\n  \"record>taxonomy_node\",\n  \"record>team\",\n  \"record>template_context_items\",\n  \"record>template_scope_types\",\n  \"record>templates\",\n  \"record>test_handset_inbox\",\n  \"record>test_handset_verification\",\n  \"record>thread\",\n  \"record>tool\",\n  \"record>tool_battle\",\n  \"record>tool_battle_cell\",\n  \"record>tool_binding\",\n  \"record>tool_bundle\",\n  \"record>tool_call\",\n  \"record>tool_canary_run\",\n  \"record>tool_catalog_cache\",\n  \"record>tool_catalog_call\",\n  \"record>tool_catalog_call_attempt\",\n  \"record>tool_catalog_call_detail\",\n  \"record>tool_catalog_endpoint\",\n  \"record>tool_catalog_entry\",\n  \"record>tool_catalog_provider\",\n  \"record>tool_definition_version\",\n  \"record>tool_executor\",\n  \"record>tool_feature_scorecard\",\n  \"record>tool_surface_defaults\",\n  \"record>tool_test_sample\",\n  \"record>tool_ui\",\n  \"record>tool_ui_incident\",\n  \"record>tool_ui_version\",\n  \"record>transcript\",\n  \"record>trigger_event\",\n  \"record>udt_document\",\n  \"record>udt_document_snapshot\",\n  \"record>udt_workbook_snapshot\",\n  \"record>ui_client\",\n  \"record>ui_decision_pick\",\n  \"record>ui_surface_action\",\n  \"record>ui_surface_agent_pref\",\n  \"record>ui_surface_agent_role\",\n  \"record>ui_surface_client_tool\",\n  \"record>ui_surface_config\",\n  \"record>ui_surface_item_type\",\n  \"record>ui_surface_value\",\n  \"record>ui_surface_write_target\",\n  \"record>univer_payload\",\n  \"record>unsubscribe_token\",\n  \"record>uploads_inflight\",\n  \"record>user\",\n  \"record>user_achievement\",\n  \"record>user_active_context\",\n  \"record>user_analysis_preference\",\n  \"record>user_email_preference\",\n  \"record>user_feedback\",\n  \"record>user_follows\",\n  \"record>user_markdown_sample\",\n  \"record>user_memory\",\n  \"record>user_preference\",\n  \"record>user_profile\",\n  \"record>user_secret\",\n  \"record>user_secret_audit\",\n  \"record>user_secret_grant\",\n  \"record>user_stat\",\n  \"record>user_storage_usage\",\n  \"record>user_surface_state\",\n  \"record>users_calendar_feed\",\n  \"record>vault_fill_approvals\",\n  \"record>vault_fill_devices\",\n  \"record>voice\",\n  \"record>war_room\",\n  \"record>wbx_demo\",\n  \"record>wbx_guidance\",\n  \"record>wbx_highlight\",\n  \"record>wbx_pattern\",\n  \"record>wbx_recipe\",\n  \"record>wbx_screenshot\",\n  \"record>wbx_seo_audit\",\n  \"record>wc_claim\",\n  \"record>wc_impairment_definition\",\n  \"record>wc_injury\",\n  \"record>wc_report\",\n  \"record>web_analysis_item\",\n  \"record>web_brand\",\n  \"record>web_brand_asset\",\n  \"record>web_brand_choice\",\n  \"record>web_brand_exclusion\",\n  \"record>web_brand_offering\",\n  \"record>web_brand_persona\",\n  \"record>web_brand_relation_kind\",\n  \"record>web_brand_review\",\n  \"record>web_brand_testimony\",\n  \"record>web_business_fact\",\n  \"record>web_business_location\",\n  \"record>web_channel_analytics_daily\",\n  \"record>web_crawl_event\",\n  \"record>web_crawl_preset\",\n  \"record>web_crawl_schedule\",\n  \"record>web_crawl_session\",\n  \"record>web_crawl_url\",\n  \"record>web_discovered_item\",\n  \"record>web_domain_category\",\n  \"record>web_domain_category_observation\",\n  \"record>web_finding\",\n  \"record>web_gsc_page_stat\",\n  \"record>web_link_edge\",\n  \"record>web_listing_publisher\",\n  \"record>web_location_listing\",\n  \"record>web_news_item\",\n  \"record>web_offering_template\",\n  \"record>web_page\",\n  \"record>web_page_content\",\n  \"record>web_page_evidence\",\n  \"record>web_page_sitemap\",\n  \"record>web_property\",\n  \"record>web_provider\",\n  \"record>web_result\",\n  \"record>web_search_review\",\n  \"record>web_site\",\n  \"record>web_site_endpoint_rule\",\n  \"record>web_site_item_config\",\n  \"record>web_site_offering\",\n  \"record>web_sitemap\",\n  \"record>web_snapshot\",\n  \"record>web_tag_manager_snapshot\",\n  \"record>web_temp_brand_firmographic\",\n  \"record>web_temp_brand_presence\",\n  \"record>web_temp_brand_recognition\",\n  \"record>web_voice_fingerprint\",\n  \"record>web_youtube_video\",\n  \"record>webhook_deliveries\",\n  \"record>webhook_dispatch_state\",\n  \"record>webhook_test_receipt\",\n  \"record>webhooks\",\n  \"record>wf_node_data_slot\",\n  \"record>work_claim\",\n  \"record>work_item\",\n  \"record>workbook\",\n  \"record>workflow\",\n  \"record>workflow_card\",\n  \"record>workflow_checkpoint\",\n  \"record>workflow_checkpoint_value\",\n  \"record>workflow_comparison\",\n  \"record>workflow_definition_overview\",\n  \"record>workflow_definition_version\",\n  \"record>workflow_idempotency\",\n  \"record>workflow_job\",\n  \"record>workflow_node_events\",\n  \"record>workflow_node_outcome\",\n  \"record>workflow_plan\",\n  \"record>workflow_plan_event\",\n  \"record>workflow_plan_sample\",\n  \"record>workflow_recovery_audit\",\n  \"record>workflow_review_issue\",\n  \"record>workflow_run\",\n  \"record>workflow_run_log\",\n  \"record>workflow_runtime_surface\",\n  \"record>workflow_step_result\",\n  \"record>workflow_template\",\n  \"record>workflow_trigger\",\n  \"record>workflow_trigger_fire\",\n  \"record>workflow_work_item\",\n  \"record>write_guard_key\",\n  \"record>youtube_search\",\n  \"record>youtube_video\",\n  \"research_analysis>research_content\",\n  \"research_analysis>research_keyword\",\n  \"research_analysis>research_topic\",\n  \"research_document>research_document\",\n  \"research_document>research_synthesis\",\n  \"research_document>research_topic\",\n  \"research_media>category\",\n  \"research_media>web_brand\",\n  \"research_source>research_keyword\",\n  \"research_source>research_tag\",\n  \"research_source>youtube_video\",\n  \"research_synthesis>research_analysis\",\n  \"research_synthesis>research_content\",\n  \"research_synthesis>research_keyword\",\n  \"research_synthesis>research_source\",\n  \"research_synthesis>research_synthesis\",\n  \"research_synthesis>research_tag\",\n  \"research_synthesis>research_topic\",\n  \"research_tag>plan_node\",\n  \"research_tag>web_page\",\n  \"research_tag>web_site\",\n  \"research_topic>plan_node\",\n  \"research_topic>project\",\n  \"research_topic>rulebook\",\n  \"research_topic>tag\",\n  \"research_topic>web_brand\",\n  \"research_topic>web_page\",\n  \"research_topic>web_site\",\n  \"rulebook>masterwork_source\",\n  \"sch_task>record\",\n  \"sch_task>scope\",\n  \"sch_task>tag\",\n  \"scope>record\",\n  \"scope>scope\",\n  \"seo_keyword>project\",\n  \"seo_keyword>web_page\",\n  \"seo_landscape_brief>web_brand\",\n  \"seo_map_topic>seo_map_facet_value\",\n  \"seo_rank_target>tag\",\n  \"seo_topical_map>web_brand\",\n  \"shared_canvas_item>record\",\n  \"shared_canvas_item>scope\",\n  \"shared_canvas_item>tag\",\n  \"skill>web_page\",\n  \"social_ad>file\",\n  \"social_post>file\",\n  \"social_post>transcript\",\n  \"social_post>web_brand\",\n  \"social_profile>file\",\n  \"social_remix_output>social_ad\",\n  \"social_remix_output>social_post\",\n  \"social_swipe_collection>social_ad\",\n  \"social_swipe_collection>social_post\",\n  \"social_swipe_collection>social_profile\",\n  \"social_tracked_account>party\",\n  \"social_tracked_account>seo_competitor\",\n  \"social_video_project>agent_run\",\n  \"social_video_project>file\",\n  \"social_video_project>social_post\",\n  \"social_video_project>web_brand\",\n  \"structured_list>web_page\",\n  \"studio_session>agent\",\n  \"studio_session>rulebook\",\n  \"studio_session>thread\",\n  \"studio_session>web_page\",\n  \"study_media>assessment\",\n  \"study_media>content_ir_kind_instance\",\n  \"study_media>conversation\",\n  \"study_media>dataset\",\n  \"study_media>document\",\n  \"study_media>fc_set\",\n  \"study_media>file\",\n  \"study_media>note\",\n  \"study_media>processed_document\",\n  \"study_media>record\",\n  \"study_media>scope\",\n  \"study_media>scope_type\",\n  \"study_media>structured_list\",\n  \"study_media>study_media\",\n  \"study_media>tag\",\n  \"study_media>transcript\",\n  \"study_media>udt_document\",\n  \"study_media>workbook\",\n  \"study_session>content_ir_kind_instance\",\n  \"study_session>conversation\",\n  \"study_session>dataset\",\n  \"study_session>document\",\n  \"study_session>fc_set\",\n  \"study_session>file\",\n  \"study_session>note\",\n  \"study_session>processed_document\",\n  \"study_session>structured_list\",\n  \"study_session>transcript\",\n  \"study_session>udt_document\",\n  \"study_session>workbook\",\n  \"study_structured_section>scope\",\n  \"task>project\",\n  \"task>record\",\n  \"task>scope\",\n  \"task>scope_type\",\n  \"task>tag\",\n  \"task>thread\",\n  \"task>war_room\",\n  \"team>agent\",\n  \"team>membership\",\n  \"team>position\",\n  \"team>team\",\n  \"team>workflow\",\n  \"thread>record\",\n  \"thread>scope\",\n  \"thread>scope_type\",\n  \"thread>tag\",\n  \"thread>war_room\",\n  \"tool>tool_bundle\",\n  \"transcript>agent\",\n  \"transcript>data_store\",\n  \"transcript>record\",\n  \"transcript>rulebook\",\n  \"transcript>scope\",\n  \"transcript>tag\",\n  \"transcript>transcript\",\n  \"transcript>web_page\",\n  \"udt_document>agent\",\n  \"udt_document>rulebook\",\n  \"udt_document>web_page\",\n  \"war_room>record\",\n  \"war_room>scope\",\n  \"war_room>scope_type\",\n  \"war_room>tag\",\n  \"web_brand_choice>category\",\n  \"web_brand_choice>seo_ai_visibility_claim\",\n  \"web_brand_choice>seo_ai_visibility_signal\",\n  \"web_brand_choice>social_post\",\n  \"web_brand_choice>web_brand_asset\",\n  \"web_brand_choice>web_brand_choice\",\n  \"web_brand_choice>web_brand_offering\",\n  \"web_brand_choice>web_brand_persona\",\n  \"web_brand_choice>web_brand_review\",\n  \"web_brand_choice>web_brand_testimony\",\n  \"web_brand_choice>web_business_fact\",\n  \"web_brand_choice>web_discovered_item\",\n  \"web_brand_choice>web_gsc_page_stat\",\n  \"web_brand_choice>web_temp_brand_recognition\",\n  \"web_discovered_item>party\",\n  \"web_discovered_item>web_site\",\n  \"web_page>seo_map_facet_value\",\n  \"web_page>seo_map_topic\",\n  \"web_page>task\",\n  \"web_page>web_brand\",\n  \"web_screenshot>task\",\n  \"web_site>agent_run\",\n  \"web_site>seo_topical_map\",\n  \"web_youtube_video>seo_map_topic\",\n  \"workbook>agent\",\n  \"workbook>web_page\",\n  \"workflow>agent\",\n  \"workflow>membership\",\n  \"workflow>position\",\n  \"workflow>record\",\n  \"workflow>scope\",\n  \"workflow>tag\",\n  \"workflow>team\",\n  \"workflow>web_page\",\n  \"workflow>workflow\",\n  \"youtube_video>transcript\",\n  \"youtube_video>web_page\",\n]);\n\n/** Is (source → target) a registered association pair? */\nexport function isRegisteredPair(sourceType: string, targetType: string): boolean {\n  return ASSOCIATION_PAIRS.has(`${sourceType}>${targetType}`);\n}\n","// core/titles.ts — @ai-matrx/associations/core\n//\n// Batched entity-title resolution — the \"UUIDs never render\" primitive.\n// Ported behavior-verbatim from matrx-frontend\n// `features/scopes/service/entityTitles.ts` (associations extraction W2,\n// 2026-08-29). One structural inversion: the MODULE-level session Map (banned\n// by the packaging standard — dual-loaded graphs silently split module\n// state) becomes STORE-INSTANCE state — the cache lives on the titles\n// service the store constructs once, so there is nothing to split and no\n// globalThis slot is needed.\n//\n// Association edges SHOULD carry a `label` stamped at attach time; this\n// service covers the rest (legacy unlabeled edges, rows renamed since\n// attach). Given a token + ids, it resolves titles through the\n// registry-driven candidate RPC and memoizes per store lifetime. Tokens\n// without a title column (or unregistered tokens) resolve to nothing —\n// callers fall back to `Untitled <label>` via `fallback`.\n\nimport { humanizeIdentifier } from \"@ai-matrx/kit/text-case\";\nimport type { CoreDeps } from \"./deps\";\nimport type { CandidatesServiceApi } from \"./candidates\";\n\nconst CHUNK = 200;\n\nexport function entityTitleCacheKey(token: string, id: string): string {\n  return `${token}:${id}`;\n}\n\nexport interface TitlesServiceApi {\n  /** Read the cache synchronously (for render paths after a fetch settled). */\n  get(token: string, id: string): string | null;\n  /**\n   * Push a known-fresh title into the cache (after a rename or a create), so\n   * surfaces that resolve through this service never show a stale name.\n   */\n  prime(token: string, id: string, title: string): void;\n  /** Display fallback when no label and no fetched title exist. */\n  fallback(token: string): string;\n  /**\n   * Resolve titles for `ids` of one token. Returns ONLY the resolved entries\n   * (cache + fresh reads); missing rows (deleted, no access) stay absent.\n   */\n  fetch(token: string, ids: string[]): Promise<Map<string, string>>;\n}\n\nexport function createTitlesService(\n  deps: CoreDeps,\n  candidates: CandidatesServiceApi,\n): TitlesServiceApi {\n  const { registry, errorSink } = deps;\n\n  /** `${token}:${id}` → resolved title. Store-lifetime; titles change rarely. */\n  const titleCache = new Map<string, string>();\n\n  return {\n    get(token, id) {\n      return titleCache.get(entityTitleCacheKey(token, id)) ?? null;\n    },\n\n    prime(token, id, title) {\n      const trimmed = title.trim();\n      if (trimmed) titleCache.set(entityTitleCacheKey(token, id), trimmed);\n    },\n\n    fallback(token) {\n      const info = registry.tryGetEntityInfo(token);\n      // Never the raw token (\"Untitled html_page\"): the ONE humanizer names it.\n      return `Untitled ${info?.label ?? humanizeIdentifier(token)}`;\n    },\n\n    async fetch(token, ids) {\n      const out = new Map<string, string>();\n      if (ids.length === 0) return out;\n\n      const info = registry.tryGetEntityInfo(token);\n      const missing: string[] = [];\n      for (const id of ids) {\n        const cached = titleCache.get(entityTitleCacheKey(token, id));\n        if (cached !== undefined) out.set(id, cached);\n        else missing.push(id);\n      }\n      if (missing.length === 0 || !info?.titleColumn) return out;\n\n      for (let index = 0; index < missing.length; index += CHUNK) {\n        const chunk = missing.slice(index, index + CHUNK);\n        const { data, error } = await candidates.callReferenceSearchCandidates({\n          p_token: token,\n          p_ids: chunk,\n          p_limit: chunk.length,\n        });\n        if (error) {\n          errorSink({\n            code: \"title_rpc_failed\",\n            message: `[fetchEntityTitles] candidate RPC failed for \"${token}\": ${error.message}`,\n            context: {\n              token,\n              chunkStart: index,\n              chunkSize: chunk.length,\n              detail: error,\n            },\n          });\n          continue;\n        }\n        for (const row of data) {\n          const title = row.title?.trim();\n          if (!title) continue;\n          titleCache.set(entityTitleCacheKey(token, row.id), title);\n          out.set(row.id, title);\n        }\n      }\n      return out;\n    },\n  };\n}\n","// core/store.ts — @ai-matrx/associations/core\n//\n// THE package-owned, store-agnostic cache (design Decision 3) — the one\n// runtime object a host constructs (`createAssociationsStore(cfg)`),\n// replacing matrx-frontend's ~530 lines of Redux fragments\n// (`scopesTree.associationsByKey` + `categoriesByDimension` + the\n// association/category thunks + selectors) with a subscribable store the\n// /react hooks (W3) ride via `useSyncExternalStore`. Behavior ported\n// verbatim from `features/scopes/redux/thunks/{associations,categories}.ts`\n// + the matching `scopesSlice` reducers + selectors (2026-08-29):\n//\n//   • lazy `load` with per-key IN-FLIGHT DEDUP (the thunks' Map) and\n//     `status === \"ready\"` short-circuit unless `force`;\n//   • pending keeps previous edges AND the visible error (consumers use\n//     status to disable/spin the same retry control);\n//   • add/remove reload BOTH endpoints on success (a write touches TWO\n//     endpoints — the source and the target each see the edge);\n//   • setTargets reloads the SOURCE only (the only endpoint with a\n//     deterministic post-state);\n//   • createCategory does the optimistic ECHO-INSERT then force-reloads to\n//     pick up server-derived fields authoritatively;\n//   • `getEdges`/`getCategories` return a STABLE idle default (never a fresh\n//     object per read — the useSyncExternalStore contract).\n//\n// THE NEVER-TOUCHES-CONTEXT INVARIANT, now structural: the thunks' law\n// \"NEVER dispatch appContextSlice actions\" (a durable association is NOT the\n// user's active working context) is carried over as architecture — this\n// package has no import path to any host store, and a write notifies ONLY\n// the association subscribers of the endpoints it touched (proven by test).\n//\n// Invalidation is owned here (subscribe/notify + `invalidate`). It does NOT\n// depend on `@ai-matrx/kit` — but the shape is deliberately bridgeable: a\n// host binding may register `store.invalidate` under kit `/invalidation`\n// names so ubiquitous modules can invalidate association caches with zero\n// import edge into this package's chunk.\n//\n// NO module-level mutable state anywhere in /core: every cache lives on the\n// store instance the host constructs, so the dual-bundle split-registry\n// failure the packaging standard's globalThis-slot rule exists for cannot\n// occur (there is no module state to split).\n\nimport type {\n  AssociationsEntry,\n  AssociationTargetType,\n  CategoriesEntry,\n  CategoryDimension,\n  PlatformCategory,\n} from \"../edges\";\nimport type { CommentAnchor, CommentsEntry } from \"../comments\";\nimport { isAssociationsRpcErr } from \"../results\";\nimport type {\n  AssociationsConfig,\n  AssociationsDataSource,\n  ErrorSink,\n} from \"../ports\";\nimport { asAssociationsDataSource } from \"../ports\";\nimport { createDefaultErrorSink } from \"./defaultErrorSink\";\nimport type { CoreDeps } from \"./deps\";\nimport { createAssociationGuards } from \"./guards\";\nimport { createRpcResultHelpers } from \"./rpcResult\";\nimport { createEntityRegistry, type EntityRegistry } from \"./registry\";\nimport {\n  createAssociationsService,\n  type AssociationsServiceApi,\n} from \"./associationsService\";\nimport {\n  createCategoriesService,\n  type CategoriesServiceApi,\n} from \"./categoriesService\";\nimport {\n  createFavoritesService,\n  type FavoritesServiceApi,\n} from \"./favoritesService\";\nimport { createCandidatesService, type CandidatesServiceApi } from \"./candidates\";\nimport { createTitlesService, type TitlesServiceApi } from \"./titles\";\nimport {\n  createEntityRowsService,\n  type EntityRowsServiceApi,\n} from \"./entityRows\";\nimport {\n  createAssociationHelpers,\n  type AssociationHelpersApi,\n} from \"./helpers\";\nimport {\n  createCommentsService,\n  type CommentsServiceApi,\n} from \"./commentsService\";\n\n/** Cache key for one association endpoint. */\nexport function associationsKey(type: string, id: string): string {\n  return `${type}:${id}`;\n}\n\nexport interface AssociationWriteResult {\n  ok: boolean;\n  /** Set on a successful single-edge `add`. */\n  id?: string;\n  error?: string;\n}\n\nexport interface CategoryMutationResult {\n  ok: boolean;\n  /** Set on a successful mutation. */\n  id?: string;\n  error?: string;\n}\n\nconst IDLE_ASSOCIATIONS: AssociationsEntry = Object.freeze({\n  status: \"idle\",\n  edges: Object.freeze([]) as unknown as AssociationsEntry[\"edges\"],\n  fetchedAt: null,\n  error: null,\n});\n\nconst IDLE_CATEGORIES: CategoriesEntry = Object.freeze({\n  status: \"idle\",\n  categories: Object.freeze([]) as unknown as CategoriesEntry[\"categories\"],\n  fetchedAt: null,\n  error: null,\n});\n\nconst IDLE_COMMENTS: CommentsEntry = Object.freeze({\n  status: \"idle\",\n  comments: Object.freeze([]) as unknown as CommentsEntry[\"comments\"],\n  fetchedAt: null,\n  error: null,\n});\n\nexport interface CommentMutationResult {\n  ok: boolean;\n  /** Set on a successful `addComment`. */\n  id?: string;\n  error?: string;\n}\n\nexport interface AssociationsStore {\n  // ── the cache (association endpoints) ────────────────────────────────\n  /** Stable, sync read of one endpoint's entry (idle default when uncached). */\n  getEdges(type: string, id: string): AssociationsEntry;\n  /**\n   * Lazy load of every edge touching `${type}:${id}` (both directions).\n   * Deduped per key; `status === \"ready\"` short-circuits unless `force`.\n   */\n  load(type: string, id: string, opts?: { force?: boolean }): Promise<void>;\n  /** External-store contract: notified whenever the key's entry changes. */\n  subscribe(key: string, cb: () => void): () => void;\n  /** Attach source → target; on success reloads BOTH endpoints. */\n  add(args: {\n    sourceType: string;\n    sourceId: string;\n    targetType: AssociationTargetType;\n    targetId: string;\n    orgId?: string;\n    label?: string;\n    role?: string;\n    metadata?: unknown;\n    replaceMetadata?: boolean;\n  }): Promise<AssociationWriteResult>;\n  /** Detach source → target; on success reloads BOTH endpoints. */\n  remove(args: {\n    sourceType: string;\n    sourceId: string;\n    targetType: string;\n    targetId: string;\n    role?: string;\n  }): Promise<AssociationWriteResult>;\n  /** Replace the source's `targetType` edge set; reloads the SOURCE. */\n  setTargets(args: {\n    sourceType: string;\n    sourceId: string;\n    targetType: AssociationTargetType;\n    targetIds: string[];\n    orgId?: string;\n    role?: string;\n  }): Promise<AssociationWriteResult>;\n  /** Reset one endpoint to idle and notify its subscribers. */\n  invalidate(type: string, id: string): void;\n  /** Reset every association endpoint, category facet, and comment thread. */\n  invalidateAll(): void;\n\n  // ── the cache (category facets) ──────────────────────────────────────\n  getCategories(dimension: CategoryDimension): CategoriesEntry;\n  loadCategories(\n    dimension: CategoryDimension,\n    opts?: { force?: boolean },\n  ): Promise<void>;\n  subscribeCategories(dimension: CategoryDimension, cb: () => void): () => void;\n  /** Create + echo-insert + authoritative force reload. Returns the new id. */\n  createCategory(args: {\n    dimension: CategoryDimension;\n    name: string;\n    orgId: string;\n    parentId?: string | null;\n    color?: string | null;\n    icon?: string | null;\n    slug?: string | null;\n  }): Promise<CategoryMutationResult>;\n  updateCategory(args: {\n    dimension: CategoryDimension;\n    id: string;\n    name: string;\n    slug: string | null;\n    color: string | null;\n    icon: string | null;\n    position: number | null;\n  }): Promise<CategoryMutationResult>;\n  reparentCategory(args: {\n    dimension: CategoryDimension;\n    id: string;\n    parentId: string | null;\n  }): Promise<CategoryMutationResult>;\n  deleteCategory(args: {\n    dimension: CategoryDimension;\n    id: string;\n  }): Promise<CategoryMutationResult>;\n\n  // ── the cache (comment threads, W6) ──────────────────────────────────\n  /** Stable, sync read of one entity's comment thread (idle when uncached). */\n  getComments(type: string, id: string): CommentsEntry;\n  /**\n   * Lazy load of every comment on `${type}:${id}` (oldest→newest; thread by\n   * `parentId`). Deduped per key; `status === \"ready\"` short-circuits unless\n   * `force`.\n   */\n  loadComments(\n    type: string,\n    id: string,\n    opts?: { force?: boolean },\n  ): Promise<void>;\n  /** External-store contract for one entity's comment thread. */\n  subscribeComments(key: string, cb: () => void): () => void;\n  /** Post a comment (or a reply); on success force-reloads the thread. */\n  addComment(args: {\n    entityType: string;\n    entityId: string;\n    body: string;\n    parentId?: string | null;\n    orgId?: string | null;\n    anchor?: CommentAnchor | null;\n  }): Promise<CommentMutationResult>;\n  /** Edit a comment body (author-only in the RPC); reloads the thread. */\n  editComment(args: {\n    entityType: string;\n    entityId: string;\n    id: string;\n    body: string;\n  }): Promise<CommentMutationResult>;\n  /** Soft-delete a comment (author/org member in the RPC); reloads the thread. */\n  deleteComment(args: {\n    entityType: string;\n    entityId: string;\n    id: string;\n  }): Promise<CommentMutationResult>;\n  /** Reset one entity's comment thread to idle and notify its subscribers. */\n  invalidateComments(type: string, id: string): void;\n\n  // ── the seams under the cache ────────────────────────────────────────\n  /** Batched title resolution + the session cache + prime. */\n  titles: TitlesServiceApi;\n  /** Per-user favorite/pinned/hidden state (`ues_*`). */\n  favorites: FavoritesServiceApi;\n  /** Candidate reads for the pickers. */\n  candidates: CandidatesServiceApi;\n  /** Generic registry-convention row create/rename. */\n  entityRows: EntityRowsServiceApi;\n  /** Composite link helpers over the chokepoint. */\n  helpers: AssociationHelpersApi;\n  /** The registry merge engine (generated metadata + host overlay). */\n  registry: EntityRegistry;\n  /**\n   * The raw chokepoint services — every RPC family, results-enveloped.\n   * `associations` writes here do NOT touch the cache; use the store-level\n   * `add`/`remove`/`setTargets` when a cached surface must stay fresh.\n   */\n  services: {\n    associations: AssociationsServiceApi;\n    categories: CategoriesServiceApi;\n    comments: CommentsServiceApi;\n  };\n  /** Merge more host overlay entries in (icons/routes/candidate loaders). */\n  registerEntityOverlay: EntityRegistry[\"registerEntityOverlay\"];\n  /**\n   * The bound scream seam (W3, additive): /react surfaces route their loud\n   * recoveries here (the originals' console.error sites) without a second\n   * sink binding. Same function the host passed at construction.\n   */\n  errorSink: ErrorSink;\n  /**\n   * The bound data seam (0.6.0, additive): the provider's demanded-schema\n   * boot probe reads it so hosts stop re-exporting their dataSource just to\n   * run a check the package owns.\n   */\n  dataSource: AssociationsDataSource;\n  /**\n   * The bound identity port (W3, additive): /react hooks that FILTER by the\n   * current user (candidate owner scoping) read it leniently; write paths\n   * keep going through the services, where `requireUserId` failures stay\n   * loud. Same object the host passed at construction.\n   */\n  identity: AssociationsConfig[\"identity\"];\n}\n\n/**\n * Build the one store a host binds. The REQUIRED ports (dataSource /\n * identity — true app identity, C23) throw at construction when absent.\n * Every other port has a SHIPPED DEFAULT (errorSink since 0.6.0) or a\n * documented degradation; nothing is ever silently missing.\n */\nexport function createAssociationsStore(\n  config: AssociationsConfig,\n): AssociationsStore {\n  // An { rpc }-only client is adapted (0.14.5), so the bridges every host passed before 0.14.0\n  // keep working; only a missing client, or one with neither schema() nor rpc(), throws.\n  const dataSource = asAssociationsDataSource(config?.dataSource);\n  if (!config || !dataSource) {\n    throw new Error(\n      \"@ai-matrx/associations: the REQUIRED dataSource port is missing \" +\n        \"(pass the supabase-js client itself, or an { rpc } client for the \" +\n        \"public schema's functions). The package IS data operations; there \" +\n        \"is no degraded mode without one.\",\n    );\n  }\n  if (typeof config.identity?.requireUserId !== \"function\") {\n    throw new Error(\n      \"@ai-matrx/associations: the REQUIRED identity port is missing \" +\n        \"(need requireUserId(): string that THROWS when unauthenticated). \" +\n        \"Identity never comes from a store import.\",\n    );\n  }\n  // `errorSink` stopped being required in 0.6.0 (C23): the package ships the\n  // obvious sink instead of refusing to construct. The default is LOUD about\n  // being the default — see createDefaultErrorSink.\n  const errorSink: ErrorSink =\n    typeof config.errorSink === \"function\"\n      ? config.errorSink\n      : createDefaultErrorSink();\n  const registry = createEntityRegistry(errorSink, config.entityOverlay);\n  const deps: CoreDeps = {\n    dataSource,\n    identity: config.identity,\n    errorSink,\n    guards: createAssociationGuards(errorSink),\n    rpc: createRpcResultHelpers(\n      errorSink,\n      config.identity.sessionAttached\n        ? () => config.identity.sessionAttached!()\n        : undefined,\n    ),\n    registry,\n  };\n\n  const associations = createAssociationsService(deps);\n  const categories = createCategoriesService(deps);\n  const favorites = createFavoritesService(deps);\n  const candidates = createCandidatesService(deps);\n  const titles = createTitlesService(deps, candidates);\n  const entityRows = createEntityRowsService(deps, titles);\n  const helpers = createAssociationHelpers(associations);\n  const comments = createCommentsService(deps);\n\n  // ── instance state (never module state) ────────────────────────────────\n  const assocByKey = new Map<string, AssociationsEntry>();\n  const assocSubs = new Map<string, Set<() => void>>();\n  const assocInFlight = new Map<string, Promise<void>>();\n  const catByDim = new Map<string, CategoriesEntry>();\n  const catSubs = new Map<string, Set<() => void>>();\n  const catInFlight = new Map<string, Promise<void>>();\n  const cmtByKey = new Map<string, CommentsEntry>();\n  const cmtSubs = new Map<string, Set<() => void>>();\n  const cmtInFlight = new Map<string, Promise<void>>();\n\n  function notifyAssoc(key: string): void {\n    const subs = assocSubs.get(key);\n    if (subs) for (const cb of [...subs]) cb();\n  }\n  function notifyCat(dimension: string): void {\n    const subs = catSubs.get(dimension);\n    if (subs) for (const cb of [...subs]) cb();\n  }\n  function setAssoc(key: string, entry: AssociationsEntry): void {\n    assocByKey.set(key, entry);\n    notifyAssoc(key);\n  }\n  function setCat(dimension: string, entry: CategoriesEntry): void {\n    catByDim.set(dimension, entry);\n    notifyCat(dimension);\n  }\n  function notifyCmt(key: string): void {\n    const subs = cmtSubs.get(key);\n    if (subs) for (const cb of [...subs]) cb();\n  }\n  function setCmt(key: string, entry: CommentsEntry): void {\n    cmtByKey.set(key, entry);\n    notifyCmt(key);\n  }\n\n  // ── association cache ops (verbatim thunk/reducer behavior) ────────────\n  async function load(\n    type: string,\n    id: string,\n    opts: { force?: boolean } = {},\n  ): Promise<void> {\n    const force = opts.force ?? false;\n    if (!type || !id) return;\n    const key = associationsKey(type, id);\n    const entry = assocByKey.get(key);\n\n    if (!force && entry?.status === \"ready\") return;\n    const pending = assocInFlight.get(key);\n    if (!force && entry?.status === \"loading\" && pending) return pending;\n\n    const prev = assocByKey.get(key);\n    setAssoc(key, {\n      status: \"loading\",\n      edges: prev?.edges ?? [],\n      fetchedAt: prev?.fetchedAt ?? null,\n      // Retain the visible failure while a retry is pending — consumers use\n      // status to disable/spin the same retry control.\n      error: prev?.error ?? null,\n    });\n\n    const promise = (async () => {\n      try {\n        const res = await associations.listForEntity(type, id);\n        if (isAssociationsRpcErr(res)) {\n          const before = assocByKey.get(key);\n          setAssoc(key, {\n            status: \"error\",\n            edges: before?.edges ?? [],\n            fetchedAt: before?.fetchedAt ?? null,\n            error: res.error.message,\n          });\n        } else {\n          setAssoc(key, {\n            status: \"ready\",\n            edges: res.data.edges,\n            fetchedAt: Date.now(),\n            error: null,\n          });\n        }\n      } finally {\n        assocInFlight.delete(key);\n      }\n    })();\n\n    assocInFlight.set(key, promise);\n    return promise;\n  }\n\n  /** Reload both endpoints of an edge so each side's cache is fresh. */\n  async function reloadBoth(\n    sourceType: string,\n    sourceId: string,\n    targetType: string,\n    targetId: string,\n  ): Promise<void> {\n    await Promise.all([\n      load(sourceType, sourceId, { force: true }),\n      load(targetType, targetId, { force: true }),\n    ]);\n  }\n\n  // ── category cache ops (verbatim thunk/reducer behavior) ───────────────\n  async function loadCategories(\n    dimension: CategoryDimension,\n    opts: { force?: boolean } = {},\n  ): Promise<void> {\n    const force = opts.force ?? false;\n    if (!dimension) return;\n    const entry = catByDim.get(dimension);\n\n    if (!force && entry?.status === \"ready\") return;\n    const pending = catInFlight.get(dimension);\n    if (!force && entry?.status === \"loading\" && pending) return pending;\n\n    const prev = catByDim.get(dimension);\n    setCat(dimension, {\n      status: \"loading\",\n      categories: prev?.categories ?? [],\n      fetchedAt: prev?.fetchedAt ?? null,\n      error: null,\n    });\n\n    const promise = (async () => {\n      try {\n        const res = await categories.list(dimension);\n        if (isAssociationsRpcErr(res)) {\n          const before = catByDim.get(dimension);\n          setCat(dimension, {\n            status: \"error\",\n            categories: before?.categories ?? [],\n            fetchedAt: before?.fetchedAt ?? null,\n            error: res.error.message,\n          });\n        } else {\n          setCat(dimension, {\n            status: \"ready\",\n            categories: res.data.categories,\n            fetchedAt: Date.now(),\n            error: null,\n          });\n        }\n      } finally {\n        catInFlight.delete(dimension);\n      }\n    })();\n\n    catInFlight.set(dimension, promise);\n    return promise;\n  }\n\n  // ── comment-thread cache ops (W6; same lifecycle as associations) ──────\n  async function loadComments(\n    type: string,\n    id: string,\n    opts: { force?: boolean } = {},\n  ): Promise<void> {\n    const force = opts.force ?? false;\n    if (!type || !id) return;\n    const key = associationsKey(type, id);\n    const entry = cmtByKey.get(key);\n\n    if (!force && entry?.status === \"ready\") return;\n    const pending = cmtInFlight.get(key);\n    if (!force && entry?.status === \"loading\" && pending) return pending;\n\n    const prev = cmtByKey.get(key);\n    setCmt(key, {\n      status: \"loading\",\n      comments: prev?.comments ?? [],\n      fetchedAt: prev?.fetchedAt ?? null,\n      // Retain the visible failure while a retry is pending (same contract\n      // as the association cache).\n      error: prev?.error ?? null,\n    });\n\n    const promise = (async () => {\n      try {\n        const res = await comments.listForEntity(type, id);\n        if (isAssociationsRpcErr(res)) {\n          const before = cmtByKey.get(key);\n          setCmt(key, {\n            status: \"error\",\n            comments: before?.comments ?? [],\n            fetchedAt: before?.fetchedAt ?? null,\n            error: res.error.message,\n          });\n        } else {\n          setCmt(key, {\n            status: \"ready\",\n            comments: res.data.comments,\n            fetchedAt: Date.now(),\n            error: null,\n          });\n        }\n      } finally {\n        cmtInFlight.delete(key);\n      }\n    })();\n\n    cmtInFlight.set(key, promise);\n    return promise;\n  }\n\n  return {\n    // ── associations ─────────────────────────────────────────────────────\n    getEdges(type, id) {\n      if (!type || !id) return IDLE_ASSOCIATIONS;\n      return assocByKey.get(associationsKey(type, id)) ?? IDLE_ASSOCIATIONS;\n    },\n\n    load,\n\n    subscribe(key, cb) {\n      let subs = assocSubs.get(key);\n      if (!subs) {\n        subs = new Set();\n        assocSubs.set(key, subs);\n      }\n      subs.add(cb);\n      return () => {\n        subs.delete(cb);\n        if (subs.size === 0) assocSubs.delete(key);\n      };\n    },\n\n    async add(args) {\n      const res = await associations.add(args);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await reloadBoth(\n        args.sourceType,\n        args.sourceId,\n        args.targetType,\n        args.targetId,\n      );\n      return { ok: true, id: res.data.id };\n    },\n\n    async remove(args) {\n      const res = await associations.remove(args);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await reloadBoth(\n        args.sourceType,\n        args.sourceId,\n        args.targetType,\n        args.targetId,\n      );\n      return { ok: true };\n    },\n\n    /**\n     * Reloads the SOURCE endpoint only — the one endpoint with a\n     * deterministic post-state; each affected target reload would need the\n     * full before/after diff, so callers displaying a specific target\n     * refresh it via `load(..., { force: true })`.\n     */\n    async setTargets(args) {\n      const res = await associations.setTargets(args);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await load(args.sourceType, args.sourceId, { force: true });\n      return { ok: true };\n    },\n\n    invalidate(type, id) {\n      const key = associationsKey(type, id);\n      if (assocByKey.delete(key)) notifyAssoc(key);\n    },\n\n    invalidateAll() {\n      const assocKeys = [...assocByKey.keys()];\n      assocByKey.clear();\n      for (const key of assocKeys) notifyAssoc(key);\n      const dims = [...catByDim.keys()];\n      catByDim.clear();\n      for (const dim of dims) notifyCat(dim);\n      const cmtKeys = [...cmtByKey.keys()];\n      cmtByKey.clear();\n      for (const key of cmtKeys) notifyCmt(key);\n    },\n\n    // ── categories ───────────────────────────────────────────────────────\n    getCategories(dimension) {\n      if (!dimension) return IDLE_CATEGORIES;\n      return catByDim.get(dimension) ?? IDLE_CATEGORIES;\n    },\n\n    loadCategories,\n\n    subscribeCategories(dimension, cb) {\n      let subs = catSubs.get(dimension);\n      if (!subs) {\n        subs = new Set();\n        catSubs.set(dimension, subs);\n      }\n      subs.add(cb);\n      return () => {\n        subs.delete(cb);\n        if (subs.size === 0) catSubs.delete(dimension);\n      };\n    },\n\n    async createCategory(args) {\n      const res = await categories.create(args);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      // Optimistic echo so the new id shows immediately, then force-reload\n      // to pick up server-derived fields (slug, position) authoritatively.\n      const optimistic: PlatformCategory = {\n        id: res.data.id,\n        orgId: args.orgId,\n        dimension: args.dimension,\n        name: args.name,\n        slug: args.slug ?? null,\n        parentId: args.parentId ?? null,\n        isSystem: false,\n        color: args.color ?? null,\n        icon: args.icon ?? null,\n        metadata: null,\n        position: null,\n      };\n      const prev = catByDim.get(args.dimension);\n      const existing = prev?.categories ?? [];\n      if (!existing.some((c) => c.id === optimistic.id)) {\n        setCat(args.dimension, {\n          status: \"ready\",\n          categories: [...existing, optimistic],\n          fetchedAt: prev?.fetchedAt ?? Date.now(),\n          error: null,\n        });\n      }\n      await loadCategories(args.dimension, { force: true });\n      return { ok: true, id: res.data.id };\n    },\n\n    async updateCategory(args) {\n      const res = await categories.update(args);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await loadCategories(args.dimension, { force: true });\n      return { ok: true, id: res.data.id };\n    },\n\n    async reparentCategory(args) {\n      const res = await categories.reparent(args);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await loadCategories(args.dimension, { force: true });\n      return { ok: true, id: res.data.id };\n    },\n\n    async deleteCategory(args) {\n      const res = await categories.delete(args.id);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await loadCategories(args.dimension, { force: true });\n      return { ok: true, id: res.data.id };\n    },\n\n    // ── comments (W6) ────────────────────────────────────────────────────\n    getComments(type, id) {\n      if (!type || !id) return IDLE_COMMENTS;\n      return cmtByKey.get(associationsKey(type, id)) ?? IDLE_COMMENTS;\n    },\n\n    loadComments,\n\n    subscribeComments(key, cb) {\n      let subs = cmtSubs.get(key);\n      if (!subs) {\n        subs = new Set();\n        cmtSubs.set(key, subs);\n      }\n      subs.add(cb);\n      return () => {\n        subs.delete(cb);\n        if (subs.size === 0) cmtSubs.delete(key);\n      };\n    },\n\n    async addComment(args) {\n      const res = await comments.add(args);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await loadComments(args.entityType, args.entityId, { force: true });\n      return { ok: true, id: res.data.id };\n    },\n\n    async editComment(args) {\n      const res = await comments.edit(args.id, args.body);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await loadComments(args.entityType, args.entityId, { force: true });\n      return { ok: true, id: args.id };\n    },\n\n    async deleteComment(args) {\n      const res = await comments.remove(args.id);\n      if (isAssociationsRpcErr(res)) {\n        return { ok: false, error: res.error.message };\n      }\n      await loadComments(args.entityType, args.entityId, { force: true });\n      return { ok: true, id: args.id };\n    },\n\n    invalidateComments(type, id) {\n      const key = associationsKey(type, id);\n      if (cmtByKey.delete(key)) notifyCmt(key);\n    },\n\n    // ── seams ────────────────────────────────────────────────────────────\n    titles,\n    favorites,\n    candidates,\n    entityRows,\n    helpers,\n    registry,\n    services: { associations, categories, comments },\n    registerEntityOverlay: registry.registerEntityOverlay,\n    errorSink,\n    dataSource,\n    identity: config.identity,\n  };\n}\n","// react/hooks/useContainerLinks.ts — @ai-matrx/associations/react\n//\n// The READ + WRITE hook for a CONTAINER's associations, from the container's\n// point of view (\"what is attached to this org / scope / project?\").\n//\n// Direction (canonical, consistent with scope-tagging): the resource is the\n// edge SOURCE and the container is the edge TARGET — `task → organization`,\n// `file → scope`. So a container's attached resources are its INCOMING edges.\n//\n// 🚨 EXCEPT WHERE THE REGISTRY SAYS OTHERWISE (page-pass 2026-09-27, /crm/<id>).\n// The database accepts an edge only in a REGISTERED direction, and some kinds\n// are registered the other way round: \"Party attached to a task\" is\n// `party → task`, and `task → party` is refused. So a person's Tasks tile\n// counted only `task → party` edges (there are none) and its \"+\" wrote the\n// refused direction. Each kind is now read and written in its registered\n// direction (`linkDirection`, from the generated `ASSOCIATION_PAIRS`): when only\n// `container → token` is registered, the container's links of that kind are\n// its OUTGOING edges and \"+\" writes `container → token`.\n//\n// It normally reads through `useAssociations({ type: containerType,\n// id: containerId })` (shared store cache). Conversation file attachments use\n// the viewer-aware `conversation_files` RPC instead: the generic association\n// reader is org-filtered and would omit files for an explicitly shared\n// cross-org conversation. Writes still use the one association chokepoint.\n//\n// Ported signature-byte-compatible from matrx-frontend\n// `features/scopes/hooks/useContainerLinks.ts` (W3, 2026-08-29): thunk\n// dispatches → store writes; `associationsService` singleton → the store's\n// chokepoint service; the host `Json` type → `unknown` at the package\n// boundary (packaging standard's JSON rule).\n\nimport {\n  useCallback,\n  useEffect,\n  useRef,\n  useSyncExternalStore,\n} from \"react\";\n\nimport {\n  isAssociationTargetType,\n  type AssociationEdge,\n  type AssociationTargetType,\n} from \"../../edges\";\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport { isRegisteredPair } from \"../../association-types.generated\";\nimport { isAssociationsRpcErr } from \"../../results\";\nimport type { AssociationWriteResult } from \"../../core/store\";\nimport type { PrimaryEntity } from \"../components/PrimaryEntityContext\";\nimport { useAssociationsStore } from \"../context\";\nimport { useAssociations } from \"./useAssociations\";\n\nexport interface ContainerLink {\n  /** The edge id (for keys / removal). */\n  edgeId: string;\n  /** The attached resource's id (the edge source). */\n  resourceId: string;\n  /** The attached resource's entity token (the edge source type). */\n  token: string;\n  /** The edge role, or null for a plain (role-less) association. */\n  role: string | null;\n  label: string | null;\n  /** Per-edge props from `platform.associations.metadata` (e.g. representation). */\n  metadata: unknown;\n}\n\ninterface UseContainerLinksBase {\n  containerId: string | null;\n  /** Org to stamp on new edges (for org-scoped RLS / counts). */\n  orgId?: string | null;\n}\n\n/**\n * `incoming` (default): the primary is a container (edge TARGET) — links are\n * what is attached into it. `outgoing`: the primary is filed under containers\n * (edge SOURCE) — links are the containers it is filed under, and `attach`\n * writes `primary → container` (the same role-less edge the landing door\n * writes), refusing tokens that are not container types.\n */\nexport type UseContainerLinksArgs =\n  | (UseContainerLinksBase & {\n      containerType: AssociationTargetType;\n      direction?: \"incoming\";\n    })\n  | (UseContainerLinksBase & {\n      containerType: EntityTypeToken;\n      direction: \"outgoing\";\n    });\n\nexport interface UseContainerLinksReturn {\n  status: ReturnType<typeof useAssociations>[\"status\"];\n  error: string | null;\n  reload: () => Promise<void>;\n  /** Total attached resources across every token (all incoming edges). */\n  totalCount: number;\n  /** Live count of attached resources of `token`. */\n  countFor: (token: EntityTypeToken) => number;\n  /** Ids of resources of `token` already attached (for picker \"attached\" state). */\n  attachedIdsFor: (token: EntityTypeToken) => Set<string>;\n  /** Full link rows of `token` (for listing/removal). */\n  linksFor: (token: EntityTypeToken) => ContainerLink[];\n  /** Every token that has at least one link, in first-seen order. */\n  presentTokens: string[];\n  /** Attach a resource (source) to this container (target). */\n  attach: (\n    token: EntityTypeToken,\n    resourceId: string,\n    label?: string,\n    metadata?: unknown,\n    options?: {\n      replaceMetadata?: boolean;\n      /**\n       * Semantic edge role (`platform.associations.role`) — e.g. the\n       * Masterwork dump surface stamps `distillation_source`. Omitted = the\n       * canonical role-less edge. Detach with the SAME role to remove it.\n       */\n      role?: string;\n    },\n  ) => Promise<AssociationWriteResult>;\n  /** Detach a resource from this container. */\n  detach: (\n    token: EntityTypeToken,\n    resourceId: string,\n    role?: string,\n  ) => Promise<AssociationWriteResult>;\n  /**\n   * Toggle the edge's agent-context pin while preserving every other metadata\n   * field and the exact semantic role.\n   */\n  setPinned: (\n    token: EntityTypeToken,\n    resourceId: string,\n    pinned: boolean,\n    role?: string,\n  ) => Promise<AssociationWriteResult>;\n}\n\n/**\n * Which way a container's links of `token` point, by the registry.\n * `from-container` only when `container → token` is registered and\n * `token → container` is not; otherwise the canonical incoming direction.\n */\nexport function linkDirection(\n  containerType: string,\n  token: string,\n): \"into-container\" | \"from-container\" {\n  return isRegisteredPair(containerType, token) && !isRegisteredPair(token, containerType)\n    ? \"from-container\"\n    : \"into-container\";\n}\n\nfunction metadataRecord(metadata: unknown): Record<string, unknown> | null {\n  if (\n    metadata === null ||\n    typeof metadata !== \"object\" ||\n    Array.isArray(metadata)\n  ) {\n    return metadata == null ? {} : null;\n  }\n  return Object.fromEntries(Object.entries(metadata));\n}\n\ninterface ConversationFilesEntry {\n  readonly key: string;\n  readonly files: ContainerLink[];\n  readonly error: string | null;\n  readonly loading: boolean;\n}\n\ninterface ConversationFilesCache {\n  get(key: string): ConversationFilesEntry | null;\n  subscribe(listener: () => void): () => void;\n  /** Read unless kept (`force` reads anyway; a read in flight is joined unless forced). */\n  load(key: string, conversationId: string, force: boolean): Promise<void>;\n}\n\ntype AssociationsStoreLike = ReturnType<typeof useAssociationsStore>;\nconst conversationFileCaches = new WeakMap<AssociationsStoreLike, ConversationFilesCache>();\n\n/** One conversation-file inventory per conversation per store (= per tab). */\nfunction conversationFilesFor(store: AssociationsStoreLike): ConversationFilesCache {\n  const existing = conversationFileCaches.get(store);\n  if (existing) return existing;\n  const entries = new Map<string, ConversationFilesEntry>();\n  const inflight = new Map<string, Promise<void>>();\n  const seqs = new Map<string, number>();\n  const listeners = new Set<() => void>();\n  const set = (entry: ConversationFilesEntry) => {\n    entries.set(entry.key, entry);\n    for (const listener of listeners) listener();\n  };\n  const cache: ConversationFilesCache = {\n    get: (key) => entries.get(key) ?? null,\n    subscribe(listener) {\n      listeners.add(listener);\n      return () => {\n        listeners.delete(listener);\n      };\n    },\n    load(key, conversationId, force) {\n      const kept = entries.get(key);\n      if (!force) {\n        const running = inflight.get(key);\n        if (running) return running;\n        // A failed read is never kept as the answer: coming back asks again.\n        if (kept && !kept.loading && kept.error === null) return Promise.resolve();\n      }\n      const seq = (seqs.get(key) ?? 0) + 1;\n      seqs.set(key, seq);\n      // Keep the visible list and failure while retrying, so the same control\n      // can show progress instead of disappearing.\n      set({ key, files: kept?.files ?? [], error: kept?.error ?? null, loading: true });\n      const request = store.services.associations.listConversationFiles(conversationId).then((result) => {\n        if (seqs.get(key) !== seq) return; // a newer read was asked: this answer is old\n        if (isAssociationsRpcErr(result)) {\n          set({ key, files: entries.get(key)?.files ?? [], error: result.error.message, loading: false });\n          return;\n        }\n        set({\n          key,\n          files: result.data.files.map((file) => ({\n            edgeId: `conversation-file:${file.fileId}`,\n            resourceId: file.fileId,\n            token: \"file\",\n            role: null,\n            label: file.label,\n            metadata: file.metadata,\n          })),\n          error: null,\n          loading: false,\n        });\n      });\n      const tracked = request.finally(() => {\n        if (inflight.get(key) === tracked) inflight.delete(key);\n      });\n      inflight.set(key, tracked);\n      return tracked;\n    },\n  };\n  conversationFileCaches.set(store, cache);\n  return cache;\n}\n\nexport function useContainerLinks(\n  args: UseContainerLinksArgs,\n): UseContainerLinksReturn {\n  const { containerType, containerId, orgId } = args;\n  const outgoing = args.direction === \"outgoing\";\n  const store = useAssociationsStore();\n\n  const {\n    edges,\n    status: genericStatus,\n    error: genericError,\n    fetchedAt: genericFetchedAt,\n    reload: reloadGeneric,\n  } = useAssociations({\n    type: containerType,\n    id: containerId,\n  });\n\n  const conversationKey =\n    !outgoing && containerType === \"conversation\" && containerId\n      ? `conversation:${containerId}`\n      : null;\n  // 🚨 KEPT BY CONVERSATION, NOT BY THIS HOOK (the remount law, 2026-10-03). The\n  // inventory lives in one per-store cache entry per conversation: the first\n  // view reads, and a wake from sleep, a remount, an Undo or a second view\n  // renders the kept list and reads NOTHING (it lived in this hook's state, so\n  // every mount read `conversation_files` again). A store write to the\n  // conversation re-reads it (below); an older read's answer never lands over\n  // a newer one.\n  const files = conversationFilesFor(store);\n  const conversationResult = useSyncExternalStore(\n    files.subscribe,\n    () => (conversationKey ? files.get(conversationKey) : null),\n    () => null,\n  );\n  const loadConversationFiles = useCallback(\n    async (force = true): Promise<void> => {\n      if (!conversationKey || !containerId) return;\n      await files.load(conversationKey, containerId, force);\n    },\n    [containerId, conversationKey, files],\n  );\n\n  useEffect(() => {\n    // Mount and wake: read unless this conversation's inventory is kept.\n    void loadConversationFiles(false);\n  }, [loadConversationFiles]);\n\n  // A write to this conversation through the STORE by any other caller (a\n  // composer's attach, a detach elsewhere) force-reloads the conversation's\n  // generic edges — the dedicated file inventory must follow, or an attached\n  // file is invisible here until remount while the agent already receives it.\n  // The first generic load (no previous stamp) is skipped: the mount effect\n  // above already read the inventory.\n  const lastGenericFetch = useRef<{ key: string | null; at: unknown }>({\n    key: conversationKey,\n    at: null,\n  });\n  useEffect(() => {\n    const previous = lastGenericFetch.current;\n    lastGenericFetch.current = { key: conversationKey, at: genericFetchedAt };\n    if (!conversationKey || genericFetchedAt == null) return;\n    if (previous.key !== conversationKey || previous.at == null) return;\n    if (previous.at === genericFetchedAt) return;\n    void loadConversationFiles();\n  }, [conversationKey, genericFetchedAt, loadConversationFiles]);\n\n  const conversationFiles =\n    conversationResult?.key === conversationKey ? conversationResult.files : [];\n  const conversationFileError =\n    conversationResult?.key === conversationKey\n      ? conversationResult.error\n      : null;\n  const conversationFileStatus =\n    outgoing || containerType !== \"conversation\"\n      ? \"idle\"\n      : conversationResult?.key !== conversationKey\n        ? \"loading\"\n        : conversationResult.loading\n          ? \"loading\"\n          : conversationFileError\n            ? \"error\"\n            : \"ready\";\n\n  // A container's attached resources are the edges pointing AT it (incoming).\n  // Suppress the generic conversation-file copy because its org-filtered read\n  // is intentionally replaced by the viewer-aware dedicated result above.\n  // Outward mode: the containers the primary is filed under — its OUTGOING edges.\n  const incomingGeneric: ContainerLink[] = edges\n    .filter((edge: AssociationEdge) =>\n      outgoing\n        ? edge.direction === \"outgoing\"\n        : !(containerType === \"conversation\" && edge.otherType === \"file\") &&\n          (linkDirection(containerType, edge.otherType) === \"from-container\"\n            ? edge.direction === \"outgoing\"\n            : edge.direction === \"incoming\"),\n    )\n    .map((edge) => ({\n      edgeId: edge.id,\n      resourceId: edge.otherId,\n      token: edge.otherType,\n      role: edge.role ?? null,\n      label: edge.label ?? null,\n      metadata: edge.metadata ?? {},\n    }));\n  const incoming =\n    !outgoing && containerType === \"conversation\"\n      ? [...incomingGeneric, ...conversationFiles]\n      : incomingGeneric;\n\n  /**\n   * The edge endpoints for (token, id) in this mode. Outgoing requires the\n   * token to be a container type — anything else is refused before a write.\n   */\n  const endpoints = (\n    token: EntityTypeToken,\n    resourceId: string,\n  ):\n    | {\n        sourceType: EntityTypeToken;\n        sourceId: string;\n        targetType: AssociationTargetType;\n        targetId: string;\n      }\n    | { error: string } => {\n    if (!containerId) return { error: \"Missing container id\" };\n    if (outgoing) {\n      if (!isAssociationTargetType(token)) {\n        return {\n          error: `A ${token.replace(/_/g, \" \")} cannot be filed under: it is not a container type.`,\n        };\n      }\n      return {\n        sourceType: containerType,\n        sourceId: containerId,\n        targetType: token,\n        targetId: resourceId,\n      };\n    }\n    if (linkDirection(containerType, token) === \"from-container\") {\n      // Registered as container → token (e.g. party → task). The token is the\n      // edge TARGET, so it must be a container type the store writes to.\n      if (!isAssociationTargetType(token)) {\n        return {\n          error: `A ${token.replace(/_/g, \" \")} is attached from this record, but it is not a type the store attaches to.`,\n        };\n      }\n      return {\n        sourceType: containerType,\n        sourceId: containerId,\n        targetType: token,\n        targetId: resourceId,\n      };\n    }\n    return {\n      sourceType: token,\n      sourceId: resourceId,\n      targetType: containerType as AssociationTargetType,\n      targetId: containerId,\n    };\n  };\n\n  const linksFor = (token: EntityTypeToken): ContainerLink[] =>\n    incoming.filter((link) => link.token === token);\n\n  const countFor = (token: EntityTypeToken): number =>\n    incoming.reduce((n, link) => (link.token === token ? n + 1 : n), 0);\n\n  const attachedIdsFor = (token: EntityTypeToken): Set<string> => {\n    const set = new Set<string>();\n    for (const link of incoming) {\n      if (link.token === token) set.add(link.resourceId);\n    }\n    return set;\n  };\n\n  const attach = async (\n    token: EntityTypeToken,\n    resourceId: string,\n    label?: string,\n    metadata?: unknown,\n    options?: { replaceMetadata?: boolean; role?: string },\n  ): Promise<AssociationWriteResult> => {\n    const ends = endpoints(token, resourceId);\n    if (\"error\" in ends) return { ok: false, error: ends.error };\n    const result = await store.add({\n      ...ends,\n      ...(orgId != null ? { orgId } : {}),\n      ...(label !== undefined ? { label } : {}),\n      ...(metadata !== undefined ? { metadata } : {}),\n      ...(options?.role !== undefined ? { role: options.role } : {}),\n      ...(options?.replaceMetadata !== undefined\n        ? { replaceMetadata: options.replaceMetadata }\n        : {}),\n    });\n    if (result.ok && !outgoing && containerType === \"conversation\" && token === \"file\") {\n      await loadConversationFiles();\n    }\n    return result;\n  };\n\n  const detach = async (\n    token: EntityTypeToken,\n    resourceId: string,\n    role?: string,\n  ): Promise<AssociationWriteResult> => {\n    const ends = endpoints(token, resourceId);\n    if (\"error\" in ends) return { ok: false, error: ends.error };\n    const result = await store.remove({\n      ...ends,\n      ...(role !== undefined ? { role } : {}),\n    });\n    if (result.ok && !outgoing && containerType === \"conversation\" && token === \"file\") {\n      await loadConversationFiles();\n    }\n    return result;\n  };\n\n  const setPinned = async (\n    token: EntityTypeToken,\n    resourceId: string,\n    pinned: boolean,\n    role?: string,\n  ): Promise<AssociationWriteResult> => {\n    const ends = endpoints(token, resourceId);\n    if (\"error\" in ends) return { ok: false, error: ends.error };\n    const exactRole = role ?? null;\n    const link = incoming.find(\n      (candidate) =>\n        candidate.token === token &&\n        candidate.resourceId === resourceId &&\n        candidate.role === exactRole,\n    );\n    if (!link) return { ok: false, error: \"Association edge not found\" };\n    const currentMetadata = metadataRecord(link.metadata);\n    if (!currentMetadata) {\n      return {\n        ok: false,\n        error: \"Association metadata is not an object and cannot be updated safely\",\n      };\n    }\n    return store.add({\n      ...ends,\n      ...(orgId != null ? { orgId } : {}),\n      ...(link.label != null ? { label: link.label } : {}),\n      ...(role !== undefined ? { role } : {}),\n      metadata: { ...currentMetadata, pinned },\n    });\n  };\n\n  const reload = async (): Promise<void> => {\n    await Promise.all([\n      reloadGeneric(),\n      !outgoing && containerType === \"conversation\"\n        ? loadConversationFiles()\n        : Promise.resolve(),\n    ]);\n  };\n\n  const status = !containerId\n    ? genericStatus\n    : conversationFileStatus === \"error\"\n      ? \"error\"\n      : !outgoing &&\n          containerType === \"conversation\" &&\n          (conversationFileStatus === \"idle\" ||\n            conversationFileStatus === \"loading\")\n        ? \"loading\"\n        : genericStatus;\n  const error = conversationFileError ?? genericError;\n\n  return {\n    status,\n    error,\n    reload,\n    totalCount: incoming.length,\n    presentTokens: [...new Set(incoming.map((link) => link.token))],\n    countFor,\n    attachedIdsFor,\n    linksFor,\n    attach,\n    detach,\n    setPinned,\n  };\n}\n\n/**\n * `useContainerLinks` args for a surface's primary entity — the ONE mapping\n * the faces (card, list) use, so a primary's direction is never dropped.\n */\nexport function containerLinksArgs(\n  container: PrimaryEntity | null,\n): UseContainerLinksArgs {\n  if (container?.direction === \"outgoing\") {\n    return {\n      containerType: container.type,\n      containerId: container.id,\n      orgId: container.orgId ?? null,\n      direction: \"outgoing\",\n    };\n  }\n  return {\n    containerType: container?.type ?? \"organization\",\n    containerId: container?.id ?? null,\n    orgId: container?.orgId ?? null,\n  };\n}\n","// src/edges.ts — @ai-matrx/associations\n//\n// The association-edge, per-user-state, and category row/cache types — ported\n// verbatim from matrx-frontend `features/scopes/types.ts` (associations\n// extraction W1, 2026-08-29). One seam inverted: the host contract's `Json`\n// becomes `unknown` (the packaging standard's JSON-boundary rule — real\n// hosts' generated Supabase contracts emit `type Json = unknown`).\n//\n// The load-bearing boundary travels with these types: an association is a\n// LINK, never an access grant — access lives in iam.permissions /\n// iam.memberships; the only sanctioned bridge is DB-side conveyance\n// (`association_types.conveys_max` → reachability). This package makes zero\n// access decisions.\n\nimport type { EntityTypeToken } from \"./entity-types.generated\";\n\n// Allowed TARGET tokens for a `platform.associations` edge. There is NO DB CHECK\n// constraint on the type columns — the only gate is the FK to\n// `platform.entity_types.token` (any registered token is accepted). This list is\n// the client-side guard that keeps `add`/`setTargets` callers honest about which\n// containers we deliberately attach into.\n//\n// `satisfies readonly EntityTypeToken[]` PROVES at compile time that every token\n// here is a real, registered entity type — so this curated list can never drift\n// to a token that doesn't exist in `platform.entity_types`. A `source_type` is\n// validated at runtime (the full registry is allowed there); only the deliberate\n// container set is narrowed here.\nexport const ASSOCIATION_TARGET_TYPES = [\n  \"organization\", //         an org — the top-level container resources attach into\n  \"scope\",\n  \"tag\", //                  a platform tag (platform.tag) — items are filed under it (`<kind> -> tag`); FTS-4\n  \"scope_type\",\n  \"project\",\n  \"task\",\n  \"context_item\",\n  \"thread\",\n  \"war_room\",\n  \"category\",\n  \"conversation\", //         a chat conversation a working_document is attached to\n  \"fc_set\", //               a flashcard set (card→set membership)\n  \"fc_card\", //              a flashcard (card→card hierarchy, quiz→card)\n  \"study_media\", //          a study-media artifact (summary/mind_map) — converter lineage target\n  \"assessment\", //           a quiz / practice test — a converter lineage target + origin (assessment→artifact 'source')\n  \"note\", //                 a note — the origin a converted study artifact links back to (artifact→note 'source' lineage, P4)\n  \"file\", //                 a file (card→file media + source lineage)\n  \"processed_document\", //   a processed source document (study-aid source lineage and kit membership)\n  \"quiz_session\", //         a quiz a card is used in\n  \"agent\", //                an orchestrator agent — the container an Orchestra's member agents attach into (role 'member'); an 'orchestra' self-edge marks the orchestrator\n  \"agent_term_list\", //      a term list — durable file attachments target its vocabulary resource\n  \"research_tag\", //         a research tag a source is filed under (rs_source_tag M2M collapsed into associations)\n  \"skill\", //                a skill — projects link to it (skill→project, role 'member'); code_files attach as resources (code_file→skill, role 'resource')\n  \"surface\", //              a UI surface — agents bind here (agent→surface); context menu reads via agent.menu_surface\n  \"plan_entity\", //          a Content Planning source/media citation — plan_node role edges (about/cites/embeds) target it\n  \"plan_node\", //            a planned page — research topics/tags attach here and follow realization into web_page\n  \"web_site\", //             a web.site — parties attach onto a site's roster (party→web_site role 'writes_for')\n  \"seo_topic\", //            a taxonomy topic — plan_node/plan_entity tag into it (role 'topic')\n  \"seo_keyword\", //          a keyword — plan_node attaches secondaries (role 'secondary_keyword'; the primary is an FK, never an edge)\n  \"web_page\", //             a canonical page — the page workspace attaches notes/tasks/files/keywords onto it (keyword edges: role 'primary'|'supporting')\n  \"web_screenshot\", //       a page capture — per-image attachments on the page workspace\n  \"party\", //                a CRM person/company (crm.party) — the record page attaches tasks/files/notes onto it\n  \"crm_outreach_list\", //    a CRM outreach list (a worked send/dial queue) — parties and resources attach into it\n  \"crm_deal\", //             a CRM deal (crm.deal) — people on it (role 'deal_contact'), tasks/files attach onto it\n  \"rulebook\", //             a Masterwork Rulebook — its Scout interviews attach here (conversation→rulebook, role 'interview')\n  \"research_topic\", //       a research topic — Sources are filed under it (processed_document→research_topic, the landing door's edge)\n  \"media_source_library\", // a media-catalog Library — Sources are catalogued into it (processed_document→media_source_library)\n  \"membership\", //           a person's place in one organization (iam.memberships) — the org chart's Person box (role 'org_chart')\n  \"team\", //                 an iam.team — a box on the org chart (role 'org_chart')\n  \"position\", //             an agent.position, a named seat (\"SEO Lead\") — a box on the org chart (role 'org_chart')\n  \"workflow\", //             a workflow.definition — a box on the org chart (role 'org_chart'), under whoever owns it\n  \"board\", //                a projects.board — conversations are filed on it (conversation→board, container_side none); the Board chat tile's own list\n  \"web_brand\", //            a web.brand — the people on a brand attach to it (party→web_brand, role 'owns' | 'key_person'); Smart Add \"Related\"\n  \"record\", //               a custom table (custom.record) — a board owns the tables made FOR it (board→record, role 'board_table', cascades_trash)\n  \"transcript\", //           a transcript — an organization's correction links to the shared one it corrects (transcript→transcript 'corrects'); a video/post points at that version (social-media-unification)\n] as const satisfies readonly EntityTypeToken[];\n\nexport type AssociationTargetType = (typeof ASSOCIATION_TARGET_TYPES)[number];\n\n/** Runtime guard: is this token one of the deliberate container (target) types? */\nexport function isAssociationTargetType(\n  value: unknown,\n): value is AssociationTargetType {\n  return (\n    typeof value === \"string\" &&\n    (ASSOCIATION_TARGET_TYPES as readonly string[]).includes(value)\n  );\n}\n\n/**\n * Which edges a primary entity's association surfaces read and write.\n *  - `incoming` (default) — the primary is a CONTAINER: it lists what is\n *    attached INTO it (`resource → primary`) and \"+\" attaches resources to it.\n *  - `outgoing` — the primary is FILED UNDER things (a Source under a project,\n *    a research topic, a Library): it lists its own `primary → container`\n *    edges and \"+\" files it under a container. Only container (target) types\n *    can be filed under.\n */\nexport type AssociationDirection = \"incoming\" | \"outgoing\";\n\n// ─── Association edges (per-entity, both-directions cache) ─────────────\n//\n// One row of `assoc_for_entity(p_type, p_id)` — every edge touching the\n// entity in BOTH directions. `direction` is relative to the queried entity:\n// \"outgoing\" = the entity is the edge's source; \"incoming\" = it is the\n// target. `otherType`/`otherId` is the entity on the far end.\n\nexport interface AssociationEdge {\n  id: string;\n  direction: \"outgoing\" | \"incoming\";\n  otherType: string;\n  otherId: string;\n  role: string | null; //     the relationship's kind (e.g. member, expands_into, source)\n  label: string | null;\n  position: number | null; // ordering within a role (e.g. card order in a set)\n  metadata: unknown;\n  orgId: string | null;\n  createdAt: string;\n}\n\n// One row of `assoc_for_targets(p_target_type, p_target_ids[])` — every INCOMING\n// edge (a member → one of the queried containers). `targetId` says which queried\n// target the edge points at, so a caller loading MANY containers at once can\n// group rows back by container in one pass. The batch counterpart of\n// `AssociationEdge` (single entity, both directions).\nexport interface AssociationTargetEdge {\n  id: string;\n  targetId: string;\n  sourceType: string;\n  sourceId: string;\n  role: string | null;\n  label: string | null;\n  position: number | null;\n  metadata: unknown;\n  orgId: string | null;\n  createdAt: string;\n}\n\n// One row of `assoc_for_sources` — the source-side batch counterpart of\n// `AssociationTargetEdge`. Every OUTGOING edge from a set of sources of one\n// type (optionally filtered to one target type). `sourceId` lets callers\n// group results back by source.\nexport interface AssociationSourceEdge {\n  id: string;\n  sourceId: string;\n  targetType: string;\n  targetId: string;\n  role: string | null;\n  label: string | null;\n  position: number | null;\n  metadata: unknown;\n  orgId: string | null;\n  createdAt: string;\n}\n\n// Cache entry for one `${type}:${id}` endpoint — the stable shape the\n// package-owned store (`/core`, W2) returns from `getEdges`.\nexport interface AssociationsEntry {\n  status: \"idle\" | \"loading\" | \"ready\" | \"error\";\n  edges: AssociationEdge[];\n  fetchedAt: number | null;\n  error: string | null;\n}\n\n// ─── Per-user entity state (platform.user_entity_state) ────────────────\n//\n// One row of the canonical per-user state ledger — the caller's favorite /\n// pinned / hidden flags + recency on a single entity. Reached ONLY via the\n// `ues_*` SECURITY-DEFINER RPCs. `entityType` is FREE TEXT in the DB\n// (per-user state is tracked for non-graph things too — e.g. `\"nav\"`\n// destinations — so the table has no entity_type CHECK), hence `string` here\n// rather than the constrained token union.\nexport interface UserEntityState {\n  entityType: string;\n  entityId: string;\n  isFavorite: boolean;\n  isPinned: boolean;\n  isHidden: boolean;\n  lastViewedAt: string | null;\n}\n\n/** The three boolean dimensions of per-user state, as accepted by `ues_list`. */\nexport type UserStateKind = \"favorite\" | \"pinned\" | \"hidden\";\n\n// ─── Categories (platform.categories) ─────────────────────────────────\n//\n// The canonical faceted taxonomy. ONE table, partitioned by `dimension`\n// (the facet — `agent-shortcut`, `skill`, `industry`, …). System/global\n// categories belong to the Matrx System org and carry `isSystem=true`;\n// ordinary categories belong to their tenant org. The client has NO direct\n// grant on `platform.categories`; every read/write goes through the PUBLIC\n// SECURITY-DEFINER `cat_*` RPCs.\n//\n// ASSIGNMENT of a category to an entity is NOT a category concern: it reuses\n// the association edge (`assoc_add(source, 'category', categoryId, orgId)`).\n// `category` is already a valid `AssociationTargetType`. A category is the\n// noun; the association is the verb.\n\n/**\n * The facet a category belongs to. Open vocabulary (new dimensions need no\n * migration — `dimension` is free text in the DB); hosts enumerate their\n * known dimensions as constants.\n */\nexport type CategoryDimension = string;\n\n/** One `platform.categories` row, camelCased (mirrors `cat_list`'s return). */\nexport interface PlatformCategory {\n  id: string;\n  /** Owning organization; system/global rows use the Matrx System org. */\n  orgId: string | null;\n  dimension: CategoryDimension;\n  name: string;\n  slug: string | null;\n  parentId: string | null;\n  isSystem: boolean;\n  color: string | null;\n  icon: string | null;\n  position: number | null;\n  /**\n   * The row's jsonb metadata — category rows CARRY semantics: e.g. a\n   * `deal_pipeline` stage stores `{outcome: \"won\"|\"lost\", probability: 0..100}`\n   * here. Null when empty or when hydrated from an older cache entry.\n   */\n  metadata: Record<string, unknown> | null;\n}\n\n/** Cache entry for one `dimension` — mirrors `AssociationsEntry`. */\nexport interface CategoriesEntry {\n  status: \"idle\" | \"loading\" | \"ready\" | \"error\";\n  categories: PlatformCategory[];\n  fetchedAt: number | null;\n  error: string | null;\n}\n","// react/hooks/useEntityTitles.ts — @ai-matrx/associations/react\n//\n// React binding for the entity-title resolver. Give it the (token, id, label)\n// rows a surface is about to render; it returns a resolver that ALWAYS yields\n// a human title — edge label first, fetched title second, `Untitled <type>`\n// last. Fetches are batched per token and memoized in the store's title\n// cache, so re-renders and sibling surfaces are free.\n//\n// `isUnresolved` is the LOUD half: the resolver deliberately omits ids the\n// viewer cannot read (deleted row, or no access), and \"Untitled Note\" for a\n// record that is actually gone reads as a healthy row. A surface that can tell\n// the difference must say so — never render an edge as fine when its target\n// could not be resolved.\n//\n// Ported signature-byte-compatible from matrx-frontend\n// `features/scopes/hooks/useEntityTitles.ts` (W3, 2026-08-29): the module\n// entityTitles service → the store's titles service; registry module →\n// `store.registry`; console.error → the errorSink.\n\nimport { useEffect, useState } from \"react\";\n\nimport { entityTitleCacheKey } from \"../../core/titles\";\nimport { useAssociationsStore } from \"../context\";\n\nexport interface EntityTitleRef {\n  token: string;\n  id: string;\n  /** The edge label (or any already-known title) — wins when present. */\n  label?: string | null;\n}\n\nexport interface UseEntityTitlesReturn {\n  /** Resolve the display title for one ref (never a UUID). */\n  titleFor: (ref: EntityTitleRef) => string;\n  /**\n   * True when this ref's target could NOT be resolved after a settled fetch —\n   * the row is gone or the viewer has no access, and `titleFor` is returning a\n   * generic fallback. Surfaces MUST render this loudly (and offer the detach).\n   * Always false for tokens with no registered title column (nothing to\n   * resolve there — silence is correct, not a failure).\n   */\n  isUnresolved: (ref: EntityTitleRef) => boolean;\n  /** True while any needed titles are still being fetched. */\n  loading: boolean;\n}\n\nexport function useEntityTitles(refs: EntityTitleRef[]): UseEntityTitlesReturn {\n  const store = useAssociationsStore();\n  const [resolved, setResolved] = useState<Record<string, string>>({});\n  // Keys we have already asked the resolver for and it has answered. A key that\n  // is attempted but absent from `resolved`/cache is genuinely unreachable.\n  const [attempted, setAttempted] = useState<Record<string, true>>({});\n  const [loading, setLoading] = useState(false);\n\n  // The refs that need a fetch.\n  //\n  // 🚨 A STAMPED LABEL DOES NOT EXEMPT A REF FROM THE READ. That exemption is\n  // what made the whole unresolved-target warning inert: a labeled ref was\n  // never fetched, so its key never entered `attempted`, so `isUnresolved`\n  // below could only ever return false. Verifying that a target still exists\n  // IS a live read; the label only decides what we DISPLAY (see `titleFor`).\n  //\n  // Tokens with no registered title column are still skipped: the resolver was\n  // never going to answer for them, and `isUnresolved` returns false for that\n  // case by design, so a call would be pure waste.\n  // Already-attempted keys are excluded too. A target that does NOT exist never\n  // enters the cache, so without this the first fetch resolves the live ones,\n  // `needed` shrinks to just the missing ones, the key changes, and they get\n  // asked for a second time before settling. One round is enough to prove\n  // absence.\n  const needed = refs.filter(\n    (r) =>\n      store.registry.tryGetEntityInfo(r.token)?.titleColumn != null &&\n      store.titles.get(r.token, r.id) == null &&\n      !attempted[entityTitleCacheKey(r.token, r.id)],\n  );\n  // Stable dependency for the effect — the set of unresolved keys.\n  const neededKey = needed\n    .map((r) => entityTitleCacheKey(r.token, r.id))\n    .sort()\n    .join(\"|\");\n\n  useEffect(() => {\n    if (!neededKey) return;\n    let cancelled = false;\n    setLoading(true);\n\n    const byToken = new Map<string, string[]>();\n    for (const key of neededKey.split(\"|\")) {\n      const sep = key.indexOf(\":\");\n      const token = key.slice(0, sep);\n      const id = key.slice(sep + 1);\n      const list = byToken.get(token) ?? [];\n      list.push(id);\n      byToken.set(token, list);\n    }\n\n    void Promise.all(\n      [...byToken.entries()].map(async ([token, ids]) => {\n        const titles = await store.titles.fetch(token, ids);\n        return [token, titles] as const;\n      }),\n    )\n      .then((results) => {\n        if (cancelled) return;\n        setResolved((prev) => {\n          const next = { ...prev };\n          for (const [token, titles] of results) {\n            for (const [id, title] of titles) {\n              next[entityTitleCacheKey(token, id)] = title;\n            }\n          }\n          return next;\n        });\n      })\n      .catch((err: unknown) => {\n        // A FAILED lookup must still mark the refs attempted, or `loading`\n        // sticks on forever and `isUnresolved` stays false — the surface would\n        // then show fallback titles with working-looking doors and never admit\n        // it couldn't read them. Loud recovery: this is a real failure.\n        if (cancelled) return;\n        store.errorSink({\n          code: \"title_resolution_failed\",\n          message: \"Failed to resolve entity titles\",\n          context: { detail: err },\n        });\n      })\n      .finally(() => {\n        if (cancelled) return;\n        setAttempted((prev) => {\n          const next = { ...prev };\n          for (const key of neededKey.split(\"|\")) next[key] = true;\n          return next;\n        });\n        setLoading(false);\n      });\n\n    return () => {\n      cancelled = true;\n    };\n  }, [neededKey, store]);\n\n  const titleFor = (ref: EntityTitleRef): string => {\n    if (ref.label && ref.label.trim()) return ref.label;\n    const key = entityTitleCacheKey(ref.token, ref.id);\n    return (\n      resolved[key] ??\n      store.titles.get(ref.token, ref.id) ??\n      store.titles.fallback(ref.token)\n    );\n  };\n\n  const isUnresolved = (ref: EntityTitleRef): boolean => {\n    // No title column registered → the resolver was never going to answer, so\n    // the edge's stamped label is the ONLY source and its absence proves\n    // nothing. (`data_store` is the live case: `rag` isn't PostgREST-exposed,\n    // which is exactly why those edges must stamp a label at attach time.)\n    if (!store.registry.tryGetEntityInfo(ref.token)?.titleColumn) return false;\n\n    const key = entityTitleCacheKey(ref.token, ref.id);\n    if (resolved[key] || store.titles.get(ref.token, ref.id)) return false;\n\n    // A stamped label does NOT clear this. It is a snapshot from attach time,\n    // so a deleted or now-inaccessible target still carries a plausible name —\n    // and treating that as proof of existence is how a dead reference renders\n    // as a normal row with working-looking doors. The live read is the truth;\n    // the label is only what we show while saying the target is unreachable.\n    return attempted[key] === true;\n  };\n\n  return { titleFor, isUnresolved, loading };\n}\n","// react/hooks/useCategories.ts — @ai-matrx/associations/react\n//\n// Public hook for the canonical faceted taxonomy (`platform.categories`) — the\n// one primitive any UI consumes to read and manage categories for a facet\n// (`dimension`). The sibling of `useAssociations`: that hook owns an entity's\n// assignment EDGES, this hook owns the category NOUNS for a dimension.\n//\n// Ported signature-byte-compatible from matrx-frontend\n// `features/scopes/hooks/useCategories.ts` (W3, 2026-08-29): the Redux\n// selector/thunk cache becomes the package store's category facets ridden via\n// `useSyncExternalStore`. ASSIGNING a category to an entity is a separate\n// concern — use `useAssociations(...).add({ targetType: 'category' })`.\n\nimport { useEffect, useRef, useSyncExternalStore } from \"react\";\n\nimport type {\n  CategoriesEntry,\n  CategoryDimension,\n  PlatformCategory,\n} from \"../../edges\";\nimport type { CategoryMutationResult } from \"../../core/store\";\nimport { useAssociationsStore } from \"../context\";\n\n/** Same shape as a mutation result; the create carries the new id. */\nexport type CategoryCreateResult = CategoryMutationResult;\nexport type { CategoryMutationResult };\n\nexport interface UseCategoriesArgs {\n  /** The facet to read/manage (`agent-shortcut`, `skill`, `industry`, …). */\n  dimension: CategoryDimension | null;\n  /** Disable the auto-load on mount. Defaults to false (auto-load). */\n  autoLoad?: boolean;\n}\n\nexport interface UseCategoriesReturn {\n  /** Every category visible to the caller in this facet (system + their orgs). */\n  categories: PlatformCategory[];\n  status: CategoriesEntry[\"status\"];\n  error: string | null;\n  fetchedAt: number | null;\n  /** Create an org category in this facet. Returns the new id on success. */\n  create: (args: {\n    name: string;\n    orgId: string;\n    parentId?: string | null;\n    color?: string | null;\n    icon?: string | null;\n    slug?: string | null;\n  }) => Promise<CategoryCreateResult>;\n  /** Replace one category's editable scalar fields. */\n  update: (args: {\n    id: string;\n    name: string;\n    slug: string | null;\n    color: string | null;\n    icon: string | null;\n    position: number | null;\n  }) => Promise<CategoryMutationResult>;\n  /** Move a category to the root or directly under a root category. */\n  reparent: (\n    id: string,\n    parentId: string | null,\n  ) => Promise<CategoryMutationResult>;\n  /** Soft-delete a leaf category. */\n  remove: (id: string) => Promise<CategoryMutationResult>;\n  /** Force a refetch of this facet's categories. */\n  reload: () => Promise<void>;\n}\n\nconst noopSubscribe = () => () => {};\n\nexport function useCategories(args: UseCategoriesArgs): UseCategoriesReturn {\n  const { dimension, autoLoad = true } = args;\n  const store = useAssociationsStore();\n\n  const entry = useSyncExternalStore(\n    dimension\n      ? (cb) => store.subscribeCategories(dimension, cb)\n      : noopSubscribe,\n    () => store.getCategories(dimension ?? \"\"),\n    () => store.getCategories(dimension ?? \"\"),\n  );\n\n  const loadedKey = useRef<string | null>(null);\n  useEffect(() => {\n    if (!autoLoad || !dimension) return;\n    if (loadedKey.current === dimension) return;\n    loadedKey.current = dimension;\n    void store.loadCategories(dimension);\n  }, [autoLoad, store, dimension]);\n\n  return {\n    categories: entry.categories,\n    status: entry.status,\n    error: entry.error,\n    fetchedAt: entry.fetchedAt,\n    create: async ({ name, orgId, parentId, color, icon, slug }) => {\n      if (!dimension) return { ok: false, error: \"Missing dimension\" };\n      return store.createCategory({\n        dimension,\n        name,\n        orgId,\n        ...(parentId !== undefined ? { parentId } : {}),\n        ...(color !== undefined ? { color } : {}),\n        ...(icon !== undefined ? { icon } : {}),\n        ...(slug !== undefined ? { slug } : {}),\n      });\n    },\n    update: async ({ id, name, slug, color, icon, position }) => {\n      if (!dimension) return { ok: false, error: \"Missing dimension\" };\n      return store.updateCategory({\n        dimension,\n        id,\n        name,\n        slug,\n        color,\n        icon,\n        position,\n      });\n    },\n    reparent: async (id, parentId) => {\n      if (!dimension) return { ok: false, error: \"Missing dimension\" };\n      return store.reparentCategory({ dimension, id, parentId });\n    },\n    remove: async (id) => {\n      if (!dimension) return { ok: false, error: \"Missing dimension\" };\n      return store.deleteCategory({ dimension, id });\n    },\n    reload: async () => {\n      if (!dimension) return;\n      await store.loadCategories(dimension, { force: true });\n    },\n  };\n}\n","// react/hooks/useUniversalEntitySearch.ts — @ai-matrx/associations/react\n//\n// ONE search box over EVERY listable entity type — the hook behind the\n// universal association picker. Debounced, stale-guarded, registry-driven\n// (new tokens join with zero code here).\n//\n// Empty query → RECENTS: the caller's `platform.user_entity_state` rows\n// (`ues_list`, one RPC) sorted by last-viewed, filtered to the searched\n// tokens, titles resolved through the store's title service. When the person\n// has no recents for those tokens (a fresh account, or one that never opened\n// a deck from a door that stamps `last_viewed_at`), the empty query FALLS BACK\n// to browsing candidates across the tokens — \"No recent items\" over an account\n// with hundreds of records is a screen that lies (0.12.0).\n//\n// NOTHING FAILS SILENTLY (0.13.0): every token whose read failed, and a\n// failed recents read, lands in `failures`; `error` is set only when nothing\n// could be read at all; `status` says loading / error / ready. A failed\n// recents read still falls back to browsing, but it is RECORDED — never\n// silently turned into a browse.\n//\n// Ported signature-byte-compatible from matrx-frontend\n// `features/scopes/hooks/useUniversalEntitySearch.ts` (W3, 2026-08-29):\n// module services → the store's candidates/favorites/titles services;\n// registry module → `store.registry`.\n\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n  isEntityTypeToken,\n  type EntityTypeToken,\n} from \"../../entity-types.generated\";\nimport type {\n  SearchAcrossTokensResult,\n  UniversalCandidate,\n} from \"../../core/candidates\";\nimport type { AssociationsStore } from \"../../core/store\";\nimport { useAssociationsStore } from \"../context\";\n\nconst DEBOUNCE_MS = 250;\nconst RECENTS_LIMIT = 12;\n\nexport type { UniversalCandidate };\n\nexport interface UseUniversalEntitySearchArgs {\n  query: string;\n  /** Restrict to these tokens; defaults to every listable token. */\n  tokens?: EntityTypeToken[];\n  enabled?: boolean;\n  perTokenLimit?: number;\n  /**\n   * What an empty query loads. Universal attach surfaces default to recents;\n   * constrained value pickers use candidates so opening the picker immediately\n   * shows the records that are available to select. `\"recents\"` falls back\n   * to candidates when the person has no recents for the searched tokens.\n   */\n  emptyQueryMode?: \"recents\" | \"candidates\";\n}\n\n/**\n * What the current results ARE: `\"search\"` for a typed query, `\"recents\"` for\n * favorites/last-viewed, `\"candidates\"` for an empty-query browse (asked for,\n * or the recents fallback).\n */\nexport type UniversalSearchSource = \"search\" | \"recents\" | \"candidates\";\n\n/**\n * One read that failed. `token` names the entity type whose candidate read\n * failed; `null` means the recents read (favorites / last-viewed) failed.\n */\nexport interface UniversalSearchFailure {\n  token: EntityTypeToken | null;\n  error: string;\n}\n\nexport type UniversalSearchStatus = \"loading\" | \"error\" | \"ready\";\n\nexport interface UseUniversalEntitySearchReturn {\n  results: UniversalCandidate[];\n  /** True while the current query's sweep is in flight. */\n  loading: boolean;\n  /** True when `results` are recents (empty query), not search hits. */\n  isRecents: boolean;\n  /** What the results are — lets the face label a browse vs recents vs hits. */\n  source: UniversalSearchSource;\n  /** Every read that failed for the current results (partial or total). */\n  failures: UniversalSearchFailure[];\n  /**\n   * Non-null only when NOTHING could be read: every searched token failed\n   * (and, for recents, the recents read found nothing or failed too).\n   */\n  error: string | null;\n  status: UniversalSearchStatus;\n}\n\nexport function useUniversalEntitySearch(\n  args: UseUniversalEntitySearchArgs,\n): UseUniversalEntitySearchReturn {\n  const {\n    query,\n    tokens,\n    enabled = true,\n    perTokenLimit = 5,\n    emptyQueryMode = \"recents\",\n  } = args;\n  const store = useAssociationsStore();\n  const [results, setResults] = useState<UniversalCandidate[]>([]);\n  const [loading, setLoading] = useState(false);\n  const [failures, setFailures] = useState<UniversalSearchFailure[]>([]);\n  const [error, setError] = useState<string | null>(null);\n  const [status, setStatus] = useState<UniversalSearchStatus>(\n    enabled ? \"loading\" : \"ready\",\n  );\n  const [source, setSource] = useState<UniversalSearchSource>(\n    emptyQueryMode === \"candidates\" ? \"candidates\" : \"recents\",\n  );\n  const runRef = useRef(0);\n  const tokensKey = (tokens ?? []).join(\",\");\n\n  useEffect(() => {\n    if (!enabled) return;\n    const run = ++runRef.current;\n    const trimmed = query.trim();\n\n    const timer = setTimeout(async () => {\n      if (runRef.current !== run) return;\n      setLoading(true);\n      setStatus(\"loading\");\n      const activeTokens = tokensKey\n        ? (tokensKey.split(\",\") as EntityTypeToken[])\n        : store.registry.listableTokens();\n\n      const browse = (): Promise<SearchAcrossTokensResult> =>\n        store.candidates.searchCandidatesAcrossTokens({\n          tokens: activeTokens,\n          search: trimmed,\n          perTokenLimit,\n        });\n      /** Every token was searched and every one failed — nothing was read. */\n      const allFailed = (r: SearchAcrossTokensResult) =>\n        activeTokens.length > 0 && r.failures.length >= activeTokens.length;\n\n      let next: UniversalCandidate[] = [];\n      let nextSource: UniversalSearchSource;\n      const nextFailures: UniversalSearchFailure[] = [];\n      let nextError: string | null = null;\n      if (trimmed || emptyQueryMode === \"candidates\") {\n        const r = await browse();\n        next = r.results;\n        nextFailures.push(...r.failures);\n        nextSource = trimmed ? \"search\" : \"candidates\";\n        if (allFailed(r)) nextError = totalFailureMessage(store, r);\n      } else {\n        const recents = await loadRecents(store, activeTokens);\n        nextSource = \"recents\";\n        if (recents.ok) {\n          next = recents.data;\n        } else {\n          nextFailures.push({ token: null, error: recents.error });\n        }\n        if (next.length === 0 && runRef.current === run) {\n          // No recents (or an unreadable recents list) is not \"nothing to\n          // pick\" — browse instead. A recents failure stays in `failures`.\n          const r = await browse();\n          next = r.results;\n          nextFailures.push(...r.failures);\n          nextSource = \"candidates\";\n          if (allFailed(r)) {\n            nextError = recents.ok\n              ? totalFailureMessage(store, r)\n              : `Couldn't load recent items (${recents.error}) or browse: ${totalFailureMessage(store, r)}`;\n          }\n        }\n      }\n      if (runRef.current !== run) return; // stale response — drop\n      setResults(next);\n      setSource(nextSource);\n      setFailures(nextFailures);\n      setError(nextError);\n      setStatus(nextError ? \"error\" : \"ready\");\n      setLoading(false);\n    }, DEBOUNCE_MS);\n\n    return () => clearTimeout(timer);\n  }, [query, tokensKey, enabled, perTokenLimit, emptyQueryMode, store]);\n\n  return {\n    results,\n    loading,\n    isRecents: source === \"recents\",\n    source,\n    failures,\n    error,\n    status,\n  };\n}\n\n/** \"Couldn't search Notes, Tasks: <first error>\" — every token failed. */\nfunction totalFailureMessage(\n  store: AssociationsStore,\n  r: SearchAcrossTokensResult,\n): string {\n  const labels = r.failures.map(\n    (f) => store.registry.getEntityInfo(f.token).labelPlural,\n  );\n  const first = r.failures[0]?.error;\n  return `Couldn't search ${labels.join(\", \")}${first ? `: ${first}` : \"\"}`;\n}\n\n/**\n * Favorited and recently-touched entities of the searched tokens, titles\n * resolved. A favorite is itself an explicit user choice and must surface even\n * before another route has stamped `last_viewed_at`; otherwise favoriting a\n * never-opened entity writes successfully but the universal picker silently\n * drops it. Favorites sort ahead of ordinary recents, then by view recency.\n */\nasync function loadRecents(\n  store: AssociationsStore,\n  tokens: EntityTypeToken[],\n): Promise<\n  { ok: true; data: UniversalCandidate[] } | { ok: false; error: string }\n> {\n  const res = await store.favorites.list();\n  if (!res.ok) return { ok: false, error: res.error.message };\n  const tokenSet = new Set<string>(tokens);\n  const rows = res.data.items\n    .filter(\n      (i) =>\n        tokenSet.has(i.entityType) &&\n        isEntityTypeToken(i.entityType) &&\n        (i.isFavorite || i.lastViewedAt),\n    )\n    .sort((a, b) => {\n      if (a.isFavorite !== b.isFavorite) return a.isFavorite ? -1 : 1;\n      return (b.lastViewedAt ?? \"\").localeCompare(a.lastViewedAt ?? \"\");\n    })\n    .slice(0, RECENTS_LIMIT);\n  if (rows.length === 0) return { ok: true, data: [] };\n\n  // Resolve titles per token (batched, cached).\n  const byToken = new Map<string, string[]>();\n  for (const r of rows) {\n    const list = byToken.get(r.entityType) ?? [];\n    list.push(r.entityId);\n    byToken.set(r.entityType, list);\n  }\n  const titles = new Map<string, Map<string, string>>();\n  await Promise.all(\n    [...byToken.entries()].map(async ([token, ids]) => {\n      titles.set(token, await store.titles.fetch(token, ids));\n    }),\n  );\n\n  const out: UniversalCandidate[] = [];\n  for (const r of rows) {\n    const title = titles.get(r.entityType)?.get(r.entityId);\n    if (!title) continue; // deleted / inaccessible / no title column\n    out.push({\n      token: r.entityType as EntityTypeToken,\n      id: r.entityId,\n      title,\n    });\n  }\n  return { ok: true, data: out };\n}\n","// react/components/SearchFailureNotice.tsx — @ai-matrx/associations/react\n//\n// The ONE way a face shows what `useUniversalEntitySearch` could not read\n// (0.13.0). Two shapes, both through the design system's ErrorBox so the\n// report/copy actions come with them:\n//   • `error` set (nothing could be read) → the destructive block, never an\n//     empty \"no results\" line;\n//   • partial `failures` → a one-line note above the results naming what\n//     could not be searched (\"Couldn't search Notes, Tasks\").\n// Renders nothing when there is nothing to say.\n\nimport { ErrorBox, cn } from \"@ai-matrx/design-system\";\n\nimport type { UniversalSearchFailure } from \"../hooks/useUniversalEntitySearch\";\nimport { useAssociationsStore } from \"../context\";\n\nexport interface SearchFailureNoticeProps {\n  /** `useUniversalEntitySearch().error` — set when nothing could be read. */\n  error: string | null;\n  /** `useUniversalEntitySearch().failures` — every read that failed. */\n  failures: UniversalSearchFailure[];\n  /** What the person was doing, for the error report (\"Search to attach\"). */\n  operation?: string;\n  /** Where this rendered, for the error report (\"media/MediaSharePopover\"). */\n  origin?: string;\n  className?: string;\n}\n\n/**\n * \"Couldn't search Notes, Tasks\" / \"Couldn't load recent items\" — the plain\n * sentence for a failure list. `labelFor` maps a token to its plural label.\n */\nexport function describeSearchFailures(\n  failures: UniversalSearchFailure[],\n  labelFor: (token: NonNullable<UniversalSearchFailure[\"token\"]>) => string,\n): string {\n  const recentsFailed = failures.some((f) => f.token === null);\n  const labels: string[] = [];\n  for (const f of failures) {\n    if (f.token === null) continue;\n    const label = labelFor(f.token);\n    if (!labels.includes(label)) labels.push(label);\n  }\n  const parts: string[] = [];\n  if (recentsFailed) parts.push(\"Couldn't load recent items\");\n  if (labels.length > 0) {\n    parts.push(\n      `${recentsFailed ? \"couldn't\" : \"Couldn't\"} search ${labels.join(\", \")}`,\n    );\n  }\n  return parts.join(\"; \");\n}\n\nexport function SearchFailureNotice(props: SearchFailureNoticeProps) {\n  const {\n    error,\n    failures,\n    operation = \"Search\",\n    origin = \"associations/SearchFailureNotice\",\n    className,\n  } = props;\n  const store = useAssociationsStore();\n\n  if (error) {\n    return (\n      <ErrorBox\n        as=\"div\"\n        className={cn(\n          \"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive\",\n          className,\n        )}\n        message={error}\n        operation={operation}\n        origin={origin}\n      >\n        <p className=\"font-medium\">Couldn’t load items</p>\n        <p className=\"opacity-80\">{error}</p>\n      </ErrorBox>\n    );\n  }\n  if (failures.length === 0) return null;\n  const summary = describeSearchFailures(\n    failures,\n    (token) => store.registry.getEntityInfo(token).labelPlural,\n  );\n  return (\n    <ErrorBox\n      className={cn(\"px-1 text-[11px] text-destructive\", className)}\n      message={summary}\n      error={failures.map((f) => `${f.token ?? \"recents\"}: ${f.error}`).join(\"\\n\")}\n      operation={operation}\n      origin={origin}\n    />\n  );\n}\n","// react/hooks/useAssociationCandidates.ts — @ai-matrx/associations/react\n//\n// State wrapper around the store's candidate reader — the picker's data\n// source. One-shot fetch on mount/param-change; re-runs on `reload()` or\n// search change. All querying logic lives in the /core service; this just\n// owns loading/error state.\n//\n// Ported signature-byte-compatible from matrx-frontend\n// `features/scopes/hooks/useAssociationCandidates.ts` (W3, 2026-08-29).\n// Visibility is enforced by the candidate RPC alone — there is no owner\n// filter (0.13.0 removed the never-applied `ownerId`).\n\nimport { useEffect, useState } from \"react\";\n\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport type { CandidateRecord } from \"../../core/candidates\";\nimport { useAssociationsStore } from \"../context\";\n\nexport type { CandidateRecord };\n\nexport interface UseAssociationCandidatesArgs {\n  token: EntityTypeToken;\n  /** Skip fetching (e.g. while the picker is closed). Defaults to true. */\n  enabled?: boolean;\n  search?: string;\n  limit?: number;\n}\n\nexport interface UseAssociationCandidatesReturn {\n  candidates: CandidateRecord[];\n  loading: boolean;\n  error: string | null;\n  reload: () => void;\n}\n\nexport function useAssociationCandidates(\n  args: UseAssociationCandidatesArgs,\n): UseAssociationCandidatesReturn {\n  const { token, enabled = true, search, limit } = args;\n  const store = useAssociationsStore();\n  const [candidates, setCandidates] = useState<CandidateRecord[]>([]);\n  const [loading, setLoading] = useState(false);\n  const [error, setError] = useState<string | null>(null);\n  const [tick, setTick] = useState(0);\n\n  useEffect(() => {\n    if (!enabled) return undefined;\n    let cancelled = false;\n    void (async () => {\n      setLoading(true);\n      setError(null);\n      const res = await store.candidates.listAssociationCandidates({\n        token,\n        ...(search !== undefined ? { search } : {}),\n        ...(limit !== undefined ? { limit } : {}),\n      });\n      if (cancelled) return;\n      if (res.ok) {\n        setCandidates(res.data);\n      } else {\n        setError(res.error);\n        setCandidates([]);\n      }\n      setLoading(false);\n    })();\n    return () => {\n      cancelled = true;\n    };\n  }, [token, enabled, search, limit, tick, store]);\n\n  return {\n    candidates,\n    loading,\n    error,\n    reload: () => setTick((t) => t + 1),\n  };\n}\n","// react/hooks/useComments.ts — @ai-matrx/associations/react\n//\n// Public hook for the unified comments primitive (`platform.comments`, W6) —\n// the one thread of comments on any entity (`token` + `id`), ridden off the\n// /core store's comment-thread cache via `useSyncExternalStore` (the same\n// lifecycle as `useAssociations`). All comments come back flat,\n// oldest→newest; build the tree from each row's `parentId` (the\n// `CommentThread` face does exactly that).\n//\n// Identity: writes go through the services, where `requireUserId` failures\n// stay LOUD; `currentUserId` is the LENIENT read the UI uses to gate\n// edit/delete-own affordances (unauthenticated → null → no own-comment\n// affordances, never a crash).\n\nimport { useEffect, useRef, useSyncExternalStore } from \"react\";\n\nimport type { CommentAnchor, CommentsEntry, PlatformComment } from \"../../comments\";\nimport { associationsKey, type CommentMutationResult } from \"../../core/store\";\nimport { useAssociationsStore } from \"../context\";\n\nexport interface UseCommentsArgs {\n  /** Entity-type token of the commented-on entity (writes-strict, C18). */\n  token: string;\n  /** The entity's row id; null renders the idle entry and loads nothing. */\n  id: string | null;\n  /** Disable the auto-load on mount. Defaults to false (auto-load). */\n  autoLoad?: boolean;\n}\n\nexport interface UseCommentsReturn {\n  /** Every comment on the entity, flat, oldest→newest (thread by parentId). */\n  comments: readonly PlatformComment[];\n  status: CommentsEntry[\"status\"];\n  error: string | null;\n  fetchedAt: number | null;\n  /** Post a comment; pass `parentId` to reply. Reloads the thread. */\n  add(\n    body: string,\n    opts?: {\n      parentId?: string | null;\n      orgId?: string | null;\n      /** Point the comment at a part / passage of the record (a `part_anchor`). */\n      anchor?: CommentAnchor | null;\n    },\n  ): Promise<CommentMutationResult>;\n  /** Edit a comment body (author-only in the RPC). Reloads the thread. */\n  edit(commentId: string, body: string): Promise<CommentMutationResult>;\n  /** Soft-delete a comment (author/org member in the RPC). Reloads. */\n  remove(commentId: string): Promise<CommentMutationResult>;\n  /** Force a refetch of the thread. */\n  reload(): Promise<void>;\n  /** Lenient identity read for edit/delete-own gating; null when signed out. */\n  currentUserId: string | null;\n}\n\nconst noopSubscribe = () => () => {};\n\nexport function useComments(args: UseCommentsArgs): UseCommentsReturn {\n  const { token, id, autoLoad = true } = args;\n  const store = useAssociationsStore();\n  const key = token && id ? associationsKey(token, id) : null;\n\n  const entry = useSyncExternalStore(\n    key ? (cb) => store.subscribeComments(key, cb) : noopSubscribe,\n    () => store.getComments(token, id ?? \"\"),\n    () => store.getComments(token, id ?? \"\"),\n  );\n\n  const loadedKey = useRef<string | null>(null);\n  useEffect(() => {\n    if (!autoLoad || !key || !id) return;\n    if (loadedKey.current === key) return;\n    loadedKey.current = key;\n    void store.loadComments(token, id);\n  }, [autoLoad, store, key, token, id]);\n\n  let currentUserId: string | null = null;\n  try {\n    currentUserId = store.identity.requireUserId();\n  } catch {\n    currentUserId = null;\n  }\n\n  return {\n    comments: entry.comments,\n    status: entry.status,\n    error: entry.error,\n    fetchedAt: entry.fetchedAt,\n    add: async (body, opts) => {\n      if (!id) return { ok: false, error: \"Missing entity id\" };\n      return store.addComment({\n        entityType: token,\n        entityId: id,\n        body,\n        ...(opts?.parentId !== undefined ? { parentId: opts.parentId } : {}),\n        ...(opts?.orgId !== undefined ? { orgId: opts.orgId } : {}),\n        ...(opts?.anchor ? { anchor: opts.anchor } : {}),\n      });\n    },\n    edit: async (commentId, body) => {\n      if (!id) return { ok: false, error: \"Missing entity id\" };\n      return store.editComment({\n        entityType: token,\n        entityId: id,\n        id: commentId,\n        body,\n      });\n    },\n    remove: async (commentId) => {\n      if (!id) return { ok: false, error: \"Missing entity id\" };\n      return store.deleteComment({\n        entityType: token,\n        entityId: id,\n        id: commentId,\n      });\n    },\n    reload: async () => {\n      if (!id) return;\n      await store.loadComments(token, id, { force: true });\n    },\n    currentUserId,\n  };\n}\n","// react/hooks/useAssociationEntitySelect.ts — @ai-matrx/associations/react\n//\n// Default AssociationEntitySelectAdapter for a plain platform.associations\n// container: items from the container's incoming edges of one token (titles\n// via the edge label / entity-title resolver), create via the generic\n// registry-driven row insert + attach, rename via the generic titleColumn\n// update, detach via the container-links hook.\n//\n// \"Active\" has no meaning on a bare association edge, so the caller owns it\n// (controlled `activeId` + `onActiveChange`); when uncontrolled it falls back\n// to the first attached entity. Surfaces with their OWN active semantics\n// (war-room's is_active edge metadata) implement the adapter themselves\n// instead of using this hook.\n//\n// Ported signature-byte-compatible from matrx-frontend\n// `features/scopes/hooks/useAssociationEntitySelect.ts` (W3, 2026-08-29):\n// `@/lib/toast` → the notifier port (warn-once degradation), console.error →\n// the errorSink, entityRows service module → the store's entityRows service.\n//\n// The `AssociationEntitySelectAdapter` CONTRACT lives here with the hook: it\n// is the read/write seam of the `AssociationEntitySelect` face (W4 — the\n// face itself is gated on a design-system Command/combobox primitive; the\n// adapter contract and this default implementation are not).\n\nimport { useState } from \"react\";\n\nimport type { AssociationTargetType } from \"../../edges\";\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport { useAssociationsStore, useNotifier } from \"../context\";\nimport { useContainerLinks } from \"./useContainerLinks\";\nimport { useEntityTitles } from \"./useEntityTitles\";\n\nexport interface AssociationEntitySelectItem {\n  id: string;\n  title: string;\n}\n\n/**\n * The read/write seam of the association \"name dropdown\". This hook is the\n * default (plain associations container); surfaces with bespoke active/create\n * semantics implement it themselves — same pattern as AssociationList's\n * ContainerResourcesAdapter.\n */\nexport interface AssociationEntitySelectAdapter {\n  /** True while the association list is still hydrating. */\n  loading: boolean;\n  /** Every entity of this token associated with the container. */\n  items: AssociationEntitySelectItem[];\n  activeId: string | null;\n  setActive: (id: string) => void | Promise<unknown>;\n  /**\n   * Create a new entity named `title`, associate it to the container, and\n   * make it active. Resolves to the new id, or null on failure (the adapter\n   * reports its own error detail; the component toasts generically).\n   * Omit when creation isn't name-driven — pass `createSlot` on the component\n   * instead (e.g. a conversation is created by PICKING AN AGENT, not naming).\n   */\n  createAndAttach?: (title: string) => Promise<string | null>;\n  /** Rename the entity (its real title column). Resolves false on failure. */\n  rename: (id: string, title: string) => Promise<boolean>;\n  /** Optional: unlink an entity from the container (never deletes the row). */\n  detach?: (id: string) => Promise<unknown>;\n}\n\nexport interface UseAssociationEntitySelectAdapterArgs {\n  token: EntityTypeToken;\n  /** The container the entities are associated with (always the edge TARGET). */\n  container: {\n    type: AssociationTargetType;\n    id: string | null;\n    orgId?: string | null;\n  };\n  /** Controlled active selection; omit to default to the first attached row. */\n  activeId?: string | null;\n  onActiveChange?: (id: string) => void | Promise<unknown>;\n  /** NOT NULL columns the registry conventions can't know (create only). */\n  createColumns?: Record<string, unknown>;\n}\n\nexport function useAssociationEntitySelectAdapter(\n  args: UseAssociationEntitySelectAdapterArgs,\n): AssociationEntitySelectAdapter {\n  const { token, container, activeId, onActiveChange, createColumns } = args;\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const links = useContainerLinks({\n    containerType: container.type,\n    containerId: container.id,\n    orgId: container.orgId ?? null,\n  });\n  const rows = links.linksFor(token);\n  const { titleFor } = useEntityTitles(\n    rows.map((r) => ({ token, id: r.resourceId, label: r.label })),\n  );\n  // Rename/create wins over the (attach-time) edge label until a refetch.\n  const [titleOverrides, setTitleOverrides] = useState<Record<string, string>>(\n    {},\n  );\n  // Uncontrolled fallback selection (used only when the caller passes no\n  // activeId — a bare edge has no active flag to persist).\n  const [localActiveId, setLocalActiveId] = useState<string | null>(null);\n\n  const items = rows.map((r) => ({\n    id: r.resourceId,\n    title:\n      titleOverrides[r.resourceId] ??\n      titleFor({ token, id: r.resourceId, label: r.label }),\n  }));\n\n  const controlled = activeId !== undefined;\n  const resolvedActive = controlled ? activeId : localActiveId;\n  const effectiveActive =\n    resolvedActive && items.some((i) => i.id === resolvedActive)\n      ? resolvedActive\n      : (items[0]?.id ?? null);\n\n  const setActive = (id: string) => {\n    if (!controlled) setLocalActiveId(id);\n    return onActiveChange?.(id);\n  };\n\n  return {\n    loading: links.status === \"loading\" || links.status === \"idle\",\n    items,\n    activeId: effectiveActive,\n    setActive,\n    createAndAttach: async (title) => {\n      // CREATE first (durable row), ASSOCIATE second (idempotent edge).\n      const created = await store.entityRows.createEntityRow(token, {\n        title,\n        orgId: container.orgId ?? null,\n        ...(createColumns !== undefined ? { extraColumns: createColumns } : {}),\n      });\n      // Create-failure surfaces via the component's generic toast (null\n      // return); entityRows already screams the DB detail to the sink.\n      if (!created.ok) return null;\n      let attached = await links.attach(token, created.data.id, title);\n      if (!attached.ok) {\n        // The row EXISTS — retry the idempotent edge once, then say exactly\n        // what happened. A created-but-unlinked item must never look like a\n        // failed create (the row would silently \"disappear\").\n        attached = await links.attach(token, created.data.id, title);\n      }\n      if (!attached.ok) {\n        store.errorSink({\n          code: \"created_but_attach_failed\",\n          message:\n            \"[useAssociationEntitySelectAdapter] created but attach failed\",\n          context: {\n            token,\n            id: created.data.id,\n            error: attached.error,\n          },\n        });\n        notifier.error(\n          `Created \"${title}\" but couldn't link it here — it exists in your library`,\n        );\n        return null;\n      }\n      setTitleOverrides((prev) => ({ ...prev, [created.data.id]: title }));\n      await setActive(created.data.id);\n      return created.data.id;\n    },\n    rename: async (id, title) => {\n      const res = await store.entityRows.renameEntityRow(token, id, title);\n      if (res.ok) setTitleOverrides((prev) => ({ ...prev, [id]: title.trim() }));\n      return res.ok;\n    },\n    detach: (id) => links.detach(token, id),\n  };\n}\n","// react/components/PrimaryEntityContext.tsx — @ai-matrx/associations/react\n//\n// The page-context bridge for association cards. A page that owns a container\n// entity (an org page, a scope page, a project page) wraps its content once:\n//\n//   <PrimaryEntityProvider value={{ type: \"organization\", id: orgId, orgId }}>\n//     <AssociationCard token=\"task\" />\n//     <AssociationCard token=\"file\" />\n//   </PrimaryEntityProvider>\n//\n// and every <AssociationCard> inside resolves its primary entity automatically —\n// no prop drilling. A card may still override with an explicit `container` prop.\n//\n// Ported verbatim from matrx-frontend\n// `features/scopes/components/associations/PrimaryEntityContext.tsx` (W4,\n// 2026-08-29).\n\nimport { useContext, type ReactNode } from \"react\";\n\nimport { sharedContext } from \"../sharedContext\";\n\nimport type { AssociationTargetType } from \"../../edges\";\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\n\ninterface PrimaryEntityBase {\n  id: string;\n  /** Org to stamp on edges created here (org-scoped RLS / counts). */\n  orgId?: string | null;\n  /** Human label for headings (e.g. the org/scope name). */\n  label?: string;\n}\n\n/** A container: its surfaces list what is attached INTO it (the default). */\nexport interface PrimaryContainerEntity extends PrimaryEntityBase {\n  /** Container token — must be an association TARGET type. */\n  type: AssociationTargetType;\n  direction?: \"incoming\";\n}\n\n/**\n * A thing FILED UNDER containers (e.g. a Source under a project): its\n * surfaces list its own outgoing edges and \"+\" files it under a container.\n */\nexport interface PrimaryFiledEntity extends PrimaryEntityBase {\n  /** Any registered entity type — it is the edge SOURCE. */\n  type: EntityTypeToken;\n  direction: \"outgoing\";\n}\n\n/** The primary entity a surface is anchored to. */\nexport type PrimaryEntity = PrimaryContainerEntity | PrimaryFiledEntity;\n\nconst PrimaryEntityCtx = sharedContext<PrimaryEntity | null>(\"PrimaryEntityCtx\", null);\n\nexport function PrimaryEntityProvider({\n  value,\n  children,\n}: {\n  value: PrimaryEntity;\n  children: ReactNode;\n}) {\n  return (\n    <PrimaryEntityCtx.Provider value={value}>\n      {children}\n    </PrimaryEntityCtx.Provider>\n  );\n}\n\n/** Read the surrounding primary entity, or null when unprovided. */\nexport function usePrimaryEntity(): PrimaryEntity | null {\n  return useContext(PrimaryEntityCtx);\n}\n","// react/components/AssociationWindow.tsx — @ai-matrx/associations/react\n//\n// The non-blocking shell for association surfaces. Ported from matrx-frontend\n// `features/scopes/components/associations/AssociationWindow.tsx` (W4,\n// 2026-08-29) with the measured seam inverted: the `WindowPanel` import\n// becomes the OPTIONAL `windowShell` port.\n//\n//   • windowShell absent → `DefaultWindowShell`, the package's OWN real\n//     window (0.6.0, C23): draggable, resizable, maximizable, viewport-\n//     clamped, portalled, non-modal, mobile bottom-card. NOT a degradation —\n//     the shipped default. A host needs no window system to get one.\n//   • windowShell bound → the host's window renders the surface instead\n//     (matrx-frontend binds `WindowPanel` for tray docking + workspace\n//     persistence, which are app identity the package cannot own).\n\nimport { useId, type ReactNode } from \"react\";\n\nimport { useAssociationsUiPorts } from \"../context\";\nimport { DefaultWindowShell } from \"./DefaultWindowShell\";\n\nexport interface AssociationWindowProps {\n  /** Controls mount — callers should also gate their JSX on this. */\n  open: boolean;\n  onClose: () => void;\n  /** Human-readable scope for the window id (debugging / tray labels). */\n  scopeId: string;\n  title: string;\n  /** Small leading icon rendered beside the title. */\n  icon?: ReactNode;\n  /**\n   * One-line context under the header (\"Attached to Titanium Marketing\").\n   * A node, not a string, so the container it names can carry its own door\n   * (THE DOOR LAW) instead of being an unreachable label.\n   */\n  subtitle?: ReactNode;\n  children: ReactNode;\n}\n\nexport function AssociationWindow({\n  open,\n  onClose,\n  scopeId,\n  title,\n  icon,\n  subtitle,\n  children,\n}: AssociationWindowProps) {\n  // Unique per mounted instance — two shells sharing an id fight over one\n  // host window-registry entry and the first unmount kills drag for the\n  // survivor.\n  const instanceId = useId();\n  const { windowShell } = useAssociationsUiPorts();\n\n  if (!open) return null;\n\n  const body = (\n    <div className=\"flex h-full min-h-0 flex-col gap-2 p-3\">\n      {/* A <div>, not a <p>: `subtitle` is a node and may carry an entity ref\n          whose peek renders block content. */}\n      {subtitle ? (\n        <div className=\"shrink-0 text-xs text-muted-foreground\">{subtitle}</div>\n      ) : null}\n      {children}\n    </div>\n  );\n\n  const windowId = `association:${scopeId}:${instanceId}`;\n\n  if (windowShell) {\n    const HostWindow = windowShell.Window;\n    return (\n      <HostWindow id={windowId} title={title} onClose={onClose}>\n        {body}\n      </HostWindow>\n    );\n  }\n\n  return (\n    <DefaultWindowShell\n      id={windowId}\n      title={title}\n      onClose={onClose}\n      {...(icon !== undefined ? { icon } : {})}\n    >\n      {body}\n    </DefaultWindowShell>\n  );\n}\n\nexport default AssociationWindow;\n","// react/components/DefaultWindowShell.tsx — @ai-matrx/associations/react\n//\n// THE package's shipped default for the `windowShell` port (C23: every port\n// ships a working default; hosts override, they never have to fill).\n//\n// Before 0.6.0 the absent-port path was a DEGRADATION — a fixed, centered,\n// non-draggable card. That failed THE ALL-INCLUSIVE LAW: a host that wants a\n// real window had to build one. This IS a real window:\n//\n//   • drag by the header (pointer events — mouse, pen and touch alike),\n//   • resize from the bottom-right grip, honoring min sizes,\n//   • maximize / restore toggle,\n//   • clamped to the viewport on drag, on resize, and on window resize —\n//     a window can never be dragged somewhere it cannot be dragged back from,\n//   • NON-MODAL: no backdrop, the page behind stays fully interactive\n//     (the pre-extraction AssociationWindow contract),\n//   • Escape closes; the panel takes focus on mount and is labeled for\n//     screen readers (`role=\"dialog\"` + `aria-label`),\n//   • portalled to <body> so a transformed ancestor cannot clip it (the\n//     classic `position: fixed` trap),\n//   • under 640px it presents as a full-width bottom card — drag/resize are\n//     pointless on a phone and the grip is hidden rather than left inert.\n//\n// The frame is design-system's: THE WINDOW DRAG (`useDragMove` — painted per\n// frame, committed once on release, cursor held, raised on press) and its\n// `clampRectToViewport`, inside a `FloatingLayer`. This file owns no pointer,\n// resize or clamp code of its own.\n//\n// What it deliberately does NOT do: dock to a tray, persist across reloads,\n// or take part in an app-wide window manager. Those are app identity — a\n// host with a window manager (matrx-frontend's `WindowPanel`) binds the\n// `windowShell` port and this shell steps aside.\n\nimport {\n  useCallback,\n  useEffect,\n  useLayoutEffect,\n  useRef,\n  useState,\n  type CSSProperties,\n  type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n  clampRectToViewport,\n  cn,\n  type DragRect,\n  FloatingLayer,\n  readViewport,\n  useDragMove,\n  useFloatingLayerZIndex,\n} from \"@ai-matrx/design-system\";\n\nimport { GripResizeIcon, RestoreIcon } from \"../icons\";\nimport { Maximize2Icon, XIcon } from \"@ai-matrx/design-system/icons\";\n\nconst DEFAULT_WIDTH = 440;\nconst DEFAULT_HEIGHT = 580;\nconst MIN_WIDTH = 330;\nconst MIN_HEIGHT = 380;\nconst MOBILE_MAX_WIDTH = 640;\n/** Never let the whole header slide off-screen — keep a grab strip visible. */\nconst EDGE_KEEP = 48;\n\ntype Rect = DragRect;\n\nexport interface DefaultWindowShellProps {\n  /** Stable id — used for the accessible label association only. */\n  id: string;\n  title: string;\n  onClose: () => void;\n  /** Small leading glyph beside the title. */\n  icon?: ReactNode;\n  children: ReactNode;\n  className?: string;\n}\n\n/** Kept reachable: a 48px grab strip stays on screen, the header never above the top. */\nfunction clamp(rect: Rect): Rect {\n  return clampRectToViewport(rect, readViewport(), {\n    keepVisible: EDGE_KEEP,\n    fit: { minWidth: MIN_WIDTH, minHeight: MIN_HEIGHT },\n  });\n}\n\nfunction centred(): Rect {\n  const { width: vw, height: vh } = readViewport();\n  const width = Math.min(DEFAULT_WIDTH, Math.max(vw - 32, MIN_WIDTH));\n  const height = Math.min(DEFAULT_HEIGHT, Math.max(vh - 32, MIN_HEIGHT));\n  return clamp({\n    width,\n    height,\n    x: Math.round((vw - width) / 2),\n    y: Math.round((vh - height) / 2),\n  });\n}\n\nexport function DefaultWindowShell({\n  id,\n  title,\n  onClose,\n  icon,\n  children,\n  className,\n}: DefaultWindowShellProps) {\n  const panelRef = useRef<HTMLDivElement | null>(null);\n  const [panel, setPanel] = useState<HTMLDivElement | null>(null);\n  const setPanelRef = useCallback((node: HTMLDivElement | null) => {\n    panelRef.current = node;\n    setPanel(node);\n  }, []);\n  // Opened from inside a modal (a Drawer, a Sheet, a phone Dialog), the window\n  // is lifted to the modal tier so its options sit above the modal's scrim\n  // (design-system floating-layer).\n  const zIndex = useFloatingLayerZIndex(50);\n  const [mounted, setMounted] = useState(false);\n  const [isMobile, setIsMobile] = useState(false);\n  const [rect, setRect] = useState<Rect>(() => centred());\n  const [maximized, setMaximized] = useState(false);\n  // SSR safety: the portal target only exists in the browser. Rendering\n  // nothing on the server is correct — this shell is opened by a user\n  // gesture, so it is never part of first paint.\n  useLayoutEffect(() => {\n    setMounted(true);\n    setIsMobile(window.innerWidth < MOBILE_MAX_WIDTH);\n    setRect(centred());\n  }, []);\n\n  // Viewport changes (rotate, resize, keyboard) re-clamp — a window must\n  // never end up unreachable because the viewport shrank under it.\n  useEffect(() => {\n    if (!mounted) return;\n    const onResize = () => {\n      setIsMobile(window.innerWidth < MOBILE_MAX_WIDTH);\n      setRect((current) => clamp(current));\n    };\n    window.addEventListener(\"resize\", onResize);\n    return () => window.removeEventListener(\"resize\", onResize);\n  }, [mounted]);\n\n  useEffect(() => {\n    const onKeyDown = (event: KeyboardEvent) => {\n      if (event.key === \"Escape\") onClose();\n    };\n    window.addEventListener(\"keydown\", onKeyDown);\n    return () => window.removeEventListener(\"keydown\", onKeyDown);\n  }, [onClose]);\n\n  useEffect(() => {\n    panelRef.current?.focus({ preventScroll: true });\n  }, [mounted]);\n\n  // THE WINDOW DRAG: the header moves it, the grip resizes it; one commit per gesture.\n  const drag = useDragMove({\n    element: panel,\n    enabled: !isMobile && !maximized,\n    getRect: () => rect,\n    limits: { minWidth: MIN_WIDTH, minHeight: MIN_HEIGHT },\n    constrain: clamp,\n    onCommit: setRect,\n  });\n\n  if (!mounted || typeof document === \"undefined\") return null;\n\n  const labelId = `assoc-window-title:${id}`;\n  const style: CSSProperties = isMobile\n    ? {}\n    : maximized\n      ? { inset: \"1rem\", width: \"auto\", height: \"auto\" }\n      : {\n          left: rect.x,\n          top: rect.y,\n          width: rect.width,\n          height: rect.height,\n        };\n\n  return createPortal(\n    <FloatingLayer>\n    <div\n      ref={setPanelRef}\n      role=\"dialog\"\n      aria-labelledby={labelId}\n      tabIndex={-1}\n      style={{ ...style, zIndex }}\n      className={cn(\n        // Non-modal by design: no backdrop element exists, so the page\n        // behind keeps every click. `pointer-events-auto` re-asserts our\n        // own subtree in case a Radix surface left <body> inert.\n        \"pointer-events-auto fixed flex flex-col overflow-hidden border border-border bg-card text-card-foreground shadow-xl outline-none\",\n        isMobile\n          ? \"inset-x-0 bottom-0 max-h-[85dvh] rounded-t-xl\"\n          : \"rounded-xl\",\n        className,\n      )}\n    >\n      <header\n        onPointerDown={drag.onPointerDown}\n        onDoubleClick={() => {\n          if (!isMobile) setMaximized((v) => !v);\n        }}\n        className={cn(\n          \"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2 select-none\",\n          isMobile ? \"\" : \"cursor-move touch-none\",\n        )}\n      >\n        <span\n          id={labelId}\n          className=\"flex min-w-0 items-center gap-1.5 text-sm font-medium text-foreground\"\n        >\n          {icon}\n          <span className=\"truncate\">{title}</span>\n        </span>\n        <span className=\"flex shrink-0 items-center gap-0.5\">\n          {isMobile ? null : (\n            <button\n              type=\"button\"\n              onClick={() => setMaximized((v) => !v)}\n              aria-label={maximized ? \"Restore window\" : \"Maximize window\"}\n              className=\"flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n            >\n              {maximized ? (\n                <RestoreIcon className=\"h-3.5 w-3.5\" />\n              ) : (\n                <Maximize2Icon className=\"h-3.5 w-3.5\" />\n              )}\n            </button>\n          )}\n          <button\n            type=\"button\"\n            onClick={onClose}\n            aria-label=\"Close\"\n            className=\"flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n          >\n            <XIcon className=\"h-3.5 w-3.5\" />\n          </button>\n        </span>\n      </header>\n\n      <div className=\"min-h-0 flex-1 overflow-hidden\">{children}</div>\n\n      {isMobile || maximized ? null : (\n        <button\n          type=\"button\"\n          aria-label=\"Resize window\"\n          onPointerDown={drag.resizeHandle(\"se\")}\n          className=\"absolute bottom-0 right-0 flex h-4 w-4 cursor-nwse-resize touch-none items-center justify-center text-muted-foreground/60 hover:text-foreground\"\n        >\n          <GripResizeIcon className=\"h-3 w-3\" />\n        </button>\n      )}\n    </div>\n    </FloatingLayer>,\n    document.body,\n  );\n}\n\nexport default DefaultWindowShell;\n","/**\n * react/icons.tsx — this package's glyph names, as aliases of the ONE glyph home,\n * `@ai-matrx/design-system/icons`. No path data lives here (policy C19: no icon library, and one drawing per\n * glyph); the alias only fixes this package's historical size and stroke. Exports are unchanged.\n */\n\nimport {\n  BoxesIcon as GBoxesIcon,\n  CornerDownRightIcon as GCornerDownRightIcon,\n  FileTextIcon as GFileTextIcon,\n  FolderOpenIcon as GFolderOpenIcon,\n  GripResizeIcon as GGripResizeIcon,\n  Link2Icon as GLink2Icon,\n  Loader2Icon as GLoader2Icon,\n  RefreshCwIcon as GRefreshCwIcon,\n  RestoreIcon as GRestoreIcon,\n  TagIcon as GTagIcon,\n  UploadIcon as GUploadIcon,\n  withGlyphDefaults,\n  type GlyphComponent,\n} from \"@ai-matrx/design-system/icons\";\n\nimport type { SVGProps } from \"react\";\n\nexport type IconProps = SVGProps<SVGSVGElement>;\n\nconst sized = (Glyph: GlyphComponent): GlyphComponent => withGlyphDefaults(Glyph, { width: 24, height: 24 });\n\nconst SpinnerIcon = sized(GLoader2Icon);\nconst Link2Icon = sized(GLink2Icon);\nconst RefreshIcon = sized(GRefreshCwIcon);\nconst UploadIcon = sized(GUploadIcon);\nconst FolderOpenIcon = sized(GFolderOpenIcon);\nconst FileTextIcon = sized(GFileTextIcon);\nconst CornerDownRightIcon = sized(GCornerDownRightIcon);\nconst TagIcon = sized(GTagIcon);\nconst DefaultEntityIcon = sized(GBoxesIcon);\nconst RestoreIcon = sized(GRestoreIcon);\nconst GripResizeIcon = sized(GGripResizeIcon);\n\nexport {\n  SpinnerIcon,\n  Link2Icon,\n  RefreshIcon,\n  UploadIcon,\n  FolderOpenIcon,\n  FileTextIcon,\n  CornerDownRightIcon,\n  TagIcon,\n  DefaultEntityIcon,\n  RestoreIcon,\n  GripResizeIcon,\n};\n","// react/components/AssociationPicker.tsx — @ai-matrx/associations/react\n//\n// The token-driven \"pick a record to associate\" surface, through the ONE\n// AssociationWindow shell. Two jobs, both ALWAYS available (the\n// create-then-associate contract):\n//   1. Associate existing — the registry-driven candidate list.\n//   2. Add new + associate — the \"+ New <Entity>\" footer creates the row\n//      first (durable, via the store's entityRows service), writes the edge\n//      second, and every terminal outcome is loud.\n//\n// Ported from matrx-frontend\n// `features/scopes/components/associations/AssociationPicker.tsx` (W4,\n// 2026-08-29) with the measured seams inverted:\n//   • the hardcoded `token === \"file\"` → FilePickerWindow branch becomes the\n//     per-token `pickerOverrides` port: a host registers its canonical picker\n//     component per token (matrx-frontend registers FilePickerWindow for\n//     \"file\" in its binding); with no override the generic candidate list\n//     serves the token (design Decision 2 degradation);\n//   • `@/lib/toast` → the notifier port (warn-once degradation);\n//   • host `next/dynamic` lazy-loading of the window shell is a HOST concern\n//     (the shell itself now arrives via the windowShell port).\n\nimport { useState, type ReactNode } from \"react\";\nimport { cn, Input } from \"@ai-matrx/design-system\";\n\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport type { AssociationPickerProps } from \"../../ports\";\nimport { useAssociationsStore, useAssociationsUiPorts, useNotifier } from \"../context\";\nimport { useAssociationCandidates } from \"../hooks/useAssociationCandidates\";\nimport { useUniversalEntitySearch } from \"../hooks/useUniversalEntitySearch\";\nimport { SearchFailureNotice } from \"./SearchFailureNotice\";\nimport { DefaultEntityIcon, SpinnerIcon } from \"../icons\";\nimport { CheckIcon, PlusIcon, SearchIcon, XIcon } from \"@ai-matrx/design-system/icons\";\nimport { AssociationWindow } from \"./AssociationWindow\";\n\nexport type { AssociationPickerProps };\n\nexport function AssociationPicker(props: AssociationPickerProps) {\n  const store = useAssociationsStore();\n  const { pickerOverrides } = useAssociationsUiPorts();\n  const info = store.registry.getEntityInfo(props.token);\n  const Icon = info.Icon ?? DefaultEntityIcon;\n\n  // A host-registered per-token picker (e.g. the canonical file browser)\n  // replaces the generic surface entirely — same props contract.\n  const Override = pickerOverrides?.[props.token];\n  if (Override) return <Override {...props} />;\n\n  const title = `Add ${info.labelPlural}`;\n  const subtitle = props.filing\n    ? `File ${props.containerLabel ?? \"this\"} under a ${info.label.toLowerCase()}`\n    : props.containerLabel\n      ? `Attach to ${props.containerLabel}`\n      : \"Click an item to attach or detach it\";\n\n  // Gated on `open` so host window chunks only load on first use.\n  if (!props.open) return null;\n  return (\n    <AssociationWindow\n      open={props.open}\n      onClose={() => props.onOpenChange(false)}\n      scopeId={`picker:${props.token}`}\n      title={title}\n      icon={<Icon className=\"size-3.5 text-primary\" />}\n      subtitle={subtitle}\n    >\n      <AssociationCandidateBody\n        token={props.token}\n        enabled={props.open}\n        orgId={props.orgId}\n        attachedIds={props.attachedIds}\n        onAttach={props.onAttach}\n        onDetach={props.onDetach}\n        onClose={() => props.onOpenChange(false)}\n      />\n    </AssociationWindow>\n  );\n}\n\nexport interface AssociationCandidateBodyProps {\n  token: EntityTypeToken;\n  /** Load candidates only while true (mirror of the surface's `open`). */\n  enabled: boolean;\n  /** Org stamped onto rows created by the \"+ New\" footer. */\n  orgId?: string | null | undefined;\n  attachedIds: Set<string>;\n  onAttach: (\n    resourceId: string,\n    title: string,\n  ) => Promise<{ ok: boolean; error?: string }>;\n  onDetach: (resourceId: string) => Promise<{ ok: boolean; error?: string }>;\n  /** Wired to a per-token browse surface's back affordance. */\n  onClose?: () => void;\n}\n\n/**\n * The attach/detach body for ONE token — reused by the picker sheet and by\n * `UniversalAssociationPicker`'s per-token browse mode. Tokens with a\n * host-registered picker override are routed at the PICKER level (windowed\n * override component); this body is always the generic registry-driven list.\n */\nexport function AssociationCandidateBody({\n  token,\n  enabled,\n  orgId,\n  attachedIds,\n  onAttach,\n  onDetach,\n  onClose,\n}: AssociationCandidateBodyProps) {\n  void onClose;\n  return (\n    <EntityCandidateList\n      token={token}\n      enabled={enabled}\n      orgId={orgId}\n      attachedIds={attachedIds}\n      onAttach={onAttach}\n      onDetach={onDetach}\n    />\n  );\n}\n\nfunction EntityCandidateList({\n  token,\n  enabled,\n  orgId,\n  attachedIds,\n  onAttach,\n  onDetach,\n}: {\n  token: EntityTypeToken;\n  enabled: boolean;\n  orgId?: string | null | undefined;\n  attachedIds: Set<string>;\n  onAttach: (\n    resourceId: string,\n    title: string,\n  ) => Promise<{ ok: boolean; error?: string }>;\n  onDetach: (resourceId: string) => Promise<{ ok: boolean; error?: string }>;\n}) {\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const [search, setSearch] = useState(\"\");\n  const [busyId, setBusyId] = useState<string | null>(null);\n  const info = store.registry.getEntityInfo(token);\n  const Icon = info.Icon ?? DefaultEntityIcon;\n  const { candidates, loading, error, reload } = useAssociationCandidates({\n    token,\n    enabled,\n    ...(search.trim() ? { search: search.trim() } : {}),\n  });\n  const {\n    results: recentCandidates,\n    loading: recentsLoading,\n    failures: recentsFailures,\n  } = useUniversalEntitySearch({\n      query: \"\",\n      tokens: [token],\n      enabled: enabled && !search.trim(),\n    });\n  const visibleRecents = search.trim() ? [] : recentCandidates;\n  const recentIds = new Set(visibleRecents.map((candidate) => candidate.id));\n  const ordinaryCandidates = search.trim()\n    ? candidates\n    : candidates.filter((candidate) => !recentIds.has(candidate.id));\n  const visibleCount = visibleRecents.length + ordinaryCandidates.length;\n\n  // Creatable = the generic registry write path works: a title column and no\n  // bespoke candidate source (a `listCandidates` override signals the table\n  // is not PostgREST-writable, e.g. rag data stores).\n  const canCreate = info.titleColumn !== null && info.listCandidates === null;\n\n  const toggle = async (id: string, title: string) => {\n    if (busyId) return;\n    setBusyId(id);\n    try {\n      const attached = attachedIds.has(id);\n      const res = attached ? await onDetach(id) : await onAttach(id, title);\n      // The container cache reload (in the store write) flips `attachedIds`\n      // for us. A silent no-op attach is the bug class this scream kills.\n      if (!res.ok) {\n        notifier.error(\n          `Couldn't ${attached ? \"detach\" : \"attach\"} \"${title}\"` +\n            (res.error ? `: ${res.error}` : \"\"),\n        );\n      }\n    } finally {\n      setBusyId(null);\n    }\n  };\n\n  return (\n    <>\n      <div className=\"relative mb-2\">\n        <SearchIcon className=\"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground\" />\n        <Input\n          autoFocus\n          value={search}\n          onChange={(e) => setSearch(e.target.value)}\n          placeholder={`Search ${info.labelPlural.toLowerCase()}…`}\n          className=\"h-11 pl-8 text-base md:h-9\"\n          style={{ fontSize: 16 }}\n        />\n      </div>\n\n      <div className=\"flex-1 min-h-0 overflow-y-auto -mx-1 px-1\">\n        {/* The recents strip supplements the list: its failure is a one-line\n            note above whatever the list shows, never a silently blank strip.\n            (A candidate-read failure below has its own block.) */}\n        {!search.trim() && !error && (\n          <SearchFailureNotice\n            error={null}\n            failures={recentsFailures}\n            operation={`Load recent ${info.labelPlural.toLowerCase()}`}\n            origin=\"associations/AssociationPicker\"\n            className=\"mb-1\"\n          />\n        )}\n        {(loading || recentsLoading) && visibleCount === 0 ? (\n          <ListMessage>\n            <SpinnerIcon className=\"h-4 w-4 animate-spin\" />\n            Loading…\n          </ListMessage>\n        ) : error ? (\n          <div className=\"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive\">\n            <p className=\"font-medium\">Couldn’t load items</p>\n            <p className=\"opacity-80\">{error}</p>\n            <button\n              type=\"button\"\n              onClick={reload}\n              className=\"mt-1 underline hover:no-underline\"\n            >\n              Retry\n            </button>\n          </div>\n        ) : visibleCount === 0 ? (\n          <ListMessage>\n            {canCreate\n              ? `Nothing to attach yet — create a new ${info.label.toLowerCase()} below.`\n              : \"Nothing to attach.\"}\n          </ListMessage>\n        ) : (\n          <div className=\"space-y-2\">\n            {visibleRecents.length > 0 && (\n              <CandidateSection\n                label=\"Recent\"\n                candidates={visibleRecents}\n                attachedIds={attachedIds}\n                busyId={busyId}\n                icon={<Icon className=\"h-4 w-4 shrink-0 text-muted-foreground\" />}\n                onToggle={toggle}\n              />\n            )}\n            {ordinaryCandidates.length > 0 && (\n              <CandidateSection\n                label={visibleRecents.length > 0 ? `All ${info.labelPlural}` : null}\n                candidates={ordinaryCandidates}\n                attachedIds={attachedIds}\n                busyId={busyId}\n                icon={<Icon className=\"h-4 w-4 shrink-0 text-muted-foreground\" />}\n                onToggle={toggle}\n              />\n            )}\n          </div>\n        )}\n      </div>\n\n      {canCreate && (\n        <CreateAndAttachFooter\n          token={token}\n          orgId={orgId}\n          seed={search.trim()}\n          onAttach={onAttach}\n          onCreated={reload}\n        />\n      )}\n    </>\n  );\n}\n\nfunction CandidateSection({\n  label,\n  candidates,\n  attachedIds,\n  busyId,\n  icon,\n  onToggle,\n}: {\n  label: string | null;\n  candidates: Array<{ id: string; title: string }>;\n  attachedIds: Set<string>;\n  busyId: string | null;\n  icon: ReactNode;\n  onToggle: (id: string, title: string) => Promise<void>;\n}) {\n  return (\n    <section className=\"space-y-0.5\">\n      {label && (\n        <p className=\"px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60\">\n          {label}\n        </p>\n      )}\n      <ul className=\"space-y-0.5\">\n        {candidates.map((candidate) => {\n          const attached = attachedIds.has(candidate.id);\n          const busy = busyId === candidate.id;\n          return (\n            <li key={candidate.id}>\n              <button\n                type=\"button\"\n                disabled={busy}\n                onClick={() => void onToggle(candidate.id, candidate.title)}\n                className={cn(\n                  \"group flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors md:min-h-0\",\n                  \"hover:bg-accent disabled:opacity-50\",\n                  attached && \"bg-accent/40\",\n                )}\n              >\n                {icon}\n                <span className=\"flex-1 min-w-0 truncate text-foreground\">\n                  {candidate.title}\n                </span>\n                <span\n                  className={cn(\n                    \"flex h-5 w-5 items-center justify-center rounded-full shrink-0\",\n                    attached\n                      ? \"bg-primary text-primary-foreground\"\n                      : \"border border-border text-muted-foreground group-hover:border-primary/60\",\n                  )}\n                >\n                  {busy ? (\n                    <SpinnerIcon className=\"h-3 w-3 animate-spin\" />\n                  ) : attached ? (\n                    <CheckIcon className=\"h-3 w-3\" />\n                  ) : (\n                    <PlusIcon className=\"h-3 w-3\" />\n                  )}\n                </span>\n              </button>\n            </li>\n          );\n        })}\n      </ul>\n    </section>\n  );\n}\n\n/**\n * The \"+ New <Entity>\" footer — the create-then-associate contract: create the\n * durable row FIRST (the store's entityRows service), write the idempotent\n * edge SECOND (retry once), and every terminal outcome is loud. A\n * created-but-unlinked row is reported WITH its location, never silently\n * orphaned.\n */\nfunction CreateAndAttachFooter({\n  token,\n  orgId,\n  seed,\n  onAttach,\n  onCreated,\n}: {\n  token: EntityTypeToken;\n  orgId?: string | null | undefined;\n  /** Current search text — doubles as the new row's default name. */\n  seed: string;\n  onAttach: (resourceId: string, title: string) => Promise<{ ok: boolean }>;\n  onCreated: () => void;\n}) {\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const info = store.registry.getEntityInfo(token);\n  const [editing, setEditing] = useState(false);\n  const [name, setName] = useState(\"\");\n  const [busy, setBusy] = useState(false);\n\n  const submit = async () => {\n    const title = name.trim();\n    if (!title || busy) return;\n    setBusy(true);\n    try {\n      const created = await store.entityRows.createEntityRow(token, {\n        title,\n        orgId: orgId ?? null,\n      });\n      if (!created.ok) {\n        notifier.error(\n          `Couldn't create ${info.label.toLowerCase()}: ${created.error}`,\n        );\n        return;\n      }\n      let attached = await onAttach(created.data.id, created.data.title);\n      if (!attached.ok) {\n        // The edge write is idempotent — one retry is safe.\n        attached = await onAttach(created.data.id, created.data.title);\n      }\n      if (attached.ok) {\n        notifier.success(`\"${title}\" created and attached`);\n      } else {\n        notifier.error(\n          `Created \"${title}\" but couldn't attach it — it's saved in your ` +\n            `${info.labelPlural.toLowerCase()}; pick it from the list to retry.`,\n        );\n      }\n      setEditing(false);\n      setName(\"\");\n      onCreated();\n    } finally {\n      setBusy(false);\n    }\n  };\n\n  if (!editing) {\n    return (\n      <button\n        type=\"button\"\n        onClick={() => {\n          setName(seed);\n          setEditing(true);\n        }}\n        className=\"mt-2 flex min-h-11 w-full shrink-0 items-center justify-center gap-1.5 rounded-md border border-dashed border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground md:min-h-0\"\n      >\n        <PlusIcon className=\"h-4 w-4\" />\n        New {info.label}\n        {seed ? (\n          <span className=\"max-w-40 truncate text-muted-foreground/70\">\n            “{seed}”\n          </span>\n        ) : null}\n      </button>\n    );\n  }\n\n  return (\n    <div className=\"mt-2 flex shrink-0 items-center gap-1.5\">\n      <Input\n        autoFocus\n        value={name}\n        onChange={(e) => setName(e.target.value)}\n        onKeyDown={(e) => {\n          if (e.key === \"Enter\") void submit();\n          if (e.key === \"Escape\") {\n            setEditing(false);\n            setName(\"\");\n          }\n        }}\n        placeholder={`New ${info.label.toLowerCase()} name…`}\n        disabled={busy}\n        className=\"h-11 flex-1 text-base md:h-8\"\n        style={{ fontSize: 16 }}\n      />\n      <button\n        type=\"button\"\n        disabled={busy || !name.trim()}\n        onClick={() => void submit()}\n        className=\"flex h-11 items-center gap-1 rounded-md bg-primary px-2.5 text-sm font-medium text-primary-foreground transition-opacity disabled:opacity-50 md:h-8\"\n      >\n        {busy ? <SpinnerIcon className=\"h-3.5 w-3.5 animate-spin\" /> : \"Create\"}\n      </button>\n      <button\n        type=\"button\"\n        disabled={busy}\n        onClick={() => {\n          setEditing(false);\n          setName(\"\");\n        }}\n        title=\"Cancel\"\n        className=\"flex h-11 w-11 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50 md:h-8 md:w-8\"\n      >\n        <XIcon className=\"h-4 w-4\" />\n      </button>\n    </div>\n  );\n}\n\nfunction ListMessage({ children }: { children: ReactNode }) {\n  return (\n    <div className=\"flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground\">\n      {children}\n    </div>\n  );\n}\n","// react/components/UniversalAssociationPicker.tsx — @ai-matrx/associations/react\n//\n// ONE search box over EVERY listable entity type — \"attach anything from\n// anywhere\". Type a name and results from all tokens stream in, grouped with\n// registry icons; click to attach/detach. An optional token chip rail narrows\n// to per-token browsing.\n//\n// Ported from matrx-frontend\n// `features/scopes/components/associations/UniversalAssociationPicker.tsx`\n// (W4, 2026-08-29) with the seams inverted:\n//   • `EntityDoorControls` → the `DoorControlsSlot` (host port when bound,\n//     otherwise the package's shipped hrefFor anchor — 0.6.0, C23) (absent →\n//     the row renders without doors — title + toggle only, per the design's\n//     degradation table);\n//   • `@/lib/toast` → the notifier port;\n//   • the file-token browse special case → the pickerOverrides port: a token\n//     with a registered override opens that override (windowed) instead of an\n//     inline generic list, preserving \"file enumeration only happens through\n//     the canonical picker\".\n//\n// THE DOOR LAW, picker flavour: every candidate carries its doors as SIBLINGS\n// of the attach/detach toggle (an <a> inside a <button> is invalid DOM).\n\nimport { useState } from \"react\";\nimport { Button, cn, Input } from \"@ai-matrx/design-system\";\n\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport type { UniversalCandidate } from \"../../core/candidates\";\nimport { useAssociationsStore, useAssociationsUiPorts, useNotifier } from \"../context\";\nimport { useUniversalEntitySearch } from \"../hooks/useUniversalEntitySearch\";\nimport { DefaultEntityIcon, SpinnerIcon } from \"../icons\";\nimport { CheckIcon, Maximize2Icon, PlusIcon, SearchIcon } from \"@ai-matrx/design-system/icons\";\nimport { AssociationCandidateBody } from \"./AssociationPicker\";\nimport { DoorControlsSlot } from \"./entityDoors\";\nimport { SearchFailureNotice } from \"./SearchFailureNotice\";\n\nexport interface UniversalAssociationPickerProps {\n  /** Tokens offered. Defaults to every listable token. */\n  tokens?: EntityTypeToken[];\n  /** Ids already attached, keyed `${token}:${id}` — rendered as attached. */\n  attachedKeys: Set<string>;\n  onAttach: (\n    token: EntityTypeToken,\n    resourceId: string,\n    title: string,\n  ) => Promise<{ ok: boolean; error?: string }>;\n  onDetach: (\n    token: EntityTypeToken,\n    resourceId: string,\n  ) => Promise<{ ok: boolean; error?: string }>;\n  /** Org stamped onto rows created via the per-token \"+ New\" footer. */\n  orgId?: string | null;\n  /**\n   * What an empty search box shows. `\"recents\"` (default) shows favorites and\n   * last-viewed records and falls back to browsing candidates when there are\n   * none; `\"candidates\"` always browses the available records.\n   */\n  emptyQueryMode?: \"recents\" | \"candidates\";\n  className?: string;\n}\n\nexport function attachedKey(token: string, id: string): string {\n  return `${token}:${id}`;\n}\n\nexport function UniversalAssociationPicker(\n  props: UniversalAssociationPickerProps,\n) {\n  const {\n    attachedKeys,\n    onAttach,\n    onDetach,\n    orgId,\n    emptyQueryMode = \"recents\",\n    className,\n  } = props;\n  const store = useAssociationsStore();\n  const { pickerOverrides } = useAssociationsUiPorts();\n  const notifier = useNotifier();\n  const tokens = props.tokens ?? store.registry.listableTokens();\n  const [query, setQuery] = useState(\"\");\n  const [browseToken, setBrowseToken] = useState<EntityTypeToken | null>(null);\n  const [busyKey, setBusyKey] = useState<string | null>(null);\n  // A token override (e.g. Files) lives in its OWN window. The picker body\n  // must say so and keep a way back — it used to render nothing at all.\n  const [overrideOpen, setOverrideOpen] = useState(false);\n  // Bumped to remount the override window: reopens a closed one, and brings\n  // an open one back to the front / on screen.\n  const [overrideMount, setOverrideMount] = useState(0);\n\n  const { results, loading, source, failures, error } = useUniversalEntitySearch({\n    query,\n    tokens,\n    enabled: browseToken === null,\n    emptyQueryMode,\n  });\n\n  const selectToken = (next: EntityTypeToken | null) => {\n    setBrowseToken(next);\n    setOverrideOpen(next !== null && Boolean(pickerOverrides?.[next]));\n  };\n\n\n  const toggle = async (c: UniversalCandidate) => {\n    const key = attachedKey(c.token, c.id);\n    if (busyKey) return;\n    setBusyKey(key);\n    try {\n      const attached = attachedKeys.has(key);\n      const res = attached\n        ? await onDetach(c.token, c.id)\n        : await onAttach(c.token, c.id, c.title);\n      // A silent no-op attach is the bug class this scream kills.\n      if (!res.ok) {\n        notifier.error(\n          `Couldn't ${attached ? \"detach\" : \"attach\"} \"${c.title}\"` +\n            (res.error ? `: ${res.error}` : \"\"),\n        );\n      }\n    } finally {\n      setBusyKey(null);\n    }\n  };\n\n  // Group hits by token for section headers (registry icon + plural).\n  const groups = new Map<EntityTypeToken, UniversalCandidate[]>();\n  for (const r of results) {\n    const list = groups.get(r.token) ?? [];\n    list.push(r);\n    groups.set(r.token, list);\n  }\n\n  const BrowseOverride = browseToken ? pickerOverrides?.[browseToken] : undefined;\n\n  return (\n    <div className={cn(\"flex min-h-0 flex-1 flex-col gap-2\", className)}>\n      {/* ── search ──────────────────────────────────────────────────── */}\n      <div className=\"relative\">\n        <SearchIcon className=\"absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground\" />\n        <Input\n          autoFocus\n          value={query}\n          onChange={(e) => {\n            setQuery(e.target.value);\n            if (browseToken) selectToken(null);\n          }}\n          placeholder=\"Search everything…\"\n          className=\"pl-8 text-base\"\n          style={{ fontSize: 16 }}\n        />\n        {loading && browseToken === null && (\n          <SpinnerIcon className=\"absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-muted-foreground\" />\n        )}\n      </div>\n\n      {/* ── token chip rail (narrow to per-token browse) ─────────────── */}\n      <div\n        role=\"group\"\n        aria-label=\"Entity type filters\"\n        className=\"flex shrink-0 flex-nowrap gap-1 overflow-x-auto pb-1\"\n      >\n        {tokens.map((t) => {\n          const info = store.registry.getEntityInfo(t);\n          const ChipIcon = info.Icon ?? DefaultEntityIcon;\n          const active = browseToken === t;\n          return (\n            <button\n              key={t}\n              type=\"button\"\n              aria-pressed={active}\n              onClick={() => selectToken(active ? null : t)}\n              className={cn(\n                \"inline-flex shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] transition-colors\",\n                active\n                  ? \"border-primary/50 bg-primary/10 text-foreground\"\n                  : \"border-border text-muted-foreground hover:text-foreground hover:bg-accent\",\n              )}\n            >\n              <ChipIcon className=\"h-3 w-3\" />\n              {info.labelPlural}\n            </button>\n          );\n        })}\n      </div>\n\n      {/* ── results ──────────────────────────────────────────────────── */}\n      {browseToken && BrowseOverride ? (\n        // The token's canonical host picker (e.g. the stored-files browser)\n        // owns per-token browsing when registered — never a plain list twin.\n        // It opens in its own window; this body says where it went.\n        <div\n          role=\"region\"\n          aria-label={`${store.registry.getEntityInfo(browseToken).labelPlural} window`}\n          className=\"flex flex-1 flex-col items-center justify-center gap-3 px-4 py-8 text-center\"\n        >\n          <p className=\"text-sm text-foreground\">\n            {overrideOpen\n              ? `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is open.`\n              : `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is closed.`}\n          </p>\n          <p className=\"max-w-xs text-[12px] text-muted-foreground\">\n            {overrideOpen\n              ? \"Check items there to attach them; uncheck to detach. Changes save as you go.\"\n              : \"Reopen it to pick more, or go back to search everything.\"}\n          </p>\n          <div className=\"flex flex-wrap items-center justify-center gap-2\">\n            <Button\n              type=\"button\"\n              size=\"sm\"\n              variant={overrideOpen ? \"outline\" : \"default\"}\n              onClick={() => {\n                setOverrideOpen(true);\n                setOverrideMount((n) => n + 1);\n              }}\n            >\n              <Maximize2Icon className=\"mr-1.5 h-3.5 w-3.5\" />\n              {overrideOpen ? \"Bring window to front\" : \"Reopen window\"}\n            </Button>\n            <Button\n              type=\"button\"\n              size=\"sm\"\n              variant=\"ghost\"\n              onClick={() => selectToken(null)}\n            >\n              Back to search\n            </Button>\n          </div>\n          {overrideOpen && (\n            <BrowseOverride\n              key={overrideMount}\n              open\n              onOpenChange={(open) => {\n                if (!open) setOverrideOpen(false);\n              }}\n          token={browseToken}\n          orgId={orgId ?? null}\n          attachedIds={\n            new Set(\n              [...attachedKeys]\n                .filter((k) => k.startsWith(`${browseToken}:`))\n                .map((k) => k.slice(browseToken.length + 1)),\n            )\n          }\n              onAttach={(id, title) => onAttach(browseToken, id, title)}\n              onDetach={(id) => onDetach(browseToken, id)}\n            />\n          )}\n        </div>\n      ) : browseToken ? (\n        <div className=\"flex min-h-0 flex-1 flex-col\">\n          <AssociationCandidateBody\n            token={browseToken}\n            enabled\n            orgId={orgId}\n            onClose={() => selectToken(null)}\n            attachedIds={\n              new Set(\n                [...attachedKeys]\n                  .filter((k) => k.startsWith(`${browseToken}:`))\n                  .map((k) => k.slice(browseToken.length + 1)),\n              )\n            }\n            onAttach={(id, title) => onAttach(browseToken, id, title)}\n            onDetach={(id) => onDetach(browseToken, id)}\n          />\n        </div>\n      ) : (\n        <div\n          role=\"region\"\n          aria-label=\"Association search results\"\n          className=\"-mx-1 min-h-24 flex-1 overflow-y-auto overscroll-contain px-1\"\n        >\n          {error ? (\n            <SearchFailureNotice\n              error={error}\n              failures={failures}\n              operation=\"Search to attach\"\n              origin=\"associations/UniversalAssociationPicker\"\n            />\n          ) : results.length === 0 && failures.length === 0 ? (\n            <p className=\"py-6 text-center text-[12px] text-muted-foreground\">\n              {loading\n                ? \"Searching…\"\n                : query.trim()\n                  ? \"No matches — narrow with a type chip to browse.\"\n                  : \"Nothing to attach yet. Type to search, or pick a type to browse.\"}\n            </p>\n          ) : (\n            <div className=\"space-y-2\">\n              <SearchFailureNotice\n                error={null}\n                failures={failures}\n                operation=\"Search to attach\"\n                origin=\"associations/UniversalAssociationPicker\"\n              />\n              {source !== \"search\" && results.length > 0 && (\n                <p className=\"px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60\">\n                  {source === \"recents\" ? \"Recent\" : \"Browse\"}\n                </p>\n              )}\n              {[...groups.entries()].map(([token, items]) => {\n                const info = store.registry.getEntityInfo(token);\n                const GroupIcon = info.Icon ?? DefaultEntityIcon;\n                return (\n                  <div key={token} className=\"space-y-0.5\">\n                    <p className=\"flex items-center gap-1 px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70\">\n                      <GroupIcon className=\"h-3 w-3\" />\n                      {info.labelPlural}\n                    </p>\n                    <ul className=\"space-y-0.5\">\n                      {items.map((c) => {\n                        const key = attachedKey(c.token, c.id);\n                        const attached = attachedKeys.has(key);\n                        const busy = busyKey === key;\n                        return (\n                          <li\n                            key={key}\n                            className={cn(\n                              \"group/entity-ref group flex items-center gap-1 rounded-md pr-1.5 transition-colors\",\n                              \"hover:bg-accent\",\n                              attached && \"bg-accent/40\",\n                            )}\n                          >\n                            <button\n                              type=\"button\"\n                              disabled={busy}\n                              onClick={() => toggle(c)}\n                              title={\n                                attached\n                                  ? `Detach \"${c.title}\"`\n                                  : `Attach \"${c.title}\"`\n                              }\n                              className={cn(\n                                \"flex min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm\",\n                                \"disabled:opacity-50\",\n                              )}\n                            >\n                              <span className=\"min-w-0 flex-1 truncate text-foreground\">\n                                {c.title}\n                              </span>\n                              <span\n                                className={cn(\n                                  \"flex h-5 w-5 shrink-0 items-center justify-center rounded-full\",\n                                  attached\n                                    ? \"bg-primary text-primary-foreground\"\n                                    : \"border border-border text-muted-foreground group-hover:border-primary/60\",\n                                )}\n                              >\n                                {busy ? (\n                                  <SpinnerIcon className=\"h-3 w-3 animate-spin\" />\n                                ) : attached ? (\n                                  <CheckIcon className=\"h-3 w-3\" />\n                                ) : (\n                                  <PlusIcon className=\"h-3 w-3\" />\n                                )}\n                              </span>\n                            </button>\n                            {/* Sibling of the toggle, never a child — an\n                                anchor inside a button is invalid DOM. */}\n                            <DoorControlsSlot\n                              token={c.token}\n                              id={c.id}\n                              name={c.title}\n                            />\n                          </li>\n                        );\n                      })}\n                    </ul>\n                  </div>\n                );\n              })}\n            </div>\n          )}\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport default UniversalAssociationPicker;\n","// react/components/entityDoors.tsx — @ai-matrx/associations/react\n//\n// The entity-doors seam, resolved with its documented degradations (design\n// Decision 2 table):\n//\n//   • `EntityRef` bound → the host's full door primitive (open / new tab /\n//     peek) renders the name;\n//   • absent → title text, wrapped in the overlay's `hrefFor` link when the\n//     registry has one (real `target=\"_blank\"` anchor — middle-click works),\n//     plain text otherwise (a link-styled title can never no-op);\n//   • `UnresolvedRef` bound → the host's access-gate chip for a target the\n//     viewer cannot read; absent → the package's plain \"unavailable\" chip;\n//   • `DoorControls` bound → the host's open/new-tab/peek control cluster;\n//     absent → the package's SHIPPED default (0.6.0, C23): a real, keyboard\n//     reachable, labeled `target=\"_blank\"` anchor built from the registry\n//     overlay's `hrefFor`. A token with no registered route renders nothing —\n//     honest absence, never a control that goes nowhere.\n\nimport type { ComponentType } from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\n\nimport type { EntityDoorProps, EntityRefProps } from \"../../ports\";\nimport { useAssociationsStore, useAssociationsUiPorts } from \"../context\";\nimport { ExternalLinkIcon } from \"@ai-matrx/design-system/icons\";\nimport { OutboundLink } from \"@ai-matrx/kit/outbound-react\";\n\nexport interface DoorRefExtras {\n  /** Container-owned opener — wins over hrefFor when the host EntityRef is absent. */\n  onOpen?: (() => void) | undefined;\n}\n\n/**\n * Render an entity's NAME with its doors, degrading per the port table.\n * The host `EntityRef` receives the measured prop subset when bound.\n */\nexport function DoorRef(props: EntityRefProps & DoorRefExtras) {\n  const { onOpen, ...refProps } = props;\n  const { entityDoors } = useAssociationsUiPorts();\n  const store = useAssociationsStore();\n\n  const HostRef: ComponentType<EntityRefProps> | undefined =\n    entityDoors?.EntityRef;\n  if (HostRef) return <HostRef {...refProps} />;\n\n  const name = refProps.name ?? null;\n  const href =\n    store.registry.tryGetEntityInfo(refProps.token)?.hrefFor?.(refProps.id) ??\n    null;\n\n  if (onOpen) {\n    return (\n      <button\n        type=\"button\"\n        onClick={onOpen}\n        className={cn(\n          \"min-w-0 truncate text-left underline-offset-2 hover:underline\",\n          refProps.className,\n        )}\n      >\n        {name}\n      </button>\n    );\n  }\n  if (href) {\n    return (\n      <a\n        href={href}\n        target={refProps.openInNewTab === false ? undefined : \"_blank\"}\n        rel=\"noopener noreferrer\"\n        className={cn(\n          \"inline-flex min-w-0 items-center gap-1 truncate underline-offset-2 hover:underline\",\n          refProps.className,\n        )}\n      >\n        <span className=\"min-w-0 truncate\">{name}</span>\n        <ExternalLinkIcon className=\"h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-60\" />\n      </a>\n    );\n  }\n  return (\n    <span className={cn(\"min-w-0 truncate\", refProps.className)}>{name}</span>\n  );\n}\n\n/** The unresolved-target chip, host-supplied or the package's plain one. */\nexport function UnresolvedRef({ token, id }: { token: string; id: string }) {\n  const { entityDoors } = useAssociationsUiPorts();\n  const HostUnresolved = entityDoors?.UnresolvedRef;\n  if (HostUnresolved) return <HostUnresolved token={token} id={id} />;\n  return (\n    <span\n      className=\"inline-flex items-center rounded border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] text-muted-foreground\"\n      title={`This ${token} could not be read — it may be deleted or not shared with you.`}\n    >\n      Unavailable\n    </span>\n  );\n}\n\n/**\n * The door-control cluster, host-supplied or the package default. Every face\n * renders doors through THIS slot — never `entityDoors?.DoorControls` — so\n * the default reaches all of them at once.\n */\nexport function DoorControlsSlot(props: EntityDoorProps) {\n  const { entityDoors } = useAssociationsUiPorts();\n  const store = useAssociationsStore();\n\n  const HostControls = entityDoors?.DoorControls;\n  if (HostControls) return <HostControls {...props} />;\n\n  const href =\n    store.registry.tryGetEntityInfo(props.token)?.hrefFor?.(props.id) ?? null;\n  // No route registered for this token: there IS no door, so we render\n  // none. A visible control that cannot open anything is the dead-end bug.\n  if (!href) return null;\n\n  const label = props.name ? `Open ${props.name}` : `Open this ${props.token}`;\n  return (\n    <OutboundLink\n      href={href}\n      aria-label={label}\n      title={label}\n      className={cn(\n        \"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\",\n        props.className,\n      )}\n    >\n      <ExternalLinkIcon className=\"h-3 w-3\" />\n    </OutboundLink>\n  );\n}\n","// react/components/AttachedItemsSheet.tsx — @ai-matrx/associations/react\n//\n// \"What is actually attached here?\" — the drill-in behind every\n// AssociationCard count. Titles are resolved LIVE through the store's title\n// service rather than read off the association edge's stored label: the edge\n// label is a snapshot from attach time and goes stale the moment the target\n// is renamed (and many existing edges have no label at all). Ids the viewer\n// cannot read are omitted by the RPC, so they resolve through the entityDoors\n// port's `UnresolvedRef` (host access gate) — or the package's plain\n// \"unavailable\" chip when the port is absent.\n//\n// Ported from matrx-frontend\n// `features/scopes/components/associations/AttachedItemsSheet.tsx` (W4,\n// 2026-08-29) with the seams inverted: `EntityRef`/access-gate → entityDoors\n// port, `@/lib/toast` → notifier port, `fetchEntityTitles` → the store's\n// titles service, WindowPanel → the AssociationWindow shell (windowShell\n// port with fixed-overlay fallback).\n\nimport { useEffect, useState } from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\n\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport { useAssociationsStore, useNotifier } from \"../context\";\nimport type { ContainerLink } from \"../hooks/useContainerLinks\";\nimport { DefaultEntityIcon, SpinnerIcon } from \"../icons\";\nimport { PinIcon, PlusIcon, XIcon } from \"@ai-matrx/design-system/icons\";\nimport { AssociationWindow } from \"./AssociationWindow\";\nimport { DoorRef, UnresolvedRef } from \"./entityDoors\";\nimport type { PrimaryEntity } from \"./PrimaryEntityContext\";\n\nfunction metadataIsPinned(metadata: unknown): boolean {\n  return (\n    metadata !== null &&\n    typeof metadata === \"object\" &&\n    !Array.isArray(metadata) &&\n    Reflect.get(metadata, \"pinned\") === true\n  );\n}\n\nexport interface AttachedItemsSheetProps {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  token: EntityTypeToken;\n  containerLabel?: string;\n  /**\n   * The container these items are attached to. When given, the \"Attached to X\"\n   * line puts a door on X — this window can outlive the page it was opened\n   * from, so its container reference must be reachable.\n   */\n  container?: PrimaryEntity;\n  links: ContainerLink[];\n  /** Opens the attach picker. Omitted when the token cannot list candidates. */\n  onAdd?: () => void;\n  onDetach: (\n    resourceId: string,\n    role?: string | null,\n  ) => Promise<{ ok: boolean; error?: string }>;\n  /** Toggle metadata.pinned on this exact role-qualified edge. */\n  onSetPinned?: (\n    resourceId: string,\n    pinned: boolean,\n    role?: string | null,\n  ) => Promise<{ ok: boolean; error?: string }>;\n}\n\nexport function AttachedItemsSheet(props: AttachedItemsSheetProps) {\n  const store = useAssociationsStore();\n  const info = store.registry.getEntityInfo(props.token);\n  const Icon = info.Icon ?? DefaultEntityIcon;\n\n  const title = info.labelPlural;\n  const containerName = props.container?.label ?? props.containerLabel;\n  const filing = props.container?.direction === \"outgoing\";\n  const subtitle = props.container ? (\n    <span className=\"inline-flex min-w-0 max-w-full items-center gap-1\">\n      {filing ? \"What this is filed under:\" : \"Attached to\"}\n      <DoorRef\n        token={props.container.type}\n        id={props.container.id}\n        name={containerName ?? null}\n        alwaysShowActions\n      />\n    </span>\n  ) : props.containerLabel ? (\n    `Attached to ${props.containerLabel}`\n  ) : (\n    \"Attached items\"\n  );\n\n  // Gated on `open` so host window chunks only load on first use.\n  if (!props.open) return null;\n  return (\n    <AssociationWindow\n      open={props.open}\n      onClose={() => props.onOpenChange(false)}\n      scopeId={`attached:${props.token}`}\n      title={title}\n      icon={<Icon className=\"size-3.5 text-primary\" />}\n      subtitle={subtitle}\n    >\n      <AttachedItemsBody\n        token={props.token}\n        enabled={props.open}\n        links={props.links}\n        {...(props.onAdd ? { onAdd: props.onAdd } : {})}\n        onDetach={props.onDetach}\n        {...(props.onSetPinned ? { onSetPinned: props.onSetPinned } : {})}\n      />\n    </AssociationWindow>\n  );\n}\n\nfunction AttachedItemsBody({\n  token,\n  enabled,\n  links,\n  onAdd,\n  onDetach,\n  onSetPinned,\n}: {\n  token: EntityTypeToken;\n  enabled: boolean;\n  links: ContainerLink[];\n  onAdd?: () => void;\n  onDetach: (\n    resourceId: string,\n    role?: string | null,\n  ) => Promise<{ ok: boolean; error?: string }>;\n  onSetPinned?: (\n    resourceId: string,\n    pinned: boolean,\n    role?: string | null,\n  ) => Promise<{ ok: boolean; error?: string }>;\n}) {\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const info = store.registry.getEntityInfo(token);\n  const Icon = info.Icon ?? DefaultEntityIcon;\n  const [titles, setTitles] = useState<Map<string, string | null> | null>(null);\n  const [titleError, setTitleError] = useState<string | null>(null);\n  const [busyId, setBusyId] = useState<string | null>(null);\n\n  const idKey = links\n    .map((l) => l.resourceId)\n    .sort()\n    .join(\",\");\n\n  useEffect(() => {\n    if (!enabled) return;\n    const ids = idKey ? idKey.split(\",\") : [];\n    if (ids.length === 0) {\n      setTitles(new Map());\n      return;\n    }\n    let cancelled = false;\n    void (async () => {\n      try {\n        const resolved = await store.titles.fetch(token, ids);\n        if (!cancelled) {\n          setTitles(resolved);\n          setTitleError(null);\n        }\n      } catch (cause) {\n        if (cancelled) return;\n        // Loud, not silent: falling back to stored edge labels is a degraded\n        // mode and the user should know the names may be stale.\n        store.errorSink({\n          code: \"title_resolution_failed\",\n          message: \"[AttachedItemsSheet] title resolution failed\",\n          context: { token, detail: cause },\n        });\n        setTitles(new Map());\n        setTitleError(\n          cause instanceof Error ? cause.message : \"Could not resolve names\",\n        );\n      }\n    })();\n    return () => {\n      cancelled = true;\n    };\n  }, [token, idKey, enabled, store]);\n\n  const detach = async (link: ContainerLink) => {\n    const resourceId = link.resourceId;\n    if (busyId) return;\n    setBusyId(resourceId);\n    try {\n      const res = await onDetach(resourceId, link.role);\n      // A silent no-op detach reads as \"removed\" — scream instead.\n      if (!res.ok) {\n        notifier.error(`Couldn't detach${res.error ? `: ${res.error}` : \"\"}`);\n      }\n    } finally {\n      setBusyId(null);\n    }\n  };\n\n  const setPinned = async (link: ContainerLink, pinned: boolean) => {\n    if (!onSetPinned || busyId) return;\n    setBusyId(link.resourceId);\n    try {\n      const res = await onSetPinned(link.resourceId, pinned, link.role);\n      if (!res.ok) {\n        notifier.error(\n          `Couldn't ${pinned ? \"pin\" : \"unpin\"}${res.error ? `: ${res.error}` : \"\"}`,\n        );\n      }\n    } finally {\n      setBusyId(null);\n    }\n  };\n\n  return (\n    <>\n      {titleError ? (\n        <div className=\"mb-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive\">\n          Showing names recorded at attach time — they may be out of date.{\" \"}\n          {titleError}\n        </div>\n      ) : null}\n\n      <div className=\"flex-1 min-h-0 overflow-y-auto -mx-1 px-1\">\n        {links.length === 0 ? (\n          <div className=\"flex items-center justify-center py-8 text-[13px] text-muted-foreground\">\n            Nothing attached yet.\n          </div>\n        ) : titles === null ? (\n          <div className=\"flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground\">\n            <SpinnerIcon className=\"h-4 w-4 animate-spin\" />\n            Loading…\n          </div>\n        ) : (\n          <ul className=\"space-y-0.5\">\n            {links.map((link) => {\n              const resolved = titles.get(link.resourceId);\n              const missing = !titles.has(link.resourceId);\n              const name =\n                resolved ?? link.label ?? (missing ? null : \"Untitled\");\n              const busy = busyId === link.resourceId;\n              const pinned = metadataIsPinned(link.metadata);\n\n              return (\n                <li\n                  key={link.edgeId}\n                  className=\"group/entity-ref group flex items-center gap-2 rounded-md px-2.5 py-2 text-sm transition-colors hover:bg-accent\"\n                >\n                  <Icon className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n                  <span className=\"flex-1 min-w-0 truncate\">\n                    {name === null ? (\n                      // The X beside the row stays the one-click detach.\n                      <UnresolvedRef token={token} id={link.resourceId} />\n                    ) : (\n                      <DoorRef\n                        token={token}\n                        id={link.resourceId}\n                        name={name}\n                        showIcon={false}\n                        className=\"text-foreground\"\n                      />\n                    )}\n                  </span>\n                  {onSetPinned ? (\n                    <button\n                      type=\"button\"\n                      disabled={busy}\n                      onClick={() => void setPinned(link, !pinned)}\n                      title={\n                        pinned\n                          ? \"Unpin (stops staying in agent context)\"\n                          : \"Pin — always in agent context\"\n                      }\n                      aria-label={pinned ? \"Unpin\" : \"Pin\"}\n                      className={cn(\n                        \"flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50\",\n                        pinned ? \"text-primary\" : \"text-muted-foreground\",\n                      )}\n                    >\n                      <PinIcon\n                        className={cn(\n                          \"h-3.5 w-3.5\",\n                          pinned && \"fill-primary/20\",\n                        )}\n                      />\n                    </button>\n                  ) : null}\n                  <button\n                    type=\"button\"\n                    disabled={busy}\n                    onClick={() => void detach(link)}\n                    title=\"Detach\"\n                    className={cn(\n                      \"flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors\",\n                      \"hover:bg-destructive/10 hover:text-destructive disabled:opacity-50\",\n                    )}\n                  >\n                    {busy ? (\n                      <SpinnerIcon className=\"h-3.5 w-3.5 animate-spin\" />\n                    ) : (\n                      <XIcon className=\"h-3.5 w-3.5\" />\n                    )}\n                  </button>\n                </li>\n              );\n            })}\n          </ul>\n        )}\n      </div>\n\n      {onAdd ? (\n        <button\n          type=\"button\"\n          onClick={onAdd}\n          className=\"mt-2 flex w-full items-center justify-center gap-1.5 rounded-md border border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground\"\n        >\n          <PlusIcon className=\"h-4 w-4\" />\n          Attach {info.labelPlural.toLowerCase()}\n        </button>\n      ) : null}\n    </>\n  );\n}\n\nexport default AttachedItemsSheet;\n","// react/components/AssociationCard.tsx — @ai-matrx/associations/react\n//\n// THE canonical, reusable association card. Drop it on any surface that has a\n// PrimaryEntityProvider (or pass `container` explicitly) and hand it a single\n// secondary-entity TOKEN:\n//\n//   <AssociationCard token=\"task\" />\n//\n// It resolves the icon + label from the entity registry (nothing hardcoded),\n// shows a LIVE count of how many of that entity are attached to the primary\n// (container) entity, and a plus button that opens the picker. ALL logic\n// lives in hooks/services — this is pure presentation wiring over\n// `useContainerLinks` + `AssociationPicker`.\n//\n// Ported verbatim from matrx-frontend\n// `features/scopes/components/associations/AssociationCard.tsx` (W4,\n// 2026-08-29); registry module → the store registry, lucide → package\n// glyphs, the missing-container console.error → the errorSink.\n\nimport { useState } from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { PlusTapButton } from \"@ai-matrx/design-system/tap-target/buttons\";\n\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport { useAssociationsStore } from \"../context\";\nimport { containerLinksArgs, useContainerLinks } from \"../hooks/useContainerLinks\";\nimport { isAssociationTargetType } from \"../../edges\";\nimport { getContentRoleMeta } from \"../contentRoles\";\nimport { DefaultEntityIcon, SpinnerIcon } from \"../icons\";\nimport { PlusIcon } from \"@ai-matrx/design-system/icons\";\nimport { AssociationPicker } from \"./AssociationPicker\";\nimport { AttachedItemsSheet } from \"./AttachedItemsSheet\";\nimport { usePrimaryEntity, type PrimaryEntity } from \"./PrimaryEntityContext\";\n\nexport interface AssociationCardProps {\n  /** The secondary entity kind this card manages (e.g. \"task\", \"file\"). */\n  token: EntityTypeToken;\n  /** Override the page's primary entity. Defaults to PrimaryEntityProvider. */\n  container?: PrimaryEntity;\n  /**\n   * \"tiles\" (default, everywhere): the tinted icon chip, role-colored top bar,\n   * \"N attached\" line and square \"+\". Opt-in one-line looks for pages that do\n   * not want the full card: \"simplified\" (square \"+\") and \"compact\" (the\n   * outline PlusTapButton — the CRM record's look).\n   */\n  look?: AssociationCardLook;\n  className?: string;\n}\n\nexport type AssociationCardLook = \"tiles\" | \"simplified\" | \"compact\";\n\nexport function AssociationCard({\n  token,\n  container: containerProp,\n  look = \"tiles\",\n  className,\n}: AssociationCardProps) {\n  const store = useAssociationsStore();\n  const fromCtx = usePrimaryEntity();\n  const container = containerProp ?? fromCtx;\n  const [open, setOpen] = useState(false);\n\n  const info = store.registry.getEntityInfo(token);\n  const role = getContentRoleMeta(info.contentRole);\n  const Icon = info.Icon ?? DefaultEntityIcon;\n\n  const [listOpen, setListOpen] = useState(false);\n\n  const {\n    status,\n    countFor,\n    attachedIdsFor,\n    linksFor,\n    attach,\n    detach,\n    setPinned,\n  } =\n    useContainerLinks(containerLinksArgs(container));\n\n  // No container in scope → render nothing rather than guess.\n  if (!container) {\n    store.errorSink({\n      code: \"association_card_no_container\",\n      message:\n        `[AssociationCard] no primary entity for token \"${token}\" — wrap in ` +\n        `<PrimaryEntityProvider> or pass a container prop`,\n      context: { token },\n    });\n    return null;\n  }\n\n  const count = countFor(token);\n  const loading = status === \"loading\" || status === \"idle\";\n  const filing = container.direction === \"outgoing\";\n  // Filed-under mode can only file under container types.\n  const canAttach =\n    info.canListCandidates && (!filing || isAssociationTargetType(token));\n\n  // The count is only useful if you can find out WHICH ones. The card body\n  // drills into the attached list; the \"+\" stays a direct shortcut to attach.\n  const canDrillIn = count > 0;\n\n  const countWord = filing ? \"filed under\" : \"attached\";\n  const drillTitle = canDrillIn\n    ? `View the ${info.labelPlural.toLowerCase()} attached to ${container.label ?? \"this\"}`\n    : undefined;\n\n  return (\n    <>\n      {look !== \"tiles\" ? (\n        // ONE-LINE LOOKS (opt-in, off by default): small icon, UPPERCASE name,\n        // count, then the \"+\".\n        //  - \"simplified\": the classic square \"+\" (the same button the tiles\n        //    use), 6px from the card edge on every side at every width.\n        //  - \"compact\": the real PlusTapButton in its OUTLINE variant (never\n        //    glass — glass only reads over a see-through surface). Nothing\n        //    around it: no card padding on its side and no vertical padding,\n        //    so the tap target's own 44px box centers the 28px circle with\n        //    8px on every side. Never pass a layout class to a tap button —\n        //    its className lands on the ICON (the 2026-09-27 crooked \"+\").\n        <div\n          data-association-card={token}\n          data-association-card-look={look}\n          className={cn(\n            \"flex items-center gap-x-1.5 rounded-md border border-border bg-card pl-2.5\",\n            look === \"simplified\" ? \"py-1.5 pr-1.5\" : \"py-0 pr-0\",\n            className,\n          )}\n        >\n          <button\n            type=\"button\"\n            disabled={!canDrillIn}\n            onClick={() => setListOpen(true)}\n            title={drillTitle}\n            aria-label={\n              loading ? info.labelPlural : `${info.labelPlural}: ${count} ${countWord}`\n            }\n            className={cn(\n              \"flex min-h-7 min-w-0 flex-1 items-center gap-x-1.5 text-left\",\n              canDrillIn ? \"cursor-pointer hover:text-foreground\" : \"cursor-default\",\n            )}\n          >\n            <Icon className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n            <span className=\"min-w-0 truncate text-xs font-semibold uppercase tracking-wider text-foreground\">\n              {info.labelPlural}\n            </span>\n            {loading ? (\n              <SpinnerIcon className=\"h-3 w-3 animate-spin text-muted-foreground\" />\n            ) : (\n              <span className=\"text-xs tabular-nums text-muted-foreground\">{count}</span>\n            )}\n          </button>\n\n          {canAttach &&\n            (look === \"compact\" ? (\n              <PlusTapButton\n                variant=\"outline\"\n                ariaLabel={`Attach ${info.labelPlural.toLowerCase()}`}\n                // No provider requirement on hosts: the name is the aria-label.\n                tooltip={false}\n                onClick={() => setOpen(true)}\n              />\n            ) : (\n              <button\n                type=\"button\"\n                onClick={() => setOpen(true)}\n                aria-label={`Attach ${info.labelPlural.toLowerCase()}`}\n                title={`Attach ${info.labelPlural.toLowerCase()}`}\n                className=\"flex h-11 w-11 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground lg:h-7 lg:w-7\"\n              >\n                <PlusIcon className=\"h-4 w-4\" />\n              </button>\n            ))}\n        </div>\n      ) : (\n        <div\n          data-association-card={token}\n          data-association-card-look=\"tiles\"\n          className={cn(\n            \"group relative flex items-center gap-3 overflow-hidden rounded-xl border border-border bg-card transition-all hover:border-primary/30 hover:bg-accent/40\",\n            className,\n          )}\n        >\n          {/* role accent bar — same categorical language as the resource tiles */}\n          <span\n            className={cn(\n              \"absolute inset-x-0 top-0 h-0.5 opacity-60\",\n              role.accentBar,\n            )}\n          />\n\n          <button\n            type=\"button\"\n            disabled={!canDrillIn}\n            onClick={() => setListOpen(true)}\n            title={drillTitle}\n            className={cn(\n              \"flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left\",\n              canDrillIn ? \"cursor-pointer\" : \"cursor-default\",\n            )}\n          >\n            <span\n              className={cn(\n                \"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg\",\n                role.accentBg,\n                role.accentText,\n              )}\n            >\n              <Icon className=\"h-4 w-4\" />\n            </span>\n\n            <span className=\"min-w-0 flex-1\">\n              <span className=\"block truncate text-sm font-medium text-foreground\">\n                {info.labelPlural}\n              </span>\n              <span className=\"block text-xs text-muted-foreground tabular-nums\">\n                {loading ? (\n                  <span className=\"inline-flex items-center gap-1\">\n                    <SpinnerIcon className=\"h-3 w-3 animate-spin\" />\n                    Loading…\n                  </span>\n                ) : (\n                  `${count} ${countWord}`\n                )}\n              </span>\n            </span>\n          </button>\n\n          {canAttach && (\n            <button\n              type=\"button\"\n              onClick={() => setOpen(true)}\n              aria-label={`Attach ${info.labelPlural.toLowerCase()}`}\n              title={`Attach ${info.labelPlural.toLowerCase()}`}\n              className=\"mr-2 flex h-11 w-11 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground lg:mr-3 lg:h-7 lg:w-7\"\n            >\n              <PlusIcon className=\"h-4 w-4\" />\n            </button>\n          )}\n        </div>\n      )}\n\n      {/* Mount while open (not while canDrillIn) — detaching the last item\n          must leave the surface up showing \"Nothing attached yet\", never\n          yank the window out from under the user. */}\n      {listOpen && (\n        <AttachedItemsSheet\n          open={listOpen}\n          onOpenChange={setListOpen}\n          token={token}\n          {...(container.label !== undefined\n            ? { containerLabel: container.label }\n            : {})}\n          container={container}\n          links={linksFor(token)}\n          {...(canAttach\n            ? {\n                onAdd: () => {\n                  setListOpen(false);\n                  setOpen(true);\n                },\n              }\n            : {})}\n          onDetach={(resourceId, role) =>\n            detach(token, resourceId, role ?? undefined)\n          }\n          onSetPinned={(resourceId, pinned, role) =>\n            setPinned(token, resourceId, pinned, role ?? undefined)\n          }\n        />\n      )}\n\n      {canAttach && (\n        <AssociationPicker\n          open={open}\n          onOpenChange={setOpen}\n          token={token}\n          {...(container.label !== undefined\n            ? { containerLabel: container.label }\n            : {})}\n          orgId={container.orgId ?? null}\n          {...(filing ? { filing: true } : {})}\n          attachedIds={attachedIdsFor(token)}\n          // the picked title is never stored as the edge label (see useContainerLinksAdapter)\n          onAttach={(resourceId) => attach(token, resourceId)}\n          onDetach={(resourceId) => detach(token, resourceId)}\n        />\n      )}\n    </>\n  );\n}\n\nexport default AssociationCard;\n","// react/contentRoles.ts — @ai-matrx/associations/react\n//\n// Display metadata for the content-role buckets — ported verbatim from\n// matrx-frontend `features/scopes/registry/entityRegistry.ts` (W4,\n// 2026-08-29). The ROLE ids and the per-entity classification live in /core\n// (`platform.entity_types.content_role` is the only authority); titles,\n// taglines, and the categorical accent classes are chrome, so they live in\n// /react. ONE visual language for \"what kind of thing is this\" across every\n// association surface.\n\nimport type { ContentRole } from \"../core/registry\";\n\nexport interface ContentRoleMeta {\n  id: ContentRole;\n  /** Section heading. */\n  title: string;\n  /** One-line \"what is this bucket\". */\n  tagline: string;\n  /** Categorical accent classes (tint only — surfaces stay semantic). */\n  accentText: string;\n  accentBg: string;\n  accentBar: string;\n}\n\n/** Ordered for display: capability, data-in, data-out, both, structure. */\nexport const CONTENT_ROLES: ContentRoleMeta[] = [\n  {\n    id: \"utility\",\n    title: \"Utilities\",\n    tagline: \"The agents and tools that act on your knowledge.\",\n    accentText: \"text-violet-600 dark:text-violet-400\",\n    accentBg: \"bg-violet-500/10\",\n    accentBar: \"bg-violet-500\",\n  },\n  {\n    id: \"source\",\n    title: \"Sources\",\n    tagline: \"Incoming sources of truth (Knowledge In).\",\n    accentText: \"text-sky-600 dark:text-sky-400\",\n    accentBg: \"bg-sky-500/10\",\n    accentBar: \"bg-sky-500\",\n  },\n  {\n    id: \"destination\",\n    title: \"Outputs\",\n    tagline: \"Knowledge your team produces.\",\n    accentText: \"text-emerald-600 dark:text-emerald-400\",\n    accentBg: \"bg-emerald-500/10\",\n    accentBar: \"bg-emerald-500\",\n  },\n  {\n    id: \"hybrid\",\n    title: \"Sources & Outputs\",\n    tagline: \"Read from and written to.\",\n    accentText: \"text-teal-600 dark:text-teal-400\",\n    accentBg: \"bg-teal-500/10\",\n    accentBar: \"bg-gradient-to-r from-sky-500 to-emerald-500\",\n  },\n  {\n    id: \"container\",\n    title: \"Workspaces\",\n    tagline: \"How work is organized.\",\n    accentText: \"text-amber-600 dark:text-amber-400\",\n    accentBg: \"bg-amber-500/10\",\n    accentBar: \"bg-amber-500\",\n  },\n];\n\nexport function getContentRoleMeta(role: ContentRole): ContentRoleMeta {\n  return (\n    CONTENT_ROLES.find((r) => r.id === role) ?? (CONTENT_ROLES[2] as ContentRoleMeta)\n  );\n}\n","// react/components/AssociationCardGrid.tsx — @ai-matrx/associations/react\n//\n// THE canonical \"everything attached to this container\" surface. Columns follow\n// the grid's OWN width (container queries), so it reads the same in a 360px\n// side rail as on a full page. Drop it under\n// a PrimaryEntityProvider and it renders one AssociationCard per cardable\n// entity token — fully registry-driven, ZERO per-page hardcoding:\n//\n//   <PrimaryEntityProvider value={{ type: \"organization\", id, orgId, label }}>\n//     <AssociationCardGrid />\n//   </PrimaryEntityProvider>\n//\n// By default it lists EVERY token the registry can list candidates for (the\n// `curatedTokens()` set), GROUPED BY CONTENT ROLE with the same categorical\n// accent colors every association surface uses. Every card shares ONE\n// association fetch for the container (the store cache dedupes), so the whole\n// grid is a single round-trip.\n//\n// Ported verbatim from matrx-frontend\n// `features/scopes/components/associations/AssociationCardGrid.tsx` (W4,\n// 2026-08-29); registry module → the store registry.\n\nimport { cn } from \"@ai-matrx/design-system\";\n\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport { useAssociationsStore } from \"../context\";\nimport { CONTENT_ROLES } from \"../contentRoles\";\nimport { AssociationCard, type AssociationCardLook } from \"./AssociationCard\";\nimport { usePrimaryEntity } from \"./PrimaryEntityContext\";\nimport { isAssociationTargetType } from \"../../edges\";\nimport { isEntityTypeToken } from \"../../entity-types.generated\";\nimport { containerLinksArgs, useContainerLinks } from \"../hooks/useContainerLinks\";\n\nexport interface AssociationCardGridProps {\n  /** Tokens to show. Defaults to every registry-listable token. */\n  tokens?: EntityTypeToken[];\n  /** Registry tokens this surface cannot honestly support yet. */\n  excludeTokens?: EntityTypeToken[];\n  /**\n   * \"tiles\" (default, everywhere): each group has a colored dot, its title and\n   * a one-line description; cards sit in a 1/2/3-column grid. Opt-in\n   * \"simplified\" / \"compact\": an uppercase eyebrow over wrapping one-line\n   * cards (see AssociationCard for the two \"+\" buttons).\n   */\n  look?: AssociationCardLook;\n  className?: string;\n}\n\n/** Simplified look: a group's name is a quiet eyebrow over its tiles. */\nconst SIMPLE_GROUP_LABEL = \"mb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground\";\nconst SIMPLE_TILE_ROW = \"flex flex-wrap gap-2 [&>*]:min-w-[16rem] [&>*]:flex-1\";\nconst TILE_GRID = \"grid grid-cols-1 gap-2 @md:grid-cols-2 @3xl:grid-cols-3\";\n\nfunction GroupHeader({\n  look,\n  title,\n  dotClassName,\n}: {\n  look: AssociationCardLook;\n  title: string;\n  dotClassName?: string;\n}) {\n  if (look !== \"tiles\") return <h3 className={SIMPLE_GROUP_LABEL}>{title}</h3>;\n  return (\n    <div className=\"mb-2.5 flex items-baseline gap-3 pl-1.5\">\n      {dotClassName ? (\n        <div className=\"flex items-center gap-2\">\n          <span className={cn(\"h-2.5 w-2.5 rounded-full\", dotClassName)} />\n          <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n        </div>\n      ) : (\n        <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n      )}\n    </div>\n  );\n}\n\nexport function AssociationCardGrid({\n  tokens,\n  excludeTokens,\n  look = \"tiles\",\n  className,\n}: AssociationCardGridProps) {\n  const store = useAssociationsStore();\n  const primary = usePrimaryEntity();\n  const excluded = new Set(excludeTokens ?? []);\n  // Filed-under mode: only container types can be filed under.\n  const filing = primary?.direction === \"outgoing\";\n  // Filed-under mode also shows every container the primary IS filed under,\n  // whatever the curated set says (a Source's Libraries, research topics,\n  // sites carry no content role and are not \"listed\", yet that is exactly\n  // where Sources live). One shared, deduped fetch with the cards.\n  const links = useContainerLinks(containerLinksArgs(primary));\n  const base = tokens ?? store.registry.curatedTokens();\n  const withPresent = filing\n    ? [\n        ...base,\n        ...links.presentTokens.filter(\n          (t): t is EntityTypeToken =>\n            isEntityTypeToken(t) && !base.includes(t as EntityTypeToken),\n        ),\n      ]\n    : base;\n  const list = withPresent.filter(\n    (token) =>\n      !excluded.has(token) && (!filing || isAssociationTargetType(token)),\n  );\n  const roleIds = new Set(CONTENT_ROLES.map((r) => r.id as string));\n  const roleless = filing\n    ? list.filter((token) => {\n        const role = store.registry.getEntityInfo(token).contentRole;\n        return !role || !roleIds.has(role);\n      })\n    : [];\n  const rowClass = look !== \"tiles\" ? SIMPLE_TILE_ROW : TILE_GRID;\n\n  return (\n    <div\n      data-association-grid-look={look}\n      className={cn(\"@container\", look !== \"tiles\" ? \"space-y-3\" : \"space-y-5\", className)}\n    >\n      {CONTENT_ROLES.map((role) => {\n        const inRole = list.filter(\n          (token) => store.registry.getEntityInfo(token).contentRole === role.id,\n        );\n        if (inRole.length === 0) return null;\n\n        return (\n          <section key={role.id}>\n            <GroupHeader\n              look={look}\n              title={role.title}\n              dotClassName={role.accentBar}\n            />\n            <div className={rowClass}>\n              {inRole.map((token) => (\n                <AssociationCard key={token} token={token} look={look} />\n              ))}\n            </div>\n          </section>\n        );\n      })}\n      {roleless.length > 0 && (\n        <section>\n          <GroupHeader\n            look={look}\n            title=\"Filed under\"\n          />\n          <div className={rowClass}>\n            {roleless.map((token) => (\n              <AssociationCard key={token} token={token} look={look} />\n            ))}\n          </div>\n        </section>\n      )}\n    </div>\n  );\n}\n\nexport default AssociationCardGrid;\n","// react/components/AssociationList.tsx — @ai-matrx/associations/react\n//\n// THE row-mode face of the container-contents system — the sibling of\n// `AssociationCardGrid` (count cards). Drop it under a `PrimaryEntityProvider`\n// (or pass `container`) and it renders EVERYTHING attached to the container as\n// grouped rows — content-role sections → token groups → title rows with open +\n// detach — plus a universal search-attach header and a per-token \"+\" picker.\n//\n// Fully registry-driven and ADAPTER-PLUGGABLE: reads/writes default to\n// `useContainerLinks` (org/scope/project pages), but a container with its own\n// write semantics (war-room threads: single-active demotion, position, host\n// bucket) supplies a `ContainerResourcesAdapter` and the UI stays identical.\n//\n// Titles are never UUIDs: edge label → batched title fetch → \"Untitled <type>\".\n//\n// Ported from matrx-frontend\n// `features/scopes/components/associations/AssociationList.tsx` (W4,\n// 2026-08-29) with the seams inverted: `EntityRef` → the entityDoors port\n// (degrading to hrefFor anchor / plain text), registry module → the store\n// registry, host Skeleton → design-system Skeleton, lucide → package glyphs.\n\nimport { useState, type ReactNode } from \"react\";\nimport { cn, Skeleton } from \"@ai-matrx/design-system\";\n\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport type { ContentRole, EntityInfo } from \"../../core/registry\";\nimport { useAssociationsStore, useNotifier } from \"../context\";\nimport { containerLinksArgs, useContainerLinks } from \"../hooks/useContainerLinks\";\nimport { useEntityTitles } from \"../hooks/useEntityTitles\";\nimport { CONTENT_ROLES, getContentRoleMeta } from \"../contentRoles\";\nimport { Link2Icon, RefreshIcon, SpinnerIcon } from \"../icons\";\nimport { PinIcon, PlusIcon, XIcon } from \"@ai-matrx/design-system/icons\";\nimport { AssociationPicker } from \"./AssociationPicker\";\nimport { DoorRef, UnresolvedRef } from \"./entityDoors\";\nimport {\n  UniversalAssociationPicker,\n  attachedKey,\n} from \"./UniversalAssociationPicker\";\nimport { usePrimaryEntity, type PrimaryEntity } from \"./PrimaryEntityContext\";\nimport { openOutbound } from \"@ai-matrx/kit/outbound\";\n\n// ─── Adapter contract ────────────────────────────────────────────────────────\n\n/** One attached resource, as the list renders it. Tokens are CANONICAL. */\nexport interface ContainerResourceRow {\n  /** Stable row key (edge id or `${token}:${id}`). */\n  key: string;\n  token: string;\n  resourceId: string;\n  label: string | null;\n  /** Exact semantic edge role; null means the canonical role-less edge. */\n  role?: string | null;\n  /** Pinned rows sort first inside their token group. */\n  pinned?: boolean;\n  /** False for inherited rows (e.g. via a thread's anchor) — no detach. */\n  removable: boolean;\n  /** Small annotation for non-removable rows (\"via anchor\"). */\n  originNote?: string | null;\n  /** Resolvable records that contributed an inherited row. */\n  originRefs?: readonly {\n    token: EntityTypeToken;\n    id: string;\n    label: string;\n  }[];\n}\n\nexport interface ContainerResourcesAdapter {\n  status: \"idle\" | \"loading\" | \"ready\" | \"error\";\n  error: string | null;\n  reload: () => void | Promise<void>;\n  rows: ContainerResourceRow[];\n  attach: (\n    token: EntityTypeToken,\n    resourceId: string,\n    title?: string,\n    /**\n     * Extra edge metadata stamped at attach time (label-at-attach-time's\n     * sibling contract). Adapters without metadata support may ignore it.\n     */\n    opts?: { metadata?: Record<string, unknown> | null },\n  ) => Promise<{ ok: boolean; error?: string }>;\n  detach: (\n    token: EntityTypeToken,\n    resourceId: string,\n    role?: string,\n  ) => Promise<{ ok: boolean; error?: string }>;\n  /**\n   * Optional pin capability (edge `metadata.pinned`) — pinned resources stay\n   * inline in agent context at every tier. Rows show a pin toggle when set.\n   */\n  setPinned?: (\n    token: EntityTypeToken,\n    resourceId: string,\n    pinned: boolean,\n    role?: string,\n  ) => Promise<{ ok: boolean; error?: string }>;\n}\n\nfunction metadataIsPinned(metadata: unknown): boolean {\n  return (\n    metadata !== null &&\n    typeof metadata === \"object\" &&\n    !Array.isArray(metadata) &&\n    Reflect.get(metadata, \"pinned\") === true\n  );\n}\n\n/** Default adapter — wraps `useContainerLinks` (org/scope/project pages). */\nexport function useContainerLinksAdapter(\n  container: PrimaryEntity | null,\n  tokens?: readonly EntityTypeToken[],\n): ContainerResourcesAdapter {\n  const store = useAssociationsStore();\n  const links = useContainerLinks(containerLinksArgs(container));\n  const rows: ContainerResourceRow[] = container\n    ? (tokens ?? store.registry.curatedTokens()).flatMap((token) =>\n        links.linksFor(token).map((l) => ({\n          key: l.edgeId,\n          token: l.token,\n          resourceId: l.resourceId,\n          label: l.label,\n          role: l.role,\n          pinned: metadataIsPinned(l.metadata),\n          removable: true,\n        })),\n      )\n    : [];\n  return {\n    status: links.status,\n    error: links.error,\n    reload: links.reload,\n    rows,\n    // The picker's `title` is the PICKED record's name. An edge is read from\n    // both ends, so storing it froze one side's name onto the other (a topic\n    // linked to brand \"X\" listed on X as \"X\"). Never stored; each side's title\n    // comes from the title resolver. A deliberate label goes through\n    // `useContainerLinks().attach(token, id, label)` directly.\n    attach: async (token, id) => links.attach(token, id),\n    detach: async (token, id, role) => links.detach(token, id, role),\n    setPinned: async (token, id, pinned, role) =>\n      links.setPinned(token, id, pinned, role),\n  };\n}\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\nexport interface AssociationListProps {\n  /** Container override; defaults to the surrounding PrimaryEntityProvider. */\n  container?: PrimaryEntity;\n  /** Write/read override (war-room threads etc.). Default: useContainerLinks. */\n  adapter?: ContainerResourcesAdapter;\n  /** Restrict display + attach to these tokens (e.g. one dynamic tab). */\n  tokens?: EntityTypeToken[];\n  /** `full` = role sections + universal search; `compact` = flat token groups. */\n  variant?: \"full\" | \"compact\";\n  /** Extra per-token actions (e.g. war-room Upload / New document). */\n  renderSectionActions?: (token: EntityTypeToken) => ReactNode;\n  /** Open a resource. Default: registry `hrefFor` in a new tab. */\n  openEntity?: (token: string, id: string) => void;\n  /**\n   * Per-token row override (return null/undefined to keep the default row) —\n   * for rows that need richer rendering than icon+title. The override owns the\n   * whole row; use `ctx` for the resolved title and the busy/detach/open\n   * wiring.\n   */\n  renderRow?: (\n    row: ContainerResourceRow,\n    ctx: {\n      title: string;\n      busy: boolean;\n      onDetach: () => void;\n      onOpen: () => void;\n    },\n  ) => ReactNode | null | undefined;\n  /**\n   * The list's own heading. Default \"Resources\". `null` when the host card already titles the list:\n   * the count and the attach controls stay, right-aligned.\n   */\n  title?: string | null;\n  className?: string;\n}\n\nexport function AssociationList(props: AssociationListProps) {\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const ctxEntity = usePrimaryEntity();\n  const container = props.container ?? ctxEntity ?? null;\n  const defaultAdapter = useContainerLinksAdapter(\n    props.adapter ? null : container,\n    props.tokens,\n  );\n  const adapter = props.adapter ?? defaultAdapter;\n  const variant = props.variant ?? \"full\";\n  const tokenFilter = props.tokens ?? null;\n\n  const [pickerToken, setPickerToken] = useState<EntityTypeToken | null>(null);\n  const [showUniversal, setShowUniversal] = useState(false);\n  const [removingKeys, setRemovingKeys] = useState<Set<string>>(new Set());\n  const [pinningKeys, setPinningKeys] = useState<Set<string>>(new Set());\n\n  const rows = tokenFilter\n    ? adapter.rows.filter((r) => (tokenFilter as string[]).includes(r.token))\n    : adapter.rows;\n  const visibleRows = rows.filter((r) => !removingKeys.has(r.key));\n\n  // `isUnresolved` is the loud half of the title resolver: a row whose record could not be read\n  // (deleted, or not shared with this viewer) renders the honest UnresolvedRef chip — never an\n  // \"Untitled <type>\" door that opens nothing (no-dead-ends door law; AttachedItemsSheet does the same).\n  const { titleFor, isUnresolved } = useEntityTitles(\n    visibleRows.map((r) => ({\n      token: r.token,\n      id: r.resourceId,\n      label: r.label,\n    })),\n  );\n\n  const attachedKeys = new Set(\n    rows.map((r) => attachedKey(r.token, r.resourceId)),\n  );\n\n  const handleDetach = async (row: ContainerResourceRow) => {\n    setRemovingKeys((prev) => new Set(prev).add(row.key));\n    const info = store.registry.tryGetEntityInfo(row.token);\n    const res = info\n      ? await adapter.detach(info.token, row.resourceId, row.role ?? undefined)\n      : { ok: false };\n    setRemovingKeys((prev) => {\n      const next = new Set(prev);\n      next.delete(row.key);\n      return next;\n    });\n    return res;\n  };\n\n  const handlePin = async (row: ContainerResourceRow, pinned: boolean) => {\n    if (!adapter.setPinned) return;\n    const info = store.registry.tryGetEntityInfo(row.token);\n    if (!info) return;\n    setPinningKeys((prev) => new Set(prev).add(row.key));\n    try {\n      const res = await adapter.setPinned(\n        info.token,\n        row.resourceId,\n        pinned,\n        row.role ?? undefined,\n      );\n      if (!res.ok) {\n        notifier.error(\n          `Couldn't ${pinned ? \"pin\" : \"unpin\"} resource${res.error ? `: ${res.error}` : \"\"}`,\n        );\n      }\n    } finally {\n      setPinningKeys((prev) => {\n        const next = new Set(prev);\n        next.delete(row.key);\n        return next;\n      });\n    }\n  };\n\n  const openRow = (row: ContainerResourceRow) => {\n    if (props.openEntity) {\n      props.openEntity(row.token, row.resourceId);\n      return;\n    }\n    const info = store.registry.tryGetEntityInfo(row.token);\n    const href = info?.hrefFor?.(row.resourceId);\n    if (href && typeof window !== \"undefined\") {\n      openOutbound(href, \"_blank\", \"noopener\");\n    }\n  };\n\n  // role → token → rows, in registry role order.\n  const grouped = groupRows(store, visibleRows);\n  const isLoading = adapter.status === \"loading\" || adapter.status === \"idle\";\n  const attachableTokens = tokenFilter ?? store.registry.listableTokens();\n\n  return (\n    <div className={cn(\"flex flex-col gap-2 text-foreground\", props.className)}>\n      {/* ── header: count + universal attach ─────────────────────────── */}\n      <div className={cn(\"flex items-center gap-2 px-1\", props.title === null ? \"justify-end\" : \"justify-between\")}>\n        {props.title === null ? null : (\n          <h3 className=\"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground\">\n            <Link2Icon className=\"h-3.5 w-3.5\" />\n            {props.title ?? \"Resources\"}\n            {visibleRows.length > 0 && (\n              <span className=\"rounded bg-muted px-1 text-[10px] font-medium text-muted-foreground\">\n                {visibleRows.length}\n              </span>\n            )}\n          </h3>\n        )}\n        <div className=\"flex items-center gap-1.5\">\n          <button\n            type=\"button\"\n            onClick={() => setShowUniversal((v) => !v)}\n            className={cn(\n              \"inline-flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] transition-colors\",\n              showUniversal\n                ? \"bg-accent text-foreground\"\n                : \"text-muted-foreground hover:bg-accent hover:text-foreground\",\n            )}\n          >\n            <PlusIcon className=\"h-3 w-3\" />\n            Add\n          </button>\n          <button\n            type=\"button\"\n            onClick={() => void adapter.reload()}\n            title=\"Refresh\"\n            className=\"text-muted-foreground/60 transition-colors hover:text-foreground\"\n          >\n            <RefreshIcon\n              className={cn(\n                \"h-3 w-3\",\n                adapter.status === \"loading\" && \"animate-spin\",\n              )}\n            />\n          </button>\n        </div>\n      </div>\n\n      {/* ── universal search-attach ──────────────────────────────────── */}\n      {showUniversal && (\n        <div className=\"rounded-md border border-border/60 bg-muted/30 p-2 max-h-80 flex flex-col\">\n          <UniversalAssociationPicker\n            tokens={attachableTokens}\n            orgId={container?.orgId ?? null}\n            attachedKeys={attachedKeys}\n            onAttach={(token, id, title) => adapter.attach(token, id, title)}\n            onDetach={(token, id) => adapter.detach(token, id)}\n          />\n        </div>\n      )}\n\n      {/* ── error / loading / empty ──────────────────────────────────── */}\n      {adapter.status === \"error\" && (\n        <div className=\"flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-2.5 py-2\">\n          <span className=\"truncate text-[11px] text-destructive\">\n            {adapter.error || \"Failed to load resources\"}\n          </span>\n          <button\n            type=\"button\"\n            onClick={() => void adapter.reload()}\n            className=\"text-[11px] font-medium text-destructive underline hover:no-underline\"\n          >\n            Retry\n          </button>\n        </div>\n      )}\n      {adapter.status !== \"error\" && isLoading && visibleRows.length === 0 && (\n        <div className=\"space-y-1.5 px-1\">\n          <Skeleton className=\"h-3 w-20\" />\n          <Skeleton className=\"h-7 w-full rounded-md\" />\n          <Skeleton className=\"h-7 w-3/4 rounded-md\" />\n        </div>\n      )}\n      {adapter.status === \"ready\" && visibleRows.length === 0 && (\n        <p className=\"px-1 py-1 text-[11px] text-muted-foreground\">\n          Nothing attached yet — use Add to link anything.\n        </p>\n      )}\n\n      {/* ── grouped rows ─────────────────────────────────────────────── */}\n      {visibleRows.length > 0 && (\n        <div className=\"space-y-2.5\">\n          {grouped.map(({ role, tokens: tokenGroups }) => {\n            const roleMeta = getContentRoleMeta(role);\n            return (\n              <div key={role} className=\"space-y-1.5\">\n                {variant === \"full\" && (\n                  <div className=\"flex items-center gap-1.5 px-1\">\n                    <span\n                      className={cn(\n                        \"h-3 w-0.5 rounded-full\",\n                        roleMeta.accentBar,\n                      )}\n                    />\n                    <p\n                      className={cn(\n                        \"text-[10px] font-semibold uppercase tracking-wider\",\n                        roleMeta.accentText,\n                      )}\n                    >\n                      {roleMeta.title}\n                    </p>\n                  </div>\n                )}\n                {tokenGroups.map(({ info, token, rows: tokenRows }) => {\n                  const TokenIcon = info?.Icon ?? null;\n                  return (\n                    <div key={token} className=\"space-y-0.5\">\n                      <div className=\"flex items-center justify-between gap-1 px-1\">\n                        <p className=\"flex items-center gap-1 text-[10px] font-medium text-muted-foreground/80\">\n                          {TokenIcon ? <TokenIcon className=\"h-3 w-3\" /> : null}\n                          {info?.labelPlural ?? titleize(token)}\n                          <span className=\"text-muted-foreground/50\">\n                            {tokenRows.length}\n                          </span>\n                        </p>\n                        <div className=\"flex items-center gap-1\">\n                          {props.renderSectionActions && info\n                            ? props.renderSectionActions(info.token)\n                            : null}\n                          {info?.canListCandidates && (\n                            <button\n                              type=\"button\"\n                              onClick={() => setPickerToken(info.token)}\n                              title={`Add ${info.labelPlural}`}\n                              className=\"rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground\"\n                            >\n                              <PlusIcon className=\"h-3 w-3\" />\n                            </button>\n                          )}\n                        </div>\n                      </div>\n                      <ul className=\"space-y-0.5\">\n                        {tokenRows.map((row) => {\n                          const busy = removingKeys.has(row.key);\n                          const custom = props.renderRow?.(row, {\n                            title: titleFor({\n                              token: row.token,\n                              id: row.resourceId,\n                              label: row.label,\n                            }),\n                            busy,\n                            onDetach: () => void handleDetach(row),\n                            onOpen: () => openRow(row),\n                          });\n                          if (custom != null) {\n                            return <li key={row.key}>{custom}</li>;\n                          }\n                          return (\n                            <li key={row.key}>\n                              <div\n                                className={cn(\n                                  \"group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-accent\",\n                                  busy && \"opacity-50\",\n                                )}\n                              >\n                                {/* THE DOOR LAW via the doors seam: the\n                                    container's `openEntity` wins when it has\n                                    one; otherwise the host EntityRef (or the\n                                    degraded hrefFor anchor) carries the\n                                    new-tab door. A row with neither renders\n                                    as plain text, so a link-styled title can\n                                    never no-op. */}\n                                {isUnresolved({\n                                  token: row.token,\n                                  id: row.resourceId,\n                                  label: row.label,\n                                }) ? (\n                                  <span className=\"min-w-0 flex-1\">\n                                    <UnresolvedRef token={row.token} id={row.resourceId} />\n                                  </span>\n                                ) : (\n                                  <DoorRef\n                                    token={row.token}\n                                    id={row.resourceId}\n                                    name={titleFor({\n                                      token: row.token,\n                                      id: row.resourceId,\n                                      label: row.label,\n                                    })}\n                                    showIcon={Boolean(TokenIcon)}\n                                    onOpen={\n                                      props.openEntity\n                                        ? () => openRow(row)\n                                        : undefined\n                                    }\n                                    openInNewTab={!props.openEntity}\n                                    className=\"min-w-0 flex-1 text-foreground\"\n                                  />\n                                )}\n                                {row.originRefs && row.originRefs.length > 0 ? (\n                                  <span className=\"flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground/60\">\n                                    via\n                                    {row.originRefs.map((origin) => (\n                                      <DoorRef\n                                        key={`${origin.token}:${origin.id}`}\n                                        token={origin.token}\n                                        id={origin.id}\n                                        name={origin.label}\n                                        showIcon={false}\n                                        openInNewTab\n                                        className=\"max-w-24 text-[10px] text-muted-foreground underline-offset-2\"\n                                      />\n                                    ))}\n                                  </span>\n                                ) : row.originNote ? (\n                                  <span className=\"shrink-0 text-[10px] text-muted-foreground/60\">\n                                    {row.originNote}\n                                  </span>\n                                ) : null}\n                                {adapter.setPinned && info && row.removable && (\n                                  <button\n                                    type=\"button\"\n                                    disabled={pinningKeys.has(row.key)}\n                                    onClick={() =>\n                                      void handlePin(row, !(row.pinned ?? false))\n                                    }\n                                    title={\n                                      row.pinned\n                                        ? \"Unpin (stops staying in agent context)\"\n                                        : \"Pin — always in agent context\"\n                                    }\n                                    aria-label={row.pinned ? \"Unpin\" : \"Pin\"}\n                                    className={cn(\n                                      \"shrink-0 rounded p-0.5 transition-colors hover:!text-foreground\",\n                                      row.pinned\n                                        ? \"text-primary\"\n                                        : \"text-muted-foreground/0 group-hover:text-muted-foreground\",\n                                    )}\n                                  >\n                                    {pinningKeys.has(row.key) ? (\n                                      <SpinnerIcon className=\"h-3 w-3 animate-spin\" />\n                                    ) : (\n                                      <PinIcon\n                                        className={cn(\n                                          \"h-3 w-3\",\n                                          row.pinned && \"fill-primary/20\",\n                                        )}\n                                      />\n                                    )}\n                                  </button>\n                                )}\n                                {row.removable && (\n                                  <button\n                                    type=\"button\"\n                                    disabled={busy}\n                                    onClick={() => void handleDetach(row)}\n                                    title=\"Detach\"\n                                    aria-label=\"Detach\"\n                                    className=\"shrink-0 rounded p-0.5 text-muted-foreground/0 transition-colors group-hover:text-muted-foreground hover:!text-destructive disabled:opacity-50\"\n                                  >\n                                    {busy ? (\n                                      <SpinnerIcon className=\"h-3 w-3 animate-spin\" />\n                                    ) : (\n                                      <XIcon className=\"h-3 w-3\" />\n                                    )}\n                                  </button>\n                                )}\n                              </div>\n                            </li>\n                          );\n                        })}\n                      </ul>\n                    </div>\n                  );\n                })}\n              </div>\n            );\n          })}\n        </div>\n      )}\n\n      {/* ── per-token picker sheet ───────────────────────────────────── */}\n      {pickerToken && (\n        <AssociationPicker\n          open\n          onOpenChange={(open) => {\n            if (!open) setPickerToken(null);\n          }}\n          token={pickerToken}\n          {...(container?.label !== undefined\n            ? { containerLabel: container.label }\n            : {})}\n          orgId={container?.orgId ?? null}\n          attachedIds={\n            new Set(\n              rows\n                .filter((r) => r.token === pickerToken)\n                .map((r) => r.resourceId),\n            )\n          }\n          onAttach={(id, title) => adapter.attach(pickerToken, id, title)}\n          onDetach={(id) => adapter.detach(pickerToken, id)}\n        />\n      )}\n    </div>\n  );\n}\n\n// ─── helpers ─────────────────────────────────────────────────────────────────\n\ninterface TokenGroup {\n  token: string;\n  info: EntityInfo | null;\n  rows: ContainerResourceRow[];\n}\ninterface RoleGroup {\n  role: ContentRole;\n  tokens: TokenGroup[];\n}\n\n/** role → token → rows; pinned rows first inside a token group. */\nfunction groupRows(\n  store: { registry: { tryGetEntityInfo(token: string): EntityInfo | null } },\n  rows: ContainerResourceRow[],\n): RoleGroup[] {\n  const byToken = new Map<string, ContainerResourceRow[]>();\n  for (const r of rows) {\n    const list = byToken.get(r.token) ?? [];\n    list.push(r);\n    byToken.set(r.token, list);\n  }\n  const roleBuckets = new Map<ContentRole, TokenGroup[]>();\n  for (const [token, tokenRows] of byToken) {\n    const info = store.registry.tryGetEntityInfo(token);\n    const role: ContentRole = info?.contentRole ?? \"destination\";\n    tokenRows.sort(\n      (a, b) => Number(b.pinned ?? false) - Number(a.pinned ?? false),\n    );\n    const groups = roleBuckets.get(role) ?? [];\n    groups.push({ token, info, rows: tokenRows });\n    roleBuckets.set(role, groups);\n  }\n  const out: RoleGroup[] = [];\n  for (const meta of CONTENT_ROLES) {\n    const tokens = roleBuckets.get(meta.id);\n    if (tokens && tokens.length > 0) {\n      tokens.sort((a, b) =>\n        (a.info?.labelPlural ?? a.token).localeCompare(\n          b.info?.labelPlural ?? b.token,\n        ),\n      );\n      out.push({ role: meta.id, tokens });\n    }\n  }\n  return out;\n}\n\nfunction titleize(token: string): string {\n  return token\n    .split(\"_\")\n    .map((w) => (w ? (w[0] as string).toUpperCase() + w.slice(1) : w))\n    .join(\" \");\n}\n\nexport default AssociationList;\n","// react/components/AssociationCaptureToolbar.tsx — @ai-matrx/associations/react\n//\n// THE shared capture toolbar for any container's association surface — the\n// upload / add-existing / create toolbar plus whole-body drag-and-drop.\n// Callback-pure and registry-driven: the host supplies ONE `attach` callback\n// (canonical tokens only — `file`, `udt_document`) and this component owns\n// the gesture end-to-end under the CREATE-then-ASSOCIATE contract: the\n// durable row is created FIRST through the host capture handlers, the edge\n// is written SECOND via the host's callback, and EVERY terminal outcome is\n// loud — a created-but-unlinked item is reported WITH its location, never\n// silently orphaned.\n//\n// Ported from matrx-frontend\n// `features/scopes/components/associations/AssociationCaptureToolbar.tsx`\n// (W4, 2026-08-29) with the measured seams inverted onto the CAPTURE port\n// (design Decision 2, per-handler optional — NEVER dead buttons):\n//\n//   • `requestUpload` (files feature) → `capture.requestUpload` — the Upload\n//     chip and body drag-and-drop render when it is bound, OR when the host\n//     bound only the one-file primitive `capture.uploadFile`: since 0.6.0\n//     (C23) the package ships the ENTIRE upload flow over that primitive\n//     (batching, per-file outcomes, the loud created-but-unattached report),\n//     so a host never has to build an upload pipeline to get one;\n//   • `openFilePicker` (cloud-files pickers) → `capture.openFilePicker` —\n//     the \"Add file\" chip renders only when bound;\n//   • `createDocument` (data-tables) → `capture.createDataTable` — the\n//     \"New document\" chip renders only when bound; the name is collected by\n//     an INLINE input row (the original's TextInputDialog is host chrome);\n//     the created document opens through the registry's `hrefFor` overlay\n//     when one is registered for `udt_document`;\n//   • the original's \"Add document\" picker (a host CommandDialog over\n//     `listAccessibleDocuments`) has NO capture handler by design — hosts\n//     append it via `extraActions`;\n//   • `@/lib/toast` → the notifier port; console.error → the errorSink.\n//\n// Zero bound handlers → the toolbar renders only `children` (drag-and-drop\n// disabled too — a drop with no upload path must not swallow files).\n\nimport { useRef, useState, type DragEvent, type ReactNode } from \"react\";\nimport { Button, cn, Input } from \"@ai-matrx/design-system\";\n\nimport { useAssociationsStore, useAssociationsUiPorts, useNotifier } from \"../context\";\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport type { CaptureShownTo, CaptureUploadOpts, CaptureUploadResult } from \"../../ports\";\nimport { FileTextIcon, FolderOpenIcon, SpinnerIcon, UploadIcon, type IconProps } from \"../icons\";\nimport { PlusIcon } from \"@ai-matrx/design-system/icons\";\nimport { openOutbound } from \"@ai-matrx/kit/outbound\";\n\nexport interface CaptureAttachResult {\n  ok: boolean;\n  /** Human error text — the toolbar screams it. Omit when the host already did. */\n  error?: string;\n}\n\n/**\n * ONE write callback for every capture verb. Tokens are canonical\n * (`file` / `udt_document`); the host maps to its own write path (an\n * association edge, a thread thunk, …) and reports the outcome honestly —\n * a silent no-op attach is the bug class this contract kills.\n */\nexport type CaptureAttach = (\n  token: EntityTypeToken,\n  resourceId: string,\n  opts?: { label?: string },\n) => Promise<CaptureAttachResult>;\n\nexport interface AssociationCaptureToolbarProps {\n  attach: CaptureAttach;\n  /** Logical cloud-files folder new uploads land in (auto-created). */\n  uploadFolderPath: string;\n  /** Publish uploads to the web. Default false — every upload writes it explicitly. */\n  uploadPublishedToWeb?: boolean;\n  /** \"Shown to\" stamped on uploads. Default \"only_me\". */\n  uploadShownTo?: CaptureShownTo;\n  /**\n   * Where a created-but-unlinked upload is reported to live, e.g.\n   * \"your Files (War Room folder)\". Keeps the loud-outcome copy honest.\n   */\n  uploadLocationLabel: string;\n  /** The retry verb named in loud-outcome copy. Default '\"Add file\"'. */\n  attachRetryLabel?: string;\n  /** Copy for the existing-files picker dialog. */\n  filePicker?: { title?: string; description?: string };\n  /** Which built-in actions render (each ALSO gated on its port handler). */\n  showActions?: {\n    upload?: boolean;\n    addFile?: boolean;\n    newDocument?: boolean;\n  };\n  /** Hide the button row (compact variants) — drag-and-drop stays live. */\n  showToolbar?: boolean;\n  /** Extra host-specific buttons appended after the built-ins. */\n  extraActions?: ReactNode;\n  /**\n   * Authoritative organization for this container. Never inferred from global\n   * selection.\n   */\n  organizationId?: string | null;\n  /** Open a freshly created document via the registry door. Default true. */\n  openCreatedDocument?: boolean;\n  className?: string;\n  /** The body the drop target wraps (the list of attached things). */\n  children?: ReactNode;\n}\n\nexport function AssociationCaptureToolbar({\n  attach,\n  uploadFolderPath,\n  uploadPublishedToWeb = false,\n  uploadShownTo = \"only_me\",\n  uploadLocationLabel,\n  attachRetryLabel = '\"Add file\"',\n  filePicker,\n  showActions,\n  showToolbar = true,\n  extraActions,\n  organizationId,\n  openCreatedDocument = true,\n  className,\n  children,\n}: AssociationCaptureToolbarProps) {\n  const store = useAssociationsStore();\n  const { capture } = useAssociationsUiPorts();\n  const notifier = useNotifier();\n  const fileInputRef = useRef<HTMLInputElement | null>(null);\n  const [isUploading, setIsUploading] = useState(false);\n  const [isDragOver, setIsDragOver] = useState(false);\n  const [isPicking, setIsPicking] = useState(false);\n  const [namingDoc, setNamingDoc] = useState(false);\n  const [docName, setDocName] = useState(\"\");\n  const [creatingDoc, setCreatingDoc] = useState(false);\n\n  // The upload path: the host's full pipeline when bound, otherwise the\n  // PACKAGE-SHIPPED flow over the one-file `uploadFile` primitive (C23).\n  // Identical `CaptureUploadResult` shape either way, so every loud-outcome\n  // branch below is written once.\n  const hostRequestUpload = capture?.requestUpload;\n  const hostUploadFile = capture?.uploadFile;\n  const requestUploadPath: ((opts: CaptureUploadOpts) => Promise<CaptureUploadResult>) | undefined =\n    hostRequestUpload\n      ? (opts) => hostRequestUpload(opts)\n      : hostUploadFile\n        ? async (opts) => {\n            const uploaded: string[] = [];\n            const failed: { name: string; error: string }[] = [];\n            for (const file of opts.files) {\n              try {\n                const { files: _files, ...uploadOpts } = opts;\n                const result = await hostUploadFile(file, uploadOpts);\n                if (result.ok) uploaded.push(result.id);\n                else failed.push({ name: file.name, error: result.error });\n              } catch (err: unknown) {\n                failed.push({\n                  name: file.name,\n                  error:\n                    err instanceof Error && err.message\n                      ? err.message\n                      : \"Upload failed\",\n                });\n              }\n            }\n            return { uploaded, aliased: [], failed };\n          }\n        : undefined;\n\n  // Per-handler optional (the design's degradation): a chip renders only\n  // when its capture handler exists AND the host didn't hide it.\n  const actions = {\n    upload: (showActions?.upload ?? true) && Boolean(requestUploadPath),\n    addFile: (showActions?.addFile ?? true) && Boolean(capture?.openFilePicker),\n    newDocument:\n      (showActions?.newDocument ?? true) && Boolean(capture?.createDataTable),\n  };\n  const canDrop = Boolean(requestUploadPath);\n\n  // ── Files: upload from disk → attach each returned file id ───────────────\n  //\n  // CREATE-then-ASSOCIATE: the file row is created FIRST (durable — it lives\n  // in the user's library under `uploadFolderPath` no matter what), the edge\n  // is written SECOND, and EVERY terminal outcome is loud. A\n  // created-but-unattached file is reported with its location — it must never\n  // look like it \"just disappeared\".\n  const uploadAndAttach = async (files: File[]) => {\n    const requestUpload = requestUploadPath;\n    if (files.length === 0 || !requestUpload) return;\n    setIsUploading(true);\n    // Watchdog: if the upload pipeline never settles (hung dialog promise,\n    // dead transport), SAY so — a stuck-silent gesture is the bug class.\n    const watchdog = setTimeout(() => {\n      store.errorSink({\n        code: \"capture_upload_unresponsive\",\n        message:\n          \"[AssociationCaptureToolbar] upload pipeline unresponsive >60s\",\n        context: { files: files.map((f) => f.name) },\n      });\n      notifier.error(\n        \"The upload isn't responding — it may be stalled. Check your connection and retry.\",\n      );\n    }, 60_000);\n    try {\n      const result = await requestUpload({\n        files,\n        folderPath: uploadFolderPath,\n        publishedToWeb: uploadPublishedToWeb,\n        shownTo: uploadShownTo,\n        visibility: uploadPublishedToWeb ? \"public\" : uploadShownTo === \"only_me\" ? \"personal\" : \"internal\", // T-13 transitional wire input\n      });\n      if (result.cancelled) {\n        notifier.success(\"Upload canceled — nothing was attached\");\n        return;\n      }\n      const aliasedIds = result.aliased.map((a) => a.existingFileId);\n      const ids = [...result.uploaded, ...aliasedIds];\n      let attached = 0;\n      const unattached: string[] = [];\n      let firstAttachError: string | null = null;\n      for (const id of ids) {\n        const res = await attach(\"file\", id);\n        if (res.ok) {\n          attached += 1;\n        } else {\n          unattached.push(id);\n          if (!firstAttachError && res.error) firstAttachError = res.error;\n        }\n      }\n      if (attached > 0) {\n        notifier.success(\n          attached === 1 ? \"Attached 1 file\" : `Attached ${attached} files`,\n        );\n      }\n      if (unattached.length > 0) {\n        // The upload SUCCEEDED — the file exists in the library. Say so, and\n        // say where, instead of letting it vanish.\n        notifier.error(\n          `Uploaded ${unattached.length === 1 ? \"1 file\" : `${unattached.length} files`} to ${uploadLocationLabel} but couldn't attach ${unattached.length === 1 ? \"it\" : \"them\"} here — use ${attachRetryLabel} to retry` +\n            (firstAttachError ? ` (${firstAttachError})` : \"\"),\n        );\n      }\n      if (result.failed.length > 0) {\n        const first = result.failed[0];\n        if (result.failed.length === 1 && first) {\n          notifier.error(`Failed to upload ${first.name}: ${first.error}`);\n        } else {\n          // 🚨 THE 2026-09-19 COLLAPSE (VERIFICATION.md §17). This used to say\n          // only `Failed to upload N files` — a bare count with every server\n          // reason dropped, so a real outage (every upload 400ing for the SAME\n          // documented cause) read exactly like a mystery. Keep EVERY distinct\n          // server sentence: one line per distinct reason, with how many files\n          // hit it, never a bare count.\n          const reasonCounts = new Map<string, number>();\n          for (const f of result.failed) {\n            const reason =\n              f.error && f.error.trim().length > 0 ? f.error : \"Upload failed\";\n            reasonCounts.set(reason, (reasonCounts.get(reason) ?? 0) + 1);\n          }\n          const lines = Array.from(reasonCounts.entries()).map(\n            ([reason, count]) => `${count}× ${reason}`,\n          );\n          notifier.error(`Failed to upload ${result.failed.length} files`, {\n            description: lines.join(\"\\n\"),\n          });\n        }\n      }\n      if (ids.length === 0 && result.failed.length === 0) {\n        // Guard-host edge case (everything skipped in the duplicate dialog\n        // with no alias chosen) — never end a user gesture in silence.\n        notifier.error(\"Nothing was uploaded or attached\");\n      }\n    } catch (err) {\n      store.errorSink({\n        code: \"capture_upload_failed\",\n        message: \"[AssociationCaptureToolbar] upload flow failed\",\n        context: { detail: err },\n      });\n      notifier.error(\n        err instanceof Error && err.message\n          ? `Upload failed: ${err.message}`\n          : \"Upload failed unexpectedly\",\n      );\n    } finally {\n      clearTimeout(watchdog);\n      setIsUploading(false);\n    }\n  };\n\n  const handleFilesSelected = (e: React.ChangeEvent<HTMLInputElement>) => {\n    const files = e.target.files ? Array.from(e.target.files) : [];\n    e.target.value = \"\";\n    void uploadAndAttach(files);\n  };\n\n  // Drop a file anywhere on the body → upload + attach. Without this the most\n  // natural gesture had NO handler — the browser navigated to the file with\n  // zero feedback: the \"file just disappeared\" bug class. (Gated on the\n  // upload handler existing: a drop zone with no upload path is a dead end.)\n  const handleDrop = (e: DragEvent) => {\n    if (!canDrop) return;\n    e.preventDefault();\n    e.stopPropagation();\n    setIsDragOver(false);\n    const files = Array.from(e.dataTransfer?.files ?? []);\n    if (files.length === 0) return;\n    void uploadAndAttach(files);\n  };\n\n  // ── Files: pick existing cloud files ──────────────────────────────────────\n  const handlePickExisting = async () => {\n    const openFilePicker = capture?.openFilePicker;\n    if (isPicking || !openFilePicker) return;\n    setIsPicking(true);\n    try {\n      const ids = await openFilePicker({\n        multi: true,\n        title: filePicker?.title ?? \"Attach files\",\n        description:\n          filePicker?.description ??\n          \"Pick existing files from your cloud storage.\",\n      });\n      if (!ids || ids.length === 0) return;\n      let attached = 0;\n      let firstAttachError: string | null = null;\n      for (const id of ids) {\n        const res = await attach(\"file\", id);\n        if (res.ok) attached += 1;\n        else if (!firstAttachError && res.error) firstAttachError = res.error;\n      }\n      if (attached > 0) {\n        notifier.success(\n          attached === 1 ? \"Attached 1 file\" : `Attached ${attached} files`,\n        );\n      }\n      if (attached < ids.length && firstAttachError) {\n        // Hosts whose attach path screams its own failures return no `error`;\n        // everyone else gets the loud outcome here.\n        notifier.error(`Couldn't attach: ${firstAttachError}`);\n      }\n    } catch (err) {\n      store.errorSink({\n        code: \"capture_pick_failed\",\n        message: \"[AssociationCaptureToolbar] attach-existing flow failed\",\n        context: { detail: err },\n      });\n      notifier.error(\"Couldn't attach the selected files\");\n    } finally {\n      setIsPicking(false);\n    }\n  };\n\n  // ── Documents ─────────────────────────────────────────────────────────────\n  const handleCreateDoc = async () => {\n    const createDataTable = capture?.createDataTable;\n    const name = docName.trim();\n    if (!name || creatingDoc || !createDataTable) return;\n    if (!organizationId) {\n      notifier.error(\n        \"This container needs an organization before a document can be created.\",\n      );\n      return;\n    }\n    setCreatingDoc(true);\n    try {\n      const doc = await createDataTable({ name, organizationId });\n      if (!doc) {\n        notifier.error(\"Couldn't create the document\");\n        return;\n      }\n      const res = await attach(\"udt_document\", doc.id, { label: name });\n      setNamingDoc(false);\n      setDocName(\"\");\n      if (res.ok) {\n        notifier.success(\"Document created\");\n        if (openCreatedDocument && typeof window !== \"undefined\") {\n          const href = store.registry\n            .tryGetEntityInfo(\"udt_document\")\n            ?.hrefFor?.(doc.id);\n          if (href) openOutbound(href, \"_blank\", \"noopener\");\n        }\n      } else {\n        // Created but not linked — the document exists; never let it vanish.\n        notifier.error(\n          `Created \"${name}\" but couldn't attach it here — it's saved in your documents; retry from its library`,\n        );\n      }\n    } catch (err) {\n      store.errorSink({\n        code: \"capture_create_document_failed\",\n        message: \"[AssociationCaptureToolbar] create-document flow failed\",\n        context: { detail: err },\n      });\n      notifier.error(\"Couldn't create the document\");\n    } finally {\n      setCreatingDoc(false);\n    }\n  };\n\n  const anyBuiltIn = actions.upload || actions.addFile || actions.newDocument;\n\n  return (\n    <div\n      className={cn(\n        \"relative flex h-full min-h-0 flex-col\",\n        isDragOver && \"ring-2 ring-inset ring-primary/50\",\n        className,\n      )}\n      onDragOver={(e) => {\n        if (!canDrop) return;\n        if (!e.dataTransfer?.types.includes(\"Files\")) return;\n        e.preventDefault();\n        e.stopPropagation();\n        setIsDragOver(true);\n      }}\n      onDragLeave={(e) => {\n        if (e.currentTarget.contains(e.relatedTarget as Node)) return;\n        setIsDragOver(false);\n      }}\n      onDrop={handleDrop}\n    >\n      {isDragOver ? (\n        <div className=\"pointer-events-none absolute inset-0 z-10 grid place-items-center bg-background/70\">\n          <span className=\"flex items-center gap-2 rounded-md border border-primary/40 bg-card px-3 py-1.5 text-xs font-medium text-foreground\">\n            <UploadIcon className=\"size-3.5 text-primary\" />\n            Drop to upload &amp; attach\n          </span>\n        </div>\n      ) : null}\n      <input\n        ref={fileInputRef}\n        type=\"file\"\n        multiple\n        className=\"sr-only\"\n        onChange={handleFilesSelected}\n      />\n\n      {/* ── capture toolbar ────────────────────────────────────────────── */}\n      {showToolbar && (anyBuiltIn || extraActions) ? (\n        <div className=\"flex flex-wrap items-center gap-0.5 border-b border-border/60 px-1.5 py-1\">\n          {namingDoc ? (\n            <div className=\"flex flex-1 items-center gap-1.5 py-0.5\">\n              <Input\n                autoFocus\n                value={docName}\n                disabled={creatingDoc}\n                placeholder=\"Document name…\"\n                onChange={(e) => setDocName(e.target.value)}\n                onKeyDown={(e) => {\n                  if (e.key === \"Enter\") void handleCreateDoc();\n                  if (e.key === \"Escape\") {\n                    setNamingDoc(false);\n                    setDocName(\"\");\n                  }\n                }}\n                className=\"h-7 flex-1 text-base md:text-xs\"\n                style={{ fontSize: 16 }}\n              />\n              <button\n                type=\"button\"\n                disabled={creatingDoc || !docName.trim()}\n                onClick={() => void handleCreateDoc()}\n                className=\"flex h-7 items-center rounded-md bg-primary px-2 text-[11px] font-medium text-primary-foreground disabled:opacity-50\"\n              >\n                {creatingDoc ? (\n                  <SpinnerIcon className=\"size-3.5 animate-spin\" />\n                ) : (\n                  \"Create\"\n                )}\n              </button>\n              <button\n                type=\"button\"\n                disabled={creatingDoc}\n                onClick={() => {\n                  setNamingDoc(false);\n                  setDocName(\"\");\n                }}\n                className=\"flex h-7 items-center rounded-md border border-border px-2 text-[11px] text-muted-foreground hover:text-foreground disabled:opacity-50\"\n              >\n                Cancel\n              </button>\n            </div>\n          ) : (\n            <>\n              {actions.upload ? (\n                <CaptureToolbarAction\n                  icon={isUploading ? SpinnerIcon : UploadIcon}\n                  spinning={isUploading}\n                  label=\"Upload\"\n                  onClick={() => !isUploading && fileInputRef.current?.click()}\n                  disabled={isPicking || isUploading}\n                />\n              ) : null}\n              {actions.addFile ? (\n                <CaptureToolbarAction\n                  icon={isPicking ? SpinnerIcon : FolderOpenIcon}\n                  spinning={isPicking}\n                  label=\"Add file\"\n                  onClick={() => void handlePickExisting()}\n                  disabled={isPicking || isUploading}\n                />\n              ) : null}\n              {(actions.upload || actions.addFile) && actions.newDocument ? (\n                <span className=\"mx-1 h-4 w-px bg-border\" />\n              ) : null}\n              {actions.newDocument ? (\n                <CaptureToolbarAction\n                  icon={creatingDoc ? SpinnerIcon : PlusIcon}\n                  spinning={creatingDoc}\n                  label=\"New document\"\n                  onClick={() => setNamingDoc(true)}\n                  disabled={creatingDoc}\n                />\n              ) : null}\n              {extraActions}\n            </>\n          )}\n        </div>\n      ) : null}\n\n      {children}\n    </div>\n  );\n}\n\n// ── toolbar chrome ──────────────────────────────────────────────────────────\n\n/** The dense toolbar button (exported so hosts' extraActions match). */\nexport function CaptureToolbarAction({\n  icon: Icon,\n  label,\n  onClick,\n  disabled,\n  spinning,\n}: {\n  icon: (props: IconProps) => ReactNode;\n  label: string;\n  onClick: () => void;\n  disabled?: boolean;\n  spinning?: boolean;\n}) {\n  return (\n    <Button\n      type=\"button\"\n      size=\"sm\"\n      variant=\"ghost\"\n      onClick={onClick}\n      disabled={disabled}\n      className=\"h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground\"\n    >\n      <Icon className={cn(\"size-3.5\", spinning && \"animate-spin\")} />\n      {label}\n    </Button>\n  );\n}\n\n/** The document-file glyph, exported for host extraActions parity. */\nexport { FileTextIcon as CaptureDocumentIcon };\n","// react/lazyPorts.tsx — @ai-matrx/associations/react\n//\n// THE package-owned bundle-split seam (0.6.0, C23 § framework differences).\n//\n// Before this module every host hand-wrote the same `next/dynamic({ssr:false})`\n// glue to keep a heavy port binding (a window manager, a canonical file\n// browser) out of its boot bundle — mechanical seam code, rebuilt per app,\n// each one a chance to get `ssr`, the `loading` fallback or the `.then(m =>\n// m.X)` unwrap wrong. The split is a PACKAGE concern; these two helpers own\n// it once, for every framework we ship on.\n//\n// They are deliberately framework-AGNOSTIC — `React.lazy` + `Suspense`, no\n// `next/dynamic`, no `next` peer dependency. `ssr: false` is not needed and\n// never was: both ports are only ever RENDERED after a user gesture opens a\n// window, so the loader fires client-side and the module never enters a\n// server render. Next.js, Vite, the Tauri shell and Jest all handle it the\n// same way, and the consumer's own bundler creates the real chunk.\n//\n// Usage in a host binding (the whole of it):\n//\n//   windowShell: {\n//     Window: lazyWindowShell(() =>\n//       import(\"./hostWindows\").then((m) => m.AssociationsWindowShellImpl)),\n//   },\n//   pickerOverrides: {\n//     file: lazyPickerOverride(() =>\n//       import(\"./hostPickers\").then((m) => m.FileAssociationPickerImpl)),\n//   },\n\nimport { Suspense, lazy, type ComponentType, type ReactNode } from \"react\";\n\nimport type { AssociationPickerProps, WindowShellPort } from \"../ports\";\n\n/** What a `windowShell.Window` component receives. */\nexport interface WindowShellComponentProps {\n  id: string;\n  title: string;\n  onClose(): void;\n  children: ReactNode;\n}\n\n/**\n * Wrap `React.lazy` so the loader may resolve EITHER a bare component or a\n * `{ default }` module — hosts reach for `.then(m => m.Named)` reflexively\n * and both spellings must work, not one of them silently.\n */\nfunction lazyComponent<P>(\n  load: () => Promise<ComponentType<P> | { default: ComponentType<P> }>,\n): ComponentType<P> {\n  return lazy(async () => {\n    const loaded = await load();\n    return typeof loaded === \"function\" ? { default: loaded } : loaded;\n  });\n}\n\n/**\n * Split a host window component off the boot bundle. The returned component\n * satisfies `WindowShellPort[\"Window\"]` exactly; the chunk fetches the first\n * time an association window opens.\n */\nexport function lazyWindowShell(\n  load: () => Promise<\n    | ComponentType<WindowShellComponentProps>\n    | { default: ComponentType<WindowShellComponentProps> }\n  >,\n): WindowShellPort[\"Window\"] {\n  const Loaded = lazyComponent<WindowShellComponentProps>(load);\n  return function LazyWindowShell(props: WindowShellComponentProps) {\n    // `null` while the chunk arrives: a window opens on a click and the\n    // chunk lands in a frame or two — a skeleton window would flash worse\n    // than nothing. Failure is NOT silent: a rejected chunk throws into the\n    // host's error boundary rather than leaving a dead surface.\n    return (\n      <Suspense fallback={null}>\n        <Loaded {...props} />\n      </Suspense>\n    );\n  };\n}\n\n/**\n * Split a host per-token picker override off the boot bundle. The returned\n * component satisfies the `pickerOverrides` map's value type exactly.\n */\nexport function lazyPickerOverride(\n  load: () => Promise<\n    | ComponentType<AssociationPickerProps>\n    | { default: ComponentType<AssociationPickerProps> }\n  >,\n): ComponentType<AssociationPickerProps> {\n  const Loaded = lazyComponent<AssociationPickerProps>(load);\n  return function LazyPickerOverride(props: AssociationPickerProps) {\n    // Gated on `open` as well as Suspense: an override registered for a\n    // token must not fetch its chunk until that picker is actually opened.\n    if (!props.open) return null;\n    return (\n      <Suspense fallback={null}>\n        <Loaded {...props} />\n      </Suspense>\n    );\n  };\n}\n","// react/hooks/useAssociationPickerBridge.ts — @ai-matrx/associations/react\n//\n// THE loud-outcome engine for a per-token picker OVERRIDE (0.6.0, C22).\n//\n// A host that registers its own canonical browser for a token (matrx-frontend\n// registers its file picker for `file`) still owes the package's contract:\n// every attach/detach reports honestly, a partial batch says exactly what\n// landed and what did not, and an attach the RPC refuses can never look like\n// an inert click (the QA F1 bug class, feedback 35d311a9). That is package\n// logic — failure semantics, retry copy, sink routing — and until 0.6.0 every\n// override re-implemented it by hand in host code. It lives here now: an\n// override binds this hook and writes only the two lines that call it.\n//\n//   const bridge = useAssociationPickerBridge(props, {\n//     createdLocationLabel: \"your Files\",\n//     openCreatedLocation: { label: \"Open Files\", onClick: () => … },\n//   });\n//   <HostPicker onUpload={(f) => bridge.attachMany(f.map(toItem))}\n//               onPick={(s) => bridge.toggle(toItem(s))} />\n\nimport { useCallback, useState } from \"react\";\n\nimport type { AssociationPickerProps } from \"../../ports\";\nimport { useAssociationsStore, useNotifier } from \"../context\";\n\n/** One thing the host's picker produced or selected. */\nexport interface PickerBridgeItem {\n  id: string;\n  /** Human name — used verbatim in every loud outcome. */\n  name: string;\n}\n\nexport interface AssociationPickerBridgeOptions {\n  /**\n   * Where an item that was CREATED but could not be attached now lives\n   * (\"your Files\"). Keeps the created-but-unlinked message honest instead of\n   * letting the item look like it vanished.\n   */\n  createdLocationLabel?: string;\n  /** An action offered on that message, e.g. a door to the library. */\n  openCreatedLocation?: { label: string; onClick: () => void };\n  /** Noun used in copy. Default \"item\". */\n  itemNoun?: string;\n}\n\nexport interface AssociationPickerBridge {\n  /**\n   * Attach a batch (the host's post-upload hand-off). Every terminal outcome\n   * is loud: successes are confirmed, failures name the item AND where it\n   * lives, and a thrown attach is captured to the errorSink.\n   */\n  attachMany(items: PickerBridgeItem[]): Promise<void>;\n  /** Attach-or-detach one item, screaming on refusal. */\n  toggle(item: PickerBridgeItem): Promise<void>;\n  /** True while a batch or toggle is in flight (drive the host's spinner). */\n  busy: boolean;\n}\n\nexport function useAssociationPickerBridge(\n  props: Pick<\n    AssociationPickerProps,\n    \"attachedIds\" | \"onAttach\" | \"onDetach\" | \"token\"\n  >,\n  options: AssociationPickerBridgeOptions = {},\n): AssociationPickerBridge {\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const [busy, setBusy] = useState(false);\n\n  const { attachedIds, onAttach, onDetach, token } = props;\n  const {\n    createdLocationLabel,\n    openCreatedLocation,\n    itemNoun = \"item\",\n  } = options;\n\n  const attachMany = useCallback(\n    async (items: PickerBridgeItem[]) => {\n      if (items.length === 0) return;\n      setBusy(true);\n      const failed: { name: string; error?: string | undefined }[] = [];\n      try {\n        for (const item of items) {\n          try {\n            const result = await onAttach(item.id, item.name);\n            if (!result.ok) {\n              failed.push({ name: item.name, error: result.error });\n            }\n          } catch (error: unknown) {\n            store.errorSink({\n              code: \"picker_attach_threw\",\n              message: `[associations] attaching ${itemNoun} \"${item.name}\" threw`,\n              context: { token, id: item.id, detail: error },\n            });\n            failed.push({\n              name: item.name,\n              error: error instanceof Error ? error.message : undefined,\n            });\n          }\n        }\n        const attached = items.length - failed.length;\n        if (attached > 0) {\n          notifier.success(\n            attached === 1\n              ? `Attached 1 ${itemNoun}`\n              : `Attached ${attached} ${itemNoun}s`,\n          );\n        }\n        if (failed.length > 0) {\n          const first = failed[0];\n          const detail = first?.error ? ` (${first.error})` : \"\";\n          notifier.error(\n            failed.length === 1\n              ? `Couldn't attach \"${first?.name ?? itemNoun}\"${detail}`\n              : `Couldn't attach ${failed.length} ${itemNoun}s${detail}`,\n            {\n              ...(createdLocationLabel\n                ? {\n                    description: `The ${failed.length === 1 ? itemNoun + \" is\" : itemNoun + \"s are\"} safe in ${createdLocationLabel}. You can retry the association here.`,\n                  }\n                : {}),\n              ...(openCreatedLocation ? { action: openCreatedLocation } : {}),\n            },\n          );\n          store.errorSink({\n            code: \"picker_attach_partial\",\n            message: `[associations] ${failed.length} of ${items.length} ${itemNoun}s were not attached`,\n            context: { token, failed },\n          });\n        }\n      } finally {\n        setBusy(false);\n      }\n    },\n    [\n      createdLocationLabel,\n      itemNoun,\n      notifier,\n      onAttach,\n      openCreatedLocation,\n      store,\n      token,\n    ],\n  );\n\n  const toggle = useCallback(\n    async (item: PickerBridgeItem) => {\n      setBusy(true);\n      try {\n        const detaching = attachedIds.has(item.id);\n        const result = detaching\n          ? await onDetach(item.id)\n          : await onAttach(item.id, item.name);\n        if (!result.ok) {\n          const verb = detaching ? \"detach\" : \"attach\";\n          notifier.error(\n            `Couldn't ${verb} \"${item.name}\"` +\n              (result.error ? `: ${result.error}` : \"\"),\n          );\n          store.errorSink({\n            code: detaching ? \"picker_detach_failed\" : \"picker_attach_failed\",\n            message: `[associations] ${verb} refused for \"${item.name}\"`,\n            context: { token, id: item.id, error: result.error },\n          });\n        }\n      } catch (error: unknown) {\n        store.errorSink({\n          code: \"picker_toggle_threw\",\n          message: `[associations] toggling ${itemNoun} \"${item.name}\" threw`,\n          context: { token, id: item.id, detail: error },\n        });\n        notifier.error(`Couldn't update \"${item.name}\"`);\n      } finally {\n        setBusy(false);\n      }\n    },\n    [attachedIds, itemNoun, notifier, onAttach, onDetach, store, token],\n  );\n\n  return { attachMany, toggle, busy };\n}\n","// react/components/AssociationEntitySelect.tsx — @ai-matrx/associations/react\n//\n// The canonical \"name dropdown\" for one kind of associated entity on a\n// container — ONE compact control that handles every aspect of the name:\n//\n//   1. DISPLAY   — the active entity's real name (registry icon beside it)\n//   2. RENAME    — click (or double-click) the name to edit it inline\n//   3. SWITCH    — a chevron opens the full list of associated entities,\n//                  searchable, with the active one checked\n//   4. ADD NEW   — the list ends with \"+ New <Entity>\"; the user types a name\n//                  and the new entity is created, associated to the container,\n//                  and made active\n//   5. REMOVE    — non-active rows offer an unlink X (when the adapter\n//                  supports detach)\n//\n// The dropdown is ALWAYS available — even with a single (or zero) entities —\n// so \"add another\" is never hidden. Registry-driven (icon/labels from the\n// store's registry merge engine), Redux-free, and adapter-driven: pass the\n// default `useAssociationEntitySelectAdapter` for plain platform.associations\n// containers, or a bespoke adapter when the surface has its own lifecycle\n// (e.g. war-room threads with is_active edge metadata).\n//\n// Ported VERBATIM from matrx-frontend\n// `features/scopes/components/associations/AssociationEntitySelect.tsx`\n// (W4 completion, 2026-08-29 — the face was gated on design-system 0.3.0's\n// Command family). Seams inverted:\n//   • `getEntityInfo` → `store.registry.getEntityInfo` (host overlay merged;\n//     `Icon: null` → the package `DefaultEntityIcon`);\n//   • `@/lib/toast` → the notifier port (warn-once degradation);\n//   • `EntityDoorControls` → the `DoorControlsSlot` (host port when bound,\n//     otherwise the package's shipped hrefFor anchor — 0.6.0, C23) (absent →\n//     the name renders without doors, per the design's degradation table);\n//   • lucide glyphs → the package's inlined SVGs (C19);\n//   • Popover/Command/EditableLabel → `@ai-matrx/design-system` (>=0.3.0).\n//\n// THE DOOR LAW: the name this control shows is a real record, so it carries its\n// doors — but the name itself CANNOT be a link (clicking it starts an inline\n// rename), so the door controls ride beside it as a sibling: peek, plus a\n// new tab. Same-tab open is withheld on purpose — this control lives in a\n// toolbar above live work (a war-room tile, a notes pane), and navigating away\n// would throw that work away to answer \"what is this thing?\". Every row in the\n// switcher gets the same doors.\n\nimport { useState } from \"react\";\nimport {\n  cn,\n  Command,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n  EditableLabel,\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@ai-matrx/design-system\";\n\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport { useAssociationsStore, useAssociationsUiPorts, useNotifier } from \"../context\";\nimport type { AssociationEntitySelectAdapter } from \"../hooks/useAssociationEntitySelect\";\nimport { DoorControlsSlot } from \"./entityDoors\";\nimport { DefaultEntityIcon, SpinnerIcon } from \"../icons\";\nimport { CheckIcon, ChevronDownIcon, PlusIcon, XIcon } from \"@ai-matrx/design-system/icons\";\n\nexport interface AssociationEntitySelectProps {\n  token: EntityTypeToken;\n  adapter: AssociationEntitySelectAdapter;\n  className?: string;\n  /** Label sizing/typography override (defaults to toolbar-dense text-xs). */\n  labelClassName?: string;\n  align?: \"start\" | \"end\";\n  showIcon?: boolean;\n  /** How the name enters inline edit. Default \"click\". */\n  renameActivation?: \"click\" | \"doubleClick\";\n  /** Shown while no entity is active yet. Defaults to the plural label. */\n  emptyLabel?: string;\n  /** Icon color accent (e.g. \"text-yellow-500\" for notes). */\n  iconClassName?: string;\n  /**\n   * Replaces the default \"+ New <Entity>\" name-input footer with a custom\n   * creator (e.g. an agent picker that starts a new chat). Function form\n   * receives `close` so the creator can dismiss the dropdown when done.\n   */\n  createSlot?: React.ReactNode | ((close: () => void) => React.ReactNode);\n}\n\nexport function AssociationEntitySelect({\n  token,\n  adapter,\n  className,\n  labelClassName,\n  align = \"end\",\n  showIcon = true,\n  renameActivation = \"click\",\n  emptyLabel,\n  iconClassName,\n  createSlot,\n}: AssociationEntitySelectProps) {\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const info = store.registry.getEntityInfo(token);\n  const InfoIcon = info.Icon ?? DefaultEntityIcon;\n  const { items, activeId } = adapter;\n  const active = items.find((i) => i.id === activeId) ?? null;\n  const activeIndex = active ? items.indexOf(active) : -1;\n\n  const [open, setOpen] = useState(false);\n  const [query, setQuery] = useState(\"\");\n  const [creating, setCreating] = useState(false);\n  const [draftName, setDraftName] = useState(\"\");\n  const [busy, setBusy] = useState(false);\n\n  const entityLabel = info.label.toLowerCase();\n  const close = () => {\n    setOpen(false);\n    setQuery(\"\");\n    setCreating(false);\n    setDraftName(\"\");\n  };\n\n  const create = async (title: string) => {\n    const name = title.trim();\n    if (!name || busy || !adapter.createAndAttach) return;\n    setBusy(true);\n    const id = await adapter.createAndAttach(name);\n    setBusy(false);\n    if (id) close();\n    else notifier.error(`Couldn't create the ${entityLabel}`);\n  };\n\n  return (\n    <div\n      className={cn(\n        \"group/entity-ref flex min-w-0 items-center gap-0.5\",\n        className,\n      )}\n    >\n      {showIcon ? (\n        <InfoIcon\n          className={cn(\n            \"size-3.5 shrink-0\",\n            iconClassName ?? \"text-muted-foreground\",\n          )}\n          aria-hidden\n        />\n      ) : null}\n\n      {active ? (\n        <EditableLabel\n          value={active.title}\n          onCommit={async (next) => {\n            const ok = await adapter.rename(active.id, next);\n            if (!ok) {\n              notifier.error(`Couldn't rename the ${entityLabel}`);\n              throw new Error(\"rename failed\");\n            }\n          }}\n          commitMode=\"await\"\n          activation={renameActivation}\n          ariaLabel={info.label}\n          className={cn(\"max-w-[14rem]\", labelClassName)}\n          displayClassName=\"text-xs font-medium text-foreground\"\n          inputClassName=\"text-xs font-medium\"\n        />\n      ) : null}\n\n      {active ? (\n        <DoorControlsSlot token={token} id={active.id} name={active.title} />\n      ) : null}\n\n      {!active ? (\n        <span\n          className={cn(\n            \"truncate px-1 text-xs font-medium text-muted-foreground\",\n            labelClassName,\n          )}\n        >\n          {adapter.loading ? \"…\" : (emptyLabel ?? info.labelPlural)}\n        </span>\n      ) : null}\n\n      <Popover\n        open={open}\n        onOpenChange={(next) => (next ? setOpen(true) : close())}\n      >\n        <PopoverTrigger asChild>\n          <button\n            type=\"button\"\n            className=\"inline-flex h-6 shrink-0 items-center gap-0.5 rounded-md px-1 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n            title={`Switch or add ${info.labelPlural.toLowerCase()}`}\n            aria-label={`Switch or add ${info.labelPlural.toLowerCase()}`}\n          >\n            {items.length > 1 ? (\n              <span className=\"tabular-nums\">\n                {activeIndex >= 0 ? activeIndex + 1 : \"—\"}/{items.length}\n              </span>\n            ) : null}\n            <ChevronDownIcon className=\"size-3 opacity-60\" />\n          </button>\n        </PopoverTrigger>\n        <PopoverContent sizing=\"content\" className=\"p-0\" align={align}>\n          <Command>\n            {items.length > 5 ? (\n              <CommandInput\n                value={query}\n                onValueChange={setQuery}\n                placeholder={`Search ${info.labelPlural.toLowerCase()}…`}\n              />\n            ) : null}\n            <CommandList>\n              <CommandEmpty>No match.</CommandEmpty>\n              {items.length > 0 ? (\n                <CommandGroup>\n                  {items.map((item) => (\n                    <CommandItem\n                      key={item.id}\n                      value={`${item.title} ${item.id}`}\n                      onSelect={() => {\n                        if (item.id !== activeId)\n                          void adapter.setActive(item.id);\n                        close();\n                      }}\n                      className=\"group/entity-ref group gap-2\"\n                    >\n                      <CheckIcon\n                        className={cn(\n                          \"size-3.5 shrink-0\",\n                          item.id === activeId ? \"opacity-100\" : \"opacity-0\",\n                        )}\n                      />\n                      <span className=\"min-w-0 flex-1 truncate\">\n                        {item.title}\n                      </span>\n                      {/* Doors, as siblings of the row's select handler.\n                          `onPointerDown` is swallowed for the same reason the\n                          unlink button below swallows it: cmdk would otherwise\n                          take focus and select the row out from under the\n                          control. */}\n                      <span\n                        className=\"inline-flex shrink-0 items-center\"\n                        onPointerDown={(e) => {\n                          e.preventDefault();\n                          e.stopPropagation();\n                        }}\n                      >\n                        <DoorControlsSlot\n                          token={token}\n                          id={item.id}\n                          name={item.title}\n                        />\n                      </span>\n                      {adapter.detach && item.id !== activeId ? (\n                        <button\n                          type=\"button\"\n                          onPointerDown={(e) => {\n                            e.preventDefault();\n                            e.stopPropagation();\n                          }}\n                          onClick={(e) => {\n                            e.stopPropagation();\n                            void adapter.detach?.(item.id);\n                          }}\n                          className=\"grid size-5 shrink-0 place-items-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-destructive group-hover:opacity-100\"\n                          title={`Remove this ${entityLabel} from here (does not delete it)`}\n                          aria-label={`Remove ${item.title}`}\n                        >\n                          <XIcon className=\"size-3\" />\n                        </button>\n                      ) : null}\n                    </CommandItem>\n                  ))}\n                </CommandGroup>\n              ) : null}\n            </CommandList>\n\n            {/* Create footer — outside CommandList so search never hides it. */}\n            {createSlot !== undefined ? (\n              <div className=\"border-t border-border p-1\">\n                {typeof createSlot === \"function\"\n                  ? createSlot(close)\n                  : createSlot}\n              </div>\n            ) : null}\n            {createSlot === undefined && adapter.createAndAttach ? (\n              <div className=\"border-t border-border p-1\">\n                {creating ? (\n                  <div className=\"flex items-center gap-1 px-1 py-0.5\">\n                    <input\n                      autoFocus\n                      type=\"text\"\n                      value={draftName}\n                      disabled={busy}\n                      placeholder={`New ${entityLabel} name…`}\n                      onChange={(e) => setDraftName(e.target.value)}\n                      onKeyDown={(e) => {\n                        if (e.key === \"Enter\") {\n                          e.preventDefault();\n                          void create(draftName);\n                        } else if (e.key === \"Escape\") {\n                          e.preventDefault();\n                          e.stopPropagation();\n                          setCreating(false);\n                          setDraftName(\"\");\n                        }\n                      }}\n                      className=\"h-6 w-full min-w-0 rounded-sm bg-transparent px-1 text-base outline-none focus:bg-background focus:ring-1 focus:ring-ring md:text-xs\"\n                      aria-label={`New ${entityLabel} name`}\n                    />\n                    <button\n                      type=\"button\"\n                      disabled={busy || !draftName.trim()}\n                      onClick={() => void create(draftName)}\n                      className=\"inline-flex h-6 shrink-0 items-center rounded-md px-1.5 text-[10px] font-medium text-primary transition-colors hover:bg-accent disabled:opacity-50\"\n                    >\n                      {busy ? (\n                        <SpinnerIcon className=\"size-3 animate-spin\" />\n                      ) : (\n                        \"Create\"\n                      )}\n                    </button>\n                  </div>\n                ) : (\n                  <button\n                    type=\"button\"\n                    disabled={busy}\n                    onClick={() => {\n                      // A typed search that matched nothing doubles as the new\n                      // name — one click instead of retyping it.\n                      if (query.trim()) void create(query);\n                      else setCreating(true);\n                    }}\n                    className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n                  >\n                    {busy ? (\n                      <SpinnerIcon className=\"size-3.5 animate-spin\" />\n                    ) : (\n                      <PlusIcon className=\"size-3.5\" />\n                    )}\n                    {query.trim()\n                      ? `Create \"${query.trim()}\"`\n                      : `New ${info.label}`}\n                  </button>\n                )}\n              </div>\n            ) : null}\n          </Command>\n        </PopoverContent>\n      </Popover>\n    </div>\n  );\n}\n","// react/components/CategorySelect.tsx — @ai-matrx/associations/react\n//\n// THE single-value picker over one `platform.categories` dimension. ONE\n// component for every category anywhere in the app: pass the `dimension` and it\n// renders that facet's categories, hierarchy and all. There is no per-feature\n// copy and there must never be one — the rules do not change between features.\n//\n// Value is the category ID (the FK the consuming table stores), display is the\n// category name. Reads and writes go through the canonical `useCategories`\n// hook (`cat_list` / `cat_create`), never a bespoke query.\n//\n// 🚨 IT TAKES NEW INPUT (P23). Type a name that does not exist and it offers to\n// create it, then selects it — because the moment someone wants to teach the\n// system a category they did not have is the moment worth the most, and a\n// picker that says \"choose from these\" instead is how the platform loses its\n// best users. Its multi-select sibling `CategoryTagPicker` has always done\n// this; the two were inconsistent for no reason, and now are not.\n//\n// Creating requires an explicit organization — a new category belongs to that\n// organization, never to a resolver default or the system set (those are\n// platform-governed; `isSystem` rows are read-only here by design).\n//\n// Ported VERBATIM from matrx-frontend\n// `features/scopes/components/CategorySelect.tsx` (W4 completion, 2026-08-29 —\n// the face was gated on design-system 0.3.0's CreatablePicker + Select).\n// Seams inverted:\n//   • the Redux active-organization read (`selectOrganizationId`) → the\n//     identity port's optional `ensureOrgId()` (the design's seam-table home\n//     for org resolution): `orgId` prop wins; otherwise `ensureOrgId()` is\n//     asked; with neither, create refuses LOUDLY (notifier + errorSink) —\n//     never a row stamped with a guessed org;\n//   • `@/lib/toast` → the notifier port (warn-once degradation);\n//   • `useCategories`/`buildCategoryHierarchy` → the package's own;\n//   • the lucide `CornerDownRight` → the package's inlined SVG (C19);\n//   • CreatablePicker/Select → `@ai-matrx/design-system` (>=0.3.0).\n\nimport { useState } from \"react\";\nimport {\n  CreatablePicker,\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@ai-matrx/design-system\";\n\nimport type { CategoryDimension } from \"../../edges\";\nimport { buildCategoryHierarchy } from \"../../core/categoryHierarchy\";\nimport { useAssociationsStore, useNotifier } from \"../context\";\nimport { useCategories } from \"../hooks/useCategories\";\nimport { CornerDownRightIcon } from \"../icons\";\n\nconst NONE = \"__none__\";\nconst ROOT_PARENT = \"__root__\";\n\n/** \"category\" → \"categories\", \"stage\" → \"stages\". Copy a person reads. */\nfunction plural(noun: string): string {\n  return /[^aeiou]y$/i.test(noun) ? `${noun.slice(0, -1)}ies` : `${noun}s`;\n}\n\nexport interface CategorySelectProps {\n  dimension: CategoryDimension;\n  value: string | null;\n  onChange: (id: string | null) => void;\n  placeholder: string;\n  allowNone?: boolean;\n  disabled?: boolean;\n  /**\n   * Offer \"Create «what you typed»\". On by default — a closed category list is\n   * a defect, so turning this off needs a reason a person would accept.\n   */\n  allowCreate?: boolean;\n  /**\n   * Org for an inline-created category. Defaults to the identity port's\n   * `ensureOrgId()`; with neither, create refuses loudly.\n   */\n  orgId?: string | null;\n  /** What one of these is called, for the create affordance (\"stage\", \"folder\"). */\n  noun?: string;\n}\n\nexport function CategorySelect({\n  dimension,\n  value,\n  onChange,\n  placeholder,\n  allowNone = true,\n  disabled,\n  allowCreate = true,\n  orgId,\n  noun = \"category\",\n}: CategorySelectProps) {\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const {\n    categories,\n    status,\n    error,\n    create: createCategory,\n    reload,\n  } = useCategories({ dimension });\n  const hierarchy = buildCategoryHierarchy(categories);\n  const [createParentId, setCreateParentId] = useState<string>(ROOT_PARENT);\n\n  const options = [\n    ...(allowNone\n      ? [{ value: NONE, label: \"None\", keywords: \"none clear empty\" }]\n      : []),\n    ...(hierarchy.hasHierarchy\n      ? hierarchy.items.map(({ category, depth, parent }) => ({\n          value: category.id,\n          label: category.name,\n          // The type-ahead matches the parent's name too, so someone who knows\n          // the branch but not the leaf still finds it.\n          keywords: parent ? parent.name : \"\",\n          render:\n            depth === 0 ? (\n              <span className=\"font-medium\">{category.name}</span>\n            ) : (\n              <span className=\"flex items-center gap-1.5 pl-3 text-muted-foreground\">\n                <CornerDownRightIcon className=\"h-3.5 w-3.5 shrink-0\" />\n                <span className=\"text-foreground\">{category.name}</span>\n              </span>\n            ),\n        }))\n      : categories.map((category) => ({\n          value: category.id,\n          label: category.name,\n        }))),\n  ];\n\n  const selected = value\n    ? (hierarchy.items.find((item) => item.category.id === value)?.displayName ??\n      categories.find((category) => category.id === value)?.name ??\n      null)\n    : null;\n\n  const create = async (typed: string): Promise<string | null> => {\n    const name = typed.trim();\n    if (!name) return null;\n    // Typing a name that already exists selects it rather than making a twin.\n    const existing = categories.find(\n      (category) => category.name.toLowerCase() === name.toLowerCase(),\n    );\n    if (existing) return existing.id;\n\n    let resolvedOrgId = orgId ?? null;\n    if (!resolvedOrgId && store.identity.ensureOrgId) {\n      try {\n        resolvedOrgId = await store.identity.ensureOrgId();\n      } catch (e) {\n        store.errorSink({\n          code: \"ensure_org_failed\",\n          message: \"[CategorySelect] identity.ensureOrgId threw\",\n          context: { error: e instanceof Error ? e.message : String(e) },\n        });\n      }\n    }\n    if (!resolvedOrgId) {\n      notifier.error(`Select an organization before creating a ${noun}.`);\n      return null;\n    }\n    const parentId =\n      hierarchy.hasHierarchy && createParentId !== ROOT_PARENT\n        ? createParentId\n        : null;\n    const result = await createCategory({ name, orgId: resolvedOrgId, parentId });\n    if (!result.ok || !result.id) {\n      notifier.error(`Couldn't create that ${noun}`, {\n        ...(result.error != null ? { description: result.error } : {}),\n      });\n      return null;\n    }\n    await reload();\n    setCreateParentId(ROOT_PARENT);\n    const under = parentId\n      ? categories.find((category) => category.id === parentId)?.name\n      : null;\n    notifier.success(\n      `“${name}” is now one of your ${plural(noun)}${\n        under\n          ? ` — it sits under ${under}, and every screen that offers ${plural(noun)} offers it.`\n          : ` — every screen that offers ${plural(noun)} offers it from now on.`\n      }`,\n    );\n    return result.id;\n  };\n\n  return (\n    <div>\n      <CreatablePicker\n        value={value ?? (allowNone ? NONE : null)}\n        onSelect={(next) => onChange(next === NONE ? null : next)}\n        options={options}\n        placeholder={placeholder}\n        searchPlaceholder={\n          allowCreate ? `Search or add a ${noun}…` : `Search ${plural(noun)}…`\n        }\n        noun={noun}\n        ariaLabel={placeholder}\n        // The old control was h-8/text-sm; keeping it means none of the twelve\n        // consuming forms shift when they pick this up.\n        className=\"text-sm\"\n        {...(disabled !== undefined ? { disabled } : {})}\n        loading={status === \"loading\"}\n        emptyLabel={`No ${noun} matches that.`}\n        {...(allowCreate ? { onCreate: create } : {})}\n        {...(allowCreate && hierarchy.hasHierarchy\n          ? {\n              createExtra: (\n                <Select value={createParentId} onValueChange={setCreateParentId}>\n                  <SelectTrigger\n                    className=\"h-7 text-xs\"\n                    aria-label={`Put the new ${noun} under`}\n                  >\n                    <SelectValue />\n                  </SelectTrigger>\n                  <SelectContent>\n                    <SelectItem value={ROOT_PARENT} className=\"text-xs\">\n                      Top level\n                    </SelectItem>\n                    {hierarchy.items\n                      .filter((item) => item.depth === 0)\n                      .map((item) => (\n                        <SelectItem\n                          key={item.category.id}\n                          value={item.category.id}\n                          className=\"text-xs\"\n                        >\n                          Under {item.category.name}\n                        </SelectItem>\n                      ))}\n                  </SelectContent>\n                </Select>\n              ),\n            }\n          : {})}\n      />\n      {selected === null && value !== null ? (\n        // A stored id whose row this reader cannot see is not \"nothing chosen\":\n        // saying so beats a blank box that looks like an unsaved field.\n        <p className=\"mt-1 text-xs text-muted-foreground\">\n          This {noun} is no longer available to you.\n        </p>\n      ) : null}\n      {error ? <p className=\"mt-1 text-xs text-destructive\">{error}</p> : null}\n    </div>\n  );\n}\n","// core/categoryHierarchy.ts — @ai-matrx/associations/core\n//\n// The canonical two-level display order for one category facet — ported\n// VERBATIM from matrx-frontend `features/scopes/utils/categoryHierarchy.ts`\n// (W4 completion, 2026-08-29). Pure data → data, React-free, so it lives in\n// /core beside the category service; the `CategorySelect` /\n// `CategoryTagPicker` faces are its measured consumers.\n\nimport type { PlatformCategory } from \"../edges\";\n\nexport interface CategoryHierarchyItem {\n  category: PlatformCategory;\n  depth: 0 | 1;\n  parent: PlatformCategory | null;\n  displayName: string;\n}\n\nexport interface CategoryHierarchy {\n  items: CategoryHierarchyItem[];\n  roots: PlatformCategory[];\n  hasHierarchy: boolean;\n}\n\n/**\n * Turns the RPC's ordered flat rows into the canonical two-level display order.\n * Flat facets retain their exact input order. Invalid/orphaned rows remain\n * visible at the root; the database guard prevents new ones from being made.\n */\nexport function buildCategoryHierarchy(\n  categories: PlatformCategory[],\n): CategoryHierarchy {\n  const byId = new Map(categories.map((category) => [category.id, category]));\n  const hasHierarchy = categories.some(\n    (category) => category.parentId !== null && byId.has(category.parentId),\n  );\n\n  if (!hasHierarchy) {\n    return {\n      items: categories.map((category) => ({\n        category,\n        depth: 0,\n        parent: null,\n        displayName: category.name,\n      })),\n      roots: categories.filter((category) => category.parentId === null),\n      hasHierarchy: false,\n    };\n  }\n\n  const roots = categories.filter(\n    (category) => category.parentId === null || !byId.has(category.parentId),\n  );\n  const childrenByParent = new Map<string, PlatformCategory[]>();\n  for (const category of categories) {\n    if (!category.parentId || !byId.has(category.parentId)) continue;\n    const children = childrenByParent.get(category.parentId) ?? [];\n    children.push(category);\n    childrenByParent.set(category.parentId, children);\n  }\n\n  const items: CategoryHierarchyItem[] = [];\n  const seen = new Set<string>();\n  for (const root of roots) {\n    items.push({\n      category: root,\n      depth: 0,\n      parent: null,\n      displayName: root.name,\n    });\n    seen.add(root.id);\n\n    for (const child of childrenByParent.get(root.id) ?? []) {\n      items.push({\n        category: child,\n        depth: 1,\n        parent: root,\n        displayName: `${root.name} / ${child.name}`,\n      });\n      seen.add(child.id);\n    }\n  }\n\n  // Loud database guards make this fallback unreachable for valid data, but a\n  // picker must never hide an identity merely because older data is malformed.\n  for (const category of categories) {\n    if (seen.has(category.id)) continue;\n    items.push({\n      category,\n      depth: 0,\n      parent: null,\n      displayName: category.name,\n    });\n  }\n\n  return {\n    items,\n    roots: categories.filter((category) => category.parentId === null),\n    hasHierarchy: true,\n  };\n}\n","// react/components/CategoryTagPicker.tsx — @ai-matrx/associations/react\n//\n// THE multi-select picker that tags an entity with `platform.categories` rows\n// through the canonical association edge (`entity → category`, one typed edge\n// role per use). The generic form of the flashcards FolderTagPicker — that\n// component is a thin wrapper over this one, and CRM party roles consume\n// it directly. Never fork a per-feature tag picker.\n//\n// Reads/writes go through the canonical `useCategories` (category nouns) +\n// `useAssociations` (assignment edges) hooks — never a bespoke table or a\n// direct service call.\n//\n// EDGE SEMANTICS: `setTargets` replaces ALL of this entity's category edges\n// carrying `edgeRole`. To keep edges from OTHER dimensions that share the same\n// role intact, the toggle set starts from every current category edge with\n// this role (not just this dimension's) — same contract FolderTagPicker\n// established. Prefer a distinct edge role per dimension when registering\n// association pairs.\n//\n// Ported VERBATIM from matrx-frontend\n// `features/scopes/components/CategoryTagPicker.tsx` (W4 completion,\n// 2026-08-29 — the face was gated on design-system 0.3.0's Command family +\n// Select). Seams inverted:\n//   • `ensureOrgId` (the host-shaped organization resolver) → the identity\n//     port's optional `ensureOrgId()`\n//     per the design's seam table: the `orgId` prop wins; otherwise\n//     `identity.ensureOrgId()` is asked; with neither, create refuses LOUDLY\n//     (notifier + errorSink) — never a row stamped with a guessed org;\n//   • `@/lib/toast` → the notifier port; `console.error` → the errorSink;\n//   • `useCategories`/`useAssociations`/`buildCategoryHierarchy` → the\n//     package's own;\n//   • lucide glyphs → the package's inlined SVGs (C19); the `icon` prop's\n//     `LucideIcon` type → a structural icon component type;\n//   • Button/Popover/Command/Badge/Select → `@ai-matrx/design-system`\n//     (>=0.3.0).\n\nimport { useState, type ComponentType } from \"react\";\nimport {\n  Badge,\n  Button,\n  cn,\n  Command,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n  SelectChevron,\n} from \"@ai-matrx/design-system\";\n\nimport type { CategoryDimension } from \"../../edges\";\nimport { buildCategoryHierarchy } from \"../../core/categoryHierarchy\";\nimport { useAssociationsStore, useNotifier } from \"../context\";\nimport { useAssociations } from \"../hooks/useAssociations\";\nimport { useCategories } from \"../hooks/useCategories\";\nimport { CornerDownRightIcon, SpinnerIcon, TagIcon } from \"../icons\";\nimport { CheckIcon, XIcon } from \"@ai-matrx/design-system/icons\";\n\nconst ROOT_PARENT = \"__root__\";\n\n/** Structural stand-in for the host's `LucideIcon` on the `icon` prop. */\nexport type TagPickerIcon = ComponentType<{ className?: string }>;\n\nexport interface CategoryTagPickerProps {\n  /** The tagged entity's registered association type (e.g. \"fc_set\", \"party\"). */\n  entityType: string;\n  entityId: string;\n  /** The `platform.categories` facet the picker offers. */\n  dimension: CategoryDimension;\n  /** The typed edge role the assignment edges carry (e.g. \"theme\", \"member\"). */\n  edgeRole: string;\n  /**\n   * Org for the edge write and for inline-created categories. Defaults to the\n   * identity port's `ensureOrgId()` (create only) — pass the owning entity's\n   * org when it has one.\n   */\n  orgId?: string | null;\n  /** Trigger label while nothing is selected. */\n  addLabel?: string;\n  /** Trigger icon. */\n  icon?: TagPickerIcon;\n  /** Offer \"Create <term>\" for unmatched search terms. Default true. */\n  allowCreate?: boolean;\n  /**\n   * Force the two-level face on or off. Omit to detect it from parentId rows,\n   * which leaves every existing flat facet visually unchanged.\n   */\n  hierarchical?: boolean;\n  emptyText?: string;\n}\n\n/**\n * Multi-select combobox: badges for the entity's current tags in `dimension`,\n * a popover to toggle existing categories, optional inline create. Fully\n * self-contained — mount it once per entity and it reads/writes the edges.\n */\nexport function CategoryTagPicker({\n  entityType,\n  entityId,\n  dimension,\n  edgeRole,\n  orgId,\n  addLabel = \"Add tag\",\n  icon: Icon = TagIcon,\n  allowCreate = true,\n  hierarchical,\n  emptyText = \"No categories yet.\",\n}: CategoryTagPickerProps) {\n  const store = useAssociationsStore();\n  const notifier = useNotifier();\n  const [open, setOpen] = useState(false);\n  const [creating, setCreating] = useState(false);\n  // Writes replace the full role-set from a render-time snapshot of the\n  // edges, so overlapping toggles would silently drop the first change.\n  // One write at a time.\n  const [writing, setWriting] = useState(false);\n  const [search, setSearch] = useState(\"\");\n  const [createParentId, setCreateParentId] = useState(ROOT_PARENT);\n  const {\n    categories,\n    create: createCategory,\n    reload: reloadCategories,\n  } = useCategories({ dimension });\n  const { edges, setTargets } = useAssociations({\n    type: entityType,\n    id: entityId,\n  });\n  const hierarchy = buildCategoryHierarchy(categories);\n  const showHierarchy = hierarchical ?? hierarchy.hasHierarchy;\n  const hierarchyById = new Map(\n    hierarchy.items.map((item) => [item.category.id, item]),\n  );\n\n  // Every current category edge with this role — INCLUDING other dimensions'\n  // (see EDGE SEMANTICS above); display intersects with this dimension.\n  const selectedIds = new Set(\n    edges\n      .filter(\n        (e) =>\n          e.direction === \"outgoing\" &&\n          e.otherType === \"category\" &&\n          e.role === edgeRole,\n      )\n      .map((e) => e.otherId),\n  );\n  const selected = categories.filter((c) => selectedIds.has(c.id));\n\n  const toggle = async (categoryId: string) => {\n    if (writing) return;\n    setWriting(true);\n    try {\n      const next = selectedIds.has(categoryId)\n        ? [...selectedIds].filter((id) => id !== categoryId)\n        : [...selectedIds, categoryId];\n      const res = await setTargets({\n        targetType: \"category\",\n        targetIds: next,\n        ...(orgId != null ? { orgId } : {}),\n        role: edgeRole,\n      });\n      if (!res.ok) {\n        store.errorSink({\n          code: \"category_tag_set_targets_failed\",\n          message: \"[CategoryTagPicker] setTargets failed\",\n          context: { entityType, entityId, edgeRole, error: res.error },\n        });\n        notifier.error(res.error ?? \"Could not update categories\");\n      }\n    } finally {\n      setWriting(false);\n    }\n  };\n\n  const createAndAttach = async () => {\n    const name = search.trim();\n    if (!name) return;\n    setCreating(true);\n    try {\n      let resolvedOrgId = orgId ?? null;\n      if (!resolvedOrgId && store.identity.ensureOrgId) {\n        try {\n          resolvedOrgId = await store.identity.ensureOrgId();\n        } catch (e) {\n          store.errorSink({\n            code: \"ensure_org_failed\",\n            message: \"[CategoryTagPicker] identity.ensureOrgId threw\",\n            context: { error: e instanceof Error ? e.message : String(e) },\n          });\n        }\n      }\n      if (!resolvedOrgId) {\n        store.errorSink({\n          code: \"ensure_org_missing\",\n          message:\n            \"[CategoryTagPicker] no org for the created category — pass \" +\n            \"`orgId` or bind `identity.ensureOrgId` on the store config\",\n          context: { entityType, entityId, dimension },\n        });\n        notifier.error(\n          \"Could not create the category — no organization is selected\",\n        );\n        return;\n      }\n      const parentId =\n        showHierarchy && createParentId !== ROOT_PARENT ? createParentId : null;\n      const createRes = await createCategory({\n        name,\n        orgId: resolvedOrgId,\n        parentId,\n      });\n      if (!createRes.ok || !createRes.id) {\n        store.errorSink({\n          code: \"category_tag_create_failed\",\n          message: \"[CategoryTagPicker] create failed\",\n          context: { dimension, error: createRes.error },\n        });\n        notifier.error(createRes.error ?? \"Could not create the category\");\n        return;\n      }\n      await reloadCategories();\n      await toggle(createRes.id);\n      setSearch(\"\");\n      setCreateParentId(ROOT_PARENT);\n    } finally {\n      setCreating(false);\n    }\n  };\n\n  const filtered = categories.filter((c) =>\n    c.name.toLowerCase().includes(search.trim().toLowerCase()),\n  );\n  const filteredHierarchy = hierarchy.items.filter((item) =>\n    item.displayName.toLowerCase().includes(search.trim().toLowerCase()),\n  );\n  const exactMatch = categories.some(\n    (c) => c.name.toLowerCase() === search.trim().toLowerCase(),\n  );\n\n  return (\n    <div className=\"flex flex-wrap items-center gap-1.5\">\n      {selected.map((c) => (\n        <Badge\n          key={c.id}\n          variant=\"secondary\"\n          className=\"gap-1 pr-1 text-xs font-medium\"\n        >\n          {showHierarchy\n            ? (hierarchyById.get(c.id)?.displayName ?? c.name)\n            : c.name}\n          <button\n            type=\"button\"\n            onClick={() => void toggle(c.id)}\n            className=\"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20\"\n            aria-label={`Remove ${c.name}`}\n          >\n            <XIcon className=\"h-2.5 w-2.5\" />\n          </button>\n        </Badge>\n      ))}\n\n      <Popover open={open} onOpenChange={setOpen}>\n        <PopoverTrigger asChild>\n          <Button\n            variant=\"outline\"\n            size=\"sm\"\n            className=\"h-7 gap-1 px-2 text-xs\"\n          >\n            <Icon className=\"h-3.5 w-3.5\" />\n            {selected.length === 0 ? addLabel : \"Edit\"}\n            <SelectChevron size=\"sm\" />\n          </Button>\n        </PopoverTrigger>\n        <PopoverContent sizing=\"content\" className=\"p-0\" align=\"start\">\n          <Command shouldFilter={false}>\n            <CommandInput\n              placeholder={allowCreate ? \"Search or create...\" : \"Search...\"}\n              value={search}\n              onValueChange={setSearch}\n            />\n            <CommandList>\n              <CommandEmpty className=\"px-2 py-3 text-xs text-muted-foreground\">\n                {search.trim() ? \"No match.\" : emptyText}\n              </CommandEmpty>\n              <CommandGroup>\n                {showHierarchy\n                  ? filteredHierarchy.map(({ category, depth, parent }) => (\n                      <CommandItem\n                        key={category.id}\n                        value={category.id}\n                        keywords={parent ? [parent.name, category.name] : []}\n                        onSelect={() => void toggle(category.id)}\n                        className={cn(\"\", depth === 1 && \"\")}\n                      >\n                        <CheckIcon\n                          className={cn(\n                            \"mr-2 h-3.5 w-3.5\",\n                            selectedIds.has(category.id)\n                              ? \"opacity-100\"\n                              : \"opacity-0\",\n                          )}\n                        />\n                        {depth === 1 ? (\n                          <CornerDownRightIcon className=\"mr-1.5 h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n                        ) : null}\n                        <span className={cn(depth === 0 && \"font-medium\")}>\n                          {category.name}\n                        </span>\n                      </CommandItem>\n                    ))\n                  : filtered.map((c) => (\n                      <CommandItem\n                        key={c.id}\n                        value={c.id}\n                        onSelect={() => void toggle(c.id)}\n                        className=\"\"\n                      >\n                        <CheckIcon\n                          className={cn(\n                            \"mr-2 h-3.5 w-3.5\",\n                            selectedIds.has(c.id) ? \"opacity-100\" : \"opacity-0\",\n                          )}\n                        />\n                        {c.name}\n                      </CommandItem>\n                    ))}\n              </CommandGroup>\n              {allowCreate && search.trim() && !exactMatch ? (\n                <CommandGroup>\n                  {showHierarchy ? (\n                    <div className=\"space-y-1.5 px-2 pb-2\">\n                      <p className=\"text-[11px] font-medium text-muted-foreground\">\n                        Place in\n                      </p>\n                      <Select\n                        value={createParentId}\n                        onValueChange={setCreateParentId}\n                      >\n                        <SelectTrigger size=\"sm\" className=\"bg-background\">\n                          <SelectValue />\n                        </SelectTrigger>\n                        <SelectContent>\n                          <SelectItem value={ROOT_PARENT}>Top level</SelectItem>\n                          {hierarchy.roots.map((root) => (\n                            <SelectItem key={root.id} value={root.id}>\n                              {root.name}\n                            </SelectItem>\n                          ))}\n                        </SelectContent>\n                      </Select>\n                    </div>\n                  ) : null}\n                  <CommandItem\n                    value={`__create__${search}`}\n                    onSelect={() => void createAndAttach()}\n                    disabled={creating}\n                    className=\"text-primary\"\n                  >\n                    {creating ? (\n                      <SpinnerIcon className=\"mr-2 h-3.5 w-3.5 animate-spin\" />\n                    ) : (\n                      <Icon className=\"mr-2 h-3.5 w-3.5\" />\n                    )}\n                    Create &ldquo;{search.trim()}&rdquo;\n                  </CommandItem>\n                </CommandGroup>\n              ) : null}\n            </CommandList>\n          </Command>\n        </PopoverContent>\n      </Popover>\n    </div>\n  );\n}\n","// react/components/CommentThread.tsx — @ai-matrx/associations/react\n//\n// THE canonical comments UI (W6, ruling C4: built IN the package — a\n// greenfield build; no matrx-frontend components existed to port). Drop it on\n// any surface with a bound AssociationsProvider and hand it an entity:\n//\n//   <CommentThread token=\"task\" id={taskId} />\n//\n// One threaded comment list over the `platform.comments` primitive\n// (`useComments` → the /core store → the four `cmt_*` demanded RPCs):\n// top-level comments oldest→newest with nested replies, a composer, per-item\n// reply, and edit/delete-own — the RPCs are the authority on who may write\n// (edit is author-only, delete is author-or-org-member); the UI only gates\n// the AFFORDANCES by the lenient identity read, so a stale gate degrades to\n// a loud server refusal, never a silent success.\n//\n// Ports and degradations:\n//   • authorDisplay (optional) — host profile enrichment; absent → the\n//     RPC's denormalized author fields, \"Unknown user\" + initial avatar as\n//     the last resort. Never blank.\n//   • entityDoors.EntityRef (optional) — author names become doors to the\n//     user entity; absent → plain text names.\n//   • notifier (optional) — failure toasts; absent → the provider's\n//     documented warn-once + errorSink routing. Failures ALSO render inline.\n//   • Chrome from @ai-matrx/design-system (peer >=0.3.0); glyphs inlined\n//     (C19).\n//\n// Destructive-click law: Delete stops and names the consequence inline\n// (\"Deletes this comment (and its replies' context) for everyone.\") before\n// the destructive click exists. Composer text is NEVER lost on a failed\n// post — the body stays in the box alongside the inline error.\n\nimport { useState, type FormEvent, type ReactNode } from \"react\";\nimport { Button, ErrorBox, Skeleton, cn } from \"@ai-matrx/design-system\";\n\nimport { partKeyOf, type PartAnchor, type PlatformComment } from \"../../comments\";\nimport type { EntityTypeToken } from \"../../entity-types.generated\";\nimport type { AuthorDisplayPort, EntityDoorsPort } from \"../../ports\";\nimport { useAssociationsUiPorts, useNotifier } from \"../context\";\nimport { isSignedOutMessage } from \"../../core/rpcResult\";\nimport { useComments, type UseCommentsReturn } from \"../hooks/useComments\";\nimport { CommentBody } from \"./CommentBody\";\nimport { CornerDownRightIcon, RefreshIcon, SpinnerIcon } from \"../icons\";\nimport { formatRelativeTime } from \"@ai-matrx/kit/format\";\n\n/** The token the author-name door opens (auth users surface as `user`). */\nconst AUTHOR_DOOR_TOKEN = \"user\";\n\nexport interface CommentThreadProps {\n  /** Entity-type token of the commented-on entity. */\n  token: EntityTypeToken;\n  /** The entity's row id. */\n  id: string;\n  /**\n   * Org override forwarded to `cmt_add`. Optional: the RPC reads the commented\n   * record's OWN organization when this is omitted, and refuses a value that\n   * disagrees with it (22023). It never falls back to the author's workspace.\n   */\n  orgId?: string | null;\n  /** Hide the slim \"Comments · n\" header row. Defaults to shown. */\n  showHeader?: boolean;\n  /**\n   * Told once per comment the person posts here (a new comment or a reply),\n   * after the door saved it. The host decides what follows (e.g. the comment\n   * rides along with the person's next chat message). Never called on a failure.\n   */\n  onPosted?: (posted: PostedComment) => void;\n  /**\n   * The thread is about ONE PART of the record (a board-only tile): the\n   * thread shows only that part's comments (and their replies), and a new\n   * comment is stored with a `part_anchor` naming it. Omitted = the whole\n   * record's thread, where each part comment carries its part's name.\n   */\n  part?: { key: string; label: string };\n  className?: string;\n}\n\n/** What `onPosted` is told: the saved row's id, the words, and the comment it answers. */\nexport interface PostedComment {\n  id: string;\n  body: string;\n  /** The comment this one replies to; null for a new top-level comment. */\n  parentId: string | null;\n}\n\n// ─── author chrome (authorDisplay + entityDoors degradations) ───────────────\n\n/** The name a system-written comment is credited to. */\nexport const SYSTEM_AUTHOR_NAME = \"AI Matrx\";\n\ninterface ResolvedAuthor {\n  name: string;\n  avatarUrl: string | null;\n  userId: string | null;\n  /** An agent wrote this: no profile door, never editable by anyone. */\n  isAgent: boolean;\n  /** The platform wrote this: no profile door, never editable by anyone. */\n  isSystem?: boolean;\n}\n\nfunction resolveAuthor(\n  comment: PlatformComment,\n  authorDisplay: AuthorDisplayPort | undefined,\n): ResolvedAuthor {\n  if (comment.authorSystem) {\n    // The platform wrote it (an edit remark's thread opener): never the person it is filed under.\n    return { name: SYSTEM_AUTHOR_NAME, avatarUrl: null, userId: null, isAgent: false, isSystem: true };\n  }\n  if (comment.authorAgent) {\n    return {\n      name: comment.authorAgent.name ?? \"Agent\",\n      avatarUrl: null,\n      userId: null,\n      isAgent: true,\n    };\n  }\n  const base = {\n    userId: comment.createdBy,\n    email: comment.author.email,\n    displayName: comment.author.displayName,\n    avatarUrl: comment.author.avatarUrl,\n  };\n  const enriched = authorDisplay ? authorDisplay(base) : null;\n  const name =\n    enriched?.displayName ??\n    base.displayName ??\n    base.email ??\n    \"Unknown user\";\n  return {\n    name,\n    avatarUrl:\n      enriched?.avatarUrl !== undefined && enriched?.avatarUrl !== null\n        ? enriched.avatarUrl\n        : base.avatarUrl,\n    userId: comment.createdBy,\n    isAgent: false,\n  };\n}\n\nfunction AuthorAvatar({ author }: { author: ResolvedAuthor }) {\n  if (author.avatarUrl) {\n    return (\n      <img\n        src={author.avatarUrl}\n        alt=\"\"\n        className=\"h-6 w-6 shrink-0 rounded-full object-cover\"\n      />\n    );\n  }\n  return (\n    <span\n      aria-hidden\n      className=\"flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-muted text-[11px] font-medium uppercase text-muted-foreground\"\n    >\n      {author.name.trim().charAt(0) || \"?\"}\n    </span>\n  );\n}\n\nfunction AuthorName({\n  author,\n  entityDoors,\n}: {\n  author: ResolvedAuthor;\n  entityDoors: EntityDoorsPort | undefined;\n}) {\n  const DoorRef = entityDoors?.EntityRef;\n  if (DoorRef && author.userId) {\n    return (\n      <DoorRef\n        token={AUTHOR_DOOR_TOKEN}\n        id={author.userId}\n        name={author.name}\n        showIcon={false}\n        className=\"text-sm font-medium text-foreground\"\n      />\n    );\n  }\n  return (\n    <span className=\"text-sm font-medium text-foreground\">{author.name}</span>\n  );\n}\n\n// ─── composer ───────────────────────────────────────────────────────────────\n\nexport interface CommentComposerProps {\n  /** Post the body; resolve `{ok:false}` to keep the text + show the error. */\n  onSubmit: (body: string) => Promise<{ ok: boolean; error?: string }>;\n  placeholder?: string;\n  submitLabel?: string;\n  /** Initial body (the edit flow seeds the current text). */\n  initialValue?: string;\n  /** Rendered right of the submit button (the Cancel affordance). */\n  trailing?: ReactNode;\n  autoFocus?: boolean;\n}\n\n/**\n * The one composer every comment write goes through (new comment, reply,\n * edit). Submit on the button or Cmd/Ctrl+Enter; the text survives a failed\n * submit alongside the inline error (input is never lost).\n */\nexport function CommentComposer({\n  onSubmit,\n  placeholder = \"Write a comment…\",\n  submitLabel = \"Comment\",\n  initialValue = \"\",\n  trailing,\n  autoFocus = false,\n}: CommentComposerProps) {\n  const notifier = useNotifier();\n  const { signIn } = useAssociationsUiPorts();\n  const [body, setBody] = useState(initialValue);\n  const [submitting, setSubmitting] = useState(false);\n  const [error, setError] = useState<string | null>(null);\n\n  async function submit(e?: FormEvent) {\n    e?.preventDefault();\n    const trimmed = body.trim();\n    if (!trimmed || submitting) return;\n    setSubmitting(true);\n    setError(null);\n    const res = await onSubmit(trimmed);\n    setSubmitting(false);\n    if (!res.ok) {\n      const msg = res.error ?? \"Could not save the comment\";\n      setError(msg);\n      notifier.error(msg);\n      return; // the body stays — user input is never lost\n    }\n    setBody(\"\");\n  }\n\n  return (\n    <form onSubmit={submit} className=\"flex flex-col gap-1.5\">\n      <textarea\n        value={body}\n        onChange={(e) => setBody(e.target.value)}\n        onKeyDown={(e) => {\n          if (e.key === \"Enter\" && (e.metaKey || e.ctrlKey)) void submit();\n        }}\n        placeholder={placeholder}\n        rows={2}\n        autoFocus={autoFocus}\n        aria-label={placeholder}\n        className=\"w-full resize-y rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n      />\n      {error && (\n        <ErrorBox\n          className=\"text-xs text-destructive\"\n          message={error}\n          operation=\"Post a comment\"\n          unsavedInput={{ comment: body }}\n          origin=\"associations/CommentThread\"\n        />\n      )}\n      {error && signIn && isSignedOutMessage(error) && (\n        <SignInAgain onClick={signIn} />\n      )}\n      <div className=\"flex items-center gap-2\">\n        <Button type=\"submit\" size=\"sm\" disabled={!body.trim() || submitting}>\n          {submitting && (\n            <SpinnerIcon className=\"mr-1 h-3 w-3 animate-spin\" />\n          )}\n          {submitLabel}\n        </Button>\n        {trailing}\n      </div>\n    </form>\n  );\n}\n\n// ─── one comment (recursive) ────────────────────────────────────────────────\n\ninterface CommentItemProps {\n  comment: PlatformComment;\n  childrenOf: Map<string, PlatformComment[]>;\n  depth: number;\n  thread: UseCommentsReturn;\n  orgId: string | null | undefined;\n  onPosted: ((posted: PostedComment) => void) | undefined;\n  /** Name the part a top-level comment is on (the whole-record thread). */\n  showPart?: boolean;\n}\n\nfunction partLabelOf(comment: PlatformComment): string | null {\n  if (partKeyOf(comment) === null) return null;\n  const label = comment.anchor?.label;\n  return typeof label === \"string\" && label ? label : \"a part\";\n}\n\nfunction CommentItem({\n  comment,\n  childrenOf,\n  depth,\n  thread,\n  orgId,\n  onPosted,\n  showPart = false,\n}: CommentItemProps) {\n  const { authorDisplay, entityDoors } = useAssociationsUiPorts();\n  const notifier = useNotifier();\n  const [replying, setReplying] = useState(false);\n  const [editing, setEditing] = useState(false);\n  const [confirmingDelete, setConfirmingDelete] = useState(false);\n  const [deleting, setDeleting] = useState(false);\n\n  const author = resolveAuthor(comment, authorDisplay);\n  // An agent wrote it under this person's authority: Delete stays theirs, Edit never\n  // (an agent's words are not rewritten under its name — the RPC refuses it too).\n  const isOwn =\n    thread.currentUserId !== null &&\n    comment.createdBy === thread.currentUserId;\n  const canEdit = isOwn && !author.isAgent && !author.isSystem;\n  const partLabel = partLabelOf(comment);\n  const edited = comment.updatedAt !== comment.createdAt;\n  const replies = childrenOf.get(comment.id) ?? [];\n\n  async function confirmDelete() {\n    setDeleting(true);\n    const res = await thread.remove(comment.id);\n    setDeleting(false);\n    setConfirmingDelete(false);\n    if (!res.ok) {\n      notifier.error(res.error ?? \"Could not delete the comment\");\n    }\n  }\n\n  return (\n    <div\n      data-comment-id={comment.id}\n      className={cn(\n        \"flex flex-col gap-1\",\n        depth > 0 && \"border-l border-border pl-3\",\n      )}\n    >\n      <div className=\"flex items-center gap-2\">\n        <AuthorAvatar author={author} />\n        <AuthorName author={author} entityDoors={entityDoors} />\n        {author.isAgent && (\n          <span className=\"rounded bg-muted px-1 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n            Agent\n          </span>\n        )}\n        {showPart && partLabel && (\n          <span className=\"truncate text-xs text-muted-foreground\" title={partLabel}>\n            on {partLabel}\n          </span>\n        )}\n        <span\n          className=\"text-xs text-muted-foreground\"\n          title={comment.createdAt}\n        >\n          {formatRelativeTime(comment.createdAt, {\n            style: \"intl\",\n            fallbackToInput: true,\n          })}\n        </span>\n        {edited && (\n          <span\n            className=\"text-xs text-muted-foreground\"\n            title={comment.updatedAt}\n          >\n            (edited)\n          </span>\n        )}\n      </div>\n\n      {editing ? (\n        <div className=\"pl-8\">\n          <CommentComposer\n            initialValue={comment.body}\n            submitLabel=\"Save\"\n            placeholder=\"Edit your comment…\"\n            autoFocus\n            onSubmit={async (body) => {\n              const res = await thread.edit(comment.id, body);\n              if (res.ok) setEditing(false);\n              return res;\n            }}\n            trailing={\n              <Button\n                type=\"button\"\n                size=\"sm\"\n                variant=\"ghost\"\n                onClick={() => setEditing(false)}\n              >\n                Cancel\n              </Button>\n            }\n          />\n        </div>\n      ) : (\n        <CommentBody body={comment.body} className=\"pl-8\" />\n      )}\n\n      {!editing && (\n        <div className=\"flex items-center gap-1 pl-7\">\n          {confirmingDelete ? (\n            <>\n              <span className=\"text-xs text-destructive\">\n                Deletes this comment for everyone.\n              </span>\n              <Button\n                type=\"button\"\n                size=\"sm\"\n                variant=\"destructive\"\n                disabled={deleting}\n                onClick={() => void confirmDelete()}\n              >\n                {deleting && (\n                  <SpinnerIcon className=\"mr-1 h-3 w-3 animate-spin\" />\n                )}\n                Delete\n              </Button>\n              <Button\n                type=\"button\"\n                size=\"sm\"\n                variant=\"ghost\"\n                disabled={deleting}\n                onClick={() => setConfirmingDelete(false)}\n              >\n                Cancel\n              </Button>\n            </>\n          ) : (\n            <>\n              <button\n                type=\"button\"\n                onClick={() => setReplying((v) => !v)}\n                className=\"rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n              >\n                Reply\n              </button>\n              {isOwn && (\n                <>\n                  {canEdit && (\n                    <button\n                      type=\"button\"\n                      onClick={() => setEditing(true)}\n                      className=\"rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n                    >\n                      Edit\n                    </button>\n                  )}\n                  <button\n                    type=\"button\"\n                    onClick={() => setConfirmingDelete(true)}\n                    className=\"rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-destructive\"\n                  >\n                    Delete\n                  </button>\n                </>\n              )}\n            </>\n          )}\n        </div>\n      )}\n\n      {replying && (\n        <div className=\"flex items-start gap-2 pl-8 pt-1\">\n          <CornerDownRightIcon className=\"mt-2 h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n          <div className=\"min-w-0 flex-1\">\n            <CommentComposer\n              submitLabel=\"Reply\"\n              placeholder={`Reply to ${author.name}…`}\n              autoFocus\n              onSubmit={async (body) => {\n                const res = await thread.add(body, {\n                  parentId: comment.id,\n                  orgId: orgId ?? null,\n                });\n                if (res.ok) {\n                  setReplying(false);\n                  if (res.id) onPosted?.({ id: res.id, body, parentId: comment.id });\n                }\n                return res;\n              }}\n              trailing={\n                <Button\n                  type=\"button\"\n                  size=\"sm\"\n                  variant=\"ghost\"\n                  onClick={() => setReplying(false)}\n                >\n                  Cancel\n                </Button>\n              }\n            />\n          </div>\n        </div>\n      )}\n\n      {replies.length > 0 && (\n        <div className=\"flex flex-col gap-3 pl-8 pt-1\">\n          {replies.map((reply) => (\n            <CommentItem\n              key={reply.id}\n              comment={reply}\n              childrenOf={childrenOf}\n              depth={depth + 1}\n              thread={thread}\n              orgId={orgId}\n              onPosted={onPosted}\n            />\n          ))}\n        </div>\n      )}\n    </div>\n  );\n}\n\n// ─── the thread face ────────────────────────────────────────────────────────\n\n/**\n * Build the parent→children index. A reply whose parent is missing from the\n * list (soft-deleted parent, partial page) is promoted to top level rather\n * than dropped — every visible comment stays reachable.\n */\nexport function buildCommentTree(comments: readonly PlatformComment[]): {\n  roots: PlatformComment[];\n  childrenOf: Map<string, PlatformComment[]>;\n} {\n  const byId = new Set(comments.map((c) => c.id));\n  const roots: PlatformComment[] = [];\n  const childrenOf = new Map<string, PlatformComment[]>();\n  for (const c of comments) {\n    if (c.parentId && byId.has(c.parentId)) {\n      const bucket = childrenOf.get(c.parentId);\n      if (bucket) bucket.push(c);\n      else childrenOf.set(c.parentId, [c]);\n    } else {\n      roots.push(c);\n    }\n  }\n  return { roots, childrenOf };\n}\n\nfunction countThread(\n  roots: readonly PlatformComment[],\n  childrenOf: Map<string, PlatformComment[]>,\n): number {\n  let n = 0;\n  const walk = (c: PlatformComment) => {\n    n += 1;\n    for (const r of childrenOf.get(c.id) ?? []) walk(r);\n  };\n  roots.forEach(walk);\n  return n;\n}\n\nexport function CommentThread({\n  token,\n  id,\n  orgId,\n  showHeader = true,\n  onPosted,\n  part,\n  className,\n}: CommentThreadProps) {\n  const thread = useComments({ token, id });\n  const { signIn: signInPort } = useAssociationsUiPorts();\n  const tree = buildCommentTree(thread.comments);\n  const { childrenOf } = tree;\n  // A part's thread is that part's comments only; the whole record's thread names each part.\n  const roots = part\n    ? tree.roots.filter((c) => partKeyOf(c) === part.key)\n    : tree.roots;\n  const shownCount = part ? countThread(roots, childrenOf) : thread.comments.length;\n  const loading =\n    (thread.status === \"loading\" || thread.status === \"idle\") &&\n    thread.comments.length === 0;\n\n  return (\n    <section className={cn(\"flex flex-col gap-3\", className)}>\n      {showHeader && (\n        <header className=\"flex items-center gap-2\">\n          <h3 className=\"text-sm font-semibold text-foreground\">Comments</h3>\n          <span className=\"text-xs text-muted-foreground tabular-nums\">\n            {shownCount}\n          </span>\n          <button\n            type=\"button\"\n            onClick={() => void thread.reload()}\n            aria-label=\"Refresh comments\"\n            title=\"Refresh comments\"\n            className=\"ml-auto flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n          >\n            {thread.status === \"loading\" ? (\n              <SpinnerIcon className=\"h-3.5 w-3.5 animate-spin\" />\n            ) : (\n              <RefreshIcon className=\"h-3.5 w-3.5\" />\n            )}\n          </button>\n        </header>\n      )}\n\n      {thread.error && (\n        <ErrorBox\n          as=\"div\"\n          className=\"flex items-center gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive\"\n          message={thread.error}\n          operation=\"Load comments\"\n          origin=\"associations/CommentThread\"\n        >\n          <span className=\"min-w-0 flex-1\">{thread.error}</span>\n          {signInPort && isSignedOutMessage(thread.error) && (\n            <SignInAgain onClick={signInPort} />\n          )}\n          <Button\n            type=\"button\"\n            size=\"sm\"\n            variant=\"outline\"\n            disabled={thread.status === \"loading\"}\n            onClick={() => void thread.reload()}\n          >\n            Retry\n          </Button>\n        </ErrorBox>\n      )}\n\n      {loading ? (\n        <div className=\"flex flex-col gap-3\" aria-hidden data-testid=\"comments-loading\">\n          <Skeleton className=\"h-12 w-full\" />\n          <Skeleton className=\"h-12 w-4/5\" />\n        </div>\n      ) : roots.length === 0 && !thread.error ? (\n        <p className=\"text-sm text-muted-foreground\">No comments yet.</p>\n      ) : (\n        <div className=\"flex flex-col gap-4\">\n          {roots.map((comment) => (\n            <CommentItem\n              key={comment.id}\n              comment={comment}\n              childrenOf={childrenOf}\n              depth={0}\n              thread={thread}\n              orgId={orgId}\n              onPosted={onPosted}\n              showPart={!part}\n            />\n          ))}\n        </div>\n      )}\n\n      <CommentComposer\n        onSubmit={async (body) => {\n          const anchor: PartAnchor | null = part\n            ? { __kind: \"part_anchor\", part_key: part.key, label: part.label.slice(0, 200) }\n            : null;\n          const res = await thread.add(body, { orgId: orgId ?? null, anchor });\n          if (res.ok && res.id) onPosted?.({ id: res.id, body, parentId: null });\n          return res;\n        }}\n      />\n    </section>\n  );\n}\n\nexport default CommentThread;\n\n/** The one remedy for a signed-out failure: the host's sign-in (a new tab; the text here stays). */\nfunction SignInAgain({ onClick }: { onClick: () => void }) {\n  return (\n    <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={onClick}>\n      Sign in\n    </Button>\n  );\n}\n","// src/comments.ts — @ai-matrx/associations\n//\n// Canonical types for the unified comments primitive — `platform.comments`\n// (W6: the comments canonical UI is built IN this package, ruling C4). One\n// comment table for EVERY entity on the platform, threaded via `parentId`,\n// reached ONLY through the four PUBLIC SECURITY-DEFINER RPCs\n// (`cmt_list` / `cmt_add` / `cmt_edit` / `cmt_delete`) — part of this\n// package's demanded schema, called only by `/core`'s comments service.\n//\n// Types ported from matrx-frontend `features/comments/types.ts`\n// (2026-08-29) and renamed to the package vocabulary (`PlatformComment`,\n// mirroring `PlatformCategory`). The access boundary travels with them: a\n// comment rides the association/access model — read and write rights\n// are decided INSIDE the RPCs (org membership + authorship), this package\n// makes zero access decisions.\n\n/** The author of a comment, denormalized by `cmt_list` from the auth user. */\nexport interface CommentAuthor {\n  email: string | null;\n  displayName: string | null;\n  avatarUrl: string | null;\n}\n\n/**\n * One `platform.comments` row, camelCased (mirrors `cmt_list`'s return).\n * Threading is by `parentId`: a top-level comment has `parentId === null`;\n * a reply points at its parent. `cmt_list` returns rows oldest→newest so\n * callers can build the thread in one pass.\n */\nexport interface PlatformComment {\n  id: string;\n  orgId: string | null;\n  entityType: string;\n  entityId: string;\n  parentId: string | null;\n  body: string;\n  createdAt: string;\n  updatedAt: string;\n  createdBy: string | null;\n  author: CommentAuthor;\n  /**\n   * The platform agent that wrote this comment (a reply the agent made in the\n   * thread), or null when a person did. `createdBy` stays the person whose\n   * authority it ran under — an agent's comment is never \"mine\" and has no Edit.\n   */\n  authorAgent: CommentAgentAuthor | null;\n  /**\n   * The platform itself wrote this comment (`created_by_tier = 'system'`, e.g. the opener of\n   * an edit remark's thread): credited to the system, never to `createdBy`, never editable.\n   */\n  authorSystem?: boolean;\n  /** The comment's anchor (`text_anchor` passage, `part_anchor` part, ...), or null for the whole record. */\n  anchor: CommentAnchor | null;\n}\n\n/** The agent behind a comment (`cmt_list`'s author_agent_id/name). */\nexport interface CommentAgentAuthor {\n  id: string;\n  name: string | null;\n}\n\n/** A comment's anchor as stored: a `__kind`-marked object (`platform.comments.anchor`). */\nexport type CommentAnchor = { __kind: string } & Record<string, unknown>;\n\n/**\n * `part_anchor`: a comment on one PART of a record that is not a record of its\n * own — a board-only tile is `tile:<tile id>`. The database validates it\n * (`platform.part_anchor_problem`, and for a board that the tile exists).\n */\nexport interface PartAnchor extends Record<string, unknown> {\n  __kind: \"part_anchor\";\n  part_key: string;\n  label?: string;\n}\n\n/** The part a comment is on, or null when it is on the whole record / a passage. */\nexport function partKeyOf(comment: Pick<PlatformComment, \"anchor\">): string | null {\n  const a = comment.anchor;\n  return a && a.__kind === \"part_anchor\" && typeof a.part_key === \"string\" ? a.part_key : null;\n}\n\n/**\n * One cached comment thread (per `${entityType}:${entityId}` endpoint) — the\n * same lifecycle shape as `AssociationsEntry`/`CategoriesEntry`: pending\n * keeps previous comments AND the visible error; `fetchedAt` is the last\n * successful load.\n */\nexport interface CommentsEntry {\n  status: \"idle\" | \"loading\" | \"ready\" | \"error\";\n  comments: readonly PlatformComment[];\n  fetchedAt: number | null;\n  error: string | null;\n}\n","// react/components/CommentBody.tsx — @ai-matrx/associations/react\n//\n// How a comment's words are shown. A body is markdown: an edit thread's root\n// carries \"Was:\" / \"Now:\" quoted blocks (\"> - item\") that must never print as\n// raw text. The host's compact renderer (the same one its sidecar uses) is the\n// `commentBody` port; when none is bound this dependency-free renderer covers\n// the shapes comments actually use — quoted blocks, bullet lists, paragraphs,\n// and **bold** / *italic* / `code` inline — so the thread is readable either way.\n\nimport { Fragment, type ReactNode } from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\n\nimport { useAssociationsUiPorts } from \"../context\";\n\nexport interface CommentBodyProps {\n  body: string;\n  className?: string;\n}\n\nconst INLINE = /(\\*\\*[^*\\n]+\\*\\*|`[^`\\n]+`|\\*[^*\\n]+\\*)/g;\n\nfunction renderInline(text: string): ReactNode[] {\n  return text.split(INLINE).map((part, i) => {\n    if (part.length > 4 && part.startsWith(\"**\") && part.endsWith(\"**\")) {\n      return <strong key={i}>{part.slice(2, -2)}</strong>;\n    }\n    if (part.length > 2 && part.startsWith(\"`\") && part.endsWith(\"`\")) {\n      return (\n        <code key={i} className=\"rounded bg-muted px-1 text-[0.9em]\">\n          {part.slice(1, -1)}\n        </code>\n      );\n    }\n    if (part.length > 2 && part.startsWith(\"*\") && part.endsWith(\"*\")) {\n      return <em key={i}>{part.slice(1, -1)}</em>;\n    }\n    return <Fragment key={i}>{part}</Fragment>;\n  });\n}\n\nconst BULLET = /^\\s*[-*]\\s+(.*)$/;\n\n/** Blocks of one markdown run: bullet lists and paragraphs (quote prefix already removed). */\nfunction renderBlocks(lines: string[], keyPrefix: string): ReactNode[] {\n  const out: ReactNode[] = [];\n  let bullets: string[] = [];\n  let para: string[] = [];\n  const flushBullets = () => {\n    if (!bullets.length) return;\n    out.push(\n      <ul key={`${keyPrefix}-u${out.length}`} className=\"list-disc pl-5\">\n        {bullets.map((b, i) => (\n          <li key={i}>{renderInline(b)}</li>\n        ))}\n      </ul>,\n    );\n    bullets = [];\n  };\n  const flushPara = () => {\n    if (!para.length) return;\n    out.push(\n      <p key={`${keyPrefix}-p${out.length}`} className=\"whitespace-pre-wrap\">\n        {renderInline(para.join(\"\\n\"))}\n      </p>,\n    );\n    para = [];\n  };\n  for (const line of lines) {\n    const m = BULLET.exec(line);\n    if (m) {\n      flushPara();\n      bullets.push(m[1] ?? \"\");\n    } else if (line.trim() === \"\") {\n      flushBullets();\n      flushPara();\n    } else {\n      flushBullets();\n      para.push(line);\n    }\n  }\n  flushBullets();\n  flushPara();\n  return out;\n}\n\nconst QUOTE = /^\\s*>\\s?(.*)$/;\n\n/** Split into runs of quoted / unquoted lines, render each run as blocks. */\nexport function renderCommentMarkdown(body: string): ReactNode[] {\n  const runs: { quoted: boolean; lines: string[] }[] = [];\n  for (const raw of body.split(\"\\n\")) {\n    const m = QUOTE.exec(raw);\n    const quoted = m !== null;\n    const line = m ? (m[1] ?? \"\") : raw;\n    const last = runs[runs.length - 1];\n    if (last && last.quoted === quoted) last.lines.push(line);\n    else runs.push({ quoted, lines: [line] });\n  }\n  return runs.map((run, i) => {\n    const blocks = renderBlocks(run.lines, `r${i}`);\n    return run.quoted ? (\n      <blockquote\n        key={i}\n        className=\"border-l-2 border-border pl-2 text-muted-foreground\"\n      >\n        {blocks}\n      </blockquote>\n    ) : (\n      <Fragment key={i}>{blocks}</Fragment>\n    );\n  });\n}\n\nexport function CommentBody({ body, className }: CommentBodyProps) {\n  const { commentBody: HostBody } = useAssociationsUiPorts();\n  if (HostBody) return <HostBody body={body} className={className} />;\n  return (\n    <div\n      data-comment-body\n      className={cn(\"flex flex-col gap-1 text-sm text-foreground\", className)}\n    >\n      {renderCommentMarkdown(body)}\n    </div>\n  );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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A;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAkEA,IAAM,wBAA6D,oBAAI,IAAI,kBAAkB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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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;AAAA;AAAA,QACC,UAAU,OAAO,SAAS;AACxB,gBAAM,SAA4B,OAC9B,EAAE,QAAQ,eAAe,UAAU,KAAK,KAAK,OAAO,KAAK,MAAM,MAAM,GAAG,GAAG,EAAE,IAC7E;AACJ,gBAAM,MAAM,MAAM,OAAO,IAAI,MAAM,EAAE,OAAO,SAAS,MAAM,OAAO,CAAC;AACnE,cAAI,IAAI,MAAM,IAAI,GAAI,YAAW,EAAE,IAAI,IAAI,IAAI,MAAM,UAAU,KAAK,CAAC;AACrE,iBAAO;AAAA,QACT;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAKA,SAAS,YAAY,EAAE,QAAQ,GAA4B;AACzD,SACE,8CAAC,iCAAO,MAAK,UAAS,MAAK,MAAK,SAAQ,WAAU,SAAkB,qBAEpE;AAEJ;","names":["import_react","import_react","import_react","import_react","import_react","noopSubscribe","import_react","import_jsx_runtime","import_react","import_react","noopSubscribe","import_react","import_react","import_jsx_runtime","import_react","import_react","import_design_system","GLoader2Icon","GLink2Icon","GRefreshCwIcon","GUploadIcon","GFolderOpenIcon","GFileTextIcon","GCornerDownRightIcon","GTagIcon","GBoxesIcon","GRestoreIcon","GGripResizeIcon","import_icons","import_jsx_runtime","import_jsx_runtime","import_react","import_design_system","import_icons","import_jsx_runtime","import_react","import_design_system","import_icons","import_design_system","import_icons","import_jsx_runtime","import_jsx_runtime","import_react","import_design_system","import_icons","import_jsx_runtime","import_react","import_design_system","import_icons","import_jsx_runtime","role","import_design_system","import_jsx_runtime","import_react","import_design_system","import_icons","import_jsx_runtime","metadataIsPinned","import_react","import_design_system","import_icons","import_outbound","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_react","import_design_system","import_icons","import_jsx_runtime","import_react","import_design_system","import_jsx_runtime","import_react","import_design_system","import_icons","import_jsx_runtime","ROOT_PARENT","import_react","import_design_system","import_react","import_design_system","import_jsx_runtime","import_jsx_runtime","DoorRef"]}