@runtypelabs/persona 4.25.0 → 4.26.1

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 (236) 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 +186 -8
  12. package/dist/approval-ui.d.ts +186 -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 +186 -8
  17. package/dist/artifacts-ui.d.ts +186 -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-GKPCIQPB.js +1 -0
  23. package/dist/chunk-HGUCGM3K.js +9 -0
  24. package/dist/chunk-IO5VVUKP.js +3 -0
  25. package/dist/chunk-J4J3Y2P2.js +1 -0
  26. package/dist/chunk-K6HKIP5K.js +1 -0
  27. package/dist/chunk-K7NA7G7J.js +1 -0
  28. package/dist/chunk-MXUTS3LB.js +1 -0
  29. package/dist/chunk-PDPVORUF.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-GOZWBDA5.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 +186 -8
  46. package/dist/context-mentions.d.ts +186 -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 +189 -31
  51. package/dist/event-stream-view.d.ts +189 -31
  52. package/dist/event-stream-view.js +1 -1
  53. package/dist/forms-ui.d.cts +227 -667
  54. package/dist/forms-ui.d.ts +227 -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 +233 -738
  65. package/dist/index.d.ts +233 -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 +186 -8
  80. package/dist/session-reconnect.d.ts +186 -8
  81. package/dist/smart-dom-reader.cjs +13 -13
  82. package/dist/smart-dom-reader.d.cts +186 -8
  83. package/dist/smart-dom-reader.d.ts +186 -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 +188 -8
  87. package/dist/theme-editor-preview.d.ts +188 -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 +187 -23
  91. package/dist/theme-editor.d.ts +187 -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-XLU6YK2N.js +17 -0
  98. package/dist/voice-runtime.cjs +17 -1
  99. package/dist/voice-runtime.d.cts +11656 -232
  100. package/dist/voice-runtime.d.ts +11656 -232
  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 +325 -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 +6 -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 +895 -1538
  151. package/src/session.voice.test.ts +1171 -5
  152. package/src/styles/widget.css +58 -0
  153. package/src/theme-editor/state.ts +91 -91
  154. package/src/types.ts +204 -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 +340 -2770
  172. package/src/utils/attachment-manager.ts +67 -67
  173. package/src/utils/constants.ts +3 -0
  174. package/src/utils/context-mention-controller.ts +323 -323
  175. package/src/utils/context-mention-manager.ts +40 -40
  176. package/src/utils/context-mention-orchestrator.ts +28 -0
  177. package/src/utils/event-stream-buffer.ts +50 -50
  178. package/src/utils/event-stream-store.ts +43 -43
  179. package/src/utils/throughput-tracker.ts +34 -34
  180. package/src/utils/virtual-scroller.ts +67 -67
  181. package/src/utils/visitor-store.test.ts +50 -0
  182. package/src/utils/visitor-store.ts +23 -5
  183. package/src/voice/__fixtures__/voice-wire/README.md +1 -0
  184. package/src/voice/__fixtures__/voice-wire/client/cancel.json +3 -0
  185. package/src/voice/__fixtures__/voice-wire/client/context.json +4 -0
  186. package/src/voice/__fixtures__/voice-wire/client/delegation_result.json +6 -0
  187. package/src/voice/__fixtures__/voice-wire/client/delegation_update.json +6 -0
  188. package/src/voice/__fixtures__/voice-wire/client/ping.json +3 -0
  189. package/src/voice/__fixtures__/voice-wire/client/playback_progress.json +5 -0
  190. package/src/voice/__fixtures__/voice-wire/client/start.json +3 -0
  191. package/src/voice/__fixtures__/voice-wire/server/artifact.json +11 -0
  192. package/src/voice/__fixtures__/voice-wire/server/attached.json +4 -0
  193. package/src/voice/__fixtures__/voice-wire/server/audio_clear.json +4 -0
  194. package/src/voice/__fixtures__/voice-wire/server/audio_end.json +3 -0
  195. package/src/voice/__fixtures__/voice-wire/server/delegation_cancelled.json +5 -0
  196. package/src/voice/__fixtures__/voice-wire/server/delegation_completed.json +8 -0
  197. package/src/voice/__fixtures__/voice-wire/server/delegation_started.json +15 -0
  198. package/src/voice/__fixtures__/voice-wire/server/error.json +6 -0
  199. package/src/voice/__fixtures__/voice-wire/server/metrics.json +10 -0
  200. package/src/voice/__fixtures__/voice-wire/server/pong.json +3 -0
  201. package/src/voice/__fixtures__/voice-wire/server/session_config.json +16 -0
  202. package/src/voice/__fixtures__/voice-wire/server/transcript_final.json +7 -0
  203. package/src/voice/__fixtures__/voice-wire/server/transcript_interim.json +4 -0
  204. package/src/voice/__fixtures__/voice-wire/server/transcript_partial.json +6 -0
  205. package/src/voice/__fixtures__/voice-wire/server/transcript_update.json +10 -0
  206. package/src/voice/__fixtures__/voice-wire/server/warning.json +5 -0
  207. package/src/voice/audio-playback-manager.test.ts +57 -0
  208. package/src/voice/audio-playback-manager.ts +120 -98
  209. package/src/voice/browser-voice-provider.ts +37 -37
  210. package/src/voice/fallback-speech-engine.ts +22 -16
  211. package/src/voice/keyed-voice-transcript.ts +314 -0
  212. package/src/voice/mic-state-styles.ts +182 -0
  213. package/src/voice/read-aloud-controller.ts +46 -44
  214. package/src/voice/runtype-speech-engine.ts +35 -33
  215. package/src/voice/runtype-voice-provider.ts +680 -189
  216. package/src/voice/session-voice-wiring.ts +266 -0
  217. package/src/voice/voice-delegation.test.ts +71 -0
  218. package/src/voice/voice-delegation.ts +364 -0
  219. package/src/voice/voice-turn-tracker.ts +6 -6
  220. package/src/voice/voice.test.ts +1060 -8
  221. package/src/voice/worklet-playback-engine.test.ts +81 -0
  222. package/src/voice/worklet-playback-engine.ts +21 -3
  223. package/src/voice-runtime-loader.ts +4 -1
  224. package/src/voice-runtime.ts +7 -0
  225. package/src/webmcp-runtime-entry.ts +41 -39
  226. package/dist/approval-ui-3NMYNXBD.js +0 -1
  227. package/dist/chunk-5EIIHQLQ.js +0 -1
  228. package/dist/chunk-7CO4T5KB.js +0 -1
  229. package/dist/chunk-EFJBUH5F.js +0 -1
  230. package/dist/chunk-R2TMIMDI.js +0 -3
  231. package/dist/chunk-UTVLOTWB.js +0 -9
  232. package/dist/context-mentions-45MODWOY.js +0 -161
  233. package/dist/event-stream-view-GL3ADRY2.js +0 -1
  234. package/dist/runtype-tts-entry-UJAEF7NZ.js +0 -1
  235. package/dist/voice-runtime-7DA7MJH4.js +0 -1
  236. package/dist/webmcp-runtime-JI7T4QYF.js +0 -6
package/dist/index.d.ts CHANGED
@@ -7153,6 +7153,45 @@ type AgentWidgetVoiceRecognitionConfig = {
7153
7153
  * @default 30000
7154
7154
  */
7155
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;
7156
7195
  /** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
7157
7196
  pauseDuration?: number;
7158
7197
  /** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
@@ -7391,6 +7430,13 @@ interface VoicePlaybackEngine {
7391
7430
  onFinished(callback: () => void): void;
7392
7431
  /** Release all audio resources. */
7393
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;
7394
7440
  }
7395
7441
  /**
7396
7442
  * A {@link VoicePlaybackEngine} that also supports pause/resume. Returned by
@@ -7442,6 +7488,14 @@ type VoiceConfig = {
7442
7488
  prewarmMode?: 'request' | 'attach';
7443
7489
  /** See `voiceRecognition.provider.runtype.attachIdleMs`. @default 30000 */
7444
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;
7445
7499
  /** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
7446
7500
  pauseDuration?: number;
7447
7501
  /** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
@@ -7474,14 +7528,23 @@ interface VoiceProvider {
7474
7528
  * Register a callback for incremental transcript updates during a voice turn.
7475
7529
  * `isFinal=false` is a live interim update (user partials, or assistant deltas
7476
7530
  * on providers that stream them); `isFinal=true` finalizes that role's text.
7477
- * On the realtime `runtype` path, interim updates fire for the `user` only and
7478
- * the `assistant` arrives as a single final. Providers with overlapping turns
7479
- * must include the same turnId on user and assistant finals; without IDs,
7480
- * providers must discard cancelled output before emitting the next user final.
7481
- */
7482
- onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
7483
- turnId?: string;
7484
- }) => 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;
7485
7548
  /** Register a callback for per-turn latency metrics (realtime path). */
7486
7549
  onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
7487
7550
  /**
@@ -7509,6 +7572,115 @@ interface VoiceProvider {
7509
7572
  * repeatedly; throttle as needed.
7510
7573
  */
7511
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
+ * `false` when no chat message carries this answer (it is only spoken), so
7640
+ * the voice model's read-back of it stays visible as a caption.
7641
+ * @default true
7642
+ */
7643
+ inChat?: boolean;
7644
+ /**
7645
+ * Set when the turn parked on approvals (`text` then asks for the decision).
7646
+ * Resolves with the terminal result once the visitor decides (or the
7647
+ * approval is replaced, declined by voice, or unanswered for
7648
+ * `approvalTimeoutMs`) and the resumed turn finishes; `null` only when
7649
+ * `signal` aborts first (hang-up, or the server cancelled the delegation).
7650
+ */
7651
+ followUp?: (options: {
7652
+ signal: AbortSignal;
7653
+ approvalTimeoutMs?: number;
7654
+ /** `false`: run only the approval bookkeeping (expiry, supersede); nothing will be read back. @default true */
7655
+ readBack?: boolean;
7656
+ /** The resumed turn stopped on another approval: ask for it too (`text` is its approval script). */
7657
+ onUpdate?: (text: string) => void;
7658
+ }) => Promise<VoiceDelegationFollowUp | null>;
7659
+ };
7660
+ /**
7661
+ * Chat-side surface the session hands a full-duplex provider: the visible
7662
+ * history (for the call-start context) and a way to run a delegated turn
7663
+ * through the normal chat pipeline.
7664
+ */
7665
+ interface VoiceSessionBridge {
7666
+ /** Visible user/assistant messages, oldest first. */
7667
+ getHistory(): Array<{
7668
+ role: 'user' | 'assistant';
7669
+ content: string;
7670
+ }>;
7671
+ /**
7672
+ * Submit the turn as the visitor's message (reusing its transcript bubble)
7673
+ * and resolve with the assistant's final answer once the turn settles.
7674
+ * Waits for any chat turn already in flight first. Never rejects.
7675
+ */
7676
+ runDelegatedTurn(request: VoiceDelegationRequest): Promise<VoiceDelegationResult>;
7677
+ /**
7678
+ * The server dropped this delegation's result (cancelled it, or refused a
7679
+ * late result): its chat answer is no longer spoken, so browser TTS may read it.
7680
+ * `expired`: the server's deadline passed, so its pending approvals are
7681
+ * declined too, as the approval TTL would.
7682
+ */
7683
+ dropDelegation?(delegationId: string, expired?: boolean): void;
7512
7684
  }
7513
7685
  /**
7514
7686
  * Extra context for an approval decision, surfaced to `onDecision` and to the
@@ -10278,6 +10450,11 @@ type AgentWidgetToolCall = {
10278
10450
  startedAt?: number;
10279
10451
  completedAt?: number;
10280
10452
  durationMs?: number;
10453
+ /**
10454
+ * The call paused for an approval that was granted, and the agent re-ran it
10455
+ * as a new tool call: that later call carries the result, this one has none.
10456
+ */
10457
+ superseded?: boolean;
10281
10458
  };
10282
10459
  /**
10283
10460
  * Represents a tool approval request in the chat conversation.
@@ -10299,6 +10476,8 @@ type AgentWidgetApproval = {
10299
10476
  */
10300
10477
  reason?: string;
10301
10478
  parameters?: unknown;
10479
+ /** The paused tool call this approval gates (`approval_start.toolCallId`). */
10480
+ toolCallId?: string;
10302
10481
  resolvedAt?: number;
10303
10482
  };
10304
10483
  type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
@@ -10398,6 +10577,13 @@ type AgentWidgetMessage = {
10398
10577
  * }
10399
10578
  */
10400
10579
  voiceProcessing?: boolean;
10580
+ /**
10581
+ * Display-only caption of full-duplex voice speech, such as the voice
10582
+ * model's own words, or something the visitor said that wasn't submitted
10583
+ * as a chat turn. It renders in the transcript but is never sent to the
10584
+ * model as conversation.
10585
+ */
10586
+ voiceCaption?: boolean;
10401
10587
  /**
10402
10588
  * Raw structured payload for this message (e.g., JSON action response).
10403
10589
  * Populated automatically when structured parsers run.
@@ -10513,6 +10699,8 @@ type InjectMessageOptions = {
10513
10699
  * Consumers can detect this in `messageTransform` to render custom UI.
10514
10700
  */
10515
10701
  voiceProcessing?: boolean;
10702
+ /** See {@link AgentWidgetMessage.voiceCaption}. */
10703
+ voiceCaption?: boolean;
10516
10704
  /**
10517
10705
  * Raw structured payload (typically a JSON string) representing the
10518
10706
  * full directive that produced this message: e.g. `{ "text": "...",
@@ -10833,51 +11021,15 @@ type DispatchOptions = {
10833
11021
  type SSEHandler = (event: AgentWidgetEvent) => void;
10834
11022
  type SSEEventCallback = (eventType: string, payload: unknown) => void;
10835
11023
  declare class AgentWidgetClient {
11024
+ #private;
10836
11025
  private config;
10837
11026
  private historyInternals;
10838
- private readonly apiUrl;
10839
- private readonly headers;
10840
11027
  private readonly debug;
10841
- private readonly createStreamParser;
10842
- private readonly contextProviders;
10843
- private readonly requestMiddleware?;
10844
- private readonly customFetch?;
10845
- private readonly parseSSEEvent?;
10846
- private readonly getHeaders?;
10847
- private onSSEEvent?;
10848
- /**
10849
- * Turn id of the newest client-token dispatch. A dispatch whose id no longer
10850
- * matches is superseded, and every SSE frame it still receives is dropped
10851
- */
10852
- private currentClientTurnId;
10853
11028
  private clientSession;
10854
- private sessionInitPromise;
10855
- /**
10856
- * Early-init latch for `warmSession()`. `false` = armed. Otherwise it holds
10857
- * the session value (`null` or an expired session) the one early attempt was
10858
- * made against, so a failed attempt is not retried on every keystroke. It is
10859
- * re-armed when a session is installed or cleared, so each session lifetime
10860
- * gets one early init.
10861
- */
10862
- private sessionWarmLatch;
10863
11029
  private lastSentClientToolsFingerprint;
10864
11030
  private clientToolsFingerprintSessionId;
10865
- private sentNonEmptyClientToolsSessionId;
10866
- private historyUnavailable;
10867
- private historyUnavailableWarned;
10868
- private claimInFlight;
10869
- private historyIdentityStatus;
10870
- private historyIdentitySubscribers;
10871
- private historyAvailabilitySubscribers;
10872
11031
  private webMcpBridge;
10873
- private webMcpBridgePromise;
10874
- /** undefined = never set; null = explicitly cleared. Applied at adoption. */
10875
- private pendingWebMcpConfirmHandler;
10876
11032
  constructor(config?: AgentWidgetConfig, historyInternals?: WidgetHistoryInternals);
10877
- /** Load the lazy runtime chunk and construct the bridge with core-owned deps. */
10878
- private createWebMcpBridge;
10879
- /** Resolve the bridge, loading the runtime chunk on first use. */
10880
- private getWebMcpBridge;
10881
11033
  /**
10882
11034
  * Refresh config in place WITHOUT tearing down the live connection or the
10883
11035
  * WebMCP bridge. `AgentWidgetSession.updateConfig` calls this when only
@@ -10935,29 +11087,10 @@ declare class AgentWidgetClient {
10935
11087
  * Check if running in client token mode
10936
11088
  */
10937
11089
  isClientTokenMode(): boolean;
10938
- /**
10939
- * Resolve the effective backend routing for the current config. Combines the
10940
- * explicit `agentId`/`flowId` fields with the normalized `target` string
10941
- * (resolved via `resolveTarget`). Computed on demand so it stays correct
10942
- * across `update()`; the `target`/explicit-field conflict is rejected in the
10943
- * constructor, so at most one source is set here.
10944
- */
10945
- private routing;
10946
11090
  /**
10947
11091
  * Check if operating in agent execution mode
10948
11092
  */
10949
11093
  isAgentMode(): boolean;
10950
- /**
10951
- * Base URL for Runtype client-surface routes (`/v1/client/*`,
10952
- * `/v1/agents/*`). Strips a configured `/v1/dispatch` suffix so an apiUrl
10953
- * pointed at the dispatch endpoint still resolves its sibling routes. Not
10954
- * used for proxy-mode URLs, whose resume route is `${apiUrl}/resume`.
10955
- */
10956
- private clientApiBase;
10957
- /**
10958
- * Get the appropriate API URL based on mode
10959
- */
10960
- private getClientApiUrl;
10961
11094
  /**
10962
11095
  * Get the current client session (if any)
10963
11096
  */
@@ -10991,56 +11124,13 @@ declare class AgentWidgetClient {
10991
11124
  * `/v1/client/init`.
10992
11125
  */
10993
11126
  initSession(): Promise<ClientSession>;
10994
- /** Visitor history rides on client-token init only, and latches off after a 403 degrade. */
10995
- private isHistoryCapable;
10996
11127
  private readVisitorToken;
10997
- /** One-way, client-lifetime latch: chat keeps working without history. */
10998
- private markHistoryUnavailable;
10999
11128
  /** Public, secret-free view of the current identity state. */
11000
11129
  getHistoryIdentityStatus(): HistoryIdentityStatus;
11001
11130
  /** Deduped status notifications; carries no token, proof, or identity value. */
11002
11131
  subscribeHistoryIdentityStatus(callback: (status: HistoryIdentityStatus) => void): () => void;
11003
11132
  /** Fires only on the one-way 403 degrade; availability never returns. */
11004
11133
  subscribeHistoryAvailability(callback: (available: boolean) => void): () => void;
11005
- /** Config-derived state before any per-operation evidence exists. */
11006
- private restingIdentityStatus;
11007
- /** Keeps an already-observed browser_only reason; otherwise derives one. */
11008
- private browserOnlyStatus;
11009
- private derivedBrowserOnly;
11010
- /** Identical consecutive states are not re-announced. */
11011
- private setHistoryIdentityStatus;
11012
- /**
11013
- * The single uncached init primitive: builds one body, performs one fetch.
11014
- * `conversationId` and `sessionId` are mutually exclusive on the wire (strict
11015
- * server union), so a resume never carries the stored session id.
11016
- */
11017
- private createClientSession;
11018
- private _doInitSession;
11019
- /**
11020
- * An empty store means this init may mint a visitor, so it runs under the
11021
- * cross-tab first-init lock: a waiter re-reads inside the lock and joins the
11022
- * winner's visitor instead of minting a second one.
11023
- */
11024
- private ordinaryInit;
11025
- private doOrdinaryInit;
11026
- /**
11027
- * Ordinary init carrying an identity proof: binds/rebinds the visitor,
11028
- * persists any replacement token (inside `createClientSession`), and installs
11029
- * the result as the live session.
11030
- */
11031
- private reinitWithProof;
11032
- /**
11033
- * A minted visitor means the record this session just created is still
11034
- * unowned; one immediate re-init with `{visitorToken, sessionId}` claims it.
11035
- */
11036
- private claimFirstConversation;
11037
- /**
11038
- * Continuity guard + id persistence. A different record than the persisted
11039
- * one is a privacy transition, announced before the new id is written.
11040
- */
11041
- private finishInit;
11042
- /** Wrap an uncached init so nothing installs until the winner commits. */
11043
- private prepared;
11044
11134
  /**
11045
11135
  * Transactional reopen of a known conversation. Always bypasses the session
11046
11136
  * cache, never sends the stored session id, and needs a credential the server
@@ -11067,10 +11157,6 @@ declare class AgentWidgetClient {
11067
11157
  * when the conversation is reset (`WidgetSession.clearMessages`).
11068
11158
  */
11069
11159
  resetClientToolsFingerprint(): void;
11070
- /**
11071
- * Get the feedback API URL
11072
- */
11073
- private getFeedbackApiUrl;
11074
11160
  /**
11075
11161
  * Send feedback for a message (client token mode only).
11076
11162
  * Supports upvote, downvote, copy, csat, and nps feedback types.
@@ -11129,37 +11215,6 @@ declare class AgentWidgetClient {
11129
11215
  * @param comment - Optional comment
11130
11216
  */
11131
11217
  submitNPSFeedback(rating: number, comment?: string): Promise<void>;
11132
- /** `/v1/client/<path>` with a query string; credentials ride in headers. */
11133
- private historyUrl;
11134
- /** Explicit per-operation scope wins; otherwise config, then evidence. */
11135
- private resolveHistoryScope;
11136
- private resolveChatIdentityProof;
11137
- /**
11138
- * Resolve the proof for one logical request. `null` is an intentional
11139
- * browser-scope fallback only while the visitor has never been bound.
11140
- */
11141
- private resolveIdentityProof;
11142
- /** Bind the visitor before the first verified request; admitted proofs only. */
11143
- private bindIdentity;
11144
- private readErrorCode;
11145
- /**
11146
- * Selective one-shot 401 recovery. Returns the session to retry under;
11147
- * anything unrecoverable throws typed and is never retried.
11148
- */
11149
- private recoverFromUnauthorized;
11150
- private historyErrorFor;
11151
- /**
11152
- * Validate `X-History-Identity-Status` before any body is committed: the
11153
- * per-operation acknowledgement, not a prior init, is what proves scope.
11154
- */
11155
- private commitIdentityAcknowledgement;
11156
- /**
11157
- * Shared history transport: live session, `sessionId` query param,
11158
- * `X-Visitor-Token` header, one resolved proof, one-shot 401 recovery, and a
11159
- * credential-revision guard that discards a response the store outran.
11160
- */
11161
- private historyFetch;
11162
- private assertHistoryUsable;
11163
11218
  /** One page of the visitor's conversations, newest first. */
11164
11219
  listConversations(opts?: {
11165
11220
  cursor?: string;
@@ -11211,18 +11266,6 @@ declare class AgentWidgetClient {
11211
11266
  * Send a message - handles both proxy and client token modes
11212
11267
  */
11213
11268
  dispatch(options: DispatchOptions, onEvent: SSEHandler): Promise<void>;
11214
- /**
11215
- * Client token mode dispatch
11216
- */
11217
- private dispatchClientToken;
11218
- /**
11219
- * Proxy mode dispatch (original implementation)
11220
- */
11221
- private dispatchProxy;
11222
- /**
11223
- * Agent mode dispatch
11224
- */
11225
- private dispatchAgent;
11226
11269
  /**
11227
11270
  * Process an external SSE stream through the SDK's event pipeline.
11228
11271
  * This allows piping responses from endpoints like agent approval
@@ -11232,114 +11275,25 @@ declare class AgentWidgetClient {
11232
11275
  /**
11233
11276
  * Send an approval decision to the API and return the response
11234
11277
  * for streaming continuation.
11278
+ *
11279
+ * Routes by mode:
11280
+ * - **client-token mode**: POST `${apiBase}/v1/client/approve` with the
11281
+ * active `sessionId` and no Bearer key (runtypelabs/core#9518). Answers a
11282
+ * gate authored `tools.approval.approver: 'end-user'`; the SSE body has
11283
+ * the same shape as `/v1/client/resume`.
11284
+ * - **dispatch / proxy mode**: POST `${apiBase}/v1/agents/{agentId}/approve`
11285
+ * with the host's headers.
11235
11286
  */
11236
11287
  resolveApproval(approval: {
11237
11288
  agentId: string;
11238
11289
  executionId: string;
11239
11290
  approvalId: string;
11240
11291
  }, decision: 'approved' | 'denied'): Promise<Response>;
11241
- /**
11242
- * Resume a paused flow execution by supplying outputs for LOCAL
11243
- * (client-executed) tools. Used by the built-in `ask_user_question`
11244
- * answer-pill sheet, but generic enough for any LOCAL tool.
11245
- *
11246
- * Routes by mode:
11247
- * - **client-token mode**: POST `${apiBase}/v1/client/resume` (the
11248
- * session-authenticated sibling of `/v1/client/chat`; runtypelabs/core#3889),
11249
- * with the active `sessionId` in the body and no Bearer key: a browser
11250
- * client-token page holds no secret. The page's tool registry is
11251
- * re-snapshotted and sent alongside `toolOutputs` via the same diff-only
11252
- * `clientTools` / `clientToolsFingerprint` protocol as `/v1/client/chat`
11253
- * (runtypelabs/core#5361), so tools registered by a mid-run page
11254
- * navigation replace the run's dispatch-time set and become callable on
11255
- * the next model turn. Old servers strip the unknown fields and keep the
11256
- * frozen-at-dispatch behavior.
11257
- * - **dispatch / proxy mode**: POST `${apiUrl}/resume`: Runtype mounts
11258
- * resume as a child of `/v1/dispatch`, so the URL is `${apiUrl}/resume`,
11259
- * and proxies follow the same shape (`/api/chat/dispatch/resume`).
11260
- *
11261
- * Returns the raw Response so the caller can pipe its SSE body through
11262
- * `connectStream()`.
11263
- *
11264
- * @param executionId - The paused execution id carried on `await`.
11265
- * @param toolOutputs - Map keyed by per-call `toolCallId` (core#3878),
11266
- * falling back to tool name for legacy servers → the tool's result value.
11267
- */
11268
- /**
11269
- * Diff-only / send-once WebMCP clientTools transport, shared by the
11270
- * client-token chat (`/v1/client/chat`) and resume (`/v1/client/resume`)
11271
- * paths — both routes speak the same protocol (runtypelabs/core#5361).
11272
- *
11273
- * Decides, against the shared fingerprint cache, whether this request ships
11274
- * the full `clientTools[]` + fingerprint (first send under this session, or
11275
- * a changed set) or the fingerprint alone (unchanged set; the server reuses
11276
- * its stored copy). Runs `doFetch` with the chosen fields and retries
11277
- * EXACTLY once with the full array on a
11278
- * `409 { error: 'client_tools_resend_required' }` registry miss — the retry
11279
- * is 409-*triggered*, never 409-*expected*, so servers predating the
11280
- * protocol (which strip the unknown fields and never 409) work unchanged.
11281
- * The 409 body is probed on a `clone()` so the original response body stays
11282
- * readable by the caller's error handling.
11283
- *
11284
- * The cache is NOT committed here: callers invoke the returned `commit()`
11285
- * only after the server has accepted the request (response OK / stream
11286
- * started), so a failed request can never record a fingerprint the server
11287
- * never stored. A resend-required miss invalidates the cached fingerprint
11288
- * immediately so later turns keep resending in full until a clean success
11289
- * commits a fresh one.
11290
- *
11291
- * `emptyMeansReplace` (resume only): when the live snapshot is empty but a
11292
- * non-empty set was committed under this session and never explicitly
11293
- * cleared (the paused tool navigated to a page with no tool registry), ship
11294
- * an explicit `clientTools: []` so the server REPLACES the persisted
11295
- * dispatch-time set with nothing and clears its stored registry. Chat keeps
11296
- * its omit-when-empty behavior: on `/chat`, absent fields already mean "no
11297
- * tools this turn", whereas on `/resume` absence means "keep the frozen
11298
- * dispatch-time set".
11299
- */
11300
- private sendWithClientToolsDiff;
11301
11292
  resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
11302
11293
  streamResponse?: boolean;
11303
11294
  signal?: AbortSignal;
11304
11295
  after?: string;
11305
11296
  }): Promise<Response>;
11306
- /**
11307
- * The opt-in structured mention channel: the MOST RECENT user turn's
11308
- * `mentionContext` (set by `session.applyMentionBundle`) namespaced under
11309
- * `mentions`. Only the latest user message is consulted — otherwise an older
11310
- * turn's mentions would re-attach to `context.mentions` on every later send.
11311
- * Returns null when the latest user turn carried no structured mention context.
11312
- * The default model-visible path (`llmAppend`) already rode into the message's
11313
- * `llmContent`/`contentParts`, so it needs nothing here.
11314
- */
11315
- private latestMentionContext;
11316
- /**
11317
- * Aggregate request `context`: merge every context provider's result with the
11318
- * opt-in mention context from the latest user turn. Returns null when nothing
11319
- * contributed, so callers can skip setting `payload.context`. Shared by the
11320
- * agent and flow payload builders.
11321
- */
11322
- private buildContextAggregate;
11323
- /**
11324
- * Non-empty composer selections only. An empty snapshot leaves the field off
11325
- * the wire entirely, so a widget with no picker and no modes sends exactly
11326
- * what it sent before.
11327
- */
11328
- private normalizeComposerOptions;
11329
- /**
11330
- * Rule 4: an inline client-defined agent may take the turn's model from the
11331
- * composer, but only for an id the host actually declared in
11332
- * `composer.models`. Config is untouched; the mapping is per request.
11333
- */
11334
- private applyInlineAgentModel;
11335
- private buildAgentPayload;
11336
- private buildPayload;
11337
- /**
11338
- * Handle custom SSE event parsing via parseSSEEvent callback
11339
- * Returns true if event was handled, false otherwise
11340
- */
11341
- private handleCustomSSEEvent;
11342
- private streamResponse;
11343
11297
  }
11344
11298
 
11345
11299
  /** The resolved bundle gathered at submit, merged into the user message. */
@@ -11357,12 +11311,7 @@ interface MentionSubmitBundle {
11357
11311
 
11358
11312
  type ReadAloudListener = (activeId: string | null, state: ReadAloudState) => void;
11359
11313
  declare class ReadAloudController {
11360
- private resolveEngine;
11361
- private engine;
11362
- private activeId;
11363
- private state;
11364
- private listeners;
11365
- private generation;
11314
+ #private;
11366
11315
  constructor(resolveEngine: () => SpeechEngine | Promise<SpeechEngine> | null);
11367
11316
  /** Whether the active engine supports pause/resume (vs. stop-only). */
11368
11317
  get supportsPause(): boolean;
@@ -11384,7 +11333,6 @@ declare class ReadAloudController {
11384
11333
  stop(): void;
11385
11334
  /** Drop the controller and its engine (called on widget teardown). */
11386
11335
  destroy(): void;
11387
- private set;
11388
11336
  }
11389
11337
 
11390
11338
  type AgentWidgetSessionStatus = "idle" | "connecting" | "connected" | "error" | "paused" | "resuming";
@@ -11443,6 +11391,7 @@ type SessionHistoryNotice = {
11443
11391
  message: string;
11444
11392
  };
11445
11393
  declare class AgentWidgetSession {
11394
+ #private;
11446
11395
  private config;
11447
11396
  private callbacks;
11448
11397
  private historyInternals;
@@ -11451,79 +11400,16 @@ declare class AgentWidgetSession {
11451
11400
  private status;
11452
11401
  private streaming;
11453
11402
  private abortController;
11454
- private sequenceCounter;
11455
11403
  private clientSession;
11456
11404
  private agentExecution;
11457
- private resumable;
11458
- private activeAssistantMessageId;
11459
- private reconnecting;
11460
- private reconnectController;
11461
- private reconnectControllerPromise;
11462
- private executionStateTimer;
11463
11405
  private artifacts;
11464
- private selectedArtifactId;
11465
11406
  private webMcpInflightKeys;
11466
11407
  private webMcpResolvedKeys;
11467
11408
  private webMcpResolveControllers;
11468
- private webMcpEpoch;
11469
11409
  private webMcpApprovalResolvers;
11470
- private webMcpApprovalSeq;
11410
+ private approvalTokens;
11471
11411
  private webMcpAwaitBatches;
11472
- private voiceProvider;
11473
- /** In-flight setupVoice chunk load; toggleVoice awaits it when racing setup. */
11474
- private voiceSetupPromise;
11475
- /** Bumped by setupVoice/cleanupVoice so a stale chunk load can't install. */
11476
- private voiceSetupGeneration;
11477
- /** Latest 0..1 capture amplitude pushed by a provider that reports one. */
11478
- private voiceLevel;
11479
- private voiceActive;
11480
- private voiceStatus;
11481
- private activeConversationId;
11482
- private activeConversationRevision;
11483
- private historyNextMessageCursor;
11484
- /** Monotonic: a later selection supersedes every earlier fetch/prepare. */
11485
- private historyOpenEpoch;
11486
- /** Blocks `setClientSession`'s welcome branch across a reopen re-init. */
11487
- private suppressWelcomeInjection;
11488
- private historyRecovery;
11489
- private historySendBlocked;
11490
- /** Continuity wipe / boot reconciliation; dispatch waits on it. */
11491
- private historyGate;
11492
- /** Deduped by `(id, cursor)` so repeated clicks issue one request. */
11493
- private olderPageRequests;
11494
- /** Serializes projection finalization against every other operation. */
11495
- private projectionFinalizationPromise;
11496
- /** Message id → projection the server has acknowledged (sent or finalized). */
11497
- private acknowledgedProjections;
11498
- private pendingProjections;
11499
- /** Persisted revision as it stood before boot init overwrote it. */
11500
- private bootConversationRevision;
11501
- private bootRevisionCaptured;
11502
- /** Exactly one visitor-store subscription per instance; re-keyed with the store. */
11503
- private visitorStoreUnsubscribe;
11504
- private subscribedVisitorStore;
11505
- /** An external credential change happened; the next dispatch must re-init. */
11506
- private credentialReinitPending;
11507
- private credentialReinitPromise;
11508
11412
  constructor(config: AgentWidgetConfig | undefined, callbacks: SessionCallbacks, historyInternals?: WidgetHistoryInternals);
11509
- /**
11510
- * Warm the deferred voice-runtime chunk (provider factory + providers) at
11511
- * init when a voice provider is configured, so setupVoice / the first mic
11512
- * click resolve against a warm module. Module fetch only — WebSocket and
11513
- * AudioContext still wait for their own triggers. Errors are swallowed: the
11514
- * setupVoice path retries via the chunk loader's rejection-retry.
11515
- */
11516
- private prefetchVoiceRuntime;
11517
- /**
11518
- * Warm the deferred Runtype TTS engine chunk at init so it's resolved before
11519
- * the first "Read aloud" click. Module fetch only — no AudioContext (that
11520
- * still waits for the user gesture on first playback). In the IIFE/CDN build
11521
- * this fetches the standalone `runtype-tts.js`; in bundler builds the module
11522
- * is already inlined, so this is a cheap no-op. Errors are swallowed: a failed
11523
- * prefetch just means the chunk loads on first click instead (or, on a hard
11524
- * failure, the browser-voice fallback kicks in).
11525
- */
11526
- private prefetchRuntypeTts;
11527
11413
  /**
11528
11414
  * Set callback for capturing raw SSE events (forwards to client)
11529
11415
  */
@@ -11556,6 +11442,8 @@ declare class AgentWidgetSession {
11556
11442
  * Get current voice status
11557
11443
  */
11558
11444
  getVoiceStatus(): VoiceStatus;
11445
+ /** The live call's AI-disclosure notice, if it shows one. */
11446
+ getVoiceDisclosure(): string | null;
11559
11447
  /**
11560
11448
  * Get the voice interruption mode from the provider (none/cancel/barge-in)
11561
11449
  */
@@ -11575,30 +11463,12 @@ declare class AgentWidgetSession {
11575
11463
  isBargeInActive(): boolean;
11576
11464
  /** Tear down the barge-in mic pipeline: "hang up" the always-on mic */
11577
11465
  deactivateBargeIn(): Promise<void>;
11578
- private pendingVoiceUserMessageId;
11579
- private pendingVoiceAssistantMessageId;
11580
- private voiceTurns;
11581
- private voiceDisconnectPromise;
11582
11466
  private ttsSpokenMessageIds;
11583
11467
  private readAloud;
11584
- /**
11585
- * Resolve the speech engine behind read-aloud (and auto-speak):
11586
- * 1. An explicit `textToSpeech.createEngine` always wins (full BYO control).
11587
- * 2. `provider: 'runtype'` builds the hosted {@link RuntypeSpeechEngine}
11588
- * from the widget config (host = `apiUrl`, `agentId`, `clientToken`),
11589
- * wrapped in a browser {@link FallbackSpeechEngine} unless
11590
- * `browserFallback: false` — so a missing endpoint or transient failure
11591
- * degrades to the browser voice instead of erroring, and auto-upgrades to
11592
- * Runtype voices the day the endpoint ships.
11593
- * 3. Otherwise the browser Web Speech API engine.
11594
- */
11595
- private createSpeechEngine;
11596
11468
  /**
11597
11469
  * Setup voice recognition with the given configuration
11598
11470
  */
11599
11471
  setupVoice(config?: VoiceConfig): void;
11600
- /** Wire callbacks onto a freshly constructed provider and connect it. */
11601
- private wireVoiceProvider;
11602
11472
  /**
11603
11473
  * Toggle voice recognition on/off
11604
11474
  */
@@ -11614,8 +11484,6 @@ declare class AgentWidgetSession {
11614
11484
  * Cleanup voice resources
11615
11485
  */
11616
11486
  cleanupVoice(): void;
11617
- private disconnectVoice;
11618
- private settlePendingVoiceTurn;
11619
11487
  /**
11620
11488
  * Extract voice configuration from widget config
11621
11489
  */
@@ -11636,12 +11504,6 @@ declare class AgentWidgetSession {
11636
11504
  * Set the client session after initialization
11637
11505
  */
11638
11506
  setClientSession(session: ClientSession, pristine?: boolean): void;
11639
- /**
11640
- * Welcome injection is skipped while `suppressWelcomeInjection` is latched:
11641
- * reopening a stored conversation is not a new thread, and the hydrated
11642
- * transcript would otherwise race a welcome bubble.
11643
- */
11644
- private injectWelcomeMessage;
11645
11507
  /**
11646
11508
  * Get current client session
11647
11509
  */
@@ -11690,26 +11552,10 @@ declare class AgentWidgetSession {
11690
11552
  setHistoryInternals(internals: WidgetHistoryInternals): void;
11691
11553
  /** Widget teardown: release the visitor-store subscription. */
11692
11554
  destroy(): void;
11693
- /**
11694
- * The session always owns the continuity transition, whether or not the shell
11695
- * supplied its own observer: a credential/record break must wipe local state
11696
- * before the replacement session becomes sendable.
11697
- */
11698
- private composeHistoryInternals;
11699
- private get historyProvider();
11700
- private requireHistoryProvider;
11701
- /**
11702
- * One resolved scope per logical action. An explicitly requested scope the
11703
- * provider cannot serve fails locally rather than silently downgrading.
11704
- */
11705
- private historyContext;
11706
11555
  getHistoryState(): SessionHistoryState;
11707
11556
  getActiveConversationId(): string | null;
11708
- private emitHistoryState;
11709
- private notifyHistory;
11710
11557
  /** Pending destructive/reconciliation work every other operation waits on. */
11711
11558
  awaitHistorySettled(): Promise<void>;
11712
- private assertHistoryIdle;
11713
11559
  listConversations(opts?: {
11714
11560
  cursor?: string;
11715
11561
  limit?: number;
@@ -11734,7 +11580,6 @@ declare class AgentWidgetSession {
11734
11580
  loadOlderMessages(id: string, cursor?: string | null, opts?: {
11735
11581
  scope?: HistoryScope;
11736
11582
  }): Promise<HistoryOlderPage>;
11737
- private fetchOlderPage;
11738
11583
  /**
11739
11584
  * The canonical new-thread operation. A failed prepare leaves the current
11740
11585
  * conversation completely intact.
@@ -11742,11 +11587,6 @@ declare class AgentWidgetSession {
11742
11587
  startNewConversation(opts?: {
11743
11588
  scope?: HistoryScope;
11744
11589
  }): Promise<void>;
11745
- /**
11746
- * Clear local + persisted conversation state, then commit the replacement.
11747
- * Welcome injection is deliberately allowed once the transcript is empty.
11748
- */
11749
- private installFreshConversation;
11750
11590
  /**
11751
11591
  * Deleting the active record (or everything) is already irreversible: the
11752
11592
  * transcript is destroyed first, then a replacement session is prepared.
@@ -11773,60 +11613,12 @@ declare class AgentWidgetSession {
11773
11613
  resetHistoryDevice(): Promise<{
11774
11614
  remoteRevocationConfirmed: boolean;
11775
11615
  }>;
11776
- private recoverFromDestroyedConversation;
11777
- /**
11778
- * Never reinstalls the deleted session. A failed preparation leaves an
11779
- * explicit recoverable state instead of the old transcript.
11780
- */
11781
- private prepareReplacementConversation;
11782
- /** The next explicit action retries a failed replacement preparation. */
11783
- private retryRequiredConversation;
11784
- /**
11785
- * Install a prepared activation. The provider's commit also invokes the
11786
- * session binding (`bindActivatedSession`); the fallback covers a shell that
11787
- * has not wired that callback yet.
11788
- */
11789
- private commitActivation;
11790
11616
  /**
11791
11617
  * Session-owned binding for a winning prepared activation. Installs the
11792
11618
  * client session WITHOUT the ordinary welcome branch while the reopen latch
11793
11619
  * is set, and persists the replacement ids through the normal storage path.
11794
11620
  */
11795
11621
  bindActivatedSession(session: ClientSession): void;
11796
- private persistConversationMetadata;
11797
- /** Conversation-scoped caches that must not leak across records. */
11798
- private resetConversationScopedState;
11799
- /**
11800
- * Irreversible local + persisted clear. Used by new-conversation, active
11801
- * deletion, 410 recovery, reset, and the continuity wipe.
11802
- */
11803
- private discardConversationState;
11804
- /**
11805
- * D6 continuity wipe (session side): a replacement visitor, identity rebind,
11806
- * cross-tab convergence, or credential expiry selected a different record.
11807
- * Invalidate synchronously; dispatch stays blocked until cleanup completes.
11808
- */
11809
- private handleHistoryContinuityChanged;
11810
- /**
11811
- * One subscription per widget instance, re-keyed when the controller swaps
11812
- * the store. Owned here so the transition sits beside the continuity wipe it
11813
- * reuses.
11814
- */
11815
- private syncVisitorStoreSubscription;
11816
- /**
11817
- * D3 privacy boundary: a sibling tab cleared or replaced the shared visitor
11818
- * credential. Privacy wins over turn continuity, so a live turn is cancelled.
11819
- * A "local" change is this tab's own mint/write and owns its init path; a
11820
- * change out of an empty store is first-init convergence, not a break.
11821
- */
11822
- private handleExternalCredentialChange;
11823
- /**
11824
- * Dispatch may not proceed until a session exists under the NEW credential.
11825
- * Deliberately lazy: re-initializing on the storage event itself would hand
11826
- * an idle tab a fresh credential the visitor just deleted elsewhere.
11827
- */
11828
- private completeCredentialReinit;
11829
- private runCredentialReinit;
11830
11622
  /**
11831
11623
  * Authoritative boot reconciliation (D4). Runs after a `conversationId` boot
11832
11624
  * resume and before chat becomes sendable: an unchanged revision needs no
@@ -11836,47 +11628,11 @@ declare class AgentWidgetSession {
11836
11628
  reconcileBootConversation(opts?: {
11837
11629
  scope?: HistoryScope;
11838
11630
  }): Promise<void>;
11839
- private runBootReconciliation;
11840
- /** Runtype transport op: active session + browser scope, never a proof. */
11841
- private projectionFinalizationEnabled;
11842
- private setPendingProjections;
11843
- private readPendingProjections;
11844
- /** Record what the dispatch payload carried as each message's projection. */
11845
- private recordDispatchedProjections;
11846
- /**
11847
- * After a terminal assistant message, finalize any browser-derived projection
11848
- * the server cannot have. Painting is never delayed by this.
11849
- */
11850
- private scheduleProjectionFinalization;
11851
- /** Serialized: operations await this chain instead of racing it. */
11852
- private enqueueProjectionFinalization;
11853
- private finalizeProjections;
11854
- /** Transport-shaped failures only; a contract failure is not retried. */
11855
- private isTransientProjectionError;
11856
- private clearFinalizedMarker;
11857
11631
  /**
11858
11632
  * Boot replay: rebuild the batch from the persisted ids plus the local
11859
11633
  * message content, then finalize before display reconciliation completes.
11860
11634
  */
11861
11635
  replayPendingProjections(): Promise<void>;
11862
- /**
11863
- * A local transcript mutation whose response carries no new revision: clear
11864
- * the persisted one rather than guessing, so the next boot refreshes safely.
11865
- */
11866
- private invalidateConversationRevision;
11867
- /** Blocks a send until the owning history transition finishes. */
11868
- private awaitHistorySendable;
11869
- private static isConversationDeleted;
11870
- /**
11871
- * Safe 410 recovery (D5). The old payload would recreate the transcript that
11872
- * was just deleted, so the retry carries ONLY the just-submitted user turn.
11873
- */
11874
- private dispatchWithDeletedRecovery;
11875
- /**
11876
- * Capture only the newly submitted user message, destroy the deleted record's
11877
- * local state, and initialize a fresh owned conversation to retry into.
11878
- */
11879
- private recoverFromDeletedConversation;
11880
11636
  updateConfig(next: AgentWidgetConfig): void;
11881
11637
  getMessages(): AgentWidgetMessage[];
11882
11638
  getStatus(): AgentWidgetSessionStatus;
@@ -11973,15 +11729,6 @@ declare class AgentWidgetSession {
11973
11729
  * });
11974
11730
  */
11975
11731
  injectComponentDirective(options: InjectComponentDirectiveOptions): AgentWidgetMessage;
11976
- /**
11977
- * Resolve the gathered mentions and merge them into the user message's
11978
- * model-visible content. Default path is `llmAppend` → `llmContent` (or a text
11979
- * `contentPart` when parts are present, since `contentParts` wins the priority
11980
- * chain); the opt-in structured `context` lands on `mentionContext` for the
11981
- * client to namespace into the request `context`. Failures were already
11982
- * dropped by `finalize()`.
11983
- */
11984
- private applyMentionBundle;
11985
11732
  sendMessage(rawInput: string, options?: {
11986
11733
  viaVoice?: boolean;
11987
11734
  /** Multi-modal content parts (e.g., images) to include with the message */
@@ -12026,6 +11773,15 @@ declare class AgentWidgetSession {
12026
11773
  * (`composer.streamingSubmitBehavior: "interrupt"`).
12027
11774
  */
12028
11775
  interrupt?: boolean;
11776
+ /**
11777
+ * Internal (voice client delegation): this is the delegated voice turn.
11778
+ * `userMessageId` names an existing transcript bubble to submit as the
11779
+ * turn's user message instead of appending a new one, so the spoken
11780
+ * request appears (and is sent) exactly once.
11781
+ */
11782
+ voiceTurn?: {
11783
+ userMessageId?: string;
11784
+ };
12029
11785
  }): Promise<void>;
12030
11786
  /**
12031
11787
  * Re-run the conversation from one user turn (docs/composer-gap-analysis.md
@@ -12049,8 +11805,6 @@ declare class AgentWidgetSession {
12049
11805
  * turn would carry no content; nothing is truncated in that case.
12050
11806
  */
12051
11807
  resubmitFrom(messageId: string, options: ComposerResubmitOptions): boolean;
12052
- /** Submission options → the wire payload shape; quote travels separately. */
12053
- private toComposerOptionsPayload;
12054
11808
  /**
12055
11809
  * Continue the conversation without adding a new user message.
12056
11810
  * Triggers the model to respond based on the current conversation state.
@@ -12085,13 +11839,6 @@ declare class AgentWidgetSession {
12085
11839
  */
12086
11840
  seedContent?: string;
12087
11841
  }): Promise<void>;
12088
- /**
12089
- * Install the native approval-bubble confirm handler on the WebMCP bridge
12090
- * when the integrator hasn't supplied a custom `webmcp.onConfirm`. Without
12091
- * this, the bridge falls back to a blunt `window.confirm`. Safe to call
12092
- * repeatedly (e.g. after the client is re-created in `updateConfig`).
12093
- */
12094
- private wireDefaultWebMcpConfirm;
12095
11842
  /**
12096
11843
  * Default WebMCP confirm gate: render Persona's native in-panel approval
12097
11844
  * bubble and resolve when the user clicks Approve/Deny. Returns immediately
@@ -12125,6 +11872,14 @@ declare class AgentWidgetSession {
12125
11872
  * 3. Append a user-visible bubble with the answer text so the
12126
11873
  * transcript reads naturally.
12127
11874
  */
11875
+ resolveAskUserQuestion(toolMessage: AgentWidgetMessage, answer: string | Record<string, string | string[]>): Promise<void>;
11876
+ /**
11877
+ * Resolve a paused auto-resolving LOCAL tool call (`webmcp:*` page tools
11878
+ * and the built-in `suggest_replies`) and post the result to `/resume`.
11879
+ * Triggered automatically from `handleEvent`; idempotent on the message's
11880
+ * `toolCall.id`. See `resolveWebMcpToolCall` in `session-actions.ts`.
11881
+ */
11882
+ resolveWebMcpToolCall(toolMessage: AgentWidgetMessage): Promise<void>;
12128
11883
  /**
12129
11884
  * Persist in-progress answers and the current page index for a multi-question
12130
11885
  * `ask_user_question` payload, so a refresh resumes on the same page with
@@ -12143,123 +11898,6 @@ declare class AgentWidgetSession {
12143
11898
  * answers via top-level merge.
12144
11899
  */
12145
11900
  markAskUserQuestionResolved(toolMessage: AgentWidgetMessage, answers?: Record<string, string | string[]>): void;
12146
- resolveAskUserQuestion(toolMessage: AgentWidgetMessage, answer: string | Record<string, string | string[]>): Promise<void>;
12147
- /**
12148
- * Collect an auto-resolving LOCAL-tool `await` (`webmcp:*` page tools
12149
- * and the built-in `suggest_replies`) into a per-executionId batch
12150
- * and schedule a single deferred flush. Parallel calls (core#3878) emit
12151
- * several `await`s for ONE paused execution within the same stream tick;
12152
- * buffering them and flushing once lets us post ONE `/resume` keyed by the
12153
- * per-call `webMcpToolCallId` rather than racing N name-keyed resumes on the
12154
- * same execution (which 404'd on the second and hung the turn).
12155
- *
12156
- * Deferred via `queueMicrotask` (epoch-guarded) for the same reason the old
12157
- * direct resolve was: handleEvent must return first so the dispatch's
12158
- * `connectStream` sees end-of-stream and releases the shared abortController
12159
- * before a resolve grabs it.
12160
- *
12161
- * Awaits without an `executionId` or `toolCall.id` can't be batched (no key)
12162
- *: route them straight to the single-call path, which surfaces the malformed
12163
- * wire shape via `onError` / an `isError` resume.
12164
- */
12165
- private enqueueWebMcpAwait;
12166
- /**
12167
- * Flush every buffered local-tool await batch, one `/resume` per executionId.
12168
- * Called once a stream ends (`status: idle` / `error`): by then all parallel
12169
- * `await`s the stream carried have been collected, even if split across
12170
- * SSE chunks. Deferred via `queueMicrotask` (epoch-guarded) so the idle
12171
- * handler returns first and the stream's end-of-stream teardown (streaming /
12172
- * abortController) settles before a resolve grabs them: the same ordering the
12173
- * single-call resolve always relied on.
12174
- */
12175
- private scheduleWebMcpBatchFlush;
12176
- /**
12177
- * Run a buffered batch of local-tool awaits for one executionId. Size 1
12178
- * (single call, or distinct-tool turns that happened to arrive alone) takes
12179
- * the original single-call path; size >1 (parallel calls) takes the batched
12180
- * path that posts ONE `/resume`. The batch is removed from the map up front
12181
- * so any later sibling re-emit (e.g. from a re-pause) forms a fresh batch
12182
- * rather than mutating one already in flight.
12183
- */
12184
- private flushWebMcpAwaitBatch;
12185
- private resolveWebMcpToolStartedAt;
12186
- /**
12187
- * Persisted-resolution guard for `suggest_replies`. The in-memory dedupe
12188
- * sets (`webMcpInflightKeys` / `webMcpResolvedKeys`) are cleared by
12189
- * hydrateMessages/clearMessages/cancel, but `suggestRepliesResolved`
12190
- * survives on the stored message, so a stale `await` re-emit after a
12191
- * hydration must not re-POST `/resume` for an already-resolved call (the
12192
- * historical double-resume failure mode the batching work exists to avoid).
12193
- * Checks the LIVE message first; the handleEvent snapshot is a fresh wire
12194
- * skeleton whose metadata never carries the flag.
12195
- */
12196
- private isSuggestRepliesAlreadyResolved;
12197
- private markWebMcpToolRunning;
12198
- private markWebMcpToolComplete;
12199
- /**
12200
- * Resolve one or more parallel local-tool awaits sharing one paused
12201
- * executionId with a SINGLE `/resume` (core#3878); `resolveWebMcpToolCall`
12202
- * delegates size-1 resolves here after its guards. By default each call is
12203
- * executed against the page registry concurrently: every gated call renders
12204
- * its own native approval bubble, and a sibling's confirm Promise never
12205
- * blocks another's execution. With `webmcp.execution: "sequential"` the
12206
- * calls run one at a time in emission order instead (see the config docs
12207
- * for when that matters). Outputs are keyed by per-call `webMcpToolCallId`
12208
- * (server prefers it over tool name; name-keying remains the fallback for
12209
- * legacy single/distinct-tool turns), so two calls to the SAME tool no longer
12210
- * collide. The server is tolerant: any call we omit (declined-after-abort,
12211
- * dedupe, exec failure) simply re-pauses and is retried on its re-emit.
12212
- *
12213
- * Owns the dedupe / abort / streaming machinery for both routes; resolved
12214
- * keys are marked on the shared resume POST's HTTP OK.
12215
- */
12216
- private resolveWebMcpToolCallBatch;
12217
- /**
12218
- * Resolve a paused auto-resolving LOCAL tool call and post the result to
12219
- * `/resume`: `webmcp:*` calls execute against the host page's tool
12220
- * registry; the built-in `suggest_replies` skips execution entirely and
12221
- * resumes with a canned "shown" result (the chips render from the message
12222
- * list, not from this resolve).
12223
- *
12224
- * Triggered automatically from `handleEvent` when an `await`-derived
12225
- * message arrives for such a tool: the user does not click a pill; the
12226
- * bridge's confirm-bubble gate (WebMCP only) is the only interactive
12227
- * surface.
12228
- *
12229
- * Idempotent on the message's `toolCall.id`: re-emits of the same await
12230
- * (e.g. from message coalescing) won't double-fire `tool.execute`. Failure
12231
- * modes, declined, timed out, throw, unknown tool, all resolve into a
12232
- * `{ isError: true, content: [...] }` payload that resumes the dispatch
12233
- * cleanly so the agent can recover.
12234
- *
12235
- * After the malformed-wire guards this is a thin gate over
12236
- * `resolveWebMcpToolCallBatch` with a size-1 batch: the dedupe check runs
12237
- * synchronously here so a stale re-emit never toggles streaming.
12238
- */
12239
- resolveWebMcpToolCall(toolMessage: AgentWidgetMessage): Promise<void>;
12240
- /**
12241
- * POST `/resume` with a SINGLE tool's output and pipe the resulting SSE
12242
- * stream back through `connectStream`. Shared by every single-call local-tool
12243
- * resolve path (ask_user_question and single WebMCP calls). Parallel WebMCP
12244
- * calls use `resolveWebMcpToolCallBatch`, which posts one resume for many.
12245
- *
12246
- * `resumeKey` is the `toolOutputs` map key: the per-call `webMcpToolCallId`
12247
- * for WebMCP (core#3878), or the tool name for ask_user_question / legacy
12248
- * servers. `onHttpOk` runs synchronously between the HTTP-status check and the
12249
- * stream pipe; it lets the WebMCP resolve path commit the dedupe flag at
12250
- * "server accepted the answer" rather than "stream finished cleanly".
12251
- */
12252
- private resumeWithToolOutput;
12253
- /**
12254
- * Tear down every in-flight WebMCP resolve and advance the epoch. Each
12255
- * resolve owns a dedicated AbortController (chained/parallel resolves don't
12256
- * share one), so we abort them individually; the aborts propagate into the
12257
- * bridge's execute race and into each `/resume` fetch signal. Bumping
12258
- * `webMcpEpoch` strands any resolve still deferred in a queued microtask: * it captured the prior epoch and bails before installing a fresh
12259
- * controller, so it can't escape this teardown. Called from every stop /
12260
- * new-turn boundary (cancel, clearMessages, hydrateMessages, sendMessage).
12261
- */
12262
- private abortWebMcpResolves;
12263
11901
  cancel(): void;
12264
11902
  clearMessages(): void;
12265
11903
  getArtifacts(): PersonaArtifactRecord[];
@@ -12268,68 +11906,9 @@ declare class AgentWidgetSession {
12268
11906
  selectArtifact(id: string | null): void;
12269
11907
  clearArtifacts(): void;
12270
11908
  upsertArtifact(manual: PersonaArtifactManualUpsert): PersonaArtifactRecord;
12271
- /**
12272
- * Injects (or refreshes) the in-thread artifact block for a programmatically
12273
- * upserted artifact, matching the streamed UX: the resolved display mode
12274
- * picks the component ("collapsed"/"panel" → reference card, "inline" → inline
12275
- * preview).
12276
- *
12277
- * Unlike the streamed path (which embeds content on `artifact_complete`),
12278
- * the programmatic record is complete up front, so the final markdown /
12279
- * file meta / component name + props are embedded immediately and the block
12280
- * hydrates after a refresh without the original registry state.
12281
- *
12282
- * A re-upsert of the same id rebuilds the existing block's persisted
12283
- * rawContent in place (the registry is not persisted, so hydration reads
12284
- * these props); without this the block would keep the first version's
12285
- * content after a refresh.
12286
- */
12287
- private injectArtifactRefBlock;
12288
- /**
12289
- * Re-materialize existing transcript artifact blocks after a live display
12290
- * preference update. One messages callback keeps conversion atomic.
12291
- */
12292
- private refreshArtifactReferenceBlocks;
12293
- private clearArtifactState;
12294
- private emitArtifactsState;
12295
- private applyArtifactStreamEvent;
12296
11909
  hydrateMessages(messages: AgentWidgetMessage[]): void;
12297
11910
  hydrateArtifacts(artifacts: PersonaArtifactRecord[], selectedId?: string | null): void;
12298
11911
  private handleEvent;
12299
- /**
12300
- * Record the latest SSE `id:` cursor and (lazily) form/advance the resume
12301
- * handle. Needs an executionId (lifted into `agentExecution` from the same
12302
- * frame's metadata, handled before this trailing cursor event) and the active
12303
- * assistant message id.
12304
- */
12305
- private trackCursor;
12306
- /**
12307
- * The drop gate: is this stream-end a dropped connection we should reconnect,
12308
- * rather than a graceful finish or an intentional `await` pause? ALL must
12309
- * hold (see plan §Design overview keystone 3).
12310
- */
12311
- private isDurableDrop;
12312
- /**
12313
- * True when the run is parked awaiting user input (an unanswered
12314
- * `ask_user_question` / local-tool await, or a pending approval). Those end
12315
- * the stream with `idle` and no terminal too, but are NOT drops.
12316
- */
12317
- private isAwaitPending;
12318
- /**
12319
- * Enter the reconnect flow. Keeps the assistant bubble open and `streaming`
12320
- * true, flips to `resuming`, and kicks the bounded backoff loop. Re-entrant
12321
- * calls (a second drop while reconnecting) are no-ops.
12322
- */
12323
- private beginReconnect;
12324
- /**
12325
- * Lazily import and instantiate the reconnect controller. Cached so repeated
12326
- * reconnects reuse one controller (and one module load). Deliberately kept off
12327
- * every hot path (`sendMessage` / `cancel` / `teardownReconnect`) so a widget
12328
- * that never reconnects never pulls the chunk.
12329
- */
12330
- private loadReconnectController;
12331
- /** The narrow surface the lazily-loaded reconnect loop drives. */
12332
- private buildReconnectHost;
12333
11912
  /** Public manual retry (e.g. a "Reconnect" button). */
12334
11913
  reconnectNow(): void;
12335
11914
  /**
@@ -12341,34 +11920,13 @@ declare class AgentWidgetSession {
12341
11920
  executionId: string;
12342
11921
  after: string;
12343
11922
  }): void;
12344
- /**
12345
- * Reopen the trailing assistant bubble (the persisted partial) so replayed
12346
- * deltas append to it. Returns its id, or null if the last turn doesn't end
12347
- * in a plain assistant message.
12348
- */
12349
- private reopenTrailingAssistant;
12350
- /**
12351
- * Tear down any in-flight/pending reconnect and clear the resume handle. Runs
12352
- * on every new turn / cancel / hydrate, so it must NOT pull the reconnect
12353
- * chunk: it only delegates to the controller if one was already created.
12354
- */
12355
- private teardownReconnect;
12356
- /** Drop the resume handle and notify the host (`onExecutionState(null)`). */
12357
- private clearResumable;
12358
- /**
12359
- * Surface the resume handle to the host for persistence. Immediate on
12360
- * create/clear; trailing-edge throttled on cursor advances so it isn't called
12361
- * per delta.
12362
- */
12363
- private notifyExecutionState;
12364
11923
  /** The current durable resume handle, if any (read-only). */
12365
11924
  getResumableHandle(): ResumableHandle | null;
12366
- private setStatus;
12367
- private setStreaming;
12368
11925
  /**
12369
11926
  * Speak the latest assistant message using the Web Speech API
12370
11927
  * if text-to-speech is enabled in the config.
12371
11928
  */
11929
+ /** `only`: speak it only if the latest assistant message is one of these. */
12372
11930
  private speakLatestAssistantMessage;
12373
11931
  /**
12374
11932
  * Pick the best available English voice from a list of SpeechSynthesisVoices.
@@ -12392,11 +11950,7 @@ declare class AgentWidgetSession {
12392
11950
  * Stop any in-progress text-to-speech / read-aloud playback.
12393
11951
  */
12394
11952
  stopSpeaking(): void;
12395
- private appendMessage;
12396
11953
  private upsertMessage;
12397
- private ensureSequence;
12398
- private nextSequence;
12399
- private sortMessages;
12400
11954
  }
12401
11955
 
12402
11956
  type LoadingIndicatorRenderer = (context: LoadingIndicatorRenderContext) => HTMLElement | null;
@@ -13656,16 +13210,10 @@ interface AttachmentManagerConfig {
13656
13210
  * Creates and manages attachments for the composer
13657
13211
  */
13658
13212
  declare class AttachmentManager {
13213
+ #private;
13659
13214
  private attachments;
13660
13215
  private config;
13661
- private previewsContainer;
13662
- /** In-flight `adapter.add` per attachment id; aborted on remove/clear/destroy. */
13663
- private pendingAdds;
13664
- private destroyed;
13665
13216
  constructor(config?: AttachmentManagerConfig);
13666
- /** True when the host supplied an adapter (tiles then show upload state). */
13667
- private hasCustomAdapter;
13668
- private adapter;
13669
13217
  /**
13670
13218
  * Set the previews container element
13671
13219
  */
@@ -13707,22 +13255,13 @@ declare class AttachmentManager {
13707
13255
  * Handle an array of files (e.g., clipboard image paste)
13708
13256
  */
13709
13257
  handleFiles(files: readonly File[]): Promise<void>;
13710
- /**
13711
- * Run `adapter.add` for one attachment and reconcile the result. Late
13712
- * completions from an aborted or removed attachment write no state and log
13713
- * nothing: the user already moved on.
13714
- */
13715
- private runAdd;
13716
13258
  /** Retry a failed attachment from its error tile. */
13717
13259
  retryAttachment(id: string): void;
13718
- /** Abort an in-flight add without touching the attachment's own state. */
13719
- private abortAdd;
13720
13260
  /**
13721
13261
  * Remove an attachment by ID. Aborts an in-flight upload, and hands a
13722
13262
  * completed one back to the adapter so remote storage can be released.
13723
13263
  */
13724
13264
  removeAttachment(id: string): void;
13725
- private releasePart;
13726
13265
  /**
13727
13266
  * Clear all attachments and abort anything in flight. This is also the
13728
13267
  * post-send path, so it never calls `adapter.remove`: the parts it drops
@@ -13731,18 +13270,6 @@ declare class AttachmentManager {
13731
13270
  clearAttachments(): void;
13732
13271
  /** Abort every in-flight upload and stop accepting new work. */
13733
13272
  destroy(): void;
13734
- private notify;
13735
- /**
13736
- * Render a preview for an attachment (image thumbnail or file icon)
13737
- */
13738
- private renderPreview;
13739
- /** Repaint only the status layer of a live tile; the thumbnail is untouched. */
13740
- private updatePreview;
13741
- private applyPreviewState;
13742
- /**
13743
- * Update the visibility of the previews container
13744
- */
13745
- private updatePreviewsVisibility;
13746
13273
  /**
13747
13274
  * Create an AttachmentManager from widget config
13748
13275
  */
@@ -13786,7 +13313,7 @@ declare const resolveDockConfig: (config?: AgentWidgetConfig) => Required<AgentW
13786
13313
  declare const VERSION: string;
13787
13314
 
13788
13315
  declare class PluginRegistry {
13789
- private plugins;
13316
+ #private;
13790
13317
  /**
13791
13318
  * Register a plugin
13792
13319
  */
@@ -14374,8 +13901,8 @@ interface ComponentRegistrationOptions {
14374
13901
  * Component registry for managing custom components
14375
13902
  */
14376
13903
  declare class ComponentRegistry {
13904
+ #private;
14377
13905
  private components;
14378
- private options;
14379
13906
  /**
14380
13907
  * Register a custom component
14381
13908
  */
@@ -14944,20 +14471,8 @@ interface WebMcpBridgeDeps {
14944
14471
  loadPolyfill: () => Promise<WebMcpPolyfillModule>;
14945
14472
  }
14946
14473
  declare class WebMcpBridge$1 {
14474
+ #private;
14947
14475
  private readonly config;
14948
- private readonly deps;
14949
- private confirmHandler;
14950
- private readonly timeoutMs;
14951
- /** `true` once the polyfill has been (idempotently) installed. */
14952
- private installed;
14953
- /** Memoizes the one-shot async install so concurrent callers share it. */
14954
- private readyPromise;
14955
- /**
14956
- * Warn-once latch for a present-but-incompatible `document.modelContext`
14957
- * (some other / older WebMCP polyfill squatting the global). `getModelContext`
14958
- * is hit on every snapshot + execute, so we log the diagnostic only once.
14959
- */
14960
- private incompatibleContextWarned;
14961
14476
  constructor(config: AgentWidgetWebMcpConfig, deps: WebMcpBridgeDeps);
14962
14477
  /**
14963
14478
  * Override the confirm handler post-construction. Used by `ui.ts` to wire
@@ -15005,26 +14520,6 @@ declare class WebMcpBridge$1 {
15005
14520
  * from firing a host-page side effect with no matching `/resume`.
15006
14521
  */
15007
14522
  executeToolCall(wireToolName: string, args: unknown, signal?: AbortSignal): Promise<WebMcpToolResult>;
15008
- /**
15009
- * Lazily install `@mcp-b/webmcp-polyfill` the first time the bridge needs the
15010
- * registry. Idempotent and memoized. Dynamic import keeps the polyfill out of
15011
- * the main bundle and prevents it from installing `document.modelContext` for
15012
- * widget consumers that never enable WebMCP.
15013
- *
15014
- * Producer pages should still install the polyfill themselves (or import it)
15015
- * before registering tools: Persona's install is a fallback, and a page that
15016
- * registers tools at load before Persona's first dispatch needs the global to
15017
- * already exist.
15018
- */
15019
- private ensureReady;
15020
- private install;
15021
- /**
15022
- * Read the consumer surface off `document.modelContext`, returning `null`
15023
- * when it is absent or doesn't expose the producer-preview API we rely on.
15024
- */
15025
- private getModelContext;
15026
- private requestConfirm;
15027
- private passesClientAllowlist;
15028
14523
  }
15029
14524
 
15030
14525
  /**
@@ -15066,4 +14561,4 @@ interface RovingTablistController {
15066
14561
  }
15067
14562
  declare function createRovingTablist(container: HTMLElement, options: RovingTablistOptions): RovingTablistController;
15068
14563
 
15069
- 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 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 };
14564
+ 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 };