@runtypelabs/persona 4.24.0 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-Db61aI9J.d.cts → types-BwKTZhg9.d.cts} +14 -0
- package/dist/animations/{types-Db61aI9J.d.ts → types-BwKTZhg9.d.ts} +14 -0
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/animations-extra.d.cts +14 -0
- package/dist/animations-extra.d.ts +14 -0
- package/dist/approval-ui-QAKWNFNM.js +1 -0
- package/dist/approval-ui.cjs +2 -2
- package/dist/approval-ui.d.cts +243 -8
- package/dist/approval-ui.d.ts +243 -8
- package/dist/approval-ui.js +2 -2
- package/dist/{artifacts-ui-IGB5YKLO.js → artifacts-ui-NJGMM27I.js} +1 -1
- package/dist/artifacts-ui.cjs +4 -4
- package/dist/artifacts-ui.d.cts +243 -8
- package/dist/artifacts-ui.d.ts +243 -8
- package/dist/artifacts-ui.js +5 -5
- package/dist/chunk-2ANTRKTV.js +1 -0
- package/dist/chunk-4HPTPUC6.js +1 -0
- package/dist/chunk-6V3MNEKB.js +1 -0
- package/dist/chunk-HGUCGM3K.js +9 -0
- package/dist/chunk-IO5VVUKP.js +3 -0
- package/dist/chunk-J4J3Y2P2.js +1 -0
- package/dist/chunk-K6HKIP5K.js +1 -0
- package/dist/chunk-K7NA7G7J.js +1 -0
- package/dist/chunk-MXUTS3LB.js +1 -0
- package/dist/chunk-PDPVORUF.js +1 -0
- package/dist/chunk-QPPJUSZH.js +1 -0
- package/dist/chunk-QRKGQPU7.js +1 -0
- package/dist/chunk-S6PBWE75.js +1 -0
- package/dist/chunk-T7QM7YMF.js +1 -0
- package/dist/chunk-TR2H475E.js +1 -0
- package/dist/chunk-UPO4GUFC.js +1 -0
- package/dist/chunk-ZC66NAIR.js +1 -0
- package/dist/client-history-YPEG45Q4.js +1 -0
- package/dist/client-history.js +1 -0
- package/dist/client-stream-42FOI3EC.js +4 -0
- package/dist/client-stream.js +5 -0
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/context-mentions-E7HJYWO6.js +161 -0
- package/dist/{context-mentions-inline-I2RDEBAK.js → context-mentions-inline-QVESLW55.js} +1 -1
- package/dist/context-mentions.cjs +7 -7
- package/dist/context-mentions.d.cts +243 -8
- package/dist/context-mentions.d.ts +243 -8
- package/dist/context-mentions.js +8 -8
- package/dist/event-stream-view-FOIJHFQO.js +1 -0
- package/dist/event-stream-view.cjs +1 -1
- package/dist/event-stream-view.d.cts +246 -31
- package/dist/event-stream-view.d.ts +246 -31
- package/dist/event-stream-view.js +1 -1
- package/dist/forms-ui.d.cts +295 -667
- package/dist/forms-ui.d.ts +295 -667
- package/dist/history-shell-QDQ44PSE.js +3 -0
- package/dist/history-shell.js +3 -0
- package/dist/{history-view-BD6OXLNA.js → history-view-NCFBI5GR.js} +2 -2
- package/dist/history-view.cjs +2 -2
- package/dist/history-view.d.cts +35 -1
- package/dist/history-view.d.ts +35 -1
- package/dist/history-view.js +2 -2
- package/dist/index.cjs +80 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +301 -738
- package/dist/index.d.ts +301 -738
- package/dist/index.global.js +3 -215
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +81 -75
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js +3 -67
- package/dist/launcher.global.js.map +1 -1
- package/dist/markdown-parsers.js +22 -22
- package/dist/runtype-tts-entry-NFBVWR7N.js +1 -0
- package/dist/runtype-tts.js +1 -1
- package/dist/session-actions-ISSKSI66.js +1 -0
- package/dist/session-actions.js +1 -0
- package/dist/session-reconnect.d.cts +243 -8
- package/dist/session-reconnect.d.ts +243 -8
- package/dist/smart-dom-reader.cjs +13 -13
- package/dist/smart-dom-reader.d.cts +243 -8
- package/dist/smart-dom-reader.d.ts +243 -8
- package/dist/smart-dom-reader.js +11 -11
- package/dist/theme-editor-preview.cjs +116 -98
- package/dist/theme-editor-preview.d.cts +245 -8
- package/dist/theme-editor-preview.d.ts +245 -8
- package/dist/theme-editor-preview.js +49 -54
- package/dist/theme-editor.cjs +2 -2
- package/dist/theme-editor.d.cts +244 -23
- package/dist/theme-editor.d.ts +244 -23
- package/dist/theme-editor.js +2 -2
- package/dist/theme-reference.d.cts +14 -0
- package/dist/theme-reference.d.ts +14 -0
- package/dist/ui-extras-entry-WAYFKVNW.js +3 -0
- package/dist/ui-extras.js +72 -0
- package/dist/voice-runtime-UOQOFAFY.js +17 -0
- package/dist/voice-runtime.cjs +17 -1
- package/dist/voice-runtime.d.cts +11643 -192
- package/dist/voice-runtime.d.ts +11643 -192
- package/dist/voice-runtime.js +17 -1
- package/dist/voice-worklet-player.cjs +19 -4
- package/dist/voice-worklet-player.d.cts +9 -10
- package/dist/voice-worklet-player.d.ts +9 -10
- package/dist/voice-worklet-player.js +19 -4
- package/dist/webmcp-polyfill.js +1 -1
- package/dist/webmcp-runtime-V6ZWW3PI.js +6 -0
- package/dist/webmcp-runtime.cjs +2 -2
- package/dist/webmcp-runtime.d.cts +1 -33
- package/dist/webmcp-runtime.d.ts +1 -33
- package/dist/webmcp-runtime.js +2 -2
- package/dist/widget.css +1 -1
- package/package.json +11 -5
- package/src/approval-paused-tool-settle.test.ts +221 -0
- package/src/client-approve.test.ts +311 -0
- package/src/client-history-eager.ts +9 -0
- package/src/client-history-loader.ts +23 -0
- package/src/client-history.ts +579 -0
- package/src/client-resume.ts +177 -0
- package/src/client-stream-eager.ts +12 -0
- package/src/client-stream-loader.ts +25 -0
- package/src/client-stream.ts +1880 -0
- package/src/client.test.ts +31 -1
- package/src/client.ts +293 -2607
- package/src/components/approval-actions.test.ts +27 -0
- package/src/components/approval-actions.ts +27 -3
- package/src/components/message-bubble.test.ts +19 -0
- package/src/components/message-bubble.ts +2 -0
- package/src/components/registry.ts +6 -6
- package/src/components/tool-bubble.test.ts +9 -0
- package/src/components/tool-bubble.ts +1 -0
- package/src/history-shell-bundle.test.ts +54 -0
- package/src/history-shell-eager.ts +12 -0
- package/src/history-shell-loader.ts +27 -0
- package/src/history-shell.ts +2362 -0
- package/src/history-view-loader.ts +2 -0
- package/src/history-view.ts +3 -0
- package/src/index-core.ts +8 -0
- package/src/index-global.ts +90 -248
- package/src/index.ts +13 -0
- package/src/install.ts +6 -4
- package/src/internal/runtype-history-provider.test.ts +1 -0
- package/src/internal/runtype-history-provider.ts +28 -13
- package/src/plugins/registry.ts +8 -8
- package/src/session-actions-chunk.test.ts +55 -0
- package/src/session-actions-eager.ts +11 -0
- package/src/session-actions-loader.ts +37 -0
- package/src/session-actions.ts +909 -0
- package/src/session-history.test.ts +3 -1
- package/src/session.ts +875 -1530
- package/src/session.voice.test.ts +1241 -5
- package/src/styles/widget.css +58 -0
- package/src/theme-editor/state.ts +91 -91
- package/src/types.ts +269 -5
- package/src/ui-ask-user-sheet.ts +382 -0
- package/src/ui-extras-eager.ts +10 -0
- package/src/ui-extras-entry.ts +9 -0
- package/src/ui-extras-loader.ts +26 -0
- package/src/ui.artifact-rail-resize.test.ts +2 -1
- package/src/ui.ask-user-chunk.test.ts +93 -0
- package/src/ui.history-chunk.test.ts +2 -1
- package/src/ui.history-config-provider.test.ts +2 -1
- package/src/ui.history-confirm-fallback.test.ts +142 -0
- package/src/ui.history-controller.test.ts +2 -1
- package/src/ui.history-lifecycle.test.ts +2 -1
- package/src/ui.history-render-hooks.test.ts +2 -1
- package/src/ui.history-shell.test.ts +2 -1
- package/src/ui.rail-overlay.test.ts +2 -1
- package/src/ui.rail-resize.test.ts +2 -1
- package/src/ui.rail-trigger-pending.test.ts +2 -1
- package/src/ui.ts +399 -2770
- package/src/ui.voice-prewarm.test.ts +222 -0
- package/src/utils/attachment-manager.ts +67 -67
- package/src/utils/constants.ts +3 -0
- package/src/utils/context-mention-controller.ts +323 -323
- package/src/utils/context-mention-manager.ts +40 -40
- package/src/utils/context-mention-orchestrator.ts +28 -0
- package/src/utils/event-stream-buffer.ts +50 -50
- package/src/utils/event-stream-store.ts +43 -43
- package/src/utils/throughput-tracker.ts +34 -34
- package/src/utils/virtual-scroller.ts +67 -67
- package/src/utils/visitor-store.test.ts +50 -0
- package/src/utils/visitor-store.ts +23 -5
- package/src/voice/__fixtures__/voice-wire/README.md +1 -0
- package/src/voice/__fixtures__/voice-wire/client/cancel.json +3 -0
- package/src/voice/__fixtures__/voice-wire/client/context.json +4 -0
- package/src/voice/__fixtures__/voice-wire/client/delegation_result.json +6 -0
- package/src/voice/__fixtures__/voice-wire/client/delegation_update.json +6 -0
- package/src/voice/__fixtures__/voice-wire/client/ping.json +3 -0
- package/src/voice/__fixtures__/voice-wire/client/playback_progress.json +5 -0
- package/src/voice/__fixtures__/voice-wire/client/start.json +3 -0
- package/src/voice/__fixtures__/voice-wire/server/artifact.json +11 -0
- package/src/voice/__fixtures__/voice-wire/server/attached.json +4 -0
- package/src/voice/__fixtures__/voice-wire/server/audio_clear.json +4 -0
- package/src/voice/__fixtures__/voice-wire/server/audio_end.json +3 -0
- package/src/voice/__fixtures__/voice-wire/server/delegation_cancelled.json +5 -0
- package/src/voice/__fixtures__/voice-wire/server/delegation_completed.json +8 -0
- package/src/voice/__fixtures__/voice-wire/server/delegation_started.json +15 -0
- package/src/voice/__fixtures__/voice-wire/server/error.json +6 -0
- package/src/voice/__fixtures__/voice-wire/server/metrics.json +10 -0
- package/src/voice/__fixtures__/voice-wire/server/pong.json +3 -0
- package/src/voice/__fixtures__/voice-wire/server/session_config.json +16 -0
- package/src/voice/__fixtures__/voice-wire/server/transcript_final.json +7 -0
- package/src/voice/__fixtures__/voice-wire/server/transcript_interim.json +4 -0
- package/src/voice/__fixtures__/voice-wire/server/transcript_partial.json +6 -0
- package/src/voice/__fixtures__/voice-wire/server/transcript_update.json +10 -0
- package/src/voice/__fixtures__/voice-wire/server/warning.json +5 -0
- package/src/voice/audio-playback-manager.test.ts +57 -0
- package/src/voice/audio-playback-manager.ts +120 -98
- package/src/voice/browser-voice-provider.ts +37 -37
- package/src/voice/fallback-speech-engine.ts +22 -16
- package/src/voice/keyed-voice-transcript.ts +314 -0
- package/src/voice/mic-state-styles.ts +182 -0
- package/src/voice/read-aloud-controller.ts +46 -44
- package/src/voice/runtype-speech-engine.ts +35 -33
- package/src/voice/runtype-voice-provider.ts +856 -164
- package/src/voice/session-voice-wiring.ts +266 -0
- package/src/voice/voice-delegation.test.ts +71 -0
- package/src/voice/voice-delegation.ts +364 -0
- package/src/voice/voice-turn-tracker.ts +6 -6
- package/src/voice/voice.test.ts +1250 -7
- package/src/voice/worklet-playback-engine.test.ts +81 -0
- package/src/voice/worklet-playback-engine.ts +21 -3
- package/src/voice-runtime-loader.ts +4 -1
- package/src/voice-runtime.ts +7 -0
- package/src/webmcp-runtime-entry.ts +41 -39
- package/dist/approval-ui-3NMYNXBD.js +0 -1
- package/dist/chunk-5EIIHQLQ.js +0 -1
- package/dist/chunk-7CO4T5KB.js +0 -1
- package/dist/chunk-EFJBUH5F.js +0 -1
- package/dist/chunk-R2TMIMDI.js +0 -3
- package/dist/chunk-UTVLOTWB.js +0 -9
- package/dist/context-mentions-45MODWOY.js +0 -161
- package/dist/event-stream-view-GL3ADRY2.js +0 -1
- package/dist/runtype-tts-entry-UJAEF7NZ.js +0 -1
- package/dist/voice-runtime-EFR3R5ES.js +0 -1
- package/dist/webmcp-runtime-JI7T4QYF.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ke=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var mt=(t,e)=>{for(var r in e)ke(t,r,{get:e[r],enumerable:!0})},xt=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pt(e))!it.call(t,o)&&o!==r&&ke(t,o,{get:()=>e[o],enumerable:!(a=dt(e,o))||a.enumerable});return t};var ct=t=>xt(ke({},"__esModule",{value:!0}),t);var Ht={};mt(Ht,{EventStreamBuffer:()=>de,EventStreamStore:()=>pe,ThroughputTracker:()=>ie,createEventStreamView:()=>Be});module.exports=ct(Ht);var u=(t,e)=>{let r=document.createElement(t);return e&&(r.className=e),r};var ce=[["path",{d:"M20 6 9 17l-5-5"}]];var Te=[["path",{d:"m6 9 6 6 6-6"}]];var Ae=[["path",{d:"m9 18 6-6-6-6"}]];var he=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];var ge=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}]];var Pe=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];var Ce=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var N=(t,e=24,r="currentColor",a=2)=>{if(!Array.isArray(t))return null;let o=document.createElementNS("http://www.w3.org/2000/svg","svg");return o.setAttribute("width",String(e)),o.setAttribute("height",String(e)),o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("fill","none"),o.setAttribute("stroke",r),o.setAttribute("stroke-width",String(a)),o.setAttribute("stroke-linecap","round"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("aria-hidden","true"),t.forEach(f=>{if(!Array.isArray(f)||f.length<2)return;let n=f[0],p=f[1];if(!p)return;let x=document.createElementNS("http://www.w3.org/2000/svg",n);Object.entries(p).forEach(([C,v])=>{C!=="stroke"&&x.setAttribute(C,String(v))}),o.appendChild(x)}),o};function Ze(t=!0){let e=t;return{isFollowing:()=>e,pause:()=>e?(e=!1,!0):!1,resume:()=>e?!1:(e=!0,!0)}}function ht(t){return Math.max(0,t.scrollHeight-t.clientHeight)}function $e(t,e){return ht(t)-t.scrollTop<=e}function Je(t){let{following:e,currentScrollTop:r,lastScrollTop:a,nearBottom:o,userScrollThreshold:f,isAutoScrolling:n=!1,pauseOnUpwardScroll:p=!1,pauseWhenAwayFromBottom:x=!0,resumeRequiresDownwardScroll:C=!1}=t,v=r-a;return n||Math.abs(v)<f?{action:"none",delta:v,nextLastScrollTop:r}:!e&&o&&(!C||v>0)?{action:"resume",delta:v,nextLastScrollTop:r}:e&&p&&v<0?{action:"pause",delta:v,nextLastScrollTop:r}:e&&x&&!o?{action:"pause",delta:v,nextLastScrollTop:r}:{action:"none",delta:v,nextLastScrollTop:r}}function je(t){let{following:e,deltaY:r,nearBottom:a=!1,resumeWhenNearBottom:o=!1}=t;return e&&r<0?"pause":!e&&o&&r>0&&a?"resume":"none"}function ee(t,e){e&&e.split(/\s+/).forEach(r=>r&&t.classList.add(r))}var _={flow_:{bg:"var(--persona-event-badge-flow-bg, #dcfce7)",text:"var(--persona-event-badge-flow-fg, #15803d)"},step_:{bg:"var(--persona-event-badge-step-bg, #f5f5f5)",text:"var(--persona-event-badge-step-fg, #0a0a0a)"},reasoning_:{bg:"var(--persona-event-badge-reasoning-bg, #fef9c3)",text:"var(--persona-event-badge-reasoning-fg, #a16207)"},tool_:{bg:"var(--persona-event-badge-tool-bg, #f3e8ff)",text:"var(--persona-event-badge-tool-fg, #6b21a8)"},agent_:{bg:"var(--persona-event-badge-agent-bg, #ccfbf1)",text:"var(--persona-event-badge-agent-fg, #115e59)"},error:{bg:"var(--persona-event-badge-error-bg, #fee2e2)",text:"var(--persona-event-badge-error-fg, #b91c1c)"}};_.execution_error=_.error;_.execution_=_.flow_;_.turn_=_.agent_;_.text_=_.agent_;var gt={bg:"var(--persona-event-badge-default-bg, #f3f4f6)",text:"var(--persona-event-badge-default-fg, #4b5563)"},Ct=["flowName","stepName","reasoningText","text","name","tool","toolName"],St=100;function Qe(t,e){if(e[t])return e[t];for(let r of Object.keys(e))if(r.endsWith("_")&&t.startsWith(r))return e[r]}function wt(t,e){return(e&&Qe(t,e))??Qe(t,_)??gt}function bt(t){return/^#[0-9a-fA-F]{6}$/.test(t)?`${t}50`:`color-mix(in srgb, ${t} 31%, transparent)`}function yt(t,e){return`+${((t-e)/1e3).toFixed(3)}s`}function vt(t){let e=new Date(t),r=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0"),f=String(e.getMilliseconds()).padStart(3,"0");return`${r}:${a}:${o}.${f}`}function kt(t,e){try{let r=JSON.parse(t);if(typeof r!="object"||r===null)return null;for(let a of e){let o=a.split("."),f=r;for(let n of o)if(f&&typeof f=="object"&&f!==null)f=f[n];else{f=void 0;break}if(typeof f=="string"&&f.trim())return f.trim()}}catch{}return null}function Tt(t){return navigator.clipboard?.writeText?navigator.clipboard.writeText(t):new Promise(e=>{let r=document.createElement("textarea");r.value=t,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r),e()})}function At(t){let e;try{e=JSON.parse(t.payload)}catch{e=t.payload}return JSON.stringify({type:t.type,timestamp:new Date(t.timestamp).toISOString(),payload:e},null,2)}function Pt(t){return t.tokensPerSecond===void 0||!Number.isFinite(t.tokensPerSecond)?"-- tok/s":`${t.tokensPerSecond.toFixed(1)} tok/s`}function Mt(t){let e=[];return t.outputTokens!==void 0&&e.push(`${t.outputTokens.toLocaleString()} tok`),t.durationMs!==void 0&&e.push(`${(t.durationMs/1e3).toFixed(2)}s`),t.source&&e.push(t.source),e.join(" \xB7 ")}function Bt(t,e,r){let a,o;try{o=JSON.parse(t.payload),a=JSON.stringify(o,null,2)}catch{o=t.payload,a=t.payload}let f=e.find(p=>p.renderEventStreamPayload);if(f?.renderEventStreamPayload&&r){let p=f.renderEventStreamPayload({event:t,config:r,defaultRenderer:()=>n(),parsedPayload:o});if(p)return p}return n();function n(){let p=u("div","persona-bg-persona-container persona-border-t persona-border-persona-divider persona-px-3 persona-py-2 persona-ml-4 persona-mr-3 persona-mb-1 persona-rounded-b persona-overflow-auto persona-max-h-[300px]"),x=u("pre","persona-m-0 persona-whitespace-pre-wrap persona-break-all persona-text-[11px] persona-text-persona-secondary persona-font-mono");return x.textContent=a,p.appendChild(x),p}}function Me(t,e,r,a,o,f,n,p){let x=o.has(t.id),C=u("div","persona-border-b persona-border-persona-divider persona-text-xs");ee(C,a.classNames?.eventRow);let v=n.find(B=>B.renderEventStreamRow);if(v?.renderEventStreamRow&&p){let B=v.renderEventStreamRow({event:t,index:e,config:p,defaultRenderer:()=>I(),isExpanded:x,onToggleExpand:()=>f(t.id)});if(B)return C.appendChild(B),C}return C.appendChild(I()),C;function I(){let B=u("div",""),D=u("div","persona-flex persona-items-center persona-gap-2 persona-px-3 persona-py-3 hover:persona-bg-persona-container persona-cursor-pointer persona-group");D.setAttribute("data-event-id",t.id);let te=u("span","persona-flex-shrink-0 persona-text-persona-muted persona-w-4 persona-text-center persona-flex persona-items-center persona-justify-center"),L=N(x?Te:Ae,"14px","currentColor",2);L&&te.appendChild(L);let H=u("span","persona-text-[11px] persona-text-persona-muted persona-whitespace-nowrap persona-flex-shrink-0 persona-font-mono persona-w-[70px]"),b=a.timestampFormat??"relative";H.textContent=b==="relative"?yt(t.timestamp,r):vt(t.timestamp);let F=null;a.showSequenceNumbers!==!1&&(F=u("span","persona-text-[11px] persona-text-persona-muted persona-font-mono persona-flex-shrink-0 persona-w-[28px] persona-text-right"),F.textContent=String(e+1));let M=wt(t.type,a.badgeColors),R=u("span","persona-inline-flex persona-items-center persona-px-2 persona-py-0.5 persona-rounded persona-text-[11px] persona-font-mono persona-font-medium persona-whitespace-nowrap persona-flex-shrink-0 persona-border");R.style.backgroundColor=M.bg,R.style.color=M.text,R.style.borderColor=bt(M.text),R.textContent=t.type;let re=a.descriptionFields??Ct,j=kt(t.payload,re),W=null;j&&(W=u("span","persona-text-[11px] persona-text-persona-secondary persona-truncate persona-min-w-0"),W.textContent=j);let k=u("div","persona-flex-1 persona-min-w-0"),T=u("button","persona-text-persona-muted hover:persona-text-persona-primary persona-cursor-pointer persona-flex-shrink-0 persona-border-none persona-bg-transparent persona-p-0"),ae=N(ge,"12px","currentColor",1.5);return ae&&T.appendChild(ae),T.addEventListener("click",async Q=>{Q.stopPropagation(),await Tt(At(t)),T.innerHTML="";let q=N(ce,"12px","currentColor",1.5);q&&T.appendChild(q),setTimeout(()=>{T.innerHTML="";let Y=N(ge,"12px","currentColor",1.5);Y&&T.appendChild(Y)},1500)}),D.appendChild(te),D.appendChild(H),F&&D.appendChild(F),D.appendChild(R),W&&D.appendChild(W),D.appendChild(k),D.appendChild(T),B.appendChild(D),x&&B.appendChild(Bt(t,n,p)),B}}function Be(t){let{buffer:e,getFullHistory:r,onClose:a,config:o,plugins:f=[],getThroughput:n}=t,p=t.renderIconByName??(()=>null),x=o?.features?.scrollToBottom,C=x?.enabled!==!1,v=x?.iconName??"arrow-down",I=x?.label??"",B=o?.features?.eventStream??{},D=f.find(L=>L.renderEventStreamView);if(D?.renderEventStreamView&&o){let L=D.renderEventStreamView({config:o,events:e.getAll(),defaultRenderer:()=>te().element,onClose:a});if(L)return{element:L,update:()=>{},destroy:()=>{}}}return te();function te(){let L=B.classNames,H=u("div","persona-event-stream-view persona-flex persona-flex-col persona-flex-1 persona-min-h-0");ee(H,L?.panel);let b=[],F="",M="",R=null,re=[],j={},W=0,k=Ze(),T=0,ae=0,Q=!1,q=null,Y=!1,Fe=0,Z=new Set,O=new Map,Re="",Ee="",J=null,S,g,w,E,oe=null,U=null,V=null;function we(){let s=u("div","persona-event-toolbar persona-relative persona-flex persona-flex-col persona-flex-shrink-0"),l=u("div","persona-flex persona-items-center persona-gap-2 persona-px-4 persona-py-3 persona-pb-0 persona-border-persona-divider persona-bg-persona-surface persona-overflow-hidden");if(ee(l,L?.headerBar),n){U=u("div","persona-relative persona-flex persona-items-center persona-gap-1.5 persona-whitespace-nowrap"),U.style.cursor="help",oe=u("span","persona-text-[11px] persona-font-mono persona-bg-persona-container persona-text-persona-muted persona-px-2 persona-py-0.5 persona-rounded persona-border persona-border-persona-border persona-tabular-nums"),oe.textContent="-- tok/s",V=u("div","persona-absolute persona-z-50 persona-whitespace-nowrap persona-rounded persona-border persona-border-persona-border persona-bg-persona-container persona-text-persona-primary persona-text-[11px] persona-font-mono persona-px-2 persona-py-1 persona-shadow"),V.style.display="none",V.style.pointerEvents="none";let K=U,ne=V,ut=()=>{if(!ne.textContent)return;let Ke=K.getBoundingClientRect(),_e=s.getBoundingClientRect();ne.style.left=`${Ke.left-_e.left}px`,ne.style.top=`${Ke.bottom-_e.top+4}px`,ne.style.display="block"},nt=()=>{ne.style.display="none"};U.addEventListener("mouseenter",ut),U.addEventListener("mouseleave",nt),U.appendChild(oe)}let d=u("div","persona-flex-1");S=u("select","persona-text-xs persona-bg-persona-surface persona-border persona-border-persona-border persona-rounded persona-px-2.5 persona-py-1 persona-text-persona-primary persona-cursor-pointer");let y=u("option","");y.value="",y.textContent="All events (0)",S.appendChild(y),g=u("button","persona-inline-flex persona-items-center persona-gap-1.5 persona-rounded persona-text-xs persona-text-persona-muted hover:persona-bg-persona-container hover:persona-text-persona-primary persona-cursor-pointer persona-border persona-border-persona-border persona-bg-persona-surface persona-flex-shrink-0 persona-px-2.5 persona-py-1"),g.type="button",g.title="Copy All";let z=N(he,"12px","currentColor",1.5);z&&g.appendChild(z);let X=u("span","persona-event-copy-all persona-text-xs");X.textContent="Copy All",g.appendChild(X),U&&l.appendChild(U),l.appendChild(d),l.appendChild(S),l.appendChild(g);let i=u("div","persona-relative persona-px-4 persona-py-2.5 persona-border-b persona-border-persona-divider persona-bg-persona-surface");ee(i,L?.searchBar);let m=N(Pe,"14px","var(--persona-muted, #9ca3af)",1.5),h=u("span","persona-absolute persona-left-6 persona-top-1/2 persona--translate-y-1/2 persona-pointer-events-none persona-flex persona-items-center");m&&h.appendChild(m),w=u("input","persona-text-sm persona-bg-persona-surface persona-border persona-border-persona-border persona-rounded-md persona-pl-8 persona-pr-3 persona-py-1 persona-w-full persona-text-persona-primary"),ee(w,L?.searchInput),w.type="text",w.placeholder="Search event payloads...",E=u("button","persona-absolute persona-right-5 persona-top-1/2 persona--translate-y-1/2 persona-text-persona-muted hover:persona-text-persona-primary persona-cursor-pointer persona-border-none persona-bg-transparent persona-p-0 persona-leading-none"),E.type="button",E.style.display="none";let P=N(Ce,"12px","currentColor",2);return P&&E.appendChild(P),i.appendChild(h),i.appendChild(w),i.appendChild(E),s.appendChild(l),s.appendChild(i),V&&s.appendChild(V),s}let be,De=f.find(s=>s.renderEventStreamToolbar);De?.renderEventStreamToolbar&&o?be=De.renderEventStreamToolbar({config:o,defaultRenderer:()=>we(),eventCount:e.getSize(),filteredCount:0,onFilterChange:l=>{F=l,ue(),$()},onSearchChange:l=>{M=l,ue(),$()}})??we():be=we();let fe=u("div","persona-text-xs persona-text-persona-muted persona-text-center persona-py-0.5 persona-px-4 persona-bg-persona-container persona-border-b persona-border-persona-divider persona-italic persona-flex-shrink-0");fe.style.display="none";function at(){if(!n||!oe||!U)return;let s=n(),l=Pt(s);oe.textContent=l;let d=Mt(s);V&&(V.textContent=d,d||(V.style.display="none")),U.setAttribute("aria-label",d?`Throughput: ${l}, ${d}`:`Throughput: ${l}`)}let me=u("div","persona-flex-1 persona-min-h-0 persona-relative"),c=u("div","persona-event-stream-list persona-overflow-y-auto persona-min-h-0");c.style.height="100%";let A=u("div","persona-scroll-to-bottom-indicator persona-absolute persona-bottom-3 persona-left-1/2 persona-transform persona--translate-x-1/2 persona-cursor-pointer persona-z-10 persona-text-xs");ee(A,L?.scrollIndicator),A.style.display="none",A.setAttribute("data-persona-scroll-to-bottom-has-label",I?"true":"false");let He=p(v,"14px","currentColor",2);He&&A.appendChild(He);let se=u("span","");se.textContent=I,A.appendChild(se);let le=u("div","persona-flex persona-items-center persona-justify-center persona-h-full persona-text-sm persona-text-persona-muted");le.style.display="none",me.appendChild(c),me.appendChild(le),me.appendChild(A),H.setAttribute("tabindex","0"),H.appendChild(be),H.appendChild(fe),H.appendChild(me);function ot(){let s=e.getAll(),l={};for(let i of s)l[i.type]=(l[i.type]||0)+1;let d=Object.keys(l).sort(),y=d.length!==re.length||!d.every((i,m)=>i===re[m]),G=!y&&d.some(i=>l[i]!==j[i]),z=s.length!==Object.values(j).reduce((i,m)=>i+m,0);if(!y&&!G&&!z||(re=d,j=l,!S))return;let X=S.value;if(S.options[0].textContent=`All events (${s.length})`,y){for(;S.options.length>1;)S.remove(1);for(let i of d){let m=u("option","");m.value=i,m.textContent=`${i} (${l[i]||0})`,S.appendChild(m)}X&&d.includes(X)?S.value=X:X&&(S.value="",F="")}else for(let i=1;i<S.options.length;i++){let m=S.options[i];m.textContent=`${m.value} (${l[m.value]||0})`}}function ft(){let s=e.getAll();if(F&&(s=s.filter(l=>l.type===F)),M){let l=M.toLowerCase();s=s.filter(d=>d.type.toLowerCase().includes(l)||d.payload.toLowerCase().includes(l))}return s}function ye(){return F!==""||M!==""}function ue(){W=0,T=0,k.resume(),A.style.display="none"}function xe(s){Z.has(s)?Z.delete(s):Z.add(s),J=s;let l=c.scrollTop,d=k.isFollowing();Y=!0,k.pause(),$(),c.scrollTop=l,d&&k.resume(),Y=!1}function qe(){return $e(c,50)}function $(){ae=Date.now(),Q=!1,at(),ot();let s=e.getEvictedCount();s>0?(fe.textContent=`${s.toLocaleString()} older events truncated`,fe.style.display=""):fe.style.display="none",b=ft();let l=b.length,d=e.getSize()>0;l===0&&d&&ye()?(le.textContent=M?`No events matching '${M}'`:"No events matching filter",le.style.display="",c.style.display="none"):(le.style.display="none",c.style.display=""),g&&(g.title=ye()?`Copy Filtered (${l})`:"Copy All"),C&&!k.isFollowing()&&l>W&&(T+=l-W,se.textContent=I?`${I}${T>0?` (${T})`:""}`:"",A.style.display=""),W=l;let y=e.getAll(),G=y.length>0?y[0].timestamp:0,z=new Set(b.map(m=>m.id));for(let m of Z)z.has(m)||Z.delete(m);let X=F!==Re||M!==Ee,i=O.size===0&&b.length>0;if(X||i||b.length===0){c.innerHTML="",O.clear();let m=document.createDocumentFragment();for(let h=0;h<b.length;h++){let P=Me(b[h],h,G,B,Z,xe,f,o);O.set(b[h].id,P),m.appendChild(P)}c.appendChild(m),Re=F,Ee=M,J=null}else{if(J!==null){let h=O.get(J);if(h&&h.parentNode===c){let P=b.findIndex(K=>K.id===J);if(P>=0){let K=Me(b[P],P,G,B,Z,xe,f,o);c.insertBefore(K,h),h.remove(),O.set(J,K)}}J=null}let m=new Set(b.map(h=>h.id));for(let[h,P]of O)m.has(h)||(P.remove(),O.delete(h));for(let h=0;h<b.length;h++){let P=b[h];if(!O.has(P.id)){let K=Me(P,h,G,B,Z,xe,f,o);O.set(P.id,K),c.appendChild(K)}}}k.isFollowing()&&(c.scrollTop=c.scrollHeight)}function st(){if(Date.now()-ae>=St){q!==null&&(cancelAnimationFrame(q),q=null),$();return}Q||(Q=!0,q=requestAnimationFrame(()=>{q=null,$()}))}let Oe=(s,l)=>{if(!g)return;g.innerHTML="";let d=N(s,"12px","currentColor",1.5);d&&g.appendChild(d);let y=u("span","persona-text-xs");y.textContent="Copy All",g.appendChild(y),setTimeout(()=>{g.innerHTML="";let G=N(he,"12px","currentColor",1.5);G&&g.appendChild(G);let z=u("span","persona-text-xs");z.textContent="Copy All",g.appendChild(z),g.disabled=!1},l)},Ue=async()=>{if(g){g.disabled=!0;try{let s;ye()?s=b:r?(s=await r(),s.length===0&&(s=e.getAll())):s=e.getAll();let l=s.map(d=>{try{return JSON.parse(d.payload)}catch{return d.payload}});await navigator.clipboard.writeText(JSON.stringify(l,null,2)),Oe(ce,1500)}catch{Oe(Ce,1500)}}},Ne=()=>{S&&(F=S.value,ue(),$())},Ie=()=>{!w||!E||(E.style.display=w.value?"":"none",R&&clearTimeout(R),R=setTimeout(()=>{M=w.value,ue(),$()},150))},ve=()=>{!w||!E||(w.value="",M="",E.style.display="none",R&&clearTimeout(R),ue(),$())},We=()=>{if(Y)return;let s=c.scrollTop,{action:l,nextLastScrollTop:d}=Je({following:k.isFollowing(),currentScrollTop:s,lastScrollTop:Fe,nearBottom:qe(),userScrollThreshold:1,resumeRequiresDownwardScroll:!0});Fe=d,l==="resume"?(k.resume(),T=0,A.style.display="none"):l==="pause"&&(k.pause(),C&&(se.textContent=I,A.style.display=""))},Ve=s=>{let l=je({following:k.isFollowing(),deltaY:s.deltaY,nearBottom:qe(),resumeWhenNearBottom:!0});l==="pause"?(k.pause(),C&&(se.textContent=I,A.style.display="")):l==="resume"&&(k.resume(),T=0,A.style.display="none")},Ge=()=>{C&&(c.scrollTop=c.scrollHeight,k.resume(),T=0,A.style.display="none")},ze=s=>{let l=s.target;if(!l||l.closest("button"))return;let d=l.closest("[data-event-id]");if(!d)return;let y=d.getAttribute("data-event-id");y&&xe(y)},Xe=s=>{if((s.metaKey||s.ctrlKey)&&s.key==="f"){s.preventDefault(),w?.focus(),w?.select();return}s.key==="Escape"&&(w&&document.activeElement===w?(ve(),w.blur(),H.focus()):a&&a())};g&&g.addEventListener("click",Ue),S&&S.addEventListener("change",Ne),w&&w.addEventListener("input",Ie),E&&E.addEventListener("click",ve),c.addEventListener("scroll",We),c.addEventListener("wheel",Ve,{passive:!0}),c.addEventListener("click",ze),A.addEventListener("click",Ge),H.addEventListener("keydown",Xe);function lt(){R&&clearTimeout(R),q!==null&&(cancelAnimationFrame(q),q=null),Q=!1,O.clear(),g&&g.removeEventListener("click",Ue),S&&S.removeEventListener("change",Ne),w&&w.removeEventListener("input",Ie),E&&E.removeEventListener("click",ve),c.removeEventListener("scroll",We),c.removeEventListener("wheel",Ve),c.removeEventListener("click",ze),A.removeEventListener("click",Ge),H.removeEventListener("keydown",Xe)}return{element:H,update:st,destroy:lt}}}var de=class{constructor(e=2e3,r=null){this.head=0;this.count=0;this.totalCaptured=0;this.eventTypesSet=new Set;this.maxSize=e,this.buffer=new Array(e),this.store=r}push(e){this.buffer[this.head]=e,this.head=(this.head+1)%this.maxSize,this.count<this.maxSize&&this.count++,this.totalCaptured++,this.eventTypesSet.add(e.type),this.store?.put(e)}getAll(){return this.count===0?[]:this.count<this.maxSize?this.buffer.slice(0,this.count):[...this.buffer.slice(this.head,this.maxSize),...this.buffer.slice(0,this.head)]}async restore(){if(!this.store)return 0;let e=await this.store.getAll();if(e.length===0)return 0;let r=e.length>this.maxSize?e.slice(e.length-this.maxSize):e;for(let a of r)this.buffer[this.head]=a,this.head=(this.head+1)%this.maxSize,this.count<this.maxSize&&this.count++,this.eventTypesSet.add(a.type);return this.totalCaptured=e.length,r.length}getAllFromStore(){return this.store?this.store.getAll():Promise.resolve(this.getAll())}getRecent(e){let r=this.getAll();return e>=r.length?r:r.slice(r.length-e)}getSize(){return this.count}getTotalCaptured(){return this.totalCaptured}getEvictedCount(){return this.totalCaptured-this.count}clear(){this.buffer=new Array(this.maxSize),this.head=0,this.count=0,this.totalCaptured=0,this.eventTypesSet.clear(),this.store?.clear()}destroy(){this.buffer=[],this.head=0,this.count=0,this.totalCaptured=0,this.eventTypesSet.clear(),this.store?.destroy()}getEventTypes(){return Array.from(this.eventTypesSet)}};var pe=class{constructor(e="persona-event-stream",r="events"){this.db=null;this.pendingWrites=[];this.flushScheduled=!1;this.isDestroyed=!1;this.dbName=e,this.storeName=r}open(){return new Promise((e,r)=>{try{let a=indexedDB.open(this.dbName,1);a.onupgradeneeded=()=>{let o=a.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName,{keyPath:"id"}).createIndex("timestamp","timestamp",{unique:!1})},a.onsuccess=()=>{this.db=a.result,e()},a.onerror=()=>{r(a.error)}}catch(a){r(a)}})}put(e){!this.db||this.isDestroyed||(this.pendingWrites.push(e),this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushWrites())))}putBatch(e){if(!(!this.db||this.isDestroyed||e.length===0))try{let a=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName);for(let o of e)a.put(o)}catch{}}getAll(){return new Promise((e,r)=>{if(!this.db){e([]);return}try{let n=this.db.transaction(this.storeName,"readonly").objectStore(this.storeName).index("timestamp").getAll();n.onsuccess=()=>{e(n.result)},n.onerror=()=>{r(n.error)}}catch(a){r(a)}})}getCount(){return new Promise((e,r)=>{if(!this.db){e(0);return}try{let f=this.db.transaction(this.storeName,"readonly").objectStore(this.storeName).count();f.onsuccess=()=>{e(f.result)},f.onerror=()=>{r(f.error)}}catch(a){r(a)}})}clear(){return new Promise((e,r)=>{if(!this.db){e();return}this.pendingWrites=[];try{let f=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).clear();f.onsuccess=()=>{e()},f.onerror=()=>{r(f.error)}}catch(a){r(a)}})}close(){this.db&&(this.db.close(),this.db=null)}destroy(){return this.isDestroyed=!0,this.pendingWrites=[],this.close(),new Promise((e,r)=>{try{let a=indexedDB.deleteDatabase(this.dbName);a.onsuccess=()=>{e()},a.onerror=()=>{r(a.error)}}catch(a){r(a)}})}flushWrites(){if(this.flushScheduled=!1,!this.db||this.isDestroyed||this.pendingWrites.length===0)return;let e=this.pendingWrites;this.pendingWrites=[];try{let a=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName);for(let o of e)a.put(o)}catch{}}};var Lt=new Set(["step_start","turn_start"]),Ft=new Set(["step_complete","turn_complete"]),tt=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),rt=t=>typeof t=="number"&&Number.isFinite(t)?t:void 0,Ye=(t,e)=>{let r=t[e];return tt(r)?r:void 0};function Le(t){return t>0?Math.max(1,Math.ceil(t/4)):0}function Se(t,e){if(!(t<=0||e===void 0||e<250))return t/(e/1e3)}function Rt(t,e){return typeof e.type=="string"?e.type:t}function et(t){let e=Ye(t,"tokens")??Ye(t,"totalTokens");return e?rt(e.output):void 0}function Et(t){return rt(t.durationMs)}function Dt(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var ie=class{constructor(e=Dt){this.metric={status:"idle"};this.run=null;this.now=e}getMetric(){let e=this.run;if(e&&this.metric.status==="running"&&e.firstDeltaAt!==void 0&&this.metric.outputTokens!==void 0){let r=this.now()-e.firstDeltaAt;return{...this.metric,durationMs:r,tokensPerSecond:Se(this.metric.outputTokens,r)}}return this.metric}reset(){this.run=null,this.metric={status:"idle"}}startRun(e){this.run={startedAt:e,visibleCharCount:0,exactOutputTokens:0},this.metric={status:"running"}}processEvent(e,r){if(!tt(r)){e==="execution_error"&&this.run&&(this.run=null,this.metric={status:"error"});return}let a=Rt(e,r),o=this.now();if(a==="execution_start"){this.startRun(o);return}if(Lt.has(a)){this.run||this.startRun(o);return}if(a==="text_delta"){let f=typeof r.delta=="string"?r.delta:"";if(!f)return;this.run||this.startRun(o);let n=this.run;n.firstDeltaAt??(n.firstDeltaAt=o),n.visibleCharCount+=f.length;let p=n.exactOutputTokens+Le(n.visibleCharCount),x=o-n.firstDeltaAt;this.metric={status:"running",tokensPerSecond:Se(p,x),outputTokens:p,durationMs:x,source:n.exactOutputTokens>0?"usage":"estimate"};return}if(Ft.has(a)){if(!this.run)return;let f=this.run,n=et(r);n!==void 0&&(f.exactOutputTokens+=n,f.visibleCharCount=0);let p=f.exactOutputTokens>0,x=f.exactOutputTokens+Le(f.visibleCharCount),C=this.resolveDuration(f,r,o);this.metric={status:"running",tokensPerSecond:Se(x,C),outputTokens:x,durationMs:C,source:p?"usage":"estimate"};return}if(a==="execution_complete"){if(!this.run)return;let f=this.run,n=et(r),p=n??f.exactOutputTokens+Le(f.visibleCharCount),x=n!==void 0||f.exactOutputTokens>0?"usage":"estimate",C=this.resolveDuration(f,r,o);this.metric={status:"complete",tokensPerSecond:Se(p,C),outputTokens:p,durationMs:C,source:x},this.run=null;return}if(a==="execution_error"||a==="error"&&r.recoverable===!1){if(!this.run)return;this.run=null,this.metric={status:"error"}}}resolveDuration(e,r,a){let o=e.firstDeltaAt!==void 0?a-e.firstDeltaAt:void 0;return o!==void 0&&o>=250?o:Et(r)??a-e.startedAt}};0&&(module.exports={EventStreamBuffer,EventStreamStore,ThroughputTracker,createEventStreamView});
|
|
1
|
+
"use strict";var ve=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var mt=(t,e)=>{for(var r in e)ve(t,r,{get:e[r],enumerable:!0})},xt=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of pt(e))!it.call(t,a)&&a!==r&&ve(t,a,{get:()=>e[a],enumerable:!(o=dt(e,a))||o.enumerable});return t};var ct=t=>xt(ve({},"__esModule",{value:!0}),t);var Ht={};mt(Ht,{EventStreamBuffer:()=>de,EventStreamStore:()=>pe,ThroughputTracker:()=>ie,createEventStreamView:()=>Be});module.exports=ct(Ht);var u=(t,e)=>{let r=document.createElement(t);return e&&(r.className=e),r};var ce=[["path",{d:"M20 6 9 17l-5-5"}]];var Te=[["path",{d:"m6 9 6 6 6-6"}]];var Ae=[["path",{d:"m9 18 6-6-6-6"}]];var he=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];var ge=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}]];var Pe=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];var Ce=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var I=(t,e=24,r="currentColor",o=2)=>{if(!Array.isArray(t))return null;let a=document.createElementNS("http://www.w3.org/2000/svg","svg");return a.setAttribute("width",String(e)),a.setAttribute("height",String(e)),a.setAttribute("viewBox","0 0 24 24"),a.setAttribute("fill","none"),a.setAttribute("stroke",r),a.setAttribute("stroke-width",String(o)),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),a.setAttribute("aria-hidden","true"),t.forEach(f=>{if(!Array.isArray(f)||f.length<2)return;let n=f[0],p=f[1];if(!p)return;let x=document.createElementNS("http://www.w3.org/2000/svg",n);Object.entries(p).forEach(([C,k])=>{C!=="stroke"&&x.setAttribute(C,String(k))}),a.appendChild(x)}),a};function Ze(t=!0){let e=t;return{isFollowing:()=>e,pause:()=>e?(e=!1,!0):!1,resume:()=>e?!1:(e=!0,!0)}}function ht(t){return Math.max(0,t.scrollHeight-t.clientHeight)}function $e(t,e){return ht(t)-t.scrollTop<=e}function Je(t){let{following:e,currentScrollTop:r,lastScrollTop:o,nearBottom:a,userScrollThreshold:f,isAutoScrolling:n=!1,pauseOnUpwardScroll:p=!1,pauseWhenAwayFromBottom:x=!0,resumeRequiresDownwardScroll:C=!1}=t,k=r-o;return n||Math.abs(k)<f?{action:"none",delta:k,nextLastScrollTop:r}:!e&&a&&(!C||k>0)?{action:"resume",delta:k,nextLastScrollTop:r}:e&&p&&k<0?{action:"pause",delta:k,nextLastScrollTop:r}:e&&x&&!a?{action:"pause",delta:k,nextLastScrollTop:r}:{action:"none",delta:k,nextLastScrollTop:r}}function je(t){let{following:e,deltaY:r,nearBottom:o=!1,resumeWhenNearBottom:a=!1}=t;return e&&r<0?"pause":!e&&a&&r>0&&o?"resume":"none"}function ee(t,e){e&&e.split(/\s+/).forEach(r=>r&&t.classList.add(r))}var _={flow_:{bg:"var(--persona-event-badge-flow-bg, #dcfce7)",text:"var(--persona-event-badge-flow-fg, #15803d)"},step_:{bg:"var(--persona-event-badge-step-bg, #f5f5f5)",text:"var(--persona-event-badge-step-fg, #0a0a0a)"},reasoning_:{bg:"var(--persona-event-badge-reasoning-bg, #fef9c3)",text:"var(--persona-event-badge-reasoning-fg, #a16207)"},tool_:{bg:"var(--persona-event-badge-tool-bg, #f3e8ff)",text:"var(--persona-event-badge-tool-fg, #6b21a8)"},agent_:{bg:"var(--persona-event-badge-agent-bg, #ccfbf1)",text:"var(--persona-event-badge-agent-fg, #115e59)"},error:{bg:"var(--persona-event-badge-error-bg, #fee2e2)",text:"var(--persona-event-badge-error-fg, #b91c1c)"}};_.execution_error=_.error;_.execution_=_.flow_;_.turn_=_.agent_;_.text_=_.agent_;var gt={bg:"var(--persona-event-badge-default-bg, #f3f4f6)",text:"var(--persona-event-badge-default-fg, #4b5563)"},Ct=["flowName","stepName","reasoningText","text","name","tool","toolName"],St=100;function Qe(t,e){if(e[t])return e[t];for(let r of Object.keys(e))if(r.endsWith("_")&&t.startsWith(r))return e[r]}function wt(t,e){return(e&&Qe(t,e))??Qe(t,_)??gt}function yt(t){return/^#[0-9a-fA-F]{6}$/.test(t)?`${t}50`:`color-mix(in srgb, ${t} 31%, transparent)`}function bt(t,e){return`+${((t-e)/1e3).toFixed(3)}s`}function kt(t){let e=new Date(t),r=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0"),f=String(e.getMilliseconds()).padStart(3,"0");return`${r}:${o}:${a}.${f}`}function vt(t,e){try{let r=JSON.parse(t);if(typeof r!="object"||r===null)return null;for(let o of e){let a=o.split("."),f=r;for(let n of a)if(f&&typeof f=="object"&&f!==null)f=f[n];else{f=void 0;break}if(typeof f=="string"&&f.trim())return f.trim()}}catch{}return null}function Tt(t){return navigator.clipboard?.writeText?navigator.clipboard.writeText(t):new Promise(e=>{let r=document.createElement("textarea");r.value=t,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r),e()})}function At(t){let e;try{e=JSON.parse(t.payload)}catch{e=t.payload}return JSON.stringify({type:t.type,timestamp:new Date(t.timestamp).toISOString(),payload:e},null,2)}function Pt(t){return t.tokensPerSecond===void 0||!Number.isFinite(t.tokensPerSecond)?"-- tok/s":`${t.tokensPerSecond.toFixed(1)} tok/s`}function Mt(t){let e=[];return t.outputTokens!==void 0&&e.push(`${t.outputTokens.toLocaleString()} tok`),t.durationMs!==void 0&&e.push(`${(t.durationMs/1e3).toFixed(2)}s`),t.source&&e.push(t.source),e.join(" \xB7 ")}function Bt(t,e,r){let o,a;try{a=JSON.parse(t.payload),o=JSON.stringify(a,null,2)}catch{a=t.payload,o=t.payload}let f=e.find(p=>p.renderEventStreamPayload);if(f?.renderEventStreamPayload&&r){let p=f.renderEventStreamPayload({event:t,config:r,defaultRenderer:()=>n(),parsedPayload:a});if(p)return p}return n();function n(){let p=u("div","persona-bg-persona-container persona-border-t persona-border-persona-divider persona-px-3 persona-py-2 persona-ml-4 persona-mr-3 persona-mb-1 persona-rounded-b persona-overflow-auto persona-max-h-[300px]"),x=u("pre","persona-m-0 persona-whitespace-pre-wrap persona-break-all persona-text-[11px] persona-text-persona-secondary persona-font-mono");return x.textContent=o,p.appendChild(x),p}}function Me(t,e,r,o,a,f,n,p){let x=a.has(t.id),C=u("div","persona-border-b persona-border-persona-divider persona-text-xs");ee(C,o.classNames?.eventRow);let k=n.find(B=>B.renderEventStreamRow);if(k?.renderEventStreamRow&&p){let B=k.renderEventStreamRow({event:t,index:e,config:p,defaultRenderer:()=>N(),isExpanded:x,onToggleExpand:()=>f(t.id)});if(B)return C.appendChild(B),C}return C.appendChild(N()),C;function N(){let B=u("div",""),D=u("div","persona-flex persona-items-center persona-gap-2 persona-px-3 persona-py-3 hover:persona-bg-persona-container persona-cursor-pointer persona-group");D.setAttribute("data-event-id",t.id);let te=u("span","persona-flex-shrink-0 persona-text-persona-muted persona-w-4 persona-text-center persona-flex persona-items-center persona-justify-center"),L=I(x?Te:Ae,"14px","currentColor",2);L&&te.appendChild(L);let H=u("span","persona-text-[11px] persona-text-persona-muted persona-whitespace-nowrap persona-flex-shrink-0 persona-font-mono persona-w-[70px]"),y=o.timestampFormat??"relative";H.textContent=y==="relative"?bt(t.timestamp,r):kt(t.timestamp);let F=null;o.showSequenceNumbers!==!1&&(F=u("span","persona-text-[11px] persona-text-persona-muted persona-font-mono persona-flex-shrink-0 persona-w-[28px] persona-text-right"),F.textContent=String(e+1));let M=wt(t.type,o.badgeColors),R=u("span","persona-inline-flex persona-items-center persona-px-2 persona-py-0.5 persona-rounded persona-text-[11px] persona-font-mono persona-font-medium persona-whitespace-nowrap persona-flex-shrink-0 persona-border");R.style.backgroundColor=M.bg,R.style.color=M.text,R.style.borderColor=yt(M.text),R.textContent=t.type;let re=o.descriptionFields??Ct,j=vt(t.payload,re),W=null;j&&(W=u("span","persona-text-[11px] persona-text-persona-secondary persona-truncate persona-min-w-0"),W.textContent=j);let v=u("div","persona-flex-1 persona-min-w-0"),T=u("button","persona-text-persona-muted hover:persona-text-persona-primary persona-cursor-pointer persona-flex-shrink-0 persona-border-none persona-bg-transparent persona-p-0"),oe=I(ge,"12px","currentColor",1.5);return oe&&T.appendChild(oe),T.addEventListener("click",async Q=>{Q.stopPropagation(),await Tt(At(t)),T.innerHTML="";let q=I(ce,"12px","currentColor",1.5);q&&T.appendChild(q),setTimeout(()=>{T.innerHTML="";let Y=I(ge,"12px","currentColor",1.5);Y&&T.appendChild(Y)},1500)}),D.appendChild(te),D.appendChild(H),F&&D.appendChild(F),D.appendChild(R),W&&D.appendChild(W),D.appendChild(v),D.appendChild(T),B.appendChild(D),x&&B.appendChild(Bt(t,n,p)),B}}function Be(t){let{buffer:e,getFullHistory:r,onClose:o,config:a,plugins:f=[],getThroughput:n}=t,p=t.renderIconByName??(()=>null),x=a?.features?.scrollToBottom,C=x?.enabled!==!1,k=x?.iconName??"arrow-down",N=x?.label??"",B=a?.features?.eventStream??{},D=f.find(L=>L.renderEventStreamView);if(D?.renderEventStreamView&&a){let L=D.renderEventStreamView({config:a,events:e.getAll(),defaultRenderer:()=>te().element,onClose:o});if(L)return{element:L,update:()=>{},destroy:()=>{}}}return te();function te(){let L=B.classNames,H=u("div","persona-event-stream-view persona-flex persona-flex-col persona-flex-1 persona-min-h-0");ee(H,L?.panel);let y=[],F="",M="",R=null,re=[],j={},W=0,v=Ze(),T=0,oe=0,Q=!1,q=null,Y=!1,Fe=0,Z=new Set,O=new Map,Re="",Ee="",J=null,S,g,w,E,ae=null,U=null,V=null;function we(){let s=u("div","persona-event-toolbar persona-relative persona-flex persona-flex-col persona-flex-shrink-0"),l=u("div","persona-flex persona-items-center persona-gap-2 persona-px-4 persona-py-3 persona-pb-0 persona-border-persona-divider persona-bg-persona-surface persona-overflow-hidden");if(ee(l,L?.headerBar),n){U=u("div","persona-relative persona-flex persona-items-center persona-gap-1.5 persona-whitespace-nowrap"),U.style.cursor="help",ae=u("span","persona-text-[11px] persona-font-mono persona-bg-persona-container persona-text-persona-muted persona-px-2 persona-py-0.5 persona-rounded persona-border persona-border-persona-border persona-tabular-nums"),ae.textContent="-- tok/s",V=u("div","persona-absolute persona-z-50 persona-whitespace-nowrap persona-rounded persona-border persona-border-persona-border persona-bg-persona-container persona-text-persona-primary persona-text-[11px] persona-font-mono persona-px-2 persona-py-1 persona-shadow"),V.style.display="none",V.style.pointerEvents="none";let K=U,ne=V,ut=()=>{if(!ne.textContent)return;let Ke=K.getBoundingClientRect(),_e=s.getBoundingClientRect();ne.style.left=`${Ke.left-_e.left}px`,ne.style.top=`${Ke.bottom-_e.top+4}px`,ne.style.display="block"},nt=()=>{ne.style.display="none"};U.addEventListener("mouseenter",ut),U.addEventListener("mouseleave",nt),U.appendChild(ae)}let d=u("div","persona-flex-1");S=u("select","persona-text-xs persona-bg-persona-surface persona-border persona-border-persona-border persona-rounded persona-px-2.5 persona-py-1 persona-text-persona-primary persona-cursor-pointer");let b=u("option","");b.value="",b.textContent="All events (0)",S.appendChild(b),g=u("button","persona-inline-flex persona-items-center persona-gap-1.5 persona-rounded persona-text-xs persona-text-persona-muted hover:persona-bg-persona-container hover:persona-text-persona-primary persona-cursor-pointer persona-border persona-border-persona-border persona-bg-persona-surface persona-flex-shrink-0 persona-px-2.5 persona-py-1"),g.type="button",g.title="Copy All";let z=I(he,"12px","currentColor",1.5);z&&g.appendChild(z);let X=u("span","persona-event-copy-all persona-text-xs");X.textContent="Copy All",g.appendChild(X),U&&l.appendChild(U),l.appendChild(d),l.appendChild(S),l.appendChild(g);let i=u("div","persona-relative persona-px-4 persona-py-2.5 persona-border-b persona-border-persona-divider persona-bg-persona-surface");ee(i,L?.searchBar);let m=I(Pe,"14px","var(--persona-muted, #9ca3af)",1.5),h=u("span","persona-absolute persona-left-6 persona-top-1/2 persona--translate-y-1/2 persona-pointer-events-none persona-flex persona-items-center");m&&h.appendChild(m),w=u("input","persona-text-sm persona-bg-persona-surface persona-border persona-border-persona-border persona-rounded-md persona-pl-8 persona-pr-3 persona-py-1 persona-w-full persona-text-persona-primary"),ee(w,L?.searchInput),w.type="text",w.placeholder="Search event payloads...",E=u("button","persona-absolute persona-right-5 persona-top-1/2 persona--translate-y-1/2 persona-text-persona-muted hover:persona-text-persona-primary persona-cursor-pointer persona-border-none persona-bg-transparent persona-p-0 persona-leading-none"),E.type="button",E.style.display="none";let P=I(Ce,"12px","currentColor",2);return P&&E.appendChild(P),i.appendChild(h),i.appendChild(w),i.appendChild(E),s.appendChild(l),s.appendChild(i),V&&s.appendChild(V),s}let ye,De=f.find(s=>s.renderEventStreamToolbar);De?.renderEventStreamToolbar&&a?ye=De.renderEventStreamToolbar({config:a,defaultRenderer:()=>we(),eventCount:e.getSize(),filteredCount:0,onFilterChange:l=>{F=l,ue(),$()},onSearchChange:l=>{M=l,ue(),$()}})??we():ye=we();let fe=u("div","persona-text-xs persona-text-persona-muted persona-text-center persona-py-0.5 persona-px-4 persona-bg-persona-container persona-border-b persona-border-persona-divider persona-italic persona-flex-shrink-0");fe.style.display="none";function ot(){if(!n||!ae||!U)return;let s=n(),l=Pt(s);ae.textContent=l;let d=Mt(s);V&&(V.textContent=d,d||(V.style.display="none")),U.setAttribute("aria-label",d?`Throughput: ${l}, ${d}`:`Throughput: ${l}`)}let me=u("div","persona-flex-1 persona-min-h-0 persona-relative"),c=u("div","persona-event-stream-list persona-overflow-y-auto persona-min-h-0");c.style.height="100%";let A=u("div","persona-scroll-to-bottom-indicator persona-absolute persona-bottom-3 persona-left-1/2 persona-transform persona--translate-x-1/2 persona-cursor-pointer persona-z-10 persona-text-xs");ee(A,L?.scrollIndicator),A.style.display="none",A.setAttribute("data-persona-scroll-to-bottom-has-label",N?"true":"false");let He=p(k,"14px","currentColor",2);He&&A.appendChild(He);let se=u("span","");se.textContent=N,A.appendChild(se);let le=u("div","persona-flex persona-items-center persona-justify-center persona-h-full persona-text-sm persona-text-persona-muted");le.style.display="none",me.appendChild(c),me.appendChild(le),me.appendChild(A),H.setAttribute("tabindex","0"),H.appendChild(ye),H.appendChild(fe),H.appendChild(me);function at(){let s=e.getAll(),l={};for(let i of s)l[i.type]=(l[i.type]||0)+1;let d=Object.keys(l).sort(),b=d.length!==re.length||!d.every((i,m)=>i===re[m]),G=!b&&d.some(i=>l[i]!==j[i]),z=s.length!==Object.values(j).reduce((i,m)=>i+m,0);if(!b&&!G&&!z||(re=d,j=l,!S))return;let X=S.value;if(S.options[0].textContent=`All events (${s.length})`,b){for(;S.options.length>1;)S.remove(1);for(let i of d){let m=u("option","");m.value=i,m.textContent=`${i} (${l[i]||0})`,S.appendChild(m)}X&&d.includes(X)?S.value=X:X&&(S.value="",F="")}else for(let i=1;i<S.options.length;i++){let m=S.options[i];m.textContent=`${m.value} (${l[m.value]||0})`}}function ft(){let s=e.getAll();if(F&&(s=s.filter(l=>l.type===F)),M){let l=M.toLowerCase();s=s.filter(d=>d.type.toLowerCase().includes(l)||d.payload.toLowerCase().includes(l))}return s}function be(){return F!==""||M!==""}function ue(){W=0,T=0,v.resume(),A.style.display="none"}function xe(s){Z.has(s)?Z.delete(s):Z.add(s),J=s;let l=c.scrollTop,d=v.isFollowing();Y=!0,v.pause(),$(),c.scrollTop=l,d&&v.resume(),Y=!1}function qe(){return $e(c,50)}function $(){oe=Date.now(),Q=!1,ot(),at();let s=e.getEvictedCount();s>0?(fe.textContent=`${s.toLocaleString()} older events truncated`,fe.style.display=""):fe.style.display="none",y=ft();let l=y.length,d=e.getSize()>0;l===0&&d&&be()?(le.textContent=M?`No events matching '${M}'`:"No events matching filter",le.style.display="",c.style.display="none"):(le.style.display="none",c.style.display=""),g&&(g.title=be()?`Copy Filtered (${l})`:"Copy All"),C&&!v.isFollowing()&&l>W&&(T+=l-W,se.textContent=N?`${N}${T>0?` (${T})`:""}`:"",A.style.display=""),W=l;let b=e.getAll(),G=b.length>0?b[0].timestamp:0,z=new Set(y.map(m=>m.id));for(let m of Z)z.has(m)||Z.delete(m);let X=F!==Re||M!==Ee,i=O.size===0&&y.length>0;if(X||i||y.length===0){c.innerHTML="",O.clear();let m=document.createDocumentFragment();for(let h=0;h<y.length;h++){let P=Me(y[h],h,G,B,Z,xe,f,a);O.set(y[h].id,P),m.appendChild(P)}c.appendChild(m),Re=F,Ee=M,J=null}else{if(J!==null){let h=O.get(J);if(h&&h.parentNode===c){let P=y.findIndex(K=>K.id===J);if(P>=0){let K=Me(y[P],P,G,B,Z,xe,f,a);c.insertBefore(K,h),h.remove(),O.set(J,K)}}J=null}let m=new Set(y.map(h=>h.id));for(let[h,P]of O)m.has(h)||(P.remove(),O.delete(h));for(let h=0;h<y.length;h++){let P=y[h];if(!O.has(P.id)){let K=Me(P,h,G,B,Z,xe,f,a);O.set(P.id,K),c.appendChild(K)}}}v.isFollowing()&&(c.scrollTop=c.scrollHeight)}function st(){if(Date.now()-oe>=St){q!==null&&(cancelAnimationFrame(q),q=null),$();return}Q||(Q=!0,q=requestAnimationFrame(()=>{q=null,$()}))}let Oe=(s,l)=>{if(!g)return;g.innerHTML="";let d=I(s,"12px","currentColor",1.5);d&&g.appendChild(d);let b=u("span","persona-text-xs");b.textContent="Copy All",g.appendChild(b),setTimeout(()=>{g.innerHTML="";let G=I(he,"12px","currentColor",1.5);G&&g.appendChild(G);let z=u("span","persona-text-xs");z.textContent="Copy All",g.appendChild(z),g.disabled=!1},l)},Ue=async()=>{if(g){g.disabled=!0;try{let s;be()?s=y:r?(s=await r(),s.length===0&&(s=e.getAll())):s=e.getAll();let l=s.map(d=>{try{return JSON.parse(d.payload)}catch{return d.payload}});await navigator.clipboard.writeText(JSON.stringify(l,null,2)),Oe(ce,1500)}catch{Oe(Ce,1500)}}},Ie=()=>{S&&(F=S.value,ue(),$())},Ne=()=>{!w||!E||(E.style.display=w.value?"":"none",R&&clearTimeout(R),R=setTimeout(()=>{M=w.value,ue(),$()},150))},ke=()=>{!w||!E||(w.value="",M="",E.style.display="none",R&&clearTimeout(R),ue(),$())},We=()=>{if(Y)return;let s=c.scrollTop,{action:l,nextLastScrollTop:d}=Je({following:v.isFollowing(),currentScrollTop:s,lastScrollTop:Fe,nearBottom:qe(),userScrollThreshold:1,resumeRequiresDownwardScroll:!0});Fe=d,l==="resume"?(v.resume(),T=0,A.style.display="none"):l==="pause"&&(v.pause(),C&&(se.textContent=N,A.style.display=""))},Ve=s=>{let l=je({following:v.isFollowing(),deltaY:s.deltaY,nearBottom:qe(),resumeWhenNearBottom:!0});l==="pause"?(v.pause(),C&&(se.textContent=N,A.style.display="")):l==="resume"&&(v.resume(),T=0,A.style.display="none")},Ge=()=>{C&&(c.scrollTop=c.scrollHeight,v.resume(),T=0,A.style.display="none")},ze=s=>{let l=s.target;if(!l||l.closest("button"))return;let d=l.closest("[data-event-id]");if(!d)return;let b=d.getAttribute("data-event-id");b&&xe(b)},Xe=s=>{if((s.metaKey||s.ctrlKey)&&s.key==="f"){s.preventDefault(),w?.focus(),w?.select();return}s.key==="Escape"&&(w&&document.activeElement===w?(ke(),w.blur(),H.focus()):o&&o())};g&&g.addEventListener("click",Ue),S&&S.addEventListener("change",Ie),w&&w.addEventListener("input",Ne),E&&E.addEventListener("click",ke),c.addEventListener("scroll",We),c.addEventListener("wheel",Ve,{passive:!0}),c.addEventListener("click",ze),A.addEventListener("click",Ge),H.addEventListener("keydown",Xe);function lt(){R&&clearTimeout(R),q!==null&&(cancelAnimationFrame(q),q=null),Q=!1,O.clear(),g&&g.removeEventListener("click",Ue),S&&S.removeEventListener("change",Ie),w&&w.removeEventListener("input",Ne),E&&E.removeEventListener("click",ke),c.removeEventListener("scroll",We),c.removeEventListener("wheel",Ve),c.removeEventListener("click",ze),A.removeEventListener("click",Ge),H.removeEventListener("keydown",Xe)}return{element:H,update:st,destroy:lt}}}var de=class{#e;#t=0;#o=0;#a=0;#s=new Set;#r;#f;constructor(e=2e3,r=null){this.#r=e,this.#e=new Array(e),this.#f=r}push(e){this.#e[this.#t]=e,this.#t=(this.#t+1)%this.#r,this.#o<this.#r&&this.#o++,this.#a++,this.#s.add(e.type),this.#f?.put(e)}getAll(){return this.#o===0?[]:this.#o<this.#r?this.#e.slice(0,this.#o):[...this.#e.slice(this.#t,this.#r),...this.#e.slice(0,this.#t)]}async restore(){if(!this.#f)return 0;let e=await this.#f.getAll();if(e.length===0)return 0;let r=e.length>this.#r?e.slice(e.length-this.#r):e;for(let o of r)this.#e[this.#t]=o,this.#t=(this.#t+1)%this.#r,this.#o<this.#r&&this.#o++,this.#s.add(o.type);return this.#a=e.length,r.length}getAllFromStore(){return this.#f?this.#f.getAll():Promise.resolve(this.getAll())}getRecent(e){let r=this.getAll();return e>=r.length?r:r.slice(r.length-e)}getSize(){return this.#o}getTotalCaptured(){return this.#a}getEvictedCount(){return this.#a-this.#o}clear(){this.#e=new Array(this.#r),this.#t=0,this.#o=0,this.#a=0,this.#s.clear(),this.#f?.clear()}destroy(){this.#e=[],this.#t=0,this.#o=0,this.#a=0,this.#s.clear(),this.#f?.destroy()}getEventTypes(){return Array.from(this.#s)}};var pe=class{#e=null;#t=[];#o=!1;#a=!1;#s;#r;constructor(e="persona-event-stream",r="events"){this.#s=e,this.#r=r}open(){return new Promise((e,r)=>{try{let o=indexedDB.open(this.#s,1);o.onupgradeneeded=()=>{let a=o.result;a.objectStoreNames.contains(this.#r)||a.createObjectStore(this.#r,{keyPath:"id"}).createIndex("timestamp","timestamp",{unique:!1})},o.onsuccess=()=>{this.#e=o.result,e()},o.onerror=()=>{r(o.error)}}catch(o){r(o)}})}put(e){!this.#e||this.#a||(this.#t.push(e),this.#o||(this.#o=!0,queueMicrotask(()=>this.#f())))}putBatch(e){if(!(!this.#e||this.#a||e.length===0))try{let o=this.#e.transaction(this.#r,"readwrite").objectStore(this.#r);for(let a of e)o.put(a)}catch{}}getAll(){return new Promise((e,r)=>{if(!this.#e){e([]);return}try{let n=this.#e.transaction(this.#r,"readonly").objectStore(this.#r).index("timestamp").getAll();n.onsuccess=()=>{e(n.result)},n.onerror=()=>{r(n.error)}}catch(o){r(o)}})}getCount(){return new Promise((e,r)=>{if(!this.#e){e(0);return}try{let f=this.#e.transaction(this.#r,"readonly").objectStore(this.#r).count();f.onsuccess=()=>{e(f.result)},f.onerror=()=>{r(f.error)}}catch(o){r(o)}})}clear(){return new Promise((e,r)=>{if(!this.#e){e();return}this.#t=[];try{let f=this.#e.transaction(this.#r,"readwrite").objectStore(this.#r).clear();f.onsuccess=()=>{e()},f.onerror=()=>{r(f.error)}}catch(o){r(o)}})}close(){this.#e&&(this.#e.close(),this.#e=null)}destroy(){return this.#a=!0,this.#t=[],this.close(),new Promise((e,r)=>{try{let o=indexedDB.deleteDatabase(this.#s);o.onsuccess=()=>{e()},o.onerror=()=>{r(o.error)}}catch(o){r(o)}})}#f(){if(this.#o=!1,!this.#e||this.#a||this.#t.length===0)return;let e=this.#t;this.#t=[];try{let o=this.#e.transaction(this.#r,"readwrite").objectStore(this.#r);for(let a of e)o.put(a)}catch{}}};var Lt=new Set(["step_start","turn_start"]),Ft=new Set(["step_complete","turn_complete"]),tt=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),rt=t=>typeof t=="number"&&Number.isFinite(t)?t:void 0,Ye=(t,e)=>{let r=t[e];return tt(r)?r:void 0};function Le(t){return t>0?Math.max(1,Math.ceil(t/4)):0}function Se(t,e){if(!(t<=0||e===void 0||e<250))return t/(e/1e3)}function Rt(t,e){return typeof e.type=="string"?e.type:t}function et(t){let e=Ye(t,"tokens")??Ye(t,"totalTokens");return e?rt(e.output):void 0}function Et(t){return rt(t.durationMs)}function Dt(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var ie=class{#e={status:"idle"};#t=null;constructor(e=Dt){this.now=e}getMetric(){let e=this.#t;if(e&&this.#e.status==="running"&&e.firstDeltaAt!==void 0&&this.#e.outputTokens!==void 0){let r=this.now()-e.firstDeltaAt;return{...this.#e,durationMs:r,tokensPerSecond:Se(this.#e.outputTokens,r)}}return this.#e}reset(){this.#t=null,this.#e={status:"idle"}}#o(e){this.#t={startedAt:e,visibleCharCount:0,exactOutputTokens:0},this.#e={status:"running"}}processEvent(e,r){if(!tt(r)){e==="execution_error"&&this.#t&&(this.#t=null,this.#e={status:"error"});return}let o=Rt(e,r),a=this.now();if(o==="execution_start"){this.#o(a);return}if(Lt.has(o)){this.#t||this.#o(a);return}if(o==="text_delta"){let f=typeof r.delta=="string"?r.delta:"";if(!f)return;this.#t||this.#o(a);let n=this.#t;n.firstDeltaAt??=a,n.visibleCharCount+=f.length;let p=n.exactOutputTokens+Le(n.visibleCharCount),x=a-n.firstDeltaAt;this.#e={status:"running",tokensPerSecond:Se(p,x),outputTokens:p,durationMs:x,source:n.exactOutputTokens>0?"usage":"estimate"};return}if(Ft.has(o)){if(!this.#t)return;let f=this.#t,n=et(r);n!==void 0&&(f.exactOutputTokens+=n,f.visibleCharCount=0);let p=f.exactOutputTokens>0,x=f.exactOutputTokens+Le(f.visibleCharCount),C=this.#a(f,r,a);this.#e={status:"running",tokensPerSecond:Se(x,C),outputTokens:x,durationMs:C,source:p?"usage":"estimate"};return}if(o==="execution_complete"){if(!this.#t)return;let f=this.#t,n=et(r),p=n??f.exactOutputTokens+Le(f.visibleCharCount),x=n!==void 0||f.exactOutputTokens>0?"usage":"estimate",C=this.#a(f,r,a);this.#e={status:"complete",tokensPerSecond:Se(p,C),outputTokens:p,durationMs:C,source:x},this.#t=null;return}if(o==="execution_error"||o==="error"&&r.recoverable===!1){if(!this.#t)return;this.#t=null,this.#e={status:"error"}}}#a(e,r,o){let a=e.firstDeltaAt!==void 0?o-e.firstDeltaAt:void 0;return a!==void 0&&a>=250?a:Et(r)??o-e.startedAt}};0&&(module.exports={EventStreamBuffer,EventStreamStore,ThroughputTracker,createEventStreamView});
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
lucide/dist/esm/icons/check.mjs:
|
|
@@ -6577,6 +6577,22 @@ type AgentWidgetStatusIndicatorConfig = {
|
|
|
6577
6577
|
/** Status text while a reconnect attempt is in flight. */
|
|
6578
6578
|
resumingText?: string;
|
|
6579
6579
|
};
|
|
6580
|
+
/** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
|
|
6581
|
+
type AgentWidgetVoicePrewarmTrigger = 'hover';
|
|
6582
|
+
/**
|
|
6583
|
+
* Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
|
|
6584
|
+
* button, and again when the button is rebuilt or `update()` swaps in a
|
|
6585
|
+
* different function. Call `warm()` whenever the visitor shows intent to talk
|
|
6586
|
+
* (it is safe to call repeatedly). Return a cleanup to run on replacement.
|
|
6587
|
+
*/
|
|
6588
|
+
type AgentWidgetVoicePrewarmHook = (context: {
|
|
6589
|
+
/** Fire-and-forget voice warm-up; latched and error-swallowing. */
|
|
6590
|
+
warm: () => void;
|
|
6591
|
+
/** The composer's current mic button. */
|
|
6592
|
+
micButton: HTMLButtonElement;
|
|
6593
|
+
/** The widget's mount element. */
|
|
6594
|
+
mount: HTMLElement;
|
|
6595
|
+
}) => void | (() => void);
|
|
6580
6596
|
type AgentWidgetVoiceRecognitionConfig = {
|
|
6581
6597
|
/**
|
|
6582
6598
|
* Enable the mic button and voice input. The mic still only renders when the
|
|
@@ -6642,6 +6658,29 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6642
6658
|
* Fires once per turn after the reply completes.
|
|
6643
6659
|
*/
|
|
6644
6660
|
onMetrics?: (metrics: VoiceMetrics) => void;
|
|
6661
|
+
/**
|
|
6662
|
+
* Warm the voice path when the visitor shows intent to talk, before the mic
|
|
6663
|
+
* click, so the call starts faster.
|
|
6664
|
+
*
|
|
6665
|
+
* - `'hover'`: when the pointer enters the mic button, it receives focus, or
|
|
6666
|
+
* (on touch) the first pointer-down on it.
|
|
6667
|
+
* - `false`: never.
|
|
6668
|
+
* - A function: custom trigger. Called with `{ warm, micButton, mount }`
|
|
6669
|
+
* while the mic button exists (and again when the button is rebuilt or
|
|
6670
|
+
* `update()` swaps in a different function); call `warm()` whenever you
|
|
6671
|
+
* decide, e.g. when the panel opens. May return a cleanup that runs on
|
|
6672
|
+
* destroy, rebuild, or replacement. Replaces the built-in trigger.
|
|
6673
|
+
*
|
|
6674
|
+
* What `warm()` does depends on the provider: `runtype` fires its prewarm
|
|
6675
|
+
* (see `provider.runtype.prewarmMode`), a `custom` provider's optional
|
|
6676
|
+
* {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
|
|
6677
|
+
* starts the client-token session init (as `sessionInit` does), since speech
|
|
6678
|
+
* recognition itself cannot start before the click. Warming is
|
|
6679
|
+
* fire-and-forget, latched, and never surfaces an error or UI state.
|
|
6680
|
+
*
|
|
6681
|
+
* @default 'hover' in client token mode, otherwise `false`
|
|
6682
|
+
*/
|
|
6683
|
+
prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
|
|
6645
6684
|
provider?: {
|
|
6646
6685
|
type: 'browser' | 'runtype' | 'custom';
|
|
6647
6686
|
browser?: {
|
|
@@ -6663,6 +6702,62 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6663
6702
|
* `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
|
|
6664
6703
|
*/
|
|
6665
6704
|
createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
|
|
6705
|
+
/**
|
|
6706
|
+
* How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
|
|
6707
|
+
*
|
|
6708
|
+
* - `'request'` (default): a fire-and-forget
|
|
6709
|
+
* `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
|
|
6710
|
+
* - `'attach'`: open the voice WebSocket ahead of the click without
|
|
6711
|
+
* starting a call; the click then starts the call on that socket. It can
|
|
6712
|
+
* create server work before the visitor clicks, so it is opt-in.
|
|
6713
|
+
* @default 'request'
|
|
6714
|
+
*/
|
|
6715
|
+
prewarmMode?: 'request' | 'attach';
|
|
6716
|
+
/**
|
|
6717
|
+
* `'attach'` mode: how long (ms) an attached socket waits for the click
|
|
6718
|
+
* before it closes. The server clamps it to 30000..600000.
|
|
6719
|
+
* @default 30000
|
|
6720
|
+
*/
|
|
6721
|
+
attachIdleMs?: number;
|
|
6722
|
+
/**
|
|
6723
|
+
* Full-duplex (speech-to-speech, e.g. GPT-Live) calls: run the turns the
|
|
6724
|
+
* voice model hands off to the agent through this widget's normal chat
|
|
6725
|
+
* pipeline. The spoken request becomes the user message, and the answer
|
|
6726
|
+
* renders as a regular assistant message (streaming, tool and approval
|
|
6727
|
+
* UI, WebMCP page tools, persistence) that the voice model then reads
|
|
6728
|
+
* aloud. Only takes effect when the server supports it (it confirms in
|
|
6729
|
+
* `session_config`); otherwise the agent turn runs on the server and its
|
|
6730
|
+
* spoken reply is transcribed, as before. Set `false` to always keep the
|
|
6731
|
+
* agent turn on the server.
|
|
6732
|
+
* @default true
|
|
6733
|
+
*/
|
|
6734
|
+
clientDelegation?: boolean;
|
|
6735
|
+
/**
|
|
6736
|
+
* Full-duplex calls: extra context for the voice model (for example the
|
|
6737
|
+
* page the visitor is on), sent after the chat history as of call start.
|
|
6738
|
+
* The frame goes out once, when the visitor finishes their first
|
|
6739
|
+
* utterance (or at the first agent hand-off). A function is
|
|
6740
|
+
* called at call start and may be async. This text is capped at 4000 characters and the whole frame
|
|
6741
|
+
* (history included) at 8000. Sent only to servers that accept call
|
|
6742
|
+
* context (they announce it in `session_config`).
|
|
6743
|
+
*/
|
|
6744
|
+
callContext?: string | (() => string | Promise<string>);
|
|
6745
|
+
/**
|
|
6746
|
+
* Full-duplex calls with client delegation: how long a tool approval
|
|
6747
|
+
* that a spoken request raised may wait before it is declined as
|
|
6748
|
+
* expired (and the voice model says so). Server-side approval gates
|
|
6749
|
+
* keep their own timeout too. Hanging up never declines it: the
|
|
6750
|
+
* approval card in the chat stays usable. Capped at 540000 (9 minutes),
|
|
6751
|
+
* under the server's 10-minute delegation deadline.
|
|
6752
|
+
* @default 300000
|
|
6753
|
+
*/
|
|
6754
|
+
approvalTimeoutMs?: number;
|
|
6755
|
+
/**
|
|
6756
|
+
* Speech-to-speech calls: the one-line notice shown in the composer
|
|
6757
|
+
* status area when the call starts. `false` hides it.
|
|
6758
|
+
* @default "You're talking to an AI assistant. Voice is processed by OpenAI."
|
|
6759
|
+
*/
|
|
6760
|
+
disclosureText?: string | false;
|
|
6666
6761
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6667
6762
|
pauseDuration?: number;
|
|
6668
6763
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -6892,6 +6987,13 @@ interface VoicePlaybackEngine {
|
|
|
6892
6987
|
onFinished(callback: () => void): void;
|
|
6893
6988
|
/** Release all audio resources. */
|
|
6894
6989
|
destroy(): Promise<void> | void;
|
|
6990
|
+
/**
|
|
6991
|
+
* Optional. Speech-to-speech calls stream reply audio with no end-of-stream
|
|
6992
|
+
* marker, so an engine that holds audio below a prebuffer waterline must, while
|
|
6993
|
+
* continuous, release that held tail on its own (e.g. after a short input gap)
|
|
6994
|
+
* instead of waiting for {@link markStreamEnd}. Engines without a prebuffer can omit it.
|
|
6995
|
+
*/
|
|
6996
|
+
setContinuousMode?(enabled: boolean): void;
|
|
6895
6997
|
}
|
|
6896
6998
|
/**
|
|
6897
6999
|
* A {@link VoicePlaybackEngine} that also supports pause/resume. Returned by
|
|
@@ -6935,14 +7037,23 @@ interface VoiceProvider {
|
|
|
6935
7037
|
* Register a callback for incremental transcript updates during a voice turn.
|
|
6936
7038
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
6937
7039
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
6938
|
-
* On the realtime `runtype` path, interim updates fire for the `user`
|
|
6939
|
-
* the `assistant` arrives as a single final
|
|
6940
|
-
*
|
|
6941
|
-
*
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
7040
|
+
* On the classic realtime `runtype` path, interim updates fire for the `user`
|
|
7041
|
+
* only and the `assistant` arrives as a single final; without a turnId the
|
|
7042
|
+
* session assumes strictly alternating turns, and providers must discard
|
|
7043
|
+
* cancelled output before emitting the next user final.
|
|
7044
|
+
*
|
|
7045
|
+
* When `metadata.turnId` is present (full-duplex / speech-to-speech, e.g.
|
|
7046
|
+
* GPT-Live), the session reconciles by `(turnId, role)`: each pair owns one
|
|
7047
|
+
* bubble that later updates replace in place, turns may overlap or arrive in
|
|
7048
|
+
* any order, and no empty assistant placeholder is injected. User and
|
|
7049
|
+
* assistant may share a turnId (a late user bubble then renders above its
|
|
7050
|
+
* reply) or use distinct ones. `metadata.startMs` (call-relative ms when the
|
|
7051
|
+
* utterance began) orders a new bubble among the call's other keyed bubbles;
|
|
7052
|
+
* without it bubbles order by first arrival. After a stop, keyed providers
|
|
7053
|
+
* must drop the cancelled reply's output until the server acknowledges the
|
|
7054
|
+
* cancel: the session renders every reply it receives.
|
|
7055
|
+
*/
|
|
7056
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: VoiceTranscriptMetadata) => void): void;
|
|
6946
7057
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
6947
7058
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
6948
7059
|
/**
|
|
@@ -6963,6 +7074,116 @@ interface VoiceProvider {
|
|
|
6963
7074
|
deactivateBargeIn?(): Promise<void>;
|
|
6964
7075
|
/** Stop playback / cancel in-flight request without starting recording */
|
|
6965
7076
|
stopPlayback?(): void;
|
|
7077
|
+
/**
|
|
7078
|
+
* Warm the provider ahead of `startListening()` (the widget calls it on mic
|
|
7079
|
+
* intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
|
|
7080
|
+
* throw, emit errors or status, or acquire the microphone. May be called
|
|
7081
|
+
* repeatedly; throttle as needed.
|
|
7082
|
+
*/
|
|
7083
|
+
prewarm?(): void;
|
|
7084
|
+
/**
|
|
7085
|
+
* Called by the session once after construction with the chat-side surface
|
|
7086
|
+
* a full-duplex provider uses to hand agent turns to the chat pipeline
|
|
7087
|
+
* ({@link VoiceSessionBridge}). Providers without client delegation omit it.
|
|
7088
|
+
*/
|
|
7089
|
+
setSessionBridge?(bridge: VoiceSessionBridge): void;
|
|
7090
|
+
/** The AI-disclosure notice for the live call, if one should show (speech-to-speech). */
|
|
7091
|
+
getDisclosure?(): string | null;
|
|
7092
|
+
}
|
|
7093
|
+
/** Metadata on a {@link VoiceProvider.onTranscript} update. */
|
|
7094
|
+
type VoiceTranscriptMetadata = {
|
|
7095
|
+
/** Groups updates that belong to one utterance bubble (full duplex). */
|
|
7096
|
+
turnId?: string;
|
|
7097
|
+
/** Call-relative ms when the utterance began; orders late bubbles. */
|
|
7098
|
+
startMs?: number;
|
|
7099
|
+
/** Call-relative ms of the latest audio this update covers. */
|
|
7100
|
+
endMs?: number;
|
|
7101
|
+
/**
|
|
7102
|
+
* The bubble only captions speech (see `AgentWidgetMessage.voiceCaption`).
|
|
7103
|
+
* The chat pipeline owns the conversation, as with client delegation.
|
|
7104
|
+
*/
|
|
7105
|
+
caption?: boolean;
|
|
7106
|
+
};
|
|
7107
|
+
/** An agent turn a full-duplex voice model handed to the widget. */
|
|
7108
|
+
type VoiceDelegationRequest = {
|
|
7109
|
+
/** The voice model's delegation id (`delegation_started.delegationId`). */
|
|
7110
|
+
delegationId: string;
|
|
7111
|
+
/** What the visitor asked, as the voice model heard it. */
|
|
7112
|
+
userText: string;
|
|
7113
|
+
/**
|
|
7114
|
+
* The user transcript utterances `userText` joins, oldest first (the last
|
|
7115
|
+
* is the one it came from). May be empty.
|
|
7116
|
+
*/
|
|
7117
|
+
userUtteranceIds: string[];
|
|
7118
|
+
/** The voice model's view of the conversation it delegated from. */
|
|
7119
|
+
messages: Array<{
|
|
7120
|
+
role: string;
|
|
7121
|
+
content: unknown;
|
|
7122
|
+
}>;
|
|
7123
|
+
};
|
|
7124
|
+
/**
|
|
7125
|
+
* How a delegated turn ended, or that it waits on an approval (contract
|
|
7126
|
+
* Amendment 5). `pending_approval` is the only non-terminal status. Open:
|
|
7127
|
+
* a receiver treats an unknown terminal status as `failed`.
|
|
7128
|
+
* - `completed`: the work ran.
|
|
7129
|
+
* - `denied`: the visitor said no (Deny tap, or a spoken decline).
|
|
7130
|
+
* - `timeout`: the approval lapsed (`approvalTimeoutMs`, or the server's own timeout).
|
|
7131
|
+
* - `cancelled`: replaced by a newer request, or abandoned by the system.
|
|
7132
|
+
* - `failed`: an error.
|
|
7133
|
+
*/
|
|
7134
|
+
type VoiceDelegationStatus = 'completed' | 'pending_approval' | 'denied' | 'timeout' | 'cancelled' | 'failed' | (string & {});
|
|
7135
|
+
/** The terminal result of a turn that parked on approvals. */
|
|
7136
|
+
type VoiceDelegationFollowUp = {
|
|
7137
|
+
status: VoiceDelegationStatus;
|
|
7138
|
+
/** What to read aloud (Markdown allowed). May be empty: nothing more to say. */
|
|
7139
|
+
text: string;
|
|
7140
|
+
};
|
|
7141
|
+
/** The delegated turn's answer, sent back for the voice model to read aloud. */
|
|
7142
|
+
type VoiceDelegationResult = {
|
|
7143
|
+
/** `pending_approval` when `followUp` is set; otherwise terminal. */
|
|
7144
|
+
status: VoiceDelegationStatus;
|
|
7145
|
+
/** The assistant text (Markdown allowed). */
|
|
7146
|
+
text: string;
|
|
7147
|
+
/**
|
|
7148
|
+
* Set when the turn parked on approvals (`text` then asks for the decision).
|
|
7149
|
+
* Resolves with the terminal result once the visitor decides (or the
|
|
7150
|
+
* approval is replaced, declined by voice, or unanswered for
|
|
7151
|
+
* `approvalTimeoutMs`) and the resumed turn finishes; `null` only when
|
|
7152
|
+
* `signal` aborts first (hang-up, or the server cancelled the delegation).
|
|
7153
|
+
*/
|
|
7154
|
+
followUp?: (options: {
|
|
7155
|
+
signal: AbortSignal;
|
|
7156
|
+
approvalTimeoutMs?: number;
|
|
7157
|
+
/** `false`: run only the approval bookkeeping (expiry, supersede); nothing will be read back. @default true */
|
|
7158
|
+
readBack?: boolean;
|
|
7159
|
+
/** The resumed turn stopped on another approval: ask for it too (`text` is its approval script). */
|
|
7160
|
+
onUpdate?: (text: string) => void;
|
|
7161
|
+
}) => Promise<VoiceDelegationFollowUp | null>;
|
|
7162
|
+
};
|
|
7163
|
+
/**
|
|
7164
|
+
* Chat-side surface the session hands a full-duplex provider: the visible
|
|
7165
|
+
* history (for the call-start context) and a way to run a delegated turn
|
|
7166
|
+
* through the normal chat pipeline.
|
|
7167
|
+
*/
|
|
7168
|
+
interface VoiceSessionBridge {
|
|
7169
|
+
/** Visible user/assistant messages, oldest first. */
|
|
7170
|
+
getHistory(): Array<{
|
|
7171
|
+
role: 'user' | 'assistant';
|
|
7172
|
+
content: string;
|
|
7173
|
+
}>;
|
|
7174
|
+
/**
|
|
7175
|
+
* Submit the turn as the visitor's message (reusing its transcript bubble)
|
|
7176
|
+
* and resolve with the assistant's final answer once the turn settles.
|
|
7177
|
+
* Waits for any chat turn already in flight first. Never rejects.
|
|
7178
|
+
*/
|
|
7179
|
+
runDelegatedTurn(request: VoiceDelegationRequest): Promise<VoiceDelegationResult>;
|
|
7180
|
+
/**
|
|
7181
|
+
* The server dropped this delegation's result (cancelled it, or refused a
|
|
7182
|
+
* late result): its chat answer is no longer spoken, so browser TTS may read it.
|
|
7183
|
+
* `expired`: the server's deadline passed, so its pending approvals are
|
|
7184
|
+
* declined too, as the approval TTL would.
|
|
7185
|
+
*/
|
|
7186
|
+
dropDelegation?(delegationId: string, expired?: boolean): void;
|
|
6966
7187
|
}
|
|
6967
7188
|
/**
|
|
6968
7189
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
|
@@ -9559,6 +9780,11 @@ type AgentWidgetToolCall = {
|
|
|
9559
9780
|
startedAt?: number;
|
|
9560
9781
|
completedAt?: number;
|
|
9561
9782
|
durationMs?: number;
|
|
9783
|
+
/**
|
|
9784
|
+
* The call paused for an approval that was granted, and the agent re-ran it
|
|
9785
|
+
* as a new tool call: that later call carries the result, this one has none.
|
|
9786
|
+
*/
|
|
9787
|
+
superseded?: boolean;
|
|
9562
9788
|
};
|
|
9563
9789
|
/**
|
|
9564
9790
|
* Represents a tool approval request in the chat conversation.
|
|
@@ -9580,6 +9806,8 @@ type AgentWidgetApproval = {
|
|
|
9580
9806
|
*/
|
|
9581
9807
|
reason?: string;
|
|
9582
9808
|
parameters?: unknown;
|
|
9809
|
+
/** The paused tool call this approval gates (`approval_start.toolCallId`). */
|
|
9810
|
+
toolCallId?: string;
|
|
9583
9811
|
resolvedAt?: number;
|
|
9584
9812
|
};
|
|
9585
9813
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
@@ -9679,6 +9907,13 @@ type AgentWidgetMessage = {
|
|
|
9679
9907
|
* }
|
|
9680
9908
|
*/
|
|
9681
9909
|
voiceProcessing?: boolean;
|
|
9910
|
+
/**
|
|
9911
|
+
* Display-only caption of full-duplex voice speech, such as the voice
|
|
9912
|
+
* model's own words, or something the visitor said that wasn't submitted
|
|
9913
|
+
* as a chat turn. It renders in the transcript but is never sent to the
|
|
9914
|
+
* model as conversation.
|
|
9915
|
+
*/
|
|
9916
|
+
voiceCaption?: boolean;
|
|
9682
9917
|
/**
|
|
9683
9918
|
* Raw structured payload for this message (e.g., JSON action response).
|
|
9684
9919
|
* Populated automatically when structured parsers run.
|
|
@@ -9757,12 +9992,7 @@ type PersonaArtifactRecord = {
|
|
|
9757
9992
|
};
|
|
9758
9993
|
|
|
9759
9994
|
declare class EventStreamStore {
|
|
9760
|
-
private
|
|
9761
|
-
private pendingWrites;
|
|
9762
|
-
private flushScheduled;
|
|
9763
|
-
private isDestroyed;
|
|
9764
|
-
private readonly dbName;
|
|
9765
|
-
private readonly storeName;
|
|
9995
|
+
#private;
|
|
9766
9996
|
constructor(dbName?: string, storeName?: string);
|
|
9767
9997
|
open(): Promise<void>;
|
|
9768
9998
|
put(event: SSEEventRecord): void;
|
|
@@ -9772,17 +10002,10 @@ declare class EventStreamStore {
|
|
|
9772
10002
|
clear(): Promise<void>;
|
|
9773
10003
|
close(): void;
|
|
9774
10004
|
destroy(): Promise<void>;
|
|
9775
|
-
private flushWrites;
|
|
9776
10005
|
}
|
|
9777
10006
|
|
|
9778
10007
|
declare class EventStreamBuffer {
|
|
9779
|
-
private
|
|
9780
|
-
private head;
|
|
9781
|
-
private count;
|
|
9782
|
-
private totalCaptured;
|
|
9783
|
-
private eventTypesSet;
|
|
9784
|
-
private readonly maxSize;
|
|
9785
|
-
private readonly store;
|
|
10008
|
+
#private;
|
|
9786
10009
|
constructor(maxSize?: number, store?: EventStreamStore | null);
|
|
9787
10010
|
push(event: SSEEventRecord): void;
|
|
9788
10011
|
getAll(): SSEEventRecord[];
|
|
@@ -9815,21 +10038,13 @@ interface ThroughputMetric {
|
|
|
9815
10038
|
* event via {@link processEvent}; read the current state via {@link getMetric}.
|
|
9816
10039
|
*/
|
|
9817
10040
|
declare class ThroughputTracker {
|
|
9818
|
-
private
|
|
9819
|
-
private run;
|
|
10041
|
+
#private;
|
|
9820
10042
|
private readonly now;
|
|
9821
10043
|
constructor(now?: () => number);
|
|
9822
10044
|
getMetric(): ThroughputMetric;
|
|
9823
10045
|
/** Reset back to idle (e.g. when the chat is cleared). */
|
|
9824
10046
|
reset(): void;
|
|
9825
|
-
private startRun;
|
|
9826
10047
|
processEvent(eventType: string, payload: unknown): void;
|
|
9827
|
-
/**
|
|
9828
|
-
* Prefer the streamed visible-output window when it clears the minimum
|
|
9829
|
-
* threshold; otherwise fall back to provider execution time, then to the
|
|
9830
|
-
* whole-request duration.
|
|
9831
|
-
*/
|
|
9832
|
-
private resolveDuration;
|
|
9833
10048
|
}
|
|
9834
10049
|
|
|
9835
10050
|
type EventStreamViewOptions = {
|