@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { KindDefinition } from '@ai-matrx/content-ir';
|
|
3
|
-
import { d as ComponentResolutionSource, a as ContentIrErrorReporter } from './component-resolution.types-
|
|
3
|
+
import { d as ComponentResolutionSource, a as ContentIrErrorReporter } from './component-resolution.types-BQa2ik3i.cjs';
|
|
4
4
|
import { D as DirectiveHost } from './directive-host-CtFMuSZc.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/host.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as ContentIrErrorReport, a as ContentIrErrorReporter, c as consoleErrorReporter } from './component-resolution.types-
|
|
2
|
-
import { C as ContentIrHost, K as KindRouteEnv } from './host-types-
|
|
3
|
-
export { a as ContentIrRenderSeams, I as IrRenderBlock, b as IrRoutableBlock, c as KindDefinitionSource, S as StructuredValueRenderProps, r as routeEnvOf } from './host-types-
|
|
1
|
+
export { b as ContentIrErrorReport, a as ContentIrErrorReporter, c as consoleErrorReporter } from './component-resolution.types-BQa2ik3i.cjs';
|
|
2
|
+
import { C as ContentIrHost, K as KindRouteEnv } from './host-types-mMFt5-hQ.cjs';
|
|
3
|
+
export { a as ContentIrRenderSeams, I as IrRenderBlock, b as IrRoutableBlock, c as KindDefinitionSource, S as StructuredValueRenderProps, r as routeEnvOf } from './host-types-mMFt5-hQ.cjs';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
import '@ai-matrx/content-ir';
|
package/dist/host.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as ContentIrErrorReport, a as ContentIrErrorReporter, c as consoleErrorReporter } from './component-resolution.types-
|
|
2
|
-
import { C as ContentIrHost, K as KindRouteEnv } from './host-types-
|
|
3
|
-
export { a as ContentIrRenderSeams, I as IrRenderBlock, b as IrRoutableBlock, c as KindDefinitionSource, S as StructuredValueRenderProps, r as routeEnvOf } from './host-types-
|
|
1
|
+
export { b as ContentIrErrorReport, a as ContentIrErrorReporter, c as consoleErrorReporter } from './component-resolution.types-BQa2ik3i.js';
|
|
2
|
+
import { C as ContentIrHost, K as KindRouteEnv } from './host-types-CGcK8Nib.js';
|
|
3
|
+
export { a as ContentIrRenderSeams, I as IrRenderBlock, b as IrRoutableBlock, c as KindDefinitionSource, S as StructuredValueRenderProps, r as routeEnvOf } from './host-types-CGcK8Nib.js';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
import '@ai-matrx/content-ir';
|
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
IR_PROVISIONAL_KEY: () => IR_PROVISIONAL_KEY,
|
|
51
51
|
IR_ROUTE_KEY: () => IR_ROUTE_KEY,
|
|
52
52
|
KindInstanceRender: () => KindInstanceRender,
|
|
53
|
+
NO_TITLE_WORD: () => NO_TITLE_WORD,
|
|
53
54
|
NodeOutcomeView: () => NodeOutcomeView,
|
|
54
55
|
ProvisionalKindBoundary: () => ProvisionalKindBoundary,
|
|
55
56
|
ProvisionalKindFrame: () => ProvisionalKindFrame,
|
|
@@ -73,6 +74,7 @@ __export(index_exports, {
|
|
|
73
74
|
isProvisionalBlock: () => isProvisionalBlock,
|
|
74
75
|
isRecordValue: () => isRecordValue,
|
|
75
76
|
itemChanges: () => itemChanges,
|
|
77
|
+
itemOwnName: () => itemOwnName,
|
|
76
78
|
itemRecordId: () => itemRecordId,
|
|
77
79
|
kindIsRoutable: () => kindIsRoutable,
|
|
78
80
|
kindServerDataFromStoredValue: () => kindServerDataFromStoredValue,
|
|
@@ -830,21 +832,21 @@ function useContentIrKindVersion(kind, sources) {
|
|
|
830
832
|
|
|
831
833
|
// react/KindInstanceRender.tsx
|
|
832
834
|
var import_react7 = require("react");
|
|
833
|
-
var
|
|
835
|
+
var import_content_ir10 = require("@ai-matrx/content-ir");
|
|
834
836
|
|
|
835
837
|
// directives/DirectiveRender.tsx
|
|
836
|
-
var
|
|
838
|
+
var import_content_ir9 = require("@ai-matrx/content-ir");
|
|
837
839
|
|
|
838
840
|
// directives/DirectiveFallbackCard.tsx
|
|
839
|
-
var
|
|
841
|
+
var import_content_ir5 = require("@ai-matrx/content-ir");
|
|
840
842
|
|
|
841
843
|
// directives/ApplyDirectiveButton.tsx
|
|
842
844
|
var import_react5 = require("react");
|
|
843
|
-
var
|
|
845
|
+
var import_content_ir4 = require("@ai-matrx/content-ir");
|
|
844
846
|
|
|
845
847
|
// directives/item-changes.ts
|
|
846
|
-
var import_uuid = require("@ai-matrx/kit/uuid");
|
|
847
848
|
var import_text_case = require("@ai-matrx/kit/text-case");
|
|
849
|
+
var import_content_ir3 = require("@ai-matrx/content-ir");
|
|
848
850
|
var TARGETING_CLASSES = /* @__PURE__ */ new Set(["update", "delete"]);
|
|
849
851
|
var NOT_A_CHANGE = /* @__PURE__ */ new Set(["__kind", "id"]);
|
|
850
852
|
var CHANGE_VALUE_MAX = 280;
|
|
@@ -860,10 +862,14 @@ function fieldLabel(key) {
|
|
|
860
862
|
function directiveFieldLabel(key, titleColumn) {
|
|
861
863
|
return titleColumn && key === titleColumn ? "Title" : fieldLabel(key);
|
|
862
864
|
}
|
|
865
|
+
function itemOwnName(item, titleColumn) {
|
|
866
|
+
const probe = (0, import_content_ir3.itemTitle)(item, titleColumn, 0, 2);
|
|
867
|
+
return probe === "Item 1 of 2" ? null : probe;
|
|
868
|
+
}
|
|
869
|
+
var NO_TITLE_WORD = "No title";
|
|
863
870
|
var EMPTY_VALUE_WORD = "None";
|
|
864
|
-
function recordFallbackName(nounLabel3
|
|
865
|
-
|
|
866
|
-
return `${nounLabel3} ${short}`;
|
|
871
|
+
function recordFallbackName(nounLabel3) {
|
|
872
|
+
return nounLabel3.trim() || "Record";
|
|
867
873
|
}
|
|
868
874
|
function describeChangeValue(value, word) {
|
|
869
875
|
return describeValue(value, word);
|
|
@@ -1185,7 +1191,7 @@ function ApplyDirectiveButton({
|
|
|
1185
1191
|
(0, import_react5.useEffect)(() => {
|
|
1186
1192
|
currentIdentity.current = identity;
|
|
1187
1193
|
}, [identity]);
|
|
1188
|
-
const nounText = (0,
|
|
1194
|
+
const nounText = (0, import_content_ir4.nounLabel)(directive.noun, host.nouns);
|
|
1189
1195
|
const shellKey = readsLedger ? JSON.stringify([directive.slug, items, conversationId ?? null]) : "";
|
|
1190
1196
|
const read = host.applyState;
|
|
1191
1197
|
const report = host.reportError;
|
|
@@ -1365,7 +1371,7 @@ function ApplyDirectiveButton({
|
|
|
1365
1371
|
) : null,
|
|
1366
1372
|
records.map((record) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
|
|
1367
1373
|
...record,
|
|
1368
|
-
fallback: recordFallbackName(label2
|
|
1374
|
+
fallback: recordFallbackName(label2),
|
|
1369
1375
|
context: "applied",
|
|
1370
1376
|
trashed
|
|
1371
1377
|
}) }, `${record.noun}:${record.id}`)),
|
|
@@ -1413,6 +1419,14 @@ function ApplyDirectiveButton({
|
|
|
1413
1419
|
}
|
|
1414
1420
|
);
|
|
1415
1421
|
}
|
|
1422
|
+
const warm = () => {
|
|
1423
|
+
const read2 = host.readRecord;
|
|
1424
|
+
if (!read2 || !TARGETING_CLASSES.has(directive.directiveClass)) return;
|
|
1425
|
+
for (const item of items) {
|
|
1426
|
+
const id = itemRecordId(item);
|
|
1427
|
+
if (id) void read2({ noun: directive.noun, id }).catch(() => null);
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1416
1430
|
const destructive = directive.directiveClass === "delete";
|
|
1417
1431
|
const muted = nothingToChange && view.status === "idle";
|
|
1418
1432
|
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: [
|
|
@@ -1422,6 +1436,8 @@ function ApplyDirectiveButton({
|
|
|
1422
1436
|
{
|
|
1423
1437
|
type: "button",
|
|
1424
1438
|
onClick: () => void handleApply(),
|
|
1439
|
+
onPointerEnter: warm,
|
|
1440
|
+
onFocus: warm,
|
|
1425
1441
|
disabled: view.status === "applying" || view.status === "asking" || items.length === 0,
|
|
1426
1442
|
"data-apply-tone": muted ? "muted" : destructive ? "destructive" : "default",
|
|
1427
1443
|
title: muted ? "It sets no fields, so applying it changes nothing." : void 0,
|
|
@@ -1498,7 +1514,7 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
|
1498
1514
|
function DirectiveFallbackCard({ directive, reason }) {
|
|
1499
1515
|
const host = useDirectiveHost();
|
|
1500
1516
|
const count = directive.items.length;
|
|
1501
|
-
const display = (0,
|
|
1517
|
+
const display = (0, import_content_ir5.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
1502
1518
|
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: [
|
|
1503
1519
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoxesIcon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1504
1520
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-foreground", children: display.title }),
|
|
@@ -1521,7 +1537,7 @@ function DirectiveFallbackCard({ directive, reason }) {
|
|
|
1521
1537
|
}
|
|
1522
1538
|
|
|
1523
1539
|
// directives/DirectiveProvisionalCard.tsx
|
|
1524
|
-
var
|
|
1540
|
+
var import_content_ir6 = require("@ai-matrx/content-ir");
|
|
1525
1541
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1526
1542
|
var COMPLETE_SLUG_RE = /^\{\s*"__kind"\s*:\s*"([^"]+)"/;
|
|
1527
1543
|
function provisionalDirectiveSlug(content) {
|
|
@@ -1531,8 +1547,8 @@ function provisionalDirectiveSlug(content) {
|
|
|
1531
1547
|
function DirectiveProvisionalCard({ content, streaming, className }) {
|
|
1532
1548
|
const host = useDirectiveHost();
|
|
1533
1549
|
const slug = provisionalDirectiveSlug(content);
|
|
1534
|
-
const known = slug ? (0,
|
|
1535
|
-
const display = known ? (0,
|
|
1550
|
+
const known = slug ? (0, import_content_ir6.parseDirectiveSlug)(slug) : null;
|
|
1551
|
+
const display = known ? (0, import_content_ir6.directiveDisplay)(known.directiveClass, known.noun, host.nouns) : null;
|
|
1536
1552
|
const Icon = known ? classIcon(known.directiveClass, known.noun) : BoxesIcon;
|
|
1537
1553
|
const title = display?.title ?? "Structured action";
|
|
1538
1554
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
@@ -1561,14 +1577,14 @@ function DirectiveProvisionalCard({ content, streaming, className }) {
|
|
|
1561
1577
|
}
|
|
1562
1578
|
|
|
1563
1579
|
// directives/registry.ts
|
|
1564
|
-
var
|
|
1580
|
+
var import_content_ir7 = require("@ai-matrx/content-ir");
|
|
1565
1581
|
var REGISTRY_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.content-ir-react.directive-renderers");
|
|
1566
1582
|
var registry = globalThis[REGISTRY_SLOT] ??= {
|
|
1567
1583
|
bySlug: /* @__PURE__ */ new Map(),
|
|
1568
1584
|
byClass: /* @__PURE__ */ new Map()
|
|
1569
1585
|
};
|
|
1570
1586
|
function registerDirectiveRenderer(directiveClass, renderer, noun) {
|
|
1571
|
-
if (noun) registry.bySlug.set((0,
|
|
1587
|
+
if (noun) registry.bySlug.set((0, import_content_ir7.buildDirectiveSlug)(directiveClass, noun), renderer);
|
|
1572
1588
|
else registry.byClass.set(directiveClass, renderer);
|
|
1573
1589
|
}
|
|
1574
1590
|
function getDirectiveRenderer(directive) {
|
|
@@ -1581,7 +1597,7 @@ function resetDirectiveRenderers() {
|
|
|
1581
1597
|
|
|
1582
1598
|
// directives/SideEffectDirectiveCard.tsx
|
|
1583
1599
|
var import_react6 = require("react");
|
|
1584
|
-
var
|
|
1600
|
+
var import_content_ir8 = require("@ai-matrx/content-ir");
|
|
1585
1601
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1586
1602
|
function directiveValueWord(host, noun) {
|
|
1587
1603
|
const valueLabel = host.valueLabel;
|
|
@@ -1604,20 +1620,28 @@ function ItemRow({
|
|
|
1604
1620
|
if (recordId) {
|
|
1605
1621
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TargetRow, { directive, item, recordId, index, phase });
|
|
1606
1622
|
}
|
|
1607
|
-
const titleColumn = (0,
|
|
1608
|
-
const
|
|
1609
|
-
const
|
|
1623
|
+
const titleColumn = (0, import_content_ir8.nounTitleColumn)(directive.noun, host.nouns);
|
|
1624
|
+
const ownName = itemOwnName(item, titleColumn);
|
|
1625
|
+
const title = ownName ?? NO_TITLE_WORD;
|
|
1626
|
+
const subtitle = (0, import_content_ir8.itemSubtitle)(item);
|
|
1610
1627
|
const valueWord = directiveValueWord(host, directive.noun);
|
|
1611
|
-
const facts = (0,
|
|
1628
|
+
const facts = (0, import_content_ir8.itemFacts)(titleColumn ? omitKey(item, titleColumn) : item).map((fact) => ({
|
|
1612
1629
|
...fact,
|
|
1613
1630
|
label: directiveFieldLabel(fact.key, titleColumn),
|
|
1614
1631
|
value: valueWord?.(fact.key, fact.value) ?? fact.value
|
|
1615
1632
|
}));
|
|
1616
1633
|
const kind = host.itemKind?.(directive.slug) ?? null;
|
|
1617
|
-
const display = (0,
|
|
1634
|
+
const display = (0, import_content_ir8.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
1618
1635
|
const openItem = host.openItem;
|
|
1619
1636
|
const body = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1620
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1638
|
+
"span",
|
|
1639
|
+
{
|
|
1640
|
+
className: `min-w-0 shrink-0 truncate font-medium ${ownName ? "text-foreground" : "italic text-muted-foreground"}`,
|
|
1641
|
+
"data-item-untitled": ownName ? void 0 : "",
|
|
1642
|
+
children: title
|
|
1643
|
+
}
|
|
1644
|
+
),
|
|
1621
1645
|
/* @__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: [
|
|
1622
1646
|
fact.label,
|
|
1623
1647
|
" ",
|
|
@@ -1633,7 +1657,7 @@ function ItemRow({
|
|
|
1633
1657
|
type: "button",
|
|
1634
1658
|
onClick: () => openItem({
|
|
1635
1659
|
// Stamped so the panel's kind pipeline types it from its own first key.
|
|
1636
|
-
item: (0,
|
|
1660
|
+
item: (0, import_content_ir8.asKindInstance)(item, kind) ?? item,
|
|
1637
1661
|
itemKind: kind,
|
|
1638
1662
|
title,
|
|
1639
1663
|
subtitle: `${display.title} \xB7 item ${index + 1} of ${total}`,
|
|
@@ -1646,7 +1670,12 @@ function ItemRow({
|
|
|
1646
1670
|
children: body
|
|
1647
1671
|
}
|
|
1648
1672
|
) : /* @__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 }),
|
|
1649
|
-
host.renderCopy?.({
|
|
1673
|
+
host.renderCopy?.({
|
|
1674
|
+
label: ownName ?? `this ${(0, import_content_ir8.nounLabel)(directive.noun, host.nouns)}`,
|
|
1675
|
+
value: item,
|
|
1676
|
+
kind,
|
|
1677
|
+
size: "xs"
|
|
1678
|
+
})
|
|
1650
1679
|
] });
|
|
1651
1680
|
}
|
|
1652
1681
|
function DirectiveChangeList({
|
|
@@ -1700,7 +1729,7 @@ function TargetRow({
|
|
|
1700
1729
|
phase
|
|
1701
1730
|
}) {
|
|
1702
1731
|
const host = useDirectiveHost();
|
|
1703
|
-
const fallback = recordFallbackName((0,
|
|
1732
|
+
const fallback = recordFallbackName((0, import_content_ir8.nounLabel)(directive.noun, host.nouns));
|
|
1704
1733
|
const isUpdate = directive.directiveClass === "update";
|
|
1705
1734
|
const readsLive = isUpdate && phase.phase === "open";
|
|
1706
1735
|
const live = useRecordValues(
|
|
@@ -1709,7 +1738,7 @@ function TargetRow({
|
|
|
1709
1738
|
);
|
|
1710
1739
|
const compareTo = phase.phase === "applied" ? phase.before?.[index] ?? null : readsLive ? live.values : null;
|
|
1711
1740
|
const changes = isUpdate ? itemChanges(item, compareTo, {
|
|
1712
|
-
titleColumn: (0,
|
|
1741
|
+
titleColumn: (0, import_content_ir8.nounTitleColumn)(directive.noun, host.nouns),
|
|
1713
1742
|
valueWord: directiveValueWord(host, directive.noun)
|
|
1714
1743
|
}) : [];
|
|
1715
1744
|
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 });
|
|
@@ -1717,7 +1746,7 @@ function TargetRow({
|
|
|
1717
1746
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1718
1747
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "flex min-w-0 flex-1 items-center gap-1 px-1", children: name }),
|
|
1719
1748
|
host.renderCopy?.({
|
|
1720
|
-
label: `this ${(0,
|
|
1749
|
+
label: `this ${(0, import_content_ir8.nounLabel)(directive.noun, host.nouns).toLowerCase()}`,
|
|
1721
1750
|
value: item,
|
|
1722
1751
|
size: "xs",
|
|
1723
1752
|
record: { noun: directive.noun, id: recordId }
|
|
@@ -1731,7 +1760,7 @@ function SideEffectDirectiveCard({ directive }) {
|
|
|
1731
1760
|
const [expanded, setExpanded] = (0, import_react6.useState)(false);
|
|
1732
1761
|
const items = directive.items;
|
|
1733
1762
|
const total = items.length;
|
|
1734
|
-
const display = (0,
|
|
1763
|
+
const display = (0, import_content_ir8.directiveDisplay)(directive.directiveClass, directive.noun, host.nouns);
|
|
1735
1764
|
const Icon = classIcon(directive.directiveClass, directive.noun);
|
|
1736
1765
|
const [phase, setPhase] = (0, import_react6.useState)(
|
|
1737
1766
|
() => readsApplyLedger(host, directive) ? { phase: "pending" } : { phase: "open" }
|
|
@@ -1797,13 +1826,13 @@ function DirectiveRender({ conversationId, ...props }) {
|
|
|
1797
1826
|
}
|
|
1798
1827
|
function DirectiveRenderInner({ content, className, streaming }) {
|
|
1799
1828
|
const host = useDirectiveHost();
|
|
1800
|
-
const directive = (0,
|
|
1829
|
+
const directive = (0, import_content_ir9.tryDecodeDirectiveContent)(content, (message) => {
|
|
1801
1830
|
const line = `[kind-directives] ${message}`;
|
|
1802
1831
|
if (host.reportError) host.reportError(line);
|
|
1803
1832
|
else console.error(line);
|
|
1804
1833
|
});
|
|
1805
1834
|
if (!directive) {
|
|
1806
|
-
if (typeof content === "string" && (0,
|
|
1835
|
+
if (typeof content === "string" && (0, import_content_ir9.looksLikeDirectiveHead)(content) && !isWholeJson(content)) {
|
|
1807
1836
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DirectiveProvisionalCard, { content, streaming: streaming !== false, className });
|
|
1808
1837
|
}
|
|
1809
1838
|
const raw = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
@@ -1827,14 +1856,14 @@ function isRecordValue(value) {
|
|
|
1827
1856
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1828
1857
|
}
|
|
1829
1858
|
function kindIsRoutable(kind, host) {
|
|
1830
|
-
if ((0,
|
|
1859
|
+
if ((0, import_content_ir10.isReservedDirectiveSlug)(kind)) return true;
|
|
1831
1860
|
if (host.kinds.getDefinition(kind)?.legacyBlockType) return true;
|
|
1832
1861
|
const resolution = host.components.resolve(kind, host.platform, "output");
|
|
1833
1862
|
if (!resolution?.isActive) return false;
|
|
1834
1863
|
return resolution.componentKey !== GENERIC_STRUCTURED_COMPONENT_KEY;
|
|
1835
1864
|
}
|
|
1836
1865
|
function KindInstanceRender(props) {
|
|
1837
|
-
if ((0,
|
|
1866
|
+
if ((0, import_content_ir10.isReservedDirectiveSlug)(props.kind)) {
|
|
1838
1867
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1839
1868
|
DirectiveRender,
|
|
1840
1869
|
{
|
|
@@ -1889,7 +1918,7 @@ function KindInstanceRenderInner({
|
|
|
1889
1918
|
content: JSON.stringify(value, null, 2),
|
|
1890
1919
|
language: "json",
|
|
1891
1920
|
metadata: {
|
|
1892
|
-
[
|
|
1921
|
+
[import_content_ir10.IR_ENVELOPE_KEY]: (0, import_content_ir10.envelopeFromCompleteValue)(value, kind)
|
|
1893
1922
|
}
|
|
1894
1923
|
} : null;
|
|
1895
1924
|
const frameClass = variant === "bare" ? void 0 : "rounded-md border border-border bg-card p-3";
|
|
@@ -1944,12 +1973,12 @@ function ProvisionalKindFrame({ children }) {
|
|
|
1944
1973
|
|
|
1945
1974
|
// react/GenericStructuredView.tsx
|
|
1946
1975
|
var import_react9 = require("react");
|
|
1947
|
-
var
|
|
1976
|
+
var import_content_ir11 = require("@ai-matrx/content-ir");
|
|
1948
1977
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1949
1978
|
function readStructuredValue(content, metadata) {
|
|
1950
|
-
const envelope = (0,
|
|
1979
|
+
const envelope = (0, import_content_ir11.readEnvelope)(metadata);
|
|
1951
1980
|
if (envelope) {
|
|
1952
|
-
return { value: (0,
|
|
1981
|
+
return { value: (0, import_content_ir11.reconstructRegionValue)(envelope), recovered: true };
|
|
1953
1982
|
}
|
|
1954
1983
|
try {
|
|
1955
1984
|
return { value: JSON.parse(content), recovered: true };
|
|
@@ -1964,10 +1993,10 @@ function GenericStructuredView({
|
|
|
1964
1993
|
className
|
|
1965
1994
|
}) {
|
|
1966
1995
|
const host = useContentIrHost();
|
|
1967
|
-
const envelope = (0,
|
|
1996
|
+
const envelope = (0, import_content_ir11.readEnvelope)(metadata);
|
|
1968
1997
|
const status = envelope?.root.status ?? "complete";
|
|
1969
1998
|
const { value, recovered } = readStructuredValue(content, metadata);
|
|
1970
|
-
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? (0,
|
|
1999
|
+
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? (0, import_content_ir11.readObjectKind)(value) : null) ?? "";
|
|
1971
2000
|
const marker = readIrRouteMarker(metadata);
|
|
1972
2001
|
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";
|
|
1973
2002
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
|
|
@@ -1981,7 +2010,7 @@ function GenericStructuredView({
|
|
|
1981
2010
|
}
|
|
1982
2011
|
|
|
1983
2012
|
// react/RuntimeWrapperViews.tsx
|
|
1984
|
-
var
|
|
2013
|
+
var import_content_ir12 = require("@ai-matrx/content-ir");
|
|
1985
2014
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1986
2015
|
function isRecord2(value) {
|
|
1987
2016
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -2003,7 +2032,7 @@ function DelegatedOutput({
|
|
|
2003
2032
|
if (!isRecord2(output)) {
|
|
2004
2033
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: host.renderValue({ value: output }) });
|
|
2005
2034
|
}
|
|
2006
|
-
const kind = (0,
|
|
2035
|
+
const kind = (0, import_content_ir12.readObjectKind)(output) ?? declaredKind;
|
|
2007
2036
|
if (!kind) {
|
|
2008
2037
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: fallback?.(output) ?? host.renderValue({ value: output }) });
|
|
2009
2038
|
}
|
|
@@ -2021,7 +2050,7 @@ function DelegatedOutput({
|
|
|
2021
2050
|
function NodeOutcomeView({ serverData, fallback }) {
|
|
2022
2051
|
const wrapper = readWrapperFrom(
|
|
2023
2052
|
serverData,
|
|
2024
|
-
|
|
2053
|
+
import_content_ir12.readNodeOutcomeValue
|
|
2025
2054
|
);
|
|
2026
2055
|
if (!wrapper) return null;
|
|
2027
2056
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2036,7 +2065,7 @@ function NodeOutcomeView({ serverData, fallback }) {
|
|
|
2036
2065
|
function RunResultView({ serverData, fallback }) {
|
|
2037
2066
|
const wrapper = readWrapperFrom(
|
|
2038
2067
|
serverData,
|
|
2039
|
-
|
|
2068
|
+
import_content_ir12.readRunResultValue
|
|
2040
2069
|
);
|
|
2041
2070
|
if (!wrapper) return null;
|
|
2042
2071
|
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)(
|