@ai-matrx/content-ir-react 0.11.10 → 0.11.11
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 +22 -0
- package/dist/directives.cjs +60 -7
- package/dist/directives.cjs.map +1 -1
- package/dist/directives.d.cts +22 -2
- package/dist/directives.d.ts +22 -2
- package/dist/directives.js +60 -7
- package/dist/directives.js.map +1 -1
- package/dist/index.cjs +128 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +107 -54
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +127 -76
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +105 -54
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -268,12 +268,32 @@ interface DirectiveFallbackCardProps {
|
|
|
268
268
|
}
|
|
269
269
|
declare function DirectiveFallbackCard({ directive, reason }: DirectiveFallbackCardProps): react.JSX.Element;
|
|
270
270
|
|
|
271
|
+
/** The directive slug of a partial document, once its closing quote has arrived. */
|
|
272
|
+
declare function provisionalDirectiveSlug(content: string): string | null;
|
|
273
|
+
interface DirectiveProvisionalCardProps {
|
|
274
|
+
/** The partial fence body as received so far. */
|
|
275
|
+
content: string;
|
|
276
|
+
/**
|
|
277
|
+
* Whether the document may still be arriving. `false` means the stream is
|
|
278
|
+
* over and the document never completed — the card says it was cut off.
|
|
279
|
+
*/
|
|
280
|
+
streaming: boolean;
|
|
281
|
+
className?: string | undefined;
|
|
282
|
+
}
|
|
283
|
+
declare function DirectiveProvisionalCard({ content, streaming, className }: DirectiveProvisionalCardProps): react.JSX.Element;
|
|
284
|
+
|
|
271
285
|
interface DirectiveRenderProps {
|
|
272
286
|
/** The fence body (JSON string) or an already-parsed shell / value. */
|
|
273
287
|
content: unknown;
|
|
274
288
|
className?: string;
|
|
289
|
+
/**
|
|
290
|
+
* Whether the document may still be arriving. A host that knows its stream
|
|
291
|
+
* has ended passes `false`, so an undecodable directive head is shown as CUT
|
|
292
|
+
* OFF rather than "writing…" forever. Omitted = it may still be arriving.
|
|
293
|
+
*/
|
|
294
|
+
streaming?: boolean;
|
|
275
295
|
}
|
|
276
|
-
declare function DirectiveRender({ content, className }: DirectiveRenderProps): react.JSX.Element;
|
|
296
|
+
declare function DirectiveRender({ content, className, streaming }: DirectiveRenderProps): react.JSX.Element;
|
|
277
297
|
|
|
278
298
|
/**
|
|
279
299
|
* The DB-component COMPILE CACHE — session-scoped, keyed per winning row
|
|
@@ -538,4 +558,4 @@ declare class DbKindComponentErrorBoundary extends react.Component<DbKindCompone
|
|
|
538
558
|
render(): react.ReactNode;
|
|
539
559
|
}
|
|
540
560
|
|
|
541
|
-
export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, type CompiledDbKindComponent, ComponentResolution, ComponentResolutionSource, ContentIrErrorReporter, ContentIrHost, ContentIrRenderProvider, type ContentIrRenderProviderProps, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, DelegatedOutput, type DelegatedOutputProps, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, GenericStructuredView, type GenericStructuredViewProps, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, createDbKindComponentCache, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, kindIsRoutable, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv };
|
|
561
|
+
export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, type CompiledDbKindComponent, ComponentResolution, ComponentResolutionSource, ContentIrErrorReporter, ContentIrHost, ContentIrRenderProvider, type ContentIrRenderProviderProps, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, DelegatedOutput, type DelegatedOutputProps, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, GenericStructuredView, type GenericStructuredViewProps, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, createDbKindComponentCache, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, kindIsRoutable, provisionalDirectiveSlug, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv };
|
package/dist/index.d.ts
CHANGED
|
@@ -268,12 +268,32 @@ interface DirectiveFallbackCardProps {
|
|
|
268
268
|
}
|
|
269
269
|
declare function DirectiveFallbackCard({ directive, reason }: DirectiveFallbackCardProps): react.JSX.Element;
|
|
270
270
|
|
|
271
|
+
/** The directive slug of a partial document, once its closing quote has arrived. */
|
|
272
|
+
declare function provisionalDirectiveSlug(content: string): string | null;
|
|
273
|
+
interface DirectiveProvisionalCardProps {
|
|
274
|
+
/** The partial fence body as received so far. */
|
|
275
|
+
content: string;
|
|
276
|
+
/**
|
|
277
|
+
* Whether the document may still be arriving. `false` means the stream is
|
|
278
|
+
* over and the document never completed — the card says it was cut off.
|
|
279
|
+
*/
|
|
280
|
+
streaming: boolean;
|
|
281
|
+
className?: string | undefined;
|
|
282
|
+
}
|
|
283
|
+
declare function DirectiveProvisionalCard({ content, streaming, className }: DirectiveProvisionalCardProps): react.JSX.Element;
|
|
284
|
+
|
|
271
285
|
interface DirectiveRenderProps {
|
|
272
286
|
/** The fence body (JSON string) or an already-parsed shell / value. */
|
|
273
287
|
content: unknown;
|
|
274
288
|
className?: string;
|
|
289
|
+
/**
|
|
290
|
+
* Whether the document may still be arriving. A host that knows its stream
|
|
291
|
+
* has ended passes `false`, so an undecodable directive head is shown as CUT
|
|
292
|
+
* OFF rather than "writing…" forever. Omitted = it may still be arriving.
|
|
293
|
+
*/
|
|
294
|
+
streaming?: boolean;
|
|
275
295
|
}
|
|
276
|
-
declare function DirectiveRender({ content, className }: DirectiveRenderProps): react.JSX.Element;
|
|
296
|
+
declare function DirectiveRender({ content, className, streaming }: DirectiveRenderProps): react.JSX.Element;
|
|
277
297
|
|
|
278
298
|
/**
|
|
279
299
|
* The DB-component COMPILE CACHE — session-scoped, keyed per winning row
|
|
@@ -538,4 +558,4 @@ declare class DbKindComponentErrorBoundary extends react.Component<DbKindCompone
|
|
|
538
558
|
render(): react.ReactNode;
|
|
539
559
|
}
|
|
540
560
|
|
|
541
|
-
export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, type CompiledDbKindComponent, ComponentResolution, ComponentResolutionSource, ContentIrErrorReporter, ContentIrHost, ContentIrRenderProvider, type ContentIrRenderProviderProps, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, DelegatedOutput, type DelegatedOutputProps, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, GenericStructuredView, type GenericStructuredViewProps, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, createDbKindComponentCache, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, kindIsRoutable, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv };
|
|
561
|
+
export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, type CompiledDbKindComponent, ComponentResolution, ComponentResolutionSource, ContentIrErrorReporter, ContentIrHost, ContentIrRenderProvider, type ContentIrRenderProviderProps, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, DelegatedOutput, type DelegatedOutputProps, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, GenericStructuredView, type GenericStructuredViewProps, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, createDbKindComponentCache, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, kindIsRoutable, provisionalDirectiveSlug, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv };
|
package/dist/index.js
CHANGED
|
@@ -708,7 +708,7 @@ import {
|
|
|
708
708
|
} from "@ai-matrx/content-ir";
|
|
709
709
|
|
|
710
710
|
// directives/DirectiveRender.tsx
|
|
711
|
-
import { tryDecodeDirectiveContent } from "@ai-matrx/content-ir";
|
|
711
|
+
import { looksLikeDirectiveHead, tryDecodeDirectiveContent } from "@ai-matrx/content-ir";
|
|
712
712
|
|
|
713
713
|
// directives/DirectiveFallbackCard.tsx
|
|
714
714
|
import { directiveDisplay } from "@ai-matrx/content-ir";
|
|
@@ -907,6 +907,46 @@ function DirectiveFallbackCard({ directive, reason }) {
|
|
|
907
907
|
] });
|
|
908
908
|
}
|
|
909
909
|
|
|
910
|
+
// directives/DirectiveProvisionalCard.tsx
|
|
911
|
+
import { directiveDisplay as directiveDisplay2, parseDirectiveSlug } from "@ai-matrx/content-ir";
|
|
912
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
913
|
+
var COMPLETE_SLUG_RE = /^\{\s*"__kind"\s*:\s*"([^"]+)"/;
|
|
914
|
+
function provisionalDirectiveSlug(content) {
|
|
915
|
+
const match = content.trimStart().match(COMPLETE_SLUG_RE);
|
|
916
|
+
return match?.[1] ?? null;
|
|
917
|
+
}
|
|
918
|
+
function DirectiveProvisionalCard({ content, streaming, className }) {
|
|
919
|
+
const host = useDirectiveHost();
|
|
920
|
+
const slug = provisionalDirectiveSlug(content);
|
|
921
|
+
const known = slug ? parseDirectiveSlug(slug) : null;
|
|
922
|
+
const display = known ? directiveDisplay2(known.directiveClass, known.noun, host.nouns) : null;
|
|
923
|
+
const Icon = known ? classIcon(known.directiveClass, known.noun) : BoxesIcon;
|
|
924
|
+
const title = display?.title ?? "Structured action";
|
|
925
|
+
return /* @__PURE__ */ jsxs4(
|
|
926
|
+
"div",
|
|
927
|
+
{
|
|
928
|
+
className: `my-3 rounded-md border border-border bg-card px-2.5 py-1.5${className ? ` ${className}` : ""}`,
|
|
929
|
+
"data-directive": slug ?? void 0,
|
|
930
|
+
"data-directive-state": streaming ? "streaming" : "incomplete",
|
|
931
|
+
children: [
|
|
932
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
933
|
+
/* @__PURE__ */ jsx6(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
934
|
+
/* @__PURE__ */ jsx6("span", { className: "text-sm font-medium text-foreground", children: title }),
|
|
935
|
+
display?.family ? /* @__PURE__ */ jsx6("span", { className: "text-xs text-muted-foreground", children: display.family }) : null,
|
|
936
|
+
streaming ? /* @__PURE__ */ jsxs4("span", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", role: "status", children: [
|
|
937
|
+
/* @__PURE__ */ jsx6("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-primary", "aria-hidden": true }),
|
|
938
|
+
"Writing\u2026"
|
|
939
|
+
] }) : /* @__PURE__ */ jsx6("span", { className: "text-xs text-destructive", role: "status", children: "Cut off before it finished \u2014 nothing can be applied." })
|
|
940
|
+
] }),
|
|
941
|
+
streaming ? null : /* @__PURE__ */ jsxs4("details", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
942
|
+
/* @__PURE__ */ jsx6("summary", { className: "cursor-pointer select-none hover:text-foreground", children: "Show what arrived" }),
|
|
943
|
+
/* @__PURE__ */ jsx6("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 })
|
|
944
|
+
] })
|
|
945
|
+
]
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
}
|
|
949
|
+
|
|
910
950
|
// directives/registry.ts
|
|
911
951
|
import {
|
|
912
952
|
buildDirectiveSlug
|
|
@@ -932,13 +972,13 @@ function resetDirectiveRenderers() {
|
|
|
932
972
|
import { useState as useState2 } from "react";
|
|
933
973
|
import {
|
|
934
974
|
asKindInstance,
|
|
935
|
-
directiveDisplay as
|
|
975
|
+
directiveDisplay as directiveDisplay3,
|
|
936
976
|
itemFacts,
|
|
937
977
|
itemSubtitle,
|
|
938
978
|
itemTitle,
|
|
939
979
|
nounTitleColumn
|
|
940
980
|
} from "@ai-matrx/content-ir";
|
|
941
|
-
import { Fragment, jsx as
|
|
981
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
942
982
|
var ROWS_BEFORE_FOLD = 3;
|
|
943
983
|
function ItemRow({
|
|
944
984
|
directive,
|
|
@@ -952,20 +992,20 @@ function ItemRow({
|
|
|
952
992
|
const subtitle = itemSubtitle(item);
|
|
953
993
|
const facts = itemFacts(item);
|
|
954
994
|
const kind = host.itemKind?.(directive.slug) ?? null;
|
|
955
|
-
const display =
|
|
995
|
+
const display = directiveDisplay3(directive.directiveClass, directive.noun, host.nouns);
|
|
956
996
|
const openItem = host.openItem;
|
|
957
|
-
const body = /* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
/* @__PURE__ */
|
|
997
|
+
const body = /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
998
|
+
/* @__PURE__ */ jsx7("span", { className: "min-w-0 shrink-0 truncate font-medium text-foreground", children: title }),
|
|
999
|
+
/* @__PURE__ */ jsx7("span", { className: "hidden min-w-0 flex-1 items-baseline gap-2 overflow-hidden sm:flex", children: facts.map((fact) => /* @__PURE__ */ jsxs5("span", { className: "truncate text-[11px] text-muted-foreground", children: [
|
|
960
1000
|
fact.value,
|
|
961
1001
|
" ",
|
|
962
1002
|
fact.label
|
|
963
1003
|
] }, fact.key)) }),
|
|
964
|
-
subtitle && facts.length === 0 ? /* @__PURE__ */
|
|
965
|
-
openItem ? /* @__PURE__ */
|
|
1004
|
+
subtitle && facts.length === 0 ? /* @__PURE__ */ jsx7("span", { className: "hidden truncate text-[11px] text-muted-foreground sm:inline", children: subtitle }) : null,
|
|
1005
|
+
openItem ? /* @__PURE__ */ jsx7(MaximizeIcon, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" }) : null
|
|
966
1006
|
] });
|
|
967
|
-
return /* @__PURE__ */
|
|
968
|
-
openItem ? /* @__PURE__ */
|
|
1007
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 py-1 text-xs", children: [
|
|
1008
|
+
openItem ? /* @__PURE__ */ jsx7(
|
|
969
1009
|
"button",
|
|
970
1010
|
{
|
|
971
1011
|
type: "button",
|
|
@@ -983,7 +1023,7 @@ function ItemRow({
|
|
|
983
1023
|
title: "Open to read it",
|
|
984
1024
|
children: body
|
|
985
1025
|
}
|
|
986
|
-
) : /* @__PURE__ */
|
|
1026
|
+
) : /* @__PURE__ */ jsx7("span", { className: "flex min-w-0 flex-1 items-center gap-2 px-1 py-0.5", children: body }),
|
|
987
1027
|
host.renderCopy?.({ label: title, value: item, kind, size: "xs" })
|
|
988
1028
|
] });
|
|
989
1029
|
}
|
|
@@ -992,37 +1032,37 @@ function SideEffectDirectiveCard({ directive }) {
|
|
|
992
1032
|
const [expanded, setExpanded] = useState2(false);
|
|
993
1033
|
const items = directive.items;
|
|
994
1034
|
const total = items.length;
|
|
995
|
-
const display =
|
|
1035
|
+
const display = directiveDisplay3(directive.directiveClass, directive.noun, host.nouns);
|
|
996
1036
|
const Icon = classIcon(directive.directiveClass, directive.noun);
|
|
997
1037
|
const shown = expanded ? items : items.slice(0, ROWS_BEFORE_FOLD);
|
|
998
1038
|
const hidden = total - shown.length;
|
|
999
|
-
return /* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
display.family ? /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1039
|
+
return /* @__PURE__ */ jsxs5("div", { className: "my-3 rounded-md border border-border bg-card px-2.5 py-1.5", "data-directive": directive.slug, children: [
|
|
1040
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
1041
|
+
/* @__PURE__ */ jsx7(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1042
|
+
/* @__PURE__ */ jsx7("span", { className: "text-sm font-medium text-foreground", children: display.title }),
|
|
1043
|
+
display.family ? /* @__PURE__ */ jsx7("span", { className: "text-xs text-muted-foreground", children: display.family }) : null,
|
|
1044
|
+
/* @__PURE__ */ jsxs5("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
1005
1045
|
total,
|
|
1006
1046
|
" ",
|
|
1007
1047
|
total === 1 ? "item" : "items"
|
|
1008
1048
|
] }),
|
|
1009
|
-
/* @__PURE__ */
|
|
1049
|
+
/* @__PURE__ */ jsxs5("div", { className: "ml-auto flex items-center gap-1", children: [
|
|
1010
1050
|
host.renderCopy?.({ label: display.title, value: directive.shell, size: "icon" }),
|
|
1011
|
-
/* @__PURE__ */
|
|
1051
|
+
/* @__PURE__ */ jsx7(ApplyDirectiveButton, { directive, itemCount: total })
|
|
1012
1052
|
] })
|
|
1013
1053
|
] }),
|
|
1014
1054
|
total === 0 ? (
|
|
1015
1055
|
// Stated, never silent: an empty batch is a real (and suspicious) state.
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
) : /* @__PURE__ */
|
|
1018
|
-
hidden > 0 || expanded ? /* @__PURE__ */
|
|
1056
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-1 text-xs text-muted-foreground", children: "No items \u2014 nothing would be written." })
|
|
1057
|
+
) : /* @__PURE__ */ jsx7("div", { className: "mt-0.5 divide-y divide-border/60", children: shown.map((item, i) => /* @__PURE__ */ jsx7(ItemRow, { directive, item, index: i, total }, i)) }),
|
|
1058
|
+
hidden > 0 || expanded ? /* @__PURE__ */ jsxs5(
|
|
1019
1059
|
"button",
|
|
1020
1060
|
{
|
|
1021
1061
|
type: "button",
|
|
1022
1062
|
onClick: () => setExpanded((v) => !v),
|
|
1023
1063
|
className: "mt-0.5 inline-flex items-center gap-1 rounded px-1 py-0.5 text-[11px] text-muted-foreground hover:text-foreground",
|
|
1024
1064
|
children: [
|
|
1025
|
-
expanded ? /* @__PURE__ */
|
|
1065
|
+
expanded ? /* @__PURE__ */ jsx7(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx7(ChevronRightIcon, { className: "h-3 w-3" }),
|
|
1026
1066
|
expanded ? "Show less" : `Show ${hidden} more`
|
|
1027
1067
|
]
|
|
1028
1068
|
}
|
|
@@ -1031,8 +1071,16 @@ function SideEffectDirectiveCard({ directive }) {
|
|
|
1031
1071
|
}
|
|
1032
1072
|
|
|
1033
1073
|
// directives/DirectiveRender.tsx
|
|
1034
|
-
import { jsx as
|
|
1035
|
-
function
|
|
1074
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1075
|
+
function isWholeJson(content) {
|
|
1076
|
+
try {
|
|
1077
|
+
JSON.parse(content);
|
|
1078
|
+
return true;
|
|
1079
|
+
} catch {
|
|
1080
|
+
return false;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function DirectiveRender({ content, className, streaming }) {
|
|
1036
1084
|
const host = useDirectiveHost();
|
|
1037
1085
|
const directive = tryDecodeDirectiveContent(content, (message) => {
|
|
1038
1086
|
const line = `[kind-directives] ${message}`;
|
|
@@ -1040,8 +1088,11 @@ function DirectiveRender({ content, className }) {
|
|
|
1040
1088
|
else console.error(line);
|
|
1041
1089
|
});
|
|
1042
1090
|
if (!directive) {
|
|
1091
|
+
if (typeof content === "string" && looksLikeDirectiveHead(content) && !isWholeJson(content)) {
|
|
1092
|
+
return /* @__PURE__ */ jsx8(DirectiveProvisionalCard, { content, streaming: streaming !== false, className });
|
|
1093
|
+
}
|
|
1043
1094
|
const raw = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
1044
|
-
return /* @__PURE__ */
|
|
1095
|
+
return /* @__PURE__ */ jsx8(
|
|
1045
1096
|
"pre",
|
|
1046
1097
|
{
|
|
1047
1098
|
className: `my-3 overflow-x-auto rounded-md border border-border bg-muted px-3 py-2 text-xs text-muted-foreground${className ? ` ${className}` : ""}`,
|
|
@@ -1050,13 +1101,13 @@ function DirectiveRender({ content, className }) {
|
|
|
1050
1101
|
);
|
|
1051
1102
|
}
|
|
1052
1103
|
const Renderer = getDirectiveRenderer(directive);
|
|
1053
|
-
if (Renderer) return /* @__PURE__ */
|
|
1054
|
-
if (directive.parsed.executes) return /* @__PURE__ */
|
|
1055
|
-
return /* @__PURE__ */
|
|
1104
|
+
if (Renderer) return /* @__PURE__ */ jsx8(Renderer, { directive });
|
|
1105
|
+
if (directive.parsed.executes) return /* @__PURE__ */ jsx8(SideEffectDirectiveCard, { directive });
|
|
1106
|
+
return /* @__PURE__ */ jsx8(DirectiveFallbackCard, { directive });
|
|
1056
1107
|
}
|
|
1057
1108
|
|
|
1058
1109
|
// react/KindInstanceRender.tsx
|
|
1059
|
-
import { Fragment as Fragment2, jsx as
|
|
1110
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1060
1111
|
function isRecordValue(value) {
|
|
1061
1112
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1062
1113
|
}
|
|
@@ -1069,7 +1120,7 @@ function kindIsRoutable(kind, host) {
|
|
|
1069
1120
|
}
|
|
1070
1121
|
function KindInstanceRender(props) {
|
|
1071
1122
|
if (isReservedDirectiveSlug2(props.kind)) {
|
|
1072
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsx9(
|
|
1073
1124
|
DirectiveRender,
|
|
1074
1125
|
{
|
|
1075
1126
|
content: props.value,
|
|
@@ -1077,7 +1128,7 @@ function KindInstanceRender(props) {
|
|
|
1077
1128
|
}
|
|
1078
1129
|
);
|
|
1079
1130
|
}
|
|
1080
|
-
return /* @__PURE__ */
|
|
1131
|
+
return /* @__PURE__ */ jsx9(KindInstanceRenderInner, { ...props });
|
|
1081
1132
|
}
|
|
1082
1133
|
function KindInstanceRenderInner({
|
|
1083
1134
|
kind,
|
|
@@ -1128,19 +1179,19 @@ function KindInstanceRenderInner({
|
|
|
1128
1179
|
} : null;
|
|
1129
1180
|
const frameClass = variant === "bare" ? void 0 : "rounded-md border border-border bg-card p-3";
|
|
1130
1181
|
if (routingStatus === "unroutable" && unroutableFallback !== void 0) {
|
|
1131
|
-
return /* @__PURE__ */
|
|
1182
|
+
return /* @__PURE__ */ jsx9(Fragment2, { children: unroutableFallback });
|
|
1132
1183
|
}
|
|
1133
1184
|
const onTheFloor = block === null || routingStatus === "unroutable";
|
|
1134
1185
|
const notice = "This shape has no custom component yet, so it renders through the universal viewer \u2014 exactly what production shows today.";
|
|
1135
|
-
return /* @__PURE__ */
|
|
1136
|
-
showRoutingNote && routingStatus === "unroutable" ? host.renderNotice?.(notice) ?? /* @__PURE__ */
|
|
1137
|
-
/* @__PURE__ */
|
|
1186
|
+
return /* @__PURE__ */ jsxs6("div", { className: className ? `space-y-3 ${className}` : "space-y-3", children: [
|
|
1187
|
+
showRoutingNote && routingStatus === "unroutable" ? host.renderNotice?.(notice) ?? /* @__PURE__ */ jsx9("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,
|
|
1188
|
+
/* @__PURE__ */ jsx9("div", { className: frameClass, children: onTheFloor ? host.renderValue({ value, kind }) : host.renderBlock(block) })
|
|
1138
1189
|
] });
|
|
1139
1190
|
}
|
|
1140
1191
|
|
|
1141
1192
|
// react/ProvisionalKindBoundary.tsx
|
|
1142
1193
|
import React from "react";
|
|
1143
|
-
import { jsx as
|
|
1194
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1144
1195
|
var ProvisionalKindBoundaryInner = class extends React.Component {
|
|
1145
1196
|
state = { failed: false };
|
|
1146
1197
|
static getDerivedStateFromError() {
|
|
@@ -1165,14 +1216,14 @@ var ProvisionalKindBoundaryInner = class extends React.Component {
|
|
|
1165
1216
|
};
|
|
1166
1217
|
function ProvisionalKindBoundary(props) {
|
|
1167
1218
|
const host = useContentIrHost();
|
|
1168
|
-
return /* @__PURE__ */
|
|
1219
|
+
return /* @__PURE__ */ jsx10(ProvisionalKindBoundaryInner, { ...props, reportError: host.reportError });
|
|
1169
1220
|
}
|
|
1170
1221
|
function ProvisionalKindFrame({ children }) {
|
|
1171
1222
|
const host = useContentIrHost();
|
|
1172
1223
|
const label = "Still arriving";
|
|
1173
|
-
return /* @__PURE__ */
|
|
1224
|
+
return /* @__PURE__ */ jsxs7("div", { className: "relative", "aria-busy": "true", children: [
|
|
1174
1225
|
children,
|
|
1175
|
-
/* @__PURE__ */
|
|
1226
|
+
/* @__PURE__ */ jsx10("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__ */ jsx10("span", { className: "text-[10px] text-muted-foreground", children: label }) })
|
|
1176
1227
|
] });
|
|
1177
1228
|
}
|
|
1178
1229
|
|
|
@@ -1183,7 +1234,7 @@ import {
|
|
|
1183
1234
|
readObjectKind as readObjectKind3,
|
|
1184
1235
|
reconstructRegionValue
|
|
1185
1236
|
} from "@ai-matrx/content-ir";
|
|
1186
|
-
import { jsx as
|
|
1237
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1187
1238
|
function readStructuredValue(content, metadata) {
|
|
1188
1239
|
const envelope = readEnvelope3(metadata);
|
|
1189
1240
|
if (envelope) {
|
|
@@ -1208,19 +1259,19 @@ function GenericStructuredView({
|
|
|
1208
1259
|
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? readObjectKind3(value) : null) ?? "";
|
|
1209
1260
|
const marker = readIrRouteMarker(metadata);
|
|
1210
1261
|
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";
|
|
1211
|
-
return /* @__PURE__ */
|
|
1212
|
-
status === "streaming" ? streamingIndicator ?? /* @__PURE__ */
|
|
1262
|
+
return /* @__PURE__ */ jsxs8("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
|
|
1263
|
+
status === "streaming" ? streamingIndicator ?? /* @__PURE__ */ jsx11("div", { className: "mb-2 text-xs text-muted-foreground", children: "Still arriving\u2026" }) : null,
|
|
1213
1264
|
recovered ? host.renderValue({ value, ...kind ? { kind } : {}, note }) : (
|
|
1214
1265
|
// Zero-data-loss backstop: the region never parsed, so show the source
|
|
1215
1266
|
// verbatim rather than swallowing it.
|
|
1216
|
-
/* @__PURE__ */
|
|
1267
|
+
/* @__PURE__ */ jsx11("pre", { className: "max-h-96 overflow-auto font-mono text-xs leading-relaxed text-muted-foreground", children: content })
|
|
1217
1268
|
)
|
|
1218
1269
|
] });
|
|
1219
1270
|
}
|
|
1220
1271
|
|
|
1221
1272
|
// react/RuntimeWrapperViews.tsx
|
|
1222
1273
|
import { readNodeOutcomeValue, readObjectKind as readObjectKind4, readRunResultValue } from "@ai-matrx/content-ir";
|
|
1223
|
-
import { Fragment as Fragment3, jsx as
|
|
1274
|
+
import { Fragment as Fragment3, jsx as jsx12 } from "react/jsx-runtime";
|
|
1224
1275
|
function isRecord2(value) {
|
|
1225
1276
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1226
1277
|
}
|
|
@@ -1236,16 +1287,16 @@ function DelegatedOutput({
|
|
|
1236
1287
|
}) {
|
|
1237
1288
|
const host = useContentIrHost();
|
|
1238
1289
|
if (output === null || output === void 0) {
|
|
1239
|
-
return /* @__PURE__ */
|
|
1290
|
+
return /* @__PURE__ */ jsx12("p", { className: "text-xs text-muted-foreground", children: emptyLabel });
|
|
1240
1291
|
}
|
|
1241
1292
|
if (!isRecord2(output)) {
|
|
1242
|
-
return /* @__PURE__ */
|
|
1293
|
+
return /* @__PURE__ */ jsx12(Fragment3, { children: host.renderValue({ value: output }) });
|
|
1243
1294
|
}
|
|
1244
1295
|
const kind = readObjectKind4(output) ?? declaredKind;
|
|
1245
1296
|
if (!kind) {
|
|
1246
|
-
return /* @__PURE__ */
|
|
1297
|
+
return /* @__PURE__ */ jsx12(Fragment3, { children: fallback?.(output) ?? host.renderValue({ value: output }) });
|
|
1247
1298
|
}
|
|
1248
|
-
return /* @__PURE__ */
|
|
1299
|
+
return /* @__PURE__ */ jsx12(
|
|
1249
1300
|
KindInstanceRender,
|
|
1250
1301
|
{
|
|
1251
1302
|
kind,
|
|
@@ -1262,7 +1313,7 @@ function NodeOutcomeView({ serverData, fallback }) {
|
|
|
1262
1313
|
readNodeOutcomeValue
|
|
1263
1314
|
);
|
|
1264
1315
|
if (!wrapper) return null;
|
|
1265
|
-
return /* @__PURE__ */
|
|
1316
|
+
return /* @__PURE__ */ jsx12(
|
|
1266
1317
|
DelegatedOutput,
|
|
1267
1318
|
{
|
|
1268
1319
|
output: wrapper.output,
|
|
@@ -1277,14 +1328,14 @@ function RunResultView({ serverData, fallback }) {
|
|
|
1277
1328
|
readRunResultValue
|
|
1278
1329
|
);
|
|
1279
1330
|
if (!wrapper) return null;
|
|
1280
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ jsx12("div", { className: "space-y-2", children: wrapper.outputs.length > 0 ? wrapper.outputs.map((outcome) => /* @__PURE__ */ jsx12(
|
|
1281
1332
|
NodeOutcomeView,
|
|
1282
1333
|
{
|
|
1283
1334
|
serverData: { wrapper: outcome },
|
|
1284
1335
|
...fallback === void 0 ? {} : { fallback }
|
|
1285
1336
|
},
|
|
1286
1337
|
`${outcome.node_id}:${outcome.attempt}`
|
|
1287
|
-
)) : /* @__PURE__ */
|
|
1338
|
+
)) : /* @__PURE__ */ jsx12(
|
|
1288
1339
|
DelegatedOutput,
|
|
1289
1340
|
{
|
|
1290
1341
|
output: wrapper.output,
|
|
@@ -1490,6 +1541,7 @@ export {
|
|
|
1490
1541
|
DelegatedOutput,
|
|
1491
1542
|
DirectiveFallbackCard,
|
|
1492
1543
|
DirectiveHostProvider,
|
|
1544
|
+
DirectiveProvisionalCard,
|
|
1493
1545
|
DirectiveRender,
|
|
1494
1546
|
GENERIC_STRUCTURED_COMPONENT_KEY,
|
|
1495
1547
|
GenericStructuredView,
|
|
@@ -1514,6 +1566,7 @@ export {
|
|
|
1514
1566
|
kindIsRoutable,
|
|
1515
1567
|
kindServerDataFromStoredValue,
|
|
1516
1568
|
markKindPartialUnsafe,
|
|
1569
|
+
provisionalDirectiveSlug,
|
|
1517
1570
|
readIrRouteMarker,
|
|
1518
1571
|
registerDirectiveRenderer,
|
|
1519
1572
|
resetDirectiveRenderers,
|