@runtypelabs/persona 3.18.0 → 3.20.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 +45 -2
- package/dist/index.cjs +47 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +383 -6
- package/dist/index.d.ts +383 -6
- package/dist/index.global.js +102 -1636
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +47 -47
- package/dist/index.js.map +1 -1
- package/dist/theme-editor.cjs +1514 -626
- package/dist/theme-editor.d.cts +192 -1
- package/dist/theme-editor.d.ts +192 -1
- package/dist/theme-editor.js +1628 -626
- package/dist/widget.css +348 -0
- package/package.json +1 -1
- package/src/components/composer-builder.test.ts +52 -0
- package/src/components/composer-builder.ts +67 -490
- package/src/components/composer-parts.test.ts +152 -0
- package/src/components/composer-parts.ts +452 -0
- package/src/components/header-builder.ts +22 -299
- package/src/components/header-parts.ts +360 -0
- package/src/components/panel.test.ts +61 -0
- package/src/components/panel.ts +262 -5
- package/src/components/pill-composer-builder.test.ts +85 -0
- package/src/components/pill-composer-builder.ts +183 -0
- package/src/index.ts +5 -0
- package/src/runtime/init.ts +4 -2
- package/src/runtime/persist-state.test.ts +152 -0
- package/src/session.test.ts +123 -0
- package/src/session.ts +58 -4
- package/src/styles/widget.css +348 -0
- package/src/types.ts +196 -1
- package/src/ui.component-directive.test.ts +183 -0
- package/src/ui.composer-bar.test.ts +1009 -0
- package/src/ui.ts +827 -72
- package/src/utils/attachment-manager.ts +1 -1
- package/src/utils/component-middleware.test.ts +134 -0
- package/src/utils/component-middleware.ts +44 -13
- package/src/utils/dock.test.ts +45 -0
- package/src/utils/dock.ts +3 -0
- package/src/utils/icons.ts +314 -58
- package/src/utils/stream-animation.ts +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IconNode } from 'lucide';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Plugin interface for customizing widget components
|
|
3
5
|
*/
|
|
@@ -1777,6 +1779,101 @@ type AgentWidgetDockConfig = {
|
|
|
1777
1779
|
*/
|
|
1778
1780
|
reveal?: "resize" | "overlay" | "push" | "emerge";
|
|
1779
1781
|
};
|
|
1782
|
+
/**
|
|
1783
|
+
* Layout configuration for `mountMode: "composer-bar"`. Controls how the
|
|
1784
|
+
* collapsed pill is positioned and sized, and how the panel expands when
|
|
1785
|
+
* the user opens it.
|
|
1786
|
+
*/
|
|
1787
|
+
type AgentWidgetComposerBarConfig = {
|
|
1788
|
+
/**
|
|
1789
|
+
* Max-width of the collapsed pill composer at the bottom of the viewport.
|
|
1790
|
+
* @default "720px"
|
|
1791
|
+
*/
|
|
1792
|
+
collapsedMaxWidth?: string;
|
|
1793
|
+
/**
|
|
1794
|
+
* Bottom offset (CSS length) from the viewport edge in the collapsed state.
|
|
1795
|
+
* @default "16px"
|
|
1796
|
+
*/
|
|
1797
|
+
bottomOffset?: string;
|
|
1798
|
+
/**
|
|
1799
|
+
* Auto-expand the panel when the user submits a message while the composer
|
|
1800
|
+
* is collapsed. When false, the message still sends but the panel remains
|
|
1801
|
+
* collapsed (the host can drive expansion programmatically).
|
|
1802
|
+
* @default true
|
|
1803
|
+
*/
|
|
1804
|
+
expandOnSubmit?: boolean;
|
|
1805
|
+
/**
|
|
1806
|
+
* Size of the expanded chat panel.
|
|
1807
|
+
* - `"anchored"` (default): the pill stays at the bottom of the viewport
|
|
1808
|
+
* and the chat history grows upward into a centered column above it.
|
|
1809
|
+
* Width is driven by `expandedMaxWidth`; the panel's top edge sits at
|
|
1810
|
+
* `expandedTopOffset` from the viewport top.
|
|
1811
|
+
* - `"fullscreen"`: covers the entire viewport (mobile-app style). Inner
|
|
1812
|
+
* content is centered horizontally via `contentMaxWidth`.
|
|
1813
|
+
* - `"modal"`: centered sheet with margins; size driven by
|
|
1814
|
+
* `modalMaxWidth` / `modalMaxHeight`.
|
|
1815
|
+
* @default "anchored"
|
|
1816
|
+
*/
|
|
1817
|
+
expandedSize?: "anchored" | "fullscreen" | "modal";
|
|
1818
|
+
/**
|
|
1819
|
+
* When `expandedSize === "anchored"`, max-width of the expanded panel
|
|
1820
|
+
* column. Capped at `calc(100vw - 32px)` on narrow viewports.
|
|
1821
|
+
* @default "880px"
|
|
1822
|
+
*/
|
|
1823
|
+
expandedMaxWidth?: string;
|
|
1824
|
+
/**
|
|
1825
|
+
* When `expandedSize === "anchored"`, distance from the viewport top to
|
|
1826
|
+
* the panel's top edge. Accepts any CSS length.
|
|
1827
|
+
* @default "5vh"
|
|
1828
|
+
*/
|
|
1829
|
+
expandedTopOffset?: string;
|
|
1830
|
+
/**
|
|
1831
|
+
* Max-width applied to messages, composer form, suggestions, and
|
|
1832
|
+
* attachment previews so they center horizontally inside the expanded
|
|
1833
|
+
* panel. Falls back to `layout.contentMaxWidth` when set; otherwise
|
|
1834
|
+
* defaults to this value.
|
|
1835
|
+
* @default "720px"
|
|
1836
|
+
*/
|
|
1837
|
+
contentMaxWidth?: string;
|
|
1838
|
+
/**
|
|
1839
|
+
* When `expandedSize === "modal"`, max-width of the expanded sheet.
|
|
1840
|
+
* @default "880px"
|
|
1841
|
+
*/
|
|
1842
|
+
modalMaxWidth?: string;
|
|
1843
|
+
/**
|
|
1844
|
+
* When `expandedSize === "modal"`, max-height of the expanded sheet.
|
|
1845
|
+
* @default "min(90vh, 800px)"
|
|
1846
|
+
*/
|
|
1847
|
+
modalMaxHeight?: string;
|
|
1848
|
+
/**
|
|
1849
|
+
* Configuration for the "peek" banner — the chrome-less row above the
|
|
1850
|
+
* collapsed pill that previews the most recent assistant message.
|
|
1851
|
+
*/
|
|
1852
|
+
peek?: AgentWidgetComposerBarPeekConfig;
|
|
1853
|
+
};
|
|
1854
|
+
/**
|
|
1855
|
+
* Configuration for the composer-bar peek banner. Reuses the same
|
|
1856
|
+
* `streamAnimation` shape developers already configure for the main message
|
|
1857
|
+
* stream, so the surface for animations is identical across both contexts.
|
|
1858
|
+
*
|
|
1859
|
+
* Resolution order:
|
|
1860
|
+
* - If `peek.streamAnimation` is set, those values apply to the peek.
|
|
1861
|
+
* - Otherwise the peek inherits from `features.streamAnimation`.
|
|
1862
|
+
*
|
|
1863
|
+
* Per-surface carve-outs:
|
|
1864
|
+
* - `bubbleClass` from a plugin (used by `pop-bubble`) is ignored — the peek
|
|
1865
|
+
* has no bubble analog.
|
|
1866
|
+
* - `containerClass`, `wrap` ("char" | "word"), `useCaret`, `placeholder`
|
|
1867
|
+
* ("skeleton"), `buffer` ("word" | "line"), `speed`, `duration`, and
|
|
1868
|
+
* custom plugins all apply unchanged.
|
|
1869
|
+
*/
|
|
1870
|
+
type AgentWidgetComposerBarPeekConfig = {
|
|
1871
|
+
/**
|
|
1872
|
+
* Reveal animation for the peek's trailing-message preview. Same shape as
|
|
1873
|
+
* `features.streamAnimation`. Omit to inherit from the main stream config.
|
|
1874
|
+
*/
|
|
1875
|
+
streamAnimation?: AgentWidgetStreamAnimationFeature;
|
|
1876
|
+
};
|
|
1780
1877
|
type AgentWidgetLauncherConfig = {
|
|
1781
1878
|
enabled?: boolean;
|
|
1782
1879
|
title?: string;
|
|
@@ -1791,14 +1888,22 @@ type AgentWidgetLauncherConfig = {
|
|
|
1791
1888
|
* Controls how the launcher panel is mounted relative to the host page.
|
|
1792
1889
|
* - "floating": default floating launcher / panel behavior
|
|
1793
1890
|
* - "docked": wraps the target container and renders as a sibling dock
|
|
1891
|
+
* - "composer-bar": persistent rounded-pill composer fixed to the bottom of
|
|
1892
|
+
* the viewport that morphs into a fullscreen (or modal) chat panel on
|
|
1893
|
+
* submit and minimizes back to the pill on close.
|
|
1794
1894
|
*
|
|
1795
1895
|
* @default "floating"
|
|
1796
1896
|
*/
|
|
1797
|
-
mountMode?: "floating" | "docked";
|
|
1897
|
+
mountMode?: "floating" | "docked" | "composer-bar";
|
|
1798
1898
|
/**
|
|
1799
1899
|
* Layout configuration for docked mode.
|
|
1800
1900
|
*/
|
|
1801
1901
|
dock?: AgentWidgetDockConfig;
|
|
1902
|
+
/**
|
|
1903
|
+
* Layout configuration for composer-bar mode.
|
|
1904
|
+
* Only applies when `mountMode === "composer-bar"`.
|
|
1905
|
+
*/
|
|
1906
|
+
composerBar?: AgentWidgetComposerBarConfig;
|
|
1802
1907
|
autoExpand?: boolean;
|
|
1803
1908
|
width?: string;
|
|
1804
1909
|
/**
|
|
@@ -3882,6 +3987,13 @@ type AgentWidgetConfig = {
|
|
|
3882
3987
|
* When `true`, uses default settings with sessionStorage.
|
|
3883
3988
|
* When an object, allows customizing storage type, key prefix, and what to persist.
|
|
3884
3989
|
*
|
|
3990
|
+
* Setting this to `false` is the explicit kill-switch: it disables UI-state
|
|
3991
|
+
* persistence **and** message-history persistence. When `false`, any
|
|
3992
|
+
* `storageAdapter` you configure is ignored and the default localStorage
|
|
3993
|
+
* adapter is not created — no chat history is read or written. Pass `true`
|
|
3994
|
+
* (or omit) to keep the default behavior of persisting messages via the
|
|
3995
|
+
* configured `storageAdapter` (or the built-in localStorage adapter).
|
|
3996
|
+
*
|
|
3885
3997
|
* @example
|
|
3886
3998
|
* ```typescript
|
|
3887
3999
|
* // Simple usage - persist open state in sessionStorage
|
|
@@ -3904,6 +4016,14 @@ type AgentWidgetConfig = {
|
|
|
3904
4016
|
* }
|
|
3905
4017
|
* }
|
|
3906
4018
|
* ```
|
|
4019
|
+
*
|
|
4020
|
+
* @example
|
|
4021
|
+
* ```typescript
|
|
4022
|
+
* // Ephemeral widget — no message history written anywhere
|
|
4023
|
+
* config: {
|
|
4024
|
+
* persistState: false
|
|
4025
|
+
* }
|
|
4026
|
+
* ```
|
|
3907
4027
|
*/
|
|
3908
4028
|
persistState?: boolean | AgentWidgetPersistStateConfig;
|
|
3909
4029
|
/**
|
|
@@ -4146,6 +4266,22 @@ type InjectMessageOptions = {
|
|
|
4146
4266
|
* Consumers can detect this in `messageTransform` to render custom UI.
|
|
4147
4267
|
*/
|
|
4148
4268
|
voiceProcessing?: boolean;
|
|
4269
|
+
/**
|
|
4270
|
+
* Raw structured payload (typically a JSON string) representing the
|
|
4271
|
+
* full directive that produced this message — e.g. `{ "text": "...",
|
|
4272
|
+
* "component": "Foo", "props": {...} }`.
|
|
4273
|
+
*
|
|
4274
|
+
* Mirrors the field populated by stream parsers during normal LLM
|
|
4275
|
+
* responses. Set this when injecting a message that should render as a
|
|
4276
|
+
* component directive (`hasComponentDirective` /
|
|
4277
|
+
* `extractComponentDirectiveFromMessage` look at `rawContent` first).
|
|
4278
|
+
*
|
|
4279
|
+
* Priority for the API payload remains:
|
|
4280
|
+
* `contentParts > llmContent > rawContent > content`. Pass `llmContent`
|
|
4281
|
+
* alongside `rawContent` if the LLM should see something other than the
|
|
4282
|
+
* raw directive.
|
|
4283
|
+
*/
|
|
4284
|
+
rawContent?: string;
|
|
4149
4285
|
};
|
|
4150
4286
|
/**
|
|
4151
4287
|
* Options for injecting assistant messages (most common case).
|
|
@@ -4162,6 +4298,57 @@ type InjectUserMessageOptions = Omit<InjectMessageOptions, "role">;
|
|
|
4162
4298
|
* Role defaults to 'system'.
|
|
4163
4299
|
*/
|
|
4164
4300
|
type InjectSystemMessageOptions = Omit<InjectMessageOptions, "role">;
|
|
4301
|
+
/**
|
|
4302
|
+
* Options for injecting an assistant message that renders as a component
|
|
4303
|
+
* directive — sugar over `injectAssistantMessage` for the common case of
|
|
4304
|
+
* "render this registered component, same as if the LLM had emitted it".
|
|
4305
|
+
*
|
|
4306
|
+
* Equivalent to calling `injectAssistantMessage({ content: text, rawContent:
|
|
4307
|
+
* JSON.stringify({ text, component, props }), llmContent })`.
|
|
4308
|
+
*
|
|
4309
|
+
* @example
|
|
4310
|
+
* widget.injectComponentDirective({
|
|
4311
|
+
* component: "DynamicForm",
|
|
4312
|
+
* props: { title: "Book a demo", fields: [...] },
|
|
4313
|
+
* text: "Share your details to book a demo.",
|
|
4314
|
+
* llmContent: "[Showed booking form]"
|
|
4315
|
+
* });
|
|
4316
|
+
*/
|
|
4317
|
+
type InjectComponentDirectiveOptions = {
|
|
4318
|
+
/**
|
|
4319
|
+
* Name of a renderer registered via `componentRegistry.register(...)`.
|
|
4320
|
+
*/
|
|
4321
|
+
component: string;
|
|
4322
|
+
/**
|
|
4323
|
+
* Props passed to the component renderer.
|
|
4324
|
+
*/
|
|
4325
|
+
props?: Record<string, unknown>;
|
|
4326
|
+
/**
|
|
4327
|
+
* Bubble copy displayed above (or with) the rendered component.
|
|
4328
|
+
* Mirrors the `text` field in a streamed JSON directive.
|
|
4329
|
+
* @default ""
|
|
4330
|
+
*/
|
|
4331
|
+
text?: string;
|
|
4332
|
+
/**
|
|
4333
|
+
* Content sent to the LLM in API requests. When omitted, the raw
|
|
4334
|
+
* directive JSON is what the LLM would see (per the standard
|
|
4335
|
+
* priority chain). Provide a redacted/short version to avoid sending
|
|
4336
|
+
* the full directive in subsequent turns.
|
|
4337
|
+
*/
|
|
4338
|
+
llmContent?: string;
|
|
4339
|
+
/**
|
|
4340
|
+
* Optional message ID. If omitted, an assistant id is auto-generated.
|
|
4341
|
+
*/
|
|
4342
|
+
id?: string;
|
|
4343
|
+
/**
|
|
4344
|
+
* Optional creation timestamp (ISO string). If omitted, uses current time.
|
|
4345
|
+
*/
|
|
4346
|
+
createdAt?: string;
|
|
4347
|
+
/**
|
|
4348
|
+
* Optional sequence number for ordering.
|
|
4349
|
+
*/
|
|
4350
|
+
sequence?: number;
|
|
4351
|
+
};
|
|
4165
4352
|
type PersonaArtifactRecord = {
|
|
4166
4353
|
id: string;
|
|
4167
4354
|
artifactType: PersonaArtifactKind;
|
|
@@ -4618,6 +4805,24 @@ declare class AgentWidgetSession {
|
|
|
4618
4805
|
* Inject multiple messages in a single batch with one sort and one render pass.
|
|
4619
4806
|
*/
|
|
4620
4807
|
injectMessageBatch(optionsList: InjectMessageOptions[]): AgentWidgetMessage[];
|
|
4808
|
+
/**
|
|
4809
|
+
* Convenience method for injecting a registered component directive as
|
|
4810
|
+
* an assistant message — the same shape Persona produces from a streamed
|
|
4811
|
+
* `{ "text": "...", "component": "...", "props": {...} }` payload.
|
|
4812
|
+
*
|
|
4813
|
+
* Sets `content` to `text`, `rawContent` to the JSON directive (so
|
|
4814
|
+
* `extractComponentDirectiveFromMessage` can find it), and forwards
|
|
4815
|
+
* `llmContent` / `id` / `createdAt` / `sequence`.
|
|
4816
|
+
*
|
|
4817
|
+
* @example
|
|
4818
|
+
* session.injectComponentDirective({
|
|
4819
|
+
* component: "DynamicForm",
|
|
4820
|
+
* props: { title: "Book a demo", fields: [...] },
|
|
4821
|
+
* text: "Share your details to book a demo.",
|
|
4822
|
+
* llmContent: "[Showed booking form]"
|
|
4823
|
+
* });
|
|
4824
|
+
*/
|
|
4825
|
+
injectComponentDirective(options: InjectComponentDirectiveOptions): AgentWidgetMessage;
|
|
4621
4826
|
sendMessage(rawInput: string, options?: {
|
|
4622
4827
|
viaVoice?: boolean;
|
|
4623
4828
|
/** Multi-modal content parts (e.g., images) to include with the message */
|
|
@@ -4811,6 +5016,12 @@ type Controller = {
|
|
|
4811
5016
|
* Inject multiple messages in a single batch with one sort and one render pass.
|
|
4812
5017
|
*/
|
|
4813
5018
|
injectMessageBatch: (optionsList: InjectMessageOptions[]) => AgentWidgetMessage[];
|
|
5019
|
+
/**
|
|
5020
|
+
* Convenience method for injecting an assistant message that renders as a
|
|
5021
|
+
* registered component — same shape Persona produces from a streamed
|
|
5022
|
+
* `{ "text": "...", "component": "...", "props": {...} }` payload.
|
|
5023
|
+
*/
|
|
5024
|
+
injectComponentDirective: (options: InjectComponentDirectiveOptions) => AgentWidgetMessage;
|
|
4814
5025
|
/**
|
|
4815
5026
|
* @deprecated Use injectMessage() instead.
|
|
4816
5027
|
*/
|
|
@@ -5632,6 +5843,161 @@ interface DropdownMenuHandle {
|
|
|
5632
5843
|
*/
|
|
5633
5844
|
declare function createDropdownMenu(options: CreateDropdownOptions): DropdownMenuHandle;
|
|
5634
5845
|
|
|
5846
|
+
/**
|
|
5847
|
+
* Curated registry of lucide icons available to `renderLucideIcon`.
|
|
5848
|
+
*
|
|
5849
|
+
* The widget used to do `import * as icons from "lucide"` and look up
|
|
5850
|
+
* icons dynamically by string. That defeated tree-shaking, so the IIFE
|
|
5851
|
+
* (CDN/script-tag) bundle shipped all 1640 lucide icons (~400KB of icon
|
|
5852
|
+
* data) regardless of which we actually used. This explicit registry
|
|
5853
|
+
* lets the bundler drop any icon not listed here.
|
|
5854
|
+
*
|
|
5855
|
+
* Trade-off: `renderLucideIcon(name)` is now a *closed set*. Names not
|
|
5856
|
+
* in this map return `null` and log a warning, exactly as a typo did
|
|
5857
|
+
* before. The registry is intentionally generous (~110 icons) so that
|
|
5858
|
+
* custom `ComponentRenderer` authors rarely hit a missing-icon dead end.
|
|
5859
|
+
*
|
|
5860
|
+
* To add icons: add a named import above and a row in `LUCIDE_ICONS`,
|
|
5861
|
+
* keyed by the lucide kebab-case name (matches their filename and
|
|
5862
|
+
* https://lucide.dev/icons).
|
|
5863
|
+
*
|
|
5864
|
+
* See `packages/widget/docs/icon-registry-shortlist.md` for the full
|
|
5865
|
+
* curation rationale and which icons were considered but excluded.
|
|
5866
|
+
*/
|
|
5867
|
+
declare const LUCIDE_ICONS: {
|
|
5868
|
+
readonly activity: IconNode;
|
|
5869
|
+
readonly "arrow-down": IconNode;
|
|
5870
|
+
readonly "arrow-up": IconNode;
|
|
5871
|
+
readonly "arrow-up-right": IconNode;
|
|
5872
|
+
readonly bot: IconNode;
|
|
5873
|
+
readonly "chevron-down": IconNode;
|
|
5874
|
+
readonly "chevron-up": IconNode;
|
|
5875
|
+
readonly "chevron-right": IconNode;
|
|
5876
|
+
readonly "chevron-left": IconNode;
|
|
5877
|
+
readonly check: IconNode;
|
|
5878
|
+
readonly clipboard: IconNode;
|
|
5879
|
+
readonly "clipboard-copy": IconNode;
|
|
5880
|
+
readonly copy: IconNode;
|
|
5881
|
+
readonly file: IconNode;
|
|
5882
|
+
readonly "file-code": IconNode;
|
|
5883
|
+
readonly "file-spreadsheet": IconNode;
|
|
5884
|
+
readonly "file-text": IconNode;
|
|
5885
|
+
readonly "image-plus": IconNode;
|
|
5886
|
+
readonly loader: IconNode;
|
|
5887
|
+
readonly "loader-circle": IconNode;
|
|
5888
|
+
readonly mic: IconNode;
|
|
5889
|
+
readonly paperclip: IconNode;
|
|
5890
|
+
readonly "refresh-cw": IconNode;
|
|
5891
|
+
readonly search: IconNode;
|
|
5892
|
+
readonly send: IconNode;
|
|
5893
|
+
readonly "shield-alert": IconNode;
|
|
5894
|
+
readonly "shield-check": IconNode;
|
|
5895
|
+
readonly "shield-x": IconNode;
|
|
5896
|
+
readonly square: IconNode;
|
|
5897
|
+
readonly "thumbs-down": IconNode;
|
|
5898
|
+
readonly "thumbs-up": IconNode;
|
|
5899
|
+
readonly upload: IconNode;
|
|
5900
|
+
readonly "volume-2": IconNode;
|
|
5901
|
+
readonly x: IconNode;
|
|
5902
|
+
readonly user: IconNode;
|
|
5903
|
+
readonly mail: IconNode;
|
|
5904
|
+
readonly phone: IconNode;
|
|
5905
|
+
readonly calendar: IconNode;
|
|
5906
|
+
readonly clock: IconNode;
|
|
5907
|
+
readonly building: IconNode;
|
|
5908
|
+
readonly "map-pin": IconNode;
|
|
5909
|
+
readonly lock: IconNode;
|
|
5910
|
+
readonly key: IconNode;
|
|
5911
|
+
readonly "credit-card": IconNode;
|
|
5912
|
+
readonly "at-sign": IconNode;
|
|
5913
|
+
readonly hash: IconNode;
|
|
5914
|
+
readonly globe: IconNode;
|
|
5915
|
+
readonly link: IconNode;
|
|
5916
|
+
readonly "circle-check": IconNode;
|
|
5917
|
+
readonly "circle-x": IconNode;
|
|
5918
|
+
readonly "triangle-alert": IconNode;
|
|
5919
|
+
readonly info: IconNode;
|
|
5920
|
+
readonly ban: IconNode;
|
|
5921
|
+
readonly shield: IconNode;
|
|
5922
|
+
readonly "arrow-left": IconNode;
|
|
5923
|
+
readonly "arrow-right": IconNode;
|
|
5924
|
+
readonly "external-link": IconNode;
|
|
5925
|
+
readonly ellipsis: IconNode;
|
|
5926
|
+
readonly "ellipsis-vertical": IconNode;
|
|
5927
|
+
readonly menu: IconNode;
|
|
5928
|
+
readonly house: IconNode;
|
|
5929
|
+
readonly plus: IconNode;
|
|
5930
|
+
readonly minus: IconNode;
|
|
5931
|
+
readonly pencil: IconNode;
|
|
5932
|
+
readonly trash: IconNode;
|
|
5933
|
+
readonly "trash-2": IconNode;
|
|
5934
|
+
readonly save: IconNode;
|
|
5935
|
+
readonly download: IconNode;
|
|
5936
|
+
readonly share: IconNode;
|
|
5937
|
+
readonly funnel: IconNode;
|
|
5938
|
+
readonly settings: IconNode;
|
|
5939
|
+
readonly "rotate-cw": IconNode;
|
|
5940
|
+
readonly maximize: IconNode;
|
|
5941
|
+
readonly minimize: IconNode;
|
|
5942
|
+
readonly "shopping-cart": IconNode;
|
|
5943
|
+
readonly "shopping-bag": IconNode;
|
|
5944
|
+
readonly package: IconNode;
|
|
5945
|
+
readonly truck: IconNode;
|
|
5946
|
+
readonly tag: IconNode;
|
|
5947
|
+
readonly gift: IconNode;
|
|
5948
|
+
readonly receipt: IconNode;
|
|
5949
|
+
readonly wallet: IconNode;
|
|
5950
|
+
readonly store: IconNode;
|
|
5951
|
+
readonly "dollar-sign": IconNode;
|
|
5952
|
+
readonly percent: IconNode;
|
|
5953
|
+
readonly play: IconNode;
|
|
5954
|
+
readonly pause: IconNode;
|
|
5955
|
+
readonly "volume-x": IconNode;
|
|
5956
|
+
readonly camera: IconNode;
|
|
5957
|
+
readonly image: IconNode;
|
|
5958
|
+
readonly film: IconNode;
|
|
5959
|
+
readonly headphones: IconNode;
|
|
5960
|
+
readonly "message-circle": IconNode;
|
|
5961
|
+
readonly "message-square": IconNode;
|
|
5962
|
+
readonly bell: IconNode;
|
|
5963
|
+
readonly heart: IconNode;
|
|
5964
|
+
readonly star: IconNode;
|
|
5965
|
+
readonly eye: IconNode;
|
|
5966
|
+
readonly "eye-off": IconNode;
|
|
5967
|
+
readonly bookmark: IconNode;
|
|
5968
|
+
readonly "calendar-days": IconNode;
|
|
5969
|
+
readonly history: IconNode;
|
|
5970
|
+
readonly timer: IconNode;
|
|
5971
|
+
readonly folder: IconNode;
|
|
5972
|
+
readonly "folder-open": IconNode;
|
|
5973
|
+
readonly files: IconNode;
|
|
5974
|
+
readonly sparkles: IconNode;
|
|
5975
|
+
readonly zap: IconNode;
|
|
5976
|
+
readonly sun: IconNode;
|
|
5977
|
+
readonly moon: IconNode;
|
|
5978
|
+
readonly flag: IconNode;
|
|
5979
|
+
readonly monitor: IconNode;
|
|
5980
|
+
readonly smartphone: IconNode;
|
|
5981
|
+
};
|
|
5982
|
+
/**
|
|
5983
|
+
* Names of lucide icons that ship with the widget. Names not in this
|
|
5984
|
+
* union return `null` from `renderLucideIcon` (with a console warning).
|
|
5985
|
+
*/
|
|
5986
|
+
type IconName = keyof typeof LUCIDE_ICONS;
|
|
5987
|
+
/**
|
|
5988
|
+
* Renders a lucide icon as an inline SVG element. Works inside Shadow
|
|
5989
|
+
* DOM and requires no CSS.
|
|
5990
|
+
*
|
|
5991
|
+
* @param iconName - A lucide kebab-case name from the registry. See
|
|
5992
|
+
* `IconName` for the full list, or `docs/icon-registry-shortlist.md`
|
|
5993
|
+
* for rationale.
|
|
5994
|
+
* @param size - The size in pixels (number) or any CSS length string.
|
|
5995
|
+
* @param color - Stroke color (default: "currentColor").
|
|
5996
|
+
* @param strokeWidth - Stroke width (default: 2).
|
|
5997
|
+
* @returns SVGElement, or null if the name is not in the registry.
|
|
5998
|
+
*/
|
|
5999
|
+
declare const renderLucideIcon: (iconName: IconName | (string & {}), size?: number | string, color?: string, strokeWidth?: number) => SVGElement | null;
|
|
6000
|
+
|
|
5635
6001
|
/** Options for {@link createIconButton}. */
|
|
5636
6002
|
interface CreateIconButtonOptions {
|
|
5637
6003
|
/** Lucide icon name (kebab-case, e.g. "eye", "chevron-down"). */
|
|
@@ -6229,11 +6595,20 @@ declare function createComponentMiddleware(): {
|
|
|
6229
6595
|
reset: () => void;
|
|
6230
6596
|
};
|
|
6231
6597
|
/**
|
|
6232
|
-
* Checks if a message contains a component directive
|
|
6598
|
+
* Checks if a message contains a component directive.
|
|
6599
|
+
*
|
|
6600
|
+
* Looks at `rawContent` first (the field set by stream parsers); falls back
|
|
6601
|
+
* to `content` when it looks like JSON, so injected messages that pass the
|
|
6602
|
+
* directive via `content` (or have no `rawContent`) are still recognized.
|
|
6233
6603
|
*/
|
|
6234
6604
|
declare function hasComponentDirective(message: AgentWidgetMessage): boolean;
|
|
6235
6605
|
/**
|
|
6236
|
-
* Extracts component directive from a complete message
|
|
6606
|
+
* Extracts component directive from a complete message.
|
|
6607
|
+
*
|
|
6608
|
+
* Looks at `rawContent` first (the field set by stream parsers); falls back
|
|
6609
|
+
* to `content` when it looks like JSON, so injected messages that pass the
|
|
6610
|
+
* directive via `content` (or have no `rawContent`) render the same as
|
|
6611
|
+
* streamed ones.
|
|
6237
6612
|
*/
|
|
6238
6613
|
declare function extractComponentDirectiveFromMessage(message: AgentWidgetMessage): ComponentDirective | null;
|
|
6239
6614
|
|
|
@@ -6343,8 +6718,10 @@ interface ComposerBuildContext {
|
|
|
6343
6718
|
disabled?: boolean;
|
|
6344
6719
|
}
|
|
6345
6720
|
/**
|
|
6346
|
-
* Build the
|
|
6347
|
-
*
|
|
6721
|
+
* Build the full footer + composer form (column-stacked card layout) for
|
|
6722
|
+
* the floating, docked, and inline-embed launcher modes. The pill variant
|
|
6723
|
+
* for `mountMode: "composer-bar"` lives in `pill-composer-builder.ts` and
|
|
6724
|
+
* shares the same low-level part factories from `composer-parts.ts`.
|
|
6348
6725
|
*/
|
|
6349
6726
|
declare const buildComposer: (context: ComposerBuildContext) => ComposerElements;
|
|
6350
6727
|
|
|
@@ -6383,4 +6760,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
|
|
|
6383
6760
|
declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
|
|
6384
6761
|
declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
|
|
6385
6762
|
|
|
6386
|
-
export { ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateComboButtonOptions, type CreateDropdownOptions, type CreateIconButtonOptions, type CreateLabelButtonOptions, type CreateStandardBubbleOptions, type CreateThemeOptions, type CreateToggleGroupOptions, DEFAULT_COMPONENTS, DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH, DEFAULT_FLOATING_LAUNCHER_WIDTH, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DeepPartial, type DemoCarouselHandle, type DemoCarouselItem, type DemoCarouselOptions, type DomContextMode, type DomContextOptions, type DropdownMenuHandle, type DropdownMenuItem, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createAskUserQuestionBubble, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComboButton, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDemoCarousel, createDirectivePostprocessor, createDropdownMenu, createFlexibleJsonStreamParser, createIconButton, createImagePart, createJsonStreamParser, createLabelButton, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|
|
6763
|
+
export { ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateComboButtonOptions, type CreateDropdownOptions, type CreateIconButtonOptions, type CreateLabelButtonOptions, type CreateStandardBubbleOptions, type CreateThemeOptions, type CreateToggleGroupOptions, DEFAULT_COMPONENTS, DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH, DEFAULT_FLOATING_LAUNCHER_WIDTH, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DeepPartial, type DemoCarouselHandle, type DemoCarouselItem, type DemoCarouselOptions, type DomContextMode, type DomContextOptions, type DropdownMenuHandle, type DropdownMenuItem, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IconName, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectComponentDirectiveOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createAskUserQuestionBubble, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComboButton, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDemoCarousel, createDirectivePostprocessor, createDropdownMenu, createFlexibleJsonStreamParser, createIconButton, createImagePart, createJsonStreamParser, createLabelButton, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|