@ai-matrx/content-ir-react 0.11.10 → 0.12.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 +48 -0
- package/dist/directive-host-Bl-ZgJWp.d.cts +116 -0
- package/dist/directive-host-Bl-ZgJWp.d.ts +116 -0
- package/dist/directives.cjs +219 -25
- package/dist/directives.cjs.map +1 -1
- package/dist/directives.d.cts +64 -3
- package/dist/directives.d.ts +64 -3
- package/dist/directives.js +209 -14
- package/dist/directives.js.map +1 -1
- package/dist/{host-types-C8jR31Wk.d.cts → host-types-BgROpyjE.d.cts} +1 -1
- package/dist/{host-types-IUEDmso7.d.ts → host-types-Cz-1pGHz.d.ts} +1 -1
- package/dist/host.cjs.map +1 -1
- package/dist/host.d.cts +3 -3
- package/dist/host.d.ts +3 -3
- package/dist/host.js.map +1 -1
- package/dist/index.cjs +278 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -4
- package/dist/index.d.ts +65 -4
- package/dist/index.js +256 -61
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +271 -85
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +248 -61
- package/dist/react.js.map +1 -1
- package/dist/{route-B9U-9QCw.d.cts → route-DxK1SoPh.d.cts} +54 -1
- package/dist/{route-gNpJ8zzW.d.ts → route-JGZfl2nL.d.ts} +54 -1
- package/dist/route.d.cts +1 -1
- package/dist/route.d.ts +1 -1
- package/package.json +1 -1
- package/dist/directive-host-DAb7Keg8.d.cts +0 -63
- package/dist/directive-host-DAb7Keg8.d.ts +0 -63
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ApplyDirectiveButton: () => ApplyDirectiveButton,
|
|
34
|
+
CHANGE_VALUE_MAX: () => CHANGE_VALUE_MAX,
|
|
34
35
|
ComponentResolver: () => ComponentResolver,
|
|
35
36
|
ContentIrRenderProvider: () => ContentIrRenderProvider,
|
|
36
37
|
DB_KIND_COMPONENT_KEY: () => DB_KIND_COMPONENT_KEY,
|
|
@@ -39,6 +40,7 @@ __export(index_exports, {
|
|
|
39
40
|
DelegatedOutput: () => DelegatedOutput,
|
|
40
41
|
DirectiveFallbackCard: () => DirectiveFallbackCard,
|
|
41
42
|
DirectiveHostProvider: () => DirectiveHostProvider,
|
|
43
|
+
DirectiveProvisionalCard: () => DirectiveProvisionalCard,
|
|
42
44
|
DirectiveRender: () => DirectiveRender,
|
|
43
45
|
GENERIC_STRUCTURED_COMPONENT_KEY: () => GENERIC_STRUCTURED_COMPONENT_KEY,
|
|
44
46
|
GenericStructuredView: () => GenericStructuredView,
|
|
@@ -50,20 +52,26 @@ __export(index_exports, {
|
|
|
50
52
|
ProvisionalKindFrame: () => ProvisionalKindFrame,
|
|
51
53
|
RunResultView: () => RunResultView,
|
|
52
54
|
SideEffectDirectiveCard: () => SideEffectDirectiveCard,
|
|
55
|
+
TARGETING_CLASSES: () => TARGETING_CLASSES,
|
|
53
56
|
applyIrKindRoute: () => applyIrKindRoute,
|
|
54
57
|
consoleErrorReporter: () => consoleErrorReporter,
|
|
55
58
|
createDbKindComponentCache: () => createDbKindComponentCache,
|
|
56
59
|
createKindRouteBinding: () => createKindRouteBinding,
|
|
57
60
|
envelopeFromPartialKind: () => envelopeFromPartialKind,
|
|
61
|
+
fieldLabel: () => fieldLabel,
|
|
58
62
|
getDirectiveRenderer: () => getDirectiveRenderer,
|
|
59
63
|
isDbKindComponentBodyPending: () => isDbKindComponentBodyPending,
|
|
60
64
|
isPartialReadyKind: () => isPartialReadyKind,
|
|
61
65
|
isProvisionalBlock: () => isProvisionalBlock,
|
|
62
66
|
isRecordValue: () => isRecordValue,
|
|
67
|
+
itemChanges: () => itemChanges,
|
|
68
|
+
itemRecordId: () => itemRecordId,
|
|
63
69
|
kindIsRoutable: () => kindIsRoutable,
|
|
64
70
|
kindServerDataFromStoredValue: () => kindServerDataFromStoredValue,
|
|
65
71
|
markKindPartialUnsafe: () => markKindPartialUnsafe,
|
|
72
|
+
provisionalDirectiveSlug: () => provisionalDirectiveSlug,
|
|
66
73
|
readIrRouteMarker: () => readIrRouteMarker,
|
|
74
|
+
recordFallbackName: () => recordFallbackName,
|
|
67
75
|
registerDirectiveRenderer: () => registerDirectiveRenderer,
|
|
68
76
|
resetDirectiveRenderers: () => resetDirectiveRenderers,
|
|
69
77
|
resetPartialUnsafeKinds: () => resetPartialUnsafeKinds,
|
|
@@ -769,16 +777,73 @@ function useContentIrKindVersion(kind, sources) {
|
|
|
769
777
|
|
|
770
778
|
// react/KindInstanceRender.tsx
|
|
771
779
|
var import_react6 = require("react");
|
|
772
|
-
var
|
|
780
|
+
var import_content_ir9 = require("@ai-matrx/content-ir");
|
|
773
781
|
|
|
774
782
|
// directives/DirectiveRender.tsx
|
|
775
|
-
var
|
|
783
|
+
var import_content_ir8 = require("@ai-matrx/content-ir");
|
|
776
784
|
|
|
777
785
|
// directives/DirectiveFallbackCard.tsx
|
|
778
|
-
var
|
|
786
|
+
var import_content_ir4 = require("@ai-matrx/content-ir");
|
|
779
787
|
|
|
780
788
|
// directives/ApplyDirectiveButton.tsx
|
|
781
789
|
var import_react4 = require("react");
|
|
790
|
+
var import_content_ir3 = require("@ai-matrx/content-ir");
|
|
791
|
+
|
|
792
|
+
// directives/item-changes.ts
|
|
793
|
+
var TARGETING_CLASSES = /* @__PURE__ */ new Set(["update", "delete"]);
|
|
794
|
+
var NOT_A_CHANGE = /* @__PURE__ */ new Set(["__kind", "id"]);
|
|
795
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
796
|
+
var CHANGE_VALUE_MAX = 60;
|
|
797
|
+
function itemRecordId(item) {
|
|
798
|
+
const id = item.id;
|
|
799
|
+
if (typeof id === "string" && id.trim()) return id.trim();
|
|
800
|
+
if (typeof id === "number") return String(id);
|
|
801
|
+
return null;
|
|
802
|
+
}
|
|
803
|
+
function fieldLabel(key) {
|
|
804
|
+
const spaced = key.replace(/_/g, " ").trim();
|
|
805
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
806
|
+
}
|
|
807
|
+
function recordFallbackName(nounLabel3, id) {
|
|
808
|
+
const short = UUID_RE.test(id) ? id.slice(0, 8) : id.length > 12 ? `${id.slice(0, 12)}\u2026` : id;
|
|
809
|
+
return `${nounLabel3} ${short}`;
|
|
810
|
+
}
|
|
811
|
+
function describeValue(value) {
|
|
812
|
+
if (value === null || value === void 0) return { value: "cleared", full: "cleared", clears: true };
|
|
813
|
+
if (typeof value === "string") {
|
|
814
|
+
const trimmed = value.trim();
|
|
815
|
+
if (!trimmed) return { value: "cleared", full: "cleared", clears: true };
|
|
816
|
+
const oneLine = trimmed.replace(/\s+/g, " ");
|
|
817
|
+
const shown = oneLine.length > CHANGE_VALUE_MAX ? `${oneLine.slice(0, CHANGE_VALUE_MAX - 1)}\u2026` : oneLine;
|
|
818
|
+
return { value: shown, full: trimmed, clears: false };
|
|
819
|
+
}
|
|
820
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
821
|
+
return { value: String(value), full: String(value), clears: false };
|
|
822
|
+
}
|
|
823
|
+
if (Array.isArray(value)) {
|
|
824
|
+
const n2 = value.length;
|
|
825
|
+
const text2 = n2 === 0 ? "cleared" : `${n2} ${n2 === 1 ? "entry" : "entries"}`;
|
|
826
|
+
return { value: text2, full: safeJson(value), clears: n2 === 0 };
|
|
827
|
+
}
|
|
828
|
+
const n = Object.keys(value).length;
|
|
829
|
+
const text = n === 0 ? "cleared" : `${n} ${n === 1 ? "field" : "fields"}`;
|
|
830
|
+
return { value: text, full: safeJson(value), clears: n === 0 };
|
|
831
|
+
}
|
|
832
|
+
function safeJson(value) {
|
|
833
|
+
try {
|
|
834
|
+
return JSON.stringify(value, null, 2);
|
|
835
|
+
} catch {
|
|
836
|
+
return String(value);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
function itemChanges(item) {
|
|
840
|
+
const out = [];
|
|
841
|
+
for (const [key, raw] of Object.entries(item)) {
|
|
842
|
+
if (NOT_A_CHANGE.has(key)) continue;
|
|
843
|
+
out.push({ key, label: fieldLabel(key), ...describeValue(raw) });
|
|
844
|
+
}
|
|
845
|
+
return out;
|
|
846
|
+
}
|
|
782
847
|
|
|
783
848
|
// directives/icons.tsx
|
|
784
849
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -896,10 +961,38 @@ function ApplyDirectiveButton({
|
|
|
896
961
|
const items = directive.items;
|
|
897
962
|
async function handleApply() {
|
|
898
963
|
if (!confirm) return;
|
|
964
|
+
if (host.ask) {
|
|
965
|
+
setState({ status: "asking" });
|
|
966
|
+
let ok = false;
|
|
967
|
+
try {
|
|
968
|
+
ok = await host.ask({
|
|
969
|
+
directive,
|
|
970
|
+
items,
|
|
971
|
+
nounLabel: (0, import_content_ir3.nounLabel)(directive.noun, host.nouns)
|
|
972
|
+
});
|
|
973
|
+
} catch (error) {
|
|
974
|
+
setState({
|
|
975
|
+
status: "error",
|
|
976
|
+
message: error instanceof Error && error.message ? error.message : "We could not ask you to confirm this, so nothing was done."
|
|
977
|
+
});
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
if (!ok) {
|
|
981
|
+
setState({ status: "idle" });
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
setElapsed(0);
|
|
899
986
|
setState({ status: "applying" });
|
|
900
987
|
try {
|
|
901
988
|
const result = await confirm({ __kind: directive.slug, items });
|
|
902
|
-
setState({
|
|
989
|
+
setState({
|
|
990
|
+
status: "applied",
|
|
991
|
+
applied: result.applied,
|
|
992
|
+
failed: result.failed,
|
|
993
|
+
message: result.message?.trim() ? result.message.trim() : null,
|
|
994
|
+
records: result.records ?? []
|
|
995
|
+
});
|
|
903
996
|
onApplied?.();
|
|
904
997
|
} catch (error) {
|
|
905
998
|
setState({
|
|
@@ -910,15 +1003,26 @@ function ApplyDirectiveButton({
|
|
|
910
1003
|
}
|
|
911
1004
|
if (state.status === "applied") {
|
|
912
1005
|
const bad = state.failed > 0;
|
|
1006
|
+
const trashed = directive.directiveClass === "delete";
|
|
1007
|
+
const label2 = (0, import_content_ir3.nounLabel)(directive.noun, host.nouns);
|
|
1008
|
+
const records = host.renderRecord ? state.records : [];
|
|
913
1009
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
914
1010
|
"span",
|
|
915
1011
|
{
|
|
916
|
-
className: `inline-flex items-center gap-1 text-xs ${bad ? "text-destructive" : "text-primary"}`,
|
|
1012
|
+
className: `inline-flex min-w-0 flex-wrap items-center gap-1 text-xs ${bad ? "text-destructive" : "text-primary"}`,
|
|
1013
|
+
"data-apply-state": "applied",
|
|
917
1014
|
children: [
|
|
918
|
-
bad ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AlertIcon, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckCircleIcon, { className: "h-3.5 w-3.5" }),
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1015
|
+
bad ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AlertIcon, { className: "h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckCircleIcon, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
|
|
1017
|
+
state.message ?? `Applied ${state.applied}`,
|
|
1018
|
+
bad && !state.message ? ` \xB7 ${state.failed} failed` : ""
|
|
1019
|
+
] }),
|
|
1020
|
+
records.map((record) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
|
|
1021
|
+
...record,
|
|
1022
|
+
fallback: recordFallbackName(label2, record.id),
|
|
1023
|
+
context: "applied",
|
|
1024
|
+
trashed
|
|
1025
|
+
}) }, `${record.noun}:${record.id}`))
|
|
922
1026
|
]
|
|
923
1027
|
}
|
|
924
1028
|
);
|
|
@@ -929,7 +1033,7 @@ function ApplyDirectiveButton({
|
|
|
929
1033
|
{
|
|
930
1034
|
type: "button",
|
|
931
1035
|
onClick: () => void handleApply(),
|
|
932
|
-
disabled: state.status === "applying" || items.length === 0,
|
|
1036
|
+
disabled: state.status === "applying" || state.status === "asking" || items.length === 0,
|
|
933
1037
|
className: "inline-flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1 text-xs font-medium hover:bg-accent disabled:opacity-50",
|
|
934
1038
|
children: [
|
|
935
1039
|
state.status === "applying" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LoaderIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PlayIcon, { className: "h-3.5 w-3.5" }),
|
|
@@ -949,7 +1053,7 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
|
949
1053
|
function DirectiveFallbackCard({ directive, reason }) {
|
|
950
1054
|
const host = useDirectiveHost();
|
|
951
1055
|
const count = directive.items.length;
|
|
952
|
-
const display = (0,
|
|
1056
|
+
const display = (0, import_content_ir4.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
953
1057
|
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: [
|
|
954
1058
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoxesIcon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
955
1059
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-foreground", children: display.title }),
|
|
@@ -971,15 +1075,55 @@ function DirectiveFallbackCard({ directive, reason }) {
|
|
|
971
1075
|
] });
|
|
972
1076
|
}
|
|
973
1077
|
|
|
1078
|
+
// directives/DirectiveProvisionalCard.tsx
|
|
1079
|
+
var import_content_ir5 = require("@ai-matrx/content-ir");
|
|
1080
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1081
|
+
var COMPLETE_SLUG_RE = /^\{\s*"__kind"\s*:\s*"([^"]+)"/;
|
|
1082
|
+
function provisionalDirectiveSlug(content) {
|
|
1083
|
+
const match = content.trimStart().match(COMPLETE_SLUG_RE);
|
|
1084
|
+
return match?.[1] ?? null;
|
|
1085
|
+
}
|
|
1086
|
+
function DirectiveProvisionalCard({ content, streaming, className }) {
|
|
1087
|
+
const host = useDirectiveHost();
|
|
1088
|
+
const slug = provisionalDirectiveSlug(content);
|
|
1089
|
+
const known = slug ? (0, import_content_ir5.parseDirectiveSlug)(slug) : null;
|
|
1090
|
+
const display = known ? (0, import_content_ir5.directiveDisplay)(known.directiveClass, known.noun, host.nouns) : null;
|
|
1091
|
+
const Icon = known ? classIcon(known.directiveClass, known.noun) : BoxesIcon;
|
|
1092
|
+
const title = display?.title ?? "Structured action";
|
|
1093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1094
|
+
"div",
|
|
1095
|
+
{
|
|
1096
|
+
className: `my-3 rounded-md border border-border bg-card px-2.5 py-1.5${className ? ` ${className}` : ""}`,
|
|
1097
|
+
"data-directive": slug ?? void 0,
|
|
1098
|
+
"data-directive-state": streaming ? "streaming" : "incomplete",
|
|
1099
|
+
children: [
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm font-medium text-foreground", children: title }),
|
|
1103
|
+
display?.family ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs text-muted-foreground", children: display.family }) : null,
|
|
1104
|
+
streaming ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", role: "status", children: [
|
|
1105
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-primary", "aria-hidden": true }),
|
|
1106
|
+
"Writing\u2026"
|
|
1107
|
+
] }) : /* @__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." })
|
|
1108
|
+
] }),
|
|
1109
|
+
streaming ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("summary", { className: "cursor-pointer select-none hover:text-foreground", children: "Show what arrived" }),
|
|
1111
|
+
/* @__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 })
|
|
1112
|
+
] })
|
|
1113
|
+
]
|
|
1114
|
+
}
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
974
1118
|
// directives/registry.ts
|
|
975
|
-
var
|
|
1119
|
+
var import_content_ir6 = require("@ai-matrx/content-ir");
|
|
976
1120
|
var REGISTRY_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.content-ir-react.directive-renderers");
|
|
977
1121
|
var registry = globalThis[REGISTRY_SLOT] ??= {
|
|
978
1122
|
bySlug: /* @__PURE__ */ new Map(),
|
|
979
1123
|
byClass: /* @__PURE__ */ new Map()
|
|
980
1124
|
};
|
|
981
1125
|
function registerDirectiveRenderer(directiveClass, renderer, noun) {
|
|
982
|
-
if (noun) registry.bySlug.set((0,
|
|
1126
|
+
if (noun) registry.bySlug.set((0, import_content_ir6.buildDirectiveSlug)(directiveClass, noun), renderer);
|
|
983
1127
|
else registry.byClass.set(directiveClass, renderer);
|
|
984
1128
|
}
|
|
985
1129
|
function getDirectiveRenderer(directive) {
|
|
@@ -992,8 +1136,8 @@ function resetDirectiveRenderers() {
|
|
|
992
1136
|
|
|
993
1137
|
// directives/SideEffectDirectiveCard.tsx
|
|
994
1138
|
var import_react5 = require("react");
|
|
995
|
-
var
|
|
996
|
-
var
|
|
1139
|
+
var import_content_ir7 = require("@ai-matrx/content-ir");
|
|
1140
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
997
1141
|
var ROWS_BEFORE_FOLD = 3;
|
|
998
1142
|
function ItemRow({
|
|
999
1143
|
directive,
|
|
@@ -1002,31 +1146,35 @@ function ItemRow({
|
|
|
1002
1146
|
total
|
|
1003
1147
|
}) {
|
|
1004
1148
|
const host = useDirectiveHost();
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1149
|
+
const recordId = TARGETING_CLASSES.has(directive.directiveClass) ? itemRecordId(item) : null;
|
|
1150
|
+
if (recordId) {
|
|
1151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TargetRow, { directive, item, recordId });
|
|
1152
|
+
}
|
|
1153
|
+
const titleColumn = (0, import_content_ir7.nounTitleColumn)(directive.noun, host.nouns);
|
|
1154
|
+
const title = (0, import_content_ir7.itemTitle)(item, titleColumn, index, total);
|
|
1155
|
+
const subtitle = (0, import_content_ir7.itemSubtitle)(item);
|
|
1156
|
+
const facts = (0, import_content_ir7.itemFacts)(item);
|
|
1009
1157
|
const kind = host.itemKind?.(directive.slug) ?? null;
|
|
1010
|
-
const display = (0,
|
|
1158
|
+
const display = (0, import_content_ir7.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
1011
1159
|
const openItem = host.openItem;
|
|
1012
|
-
const body = /* @__PURE__ */ (0,
|
|
1013
|
-
/* @__PURE__ */ (0,
|
|
1014
|
-
/* @__PURE__ */ (0,
|
|
1160
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1161
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "min-w-0 shrink-0 truncate font-medium text-foreground", children: title }),
|
|
1162
|
+
/* @__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: [
|
|
1015
1163
|
fact.value,
|
|
1016
1164
|
" ",
|
|
1017
1165
|
fact.label
|
|
1018
1166
|
] }, fact.key)) }),
|
|
1019
|
-
subtitle && facts.length === 0 ? /* @__PURE__ */ (0,
|
|
1020
|
-
openItem ? /* @__PURE__ */ (0,
|
|
1167
|
+
subtitle && facts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hidden truncate text-[11px] text-muted-foreground sm:inline", children: subtitle }) : null,
|
|
1168
|
+
openItem ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MaximizeIcon, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" }) : null
|
|
1021
1169
|
] });
|
|
1022
|
-
return /* @__PURE__ */ (0,
|
|
1023
|
-
openItem ? /* @__PURE__ */ (0,
|
|
1170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 py-1 text-xs", children: [
|
|
1171
|
+
openItem ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1024
1172
|
"button",
|
|
1025
1173
|
{
|
|
1026
1174
|
type: "button",
|
|
1027
1175
|
onClick: () => openItem({
|
|
1028
1176
|
// Stamped so the panel's kind pipeline types it from its own first key.
|
|
1029
|
-
item: (0,
|
|
1177
|
+
item: (0, import_content_ir7.asKindInstance)(item, kind) ?? item,
|
|
1030
1178
|
itemKind: kind,
|
|
1031
1179
|
title,
|
|
1032
1180
|
subtitle: `${display.title} \xB7 item ${index + 1} of ${total}`,
|
|
@@ -1038,46 +1186,81 @@ function ItemRow({
|
|
|
1038
1186
|
title: "Open to read it",
|
|
1039
1187
|
children: body
|
|
1040
1188
|
}
|
|
1041
|
-
) : /* @__PURE__ */ (0,
|
|
1189
|
+
) : /* @__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 }),
|
|
1042
1190
|
host.renderCopy?.({ label: title, value: item, kind, size: "xs" })
|
|
1043
1191
|
] });
|
|
1044
1192
|
}
|
|
1193
|
+
function TargetRow({
|
|
1194
|
+
directive,
|
|
1195
|
+
item,
|
|
1196
|
+
recordId
|
|
1197
|
+
}) {
|
|
1198
|
+
const host = useDirectiveHost();
|
|
1199
|
+
const fallback = recordFallbackName((0, import_content_ir7.nounLabel)(directive.noun, host.nouns), recordId);
|
|
1200
|
+
const changes = directive.directiveClass === "update" ? itemChanges(item) : [];
|
|
1201
|
+
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 });
|
|
1202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "py-1 text-xs", "data-directive-target": recordId, children: [
|
|
1203
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "flex min-w-0 flex-1 items-center gap-1 px-1", children: name }),
|
|
1205
|
+
host.renderCopy?.({ label: fallback, value: item, size: "xs" })
|
|
1206
|
+
] }),
|
|
1207
|
+
directive.directiveClass === "update" ? changes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "px-1 text-[11px] text-muted-foreground", children: "Sets no fields \u2014 nothing would change." }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "mt-0.5 space-y-0.5 px-1", children: changes.map((change) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1208
|
+
"li",
|
|
1209
|
+
{
|
|
1210
|
+
className: "flex min-w-0 items-baseline gap-1.5 text-[11px]",
|
|
1211
|
+
title: `${change.label} \u2192 ${change.full}`,
|
|
1212
|
+
children: [
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "shrink-0 text-muted-foreground", children: change.label }),
|
|
1214
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": true, className: "shrink-0 text-muted-foreground", children: "\u2192" }),
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1216
|
+
"span",
|
|
1217
|
+
{
|
|
1218
|
+
className: `min-w-0 truncate ${change.clears ? "italic text-muted-foreground" : "text-foreground"}`,
|
|
1219
|
+
children: change.value
|
|
1220
|
+
}
|
|
1221
|
+
)
|
|
1222
|
+
]
|
|
1223
|
+
},
|
|
1224
|
+
change.key
|
|
1225
|
+
)) }) : null
|
|
1226
|
+
] });
|
|
1227
|
+
}
|
|
1045
1228
|
function SideEffectDirectiveCard({ directive }) {
|
|
1046
1229
|
const host = useDirectiveHost();
|
|
1047
1230
|
const [expanded, setExpanded] = (0, import_react5.useState)(false);
|
|
1048
1231
|
const items = directive.items;
|
|
1049
1232
|
const total = items.length;
|
|
1050
|
-
const display = (0,
|
|
1233
|
+
const display = (0, import_content_ir7.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
1051
1234
|
const Icon = classIcon(directive.directiveClass, directive.noun);
|
|
1052
1235
|
const shown = expanded ? items : items.slice(0, ROWS_BEFORE_FOLD);
|
|
1053
1236
|
const hidden = total - shown.length;
|
|
1054
|
-
return /* @__PURE__ */ (0,
|
|
1055
|
-
/* @__PURE__ */ (0,
|
|
1056
|
-
/* @__PURE__ */ (0,
|
|
1057
|
-
/* @__PURE__ */ (0,
|
|
1058
|
-
display.family ? /* @__PURE__ */ (0,
|
|
1059
|
-
/* @__PURE__ */ (0,
|
|
1237
|
+
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: [
|
|
1238
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
1239
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-sm font-medium text-foreground", children: display.title }),
|
|
1241
|
+
display.family ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-xs text-muted-foreground", children: display.family }) : null,
|
|
1242
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
1060
1243
|
total,
|
|
1061
1244
|
" ",
|
|
1062
1245
|
total === 1 ? "item" : "items"
|
|
1063
1246
|
] }),
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [
|
|
1065
1248
|
host.renderCopy?.({ label: display.title, value: directive.shell, size: "icon" }),
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ApplyDirectiveButton, { directive, itemCount: total })
|
|
1067
1250
|
] })
|
|
1068
1251
|
] }),
|
|
1069
1252
|
total === 0 ? (
|
|
1070
1253
|
// Stated, never silent: an empty batch is a real (and suspicious) state.
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
1072
|
-
) : /* @__PURE__ */ (0,
|
|
1073
|
-
hidden > 0 || expanded ? /* @__PURE__ */ (0,
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "No items \u2014 nothing would be written." })
|
|
1255
|
+
) : /* @__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)) }),
|
|
1256
|
+
hidden > 0 || expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1074
1257
|
"button",
|
|
1075
1258
|
{
|
|
1076
1259
|
type: "button",
|
|
1077
1260
|
onClick: () => setExpanded((v) => !v),
|
|
1078
1261
|
className: "mt-0.5 inline-flex items-center gap-1 rounded px-1 py-0.5 text-[11px] text-muted-foreground hover:text-foreground",
|
|
1079
1262
|
children: [
|
|
1080
|
-
expanded ? /* @__PURE__ */ (0,
|
|
1263
|
+
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" }),
|
|
1081
1264
|
expanded ? "Show less" : `Show ${hidden} more`
|
|
1082
1265
|
]
|
|
1083
1266
|
}
|
|
@@ -1086,17 +1269,28 @@ function SideEffectDirectiveCard({ directive }) {
|
|
|
1086
1269
|
}
|
|
1087
1270
|
|
|
1088
1271
|
// directives/DirectiveRender.tsx
|
|
1089
|
-
var
|
|
1090
|
-
function
|
|
1272
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1273
|
+
function isWholeJson(content) {
|
|
1274
|
+
try {
|
|
1275
|
+
JSON.parse(content);
|
|
1276
|
+
return true;
|
|
1277
|
+
} catch {
|
|
1278
|
+
return false;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
function DirectiveRender({ content, className, streaming }) {
|
|
1091
1282
|
const host = useDirectiveHost();
|
|
1092
|
-
const directive = (0,
|
|
1283
|
+
const directive = (0, import_content_ir8.tryDecodeDirectiveContent)(content, (message) => {
|
|
1093
1284
|
const line = `[kind-directives] ${message}`;
|
|
1094
1285
|
if (host.reportError) host.reportError(line);
|
|
1095
1286
|
else console.error(line);
|
|
1096
1287
|
});
|
|
1097
1288
|
if (!directive) {
|
|
1289
|
+
if (typeof content === "string" && (0, import_content_ir8.looksLikeDirectiveHead)(content) && !isWholeJson(content)) {
|
|
1290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DirectiveProvisionalCard, { content, streaming: streaming !== false, className });
|
|
1291
|
+
}
|
|
1098
1292
|
const raw = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
1099
|
-
return /* @__PURE__ */ (0,
|
|
1293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1100
1294
|
"pre",
|
|
1101
1295
|
{
|
|
1102
1296
|
className: `my-3 overflow-x-auto rounded-md border border-border bg-muted px-3 py-2 text-xs text-muted-foreground${className ? ` ${className}` : ""}`,
|
|
@@ -1105,26 +1299,26 @@ function DirectiveRender({ content, className }) {
|
|
|
1105
1299
|
);
|
|
1106
1300
|
}
|
|
1107
1301
|
const Renderer = getDirectiveRenderer(directive);
|
|
1108
|
-
if (Renderer) return /* @__PURE__ */ (0,
|
|
1109
|
-
if (directive.parsed.executes) return /* @__PURE__ */ (0,
|
|
1110
|
-
return /* @__PURE__ */ (0,
|
|
1302
|
+
if (Renderer) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Renderer, { directive });
|
|
1303
|
+
if (directive.parsed.executes) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SideEffectDirectiveCard, { directive });
|
|
1304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DirectiveFallbackCard, { directive });
|
|
1111
1305
|
}
|
|
1112
1306
|
|
|
1113
1307
|
// react/KindInstanceRender.tsx
|
|
1114
|
-
var
|
|
1308
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1115
1309
|
function isRecordValue(value) {
|
|
1116
1310
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1117
1311
|
}
|
|
1118
1312
|
function kindIsRoutable(kind, host) {
|
|
1119
|
-
if ((0,
|
|
1313
|
+
if ((0, import_content_ir9.isReservedDirectiveSlug)(kind)) return true;
|
|
1120
1314
|
if (host.kinds.getDefinition(kind)?.legacyBlockType) return true;
|
|
1121
1315
|
const resolution = host.components.resolve(kind, host.platform, "output");
|
|
1122
1316
|
if (!resolution?.isActive) return false;
|
|
1123
1317
|
return resolution.componentKey !== GENERIC_STRUCTURED_COMPONENT_KEY;
|
|
1124
1318
|
}
|
|
1125
1319
|
function KindInstanceRender(props) {
|
|
1126
|
-
if ((0,
|
|
1127
|
-
return /* @__PURE__ */ (0,
|
|
1320
|
+
if ((0, import_content_ir9.isReservedDirectiveSlug)(props.kind)) {
|
|
1321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1128
1322
|
DirectiveRender,
|
|
1129
1323
|
{
|
|
1130
1324
|
content: props.value,
|
|
@@ -1132,7 +1326,7 @@ function KindInstanceRender(props) {
|
|
|
1132
1326
|
}
|
|
1133
1327
|
);
|
|
1134
1328
|
}
|
|
1135
|
-
return /* @__PURE__ */ (0,
|
|
1329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KindInstanceRenderInner, { ...props });
|
|
1136
1330
|
}
|
|
1137
1331
|
function KindInstanceRenderInner({
|
|
1138
1332
|
kind,
|
|
@@ -1178,24 +1372,24 @@ function KindInstanceRenderInner({
|
|
|
1178
1372
|
content: JSON.stringify(value, null, 2),
|
|
1179
1373
|
language: "json",
|
|
1180
1374
|
metadata: {
|
|
1181
|
-
[
|
|
1375
|
+
[import_content_ir9.IR_ENVELOPE_KEY]: (0, import_content_ir9.envelopeFromCompleteValue)(value, kind)
|
|
1182
1376
|
}
|
|
1183
1377
|
} : null;
|
|
1184
1378
|
const frameClass = variant === "bare" ? void 0 : "rounded-md border border-border bg-card p-3";
|
|
1185
1379
|
if (routingStatus === "unroutable" && unroutableFallback !== void 0) {
|
|
1186
|
-
return /* @__PURE__ */ (0,
|
|
1380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: unroutableFallback });
|
|
1187
1381
|
}
|
|
1188
1382
|
const onTheFloor = block === null || routingStatus === "unroutable";
|
|
1189
1383
|
const notice = "This shape has no custom component yet, so it renders through the universal viewer \u2014 exactly what production shows today.";
|
|
1190
|
-
return /* @__PURE__ */ (0,
|
|
1191
|
-
showRoutingNote && routingStatus === "unroutable" ? host.renderNotice?.(notice) ?? /* @__PURE__ */ (0,
|
|
1192
|
-
/* @__PURE__ */ (0,
|
|
1384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: className ? `space-y-3 ${className}` : "space-y-3", children: [
|
|
1385
|
+
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,
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: frameClass, children: onTheFloor ? host.renderValue({ value, kind }) : host.renderBlock(block) })
|
|
1193
1387
|
] });
|
|
1194
1388
|
}
|
|
1195
1389
|
|
|
1196
1390
|
// react/ProvisionalKindBoundary.tsx
|
|
1197
1391
|
var import_react7 = __toESM(require("react"), 1);
|
|
1198
|
-
var
|
|
1392
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1199
1393
|
var ProvisionalKindBoundaryInner = class extends import_react7.default.Component {
|
|
1200
1394
|
state = { failed: false };
|
|
1201
1395
|
static getDerivedStateFromError() {
|
|
@@ -1220,25 +1414,25 @@ var ProvisionalKindBoundaryInner = class extends import_react7.default.Component
|
|
|
1220
1414
|
};
|
|
1221
1415
|
function ProvisionalKindBoundary(props) {
|
|
1222
1416
|
const host = useContentIrHost();
|
|
1223
|
-
return /* @__PURE__ */ (0,
|
|
1417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProvisionalKindBoundaryInner, { ...props, reportError: host.reportError });
|
|
1224
1418
|
}
|
|
1225
1419
|
function ProvisionalKindFrame({ children }) {
|
|
1226
1420
|
const host = useContentIrHost();
|
|
1227
1421
|
const label = "Still arriving";
|
|
1228
|
-
return /* @__PURE__ */ (0,
|
|
1422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative", "aria-busy": "true", children: [
|
|
1229
1423
|
children,
|
|
1230
|
-
/* @__PURE__ */ (0,
|
|
1424
|
+
/* @__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 }) })
|
|
1231
1425
|
] });
|
|
1232
1426
|
}
|
|
1233
1427
|
|
|
1234
1428
|
// react/GenericStructuredView.tsx
|
|
1235
1429
|
var import_react8 = require("react");
|
|
1236
|
-
var
|
|
1237
|
-
var
|
|
1430
|
+
var import_content_ir10 = require("@ai-matrx/content-ir");
|
|
1431
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1238
1432
|
function readStructuredValue(content, metadata) {
|
|
1239
|
-
const envelope = (0,
|
|
1433
|
+
const envelope = (0, import_content_ir10.readEnvelope)(metadata);
|
|
1240
1434
|
if (envelope) {
|
|
1241
|
-
return { value: (0,
|
|
1435
|
+
return { value: (0, import_content_ir10.reconstructRegionValue)(envelope), recovered: true };
|
|
1242
1436
|
}
|
|
1243
1437
|
try {
|
|
1244
1438
|
return { value: JSON.parse(content), recovered: true };
|
|
@@ -1253,25 +1447,25 @@ function GenericStructuredView({
|
|
|
1253
1447
|
className
|
|
1254
1448
|
}) {
|
|
1255
1449
|
const host = useContentIrHost();
|
|
1256
|
-
const envelope = (0,
|
|
1450
|
+
const envelope = (0, import_content_ir10.readEnvelope)(metadata);
|
|
1257
1451
|
const status = envelope?.root.status ?? "complete";
|
|
1258
1452
|
const { value, recovered } = readStructuredValue(content, metadata);
|
|
1259
|
-
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? (0,
|
|
1453
|
+
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? (0, import_content_ir10.readObjectKind)(value) : null) ?? "";
|
|
1260
1454
|
const marker = readIrRouteMarker(metadata);
|
|
1261
1455
|
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";
|
|
1262
|
-
return /* @__PURE__ */ (0,
|
|
1263
|
-
status === "streaming" ? streamingIndicator ?? /* @__PURE__ */ (0,
|
|
1456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
|
|
1457
|
+
status === "streaming" ? streamingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-2 text-xs text-muted-foreground", children: "Still arriving\u2026" }) : null,
|
|
1264
1458
|
recovered ? host.renderValue({ value, ...kind ? { kind } : {}, note }) : (
|
|
1265
1459
|
// Zero-data-loss backstop: the region never parsed, so show the source
|
|
1266
1460
|
// verbatim rather than swallowing it.
|
|
1267
|
-
/* @__PURE__ */ (0,
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("pre", { className: "max-h-96 overflow-auto font-mono text-xs leading-relaxed text-muted-foreground", children: content })
|
|
1268
1462
|
)
|
|
1269
1463
|
] });
|
|
1270
1464
|
}
|
|
1271
1465
|
|
|
1272
1466
|
// react/RuntimeWrapperViews.tsx
|
|
1273
|
-
var
|
|
1274
|
-
var
|
|
1467
|
+
var import_content_ir11 = require("@ai-matrx/content-ir");
|
|
1468
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1275
1469
|
function isRecord2(value) {
|
|
1276
1470
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1277
1471
|
}
|
|
@@ -1287,16 +1481,16 @@ function DelegatedOutput({
|
|
|
1287
1481
|
}) {
|
|
1288
1482
|
const host = useContentIrHost();
|
|
1289
1483
|
if (output === null || output === void 0) {
|
|
1290
|
-
return /* @__PURE__ */ (0,
|
|
1484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyLabel });
|
|
1291
1485
|
}
|
|
1292
1486
|
if (!isRecord2(output)) {
|
|
1293
|
-
return /* @__PURE__ */ (0,
|
|
1487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: host.renderValue({ value: output }) });
|
|
1294
1488
|
}
|
|
1295
|
-
const kind = (0,
|
|
1489
|
+
const kind = (0, import_content_ir11.readObjectKind)(output) ?? declaredKind;
|
|
1296
1490
|
if (!kind) {
|
|
1297
|
-
return /* @__PURE__ */ (0,
|
|
1491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: fallback?.(output) ?? host.renderValue({ value: output }) });
|
|
1298
1492
|
}
|
|
1299
|
-
return /* @__PURE__ */ (0,
|
|
1493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1300
1494
|
KindInstanceRender,
|
|
1301
1495
|
{
|
|
1302
1496
|
kind,
|
|
@@ -1310,10 +1504,10 @@ function DelegatedOutput({
|
|
|
1310
1504
|
function NodeOutcomeView({ serverData, fallback }) {
|
|
1311
1505
|
const wrapper = readWrapperFrom(
|
|
1312
1506
|
serverData,
|
|
1313
|
-
|
|
1507
|
+
import_content_ir11.readNodeOutcomeValue
|
|
1314
1508
|
);
|
|
1315
1509
|
if (!wrapper) return null;
|
|
1316
|
-
return /* @__PURE__ */ (0,
|
|
1510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1317
1511
|
DelegatedOutput,
|
|
1318
1512
|
{
|
|
1319
1513
|
output: wrapper.output,
|
|
@@ -1325,17 +1519,17 @@ function NodeOutcomeView({ serverData, fallback }) {
|
|
|
1325
1519
|
function RunResultView({ serverData, fallback }) {
|
|
1326
1520
|
const wrapper = readWrapperFrom(
|
|
1327
1521
|
serverData,
|
|
1328
|
-
|
|
1522
|
+
import_content_ir11.readRunResultValue
|
|
1329
1523
|
);
|
|
1330
1524
|
if (!wrapper) return null;
|
|
1331
|
-
return /* @__PURE__ */ (0,
|
|
1525
|
+
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)(
|
|
1332
1526
|
NodeOutcomeView,
|
|
1333
1527
|
{
|
|
1334
1528
|
serverData: { wrapper: outcome },
|
|
1335
1529
|
...fallback === void 0 ? {} : { fallback }
|
|
1336
1530
|
},
|
|
1337
1531
|
`${outcome.node_id}:${outcome.attempt}`
|
|
1338
|
-
)) : /* @__PURE__ */ (0,
|
|
1532
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1339
1533
|
DelegatedOutput,
|
|
1340
1534
|
{
|
|
1341
1535
|
output: wrapper.output,
|