@runtypelabs/persona 4.6.1 → 4.8.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/dist/animations/glyph-cycle.cjs +2 -2
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/glyph-cycle.js +2 -2
- package/dist/animations/{types-CSmiKRVa.d.cts → types-BsZtXPKK.d.cts} +43 -3
- package/dist/animations/{types-CSmiKRVa.d.ts → types-BsZtXPKK.d.ts} +43 -3
- package/dist/animations/wipe.cjs +2 -2
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/chunk-5EIIHQLQ.js +1 -0
- package/dist/codegen.cjs +12 -12
- package/dist/codegen.js +14 -14
- package/dist/index.cjs +91 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +918 -174
- package/dist/index.d.ts +918 -174
- package/dist/index.global.js +81 -57
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +89 -66
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js +3 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/markdown-parsers.js +24 -24
- package/dist/plugin-kit.cjs +1 -1
- package/dist/plugin-kit.js +1 -1
- package/dist/runtype-tts-entry-UJAEF7NZ.js +1 -0
- package/dist/runtype-tts.js +1 -1
- package/dist/session-reconnect-JKIJBHS5.js +1 -0
- package/dist/smart-dom-reader.cjs +17 -17
- package/dist/smart-dom-reader.d.cts +753 -15
- package/dist/smart-dom-reader.d.ts +753 -15
- package/dist/smart-dom-reader.js +17 -17
- package/dist/testing.cjs +3 -3
- package/dist/testing.js +3 -3
- package/dist/theme-editor-preview.cjs +81 -58
- package/dist/theme-editor-preview.d.cts +761 -15
- package/dist/theme-editor-preview.d.ts +761 -15
- package/dist/theme-editor-preview.js +81 -58
- package/dist/theme-editor.cjs +6 -6
- package/dist/theme-editor.d.cts +753 -15
- package/dist/theme-editor.d.ts +753 -15
- package/dist/theme-editor.js +10 -10
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +74 -0
- package/dist/theme-reference.d.ts +74 -0
- package/dist/theme-reference.js +1 -1
- package/dist/voice-worklet-player.cjs +2 -2
- package/dist/voice-worklet-player.js +2 -2
- package/dist/webmcp-polyfill.js +2 -2
- package/dist/widget.css +1 -1
- package/package.json +2 -3
- package/src/artifacts-session.test.ts +178 -0
- package/src/client.test.ts +500 -1
- package/src/client.ts +285 -93
- package/src/components/artifact-card.test.ts +333 -0
- package/src/components/artifact-card.ts +75 -28
- package/src/components/artifact-inline.test.ts +1328 -0
- package/src/components/artifact-inline.ts +920 -0
- package/src/components/artifact-pane.test.ts +1042 -0
- package/src/components/artifact-pane.ts +440 -131
- package/src/components/artifact-preview.test.ts +1155 -0
- package/src/components/artifact-preview.ts +994 -0
- package/src/components/pill-composer-builder.test.ts +6 -2
- package/src/components/pill-composer-builder.ts +6 -6
- package/src/components/reasoning-bubble.ts +1 -13
- package/src/components/registry.ts +38 -3
- package/src/components/tool-bubble.ts +1 -13
- package/src/defaults.ts +1 -0
- package/src/generated/runtype-openapi-contract.ts +55 -3
- package/src/index-core.ts +20 -1
- package/src/index.ts +8 -0
- package/src/markdown-parsers-loader.test.ts +158 -0
- package/src/markdown-parsers-loader.ts +74 -9
- package/src/runtime/host-layout.test.ts +163 -0
- package/src/runtime/host-layout.ts +110 -7
- package/src/runtime/init.ts +18 -61
- package/src/runtime/persist-state.test.ts +118 -0
- package/src/session.ts +76 -22
- package/src/styles/widget.css +773 -26
- package/src/theme-editor/preview.ts +2 -0
- package/src/theme-editor/sections.test.ts +26 -1
- package/src/theme-editor/sections.ts +10 -2
- package/src/theme-reference.ts +2 -2
- package/src/tool-call-display-defaults.test.ts +1 -0
- package/src/types/theme.ts +77 -0
- package/src/types.ts +516 -17
- package/src/ui.artifact-pane-gating.test.ts +636 -0
- package/src/ui.component-directive.test.ts +104 -0
- package/src/ui.composer-bar.test.ts +60 -2
- package/src/ui.detached-panel.test.ts +1049 -0
- package/src/ui.scroll-additive.test.ts +1 -1
- package/src/ui.streaming-coalescing.test.ts +312 -0
- package/src/ui.tool-display.test.ts +51 -0
- package/src/ui.ts +933 -214
- package/src/utils/artifact-custom-actions.ts +128 -0
- package/src/utils/artifact-display.test.ts +42 -0
- package/src/utils/artifact-display.ts +84 -0
- package/src/utils/artifact-file.test.ts +116 -0
- package/src/utils/artifact-file.ts +117 -0
- package/src/utils/artifact-gate.test.ts +112 -5
- package/src/utils/artifact-gate.ts +39 -14
- package/src/utils/artifact-loading-status.ts +55 -0
- package/src/utils/artifact-status-label.ts +190 -0
- package/src/utils/buttons.ts +7 -1
- package/src/utils/code-highlight.test.ts +186 -0
- package/src/utils/code-highlight.ts +400 -0
- package/src/utils/icons.ts +2 -0
- package/src/utils/roving-tablist.test.ts +152 -0
- package/src/utils/roving-tablist.ts +111 -0
- package/src/utils/spinner.ts +45 -0
- package/src/utils/theme.test.ts +48 -0
- package/src/utils/theme.ts +7 -0
- package/src/utils/tokens.ts +91 -0
- package/src/utils/tool-loading-animation.test.ts +32 -0
- package/src/utils/tool-loading-animation.ts +24 -0
- package/dist/chunk-DFBSCFYN.js +0 -1
- package/dist/runtype-tts-entry-HFUV2UF7.js +0 -1
- package/dist/session-reconnect-U77QFUR7.js +0 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IconNode } from 'lucide';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* VENDORED type declarations: @mcp-b/smart-dom-reader v2.3.1 (MIT).
|
|
3
5
|
* Copied verbatim from upstream dist/index.d.mts (only the trailing sourceMappingURL
|
|
@@ -714,6 +716,10 @@ interface PanelTokens extends ComponentTokenSet {
|
|
|
714
716
|
maxWidth: string;
|
|
715
717
|
height: string;
|
|
716
718
|
maxHeight: string;
|
|
719
|
+
/** Gap between the detached panel and its region edges. Only used when detached. */
|
|
720
|
+
inset?: string;
|
|
721
|
+
/** Background of the region revealed behind a detached panel. */
|
|
722
|
+
canvasBackground?: string;
|
|
717
723
|
}
|
|
718
724
|
interface HeaderTokens extends ComponentTokenSet {
|
|
719
725
|
background: TokenReference<'color'>;
|
|
@@ -878,6 +884,14 @@ interface ArtifactToolbarTokens {
|
|
|
878
884
|
iconBorder?: string;
|
|
879
885
|
toggleGroupGap?: string;
|
|
880
886
|
toggleBorderRadius?: string;
|
|
887
|
+
/** Inner padding of the segmented view/source toggle pill. */
|
|
888
|
+
toggleGroupPadding?: string;
|
|
889
|
+
/** Border of the segmented view/source toggle pill (e.g., `none`). */
|
|
890
|
+
toggleGroupBorder?: string;
|
|
891
|
+
/** Corner radius of the segmented view/source toggle pill. */
|
|
892
|
+
toggleGroupBorderRadius?: string;
|
|
893
|
+
/** Background of the segmented view/source toggle pill. */
|
|
894
|
+
toggleGroupBackground?: string;
|
|
881
895
|
copyBackground?: string;
|
|
882
896
|
copyBorder?: string;
|
|
883
897
|
copyColor?: string;
|
|
@@ -909,6 +923,16 @@ interface ArtifactTabTokens {
|
|
|
909
923
|
/** Tab list container padding (CSS shorthand). */
|
|
910
924
|
listPadding?: string;
|
|
911
925
|
}
|
|
926
|
+
/** Artifact reference card (chat thread) chrome. */
|
|
927
|
+
interface ArtifactCardTokens {
|
|
928
|
+
background?: string;
|
|
929
|
+
/** Full border shorthand (e.g. `1px solid #e5e7eb`). */
|
|
930
|
+
border?: string;
|
|
931
|
+
borderRadius?: string;
|
|
932
|
+
hoverBackground?: string;
|
|
933
|
+
/** Border color on hover. */
|
|
934
|
+
hoverBorderColor?: string;
|
|
935
|
+
}
|
|
912
936
|
/** Artifact pane chrome. */
|
|
913
937
|
interface ArtifactPaneTokens {
|
|
914
938
|
/**
|
|
@@ -919,6 +943,54 @@ interface ArtifactPaneTokens {
|
|
|
919
943
|
background?: string;
|
|
920
944
|
toolbarBackground?: string;
|
|
921
945
|
}
|
|
946
|
+
/** Inline artifact block chrome (`display: "inline"` file preview). */
|
|
947
|
+
interface ArtifactInlineTokens {
|
|
948
|
+
/** Background of the inline preview frame. */
|
|
949
|
+
background?: string;
|
|
950
|
+
/** Full border shorthand for the frame (e.g. `1px solid #e5e7eb`). */
|
|
951
|
+
border?: string;
|
|
952
|
+
/** Border radius of the inline preview frame. */
|
|
953
|
+
borderRadius?: string;
|
|
954
|
+
/** Background of the title/toolbar chrome bar. */
|
|
955
|
+
chromeBackground?: string;
|
|
956
|
+
/** Bottom border of the title bar. */
|
|
957
|
+
chromeBorder?: string;
|
|
958
|
+
/** Title text color in the chrome bar (artifact basename). */
|
|
959
|
+
titleColor?: string;
|
|
960
|
+
/** Muted text color for the type label / streaming status. */
|
|
961
|
+
mutedColor?: string;
|
|
962
|
+
/** Preview iframe height inside the inline body. */
|
|
963
|
+
frameHeight?: string;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Syntax-highlighted artifact source view (pane + inline), rendered by
|
|
967
|
+
* `utils/code-highlight.ts`. One Light defaults ship in `widget.css`, with a
|
|
968
|
+
* One Dark override keyed off the widget's resolved color scheme (the
|
|
969
|
+
* `data-persona-color-scheme` root attribute, not the OS preference); set any
|
|
970
|
+
* of these to retheme the tokenizer palette and the line-number gutter.
|
|
971
|
+
*/
|
|
972
|
+
interface CodeTokens {
|
|
973
|
+
/** Keywords, booleans, null (e.g. `const`, `true`). */
|
|
974
|
+
keywordColor?: string;
|
|
975
|
+
/** String and template literals; HTML attribute values. */
|
|
976
|
+
stringColor?: string;
|
|
977
|
+
/** Line and block comments. */
|
|
978
|
+
commentColor?: string;
|
|
979
|
+
/** Numeric literals; CSS hex colors / units. */
|
|
980
|
+
numberColor?: string;
|
|
981
|
+
/** HTML tag brackets + names; doctype. */
|
|
982
|
+
tagColor?: string;
|
|
983
|
+
/** HTML attribute names. */
|
|
984
|
+
attrColor?: string;
|
|
985
|
+
/** CSS property names; JSON object keys. */
|
|
986
|
+
propertyColor?: string;
|
|
987
|
+
/** Line-number gutter digits. */
|
|
988
|
+
lineNumberColor?: string;
|
|
989
|
+
/** Right border of the line-number gutter. */
|
|
990
|
+
gutterBorderColor?: string;
|
|
991
|
+
/** Background of the source-view code sheet (defaults to One Light/Dark editor background). */
|
|
992
|
+
background?: string;
|
|
993
|
+
}
|
|
922
994
|
/** Icon button chrome (used by createIconButton). */
|
|
923
995
|
interface IconButtonTokens {
|
|
924
996
|
background?: string;
|
|
@@ -988,9 +1060,13 @@ interface ComponentTokens {
|
|
|
988
1060
|
toolbar?: ArtifactToolbarTokens;
|
|
989
1061
|
tab?: ArtifactTabTokens;
|
|
990
1062
|
pane?: ArtifactPaneTokens;
|
|
1063
|
+
card?: ArtifactCardTokens;
|
|
1064
|
+
inline?: ArtifactInlineTokens;
|
|
991
1065
|
};
|
|
992
1066
|
/** Collapsible widget chrome (tool/reasoning/approval bubbles). */
|
|
993
1067
|
collapsibleWidget?: CollapsibleWidgetTokens;
|
|
1068
|
+
/** Syntax-highlighted artifact source view (tokenizer palette + gutter). */
|
|
1069
|
+
code?: CodeTokens;
|
|
994
1070
|
}
|
|
995
1071
|
interface PaletteExtras {
|
|
996
1072
|
transitions?: Record<string, string>;
|
|
@@ -1033,6 +1109,7 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1033
1109
|
totalSteps?: number;
|
|
1034
1110
|
type: "execution_start";
|
|
1035
1111
|
}) | ({
|
|
1112
|
+
claudeManagedAgentId?: string;
|
|
1036
1113
|
completedAt?: string;
|
|
1037
1114
|
durationMs?: number;
|
|
1038
1115
|
executionId: string;
|
|
@@ -1077,6 +1154,15 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1077
1154
|
completedAt?: string;
|
|
1078
1155
|
content?: string;
|
|
1079
1156
|
cost?: number;
|
|
1157
|
+
estimatedContextBreakdown?: {
|
|
1158
|
+
categories: Record<string, {
|
|
1159
|
+
chars: number;
|
|
1160
|
+
estimatedTokens: number;
|
|
1161
|
+
}>;
|
|
1162
|
+
contextWindowSize?: number;
|
|
1163
|
+
estimatedTotalTokens: number;
|
|
1164
|
+
estimatedUtilizationPercent?: number;
|
|
1165
|
+
};
|
|
1080
1166
|
executionId: string;
|
|
1081
1167
|
fallback?: {
|
|
1082
1168
|
attempts: Array<{
|
|
@@ -1114,6 +1200,7 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1114
1200
|
type: "step_start";
|
|
1115
1201
|
} | ({
|
|
1116
1202
|
completedAt?: string;
|
|
1203
|
+
cost?: number;
|
|
1117
1204
|
durationMs?: number;
|
|
1118
1205
|
error?: string;
|
|
1119
1206
|
executionId: string;
|
|
@@ -1219,6 +1306,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1219
1306
|
artifactType: "markdown" | "component";
|
|
1220
1307
|
component?: string;
|
|
1221
1308
|
executionId?: string;
|
|
1309
|
+
file?: {
|
|
1310
|
+
language?: string;
|
|
1311
|
+
mimeType: string;
|
|
1312
|
+
path: string;
|
|
1313
|
+
};
|
|
1222
1314
|
id: string;
|
|
1223
1315
|
seq?: number;
|
|
1224
1316
|
title?: string;
|
|
@@ -1327,6 +1419,14 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1327
1419
|
awaitReason?: string;
|
|
1328
1420
|
awaitedAt?: string;
|
|
1329
1421
|
crawlId?: string;
|
|
1422
|
+
elicitation?: {
|
|
1423
|
+
message: string;
|
|
1424
|
+
mode: "form" | "url";
|
|
1425
|
+
pauseCount?: number;
|
|
1426
|
+
requestedSchema?: Record<string, unknown>;
|
|
1427
|
+
serverName?: string;
|
|
1428
|
+
url?: string;
|
|
1429
|
+
};
|
|
1330
1430
|
executionId: string;
|
|
1331
1431
|
origin?: "webmcp" | "sdk";
|
|
1332
1432
|
pageOrigin?: string;
|
|
@@ -1426,6 +1526,14 @@ type RuntypeFlowSSEEvent = {
|
|
|
1426
1526
|
awaitReason?: string;
|
|
1427
1527
|
awaitedAt: string;
|
|
1428
1528
|
crawlId?: string;
|
|
1529
|
+
elicitation?: {
|
|
1530
|
+
message: string;
|
|
1531
|
+
mode: "form" | "url";
|
|
1532
|
+
pauseCount?: number;
|
|
1533
|
+
requestedSchema?: Record<string, unknown>;
|
|
1534
|
+
serverName?: string;
|
|
1535
|
+
url?: string;
|
|
1536
|
+
};
|
|
1429
1537
|
executionId?: string;
|
|
1430
1538
|
flowId: string;
|
|
1431
1539
|
origin?: "webmcp" | "sdk";
|
|
@@ -1476,7 +1584,7 @@ type RuntypeFlowSSEEvent = {
|
|
|
1476
1584
|
completedAt?: string;
|
|
1477
1585
|
duration?: number;
|
|
1478
1586
|
durationMs?: number;
|
|
1479
|
-
error?: string;
|
|
1587
|
+
error?: string | null;
|
|
1480
1588
|
executionId?: string;
|
|
1481
1589
|
executionTime?: number;
|
|
1482
1590
|
id?: string;
|
|
@@ -1520,13 +1628,21 @@ type RuntypeFlowSSEEvent = {
|
|
|
1520
1628
|
totalSteps: number;
|
|
1521
1629
|
type: "step_skip";
|
|
1522
1630
|
when: string;
|
|
1523
|
-
} | {
|
|
1631
|
+
} | ({
|
|
1632
|
+
elicitation?: {
|
|
1633
|
+
message: string;
|
|
1634
|
+
mode: "form" | "url";
|
|
1635
|
+
pauseCount?: number;
|
|
1636
|
+
requestedSchema?: Record<string, unknown>;
|
|
1637
|
+
serverName?: string;
|
|
1638
|
+
url?: string;
|
|
1639
|
+
};
|
|
1524
1640
|
executionId?: string;
|
|
1525
1641
|
reason?: string;
|
|
1526
1642
|
seq?: number;
|
|
1527
1643
|
type: "step_await";
|
|
1528
1644
|
[key: string]: unknown;
|
|
1529
|
-
} | ({
|
|
1645
|
+
}) | ({
|
|
1530
1646
|
agentContext?: {
|
|
1531
1647
|
executionId: string;
|
|
1532
1648
|
iteration: number;
|
|
@@ -1691,6 +1807,149 @@ type TargetResolver = (id: string) => {
|
|
|
1691
1807
|
payload: Record<string, unknown>;
|
|
1692
1808
|
};
|
|
1693
1809
|
|
|
1810
|
+
/**
|
|
1811
|
+
* Curated registry of lucide icons available to `renderLucideIcon`.
|
|
1812
|
+
*
|
|
1813
|
+
* The widget used to do `import * as icons from "lucide"` and look up
|
|
1814
|
+
* icons dynamically by string. That defeated tree-shaking, so the IIFE
|
|
1815
|
+
* (CDN/script-tag) bundle shipped all 1640 lucide icons (~400KB of icon
|
|
1816
|
+
* data) regardless of which we actually used. This explicit registry
|
|
1817
|
+
* lets the bundler drop any icon not listed here.
|
|
1818
|
+
*
|
|
1819
|
+
* Trade-off: `renderLucideIcon(name)` is now a *closed set*. Names not
|
|
1820
|
+
* in this map return `null` and log a warning, exactly as a typo did
|
|
1821
|
+
* before. The registry is intentionally generous (~110 icons) so that
|
|
1822
|
+
* custom `ComponentRenderer` authors rarely hit a missing-icon dead end.
|
|
1823
|
+
*
|
|
1824
|
+
* To add icons: add a named import above and a row in `LUCIDE_ICONS`,
|
|
1825
|
+
* keyed by the lucide kebab-case name (matches their filename and
|
|
1826
|
+
* https://lucide.dev/icons).
|
|
1827
|
+
*
|
|
1828
|
+
* See `packages/widget/docs/icon-registry-shortlist.md` for the full
|
|
1829
|
+
* curation rationale and which icons were considered but excluded.
|
|
1830
|
+
*/
|
|
1831
|
+
declare const LUCIDE_ICONS: {
|
|
1832
|
+
readonly activity: IconNode;
|
|
1833
|
+
readonly "arrow-down": IconNode;
|
|
1834
|
+
readonly "arrow-up": IconNode;
|
|
1835
|
+
readonly "arrow-up-right": IconNode;
|
|
1836
|
+
readonly bot: IconNode;
|
|
1837
|
+
readonly "chevron-down": IconNode;
|
|
1838
|
+
readonly "chevron-up": IconNode;
|
|
1839
|
+
readonly "chevron-right": IconNode;
|
|
1840
|
+
readonly "chevron-left": IconNode;
|
|
1841
|
+
readonly check: IconNode;
|
|
1842
|
+
readonly clipboard: IconNode;
|
|
1843
|
+
readonly "clipboard-copy": IconNode;
|
|
1844
|
+
readonly "code-xml": IconNode;
|
|
1845
|
+
readonly copy: IconNode;
|
|
1846
|
+
readonly file: IconNode;
|
|
1847
|
+
readonly "file-code": IconNode;
|
|
1848
|
+
readonly "file-spreadsheet": IconNode;
|
|
1849
|
+
readonly "file-text": IconNode;
|
|
1850
|
+
readonly "image-plus": IconNode;
|
|
1851
|
+
readonly loader: IconNode;
|
|
1852
|
+
readonly "loader-circle": IconNode;
|
|
1853
|
+
readonly mic: IconNode;
|
|
1854
|
+
readonly paperclip: IconNode;
|
|
1855
|
+
readonly "refresh-cw": IconNode;
|
|
1856
|
+
readonly search: IconNode;
|
|
1857
|
+
readonly send: IconNode;
|
|
1858
|
+
readonly "shield-alert": IconNode;
|
|
1859
|
+
readonly "shield-check": IconNode;
|
|
1860
|
+
readonly "shield-x": IconNode;
|
|
1861
|
+
readonly square: IconNode;
|
|
1862
|
+
readonly "thumbs-down": IconNode;
|
|
1863
|
+
readonly "thumbs-up": IconNode;
|
|
1864
|
+
readonly upload: IconNode;
|
|
1865
|
+
readonly "volume-2": IconNode;
|
|
1866
|
+
readonly x: IconNode;
|
|
1867
|
+
readonly user: IconNode;
|
|
1868
|
+
readonly mail: IconNode;
|
|
1869
|
+
readonly phone: IconNode;
|
|
1870
|
+
readonly calendar: IconNode;
|
|
1871
|
+
readonly clock: IconNode;
|
|
1872
|
+
readonly building: IconNode;
|
|
1873
|
+
readonly "map-pin": IconNode;
|
|
1874
|
+
readonly lock: IconNode;
|
|
1875
|
+
readonly key: IconNode;
|
|
1876
|
+
readonly "credit-card": IconNode;
|
|
1877
|
+
readonly "at-sign": IconNode;
|
|
1878
|
+
readonly hash: IconNode;
|
|
1879
|
+
readonly globe: IconNode;
|
|
1880
|
+
readonly link: IconNode;
|
|
1881
|
+
readonly "circle-check": IconNode;
|
|
1882
|
+
readonly "circle-x": IconNode;
|
|
1883
|
+
readonly "triangle-alert": IconNode;
|
|
1884
|
+
readonly info: IconNode;
|
|
1885
|
+
readonly ban: IconNode;
|
|
1886
|
+
readonly shield: IconNode;
|
|
1887
|
+
readonly "arrow-left": IconNode;
|
|
1888
|
+
readonly "arrow-right": IconNode;
|
|
1889
|
+
readonly "external-link": IconNode;
|
|
1890
|
+
readonly ellipsis: IconNode;
|
|
1891
|
+
readonly "ellipsis-vertical": IconNode;
|
|
1892
|
+
readonly menu: IconNode;
|
|
1893
|
+
readonly house: IconNode;
|
|
1894
|
+
readonly plus: IconNode;
|
|
1895
|
+
readonly minus: IconNode;
|
|
1896
|
+
readonly pencil: IconNode;
|
|
1897
|
+
readonly trash: IconNode;
|
|
1898
|
+
readonly "trash-2": IconNode;
|
|
1899
|
+
readonly save: IconNode;
|
|
1900
|
+
readonly download: IconNode;
|
|
1901
|
+
readonly share: IconNode;
|
|
1902
|
+
readonly funnel: IconNode;
|
|
1903
|
+
readonly settings: IconNode;
|
|
1904
|
+
readonly "rotate-cw": IconNode;
|
|
1905
|
+
readonly maximize: IconNode;
|
|
1906
|
+
readonly minimize: IconNode;
|
|
1907
|
+
readonly "shopping-cart": IconNode;
|
|
1908
|
+
readonly "shopping-bag": IconNode;
|
|
1909
|
+
readonly package: IconNode;
|
|
1910
|
+
readonly truck: IconNode;
|
|
1911
|
+
readonly tag: IconNode;
|
|
1912
|
+
readonly gift: IconNode;
|
|
1913
|
+
readonly receipt: IconNode;
|
|
1914
|
+
readonly wallet: IconNode;
|
|
1915
|
+
readonly store: IconNode;
|
|
1916
|
+
readonly "dollar-sign": IconNode;
|
|
1917
|
+
readonly percent: IconNode;
|
|
1918
|
+
readonly play: IconNode;
|
|
1919
|
+
readonly pause: IconNode;
|
|
1920
|
+
readonly "volume-x": IconNode;
|
|
1921
|
+
readonly camera: IconNode;
|
|
1922
|
+
readonly image: IconNode;
|
|
1923
|
+
readonly film: IconNode;
|
|
1924
|
+
readonly headphones: IconNode;
|
|
1925
|
+
readonly "message-circle": IconNode;
|
|
1926
|
+
readonly "message-square": IconNode;
|
|
1927
|
+
readonly bell: IconNode;
|
|
1928
|
+
readonly heart: IconNode;
|
|
1929
|
+
readonly star: IconNode;
|
|
1930
|
+
readonly eye: IconNode;
|
|
1931
|
+
readonly "eye-off": IconNode;
|
|
1932
|
+
readonly bookmark: IconNode;
|
|
1933
|
+
readonly "calendar-days": IconNode;
|
|
1934
|
+
readonly history: IconNode;
|
|
1935
|
+
readonly timer: IconNode;
|
|
1936
|
+
readonly folder: IconNode;
|
|
1937
|
+
readonly "folder-open": IconNode;
|
|
1938
|
+
readonly files: IconNode;
|
|
1939
|
+
readonly sparkles: IconNode;
|
|
1940
|
+
readonly zap: IconNode;
|
|
1941
|
+
readonly sun: IconNode;
|
|
1942
|
+
readonly moon: IconNode;
|
|
1943
|
+
readonly flag: IconNode;
|
|
1944
|
+
readonly monitor: IconNode;
|
|
1945
|
+
readonly smartphone: IconNode;
|
|
1946
|
+
};
|
|
1947
|
+
/**
|
|
1948
|
+
* Names of lucide icons that ship with the widget. Names not in this
|
|
1949
|
+
* union return `null` from `renderLucideIcon` (with a console warning).
|
|
1950
|
+
*/
|
|
1951
|
+
type IconName = keyof typeof LUCIDE_ICONS;
|
|
1952
|
+
|
|
1694
1953
|
/**
|
|
1695
1954
|
* Text content part for multi-modal messages
|
|
1696
1955
|
*/
|
|
@@ -2211,7 +2470,13 @@ type AgentWidgetMessageActionsConfig = {
|
|
|
2211
2470
|
* new artifact content arrives or the host calls `showArtifacts()` on the widget handle.
|
|
2212
2471
|
*/
|
|
2213
2472
|
type AgentWidgetArtifactsLayoutConfig = {
|
|
2214
|
-
/**
|
|
2473
|
+
/**
|
|
2474
|
+
* Flex gap between chat column and artifact pane.
|
|
2475
|
+
* @default 0 (welded); detached uses the panel inset
|
|
2476
|
+
* @remarks In welded appearances (`panel` / `seamless`) a nonzero gap opens a
|
|
2477
|
+
* visible seam in the single card. It is honored geometrically (resize clamps
|
|
2478
|
+
* and the seam handle account for it) but is usually undesired.
|
|
2479
|
+
*/
|
|
2215
2480
|
splitGap?: string;
|
|
2216
2481
|
/** Artifact column width in split mode. @default 40% */
|
|
2217
2482
|
paneWidth?: string;
|
|
@@ -2242,16 +2507,39 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2242
2507
|
/** Optional max artifact width cap while resizing (`px` only). Layout still bounds by chat min width. */
|
|
2243
2508
|
resizableMaxWidth?: string;
|
|
2244
2509
|
/**
|
|
2245
|
-
* Visual treatment for the artifact column in split
|
|
2246
|
-
* - `'panel'`:
|
|
2247
|
-
*
|
|
2510
|
+
* Visual treatment for the artifact column in a desktop split.
|
|
2511
|
+
* - `'panel'`: one welded card (border + radius wrap chat + pane) with a hairline
|
|
2512
|
+
* divider on the pane's chat-facing edge, zero gap (default).
|
|
2513
|
+
* - `'seamless'`: the same welded card with no internal divider or chrome, zero gap.
|
|
2514
|
+
* - `'detached'`: two separate elevated cards: gap from `--persona-panel-inset`,
|
|
2515
|
+
* all-side border and radius on each, and canvas background behind the split.
|
|
2516
|
+
* In an inline embed this also insets the split from the container edges on all
|
|
2517
|
+
* sides (the page canvas shows through), so the all-side margin no longer requires
|
|
2518
|
+
* `launcher.detachedPanel`.
|
|
2519
|
+
*
|
|
2520
|
+
* Default is `'panel'` unless `launcher.detachedPanel` is true, in which case an unset
|
|
2521
|
+
* `paneAppearance` resolves to `'detached'`. An explicit value always wins.
|
|
2248
2522
|
* @default 'panel'
|
|
2249
2523
|
*/
|
|
2250
|
-
paneAppearance?: "panel" | "seamless";
|
|
2524
|
+
paneAppearance?: "panel" | "seamless" | "detached";
|
|
2251
2525
|
/** Border radius on the artifact pane (CSS length). Works with any `paneAppearance`. */
|
|
2252
2526
|
paneBorderRadius?: string;
|
|
2253
2527
|
/** CSS `box-shadow` on the artifact pane. Set `"none"` to suppress the default shadow. */
|
|
2254
2528
|
paneShadow?: string;
|
|
2529
|
+
/**
|
|
2530
|
+
* CSS `box-shadow` for the chat column card in a detached split. Defaults to the same
|
|
2531
|
+
* elevation as the artifact pane; set to `"none"` to keep the chat flat while the pane stays raised.
|
|
2532
|
+
*/
|
|
2533
|
+
chatShadow?: string;
|
|
2534
|
+
/**
|
|
2535
|
+
* Chat column surface in a detached split. `"card"` (default) renders the chat as an inset card
|
|
2536
|
+
* matching the artifact pane; `"flush"` renders the chat flush with the container (no border, radius,
|
|
2537
|
+
* or shadow) and insets only the artifact pane, so the chat is flat background and the pane floats.
|
|
2538
|
+
* Only affects an inline-embedded detached split (the container-filling case); in floating, docked,
|
|
2539
|
+
* or sidebar modes it falls back to the card look.
|
|
2540
|
+
* @default 'card'
|
|
2541
|
+
*/
|
|
2542
|
+
chatSurface?: "card" | "flush";
|
|
2255
2543
|
/**
|
|
2256
2544
|
* Full `border` shorthand for the artifact `<aside>` (all sides). Overrides default pane borders.
|
|
2257
2545
|
* Example: `"1px solid #cccccc"`.
|
|
@@ -2263,14 +2551,12 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2263
2551
|
*/
|
|
2264
2552
|
paneBorderLeft?: string;
|
|
2265
2553
|
/**
|
|
2266
|
-
*
|
|
2267
|
-
* top-right and bottom-right radii, and round the **artifact pane’s** top-right and bottom-right
|
|
2268
|
-
* to match `persona-rounded-2xl` (`--persona-radius-lg`) so the two columns read as one shell.
|
|
2554
|
+
* @deprecated No-op. Panel and seamless splits now weld into one card by default.
|
|
2269
2555
|
*/
|
|
2270
2556
|
unifiedSplitChrome?: boolean;
|
|
2271
2557
|
/**
|
|
2272
|
-
*
|
|
2273
|
-
* @default matches
|
|
2558
|
+
* Desktop welded split only: override the artifact pane's outer-right corner radius (CSS length).
|
|
2559
|
+
* @default matches the panel radius (`--persona-panel-radius`)
|
|
2274
2560
|
*/
|
|
2275
2561
|
unifiedSplitOuterRadius?: string;
|
|
2276
2562
|
/**
|
|
@@ -2290,6 +2576,10 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2290
2576
|
* @default 'default'
|
|
2291
2577
|
*/
|
|
2292
2578
|
toolbarPreset?: "default" | "document";
|
|
2579
|
+
/** Visible title in the artifact toolbar. @default "Artifacts" */
|
|
2580
|
+
toolbarTitle?: string;
|
|
2581
|
+
/** Label for the artifact dismiss control. @default "Close" */
|
|
2582
|
+
closeButtonLabel?: string;
|
|
2293
2583
|
/**
|
|
2294
2584
|
* When `toolbarPreset` is `document`, show a visible "Copy" label next to the copy icon.
|
|
2295
2585
|
*/
|
|
@@ -2304,6 +2594,17 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2304
2594
|
documentToolbarToggleActiveBackground?: string;
|
|
2305
2595
|
/** Active view/source toggle border color. Sets `--persona-artifact-doc-toggle-active-border`. */
|
|
2306
2596
|
documentToolbarToggleActiveBorderColor?: string;
|
|
2597
|
+
/** Show an expand/collapse toggle in the artifact toolbar (both presets). Expanded fills the widget with the pane and hides the chat column. Default: false. */
|
|
2598
|
+
showExpandToggle?: boolean;
|
|
2599
|
+
/** Show the copy control in the `default` toolbar preset (the `document` preset always shows it). Default: false. */
|
|
2600
|
+
showCopyButton?: boolean;
|
|
2601
|
+
/** Edge fade on the scrollable tab strip. true = both ends (dynamic). @default true */
|
|
2602
|
+
tabFade?: boolean | {
|
|
2603
|
+
start?: boolean;
|
|
2604
|
+
end?: boolean;
|
|
2605
|
+
};
|
|
2606
|
+
/** Tab fade width (CSS length). @default 24px */
|
|
2607
|
+
tabFadeSize?: string;
|
|
2307
2608
|
/**
|
|
2308
2609
|
* Invoked when the document toolbar Refresh control is used (before the pane re-renders).
|
|
2309
2610
|
* Use to replay `connectStream`, refetch, etc.
|
|
@@ -2327,20 +2628,349 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2327
2628
|
jsonPayload: string;
|
|
2328
2629
|
}) => void | Promise<void>;
|
|
2329
2630
|
};
|
|
2631
|
+
type PersonaArtifactDisplayMode = "card" | "panel" | "inline";
|
|
2632
|
+
/** Context handed to custom artifact actions. Content fields are best-effort: resolved from live session state or, after a refresh, from the persisted reference-card payload. */
|
|
2633
|
+
type PersonaArtifactActionContext = {
|
|
2634
|
+
artifactId: string | null;
|
|
2635
|
+
title: string;
|
|
2636
|
+
artifactType: string;
|
|
2637
|
+
markdown?: string;
|
|
2638
|
+
file?: PersonaArtifactFileMeta;
|
|
2639
|
+
/** Component artifacts: pretty-printed { component, props } JSON. */
|
|
2640
|
+
jsonPayload?: string;
|
|
2641
|
+
};
|
|
2642
|
+
/**
|
|
2643
|
+
* Context passed to a `features.artifacts.statusLabel` function on every
|
|
2644
|
+
* artifact streaming update, once per visible surface. Treat it as read-only:
|
|
2645
|
+
* the function should be pure and fast (it runs per streaming delta, per
|
|
2646
|
+
* surface).
|
|
2647
|
+
*/
|
|
2648
|
+
type PersonaArtifactStatusLabelContext = {
|
|
2649
|
+
artifactId: string;
|
|
2650
|
+
artifactType: "markdown" | "component";
|
|
2651
|
+
title?: string;
|
|
2652
|
+
/** The default subject, e.g. "document", "component", or a file type label like "HTML file". */
|
|
2653
|
+
typeLabel: string;
|
|
2654
|
+
file?: PersonaArtifactFileMeta;
|
|
2655
|
+
/** Accumulated streamed content length so far (0 for component artifacts). */
|
|
2656
|
+
chars: number;
|
|
2657
|
+
/** Accumulated line count so far (0 for component artifacts). */
|
|
2658
|
+
lines: number;
|
|
2659
|
+
/** Milliseconds since this artifact's first streaming update was seen. */
|
|
2660
|
+
elapsedMs: number;
|
|
2661
|
+
/** Lazy accessor for the accumulated markdown source (empty string for component artifacts). Call only if needed; parsing cost is opt-in. */
|
|
2662
|
+
content: () => string;
|
|
2663
|
+
/** Which surface is asking, so hosts can shorten for cramped spots. */
|
|
2664
|
+
surface: "card" | "inline-chrome" | "status-body";
|
|
2665
|
+
};
|
|
2666
|
+
/** A custom action button rendered in an artifact toolbar/card slot. */
|
|
2667
|
+
type PersonaArtifactCustomAction = {
|
|
2668
|
+
/** Stable id, used for DOM wiring and keyed re-renders. */
|
|
2669
|
+
id: string;
|
|
2670
|
+
/** Accessible label; also the visible text when showLabel is true. */
|
|
2671
|
+
label: string;
|
|
2672
|
+
/** Registry icon name, or a factory returning your own element (e.g. a brand SVG). The factory result is author-owned code, not sanitized wire data. */
|
|
2673
|
+
icon?: IconName | (() => HTMLElement | SVGElement);
|
|
2674
|
+
/** Render icon + text instead of icon-only. Default: false. */
|
|
2675
|
+
showLabel?: boolean;
|
|
2676
|
+
/** Per-artifact gate, evaluated on each render. Omitted = always visible. */
|
|
2677
|
+
visible?: (ctx: PersonaArtifactActionContext) => boolean;
|
|
2678
|
+
/** May be async; rejections are swallowed like built-in action errors. */
|
|
2679
|
+
onClick: (ctx: PersonaArtifactActionContext) => void | Promise<void>;
|
|
2680
|
+
};
|
|
2330
2681
|
type AgentWidgetArtifactsFeature = {
|
|
2331
2682
|
/** When true, Persona shows the artifact pane and handles artifact_* SSE events */
|
|
2332
2683
|
enabled?: boolean;
|
|
2333
2684
|
/** If set, artifact events for other types are ignored */
|
|
2334
2685
|
allowedTypes?: PersonaArtifactKind[];
|
|
2686
|
+
/**
|
|
2687
|
+
* Where artifact bodies render. A single mode applies to all artifacts;
|
|
2688
|
+
* the object form sets a default plus per-type overrides.
|
|
2689
|
+
* Defaults to "panel" (current behavior).
|
|
2690
|
+
*/
|
|
2691
|
+
display?: PersonaArtifactDisplayMode | {
|
|
2692
|
+
default?: PersonaArtifactDisplayMode;
|
|
2693
|
+
byType?: Partial<Record<PersonaArtifactKind, PersonaArtifactDisplayMode>>;
|
|
2694
|
+
};
|
|
2335
2695
|
/** Split / drawer dimensions and launcher widen behavior */
|
|
2336
2696
|
layout?: AgentWidgetArtifactsLayoutConfig;
|
|
2337
2697
|
/**
|
|
2338
|
-
*
|
|
2339
|
-
*
|
|
2698
|
+
* Controls inline preview of previewable file artifacts (HTML/SVG written by
|
|
2699
|
+
* a Claude Managed agent). When a markdown artifact carries `file` metadata,
|
|
2700
|
+
* the pane can render an isolated `<iframe srcdoc>` sandbox instead of a code
|
|
2701
|
+
* block.
|
|
2702
|
+
*/
|
|
2703
|
+
filePreview?: {
|
|
2704
|
+
/** Enable rendered preview for html/svg files. Defaults to enabled. Set false to force source view. */
|
|
2705
|
+
enabled?: boolean;
|
|
2706
|
+
/**
|
|
2707
|
+
* `sandbox` attribute for the preview iframe. Defaults to `"allow-scripts"`.
|
|
2708
|
+
* `allow-same-origin` is stripped (with a console warning) unless
|
|
2709
|
+
* `dangerouslyAllowSameOrigin` is set: the opaque origin is what isolates
|
|
2710
|
+
* the preview from the host page. Embedder-trusted config.
|
|
2711
|
+
*/
|
|
2712
|
+
iframeSandbox?: string;
|
|
2713
|
+
/**
|
|
2714
|
+
* Allows `allow-same-origin` to pass through `iframeSandbox`. Off by
|
|
2715
|
+
* default because it lets agent-written file content run with the host
|
|
2716
|
+
* page's origin (DOM, storage, credentialed requests). Only set this when
|
|
2717
|
+
* every previewed file source is fully trusted.
|
|
2718
|
+
*/
|
|
2719
|
+
dangerouslyAllowSameOrigin?: boolean;
|
|
2720
|
+
/**
|
|
2721
|
+
* Loading treatment for the preview iframe. Default on.
|
|
2722
|
+
*
|
|
2723
|
+
* A sandboxed `iframe srcdoc` (opaque origin, `allow-scripts` only) paints
|
|
2724
|
+
* blank until its content renders — seconds for artifacts that pull CDN
|
|
2725
|
+
* scripts (React/Babel). The default shows a themed "Loading preview…"
|
|
2726
|
+
* overlay over the iframe, dismissed the instant the content signals it has
|
|
2727
|
+
* painted (an injected `postMessage` reporter) or a hard timeout elapses.
|
|
2728
|
+
*
|
|
2729
|
+
* `false` disables the overlay and the injected ready signal entirely (the
|
|
2730
|
+
* srcdoc becomes the raw file source, the prior behavior). An object tunes
|
|
2731
|
+
* the timing; omitted / `true` uses all defaults.
|
|
2732
|
+
*/
|
|
2733
|
+
loading?: boolean | {
|
|
2734
|
+
/** Show the overlay only if the preview is not ready after this many ms. Default 200. */
|
|
2735
|
+
delayMs?: number;
|
|
2736
|
+
/** Once shown, keep the overlay visible at least this long (anti-flicker). Default 300. */
|
|
2737
|
+
minVisibleMs?: number;
|
|
2738
|
+
/** Give up waiting and reveal the iframe regardless after this many ms. Default 8000. */
|
|
2739
|
+
timeoutMs?: number;
|
|
2740
|
+
/**
|
|
2741
|
+
* Append the `postMessage` ready reporter to the srcdoc so the overlay
|
|
2742
|
+
* dismisses on first paint rather than the iframe `load` event (which
|
|
2743
|
+
* fires before post-DOMContentLoaded rendering like Babel compilation).
|
|
2744
|
+
* Default true. When false, the overlay dismisses on `load` + a double
|
|
2745
|
+
* `requestAnimationFrame`, or the timeout.
|
|
2746
|
+
*/
|
|
2747
|
+
injectReadySignal?: boolean;
|
|
2748
|
+
/**
|
|
2749
|
+
* Escalation text shown beside the spinner after `labelDelayMs`.
|
|
2750
|
+
* Default `"Starting preview..."`. `false` renders an icon-only
|
|
2751
|
+
* indicator forever (no text ever). A short work-naming label is
|
|
2752
|
+
* added only after a delay by design — icon-first, with text reserved
|
|
2753
|
+
* for genuinely slow loads (per Geist/Sandpack guidance; HIG warns
|
|
2754
|
+
* against the vague word "loading").
|
|
2755
|
+
*/
|
|
2756
|
+
label?: string | false;
|
|
2757
|
+
/**
|
|
2758
|
+
* Delay before the escalation label fades in, measured from when the
|
|
2759
|
+
* overlay actually becomes visible (i.e. after `delayMs`), not from
|
|
2760
|
+
* iframe creation. Default 2000.
|
|
2761
|
+
*/
|
|
2762
|
+
labelDelayMs?: number;
|
|
2763
|
+
/**
|
|
2764
|
+
* Full replacement for the default indicator (spinner + escalation
|
|
2765
|
+
* label). Called once when the overlay is built; return any element
|
|
2766
|
+
* (a brand mark, skeleton, custom animation) to own the indicator
|
|
2767
|
+
* content entirely (the escalation-label logic is then skipped), or
|
|
2768
|
+
* return `null` to fall back to the default. A thrown error also falls
|
|
2769
|
+
* back. Mirrors `renderInline` / `renderCard`'s null-falls-back
|
|
2770
|
+
* contract. The overlay backdrop, timing, and dismissal stay
|
|
2771
|
+
* widget-owned either way.
|
|
2772
|
+
*/
|
|
2773
|
+
renderIndicator?: (ctx: {
|
|
2774
|
+
artifactId: string;
|
|
2775
|
+
config: AgentWidgetConfig;
|
|
2776
|
+
}) => HTMLElement | null;
|
|
2777
|
+
};
|
|
2778
|
+
};
|
|
2779
|
+
/**
|
|
2780
|
+
* Custom action buttons for the artifact pane toolbar, rendered between the
|
|
2781
|
+
* refresh and expand/close controls in both toolbar presets. Re-read on live
|
|
2782
|
+
* config updates.
|
|
2783
|
+
*/
|
|
2784
|
+
toolbarActions?: PersonaArtifactCustomAction[];
|
|
2785
|
+
/**
|
|
2786
|
+
* Custom action buttons for the artifact reference card, rendered before the
|
|
2787
|
+
* Download button on complete artifacts. Clicks are delegated, so they
|
|
2788
|
+
* survive re-renders and page refresh.
|
|
2789
|
+
*/
|
|
2790
|
+
cardActions?: PersonaArtifactCustomAction[];
|
|
2791
|
+
/**
|
|
2792
|
+
* File chrome (title bar + toolbar) around inline preview blocks
|
|
2793
|
+
* (`display: "inline"`). Default when undefined: chrome on, with the built-in
|
|
2794
|
+
* Copy and Expand controls. Pass `false` to render the bare preview body
|
|
2795
|
+
* (frame → padded body, no chrome bar), or an object to toggle the built-in
|
|
2796
|
+
* controls individually.
|
|
2797
|
+
*
|
|
2798
|
+
* Note: default-on chrome adds a title bar and buttons to every existing
|
|
2799
|
+
* inline host on upgrade; set `inlineChrome: false` to opt out.
|
|
2800
|
+
*/
|
|
2801
|
+
inlineChrome?: boolean | {
|
|
2802
|
+
/** Show the built-in Copy button (complete artifacts only). Default true. */
|
|
2803
|
+
showCopy?: boolean;
|
|
2804
|
+
/** Show the built-in Expand button (opens the pane for this artifact). Default true. */
|
|
2805
|
+
showExpand?: boolean;
|
|
2806
|
+
/**
|
|
2807
|
+
* Show the built-in rendered/source view toggle (complete artifacts
|
|
2808
|
+
* only). Default true. The toggle is availability-gated: it appears only
|
|
2809
|
+
* for file-backed markdown artifacts that have a rendered alternative to
|
|
2810
|
+
* their source (previewable HTML/SVG, or markdown-kind files), and never
|
|
2811
|
+
* when `inlineBody.viewMode: "source"` forces a source-only body. Plain
|
|
2812
|
+
* markdown and component artifacts don't get it (the pane toggle covers
|
|
2813
|
+
* those).
|
|
2814
|
+
*/
|
|
2815
|
+
showViewToggle?: boolean;
|
|
2816
|
+
};
|
|
2817
|
+
/**
|
|
2818
|
+
* Custom action buttons for the inline chrome toolbar, rendered before the
|
|
2819
|
+
* built-in Copy/Expand controls on complete artifacts. Same shape as
|
|
2820
|
+
* `cardActions`; each action's `visible` gate is respected and clicks are
|
|
2821
|
+
* delegated, so they survive re-renders and page refresh.
|
|
2822
|
+
*/
|
|
2823
|
+
inlineActions?: PersonaArtifactCustomAction[];
|
|
2824
|
+
/**
|
|
2825
|
+
* Replace the artifact tab strip entirely (Seam A). Return an element mounted in
|
|
2826
|
+
* place of the built-in `.persona-artifact-list`; the pane still owns the toolbar,
|
|
2827
|
+
* preview body, iframe reuse, and lazy-render gate. Re-invoked when the records or
|
|
2828
|
+
* selection change. Custom bars own their own accessibility; use `createRovingTablist`
|
|
2829
|
+
* to keep keyboard/tablist behavior. When set, the built-in strip (scroll, fade,
|
|
2830
|
+
* tablist) is not rendered.
|
|
2831
|
+
*
|
|
2832
|
+
* Return either a fresh element per call, or the SAME element updated in place.
|
|
2833
|
+
* Returning a stable element preserves internal state across selection changes:
|
|
2834
|
+
* the pane skips remounting an unchanged node, so a roving tablist keeps keyboard
|
|
2835
|
+
* focus on the selected tab (a fresh element per call drops focus and breaks
|
|
2836
|
+
* Arrow-key nav). See the reference bars in `apps/web/src/artifact-demo.ts`.
|
|
2837
|
+
*/
|
|
2838
|
+
renderTabBar?: (ctx: {
|
|
2839
|
+
records: PersonaArtifactRecord[];
|
|
2840
|
+
selectedId: string | null;
|
|
2841
|
+
onSelect: (id: string) => void;
|
|
2842
|
+
}) => HTMLElement;
|
|
2843
|
+
/**
|
|
2844
|
+
* Body layout for inline artifact blocks (`display: "inline"`). Controls how
|
|
2845
|
+
* the block reserves height and behaves while a file/document artifact
|
|
2846
|
+
* streams, so the streaming source no longer grows an unbounded `<pre>` and
|
|
2847
|
+
* then snaps to the completed preview. Affects only the inline block; the
|
|
2848
|
+
* artifact pane is unchanged.
|
|
2849
|
+
*
|
|
2850
|
+
* Defaults (a behavior change from prior versions, which grew with content
|
|
2851
|
+
* during streaming): a fixed 320px streaming source window with tail-follow,
|
|
2852
|
+
* a top edge fade, and an animated streaming→complete swap. Pass
|
|
2853
|
+
* `height: "auto"` to restore the old grow-with-content streaming behavior.
|
|
2854
|
+
*/
|
|
2855
|
+
inlineBody?: {
|
|
2856
|
+
/** What the body shows while streaming. Default `"source"`. */
|
|
2857
|
+
streamingView?: "source" | "status";
|
|
2858
|
+
/**
|
|
2859
|
+
* How the completed body renders. `"rendered"` (default) keeps the current
|
|
2860
|
+
* behavior: file previews in a sandboxed iframe, markdown through the
|
|
2861
|
+
* markdown pipeline. `"source"` always shows the raw syntax-highlighted
|
|
2862
|
+
* source instead — for hosts where the artifact is input to the host system
|
|
2863
|
+
* (a code editor, a query runner) rather than something to preview. Unlike
|
|
2864
|
+
* `filePreview.enabled: false`, this also covers markdown-kind files and
|
|
2865
|
+
* plain markdown artifacts. Component artifacts always render through the
|
|
2866
|
+
* registry.
|
|
2867
|
+
*/
|
|
2868
|
+
viewMode?: "rendered" | "source";
|
|
2869
|
+
/**
|
|
2870
|
+
* Body height per state. A number reserves that many px for the whole body
|
|
2871
|
+
* region (border-box, padding included) with internal scroll — the
|
|
2872
|
+
* zero-layout-shift path; `"auto"` means content-sized. A
|
|
2873
|
+
* scalar applies to both the streaming and complete states; the object form
|
|
2874
|
+
* sets them independently. Default `320` for both states.
|
|
2875
|
+
*
|
|
2876
|
+
* Note: with `"auto"` on the complete state, non-iframe bodies (rendered
|
|
2877
|
+
* markdown, source view, component) are content-sized, but a file-preview
|
|
2878
|
+
* iframe cannot be content-sized without postMessage plumbing, so it falls
|
|
2879
|
+
* back to the CSS-var default (`--persona-artifact-inline-frame-height`,
|
|
2880
|
+
* 320px).
|
|
2881
|
+
*
|
|
2882
|
+
* Numeric heights are applied via the CSS var
|
|
2883
|
+
* `--persona-artifact-inline-body-height` on the block root. The older
|
|
2884
|
+
* `--persona-artifact-inline-frame-height` var still overrides the iframe
|
|
2885
|
+
* height when this one is unset, so themes pinned to it keep working.
|
|
2886
|
+
*/
|
|
2887
|
+
height?: number | "auto" | {
|
|
2888
|
+
streaming?: number | "auto";
|
|
2889
|
+
complete?: number | "auto";
|
|
2890
|
+
};
|
|
2891
|
+
/**
|
|
2892
|
+
* Tail-follow the newest streamed lines in a fixed-height source window: if
|
|
2893
|
+
* the viewport is already at the bottom, keep it pinned as content arrives;
|
|
2894
|
+
* if the reader scrolled up, don't fight them. Only meaningful for a numeric
|
|
2895
|
+
* streaming height. Default `true`.
|
|
2896
|
+
*
|
|
2897
|
+
* Precedence: ignored when `overflow: "clip"` (a clipped window shows the
|
|
2898
|
+
* top of the document and never scrolls, so there is no tail to follow).
|
|
2899
|
+
*/
|
|
2900
|
+
followOutput?: boolean;
|
|
2901
|
+
/**
|
|
2902
|
+
* How a fixed-height source window handles content taller than the window.
|
|
2903
|
+
*
|
|
2904
|
+
* - `"scroll"` (default) — the current behavior: an internally scrollable
|
|
2905
|
+
* window that tail-follows the newest streamed lines (see `followOutput`),
|
|
2906
|
+
* so the reader sees the growing tail of the document.
|
|
2907
|
+
* - `"clip"` — a fixed-height window that shows the TOP of the document,
|
|
2908
|
+
* `overflow: hidden` with no internal scroll and no tail-follow
|
|
2909
|
+
* (`followOutput` is ignored in this mode). When content overflows the
|
|
2910
|
+
* window a bottom edge fade signals there is more below (the top is always
|
|
2911
|
+
* visible, so a top fade never applies); an explicit `fadeMask` still wins
|
|
2912
|
+
* over this clip-mode default. When the inline chrome's Expand control is
|
|
2913
|
+
* enabled the whole body doubles as an expand hitbox (click / Enter / Space
|
|
2914
|
+
* opens the artifact in the pane), matching the industry inline-card
|
|
2915
|
+
* pattern; otherwise the clip is purely visual.
|
|
2916
|
+
*
|
|
2917
|
+
* Only meaningful for a numeric streaming/complete height. Default
|
|
2918
|
+
* `"scroll"`.
|
|
2919
|
+
*/
|
|
2920
|
+
overflow?: "scroll" | "clip";
|
|
2921
|
+
/**
|
|
2922
|
+
* Edge fade masks on the fixed-height streaming window (a top fade signals
|
|
2923
|
+
* clipped content above, a bottom fade signals clipped content below). Each
|
|
2924
|
+
* fade renders only when content is actually clipped on that edge, so with
|
|
2925
|
+
* tail-follow pinned at the bottom the bottom fade stays inert until the
|
|
2926
|
+
* reader scrolls up mid-stream. `true` = `{ top: true, bottom: true }`,
|
|
2927
|
+
* `false` = none. Default `{ top: true, bottom: true }`.
|
|
2928
|
+
*/
|
|
2929
|
+
fadeMask?: boolean | {
|
|
2930
|
+
top?: boolean;
|
|
2931
|
+
bottom?: boolean;
|
|
2932
|
+
};
|
|
2933
|
+
/**
|
|
2934
|
+
* Animate the streaming→complete body swap. `"auto"` uses the View
|
|
2935
|
+
* Transitions API when supported and `prefers-reduced-motion` is off;
|
|
2936
|
+
* `"none"` swaps instantly. Default `"auto"`.
|
|
2937
|
+
*/
|
|
2938
|
+
transition?: "auto" | "none";
|
|
2939
|
+
/**
|
|
2940
|
+
* What the block becomes once the artifact completes.
|
|
2941
|
+
*
|
|
2942
|
+
* - `"inline"` (default) — the streamed body stays inline forever, as
|
|
2943
|
+
* configured by the other `inlineBody` options.
|
|
2944
|
+
* - `"card"` — the block streams inline as configured, then collapses to the
|
|
2945
|
+
* compact artifact reference card once the artifact completes (the Copilot
|
|
2946
|
+
* "chiclet" / Claude side-panel handoff pattern), keeping the thread
|
|
2947
|
+
* scannable. The collapse plays as a short CSS height transition (skipped
|
|
2948
|
+
* under `prefers-reduced-motion`); it does not use the View Transitions
|
|
2949
|
+
* API, so `transition` does not affect it. After the collapse the card's
|
|
2950
|
+
* normal actions apply (click opens the artifact pane). `viewMode`, the
|
|
2951
|
+
* inline rendered/source view toggle, `inlineActions`, and inline copy are
|
|
2952
|
+
* streaming-phase-only in this mode and inert once the block is a card
|
|
2953
|
+
* (there is nothing to toggle or copy on a collapsed card). Blocks that are
|
|
2954
|
+
* already complete when they first render (page-refresh hydration) render
|
|
2955
|
+
* the card directly, with no flash of the inline body and no animation.
|
|
2956
|
+
*
|
|
2957
|
+
* Default `"inline"`.
|
|
2958
|
+
*/
|
|
2959
|
+
completeDisplay?: "inline" | "card";
|
|
2960
|
+
};
|
|
2961
|
+
/**
|
|
2962
|
+
* Called when an artifact action is triggered (open, download, expand).
|
|
2963
|
+
* Return `true` to intercept: the widget then does not change state.
|
|
2964
|
+
* For `expand`, `expanded` is the state the toggle is about to enter and
|
|
2965
|
+
* `artifactId` is the currently selected artifact (or `null` when none).
|
|
2340
2966
|
*/
|
|
2341
2967
|
onArtifactAction?: (action: {
|
|
2342
2968
|
type: 'open' | 'download';
|
|
2343
2969
|
artifactId: string;
|
|
2970
|
+
} | {
|
|
2971
|
+
type: 'expand';
|
|
2972
|
+
artifactId: string | null;
|
|
2973
|
+
expanded: boolean;
|
|
2344
2974
|
}) => boolean | void;
|
|
2345
2975
|
/**
|
|
2346
2976
|
* Custom renderer for artifact reference cards shown in the message thread.
|
|
@@ -2356,6 +2986,72 @@ type AgentWidgetArtifactsFeature = {
|
|
|
2356
2986
|
config: AgentWidgetConfig;
|
|
2357
2987
|
defaultRenderer: () => HTMLElement;
|
|
2358
2988
|
}) => HTMLElement | null;
|
|
2989
|
+
/**
|
|
2990
|
+
* Custom renderer for inline artifact blocks (display: "inline"), mirroring
|
|
2991
|
+
* `renderCard`. Return an element to replace the default inline preview,
|
|
2992
|
+
* or null to use the default.
|
|
2993
|
+
*/
|
|
2994
|
+
renderInline?: (context: {
|
|
2995
|
+
artifact: {
|
|
2996
|
+
artifactId: string;
|
|
2997
|
+
title: string;
|
|
2998
|
+
artifactType: string;
|
|
2999
|
+
status: string;
|
|
3000
|
+
};
|
|
3001
|
+
config: AgentWidgetConfig;
|
|
3002
|
+
defaultRenderer: () => HTMLElement;
|
|
3003
|
+
}) => HTMLElement | null;
|
|
3004
|
+
/**
|
|
3005
|
+
* Text shown while an artifact streams, in place of the default
|
|
3006
|
+
* `Generating <type>...` status. Applies to every streaming surface: the
|
|
3007
|
+
* reference card status line, the inline chrome meta label, and the inline
|
|
3008
|
+
* streaming status body (`inlineBody.streamingView: "status"`).
|
|
3009
|
+
*
|
|
3010
|
+
* - A plain string replaces the default label everywhere (localization or
|
|
3011
|
+
* brand voice).
|
|
3012
|
+
* - A function is called on every artifact update for each visible surface;
|
|
3013
|
+
* it must be pure and fast. Returning a string sets the animated label
|
|
3014
|
+
* only. Returning `{ label, detail }` splits the status into an animated
|
|
3015
|
+
* label (re-applied only when its text changes, so the loading animation
|
|
3016
|
+
* stays stable) and a plain un-animated detail span that may update freely
|
|
3017
|
+
* per delta (live counters).
|
|
3018
|
+
*
|
|
3019
|
+
* Default when unset: the current behavior, `Generating <type>...` with no
|
|
3020
|
+
* detail. If the function throws, the default label is used for that update
|
|
3021
|
+
* (a bad host callback must never break rendering). There is deliberately no
|
|
3022
|
+
* percent progress: streams do not announce total length, so counts and
|
|
3023
|
+
* elapsed time are the only truthful signals.
|
|
3024
|
+
*/
|
|
3025
|
+
statusLabel?: string | ((ctx: PersonaArtifactStatusLabelContext) => string | {
|
|
3026
|
+
label: string;
|
|
3027
|
+
detail?: string;
|
|
3028
|
+
});
|
|
3029
|
+
/**
|
|
3030
|
+
* Animation applied to the artifact card's "Generating …" status text while
|
|
3031
|
+
* the artifact streams. Character-by-character modes (`shimmer`,
|
|
3032
|
+
* `shimmer-color`, `rainbow`) wrap each character in a span with a staggered
|
|
3033
|
+
* `animation-delay`; `pulse` fades the whole status text; `none` disables the
|
|
3034
|
+
* animation. Honors `prefers-reduced-motion`.
|
|
3035
|
+
* @default "shimmer"
|
|
3036
|
+
*/
|
|
3037
|
+
loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
|
|
3038
|
+
/**
|
|
3039
|
+
* Duration of one full animation cycle in milliseconds.
|
|
3040
|
+
* Applies to pulse, shimmer, shimmer-color, and rainbow modes.
|
|
3041
|
+
* @default 2000
|
|
3042
|
+
*/
|
|
3043
|
+
loadingAnimationDuration?: number;
|
|
3044
|
+
/**
|
|
3045
|
+
* Primary color for shimmer-color animation mode.
|
|
3046
|
+
* Defaults to the current text color.
|
|
3047
|
+
*/
|
|
3048
|
+
loadingAnimationColor?: string;
|
|
3049
|
+
/**
|
|
3050
|
+
* Secondary/end color for shimmer-color animation mode.
|
|
3051
|
+
* Creates a gradient sweep between `loadingAnimationColor` and this color.
|
|
3052
|
+
* @default "#3b82f6"
|
|
3053
|
+
*/
|
|
3054
|
+
loadingAnimationSecondaryColor?: string;
|
|
2359
3055
|
};
|
|
2360
3056
|
/**
|
|
2361
3057
|
* How the transcript scrolls while an assistant response streams in.
|
|
@@ -2483,6 +3179,13 @@ type AgentWidgetToolCallDisplayFeature = {
|
|
|
2483
3179
|
* @default false
|
|
2484
3180
|
*/
|
|
2485
3181
|
grouped?: boolean;
|
|
3182
|
+
/**
|
|
3183
|
+
* Controls how a grouped tool sequence is rendered.
|
|
3184
|
+
* - `"stack"`: show the group summary and each child tool row.
|
|
3185
|
+
* - `"summary"`: show one consolidated summary row only.
|
|
3186
|
+
* @default "stack"
|
|
3187
|
+
*/
|
|
3188
|
+
groupedMode?: "stack" | "summary";
|
|
2486
3189
|
/**
|
|
2487
3190
|
* When false, tool call bubbles show only the collapsed summary with no
|
|
2488
3191
|
* expand/collapse toggle. Users see tool awareness without full details.
|
|
@@ -3172,6 +3875,24 @@ type AgentWidgetLauncherConfig = {
|
|
|
3172
3875
|
* @default false
|
|
3173
3876
|
*/
|
|
3174
3877
|
sidebarMode?: boolean;
|
|
3878
|
+
/**
|
|
3879
|
+
* When true, the widget panel renders as a detached card inset within its region,
|
|
3880
|
+
* with rounded corners on all sides and elevation (shadow plus hairline border),
|
|
3881
|
+
* instead of sitting flush against the region edges.
|
|
3882
|
+
*
|
|
3883
|
+
* The gap around the card is themed via `theme.components.panel.inset`. The
|
|
3884
|
+
* background revealed behind it is themed via `theme.components.panel.canvasBackground`
|
|
3885
|
+
* in docked and inline embed modes. In sidebar mode the gap stays click-through, so the
|
|
3886
|
+
* host page shows through it the same way it does in floating mode, and canvasBackground
|
|
3887
|
+
* is a no-op there.
|
|
3888
|
+
*
|
|
3889
|
+
* Applies to sidebar, docked, and inline embed modes. Ignored in mobile fullscreen,
|
|
3890
|
+
* where chrome is already suppressed. Floating mode is unchanged, since it already
|
|
3891
|
+
* renders as a detached card.
|
|
3892
|
+
*
|
|
3893
|
+
* @default false
|
|
3894
|
+
*/
|
|
3895
|
+
detachedPanel?: boolean;
|
|
3175
3896
|
/**
|
|
3176
3897
|
* Width of the sidebar panel when sidebarMode is true.
|
|
3177
3898
|
* @default "420px"
|
|
@@ -5818,6 +6539,21 @@ type AgentWidgetMessage = {
|
|
|
5818
6539
|
*/
|
|
5819
6540
|
stopReason?: StopReasonKind;
|
|
5820
6541
|
};
|
|
6542
|
+
/**
|
|
6543
|
+
* Optional file metadata attached to a markdown artifact that represents a
|
|
6544
|
+
* concrete file written by a Claude Managed agent (e.g. `/mnt/session/outputs/cat.html`).
|
|
6545
|
+
* Additive: the artifact content stays a fenced code block on the wire for
|
|
6546
|
+
* backward compatibility; new widgets use this to recover the raw source and
|
|
6547
|
+
* offer a preview. Mirrors the `file` field on the core `artifact_start` event.
|
|
6548
|
+
*/
|
|
6549
|
+
type PersonaArtifactFileMeta = {
|
|
6550
|
+
/** Full path of the written file (also used as the artifact title). */
|
|
6551
|
+
path: string;
|
|
6552
|
+
/** MIME type of the file (used for download and preview decisions). */
|
|
6553
|
+
mimeType: string;
|
|
6554
|
+
/** Fence language the content was encoded with (html/xml/md/text). */
|
|
6555
|
+
language?: string;
|
|
6556
|
+
};
|
|
5821
6557
|
type PersonaArtifactRecord = {
|
|
5822
6558
|
id: string;
|
|
5823
6559
|
artifactType: PersonaArtifactKind;
|
|
@@ -5826,6 +6562,8 @@ type PersonaArtifactRecord = {
|
|
|
5826
6562
|
markdown?: string;
|
|
5827
6563
|
component?: string;
|
|
5828
6564
|
props?: Record<string, unknown>;
|
|
6565
|
+
/** Present when this markdown artifact is a previewable file (see PersonaArtifactFileMeta). */
|
|
6566
|
+
file?: PersonaArtifactFileMeta;
|
|
5829
6567
|
};
|
|
5830
6568
|
|
|
5831
6569
|
/**
|