@runtypelabs/persona 4.15.0 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/context-mentions.d.cts +283 -9
- package/dist/context-mentions.d.ts +283 -9
- package/dist/index.cjs +68 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +299 -10
- package/dist/index.d.ts +299 -10
- package/dist/index.global.js +57 -57
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +69 -69
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js +2 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/smart-dom-reader.d.cts +283 -9
- package/dist/smart-dom-reader.d.ts +283 -9
- package/dist/testing.cjs +3 -3
- package/dist/testing.d.cts +7 -0
- package/dist/testing.d.ts +7 -0
- package/dist/testing.js +3 -3
- package/dist/theme-editor-preview.cjs +64 -64
- package/dist/theme-editor-preview.d.cts +283 -9
- package/dist/theme-editor-preview.d.ts +283 -9
- package/dist/theme-editor-preview.js +56 -56
- package/dist/theme-editor.cjs +10 -10
- package/dist/theme-editor.d.cts +283 -10
- package/dist/theme-editor.d.ts +283 -10
- package/dist/theme-editor.js +10 -10
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +66 -3
- package/dist/theme-reference.d.ts +66 -3
- package/dist/theme-reference.js +1 -1
- package/dist/widget.css +1 -1
- package/package.json +1 -1
- package/src/components/artifact-pane.test.ts +27 -0
- package/src/components/artifact-pane.ts +7 -3
- package/src/components/header-builder.ts +27 -2
- package/src/components/header-layouts.test.ts +56 -0
- package/src/components/header-layouts.ts +29 -9
- package/src/components/launcher-surface.test.ts +403 -0
- package/src/components/launcher.ts +297 -2
- package/src/components/panel.ts +69 -74
- package/src/components/suggestions.test.ts +40 -0
- package/src/components/suggestions.ts +213 -153
- package/src/components/welcome.test.ts +121 -0
- package/src/components/welcome.ts +305 -0
- package/src/components/widget-view.test.ts +5 -3
- package/src/components/widget-view.ts +14 -7
- package/src/defaults.ts +2 -2
- package/src/index-core.ts +12 -1
- package/src/launcher-global.ts +10 -7
- package/src/plugins/types.ts +66 -1
- package/src/styles/widget-styles.test.ts +220 -0
- package/src/styles/widget.css +353 -9
- package/src/testing/mock-stream.test.ts +19 -0
- package/src/testing/mock-stream.ts +20 -0
- package/src/theme-editor/sections.ts +30 -1
- package/src/theme-reference.ts +26 -4
- package/src/types/theme.ts +40 -3
- package/src/types.ts +164 -6
- package/src/ui.body-top-slot.test.ts +95 -0
- package/src/ui.content-width.test.ts +91 -0
- package/src/ui.docked.test.ts +7 -4
- package/src/ui.launcher-teaser.test.ts +162 -0
- package/src/ui.rebuild-composer.test.ts +491 -0
- package/src/ui.render-welcome.test.ts +505 -0
- package/src/ui.scroll-additive.test.ts +91 -21
- package/src/ui.scroll.test.ts +302 -14
- package/src/ui.suggest-replies.test.ts +46 -0
- package/src/ui.ts +747 -136
- package/src/ui.welcome.test.ts +504 -0
- package/src/utils/artifact-gate.test.ts +27 -0
- package/src/utils/artifact-gate.ts +9 -0
- package/src/utils/attachment-manager.test.ts +37 -0
- package/src/utils/attachment-manager.ts +15 -0
- package/src/utils/auto-follow.test.ts +23 -0
- package/src/utils/auto-follow.ts +11 -1
- package/src/utils/config-merge.ts +2 -0
- package/src/utils/content-width.test.ts +37 -0
- package/src/utils/content-width.ts +17 -0
- package/src/utils/plugin-storage.test.ts +94 -0
- package/src/utils/plugin-storage.ts +98 -0
- package/src/utils/theme.test.ts +137 -0
- package/src/utils/tokens.ts +49 -3
- package/src/welcome.test.ts +213 -0
- package/src/welcome.ts +130 -0
|
@@ -269,6 +269,27 @@ interface SmartDomAdapterOptions {
|
|
|
269
269
|
*/
|
|
270
270
|
declare function smartDomResultToEnriched(result: SmartDOMResult, opts?: SmartDomAdapterOptions): EnrichedPageElement[];
|
|
271
271
|
|
|
272
|
+
interface ResolvedWelcomeConfig {
|
|
273
|
+
title: string;
|
|
274
|
+
subtitle: string;
|
|
275
|
+
icon?: AgentWidgetWelcomeIcon;
|
|
276
|
+
variant: AgentWidgetWelcomeVariant;
|
|
277
|
+
dismiss: AgentWidgetWelcomeDismiss;
|
|
278
|
+
/** Undefined under `variant: "hero"`, which suppresses the greeting. */
|
|
279
|
+
message?: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Synchronous key-value store handed to plugin render hooks. Backed by
|
|
284
|
+
* `localStorage`, namespaced per plugin id. The async `storageAdapter` cannot
|
|
285
|
+
* back a synchronous API and `persistState` is not a general key-value surface.
|
|
286
|
+
*/
|
|
287
|
+
interface AgentWidgetPluginStorage {
|
|
288
|
+
get: (key: string) => string | null;
|
|
289
|
+
set: (key: string, value: string) => void;
|
|
290
|
+
remove: (key: string) => void;
|
|
291
|
+
}
|
|
292
|
+
|
|
272
293
|
type AgentWidgetTransformSuggestionsContext = {
|
|
273
294
|
/**
|
|
274
295
|
* Fresh copy of the suggestions entering this plugin, already normalized:
|
|
@@ -296,6 +317,27 @@ type AgentWidgetRenderSuggestionContext = {
|
|
|
296
317
|
*/
|
|
297
318
|
select: () => void;
|
|
298
319
|
};
|
|
320
|
+
type AgentWidgetRenderWelcomeContext = {
|
|
321
|
+
/** Alias-resolved welcome config; never the raw `copy.welcome*` shape. */
|
|
322
|
+
config: ResolvedWelcomeConfig;
|
|
323
|
+
variant: AgentWidgetWelcomeVariant;
|
|
324
|
+
/** Derived visibility for this render; governs the default renderer only. */
|
|
325
|
+
visible: boolean;
|
|
326
|
+
/** The core-owned welcome card, live-updated by `controller.update()`. */
|
|
327
|
+
defaultRenderer: () => HTMLElement;
|
|
328
|
+
sendMessage: (text: string) => void;
|
|
329
|
+
/** Re-run welcome arbitration: cleanups run, previous content is removed. */
|
|
330
|
+
requestRender: () => void;
|
|
331
|
+
/**
|
|
332
|
+
* Persona's starter renderer, wired through the full select pipeline:
|
|
333
|
+
* `onSuggestionSelect`, cancelable `persona:suggestion:*` events, send/fill.
|
|
334
|
+
*/
|
|
335
|
+
renderStarter: (suggestion: AgentWidgetSuggestion) => HTMLElement;
|
|
336
|
+
/** Sync store namespaced by `persistState.keyPrefix` plus the plugin id. */
|
|
337
|
+
storage: AgentWidgetPluginStorage;
|
|
338
|
+
/** Teardown for this render; runs before the next one and on destroy. */
|
|
339
|
+
onCleanup: (fn: () => void) => void;
|
|
340
|
+
};
|
|
299
341
|
type AgentWidgetSuggestionSelectContext = {
|
|
300
342
|
suggestion: AgentWidgetResolvedSuggestion;
|
|
301
343
|
surface: AgentWidgetSuggestionSurface;
|
|
@@ -352,6 +394,34 @@ interface AgentWidgetPlugin {
|
|
|
352
394
|
defaultRenderer: () => HTMLElement;
|
|
353
395
|
onToggle: () => void;
|
|
354
396
|
}) => HTMLElement | null;
|
|
397
|
+
/**
|
|
398
|
+
* Custom renderer for the welcome surface (card, hero, greeting stack).
|
|
399
|
+
* First plugin returning an element wins; null falls through to the default,
|
|
400
|
+
* same contract as `renderSuggestion`.
|
|
401
|
+
*
|
|
402
|
+
* The core owns the welcome host: it stays mounted for the panel's lifetime
|
|
403
|
+
* and content is swapped inside it. A plugin element renders regardless of
|
|
404
|
+
* `ctx.visible` (derived visibility governs the default renderer only) and
|
|
405
|
+
* the host overlays the transcript while that element is active, so a home
|
|
406
|
+
* screen can return over an existing conversation. Return null again to
|
|
407
|
+
* clear the overlay.
|
|
408
|
+
*
|
|
409
|
+
* The ctx carries no controller: plugins are host-instantiated, so close a
|
|
410
|
+
* factory over the init handle (`plugin.attach(controller)`).
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```typescript
|
|
414
|
+
* renderWelcome: ({ config, renderStarter, requestRender, onCleanup }) => {
|
|
415
|
+
* const root = document.createElement("div");
|
|
416
|
+
* root.textContent = config.title;
|
|
417
|
+
* root.appendChild(renderStarter({ label: "Track my order" }));
|
|
418
|
+
* const timer = setInterval(requestRender, 60_000);
|
|
419
|
+
* onCleanup(() => clearInterval(timer));
|
|
420
|
+
* return root;
|
|
421
|
+
* }
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
renderWelcome?: (context: AgentWidgetRenderWelcomeContext) => HTMLElement | null;
|
|
355
425
|
/**
|
|
356
426
|
* Custom renderer for panel header
|
|
357
427
|
* Return null to use default renderer
|
|
@@ -396,6 +466,15 @@ interface AgentWidgetPlugin {
|
|
|
396
466
|
* Omitted when `config.voiceRecognition.enabled` is not true.
|
|
397
467
|
*/
|
|
398
468
|
onVoiceToggle?: () => void;
|
|
469
|
+
/**
|
|
470
|
+
* Re-run composer arbitration and swap the footer in place. The hook runs
|
|
471
|
+
* once at panel construction, so this is how a composer plugin unlocks
|
|
472
|
+
* (returns null) or re-renders later. Pending attachments, the mention
|
|
473
|
+
* affordances, and the composer listener registry are re-wired by the core.
|
|
474
|
+
*/
|
|
475
|
+
requestRender: () => void;
|
|
476
|
+
/** Same sync store as the `renderWelcome` ctx, namespaced per plugin id. */
|
|
477
|
+
storage: AgentWidgetPluginStorage;
|
|
399
478
|
}) => HTMLElement | null;
|
|
400
479
|
/**
|
|
401
480
|
* Custom renderer for reasoning bubbles
|
|
@@ -776,6 +855,15 @@ interface PanelTokens extends ComponentTokenSet {
|
|
|
776
855
|
/** Background of the region revealed behind a detached panel. */
|
|
777
856
|
canvasBackground?: string;
|
|
778
857
|
}
|
|
858
|
+
/** Per-element text styling shared by themable text surfaces. */
|
|
859
|
+
interface TextStyleTokens {
|
|
860
|
+
fontFamily?: string;
|
|
861
|
+
fontSize?: string;
|
|
862
|
+
fontWeight?: string;
|
|
863
|
+
lineHeight?: string;
|
|
864
|
+
letterSpacing?: string;
|
|
865
|
+
color?: TokenReference<'color'>;
|
|
866
|
+
}
|
|
779
867
|
interface HeaderTokens extends ComponentTokenSet {
|
|
780
868
|
background: TokenReference<'color'>;
|
|
781
869
|
border: TokenReference<'color'>;
|
|
@@ -784,10 +872,14 @@ interface HeaderTokens extends ComponentTokenSet {
|
|
|
784
872
|
iconBackground: TokenReference<'color'>;
|
|
785
873
|
/** Foreground (glyph stroke or emoji text) on the header avatar tile. */
|
|
786
874
|
iconForeground: TokenReference<'color'>;
|
|
787
|
-
/**
|
|
875
|
+
/** Legacy alias of `title.color`; `title.color` wins when both are set. */
|
|
788
876
|
titleForeground: TokenReference<'color'>;
|
|
789
|
-
/**
|
|
877
|
+
/** Legacy alias of `subtitle.color`; `subtitle.color` wins when both are set. */
|
|
790
878
|
subtitleForeground: TokenReference<'color'>;
|
|
879
|
+
/** Header title typography (next to the icon, or minimal layout title). */
|
|
880
|
+
title?: TextStyleTokens;
|
|
881
|
+
/** Header subtitle typography, for the line under the title. */
|
|
882
|
+
subtitle?: TextStyleTokens;
|
|
791
883
|
/** Default color for clear / close icon buttons when launcher overrides are unset. */
|
|
792
884
|
actionIconForeground: TokenReference<'color'>;
|
|
793
885
|
/** Box-shadow on the header (e.g., a fade shadow to replace the default border). */
|
|
@@ -817,7 +909,7 @@ interface MessageTokens {
|
|
|
817
909
|
}
|
|
818
910
|
/**
|
|
819
911
|
* Welcome / intro card rendered above the message list when no messages exist.
|
|
820
|
-
* Set `
|
|
912
|
+
* Set `welcome.variant: "none"` to hide it; use `layout.slots["body-top"]`
|
|
821
913
|
* to replace it wholesale.
|
|
822
914
|
*/
|
|
823
915
|
interface IntroCardTokens extends ComponentTokenSet {
|
|
@@ -826,6 +918,12 @@ interface IntroCardTokens extends ComponentTokenSet {
|
|
|
826
918
|
padding?: TokenReference<'spacing'>;
|
|
827
919
|
/** Box-shadow on the intro card (token ref or raw CSS, e.g. `none`). */
|
|
828
920
|
shadow?: string;
|
|
921
|
+
/** Full border shorthand on the intro card (raw CSS, e.g. `"1px solid rgba(0,0,0,0.1)"`). @default "none" */
|
|
922
|
+
border?: string;
|
|
923
|
+
/** Welcome title typography. */
|
|
924
|
+
title?: TextStyleTokens;
|
|
925
|
+
/** Welcome subtitle typography. */
|
|
926
|
+
subtitle?: TextStyleTokens;
|
|
829
927
|
}
|
|
830
928
|
/** Collapsible widget chrome (tool bubbles, reasoning bubbles, approval bubbles). */
|
|
831
929
|
interface CollapsibleWidgetTokens {
|
|
@@ -868,6 +966,8 @@ interface MarkdownTokens {
|
|
|
868
966
|
background?: TokenReference<'color'>;
|
|
869
967
|
borderColor?: TokenReference<'color'>;
|
|
870
968
|
textColor?: TokenReference<'color'>;
|
|
969
|
+
/** Corner radius; follows `palette.radius.md` by default so square-corner themes get square code blocks. */
|
|
970
|
+
borderRadius?: TokenReference<'radius'>;
|
|
871
971
|
};
|
|
872
972
|
/** Table styling. */
|
|
873
973
|
table?: {
|
|
@@ -925,10 +1025,19 @@ interface ToolBubbleTokens {
|
|
|
925
1025
|
interface ReasoningBubbleTokens {
|
|
926
1026
|
shadow: string;
|
|
927
1027
|
}
|
|
1028
|
+
/** Scrollbar appearance shared by every scroller in the widget. */
|
|
1029
|
+
interface ScrollbarTokens {
|
|
1030
|
+
/** Thumb color. @default semantic.colors.border */
|
|
1031
|
+
thumb?: TokenReference<'color'>;
|
|
1032
|
+
/** Track color. @default "transparent" */
|
|
1033
|
+
track?: TokenReference<'color'>;
|
|
1034
|
+
}
|
|
928
1035
|
/** Composer (message input) chrome. */
|
|
929
1036
|
interface ComposerChromeTokens {
|
|
930
1037
|
/** Box-shadow on the composer form (raw CSS, e.g. `none`). */
|
|
931
1038
|
shadow: string;
|
|
1039
|
+
/** Border color of the composer form. @default semantic.colors.border */
|
|
1040
|
+
borderColor?: TokenReference<'color'>;
|
|
932
1041
|
/** Inner padding of the composer form (raw CSS shorthand). @default "0.75rem 1rem" */
|
|
933
1042
|
padding?: string;
|
|
934
1043
|
/** Gap between the textarea row and the actions row. @default "0.5rem" */
|
|
@@ -1088,7 +1197,10 @@ interface ScrollToBottomTokens extends ComponentTokenSet {
|
|
|
1088
1197
|
}
|
|
1089
1198
|
/** Visual tokens shared by one suggestion presentation variant. */
|
|
1090
1199
|
interface SuggestionVariantTokens extends ComponentTokenSet {
|
|
1200
|
+
/** Space inside one item, between its icon and its copy. */
|
|
1091
1201
|
gap?: string;
|
|
1202
|
+
/** Space between suggestion items in the container. */
|
|
1203
|
+
itemGap?: string;
|
|
1092
1204
|
minHeight?: string;
|
|
1093
1205
|
fontSize?: string;
|
|
1094
1206
|
lineHeight?: string;
|
|
@@ -1130,6 +1242,8 @@ interface ComponentTokens {
|
|
|
1130
1242
|
toolBubble: ToolBubbleTokens;
|
|
1131
1243
|
reasoningBubble: ReasoningBubbleTokens;
|
|
1132
1244
|
composer: ComposerChromeTokens;
|
|
1245
|
+
/** Scrollbar appearance for every scroller in the widget. */
|
|
1246
|
+
scrollbar?: ScrollbarTokens;
|
|
1133
1247
|
/** Icon button styling tokens. */
|
|
1134
1248
|
iconButton?: IconButtonTokens;
|
|
1135
1249
|
/** Label button styling tokens. */
|
|
@@ -2738,6 +2852,13 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2738
2852
|
* @default 520
|
|
2739
2853
|
*/
|
|
2740
2854
|
narrowHostMaxWidth?: number;
|
|
2855
|
+
/**
|
|
2856
|
+
* Width of the slide-over artifact drawer (the narrow-host and mobile
|
|
2857
|
+
* presentations; `paneWidth`/`paneMaxWidth` only size the desktop split).
|
|
2858
|
+
* CSS length; `"100%"` makes the drawer cover the whole panel.
|
|
2859
|
+
* @default min(calc(100% - 1rem), 22rem)
|
|
2860
|
+
*/
|
|
2861
|
+
drawerWidth?: string;
|
|
2741
2862
|
/**
|
|
2742
2863
|
* When true (default), widen the launcher panel while artifacts are visible and not user-dismissed.
|
|
2743
2864
|
* No-op for inline embed (`launcher.enabled === false`).
|
|
@@ -3366,6 +3487,18 @@ type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
|
|
|
3366
3487
|
* restored thread opens at a readable place rather than at the very bottom.
|
|
3367
3488
|
*/
|
|
3368
3489
|
type AgentWidgetScrollRestorePosition = "bottom" | "last-user-turn";
|
|
3490
|
+
/**
|
|
3491
|
+
* Scrollbar visibility policy for every scroll surface in the widget.
|
|
3492
|
+
*
|
|
3493
|
+
* - `"on-scroll"` hides bars at rest and reveals them on genuine reader
|
|
3494
|
+
* input, keeping them visible while the reader is away from the resting
|
|
3495
|
+
* position: overlay-scrollbar semantics on every platform.
|
|
3496
|
+
* - `"auto"` keeps the themed bar under native visibility semantics: overlay
|
|
3497
|
+
* platforms still auto-hide, classic-scrollbar platforms (Windows,
|
|
3498
|
+
* always-show macOS) show it persistently.
|
|
3499
|
+
* - `"hidden"` never shows an indicator. Scrolling itself is unaffected.
|
|
3500
|
+
*/
|
|
3501
|
+
type AgentWidgetScrollbarPolicy = "on-scroll" | "auto" | "hidden";
|
|
3369
3502
|
type AgentWidgetScrollBehaviorFeature = {
|
|
3370
3503
|
/** Scroll behavior during streamed responses. @default "anchor-top" */
|
|
3371
3504
|
mode?: AgentWidgetScrollMode;
|
|
@@ -3410,6 +3543,13 @@ type AgentWidgetScrollBehaviorFeature = {
|
|
|
3410
3543
|
* @default false
|
|
3411
3544
|
*/
|
|
3412
3545
|
announce?: boolean;
|
|
3546
|
+
/**
|
|
3547
|
+
* Scrollbar visibility policy, applied to the transcript and every inner
|
|
3548
|
+
* scroller through one root attribute. Themable via
|
|
3549
|
+
* `--persona-scrollbar-thumb` and `--persona-scrollbar-track`.
|
|
3550
|
+
* @default "on-scroll"
|
|
3551
|
+
*/
|
|
3552
|
+
scrollbar?: AgentWidgetScrollbarPolicy;
|
|
3413
3553
|
};
|
|
3414
3554
|
type AgentWidgetScrollToBottomFeature = {
|
|
3415
3555
|
/**
|
|
@@ -4310,6 +4450,57 @@ type AgentWidgetLauncherConfig = {
|
|
|
4310
4450
|
* @example "min(380px, calc(100vw - 48px))"
|
|
4311
4451
|
*/
|
|
4312
4452
|
collapsedMaxWidth?: string;
|
|
4453
|
+
/**
|
|
4454
|
+
* Proactive nudge bubble anchored above the collapsed floating launcher.
|
|
4455
|
+
* Omit it (the default) and no teaser renders.
|
|
4456
|
+
*/
|
|
4457
|
+
teaser?: AgentWidgetLauncherTeaserConfig;
|
|
4458
|
+
};
|
|
4459
|
+
/**
|
|
4460
|
+
* Launcher teaser: a small bubble above the collapsed launcher. Clicking it
|
|
4461
|
+
* opens the panel and consumes the teaser exactly like an explicit dismissal.
|
|
4462
|
+
* Within a single page load the teaser appears at most once under either
|
|
4463
|
+
* frequency.
|
|
4464
|
+
*
|
|
4465
|
+
* @example
|
|
4466
|
+
* ```typescript
|
|
4467
|
+
* launcher: {
|
|
4468
|
+
* teaser: { text: "Need a hand picking a plan?", delayMs: 3000 }
|
|
4469
|
+
* }
|
|
4470
|
+
* ```
|
|
4471
|
+
*/
|
|
4472
|
+
type AgentWidgetLauncherTeaserConfig = {
|
|
4473
|
+
/** Bubble copy. An empty string renders no teaser. */
|
|
4474
|
+
text: string;
|
|
4475
|
+
/**
|
|
4476
|
+
* Delay before the bubble appears, in milliseconds.
|
|
4477
|
+
* @default 0
|
|
4478
|
+
*/
|
|
4479
|
+
delayMs?: number;
|
|
4480
|
+
/**
|
|
4481
|
+
* How often the teaser may return.
|
|
4482
|
+
*
|
|
4483
|
+
* `"once"`: a dismissal or a click-through is remembered in `localStorage`
|
|
4484
|
+
* under `` `${persistState.keyPrefix ?? "persona-"}teaser-dismissed` `` and
|
|
4485
|
+
* the teaser never returns on that browser. `"always"`: shows on every page
|
|
4486
|
+
* load, tracked in memory only. `persistState: false` downgrades `"once"` to
|
|
4487
|
+
* in-memory too, so the teaser reappears each load.
|
|
4488
|
+
*
|
|
4489
|
+
* Custom `storageAdapter` implementations do not participate in teaser state.
|
|
4490
|
+
*
|
|
4491
|
+
* @default "once"
|
|
4492
|
+
*/
|
|
4493
|
+
frequency?: "once" | "always";
|
|
4494
|
+
/**
|
|
4495
|
+
* Render an x affordance that dismisses the teaser without opening the panel.
|
|
4496
|
+
* @default true
|
|
4497
|
+
*/
|
|
4498
|
+
dismissible?: boolean;
|
|
4499
|
+
/**
|
|
4500
|
+
* Accessible label for the dismiss affordance.
|
|
4501
|
+
* @default "Dismiss message"
|
|
4502
|
+
*/
|
|
4503
|
+
dismissLabel?: string;
|
|
4313
4504
|
};
|
|
4314
4505
|
type AgentWidgetSendButtonConfig = {
|
|
4315
4506
|
borderWidth?: string;
|
|
@@ -5053,7 +5244,10 @@ type AgentWidgetSuggestion = string | {
|
|
|
5053
5244
|
label: string;
|
|
5054
5245
|
/** Text placed in the composer or sent. Defaults to `label`. */
|
|
5055
5246
|
prompt?: string;
|
|
5056
|
-
/**
|
|
5247
|
+
/**
|
|
5248
|
+
* Optional supporting copy, most useful with the `card` variant. The
|
|
5249
|
+
* `chip` variant ignores it and renders the label alone.
|
|
5250
|
+
*/
|
|
5057
5251
|
description?: string;
|
|
5058
5252
|
/** Optional icon from Persona's bundled Lucide registry. */
|
|
5059
5253
|
icon?: IconName;
|
|
@@ -5097,9 +5291,10 @@ type AgentWidgetSuggestionSurfaceConfig = {
|
|
|
5097
5291
|
/** Default click behavior, overridable per item. Defaults to `send`. */
|
|
5098
5292
|
behavior?: AgentWidgetSuggestionBehavior;
|
|
5099
5293
|
/**
|
|
5100
|
-
* Layout for items past the surface width. Defaults to `wrap`
|
|
5101
|
-
*
|
|
5102
|
-
* `card` and `list` layouts manage their
|
|
5294
|
+
* Layout for items past the surface width. Defaults to `wrap` on every
|
|
5295
|
+
* surface; `scroll` opts into a horizontal strip for large sets. Applies
|
|
5296
|
+
* to the `chip` variant only; the `card` and `list` layouts manage their
|
|
5297
|
+
* own stacking.
|
|
5103
5298
|
*/
|
|
5104
5299
|
overflow?: "scroll" | "wrap";
|
|
5105
5300
|
/** Maximum visible items. Defaults to 4. */
|
|
@@ -5148,6 +5343,70 @@ type AgentWidgetSuggestionsConfig = {
|
|
|
5148
5343
|
starters?: AgentWidgetStarterSuggestionsConfig;
|
|
5149
5344
|
followUps?: AgentWidgetFollowUpSuggestionsConfig;
|
|
5150
5345
|
};
|
|
5346
|
+
/**
|
|
5347
|
+
* Which welcome surface renders.
|
|
5348
|
+
* `"card"` is the top-of-scroll intro card (default, back-compatible),
|
|
5349
|
+
* `"hero"` centers it in the empty conversation, `"none"` renders no surface.
|
|
5350
|
+
*/
|
|
5351
|
+
type AgentWidgetWelcomeVariant = "card" | "hero" | "none";
|
|
5352
|
+
/**
|
|
5353
|
+
* When the welcome surface goes away. `"never"` is the default for `"card"`;
|
|
5354
|
+
* `"on-first-message"` is the default for `"hero"` and cannot be overridden
|
|
5355
|
+
* there.
|
|
5356
|
+
*/
|
|
5357
|
+
type AgentWidgetWelcomeDismiss = "never" | "on-first-message";
|
|
5358
|
+
/**
|
|
5359
|
+
* Avatar or logo shown above the welcome title. Discriminated union; the
|
|
5360
|
+
* function form is the escape hatch for custom markup. There is deliberately
|
|
5361
|
+
* no raw HTML string variant (sanitization surface plus accessibility hole).
|
|
5362
|
+
*/
|
|
5363
|
+
type AgentWidgetWelcomeIcon = {
|
|
5364
|
+
type: "lucide";
|
|
5365
|
+
name: IconName;
|
|
5366
|
+
}
|
|
5367
|
+
/** `alt` is required, and may be `""` for a decorative logo. */
|
|
5368
|
+
| {
|
|
5369
|
+
type: "image";
|
|
5370
|
+
url: string;
|
|
5371
|
+
alt: string;
|
|
5372
|
+
}
|
|
5373
|
+
/** Emoji or short text glyph. */
|
|
5374
|
+
| {
|
|
5375
|
+
type: "text";
|
|
5376
|
+
text: string;
|
|
5377
|
+
} | (() => HTMLElement | SVGElement);
|
|
5378
|
+
/**
|
|
5379
|
+
* First-open welcome surface. Consolidates the deprecated
|
|
5380
|
+
* `copy.welcomeTitle` / `copy.welcomeSubtitle` / `copy.showWelcomeCard`
|
|
5381
|
+
* options; a field present here wins over its legacy alias.
|
|
5382
|
+
*
|
|
5383
|
+
* All defaults live in the resolver (`resolveWelcomeConfig`), never in
|
|
5384
|
+
* `DEFAULT_WIDGET_CONFIG`: presence on this object is what distinguishes a
|
|
5385
|
+
* host-set value from a filled-in default.
|
|
5386
|
+
*/
|
|
5387
|
+
interface AgentWidgetWelcomeConfig {
|
|
5388
|
+
/** Card or hero title. Defaults to "Hello 👋". */
|
|
5389
|
+
title?: string;
|
|
5390
|
+
/** Scope statement in the assistant's voice. Empty string omits it. */
|
|
5391
|
+
subtitle?: string;
|
|
5392
|
+
/** Avatar or logo shown above the title. */
|
|
5393
|
+
icon?: AgentWidgetWelcomeIcon;
|
|
5394
|
+
/** @default "card" */
|
|
5395
|
+
variant?: AgentWidgetWelcomeVariant;
|
|
5396
|
+
/** @default "never" for `card`, always `"on-first-message"` for `hero`. */
|
|
5397
|
+
dismiss?: AgentWidgetWelcomeDismiss;
|
|
5398
|
+
/**
|
|
5399
|
+
* Display-only greeting bubble pinned at transcript position zero. It is UI
|
|
5400
|
+
* chrome derived from config, never a session message: it does not appear in
|
|
5401
|
+
* `getMessages()`, is never persisted or sent to the model, `onMessage` does
|
|
5402
|
+
* not fire for it, and it survives `clearChat()`. Use an assistant
|
|
5403
|
+
* `initialMessages` entry instead when the model should see the greeting.
|
|
5404
|
+
*
|
|
5405
|
+
* Ignored (with a debug-mode warning) when `variant` is `"hero"`: the hero
|
|
5406
|
+
* is the greeting.
|
|
5407
|
+
*/
|
|
5408
|
+
message?: string;
|
|
5409
|
+
}
|
|
5151
5410
|
/**
|
|
5152
5411
|
* Interface for pluggable stream parsers that extract text from streaming responses.
|
|
5153
5412
|
* Parsers handle incremental parsing to extract text values from structured formats (JSON, XML, etc.).
|
|
@@ -5329,7 +5588,9 @@ type AgentWidgetHeaderLayoutConfig = {
|
|
|
5329
5588
|
*/
|
|
5330
5589
|
render?: (context: HeaderRenderContext) => HTMLElement;
|
|
5331
5590
|
/**
|
|
5332
|
-
*
|
|
5591
|
+
* Icon action buttons at the trailing edge of the `minimal` header layout,
|
|
5592
|
+
* clustered with the close button and sharing its chrome. For a menu
|
|
5593
|
+
* affordance next to the title, use `titleMenu` instead.
|
|
5333
5594
|
*/
|
|
5334
5595
|
trailingActions?: AgentWidgetHeaderTrailingAction[];
|
|
5335
5596
|
/** Called when a `trailingActions` button is clicked. */
|
|
@@ -5509,7 +5770,11 @@ type AgentWidgetLayoutConfig = {
|
|
|
5509
5770
|
/**
|
|
5510
5771
|
* Max width for the content area (messages + composer).
|
|
5511
5772
|
* Applied with `margin: 0 auto` for centering.
|
|
5512
|
-
* Accepts any CSS width value (e.g. "90ch", "720px", "80%")
|
|
5773
|
+
* Accepts any CSS width value (e.g. "90ch", "720px", "80%"), or "none"
|
|
5774
|
+
* for a full-width column. Only engages on panels wider than the cap,
|
|
5775
|
+
* so launcher-width panels are unaffected.
|
|
5776
|
+
* @default "768px" ("720px" in composer-bar mode via
|
|
5777
|
+
* `launcher.composerBar.contentMaxWidth`)
|
|
5513
5778
|
*/
|
|
5514
5779
|
contentMaxWidth?: string;
|
|
5515
5780
|
};
|
|
@@ -6257,7 +6522,9 @@ type AgentWidgetConfig = {
|
|
|
6257
6522
|
*/
|
|
6258
6523
|
getHeaders?: AgentWidgetHeadersFunction;
|
|
6259
6524
|
copy?: {
|
|
6525
|
+
/** @deprecated Use `welcome.title`. */
|
|
6260
6526
|
welcomeTitle?: string;
|
|
6527
|
+
/** @deprecated Use `welcome.subtitle`. */
|
|
6261
6528
|
welcomeSubtitle?: string;
|
|
6262
6529
|
inputPlaceholder?: string;
|
|
6263
6530
|
sendButtonLabel?: string;
|
|
@@ -6265,6 +6532,7 @@ type AgentWidgetConfig = {
|
|
|
6265
6532
|
stopButtonLabel?: string;
|
|
6266
6533
|
/**
|
|
6267
6534
|
* When false, the welcome / intro card is not shown above the message list.
|
|
6535
|
+
* @deprecated Use `welcome.variant: "none"`.
|
|
6268
6536
|
* @default true
|
|
6269
6537
|
*/
|
|
6270
6538
|
showWelcomeCard?: boolean;
|
|
@@ -6331,6 +6599,12 @@ type AgentWidgetConfig = {
|
|
|
6331
6599
|
initialSelectedArtifactId?: string | null;
|
|
6332
6600
|
/** Rich starter and follow-up suggestion surfaces. */
|
|
6333
6601
|
suggestions?: AgentWidgetSuggestionsConfig;
|
|
6602
|
+
/**
|
|
6603
|
+
* First-open welcome surface (card, hero, or none) plus the optional
|
|
6604
|
+
* display-only greeting bubble. Supersedes `copy.welcomeTitle`,
|
|
6605
|
+
* `copy.welcomeSubtitle`, and `copy.showWelcomeCard`.
|
|
6606
|
+
*/
|
|
6607
|
+
welcome?: AgentWidgetWelcomeConfig;
|
|
6334
6608
|
/** @deprecated Prefer `suggestions.starters.items`. */
|
|
6335
6609
|
suggestionChips?: string[];
|
|
6336
6610
|
/** @deprecated Prefer semantic tokens under `theme.components.suggestion`. */
|