@ai-matrx/content-ir-react 0.11.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/index.cjs +37 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +45 -7
- package/dist/index.js.map +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +6 -4
- package/dist/react.js.map +1 -1
- package/dist/{route-Bu85A41G.d.cts → route-B9U-9QCw.d.cts} +35 -1
- package/dist/{route-DoFoDKBn.d.ts → route-gNpJ8zzW.d.ts} +35 -1
- package/dist/route.cjs +38 -2
- package/dist/route.cjs.map +1 -1
- package/dist/route.d.cts +1 -1
- package/dist/route.d.ts +1 -1
- package/dist/route.js +40 -2
- package/dist/route.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as ComponentResolutionSource, a as ComponentResolution, b as ContentIrErrorReporter } from './component-resolution.types-DLO2w-0n.cjs';
|
|
2
2
|
export { c as ComponentRole, d as ContentIrErrorReport, J as JsonObject, K as KindComponentRow, S as SystemComponentEntry, e as consoleErrorReporter } from './component-resolution.types-DLO2w-0n.cjs';
|
|
3
|
-
import { C as ContentIrHost, K as KindRouteEnv, a as KindDefinitionSource } from './route-
|
|
4
|
-
export { b as ContentIrRenderSeams, D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, d as DirectiveApplyResult, e as DirectiveCopyProps, f as DirectiveHost, g as DirectiveHostProvider, h as DirectiveHostProviderProps, i as DirectiveOpenItemOptions, G as GENERIC_STRUCTURED_COMPONENT_KEY, j as GenericFallbackReason, I as IR_PROVISIONAL_KEY, k as IR_ROUTE_KEY, l as IrRenderBlock, m as IrRoutableBlock, n as IrRouteMarker, o as KindRouteBinding, p as KindRouteOptions, P as PartialRenderOptions, q as ProvisionalKindRender, S as StructuredValueRenderProps, r as
|
|
3
|
+
import { C as ContentIrHost, K as KindRouteEnv, a as KindDefinitionSource } from './route-B9U-9QCw.cjs';
|
|
4
|
+
export { b as ContentIrRenderSeams, D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, d as DirectiveApplyResult, e as DirectiveCopyProps, f as DirectiveHost, g as DirectiveHostProvider, h as DirectiveHostProviderProps, i as DirectiveOpenItemOptions, G as GENERIC_STRUCTURED_COMPONENT_KEY, j as GenericFallbackReason, I as IR_PROVISIONAL_KEY, k as IR_ROUTE_KEY, l as IrRenderBlock, m as IrRoutableBlock, n as IrRouteMarker, o as KindRouteBinding, p as KindRouteOptions, P as PartialRenderOptions, q as ProvisionalKindRender, S as StructuredValueRenderProps, r as SupersededKindRender, s as applyIrKindRoute, t as createKindRouteBinding, u as envelopeFromPartialKind, v as isPartialReadyKind, w as isProvisionalBlock, x as kindServerDataFromStoredValue, y as markKindPartialUnsafe, z as readIrRouteMarker, A as resetPartialUnsafeKinds, B as resetSourcelessDbRowReports, E as resolveAnnouncedKindLoading, F as resolveProvisionalKindRender, H as resolveSupersededKindRender, J as routeEnvOf, L as useDirectiveHost } from './route-B9U-9QCw.cjs';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactNode, ComponentType } from 'react';
|
|
7
7
|
export { ComponentResolver, ComponentResolverOptions } from './resolver.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as ComponentResolutionSource, a as ComponentResolution, b as ContentIrErrorReporter } from './component-resolution.types-DLO2w-0n.js';
|
|
2
2
|
export { c as ComponentRole, d as ContentIrErrorReport, J as JsonObject, K as KindComponentRow, S as SystemComponentEntry, e as consoleErrorReporter } from './component-resolution.types-DLO2w-0n.js';
|
|
3
|
-
import { C as ContentIrHost, K as KindRouteEnv, a as KindDefinitionSource } from './route-
|
|
4
|
-
export { b as ContentIrRenderSeams, D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, d as DirectiveApplyResult, e as DirectiveCopyProps, f as DirectiveHost, g as DirectiveHostProvider, h as DirectiveHostProviderProps, i as DirectiveOpenItemOptions, G as GENERIC_STRUCTURED_COMPONENT_KEY, j as GenericFallbackReason, I as IR_PROVISIONAL_KEY, k as IR_ROUTE_KEY, l as IrRenderBlock, m as IrRoutableBlock, n as IrRouteMarker, o as KindRouteBinding, p as KindRouteOptions, P as PartialRenderOptions, q as ProvisionalKindRender, S as StructuredValueRenderProps, r as
|
|
3
|
+
import { C as ContentIrHost, K as KindRouteEnv, a as KindDefinitionSource } from './route-gNpJ8zzW.js';
|
|
4
|
+
export { b as ContentIrRenderSeams, D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, d as DirectiveApplyResult, e as DirectiveCopyProps, f as DirectiveHost, g as DirectiveHostProvider, h as DirectiveHostProviderProps, i as DirectiveOpenItemOptions, G as GENERIC_STRUCTURED_COMPONENT_KEY, j as GenericFallbackReason, I as IR_PROVISIONAL_KEY, k as IR_ROUTE_KEY, l as IrRenderBlock, m as IrRoutableBlock, n as IrRouteMarker, o as KindRouteBinding, p as KindRouteOptions, P as PartialRenderOptions, q as ProvisionalKindRender, S as StructuredValueRenderProps, r as SupersededKindRender, s as applyIrKindRoute, t as createKindRouteBinding, u as envelopeFromPartialKind, v as isPartialReadyKind, w as isProvisionalBlock, x as kindServerDataFromStoredValue, y as markKindPartialUnsafe, z as readIrRouteMarker, A as resetPartialUnsafeKinds, B as resetSourcelessDbRowReports, E as resolveAnnouncedKindLoading, F as resolveProvisionalKindRender, H as resolveSupersededKindRender, J as routeEnvOf, L as useDirectiveHost } from './route-gNpJ8zzW.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactNode, ComponentType } from 'react';
|
|
7
7
|
export { ComponentResolver, ComponentResolverOptions } from './resolver.js';
|
package/dist/index.js
CHANGED
|
@@ -538,11 +538,13 @@ function kindServerDataFromStoredValue(value, env) {
|
|
|
538
538
|
|
|
539
539
|
// route/partial-kind-route.ts
|
|
540
540
|
import {
|
|
541
|
+
envelopeFromCompleteValue as envelopeFromCompleteValue2,
|
|
541
542
|
IR_ENVELOPE_KEY,
|
|
542
543
|
IR_PARTIAL_KEY,
|
|
543
544
|
IR_VERSION,
|
|
544
545
|
isProvisionalKind,
|
|
545
546
|
readEnvelope as readEnvelope2,
|
|
547
|
+
readObjectKind as readObjectKind2,
|
|
546
548
|
readPartialKindEvent
|
|
547
549
|
} from "@ai-matrx/content-ir";
|
|
548
550
|
var IR_PROVISIONAL_KEY = "__ir_provisional";
|
|
@@ -584,6 +586,36 @@ function resolveAnnouncedKindLoading(block, options) {
|
|
|
584
586
|
if (verified && verified.root.status === "complete") return null;
|
|
585
587
|
return { kind, envelope: envelopeFromPartialKind(event) };
|
|
586
588
|
}
|
|
589
|
+
function parseCompletedJsonObject(content) {
|
|
590
|
+
let source = content.trim();
|
|
591
|
+
const fenced = source.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);
|
|
592
|
+
if (fenced?.[1]) source = fenced[1].trim();
|
|
593
|
+
try {
|
|
594
|
+
const value = JSON.parse(source);
|
|
595
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
596
|
+
} catch {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function resolveSupersededKindRender(block, env, options) {
|
|
601
|
+
const event = readPartialKindEvent(block.metadata);
|
|
602
|
+
if (event?.state !== "superseded") return null;
|
|
603
|
+
if (readEnvelope2(block.metadata)?.root.status === "complete") return null;
|
|
604
|
+
const value = parseCompletedJsonObject(block.content);
|
|
605
|
+
if (!value || readObjectKind2(value) !== event.kind) return null;
|
|
606
|
+
const { [IR_PARTIAL_KEY]: _partial, ...rest } = block.metadata ?? {};
|
|
607
|
+
void _partial;
|
|
608
|
+
const envelope = envelopeFromCompleteValue2(value, event.kind);
|
|
609
|
+
const terminalBlock = {
|
|
610
|
+
...block,
|
|
611
|
+
// A code/json block's serverData is an annotation, not kind data.
|
|
612
|
+
serverData: void 0,
|
|
613
|
+
metadata: { ...rest, [IR_ENVELOPE_KEY]: envelope }
|
|
614
|
+
};
|
|
615
|
+
const routed = applyIrKindRoute(terminalBlock, env, options);
|
|
616
|
+
if (routed === terminalBlock) return null;
|
|
617
|
+
return { block: routed, kind: event.kind, seq: event.seq, envelope };
|
|
618
|
+
}
|
|
587
619
|
function resolveProvisionalKindRender(block, env, options) {
|
|
588
620
|
if (options?.streamActive === false) return null;
|
|
589
621
|
const event = readPartialKindEvent(block.metadata);
|
|
@@ -624,7 +656,12 @@ function createKindRouteBinding(env, options) {
|
|
|
624
656
|
resolveProvisionalKindRender: (block, streamOptions) => resolveProvisionalKindRender(block, env, {
|
|
625
657
|
...streamOptions,
|
|
626
658
|
...ownedTypes ? { ownedTypes } : null
|
|
627
|
-
})
|
|
659
|
+
}),
|
|
660
|
+
resolveSupersededKindRender: (block) => resolveSupersededKindRender(
|
|
661
|
+
block,
|
|
662
|
+
env,
|
|
663
|
+
ownedTypes ? { ownedTypes } : void 0
|
|
664
|
+
)
|
|
628
665
|
};
|
|
629
666
|
}
|
|
630
667
|
|
|
@@ -670,7 +707,7 @@ function useContentIrKindVersion(kind, sources) {
|
|
|
670
707
|
// react/KindInstanceRender.tsx
|
|
671
708
|
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
672
709
|
import {
|
|
673
|
-
envelopeFromCompleteValue as
|
|
710
|
+
envelopeFromCompleteValue as envelopeFromCompleteValue3,
|
|
674
711
|
IR_ENVELOPE_KEY as IR_ENVELOPE_KEY2,
|
|
675
712
|
isReservedDirectiveSlug as isReservedDirectiveSlug2
|
|
676
713
|
} from "@ai-matrx/content-ir";
|
|
@@ -1091,7 +1128,7 @@ function KindInstanceRenderInner({
|
|
|
1091
1128
|
content: JSON.stringify(value, null, 2),
|
|
1092
1129
|
language: "json",
|
|
1093
1130
|
metadata: {
|
|
1094
|
-
[IR_ENVELOPE_KEY2]:
|
|
1131
|
+
[IR_ENVELOPE_KEY2]: envelopeFromCompleteValue3(value, kind)
|
|
1095
1132
|
}
|
|
1096
1133
|
} : null;
|
|
1097
1134
|
const frameClass = variant === "bare" ? void 0 : "rounded-md border border-border bg-card p-3";
|
|
@@ -1148,7 +1185,7 @@ function ProvisionalKindFrame({ children }) {
|
|
|
1148
1185
|
import "react";
|
|
1149
1186
|
import {
|
|
1150
1187
|
readEnvelope as readEnvelope3,
|
|
1151
|
-
readObjectKind as
|
|
1188
|
+
readObjectKind as readObjectKind3,
|
|
1152
1189
|
reconstructRegionValue
|
|
1153
1190
|
} from "@ai-matrx/content-ir";
|
|
1154
1191
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -1173,7 +1210,7 @@ function GenericStructuredView({
|
|
|
1173
1210
|
const envelope = readEnvelope3(metadata);
|
|
1174
1211
|
const status = envelope?.root.status ?? "complete";
|
|
1175
1212
|
const { value, recovered } = readStructuredValue(content, metadata);
|
|
1176
|
-
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ?
|
|
1213
|
+
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? readObjectKind3(value) : null) ?? "";
|
|
1177
1214
|
const marker = readIrRouteMarker(metadata);
|
|
1178
1215
|
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";
|
|
1179
1216
|
return /* @__PURE__ */ jsxs7("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
|
|
@@ -1187,7 +1224,7 @@ function GenericStructuredView({
|
|
|
1187
1224
|
}
|
|
1188
1225
|
|
|
1189
1226
|
// react/RuntimeWrapperViews.tsx
|
|
1190
|
-
import { readNodeOutcomeValue, readObjectKind as
|
|
1227
|
+
import { readNodeOutcomeValue, readObjectKind as readObjectKind4, readRunResultValue } from "@ai-matrx/content-ir";
|
|
1191
1228
|
import { Fragment as Fragment3, jsx as jsx11 } from "react/jsx-runtime";
|
|
1192
1229
|
function isRecord2(value) {
|
|
1193
1230
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1209,7 +1246,7 @@ function DelegatedOutput({
|
|
|
1209
1246
|
if (!isRecord2(output)) {
|
|
1210
1247
|
return /* @__PURE__ */ jsx11(Fragment3, { children: host.renderValue({ value: output }) });
|
|
1211
1248
|
}
|
|
1212
|
-
const kind =
|
|
1249
|
+
const kind = readObjectKind4(output) ?? declaredKind;
|
|
1213
1250
|
if (!kind) {
|
|
1214
1251
|
return /* @__PURE__ */ jsx11(Fragment3, { children: fallback?.(output) ?? host.renderValue({ value: output }) });
|
|
1215
1252
|
}
|
|
@@ -1489,6 +1526,7 @@ export {
|
|
|
1489
1526
|
resetSourcelessDbRowReports,
|
|
1490
1527
|
resolveAnnouncedKindLoading,
|
|
1491
1528
|
resolveProvisionalKindRender,
|
|
1529
|
+
resolveSupersededKindRender,
|
|
1492
1530
|
routeEnvOf,
|
|
1493
1531
|
useContentIrHost,
|
|
1494
1532
|
useContentIrHostOrNull,
|