@ai-matrx/content-ir-react 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.1 — 2026-09-09
4
+
5
+ - **A completed partial kind now hands off directly to its real renderer.**
6
+ Workflow run pages shadow the raw text channel while server-built blocks
7
+ stream, so a `superseded` terminal can arrive on a completed `code` block
8
+ without a verified `__ir` envelope. The shared route now reconstructs a
9
+ render-local complete envelope from the block's closed JSON, verifies that
10
+ its root `__kind` matches the producer-confirmed kind, and routes through the
11
+ normal component path in that same frame. Retracted, malformed, and
12
+ mismatched terminals remain on the host's honest fallback.
13
+
14
+ ### Consumer action
15
+
16
+ - Hosts rendering server-built workflow blocks should call the new
17
+ `resolveSupersededKindRender` binding before ordinary kind routing so a
18
+ finished node cannot flash raw Shape JSON while sibling nodes continue.
19
+
3
20
  ## 0.11.0 — 2026-09-08
4
21
 
5
22
  **THE DIRECTIVE TIER — `/directives`.** Every AI Matrx UI draws a Kind
package/dist/index.cjs CHANGED
@@ -70,6 +70,7 @@ __export(index_exports, {
70
70
  resetSourcelessDbRowReports: () => resetSourcelessDbRowReports,
71
71
  resolveAnnouncedKindLoading: () => resolveAnnouncedKindLoading,
72
72
  resolveProvisionalKindRender: () => resolveProvisionalKindRender,
73
+ resolveSupersededKindRender: () => resolveSupersededKindRender,
73
74
  routeEnvOf: () => routeEnvOf,
74
75
  useContentIrHost: () => useContentIrHost,
75
76
  useContentIrHostOrNull: () => useContentIrHostOrNull,
@@ -653,6 +654,36 @@ function resolveAnnouncedKindLoading(block, options) {
653
654
  if (verified && verified.root.status === "complete") return null;
654
655
  return { kind, envelope: envelopeFromPartialKind(event) };
655
656
  }
657
+ function parseCompletedJsonObject(content) {
658
+ let source = content.trim();
659
+ const fenced = source.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);
660
+ if (fenced?.[1]) source = fenced[1].trim();
661
+ try {
662
+ const value = JSON.parse(source);
663
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
664
+ } catch {
665
+ return null;
666
+ }
667
+ }
668
+ function resolveSupersededKindRender(block, env, options) {
669
+ const event = (0, import_content_ir2.readPartialKindEvent)(block.metadata);
670
+ if (event?.state !== "superseded") return null;
671
+ if ((0, import_content_ir2.readEnvelope)(block.metadata)?.root.status === "complete") return null;
672
+ const value = parseCompletedJsonObject(block.content);
673
+ if (!value || (0, import_content_ir2.readObjectKind)(value) !== event.kind) return null;
674
+ const { [import_content_ir2.IR_PARTIAL_KEY]: _partial, ...rest } = block.metadata ?? {};
675
+ void _partial;
676
+ const envelope = (0, import_content_ir2.envelopeFromCompleteValue)(value, event.kind);
677
+ const terminalBlock = {
678
+ ...block,
679
+ // A code/json block's serverData is an annotation, not kind data.
680
+ serverData: void 0,
681
+ metadata: { ...rest, [import_content_ir2.IR_ENVELOPE_KEY]: envelope }
682
+ };
683
+ const routed = applyIrKindRoute(terminalBlock, env, options);
684
+ if (routed === terminalBlock) return null;
685
+ return { block: routed, kind: event.kind, seq: event.seq, envelope };
686
+ }
656
687
  function resolveProvisionalKindRender(block, env, options) {
657
688
  if (options?.streamActive === false) return null;
658
689
  const event = (0, import_content_ir2.readPartialKindEvent)(block.metadata);
@@ -693,7 +724,12 @@ function createKindRouteBinding(env, options) {
693
724
  resolveProvisionalKindRender: (block, streamOptions) => resolveProvisionalKindRender(block, env, {
694
725
  ...streamOptions,
695
726
  ...ownedTypes ? { ownedTypes } : null
696
- })
727
+ }),
728
+ resolveSupersededKindRender: (block) => resolveSupersededKindRender(
729
+ block,
730
+ env,
731
+ ownedTypes ? { ownedTypes } : void 0
732
+ )
697
733
  };
698
734
  }
699
735