@runtypelabs/persona 4.24.0 → 4.26.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 (237) hide show
  1. package/dist/animations/glyph-cycle.d.cts +1 -1
  2. package/dist/animations/glyph-cycle.d.ts +1 -1
  3. package/dist/animations/{types-Db61aI9J.d.cts → types-BwKTZhg9.d.cts} +14 -0
  4. package/dist/animations/{types-Db61aI9J.d.ts → types-BwKTZhg9.d.ts} +14 -0
  5. package/dist/animations/wipe.d.cts +1 -1
  6. package/dist/animations/wipe.d.ts +1 -1
  7. package/dist/animations-extra.d.cts +14 -0
  8. package/dist/animations-extra.d.ts +14 -0
  9. package/dist/approval-ui-QAKWNFNM.js +1 -0
  10. package/dist/approval-ui.cjs +2 -2
  11. package/dist/approval-ui.d.cts +243 -8
  12. package/dist/approval-ui.d.ts +243 -8
  13. package/dist/approval-ui.js +2 -2
  14. package/dist/{artifacts-ui-IGB5YKLO.js → artifacts-ui-NJGMM27I.js} +1 -1
  15. package/dist/artifacts-ui.cjs +4 -4
  16. package/dist/artifacts-ui.d.cts +243 -8
  17. package/dist/artifacts-ui.d.ts +243 -8
  18. package/dist/artifacts-ui.js +5 -5
  19. package/dist/chunk-2ANTRKTV.js +1 -0
  20. package/dist/chunk-4HPTPUC6.js +1 -0
  21. package/dist/chunk-6V3MNEKB.js +1 -0
  22. package/dist/chunk-HGUCGM3K.js +9 -0
  23. package/dist/chunk-IO5VVUKP.js +3 -0
  24. package/dist/chunk-J4J3Y2P2.js +1 -0
  25. package/dist/chunk-K6HKIP5K.js +1 -0
  26. package/dist/chunk-K7NA7G7J.js +1 -0
  27. package/dist/chunk-MXUTS3LB.js +1 -0
  28. package/dist/chunk-PDPVORUF.js +1 -0
  29. package/dist/chunk-QPPJUSZH.js +1 -0
  30. package/dist/chunk-QRKGQPU7.js +1 -0
  31. package/dist/chunk-S6PBWE75.js +1 -0
  32. package/dist/chunk-T7QM7YMF.js +1 -0
  33. package/dist/chunk-TR2H475E.js +1 -0
  34. package/dist/chunk-UPO4GUFC.js +1 -0
  35. package/dist/chunk-ZC66NAIR.js +1 -0
  36. package/dist/client-history-YPEG45Q4.js +1 -0
  37. package/dist/client-history.js +1 -0
  38. package/dist/client-stream-42FOI3EC.js +4 -0
  39. package/dist/client-stream.js +5 -0
  40. package/dist/codegen.cjs +1 -1
  41. package/dist/codegen.js +1 -1
  42. package/dist/context-mentions-E7HJYWO6.js +161 -0
  43. package/dist/{context-mentions-inline-I2RDEBAK.js → context-mentions-inline-QVESLW55.js} +1 -1
  44. package/dist/context-mentions.cjs +7 -7
  45. package/dist/context-mentions.d.cts +243 -8
  46. package/dist/context-mentions.d.ts +243 -8
  47. package/dist/context-mentions.js +8 -8
  48. package/dist/event-stream-view-FOIJHFQO.js +1 -0
  49. package/dist/event-stream-view.cjs +1 -1
  50. package/dist/event-stream-view.d.cts +246 -31
  51. package/dist/event-stream-view.d.ts +246 -31
  52. package/dist/event-stream-view.js +1 -1
  53. package/dist/forms-ui.d.cts +295 -667
  54. package/dist/forms-ui.d.ts +295 -667
  55. package/dist/history-shell-QDQ44PSE.js +3 -0
  56. package/dist/history-shell.js +3 -0
  57. package/dist/{history-view-BD6OXLNA.js → history-view-NCFBI5GR.js} +2 -2
  58. package/dist/history-view.cjs +2 -2
  59. package/dist/history-view.d.cts +35 -1
  60. package/dist/history-view.d.ts +35 -1
  61. package/dist/history-view.js +2 -2
  62. package/dist/index.cjs +80 -74
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.d.cts +301 -738
  65. package/dist/index.d.ts +301 -738
  66. package/dist/index.global.js +3 -215
  67. package/dist/index.global.js.map +1 -1
  68. package/dist/index.js +81 -75
  69. package/dist/index.js.map +1 -1
  70. package/dist/install.global.js +1 -1
  71. package/dist/install.global.js.map +1 -1
  72. package/dist/launcher.global.js +3 -67
  73. package/dist/launcher.global.js.map +1 -1
  74. package/dist/markdown-parsers.js +22 -22
  75. package/dist/runtype-tts-entry-NFBVWR7N.js +1 -0
  76. package/dist/runtype-tts.js +1 -1
  77. package/dist/session-actions-ISSKSI66.js +1 -0
  78. package/dist/session-actions.js +1 -0
  79. package/dist/session-reconnect.d.cts +243 -8
  80. package/dist/session-reconnect.d.ts +243 -8
  81. package/dist/smart-dom-reader.cjs +13 -13
  82. package/dist/smart-dom-reader.d.cts +243 -8
  83. package/dist/smart-dom-reader.d.ts +243 -8
  84. package/dist/smart-dom-reader.js +11 -11
  85. package/dist/theme-editor-preview.cjs +116 -98
  86. package/dist/theme-editor-preview.d.cts +245 -8
  87. package/dist/theme-editor-preview.d.ts +245 -8
  88. package/dist/theme-editor-preview.js +49 -54
  89. package/dist/theme-editor.cjs +2 -2
  90. package/dist/theme-editor.d.cts +244 -23
  91. package/dist/theme-editor.d.ts +244 -23
  92. package/dist/theme-editor.js +2 -2
  93. package/dist/theme-reference.d.cts +14 -0
  94. package/dist/theme-reference.d.ts +14 -0
  95. package/dist/ui-extras-entry-WAYFKVNW.js +3 -0
  96. package/dist/ui-extras.js +72 -0
  97. package/dist/voice-runtime-UOQOFAFY.js +17 -0
  98. package/dist/voice-runtime.cjs +17 -1
  99. package/dist/voice-runtime.d.cts +11643 -192
  100. package/dist/voice-runtime.d.ts +11643 -192
  101. package/dist/voice-runtime.js +17 -1
  102. package/dist/voice-worklet-player.cjs +19 -4
  103. package/dist/voice-worklet-player.d.cts +9 -10
  104. package/dist/voice-worklet-player.d.ts +9 -10
  105. package/dist/voice-worklet-player.js +19 -4
  106. package/dist/webmcp-polyfill.js +1 -1
  107. package/dist/webmcp-runtime-V6ZWW3PI.js +6 -0
  108. package/dist/webmcp-runtime.cjs +2 -2
  109. package/dist/webmcp-runtime.d.cts +1 -33
  110. package/dist/webmcp-runtime.d.ts +1 -33
  111. package/dist/webmcp-runtime.js +2 -2
  112. package/dist/widget.css +1 -1
  113. package/package.json +11 -5
  114. package/src/approval-paused-tool-settle.test.ts +221 -0
  115. package/src/client-approve.test.ts +311 -0
  116. package/src/client-history-eager.ts +9 -0
  117. package/src/client-history-loader.ts +23 -0
  118. package/src/client-history.ts +579 -0
  119. package/src/client-resume.ts +177 -0
  120. package/src/client-stream-eager.ts +12 -0
  121. package/src/client-stream-loader.ts +25 -0
  122. package/src/client-stream.ts +1880 -0
  123. package/src/client.test.ts +31 -1
  124. package/src/client.ts +293 -2607
  125. package/src/components/approval-actions.test.ts +27 -0
  126. package/src/components/approval-actions.ts +27 -3
  127. package/src/components/message-bubble.test.ts +19 -0
  128. package/src/components/message-bubble.ts +2 -0
  129. package/src/components/registry.ts +6 -6
  130. package/src/components/tool-bubble.test.ts +9 -0
  131. package/src/components/tool-bubble.ts +1 -0
  132. package/src/history-shell-bundle.test.ts +54 -0
  133. package/src/history-shell-eager.ts +12 -0
  134. package/src/history-shell-loader.ts +27 -0
  135. package/src/history-shell.ts +2362 -0
  136. package/src/history-view-loader.ts +2 -0
  137. package/src/history-view.ts +3 -0
  138. package/src/index-core.ts +8 -0
  139. package/src/index-global.ts +90 -248
  140. package/src/index.ts +13 -0
  141. package/src/install.ts +6 -4
  142. package/src/internal/runtype-history-provider.test.ts +1 -0
  143. package/src/internal/runtype-history-provider.ts +28 -13
  144. package/src/plugins/registry.ts +8 -8
  145. package/src/session-actions-chunk.test.ts +55 -0
  146. package/src/session-actions-eager.ts +11 -0
  147. package/src/session-actions-loader.ts +37 -0
  148. package/src/session-actions.ts +909 -0
  149. package/src/session-history.test.ts +3 -1
  150. package/src/session.ts +875 -1530
  151. package/src/session.voice.test.ts +1241 -5
  152. package/src/styles/widget.css +58 -0
  153. package/src/theme-editor/state.ts +91 -91
  154. package/src/types.ts +269 -5
  155. package/src/ui-ask-user-sheet.ts +382 -0
  156. package/src/ui-extras-eager.ts +10 -0
  157. package/src/ui-extras-entry.ts +9 -0
  158. package/src/ui-extras-loader.ts +26 -0
  159. package/src/ui.artifact-rail-resize.test.ts +2 -1
  160. package/src/ui.ask-user-chunk.test.ts +93 -0
  161. package/src/ui.history-chunk.test.ts +2 -1
  162. package/src/ui.history-config-provider.test.ts +2 -1
  163. package/src/ui.history-confirm-fallback.test.ts +142 -0
  164. package/src/ui.history-controller.test.ts +2 -1
  165. package/src/ui.history-lifecycle.test.ts +2 -1
  166. package/src/ui.history-render-hooks.test.ts +2 -1
  167. package/src/ui.history-shell.test.ts +2 -1
  168. package/src/ui.rail-overlay.test.ts +2 -1
  169. package/src/ui.rail-resize.test.ts +2 -1
  170. package/src/ui.rail-trigger-pending.test.ts +2 -1
  171. package/src/ui.ts +399 -2770
  172. package/src/ui.voice-prewarm.test.ts +222 -0
  173. package/src/utils/attachment-manager.ts +67 -67
  174. package/src/utils/constants.ts +3 -0
  175. package/src/utils/context-mention-controller.ts +323 -323
  176. package/src/utils/context-mention-manager.ts +40 -40
  177. package/src/utils/context-mention-orchestrator.ts +28 -0
  178. package/src/utils/event-stream-buffer.ts +50 -50
  179. package/src/utils/event-stream-store.ts +43 -43
  180. package/src/utils/throughput-tracker.ts +34 -34
  181. package/src/utils/virtual-scroller.ts +67 -67
  182. package/src/utils/visitor-store.test.ts +50 -0
  183. package/src/utils/visitor-store.ts +23 -5
  184. package/src/voice/__fixtures__/voice-wire/README.md +1 -0
  185. package/src/voice/__fixtures__/voice-wire/client/cancel.json +3 -0
  186. package/src/voice/__fixtures__/voice-wire/client/context.json +4 -0
  187. package/src/voice/__fixtures__/voice-wire/client/delegation_result.json +6 -0
  188. package/src/voice/__fixtures__/voice-wire/client/delegation_update.json +6 -0
  189. package/src/voice/__fixtures__/voice-wire/client/ping.json +3 -0
  190. package/src/voice/__fixtures__/voice-wire/client/playback_progress.json +5 -0
  191. package/src/voice/__fixtures__/voice-wire/client/start.json +3 -0
  192. package/src/voice/__fixtures__/voice-wire/server/artifact.json +11 -0
  193. package/src/voice/__fixtures__/voice-wire/server/attached.json +4 -0
  194. package/src/voice/__fixtures__/voice-wire/server/audio_clear.json +4 -0
  195. package/src/voice/__fixtures__/voice-wire/server/audio_end.json +3 -0
  196. package/src/voice/__fixtures__/voice-wire/server/delegation_cancelled.json +5 -0
  197. package/src/voice/__fixtures__/voice-wire/server/delegation_completed.json +8 -0
  198. package/src/voice/__fixtures__/voice-wire/server/delegation_started.json +15 -0
  199. package/src/voice/__fixtures__/voice-wire/server/error.json +6 -0
  200. package/src/voice/__fixtures__/voice-wire/server/metrics.json +10 -0
  201. package/src/voice/__fixtures__/voice-wire/server/pong.json +3 -0
  202. package/src/voice/__fixtures__/voice-wire/server/session_config.json +16 -0
  203. package/src/voice/__fixtures__/voice-wire/server/transcript_final.json +7 -0
  204. package/src/voice/__fixtures__/voice-wire/server/transcript_interim.json +4 -0
  205. package/src/voice/__fixtures__/voice-wire/server/transcript_partial.json +6 -0
  206. package/src/voice/__fixtures__/voice-wire/server/transcript_update.json +10 -0
  207. package/src/voice/__fixtures__/voice-wire/server/warning.json +5 -0
  208. package/src/voice/audio-playback-manager.test.ts +57 -0
  209. package/src/voice/audio-playback-manager.ts +120 -98
  210. package/src/voice/browser-voice-provider.ts +37 -37
  211. package/src/voice/fallback-speech-engine.ts +22 -16
  212. package/src/voice/keyed-voice-transcript.ts +314 -0
  213. package/src/voice/mic-state-styles.ts +182 -0
  214. package/src/voice/read-aloud-controller.ts +46 -44
  215. package/src/voice/runtype-speech-engine.ts +35 -33
  216. package/src/voice/runtype-voice-provider.ts +856 -164
  217. package/src/voice/session-voice-wiring.ts +266 -0
  218. package/src/voice/voice-delegation.test.ts +71 -0
  219. package/src/voice/voice-delegation.ts +364 -0
  220. package/src/voice/voice-turn-tracker.ts +6 -6
  221. package/src/voice/voice.test.ts +1250 -7
  222. package/src/voice/worklet-playback-engine.test.ts +81 -0
  223. package/src/voice/worklet-playback-engine.ts +21 -3
  224. package/src/voice-runtime-loader.ts +4 -1
  225. package/src/voice-runtime.ts +7 -0
  226. package/src/webmcp-runtime-entry.ts +41 -39
  227. package/dist/approval-ui-3NMYNXBD.js +0 -1
  228. package/dist/chunk-5EIIHQLQ.js +0 -1
  229. package/dist/chunk-7CO4T5KB.js +0 -1
  230. package/dist/chunk-EFJBUH5F.js +0 -1
  231. package/dist/chunk-R2TMIMDI.js +0 -3
  232. package/dist/chunk-UTVLOTWB.js +0 -9
  233. package/dist/context-mentions-45MODWOY.js +0 -161
  234. package/dist/event-stream-view-GL3ADRY2.js +0 -1
  235. package/dist/runtype-tts-entry-UJAEF7NZ.js +0 -1
  236. package/dist/voice-runtime-EFR3R5ES.js +0 -1
  237. package/dist/webmcp-runtime-JI7T4QYF.js +0 -6
package/dist/index.d.ts CHANGED
@@ -7011,6 +7011,22 @@ type AgentWidgetStatusIndicatorConfig = {
7011
7011
  /** Status text while a reconnect attempt is in flight. */
7012
7012
  resumingText?: string;
7013
7013
  };
7014
+ /** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
7015
+ type AgentWidgetVoicePrewarmTrigger = 'hover';
7016
+ /**
7017
+ * Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
7018
+ * button, and again when the button is rebuilt or `update()` swaps in a
7019
+ * different function. Call `warm()` whenever the visitor shows intent to talk
7020
+ * (it is safe to call repeatedly). Return a cleanup to run on replacement.
7021
+ */
7022
+ type AgentWidgetVoicePrewarmHook = (context: {
7023
+ /** Fire-and-forget voice warm-up; latched and error-swallowing. */
7024
+ warm: () => void;
7025
+ /** The composer's current mic button. */
7026
+ micButton: HTMLButtonElement;
7027
+ /** The widget's mount element. */
7028
+ mount: HTMLElement;
7029
+ }) => void | (() => void);
7014
7030
  type AgentWidgetVoiceRecognitionConfig = {
7015
7031
  /**
7016
7032
  * Enable the mic button and voice input. The mic still only renders when the
@@ -7076,6 +7092,29 @@ type AgentWidgetVoiceRecognitionConfig = {
7076
7092
  * Fires once per turn after the reply completes.
7077
7093
  */
7078
7094
  onMetrics?: (metrics: VoiceMetrics) => void;
7095
+ /**
7096
+ * Warm the voice path when the visitor shows intent to talk, before the mic
7097
+ * click, so the call starts faster.
7098
+ *
7099
+ * - `'hover'`: when the pointer enters the mic button, it receives focus, or
7100
+ * (on touch) the first pointer-down on it.
7101
+ * - `false`: never.
7102
+ * - A function: custom trigger. Called with `{ warm, micButton, mount }`
7103
+ * while the mic button exists (and again when the button is rebuilt or
7104
+ * `update()` swaps in a different function); call `warm()` whenever you
7105
+ * decide, e.g. when the panel opens. May return a cleanup that runs on
7106
+ * destroy, rebuild, or replacement. Replaces the built-in trigger.
7107
+ *
7108
+ * What `warm()` does depends on the provider: `runtype` fires its prewarm
7109
+ * (see `provider.runtype.prewarmMode`), a `custom` provider's optional
7110
+ * {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
7111
+ * starts the client-token session init (as `sessionInit` does), since speech
7112
+ * recognition itself cannot start before the click. Warming is
7113
+ * fire-and-forget, latched, and never surfaces an error or UI state.
7114
+ *
7115
+ * @default 'hover' in client token mode, otherwise `false`
7116
+ */
7117
+ prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
7079
7118
  provider?: {
7080
7119
  type: 'browser' | 'runtype' | 'custom';
7081
7120
  browser?: {
@@ -7097,6 +7136,62 @@ type AgentWidgetVoiceRecognitionConfig = {
7097
7136
  * `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
7098
7137
  */
7099
7138
  createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
7139
+ /**
7140
+ * How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
7141
+ *
7142
+ * - `'request'` (default): a fire-and-forget
7143
+ * `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
7144
+ * - `'attach'`: open the voice WebSocket ahead of the click without
7145
+ * starting a call; the click then starts the call on that socket. It can
7146
+ * create server work before the visitor clicks, so it is opt-in.
7147
+ * @default 'request'
7148
+ */
7149
+ prewarmMode?: 'request' | 'attach';
7150
+ /**
7151
+ * `'attach'` mode: how long (ms) an attached socket waits for the click
7152
+ * before it closes. The server clamps it to 30000..600000.
7153
+ * @default 30000
7154
+ */
7155
+ attachIdleMs?: number;
7156
+ /**
7157
+ * Full-duplex (speech-to-speech, e.g. GPT-Live) calls: run the turns the
7158
+ * voice model hands off to the agent through this widget's normal chat
7159
+ * pipeline. The spoken request becomes the user message, and the answer
7160
+ * renders as a regular assistant message (streaming, tool and approval
7161
+ * UI, WebMCP page tools, persistence) that the voice model then reads
7162
+ * aloud. Only takes effect when the server supports it (it confirms in
7163
+ * `session_config`); otherwise the agent turn runs on the server and its
7164
+ * spoken reply is transcribed, as before. Set `false` to always keep the
7165
+ * agent turn on the server.
7166
+ * @default true
7167
+ */
7168
+ clientDelegation?: boolean;
7169
+ /**
7170
+ * Full-duplex calls: extra context for the voice model (for example the
7171
+ * page the visitor is on), sent after the chat history as of call start.
7172
+ * The frame goes out once, when the visitor finishes their first
7173
+ * utterance (or at the first agent hand-off). A function is
7174
+ * called at call start and may be async. This text is capped at 4000 characters and the whole frame
7175
+ * (history included) at 8000. Sent only to servers that accept call
7176
+ * context (they announce it in `session_config`).
7177
+ */
7178
+ callContext?: string | (() => string | Promise<string>);
7179
+ /**
7180
+ * Full-duplex calls with client delegation: how long a tool approval
7181
+ * that a spoken request raised may wait before it is declined as
7182
+ * expired (and the voice model says so). Server-side approval gates
7183
+ * keep their own timeout too. Hanging up never declines it: the
7184
+ * approval card in the chat stays usable. Capped at 540000 (9 minutes),
7185
+ * under the server's 10-minute delegation deadline.
7186
+ * @default 300000
7187
+ */
7188
+ approvalTimeoutMs?: number;
7189
+ /**
7190
+ * Speech-to-speech calls: the one-line notice shown in the composer
7191
+ * status area when the call starts. `false` hides it.
7192
+ * @default "You're talking to an AI assistant. Voice is processed by OpenAI."
7193
+ */
7194
+ disclosureText?: string | false;
7100
7195
  /** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
7101
7196
  pauseDuration?: number;
7102
7197
  /** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
@@ -7335,6 +7430,13 @@ interface VoicePlaybackEngine {
7335
7430
  onFinished(callback: () => void): void;
7336
7431
  /** Release all audio resources. */
7337
7432
  destroy(): Promise<void> | void;
7433
+ /**
7434
+ * Optional. Speech-to-speech calls stream reply audio with no end-of-stream
7435
+ * marker, so an engine that holds audio below a prebuffer waterline must, while
7436
+ * continuous, release that held tail on its own (e.g. after a short input gap)
7437
+ * instead of waiting for {@link markStreamEnd}. Engines without a prebuffer can omit it.
7438
+ */
7439
+ setContinuousMode?(enabled: boolean): void;
7338
7440
  }
7339
7441
  /**
7340
7442
  * A {@link VoicePlaybackEngine} that also supports pause/resume. Returned by
@@ -7382,6 +7484,18 @@ type VoiceConfig = {
7382
7484
  * `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
7383
7485
  */
7384
7486
  createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
7487
+ /** See `voiceRecognition.provider.runtype.prewarmMode`. @default 'request' */
7488
+ prewarmMode?: 'request' | 'attach';
7489
+ /** See `voiceRecognition.provider.runtype.attachIdleMs`. @default 30000 */
7490
+ attachIdleMs?: number;
7491
+ /** See `voiceRecognition.provider.runtype.clientDelegation`. @default true */
7492
+ clientDelegation?: boolean;
7493
+ /** See `voiceRecognition.provider.runtype.callContext`. */
7494
+ callContext?: string | (() => string | Promise<string>);
7495
+ /** See `voiceRecognition.provider.runtype.approvalTimeoutMs`. @default 300000 (capped at 540000) */
7496
+ approvalTimeoutMs?: number;
7497
+ /** See `voiceRecognition.provider.runtype.disclosureText`. */
7498
+ disclosureText?: string | false;
7385
7499
  /** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
7386
7500
  pauseDuration?: number;
7387
7501
  /** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
@@ -7414,14 +7528,23 @@ interface VoiceProvider {
7414
7528
  * Register a callback for incremental transcript updates during a voice turn.
7415
7529
  * `isFinal=false` is a live interim update (user partials, or assistant deltas
7416
7530
  * on providers that stream them); `isFinal=true` finalizes that role's text.
7417
- * On the realtime `runtype` path, interim updates fire for the `user` only and
7418
- * the `assistant` arrives as a single final. Providers with overlapping turns
7419
- * must include the same turnId on user and assistant finals; without IDs,
7420
- * providers must discard cancelled output before emitting the next user final.
7421
- */
7422
- onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
7423
- turnId?: string;
7424
- }) => void): void;
7531
+ * On the classic realtime `runtype` path, interim updates fire for the `user`
7532
+ * only and the `assistant` arrives as a single final; without a turnId the
7533
+ * session assumes strictly alternating turns, and providers must discard
7534
+ * cancelled output before emitting the next user final.
7535
+ *
7536
+ * When `metadata.turnId` is present (full-duplex / speech-to-speech, e.g.
7537
+ * GPT-Live), the session reconciles by `(turnId, role)`: each pair owns one
7538
+ * bubble that later updates replace in place, turns may overlap or arrive in
7539
+ * any order, and no empty assistant placeholder is injected. User and
7540
+ * assistant may share a turnId (a late user bubble then renders above its
7541
+ * reply) or use distinct ones. `metadata.startMs` (call-relative ms when the
7542
+ * utterance began) orders a new bubble among the call's other keyed bubbles;
7543
+ * without it bubbles order by first arrival. After a stop, keyed providers
7544
+ * must drop the cancelled reply's output until the server acknowledges the
7545
+ * cancel: the session renders every reply it receives.
7546
+ */
7547
+ onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: VoiceTranscriptMetadata) => void): void;
7425
7548
  /** Register a callback for per-turn latency metrics (realtime path). */
7426
7549
  onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
7427
7550
  /**
@@ -7442,6 +7565,116 @@ interface VoiceProvider {
7442
7565
  deactivateBargeIn?(): Promise<void>;
7443
7566
  /** Stop playback / cancel in-flight request without starting recording */
7444
7567
  stopPlayback?(): void;
7568
+ /**
7569
+ * Warm the provider ahead of `startListening()` (the widget calls it on mic
7570
+ * intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
7571
+ * throw, emit errors or status, or acquire the microphone. May be called
7572
+ * repeatedly; throttle as needed.
7573
+ */
7574
+ prewarm?(): void;
7575
+ /**
7576
+ * Called by the session once after construction with the chat-side surface
7577
+ * a full-duplex provider uses to hand agent turns to the chat pipeline
7578
+ * ({@link VoiceSessionBridge}). Providers without client delegation omit it.
7579
+ */
7580
+ setSessionBridge?(bridge: VoiceSessionBridge): void;
7581
+ /** The AI-disclosure notice for the live call, if one should show (speech-to-speech). */
7582
+ getDisclosure?(): string | null;
7583
+ }
7584
+ /** Metadata on a {@link VoiceProvider.onTranscript} update. */
7585
+ type VoiceTranscriptMetadata = {
7586
+ /** Groups updates that belong to one utterance bubble (full duplex). */
7587
+ turnId?: string;
7588
+ /** Call-relative ms when the utterance began; orders late bubbles. */
7589
+ startMs?: number;
7590
+ /** Call-relative ms of the latest audio this update covers. */
7591
+ endMs?: number;
7592
+ /**
7593
+ * The bubble only captions speech (see `AgentWidgetMessage.voiceCaption`).
7594
+ * The chat pipeline owns the conversation, as with client delegation.
7595
+ */
7596
+ caption?: boolean;
7597
+ };
7598
+ /** An agent turn a full-duplex voice model handed to the widget. */
7599
+ type VoiceDelegationRequest = {
7600
+ /** The voice model's delegation id (`delegation_started.delegationId`). */
7601
+ delegationId: string;
7602
+ /** What the visitor asked, as the voice model heard it. */
7603
+ userText: string;
7604
+ /**
7605
+ * The user transcript utterances `userText` joins, oldest first (the last
7606
+ * is the one it came from). May be empty.
7607
+ */
7608
+ userUtteranceIds: string[];
7609
+ /** The voice model's view of the conversation it delegated from. */
7610
+ messages: Array<{
7611
+ role: string;
7612
+ content: unknown;
7613
+ }>;
7614
+ };
7615
+ /**
7616
+ * How a delegated turn ended, or that it waits on an approval (contract
7617
+ * Amendment 5). `pending_approval` is the only non-terminal status. Open:
7618
+ * a receiver treats an unknown terminal status as `failed`.
7619
+ * - `completed`: the work ran.
7620
+ * - `denied`: the visitor said no (Deny tap, or a spoken decline).
7621
+ * - `timeout`: the approval lapsed (`approvalTimeoutMs`, or the server's own timeout).
7622
+ * - `cancelled`: replaced by a newer request, or abandoned by the system.
7623
+ * - `failed`: an error.
7624
+ */
7625
+ type VoiceDelegationStatus = 'completed' | 'pending_approval' | 'denied' | 'timeout' | 'cancelled' | 'failed' | (string & {});
7626
+ /** The terminal result of a turn that parked on approvals. */
7627
+ type VoiceDelegationFollowUp = {
7628
+ status: VoiceDelegationStatus;
7629
+ /** What to read aloud (Markdown allowed). May be empty: nothing more to say. */
7630
+ text: string;
7631
+ };
7632
+ /** The delegated turn's answer, sent back for the voice model to read aloud. */
7633
+ type VoiceDelegationResult = {
7634
+ /** `pending_approval` when `followUp` is set; otherwise terminal. */
7635
+ status: VoiceDelegationStatus;
7636
+ /** The assistant text (Markdown allowed). */
7637
+ text: string;
7638
+ /**
7639
+ * Set when the turn parked on approvals (`text` then asks for the decision).
7640
+ * Resolves with the terminal result once the visitor decides (or the
7641
+ * approval is replaced, declined by voice, or unanswered for
7642
+ * `approvalTimeoutMs`) and the resumed turn finishes; `null` only when
7643
+ * `signal` aborts first (hang-up, or the server cancelled the delegation).
7644
+ */
7645
+ followUp?: (options: {
7646
+ signal: AbortSignal;
7647
+ approvalTimeoutMs?: number;
7648
+ /** `false`: run only the approval bookkeeping (expiry, supersede); nothing will be read back. @default true */
7649
+ readBack?: boolean;
7650
+ /** The resumed turn stopped on another approval: ask for it too (`text` is its approval script). */
7651
+ onUpdate?: (text: string) => void;
7652
+ }) => Promise<VoiceDelegationFollowUp | null>;
7653
+ };
7654
+ /**
7655
+ * Chat-side surface the session hands a full-duplex provider: the visible
7656
+ * history (for the call-start context) and a way to run a delegated turn
7657
+ * through the normal chat pipeline.
7658
+ */
7659
+ interface VoiceSessionBridge {
7660
+ /** Visible user/assistant messages, oldest first. */
7661
+ getHistory(): Array<{
7662
+ role: 'user' | 'assistant';
7663
+ content: string;
7664
+ }>;
7665
+ /**
7666
+ * Submit the turn as the visitor's message (reusing its transcript bubble)
7667
+ * and resolve with the assistant's final answer once the turn settles.
7668
+ * Waits for any chat turn already in flight first. Never rejects.
7669
+ */
7670
+ runDelegatedTurn(request: VoiceDelegationRequest): Promise<VoiceDelegationResult>;
7671
+ /**
7672
+ * The server dropped this delegation's result (cancelled it, or refused a
7673
+ * late result): its chat answer is no longer spoken, so browser TTS may read it.
7674
+ * `expired`: the server's deadline passed, so its pending approvals are
7675
+ * declined too, as the approval TTL would.
7676
+ */
7677
+ dropDelegation?(delegationId: string, expired?: boolean): void;
7445
7678
  }
7446
7679
  /**
7447
7680
  * Extra context for an approval decision, surfaced to `onDecision` and to the
@@ -10211,6 +10444,11 @@ type AgentWidgetToolCall = {
10211
10444
  startedAt?: number;
10212
10445
  completedAt?: number;
10213
10446
  durationMs?: number;
10447
+ /**
10448
+ * The call paused for an approval that was granted, and the agent re-ran it
10449
+ * as a new tool call: that later call carries the result, this one has none.
10450
+ */
10451
+ superseded?: boolean;
10214
10452
  };
10215
10453
  /**
10216
10454
  * Represents a tool approval request in the chat conversation.
@@ -10232,6 +10470,8 @@ type AgentWidgetApproval = {
10232
10470
  */
10233
10471
  reason?: string;
10234
10472
  parameters?: unknown;
10473
+ /** The paused tool call this approval gates (`approval_start.toolCallId`). */
10474
+ toolCallId?: string;
10235
10475
  resolvedAt?: number;
10236
10476
  };
10237
10477
  type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
@@ -10331,6 +10571,13 @@ type AgentWidgetMessage = {
10331
10571
  * }
10332
10572
  */
10333
10573
  voiceProcessing?: boolean;
10574
+ /**
10575
+ * Display-only caption of full-duplex voice speech, such as the voice
10576
+ * model's own words, or something the visitor said that wasn't submitted
10577
+ * as a chat turn. It renders in the transcript but is never sent to the
10578
+ * model as conversation.
10579
+ */
10580
+ voiceCaption?: boolean;
10334
10581
  /**
10335
10582
  * Raw structured payload for this message (e.g., JSON action response).
10336
10583
  * Populated automatically when structured parsers run.
@@ -10446,6 +10693,8 @@ type InjectMessageOptions = {
10446
10693
  * Consumers can detect this in `messageTransform` to render custom UI.
10447
10694
  */
10448
10695
  voiceProcessing?: boolean;
10696
+ /** See {@link AgentWidgetMessage.voiceCaption}. */
10697
+ voiceCaption?: boolean;
10449
10698
  /**
10450
10699
  * Raw structured payload (typically a JSON string) representing the
10451
10700
  * full directive that produced this message: e.g. `{ "text": "...",
@@ -10766,51 +11015,15 @@ type DispatchOptions = {
10766
11015
  type SSEHandler = (event: AgentWidgetEvent) => void;
10767
11016
  type SSEEventCallback = (eventType: string, payload: unknown) => void;
10768
11017
  declare class AgentWidgetClient {
11018
+ #private;
10769
11019
  private config;
10770
11020
  private historyInternals;
10771
- private readonly apiUrl;
10772
- private readonly headers;
10773
11021
  private readonly debug;
10774
- private readonly createStreamParser;
10775
- private readonly contextProviders;
10776
- private readonly requestMiddleware?;
10777
- private readonly customFetch?;
10778
- private readonly parseSSEEvent?;
10779
- private readonly getHeaders?;
10780
- private onSSEEvent?;
10781
- /**
10782
- * Turn id of the newest client-token dispatch. A dispatch whose id no longer
10783
- * matches is superseded, and every SSE frame it still receives is dropped
10784
- */
10785
- private currentClientTurnId;
10786
11022
  private clientSession;
10787
- private sessionInitPromise;
10788
- /**
10789
- * Early-init latch for `warmSession()`. `false` = armed. Otherwise it holds
10790
- * the session value (`null` or an expired session) the one early attempt was
10791
- * made against, so a failed attempt is not retried on every keystroke. It is
10792
- * re-armed when a session is installed or cleared, so each session lifetime
10793
- * gets one early init.
10794
- */
10795
- private sessionWarmLatch;
10796
11023
  private lastSentClientToolsFingerprint;
10797
11024
  private clientToolsFingerprintSessionId;
10798
- private sentNonEmptyClientToolsSessionId;
10799
- private historyUnavailable;
10800
- private historyUnavailableWarned;
10801
- private claimInFlight;
10802
- private historyIdentityStatus;
10803
- private historyIdentitySubscribers;
10804
- private historyAvailabilitySubscribers;
10805
11025
  private webMcpBridge;
10806
- private webMcpBridgePromise;
10807
- /** undefined = never set; null = explicitly cleared. Applied at adoption. */
10808
- private pendingWebMcpConfirmHandler;
10809
11026
  constructor(config?: AgentWidgetConfig, historyInternals?: WidgetHistoryInternals);
10810
- /** Load the lazy runtime chunk and construct the bridge with core-owned deps. */
10811
- private createWebMcpBridge;
10812
- /** Resolve the bridge, loading the runtime chunk on first use. */
10813
- private getWebMcpBridge;
10814
11027
  /**
10815
11028
  * Refresh config in place WITHOUT tearing down the live connection or the
10816
11029
  * WebMCP bridge. `AgentWidgetSession.updateConfig` calls this when only
@@ -10868,29 +11081,10 @@ declare class AgentWidgetClient {
10868
11081
  * Check if running in client token mode
10869
11082
  */
10870
11083
  isClientTokenMode(): boolean;
10871
- /**
10872
- * Resolve the effective backend routing for the current config. Combines the
10873
- * explicit `agentId`/`flowId` fields with the normalized `target` string
10874
- * (resolved via `resolveTarget`). Computed on demand so it stays correct
10875
- * across `update()`; the `target`/explicit-field conflict is rejected in the
10876
- * constructor, so at most one source is set here.
10877
- */
10878
- private routing;
10879
11084
  /**
10880
11085
  * Check if operating in agent execution mode
10881
11086
  */
10882
11087
  isAgentMode(): boolean;
10883
- /**
10884
- * Base URL for Runtype client-surface routes (`/v1/client/*`,
10885
- * `/v1/agents/*`). Strips a configured `/v1/dispatch` suffix so an apiUrl
10886
- * pointed at the dispatch endpoint still resolves its sibling routes. Not
10887
- * used for proxy-mode URLs, whose resume route is `${apiUrl}/resume`.
10888
- */
10889
- private clientApiBase;
10890
- /**
10891
- * Get the appropriate API URL based on mode
10892
- */
10893
- private getClientApiUrl;
10894
11088
  /**
10895
11089
  * Get the current client session (if any)
10896
11090
  */
@@ -10924,56 +11118,13 @@ declare class AgentWidgetClient {
10924
11118
  * `/v1/client/init`.
10925
11119
  */
10926
11120
  initSession(): Promise<ClientSession>;
10927
- /** Visitor history rides on client-token init only, and latches off after a 403 degrade. */
10928
- private isHistoryCapable;
10929
11121
  private readVisitorToken;
10930
- /** One-way, client-lifetime latch: chat keeps working without history. */
10931
- private markHistoryUnavailable;
10932
11122
  /** Public, secret-free view of the current identity state. */
10933
11123
  getHistoryIdentityStatus(): HistoryIdentityStatus;
10934
11124
  /** Deduped status notifications; carries no token, proof, or identity value. */
10935
11125
  subscribeHistoryIdentityStatus(callback: (status: HistoryIdentityStatus) => void): () => void;
10936
11126
  /** Fires only on the one-way 403 degrade; availability never returns. */
10937
11127
  subscribeHistoryAvailability(callback: (available: boolean) => void): () => void;
10938
- /** Config-derived state before any per-operation evidence exists. */
10939
- private restingIdentityStatus;
10940
- /** Keeps an already-observed browser_only reason; otherwise derives one. */
10941
- private browserOnlyStatus;
10942
- private derivedBrowserOnly;
10943
- /** Identical consecutive states are not re-announced. */
10944
- private setHistoryIdentityStatus;
10945
- /**
10946
- * The single uncached init primitive: builds one body, performs one fetch.
10947
- * `conversationId` and `sessionId` are mutually exclusive on the wire (strict
10948
- * server union), so a resume never carries the stored session id.
10949
- */
10950
- private createClientSession;
10951
- private _doInitSession;
10952
- /**
10953
- * An empty store means this init may mint a visitor, so it runs under the
10954
- * cross-tab first-init lock: a waiter re-reads inside the lock and joins the
10955
- * winner's visitor instead of minting a second one.
10956
- */
10957
- private ordinaryInit;
10958
- private doOrdinaryInit;
10959
- /**
10960
- * Ordinary init carrying an identity proof: binds/rebinds the visitor,
10961
- * persists any replacement token (inside `createClientSession`), and installs
10962
- * the result as the live session.
10963
- */
10964
- private reinitWithProof;
10965
- /**
10966
- * A minted visitor means the record this session just created is still
10967
- * unowned; one immediate re-init with `{visitorToken, sessionId}` claims it.
10968
- */
10969
- private claimFirstConversation;
10970
- /**
10971
- * Continuity guard + id persistence. A different record than the persisted
10972
- * one is a privacy transition, announced before the new id is written.
10973
- */
10974
- private finishInit;
10975
- /** Wrap an uncached init so nothing installs until the winner commits. */
10976
- private prepared;
10977
11128
  /**
10978
11129
  * Transactional reopen of a known conversation. Always bypasses the session
10979
11130
  * cache, never sends the stored session id, and needs a credential the server
@@ -11000,10 +11151,6 @@ declare class AgentWidgetClient {
11000
11151
  * when the conversation is reset (`WidgetSession.clearMessages`).
11001
11152
  */
11002
11153
  resetClientToolsFingerprint(): void;
11003
- /**
11004
- * Get the feedback API URL
11005
- */
11006
- private getFeedbackApiUrl;
11007
11154
  /**
11008
11155
  * Send feedback for a message (client token mode only).
11009
11156
  * Supports upvote, downvote, copy, csat, and nps feedback types.
@@ -11062,37 +11209,6 @@ declare class AgentWidgetClient {
11062
11209
  * @param comment - Optional comment
11063
11210
  */
11064
11211
  submitNPSFeedback(rating: number, comment?: string): Promise<void>;
11065
- /** `/v1/client/<path>` with a query string; credentials ride in headers. */
11066
- private historyUrl;
11067
- /** Explicit per-operation scope wins; otherwise config, then evidence. */
11068
- private resolveHistoryScope;
11069
- private resolveChatIdentityProof;
11070
- /**
11071
- * Resolve the proof for one logical request. `null` is an intentional
11072
- * browser-scope fallback only while the visitor has never been bound.
11073
- */
11074
- private resolveIdentityProof;
11075
- /** Bind the visitor before the first verified request; admitted proofs only. */
11076
- private bindIdentity;
11077
- private readErrorCode;
11078
- /**
11079
- * Selective one-shot 401 recovery. Returns the session to retry under;
11080
- * anything unrecoverable throws typed and is never retried.
11081
- */
11082
- private recoverFromUnauthorized;
11083
- private historyErrorFor;
11084
- /**
11085
- * Validate `X-History-Identity-Status` before any body is committed: the
11086
- * per-operation acknowledgement, not a prior init, is what proves scope.
11087
- */
11088
- private commitIdentityAcknowledgement;
11089
- /**
11090
- * Shared history transport: live session, `sessionId` query param,
11091
- * `X-Visitor-Token` header, one resolved proof, one-shot 401 recovery, and a
11092
- * credential-revision guard that discards a response the store outran.
11093
- */
11094
- private historyFetch;
11095
- private assertHistoryUsable;
11096
11212
  /** One page of the visitor's conversations, newest first. */
11097
11213
  listConversations(opts?: {
11098
11214
  cursor?: string;
@@ -11144,18 +11260,6 @@ declare class AgentWidgetClient {
11144
11260
  * Send a message - handles both proxy and client token modes
11145
11261
  */
11146
11262
  dispatch(options: DispatchOptions, onEvent: SSEHandler): Promise<void>;
11147
- /**
11148
- * Client token mode dispatch
11149
- */
11150
- private dispatchClientToken;
11151
- /**
11152
- * Proxy mode dispatch (original implementation)
11153
- */
11154
- private dispatchProxy;
11155
- /**
11156
- * Agent mode dispatch
11157
- */
11158
- private dispatchAgent;
11159
11263
  /**
11160
11264
  * Process an external SSE stream through the SDK's event pipeline.
11161
11265
  * This allows piping responses from endpoints like agent approval
@@ -11165,114 +11269,25 @@ declare class AgentWidgetClient {
11165
11269
  /**
11166
11270
  * Send an approval decision to the API and return the response
11167
11271
  * for streaming continuation.
11272
+ *
11273
+ * Routes by mode:
11274
+ * - **client-token mode**: POST `${apiBase}/v1/client/approve` with the
11275
+ * active `sessionId` and no Bearer key (runtypelabs/core#9518). Answers a
11276
+ * gate authored `tools.approval.approver: 'end-user'`; the SSE body has
11277
+ * the same shape as `/v1/client/resume`.
11278
+ * - **dispatch / proxy mode**: POST `${apiBase}/v1/agents/{agentId}/approve`
11279
+ * with the host's headers.
11168
11280
  */
11169
11281
  resolveApproval(approval: {
11170
11282
  agentId: string;
11171
11283
  executionId: string;
11172
11284
  approvalId: string;
11173
11285
  }, decision: 'approved' | 'denied'): Promise<Response>;
11174
- /**
11175
- * Resume a paused flow execution by supplying outputs for LOCAL
11176
- * (client-executed) tools. Used by the built-in `ask_user_question`
11177
- * answer-pill sheet, but generic enough for any LOCAL tool.
11178
- *
11179
- * Routes by mode:
11180
- * - **client-token mode**: POST `${apiBase}/v1/client/resume` (the
11181
- * session-authenticated sibling of `/v1/client/chat`; runtypelabs/core#3889),
11182
- * with the active `sessionId` in the body and no Bearer key: a browser
11183
- * client-token page holds no secret. The page's tool registry is
11184
- * re-snapshotted and sent alongside `toolOutputs` via the same diff-only
11185
- * `clientTools` / `clientToolsFingerprint` protocol as `/v1/client/chat`
11186
- * (runtypelabs/core#5361), so tools registered by a mid-run page
11187
- * navigation replace the run's dispatch-time set and become callable on
11188
- * the next model turn. Old servers strip the unknown fields and keep the
11189
- * frozen-at-dispatch behavior.
11190
- * - **dispatch / proxy mode**: POST `${apiUrl}/resume`: Runtype mounts
11191
- * resume as a child of `/v1/dispatch`, so the URL is `${apiUrl}/resume`,
11192
- * and proxies follow the same shape (`/api/chat/dispatch/resume`).
11193
- *
11194
- * Returns the raw Response so the caller can pipe its SSE body through
11195
- * `connectStream()`.
11196
- *
11197
- * @param executionId - The paused execution id carried on `await`.
11198
- * @param toolOutputs - Map keyed by per-call `toolCallId` (core#3878),
11199
- * falling back to tool name for legacy servers → the tool's result value.
11200
- */
11201
- /**
11202
- * Diff-only / send-once WebMCP clientTools transport, shared by the
11203
- * client-token chat (`/v1/client/chat`) and resume (`/v1/client/resume`)
11204
- * paths — both routes speak the same protocol (runtypelabs/core#5361).
11205
- *
11206
- * Decides, against the shared fingerprint cache, whether this request ships
11207
- * the full `clientTools[]` + fingerprint (first send under this session, or
11208
- * a changed set) or the fingerprint alone (unchanged set; the server reuses
11209
- * its stored copy). Runs `doFetch` with the chosen fields and retries
11210
- * EXACTLY once with the full array on a
11211
- * `409 { error: 'client_tools_resend_required' }` registry miss — the retry
11212
- * is 409-*triggered*, never 409-*expected*, so servers predating the
11213
- * protocol (which strip the unknown fields and never 409) work unchanged.
11214
- * The 409 body is probed on a `clone()` so the original response body stays
11215
- * readable by the caller's error handling.
11216
- *
11217
- * The cache is NOT committed here: callers invoke the returned `commit()`
11218
- * only after the server has accepted the request (response OK / stream
11219
- * started), so a failed request can never record a fingerprint the server
11220
- * never stored. A resend-required miss invalidates the cached fingerprint
11221
- * immediately so later turns keep resending in full until a clean success
11222
- * commits a fresh one.
11223
- *
11224
- * `emptyMeansReplace` (resume only): when the live snapshot is empty but a
11225
- * non-empty set was committed under this session and never explicitly
11226
- * cleared (the paused tool navigated to a page with no tool registry), ship
11227
- * an explicit `clientTools: []` so the server REPLACES the persisted
11228
- * dispatch-time set with nothing and clears its stored registry. Chat keeps
11229
- * its omit-when-empty behavior: on `/chat`, absent fields already mean "no
11230
- * tools this turn", whereas on `/resume` absence means "keep the frozen
11231
- * dispatch-time set".
11232
- */
11233
- private sendWithClientToolsDiff;
11234
11286
  resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
11235
11287
  streamResponse?: boolean;
11236
11288
  signal?: AbortSignal;
11237
11289
  after?: string;
11238
11290
  }): Promise<Response>;
11239
- /**
11240
- * The opt-in structured mention channel: the MOST RECENT user turn's
11241
- * `mentionContext` (set by `session.applyMentionBundle`) namespaced under
11242
- * `mentions`. Only the latest user message is consulted — otherwise an older
11243
- * turn's mentions would re-attach to `context.mentions` on every later send.
11244
- * Returns null when the latest user turn carried no structured mention context.
11245
- * The default model-visible path (`llmAppend`) already rode into the message's
11246
- * `llmContent`/`contentParts`, so it needs nothing here.
11247
- */
11248
- private latestMentionContext;
11249
- /**
11250
- * Aggregate request `context`: merge every context provider's result with the
11251
- * opt-in mention context from the latest user turn. Returns null when nothing
11252
- * contributed, so callers can skip setting `payload.context`. Shared by the
11253
- * agent and flow payload builders.
11254
- */
11255
- private buildContextAggregate;
11256
- /**
11257
- * Non-empty composer selections only. An empty snapshot leaves the field off
11258
- * the wire entirely, so a widget with no picker and no modes sends exactly
11259
- * what it sent before.
11260
- */
11261
- private normalizeComposerOptions;
11262
- /**
11263
- * Rule 4: an inline client-defined agent may take the turn's model from the
11264
- * composer, but only for an id the host actually declared in
11265
- * `composer.models`. Config is untouched; the mapping is per request.
11266
- */
11267
- private applyInlineAgentModel;
11268
- private buildAgentPayload;
11269
- private buildPayload;
11270
- /**
11271
- * Handle custom SSE event parsing via parseSSEEvent callback
11272
- * Returns true if event was handled, false otherwise
11273
- */
11274
- private handleCustomSSEEvent;
11275
- private streamResponse;
11276
11291
  }
11277
11292
 
11278
11293
  /** The resolved bundle gathered at submit, merged into the user message. */
@@ -11290,12 +11305,7 @@ interface MentionSubmitBundle {
11290
11305
 
11291
11306
  type ReadAloudListener = (activeId: string | null, state: ReadAloudState) => void;
11292
11307
  declare class ReadAloudController {
11293
- private resolveEngine;
11294
- private engine;
11295
- private activeId;
11296
- private state;
11297
- private listeners;
11298
- private generation;
11308
+ #private;
11299
11309
  constructor(resolveEngine: () => SpeechEngine | Promise<SpeechEngine> | null);
11300
11310
  /** Whether the active engine supports pause/resume (vs. stop-only). */
11301
11311
  get supportsPause(): boolean;
@@ -11317,7 +11327,6 @@ declare class ReadAloudController {
11317
11327
  stop(): void;
11318
11328
  /** Drop the controller and its engine (called on widget teardown). */
11319
11329
  destroy(): void;
11320
- private set;
11321
11330
  }
11322
11331
 
11323
11332
  type AgentWidgetSessionStatus = "idle" | "connecting" | "connected" | "error" | "paused" | "resuming";
@@ -11376,6 +11385,7 @@ type SessionHistoryNotice = {
11376
11385
  message: string;
11377
11386
  };
11378
11387
  declare class AgentWidgetSession {
11388
+ #private;
11379
11389
  private config;
11380
11390
  private callbacks;
11381
11391
  private historyInternals;
@@ -11384,79 +11394,16 @@ declare class AgentWidgetSession {
11384
11394
  private status;
11385
11395
  private streaming;
11386
11396
  private abortController;
11387
- private sequenceCounter;
11388
11397
  private clientSession;
11389
11398
  private agentExecution;
11390
- private resumable;
11391
- private activeAssistantMessageId;
11392
- private reconnecting;
11393
- private reconnectController;
11394
- private reconnectControllerPromise;
11395
- private executionStateTimer;
11396
11399
  private artifacts;
11397
- private selectedArtifactId;
11398
11400
  private webMcpInflightKeys;
11399
11401
  private webMcpResolvedKeys;
11400
11402
  private webMcpResolveControllers;
11401
- private webMcpEpoch;
11402
11403
  private webMcpApprovalResolvers;
11403
- private webMcpApprovalSeq;
11404
+ private approvalTokens;
11404
11405
  private webMcpAwaitBatches;
11405
- private voiceProvider;
11406
- /** In-flight setupVoice chunk load; toggleVoice awaits it when racing setup. */
11407
- private voiceSetupPromise;
11408
- /** Bumped by setupVoice/cleanupVoice so a stale chunk load can't install. */
11409
- private voiceSetupGeneration;
11410
- /** Latest 0..1 capture amplitude pushed by a provider that reports one. */
11411
- private voiceLevel;
11412
- private voiceActive;
11413
- private voiceStatus;
11414
- private activeConversationId;
11415
- private activeConversationRevision;
11416
- private historyNextMessageCursor;
11417
- /** Monotonic: a later selection supersedes every earlier fetch/prepare. */
11418
- private historyOpenEpoch;
11419
- /** Blocks `setClientSession`'s welcome branch across a reopen re-init. */
11420
- private suppressWelcomeInjection;
11421
- private historyRecovery;
11422
- private historySendBlocked;
11423
- /** Continuity wipe / boot reconciliation; dispatch waits on it. */
11424
- private historyGate;
11425
- /** Deduped by `(id, cursor)` so repeated clicks issue one request. */
11426
- private olderPageRequests;
11427
- /** Serializes projection finalization against every other operation. */
11428
- private projectionFinalizationPromise;
11429
- /** Message id → projection the server has acknowledged (sent or finalized). */
11430
- private acknowledgedProjections;
11431
- private pendingProjections;
11432
- /** Persisted revision as it stood before boot init overwrote it. */
11433
- private bootConversationRevision;
11434
- private bootRevisionCaptured;
11435
- /** Exactly one visitor-store subscription per instance; re-keyed with the store. */
11436
- private visitorStoreUnsubscribe;
11437
- private subscribedVisitorStore;
11438
- /** An external credential change happened; the next dispatch must re-init. */
11439
- private credentialReinitPending;
11440
- private credentialReinitPromise;
11441
11406
  constructor(config: AgentWidgetConfig | undefined, callbacks: SessionCallbacks, historyInternals?: WidgetHistoryInternals);
11442
- /**
11443
- * Warm the deferred voice-runtime chunk (provider factory + providers) at
11444
- * init when a voice provider is configured, so setupVoice / the first mic
11445
- * click resolve against a warm module. Module fetch only — WebSocket and
11446
- * AudioContext still wait for their own triggers. Errors are swallowed: the
11447
- * setupVoice path retries via the chunk loader's rejection-retry.
11448
- */
11449
- private prefetchVoiceRuntime;
11450
- /**
11451
- * Warm the deferred Runtype TTS engine chunk at init so it's resolved before
11452
- * the first "Read aloud" click. Module fetch only — no AudioContext (that
11453
- * still waits for the user gesture on first playback). In the IIFE/CDN build
11454
- * this fetches the standalone `runtype-tts.js`; in bundler builds the module
11455
- * is already inlined, so this is a cheap no-op. Errors are swallowed: a failed
11456
- * prefetch just means the chunk loads on first click instead (or, on a hard
11457
- * failure, the browser-voice fallback kicks in).
11458
- */
11459
- private prefetchRuntypeTts;
11460
11407
  /**
11461
11408
  * Set callback for capturing raw SSE events (forwards to client)
11462
11409
  */
@@ -11489,6 +11436,8 @@ declare class AgentWidgetSession {
11489
11436
  * Get current voice status
11490
11437
  */
11491
11438
  getVoiceStatus(): VoiceStatus;
11439
+ /** The live call's AI-disclosure notice, if it shows one. */
11440
+ getVoiceDisclosure(): string | null;
11492
11441
  /**
11493
11442
  * Get the voice interruption mode from the provider (none/cancel/barge-in)
11494
11443
  */
@@ -11508,40 +11457,27 @@ declare class AgentWidgetSession {
11508
11457
  isBargeInActive(): boolean;
11509
11458
  /** Tear down the barge-in mic pipeline: "hang up" the always-on mic */
11510
11459
  deactivateBargeIn(): Promise<void>;
11511
- private pendingVoiceUserMessageId;
11512
- private pendingVoiceAssistantMessageId;
11513
- private voiceTurns;
11514
- private voiceDisconnectPromise;
11515
11460
  private ttsSpokenMessageIds;
11516
11461
  private readAloud;
11517
- /**
11518
- * Resolve the speech engine behind read-aloud (and auto-speak):
11519
- * 1. An explicit `textToSpeech.createEngine` always wins (full BYO control).
11520
- * 2. `provider: 'runtype'` builds the hosted {@link RuntypeSpeechEngine}
11521
- * from the widget config (host = `apiUrl`, `agentId`, `clientToken`),
11522
- * wrapped in a browser {@link FallbackSpeechEngine} unless
11523
- * `browserFallback: false` — so a missing endpoint or transient failure
11524
- * degrades to the browser voice instead of erroring, and auto-upgrades to
11525
- * Runtype voices the day the endpoint ships.
11526
- * 3. Otherwise the browser Web Speech API engine.
11527
- */
11528
- private createSpeechEngine;
11529
11462
  /**
11530
11463
  * Setup voice recognition with the given configuration
11531
11464
  */
11532
11465
  setupVoice(config?: VoiceConfig): void;
11533
- /** Wire callbacks onto a freshly constructed provider and connect it. */
11534
- private wireVoiceProvider;
11535
11466
  /**
11536
11467
  * Toggle voice recognition on/off
11537
11468
  */
11538
11469
  toggleVoice(): Promise<void>;
11470
+ /**
11471
+ * Warm the voice path ahead of the mic click (`voiceRecognition.prewarm`).
11472
+ * Session-owned providers (`runtype`, `custom`) get `provider.prewarm()` once
11473
+ * the lazy voice runtime has installed them; the browser (Web Speech) path
11474
+ * warms the client-token session instead. Fire-and-forget and silent.
11475
+ */
11476
+ prewarmVoice(): void;
11539
11477
  /**
11540
11478
  * Cleanup voice resources
11541
11479
  */
11542
11480
  cleanupVoice(): void;
11543
- private disconnectVoice;
11544
- private settlePendingVoiceTurn;
11545
11481
  /**
11546
11482
  * Extract voice configuration from widget config
11547
11483
  */
@@ -11562,12 +11498,6 @@ declare class AgentWidgetSession {
11562
11498
  * Set the client session after initialization
11563
11499
  */
11564
11500
  setClientSession(session: ClientSession, pristine?: boolean): void;
11565
- /**
11566
- * Welcome injection is skipped while `suppressWelcomeInjection` is latched:
11567
- * reopening a stored conversation is not a new thread, and the hydrated
11568
- * transcript would otherwise race a welcome bubble.
11569
- */
11570
- private injectWelcomeMessage;
11571
11501
  /**
11572
11502
  * Get current client session
11573
11503
  */
@@ -11616,26 +11546,10 @@ declare class AgentWidgetSession {
11616
11546
  setHistoryInternals(internals: WidgetHistoryInternals): void;
11617
11547
  /** Widget teardown: release the visitor-store subscription. */
11618
11548
  destroy(): void;
11619
- /**
11620
- * The session always owns the continuity transition, whether or not the shell
11621
- * supplied its own observer: a credential/record break must wipe local state
11622
- * before the replacement session becomes sendable.
11623
- */
11624
- private composeHistoryInternals;
11625
- private get historyProvider();
11626
- private requireHistoryProvider;
11627
- /**
11628
- * One resolved scope per logical action. An explicitly requested scope the
11629
- * provider cannot serve fails locally rather than silently downgrading.
11630
- */
11631
- private historyContext;
11632
11549
  getHistoryState(): SessionHistoryState;
11633
11550
  getActiveConversationId(): string | null;
11634
- private emitHistoryState;
11635
- private notifyHistory;
11636
11551
  /** Pending destructive/reconciliation work every other operation waits on. */
11637
11552
  awaitHistorySettled(): Promise<void>;
11638
- private assertHistoryIdle;
11639
11553
  listConversations(opts?: {
11640
11554
  cursor?: string;
11641
11555
  limit?: number;
@@ -11660,7 +11574,6 @@ declare class AgentWidgetSession {
11660
11574
  loadOlderMessages(id: string, cursor?: string | null, opts?: {
11661
11575
  scope?: HistoryScope;
11662
11576
  }): Promise<HistoryOlderPage>;
11663
- private fetchOlderPage;
11664
11577
  /**
11665
11578
  * The canonical new-thread operation. A failed prepare leaves the current
11666
11579
  * conversation completely intact.
@@ -11668,11 +11581,6 @@ declare class AgentWidgetSession {
11668
11581
  startNewConversation(opts?: {
11669
11582
  scope?: HistoryScope;
11670
11583
  }): Promise<void>;
11671
- /**
11672
- * Clear local + persisted conversation state, then commit the replacement.
11673
- * Welcome injection is deliberately allowed once the transcript is empty.
11674
- */
11675
- private installFreshConversation;
11676
11584
  /**
11677
11585
  * Deleting the active record (or everything) is already irreversible: the
11678
11586
  * transcript is destroyed first, then a replacement session is prepared.
@@ -11699,60 +11607,12 @@ declare class AgentWidgetSession {
11699
11607
  resetHistoryDevice(): Promise<{
11700
11608
  remoteRevocationConfirmed: boolean;
11701
11609
  }>;
11702
- private recoverFromDestroyedConversation;
11703
- /**
11704
- * Never reinstalls the deleted session. A failed preparation leaves an
11705
- * explicit recoverable state instead of the old transcript.
11706
- */
11707
- private prepareReplacementConversation;
11708
- /** The next explicit action retries a failed replacement preparation. */
11709
- private retryRequiredConversation;
11710
- /**
11711
- * Install a prepared activation. The provider's commit also invokes the
11712
- * session binding (`bindActivatedSession`); the fallback covers a shell that
11713
- * has not wired that callback yet.
11714
- */
11715
- private commitActivation;
11716
11610
  /**
11717
11611
  * Session-owned binding for a winning prepared activation. Installs the
11718
11612
  * client session WITHOUT the ordinary welcome branch while the reopen latch
11719
11613
  * is set, and persists the replacement ids through the normal storage path.
11720
11614
  */
11721
11615
  bindActivatedSession(session: ClientSession): void;
11722
- private persistConversationMetadata;
11723
- /** Conversation-scoped caches that must not leak across records. */
11724
- private resetConversationScopedState;
11725
- /**
11726
- * Irreversible local + persisted clear. Used by new-conversation, active
11727
- * deletion, 410 recovery, reset, and the continuity wipe.
11728
- */
11729
- private discardConversationState;
11730
- /**
11731
- * D6 continuity wipe (session side): a replacement visitor, identity rebind,
11732
- * cross-tab convergence, or credential expiry selected a different record.
11733
- * Invalidate synchronously; dispatch stays blocked until cleanup completes.
11734
- */
11735
- private handleHistoryContinuityChanged;
11736
- /**
11737
- * One subscription per widget instance, re-keyed when the controller swaps
11738
- * the store. Owned here so the transition sits beside the continuity wipe it
11739
- * reuses.
11740
- */
11741
- private syncVisitorStoreSubscription;
11742
- /**
11743
- * D3 privacy boundary: a sibling tab cleared or replaced the shared visitor
11744
- * credential. Privacy wins over turn continuity, so a live turn is cancelled.
11745
- * A "local" change is this tab's own mint/write and owns its init path; a
11746
- * change out of an empty store is first-init convergence, not a break.
11747
- */
11748
- private handleExternalCredentialChange;
11749
- /**
11750
- * Dispatch may not proceed until a session exists under the NEW credential.
11751
- * Deliberately lazy: re-initializing on the storage event itself would hand
11752
- * an idle tab a fresh credential the visitor just deleted elsewhere.
11753
- */
11754
- private completeCredentialReinit;
11755
- private runCredentialReinit;
11756
11616
  /**
11757
11617
  * Authoritative boot reconciliation (D4). Runs after a `conversationId` boot
11758
11618
  * resume and before chat becomes sendable: an unchanged revision needs no
@@ -11762,47 +11622,11 @@ declare class AgentWidgetSession {
11762
11622
  reconcileBootConversation(opts?: {
11763
11623
  scope?: HistoryScope;
11764
11624
  }): Promise<void>;
11765
- private runBootReconciliation;
11766
- /** Runtype transport op: active session + browser scope, never a proof. */
11767
- private projectionFinalizationEnabled;
11768
- private setPendingProjections;
11769
- private readPendingProjections;
11770
- /** Record what the dispatch payload carried as each message's projection. */
11771
- private recordDispatchedProjections;
11772
- /**
11773
- * After a terminal assistant message, finalize any browser-derived projection
11774
- * the server cannot have. Painting is never delayed by this.
11775
- */
11776
- private scheduleProjectionFinalization;
11777
- /** Serialized: operations await this chain instead of racing it. */
11778
- private enqueueProjectionFinalization;
11779
- private finalizeProjections;
11780
- /** Transport-shaped failures only; a contract failure is not retried. */
11781
- private isTransientProjectionError;
11782
- private clearFinalizedMarker;
11783
11625
  /**
11784
11626
  * Boot replay: rebuild the batch from the persisted ids plus the local
11785
11627
  * message content, then finalize before display reconciliation completes.
11786
11628
  */
11787
11629
  replayPendingProjections(): Promise<void>;
11788
- /**
11789
- * A local transcript mutation whose response carries no new revision: clear
11790
- * the persisted one rather than guessing, so the next boot refreshes safely.
11791
- */
11792
- private invalidateConversationRevision;
11793
- /** Blocks a send until the owning history transition finishes. */
11794
- private awaitHistorySendable;
11795
- private static isConversationDeleted;
11796
- /**
11797
- * Safe 410 recovery (D5). The old payload would recreate the transcript that
11798
- * was just deleted, so the retry carries ONLY the just-submitted user turn.
11799
- */
11800
- private dispatchWithDeletedRecovery;
11801
- /**
11802
- * Capture only the newly submitted user message, destroy the deleted record's
11803
- * local state, and initialize a fresh owned conversation to retry into.
11804
- */
11805
- private recoverFromDeletedConversation;
11806
11630
  updateConfig(next: AgentWidgetConfig): void;
11807
11631
  getMessages(): AgentWidgetMessage[];
11808
11632
  getStatus(): AgentWidgetSessionStatus;
@@ -11899,15 +11723,6 @@ declare class AgentWidgetSession {
11899
11723
  * });
11900
11724
  */
11901
11725
  injectComponentDirective(options: InjectComponentDirectiveOptions): AgentWidgetMessage;
11902
- /**
11903
- * Resolve the gathered mentions and merge them into the user message's
11904
- * model-visible content. Default path is `llmAppend` → `llmContent` (or a text
11905
- * `contentPart` when parts are present, since `contentParts` wins the priority
11906
- * chain); the opt-in structured `context` lands on `mentionContext` for the
11907
- * client to namespace into the request `context`. Failures were already
11908
- * dropped by `finalize()`.
11909
- */
11910
- private applyMentionBundle;
11911
11726
  sendMessage(rawInput: string, options?: {
11912
11727
  viaVoice?: boolean;
11913
11728
  /** Multi-modal content parts (e.g., images) to include with the message */
@@ -11952,6 +11767,15 @@ declare class AgentWidgetSession {
11952
11767
  * (`composer.streamingSubmitBehavior: "interrupt"`).
11953
11768
  */
11954
11769
  interrupt?: boolean;
11770
+ /**
11771
+ * Internal (voice client delegation): this is the delegated voice turn.
11772
+ * `userMessageId` names an existing transcript bubble to submit as the
11773
+ * turn's user message instead of appending a new one, so the spoken
11774
+ * request appears (and is sent) exactly once.
11775
+ */
11776
+ voiceTurn?: {
11777
+ userMessageId?: string;
11778
+ };
11955
11779
  }): Promise<void>;
11956
11780
  /**
11957
11781
  * Re-run the conversation from one user turn (docs/composer-gap-analysis.md
@@ -11975,8 +11799,6 @@ declare class AgentWidgetSession {
11975
11799
  * turn would carry no content; nothing is truncated in that case.
11976
11800
  */
11977
11801
  resubmitFrom(messageId: string, options: ComposerResubmitOptions): boolean;
11978
- /** Submission options → the wire payload shape; quote travels separately. */
11979
- private toComposerOptionsPayload;
11980
11802
  /**
11981
11803
  * Continue the conversation without adding a new user message.
11982
11804
  * Triggers the model to respond based on the current conversation state.
@@ -12011,13 +11833,6 @@ declare class AgentWidgetSession {
12011
11833
  */
12012
11834
  seedContent?: string;
12013
11835
  }): Promise<void>;
12014
- /**
12015
- * Install the native approval-bubble confirm handler on the WebMCP bridge
12016
- * when the integrator hasn't supplied a custom `webmcp.onConfirm`. Without
12017
- * this, the bridge falls back to a blunt `window.confirm`. Safe to call
12018
- * repeatedly (e.g. after the client is re-created in `updateConfig`).
12019
- */
12020
- private wireDefaultWebMcpConfirm;
12021
11836
  /**
12022
11837
  * Default WebMCP confirm gate: render Persona's native in-panel approval
12023
11838
  * bubble and resolve when the user clicks Approve/Deny. Returns immediately
@@ -12051,6 +11866,14 @@ declare class AgentWidgetSession {
12051
11866
  * 3. Append a user-visible bubble with the answer text so the
12052
11867
  * transcript reads naturally.
12053
11868
  */
11869
+ resolveAskUserQuestion(toolMessage: AgentWidgetMessage, answer: string | Record<string, string | string[]>): Promise<void>;
11870
+ /**
11871
+ * Resolve a paused auto-resolving LOCAL tool call (`webmcp:*` page tools
11872
+ * and the built-in `suggest_replies`) and post the result to `/resume`.
11873
+ * Triggered automatically from `handleEvent`; idempotent on the message's
11874
+ * `toolCall.id`. See `resolveWebMcpToolCall` in `session-actions.ts`.
11875
+ */
11876
+ resolveWebMcpToolCall(toolMessage: AgentWidgetMessage): Promise<void>;
12054
11877
  /**
12055
11878
  * Persist in-progress answers and the current page index for a multi-question
12056
11879
  * `ask_user_question` payload, so a refresh resumes on the same page with
@@ -12069,123 +11892,6 @@ declare class AgentWidgetSession {
12069
11892
  * answers via top-level merge.
12070
11893
  */
12071
11894
  markAskUserQuestionResolved(toolMessage: AgentWidgetMessage, answers?: Record<string, string | string[]>): void;
12072
- resolveAskUserQuestion(toolMessage: AgentWidgetMessage, answer: string | Record<string, string | string[]>): Promise<void>;
12073
- /**
12074
- * Collect an auto-resolving LOCAL-tool `await` (`webmcp:*` page tools
12075
- * and the built-in `suggest_replies`) into a per-executionId batch
12076
- * and schedule a single deferred flush. Parallel calls (core#3878) emit
12077
- * several `await`s for ONE paused execution within the same stream tick;
12078
- * buffering them and flushing once lets us post ONE `/resume` keyed by the
12079
- * per-call `webMcpToolCallId` rather than racing N name-keyed resumes on the
12080
- * same execution (which 404'd on the second and hung the turn).
12081
- *
12082
- * Deferred via `queueMicrotask` (epoch-guarded) for the same reason the old
12083
- * direct resolve was: handleEvent must return first so the dispatch's
12084
- * `connectStream` sees end-of-stream and releases the shared abortController
12085
- * before a resolve grabs it.
12086
- *
12087
- * Awaits without an `executionId` or `toolCall.id` can't be batched (no key)
12088
- *: route them straight to the single-call path, which surfaces the malformed
12089
- * wire shape via `onError` / an `isError` resume.
12090
- */
12091
- private enqueueWebMcpAwait;
12092
- /**
12093
- * Flush every buffered local-tool await batch, one `/resume` per executionId.
12094
- * Called once a stream ends (`status: idle` / `error`): by then all parallel
12095
- * `await`s the stream carried have been collected, even if split across
12096
- * SSE chunks. Deferred via `queueMicrotask` (epoch-guarded) so the idle
12097
- * handler returns first and the stream's end-of-stream teardown (streaming /
12098
- * abortController) settles before a resolve grabs them: the same ordering the
12099
- * single-call resolve always relied on.
12100
- */
12101
- private scheduleWebMcpBatchFlush;
12102
- /**
12103
- * Run a buffered batch of local-tool awaits for one executionId. Size 1
12104
- * (single call, or distinct-tool turns that happened to arrive alone) takes
12105
- * the original single-call path; size >1 (parallel calls) takes the batched
12106
- * path that posts ONE `/resume`. The batch is removed from the map up front
12107
- * so any later sibling re-emit (e.g. from a re-pause) forms a fresh batch
12108
- * rather than mutating one already in flight.
12109
- */
12110
- private flushWebMcpAwaitBatch;
12111
- private resolveWebMcpToolStartedAt;
12112
- /**
12113
- * Persisted-resolution guard for `suggest_replies`. The in-memory dedupe
12114
- * sets (`webMcpInflightKeys` / `webMcpResolvedKeys`) are cleared by
12115
- * hydrateMessages/clearMessages/cancel, but `suggestRepliesResolved`
12116
- * survives on the stored message, so a stale `await` re-emit after a
12117
- * hydration must not re-POST `/resume` for an already-resolved call (the
12118
- * historical double-resume failure mode the batching work exists to avoid).
12119
- * Checks the LIVE message first; the handleEvent snapshot is a fresh wire
12120
- * skeleton whose metadata never carries the flag.
12121
- */
12122
- private isSuggestRepliesAlreadyResolved;
12123
- private markWebMcpToolRunning;
12124
- private markWebMcpToolComplete;
12125
- /**
12126
- * Resolve one or more parallel local-tool awaits sharing one paused
12127
- * executionId with a SINGLE `/resume` (core#3878); `resolveWebMcpToolCall`
12128
- * delegates size-1 resolves here after its guards. By default each call is
12129
- * executed against the page registry concurrently: every gated call renders
12130
- * its own native approval bubble, and a sibling's confirm Promise never
12131
- * blocks another's execution. With `webmcp.execution: "sequential"` the
12132
- * calls run one at a time in emission order instead (see the config docs
12133
- * for when that matters). Outputs are keyed by per-call `webMcpToolCallId`
12134
- * (server prefers it over tool name; name-keying remains the fallback for
12135
- * legacy single/distinct-tool turns), so two calls to the SAME tool no longer
12136
- * collide. The server is tolerant: any call we omit (declined-after-abort,
12137
- * dedupe, exec failure) simply re-pauses and is retried on its re-emit.
12138
- *
12139
- * Owns the dedupe / abort / streaming machinery for both routes; resolved
12140
- * keys are marked on the shared resume POST's HTTP OK.
12141
- */
12142
- private resolveWebMcpToolCallBatch;
12143
- /**
12144
- * Resolve a paused auto-resolving LOCAL tool call and post the result to
12145
- * `/resume`: `webmcp:*` calls execute against the host page's tool
12146
- * registry; the built-in `suggest_replies` skips execution entirely and
12147
- * resumes with a canned "shown" result (the chips render from the message
12148
- * list, not from this resolve).
12149
- *
12150
- * Triggered automatically from `handleEvent` when an `await`-derived
12151
- * message arrives for such a tool: the user does not click a pill; the
12152
- * bridge's confirm-bubble gate (WebMCP only) is the only interactive
12153
- * surface.
12154
- *
12155
- * Idempotent on the message's `toolCall.id`: re-emits of the same await
12156
- * (e.g. from message coalescing) won't double-fire `tool.execute`. Failure
12157
- * modes, declined, timed out, throw, unknown tool, all resolve into a
12158
- * `{ isError: true, content: [...] }` payload that resumes the dispatch
12159
- * cleanly so the agent can recover.
12160
- *
12161
- * After the malformed-wire guards this is a thin gate over
12162
- * `resolveWebMcpToolCallBatch` with a size-1 batch: the dedupe check runs
12163
- * synchronously here so a stale re-emit never toggles streaming.
12164
- */
12165
- resolveWebMcpToolCall(toolMessage: AgentWidgetMessage): Promise<void>;
12166
- /**
12167
- * POST `/resume` with a SINGLE tool's output and pipe the resulting SSE
12168
- * stream back through `connectStream`. Shared by every single-call local-tool
12169
- * resolve path (ask_user_question and single WebMCP calls). Parallel WebMCP
12170
- * calls use `resolveWebMcpToolCallBatch`, which posts one resume for many.
12171
- *
12172
- * `resumeKey` is the `toolOutputs` map key: the per-call `webMcpToolCallId`
12173
- * for WebMCP (core#3878), or the tool name for ask_user_question / legacy
12174
- * servers. `onHttpOk` runs synchronously between the HTTP-status check and the
12175
- * stream pipe; it lets the WebMCP resolve path commit the dedupe flag at
12176
- * "server accepted the answer" rather than "stream finished cleanly".
12177
- */
12178
- private resumeWithToolOutput;
12179
- /**
12180
- * Tear down every in-flight WebMCP resolve and advance the epoch. Each
12181
- * resolve owns a dedicated AbortController (chained/parallel resolves don't
12182
- * share one), so we abort them individually; the aborts propagate into the
12183
- * bridge's execute race and into each `/resume` fetch signal. Bumping
12184
- * `webMcpEpoch` strands any resolve still deferred in a queued microtask: * it captured the prior epoch and bails before installing a fresh
12185
- * controller, so it can't escape this teardown. Called from every stop /
12186
- * new-turn boundary (cancel, clearMessages, hydrateMessages, sendMessage).
12187
- */
12188
- private abortWebMcpResolves;
12189
11895
  cancel(): void;
12190
11896
  clearMessages(): void;
12191
11897
  getArtifacts(): PersonaArtifactRecord[];
@@ -12194,68 +11900,9 @@ declare class AgentWidgetSession {
12194
11900
  selectArtifact(id: string | null): void;
12195
11901
  clearArtifacts(): void;
12196
11902
  upsertArtifact(manual: PersonaArtifactManualUpsert): PersonaArtifactRecord;
12197
- /**
12198
- * Injects (or refreshes) the in-thread artifact block for a programmatically
12199
- * upserted artifact, matching the streamed UX: the resolved display mode
12200
- * picks the component ("collapsed"/"panel" → reference card, "inline" → inline
12201
- * preview).
12202
- *
12203
- * Unlike the streamed path (which embeds content on `artifact_complete`),
12204
- * the programmatic record is complete up front, so the final markdown /
12205
- * file meta / component name + props are embedded immediately and the block
12206
- * hydrates after a refresh without the original registry state.
12207
- *
12208
- * A re-upsert of the same id rebuilds the existing block's persisted
12209
- * rawContent in place (the registry is not persisted, so hydration reads
12210
- * these props); without this the block would keep the first version's
12211
- * content after a refresh.
12212
- */
12213
- private injectArtifactRefBlock;
12214
- /**
12215
- * Re-materialize existing transcript artifact blocks after a live display
12216
- * preference update. One messages callback keeps conversion atomic.
12217
- */
12218
- private refreshArtifactReferenceBlocks;
12219
- private clearArtifactState;
12220
- private emitArtifactsState;
12221
- private applyArtifactStreamEvent;
12222
11903
  hydrateMessages(messages: AgentWidgetMessage[]): void;
12223
11904
  hydrateArtifacts(artifacts: PersonaArtifactRecord[], selectedId?: string | null): void;
12224
11905
  private handleEvent;
12225
- /**
12226
- * Record the latest SSE `id:` cursor and (lazily) form/advance the resume
12227
- * handle. Needs an executionId (lifted into `agentExecution` from the same
12228
- * frame's metadata, handled before this trailing cursor event) and the active
12229
- * assistant message id.
12230
- */
12231
- private trackCursor;
12232
- /**
12233
- * The drop gate: is this stream-end a dropped connection we should reconnect,
12234
- * rather than a graceful finish or an intentional `await` pause? ALL must
12235
- * hold (see plan §Design overview keystone 3).
12236
- */
12237
- private isDurableDrop;
12238
- /**
12239
- * True when the run is parked awaiting user input (an unanswered
12240
- * `ask_user_question` / local-tool await, or a pending approval). Those end
12241
- * the stream with `idle` and no terminal too, but are NOT drops.
12242
- */
12243
- private isAwaitPending;
12244
- /**
12245
- * Enter the reconnect flow. Keeps the assistant bubble open and `streaming`
12246
- * true, flips to `resuming`, and kicks the bounded backoff loop. Re-entrant
12247
- * calls (a second drop while reconnecting) are no-ops.
12248
- */
12249
- private beginReconnect;
12250
- /**
12251
- * Lazily import and instantiate the reconnect controller. Cached so repeated
12252
- * reconnects reuse one controller (and one module load). Deliberately kept off
12253
- * every hot path (`sendMessage` / `cancel` / `teardownReconnect`) so a widget
12254
- * that never reconnects never pulls the chunk.
12255
- */
12256
- private loadReconnectController;
12257
- /** The narrow surface the lazily-loaded reconnect loop drives. */
12258
- private buildReconnectHost;
12259
11906
  /** Public manual retry (e.g. a "Reconnect" button). */
12260
11907
  reconnectNow(): void;
12261
11908
  /**
@@ -12267,34 +11914,13 @@ declare class AgentWidgetSession {
12267
11914
  executionId: string;
12268
11915
  after: string;
12269
11916
  }): void;
12270
- /**
12271
- * Reopen the trailing assistant bubble (the persisted partial) so replayed
12272
- * deltas append to it. Returns its id, or null if the last turn doesn't end
12273
- * in a plain assistant message.
12274
- */
12275
- private reopenTrailingAssistant;
12276
- /**
12277
- * Tear down any in-flight/pending reconnect and clear the resume handle. Runs
12278
- * on every new turn / cancel / hydrate, so it must NOT pull the reconnect
12279
- * chunk: it only delegates to the controller if one was already created.
12280
- */
12281
- private teardownReconnect;
12282
- /** Drop the resume handle and notify the host (`onExecutionState(null)`). */
12283
- private clearResumable;
12284
- /**
12285
- * Surface the resume handle to the host for persistence. Immediate on
12286
- * create/clear; trailing-edge throttled on cursor advances so it isn't called
12287
- * per delta.
12288
- */
12289
- private notifyExecutionState;
12290
11917
  /** The current durable resume handle, if any (read-only). */
12291
11918
  getResumableHandle(): ResumableHandle | null;
12292
- private setStatus;
12293
- private setStreaming;
12294
11919
  /**
12295
11920
  * Speak the latest assistant message using the Web Speech API
12296
11921
  * if text-to-speech is enabled in the config.
12297
11922
  */
11923
+ /** `only`: speak it only if the latest assistant message is one of these. */
12298
11924
  private speakLatestAssistantMessage;
12299
11925
  /**
12300
11926
  * Pick the best available English voice from a list of SpeechSynthesisVoices.
@@ -12318,11 +11944,7 @@ declare class AgentWidgetSession {
12318
11944
  * Stop any in-progress text-to-speech / read-aloud playback.
12319
11945
  */
12320
11946
  stopSpeaking(): void;
12321
- private appendMessage;
12322
11947
  private upsertMessage;
12323
- private ensureSequence;
12324
- private nextSequence;
12325
- private sortMessages;
12326
11948
  }
12327
11949
 
12328
11950
  type LoadingIndicatorRenderer = (context: LoadingIndicatorRenderContext) => HTMLElement | null;
@@ -13582,16 +13204,10 @@ interface AttachmentManagerConfig {
13582
13204
  * Creates and manages attachments for the composer
13583
13205
  */
13584
13206
  declare class AttachmentManager {
13207
+ #private;
13585
13208
  private attachments;
13586
13209
  private config;
13587
- private previewsContainer;
13588
- /** In-flight `adapter.add` per attachment id; aborted on remove/clear/destroy. */
13589
- private pendingAdds;
13590
- private destroyed;
13591
13210
  constructor(config?: AttachmentManagerConfig);
13592
- /** True when the host supplied an adapter (tiles then show upload state). */
13593
- private hasCustomAdapter;
13594
- private adapter;
13595
13211
  /**
13596
13212
  * Set the previews container element
13597
13213
  */
@@ -13633,22 +13249,13 @@ declare class AttachmentManager {
13633
13249
  * Handle an array of files (e.g., clipboard image paste)
13634
13250
  */
13635
13251
  handleFiles(files: readonly File[]): Promise<void>;
13636
- /**
13637
- * Run `adapter.add` for one attachment and reconcile the result. Late
13638
- * completions from an aborted or removed attachment write no state and log
13639
- * nothing: the user already moved on.
13640
- */
13641
- private runAdd;
13642
13252
  /** Retry a failed attachment from its error tile. */
13643
13253
  retryAttachment(id: string): void;
13644
- /** Abort an in-flight add without touching the attachment's own state. */
13645
- private abortAdd;
13646
13254
  /**
13647
13255
  * Remove an attachment by ID. Aborts an in-flight upload, and hands a
13648
13256
  * completed one back to the adapter so remote storage can be released.
13649
13257
  */
13650
13258
  removeAttachment(id: string): void;
13651
- private releasePart;
13652
13259
  /**
13653
13260
  * Clear all attachments and abort anything in flight. This is also the
13654
13261
  * post-send path, so it never calls `adapter.remove`: the parts it drops
@@ -13657,18 +13264,6 @@ declare class AttachmentManager {
13657
13264
  clearAttachments(): void;
13658
13265
  /** Abort every in-flight upload and stop accepting new work. */
13659
13266
  destroy(): void;
13660
- private notify;
13661
- /**
13662
- * Render a preview for an attachment (image thumbnail or file icon)
13663
- */
13664
- private renderPreview;
13665
- /** Repaint only the status layer of a live tile; the thumbnail is untouched. */
13666
- private updatePreview;
13667
- private applyPreviewState;
13668
- /**
13669
- * Update the visibility of the previews container
13670
- */
13671
- private updatePreviewsVisibility;
13672
13267
  /**
13673
13268
  * Create an AttachmentManager from widget config
13674
13269
  */
@@ -13712,7 +13307,7 @@ declare const resolveDockConfig: (config?: AgentWidgetConfig) => Required<AgentW
13712
13307
  declare const VERSION: string;
13713
13308
 
13714
13309
  declare class PluginRegistry {
13715
- private plugins;
13310
+ #private;
13716
13311
  /**
13717
13312
  * Register a plugin
13718
13313
  */
@@ -14300,8 +13895,8 @@ interface ComponentRegistrationOptions {
14300
13895
  * Component registry for managing custom components
14301
13896
  */
14302
13897
  declare class ComponentRegistry {
13898
+ #private;
14303
13899
  private components;
14304
- private options;
14305
13900
  /**
14306
13901
  * Register a custom component
14307
13902
  */
@@ -14870,20 +14465,8 @@ interface WebMcpBridgeDeps {
14870
14465
  loadPolyfill: () => Promise<WebMcpPolyfillModule>;
14871
14466
  }
14872
14467
  declare class WebMcpBridge$1 {
14468
+ #private;
14873
14469
  private readonly config;
14874
- private readonly deps;
14875
- private confirmHandler;
14876
- private readonly timeoutMs;
14877
- /** `true` once the polyfill has been (idempotently) installed. */
14878
- private installed;
14879
- /** Memoizes the one-shot async install so concurrent callers share it. */
14880
- private readyPromise;
14881
- /**
14882
- * Warn-once latch for a present-but-incompatible `document.modelContext`
14883
- * (some other / older WebMCP polyfill squatting the global). `getModelContext`
14884
- * is hit on every snapshot + execute, so we log the diagnostic only once.
14885
- */
14886
- private incompatibleContextWarned;
14887
14470
  constructor(config: AgentWidgetWebMcpConfig, deps: WebMcpBridgeDeps);
14888
14471
  /**
14889
14472
  * Override the confirm handler post-construction. Used by `ui.ts` to wire
@@ -14931,26 +14514,6 @@ declare class WebMcpBridge$1 {
14931
14514
  * from firing a host-page side effect with no matching `/resume`.
14932
14515
  */
14933
14516
  executeToolCall(wireToolName: string, args: unknown, signal?: AbortSignal): Promise<WebMcpToolResult>;
14934
- /**
14935
- * Lazily install `@mcp-b/webmcp-polyfill` the first time the bridge needs the
14936
- * registry. Idempotent and memoized. Dynamic import keeps the polyfill out of
14937
- * the main bundle and prevents it from installing `document.modelContext` for
14938
- * widget consumers that never enable WebMCP.
14939
- *
14940
- * Producer pages should still install the polyfill themselves (or import it)
14941
- * before registering tools: Persona's install is a fallback, and a page that
14942
- * registers tools at load before Persona's first dispatch needs the global to
14943
- * already exist.
14944
- */
14945
- private ensureReady;
14946
- private install;
14947
- /**
14948
- * Read the consumer surface off `document.modelContext`, returning `null`
14949
- * when it is absent or doesn't expose the producer-preview API we rely on.
14950
- */
14951
- private getModelContext;
14952
- private requestConfirm;
14953
- private passesClientAllowlist;
14954
14517
  }
14955
14518
 
14956
14519
  /**
@@ -14992,4 +14555,4 @@ interface RovingTablistController {
14992
14555
  }
14993
14556
  declare function createRovingTablist(container: HTMLElement, options: RovingTablistOptions): RovingTablistController;
14994
14557
 
14995
- export { ASK_USER_QUESTION_CLIENT_TOOL, ASK_USER_QUESTION_PARAMETERS_SCHEMA, 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 AgentWidgetAttachmentAdapter, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComponentRenderer, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetConfigPatch, type AgentWidgetContextMentionChipRenderContext, type AgentWidgetContextMentionCommandContext, type AgentWidgetContextMentionComposerCapability, type AgentWidgetContextMentionConfig, type AgentWidgetContextMentionItem, type AgentWidgetContextMentionItemRenderContext, type AgentWidgetContextMentionMenuRenderContext, type AgentWidgetContextMentionPayload, type AgentWidgetContextMentionRef, type AgentWidgetContextMentionResolveContext, type AgentWidgetContextMentionSearchContext, type AgentWidgetContextMentionSource, type AgentWidgetContextMentionTokenRenderContext, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetCustomMessageAction, type AgentWidgetCustomMessageActionRole, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetFollowUpSuggestionsConfig, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetHistoryCopy, type AgentWidgetHistoryFeature, type AgentWidgetHistoryListAction, type AgentWidgetHistoryRenderActions, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLauncherTeaserConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMentionLlmEntry, type AgentWidgetMentionTriggerChannel, type AgentWidgetMentionTriggerPosition, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetMessageRoleLayout, type AgentWidgetParsedAction, type AgentWidgetPlugin, type AgentWidgetPluginStorage, type AgentWidgetRailSection, type AgentWidgetRailSectionContext, type AgentWidgetReadAloudEvent, type AgentWidgetRenderHistoryConversationContext, type AgentWidgetRenderHistoryHeaderContext, type AgentWidgetRenderHistoryOpenErrorContext, type AgentWidgetRenderHistoryStateContext, type AgentWidgetRenderHistoryViewContext, type AgentWidgetRenderSuggestionContext, type AgentWidgetRenderWelcomeContext, type AgentWidgetRequestPayload, type AgentWidgetResolvedSuggestion, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, type AgentWidgetScrollBehaviorFeature, type AgentWidgetScrollMode, type AgentWidgetScrollRestorePosition, type AgentWidgetScrollToBottomFeature, AgentWidgetSession, type AgentWidgetSessionInitHook, type AgentWidgetSessionInitTrigger, type AgentWidgetSessionStatus, type AgentWidgetStarterSuggestionsConfig, type AgentWidgetStorageAdapter, type AgentWidgetStoredDraft, type AgentWidgetStoredState, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetSuggestion, type AgentWidgetSuggestionBehavior, type AgentWidgetSuggestionChipsConfig, type AgentWidgetSuggestionSelectContext, type AgentWidgetSuggestionSource, type AgentWidgetSuggestionSurface, type AgentWidgetSuggestionSurfaceConfig, type AgentWidgetSuggestionVariant, type AgentWidgetSuggestionsConfig, type AgentWidgetTimestampConfig, type AgentWidgetTooltipConfig, type AgentWidgetTransformSuggestionsContext, type AgentWidgetVoiceStatusEvent, type AgentWidgetWebMcpConfig, type AgentWidgetWelcomeAlign, type AgentWidgetWelcomeConfig, type AgentWidgetWelcomeDismiss, type AgentWidgetWelcomeIcon, type AgentWidgetWelcomeIconBase, type AgentWidgetWelcomeIconPlacement, type AgentWidgetWelcomeVariant, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type AttachmentUploadContext, type BorderScale, BrowserSpeechEngine, type BrowserSpeechEngineOptions, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type ClientToolDefinition, type ClientVisitorGrant, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRegistrationOptions, type ComponentRenderer, type ComponentTokens, type ComposerAction, type ComposerActionBase, type ComposerActionContext, type ComposerActionContributionContext, type ComposerActionOverflowConfig, type ComposerActionPlacement, type ComposerActionPresentation, type ComposerActionRenderContext, type ComposerActionVisibility, type ComposerAttachmentState, type ComposerBeforeSendResult, type ComposerBuildContext, type ComposerButtonAction, type ComposerCustomAction, type ComposerDisabledOption, type ComposerElements, type ComposerInputAttributes, type ComposerLayout, type ComposerMode, type ComposerModeChipVisibility, type ComposerModeGroup, type ComposerModeGroupPresentation, type ComposerModel, type ComposerModelPickerConfig, type ComposerModelPickerPresentation, type ComposerPhase, type ComposerQuote, type ComposerResubmitOptions, type ComposerState, type ComposerStreamingSubmitBehavior, type ComposerSubmissionOptions, type ComposerSubmissionSnapshot, type ComposerSubmitKey, 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 FallbackSpeechEngineOptions, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type HistoryConversationDetail, type HistoryConversationPage, type HistoryConversationPatch, type HistoryConversationSummary, type HistoryDeleteAllOptions, type HistoryDisplayProjection, type HistoryIdentityStatus, type HistoryListOptions, type HistoryListResult, type HistoryOperationContext, type HistoryPageOptions, type HistoryPageResult, type HistoryPendingAction, type HistoryProvider, HistoryProviderError, type HistoryProviderErrorCode, type HistoryReturnSurface, type HistoryScope, type HistoryViewState, 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 MarkdownParsersModule, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PcmStreamPlayer, type PendingAttachment, type PersonaArtifactActionContext, type PersonaArtifactCustomAction, type PersonaArtifactDisplayDescriptor, type PersonaArtifactDisplayMatch, type PersonaArtifactDisplayMode, type PersonaArtifactDisplayModeInput, type PersonaArtifactDisplayResolution, type PersonaArtifactDisplayRules, type PersonaArtifactFilesDisplayRules, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactPresentation, type PersonaArtifactRecord, type PersonaArtifactStatusLabelContext, type PersonaTheme, type PersonaThemePlugin, type PreparedClientSession, type PreparedHistoryActivation, type RadiusScale, ReadAloudController, type ReadAloudListener, type ReadAloudState, type ResolvedHistoryCopy, type ResolvedHistoryPresentation, type ResolvedTarget, type ResolvedWelcomeConfig, type RovingTablistController, type RovingTablistOptions, type RuleScoringContext, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeExecutionStreamEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, type RuntypeTurnCompleteEvent, type SSEEventCallback, type SSEEventRecord, SUGGEST_REPLIES_CLIENT_TOOL, SUGGEST_REPLIES_PARAMETERS_SCHEMA, SUGGEST_REPLIES_TOOL_NAME, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlashCommandDefinition, type SlotRenderContext, type SlotRenderer, type SpacingScale, type SpeechCallbacks, type SpeechEngine, type SpeechRequest, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TargetResolver, type TextContentPart, type TextStyleTokens, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceMetrics, type VoicePlaybackEngine, type VoiceProvider, type VoiceResult, type VoiceStatus, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, type WidgetArtifactLayoutPreference, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreferenceCapabilities, type WidgetPreferenceParseIssue, type WidgetPreferenceParseIssueCode, type WidgetPreferenceParseResult, type WidgetPreferenceSlice, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyFeaturePreferences, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, builtInClientToolsForDispatch, canonicalArtifactDisplayMode, 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, createRovingTablist, createSlashCommandsSource, createSplitButton, createStandardBubble, createStaticMentionSource, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultMentionFilter, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getAgentWidgetHandles, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isHistoryProviderError, isSuggestRepliesMessage, isVoiceSupported, isWebMcpToolName, isWelcomeVisible, latestAgentSuggestions, listRegisteredStreamAnimations, loadMarkdownParsers, markdownPostprocessor, mergeWithDefaults, normalizeContent, normalizeMediaType, onMarkdownParsersReady, parseAskUserQuestionPayload, parseSuggestRepliesPayload, parseWidgetPreferenceSlice, pickBestVoice, pluginRegistry, reducedMotionPlugin, registerIcons, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveArtifactDisplay, resolveArtifactDisplayMode, resolveConfigPreferences, resolveDockConfig, resolveSanitizer, resolveTokens, resolveWelcomeConfig, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
14558
+ export { ASK_USER_QUESTION_CLIENT_TOOL, ASK_USER_QUESTION_PARAMETERS_SCHEMA, 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 AgentWidgetAttachmentAdapter, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComponentRenderer, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetConfigPatch, type AgentWidgetContextMentionChipRenderContext, type AgentWidgetContextMentionCommandContext, type AgentWidgetContextMentionComposerCapability, type AgentWidgetContextMentionConfig, type AgentWidgetContextMentionItem, type AgentWidgetContextMentionItemRenderContext, type AgentWidgetContextMentionMenuRenderContext, type AgentWidgetContextMentionPayload, type AgentWidgetContextMentionRef, type AgentWidgetContextMentionResolveContext, type AgentWidgetContextMentionSearchContext, type AgentWidgetContextMentionSource, type AgentWidgetContextMentionTokenRenderContext, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetCustomMessageAction, type AgentWidgetCustomMessageActionRole, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetFollowUpSuggestionsConfig, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetHistoryCopy, type AgentWidgetHistoryFeature, type AgentWidgetHistoryListAction, type AgentWidgetHistoryRenderActions, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLauncherTeaserConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMentionLlmEntry, type AgentWidgetMentionTriggerChannel, type AgentWidgetMentionTriggerPosition, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetMessageRoleLayout, type AgentWidgetParsedAction, type AgentWidgetPlugin, type AgentWidgetPluginStorage, type AgentWidgetRailSection, type AgentWidgetRailSectionContext, type AgentWidgetReadAloudEvent, type AgentWidgetRenderHistoryConversationContext, type AgentWidgetRenderHistoryHeaderContext, type AgentWidgetRenderHistoryOpenErrorContext, type AgentWidgetRenderHistoryStateContext, type AgentWidgetRenderHistoryViewContext, type AgentWidgetRenderSuggestionContext, type AgentWidgetRenderWelcomeContext, type AgentWidgetRequestPayload, type AgentWidgetResolvedSuggestion, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, type AgentWidgetScrollBehaviorFeature, type AgentWidgetScrollMode, type AgentWidgetScrollRestorePosition, type AgentWidgetScrollToBottomFeature, AgentWidgetSession, type AgentWidgetSessionInitHook, type AgentWidgetSessionInitTrigger, type AgentWidgetSessionStatus, type AgentWidgetStarterSuggestionsConfig, type AgentWidgetStorageAdapter, type AgentWidgetStoredDraft, type AgentWidgetStoredState, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetSuggestion, type AgentWidgetSuggestionBehavior, type AgentWidgetSuggestionChipsConfig, type AgentWidgetSuggestionSelectContext, type AgentWidgetSuggestionSource, type AgentWidgetSuggestionSurface, type AgentWidgetSuggestionSurfaceConfig, type AgentWidgetSuggestionVariant, type AgentWidgetSuggestionsConfig, type AgentWidgetTimestampConfig, type AgentWidgetTooltipConfig, type AgentWidgetTransformSuggestionsContext, type AgentWidgetVoicePrewarmHook, type AgentWidgetVoicePrewarmTrigger, type AgentWidgetVoiceStatusEvent, type AgentWidgetWebMcpConfig, type AgentWidgetWelcomeAlign, type AgentWidgetWelcomeConfig, type AgentWidgetWelcomeDismiss, type AgentWidgetWelcomeIcon, type AgentWidgetWelcomeIconBase, type AgentWidgetWelcomeIconPlacement, type AgentWidgetWelcomeVariant, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type AttachmentUploadContext, type BorderScale, BrowserSpeechEngine, type BrowserSpeechEngineOptions, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type ClientToolDefinition, type ClientVisitorGrant, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRegistrationOptions, type ComponentRenderer, type ComponentTokens, type ComposerAction, type ComposerActionBase, type ComposerActionContext, type ComposerActionContributionContext, type ComposerActionOverflowConfig, type ComposerActionPlacement, type ComposerActionPresentation, type ComposerActionRenderContext, type ComposerActionVisibility, type ComposerAttachmentState, type ComposerBeforeSendResult, type ComposerBuildContext, type ComposerButtonAction, type ComposerCustomAction, type ComposerDisabledOption, type ComposerElements, type ComposerInputAttributes, type ComposerLayout, type ComposerMode, type ComposerModeChipVisibility, type ComposerModeGroup, type ComposerModeGroupPresentation, type ComposerModel, type ComposerModelPickerConfig, type ComposerModelPickerPresentation, type ComposerPhase, type ComposerQuote, type ComposerResubmitOptions, type ComposerState, type ComposerStreamingSubmitBehavior, type ComposerSubmissionOptions, type ComposerSubmissionSnapshot, type ComposerSubmitKey, 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 FallbackSpeechEngineOptions, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type HistoryConversationDetail, type HistoryConversationPage, type HistoryConversationPatch, type HistoryConversationSummary, type HistoryDeleteAllOptions, type HistoryDisplayProjection, type HistoryIdentityStatus, type HistoryListOptions, type HistoryListResult, type HistoryOperationContext, type HistoryPageOptions, type HistoryPageResult, type HistoryPendingAction, type HistoryProvider, HistoryProviderError, type HistoryProviderErrorCode, type HistoryReturnSurface, type HistoryScope, type HistoryViewState, 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 MarkdownParsersModule, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PcmStreamPlayer, type PendingAttachment, type PersonaArtifactActionContext, type PersonaArtifactCustomAction, type PersonaArtifactDisplayDescriptor, type PersonaArtifactDisplayMatch, type PersonaArtifactDisplayMode, type PersonaArtifactDisplayModeInput, type PersonaArtifactDisplayResolution, type PersonaArtifactDisplayRules, type PersonaArtifactFilesDisplayRules, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactPresentation, type PersonaArtifactRecord, type PersonaArtifactStatusLabelContext, type PersonaTheme, type PersonaThemePlugin, type PreparedClientSession, type PreparedHistoryActivation, type RadiusScale, ReadAloudController, type ReadAloudListener, type ReadAloudState, type ResolvedHistoryCopy, type ResolvedHistoryPresentation, type ResolvedTarget, type ResolvedWelcomeConfig, type RovingTablistController, type RovingTablistOptions, type RuleScoringContext, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeExecutionStreamEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, type RuntypeTurnCompleteEvent, type SSEEventCallback, type SSEEventRecord, SUGGEST_REPLIES_CLIENT_TOOL, SUGGEST_REPLIES_PARAMETERS_SCHEMA, SUGGEST_REPLIES_TOOL_NAME, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlashCommandDefinition, type SlotRenderContext, type SlotRenderer, type SpacingScale, type SpeechCallbacks, type SpeechEngine, type SpeechRequest, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TargetResolver, type TextContentPart, type TextStyleTokens, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceDelegationFollowUp, type VoiceDelegationRequest, type VoiceDelegationResult, type VoiceDelegationStatus, type VoiceMetrics, type VoicePlaybackEngine, type VoiceProvider, type VoiceResult, type VoiceSessionBridge, type VoiceStatus, type VoiceTranscriptMetadata, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, type WidgetArtifactLayoutPreference, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreferenceCapabilities, type WidgetPreferenceParseIssue, type WidgetPreferenceParseIssueCode, type WidgetPreferenceParseResult, type WidgetPreferenceSlice, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyFeaturePreferences, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, builtInClientToolsForDispatch, canonicalArtifactDisplayMode, 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, createRovingTablist, createSlashCommandsSource, createSplitButton, createStandardBubble, createStaticMentionSource, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultMentionFilter, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getAgentWidgetHandles, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isHistoryProviderError, isSuggestRepliesMessage, isVoiceSupported, isWebMcpToolName, isWelcomeVisible, latestAgentSuggestions, listRegisteredStreamAnimations, loadMarkdownParsers, markdownPostprocessor, mergeWithDefaults, normalizeContent, normalizeMediaType, onMarkdownParsersReady, parseAskUserQuestionPayload, parseSuggestRepliesPayload, parseWidgetPreferenceSlice, pickBestVoice, pluginRegistry, reducedMotionPlugin, registerIcons, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveArtifactDisplay, resolveArtifactDisplayMode, resolveConfigPreferences, resolveDockConfig, resolveSanitizer, resolveTokens, resolveWelcomeConfig, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };