@runtypelabs/persona 4.7.0 → 4.9.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/README.md +1 -0
- 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-4ROVJ1gA.d.cts} +85 -3
- package/dist/animations/{types-CSmiKRVa.d.ts → types-4ROVJ1gA.d.ts} +85 -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/chunk-IO5VVUKP.js +3 -0
- package/dist/chunk-IPVK3KOM.js +1 -0
- package/dist/chunk-UPO4GUFC.js +1 -0
- package/dist/codegen.cjs +13 -13
- package/dist/codegen.js +14 -14
- package/dist/context-mentions-7S5KVUTG.js +169 -0
- package/dist/context-mentions-inline-TTCN7ZM2.js +4 -0
- package/dist/context-mentions-inline.cjs +4 -0
- package/dist/context-mentions-inline.d.cts +203 -0
- package/dist/context-mentions-inline.d.ts +203 -0
- package/dist/context-mentions-inline.js +4 -0
- package/dist/context-mentions.cjs +295 -0
- package/dist/context-mentions.d.cts +7025 -0
- package/dist/context-mentions.d.ts +7025 -0
- package/dist/context-mentions.js +295 -0
- package/dist/index.cjs +99 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1507 -182
- package/dist/index.d.ts +1507 -182
- package/dist/index.global.js +88 -56
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +99 -68
- 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.d.cts +17 -0
- package/dist/plugin-kit.d.ts +17 -0
- 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 +18 -17
- package/dist/smart-dom-reader.d.cts +1260 -16
- package/dist/smart-dom-reader.d.ts +1260 -16
- package/dist/smart-dom-reader.js +18 -17
- package/dist/testing.cjs +3 -3
- package/dist/testing.js +3 -3
- package/dist/theme-editor-preview.cjs +260 -58
- package/dist/theme-editor-preview.d.cts +1234 -15
- package/dist/theme-editor-preview.d.ts +1234 -15
- package/dist/theme-editor-preview.js +87 -58
- package/dist/theme-editor.cjs +10 -10
- package/dist/theme-editor.d.cts +1226 -15
- package/dist/theme-editor.d.ts +1226 -15
- package/dist/theme-editor.js +10 -10
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +76 -0
- package/dist/theme-reference.d.ts +76 -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 +16 -5
- package/src/artifacts-session.test.ts +178 -0
- package/src/client.test.ts +255 -1
- package/src/client.ts +157 -60
- 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/composer-parts.ts +3 -12
- package/src/components/context-mention-button.test.ts +70 -0
- package/src/components/context-mention-button.ts +82 -0
- package/src/components/context-mention-chip.ts +134 -0
- package/src/components/context-mention-menu.test.ts +508 -0
- package/src/components/context-mention-menu.ts +0 -0
- package/src/components/message-bubble.test.ts +175 -0
- package/src/components/message-bubble.ts +177 -19
- package/src/components/panel.ts +7 -10
- 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/context-mentions-bundle.test.ts +163 -0
- package/src/context-mentions-entry.ts +185 -0
- package/src/context-mentions-inline-entry.test.ts +136 -0
- package/src/context-mentions-inline-entry.ts +226 -0
- package/src/context-mentions-inline-loader.test.ts +30 -0
- package/src/context-mentions-inline-loader.ts +36 -0
- package/src/context-mentions-inline.ts +15 -0
- package/src/context-mentions-loader.ts +32 -0
- package/src/context-mentions.ts +16 -0
- package/src/defaults.ts +1 -0
- package/src/generated/runtype-openapi-contract.ts +55 -3
- package/src/index-core.ts +46 -1
- package/src/index-global.ts +51 -0
- package/src/index.ts +8 -0
- package/src/markdown-parsers-loader.test.ts +158 -0
- package/src/markdown-parsers-loader.ts +83 -27
- package/src/plugin-kit.test.ts +40 -0
- package/src/plugin-kit.ts +39 -5
- 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/session.mentions.test.ts +175 -0
- package/src/session.test.ts +52 -4
- package/src/session.ts +197 -27
- package/src/smart-dom-reader.test.ts +129 -2
- package/src/smart-dom-reader.ts +127 -1
- package/src/styles/context-mention-menu-css.ts +176 -0
- package/src/styles/widget.css +1002 -152
- package/src/theme-editor/preview.ts +2 -0
- package/src/theme-editor/sections.test.ts +26 -1
- package/src/theme-editor/sections.ts +13 -5
- package/src/theme-reference.ts +2 -2
- package/src/tool-call-display-defaults.test.ts +1 -0
- package/src/types/theme.ts +79 -0
- package/src/types.ts +1041 -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.mention-submit.test.ts +235 -0
- package/src/ui.tool-display.test.ts +51 -0
- package/src/ui.ts +998 -159
- 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/chunk-loader.test.ts +97 -0
- package/src/utils/chunk-loader.ts +88 -0
- package/src/utils/code-highlight.test.ts +186 -0
- package/src/utils/code-highlight.ts +400 -0
- package/src/utils/composer-contenteditable.test.ts +507 -0
- package/src/utils/composer-contenteditable.ts +626 -0
- package/src/utils/composer-document.test.ts +280 -0
- package/src/utils/composer-document.ts +293 -0
- package/src/utils/composer-history.test.ts +35 -7
- package/src/utils/composer-history.ts +30 -20
- package/src/utils/composer-input.ts +159 -0
- package/src/utils/context-mention-controller.test.ts +1215 -0
- package/src/utils/context-mention-controller.ts +1186 -0
- package/src/utils/context-mention-manager.test.ts +422 -0
- package/src/utils/context-mention-manager.ts +410 -0
- package/src/utils/context-mention-orchestrator.test.ts +538 -0
- package/src/utils/context-mention-orchestrator.ts +348 -0
- package/src/utils/icons.ts +2 -0
- package/src/utils/live-region.test.ts +108 -0
- package/src/utils/live-region.ts +94 -0
- package/src/utils/mention-channels.ts +63 -0
- package/src/utils/mention-llm-format.test.ts +91 -0
- package/src/utils/mention-llm-format.ts +79 -0
- package/src/utils/mention-matcher.test.ts +86 -0
- package/src/utils/mention-matcher.ts +221 -0
- package/src/utils/mention-token.ts +72 -0
- package/src/utils/mention-trigger.test.ts +155 -0
- package/src/utils/mention-trigger.ts +156 -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 +76 -4
- package/src/utils/theme.ts +7 -0
- package/src/utils/tokens.ts +118 -11
- 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
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IconNode } from 'lucide';
|
|
2
|
+
import { Marked } from 'marked';
|
|
3
|
+
import DOMPurify from 'dompurify';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Plugin interface for customizing widget components
|
|
@@ -423,6 +425,8 @@ interface ComponentTokenSet {
|
|
|
423
425
|
margin?: TokenReference<'spacing'>;
|
|
424
426
|
shadow?: TokenReference<'shadow'>;
|
|
425
427
|
opacity?: number;
|
|
428
|
+
/** Hover background — used by transparent variants like `button.ghost`. */
|
|
429
|
+
hoverBackground?: TokenReference<'color'>;
|
|
426
430
|
}
|
|
427
431
|
interface ButtonTokens extends ComponentTokenSet {
|
|
428
432
|
primary: ComponentTokenSet;
|
|
@@ -447,6 +451,10 @@ interface PanelTokens extends ComponentTokenSet {
|
|
|
447
451
|
maxWidth: string;
|
|
448
452
|
height: string;
|
|
449
453
|
maxHeight: string;
|
|
454
|
+
/** Gap between the detached panel and its region edges. Only used when detached. */
|
|
455
|
+
inset?: string;
|
|
456
|
+
/** Background of the region revealed behind a detached panel. */
|
|
457
|
+
canvasBackground?: string;
|
|
450
458
|
}
|
|
451
459
|
interface HeaderTokens extends ComponentTokenSet {
|
|
452
460
|
background: TokenReference<'color'>;
|
|
@@ -611,6 +619,14 @@ interface ArtifactToolbarTokens {
|
|
|
611
619
|
iconBorder?: string;
|
|
612
620
|
toggleGroupGap?: string;
|
|
613
621
|
toggleBorderRadius?: string;
|
|
622
|
+
/** Inner padding of the segmented view/source toggle pill. */
|
|
623
|
+
toggleGroupPadding?: string;
|
|
624
|
+
/** Border of the segmented view/source toggle pill (e.g., `none`). */
|
|
625
|
+
toggleGroupBorder?: string;
|
|
626
|
+
/** Corner radius of the segmented view/source toggle pill. */
|
|
627
|
+
toggleGroupBorderRadius?: string;
|
|
628
|
+
/** Background of the segmented view/source toggle pill. */
|
|
629
|
+
toggleGroupBackground?: string;
|
|
614
630
|
copyBackground?: string;
|
|
615
631
|
copyBorder?: string;
|
|
616
632
|
copyColor?: string;
|
|
@@ -642,6 +658,16 @@ interface ArtifactTabTokens {
|
|
|
642
658
|
/** Tab list container padding (CSS shorthand). */
|
|
643
659
|
listPadding?: string;
|
|
644
660
|
}
|
|
661
|
+
/** Artifact reference card (chat thread) chrome. */
|
|
662
|
+
interface ArtifactCardTokens {
|
|
663
|
+
background?: string;
|
|
664
|
+
/** Full border shorthand (e.g. `1px solid #e5e7eb`). */
|
|
665
|
+
border?: string;
|
|
666
|
+
borderRadius?: string;
|
|
667
|
+
hoverBackground?: string;
|
|
668
|
+
/** Border color on hover. */
|
|
669
|
+
hoverBorderColor?: string;
|
|
670
|
+
}
|
|
645
671
|
/** Artifact pane chrome. */
|
|
646
672
|
interface ArtifactPaneTokens {
|
|
647
673
|
/**
|
|
@@ -652,6 +678,54 @@ interface ArtifactPaneTokens {
|
|
|
652
678
|
background?: string;
|
|
653
679
|
toolbarBackground?: string;
|
|
654
680
|
}
|
|
681
|
+
/** Inline artifact block chrome (`display: "inline"` file preview). */
|
|
682
|
+
interface ArtifactInlineTokens {
|
|
683
|
+
/** Background of the inline preview frame. */
|
|
684
|
+
background?: string;
|
|
685
|
+
/** Full border shorthand for the frame (e.g. `1px solid #e5e7eb`). */
|
|
686
|
+
border?: string;
|
|
687
|
+
/** Border radius of the inline preview frame. */
|
|
688
|
+
borderRadius?: string;
|
|
689
|
+
/** Background of the title/toolbar chrome bar. */
|
|
690
|
+
chromeBackground?: string;
|
|
691
|
+
/** Bottom border of the title bar. */
|
|
692
|
+
chromeBorder?: string;
|
|
693
|
+
/** Title text color in the chrome bar (artifact basename). */
|
|
694
|
+
titleColor?: string;
|
|
695
|
+
/** Muted text color for the type label / streaming status. */
|
|
696
|
+
mutedColor?: string;
|
|
697
|
+
/** Preview iframe height inside the inline body. */
|
|
698
|
+
frameHeight?: string;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Syntax-highlighted artifact source view (pane + inline), rendered by
|
|
702
|
+
* `utils/code-highlight.ts`. One Light defaults ship in `widget.css`, with a
|
|
703
|
+
* One Dark override keyed off the widget's resolved color scheme (the
|
|
704
|
+
* `data-persona-color-scheme` root attribute, not the OS preference); set any
|
|
705
|
+
* of these to retheme the tokenizer palette and the line-number gutter.
|
|
706
|
+
*/
|
|
707
|
+
interface CodeTokens {
|
|
708
|
+
/** Keywords, booleans, null (e.g. `const`, `true`). */
|
|
709
|
+
keywordColor?: string;
|
|
710
|
+
/** String and template literals; HTML attribute values. */
|
|
711
|
+
stringColor?: string;
|
|
712
|
+
/** Line and block comments. */
|
|
713
|
+
commentColor?: string;
|
|
714
|
+
/** Numeric literals; CSS hex colors / units. */
|
|
715
|
+
numberColor?: string;
|
|
716
|
+
/** HTML tag brackets + names; doctype. */
|
|
717
|
+
tagColor?: string;
|
|
718
|
+
/** HTML attribute names. */
|
|
719
|
+
attrColor?: string;
|
|
720
|
+
/** CSS property names; JSON object keys. */
|
|
721
|
+
propertyColor?: string;
|
|
722
|
+
/** Line-number gutter digits. */
|
|
723
|
+
lineNumberColor?: string;
|
|
724
|
+
/** Right border of the line-number gutter. */
|
|
725
|
+
gutterBorderColor?: string;
|
|
726
|
+
/** Background of the source-view code sheet (defaults to One Light/Dark editor background). */
|
|
727
|
+
background?: string;
|
|
728
|
+
}
|
|
655
729
|
/** Icon button chrome (used by createIconButton). */
|
|
656
730
|
interface IconButtonTokens {
|
|
657
731
|
background?: string;
|
|
@@ -721,9 +795,13 @@ interface ComponentTokens {
|
|
|
721
795
|
toolbar?: ArtifactToolbarTokens;
|
|
722
796
|
tab?: ArtifactTabTokens;
|
|
723
797
|
pane?: ArtifactPaneTokens;
|
|
798
|
+
card?: ArtifactCardTokens;
|
|
799
|
+
inline?: ArtifactInlineTokens;
|
|
724
800
|
};
|
|
725
801
|
/** Collapsible widget chrome (tool/reasoning/approval bubbles). */
|
|
726
802
|
collapsibleWidget?: CollapsibleWidgetTokens;
|
|
803
|
+
/** Syntax-highlighted artifact source view (tokenizer palette + gutter). */
|
|
804
|
+
code?: CodeTokens;
|
|
727
805
|
}
|
|
728
806
|
interface PaletteExtras {
|
|
729
807
|
transitions?: Record<string, string>;
|
|
@@ -793,6 +871,7 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
793
871
|
totalSteps?: number;
|
|
794
872
|
type: "execution_start";
|
|
795
873
|
}) | ({
|
|
874
|
+
claudeManagedAgentId?: string;
|
|
796
875
|
completedAt?: string;
|
|
797
876
|
durationMs?: number;
|
|
798
877
|
executionId: string;
|
|
@@ -837,6 +916,15 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
837
916
|
completedAt?: string;
|
|
838
917
|
content?: string;
|
|
839
918
|
cost?: number;
|
|
919
|
+
estimatedContextBreakdown?: {
|
|
920
|
+
categories: Record<string, {
|
|
921
|
+
chars: number;
|
|
922
|
+
estimatedTokens: number;
|
|
923
|
+
}>;
|
|
924
|
+
contextWindowSize?: number;
|
|
925
|
+
estimatedTotalTokens: number;
|
|
926
|
+
estimatedUtilizationPercent?: number;
|
|
927
|
+
};
|
|
840
928
|
executionId: string;
|
|
841
929
|
fallback?: {
|
|
842
930
|
attempts: Array<{
|
|
@@ -874,6 +962,7 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
874
962
|
type: "step_start";
|
|
875
963
|
} | ({
|
|
876
964
|
completedAt?: string;
|
|
965
|
+
cost?: number;
|
|
877
966
|
durationMs?: number;
|
|
878
967
|
error?: string;
|
|
879
968
|
executionId: string;
|
|
@@ -979,6 +1068,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
979
1068
|
artifactType: "markdown" | "component";
|
|
980
1069
|
component?: string;
|
|
981
1070
|
executionId?: string;
|
|
1071
|
+
file?: {
|
|
1072
|
+
language?: string;
|
|
1073
|
+
mimeType: string;
|
|
1074
|
+
path: string;
|
|
1075
|
+
};
|
|
982
1076
|
id: string;
|
|
983
1077
|
seq?: number;
|
|
984
1078
|
title?: string;
|
|
@@ -1087,6 +1181,14 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1087
1181
|
awaitReason?: string;
|
|
1088
1182
|
awaitedAt?: string;
|
|
1089
1183
|
crawlId?: string;
|
|
1184
|
+
elicitation?: {
|
|
1185
|
+
message: string;
|
|
1186
|
+
mode: "form" | "url";
|
|
1187
|
+
pauseCount?: number;
|
|
1188
|
+
requestedSchema?: Record<string, unknown>;
|
|
1189
|
+
serverName?: string;
|
|
1190
|
+
url?: string;
|
|
1191
|
+
};
|
|
1090
1192
|
executionId: string;
|
|
1091
1193
|
origin?: "webmcp" | "sdk";
|
|
1092
1194
|
pageOrigin?: string;
|
|
@@ -1186,6 +1288,14 @@ type RuntypeFlowSSEEvent = {
|
|
|
1186
1288
|
awaitReason?: string;
|
|
1187
1289
|
awaitedAt: string;
|
|
1188
1290
|
crawlId?: string;
|
|
1291
|
+
elicitation?: {
|
|
1292
|
+
message: string;
|
|
1293
|
+
mode: "form" | "url";
|
|
1294
|
+
pauseCount?: number;
|
|
1295
|
+
requestedSchema?: Record<string, unknown>;
|
|
1296
|
+
serverName?: string;
|
|
1297
|
+
url?: string;
|
|
1298
|
+
};
|
|
1189
1299
|
executionId?: string;
|
|
1190
1300
|
flowId: string;
|
|
1191
1301
|
origin?: "webmcp" | "sdk";
|
|
@@ -1236,7 +1346,7 @@ type RuntypeFlowSSEEvent = {
|
|
|
1236
1346
|
completedAt?: string;
|
|
1237
1347
|
duration?: number;
|
|
1238
1348
|
durationMs?: number;
|
|
1239
|
-
error?: string;
|
|
1349
|
+
error?: string | null;
|
|
1240
1350
|
executionId?: string;
|
|
1241
1351
|
executionTime?: number;
|
|
1242
1352
|
id?: string;
|
|
@@ -1280,13 +1390,21 @@ type RuntypeFlowSSEEvent = {
|
|
|
1280
1390
|
totalSteps: number;
|
|
1281
1391
|
type: "step_skip";
|
|
1282
1392
|
when: string;
|
|
1283
|
-
} | {
|
|
1393
|
+
} | ({
|
|
1394
|
+
elicitation?: {
|
|
1395
|
+
message: string;
|
|
1396
|
+
mode: "form" | "url";
|
|
1397
|
+
pauseCount?: number;
|
|
1398
|
+
requestedSchema?: Record<string, unknown>;
|
|
1399
|
+
serverName?: string;
|
|
1400
|
+
url?: string;
|
|
1401
|
+
};
|
|
1284
1402
|
executionId?: string;
|
|
1285
1403
|
reason?: string;
|
|
1286
1404
|
seq?: number;
|
|
1287
1405
|
type: "step_await";
|
|
1288
1406
|
[key: string]: unknown;
|
|
1289
|
-
} | ({
|
|
1407
|
+
}) | ({
|
|
1290
1408
|
agentContext?: {
|
|
1291
1409
|
executionId: string;
|
|
1292
1410
|
iteration: number;
|
|
@@ -1490,6 +1608,18 @@ type RuntypeClientChatRequest = {
|
|
|
1490
1608
|
};
|
|
1491
1609
|
type RuntypeClientChatStreamEvent = RuntypeExecutionStreamEvent;
|
|
1492
1610
|
type RuntypeClientResumeRequest = {
|
|
1611
|
+
clientTools?: Array<{
|
|
1612
|
+
description: string;
|
|
1613
|
+
name: string;
|
|
1614
|
+
origin?: "webmcp" | "sdk";
|
|
1615
|
+
pageOrigin?: string;
|
|
1616
|
+
parametersSchema: {
|
|
1617
|
+
type: "object";
|
|
1618
|
+
[key: string]: unknown;
|
|
1619
|
+
};
|
|
1620
|
+
untrustedContentHint?: boolean;
|
|
1621
|
+
}>;
|
|
1622
|
+
clientToolsFingerprint?: string;
|
|
1493
1623
|
executionId: string;
|
|
1494
1624
|
messages?: Array<{
|
|
1495
1625
|
content: string | (Array<{
|
|
@@ -1569,6 +1699,162 @@ type ResolvedTarget = {
|
|
|
1569
1699
|
payload: Record<string, unknown>;
|
|
1570
1700
|
};
|
|
1571
1701
|
|
|
1702
|
+
/**
|
|
1703
|
+
* Curated registry of lucide icons available to `renderLucideIcon`.
|
|
1704
|
+
*
|
|
1705
|
+
* The widget used to do `import * as icons from "lucide"` and look up
|
|
1706
|
+
* icons dynamically by string. That defeated tree-shaking, so the IIFE
|
|
1707
|
+
* (CDN/script-tag) bundle shipped all 1640 lucide icons (~400KB of icon
|
|
1708
|
+
* data) regardless of which we actually used. This explicit registry
|
|
1709
|
+
* lets the bundler drop any icon not listed here.
|
|
1710
|
+
*
|
|
1711
|
+
* Trade-off: `renderLucideIcon(name)` is now a *closed set*. Names not
|
|
1712
|
+
* in this map return `null` and log a warning, exactly as a typo did
|
|
1713
|
+
* before. The registry is intentionally generous (~110 icons) so that
|
|
1714
|
+
* custom `ComponentRenderer` authors rarely hit a missing-icon dead end.
|
|
1715
|
+
*
|
|
1716
|
+
* To add icons: add a named import above and a row in `LUCIDE_ICONS`,
|
|
1717
|
+
* keyed by the lucide kebab-case name (matches their filename and
|
|
1718
|
+
* https://lucide.dev/icons).
|
|
1719
|
+
*
|
|
1720
|
+
* See `packages/widget/docs/icon-registry-shortlist.md` for the full
|
|
1721
|
+
* curation rationale and which icons were considered but excluded.
|
|
1722
|
+
*/
|
|
1723
|
+
declare const LUCIDE_ICONS: {
|
|
1724
|
+
readonly activity: IconNode;
|
|
1725
|
+
readonly "arrow-down": IconNode;
|
|
1726
|
+
readonly "arrow-up": IconNode;
|
|
1727
|
+
readonly "arrow-up-right": IconNode;
|
|
1728
|
+
readonly bot: IconNode;
|
|
1729
|
+
readonly "chevron-down": IconNode;
|
|
1730
|
+
readonly "chevron-up": IconNode;
|
|
1731
|
+
readonly "chevron-right": IconNode;
|
|
1732
|
+
readonly "chevron-left": IconNode;
|
|
1733
|
+
readonly check: IconNode;
|
|
1734
|
+
readonly clipboard: IconNode;
|
|
1735
|
+
readonly "clipboard-copy": IconNode;
|
|
1736
|
+
readonly "code-xml": IconNode;
|
|
1737
|
+
readonly copy: IconNode;
|
|
1738
|
+
readonly file: IconNode;
|
|
1739
|
+
readonly "file-code": IconNode;
|
|
1740
|
+
readonly "file-spreadsheet": IconNode;
|
|
1741
|
+
readonly "file-text": IconNode;
|
|
1742
|
+
readonly "image-plus": IconNode;
|
|
1743
|
+
readonly loader: IconNode;
|
|
1744
|
+
readonly "loader-circle": IconNode;
|
|
1745
|
+
readonly mic: IconNode;
|
|
1746
|
+
readonly paperclip: IconNode;
|
|
1747
|
+
readonly "refresh-cw": IconNode;
|
|
1748
|
+
readonly search: IconNode;
|
|
1749
|
+
readonly send: IconNode;
|
|
1750
|
+
readonly "shield-alert": IconNode;
|
|
1751
|
+
readonly "shield-check": IconNode;
|
|
1752
|
+
readonly "shield-x": IconNode;
|
|
1753
|
+
readonly square: IconNode;
|
|
1754
|
+
readonly "thumbs-down": IconNode;
|
|
1755
|
+
readonly "thumbs-up": IconNode;
|
|
1756
|
+
readonly upload: IconNode;
|
|
1757
|
+
readonly "volume-2": IconNode;
|
|
1758
|
+
readonly x: IconNode;
|
|
1759
|
+
readonly user: IconNode;
|
|
1760
|
+
readonly mail: IconNode;
|
|
1761
|
+
readonly phone: IconNode;
|
|
1762
|
+
readonly calendar: IconNode;
|
|
1763
|
+
readonly clock: IconNode;
|
|
1764
|
+
readonly building: IconNode;
|
|
1765
|
+
readonly "map-pin": IconNode;
|
|
1766
|
+
readonly lock: IconNode;
|
|
1767
|
+
readonly key: IconNode;
|
|
1768
|
+
readonly "credit-card": IconNode;
|
|
1769
|
+
readonly "at-sign": IconNode;
|
|
1770
|
+
readonly hash: IconNode;
|
|
1771
|
+
readonly globe: IconNode;
|
|
1772
|
+
readonly link: IconNode;
|
|
1773
|
+
readonly "circle-check": IconNode;
|
|
1774
|
+
readonly "circle-x": IconNode;
|
|
1775
|
+
readonly "triangle-alert": IconNode;
|
|
1776
|
+
readonly info: IconNode;
|
|
1777
|
+
readonly ban: IconNode;
|
|
1778
|
+
readonly shield: IconNode;
|
|
1779
|
+
readonly "arrow-left": IconNode;
|
|
1780
|
+
readonly "arrow-right": IconNode;
|
|
1781
|
+
readonly "external-link": IconNode;
|
|
1782
|
+
readonly ellipsis: IconNode;
|
|
1783
|
+
readonly "ellipsis-vertical": IconNode;
|
|
1784
|
+
readonly menu: IconNode;
|
|
1785
|
+
readonly house: IconNode;
|
|
1786
|
+
readonly plus: IconNode;
|
|
1787
|
+
readonly minus: IconNode;
|
|
1788
|
+
readonly pencil: IconNode;
|
|
1789
|
+
readonly trash: IconNode;
|
|
1790
|
+
readonly "trash-2": IconNode;
|
|
1791
|
+
readonly save: IconNode;
|
|
1792
|
+
readonly download: IconNode;
|
|
1793
|
+
readonly share: IconNode;
|
|
1794
|
+
readonly funnel: IconNode;
|
|
1795
|
+
readonly settings: IconNode;
|
|
1796
|
+
readonly "rotate-cw": IconNode;
|
|
1797
|
+
readonly maximize: IconNode;
|
|
1798
|
+
readonly minimize: IconNode;
|
|
1799
|
+
readonly "shopping-cart": IconNode;
|
|
1800
|
+
readonly "shopping-bag": IconNode;
|
|
1801
|
+
readonly package: IconNode;
|
|
1802
|
+
readonly truck: IconNode;
|
|
1803
|
+
readonly tag: IconNode;
|
|
1804
|
+
readonly gift: IconNode;
|
|
1805
|
+
readonly receipt: IconNode;
|
|
1806
|
+
readonly wallet: IconNode;
|
|
1807
|
+
readonly store: IconNode;
|
|
1808
|
+
readonly "dollar-sign": IconNode;
|
|
1809
|
+
readonly percent: IconNode;
|
|
1810
|
+
readonly play: IconNode;
|
|
1811
|
+
readonly pause: IconNode;
|
|
1812
|
+
readonly "volume-x": IconNode;
|
|
1813
|
+
readonly camera: IconNode;
|
|
1814
|
+
readonly image: IconNode;
|
|
1815
|
+
readonly film: IconNode;
|
|
1816
|
+
readonly headphones: IconNode;
|
|
1817
|
+
readonly "message-circle": IconNode;
|
|
1818
|
+
readonly "message-square": IconNode;
|
|
1819
|
+
readonly bell: IconNode;
|
|
1820
|
+
readonly heart: IconNode;
|
|
1821
|
+
readonly star: IconNode;
|
|
1822
|
+
readonly eye: IconNode;
|
|
1823
|
+
readonly "eye-off": IconNode;
|
|
1824
|
+
readonly bookmark: IconNode;
|
|
1825
|
+
readonly "calendar-days": IconNode;
|
|
1826
|
+
readonly history: IconNode;
|
|
1827
|
+
readonly timer: IconNode;
|
|
1828
|
+
readonly folder: IconNode;
|
|
1829
|
+
readonly "folder-open": IconNode;
|
|
1830
|
+
readonly files: IconNode;
|
|
1831
|
+
readonly sparkles: IconNode;
|
|
1832
|
+
readonly zap: IconNode;
|
|
1833
|
+
readonly sun: IconNode;
|
|
1834
|
+
readonly moon: IconNode;
|
|
1835
|
+
readonly flag: IconNode;
|
|
1836
|
+
readonly monitor: IconNode;
|
|
1837
|
+
readonly smartphone: IconNode;
|
|
1838
|
+
};
|
|
1839
|
+
/**
|
|
1840
|
+
* Names of lucide icons that ship with the widget. Names not in this
|
|
1841
|
+
* union return `null` from `renderLucideIcon` (with a console warning).
|
|
1842
|
+
*/
|
|
1843
|
+
type IconName = keyof typeof LUCIDE_ICONS;
|
|
1844
|
+
/**
|
|
1845
|
+
* Renders a lucide icon as an inline SVG element. Works inside Shadow
|
|
1846
|
+
* DOM and requires no CSS.
|
|
1847
|
+
*
|
|
1848
|
+
* @param iconName - A lucide kebab-case name from the registry. See
|
|
1849
|
+
* `IconName` for the full list, or `docs/icon-registry-shortlist.md`
|
|
1850
|
+
* for rationale.
|
|
1851
|
+
* @param size - The size in pixels (number) or any CSS length string.
|
|
1852
|
+
* @param color - Stroke color (default: "currentColor").
|
|
1853
|
+
* @param strokeWidth - Stroke width (default: 2).
|
|
1854
|
+
* @returns SVGElement, or null if the name is not in the registry.
|
|
1855
|
+
*/
|
|
1856
|
+
declare const renderLucideIcon: (iconName: IconName | (string & {}), size?: number | string, color?: string, strokeWidth?: number) => SVGElement | null;
|
|
1857
|
+
|
|
1572
1858
|
/**
|
|
1573
1859
|
* Text content part for multi-modal messages
|
|
1574
1860
|
*/
|
|
@@ -1627,6 +1913,446 @@ type AgentWidgetContextProviderContext = {
|
|
|
1627
1913
|
config: AgentWidgetConfig;
|
|
1628
1914
|
};
|
|
1629
1915
|
type AgentWidgetContextProvider = (context: AgentWidgetContextProviderContext) => Record<string, unknown> | void | Promise<Record<string, unknown> | void>;
|
|
1916
|
+
/** A single selectable item in the mention menu (host-provided). */
|
|
1917
|
+
type AgentWidgetContextMentionItem = {
|
|
1918
|
+
/** Stable key within its source. */
|
|
1919
|
+
id: string;
|
|
1920
|
+
/** Shown in the menu and on the chip (e.g. "App.tsx"). */
|
|
1921
|
+
label: string;
|
|
1922
|
+
/** Subtitle line in the menu. */
|
|
1923
|
+
description?: string;
|
|
1924
|
+
/** Lucide icon name. */
|
|
1925
|
+
iconName?: string;
|
|
1926
|
+
/**
|
|
1927
|
+
* Accent color for this item's inline token (`display: "inline"`), any CSS
|
|
1928
|
+
* color. Sets `--persona-mention-token-accent` on the token, tinting its pill
|
|
1929
|
+
* background + icon/label — the per-item/per-type color knob (Slack/Linear
|
|
1930
|
+
* style). Prefer setting the same color across a source's items for a "color
|
|
1931
|
+
* per type" look, or theme by `[data-mention-source]` in CSS instead. Ignored
|
|
1932
|
+
* in chip mode.
|
|
1933
|
+
*/
|
|
1934
|
+
color?: string;
|
|
1935
|
+
/** Group header override; defaults to the source's `label`. */
|
|
1936
|
+
group?: string;
|
|
1937
|
+
/** Optional recency/popularity hint the default matcher boosts on. */
|
|
1938
|
+
recencyScore?: number;
|
|
1939
|
+
/**
|
|
1940
|
+
* SKILLS / SLASH-COMMANDS. When set, this item is a COMMAND (a verb) rather
|
|
1941
|
+
* than a context mention (a noun), so selecting it dispatches a behavior
|
|
1942
|
+
* instead of adding a context chip. Absent for ordinary mentions.
|
|
1943
|
+
*
|
|
1944
|
+
* - `"prompt"`: a prompt macro. `resolve()` returns `insertText` (or
|
|
1945
|
+
* `llmAppend`) which is written into the composer (see `insertMode`);
|
|
1946
|
+
* `submitOnSelect` optionally sends it immediately. No chip.
|
|
1947
|
+
* - `"action"`: a client action. `action()` runs in the browser; no resolve,
|
|
1948
|
+
* no chip, no message sent (e.g. `/clear`, `/theme dark`).
|
|
1949
|
+
* - `"server"`: a server-invoked skill. Routed like a `resolveOn:"submit"`
|
|
1950
|
+
* mention whose `resolve().context` reaches the backend via request
|
|
1951
|
+
* `context.mentions.<sourceId>.<itemId>` (a flow/agent reads it).
|
|
1952
|
+
*/
|
|
1953
|
+
command?: "prompt" | "action" | "server";
|
|
1954
|
+
/**
|
|
1955
|
+
* `command:"action"` handler. Receives the parsed `args` (text after the
|
|
1956
|
+
* command name), plus a small `composer` capability + `config`/`messages`.
|
|
1957
|
+
* Short-circuits the mention flow (no chip, no send). Ignored otherwise.
|
|
1958
|
+
*/
|
|
1959
|
+
action?: (ctx: AgentWidgetContextMentionCommandContext) => void | Promise<void>;
|
|
1960
|
+
/**
|
|
1961
|
+
* `command:"prompt"` insertion mode. `"replace"` (default) swaps the whole
|
|
1962
|
+
* composer value for the resolved text; `"insert-at-caret"` replaces only the
|
|
1963
|
+
* `/token` span, keeping surrounding prose. Ignored otherwise.
|
|
1964
|
+
*/
|
|
1965
|
+
insertMode?: "replace" | "insert-at-caret";
|
|
1966
|
+
/**
|
|
1967
|
+
* When true, a `command:"prompt"` submits the composer immediately after
|
|
1968
|
+
* inserting its text (a one-shot macro). Ignored for other kinds.
|
|
1969
|
+
*/
|
|
1970
|
+
submitOnSelect?: boolean;
|
|
1971
|
+
/**
|
|
1972
|
+
* COMMANDS only. Ghost hint for a free-text argument (e.g. "order id" →
|
|
1973
|
+
* `/lookup ‹order id›` in the menu). Its presence switches the command to
|
|
1974
|
+
* INLINE COMPLETION (Slack-style): selecting it fills `/name ` into the
|
|
1975
|
+
* composer for inline arg entry instead of dispatching on select, and the
|
|
1976
|
+
* command is executed at SUBMIT with the typed args. `command:"server"` items
|
|
1977
|
+
* always use inline completion (their chip had no way to add an argument);
|
|
1978
|
+
* for `"prompt"`/`"action"` items this is opt-in. Ignored for non-commands.
|
|
1979
|
+
*/
|
|
1980
|
+
commandArgsPlaceholder?: string;
|
|
1981
|
+
};
|
|
1982
|
+
/**
|
|
1983
|
+
* Capability object handed to a `command:"action"` handler. The widget exposes
|
|
1984
|
+
* only composer-local operations; broader actions (clear the transcript, change
|
|
1985
|
+
* theme) are wired by the host via closures over its own controller.
|
|
1986
|
+
*/
|
|
1987
|
+
type AgentWidgetContextMentionComposerCapability = {
|
|
1988
|
+
/** Current composer text. */
|
|
1989
|
+
getValue: () => string;
|
|
1990
|
+
/** Replace composer text (fires `input`, moves caret to end, refocuses). */
|
|
1991
|
+
setValue: (value: string) => void;
|
|
1992
|
+
/** Submit the composer (same path as pressing send). */
|
|
1993
|
+
submit: () => void;
|
|
1994
|
+
};
|
|
1995
|
+
/** Context passed to a `command:"action"` handler. */
|
|
1996
|
+
type AgentWidgetContextMentionCommandContext = {
|
|
1997
|
+
/** Text typed after the command name (e.g. `staging` for `/deploy staging`). */
|
|
1998
|
+
args: string;
|
|
1999
|
+
config: AgentWidgetConfig;
|
|
2000
|
+
messages: AgentWidgetMessage[];
|
|
2001
|
+
composer: AgentWidgetContextMentionComposerCapability;
|
|
2002
|
+
};
|
|
2003
|
+
/** Reference stored on a sent message for transcript fidelity + chip rendering. */
|
|
2004
|
+
type AgentWidgetContextMentionRef = {
|
|
2005
|
+
sourceId: string;
|
|
2006
|
+
itemId: string;
|
|
2007
|
+
label: string;
|
|
2008
|
+
iconName?: string;
|
|
2009
|
+
/** Accent color for the inline token (see `AgentWidgetContextMentionItem.color`). */
|
|
2010
|
+
color?: string;
|
|
2011
|
+
};
|
|
2012
|
+
/**
|
|
2013
|
+
* One ordered segment of a sent message's prose, for inline mention rendering
|
|
2014
|
+
* (`contextMentions.display: "inline"`). Text runs and atomic mention tokens
|
|
2015
|
+
* interleave in document order so the sent bubble re-renders `@tokens` in place
|
|
2016
|
+
* and composer history can round-trip them. Display/transcript concern only —
|
|
2017
|
+
* the model still sees resolved bodies via `llmContent`/`contentParts`.
|
|
2018
|
+
*/
|
|
2019
|
+
type AgentWidgetContentSegment = {
|
|
2020
|
+
kind: "text";
|
|
2021
|
+
text: string;
|
|
2022
|
+
} | {
|
|
2023
|
+
kind: "mention";
|
|
2024
|
+
ref: AgentWidgetContextMentionRef;
|
|
2025
|
+
};
|
|
2026
|
+
/**
|
|
2027
|
+
* The payload a source returns from `resolve()` for one selected item.
|
|
2028
|
+
* Lead with `llmAppend` — it is the only channel guaranteed to reach the model
|
|
2029
|
+
* with no backend changes.
|
|
2030
|
+
*/
|
|
2031
|
+
type AgentWidgetContextMentionPayload = {
|
|
2032
|
+
/**
|
|
2033
|
+
* PRIMARY, model-visible channel. Appended to this user message's LLM content
|
|
2034
|
+
* so the model actually sees the context with no backend changes.
|
|
2035
|
+
*/
|
|
2036
|
+
llmAppend?: string;
|
|
2037
|
+
/**
|
|
2038
|
+
* `command:"prompt"` macros only. Text written into the COMPOSER on select
|
|
2039
|
+
* (see `AgentWidgetContextMentionItem.insertMode`) — distinct from the hidden
|
|
2040
|
+
* `llmAppend` context channel. Falls back to `llmAppend` when omitted.
|
|
2041
|
+
*/
|
|
2042
|
+
insertText?: string;
|
|
2043
|
+
/** Extra content parts (e.g. file text / image) via the multi-modal path. */
|
|
2044
|
+
contentParts?: ContentPart[];
|
|
2045
|
+
/**
|
|
2046
|
+
* OPT-IN structured channel. Merged into request `context` under
|
|
2047
|
+
* `mentions.<sourceId>.<itemId>` for flows/agents that read it. NOTE: ambient
|
|
2048
|
+
* `context` is NOT guaranteed to reach the model — use `llmAppend` if you need
|
|
2049
|
+
* the model to see it.
|
|
2050
|
+
*/
|
|
2051
|
+
context?: Record<string, unknown>;
|
|
2052
|
+
};
|
|
2053
|
+
/**
|
|
2054
|
+
* One resolved mention, handed to `contextMentions.llmFormat` to build the
|
|
2055
|
+
* model-visible block. `text` is the source's `llmAppend`; `ref`/`item` carry
|
|
2056
|
+
* the selection identity/metadata for a custom formatter (e.g. a source-specific
|
|
2057
|
+
* wrapper or a path from `item`).
|
|
2058
|
+
*/
|
|
2059
|
+
type AgentWidgetMentionLlmEntry = {
|
|
2060
|
+
/** The mention's display label (from `ref.label`). */
|
|
2061
|
+
label: string;
|
|
2062
|
+
/** The resolved model-visible body (the source's `llmAppend`). */
|
|
2063
|
+
text: string;
|
|
2064
|
+
ref: AgentWidgetContextMentionRef;
|
|
2065
|
+
item: AgentWidgetContextMentionItem;
|
|
2066
|
+
};
|
|
2067
|
+
type AgentWidgetContextMentionSearchContext = {
|
|
2068
|
+
messages: AgentWidgetMessage[];
|
|
2069
|
+
config: AgentWidgetConfig;
|
|
2070
|
+
/** Aborts when the next keystroke supersedes this in-flight search. */
|
|
2071
|
+
signal: AbortSignal;
|
|
2072
|
+
};
|
|
2073
|
+
type AgentWidgetContextMentionResolveContext = AgentWidgetContextMentionSearchContext & {
|
|
2074
|
+
/** Plain-text composer value at resolve time. */
|
|
2075
|
+
composerText: string;
|
|
2076
|
+
/**
|
|
2077
|
+
* For `command` items: the text typed after the command name (e.g.
|
|
2078
|
+
* `"123"` for `/lookup 123`). Empty string for ordinary mentions.
|
|
2079
|
+
*/
|
|
2080
|
+
args: string;
|
|
2081
|
+
};
|
|
2082
|
+
type AgentWidgetContextMentionSource = {
|
|
2083
|
+
id: string;
|
|
2084
|
+
/** Group header shown in the menu. */
|
|
2085
|
+
label: string;
|
|
2086
|
+
/**
|
|
2087
|
+
* Filter items for the current `@query` (empty query → recent/popular).
|
|
2088
|
+
* Implement server-side search for large/remote sets, or return all items and
|
|
2089
|
+
* let the widget rank them with `defaultMentionFilter`
|
|
2090
|
+
* (see `createStaticMentionSource` for the common case).
|
|
2091
|
+
*/
|
|
2092
|
+
search: (query: string, ctx: AgentWidgetContextMentionSearchContext) => AgentWidgetContextMentionItem[] | Promise<AgentWidgetContextMentionItem[]>;
|
|
2093
|
+
/**
|
|
2094
|
+
* Fetch the payload for dispatch. Called once when the user SELECTS the item
|
|
2095
|
+
* (eagerly, cached on the chip, abortable on removal) unless `resolveOn` is
|
|
2096
|
+
* `"submit"`. A throw/abort drops the mention via `onMentionResolveError`.
|
|
2097
|
+
*/
|
|
2098
|
+
resolve: (item: AgentWidgetContextMentionItem, ctx: AgentWidgetContextMentionResolveContext) => AgentWidgetContextMentionPayload | Promise<AgentWidgetContextMentionPayload>;
|
|
2099
|
+
/**
|
|
2100
|
+
* When to call `resolve()`:
|
|
2101
|
+
* - `"select"` (default): eager on pick; parallelizes the fetch with the user
|
|
2102
|
+
* finishing their sentence so submit stays instant.
|
|
2103
|
+
* - `"submit"`: defer to send time, for time-sensitive sources (e.g. current
|
|
2104
|
+
* page state that may change between select and send).
|
|
2105
|
+
* @default "select"
|
|
2106
|
+
*/
|
|
2107
|
+
resolveOn?: "select" | "submit";
|
|
2108
|
+
/**
|
|
2109
|
+
* COMMAND sources only. Resolve a `/name` (the first token of a command line)
|
|
2110
|
+
* to its menu item, for submit-time inline-command dispatch and the menu's
|
|
2111
|
+
* "typing args now" suppression. `createSlashCommandsSource` sets this; plain
|
|
2112
|
+
* `@`-mention sources leave it undefined.
|
|
2113
|
+
*/
|
|
2114
|
+
matchCommand?: (name: string) => AgentWidgetContextMentionItem | undefined;
|
|
2115
|
+
};
|
|
2116
|
+
/** Context passed to the optional `renderMentionMenu` override. */
|
|
2117
|
+
type AgentWidgetContextMentionMenuRenderContext = {
|
|
2118
|
+
/** Current trigger query ("" when freshly opened). */
|
|
2119
|
+
query: string;
|
|
2120
|
+
/** Grouped, ranked, capped results ready to paint. */
|
|
2121
|
+
groups: {
|
|
2122
|
+
source: AgentWidgetContextMentionSource;
|
|
2123
|
+
items: AgentWidgetContextMentionItem[];
|
|
2124
|
+
}[];
|
|
2125
|
+
/** Per-source async state for loading/empty/error rendering, keyed by source id. */
|
|
2126
|
+
status: Record<string, "loading" | "ready" | "empty" | "error">;
|
|
2127
|
+
/** Index into the flat keyboard-traversal order. */
|
|
2128
|
+
activeIndex: number;
|
|
2129
|
+
/** Commit a selection (strips `@query`, adds chip, resolves on select). */
|
|
2130
|
+
select: (item: AgentWidgetContextMentionItem) => void;
|
|
2131
|
+
/** Close the menu, keeping a literal `@`. */
|
|
2132
|
+
close: () => void;
|
|
2133
|
+
};
|
|
2134
|
+
/** Context passed to the optional `renderMentionItem` per-row override. */
|
|
2135
|
+
type AgentWidgetContextMentionItemRenderContext = {
|
|
2136
|
+
/** The item to render. */
|
|
2137
|
+
item: AgentWidgetContextMentionItem;
|
|
2138
|
+
/** The source this item came from (its group). */
|
|
2139
|
+
source: AgentWidgetContextMentionSource;
|
|
2140
|
+
/** Current trigger query, for highlighting matches. */
|
|
2141
|
+
query: string;
|
|
2142
|
+
/** True when this row is the keyboard-highlighted one at render time. */
|
|
2143
|
+
active: boolean;
|
|
2144
|
+
/** Position in the flat keyboard-traversal order. */
|
|
2145
|
+
index: number;
|
|
2146
|
+
};
|
|
2147
|
+
/** Context passed to the optional `renderMentionChip` override. */
|
|
2148
|
+
type AgentWidgetContextMentionChipRenderContext = {
|
|
2149
|
+
ref: AgentWidgetContextMentionRef;
|
|
2150
|
+
/** Resolve-on-select lifecycle for spinner→ready→error UI. */
|
|
2151
|
+
status: "resolving" | "ready" | "error";
|
|
2152
|
+
/**
|
|
2153
|
+
* The resolved payload, once available (select-resolved sources only). Use it
|
|
2154
|
+
* to preview already-fetched content on hover. Undefined while `status` is
|
|
2155
|
+
* `"resolving"`, on `"error"`, and for `resolveOn:"submit"` sources (which
|
|
2156
|
+
* resolve at send time, not while the chip sits in the composer — for those,
|
|
2157
|
+
* `ref.itemId` carries the source key you can re-read on demand, e.g. a CSS
|
|
2158
|
+
* selector for the smart-dom source).
|
|
2159
|
+
*/
|
|
2160
|
+
payload?: AgentWidgetContextMentionPayload;
|
|
2161
|
+
/** Remove the chip; aborts any in-flight resolve. */
|
|
2162
|
+
remove: () => void;
|
|
2163
|
+
};
|
|
2164
|
+
/**
|
|
2165
|
+
* Where a trigger char is allowed to open the menu:
|
|
2166
|
+
* - `"anywhere"` (default): after any whitespace or start (the `@` rule).
|
|
2167
|
+
* - `"line-start"`: only when the char before the trigger is a newline or the
|
|
2168
|
+
* start of input — the natural rule for `/` slash-commands.
|
|
2169
|
+
* - `"input-start"`: only at index 0 of the composer.
|
|
2170
|
+
*/
|
|
2171
|
+
type AgentWidgetMentionTriggerPosition = "anywhere" | "line-start" | "input-start";
|
|
2172
|
+
/**
|
|
2173
|
+
* A SECOND (or Nth) trigger channel sharing the same menu engine — e.g. `/` for
|
|
2174
|
+
* slash-commands alongside `@` for context. The legacy `trigger`/`sources`
|
|
2175
|
+
* fields form the implicit first channel; `triggers[]` adds more. At any caret
|
|
2176
|
+
* at most one channel is active, so all channels drive one menu/controller.
|
|
2177
|
+
*/
|
|
2178
|
+
type AgentWidgetMentionTriggerChannel = {
|
|
2179
|
+
/** Trigger character (e.g. "/"). */
|
|
2180
|
+
trigger: string;
|
|
2181
|
+
/** Sources for this channel (searched only when this trigger is active). */
|
|
2182
|
+
sources: AgentWidgetContextMentionSource[];
|
|
2183
|
+
/** Where the trigger may open. @default "anywhere" */
|
|
2184
|
+
triggerPosition?: AgentWidgetMentionTriggerPosition;
|
|
2185
|
+
/**
|
|
2186
|
+
* Let the query span spaces so a command can take ARGS (`/deploy staging`).
|
|
2187
|
+
* A newline still ends it. Pair with `triggerPosition: "line-start"` for
|
|
2188
|
+
* slash-commands. @default false
|
|
2189
|
+
*/
|
|
2190
|
+
allowSpaces?: boolean;
|
|
2191
|
+
/** Show a composer affordance button for this channel. @default false */
|
|
2192
|
+
showButton?: boolean;
|
|
2193
|
+
/** Icon for this channel's affordance button. */
|
|
2194
|
+
buttonIconName?: string;
|
|
2195
|
+
/** Tooltip / aria-label for this channel's affordance button. */
|
|
2196
|
+
buttonTooltipText?: string;
|
|
2197
|
+
/** Placeholder for this channel's picker search field. */
|
|
2198
|
+
searchPlaceholder?: string;
|
|
2199
|
+
};
|
|
2200
|
+
type AgentWidgetContextMentionConfig = {
|
|
2201
|
+
/** @default false */
|
|
2202
|
+
enabled?: boolean;
|
|
2203
|
+
/**
|
|
2204
|
+
* Show the visible composer affordance button (the discoverable entry point).
|
|
2205
|
+
* Strongly recommended; the bare `@` trigger alone is hard to discover for
|
|
2206
|
+
* non-technical users. @default true
|
|
2207
|
+
*/
|
|
2208
|
+
showButton?: boolean;
|
|
2209
|
+
/**
|
|
2210
|
+
* Icon for the affordance button (any registered Lucide name). Defaults to a
|
|
2211
|
+
* "+" signifier — the consumer-recognized "add context" affordance — rather
|
|
2212
|
+
* than an "@" glyph, which reads as power-user. Use `"at-sign"` on a
|
|
2213
|
+
* developer/power-user surface. @default "plus"
|
|
2214
|
+
*/
|
|
2215
|
+
buttonIconName?: string;
|
|
2216
|
+
/** Tooltip / aria-label for the affordance button. @default "Add context" */
|
|
2217
|
+
buttonTooltipText?: string;
|
|
2218
|
+
/**
|
|
2219
|
+
* Placeholder for the picker's search field, shown when the menu is opened
|
|
2220
|
+
* from the affordance button (a Cursor/Copilot-style picker that inserts no
|
|
2221
|
+
* trigger character). The typed-trigger path keeps its query in the textarea
|
|
2222
|
+
* and never shows this field. @default "Search context…"
|
|
2223
|
+
*/
|
|
2224
|
+
searchPlaceholder?: string;
|
|
2225
|
+
/** Trigger character. @default "@" */
|
|
2226
|
+
trigger?: string;
|
|
2227
|
+
/**
|
|
2228
|
+
* Where the primary `trigger` may open the menu. @default "anywhere"
|
|
2229
|
+
*/
|
|
2230
|
+
triggerPosition?: AgentWidgetMentionTriggerPosition;
|
|
2231
|
+
/**
|
|
2232
|
+
* ADDITIONAL trigger channels sharing this engine — e.g. a `/` slash-command
|
|
2233
|
+
* channel next to `@` context. Each channel has its own trigger char,
|
|
2234
|
+
* sources, and position rule. See `AgentWidgetMentionTriggerChannel`.
|
|
2235
|
+
*/
|
|
2236
|
+
triggers?: AgentWidgetMentionTriggerChannel[];
|
|
2237
|
+
/** Max mentions per message. @default 8 */
|
|
2238
|
+
maxMentions?: number;
|
|
2239
|
+
/** Max items shown per source group before "keep typing to narrow". @default 6 */
|
|
2240
|
+
maxItemsPerGroup?: number;
|
|
2241
|
+
/**
|
|
2242
|
+
* Debounce for ASYNC source search only (ms). Synchronous sources and the
|
|
2243
|
+
* menu's first paint are never debounced. @default 150
|
|
2244
|
+
*/
|
|
2245
|
+
searchDebounceMs?: number;
|
|
2246
|
+
/** Registered mention sources (search + resolve). */
|
|
2247
|
+
sources: AgentWidgetContextMentionSource[];
|
|
2248
|
+
/** Chip icon fallback when a source/item omits one. @default "at-sign" */
|
|
2249
|
+
chipIconName?: string;
|
|
2250
|
+
/**
|
|
2251
|
+
* How each resolved mention's `llmAppend` text is wrapped into a delimited
|
|
2252
|
+
* block before it is prepended to the model-visible message content. Blocks
|
|
2253
|
+
* are joined with a blank line and the typed prose follows last.
|
|
2254
|
+
*
|
|
2255
|
+
* - `"fenced"` (default): a fenced code block with the label in the info
|
|
2256
|
+
* string, e.g. selecting `App.tsx` emits:
|
|
2257
|
+
* ```text
|
|
2258
|
+
* ```App.tsx
|
|
2259
|
+
* <file body>
|
|
2260
|
+
* ```
|
|
2261
|
+
* ```
|
|
2262
|
+
* The fence auto-escalates (four+ backticks) when the body itself contains a
|
|
2263
|
+
* fence, so a body can never terminate its own wrapper.
|
|
2264
|
+
* - `"document"`: Anthropic's long-context document shape, e.g.:
|
|
2265
|
+
* ```text
|
|
2266
|
+
* <document index="1">
|
|
2267
|
+
* <source>App.tsx</source>
|
|
2268
|
+
* <document_content>
|
|
2269
|
+
* <file body>
|
|
2270
|
+
* </document_content>
|
|
2271
|
+
* </document>
|
|
2272
|
+
* ```
|
|
2273
|
+
* Prefer this for prose/document-shaped sources per Anthropic's long-context
|
|
2274
|
+
* guidance (indexed `<document>` blocks improve grounding and citation). A
|
|
2275
|
+
* body containing the literal `</document_content>` closing tag falls back to
|
|
2276
|
+
* the fenced block for that entry to avoid a broken XML boundary.
|
|
2277
|
+
* - function form: fully owns the block for one mention — its return string is
|
|
2278
|
+
* used verbatim (no extra wrapping), joined with the other blocks. `index` is
|
|
2279
|
+
* the 0-based position among the message's mention blocks.
|
|
2280
|
+
*
|
|
2281
|
+
* @default "fenced"
|
|
2282
|
+
*/
|
|
2283
|
+
llmFormat?: "fenced" | "document" | ((entry: AgentWidgetMentionLlmEntry, index: number) => string);
|
|
2284
|
+
/**
|
|
2285
|
+
* How `@` selections appear in the composer and sent user bubble.
|
|
2286
|
+
*
|
|
2287
|
+
* - `"chip"` (default): strip `@query` on select; show a compact pill in the
|
|
2288
|
+
* composer context row; `content` is prose-only.
|
|
2289
|
+
* - `"inline"`: insert an atomic styled token in the sentence (Slack/Linear/
|
|
2290
|
+
* Cursor style), backed by a contenteditable composer. Slash-command channels
|
|
2291
|
+
* (`triggers[]` with `/`) stay inline-text regardless — they already use the
|
|
2292
|
+
* `/name args` model, not chips. `renderMentionChip` is ignored for `@`
|
|
2293
|
+
* mentions in this mode.
|
|
2294
|
+
*
|
|
2295
|
+
* The resolved-context channel (`llmContent`/`contentParts`) is unchanged
|
|
2296
|
+
* across both modes — inline tokens are a display concern.
|
|
2297
|
+
*
|
|
2298
|
+
* @default "chip"
|
|
2299
|
+
*/
|
|
2300
|
+
display?: "chip" | "inline";
|
|
2301
|
+
/**
|
|
2302
|
+
* Fired when a pick is rejected: it duplicates an existing chip in chip display
|
|
2303
|
+
* (`"duplicate"` — inline display allows the same item as multiple tokens, so it
|
|
2304
|
+
* never rejects for this reason), hits `maxMentions` (`"limit"`), or (inline
|
|
2305
|
+
* display) the composer text changed between parse and commit so the token could
|
|
2306
|
+
* not be inserted (`"stale"`).
|
|
2307
|
+
*/
|
|
2308
|
+
onMentionRejected?: (item: AgentWidgetContextMentionItem, reason: "duplicate" | "limit" | "stale") => void;
|
|
2309
|
+
/**
|
|
2310
|
+
* A `resolve()` that throws/aborts: the mention is dropped and the message
|
|
2311
|
+
* still sends. Surface a non-blocking notice here if desired.
|
|
2312
|
+
*/
|
|
2313
|
+
onMentionResolveError?: (item: AgentWidgetContextMentionItem, error: unknown) => void;
|
|
2314
|
+
/**
|
|
2315
|
+
* MID-LEVEL render override for the autocomplete menu. The widget still owns
|
|
2316
|
+
* trigger detection, search, debounce/abort, keyboard nav, and positioning;
|
|
2317
|
+
* you only supply the menu markup and drive selection through `ctx`. Omit to
|
|
2318
|
+
* use the built-in grouped menu. @default built-in
|
|
2319
|
+
*/
|
|
2320
|
+
renderMentionMenu?: (ctx: AgentWidgetContextMentionMenuRenderContext) => HTMLElement;
|
|
2321
|
+
/**
|
|
2322
|
+
* NARROW render override for a single result row's INNER content, keeping the
|
|
2323
|
+
* built-in menu chrome (group headers, loading/empty/error, keyboard nav, the
|
|
2324
|
+
* "keep typing" hint). The widget keeps the `role="option"` wrapper and its
|
|
2325
|
+
* click/hover wiring; you return only the row's contents. For full menu
|
|
2326
|
+
* control use `renderMentionMenu` instead. Highlight is CSS-driven via the
|
|
2327
|
+
* wrapper's `[data-active]` attribute, so this is called once per render, not
|
|
2328
|
+
* on every arrow key. Ignored when `renderMentionMenu` is set. @default built-in
|
|
2329
|
+
*/
|
|
2330
|
+
renderMentionItem?: (ctx: AgentWidgetContextMentionItemRenderContext) => HTMLElement;
|
|
2331
|
+
/**
|
|
2332
|
+
* MID-LEVEL render override for a single context chip. Return your own pill
|
|
2333
|
+
* (must include an accessible remove control wired to `ctx.remove`); reflect
|
|
2334
|
+
* `ctx.status` for resolve-on-select. Omit to use the built-in compact pill.
|
|
2335
|
+
* @default built-in
|
|
2336
|
+
*/
|
|
2337
|
+
renderMentionChip?: (ctx: AgentWidgetContextMentionChipRenderContext) => HTMLElement;
|
|
2338
|
+
/**
|
|
2339
|
+
* INLINE display only (`display: "inline"`). Render override for a single inline
|
|
2340
|
+
* mention TOKEN — the atomic styled node that sits in the sentence, in both the
|
|
2341
|
+
* contenteditable composer and the read-only sent bubble. Return your own
|
|
2342
|
+
* element (e.g. a fully custom colored pill); the composer marks it
|
|
2343
|
+
* `contenteditable="false"` and stamps `data-mention-id` so it stays atomic.
|
|
2344
|
+
* Omit to use the built-in pill (icon + `@label`, tinted by
|
|
2345
|
+
* `--persona-mention-token-accent` / `ref.color`, themeable per source via the
|
|
2346
|
+
* `[data-mention-source]` attribute). Ignored in chip mode.
|
|
2347
|
+
* @default built-in
|
|
2348
|
+
*/
|
|
2349
|
+
renderMentionToken?: (ctx: AgentWidgetContextMentionTokenRenderContext) => HTMLElement;
|
|
2350
|
+
};
|
|
2351
|
+
/** Render context for `renderMentionToken`. `readonly` is true in the sent bubble. */
|
|
2352
|
+
type AgentWidgetContextMentionTokenRenderContext = {
|
|
2353
|
+
ref: AgentWidgetContextMentionRef;
|
|
2354
|
+
readonly: boolean;
|
|
2355
|
+
};
|
|
1630
2356
|
type AgentWidgetRequestPayloadMessage = {
|
|
1631
2357
|
role: AgentWidgetMessageRole;
|
|
1632
2358
|
content: MessageContent;
|
|
@@ -2231,7 +2957,13 @@ type AgentWidgetControllerEventMap = {
|
|
|
2231
2957
|
* new artifact content arrives or the host calls `showArtifacts()` on the widget handle.
|
|
2232
2958
|
*/
|
|
2233
2959
|
type AgentWidgetArtifactsLayoutConfig = {
|
|
2234
|
-
/**
|
|
2960
|
+
/**
|
|
2961
|
+
* Flex gap between chat column and artifact pane.
|
|
2962
|
+
* @default 0 (welded); detached uses the panel inset
|
|
2963
|
+
* @remarks In welded appearances (`panel` / `seamless`) a nonzero gap opens a
|
|
2964
|
+
* visible seam in the single card. It is honored geometrically (resize clamps
|
|
2965
|
+
* and the seam handle account for it) but is usually undesired.
|
|
2966
|
+
*/
|
|
2235
2967
|
splitGap?: string;
|
|
2236
2968
|
/** Artifact column width in split mode. @default 40% */
|
|
2237
2969
|
paneWidth?: string;
|
|
@@ -2262,16 +2994,39 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2262
2994
|
/** Optional max artifact width cap while resizing (`px` only). Layout still bounds by chat min width. */
|
|
2263
2995
|
resizableMaxWidth?: string;
|
|
2264
2996
|
/**
|
|
2265
|
-
* Visual treatment for the artifact column in split
|
|
2266
|
-
* - `'panel'`:
|
|
2267
|
-
*
|
|
2997
|
+
* Visual treatment for the artifact column in a desktop split.
|
|
2998
|
+
* - `'panel'`: one welded card (border + radius wrap chat + pane) with a hairline
|
|
2999
|
+
* divider on the pane's chat-facing edge, zero gap (default).
|
|
3000
|
+
* - `'seamless'`: the same welded card with no internal divider or chrome, zero gap.
|
|
3001
|
+
* - `'detached'`: two separate elevated cards: gap from `--persona-panel-inset`,
|
|
3002
|
+
* all-side border and radius on each, and canvas background behind the split.
|
|
3003
|
+
* In an inline embed this also insets the split from the container edges on all
|
|
3004
|
+
* sides (the page canvas shows through), so the all-side margin no longer requires
|
|
3005
|
+
* `launcher.detachedPanel`.
|
|
3006
|
+
*
|
|
3007
|
+
* Default is `'panel'` unless `launcher.detachedPanel` is true, in which case an unset
|
|
3008
|
+
* `paneAppearance` resolves to `'detached'`. An explicit value always wins.
|
|
2268
3009
|
* @default 'panel'
|
|
2269
3010
|
*/
|
|
2270
|
-
paneAppearance?: "panel" | "seamless";
|
|
3011
|
+
paneAppearance?: "panel" | "seamless" | "detached";
|
|
2271
3012
|
/** Border radius on the artifact pane (CSS length). Works with any `paneAppearance`. */
|
|
2272
3013
|
paneBorderRadius?: string;
|
|
2273
3014
|
/** CSS `box-shadow` on the artifact pane. Set `"none"` to suppress the default shadow. */
|
|
2274
3015
|
paneShadow?: string;
|
|
3016
|
+
/**
|
|
3017
|
+
* CSS `box-shadow` for the chat column card in a detached split. Defaults to the same
|
|
3018
|
+
* elevation as the artifact pane; set to `"none"` to keep the chat flat while the pane stays raised.
|
|
3019
|
+
*/
|
|
3020
|
+
chatShadow?: string;
|
|
3021
|
+
/**
|
|
3022
|
+
* Chat column surface in a detached split. `"card"` (default) renders the chat as an inset card
|
|
3023
|
+
* matching the artifact pane; `"flush"` renders the chat flush with the container (no border, radius,
|
|
3024
|
+
* or shadow) and insets only the artifact pane, so the chat is flat background and the pane floats.
|
|
3025
|
+
* Only affects an inline-embedded detached split (the container-filling case); in floating, docked,
|
|
3026
|
+
* or sidebar modes it falls back to the card look.
|
|
3027
|
+
* @default 'card'
|
|
3028
|
+
*/
|
|
3029
|
+
chatSurface?: "card" | "flush";
|
|
2275
3030
|
/**
|
|
2276
3031
|
* Full `border` shorthand for the artifact `<aside>` (all sides). Overrides default pane borders.
|
|
2277
3032
|
* Example: `"1px solid #cccccc"`.
|
|
@@ -2283,14 +3038,12 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2283
3038
|
*/
|
|
2284
3039
|
paneBorderLeft?: string;
|
|
2285
3040
|
/**
|
|
2286
|
-
*
|
|
2287
|
-
* top-right and bottom-right radii, and round the **artifact pane’s** top-right and bottom-right
|
|
2288
|
-
* to match `persona-rounded-2xl` (`--persona-radius-lg`) so the two columns read as one shell.
|
|
3041
|
+
* @deprecated No-op. Panel and seamless splits now weld into one card by default.
|
|
2289
3042
|
*/
|
|
2290
3043
|
unifiedSplitChrome?: boolean;
|
|
2291
3044
|
/**
|
|
2292
|
-
*
|
|
2293
|
-
* @default matches
|
|
3045
|
+
* Desktop welded split only: override the artifact pane's outer-right corner radius (CSS length).
|
|
3046
|
+
* @default matches the panel radius (`--persona-panel-radius`)
|
|
2294
3047
|
*/
|
|
2295
3048
|
unifiedSplitOuterRadius?: string;
|
|
2296
3049
|
/**
|
|
@@ -2310,6 +3063,10 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2310
3063
|
* @default 'default'
|
|
2311
3064
|
*/
|
|
2312
3065
|
toolbarPreset?: "default" | "document";
|
|
3066
|
+
/** Visible title in the artifact toolbar. @default "Artifacts" */
|
|
3067
|
+
toolbarTitle?: string;
|
|
3068
|
+
/** Label for the artifact dismiss control. @default "Close" */
|
|
3069
|
+
closeButtonLabel?: string;
|
|
2313
3070
|
/**
|
|
2314
3071
|
* When `toolbarPreset` is `document`, show a visible "Copy" label next to the copy icon.
|
|
2315
3072
|
*/
|
|
@@ -2324,6 +3081,17 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2324
3081
|
documentToolbarToggleActiveBackground?: string;
|
|
2325
3082
|
/** Active view/source toggle border color. Sets `--persona-artifact-doc-toggle-active-border`. */
|
|
2326
3083
|
documentToolbarToggleActiveBorderColor?: string;
|
|
3084
|
+
/** 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. */
|
|
3085
|
+
showExpandToggle?: boolean;
|
|
3086
|
+
/** Show the copy control in the `default` toolbar preset (the `document` preset always shows it). Default: false. */
|
|
3087
|
+
showCopyButton?: boolean;
|
|
3088
|
+
/** Edge fade on the scrollable tab strip. true = both ends (dynamic). @default true */
|
|
3089
|
+
tabFade?: boolean | {
|
|
3090
|
+
start?: boolean;
|
|
3091
|
+
end?: boolean;
|
|
3092
|
+
};
|
|
3093
|
+
/** Tab fade width (CSS length). @default 24px */
|
|
3094
|
+
tabFadeSize?: string;
|
|
2327
3095
|
/**
|
|
2328
3096
|
* Invoked when the document toolbar Refresh control is used (before the pane re-renders).
|
|
2329
3097
|
* Use to replay `connectStream`, refetch, etc.
|
|
@@ -2347,35 +3115,430 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2347
3115
|
jsonPayload: string;
|
|
2348
3116
|
}) => void | Promise<void>;
|
|
2349
3117
|
};
|
|
3118
|
+
type PersonaArtifactDisplayMode = "card" | "panel" | "inline";
|
|
3119
|
+
/** 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. */
|
|
3120
|
+
type PersonaArtifactActionContext = {
|
|
3121
|
+
artifactId: string | null;
|
|
3122
|
+
title: string;
|
|
3123
|
+
artifactType: string;
|
|
3124
|
+
markdown?: string;
|
|
3125
|
+
file?: PersonaArtifactFileMeta;
|
|
3126
|
+
/** Component artifacts: pretty-printed { component, props } JSON. */
|
|
3127
|
+
jsonPayload?: string;
|
|
3128
|
+
};
|
|
3129
|
+
/**
|
|
3130
|
+
* Context passed to a `features.artifacts.statusLabel` function on every
|
|
3131
|
+
* artifact streaming update, once per visible surface. Treat it as read-only:
|
|
3132
|
+
* the function should be pure and fast (it runs per streaming delta, per
|
|
3133
|
+
* surface).
|
|
3134
|
+
*/
|
|
3135
|
+
type PersonaArtifactStatusLabelContext = {
|
|
3136
|
+
artifactId: string;
|
|
3137
|
+
artifactType: "markdown" | "component";
|
|
3138
|
+
title?: string;
|
|
3139
|
+
/** The default subject, e.g. "document", "component", or a file type label like "HTML file". */
|
|
3140
|
+
typeLabel: string;
|
|
3141
|
+
file?: PersonaArtifactFileMeta;
|
|
3142
|
+
/** Accumulated streamed content length so far (0 for component artifacts). */
|
|
3143
|
+
chars: number;
|
|
3144
|
+
/** Accumulated line count so far (0 for component artifacts). */
|
|
3145
|
+
lines: number;
|
|
3146
|
+
/** Milliseconds since this artifact's first streaming update was seen. */
|
|
3147
|
+
elapsedMs: number;
|
|
3148
|
+
/** Lazy accessor for the accumulated markdown source (empty string for component artifacts). Call only if needed; parsing cost is opt-in. */
|
|
3149
|
+
content: () => string;
|
|
3150
|
+
/** Which surface is asking, so hosts can shorten for cramped spots. */
|
|
3151
|
+
surface: "card" | "inline-chrome" | "status-body";
|
|
3152
|
+
};
|
|
3153
|
+
/** A custom action button rendered in an artifact toolbar/card slot. */
|
|
3154
|
+
type PersonaArtifactCustomAction = {
|
|
3155
|
+
/** Stable id, used for DOM wiring and keyed re-renders. */
|
|
3156
|
+
id: string;
|
|
3157
|
+
/** Accessible label; also the visible text when showLabel is true. */
|
|
3158
|
+
label: string;
|
|
3159
|
+
/** 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. */
|
|
3160
|
+
icon?: IconName | (() => HTMLElement | SVGElement);
|
|
3161
|
+
/** Render icon + text instead of icon-only. Default: false. */
|
|
3162
|
+
showLabel?: boolean;
|
|
3163
|
+
/** Per-artifact gate, evaluated on each render. Omitted = always visible. */
|
|
3164
|
+
visible?: (ctx: PersonaArtifactActionContext) => boolean;
|
|
3165
|
+
/** May be async; rejections are swallowed like built-in action errors. */
|
|
3166
|
+
onClick: (ctx: PersonaArtifactActionContext) => void | Promise<void>;
|
|
3167
|
+
};
|
|
2350
3168
|
type AgentWidgetArtifactsFeature = {
|
|
2351
3169
|
/** When true, Persona shows the artifact pane and handles artifact_* SSE events */
|
|
2352
3170
|
enabled?: boolean;
|
|
2353
3171
|
/** If set, artifact events for other types are ignored */
|
|
2354
3172
|
allowedTypes?: PersonaArtifactKind[];
|
|
3173
|
+
/**
|
|
3174
|
+
* Where artifact bodies render. A single mode applies to all artifacts;
|
|
3175
|
+
* the object form sets a default plus per-type overrides.
|
|
3176
|
+
* Defaults to "panel" (current behavior).
|
|
3177
|
+
*/
|
|
3178
|
+
display?: PersonaArtifactDisplayMode | {
|
|
3179
|
+
default?: PersonaArtifactDisplayMode;
|
|
3180
|
+
byType?: Partial<Record<PersonaArtifactKind, PersonaArtifactDisplayMode>>;
|
|
3181
|
+
};
|
|
2355
3182
|
/** Split / drawer dimensions and launcher widen behavior */
|
|
2356
3183
|
layout?: AgentWidgetArtifactsLayoutConfig;
|
|
2357
3184
|
/**
|
|
2358
|
-
*
|
|
2359
|
-
*
|
|
3185
|
+
* Controls inline preview of previewable file artifacts (HTML/SVG written by
|
|
3186
|
+
* a Claude Managed agent). When a markdown artifact carries `file` metadata,
|
|
3187
|
+
* the pane can render an isolated `<iframe srcdoc>` sandbox instead of a code
|
|
3188
|
+
* block.
|
|
3189
|
+
*/
|
|
3190
|
+
filePreview?: {
|
|
3191
|
+
/** Enable rendered preview for html/svg files. Defaults to enabled. Set false to force source view. */
|
|
3192
|
+
enabled?: boolean;
|
|
3193
|
+
/**
|
|
3194
|
+
* `sandbox` attribute for the preview iframe. Defaults to `"allow-scripts"`.
|
|
3195
|
+
* `allow-same-origin` is stripped (with a console warning) unless
|
|
3196
|
+
* `dangerouslyAllowSameOrigin` is set: the opaque origin is what isolates
|
|
3197
|
+
* the preview from the host page. Embedder-trusted config.
|
|
3198
|
+
*/
|
|
3199
|
+
iframeSandbox?: string;
|
|
3200
|
+
/**
|
|
3201
|
+
* Allows `allow-same-origin` to pass through `iframeSandbox`. Off by
|
|
3202
|
+
* default because it lets agent-written file content run with the host
|
|
3203
|
+
* page's origin (DOM, storage, credentialed requests). Only set this when
|
|
3204
|
+
* every previewed file source is fully trusted.
|
|
3205
|
+
*/
|
|
3206
|
+
dangerouslyAllowSameOrigin?: boolean;
|
|
3207
|
+
/**
|
|
3208
|
+
* Loading treatment for the preview iframe. Default on.
|
|
3209
|
+
*
|
|
3210
|
+
* A sandboxed `iframe srcdoc` (opaque origin, `allow-scripts` only) paints
|
|
3211
|
+
* blank until its content renders — seconds for artifacts that pull CDN
|
|
3212
|
+
* scripts (React/Babel). The default shows a themed "Loading preview…"
|
|
3213
|
+
* overlay over the iframe, dismissed the instant the content signals it has
|
|
3214
|
+
* painted (an injected `postMessage` reporter) or a hard timeout elapses.
|
|
3215
|
+
*
|
|
3216
|
+
* `false` disables the overlay and the injected ready signal entirely (the
|
|
3217
|
+
* srcdoc becomes the raw file source, the prior behavior). An object tunes
|
|
3218
|
+
* the timing; omitted / `true` uses all defaults.
|
|
3219
|
+
*/
|
|
3220
|
+
loading?: boolean | {
|
|
3221
|
+
/** Show the overlay only if the preview is not ready after this many ms. Default 200. */
|
|
3222
|
+
delayMs?: number;
|
|
3223
|
+
/** Once shown, keep the overlay visible at least this long (anti-flicker). Default 300. */
|
|
3224
|
+
minVisibleMs?: number;
|
|
3225
|
+
/** Give up waiting and reveal the iframe regardless after this many ms. Default 8000. */
|
|
3226
|
+
timeoutMs?: number;
|
|
3227
|
+
/**
|
|
3228
|
+
* Append the `postMessage` ready reporter to the srcdoc so the overlay
|
|
3229
|
+
* dismisses on first paint rather than the iframe `load` event (which
|
|
3230
|
+
* fires before post-DOMContentLoaded rendering like Babel compilation).
|
|
3231
|
+
* Default true. When false, the overlay dismisses on `load` + a double
|
|
3232
|
+
* `requestAnimationFrame`, or the timeout.
|
|
3233
|
+
*/
|
|
3234
|
+
injectReadySignal?: boolean;
|
|
3235
|
+
/**
|
|
3236
|
+
* Escalation text shown beside the spinner after `labelDelayMs`.
|
|
3237
|
+
* Default `"Starting preview..."`. `false` renders an icon-only
|
|
3238
|
+
* indicator forever (no text ever). A short work-naming label is
|
|
3239
|
+
* added only after a delay by design — icon-first, with text reserved
|
|
3240
|
+
* for genuinely slow loads (per Geist/Sandpack guidance; HIG warns
|
|
3241
|
+
* against the vague word "loading").
|
|
3242
|
+
*/
|
|
3243
|
+
label?: string | false;
|
|
3244
|
+
/**
|
|
3245
|
+
* Delay before the escalation label fades in, measured from when the
|
|
3246
|
+
* overlay actually becomes visible (i.e. after `delayMs`), not from
|
|
3247
|
+
* iframe creation. Default 2000.
|
|
3248
|
+
*/
|
|
3249
|
+
labelDelayMs?: number;
|
|
3250
|
+
/**
|
|
3251
|
+
* Full replacement for the default indicator (spinner + escalation
|
|
3252
|
+
* label). Called once when the overlay is built; return any element
|
|
3253
|
+
* (a brand mark, skeleton, custom animation) to own the indicator
|
|
3254
|
+
* content entirely (the escalation-label logic is then skipped), or
|
|
3255
|
+
* return `null` to fall back to the default. A thrown error also falls
|
|
3256
|
+
* back. Mirrors `renderInline` / `renderCard`'s null-falls-back
|
|
3257
|
+
* contract. The overlay backdrop, timing, and dismissal stay
|
|
3258
|
+
* widget-owned either way.
|
|
3259
|
+
*/
|
|
3260
|
+
renderIndicator?: (ctx: {
|
|
3261
|
+
artifactId: string;
|
|
3262
|
+
config: AgentWidgetConfig;
|
|
3263
|
+
}) => HTMLElement | null;
|
|
3264
|
+
};
|
|
3265
|
+
};
|
|
3266
|
+
/**
|
|
3267
|
+
* Custom action buttons for the artifact pane toolbar, rendered between the
|
|
3268
|
+
* refresh and expand/close controls in both toolbar presets. Re-read on live
|
|
3269
|
+
* config updates.
|
|
3270
|
+
*/
|
|
3271
|
+
toolbarActions?: PersonaArtifactCustomAction[];
|
|
3272
|
+
/**
|
|
3273
|
+
* Custom action buttons for the artifact reference card, rendered before the
|
|
3274
|
+
* Download button on complete artifacts. Clicks are delegated, so they
|
|
3275
|
+
* survive re-renders and page refresh.
|
|
3276
|
+
*/
|
|
3277
|
+
cardActions?: PersonaArtifactCustomAction[];
|
|
3278
|
+
/**
|
|
3279
|
+
* File chrome (title bar + toolbar) around inline preview blocks
|
|
3280
|
+
* (`display: "inline"`). Default when undefined: chrome on, with the built-in
|
|
3281
|
+
* Copy and Expand controls. Pass `false` to render the bare preview body
|
|
3282
|
+
* (frame → padded body, no chrome bar), or an object to toggle the built-in
|
|
3283
|
+
* controls individually.
|
|
3284
|
+
*
|
|
3285
|
+
* Note: default-on chrome adds a title bar and buttons to every existing
|
|
3286
|
+
* inline host on upgrade; set `inlineChrome: false` to opt out.
|
|
3287
|
+
*/
|
|
3288
|
+
inlineChrome?: boolean | {
|
|
3289
|
+
/** Show the built-in Copy button (complete artifacts only). Default true. */
|
|
3290
|
+
showCopy?: boolean;
|
|
3291
|
+
/** Show the built-in Expand button (opens the pane for this artifact). Default true. */
|
|
3292
|
+
showExpand?: boolean;
|
|
3293
|
+
/**
|
|
3294
|
+
* Show the built-in rendered/source view toggle (complete artifacts
|
|
3295
|
+
* only). Default true. The toggle is availability-gated: it appears only
|
|
3296
|
+
* for file-backed markdown artifacts that have a rendered alternative to
|
|
3297
|
+
* their source (previewable HTML/SVG, or markdown-kind files), and never
|
|
3298
|
+
* when `inlineBody.viewMode: "source"` forces a source-only body. Plain
|
|
3299
|
+
* markdown and component artifacts don't get it (the pane toggle covers
|
|
3300
|
+
* those).
|
|
3301
|
+
*/
|
|
3302
|
+
showViewToggle?: boolean;
|
|
3303
|
+
};
|
|
3304
|
+
/**
|
|
3305
|
+
* Custom action buttons for the inline chrome toolbar, rendered before the
|
|
3306
|
+
* built-in Copy/Expand controls on complete artifacts. Same shape as
|
|
3307
|
+
* `cardActions`; each action's `visible` gate is respected and clicks are
|
|
3308
|
+
* delegated, so they survive re-renders and page refresh.
|
|
3309
|
+
*/
|
|
3310
|
+
inlineActions?: PersonaArtifactCustomAction[];
|
|
3311
|
+
/**
|
|
3312
|
+
* Replace the artifact tab strip entirely (Seam A). Return an element mounted in
|
|
3313
|
+
* place of the built-in `.persona-artifact-list`; the pane still owns the toolbar,
|
|
3314
|
+
* preview body, iframe reuse, and lazy-render gate. Re-invoked when the records or
|
|
3315
|
+
* selection change. Custom bars own their own accessibility; use `createRovingTablist`
|
|
3316
|
+
* to keep keyboard/tablist behavior. When set, the built-in strip (scroll, fade,
|
|
3317
|
+
* tablist) is not rendered.
|
|
3318
|
+
*
|
|
3319
|
+
* Return either a fresh element per call, or the SAME element updated in place.
|
|
3320
|
+
* Returning a stable element preserves internal state across selection changes:
|
|
3321
|
+
* the pane skips remounting an unchanged node, so a roving tablist keeps keyboard
|
|
3322
|
+
* focus on the selected tab (a fresh element per call drops focus and breaks
|
|
3323
|
+
* Arrow-key nav). See the reference bars in `apps/web/src/artifact-demo.ts`.
|
|
3324
|
+
*/
|
|
3325
|
+
renderTabBar?: (ctx: {
|
|
3326
|
+
records: PersonaArtifactRecord[];
|
|
3327
|
+
selectedId: string | null;
|
|
3328
|
+
onSelect: (id: string) => void;
|
|
3329
|
+
}) => HTMLElement;
|
|
3330
|
+
/**
|
|
3331
|
+
* Body layout for inline artifact blocks (`display: "inline"`). Controls how
|
|
3332
|
+
* the block reserves height and behaves while a file/document artifact
|
|
3333
|
+
* streams, so the streaming source no longer grows an unbounded `<pre>` and
|
|
3334
|
+
* then snaps to the completed preview. Affects only the inline block; the
|
|
3335
|
+
* artifact pane is unchanged.
|
|
3336
|
+
*
|
|
3337
|
+
* Defaults (a behavior change from prior versions, which grew with content
|
|
3338
|
+
* during streaming): a fixed 320px streaming source window with tail-follow,
|
|
3339
|
+
* a top edge fade, and an animated streaming→complete swap. Pass
|
|
3340
|
+
* `height: "auto"` to restore the old grow-with-content streaming behavior.
|
|
3341
|
+
*/
|
|
3342
|
+
inlineBody?: {
|
|
3343
|
+
/** What the body shows while streaming. Default `"source"`. */
|
|
3344
|
+
streamingView?: "source" | "status";
|
|
3345
|
+
/**
|
|
3346
|
+
* How the completed body renders. `"rendered"` (default) keeps the current
|
|
3347
|
+
* behavior: file previews in a sandboxed iframe, markdown through the
|
|
3348
|
+
* markdown pipeline. `"source"` always shows the raw syntax-highlighted
|
|
3349
|
+
* source instead — for hosts where the artifact is input to the host system
|
|
3350
|
+
* (a code editor, a query runner) rather than something to preview. Unlike
|
|
3351
|
+
* `filePreview.enabled: false`, this also covers markdown-kind files and
|
|
3352
|
+
* plain markdown artifacts. Component artifacts always render through the
|
|
3353
|
+
* registry.
|
|
3354
|
+
*/
|
|
3355
|
+
viewMode?: "rendered" | "source";
|
|
3356
|
+
/**
|
|
3357
|
+
* Body height per state. A number reserves that many px for the whole body
|
|
3358
|
+
* region (border-box, padding included) with internal scroll — the
|
|
3359
|
+
* zero-layout-shift path; `"auto"` means content-sized. A
|
|
3360
|
+
* scalar applies to both the streaming and complete states; the object form
|
|
3361
|
+
* sets them independently. Default `320` for both states.
|
|
3362
|
+
*
|
|
3363
|
+
* Note: with `"auto"` on the complete state, non-iframe bodies (rendered
|
|
3364
|
+
* markdown, source view, component) are content-sized, but a file-preview
|
|
3365
|
+
* iframe cannot be content-sized without postMessage plumbing, so it falls
|
|
3366
|
+
* back to the CSS-var default (`--persona-artifact-inline-frame-height`,
|
|
3367
|
+
* 320px).
|
|
3368
|
+
*
|
|
3369
|
+
* Numeric heights are applied via the CSS var
|
|
3370
|
+
* `--persona-artifact-inline-body-height` on the block root. The older
|
|
3371
|
+
* `--persona-artifact-inline-frame-height` var still overrides the iframe
|
|
3372
|
+
* height when this one is unset, so themes pinned to it keep working.
|
|
3373
|
+
*/
|
|
3374
|
+
height?: number | "auto" | {
|
|
3375
|
+
streaming?: number | "auto";
|
|
3376
|
+
complete?: number | "auto";
|
|
3377
|
+
};
|
|
3378
|
+
/**
|
|
3379
|
+
* Tail-follow the newest streamed lines in a fixed-height source window: if
|
|
3380
|
+
* the viewport is already at the bottom, keep it pinned as content arrives;
|
|
3381
|
+
* if the reader scrolled up, don't fight them. Only meaningful for a numeric
|
|
3382
|
+
* streaming height. Default `true`.
|
|
3383
|
+
*
|
|
3384
|
+
* Precedence: ignored when `overflow: "clip"` (a clipped window shows the
|
|
3385
|
+
* top of the document and never scrolls, so there is no tail to follow).
|
|
3386
|
+
*/
|
|
3387
|
+
followOutput?: boolean;
|
|
3388
|
+
/**
|
|
3389
|
+
* How a fixed-height source window handles content taller than the window.
|
|
3390
|
+
*
|
|
3391
|
+
* - `"scroll"` (default) — the current behavior: an internally scrollable
|
|
3392
|
+
* window that tail-follows the newest streamed lines (see `followOutput`),
|
|
3393
|
+
* so the reader sees the growing tail of the document.
|
|
3394
|
+
* - `"clip"` — a fixed-height window that shows the TOP of the document,
|
|
3395
|
+
* `overflow: hidden` with no internal scroll and no tail-follow
|
|
3396
|
+
* (`followOutput` is ignored in this mode). When content overflows the
|
|
3397
|
+
* window a bottom edge fade signals there is more below (the top is always
|
|
3398
|
+
* visible, so a top fade never applies); an explicit `fadeMask` still wins
|
|
3399
|
+
* over this clip-mode default. When the inline chrome's Expand control is
|
|
3400
|
+
* enabled the whole body doubles as an expand hitbox (click / Enter / Space
|
|
3401
|
+
* opens the artifact in the pane), matching the industry inline-card
|
|
3402
|
+
* pattern; otherwise the clip is purely visual.
|
|
3403
|
+
*
|
|
3404
|
+
* Only meaningful for a numeric streaming/complete height. Default
|
|
3405
|
+
* `"scroll"`.
|
|
3406
|
+
*/
|
|
3407
|
+
overflow?: "scroll" | "clip";
|
|
3408
|
+
/**
|
|
3409
|
+
* Edge fade masks on the fixed-height streaming window (a top fade signals
|
|
3410
|
+
* clipped content above, a bottom fade signals clipped content below). Each
|
|
3411
|
+
* fade renders only when content is actually clipped on that edge, so with
|
|
3412
|
+
* tail-follow pinned at the bottom the bottom fade stays inert until the
|
|
3413
|
+
* reader scrolls up mid-stream. `true` = `{ top: true, bottom: true }`,
|
|
3414
|
+
* `false` = none. Default `{ top: true, bottom: true }`.
|
|
3415
|
+
*/
|
|
3416
|
+
fadeMask?: boolean | {
|
|
3417
|
+
top?: boolean;
|
|
3418
|
+
bottom?: boolean;
|
|
3419
|
+
};
|
|
3420
|
+
/**
|
|
3421
|
+
* Animate the streaming→complete body swap. `"auto"` uses the View
|
|
3422
|
+
* Transitions API when supported and `prefers-reduced-motion` is off;
|
|
3423
|
+
* `"none"` swaps instantly. Default `"auto"`.
|
|
3424
|
+
*/
|
|
3425
|
+
transition?: "auto" | "none";
|
|
3426
|
+
/**
|
|
3427
|
+
* What the block becomes once the artifact completes.
|
|
3428
|
+
*
|
|
3429
|
+
* - `"inline"` (default) — the streamed body stays inline forever, as
|
|
3430
|
+
* configured by the other `inlineBody` options.
|
|
3431
|
+
* - `"card"` — the block streams inline as configured, then collapses to the
|
|
3432
|
+
* compact artifact reference card once the artifact completes (the Copilot
|
|
3433
|
+
* "chiclet" / Claude side-panel handoff pattern), keeping the thread
|
|
3434
|
+
* scannable. The collapse plays as a short CSS height transition (skipped
|
|
3435
|
+
* under `prefers-reduced-motion`); it does not use the View Transitions
|
|
3436
|
+
* API, so `transition` does not affect it. After the collapse the card's
|
|
3437
|
+
* normal actions apply (click opens the artifact pane). `viewMode`, the
|
|
3438
|
+
* inline rendered/source view toggle, `inlineActions`, and inline copy are
|
|
3439
|
+
* streaming-phase-only in this mode and inert once the block is a card
|
|
3440
|
+
* (there is nothing to toggle or copy on a collapsed card). Blocks that are
|
|
3441
|
+
* already complete when they first render (page-refresh hydration) render
|
|
3442
|
+
* the card directly, with no flash of the inline body and no animation.
|
|
3443
|
+
*
|
|
3444
|
+
* Default `"inline"`.
|
|
3445
|
+
*/
|
|
3446
|
+
completeDisplay?: "inline" | "card";
|
|
3447
|
+
};
|
|
3448
|
+
/**
|
|
3449
|
+
* Called when an artifact action is triggered (open, download, expand).
|
|
3450
|
+
* Return `true` to intercept: the widget then does not change state.
|
|
3451
|
+
* For `expand`, `expanded` is the state the toggle is about to enter and
|
|
3452
|
+
* `artifactId` is the currently selected artifact (or `null` when none).
|
|
2360
3453
|
*/
|
|
2361
3454
|
onArtifactAction?: (action: {
|
|
2362
3455
|
type: 'open' | 'download';
|
|
2363
3456
|
artifactId: string;
|
|
3457
|
+
} | {
|
|
3458
|
+
type: 'expand';
|
|
3459
|
+
artifactId: string | null;
|
|
3460
|
+
expanded: boolean;
|
|
2364
3461
|
}) => boolean | void;
|
|
2365
3462
|
/**
|
|
2366
3463
|
* Custom renderer for artifact reference cards shown in the message thread.
|
|
2367
3464
|
* Return an HTMLElement to replace the default card, or `null` to use the default.
|
|
2368
3465
|
*/
|
|
2369
|
-
renderCard?: (context: {
|
|
2370
|
-
artifact: {
|
|
2371
|
-
artifactId: string;
|
|
2372
|
-
title: string;
|
|
2373
|
-
artifactType: string;
|
|
2374
|
-
status: string;
|
|
2375
|
-
};
|
|
2376
|
-
config: AgentWidgetConfig;
|
|
2377
|
-
defaultRenderer: () => HTMLElement;
|
|
2378
|
-
}) => HTMLElement | null;
|
|
3466
|
+
renderCard?: (context: {
|
|
3467
|
+
artifact: {
|
|
3468
|
+
artifactId: string;
|
|
3469
|
+
title: string;
|
|
3470
|
+
artifactType: string;
|
|
3471
|
+
status: string;
|
|
3472
|
+
};
|
|
3473
|
+
config: AgentWidgetConfig;
|
|
3474
|
+
defaultRenderer: () => HTMLElement;
|
|
3475
|
+
}) => HTMLElement | null;
|
|
3476
|
+
/**
|
|
3477
|
+
* Custom renderer for inline artifact blocks (display: "inline"), mirroring
|
|
3478
|
+
* `renderCard`. Return an element to replace the default inline preview,
|
|
3479
|
+
* or null to use the default.
|
|
3480
|
+
*/
|
|
3481
|
+
renderInline?: (context: {
|
|
3482
|
+
artifact: {
|
|
3483
|
+
artifactId: string;
|
|
3484
|
+
title: string;
|
|
3485
|
+
artifactType: string;
|
|
3486
|
+
status: string;
|
|
3487
|
+
};
|
|
3488
|
+
config: AgentWidgetConfig;
|
|
3489
|
+
defaultRenderer: () => HTMLElement;
|
|
3490
|
+
}) => HTMLElement | null;
|
|
3491
|
+
/**
|
|
3492
|
+
* Text shown while an artifact streams, in place of the default
|
|
3493
|
+
* `Generating <type>...` status. Applies to every streaming surface: the
|
|
3494
|
+
* reference card status line, the inline chrome meta label, and the inline
|
|
3495
|
+
* streaming status body (`inlineBody.streamingView: "status"`).
|
|
3496
|
+
*
|
|
3497
|
+
* - A plain string replaces the default label everywhere (localization or
|
|
3498
|
+
* brand voice).
|
|
3499
|
+
* - A function is called on every artifact update for each visible surface;
|
|
3500
|
+
* it must be pure and fast. Returning a string sets the animated label
|
|
3501
|
+
* only. Returning `{ label, detail }` splits the status into an animated
|
|
3502
|
+
* label (re-applied only when its text changes, so the loading animation
|
|
3503
|
+
* stays stable) and a plain un-animated detail span that may update freely
|
|
3504
|
+
* per delta (live counters).
|
|
3505
|
+
*
|
|
3506
|
+
* Default when unset: the current behavior, `Generating <type>...` with no
|
|
3507
|
+
* detail. If the function throws, the default label is used for that update
|
|
3508
|
+
* (a bad host callback must never break rendering). There is deliberately no
|
|
3509
|
+
* percent progress: streams do not announce total length, so counts and
|
|
3510
|
+
* elapsed time are the only truthful signals.
|
|
3511
|
+
*/
|
|
3512
|
+
statusLabel?: string | ((ctx: PersonaArtifactStatusLabelContext) => string | {
|
|
3513
|
+
label: string;
|
|
3514
|
+
detail?: string;
|
|
3515
|
+
});
|
|
3516
|
+
/**
|
|
3517
|
+
* Animation applied to the artifact card's "Generating …" status text while
|
|
3518
|
+
* the artifact streams. Character-by-character modes (`shimmer`,
|
|
3519
|
+
* `shimmer-color`, `rainbow`) wrap each character in a span with a staggered
|
|
3520
|
+
* `animation-delay`; `pulse` fades the whole status text; `none` disables the
|
|
3521
|
+
* animation. Honors `prefers-reduced-motion`.
|
|
3522
|
+
* @default "shimmer"
|
|
3523
|
+
*/
|
|
3524
|
+
loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
|
|
3525
|
+
/**
|
|
3526
|
+
* Duration of one full animation cycle in milliseconds.
|
|
3527
|
+
* Applies to pulse, shimmer, shimmer-color, and rainbow modes.
|
|
3528
|
+
* @default 2000
|
|
3529
|
+
*/
|
|
3530
|
+
loadingAnimationDuration?: number;
|
|
3531
|
+
/**
|
|
3532
|
+
* Primary color for shimmer-color animation mode.
|
|
3533
|
+
* Defaults to the current text color.
|
|
3534
|
+
*/
|
|
3535
|
+
loadingAnimationColor?: string;
|
|
3536
|
+
/**
|
|
3537
|
+
* Secondary/end color for shimmer-color animation mode.
|
|
3538
|
+
* Creates a gradient sweep between `loadingAnimationColor` and this color.
|
|
3539
|
+
* @default "#3b82f6"
|
|
3540
|
+
*/
|
|
3541
|
+
loadingAnimationSecondaryColor?: string;
|
|
2379
3542
|
};
|
|
2380
3543
|
/**
|
|
2381
3544
|
* How the transcript scrolls while an assistant response streams in.
|
|
@@ -2503,6 +3666,13 @@ type AgentWidgetToolCallDisplayFeature = {
|
|
|
2503
3666
|
* @default false
|
|
2504
3667
|
*/
|
|
2505
3668
|
grouped?: boolean;
|
|
3669
|
+
/**
|
|
3670
|
+
* Controls how a grouped tool sequence is rendered.
|
|
3671
|
+
* - `"stack"`: show the group summary and each child tool row.
|
|
3672
|
+
* - `"summary"`: show one consolidated summary row only.
|
|
3673
|
+
* @default "stack"
|
|
3674
|
+
*/
|
|
3675
|
+
groupedMode?: "stack" | "summary";
|
|
2506
3676
|
/**
|
|
2507
3677
|
* When false, tool call bubbles show only the collapsed summary with no
|
|
2508
3678
|
* expand/collapse toggle. Users see tool awareness without full details.
|
|
@@ -3192,6 +4362,24 @@ type AgentWidgetLauncherConfig = {
|
|
|
3192
4362
|
* @default false
|
|
3193
4363
|
*/
|
|
3194
4364
|
sidebarMode?: boolean;
|
|
4365
|
+
/**
|
|
4366
|
+
* When true, the widget panel renders as a detached card inset within its region,
|
|
4367
|
+
* with rounded corners on all sides and elevation (shadow plus hairline border),
|
|
4368
|
+
* instead of sitting flush against the region edges.
|
|
4369
|
+
*
|
|
4370
|
+
* The gap around the card is themed via `theme.components.panel.inset`. The
|
|
4371
|
+
* background revealed behind it is themed via `theme.components.panel.canvasBackground`
|
|
4372
|
+
* in docked and inline embed modes. In sidebar mode the gap stays click-through, so the
|
|
4373
|
+
* host page shows through it the same way it does in floating mode, and canvasBackground
|
|
4374
|
+
* is a no-op there.
|
|
4375
|
+
*
|
|
4376
|
+
* Applies to sidebar, docked, and inline embed modes. Ignored in mobile fullscreen,
|
|
4377
|
+
* where chrome is already suppressed. Floating mode is unchanged, since it already
|
|
4378
|
+
* renders as a detached card.
|
|
4379
|
+
*
|
|
4380
|
+
* @default false
|
|
4381
|
+
*/
|
|
4382
|
+
detachedPanel?: boolean;
|
|
3195
4383
|
/**
|
|
3196
4384
|
* Width of the sidebar panel when sidebarMode is true.
|
|
3197
4385
|
* @default "420px"
|
|
@@ -5336,6 +6524,18 @@ type AgentWidgetConfig = {
|
|
|
5336
6524
|
}) => string;
|
|
5337
6525
|
plugins?: AgentWidgetPlugin[];
|
|
5338
6526
|
contextProviders?: AgentWidgetContextProvider[];
|
|
6527
|
+
/**
|
|
6528
|
+
* Context mentions: let users explicitly pull external context into a turn by
|
|
6529
|
+
* typing `@` or clicking a visible composer button, both opening one shared
|
|
6530
|
+
* searchable menu of host-provided sources. Selecting a mention adds a
|
|
6531
|
+
* removable pill chip; resolved content reaches the model via `llmAppend`
|
|
6532
|
+
* (default) or the opt-in structured `context` channel.
|
|
6533
|
+
*
|
|
6534
|
+
* Disabled by default. When enabled, the mention runtime is lazy-loaded from a
|
|
6535
|
+
* sibling chunk on first use, so sites that leave it off pay no bundle cost.
|
|
6536
|
+
* See `docs/context-mentions-plan.md`.
|
|
6537
|
+
*/
|
|
6538
|
+
contextMentions?: AgentWidgetContextMentionConfig;
|
|
5339
6539
|
requestMiddleware?: AgentWidgetRequestMiddleware;
|
|
5340
6540
|
actionParsers?: AgentWidgetActionParser[];
|
|
5341
6541
|
actionHandlers?: AgentWidgetActionHandler[];
|
|
@@ -5878,6 +7078,25 @@ type AgentWidgetMessage = {
|
|
|
5878
7078
|
* The `content` field contains the text-only representation for display.
|
|
5879
7079
|
*/
|
|
5880
7080
|
contentParts?: ContentPart[];
|
|
7081
|
+
/**
|
|
7082
|
+
* Context mentions attached to this (user) message, for transcript fidelity +
|
|
7083
|
+
* chip rendering in the sent bubble. Refs only — the resolved payloads are
|
|
7084
|
+
* merged into `llmContent`/`contentParts` (model-visible) at send time.
|
|
7085
|
+
*/
|
|
7086
|
+
contextMentions?: AgentWidgetContextMentionRef[];
|
|
7087
|
+
/**
|
|
7088
|
+
* Ordered prose + mention blocks for inline-mode rendering and composer history
|
|
7089
|
+
* recall (`contextMentions.display: "inline"`). Present only on inline-mode user
|
|
7090
|
+
* messages; when omitted the sent bubble falls back to the chip row derived from
|
|
7091
|
+
* `contextMentions`. Display/transcript concern only — not the model channel.
|
|
7092
|
+
*/
|
|
7093
|
+
contentSegments?: AgentWidgetContentSegment[];
|
|
7094
|
+
/**
|
|
7095
|
+
* Resolved opt-in structured mention context for this (user) message, merged
|
|
7096
|
+
* into the request `context` under `mentions.<sourceId>.<itemId>` by the
|
|
7097
|
+
* client. Internal: set at send time from each source's `resolve().context`.
|
|
7098
|
+
*/
|
|
7099
|
+
mentionContext?: Record<string, unknown>;
|
|
5881
7100
|
streaming?: boolean;
|
|
5882
7101
|
variant?: AgentWidgetMessageVariant;
|
|
5883
7102
|
sequence?: number;
|
|
@@ -6098,6 +7317,21 @@ type InjectComponentDirectiveOptions = {
|
|
|
6098
7317
|
*/
|
|
6099
7318
|
sequence?: number;
|
|
6100
7319
|
};
|
|
7320
|
+
/**
|
|
7321
|
+
* Optional file metadata attached to a markdown artifact that represents a
|
|
7322
|
+
* concrete file written by a Claude Managed agent (e.g. `/mnt/session/outputs/cat.html`).
|
|
7323
|
+
* Additive: the artifact content stays a fenced code block on the wire for
|
|
7324
|
+
* backward compatibility; new widgets use this to recover the raw source and
|
|
7325
|
+
* offer a preview. Mirrors the `file` field on the core `artifact_start` event.
|
|
7326
|
+
*/
|
|
7327
|
+
type PersonaArtifactFileMeta = {
|
|
7328
|
+
/** Full path of the written file (also used as the artifact title). */
|
|
7329
|
+
path: string;
|
|
7330
|
+
/** MIME type of the file (used for download and preview decisions). */
|
|
7331
|
+
mimeType: string;
|
|
7332
|
+
/** Fence language the content was encoded with (html/xml/md/text). */
|
|
7333
|
+
language?: string;
|
|
7334
|
+
};
|
|
6101
7335
|
type PersonaArtifactRecord = {
|
|
6102
7336
|
id: string;
|
|
6103
7337
|
artifactType: PersonaArtifactKind;
|
|
@@ -6106,6 +7340,8 @@ type PersonaArtifactRecord = {
|
|
|
6106
7340
|
markdown?: string;
|
|
6107
7341
|
component?: string;
|
|
6108
7342
|
props?: Record<string, unknown>;
|
|
7343
|
+
/** Present when this markdown artifact is a previewable file (see PersonaArtifactFileMeta). */
|
|
7344
|
+
file?: PersonaArtifactFileMeta;
|
|
6109
7345
|
};
|
|
6110
7346
|
/** Programmatic artifact upsert (controller / window API) */
|
|
6111
7347
|
type PersonaArtifactManualUpsert = {
|
|
@@ -6113,12 +7349,18 @@ type PersonaArtifactManualUpsert = {
|
|
|
6113
7349
|
artifactType: "markdown";
|
|
6114
7350
|
title?: string;
|
|
6115
7351
|
content: string;
|
|
7352
|
+
/** Optional file metadata for previewable file artifacts. */
|
|
7353
|
+
file?: PersonaArtifactFileMeta;
|
|
7354
|
+
/** Set false to update the registry/pane without a transcript block (pre-4.x behavior). */
|
|
7355
|
+
transcript?: boolean;
|
|
6116
7356
|
} | {
|
|
6117
7357
|
id?: string;
|
|
6118
7358
|
artifactType: "component";
|
|
6119
7359
|
title?: string;
|
|
6120
7360
|
component: string;
|
|
6121
7361
|
props?: Record<string, unknown>;
|
|
7362
|
+
/** Set false to update the registry/pane without a transcript block (pre-4.x behavior). */
|
|
7363
|
+
transcript?: boolean;
|
|
6122
7364
|
};
|
|
6123
7365
|
type AgentWidgetEvent = {
|
|
6124
7366
|
type: "message";
|
|
@@ -6153,6 +7395,8 @@ type AgentWidgetEvent = {
|
|
|
6153
7395
|
artifactType: PersonaArtifactKind;
|
|
6154
7396
|
title?: string;
|
|
6155
7397
|
component?: string;
|
|
7398
|
+
/** Present when this markdown artifact is a previewable file. */
|
|
7399
|
+
file?: PersonaArtifactFileMeta;
|
|
6156
7400
|
} | {
|
|
6157
7401
|
type: "artifact_delta";
|
|
6158
7402
|
id: string;
|
|
@@ -6451,6 +7695,23 @@ declare class AgentWidgetClient {
|
|
|
6451
7695
|
streamResponse?: boolean;
|
|
6452
7696
|
signal?: AbortSignal;
|
|
6453
7697
|
}): Promise<Response>;
|
|
7698
|
+
/**
|
|
7699
|
+
* The opt-in structured mention channel: the MOST RECENT user turn's
|
|
7700
|
+
* `mentionContext` (set by `session.applyMentionBundle`) namespaced under
|
|
7701
|
+
* `mentions`. Only the latest user message is consulted — otherwise an older
|
|
7702
|
+
* turn's mentions would re-attach to `context.mentions` on every later send.
|
|
7703
|
+
* Returns null when the latest user turn carried no structured mention context.
|
|
7704
|
+
* The default model-visible path (`llmAppend`) already rode into the message's
|
|
7705
|
+
* `llmContent`/`contentParts`, so it needs nothing here.
|
|
7706
|
+
*/
|
|
7707
|
+
private latestMentionContext;
|
|
7708
|
+
/**
|
|
7709
|
+
* Aggregate request `context`: merge every context provider's result with the
|
|
7710
|
+
* opt-in mention context from the latest user turn. Returns null when nothing
|
|
7711
|
+
* contributed, so callers can skip setting `payload.context`. Shared by the
|
|
7712
|
+
* agent and flow payload builders.
|
|
7713
|
+
*/
|
|
7714
|
+
private buildContextAggregate;
|
|
6454
7715
|
private buildAgentPayload;
|
|
6455
7716
|
private buildPayload;
|
|
6456
7717
|
/**
|
|
@@ -6461,6 +7722,19 @@ declare class AgentWidgetClient {
|
|
|
6461
7722
|
private streamResponse;
|
|
6462
7723
|
}
|
|
6463
7724
|
|
|
7725
|
+
/** The resolved bundle gathered at submit, merged into the user message. */
|
|
7726
|
+
interface MentionSubmitBundle {
|
|
7727
|
+
/**
|
|
7728
|
+
* Ready-to-join, per-mention LLM blocks (mentions-first). The mention layer
|
|
7729
|
+
* has already applied `contextMentions.llmFormat` (fenced/document/custom), so
|
|
7730
|
+
* the session just joins these with a blank line and appends the typed prose.
|
|
7731
|
+
*/
|
|
7732
|
+
blocks: string[];
|
|
7733
|
+
contentParts: ContentPart[];
|
|
7734
|
+
/** Namespaced `{ [sourceId]: { [itemId]: context } }` for the opt-in path. */
|
|
7735
|
+
context: Record<string, Record<string, unknown>>;
|
|
7736
|
+
}
|
|
7737
|
+
|
|
6464
7738
|
declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
|
|
6465
7739
|
declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
|
|
6466
7740
|
declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
|
|
@@ -6816,10 +8090,36 @@ declare class AgentWidgetSession {
|
|
|
6816
8090
|
* });
|
|
6817
8091
|
*/
|
|
6818
8092
|
injectComponentDirective(options: InjectComponentDirectiveOptions): AgentWidgetMessage;
|
|
8093
|
+
/**
|
|
8094
|
+
* Resolve the gathered mentions and merge them into the user message's
|
|
8095
|
+
* model-visible content. Default path is `llmAppend` → `llmContent` (or a text
|
|
8096
|
+
* `contentPart` when parts are present, since `contentParts` wins the priority
|
|
8097
|
+
* chain); the opt-in structured `context` lands on `mentionContext` for the
|
|
8098
|
+
* client to namespace into the request `context`. Failures were already
|
|
8099
|
+
* dropped by `finalize()`.
|
|
8100
|
+
*/
|
|
8101
|
+
private applyMentionBundle;
|
|
6819
8102
|
sendMessage(rawInput: string, options?: {
|
|
6820
8103
|
viaVoice?: boolean;
|
|
6821
8104
|
/** Multi-modal content parts (e.g., images) to include with the message */
|
|
6822
8105
|
contentParts?: ContentPart[];
|
|
8106
|
+
/**
|
|
8107
|
+
* Context mentions gathered from the composer. `refs` echo immediately as
|
|
8108
|
+
* chips; `finalize()` resolves any pending/submit sources just before
|
|
8109
|
+
* dispatch (after the instant echo) and the bundle is merged into this
|
|
8110
|
+
* message's model-visible content.
|
|
8111
|
+
*/
|
|
8112
|
+
mentions?: {
|
|
8113
|
+
refs: AgentWidgetContextMentionRef[];
|
|
8114
|
+
finalize: () => Promise<MentionSubmitBundle>;
|
|
8115
|
+
};
|
|
8116
|
+
/**
|
|
8117
|
+
* Ordered prose + mention segments for inline-mode display (`display:
|
|
8118
|
+
* "inline"`). Stored on the user message so its bubble re-renders `@tokens`
|
|
8119
|
+
* in place (and suppresses the chip row). Display/transcript only — the
|
|
8120
|
+
* model still sees resolved bodies via the `mentions` bundle above.
|
|
8121
|
+
*/
|
|
8122
|
+
contentSegments?: AgentWidgetContentSegment[];
|
|
6823
8123
|
}): Promise<void>;
|
|
6824
8124
|
/**
|
|
6825
8125
|
* Continue the conversation without adding a new user message.
|
|
@@ -7031,6 +8331,23 @@ declare class AgentWidgetSession {
|
|
|
7031
8331
|
selectArtifact(id: string | null): void;
|
|
7032
8332
|
clearArtifacts(): void;
|
|
7033
8333
|
upsertArtifact(manual: PersonaArtifactManualUpsert): PersonaArtifactRecord;
|
|
8334
|
+
/**
|
|
8335
|
+
* Injects (or refreshes) the in-thread artifact block for a programmatically
|
|
8336
|
+
* upserted artifact, matching the streamed UX: the resolved display mode
|
|
8337
|
+
* picks the component ("card"/"panel" → reference card, "inline" → inline
|
|
8338
|
+
* preview).
|
|
8339
|
+
*
|
|
8340
|
+
* Unlike the streamed path (which embeds content on `artifact_complete`),
|
|
8341
|
+
* the programmatic record is complete up front, so the final markdown /
|
|
8342
|
+
* file meta / component name + props are embedded immediately and the block
|
|
8343
|
+
* hydrates after a refresh without the original registry state.
|
|
8344
|
+
*
|
|
8345
|
+
* A re-upsert of the same id rebuilds the existing block's persisted
|
|
8346
|
+
* rawContent in place (the registry is not persisted, so hydration reads
|
|
8347
|
+
* these props); without this the block would keep the first version's
|
|
8348
|
+
* content after a refresh.
|
|
8349
|
+
*/
|
|
8350
|
+
private injectArtifactRefBlock;
|
|
7034
8351
|
private clearArtifactState;
|
|
7035
8352
|
private emitArtifactsState;
|
|
7036
8353
|
private applyArtifactStreamEvent;
|
|
@@ -7810,6 +9127,32 @@ declare const createDirectivePostprocessor: (markdownConfig?: AgentWidgetMarkdow
|
|
|
7810
9127
|
*/
|
|
7811
9128
|
declare const directivePostprocessor: (text: string) => string;
|
|
7812
9129
|
|
|
9130
|
+
type MarkdownParsersModule = {
|
|
9131
|
+
Marked: typeof Marked;
|
|
9132
|
+
DOMPurify: typeof DOMPurify;
|
|
9133
|
+
};
|
|
9134
|
+
declare const loadMarkdownParsers: () => Promise<MarkdownParsersModule>;
|
|
9135
|
+
/**
|
|
9136
|
+
* Register `cb` to run once the markdown parsers (marked + DOMPurify) become
|
|
9137
|
+
* available, i.e. when the lazy `markdown-parsers.js` chunk resolves on the
|
|
9138
|
+
* IIFE/CDN build. Returns an unsubscribe function.
|
|
9139
|
+
*
|
|
9140
|
+
* This exists so every markdown render surface (chat messages, artifact pane,
|
|
9141
|
+
* and any future one) shares a SINGLE self-heal path instead of each wiring its
|
|
9142
|
+
* own `loadMarkdownParsers().then(reRender)`. Before this, a new surface that
|
|
9143
|
+
* forgot to do that rendered escaped plain text until a user interaction forced
|
|
9144
|
+
* a re-render — the recurring first-render bug (chat messages, then the artifact
|
|
9145
|
+
* pane) this centralizes away.
|
|
9146
|
+
*
|
|
9147
|
+
* If the parsers are ALREADY loaded, `cb` is not scheduled and a no-op
|
|
9148
|
+
* unsubscribe is returned: the caller's first render already used real markdown,
|
|
9149
|
+
* so there is nothing to heal (this is the ESM/CJS build's steady state, and the
|
|
9150
|
+
* CDN build's state after the first chunk load). Registering also kicks the load
|
|
9151
|
+
* so a surface that renders before anything else triggers it still heals.
|
|
9152
|
+
* Fires at most once per subscription.
|
|
9153
|
+
*/
|
|
9154
|
+
declare const onMarkdownParsersReady: (cb: () => void) => (() => void);
|
|
9155
|
+
|
|
7813
9156
|
/**
|
|
7814
9157
|
* A function that sanitizes an HTML string, returning safe HTML.
|
|
7815
9158
|
*/
|
|
@@ -7919,6 +9262,97 @@ declare function validateImageFile(file: File, acceptedTypes?: string[], maxSize
|
|
|
7919
9262
|
error?: string;
|
|
7920
9263
|
};
|
|
7921
9264
|
|
|
9265
|
+
/**
|
|
9266
|
+
* Default fuzzy matcher + static-source helper for context mentions.
|
|
9267
|
+
*
|
|
9268
|
+
* Pure and dependency-free so it can be exported for hosts (to filter
|
|
9269
|
+
* client-side sources) and unit-tested in isolation. Ranking tiers, best first:
|
|
9270
|
+
* 1. prefix — label starts with the query
|
|
9271
|
+
* 2. word-boundary — a word inside the label starts with the query
|
|
9272
|
+
* 3. subsequence — query chars appear in order anywhere in the label
|
|
9273
|
+
* Ties break by `recencyScore` (desc) then label (asc). An empty query returns
|
|
9274
|
+
* every item ordered by recency (recents/popular first).
|
|
9275
|
+
*/
|
|
9276
|
+
|
|
9277
|
+
/**
|
|
9278
|
+
* Filter + rank items for the current `@query`. An empty query keeps all items,
|
|
9279
|
+
* recency-ordered. Non-matching items are dropped.
|
|
9280
|
+
*/
|
|
9281
|
+
declare function defaultMentionFilter(items: AgentWidgetContextMentionItem[], query: string): AgentWidgetContextMentionItem[];
|
|
9282
|
+
/**
|
|
9283
|
+
* The easy path: a static, in-memory list filtered client-side with
|
|
9284
|
+
* {@link defaultMentionFilter}. Supply your own `resolve()` to turn a selected
|
|
9285
|
+
* item into a dispatch payload (lead with `llmAppend`).
|
|
9286
|
+
*/
|
|
9287
|
+
declare function createStaticMentionSource(opts: {
|
|
9288
|
+
id: string;
|
|
9289
|
+
label: string;
|
|
9290
|
+
items: AgentWidgetContextMentionItem[];
|
|
9291
|
+
resolve: AgentWidgetContextMentionSource["resolve"];
|
|
9292
|
+
resolveOn?: "select" | "submit";
|
|
9293
|
+
}): AgentWidgetContextMentionSource;
|
|
9294
|
+
/**
|
|
9295
|
+
* A single slash-command definition for {@link createSlashCommandsSource}. Maps
|
|
9296
|
+
* to a menu item plus its dispatch behavior (see `AgentWidgetContextMentionItem.command`):
|
|
9297
|
+
* - `"prompt"` (default): `prompt` text is written into the composer (a macro).
|
|
9298
|
+
* - `"action"`: `action()` runs in the browser (no message sent).
|
|
9299
|
+
* - `"server"`: `data` is sent to the backend via request `context.mentions`.
|
|
9300
|
+
*/
|
|
9301
|
+
type SlashCommandDefinition = {
|
|
9302
|
+
/** Command name shown after the trigger (e.g. "summarize" → `/summarize`). */
|
|
9303
|
+
name: string;
|
|
9304
|
+
/** Menu subtitle. */
|
|
9305
|
+
description?: string;
|
|
9306
|
+
/** Lucide icon name for the menu row / chip. */
|
|
9307
|
+
iconName?: string;
|
|
9308
|
+
/** Dispatch kind. @default "prompt" */
|
|
9309
|
+
kind?: "prompt" | "action" | "server";
|
|
9310
|
+
/** `kind:"prompt"` — composer text (static, or built from the typed args). */
|
|
9311
|
+
prompt?: string | ((args: string) => string);
|
|
9312
|
+
/** `kind:"prompt"` — insertion mode. @default "replace" */
|
|
9313
|
+
insertMode?: "replace" | "insert-at-caret";
|
|
9314
|
+
/** `kind:"prompt"` — submit the composer immediately after inserting. */
|
|
9315
|
+
submitOnSelect?: boolean;
|
|
9316
|
+
/**
|
|
9317
|
+
* Free-text argument hint (e.g. "order id"). Shown as ghost text in the menu
|
|
9318
|
+
* row (`lookup ‹order id›`) and switches the command to INLINE COMPLETION:
|
|
9319
|
+
* selecting it fills `/name ` into the composer so you type the arg inline,
|
|
9320
|
+
* and the command runs at SUBMIT with the typed args (Slack-style). Optional
|
|
9321
|
+
* for `"prompt"`/`"action"`; `"server"` commands always complete inline.
|
|
9322
|
+
*/
|
|
9323
|
+
argsPlaceholder?: string;
|
|
9324
|
+
/** `kind:"action"` — the browser handler (receives parsed `args`). */
|
|
9325
|
+
action?: (ctx: AgentWidgetContextMentionCommandContext) => void | Promise<void>;
|
|
9326
|
+
/** `kind:"server"` — structured payload sent via `context.mentions.<sourceId>.<name>`. */
|
|
9327
|
+
data?: Record<string, unknown> | ((args: string) => Record<string, unknown>);
|
|
9328
|
+
};
|
|
9329
|
+
/**
|
|
9330
|
+
* Build a `/`-slash-command SOURCE for `contextMentions.triggers`. Unlike a
|
|
9331
|
+
* mention source, its items are COMMANDS (verbs): selecting one runs a prompt
|
|
9332
|
+
* macro, a client action, or a server skill (see {@link SlashCommandDefinition}).
|
|
9333
|
+
*
|
|
9334
|
+
* Matching is on the command NAME only (the first token of the query), so
|
|
9335
|
+
* `/deploy staging` still matches the `deploy` command while `staging` becomes
|
|
9336
|
+
* the command's `args`. Pair it with a `"/"` channel, typically at line-start:
|
|
9337
|
+
*
|
|
9338
|
+
* ```ts
|
|
9339
|
+
* contextMentions: {
|
|
9340
|
+
* enabled: true,
|
|
9341
|
+
* sources: [ ...mentionSources ], // @ context
|
|
9342
|
+
* triggers: [{
|
|
9343
|
+
* trigger: "/",
|
|
9344
|
+
* triggerPosition: "line-start",
|
|
9345
|
+
* sources: [createSlashCommandsSource({ id: "cmd", label: "Commands", commands })],
|
|
9346
|
+
* }],
|
|
9347
|
+
* }
|
|
9348
|
+
* ```
|
|
9349
|
+
*/
|
|
9350
|
+
declare function createSlashCommandsSource(opts: {
|
|
9351
|
+
id: string;
|
|
9352
|
+
label: string;
|
|
9353
|
+
commands: SlashCommandDefinition[];
|
|
9354
|
+
}): AgentWidgetContextMentionSource;
|
|
9355
|
+
|
|
7922
9356
|
/**
|
|
7923
9357
|
* Enriched DOM context collection for providing richer page information to AI.
|
|
7924
9358
|
*
|
|
@@ -8276,161 +9710,6 @@ interface DropdownMenuHandle {
|
|
|
8276
9710
|
*/
|
|
8277
9711
|
declare function createDropdownMenu(options: CreateDropdownOptions): DropdownMenuHandle;
|
|
8278
9712
|
|
|
8279
|
-
/**
|
|
8280
|
-
* Curated registry of lucide icons available to `renderLucideIcon`.
|
|
8281
|
-
*
|
|
8282
|
-
* The widget used to do `import * as icons from "lucide"` and look up
|
|
8283
|
-
* icons dynamically by string. That defeated tree-shaking, so the IIFE
|
|
8284
|
-
* (CDN/script-tag) bundle shipped all 1640 lucide icons (~400KB of icon
|
|
8285
|
-
* data) regardless of which we actually used. This explicit registry
|
|
8286
|
-
* lets the bundler drop any icon not listed here.
|
|
8287
|
-
*
|
|
8288
|
-
* Trade-off: `renderLucideIcon(name)` is now a *closed set*. Names not
|
|
8289
|
-
* in this map return `null` and log a warning, exactly as a typo did
|
|
8290
|
-
* before. The registry is intentionally generous (~110 icons) so that
|
|
8291
|
-
* custom `ComponentRenderer` authors rarely hit a missing-icon dead end.
|
|
8292
|
-
*
|
|
8293
|
-
* To add icons: add a named import above and a row in `LUCIDE_ICONS`,
|
|
8294
|
-
* keyed by the lucide kebab-case name (matches their filename and
|
|
8295
|
-
* https://lucide.dev/icons).
|
|
8296
|
-
*
|
|
8297
|
-
* See `packages/widget/docs/icon-registry-shortlist.md` for the full
|
|
8298
|
-
* curation rationale and which icons were considered but excluded.
|
|
8299
|
-
*/
|
|
8300
|
-
declare const LUCIDE_ICONS: {
|
|
8301
|
-
readonly activity: IconNode;
|
|
8302
|
-
readonly "arrow-down": IconNode;
|
|
8303
|
-
readonly "arrow-up": IconNode;
|
|
8304
|
-
readonly "arrow-up-right": IconNode;
|
|
8305
|
-
readonly bot: IconNode;
|
|
8306
|
-
readonly "chevron-down": IconNode;
|
|
8307
|
-
readonly "chevron-up": IconNode;
|
|
8308
|
-
readonly "chevron-right": IconNode;
|
|
8309
|
-
readonly "chevron-left": IconNode;
|
|
8310
|
-
readonly check: IconNode;
|
|
8311
|
-
readonly clipboard: IconNode;
|
|
8312
|
-
readonly "clipboard-copy": IconNode;
|
|
8313
|
-
readonly copy: IconNode;
|
|
8314
|
-
readonly file: IconNode;
|
|
8315
|
-
readonly "file-code": IconNode;
|
|
8316
|
-
readonly "file-spreadsheet": IconNode;
|
|
8317
|
-
readonly "file-text": IconNode;
|
|
8318
|
-
readonly "image-plus": IconNode;
|
|
8319
|
-
readonly loader: IconNode;
|
|
8320
|
-
readonly "loader-circle": IconNode;
|
|
8321
|
-
readonly mic: IconNode;
|
|
8322
|
-
readonly paperclip: IconNode;
|
|
8323
|
-
readonly "refresh-cw": IconNode;
|
|
8324
|
-
readonly search: IconNode;
|
|
8325
|
-
readonly send: IconNode;
|
|
8326
|
-
readonly "shield-alert": IconNode;
|
|
8327
|
-
readonly "shield-check": IconNode;
|
|
8328
|
-
readonly "shield-x": IconNode;
|
|
8329
|
-
readonly square: IconNode;
|
|
8330
|
-
readonly "thumbs-down": IconNode;
|
|
8331
|
-
readonly "thumbs-up": IconNode;
|
|
8332
|
-
readonly upload: IconNode;
|
|
8333
|
-
readonly "volume-2": IconNode;
|
|
8334
|
-
readonly x: IconNode;
|
|
8335
|
-
readonly user: IconNode;
|
|
8336
|
-
readonly mail: IconNode;
|
|
8337
|
-
readonly phone: IconNode;
|
|
8338
|
-
readonly calendar: IconNode;
|
|
8339
|
-
readonly clock: IconNode;
|
|
8340
|
-
readonly building: IconNode;
|
|
8341
|
-
readonly "map-pin": IconNode;
|
|
8342
|
-
readonly lock: IconNode;
|
|
8343
|
-
readonly key: IconNode;
|
|
8344
|
-
readonly "credit-card": IconNode;
|
|
8345
|
-
readonly "at-sign": IconNode;
|
|
8346
|
-
readonly hash: IconNode;
|
|
8347
|
-
readonly globe: IconNode;
|
|
8348
|
-
readonly link: IconNode;
|
|
8349
|
-
readonly "circle-check": IconNode;
|
|
8350
|
-
readonly "circle-x": IconNode;
|
|
8351
|
-
readonly "triangle-alert": IconNode;
|
|
8352
|
-
readonly info: IconNode;
|
|
8353
|
-
readonly ban: IconNode;
|
|
8354
|
-
readonly shield: IconNode;
|
|
8355
|
-
readonly "arrow-left": IconNode;
|
|
8356
|
-
readonly "arrow-right": IconNode;
|
|
8357
|
-
readonly "external-link": IconNode;
|
|
8358
|
-
readonly ellipsis: IconNode;
|
|
8359
|
-
readonly "ellipsis-vertical": IconNode;
|
|
8360
|
-
readonly menu: IconNode;
|
|
8361
|
-
readonly house: IconNode;
|
|
8362
|
-
readonly plus: IconNode;
|
|
8363
|
-
readonly minus: IconNode;
|
|
8364
|
-
readonly pencil: IconNode;
|
|
8365
|
-
readonly trash: IconNode;
|
|
8366
|
-
readonly "trash-2": IconNode;
|
|
8367
|
-
readonly save: IconNode;
|
|
8368
|
-
readonly download: IconNode;
|
|
8369
|
-
readonly share: IconNode;
|
|
8370
|
-
readonly funnel: IconNode;
|
|
8371
|
-
readonly settings: IconNode;
|
|
8372
|
-
readonly "rotate-cw": IconNode;
|
|
8373
|
-
readonly maximize: IconNode;
|
|
8374
|
-
readonly minimize: IconNode;
|
|
8375
|
-
readonly "shopping-cart": IconNode;
|
|
8376
|
-
readonly "shopping-bag": IconNode;
|
|
8377
|
-
readonly package: IconNode;
|
|
8378
|
-
readonly truck: IconNode;
|
|
8379
|
-
readonly tag: IconNode;
|
|
8380
|
-
readonly gift: IconNode;
|
|
8381
|
-
readonly receipt: IconNode;
|
|
8382
|
-
readonly wallet: IconNode;
|
|
8383
|
-
readonly store: IconNode;
|
|
8384
|
-
readonly "dollar-sign": IconNode;
|
|
8385
|
-
readonly percent: IconNode;
|
|
8386
|
-
readonly play: IconNode;
|
|
8387
|
-
readonly pause: IconNode;
|
|
8388
|
-
readonly "volume-x": IconNode;
|
|
8389
|
-
readonly camera: IconNode;
|
|
8390
|
-
readonly image: IconNode;
|
|
8391
|
-
readonly film: IconNode;
|
|
8392
|
-
readonly headphones: IconNode;
|
|
8393
|
-
readonly "message-circle": IconNode;
|
|
8394
|
-
readonly "message-square": IconNode;
|
|
8395
|
-
readonly bell: IconNode;
|
|
8396
|
-
readonly heart: IconNode;
|
|
8397
|
-
readonly star: IconNode;
|
|
8398
|
-
readonly eye: IconNode;
|
|
8399
|
-
readonly "eye-off": IconNode;
|
|
8400
|
-
readonly bookmark: IconNode;
|
|
8401
|
-
readonly "calendar-days": IconNode;
|
|
8402
|
-
readonly history: IconNode;
|
|
8403
|
-
readonly timer: IconNode;
|
|
8404
|
-
readonly folder: IconNode;
|
|
8405
|
-
readonly "folder-open": IconNode;
|
|
8406
|
-
readonly files: IconNode;
|
|
8407
|
-
readonly sparkles: IconNode;
|
|
8408
|
-
readonly zap: IconNode;
|
|
8409
|
-
readonly sun: IconNode;
|
|
8410
|
-
readonly moon: IconNode;
|
|
8411
|
-
readonly flag: IconNode;
|
|
8412
|
-
readonly monitor: IconNode;
|
|
8413
|
-
readonly smartphone: IconNode;
|
|
8414
|
-
};
|
|
8415
|
-
/**
|
|
8416
|
-
* Names of lucide icons that ship with the widget. Names not in this
|
|
8417
|
-
* union return `null` from `renderLucideIcon` (with a console warning).
|
|
8418
|
-
*/
|
|
8419
|
-
type IconName = keyof typeof LUCIDE_ICONS;
|
|
8420
|
-
/**
|
|
8421
|
-
* Renders a lucide icon as an inline SVG element. Works inside Shadow
|
|
8422
|
-
* DOM and requires no CSS.
|
|
8423
|
-
*
|
|
8424
|
-
* @param iconName - A lucide kebab-case name from the registry. See
|
|
8425
|
-
* `IconName` for the full list, or `docs/icon-registry-shortlist.md`
|
|
8426
|
-
* for rationale.
|
|
8427
|
-
* @param size - The size in pixels (number) or any CSS length string.
|
|
8428
|
-
* @param color - Stroke color (default: "currentColor").
|
|
8429
|
-
* @param strokeWidth - Stroke width (default: 2).
|
|
8430
|
-
* @returns SVGElement, or null if the name is not in the registry.
|
|
8431
|
-
*/
|
|
8432
|
-
declare const renderLucideIcon: (iconName: IconName | (string & {}), size?: number | string, color?: string, strokeWidth?: number) => SVGElement | null;
|
|
8433
|
-
|
|
8434
9713
|
/** Options for {@link createIconButton}. */
|
|
8435
9714
|
interface CreateIconButtonOptions {
|
|
8436
9715
|
/** Lucide icon name (kebab-case, e.g. "eye", "chevron-down"). */
|
|
@@ -8488,6 +9767,8 @@ interface ToggleGroupItem {
|
|
|
8488
9767
|
icon?: string;
|
|
8489
9768
|
/** Accessible label for the button. */
|
|
8490
9769
|
label: string;
|
|
9770
|
+
/** Extra CSS class(es) appended after "persona-icon-btn". */
|
|
9771
|
+
className?: string;
|
|
8491
9772
|
}
|
|
8492
9773
|
/** Options for {@link createToggleGroup}. */
|
|
8493
9774
|
interface CreateToggleGroupOptions {
|
|
@@ -8775,6 +10056,8 @@ declare const THEME_ZONES: {
|
|
|
8775
10056
|
readonly container: "Main widget container";
|
|
8776
10057
|
readonly 'artifact-pane': "Artifact sidebar";
|
|
8777
10058
|
readonly 'artifact-toolbar': "Artifact toolbar";
|
|
10059
|
+
readonly 'artifact-inline': "Inline artifact block";
|
|
10060
|
+
readonly 'artifact-inline-chrome': "Inline artifact title bar";
|
|
8778
10061
|
};
|
|
8779
10062
|
type ThemeZone = keyof typeof THEME_ZONES;
|
|
8780
10063
|
|
|
@@ -8826,15 +10109,27 @@ interface ComponentContext {
|
|
|
8826
10109
|
* Component renderer function signature
|
|
8827
10110
|
*/
|
|
8828
10111
|
type ComponentRenderer = (props: Record<string, unknown>, context: ComponentContext) => HTMLElement;
|
|
10112
|
+
/**
|
|
10113
|
+
* Per-component registration options
|
|
10114
|
+
*/
|
|
10115
|
+
interface ComponentRegistrationOptions {
|
|
10116
|
+
/**
|
|
10117
|
+
* When false, the component directive renders bare in the thread (no
|
|
10118
|
+
* persona-message-bubble chrome).
|
|
10119
|
+
* @default true
|
|
10120
|
+
*/
|
|
10121
|
+
bubbleChrome?: boolean;
|
|
10122
|
+
}
|
|
8829
10123
|
/**
|
|
8830
10124
|
* Component registry for managing custom components
|
|
8831
10125
|
*/
|
|
8832
10126
|
declare class ComponentRegistry {
|
|
8833
10127
|
private components;
|
|
10128
|
+
private options;
|
|
8834
10129
|
/**
|
|
8835
10130
|
* Register a custom component
|
|
8836
10131
|
*/
|
|
8837
|
-
register(name: string, renderer: ComponentRenderer): void;
|
|
10132
|
+
register(name: string, renderer: ComponentRenderer, options?: ComponentRegistrationOptions): void;
|
|
8838
10133
|
/**
|
|
8839
10134
|
* Unregister a component
|
|
8840
10135
|
*/
|
|
@@ -8847,6 +10142,10 @@ declare class ComponentRegistry {
|
|
|
8847
10142
|
* Check if a component is registered
|
|
8848
10143
|
*/
|
|
8849
10144
|
has(name: string): boolean;
|
|
10145
|
+
/**
|
|
10146
|
+
* Get the registration options for a component, if any were supplied
|
|
10147
|
+
*/
|
|
10148
|
+
getOptions(name: string): ComponentRegistrationOptions | undefined;
|
|
8850
10149
|
/**
|
|
8851
10150
|
* Get all registered component names
|
|
8852
10151
|
*/
|
|
@@ -9288,4 +10587,30 @@ interface DemoCarouselHandle {
|
|
|
9288
10587
|
}
|
|
9289
10588
|
declare function createDemoCarousel(container: HTMLElement, options: DemoCarouselOptions): DemoCarouselHandle;
|
|
9290
10589
|
|
|
9291
|
-
|
|
10590
|
+
/**
|
|
10591
|
+
* Roving-tabindex tablist controller (WAI-ARIA APG tabs pattern). Owns the tab
|
|
10592
|
+
* roles, aria-selected, roving tabindex, Arrow/Home/End keyboard nav routed
|
|
10593
|
+
* through an onSelect callback, focus reveal via scrollIntoView, and focus
|
|
10594
|
+
* survival across a tab-DOM rebuild. Extracted so custom tab bars stay
|
|
10595
|
+
* accessible without re-implementing the pattern.
|
|
10596
|
+
*/
|
|
10597
|
+
interface RovingTablistOptions {
|
|
10598
|
+
onSelect: (index: number) => void;
|
|
10599
|
+
/** Arrow-key axis. @default "horizontal" */
|
|
10600
|
+
orientation?: "horizontal" | "vertical";
|
|
10601
|
+
}
|
|
10602
|
+
interface RovingTablistController {
|
|
10603
|
+
/** Snapshot whether focus is inside the strip. Call before replacing tab DOM. */
|
|
10604
|
+
beforeRender(): void;
|
|
10605
|
+
/**
|
|
10606
|
+
* Apply role=tablist/tab, aria-selected, roving tabindex, and keyboard nav to
|
|
10607
|
+
* the given tab elements (in order). Restores focus to the selected tab when
|
|
10608
|
+
* the last beforeRender() saw focus inside the strip. Call after (re)building
|
|
10609
|
+
* tabs.
|
|
10610
|
+
*/
|
|
10611
|
+
render(tabs: HTMLElement[], selectedIndex: number): void;
|
|
10612
|
+
destroy(): void;
|
|
10613
|
+
}
|
|
10614
|
+
declare function createRovingTablist(container: HTMLElement, options: RovingTablistOptions): RovingTablistController;
|
|
10615
|
+
|
|
10616
|
+
export { ASK_USER_QUESTION_CLIENT_TOOL, ASK_USER_QUESTION_PARAMETERS_SCHEMA, ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetApprovalDecisionOptions, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComponentRenderer, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetContextMentionChipRenderContext, type AgentWidgetContextMentionCommandContext, type AgentWidgetContextMentionComposerCapability, type AgentWidgetContextMentionConfig, type AgentWidgetContextMentionItem, type AgentWidgetContextMentionItemRenderContext, type AgentWidgetContextMentionMenuRenderContext, type AgentWidgetContextMentionPayload, type AgentWidgetContextMentionRef, type AgentWidgetContextMentionResolveContext, type AgentWidgetContextMentionSearchContext, type AgentWidgetContextMentionSource, type AgentWidgetContextMentionTokenRenderContext, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMentionLlmEntry, type AgentWidgetMentionTriggerChannel, type AgentWidgetMentionTriggerPosition, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetParsedAction, type AgentWidgetPlugin, type AgentWidgetReadAloudEvent, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, type AgentWidgetScrollBehaviorFeature, type AgentWidgetScrollMode, type AgentWidgetScrollRestorePosition, type AgentWidgetScrollToBottomFeature, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type AgentWidgetVoiceStatusEvent, type AgentWidgetWebMcpConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type BorderScale, BrowserSpeechEngine, type BrowserSpeechEngineOptions, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type ClientToolDefinition, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRegistrationOptions, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateComboButtonOptions, type CreateDropdownOptions, type CreateIconButtonOptions, type CreateLabelButtonOptions, type CreateStandardBubbleOptions, type CreateThemeOptions, type CreateToggleGroupOptions, DEFAULT_COMPONENTS, DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH, DEFAULT_FLOATING_LAUNCHER_WIDTH, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DeepPartial, type DemoCarouselHandle, type DemoCarouselItem, type DemoCarouselOptions, type DomContextMode, type DomContextOptions, type DropdownMenuHandle, type DropdownMenuItem, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FallbackSpeechEngineOptions, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IconName, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectComponentDirectiveOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownParsersModule, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PcmStreamPlayer, type PendingAttachment, type PersonaArtifactActionContext, type PersonaArtifactCustomAction, type PersonaArtifactDisplayMode, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaArtifactStatusLabelContext, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, ReadAloudController, type ReadAloudListener, type ReadAloudState, type ResolvedTarget, type RovingTablistController, type RovingTablistOptions, type RuleScoringContext, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeExecutionStreamEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, type RuntypeTurnCompleteEvent, type SSEEventCallback, type SSEEventRecord, SUGGEST_REPLIES_CLIENT_TOOL, SUGGEST_REPLIES_PARAMETERS_SCHEMA, SUGGEST_REPLIES_TOOL_NAME, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlashCommandDefinition, type SlotRenderContext, type SlotRenderer, type SpacingScale, type SpeechCallbacks, type SpeechEngine, type SpeechRequest, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TargetResolver, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceMetrics, type VoicePlaybackEngine, type VoiceProvider, type VoiceResult, type VoiceStatus, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, builtInClientToolsForDispatch, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createAskUserQuestionBubble, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComboButton, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDemoCarousel, createDirectivePostprocessor, createDropdownMenu, createFlexibleJsonStreamParser, createIconButton, createImagePart, createJsonStreamParser, createLabelButton, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createRovingTablist, createSlashCommandsSource, createStandardBubble, createStaticMentionSource, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultMentionFilter, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isSuggestRepliesMessage, isVoiceSupported, isWebMcpToolName, latestAgentSuggestions, listRegisteredStreamAnimations, loadMarkdownParsers, markdownPostprocessor, mergeWithDefaults, normalizeContent, onMarkdownParsersReady, parseAskUserQuestionPayload, parseSuggestRepliesPayload, pickBestVoice, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|