@agi-cli/web-ui 0.1.69 → 0.1.70

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.
@@ -273,7 +273,7 @@ Error generating stack: `+c.message+`
273
273
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const a=new this(t);return n.forEach(o=>a.set(o)),a}static accessor(t){const a=(this[UA]=this[UA]={accessors:{}}).accessors,o=this.prototype;function l(u){const d=Wo(u);a[d]||(FB(o,u),a[d]=!0)}return X.isArray(t)?t.forEach(l):l(t),this}};sn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);X.reduceDescriptors(sn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(a){this[n]=a}}});X.freezeMethods(sn);function gp(e,t){const n=this||gs,a=t||n,o=sn.from(a.headers);let l=a.data;return X.forEach(e,function(d){l=d.call(n,l,o.normalize(),t?t.status:void 0)}),o.normalize(),l}function MO(e){return!!(e&&e.__CANCEL__)}function Yi(e,t,n){Ae.call(this,e??"canceled",Ae.ERR_CANCELED,t,n),this.name="CanceledError"}X.inherits(Yi,Ae,{__CANCEL__:!0});function UO(e,t,n){const a=n.config.validateStatus;!n.status||!a||a(n.status)?e(n):t(new Ae("Request failed with status code "+n.status,[Ae.ERR_BAD_REQUEST,Ae.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function BB(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function PB(e,t){e=e||10;const n=new Array(e),a=new Array(e);let o=0,l=0,u;return t=t!==void 0?t:1e3,function(p){const f=Date.now(),h=a[l];u||(u=f),n[o]=p,a[o]=f;let m=l,y=0;for(;m!==o;)y+=n[m++],m=m%e;if(o=(o+1)%e,o===l&&(l=(l+1)%e),f-u<t)return;const E=h&&f-h;return E?Math.round(y*1e3/E):void 0}}function jB(e,t){let n=0,a=1e3/t,o,l;const u=(f,h=Date.now())=>{n=h,o=null,l&&(clearTimeout(l),l=null),e(...f)};return[(...f)=>{const h=Date.now(),m=h-n;m>=a?u(f,h):(o=f,l||(l=setTimeout(()=>{l=null,u(o)},a-m)))},()=>o&&u(o)]}const hu=(e,t,n=3)=>{let a=0;const o=PB(50,250);return jB(l=>{const u=l.loaded,d=l.lengthComputable?l.total:void 0,p=u-a,f=o(p),h=u<=d;a=u;const m={loaded:u,total:d,progress:d?u/d:void 0,bytes:p,rate:f||void 0,estimated:f&&d&&h?(d-u)/f:void 0,event:l,lengthComputable:d!=null,[t?"download":"upload"]:!0};e(m)},n)},FA=(e,t)=>{const n=e!=null;return[a=>t[0]({lengthComputable:n,total:e,loaded:a}),t[1]]},BA=e=>(...t)=>X.asap(()=>e(...t)),zB=Mt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Mt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Mt.origin),Mt.navigator&&/(msie|trident)/i.test(Mt.navigator.userAgent)):()=>!0,qB=Mt.hasStandardBrowserEnv?{write(e,t,n,a,o,l){const u=[e+"="+encodeURIComponent(t)];X.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),X.isString(a)&&u.push("path="+a),X.isString(o)&&u.push("domain="+o),l===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function GB(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function HB(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function FO(e,t,n){let a=!GB(t);return e&&(a||n==!1)?HB(e,t):t}const PA=e=>e instanceof sn?{...e}:e;function Pa(e,t){t=t||{};const n={};function a(f,h,m,y){return X.isPlainObject(f)&&X.isPlainObject(h)?X.merge.call({caseless:y},f,h):X.isPlainObject(h)?X.merge({},h):X.isArray(h)?h.slice():h}function o(f,h,m,y){if(X.isUndefined(h)){if(!X.isUndefined(f))return a(void 0,f,m,y)}else return a(f,h,m,y)}function l(f,h){if(!X.isUndefined(h))return a(void 0,h)}function u(f,h){if(X.isUndefined(h)){if(!X.isUndefined(f))return a(void 0,f)}else return a(void 0,h)}function d(f,h,m){if(m in t)return a(f,h);if(m in e)return a(void 0,f)}const p={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d,headers:(f,h,m)=>o(PA(f),PA(h),m,!0)};return X.forEach(Object.keys({...e,...t}),function(h){const m=p[h]||o,y=m(e[h],t[h],h);X.isUndefined(y)&&m!==d||(n[h]=y)}),n}const BO=e=>{const t=Pa({},e);let{data:n,withXSRFToken:a,xsrfHeaderName:o,xsrfCookieName:l,headers:u,auth:d}=t;if(t.headers=u=sn.from(u),t.url=IO(FO(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),d&&u.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),X.isFormData(n)){if(Mt.hasStandardBrowserEnv||Mt.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(X.isFunction(n.getHeaders)){const p=n.getHeaders(),f=["content-type","content-length"];Object.entries(p).forEach(([h,m])=>{f.includes(h.toLowerCase())&&u.set(h,m)})}}if(Mt.hasStandardBrowserEnv&&(a&&X.isFunction(a)&&(a=a(t)),a||a!==!1&&zB(t.url))){const p=o&&l&&qB.read(l);p&&u.set(o,p)}return t},$B=typeof XMLHttpRequest<"u",VB=$B&&function(e){return new Promise(function(n,a){const o=BO(e);let l=o.data;const u=sn.from(o.headers).normalize();let{responseType:d,onUploadProgress:p,onDownloadProgress:f}=o,h,m,y,E,v;function T(){E&&E(),v&&v(),o.cancelToken&&o.cancelToken.unsubscribe(h),o.signal&&o.signal.removeEventListener("abort",h)}let R=new XMLHttpRequest;R.open(o.method.toUpperCase(),o.url,!0),R.timeout=o.timeout;function A(){if(!R)return;const w=sn.from("getAllResponseHeaders"in R&&R.getAllResponseHeaders()),D={data:!d||d==="text"||d==="json"?R.responseText:R.response,status:R.status,statusText:R.statusText,headers:w,config:e,request:R};UO(function(I){n(I),T()},function(I){a(I),T()},D),R=null}"onloadend"in R?R.onloadend=A:R.onreadystatechange=function(){!R||R.readyState!==4||R.status===0&&!(R.responseURL&&R.responseURL.indexOf("file:")===0)||setTimeout(A)},R.onabort=function(){R&&(a(new Ae("Request aborted",Ae.ECONNABORTED,e,R)),R=null)},R.onerror=function(O){const D=O&&O.message?O.message:"Network Error",N=new Ae(D,Ae.ERR_NETWORK,e,R);N.event=O||null,a(N),R=null},R.ontimeout=function(){let O=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const D=o.transitional||LO;o.timeoutErrorMessage&&(O=o.timeoutErrorMessage),a(new Ae(O,D.clarifyTimeoutError?Ae.ETIMEDOUT:Ae.ECONNABORTED,e,R)),R=null},l===void 0&&u.setContentType(null),"setRequestHeader"in R&&X.forEach(u.toJSON(),function(O,D){R.setRequestHeader(D,O)}),X.isUndefined(o.withCredentials)||(R.withCredentials=!!o.withCredentials),d&&d!=="json"&&(R.responseType=o.responseType),f&&([y,v]=hu(f,!0),R.addEventListener("progress",y)),p&&R.upload&&([m,E]=hu(p),R.upload.addEventListener("progress",m),R.upload.addEventListener("loadend",E)),(o.cancelToken||o.signal)&&(h=w=>{R&&(a(!w||w.type?new Yi(null,e,R):w),R.abort(),R=null)},o.cancelToken&&o.cancelToken.subscribe(h),o.signal&&(o.signal.aborted?h():o.signal.addEventListener("abort",h)));const _=BB(o.url);if(_&&Mt.protocols.indexOf(_)===-1){a(new Ae("Unsupported protocol "+_+":",Ae.ERR_BAD_REQUEST,e));return}R.send(l||null)})},YB=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let a=new AbortController,o;const l=function(f){if(!o){o=!0,d();const h=f instanceof Error?f:this.reason;a.abort(h instanceof Ae?h:new Yi(h instanceof Error?h.message:h))}};let u=t&&setTimeout(()=>{u=null,l(new Ae(`timeout ${t} of ms exceeded`,Ae.ETIMEDOUT))},t);const d=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(l):f.removeEventListener("abort",l)}),e=null)};e.forEach(f=>f.addEventListener("abort",l));const{signal:p}=a;return p.unsubscribe=()=>X.asap(d),p}},WB=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let a=0,o;for(;a<n;)o=a+t,yield e.slice(a,o),a=o},KB=async function*(e,t){for await(const n of XB(e))yield*WB(n,t)},XB=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:a}=await t.read();if(n)break;yield a}}finally{await t.cancel()}},jA=(e,t,n,a)=>{const o=KB(e,t);let l=0,u,d=p=>{u||(u=!0,a&&a(p))};return new ReadableStream({async pull(p){try{const{done:f,value:h}=await o.next();if(f){d(),p.close();return}let m=h.byteLength;if(n){let y=l+=m;n(y)}p.enqueue(new Uint8Array(h))}catch(f){throw d(f),f}},cancel(p){return d(p),o.return()}},{highWaterMark:2})},zA=64*1024,{isFunction:Pl}=X,ZB=(({Request:e,Response:t})=>({Request:e,Response:t}))(X.global),{ReadableStream:qA,TextEncoder:GA}=X.global,HA=(e,...t)=>{try{return!!e(...t)}catch{return!1}},QB=e=>{e=X.merge.call({skipUndefined:!0},ZB,e);const{fetch:t,Request:n,Response:a}=e,o=t?Pl(t):typeof fetch=="function",l=Pl(n),u=Pl(a);if(!o)return!1;const d=o&&Pl(qA),p=o&&(typeof GA=="function"?(v=>T=>v.encode(T))(new GA):async v=>new Uint8Array(await new n(v).arrayBuffer())),f=l&&d&&HA(()=>{let v=!1;const T=new n(Mt.origin,{body:new qA,method:"POST",get duplex(){return v=!0,"half"}}).headers.has("Content-Type");return v&&!T}),h=u&&d&&HA(()=>X.isReadableStream(new a("").body)),m={stream:h&&(v=>v.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!m[v]&&(m[v]=(T,R)=>{let A=T&&T[v];if(A)return A.call(T);throw new Ae(`Response type '${v}' is not supported`,Ae.ERR_NOT_SUPPORT,R)})});const y=async v=>{if(v==null)return 0;if(X.isBlob(v))return v.size;if(X.isSpecCompliantForm(v))return(await new n(Mt.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(X.isArrayBufferView(v)||X.isArrayBuffer(v))return v.byteLength;if(X.isURLSearchParams(v)&&(v=v+""),X.isString(v))return(await p(v)).byteLength},E=async(v,T)=>{const R=X.toFiniteNumber(v.getContentLength());return R??y(T)};return async v=>{let{url:T,method:R,data:A,signal:_,cancelToken:w,timeout:O,onDownloadProgress:D,onUploadProgress:N,responseType:I,headers:P,withCredentials:B="same-origin",fetchOptions:M}=BO(v),H=t||fetch;I=I?(I+"").toLowerCase():"text";let K=YB([_,w&&w.toAbortSignal()],O),ne=null;const te=K&&K.unsubscribe&&(()=>{K.unsubscribe()});let ue;try{if(N&&f&&R!=="get"&&R!=="head"&&(ue=await E(P,A))!==0){let U=new n(T,{method:"POST",body:A,duplex:"half"}),$;if(X.isFormData(A)&&($=U.headers.get("content-type"))&&P.setContentType($),U.body){const[C,oe]=FA(ue,hu(BA(N)));A=jA(U.body,zA,C,oe)}}X.isString(B)||(B=B?"include":"omit");const q=l&&"credentials"in n.prototype,ee={...M,signal:K,method:R.toUpperCase(),headers:P.normalize().toJSON(),body:A,duplex:"half",credentials:q?B:void 0};ne=l&&new n(T,ee);let ae=await(l?H(ne,M):H(T,ee));const pe=h&&(I==="stream"||I==="response");if(h&&(D||pe&&te)){const U={};["status","statusText","headers"].forEach(ce=>{U[ce]=ae[ce]});const $=X.toFiniteNumber(ae.headers.get("content-length")),[C,oe]=D&&FA($,hu(BA(D),!0))||[];ae=new a(jA(ae.body,zA,C,()=>{oe&&oe(),te&&te()}),U)}I=I||"text";let L=await m[X.findKey(m,I)||"text"](ae,v);return!pe&&te&&te(),await new Promise((U,$)=>{UO(U,$,{data:L,headers:sn.from(ae.headers),status:ae.status,statusText:ae.statusText,config:v,request:ne})})}catch(q){throw te&&te(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new Ae("Network Error",Ae.ERR_NETWORK,v,ne),{cause:q.cause||q}):Ae.from(q,q&&q.code,v,ne)}}},JB=new Map,PO=e=>{let t=e?e.env:{};const{fetch:n,Request:a,Response:o}=t,l=[a,o,n];let u=l.length,d=u,p,f,h=JB;for(;d--;)p=l[d],f=h.get(p),f===void 0&&h.set(p,f=d?new Map:QB(t)),h=f;return f};PO();const Dy={http:gB,xhr:VB,fetch:{get:PO}};X.forEach(Dy,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const $A=e=>`- ${e}`,eP=e=>X.isFunction(e)||e===null||e===!1,jO={getAdapter:(e,t)=>{e=X.isArray(e)?e:[e];const{length:n}=e;let a,o;const l={};for(let u=0;u<n;u++){a=e[u];let d;if(o=a,!eP(a)&&(o=Dy[(d=String(a)).toLowerCase()],o===void 0))throw new Ae(`Unknown adapter '${d}'`);if(o&&(X.isFunction(o)||(o=o.get(t))))break;l[d||"#"+u]=o}if(!o){const u=Object.entries(l).map(([p,f])=>`adapter ${p} `+(f===!1?"is not supported by the environment":"is not available in the build"));let d=n?u.length>1?`since :
274
274
  `+u.map($A).join(`
275
275
  `):" "+$A(u[0]):"as no adapter specified";throw new Ae("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return o},adapters:Dy};function bp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yi(null,e)}function VA(e){return bp(e),e.headers=sn.from(e.headers),e.data=gp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),jO.getAdapter(e.adapter||gs.adapter,e)(e).then(function(a){return bp(e),a.data=gp.call(e,e.transformResponse,a),a.headers=sn.from(a.headers),a},function(a){return MO(a)||(bp(e),a&&a.response&&(a.response.data=gp.call(e,e.transformResponse,a.response),a.response.headers=sn.from(a.response.headers))),Promise.reject(a)})}const zO="1.12.2",Cu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Cu[e]=function(a){return typeof a===e||"a"+(t<1?"n ":" ")+e}});const YA={};Cu.transitional=function(t,n,a){function o(l,u){return"[Axios v"+zO+"] Transitional option '"+l+"'"+u+(a?". "+a:"")}return(l,u,d)=>{if(t===!1)throw new Ae(o(u," has been removed"+(n?" in "+n:"")),Ae.ERR_DEPRECATED);return n&&!YA[u]&&(YA[u]=!0,console.warn(o(u," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(l,u,d):!0}};Cu.spelling=function(t){return(n,a)=>(console.warn(`${a} is likely a misspelling of ${t}`),!0)};function tP(e,t,n){if(typeof e!="object")throw new Ae("options must be an object",Ae.ERR_BAD_OPTION_VALUE);const a=Object.keys(e);let o=a.length;for(;o-- >0;){const l=a[o],u=t[l];if(u){const d=e[l],p=d===void 0||u(d,l,e);if(p!==!0)throw new Ae("option "+l+" must be "+p,Ae.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ae("Unknown option "+l,Ae.ERR_BAD_OPTION)}}const Ql={assertOptions:tP,validators:Cu},Zn=Ql.validators;let Da=class{constructor(t){this.defaults=t||{},this.interceptors={request:new MA,response:new MA}}async request(t,n){try{return await this._request(t,n)}catch(a){if(a instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const l=o.stack?o.stack.replace(/^.+\n/,""):"";try{a.stack?l&&!String(a.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(a.stack+=`
276
- `+l):a.stack=l}catch{}}throw a}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Pa(this.defaults,n);const{transitional:a,paramsSerializer:o,headers:l}=n;a!==void 0&&Ql.assertOptions(a,{silentJSONParsing:Zn.transitional(Zn.boolean),forcedJSONParsing:Zn.transitional(Zn.boolean),clarifyTimeoutError:Zn.transitional(Zn.boolean)},!1),o!=null&&(X.isFunction(o)?n.paramsSerializer={serialize:o}:Ql.assertOptions(o,{encode:Zn.function,serialize:Zn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ql.assertOptions(n,{baseUrl:Zn.spelling("baseURL"),withXsrfToken:Zn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&X.merge(l.common,l[n.method]);l&&X.forEach(["delete","get","head","post","put","patch","common"],v=>{delete l[v]}),n.headers=sn.concat(u,l);const d=[];let p=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(n)===!1||(p=p&&T.synchronous,d.unshift(T.fulfilled,T.rejected))});const f=[];this.interceptors.response.forEach(function(T){f.push(T.fulfilled,T.rejected)});let h,m=0,y;if(!p){const v=[VA.bind(this),void 0];for(v.unshift(...d),v.push(...f),y=v.length,h=Promise.resolve(n);m<y;)h=h.then(v[m++],v[m++]);return h}y=d.length;let E=n;for(;m<y;){const v=d[m++],T=d[m++];try{E=v(E)}catch(R){T.call(this,R);break}}try{h=VA.call(this,E)}catch(v){return Promise.reject(v)}for(m=0,y=f.length;m<y;)h=h.then(f[m++],f[m++]);return h}getUri(t){t=Pa(this.defaults,t);const n=FO(t.baseURL,t.url,t.allowAbsoluteUrls);return IO(n,t.params,t.paramsSerializer)}};X.forEach(["delete","get","head","options"],function(t){Da.prototype[t]=function(n,a){return this.request(Pa(a||{},{method:t,url:n,data:(a||{}).data}))}});X.forEach(["post","put","patch"],function(t){function n(a){return function(l,u,d){return this.request(Pa(d||{},{method:t,headers:a?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}Da.prototype[t]=n(),Da.prototype[t+"Form"]=n(!0)});let nP=class qO{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const a=this;this.promise.then(o=>{if(!a._listeners)return;let l=a._listeners.length;for(;l-- >0;)a._listeners[l](o);a._listeners=null}),this.promise.then=o=>{let l;const u=new Promise(d=>{a.subscribe(d),l=d}).then(o);return u.cancel=function(){a.unsubscribe(l)},u},t(function(l,u,d){a.reason||(a.reason=new Yi(l,u,d),n(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=a=>{t.abort(a)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new qO(function(o){t=o}),cancel:t}}};function rP(e){return function(n){return e.apply(null,n)}}function aP(e){return X.isObject(e)&&e.isAxiosError===!0}const My={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(My).forEach(([e,t])=>{My[t]=e});function GO(e){const t=new Da(e),n=EO(Da.prototype.request,t);return X.extend(n,Da.prototype,t,{allOwnKeys:!0}),X.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return GO(Pa(e,o))},n}const dt=GO(gs);dt.Axios=Da;dt.CanceledError=Yi;dt.CancelToken=nP;dt.isCancel=MO;dt.VERSION=zO;dt.toFormData=ku;dt.AxiosError=Ae;dt.Cancel=dt.CanceledError;dt.all=function(t){return Promise.all(t)};dt.spread=rP;dt.isAxiosError=aP;dt.mergeConfig=Pa;dt.AxiosHeaders=sn;dt.formToJSON=e=>DO(X.isHTMLForm(e)?new FormData(e):e);dt.getAdapter=jO.getAdapter;dt.HttpStatusCode=My;dt.default=dt;const{Axios:jK,AxiosError:zK,CanceledError:qK,isCancel:GK,CancelToken:HK,VERSION:$K,all:VK,Cancel:YK,isAxiosError:WK,spread:KK,toFormData:XK,AxiosHeaders:ZK,HttpStatusCode:QK,formToJSON:JK,getAdapter:e7,mergeConfig:t7}=dt,iP=({onRequest:e,onSseError:t,onSseEvent:n,responseTransformer:a,responseValidator:o,sseDefaultRetryDelay:l,sseMaxRetryAttempts:u,sseMaxRetryDelay:d,sseSleepFn:p,url:f,...h})=>{let m;const y=p??(T=>new Promise(R=>setTimeout(R,T)));return{stream:async function*(){let T=l??3e3,R=0;const A=h.signal??new AbortController().signal;for(;!A.aborted;){R++;const _=h.headers instanceof Headers?h.headers:new Headers(h.headers);m!==void 0&&_.set("Last-Event-ID",m);try{const w={redirect:"follow",...h,body:h.serializedBody,headers:_,signal:A};let O=new Request(f,w);e&&(O=await e(f,w));const N=await(h.fetch??globalThis.fetch)(O);if(!N.ok)throw new Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw new Error("No body in SSE response");const I=N.body.pipeThrough(new TextDecoderStream).getReader();let P="";const B=()=>{try{I.cancel()}catch{}};A.addEventListener("abort",B);try{for(;;){const{done:M,value:H}=await I.read();if(M)break;P+=H;const K=P.split(`
276
+ `+l):a.stack=l}catch{}}throw a}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Pa(this.defaults,n);const{transitional:a,paramsSerializer:o,headers:l}=n;a!==void 0&&Ql.assertOptions(a,{silentJSONParsing:Zn.transitional(Zn.boolean),forcedJSONParsing:Zn.transitional(Zn.boolean),clarifyTimeoutError:Zn.transitional(Zn.boolean)},!1),o!=null&&(X.isFunction(o)?n.paramsSerializer={serialize:o}:Ql.assertOptions(o,{encode:Zn.function,serialize:Zn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ql.assertOptions(n,{baseUrl:Zn.spelling("baseURL"),withXsrfToken:Zn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&X.merge(l.common,l[n.method]);l&&X.forEach(["delete","get","head","post","put","patch","common"],v=>{delete l[v]}),n.headers=sn.concat(u,l);const d=[];let p=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(n)===!1||(p=p&&T.synchronous,d.unshift(T.fulfilled,T.rejected))});const f=[];this.interceptors.response.forEach(function(T){f.push(T.fulfilled,T.rejected)});let h,m=0,y;if(!p){const v=[VA.bind(this),void 0];for(v.unshift(...d),v.push(...f),y=v.length,h=Promise.resolve(n);m<y;)h=h.then(v[m++],v[m++]);return h}y=d.length;let E=n;for(;m<y;){const v=d[m++],T=d[m++];try{E=v(E)}catch(R){T.call(this,R);break}}try{h=VA.call(this,E)}catch(v){return Promise.reject(v)}for(m=0,y=f.length;m<y;)h=h.then(f[m++],f[m++]);return h}getUri(t){t=Pa(this.defaults,t);const n=FO(t.baseURL,t.url,t.allowAbsoluteUrls);return IO(n,t.params,t.paramsSerializer)}};X.forEach(["delete","get","head","options"],function(t){Da.prototype[t]=function(n,a){return this.request(Pa(a||{},{method:t,url:n,data:(a||{}).data}))}});X.forEach(["post","put","patch"],function(t){function n(a){return function(l,u,d){return this.request(Pa(d||{},{method:t,headers:a?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}Da.prototype[t]=n(),Da.prototype[t+"Form"]=n(!0)});let nP=class qO{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const a=this;this.promise.then(o=>{if(!a._listeners)return;let l=a._listeners.length;for(;l-- >0;)a._listeners[l](o);a._listeners=null}),this.promise.then=o=>{let l;const u=new Promise(d=>{a.subscribe(d),l=d}).then(o);return u.cancel=function(){a.unsubscribe(l)},u},t(function(l,u,d){a.reason||(a.reason=new Yi(l,u,d),n(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=a=>{t.abort(a)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new qO(function(o){t=o}),cancel:t}}};function rP(e){return function(n){return e.apply(null,n)}}function aP(e){return X.isObject(e)&&e.isAxiosError===!0}const My={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(My).forEach(([e,t])=>{My[t]=e});function GO(e){const t=new Da(e),n=EO(Da.prototype.request,t);return X.extend(n,Da.prototype,t,{allOwnKeys:!0}),X.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return GO(Pa(e,o))},n}const dt=GO(gs);dt.Axios=Da;dt.CanceledError=Yi;dt.CancelToken=nP;dt.isCancel=MO;dt.VERSION=zO;dt.toFormData=ku;dt.AxiosError=Ae;dt.Cancel=dt.CanceledError;dt.all=function(t){return Promise.all(t)};dt.spread=rP;dt.isAxiosError=aP;dt.mergeConfig=Pa;dt.AxiosHeaders=sn;dt.formToJSON=e=>DO(X.isHTMLForm(e)?new FormData(e):e);dt.getAdapter=jO.getAdapter;dt.HttpStatusCode=My;dt.default=dt;const{Axios:zK,AxiosError:qK,CanceledError:GK,isCancel:HK,CancelToken:$K,VERSION:VK,all:YK,Cancel:WK,isAxiosError:KK,spread:XK,toFormData:ZK,AxiosHeaders:QK,HttpStatusCode:JK,formToJSON:e7,getAdapter:t7,mergeConfig:n7}=dt,iP=({onRequest:e,onSseError:t,onSseEvent:n,responseTransformer:a,responseValidator:o,sseDefaultRetryDelay:l,sseMaxRetryAttempts:u,sseMaxRetryDelay:d,sseSleepFn:p,url:f,...h})=>{let m;const y=p??(T=>new Promise(R=>setTimeout(R,T)));return{stream:async function*(){let T=l??3e3,R=0;const A=h.signal??new AbortController().signal;for(;!A.aborted;){R++;const _=h.headers instanceof Headers?h.headers:new Headers(h.headers);m!==void 0&&_.set("Last-Event-ID",m);try{const w={redirect:"follow",...h,body:h.serializedBody,headers:_,signal:A};let O=new Request(f,w);e&&(O=await e(f,w));const N=await(h.fetch??globalThis.fetch)(O);if(!N.ok)throw new Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw new Error("No body in SSE response");const I=N.body.pipeThrough(new TextDecoderStream).getReader();let P="";const B=()=>{try{I.cancel()}catch{}};A.addEventListener("abort",B);try{for(;;){const{done:M,value:H}=await I.read();if(M)break;P+=H;const K=P.split(`
277
277
 
278
278
  `);P=K.pop()??"";for(const ne of K){const te=ne.split(`
279
279
  `),ue=[];let q;for(const pe of te)if(pe.startsWith("data:"))ue.push(pe.replace(/^data:\s*/,""));else if(pe.startsWith("event:"))q=pe.replace(/^event:\s*/,"");else if(pe.startsWith("id:"))m=pe.replace(/^id:\s*/,"");else if(pe.startsWith("retry:")){const L=Number.parseInt(pe.replace(/^retry:\s*/,""),10);Number.isNaN(L)||(T=L)}let ee,ae=!1;if(ue.length){const pe=ue.join(`
@@ -383,4 +383,4 @@ ${p?.absPath||""}`,children:n}),a&&S.jsx("span",{className:"text-xs px-2 py-0.5
383
383
  *
384
384
  * This source code is licensed under the ISC license.
385
385
  * See the LICENSE file in the root directory of this source tree.
386
- */const bK=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],yK=Xi("x",bK),SK=G.memo(function({theme:t,onToggleTheme:n}){const a=ra(o=>o.toggleCollapse);return S.jsxs("header",{className:"h-14 border-b border-border bg-background px-4 flex items-center justify-between relative z-30",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Et,{variant:"ghost",size:"icon",onClick:a,className:"md:hidden touch-manipulation",title:"Toggle menu","aria-label":"Toggle menu",children:S.jsx(dK,{className:"w-5 h-5"})}),S.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"AGI"})]}),S.jsx("div",{className:"flex items-center gap-2",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:n,title:`Switch to ${t==="dark"?"light":"dark"} mode`,"aria-label":`Switch to ${t==="dark"?"light":"dark"} mode`,className:"touch-manipulation",children:t==="dark"?S.jsx(gK,{className:"w-4 h-4"}):S.jsx(fK,{className:"w-4 h-4"})})})]})}),EK=G.memo(function({children:t,onNewSession:n}){const a=xn(u=>u.isDiffOpen),o=ra(u=>u.isCollapsed),l=ra(u=>u.toggleCollapse);return G.useEffect(()=>(o?document.body.style.overflow="":document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[o]),o?S.jsxs("aside",{className:"w-12 md:w-12 border-r border-border bg-background flex flex-col transition-all duration-300 ease-in-out hidden md:flex",children:[S.jsx("div",{className:"h-14 border-b border-border flex items-center justify-center",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:n,title:"New session",className:"rounded-full touch-manipulation",children:S.jsx(D0,{className:"w-4 h-4"})})}),S.jsx("button",{type:"button",className:"flex-1 cursor-pointer hover:bg-muted/50 transition-colors touch-manipulation",onClick:a?void 0:l,title:a?void 0:"Expand sidebar","aria-label":"Expand sidebar"}),S.jsx("div",{className:"border-t border-border p-2 flex items-center justify-center",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Expand sidebar",disabled:a,className:"transition-transform duration-200 hover:scale-110 touch-manipulation",children:S.jsx(uK,{className:"w-4 h-4"})})})]}):S.jsxs(S.Fragment,{children:[!o&&S.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 md:hidden",onClick:l,"aria-hidden":"true"}),S.jsxs("aside",{className:"w-full md:w-64 border-r border-border bg-background flex flex-col transition-all duration-300 ease-in-out fixed md:relative top-0 left-0 z-50 h-screen md:h-auto",children:[S.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center gap-2 md:hidden bg-background",children:[S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Close menu",className:"touch-manipulation flex-shrink-0","aria-label":"Close menu",children:S.jsx(yK,{className:"w-5 h-5"})}),S.jsx("h1",{className:"text-lg font-semibold text-foreground flex-1",children:"AGI"})]}),S.jsx("div",{className:"h-14 border-b border-border px-4 flex items-center gap-2",children:S.jsxs(Et,{variant:"primary",size:"sm",onClick:n,className:"flex-1 touch-manipulation",children:[S.jsx(D0,{className:"w-4 h-4 mr-2"}),"New Session"]})}),S.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide",children:t}),S.jsx("div",{className:"border-t border-border p-2 flex items-center justify-end",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Collapse sidebar",disabled:a,className:"transition-transform duration-200 hover:scale-110 touch-manipulation",children:S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform duration-300",role:"img","aria-label":"Collapse sidebar",children:[S.jsx("title",{children:"Collapse sidebar"}),S.jsx("path",{d:"M15 18l-6-6 6-6"})]})})})]})]})}),vK=G.memo(function({sidebar:t,children:n,onNewSession:a,theme:o,onToggleTheme:l}){return S.jsxs("div",{className:"h-screen flex flex-col bg-background touch-manipulation",children:[S.jsx(SK,{onToggleTheme:l,theme:o}),S.jsxs("div",{className:"flex-1 flex overflow-hidden relative",children:[S.jsx(EK,{onNewSession:a,children:t}),S.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden relative w-full md:w-auto",children:[S.jsx(tK,{}),n]}),S.jsxs("div",{className:"hidden md:block",children:[S.jsx(ZW,{}),S.jsx(XW,{})]})]}),S.jsx(nK,{})]})}),x1="agi-theme",M0="dark";function xK(){if(typeof window>"u")return M0;const e=window.localStorage.getItem(x1);return e==="light"||e==="dark"?e:M0}function TK(){const[e,t]=G.useState(()=>xK());G.useEffect(()=>{if(typeof document>"u")return;const a=document.documentElement;e==="dark"?a.classList.add("dark"):a.classList.remove("dark");try{window.localStorage.setItem(x1,e)}catch(o){console.warn("Failed to persist theme preference",o)}},[e]);const n=G.useCallback(()=>{t(a=>a==="dark"?"light":"dark")},[]);return G.useMemo(()=>({theme:e,setTheme:t,toggleTheme:n}),[e,n])}function AK(){const[e,t]=G.useState(null);return G.useEffect(()=>{(async()=>{try{const l=`${window.AGI_SERVER_URL||gS}/v1/config/cwd`;console.log("[useWorkingDirectory] Fetching from:",l);const u=await fetch(l);if(!u.ok)throw console.error("[useWorkingDirectory] Failed:",u.status,u.statusText),new Error(`Failed to fetch working directory: ${u.status}`);const d=await u.json();console.log("[useWorkingDirectory] Success:",d),d.dirName&&(console.log("[useWorkingDirectory] Setting title to:",d.dirName),t(d.dirName),document.title=d.dirName)}catch(a){console.error("[useWorkingDirectory] Error:",a),document.title="AGI"}})()},[]),e}function T1({sessionId:e}){const t=G.useRef(null),n=IW(),{theme:a,toggleTheme:o}=TK(),l=ra(m=>m.setCollapsed),u=Au();AK();const d=G.useCallback(()=>{setTimeout(()=>{t.current?.focus()},100)},[]),p=G.useCallback(async()=>{try{const m=await n.mutateAsync({agent:"general"});u({to:"/sessions/$sessionId",params:{sessionId:m.id},replace:!1}),l(!0),d()}catch(m){console.error("Failed to create session:",m)}},[n,u,l,d]),f=G.useCallback(m=>{u({to:"/sessions/$sessionId",params:{sessionId:m}}),l(!0),d()},[u,l,d]);G.useEffect(()=>{e&&d()},[e,d]);const h=G.useMemo(()=>e?S.jsxs(S.Fragment,{children:[S.jsx(LW,{sessionId:e}),S.jsx(HP,{ref:t,sessionId:e})]}):S.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a session or create a new one to start"}),[e]);return S.jsx(vK,{onNewSession:p,theme:a,onToggleTheme:o,sidebar:S.jsx(MW,{activeSessionId:e,onSelectSession:f}),children:h})}const RK=ss("/sessions/")({component:wK});function wK(){return S.jsx(T1,{})}const A1=ss("/sessions/$sessionId")({component:_K});function _K(){const{sessionId:e}=A1.useParams();return S.jsx(T1,{sessionId:e})}const NK=bU.update({id:"/",path:"/",getParentRoute:()=>Ru}),kK=RK.update({id:"/sessions/",path:"/sessions/",getParentRoute:()=>Ru}),CK=A1.update({id:"/sessions/$sessionId",path:"/sessions/$sessionId",getParentRoute:()=>Ru}),OK={IndexRoute:NK,SessionsSessionIdRoute:CK,SessionsIndexRoute:kK},IK=Ru._addFileChildren(OK)._addFileTypes(),LK=pU({routeTree:IK}),DK=new mM({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,structuralSharing:!0}}});function MK(){return S.jsx(gM,{client:DK,children:S.jsx(mU,{router:LK})})}const R1=document.getElementById("root");if(!R1)throw new Error("Root element not found");VD.createRoot(R1).render(S.jsx(G.StrictMode,{children:S.jsx(MK,{})}));
386
+ */const bK=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],yK=Xi("x",bK),SK=G.memo(function({theme:t,onToggleTheme:n}){const a=ra(o=>o.toggleCollapse);return S.jsxs("header",{className:"h-14 border-b border-border bg-background px-4 flex items-center justify-between relative z-30",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Et,{variant:"ghost",size:"icon",onClick:a,className:"md:hidden touch-manipulation",title:"Toggle menu","aria-label":"Toggle menu",children:S.jsx(dK,{className:"w-5 h-5"})}),S.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"AGI"})]}),S.jsx("div",{className:"flex items-center gap-2",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:n,title:`Switch to ${t==="dark"?"light":"dark"} mode`,"aria-label":`Switch to ${t==="dark"?"light":"dark"} mode`,className:"touch-manipulation",children:t==="dark"?S.jsx(gK,{className:"w-4 h-4"}):S.jsx(fK,{className:"w-4 h-4"})})})]})}),EK=G.memo(function({children:t,onNewSession:n}){const a=xn(u=>u.isDiffOpen),o=ra(u=>u.isCollapsed),l=ra(u=>u.toggleCollapse);return G.useEffect(()=>(o?document.body.style.overflow="":document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[o]),o?S.jsxs("aside",{className:"w-12 md:w-12 border-r border-border bg-background flex flex-col transition-all duration-300 ease-in-out hidden md:flex",children:[S.jsx("div",{className:"h-14 border-b border-border flex items-center justify-center",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:n,title:"New session",className:"rounded-full touch-manipulation",children:S.jsx(D0,{className:"w-4 h-4"})})}),S.jsx("button",{type:"button",className:"flex-1 cursor-pointer hover:bg-muted/50 transition-colors touch-manipulation",onClick:a?void 0:l,title:a?void 0:"Expand sidebar","aria-label":"Expand sidebar"}),S.jsx("div",{className:"border-t border-border p-2 flex items-center justify-center",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Expand sidebar",disabled:a,className:"transition-transform duration-200 hover:scale-110 touch-manipulation",children:S.jsx(uK,{className:"w-4 h-4"})})})]}):S.jsxs(S.Fragment,{children:[!o&&S.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 md:hidden",onClick:l,"aria-hidden":"true"}),S.jsxs("aside",{className:"w-full md:w-64 border-r border-border bg-background flex flex-col transition-all duration-300 ease-in-out fixed md:relative top-0 left-0 z-50 h-screen md:h-auto",children:[S.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center gap-2 md:hidden bg-background",children:[S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Close menu",className:"touch-manipulation flex-shrink-0","aria-label":"Close menu",children:S.jsx(yK,{className:"w-5 h-5"})}),S.jsx("h1",{className:"text-lg font-semibold text-foreground flex-1",children:"AGI"})]}),S.jsx("div",{className:"h-14 border-b border-border px-4 flex items-center gap-2",children:S.jsxs(Et,{variant:"primary",size:"sm",onClick:n,className:"flex-1 touch-manipulation",children:[S.jsx(D0,{className:"w-4 h-4 mr-2"}),"New Session"]})}),S.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide",children:t}),S.jsx("div",{className:"border-t border-border p-2 flex items-center justify-end",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Collapse sidebar",disabled:a,className:"transition-transform duration-200 hover:scale-110 touch-manipulation",children:S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform duration-300",role:"img","aria-label":"Collapse sidebar",children:[S.jsx("title",{children:"Collapse sidebar"}),S.jsx("path",{d:"M15 18l-6-6 6-6"})]})})})]})]})}),vK=G.memo(function({sidebar:t,children:n,onNewSession:a,theme:o,onToggleTheme:l}){return S.jsxs("div",{className:"h-screen flex flex-col bg-background touch-manipulation",children:[S.jsx(SK,{onToggleTheme:l,theme:o}),S.jsxs("div",{className:"flex-1 flex overflow-hidden relative",children:[S.jsx(EK,{onNewSession:a,children:t}),S.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden relative w-full md:w-auto",children:[S.jsx(tK,{}),n]}),S.jsxs("div",{className:"hidden md:block",children:[S.jsx(ZW,{}),S.jsx(XW,{})]})]}),S.jsx(nK,{})]})}),x1="agi-theme",M0="dark";function xK(){if(typeof window>"u")return M0;const e=window.localStorage.getItem(x1);return e==="light"||e==="dark"?e:M0}function TK(){const[e,t]=G.useState(()=>xK());G.useEffect(()=>{if(typeof document>"u")return;const a=document.documentElement;e==="dark"?a.classList.add("dark"):a.classList.remove("dark");try{window.localStorage.setItem(x1,e)}catch(o){console.warn("Failed to persist theme preference",o)}},[e]);const n=G.useCallback(()=>{t(a=>a==="dark"?"light":"dark")},[]);return G.useMemo(()=>({theme:e,setTheme:t,toggleTheme:n}),[e,n])}function AK(){const[e,t]=G.useState(null);return G.useEffect(()=>{(async()=>{try{const l=`${window.AGI_SERVER_URL||gS}/v1/config/cwd`;console.log("[useWorkingDirectory] Fetching from:",l);const u=await fetch(l);if(!u.ok)throw console.error("[useWorkingDirectory] Failed:",u.status,u.statusText),new Error(`Failed to fetch working directory: ${u.status}`);const d=await u.json();console.log("[useWorkingDirectory] Success:",d),d.dirName&&(console.log("[useWorkingDirectory] Setting title to:",d.dirName),t(d.dirName),document.title=d.dirName)}catch(a){console.error("[useWorkingDirectory] Error:",a),document.title="AGI"}})()},[]),e}function T1({sessionId:e}){const t=G.useRef(null),n=IW(),{theme:a,toggleTheme:o}=TK(),l=ra(m=>m.setCollapsed),u=Au();AK();const d=G.useCallback(()=>{setTimeout(()=>{t.current?.focus()},100)},[]),p=G.useCallback(async()=>{try{const m=await n.mutateAsync({agent:"general"});u({to:"/sessions/$sessionId",params:{sessionId:m.id},replace:!1}),l(!0),d()}catch(m){console.error("Failed to create session:",m)}},[n,u,l,d]),f=G.useCallback(m=>{u({to:"/sessions/$sessionId",params:{sessionId:m}}),l(!0),d()},[u,l,d]);G.useEffect(()=>{e&&d()},[e,d]);const h=G.useMemo(()=>e?S.jsxs(S.Fragment,{children:[S.jsx(LW,{sessionId:e}),S.jsx(HP,{ref:t,sessionId:e})]}):S.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a session or create a new one to start"}),[e]);return S.jsx(vK,{onNewSession:p,theme:a,onToggleTheme:o,sidebar:S.jsx(MW,{activeSessionId:e,onSelectSession:f}),children:h})}const RK=ss("/sessions/")({component:wK});function wK(){return S.jsx(T1,{})}const A1=ss("/sessions/$sessionId")({component:_K});function _K(){const{sessionId:e}=A1.useParams();return S.jsx(T1,{sessionId:e})}const NK=bU.update({id:"/",path:"/",getParentRoute:()=>Ru}),kK=RK.update({id:"/sessions/",path:"/sessions/",getParentRoute:()=>Ru}),CK=A1.update({id:"/sessions/$sessionId",path:"/sessions/$sessionId",getParentRoute:()=>Ru}),OK={IndexRoute:NK,SessionsSessionIdRoute:CK,SessionsIndexRoute:kK},IK=Ru._addFileChildren(OK)._addFileTypes(),LK=()=>{const n=(typeof globalThis<"u"?globalThis.AGI_ROUTER_BASEPATH:void 0)??"/"??"/";if(!n||n==="/")return"/";const a=n.replace(/\/+$/,"")||"/";return a.startsWith("/")?a:`/${a}`},DK=pU({routeTree:IK,basepath:LK()}),MK=new mM({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,structuralSharing:!0}}});function UK(){return S.jsx(gM,{client:MK,children:S.jsx(mU,{router:DK})})}const R1=document.getElementById("root");if(!R1)throw new Error("Root element not found");VD.createRoot(R1).render(S.jsx(G.StrictMode,{children:S.jsx(UK,{})}));
@@ -8,7 +8,7 @@
8
8
  <meta name="apple-mobile-web-app-capable" content="yes" />
9
9
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
10
10
  <title>Loading...</title>
11
- <script type="module" crossorigin src="/assets/index-BNPAVL6y.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-BzXNYcbS.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-DIVb-yh8.css">
13
13
  </head>
14
14
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agi-cli/web-ui",
3
- "version": "0.1.69",
3
+ "version": "0.1.70",
4
4
  "description": "Embeddable web UI for AGI CLI - pre-built static assets",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",