@runtypelabs/persona 4.7.0 → 4.9.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 (185) hide show
  1. package/README.md +1 -0
  2. package/dist/animations/glyph-cycle.cjs +2 -2
  3. package/dist/animations/glyph-cycle.d.cts +1 -1
  4. package/dist/animations/glyph-cycle.d.ts +1 -1
  5. package/dist/animations/glyph-cycle.js +2 -2
  6. package/dist/animations/{types-CSmiKRVa.d.cts → types-4ROVJ1gA.d.cts} +85 -3
  7. package/dist/animations/{types-CSmiKRVa.d.ts → types-4ROVJ1gA.d.ts} +85 -3
  8. package/dist/animations/wipe.cjs +2 -2
  9. package/dist/animations/wipe.d.cts +1 -1
  10. package/dist/animations/wipe.d.ts +1 -1
  11. package/dist/chunk-5EIIHQLQ.js +1 -0
  12. package/dist/chunk-IO5VVUKP.js +3 -0
  13. package/dist/chunk-IPVK3KOM.js +1 -0
  14. package/dist/chunk-UPO4GUFC.js +1 -0
  15. package/dist/codegen.cjs +13 -13
  16. package/dist/codegen.js +14 -14
  17. package/dist/context-mentions-7S5KVUTG.js +169 -0
  18. package/dist/context-mentions-inline-TTCN7ZM2.js +4 -0
  19. package/dist/context-mentions-inline.cjs +4 -0
  20. package/dist/context-mentions-inline.d.cts +203 -0
  21. package/dist/context-mentions-inline.d.ts +203 -0
  22. package/dist/context-mentions-inline.js +4 -0
  23. package/dist/context-mentions.cjs +295 -0
  24. package/dist/context-mentions.d.cts +7025 -0
  25. package/dist/context-mentions.d.ts +7025 -0
  26. package/dist/context-mentions.js +295 -0
  27. package/dist/index.cjs +99 -68
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +1507 -182
  30. package/dist/index.d.ts +1507 -182
  31. package/dist/index.global.js +88 -56
  32. package/dist/index.global.js.map +1 -1
  33. package/dist/index.js +99 -68
  34. package/dist/index.js.map +1 -1
  35. package/dist/install.global.js +1 -1
  36. package/dist/install.global.js.map +1 -1
  37. package/dist/launcher.global.js +3 -2
  38. package/dist/launcher.global.js.map +1 -1
  39. package/dist/markdown-parsers.js +24 -24
  40. package/dist/plugin-kit.cjs +1 -1
  41. package/dist/plugin-kit.d.cts +17 -0
  42. package/dist/plugin-kit.d.ts +17 -0
  43. package/dist/plugin-kit.js +1 -1
  44. package/dist/runtype-tts-entry-UJAEF7NZ.js +1 -0
  45. package/dist/runtype-tts.js +1 -1
  46. package/dist/session-reconnect-JKIJBHS5.js +1 -0
  47. package/dist/smart-dom-reader.cjs +18 -17
  48. package/dist/smart-dom-reader.d.cts +1260 -16
  49. package/dist/smart-dom-reader.d.ts +1260 -16
  50. package/dist/smart-dom-reader.js +18 -17
  51. package/dist/testing.cjs +3 -3
  52. package/dist/testing.js +3 -3
  53. package/dist/theme-editor-preview.cjs +260 -58
  54. package/dist/theme-editor-preview.d.cts +1234 -15
  55. package/dist/theme-editor-preview.d.ts +1234 -15
  56. package/dist/theme-editor-preview.js +87 -58
  57. package/dist/theme-editor.cjs +10 -10
  58. package/dist/theme-editor.d.cts +1226 -15
  59. package/dist/theme-editor.d.ts +1226 -15
  60. package/dist/theme-editor.js +10 -10
  61. package/dist/theme-reference.cjs +1 -1
  62. package/dist/theme-reference.d.cts +76 -0
  63. package/dist/theme-reference.d.ts +76 -0
  64. package/dist/theme-reference.js +1 -1
  65. package/dist/voice-worklet-player.cjs +2 -2
  66. package/dist/voice-worklet-player.js +2 -2
  67. package/dist/webmcp-polyfill.js +2 -2
  68. package/dist/widget.css +1 -1
  69. package/package.json +16 -5
  70. package/src/artifacts-session.test.ts +178 -0
  71. package/src/client.test.ts +255 -1
  72. package/src/client.ts +157 -60
  73. package/src/components/artifact-card.test.ts +333 -0
  74. package/src/components/artifact-card.ts +75 -28
  75. package/src/components/artifact-inline.test.ts +1328 -0
  76. package/src/components/artifact-inline.ts +920 -0
  77. package/src/components/artifact-pane.test.ts +1042 -0
  78. package/src/components/artifact-pane.ts +440 -131
  79. package/src/components/artifact-preview.test.ts +1155 -0
  80. package/src/components/artifact-preview.ts +994 -0
  81. package/src/components/composer-parts.ts +3 -12
  82. package/src/components/context-mention-button.test.ts +70 -0
  83. package/src/components/context-mention-button.ts +82 -0
  84. package/src/components/context-mention-chip.ts +134 -0
  85. package/src/components/context-mention-menu.test.ts +508 -0
  86. package/src/components/context-mention-menu.ts +0 -0
  87. package/src/components/message-bubble.test.ts +175 -0
  88. package/src/components/message-bubble.ts +177 -19
  89. package/src/components/panel.ts +7 -10
  90. package/src/components/pill-composer-builder.test.ts +6 -2
  91. package/src/components/pill-composer-builder.ts +6 -6
  92. package/src/components/reasoning-bubble.ts +1 -13
  93. package/src/components/registry.ts +38 -3
  94. package/src/components/tool-bubble.ts +1 -13
  95. package/src/context-mentions-bundle.test.ts +163 -0
  96. package/src/context-mentions-entry.ts +185 -0
  97. package/src/context-mentions-inline-entry.test.ts +136 -0
  98. package/src/context-mentions-inline-entry.ts +226 -0
  99. package/src/context-mentions-inline-loader.test.ts +30 -0
  100. package/src/context-mentions-inline-loader.ts +36 -0
  101. package/src/context-mentions-inline.ts +15 -0
  102. package/src/context-mentions-loader.ts +32 -0
  103. package/src/context-mentions.ts +16 -0
  104. package/src/defaults.ts +1 -0
  105. package/src/generated/runtype-openapi-contract.ts +55 -3
  106. package/src/index-core.ts +46 -1
  107. package/src/index-global.ts +51 -0
  108. package/src/index.ts +8 -0
  109. package/src/markdown-parsers-loader.test.ts +158 -0
  110. package/src/markdown-parsers-loader.ts +83 -27
  111. package/src/plugin-kit.test.ts +40 -0
  112. package/src/plugin-kit.ts +39 -5
  113. package/src/runtime/host-layout.test.ts +163 -0
  114. package/src/runtime/host-layout.ts +110 -7
  115. package/src/runtime/init.ts +18 -61
  116. package/src/session.mentions.test.ts +175 -0
  117. package/src/session.test.ts +52 -4
  118. package/src/session.ts +197 -27
  119. package/src/smart-dom-reader.test.ts +129 -2
  120. package/src/smart-dom-reader.ts +127 -1
  121. package/src/styles/context-mention-menu-css.ts +176 -0
  122. package/src/styles/widget.css +1002 -152
  123. package/src/theme-editor/preview.ts +2 -0
  124. package/src/theme-editor/sections.test.ts +26 -1
  125. package/src/theme-editor/sections.ts +13 -5
  126. package/src/theme-reference.ts +2 -2
  127. package/src/tool-call-display-defaults.test.ts +1 -0
  128. package/src/types/theme.ts +79 -0
  129. package/src/types.ts +1041 -17
  130. package/src/ui.artifact-pane-gating.test.ts +636 -0
  131. package/src/ui.component-directive.test.ts +104 -0
  132. package/src/ui.composer-bar.test.ts +60 -2
  133. package/src/ui.detached-panel.test.ts +1049 -0
  134. package/src/ui.mention-submit.test.ts +235 -0
  135. package/src/ui.tool-display.test.ts +51 -0
  136. package/src/ui.ts +998 -159
  137. package/src/utils/artifact-custom-actions.ts +128 -0
  138. package/src/utils/artifact-display.test.ts +42 -0
  139. package/src/utils/artifact-display.ts +84 -0
  140. package/src/utils/artifact-file.test.ts +116 -0
  141. package/src/utils/artifact-file.ts +117 -0
  142. package/src/utils/artifact-gate.test.ts +112 -5
  143. package/src/utils/artifact-gate.ts +39 -14
  144. package/src/utils/artifact-loading-status.ts +55 -0
  145. package/src/utils/artifact-status-label.ts +190 -0
  146. package/src/utils/buttons.ts +7 -1
  147. package/src/utils/chunk-loader.test.ts +97 -0
  148. package/src/utils/chunk-loader.ts +88 -0
  149. package/src/utils/code-highlight.test.ts +186 -0
  150. package/src/utils/code-highlight.ts +400 -0
  151. package/src/utils/composer-contenteditable.test.ts +507 -0
  152. package/src/utils/composer-contenteditable.ts +626 -0
  153. package/src/utils/composer-document.test.ts +280 -0
  154. package/src/utils/composer-document.ts +293 -0
  155. package/src/utils/composer-history.test.ts +35 -7
  156. package/src/utils/composer-history.ts +30 -20
  157. package/src/utils/composer-input.ts +159 -0
  158. package/src/utils/context-mention-controller.test.ts +1215 -0
  159. package/src/utils/context-mention-controller.ts +1186 -0
  160. package/src/utils/context-mention-manager.test.ts +422 -0
  161. package/src/utils/context-mention-manager.ts +410 -0
  162. package/src/utils/context-mention-orchestrator.test.ts +538 -0
  163. package/src/utils/context-mention-orchestrator.ts +348 -0
  164. package/src/utils/icons.ts +2 -0
  165. package/src/utils/live-region.test.ts +108 -0
  166. package/src/utils/live-region.ts +94 -0
  167. package/src/utils/mention-channels.ts +63 -0
  168. package/src/utils/mention-llm-format.test.ts +91 -0
  169. package/src/utils/mention-llm-format.ts +79 -0
  170. package/src/utils/mention-matcher.test.ts +86 -0
  171. package/src/utils/mention-matcher.ts +221 -0
  172. package/src/utils/mention-token.ts +72 -0
  173. package/src/utils/mention-trigger.test.ts +155 -0
  174. package/src/utils/mention-trigger.ts +156 -0
  175. package/src/utils/roving-tablist.test.ts +152 -0
  176. package/src/utils/roving-tablist.ts +111 -0
  177. package/src/utils/spinner.ts +45 -0
  178. package/src/utils/theme.test.ts +76 -4
  179. package/src/utils/theme.ts +7 -0
  180. package/src/utils/tokens.ts +118 -11
  181. package/src/utils/tool-loading-animation.test.ts +32 -0
  182. package/src/utils/tool-loading-animation.ts +24 -0
  183. package/dist/chunk-DFBSCFYN.js +0 -1
  184. package/dist/runtype-tts-entry-HFUV2UF7.js +0 -1
  185. package/dist/session-reconnect-U77QFUR7.js +0 -1
package/README.md CHANGED
@@ -121,6 +121,7 @@ The full reference lives in [`docs/`](./docs/) and the theming guide:
121
121
  - [UI Features & Components](./docs/UI-COMPONENTS.md): message actions and feedback, loading/idle indicators, approvals, built-in `ask_user_question` and `suggest_replies` tools, dropdown menus, button utilities, dynamic forms
122
122
  - [Script Tag Installation & Framework Integration](./docs/INSTALLATION-FRAMEWORKS.md): automatic installer, deferred launcher lifecycle hooks, manual script tag setup, React, Next.js, Remix, Gatsby, and Astro guides
123
123
  - [Configuration Reference](./docs/CONFIGURATION-REFERENCE.md): every config option: core, client token mode, agent mode, UI & theme, launcher/docking, layout, voice, WebMCP, tool calls, features, suggestion chips, state & storage
124
+ - [Context Mentions](./docs/CONTEXT-MENTIONS.md): `@`-mention sources, resolve lifecycle, chip vs inline display, menu positioning, slash commands, and render overrides
124
125
  - [Stream Parser Configuration](./docs/STREAM-PARSERS.md): JSON, XML, and plain-text stream parsers and custom parser factories
125
126
  - [Message Injection](./docs/MESSAGE-INJECTION.md): full injection and component-directive reference
126
127
  - [Dynamic Forms](./docs/DYNAMIC-FORMS.md): field schema, form styles, and recipes
@@ -1,4 +1,4 @@
1
- "use strict";var d=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var W=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},R=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of P(t))!H.call(e,a)&&a!==n&&d(e,a,{get:()=>t[a],enumerable:!(r=L(t,a))||r.enumerable});return e};var N=e=>R(d({},"__esModule",{value:!0}),e);var J={};W(J,{default:()=>X,glyphCycle:()=>g});module.exports=N(J);var k=[{name:"typewriter",containerClass:"persona-stream-typewriter",wrap:"char",useCaret:!0},{name:"pop-bubble",bubbleClass:"persona-stream-pop",wrap:"none"},{name:"letter-rise",containerClass:"persona-stream-letter-rise",wrap:"char"},{name:"word-fade",containerClass:"persona-stream-word-fade",wrap:"word"}],f=new Map;for(let e of k)f.set(e.name,e);var A=e=>{f.set(e.name,e)};var D=`
1
+ "use strict";var m=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var H=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},W=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of L(t))!P.call(e,a)&&a!==n&&m(e,a,{get:()=>t[a],enumerable:!(r=v(t,a))||r.enumerable});return e};var R=e=>W(m({},"__esModule",{value:!0}),e);var X={};H(X,{default:()=>q,glyphCycle:()=>p});module.exports=R(X);var N=[{name:"typewriter",containerClass:"persona-stream-typewriter",wrap:"char",useCaret:!0},{name:"pop-bubble",bubbleClass:"persona-stream-pop",wrap:"none"},{name:"letter-rise",containerClass:"persona-stream-letter-rise",wrap:"char"},{name:"word-fade",containerClass:"persona-stream-word-fade",wrap:"word"}],f=new Map;for(let e of N)f.set(e.name,e);var h=e=>{f.set(e.name,e)};var k=`
2
2
  [data-persona-root] .persona-stream-glyph-cycle .persona-stream-char {
3
3
  animation: persona-stream-glyph-cycle-fade
4
4
  calc(var(--persona-stream-step, 120ms) * 1.5) ease-out both;
@@ -16,4 +16,4 @@
16
16
  opacity: 1 !important;
17
17
  }
18
18
  }
19
- `.trim(),l="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$%&@",_=10,I=120,u=120,F=.4,B=50,O=e=>{var r;if(!e)return u;let n=((r=e.style.getPropertyValue("--persona-stream-step"))==null?void 0:r.trim()).match(/([\d.]+)\s*ms/);return n?parseFloat(n[1]):u},x=e=>{let t=e.closest(".persona-stream-glyph-cycle"),n=O(t);return I*n/u},p=e=>{let t=l[Math.floor(Math.random()*l.length)];return e&&t===e&&(t=l[(l.indexOf(t)+1)%l.length]),t},G=e=>{let t=e.closest(".persona-stream-glyph-cycle");if(!t)return;let n=t.querySelectorAll(".persona-stream-char[data-glyph-cycle-final]"),r=!1;for(let a of Array.from(n)){if(a===e){r=!0;continue}r&&Math.random()<F&&(a.textContent=p())}},S=new WeakMap,T=25,C=.5,U=6,M=.25,w=new WeakMap,E=new WeakMap,$=(e,t)=>{var a;if(!e)return T*C;let n=w.get(e);w.set(e,t);let r=(a=E.get(e))!=null?a:T;if(n!==void 0){let s=t-n;s>1&&(r=r*(1-M)+s*M,E.set(e,r))}return Math.max(U,r*C)},i=new Map,j=e=>{var n;let t=e.closest("[data-message-id]");return(n=t==null?void 0:t.dataset.messageId)!=null?n:null},K=e=>{var t;e&&i.set(e,((t=i.get(e))!=null?t:0)+1)},V=e=>{var n;if(!e)return;let t=(n=i.get(e))!=null?n:0;t<=1?i.delete(e):i.set(e,t-1)},v=e=>{var h;if(e.dataset.glyphCycleScheduled==="true")return;let t=(h=e.textContent)!=null?h:"";if(!t||/\s/.test(t))return;e.dataset.glyphCycleScheduled="true",e.dataset.glyphCycleFinal=t,e.setAttribute("data-preserve-runtime","stream-glyph-cycle"),e.textContent=p();let n=j(e);n&&(e.dataset.glyphCycleMessageId=n),K(n);let r=e.closest(".persona-stream-glyph-cycle"),a=Date.now(),s=$(r,a),c=x(e),m=_*c,o=a+m;if(r){let y=S.get(r);y!==void 0&&(o=Math.max(o,y)),S.set(r,o+s)}Y(e,t,o)},Y=(e,t,n)=>{var c;if(e.dataset.glyphCycleStarted==="true")return;e.dataset.glyphCycleStarted="true";let r=x(e),a=(c=e.textContent)!=null?c:void 0,s=()=>{var o;if(!e.isConnected)return;if(Date.now()>=n){e.textContent=t,e.removeAttribute("data-preserve-runtime"),delete e.dataset.glyphCycleStarted,delete e.dataset.glyphCycleFinal,V((o=e.dataset.glyphCycleMessageId)!=null?o:null),delete e.dataset.glyphCycleMessageId;return}let m=p(a);e.textContent=m,a=m,G(e),setTimeout(s,r)};setTimeout(s,r)},b=e=>{var n;let t=(n=e.querySelectorAll)==null?void 0:n.call(e,".persona-stream-glyph-cycle .persona-stream-char:not([data-glyph-cycle-scheduled])");if(t)for(let r of Array.from(t))v(r)},q=e=>e.nodeType===1,g={name:"glyph-cycle",containerClass:"persona-stream-glyph-cycle",wrap:"char",skipTags:["a","script","style"],styles:D,bufferContent(e){if(e.length<B)return"";let t=0,n=-1,r=0;for(;r<e.length;){if(e[r]==="*"&&e[r+1]==="*"){t+=1,r+=2;continue}/\s/.test(e[r])&&t%2===0&&(n=r),r+=1}return n<0?"":e.slice(0,n)},isAnimating(e){var t;return((t=i.get(e.id))!=null?t:0)>0},onAttach(e){b(e);let t=new MutationObserver(n=>{for(let r of n)for(let a of Array.from(r.addedNodes))q(a)&&(a.classList.contains("persona-stream-char")&&a.closest(".persona-stream-glyph-cycle")?v(a):b(a))});return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}};A(g);var X=g;0&&(module.exports={glyphCycle});
19
+ `.trim(),s="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$%&@",D=10,_=120,u=120,I=.4,F=50,B=e=>{if(!e)return u;let n=(e.style.getPropertyValue("--persona-stream-step")?.trim()).match(/([\d.]+)\s*ms/);return n?parseFloat(n[1]):u},w=e=>{let t=e.closest(".persona-stream-glyph-cycle"),n=B(t);return _*n/u},d=e=>{let t=s[Math.floor(Math.random()*s.length)];return e&&t===e&&(t=s[(s.indexOf(t)+1)%s.length]),t},O=e=>{let t=e.closest(".persona-stream-glyph-cycle");if(!t)return;let n=t.querySelectorAll(".persona-stream-char[data-glyph-cycle-final]"),r=!1;for(let a of Array.from(n)){if(a===e){r=!0;continue}r&&Math.random()<I&&(a.textContent=d())}},y=new WeakMap,A=25,S=.5,G=6,T=.25,b=new WeakMap,C=new WeakMap,U=(e,t)=>{if(!e)return A*S;let n=b.get(e);b.set(e,t);let r=C.get(e)??A;if(n!==void 0){let a=t-n;a>1&&(r=r*(1-T)+a*T,C.set(e,r))}return Math.max(G,r*S)},o=new Map,$=e=>e.closest("[data-message-id]")?.dataset.messageId??null,j=e=>{e&&o.set(e,(o.get(e)??0)+1)},K=e=>{if(!e)return;let t=o.get(e)??0;t<=1?o.delete(e):o.set(e,t-1)},E=e=>{if(e.dataset.glyphCycleScheduled==="true")return;let t=e.textContent??"";if(!t||/\s/.test(t))return;e.dataset.glyphCycleScheduled="true",e.dataset.glyphCycleFinal=t,e.setAttribute("data-preserve-runtime","stream-glyph-cycle"),e.textContent=d();let n=$(e);n&&(e.dataset.glyphCycleMessageId=n),j(n);let r=e.closest(".persona-stream-glyph-cycle"),a=Date.now(),i=U(r,a),l=w(e),x=D*l,c=a+x;if(r){let g=y.get(r);g!==void 0&&(c=Math.max(c,g)),y.set(r,c+i)}V(e,t,c)},V=(e,t,n)=>{if(e.dataset.glyphCycleStarted==="true")return;e.dataset.glyphCycleStarted="true";let r=w(e),a=e.textContent??void 0,i=()=>{if(!e.isConnected)return;if(Date.now()>=n){e.textContent=t,e.removeAttribute("data-preserve-runtime"),delete e.dataset.glyphCycleStarted,delete e.dataset.glyphCycleFinal,K(e.dataset.glyphCycleMessageId??null),delete e.dataset.glyphCycleMessageId;return}let l=d(a);e.textContent=l,a=l,O(e),setTimeout(i,r)};setTimeout(i,r)},M=e=>{let t=e.querySelectorAll?.(".persona-stream-glyph-cycle .persona-stream-char:not([data-glyph-cycle-scheduled])");if(t)for(let n of Array.from(t))E(n)},Y=e=>e.nodeType===1,p={name:"glyph-cycle",containerClass:"persona-stream-glyph-cycle",wrap:"char",skipTags:["a","script","style"],styles:k,bufferContent(e){if(e.length<F)return"";let t=0,n=-1,r=0;for(;r<e.length;){if(e[r]==="*"&&e[r+1]==="*"){t+=1,r+=2;continue}/\s/.test(e[r])&&t%2===0&&(n=r),r+=1}return n<0?"":e.slice(0,n)},isAnimating(e){return(o.get(e.id)??0)>0},onAttach(e){M(e);let t=new MutationObserver(n=>{for(let r of n)for(let a of Array.from(r.addedNodes))Y(a)&&(a.classList.contains("persona-stream-char")&&a.closest(".persona-stream-glyph-cycle")?E(a):M(a))});return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}};h(p);var q=p;0&&(module.exports={glyphCycle});
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-CSmiKRVa.cjs';
1
+ import { S as StreamAnimationPlugin } from './types-4ROVJ1gA.cjs';
2
2
 
3
3
  declare const glyphCycle: StreamAnimationPlugin;
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-CSmiKRVa.js';
1
+ import { S as StreamAnimationPlugin } from './types-4ROVJ1gA.js';
2
2
 
3
3
  declare const glyphCycle: StreamAnimationPlugin;
4
4
 
@@ -1,4 +1,4 @@
1
- var v=[{name:"typewriter",containerClass:"persona-stream-typewriter",wrap:"char",useCaret:!0},{name:"pop-bubble",bubbleClass:"persona-stream-pop",wrap:"none"},{name:"letter-rise",containerClass:"persona-stream-letter-rise",wrap:"char"},{name:"word-fade",containerClass:"persona-stream-word-fade",wrap:"word"}],h=new Map;for(let e of v)h.set(e.name,e);var y=e=>{h.set(e.name,e)};var L=`
1
+ var x=[{name:"typewriter",containerClass:"persona-stream-typewriter",wrap:"char",useCaret:!0},{name:"pop-bubble",bubbleClass:"persona-stream-pop",wrap:"none"},{name:"letter-rise",containerClass:"persona-stream-letter-rise",wrap:"char"},{name:"word-fade",containerClass:"persona-stream-word-fade",wrap:"word"}],p=new Map;for(let e of x)p.set(e.name,e);var g=e=>{p.set(e.name,e)};var v=`
2
2
  [data-persona-root] .persona-stream-glyph-cycle .persona-stream-char {
3
3
  animation: persona-stream-glyph-cycle-fade
4
4
  calc(var(--persona-stream-step, 120ms) * 1.5) ease-out both;
@@ -16,4 +16,4 @@ var v=[{name:"typewriter",containerClass:"persona-stream-typewriter",wrap:"char"
16
16
  opacity: 1 !important;
17
17
  }
18
18
  }
19
- `.trim(),l="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$%&@",P=10,H=120,d=120,W=.4,R=50,N=e=>{var r;if(!e)return d;let n=((r=e.style.getPropertyValue("--persona-stream-step"))==null?void 0:r.trim()).match(/([\d.]+)\s*ms/);return n?parseFloat(n[1]):d},E=e=>{let t=e.closest(".persona-stream-glyph-cycle"),n=N(t);return H*n/d},u=e=>{let t=l[Math.floor(Math.random()*l.length)];return e&&t===e&&(t=l[(l.indexOf(t)+1)%l.length]),t},k=e=>{let t=e.closest(".persona-stream-glyph-cycle");if(!t)return;let n=t.querySelectorAll(".persona-stream-char[data-glyph-cycle-final]"),r=!1;for(let a of Array.from(n)){if(a===e){r=!0;continue}r&&Math.random()<W&&(a.textContent=u())}},f=new WeakMap,A=25,S=.5,D=6,T=.25,C=new WeakMap,M=new WeakMap,_=(e,t)=>{var a;if(!e)return A*S;let n=C.get(e);C.set(e,t);let r=(a=M.get(e))!=null?a:A;if(n!==void 0){let s=t-n;s>1&&(r=r*(1-T)+s*T,M.set(e,r))}return Math.max(D,r*S)},i=new Map,I=e=>{var n;let t=e.closest("[data-message-id]");return(n=t==null?void 0:t.dataset.messageId)!=null?n:null},F=e=>{var t;e&&i.set(e,((t=i.get(e))!=null?t:0)+1)},B=e=>{var n;if(!e)return;let t=(n=i.get(e))!=null?n:0;t<=1?i.delete(e):i.set(e,t-1)},b=e=>{var p;if(e.dataset.glyphCycleScheduled==="true")return;let t=(p=e.textContent)!=null?p:"";if(!t||/\s/.test(t))return;e.dataset.glyphCycleScheduled="true",e.dataset.glyphCycleFinal=t,e.setAttribute("data-preserve-runtime","stream-glyph-cycle"),e.textContent=u();let n=I(e);n&&(e.dataset.glyphCycleMessageId=n),F(n);let r=e.closest(".persona-stream-glyph-cycle"),a=Date.now(),s=_(r,a),c=E(e),m=P*c,o=a+m;if(r){let g=f.get(r);g!==void 0&&(o=Math.max(o,g)),f.set(r,o+s)}O(e,t,o)},O=(e,t,n)=>{var c;if(e.dataset.glyphCycleStarted==="true")return;e.dataset.glyphCycleStarted="true";let r=E(e),a=(c=e.textContent)!=null?c:void 0,s=()=>{var o;if(!e.isConnected)return;if(Date.now()>=n){e.textContent=t,e.removeAttribute("data-preserve-runtime"),delete e.dataset.glyphCycleStarted,delete e.dataset.glyphCycleFinal,B((o=e.dataset.glyphCycleMessageId)!=null?o:null),delete e.dataset.glyphCycleMessageId;return}let m=u(a);e.textContent=m,a=m,k(e),setTimeout(s,r)};setTimeout(s,r)},w=e=>{var n;let t=(n=e.querySelectorAll)==null?void 0:n.call(e,".persona-stream-glyph-cycle .persona-stream-char:not([data-glyph-cycle-scheduled])");if(t)for(let r of Array.from(t))b(r)},G=e=>e.nodeType===1,x={name:"glyph-cycle",containerClass:"persona-stream-glyph-cycle",wrap:"char",skipTags:["a","script","style"],styles:L,bufferContent(e){if(e.length<R)return"";let t=0,n=-1,r=0;for(;r<e.length;){if(e[r]==="*"&&e[r+1]==="*"){t+=1,r+=2;continue}/\s/.test(e[r])&&t%2===0&&(n=r),r+=1}return n<0?"":e.slice(0,n)},isAnimating(e){var t;return((t=i.get(e.id))!=null?t:0)>0},onAttach(e){w(e);let t=new MutationObserver(n=>{for(let r of n)for(let a of Array.from(r.addedNodes))G(a)&&(a.classList.contains("persona-stream-char")&&a.closest(".persona-stream-glyph-cycle")?b(a):w(a))});return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}};y(x);var j=x;export{j as default,x as glyphCycle};
19
+ `.trim(),s="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$%&@",L=10,P=120,m=120,H=.4,W=50,R=e=>{if(!e)return m;let r=(e.style.getPropertyValue("--persona-stream-step")?.trim()).match(/([\d.]+)\s*ms/);return r?parseFloat(r[1]):m},C=e=>{let t=e.closest(".persona-stream-glyph-cycle"),r=R(t);return P*r/m},u=e=>{let t=s[Math.floor(Math.random()*s.length)];return e&&t===e&&(t=s[(s.indexOf(t)+1)%s.length]),t},N=e=>{let t=e.closest(".persona-stream-glyph-cycle");if(!t)return;let r=t.querySelectorAll(".persona-stream-char[data-glyph-cycle-final]"),n=!1;for(let a of Array.from(r)){if(a===e){n=!0;continue}n&&Math.random()<H&&(a.textContent=u())}},f=new WeakMap,h=25,y=.5,k=6,A=.25,S=new WeakMap,T=new WeakMap,D=(e,t)=>{if(!e)return h*y;let r=S.get(e);S.set(e,t);let n=T.get(e)??h;if(r!==void 0){let a=t-r;a>1&&(n=n*(1-A)+a*A,T.set(e,n))}return Math.max(k,n*y)},o=new Map,_=e=>e.closest("[data-message-id]")?.dataset.messageId??null,I=e=>{e&&o.set(e,(o.get(e)??0)+1)},F=e=>{if(!e)return;let t=o.get(e)??0;t<=1?o.delete(e):o.set(e,t-1)},M=e=>{if(e.dataset.glyphCycleScheduled==="true")return;let t=e.textContent??"";if(!t||/\s/.test(t))return;e.dataset.glyphCycleScheduled="true",e.dataset.glyphCycleFinal=t,e.setAttribute("data-preserve-runtime","stream-glyph-cycle"),e.textContent=u();let r=_(e);r&&(e.dataset.glyphCycleMessageId=r),I(r);let n=e.closest(".persona-stream-glyph-cycle"),a=Date.now(),i=D(n,a),l=C(e),E=L*l,c=a+E;if(n){let d=f.get(n);d!==void 0&&(c=Math.max(c,d)),f.set(n,c+i)}B(e,t,c)},B=(e,t,r)=>{if(e.dataset.glyphCycleStarted==="true")return;e.dataset.glyphCycleStarted="true";let n=C(e),a=e.textContent??void 0,i=()=>{if(!e.isConnected)return;if(Date.now()>=r){e.textContent=t,e.removeAttribute("data-preserve-runtime"),delete e.dataset.glyphCycleStarted,delete e.dataset.glyphCycleFinal,F(e.dataset.glyphCycleMessageId??null),delete e.dataset.glyphCycleMessageId;return}let l=u(a);e.textContent=l,a=l,N(e),setTimeout(i,n)};setTimeout(i,n)},b=e=>{let t=e.querySelectorAll?.(".persona-stream-glyph-cycle .persona-stream-char:not([data-glyph-cycle-scheduled])");if(t)for(let r of Array.from(t))M(r)},O=e=>e.nodeType===1,w={name:"glyph-cycle",containerClass:"persona-stream-glyph-cycle",wrap:"char",skipTags:["a","script","style"],styles:v,bufferContent(e){if(e.length<W)return"";let t=0,r=-1,n=0;for(;n<e.length;){if(e[n]==="*"&&e[n+1]==="*"){t+=1,n+=2;continue}/\s/.test(e[n])&&t%2===0&&(r=n),n+=1}return r<0?"":e.slice(0,r)},isAnimating(e){return(o.get(e.id)??0)>0},onAttach(e){b(e);let t=new MutationObserver(r=>{for(let n of r)for(let a of Array.from(n.addedNodes))O(a)&&(a.classList.contains("persona-stream-char")&&a.closest(".persona-stream-glyph-cycle")?M(a):b(a))});return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}};g(w);var $=w;export{$ as default,w as glyphCycle};
@@ -13,6 +13,7 @@ type RuntypeExecutionStreamEvent = ({
13
13
  totalSteps?: number;
14
14
  type: "execution_start";
15
15
  }) | ({
16
+ claudeManagedAgentId?: string;
16
17
  completedAt?: string;
17
18
  durationMs?: number;
18
19
  executionId: string;
@@ -57,6 +58,15 @@ type RuntypeExecutionStreamEvent = ({
57
58
  completedAt?: string;
58
59
  content?: string;
59
60
  cost?: number;
61
+ estimatedContextBreakdown?: {
62
+ categories: Record<string, {
63
+ chars: number;
64
+ estimatedTokens: number;
65
+ }>;
66
+ contextWindowSize?: number;
67
+ estimatedTotalTokens: number;
68
+ estimatedUtilizationPercent?: number;
69
+ };
60
70
  executionId: string;
61
71
  fallback?: {
62
72
  attempts: Array<{
@@ -94,6 +104,7 @@ type RuntypeExecutionStreamEvent = ({
94
104
  type: "step_start";
95
105
  } | ({
96
106
  completedAt?: string;
107
+ cost?: number;
97
108
  durationMs?: number;
98
109
  error?: string;
99
110
  executionId: string;
@@ -199,6 +210,11 @@ type RuntypeExecutionStreamEvent = ({
199
210
  artifactType: "markdown" | "component";
200
211
  component?: string;
201
212
  executionId?: string;
213
+ file?: {
214
+ language?: string;
215
+ mimeType: string;
216
+ path: string;
217
+ };
202
218
  id: string;
203
219
  seq?: number;
204
220
  title?: string;
@@ -307,6 +323,14 @@ type RuntypeExecutionStreamEvent = ({
307
323
  awaitReason?: string;
308
324
  awaitedAt?: string;
309
325
  crawlId?: string;
326
+ elicitation?: {
327
+ message: string;
328
+ mode: "form" | "url";
329
+ pauseCount?: number;
330
+ requestedSchema?: Record<string, unknown>;
331
+ serverName?: string;
332
+ url?: string;
333
+ };
310
334
  executionId: string;
311
335
  origin?: "webmcp" | "sdk";
312
336
  pageOrigin?: string;
@@ -406,6 +430,14 @@ type RuntypeFlowSSEEvent = {
406
430
  awaitReason?: string;
407
431
  awaitedAt: string;
408
432
  crawlId?: string;
433
+ elicitation?: {
434
+ message: string;
435
+ mode: "form" | "url";
436
+ pauseCount?: number;
437
+ requestedSchema?: Record<string, unknown>;
438
+ serverName?: string;
439
+ url?: string;
440
+ };
409
441
  executionId?: string;
410
442
  flowId: string;
411
443
  origin?: "webmcp" | "sdk";
@@ -456,7 +488,7 @@ type RuntypeFlowSSEEvent = {
456
488
  completedAt?: string;
457
489
  duration?: number;
458
490
  durationMs?: number;
459
- error?: string;
491
+ error?: string | null;
460
492
  executionId?: string;
461
493
  executionTime?: number;
462
494
  id?: string;
@@ -500,13 +532,21 @@ type RuntypeFlowSSEEvent = {
500
532
  totalSteps: number;
501
533
  type: "step_skip";
502
534
  when: string;
503
- } | {
535
+ } | ({
536
+ elicitation?: {
537
+ message: string;
538
+ mode: "form" | "url";
539
+ pauseCount?: number;
540
+ requestedSchema?: Record<string, unknown>;
541
+ serverName?: string;
542
+ url?: string;
543
+ };
504
544
  executionId?: string;
505
545
  reason?: string;
506
546
  seq?: number;
507
547
  type: "step_await";
508
548
  [key: string]: unknown;
509
- } | ({
549
+ }) | ({
510
550
  agentContext?: {
511
551
  executionId: string;
512
552
  iteration: number;
@@ -694,6 +734,29 @@ type VideoContentPart = {
694
734
  * Union type for all content part types
695
735
  */
696
736
  type ContentPart = TextContentPart | ImageContentPart | FileContentPart | AudioContentPart | VideoContentPart;
737
+ /** Reference stored on a sent message for transcript fidelity + chip rendering. */
738
+ type AgentWidgetContextMentionRef = {
739
+ sourceId: string;
740
+ itemId: string;
741
+ label: string;
742
+ iconName?: string;
743
+ /** Accent color for the inline token (see `AgentWidgetContextMentionItem.color`). */
744
+ color?: string;
745
+ };
746
+ /**
747
+ * One ordered segment of a sent message's prose, for inline mention rendering
748
+ * (`contextMentions.display: "inline"`). Text runs and atomic mention tokens
749
+ * interleave in document order so the sent bubble re-renders `@tokens` in place
750
+ * and composer history can round-trip them. Display/transcript concern only —
751
+ * the model still sees resolved bodies via `llmContent`/`contentParts`.
752
+ */
753
+ type AgentWidgetContentSegment = {
754
+ kind: "text";
755
+ text: string;
756
+ } | {
757
+ kind: "mention";
758
+ ref: AgentWidgetContextMentionRef;
759
+ };
697
760
  /**
698
761
  * Metadata attached to messages created during agent execution.
699
762
  */
@@ -927,6 +990,25 @@ type AgentWidgetMessage = {
927
990
  * The `content` field contains the text-only representation for display.
928
991
  */
929
992
  contentParts?: ContentPart[];
993
+ /**
994
+ * Context mentions attached to this (user) message, for transcript fidelity +
995
+ * chip rendering in the sent bubble. Refs only — the resolved payloads are
996
+ * merged into `llmContent`/`contentParts` (model-visible) at send time.
997
+ */
998
+ contextMentions?: AgentWidgetContextMentionRef[];
999
+ /**
1000
+ * Ordered prose + mention blocks for inline-mode rendering and composer history
1001
+ * recall (`contextMentions.display: "inline"`). Present only on inline-mode user
1002
+ * messages; when omitted the sent bubble falls back to the chip row derived from
1003
+ * `contextMentions`. Display/transcript concern only — not the model channel.
1004
+ */
1005
+ contentSegments?: AgentWidgetContentSegment[];
1006
+ /**
1007
+ * Resolved opt-in structured mention context for this (user) message, merged
1008
+ * into the request `context` under `mentions.<sourceId>.<itemId>` by the
1009
+ * client. Internal: set at send time from each source's `resolve().context`.
1010
+ */
1011
+ mentionContext?: Record<string, unknown>;
930
1012
  streaming?: boolean;
931
1013
  variant?: AgentWidgetMessageVariant;
932
1014
  sequence?: number;
@@ -13,6 +13,7 @@ type RuntypeExecutionStreamEvent = ({
13
13
  totalSteps?: number;
14
14
  type: "execution_start";
15
15
  }) | ({
16
+ claudeManagedAgentId?: string;
16
17
  completedAt?: string;
17
18
  durationMs?: number;
18
19
  executionId: string;
@@ -57,6 +58,15 @@ type RuntypeExecutionStreamEvent = ({
57
58
  completedAt?: string;
58
59
  content?: string;
59
60
  cost?: number;
61
+ estimatedContextBreakdown?: {
62
+ categories: Record<string, {
63
+ chars: number;
64
+ estimatedTokens: number;
65
+ }>;
66
+ contextWindowSize?: number;
67
+ estimatedTotalTokens: number;
68
+ estimatedUtilizationPercent?: number;
69
+ };
60
70
  executionId: string;
61
71
  fallback?: {
62
72
  attempts: Array<{
@@ -94,6 +104,7 @@ type RuntypeExecutionStreamEvent = ({
94
104
  type: "step_start";
95
105
  } | ({
96
106
  completedAt?: string;
107
+ cost?: number;
97
108
  durationMs?: number;
98
109
  error?: string;
99
110
  executionId: string;
@@ -199,6 +210,11 @@ type RuntypeExecutionStreamEvent = ({
199
210
  artifactType: "markdown" | "component";
200
211
  component?: string;
201
212
  executionId?: string;
213
+ file?: {
214
+ language?: string;
215
+ mimeType: string;
216
+ path: string;
217
+ };
202
218
  id: string;
203
219
  seq?: number;
204
220
  title?: string;
@@ -307,6 +323,14 @@ type RuntypeExecutionStreamEvent = ({
307
323
  awaitReason?: string;
308
324
  awaitedAt?: string;
309
325
  crawlId?: string;
326
+ elicitation?: {
327
+ message: string;
328
+ mode: "form" | "url";
329
+ pauseCount?: number;
330
+ requestedSchema?: Record<string, unknown>;
331
+ serverName?: string;
332
+ url?: string;
333
+ };
310
334
  executionId: string;
311
335
  origin?: "webmcp" | "sdk";
312
336
  pageOrigin?: string;
@@ -406,6 +430,14 @@ type RuntypeFlowSSEEvent = {
406
430
  awaitReason?: string;
407
431
  awaitedAt: string;
408
432
  crawlId?: string;
433
+ elicitation?: {
434
+ message: string;
435
+ mode: "form" | "url";
436
+ pauseCount?: number;
437
+ requestedSchema?: Record<string, unknown>;
438
+ serverName?: string;
439
+ url?: string;
440
+ };
409
441
  executionId?: string;
410
442
  flowId: string;
411
443
  origin?: "webmcp" | "sdk";
@@ -456,7 +488,7 @@ type RuntypeFlowSSEEvent = {
456
488
  completedAt?: string;
457
489
  duration?: number;
458
490
  durationMs?: number;
459
- error?: string;
491
+ error?: string | null;
460
492
  executionId?: string;
461
493
  executionTime?: number;
462
494
  id?: string;
@@ -500,13 +532,21 @@ type RuntypeFlowSSEEvent = {
500
532
  totalSteps: number;
501
533
  type: "step_skip";
502
534
  when: string;
503
- } | {
535
+ } | ({
536
+ elicitation?: {
537
+ message: string;
538
+ mode: "form" | "url";
539
+ pauseCount?: number;
540
+ requestedSchema?: Record<string, unknown>;
541
+ serverName?: string;
542
+ url?: string;
543
+ };
504
544
  executionId?: string;
505
545
  reason?: string;
506
546
  seq?: number;
507
547
  type: "step_await";
508
548
  [key: string]: unknown;
509
- } | ({
549
+ }) | ({
510
550
  agentContext?: {
511
551
  executionId: string;
512
552
  iteration: number;
@@ -694,6 +734,29 @@ type VideoContentPart = {
694
734
  * Union type for all content part types
695
735
  */
696
736
  type ContentPart = TextContentPart | ImageContentPart | FileContentPart | AudioContentPart | VideoContentPart;
737
+ /** Reference stored on a sent message for transcript fidelity + chip rendering. */
738
+ type AgentWidgetContextMentionRef = {
739
+ sourceId: string;
740
+ itemId: string;
741
+ label: string;
742
+ iconName?: string;
743
+ /** Accent color for the inline token (see `AgentWidgetContextMentionItem.color`). */
744
+ color?: string;
745
+ };
746
+ /**
747
+ * One ordered segment of a sent message's prose, for inline mention rendering
748
+ * (`contextMentions.display: "inline"`). Text runs and atomic mention tokens
749
+ * interleave in document order so the sent bubble re-renders `@tokens` in place
750
+ * and composer history can round-trip them. Display/transcript concern only —
751
+ * the model still sees resolved bodies via `llmContent`/`contentParts`.
752
+ */
753
+ type AgentWidgetContentSegment = {
754
+ kind: "text";
755
+ text: string;
756
+ } | {
757
+ kind: "mention";
758
+ ref: AgentWidgetContextMentionRef;
759
+ };
697
760
  /**
698
761
  * Metadata attached to messages created during agent execution.
699
762
  */
@@ -927,6 +990,25 @@ type AgentWidgetMessage = {
927
990
  * The `content` field contains the text-only representation for display.
928
991
  */
929
992
  contentParts?: ContentPart[];
993
+ /**
994
+ * Context mentions attached to this (user) message, for transcript fidelity +
995
+ * chip rendering in the sent bubble. Refs only — the resolved payloads are
996
+ * merged into `llmContent`/`contentParts` (model-visible) at send time.
997
+ */
998
+ contextMentions?: AgentWidgetContextMentionRef[];
999
+ /**
1000
+ * Ordered prose + mention blocks for inline-mode rendering and composer history
1001
+ * recall (`contextMentions.display: "inline"`). Present only on inline-mode user
1002
+ * messages; when omitted the sent bubble falls back to the chip row derived from
1003
+ * `contextMentions`. Display/transcript concern only — not the model channel.
1004
+ */
1005
+ contentSegments?: AgentWidgetContentSegment[];
1006
+ /**
1007
+ * Resolved opt-in structured mention context for this (user) message, merged
1008
+ * into the request `context` under `mentions.<sourceId>.<itemId>` by the
1009
+ * client. Internal: set at send time from each source's `resolve().context`.
1010
+ */
1011
+ mentionContext?: Record<string, unknown>;
930
1012
  streaming?: boolean;
931
1013
  variant?: AgentWidgetMessageVariant;
932
1014
  sequence?: number;
@@ -1,4 +1,4 @@
1
- "use strict";var r=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(e,t)=>{for(var a in t)r(e,a,{get:t[a],enumerable:!0})},u=(e,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of c(t))!p.call(e,n)&&n!==a&&r(e,n,{get:()=>t[n],enumerable:!(s=l(t,n))||s.enumerable});return e};var g=e=>u(r({},"__esModule",{value:!0}),e);var f={};d(f,{default:()=>w,wipe:()=>o});module.exports=g(f);var A=[{name:"typewriter",containerClass:"persona-stream-typewriter",wrap:"char",useCaret:!0},{name:"pop-bubble",bubbleClass:"persona-stream-pop",wrap:"none"},{name:"letter-rise",containerClass:"persona-stream-letter-rise",wrap:"char"},{name:"word-fade",containerClass:"persona-stream-word-fade",wrap:"word"}],i=new Map;for(let e of A)i.set(e.name,e);var m=e=>{i.set(e.name,e)};var S=`
1
+ "use strict";var r=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(e,t)=>{for(var a in t)r(e,a,{get:t[a],enumerable:!0})},u=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of p(t))!c.call(e,n)&&n!==a&&r(e,n,{get:()=>t[n],enumerable:!(i=l(t,n))||i.enumerable});return e};var g=e=>u(r({},"__esModule",{value:!0}),e);var w={};d(w,{default:()=>S,wipe:()=>o});module.exports=g(w);var A=[{name:"typewriter",containerClass:"persona-stream-typewriter",wrap:"char",useCaret:!0},{name:"pop-bubble",bubbleClass:"persona-stream-pop",wrap:"none"},{name:"letter-rise",containerClass:"persona-stream-letter-rise",wrap:"char"},{name:"word-fade",containerClass:"persona-stream-word-fade",wrap:"word"}],s=new Map;for(let e of A)s.set(e.name,e);var m=e=>{s.set(e.name,e)};var f=`
2
2
  @keyframes persona-stream-wipe {
3
3
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
4
4
  to { -webkit-mask-position: 0% 0; mask-position: 0% 0; }
@@ -34,4 +34,4 @@
34
34
  mask-image: none !important;
35
35
  }
36
36
  }
37
- `.trim(),o={name:"wipe",containerClass:"persona-stream-wipe",wrap:"word",styles:S};m(o);var w=o;0&&(module.exports={wipe});
37
+ `.trim(),o={name:"wipe",containerClass:"persona-stream-wipe",wrap:"word",styles:f};m(o);var S=o;0&&(module.exports={wipe});
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-CSmiKRVa.cjs';
1
+ import { S as StreamAnimationPlugin } from './types-4ROVJ1gA.cjs';
2
2
 
3
3
  declare const wipe: StreamAnimationPlugin;
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-CSmiKRVa.js';
1
+ import { S as StreamAnimationPlugin } from './types-4ROVJ1gA.js';
2
2
 
3
3
  declare const wipe: StreamAnimationPlugin;
4
4
 
@@ -0,0 +1 @@
1
+ var a=class{constructor(e=24e3,t={}){this.ctx=null;this.nextStartTime=0;this.activeSources=[];this.finishedCallbacks=[];this.startedCallbacks=[];this.playing=!1;this.streamEnded=!1;this.pendingCount=0;this.started=!1;this.userPaused=!1;this.pendingBuffers=[];this.pendingSamples=0;this.remainder=null;this.sampleRate=e;let i=Math.max(0,t.prebufferMs??0);this.waterlineSamples=Math.round(e*i/1e3),this.buffering=this.waterlineSamples>0}ensureContext(){if(!this.ctx){let t=typeof window<"u"?window:void 0;if(!t)throw new Error("AudioPlaybackManager requires a browser environment");let i=t.AudioContext||t.webkitAudioContext;this.ctx=new i({sampleRate:this.sampleRate})}let e=this.ctx;return e.state==="suspended"&&!this.userPaused&&e.resume(),e}enqueue(e){if(e.length===0)return;let t=e;if(this.remainder){let s=new Uint8Array(this.remainder.length+e.length);s.set(this.remainder),s.set(e,this.remainder.length),t=s,this.remainder=null}if(t.length%2!==0&&(this.remainder=new Uint8Array([t[t.length-1]]),t=t.subarray(0,t.length-1)),t.length===0)return;let i=this.pcmToFloat32(t);i.length!==0&&(this.buffering?(this.pendingBuffers.push(i),this.pendingSamples+=i.length,this.pendingSamples>=this.waterlineSamples&&this.releaseBuffer()):this.scheduleSamples(i))}markStreamEnd(){this.pendingBuffers.length>0&&this.releaseBuffer(),this.streamEnded=!0,this.checkFinished()}flush(){for(let e of this.activeSources)try{e.stop(),e.disconnect()}catch{}this.activeSources=[],this.pendingCount=0,this.nextStartTime=0,this.playing=!1,this.streamEnded=!1,this.finishedCallbacks=[],this.startedCallbacks=[],this.remainder=null,this.pendingBuffers=[],this.pendingSamples=0,this.buffering=this.waterlineSamples>0,this.started=!1}isPlaying(){return this.playing}onFinished(e){this.finishedCallbacks.push(e)}onStarted(e){this.startedCallbacks.push(e)}pause(){this.userPaused=!0,this.ctx&&this.ctx.state==="running"&&this.ctx.suspend()}resume(){this.userPaused=!1,this.ctx&&this.ctx.state==="suspended"&&this.ctx.resume()}async destroy(){this.flush(),this.ctx&&(await this.ctx.close(),this.ctx=null)}releaseBuffer(){this.buffering=!1;let e=this.pendingBuffers;this.pendingBuffers=[],this.pendingSamples=0;for(let t of e)this.scheduleSamples(t)}scheduleSamples(e){if(e.length===0)return;let t=this.ensureContext(),i=t.createBuffer(1,e.length,this.sampleRate);i.getChannelData(0).set(e);let s=t.createBufferSource();s.buffer=i,s.connect(t.destination);let n=t.currentTime;if(this.nextStartTime===0?this.nextStartTime=n:this.nextStartTime<n&&(this.nextStartTime=n,this.waterlineSamples>0&&(this.buffering=!0)),s.start(this.nextStartTime),this.nextStartTime+=i.duration,this.activeSources.push(s),this.pendingCount++,this.playing=!0,!this.started){this.started=!0;let r=this.startedCallbacks.slice();this.startedCallbacks=[];for(let h of r)h()}s.onended=()=>{let r=this.activeSources.indexOf(s);r!==-1&&this.activeSources.splice(r,1),this.pendingCount--,this.checkFinished()}}checkFinished(){if(this.streamEnded&&this.pendingCount<=0&&this.pendingBuffers.length===0){this.playing=!1,this.streamEnded=!1;let e=this.finishedCallbacks.slice();this.finishedCallbacks=[];for(let t of e)t()}}pcmToFloat32(e){let t=Math.floor(e.length/2),i=new Float32Array(t),s=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let n=0;n<t;n++){let r=s.getInt16(n*2,!0);i[n]=r/32768}return i}};export{a};
@@ -0,0 +1,3 @@
1
+ var u=/\s/;function g(n,e,t){if(t==="input-start")return e===0;let r=e>0?n[e-1]:"";return t==="line-start"?r===""||r===`
2
+ `:r===""||u.test(r)}function l(n,e,t="@",r="anywhere",o=!1){if(!t||e<=0||e>n.length)return null;let i=e-1;for(;i>=0;){let s=n[i];if(s===t)return g(n,i,r)?{triggerIndex:i,query:n.slice(i+1,e)}:null;if(s===`
3
+ `||s==="\uFFFC"||!o&&u.test(s))return null;i--}return null}function c(n,e,t){for(let r of t){let o=l(n,e,r.trigger,r.position??"anywhere",r.allowSpaces??!1);if(o)return{channel:r,match:o}}return null}function a(n){return n?n!=="insertFromPaste"&&n!=="insertFromDrop":!0}function f(n,e,t){return{value:n.slice(0,e.triggerIndex)+n.slice(t),caret:e.triggerIndex}}export{c as a,a as b,f as c};
@@ -0,0 +1 @@
1
+ var zt=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n},Bt=(e,t,n)=>{let o=e.createElement(t);return n&&(o.className=n),o},Ft=()=>document.createDocumentFragment(),Kt=(e,t={},...n)=>{let o=document.createElement(e);if(t.className&&(o.className=t.className),t.text!==void 0&&(o.textContent=t.text),t.attrs)for(let[s,a]of Object.entries(t.attrs))o.setAttribute(s,a);if(t.style){let s=o.style,a=t.style;for(let c of Object.keys(a)){let l=a[c];l!=null&&(s[c]=l)}}let r=n.filter(s=>s!=null);return r.length>0&&o.append(...r),o},Wt=(...e)=>e.filter(Boolean).join(" ");import{Activity as A,ArrowDown as k,ArrowUp as P,ArrowUpRight as L,Bot as I,ChevronDown as R,ChevronUp as D,ChevronRight as H,ChevronLeft as O,Check as z,Clipboard as B,ClipboardCopy as F,CodeXml as K,Copy as W,File as U,FileCode as j,FileSpreadsheet as $,FileText as q,ImagePlus as V,Loader as X,LoaderCircle as G,Mic as _,Paperclip as Y,RefreshCw as Z,Search as J,Send as Q,ShieldAlert as ee,ShieldCheck as te,ShieldX as ne,Square as oe,ThumbsDown as re,ThumbsUp as ie,Upload as se,Volume2 as ae,X as le,User as ce,Mail as de,Phone as ue,Calendar as me,Clock as pe,Building as ge,MapPin as he,Lock as fe,Key as we,CreditCard as ye,AtSign as be,Hash as ve,Globe as xe,Link as Ce,CircleCheck as Se,CircleX as Ee,TriangleAlert as Te,Info as Me,Ban as Ne,Shield as Ae,ArrowLeft as ke,ArrowRight as Pe,ExternalLink as Le,Ellipsis as Ie,EllipsisVertical as Re,Menu as De,House as He,Plus as Oe,Minus as ze,Pencil as Be,Trash as Fe,Trash2 as Ke,Save as We,Download as Ue,Share as je,Funnel as $e,Settings as qe,RotateCw as Ve,Maximize as Xe,Minimize as Ge,ShoppingCart as _e,ShoppingBag as Ye,Package as Ze,Truck as Je,Tag as Qe,Gift as et,Receipt as tt,Wallet as nt,Store as ot,DollarSign as rt,Percent as it,Play as st,Pause as at,VolumeX as lt,Camera as ct,Image as dt,Film as ut,Headphones as mt,MessageCircle as pt,MessageSquare as gt,Bell as ht,Heart as ft,Star as wt,Eye as yt,EyeOff as bt,Bookmark as vt,CalendarDays as xt,History as Ct,Timer as St,Folder as Et,FolderOpen as Tt,Files as Mt,Sparkles as Nt,Zap as At,Sun as kt,Moon as Pt,Flag as Lt,Monitor as It,Smartphone as Rt}from"lucide";var Dt={activity:A,"arrow-down":k,"arrow-up":P,"arrow-up-right":L,bot:I,"chevron-down":R,"chevron-up":D,"chevron-right":H,"chevron-left":O,check:z,clipboard:B,"clipboard-copy":F,"code-xml":K,copy:W,file:U,"file-code":j,"file-spreadsheet":$,"file-text":q,"image-plus":V,loader:X,"loader-circle":G,mic:_,paperclip:Y,"refresh-cw":Z,search:J,send:Q,"shield-alert":ee,"shield-check":te,"shield-x":ne,square:oe,"thumbs-down":re,"thumbs-up":ie,upload:se,"volume-2":ae,x:le,user:ce,mail:de,phone:ue,calendar:me,clock:pe,building:ge,"map-pin":he,lock:fe,key:we,"credit-card":ye,"at-sign":be,hash:ve,globe:xe,link:Ce,"circle-check":Se,"circle-x":Ee,"triangle-alert":Te,info:Me,ban:Ne,shield:Ae,"arrow-left":ke,"arrow-right":Pe,"external-link":Le,ellipsis:Ie,"ellipsis-vertical":Re,menu:De,house:He,plus:Oe,minus:ze,pencil:Be,trash:Fe,"trash-2":Ke,save:We,download:Ue,share:je,funnel:$e,settings:qe,"rotate-cw":Ve,maximize:Xe,minimize:Ge,"shopping-cart":_e,"shopping-bag":Ye,package:Ze,truck:Je,tag:Qe,gift:et,receipt:tt,wallet:nt,store:ot,"dollar-sign":rt,percent:it,play:st,pause:at,"volume-x":lt,camera:ct,image:dt,film:ut,headphones:mt,"message-circle":pt,"message-square":gt,bell:ht,heart:ft,star:wt,eye:yt,"eye-off":bt,bookmark:vt,"calendar-days":xt,history:Ct,timer:St,folder:Et,"folder-open":Tt,files:Mt,sparkles:Nt,zap:At,sun:kt,moon:Pt,flag:Lt,monitor:It,smartphone:Rt},$t=(e,t=24,n="currentColor",o=2)=>{let r=Dt[e];return r?Ht(r,t,n,o):(console.warn(`Lucide icon "${e}" is not in the Persona registry. Add it to packages/widget/src/utils/icons.ts (see docs/icon-registry-shortlist.md).`),null)};function Ht(e,t,n,o){if(!Array.isArray(e))return null;let r=document.createElementNS("http://www.w3.org/2000/svg","svg");return r.setAttribute("width",String(t)),r.setAttribute("height",String(t)),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke",n),r.setAttribute("stroke-width",String(o)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.setAttribute("aria-hidden","true"),e.forEach(s=>{if(!Array.isArray(s)||s.length<2)return;let a=s[0],c=s[1];if(!c)return;let l=document.createElementNS("http://www.w3.org/2000/svg",a);Object.entries(c).forEach(([h,f])=>{h!=="stroke"&&l.setAttribute(h,String(f))}),r.appendChild(l)}),r}function Vt(e){let t={trigger:e.trigger??"@",position:e.triggerPosition??"anywhere",allowSpaces:!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton!==!1,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText},n=(e.triggers??[]).map(o=>({trigger:o.trigger,position:o.triggerPosition??"anywhere",allowSpaces:o.allowSpaces??!1,sources:Array.isArray(o.sources)?o.sources:[],searchPlaceholder:o.searchPlaceholder,showButton:o.showButton===!0,buttonIconName:o.buttonIconName,buttonTooltipText:o.buttonTooltipText}));return[t,...n]}function T(e){let t=e.getRootNode?.();return t instanceof ShadowRoot||t instanceof Document?t:e.ownerDocument??document}function b(e,t,n){let o=e instanceof Document?e.head:e,r=t.replace(/["\\]/g,"\\$&");if(o.querySelector(`style[data-persona-plugin-style="${r}"]`))return;let a=(e instanceof Document?e:e.ownerDocument??document).createElement("style");a.setAttribute("data-persona-plugin-style",t),a.textContent=n,o.appendChild(a)}function Gt(e,t,n){if(e instanceof Document||e instanceof ShadowRoot){b(e,t,n);return}let o=e;if(o.isConnected){b(T(o),t,n);return}let r=o.ownerDocument??document;b(r,t,n),queueMicrotask(()=>{let s=T(o);s!==r&&b(s,t,n)})}function Ot(e){let t=e.getRootNode?.();return t instanceof ShadowRoot?t:(e.ownerDocument??document).body}function _t(e){let{anchor:t,content:n,placement:o="bottom-start",offset:r=6,matchAnchorWidth:s=!1,horizontalOffset:a,verticalOffset:c,zIndex:l=2147483e3,onOpen:h,onDismiss:f}=e,M=e.container??Ot(t),d=!1,w=null,v=()=>{if(!d)return;let i=t.getBoundingClientRect();n.style.position="fixed",s&&(n.style.minWidth=`${i.width}px`),a&&(n.style.maxWidth=`${i.width}px`);let m=n.getBoundingClientRect(),u=c?.()??null,y=u!=null?i.top+u:i.top,x=o==="top-start"||o==="top-end"?y-r-m.height:i.bottom+r,g=o==="bottom-end"||o==="top-end"?i.right-m.width:i.left,E=a?.()??null;if(E!=null){let N=Math.max(i.left,i.right-m.width);g=Math.min(Math.max(i.left+E,i.left),N)}n.style.top=`${x}px`,n.style.left=`${g}px`},p=()=>{d&&(d=!1,w&&(w(),w=null),n.remove())},S=()=>{if(d)return;d=!0,l!=null&&(n.style.zIndex=String(l)),M.appendChild(n),v();let i=(t.ownerDocument??document).defaultView??window,m=t.ownerDocument??document,u=()=>{if(!t.isConnected){p(),f?.("anchor-removed");return}v()},y=C=>{let g=typeof C.composedPath=="function"?C.composedPath():[];g.includes(n)||g.includes(t)||(p(),f?.("outside"))},x=i.setTimeout(()=>{m.addEventListener("pointerdown",y,!0)},0);i.addEventListener("scroll",u,!0),i.addEventListener("resize",u),w=()=>{i.clearTimeout(x),m.removeEventListener("pointerdown",y,!0),i.removeEventListener("scroll",u,!0),i.removeEventListener("resize",u)},h?.()};return{get isOpen(){return d},open:S,close:p,toggle:()=>d?p():S(),reposition:v,destroy:p}}function Yt(e){return(typeof e.composedPath=="function"?e.composedPath():[]).some(n=>n instanceof HTMLElement&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable))}export{zt as a,Bt as b,Ft as c,Kt as d,Wt as e,$t as f,Vt as g,Gt as h,_t as i,Yt as j};
@@ -0,0 +1 @@
1
+ function i(e){e&&(typeof e.requestSubmit=="function"?e.requestSubmit():e.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0})))}function r(e){let o=()=>{e.dispatchEvent(new Event("input",{bubbles:!0}))};return{element:e,getValue:()=>e.value,getLogicalText:()=>e.value,getSelection:()=>({start:e.selectionStart??0,end:e.selectionEnd??0}),setSelection:(t,n=t)=>{e.setSelectionRange(t,n)},setValueWithCaret:(t,n)=>{e.value=t,e.setSelectionRange(n,n)},setValue:t=>{e.value=t,e.setSelectionRange(t.length,t.length),o(),e.focus()},submit:()=>i(e.form),dispatchInput:o,focus:()=>e.focus()}}export{i as a,r as b};