@ai-matrx/content-ir-react 0.11.10 → 0.11.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.cjs CHANGED
@@ -115,10 +115,10 @@ function useContentIrKindVersion(kind, sources) {
115
115
 
116
116
  // react/KindInstanceRender.tsx
117
117
  var import_react6 = require("react");
118
- var import_content_ir6 = require("@ai-matrx/content-ir");
118
+ var import_content_ir7 = require("@ai-matrx/content-ir");
119
119
 
120
120
  // directives/DirectiveRender.tsx
121
- var import_content_ir4 = require("@ai-matrx/content-ir");
121
+ var import_content_ir5 = require("@ai-matrx/content-ir");
122
122
 
123
123
  // directives/DirectiveFallbackCard.tsx
124
124
  var import_content_ir = require("@ai-matrx/content-ir");
@@ -317,8 +317,48 @@ function DirectiveFallbackCard({ directive, reason }) {
317
317
  ] });
318
318
  }
319
319
 
320
- // directives/registry.ts
320
+ // directives/DirectiveProvisionalCard.tsx
321
321
  var import_content_ir2 = require("@ai-matrx/content-ir");
322
+ var import_jsx_runtime6 = require("react/jsx-runtime");
323
+ var COMPLETE_SLUG_RE = /^\{\s*"__kind"\s*:\s*"([^"]+)"/;
324
+ function provisionalDirectiveSlug(content) {
325
+ const match = content.trimStart().match(COMPLETE_SLUG_RE);
326
+ return match?.[1] ?? null;
327
+ }
328
+ function DirectiveProvisionalCard({ content, streaming, className }) {
329
+ const host = useDirectiveHost();
330
+ const slug = provisionalDirectiveSlug(content);
331
+ const known = slug ? (0, import_content_ir2.parseDirectiveSlug)(slug) : null;
332
+ const display = known ? (0, import_content_ir2.directiveDisplay)(known.directiveClass, known.noun, host.nouns) : null;
333
+ const Icon = known ? classIcon(known.directiveClass, known.noun) : BoxesIcon;
334
+ const title = display?.title ?? "Structured action";
335
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
336
+ "div",
337
+ {
338
+ className: `my-3 rounded-md border border-border bg-card px-2.5 py-1.5${className ? ` ${className}` : ""}`,
339
+ "data-directive": slug ?? void 0,
340
+ "data-directive-state": streaming ? "streaming" : "incomplete",
341
+ children: [
342
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
343
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
344
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm font-medium text-foreground", children: title }),
345
+ display?.family ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs text-muted-foreground", children: display.family }) : null,
346
+ streaming ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", role: "status", children: [
347
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-primary", "aria-hidden": true }),
348
+ "Writing\u2026"
349
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs text-destructive", role: "status", children: "Cut off before it finished \u2014 nothing can be applied." })
350
+ ] }),
351
+ streaming ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "mt-1 text-xs text-muted-foreground", children: [
352
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("summary", { className: "cursor-pointer select-none hover:text-foreground", children: "Show what arrived" }),
353
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("pre", { className: "mt-1 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded bg-muted px-2 py-1 text-[11px]", children: content })
354
+ ] })
355
+ ]
356
+ }
357
+ );
358
+ }
359
+
360
+ // directives/registry.ts
361
+ var import_content_ir3 = require("@ai-matrx/content-ir");
322
362
  var REGISTRY_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.content-ir-react.directive-renderers");
323
363
  var registry = globalThis[REGISTRY_SLOT] ??= {
324
364
  bySlug: /* @__PURE__ */ new Map(),
@@ -330,8 +370,8 @@ function getDirectiveRenderer(directive) {
330
370
 
331
371
  // directives/SideEffectDirectiveCard.tsx
332
372
  var import_react5 = require("react");
333
- var import_content_ir3 = require("@ai-matrx/content-ir");
334
- var import_jsx_runtime6 = require("react/jsx-runtime");
373
+ var import_content_ir4 = require("@ai-matrx/content-ir");
374
+ var import_jsx_runtime7 = require("react/jsx-runtime");
335
375
  var ROWS_BEFORE_FOLD = 3;
336
376
  function ItemRow({
337
377
  directive,
@@ -340,31 +380,31 @@ function ItemRow({
340
380
  total
341
381
  }) {
342
382
  const host = useDirectiveHost();
343
- const titleColumn = (0, import_content_ir3.nounTitleColumn)(directive.noun, host.nouns);
344
- const title = (0, import_content_ir3.itemTitle)(item, titleColumn, index, total);
345
- const subtitle = (0, import_content_ir3.itemSubtitle)(item);
346
- const facts = (0, import_content_ir3.itemFacts)(item);
383
+ const titleColumn = (0, import_content_ir4.nounTitleColumn)(directive.noun, host.nouns);
384
+ const title = (0, import_content_ir4.itemTitle)(item, titleColumn, index, total);
385
+ const subtitle = (0, import_content_ir4.itemSubtitle)(item);
386
+ const facts = (0, import_content_ir4.itemFacts)(item);
347
387
  const kind = host.itemKind?.(directive.slug) ?? null;
348
- const display = (0, import_content_ir3.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
388
+ const display = (0, import_content_ir4.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
349
389
  const openItem = host.openItem;
350
- const body = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
351
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "min-w-0 shrink-0 truncate font-medium text-foreground", children: title }),
352
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "hidden min-w-0 flex-1 items-baseline gap-2 overflow-hidden sm:flex", children: facts.map((fact) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "truncate text-[11px] text-muted-foreground", children: [
390
+ const body = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
391
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "min-w-0 shrink-0 truncate font-medium text-foreground", children: title }),
392
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hidden min-w-0 flex-1 items-baseline gap-2 overflow-hidden sm:flex", children: facts.map((fact) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "truncate text-[11px] text-muted-foreground", children: [
353
393
  fact.value,
354
394
  " ",
355
395
  fact.label
356
396
  ] }, fact.key)) }),
357
- subtitle && facts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "hidden truncate text-[11px] text-muted-foreground sm:inline", children: subtitle }) : null,
358
- openItem ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MaximizeIcon, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" }) : null
397
+ subtitle && facts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hidden truncate text-[11px] text-muted-foreground sm:inline", children: subtitle }) : null,
398
+ openItem ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MaximizeIcon, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" }) : null
359
399
  ] });
360
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2 py-1 text-xs", children: [
361
- openItem ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
400
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 py-1 text-xs", children: [
401
+ openItem ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
362
402
  "button",
363
403
  {
364
404
  type: "button",
365
405
  onClick: () => openItem({
366
406
  // Stamped so the panel's kind pipeline types it from its own first key.
367
- item: (0, import_content_ir3.asKindInstance)(item, kind) ?? item,
407
+ item: (0, import_content_ir4.asKindInstance)(item, kind) ?? item,
368
408
  itemKind: kind,
369
409
  title,
370
410
  subtitle: `${display.title} \xB7 item ${index + 1} of ${total}`,
@@ -376,7 +416,7 @@ function ItemRow({
376
416
  title: "Open to read it",
377
417
  children: body
378
418
  }
379
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "flex min-w-0 flex-1 items-center gap-2 px-1 py-0.5", children: body }),
419
+ ) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "flex min-w-0 flex-1 items-center gap-2 px-1 py-0.5", children: body }),
380
420
  host.renderCopy?.({ label: title, value: item, kind, size: "xs" })
381
421
  ] });
382
422
  }
@@ -385,37 +425,37 @@ function SideEffectDirectiveCard({ directive }) {
385
425
  const [expanded, setExpanded] = (0, import_react5.useState)(false);
386
426
  const items = directive.items;
387
427
  const total = items.length;
388
- const display = (0, import_content_ir3.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
428
+ const display = (0, import_content_ir4.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
389
429
  const Icon = classIcon(directive.directiveClass, directive.noun);
390
430
  const shown = expanded ? items : items.slice(0, ROWS_BEFORE_FOLD);
391
431
  const hidden = total - shown.length;
392
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "my-3 rounded-md border border-border bg-card px-2.5 py-1.5", "data-directive": directive.slug, children: [
393
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
394
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
395
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm font-medium text-foreground", children: display.title }),
396
- display.family ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs text-muted-foreground", children: display.family }) : null,
397
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
432
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "my-3 rounded-md border border-border bg-card px-2.5 py-1.5", "data-directive": directive.slug, children: [
433
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
434
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
435
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-sm font-medium text-foreground", children: display.title }),
436
+ display.family ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-xs text-muted-foreground", children: display.family }) : null,
437
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
398
438
  total,
399
439
  " ",
400
440
  total === 1 ? "item" : "items"
401
441
  ] }),
402
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [
442
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [
403
443
  host.renderCopy?.({ label: display.title, value: directive.shell, size: "icon" }),
404
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ApplyDirectiveButton, { directive, itemCount: total })
444
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ApplyDirectiveButton, { directive, itemCount: total })
405
445
  ] })
406
446
  ] }),
407
447
  total === 0 ? (
408
448
  // Stated, never silent: an empty batch is a real (and suspicious) state.
409
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "No items \u2014 nothing would be written." })
410
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mt-0.5 divide-y divide-border/60", children: shown.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ItemRow, { directive, item, index: i, total }, i)) }),
411
- hidden > 0 || expanded ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
449
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "No items \u2014 nothing would be written." })
450
+ ) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-0.5 divide-y divide-border/60", children: shown.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ItemRow, { directive, item, index: i, total }, i)) }),
451
+ hidden > 0 || expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
412
452
  "button",
413
453
  {
414
454
  type: "button",
415
455
  onClick: () => setExpanded((v) => !v),
416
456
  className: "mt-0.5 inline-flex items-center gap-1 rounded px-1 py-0.5 text-[11px] text-muted-foreground hover:text-foreground",
417
457
  children: [
418
- expanded ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronRightIcon, { className: "h-3 w-3" }),
458
+ expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronRightIcon, { className: "h-3 w-3" }),
419
459
  expanded ? "Show less" : `Show ${hidden} more`
420
460
  ]
421
461
  }
@@ -424,17 +464,28 @@ function SideEffectDirectiveCard({ directive }) {
424
464
  }
425
465
 
426
466
  // directives/DirectiveRender.tsx
427
- var import_jsx_runtime7 = require("react/jsx-runtime");
428
- function DirectiveRender({ content, className }) {
467
+ var import_jsx_runtime8 = require("react/jsx-runtime");
468
+ function isWholeJson(content) {
469
+ try {
470
+ JSON.parse(content);
471
+ return true;
472
+ } catch {
473
+ return false;
474
+ }
475
+ }
476
+ function DirectiveRender({ content, className, streaming }) {
429
477
  const host = useDirectiveHost();
430
- const directive = (0, import_content_ir4.tryDecodeDirectiveContent)(content, (message) => {
478
+ const directive = (0, import_content_ir5.tryDecodeDirectiveContent)(content, (message) => {
431
479
  const line = `[kind-directives] ${message}`;
432
480
  if (host.reportError) host.reportError(line);
433
481
  else console.error(line);
434
482
  });
435
483
  if (!directive) {
484
+ if (typeof content === "string" && (0, import_content_ir5.looksLikeDirectiveHead)(content) && !isWholeJson(content)) {
485
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DirectiveProvisionalCard, { content, streaming: streaming !== false, className });
486
+ }
436
487
  const raw = typeof content === "string" ? content : JSON.stringify(content, null, 2);
437
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
488
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
438
489
  "pre",
439
490
  {
440
491
  className: `my-3 overflow-x-auto rounded-md border border-border bg-muted px-3 py-2 text-xs text-muted-foreground${className ? ` ${className}` : ""}`,
@@ -443,13 +494,13 @@ function DirectiveRender({ content, className }) {
443
494
  );
444
495
  }
445
496
  const Renderer = getDirectiveRenderer(directive);
446
- if (Renderer) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Renderer, { directive });
447
- if (directive.parsed.executes) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SideEffectDirectiveCard, { directive });
448
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DirectiveFallbackCard, { directive });
497
+ if (Renderer) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Renderer, { directive });
498
+ if (directive.parsed.executes) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SideEffectDirectiveCard, { directive });
499
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DirectiveFallbackCard, { directive });
449
500
  }
450
501
 
451
502
  // route/kind-route.ts
452
- var import_content_ir5 = require("@ai-matrx/content-ir");
503
+ var import_content_ir6 = require("@ai-matrx/content-ir");
453
504
  var IR_ROUTE_KEY = "__ir_route";
454
505
  var GENERIC_STRUCTURED_COMPONENT_KEY = "generic_structured";
455
506
  var SOURCELESS_DB_ROW_SLOT = /* @__PURE__ */ Symbol.for(
@@ -468,20 +519,20 @@ function readIrRouteMarker(metadata) {
468
519
  }
469
520
 
470
521
  // react/KindInstanceRender.tsx
471
- var import_jsx_runtime8 = require("react/jsx-runtime");
522
+ var import_jsx_runtime9 = require("react/jsx-runtime");
472
523
  function isRecordValue(value) {
473
524
  return typeof value === "object" && value !== null && !Array.isArray(value);
474
525
  }
475
526
  function kindIsRoutable(kind, host) {
476
- if ((0, import_content_ir6.isReservedDirectiveSlug)(kind)) return true;
527
+ if ((0, import_content_ir7.isReservedDirectiveSlug)(kind)) return true;
477
528
  if (host.kinds.getDefinition(kind)?.legacyBlockType) return true;
478
529
  const resolution = host.components.resolve(kind, host.platform, "output");
479
530
  if (!resolution?.isActive) return false;
480
531
  return resolution.componentKey !== GENERIC_STRUCTURED_COMPONENT_KEY;
481
532
  }
482
533
  function KindInstanceRender(props) {
483
- if ((0, import_content_ir6.isReservedDirectiveSlug)(props.kind)) {
484
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
534
+ if ((0, import_content_ir7.isReservedDirectiveSlug)(props.kind)) {
535
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
485
536
  DirectiveRender,
486
537
  {
487
538
  content: props.value,
@@ -489,7 +540,7 @@ function KindInstanceRender(props) {
489
540
  }
490
541
  );
491
542
  }
492
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(KindInstanceRenderInner, { ...props });
543
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KindInstanceRenderInner, { ...props });
493
544
  }
494
545
  function KindInstanceRenderInner({
495
546
  kind,
@@ -535,18 +586,18 @@ function KindInstanceRenderInner({
535
586
  content: JSON.stringify(value, null, 2),
536
587
  language: "json",
537
588
  metadata: {
538
- [import_content_ir6.IR_ENVELOPE_KEY]: (0, import_content_ir6.envelopeFromCompleteValue)(value, kind)
589
+ [import_content_ir7.IR_ENVELOPE_KEY]: (0, import_content_ir7.envelopeFromCompleteValue)(value, kind)
539
590
  }
540
591
  } : null;
541
592
  const frameClass = variant === "bare" ? void 0 : "rounded-md border border-border bg-card p-3";
542
593
  if (routingStatus === "unroutable" && unroutableFallback !== void 0) {
543
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: unroutableFallback });
594
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: unroutableFallback });
544
595
  }
545
596
  const onTheFloor = block === null || routingStatus === "unroutable";
546
597
  const notice = "This shape has no custom component yet, so it renders through the universal viewer \u2014 exactly what production shows today.";
547
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: className ? `space-y-3 ${className}` : "space-y-3", children: [
548
- showRoutingNote && routingStatus === "unroutable" ? host.renderNotice?.(notice) ?? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-xs text-amber-800 dark:text-amber-200", children: notice }) : null,
549
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: frameClass, children: onTheFloor ? host.renderValue({ value, kind }) : host.renderBlock(block) })
598
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: className ? `space-y-3 ${className}` : "space-y-3", children: [
599
+ showRoutingNote && routingStatus === "unroutable" ? host.renderNotice?.(notice) ?? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-xs text-amber-800 dark:text-amber-200", children: notice }) : null,
600
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: frameClass, children: onTheFloor ? host.renderValue({ value, kind }) : host.renderBlock(block) })
550
601
  ] });
551
602
  }
552
603
 
@@ -554,7 +605,7 @@ function KindInstanceRenderInner({
554
605
  var import_react7 = __toESM(require("react"), 1);
555
606
 
556
607
  // route/partial-kind-route.ts
557
- var import_content_ir7 = require("@ai-matrx/content-ir");
608
+ var import_content_ir8 = require("@ai-matrx/content-ir");
558
609
  var PARTIAL_UNSAFE_SLOT = /* @__PURE__ */ Symbol.for(
559
610
  "ai-matrx.content-ir-react.partial-unsafe-kinds"
560
611
  );
@@ -564,7 +615,7 @@ function markKindPartialUnsafe(kind) {
564
615
  }
565
616
 
566
617
  // react/ProvisionalKindBoundary.tsx
567
- var import_jsx_runtime9 = require("react/jsx-runtime");
618
+ var import_jsx_runtime10 = require("react/jsx-runtime");
568
619
  var ProvisionalKindBoundaryInner = class extends import_react7.default.Component {
569
620
  state = { failed: false };
570
621
  static getDerivedStateFromError() {
@@ -589,25 +640,25 @@ var ProvisionalKindBoundaryInner = class extends import_react7.default.Component
589
640
  };
590
641
  function ProvisionalKindBoundary(props) {
591
642
  const host = useContentIrHost();
592
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ProvisionalKindBoundaryInner, { ...props, reportError: host.reportError });
643
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProvisionalKindBoundaryInner, { ...props, reportError: host.reportError });
593
644
  }
594
645
  function ProvisionalKindFrame({ children }) {
595
646
  const host = useContentIrHost();
596
647
  const label = "Still arriving";
597
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", "aria-busy": "true", children: [
648
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative", "aria-busy": "true", children: [
598
649
  children,
599
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "pointer-events-none absolute -top-2 right-4 z-10 select-none rounded-full bg-background px-1.5 leading-4", children: host.renderShimmer?.(label) ?? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[10px] text-muted-foreground", children: label }) })
650
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "pointer-events-none absolute -top-2 right-4 z-10 select-none rounded-full bg-background px-1.5 leading-4", children: host.renderShimmer?.(label) ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-muted-foreground", children: label }) })
600
651
  ] });
601
652
  }
602
653
 
603
654
  // react/GenericStructuredView.tsx
604
655
  var import_react8 = require("react");
605
- var import_content_ir8 = require("@ai-matrx/content-ir");
606
- var import_jsx_runtime10 = require("react/jsx-runtime");
656
+ var import_content_ir9 = require("@ai-matrx/content-ir");
657
+ var import_jsx_runtime11 = require("react/jsx-runtime");
607
658
  function readStructuredValue(content, metadata) {
608
- const envelope = (0, import_content_ir8.readEnvelope)(metadata);
659
+ const envelope = (0, import_content_ir9.readEnvelope)(metadata);
609
660
  if (envelope) {
610
- return { value: (0, import_content_ir8.reconstructRegionValue)(envelope), recovered: true };
661
+ return { value: (0, import_content_ir9.reconstructRegionValue)(envelope), recovered: true };
611
662
  }
612
663
  try {
613
664
  return { value: JSON.parse(content), recovered: true };
@@ -622,25 +673,25 @@ function GenericStructuredView({
622
673
  className
623
674
  }) {
624
675
  const host = useContentIrHost();
625
- const envelope = (0, import_content_ir8.readEnvelope)(metadata);
676
+ const envelope = (0, import_content_ir9.readEnvelope)(metadata);
626
677
  const status = envelope?.root.status ?? "complete";
627
678
  const { value, recovered } = readStructuredValue(content, metadata);
628
- const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? (0, import_content_ir8.readObjectKind)(value) : null) ?? "";
679
+ const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? (0, import_content_ir9.readObjectKind)(value) : null) ?? "";
629
680
  const marker = readIrRouteMarker(metadata);
630
681
  const note = marker?.reason === "inactive" ? "a custom view is registered but held inactive" : marker?.reason === "broken-instance" ? "this instance did not match the shape's schema" : marker?.reason === "unregistered" ? "this shape isn't registered on this platform" : "no custom view yet";
631
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
632
- status === "streaming" ? streamingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mb-2 text-xs text-muted-foreground", children: "Still arriving\u2026" }) : null,
682
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
683
+ status === "streaming" ? streamingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-2 text-xs text-muted-foreground", children: "Still arriving\u2026" }) : null,
633
684
  recovered ? host.renderValue({ value, ...kind ? { kind } : {}, note }) : (
634
685
  // Zero-data-loss backstop: the region never parsed, so show the source
635
686
  // verbatim rather than swallowing it.
636
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("pre", { className: "max-h-96 overflow-auto font-mono text-xs leading-relaxed text-muted-foreground", children: content })
687
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("pre", { className: "max-h-96 overflow-auto font-mono text-xs leading-relaxed text-muted-foreground", children: content })
637
688
  )
638
689
  ] });
639
690
  }
640
691
 
641
692
  // react/RuntimeWrapperViews.tsx
642
- var import_content_ir9 = require("@ai-matrx/content-ir");
643
- var import_jsx_runtime11 = require("react/jsx-runtime");
693
+ var import_content_ir10 = require("@ai-matrx/content-ir");
694
+ var import_jsx_runtime12 = require("react/jsx-runtime");
644
695
  function isRecord2(value) {
645
696
  return typeof value === "object" && value !== null && !Array.isArray(value);
646
697
  }
@@ -656,16 +707,16 @@ function DelegatedOutput({
656
707
  }) {
657
708
  const host = useContentIrHost();
658
709
  if (output === null || output === void 0) {
659
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyLabel });
710
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyLabel });
660
711
  }
661
712
  if (!isRecord2(output)) {
662
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: host.renderValue({ value: output }) });
713
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: host.renderValue({ value: output }) });
663
714
  }
664
- const kind = (0, import_content_ir9.readObjectKind)(output) ?? declaredKind;
715
+ const kind = (0, import_content_ir10.readObjectKind)(output) ?? declaredKind;
665
716
  if (!kind) {
666
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: fallback?.(output) ?? host.renderValue({ value: output }) });
717
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: fallback?.(output) ?? host.renderValue({ value: output }) });
667
718
  }
668
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
719
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
669
720
  KindInstanceRender,
670
721
  {
671
722
  kind,
@@ -679,10 +730,10 @@ function DelegatedOutput({
679
730
  function NodeOutcomeView({ serverData, fallback }) {
680
731
  const wrapper = readWrapperFrom(
681
732
  serverData,
682
- import_content_ir9.readNodeOutcomeValue
733
+ import_content_ir10.readNodeOutcomeValue
683
734
  );
684
735
  if (!wrapper) return null;
685
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
736
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
686
737
  DelegatedOutput,
687
738
  {
688
739
  output: wrapper.output,
@@ -694,17 +745,17 @@ function NodeOutcomeView({ serverData, fallback }) {
694
745
  function RunResultView({ serverData, fallback }) {
695
746
  const wrapper = readWrapperFrom(
696
747
  serverData,
697
- import_content_ir9.readRunResultValue
748
+ import_content_ir10.readRunResultValue
698
749
  );
699
750
  if (!wrapper) return null;
700
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "space-y-2", children: wrapper.outputs.length > 0 ? wrapper.outputs.map((outcome) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
751
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-2", children: wrapper.outputs.length > 0 ? wrapper.outputs.map((outcome) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
701
752
  NodeOutcomeView,
702
753
  {
703
754
  serverData: { wrapper: outcome },
704
755
  ...fallback === void 0 ? {} : { fallback }
705
756
  },
706
757
  `${outcome.node_id}:${outcome.attempt}`
707
- )) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
758
+ )) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
708
759
  DelegatedOutput,
709
760
  {
710
761
  output: wrapper.output,