@runtypelabs/persona 3.29.0 → 3.30.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 (63) hide show
  1. package/README.md +55 -0
  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-CxvHw0X6.d.cts → types-B_Qazlm4.d.cts} +6 -0
  5. package/dist/animations/{types-CxvHw0X6.d.ts → types-B_Qazlm4.d.ts} +6 -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 +47 -47
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +127 -7
  13. package/dist/index.d.ts +127 -7
  14. package/dist/index.global.js +60 -60
  15. package/dist/index.global.js.map +1 -1
  16. package/dist/index.js +47 -47
  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 +113 -4
  25. package/dist/smart-dom-reader.d.ts +113 -4
  26. package/dist/theme-editor.cjs +38 -38
  27. package/dist/theme-editor.d.cts +117 -6
  28. package/dist/theme-editor.d.ts +117 -6
  29. package/dist/theme-editor.js +38 -38
  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/package.json +8 -2
  35. package/src/client.test.ts +40 -0
  36. package/src/client.ts +18 -4
  37. package/src/components/approval-bubble.test.ts +268 -0
  38. package/src/components/approval-bubble.ts +170 -20
  39. package/src/components/launcher.ts +6 -3
  40. package/src/components/tool-bubble.test.ts +39 -0
  41. package/src/components/tool-bubble.ts +4 -0
  42. package/src/generated/runtype-openapi-contract.ts +12 -0
  43. package/src/index-core.ts +1 -0
  44. package/src/plugin-kit.test.ts +230 -0
  45. package/src/plugin-kit.ts +294 -0
  46. package/src/plugins/types.ts +49 -2
  47. package/src/session.test.ts +99 -0
  48. package/src/session.ts +204 -32
  49. package/src/session.webmcp.test.ts +326 -6
  50. package/src/theme-editor/preview-utils.test.ts +10 -0
  51. package/src/theme-editor/preview-utils.ts +29 -1
  52. package/src/theme-editor/sections.test.ts +17 -0
  53. package/src/theme-editor/sections.ts +31 -0
  54. package/src/theme-reference.ts +1 -1
  55. package/src/types/theme.ts +2 -0
  56. package/src/types.ts +59 -2
  57. package/src/ui.approval-plugin.test.ts +204 -0
  58. package/src/ui.ts +149 -16
  59. package/src/utils/theme.test.ts +6 -2
  60. package/src/utils/theme.ts +0 -8
  61. package/src/utils/tokens.ts +6 -1
  62. package/src/webmcp-bridge.test.ts +66 -0
  63. 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;
@@ -929,6 +977,7 @@ type RuntypeAgentSSEEvent = {
929
977
  iteration: number;
930
978
  reflection?: string;
931
979
  seq: number;
980
+ timestamp?: string;
932
981
  type: "agent_reflection";
933
982
  } | {
934
983
  activatedCapabilities: Array<string>;
@@ -936,6 +985,7 @@ type RuntypeAgentSSEEvent = {
936
985
  iteration: number;
937
986
  seq: number;
938
987
  skill: string;
988
+ timestamp?: string;
939
989
  toolCallId: string;
940
990
  type: "agent_skill_loaded";
941
991
  } | ({
@@ -945,6 +995,7 @@ type RuntypeAgentSSEEvent = {
945
995
  proposalId?: string;
946
996
  seq: number;
947
997
  skill: string;
998
+ timestamp?: string;
948
999
  toolCallId: string;
949
1000
  type: "agent_skill_proposed";
950
1001
  }) | ({
@@ -978,6 +1029,7 @@ type RuntypeAgentSSEEvent = {
978
1029
  iteration?: number;
979
1030
  recoverable: boolean;
980
1031
  seq: number;
1032
+ timestamp?: string;
981
1033
  type: "agent_error";
982
1034
  } | {
983
1035
  executionId: string;
@@ -1011,6 +1063,7 @@ type RuntypeFlowSSEEvent = {
1011
1063
  failedSteps?: number;
1012
1064
  finalOutput?: string;
1013
1065
  flowId?: string;
1066
+ flowName?: string;
1014
1067
  output?: unknown;
1015
1068
  seq?: number;
1016
1069
  source?: string;
@@ -1062,6 +1115,7 @@ type RuntypeFlowSSEEvent = {
1062
1115
  id?: string;
1063
1116
  index?: number;
1064
1117
  name?: string;
1118
+ outputVariable?: string;
1065
1119
  seq?: number;
1066
1120
  startedAt: string;
1067
1121
  stepId?: string;
@@ -1472,6 +1526,7 @@ type RuntypeDispatchSSEEvent = {
1472
1526
  iteration: number;
1473
1527
  reflection?: string;
1474
1528
  seq: number;
1529
+ timestamp?: string;
1475
1530
  type: "agent_reflection";
1476
1531
  } | {
1477
1532
  activatedCapabilities: Array<string>;
@@ -1479,6 +1534,7 @@ type RuntypeDispatchSSEEvent = {
1479
1534
  iteration: number;
1480
1535
  seq: number;
1481
1536
  skill: string;
1537
+ timestamp?: string;
1482
1538
  toolCallId: string;
1483
1539
  type: "agent_skill_loaded";
1484
1540
  } | ({
@@ -1488,6 +1544,7 @@ type RuntypeDispatchSSEEvent = {
1488
1544
  proposalId?: string;
1489
1545
  seq: number;
1490
1546
  skill: string;
1547
+ timestamp?: string;
1491
1548
  toolCallId: string;
1492
1549
  type: "agent_skill_proposed";
1493
1550
  }) | ({
@@ -1521,6 +1578,7 @@ type RuntypeDispatchSSEEvent = {
1521
1578
  iteration?: number;
1522
1579
  recoverable: boolean;
1523
1580
  seq: number;
1581
+ timestamp?: string;
1524
1582
  type: "agent_error";
1525
1583
  } | {
1526
1584
  executionId: string;
@@ -1553,6 +1611,7 @@ type RuntypeDispatchSSEEvent = {
1553
1611
  failedSteps?: number;
1554
1612
  finalOutput?: string;
1555
1613
  flowId?: string;
1614
+ flowName?: string;
1556
1615
  output?: unknown;
1557
1616
  seq?: number;
1558
1617
  source?: string;
@@ -1604,6 +1663,7 @@ type RuntypeDispatchSSEEvent = {
1604
1663
  id?: string;
1605
1664
  index?: number;
1606
1665
  name?: string;
1666
+ outputVariable?: string;
1607
1667
  seq?: number;
1608
1668
  startedAt: string;
1609
1669
  stepId?: string;
@@ -2154,6 +2214,12 @@ type WebMcpConfirmInfo = {
2154
2214
  toolName: string;
2155
2215
  args: unknown;
2156
2216
  description?: string;
2217
+ /**
2218
+ * Display title the tool declared via the WebMCP spec's
2219
+ * `ToolDescriptor.title` (e.g. `"Add to Cart"`). Absent when the tool
2220
+ * didn't declare one.
2221
+ */
2222
+ title?: string;
2157
2223
  annotations?: {
2158
2224
  readOnlyHint?: boolean;
2159
2225
  untrustedContentHint?: boolean;
@@ -3613,6 +3679,22 @@ interface VoiceProvider {
3613
3679
  /** Stop playback / cancel in-flight request without starting recording */
3614
3680
  stopPlayback?(): void;
3615
3681
  }
3682
+ /**
3683
+ * Extra context for an approval decision, surfaced to `onDecision` and to the
3684
+ * `approve`/`deny` callbacks passed to the `renderApproval` plugin hook.
3685
+ */
3686
+ type AgentWidgetApprovalDecisionOptions = {
3687
+ /**
3688
+ * The user chose a "remember this" affordance (e.g. an "Always allow"
3689
+ * button) rather than a one-time decision. The widget resolves the *current*
3690
+ * approval identically whether or not this is set — an approval bubble is a
3691
+ * single binary gate (`approved`/`denied`). Persisting a don't-ask-again
3692
+ * policy for *future* approvals (auto-resolving them, or not surfacing them)
3693
+ * is the integrator's responsibility, typically inside `onDecision`.
3694
+ * Defaults to absent/`false`.
3695
+ */
3696
+ remember?: boolean;
3697
+ };
3616
3698
  /**
3617
3699
  * Configuration for tool approval bubbles.
3618
3700
  * Controls styling, labels, and behavior of the approval UI.
@@ -3622,6 +3704,8 @@ type AgentWidgetApprovalConfig = {
3622
3704
  backgroundColor?: string;
3623
3705
  /** Border color of the approval bubble */
3624
3706
  borderColor?: string;
3707
+ /** Box-shadow for the approval bubble; pass `"none"` to remove it. Overrides the default `persona-shadow-sm`. */
3708
+ shadow?: string;
3625
3709
  /** Color for the title text */
3626
3710
  titleColor?: string;
3627
3711
  /** Color for the description text */
@@ -3644,20 +3728,51 @@ type AgentWidgetApprovalConfig = {
3644
3728
  approveLabel?: string;
3645
3729
  /** Label for the deny button */
3646
3730
  denyLabel?: string;
3731
+ /**
3732
+ * How the technical details (the tool's agent-facing description and the
3733
+ * raw parameters JSON) are presented:
3734
+ * - `"collapsed"` (default) — hidden behind a "Show details" toggle
3735
+ * - `"expanded"` — visible, with the toggle available to hide them
3736
+ * - `"hidden"` — never rendered
3737
+ */
3738
+ detailsDisplay?: "collapsed" | "expanded" | "hidden";
3739
+ /** Label for the toggle that reveals the technical details */
3740
+ showDetailsLabel?: string;
3741
+ /** Label for the toggle that hides the technical details */
3742
+ hideDetailsLabel?: string;
3743
+ /**
3744
+ * Build the user-facing summary line for an approval request. Overrides the
3745
+ * default "The assistant wants to use “Tool name”." copy. Return a falsy
3746
+ * value to fall back to the default for that approval. `displayTitle` is
3747
+ * the display name the tool declared via the WebMCP spec's
3748
+ * `ToolDescriptor.title`, when one exists.
3749
+ */
3750
+ formatDescription?: (approval: {
3751
+ toolName: string;
3752
+ toolType?: string;
3753
+ description: string;
3754
+ parameters?: unknown;
3755
+ displayTitle?: string;
3756
+ }) => string | undefined;
3647
3757
  /**
3648
3758
  * Custom handler for approval decisions.
3649
3759
  * Return void to let the SDK auto-resolve via the API,
3650
3760
  * or return a Response/ReadableStream for custom handling.
3761
+ *
3762
+ * `options.remember` is `true` when the decision came from a "remember this"
3763
+ * affordance (e.g. an "Always allow" button in a custom `renderApproval`
3764
+ * plugin). Use it to persist a don't-ask-again policy for future approvals;
3765
+ * the current approval resolves the same way regardless.
3651
3766
  */
3652
3767
  onDecision?: (data: {
3653
3768
  approvalId: string;
3654
3769
  executionId: string;
3655
3770
  agentId: string;
3656
3771
  toolName: string;
3657
- }, decision: 'approved' | 'denied') => Promise<Response | ReadableStream<Uint8Array> | void>;
3772
+ }, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<Response | ReadableStream<Uint8Array> | void>;
3658
3773
  };
3659
3774
  type AgentWidgetToolCallConfig = {
3660
- /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
3775
+ /** Box-shadow for tool-call bubbles; pass `"none"` to remove it. Overrides the `components.toolBubble.shadow` token / `--persona-tool-bubble-shadow`. */
3661
3776
  shadow?: string;
3662
3777
  /** Background color of the tool call bubble container. */
3663
3778
  backgroundColor?: string;
@@ -6359,7 +6474,7 @@ declare class AgentWidgetSession {
6359
6474
  * Updates the approval message status, calls the API (or custom onDecision),
6360
6475
  * and pipes the response stream through connectStream().
6361
6476
  */
6362
- resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied'): Promise<void>;
6477
+ resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions): Promise<void>;
6363
6478
  /**
6364
6479
  * Resolve a paused `ask_user_question` LOCAL tool call.
6365
6480
  *
@@ -6428,6 +6543,9 @@ declare class AgentWidgetSession {
6428
6543
  * rather than mutating one already in flight.
6429
6544
  */
6430
6545
  private flushWebMcpAwaitBatch;
6546
+ private resolveWebMcpToolStartedAt;
6547
+ private markWebMcpToolRunning;
6548
+ private markWebMcpToolComplete;
6431
6549
  /**
6432
6550
  * Resolve TWO OR MORE parallel local-tool awaits sharing one paused
6433
6551
  * executionId with a SINGLE `/resume` (core#3878). Each call is executed
@@ -6675,8 +6793,10 @@ type Controller = {
6675
6793
  * Programmatically resolve a pending approval.
6676
6794
  * @param approvalId - The approval ID to resolve
6677
6795
  * @param decision - "approved" or "denied"
6796
+ * @param options - Optional decision context (e.g. `{ remember: true }`),
6797
+ * forwarded to `config.approval.onDecision`.
6678
6798
  */
6679
- resolveApproval: (approvalId: string, decision: 'approved' | 'denied') => Promise<void>;
6799
+ resolveApproval: (approvalId: string, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<void>;
6680
6800
  };
6681
6801
  declare const createAgentExperience: (mount: HTMLElement, initialConfig?: AgentWidgetConfig, runtimeOptions?: {
6682
6802
  debugTools?: boolean;
@@ -8499,4 +8619,4 @@ interface DemoCarouselHandle {
8499
8619
  }
8500
8620
  declare function createDemoCarousel(container: HTMLElement, options: DemoCarouselOptions): DemoCarouselHandle;
8501
8621
 
8502
- 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 };
8622
+ 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;
@@ -929,6 +977,7 @@ type RuntypeAgentSSEEvent = {
929
977
  iteration: number;
930
978
  reflection?: string;
931
979
  seq: number;
980
+ timestamp?: string;
932
981
  type: "agent_reflection";
933
982
  } | {
934
983
  activatedCapabilities: Array<string>;
@@ -936,6 +985,7 @@ type RuntypeAgentSSEEvent = {
936
985
  iteration: number;
937
986
  seq: number;
938
987
  skill: string;
988
+ timestamp?: string;
939
989
  toolCallId: string;
940
990
  type: "agent_skill_loaded";
941
991
  } | ({
@@ -945,6 +995,7 @@ type RuntypeAgentSSEEvent = {
945
995
  proposalId?: string;
946
996
  seq: number;
947
997
  skill: string;
998
+ timestamp?: string;
948
999
  toolCallId: string;
949
1000
  type: "agent_skill_proposed";
950
1001
  }) | ({
@@ -978,6 +1029,7 @@ type RuntypeAgentSSEEvent = {
978
1029
  iteration?: number;
979
1030
  recoverable: boolean;
980
1031
  seq: number;
1032
+ timestamp?: string;
981
1033
  type: "agent_error";
982
1034
  } | {
983
1035
  executionId: string;
@@ -1011,6 +1063,7 @@ type RuntypeFlowSSEEvent = {
1011
1063
  failedSteps?: number;
1012
1064
  finalOutput?: string;
1013
1065
  flowId?: string;
1066
+ flowName?: string;
1014
1067
  output?: unknown;
1015
1068
  seq?: number;
1016
1069
  source?: string;
@@ -1062,6 +1115,7 @@ type RuntypeFlowSSEEvent = {
1062
1115
  id?: string;
1063
1116
  index?: number;
1064
1117
  name?: string;
1118
+ outputVariable?: string;
1065
1119
  seq?: number;
1066
1120
  startedAt: string;
1067
1121
  stepId?: string;
@@ -1472,6 +1526,7 @@ type RuntypeDispatchSSEEvent = {
1472
1526
  iteration: number;
1473
1527
  reflection?: string;
1474
1528
  seq: number;
1529
+ timestamp?: string;
1475
1530
  type: "agent_reflection";
1476
1531
  } | {
1477
1532
  activatedCapabilities: Array<string>;
@@ -1479,6 +1534,7 @@ type RuntypeDispatchSSEEvent = {
1479
1534
  iteration: number;
1480
1535
  seq: number;
1481
1536
  skill: string;
1537
+ timestamp?: string;
1482
1538
  toolCallId: string;
1483
1539
  type: "agent_skill_loaded";
1484
1540
  } | ({
@@ -1488,6 +1544,7 @@ type RuntypeDispatchSSEEvent = {
1488
1544
  proposalId?: string;
1489
1545
  seq: number;
1490
1546
  skill: string;
1547
+ timestamp?: string;
1491
1548
  toolCallId: string;
1492
1549
  type: "agent_skill_proposed";
1493
1550
  }) | ({
@@ -1521,6 +1578,7 @@ type RuntypeDispatchSSEEvent = {
1521
1578
  iteration?: number;
1522
1579
  recoverable: boolean;
1523
1580
  seq: number;
1581
+ timestamp?: string;
1524
1582
  type: "agent_error";
1525
1583
  } | {
1526
1584
  executionId: string;
@@ -1553,6 +1611,7 @@ type RuntypeDispatchSSEEvent = {
1553
1611
  failedSteps?: number;
1554
1612
  finalOutput?: string;
1555
1613
  flowId?: string;
1614
+ flowName?: string;
1556
1615
  output?: unknown;
1557
1616
  seq?: number;
1558
1617
  source?: string;
@@ -1604,6 +1663,7 @@ type RuntypeDispatchSSEEvent = {
1604
1663
  id?: string;
1605
1664
  index?: number;
1606
1665
  name?: string;
1666
+ outputVariable?: string;
1607
1667
  seq?: number;
1608
1668
  startedAt: string;
1609
1669
  stepId?: string;
@@ -2154,6 +2214,12 @@ type WebMcpConfirmInfo = {
2154
2214
  toolName: string;
2155
2215
  args: unknown;
2156
2216
  description?: string;
2217
+ /**
2218
+ * Display title the tool declared via the WebMCP spec's
2219
+ * `ToolDescriptor.title` (e.g. `"Add to Cart"`). Absent when the tool
2220
+ * didn't declare one.
2221
+ */
2222
+ title?: string;
2157
2223
  annotations?: {
2158
2224
  readOnlyHint?: boolean;
2159
2225
  untrustedContentHint?: boolean;
@@ -3613,6 +3679,22 @@ interface VoiceProvider {
3613
3679
  /** Stop playback / cancel in-flight request without starting recording */
3614
3680
  stopPlayback?(): void;
3615
3681
  }
3682
+ /**
3683
+ * Extra context for an approval decision, surfaced to `onDecision` and to the
3684
+ * `approve`/`deny` callbacks passed to the `renderApproval` plugin hook.
3685
+ */
3686
+ type AgentWidgetApprovalDecisionOptions = {
3687
+ /**
3688
+ * The user chose a "remember this" affordance (e.g. an "Always allow"
3689
+ * button) rather than a one-time decision. The widget resolves the *current*
3690
+ * approval identically whether or not this is set — an approval bubble is a
3691
+ * single binary gate (`approved`/`denied`). Persisting a don't-ask-again
3692
+ * policy for *future* approvals (auto-resolving them, or not surfacing them)
3693
+ * is the integrator's responsibility, typically inside `onDecision`.
3694
+ * Defaults to absent/`false`.
3695
+ */
3696
+ remember?: boolean;
3697
+ };
3616
3698
  /**
3617
3699
  * Configuration for tool approval bubbles.
3618
3700
  * Controls styling, labels, and behavior of the approval UI.
@@ -3622,6 +3704,8 @@ type AgentWidgetApprovalConfig = {
3622
3704
  backgroundColor?: string;
3623
3705
  /** Border color of the approval bubble */
3624
3706
  borderColor?: string;
3707
+ /** Box-shadow for the approval bubble; pass `"none"` to remove it. Overrides the default `persona-shadow-sm`. */
3708
+ shadow?: string;
3625
3709
  /** Color for the title text */
3626
3710
  titleColor?: string;
3627
3711
  /** Color for the description text */
@@ -3644,20 +3728,51 @@ type AgentWidgetApprovalConfig = {
3644
3728
  approveLabel?: string;
3645
3729
  /** Label for the deny button */
3646
3730
  denyLabel?: string;
3731
+ /**
3732
+ * How the technical details (the tool's agent-facing description and the
3733
+ * raw parameters JSON) are presented:
3734
+ * - `"collapsed"` (default) — hidden behind a "Show details" toggle
3735
+ * - `"expanded"` — visible, with the toggle available to hide them
3736
+ * - `"hidden"` — never rendered
3737
+ */
3738
+ detailsDisplay?: "collapsed" | "expanded" | "hidden";
3739
+ /** Label for the toggle that reveals the technical details */
3740
+ showDetailsLabel?: string;
3741
+ /** Label for the toggle that hides the technical details */
3742
+ hideDetailsLabel?: string;
3743
+ /**
3744
+ * Build the user-facing summary line for an approval request. Overrides the
3745
+ * default "The assistant wants to use “Tool name”." copy. Return a falsy
3746
+ * value to fall back to the default for that approval. `displayTitle` is
3747
+ * the display name the tool declared via the WebMCP spec's
3748
+ * `ToolDescriptor.title`, when one exists.
3749
+ */
3750
+ formatDescription?: (approval: {
3751
+ toolName: string;
3752
+ toolType?: string;
3753
+ description: string;
3754
+ parameters?: unknown;
3755
+ displayTitle?: string;
3756
+ }) => string | undefined;
3647
3757
  /**
3648
3758
  * Custom handler for approval decisions.
3649
3759
  * Return void to let the SDK auto-resolve via the API,
3650
3760
  * or return a Response/ReadableStream for custom handling.
3761
+ *
3762
+ * `options.remember` is `true` when the decision came from a "remember this"
3763
+ * affordance (e.g. an "Always allow" button in a custom `renderApproval`
3764
+ * plugin). Use it to persist a don't-ask-again policy for future approvals;
3765
+ * the current approval resolves the same way regardless.
3651
3766
  */
3652
3767
  onDecision?: (data: {
3653
3768
  approvalId: string;
3654
3769
  executionId: string;
3655
3770
  agentId: string;
3656
3771
  toolName: string;
3657
- }, decision: 'approved' | 'denied') => Promise<Response | ReadableStream<Uint8Array> | void>;
3772
+ }, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<Response | ReadableStream<Uint8Array> | void>;
3658
3773
  };
3659
3774
  type AgentWidgetToolCallConfig = {
3660
- /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
3775
+ /** Box-shadow for tool-call bubbles; pass `"none"` to remove it. Overrides the `components.toolBubble.shadow` token / `--persona-tool-bubble-shadow`. */
3661
3776
  shadow?: string;
3662
3777
  /** Background color of the tool call bubble container. */
3663
3778
  backgroundColor?: string;
@@ -6359,7 +6474,7 @@ declare class AgentWidgetSession {
6359
6474
  * Updates the approval message status, calls the API (or custom onDecision),
6360
6475
  * and pipes the response stream through connectStream().
6361
6476
  */
6362
- resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied'): Promise<void>;
6477
+ resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions): Promise<void>;
6363
6478
  /**
6364
6479
  * Resolve a paused `ask_user_question` LOCAL tool call.
6365
6480
  *
@@ -6428,6 +6543,9 @@ declare class AgentWidgetSession {
6428
6543
  * rather than mutating one already in flight.
6429
6544
  */
6430
6545
  private flushWebMcpAwaitBatch;
6546
+ private resolveWebMcpToolStartedAt;
6547
+ private markWebMcpToolRunning;
6548
+ private markWebMcpToolComplete;
6431
6549
  /**
6432
6550
  * Resolve TWO OR MORE parallel local-tool awaits sharing one paused
6433
6551
  * executionId with a SINGLE `/resume` (core#3878). Each call is executed
@@ -6675,8 +6793,10 @@ type Controller = {
6675
6793
  * Programmatically resolve a pending approval.
6676
6794
  * @param approvalId - The approval ID to resolve
6677
6795
  * @param decision - "approved" or "denied"
6796
+ * @param options - Optional decision context (e.g. `{ remember: true }`),
6797
+ * forwarded to `config.approval.onDecision`.
6678
6798
  */
6679
- resolveApproval: (approvalId: string, decision: 'approved' | 'denied') => Promise<void>;
6799
+ resolveApproval: (approvalId: string, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<void>;
6680
6800
  };
6681
6801
  declare const createAgentExperience: (mount: HTMLElement, initialConfig?: AgentWidgetConfig, runtimeOptions?: {
6682
6802
  debugTools?: boolean;
@@ -8499,4 +8619,4 @@ interface DemoCarouselHandle {
8499
8619
  }
8500
8620
  declare function createDemoCarousel(container: HTMLElement, options: DemoCarouselOptions): DemoCarouselHandle;
8501
8621
 
8502
- 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 };
8622
+ 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 };