@runtypelabs/persona 3.34.1 → 3.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +11 -11
  2. package/dist/animations/glyph-cycle.d.cts +1 -1
  3. package/dist/animations/glyph-cycle.d.ts +1 -1
  4. package/dist/animations/{types-CthJFfNx.d.cts → types-DgYsuwXL.d.cts} +15 -14
  5. package/dist/animations/{types-CthJFfNx.d.ts → types-DgYsuwXL.d.ts} +15 -14
  6. package/dist/animations/wipe.d.cts +1 -1
  7. package/dist/animations/wipe.d.ts +1 -1
  8. package/dist/codegen.cjs +11 -11
  9. package/dist/codegen.js +10 -10
  10. package/dist/index.cjs +46 -44
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +514 -158
  13. package/dist/index.d.ts +514 -158
  14. package/dist/index.global.js +41 -89
  15. package/dist/index.global.js.map +1 -1
  16. package/dist/index.js +46 -44
  17. package/dist/index.js.map +1 -1
  18. package/dist/install.global.js +1 -1
  19. package/dist/install.global.js.map +1 -1
  20. package/dist/launcher.global.js +2 -2
  21. package/dist/launcher.global.js.map +1 -1
  22. package/dist/markdown-parsers.js +53 -0
  23. package/dist/plugin-kit.d.cts +4 -4
  24. package/dist/plugin-kit.d.ts +4 -4
  25. package/dist/runtype-tts.js +1 -0
  26. package/dist/smart-dom-reader.cjs +1 -1
  27. package/dist/smart-dom-reader.d.cts +352 -103
  28. package/dist/smart-dom-reader.d.ts +352 -103
  29. package/dist/smart-dom-reader.js +1 -1
  30. package/dist/theme-editor-preview.cjs +203 -0
  31. package/dist/theme-editor-preview.d.cts +5748 -0
  32. package/dist/theme-editor-preview.d.ts +5748 -0
  33. package/dist/theme-editor-preview.js +203 -0
  34. package/dist/theme-editor.cjs +14 -131
  35. package/dist/theme-editor.d.cts +362 -574
  36. package/dist/theme-editor.d.ts +362 -574
  37. package/dist/theme-editor.js +14 -131
  38. package/dist/theme-reference.cjs +1 -1
  39. package/dist/theme-reference.d.cts +1 -1
  40. package/dist/theme-reference.d.ts +1 -1
  41. package/dist/theme-reference.js +1 -1
  42. package/dist/voice-worklet-player.cjs +80 -0
  43. package/dist/voice-worklet-player.d.cts +215 -0
  44. package/dist/voice-worklet-player.d.ts +215 -0
  45. package/dist/voice-worklet-player.js +80 -0
  46. package/dist/widget.css +54 -36
  47. package/package.json +16 -2
  48. package/src/animations/glyph-cycle.ts +11 -14
  49. package/src/animations/wipe.ts +1 -1
  50. package/src/ask-user-question-tool.test.ts +1 -1
  51. package/src/ask-user-question-tool.ts +6 -8
  52. package/src/client.test.ts +12 -12
  53. package/src/client.ts +30 -31
  54. package/src/codegen.test.ts +1 -1
  55. package/src/codegen.ts +1 -1
  56. package/src/components/approval-bubble.test.ts +1 -1
  57. package/src/components/approval-bubble.ts +3 -3
  58. package/src/components/artifact-pane.ts +3 -3
  59. package/src/components/ask-user-question-bubble.test.ts +14 -14
  60. package/src/components/ask-user-question-bubble.ts +10 -10
  61. package/src/components/composer-builder.ts +17 -16
  62. package/src/components/composer-parts.test.ts +54 -0
  63. package/src/components/composer-parts.ts +95 -126
  64. package/src/components/demo-carousel.ts +1 -1
  65. package/src/components/event-stream-view.test.ts +7 -7
  66. package/src/components/event-stream-view.ts +5 -5
  67. package/src/components/header-builder.ts +33 -27
  68. package/src/components/header-layouts.ts +1 -1
  69. package/src/components/header-parts.test.ts +90 -0
  70. package/src/components/header-parts.ts +62 -93
  71. package/src/components/launcher.test.ts +11 -0
  72. package/src/components/launcher.ts +1 -1
  73. package/src/components/message-bubble.test.ts +74 -2
  74. package/src/components/message-bubble.ts +25 -11
  75. package/src/components/messages.ts +2 -2
  76. package/src/components/panel.test.ts +1 -1
  77. package/src/components/panel.ts +92 -97
  78. package/src/components/pill-composer-builder.ts +28 -24
  79. package/src/components/reasoning-bubble.ts +2 -2
  80. package/src/components/suggestions.ts +1 -1
  81. package/src/components/tool-bubble.ts +1 -1
  82. package/src/components/widget-view.test.ts +181 -0
  83. package/src/components/widget-view.ts +234 -0
  84. package/src/defaults.ts +54 -51
  85. package/src/generated/runtype-openapi-contract.ts +5 -0
  86. package/src/index-core.ts +30 -4
  87. package/src/index-global.ts +73 -6
  88. package/src/index.ts +7 -1
  89. package/src/install.test.ts +11 -11
  90. package/src/install.ts +28 -18
  91. package/src/launcher-global.ts +25 -14
  92. package/src/markdown-parsers-eager.ts +20 -0
  93. package/src/markdown-parsers-entry.ts +4 -0
  94. package/src/markdown-parsers-loader.ts +49 -0
  95. package/src/plugin-kit.test.ts +1 -1
  96. package/src/plugin-kit.ts +7 -7
  97. package/src/plugins/types.ts +5 -5
  98. package/src/postprocessors.ts +27 -14
  99. package/src/runtime/host-layout.test.ts +1 -1
  100. package/src/runtime/host-layout.ts +4 -5
  101. package/src/runtime/init.ts +2 -2
  102. package/src/session.test.ts +5 -6
  103. package/src/session.ts +333 -227
  104. package/src/session.voice.test.ts +146 -0
  105. package/src/session.webmcp.test.ts +24 -25
  106. package/src/smart-dom-reader.ts +3 -4
  107. package/src/styles/widget.css +54 -36
  108. package/src/suggest-replies-tool.test.ts +3 -3
  109. package/src/suggest-replies-tool.ts +5 -5
  110. package/src/testing/index.ts +1 -1
  111. package/src/theme-editor/color-utils.ts +2 -2
  112. package/src/theme-editor/index.ts +4 -13
  113. package/src/theme-editor/presets.ts +1 -1
  114. package/src/theme-editor/preview-utils.ts +22 -20
  115. package/src/theme-editor/preview.ts +4 -1
  116. package/src/theme-editor/role-mappings.ts +3 -3
  117. package/src/theme-editor/sections.ts +21 -20
  118. package/src/theme-editor/types.ts +1 -1
  119. package/src/theme-editor/webmcp/index.ts +1 -1
  120. package/src/theme-editor/webmcp/summary.ts +1 -2
  121. package/src/theme-editor/webmcp/tools.ts +30 -30
  122. package/src/theme-editor/webmcp/types.ts +2 -2
  123. package/src/theme-editor-preview.ts +10 -0
  124. package/src/theme-reference.ts +26 -26
  125. package/src/types.ts +368 -99
  126. package/src/ui.approval-plugin.test.ts +3 -3
  127. package/src/ui.ask-user-question-plugin.test.ts +9 -9
  128. package/src/ui.component-directive.test.ts +4 -4
  129. package/src/ui.composer-bar.test.ts +10 -11
  130. package/src/ui.composer-keyboard.test.ts +5 -5
  131. package/src/ui.header-icon-color.test.ts +59 -0
  132. package/src/ui.scroll.test.ts +5 -6
  133. package/src/ui.stop-button.test.ts +3 -4
  134. package/src/ui.suggest-replies.test.ts +2 -2
  135. package/src/ui.ts +292 -131
  136. package/src/utils/buttons.ts +1 -1
  137. package/src/utils/code-generators.ts +1 -1
  138. package/src/utils/composer-history.ts +3 -3
  139. package/src/utils/dom-context.test.ts +2 -2
  140. package/src/utils/dom-context.ts +7 -7
  141. package/src/utils/dom.test.ts +67 -0
  142. package/src/utils/dom.ts +75 -0
  143. package/src/utils/dropdown.ts +2 -2
  144. package/src/utils/event-stream-buffer.test.ts +2 -2
  145. package/src/utils/message-fingerprint.test.ts +9 -0
  146. package/src/utils/message-fingerprint.ts +5 -0
  147. package/src/utils/morph.ts +1 -1
  148. package/src/utils/sanitize.ts +32 -16
  149. package/src/utils/sequence-buffer.test.ts +8 -8
  150. package/src/utils/sequence-buffer.ts +4 -4
  151. package/src/utils/smart-dom-adapter.test.ts +1 -1
  152. package/src/utils/smart-dom-adapter.ts +4 -5
  153. package/src/utils/speech-text.test.ts +122 -0
  154. package/src/utils/speech-text.ts +101 -0
  155. package/src/utils/stream-animation.test.ts +3 -3
  156. package/src/utils/stream-animation.ts +6 -6
  157. package/src/utils/theme.test.ts +1 -1
  158. package/src/utils/throughput-tracker.test.ts +11 -11
  159. package/src/utils/throughput-tracker.ts +9 -9
  160. package/src/utils/tokens.ts +13 -13
  161. package/src/utils/virtual-scroller.ts +1 -1
  162. package/src/vendor/smart-dom-reader/README.md +4 -4
  163. package/src/vendor/smart-dom-reader/index.d.ts +1 -1
  164. package/src/vendor/smart-dom-reader/index.js +2 -2
  165. package/src/version.ts +1 -1
  166. package/src/voice/audio-playback-manager.test.ts +159 -0
  167. package/src/voice/audio-playback-manager.ts +145 -30
  168. package/src/voice/browser-speech-engine.ts +130 -0
  169. package/src/voice/fallback-speech-engine.ts +89 -0
  170. package/src/voice/index.ts +21 -0
  171. package/src/voice/read-aloud-controller.test.ts +143 -0
  172. package/src/voice/read-aloud-controller.ts +136 -0
  173. package/src/voice/runtype-speech-engine.test.ts +280 -0
  174. package/src/voice/runtype-speech-engine.ts +211 -0
  175. package/src/voice/runtype-tts-entry.ts +10 -0
  176. package/src/voice/runtype-tts-loader.test.ts +47 -0
  177. package/src/voice/runtype-tts-loader.ts +42 -0
  178. package/src/voice/runtype-voice-provider.ts +332 -537
  179. package/src/voice/voice-factory.ts +26 -4
  180. package/src/voice/voice.test.ts +321 -7
  181. package/src/voice/worklet-playback-engine.ts +272 -0
  182. package/src/voice-worklet-player.ts +39 -0
  183. package/src/webmcp-bridge.test.ts +6 -6
  184. package/src/webmcp-bridge.ts +24 -25
  185. package/src/webmcp-polyfill.ts +1 -1
  186. package/src/voice/voice-activity-detector.ts +0 -90
@@ -33,7 +33,7 @@ const parseDockWidthToPx = (width: string, shellClientWidth: number): number =>
33
33
  * the dock column would grow with the conversation and scroll off the page.
34
34
  * Clamping the slot keeps the panel viewport-sized (messages scroll
35
35
  * internally) even when the page's height chain is missing. `100vh` is set
36
- * first as a fallback for engines without `dvh` support an invalid value
36
+ * first as a fallback for engines without `dvh` support: an invalid value
37
37
  * leaves the previous one in place.
38
38
  */
39
39
  const applyDockSlotMaxHeight = (
@@ -372,7 +372,7 @@ const applyDockStyles = (
372
372
  // the containing block for any `position: fixed` descendant, so host pages
373
373
  // that render viewport-fixed chrome inside the pushed content (e.g. the
374
374
  // dashboard editor's `fixed top-0 right-0` toolbar) resolve `right: 0`
375
- // against the track's right edge `panelPx` past the viewport, off-screen.
375
+ // against the track's right edge: `panelPx` past the viewport, off-screen.
376
376
  // `margin-left` produces the identical visual offset (the track is clipped
377
377
  // by the overflow:hidden shell) without establishing a containing block for
378
378
  // fixed OR absolutely-positioned descendants.
@@ -395,8 +395,7 @@ const applyDockStyles = (
395
395
  pushTrack.style.width = `${contentPx + panelPx}px`;
396
396
  pushTrack.style.transition = dockTransition;
397
397
  pushTrack.style.marginLeft = `${marginOffsetPx}px`;
398
- // Defensively clear any transform a previous reveal mode may have set
399
- // leaving one would re-establish the fixed-position containing block.
398
+ // Defensively clear any transform a previous reveal mode may have set: // leaving one would re-establish the fixed-position containing block.
400
399
  pushTrack.style.transform = "";
401
400
 
402
401
  contentSlot.style.flex = "0 0 auto";
@@ -536,7 +535,7 @@ const createDockedLayout = (target: HTMLElement, config?: AgentWidgetConfig): Wi
536
535
  syncPushResizeObserver();
537
536
  // Check the height chain once, the first time the panel is actually shown
538
537
  // in a layout that depends on it (mobile fullscreen is fixed-position and
539
- // doesn't keep checking until a dependent layout comes around).
538
+ // doesn't: keep checking until a dependent layout comes around).
540
539
  if (
541
540
  expanded &&
542
541
  !heightChainChecked &&
@@ -161,7 +161,7 @@ export const initAgentWidget = (
161
161
 
162
162
  mountController();
163
163
  // Fired when the controller is mounted and its API is callable. `onReady` is
164
- // the deprecated alias of `onChatReady` (removed next major) warn once.
164
+ // the deprecated alias of `onChatReady` (removed next major): warn once.
165
165
  if (options.onChatReady) {
166
166
  options.onChatReady();
167
167
  } else if (options.onReady) {
@@ -169,7 +169,7 @@ export const initAgentWidget = (
169
169
  warnedOnReadyDeprecated = true;
170
170
  // eslint-disable-next-line no-console
171
171
  console.warn(
172
- "[Persona] `onReady` is deprecated use `onChatReady`. `onReady` still works but is removed in the next major."
172
+ "[Persona] `onReady` is deprecated: use `onChatReady`. `onReady` still works but is removed in the next major."
173
173
  );
174
174
  }
175
175
  options.onReady();
@@ -379,8 +379,7 @@ describe('AgentWidgetSession - cancel()', () => {
379
379
 
380
380
  it('aborts the in-flight dispatch and flips streaming/status back to idle', async () => {
381
381
  let capturedSignal: AbortSignal | null = null;
382
- // Fetch returns a promise that only settles when the AbortSignal fires
383
- // modeling a dispatch that's still receiving SSE tokens.
382
+ // Fetch returns a promise that only settles when the AbortSignal fires: // modeling a dispatch that's still receiving SSE tokens.
384
383
  global.fetch = vi.fn().mockImplementation((_url: string, options: any) => {
385
384
  capturedSignal = options.signal as AbortSignal;
386
385
  return new Promise((_resolve, reject) => {
@@ -403,7 +402,7 @@ describe('AgentWidgetSession - cancel()', () => {
403
402
  }
404
403
  );
405
404
 
406
- // Kick off the dispatch but don't await we want it in-flight when we cancel.
405
+ // Kick off the dispatch but don't await: we want it in-flight when we cancel.
407
406
  const dispatchPromise = session.sendMessage('Hello');
408
407
  // Let the session set up the AbortController and call fetch.
409
408
  await Promise.resolve();
@@ -554,7 +553,7 @@ describe('AgentWidgetSession.resolveAskUserQuestion', () => {
554
553
 
555
554
  vi.spyOn(session, 'connectStream').mockResolvedValue(undefined);
556
555
 
557
- // Capture the flag state at the exact moment fetch is called this is
556
+ // Capture the flag state at the exact moment fetch is called: this is
558
557
  // the "before the POST fires" assertion. The flag must be flipped BEFORE
559
558
  // any network I/O so the subsequent stream-driven renders skip the sheet.
560
559
  let flagAtFetch: { awaiting?: boolean; answered?: boolean } | undefined;
@@ -666,7 +665,7 @@ describe('AgentWidgetSession.resolveAskUserQuestion', () => {
666
665
 
667
666
  vi.spyOn(session, 'connectStream').mockResolvedValue(undefined);
668
667
 
669
- // Kick off don't await.
668
+ // Kick off: don't await.
670
669
  const resolvePromise = session.resolveAskUserQuestion(awaiting, 'Hobbyists');
671
670
 
672
671
  // Yield a microtask so synchronous setup (markResolved → setStreaming(true)
@@ -920,7 +919,7 @@ describe('AgentWidgetSession - approval context across agent_approval_complete',
920
919
  }
921
920
  );
922
921
 
923
- // `agent_approval_complete` carries only the resolution none of the
922
+ // `agent_approval_complete` carries only the resolution: none of the
924
923
  // context fields from `agent_approval_start`. The session merge must keep
925
924
  // them so a full re-render of the resolved bubble (morph, virtual-scroll
926
925
  // re-mount, storage restore) still shows the tool, description, and the