@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
@@ -306,6 +306,8 @@ interface ApprovalTokens {
306
306
  background: TokenReference<'color'>;
307
307
  border: TokenReference<'color'>;
308
308
  text: TokenReference<'color'>;
309
+ /** Box-shadow for the approval bubble (token ref or raw CSS, e.g. `none`). */
310
+ shadow: string;
309
311
  };
310
312
  approve: ComponentTokenSet;
311
313
  deny: ComponentTokenSet;
@@ -628,13 +630,59 @@ interface AgentWidgetPlugin {
628
630
  config: AgentWidgetConfig;
629
631
  }) => HTMLElement | null;
630
632
  /**
631
- * Custom renderer for approval bubbles
632
- * Return null to use default renderer
633
+ * Custom renderer for approval bubbles.
634
+ *
635
+ * Return an `HTMLElement` to fully own the approval UI, `defaultRenderer()`
636
+ * to render (or wrap) the built-in bubble, or `null` to fall through to the
637
+ * default. Unlike the built-in bubble — whose Approve/Deny buttons are wired
638
+ * via delegation — a fully custom element resolves the approval by calling
639
+ * the `approve`/`deny` callbacks. Both route through the same path the
640
+ * built-in buttons use (optimistic update, `onDecision`, in-place anchoring).
641
+ *
642
+ * An approval is a single binary gate, so there are exactly two outcomes.
643
+ * Pass `{ remember: true }` to flag a "remember this" affordance (e.g. an
644
+ * "Always allow" button); the current approval resolves identically, but the
645
+ * flag is forwarded to `config.approval.onDecision` so you can persist a
646
+ * don't-ask-again policy for future approvals.
647
+ *
648
+ * `renderApproval` is called again whenever the approval's status changes, so
649
+ * branch on `message.approval?.status` to render the resolved state (and tear
650
+ * down any global listeners you added while pending).
651
+ *
652
+ * @example
653
+ * ```typescript
654
+ * // An alternative prompt: "Always allow" / "Allow once" / "Deny".
655
+ * renderApproval: ({ message, approve, deny }) => {
656
+ * const approval = message.approval;
657
+ * if (!approval || approval.status !== "pending") return null; // default renders resolved state
658
+ * const root = document.createElement("div");
659
+ * root.textContent = `${approval.toolName} requires approval`;
660
+ *
661
+ * const always = document.createElement("button");
662
+ * always.textContent = "Always allow";
663
+ * always.addEventListener("click", () => approve({ remember: true }));
664
+ *
665
+ * const once = document.createElement("button");
666
+ * once.textContent = "Allow once";
667
+ * once.addEventListener("click", () => approve());
668
+ *
669
+ * const no = document.createElement("button");
670
+ * no.textContent = "Deny";
671
+ * no.addEventListener("click", () => deny());
672
+ *
673
+ * root.append(always, once, no);
674
+ * return root;
675
+ * }
676
+ * ```
633
677
  */
634
678
  renderApproval?: (context: {
635
679
  message: AgentWidgetMessage;
636
680
  defaultRenderer: () => HTMLElement;
637
681
  config: AgentWidgetConfig;
682
+ /** Resolve this approval as approved. Pass `{ remember: true }` for an "Always allow" affordance. */
683
+ approve: (options?: AgentWidgetApprovalDecisionOptions) => void;
684
+ /** Resolve this approval as denied. Pass `{ remember: true }` for an "Always deny" affordance. */
685
+ deny: (options?: AgentWidgetApprovalDecisionOptions) => void;
638
686
  }) => HTMLElement | null;
639
687
  /**
640
688
  * Custom renderer for loading indicator
@@ -900,6 +948,7 @@ type RuntypeAgentSSEEvent = {
900
948
  iteration: number;
901
949
  reflection?: string;
902
950
  seq: number;
951
+ timestamp?: string;
903
952
  type: "agent_reflection";
904
953
  } | {
905
954
  activatedCapabilities: Array<string>;
@@ -907,6 +956,7 @@ type RuntypeAgentSSEEvent = {
907
956
  iteration: number;
908
957
  seq: number;
909
958
  skill: string;
959
+ timestamp?: string;
910
960
  toolCallId: string;
911
961
  type: "agent_skill_loaded";
912
962
  } | ({
@@ -916,6 +966,7 @@ type RuntypeAgentSSEEvent = {
916
966
  proposalId?: string;
917
967
  seq: number;
918
968
  skill: string;
969
+ timestamp?: string;
919
970
  toolCallId: string;
920
971
  type: "agent_skill_proposed";
921
972
  }) | ({
@@ -949,6 +1000,7 @@ type RuntypeAgentSSEEvent = {
949
1000
  iteration?: number;
950
1001
  recoverable: boolean;
951
1002
  seq: number;
1003
+ timestamp?: string;
952
1004
  type: "agent_error";
953
1005
  } | {
954
1006
  executionId: string;
@@ -982,6 +1034,7 @@ type RuntypeFlowSSEEvent = {
982
1034
  failedSteps?: number;
983
1035
  finalOutput?: string;
984
1036
  flowId?: string;
1037
+ flowName?: string;
985
1038
  output?: unknown;
986
1039
  seq?: number;
987
1040
  source?: string;
@@ -1033,6 +1086,7 @@ type RuntypeFlowSSEEvent = {
1033
1086
  id?: string;
1034
1087
  index?: number;
1035
1088
  name?: string;
1089
+ outputVariable?: string;
1036
1090
  seq?: number;
1037
1091
  startedAt: string;
1038
1092
  stepId?: string;
@@ -1440,6 +1494,12 @@ type WebMcpConfirmInfo = {
1440
1494
  toolName: string;
1441
1495
  args: unknown;
1442
1496
  description?: string;
1497
+ /**
1498
+ * Display title the tool declared via the WebMCP spec's
1499
+ * `ToolDescriptor.title` (e.g. `"Add to Cart"`). Absent when the tool
1500
+ * didn't declare one.
1501
+ */
1502
+ title?: string;
1443
1503
  annotations?: {
1444
1504
  readOnlyHint?: boolean;
1445
1505
  untrustedContentHint?: boolean;
@@ -2801,6 +2861,22 @@ type TextToSpeechConfig = {
2801
2861
  /** Speech pitch (0 - 2). Default: 1 */
2802
2862
  pitch?: number;
2803
2863
  };
2864
+ /**
2865
+ * Extra context for an approval decision, surfaced to `onDecision` and to the
2866
+ * `approve`/`deny` callbacks passed to the `renderApproval` plugin hook.
2867
+ */
2868
+ type AgentWidgetApprovalDecisionOptions = {
2869
+ /**
2870
+ * The user chose a "remember this" affordance (e.g. an "Always allow"
2871
+ * button) rather than a one-time decision. The widget resolves the *current*
2872
+ * approval identically whether or not this is set — an approval bubble is a
2873
+ * single binary gate (`approved`/`denied`). Persisting a don't-ask-again
2874
+ * policy for *future* approvals (auto-resolving them, or not surfacing them)
2875
+ * is the integrator's responsibility, typically inside `onDecision`.
2876
+ * Defaults to absent/`false`.
2877
+ */
2878
+ remember?: boolean;
2879
+ };
2804
2880
  /**
2805
2881
  * Configuration for tool approval bubbles.
2806
2882
  * Controls styling, labels, and behavior of the approval UI.
@@ -2810,6 +2886,8 @@ type AgentWidgetApprovalConfig = {
2810
2886
  backgroundColor?: string;
2811
2887
  /** Border color of the approval bubble */
2812
2888
  borderColor?: string;
2889
+ /** Box-shadow for the approval bubble; pass `"none"` to remove it. Overrides the default `persona-shadow-sm`. */
2890
+ shadow?: string;
2813
2891
  /** Color for the title text */
2814
2892
  titleColor?: string;
2815
2893
  /** Color for the description text */
@@ -2832,20 +2910,51 @@ type AgentWidgetApprovalConfig = {
2832
2910
  approveLabel?: string;
2833
2911
  /** Label for the deny button */
2834
2912
  denyLabel?: string;
2913
+ /**
2914
+ * How the technical details (the tool's agent-facing description and the
2915
+ * raw parameters JSON) are presented:
2916
+ * - `"collapsed"` (default) — hidden behind a "Show details" toggle
2917
+ * - `"expanded"` — visible, with the toggle available to hide them
2918
+ * - `"hidden"` — never rendered
2919
+ */
2920
+ detailsDisplay?: "collapsed" | "expanded" | "hidden";
2921
+ /** Label for the toggle that reveals the technical details */
2922
+ showDetailsLabel?: string;
2923
+ /** Label for the toggle that hides the technical details */
2924
+ hideDetailsLabel?: string;
2925
+ /**
2926
+ * Build the user-facing summary line for an approval request. Overrides the
2927
+ * default "The assistant wants to use “Tool name”." copy. Return a falsy
2928
+ * value to fall back to the default for that approval. `displayTitle` is
2929
+ * the display name the tool declared via the WebMCP spec's
2930
+ * `ToolDescriptor.title`, when one exists.
2931
+ */
2932
+ formatDescription?: (approval: {
2933
+ toolName: string;
2934
+ toolType?: string;
2935
+ description: string;
2936
+ parameters?: unknown;
2937
+ displayTitle?: string;
2938
+ }) => string | undefined;
2835
2939
  /**
2836
2940
  * Custom handler for approval decisions.
2837
2941
  * Return void to let the SDK auto-resolve via the API,
2838
2942
  * or return a Response/ReadableStream for custom handling.
2943
+ *
2944
+ * `options.remember` is `true` when the decision came from a "remember this"
2945
+ * affordance (e.g. an "Always allow" button in a custom `renderApproval`
2946
+ * plugin). Use it to persist a don't-ask-again policy for future approvals;
2947
+ * the current approval resolves the same way regardless.
2839
2948
  */
2840
2949
  onDecision?: (data: {
2841
2950
  approvalId: string;
2842
2951
  executionId: string;
2843
2952
  agentId: string;
2844
2953
  toolName: string;
2845
- }, decision: 'approved' | 'denied') => Promise<Response | ReadableStream<Uint8Array> | void>;
2954
+ }, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<Response | ReadableStream<Uint8Array> | void>;
2846
2955
  };
2847
2956
  type AgentWidgetToolCallConfig$1 = {
2848
- /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
2957
+ /** Box-shadow for tool-call bubbles; pass `"none"` to remove it. Overrides the `components.toolBubble.shadow` token / `--persona-tool-bubble-shadow`. */
2849
2958
  shadow?: string;
2850
2959
  /** Background color of the tool call bubble container. */
2851
2960
  backgroundColor?: string;
@@ -5331,8 +5440,10 @@ type Controller = {
5331
5440
  * Programmatically resolve a pending approval.
5332
5441
  * @param approvalId - The approval ID to resolve
5333
5442
  * @param decision - "approved" or "denied"
5443
+ * @param options - Optional decision context (e.g. `{ remember: true }`),
5444
+ * forwarded to `config.approval.onDecision`.
5334
5445
  */
5335
- resolveApproval: (approvalId: string, decision: 'approved' | 'denied') => Promise<void>;
5446
+ resolveApproval: (approvalId: string, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<void>;
5336
5447
  };
5337
5448
  type AgentWidgetController = Controller;
5338
5449
 
@@ -5379,7 +5490,7 @@ declare const MOCK_WORKSPACE_CONTENT = "\n <div class=\"preview-workspace-con
5379
5490
  */
5380
5491
  declare function buildSrcdoc(mountId: string, shellMode: 'light' | 'dark', docked: boolean, widgetCssPath: string): string;
5381
5492
  type PreviewScene = 'home' | 'conversation' | 'minimized' | 'artifact';
5382
- type PreviewTranscriptEntryPreset = 'user-message' | 'assistant-message' | 'assistant-code-block' | 'assistant-markdown-table' | 'assistant-image' | 'reasoning-streaming' | 'reasoning-complete' | 'tool-running' | 'tool-complete';
5493
+ type PreviewTranscriptEntryPreset = 'user-message' | 'assistant-message' | 'assistant-code-block' | 'assistant-markdown-table' | 'assistant-image' | 'reasoning-streaming' | 'reasoning-complete' | 'tool-running' | 'tool-complete' | 'approval-request';
5383
5494
  declare function getPreviewTranscriptPresetLabel(preset: PreviewTranscriptEntryPreset): string;
5384
5495
  declare function createPreviewTranscriptEntry(preset: PreviewTranscriptEntryPreset, index?: number): AgentWidgetMessage;
5385
5496
  declare function appendPreviewTranscriptEntry(messages: AgentWidgetMessage[], preset: PreviewTranscriptEntryPreset): AgentWidgetMessage[];
@@ -306,6 +306,8 @@ interface ApprovalTokens {
306
306
  background: TokenReference<'color'>;
307
307
  border: TokenReference<'color'>;
308
308
  text: TokenReference<'color'>;
309
+ /** Box-shadow for the approval bubble (token ref or raw CSS, e.g. `none`). */
310
+ shadow: string;
309
311
  };
310
312
  approve: ComponentTokenSet;
311
313
  deny: ComponentTokenSet;
@@ -628,13 +630,59 @@ interface AgentWidgetPlugin {
628
630
  config: AgentWidgetConfig;
629
631
  }) => HTMLElement | null;
630
632
  /**
631
- * Custom renderer for approval bubbles
632
- * Return null to use default renderer
633
+ * Custom renderer for approval bubbles.
634
+ *
635
+ * Return an `HTMLElement` to fully own the approval UI, `defaultRenderer()`
636
+ * to render (or wrap) the built-in bubble, or `null` to fall through to the
637
+ * default. Unlike the built-in bubble — whose Approve/Deny buttons are wired
638
+ * via delegation — a fully custom element resolves the approval by calling
639
+ * the `approve`/`deny` callbacks. Both route through the same path the
640
+ * built-in buttons use (optimistic update, `onDecision`, in-place anchoring).
641
+ *
642
+ * An approval is a single binary gate, so there are exactly two outcomes.
643
+ * Pass `{ remember: true }` to flag a "remember this" affordance (e.g. an
644
+ * "Always allow" button); the current approval resolves identically, but the
645
+ * flag is forwarded to `config.approval.onDecision` so you can persist a
646
+ * don't-ask-again policy for future approvals.
647
+ *
648
+ * `renderApproval` is called again whenever the approval's status changes, so
649
+ * branch on `message.approval?.status` to render the resolved state (and tear
650
+ * down any global listeners you added while pending).
651
+ *
652
+ * @example
653
+ * ```typescript
654
+ * // An alternative prompt: "Always allow" / "Allow once" / "Deny".
655
+ * renderApproval: ({ message, approve, deny }) => {
656
+ * const approval = message.approval;
657
+ * if (!approval || approval.status !== "pending") return null; // default renders resolved state
658
+ * const root = document.createElement("div");
659
+ * root.textContent = `${approval.toolName} requires approval`;
660
+ *
661
+ * const always = document.createElement("button");
662
+ * always.textContent = "Always allow";
663
+ * always.addEventListener("click", () => approve({ remember: true }));
664
+ *
665
+ * const once = document.createElement("button");
666
+ * once.textContent = "Allow once";
667
+ * once.addEventListener("click", () => approve());
668
+ *
669
+ * const no = document.createElement("button");
670
+ * no.textContent = "Deny";
671
+ * no.addEventListener("click", () => deny());
672
+ *
673
+ * root.append(always, once, no);
674
+ * return root;
675
+ * }
676
+ * ```
633
677
  */
634
678
  renderApproval?: (context: {
635
679
  message: AgentWidgetMessage;
636
680
  defaultRenderer: () => HTMLElement;
637
681
  config: AgentWidgetConfig;
682
+ /** Resolve this approval as approved. Pass `{ remember: true }` for an "Always allow" affordance. */
683
+ approve: (options?: AgentWidgetApprovalDecisionOptions) => void;
684
+ /** Resolve this approval as denied. Pass `{ remember: true }` for an "Always deny" affordance. */
685
+ deny: (options?: AgentWidgetApprovalDecisionOptions) => void;
638
686
  }) => HTMLElement | null;
639
687
  /**
640
688
  * Custom renderer for loading indicator
@@ -900,6 +948,7 @@ type RuntypeAgentSSEEvent = {
900
948
  iteration: number;
901
949
  reflection?: string;
902
950
  seq: number;
951
+ timestamp?: string;
903
952
  type: "agent_reflection";
904
953
  } | {
905
954
  activatedCapabilities: Array<string>;
@@ -907,6 +956,7 @@ type RuntypeAgentSSEEvent = {
907
956
  iteration: number;
908
957
  seq: number;
909
958
  skill: string;
959
+ timestamp?: string;
910
960
  toolCallId: string;
911
961
  type: "agent_skill_loaded";
912
962
  } | ({
@@ -916,6 +966,7 @@ type RuntypeAgentSSEEvent = {
916
966
  proposalId?: string;
917
967
  seq: number;
918
968
  skill: string;
969
+ timestamp?: string;
919
970
  toolCallId: string;
920
971
  type: "agent_skill_proposed";
921
972
  }) | ({
@@ -949,6 +1000,7 @@ type RuntypeAgentSSEEvent = {
949
1000
  iteration?: number;
950
1001
  recoverable: boolean;
951
1002
  seq: number;
1003
+ timestamp?: string;
952
1004
  type: "agent_error";
953
1005
  } | {
954
1006
  executionId: string;
@@ -982,6 +1034,7 @@ type RuntypeFlowSSEEvent = {
982
1034
  failedSteps?: number;
983
1035
  finalOutput?: string;
984
1036
  flowId?: string;
1037
+ flowName?: string;
985
1038
  output?: unknown;
986
1039
  seq?: number;
987
1040
  source?: string;
@@ -1033,6 +1086,7 @@ type RuntypeFlowSSEEvent = {
1033
1086
  id?: string;
1034
1087
  index?: number;
1035
1088
  name?: string;
1089
+ outputVariable?: string;
1036
1090
  seq?: number;
1037
1091
  startedAt: string;
1038
1092
  stepId?: string;
@@ -1440,6 +1494,12 @@ type WebMcpConfirmInfo = {
1440
1494
  toolName: string;
1441
1495
  args: unknown;
1442
1496
  description?: string;
1497
+ /**
1498
+ * Display title the tool declared via the WebMCP spec's
1499
+ * `ToolDescriptor.title` (e.g. `"Add to Cart"`). Absent when the tool
1500
+ * didn't declare one.
1501
+ */
1502
+ title?: string;
1443
1503
  annotations?: {
1444
1504
  readOnlyHint?: boolean;
1445
1505
  untrustedContentHint?: boolean;
@@ -2801,6 +2861,22 @@ type TextToSpeechConfig = {
2801
2861
  /** Speech pitch (0 - 2). Default: 1 */
2802
2862
  pitch?: number;
2803
2863
  };
2864
+ /**
2865
+ * Extra context for an approval decision, surfaced to `onDecision` and to the
2866
+ * `approve`/`deny` callbacks passed to the `renderApproval` plugin hook.
2867
+ */
2868
+ type AgentWidgetApprovalDecisionOptions = {
2869
+ /**
2870
+ * The user chose a "remember this" affordance (e.g. an "Always allow"
2871
+ * button) rather than a one-time decision. The widget resolves the *current*
2872
+ * approval identically whether or not this is set — an approval bubble is a
2873
+ * single binary gate (`approved`/`denied`). Persisting a don't-ask-again
2874
+ * policy for *future* approvals (auto-resolving them, or not surfacing them)
2875
+ * is the integrator's responsibility, typically inside `onDecision`.
2876
+ * Defaults to absent/`false`.
2877
+ */
2878
+ remember?: boolean;
2879
+ };
2804
2880
  /**
2805
2881
  * Configuration for tool approval bubbles.
2806
2882
  * Controls styling, labels, and behavior of the approval UI.
@@ -2810,6 +2886,8 @@ type AgentWidgetApprovalConfig = {
2810
2886
  backgroundColor?: string;
2811
2887
  /** Border color of the approval bubble */
2812
2888
  borderColor?: string;
2889
+ /** Box-shadow for the approval bubble; pass `"none"` to remove it. Overrides the default `persona-shadow-sm`. */
2890
+ shadow?: string;
2813
2891
  /** Color for the title text */
2814
2892
  titleColor?: string;
2815
2893
  /** Color for the description text */
@@ -2832,20 +2910,51 @@ type AgentWidgetApprovalConfig = {
2832
2910
  approveLabel?: string;
2833
2911
  /** Label for the deny button */
2834
2912
  denyLabel?: string;
2913
+ /**
2914
+ * How the technical details (the tool's agent-facing description and the
2915
+ * raw parameters JSON) are presented:
2916
+ * - `"collapsed"` (default) — hidden behind a "Show details" toggle
2917
+ * - `"expanded"` — visible, with the toggle available to hide them
2918
+ * - `"hidden"` — never rendered
2919
+ */
2920
+ detailsDisplay?: "collapsed" | "expanded" | "hidden";
2921
+ /** Label for the toggle that reveals the technical details */
2922
+ showDetailsLabel?: string;
2923
+ /** Label for the toggle that hides the technical details */
2924
+ hideDetailsLabel?: string;
2925
+ /**
2926
+ * Build the user-facing summary line for an approval request. Overrides the
2927
+ * default "The assistant wants to use “Tool name”." copy. Return a falsy
2928
+ * value to fall back to the default for that approval. `displayTitle` is
2929
+ * the display name the tool declared via the WebMCP spec's
2930
+ * `ToolDescriptor.title`, when one exists.
2931
+ */
2932
+ formatDescription?: (approval: {
2933
+ toolName: string;
2934
+ toolType?: string;
2935
+ description: string;
2936
+ parameters?: unknown;
2937
+ displayTitle?: string;
2938
+ }) => string | undefined;
2835
2939
  /**
2836
2940
  * Custom handler for approval decisions.
2837
2941
  * Return void to let the SDK auto-resolve via the API,
2838
2942
  * or return a Response/ReadableStream for custom handling.
2943
+ *
2944
+ * `options.remember` is `true` when the decision came from a "remember this"
2945
+ * affordance (e.g. an "Always allow" button in a custom `renderApproval`
2946
+ * plugin). Use it to persist a don't-ask-again policy for future approvals;
2947
+ * the current approval resolves the same way regardless.
2839
2948
  */
2840
2949
  onDecision?: (data: {
2841
2950
  approvalId: string;
2842
2951
  executionId: string;
2843
2952
  agentId: string;
2844
2953
  toolName: string;
2845
- }, decision: 'approved' | 'denied') => Promise<Response | ReadableStream<Uint8Array> | void>;
2954
+ }, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<Response | ReadableStream<Uint8Array> | void>;
2846
2955
  };
2847
2956
  type AgentWidgetToolCallConfig$1 = {
2848
- /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
2957
+ /** Box-shadow for tool-call bubbles; pass `"none"` to remove it. Overrides the `components.toolBubble.shadow` token / `--persona-tool-bubble-shadow`. */
2849
2958
  shadow?: string;
2850
2959
  /** Background color of the tool call bubble container. */
2851
2960
  backgroundColor?: string;
@@ -5331,8 +5440,10 @@ type Controller = {
5331
5440
  * Programmatically resolve a pending approval.
5332
5441
  * @param approvalId - The approval ID to resolve
5333
5442
  * @param decision - "approved" or "denied"
5443
+ * @param options - Optional decision context (e.g. `{ remember: true }`),
5444
+ * forwarded to `config.approval.onDecision`.
5334
5445
  */
5335
- resolveApproval: (approvalId: string, decision: 'approved' | 'denied') => Promise<void>;
5446
+ resolveApproval: (approvalId: string, decision: 'approved' | 'denied', options?: AgentWidgetApprovalDecisionOptions) => Promise<void>;
5336
5447
  };
5337
5448
  type AgentWidgetController = Controller;
5338
5449
 
@@ -5379,7 +5490,7 @@ declare const MOCK_WORKSPACE_CONTENT = "\n <div class=\"preview-workspace-con
5379
5490
  */
5380
5491
  declare function buildSrcdoc(mountId: string, shellMode: 'light' | 'dark', docked: boolean, widgetCssPath: string): string;
5381
5492
  type PreviewScene = 'home' | 'conversation' | 'minimized' | 'artifact';
5382
- type PreviewTranscriptEntryPreset = 'user-message' | 'assistant-message' | 'assistant-code-block' | 'assistant-markdown-table' | 'assistant-image' | 'reasoning-streaming' | 'reasoning-complete' | 'tool-running' | 'tool-complete';
5493
+ type PreviewTranscriptEntryPreset = 'user-message' | 'assistant-message' | 'assistant-code-block' | 'assistant-markdown-table' | 'assistant-image' | 'reasoning-streaming' | 'reasoning-complete' | 'tool-running' | 'tool-complete' | 'approval-request';
5383
5494
  declare function getPreviewTranscriptPresetLabel(preset: PreviewTranscriptEntryPreset): string;
5384
5495
  declare function createPreviewTranscriptEntry(preset: PreviewTranscriptEntryPreset, index?: number): AgentWidgetMessage;
5385
5496
  declare function appendPreviewTranscriptEntry(messages: AgentWidgetMessage[], preset: PreviewTranscriptEntryPreset): AgentWidgetMessage[];