@runtypelabs/persona 3.16.0 → 3.17.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/animations/glyph-cycle.cjs +279 -0
- package/dist/animations/glyph-cycle.d.cts +5 -0
- package/dist/animations/glyph-cycle.d.ts +5 -0
- package/dist/animations/glyph-cycle.js +252 -0
- package/dist/animations/types-HPZY7oAI.d.cts +282 -0
- package/dist/animations/types-HPZY7oAI.d.ts +282 -0
- package/dist/animations/wipe.cjs +107 -0
- package/dist/animations/wipe.d.cts +5 -0
- package/dist/animations/wipe.d.ts +5 -0
- package/dist/animations/wipe.js +80 -0
- package/dist/index.cjs +48 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +205 -1
- package/dist/index.d.ts +205 -1
- package/dist/index.global.js +136 -81
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +48 -47
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +85 -0
- package/dist/testing.d.cts +39 -0
- package/dist/testing.d.ts +39 -0
- package/dist/testing.js +56 -0
- package/dist/theme-editor.cjs +714 -99
- package/dist/theme-editor.d.cts +214 -2
- package/dist/theme-editor.d.ts +214 -2
- package/dist/theme-editor.js +712 -99
- package/dist/widget.css +133 -0
- package/package.json +20 -3
- package/src/animations/glyph-cycle.ts +332 -0
- package/src/animations/wipe.ts +66 -0
- package/src/client.test.ts +141 -0
- package/src/client.ts +28 -0
- package/src/components/composer-builder.ts +61 -10
- package/src/components/message-bubble.test.ts +181 -2
- package/src/components/message-bubble.ts +209 -14
- package/src/components/panel.ts +4 -1
- package/src/defaults.ts +16 -0
- package/src/index-global.ts +31 -0
- package/src/index.ts +18 -0
- package/src/session.test.ts +93 -1
- package/src/session.ts +5 -0
- package/src/styles/widget.css +133 -0
- package/src/testing/index.ts +11 -0
- package/src/testing/mock-stream.test.ts +80 -0
- package/src/testing/mock-stream.ts +94 -0
- package/src/testing.ts +2 -0
- package/src/theme-editor/index.ts +4 -0
- package/src/theme-editor/preview-utils.test.ts +60 -0
- package/src/theme-editor/preview-utils.ts +129 -0
- package/src/theme-editor/sections.test.ts +19 -0
- package/src/theme-editor/sections.ts +84 -1
- package/src/types.ts +210 -0
- package/src/ui.stop-button.test.ts +165 -0
- package/src/ui.ts +75 -6
- package/src/utils/message-fingerprint.ts +2 -0
- package/src/utils/morph.ts +7 -0
- package/src/utils/stream-animation.test.ts +417 -0
- package/src/utils/stream-animation.ts +449 -0
package/dist/index.d.cts
CHANGED
|
@@ -1272,6 +1272,151 @@ type AgentWidgetReasoningDisplayFeature = {
|
|
|
1272
1272
|
*/
|
|
1273
1273
|
loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
|
|
1274
1274
|
};
|
|
1275
|
+
/**
|
|
1276
|
+
* Reveal animation applied to assistant message text while it is streaming.
|
|
1277
|
+
*
|
|
1278
|
+
* Built-in types always available:
|
|
1279
|
+
* - `none` — text appears as tokens arrive (default).
|
|
1280
|
+
* - `typewriter` — characters fade in with a blinking caret.
|
|
1281
|
+
* - `pop-bubble` — the bubble scales in; text streams normally afterward.
|
|
1282
|
+
* - `letter-rise` — per-char translateY + fade reveal.
|
|
1283
|
+
* - `word-fade` — per-word blur + translateY fade-in.
|
|
1284
|
+
*
|
|
1285
|
+
* Subpath plugins (import from `@runtypelabs/persona/animations/*` to register):
|
|
1286
|
+
* - `wipe`, `glyph-cycle`.
|
|
1287
|
+
*
|
|
1288
|
+
* Custom types are allowed — register a plugin with any string name and
|
|
1289
|
+
* reference it by that name in `type`.
|
|
1290
|
+
*/
|
|
1291
|
+
type AgentWidgetStreamAnimationBuiltinType = "none" | "typewriter" | "word-fade" | "letter-rise" | "glyph-cycle" | "wipe" | "pop-bubble";
|
|
1292
|
+
type AgentWidgetStreamAnimationType = AgentWidgetStreamAnimationBuiltinType | (string & {});
|
|
1293
|
+
/**
|
|
1294
|
+
* Placeholder shown inside a streaming assistant bubble before the first token arrives.
|
|
1295
|
+
* - `none` — use the default typing-dots indicator (existing behavior).
|
|
1296
|
+
* - `skeleton` — shimmer bars, replaced by streaming content once it starts.
|
|
1297
|
+
*/
|
|
1298
|
+
type AgentWidgetStreamAnimationPlaceholder = "none" | "skeleton";
|
|
1299
|
+
/**
|
|
1300
|
+
* How much of the accumulated streaming content to display while tokens are
|
|
1301
|
+
* still arriving. Trimming to a boundary means in-progress words or lines
|
|
1302
|
+
* stay hidden until they complete — useful for animations that benefit from
|
|
1303
|
+
* unit-complete reveals (e.g. wipe, glyph-cycle).
|
|
1304
|
+
* - `none` — show every character as it arrives (default).
|
|
1305
|
+
* - `word` — trim to the last whitespace boundary.
|
|
1306
|
+
* - `line` — trim to the last newline boundary.
|
|
1307
|
+
*/
|
|
1308
|
+
type AgentWidgetStreamAnimationBuffer = "none" | "word" | "line";
|
|
1309
|
+
/**
|
|
1310
|
+
* Context passed to plugin lifecycle hooks. Carries the live DOM references
|
|
1311
|
+
* and resolved animation settings for the currently-streaming message.
|
|
1312
|
+
*/
|
|
1313
|
+
type StreamAnimationContext = {
|
|
1314
|
+
/** The `.persona-message-content` element owning the streamed text. */
|
|
1315
|
+
container: HTMLElement;
|
|
1316
|
+
/** The outer message bubble element. */
|
|
1317
|
+
bubble: HTMLElement;
|
|
1318
|
+
/** ID of the streaming message. */
|
|
1319
|
+
messageId: string;
|
|
1320
|
+
/** Read-only reference to the message being streamed. */
|
|
1321
|
+
message: AgentWidgetMessage;
|
|
1322
|
+
/** Effective `speed` from `streamAnimation.speed`. */
|
|
1323
|
+
speed: number;
|
|
1324
|
+
/** Effective `duration` from `streamAnimation.duration`. */
|
|
1325
|
+
duration: number;
|
|
1326
|
+
};
|
|
1327
|
+
/**
|
|
1328
|
+
* Pluggable stream animation. Third-party packages and inline registrations
|
|
1329
|
+
* implement this interface to add custom reveal effects.
|
|
1330
|
+
*
|
|
1331
|
+
* Lifecycle:
|
|
1332
|
+
* - When the widget mounts and detects a plugin (either passed via config or
|
|
1333
|
+
* auto-registered in the IIFE bundle), it injects `styles` once into the
|
|
1334
|
+
* widget's style host.
|
|
1335
|
+
* - For each streaming assistant message whose `type` matches `name`, the
|
|
1336
|
+
* widget applies `containerClass` / `bubbleClass`, wraps text per `wrap`,
|
|
1337
|
+
* and — if `useCaret` is true — appends a blinking caret.
|
|
1338
|
+
* - Hooks fire after the live DOM is morphed; plugins use stable element IDs
|
|
1339
|
+
* and `data-preserve-animation` to safely mutate per-char or per-word spans
|
|
1340
|
+
* without idiomorph clobbering in-flight work.
|
|
1341
|
+
*/
|
|
1342
|
+
type StreamAnimationPlugin = {
|
|
1343
|
+
/** Plugin identifier. Matches the `type` field in `streamAnimation`. */
|
|
1344
|
+
name: string;
|
|
1345
|
+
/** Class added to `.persona-message-content` while streaming. */
|
|
1346
|
+
containerClass?: string;
|
|
1347
|
+
/** Class added to the bubble element (e.g. a one-shot scale animation). */
|
|
1348
|
+
bubbleClass?: string;
|
|
1349
|
+
/** Wrap mode applied to text nodes during streaming. @default "none" */
|
|
1350
|
+
wrap?: "none" | "char" | "word";
|
|
1351
|
+
/**
|
|
1352
|
+
* HTML tags whose descendant text is skipped during wrapping. Defaults to
|
|
1353
|
+
* `["pre", "code", "a", "script", "style"]` — useful for keeping code
|
|
1354
|
+
* blocks legible and link click-targets intact. Plugins that want to
|
|
1355
|
+
* animate characters inside inline code (e.g. `glyph-cycle`) can narrow
|
|
1356
|
+
* the list.
|
|
1357
|
+
*/
|
|
1358
|
+
skipTags?: string[];
|
|
1359
|
+
/** Append a blinking caret after the last rendered char/word. */
|
|
1360
|
+
useCaret?: boolean;
|
|
1361
|
+
/** CSS string injected into the widget style host on first activation. */
|
|
1362
|
+
styles?: string;
|
|
1363
|
+
/**
|
|
1364
|
+
* Optional custom buffering strategy. Returns the portion of `content`
|
|
1365
|
+
* that should be rendered during streaming. Use this for buffering
|
|
1366
|
+
* schemes beyond the built-in `word` / `line` strategies.
|
|
1367
|
+
*/
|
|
1368
|
+
bufferContent?: (content: string, message: AgentWidgetMessage) => string;
|
|
1369
|
+
/**
|
|
1370
|
+
* Fires once when the plugin is first activated inside a widget instance.
|
|
1371
|
+
* Use this to set up MutationObservers or other long-lived listeners.
|
|
1372
|
+
* Return an optional cleanup function that runs on widget destroy.
|
|
1373
|
+
*/
|
|
1374
|
+
onAttach?: (root: HTMLElement | ShadowRoot) => (() => void) | void;
|
|
1375
|
+
/** Fires after each render that reaches the live DOM. */
|
|
1376
|
+
onAfterRender?: (ctx: StreamAnimationContext) => void;
|
|
1377
|
+
/** Fires when a streamed message's `streaming` flag flips to false. */
|
|
1378
|
+
onStreamComplete?: (ctx: StreamAnimationContext) => void;
|
|
1379
|
+
/**
|
|
1380
|
+
* Report whether the plugin still has in-flight animation work for a
|
|
1381
|
+
* message. When `true`, the widget keeps rendering the message in its
|
|
1382
|
+
* "streaming-animated" mode even after `message.streaming` flips false —
|
|
1383
|
+
* preventing the final non-animated render from yanking the rug out from
|
|
1384
|
+
* under unfinished per-char cycles or reveals.
|
|
1385
|
+
*/
|
|
1386
|
+
isAnimating?: (message: AgentWidgetMessage) => boolean;
|
|
1387
|
+
};
|
|
1388
|
+
type AgentWidgetStreamAnimationFeature = {
|
|
1389
|
+
/** Reveal animation to apply while streaming. @default "none" */
|
|
1390
|
+
type?: AgentWidgetStreamAnimationType;
|
|
1391
|
+
/** Pre-first-token placeholder. @default "none" */
|
|
1392
|
+
placeholder?: AgentWidgetStreamAnimationPlaceholder;
|
|
1393
|
+
/**
|
|
1394
|
+
* Per-unit animation duration (ms) for `typewriter`, `letter-rise`, `word-fade`,
|
|
1395
|
+
* and per-unit plugin animations. Each arriving character/word animates from
|
|
1396
|
+
* invisible to visible over this duration, independent of its position — the
|
|
1397
|
+
* streaming cadence itself provides the visible stagger.
|
|
1398
|
+
* @default 120
|
|
1399
|
+
*/
|
|
1400
|
+
speed?: number;
|
|
1401
|
+
/**
|
|
1402
|
+
* Total duration of container-level animations (`pop-bubble` and custom
|
|
1403
|
+
* plugin animations), in milliseconds.
|
|
1404
|
+
* @default 1800
|
|
1405
|
+
*/
|
|
1406
|
+
duration?: number;
|
|
1407
|
+
/**
|
|
1408
|
+
* Trim the accumulated streaming content to a word or line boundary before
|
|
1409
|
+
* rendering. Hides in-progress units until they complete.
|
|
1410
|
+
* @default "none"
|
|
1411
|
+
*/
|
|
1412
|
+
buffer?: AgentWidgetStreamAnimationBuffer;
|
|
1413
|
+
/**
|
|
1414
|
+
* Extra animation plugins available to this widget instance. Keys are
|
|
1415
|
+
* plugin names; the matching plugin activates when `type` is set to that
|
|
1416
|
+
* name. Built-in types (`typewriter`, `pop-bubble`) are always registered.
|
|
1417
|
+
*/
|
|
1418
|
+
plugins?: Record<string, StreamAnimationPlugin>;
|
|
1419
|
+
};
|
|
1275
1420
|
type AgentWidgetFeatureFlags = {
|
|
1276
1421
|
showReasoning?: boolean;
|
|
1277
1422
|
showToolCalls?: boolean;
|
|
@@ -1286,6 +1431,8 @@ type AgentWidgetFeatureFlags = {
|
|
|
1286
1431
|
eventStream?: EventStreamConfig;
|
|
1287
1432
|
/** Optional artifact sidebar (split pane / mobile drawer) */
|
|
1288
1433
|
artifacts?: AgentWidgetArtifactsFeature;
|
|
1434
|
+
/** Reveal animation for streaming assistant text. */
|
|
1435
|
+
streamAnimation?: AgentWidgetStreamAnimationFeature;
|
|
1289
1436
|
};
|
|
1290
1437
|
type SSEEventRecord = {
|
|
1291
1438
|
id: string;
|
|
@@ -1574,6 +1721,10 @@ type AgentWidgetSendButtonConfig = {
|
|
|
1574
1721
|
backgroundColor?: string;
|
|
1575
1722
|
textColor?: string;
|
|
1576
1723
|
size?: string;
|
|
1724
|
+
/** Lucide icon name shown while a response is streaming. Clicking the button in this state aborts the stream. Default: "square". */
|
|
1725
|
+
stopIconName?: string;
|
|
1726
|
+
/** Tooltip text shown while streaming. Default: "Stop generating". */
|
|
1727
|
+
stopTooltipText?: string;
|
|
1577
1728
|
};
|
|
1578
1729
|
/** Optional composer UI state for custom `renderComposer` implementations. */
|
|
1579
1730
|
type AgentWidgetComposerConfig = {
|
|
@@ -3089,11 +3240,21 @@ type AgentWidgetConfig = {
|
|
|
3089
3240
|
welcomeSubtitle?: string;
|
|
3090
3241
|
inputPlaceholder?: string;
|
|
3091
3242
|
sendButtonLabel?: string;
|
|
3243
|
+
/** Button label shown in text mode while a response is streaming. Default: "Stop". */
|
|
3244
|
+
stopButtonLabel?: string;
|
|
3092
3245
|
/**
|
|
3093
3246
|
* When false, the welcome / intro card is not shown above the message list.
|
|
3094
3247
|
* @default true
|
|
3095
3248
|
*/
|
|
3096
3249
|
showWelcomeCard?: boolean;
|
|
3250
|
+
/**
|
|
3251
|
+
* Per-stop-reason copy for the inline notice rendered on assistant
|
|
3252
|
+
* bubbles when the runtime reports a non-natural stop (e.g. the agent
|
|
3253
|
+
* loop hit `max_tool_calls` and was cut off mid-loop). Each key is
|
|
3254
|
+
* optional — keys you omit fall back to the built-in defaults. Set a
|
|
3255
|
+
* key to an empty string to suppress the notice for that reason.
|
|
3256
|
+
*/
|
|
3257
|
+
stopReasonNotice?: Partial<Record<StopReasonKind, string>>;
|
|
3097
3258
|
};
|
|
3098
3259
|
/**
|
|
3099
3260
|
* Semantic design tokens (`palette`, `semantic`, `components`).
|
|
@@ -3591,6 +3752,21 @@ type AgentWidgetApproval = {
|
|
|
3591
3752
|
resolvedAt?: number;
|
|
3592
3753
|
};
|
|
3593
3754
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
3755
|
+
/**
|
|
3756
|
+
* Per-turn / per-step stop reason emitted by the runtime on
|
|
3757
|
+
* `agent_turn_complete` and `step_complete` SSE events. The vocabulary is
|
|
3758
|
+
* owned by the upstream Runtype API — do not extend without coordination.
|
|
3759
|
+
*
|
|
3760
|
+
* - `end_turn` — natural completion (no affordance needed)
|
|
3761
|
+
* - `max_tool_calls` — agent loop tripped the configured tool-call ceiling
|
|
3762
|
+
* - `length` — provider hit max output tokens
|
|
3763
|
+
* - `content_filter` — provider content filter intervened
|
|
3764
|
+
* - `error` — provider/runtime error (prefer existing error rendering)
|
|
3765
|
+
* - `unknown` — explicitly reported but uninformative
|
|
3766
|
+
*
|
|
3767
|
+
* Absent (`undefined`) means "not reported" — distinct from `'unknown'`.
|
|
3768
|
+
*/
|
|
3769
|
+
type StopReasonKind = 'end_turn' | 'max_tool_calls' | 'length' | 'content_filter' | 'error' | 'unknown';
|
|
3594
3770
|
/**
|
|
3595
3771
|
* Represents a message in the chat conversation.
|
|
3596
3772
|
*
|
|
@@ -3677,6 +3853,17 @@ type AgentWidgetMessage = {
|
|
|
3677
3853
|
* Contains execution context like iteration number and turn ID.
|
|
3678
3854
|
*/
|
|
3679
3855
|
agentMetadata?: AgentMessageMetadata;
|
|
3856
|
+
/**
|
|
3857
|
+
* Per-turn stop reason reported by the runtime on `agent_turn_complete`
|
|
3858
|
+
* (agent-loop path) or the last `step_complete` for a prompt step
|
|
3859
|
+
* (dispatch / flow path). Absent when the API did not report a value.
|
|
3860
|
+
*
|
|
3861
|
+
* When set to a non-natural value (`max_tool_calls`, `length`,
|
|
3862
|
+
* `content_filter`, `error`), the widget renders an inline notice on
|
|
3863
|
+
* the assistant bubble. See `config.copy.stopReasonNotice` to override
|
|
3864
|
+
* the default copy.
|
|
3865
|
+
*/
|
|
3866
|
+
stopReason?: StopReasonKind;
|
|
3680
3867
|
};
|
|
3681
3868
|
/**
|
|
3682
3869
|
* Options for injecting a message into the conversation.
|
|
@@ -5075,6 +5262,16 @@ declare class PluginRegistry {
|
|
|
5075
5262
|
}
|
|
5076
5263
|
declare const pluginRegistry: PluginRegistry;
|
|
5077
5264
|
|
|
5265
|
+
/**
|
|
5266
|
+
* Register a custom stream animation plugin globally. Subsequent widget
|
|
5267
|
+
* instances can reference the plugin by `name` in `features.streamAnimation.type`.
|
|
5268
|
+
* Per-widget plugin overrides via `features.streamAnimation.plugins` take
|
|
5269
|
+
* precedence over the global registry.
|
|
5270
|
+
*/
|
|
5271
|
+
declare const registerStreamAnimationPlugin: (plugin: StreamAnimationPlugin) => void;
|
|
5272
|
+
declare const unregisterStreamAnimationPlugin: (name: string) => void;
|
|
5273
|
+
declare const listRegisteredStreamAnimations: () => string[];
|
|
5274
|
+
|
|
5078
5275
|
interface DropdownMenuItem {
|
|
5079
5276
|
id: string;
|
|
5080
5277
|
label: string;
|
|
@@ -5833,6 +6030,13 @@ interface ComposerElements {
|
|
|
5833
6030
|
actionsRow: HTMLElement;
|
|
5834
6031
|
leftActions: HTMLElement;
|
|
5835
6032
|
rightActions: HTMLElement;
|
|
6033
|
+
/**
|
|
6034
|
+
* Swap the send button between its idle ("send") appearance and its
|
|
6035
|
+
* streaming ("stop") appearance. In icon mode this swaps the SVG; in text
|
|
6036
|
+
* mode it swaps the button label. Tooltip text is updated when a tooltip
|
|
6037
|
+
* element is present.
|
|
6038
|
+
*/
|
|
6039
|
+
setSendButtonMode: (mode: "send" | "stop") => void;
|
|
5836
6040
|
}
|
|
5837
6041
|
interface ComposerBuildContext {
|
|
5838
6042
|
config?: AgentWidgetConfig;
|
|
@@ -5880,4 +6084,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
|
|
|
5880
6084
|
declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
|
|
5881
6085
|
declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
|
|
5882
6086
|
|
|
5883
|
-
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, 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 AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, 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, 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, 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, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, validateImageFile, validateTheme };
|
|
6087
|
+
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, 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, 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, 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, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -1272,6 +1272,151 @@ type AgentWidgetReasoningDisplayFeature = {
|
|
|
1272
1272
|
*/
|
|
1273
1273
|
loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
|
|
1274
1274
|
};
|
|
1275
|
+
/**
|
|
1276
|
+
* Reveal animation applied to assistant message text while it is streaming.
|
|
1277
|
+
*
|
|
1278
|
+
* Built-in types always available:
|
|
1279
|
+
* - `none` — text appears as tokens arrive (default).
|
|
1280
|
+
* - `typewriter` — characters fade in with a blinking caret.
|
|
1281
|
+
* - `pop-bubble` — the bubble scales in; text streams normally afterward.
|
|
1282
|
+
* - `letter-rise` — per-char translateY + fade reveal.
|
|
1283
|
+
* - `word-fade` — per-word blur + translateY fade-in.
|
|
1284
|
+
*
|
|
1285
|
+
* Subpath plugins (import from `@runtypelabs/persona/animations/*` to register):
|
|
1286
|
+
* - `wipe`, `glyph-cycle`.
|
|
1287
|
+
*
|
|
1288
|
+
* Custom types are allowed — register a plugin with any string name and
|
|
1289
|
+
* reference it by that name in `type`.
|
|
1290
|
+
*/
|
|
1291
|
+
type AgentWidgetStreamAnimationBuiltinType = "none" | "typewriter" | "word-fade" | "letter-rise" | "glyph-cycle" | "wipe" | "pop-bubble";
|
|
1292
|
+
type AgentWidgetStreamAnimationType = AgentWidgetStreamAnimationBuiltinType | (string & {});
|
|
1293
|
+
/**
|
|
1294
|
+
* Placeholder shown inside a streaming assistant bubble before the first token arrives.
|
|
1295
|
+
* - `none` — use the default typing-dots indicator (existing behavior).
|
|
1296
|
+
* - `skeleton` — shimmer bars, replaced by streaming content once it starts.
|
|
1297
|
+
*/
|
|
1298
|
+
type AgentWidgetStreamAnimationPlaceholder = "none" | "skeleton";
|
|
1299
|
+
/**
|
|
1300
|
+
* How much of the accumulated streaming content to display while tokens are
|
|
1301
|
+
* still arriving. Trimming to a boundary means in-progress words or lines
|
|
1302
|
+
* stay hidden until they complete — useful for animations that benefit from
|
|
1303
|
+
* unit-complete reveals (e.g. wipe, glyph-cycle).
|
|
1304
|
+
* - `none` — show every character as it arrives (default).
|
|
1305
|
+
* - `word` — trim to the last whitespace boundary.
|
|
1306
|
+
* - `line` — trim to the last newline boundary.
|
|
1307
|
+
*/
|
|
1308
|
+
type AgentWidgetStreamAnimationBuffer = "none" | "word" | "line";
|
|
1309
|
+
/**
|
|
1310
|
+
* Context passed to plugin lifecycle hooks. Carries the live DOM references
|
|
1311
|
+
* and resolved animation settings for the currently-streaming message.
|
|
1312
|
+
*/
|
|
1313
|
+
type StreamAnimationContext = {
|
|
1314
|
+
/** The `.persona-message-content` element owning the streamed text. */
|
|
1315
|
+
container: HTMLElement;
|
|
1316
|
+
/** The outer message bubble element. */
|
|
1317
|
+
bubble: HTMLElement;
|
|
1318
|
+
/** ID of the streaming message. */
|
|
1319
|
+
messageId: string;
|
|
1320
|
+
/** Read-only reference to the message being streamed. */
|
|
1321
|
+
message: AgentWidgetMessage;
|
|
1322
|
+
/** Effective `speed` from `streamAnimation.speed`. */
|
|
1323
|
+
speed: number;
|
|
1324
|
+
/** Effective `duration` from `streamAnimation.duration`. */
|
|
1325
|
+
duration: number;
|
|
1326
|
+
};
|
|
1327
|
+
/**
|
|
1328
|
+
* Pluggable stream animation. Third-party packages and inline registrations
|
|
1329
|
+
* implement this interface to add custom reveal effects.
|
|
1330
|
+
*
|
|
1331
|
+
* Lifecycle:
|
|
1332
|
+
* - When the widget mounts and detects a plugin (either passed via config or
|
|
1333
|
+
* auto-registered in the IIFE bundle), it injects `styles` once into the
|
|
1334
|
+
* widget's style host.
|
|
1335
|
+
* - For each streaming assistant message whose `type` matches `name`, the
|
|
1336
|
+
* widget applies `containerClass` / `bubbleClass`, wraps text per `wrap`,
|
|
1337
|
+
* and — if `useCaret` is true — appends a blinking caret.
|
|
1338
|
+
* - Hooks fire after the live DOM is morphed; plugins use stable element IDs
|
|
1339
|
+
* and `data-preserve-animation` to safely mutate per-char or per-word spans
|
|
1340
|
+
* without idiomorph clobbering in-flight work.
|
|
1341
|
+
*/
|
|
1342
|
+
type StreamAnimationPlugin = {
|
|
1343
|
+
/** Plugin identifier. Matches the `type` field in `streamAnimation`. */
|
|
1344
|
+
name: string;
|
|
1345
|
+
/** Class added to `.persona-message-content` while streaming. */
|
|
1346
|
+
containerClass?: string;
|
|
1347
|
+
/** Class added to the bubble element (e.g. a one-shot scale animation). */
|
|
1348
|
+
bubbleClass?: string;
|
|
1349
|
+
/** Wrap mode applied to text nodes during streaming. @default "none" */
|
|
1350
|
+
wrap?: "none" | "char" | "word";
|
|
1351
|
+
/**
|
|
1352
|
+
* HTML tags whose descendant text is skipped during wrapping. Defaults to
|
|
1353
|
+
* `["pre", "code", "a", "script", "style"]` — useful for keeping code
|
|
1354
|
+
* blocks legible and link click-targets intact. Plugins that want to
|
|
1355
|
+
* animate characters inside inline code (e.g. `glyph-cycle`) can narrow
|
|
1356
|
+
* the list.
|
|
1357
|
+
*/
|
|
1358
|
+
skipTags?: string[];
|
|
1359
|
+
/** Append a blinking caret after the last rendered char/word. */
|
|
1360
|
+
useCaret?: boolean;
|
|
1361
|
+
/** CSS string injected into the widget style host on first activation. */
|
|
1362
|
+
styles?: string;
|
|
1363
|
+
/**
|
|
1364
|
+
* Optional custom buffering strategy. Returns the portion of `content`
|
|
1365
|
+
* that should be rendered during streaming. Use this for buffering
|
|
1366
|
+
* schemes beyond the built-in `word` / `line` strategies.
|
|
1367
|
+
*/
|
|
1368
|
+
bufferContent?: (content: string, message: AgentWidgetMessage) => string;
|
|
1369
|
+
/**
|
|
1370
|
+
* Fires once when the plugin is first activated inside a widget instance.
|
|
1371
|
+
* Use this to set up MutationObservers or other long-lived listeners.
|
|
1372
|
+
* Return an optional cleanup function that runs on widget destroy.
|
|
1373
|
+
*/
|
|
1374
|
+
onAttach?: (root: HTMLElement | ShadowRoot) => (() => void) | void;
|
|
1375
|
+
/** Fires after each render that reaches the live DOM. */
|
|
1376
|
+
onAfterRender?: (ctx: StreamAnimationContext) => void;
|
|
1377
|
+
/** Fires when a streamed message's `streaming` flag flips to false. */
|
|
1378
|
+
onStreamComplete?: (ctx: StreamAnimationContext) => void;
|
|
1379
|
+
/**
|
|
1380
|
+
* Report whether the plugin still has in-flight animation work for a
|
|
1381
|
+
* message. When `true`, the widget keeps rendering the message in its
|
|
1382
|
+
* "streaming-animated" mode even after `message.streaming` flips false —
|
|
1383
|
+
* preventing the final non-animated render from yanking the rug out from
|
|
1384
|
+
* under unfinished per-char cycles or reveals.
|
|
1385
|
+
*/
|
|
1386
|
+
isAnimating?: (message: AgentWidgetMessage) => boolean;
|
|
1387
|
+
};
|
|
1388
|
+
type AgentWidgetStreamAnimationFeature = {
|
|
1389
|
+
/** Reveal animation to apply while streaming. @default "none" */
|
|
1390
|
+
type?: AgentWidgetStreamAnimationType;
|
|
1391
|
+
/** Pre-first-token placeholder. @default "none" */
|
|
1392
|
+
placeholder?: AgentWidgetStreamAnimationPlaceholder;
|
|
1393
|
+
/**
|
|
1394
|
+
* Per-unit animation duration (ms) for `typewriter`, `letter-rise`, `word-fade`,
|
|
1395
|
+
* and per-unit plugin animations. Each arriving character/word animates from
|
|
1396
|
+
* invisible to visible over this duration, independent of its position — the
|
|
1397
|
+
* streaming cadence itself provides the visible stagger.
|
|
1398
|
+
* @default 120
|
|
1399
|
+
*/
|
|
1400
|
+
speed?: number;
|
|
1401
|
+
/**
|
|
1402
|
+
* Total duration of container-level animations (`pop-bubble` and custom
|
|
1403
|
+
* plugin animations), in milliseconds.
|
|
1404
|
+
* @default 1800
|
|
1405
|
+
*/
|
|
1406
|
+
duration?: number;
|
|
1407
|
+
/**
|
|
1408
|
+
* Trim the accumulated streaming content to a word or line boundary before
|
|
1409
|
+
* rendering. Hides in-progress units until they complete.
|
|
1410
|
+
* @default "none"
|
|
1411
|
+
*/
|
|
1412
|
+
buffer?: AgentWidgetStreamAnimationBuffer;
|
|
1413
|
+
/**
|
|
1414
|
+
* Extra animation plugins available to this widget instance. Keys are
|
|
1415
|
+
* plugin names; the matching plugin activates when `type` is set to that
|
|
1416
|
+
* name. Built-in types (`typewriter`, `pop-bubble`) are always registered.
|
|
1417
|
+
*/
|
|
1418
|
+
plugins?: Record<string, StreamAnimationPlugin>;
|
|
1419
|
+
};
|
|
1275
1420
|
type AgentWidgetFeatureFlags = {
|
|
1276
1421
|
showReasoning?: boolean;
|
|
1277
1422
|
showToolCalls?: boolean;
|
|
@@ -1286,6 +1431,8 @@ type AgentWidgetFeatureFlags = {
|
|
|
1286
1431
|
eventStream?: EventStreamConfig;
|
|
1287
1432
|
/** Optional artifact sidebar (split pane / mobile drawer) */
|
|
1288
1433
|
artifacts?: AgentWidgetArtifactsFeature;
|
|
1434
|
+
/** Reveal animation for streaming assistant text. */
|
|
1435
|
+
streamAnimation?: AgentWidgetStreamAnimationFeature;
|
|
1289
1436
|
};
|
|
1290
1437
|
type SSEEventRecord = {
|
|
1291
1438
|
id: string;
|
|
@@ -1574,6 +1721,10 @@ type AgentWidgetSendButtonConfig = {
|
|
|
1574
1721
|
backgroundColor?: string;
|
|
1575
1722
|
textColor?: string;
|
|
1576
1723
|
size?: string;
|
|
1724
|
+
/** Lucide icon name shown while a response is streaming. Clicking the button in this state aborts the stream. Default: "square". */
|
|
1725
|
+
stopIconName?: string;
|
|
1726
|
+
/** Tooltip text shown while streaming. Default: "Stop generating". */
|
|
1727
|
+
stopTooltipText?: string;
|
|
1577
1728
|
};
|
|
1578
1729
|
/** Optional composer UI state for custom `renderComposer` implementations. */
|
|
1579
1730
|
type AgentWidgetComposerConfig = {
|
|
@@ -3089,11 +3240,21 @@ type AgentWidgetConfig = {
|
|
|
3089
3240
|
welcomeSubtitle?: string;
|
|
3090
3241
|
inputPlaceholder?: string;
|
|
3091
3242
|
sendButtonLabel?: string;
|
|
3243
|
+
/** Button label shown in text mode while a response is streaming. Default: "Stop". */
|
|
3244
|
+
stopButtonLabel?: string;
|
|
3092
3245
|
/**
|
|
3093
3246
|
* When false, the welcome / intro card is not shown above the message list.
|
|
3094
3247
|
* @default true
|
|
3095
3248
|
*/
|
|
3096
3249
|
showWelcomeCard?: boolean;
|
|
3250
|
+
/**
|
|
3251
|
+
* Per-stop-reason copy for the inline notice rendered on assistant
|
|
3252
|
+
* bubbles when the runtime reports a non-natural stop (e.g. the agent
|
|
3253
|
+
* loop hit `max_tool_calls` and was cut off mid-loop). Each key is
|
|
3254
|
+
* optional — keys you omit fall back to the built-in defaults. Set a
|
|
3255
|
+
* key to an empty string to suppress the notice for that reason.
|
|
3256
|
+
*/
|
|
3257
|
+
stopReasonNotice?: Partial<Record<StopReasonKind, string>>;
|
|
3097
3258
|
};
|
|
3098
3259
|
/**
|
|
3099
3260
|
* Semantic design tokens (`palette`, `semantic`, `components`).
|
|
@@ -3591,6 +3752,21 @@ type AgentWidgetApproval = {
|
|
|
3591
3752
|
resolvedAt?: number;
|
|
3592
3753
|
};
|
|
3593
3754
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
3755
|
+
/**
|
|
3756
|
+
* Per-turn / per-step stop reason emitted by the runtime on
|
|
3757
|
+
* `agent_turn_complete` and `step_complete` SSE events. The vocabulary is
|
|
3758
|
+
* owned by the upstream Runtype API — do not extend without coordination.
|
|
3759
|
+
*
|
|
3760
|
+
* - `end_turn` — natural completion (no affordance needed)
|
|
3761
|
+
* - `max_tool_calls` — agent loop tripped the configured tool-call ceiling
|
|
3762
|
+
* - `length` — provider hit max output tokens
|
|
3763
|
+
* - `content_filter` — provider content filter intervened
|
|
3764
|
+
* - `error` — provider/runtime error (prefer existing error rendering)
|
|
3765
|
+
* - `unknown` — explicitly reported but uninformative
|
|
3766
|
+
*
|
|
3767
|
+
* Absent (`undefined`) means "not reported" — distinct from `'unknown'`.
|
|
3768
|
+
*/
|
|
3769
|
+
type StopReasonKind = 'end_turn' | 'max_tool_calls' | 'length' | 'content_filter' | 'error' | 'unknown';
|
|
3594
3770
|
/**
|
|
3595
3771
|
* Represents a message in the chat conversation.
|
|
3596
3772
|
*
|
|
@@ -3677,6 +3853,17 @@ type AgentWidgetMessage = {
|
|
|
3677
3853
|
* Contains execution context like iteration number and turn ID.
|
|
3678
3854
|
*/
|
|
3679
3855
|
agentMetadata?: AgentMessageMetadata;
|
|
3856
|
+
/**
|
|
3857
|
+
* Per-turn stop reason reported by the runtime on `agent_turn_complete`
|
|
3858
|
+
* (agent-loop path) or the last `step_complete` for a prompt step
|
|
3859
|
+
* (dispatch / flow path). Absent when the API did not report a value.
|
|
3860
|
+
*
|
|
3861
|
+
* When set to a non-natural value (`max_tool_calls`, `length`,
|
|
3862
|
+
* `content_filter`, `error`), the widget renders an inline notice on
|
|
3863
|
+
* the assistant bubble. See `config.copy.stopReasonNotice` to override
|
|
3864
|
+
* the default copy.
|
|
3865
|
+
*/
|
|
3866
|
+
stopReason?: StopReasonKind;
|
|
3680
3867
|
};
|
|
3681
3868
|
/**
|
|
3682
3869
|
* Options for injecting a message into the conversation.
|
|
@@ -5075,6 +5262,16 @@ declare class PluginRegistry {
|
|
|
5075
5262
|
}
|
|
5076
5263
|
declare const pluginRegistry: PluginRegistry;
|
|
5077
5264
|
|
|
5265
|
+
/**
|
|
5266
|
+
* Register a custom stream animation plugin globally. Subsequent widget
|
|
5267
|
+
* instances can reference the plugin by `name` in `features.streamAnimation.type`.
|
|
5268
|
+
* Per-widget plugin overrides via `features.streamAnimation.plugins` take
|
|
5269
|
+
* precedence over the global registry.
|
|
5270
|
+
*/
|
|
5271
|
+
declare const registerStreamAnimationPlugin: (plugin: StreamAnimationPlugin) => void;
|
|
5272
|
+
declare const unregisterStreamAnimationPlugin: (name: string) => void;
|
|
5273
|
+
declare const listRegisteredStreamAnimations: () => string[];
|
|
5274
|
+
|
|
5078
5275
|
interface DropdownMenuItem {
|
|
5079
5276
|
id: string;
|
|
5080
5277
|
label: string;
|
|
@@ -5833,6 +6030,13 @@ interface ComposerElements {
|
|
|
5833
6030
|
actionsRow: HTMLElement;
|
|
5834
6031
|
leftActions: HTMLElement;
|
|
5835
6032
|
rightActions: HTMLElement;
|
|
6033
|
+
/**
|
|
6034
|
+
* Swap the send button between its idle ("send") appearance and its
|
|
6035
|
+
* streaming ("stop") appearance. In icon mode this swaps the SVG; in text
|
|
6036
|
+
* mode it swaps the button label. Tooltip text is updated when a tooltip
|
|
6037
|
+
* element is present.
|
|
6038
|
+
*/
|
|
6039
|
+
setSendButtonMode: (mode: "send" | "stop") => void;
|
|
5836
6040
|
}
|
|
5837
6041
|
interface ComposerBuildContext {
|
|
5838
6042
|
config?: AgentWidgetConfig;
|
|
@@ -5880,4 +6084,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
|
|
|
5880
6084
|
declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
|
|
5881
6085
|
declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
|
|
5882
6086
|
|
|
5883
|
-
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, 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 AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, 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, 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, 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, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, validateImageFile, validateTheme };
|
|
6087
|
+
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, 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, 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, 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, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|