{"version":3,"sources":["../host.ts","../host/error-report.ts","../host/host-types.ts"],"sourcesContent":["\"use client\";\n\n/**\n * `@ai-matrx/content-ir/host` — the contract every consumer wires once:\n * the scream seam, the host/seam types, and the React provider.\n *\n * NOTE: this entry is stamped \"use client\" (it carries the provider). The\n * TYPES here are importable from anywhere; a server-side module that needs\n * only pure route logic imports `/route` instead.\n */\nexport * from \"./host/error-report\";\nexport * from \"./host/host-types\";\nexport * from \"./host/ContentIrProvider\";\n","/**\n * THE SCREAM SEAM.\n *\n * Every recovery path in this package is loud: a defective component row, a\n * failed resolver load, a kind whose component throws on a provisional value.\n * The package refuses to own where those screams land — matrx-frontend routes\n * them to the Error Inspector, the dashboard to its own log, the extension to\n * its background page. Each host binds one function.\n *\n * A host that binds a no-op has chosen silence, which is a defect in itself;\n * {@link consoleErrorReporter} is the honest default.\n */\n\nexport interface ContentIrErrorReport {\n  /** Always `\"content-ir\"` — hosts key their capture stores on it. */\n  source: \"content-ir\";\n  message: string;\n  name?: string;\n  stack?: string;\n  /** Free-form grouping key (the host's `relation`), e.g. `\"partial-kind\"`. */\n  relation?: string;\n  raw?: unknown;\n}\n\nexport type ContentIrErrorReporter = (report: ContentIrErrorReport) => void;\n\n/** The default when a host binds nothing: never silent. */\nexport const consoleErrorReporter: ContentIrErrorReporter = (report) => {\n  console.error(`[content-ir] ${report.message}`, report.raw ?? \"\");\n};\n","/**\n * THE HOST CONTRACT — everything this package refuses to decide.\n *\n * The kernel (`@ai-matrx/content-ir`) proved the shape: extract the portable\n * part, let host capability enter through explicit named seams. The render\n * layer needs four things it must never own:\n *\n *  1. WHERE KIND DEFINITIONS COME FROM (a bundled table, `content_ir`, a REST\n *     call). The route only asks \"is this kind registered, and does it carry a\n *     legacy bridge / a partial-ready opt-in\".\n *  2. WHERE COMPONENT ROWS COME FROM — {@link ComponentResolutionSource}. The\n *     package ships `ComponentResolver`, which any host can construct with its\n *     own loaders; a host with its own resolver only has to satisfy the type.\n *  3. HOW A ROUTED BLOCK ACTUALLY DRAWS. `applyIrKindRoute` decides a block's\n *     TYPE; turning that type into pixels is the host's dispatch table\n *     (matrx-frontend's `BlockRenderer`, the dashboard's small map). The\n *     package never imports a component library.\n *  4. WHERE SCREAMS LAND — {@link ContentIrErrorReporter}.\n *\n * No Next.js, no Redux, no Supabase, no router, no host error capture. If a\n * seam is missing, ADD A SEAM — never an import.\n */\n\nimport type { ReactNode } from \"react\";\nimport type { KindDefinition } from \"../registry\";\nimport type { ContentIrErrorReporter } from \"./error-report\";\nimport type { ComponentResolutionSource } from \"../resolver/component-resolution.types\";\nimport type { DirectiveHost } from \"../react-directives/directive-host\";\n\n/**\n * The minimum a render block must expose for the kind route to work. Hosts\n * pass their own richer block type through; the route is generic over `T` and\n * preserves every extra field.\n */\nexport interface IrRoutableBlock {\n  type: string;\n  serverData?: Record<string, unknown>;\n  metadata?: Record<string, unknown>;\n}\n\n/** A routable block that also carries its source text (the raw region). */\nexport interface IrRenderBlock extends IrRoutableBlock {\n  content: string;\n  language?: string;\n}\n\n/**\n * Where registered kinds come from. `getDefinition` is the only method the\n * pure route needs; the rest drive the granular repaint and the warm-up tick\n * that keeps a cold registry from being mistaken for \"this kind has no\n * component\".\n */\nexport interface KindDefinitionSource {\n  getDefinition(kind: string): KindDefinition | undefined;\n  /** Monotonic per-kind version — the repaint snapshot key. */\n  getKindVersion(kind: string): number;\n  subscribeKind(kind: string, listener: () => void): () => void;\n  /** One definition load per app session. */\n  ensureWarm(): Promise<void>;\n}\n\n/**\n * The rendering seams. Everything here returns host UI; the package supplies\n * the DECISIONS and the chrome-free structure around them.\n */\nexport interface ContentIrRenderSeams {\n  /**\n   * Draw a block the kind route has already typed. This is the host's dispatch\n   * table — the single place a component key becomes a component.\n   */\n  renderBlock(block: IrRenderBlock): ReactNode;\n  /**\n   * THE FLOOR: render ANY JSON value as a human document. Reached when a kind\n   * has no render-trusted component, when the value is not an object at all,\n   * and by the generic structured view.\n   *\n   * This is deliberately a seam and not a bundled component. Rendering a value\n   * WELL means prose through the host's markdown renderer, media through the\n   * host's file handler, and uniform arrays through the host's data table —\n   * all of which are host property. A host that has none of those can pass a\n   * `<pre>`; it will be honest, just plain.\n   */\n  renderValue(props: StructuredValueRenderProps): ReactNode;\n  /**\n   * The \"still arriving\" indicator used by the provisional frame. Optional —\n   * hosts without a shimmer get plain text.\n   */\n  renderShimmer?(text: string): ReactNode;\n  /**\n   * The honest \"this shape has no custom component yet\" notice. Optional: the\n   * package draws a plain amber line when a host supplies nothing, and a host\n   * with an icon set or its own callout component supplies that instead. It is\n   * a seam and not a bundled component because this package depends on no icon\n   * library.\n   */\n  renderNotice?(text: string): ReactNode;\n}\n\nexport interface StructuredValueRenderProps {\n  value: unknown;\n  /** The kind slug this value claims, when known. Honesty line only — never a renderer choice. */\n  kind?: string;\n  /** Why this shape has no custom view, in human words. */\n  note?: string;\n  /** Show the \"what this is / raw data\" footer. Default true. */\n  footer?: boolean;\n}\n\n/**\n * One host, wired once, read by every component in this package through\n * {@link ContentIrRenderProvider}.\n */\nexport interface ContentIrHost extends ContentIrRenderSeams {\n  kinds: KindDefinitionSource;\n  components: ComponentResolutionSource;\n  reportError: ContentIrErrorReporter;\n  /**\n   * The `kind_component.platform` this host resolves as. \"web\" for every\n   * browser UI; the column already models \"react-native\" and friends, and a\n   * host that lies here renders the wrong component everywhere.\n   */\n  platform: string;\n  /**\n   * The Kind Directives seams (apply / open item / copy / noun catalog / item\n   * kind). Optional: a host without them still renders every directive card,\n   * apply-less and copy-less — honest chrome, never hidden content. Provided\n   * to the directive tier by `ContentIrRenderProvider`; a host that has not\n   * adopted the render provider mounts `DirectiveHostProvider` directly.\n   */\n  directives?: DirectiveHost;\n}\n\n/**\n * The pure route's dependencies — a strict subset of {@link ContentIrHost},\n * because `applyIrKindRoute` is called OUTSIDE React (reducers, stream\n * accumulators, tests) where there is no provider to read.\n */\nexport interface KindRouteEnv {\n  /**\n   * `schemaState` is optional and read ONLY to suppress a negative verdict while this kind's\n   * definition read has not answered (\"pending\") — THE COLD-VERDICT RULE, per kind.\n   */\n  kinds: Pick<KindDefinitionSource, \"getDefinition\"> & {\n    schemaState?(kind: string): \"loaded\" | \"pending\" | \"absent\" | \"failed\";\n  };\n  /**\n   * `hasSettled` is optional and read ONLY to suppress a negative verdict from\n   * a registry that has not loaded yet — see THE COLD-VERDICT RULE on\n   * `ComponentResolutionSource`.\n   */\n  components: Pick<ComponentResolutionSource, \"resolve\"> &\n    Partial<Pick<ComponentResolutionSource, \"hasSettled\" | \"hasSettledFor\">>;\n  reportError: ContentIrErrorReporter;\n  platform: string;\n}\n\n/** Narrow a host (or anything host-shaped) to what the pure route needs. */\nexport function routeEnvOf(host: ContentIrHost): KindRouteEnv {\n  return {\n    kinds: host.kinds,\n    components: host.components,\n    reportError: host.reportError,\n    platform: host.platform,\n  };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC2BO,IAAM,uBAA+C,CAAC,WAAW;AACtE,UAAQ,MAAM,gBAAgB,OAAO,OAAO,IAAI,OAAO,OAAO,EAAE;AAClE;;;ACgIO,SAAS,WAAW,MAAmC;AAC5D,SAAO;AAAA,IACL,OAAO,KAAK;AAAA,IACZ,YAAY,KAAK;AAAA,IACjB,aAAa,KAAK;AAAA,IAClB,UAAU,KAAK;AAAA,EACjB;AACF;;;AFxJA,yBAAc,+CAZd;","names":[]}