@runtypelabs/persona 4.14.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 +241 -16
- package/dist/context-mentions.d.ts +241 -16
- package/dist/context-mentions.js +11 -8
- package/dist/index.cjs +67 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +301 -41
- package/dist/index.d.ts +301 -41
- package/dist/index.global.js +59 -56
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +67 -66
- 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 +241 -16
- package/dist/smart-dom-reader.d.ts +241 -16
- package/dist/theme-editor-preview.cjs +66 -66
- package/dist/theme-editor-preview.d.cts +255 -17
- package/dist/theme-editor-preview.d.ts +255 -17
- package/dist/theme-editor-preview.js +56 -56
- package/dist/theme-editor.cjs +5 -5
- package/dist/theme-editor.d.cts +242 -17
- package/dist/theme-editor.d.ts +242 -17
- package/dist/theme-editor.js +7 -7
- 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/ask-user-question-tool.ts +10 -7
- package/src/components/artifact-preview.ts +1 -1
- package/src/components/composer-parts.test.ts +103 -4
- package/src/components/composer-parts.ts +53 -15
- 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 +18 -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 +10 -8
- package/src/styles/widget-styles.test.ts +162 -0
- package/src/styles/widget.css +430 -0
- package/src/suggest-replies-tool.test.ts +233 -2
- package/src/suggest-replies-tool.ts +115 -39
- 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 +33 -0
- package/src/theme-editor/sections.ts +53 -5
- package/src/theme-reference.ts +9 -2
- package/src/types/theme.ts +32 -0
- package/src/types.ts +152 -16
- package/src/ui.detached-panel.test.ts +1 -1
- package/src/ui.suggest-replies.test.ts +1066 -1
- package/src/ui.ts +268 -20
- 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 +24 -0
- package/src/utils/icons.test.ts +26 -0
- package/src/utils/icons.ts +8 -0
- package/src/utils/theme.test.ts +79 -0
- package/src/utils/tokens.ts +64 -0
- 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
|
};
|
|
@@ -3417,10 +3520,13 @@ type AgentWidgetFeatureFlags = {
|
|
|
3417
3520
|
*/
|
|
3418
3521
|
askUserQuestion?: AgentWidgetAskUserQuestionFeature;
|
|
3419
3522
|
/**
|
|
3420
|
-
* Built-in `suggest_replies`
|
|
3421
|
-
*
|
|
3422
|
-
*
|
|
3423
|
-
*
|
|
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.
|
|
3424
3530
|
*/
|
|
3425
3531
|
suggestReplies?: AgentWidgetSuggestRepliesFeature;
|
|
3426
3532
|
};
|
|
@@ -3460,11 +3566,12 @@ type WidgetPreferenceSlice = {
|
|
|
3460
3566
|
};
|
|
3461
3567
|
};
|
|
3462
3568
|
/**
|
|
3463
|
-
* Feature config for the built-in `suggest_replies`
|
|
3464
|
-
*
|
|
3465
|
-
*
|
|
3466
|
-
*
|
|
3467
|
-
*
|
|
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.
|
|
3468
3575
|
*/
|
|
3469
3576
|
type AgentWidgetSuggestRepliesFeature = {
|
|
3470
3577
|
/**
|
|
@@ -3472,14 +3579,18 @@ type AgentWidgetSuggestRepliesFeature = {
|
|
|
3472
3579
|
* renders as a regular tool bubble and is NOT auto-resumed: only set this
|
|
3473
3580
|
* with no server-side `suggest_replies` declaration, or the execution
|
|
3474
3581
|
* parks awaiting a resume that never comes.
|
|
3582
|
+
* @deprecated Use `suggestions.followUps.enabled`.
|
|
3475
3583
|
*/
|
|
3476
3584
|
enabled?: boolean;
|
|
3477
3585
|
/**
|
|
3478
3586
|
* Advertise the built-in `suggest_replies` tool to the agent on every
|
|
3479
3587
|
* dispatch via `clientTools[]`: no server-side `runtimeTools` declaration
|
|
3480
|
-
* needed. Defaults to `false
|
|
3481
|
-
*
|
|
3482
|
-
*
|
|
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`.
|
|
3483
3594
|
*/
|
|
3484
3595
|
expose?: boolean;
|
|
3485
3596
|
};
|
|
@@ -3549,10 +3660,13 @@ type AgentWidgetAskUserQuestionFeature = {
|
|
|
3549
3660
|
* matching {@link AskUserQuestionPayload}; when the model calls it, the
|
|
3550
3661
|
* existing answer-pill sheet renders and the answer resumes the execution.
|
|
3551
3662
|
*
|
|
3552
|
-
* Defaults to `false
|
|
3553
|
-
*
|
|
3554
|
-
*
|
|
3555
|
-
*
|
|
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.
|
|
3556
3670
|
*/
|
|
3557
3671
|
expose?: boolean;
|
|
3558
3672
|
/** Slide-in animation duration in ms. Defaults to 180. */
|
|
@@ -4025,6 +4139,10 @@ type AgentWidgetSendButtonConfig = {
|
|
|
4025
4139
|
paddingY?: string;
|
|
4026
4140
|
iconText?: string;
|
|
4027
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;
|
|
4028
4146
|
useIcon?: boolean;
|
|
4029
4147
|
tooltipText?: string;
|
|
4030
4148
|
showTooltip?: boolean;
|
|
@@ -4757,6 +4875,109 @@ type AgentWidgetSuggestionChipsConfig = {
|
|
|
4757
4875
|
paddingX?: string;
|
|
4758
4876
|
paddingY?: string;
|
|
4759
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
|
+
};
|
|
4760
4981
|
/**
|
|
4761
4982
|
* Interface for pluggable stream parsers that extract text from streaming responses.
|
|
4762
4983
|
* Parsers handle incremental parsing to extract text values from structured formats (JSON, XML, etc.).
|
|
@@ -5938,7 +6159,11 @@ type AgentWidgetConfig = {
|
|
|
5938
6159
|
* with `initialArtifacts`.
|
|
5939
6160
|
*/
|
|
5940
6161
|
initialSelectedArtifactId?: string | null;
|
|
6162
|
+
/** Rich starter and follow-up suggestion surfaces. */
|
|
6163
|
+
suggestions?: AgentWidgetSuggestionsConfig;
|
|
6164
|
+
/** @deprecated Prefer `suggestions.starters.items`. */
|
|
5941
6165
|
suggestionChips?: string[];
|
|
6166
|
+
/** @deprecated Prefer semantic tokens under `theme.components.suggestion`. */
|
|
5942
6167
|
suggestionChipsConfig?: AgentWidgetSuggestionChipsConfig;
|
|
5943
6168
|
debug?: boolean;
|
|
5944
6169
|
formEndpoint?: string;
|
|
@@ -7007,6 +7232,19 @@ type Controller = {
|
|
|
7007
7232
|
* @deprecated Use injectMessage() instead.
|
|
7008
7233
|
*/
|
|
7009
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;
|
|
7010
7248
|
getMessages: () => AgentWidgetMessage[];
|
|
7011
7249
|
getStatus: () => AgentWidgetSessionStatus;
|
|
7012
7250
|
getPersistentMetadata: () => Record<string, unknown>;
|
|
@@ -7076,7 +7314,7 @@ type AgentWidgetController = Controller;
|
|
|
7076
7314
|
* advanced preview system. Separate file for code-splitting.
|
|
7077
7315
|
*/
|
|
7078
7316
|
|
|
7079
|
-
type PreviewScene = 'home' | 'conversation' | 'minimized' | 'artifact';
|
|
7317
|
+
type PreviewScene = 'home' | 'conversation' | 'follow-ups' | 'minimized' | 'artifact';
|
|
7080
7318
|
|
|
7081
7319
|
/**
|
|
7082
7320
|
* Imperative preview renderer for the theme editor.
|