@ai-matrx/content-ir-react 0.20.1 → 0.21.0
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 +29 -0
- package/README.md +1 -1
- package/dist/{component-resolution.types-DwKSF64x.d.cts → component-resolution.types-BQa2ik3i.d.cts} +1 -1
- package/dist/{component-resolution.types-DwKSF64x.d.ts → component-resolution.types-BQa2ik3i.d.ts} +1 -1
- package/dist/{component-resolution.types-DY4pGymy.d.cts → component-resolution.types-C_irCaHc.d.cts} +1 -1
- package/dist/{component-resolution.types-DY4pGymy.d.ts → component-resolution.types-C_irCaHc.d.ts} +1 -1
- package/dist/db-component.d.cts +1 -1
- package/dist/db-component.d.ts +1 -1
- package/dist/directives.cjs +57 -28
- package/dist/directives.cjs.map +1 -1
- package/dist/directives.d.cts +18 -3
- package/dist/directives.d.ts +18 -3
- package/dist/directives.js +38 -10
- package/dist/directives.js.map +1 -1
- package/dist/{host-types-BpcRcZ48.d.ts → host-types-CGcK8Nib.d.ts} +1 -1
- package/dist/{host-types-BRLk_J_3.d.cts → host-types-mMFt5-hQ.d.cts} +1 -1
- package/dist/host.d.cts +3 -3
- package/dist/host.d.ts +3 -3
- package/dist/index.cjs +72 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -8
- package/dist/index.d.ts +23 -8
- package/dist/index.js +38 -10
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +71 -44
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +36 -10
- package/dist/react.js.map +1 -1
- package/dist/resolver.d.cts +2 -2
- package/dist/resolver.d.ts +2 -2
- package/dist/{route-CiCUQGAB.d.ts → route-Bq6db_zH.d.cts} +2 -2
- package/dist/{route-DMTBn8w4.d.cts → route-DStinBoZ.d.ts} +2 -2
- package/dist/route.cjs.map +1 -1
- package/dist/route.d.cts +2 -2
- package/dist/route.d.ts +2 -2
- package/dist/route.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -125,21 +125,21 @@ function useContentIrKindVersion(kind, sources) {
|
|
|
125
125
|
|
|
126
126
|
// react/KindInstanceRender.tsx
|
|
127
127
|
var import_react7 = require("react");
|
|
128
|
-
var
|
|
128
|
+
var import_content_ir9 = require("@ai-matrx/content-ir");
|
|
129
129
|
|
|
130
130
|
// directives/DirectiveRender.tsx
|
|
131
|
-
var
|
|
131
|
+
var import_content_ir7 = require("@ai-matrx/content-ir");
|
|
132
132
|
|
|
133
133
|
// directives/DirectiveFallbackCard.tsx
|
|
134
|
-
var
|
|
134
|
+
var import_content_ir3 = require("@ai-matrx/content-ir");
|
|
135
135
|
|
|
136
136
|
// directives/ApplyDirectiveButton.tsx
|
|
137
137
|
var import_react5 = require("react");
|
|
138
|
-
var
|
|
138
|
+
var import_content_ir2 = require("@ai-matrx/content-ir");
|
|
139
139
|
|
|
140
140
|
// directives/item-changes.ts
|
|
141
|
-
var import_uuid = require("@ai-matrx/kit/uuid");
|
|
142
141
|
var import_text_case = require("@ai-matrx/kit/text-case");
|
|
142
|
+
var import_content_ir = require("@ai-matrx/content-ir");
|
|
143
143
|
var TARGETING_CLASSES = /* @__PURE__ */ new Set(["update", "delete"]);
|
|
144
144
|
var NOT_A_CHANGE = /* @__PURE__ */ new Set(["__kind", "id"]);
|
|
145
145
|
var CHANGE_VALUE_MAX = 280;
|
|
@@ -155,10 +155,14 @@ function fieldLabel(key) {
|
|
|
155
155
|
function directiveFieldLabel(key, titleColumn) {
|
|
156
156
|
return titleColumn && key === titleColumn ? "Title" : fieldLabel(key);
|
|
157
157
|
}
|
|
158
|
+
function itemOwnName(item, titleColumn) {
|
|
159
|
+
const probe = (0, import_content_ir.itemTitle)(item, titleColumn, 0, 2);
|
|
160
|
+
return probe === "Item 1 of 2" ? null : probe;
|
|
161
|
+
}
|
|
162
|
+
var NO_TITLE_WORD = "No title";
|
|
158
163
|
var EMPTY_VALUE_WORD = "None";
|
|
159
|
-
function recordFallbackName(nounLabel3
|
|
160
|
-
|
|
161
|
-
return `${nounLabel3} ${short}`;
|
|
164
|
+
function recordFallbackName(nounLabel3) {
|
|
165
|
+
return nounLabel3.trim() || "Record";
|
|
162
166
|
}
|
|
163
167
|
var EMPTY = { value: EMPTY_VALUE_WORD, full: EMPTY_VALUE_WORD, clears: true };
|
|
164
168
|
function describeValue(value, word) {
|
|
@@ -477,7 +481,7 @@ function ApplyDirectiveButton({
|
|
|
477
481
|
(0, import_react5.useEffect)(() => {
|
|
478
482
|
currentIdentity.current = identity;
|
|
479
483
|
}, [identity]);
|
|
480
|
-
const nounText = (0,
|
|
484
|
+
const nounText = (0, import_content_ir2.nounLabel)(directive.noun, host.nouns);
|
|
481
485
|
const shellKey = readsLedger ? JSON.stringify([directive.slug, items, conversationId ?? null]) : "";
|
|
482
486
|
const read = host.applyState;
|
|
483
487
|
const report = host.reportError;
|
|
@@ -657,7 +661,7 @@ function ApplyDirectiveButton({
|
|
|
657
661
|
) : null,
|
|
658
662
|
records.map((record) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
|
|
659
663
|
...record,
|
|
660
|
-
fallback: recordFallbackName(label2
|
|
664
|
+
fallback: recordFallbackName(label2),
|
|
661
665
|
context: "applied",
|
|
662
666
|
trashed
|
|
663
667
|
}) }, `${record.noun}:${record.id}`)),
|
|
@@ -705,6 +709,14 @@ function ApplyDirectiveButton({
|
|
|
705
709
|
}
|
|
706
710
|
);
|
|
707
711
|
}
|
|
712
|
+
const warm = () => {
|
|
713
|
+
const read2 = host.readRecord;
|
|
714
|
+
if (!read2 || !TARGETING_CLASSES.has(directive.directiveClass)) return;
|
|
715
|
+
for (const item of items) {
|
|
716
|
+
const id = itemRecordId(item);
|
|
717
|
+
if (id) void read2({ noun: directive.noun, id }).catch(() => null);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
708
720
|
const destructive = directive.directiveClass === "delete";
|
|
709
721
|
const muted = nothingToChange && view.status === "idle";
|
|
710
722
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1", children: [
|
|
@@ -714,6 +726,8 @@ function ApplyDirectiveButton({
|
|
|
714
726
|
{
|
|
715
727
|
type: "button",
|
|
716
728
|
onClick: () => void handleApply(),
|
|
729
|
+
onPointerEnter: warm,
|
|
730
|
+
onFocus: warm,
|
|
717
731
|
disabled: view.status === "applying" || view.status === "asking" || items.length === 0,
|
|
718
732
|
"data-apply-tone": muted ? "muted" : destructive ? "destructive" : "default",
|
|
719
733
|
title: muted ? "It sets no fields, so applying it changes nothing." : void 0,
|
|
@@ -790,7 +804,7 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
|
790
804
|
function DirectiveFallbackCard({ directive, reason }) {
|
|
791
805
|
const host = useDirectiveHost();
|
|
792
806
|
const count = directive.items.length;
|
|
793
|
-
const display = (0,
|
|
807
|
+
const display = (0, import_content_ir3.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
794
808
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "my-3 inline-flex flex-wrap items-center gap-2 rounded-md border border-border bg-muted px-2.5 py-1 text-sm", children: [
|
|
795
809
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoxesIcon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
796
810
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-foreground", children: display.title }),
|
|
@@ -813,7 +827,7 @@ function DirectiveFallbackCard({ directive, reason }) {
|
|
|
813
827
|
}
|
|
814
828
|
|
|
815
829
|
// directives/DirectiveProvisionalCard.tsx
|
|
816
|
-
var
|
|
830
|
+
var import_content_ir4 = require("@ai-matrx/content-ir");
|
|
817
831
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
818
832
|
var COMPLETE_SLUG_RE = /^\{\s*"__kind"\s*:\s*"([^"]+)"/;
|
|
819
833
|
function provisionalDirectiveSlug(content) {
|
|
@@ -823,8 +837,8 @@ function provisionalDirectiveSlug(content) {
|
|
|
823
837
|
function DirectiveProvisionalCard({ content, streaming, className }) {
|
|
824
838
|
const host = useDirectiveHost();
|
|
825
839
|
const slug = provisionalDirectiveSlug(content);
|
|
826
|
-
const known = slug ? (0,
|
|
827
|
-
const display = known ? (0,
|
|
840
|
+
const known = slug ? (0, import_content_ir4.parseDirectiveSlug)(slug) : null;
|
|
841
|
+
const display = known ? (0, import_content_ir4.directiveDisplay)(known.directiveClass, known.noun, host.nouns) : null;
|
|
828
842
|
const Icon = known ? classIcon(known.directiveClass, known.noun) : BoxesIcon;
|
|
829
843
|
const title = display?.title ?? "Structured action";
|
|
830
844
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
@@ -853,7 +867,7 @@ function DirectiveProvisionalCard({ content, streaming, className }) {
|
|
|
853
867
|
}
|
|
854
868
|
|
|
855
869
|
// directives/registry.ts
|
|
856
|
-
var
|
|
870
|
+
var import_content_ir5 = require("@ai-matrx/content-ir");
|
|
857
871
|
var REGISTRY_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.content-ir-react.directive-renderers");
|
|
858
872
|
var registry = globalThis[REGISTRY_SLOT] ??= {
|
|
859
873
|
bySlug: /* @__PURE__ */ new Map(),
|
|
@@ -865,7 +879,7 @@ function getDirectiveRenderer(directive) {
|
|
|
865
879
|
|
|
866
880
|
// directives/SideEffectDirectiveCard.tsx
|
|
867
881
|
var import_react6 = require("react");
|
|
868
|
-
var
|
|
882
|
+
var import_content_ir6 = require("@ai-matrx/content-ir");
|
|
869
883
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
870
884
|
function directiveValueWord(host, noun) {
|
|
871
885
|
const valueLabel = host.valueLabel;
|
|
@@ -888,20 +902,28 @@ function ItemRow({
|
|
|
888
902
|
if (recordId) {
|
|
889
903
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TargetRow, { directive, item, recordId, index, phase });
|
|
890
904
|
}
|
|
891
|
-
const titleColumn = (0,
|
|
892
|
-
const
|
|
893
|
-
const
|
|
905
|
+
const titleColumn = (0, import_content_ir6.nounTitleColumn)(directive.noun, host.nouns);
|
|
906
|
+
const ownName = itemOwnName(item, titleColumn);
|
|
907
|
+
const title = ownName ?? NO_TITLE_WORD;
|
|
908
|
+
const subtitle = (0, import_content_ir6.itemSubtitle)(item);
|
|
894
909
|
const valueWord = directiveValueWord(host, directive.noun);
|
|
895
|
-
const facts = (0,
|
|
910
|
+
const facts = (0, import_content_ir6.itemFacts)(titleColumn ? omitKey(item, titleColumn) : item).map((fact) => ({
|
|
896
911
|
...fact,
|
|
897
912
|
label: directiveFieldLabel(fact.key, titleColumn),
|
|
898
913
|
value: valueWord?.(fact.key, fact.value) ?? fact.value
|
|
899
914
|
}));
|
|
900
915
|
const kind = host.itemKind?.(directive.slug) ?? null;
|
|
901
|
-
const display = (0,
|
|
916
|
+
const display = (0, import_content_ir6.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
902
917
|
const openItem = host.openItem;
|
|
903
918
|
const body = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
904
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
920
|
+
"span",
|
|
921
|
+
{
|
|
922
|
+
className: `min-w-0 shrink-0 truncate font-medium ${ownName ? "text-foreground" : "italic text-muted-foreground"}`,
|
|
923
|
+
"data-item-untitled": ownName ? void 0 : "",
|
|
924
|
+
children: title
|
|
925
|
+
}
|
|
926
|
+
),
|
|
905
927
|
/* @__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", "data-item-fact": fact.key, children: [
|
|
906
928
|
fact.label,
|
|
907
929
|
" ",
|
|
@@ -917,7 +939,7 @@ function ItemRow({
|
|
|
917
939
|
type: "button",
|
|
918
940
|
onClick: () => openItem({
|
|
919
941
|
// Stamped so the panel's kind pipeline types it from its own first key.
|
|
920
|
-
item: (0,
|
|
942
|
+
item: (0, import_content_ir6.asKindInstance)(item, kind) ?? item,
|
|
921
943
|
itemKind: kind,
|
|
922
944
|
title,
|
|
923
945
|
subtitle: `${display.title} \xB7 item ${index + 1} of ${total}`,
|
|
@@ -930,7 +952,12 @@ function ItemRow({
|
|
|
930
952
|
children: body
|
|
931
953
|
}
|
|
932
954
|
) : /* @__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 }),
|
|
933
|
-
host.renderCopy?.({
|
|
955
|
+
host.renderCopy?.({
|
|
956
|
+
label: ownName ?? `this ${(0, import_content_ir6.nounLabel)(directive.noun, host.nouns)}`,
|
|
957
|
+
value: item,
|
|
958
|
+
kind,
|
|
959
|
+
size: "xs"
|
|
960
|
+
})
|
|
934
961
|
] });
|
|
935
962
|
}
|
|
936
963
|
function DirectiveChangeList({
|
|
@@ -984,7 +1011,7 @@ function TargetRow({
|
|
|
984
1011
|
phase
|
|
985
1012
|
}) {
|
|
986
1013
|
const host = useDirectiveHost();
|
|
987
|
-
const fallback = recordFallbackName((0,
|
|
1014
|
+
const fallback = recordFallbackName((0, import_content_ir6.nounLabel)(directive.noun, host.nouns));
|
|
988
1015
|
const isUpdate = directive.directiveClass === "update";
|
|
989
1016
|
const readsLive = isUpdate && phase.phase === "open";
|
|
990
1017
|
const live = useRecordValues(
|
|
@@ -993,7 +1020,7 @@ function TargetRow({
|
|
|
993
1020
|
);
|
|
994
1021
|
const compareTo = phase.phase === "applied" ? phase.before?.[index] ?? null : readsLive ? live.values : null;
|
|
995
1022
|
const changes = isUpdate ? itemChanges(item, compareTo, {
|
|
996
|
-
titleColumn: (0,
|
|
1023
|
+
titleColumn: (0, import_content_ir6.nounTitleColumn)(directive.noun, host.nouns),
|
|
997
1024
|
valueWord: directiveValueWord(host, directive.noun)
|
|
998
1025
|
}) : [];
|
|
999
1026
|
const name = host.renderRecord ? host.renderRecord({ noun: directive.noun, id: recordId, fallback, context: "row" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "truncate font-medium text-foreground", children: fallback });
|
|
@@ -1001,7 +1028,7 @@ function TargetRow({
|
|
|
1001
1028
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1002
1029
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "flex min-w-0 flex-1 items-center gap-1 px-1", children: name }),
|
|
1003
1030
|
host.renderCopy?.({
|
|
1004
|
-
label: `this ${(0,
|
|
1031
|
+
label: `this ${(0, import_content_ir6.nounLabel)(directive.noun, host.nouns).toLowerCase()}`,
|
|
1005
1032
|
value: item,
|
|
1006
1033
|
size: "xs",
|
|
1007
1034
|
record: { noun: directive.noun, id: recordId }
|
|
@@ -1015,7 +1042,7 @@ function SideEffectDirectiveCard({ directive }) {
|
|
|
1015
1042
|
const [expanded, setExpanded] = (0, import_react6.useState)(false);
|
|
1016
1043
|
const items = directive.items;
|
|
1017
1044
|
const total = items.length;
|
|
1018
|
-
const display = (0,
|
|
1045
|
+
const display = (0, import_content_ir6.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
1019
1046
|
const Icon = classIcon(directive.directiveClass, directive.noun);
|
|
1020
1047
|
const [phase, setPhase] = (0, import_react6.useState)(
|
|
1021
1048
|
() => readsApplyLedger(host, directive) ? { phase: "pending" } : { phase: "open" }
|
|
@@ -1081,13 +1108,13 @@ function DirectiveRender({ conversationId, ...props }) {
|
|
|
1081
1108
|
}
|
|
1082
1109
|
function DirectiveRenderInner({ content, className, streaming }) {
|
|
1083
1110
|
const host = useDirectiveHost();
|
|
1084
|
-
const directive = (0,
|
|
1111
|
+
const directive = (0, import_content_ir7.tryDecodeDirectiveContent)(content, (message) => {
|
|
1085
1112
|
const line = `[kind-directives] ${message}`;
|
|
1086
1113
|
if (host.reportError) host.reportError(line);
|
|
1087
1114
|
else console.error(line);
|
|
1088
1115
|
});
|
|
1089
1116
|
if (!directive) {
|
|
1090
|
-
if (typeof content === "string" && (0,
|
|
1117
|
+
if (typeof content === "string" && (0, import_content_ir7.looksLikeDirectiveHead)(content) && !isWholeJson(content)) {
|
|
1091
1118
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DirectiveProvisionalCard, { content, streaming: streaming !== false, className });
|
|
1092
1119
|
}
|
|
1093
1120
|
const raw = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
@@ -1106,7 +1133,7 @@ function DirectiveRenderInner({ content, className, streaming }) {
|
|
|
1106
1133
|
}
|
|
1107
1134
|
|
|
1108
1135
|
// route/kind-route.ts
|
|
1109
|
-
var
|
|
1136
|
+
var import_content_ir8 = require("@ai-matrx/content-ir");
|
|
1110
1137
|
var IR_ROUTE_KEY = "__ir_route";
|
|
1111
1138
|
var GENERIC_STRUCTURED_COMPONENT_KEY = "generic_structured";
|
|
1112
1139
|
var SOURCELESS_DB_ROW_SLOT = /* @__PURE__ */ Symbol.for(
|
|
@@ -1130,14 +1157,14 @@ function isRecordValue(value) {
|
|
|
1130
1157
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1131
1158
|
}
|
|
1132
1159
|
function kindIsRoutable(kind, host) {
|
|
1133
|
-
if ((0,
|
|
1160
|
+
if ((0, import_content_ir9.isReservedDirectiveSlug)(kind)) return true;
|
|
1134
1161
|
if (host.kinds.getDefinition(kind)?.legacyBlockType) return true;
|
|
1135
1162
|
const resolution = host.components.resolve(kind, host.platform, "output");
|
|
1136
1163
|
if (!resolution?.isActive) return false;
|
|
1137
1164
|
return resolution.componentKey !== GENERIC_STRUCTURED_COMPONENT_KEY;
|
|
1138
1165
|
}
|
|
1139
1166
|
function KindInstanceRender(props) {
|
|
1140
|
-
if ((0,
|
|
1167
|
+
if ((0, import_content_ir9.isReservedDirectiveSlug)(props.kind)) {
|
|
1141
1168
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1142
1169
|
DirectiveRender,
|
|
1143
1170
|
{
|
|
@@ -1192,7 +1219,7 @@ function KindInstanceRenderInner({
|
|
|
1192
1219
|
content: JSON.stringify(value, null, 2),
|
|
1193
1220
|
language: "json",
|
|
1194
1221
|
metadata: {
|
|
1195
|
-
[
|
|
1222
|
+
[import_content_ir9.IR_ENVELOPE_KEY]: (0, import_content_ir9.envelopeFromCompleteValue)(value, kind)
|
|
1196
1223
|
}
|
|
1197
1224
|
} : null;
|
|
1198
1225
|
const frameClass = variant === "bare" ? void 0 : "rounded-md border border-border bg-card p-3";
|
|
@@ -1211,7 +1238,7 @@ function KindInstanceRenderInner({
|
|
|
1211
1238
|
var import_react8 = __toESM(require("react"), 1);
|
|
1212
1239
|
|
|
1213
1240
|
// route/partial-kind-route.ts
|
|
1214
|
-
var
|
|
1241
|
+
var import_content_ir10 = require("@ai-matrx/content-ir");
|
|
1215
1242
|
var PARTIAL_UNSAFE_SLOT = /* @__PURE__ */ Symbol.for(
|
|
1216
1243
|
"ai-matrx.content-ir-react.partial-unsafe-kinds"
|
|
1217
1244
|
);
|
|
@@ -1259,12 +1286,12 @@ function ProvisionalKindFrame({ children }) {
|
|
|
1259
1286
|
|
|
1260
1287
|
// react/GenericStructuredView.tsx
|
|
1261
1288
|
var import_react9 = require("react");
|
|
1262
|
-
var
|
|
1289
|
+
var import_content_ir11 = require("@ai-matrx/content-ir");
|
|
1263
1290
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1264
1291
|
function readStructuredValue(content, metadata) {
|
|
1265
|
-
const envelope = (0,
|
|
1292
|
+
const envelope = (0, import_content_ir11.readEnvelope)(metadata);
|
|
1266
1293
|
if (envelope) {
|
|
1267
|
-
return { value: (0,
|
|
1294
|
+
return { value: (0, import_content_ir11.reconstructRegionValue)(envelope), recovered: true };
|
|
1268
1295
|
}
|
|
1269
1296
|
try {
|
|
1270
1297
|
return { value: JSON.parse(content), recovered: true };
|
|
@@ -1279,10 +1306,10 @@ function GenericStructuredView({
|
|
|
1279
1306
|
className
|
|
1280
1307
|
}) {
|
|
1281
1308
|
const host = useContentIrHost();
|
|
1282
|
-
const envelope = (0,
|
|
1309
|
+
const envelope = (0, import_content_ir11.readEnvelope)(metadata);
|
|
1283
1310
|
const status = envelope?.root.status ?? "complete";
|
|
1284
1311
|
const { value, recovered } = readStructuredValue(content, metadata);
|
|
1285
|
-
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? (0,
|
|
1312
|
+
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? (0, import_content_ir11.readObjectKind)(value) : null) ?? "";
|
|
1286
1313
|
const marker = readIrRouteMarker(metadata);
|
|
1287
1314
|
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";
|
|
1288
1315
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
|
|
@@ -1296,7 +1323,7 @@ function GenericStructuredView({
|
|
|
1296
1323
|
}
|
|
1297
1324
|
|
|
1298
1325
|
// react/RuntimeWrapperViews.tsx
|
|
1299
|
-
var
|
|
1326
|
+
var import_content_ir12 = require("@ai-matrx/content-ir");
|
|
1300
1327
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1301
1328
|
function isRecord2(value) {
|
|
1302
1329
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1318,7 +1345,7 @@ function DelegatedOutput({
|
|
|
1318
1345
|
if (!isRecord2(output)) {
|
|
1319
1346
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: host.renderValue({ value: output }) });
|
|
1320
1347
|
}
|
|
1321
|
-
const kind = (0,
|
|
1348
|
+
const kind = (0, import_content_ir12.readObjectKind)(output) ?? declaredKind;
|
|
1322
1349
|
if (!kind) {
|
|
1323
1350
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: fallback?.(output) ?? host.renderValue({ value: output }) });
|
|
1324
1351
|
}
|
|
@@ -1336,7 +1363,7 @@ function DelegatedOutput({
|
|
|
1336
1363
|
function NodeOutcomeView({ serverData, fallback }) {
|
|
1337
1364
|
const wrapper = readWrapperFrom(
|
|
1338
1365
|
serverData,
|
|
1339
|
-
|
|
1366
|
+
import_content_ir12.readNodeOutcomeValue
|
|
1340
1367
|
);
|
|
1341
1368
|
if (!wrapper) return null;
|
|
1342
1369
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -1351,7 +1378,7 @@ function NodeOutcomeView({ serverData, fallback }) {
|
|
|
1351
1378
|
function RunResultView({ serverData, fallback }) {
|
|
1352
1379
|
const wrapper = readWrapperFrom(
|
|
1353
1380
|
serverData,
|
|
1354
|
-
|
|
1381
|
+
import_content_ir12.readRunResultValue
|
|
1355
1382
|
);
|
|
1356
1383
|
if (!wrapper) return null;
|
|
1357
1384
|
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)(
|