@runtypelabs/persona 3.29.1 → 3.31.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.
Files changed (68) hide show
  1. package/README.md +15 -2547
  2. package/dist/animations/glyph-cycle.d.cts +1 -1
  3. package/dist/animations/glyph-cycle.d.ts +1 -1
  4. package/dist/animations/{types-B_Qazlm4.d.cts → types-quh7NmYD.d.cts} +9 -0
  5. package/dist/animations/{types-B_Qazlm4.d.ts → types-quh7NmYD.d.ts} +9 -0
  6. package/dist/animations/wipe.d.cts +1 -1
  7. package/dist/animations/wipe.d.ts +1 -1
  8. package/dist/codegen.cjs +6 -6
  9. package/dist/codegen.js +4 -4
  10. package/dist/index.cjs +50 -50
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +164 -7
  13. package/dist/index.d.ts +164 -7
  14. package/dist/index.global.js +60 -60
  15. package/dist/index.global.js.map +1 -1
  16. package/dist/index.js +49 -49
  17. package/dist/index.js.map +1 -1
  18. package/dist/launcher.global.js +2 -2
  19. package/dist/launcher.global.js.map +1 -1
  20. package/dist/plugin-kit.cjs +1 -0
  21. package/dist/plugin-kit.d.cts +98 -0
  22. package/dist/plugin-kit.d.ts +98 -0
  23. package/dist/plugin-kit.js +1 -0
  24. package/dist/smart-dom-reader.d.cts +157 -4
  25. package/dist/smart-dom-reader.d.ts +157 -4
  26. package/dist/theme-editor.cjs +40 -40
  27. package/dist/theme-editor.d.cts +161 -6
  28. package/dist/theme-editor.d.ts +161 -6
  29. package/dist/theme-editor.js +40 -40
  30. package/dist/theme-reference.cjs +1 -1
  31. package/dist/theme-reference.d.cts +2 -0
  32. package/dist/theme-reference.d.ts +2 -0
  33. package/dist/theme-reference.js +1 -1
  34. package/dist/widget.css +19 -0
  35. package/package.json +8 -2
  36. package/src/client.ts +6 -0
  37. package/src/components/approval-bubble.test.ts +320 -0
  38. package/src/components/approval-bubble.ts +190 -20
  39. package/src/components/launcher.ts +6 -3
  40. package/src/components/panel.ts +7 -1
  41. package/src/components/tool-bubble.test.ts +39 -0
  42. package/src/components/tool-bubble.ts +4 -0
  43. package/src/defaults.ts +14 -0
  44. package/src/generated/runtype-openapi-contract.ts +4 -0
  45. package/src/index-core.ts +1 -0
  46. package/src/plugin-kit.test.ts +230 -0
  47. package/src/plugin-kit.ts +294 -0
  48. package/src/plugins/types.ts +49 -2
  49. package/src/session.test.ts +161 -0
  50. package/src/session.ts +41 -3
  51. package/src/styles/widget.css +19 -0
  52. package/src/theme-editor/preview-utils.test.ts +10 -0
  53. package/src/theme-editor/preview-utils.ts +29 -1
  54. package/src/theme-editor/sections.test.ts +17 -0
  55. package/src/theme-editor/sections.ts +31 -0
  56. package/src/theme-reference.ts +2 -2
  57. package/src/types/theme.ts +2 -0
  58. package/src/types.ts +109 -2
  59. package/src/ui.approval-plugin.test.ts +204 -0
  60. package/src/ui.scroll.test.ts +383 -0
  61. package/src/ui.ts +539 -56
  62. package/src/utils/auto-follow.test.ts +91 -0
  63. package/src/utils/auto-follow.ts +68 -0
  64. package/src/utils/theme.test.ts +6 -2
  65. package/src/utils/theme.ts +0 -8
  66. package/src/utils/tokens.ts +6 -1
  67. package/src/webmcp-bridge.test.ts +66 -0
  68. package/src/webmcp-bridge.ts +49 -0
package/dist/index.d.cts CHANGED
@@ -149,13 +149,59 @@ interface AgentWidgetPlugin {
149
149
  config: AgentWidgetConfig;
150
150
  }) => HTMLElement | null;
151
151
  /**
152
- * Custom renderer for approval bubbles
153
- * Return null to use default renderer
152
+ * Custom renderer for approval bubbles.
153
+ *
154
+ * Return an `HTMLElement` to fully own the approval UI, `defaultRenderer()`
155
+ * to render (or wrap) the built-in bubble, or `null` to fall through to the
156
+ * default. Unlike the built-in bubble — whose Approve/Deny buttons are wired
157
+ * via delegation — a fully custom element resolves the approval by calling
158
+ * the `approve`/`deny` callbacks. Both route through the same path the
159
+ * built-in buttons use (optimistic update, `onDecision`, in-place anchoring).
160
+ *
161
+ * An approval is a single binary gate, so there are exactly two outcomes.
162
+ * Pass `{ remember: true }` to flag a "remember this" affordance (e.g. an
163
+ * "Always allow" button); the current approval resolves identically, but the
164
+ * flag is forwarded to `config.approval.onDecision` so you can persist a
165
+ * don't-ask-again policy for future approvals.
166
+ *
167
+ * `renderApproval` is called again whenever the approval's status changes, so
168
+ * branch on `message.approval?.status` to render the resolved state (and tear
169
+ * down any global listeners you added while pending).
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * // An alternative prompt: "Always allow" / "Allow once" / "Deny".
174
+ * renderApproval: ({ message, approve, deny }) => {
175
+ * const approval = message.approval;
176
+ * if (!approval || approval.status !== "pending") return null; // default renders resolved state
177
+ * const root = document.createElement("div");
178
+ * root.textContent = `${approval.toolName} requires approval`;
179
+ *
180
+ * const always = document.createElement("button");
181
+ * always.textContent = "Always allow";
182
+ * always.addEventListener("click", () => approve({ remember: true }));
183
+ *
184
+ * const once = document.createElement("button");
185
+ * once.textContent = "Allow once";
186
+ * once.addEventListener("click", () => approve());
187
+ *
188
+ * const no = document.createElement("button");
189
+ * no.textContent = "Deny";
190
+ * no.addEventListener("click", () => deny());
191
+ *
192
+ * root.append(always, once, no);
193
+ * return root;
194
+ * }
195
+ * ```
154
196
  */
155
197
  renderApproval?: (context: {
156
198
  message: AgentWidgetMessage;
157
199
  defaultRenderer: () => HTMLElement;
158
200
  config: AgentWidgetConfig;
201
+ /** Resolve this approval as approved. Pass `{ remember: true }` for an "Always allow" affordance. */
202
+ approve: (options?: AgentWidgetApprovalDecisionOptions) => void;
203
+ /** Resolve this approval as denied. Pass `{ remember: true }` for an "Always deny" affordance. */
204
+ deny: (options?: AgentWidgetApprovalDecisionOptions) => void;
159
205
  }) => HTMLElement | null;
160
206
  /**
161
207
  * Custom renderer for loading indicator
@@ -530,6 +576,8 @@ interface ApprovalTokens {
530
576
  background: TokenReference<'color'>;
531
577
  border: TokenReference<'color'>;
532
578
  text: TokenReference<'color'>;
579
+ /** Box-shadow for the approval bubble (token ref or raw CSS, e.g. `none`). */
580
+ shadow: string;
533
581
  };
534
582
  approve: ComponentTokenSet;
535
583
  deny: ComponentTokenSet;
@@ -873,6 +921,7 @@ type RuntypeAgentSSEEvent = {
873
921
  };
874
922
  iteration?: number;
875
923
  parameters?: Record<string, unknown>;
924
+ reason?: string;
876
925
  seq: number;
877
926
  startedAt: string;
878
927
  timeout: number;
@@ -1144,6 +1193,7 @@ type RuntypeFlowSSEEvent = {
1144
1193
  when: string;
1145
1194
  } | {
1146
1195
  executionId?: string;
1196
+ reason?: string;
1147
1197
  seq?: number;
1148
1198
  type: "step_await";
1149
1199
  [key: string]: unknown;
@@ -1422,6 +1472,7 @@ type RuntypeDispatchSSEEvent = {
1422
1472
  };
1423
1473
  iteration?: number;
1424
1474
  parameters?: Record<string, unknown>;
1475
+ reason?: string;
1425
1476
  seq: number;
1426
1477
  startedAt: string;
1427
1478
  timeout: number;
@@ -1692,6 +1743,7 @@ type RuntypeDispatchSSEEvent = {
1692
1743
  when: string;
1693
1744
  } | {
1694
1745
  executionId?: string;
1746
+ reason?: string;
1695
1747
  seq?: number;
1696
1748
  type: "step_await";
1697
1749
  [key: string]: unknown;
@@ -2166,6 +2218,12 @@ type WebMcpConfirmInfo = {
2166
2218
  toolName: string;
2167
2219
  args: unknown;
2168
2220
  description?: string;
2221
+ /**
2222
+ * Display title the tool declared via the WebMCP spec's
2223
+ * `ToolDescriptor.title` (e.g. `"Add to Cart"`). Absent when the tool
2224
+ * didn't declare one.
2225
+ */
2226
+ title?: string;
2169
2227
  annotations?: {
2170
2228
  readOnlyHint?: boolean;
2171
2229
  untrustedContentHint?: boolean;
@@ -2641,6 +2699,29 @@ type AgentWidgetArtifactsFeature = {
2641
2699
  defaultRenderer: () => HTMLElement;
2642
2700
  }) => HTMLElement | null;
2643
2701
  };
2702
+ /**
2703
+ * How the transcript scrolls while an assistant response streams in.
2704
+ *
2705
+ * - `"follow"` (default): keep the newest content pinned to the bottom of the
2706
+ * viewport, pausing when the user scrolls up and resuming when they return
2707
+ * to the bottom.
2708
+ * - `"anchor-top"`: on send, scroll the user's message near the top of the
2709
+ * viewport and hold it there while the response streams in beneath it
2710
+ * (ChatGPT-style). The transcript never auto-scrolls during streaming.
2711
+ * - `"none"`: never auto-scroll; the scroll-to-bottom affordance is the only
2712
+ * way back to the latest content.
2713
+ */
2714
+ type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
2715
+ type AgentWidgetScrollBehaviorFeature = {
2716
+ /** Scroll behavior during streamed responses. @default "follow" */
2717
+ mode?: AgentWidgetScrollMode;
2718
+ /**
2719
+ * Gap (px) kept between the anchored user message and the top of the
2720
+ * viewport in `"anchor-top"` mode.
2721
+ * @default 16
2722
+ */
2723
+ anchorTopOffset?: number;
2724
+ };
2644
2725
  type AgentWidgetScrollToBottomFeature = {
2645
2726
  /**
2646
2727
  * When true, Persona shows a scroll-to-bottom affordance when the user breaks
@@ -2904,6 +2985,8 @@ type AgentWidgetFeatureFlags = {
2904
2985
  composerHistory?: boolean;
2905
2986
  /** Shared transcript + event stream scroll-to-bottom affordance. */
2906
2987
  scrollToBottom?: AgentWidgetScrollToBottomFeature;
2988
+ /** Transcript scroll behavior during streamed responses. */
2989
+ scrollBehavior?: AgentWidgetScrollBehaviorFeature;
2907
2990
  /** Collapsed transcript behavior for tool call rows. */
2908
2991
  toolCallDisplay?: AgentWidgetToolCallDisplayFeature;
2909
2992
  /** Collapsed transcript behavior for reasoning rows. */
@@ -3625,6 +3708,22 @@ interface VoiceProvider {
3625
3708
  /** Stop playback / cancel in-flight request without starting recording */
3626
3709
  stopPlayback?(): void;
3627
3710
  }
3711
+ /**
3712
+ * Extra context for an approval decision, surfaced to `onDecision` and to the
3713
+ * `approve`/`deny` callbacks passed to the `renderApproval` plugin hook.
3714
+ */
3715
+ type AgentWidgetApprovalDecisionOptions = {
3716
+ /**
3717
+ * The user chose a "remember this" affordance (e.g. an "Always allow"
3718
+ * button) rather than a one-time decision. The widget resolves the *current*
3719
+ * approval identically whether or not this is set — an approval bubble is a
3720
+ * single binary gate (`approved`/`denied`). Persisting a don't-ask-again
3721
+ * policy for *future* approvals (auto-resolving them, or not surfacing them)
3722
+ * is the integrator's responsibility, typically inside `onDecision`.
3723
+ * Defaults to absent/`false`.
3724
+ */
3725
+ remember?: boolean;
3726
+ };
3628
3727
  /**
3629
3728
  * Configuration for tool approval bubbles.
3630
3729
  * Controls styling, labels, and behavior of the approval UI.
@@ -3634,6 +3733,8 @@ type AgentWidgetApprovalConfig = {
3634
3733
  backgroundColor?: string;
3635
3734
  /** Border color of the approval bubble */
3636
3735
  borderColor?: string;
3736
+ /** Box-shadow for the approval bubble; pass `"none"` to remove it. Overrides the default `persona-shadow-sm`. */
3737
+ shadow?: string;
3637
3738
  /** Color for the title text */
3638
3739
  titleColor?: string;
3639
3740
  /** Color for the description text */
@@ -3656,20 +3757,67 @@ type AgentWidgetApprovalConfig = {
3656
3757
  approveLabel?: string;
3657
3758
  /** Label for the deny button */
3658
3759
  denyLabel?: string;
3760
+ /**
3761
+ * Color for the agent-authored reason line (the agent's per-call
3762
+ * justification, shown attributed below the summary when present).
3763
+ */
3764
+ reasonColor?: string;
3765
+ /**
3766
+ * Label prefix for the agent-authored reason line.
3767
+ * Defaults to "Agent's stated reason:".
3768
+ */
3769
+ reasonLabel?: string;
3770
+ /**
3771
+ * How the technical details (the tool's agent-facing description and the
3772
+ * raw parameters JSON) are presented:
3773
+ * - `"collapsed"` (default) — hidden behind a "Show details" toggle
3774
+ * - `"expanded"` — visible, with the toggle available to hide them
3775
+ * - `"hidden"` — never rendered
3776
+ */
3777
+ detailsDisplay?: "collapsed" | "expanded" | "hidden";
3778
+ /** Label for the toggle that reveals the technical details */
3779
+ showDetailsLabel?: string;
3780
+ /** Label for the toggle that hides the technical details */
3781
+ hideDetailsLabel?: string;
3782
+ /**
3783
+ * Build the user-facing summary line for an approval request. Overrides the
3784
+ * default "The assistant wants to use “Tool name”." copy. Return a falsy
3785
+ * value to fall back to the default for that approval. `displayTitle` is
3786
+ * the display name the tool declared via the WebMCP spec's
3787
+ * `ToolDescriptor.title`, when one exists.
3788
+ */
3789
+ formatDescription?: (approval: {
3790
+ toolName: string;
3791
+ toolType?: string;
3792
+ description: string;
3793
+ parameters?: unknown;
3794
+ displayTitle?: string;
3795
+ /**
3796
+ * Agent-authored justification for this specific call, when the agent
3797
+ * provided one. It is the agent's own claim — if you fold it into the
3798
+ * summary, keep it attributed to the agent.
3799
+ */
3800
+ reason?: string;
3801
+ }) => string | undefined;
3659
3802
  /**
3660
3803
  * Custom handler for approval decisions.
3661
3804
  * Return void to let the SDK auto-resolve via the API,
3662
3805
  * or return a Response/ReadableStream for custom handling.
3806
+ *
3807
+ * `options.remember` is `true` when the decision came from a "remember this"
3808
+ * affordance (e.g. an "Always allow" button in a custom `renderApproval`
3809
+ * plugin). Use it to persist a don't-ask-again policy for future approvals;
3810
+ * the current approval resolves the same way regardless.
3663
3811
  */
3664
3812
  onDecision?: (data: {
3665
3813
  approvalId: string;
3666
3814
  executionId: string;
3667
3815
  agentId: string;
3668
3816
  toolName: string;
3669
- }, decision: 'approved' | 'denied') => Promise<Response | ReadableStream<Uint8Array> | void>;
3817
+ }, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<Response | ReadableStream<Uint8Array> | void>;
3670
3818
  };
3671
3819
  type AgentWidgetToolCallConfig = {
3672
- /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
3820
+ /** Box-shadow for tool-call bubbles; pass `"none"` to remove it. Overrides the `components.toolBubble.shadow` token / `--persona-tool-bubble-shadow`. */
3673
3821
  shadow?: string;
3674
3822
  /** Background color of the tool call bubble container. */
3675
3823
  backgroundColor?: string;
@@ -5524,6 +5672,13 @@ type AgentWidgetApproval = {
5524
5672
  toolName: string;
5525
5673
  toolType?: string;
5526
5674
  description: string;
5675
+ /**
5676
+ * Agent-authored justification for this specific call (the agent's own
5677
+ * claim about its intent, extracted server-side from the reserved
5678
+ * `_approvalReason` parameter). Render it attributed to the agent and as
5679
+ * plain text — it is approver context, not a system statement.
5680
+ */
5681
+ reason?: string;
5527
5682
  parameters?: unknown;
5528
5683
  resolvedAt?: number;
5529
5684
  };
@@ -6371,7 +6526,7 @@ declare class AgentWidgetSession {
6371
6526
  * Updates the approval message status, calls the API (or custom onDecision),
6372
6527
  * and pipes the response stream through connectStream().
6373
6528
  */
6374
- resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied'): Promise<void>;
6529
+ resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions): Promise<void>;
6375
6530
  /**
6376
6531
  * Resolve a paused `ask_user_question` LOCAL tool call.
6377
6532
  *
@@ -6690,8 +6845,10 @@ type Controller = {
6690
6845
  * Programmatically resolve a pending approval.
6691
6846
  * @param approvalId - The approval ID to resolve
6692
6847
  * @param decision - "approved" or "denied"
6848
+ * @param options - Optional decision context (e.g. `{ remember: true }`),
6849
+ * forwarded to `config.approval.onDecision`.
6693
6850
  */
6694
- resolveApproval: (approvalId: string, decision: 'approved' | 'denied') => Promise<void>;
6851
+ resolveApproval: (approvalId: string, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<void>;
6695
6852
  };
6696
6853
  declare const createAgentExperience: (mount: HTMLElement, initialConfig?: AgentWidgetConfig, runtimeOptions?: {
6697
6854
  debugTools?: boolean;
@@ -8514,4 +8671,4 @@ interface DemoCarouselHandle {
8514
8671
  }
8515
8672
  declare function createDemoCarousel(container: HTMLElement, options: DemoCarouselOptions): DemoCarouselHandle;
8516
8673
 
8517
- export { ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, 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 AgentWidgetParsedAction, 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 AgentWidgetWebMcpConfig, 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 ClientToolDefinition, 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 RuntypeAgentSSEEvent, type RuntypeAgentTurnCompleteEvent, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeDispatchSSEEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, 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, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, 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, isWebMcpToolName, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
8674
+ export { ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetApprovalDecisionOptions, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, 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 AgentWidgetParsedAction, 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 AgentWidgetWebMcpConfig, 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 ClientToolDefinition, 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 RuntypeAgentSSEEvent, type RuntypeAgentTurnCompleteEvent, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeDispatchSSEEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, 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, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, 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, isWebMcpToolName, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
package/dist/index.d.ts CHANGED
@@ -149,13 +149,59 @@ interface AgentWidgetPlugin {
149
149
  config: AgentWidgetConfig;
150
150
  }) => HTMLElement | null;
151
151
  /**
152
- * Custom renderer for approval bubbles
153
- * Return null to use default renderer
152
+ * Custom renderer for approval bubbles.
153
+ *
154
+ * Return an `HTMLElement` to fully own the approval UI, `defaultRenderer()`
155
+ * to render (or wrap) the built-in bubble, or `null` to fall through to the
156
+ * default. Unlike the built-in bubble — whose Approve/Deny buttons are wired
157
+ * via delegation — a fully custom element resolves the approval by calling
158
+ * the `approve`/`deny` callbacks. Both route through the same path the
159
+ * built-in buttons use (optimistic update, `onDecision`, in-place anchoring).
160
+ *
161
+ * An approval is a single binary gate, so there are exactly two outcomes.
162
+ * Pass `{ remember: true }` to flag a "remember this" affordance (e.g. an
163
+ * "Always allow" button); the current approval resolves identically, but the
164
+ * flag is forwarded to `config.approval.onDecision` so you can persist a
165
+ * don't-ask-again policy for future approvals.
166
+ *
167
+ * `renderApproval` is called again whenever the approval's status changes, so
168
+ * branch on `message.approval?.status` to render the resolved state (and tear
169
+ * down any global listeners you added while pending).
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * // An alternative prompt: "Always allow" / "Allow once" / "Deny".
174
+ * renderApproval: ({ message, approve, deny }) => {
175
+ * const approval = message.approval;
176
+ * if (!approval || approval.status !== "pending") return null; // default renders resolved state
177
+ * const root = document.createElement("div");
178
+ * root.textContent = `${approval.toolName} requires approval`;
179
+ *
180
+ * const always = document.createElement("button");
181
+ * always.textContent = "Always allow";
182
+ * always.addEventListener("click", () => approve({ remember: true }));
183
+ *
184
+ * const once = document.createElement("button");
185
+ * once.textContent = "Allow once";
186
+ * once.addEventListener("click", () => approve());
187
+ *
188
+ * const no = document.createElement("button");
189
+ * no.textContent = "Deny";
190
+ * no.addEventListener("click", () => deny());
191
+ *
192
+ * root.append(always, once, no);
193
+ * return root;
194
+ * }
195
+ * ```
154
196
  */
155
197
  renderApproval?: (context: {
156
198
  message: AgentWidgetMessage;
157
199
  defaultRenderer: () => HTMLElement;
158
200
  config: AgentWidgetConfig;
201
+ /** Resolve this approval as approved. Pass `{ remember: true }` for an "Always allow" affordance. */
202
+ approve: (options?: AgentWidgetApprovalDecisionOptions) => void;
203
+ /** Resolve this approval as denied. Pass `{ remember: true }` for an "Always deny" affordance. */
204
+ deny: (options?: AgentWidgetApprovalDecisionOptions) => void;
159
205
  }) => HTMLElement | null;
160
206
  /**
161
207
  * Custom renderer for loading indicator
@@ -530,6 +576,8 @@ interface ApprovalTokens {
530
576
  background: TokenReference<'color'>;
531
577
  border: TokenReference<'color'>;
532
578
  text: TokenReference<'color'>;
579
+ /** Box-shadow for the approval bubble (token ref or raw CSS, e.g. `none`). */
580
+ shadow: string;
533
581
  };
534
582
  approve: ComponentTokenSet;
535
583
  deny: ComponentTokenSet;
@@ -873,6 +921,7 @@ type RuntypeAgentSSEEvent = {
873
921
  };
874
922
  iteration?: number;
875
923
  parameters?: Record<string, unknown>;
924
+ reason?: string;
876
925
  seq: number;
877
926
  startedAt: string;
878
927
  timeout: number;
@@ -1144,6 +1193,7 @@ type RuntypeFlowSSEEvent = {
1144
1193
  when: string;
1145
1194
  } | {
1146
1195
  executionId?: string;
1196
+ reason?: string;
1147
1197
  seq?: number;
1148
1198
  type: "step_await";
1149
1199
  [key: string]: unknown;
@@ -1422,6 +1472,7 @@ type RuntypeDispatchSSEEvent = {
1422
1472
  };
1423
1473
  iteration?: number;
1424
1474
  parameters?: Record<string, unknown>;
1475
+ reason?: string;
1425
1476
  seq: number;
1426
1477
  startedAt: string;
1427
1478
  timeout: number;
@@ -1692,6 +1743,7 @@ type RuntypeDispatchSSEEvent = {
1692
1743
  when: string;
1693
1744
  } | {
1694
1745
  executionId?: string;
1746
+ reason?: string;
1695
1747
  seq?: number;
1696
1748
  type: "step_await";
1697
1749
  [key: string]: unknown;
@@ -2166,6 +2218,12 @@ type WebMcpConfirmInfo = {
2166
2218
  toolName: string;
2167
2219
  args: unknown;
2168
2220
  description?: string;
2221
+ /**
2222
+ * Display title the tool declared via the WebMCP spec's
2223
+ * `ToolDescriptor.title` (e.g. `"Add to Cart"`). Absent when the tool
2224
+ * didn't declare one.
2225
+ */
2226
+ title?: string;
2169
2227
  annotations?: {
2170
2228
  readOnlyHint?: boolean;
2171
2229
  untrustedContentHint?: boolean;
@@ -2641,6 +2699,29 @@ type AgentWidgetArtifactsFeature = {
2641
2699
  defaultRenderer: () => HTMLElement;
2642
2700
  }) => HTMLElement | null;
2643
2701
  };
2702
+ /**
2703
+ * How the transcript scrolls while an assistant response streams in.
2704
+ *
2705
+ * - `"follow"` (default): keep the newest content pinned to the bottom of the
2706
+ * viewport, pausing when the user scrolls up and resuming when they return
2707
+ * to the bottom.
2708
+ * - `"anchor-top"`: on send, scroll the user's message near the top of the
2709
+ * viewport and hold it there while the response streams in beneath it
2710
+ * (ChatGPT-style). The transcript never auto-scrolls during streaming.
2711
+ * - `"none"`: never auto-scroll; the scroll-to-bottom affordance is the only
2712
+ * way back to the latest content.
2713
+ */
2714
+ type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
2715
+ type AgentWidgetScrollBehaviorFeature = {
2716
+ /** Scroll behavior during streamed responses. @default "follow" */
2717
+ mode?: AgentWidgetScrollMode;
2718
+ /**
2719
+ * Gap (px) kept between the anchored user message and the top of the
2720
+ * viewport in `"anchor-top"` mode.
2721
+ * @default 16
2722
+ */
2723
+ anchorTopOffset?: number;
2724
+ };
2644
2725
  type AgentWidgetScrollToBottomFeature = {
2645
2726
  /**
2646
2727
  * When true, Persona shows a scroll-to-bottom affordance when the user breaks
@@ -2904,6 +2985,8 @@ type AgentWidgetFeatureFlags = {
2904
2985
  composerHistory?: boolean;
2905
2986
  /** Shared transcript + event stream scroll-to-bottom affordance. */
2906
2987
  scrollToBottom?: AgentWidgetScrollToBottomFeature;
2988
+ /** Transcript scroll behavior during streamed responses. */
2989
+ scrollBehavior?: AgentWidgetScrollBehaviorFeature;
2907
2990
  /** Collapsed transcript behavior for tool call rows. */
2908
2991
  toolCallDisplay?: AgentWidgetToolCallDisplayFeature;
2909
2992
  /** Collapsed transcript behavior for reasoning rows. */
@@ -3625,6 +3708,22 @@ interface VoiceProvider {
3625
3708
  /** Stop playback / cancel in-flight request without starting recording */
3626
3709
  stopPlayback?(): void;
3627
3710
  }
3711
+ /**
3712
+ * Extra context for an approval decision, surfaced to `onDecision` and to the
3713
+ * `approve`/`deny` callbacks passed to the `renderApproval` plugin hook.
3714
+ */
3715
+ type AgentWidgetApprovalDecisionOptions = {
3716
+ /**
3717
+ * The user chose a "remember this" affordance (e.g. an "Always allow"
3718
+ * button) rather than a one-time decision. The widget resolves the *current*
3719
+ * approval identically whether or not this is set — an approval bubble is a
3720
+ * single binary gate (`approved`/`denied`). Persisting a don't-ask-again
3721
+ * policy for *future* approvals (auto-resolving them, or not surfacing them)
3722
+ * is the integrator's responsibility, typically inside `onDecision`.
3723
+ * Defaults to absent/`false`.
3724
+ */
3725
+ remember?: boolean;
3726
+ };
3628
3727
  /**
3629
3728
  * Configuration for tool approval bubbles.
3630
3729
  * Controls styling, labels, and behavior of the approval UI.
@@ -3634,6 +3733,8 @@ type AgentWidgetApprovalConfig = {
3634
3733
  backgroundColor?: string;
3635
3734
  /** Border color of the approval bubble */
3636
3735
  borderColor?: string;
3736
+ /** Box-shadow for the approval bubble; pass `"none"` to remove it. Overrides the default `persona-shadow-sm`. */
3737
+ shadow?: string;
3637
3738
  /** Color for the title text */
3638
3739
  titleColor?: string;
3639
3740
  /** Color for the description text */
@@ -3656,20 +3757,67 @@ type AgentWidgetApprovalConfig = {
3656
3757
  approveLabel?: string;
3657
3758
  /** Label for the deny button */
3658
3759
  denyLabel?: string;
3760
+ /**
3761
+ * Color for the agent-authored reason line (the agent's per-call
3762
+ * justification, shown attributed below the summary when present).
3763
+ */
3764
+ reasonColor?: string;
3765
+ /**
3766
+ * Label prefix for the agent-authored reason line.
3767
+ * Defaults to "Agent's stated reason:".
3768
+ */
3769
+ reasonLabel?: string;
3770
+ /**
3771
+ * How the technical details (the tool's agent-facing description and the
3772
+ * raw parameters JSON) are presented:
3773
+ * - `"collapsed"` (default) — hidden behind a "Show details" toggle
3774
+ * - `"expanded"` — visible, with the toggle available to hide them
3775
+ * - `"hidden"` — never rendered
3776
+ */
3777
+ detailsDisplay?: "collapsed" | "expanded" | "hidden";
3778
+ /** Label for the toggle that reveals the technical details */
3779
+ showDetailsLabel?: string;
3780
+ /** Label for the toggle that hides the technical details */
3781
+ hideDetailsLabel?: string;
3782
+ /**
3783
+ * Build the user-facing summary line for an approval request. Overrides the
3784
+ * default "The assistant wants to use “Tool name”." copy. Return a falsy
3785
+ * value to fall back to the default for that approval. `displayTitle` is
3786
+ * the display name the tool declared via the WebMCP spec's
3787
+ * `ToolDescriptor.title`, when one exists.
3788
+ */
3789
+ formatDescription?: (approval: {
3790
+ toolName: string;
3791
+ toolType?: string;
3792
+ description: string;
3793
+ parameters?: unknown;
3794
+ displayTitle?: string;
3795
+ /**
3796
+ * Agent-authored justification for this specific call, when the agent
3797
+ * provided one. It is the agent's own claim — if you fold it into the
3798
+ * summary, keep it attributed to the agent.
3799
+ */
3800
+ reason?: string;
3801
+ }) => string | undefined;
3659
3802
  /**
3660
3803
  * Custom handler for approval decisions.
3661
3804
  * Return void to let the SDK auto-resolve via the API,
3662
3805
  * or return a Response/ReadableStream for custom handling.
3806
+ *
3807
+ * `options.remember` is `true` when the decision came from a "remember this"
3808
+ * affordance (e.g. an "Always allow" button in a custom `renderApproval`
3809
+ * plugin). Use it to persist a don't-ask-again policy for future approvals;
3810
+ * the current approval resolves the same way regardless.
3663
3811
  */
3664
3812
  onDecision?: (data: {
3665
3813
  approvalId: string;
3666
3814
  executionId: string;
3667
3815
  agentId: string;
3668
3816
  toolName: string;
3669
- }, decision: 'approved' | 'denied') => Promise<Response | ReadableStream<Uint8Array> | void>;
3817
+ }, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<Response | ReadableStream<Uint8Array> | void>;
3670
3818
  };
3671
3819
  type AgentWidgetToolCallConfig = {
3672
- /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
3820
+ /** Box-shadow for tool-call bubbles; pass `"none"` to remove it. Overrides the `components.toolBubble.shadow` token / `--persona-tool-bubble-shadow`. */
3673
3821
  shadow?: string;
3674
3822
  /** Background color of the tool call bubble container. */
3675
3823
  backgroundColor?: string;
@@ -5524,6 +5672,13 @@ type AgentWidgetApproval = {
5524
5672
  toolName: string;
5525
5673
  toolType?: string;
5526
5674
  description: string;
5675
+ /**
5676
+ * Agent-authored justification for this specific call (the agent's own
5677
+ * claim about its intent, extracted server-side from the reserved
5678
+ * `_approvalReason` parameter). Render it attributed to the agent and as
5679
+ * plain text — it is approver context, not a system statement.
5680
+ */
5681
+ reason?: string;
5527
5682
  parameters?: unknown;
5528
5683
  resolvedAt?: number;
5529
5684
  };
@@ -6371,7 +6526,7 @@ declare class AgentWidgetSession {
6371
6526
  * Updates the approval message status, calls the API (or custom onDecision),
6372
6527
  * and pipes the response stream through connectStream().
6373
6528
  */
6374
- resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied'): Promise<void>;
6529
+ resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions): Promise<void>;
6375
6530
  /**
6376
6531
  * Resolve a paused `ask_user_question` LOCAL tool call.
6377
6532
  *
@@ -6690,8 +6845,10 @@ type Controller = {
6690
6845
  * Programmatically resolve a pending approval.
6691
6846
  * @param approvalId - The approval ID to resolve
6692
6847
  * @param decision - "approved" or "denied"
6848
+ * @param options - Optional decision context (e.g. `{ remember: true }`),
6849
+ * forwarded to `config.approval.onDecision`.
6693
6850
  */
6694
- resolveApproval: (approvalId: string, decision: 'approved' | 'denied') => Promise<void>;
6851
+ resolveApproval: (approvalId: string, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<void>;
6695
6852
  };
6696
6853
  declare const createAgentExperience: (mount: HTMLElement, initialConfig?: AgentWidgetConfig, runtimeOptions?: {
6697
6854
  debugTools?: boolean;
@@ -8514,4 +8671,4 @@ interface DemoCarouselHandle {
8514
8671
  }
8515
8672
  declare function createDemoCarousel(container: HTMLElement, options: DemoCarouselOptions): DemoCarouselHandle;
8516
8673
 
8517
- export { ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, 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 AgentWidgetParsedAction, 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 AgentWidgetWebMcpConfig, 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 ClientToolDefinition, 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 RuntypeAgentSSEEvent, type RuntypeAgentTurnCompleteEvent, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeDispatchSSEEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, 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, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, 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, isWebMcpToolName, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
8674
+ export { ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetApprovalDecisionOptions, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, 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 AgentWidgetParsedAction, 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 AgentWidgetWebMcpConfig, 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 ClientToolDefinition, 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 RuntypeAgentSSEEvent, type RuntypeAgentTurnCompleteEvent, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeDispatchSSEEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, 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, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, 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, isWebMcpToolName, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };