@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
package/dist/theme-editor.d.cts
CHANGED
|
@@ -186,6 +186,15 @@ interface PanelTokens extends ComponentTokenSet {
|
|
|
186
186
|
/** Background of the region revealed behind a detached panel. */
|
|
187
187
|
canvasBackground?: string;
|
|
188
188
|
}
|
|
189
|
+
/** Per-element text styling shared by themable text surfaces. */
|
|
190
|
+
interface TextStyleTokens {
|
|
191
|
+
fontFamily?: string;
|
|
192
|
+
fontSize?: string;
|
|
193
|
+
fontWeight?: string;
|
|
194
|
+
lineHeight?: string;
|
|
195
|
+
letterSpacing?: string;
|
|
196
|
+
color?: TokenReference<'color'>;
|
|
197
|
+
}
|
|
189
198
|
interface HeaderTokens extends ComponentTokenSet {
|
|
190
199
|
background: TokenReference<'color'>;
|
|
191
200
|
border: TokenReference<'color'>;
|
|
@@ -194,10 +203,14 @@ interface HeaderTokens extends ComponentTokenSet {
|
|
|
194
203
|
iconBackground: TokenReference<'color'>;
|
|
195
204
|
/** Foreground (glyph stroke or emoji text) on the header avatar tile. */
|
|
196
205
|
iconForeground: TokenReference<'color'>;
|
|
197
|
-
/**
|
|
206
|
+
/** Legacy alias of `title.color`; `title.color` wins when both are set. */
|
|
198
207
|
titleForeground: TokenReference<'color'>;
|
|
199
|
-
/**
|
|
208
|
+
/** Legacy alias of `subtitle.color`; `subtitle.color` wins when both are set. */
|
|
200
209
|
subtitleForeground: TokenReference<'color'>;
|
|
210
|
+
/** Header title typography (next to the icon, or minimal layout title). */
|
|
211
|
+
title?: TextStyleTokens;
|
|
212
|
+
/** Header subtitle typography, for the line under the title. */
|
|
213
|
+
subtitle?: TextStyleTokens;
|
|
201
214
|
/** Default color for clear / close icon buttons when launcher overrides are unset. */
|
|
202
215
|
actionIconForeground: TokenReference<'color'>;
|
|
203
216
|
/** Box-shadow on the header (e.g., a fade shadow to replace the default border). */
|
|
@@ -227,7 +240,7 @@ interface MessageTokens {
|
|
|
227
240
|
}
|
|
228
241
|
/**
|
|
229
242
|
* Welcome / intro card rendered above the message list when no messages exist.
|
|
230
|
-
* Set `
|
|
243
|
+
* Set `welcome.variant: "none"` to hide it; use `layout.slots["body-top"]`
|
|
231
244
|
* to replace it wholesale.
|
|
232
245
|
*/
|
|
233
246
|
interface IntroCardTokens extends ComponentTokenSet {
|
|
@@ -236,6 +249,12 @@ interface IntroCardTokens extends ComponentTokenSet {
|
|
|
236
249
|
padding?: TokenReference<'spacing'>;
|
|
237
250
|
/** Box-shadow on the intro card (token ref or raw CSS, e.g. `none`). */
|
|
238
251
|
shadow?: string;
|
|
252
|
+
/** Full border shorthand on the intro card (raw CSS, e.g. `"1px solid rgba(0,0,0,0.1)"`). @default "none" */
|
|
253
|
+
border?: string;
|
|
254
|
+
/** Welcome title typography. */
|
|
255
|
+
title?: TextStyleTokens;
|
|
256
|
+
/** Welcome subtitle typography. */
|
|
257
|
+
subtitle?: TextStyleTokens;
|
|
239
258
|
}
|
|
240
259
|
/** Collapsible widget chrome (tool bubbles, reasoning bubbles, approval bubbles). */
|
|
241
260
|
interface CollapsibleWidgetTokens {
|
|
@@ -278,6 +297,8 @@ interface MarkdownTokens {
|
|
|
278
297
|
background?: TokenReference<'color'>;
|
|
279
298
|
borderColor?: TokenReference<'color'>;
|
|
280
299
|
textColor?: TokenReference<'color'>;
|
|
300
|
+
/** Corner radius; follows `palette.radius.md` by default so square-corner themes get square code blocks. */
|
|
301
|
+
borderRadius?: TokenReference<'radius'>;
|
|
281
302
|
};
|
|
282
303
|
/** Table styling. */
|
|
283
304
|
table?: {
|
|
@@ -335,10 +356,19 @@ interface ToolBubbleTokens {
|
|
|
335
356
|
interface ReasoningBubbleTokens {
|
|
336
357
|
shadow: string;
|
|
337
358
|
}
|
|
359
|
+
/** Scrollbar appearance shared by every scroller in the widget. */
|
|
360
|
+
interface ScrollbarTokens {
|
|
361
|
+
/** Thumb color. @default semantic.colors.border */
|
|
362
|
+
thumb?: TokenReference<'color'>;
|
|
363
|
+
/** Track color. @default "transparent" */
|
|
364
|
+
track?: TokenReference<'color'>;
|
|
365
|
+
}
|
|
338
366
|
/** Composer (message input) chrome. */
|
|
339
367
|
interface ComposerChromeTokens {
|
|
340
368
|
/** Box-shadow on the composer form (raw CSS, e.g. `none`). */
|
|
341
369
|
shadow: string;
|
|
370
|
+
/** Border color of the composer form. @default semantic.colors.border */
|
|
371
|
+
borderColor?: TokenReference<'color'>;
|
|
342
372
|
/** Inner padding of the composer form (raw CSS shorthand). @default "0.75rem 1rem" */
|
|
343
373
|
padding?: string;
|
|
344
374
|
/** Gap between the textarea row and the actions row. @default "0.5rem" */
|
|
@@ -498,7 +528,10 @@ interface ScrollToBottomTokens extends ComponentTokenSet {
|
|
|
498
528
|
}
|
|
499
529
|
/** Visual tokens shared by one suggestion presentation variant. */
|
|
500
530
|
interface SuggestionVariantTokens extends ComponentTokenSet {
|
|
531
|
+
/** Space inside one item, between its icon and its copy. */
|
|
501
532
|
gap?: string;
|
|
533
|
+
/** Space between suggestion items in the container. */
|
|
534
|
+
itemGap?: string;
|
|
502
535
|
minHeight?: string;
|
|
503
536
|
fontSize?: string;
|
|
504
537
|
lineHeight?: string;
|
|
@@ -540,6 +573,8 @@ interface ComponentTokens {
|
|
|
540
573
|
toolBubble: ToolBubbleTokens;
|
|
541
574
|
reasoningBubble: ReasoningBubbleTokens;
|
|
542
575
|
composer: ComposerChromeTokens;
|
|
576
|
+
/** Scrollbar appearance for every scroller in the widget. */
|
|
577
|
+
scrollbar?: ScrollbarTokens;
|
|
543
578
|
/** Icon button styling tokens. */
|
|
544
579
|
iconButton?: IconButtonTokens;
|
|
545
580
|
/** Label button styling tokens. */
|
|
@@ -589,6 +624,27 @@ type DeepPartial<T> = T extends object ? {
|
|
|
589
624
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
590
625
|
} : T;
|
|
591
626
|
|
|
627
|
+
interface ResolvedWelcomeConfig {
|
|
628
|
+
title: string;
|
|
629
|
+
subtitle: string;
|
|
630
|
+
icon?: AgentWidgetWelcomeIcon;
|
|
631
|
+
variant: AgentWidgetWelcomeVariant;
|
|
632
|
+
dismiss: AgentWidgetWelcomeDismiss;
|
|
633
|
+
/** Undefined under `variant: "hero"`, which suppresses the greeting. */
|
|
634
|
+
message?: string;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Synchronous key-value store handed to plugin render hooks. Backed by
|
|
639
|
+
* `localStorage`, namespaced per plugin id. The async `storageAdapter` cannot
|
|
640
|
+
* back a synchronous API and `persistState` is not a general key-value surface.
|
|
641
|
+
*/
|
|
642
|
+
interface AgentWidgetPluginStorage {
|
|
643
|
+
get: (key: string) => string | null;
|
|
644
|
+
set: (key: string, value: string) => void;
|
|
645
|
+
remove: (key: string) => void;
|
|
646
|
+
}
|
|
647
|
+
|
|
592
648
|
type AgentWidgetTransformSuggestionsContext = {
|
|
593
649
|
/**
|
|
594
650
|
* Fresh copy of the suggestions entering this plugin, already normalized:
|
|
@@ -616,6 +672,27 @@ type AgentWidgetRenderSuggestionContext = {
|
|
|
616
672
|
*/
|
|
617
673
|
select: () => void;
|
|
618
674
|
};
|
|
675
|
+
type AgentWidgetRenderWelcomeContext = {
|
|
676
|
+
/** Alias-resolved welcome config; never the raw `copy.welcome*` shape. */
|
|
677
|
+
config: ResolvedWelcomeConfig;
|
|
678
|
+
variant: AgentWidgetWelcomeVariant;
|
|
679
|
+
/** Derived visibility for this render; governs the default renderer only. */
|
|
680
|
+
visible: boolean;
|
|
681
|
+
/** The core-owned welcome card, live-updated by `controller.update()`. */
|
|
682
|
+
defaultRenderer: () => HTMLElement;
|
|
683
|
+
sendMessage: (text: string) => void;
|
|
684
|
+
/** Re-run welcome arbitration: cleanups run, previous content is removed. */
|
|
685
|
+
requestRender: () => void;
|
|
686
|
+
/**
|
|
687
|
+
* Persona's starter renderer, wired through the full select pipeline:
|
|
688
|
+
* `onSuggestionSelect`, cancelable `persona:suggestion:*` events, send/fill.
|
|
689
|
+
*/
|
|
690
|
+
renderStarter: (suggestion: AgentWidgetSuggestion) => HTMLElement;
|
|
691
|
+
/** Sync store namespaced by `persistState.keyPrefix` plus the plugin id. */
|
|
692
|
+
storage: AgentWidgetPluginStorage;
|
|
693
|
+
/** Teardown for this render; runs before the next one and on destroy. */
|
|
694
|
+
onCleanup: (fn: () => void) => void;
|
|
695
|
+
};
|
|
619
696
|
type AgentWidgetSuggestionSelectContext = {
|
|
620
697
|
suggestion: AgentWidgetResolvedSuggestion;
|
|
621
698
|
surface: AgentWidgetSuggestionSurface;
|
|
@@ -672,6 +749,34 @@ interface AgentWidgetPlugin {
|
|
|
672
749
|
defaultRenderer: () => HTMLElement;
|
|
673
750
|
onToggle: () => void;
|
|
674
751
|
}) => HTMLElement | null;
|
|
752
|
+
/**
|
|
753
|
+
* Custom renderer for the welcome surface (card, hero, greeting stack).
|
|
754
|
+
* First plugin returning an element wins; null falls through to the default,
|
|
755
|
+
* same contract as `renderSuggestion`.
|
|
756
|
+
*
|
|
757
|
+
* The core owns the welcome host: it stays mounted for the panel's lifetime
|
|
758
|
+
* and content is swapped inside it. A plugin element renders regardless of
|
|
759
|
+
* `ctx.visible` (derived visibility governs the default renderer only) and
|
|
760
|
+
* the host overlays the transcript while that element is active, so a home
|
|
761
|
+
* screen can return over an existing conversation. Return null again to
|
|
762
|
+
* clear the overlay.
|
|
763
|
+
*
|
|
764
|
+
* The ctx carries no controller: plugins are host-instantiated, so close a
|
|
765
|
+
* factory over the init handle (`plugin.attach(controller)`).
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* ```typescript
|
|
769
|
+
* renderWelcome: ({ config, renderStarter, requestRender, onCleanup }) => {
|
|
770
|
+
* const root = document.createElement("div");
|
|
771
|
+
* root.textContent = config.title;
|
|
772
|
+
* root.appendChild(renderStarter({ label: "Track my order" }));
|
|
773
|
+
* const timer = setInterval(requestRender, 60_000);
|
|
774
|
+
* onCleanup(() => clearInterval(timer));
|
|
775
|
+
* return root;
|
|
776
|
+
* }
|
|
777
|
+
* ```
|
|
778
|
+
*/
|
|
779
|
+
renderWelcome?: (context: AgentWidgetRenderWelcomeContext) => HTMLElement | null;
|
|
675
780
|
/**
|
|
676
781
|
* Custom renderer for panel header
|
|
677
782
|
* Return null to use default renderer
|
|
@@ -716,6 +821,15 @@ interface AgentWidgetPlugin {
|
|
|
716
821
|
* Omitted when `config.voiceRecognition.enabled` is not true.
|
|
717
822
|
*/
|
|
718
823
|
onVoiceToggle?: () => void;
|
|
824
|
+
/**
|
|
825
|
+
* Re-run composer arbitration and swap the footer in place. The hook runs
|
|
826
|
+
* once at panel construction, so this is how a composer plugin unlocks
|
|
827
|
+
* (returns null) or re-renders later. Pending attachments, the mention
|
|
828
|
+
* affordances, and the composer listener registry are re-wired by the core.
|
|
829
|
+
*/
|
|
830
|
+
requestRender: () => void;
|
|
831
|
+
/** Same sync store as the `renderWelcome` ctx, namespaced per plugin id. */
|
|
832
|
+
storage: AgentWidgetPluginStorage;
|
|
719
833
|
}) => HTMLElement | null;
|
|
720
834
|
/**
|
|
721
835
|
* Custom renderer for reasoning bubbles
|
|
@@ -2469,6 +2583,13 @@ type AgentWidgetArtifactsLayoutConfig = {
|
|
|
2469
2583
|
* @default 520
|
|
2470
2584
|
*/
|
|
2471
2585
|
narrowHostMaxWidth?: number;
|
|
2586
|
+
/**
|
|
2587
|
+
* Width of the slide-over artifact drawer (the narrow-host and mobile
|
|
2588
|
+
* presentations; `paneWidth`/`paneMaxWidth` only size the desktop split).
|
|
2589
|
+
* CSS length; `"100%"` makes the drawer cover the whole panel.
|
|
2590
|
+
* @default min(calc(100% - 1rem), 22rem)
|
|
2591
|
+
*/
|
|
2592
|
+
drawerWidth?: string;
|
|
2472
2593
|
/**
|
|
2473
2594
|
* When true (default), widen the launcher panel while artifacts are visible and not user-dismissed.
|
|
2474
2595
|
* No-op for inline embed (`launcher.enabled === false`).
|
|
@@ -3097,6 +3218,18 @@ type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
|
|
|
3097
3218
|
* restored thread opens at a readable place rather than at the very bottom.
|
|
3098
3219
|
*/
|
|
3099
3220
|
type AgentWidgetScrollRestorePosition = "bottom" | "last-user-turn";
|
|
3221
|
+
/**
|
|
3222
|
+
* Scrollbar visibility policy for every scroll surface in the widget.
|
|
3223
|
+
*
|
|
3224
|
+
* - `"on-scroll"` hides bars at rest and reveals them on genuine reader
|
|
3225
|
+
* input, keeping them visible while the reader is away from the resting
|
|
3226
|
+
* position: overlay-scrollbar semantics on every platform.
|
|
3227
|
+
* - `"auto"` keeps the themed bar under native visibility semantics: overlay
|
|
3228
|
+
* platforms still auto-hide, classic-scrollbar platforms (Windows,
|
|
3229
|
+
* always-show macOS) show it persistently.
|
|
3230
|
+
* - `"hidden"` never shows an indicator. Scrolling itself is unaffected.
|
|
3231
|
+
*/
|
|
3232
|
+
type AgentWidgetScrollbarPolicy = "on-scroll" | "auto" | "hidden";
|
|
3100
3233
|
type AgentWidgetScrollBehaviorFeature = {
|
|
3101
3234
|
/** Scroll behavior during streamed responses. @default "anchor-top" */
|
|
3102
3235
|
mode?: AgentWidgetScrollMode;
|
|
@@ -3141,6 +3274,13 @@ type AgentWidgetScrollBehaviorFeature = {
|
|
|
3141
3274
|
* @default false
|
|
3142
3275
|
*/
|
|
3143
3276
|
announce?: boolean;
|
|
3277
|
+
/**
|
|
3278
|
+
* Scrollbar visibility policy, applied to the transcript and every inner
|
|
3279
|
+
* scroller through one root attribute. Themable via
|
|
3280
|
+
* `--persona-scrollbar-thumb` and `--persona-scrollbar-track`.
|
|
3281
|
+
* @default "on-scroll"
|
|
3282
|
+
*/
|
|
3283
|
+
scrollbar?: AgentWidgetScrollbarPolicy;
|
|
3144
3284
|
};
|
|
3145
3285
|
type AgentWidgetScrollToBottomFeature = {
|
|
3146
3286
|
/**
|
|
@@ -4046,6 +4186,57 @@ type AgentWidgetLauncherConfig = {
|
|
|
4046
4186
|
* @example "min(380px, calc(100vw - 48px))"
|
|
4047
4187
|
*/
|
|
4048
4188
|
collapsedMaxWidth?: string;
|
|
4189
|
+
/**
|
|
4190
|
+
* Proactive nudge bubble anchored above the collapsed floating launcher.
|
|
4191
|
+
* Omit it (the default) and no teaser renders.
|
|
4192
|
+
*/
|
|
4193
|
+
teaser?: AgentWidgetLauncherTeaserConfig;
|
|
4194
|
+
};
|
|
4195
|
+
/**
|
|
4196
|
+
* Launcher teaser: a small bubble above the collapsed launcher. Clicking it
|
|
4197
|
+
* opens the panel and consumes the teaser exactly like an explicit dismissal.
|
|
4198
|
+
* Within a single page load the teaser appears at most once under either
|
|
4199
|
+
* frequency.
|
|
4200
|
+
*
|
|
4201
|
+
* @example
|
|
4202
|
+
* ```typescript
|
|
4203
|
+
* launcher: {
|
|
4204
|
+
* teaser: { text: "Need a hand picking a plan?", delayMs: 3000 }
|
|
4205
|
+
* }
|
|
4206
|
+
* ```
|
|
4207
|
+
*/
|
|
4208
|
+
type AgentWidgetLauncherTeaserConfig = {
|
|
4209
|
+
/** Bubble copy. An empty string renders no teaser. */
|
|
4210
|
+
text: string;
|
|
4211
|
+
/**
|
|
4212
|
+
* Delay before the bubble appears, in milliseconds.
|
|
4213
|
+
* @default 0
|
|
4214
|
+
*/
|
|
4215
|
+
delayMs?: number;
|
|
4216
|
+
/**
|
|
4217
|
+
* How often the teaser may return.
|
|
4218
|
+
*
|
|
4219
|
+
* `"once"`: a dismissal or a click-through is remembered in `localStorage`
|
|
4220
|
+
* under `` `${persistState.keyPrefix ?? "persona-"}teaser-dismissed` `` and
|
|
4221
|
+
* the teaser never returns on that browser. `"always"`: shows on every page
|
|
4222
|
+
* load, tracked in memory only. `persistState: false` downgrades `"once"` to
|
|
4223
|
+
* in-memory too, so the teaser reappears each load.
|
|
4224
|
+
*
|
|
4225
|
+
* Custom `storageAdapter` implementations do not participate in teaser state.
|
|
4226
|
+
*
|
|
4227
|
+
* @default "once"
|
|
4228
|
+
*/
|
|
4229
|
+
frequency?: "once" | "always";
|
|
4230
|
+
/**
|
|
4231
|
+
* Render an x affordance that dismisses the teaser without opening the panel.
|
|
4232
|
+
* @default true
|
|
4233
|
+
*/
|
|
4234
|
+
dismissible?: boolean;
|
|
4235
|
+
/**
|
|
4236
|
+
* Accessible label for the dismiss affordance.
|
|
4237
|
+
* @default "Dismiss message"
|
|
4238
|
+
*/
|
|
4239
|
+
dismissLabel?: string;
|
|
4049
4240
|
};
|
|
4050
4241
|
type AgentWidgetSendButtonConfig = {
|
|
4051
4242
|
borderWidth?: string;
|
|
@@ -4789,7 +4980,10 @@ type AgentWidgetSuggestion = string | {
|
|
|
4789
4980
|
label: string;
|
|
4790
4981
|
/** Text placed in the composer or sent. Defaults to `label`. */
|
|
4791
4982
|
prompt?: string;
|
|
4792
|
-
/**
|
|
4983
|
+
/**
|
|
4984
|
+
* Optional supporting copy, most useful with the `card` variant. The
|
|
4985
|
+
* `chip` variant ignores it and renders the label alone.
|
|
4986
|
+
*/
|
|
4793
4987
|
description?: string;
|
|
4794
4988
|
/** Optional icon from Persona's bundled Lucide registry. */
|
|
4795
4989
|
icon?: IconName;
|
|
@@ -4833,9 +5027,10 @@ type AgentWidgetSuggestionSurfaceConfig = {
|
|
|
4833
5027
|
/** Default click behavior, overridable per item. Defaults to `send`. */
|
|
4834
5028
|
behavior?: AgentWidgetSuggestionBehavior;
|
|
4835
5029
|
/**
|
|
4836
|
-
* Layout for items past the surface width. Defaults to `wrap`
|
|
4837
|
-
*
|
|
4838
|
-
* `card` and `list` layouts manage their
|
|
5030
|
+
* Layout for items past the surface width. Defaults to `wrap` on every
|
|
5031
|
+
* surface; `scroll` opts into a horizontal strip for large sets. Applies
|
|
5032
|
+
* to the `chip` variant only; the `card` and `list` layouts manage their
|
|
5033
|
+
* own stacking.
|
|
4839
5034
|
*/
|
|
4840
5035
|
overflow?: "scroll" | "wrap";
|
|
4841
5036
|
/** Maximum visible items. Defaults to 4. */
|
|
@@ -4884,6 +5079,70 @@ type AgentWidgetSuggestionsConfig = {
|
|
|
4884
5079
|
starters?: AgentWidgetStarterSuggestionsConfig;
|
|
4885
5080
|
followUps?: AgentWidgetFollowUpSuggestionsConfig;
|
|
4886
5081
|
};
|
|
5082
|
+
/**
|
|
5083
|
+
* Which welcome surface renders.
|
|
5084
|
+
* `"card"` is the top-of-scroll intro card (default, back-compatible),
|
|
5085
|
+
* `"hero"` centers it in the empty conversation, `"none"` renders no surface.
|
|
5086
|
+
*/
|
|
5087
|
+
type AgentWidgetWelcomeVariant = "card" | "hero" | "none";
|
|
5088
|
+
/**
|
|
5089
|
+
* When the welcome surface goes away. `"never"` is the default for `"card"`;
|
|
5090
|
+
* `"on-first-message"` is the default for `"hero"` and cannot be overridden
|
|
5091
|
+
* there.
|
|
5092
|
+
*/
|
|
5093
|
+
type AgentWidgetWelcomeDismiss = "never" | "on-first-message";
|
|
5094
|
+
/**
|
|
5095
|
+
* Avatar or logo shown above the welcome title. Discriminated union; the
|
|
5096
|
+
* function form is the escape hatch for custom markup. There is deliberately
|
|
5097
|
+
* no raw HTML string variant (sanitization surface plus accessibility hole).
|
|
5098
|
+
*/
|
|
5099
|
+
type AgentWidgetWelcomeIcon = {
|
|
5100
|
+
type: "lucide";
|
|
5101
|
+
name: IconName;
|
|
5102
|
+
}
|
|
5103
|
+
/** `alt` is required, and may be `""` for a decorative logo. */
|
|
5104
|
+
| {
|
|
5105
|
+
type: "image";
|
|
5106
|
+
url: string;
|
|
5107
|
+
alt: string;
|
|
5108
|
+
}
|
|
5109
|
+
/** Emoji or short text glyph. */
|
|
5110
|
+
| {
|
|
5111
|
+
type: "text";
|
|
5112
|
+
text: string;
|
|
5113
|
+
} | (() => HTMLElement | SVGElement);
|
|
5114
|
+
/**
|
|
5115
|
+
* First-open welcome surface. Consolidates the deprecated
|
|
5116
|
+
* `copy.welcomeTitle` / `copy.welcomeSubtitle` / `copy.showWelcomeCard`
|
|
5117
|
+
* options; a field present here wins over its legacy alias.
|
|
5118
|
+
*
|
|
5119
|
+
* All defaults live in the resolver (`resolveWelcomeConfig`), never in
|
|
5120
|
+
* `DEFAULT_WIDGET_CONFIG`: presence on this object is what distinguishes a
|
|
5121
|
+
* host-set value from a filled-in default.
|
|
5122
|
+
*/
|
|
5123
|
+
interface AgentWidgetWelcomeConfig {
|
|
5124
|
+
/** Card or hero title. Defaults to "Hello 👋". */
|
|
5125
|
+
title?: string;
|
|
5126
|
+
/** Scope statement in the assistant's voice. Empty string omits it. */
|
|
5127
|
+
subtitle?: string;
|
|
5128
|
+
/** Avatar or logo shown above the title. */
|
|
5129
|
+
icon?: AgentWidgetWelcomeIcon;
|
|
5130
|
+
/** @default "card" */
|
|
5131
|
+
variant?: AgentWidgetWelcomeVariant;
|
|
5132
|
+
/** @default "never" for `card`, always `"on-first-message"` for `hero`. */
|
|
5133
|
+
dismiss?: AgentWidgetWelcomeDismiss;
|
|
5134
|
+
/**
|
|
5135
|
+
* Display-only greeting bubble pinned at transcript position zero. It is UI
|
|
5136
|
+
* chrome derived from config, never a session message: it does not appear in
|
|
5137
|
+
* `getMessages()`, is never persisted or sent to the model, `onMessage` does
|
|
5138
|
+
* not fire for it, and it survives `clearChat()`. Use an assistant
|
|
5139
|
+
* `initialMessages` entry instead when the model should see the greeting.
|
|
5140
|
+
*
|
|
5141
|
+
* Ignored (with a debug-mode warning) when `variant` is `"hero"`: the hero
|
|
5142
|
+
* is the greeting.
|
|
5143
|
+
*/
|
|
5144
|
+
message?: string;
|
|
5145
|
+
}
|
|
4887
5146
|
/**
|
|
4888
5147
|
* Interface for pluggable stream parsers that extract text from streaming responses.
|
|
4889
5148
|
* Parsers handle incremental parsing to extract text values from structured formats (JSON, XML, etc.).
|
|
@@ -5065,7 +5324,9 @@ type AgentWidgetHeaderLayoutConfig = {
|
|
|
5065
5324
|
*/
|
|
5066
5325
|
render?: (context: HeaderRenderContext) => HTMLElement;
|
|
5067
5326
|
/**
|
|
5068
|
-
*
|
|
5327
|
+
* Icon action buttons at the trailing edge of the `minimal` header layout,
|
|
5328
|
+
* clustered with the close button and sharing its chrome. For a menu
|
|
5329
|
+
* affordance next to the title, use `titleMenu` instead.
|
|
5069
5330
|
*/
|
|
5070
5331
|
trailingActions?: AgentWidgetHeaderTrailingAction[];
|
|
5071
5332
|
/** Called when a `trailingActions` button is clicked. */
|
|
@@ -5245,7 +5506,11 @@ type AgentWidgetLayoutConfig = {
|
|
|
5245
5506
|
/**
|
|
5246
5507
|
* Max width for the content area (messages + composer).
|
|
5247
5508
|
* Applied with `margin: 0 auto` for centering.
|
|
5248
|
-
* Accepts any CSS width value (e.g. "90ch", "720px", "80%")
|
|
5509
|
+
* Accepts any CSS width value (e.g. "90ch", "720px", "80%"), or "none"
|
|
5510
|
+
* for a full-width column. Only engages on panels wider than the cap,
|
|
5511
|
+
* so launcher-width panels are unaffected.
|
|
5512
|
+
* @default "768px" ("720px" in composer-bar mode via
|
|
5513
|
+
* `launcher.composerBar.contentMaxWidth`)
|
|
5249
5514
|
*/
|
|
5250
5515
|
contentMaxWidth?: string;
|
|
5251
5516
|
};
|
|
@@ -5993,7 +6258,9 @@ type AgentWidgetConfig = {
|
|
|
5993
6258
|
*/
|
|
5994
6259
|
getHeaders?: AgentWidgetHeadersFunction;
|
|
5995
6260
|
copy?: {
|
|
6261
|
+
/** @deprecated Use `welcome.title`. */
|
|
5996
6262
|
welcomeTitle?: string;
|
|
6263
|
+
/** @deprecated Use `welcome.subtitle`. */
|
|
5997
6264
|
welcomeSubtitle?: string;
|
|
5998
6265
|
inputPlaceholder?: string;
|
|
5999
6266
|
sendButtonLabel?: string;
|
|
@@ -6001,6 +6268,7 @@ type AgentWidgetConfig = {
|
|
|
6001
6268
|
stopButtonLabel?: string;
|
|
6002
6269
|
/**
|
|
6003
6270
|
* When false, the welcome / intro card is not shown above the message list.
|
|
6271
|
+
* @deprecated Use `welcome.variant: "none"`.
|
|
6004
6272
|
* @default true
|
|
6005
6273
|
*/
|
|
6006
6274
|
showWelcomeCard?: boolean;
|
|
@@ -6067,6 +6335,12 @@ type AgentWidgetConfig = {
|
|
|
6067
6335
|
initialSelectedArtifactId?: string | null;
|
|
6068
6336
|
/** Rich starter and follow-up suggestion surfaces. */
|
|
6069
6337
|
suggestions?: AgentWidgetSuggestionsConfig;
|
|
6338
|
+
/**
|
|
6339
|
+
* First-open welcome surface (card, hero, or none) plus the optional
|
|
6340
|
+
* display-only greeting bubble. Supersedes `copy.welcomeTitle`,
|
|
6341
|
+
* `copy.welcomeSubtitle`, and `copy.showWelcomeCard`.
|
|
6342
|
+
*/
|
|
6343
|
+
welcome?: AgentWidgetWelcomeConfig;
|
|
6070
6344
|
/** @deprecated Prefer `suggestions.starters.items`. */
|
|
6071
6345
|
suggestionChips?: string[];
|
|
6072
6346
|
/** @deprecated Prefer semantic tokens under `theme.components.suggestion`. */
|
|
@@ -7024,7 +7298,6 @@ declare const STYLE_SECTIONS: SectionDef[];
|
|
|
7024
7298
|
declare const PALETTE_SECTION: SectionDef;
|
|
7025
7299
|
declare const SEMANTIC_COLORS_SECTION: SectionDef;
|
|
7026
7300
|
declare const COLORS_SECTIONS: SectionDef[];
|
|
7027
|
-
/** Shared shape sections (not scoped to light/dark) */
|
|
7028
7301
|
declare const COMPONENT_SHAPE_SECTIONS: SectionDef[];
|
|
7029
7302
|
/** Component color sections (can be scoped for light/dark) */
|
|
7030
7303
|
declare const COMPONENT_COLOR_SECTIONS: SectionDef[];
|