@runtypelabs/persona 4.13.0 → 4.15.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 +4 -4
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-DveIaNx6.d.cts → types-BpWGm7_6.d.cts} +17 -0
- package/dist/animations/{types-DveIaNx6.d.ts → types-BpWGm7_6.d.ts} +17 -0
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/chunk-QJ4LV2KW.js +1 -0
- package/dist/codegen.cjs +12 -11
- package/dist/codegen.js +14 -13
- package/dist/{context-mentions-ONG7A7M6.js → context-mentions-BTSTIBFC.js} +1 -1
- package/dist/context-mentions.cjs +11 -8
- package/dist/context-mentions.d.cts +339 -22
- package/dist/context-mentions.d.ts +339 -22
- package/dist/context-mentions.js +11 -8
- package/dist/index.cjs +68 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +483 -48
- package/dist/index.d.ts +483 -48
- package/dist/index.global.js +61 -58
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +70 -69
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js +5 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/smart-dom-reader.d.cts +339 -22
- package/dist/smart-dom-reader.d.ts +339 -22
- package/dist/theme-editor-preview.cjs +67 -67
- package/dist/theme-editor-preview.d.cts +355 -23
- package/dist/theme-editor-preview.d.ts +355 -23
- package/dist/theme-editor-preview.js +75 -75
- package/dist/theme-editor.cjs +10 -10
- package/dist/theme-editor.d.cts +376 -24
- package/dist/theme-editor.d.ts +376 -24
- package/dist/theme-editor.js +10 -10
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +38 -0
- package/dist/theme-reference.d.ts +38 -0
- package/dist/theme-reference.js +1 -1
- package/dist/widget.css +1 -1
- package/package.json +1 -1
- package/src/artifacts-session.test.ts +106 -0
- package/src/ask-user-question-tool.ts +10 -7
- package/src/client.test.ts +2 -2
- package/src/client.ts +4 -1
- package/src/components/artifact-card.ts +13 -2
- package/src/components/artifact-inline.ts +11 -2
- package/src/components/artifact-preview.ts +1 -1
- package/src/components/composer-builder.test.ts +2 -0
- package/src/components/composer-builder.ts +1 -1
- package/src/components/composer-parts.test.ts +105 -4
- package/src/components/composer-parts.ts +54 -16
- package/src/components/message-bubble.test.ts +7 -1
- package/src/components/message-bubble.ts +11 -8
- package/src/components/messages.ts +5 -2
- package/src/components/panel.ts +31 -5
- package/src/components/pill-composer-builder.test.ts +18 -0
- package/src/components/suggestions.test.ts +233 -0
- package/src/components/suggestions.ts +463 -81
- package/src/components/widget-view.ts +4 -0
- package/src/defaults.ts +5 -3
- package/src/generated/runtype-openapi-contract.ts +17 -0
- package/src/index-core.ts +52 -2
- package/src/launcher-global.ts +1 -1
- package/src/plugins/types.ts +71 -3
- package/src/presets.ts +3 -3
- package/src/session.ts +55 -12
- package/src/styles/widget-styles.test.ts +162 -0
- package/src/styles/widget.css +440 -1
- package/src/suggest-replies-tool.test.ts +233 -2
- package/src/suggest-replies-tool.ts +115 -39
- package/src/theme-editor/index.ts +5 -0
- package/src/theme-editor/presets.test.ts +43 -0
- package/src/theme-editor/presets.ts +101 -87
- package/src/theme-editor/preview-utils.test.ts +34 -0
- package/src/theme-editor/preview-utils.ts +77 -2
- package/src/theme-editor/sections.test.ts +72 -7
- package/src/theme-editor/sections.ts +113 -13
- package/src/theme-editor/state-preferences.test.ts +15 -0
- package/src/theme-editor/state.ts +46 -0
- package/src/theme-editor/types.ts +15 -1
- package/src/theme-editor/webmcp/tools.test.ts +13 -0
- package/src/theme-editor/webmcp/tools.ts +5 -0
- package/src/theme-reference.ts +9 -2
- package/src/types/theme.ts +32 -0
- package/src/types.ts +291 -25
- package/src/ui.artifact-pane-gating.test.ts +5 -5
- package/src/ui.config-preferences.test.ts +166 -0
- package/src/ui.detached-panel.test.ts +1 -1
- package/src/ui.suggest-replies.test.ts +1066 -1
- package/src/ui.ts +311 -45
- package/src/ui.typing-indicator.test.ts +135 -0
- package/src/utils/artifact-display.test.ts +180 -16
- package/src/utils/artifact-display.ts +155 -14
- package/src/utils/artifact-file.test.ts +1 -1
- package/src/utils/code-generators.test.ts +40 -0
- package/src/utils/code-generators.ts +22 -0
- package/src/utils/config-merge.test.ts +84 -0
- package/src/utils/config-merge.ts +6 -1
- package/src/utils/feature-preferences.test.ts +326 -0
- package/src/utils/feature-preferences.ts +498 -0
- package/src/utils/icons.test.ts +26 -0
- package/src/utils/icons.ts +8 -0
- package/src/utils/theme.test.ts +171 -0
- package/src/utils/tokens.ts +71 -7
- package/dist/chunk-MMUPR2JW.js +0 -1
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
import { IconNode } from 'lucide';
|
|
2
2
|
|
|
3
|
+
type AgentWidgetTransformSuggestionsContext = {
|
|
4
|
+
/**
|
|
5
|
+
* Fresh copy of the suggestions entering this plugin, already normalized:
|
|
6
|
+
* shorthand strings expanded and the effective send/fill behavior resolved.
|
|
7
|
+
*/
|
|
8
|
+
suggestions: AgentWidgetResolvedSuggestion[];
|
|
9
|
+
surface: AgentWidgetSuggestionSurface;
|
|
10
|
+
source: AgentWidgetSuggestionSource;
|
|
11
|
+
config: AgentWidgetConfig;
|
|
12
|
+
};
|
|
13
|
+
type AgentWidgetRenderSuggestionContext = {
|
|
14
|
+
/** Fully normalized suggestion, including the effective send/fill behavior. */
|
|
15
|
+
suggestion: AgentWidgetResolvedSuggestion;
|
|
16
|
+
index: number;
|
|
17
|
+
surface: AgentWidgetSuggestionSurface;
|
|
18
|
+
source: AgentWidgetSuggestionSource;
|
|
19
|
+
variant: AgentWidgetSuggestionVariant;
|
|
20
|
+
streaming: boolean;
|
|
21
|
+
config: AgentWidgetConfig;
|
|
22
|
+
/** Build Persona's standard chip, card, or list item. */
|
|
23
|
+
defaultRenderer: () => HTMLElement;
|
|
24
|
+
/**
|
|
25
|
+
* Run the normal selection pipeline: DOM event, plugin selection hooks, then
|
|
26
|
+
* send or fill. Custom renderers should call this instead of sending directly.
|
|
27
|
+
*/
|
|
28
|
+
select: () => void;
|
|
29
|
+
};
|
|
30
|
+
type AgentWidgetSuggestionSelectContext = {
|
|
31
|
+
suggestion: AgentWidgetResolvedSuggestion;
|
|
32
|
+
surface: AgentWidgetSuggestionSurface;
|
|
33
|
+
source: AgentWidgetSuggestionSource;
|
|
34
|
+
variant: AgentWidgetSuggestionVariant;
|
|
35
|
+
config: AgentWidgetConfig;
|
|
36
|
+
};
|
|
3
37
|
/**
|
|
4
38
|
* Plugin interface for customizing widget components
|
|
5
39
|
*/
|
|
@@ -12,6 +46,25 @@ interface AgentWidgetPlugin {
|
|
|
12
46
|
* Optional priority (higher = runs first). Default: 0
|
|
13
47
|
*/
|
|
14
48
|
priority?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Transform, filter, enrich, or reorder suggestions. Hooks receive normalized
|
|
51
|
+
* items and compose in plugin priority order; the return value may use the
|
|
52
|
+
* loose shape (string shorthand included) and is re-normalized before the next
|
|
53
|
+
* hook. A per-item `behavior` set here survives. `maxItems` caps the list
|
|
54
|
+
* after the full chain. Return an empty array to hide the surface.
|
|
55
|
+
*/
|
|
56
|
+
transformSuggestions?: (context: AgentWidgetTransformSuggestionsContext) => AgentWidgetSuggestion[];
|
|
57
|
+
/**
|
|
58
|
+
* Render one starter or follow-up suggestion. Return null to use Persona's
|
|
59
|
+
* default chip/card/list renderer. Call `select()` from custom interaction
|
|
60
|
+
* controls to preserve events, selection hooks, and send/fill behavior.
|
|
61
|
+
*/
|
|
62
|
+
renderSuggestion?: (context: AgentWidgetRenderSuggestionContext) => HTMLElement | null;
|
|
63
|
+
/**
|
|
64
|
+
* Observe or intercept a suggestion selection. Return false to cancel the
|
|
65
|
+
* built-in send/fill action. Hooks run in plugin priority order.
|
|
66
|
+
*/
|
|
67
|
+
onSuggestionSelect?: (context: AgentWidgetSuggestionSelectContext) => void | boolean;
|
|
15
68
|
/**
|
|
16
69
|
* Custom renderer for message bubbles
|
|
17
70
|
* Return null to use default renderer
|
|
@@ -607,6 +660,14 @@ interface ReasoningBubbleTokens {
|
|
|
607
660
|
interface ComposerChromeTokens {
|
|
608
661
|
/** Box-shadow on the composer form (raw CSS, e.g. `none`). */
|
|
609
662
|
shadow: string;
|
|
663
|
+
/** Inner padding of the composer form (raw CSS shorthand). @default "0.75rem 1rem" */
|
|
664
|
+
padding?: string;
|
|
665
|
+
/** Gap between the textarea row and the actions row. @default "0.5rem" */
|
|
666
|
+
gap?: string;
|
|
667
|
+
/** Composer textarea font-size. @default "0.875rem" */
|
|
668
|
+
fontSize?: string;
|
|
669
|
+
/** Composer textarea line-height. @default "1.25rem" */
|
|
670
|
+
lineHeight?: string;
|
|
610
671
|
}
|
|
611
672
|
/** Artifact toolbar chrome. */
|
|
612
673
|
interface ArtifactToolbarTokens {
|
|
@@ -756,6 +817,26 @@ interface ScrollToBottomTokens extends ComponentTokenSet {
|
|
|
756
817
|
fontSize?: string;
|
|
757
818
|
iconSize?: string;
|
|
758
819
|
}
|
|
820
|
+
/** Visual tokens shared by one suggestion presentation variant. */
|
|
821
|
+
interface SuggestionVariantTokens extends ComponentTokenSet {
|
|
822
|
+
gap?: string;
|
|
823
|
+
minHeight?: string;
|
|
824
|
+
fontSize?: string;
|
|
825
|
+
lineHeight?: string;
|
|
826
|
+
iconSize?: string;
|
|
827
|
+
hoverBackground?: TokenReference<'color'>;
|
|
828
|
+
hoverForeground?: TokenReference<'color'>;
|
|
829
|
+
hoverBorder?: TokenReference<'color'>;
|
|
830
|
+
pressedBackground?: TokenReference<'color'>;
|
|
831
|
+
focusRing?: TokenReference<'color'>;
|
|
832
|
+
disabledOpacity?: string;
|
|
833
|
+
}
|
|
834
|
+
/** Starter and follow-up suggestion chrome. */
|
|
835
|
+
interface SuggestionTokens {
|
|
836
|
+
chip: SuggestionVariantTokens;
|
|
837
|
+
card: SuggestionVariantTokens;
|
|
838
|
+
list: SuggestionVariantTokens;
|
|
839
|
+
}
|
|
759
840
|
/** Toggle group chrome (used by createToggleGroup). */
|
|
760
841
|
interface ToggleGroupTokens {
|
|
761
842
|
/** Gap between toggle buttons. Default: 0 (connected). */
|
|
@@ -786,6 +867,8 @@ interface ComponentTokens {
|
|
|
786
867
|
labelButton?: LabelButtonTokens;
|
|
787
868
|
/** Scroll-to-bottom indicator styling tokens. */
|
|
788
869
|
scrollToBottom?: ScrollToBottomTokens;
|
|
870
|
+
/** Starter prompt and follow-up suggestion styling tokens. */
|
|
871
|
+
suggestion?: SuggestionTokens;
|
|
789
872
|
/** Toggle group styling tokens. */
|
|
790
873
|
toggleGroup?: ToggleGroupTokens;
|
|
791
874
|
/** Artifact toolbar, tab strip, and pane chrome. */
|
|
@@ -1080,7 +1163,24 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1080
1163
|
type: "source";
|
|
1081
1164
|
url?: string;
|
|
1082
1165
|
[key: string]: unknown;
|
|
1166
|
+
} | {
|
|
1167
|
+
executionId: string;
|
|
1168
|
+
iteration?: number;
|
|
1169
|
+
seq: number;
|
|
1170
|
+
state: Record<string, unknown>;
|
|
1171
|
+
type: "state_snapshot";
|
|
1083
1172
|
} | ({
|
|
1173
|
+
executionId: string;
|
|
1174
|
+
iteration?: number;
|
|
1175
|
+
patch: Array<{
|
|
1176
|
+
from?: string;
|
|
1177
|
+
op: "add" | "remove" | "replace" | "move" | "copy" | "test";
|
|
1178
|
+
path: string;
|
|
1179
|
+
value?: unknown;
|
|
1180
|
+
}>;
|
|
1181
|
+
seq: number;
|
|
1182
|
+
type: "state_delta";
|
|
1183
|
+
}) | ({
|
|
1084
1184
|
executionId: string;
|
|
1085
1185
|
hiddenParameterNames?: Array<string>;
|
|
1086
1186
|
iteration?: number;
|
|
@@ -1322,6 +1422,7 @@ declare const LUCIDE_ICONS: {
|
|
|
1322
1422
|
readonly plus: IconNode;
|
|
1323
1423
|
readonly minus: IconNode;
|
|
1324
1424
|
readonly pencil: IconNode;
|
|
1425
|
+
readonly "pen-line": IconNode;
|
|
1325
1426
|
readonly trash: IconNode;
|
|
1326
1427
|
readonly "trash-2": IconNode;
|
|
1327
1428
|
readonly save: IconNode;
|
|
@@ -1364,11 +1465,13 @@ declare const LUCIDE_ICONS: {
|
|
|
1364
1465
|
readonly folder: IconNode;
|
|
1365
1466
|
readonly "folder-open": IconNode;
|
|
1366
1467
|
readonly files: IconNode;
|
|
1468
|
+
readonly "chart-column": IconNode;
|
|
1367
1469
|
readonly sparkles: IconNode;
|
|
1368
1470
|
readonly zap: IconNode;
|
|
1369
1471
|
readonly sun: IconNode;
|
|
1370
1472
|
readonly moon: IconNode;
|
|
1371
1473
|
readonly flag: IconNode;
|
|
1474
|
+
readonly lightbulb: IconNode;
|
|
1372
1475
|
readonly monitor: IconNode;
|
|
1373
1476
|
readonly smartphone: IconNode;
|
|
1374
1477
|
};
|
|
@@ -1968,6 +2071,14 @@ type AgentToolsConfig = {
|
|
|
1968
2071
|
};
|
|
1969
2072
|
/** Artifact kinds for the Persona sidebar and dispatch payload */
|
|
1970
2073
|
type PersonaArtifactKind = "markdown" | "component";
|
|
2074
|
+
type PersonaArtifactPresentation = {
|
|
2075
|
+
/**
|
|
2076
|
+
* Producer hint for where this artifact renders (content-disposition
|
|
2077
|
+
* model). Beats configured defaults; loses to explicit `files`/`byKind`
|
|
2078
|
+
* rules. Persona never infers it; the producer or host supplies it.
|
|
2079
|
+
*/
|
|
2080
|
+
preferredMode?: PersonaArtifactDisplayModeInput;
|
|
2081
|
+
};
|
|
1971
2082
|
/**
|
|
1972
2083
|
* Agent configuration for agent execution mode.
|
|
1973
2084
|
* When provided in the widget config, enables agent loop execution instead of flow dispatch.
|
|
@@ -2586,7 +2697,48 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2586
2697
|
jsonPayload: string;
|
|
2587
2698
|
}) => void | Promise<void>;
|
|
2588
2699
|
};
|
|
2589
|
-
|
|
2700
|
+
/**
|
|
2701
|
+
* Where the artifact body renders by default. Every mode shows the compact
|
|
2702
|
+
* reference in the transcript; the mode names where the body goes:
|
|
2703
|
+
* nowhere yet (`collapsed`), the side panel (`panel`), or the conversation
|
|
2704
|
+
* itself (`inline`).
|
|
2705
|
+
*/
|
|
2706
|
+
type PersonaArtifactDisplayMode = "collapsed" | "panel" | "inline";
|
|
2707
|
+
/**
|
|
2708
|
+
* Accepted wherever a display mode is written. `"card"` is a deprecated
|
|
2709
|
+
* alias of `"collapsed"` (the old name described the reference card, which
|
|
2710
|
+
* every mode shows, instead of where the body renders). Resolution and
|
|
2711
|
+
* parsing always canonicalize to `"collapsed"`.
|
|
2712
|
+
*/
|
|
2713
|
+
type PersonaArtifactDisplayModeInput = PersonaArtifactDisplayMode | "card";
|
|
2714
|
+
/**
|
|
2715
|
+
* Display rules for file-backed artifacts. `byMediaType` keys are exact MIME
|
|
2716
|
+
* types (`"text/html"`) or major-type wildcards (`"image/*"`), matched
|
|
2717
|
+
* case-insensitively without parameters; exact beats wildcard.
|
|
2718
|
+
*/
|
|
2719
|
+
type PersonaArtifactFilesDisplayRules = {
|
|
2720
|
+
default?: PersonaArtifactDisplayModeInput;
|
|
2721
|
+
byMediaType?: Record<string, PersonaArtifactDisplayModeInput>;
|
|
2722
|
+
};
|
|
2723
|
+
/**
|
|
2724
|
+
* Scoped artifact display rules. Matching resolves from the most specific
|
|
2725
|
+
* selector to `default`; see `resolveArtifactDisplay`.
|
|
2726
|
+
*
|
|
2727
|
+
* Across preference layers, one merge rule applies everywhere: a string value
|
|
2728
|
+
* replaces the whole subtree it names; an object refines it per key. So
|
|
2729
|
+
* `files: "inline"` overrides every lower-layer file rule, while
|
|
2730
|
+
* `files: { default: "inline" }` keeps lower-layer MIME exceptions.
|
|
2731
|
+
*/
|
|
2732
|
+
type PersonaArtifactDisplayRules = {
|
|
2733
|
+
default?: PersonaArtifactDisplayModeInput;
|
|
2734
|
+
byKind?: Partial<Record<PersonaArtifactKind, PersonaArtifactDisplayModeInput>>;
|
|
2735
|
+
/**
|
|
2736
|
+
* @deprecated Use `byKind`. When both are present, `byKind` wins.
|
|
2737
|
+
*/
|
|
2738
|
+
byType?: Partial<Record<PersonaArtifactKind, PersonaArtifactDisplayModeInput>>;
|
|
2739
|
+
/** Rules for any artifact carrying file metadata. */
|
|
2740
|
+
files?: PersonaArtifactDisplayModeInput | PersonaArtifactFilesDisplayRules;
|
|
2741
|
+
};
|
|
2590
2742
|
/** 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. */
|
|
2591
2743
|
type PersonaArtifactActionContext = {
|
|
2592
2744
|
artifactId: string | null;
|
|
@@ -2643,13 +2795,10 @@ type AgentWidgetArtifactsFeature = {
|
|
|
2643
2795
|
allowedTypes?: PersonaArtifactKind[];
|
|
2644
2796
|
/**
|
|
2645
2797
|
* Where artifact bodies render. A single mode applies to all artifacts;
|
|
2646
|
-
* the object form sets a default plus
|
|
2798
|
+
* the object form sets a default plus scoped overrides.
|
|
2647
2799
|
* Defaults to "panel" (current behavior).
|
|
2648
2800
|
*/
|
|
2649
|
-
display?:
|
|
2650
|
-
default?: PersonaArtifactDisplayMode;
|
|
2651
|
-
byType?: Partial<Record<PersonaArtifactKind, PersonaArtifactDisplayMode>>;
|
|
2652
|
-
};
|
|
2801
|
+
display?: PersonaArtifactDisplayModeInput | PersonaArtifactDisplayRules;
|
|
2653
2802
|
/** Split / drawer dimensions and launcher widen behavior */
|
|
2654
2803
|
layout?: AgentWidgetArtifactsLayoutConfig;
|
|
2655
2804
|
/**
|
|
@@ -3371,19 +3520,58 @@ type AgentWidgetFeatureFlags = {
|
|
|
3371
3520
|
*/
|
|
3372
3521
|
askUserQuestion?: AgentWidgetAskUserQuestionFeature;
|
|
3373
3522
|
/**
|
|
3374
|
-
* Built-in `suggest_replies`
|
|
3375
|
-
*
|
|
3376
|
-
*
|
|
3377
|
-
*
|
|
3523
|
+
* Built-in `suggest_replies` follow-ups. When the assistant invokes the
|
|
3524
|
+
* tool, the widget shows the suggestions using `suggestions.followUps` and
|
|
3525
|
+
* immediately resumes the execution: fire-and-forget, no user input awaited.
|
|
3526
|
+
*
|
|
3527
|
+
* @deprecated Both keys moved to `suggestions.followUps`: use
|
|
3528
|
+
* `suggestions.followUps.enabled` and `suggestions.followUps.expose`. This
|
|
3529
|
+
* alias keeps working per key, with `suggestions.followUps` winning.
|
|
3378
3530
|
*/
|
|
3379
3531
|
suggestReplies?: AgentWidgetSuggestRepliesFeature;
|
|
3380
3532
|
};
|
|
3381
3533
|
/**
|
|
3382
|
-
*
|
|
3383
|
-
*
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3534
|
+
* Persistable artifact-layout choices. The full layout config deliberately is
|
|
3535
|
+
* not exposed because it also contains callbacks and embedder-owned chrome.
|
|
3536
|
+
*/
|
|
3537
|
+
type WidgetArtifactLayoutPreference = Pick<AgentWidgetArtifactsLayoutConfig, "paneWidth" | "paneMaxWidth" | "paneMinWidth" | "expandLauncherPanelWhenOpen" | "expandedPanelWidth" | "resizable" | "resizableMinWidth" | "resizableMaxWidth">;
|
|
3538
|
+
/**
|
|
3539
|
+
* Curated, JSON-serializable display preferences in native `features` shape.
|
|
3540
|
+
*
|
|
3541
|
+
* Absence means inherit the next preference layer and ultimately Persona's
|
|
3542
|
+
* current default. Persist only explicit choices; resetting a choice deletes
|
|
3543
|
+
* its key.
|
|
3544
|
+
*
|
|
3545
|
+
* Capability facts (`artifacts.enabled`, `allowedTypes`), trusted iframe
|
|
3546
|
+
* security, callbacks, actions, renderers, labels, and theme styling are
|
|
3547
|
+
* intentionally excluded because they remain embedder/code-owned.
|
|
3548
|
+
*/
|
|
3549
|
+
type WidgetPreferenceSlice = {
|
|
3550
|
+
showToolCalls?: boolean;
|
|
3551
|
+
showReasoning?: boolean;
|
|
3552
|
+
toolCallDisplay?: Pick<AgentWidgetToolCallDisplayFeature, "collapsedMode" | "expandable" | "grouped" | "groupedMode" | "loadingAnimation">;
|
|
3553
|
+
reasoningDisplay?: Pick<AgentWidgetReasoningDisplayFeature, "expandable" | "activePreview">;
|
|
3554
|
+
artifacts?: {
|
|
3555
|
+
/**
|
|
3556
|
+
* String and object forms are both persistable and mean different things
|
|
3557
|
+
* when layers merge: a string replaces every lower-layer display rule; an
|
|
3558
|
+
* object refines lower layers per selector key (same rule applies to
|
|
3559
|
+
* `display.files`).
|
|
3560
|
+
*/
|
|
3561
|
+
display?: PersonaArtifactDisplayModeInput | PersonaArtifactDisplayRules;
|
|
3562
|
+
filePreview?: {
|
|
3563
|
+
enabled?: boolean;
|
|
3564
|
+
};
|
|
3565
|
+
layout?: WidgetArtifactLayoutPreference;
|
|
3566
|
+
};
|
|
3567
|
+
};
|
|
3568
|
+
/**
|
|
3569
|
+
* Feature config for the built-in `suggest_replies` follow-ups.
|
|
3570
|
+
*
|
|
3571
|
+
* @deprecated Both keys moved to `suggestions.followUps`
|
|
3572
|
+
* (`suggestions.followUps.enabled` / `suggestions.followUps.expose`), which
|
|
3573
|
+
* also owns presentation, placement, and send/fill behavior. Resolution is
|
|
3574
|
+
* per key with `suggestions.followUps` winning; removal waits for 5.0.
|
|
3387
3575
|
*/
|
|
3388
3576
|
type AgentWidgetSuggestRepliesFeature = {
|
|
3389
3577
|
/**
|
|
@@ -3391,14 +3579,18 @@ type AgentWidgetSuggestRepliesFeature = {
|
|
|
3391
3579
|
* renders as a regular tool bubble and is NOT auto-resumed: only set this
|
|
3392
3580
|
* with no server-side `suggest_replies` declaration, or the execution
|
|
3393
3581
|
* parks awaiting a resume that never comes.
|
|
3582
|
+
* @deprecated Use `suggestions.followUps.enabled`.
|
|
3394
3583
|
*/
|
|
3395
3584
|
enabled?: boolean;
|
|
3396
3585
|
/**
|
|
3397
3586
|
* Advertise the built-in `suggest_replies` tool to the agent on every
|
|
3398
3587
|
* dispatch via `clientTools[]`: no server-side `runtimeTools` declaration
|
|
3399
|
-
* needed. Defaults to `false
|
|
3400
|
-
*
|
|
3401
|
-
*
|
|
3588
|
+
* needed. Defaults to `false`. Declare the tool in one place: the API
|
|
3589
|
+
* dedupes a double declaration by name with `clientTools[]` winning, so the
|
|
3590
|
+
* model still sees exactly one tool, but the widget's description and schema
|
|
3591
|
+
* win and the effective tool type becomes `local` (the execution pauses and
|
|
3592
|
+
* the widget auto-resumes it). Ignored when `enabled` is `false`.
|
|
3593
|
+
* @deprecated Use `suggestions.followUps.expose`.
|
|
3402
3594
|
*/
|
|
3403
3595
|
expose?: boolean;
|
|
3404
3596
|
};
|
|
@@ -3468,10 +3660,13 @@ type AgentWidgetAskUserQuestionFeature = {
|
|
|
3468
3660
|
* matching {@link AskUserQuestionPayload}; when the model calls it, the
|
|
3469
3661
|
* existing answer-pill sheet renders and the answer resumes the execution.
|
|
3470
3662
|
*
|
|
3471
|
-
* Defaults to `false
|
|
3472
|
-
*
|
|
3473
|
-
*
|
|
3474
|
-
*
|
|
3663
|
+
* Defaults to `false`. Declare the tool in one place: the API dedupes a
|
|
3664
|
+
* double declaration by name with `clientTools[]` winning, so the model
|
|
3665
|
+
* still sees exactly one tool, but the widget's description and schema win
|
|
3666
|
+
* and the effective tool type becomes `local` (the execution pauses and the
|
|
3667
|
+
* widget resumes it with the user's answer). Ignored when `enabled` is
|
|
3668
|
+
* `false`: never offer the agent a question tool the widget can't render an
|
|
3669
|
+
* answer UI for.
|
|
3475
3670
|
*/
|
|
3476
3671
|
expose?: boolean;
|
|
3477
3672
|
/** Slide-in animation duration in ms. Defaults to 180. */
|
|
@@ -3944,6 +4139,10 @@ type AgentWidgetSendButtonConfig = {
|
|
|
3944
4139
|
paddingY?: string;
|
|
3945
4140
|
iconText?: string;
|
|
3946
4141
|
iconName?: string;
|
|
4142
|
+
/** Icon glyph box in icon mode, e.g. "20px". Defaults to half of `size`. */
|
|
4143
|
+
iconSize?: string;
|
|
4144
|
+
/** Stroke width for the icon glyph, in viewBox units. Default 2. */
|
|
4145
|
+
iconStrokeWidth?: number;
|
|
3947
4146
|
useIcon?: boolean;
|
|
3948
4147
|
tooltipText?: string;
|
|
3949
4148
|
showTooltip?: boolean;
|
|
@@ -4676,6 +4875,109 @@ type AgentWidgetSuggestionChipsConfig = {
|
|
|
4676
4875
|
paddingX?: string;
|
|
4677
4876
|
paddingY?: string;
|
|
4678
4877
|
};
|
|
4878
|
+
/** A suggested next action shown to the user. Strings remain supported as shorthand. */
|
|
4879
|
+
type AgentWidgetSuggestion = string | {
|
|
4880
|
+
/** Stable analytics / DOM identity. Falls back to the prompt or label. */
|
|
4881
|
+
id?: string;
|
|
4882
|
+
/** Concise visible action label. */
|
|
4883
|
+
label: string;
|
|
4884
|
+
/** Text placed in the composer or sent. Defaults to `label`. */
|
|
4885
|
+
prompt?: string;
|
|
4886
|
+
/** Optional supporting copy, most useful with the `card` variant. */
|
|
4887
|
+
description?: string;
|
|
4888
|
+
/** Optional icon from Persona's bundled Lucide registry. */
|
|
4889
|
+
icon?: IconName;
|
|
4890
|
+
/**
|
|
4891
|
+
* CSS color for this item's glyph. Tints the icon only: label, border,
|
|
4892
|
+
* and background stay neutral. Ignored without an `icon`.
|
|
4893
|
+
*/
|
|
4894
|
+
iconColor?: string;
|
|
4895
|
+
/** Override the surface's click behavior for this item. */
|
|
4896
|
+
behavior?: AgentWidgetSuggestionBehavior;
|
|
4897
|
+
/** Visually promote one high-confidence action. */
|
|
4898
|
+
emphasis?: "default" | "primary";
|
|
4899
|
+
};
|
|
4900
|
+
type AgentWidgetSuggestionBehavior = "send" | "fill";
|
|
4901
|
+
type AgentWidgetSuggestionVariant = "chip" | "card" | "list";
|
|
4902
|
+
type AgentWidgetSuggestionSurface = "starter" | "followUp";
|
|
4903
|
+
/**
|
|
4904
|
+
* Who produced the rendered suggestions: static config, the agent's
|
|
4905
|
+
* `suggest_replies` tool, or `controller.setFollowUpSuggestions`.
|
|
4906
|
+
*/
|
|
4907
|
+
type AgentWidgetSuggestionSource = "config" | "agent" | "host";
|
|
4908
|
+
/**
|
|
4909
|
+
* A suggestion after Persona has normalized shorthand strings and resolved the
|
|
4910
|
+
* effective click behavior. Plugin hooks receive this stable shape.
|
|
4911
|
+
*/
|
|
4912
|
+
type AgentWidgetResolvedSuggestion = {
|
|
4913
|
+
id: string;
|
|
4914
|
+
label: string;
|
|
4915
|
+
prompt: string;
|
|
4916
|
+
description?: string;
|
|
4917
|
+
icon?: IconName;
|
|
4918
|
+
/** CSS color for the glyph only; never the label, border, or background. */
|
|
4919
|
+
iconColor?: string;
|
|
4920
|
+
behavior: AgentWidgetSuggestionBehavior;
|
|
4921
|
+
emphasis: "default" | "primary";
|
|
4922
|
+
};
|
|
4923
|
+
/** Presentation keys shared by every suggestion surface. */
|
|
4924
|
+
type AgentWidgetSuggestionSurfaceConfig = {
|
|
4925
|
+
/** Item density. Defaults to `card` for starters and `chip` for follow-ups. */
|
|
4926
|
+
variant?: AgentWidgetSuggestionVariant;
|
|
4927
|
+
/** Default click behavior, overridable per item. Defaults to `send`. */
|
|
4928
|
+
behavior?: AgentWidgetSuggestionBehavior;
|
|
4929
|
+
/**
|
|
4930
|
+
* Layout for items past the surface width. Defaults to `wrap` for starters
|
|
4931
|
+
* and `scroll` for follow-ups. Applies to the `chip` variant only; the
|
|
4932
|
+
* `card` and `list` layouts manage their own stacking.
|
|
4933
|
+
*/
|
|
4934
|
+
overflow?: "scroll" | "wrap";
|
|
4935
|
+
/** Maximum visible items. Defaults to 4. */
|
|
4936
|
+
maxItems?: number;
|
|
4937
|
+
};
|
|
4938
|
+
type AgentWidgetStarterSuggestionsConfig = AgentWidgetSuggestionSurfaceConfig & {
|
|
4939
|
+
/** Suggestions shown before the first user message. */
|
|
4940
|
+
items?: AgentWidgetSuggestion[];
|
|
4941
|
+
/**
|
|
4942
|
+
* `auto` uses the welcome surface when the welcome card renders and the
|
|
4943
|
+
* composer otherwise. Explicit values are literal: `welcome` renders
|
|
4944
|
+
* nothing when the welcome card is hidden. Defaults to `auto`.
|
|
4945
|
+
*/
|
|
4946
|
+
placement?: "auto" | "welcome" | "composer";
|
|
4947
|
+
};
|
|
4948
|
+
type AgentWidgetFollowUpSuggestionsConfig = AgentWidgetSuggestionSurfaceConfig & {
|
|
4949
|
+
/**
|
|
4950
|
+
* Enable the built-in `suggest_replies` follow-ups. Defaults to true. When
|
|
4951
|
+
* false, `suggest_replies` renders as a regular tool bubble and is NOT
|
|
4952
|
+
* auto-resumed: only set this with no server-side `suggest_replies`
|
|
4953
|
+
* declaration, or the execution parks awaiting a resume that never comes.
|
|
4954
|
+
*/
|
|
4955
|
+
enabled?: boolean;
|
|
4956
|
+
/**
|
|
4957
|
+
* Advertise the built-in `suggest_replies` tool to the agent on every
|
|
4958
|
+
* dispatch via `clientTools[]`: no server-side `runtimeTools` declaration
|
|
4959
|
+
* needed. Defaults to `false`. Declare the tool in one place: the API
|
|
4960
|
+
* dedupes a double declaration by name with `clientTools[]` winning, so
|
|
4961
|
+
* the model still sees exactly one tool, but the widget's description and
|
|
4962
|
+
* schema win and the effective tool type becomes `local` (the execution
|
|
4963
|
+
* pauses and the widget auto-resumes it). Ignored when `enabled` is
|
|
4964
|
+
* `false`.
|
|
4965
|
+
*/
|
|
4966
|
+
expose?: boolean;
|
|
4967
|
+
/**
|
|
4968
|
+
* `auto` places follow-ups after the transcript in regular panels and above
|
|
4969
|
+
* the composer in composer-bar mode. Defaults to `auto`.
|
|
4970
|
+
*/
|
|
4971
|
+
placement?: "auto" | "after-message" | "composer";
|
|
4972
|
+
};
|
|
4973
|
+
/**
|
|
4974
|
+
* Structured suggestions configuration. The legacy `suggestionChips` and
|
|
4975
|
+
* `suggestionChipsConfig` fields remain supported for backwards compatibility.
|
|
4976
|
+
*/
|
|
4977
|
+
type AgentWidgetSuggestionsConfig = {
|
|
4978
|
+
starters?: AgentWidgetStarterSuggestionsConfig;
|
|
4979
|
+
followUps?: AgentWidgetFollowUpSuggestionsConfig;
|
|
4980
|
+
};
|
|
4679
4981
|
/**
|
|
4680
4982
|
* Interface for pluggable stream parsers that extract text from streaming responses.
|
|
4681
4983
|
* Parsers handle incremental parsing to extract text values from structured formats (JSON, XML, etc.).
|
|
@@ -5828,6 +6130,15 @@ type AgentWidgetConfig = {
|
|
|
5828
6130
|
*/
|
|
5829
6131
|
colorScheme?: 'auto' | 'light' | 'dark';
|
|
5830
6132
|
features?: AgentWidgetFeatureFlags;
|
|
6133
|
+
/**
|
|
6134
|
+
* Per-instance display overrides, applied over `features` through the
|
|
6135
|
+
* preference allowlist (security/capability keys cannot pass). String
|
|
6136
|
+
* `display` values replace the base rule subtree; objects refine it per
|
|
6137
|
+
* key. Each `controller.update({ preferences })` replaces the previous
|
|
6138
|
+
* slice wholesale (dropped keys revert to the base `features`); an
|
|
6139
|
+
* explicit-undefined patch clears it entirely.
|
|
6140
|
+
*/
|
|
6141
|
+
preferences?: WidgetPreferenceSlice;
|
|
5831
6142
|
/**
|
|
5832
6143
|
* When true, focus the chat input after the panel opens and the open animation completes.
|
|
5833
6144
|
* Applies to launcher mode (user click, controller.open(), autoExpand) and inline mode (on init).
|
|
@@ -5848,7 +6159,11 @@ type AgentWidgetConfig = {
|
|
|
5848
6159
|
* with `initialArtifacts`.
|
|
5849
6160
|
*/
|
|
5850
6161
|
initialSelectedArtifactId?: string | null;
|
|
6162
|
+
/** Rich starter and follow-up suggestion surfaces. */
|
|
6163
|
+
suggestions?: AgentWidgetSuggestionsConfig;
|
|
6164
|
+
/** @deprecated Prefer `suggestions.starters.items`. */
|
|
5851
6165
|
suggestionChips?: string[];
|
|
6166
|
+
/** @deprecated Prefer semantic tokens under `theme.components.suggestion`. */
|
|
5852
6167
|
suggestionChipsConfig?: AgentWidgetSuggestionChipsConfig;
|
|
5853
6168
|
debug?: boolean;
|
|
5854
6169
|
formEndpoint?: string;
|
|
@@ -6749,6 +7064,8 @@ type PersonaArtifactRecord = {
|
|
|
6749
7064
|
props?: Record<string, unknown>;
|
|
6750
7065
|
/** Present when this markdown artifact is a previewable file (see PersonaArtifactFileMeta). */
|
|
6751
7066
|
file?: PersonaArtifactFileMeta;
|
|
7067
|
+
/** Optional presentation metadata such as the producer's display-mode hint. */
|
|
7068
|
+
presentation?: PersonaArtifactPresentation;
|
|
6752
7069
|
};
|
|
6753
7070
|
/** Programmatic artifact upsert (controller / window API) */
|
|
6754
7071
|
type PersonaArtifactManualUpsert = {
|
|
@@ -6758,6 +7075,7 @@ type PersonaArtifactManualUpsert = {
|
|
|
6758
7075
|
content: string;
|
|
6759
7076
|
/** Optional file metadata for previewable file artifacts. */
|
|
6760
7077
|
file?: PersonaArtifactFileMeta;
|
|
7078
|
+
presentation?: PersonaArtifactPresentation;
|
|
6761
7079
|
/** Set false to update the registry/pane without a transcript block (pre-4.x behavior). */
|
|
6762
7080
|
transcript?: boolean;
|
|
6763
7081
|
} | {
|
|
@@ -6766,6 +7084,7 @@ type PersonaArtifactManualUpsert = {
|
|
|
6766
7084
|
title?: string;
|
|
6767
7085
|
component: string;
|
|
6768
7086
|
props?: Record<string, unknown>;
|
|
7087
|
+
presentation?: PersonaArtifactPresentation;
|
|
6769
7088
|
/** Set false to update the registry/pane without a transcript block (pre-4.x behavior). */
|
|
6770
7089
|
transcript?: boolean;
|
|
6771
7090
|
};
|
|
@@ -6913,6 +7232,19 @@ type Controller = {
|
|
|
6913
7232
|
* @deprecated Use injectMessage() instead.
|
|
6914
7233
|
*/
|
|
6915
7234
|
injectTestMessage: (event: AgentWidgetEvent) => void;
|
|
7235
|
+
/**
|
|
7236
|
+
* Show follow-up suggestions from host code. An ephemeral UI overlay: the
|
|
7237
|
+
* items never enter the transcript, the wire payload, or persisted state, so
|
|
7238
|
+
* they do not survive a refresh. Cleared automatically when the next user
|
|
7239
|
+
* message appends. Latest writer wins against the agent's `suggest_replies`
|
|
7240
|
+
* payloads: this call overrides chips shown now, and a payload arriving
|
|
7241
|
+
* afterwards overrides these. Renders through the `suggestions.followUps`
|
|
7242
|
+
* presentation config and the full plugin and `persona:suggestReplies:*`
|
|
7243
|
+
* event pipeline, with source `"host"`. An empty array clears.
|
|
7244
|
+
*/
|
|
7245
|
+
setFollowUpSuggestions: (items: AgentWidgetSuggestion[]) => void;
|
|
7246
|
+
/** Remove host-set follow-up suggestions. Agent-set chips are untouched. */
|
|
7247
|
+
clearFollowUpSuggestions: () => void;
|
|
6916
7248
|
getMessages: () => AgentWidgetMessage[];
|
|
6917
7249
|
getStatus: () => AgentWidgetSessionStatus;
|
|
6918
7250
|
getPersistentMetadata: () => Record<string, unknown>;
|
|
@@ -6982,7 +7314,7 @@ type AgentWidgetController = Controller;
|
|
|
6982
7314
|
* advanced preview system. Separate file for code-splitting.
|
|
6983
7315
|
*/
|
|
6984
7316
|
|
|
6985
|
-
type PreviewScene = 'home' | 'conversation' | 'minimized' | 'artifact';
|
|
7317
|
+
type PreviewScene = 'home' | 'conversation' | 'follow-ups' | 'minimized' | 'artifact';
|
|
6986
7318
|
|
|
6987
7319
|
/**
|
|
6988
7320
|
* Imperative preview renderer for the theme editor.
|