@alexkroman1/aai-ui 5.0.1 → 5.1.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/client-config.d.ts +3 -2
- package/dist/default-client/assets/{audio-BdEKgLwT.js → audio-BnLV_QB3.js} +1 -1
- package/dist/default-client/assets/{capture-processor-_QJe3nzY.js → capture-processor-ChXugkMd.js} +1 -1
- package/dist/default-client/assets/{index-RQnhfgSS.js → index-22Wylv4z.js} +3 -3
- package/dist/default-client/assets/{playback-processor-C_F19eUJ.js → playback-processor-BfJzQKW5.js} +1 -1
- package/dist/default-client/index.html +1 -1
- package/dist/define-client.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{session-core-ByBLnLfW.js → session-core-CwCaFzL8.js} +4 -7
- package/dist/session-core-types.d.ts +7 -3
- package/dist/session-core.js +1 -1
- package/package.json +2 -2
package/dist/client-config.d.ts
CHANGED
|
@@ -26,8 +26,9 @@ export declare function buildAgentUrl(platformUrl: string, endpointPath: string)
|
|
|
26
26
|
* server) — a durable fact worth latching. A lookup that FAILED means
|
|
27
27
|
* nothing about the server, and treating the two alike is how a single 503
|
|
28
28
|
* (a sandbox mid-boot, or one that failed to start) pinned a session to the
|
|
29
|
-
* platform's `/:slug/websocket` —
|
|
30
|
-
* no re-brokering even after the agent
|
|
29
|
+
* platform's `/:slug/websocket` — a WebSocket redirect browsers don't
|
|
30
|
+
* follow, so every retry failed with no re-brokering even after the agent
|
|
31
|
+
* recovered.
|
|
31
32
|
*/
|
|
32
33
|
export declare function loadClientConfig(platformUrl: string, fetchFn?: typeof globalThis.fetch): Promise<ClientConfigResponse | null>;
|
|
33
34
|
/** Fetch the agent's client config; any failure yields the agent default. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,o as t,t as n}from"./index-
|
|
1
|
+
import{a as e,o as t,t as n}from"./index-22Wylv4z.js";function r(e,t,n){if(e!==t)throw Error(`Browser refused the ${n} sample rate: asked for ${t} Hz, got ${e} Hz`)}function i(e){e.then(e=>{for(let t of e.getTracks())t.stop()}).catch(()=>{})}function a(e,t,n){let r=new AudioWorkletNode(e,`capture-processor`,{channelCount:1,channelCountMode:`explicit`}),i=null;return r.port.onmessage=e=>{let r=e.data;r.event===`chunk`&&r.buffer?t(r.buffer):r.event===`silent`?n?.():r.event===`stopped`&&(i?.(),i=null)},{node:r,start(){r.port.postMessage({event:`start`})},stop(){return new Promise(e=>{let t=setTimeout(e,250);i=()=>{clearTimeout(t),e()},r.port.postMessage({event:`stop`})})}}}async function o(o){let{sttSampleRate:s,ttsSampleRate:c,captureWorkletSrc:l,playbackWorkletSrc:u,onMicData:d,onError:f,onPlaybackStats:p,onMicSilent:m}=o,h=new AudioContext({sampleRate:c,latencyHint:`playback`}),g=s===c,_=g?h:new AudioContext({sampleRate:s,latencyHint:`interactive`});async function v(){let e=g?[h]:[h,_];await Promise.all(e.map(e=>e.close().catch(e=>{console.warn(`AudioContext close failed:`,e)})))}let y=navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:`default`},...n}}),b;try{[b]=await Promise.all([y,h.resume(),_.resume(),_.audioWorklet.addModule(l),h.audioWorklet.addModule(u)]),r(_.sampleRate,s,`capture`),r(h.sampleRate,c,`playback`)}catch(e){throw i(y),await v(),e}let x=_.createMediaStreamSource(b),S=a(_,d,m);x.connect(S.node),S.node.onprocessorerror=()=>{let e=Error(`Audio capture worklet crashed`);console.error(`[aai-ui]`,e.message),f?.(e)},S.start();let C=null,w=null,T=new AbortController;function E(){if(C)return C;let e=new AudioWorkletNode(h,`playback-processor`);return e.connect(h.destination),e.port.onmessage=e=>{if(e.data.event===`stop`){let t=e.data.stats;if(t&&t.concealedSamples>0&&p?.(t),e.data.reason===`interrupt`)return;w?.(),w=null}},e.onprocessorerror=()=>{let e=Error(`Audio playback worklet crashed`);console.error(`[aai-ui]`,e.message),w?.(),w=null,f?.(e)},C=e,e}let D={enqueue(e){T.signal.aborted||e.byteLength!==0&&E().port.postMessage({event:`write`,buffer:new Uint8Array(e)},[e])},done(){return!C||(C.port.postMessage({event:`done`}),h.state!==`running`)?Promise.resolve():new Promise(n=>{w?.();let r=()=>{clearInterval(i),clearTimeout(a),w===r&&(w=null),n()},i=setInterval(()=>{h.state!==`running`&&r()},t),a=setTimeout(r,e);w=r})},flush(){C&&(w?.(),w=null,C.port.postMessage({event:`interrupt`}))},async close(){if(!T.signal.aborted){T.abort(),await S.stop(),x.disconnect(),S.node.disconnect(),C&&C.disconnect();for(let e of b.getTracks())e.stop();await v()}},async[Symbol.asyncDispose](){await D.close()}};return D}export{o as createVoiceIO};
|
package/dist/default-client/assets/{capture-processor-_QJe3nzY.js → capture-processor-ChXugkMd.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./index-
|
|
1
|
+
import{n as e,r as t}from"./index-22Wylv4z.js";import{t as n}from"./_module-url-BX0RuRU2.js";var r=n(`
|
|
2
2
|
class CaptureProcessor extends AudioWorkletProcessor {
|
|
3
3
|
constructor(options) {
|
|
4
4
|
super();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./capture-processor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./capture-processor-ChXugkMd.js","./_module-url-BX0RuRU2.js","./playback-processor-BfJzQKW5.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var ee=Array.isArray;function S(){}var C={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function T(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return T(e.type,t,e.props)}function E(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ne(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var re=/\/+/g;function D(e,t){return typeof e==`object`&&e&&e.key!=null?ne(``+e.key):t.toString(36)}function ie(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(S,S):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ae(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ae(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+D(e,0):a,ee(o)?(i=``,c!=null&&(i=c.replace(re,`$&/`)+`/`),ae(o,r,i,``,function(e){return e})):o!=null&&(E(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(re,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ee(e))for(var u=0;u<e.length;u++)a=e[u],s=l+D(a,u),c+=ae(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+D(a,u++),c+=ae(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ae(ie(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function oe(e,t,n){if(e==null)return e;var r=[],i=0;return ae(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function se(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var O=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},k={map:oe,forEach:function(e,t,n){oe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return oe(e,function(){t++}),t},toArray:function(e){return oe(e,function(e){return e})||[]},only:function(e){if(!E(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=k,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return C.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!w.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return T(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)w.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return T(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=E,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:se}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=C.T,n={};C.T=n;try{var r=e(),i=C.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(S,O)}catch(e){O(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),C.T=t}},e.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},e.use=function(e){return C.H.use(e)},e.useActionState=function(e,t,n){return C.H.useActionState(e,t,n)},e.useCallback=function(e,t){return C.H.useCallback(e,t)},e.useContext=function(e){return C.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return C.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return C.H.useEffect(e,t)},e.useEffectEvent=function(e){return C.H.useEffectEvent(e)},e.useId=function(){return C.H.useId()},e.useImperativeHandle=function(e,t,n){return C.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return C.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return C.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return C.H.useMemo(e,t)},e.useOptimistic=function(e,t){return C.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return C.H.useReducer(e,t,n)},e.useRef=function(e){return C.H.useRef(e)},e.useState=function(e){return C.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return C.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return C.H.useTransition()},e.version=`19.2.8`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),p=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=f()})),m=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,E());else{var t=n(l);t!==null&&D(x,t.startTime-e)}}var ee=!1,S=-1,C=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<C)}function te(){if(g=!1,ee){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(S),S=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&D(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?E():ee=!1}}}var E;if(typeof y==`function`)E=function(){y(te)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=te,E=function(){re.postMessage(null)}}else E=function(){_(te,0)};function D(t,n){S=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):C=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(S),S=-1):h=!0,D(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,E()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=o(((e,t)=>{t.exports=m()})),g=o((e=>{var t=h(),n=d(),r=p();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),te=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),ne=Symbol.for(`react.activity`),re=Symbol.for(`react.memo_cache_sentinel`),D=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=D&&e[D]||e[`@@iterator`],typeof e==`function`?e:null)}var ae=Symbol.for(`react.client.reference`);function oe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case ne:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case S:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case te:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var se=Array.isArray,O=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,k=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},le=[],ue=-1;function de(e){return{current:e}}function fe(e){0>ue||(e.current=le[ue],le[ue]=null,ue--)}function A(e,t){ue++,le[ue]=e.current,e.current=t}var j=de(null),pe=de(null),me=de(null),he=de(null);function ge(e,t){switch(A(me,t),A(pe,e),A(j,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}fe(j),A(j,e)}function _e(){fe(j),fe(pe),fe(me)}function ve(e){e.memoizedState!==null&&A(he,e);var t=j.current,n=Hd(t,e.type);t!==n&&(A(pe,e),A(j,n))}function ye(e){pe.current===e&&(fe(j),fe(pe)),he.current===e&&(fe(he),Qf._currentValue=ce)}var be,xe;function Se(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+be+e+xe}var Ce=!1;function we(e,t){if(!e||Ce)return``;Ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -168,7 +168,7 @@ agent-specific instructions win.
|
|
|
168
168
|
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return th(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=Qh.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function cg(){return{exit:{taskListCheckValueChecked:ug,taskListCheckValueUnchecked:ug,paragraph:dg}}}function lg(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:fg}}}function ug(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function dg(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function fg(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=Qh.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function pg(){return[ym(),Um(),Jm(),$h(),cg()]}function mg(e){return{extensions:[bm(),Wm(e),Ym(),sg(e),lg()]}}var hg={tokenize:kg,partial:!0},gg={tokenize:Ag,partial:!0},_g={tokenize:jg,partial:!0},vg={tokenize:Mg,partial:!0},yg={tokenize:Ng,partial:!0},bg={name:`wwwAutolink`,tokenize:Dg,previous:Pg},xg={name:`protocolAutolink`,tokenize:Og,previous:Fg},Sg={name:`emailAutolink`,tokenize:Eg,previous:Ig},Cg={};function wg(){return{text:Cg}}for(var Tg=48;Tg<123;)Cg[Tg]=Sg,Tg++,Tg===58?Tg=65:Tg===91&&(Tg=97);Cg[43]=Sg,Cg[45]=Sg,Cg[46]=Sg,Cg[95]=Sg,Cg[72]=[Sg,xg],Cg[104]=[Sg,xg],Cg[87]=[Sg,bg],Cg[119]=[Sg,bg];function Eg(e,t,n){let r=this,i,a;return o;function o(t){return!Lg(t)||!Ig.call(r,r.previous)||Rg(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Lg(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(yg,u,l)(t):t===45||t===95||kl(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Ol(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Dg(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Pg.call(r,r.previous)||Rg(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(hg,e.attempt(gg,e.attempt(_g,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Og(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Fg.call(r,r.previous)&&!Rg(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Ol(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||jl(t)||U(t)||Il(t)||Fl(t)?n(t):e.attempt(gg,e.attempt(_g,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function kg(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Ag(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(vg,c,s)(t):t===null||U(t)||Il(t)||t!==45&&Fl(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function jg(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(vg,t,a)(o):o===null||U(o)||Il(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Mg(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||U(o)||Il(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||U(e)||Il(e)?t(e):r(e)}function a(e){return Ol(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Ol(t)?(e.consume(t),o):n(t)}}function Ng(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return kl(e)?n(e):t(e)}}function Pg(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||U(e)}function Fg(e){return!Ol(e)}function Ig(e){return!(e===47||Lg(e))}function Lg(e){return e===43||e===45||e===46||e===95||kl(e)}function Rg(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var zg={tokenize:qg,partial:!0};function Bg(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Wg,continuation:{tokenize:Gg},exit:Kg}},text:{91:{name:`gfmFootnoteCall`,tokenize:Ug},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Vg,resolveTo:Hg}}}}function Vg(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Dl(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Hg(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Ug(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||U(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Dl(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return U(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Wg(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||U(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Dl(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return U(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),G(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Gg(e,t,n){return e.check(Jl,t,e.attempt(zg,t,n))}function Kg(e){e.exit(`gfmFootnoteDefinition`)}function qg(e,t,n){let r=this;return G(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Jg(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&bl(o,o.length,0,Vl(s,e.slice(r+1,n),t)),bl(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),bl(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Bl(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Bl(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Yg=class{constructor(){this.map=[]}add(e,t,n){Xg(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function Xg(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Zg(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function Qg(){return{flow:{null:{name:`table`,tokenize:$g,resolveAll:e_}}}}function $g(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?ee:c;return a===ee&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):H(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):W(t)?G(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||U(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,W(t)?G(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return W(t)?G(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||H(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return W(t)?G(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||H(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function ee(t){return e.enter(`tableRow`),S(t)}function S(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),S):n===null||H(n)?(e.exit(`tableRow`),t(n)):W(n)?G(e,S,`whitespace`)(n):(e.enter(`data`),C(n))}function C(t){return t===null||t===124||U(t)?(e.exit(`data`),S(t)):(e.consume(t),t===92?w:C)}function w(t){return t===92||t===124?(e.consume(t),C):C(t)}}function e_(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Yg;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(n_(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=t_(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=t_(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=t_(f,t,o,i,n,d)):(o[0]=o[1],d=t_(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&n_(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=Zg(t.events,n))}return e}function t_(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},r_(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=r_(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=r_(t.events,n[2]),a=r_(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},r_(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function n_(e,t,n,r,i){let a=[],o=r_(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function r_(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var i_={name:`tasklistCheck`,tokenize:o_};function a_(){return{text:{91:i_}}}function o_(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return U(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return H(r)?t(r):W(r)?e.check({tokenize:s_},t,n)(r):n(r)}}function s_(e,t,n){return G(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function c_(e){return Cl([wg(),Bg(),Jg(e),Qg(),a_()])}var l_={};function u_(e){let t=this,n=e||l_,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(c_(n)),a.push(pg()),o.push(mg(n))}var d_=/^(\s*)(\d{1,9})([.)])\s*$/,f_=/^(\s*)([-*+])\s*$/,p_=/^\s*(```|~~~)/;function m_(e){let t=!1;return e.split(`
|
|
169
169
|
`).map(e=>{if(p_.test(e))return t=!t,e;if(t)return e;let n=d_.exec(e);if(n)return`${n[1]}${n[2]}\\${n[3]}`;let r=f_.exec(e);return r?`${r[1]}\\${r[2]}`:e}).join(`
|
|
170
170
|
`)}var h_=(0,L.memo)(function({text:e}){let t=gs();return(0,R.jsx)(om,{remarkPlugins:[u_],components:{p:e=>(0,R.jsx)(`p`,{className:`my-1.5 first:mt-0 last:mb-0`,...e}),ul:e=>(0,R.jsx)(`ul`,{className:`my-1.5 list-disc pl-5`,...e}),ol:e=>(0,R.jsx)(`ol`,{className:`my-1.5 list-decimal pl-5`,...e}),li:e=>(0,R.jsx)(`li`,{className:`my-0.5`,...e}),h1:e=>(0,R.jsx)(`h1`,{className:`mt-3 mb-1.5 text-[17px] font-semibold`,...e}),h2:e=>(0,R.jsx)(`h2`,{className:`mt-3 mb-1.5 text-[16px] font-semibold`,...e}),h3:e=>(0,R.jsx)(`h3`,{className:`mt-3 mb-1.5 text-[15px] font-semibold`,...e}),a:({style:e,...n})=>(0,R.jsx)(`a`,{className:`underline underline-offset-2`,style:{color:t.primary,...e},target:`_blank`,rel:`noreferrer noopener`,...n}),code:({className:e,style:n,children:r,...i})=>/language-/.test(e??``)?(0,R.jsx)(`code`,{className:`font-aai-mono text-[12.5px]`,...i,children:r}):(0,R.jsx)(`code`,{className:`rounded-sm border px-1 py-0.5 font-aai-mono text-[12.5px]`,style:{borderColor:t.border,background:xs,...n},...i,children:r}),pre:({style:e,...n})=>(0,R.jsx)(`pre`,{className:`my-1.5 overflow-x-auto rounded-md border p-2.5 whitespace-pre-wrap wrap-break-word`,style:{borderColor:t.border,background:xs,...e},...n}),blockquote:({style:e,...n})=>(0,R.jsx)(`blockquote`,{className:`my-1.5 border-l-2 pl-3`,style:{borderColor:t.border,color:ys,...e},...n}),table:e=>(0,R.jsx)(`table`,{className:`my-1.5 w-full border-collapse text-sm`,...e}),th:({style:e,...n})=>(0,R.jsx)(`th`,{className:`border px-2 py-1 text-left font-medium`,style:{borderColor:t.border,...e},...n}),td:({style:e,...n})=>(0,R.jsx)(`td`,{className:`border px-2 py-1`,style:{borderColor:t.border,...e},...n}),hr:({style:e,...n})=>(0,R.jsx)(`hr`,{className:`my-2.5 border-t`,style:{borderColor:t.border,...e},...n})},children:m_(e)})});function g_(){let e=0;return{current:()=>e,bump(){e+=1},isCurrent:t=>t===e}}function __(e){return e&&(Wo(e)??e)}function v_(e,t=80){return e.length>t?`${e.slice(0,t)}...`:e}var y_=(0,L.createContext)({});function b_(){return(0,L.useContext)(y_)}function x_(e){let t=__(e);return t===e?e:JSON.stringify(t,null,2)}var S_=(0,L.memo)(function({toolCall:e,className:t}){let[n,r]=(0,L.useState)(!1),i=gs(),a=b_(),o=Object.hasOwn(a,e.name)?a[e.name]:void 0,s=e.status===`pending`,c=o?.label||e.name,l=o?.icon,u=!s&&!!e.result,d=(0,L.useMemo)(()=>e.result?x_(e.result):``,[e.result]),f=(0,L.useMemo)(()=>{let t=e.args;if(e.name===`run_code`&&t.code)return v_(String(t.code).split(`
|
|
171
|
-
`)[0]??``);for(let e of[`query`,`url`,`question`])if(t[e])return String(t[e]);return v_(JSON.stringify(t))},[e.name,e.args]);return(0,R.jsxs)(`div`,{className:vs(`flex flex-col rounded-md border overflow-hidden`,t),style:{borderColor:i.border,background:i.bg},children:[(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":u?n:void 0,disabled:s,className:vs(`flex items-center gap-2.5 px-3.5 py-2.5 select-none text-left w-full appearance-none border-none bg-transparent`,u&&`cursor-pointer`),onClick:()=>{u&&r(!n)},children:[l?(0,R.jsx)(`span`,{className:`w-4 h-4 shrink-0 text-center leading-4`,children:l}):(0,R.jsx)(Es,{className:`shrink-0`,style:{color:bs},children:`Tool`}),(0,R.jsx)(`span`,{className:vs(`font-aai-mono text-[13px] font-medium`,s&&`tool-shimmer`),style:{color:i.text},children:c}),(0,R.jsx)(`span`,{className:`font-aai-mono text-[13px] truncate flex-1 min-w-0`,style:{color:bs},children:f}),u&&(0,R.jsx)(`span`,{className:vs(`text-[10px] shrink-0 transition-transform duration-150`,n&&`rotate-90`),style:{color:`#6F6A60`},children:`▶`})]}),n&&(0,R.jsxs)(`div`,{className:`border-t max-h-64 overflow-auto`,style:{borderColor:i.border,background:i.surface},children:[e.name===`run_code`&&!!e.args.code&&(0,R.jsx)(`pre`,{className:`font-aai-mono text-xs px-3.5 py-3 m-0 whitespace-pre-wrap wrap-break-word border-b`,style:{color:i.text,borderColor:i.border},children:String(e.args.code)}),d&&(0,R.jsx)(`pre`,{className:`font-aai-mono text-xs px-3.5 py-3 m-0 whitespace-pre-wrap wrap-break-word`,style:{color:`#57534B`},children:d})]})]})}),C_=[0,.16,.32].map(e=>({animation:`aai-bounce 1.4s infinite ease-in-out both`,animationDelay:`${e}s`}));function w_(){return(0,R.jsx)(`div`,{className:`flex items-center gap-2 text-sm font-medium min-h-5`,style:{color:ys},children:C_.map((e,t)=>(0,R.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full`,style:{...e,background:ys}},t))})}function T_({theme:e,color:t,children:n}){return(0,R.jsx)(`div`,{className:`flex flex-col w-full items-end`,children:(0,R.jsx)(`div`,{className:`max-w-[min(78%,64ch)] border px-3.5 py-2.5 rounded-md whitespace-pre-wrap wrap-break-word text-[15px] font-normal leading-[22px]`,style:{background:Cs(e.primary,e.surface,7),borderColor:Cs(e.primary,e.surface,16),color:t},children:n})})}var E_=(0,L.memo)(function({message:e,theme:t}){return e.role===`user`?(0,R.jsx)(T_,{theme:t,color:t.text,children:e.content}):(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 max-w-[82%]`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-medium tracking-[1.2px] uppercase leading-none`,style:{color:bs},children:`Agent`}),(0,R.jsx)(`div`,{className:`wrap-break-word text-[15px] font-normal leading-[23px]`,style:{color:t.text},children:(0,R.jsx)(h_,{text:e.content})})]})}),D_=96;function O_(e,t){let n=(0,L.useRef)(null),r=(0,L.useRef)(!0),i=(0,L.useRef)(!1),a=(0,L.useRef)(t);a.current=t;let o=(0,L.useCallback)(e=>{let t=e.currentTarget;r.current=t.scrollTop+t.clientHeight>=t.scrollHeight-D_},[]);return(0,L.useEffect)(()=>{e===0||i.current||!r.current||(i.current=!0,requestAnimationFrame(()=>{i.current=!1,r.current&&n.current?.scrollIntoView({behavior:a.current?`instant`:`smooth`,block:`end`})}))},[e]),{anchorRef:n,onScroll:o}}function k_(e,t,n,r){let i=[],a=0,o=e=>{let n=t[a];for(;n&&n.afterMessageId<=e;)i.push(r(n)),a++,n=t[a]},s=e[0];s&&o(s.id-1);for(let t of e)i.push(n(t)),o(t.id);return o(1/0),i}var A_=(0,L.memo)(function({className:e}){let t=fs(e=>e.state),n=fs(e=>e.messages),r=fs(e=>e.toolCalls),i=fs(e=>e.userTranscript),a=fs(e=>e.agentTranscript),o=fs(e=>e.contentVersion),s=gs(),c=(0,L.useMemo)(()=>{if(t!==`thinking`)return!1;let e=r.at(-1);if(e?.status===`pending`)return!1;let i=n.at(-1);return!i||i.role===`user`||!!e},[t,r,n]),{anchorRef:l,onScroll:u}=O_(o,i!==null),d=(0,L.useMemo)(()=>k_(n,r,e=>(0,R.jsx)(E_,{message:e,theme:s},e.id),e=>(0,R.jsx)(S_,{toolCall:e},e.callId)),[n,r,s]);return(0,R.jsx)(`div`,{role:`log`,className:vs(`flex-1 overflow-y-auto [scrollbar-width:none]`,e),style:{background:s.surface},onScroll:u,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 p-7`,children:[d,a&&(0,R.jsx)(E_,{message:{role:`assistant`,content:a},theme:s}),i!==null&&(0,R.jsx)(T_,{theme:s,color:`#6F6A60`,children:i||(0,R.jsx)(w_,{})}),c&&(0,R.jsx)(w_,{}),(0,R.jsx)(`div`,{ref:l})]})})}),j_=new Set([`listening`,`speaking`]);function M_({icon:e,title:t,className:n}){let r=fs(e=>e.state),i=fs(e=>e.error);return(0,R.jsx)(Os,{icon:e,title:t,state:r,pulsing:j_.has(r),error:i?.message,className:n,footer:(0,R.jsx)(Is,{}),children:(0,R.jsx)(A_,{})})}function N_({sidebar:e,children:t,sidebarWidth:n=`18rem`,sidebarPosition:r=`left`,className:i}){let a=gs(),o=(0,R.jsx)(`div`,{className:`shrink-0 flex flex-col overflow-y-auto`,style:{width:n,...r===`left`?{borderRight:`1px solid ${a.border}`}:{borderLeft:`1px solid ${a.border}`}},children:e});return(0,R.jsxs)(`div`,{className:vs(`flex h-screen`,i),style:{background:a.bg},children:[r===`left`&&o,(0,R.jsx)(`div`,{className:`flex-1 min-w-0`,children:t}),r===`right`&&o]})}function P_({children:e,icon:t,title:n,subtitle:r,buttonText:i=`Start Conversation`,className:a}){let o=fs(e=>e.started),{start:s}=ds(),c=gs();return o?e:(0,R.jsx)(`div`,{className:vs(`flex items-center justify-center h-screen font-aai`,a),style:{background:c.bg},children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-5 border rounded-xl px-10 py-12 sm:px-16 sm:py-14 max-w-105 text-center`,style:{background:c.surface,borderColor:c.border,boxShadow:`0 4px 12px -2px rgb(20 18 12 / 0.08)`},children:[t??(0,R.jsx)(Ts,{size:24}),(0,R.jsx)(Es,{children:`Voice Agent`}),n&&(0,R.jsx)(`h1`,{className:`font-aai-serif font-normal text-[32px] leading-[1.15] tracking-[-0.2px] m-0 text-balance`,style:{color:c.text},children:n}),r&&(0,R.jsx)(`p`,{className:`text-[15px] leading-[22px] m-0 max-w-75`,style:{color:`#57534B`},children:r}),(0,R.jsx)(ks,{size:`lg`,className:`mt-2`,onClick:s,children:i})]})})}var F_=`modulepreload`,I_=function(e,t){return new URL(e,t).href},L_={},R_=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=I_(t,n),t=s(t),t in L_)return;L_[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:F_,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};async function z_(e,t,n){if(e.audioSetupInFlight)return;e.audioSetupInFlight=!0;let r=e.generation.current(),i=()=>!(e.generation.isCurrent(r)&&e.ws)||e.ws.readyState!==1,a=e=>{n.cleanupAudio(),n.updateState({state:`error`,error:{code:`audio`,message:e},running:!1,recording:!1})};try{let[{createVoiceIO:o},s,c]=await Promise.all([R_(()=>import(`./audio-BdEKgLwT.js`),[],import.meta.url),R_(()=>import(`./capture-processor-_QJe3nzY.js`).then(e=>e.default),__vite__mapDeps([0,1]),import.meta.url),R_(()=>import(`./playback-processor-C_F19eUJ.js`).then(e=>e.default),__vite__mapDeps([2,1]),import.meta.url)]),l=await o({sttSampleRate:t.sampleRate,ttsSampleRate:t.ttsSampleRate,captureWorkletSrc:s,playbackWorkletSrc:c,onMicData:e=>{try{n.sendAudio(new Uint8Array(e))}catch{console.debug(`[aai-ui] sendAudio dropped: connection closed`)}},onPlaybackStats:e=>{console.warn(`[aai-ui] playback concealed a gap in this turn`,e)},onMicSilent:()=>{console.warn(`[aai-ui] microphone is delivering only silence — check the selected input device`)},onError:t=>{e.generation.isCurrent(r)&&a(t.message)}});if(i()){l.close().catch(()=>{});return}if(e.voiceIO?.close().catch(()=>{}),e.voiceIO=l,e.preInitAudio.length>0){for(let t of e.preInitAudio)l.enqueue(t.buffer);e.preInitAudio=[]}n.sendJson({type:`audio_ready`}),n.updateState({recording:!0}),e.preInitDone?(e.preInitDone=!1,n.settleWhenAudioDrained(l)):n.updateState({state:`listening`})}catch(e){if(i())return;a(`Microphone access failed: ${Uo(e)}`)}finally{e.generation.isCurrent(r)&&(e.audioSetupInFlight=!1)}}var B_=200,V_=200,H_=100,U_={messages:[],toolCalls:[],customEvents:[],agentState:null,userTranscript:null,agentTranscript:null,error:null};function W_(e,t,n){if(e.length<n)return[...e,t];let r=e.slice(e.length-n+1);return r.push(t),r}function G_(e){let{getSnapshot:t,updateState:n,conn:r,cleanupAudio:i}=e,a=g_(),o=0,s=0,c=0;function l(e,r){n({customEvents:W_(t().customEvents,{id:++o,event:e,data:r},B_)})}function u(e){a.bump(),n({userTranscript:null,messages:W_(t().messages,{id:++s,role:`user`,content:e},V_),state:`thinking`})}function d(e){n({agentTranscript:e})}function f(){let e=t().agentTranscript;if(e===null||e.length===0){n({agentTranscript:null});return}n({agentTranscript:null,messages:W_(t().messages,{id:++s,role:`assistant`,content:e},V_)})}function p(){let e=t();e.state===`error`?n({state:`listening`,error:null}):e.error!==null&&n({error:null})}function m(e){console.error(`Agent error:`,e.message),e.fatal===!1?n({error:{code:e.code,message:e.message}}):(i(),r.generation.bump(),n({state:`error`,error:{code:e.code,message:e.message},running:!1,recording:!1}))}function h(e){switch(e.type!==`error`&&p(),e.type){case`speech_started`:n({userTranscript:``});break;case`speech_stopped`:break;case`user_transcript`:u(e.text);break;case`user_transcript_partial`:n({userTranscript:e.text});break;case`agent_transcript`:d(e.text);break;case`tool_call`:n({toolCalls:W_(t().toolCalls,{callId:e.toolCallId,name:e.toolName,args:e.args??{},status:`pending`,seq:++c,afterMessageId:t().messages.at(-1)?.id??-1},V_)});break;case`tool_call_done`:{let r=t().toolCalls,i=r.findIndex(t=>t.callId===e.toolCallId);if(i!==-1){let t=[...r],a=t[i];a&&(t[i]={...a,status:`done`,result:e.result}),n({toolCalls:t})}break}case`reply_done`:f(),n({state:`listening`});break;case`cancelled`:a.bump(),r.voiceIO?.flush(),f(),n({userTranscript:null,state:`listening`});break;case`reset`:a.bump(),r.voiceIO?.flush(),n({...U_,state:`listening`});break;case`custom_event`:l(e.event,e.data);break;case`agent_state`:n({agentState:e.state});break;case`error`:m(e);break;default:break}}function g(e){let i=t();i.state===`error`||i.state===`disconnected`&&i.error!==null||(i.state!==`speaking`&&n({state:`speaking`}),r.voiceIO?r.voiceIO.enqueue(e.buffer):r.preInitAudio.length<H_&&r.preInitAudio.push(e))}function _(e){let t=a.current();e.done().then(()=>{a.isCurrent(t)&&n({state:`listening`})}).catch(e=>{console.warn(`Audio playback done failed:`,e)})}function v(){let e=r.voiceIO;e?_(e):(r.preInitDone=!0,n({state:`listening`}))}function y(e){if(e instanceof ArrayBuffer){g(new Uint8Array(e));return}if(typeof e!=`string`){console.warn(`session-core: non-string, non-binary frame received; dropping`);return}let t=Wo(e);if(t===void 0){console.warn(`session-core: invalid JSON; dropping`);return}let n=Yo(es,t);if(!n.ok){n.malformed&&console.warn(`session-core: malformed server message`,n.error);return}let r=n.data;if(r.type===`config`)return{sampleRate:r.sampleRate,ttsSampleRate:r.ttsSampleRate,sid:r.sessionId};if(r.type===`audio_done`){v();return}h(r)}return{handleMessage:y,settleWhenAudioDrained:_}}(!globalThis.EventTarget||!globalThis.Event)&&console.error(`
|
|
171
|
+
`)[0]??``);for(let e of[`query`,`url`,`question`])if(t[e])return String(t[e]);return v_(JSON.stringify(t))},[e.name,e.args]);return(0,R.jsxs)(`div`,{className:vs(`flex flex-col rounded-md border overflow-hidden`,t),style:{borderColor:i.border,background:i.bg},children:[(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":u?n:void 0,disabled:s,className:vs(`flex items-center gap-2.5 px-3.5 py-2.5 select-none text-left w-full appearance-none border-none bg-transparent`,u&&`cursor-pointer`),onClick:()=>{u&&r(!n)},children:[l?(0,R.jsx)(`span`,{className:`w-4 h-4 shrink-0 text-center leading-4`,children:l}):(0,R.jsx)(Es,{className:`shrink-0`,style:{color:bs},children:`Tool`}),(0,R.jsx)(`span`,{className:vs(`font-aai-mono text-[13px] font-medium`,s&&`tool-shimmer`),style:{color:i.text},children:c}),(0,R.jsx)(`span`,{className:`font-aai-mono text-[13px] truncate flex-1 min-w-0`,style:{color:bs},children:f}),u&&(0,R.jsx)(`span`,{className:vs(`text-[10px] shrink-0 transition-transform duration-150`,n&&`rotate-90`),style:{color:`#6F6A60`},children:`▶`})]}),n&&(0,R.jsxs)(`div`,{className:`border-t max-h-64 overflow-auto`,style:{borderColor:i.border,background:i.surface},children:[e.name===`run_code`&&!!e.args.code&&(0,R.jsx)(`pre`,{className:`font-aai-mono text-xs px-3.5 py-3 m-0 whitespace-pre-wrap wrap-break-word border-b`,style:{color:i.text,borderColor:i.border},children:String(e.args.code)}),d&&(0,R.jsx)(`pre`,{className:`font-aai-mono text-xs px-3.5 py-3 m-0 whitespace-pre-wrap wrap-break-word`,style:{color:`#57534B`},children:d})]})]})}),C_=[0,.16,.32].map(e=>({animation:`aai-bounce 1.4s infinite ease-in-out both`,animationDelay:`${e}s`}));function w_(){return(0,R.jsx)(`div`,{className:`flex items-center gap-2 text-sm font-medium min-h-5`,style:{color:ys},children:C_.map((e,t)=>(0,R.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full`,style:{...e,background:ys}},t))})}function T_({theme:e,color:t,children:n}){return(0,R.jsx)(`div`,{className:`flex flex-col w-full items-end`,children:(0,R.jsx)(`div`,{className:`max-w-[min(78%,64ch)] border px-3.5 py-2.5 rounded-md whitespace-pre-wrap wrap-break-word text-[15px] font-normal leading-[22px]`,style:{background:Cs(e.primary,e.surface,7),borderColor:Cs(e.primary,e.surface,16),color:t},children:n})})}var E_=(0,L.memo)(function({message:e,theme:t}){return e.role===`user`?(0,R.jsx)(T_,{theme:t,color:t.text,children:e.content}):(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 max-w-[82%]`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-medium tracking-[1.2px] uppercase leading-none`,style:{color:bs},children:`Agent`}),(0,R.jsx)(`div`,{className:`wrap-break-word text-[15px] font-normal leading-[23px]`,style:{color:t.text},children:(0,R.jsx)(h_,{text:e.content})})]})}),D_=96;function O_(e,t){let n=(0,L.useRef)(null),r=(0,L.useRef)(!0),i=(0,L.useRef)(!1),a=(0,L.useRef)(t);a.current=t;let o=(0,L.useCallback)(e=>{let t=e.currentTarget;r.current=t.scrollTop+t.clientHeight>=t.scrollHeight-D_},[]);return(0,L.useEffect)(()=>{e===0||i.current||!r.current||(i.current=!0,requestAnimationFrame(()=>{i.current=!1,r.current&&n.current?.scrollIntoView({behavior:a.current?`instant`:`smooth`,block:`end`})}))},[e]),{anchorRef:n,onScroll:o}}function k_(e,t,n,r){let i=[],a=0,o=e=>{let n=t[a];for(;n&&n.afterMessageId<=e;)i.push(r(n)),a++,n=t[a]},s=e[0];s&&o(s.id-1);for(let t of e)i.push(n(t)),o(t.id);return o(1/0),i}var A_=(0,L.memo)(function({className:e}){let t=fs(e=>e.state),n=fs(e=>e.messages),r=fs(e=>e.toolCalls),i=fs(e=>e.userTranscript),a=fs(e=>e.agentTranscript),o=fs(e=>e.contentVersion),s=gs(),c=(0,L.useMemo)(()=>{if(t!==`thinking`)return!1;let e=r.at(-1);if(e?.status===`pending`)return!1;let i=n.at(-1);return!i||i.role===`user`||!!e},[t,r,n]),{anchorRef:l,onScroll:u}=O_(o,i!==null),d=(0,L.useMemo)(()=>k_(n,r,e=>(0,R.jsx)(E_,{message:e,theme:s},e.id),e=>(0,R.jsx)(S_,{toolCall:e},e.callId)),[n,r,s]);return(0,R.jsx)(`div`,{role:`log`,className:vs(`flex-1 overflow-y-auto [scrollbar-width:none]`,e),style:{background:s.surface},onScroll:u,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 p-7`,children:[d,a&&(0,R.jsx)(E_,{message:{role:`assistant`,content:a},theme:s}),i!==null&&(0,R.jsx)(T_,{theme:s,color:`#6F6A60`,children:i||(0,R.jsx)(w_,{})}),c&&(0,R.jsx)(w_,{}),(0,R.jsx)(`div`,{ref:l})]})})}),j_=new Set([`listening`,`speaking`]);function M_({icon:e,title:t,className:n}){let r=fs(e=>e.state),i=fs(e=>e.error);return(0,R.jsx)(Os,{icon:e,title:t,state:r,pulsing:j_.has(r),error:i?.message,className:n,footer:(0,R.jsx)(Is,{}),children:(0,R.jsx)(A_,{})})}function N_({sidebar:e,children:t,sidebarWidth:n=`18rem`,sidebarPosition:r=`left`,className:i}){let a=gs(),o=(0,R.jsx)(`div`,{className:`shrink-0 flex flex-col overflow-y-auto`,style:{width:n,...r===`left`?{borderRight:`1px solid ${a.border}`}:{borderLeft:`1px solid ${a.border}`}},children:e});return(0,R.jsxs)(`div`,{className:vs(`flex h-screen`,i),style:{background:a.bg},children:[r===`left`&&o,(0,R.jsx)(`div`,{className:`flex-1 min-w-0`,children:t}),r===`right`&&o]})}function P_({children:e,icon:t,title:n,subtitle:r,buttonText:i=`Start Conversation`,className:a}){let o=fs(e=>e.started),{start:s}=ds(),c=gs();return o?e:(0,R.jsx)(`div`,{className:vs(`flex items-center justify-center h-screen font-aai`,a),style:{background:c.bg},children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-5 border rounded-xl px-10 py-12 sm:px-16 sm:py-14 max-w-105 text-center`,style:{background:c.surface,borderColor:c.border,boxShadow:`0 4px 12px -2px rgb(20 18 12 / 0.08)`},children:[t??(0,R.jsx)(Ts,{size:24}),(0,R.jsx)(Es,{children:`Voice Agent`}),n&&(0,R.jsx)(`h1`,{className:`font-aai-serif font-normal text-[32px] leading-[1.15] tracking-[-0.2px] m-0 text-balance`,style:{color:c.text},children:n}),r&&(0,R.jsx)(`p`,{className:`text-[15px] leading-[22px] m-0 max-w-75`,style:{color:`#57534B`},children:r}),(0,R.jsx)(ks,{size:`lg`,className:`mt-2`,onClick:s,children:i})]})})}var F_=`modulepreload`,I_=function(e,t){return new URL(e,t).href},L_={},R_=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=I_(t,n),t=s(t),t in L_)return;L_[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:F_,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};async function z_(e,t,n){if(e.audioSetupInFlight)return;e.audioSetupInFlight=!0;let r=e.generation.current(),i=()=>!(e.generation.isCurrent(r)&&e.ws)||e.ws.readyState!==1,a=e=>{n.cleanupAudio(),n.updateState({state:`error`,error:{code:`audio`,message:e},running:!1,recording:!1})};try{let[{createVoiceIO:o},s,c]=await Promise.all([R_(()=>import(`./audio-BnLV_QB3.js`),[],import.meta.url),R_(()=>import(`./capture-processor-ChXugkMd.js`).then(e=>e.default),__vite__mapDeps([0,1]),import.meta.url),R_(()=>import(`./playback-processor-BfJzQKW5.js`).then(e=>e.default),__vite__mapDeps([2,1]),import.meta.url)]),l=await o({sttSampleRate:t.sampleRate,ttsSampleRate:t.ttsSampleRate,captureWorkletSrc:s,playbackWorkletSrc:c,onMicData:e=>{try{n.sendAudio(new Uint8Array(e))}catch{console.debug(`[aai-ui] sendAudio dropped: connection closed`)}},onPlaybackStats:e=>{console.warn(`[aai-ui] playback concealed a gap in this turn`,e)},onMicSilent:()=>{console.warn(`[aai-ui] microphone is delivering only silence — check the selected input device`)},onError:t=>{e.generation.isCurrent(r)&&a(t.message)}});if(i()){l.close().catch(()=>{});return}if(e.voiceIO?.close().catch(()=>{}),e.voiceIO=l,e.preInitAudio.length>0){for(let t of e.preInitAudio)l.enqueue(t.buffer);e.preInitAudio=[]}n.sendJson({type:`audio_ready`}),n.updateState({recording:!0}),e.preInitDone?(e.preInitDone=!1,n.settleWhenAudioDrained(l)):n.updateState({state:`listening`})}catch(e){if(i())return;a(`Microphone access failed: ${Uo(e)}`)}finally{e.generation.isCurrent(r)&&(e.audioSetupInFlight=!1)}}var B_=200,V_=200,H_=100,U_={messages:[],toolCalls:[],customEvents:[],agentState:null,userTranscript:null,agentTranscript:null,error:null};function W_(e,t,n){if(e.length<n)return[...e,t];let r=e.slice(e.length-n+1);return r.push(t),r}function G_(e){let{getSnapshot:t,updateState:n,conn:r,cleanupAudio:i}=e,a=g_(),o=0,s=0,c=0;function l(e,r){n({customEvents:W_(t().customEvents,{id:++o,event:e,data:r},B_)})}function u(e){a.bump(),n({userTranscript:null,messages:W_(t().messages,{id:++s,role:`user`,content:e},V_),state:`thinking`})}function d(e){n({agentTranscript:e})}function f(){let e=t().agentTranscript;if(e===null||e.length===0){n({agentTranscript:null});return}n({agentTranscript:null,messages:W_(t().messages,{id:++s,role:`assistant`,content:e},V_)})}function p(){let e=t();e.state===`error`?n({state:`listening`,error:null}):e.error!==null&&n({error:null})}function m(e){console.error(`Agent error:`,e.message),e.fatal===!1?n({error:{code:e.code,message:e.message}}):(i(),r.generation.bump(),n({state:`error`,error:{code:e.code,message:e.message},running:!1,recording:!1}))}function h(e){switch(e.type!==`error`&&p(),e.type){case`speech_started`:n({userTranscript:``});break;case`speech_stopped`:break;case`user_transcript`:u(e.text);break;case`user_transcript_partial`:n({userTranscript:e.text});break;case`agent_transcript`:d(e.text);break;case`tool_call`:n({toolCalls:W_(t().toolCalls,{callId:e.toolCallId,name:e.toolName,args:e.args??{},status:`pending`,seq:++c,afterMessageId:t().messages.at(-1)?.id??-1},V_)});break;case`tool_call_done`:{let r=t().toolCalls,i=r.findIndex(t=>t.callId===e.toolCallId);if(i!==-1){let t=[...r],a=t[i];a&&(t[i]={...a,status:`done`,result:e.result}),n({toolCalls:t})}break}case`reply_done`:f(),n({state:`listening`});break;case`cancelled`:a.bump(),r.voiceIO?.flush(),f(),n({userTranscript:null,state:`listening`});break;case`reset`:a.bump(),r.voiceIO?.flush(),n({...U_,state:`listening`});break;case`custom_event`:l(e.event,e.data);break;case`agent_state`:n({agentState:e.state});break;case`error`:m(e);break;default:break}}function g(e){let i=t();i.state===`error`||i.state===`disconnected`&&i.error!==null||(i.state!==`speaking`&&n({state:`speaking`}),r.voiceIO?r.voiceIO.enqueue(e.buffer):r.preInitAudio.length<H_&&r.preInitAudio.push(e))}function _(e){let t=a.current();e.done().then(()=>{a.isCurrent(t)&&n({state:`listening`})}).catch(e=>{console.warn(`Audio playback done failed:`,e)})}function v(){let e=r.voiceIO;e?_(e):(r.preInitDone=!0,n({state:`listening`}))}function y(e){if(e instanceof ArrayBuffer){g(new Uint8Array(e));return}if(typeof e!=`string`){console.warn(`session-core: non-string, non-binary frame received; dropping`);return}let t=Wo(e);if(t===void 0){console.warn(`session-core: invalid JSON; dropping`);return}let n=Yo(es,t);if(!n.ok){n.malformed&&console.warn(`session-core: malformed server message`,n.error);return}let r=n.data;if(r.type===`config`)return{sampleRate:r.sampleRate,ttsSampleRate:r.ttsSampleRate,sid:r.sessionId};if(r.type===`audio_done`){v();return}h(r)}return{handleMessage:y,settleWhenAudioDrained:_}}(!globalThis.EventTarget||!globalThis.Event)&&console.error(`
|
|
172
172
|
PartySocket requires a global 'EventTarget' class to be available!
|
|
173
173
|
You can polyfill this global by adding this to your code before any partysocket imports:
|
|
174
174
|
|
|
@@ -189,4 +189,4 @@ const partysocket = new PartySocket({
|
|
|
189
189
|
WebSocket: WS
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
`),nv=!0);let r=this._options.WebSocket||WebSocket;this._debug(`connect`,{url:e,protocols:n}),this._ws=n?new r(e,n):new r(e),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),t)}).catch(e=>{this._connectLock=!1,this._handleError(new J_.ErrorEvent(Error(e.message),this))})}_handleTimeout(){this._debug(`timeout event`),this._handleError(new J_.ErrorEvent(Error(`TIMEOUT`),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),this._ws){this._removeListeners();try{(this._ws.readyState===this.OPEN||this._ws.readyState===this.CONNECTING)&&this._ws.close(e,t),this._handleClose(new J_.CloseEvent(e,t,this))}catch{}}}_acceptOpen(){this._debug(`accept open`),this._retryCount=0}_handleOpen=e=>{this._debug(`open event`);let{minUptime:t=tv.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),t),Y_(this._ws,`WebSocket is not defined`),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(e=>{this._ws?.send(e)}),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(ev(e))};_handleMessage=e=>{this._debug(`message event`),this.onmessage&&this.onmessage(e),this.dispatchEvent(ev(e))};_handleError=e=>{this._debug(`error event`,e.message),this._disconnect(void 0,e.message===`TIMEOUT`?`timeout`:void 0),this.onerror&&this.onerror(e),this._debug(`exec error listeners`),this.dispatchEvent(ev(e)),this._connect()};_handleClose=e=>{this._debug(`close event`),this._clearTimeouts(),this._options.shouldReconnectOnClose&&!this._options.shouldReconnectOnClose(e)&&(this._shouldReconnect=!1),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(ev(e))};_removeListeners(){this._ws&&(this._debug(`removeListeners`),this._ws.removeEventListener(`open`,this._handleOpen),this._ws.removeEventListener(`close`,this._handleClose),this._ws.removeEventListener(`message`,this._handleMessage),this._ws.removeEventListener(`error`,this._handleError),this._ws.addEventListener(`error`,rv))}_addListeners(){this._ws&&(this._debug(`addListeners`),this._ws.addEventListener(`open`,this._handleOpen),this._ws.addEventListener(`close`,this._handleClose),this._ws.addEventListener(`message`,this._handleMessage),this._ws.addEventListener(`error`,this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}},av={minReconnectionDelay:1e3,maxReconnectionDelay:15e3,reconnectionDelayGrowFactor:2,maxRetries:10};function ov(e){return new iv(e,void 0,av)}function sv(e){return e instanceof iv&&e.shouldReconnect&&e.retryCount<av.maxRetries}function cv(e,t,n){return dv(new URL(`websocket`,e.endsWith(`/`)?e:`${e}/`),t,n)}function lv(e,t,n){return dv(new URL(e),t,n)}var uv={"https:":`wss:`,"http:":`ws:`};function dv(e,t,n){return e.protocol=uv[e.protocol]??e.protocol,n?e.searchParams.set(`sessionId`,n):t&&e.searchParams.set(`resume`,`1`),e}var fv={echoCancellation:!0,noiseSuppression:!1,autoGainControl:!1,voiceIsolation:!1};function pv(e){let t={...U_,state:`disconnected`,contentVersion:0,started:!1,running:!1,recording:!1,apiUrl:cv(e.platformUrl,!1).toString()},n=new Set;function r(){for(let e of n)e()}let i=[`messages`,`toolCalls`,`userTranscript`,`agentTranscript`];function a(e){t=i.some(n=>n in e&&e[n]!==t[n])?{...t,...e,contentVersion:t.contentVersion+1}:{...t,...e},r()}function o(){return t}function s(e){return n.add(e),()=>{n.delete(e)}}let c={ws:null,voiceIO:null,audioSetupInFlight:!1,generation:g_(),preInitAudio:[],preInitDone:!1},l=null,u=!1,d=e.resumeSessionId,f;function p(){c.audioSetupInFlight=!1,c.voiceIO?.close().catch(()=>{}),c.voiceIO=null,c.preInitAudio=[],c.preInitDone=!1}function m(){a(U_)}function h(e){c.ws&&c.ws.readyState===1&&c.ws.send(JSON.stringify(e))}function g(e){!c.ws||c.ws.readyState!==1||c.ws.bufferedAmount>65536||c.ws.send(e)}let{handleMessage:_,settleWhenAudioDrained:v}=G_({getSnapshot:o,updateState:a,conn:c,cleanupAudio:p}),y={sendJson:h,sendAudio:g,updateState:a,settleWhenAudioDrained:v,cleanupAudio:p};function b(){l?.abort(),l=null,p(),c.ws?.close(),c.ws=null}function x(n){n.sid&&(d=n.sid,e.onSessionId?.(n.sid));let r=u;u=!0,z_(c,n,y),r&&t.messages.length>0&&h({type:`history`,messages:t.messages.map(e=>({role:e.role,content:e.content}))})}async function ee(){let
|
|
192
|
+
`),nv=!0);let r=this._options.WebSocket||WebSocket;this._debug(`connect`,{url:e,protocols:n}),this._ws=n?new r(e,n):new r(e),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),t)}).catch(e=>{this._connectLock=!1,this._handleError(new J_.ErrorEvent(Error(e.message),this))})}_handleTimeout(){this._debug(`timeout event`),this._handleError(new J_.ErrorEvent(Error(`TIMEOUT`),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),this._ws){this._removeListeners();try{(this._ws.readyState===this.OPEN||this._ws.readyState===this.CONNECTING)&&this._ws.close(e,t),this._handleClose(new J_.CloseEvent(e,t,this))}catch{}}}_acceptOpen(){this._debug(`accept open`),this._retryCount=0}_handleOpen=e=>{this._debug(`open event`);let{minUptime:t=tv.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),t),Y_(this._ws,`WebSocket is not defined`),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(e=>{this._ws?.send(e)}),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(ev(e))};_handleMessage=e=>{this._debug(`message event`),this.onmessage&&this.onmessage(e),this.dispatchEvent(ev(e))};_handleError=e=>{this._debug(`error event`,e.message),this._disconnect(void 0,e.message===`TIMEOUT`?`timeout`:void 0),this.onerror&&this.onerror(e),this._debug(`exec error listeners`),this.dispatchEvent(ev(e)),this._connect()};_handleClose=e=>{this._debug(`close event`),this._clearTimeouts(),this._options.shouldReconnectOnClose&&!this._options.shouldReconnectOnClose(e)&&(this._shouldReconnect=!1),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(ev(e))};_removeListeners(){this._ws&&(this._debug(`removeListeners`),this._ws.removeEventListener(`open`,this._handleOpen),this._ws.removeEventListener(`close`,this._handleClose),this._ws.removeEventListener(`message`,this._handleMessage),this._ws.removeEventListener(`error`,this._handleError),this._ws.addEventListener(`error`,rv))}_addListeners(){this._ws&&(this._debug(`addListeners`),this._ws.addEventListener(`open`,this._handleOpen),this._ws.addEventListener(`close`,this._handleClose),this._ws.addEventListener(`message`,this._handleMessage),this._ws.addEventListener(`error`,this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}},av={minReconnectionDelay:1e3,maxReconnectionDelay:15e3,reconnectionDelayGrowFactor:2,maxRetries:10};function ov(e){return new iv(e,void 0,av)}function sv(e){return e instanceof iv&&e.shouldReconnect&&e.retryCount<av.maxRetries}function cv(e,t,n){return dv(new URL(`websocket`,e.endsWith(`/`)?e:`${e}/`),t,n)}function lv(e,t,n){return dv(new URL(e),t,n)}var uv={"https:":`wss:`,"http:":`ws:`};function dv(e,t,n){return e.protocol=uv[e.protocol]??e.protocol,n?e.searchParams.set(`sessionId`,n):t&&e.searchParams.set(`resume`,`1`),e}var fv={echoCancellation:!0,noiseSuppression:!1,autoGainControl:!1,voiceIsolation:!1};function pv(e){let t={...U_,state:`disconnected`,contentVersion:0,started:!1,running:!1,recording:!1,apiUrl:cv(e.platformUrl,!1).toString()},n=new Set;function r(){for(let e of n)e()}let i=[`messages`,`toolCalls`,`userTranscript`,`agentTranscript`];function a(e){t=i.some(n=>n in e&&e[n]!==t[n])?{...t,...e,contentVersion:t.contentVersion+1}:{...t,...e},r()}function o(){return t}function s(e){return n.add(e),()=>{n.delete(e)}}let c={ws:null,voiceIO:null,audioSetupInFlight:!1,generation:g_(),preInitAudio:[],preInitDone:!1},l=null,u=!1,d=e.resumeSessionId,f;function p(){c.audioSetupInFlight=!1,c.voiceIO?.close().catch(()=>{}),c.voiceIO=null,c.preInitAudio=[],c.preInitDone=!1}function m(){a(U_)}function h(e){c.ws&&c.ws.readyState===1&&c.ws.send(JSON.stringify(e))}function g(e){!c.ws||c.ws.readyState!==1||c.ws.bufferedAmount>65536||c.ws.send(e)}let{handleMessage:_,settleWhenAudioDrained:v}=G_({getSnapshot:o,updateState:a,conn:c,cleanupAudio:p}),y={sendJson:h,sendAudio:g,updateState:a,settleWhenAudioDrained:v,cleanupAudio:p};function b(){l?.abort(),l=null,p(),c.ws?.close(),c.ws=null}function x(n){n.sid&&(d=n.sid,e.onSessionId?.(n.sid));let r=u;u=!0,z_(c,n,y),r&&t.messages.length>0&&h({type:`history`,messages:t.messages.map(e=>({role:e.role,content:e.content}))})}async function ee(){let t=f===!1?null:await is(e.platformUrl);return t&&(f=t.sessionUrl!==void 0),(t?.sessionUrl?lv(t.sessionUrl,u,d):cv(e.platformUrl,u,d)).toString()}function S(){return e.WebSocket?new e.WebSocket(cv(e.platformUrl,u,d).toString()):ov(ee)}function C(e){if(e?.signal?.aborted){te();return}a({state:`connecting`,error:null}),b(),c.generation.bump();let n=new AbortController;l=n;let{signal:r}=n;e?.signal&&e.signal.addEventListener(`abort`,()=>te(),{signal:r});let i=S();i.binaryType=`arraybuffer`,c.ws=i;let o=!1;i.addEventListener(`open`,()=>{a({state:`ready`})},{signal:r}),i.addEventListener(`message`,e=>{let t=_(e.data);t&&x(t)},{signal:r}),i.addEventListener(`error`,()=>{o=!0},{signal:r}),i.addEventListener(`close`,()=>{if(!r.aborted){if(p(),sv(i)){c.generation.bump(),o=!1,a({state:`connecting`,recording:!1});return}n.abort(),i.close(),c.ws=null,o?a({state:`error`,error:{code:`connection`,message:`WebSocket connection error`},running:!1,recording:!1}):t.state===`error`?a({running:!1,recording:!1}):a({state:`disconnected`,error:null,running:!1,recording:!1})}},{signal:r})}function w(){!c.ws||c.ws.readyState!==1||(c.voiceIO?.flush(),a({state:`listening`}),h({type:`cancel`}))}function T(){if(c.voiceIO?.flush(),c.ws&&c.ws.readyState===1){h({type:`reset`});return}m(),te(),a({running:!0}),C()}function te(){b(),a({state:`disconnected`,running:!1,recording:!1})}function E(){a({started:!0,running:!0}),C()}function ne(){t.running?te():(a({running:!0}),C())}return{getSnapshot:o,subscribe:s,connect:C,cancel:w,resetState:m,reset:T,disconnect:te,start:E,toggle:ne,[Symbol.dispose](){te()}}}function mv(e=`#app`){if(typeof e!=`string`)return e;let t=document.querySelector(e);if(!t)throw Error(`Element not found: ${e}`);return t}function hv({name:e,Sidebar:t,sidebarWidth:n}){let r=(0,R.jsx)(M_,{title:e});return(0,R.jsx)(P_,{title:e,children:t?(0,R.jsx)(N_,{sidebar:(0,R.jsx)(t,{}),sidebarWidth:n,children:r}):r})}function gv({platformUrl:e,name:t,Sidebar:n,sidebarWidth:r}){let[i,a]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let t=!1;return as(e).then(e=>{t||a(e)}),()=>{t=!0}},[e]),(0,R.jsx)(hv,{name:t??i?.name,Sidebar:n,sidebarWidth:r})}function _v(e){let t=mv(e.target),n=e.platformUrl??globalThis.location.origin+globalThis.location.pathname,r=pv({platformUrl:n,onSessionId:e.onSessionId,resumeSessionId:e.resumeSessionId,WebSocket:e.WebSocket});e.name&&typeof document<`u`&&(document.title=e.name);let i=e.component?(0,L.createElement)(e.component):(0,L.createElement)(gv,{platformUrl:n,name:e.name,Sidebar:e.sidebar,sidebarWidth:e.sidebarWidth}),a=e.tools??{},o=(0,wo.createRoot)(t);(0,Co.flushSync)(()=>{o.render((0,L.createElement)(y_.Provider,{value:a},(0,L.createElement)(ms,{value:e.theme},(0,L.createElement)(us,{value:r},i))))});let s={session:r,dispose(){o.unmount(),r[Symbol.dispose]()},[Symbol.dispose](){s.dispose()}};return s}_v({});export{jo as a,ko as i,Do as n,Ao as o,Oo as r,fv as t};
|
package/dist/default-client/assets/{playback-processor-C_F19eUJ.js → playback-processor-BfJzQKW5.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./index-
|
|
1
|
+
import{i as e}from"./index-22Wylv4z.js";import{t}from"./_module-url-BX0RuRU2.js";var n=t(`
|
|
2
2
|
class PlaybackProcessor extends AudioWorkletProcessor {
|
|
3
3
|
constructor(options) {
|
|
4
4
|
super();
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>aai</title>
|
|
7
7
|
<link rel="icon" href="./favicon.ico" />
|
|
8
8
|
<style>html, body { background: #FBF8F2; margin: 0; }</style>
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-22Wylv4z.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="./assets/index-CRfdZPH1.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/dist/define-client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as fetchClientConfig, t as createSessionCore } from "./session-core-
|
|
1
|
+
import { r as fetchClientConfig, t as createSessionCore } from "./session-core-CwCaFzL8.js";
|
|
2
2
|
import { SessionProvider, ThemeProvider } from "./context.js";
|
|
3
3
|
import { t as ChatView } from "./chat-view-CW-tZCMm.js";
|
|
4
4
|
import { n as ToolConfigContext } from "./tool-call-block-DIxpG8GM.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as buildAgentUrl, r as fetchClientConfig, t as createSessionCore } from "./session-core-
|
|
1
|
+
import { n as buildAgentUrl, r as fetchClientConfig, t as createSessionCore } from "./session-core-CwCaFzL8.js";
|
|
2
2
|
import { SessionProvider, ThemeProvider, useSession, useSessionSelector, useTheme } from "./context.js";
|
|
3
3
|
import { Button } from "./components/button.js";
|
|
4
4
|
import { t as ChatView } from "./chat-view-CW-tZCMm.js";
|
|
@@ -32,8 +32,9 @@ const AGENT_DEFAULT = {};
|
|
|
32
32
|
* server) — a durable fact worth latching. A lookup that FAILED means
|
|
33
33
|
* nothing about the server, and treating the two alike is how a single 503
|
|
34
34
|
* (a sandbox mid-boot, or one that failed to start) pinned a session to the
|
|
35
|
-
* platform's `/:slug/websocket` —
|
|
36
|
-
* no re-brokering even after the agent
|
|
35
|
+
* platform's `/:slug/websocket` — a WebSocket redirect browsers don't
|
|
36
|
+
* follow, so every retry failed with no re-brokering even after the agent
|
|
37
|
+
* recovered.
|
|
37
38
|
*/
|
|
38
39
|
async function loadClientConfig(platformUrl, fetchFn) {
|
|
39
40
|
const doFetch = fetchFn ?? ((input, init) => globalThis.fetch(input, init));
|
|
@@ -658,11 +659,7 @@ function createSessionCore(options) {
|
|
|
658
659
|
async function currentWsUrl() {
|
|
659
660
|
const cfg = serverIsBroker === false ? null : await loadClientConfig(options.platformUrl);
|
|
660
661
|
if (cfg) serverIsBroker = cfg.sessionUrl !== void 0;
|
|
661
|
-
|
|
662
|
-
const display = new URL(url);
|
|
663
|
-
display.search = "";
|
|
664
|
-
if (display.toString() !== currentSnapshot.apiUrl) updateState({ apiUrl: display.toString() });
|
|
665
|
-
return url.toString();
|
|
662
|
+
return (cfg?.sessionUrl ? buildBrokeredWsUrl(cfg.sessionUrl, hasConnected, sessionId) : buildWsUrl(options.platformUrl, hasConnected, sessionId)).toString();
|
|
666
663
|
}
|
|
667
664
|
/** Open a socket: an injected constructor as-is (tests — connects to the
|
|
668
665
|
* same-origin path, no brokering), or partysocket's reconnecting
|
|
@@ -29,9 +29,13 @@ export type SessionSnapshot = {
|
|
|
29
29
|
/** True while the microphone is live and streaming to the server. */
|
|
30
30
|
readonly recording: boolean;
|
|
31
31
|
/**
|
|
32
|
-
* The WebSocket URL a program can connect to directly
|
|
33
|
-
*
|
|
34
|
-
* `platformUrl` at construction — available before connecting
|
|
32
|
+
* The WebSocket URL a program can connect to directly — the long-living
|
|
33
|
+
* platform endpoint, e.g. `wss://host/my-agent/websocket`. Derived from
|
|
34
|
+
* `platformUrl` at construction — available before connecting — and never
|
|
35
|
+
* replaced by the brokered sandbox tunnel URL the session may actually be
|
|
36
|
+
* connected to: that URL is ephemeral (it dies when the sandbox is
|
|
37
|
+
* replaced), while the platform endpoint is stable and upgrades
|
|
38
|
+
* programmatic clients to the current sandbox endpoint itself.
|
|
35
39
|
*/
|
|
36
40
|
readonly apiUrl: string;
|
|
37
41
|
/**
|
package/dist/session-core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createSessionCore } from "./session-core-
|
|
1
|
+
import { t as createSessionCore } from "./session-core-CwCaFzL8.js";
|
|
2
2
|
export { createSessionCore };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexkroman1/aai-ui",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"react-markdown": "^10.1.0",
|
|
23
23
|
"remark-gfm": "^4.0.1",
|
|
24
24
|
"use-sync-external-store": "^1.6.0",
|
|
25
|
-
"@alexkroman1/aai": "5.0
|
|
25
|
+
"@alexkroman1/aai": "5.1.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^19.0.0",
|