@linzumi/cli 1.0.310 → 1.0.312

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.
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __linzumiBundleCreateRequire } from 'node:module';
2
2
  const require = __linzumiBundleCreateRequire(import.meta.url);
3
- var Y_=Object.create;var Pa=Object.defineProperty;var X_=Object.getOwnPropertyDescriptor;var eh=Object.getOwnPropertyNames;var th=Object.getPrototypeOf,nh=Object.prototype.hasOwnProperty;var re=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),rh=(e,t)=>{for(var n in t)Pa(e,n,{get:t[n],enumerable:!0})},ih=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eh(t))!nh.call(e,i)&&i!==n&&Pa(e,i,{get:()=>t[i],enumerable:!(r=X_(t,i))||r.enumerable});return e};var bt=(e,t,n)=>(n=e!=null?Y_(th(e)):{},ih(t||!e||!e.__esModule?Pa(n,"default",{value:e,enumerable:!0}):n,e));var Ra=_(()=>{});function se(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function er(e){if(e!=null)return se(e)}function N(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}var D=_(()=>{});function $t(e,t){if(e!==void 0)return t(N(e))}function xe(e,t,n){return e!==void 0?n(N(e)):t}function H(e,t){if(e!==void 0)return se(t(N(e)))}function oe(e,t){if(e!==void 0)return t(N(e))}function j(e,t){return e!==void 0?N(e):t}var w=_(()=>{Ra();D()});var Wi=_(()=>{});function ce(e,t,n){return e.reduce(n,t)}var X=_(()=>{Wi();D()});function St(e){if(e.RE_EXN_ID==="JsExn")return se(e._1)}var Hi,ah,vt,Ck,Ok,Ft=_(()=>{D();Hi=(e=>t=>t&&typeof t[e]=="string"?t[e]:void 0),ah=Hi("stack"),vt=Hi("message"),Ck=Hi("name"),Ok=Hi("fileName")});var tr=_(()=>{});var fl=le((Ek,cl)=>{var an=re("constants"),sh=process.cwd,Vi=null,dh=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Vi||(Vi=sh.call(process)),Vi};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Ma=process.chdir,process.chdir=function(e){Vi=null,Ma.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Ma));var Ma;cl.exports=lh;function lh(e){an.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=r(e.chmod),e.fchmod=r(e.fchmod),e.lchmod=r(e.lchmod),e.chownSync=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=i(e.chmodSync),e.fchmodSync=i(e.fchmodSync),e.lchmodSync=i(e.lchmodSync),e.stat=s(e.stat),e.fstat=s(e.fstat),e.lstat=s(e.lstat),e.statSync=l(e.statSync),e.fstatSync=l(e.fstatSync),e.lstatSync=l(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(d,m,p){p&&process.nextTick(p)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(d,m,p,f){f&&process.nextTick(f)},e.lchownSync=function(){}),dh==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(d){function m(p,f,h){var c=Date.now(),y=0;d(p,f,function b(T){if(T&&(T.code==="EACCES"||T.code==="EPERM"||T.code==="EBUSY")&&Date.now()-c<6e4){setTimeout(function(){e.stat(f,function(v,g){v&&v.code==="ENOENT"?d(p,f,b):h(T)})},y),y<100&&(y+=10);return}h&&h(T)})}return Object.setPrototypeOf&&Object.setPrototypeOf(m,d),m})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(d){function m(p,f,h,c,y,b){var T;if(b&&typeof b=="function"){var v=0;T=function(g,R,M){if(g&&g.code==="EAGAIN"&&v<10)return v++,d.call(e,p,f,h,c,y,T);b.apply(this,arguments)}}return d.call(e,p,f,h,c,y,T)}return Object.setPrototypeOf&&Object.setPrototypeOf(m,d),m})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(d){return function(m,p,f,h,c){for(var y=0;;)try{return d.call(e,m,p,f,h,c)}catch(b){if(b.code==="EAGAIN"&&y<10){y++;continue}throw b}}})(e.readSync);function t(d){d.lchmod=function(m,p,f){d.open(m,an.O_WRONLY|an.O_SYMLINK,p,function(h,c){if(h){f&&f(h);return}d.fchmod(c,p,function(y){d.close(c,function(b){f&&f(y||b)})})})},d.lchmodSync=function(m,p){var f=d.openSync(m,an.O_WRONLY|an.O_SYMLINK,p),h=!0,c;try{c=d.fchmodSync(f,p),h=!1}finally{if(h)try{d.closeSync(f)}catch{}else d.closeSync(f)}return c}}function n(d){an.hasOwnProperty("O_SYMLINK")&&d.futimes?(d.lutimes=function(m,p,f,h){d.open(m,an.O_SYMLINK,function(c,y){if(c){h&&h(c);return}d.futimes(y,p,f,function(b){d.close(y,function(T){h&&h(b||T)})})})},d.lutimesSync=function(m,p,f){var h=d.openSync(m,an.O_SYMLINK),c,y=!0;try{c=d.futimesSync(h,p,f),y=!1}finally{if(y)try{d.closeSync(h)}catch{}else d.closeSync(h)}return c}):d.futimes&&(d.lutimes=function(m,p,f,h){h&&process.nextTick(h)},d.lutimesSync=function(){})}function r(d){return d&&function(m,p,f){return d.call(e,m,p,function(h){u(h)&&(h=null),f&&f.apply(this,arguments)})}}function i(d){return d&&function(m,p){try{return d.call(e,m,p)}catch(f){if(!u(f))throw f}}}function o(d){return d&&function(m,p,f,h){return d.call(e,m,p,f,function(c){u(c)&&(c=null),h&&h.apply(this,arguments)})}}function a(d){return d&&function(m,p,f){try{return d.call(e,m,p,f)}catch(h){if(!u(h))throw h}}}function s(d){return d&&function(m,p,f){typeof p=="function"&&(f=p,p=null);function h(c,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),f&&f.apply(this,arguments)}return p?d.call(e,m,p,h):d.call(e,m,h)}}function l(d){return d&&function(m,p){var f=p?d.call(e,m,p):d.call(e,m);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function u(d){if(!d||d.code==="ENOSYS")return!0;var m=!process.getuid||process.getuid()!==0;return!!(m&&(d.code==="EINVAL"||d.code==="EPERM"))}}});var _l=le((Pk,pl)=>{var ml=re("stream").Stream;pl.exports=uh;function uh(e){return{ReadStream:t,WriteStream:n};function t(r,i){if(!(this instanceof t))return new t(r,i);ml.call(this);var o=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var a=Object.keys(i),s=0,l=a.length;s<l;s++){var u=a[s];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}e.open(this.path,this.flags,this.mode,function(d,m){if(d){o.emit("error",d),o.readable=!1;return}o.fd=m,o.emit("open",m),o._read()})}function n(r,i){if(!(this instanceof n))return new n(r,i);ml.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),a=0,s=o.length;a<s;a++){var l=o[a];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var yl=le((Rk,hl)=>{"use strict";hl.exports=fh;var ch=Object.getPrototypeOf||function(e){return e.__proto__};function fh(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:ch(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}});var $a=le((Ik,ja)=>{var he=re("fs"),mh=fl(),ph=_l(),_h=yl(),Qi=re("util"),Ne,Yi;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ne=Symbol.for("graceful-fs.queue"),Yi=Symbol.for("graceful-fs.previous")):(Ne="___graceful-fs.queue",Yi="___graceful-fs.previous");function hh(){}function Sl(e,t){Object.defineProperty(e,Ne,{get:function(){return t}})}var On=hh;Qi.debuglog?On=Qi.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(On=function(){var e=Qi.format.apply(Qi,arguments);e="GFS4: "+e.split(/\n/).join(`
4
- GFS4: `),console.error(e)});he[Ne]||(gl=global[Ne]||[],Sl(he,gl),he.close=(function(e){function t(n,r){return e.call(he,n,function(i){i||bl(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(t,Yi,{value:e}),t})(he.close),he.closeSync=(function(e){function t(n){e.apply(he,arguments),bl()}return Object.defineProperty(t,Yi,{value:e}),t})(he.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){On(he[Ne]),re("assert").equal(he[Ne].length,0)}));var gl;global[Ne]||Sl(global,he[Ne]);ja.exports=Ga(_h(he));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!he.__patched&&(ja.exports=Ga(he),he.__patched=!0);function Ga(e){mh(e),e.gracefulify=Ga,e.createReadStream=R,e.createWriteStream=M;var t=e.readFile;e.readFile=n;function n(A,q,$){return typeof q=="function"&&($=q,q=null),Se(A,q,$);function Se(G,k,S,E){return t(G,k,function(P){P&&(P.code==="EMFILE"||P.code==="ENFILE")?nr([Se,[G,k,S],P,E||Date.now(),Date.now()]):typeof S=="function"&&S.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=i;function i(A,q,$,Se){return typeof $=="function"&&(Se=$,$=null),G(A,q,$,Se);function G(k,S,E,P,x){return r(k,S,E,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?nr([G,[k,S,E,P],C,x||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=a);function a(A,q,$,Se){return typeof $=="function"&&(Se=$,$=null),G(A,q,$,Se);function G(k,S,E,P,x){return o(k,S,E,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?nr([G,[k,S,E,P],C,x||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var s=e.copyFile;s&&(e.copyFile=l);function l(A,q,$,Se){return typeof $=="function"&&(Se=$,$=0),G(A,q,$,Se);function G(k,S,E,P,x){return s(k,S,E,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?nr([G,[k,S,E,P],C,x||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var u=e.readdir;e.readdir=m;var d=/^v[0-5]\./;function m(A,q,$){typeof q=="function"&&($=q,q=null);var Se=d.test(process.version)?function(S,E,P,x){return u(S,G(S,E,P,x))}:function(S,E,P,x){return u(S,E,G(S,E,P,x))};return Se(A,q,$);function G(k,S,E,P){return function(x,C){x&&(x.code==="EMFILE"||x.code==="ENFILE")?nr([Se,[k,S,E],x,P||Date.now(),Date.now()]):(C&&C.sort&&C.sort(),typeof E=="function"&&E.call(this,x,C))}}}if(process.version.substr(0,4)==="v0.8"){var p=ph(e);b=p.ReadStream,v=p.WriteStream}var f=e.ReadStream;f&&(b.prototype=Object.create(f.prototype),b.prototype.open=T);var h=e.WriteStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=g),Object.defineProperty(e,"ReadStream",{get:function(){return b},set:function(A){b=A},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(A){v=A},enumerable:!0,configurable:!0});var c=b;Object.defineProperty(e,"FileReadStream",{get:function(){return c},set:function(A){c=A},enumerable:!0,configurable:!0});var y=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return y},set:function(A){y=A},enumerable:!0,configurable:!0});function b(A,q){return this instanceof b?(f.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function T(){var A=this;be(A.path,A.flags,A.mode,function(q,$){q?(A.autoClose&&A.destroy(),A.emit("error",q)):(A.fd=$,A.emit("open",$),A.read())})}function v(A,q){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function g(){var A=this;be(A.path,A.flags,A.mode,function(q,$){q?(A.destroy(),A.emit("error",q)):(A.fd=$,A.emit("open",$))})}function R(A,q){return new e.ReadStream(A,q)}function M(A,q){return new e.WriteStream(A,q)}var W=e.open;e.open=be;function be(A,q,$,Se){return typeof $=="function"&&(Se=$,$=null),G(A,q,$,Se);function G(k,S,E,P,x){return W(k,S,E,function(C,K){C&&(C.code==="EMFILE"||C.code==="ENFILE")?nr([G,[k,S,E,P],C,x||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}return e}function nr(e){On("ENQUEUE",e[0].name,e[1]),he[Ne].push(e),qa()}var Zi;function bl(){for(var e=Date.now(),t=0;t<he[Ne].length;++t)he[Ne][t].length>2&&(he[Ne][t][3]=e,he[Ne][t][4]=e);qa()}function qa(){if(clearTimeout(Zi),Zi=void 0,he[Ne].length!==0){var e=he[Ne].shift(),t=e[0],n=e[1],r=e[2],i=e[3],o=e[4];if(i===void 0)On("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-i>=6e4){On("TIMEOUT",t.name,n);var a=n.pop();typeof a=="function"&&a.call(null,r)}else{var s=Date.now()-o,l=Math.max(o-i,1),u=Math.min(l*1.2,100);s>=u?(On("RETRY",t.name,n),t.apply(null,n.concat([i]))):he[Ne].push(e)}Zi===void 0&&(Zi=setTimeout(qa,0))}}});var Tl=le((Mk,vl)=>{function it(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}vl.exports=it;it.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};it.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};it.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0};it.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};it.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};it.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};it.prototype.start=it.prototype.try;it.prototype.errors=function(){return this._errors};it.prototype.attempts=function(){return this._attempts};it.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],o=i.message,a=(e[o]||0)+1;e[o]=a,a>=n&&(t=i,n=a)}return t}});var kl=le(En=>{var yh=Tl();En.operation=function(e){var t=En.timeouts(e);return new yh(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};En.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(o,a){return o-a}),r};En.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout),r};En.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var i=0;i<n.length;i++){var o=n[i],a=e[o];e[o]=function(l){var u=En.operation(t),d=Array.prototype.slice.call(arguments,1),m=d.pop();d.push(function(p){u.retry(p)||(p&&(arguments[0]=u.mainError()),m.apply(this,arguments))}),u.attempt(function(){l.apply(e,d)})}.bind(e,a),e[o].options=t}}});var Al=le((qk,xl)=>{xl.exports=kl()});var wl=le((jk,Xi)=>{Xi.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Xi.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Xi.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Rl=le(($k,or)=>{var me=global.process,Pn=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};Pn(me)?(Cl=re("assert"),rr=wl(),Ol=/^win/i.test(me.platform),Qr=re("events"),typeof Qr!="function"&&(Qr=Qr.EventEmitter),me.__signal_exit_emitter__?Me=me.__signal_exit_emitter__:(Me=me.__signal_exit_emitter__=new Qr,Me.count=0,Me.emitted={}),Me.infinite||(Me.setMaxListeners(1/0),Me.infinite=!0),or.exports=function(e,t){if(!Pn(global.process))return function(){};Cl.equal(typeof e,"function","a callback must be provided for exit handler"),ir===!1&&Fa();var n="exit";t&&t.alwaysLast&&(n="afterexit");var r=function(){Me.removeListener(n,e),Me.listeners("exit").length===0&&Me.listeners("afterexit").length===0&&eo()};return Me.on(n,e),r},eo=function(){!ir||!Pn(global.process)||(ir=!1,rr.forEach(function(t){try{me.removeListener(t,to[t])}catch{}}),me.emit=no,me.reallyExit=Na,Me.count-=1)},or.exports.unload=eo,Rn=function(t,n,r){Me.emitted[t]||(Me.emitted[t]=!0,Me.emit(t,n,r))},to={},rr.forEach(function(e){to[e]=function(){if(Pn(global.process)){var n=me.listeners(e);n.length===Me.count&&(eo(),Rn("exit",null,e),Rn("afterexit",null,e),Ol&&e==="SIGHUP"&&(e="SIGINT"),me.kill(me.pid,e))}}}),or.exports.signals=function(){return rr},ir=!1,Fa=function(){ir||!Pn(global.process)||(ir=!0,Me.count+=1,rr=rr.filter(function(t){try{return me.on(t,to[t]),!0}catch{return!1}}),me.emit=Pl,me.reallyExit=El)},or.exports.load=Fa,Na=me.reallyExit,El=function(t){Pn(global.process)&&(me.exitCode=t||0,Rn("exit",me.exitCode,null),Rn("afterexit",me.exitCode,null),Na.call(me,me.exitCode))},no=me.emit,Pl=function(t,n){if(t==="exit"&&Pn(global.process)){n!==void 0&&(me.exitCode=n);var r=no.apply(this,arguments);return Rn("exit",me.exitCode,null),Rn("afterexit",me.exitCode,null),r}else return no.apply(this,arguments)}):or.exports=function(){return function(){}};var Cl,rr,Ol,Qr,Me,eo,Rn,to,ir,Fa,Na,El,no,Pl});var jl=le((Fk,Zr)=>{"use strict";var gh=re("path"),Ja=$a(),bh=Al(),Sh=Rl(),Nt={};function ar(e,t){return t.lockfilePath||`${e}.lock`}function Ua(e,t,n){if(!t.realpath)return n(null,gh.resolve(e));t.fs.realpath(e,n)}function Da(e,t,n){t.fs.mkdir(ar(e,t),r=>{if(!r)return n();if(r.code!=="EEXIST")return n(r);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));t.fs.stat(ar(e,t),(i,o)=>{if(i)return i.code==="ENOENT"?Da(e,{...t,stale:0},n):n(i);if(!Ml(o,t))return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));Gl(e,t,a=>{if(a)return n(a);Da(e,{...t,stale:0},n)})})})}function Ml(e,t){return e.mtime.getTime()<Date.now()-t.stale}function Gl(e,t,n){t.fs.rmdir(ar(e,t),r=>{if(r&&r.code!=="ENOENT")return n(r);n()})}function La(e,t){let n=Nt[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{let r=Date.now()/1e3;n.updateTimeout=null,t.fs.utimes(ar(e,t),r,r,i=>{if(!n.released){if(n.lastUpdate<=Date.now()-t.stale&&n.lastUpdate>Date.now()-t.stale*2){let o=Object.assign(new Error(n.updateError||"Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"});return Il(e,n,o)}if(i)return i.code==="ENOENT"?Il(e,n,Object.assign(i,{code:"ECOMPROMISED"})):(n.updateError=i,n.updateDelay=1e3,La(e,t));n.lastUpdate=Date.now(),n.updateError=null,n.updateDelay=null,La(e,t)}})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function Il(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),Nt[e]===t&&delete Nt[e],t.options.onCompromised(n)}function vh(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:Ja,onCompromised:r=>{throw r},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),Ua(e,t,(r,i)=>{if(r)return n(r);let o=bh.operation(t.retries);o.attempt(()=>{Da(i,t,a=>{if(o.retry(a))return;if(a)return n(o.mainError());let s=Nt[i]={options:t,lastUpdate:Date.now()};La(i,t),n(null,l=>{if(s.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));ql(i,{...t,realpath:!1},l)})})})})}function ql(e,t,n){t={fs:Ja,realpath:!0,...t},Ua(e,t,(r,i)=>{if(r)return n(r);let o=Nt[i];if(!o)return n(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete Nt[i],Gl(i,t,n)})}function Th(e,t,n){t={stale:1e4,realpath:!0,fs:Ja,...t},t.stale=Math.max(t.stale||0,2e3),Ua(e,t,(r,i)=>{if(r)return n(r);t.fs.stat(ar(i,t),(o,a)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!Ml(a,t)))})}function kh(){return Nt}Sh(()=>{for(let e in Nt){let t=Nt[e].options;try{t.fs.rmdirSync(ar(e,t))}catch{}}});Zr.exports.lock=vh;Zr.exports.unlock=ql;Zr.exports.check=Th;Zr.exports.getLocks=kh});var Fl=le((Nk,$l)=>{"use strict";var xh=$a();function Ah(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(r=>{n[r]=(...i)=>{let o=i.pop(),a;try{a=e[`${r}Sync`](...i)}catch(s){return o(s)}o(null,a)}}),n}function wh(e){return(...t)=>new Promise((n,r)=>{t.push((i,o)=>{i?r(i):n(o)}),e(...t)})}function Ch(e){return(...t)=>{let n,r;if(t.push((i,o)=>{n=i,r=o}),e(...t),n)throw n;return r}}function Oh(e){if(e={...e},e.fs=Ah(e.fs||xh),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}$l.exports={toPromise:wh,toSync:Ch,toSyncOptions:Oh}});var Dl=le((Dk,sn)=>{"use strict";var sr=jl(),{toPromise:ro,toSync:io,toSyncOptions:Ba}=Fl();async function Nl(e,t){let n=await ro(sr.lock)(e,t);return ro(n)}function Eh(e,t){let n=io(sr.lock)(e,Ba(t));return io(n)}function Ph(e,t){return ro(sr.unlock)(e,t)}function Rh(e,t){return io(sr.unlock)(e,Ba(t))}function Ih(e,t){return ro(sr.check)(e,t)}function Mh(e,t){return io(sr.check)(e,Ba(t))}sn.exports=Nl;sn.exports.lock=Nl;sn.exports.unlock=Ph;sn.exports.lockSync=Eh;sn.exports.unlockSync=Rh;sn.exports.check=Ih;sn.exports.checkSync=Mh});var Ll=_(()=>{});var dr=_(()=>{});var dn=_(()=>{});var L=_(()=>{Ll();dr();dn()});function qh(e){return e==null?!1:typeof e.RE_EXN_ID=="string"}function Q(e){return qh(e)?e:{RE_EXN_ID:"JsExn",_1:e}}function za(e){let t=Ka[e];if(t!==void 0){let n=t+1|0;return Ka[e]=n,e+("/"+n)}return Ka[e]=1,e}var Ka,ee=_(()=>{Ka={}});function ve(e){let t=St(e);if(t===void 0)return{code:void 0,message:"unknown error"};let n=N(t);return{code:er(n.code),message:j(vt(n),"unknown error")}}var jh,B=_(()=>{Ft();w();tr();jh=bt(Dl(),1);L();D();ee()});function Bl(e,t){return e!==void 0&&t!==void 0?e===t?{TAG:"Match",version:e}:{TAG:"Mismatch",pathVersion:e,pinnedVersion:t}:{TAG:"Unverified",pathVersion:e,pinnedVersion:t}}var Ul,Kl=_(()=>{X();B();w();L();Ul=new RegExp("(\\d+\\.\\d+\\.\\d+)")});function zl(e){return e!=="claude_code"}function Fh(e,t){let n=Bl(e,t);switch(n.TAG){case"Match":return{TAG:"Ok",_0:n.version};case"Mismatch":return{TAG:"Error",_0:"hosted_codex_runtime_refused reason=mismatch observed="+n.pathVersion+" expected="+n.pinnedVersion};case"Unverified":return{TAG:"Error",_0:"hosted_codex_runtime_refused reason=unverified observed=unverified expected="+t}}}function Wl(e,t,n){let r;if(e===0&&t.length<=1048576){let i=Ul.exec(t);r=i==null?void 0:oe(i.slice(1)[0],o=>o)}else r=void 0;return Fh(r,n)}var Hl=_(()=>{w();Kl()});var Vl,Ql,Wa=_(()=>{Hl();Vl=zl,Ql=Wl});var Yl,Zl=_(()=>{Yl={name:"@linzumi/cli",version:"1.0.310",description:"Linzumi CLI \u2014 point a Codex agent at the real code on your laptop, with your team watching and steering from shared threads.",type:"module",bin:{linzumi:"bin/linzumi.js"},files:["README.md","bin","dist","scripts","!scripts/build-*-oracle.mjs","native/darwin/linzumi-terminal-pty-helper","native/darwin/terminal-pty-helper.manifest.json"],scripts:{build:"rescript build ../linzumi-cli-rescript && node scripts/build.mjs","bump-version":"node scripts/bump-cli-version.mjs",test:"pnpm --dir ../linzumi-cli-rescript test && npm run test:operational",typecheck:"rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.source.json",prepack:"rescript build -q ../linzumi-cli-rescript && node scripts/build.mjs","pack:dry-run":"npm pack --dry-run","test:operational":"vitest run --config vitest.config.mjs","vendor:codex-app-server-protocol":"tsx scripts/vendor-codex-app-server-protocol.ts","test:startup":"npm run build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/CommanderStartupRefusalConformance.res.mjs","typecheck:all":"rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.json","typecheck:watch":"rescript build ../linzumi-cli-rescript && tsgo --noEmit -w -p tsconfig.source.json","test:agent-source":"LINZUMI_CI_QUARANTINE=0 pnpm exec vitest run --config vitest.config.mjs test/channelSession.test.ts test/kandanQueue.test.ts -t '(retains three busy accepted source snapshots without fusing or interrupting|keeps different accepted agent sources distinct through interrupt pickup)' && pnpm --dir ../linzumi-cli-rescript build && pnpm --dir ../linzumi-cli-rescript exec node --import tsx src/parity/AgentOpenaiModelProviderConformance.res.mjs && pnpm --dir ../linzumi-cli-rescript exec node --import tsx src/parity/WorkerMintCredentialConformance.res.mjs","codex:history-table":"node scripts/codex_history_table.mjs","vendor:codex-app-server-protocol:check":"tsx scripts/vendor-codex-app-server-protocol.ts --check"},keywords:["linzumi","kandan","codex","local-runner"],license:"MIT",publishConfig:{access:"public"},dependencies:{"@anthropic-ai/claude-agent-sdk":"0.3.283","@inquirer/prompts":"^7.8.6","@modelcontextprotocol/sdk":"^1.29.0","@openai/codex":"0.159.2",blessed:"^0.1.81","ghostty-web":"0.4.0","proper-lockfile":"3.2.0","stream-json":"1.9.1",undici:"^6.25.0",ws:"^8.18.0",zod:"^3.25.76"},engines:{node:">=20"},readmeFilename:"README.md",devDependencies:{"@types/blessed":"^0.1.27","@types/node":"^22.18.6","@types/proper-lockfile":"4.1.4","@typescript/native-preview":"7.0.0-dev.20260703.1",esbuild:"^0.27.2","fast-check":"^3.23.2",rescript:"12.3.0",tsx:"^4.21.0",typescript:"^5.9.3",vitest:"^1.6.1"}}});var ao,so=_(()=>{"use strict";Zl();ao=Yl.dependencies["@openai/codex"]});import{readFileSync as Lh}from"node:fs";function Bh(e=process.env,t=void 0,n=r=>Lh(r,"utf8")){let r=e.SMOLCLOUD_API_KEY?.trim();if(r!==void 0&&r!=="")return r;if(t?.apiKeyFile!==void 0&&t.apiKeyFile!=="")try{let o=n(t.apiKeyFile).trim();if(o!=="")return o}catch{}let i=e.SMOL_CLOUD_TOKEN?.trim();if(i!==void 0&&i!=="")return i}function Qa(e){let t=e.env??process.env,n=Bh(t,e.config);if(n===void 0)return;let r=(t.SMOLCLOUD_BASE_URL??e.config?.baseUrl??Jh).replace(/\/+$/,"");return e.fetchImpl===void 0?{baseUrl:r,apiKey:n}:{baseUrl:r,apiKey:n,fetchImpl:e.fetchImpl}}function lo(e){return e.replace(/\bsmk_[A-Za-z0-9._-]+/g,"smk_[REDACTED]")}function Xl(e){return e.split("/").map(encodeURIComponent).join("/")}async function Dt(e,t,n,r={}){let i=e.fetchImpl??fetch,o={authorization:`Bearer ${e.apiKey}`},a;r.json!==void 0?(o["content-type"]="application/json",a=JSON.stringify(r.json)):r.body!==void 0&&(o["content-type"]="application/octet-stream",a=r.body);let s=new AbortController,l=r.timeoutMs??Va,u=setTimeout(()=>s.abort(),l),d;try{d=await i(`${e.baseUrl}${n}`,{method:t,headers:o,body:a??null,signal:s.signal})}catch(p){throw p instanceof Error&&p.name==="AbortError"?new We("TIMEOUT",`smolcloud ${t} ${n} timed out after ${l}ms`):new We("CONNECTION",`smolcloud request failed: ${p instanceof Error?p.message:String(p)}`)}finally{clearTimeout(u)}if(!d.ok){let p=await d.text().catch(()=>""),f=d.status===404?"NOT_FOUND":d.status===401||d.status===403?"UNAUTHORIZED":"CLOUD_ERROR";throw new We(f,`smolcloud ${t} ${n} \u2192 ${d.status}${p===""?"":`: ${p}`}`)}return r.accept==="bytes"?Buffer.from(await d.arrayBuffer()):d.status===204?void 0:(d.headers.get("content-type")??"").includes("application/json")?await d.json():void 0}async function*Kh(e){let t=e.getReader(),n=new TextDecoder,r="",i="",o=[],a=()=>{let s=i,l=o.join(`
3
+ var Y_=Object.create;var Pa=Object.defineProperty;var X_=Object.getOwnPropertyDescriptor;var eh=Object.getOwnPropertyNames;var th=Object.getPrototypeOf,nh=Object.prototype.hasOwnProperty;var re=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),rh=(e,t)=>{for(var n in t)Pa(e,n,{get:t[n],enumerable:!0})},ih=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eh(t))!nh.call(e,i)&&i!==n&&Pa(e,i,{get:()=>t[i],enumerable:!(r=X_(t,i))||r.enumerable});return e};var bt=(e,t,n)=>(n=e!=null?Y_(th(e)):{},ih(t||!e||!e.__esModule?Pa(n,"default",{value:e,enumerable:!0}):n,e));var Ra=_(()=>{});function se(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function er(e){if(e!=null)return se(e)}function N(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}var D=_(()=>{});function $t(e,t){if(e!==void 0)return t(N(e))}function xe(e,t,n){return e!==void 0?n(N(e)):t}function H(e,t){if(e!==void 0)return se(t(N(e)))}function ie(e,t){if(e!==void 0)return t(N(e))}function j(e,t){return e!==void 0?N(e):t}var w=_(()=>{Ra();D()});var Wi=_(()=>{});function ce(e,t,n){return e.reduce(n,t)}var X=_(()=>{Wi();D()});function St(e){if(e.RE_EXN_ID==="JsExn")return se(e._1)}var Hi,ah,vt,Ck,Ok,Ft=_(()=>{D();Hi=(e=>t=>t&&typeof t[e]=="string"?t[e]:void 0),ah=Hi("stack"),vt=Hi("message"),Ck=Hi("name"),Ok=Hi("fileName")});var tr=_(()=>{});var fl=le((Ek,cl)=>{var an=re("constants"),sh=process.cwd,Vi=null,dh=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Vi||(Vi=sh.call(process)),Vi};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Ma=process.chdir,process.chdir=function(e){Vi=null,Ma.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Ma));var Ma;cl.exports=lh;function lh(e){an.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=r(e.chmod),e.fchmod=r(e.fchmod),e.lchmod=r(e.lchmod),e.chownSync=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=i(e.chmodSync),e.fchmodSync=i(e.fchmodSync),e.lchmodSync=i(e.lchmodSync),e.stat=s(e.stat),e.fstat=s(e.fstat),e.lstat=s(e.lstat),e.statSync=l(e.statSync),e.fstatSync=l(e.fstatSync),e.lstatSync=l(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(d,m,p){p&&process.nextTick(p)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(d,m,p,f){f&&process.nextTick(f)},e.lchownSync=function(){}),dh==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(d){function m(p,f,h){var c=Date.now(),y=0;d(p,f,function b(T){if(T&&(T.code==="EACCES"||T.code==="EPERM"||T.code==="EBUSY")&&Date.now()-c<6e4){setTimeout(function(){e.stat(f,function(v,g){v&&v.code==="ENOENT"?d(p,f,b):h(T)})},y),y<100&&(y+=10);return}h&&h(T)})}return Object.setPrototypeOf&&Object.setPrototypeOf(m,d),m})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(d){function m(p,f,h,c,y,b){var T;if(b&&typeof b=="function"){var v=0;T=function(g,R,M){if(g&&g.code==="EAGAIN"&&v<10)return v++,d.call(e,p,f,h,c,y,T);b.apply(this,arguments)}}return d.call(e,p,f,h,c,y,T)}return Object.setPrototypeOf&&Object.setPrototypeOf(m,d),m})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(d){return function(m,p,f,h,c){for(var y=0;;)try{return d.call(e,m,p,f,h,c)}catch(b){if(b.code==="EAGAIN"&&y<10){y++;continue}throw b}}})(e.readSync);function t(d){d.lchmod=function(m,p,f){d.open(m,an.O_WRONLY|an.O_SYMLINK,p,function(h,c){if(h){f&&f(h);return}d.fchmod(c,p,function(y){d.close(c,function(b){f&&f(y||b)})})})},d.lchmodSync=function(m,p){var f=d.openSync(m,an.O_WRONLY|an.O_SYMLINK,p),h=!0,c;try{c=d.fchmodSync(f,p),h=!1}finally{if(h)try{d.closeSync(f)}catch{}else d.closeSync(f)}return c}}function n(d){an.hasOwnProperty("O_SYMLINK")&&d.futimes?(d.lutimes=function(m,p,f,h){d.open(m,an.O_SYMLINK,function(c,y){if(c){h&&h(c);return}d.futimes(y,p,f,function(b){d.close(y,function(T){h&&h(b||T)})})})},d.lutimesSync=function(m,p,f){var h=d.openSync(m,an.O_SYMLINK),c,y=!0;try{c=d.futimesSync(h,p,f),y=!1}finally{if(y)try{d.closeSync(h)}catch{}else d.closeSync(h)}return c}):d.futimes&&(d.lutimes=function(m,p,f,h){h&&process.nextTick(h)},d.lutimesSync=function(){})}function r(d){return d&&function(m,p,f){return d.call(e,m,p,function(h){u(h)&&(h=null),f&&f.apply(this,arguments)})}}function i(d){return d&&function(m,p){try{return d.call(e,m,p)}catch(f){if(!u(f))throw f}}}function o(d){return d&&function(m,p,f,h){return d.call(e,m,p,f,function(c){u(c)&&(c=null),h&&h.apply(this,arguments)})}}function a(d){return d&&function(m,p,f){try{return d.call(e,m,p,f)}catch(h){if(!u(h))throw h}}}function s(d){return d&&function(m,p,f){typeof p=="function"&&(f=p,p=null);function h(c,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),f&&f.apply(this,arguments)}return p?d.call(e,m,p,h):d.call(e,m,h)}}function l(d){return d&&function(m,p){var f=p?d.call(e,m,p):d.call(e,m);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function u(d){if(!d||d.code==="ENOSYS")return!0;var m=!process.getuid||process.getuid()!==0;return!!(m&&(d.code==="EINVAL"||d.code==="EPERM"))}}});var _l=le((Pk,pl)=>{var ml=re("stream").Stream;pl.exports=uh;function uh(e){return{ReadStream:t,WriteStream:n};function t(r,i){if(!(this instanceof t))return new t(r,i);ml.call(this);var o=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var a=Object.keys(i),s=0,l=a.length;s<l;s++){var u=a[s];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}e.open(this.path,this.flags,this.mode,function(d,m){if(d){o.emit("error",d),o.readable=!1;return}o.fd=m,o.emit("open",m),o._read()})}function n(r,i){if(!(this instanceof n))return new n(r,i);ml.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),a=0,s=o.length;a<s;a++){var l=o[a];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var yl=le((Rk,hl)=>{"use strict";hl.exports=fh;var ch=Object.getPrototypeOf||function(e){return e.__proto__};function fh(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:ch(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}});var $a=le((Ik,ja)=>{var he=re("fs"),mh=fl(),ph=_l(),_h=yl(),Qi=re("util"),Ne,Yi;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ne=Symbol.for("graceful-fs.queue"),Yi=Symbol.for("graceful-fs.previous")):(Ne="___graceful-fs.queue",Yi="___graceful-fs.previous");function hh(){}function Sl(e,t){Object.defineProperty(e,Ne,{get:function(){return t}})}var On=hh;Qi.debuglog?On=Qi.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(On=function(){var e=Qi.format.apply(Qi,arguments);e="GFS4: "+e.split(/\n/).join(`
4
+ GFS4: `),console.error(e)});he[Ne]||(gl=global[Ne]||[],Sl(he,gl),he.close=(function(e){function t(n,r){return e.call(he,n,function(i){i||bl(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(t,Yi,{value:e}),t})(he.close),he.closeSync=(function(e){function t(n){e.apply(he,arguments),bl()}return Object.defineProperty(t,Yi,{value:e}),t})(he.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){On(he[Ne]),re("assert").equal(he[Ne].length,0)}));var gl;global[Ne]||Sl(global,he[Ne]);ja.exports=Ga(_h(he));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!he.__patched&&(ja.exports=Ga(he),he.__patched=!0);function Ga(e){mh(e),e.gracefulify=Ga,e.createReadStream=R,e.createWriteStream=M;var t=e.readFile;e.readFile=n;function n(A,q,$){return typeof q=="function"&&($=q,q=null),Se(A,q,$);function Se(G,k,S,E){return t(G,k,function(P){P&&(P.code==="EMFILE"||P.code==="ENFILE")?nr([Se,[G,k,S],P,E||Date.now(),Date.now()]):typeof S=="function"&&S.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=i;function i(A,q,$,Se){return typeof $=="function"&&(Se=$,$=null),G(A,q,$,Se);function G(k,S,E,P,x){return r(k,S,E,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?nr([G,[k,S,E,P],C,x||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=a);function a(A,q,$,Se){return typeof $=="function"&&(Se=$,$=null),G(A,q,$,Se);function G(k,S,E,P,x){return o(k,S,E,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?nr([G,[k,S,E,P],C,x||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var s=e.copyFile;s&&(e.copyFile=l);function l(A,q,$,Se){return typeof $=="function"&&(Se=$,$=0),G(A,q,$,Se);function G(k,S,E,P,x){return s(k,S,E,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?nr([G,[k,S,E,P],C,x||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var u=e.readdir;e.readdir=m;var d=/^v[0-5]\./;function m(A,q,$){typeof q=="function"&&($=q,q=null);var Se=d.test(process.version)?function(S,E,P,x){return u(S,G(S,E,P,x))}:function(S,E,P,x){return u(S,E,G(S,E,P,x))};return Se(A,q,$);function G(k,S,E,P){return function(x,C){x&&(x.code==="EMFILE"||x.code==="ENFILE")?nr([Se,[k,S,E],x,P||Date.now(),Date.now()]):(C&&C.sort&&C.sort(),typeof E=="function"&&E.call(this,x,C))}}}if(process.version.substr(0,4)==="v0.8"){var p=ph(e);b=p.ReadStream,v=p.WriteStream}var f=e.ReadStream;f&&(b.prototype=Object.create(f.prototype),b.prototype.open=T);var h=e.WriteStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=g),Object.defineProperty(e,"ReadStream",{get:function(){return b},set:function(A){b=A},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(A){v=A},enumerable:!0,configurable:!0});var c=b;Object.defineProperty(e,"FileReadStream",{get:function(){return c},set:function(A){c=A},enumerable:!0,configurable:!0});var y=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return y},set:function(A){y=A},enumerable:!0,configurable:!0});function b(A,q){return this instanceof b?(f.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function T(){var A=this;be(A.path,A.flags,A.mode,function(q,$){q?(A.autoClose&&A.destroy(),A.emit("error",q)):(A.fd=$,A.emit("open",$),A.read())})}function v(A,q){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function g(){var A=this;be(A.path,A.flags,A.mode,function(q,$){q?(A.destroy(),A.emit("error",q)):(A.fd=$,A.emit("open",$))})}function R(A,q){return new e.ReadStream(A,q)}function M(A,q){return new e.WriteStream(A,q)}var W=e.open;e.open=be;function be(A,q,$,Se){return typeof $=="function"&&(Se=$,$=null),G(A,q,$,Se);function G(k,S,E,P,x){return W(k,S,E,function(C,K){C&&(C.code==="EMFILE"||C.code==="ENFILE")?nr([G,[k,S,E,P],C,x||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}return e}function nr(e){On("ENQUEUE",e[0].name,e[1]),he[Ne].push(e),qa()}var Zi;function bl(){for(var e=Date.now(),t=0;t<he[Ne].length;++t)he[Ne][t].length>2&&(he[Ne][t][3]=e,he[Ne][t][4]=e);qa()}function qa(){if(clearTimeout(Zi),Zi=void 0,he[Ne].length!==0){var e=he[Ne].shift(),t=e[0],n=e[1],r=e[2],i=e[3],o=e[4];if(i===void 0)On("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-i>=6e4){On("TIMEOUT",t.name,n);var a=n.pop();typeof a=="function"&&a.call(null,r)}else{var s=Date.now()-o,l=Math.max(o-i,1),u=Math.min(l*1.2,100);s>=u?(On("RETRY",t.name,n),t.apply(null,n.concat([i]))):he[Ne].push(e)}Zi===void 0&&(Zi=setTimeout(qa,0))}}});var Tl=le((Mk,vl)=>{function it(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}vl.exports=it;it.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};it.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};it.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0};it.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};it.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};it.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};it.prototype.start=it.prototype.try;it.prototype.errors=function(){return this._errors};it.prototype.attempts=function(){return this._attempts};it.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],o=i.message,a=(e[o]||0)+1;e[o]=a,a>=n&&(t=i,n=a)}return t}});var kl=le(En=>{var yh=Tl();En.operation=function(e){var t=En.timeouts(e);return new yh(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};En.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(o,a){return o-a}),r};En.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout),r};En.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var i=0;i<n.length;i++){var o=n[i],a=e[o];e[o]=function(l){var u=En.operation(t),d=Array.prototype.slice.call(arguments,1),m=d.pop();d.push(function(p){u.retry(p)||(p&&(arguments[0]=u.mainError()),m.apply(this,arguments))}),u.attempt(function(){l.apply(e,d)})}.bind(e,a),e[o].options=t}}});var Al=le((qk,xl)=>{xl.exports=kl()});var wl=le((jk,Xi)=>{Xi.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Xi.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Xi.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Rl=le(($k,or)=>{var me=global.process,Pn=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};Pn(me)?(Cl=re("assert"),rr=wl(),Ol=/^win/i.test(me.platform),Qr=re("events"),typeof Qr!="function"&&(Qr=Qr.EventEmitter),me.__signal_exit_emitter__?Me=me.__signal_exit_emitter__:(Me=me.__signal_exit_emitter__=new Qr,Me.count=0,Me.emitted={}),Me.infinite||(Me.setMaxListeners(1/0),Me.infinite=!0),or.exports=function(e,t){if(!Pn(global.process))return function(){};Cl.equal(typeof e,"function","a callback must be provided for exit handler"),ir===!1&&Fa();var n="exit";t&&t.alwaysLast&&(n="afterexit");var r=function(){Me.removeListener(n,e),Me.listeners("exit").length===0&&Me.listeners("afterexit").length===0&&eo()};return Me.on(n,e),r},eo=function(){!ir||!Pn(global.process)||(ir=!1,rr.forEach(function(t){try{me.removeListener(t,to[t])}catch{}}),me.emit=no,me.reallyExit=Na,Me.count-=1)},or.exports.unload=eo,Rn=function(t,n,r){Me.emitted[t]||(Me.emitted[t]=!0,Me.emit(t,n,r))},to={},rr.forEach(function(e){to[e]=function(){if(Pn(global.process)){var n=me.listeners(e);n.length===Me.count&&(eo(),Rn("exit",null,e),Rn("afterexit",null,e),Ol&&e==="SIGHUP"&&(e="SIGINT"),me.kill(me.pid,e))}}}),or.exports.signals=function(){return rr},ir=!1,Fa=function(){ir||!Pn(global.process)||(ir=!0,Me.count+=1,rr=rr.filter(function(t){try{return me.on(t,to[t]),!0}catch{return!1}}),me.emit=Pl,me.reallyExit=El)},or.exports.load=Fa,Na=me.reallyExit,El=function(t){Pn(global.process)&&(me.exitCode=t||0,Rn("exit",me.exitCode,null),Rn("afterexit",me.exitCode,null),Na.call(me,me.exitCode))},no=me.emit,Pl=function(t,n){if(t==="exit"&&Pn(global.process)){n!==void 0&&(me.exitCode=n);var r=no.apply(this,arguments);return Rn("exit",me.exitCode,null),Rn("afterexit",me.exitCode,null),r}else return no.apply(this,arguments)}):or.exports=function(){return function(){}};var Cl,rr,Ol,Qr,Me,eo,Rn,to,ir,Fa,Na,El,no,Pl});var jl=le((Fk,Zr)=>{"use strict";var gh=re("path"),Ja=$a(),bh=Al(),Sh=Rl(),Nt={};function ar(e,t){return t.lockfilePath||`${e}.lock`}function Ua(e,t,n){if(!t.realpath)return n(null,gh.resolve(e));t.fs.realpath(e,n)}function Da(e,t,n){t.fs.mkdir(ar(e,t),r=>{if(!r)return n();if(r.code!=="EEXIST")return n(r);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));t.fs.stat(ar(e,t),(i,o)=>{if(i)return i.code==="ENOENT"?Da(e,{...t,stale:0},n):n(i);if(!Ml(o,t))return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));Gl(e,t,a=>{if(a)return n(a);Da(e,{...t,stale:0},n)})})})}function Ml(e,t){return e.mtime.getTime()<Date.now()-t.stale}function Gl(e,t,n){t.fs.rmdir(ar(e,t),r=>{if(r&&r.code!=="ENOENT")return n(r);n()})}function La(e,t){let n=Nt[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{let r=Date.now()/1e3;n.updateTimeout=null,t.fs.utimes(ar(e,t),r,r,i=>{if(!n.released){if(n.lastUpdate<=Date.now()-t.stale&&n.lastUpdate>Date.now()-t.stale*2){let o=Object.assign(new Error(n.updateError||"Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"});return Il(e,n,o)}if(i)return i.code==="ENOENT"?Il(e,n,Object.assign(i,{code:"ECOMPROMISED"})):(n.updateError=i,n.updateDelay=1e3,La(e,t));n.lastUpdate=Date.now(),n.updateError=null,n.updateDelay=null,La(e,t)}})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function Il(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),Nt[e]===t&&delete Nt[e],t.options.onCompromised(n)}function vh(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:Ja,onCompromised:r=>{throw r},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),Ua(e,t,(r,i)=>{if(r)return n(r);let o=bh.operation(t.retries);o.attempt(()=>{Da(i,t,a=>{if(o.retry(a))return;if(a)return n(o.mainError());let s=Nt[i]={options:t,lastUpdate:Date.now()};La(i,t),n(null,l=>{if(s.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));ql(i,{...t,realpath:!1},l)})})})})}function ql(e,t,n){t={fs:Ja,realpath:!0,...t},Ua(e,t,(r,i)=>{if(r)return n(r);let o=Nt[i];if(!o)return n(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete Nt[i],Gl(i,t,n)})}function Th(e,t,n){t={stale:1e4,realpath:!0,fs:Ja,...t},t.stale=Math.max(t.stale||0,2e3),Ua(e,t,(r,i)=>{if(r)return n(r);t.fs.stat(ar(i,t),(o,a)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!Ml(a,t)))})}function kh(){return Nt}Sh(()=>{for(let e in Nt){let t=Nt[e].options;try{t.fs.rmdirSync(ar(e,t))}catch{}}});Zr.exports.lock=vh;Zr.exports.unlock=ql;Zr.exports.check=Th;Zr.exports.getLocks=kh});var Fl=le((Nk,$l)=>{"use strict";var xh=$a();function Ah(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(r=>{n[r]=(...i)=>{let o=i.pop(),a;try{a=e[`${r}Sync`](...i)}catch(s){return o(s)}o(null,a)}}),n}function wh(e){return(...t)=>new Promise((n,r)=>{t.push((i,o)=>{i?r(i):n(o)}),e(...t)})}function Ch(e){return(...t)=>{let n,r;if(t.push((i,o)=>{n=i,r=o}),e(...t),n)throw n;return r}}function Oh(e){if(e={...e},e.fs=Ah(e.fs||xh),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}$l.exports={toPromise:wh,toSync:Ch,toSyncOptions:Oh}});var Dl=le((Dk,sn)=>{"use strict";var sr=jl(),{toPromise:ro,toSync:io,toSyncOptions:Ba}=Fl();async function Nl(e,t){let n=await ro(sr.lock)(e,t);return ro(n)}function Eh(e,t){let n=io(sr.lock)(e,Ba(t));return io(n)}function Ph(e,t){return ro(sr.unlock)(e,t)}function Rh(e,t){return io(sr.unlock)(e,Ba(t))}function Ih(e,t){return ro(sr.check)(e,t)}function Mh(e,t){return io(sr.check)(e,Ba(t))}sn.exports=Nl;sn.exports.lock=Nl;sn.exports.unlock=Ph;sn.exports.lockSync=Eh;sn.exports.unlockSync=Rh;sn.exports.check=Ih;sn.exports.checkSync=Mh});var Ll=_(()=>{});var dr=_(()=>{});var dn=_(()=>{});var L=_(()=>{Ll();dr();dn()});function qh(e){return e==null?!1:typeof e.RE_EXN_ID=="string"}function Q(e){return qh(e)?e:{RE_EXN_ID:"JsExn",_1:e}}function za(e){let t=Ka[e];if(t!==void 0){let n=t+1|0;return Ka[e]=n,e+("/"+n)}return Ka[e]=1,e}var Ka,ee=_(()=>{Ka={}});function ve(e){let t=St(e);if(t===void 0)return{code:void 0,message:"unknown error"};let n=N(t);return{code:er(n.code),message:j(vt(n),"unknown error")}}var jh,B=_(()=>{Ft();w();tr();jh=bt(Dl(),1);L();D();ee()});function Bl(e,t){return e!==void 0&&t!==void 0?e===t?{TAG:"Match",version:e}:{TAG:"Mismatch",pathVersion:e,pinnedVersion:t}:{TAG:"Unverified",pathVersion:e,pinnedVersion:t}}var Ul,Kl=_(()=>{X();B();w();L();Ul=new RegExp("(\\d+\\.\\d+\\.\\d+)")});function zl(e){return e!=="claude_code"}function Fh(e,t){let n=Bl(e,t);switch(n.TAG){case"Match":return{TAG:"Ok",_0:n.version};case"Mismatch":return{TAG:"Error",_0:"hosted_codex_runtime_refused reason=mismatch observed="+n.pathVersion+" expected="+n.pinnedVersion};case"Unverified":return{TAG:"Error",_0:"hosted_codex_runtime_refused reason=unverified observed=unverified expected="+t}}}function Wl(e,t,n){let r;if(e===0&&t.length<=1048576){let i=Ul.exec(t);r=i==null?void 0:ie(i.slice(1)[0],o=>o)}else r=void 0;return Fh(r,n)}var Hl=_(()=>{w();Kl()});var Vl,Ql,Wa=_(()=>{Hl();Vl=zl,Ql=Wl});var Yl,Zl=_(()=>{Yl={name:"@linzumi/cli",version:"1.0.312",description:"Linzumi CLI \u2014 point a Codex agent at the real code on your laptop, with your team watching and steering from shared threads.",type:"module",bin:{linzumi:"bin/linzumi.js"},files:["README.md","bin","dist","scripts","!scripts/build-*-oracle.mjs","native/darwin/linzumi-terminal-pty-helper","native/darwin/terminal-pty-helper.manifest.json"],scripts:{build:"rescript build ../linzumi-cli-rescript && node scripts/build.mjs","bump-version":"node scripts/bump-cli-version.mjs",test:"pnpm --dir ../linzumi-cli-rescript test && npm run test:operational",typecheck:"rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.source.json",prepack:"rescript build -q ../linzumi-cli-rescript && node scripts/build.mjs","pack:dry-run":"npm pack --dry-run","test:operational":"vitest run --config vitest.config.mjs","vendor:codex-app-server-protocol":"tsx scripts/vendor-codex-app-server-protocol.ts","test:startup":"npm run build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/CommanderStartupRefusalConformance.res.mjs","typecheck:all":"rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.json","typecheck:watch":"rescript build ../linzumi-cli-rescript && tsgo --noEmit -w -p tsconfig.source.json","test:agent-source":"LINZUMI_CI_QUARANTINE=0 pnpm exec vitest run --config vitest.config.mjs test/channelSession.test.ts test/kandanQueue.test.ts -t '(retains three busy accepted source snapshots without fusing or interrupting|keeps different accepted agent sources distinct through interrupt pickup)' && pnpm --dir ../linzumi-cli-rescript build && pnpm --dir ../linzumi-cli-rescript exec node --import tsx src/parity/AgentOpenaiModelProviderConformance.res.mjs && pnpm --dir ../linzumi-cli-rescript exec node --import tsx src/parity/WorkerMintCredentialConformance.res.mjs","codex:history-table":"node scripts/codex_history_table.mjs","vendor:codex-app-server-protocol:check":"tsx scripts/vendor-codex-app-server-protocol.ts --check"},keywords:["linzumi","kandan","codex","local-runner"],license:"MIT",publishConfig:{access:"public"},dependencies:{"@anthropic-ai/claude-agent-sdk":"0.3.283","@inquirer/prompts":"^7.8.6","@modelcontextprotocol/sdk":"^1.29.0","@openai/codex":"0.159.2",blessed:"^0.1.81","ghostty-web":"0.4.0","proper-lockfile":"3.2.0","stream-json":"1.9.1",undici:"^6.25.0",ws:"^8.18.0",zod:"^3.25.76"},engines:{node:">=20"},readmeFilename:"README.md",devDependencies:{"@types/blessed":"^0.1.27","@types/node":"^22.18.6","@types/proper-lockfile":"4.1.4","@typescript/native-preview":"7.0.0-dev.20260703.1",esbuild:"^0.27.2","fast-check":"^3.23.2",rescript:"12.3.0",tsx:"^4.21.0",typescript:"^5.9.3",vitest:"^1.6.1"}}});var ao,so=_(()=>{"use strict";Zl();ao=Yl.dependencies["@openai/codex"]});import{readFileSync as Lh}from"node:fs";function Bh(e=process.env,t=void 0,n=r=>Lh(r,"utf8")){let r=e.SMOLCLOUD_API_KEY?.trim();if(r!==void 0&&r!=="")return r;if(t?.apiKeyFile!==void 0&&t.apiKeyFile!=="")try{let o=n(t.apiKeyFile).trim();if(o!=="")return o}catch{}let i=e.SMOL_CLOUD_TOKEN?.trim();if(i!==void 0&&i!=="")return i}function Qa(e){let t=e.env??process.env,n=Bh(t,e.config);if(n===void 0)return;let r=(t.SMOLCLOUD_BASE_URL??e.config?.baseUrl??Jh).replace(/\/+$/,"");return e.fetchImpl===void 0?{baseUrl:r,apiKey:n}:{baseUrl:r,apiKey:n,fetchImpl:e.fetchImpl}}function lo(e){return e.replace(/\bsmk_[A-Za-z0-9._-]+/g,"smk_[REDACTED]")}function Xl(e){return e.split("/").map(encodeURIComponent).join("/")}async function Dt(e,t,n,r={}){let i=e.fetchImpl??fetch,o={authorization:`Bearer ${e.apiKey}`},a;r.json!==void 0?(o["content-type"]="application/json",a=JSON.stringify(r.json)):r.body!==void 0&&(o["content-type"]="application/octet-stream",a=r.body);let s=new AbortController,l=r.timeoutMs??Va,u=setTimeout(()=>s.abort(),l),d;try{d=await i(`${e.baseUrl}${n}`,{method:t,headers:o,body:a??null,signal:s.signal})}catch(p){throw p instanceof Error&&p.name==="AbortError"?new We("TIMEOUT",`smolcloud ${t} ${n} timed out after ${l}ms`):new We("CONNECTION",`smolcloud request failed: ${p instanceof Error?p.message:String(p)}`)}finally{clearTimeout(u)}if(!d.ok){let p=await d.text().catch(()=>""),f=d.status===404?"NOT_FOUND":d.status===401||d.status===403?"UNAUTHORIZED":"CLOUD_ERROR";throw new We(f,`smolcloud ${t} ${n} \u2192 ${d.status}${p===""?"":`: ${p}`}`)}return r.accept==="bytes"?Buffer.from(await d.arrayBuffer()):d.status===204?void 0:(d.headers.get("content-type")??"").includes("application/json")?await d.json():void 0}async function*Kh(e){let t=e.getReader(),n=new TextDecoder,r="",i="",o=[],a=()=>{let s=i,l=o.join(`
5
5
  `);if(i="",o=[],s==="stdout")return{kind:"stdout",data:l};if(s==="stderr")return{kind:"stderr",data:l};if(s==="error")return{kind:"error",message:lo(l)};if(s==="exit"){let u=0;try{u=JSON.parse(l).exitCode??0}catch{}return{kind:"exit",exitCode:u}}};try{for(;;){let{value:l,done:u}=await t.read();if(u)break;r+=n.decode(l,{stream:!0});let d;for(;(d=r.indexOf(`
6
6
  `))>=0;){let m=r.slice(0,d);r=r.slice(d+1);let p=m.endsWith("\r")?m.slice(0,-1):m;if(p===""){let f=a();f!==void 0&&(yield f)}else p.startsWith("event:")?i=p.slice(6).trim():p.startsWith("data:")&&o.push(p.slice(5).replace(/^ /,""))}}let s=a();s!==void 0&&(yield s)}finally{t.releaseLock()}}function zh(e){if(!e.startsWith("smolmachine:"))return{type:"image",reference:e};let t=e.slice(12),n=t.lastIndexOf("@");if(n<0)return{type:"smolmachine",reference:t,arch:"arm64"};let r=t.slice(n+1);if(r!=="arm64"&&r!=="amd64")throw new We("CLOUD_ERROR",`invalid smolmachine image arch suffix ${JSON.stringify(r)} in ${JSON.stringify(e)} (expected @arm64 or @amd64)`);return{type:"smolmachine",reference:t.slice(0,n),arch:r}}async function eu(e,t){let n={name:t.name??null,source:zh(t.image),resources:{...t.cpus!==void 0?{cpus:t.cpus}:{},...t.memoryMb!==void 0?{memoryMb:t.memoryMb}:{},diskGb:t.diskGb??null},...t.network!==void 0?{network:t.network}:{},...t.env!==void 0?{env:t.env}:{},autoStopSeconds:t.autoStopSeconds??null,ttlSeconds:t.ttlSeconds??null},r=await Dt(e,"POST","/v1/machines",{json:n});if(r.id===void 0)throw new We("CLOUD_ERROR","machine create returned no machine id");let i=new ei(e,r.id);try{return await Dt(e,"POST",`/v1/machines/${r.id}/start`).catch(()=>{}),await Wh(e,r.id),i}catch(o){throw await i.delete().catch(()=>{}),o}}async function Wh(e,t,n=Uh,r=i=>new Promise(o=>setTimeout(o,i))){let i=Date.now()+n;for(;;){let o;try{o=(await Dt(e,"GET",`/v1/machines/${t}`))?.state}catch(a){if(a instanceof We&&(a.code==="UNAUTHORIZED"||a.code==="NOT_FOUND"))throw a}if(o==="started"||o==="running")return;if(o==="error")throw new We("CLOUD_ERROR",`machine ${t} entered error state while starting`);if(Date.now()>=i)throw new We("TIMEOUT",`machine ${t} not ready after ${n}ms (state=${o??"unknown"})`);await r(1e3)}}var Jh,Va,Ha,Uh,We,ei,Za=_(()=>{"use strict";so();Jh="https://api.smolmachines.com",Va=3e4,Ha=3e4,Uh=12e4;We=class extends Error{code;constructor(t,n){super(lo(n)),this.code=t,this.name="SmolcloudError"}};ei=class{id;conn;constructor(t,n){this.conn=t,this.id=n}get name(){return this.id}async state(){return(await this.info()).state}async info(){let t=await Dt(this.conn,"GET",`/v1/machines/${this.id}`);return{id:t?.id??this.id,name:t?.name??null,state:t?.state??"unknown",env:t?.env??{}}}async exec(t,n){let r={command:[...t],env:n?.env??{},cwd:n?.workdir??null,stdin:n?.stdin??null,timeoutSeconds:n?.timeout??null},i=n?.timeout!==void 0?Math.max(Va,n.timeout*1e3+Ha):Va,o=await Dt(this.conn,"POST",`/v1/machines/${this.id}/exec`,{json:r,timeoutMs:i});return{exitCode:o.exitCode??0,stdout:o.stdout??"",stderr:o.stderr??""}}async*execStream(t,n){let r=this.conn.fetchImpl??fetch,i={command:[...t],env:n?.env??{},cwd:n?.workdir??null,stdin:n?.stdin??null,timeoutSeconds:n?.timeout??null},o=new AbortController,a=n?.timeout!==void 0?setTimeout(()=>o.abort(),n.timeout*1e3+Ha):void 0,s;try{s=await r(`${this.conn.baseUrl}/v1/machines/${this.id}/exec/stream`,{method:"POST",headers:{authorization:`Bearer ${this.conn.apiKey}`,"content-type":"application/json",accept:"text/event-stream"},body:JSON.stringify(i),signal:o.signal})}catch(l){throw a!==void 0&&clearTimeout(a),l instanceof Error&&l.name==="AbortError"?new We("TIMEOUT",`smolcloud exec/stream timed out after ${(n?.timeout??0)*1e3+Ha}ms`):new We("CONNECTION",`smolcloud exec/stream failed: ${l instanceof Error?l.message:String(l)}`)}try{if(!s.ok){let l=await s.text().catch(()=>"");throw new We(s.status===404?"NOT_FOUND":"CLOUD_ERROR",`smolcloud POST /v1/machines/${this.id}/exec/stream \u2192 ${s.status}${l===""?"":`: ${l}`}`)}if(s.body===null)throw new We("CLOUD_ERROR","exec/stream returned no response body");yield*Kh(s.body)}finally{a!==void 0&&clearTimeout(a)}}async readFile(t){return await Dt(this.conn,"GET",`/v1/machines/${this.id}/files/${Xl(t)}`,{accept:"bytes"})}async writeFile(t,n,r){await Dt(this.conn,"PUT",`/v1/machines/${this.id}/files/${Xl(t)}`,{body:typeof n=="string"?Buffer.from(n,"utf8"):n}),r!==void 0&&await this.exec(["chmod",r.toString(8),t])}async stop(){await Dt(this.conn,"POST",`/v1/machines/${this.id}/stop`)}async delete(){await Dt(this.conn,"DELETE",`/v1/machines/${this.id}`)}}});function tu(e){return`'${e.replaceAll("'",String.raw`'\''`)}'`}var Ya,nx,rx,ix,nu=_(()=>{"use strict";Ya="/dev/shm/linzumi",nx=`${Ya}/codex`,rx=`${Ya}/mcp-auth.json`,ix=`${Ya}/codex.env`});function Xa(e){let t=e.replace(/[^A-Za-z0-9._-]/g,"_");return`${Tt}/.linzumi-provisioned-${ru}-${t}`}function au(e){return["/bin/sh","-c",["set -e",`mkdir -p ${Tt} ${ti} ${uo}`,`chmod 700 ${ti} ${uo}`,"export DEBIAN_FRONTEND=noninteractive","apt-get update -qq >/dev/null","apt-get install -y --no-install-recommends bubblewrap ca-certificates git ripgrep curl >/dev/null","update-ca-certificates >/dev/null 2>&1 || true",`npm install -g --no-fund --no-audit @openai/codex@${tu(e)} >/dev/null`,`rm -f ${Tt}/.linzumi-provisioned-${ru}-* 2>/dev/null || true`,`touch ${Xa(e)}`,`touch ${mu}`].join(" && ")]}function su(e){return["/bin/sh","-c",`test -f ${Xa(e)} && command -v codex >/dev/null && command -v node >/dev/null && command -v bwrap >/dev/null && test -s ${ou}`]}function du(e){return["/bin/sh","-c",`if test -f ${Xa(e)} && command -v codex >/dev/null && command -v node >/dev/null && command -v bwrap >/dev/null && test -s ${ou}; then echo TOOLCHAIN_OK; else echo TOOLCHAIN_MISSING; fi; echo BUNDLE_SUP $(sha256sum ${co} 2>/dev/null | cut -d' ' -f1); echo BUNDLE_MCP $(sha256sum ${fo} 2>/dev/null | cut -d' ' -f1)`]}function es(){return["/bin/sh","-c",`rm -rf ${ti} 2>/dev/null; true`]}function ns(e){if(!Qh.test(e))throw new Error(`invalid cloud turn nonce: ${JSON.stringify(e.slice(0,80))}`)}function lu(e){return ns(e),`${ts}/${e}.beat`}function uu(e){return ns(e),`${ts}/${e}.exit`}function cu(e){let t=uu(e),n=lu(e);return["/bin/sh","-c",`if test -f ${t}; then echo EXIT; cat ${t}; elif test -f ${n}; then now=$(date +%s); hb=$(stat -c %Y ${n} 2>/dev/null || echo 0); echo AGE $((now-hb)); else echo NONE; fi`]}function fu(e){let t=uu(e),n=lu(e);return["/bin/sh","-c",`rm -f ${t} ${n} 2>/dev/null; true`]}var ru,iu,co,fo,ti,Hh,uo,Vh,ou,ts,Qh,rs=_(()=>{"use strict";is();nu();ru="v1",iu=4500,co=`${Tt}/cloud-supervisor.mjs`,fo=`${Tt}/mcp-server.mjs`,ti=`${Tt}/.secrets`,Hh=`${ti}/mcp-auth.json`,uo=`${Tt}/.codex`,Vh=`${uo}/linzumi-thread-map.json`,ou="/etc/ssl/certs/ca-certificates.crt";ts=`${Tt}/.turn-heartbeats`,Qh=/^[A-Za-z0-9-]{8,64}$/});function pu(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64")}var mo,_u,os=_(()=>{"use strict";mo={mcpAuthFileContents:"LINZUMI_CLOUD_MCP_AUTH_JSON",llmProxyToken:"LINZUMI_CLOUD_LLM_PROXY_TOKEN"};_u="exit"});var hu=_(()=>{});var yu=_(()=>{hu()});var Ee=_(()=>{"use strict"});var po=_(()=>{"use strict";Ee()});var gu=_(()=>{"use strict";po();Ee()});var Lt=le((bx,vu)=>{"use strict";var bu=["nodebuffer","arraybuffer","fragments"],Su=typeof Blob<"u";Su&&bu.push("blob");vu.exports={BINARY_TYPES:bu,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Su,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var ni=le((Sx,_o)=>{"use strict";var{EMPTY_BUFFER:ey}=Lt(),as=Buffer[Symbol.species];function ty(e,t){if(e.length===0)return ey;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),r=0;for(let i=0;i<e.length;i++){let o=e[i];n.set(o,r),r+=o.length}return r<t?new as(n.buffer,n.byteOffset,r):n}function Tu(e,t,n,r,i){for(let o=0;o<i;o++)n[r+o]=e[o]^t[o&3]}function ku(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function ny(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function ss(e){if(ss.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new as(e):ArrayBuffer.isView(e)?t=new as(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),ss.readOnly=!1),t}_o.exports={concat:ty,mask:Tu,toArrayBuffer:ny,toBuffer:ss,unmask:ku};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=re("bufferutil");_o.exports.mask=function(t,n,r,i,o){o<48?Tu(t,n,r,i,o):e.mask(t,n,r,i,o)},_o.exports.unmask=function(t,n){t.length<32?ku(t,n):e.unmask(t,n)}}catch{}});var wu=le((vx,Au)=>{"use strict";var xu=Symbol("kDone"),ds=Symbol("kRun"),ls=class{constructor(t){this[xu]=()=>{this.pending--,this[ds]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[ds]()}[ds](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[xu])}}};Au.exports=ls});var ii=le((Tx,Pu)=>{"use strict";var ri=re("zlib"),Cu=ni(),ry=wu(),{kStatusCode:Ou}=Lt(),iy=Buffer[Symbol.species],oy=Buffer.from([0,0,255,255]),yo=Symbol("permessage-deflate"),Jt=Symbol("total-length"),ur=Symbol("callback"),un=Symbol("buffers"),cr=Symbol("error"),ho,us=class{constructor(t,n,r){if(this._maxPayload=r|0,this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!n,this._deflate=null,this._inflate=null,this.params=null,!ho){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;ho=new ry(i)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[ur];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let n=this._options,r=t.find(i=>!(n.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>i.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(r.server_no_context_takeover=!0),n.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(r.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?r.client_max_window_bits=n.clientMaxWindowBits:(r.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(t){let n=t[0];if(this._options.clientNoContextTakeover===!1&&n.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!n.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(n.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&n.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return n}normalizeParams(t){return t.forEach(n=>{Object.keys(n).forEach(r=>{let i=n[r];if(i.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(i=i[0],r==="client_max_window_bits"){if(i!==!0){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else if(r==="server_max_window_bits"){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=o}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else throw new Error(`Unknown parameter "${r}"`);n[r]=i})}),t}decompress(t,n,r){ho.add(i=>{this._decompress(t,n,(o,a)=>{i(),r(o,a)})})}compress(t,n,r){ho.add(i=>{this._compress(t,n,(o,a)=>{i(),r(o,a)})})}_decompress(t,n,r){let i=this._isServer?"client":"server";if(!this._inflate){let o=`${i}_max_window_bits`,a=typeof this.params[o]!="number"?ri.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=ri.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[yo]=this,this._inflate[Jt]=0,this._inflate[un]=[],this._inflate.on("error",sy),this._inflate.on("data",Eu)}this._inflate[ur]=r,this._inflate.write(t),n&&this._inflate.write(oy),this._inflate.flush(()=>{let o=this._inflate[cr];if(o){this._inflate.close(),this._inflate=null,r(o);return}let a=Cu.concat(this._inflate[un],this._inflate[Jt]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Jt]=0,this._inflate[un]=[],n&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),r(null,a)})}_compress(t,n,r){let i=this._isServer?"server":"client";if(!this._deflate){let o=`${i}_max_window_bits`,a=typeof this.params[o]!="number"?ri.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=ri.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[Jt]=0,this._deflate[un]=[],this._deflate.on("data",ay)}this._deflate[ur]=r,this._deflate.write(t),this._deflate.flush(ri.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=Cu.concat(this._deflate[un],this._deflate[Jt]);n&&(o=new iy(o.buffer,o.byteOffset,o.length-4)),this._deflate[ur]=null,this._deflate[Jt]=0,this._deflate[un]=[],n&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),r(null,o)})}};Pu.exports=us;function ay(e){this[un].push(e),this[Jt]+=e.length}function Eu(e){if(this[Jt]+=e.length,this[yo]._maxPayload<1||this[Jt]<=this[yo]._maxPayload){this[un].push(e);return}this[cr]=new RangeError("Max payload size exceeded"),this[cr].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[cr][Ou]=1009,this.removeListener("data",Eu),this.reset()}function sy(e){if(this[yo]._inflate=null,this[cr]){this[ur](this[cr]);return}e[Ou]=1007,this[ur](e)}});var fr=le((kx,go)=>{"use strict";var{isUtf8:Ru}=re("buffer"),{hasBlob:dy}=Lt(),ly=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function uy(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function cs(e){let t=e.length,n=0;for(;n<t;)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function cy(e){return dy&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}go.exports={isBlob:cy,isValidStatusCode:uy,isValidUTF8:cs,tokenChars:ly};if(Ru)go.exports.isValidUTF8=function(e){return e.length<24?cs(e):Ru(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=re("utf-8-validate");go.exports.isValidUTF8=function(t){return t.length<32?cs(t):e(t)}}catch{}});var hs=le((xx,Fu)=>{"use strict";var{Writable:fy}=re("stream"),Iu=ii(),{BINARY_TYPES:my,EMPTY_BUFFER:Mu,kStatusCode:py,kWebSocket:_y}=Lt(),{concat:fs,toArrayBuffer:hy,unmask:yy}=ni(),{isValidStatusCode:gy,isValidUTF8:Gu}=fr(),bo=Buffer[Symbol.species],ot=0,qu=1,ju=2,$u=3,ms=4,ps=5,So=6,_s=class extends fy{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||my[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[_y]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=ot}_write(t,n,r){if(this._opcode===8&&this._state==ot)return r();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(r)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new bo(r.buffer,r.byteOffset+t,r.length-t),new bo(r.buffer,r.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let r=this._buffers[0],i=n.length-t;t>=r.length?n.set(this._buffers.shift(),i):(n.set(new Uint8Array(r.buffer,r.byteOffset,t),i),this._buffers[0]=new bo(r.buffer,r.byteOffset+t,r.length-t)),t-=r.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case ot:this.getInfo(t);break;case qu:this.getPayloadLength16(t);break;case ju:this.getPayloadLength64(t);break;case $u:this.getMask();break;case ms:this.getData(t);break;case ps:case So:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let n=this.consume(2);if((n[0]&48)!==0){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(i);return}let r=(n[0]&64)===64;if(r&&!this._extensions[Iu.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(i);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(r){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(i);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(i);return}this._compressed=r}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(i);return}if(r){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(n[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(i);return}this._payloadLength===126?this._state=qu:this._payloadLength===127?this._state=ju:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let n=this.consume(8),r=n.readUInt32BE(0);if(r>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(i);return}this._payloadLength=r*Math.pow(2,32)+n.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(n);return}this._masked?this._state=$u:this._state=ms}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=ms}getData(t){let n=Mu;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}n=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&yy(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._compressed){this._state=ps,this.decompress(n,t);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(n)),this.dataMessage(t)}decompress(t,n){this._extensions[Iu.extensionName].decompress(t,this._fin,(i,o)=>{if(i)return n(i);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");n(a);return}this._fragments.push(o)}this.dataMessage(n),this._state===ot&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=ot;return}let n=this._messageLength,r=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=fs(r,n):this._binaryType==="arraybuffer"?i=hy(fs(r,n)):this._binaryType==="blob"?i=new Blob(r):i=r,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=ot):(this._state=So,setImmediate(()=>{this.emit("message",i,!0),this._state=ot,this.startLoop(t)}))}else{let i=fs(r,n);if(!this._skipUTF8Validation&&!Gu(i)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(o);return}this._state===ps||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=ot):(this._state=So,setImmediate(()=>{this.emit("message",i,!1),this._state=ot,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,Mu),this.end();else{let r=t.readUInt16BE(0);if(!gy(r)){let o=this.createError(RangeError,`invalid status code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(o);return}let i=new bo(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!Gu(i)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(o);return}this._loop=!1,this.emit("conclude",r,i),this.end()}this._state=ot;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=ot):(this._state=So,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=ot,this.startLoop(n)}))}createError(t,n,r,i,o){this._loop=!1,this._errored=!0;let a=new t(r?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(a,this.createError),a.code=o,a[py]=i,a}};Fu.exports=_s});var bs=le((wx,Lu)=>{"use strict";var{Duplex:Ax}=re("stream"),{randomFillSync:by}=re("crypto"),Nu=ii(),{EMPTY_BUFFER:Sy,kWebSocket:vy,NOOP:Ty}=Lt(),{isBlob:mr,isValidStatusCode:ky}=fr(),{mask:Du,toBuffer:Mn}=ni(),at=Symbol("kByteLength"),xy=Buffer.alloc(4),vo=8*1024,Gn,pr=vo,ct=0,Ay=1,wy=2,ys=class e{constructor(t,n,r){this._extensions=n||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ct,this.onerror=Ty,this[vy]=void 0}static frame(t,n){let r,i=!1,o=2,a=!1;n.mask&&(r=n.maskBuffer||xy,n.generateMask?n.generateMask(r):(pr===vo&&(Gn===void 0&&(Gn=Buffer.alloc(vo)),by(Gn,0,vo),pr=0),r[0]=Gn[pr++],r[1]=Gn[pr++],r[2]=Gn[pr++],r[3]=Gn[pr++]),a=(r[0]|r[1]|r[2]|r[3])===0,o=6);let s;typeof t=="string"?(!n.mask||a)&&n[at]!==void 0?s=n[at]:(t=Buffer.from(t),s=t.length):(s=t.length,i=n.mask&&n.readOnly&&!a);let l=s;s>=65536?(o+=8,l=127):s>125&&(o+=2,l=126);let u=Buffer.allocUnsafe(i?s+o:o);return u[0]=n.fin?n.opcode|128:n.opcode,n.rsv1&&(u[0]|=64),u[1]=l,l===126?u.writeUInt16BE(s,2):l===127&&(u[2]=u[3]=0,u.writeUIntBE(s,4,6)),n.mask?(u[1]|=128,u[o-4]=r[0],u[o-3]=r[1],u[o-2]=r[2],u[o-1]=r[3],a?[u,t]:i?(Du(t,r,u,o,s),[u]):(Du(t,r,t,0,s),[u,t])):[u,t]}close(t,n,r,i){let o;if(t===void 0)o=Sy;else{if(typeof t!="number"||!ky(t))throw new TypeError("First argument must be a valid error code number");if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let s=Buffer.byteLength(n);if(s>123)throw new RangeError("The message must not be greater than 123 bytes");o=Buffer.allocUnsafe(2+s),o.writeUInt16BE(t,0),typeof n=="string"?o.write(n,2):o.set(n,2)}}let a={[at]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ct?this.enqueue([this.dispatch,o,!1,a,i]):this.sendFrame(e.frame(o,a),i)}ping(t,n,r){let i,o;if(typeof t=="string"?(i=Buffer.byteLength(t),o=!1):mr(t)?(i=t.size,o=!1):(t=Mn(t),i=t.length,o=Mn.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[at]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};mr(t)?this._state!==ct?this.enqueue([this.getBlobData,t,!1,a,r]):this.getBlobData(t,!1,a,r):this._state!==ct?this.enqueue([this.dispatch,t,!1,a,r]):this.sendFrame(e.frame(t,a),r)}pong(t,n,r){let i,o;if(typeof t=="string"?(i=Buffer.byteLength(t),o=!1):mr(t)?(i=t.size,o=!1):(t=Mn(t),i=t.length,o=Mn.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[at]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};mr(t)?this._state!==ct?this.enqueue([this.getBlobData,t,!1,a,r]):this.getBlobData(t,!1,a,r):this._state!==ct?this.enqueue([this.dispatch,t,!1,a,r]):this.sendFrame(e.frame(t,a),r)}send(t,n,r){let i=this._extensions[Nu.extensionName],o=n.binary?2:1,a=n.compress,s,l;typeof t=="string"?(s=Buffer.byteLength(t),l=!1):mr(t)?(s=t.size,l=!1):(t=Mn(t),s=t.length,l=Mn.readOnly),this._firstFragment?(this._firstFragment=!1,a&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=s>=i._threshold),this._compress=a):(a=!1,o=0),n.fin&&(this._firstFragment=!0);let u={[at]:s,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:l,rsv1:a};mr(t)?this._state!==ct?this.enqueue([this.getBlobData,t,this._compress,u,r]):this.getBlobData(t,this._compress,u,r):this._state!==ct?this.enqueue([this.dispatch,t,this._compress,u,r]):this.dispatch(t,this._compress,u,r)}getBlobData(t,n,r,i){this._bufferedBytes+=r[at],this._state=wy,t.arrayBuffer().then(o=>{if(this._socket.destroyed){let s=new Error("The socket was closed while the blob was being read");process.nextTick(gs,this,s,i);return}this._bufferedBytes-=r[at];let a=Mn(o);n?this.dispatch(a,n,r,i):(this._state=ct,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(o=>{process.nextTick(Cy,this,o,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let o=this._extensions[Nu.extensionName];this._bufferedBytes+=r[at],this._state=Ay,o.compress(t,r.fin,(a,s)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");gs(this,l,i);return}this._bufferedBytes-=r[at],this._state=ct,r.readOnly=!1,this.sendFrame(e.frame(s,r),i),this.dequeue()})}dequeue(){for(;this._state===ct&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][at],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][at],this._queue.push(t)}sendFrame(t,n){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],n),this._socket.uncork()):this._socket.write(t[0],n)}};Lu.exports=ys;function gs(e,t,n){typeof n=="function"&&n(t);for(let r=0;r<e._queue.length;r++){let i=e._queue[r],o=i[i.length-1];typeof o=="function"&&o(t)}}function Cy(e,t,n){gs(e,t,n),e.onerror(t)}});var Qu=le((Cx,Vu)=>{"use strict";var{kForOnEventAttribute:oi,kListener:Ss}=Lt(),Ju=Symbol("kCode"),Uu=Symbol("kData"),Bu=Symbol("kError"),Ku=Symbol("kMessage"),zu=Symbol("kReason"),_r=Symbol("kTarget"),Wu=Symbol("kType"),Hu=Symbol("kWasClean"),Ut=class{constructor(t){this[_r]=null,this[Wu]=t}get target(){return this[_r]}get type(){return this[Wu]}};Object.defineProperty(Ut.prototype,"target",{enumerable:!0});Object.defineProperty(Ut.prototype,"type",{enumerable:!0});var qn=class extends Ut{constructor(t,n={}){super(t),this[Ju]=n.code===void 0?0:n.code,this[zu]=n.reason===void 0?"":n.reason,this[Hu]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[Ju]}get reason(){return this[zu]}get wasClean(){return this[Hu]}};Object.defineProperty(qn.prototype,"code",{enumerable:!0});Object.defineProperty(qn.prototype,"reason",{enumerable:!0});Object.defineProperty(qn.prototype,"wasClean",{enumerable:!0});var hr=class extends Ut{constructor(t,n={}){super(t),this[Bu]=n.error===void 0?null:n.error,this[Ku]=n.message===void 0?"":n.message}get error(){return this[Bu]}get message(){return this[Ku]}};Object.defineProperty(hr.prototype,"error",{enumerable:!0});Object.defineProperty(hr.prototype,"message",{enumerable:!0});var ai=class extends Ut{constructor(t,n={}){super(t),this[Uu]=n.data===void 0?null:n.data}get data(){return this[Uu]}};Object.defineProperty(ai.prototype,"data",{enumerable:!0});var Oy={addEventListener(e,t,n={}){for(let i of this.listeners(e))if(!n[oi]&&i[Ss]===t&&!i[oi])return;let r;if(e==="message")r=function(o,a){let s=new ai("message",{data:a?o:o.toString()});s[_r]=this,To(t,this,s)};else if(e==="close")r=function(o,a){let s=new qn("close",{code:o,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[_r]=this,To(t,this,s)};else if(e==="error")r=function(o){let a=new hr("error",{error:o,message:o.message});a[_r]=this,To(t,this,a)};else if(e==="open")r=function(){let o=new Ut("open");o[_r]=this,To(t,this,o)};else return;r[oi]=!!n[oi],r[Ss]=t,n.once?this.once(e,r):this.on(e,r)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[Ss]===t&&!n[oi]){this.removeListener(e,n);break}}};Vu.exports={CloseEvent:qn,ErrorEvent:hr,Event:Ut,EventTarget:Oy,MessageEvent:ai};function To(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}});var vs=le((Ox,Zu)=>{"use strict";var{tokenChars:si}=fr();function kt(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function Ey(e){let t=Object.create(null),n=Object.create(null),r=!1,i=!1,o=!1,a,s,l=-1,u=-1,d=-1,m=0;for(;m<e.length;m++)if(u=e.charCodeAt(m),a===void 0)if(d===-1&&si[u]===1)l===-1&&(l=m);else if(m!==0&&(u===32||u===9))d===-1&&l!==-1&&(d=m);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${m}`);d===-1&&(d=m);let f=e.slice(l,d);u===44?(kt(t,f,n),n=Object.create(null)):a=f,l=d=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);else if(s===void 0)if(d===-1&&si[u]===1)l===-1&&(l=m);else if(u===32||u===9)d===-1&&l!==-1&&(d=m);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${m}`);d===-1&&(d=m),kt(n,e.slice(l,d),!0),u===44&&(kt(t,a,n),n=Object.create(null),a=void 0),l=d=-1}else if(u===61&&l!==-1&&d===-1)s=e.slice(l,m),l=d=-1;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(i){if(si[u]!==1)throw new SyntaxError(`Unexpected character at index ${m}`);l===-1?l=m:r||(r=!0),i=!1}else if(o)if(si[u]===1)l===-1&&(l=m);else if(u===34&&l!==-1)o=!1,d=m;else if(u===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(u===34&&e.charCodeAt(m-1)===61)o=!0;else if(d===-1&&si[u]===1)l===-1&&(l=m);else if(l!==-1&&(u===32||u===9))d===-1&&(d=m);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${m}`);d===-1&&(d=m);let f=e.slice(l,d);r&&(f=f.replace(/\\/g,""),r=!1),kt(n,s,f),u===44&&(kt(t,a,n),n=Object.create(null),a=void 0),s=void 0,l=d=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);if(l===-1||o||u===32||u===9)throw new SyntaxError("Unexpected end of input");d===-1&&(d=m);let p=e.slice(l,d);return a===void 0?kt(t,p,n):(s===void 0?kt(n,p,!0):r?kt(n,s,p.replace(/\\/g,"")):kt(n,s,p),kt(t,a,n)),t}function Py(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(r=>[t].concat(Object.keys(r).map(i=>{let o=r[i];return Array.isArray(o)||(o=[o]),o.map(a=>a===!0?i:`${i}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Zu.exports={format:Py,parse:Ey}});var wo=le((Rx,lc)=>{"use strict";var Ry=re("events"),Iy=re("https"),My=re("http"),ec=re("net"),Gy=re("tls"),{randomBytes:qy,createHash:jy}=re("crypto"),{Duplex:Ex,Readable:Px}=re("stream"),{URL:Ts}=re("url"),cn=ii(),$y=hs(),Fy=bs(),{isBlob:Ny}=fr(),{BINARY_TYPES:Yu,EMPTY_BUFFER:ko,GUID:Dy,kForOnEventAttribute:ks,kListener:Ly,kStatusCode:Jy,kWebSocket:Ge,NOOP:tc}=Lt(),{EventTarget:{addEventListener:Uy,removeEventListener:By}}=Qu(),{format:Ky,parse:zy}=vs(),{toBuffer:Wy}=ni(),Hy=30*1e3,nc=Symbol("kAborted"),xs=[8,13],Bt=["CONNECTING","OPEN","CLOSING","CLOSED"],Vy=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,pe=class e extends Ry{constructor(t,n,r){super(),this._binaryType=Yu[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ko,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n=="object"&&n!==null?(r=n,n=[]):n=[n]),rc(this,t,n,r)):(this._autoPong=r.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Yu.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new $y({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),o=new Fy(t,this._extensions,r.generateMask);this._receiver=i,this._sender=o,this._socket=t,i[Ge]=this,o[Ge]=this,t[Ge]=this,i.on("conclude",Yy),i.on("drain",Xy),i.on("error",eg),i.on("message",tg),i.on("ping",ng),i.on("pong",rg),o.onerror=ig,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",ac),t.on("data",Ao),t.on("end",sc),t.on("error",dc),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[cn.extensionName]&&this._extensions[cn.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Xe(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),oc(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){As(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||ko,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){As(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||ko,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(r=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){As(this,t,r);return}let i={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[cn.extensionName]||(i.compress=!1),this._sender.send(t||ko,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Xe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(pe,"CONNECTING",{enumerable:!0,value:Bt.indexOf("CONNECTING")});Object.defineProperty(pe.prototype,"CONNECTING",{enumerable:!0,value:Bt.indexOf("CONNECTING")});Object.defineProperty(pe,"OPEN",{enumerable:!0,value:Bt.indexOf("OPEN")});Object.defineProperty(pe.prototype,"OPEN",{enumerable:!0,value:Bt.indexOf("OPEN")});Object.defineProperty(pe,"CLOSING",{enumerable:!0,value:Bt.indexOf("CLOSING")});Object.defineProperty(pe.prototype,"CLOSING",{enumerable:!0,value:Bt.indexOf("CLOSING")});Object.defineProperty(pe,"CLOSED",{enumerable:!0,value:Bt.indexOf("CLOSED")});Object.defineProperty(pe.prototype,"CLOSED",{enumerable:!0,value:Bt.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(pe.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(pe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[ks])return t[Ly];return null},set(t){for(let n of this.listeners(e))if(n[ks]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[ks]:!0})}})});pe.prototype.addEventListener=Uy;pe.prototype.removeEventListener=By;lc.exports=pe;function rc(e,t,n,r){let i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:xs[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=i.autoPong,!xs.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${xs.join(", ")})`);let o;if(t instanceof Ts)o=t;else try{o=new Ts(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}o.protocol==="http:"?o.protocol="ws:":o.protocol==="https:"&&(o.protocol="wss:"),e._url=o.href;let a=o.protocol==="wss:",s=o.protocol==="ws+unix:",l;if(o.protocol!=="ws:"&&!a&&!s?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:s&&!o.pathname?l="The URL's pathname is empty":o.hash&&(l="The URL contains a fragment identifier"),l){let c=new SyntaxError(l);if(e._redirects===0)throw c;xo(e,c);return}let u=a?443:80,d=qy(16).toString("base64"),m=a?Iy.request:My.request,p=new Set,f;if(i.createConnection=i.createConnection||(a?Zy:Qy),i.defaultPort=i.defaultPort||u,i.port=o.port||u,i.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":d,Connection:"Upgrade",Upgrade:"websocket"},i.path=o.pathname+o.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(f=new cn(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=Ky({[cn.extensionName]:f.offer()})),n.length){for(let c of n){if(typeof c!="string"||!Vy.test(c)||p.has(c))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(c)}i.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(o.username||o.password)&&(i.auth=`${o.username}:${o.password}`),s){let c=i.path.split(":");i.socketPath=c[0],i.path=c[1]}let h;if(i.followRedirects){if(e._redirects===0){e._originalIpc=s,e._originalSecure=a,e._originalHostOrSocketPath=s?i.socketPath:o.host;let c=r&&r.headers;if(r={...r,headers:{}},c)for(let[y,b]of Object.entries(c))r.headers[y.toLowerCase()]=b}else if(e.listenerCount("redirect")===0){let c=s?e._originalIpc?i.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:o.host===e._originalHostOrSocketPath;(!c||e._originalSecure&&!a)&&(delete i.headers.authorization,delete i.headers.cookie,c||delete i.headers.host,i.auth=void 0)}i.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),h=e._req=m(i),e._redirects&&e.emit("redirect",e.url,h)}else h=e._req=m(i);i.timeout&&h.on("timeout",()=>{Xe(e,h,"Opening handshake has timed out")}),h.on("error",c=>{h===null||h[nc]||(h=e._req=null,xo(e,c))}),h.on("response",c=>{let y=c.headers.location,b=c.statusCode;if(y&&i.followRedirects&&b>=300&&b<400){if(++e._redirects>i.maxRedirects){Xe(e,h,"Maximum redirects exceeded");return}h.abort();let T;try{T=new Ts(y,t)}catch{let g=new SyntaxError(`Invalid URL: ${y}`);xo(e,g);return}rc(e,T,n,r)}else e.emit("unexpected-response",h,c)||Xe(e,h,`Unexpected server response: ${c.statusCode}`)}),h.on("upgrade",(c,y,b)=>{if(e.emit("upgrade",c),e.readyState!==pe.CONNECTING)return;h=e._req=null;let T=c.headers.upgrade;if(T===void 0||T.toLowerCase()!=="websocket"){Xe(e,y,"Invalid Upgrade header");return}let v=jy("sha1").update(d+Dy).digest("base64");if(c.headers["sec-websocket-accept"]!==v){Xe(e,y,"Invalid Sec-WebSocket-Accept header");return}let g=c.headers["sec-websocket-protocol"],R;if(g!==void 0?p.size?p.has(g)||(R="Server sent an invalid subprotocol"):R="Server sent a subprotocol but none was requested":p.size&&(R="Server sent no subprotocol"),R){Xe(e,y,R);return}g&&(e._protocol=g);let M=c.headers["sec-websocket-extensions"];if(M!==void 0){if(!f){Xe(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let W;try{W=zy(M)}catch{Xe(e,y,"Invalid Sec-WebSocket-Extensions header");return}let be=Object.keys(W);if(be.length!==1||be[0]!==cn.extensionName){Xe(e,y,"Server indicated an extension that was not requested");return}try{f.accept(W[cn.extensionName])}catch{Xe(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[cn.extensionName]=f}e.setSocket(y,b,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(h,e):h.end()}function xo(e,t){e._readyState=pe.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function Qy(e){return e.path=e.socketPath,ec.connect(e)}function Zy(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=ec.isIP(e.host)?"":e.host),Gy.connect(e)}function Xe(e,t,n){e._readyState=pe.CLOSING;let r=new Error(n);Error.captureStackTrace(r,Xe),t.setHeader?(t[nc]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(xo,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function As(e,t,n){if(t){let r=Ny(t)?t.size:Wy(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}if(n){let r=new Error(`WebSocket is not open: readyState ${e.readyState} (${Bt[e.readyState]})`);process.nextTick(n,r)}}function Yy(e,t){let n=this[Ge];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[Ge]!==void 0&&(n._socket.removeListener("data",Ao),process.nextTick(ic,n._socket),e===1005?n.close():n.close(e,t))}function Xy(){let e=this[Ge];e.isPaused||e._socket.resume()}function eg(e){let t=this[Ge];t._socket[Ge]!==void 0&&(t._socket.removeListener("data",Ao),process.nextTick(ic,t._socket),t.close(e[Jy])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function Xu(){this[Ge].emitClose()}function tg(e,t){this[Ge].emit("message",e,t)}function ng(e){let t=this[Ge];t._autoPong&&t.pong(e,!this._isServer,tc),t.emit("ping",e)}function rg(e){this[Ge].emit("pong",e)}function ic(e){e.resume()}function ig(e){let t=this[Ge];t.readyState!==pe.CLOSED&&(t.readyState===pe.OPEN&&(t._readyState=pe.CLOSING,oc(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function oc(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),Hy)}function ac(){let e=this[Ge];this.removeListener("close",ac),this.removeListener("data",Ao),this.removeListener("end",sc),e._readyState=pe.CLOSING;let t;!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&(t=e._socket.read())!==null&&e._receiver.write(t),e._receiver.end(),this[Ge]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Xu),e._receiver.on("finish",Xu))}function Ao(e){this[Ge]._receiver.write(e)||this.pause()}function sc(){let e=this[Ge];e._readyState=pe.CLOSING,e._receiver.end(),this.end()}function dc(){let e=this[Ge];this.removeListener("error",dc),this.on("error",tc),e&&(e._readyState=pe.CLOSING,this.destroy())}});var mc=le((Mx,fc)=>{"use strict";var Ix=wo(),{Duplex:og}=re("stream");function uc(e){e.emit("close")}function ag(){!this.destroyed&&this._writableState.finished&&this.destroy()}function cc(e){this.removeListener("error",cc),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function sg(e,t){let n=!0,r=new og({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(o,a){let s=!a&&r._readableState.objectMode?o.toString():o;r.push(s)||e.pause()}),e.once("error",function(o){r.destroyed||(n=!1,r.destroy(o))}),e.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(i,o){if(e.readyState===e.CLOSED){o(i),process.nextTick(uc,r);return}let a=!1;e.once("error",function(l){a=!0,o(l)}),e.once("close",function(){a||o(i),process.nextTick(uc,r)}),n&&e.terminate()},r._final=function(i){if(e.readyState===e.CONNECTING){e.once("open",function(){r._final(i)});return}e._socket!==null&&(e._socket._writableState.finished?(i(),r._readableState.endEmitted&&r.destroy()):(e._socket.once("finish",function(){i()}),e.close()))},r._read=function(){e.isPaused&&e.resume()},r._write=function(i,o,a){if(e.readyState===e.CONNECTING){e.once("open",function(){r._write(i,o,a)});return}e.send(i,a)},r.on("end",ag),r.on("error",cc),r}fc.exports=sg});var _c=le((Gx,pc)=>{"use strict";var{tokenChars:dg}=fr();function lg(e){let t=new Set,n=-1,r=-1,i=0;for(i;i<e.length;i++){let a=e.charCodeAt(i);if(r===-1&&dg[a]===1)n===-1&&(n=i);else if(i!==0&&(a===32||a===9))r===-1&&n!==-1&&(r=i);else if(a===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${i}`);r===-1&&(r=i);let s=e.slice(n,r);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);t.add(s),n=r=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(n===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let o=e.slice(n,i);if(t.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}pc.exports={parse:lg}});var Tc=le((jx,vc)=>{"use strict";var ug=re("events"),Co=re("http"),{Duplex:qx}=re("stream"),{createHash:cg}=re("crypto"),hc=vs(),jn=ii(),fg=_c(),mg=wo(),{GUID:pg,kWebSocket:_g}=Lt(),hg=/^[+/0-9A-Za-z]{22}==$/,yc=0,gc=1,Sc=2,ws=class extends ug{constructor(t,n){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:mg,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Co.createServer((r,i)=>{let o=Co.STATUS_CODES[426];i.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),i.end(o)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=yg(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,o,a)=>{this.handleUpgrade(i,o,a,r)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=yc}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===Sc){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(di,this);return}if(t&&this.once("close",t),this._state!==gc)if(this._state=gc,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(di,this):process.nextTick(di,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{di(this)})}}shouldHandle(t){if(this.options.path){let n=t.url.indexOf("?");if((n!==-1?t.url.slice(0,n):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,n,r,i){n.on("error",bc);let o=t.headers["sec-websocket-key"],a=t.headers.upgrade,s=+t.headers["sec-websocket-version"];if(t.method!=="GET"){$n(this,t,n,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){$n(this,t,n,400,"Invalid Upgrade header");return}if(o===void 0||!hg.test(o)){$n(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(s!==13&&s!==8){$n(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){li(n,400);return}let l=t.headers["sec-websocket-protocol"],u=new Set;if(l!==void 0)try{u=fg.parse(l)}catch{$n(this,t,n,400,"Invalid Sec-WebSocket-Protocol header");return}let d=t.headers["sec-websocket-extensions"],m={};if(this.options.perMessageDeflate&&d!==void 0){let p=new jn(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let f=hc.parse(d);f[jn.extensionName]&&(p.accept(f[jn.extensionName]),m[jn.extensionName]=p)}catch{$n(this,t,n,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={origin:t.headers[`${s===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(p,(f,h,c,y)=>{if(!f)return li(n,h||401,c,y);this.completeUpgrade(m,o,u,t,n,r,i)});return}if(!this.options.verifyClient(p))return li(n,401)}this.completeUpgrade(m,o,u,t,n,r,i)}completeUpgrade(t,n,r,i,o,a,s){if(!o.readable||!o.writable)return o.destroy();if(o[_g])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>yc)return li(o,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${cg("sha1").update(n+pg).digest("base64")}`],d=new this.options.WebSocket(null,void 0,this.options);if(r.size){let m=this.options.handleProtocols?this.options.handleProtocols(r,i):r.values().next().value;m&&(u.push(`Sec-WebSocket-Protocol: ${m}`),d._protocol=m)}if(t[jn.extensionName]){let m=t[jn.extensionName].params,p=hc.format({[jn.extensionName]:[m]});u.push(`Sec-WebSocket-Extensions: ${p}`),d._extensions=t}this.emit("headers",u,i),o.write(u.concat(`\r
7
7
  `).join(`\r
@@ -11,13 +11,13 @@ GFS4: `),console.error(e)});he[Ne]||(gl=global[Ne]||[],Sl(he,gl),he.close=(funct
11
11
  \r
12
12
  `+n)}function $n(e,t,n,r,i,o){if(e.listenerCount("wsClientError")){let a=new Error(i);Error.captureStackTrace(a,$n),e.emit("wsClientError",a,n,t)}else li(n,r,i,o)}});var gg,bg,Sg,kc,vg,xc=_(()=>{gg=bt(mc(),1),bg=bt(hs(),1),Sg=bt(bs(),1),kc=bt(wo(),1),vg=bt(Tc(),1)});var Te=_(()=>{"use strict";Ee()});var xt,Ac=_(()=>{xt={_generated:"GENERATED by scripts/naming_dual_emit_codegen.mjs from scripts/naming_canonical_key_map.json (N2.2 dual-emit, D46) - DO NOT EDIT; run: node scripts/naming_dual_emit_codegen.mjs --write",events:[["codex.agent_turn_narration_only_no_reply","harness.agent_turn_narration_only_no_reply"],["codex.cost_cap_402_seen","harness.cost_cap_402_seen"],["codex.edge_blocked_captured","harness.edge_blocked_captured"],["codex.empty_turn_auto_retry_suppressed_cost_cap","harness.empty_turn_auto_retry_suppressed_cost_cap"],["codex.empty_turn_loop_guard_tripped","harness.empty_turn_loop_guard_tripped"],["codex.error_without_http_status_captured","harness.error_without_http_status_captured"],["codex.mid_stream_stall_auto_resume_flagged","harness.mid_stream_stall_auto_resume_flagged"],["codex.mid_stream_stall_fresh_session_resume","harness.mid_stream_stall_fresh_session_resume"],["codex.mid_stream_stall_fresh_session_resume_failed","harness.mid_stream_stall_fresh_session_resume_failed"],["codex.mid_stream_stall_fresh_session_resume_flagged","harness.mid_stream_stall_fresh_session_resume_flagged"],["codex.mid_stream_stall_resume_suppressed_rate_limit","harness.mid_stream_stall_resume_suppressed_rate_limit"],["codex.mid_stream_stall_second_stall_after_resume","harness.mid_stream_stall_second_stall_after_resume"],["codex.pre_first_byte_stall_auto_retry_flagged","harness.pre_first_byte_stall_auto_retry_flagged"],["codex.pre_first_byte_stall_retry_suppressed_cost_cap","harness.pre_first_byte_stall_retry_suppressed_cost_cap"],["codex.provider_outage_flagged_captured","harness.provider_outage_flagged_captured"],["codex.reasoning_loop_breaker_tripped","harness.reasoning_loop_breaker_tripped"],["codex.tool_fatal_captured","harness.tool_fatal_captured"],["codex.turn_completed","job.turn_completed"],["codex.turn_completed_with_protocol_failure","job.turn_completed_with_protocol_failure"],["codex.turn_completed_with_unsupported_tool_call_ignored","job.turn_completed_with_unsupported_tool_call_ignored"],["codex.turn_completed_without_assistant_output","job.turn_completed_without_assistant_output"],["codex.turn_demoted_late_upstream_error","job.turn_demoted_late_upstream_error"],["codex.turn_forward_failed","job.turn_forward_failed"],["codex.upstream_error_captured","harness.upstream_error_captured"],["codex.upstream_rejection_captured","harness.upstream_rejection_captured"],["codex.upstream_turn_error_captured","harness.upstream_turn_error_captured"],["kandan.chat_event","linzumi.chat_event"],["kandan.chat_event_abandoned","linzumi.chat_event_abandoned"],["kandan.chat_event_failed","linzumi.chat_event_failed"],["kandan.chat_event_failure_cleared","linzumi.chat_event_failure_cleared"],["kandan.child_thread_event_failed","linzumi.child_thread_event_failed"],["kandan.child_thread_event_skipped_missing_thread_binding","linzumi.child_thread_event_skipped_missing_thread_binding"],["kandan.child_thread_upsert_failed","linzumi.child_thread_upsert_failed"],["kandan.child_thread_upsert_skipped_missing_thread_binding","linzumi.child_thread_upsert_skipped_missing_thread_binding"],["kandan.claude_code_interrupt_state_push_failed","linzumi.claude_code_interrupt_state_push_failed"],["kandan.claude_code_stop_state_push_failed","linzumi.claude_code_stop_state_push_failed"],["kandan.claude_code_typing_heartbeat_failed","linzumi.claude_code_typing_heartbeat_failed"],["kandan.claude_code_typing_start_wait_timeout","linzumi.claude_code_typing_start_wait_timeout"],["kandan.claude_code_typing_stop_failed","linzumi.claude_code_typing_stop_failed"],["kandan.claude_code_user_input_abort_publish_failed","linzumi.claude_code_user_input_abort_publish_failed"],["kandan.claude_code_user_question_completed_publish_failed","linzumi.claude_code_user_question_completed_publish_failed"],["kandan.codex_command_output_forwarded","linzumi.codex_command_output_forwarded"],["kandan.codex_delta_forwarded","linzumi.codex_delta_forwarded"],["kandan.codex_file_change_forwarded","linzumi.codex_file_change_forwarded"],["kandan.codex_notification_push_failed","linzumi.codex_notification_push_failed"],["kandan.codex_output_forwarded","linzumi.codex_output_forwarded"],["kandan.codex_reasoning_delta_forwarded","linzumi.codex_reasoning_delta_forwarded"],["kandan.codex_web_search_progress_forwarded","linzumi.codex_web_search_progress_forwarded"],["kandan.connection_force_reconnect","linzumi.connection_force_reconnect"],["kandan.connection_force_reconnect_dispatched","linzumi.connection_force_reconnect_dispatched"],["kandan.connection_hard_reset","linzumi.connection_hard_reset"],["kandan.connection_hard_reset_exhausted","linzumi.connection_hard_reset_exhausted"],["kandan.connection_recovered","linzumi.connection_recovered"],["kandan.connection_stale","linzumi.connection_stale"],["kandan.connection_unrecoverable","linzumi.connection_unrecoverable"],["kandan.control","linzumi.control"],["kandan.control_ack_withheld_on_failure","linzumi.control_ack_withheld_on_failure"],["kandan.control_epoch_changed","linzumi.control_epoch_changed"],["kandan.control_handler_threw","linzumi.control_handler_threw"],["kandan.control_ignored","linzumi.control_ignored"],["kandan.control_response_push_failed","linzumi.control_response_push_failed"],["kandan.failed_seq_overflow","linzumi.failed_seq_overflow"],["kandan.forward_port_revoked_push_failed","linzumi.forward_port_revoked_push_failed"],["kandan.forward_response","linzumi.forward_response"],["kandan.forward_response_push_failed","linzumi.forward_response_push_failed"],["kandan.forward_tunnel_error","linzumi.forward_tunnel_error"],["kandan.forward_tunnel_open_failed","linzumi.forward_tunnel_open_failed"],["kandan.heartbeat_push_failed","linzumi.heartbeat_push_failed"],["kandan.local_editor_initial_status_failed","linzumi.local_editor_initial_status_failed"],["kandan.local_editor_status_push_failed","linzumi.local_editor_status_push_failed"],["kandan.message_duplicate_ignored","linzumi.message_duplicate_ignored"],["kandan.message_ignored","linzumi.message_ignored"],["kandan.message_queued","linzumi.message_queued"],["kandan.message_spawn_on_miss","linzumi.message_spawn_on_miss"],["kandan.message_spawn_on_miss_failed","linzumi.message_spawn_on_miss_failed"],["kandan.message_state_refresh_failed","linzumi.message_state_refresh_failed"],["kandan.optional_push_failed","linzumi.optional_push_failed"],["kandan.post_stop_queue_drain_failed","linzumi.post_stop_queue_drain_failed"],["kandan.queue_drain_blocked","linzumi.queue_drain_blocked"],["kandan.queue_drain_dead_worker_fail_publish_failed","linzumi.queue_drain_dead_worker_fail_publish_failed"],["kandan.queue_drain_dead_worker_rebuild","linzumi.queue_drain_dead_worker_rebuild"],["kandan.queue_drain_dead_worker_rebuild_exhausted","linzumi.queue_drain_dead_worker_rebuild_exhausted"],["kandan.queue_drain_dead_worker_rebuild_failed","linzumi.queue_drain_dead_worker_rebuild_failed"],["kandan.reconnect_handling_failed","linzumi.reconnect_handling_failed"],["kandan.reconnect_thread_context_fetch_failed","linzumi.reconnect_thread_context_fetch_failed"],["kandan.reconnect_thread_cwd_failed_state_push_failed","linzumi.reconnect_thread_cwd_failed_state_push_failed"],["kandan.reconnect_thread_failed","linzumi.reconnect_thread_failed"],["kandan.reconnect_thread_processing_state_push_failed","linzumi.reconnect_thread_processing_state_push_failed"],["kandan.reconnect_thread_queue_closed_state_push_failed","linzumi.reconnect_thread_queue_closed_state_push_failed"],["kandan.reconnect_thread_queue_failed_state_push_failed","linzumi.reconnect_thread_queue_failed_state_push_failed"],["kandan.reconnect_thread_queue_state_push_failed","linzumi.reconnect_thread_queue_state_push_failed"],["kandan.reconnect_thread_rehydrate_forced","linzumi.reconnect_thread_rehydrate_forced"],["kandan.reconnect_thread_rehydrated","linzumi.reconnect_thread_rehydrated"],["kandan.reconnect_thread_rehydrated_state_push_failed","linzumi.reconnect_thread_rehydrated_state_push_failed"],["kandan.reconnect_thread_rehydration_failed","linzumi.reconnect_thread_rehydration_failed"],["kandan.reconnect_thread_rehydration_ir_emitted","linzumi.reconnect_thread_rehydration_ir_emitted"],["kandan.reconnect_thread_rehydration_items_failed","linzumi.reconnect_thread_rehydration_items_failed"],["kandan.reconnect_thread_resume_failed","linzumi.reconnect_thread_resume_failed"],["kandan.reconnect_thread_seq_already_applied","linzumi.reconnect_thread_seq_already_applied"],["kandan.reconnect_thread_transcript_fetch_failed","linzumi.reconnect_thread_transcript_fetch_failed"],["kandan.reconnect_thread_unarchive_failed","linzumi.reconnect_thread_unarchive_failed"],["kandan.reconnect_thread_unarchive_resumed","linzumi.reconnect_thread_unarchive_resumed"],["kandan.reconnect_thread_unarchive_started","linzumi.reconnect_thread_unarchive_started"],["kandan.reconnect_thread_unavailable_state_push_failed","linzumi.reconnect_thread_unavailable_state_push_failed"],["kandan.reconnected","linzumi.reconnected"],["kandan.roster_seeded","linzumi.roster_seeded"],["kandan.session_app_server_lost_push_failed","linzumi.session_app_server_lost_push_failed"],["kandan.session_settings_publish_failed","linzumi.session_settings_publish_failed"],["kandan.start_instance_claude_code_attachment_failed_state_push_failed","linzumi.start_instance_claude_code_attachment_failed_state_push_failed"],["kandan.start_instance_codex_app_server_unavailable","linzumi.start_instance_codex_app_server_unavailable"],["kandan.start_instance_cwd_failed_state_push_failed","linzumi.start_instance_cwd_failed_state_push_failed"],["kandan.start_instance_cwd_rejected","linzumi.start_instance_cwd_rejected"],["kandan.start_instance_failed","linzumi.start_instance_failed"],["kandan.start_instance_processing_state_push_failed","linzumi.start_instance_processing_state_push_failed"],["kandan.start_instance_skipped_known_session","linzumi.start_instance_skipped_known_session"],["kandan.start_instance_stale_skipped","linzumi.start_instance_stale_skipped"],["kandan.start_instance_unavailable_state_push_failed","linzumi.start_instance_unavailable_state_push_failed"],["kandan.start_instance_wafer_state_push_failed","linzumi.start_instance_wafer_state_push_failed"],["kandan.start_turn_replay_skipped","linzumi.start_turn_replay_skipped"],["kandan.steer_duplicate_ignored","linzumi.steer_duplicate_ignored"],["kandan.steer_parked_as_own_turn","linzumi.steer_parked_as_own_turn"],["kandan.thread_bind_from_historical_reply_failed","linzumi.thread_bind_from_historical_reply_failed"],["kandan.thread_bound_from_historical_reply","linzumi.thread_bound_from_historical_reply"],["kandan.thread_sessions_reannounce_failed","linzumi.thread_sessions_reannounce_failed"],["kandan.thread_sessions_reannounced","linzumi.thread_sessions_reannounced"],["kandan.tui_input_mirrored","linzumi.tui_input_mirrored"],["kandan.typing_heartbeat_failed","linzumi.typing_heartbeat_failed"],["kandan.typing_stop_after_completion_failed","linzumi.typing_stop_after_completion_failed"]],keys:[["codexThreadId","harness_session_id"],["codex_thread_id","harness_session_id"],["kandanThreadId","thread_id"],["kandan_preview_ticket","linzumi_preview_ticket"],["kandan_thread_id","thread_id"],["linzumiThreadId","thread_id"],["linzumi_thread_id","thread_id"],["local_codex_runner","commander"],["runnerId","commander_id"],["runner_config","commander_config"],["runner_id","commander_id"]],keyPrimaryLegacy:[["commander","local_codex_runner"],["commander_config","runner_config"],["commander_id","runner_id"],["harness_session_id","codex_thread_id"],["linzumi_preview_ticket","kandan_preview_ticket"],["thread_id","kandan_thread_id"]],values:[["engine_boot_reconnect","harness_boot_reconnect"],["engine_for_runner_event_type","harness_for_commander_event_type"],["engine_rejected_steer","harness_rejected_steer"],["engine_unavailable","harness_unavailable"],["join_engine","join_harness"],["kandan-local-codex-runner","linzumi-commander"],["local_codex_runner","commander"],["original_engine","original_harness"],["resume_engine","resume_harness"]],topic:{legacyPrefix:"local_codex_runner:",canonicalPrefix:"commander:"},originator:{legacy:"kandan-local-codex-runner",canonical:"linzumi-commander"}}});function Ec(e){let t=new Set(e);for(let n of e){let r=Cc.get(n);r!==void 0&&t.add(r);let i=Oc.get(n);i!==void 0&&t.add(i)}return t}var kg,xg,Cc,Oc,Ag,wg,Jx,wc,Cs=_(()=>{"use strict";Ac();kg=new Map(xt.events),xg=new Map(xt.events.map(([e,t])=>[t,e])),Cc=new Map(xt.keys),Oc=new Map(xt.keyPrimaryLegacy),Ag=new Map(xt.values),wg=new Map(xt.values.map(([e,t])=>[t,e])),Jx={eventCanonicalByLegacy:kg,eventLegacyByCanonical:xg,keyCanonicalByLegacy:Cc,keyPrimaryLegacyByCanonical:Oc,valueCanonicalByLegacy:Ag,valueLegacyByCanonical:wg,originator:xt.originator,topic:xt.topic};wc=new Map;for(let[e,t]of xt.keys){let n=wc.get(t)??[];n.push(e),wc.set(t,n)}});import{appendFileSync as Og,openSync as zx}from"node:fs";import{homedir as Pc}from"node:os";import{dirname as Eg,join as Rc,resolve as Pg,sep as Rg}from"node:path";import{mkdirSync as Ig}from"node:fs";function Gg(e){if(process.env.VITEST===void 0)return;let t=Rc(Pc(),".linzumi"),n=Pg(e);if(n===t||n.startsWith(`${t}${Rg}`))throw new Error(`test-mode log isolation violated: refusing to open ${e} inside the real ~/.linzumi (point the logger at a temp path; the harness defaults LINZUMI_RUNNER_LOG_FILE / LINZUMI_CLI_AUDIT_LOG for exactly this - see plans/2026-07-10-cli-test-hygiene-spec.md item 2)`)}function Nn(e,t,n={}){let r=n.logFile??qg();Gg(r);try{Ig(Eg(r),{recursive:!0}),Og(r,`${JSON.stringify({ts:new Date().toISOString(),event:e,...n.sessionId===void 0?{}:{sessionId:n.sessionId},...Os(t)})}
13
13
  `,"utf8")}catch(i){console.warn("cli.audit_write_failed",{event:e,code:i instanceof Error&&"code"in i&&typeof i.code=="string"?i.code:"audit_write_error"});return}}function qg(){let e=process.env.LINZUMI_CLI_AUDIT_LOG?.trim();return e===void 0||e===""?Rc(Pc(),".linzumi","logs","command-events.jsonl"):e}function Os(e){return Mc(e)}function Es(e,t){return Fg(t)?Fn:typeof e=="string"?Gc(e):Array.isArray(e)?t==="args"?jg(e):e.map(n=>Es(n,void 0)):e!==null&&typeof e=="object"?Mc(e):e}function Mc(e){let t=typeof e.name=="string"?e.name.toLowerCase():void 0,n=t==="authorization"||t==="cookie"||t==="x-linzumi-agent-turn"||t==="set-cookie";return Object.fromEntries(Object.entries(e).filter(([r])=>r!=="runner_console").map(([r,i])=>[r,n&&r==="value"?Fn:Es(i,r)]))}function jg(e){let t=!1;return e.map(n=>{if(typeof n!="string")return t=!1,Es(n,void 0);if(t)return t=!1,Fn;let[r,i]=$g(n);return Mg.has(r)?i===void 0?(t=!0,n):`${r}=${Fn}`:Gc(n)})}function $g(e){let t=e.indexOf("=");return t===-1?[e,void 0]:[e.slice(0,t),e.slice(t+1)]}function Fg(e){return e===void 0?!1:/^(authorization|cookie|set-cookie|password|login[_-]?url|turnCapability|topicWakeTurnCapability|topic_wake_turn_capability|x-linzumi-agent-turn|mcpAuthFileContents|LINZUMI_CLOUD_MCP_AUTH_JSON)$/i.test(e)||/(^|[_-])(access[_-]?token|api[_-]?key|auth[_-]?token|oauth[_-]?code|refresh[_-]?token|secret|token)$/i.test(e)}function Gc(e){return Ng(e).replace(/\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,Fn)}function Ng(e){let t;try{t=new URL(e)}catch{return Dg(e)}for(let n of[...t.searchParams.keys()])Ic.has(n.toLowerCase())&&t.searchParams.set(n,Fn);return t.toString()}function Dg(e){let t=e.indexOf("?"),n=e.indexOf("#");if(t===-1||n!==-1&&n<t)return e;let r=e.slice(0,t),i=n===-1?e.slice(t+1):e.slice(t+1,n),o=n===-1?"":e.slice(n),a=new URLSearchParams(i),s=!1;for(let l of[...a.keys()])Ic.has(l.toLowerCase())&&(a.set(l,Fn),s=!0);switch(s){case!0:return`${r}?${a.toString()}${o}`;case!1:return e}}var Fn,Ic,Mg,fn=_(()=>{"use strict";Cs();Fn="<SENSITIVE_DATA>",Ic=Ec(new Set(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"])),Mg=new Set(["--access-token","--api-key","--authorization","--cookie","--oauth-code","--password","--refresh-token","--secret","--token"])});var Oo=_(()=>{"use strict"});var pn=_(()=>{"use strict";Ee();Te();Oo()});var qc=_(()=>{"use strict";Ee();Te()});var Eo=_(()=>{"use strict";qc();Ee()});var Po=_(()=>{"use strict"});var Bg,Kg,Ro=_(()=>{"use strict";Te();Bg=2147483,Kg=Bg*1e3-5*6e4});var pA,jc=_(()=>{"use strict";pA=["# Managed by Linzumi - do not edit by hand.","# This isolated CODEX_HOME keeps Linzumi-spawned codex processes off the","# user's ~/.codex config and the macOS Keychain. See codexHome.ts.",'mcp_oauth_credentials_store = "file"','cli_auth_credentials_store = "file"',""].join(`
14
- `)});var zg,ui=_(()=>{"use strict";zg=5*6e4});var $c=_(()=>{"use strict";ui();fn()});var Fc=_(()=>{"use strict";ui()});var Nc=_(()=>{"use strict"});var zA,Ps=_(()=>{"use strict";xc();Ee();Te();fn();pn();Eo();Po();Ro();jc();ui();$c();Fc();Nc();zA=(()=>{let e=process.env.LINZUMI_CODEX_WS_KEEPALIVE_MS;if(e===void 0)return 2e4;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:2e4})()});var VA,Rs=_(()=>{"use strict";fn();VA=300*1e3});var Lc=_(()=>{"use strict";Rs();Ee()});var Jc=_(()=>{});var Io=_(()=>{Jc()});var Uc=_(()=>{"use strict";Rs();Io()});var Bc=_(()=>{});var Kc=_(()=>{Bc()});var Is=_(()=>{Ft();w();D()});var Wc,Hc,Ms,Gs=_(()=>{Wc=[["codexThreadId","harness_session_id"],["codex_thread_id","harness_session_id"],["kandanThreadId","thread_id"],["kandan_preview_ticket","linzumi_preview_ticket"],["kandan_thread_id","thread_id"],["linzumiThreadId","thread_id"],["linzumi_thread_id","thread_id"],["local_codex_runner","commander"],["runnerId","commander_id"],["runner_config","commander_config"],["runner_id","commander_id"]],Hc=[["commander","local_codex_runner"],["commander_config","runner_config"],["commander_id","runner_id"],["harness_session_id","codex_thread_id"],["linzumi_preview_ticket","kandan_preview_ticket"],["thread_id","kandan_thread_id"]],Ms=[["engine_boot_reconnect","harness_boot_reconnect"],["engine_for_runner_event_type","harness_for_commander_event_type"],["engine_rejected_steer","harness_rejected_steer"],["engine_unavailable","harness_unavailable"],["join_engine","join_harness"],["kandan-local-codex-runner","linzumi-commander"],["local_codex_runner","commander"],["original_engine","original_harness"],["resume_engine","resume_harness"]]});function qs(e){let t={};return e.forEach(n=>{t[n[0]]=n[1]}),t}function tb(e){let t={};return e.forEach(n=>{t[n[1]]=n[0]}),t}function Qc(e){let t=e.slice();return e.forEach(n=>{let r=nb[n];r!==void 0&&!t.includes(r)&&t.push(r);let i=rb[n];if(i!==void 0&&!t.includes(i)){t.push(i);return}}),t}var nb,rb,Tw,kw,Mo=_(()=>{Gs();nb=qs(Wc),rb=qs(Hc),Tw=qs(Ms),kw=tb(Ms)});var Aw,ww,Cw,Ow,ci=_(()=>{B();tr();D();Mo();Aw=Qc(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"]),ww=new RegExp("^(authorization|cookie|set-cookie|password|login[_-]?url|turnCapability|topicWakeTurnCapability|topic_wake_turn_capability|x-linzumi-agent-turn|mcpAuthFileContents|LINZUMI_CLOUD_MCP_AUTH_JSON)$","i"),Cw=new RegExp("(^|[_-])(access[_-]?token|api[_-]?key|auth[_-]?token|oauth[_-]?code|refresh[_-]?token|secret|token)$","i"),Ow=new RegExp("\\beyJ[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\b","g")});var ef=_(()=>{B();Is();ee();ci()});var tf=_(()=>{ef()});var ie=_(()=>{X()});var dt=_(()=>{});function ab(e){try{let t=JSON.stringify(e);if(t===void 0)return null;try{return JSON.parse(t)}catch{return null}}catch{return null}}var fi,yr=_(()=>{X();B();w();D();ee();fi=ab});var nf,_n=_(()=>{w();L();ie();yr();nf=fi({version:1,kind:"successful_no_answer"})});var _i=_(()=>{dt();B();w();L();ie();yr();_n()});var At=_(()=>{B()});function $o(e){try{let t=JSON.stringify(e);if(t===void 0)return{TAG:"Error",_0:"authored JSON serialization failed"};try{return{TAG:"Ok",_0:JSON.parse(t)}}catch(n){let r=Q(n);return{TAG:"Error",_0:"authored JSON parse failed: "+ve(r).message}}}catch(t){let n=Q(t);return{TAG:"Error",_0:"authored JSON serialization failed: "+ve(n).message}}}var Mw,gr=_(()=>{B();w();L();ie();ee();_n();Mw=$o({})});var Fo=_(()=>{dt();B();w();L();gr()});var of=le((Gw,rf)=>{"use strict";var{Transform:db}=re("stream"),{StringDecoder:lb}=re("string_decoder"),Fs=class extends db{constructor(t){super(Object.assign({},t,{writableObjectMode:!1})),this._buffer=""}_transform(t,n,r){typeof t=="string"?this._transform=this._transformString:(this._stringDecoder=new lb,this._transform=this._transformBuffer),this._transform(t,n,r)}_transformBuffer(t,n,r){this._buffer+=this._stringDecoder.write(t),this._processBuffer(r)}_transformString(t,n,r){this._buffer+=t.toString(),this._processBuffer(r)}_processBuffer(t){this._buffer&&(this.push(this._buffer,"utf8"),this._buffer=""),t(null)}_flushInput(){this._stringDecoder&&(this._buffer+=this._stringDecoder.end())}_flush(t){this._flushInput(),this._processBuffer(t)}};rf.exports=Fs});var yi=le((qw,af)=>{"use strict";var ub=of(),F={value1:/^(?:[\"\{\[\]\-\d]|true\b|false\b|null\b|\s{1,256})/,string:/^(?:[^\x00-\x1f\"\\]{1,256}|\\[bfnrt\"\\\/]|\\u[\da-fA-F]{4}|\")/,key1:/^(?:[\"\}]|\s{1,256})/,colon:/^(?:\:|\s{1,256})/,comma:/^(?:[\,\]\}]|\s{1,256})/,ws:/^\s{1,256}/,numberStart:/^\d/,numberDigit:/^\d{0,256}/,numberFraction:/^[\.eE]/,numberExponent:/^[eE]/,numberExpSign:/^[-+]/},cb=16,je=!0;try{new RegExp(".","y"),je=!1}catch{}!je&&Object.keys(F).forEach(e=>{let t=F[e].source.slice(1);t.slice(0,3)==="(?:"&&t.slice(-1)===")"&&(t=t.slice(3,-1)),F[e]=new RegExp(t,"y")});F.numberFracStart=F.numberExpStart=F.numberStart;F.numberFracDigit=F.numberExpDigit=F.numberDigit;var fb={true:!0,false:!1,null:null},wt={object:"objectStop",array:"arrayStop","":"done"},mb=e=>String.fromCharCode(parseInt(e.slice(2),16)),pb={b:"\b",f:"\f",n:`
15
- `,r:"\r",t:" ",'"':'"',"\\":"\\","/":"/"},Ln=class e extends ub{static make(t){return new e(t)}constructor(t){super(Object.assign({},t,{readableObjectMode:!0})),this._packKeys=this._packStrings=this._packNumbers=this._streamKeys=this._streamStrings=this._streamNumbers=!0,t&&("packValues"in t&&(this._packKeys=this._packStrings=this._packNumbers=t.packValues),"packKeys"in t&&(this._packKeys=t.packKeys),"packStrings"in t&&(this._packStrings=t.packStrings),"packNumbers"in t&&(this._packNumbers=t.packNumbers),"streamValues"in t&&(this._streamKeys=this._streamStrings=this._streamNumbers=t.streamValues),"streamKeys"in t&&(this._streamKeys=t.streamKeys),"streamStrings"in t&&(this._streamStrings=t.streamStrings),"streamNumbers"in t&&(this._streamNumbers=t.streamNumbers),this._jsonStreaming=t.jsonStreaming),!this._packKeys&&(this._streamKeys=!0),!this._packStrings&&(this._streamStrings=!0),!this._packNumbers&&(this._streamNumbers=!0),this._done=!1,this._expect=this._jsonStreaming?"done":"value",this._stack=[],this._parent="",this._open_number=!1,this._accumulator=""}_flush(t){this._done=!0,super._flush(n=>{if(n)return t(n);this._open_number&&(this._streamNumbers&&this.push({name:"endNumber"}),this._open_number=!1,this._packNumbers&&(this.push({name:"numberValue",value:this._accumulator}),this._accumulator="")),t(null)})}_processBuffer(t){let n,r,i=0;e:for(;;)switch(this._expect){case"value1":case"value":if(F.value1.lastIndex=i,n=F.value1.exec(this._buffer),!n){if(this._done||i+cb<this._buffer.length)return i<this._buffer.length?t(new Error("Parser cannot parse input: expected a value")):t(new Error("Parser has expected a value"));break e}switch(r=n[0],r){case'"':this._streamStrings&&this.push({name:"startString"}),this._expect="string";break;case"{":this.push({name:"startObject"}),this._stack.push(this._parent),this._parent="object",this._expect="key1";break;case"[":this.push({name:"startArray"}),this._stack.push(this._parent),this._parent="array",this._expect="value1";break;case"]":if(this._expect!=="value1")return t(new Error("Parser cannot parse input: unexpected token ']'"));this._open_number&&(this._streamNumbers&&this.push({name:"endNumber"}),this._open_number=!1,this._packNumbers&&(this.push({name:"numberValue",value:this._accumulator}),this._accumulator="")),this.push({name:"endArray"}),this._parent=this._stack.pop(),this._expect=wt[this._parent];break;case"-":this._open_number=!0,this._streamNumbers&&(this.push({name:"startNumber"}),this.push({name:"numberChunk",value:"-"})),this._packNumbers&&(this._accumulator="-"),this._expect="numberStart";break;case"0":this._open_number=!0,this._streamNumbers&&(this.push({name:"startNumber"}),this.push({name:"numberChunk",value:"0"})),this._packNumbers&&(this._accumulator="0"),this._expect="numberFraction";break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":this._open_number=!0,this._streamNumbers&&(this.push({name:"startNumber"}),this.push({name:"numberChunk",value:r})),this._packNumbers&&(this._accumulator=r),this._expect="numberDigit";break;case"true":case"false":case"null":if(this._buffer.length-i===r.length&&!this._done)break e;this.push({name:r+"Value",value:fb[r]}),this._expect=wt[this._parent];break}je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"keyVal":case"string":if(F.string.lastIndex=i,n=F.string.exec(this._buffer),!n){if(i<this._buffer.length&&(this._done||this._buffer.length-i>=6))return t(new Error("Parser cannot parse input: escaped characters"));if(this._done)return t(new Error("Parser has expected a string value"));break e}if(r=n[0],r==='"')this._expect==="keyVal"?(this._streamKeys&&this.push({name:"endKey"}),this._packKeys&&(this.push({name:"keyValue",value:this._accumulator}),this._accumulator=""),this._expect="colon"):(this._streamStrings&&this.push({name:"endString"}),this._packStrings&&(this.push({name:"stringValue",value:this._accumulator}),this._accumulator=""),this._expect=wt[this._parent]);else if(r.length>1&&r.charAt(0)==="\\"){let o=r.length==2?pb[r.charAt(1)]:mb(r);(this._expect==="keyVal"?this._streamKeys:this._streamStrings)&&this.push({name:"stringChunk",value:o}),(this._expect==="keyVal"?this._packKeys:this._packStrings)&&(this._accumulator+=o)}else(this._expect==="keyVal"?this._streamKeys:this._streamStrings)&&this.push({name:"stringChunk",value:r}),(this._expect==="keyVal"?this._packKeys:this._packStrings)&&(this._accumulator+=r);je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"key1":case"key":if(F.key1.lastIndex=i,n=F.key1.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected an object key"));break e}if(r=n[0],r==='"')this._streamKeys&&this.push({name:"startKey"}),this._expect="keyVal";else if(r==="}"){if(this._expect!=="key1")return t(new Error("Parser cannot parse input: unexpected token '}'"));this.push({name:"endObject"}),this._parent=this._stack.pop(),this._expect=wt[this._parent]}je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"colon":if(F.colon.lastIndex=i,n=F.colon.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected ':'"));break e}r=n[0],r===":"&&(this._expect="value"),je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"arrayStop":case"objectStop":if(F.comma.lastIndex=i,n=F.comma.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected ','"));break e}if(this._open_number&&(this._streamNumbers&&this.push({name:"endNumber"}),this._open_number=!1,this._packNumbers&&(this.push({name:"numberValue",value:this._accumulator}),this._accumulator="")),r=n[0],r===",")this._expect=this._expect==="arrayStop"?"value":"key";else if(r==="}"||r==="]"){if(r==="}"?this._expect==="arrayStop":this._expect!=="arrayStop")return t(new Error("Parser cannot parse input: expected '"+(this._expect==="arrayStop"?"]":"}")+"'"));this.push({name:r==="}"?"endObject":"endArray"}),this._parent=this._stack.pop(),this._expect=wt[this._parent]}je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberStart":if(F.numberStart.lastIndex=i,n=F.numberStart.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected a starting digit"));break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect=r==="0"?"numberFraction":"numberDigit",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberDigit":if(F.numberDigit.lastIndex=i,n=F.numberDigit.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected a digit"));break e}if(r=n[0],r)this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),je?this._buffer=this._buffer.slice(r.length):i+=r.length;else{if(i<this._buffer.length){this._expect="numberFraction";break}if(this._done){this._expect=wt[this._parent];break}break e}break;case"numberFraction":if(F.numberFraction.lastIndex=i,n=F.numberFraction.exec(this._buffer),!n){if(i<this._buffer.length||this._done){this._expect=wt[this._parent];break}break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect=r==="."?"numberFracStart":"numberExpSign",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberFracStart":if(F.numberFracStart.lastIndex=i,n=F.numberFracStart.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected a fractional part of a number"));break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect="numberFracDigit",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberFracDigit":if(F.numberFracDigit.lastIndex=i,n=F.numberFracDigit.exec(this._buffer),r=n[0],r)this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),je?this._buffer=this._buffer.slice(r.length):i+=r.length;else{if(i<this._buffer.length){this._expect="numberExponent";break}if(this._done){this._expect=wt[this._parent];break}break e}break;case"numberExponent":if(F.numberExponent.lastIndex=i,n=F.numberExponent.exec(this._buffer),!n){if(i<this._buffer.length){this._expect=wt[this._parent];break}if(this._done){this._expect="done";break}break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect="numberExpSign",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberExpSign":if(F.numberExpSign.lastIndex=i,n=F.numberExpSign.exec(this._buffer),!n){if(i<this._buffer.length){this._expect="numberExpStart";break}if(this._done)return t(new Error("Parser has expected an exponent value of a number"));break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect="numberExpStart",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberExpStart":if(F.numberExpStart.lastIndex=i,n=F.numberExpStart.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected an exponent part of a number"));break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect="numberExpDigit",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberExpDigit":if(F.numberExpDigit.lastIndex=i,n=F.numberExpDigit.exec(this._buffer),r=n[0],r)this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),je?this._buffer=this._buffer.slice(r.length):i+=r.length;else{if(i<this._buffer.length||this._done){this._expect=wt[this._parent];break}break e}break;case"done":if(F.ws.lastIndex=i,n=F.ws.exec(this._buffer),!n){if(i<this._buffer.length){if(this._jsonStreaming){this._expect="value";break}return t(new Error("Parser cannot parse input: unexpected characters"))}break e}r=n[0],this._open_number&&(this._streamNumbers&&this.push({name:"endNumber"}),this._open_number=!1,this._packNumbers&&(this.push({name:"numberValue",value:this._accumulator}),this._accumulator="")),je?this._buffer=this._buffer.slice(r.length):i+=r.length;break}!je&&(this._buffer=this._buffer.slice(i)),t(null)}};Ln.parser=Ln.make;Ln.make.Constructor=Ln;af.exports=Ln});var _b,Ns=_(()=>{B();ee();_b=bt(yi(),1)});var Do=_(()=>{B();w();L();ie();At();_n();Fo();Ns();gr()});var mt=_(()=>{B();L();ie();_i();Do()});var Js=_(()=>{mt()});var uf=_(()=>{});var cf=_(()=>{X();Wi();D()});function Er(e){let t=0;for(;;){let n=t,r=e[n];if(r===void 0)return'"'+e+'"';switch(r){case'"':case`
14
+ `)});var zg,ui=_(()=>{"use strict";zg=5*6e4});var $c=_(()=>{"use strict";ui();fn()});var Fc=_(()=>{"use strict";ui()});var Nc=_(()=>{"use strict"});var zA,Ps=_(()=>{"use strict";xc();Ee();Te();fn();pn();Eo();Po();Ro();jc();ui();$c();Fc();Nc();zA=(()=>{let e=process.env.LINZUMI_CODEX_WS_KEEPALIVE_MS;if(e===void 0)return 2e4;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:2e4})()});var VA,Rs=_(()=>{"use strict";fn();VA=300*1e3});var Lc=_(()=>{"use strict";Rs();Ee()});var Jc=_(()=>{});var Io=_(()=>{Jc()});var Uc=_(()=>{"use strict";Rs();Io()});var Bc=_(()=>{});var Kc=_(()=>{Bc()});var Is=_(()=>{Ft();w();D()});var Wc,Hc,Ms,Gs=_(()=>{Wc=[["codexThreadId","harness_session_id"],["codex_thread_id","harness_session_id"],["kandanThreadId","thread_id"],["kandan_preview_ticket","linzumi_preview_ticket"],["kandan_thread_id","thread_id"],["linzumiThreadId","thread_id"],["linzumi_thread_id","thread_id"],["local_codex_runner","commander"],["runnerId","commander_id"],["runner_config","commander_config"],["runner_id","commander_id"]],Hc=[["commander","local_codex_runner"],["commander_config","runner_config"],["commander_id","runner_id"],["harness_session_id","codex_thread_id"],["linzumi_preview_ticket","kandan_preview_ticket"],["thread_id","kandan_thread_id"]],Ms=[["engine_boot_reconnect","harness_boot_reconnect"],["engine_for_runner_event_type","harness_for_commander_event_type"],["engine_rejected_steer","harness_rejected_steer"],["engine_unavailable","harness_unavailable"],["join_engine","join_harness"],["kandan-local-codex-runner","linzumi-commander"],["local_codex_runner","commander"],["original_engine","original_harness"],["resume_engine","resume_harness"]]});function qs(e){let t={};return e.forEach(n=>{t[n[0]]=n[1]}),t}function tb(e){let t={};return e.forEach(n=>{t[n[1]]=n[0]}),t}function Qc(e){let t=e.slice();return e.forEach(n=>{let r=nb[n];r!==void 0&&!t.includes(r)&&t.push(r);let i=rb[n];if(i!==void 0&&!t.includes(i)){t.push(i);return}}),t}var nb,rb,Tw,kw,Mo=_(()=>{Gs();nb=qs(Wc),rb=qs(Hc),Tw=qs(Ms),kw=tb(Ms)});var Aw,ww,Cw,Ow,ci=_(()=>{B();tr();D();Mo();Aw=Qc(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"]),ww=new RegExp("^(authorization|cookie|set-cookie|password|login[_-]?url|turnCapability|topicWakeTurnCapability|topic_wake_turn_capability|x-linzumi-agent-turn|mcpAuthFileContents|LINZUMI_CLOUD_MCP_AUTH_JSON)$","i"),Cw=new RegExp("(^|[_-])(access[_-]?token|api[_-]?key|auth[_-]?token|oauth[_-]?code|refresh[_-]?token|secret|token)$","i"),Ow=new RegExp("\\beyJ[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\b","g")});var ef=_(()=>{B();Is();ee();ci()});var tf=_(()=>{ef()});var oe=_(()=>{X()});var dt=_(()=>{});function ab(e){try{let t=JSON.stringify(e);if(t===void 0)return null;try{return JSON.parse(t)}catch{return null}}catch{return null}}var fi,yr=_(()=>{X();B();w();D();ee();fi=ab});var nf,_n=_(()=>{w();L();oe();yr();nf=fi({version:1,kind:"successful_no_answer"})});var _i=_(()=>{dt();B();w();L();oe();yr();_n()});var At=_(()=>{B()});function $o(e){try{let t=JSON.stringify(e);if(t===void 0)return{TAG:"Error",_0:"authored JSON serialization failed"};try{return{TAG:"Ok",_0:JSON.parse(t)}}catch(n){let r=Q(n);return{TAG:"Error",_0:"authored JSON parse failed: "+ve(r).message}}}catch(t){let n=Q(t);return{TAG:"Error",_0:"authored JSON serialization failed: "+ve(n).message}}}var Mw,gr=_(()=>{B();w();L();oe();ee();_n();Mw=$o({})});var Fo=_(()=>{dt();B();w();L();gr()});var of=le((Gw,rf)=>{"use strict";var{Transform:db}=re("stream"),{StringDecoder:lb}=re("string_decoder"),Fs=class extends db{constructor(t){super(Object.assign({},t,{writableObjectMode:!1})),this._buffer=""}_transform(t,n,r){typeof t=="string"?this._transform=this._transformString:(this._stringDecoder=new lb,this._transform=this._transformBuffer),this._transform(t,n,r)}_transformBuffer(t,n,r){this._buffer+=this._stringDecoder.write(t),this._processBuffer(r)}_transformString(t,n,r){this._buffer+=t.toString(),this._processBuffer(r)}_processBuffer(t){this._buffer&&(this.push(this._buffer,"utf8"),this._buffer=""),t(null)}_flushInput(){this._stringDecoder&&(this._buffer+=this._stringDecoder.end())}_flush(t){this._flushInput(),this._processBuffer(t)}};rf.exports=Fs});var yi=le((qw,af)=>{"use strict";var ub=of(),F={value1:/^(?:[\"\{\[\]\-\d]|true\b|false\b|null\b|\s{1,256})/,string:/^(?:[^\x00-\x1f\"\\]{1,256}|\\[bfnrt\"\\\/]|\\u[\da-fA-F]{4}|\")/,key1:/^(?:[\"\}]|\s{1,256})/,colon:/^(?:\:|\s{1,256})/,comma:/^(?:[\,\]\}]|\s{1,256})/,ws:/^\s{1,256}/,numberStart:/^\d/,numberDigit:/^\d{0,256}/,numberFraction:/^[\.eE]/,numberExponent:/^[eE]/,numberExpSign:/^[-+]/},cb=16,je=!0;try{new RegExp(".","y"),je=!1}catch{}!je&&Object.keys(F).forEach(e=>{let t=F[e].source.slice(1);t.slice(0,3)==="(?:"&&t.slice(-1)===")"&&(t=t.slice(3,-1)),F[e]=new RegExp(t,"y")});F.numberFracStart=F.numberExpStart=F.numberStart;F.numberFracDigit=F.numberExpDigit=F.numberDigit;var fb={true:!0,false:!1,null:null},wt={object:"objectStop",array:"arrayStop","":"done"},mb=e=>String.fromCharCode(parseInt(e.slice(2),16)),pb={b:"\b",f:"\f",n:`
15
+ `,r:"\r",t:" ",'"':'"',"\\":"\\","/":"/"},Ln=class e extends ub{static make(t){return new e(t)}constructor(t){super(Object.assign({},t,{readableObjectMode:!0})),this._packKeys=this._packStrings=this._packNumbers=this._streamKeys=this._streamStrings=this._streamNumbers=!0,t&&("packValues"in t&&(this._packKeys=this._packStrings=this._packNumbers=t.packValues),"packKeys"in t&&(this._packKeys=t.packKeys),"packStrings"in t&&(this._packStrings=t.packStrings),"packNumbers"in t&&(this._packNumbers=t.packNumbers),"streamValues"in t&&(this._streamKeys=this._streamStrings=this._streamNumbers=t.streamValues),"streamKeys"in t&&(this._streamKeys=t.streamKeys),"streamStrings"in t&&(this._streamStrings=t.streamStrings),"streamNumbers"in t&&(this._streamNumbers=t.streamNumbers),this._jsonStreaming=t.jsonStreaming),!this._packKeys&&(this._streamKeys=!0),!this._packStrings&&(this._streamStrings=!0),!this._packNumbers&&(this._streamNumbers=!0),this._done=!1,this._expect=this._jsonStreaming?"done":"value",this._stack=[],this._parent="",this._open_number=!1,this._accumulator=""}_flush(t){this._done=!0,super._flush(n=>{if(n)return t(n);this._open_number&&(this._streamNumbers&&this.push({name:"endNumber"}),this._open_number=!1,this._packNumbers&&(this.push({name:"numberValue",value:this._accumulator}),this._accumulator="")),t(null)})}_processBuffer(t){let n,r,i=0;e:for(;;)switch(this._expect){case"value1":case"value":if(F.value1.lastIndex=i,n=F.value1.exec(this._buffer),!n){if(this._done||i+cb<this._buffer.length)return i<this._buffer.length?t(new Error("Parser cannot parse input: expected a value")):t(new Error("Parser has expected a value"));break e}switch(r=n[0],r){case'"':this._streamStrings&&this.push({name:"startString"}),this._expect="string";break;case"{":this.push({name:"startObject"}),this._stack.push(this._parent),this._parent="object",this._expect="key1";break;case"[":this.push({name:"startArray"}),this._stack.push(this._parent),this._parent="array",this._expect="value1";break;case"]":if(this._expect!=="value1")return t(new Error("Parser cannot parse input: unexpected token ']'"));this._open_number&&(this._streamNumbers&&this.push({name:"endNumber"}),this._open_number=!1,this._packNumbers&&(this.push({name:"numberValue",value:this._accumulator}),this._accumulator="")),this.push({name:"endArray"}),this._parent=this._stack.pop(),this._expect=wt[this._parent];break;case"-":this._open_number=!0,this._streamNumbers&&(this.push({name:"startNumber"}),this.push({name:"numberChunk",value:"-"})),this._packNumbers&&(this._accumulator="-"),this._expect="numberStart";break;case"0":this._open_number=!0,this._streamNumbers&&(this.push({name:"startNumber"}),this.push({name:"numberChunk",value:"0"})),this._packNumbers&&(this._accumulator="0"),this._expect="numberFraction";break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":this._open_number=!0,this._streamNumbers&&(this.push({name:"startNumber"}),this.push({name:"numberChunk",value:r})),this._packNumbers&&(this._accumulator=r),this._expect="numberDigit";break;case"true":case"false":case"null":if(this._buffer.length-i===r.length&&!this._done)break e;this.push({name:r+"Value",value:fb[r]}),this._expect=wt[this._parent];break}je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"keyVal":case"string":if(F.string.lastIndex=i,n=F.string.exec(this._buffer),!n){if(i<this._buffer.length&&(this._done||this._buffer.length-i>=6))return t(new Error("Parser cannot parse input: escaped characters"));if(this._done)return t(new Error("Parser has expected a string value"));break e}if(r=n[0],r==='"')this._expect==="keyVal"?(this._streamKeys&&this.push({name:"endKey"}),this._packKeys&&(this.push({name:"keyValue",value:this._accumulator}),this._accumulator=""),this._expect="colon"):(this._streamStrings&&this.push({name:"endString"}),this._packStrings&&(this.push({name:"stringValue",value:this._accumulator}),this._accumulator=""),this._expect=wt[this._parent]);else if(r.length>1&&r.charAt(0)==="\\"){let o=r.length==2?pb[r.charAt(1)]:mb(r);(this._expect==="keyVal"?this._streamKeys:this._streamStrings)&&this.push({name:"stringChunk",value:o}),(this._expect==="keyVal"?this._packKeys:this._packStrings)&&(this._accumulator+=o)}else(this._expect==="keyVal"?this._streamKeys:this._streamStrings)&&this.push({name:"stringChunk",value:r}),(this._expect==="keyVal"?this._packKeys:this._packStrings)&&(this._accumulator+=r);je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"key1":case"key":if(F.key1.lastIndex=i,n=F.key1.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected an object key"));break e}if(r=n[0],r==='"')this._streamKeys&&this.push({name:"startKey"}),this._expect="keyVal";else if(r==="}"){if(this._expect!=="key1")return t(new Error("Parser cannot parse input: unexpected token '}'"));this.push({name:"endObject"}),this._parent=this._stack.pop(),this._expect=wt[this._parent]}je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"colon":if(F.colon.lastIndex=i,n=F.colon.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected ':'"));break e}r=n[0],r===":"&&(this._expect="value"),je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"arrayStop":case"objectStop":if(F.comma.lastIndex=i,n=F.comma.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected ','"));break e}if(this._open_number&&(this._streamNumbers&&this.push({name:"endNumber"}),this._open_number=!1,this._packNumbers&&(this.push({name:"numberValue",value:this._accumulator}),this._accumulator="")),r=n[0],r===",")this._expect=this._expect==="arrayStop"?"value":"key";else if(r==="}"||r==="]"){if(r==="}"?this._expect==="arrayStop":this._expect!=="arrayStop")return t(new Error("Parser cannot parse input: expected '"+(this._expect==="arrayStop"?"]":"}")+"'"));this.push({name:r==="}"?"endObject":"endArray"}),this._parent=this._stack.pop(),this._expect=wt[this._parent]}je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberStart":if(F.numberStart.lastIndex=i,n=F.numberStart.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected a starting digit"));break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect=r==="0"?"numberFraction":"numberDigit",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberDigit":if(F.numberDigit.lastIndex=i,n=F.numberDigit.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected a digit"));break e}if(r=n[0],r)this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),je?this._buffer=this._buffer.slice(r.length):i+=r.length;else{if(i<this._buffer.length){this._expect="numberFraction";break}if(this._done){this._expect=wt[this._parent];break}break e}break;case"numberFraction":if(F.numberFraction.lastIndex=i,n=F.numberFraction.exec(this._buffer),!n){if(i<this._buffer.length||this._done){this._expect=wt[this._parent];break}break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect=r==="."?"numberFracStart":"numberExpSign",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberFracStart":if(F.numberFracStart.lastIndex=i,n=F.numberFracStart.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected a fractional part of a number"));break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect="numberFracDigit",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberFracDigit":if(F.numberFracDigit.lastIndex=i,n=F.numberFracDigit.exec(this._buffer),r=n[0],r)this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),je?this._buffer=this._buffer.slice(r.length):i+=r.length;else{if(i<this._buffer.length){this._expect="numberExponent";break}if(this._done){this._expect=wt[this._parent];break}break e}break;case"numberExponent":if(F.numberExponent.lastIndex=i,n=F.numberExponent.exec(this._buffer),!n){if(i<this._buffer.length){this._expect=wt[this._parent];break}if(this._done){this._expect="done";break}break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect="numberExpSign",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberExpSign":if(F.numberExpSign.lastIndex=i,n=F.numberExpSign.exec(this._buffer),!n){if(i<this._buffer.length){this._expect="numberExpStart";break}if(this._done)return t(new Error("Parser has expected an exponent value of a number"));break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect="numberExpStart",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberExpStart":if(F.numberExpStart.lastIndex=i,n=F.numberExpStart.exec(this._buffer),!n){if(i<this._buffer.length||this._done)return t(new Error("Parser cannot parse input: expected an exponent part of a number"));break e}r=n[0],this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),this._expect="numberExpDigit",je?this._buffer=this._buffer.slice(r.length):i+=r.length;break;case"numberExpDigit":if(F.numberExpDigit.lastIndex=i,n=F.numberExpDigit.exec(this._buffer),r=n[0],r)this._streamNumbers&&this.push({name:"numberChunk",value:r}),this._packNumbers&&(this._accumulator+=r),je?this._buffer=this._buffer.slice(r.length):i+=r.length;else{if(i<this._buffer.length||this._done){this._expect=wt[this._parent];break}break e}break;case"done":if(F.ws.lastIndex=i,n=F.ws.exec(this._buffer),!n){if(i<this._buffer.length){if(this._jsonStreaming){this._expect="value";break}return t(new Error("Parser cannot parse input: unexpected characters"))}break e}r=n[0],this._open_number&&(this._streamNumbers&&this.push({name:"endNumber"}),this._open_number=!1,this._packNumbers&&(this.push({name:"numberValue",value:this._accumulator}),this._accumulator="")),je?this._buffer=this._buffer.slice(r.length):i+=r.length;break}!je&&(this._buffer=this._buffer.slice(i)),t(null)}};Ln.parser=Ln.make;Ln.make.Constructor=Ln;af.exports=Ln});var _b,Ns=_(()=>{B();ee();_b=bt(yi(),1)});var Do=_(()=>{B();w();L();oe();At();_n();Fo();Ns();gr()});var mt=_(()=>{B();L();oe();_i();Do()});var Js=_(()=>{mt()});var uf=_(()=>{});var cf=_(()=>{X();Wi();D()});function Er(e){let t=0;for(;;){let n=t,r=e[n];if(r===void 0)return'"'+e+'"';switch(r){case'"':case`
16
16
  `:return JSON.stringify(e);default:t=n+1|0;continue}}}function wb(e){return e===""?[]:JSON.parse(e.split('"]["').join('","'))}function Cb(e){return"["+Er(e)+"]"}function Ob(e){let t=e.length;return t!==1?t!==0?e.map(Cb).join(""):"":"["+Er(e[0])+"]"}function Rb(e){return e.type===lt?!0:e.type===pt?lt in e.has:!1}function Ib(e,t){return(e&t)!==0}function zo(e){let t=fe[typeof e];if(t&16)return lt;if(!(t&64))return t&2?'"'+e+'"':t&1024?e+"n":t&4096?"Function":e.toString();if(e===null)return kr;if(Array.isArray(e)){let i="[";for(let o=0,a=e.length;o<a;++o)o!==0&&(i=i+", "),i=i+zo(e[o]);return i+"]"}if(e.constructor!==Object)return Object.prototype.toString.call(e);let n=Object.keys(e),r="{ ";for(let i=0,o=n.length;i<o;++i){let a=n[i],s=e[a];r=r+a+": "+zo(s)+"; "}return r+"}"}function Ae(e){let t=e.type,n=e.to,r=e.const,i=e.name;if(i!==void 0)return i;if(r!==void 0)return zo(r);let o=e.format,a=e.anyOf;if(a!==void 0)return a.map(Ae).join(" | ");if(o!==void 0){if(o!=="compactColumns")return o;let s=e.additionalItems;if(n===void 0)return s!==void 0&&s!=="strip"&&s!=="strict"?Ae(s)+"[]":"unknown[][]";let l=n.properties;return l===void 0?"unknown[][]":"["+Object.keys(l).map(d=>{let m=l[d];return Ae(m)+"[]"}).join(", ")+"]"}switch(t){case"nan":return"NaN";case"object":let s=e.additionalItems,l=e.properties,u=Object.keys(l);return u.length===0?typeof s===Re?"{ [key: string]: "+Ae(s)+"; }":"{}":"{ "+u.map(d=>d+": "+Ae(l[d])+";").join(" ")+" }";default:if(e.b)return t;switch(t){case"instance":return e.class.name;case"array":let d=e.additionalItems,m=e.items;if(typeof d!==Re)return"["+m.map(Ae).join(", ")+"]";let p=Ae(d);return(d.type===pt?"("+p+")":p)+"[]";default:return t}}}function Yo(e){if(e&&e.s===ed)return e;throw e}function Sf(e){let t=e.path;return(t===""?"":"Failed at "+t+": ")+e.reason}function Pe(e,t){let n=new rd;return n.type=e,n.seq=bf++,t&&(Ot[xr]=n,nt(n,Un,Ot)),n}function vf(e){return e}function Sn(e,t,n){if(Us[e])return Us[e];let r=Pe(t,!0);return n(r),Us[e]=r,r}function gn(e,t){let n=_t(e),r=n;for(;r.to;){let i=_t(r.to);r.to=i,r=i}return t(r),n}function Et(e,t){let n=e.g.e,r=n.length;return n[r]=t,"e["+r+"]"}function Ai(e,t){let n=fe[t.type],r=t.const;return n&16?"void 0":n&2?Er(r):n&1024?r+"n":n&28672?Et(e,t.const):r}function Kn(e,t){let n='"'+t+'"',r=e[n];if(r!==void 0)return r;let i=Er(t);return e[n]=i,i}function Ke(){return this.i}function Mb(){return this.b.v()}function Gb(){return this.prev.v()}function Qe(e){let t=e.v+1;return e.v=t,"v"+t}function Wo(e,t){e.hd=e.hd===""?t:e.hd+","+t}function qb(){let e=this,t=Qe(e.g);return e.cp="let "+t+"="+e.i+";",e.i=t,e.v=Ke,t}function Vs(){let e=this,t=e.p;if(t.fz)return e.v=Ke,e.i;let n=Qe(e.g);return Wo(t,n+"="+e.i),e.v=Ke,e.i=n,n}function Ho(){let e=this;if(e.fz)return e.v=Ke,e.i="("+e.i+")",e.i;let t=Qe(e.g);if(e.prev!==void 0){let r=e.i;r===""?e.cp="let "+t+";"+e.cp:e.cp=e.cp+("let "+t+"="+r+";")}else{let r=e.i;r===""?Wo(e,t):Wo(e,t+"="+r)}return e.v=Ke,e.i=t,t}function jb(e,t,n,r){return{v:Ke,i:"i",s:e,e:t,f:0,cp:"",hd:"",path:"",g:{v:-1,o:n,e:[],d:r}}}function Wn(e,t,n){let r=e.path,i="Can't decode "+Ae(t)+" to "+Ae(n)+". Use S.to to define a custom decoder",o={code:"unsupported_decode",path:r,reason:i,from:t,to:n};throw new Bn(o)}function bi(e,t,n){return Et(e,r=>{let i=t(r);throw new Bn(i)})+"("+n+")"}function Tf(e,t,n,r,i,o,a){let s=a!==void 0?a:"Expected "+Ae(e)+", received "+(i?zo(r):Ae(t));if(o!==void 0){let u={};for(let d=0,m=o.length;d<m;++d){let p=o[d],f=p.reason.split(`
17
17
  `).join(`
18
18
  `),h=p.path,y=`
19
- - `+(h===""?"":"At "+h+": ")+f;u[y]||(u[y]=1,s=s+y)}}let l={code:"invalid_input",path:n,reason:s,expected:e,received:t,unionErrors:o};return i&&(l.input=r),l}function od(e,t,n,r){return i=>{let o=t!==void 0?t:"",a=r!==void 0?r:!0,s=e!==void 0?e:i.e,l=i.prev,u=l!==void 0?l.s:i.s,d=o===""?i.path:i.path+o;return m=>Tf(s,u,d,m,a,void 0,n)}}function $e(e){let t=e.e.errorMessage,n;if(t!==void 0){let r=t.type;n=r!==void 0?r:t._}else n=void 0;return od(void 0,void 0,n,void 0)(e)}function kf(e,t){let n=t!==void 0?t:e.e;return bi(e,od(n,void 0,void 0,void 0)(e),e.v())}function $b(e,t){let n=e.vc,r=n.length;if(r===1){let a=n[0];return a.c(t)+"||"+bi(e,a.f(e),t)+";"}let i="",o=0;for(;o<r;){let a=n[o],s=a.f,l=a.c(t);for(o=o+1|0;o<r&&n[o].f===s;)l=l+"&&"+n[o].c(t),o=o+1|0;i=i+(l+"||"+bi(e,s(e),t)+";")}return i}function xf(e){return e.t===!0?e.prev.t!==!0?e.cp==="":!1:!0}function Pt(e,t){let n=e,r="";for(;n!==void 0;){let i=n;n=i.prev;let o="";if(i.vc)if(t!==void 0&&xf(i)){let s=n.v(),l=i.vc,u="";for(let d=0,m=l.length;d<m;++d){let p=l[d],f=p.c(s);p.f===$e?u=u?u+"&&"+f:f:i.e.noValidation!==!0&&(o=o+(f+"||"+bi(i,p.f(i),s)+";"))}u&&(t.contents?t.contents=u+"&&"+t.contents:t.contents=u)}else i.e.noValidation!==!0&&(o=$b(i,n.v()));i.hd!==""&&(o=o+("let "+i.hd+";")),i.fz=!0,o=i.cp+o,r=o+r}return r}function ut(e,t,n,r){let i=r!==void 0?r:e.e;return{v:Ho,i:t,s:n,e:i,prev:e,f:0,d:e.d,cp:"",hd:"",t:!0,path:e.path,g:e.g}}function Y(e,t,n,r){let i=t!==void 0?t:e.s,o=r!==void 0?r:e.e,a=e.v!==Ke,s={v:a?Gb:Ke,i:e.i,s:i,e:o,prev:e,f:e.f,d:e.d,cp:"",hd:"",vc:n,t:e.t,path:e.path,g:e.g};if(a){let l=e.v.bind(e);e.v=()=>{let u=l();return s.i=u,s.v=Ke,u}}return s}function ad(e,t){let n=e.vc;n!==void 0?n.push(t):e.vc=[t]}function Si(e,t){let n=t.e.inputRefiner,r;if(n!==void 0){let s=n(t);if(s.length!==0)if(t.prev!==void 0){for(let u=0,d=s.length;u<d;++u)ad(t,s[u]);r=void 0}else r=s;else r=void 0}else r=void 0;let i=e.e.refiner,o;if(i!==void 0){let s=i(e);o=s.length!==0?s:void 0}else o=void 0;let a=r!==void 0?o!==void 0?Y(e,void 0,r.concat(o),void 0):Y(e,void 0,r,void 0):o!==void 0?Y(e,void 0,o,void 0):e;return a.io=!0,a}function Af(e,t,n){if(!t.vc)return;let i="["+Kn(e.g,n)+"]";t.vc.forEach(o=>ad(e,{c:a=>o.c(a+i),f:o.f})),t.vc=void 0}function wf(e,t){let n=e.s.additionalItems,r;r=n!==void 0&&n!=="strip"&&n!=="strict"?n:_e;let i=e.e.additionalItems,o;return o=i!==void 0&&i!=="strip"&&i!=="strict"?i:_e,{p:e,v:qb,i:e.v()+"["+t+"]",s:r,e:o,f:e.f,cp:"",hd:"",path:"",g:e.g}}function hn(e,t,n){return ut(e,Ai(e,t),t,n)}function Cf(e,t){let n=ut(e,t,e.s,void 0);return n.f=1,n}function Rt(e,t,n){e.s.type===Ht?e.s.items.push(n.s):(n.o||e.s.required.push(t),e.s.properties[t]=n.s),n.f&1&&n.v(),e.cp=e.cp+Pt(n,void 0),e.d[t]=n}function Of(e,t,n){return e.v()+"["+t+"]="+n.i}function Vt(e){let t=e.v!==Ke,n={b:e,v:t?Mb:Ke,i:e.i,s:e.s,io:e.io,e:e.e,f:0,d:e.d,cp:"",hd:"",u:!1,t:!1,path:e.path,g:e.g};if(t){let r=e.v.bind(e);e.v=()=>{let i=r();return n.i=i,n.v=Ke,i}}return n}function Fb(e,t){throw new Bn({code:"invalid_operation",path:e.path,reason:t})}function sd(e,t,n,r){if(e.path===""&&n===void 0)return Pt(e,void 0);{let i=l=>{let u=t.path,d=u===""?"":Er(u)+"+";return l+".path="+d+(n!==void 0?`'["'+`+n+`+'"]'+`:"")+l+".path"},o=Pt(e,void 0);if(o===""&&!(e.f&1))return o+(r!==void 0?r():"");let a=Qe(e.g),s=i(a)+";throw "+a;return e.f&1&&(e.i=e.i+".catch("+a+"=>{"+s+"})"),"try{"+o+(r!==void 0?r():"")+"}catch("+a+"){"+s+"}"}}function Ef(e){return e}function Bs(e){return e+"<=2147483647&&"+e+">=-2147483648&&"+e+"%1===0"}function Ar(e){return t=>"typeof "+t+'==="'+e+'"'}function vr(e){return"Number.isNaN("+e+")"}function Vo(e){return"Array.isArray("+e+")"}function Pf(e){return Ar(Re)(e)+"&&"+e}function Nb(e,t){return n=>n+" instanceof "+Et(e,t)}function Db(e){let t=fe[e.s.type];if(t&1){let i=[{c:Ar(yn),f:$e}],o=e.e.format,a=0;return o==="int32"?i.push({c:Bs,f:$e}):a=1,a===1&&(e.g.o&2||i.push({c:s=>"!"+vr(s),f:$e})),Y(e,e.e,i,void 0)}if(!(t&2))return t&4?e.s.format!==e.e.format&&e.e.format==="int32"?Y(e,e.e,[{c:Bs,f:$e}],void 0):e:Wn(e,e.s,e.e);let n=Qe(e.g),r=ut(e,n,e.e,void 0);return r.v=Ke,r.cp="let "+n+"=+"+e.v()+";",r.vc=[{c:i=>{let o=e.e.format;return o!==void 0&&o==="int32"?Bs(n):"!"+vr(n)},f:$e}],r}function dd(){return Sn(yn,yn,e=>{e.decoder=Db})}function Lb(e){return ut(e,'""+'+e.i,Pr(),void 0)}function Jb(e){let t=fe[e.s.type];if(t&1)return Y(e,e.e,[{c:Ar(Tr),f:$e}],void 0);if(!(t&3132&&It in e.s))return t&1036?Lb(e):t&2?e:Wn(e,e.s,e.e);let n=""+e.s.const,r=Pe(Tr,!1);return r.const=n,ut(e,'"'+n+'"',r,void 0)}function Pr(){return Sn(Tr,Tr,e=>{e.decoder=Jb})}function Ub(e){let t=fe[e.s.type];if(t&1)return Y(e,e.e,[{c:Ar(Ko),f:$e}],void 0);if(!(t&2))return t&8?e:Wn(e,e.s,e.e);let n=Qe(e.g),r=ut(e,n,e.e,void 0);r.v=Ke;let i=e.v();return r.cp="let "+n+";("+r.i+"="+i+'==="true")||'+i+'==="false"||'+kf(e,void 0)+";",r}function ld(){return Sn(Ko,Ko,e=>{e.decoder=Ub})}function Rf(e,t){e[fe[t]&768?ki:t]=!0}function wr(e){let t=e.e;if(t.noValidation&&!e.u)return hn(e,t,void 0);if(It in e.s)return e.s.const===t.const?e:hn(e,t,void 0);let n=fe[t.type];if(!(fe[e.s.type]&2&&n&3132))return n&2048?Y(e,t,[{c:vr,f:$e}],void 0):Y(e,t,[{c:o=>o+"==="+Ai(e,t),f:$e}],void 0);let r=Pe(Tr,!1);r.const=""+t.const;let i=hn(e,r,r);return i.vc=[{c:o=>o+'==="'+r.const+'"',f:$e}],hn(i,t,t)}function vn(){return Sn(lt,lt,e=>{e.const=void 0,e.decoder=wr})}function wi(){return Sn(kr,kr,e=>{e.const=null,e.decoder=wr})}function If(){return Sn(zs,zs,e=>{e.const=NaN,e.decoder=wr})}function ud(e){if(e===null)return wi();let t=typeof e;if(t===lt)return vn();if(t===yn&&Number.isNaN(e))return If();if(t===Re){let r=Pe(nd,!0);return r.class=e.constructor,r.const=e,r.decoder=wr,r}let n=Pe(t,!0);return n.const=e,n.decoder=wr,n}function ye(e){let t=e,n,r=0;for(;!t.io||t.e.to;){let i=n;n=void 0;let o=t;if(r=r+1|0,r>50)throw new Error("Loop count exceeded 100");if(o.e.$defs&&(o.g.d?Object.assign(o.g.d,o.e.$defs):o.g.d=o.e.$defs),o.f&1){let a=o.v(),s=Vt(o),l=ye(s),u=Pt(l,void 0);t=s.i!==l.i||u!==""?ut(o,a+".then("+a+"=>{"+u+"return "+l.i+"})",l.s,l.e):Y(o,l.s,void 0,l.e),t.f=t.f|1,t.io=!0}else if(o.io){let a=o.e.to,l=o.e.parser;t=l!==void 0?l(o):Y(t,void 0,void 0,a)}else{let a=o.s.encoder;a&&a!==i&&o.s!==o.e&&o.e.type!==ki&&(t=a(o,o.e)),o!==t?n=a:(t=o.e.decoder(o),t.io||(t=Si(t,t)))}}return t}function bn(e){for(;;){let t=e,n=t.to;if(n===void 0)return t;e=n}}function Wt(e){if(Un in e)return e[Un];let t,n=e;for(;n;){let i=_t(n),o=i.to,a=t;a!==void 0?i.to=a:delete i.to;let s=i.parser,l=i.serializer;l!==void 0?i.parser=l:delete i.parser,s!==void 0?i.serializer=s:delete i.serializer;let u=i.refiner,d=i.inputRefiner;d!==void 0?i.refiner=d:delete i.refiner,u!==void 0?i.inputRefiner=u:delete i.inputRefiner;let m=i.fromDefault,p=i.default;p!==void 0?i.fromDefault=p:delete i.fromDefault,m!==void 0?i.default=m:delete i.default;let f=i.items;f!==void 0&&(i.items=f.map(Wt));let h=i.properties;if(h!==void 0){let b={},T=Object.keys(h);for(let v=0,g=T.length;v<g;++v){let R=T[v];b[R]=Wt(h[R])}i.properties=b}typeof i.additionalItems===Re&&(i.additionalItems=Wt(i.additionalItems));let c=i.anyOf;if(c!==void 0){let b={},T=[];for(let v=0,g=c.length;v<g;++v){let R=c[v],M=Wt(R);T.push(M),Rf(b,M.type)}i.has=b,i.anyOf=T}let y=i.$defs;if(y!==void 0){let b={};for(let T=0,v=Object.keys(y).length;T<v;++T){let g=Object.keys(y)[T];b[g]=Wt(y[g])}i.$defs=b}t=i,n=o}let r=t;return Ot[xr]=r,nt(e,Un,Ot),Ot[xr]=e,nt(r,Un,Ot),r}function Mf(e){try{return ye(e)}catch(t){let n=Yo(t),r=e.p;throw n.path=(r!==void 0?r.path:"")+(e.path+"[]"+n.path),n}}function Gf(e,t,n,r){let i=jb(It in e?_e:e,t,n,r),o=ye(i),a=Pt(o,void 0),s=Ib(o.f,1);t.isAsync=s;let l=o.t===!0;if(t.hasTransform=l,a===""&&(o===i||o.i===i.i)&&!(n&1))return Ef;let u=o.i;n&1&&!s&&!r&&(u="Promise.resolve("+u+")");let d="i=>{"+a+"return "+u+"}",m=i.g.e,p=new Function("e","s","return "+d)(m,ed);return p.embedded=i.g.e,p}function Qs(e,t){let n=arguments,r=0,i,o="",a=0,s;for(;i===void 0;){let u=n[r];if(u)if(typeof u===yn){let d=u|gi.f;i=d,o=o+"-"+d}else{let d=u.seq;d>a&&(a=d,s=u),o=o+d+"-",r=r+1|0}else{let d=gi.f;i=d,o=o+"-"+d}}let l=s;if(l!==void 0){let u=o;if(u in l)return l[u];let d=n[r-1|0];for(let p=r-2|0;p>=0;--p){let f=d;d=gn(n[p],h=>{h.to=f})}let m=Gf(d,d,i,0);return Ot[xr]=m,nt(l,u,Ot),m}throw new Error("[Sury] No schema provided for decoder.")}function Bb(e){let t=Y(e,void 0,void 0,cd());return t.cp=kf(e,void 0)+";",t}function cd(){return Sn(Ws,Ws,e=>{e.decoder=Bb})}function Kb(e){let t=e.e.to;return ut(e,"{"+zn+":"+bn(e.e).properties[zn].const+"}",t,t)}function Cr(e,t){return{v:Ho,i:"",s:t.type===Ht?{type:Ht,decoder:Ci,additionalItems:"strict",items:[]}:{type:Re,decoder:Rr,additionalItems:"strict",required:[],properties:{}},e:e.e,prev:e,f:0,d:{},cp:"",hd:"",t:!0,path:e.path,g:e.g}}function fd(e){return Xo(e,vn())}function Rr(e){let t=e.u,n=e.e,r=fe[e.s.type],i;if(r&65){let d=r&64,m;if(d)m=e.s;else{let f=Pe(Re,!1);f.properties=Ys,f.additionalItems=_e,m=f}let p=[];d||(p.push({c:Pf,f:$e}),n.additionalItems!=="strip"&&p.push({c:f=>"!"+Vo(f),f:$e})),i=p.length!==0?Y(e,m,p,void 0):Y(e,m,void 0,void 0)}else i=Wn(e,e.s,n);let o=n.additionalItems,a;a=o==="strip"||o==="strict"?void 0:o;let s=i.s.additionalItems,l;l=s!=="strip"&&s!=="strict";let u;if(a!==void 0)if(a===_e)u=i;else if(l){let d=i.v(),m=Qe(i.g),p=wf(i,m),f=Mf(p),h=f.t,c=h?ut(i,"{}",n,void 0):Y(i,n,void 0,void 0),y=sd(f,i,m,h?()=>Of(c,m,f):void 0);if((h||y!=="")&&(c.cp=c.cp+("for(let "+m+" in "+d+"){"+y+"}")),f.f&1){let b=Qe(c.g),T=Qe(c.g),v=Qe(c.g),g=Qe(c.g),R=c.v();u=Cf(c,"new Promise(("+b+","+T+")=>{let "+g+"=Object.keys("+R+").length;for(let "+m+" in "+R+"){"+R+"["+m+"].then("+v+"=>{"+R+"["+m+"]="+v+";if("+g+"--===1){"+b+"("+R+")}},"+T+")}})")}else u=c}else{let d=Cr(i,n),m=Object.keys(i.s.properties);for(let p=0,f=m.length;p<f;++p){let h=m[p],c=vi(i,h);c.e=a,c.io=!1,c.u=t,Rt(d,h,ye(c))}u=Or(d)}else{let d=n.properties,m=Object.keys(d),p=m.length,f=Cr(i,n),h=n.additionalItems,c;c=h==="strip"||h==="strict"?h==="strip"?l||Object.keys(i.s.properties).length!==p:!1:!0;let y=i.s.additionalItems,b;b=y==="strip"||y==="strict"?!1:y.name===Jn;for(let v=0;v<p;++v){let g=m[v],R=d[g],M=vi(i,g);M.e=R,M.io=!1,M.u=t,b&&R.type===pt&&R.has[lt]&&(M.i="("+M.i+"??null)");let W=ye(M);t&&It in R&&Af(i,W,g),Rt(f,g,W),c||(c=W.t)}let T=!1;if(n.additionalItems==="strict"){let v=i.s.additionalItems,g;g=v!=="strip"&&v!=="strict",T=g}if(T){let v=Qe(f.g);if(Wo(i,v),f.cp=f.cp+("for("+v+" in "+i.v()+"){if("),m.length!==0)for(let g=0,R=m.length;g<R;++g){let M=m[g];g!==0&&(f.cp=f.cp+"&&"),f.cp=f.cp+(v+"!=="+Kn(i.g,M))}else f.cp=f.cp+"true";f.cp=f.cp+("){"+bi(i,g=>({code:"unrecognized_keys",path:f.path,reason:'Unrecognized key "'+g+'"',keys:[g]}),v)+"}}")}if(c)u=Or(f);else{let v=Y(i,void 0,void 0,void 0);v.cp=f.cp,v.d=f.d,u=v}}return Si(u,i)}function zb(){let e=ud(0),t={};return t[zn]=e,{type:Re,serializer:n=>{let r=n.e.to;return hn(n,r,r)},decoder:Rr,additionalItems:"strip",required:[zn],properties:t}}function Ci(e){let t=e.u,n=e.e,r=fe[e.s.type],i=n.items,o=i.length,a;if(r&129){let d=r&128,m=d?e.s:Oi(_e),p=[];d||p.push({c:Vo,f:$e});let f=m.additionalItems,h;if(h=f==="strip"||f==="strict"?m.items.length===o:!1,!h){let c=n.additionalItems;(c==="strip"||c==="strict")&&(c==="strip"?p.push({c:y=>y+".length>="+o,f:$e}):p.push({c:y=>y+".length==="+o,f:$e}))}a=p.length!==0?Y(e,m,p,void 0):Y(e,m,void 0,void 0)}else a=Wn(e,e.s,n);let s=n.additionalItems,l,u=0;if(s==="strip"||s==="strict")u=1;else if(s===_e)l=a;else{let d=a.v(),m=Qe(a.g),p=wf(a,m),f=Mf(p),h=f.t,c=h?ut(a,"new Array("+d+".length)",n,void 0):Y(a,n,void 0,void 0),y=sd(f,a,m,h?()=>Of(c,m,f):void 0);(h||y!=="")&&(c.cp=c.cp+("for(let "+m+"="+o+";"+m+"<"+d+".length;++"+m+"){"+y+"}")),l=f.f&1?Cf(c,"Promise.all("+c.i+")"):c}if(u===1){let d=Cr(a,n),m=n.additionalItems,p;if(m==="strip"||m==="strict")if(m==="strip"){let f=a.s.additionalItems;p=f==="strip"||f==="strict"?a.s.items.length!==o:!0}else p=!1;else p=!0;for(let f=0;f<o;++f){let h=i[f],c=f.toString(),y=vi(a,c);y.e=h,y.io=!1,y.u=t;let b=ye(y);t&&It in h&&Af(a,b,c),Rt(d,c,b),p||(p=b.t)}if(p)l=Or(d);else{let f=Y(a,void 0,void 0,void 0);f.cp=d.cp,f.d=d.d,l=f}}return Si(l,a)}function Wb(e,t){let n=e.s.anyOf;return t.type===pt&&Ff(t)===void 0&&jf(t.anyOf,n)||!Hb(n,t)?e:$f(e,t)}function qf(e){let t=e.e,n=t.anyOf,r=fe[e.s.type],i=Ff(t);if(e.s===t&&i===void 0&&n.every(Uo)||r&256&&jf(n,e.s.anyOf)&&i===void 0||e.io&&e.e===e.s)return e;(r&256||e.s.encoder===void 0&&r&512)&&(e.s=_e);let o="";if(!(r&769)){let k=Ks(e.s),S=!1,E=!1,P=n.length,x=0;for(;o===""&&x<P;){let C=n[x];Ks(C)===k?o=k:C.type===kr?S=!0:C.type===lt&&(E=!0),x=x+1|0}o===""&&(r&16&&S?o=kr:r&32&&E&&(o=lt))}let a=o,s=e.i,l=k=>Et(e,function(){let S=arguments,E=Tf(t,_e,e.path,S[0],!0,S.length>1?Array.from(S).slice(1):void 0,void 0);throw new Bn(E)})+"("+e.v()+k+")",u=Y(e,void 0,void 0,void 0),d=[],m={contents:""},p=(k,S)=>{let E=k[0],P=k[1],x="",C="",K=!1,Ce={contents:""},Fe="",rt={},ze=2,de=k.length-1|0;for(;ze<=de;){let Oe=Vt(P);Oe.u=!0,Oe.t=P.t,Oe.io=!1,Oe.e=k[ze];let Ie=ze===de,Ye=ze===2,wn=Ye&&Ie,Xn=!wn,yt=!1,jt="",nn={contents:""};try{let ue=ye(Oe);if(d.push(ue.s),jt=Pt(ue,nn),ue.t){u.t=!0,ue.f&1&&(u.f=u.f|1);let gt=E.v();ue.i!==gt&&(jt=jt+(gt+"="+ue.i))}}catch(ue){let gt=Et(Oe,Yo(ue));Fe=Fe+","+gt,S&&wn?(m.contents=gt,yt=!0):Ie?(Xn=!1,jt=S?"throw "+gt:l(Fe)):yt=!0}let rn=nn.contents,Cn=jt;if(!yt&&rn)if(Cn){let ue=rt[rn];ue!==void 0?typeof ue=="string"?rt[rn]=[ue,Cn]:ue.push(Cn):rt[rn]=Cn}else Ce.contents=Ce.contents?Ce.contents+"||"+rn:rn;if(!yt&&(!rn||Ie)){let ue=Object.keys(rt);for(let gt=0,V_=ue.length;gt<V_;++gt){let sl=ue[gt];x=x+(K?"else if":"if")+("("+sl+"){");let Hr=rt[sl];if(typeof Hr=="string")x=x+Hr+"}";else{let Ea="";for(let zi=0,Q_=Hr.length;zi<Q_;++zi){let Z_=Hr[zi],dl="e"+zi;x=x+("try{"+Z_+"}catch("+dl+"){"),Ea=Ea+","+dl}x=x+l(Ea)+"}".repeat(Hr.length)+"}"}K=!0}rt={}}if(!yt&&!rn)if(Cn)if(Ce.contents&&(x=x+(K?"else if":"if")+("(!("+Ce.contents+")){"),C="}"+C,Ce.contents="",K=!1),Ie&&(S||!Xn||Ye))x=x+((K?"else{":"")+Cn),C=(K?"}":"")+C;else{let ue="e"+(ze-2|0);x=x+((K?"else{":"")+"try{"+Cn+"}catch("+ue+"){"),C=(K?"}":"")+"}"+C,Fe=Fe+","+ue,K=!1}else Ce.contents="",ze=de,Xn=!1;if(Ie){if(Ce.contents)x||Fe?x=x+(K?"else if":"if")+("(!("+Ce.contents+")){"+l(Fe)+"}"):ad(P,{c:ue=>"("+Ce.contents+")",f:$e});else if(Xn){let ue=l(Fe);x=x+(K?"else{"+ue+"}":ue)}}ze=ze+1}return x+C},f="",h="",c="",y=!1,b=n.length-1|0,T={},v=[],g=t.refiner,R=t.inputRefiner,M={contents:void 0},W={contents:void 0},be=(k,S,E)=>{if(S===void 0)return k;let P=x=>{let C=E.contents;if(C!==void 0)return C;let K=S(x);return E.contents=K,K};return k!==void 0?x=>{let C=k(x),K=P(x);for(let Ce=0,Fe=K.length;Ce<Fe;++Ce)C.push(K[Ce]);return C}:P},A=k=>{let S=be(k.refiner,g,M);S!==void 0&&(k.refiner=S);let E=be(k.inputRefiner,R,W);if(E!==void 0){k.inputRefiner=E;return}},q;if(It in e.s){let k=[],S=[];for(let E=0;E<=b;++E){let P=n[E];It in P&&P.const===e.s.const?k.push(P):S.push(P)}q=k.concat(S)}else q=n;for(let k=0;k<=b;++k){let S=i!==void 0?gn(q[k],C=>{A(C),C.to=i}):q[k],E=S.type,P=fe[E],x=Ks(S);if((a===""||a===x)&&!(P&16&&"fromDefault"in t)){let C=T[x];if(C!==void 0)P&64&&zn in S.properties?C.splice(C.length-1|0,0,S):P&2096||C.push(S);else{let K=Vt(e),Ce;if(P&37633)Ce=_e;else{let de=Pe(S.type,!1);de.encoder=S.encoder,P&8192?de.class=S.class:P&64?(de.properties=Ys,de.additionalItems=_e):P&128?(de.additionalItems=_e,de.items=Zo):P&2096&&(de.const=S.const),de.decoder=Oe=>fe[Oe.s.type]&1?Y(Oe,Oe.e,[{c:Ie=>{let Ye=fe[S.type];if(Ye&64)return Pf(Ie)+"&&!"+Vo(Ie);if(Ye&128)return Vo(Ie);if(Ye&8192)return Nb(Oe,S.class)(Ie);if(!(Ye&4))return Ye&2048?vr(Ie):Ye&48?Ie+"==="+Ai(Oe,S):Ye&17418?Ar(S.type)(Ie):"";let wn=Ar(yn)(Ie);return Oe.g.o&2?wn:wn+"&&!"+vr(Ie)},f:$e}],void 0):S.decoder(Oe),Ce=de}K.e=Ce;let Fe;try{Fe=ye(K)}catch{K.vc=void 0,Fe=K}mf(P,T)?v.unshift(x):v.push(x),T[x]=[K,Fe,S];let rt=!0,ze=Fe;for(;ze!==void 0&&rt;){let de=ze;ze=de.prev,rt=!(de.vc&&xf(de))}if(rt){for(let de=0,Oe=v.length;de<Oe;++de){let Ie=v[de];if(!y){let Ye=T[Ie],wn=Ye[1],Xn=p(Ye,!0),yt=Pt(wn,void 0)+Xn,jt=m.contents;if(jt)if(m.contents="",yt){let nn="e"+(k+de|0);f=f+("try{"+yt+"throw "+jt+"}catch("+nn+"){"),h="}"+h,c=c+","+nn}else c=c+","+jt;else if(yt){let nn="e"+(k+de|0);f=f+("try{"+yt+"}catch("+nn+"){"),h="}"+h,c=c+","+nn}else y=!0}}T={},v=[]}}}}let $=T,Se=v;if(!y){let k=!1,S="";for(let x=0,C=Se.length;x<C;++x){let K=$[Se[x]],Ce=K[1],Fe=K[2],rt=p(K,!1),ze={contents:""},de=Pt(Ce,ze)+rt,Oe=ze.contents;de||mf(fe[Fe.type],$)?(f=f+(k?"else if":"if")+("("+Oe+"){"+de+"}"),k=!0):S=S?S+"||"+Oe:Oe}let E=l(c),P;S?P=(k?"else if":"if")+("(!("+S+")){"+E+"}"):P=k?"else{"+E+"}":h===""?E+";":E,f=f+P}u.cp=u.cp+f+h,e.i!==u.i&&(u.i=e.i);let G=u.f&1?(u.i="Promise.resolve("+u.i+")",u.v=Ho,u):u.v===Ke&&e.cp===""&&u.cp===""&&s==="i"?(e.hd="",e.v=Ho,e.i=s,e):u;return G.s=d.length?Qt(d):cd(),G.e=i!==void 0?(G.io=!0,bn(i)):t,G}function jf(e,t){return t.every((n,r)=>{let i=e[r];return i!==void 0&&!(fe[n.type]&9152)&&n.type===i.type&&n.const===i.const?n.to===void 0:!1})}function $f(e,t){return Y(e,_e,void 0,gn(e.s,n=>{n.to=t}))}function Hb(e,t){return!(fe[bn(t).type]&512)&&!(t.type===pt&&t.anyOf.some(n=>fe[n.type]&512))?!e.some(n=>n.to!==void 0||n.parser!==void 0?!0:fe[n.type]&512):!1}function Ff(e){if(e.parser!==void 0)return;let n=e.to;if(n!==void 0)return n}function vi(e,t){let n=e.d,r;if(n!==void 0)r=n;else{let d={};e.d=d,r=d}let i=r[t];if(i!==void 0)return Vt(i);let o=e.s.type===Re?e.s.properties[t]:e.s.items[t],a;if(o!==void 0)a=o;else{let d=e.s.additionalItems;a=d==="strip"||d==="strict"?Wn(e,e.s,e.e):e.s.type===Re&&d.type!==ki&&!(fe[d.type]&512)&&!Rb(d)?fd(d):d}let l="["+Kn(e.g,t)+"]",u={p:e,v:Vs,i:It in a?Ai(e,a):e.v()+l,s:a,e:a,f:0,cp:"",hd:"",path:e.path+l,g:e.g};return r[t]=u,u}function Or(e){let t=e.s.type===Ht,n="",r="",i,o=Object.keys(e.d);for(let u=0,d=o.length;u<d;++u){let m=o[u],p=e.d[m];if(p.f&1&&(r=r+p.i+","),p.o){let f=i;i=h=>(f!==void 0?f(h):"")+("if("+p.v()+"!==void 0){"+h+"["+Kn(e.g,m)+"]="+p.i+"}")}else n=n+(t?p.i:Kn(e.g,m)+":"+p.i)+","}if(e.i=t?"["+n+"]":"{"+n+"}",r){let u=Vt(e);u.io=!0;let d=ye(u),m=Pt(d,void 0);return m===""&&r===d.i+","?e.i=d.i:e.i="Promise.all(["+r+"]).then((["+r+"])=>{"+m+"return "+d.i+"})",e.f=e.f|1,e.s=d.s,e.e=d.e,e.io=!0,e}let a=i;if(a===void 0)return e;let s=a(e.v()),l=Y(e,void 0,void 0,void 0);return l.cp=l.cp+s,l}function Qt(e){let t=e.length;if(t===1)return e[0];if(t!==0){let n={},r=new Set;for(let o=0,a=e.length;o<a;++o){let s=e[o];s.type===pt&&s.to===void 0?(s.anyOf.forEach(l=>{r.add(l)}),Object.assign(n,s.has)):(r.add(s),Rf(n,s.type))}let i=Pe(pt,!1);return i.anyOf=Array.from(r),i.decoder=qf,i.encoder=Wb,i.has=n,i}throw new Error("[Sury] S.union requires at least one item")}function mf(e,t){return e&8320&&Re in t?!0:e&2048?yn in t:!1}function Ks(e){return fe[e.type]&8192?e.class.name:e.type}function Uo(e){for(;;){let t=e,n=!1,r=!1,i=!1;if(t.to===void 0&&t.parser===void 0&&!(fe[t.type]&512)){let a=t.anyOf;i=a!==void 0?a.every(Uo):!0}if(i){let a=t.items;r=a!==void 0?a.every(Uo):!0}if(r){let a=t.properties;n=a!==void 0?Object.values(a).every(Uo):!0}if(!n)return!1;let o=t.additionalItems;if(o===void 0||o==="strip"||o==="strict")return!0;e=o}}function Oi(e){let t=Pe(Ht,e[Un]===e);return t.additionalItems=e,t.items=Zo,t.decoder=Ci,t}function Xo(e,t){let n=t!==void 0?t:vn(),r=bn(e);switch(r.type){case"undefined":return Qt([n,pf(e)]);case"union":let o=r.has,a=r.anyOf;return gn(e,s=>{let l=Ab(o),u=[];for(let d=0,m=a.length;d<m;++d){let p=a[d],f=bn(p),h=f.type,c;if(h==="undefined")l[n.type]=!0,u.push(n),c=pf(p);else{let y=f.properties;if(y!==void 0){let b=y[zn];c=b!==void 0?gn(p,T=>{let v={},g={...b};g.const=b.const+1,v[zn]=g,T.properties=v}):p}else c=p}u.push(c)}u.length===a.length&&(l[n.type]=!0,u.push(n)),s.anyOf=u,s.has=l});default:return Qt([e,n])}}function pf(e){return gn(e,t=>{t.to=zb(),t.parser=Kb})}function ea(e){let t=Pe(Re,e[Un]===e);return t.properties=Ys,t.additionalItems=e,t.decoder=Rr,t}function _f(e){let t=e.e,n=t.$ref,r=e.g.d,i=n.slice(8),o=r[i],a=e.g.o,s=e.s.seq===t.seq?o:e.s,l=s.seq+"-"+o.seq+"--"+a,u="",d=o[l];if(d!==void 0){let c=N(d);u=c===0?Et(e,o)+('["'+l+'"]'):Et(e,c)}else{let c=j(o.hasTransform,!1),y=j(o.isAsync,!1),b=!0,T=0;for(;b;){b=!1,o.hasTransform===void 0&&(o.hasTransform=c),o.isAsync===void 0&&(o.isAsync=y),ff[xr]=0,nt(o,l,ff);let v=Gf(s,o,a,r);Ot[xr]=v,nt(o,l,Ot),T=v;let g=o.hasTransform,R=o.isAsync;(g!==c||R!==y)&&(c=g,y=R,delete o[l],b=!0)}u=Et(e,T)}let m=o.hasTransform===!0,p=o.isAsync,f="",h;if(m||p){let c=Qe(e.g);f="let "+c+";";let y=ut(e,c,t,t);y.v=Ke,y.cp=c+"="+u+"("+e.i+");",p&&(y.f=y.f|1),h=y}else{let c=Y(e,t,void 0,t);c.cp=u+"("+e.i+");",h=c}return h.prev=void 0,h.cp=f+sd(h,e,void 0,void 0),h.fz=void 0,h.prev=e,h}function Qb(e,t){return gn(e,n=>{let r=t(n),i=n.refiner;i!==void 0?n.refiner=o=>{let a=i(o),s=r(o);for(let l=0,u=s.length;l<u;++l)a.push(s[l]);return a}:n.refiner=r})}function Nf(e,t,n,r){let i=n!==void 0?n:"Refinement failed",o=r!==void 0?Ob(r):"";return Qb(e,a=>(s=>{let l=Et(s,t);return[{c:u=>l+"("+u+")",f:od(void 0,o,i,void 0)}]}))}function md(){let e=_t(wi());return e.to=vn(),e}function Df(e,t){return gn(e,n=>{let r=n.anyOf;if(r!==void 0){let o=[],a=[];for(let p=0,f=r.length;p<f;++p){let h=r[p],c=bn(h);c.type!=="undefined"&&(o.push(c),a.push(h))}let s=o.length,l;if(s!==1)if(s!==0)l=Qt(o);else{let p="Can't set default for "+Ae(n);throw new Error("[Sury] "+p)}else l=o[0];let u=a.length!==1?Qt(a):a[0];if(t.TAG==="Value"){let p=t._0;try{Qs(_e,l)(p)}catch(f){let h=Yo(f),c="Invalid default for "+Ae(n)+": "+h.message;throw new Error("[Sury] "+c)}try{n.default=Qs(Wt(u),void 0)(p)}catch{}}n.parser=p=>{let f=p.e.to,h=p.v(),c;return c=t.TAG==="Value"?Ai(p,ud(t._0)):Et(p,t._0)+"()",ut(p,h+"===void 0?"+c+":"+h,f,f)};let d=_t(l),m=d.decoder;d.serializer=p=>{let f=Wt(u);return Y(m(p),f,void 0,f)},d.decoder=vf,n.to=d;return}let i="Can't set default for "+Ae(n);throw new Error("[Sury] "+i)})}function Zs(e,t){let n=fe[t.type];if(n&46)return ye(Y(e,_e,void 0,t));if(n&2064){let i=_t(wi());return i.to=t,ye(Y(e,_e,void 0,i))}if(n&128){let i=Oi(_e),o=ye(Y(e,_e,void 0,i));return o.s.additionalItems=Ve(),o.e=t,o.io=!1,o}if(n&64){let i=ea(_e),o=ye(Y(e,_e,void 0,i));return o.s.additionalItems=Ve(),o.e=t,o.io=!1,o}if(n&768)return e;let r=_t(Pr());return r.to=t,ye(Y(e,_e,void 0,r))}function Sr(e){let t=fe[e.type],n=!0;if(!(t&46||e.$ref===Ve().$ref||t&256&&e.anyOf.every(Sr))){let i=!1;if(t&128){let o=e.additionalItems,a;a=o==="strip"||o==="strict"?!0:Sr(o),i=a}n=i&&e.items.every(Sr)}if(n)return!0;let r=!1;if(t&64){let i=e.additionalItems,o;o=i==="strip"||i==="strict"?!0:Sr(i),r=o}return r?Object.values(e.properties).every(Sr):!1}function hf(e){let t=fe[e.s.type];if(Sr(e.s))return e;if(t&2064)return hn(e,wi(),void 0);if(t&128){let n=Pe(Ht,!1);n.items=e.s.items.map(o=>Ve()),n.decoder=Ci;let r=e.s.additionalItems,i;return i=r==="strip"||r==="strict"?r:Ve(),n.additionalItems=i,n.to=e.e.to,ye(Y(e,void 0,void 0,n))}if(t&64){let n=e.s.additionalItems;if(!(n==="strip"||n==="strict")){let o=ea(Ve());return o.to=e.e.to,ye(Y(e,void 0,void 0,o))}let r=Cr(e,e.s);r.e=Ve(),e.e.to&&(r.e=_t(r.e),r.e.to=e.e.to);let i=Object.keys(e.s.properties);for(let o=0,a=i.length;o<a;++o){let s=i[o],l=vi(e,s);if(l.io=!1,l.s.type===pt&&l.s.has[lt]){l.e=Qt([vn(),Ve()]);let u=ye(l);u.o=!0,Rt(r,s,u)}else l.e=Ve(),Rt(r,s,ye(l))}return Or(r)}if(t&512)return _f(e);if(t&256&&!(lt in e.s.has))return ye($f(e,e.e));if(t&1)return e.e.to&&!e.e.parser?(e.s=Ve(),Zs(e,e.e)):e.e.noValidation?(e.s=Ve(),e):_f(e);try{let n=_t(Pr());return n.to=e.e,e.e=n,ye(e)}catch{return Wn(e,e.s,Ve())}}function Ve(){return Sn(Jn,Hs,e=>{let t=Pe(Hs,!0);t.$ref=Vb+Jn,t.name=Jn,t.decoder=hf,t.encoder=Zs,e.$ref=t.$ref,e.name=Jn,e.decoder=hf,e.encoder=Zs;let n=[Pr(),ld(),dd(),wi(),ea(t),Oi(t)],r={};n.forEach(a=>{r[a.type]=!0});let i=Pe(pt,!0);i.anyOf=n,i.has=r,i.decoder=qf,i.name=Jn,i.type=pt;let o={};o[Jn]=i,e.$defs=o})}function Zb(e){return e[td]}function Ti(e,t,n){let r=_t(bn(e));return r.from=t,n!==void 0&&(r.fromFlattened=n),new Proxy(r,{get:(i,o)=>{if(o===td)return i;let a=i.items,s=i.properties,l=s!==void 0?s[o]:a!==void 0?a[o]:void 0;if(l===void 0){let u='Cannot read property "'+o+'" of '+Ae(i);throw new Error("[Sury] "+u)}return Ti(l,i.from.concat(o),i.fromFlattened)}})}function Lf(e,t,n){let r=Cr(e,t);r.io=!0;let i=t.items;if(i!==void 0)for(let o=0,a=i.length;o<a;++o){let s=o.toString();Rt(r,s,n(s,i[o]))}else{let o=t.properties;if(o!==void 0){let a=Object.keys(o);for(let s=0,l=a.length;s<l;++s){let u=a[s];Rt(r,u,n(u,o[u]))}}else{let a="Don't know where the value is coming from: "+Ae(t);throw new Error("[Sury] "+a)}}return Or(r)}function Jf(e,t){let n=t.from,r=t.fromFlattened,i=r!==void 0?Vt(yf(e.fv[r],t.from,0)):n!==void 0?Vt(yf(e,n,0)):It in t?hn(e,t,void 0):Lf(e,t,(o,a)=>Jf(e,a));return i.prev=void 0,i.e=t,i}function Uf(e,t){let n=t.e,r=n.from;if(r!==void 0){let a=n.fromFlattened,s;if(a!==void 0){e.flattened===void 0&&(e.flattened=[]);let l=e.flattened[a];if(l!==void 0)s=l;else{let u={};e.flattened[a]=u,s=u}}else s=e;for(let l=0,u=r.length;l<u;++l){let d=r[l],m=s.properties,p;if(m!==void 0)p=m;else{let c={};s.properties=c,p=c}let f=p[d],h;if(f!==void 0)h=f;else{let c={};p[d]=c,h=c}s=h}s.val=t;return}let i=t.d;if(i===void 0)return;let o=Object.keys(i);for(let a=0,s=o.length;a<s;++a)Uf(e,i[o[a]])}function Bo(e,t,n,r){let i=0;if(t!==void 0){let o=t.val;if(o!==void 0){let a=Vt(o);return a.t=!0,a.s=n,a.e=n,ye(a)}i=1}else i=1;if(i===1){if(It in n){let m=hn(e,n,n);return m.prev=void 0,m.p=e,m.v=Vs,m.io=!0,ye(m)}let o=t===void 0?bn(n):n,a=Cr(e,o);a.e=o,a.io=!0,a.prev=void 0,a.p=e,a.v=Vs;let s=o.flattened,l=o.items,u=0,d=0;if(l!==void 0&&(t!==void 0||typeof o.additionalItems!==Re))for(let m=0,p=l.length;m<p;++m){let f=m.toString(),h;if(t!==void 0){let y=t.properties;h=y!==void 0?y[f]:void 0}else h=void 0;let c=Kn(e.g,f);Rt(a,f,Bo(e,h,l[m],r+("["+c+"]")))}else d=3;if(d===3){let m=o.properties;if(m!==void 0&&(t!==void 0||typeof o.additionalItems!==Re)){if(s!==void 0&&t!==void 0){let f=t.flattened;f!==void 0&&f.forEach((h,c)=>{let b=Bo(e,h,Wt(s[c]),r).d,T=Object.keys(b);for(let v=0,g=T.length;v<g;++v){let R=T[v];Rt(a,R,b[R])}})}let p=Object.keys(m);for(let f=0,h=p.length;f<h;++f){let c=p[f];if(!(c in a.d)){let y;if(t!==void 0){let T=t.properties;y=T!==void 0?T[c]:void 0}else y=void 0;let b=Kn(e.g,c);Rt(a,c,Bo(e,y,m[c],r+("["+b+"]")))}}}else u=2}if(u===2){let m=n.from,p=m!==void 0?r+m.map(h=>'["'+h+'"]').join(""):r,f=p===""?"":" at "+p;Fb(e,"Missing input for "+Ae(n)+f)}return Or(a)}}function yf(e,t,n){for(;;){let r=n,i=e,o=t[r];if(o===void 0)return i;n=r+1|0,e=i.d[o]}}function Qo(e,t){if(typeof e!==Re||e===null)return ud(e);let n=t(e);if(n!==void 0)return n;if(Array.isArray(e)){for(let l=0,u=e.length;l<u;++l){let d=Qo(e[l],t);e[l]=d}let s=Pe(Ht,!1);return s.items=e,s.additionalItems="strict",s.decoder=Ci,s}let r=e.constructor;if(r&&r!==Object){let s=Pe(nd,!0);return s.class=r,s.const=e,s.decoder=wr,s}let i=Object.keys(e),o=i.length;for(let s=0;s<o;++s){let l=i[s],u=Qo(e[l],t);e[l]=u}let a=Pe(Re,!1);return a.required=i,a.properties=e,a.additionalItems=gi.a,a.decoder=Rr,a}function Yb(e){let t={};Uf(t,e);let n=e.e.to,r=Bo(e,t,n,"");return r.t=!0,r.prev=e,r}function Ei(e){return Qo(e,t=>{if(t["~standard"])return t})}function Bf(e){let t=this,n="~"+e,r=t[n];if(r!==void 0)return N(r);let i={},o=[],a=Pe(Re,!1);a.required=o,a.properties=i,a.additionalItems=gi.a,a.decoder=Rr;let s=t.f(e,a)[td],l=(f,h)=>{let c=Er(f);if(f in i)throw new Error("[Sury] "+("The field "+c+" defined twice"));return o.push(f),i[f]=h,Ti(h,s.from.concat(f),s.fromFlattened)},p={field:l,f:l,fieldOr:(f,h,c)=>{let y=Xo(h,void 0);return l(f,Df(y,{TAG:"Value",_0:c}))},tag:(f,h)=>{l(f,Ei(h))},nested:Bf,flatten:f=>{if(f.type==="object"){let y=f.to,b=f.properties;if(y){let g="Unsupported nested flatten for transformed object schema "+Ae(f);throw new Error("[Sury] "+g)}let T=Object.keys(b),v={};for(let g=0,R=T.length;g<R;++g){let M=T[g];v[M]=l(M,b[M])}return v}let c="Can't flatten "+Ae(f)+" schema";throw new Error("[Sury] "+c)}};return t[n]=p,p}function Kf(e){let t=_t(Qo(e,Zb));return t.serializer=Yb,t}function zf(e){let t=e.e.flattened;if(t!==void 0){let i=[];for(let o=0,a=t.length;o<a;++o){let s=t[o],l=s.to,u;if(l!==void 0){let d=Vt(e);d.e=s,d.io=!0,u=ye(d)}else{let d=Lf(e,s,(m,p)=>vi(e,m));d.e=s,d.prev=void 0,u=Si(d,d)}i.push(u),e.cp=e.cp+Pt(u,void 0)}e.fv=i}let n=e.e.to,r=Jf(e,n);return r.t=!0,r.prev=e,Si(r,e)}function Wf(e){let t,n={},r=d=>{if(d.type==="object"){let f=d.properties,h=Object.keys(f);for(let y=0,b=h.length;y<b;++y){let T=h[y],v=f[T],g=n[T];if(g!==void 0){if(g!==v)throw new Error("[Sury] "+('The field "'+T+'" defined twice with incompatible schemas'))}else n[T]=v}let c=t||(t=[]);return Ti(d,Zo,c.push(d)-1|0)}let p="The '"+Ae(d)+"' schema can't be flattened";throw new Error("[Sury] "+p)},i=(d,m)=>{if(d in n)throw new Error("[Sury] "+('The field "'+d+'" defined twice with incompatible schemas'));return n[d]=m,Ti(m,[d],void 0)},l=e({field:i,f:i,fieldOr:(d,m,p)=>{let f=Xo(m,void 0);return i(d,Df(f,{TAG:"Value",_0:p}))},tag:(d,m)=>{i(d,Ei(m))},nested:Bf,flatten:r}),u=Pe(Re,!1);return u.required=Object.keys(n),u.properties=n,u.additionalItems=gi.a,u.decoder=Rr,u.parser=zf,u.to=Kf(l),t!==void 0&&(u.flattened=t),u}function Hf(e){let t=[],n=(s,l)=>{let u=s.toString();if(t[s])throw new Error("[Sury] "+("The item ["+u+"] is defined multiple times"));return t[s]=l,Ti(l,[s.toString()],void 0)},o=e({item:n,tag:(s,l)=>{n(s,Ei(l))}});for(let s=0,l=t.length;s<l;++s)t[s]||(t[s]=vn());let a=Pe(Ht,!1);return a.items=t,a.additionalItems="strict",a.decoder=Ci,a.parser=zf,a.to=Kf(o),a}function Xb(e){return e}function tS(e){return Ei(e(eS))}function Qf(e){return Qt(e.map(Vf))}function Zf(e){return Xo(e,md())}function Yf(e){return Qt([e,vn(),md()])}var Ys,Zo,Ab,Xs,ed,td,Tr,yn,Eb,Ko,Pb,kr,lt,zs,nd,Ht,Re,pt,Ws,ki,Hs,gf,It,fe,Bn,nt,xi,bf,rd,id,gi,Ot,ff,xr,Un,Us,_e,_t,Jn,zn,Vb,eS,Vf,Xf,em,tm,nm,rm=_(()=>{uf();cf();w();D();ee();Ys={},Zo=[],Ab=(e=>({...e}));Xs="sury",ed=Symbol(Xs),td=Symbol(Xs+":item"),Tr="string",yn="number",Eb="bigint",Ko="boolean",Pb="symbol",kr="null",lt="undefined",zs="nan",nd="instance",Ht="array",Re="object",pt="union",Ws="never",ki="unknown",Hs="ref",gf=za("Sury.Exn"),It="const";fe={[ki]:1,[Tr]:2,[yn]:4,[Ko]:8,[lt]:16,[kr]:32,[Re]:64,[Ht]:128,[pt]:256,[Hs]:512,[Eb]:1024,[zs]:2048,function:4096,[nd]:8192,[Ws]:32768,[Pb]:16384};Bn=class extends Error{constructor(t){super();for(let n in t)this[n]=t[n]}},nt=Object.defineProperty,xi=Bn.prototype;nt(xi,"message",{get(){return Sf(this)}});nt(xi,"name",{value:"SuryError"});nt(xi,"s",{value:ed});nt(xi,"_1",{get(){return this}});nt(xi,"RE_EXN_ID",{value:gf});bf=1,rd=function(){},id=Object.create(null);nt(id,"with",{get(){return(e,...t)=>e(this,...t)}});rd.prototype=id;gi={m:Sf,d:void 0,a:"strip",f:0},Ot={},ff={configurable:!0},xr="value",Un="r";Us={};_e=Pe(ki,!0);_e.decoder=vf;_t=(e=>{let t=new rd;for(let n in e)t[n]=e[n];return t.seq=bf++,t});Ef.embedded=Zo;Jn="JSON";zn="BS_PRIVATE_NESTED_SOME_NONE";nt(id,"~standard",{get:function(){let e=this;return{version:1,vendor:Xs,validate:t=>{try{return{value:Qs(_e,e)(t)}}catch(n){let r=Yo(n);return{issues:[{message:r.reason,path:r.path===""?void 0:wb(r.path)}]}}}}}});Vb="#/$defs/";eS={m:Xb};Vf=Ei;Xf=Vf,em=ea,tm=Qt,nm=tS});var I,im,ht,Ir,Ze,ta,om,V,pd,am,Zt,na,Hn,Mt,Le,sm,Tn=_(()=>{rm();I=Pr(),im=ld(),ht=dd(),Ir=Ve(),Ze=Xf,ta=Oi,om=em,V=fd,pd=Zf,am=Yf,Zt=tm,na=Qf,Hn=Nf,Mt=nm,Le=Wf,sm=Hf});function Gt(e,t){return e.TAG==="Ok"?t(e._0):e}var ge=_(()=>{Ra()});var Mr=_(()=>{Tn();ee()});var Ri,dm,ra,iS,o0,_d=_(()=>{Tn();ge();Mr();Ri=Hn(I,e=>e.trim()!=="","empty author field",void 0),dm=Hn(Ri,e=>new RegExp("^[A-Za-z0-9+/]+={0,2}$").test(e),"expected unbroken base64 entity reference",void 0),ra=Hn(dm,e=>{let t=Buffer.from(e,"base64").toString("utf8");return new RegExp("^1:User:[1-9][0-9]*$").test(t)},"expected encoded User identity",void 0),iS=Hn(dm,e=>{let t=Buffer.from(e,"base64").toString("utf8");return new RegExp("^1:CodingJob:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$").test(t)},"expected encoded CodingJob identity",void 0),o0=Zt([Le(e=>(e.tag("kind","agent"),{kind:"agent",agent_id:e.f("agent_id",iS),via_user_id:e.f("via_user_id",ra),display_name:e.f("display_name",Ri)})),Le(e=>(e.tag("kind","human"),{kind:"human",user_id:e.f("user_id",ra),display_name:e.f("display_name",Ri)})),Le(e=>(e.tag("kind","service"),{kind:"service",user_id:e.f("user_id",ra),display_name:e.f("display_name",Ri)})),Le(e=>(e.tag("kind","external"),{kind:"external",user_id:e.f("user_id",ra),display_name:e.f("display_name",Ri)})),Le(e=>(e.tag("kind","system"),{kind:"system"})),Le(e=>(e.tag("kind","unavailable"),{kind:"unavailable",author_kind:e.f("author_kind",Hn(I,t=>["agent","system","unknown"].includes(t),"unknown unavailable author kind",void 0)),reason:e.f("reason",Hn(I,t=>["not_visible","invalid_source"].includes(t),"unknown unavailable author reason",void 0))}))])});var Gr=_(()=>{_d()});var Ii=_(()=>{w();D()});var Qn=_(()=>{Wi();D()});var sa=_(()=>{Qn();B();w();ge();L();D();ie();ee()});function Gi(e){switch(e){case"LoggedIn":return"logged_in";case"NotLoggedIn":return"not_logged_in";case"BinaryMissing":return"binary_missing";case"ProbeFailed":return"probe_failed"}}var yd=_(()=>{});var lS,uS,cS,fS,m0,da=_(()=>{Tn();ge();Mr();ie();lS=Zt([Ze("openai"),Ze("wafer")]),uS=Mt(e=>({sourceSeq:e.m(ht),provider:e.m(lS),model:e.m(I)})),cS=Zt([Ze("catalog_unavailable"),Ze("offered"),Ze("delisted"),Ze("unverified")]),fS=Mt(e=>({selection:e.m(uS),baseUrl:e.m(I),token:e.m(I),catalogStatus:e.m(V(cS))})),m0=Mt(e=>({source:e.m(fS),turn:e.m(om(Ir))}))});var mm=_(()=>{w();L();ie();sa();yd();da()});var pm=_(()=>{w();ge();Ii();L();ie();mm()});var qi=_(()=>{X()});var v0,T0,k0,_m=_(()=>{qi();X();B();w();ge();ie();ee();v0=1800*1e3,T0=new RegExp("[^A-Za-z0-9._-]+","g"),k0=new RegExp("^[-.]+|[-.]+$","g")});var ym=_(()=>{X();B();w();ge();ie();_m()});var gm=_(()=>{dt();w();ge();Is();L();D();ie();ee();pm();ym()});var vd=_(()=>{gm()});var Sm=_(()=>{"use strict";Gr();vd();Io();Te();Ee()});var vm=_(()=>{});function vS(e){switch(e){case"HumanReview":return"human_review";case"AutomaticReview":return"automatic_review";case"AcceptEdits":return"accept_edits";case"DenyRequests":return"deny_requests";case"DangerousBypass":return"dangerous_bypass"}}var sO,Tm=_(()=>{sO=["HumanReview","AutomaticReview","AcceptEdits","DenyRequests","DangerousBypass"].map(vS)});var bO,Td=_(()=>{X();w();ge();L();D();vm();Tm();bO=Object.fromEntries([["granular",Object.fromEntries([["sandbox_approval",!1],["rules",!1],["skill_approval",!1],["request_permissions",!1],["mcp_elicitations",!0]])]])});var xm=_(()=>{Qn();B();w();ge();L();D();Td();ee();da()});var Fr=_(()=>{});var Am=_(()=>{dt();Fr();B();w();L();D();ie()});function wm(e){return JSON.stringify(e)}var wS,CS,xO,AO,wO,CO,Cm=_(()=>{qi();dt();B();D();Am();wS="file",CS=["mcp_oauth_credentials_store","cli_auth_credentials_store"],xO=CS.flatMap(e=>["-c",e+'="'+wS+'"']);AO=["-c","model_providers.openai-linzumi.name="+wm("OpenAI"),"-c","model_providers.openai-linzumi.wire_api="+wm("responses"),"-c","model_providers.openai-linzumi.requires_openai_auth=true","-c","model_providers.openai-linzumi.supports_websockets=true"],wO=new RegExp("\\bsession\\b.+\\bis archived\\b","i"),CO=new RegExp("^thread not found(?:\\s*:|\\b)","i")});var Em=_(()=>{X();w();ge();D();ie();xm();Cm();_d()});var Pm=_(()=>{Em()});var xd=_(()=>{});var Ad=_(()=>{});var fa=_(()=>{w();ie();_i();xd();Ad()});var Mm=_(()=>{fa()});var Cd=_(()=>{"use strict"});function qS(e){let t=new Map;return{report:r=>{let i=r.key??r.message,o=r.audience??"user",a=e.nowMs(),s=t.get(i),l=s===void 0?{key:i,severity:r.severity,message:r.message,audience:o,count:1,firstAtMs:a,lastAtMs:a}:{...s,severity:r.severity,message:r.message,audience:o,count:s.count+1,lastAtMs:a};t.delete(i),t.set(i,l);for(let u of t.keys()){if(t.size<=GS)break;t.delete(u)}return e.writeAuditEvent(Gm,{severity:l.severity,audience:l.audience,key:l.key,message:l.message,count:l.count}),e.tuiActive()?(l.audience==="user"&&e.reportConsoleEvent(Gm,{severity:l.severity,key:l.key,message:l.message,count:l.count}),l):(l.count===1&&e.writeStderr(`${jS(l.severity)}${l.message}
20
- `),l)},notices:()=>Array.from(t.values()),reset:()=>t.clear()}}function jS(e){switch(e){case"warning":return"WARNING: ";case"error":return"ERROR: ";case"info":return""}}var GS,Gm,qm,$O,Od=_(()=>{"use strict";fn();GS=50,Gm="runner.notice";qm={tuiActive:()=>!1,reportConsoleEvent:()=>{}},$O=qS({tuiActive:()=>qm.tuiActive(),writeAuditEvent:(e,t)=>Nn(e,t),reportConsoleEvent:(e,t)=>qm.reportConsoleEvent(e,t),writeStderr:e=>{process.stderr.write(e)},nowMs:Date.now})});var jm=_(()=>{"use strict";Te();Ee()});var $m=_(()=>{"use strict"});var $i=_(()=>{"use strict";Te()});var Nm=_(()=>{"use strict";Gr();$m();$i()});var Dm=_(()=>{"use strict";pn();Ee();Te()});var $S,Ed,Nr=_(()=>{Tn();$S=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],Ed=na($S)});var Di=_(()=>{qi();X();B();w();ge();Ii();D();dn();ee();mt()});var fE,Xt=_(()=>{X();B();w();tr();dr();L();ie();ee();Di();At();mt();fE=new RegExp('^\\{"t":"([^"]+)"')});function en(e,t){return e.catch(n=>t(Q(n)))}var tn=_(()=>{ee()});function Rd(e,t){return{message:t,budgetExempt:!1,preserveForRestart:e!==void 0?e:!1}}function Hm(e,t){let n=t-e.maxLivePressureAgeMs;return e.activeAckStartedAtMs.some(r=>r<=n)}function Lr(e){return e.replace(BS,"?").slice(0,128)}function KS(e,t,n,r,i,o,a,s,l,u){let d=a!==void 0?a:!1,m=e.now(),p=Lr(t).slice(0,64),f=Lr(r),h=o!==void 0?o-i:d?m-i:0,c=o!==void 0?m-o:0,y={correlationId:p,pushClass:n,pushEvent:f,queueWaitMs:h,ackWaitMs:c,outcome:s,activeWindowOccupancy:l};try{return u!==void 0?u(y):e.onPushTiming(y)}catch{try{console.warn("commander_push.timing_sink_failed correlation_id="+p+" push_event="+f+" branch="+s);return}catch{return}}}function Li(e,t,n,r,i){let o=t.timingEmitted.contents,a=t.timing;if(!(o||a===void 0))return t.timingEmitted.contents=!0,KS(e,a.correlationId,a.pushClass,a.pushEvent,t.enqueuedAtMs,n,!0,r,i,t.onPushTiming)}function Vm(e,t){return ce(e.activeAckStartedAtMs,0,(n,r)=>Math.max(n,t-r))}function zS(e,t,n,r,i){e.pressureShedCount.contents=e.pressureShedCount.contents+1|0;let o=i!==void 0?i.TAG==="ItemStream"?["item",Lr(i.itemKey),H(i.turnId,Lr)]:["turn",void 0,Lr(i._0)]:["none",void 0,void 0],a;return a=t==="AckPressure"?"ack_pressure":"queue_age",{event:"commander_push.pressure_shed",branch:a,shedCount:e.pressureShedCount.contents,ageMs:n,budgetMs:e.maxLivePressureAgeMs,threadKey:Lr(r),streamKind:o[0],itemKey:o[1],turnId:o[2]}}function Qm(e,t,n,r,i,o){let a=o(),s=zS(e,t,n,r,i);try{e.onPressureShed(s)}catch{let u=s.branch,d=s.shedCount,m=s.ageMs,p=s.budgetMs,f=s.threadKey,h=s.streamKind,c=s.itemKey,y=s.turnId,b={event:"commander_push.pressure_shed_fallback",branch:u,shedCount:d,ageMs:m,budgetMs:p,threadKey:f,streamKind:h,itemKey:c,turnId:y};try{e.onPressureShedFallback(b)}catch{}}return a}function Km(e){let t=e.now(),n=t-e.maxLivePressureAgeMs,r=Hm(e,t),i=[];e.live.activeThreads.forEach(o=>{let a=e.live.pendingByThread.get(o);if(a===void 0)return;let s=a.filter(u=>{let d=u.enqueuedAtMs<=n;if(!r&&!d)return!0;let m=r?"AckPressure":"QueueAge",p;return p=m==="AckPressure"?Vm(e,t):t-u.enqueuedAtMs,Qm(e,m,p,u.threadKey,u.streamIdentity,()=>{$t(u.supersede,f=>f()),Li(e,u,void 0,"pressure_shed",e.inFlight.contents)}),!1});s.length!==0?(e.live.pendingByThread.set(o,s),i.push(o)):e.live.pendingByThread.delete(o)}),e.live.activeThreads.splice(0,e.live.activeThreads.length,...i)}function Zm(e){let t=e.activeThreads.shift();if(t===void 0)return{TAG:"Ok",_0:void 0};let n=e.pendingByThread.get(t);if(n===void 0)return{TAG:"Error",_0:"Commander push admission lost an active thread"};let r=n.shift();return r!==void 0?(n.length!==0?e.activeThreads.push(t):e.pendingByThread.delete(t),{TAG:"Ok",_0:r}):(e.pendingByThread.delete(t),{TAG:"Error",_0:"Commander push admission thread queue was empty"})}function WS(e){for(;;){let t=Zm(e.live);if(t.TAG!=="Ok")return{TAG:"Error",_0:t._0};let n=t._0;if(n===void 0)return{TAG:"Ok",_0:void 0};let r=e.now(),i=Hm(e,r),o=n.enqueuedAtMs+e.maxLivePressureAgeMs<=r;if(!i&&!o)return{TAG:"Ok",_0:n};let a=i?"AckPressure":"QueueAge",s;s=a==="AckPressure"?Vm(e,r):r-n.enqueuedAtMs,Qm(e,a,s,n.threadKey,n.streamIdentity,()=>{$t(n.supersede,l=>l()),Li(e,n,void 0,"pressure_shed",e.inFlight.contents)})}}function HS(e){for(;;){let t=e.priority.activeThreads.length!==0,n=e.live.activeThreads.length!==0,r=e.maxInFlight===1?!0:e.liveInFlight.contents<(e.maxInFlight-1|0),i=n&&r,o=e.consecutivePriority.contents<8,a=0;if(t)a=i&&!o?1:2;else if(i)a=1;else return e.consecutivePriority.contents=0,{TAG:"Ok",_0:void 0};switch(a){case 1:e.consecutivePriority.contents=0;let s=WS(e);if(s.TAG!=="Ok")return{TAG:"Error",_0:s._0};let l=s._0;if(l!==void 0)return{TAG:"Ok",_0:l};continue;case 2:return e.consecutivePriority.contents=e.consecutivePriority.contents+1|0,Zm(e.priority)}}}function Ym(e,t,n,r,i,o,a){let s=t!==void 0?t:2e3,l=n!==void 0?n:g=>performance.now(),u=r!==void 0?r:(g,R)=>{let M=setTimeout(R,g);return M.unref(),()=>{clearTimeout(M)}},d=i!==void 0?i:g=>{console.warn("commander_push.pressure_shed",g)},m=o!==void 0?o:g=>{console.warn("commander_push.pressure_shed_fallback",g)},p=a!==void 0?a:g=>{},f=e>0,h=s>0&&isFinite(s)&&Number.isSafeInteger(s);if(!f)return{TAG:"Error",_0:"Commander push admission maxInFlight must be a positive integer"};if(!h)return{TAG:"Error",_0:"Commander push admission maxLivePressureAgeMs must be positive and finite"};let c={maxInFlight:e,priority:{pendingByThread:new Map,activeThreads:[]},live:{pendingByThread:new Map,activeThreads:[]},inFlight:{contents:0},liveInFlight:{contents:0},consecutivePriority:{contents:0},pumpScheduled:{contents:!1},schedulePump:()=>{},armPressureCheck:g=>{},recomputePressureCheck:()=>{},maxLivePressureAgeMs:s,now:l,schedulePressureCheck:u,activeAckStartedAtMs:[],cancelPressureCheck:{contents:void 0},pressureCheckDeadlineMs:{contents:void 0},onPressureShed:d,onPressureShedFallback:m,pressureShedCount:{contents:0},onPushTiming:p},y=g=>{let R=c.pressureCheckDeadlineMs.contents;if(R!==void 0){if(R<=g)return;$t(c.cancelPressureCheck.contents,be=>be()),c.pressureCheckDeadlineMs.contents=g;let W=c.schedulePressureCheck(Math.max(1,g-c.now()),()=>{c.cancelPressureCheck.contents=void 0,c.pressureCheckDeadlineMs.contents=void 0,Km(c),c.schedulePump(),c.recomputePressureCheck()});c.cancelPressureCheck.contents=W;return}$t(c.cancelPressureCheck.contents,W=>W()),c.pressureCheckDeadlineMs.contents=g;let M=c.schedulePressureCheck(Math.max(1,g-c.now()),()=>{c.cancelPressureCheck.contents=void 0,c.pressureCheckDeadlineMs.contents=void 0,Km(c),c.schedulePump(),c.recomputePressureCheck()});c.cancelPressureCheck.contents=M},b=()=>{let g={contents:void 0};c.live.pendingByThread.forEach(M=>{M.forEach(W=>{let be=W.enqueuedAtMs+c.maxLivePressureAgeMs,A=g.contents;g.contents=A!==void 0?Math.min(A,be):be})});let R=g.contents;if(R!==void 0)return y(ce(c.activeAckStartedAtMs,R,(M,W)=>Math.min(M,W+c.maxLivePressureAgeMs)))},T=()=>{for(;;){if(c.pumpScheduled.contents=!1,c.inFlight.contents>=c.maxInFlight)return;let g=HS(c);if(g.TAG==="Ok"){let M=g._0;if(M===void 0)return;let W=c.now();c.inFlight.contents=c.inFlight.contents+1|0;let be=c.inFlight.contents;c.activeAckStartedAtMs.push(W),c.live.activeThreads.length!==0&&y(W+c.maxLivePressureAgeMs),M.replaceableLive&&(c.liveInFlight.contents=c.liveInFlight.contents+1|0),en(M.task(W,be),A=>{M.outcome.contents="failed";let q=St(A),$=q!==void 0?j(vt(N(q)),"unknown admission task error"):"unknown admission task error";return M.fail(Rd(void 0,$)),Promise.resolve()}).finally(()=>{Li(c,M,W,M.outcome.contents,be),c.inFlight.contents=c.inFlight.contents-1|0;let A=c.activeAckStartedAtMs.indexOf(W);A!==-1&&c.activeAckStartedAtMs.splice(A,1),M.replaceableLive&&(c.liveInFlight.contents=c.liveInFlight.contents-1|0),c.schedulePump()});continue}let R=g._0;c.priority.pendingByThread.forEach(M=>{M.forEach(W=>{W.fail(Rd(void 0,R)),Li(c,W,void 0,"failed",c.inFlight.contents)})}),c.live.pendingByThread.forEach(M=>{M.forEach(W=>{W.fail(Rd(void 0,R)),Li(c,W,void 0,"failed",c.inFlight.contents)})}),c.priority.pendingByThread.clear(),c.live.pendingByThread.clear(),c.priority.activeThreads.splice(0,c.priority.activeThreads.length),c.live.activeThreads.splice(0,c.live.activeThreads.length);return}},v=()=>{if(!c.pumpScheduled.contents){c.pumpScheduled.contents=!0,queueMicrotask(T);return}};return c.schedulePump=v,c.armPressureCheck=y,c.recomputePressureCheck=b,{TAG:"Ok",_0:c}}function Xm(e){let t=H(e[Um],r=>r.trim());if(t===void 0)return{TAG:"Ok",_0:16};if(t==="")return{TAG:"Ok",_0:16};let n=Number(t);return Number.isSafeInteger(n)&&n>=2?{TAG:"Ok",_0:n|0}:{TAG:"Error",_0:Um+" must be an integer of at least 2"}}function ep(e){let t=H(e[Bm],r=>r.trim());if(t===void 0)return{TAG:"Ok",_0:2e3};if(t==="")return{TAG:"Ok",_0:2e3};let n=Number(t);return Number.isSafeInteger(n)&&n>0?{TAG:"Ok",_0:n|0}:{TAG:"Error",_0:Bm+" must be a positive integer"}}function zm(e,t,n,r,i,o,a,s){return Object.fromEntries([["branch",e],["shed_count",t],["age_ms",n],["budget_ms",r],["thread_key",i],["stream_kind",o],["item_key",xe(a,null,l=>l)],["turn_id",xe(s,null,l=>l)]])}function ZS(e,t){if(t.TAG==="PressureShed"){let r=t._0;return e(r.event,zm(r.branch,r.shedCount,r.ageMs,r.budgetMs,r.threadKey,r.streamKind,r.itemKey,r.turnId))}let n=t._0;e(n.event,zm(n.branch,n.shedCount,n.ageMs,n.budgetMs,n.threadKey,n.streamKind,n.itemKey,n.turnId))}function Wm(e){let t=VS.contents;if(t!==void 0)return ZS(t,e);QS.push(e)}var Um,Bm,BS,VS,QS,mE,Id=_(()=>{X();Ft();w();ge();tn();D();Um="LINZUMI_COMMANDER_PUSH_MAX_INFLIGHT",Bm="LINZUMI_COMMANDER_PUSH_PRESSURE_BUDGET_MS";BS=new RegExp("[^\\x20-\\x7E]","g");VS={contents:void 0},QS=[];mE=Gt(Xm(process.env),e=>Gt(ep(process.env),t=>Ym(e,t,void 0,void 0,n=>Wm({TAG:"PressureShed",_0:n}),n=>Wm({TAG:"PressureShedFallback",_0:n}),void 0)))});var np=_(()=>{dt();w();L()});var XS,Yn=_(()=>{B();w();L();D();ee();XS=bt(yi(),1)});var rp=_(()=>{w();D()});var _E,ip=_(()=>{rp();w();D();ie();_E=process.pid.toString()+":"+performance.timeOrigin.toString()});var Br=_(()=>{X()});var nv,ap=_(()=>{Qn();Fr();B();w();tr();L();D();nv=bt(yi(),1);Br();Ns()});var iv,sp=_(()=>{Qn();X();Fr();B();w();ge();D();ee();iv=bt(yi(),1);Yn()});var dp=_(()=>{qi();B();ge();ie();ee();Yn()});var ya=_(()=>{X();B();w();ge();dr();L();ie();ee();Yn();Xt();At();ap();sp();mt();Br();dp();Do()});var jd=_(()=>{X();B();w();L();Xt();At();ya();mt();Br()});var iP,Sa=_(()=>{X();B();w();ge();tn();dr();L();D();ie();ee();Yn();Di();Xt();At();_n();Fo();ip();mt();Br();jd();iP=1440*60*1e3});var Dd=_(()=>{});var Av,wv,Cv,oP,pp=_(()=>{Tn();Mr();Nr();Av=Le(e=>({decision:e.f("decision",I),label:e.f("label",I),description:e.f("description",V(I))})),wv=Le(e=>({requestId:e.f("requestId",I),kind:e.f("kind",I),summary:e.f("summary",I),reason:e.f("reason",V(I)),port:e.f("port",V(ht)),pid:e.f("pid",V(ht)),command:e.f("command",V(I)),cwd:e.f("cwd",V(I)),processName:e.f("processName",V(I)),processIconKey:e.f("processIconKey",V(I)),processIconPath:e.f("processIconPath",V(I)),choices:e.f("choices",V(ta(Av))),allowedActorSlug:e.f("allowedActorSlug",V(I)),allowedActorUserId:e.f("allowedActorUserId",V(ht))})),Cv=na(["starting turn","streaming response","running terminal command","interrupt requested","retrying empty turn","model stream stalled - resuming automatically from the last streamed checkpoint","upstream outage detected - recovery paused, resuming automatically","compacting conversation history","awaiting approval"]),oP=Zt([Le(e=>(e.tag("status","queued"),{TAG:"Queued",reason:e.f("reason",V(I))})),Le(e=>(e.tag("status","processed"),{TAG:"Processed",reason:e.f("reason",V(I))})),Le(e=>(e.tag("status","processing"),{TAG:"Processing",reason:e.f("reason",Cv),approval:e.f("approval",V(wv))})),Le(e=>(e.tag("status","ignored"),{TAG:"Ignored",reason:e.f("reason",I)})),Le(e=>(e.tag("status","failed"),{TAG:"Failed",reason:e.f("reason",I),retryable:e.f("retryable",V(im)),fate:e.f("fate",V(Ed))})),Le(e=>(e.tag("status","recovering"),{TAG:"Recovering",reason:e.f("reason",I),fate:e.f("fate",V(Ed))})),Le(e=>(e.tag("status","interrupted"),{TAG:"Interrupted",reason:e.f("reason",I)}))])});var _p=_(()=>{w()});var zr=_(()=>{w();Nr();Xt();_p()});var hp=_(()=>{X();w();D();ci()});var _P,hP,yP,Bi=_(()=>{X();w();L();ie();Td();zr();hp();_P=new RegExp("^https?:\\/\\/","i"),hP=new RegExp("^data:","i"),yP=new RegExp("^file:\\/\\/","i")});var Jd=_(()=>{X();B();w();D();ie();Bi()});var Sp=_(()=>{});var vp=_(()=>{X();w();L()});var Tp=_(()=>{L();yr()});var hR,yR,gR,bR,SR,vR,TR,kR,xR,AR,wR,CR,OR,ER,PR,RR,IR,MR,GR,qR,Ud=_(()=>{X();Fr();w();tr();Ii();Dd();L();D();Nr();ie();yr();Sp();vp();Bi();Tp();zr();Jd();_n();hR=new RegExp("<[^>]*>","g"),yR=new RegExp(`data:[^"' )]+`,"g"),gR=new RegExp("\\s+","g"),bR=new RegExp("(?:<!doctype\\s+html|<html(?:\\s|>))","i"),SR=new RegExp("cloudflare|cf-ray|\\bblocked\\b|access denied|\\bchallenge\\b|attention required","i"),vR=new RegExp("cloudflare|cf-ray","i"),TR=new RegExp("\\bblocked\\b|access denied","i"),kR=new RegExp("attention required","i"),xR=new RegExp("@font-face","i"),AR=new RegExp("unexpected status (401|403)\\b","i"),wR=new RegExp("\\b(401|403)\\s+(?:unauthorized|forbidden)\\b","i"),CR=new RegExp("^(?:model_request_rejected|invalid_request_error|invalid_request|request_rejected|content_policy_violation|content_filter|input_validation_error)$","i"),OR=new RegExp("\\bmodel request was rejected\\b|\\bmodel_request_rejected\\b","i"),ER=new RegExp("^provider_outage$","i"),PR=new RegExp("rejecting requests|experiencing an outage|provider outage","i"),RR=new RegExp("\\bapply_patch\\b[^]*\\bincompatible\\b|\\bin-flight tool future\\b[^]*\\bfail","i"),IR=new RegExp("\\btools::router\\b[^]*\\bfatal\\b|\\bresponse\\.failed\\b","i"),MR=new RegExp("(tool.*fatal|fatal.*tool|response[._]failed|tool_failure)","i"),GR=new RegExp("upstream model stream stalled","i"),qR=new RegExp("\\(HTTP (\\d{3})\\)")});var NR,Bd=_(()=>{Ft();w();D();ee();Bi();zr();Jd();Ud();NR=10*6e4});var JR,Ap=_(()=>{X();w();D();dn();ee();Bd();zr();JR=10*6e4});var wp=_(()=>{});var UR,Cp=_(()=>{Tn();Mr();UR=sm(e=>({joinRef:e.item(0,pd(I)),ref:e.item(1,pd(I)),topic:e.item(2,I),event:e.item(3,I),payload:e.item(4,Ir)}))});var Op=_(()=>{});var tI,Ep,nI,rI,iI,oI,ka=_(()=>{dt();X();Ft();B();w();ge();tn();L();D();ie();wp();ee();ci();Cp();Mo();Op();tI=new RegExp("/$"),Ep="[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]",nI=new RegExp(Ep),rI=new RegExp(Ep,"g"),iI=new RegExp("^npm install -g @linzumi\\/cli(@[0-9A-Za-z^~.-]{1,32})?$"),oI=new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]{1,32})?$")});var Pp=_(()=>{X();w()});var sT,aI,sI,dT,lT,dI,lI,Rp=_(()=>{Tn();w();Mr();sT=Mt(e=>({decision:e.m(I),label:e.m(I),description:e.m(V(I))})),aI=Mt(e=>({decision:e.m(I)})),sI=Mt(e=>({status:e.m(I),response:e.m(Ir)})),dT=Ze("terminal"),lT=Zt([Ze("interrupted"),Ze("processed"),Ze("failed"),Ze("ignored"),Ze("stop_failed")]),dI=Mt(e=>({disposition:e.m(dT),thread_id:e.m(I),seq:e.m(ht),status:e.m(lT),reason:e.m(am(I))})),lI=Mt(e=>({approval_request_id:e.m(I),approval_kind:e.m(I),approval_summary:e.m(I),approval_reason:e.m(V(I)),approval_port:e.m(V(ht)),approval_pid:e.m(V(ht)),approval_command:e.m(V(I)),approval_cwd:e.m(V(I)),approval_process_name:e.m(V(I)),approval_process_icon_key:e.m(V(I)),approval_process_icon_path:e.m(V(I)),approval_choices:e.m(V(ta(sT))),approval_allowed_actor_slug:e.m(V(I)),approval_allowed_actor_user_id:e.m(V(ht))}))});var Ip=_(()=>{Qn();X();Fr();B();w();ge();L();ee();Yn();Di();Xt();At();ya()});var ZI,zd=_(()=>{dt();X();Ft();B();w();ge();tn();Sa();Ii();Dd();L();D();dn();Nr();ie();_i();yr();ee();pp();Bd();Xt();Ap();Id();Bi();ka();At();zr();Ud();_n();Pp();Fo();mt();Br();Do();gr();Rp();fa();Ip();ZI=new RegExp("^item-\\d+$")});var YI,XI,jp=_(()=>{Ft();w();D();ee();YI=10*6e4,XI=30*6e4});var $p=_(()=>{w();ge();tn();L();D();ee()});var oM,Fp=_(()=>{dt();X();B();w();ge();tn();L();dn();ie();Gs();ee();ci();Mo();oM=100*1024*1024});var Np=_(()=>{Qn();dt();X();B();w();tn();Sa();L();ie();_i();ee();Fp();ka();xd();mt();fa()});var pG,Dp=_(()=>{dt();X();B();w();ge();tn();Sa();dr();L();D();dn();ie();ee();Yn();Di();Xt();ka();At();ya();jp();$p();_n();zd();mt();Np();gr();jd();pG=8*1024*1024});var RT,bG,Wd=_(()=>{"use strict";Eo();Cs();fn();Ee();RT=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,bG=new RegExp(RT.source,"g")});var Lp=_(()=>{B();w();L();Nr();ee();Xt();Id();np();zd();Dp();mt();gr();Wd();Cd()});var Jp=_(()=>{Lp()});var Up=_(()=>{At()});var u1,Bp=_(()=>{"use strict";Ee();Te();u1=1024*1024});var A1,Kp=_(()=>{"use strict";Ee();Up();Js();Bp();A1=1440*60*1e3});var zp=_(()=>{"use strict"});var Hd=_(()=>{"use strict";zp();pn()});var jT,M1,$T,G1,xa=_(()=>{"use strict";jT=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],M1=new Set(jT),$T={runner_updating:"transient_local",stillborn_worker:"transient_local",infra_turn_kill:"transient_local",resume_transient:"transient_local",start_stage_transient:"transient_local",resume_torn_tail:"transient_local",resurrection_interrupted:"transient_local",dead_letter_exhausted:"transient_local",dead_letter_withheld:"needs_decision",dead_letter_permanent:"deterministic",resume_cwd_not_allowed:"deterministic",cwd_stillbirth_circuit_open:"deterministic",engine_unavailable:"deterministic",provider_binding_rejected:"deterministic",project_untrusted:"deterministic",attachment_download_failed:"transient_local",claude_input_queue_closed:"transient_local",claude_dispatch_wedged:"transient_local"},G1=Object.keys($T)});var Wp=_(()=>{Ad()});var Vd=_(()=>{"use strict";Te();Wp()});var Hp=_(()=>{"use strict";pn();Te();Ee()});var Qp=_(()=>{"use strict";Hd();pn();Te();xa();Vd();Hp()});var Qd=_(()=>{"use strict";Gr()});var Zp=_(()=>{da()});var Yp=_(()=>{"use strict";Gr();Te();$i();Ee()});var Zd=_(()=>{"use strict";Gr();Te();$i();Ee()});var Xp=_(()=>{"use strict";Te()});var e_=_(()=>{"use strict";Te();xa()});var t_=_(()=>{"use strict"});var n_=_(()=>{w();L();ie()});var r_=_(()=>{n_()});var i_=_(()=>{"use strict";Qd();r_()});var Aa,o_=_(()=>{Aa={default:{maxLadderMs:9e5},wafer:{maxLadderMs:36e5}}});var fj,mj,a_=_(()=>{"use strict";o_();fj={maxRecoveryRungs:4,maxLadderMs:Aa.default.maxLadderMs,maxRateLimitHoldMs:30*6e4},mj={default:Aa.default,wafer:Aa.wafer}});var s_=_(()=>{"use strict"});var yj,d_=_(()=>{"use strict";Ee();yj=10*6e4});var Yd=_(()=>{"use strict";fn()});var Xd=_(()=>{"use strict";Yd();Yd()});var l_=_(()=>{"use strict";Xd()});function WT(e){let t=e.toLowerCase();switch(!0){case t.endsWith(".app"):return e.slice(0,-4);case t.endsWith(".exe"):return e.slice(0,-4);case t.endsWith(".cmd"):case t.endsWith(".bat"):return e.slice(0,-4);default:return e}}function HT(e){return WT(e.trim().replaceAll("\\","/").toLowerCase())}var zT,u_,Mj,c_=_(()=>{"use strict";zT=[{appName:"Bun",iconKey:"bun",names:["bun","bunx"]},{appName:"Node.js",iconKey:"nodejs",names:["node","nodejs","node.exe"]},{appName:"npm",iconKey:"npm",names:["npm","npm-cli.js","npx"]},{appName:"pnpm",iconKey:"pnpm",names:["pnpm","pnpx"]},{appName:"Yarn",iconKey:"yarn",names:["yarn","yarnpkg","yarn.js"]},{appName:"Corepack",iconKey:"corepack",names:["corepack"]},{appName:"Deno",iconKey:"deno",names:["deno"]},{appName:"Vite",iconKey:"vite",names:["vite","vite-node"]},{appName:"Vitest",iconKey:"vitest",names:["vitest"]},{appName:"Next.js",iconKey:"nextjs",names:["next","next-server"]},{appName:"Nuxt",iconKey:"nuxt",names:["nuxt","nuxi"]},{appName:"Astro",iconKey:"astro",names:["astro"]},{appName:"SvelteKit",iconKey:"svelte",names:["svelte-kit","sveltekit"]},{appName:"Remix",iconKey:"remix",names:["remix"]},{appName:"Expo",iconKey:"expo",names:["expo","expo-cli"]},{appName:"React Native",iconKey:"react",names:["react-native"]},{appName:"Metro",iconKey:"metro",names:["metro","metro-inspector-proxy"]},{appName:"Webpack",iconKey:"webpack",names:["webpack","webpack-dev-server","webpack-cli"]},{appName:"Parcel",iconKey:"parcel",names:["parcel"]},{appName:"Rollup",iconKey:"rollup",names:["rollup"]},{appName:"esbuild",iconKey:"esbuild",names:["esbuild"]},{appName:"SWC",iconKey:"swc",names:["swc"]},{appName:"TypeScript",iconKey:"typescript",names:["tsc","tsserver","tsx","ts-node","typescript-language-server"]},{appName:"ESLint",iconKey:"eslint",names:["eslint","eslint_d"]},{appName:"Prettier",iconKey:"prettier",names:["prettier"]},{appName:"Biome",iconKey:"biome",names:["biome"]},{appName:"Storybook",iconKey:"storybook",names:["storybook","start-storybook"]},{appName:"Playwright",iconKey:"playwright",names:["playwright"]},{appName:"Cypress",iconKey:"cypress",names:["cypress"]},{appName:"Jest",iconKey:"jest",names:["jest"]},{appName:"Python",iconKey:"python",names:["python","python2","python3","python3.9","python3.10","python3.11","python3.12","python3.13","pypy","pypy3"]},{appName:"pip",iconKey:"python",names:["pip","pip2","pip3"]},{appName:"pipx",iconKey:"python",names:["pipx"]},{appName:"uv",iconKey:"python",names:["uv","uvx"]},{appName:"Poetry",iconKey:"poetry",names:["poetry"]},{appName:"Pipenv",iconKey:"python",names:["pipenv"]},{appName:"Conda",iconKey:"conda",names:["conda","mamba","micromamba"]},{appName:"Django",iconKey:"django",names:["django-admin","django-admin.py","manage.py"]},{appName:"Flask",iconKey:"flask",names:["flask"]},{appName:"Uvicorn",iconKey:"uvicorn",names:["uvicorn"]},{appName:"Gunicorn",iconKey:"gunicorn",names:["gunicorn"]},{appName:"Hypercorn",iconKey:"python",names:["hypercorn"]},{appName:"Celery",iconKey:"celery",names:["celery"]},{appName:"Jupyter",iconKey:"jupyter",names:["jupyter","jupyter-lab","jupyter-notebook","ipython"]},{appName:"Ruby",iconKey:"ruby",names:["ruby","erb","irb"]},{appName:"Bundler",iconKey:"ruby",names:["bundle","bundler"]},{appName:"Rails",iconKey:"rails",names:["rails","bin/rails"]},{appName:"Rack",iconKey:"ruby",names:["rackup"]},{appName:"Puma",iconKey:"puma",names:["puma"]},{appName:"Sidekiq",iconKey:"sidekiq",names:["sidekiq"]},{appName:"RSpec",iconKey:"ruby",names:["rspec"]},{appName:"Go",iconKey:"go",names:["go","gofmt","gopls","air"]},{appName:"Delve",iconKey:"go",names:["dlv"]},{appName:"Rust",iconKey:"rust",names:["rustc","rustup","cargo","rust-analyzer"]},{appName:"Java",iconKey:"java",names:["java","javac","jar","jshell","jwebserver"]},{appName:"Gradle",iconKey:"gradle",names:["gradle","gradlew"]},{appName:"Maven",iconKey:"maven",names:["mvn","mvnw"]},{appName:"Spring Boot",iconKey:"spring",names:["spring","spring-boot"]},{appName:"Kotlin",iconKey:"kotlin",names:["kotlin","kotlinc","kotlin-language-server"]},{appName:"Scala",iconKey:"scala",names:["scala","scalac","sbt","metals"]},{appName:"Clojure",iconKey:"clojure",names:["clojure","clj","lein","boot"]},{appName:"PHP",iconKey:"php",names:["php","php-fpm","php-cgi","composer"]},{appName:"Laravel",iconKey:"laravel",names:["artisan","laravel"]},{appName:"Symfony",iconKey:"symfony",names:["symfony"]},{appName:"Elixir",iconKey:"elixir",names:["elixir","iex","mix"]},{appName:"Erlang",iconKey:"erlang",names:["erl","beam.smp","beam","epmd","rebar3"]},{appName:"Phoenix",iconKey:"phoenix",names:["phx.server","phoenix"]},{appName:"PostgreSQL",iconKey:"postgresql",names:["postgres","postmaster","pg_ctl","psql","pg_isready"]},{appName:"Redis",iconKey:"redis",names:["redis-server","redis-cli","redis-sentinel"]},{appName:"MySQL",iconKey:"mysql",names:["mysql","mysqld","mysqladmin"]},{appName:"MariaDB",iconKey:"mariadb",names:["mariadb","mariadbd","mariadb-admin"]},{appName:"SQLite",iconKey:"sqlite",names:["sqlite3","sqlite"]},{appName:"MongoDB",iconKey:"mongodb",names:["mongod","mongosh","mongo"]},{appName:"Elasticsearch",iconKey:"elasticsearch",names:["elasticsearch"]},{appName:"OpenSearch",iconKey:"opensearch",names:["opensearch"]},{appName:"Solr",iconKey:"solr",names:["solr"]},{appName:"Kafka",iconKey:"kafka",names:["kafka-server-start","kafka-console-consumer","kafka-console-producer"]},{appName:"ZooKeeper",iconKey:"zookeeper",names:["zookeeper-server-start","zkserver"]},{appName:"RabbitMQ",iconKey:"rabbitmq",names:["rabbitmq-server","rabbitmqctl"]},{appName:"NATS",iconKey:"nats",names:["nats-server","nats"]},{appName:"Docker",iconKey:"docker",names:["docker","dockerd","docker-compose","docker-proxy","com.docker.backend"]},{appName:"Podman",iconKey:"podman",names:["podman","podman-compose"]},{appName:"Kubernetes",iconKey:"kubernetes",names:["kubectl","kube-apiserver","kubelet","minikube","kind"]},{appName:"Helm",iconKey:"helm",names:["helm"]},{appName:"Tilt",iconKey:"tilt",names:["tilt"]},{appName:"nginx",iconKey:"nginx",names:["nginx"]},{appName:"Caddy",iconKey:"caddy",names:["caddy"]},{appName:"Apache HTTP Server",iconKey:"apache",names:["httpd","apache2","apachectl"]},{appName:"HAProxy",iconKey:"haproxy",names:["haproxy"]},{appName:"Traefik",iconKey:"traefik",names:["traefik"]},{appName:"Envoy",iconKey:"envoy",names:["envoy"]},{appName:"Tailscale",iconKey:"tailscale",names:["tailscale","tailscaled"]},{appName:"Cloudflare Tunnel",iconKey:"cloudflare",names:["cloudflared"]},{appName:"ngrok",iconKey:"ngrok",names:["ngrok"]},{appName:"localtunnel",iconKey:"terminal",names:["lt","localtunnel"]},{appName:"SSH",iconKey:"ssh",names:["ssh","sshd","scp","sftp"]},{appName:"Git",iconKey:"git",names:["git","git-lfs","git-upload-pack","git-receive-pack"]},{appName:"GitHub CLI",iconKey:"github",names:["gh"]},{appName:"GitLab CLI",iconKey:"gitlab",names:["glab"]},{appName:"Subversion",iconKey:"subversion",names:["svn"]},{appName:"Mercurial",iconKey:"mercurial",names:["hg"]},{appName:"AWS CLI",iconKey:"aws",names:["aws","aws-vault","sam"]},{appName:"Azure CLI",iconKey:"azure",names:["az"]},{appName:"Google Cloud CLI",iconKey:"google-cloud",names:["gcloud","gsutil","bq"]},{appName:"Terraform",iconKey:"terraform",names:["terraform"]},{appName:"OpenTofu",iconKey:"opentofu",names:["tofu"]},{appName:"Ansible",iconKey:"ansible",names:["ansible","ansible-playbook"]},{appName:"Pulumi",iconKey:"pulumi",names:["pulumi"]},{appName:"Nomad",iconKey:"nomad",names:["nomad"]},{appName:"Vault",iconKey:"vault",names:["vault"]},{appName:"Consul",iconKey:"consul",names:["consul"]},{appName:"Make",iconKey:"make",names:["make","gmake"]},{appName:"CMake",iconKey:"cmake",names:["cmake","ctest","cpack"]},{appName:"Ninja",iconKey:"ninja",names:["ninja"]},{appName:"Bazel",iconKey:"bazel",names:["bazel","bazelisk"]},{appName:"Buck",iconKey:"buck",names:["buck","buck2"]},{appName:"Clang",iconKey:"clang",names:["clang","clang++","clangd"]},{appName:"GCC",iconKey:"gcc",names:["gcc","g++","cc","c++"]},{appName:"LLDB",iconKey:"terminal",names:["lldb"]},{appName:"GDB",iconKey:"terminal",names:["gdb"]},{appName:"Swift",iconKey:"swift",names:["swift","swiftc","sourcekit-lsp"]},{appName:"Xcode",iconKey:"xcode",names:["xcodebuild","xcrun","simctl"]},{appName:"Zig",iconKey:"zig",names:["zig"]},{appName:"Lua",iconKey:"lua",names:["lua","luajit","lua-language-server"]},{appName:"Perl",iconKey:"perl",names:["perl"]},{appName:"R",iconKey:"r",names:["r","rscript","rserver","rsession"]},{appName:"Julia",iconKey:"julia",names:["julia"]},{appName:"Haskell",iconKey:"haskell",names:["ghc","ghci","cabal","stack","haskell-language-server-wrapper"]},{appName:"OCaml",iconKey:"ocaml",names:["ocaml","ocamlc","dune","opam"]},{appName:"F#",iconKey:"fsharp",names:["fsharpi","fsautocomplete"]},{appName:".NET",iconKey:"dotnet",names:["dotnet","csharp-ls","omnisharp"]},{appName:"PowerShell",iconKey:"powershell",names:["pwsh","powershell"]},{appName:"Bash",iconKey:"terminal",names:["bash"]},{appName:"Zsh",iconKey:"terminal",names:["zsh"]},{appName:"fish",iconKey:"terminal",names:["fish"]},{appName:"tmux",iconKey:"terminal",names:["tmux"]},{appName:"GNU Screen",iconKey:"terminal",names:["screen"]},{appName:"direnv",iconKey:"terminal",names:["direnv"]},{appName:"Nix",iconKey:"nix",names:["nix","nix-shell","nix-daemon","nix-build","nix develop"]},{appName:"Homebrew",iconKey:"homebrew",names:["brew"]},{appName:"mise",iconKey:"terminal",names:["mise"]},{appName:"asdf",iconKey:"terminal",names:["asdf"]},{appName:"Volta",iconKey:"volta",names:["volta"]},{appName:"fnm",iconKey:"nodejs",names:["fnm"]},{appName:"nvm",iconKey:"nodejs",names:["nvm"]},{appName:"curl",iconKey:"terminal",names:["curl"]},{appName:"HTTPie",iconKey:"httpie",names:["http","https","httpie"]},{appName:"wget",iconKey:"terminal",names:["wget"]},{appName:"jq",iconKey:"terminal",names:["jq"]},{appName:"ripgrep",iconKey:"terminal",names:["rg","ripgrep"]},{appName:"fd",iconKey:"terminal",names:["fd"]},{appName:"fzf",iconKey:"terminal",names:["fzf"]},{appName:"bat",iconKey:"terminal",names:["bat"]},{appName:"eza",iconKey:"terminal",names:["eza","exa"]},{appName:"htop",iconKey:"terminal",names:["htop","top","btop"]},{appName:"Vim",iconKey:"vim",names:["vim","view","vimdiff"]},{appName:"Neovim",iconKey:"neovim",names:["nvim","nvim-qt"]},{appName:"Emacs",iconKey:"emacs",names:["emacs","emacsclient"]},{appName:"Visual Studio Code",iconKey:"vscode",names:["code","code-insiders","vscode","visual studio code","visual studio code - insiders"]},{appName:"code-server",iconKey:"vscode",names:["code-server"]},{appName:"Cursor",iconKey:"cursor",names:["cursor"]},{appName:"Zed",iconKey:"zed",names:["zed"]},{appName:"Sublime Text",iconKey:"sublime-text",names:["subl","sublime_text","sublime text"]},{appName:"Atom",iconKey:"atom",names:["atom"]},{appName:"IntelliJ IDEA",iconKey:"intellij-idea",names:["idea","idea.sh","intellij idea","idea64.exe"]},{appName:"WebStorm",iconKey:"webstorm",names:["webstorm","webstorm.sh"]},{appName:"PyCharm",iconKey:"pycharm",names:["pycharm","pycharm.sh"]},{appName:"RubyMine",iconKey:"rubymine",names:["rubymine","rubymine.sh"]},{appName:"GoLand",iconKey:"goland",names:["goland","goland.sh"]},{appName:"CLion",iconKey:"clion",names:["clion","clion.sh"]},{appName:"DataGrip",iconKey:"datagrip",names:["datagrip","datagrip.sh"]},{appName:"Rider",iconKey:"rider",names:["rider","rider.sh"]},{appName:"Android Studio",iconKey:"android-studio",names:["studio","studio.sh","android studio"]},{appName:"Xcode",iconKey:"xcode",names:["xcode","xcode.app"]},{appName:"Postman",iconKey:"postman",names:["postman"]},{appName:"Insomnia",iconKey:"insomnia",names:["insomnia"]},{appName:"Hoppscotch",iconKey:"hoppscotch",names:["hoppscotch"]},{appName:"TablePlus",iconKey:"tableplus",names:["tableplus"]},{appName:"DBeaver",iconKey:"dbeaver",names:["dbeaver"]},{appName:"RedisInsight",iconKey:"redis",names:["redisinsight"]},{appName:"Prisma",iconKey:"prisma",names:["prisma"]},{appName:"Drizzle Kit",iconKey:"drizzle",names:["drizzle-kit"]},{appName:"Supabase",iconKey:"supabase",names:["supabase"]},{appName:"Firebase",iconKey:"firebase",names:["firebase"]},{appName:"Vercel",iconKey:"vercel",names:["vercel"]},{appName:"Netlify",iconKey:"netlify",names:["netlify","ntl"]},{appName:"Fly.io",iconKey:"fly",names:["fly","flyctl"]},{appName:"Heroku",iconKey:"heroku",names:["heroku"]},{appName:"Stripe CLI",iconKey:"stripe",names:["stripe"]},{appName:"Twilio CLI",iconKey:"twilio",names:["twilio"]},{appName:"Mailpit",iconKey:"mail",names:["mailpit"]},{appName:"MailHog",iconKey:"mail",names:["mailhog"]},{appName:"OpenSSL",iconKey:"openssl",names:["openssl"]},{appName:"mkcert",iconKey:"certificate",names:["mkcert"]},{appName:"mkdocs",iconKey:"markdown",names:["mkdocs"]},{appName:"Hugo",iconKey:"hugo",names:["hugo"]},{appName:"Jekyll",iconKey:"jekyll",names:["jekyll"]},{appName:"Eleventy",iconKey:"eleventy",names:["eleventy","11ty"]},{appName:"Docusaurus",iconKey:"docusaurus",names:["docusaurus"]},{appName:"Trunk",iconKey:"rust",names:["trunk"]},{appName:"wasm-pack",iconKey:"webassembly",names:["wasm-pack"]},{appName:"wasmtime",iconKey:"webassembly",names:["wasmtime"]},{appName:"Language Server",iconKey:"language-server",names:["lua-language-server","yaml-language-server","vscode-json-language-server","docker-langserver","bash-language-server","marksman","taplo"]}],u_=new Map;for(let e of zT)for(let t of e.names)u_.set(HT(t),{appName:e.appName,iconKey:e.iconKey});Mj=u_.size});var f_=_(()=>{"use strict"});var el=_(()=>{"use strict";tf();Js();Sm();vd();Pm();Mm();Cd();Po();Od();jm();po();Oo();Nm();pn();Dm();Jp();Kp();Qp();Vd();Te();Qd();Zp();$i();Ro();Yp();Zd();Xp();e_();t_();i_();Wd();xa();a_();Ee();s_();ui();d_();Xd();l_();c_();f_()});var m_=_(()=>{});var eD,tD,nD,rD,iD,p_=_(()=>{m_();X();Ft();B();w();L();dn();ee();sa();yd();eD=Gi("LoggedIn"),tD=Gi("NotLoggedIn"),nD=Gi("BinaryMissing"),rD=Gi("ProbeFailed"),iD=new RegExp("[\\x00-\\x1f\\x7f-\\x9f]")});var __=_(()=>{p_()});var h_=_(()=>{sa()});var y_=_(()=>{"use strict"});var gD,bD,g_=_(()=>{"use strict";gD=64*1024,bD=16*1024});var b_=_(()=>{"use strict"});var S_=_(()=>{"use strict";Te()});var v_=_(()=>{"use strict";__();h_();Po();fn();Te();y_();po();g_();Od();Eo();b_();Hd();S_();el()});function k_(e){let t=e[Ca];if(t===void 0)return ik;let n=Number(t);if(t.trim()===""||!Number.isSafeInteger(n)||n<=0||n>T_)throw new Error(`${Ca} must be an integer number of milliseconds between 1 and ${T_}, got ${JSON.stringify(t)}`);return n}function x_(e){let t=e[wa];if(t===void 0)return rk;let n=Number(t);if(t.trim()===""||!Number.isSafeInteger(n)||n<=0)throw new Error(`${wa} must be a positive integer number of milliseconds, got ${JSON.stringify(t)}`);return n}var rk,wa,ik,Ca,T_,UL,BL,KL,A_=_(()=>{"use strict";Wa();so();yu();gu();Ps();Ps();Ro();Lc();Uc();Io();Kc();el();v_();pn();Te();Oo();Te();Zd();os();rs();rk=18e4,wa="LINZUMI_GUEST_MODEL_CALL_LIVENESS_MS",ik=15*6e4,Ca="LINZUMI_GUEST_ACTIVE_LOOP_BUDGET_MS",T_=2147483647;UL=64*1024,BL=360*60*1e3,KL=600*1e3});var J_={};rh(J_,{CloudTurnError:()=>we,DEFAULT_CLOUD_TURN_TIMEOUT_MS:()=>$_,cloudSupervisorConstsForTest:()=>pk,cloudTurnTimeoutMs:()=>F_,injectTurnSecrets:()=>D_,parseCloudTurnExitLineForTest:()=>mk,parsePreflightOutput:()=>N_,provisionAgentHome:()=>ck,runCloudTurn:()=>fk});import{existsSync as w_}from"node:fs";import{readFile as ok}from"node:fs/promises";import{dirname as ak,join as sk}from"node:path";import{fileURLToPath as dk}from"node:url";import{createHash as lk,randomUUID as uk}from"node:crypto";function F_(e=process.env){let t=e.LINZUMI_CLOUD_TURN_TIMEOUT_MS?.trim();if(t===void 0||t==="")return $_;let n=Number(t);if(!Number.isInteger(n)||n<=0)throw new Error("LINZUMI_CLOUD_TURN_TIMEOUT_MS must be a positive integer");return n}function C_(e,t){if(t!==void 0)return w_(t)?t:void 0;let n=sk(ak(dk(import.meta.url)),e);return w_(n)?n:void 0}function N_(e){let t=e.split(`
19
+ - `+(h===""?"":"At "+h+": ")+f;u[y]||(u[y]=1,s=s+y)}}let l={code:"invalid_input",path:n,reason:s,expected:e,received:t,unionErrors:o};return i&&(l.input=r),l}function od(e,t,n,r){return i=>{let o=t!==void 0?t:"",a=r!==void 0?r:!0,s=e!==void 0?e:i.e,l=i.prev,u=l!==void 0?l.s:i.s,d=o===""?i.path:i.path+o;return m=>Tf(s,u,d,m,a,void 0,n)}}function $e(e){let t=e.e.errorMessage,n;if(t!==void 0){let r=t.type;n=r!==void 0?r:t._}else n=void 0;return od(void 0,void 0,n,void 0)(e)}function kf(e,t){let n=t!==void 0?t:e.e;return bi(e,od(n,void 0,void 0,void 0)(e),e.v())}function $b(e,t){let n=e.vc,r=n.length;if(r===1){let a=n[0];return a.c(t)+"||"+bi(e,a.f(e),t)+";"}let i="",o=0;for(;o<r;){let a=n[o],s=a.f,l=a.c(t);for(o=o+1|0;o<r&&n[o].f===s;)l=l+"&&"+n[o].c(t),o=o+1|0;i=i+(l+"||"+bi(e,s(e),t)+";")}return i}function xf(e){return e.t===!0?e.prev.t!==!0?e.cp==="":!1:!0}function Pt(e,t){let n=e,r="";for(;n!==void 0;){let i=n;n=i.prev;let o="";if(i.vc)if(t!==void 0&&xf(i)){let s=n.v(),l=i.vc,u="";for(let d=0,m=l.length;d<m;++d){let p=l[d],f=p.c(s);p.f===$e?u=u?u+"&&"+f:f:i.e.noValidation!==!0&&(o=o+(f+"||"+bi(i,p.f(i),s)+";"))}u&&(t.contents?t.contents=u+"&&"+t.contents:t.contents=u)}else i.e.noValidation!==!0&&(o=$b(i,n.v()));i.hd!==""&&(o=o+("let "+i.hd+";")),i.fz=!0,o=i.cp+o,r=o+r}return r}function ut(e,t,n,r){let i=r!==void 0?r:e.e;return{v:Ho,i:t,s:n,e:i,prev:e,f:0,d:e.d,cp:"",hd:"",t:!0,path:e.path,g:e.g}}function Y(e,t,n,r){let i=t!==void 0?t:e.s,o=r!==void 0?r:e.e,a=e.v!==Ke,s={v:a?Gb:Ke,i:e.i,s:i,e:o,prev:e,f:e.f,d:e.d,cp:"",hd:"",vc:n,t:e.t,path:e.path,g:e.g};if(a){let l=e.v.bind(e);e.v=()=>{let u=l();return s.i=u,s.v=Ke,u}}return s}function ad(e,t){let n=e.vc;n!==void 0?n.push(t):e.vc=[t]}function Si(e,t){let n=t.e.inputRefiner,r;if(n!==void 0){let s=n(t);if(s.length!==0)if(t.prev!==void 0){for(let u=0,d=s.length;u<d;++u)ad(t,s[u]);r=void 0}else r=s;else r=void 0}else r=void 0;let i=e.e.refiner,o;if(i!==void 0){let s=i(e);o=s.length!==0?s:void 0}else o=void 0;let a=r!==void 0?o!==void 0?Y(e,void 0,r.concat(o),void 0):Y(e,void 0,r,void 0):o!==void 0?Y(e,void 0,o,void 0):e;return a.io=!0,a}function Af(e,t,n){if(!t.vc)return;let i="["+Kn(e.g,n)+"]";t.vc.forEach(o=>ad(e,{c:a=>o.c(a+i),f:o.f})),t.vc=void 0}function wf(e,t){let n=e.s.additionalItems,r;r=n!==void 0&&n!=="strip"&&n!=="strict"?n:_e;let i=e.e.additionalItems,o;return o=i!==void 0&&i!=="strip"&&i!=="strict"?i:_e,{p:e,v:qb,i:e.v()+"["+t+"]",s:r,e:o,f:e.f,cp:"",hd:"",path:"",g:e.g}}function hn(e,t,n){return ut(e,Ai(e,t),t,n)}function Cf(e,t){let n=ut(e,t,e.s,void 0);return n.f=1,n}function Rt(e,t,n){e.s.type===Ht?e.s.items.push(n.s):(n.o||e.s.required.push(t),e.s.properties[t]=n.s),n.f&1&&n.v(),e.cp=e.cp+Pt(n,void 0),e.d[t]=n}function Of(e,t,n){return e.v()+"["+t+"]="+n.i}function Vt(e){let t=e.v!==Ke,n={b:e,v:t?Mb:Ke,i:e.i,s:e.s,io:e.io,e:e.e,f:0,d:e.d,cp:"",hd:"",u:!1,t:!1,path:e.path,g:e.g};if(t){let r=e.v.bind(e);e.v=()=>{let i=r();return n.i=i,n.v=Ke,i}}return n}function Fb(e,t){throw new Bn({code:"invalid_operation",path:e.path,reason:t})}function sd(e,t,n,r){if(e.path===""&&n===void 0)return Pt(e,void 0);{let i=l=>{let u=t.path,d=u===""?"":Er(u)+"+";return l+".path="+d+(n!==void 0?`'["'+`+n+`+'"]'+`:"")+l+".path"},o=Pt(e,void 0);if(o===""&&!(e.f&1))return o+(r!==void 0?r():"");let a=Qe(e.g),s=i(a)+";throw "+a;return e.f&1&&(e.i=e.i+".catch("+a+"=>{"+s+"})"),"try{"+o+(r!==void 0?r():"")+"}catch("+a+"){"+s+"}"}}function Ef(e){return e}function Bs(e){return e+"<=2147483647&&"+e+">=-2147483648&&"+e+"%1===0"}function Ar(e){return t=>"typeof "+t+'==="'+e+'"'}function vr(e){return"Number.isNaN("+e+")"}function Vo(e){return"Array.isArray("+e+")"}function Pf(e){return Ar(Re)(e)+"&&"+e}function Nb(e,t){return n=>n+" instanceof "+Et(e,t)}function Db(e){let t=fe[e.s.type];if(t&1){let i=[{c:Ar(yn),f:$e}],o=e.e.format,a=0;return o==="int32"?i.push({c:Bs,f:$e}):a=1,a===1&&(e.g.o&2||i.push({c:s=>"!"+vr(s),f:$e})),Y(e,e.e,i,void 0)}if(!(t&2))return t&4?e.s.format!==e.e.format&&e.e.format==="int32"?Y(e,e.e,[{c:Bs,f:$e}],void 0):e:Wn(e,e.s,e.e);let n=Qe(e.g),r=ut(e,n,e.e,void 0);return r.v=Ke,r.cp="let "+n+"=+"+e.v()+";",r.vc=[{c:i=>{let o=e.e.format;return o!==void 0&&o==="int32"?Bs(n):"!"+vr(n)},f:$e}],r}function dd(){return Sn(yn,yn,e=>{e.decoder=Db})}function Lb(e){return ut(e,'""+'+e.i,Pr(),void 0)}function Jb(e){let t=fe[e.s.type];if(t&1)return Y(e,e.e,[{c:Ar(Tr),f:$e}],void 0);if(!(t&3132&&It in e.s))return t&1036?Lb(e):t&2?e:Wn(e,e.s,e.e);let n=""+e.s.const,r=Pe(Tr,!1);return r.const=n,ut(e,'"'+n+'"',r,void 0)}function Pr(){return Sn(Tr,Tr,e=>{e.decoder=Jb})}function Ub(e){let t=fe[e.s.type];if(t&1)return Y(e,e.e,[{c:Ar(Ko),f:$e}],void 0);if(!(t&2))return t&8?e:Wn(e,e.s,e.e);let n=Qe(e.g),r=ut(e,n,e.e,void 0);r.v=Ke;let i=e.v();return r.cp="let "+n+";("+r.i+"="+i+'==="true")||'+i+'==="false"||'+kf(e,void 0)+";",r}function ld(){return Sn(Ko,Ko,e=>{e.decoder=Ub})}function Rf(e,t){e[fe[t]&768?ki:t]=!0}function wr(e){let t=e.e;if(t.noValidation&&!e.u)return hn(e,t,void 0);if(It in e.s)return e.s.const===t.const?e:hn(e,t,void 0);let n=fe[t.type];if(!(fe[e.s.type]&2&&n&3132))return n&2048?Y(e,t,[{c:vr,f:$e}],void 0):Y(e,t,[{c:o=>o+"==="+Ai(e,t),f:$e}],void 0);let r=Pe(Tr,!1);r.const=""+t.const;let i=hn(e,r,r);return i.vc=[{c:o=>o+'==="'+r.const+'"',f:$e}],hn(i,t,t)}function vn(){return Sn(lt,lt,e=>{e.const=void 0,e.decoder=wr})}function wi(){return Sn(kr,kr,e=>{e.const=null,e.decoder=wr})}function If(){return Sn(zs,zs,e=>{e.const=NaN,e.decoder=wr})}function ud(e){if(e===null)return wi();let t=typeof e;if(t===lt)return vn();if(t===yn&&Number.isNaN(e))return If();if(t===Re){let r=Pe(nd,!0);return r.class=e.constructor,r.const=e,r.decoder=wr,r}let n=Pe(t,!0);return n.const=e,n.decoder=wr,n}function ye(e){let t=e,n,r=0;for(;!t.io||t.e.to;){let i=n;n=void 0;let o=t;if(r=r+1|0,r>50)throw new Error("Loop count exceeded 100");if(o.e.$defs&&(o.g.d?Object.assign(o.g.d,o.e.$defs):o.g.d=o.e.$defs),o.f&1){let a=o.v(),s=Vt(o),l=ye(s),u=Pt(l,void 0);t=s.i!==l.i||u!==""?ut(o,a+".then("+a+"=>{"+u+"return "+l.i+"})",l.s,l.e):Y(o,l.s,void 0,l.e),t.f=t.f|1,t.io=!0}else if(o.io){let a=o.e.to,l=o.e.parser;t=l!==void 0?l(o):Y(t,void 0,void 0,a)}else{let a=o.s.encoder;a&&a!==i&&o.s!==o.e&&o.e.type!==ki&&(t=a(o,o.e)),o!==t?n=a:(t=o.e.decoder(o),t.io||(t=Si(t,t)))}}return t}function bn(e){for(;;){let t=e,n=t.to;if(n===void 0)return t;e=n}}function Wt(e){if(Un in e)return e[Un];let t,n=e;for(;n;){let i=_t(n),o=i.to,a=t;a!==void 0?i.to=a:delete i.to;let s=i.parser,l=i.serializer;l!==void 0?i.parser=l:delete i.parser,s!==void 0?i.serializer=s:delete i.serializer;let u=i.refiner,d=i.inputRefiner;d!==void 0?i.refiner=d:delete i.refiner,u!==void 0?i.inputRefiner=u:delete i.inputRefiner;let m=i.fromDefault,p=i.default;p!==void 0?i.fromDefault=p:delete i.fromDefault,m!==void 0?i.default=m:delete i.default;let f=i.items;f!==void 0&&(i.items=f.map(Wt));let h=i.properties;if(h!==void 0){let b={},T=Object.keys(h);for(let v=0,g=T.length;v<g;++v){let R=T[v];b[R]=Wt(h[R])}i.properties=b}typeof i.additionalItems===Re&&(i.additionalItems=Wt(i.additionalItems));let c=i.anyOf;if(c!==void 0){let b={},T=[];for(let v=0,g=c.length;v<g;++v){let R=c[v],M=Wt(R);T.push(M),Rf(b,M.type)}i.has=b,i.anyOf=T}let y=i.$defs;if(y!==void 0){let b={};for(let T=0,v=Object.keys(y).length;T<v;++T){let g=Object.keys(y)[T];b[g]=Wt(y[g])}i.$defs=b}t=i,n=o}let r=t;return Ot[xr]=r,nt(e,Un,Ot),Ot[xr]=e,nt(r,Un,Ot),r}function Mf(e){try{return ye(e)}catch(t){let n=Yo(t),r=e.p;throw n.path=(r!==void 0?r.path:"")+(e.path+"[]"+n.path),n}}function Gf(e,t,n,r){let i=jb(It in e?_e:e,t,n,r),o=ye(i),a=Pt(o,void 0),s=Ib(o.f,1);t.isAsync=s;let l=o.t===!0;if(t.hasTransform=l,a===""&&(o===i||o.i===i.i)&&!(n&1))return Ef;let u=o.i;n&1&&!s&&!r&&(u="Promise.resolve("+u+")");let d="i=>{"+a+"return "+u+"}",m=i.g.e,p=new Function("e","s","return "+d)(m,ed);return p.embedded=i.g.e,p}function Qs(e,t){let n=arguments,r=0,i,o="",a=0,s;for(;i===void 0;){let u=n[r];if(u)if(typeof u===yn){let d=u|gi.f;i=d,o=o+"-"+d}else{let d=u.seq;d>a&&(a=d,s=u),o=o+d+"-",r=r+1|0}else{let d=gi.f;i=d,o=o+"-"+d}}let l=s;if(l!==void 0){let u=o;if(u in l)return l[u];let d=n[r-1|0];for(let p=r-2|0;p>=0;--p){let f=d;d=gn(n[p],h=>{h.to=f})}let m=Gf(d,d,i,0);return Ot[xr]=m,nt(l,u,Ot),m}throw new Error("[Sury] No schema provided for decoder.")}function Bb(e){let t=Y(e,void 0,void 0,cd());return t.cp=kf(e,void 0)+";",t}function cd(){return Sn(Ws,Ws,e=>{e.decoder=Bb})}function Kb(e){let t=e.e.to;return ut(e,"{"+zn+":"+bn(e.e).properties[zn].const+"}",t,t)}function Cr(e,t){return{v:Ho,i:"",s:t.type===Ht?{type:Ht,decoder:Ci,additionalItems:"strict",items:[]}:{type:Re,decoder:Rr,additionalItems:"strict",required:[],properties:{}},e:e.e,prev:e,f:0,d:{},cp:"",hd:"",t:!0,path:e.path,g:e.g}}function fd(e){return Xo(e,vn())}function Rr(e){let t=e.u,n=e.e,r=fe[e.s.type],i;if(r&65){let d=r&64,m;if(d)m=e.s;else{let f=Pe(Re,!1);f.properties=Ys,f.additionalItems=_e,m=f}let p=[];d||(p.push({c:Pf,f:$e}),n.additionalItems!=="strip"&&p.push({c:f=>"!"+Vo(f),f:$e})),i=p.length!==0?Y(e,m,p,void 0):Y(e,m,void 0,void 0)}else i=Wn(e,e.s,n);let o=n.additionalItems,a;a=o==="strip"||o==="strict"?void 0:o;let s=i.s.additionalItems,l;l=s!=="strip"&&s!=="strict";let u;if(a!==void 0)if(a===_e)u=i;else if(l){let d=i.v(),m=Qe(i.g),p=wf(i,m),f=Mf(p),h=f.t,c=h?ut(i,"{}",n,void 0):Y(i,n,void 0,void 0),y=sd(f,i,m,h?()=>Of(c,m,f):void 0);if((h||y!=="")&&(c.cp=c.cp+("for(let "+m+" in "+d+"){"+y+"}")),f.f&1){let b=Qe(c.g),T=Qe(c.g),v=Qe(c.g),g=Qe(c.g),R=c.v();u=Cf(c,"new Promise(("+b+","+T+")=>{let "+g+"=Object.keys("+R+").length;for(let "+m+" in "+R+"){"+R+"["+m+"].then("+v+"=>{"+R+"["+m+"]="+v+";if("+g+"--===1){"+b+"("+R+")}},"+T+")}})")}else u=c}else{let d=Cr(i,n),m=Object.keys(i.s.properties);for(let p=0,f=m.length;p<f;++p){let h=m[p],c=vi(i,h);c.e=a,c.io=!1,c.u=t,Rt(d,h,ye(c))}u=Or(d)}else{let d=n.properties,m=Object.keys(d),p=m.length,f=Cr(i,n),h=n.additionalItems,c;c=h==="strip"||h==="strict"?h==="strip"?l||Object.keys(i.s.properties).length!==p:!1:!0;let y=i.s.additionalItems,b;b=y==="strip"||y==="strict"?!1:y.name===Jn;for(let v=0;v<p;++v){let g=m[v],R=d[g],M=vi(i,g);M.e=R,M.io=!1,M.u=t,b&&R.type===pt&&R.has[lt]&&(M.i="("+M.i+"??null)");let W=ye(M);t&&It in R&&Af(i,W,g),Rt(f,g,W),c||(c=W.t)}let T=!1;if(n.additionalItems==="strict"){let v=i.s.additionalItems,g;g=v!=="strip"&&v!=="strict",T=g}if(T){let v=Qe(f.g);if(Wo(i,v),f.cp=f.cp+("for("+v+" in "+i.v()+"){if("),m.length!==0)for(let g=0,R=m.length;g<R;++g){let M=m[g];g!==0&&(f.cp=f.cp+"&&"),f.cp=f.cp+(v+"!=="+Kn(i.g,M))}else f.cp=f.cp+"true";f.cp=f.cp+("){"+bi(i,g=>({code:"unrecognized_keys",path:f.path,reason:'Unrecognized key "'+g+'"',keys:[g]}),v)+"}}")}if(c)u=Or(f);else{let v=Y(i,void 0,void 0,void 0);v.cp=f.cp,v.d=f.d,u=v}}return Si(u,i)}function zb(){let e=ud(0),t={};return t[zn]=e,{type:Re,serializer:n=>{let r=n.e.to;return hn(n,r,r)},decoder:Rr,additionalItems:"strip",required:[zn],properties:t}}function Ci(e){let t=e.u,n=e.e,r=fe[e.s.type],i=n.items,o=i.length,a;if(r&129){let d=r&128,m=d?e.s:Oi(_e),p=[];d||p.push({c:Vo,f:$e});let f=m.additionalItems,h;if(h=f==="strip"||f==="strict"?m.items.length===o:!1,!h){let c=n.additionalItems;(c==="strip"||c==="strict")&&(c==="strip"?p.push({c:y=>y+".length>="+o,f:$e}):p.push({c:y=>y+".length==="+o,f:$e}))}a=p.length!==0?Y(e,m,p,void 0):Y(e,m,void 0,void 0)}else a=Wn(e,e.s,n);let s=n.additionalItems,l,u=0;if(s==="strip"||s==="strict")u=1;else if(s===_e)l=a;else{let d=a.v(),m=Qe(a.g),p=wf(a,m),f=Mf(p),h=f.t,c=h?ut(a,"new Array("+d+".length)",n,void 0):Y(a,n,void 0,void 0),y=sd(f,a,m,h?()=>Of(c,m,f):void 0);(h||y!=="")&&(c.cp=c.cp+("for(let "+m+"="+o+";"+m+"<"+d+".length;++"+m+"){"+y+"}")),l=f.f&1?Cf(c,"Promise.all("+c.i+")"):c}if(u===1){let d=Cr(a,n),m=n.additionalItems,p;if(m==="strip"||m==="strict")if(m==="strip"){let f=a.s.additionalItems;p=f==="strip"||f==="strict"?a.s.items.length!==o:!0}else p=!1;else p=!0;for(let f=0;f<o;++f){let h=i[f],c=f.toString(),y=vi(a,c);y.e=h,y.io=!1,y.u=t;let b=ye(y);t&&It in h&&Af(a,b,c),Rt(d,c,b),p||(p=b.t)}if(p)l=Or(d);else{let f=Y(a,void 0,void 0,void 0);f.cp=d.cp,f.d=d.d,l=f}}return Si(l,a)}function Wb(e,t){let n=e.s.anyOf;return t.type===pt&&Ff(t)===void 0&&jf(t.anyOf,n)||!Hb(n,t)?e:$f(e,t)}function qf(e){let t=e.e,n=t.anyOf,r=fe[e.s.type],i=Ff(t);if(e.s===t&&i===void 0&&n.every(Uo)||r&256&&jf(n,e.s.anyOf)&&i===void 0||e.io&&e.e===e.s)return e;(r&256||e.s.encoder===void 0&&r&512)&&(e.s=_e);let o="";if(!(r&769)){let k=Ks(e.s),S=!1,E=!1,P=n.length,x=0;for(;o===""&&x<P;){let C=n[x];Ks(C)===k?o=k:C.type===kr?S=!0:C.type===lt&&(E=!0),x=x+1|0}o===""&&(r&16&&S?o=kr:r&32&&E&&(o=lt))}let a=o,s=e.i,l=k=>Et(e,function(){let S=arguments,E=Tf(t,_e,e.path,S[0],!0,S.length>1?Array.from(S).slice(1):void 0,void 0);throw new Bn(E)})+"("+e.v()+k+")",u=Y(e,void 0,void 0,void 0),d=[],m={contents:""},p=(k,S)=>{let E=k[0],P=k[1],x="",C="",K=!1,Ce={contents:""},Fe="",rt={},ze=2,de=k.length-1|0;for(;ze<=de;){let Oe=Vt(P);Oe.u=!0,Oe.t=P.t,Oe.io=!1,Oe.e=k[ze];let Ie=ze===de,Ye=ze===2,wn=Ye&&Ie,Xn=!wn,yt=!1,jt="",nn={contents:""};try{let ue=ye(Oe);if(d.push(ue.s),jt=Pt(ue,nn),ue.t){u.t=!0,ue.f&1&&(u.f=u.f|1);let gt=E.v();ue.i!==gt&&(jt=jt+(gt+"="+ue.i))}}catch(ue){let gt=Et(Oe,Yo(ue));Fe=Fe+","+gt,S&&wn?(m.contents=gt,yt=!0):Ie?(Xn=!1,jt=S?"throw "+gt:l(Fe)):yt=!0}let rn=nn.contents,Cn=jt;if(!yt&&rn)if(Cn){let ue=rt[rn];ue!==void 0?typeof ue=="string"?rt[rn]=[ue,Cn]:ue.push(Cn):rt[rn]=Cn}else Ce.contents=Ce.contents?Ce.contents+"||"+rn:rn;if(!yt&&(!rn||Ie)){let ue=Object.keys(rt);for(let gt=0,V_=ue.length;gt<V_;++gt){let sl=ue[gt];x=x+(K?"else if":"if")+("("+sl+"){");let Hr=rt[sl];if(typeof Hr=="string")x=x+Hr+"}";else{let Ea="";for(let zi=0,Q_=Hr.length;zi<Q_;++zi){let Z_=Hr[zi],dl="e"+zi;x=x+("try{"+Z_+"}catch("+dl+"){"),Ea=Ea+","+dl}x=x+l(Ea)+"}".repeat(Hr.length)+"}"}K=!0}rt={}}if(!yt&&!rn)if(Cn)if(Ce.contents&&(x=x+(K?"else if":"if")+("(!("+Ce.contents+")){"),C="}"+C,Ce.contents="",K=!1),Ie&&(S||!Xn||Ye))x=x+((K?"else{":"")+Cn),C=(K?"}":"")+C;else{let ue="e"+(ze-2|0);x=x+((K?"else{":"")+"try{"+Cn+"}catch("+ue+"){"),C=(K?"}":"")+"}"+C,Fe=Fe+","+ue,K=!1}else Ce.contents="",ze=de,Xn=!1;if(Ie){if(Ce.contents)x||Fe?x=x+(K?"else if":"if")+("(!("+Ce.contents+")){"+l(Fe)+"}"):ad(P,{c:ue=>"("+Ce.contents+")",f:$e});else if(Xn){let ue=l(Fe);x=x+(K?"else{"+ue+"}":ue)}}ze=ze+1}return x+C},f="",h="",c="",y=!1,b=n.length-1|0,T={},v=[],g=t.refiner,R=t.inputRefiner,M={contents:void 0},W={contents:void 0},be=(k,S,E)=>{if(S===void 0)return k;let P=x=>{let C=E.contents;if(C!==void 0)return C;let K=S(x);return E.contents=K,K};return k!==void 0?x=>{let C=k(x),K=P(x);for(let Ce=0,Fe=K.length;Ce<Fe;++Ce)C.push(K[Ce]);return C}:P},A=k=>{let S=be(k.refiner,g,M);S!==void 0&&(k.refiner=S);let E=be(k.inputRefiner,R,W);if(E!==void 0){k.inputRefiner=E;return}},q;if(It in e.s){let k=[],S=[];for(let E=0;E<=b;++E){let P=n[E];It in P&&P.const===e.s.const?k.push(P):S.push(P)}q=k.concat(S)}else q=n;for(let k=0;k<=b;++k){let S=i!==void 0?gn(q[k],C=>{A(C),C.to=i}):q[k],E=S.type,P=fe[E],x=Ks(S);if((a===""||a===x)&&!(P&16&&"fromDefault"in t)){let C=T[x];if(C!==void 0)P&64&&zn in S.properties?C.splice(C.length-1|0,0,S):P&2096||C.push(S);else{let K=Vt(e),Ce;if(P&37633)Ce=_e;else{let de=Pe(S.type,!1);de.encoder=S.encoder,P&8192?de.class=S.class:P&64?(de.properties=Ys,de.additionalItems=_e):P&128?(de.additionalItems=_e,de.items=Zo):P&2096&&(de.const=S.const),de.decoder=Oe=>fe[Oe.s.type]&1?Y(Oe,Oe.e,[{c:Ie=>{let Ye=fe[S.type];if(Ye&64)return Pf(Ie)+"&&!"+Vo(Ie);if(Ye&128)return Vo(Ie);if(Ye&8192)return Nb(Oe,S.class)(Ie);if(!(Ye&4))return Ye&2048?vr(Ie):Ye&48?Ie+"==="+Ai(Oe,S):Ye&17418?Ar(S.type)(Ie):"";let wn=Ar(yn)(Ie);return Oe.g.o&2?wn:wn+"&&!"+vr(Ie)},f:$e}],void 0):S.decoder(Oe),Ce=de}K.e=Ce;let Fe;try{Fe=ye(K)}catch{K.vc=void 0,Fe=K}mf(P,T)?v.unshift(x):v.push(x),T[x]=[K,Fe,S];let rt=!0,ze=Fe;for(;ze!==void 0&&rt;){let de=ze;ze=de.prev,rt=!(de.vc&&xf(de))}if(rt){for(let de=0,Oe=v.length;de<Oe;++de){let Ie=v[de];if(!y){let Ye=T[Ie],wn=Ye[1],Xn=p(Ye,!0),yt=Pt(wn,void 0)+Xn,jt=m.contents;if(jt)if(m.contents="",yt){let nn="e"+(k+de|0);f=f+("try{"+yt+"throw "+jt+"}catch("+nn+"){"),h="}"+h,c=c+","+nn}else c=c+","+jt;else if(yt){let nn="e"+(k+de|0);f=f+("try{"+yt+"}catch("+nn+"){"),h="}"+h,c=c+","+nn}else y=!0}}T={},v=[]}}}}let $=T,Se=v;if(!y){let k=!1,S="";for(let x=0,C=Se.length;x<C;++x){let K=$[Se[x]],Ce=K[1],Fe=K[2],rt=p(K,!1),ze={contents:""},de=Pt(Ce,ze)+rt,Oe=ze.contents;de||mf(fe[Fe.type],$)?(f=f+(k?"else if":"if")+("("+Oe+"){"+de+"}"),k=!0):S=S?S+"||"+Oe:Oe}let E=l(c),P;S?P=(k?"else if":"if")+("(!("+S+")){"+E+"}"):P=k?"else{"+E+"}":h===""?E+";":E,f=f+P}u.cp=u.cp+f+h,e.i!==u.i&&(u.i=e.i);let G=u.f&1?(u.i="Promise.resolve("+u.i+")",u.v=Ho,u):u.v===Ke&&e.cp===""&&u.cp===""&&s==="i"?(e.hd="",e.v=Ho,e.i=s,e):u;return G.s=d.length?Qt(d):cd(),G.e=i!==void 0?(G.io=!0,bn(i)):t,G}function jf(e,t){return t.every((n,r)=>{let i=e[r];return i!==void 0&&!(fe[n.type]&9152)&&n.type===i.type&&n.const===i.const?n.to===void 0:!1})}function $f(e,t){return Y(e,_e,void 0,gn(e.s,n=>{n.to=t}))}function Hb(e,t){return!(fe[bn(t).type]&512)&&!(t.type===pt&&t.anyOf.some(n=>fe[n.type]&512))?!e.some(n=>n.to!==void 0||n.parser!==void 0?!0:fe[n.type]&512):!1}function Ff(e){if(e.parser!==void 0)return;let n=e.to;if(n!==void 0)return n}function vi(e,t){let n=e.d,r;if(n!==void 0)r=n;else{let d={};e.d=d,r=d}let i=r[t];if(i!==void 0)return Vt(i);let o=e.s.type===Re?e.s.properties[t]:e.s.items[t],a;if(o!==void 0)a=o;else{let d=e.s.additionalItems;a=d==="strip"||d==="strict"?Wn(e,e.s,e.e):e.s.type===Re&&d.type!==ki&&!(fe[d.type]&512)&&!Rb(d)?fd(d):d}let l="["+Kn(e.g,t)+"]",u={p:e,v:Vs,i:It in a?Ai(e,a):e.v()+l,s:a,e:a,f:0,cp:"",hd:"",path:e.path+l,g:e.g};return r[t]=u,u}function Or(e){let t=e.s.type===Ht,n="",r="",i,o=Object.keys(e.d);for(let u=0,d=o.length;u<d;++u){let m=o[u],p=e.d[m];if(p.f&1&&(r=r+p.i+","),p.o){let f=i;i=h=>(f!==void 0?f(h):"")+("if("+p.v()+"!==void 0){"+h+"["+Kn(e.g,m)+"]="+p.i+"}")}else n=n+(t?p.i:Kn(e.g,m)+":"+p.i)+","}if(e.i=t?"["+n+"]":"{"+n+"}",r){let u=Vt(e);u.io=!0;let d=ye(u),m=Pt(d,void 0);return m===""&&r===d.i+","?e.i=d.i:e.i="Promise.all(["+r+"]).then((["+r+"])=>{"+m+"return "+d.i+"})",e.f=e.f|1,e.s=d.s,e.e=d.e,e.io=!0,e}let a=i;if(a===void 0)return e;let s=a(e.v()),l=Y(e,void 0,void 0,void 0);return l.cp=l.cp+s,l}function Qt(e){let t=e.length;if(t===1)return e[0];if(t!==0){let n={},r=new Set;for(let o=0,a=e.length;o<a;++o){let s=e[o];s.type===pt&&s.to===void 0?(s.anyOf.forEach(l=>{r.add(l)}),Object.assign(n,s.has)):(r.add(s),Rf(n,s.type))}let i=Pe(pt,!1);return i.anyOf=Array.from(r),i.decoder=qf,i.encoder=Wb,i.has=n,i}throw new Error("[Sury] S.union requires at least one item")}function mf(e,t){return e&8320&&Re in t?!0:e&2048?yn in t:!1}function Ks(e){return fe[e.type]&8192?e.class.name:e.type}function Uo(e){for(;;){let t=e,n=!1,r=!1,i=!1;if(t.to===void 0&&t.parser===void 0&&!(fe[t.type]&512)){let a=t.anyOf;i=a!==void 0?a.every(Uo):!0}if(i){let a=t.items;r=a!==void 0?a.every(Uo):!0}if(r){let a=t.properties;n=a!==void 0?Object.values(a).every(Uo):!0}if(!n)return!1;let o=t.additionalItems;if(o===void 0||o==="strip"||o==="strict")return!0;e=o}}function Oi(e){let t=Pe(Ht,e[Un]===e);return t.additionalItems=e,t.items=Zo,t.decoder=Ci,t}function Xo(e,t){let n=t!==void 0?t:vn(),r=bn(e);switch(r.type){case"undefined":return Qt([n,pf(e)]);case"union":let o=r.has,a=r.anyOf;return gn(e,s=>{let l=Ab(o),u=[];for(let d=0,m=a.length;d<m;++d){let p=a[d],f=bn(p),h=f.type,c;if(h==="undefined")l[n.type]=!0,u.push(n),c=pf(p);else{let y=f.properties;if(y!==void 0){let b=y[zn];c=b!==void 0?gn(p,T=>{let v={},g={...b};g.const=b.const+1,v[zn]=g,T.properties=v}):p}else c=p}u.push(c)}u.length===a.length&&(l[n.type]=!0,u.push(n)),s.anyOf=u,s.has=l});default:return Qt([e,n])}}function pf(e){return gn(e,t=>{t.to=zb(),t.parser=Kb})}function ea(e){let t=Pe(Re,e[Un]===e);return t.properties=Ys,t.additionalItems=e,t.decoder=Rr,t}function _f(e){let t=e.e,n=t.$ref,r=e.g.d,i=n.slice(8),o=r[i],a=e.g.o,s=e.s.seq===t.seq?o:e.s,l=s.seq+"-"+o.seq+"--"+a,u="",d=o[l];if(d!==void 0){let c=N(d);u=c===0?Et(e,o)+('["'+l+'"]'):Et(e,c)}else{let c=j(o.hasTransform,!1),y=j(o.isAsync,!1),b=!0,T=0;for(;b;){b=!1,o.hasTransform===void 0&&(o.hasTransform=c),o.isAsync===void 0&&(o.isAsync=y),ff[xr]=0,nt(o,l,ff);let v=Gf(s,o,a,r);Ot[xr]=v,nt(o,l,Ot),T=v;let g=o.hasTransform,R=o.isAsync;(g!==c||R!==y)&&(c=g,y=R,delete o[l],b=!0)}u=Et(e,T)}let m=o.hasTransform===!0,p=o.isAsync,f="",h;if(m||p){let c=Qe(e.g);f="let "+c+";";let y=ut(e,c,t,t);y.v=Ke,y.cp=c+"="+u+"("+e.i+");",p&&(y.f=y.f|1),h=y}else{let c=Y(e,t,void 0,t);c.cp=u+"("+e.i+");",h=c}return h.prev=void 0,h.cp=f+sd(h,e,void 0,void 0),h.fz=void 0,h.prev=e,h}function Qb(e,t){return gn(e,n=>{let r=t(n),i=n.refiner;i!==void 0?n.refiner=o=>{let a=i(o),s=r(o);for(let l=0,u=s.length;l<u;++l)a.push(s[l]);return a}:n.refiner=r})}function Nf(e,t,n,r){let i=n!==void 0?n:"Refinement failed",o=r!==void 0?Ob(r):"";return Qb(e,a=>(s=>{let l=Et(s,t);return[{c:u=>l+"("+u+")",f:od(void 0,o,i,void 0)}]}))}function md(){let e=_t(wi());return e.to=vn(),e}function Df(e,t){return gn(e,n=>{let r=n.anyOf;if(r!==void 0){let o=[],a=[];for(let p=0,f=r.length;p<f;++p){let h=r[p],c=bn(h);c.type!=="undefined"&&(o.push(c),a.push(h))}let s=o.length,l;if(s!==1)if(s!==0)l=Qt(o);else{let p="Can't set default for "+Ae(n);throw new Error("[Sury] "+p)}else l=o[0];let u=a.length!==1?Qt(a):a[0];if(t.TAG==="Value"){let p=t._0;try{Qs(_e,l)(p)}catch(f){let h=Yo(f),c="Invalid default for "+Ae(n)+": "+h.message;throw new Error("[Sury] "+c)}try{n.default=Qs(Wt(u),void 0)(p)}catch{}}n.parser=p=>{let f=p.e.to,h=p.v(),c;return c=t.TAG==="Value"?Ai(p,ud(t._0)):Et(p,t._0)+"()",ut(p,h+"===void 0?"+c+":"+h,f,f)};let d=_t(l),m=d.decoder;d.serializer=p=>{let f=Wt(u);return Y(m(p),f,void 0,f)},d.decoder=vf,n.to=d;return}let i="Can't set default for "+Ae(n);throw new Error("[Sury] "+i)})}function Zs(e,t){let n=fe[t.type];if(n&46)return ye(Y(e,_e,void 0,t));if(n&2064){let i=_t(wi());return i.to=t,ye(Y(e,_e,void 0,i))}if(n&128){let i=Oi(_e),o=ye(Y(e,_e,void 0,i));return o.s.additionalItems=Ve(),o.e=t,o.io=!1,o}if(n&64){let i=ea(_e),o=ye(Y(e,_e,void 0,i));return o.s.additionalItems=Ve(),o.e=t,o.io=!1,o}if(n&768)return e;let r=_t(Pr());return r.to=t,ye(Y(e,_e,void 0,r))}function Sr(e){let t=fe[e.type],n=!0;if(!(t&46||e.$ref===Ve().$ref||t&256&&e.anyOf.every(Sr))){let i=!1;if(t&128){let o=e.additionalItems,a;a=o==="strip"||o==="strict"?!0:Sr(o),i=a}n=i&&e.items.every(Sr)}if(n)return!0;let r=!1;if(t&64){let i=e.additionalItems,o;o=i==="strip"||i==="strict"?!0:Sr(i),r=o}return r?Object.values(e.properties).every(Sr):!1}function hf(e){let t=fe[e.s.type];if(Sr(e.s))return e;if(t&2064)return hn(e,wi(),void 0);if(t&128){let n=Pe(Ht,!1);n.items=e.s.items.map(o=>Ve()),n.decoder=Ci;let r=e.s.additionalItems,i;return i=r==="strip"||r==="strict"?r:Ve(),n.additionalItems=i,n.to=e.e.to,ye(Y(e,void 0,void 0,n))}if(t&64){let n=e.s.additionalItems;if(!(n==="strip"||n==="strict")){let o=ea(Ve());return o.to=e.e.to,ye(Y(e,void 0,void 0,o))}let r=Cr(e,e.s);r.e=Ve(),e.e.to&&(r.e=_t(r.e),r.e.to=e.e.to);let i=Object.keys(e.s.properties);for(let o=0,a=i.length;o<a;++o){let s=i[o],l=vi(e,s);if(l.io=!1,l.s.type===pt&&l.s.has[lt]){l.e=Qt([vn(),Ve()]);let u=ye(l);u.o=!0,Rt(r,s,u)}else l.e=Ve(),Rt(r,s,ye(l))}return Or(r)}if(t&512)return _f(e);if(t&256&&!(lt in e.s.has))return ye($f(e,e.e));if(t&1)return e.e.to&&!e.e.parser?(e.s=Ve(),Zs(e,e.e)):e.e.noValidation?(e.s=Ve(),e):_f(e);try{let n=_t(Pr());return n.to=e.e,e.e=n,ye(e)}catch{return Wn(e,e.s,Ve())}}function Ve(){return Sn(Jn,Hs,e=>{let t=Pe(Hs,!0);t.$ref=Vb+Jn,t.name=Jn,t.decoder=hf,t.encoder=Zs,e.$ref=t.$ref,e.name=Jn,e.decoder=hf,e.encoder=Zs;let n=[Pr(),ld(),dd(),wi(),ea(t),Oi(t)],r={};n.forEach(a=>{r[a.type]=!0});let i=Pe(pt,!0);i.anyOf=n,i.has=r,i.decoder=qf,i.name=Jn,i.type=pt;let o={};o[Jn]=i,e.$defs=o})}function Zb(e){return e[td]}function Ti(e,t,n){let r=_t(bn(e));return r.from=t,n!==void 0&&(r.fromFlattened=n),new Proxy(r,{get:(i,o)=>{if(o===td)return i;let a=i.items,s=i.properties,l=s!==void 0?s[o]:a!==void 0?a[o]:void 0;if(l===void 0){let u='Cannot read property "'+o+'" of '+Ae(i);throw new Error("[Sury] "+u)}return Ti(l,i.from.concat(o),i.fromFlattened)}})}function Lf(e,t,n){let r=Cr(e,t);r.io=!0;let i=t.items;if(i!==void 0)for(let o=0,a=i.length;o<a;++o){let s=o.toString();Rt(r,s,n(s,i[o]))}else{let o=t.properties;if(o!==void 0){let a=Object.keys(o);for(let s=0,l=a.length;s<l;++s){let u=a[s];Rt(r,u,n(u,o[u]))}}else{let a="Don't know where the value is coming from: "+Ae(t);throw new Error("[Sury] "+a)}}return Or(r)}function Jf(e,t){let n=t.from,r=t.fromFlattened,i=r!==void 0?Vt(yf(e.fv[r],t.from,0)):n!==void 0?Vt(yf(e,n,0)):It in t?hn(e,t,void 0):Lf(e,t,(o,a)=>Jf(e,a));return i.prev=void 0,i.e=t,i}function Uf(e,t){let n=t.e,r=n.from;if(r!==void 0){let a=n.fromFlattened,s;if(a!==void 0){e.flattened===void 0&&(e.flattened=[]);let l=e.flattened[a];if(l!==void 0)s=l;else{let u={};e.flattened[a]=u,s=u}}else s=e;for(let l=0,u=r.length;l<u;++l){let d=r[l],m=s.properties,p;if(m!==void 0)p=m;else{let c={};s.properties=c,p=c}let f=p[d],h;if(f!==void 0)h=f;else{let c={};p[d]=c,h=c}s=h}s.val=t;return}let i=t.d;if(i===void 0)return;let o=Object.keys(i);for(let a=0,s=o.length;a<s;++a)Uf(e,i[o[a]])}function Bo(e,t,n,r){let i=0;if(t!==void 0){let o=t.val;if(o!==void 0){let a=Vt(o);return a.t=!0,a.s=n,a.e=n,ye(a)}i=1}else i=1;if(i===1){if(It in n){let m=hn(e,n,n);return m.prev=void 0,m.p=e,m.v=Vs,m.io=!0,ye(m)}let o=t===void 0?bn(n):n,a=Cr(e,o);a.e=o,a.io=!0,a.prev=void 0,a.p=e,a.v=Vs;let s=o.flattened,l=o.items,u=0,d=0;if(l!==void 0&&(t!==void 0||typeof o.additionalItems!==Re))for(let m=0,p=l.length;m<p;++m){let f=m.toString(),h;if(t!==void 0){let y=t.properties;h=y!==void 0?y[f]:void 0}else h=void 0;let c=Kn(e.g,f);Rt(a,f,Bo(e,h,l[m],r+("["+c+"]")))}else d=3;if(d===3){let m=o.properties;if(m!==void 0&&(t!==void 0||typeof o.additionalItems!==Re)){if(s!==void 0&&t!==void 0){let f=t.flattened;f!==void 0&&f.forEach((h,c)=>{let b=Bo(e,h,Wt(s[c]),r).d,T=Object.keys(b);for(let v=0,g=T.length;v<g;++v){let R=T[v];Rt(a,R,b[R])}})}let p=Object.keys(m);for(let f=0,h=p.length;f<h;++f){let c=p[f];if(!(c in a.d)){let y;if(t!==void 0){let T=t.properties;y=T!==void 0?T[c]:void 0}else y=void 0;let b=Kn(e.g,c);Rt(a,c,Bo(e,y,m[c],r+("["+b+"]")))}}}else u=2}if(u===2){let m=n.from,p=m!==void 0?r+m.map(h=>'["'+h+'"]').join(""):r,f=p===""?"":" at "+p;Fb(e,"Missing input for "+Ae(n)+f)}return Or(a)}}function yf(e,t,n){for(;;){let r=n,i=e,o=t[r];if(o===void 0)return i;n=r+1|0,e=i.d[o]}}function Qo(e,t){if(typeof e!==Re||e===null)return ud(e);let n=t(e);if(n!==void 0)return n;if(Array.isArray(e)){for(let l=0,u=e.length;l<u;++l){let d=Qo(e[l],t);e[l]=d}let s=Pe(Ht,!1);return s.items=e,s.additionalItems="strict",s.decoder=Ci,s}let r=e.constructor;if(r&&r!==Object){let s=Pe(nd,!0);return s.class=r,s.const=e,s.decoder=wr,s}let i=Object.keys(e),o=i.length;for(let s=0;s<o;++s){let l=i[s],u=Qo(e[l],t);e[l]=u}let a=Pe(Re,!1);return a.required=i,a.properties=e,a.additionalItems=gi.a,a.decoder=Rr,a}function Yb(e){let t={};Uf(t,e);let n=e.e.to,r=Bo(e,t,n,"");return r.t=!0,r.prev=e,r}function Ei(e){return Qo(e,t=>{if(t["~standard"])return t})}function Bf(e){let t=this,n="~"+e,r=t[n];if(r!==void 0)return N(r);let i={},o=[],a=Pe(Re,!1);a.required=o,a.properties=i,a.additionalItems=gi.a,a.decoder=Rr;let s=t.f(e,a)[td],l=(f,h)=>{let c=Er(f);if(f in i)throw new Error("[Sury] "+("The field "+c+" defined twice"));return o.push(f),i[f]=h,Ti(h,s.from.concat(f),s.fromFlattened)},p={field:l,f:l,fieldOr:(f,h,c)=>{let y=Xo(h,void 0);return l(f,Df(y,{TAG:"Value",_0:c}))},tag:(f,h)=>{l(f,Ei(h))},nested:Bf,flatten:f=>{if(f.type==="object"){let y=f.to,b=f.properties;if(y){let g="Unsupported nested flatten for transformed object schema "+Ae(f);throw new Error("[Sury] "+g)}let T=Object.keys(b),v={};for(let g=0,R=T.length;g<R;++g){let M=T[g];v[M]=l(M,b[M])}return v}let c="Can't flatten "+Ae(f)+" schema";throw new Error("[Sury] "+c)}};return t[n]=p,p}function Kf(e){let t=_t(Qo(e,Zb));return t.serializer=Yb,t}function zf(e){let t=e.e.flattened;if(t!==void 0){let i=[];for(let o=0,a=t.length;o<a;++o){let s=t[o],l=s.to,u;if(l!==void 0){let d=Vt(e);d.e=s,d.io=!0,u=ye(d)}else{let d=Lf(e,s,(m,p)=>vi(e,m));d.e=s,d.prev=void 0,u=Si(d,d)}i.push(u),e.cp=e.cp+Pt(u,void 0)}e.fv=i}let n=e.e.to,r=Jf(e,n);return r.t=!0,r.prev=e,Si(r,e)}function Wf(e){let t,n={},r=d=>{if(d.type==="object"){let f=d.properties,h=Object.keys(f);for(let y=0,b=h.length;y<b;++y){let T=h[y],v=f[T],g=n[T];if(g!==void 0){if(g!==v)throw new Error("[Sury] "+('The field "'+T+'" defined twice with incompatible schemas'))}else n[T]=v}let c=t||(t=[]);return Ti(d,Zo,c.push(d)-1|0)}let p="The '"+Ae(d)+"' schema can't be flattened";throw new Error("[Sury] "+p)},i=(d,m)=>{if(d in n)throw new Error("[Sury] "+('The field "'+d+'" defined twice with incompatible schemas'));return n[d]=m,Ti(m,[d],void 0)},l=e({field:i,f:i,fieldOr:(d,m,p)=>{let f=Xo(m,void 0);return i(d,Df(f,{TAG:"Value",_0:p}))},tag:(d,m)=>{i(d,Ei(m))},nested:Bf,flatten:r}),u=Pe(Re,!1);return u.required=Object.keys(n),u.properties=n,u.additionalItems=gi.a,u.decoder=Rr,u.parser=zf,u.to=Kf(l),t!==void 0&&(u.flattened=t),u}function Hf(e){let t=[],n=(s,l)=>{let u=s.toString();if(t[s])throw new Error("[Sury] "+("The item ["+u+"] is defined multiple times"));return t[s]=l,Ti(l,[s.toString()],void 0)},o=e({item:n,tag:(s,l)=>{n(s,Ei(l))}});for(let s=0,l=t.length;s<l;++s)t[s]||(t[s]=vn());let a=Pe(Ht,!1);return a.items=t,a.additionalItems="strict",a.decoder=Ci,a.parser=zf,a.to=Kf(o),a}function Xb(e){return e}function tS(e){return Ei(e(eS))}function Qf(e){return Qt(e.map(Vf))}function Zf(e){return Xo(e,md())}function Yf(e){return Qt([e,vn(),md()])}var Ys,Zo,Ab,Xs,ed,td,Tr,yn,Eb,Ko,Pb,kr,lt,zs,nd,Ht,Re,pt,Ws,ki,Hs,gf,It,fe,Bn,nt,xi,bf,rd,id,gi,Ot,ff,xr,Un,Us,_e,_t,Jn,zn,Vb,eS,Vf,Xf,em,tm,nm,rm=_(()=>{uf();cf();w();D();ee();Ys={},Zo=[],Ab=(e=>({...e}));Xs="sury",ed=Symbol(Xs),td=Symbol(Xs+":item"),Tr="string",yn="number",Eb="bigint",Ko="boolean",Pb="symbol",kr="null",lt="undefined",zs="nan",nd="instance",Ht="array",Re="object",pt="union",Ws="never",ki="unknown",Hs="ref",gf=za("Sury.Exn"),It="const";fe={[ki]:1,[Tr]:2,[yn]:4,[Ko]:8,[lt]:16,[kr]:32,[Re]:64,[Ht]:128,[pt]:256,[Hs]:512,[Eb]:1024,[zs]:2048,function:4096,[nd]:8192,[Ws]:32768,[Pb]:16384};Bn=class extends Error{constructor(t){super();for(let n in t)this[n]=t[n]}},nt=Object.defineProperty,xi=Bn.prototype;nt(xi,"message",{get(){return Sf(this)}});nt(xi,"name",{value:"SuryError"});nt(xi,"s",{value:ed});nt(xi,"_1",{get(){return this}});nt(xi,"RE_EXN_ID",{value:gf});bf=1,rd=function(){},id=Object.create(null);nt(id,"with",{get(){return(e,...t)=>e(this,...t)}});rd.prototype=id;gi={m:Sf,d:void 0,a:"strip",f:0},Ot={},ff={configurable:!0},xr="value",Un="r";Us={};_e=Pe(ki,!0);_e.decoder=vf;_t=(e=>{let t=new rd;for(let n in e)t[n]=e[n];return t.seq=bf++,t});Ef.embedded=Zo;Jn="JSON";zn="BS_PRIVATE_NESTED_SOME_NONE";nt(id,"~standard",{get:function(){let e=this;return{version:1,vendor:Xs,validate:t=>{try{return{value:Qs(_e,e)(t)}}catch(n){let r=Yo(n);return{issues:[{message:r.reason,path:r.path===""?void 0:wb(r.path)}]}}}}}});Vb="#/$defs/";eS={m:Xb};Vf=Ei;Xf=Vf,em=ea,tm=Qt,nm=tS});var I,im,ht,Ir,Ze,ta,om,V,pd,am,Zt,na,Hn,Mt,Le,sm,Tn=_(()=>{rm();I=Pr(),im=ld(),ht=dd(),Ir=Ve(),Ze=Xf,ta=Oi,om=em,V=fd,pd=Zf,am=Yf,Zt=tm,na=Qf,Hn=Nf,Mt=nm,Le=Wf,sm=Hf});function Gt(e,t){return e.TAG==="Ok"?t(e._0):e}var ge=_(()=>{Ra()});var Mr=_(()=>{Tn();ee()});var Ri,dm,ra,iS,o0,_d=_(()=>{Tn();ge();Mr();Ri=Hn(I,e=>e.trim()!=="","empty author field",void 0),dm=Hn(Ri,e=>new RegExp("^[A-Za-z0-9+/]+={0,2}$").test(e),"expected unbroken base64 entity reference",void 0),ra=Hn(dm,e=>{let t=Buffer.from(e,"base64").toString("utf8");return new RegExp("^1:User:[1-9][0-9]*$").test(t)},"expected encoded User identity",void 0),iS=Hn(dm,e=>{let t=Buffer.from(e,"base64").toString("utf8");return new RegExp("^1:CodingJob:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$").test(t)},"expected encoded CodingJob identity",void 0),o0=Zt([Le(e=>(e.tag("kind","agent"),{kind:"agent",agent_id:e.f("agent_id",iS),via_user_id:e.f("via_user_id",ra),display_name:e.f("display_name",Ri)})),Le(e=>(e.tag("kind","human"),{kind:"human",user_id:e.f("user_id",ra),display_name:e.f("display_name",Ri)})),Le(e=>(e.tag("kind","service"),{kind:"service",user_id:e.f("user_id",ra),display_name:e.f("display_name",Ri)})),Le(e=>(e.tag("kind","external"),{kind:"external",user_id:e.f("user_id",ra),display_name:e.f("display_name",Ri)})),Le(e=>(e.tag("kind","system"),{kind:"system"})),Le(e=>(e.tag("kind","unavailable"),{kind:"unavailable",author_kind:e.f("author_kind",Hn(I,t=>["agent","system","unknown"].includes(t),"unknown unavailable author kind",void 0)),reason:e.f("reason",Hn(I,t=>["not_visible","invalid_source"].includes(t),"unknown unavailable author reason",void 0))}))])});var Gr=_(()=>{_d()});var Ii=_(()=>{w();D()});var Qn=_(()=>{Wi();D()});var sa=_(()=>{Qn();B();w();ge();L();D();oe();ee()});function Gi(e){switch(e){case"LoggedIn":return"logged_in";case"NotLoggedIn":return"not_logged_in";case"BinaryMissing":return"binary_missing";case"ProbeFailed":return"probe_failed"}}var yd=_(()=>{});var lS,uS,cS,fS,m0,da=_(()=>{Tn();ge();Mr();oe();lS=Zt([Ze("openai"),Ze("wafer")]),uS=Mt(e=>({sourceSeq:e.m(ht),provider:e.m(lS),model:e.m(I)})),cS=Zt([Ze("catalog_unavailable"),Ze("offered"),Ze("delisted"),Ze("unverified")]),fS=Mt(e=>({selection:e.m(uS),baseUrl:e.m(I),token:e.m(I),catalogStatus:e.m(V(cS))})),m0=Mt(e=>({source:e.m(fS),turn:e.m(om(Ir))}))});var mm=_(()=>{w();L();oe();sa();yd();da()});var pm=_(()=>{w();ge();Ii();L();oe();mm()});var qi=_(()=>{X()});var v0,T0,k0,_m=_(()=>{qi();X();B();w();ge();oe();ee();v0=1800*1e3,T0=new RegExp("[^A-Za-z0-9._-]+","g"),k0=new RegExp("^[-.]+|[-.]+$","g")});var ym=_(()=>{X();B();w();ge();oe();_m()});var gm=_(()=>{dt();w();ge();Is();L();D();oe();ee();pm();ym()});var vd=_(()=>{gm()});var Sm=_(()=>{"use strict";Gr();vd();Io();Te();Ee()});var vm=_(()=>{});function vS(e){switch(e){case"HumanReview":return"human_review";case"AutomaticReview":return"automatic_review";case"AcceptEdits":return"accept_edits";case"DenyRequests":return"deny_requests";case"DangerousBypass":return"dangerous_bypass"}}var sO,Tm=_(()=>{sO=["HumanReview","AutomaticReview","AcceptEdits","DenyRequests","DangerousBypass"].map(vS)});var bO,Td=_(()=>{X();w();ge();L();D();vm();Tm();bO=Object.fromEntries([["granular",Object.fromEntries([["sandbox_approval",!1],["rules",!1],["skill_approval",!1],["request_permissions",!1],["mcp_elicitations",!0]])]])});var xm=_(()=>{Qn();B();w();ge();L();D();Td();ee();da()});var Fr=_(()=>{});var Am=_(()=>{dt();Fr();B();w();L();D();oe()});function wm(e){return JSON.stringify(e)}var wS,CS,xO,AO,wO,CO,Cm=_(()=>{qi();dt();B();D();Am();wS="file",CS=["mcp_oauth_credentials_store","cli_auth_credentials_store"],xO=CS.flatMap(e=>["-c",e+'="'+wS+'"']);AO=["-c","model_providers.openai-linzumi.name="+wm("OpenAI"),"-c","model_providers.openai-linzumi.wire_api="+wm("responses"),"-c","model_providers.openai-linzumi.requires_openai_auth=true","-c","model_providers.openai-linzumi.supports_websockets=true"],wO=new RegExp("\\bsession\\b.+\\bis archived\\b","i"),CO=new RegExp("^thread not found(?:\\s*:|\\b)","i")});var Em=_(()=>{X();w();ge();D();oe();xm();Cm();_d()});var Pm=_(()=>{Em()});var xd=_(()=>{});var Ad=_(()=>{});var fa=_(()=>{w();oe();_i();xd();Ad()});var Mm=_(()=>{fa()});var Cd=_(()=>{"use strict"});function qS(e){let t=new Map;return{report:r=>{let i=r.key??r.message,o=r.audience??"user",a=e.nowMs(),s=t.get(i),l=s===void 0?{key:i,severity:r.severity,message:r.message,audience:o,count:1,firstAtMs:a,lastAtMs:a}:{...s,severity:r.severity,message:r.message,audience:o,count:s.count+1,lastAtMs:a};t.delete(i),t.set(i,l);for(let u of t.keys()){if(t.size<=GS)break;t.delete(u)}return e.writeAuditEvent(Gm,{severity:l.severity,audience:l.audience,key:l.key,message:l.message,count:l.count}),e.tuiActive()?(l.audience==="user"&&e.reportConsoleEvent(Gm,{severity:l.severity,key:l.key,message:l.message,count:l.count}),l):(l.count===1&&e.writeStderr(`${jS(l.severity)}${l.message}
20
+ `),l)},notices:()=>Array.from(t.values()),reset:()=>t.clear()}}function jS(e){switch(e){case"warning":return"WARNING: ";case"error":return"ERROR: ";case"info":return""}}var GS,Gm,qm,$O,Od=_(()=>{"use strict";fn();GS=50,Gm="runner.notice";qm={tuiActive:()=>!1,reportConsoleEvent:()=>{}},$O=qS({tuiActive:()=>qm.tuiActive(),writeAuditEvent:(e,t)=>Nn(e,t),reportConsoleEvent:(e,t)=>qm.reportConsoleEvent(e,t),writeStderr:e=>{process.stderr.write(e)},nowMs:Date.now})});var jm=_(()=>{"use strict";Te();Ee()});var $m=_(()=>{"use strict"});var $i=_(()=>{"use strict";Te()});var Nm=_(()=>{"use strict";Gr();$m();$i()});var Dm=_(()=>{"use strict";pn();Ee();Te()});var $S,Ed,Nr=_(()=>{Tn();$S=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],Ed=na($S)});var Di=_(()=>{qi();X();B();w();ge();Ii();D();dn();ee();mt()});var fE,Xt=_(()=>{X();B();w();tr();dr();L();oe();ee();Di();At();mt();fE=new RegExp('^\\{"t":"([^"]+)"')});function en(e,t){return e.catch(n=>t(Q(n)))}var tn=_(()=>{ee()});function Rd(e,t){return{message:t,budgetExempt:!1,preserveForRestart:e!==void 0?e:!1}}function Hm(e,t){let n=t-e.maxLivePressureAgeMs;return e.activeAckStartedAtMs.some(r=>r<=n)}function Lr(e){return e.replace(BS,"?").slice(0,128)}function KS(e,t,n,r,i,o,a,s,l,u){let d=a!==void 0?a:!1,m=e.now(),p=Lr(t).slice(0,64),f=Lr(r),h=o!==void 0?o-i:d?m-i:0,c=o!==void 0?m-o:0,y={correlationId:p,pushClass:n,pushEvent:f,queueWaitMs:h,ackWaitMs:c,outcome:s,activeWindowOccupancy:l};try{return u!==void 0?u(y):e.onPushTiming(y)}catch{try{console.warn("commander_push.timing_sink_failed correlation_id="+p+" push_event="+f+" branch="+s);return}catch{return}}}function Li(e,t,n,r,i){let o=t.timingEmitted.contents,a=t.timing;if(!(o||a===void 0))return t.timingEmitted.contents=!0,KS(e,a.correlationId,a.pushClass,a.pushEvent,t.enqueuedAtMs,n,!0,r,i,t.onPushTiming)}function Vm(e,t){return ce(e.activeAckStartedAtMs,0,(n,r)=>Math.max(n,t-r))}function zS(e,t,n,r,i){e.pressureShedCount.contents=e.pressureShedCount.contents+1|0;let o=i!==void 0?i.TAG==="ItemStream"?["item",Lr(i.itemKey),H(i.turnId,Lr)]:["turn",void 0,Lr(i._0)]:["none",void 0,void 0],a;return a=t==="AckPressure"?"ack_pressure":"queue_age",{event:"commander_push.pressure_shed",branch:a,shedCount:e.pressureShedCount.contents,ageMs:n,budgetMs:e.maxLivePressureAgeMs,threadKey:Lr(r),streamKind:o[0],itemKey:o[1],turnId:o[2]}}function Qm(e,t,n,r,i,o){let a=o(),s=zS(e,t,n,r,i);try{e.onPressureShed(s)}catch{let u=s.branch,d=s.shedCount,m=s.ageMs,p=s.budgetMs,f=s.threadKey,h=s.streamKind,c=s.itemKey,y=s.turnId,b={event:"commander_push.pressure_shed_fallback",branch:u,shedCount:d,ageMs:m,budgetMs:p,threadKey:f,streamKind:h,itemKey:c,turnId:y};try{e.onPressureShedFallback(b)}catch{}}return a}function Km(e){let t=e.now(),n=t-e.maxLivePressureAgeMs,r=Hm(e,t),i=[];e.live.activeThreads.forEach(o=>{let a=e.live.pendingByThread.get(o);if(a===void 0)return;let s=a.filter(u=>{let d=u.enqueuedAtMs<=n;if(!r&&!d)return!0;let m=r?"AckPressure":"QueueAge",p;return p=m==="AckPressure"?Vm(e,t):t-u.enqueuedAtMs,Qm(e,m,p,u.threadKey,u.streamIdentity,()=>{$t(u.supersede,f=>f()),Li(e,u,void 0,"pressure_shed",e.inFlight.contents)}),!1});s.length!==0?(e.live.pendingByThread.set(o,s),i.push(o)):e.live.pendingByThread.delete(o)}),e.live.activeThreads.splice(0,e.live.activeThreads.length,...i)}function Zm(e){let t=e.activeThreads.shift();if(t===void 0)return{TAG:"Ok",_0:void 0};let n=e.pendingByThread.get(t);if(n===void 0)return{TAG:"Error",_0:"Commander push admission lost an active thread"};let r=n.shift();return r!==void 0?(n.length!==0?e.activeThreads.push(t):e.pendingByThread.delete(t),{TAG:"Ok",_0:r}):(e.pendingByThread.delete(t),{TAG:"Error",_0:"Commander push admission thread queue was empty"})}function WS(e){for(;;){let t=Zm(e.live);if(t.TAG!=="Ok")return{TAG:"Error",_0:t._0};let n=t._0;if(n===void 0)return{TAG:"Ok",_0:void 0};let r=e.now(),i=Hm(e,r),o=n.enqueuedAtMs+e.maxLivePressureAgeMs<=r;if(!i&&!o)return{TAG:"Ok",_0:n};let a=i?"AckPressure":"QueueAge",s;s=a==="AckPressure"?Vm(e,r):r-n.enqueuedAtMs,Qm(e,a,s,n.threadKey,n.streamIdentity,()=>{$t(n.supersede,l=>l()),Li(e,n,void 0,"pressure_shed",e.inFlight.contents)})}}function HS(e){for(;;){let t=e.priority.activeThreads.length!==0,n=e.live.activeThreads.length!==0,r=e.maxInFlight===1?!0:e.liveInFlight.contents<(e.maxInFlight-1|0),i=n&&r,o=e.consecutivePriority.contents<8,a=0;if(t)a=i&&!o?1:2;else if(i)a=1;else return e.consecutivePriority.contents=0,{TAG:"Ok",_0:void 0};switch(a){case 1:e.consecutivePriority.contents=0;let s=WS(e);if(s.TAG!=="Ok")return{TAG:"Error",_0:s._0};let l=s._0;if(l!==void 0)return{TAG:"Ok",_0:l};continue;case 2:return e.consecutivePriority.contents=e.consecutivePriority.contents+1|0,Zm(e.priority)}}}function Ym(e,t,n,r,i,o,a){let s=t!==void 0?t:2e3,l=n!==void 0?n:g=>performance.now(),u=r!==void 0?r:(g,R)=>{let M=setTimeout(R,g);return M.unref(),()=>{clearTimeout(M)}},d=i!==void 0?i:g=>{console.warn("commander_push.pressure_shed",g)},m=o!==void 0?o:g=>{console.warn("commander_push.pressure_shed_fallback",g)},p=a!==void 0?a:g=>{},f=e>0,h=s>0&&isFinite(s)&&Number.isSafeInteger(s);if(!f)return{TAG:"Error",_0:"Commander push admission maxInFlight must be a positive integer"};if(!h)return{TAG:"Error",_0:"Commander push admission maxLivePressureAgeMs must be positive and finite"};let c={maxInFlight:e,priority:{pendingByThread:new Map,activeThreads:[]},live:{pendingByThread:new Map,activeThreads:[]},inFlight:{contents:0},liveInFlight:{contents:0},consecutivePriority:{contents:0},pumpScheduled:{contents:!1},schedulePump:()=>{},armPressureCheck:g=>{},recomputePressureCheck:()=>{},maxLivePressureAgeMs:s,now:l,schedulePressureCheck:u,activeAckStartedAtMs:[],cancelPressureCheck:{contents:void 0},pressureCheckDeadlineMs:{contents:void 0},onPressureShed:d,onPressureShedFallback:m,pressureShedCount:{contents:0},onPushTiming:p},y=g=>{let R=c.pressureCheckDeadlineMs.contents;if(R!==void 0){if(R<=g)return;$t(c.cancelPressureCheck.contents,be=>be()),c.pressureCheckDeadlineMs.contents=g;let W=c.schedulePressureCheck(Math.max(1,g-c.now()),()=>{c.cancelPressureCheck.contents=void 0,c.pressureCheckDeadlineMs.contents=void 0,Km(c),c.schedulePump(),c.recomputePressureCheck()});c.cancelPressureCheck.contents=W;return}$t(c.cancelPressureCheck.contents,W=>W()),c.pressureCheckDeadlineMs.contents=g;let M=c.schedulePressureCheck(Math.max(1,g-c.now()),()=>{c.cancelPressureCheck.contents=void 0,c.pressureCheckDeadlineMs.contents=void 0,Km(c),c.schedulePump(),c.recomputePressureCheck()});c.cancelPressureCheck.contents=M},b=()=>{let g={contents:void 0};c.live.pendingByThread.forEach(M=>{M.forEach(W=>{let be=W.enqueuedAtMs+c.maxLivePressureAgeMs,A=g.contents;g.contents=A!==void 0?Math.min(A,be):be})});let R=g.contents;if(R!==void 0)return y(ce(c.activeAckStartedAtMs,R,(M,W)=>Math.min(M,W+c.maxLivePressureAgeMs)))},T=()=>{for(;;){if(c.pumpScheduled.contents=!1,c.inFlight.contents>=c.maxInFlight)return;let g=HS(c);if(g.TAG==="Ok"){let M=g._0;if(M===void 0)return;let W=c.now();c.inFlight.contents=c.inFlight.contents+1|0;let be=c.inFlight.contents;c.activeAckStartedAtMs.push(W),c.live.activeThreads.length!==0&&y(W+c.maxLivePressureAgeMs),M.replaceableLive&&(c.liveInFlight.contents=c.liveInFlight.contents+1|0),en(M.task(W,be),A=>{M.outcome.contents="failed";let q=St(A),$=q!==void 0?j(vt(N(q)),"unknown admission task error"):"unknown admission task error";return M.fail(Rd(void 0,$)),Promise.resolve()}).finally(()=>{Li(c,M,W,M.outcome.contents,be),c.inFlight.contents=c.inFlight.contents-1|0;let A=c.activeAckStartedAtMs.indexOf(W);A!==-1&&c.activeAckStartedAtMs.splice(A,1),M.replaceableLive&&(c.liveInFlight.contents=c.liveInFlight.contents-1|0),c.schedulePump()});continue}let R=g._0;c.priority.pendingByThread.forEach(M=>{M.forEach(W=>{W.fail(Rd(void 0,R)),Li(c,W,void 0,"failed",c.inFlight.contents)})}),c.live.pendingByThread.forEach(M=>{M.forEach(W=>{W.fail(Rd(void 0,R)),Li(c,W,void 0,"failed",c.inFlight.contents)})}),c.priority.pendingByThread.clear(),c.live.pendingByThread.clear(),c.priority.activeThreads.splice(0,c.priority.activeThreads.length),c.live.activeThreads.splice(0,c.live.activeThreads.length);return}},v=()=>{if(!c.pumpScheduled.contents){c.pumpScheduled.contents=!0,queueMicrotask(T);return}};return c.schedulePump=v,c.armPressureCheck=y,c.recomputePressureCheck=b,{TAG:"Ok",_0:c}}function Xm(e){let t=H(e[Um],r=>r.trim());if(t===void 0)return{TAG:"Ok",_0:16};if(t==="")return{TAG:"Ok",_0:16};let n=Number(t);return Number.isSafeInteger(n)&&n>=2?{TAG:"Ok",_0:n|0}:{TAG:"Error",_0:Um+" must be an integer of at least 2"}}function ep(e){let t=H(e[Bm],r=>r.trim());if(t===void 0)return{TAG:"Ok",_0:2e3};if(t==="")return{TAG:"Ok",_0:2e3};let n=Number(t);return Number.isSafeInteger(n)&&n>0?{TAG:"Ok",_0:n|0}:{TAG:"Error",_0:Bm+" must be a positive integer"}}function zm(e,t,n,r,i,o,a,s){return Object.fromEntries([["branch",e],["shed_count",t],["age_ms",n],["budget_ms",r],["thread_key",i],["stream_kind",o],["item_key",xe(a,null,l=>l)],["turn_id",xe(s,null,l=>l)]])}function ZS(e,t){if(t.TAG==="PressureShed"){let r=t._0;return e(r.event,zm(r.branch,r.shedCount,r.ageMs,r.budgetMs,r.threadKey,r.streamKind,r.itemKey,r.turnId))}let n=t._0;e(n.event,zm(n.branch,n.shedCount,n.ageMs,n.budgetMs,n.threadKey,n.streamKind,n.itemKey,n.turnId))}function Wm(e){let t=VS.contents;if(t!==void 0)return ZS(t,e);QS.push(e)}var Um,Bm,BS,VS,QS,mE,Id=_(()=>{X();Ft();w();ge();tn();D();Um="LINZUMI_COMMANDER_PUSH_MAX_INFLIGHT",Bm="LINZUMI_COMMANDER_PUSH_PRESSURE_BUDGET_MS";BS=new RegExp("[^\\x20-\\x7E]","g");VS={contents:void 0},QS=[];mE=Gt(Xm(process.env),e=>Gt(ep(process.env),t=>Ym(e,t,void 0,void 0,n=>Wm({TAG:"PressureShed",_0:n}),n=>Wm({TAG:"PressureShedFallback",_0:n}),void 0)))});var np=_(()=>{dt();w();L()});var XS,Yn=_(()=>{B();w();L();D();ee();XS=bt(yi(),1)});var rp=_(()=>{w();D()});var _E,ip=_(()=>{rp();w();D();oe();_E=process.pid.toString()+":"+performance.timeOrigin.toString()});var Br=_(()=>{X()});var nv,ap=_(()=>{Qn();Fr();B();w();tr();L();D();nv=bt(yi(),1);Br();Ns()});var iv,sp=_(()=>{Qn();X();Fr();B();w();ge();D();ee();iv=bt(yi(),1);Yn()});var dp=_(()=>{qi();B();ge();oe();ee();Yn()});var ya=_(()=>{X();B();w();ge();dr();L();oe();ee();Yn();Xt();At();ap();sp();mt();Br();dp();Do()});var jd=_(()=>{X();B();w();L();Xt();At();ya();mt();Br()});var iP,Sa=_(()=>{X();B();w();ge();tn();dr();L();D();oe();ee();Yn();Di();Xt();At();_n();Fo();ip();mt();Br();jd();iP=1440*60*1e3});var Dd=_(()=>{});var Av,wv,Cv,oP,pp=_(()=>{Tn();Mr();Nr();Av=Le(e=>({decision:e.f("decision",I),label:e.f("label",I),description:e.f("description",V(I))})),wv=Le(e=>({requestId:e.f("requestId",I),kind:e.f("kind",I),summary:e.f("summary",I),reason:e.f("reason",V(I)),port:e.f("port",V(ht)),pid:e.f("pid",V(ht)),command:e.f("command",V(I)),cwd:e.f("cwd",V(I)),processName:e.f("processName",V(I)),processIconKey:e.f("processIconKey",V(I)),processIconPath:e.f("processIconPath",V(I)),choices:e.f("choices",V(ta(Av))),allowedActorSlug:e.f("allowedActorSlug",V(I)),allowedActorUserId:e.f("allowedActorUserId",V(ht))})),Cv=na(["starting turn","streaming response","running terminal command","interrupt requested","retrying empty turn","model stream stalled - resuming automatically from the last streamed checkpoint","upstream outage detected - recovery paused, resuming automatically","compacting conversation history","awaiting approval"]),oP=Zt([Le(e=>(e.tag("status","queued"),{TAG:"Queued",reason:e.f("reason",V(I))})),Le(e=>(e.tag("status","processed"),{TAG:"Processed",reason:e.f("reason",V(I))})),Le(e=>(e.tag("status","processing"),{TAG:"Processing",reason:e.f("reason",Cv),approval:e.f("approval",V(wv))})),Le(e=>(e.tag("status","ignored"),{TAG:"Ignored",reason:e.f("reason",I)})),Le(e=>(e.tag("status","failed"),{TAG:"Failed",reason:e.f("reason",I),retryable:e.f("retryable",V(im)),fate:e.f("fate",V(Ed))})),Le(e=>(e.tag("status","recovering"),{TAG:"Recovering",reason:e.f("reason",I),fate:e.f("fate",V(Ed))})),Le(e=>(e.tag("status","interrupted"),{TAG:"Interrupted",reason:e.f("reason",I)}))])});var _p=_(()=>{w()});var zr=_(()=>{w();Nr();Xt();_p()});var hp=_(()=>{X();w();D();ci()});var _P,hP,yP,Bi=_(()=>{X();w();L();oe();Td();zr();hp();_P=new RegExp("^https?:\\/\\/","i"),hP=new RegExp("^data:","i"),yP=new RegExp("^file:\\/\\/","i")});var Jd=_(()=>{X();B();w();D();oe();Bi()});var Sp=_(()=>{});var vp=_(()=>{X();w();L()});var Tp=_(()=>{L();yr()});var hR,yR,gR,bR,SR,vR,TR,kR,xR,AR,wR,CR,OR,ER,PR,RR,IR,MR,GR,qR,Ud=_(()=>{X();Fr();w();tr();Ii();Dd();L();D();Nr();oe();yr();Sp();vp();Bi();Tp();zr();Jd();_n();hR=new RegExp("<[^>]*>","g"),yR=new RegExp(`data:[^"' )]+`,"g"),gR=new RegExp("\\s+","g"),bR=new RegExp("(?:<!doctype\\s+html|<html(?:\\s|>))","i"),SR=new RegExp("cloudflare|cf-ray|\\bblocked\\b|access denied|\\bchallenge\\b|attention required","i"),vR=new RegExp("cloudflare|cf-ray","i"),TR=new RegExp("\\bblocked\\b|access denied","i"),kR=new RegExp("attention required","i"),xR=new RegExp("@font-face","i"),AR=new RegExp("unexpected status (401|403)\\b","i"),wR=new RegExp("\\b(401|403)\\s+(?:unauthorized|forbidden)\\b","i"),CR=new RegExp("^(?:model_request_rejected|invalid_request_error|invalid_request|request_rejected|content_policy_violation|content_filter|input_validation_error)$","i"),OR=new RegExp("\\bmodel request was rejected\\b|\\bmodel_request_rejected\\b","i"),ER=new RegExp("^provider_outage$","i"),PR=new RegExp("rejecting requests|experiencing an outage|provider outage","i"),RR=new RegExp("\\bapply_patch\\b[^]*\\bincompatible\\b|\\bin-flight tool future\\b[^]*\\bfail","i"),IR=new RegExp("\\btools::router\\b[^]*\\bfatal\\b|\\bresponse\\.failed\\b","i"),MR=new RegExp("(tool.*fatal|fatal.*tool|response[._]failed|tool_failure)","i"),GR=new RegExp("upstream model stream stalled","i"),qR=new RegExp("\\(HTTP (\\d{3})\\)")});var NR,Bd=_(()=>{Ft();w();D();ee();Bi();zr();Jd();Ud();NR=10*6e4});var JR,Ap=_(()=>{X();w();D();dn();ee();Bd();zr();JR=10*6e4});var wp=_(()=>{});var UR,Cp=_(()=>{Tn();Mr();UR=sm(e=>({joinRef:e.item(0,pd(I)),ref:e.item(1,pd(I)),topic:e.item(2,I),event:e.item(3,I),payload:e.item(4,Ir)}))});var Op=_(()=>{});var tI,Ep,nI,rI,iI,oI,ka=_(()=>{dt();X();Ft();B();w();ge();tn();L();D();oe();wp();ee();ci();Cp();Mo();Op();tI=new RegExp("/$"),Ep="[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]",nI=new RegExp(Ep),rI=new RegExp(Ep,"g"),iI=new RegExp("^npm install -g @linzumi\\/cli(@[0-9A-Za-z^~.-]{1,32})?$"),oI=new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]{1,32})?$")});var Pp=_(()=>{X();w()});var sT,aI,sI,dT,lT,dI,lI,Rp=_(()=>{Tn();w();Mr();sT=Mt(e=>({decision:e.m(I),label:e.m(I),description:e.m(V(I))})),aI=Mt(e=>({decision:e.m(I)})),sI=Mt(e=>({status:e.m(I),response:e.m(Ir)})),dT=Ze("terminal"),lT=Zt([Ze("interrupted"),Ze("processed"),Ze("failed"),Ze("ignored"),Ze("stop_failed")]),dI=Mt(e=>({disposition:e.m(dT),thread_id:e.m(I),seq:e.m(ht),status:e.m(lT),reason:e.m(am(I))})),lI=Mt(e=>({approval_request_id:e.m(I),approval_kind:e.m(I),approval_summary:e.m(I),approval_reason:e.m(V(I)),approval_port:e.m(V(ht)),approval_pid:e.m(V(ht)),approval_command:e.m(V(I)),approval_cwd:e.m(V(I)),approval_process_name:e.m(V(I)),approval_process_icon_key:e.m(V(I)),approval_process_icon_path:e.m(V(I)),approval_choices:e.m(V(ta(sT))),approval_allowed_actor_slug:e.m(V(I)),approval_allowed_actor_user_id:e.m(V(ht))}))});var Ip=_(()=>{Qn();X();Fr();B();w();ge();L();ee();Yn();Di();Xt();At();ya()});var ZI,zd=_(()=>{dt();X();Ft();B();w();ge();tn();Sa();Ii();Dd();L();D();dn();Nr();oe();_i();yr();ee();pp();Bd();Xt();Ap();Id();Bi();ka();At();zr();Ud();_n();Pp();Fo();mt();Br();Do();gr();Rp();fa();Ip();ZI=new RegExp("^item-\\d+$")});var YI,XI,jp=_(()=>{Ft();w();D();ee();YI=10*6e4,XI=30*6e4});var $p=_(()=>{w();ge();tn();L();D();ee()});var oM,Fp=_(()=>{dt();X();B();w();ge();tn();L();dn();oe();Gs();ee();ci();Mo();oM=100*1024*1024});var Np=_(()=>{Qn();dt();X();B();w();tn();Sa();L();oe();_i();ee();Fp();ka();xd();mt();fa()});var pG,Dp=_(()=>{dt();X();B();w();ge();tn();Sa();dr();L();D();dn();oe();ee();Yn();Di();Xt();ka();At();ya();jp();$p();_n();zd();mt();Np();gr();jd();pG=8*1024*1024});var RT,bG,Wd=_(()=>{"use strict";Eo();Cs();fn();Ee();RT=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,bG=new RegExp(RT.source,"g")});var Lp=_(()=>{B();w();L();Nr();ee();Xt();Id();np();zd();Dp();mt();gr();Wd();Cd()});var Jp=_(()=>{Lp()});var Up=_(()=>{At()});var u1,Bp=_(()=>{"use strict";Ee();Te();u1=1024*1024});var A1,Kp=_(()=>{"use strict";Ee();Up();Js();Bp();A1=1440*60*1e3});var zp=_(()=>{"use strict"});var Hd=_(()=>{"use strict";zp();pn()});var jT,M1,$T,G1,xa=_(()=>{"use strict";jT=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],M1=new Set(jT),$T={runner_updating:"transient_local",stillborn_worker:"transient_local",infra_turn_kill:"transient_local",resume_transient:"transient_local",start_stage_transient:"transient_local",resume_torn_tail:"transient_local",resurrection_interrupted:"transient_local",dead_letter_exhausted:"transient_local",dead_letter_withheld:"needs_decision",dead_letter_permanent:"deterministic",resume_cwd_not_allowed:"deterministic",cwd_stillbirth_circuit_open:"deterministic",engine_unavailable:"deterministic",provider_binding_rejected:"deterministic",project_untrusted:"deterministic",attachment_download_failed:"transient_local",claude_input_queue_closed:"transient_local",claude_dispatch_wedged:"transient_local"},G1=Object.keys($T)});var Wp=_(()=>{Ad()});var Vd=_(()=>{"use strict";Te();Wp()});var Hp=_(()=>{"use strict";pn();Te();Ee()});var Qp=_(()=>{"use strict";Hd();pn();Te();xa();Vd();Hp()});var Qd=_(()=>{"use strict";Gr()});var Zp=_(()=>{da()});var Yp=_(()=>{"use strict";Gr();Te();$i();Ee()});var Zd=_(()=>{"use strict";Gr();Te();$i();Ee()});var Xp=_(()=>{"use strict";Te()});var e_=_(()=>{"use strict";Te();xa()});var t_=_(()=>{"use strict"});var n_=_(()=>{w();L();oe()});var r_=_(()=>{n_()});var i_=_(()=>{"use strict";Qd();r_()});var Aa,o_=_(()=>{Aa={default:{maxLadderMs:9e5},wafer:{maxLadderMs:36e5}}});var fj,mj,a_=_(()=>{"use strict";o_();fj={maxRecoveryRungs:4,maxLadderMs:Aa.default.maxLadderMs,maxRateLimitHoldMs:30*6e4},mj={default:Aa.default,wafer:Aa.wafer}});var s_=_(()=>{"use strict"});var yj,d_=_(()=>{"use strict";Ee();yj=10*6e4});var Yd=_(()=>{"use strict";fn()});var Xd=_(()=>{"use strict";Yd();Yd()});var l_=_(()=>{"use strict";Xd()});function WT(e){let t=e.toLowerCase();switch(!0){case t.endsWith(".app"):return e.slice(0,-4);case t.endsWith(".exe"):return e.slice(0,-4);case t.endsWith(".cmd"):case t.endsWith(".bat"):return e.slice(0,-4);default:return e}}function HT(e){return WT(e.trim().replaceAll("\\","/").toLowerCase())}var zT,u_,Mj,c_=_(()=>{"use strict";zT=[{appName:"Bun",iconKey:"bun",names:["bun","bunx"]},{appName:"Node.js",iconKey:"nodejs",names:["node","nodejs","node.exe"]},{appName:"npm",iconKey:"npm",names:["npm","npm-cli.js","npx"]},{appName:"pnpm",iconKey:"pnpm",names:["pnpm","pnpx"]},{appName:"Yarn",iconKey:"yarn",names:["yarn","yarnpkg","yarn.js"]},{appName:"Corepack",iconKey:"corepack",names:["corepack"]},{appName:"Deno",iconKey:"deno",names:["deno"]},{appName:"Vite",iconKey:"vite",names:["vite","vite-node"]},{appName:"Vitest",iconKey:"vitest",names:["vitest"]},{appName:"Next.js",iconKey:"nextjs",names:["next","next-server"]},{appName:"Nuxt",iconKey:"nuxt",names:["nuxt","nuxi"]},{appName:"Astro",iconKey:"astro",names:["astro"]},{appName:"SvelteKit",iconKey:"svelte",names:["svelte-kit","sveltekit"]},{appName:"Remix",iconKey:"remix",names:["remix"]},{appName:"Expo",iconKey:"expo",names:["expo","expo-cli"]},{appName:"React Native",iconKey:"react",names:["react-native"]},{appName:"Metro",iconKey:"metro",names:["metro","metro-inspector-proxy"]},{appName:"Webpack",iconKey:"webpack",names:["webpack","webpack-dev-server","webpack-cli"]},{appName:"Parcel",iconKey:"parcel",names:["parcel"]},{appName:"Rollup",iconKey:"rollup",names:["rollup"]},{appName:"esbuild",iconKey:"esbuild",names:["esbuild"]},{appName:"SWC",iconKey:"swc",names:["swc"]},{appName:"TypeScript",iconKey:"typescript",names:["tsc","tsserver","tsx","ts-node","typescript-language-server"]},{appName:"ESLint",iconKey:"eslint",names:["eslint","eslint_d"]},{appName:"Prettier",iconKey:"prettier",names:["prettier"]},{appName:"Biome",iconKey:"biome",names:["biome"]},{appName:"Storybook",iconKey:"storybook",names:["storybook","start-storybook"]},{appName:"Playwright",iconKey:"playwright",names:["playwright"]},{appName:"Cypress",iconKey:"cypress",names:["cypress"]},{appName:"Jest",iconKey:"jest",names:["jest"]},{appName:"Python",iconKey:"python",names:["python","python2","python3","python3.9","python3.10","python3.11","python3.12","python3.13","pypy","pypy3"]},{appName:"pip",iconKey:"python",names:["pip","pip2","pip3"]},{appName:"pipx",iconKey:"python",names:["pipx"]},{appName:"uv",iconKey:"python",names:["uv","uvx"]},{appName:"Poetry",iconKey:"poetry",names:["poetry"]},{appName:"Pipenv",iconKey:"python",names:["pipenv"]},{appName:"Conda",iconKey:"conda",names:["conda","mamba","micromamba"]},{appName:"Django",iconKey:"django",names:["django-admin","django-admin.py","manage.py"]},{appName:"Flask",iconKey:"flask",names:["flask"]},{appName:"Uvicorn",iconKey:"uvicorn",names:["uvicorn"]},{appName:"Gunicorn",iconKey:"gunicorn",names:["gunicorn"]},{appName:"Hypercorn",iconKey:"python",names:["hypercorn"]},{appName:"Celery",iconKey:"celery",names:["celery"]},{appName:"Jupyter",iconKey:"jupyter",names:["jupyter","jupyter-lab","jupyter-notebook","ipython"]},{appName:"Ruby",iconKey:"ruby",names:["ruby","erb","irb"]},{appName:"Bundler",iconKey:"ruby",names:["bundle","bundler"]},{appName:"Rails",iconKey:"rails",names:["rails","bin/rails"]},{appName:"Rack",iconKey:"ruby",names:["rackup"]},{appName:"Puma",iconKey:"puma",names:["puma"]},{appName:"Sidekiq",iconKey:"sidekiq",names:["sidekiq"]},{appName:"RSpec",iconKey:"ruby",names:["rspec"]},{appName:"Go",iconKey:"go",names:["go","gofmt","gopls","air"]},{appName:"Delve",iconKey:"go",names:["dlv"]},{appName:"Rust",iconKey:"rust",names:["rustc","rustup","cargo","rust-analyzer"]},{appName:"Java",iconKey:"java",names:["java","javac","jar","jshell","jwebserver"]},{appName:"Gradle",iconKey:"gradle",names:["gradle","gradlew"]},{appName:"Maven",iconKey:"maven",names:["mvn","mvnw"]},{appName:"Spring Boot",iconKey:"spring",names:["spring","spring-boot"]},{appName:"Kotlin",iconKey:"kotlin",names:["kotlin","kotlinc","kotlin-language-server"]},{appName:"Scala",iconKey:"scala",names:["scala","scalac","sbt","metals"]},{appName:"Clojure",iconKey:"clojure",names:["clojure","clj","lein","boot"]},{appName:"PHP",iconKey:"php",names:["php","php-fpm","php-cgi","composer"]},{appName:"Laravel",iconKey:"laravel",names:["artisan","laravel"]},{appName:"Symfony",iconKey:"symfony",names:["symfony"]},{appName:"Elixir",iconKey:"elixir",names:["elixir","iex","mix"]},{appName:"Erlang",iconKey:"erlang",names:["erl","beam.smp","beam","epmd","rebar3"]},{appName:"Phoenix",iconKey:"phoenix",names:["phx.server","phoenix"]},{appName:"PostgreSQL",iconKey:"postgresql",names:["postgres","postmaster","pg_ctl","psql","pg_isready"]},{appName:"Redis",iconKey:"redis",names:["redis-server","redis-cli","redis-sentinel"]},{appName:"MySQL",iconKey:"mysql",names:["mysql","mysqld","mysqladmin"]},{appName:"MariaDB",iconKey:"mariadb",names:["mariadb","mariadbd","mariadb-admin"]},{appName:"SQLite",iconKey:"sqlite",names:["sqlite3","sqlite"]},{appName:"MongoDB",iconKey:"mongodb",names:["mongod","mongosh","mongo"]},{appName:"Elasticsearch",iconKey:"elasticsearch",names:["elasticsearch"]},{appName:"OpenSearch",iconKey:"opensearch",names:["opensearch"]},{appName:"Solr",iconKey:"solr",names:["solr"]},{appName:"Kafka",iconKey:"kafka",names:["kafka-server-start","kafka-console-consumer","kafka-console-producer"]},{appName:"ZooKeeper",iconKey:"zookeeper",names:["zookeeper-server-start","zkserver"]},{appName:"RabbitMQ",iconKey:"rabbitmq",names:["rabbitmq-server","rabbitmqctl"]},{appName:"NATS",iconKey:"nats",names:["nats-server","nats"]},{appName:"Docker",iconKey:"docker",names:["docker","dockerd","docker-compose","docker-proxy","com.docker.backend"]},{appName:"Podman",iconKey:"podman",names:["podman","podman-compose"]},{appName:"Kubernetes",iconKey:"kubernetes",names:["kubectl","kube-apiserver","kubelet","minikube","kind"]},{appName:"Helm",iconKey:"helm",names:["helm"]},{appName:"Tilt",iconKey:"tilt",names:["tilt"]},{appName:"nginx",iconKey:"nginx",names:["nginx"]},{appName:"Caddy",iconKey:"caddy",names:["caddy"]},{appName:"Apache HTTP Server",iconKey:"apache",names:["httpd","apache2","apachectl"]},{appName:"HAProxy",iconKey:"haproxy",names:["haproxy"]},{appName:"Traefik",iconKey:"traefik",names:["traefik"]},{appName:"Envoy",iconKey:"envoy",names:["envoy"]},{appName:"Tailscale",iconKey:"tailscale",names:["tailscale","tailscaled"]},{appName:"Cloudflare Tunnel",iconKey:"cloudflare",names:["cloudflared"]},{appName:"ngrok",iconKey:"ngrok",names:["ngrok"]},{appName:"localtunnel",iconKey:"terminal",names:["lt","localtunnel"]},{appName:"SSH",iconKey:"ssh",names:["ssh","sshd","scp","sftp"]},{appName:"Git",iconKey:"git",names:["git","git-lfs","git-upload-pack","git-receive-pack"]},{appName:"GitHub CLI",iconKey:"github",names:["gh"]},{appName:"GitLab CLI",iconKey:"gitlab",names:["glab"]},{appName:"Subversion",iconKey:"subversion",names:["svn"]},{appName:"Mercurial",iconKey:"mercurial",names:["hg"]},{appName:"AWS CLI",iconKey:"aws",names:["aws","aws-vault","sam"]},{appName:"Azure CLI",iconKey:"azure",names:["az"]},{appName:"Google Cloud CLI",iconKey:"google-cloud",names:["gcloud","gsutil","bq"]},{appName:"Terraform",iconKey:"terraform",names:["terraform"]},{appName:"OpenTofu",iconKey:"opentofu",names:["tofu"]},{appName:"Ansible",iconKey:"ansible",names:["ansible","ansible-playbook"]},{appName:"Pulumi",iconKey:"pulumi",names:["pulumi"]},{appName:"Nomad",iconKey:"nomad",names:["nomad"]},{appName:"Vault",iconKey:"vault",names:["vault"]},{appName:"Consul",iconKey:"consul",names:["consul"]},{appName:"Make",iconKey:"make",names:["make","gmake"]},{appName:"CMake",iconKey:"cmake",names:["cmake","ctest","cpack"]},{appName:"Ninja",iconKey:"ninja",names:["ninja"]},{appName:"Bazel",iconKey:"bazel",names:["bazel","bazelisk"]},{appName:"Buck",iconKey:"buck",names:["buck","buck2"]},{appName:"Clang",iconKey:"clang",names:["clang","clang++","clangd"]},{appName:"GCC",iconKey:"gcc",names:["gcc","g++","cc","c++"]},{appName:"LLDB",iconKey:"terminal",names:["lldb"]},{appName:"GDB",iconKey:"terminal",names:["gdb"]},{appName:"Swift",iconKey:"swift",names:["swift","swiftc","sourcekit-lsp"]},{appName:"Xcode",iconKey:"xcode",names:["xcodebuild","xcrun","simctl"]},{appName:"Zig",iconKey:"zig",names:["zig"]},{appName:"Lua",iconKey:"lua",names:["lua","luajit","lua-language-server"]},{appName:"Perl",iconKey:"perl",names:["perl"]},{appName:"R",iconKey:"r",names:["r","rscript","rserver","rsession"]},{appName:"Julia",iconKey:"julia",names:["julia"]},{appName:"Haskell",iconKey:"haskell",names:["ghc","ghci","cabal","stack","haskell-language-server-wrapper"]},{appName:"OCaml",iconKey:"ocaml",names:["ocaml","ocamlc","dune","opam"]},{appName:"F#",iconKey:"fsharp",names:["fsharpi","fsautocomplete"]},{appName:".NET",iconKey:"dotnet",names:["dotnet","csharp-ls","omnisharp"]},{appName:"PowerShell",iconKey:"powershell",names:["pwsh","powershell"]},{appName:"Bash",iconKey:"terminal",names:["bash"]},{appName:"Zsh",iconKey:"terminal",names:["zsh"]},{appName:"fish",iconKey:"terminal",names:["fish"]},{appName:"tmux",iconKey:"terminal",names:["tmux"]},{appName:"GNU Screen",iconKey:"terminal",names:["screen"]},{appName:"direnv",iconKey:"terminal",names:["direnv"]},{appName:"Nix",iconKey:"nix",names:["nix","nix-shell","nix-daemon","nix-build","nix develop"]},{appName:"Homebrew",iconKey:"homebrew",names:["brew"]},{appName:"mise",iconKey:"terminal",names:["mise"]},{appName:"asdf",iconKey:"terminal",names:["asdf"]},{appName:"Volta",iconKey:"volta",names:["volta"]},{appName:"fnm",iconKey:"nodejs",names:["fnm"]},{appName:"nvm",iconKey:"nodejs",names:["nvm"]},{appName:"curl",iconKey:"terminal",names:["curl"]},{appName:"HTTPie",iconKey:"httpie",names:["http","https","httpie"]},{appName:"wget",iconKey:"terminal",names:["wget"]},{appName:"jq",iconKey:"terminal",names:["jq"]},{appName:"ripgrep",iconKey:"terminal",names:["rg","ripgrep"]},{appName:"fd",iconKey:"terminal",names:["fd"]},{appName:"fzf",iconKey:"terminal",names:["fzf"]},{appName:"bat",iconKey:"terminal",names:["bat"]},{appName:"eza",iconKey:"terminal",names:["eza","exa"]},{appName:"htop",iconKey:"terminal",names:["htop","top","btop"]},{appName:"Vim",iconKey:"vim",names:["vim","view","vimdiff"]},{appName:"Neovim",iconKey:"neovim",names:["nvim","nvim-qt"]},{appName:"Emacs",iconKey:"emacs",names:["emacs","emacsclient"]},{appName:"Visual Studio Code",iconKey:"vscode",names:["code","code-insiders","vscode","visual studio code","visual studio code - insiders"]},{appName:"code-server",iconKey:"vscode",names:["code-server"]},{appName:"Cursor",iconKey:"cursor",names:["cursor"]},{appName:"Zed",iconKey:"zed",names:["zed"]},{appName:"Sublime Text",iconKey:"sublime-text",names:["subl","sublime_text","sublime text"]},{appName:"Atom",iconKey:"atom",names:["atom"]},{appName:"IntelliJ IDEA",iconKey:"intellij-idea",names:["idea","idea.sh","intellij idea","idea64.exe"]},{appName:"WebStorm",iconKey:"webstorm",names:["webstorm","webstorm.sh"]},{appName:"PyCharm",iconKey:"pycharm",names:["pycharm","pycharm.sh"]},{appName:"RubyMine",iconKey:"rubymine",names:["rubymine","rubymine.sh"]},{appName:"GoLand",iconKey:"goland",names:["goland","goland.sh"]},{appName:"CLion",iconKey:"clion",names:["clion","clion.sh"]},{appName:"DataGrip",iconKey:"datagrip",names:["datagrip","datagrip.sh"]},{appName:"Rider",iconKey:"rider",names:["rider","rider.sh"]},{appName:"Android Studio",iconKey:"android-studio",names:["studio","studio.sh","android studio"]},{appName:"Xcode",iconKey:"xcode",names:["xcode","xcode.app"]},{appName:"Postman",iconKey:"postman",names:["postman"]},{appName:"Insomnia",iconKey:"insomnia",names:["insomnia"]},{appName:"Hoppscotch",iconKey:"hoppscotch",names:["hoppscotch"]},{appName:"TablePlus",iconKey:"tableplus",names:["tableplus"]},{appName:"DBeaver",iconKey:"dbeaver",names:["dbeaver"]},{appName:"RedisInsight",iconKey:"redis",names:["redisinsight"]},{appName:"Prisma",iconKey:"prisma",names:["prisma"]},{appName:"Drizzle Kit",iconKey:"drizzle",names:["drizzle-kit"]},{appName:"Supabase",iconKey:"supabase",names:["supabase"]},{appName:"Firebase",iconKey:"firebase",names:["firebase"]},{appName:"Vercel",iconKey:"vercel",names:["vercel"]},{appName:"Netlify",iconKey:"netlify",names:["netlify","ntl"]},{appName:"Fly.io",iconKey:"fly",names:["fly","flyctl"]},{appName:"Heroku",iconKey:"heroku",names:["heroku"]},{appName:"Stripe CLI",iconKey:"stripe",names:["stripe"]},{appName:"Twilio CLI",iconKey:"twilio",names:["twilio"]},{appName:"Mailpit",iconKey:"mail",names:["mailpit"]},{appName:"MailHog",iconKey:"mail",names:["mailhog"]},{appName:"OpenSSL",iconKey:"openssl",names:["openssl"]},{appName:"mkcert",iconKey:"certificate",names:["mkcert"]},{appName:"mkdocs",iconKey:"markdown",names:["mkdocs"]},{appName:"Hugo",iconKey:"hugo",names:["hugo"]},{appName:"Jekyll",iconKey:"jekyll",names:["jekyll"]},{appName:"Eleventy",iconKey:"eleventy",names:["eleventy","11ty"]},{appName:"Docusaurus",iconKey:"docusaurus",names:["docusaurus"]},{appName:"Trunk",iconKey:"rust",names:["trunk"]},{appName:"wasm-pack",iconKey:"webassembly",names:["wasm-pack"]},{appName:"wasmtime",iconKey:"webassembly",names:["wasmtime"]},{appName:"Language Server",iconKey:"language-server",names:["lua-language-server","yaml-language-server","vscode-json-language-server","docker-langserver","bash-language-server","marksman","taplo"]}],u_=new Map;for(let e of zT)for(let t of e.names)u_.set(HT(t),{appName:e.appName,iconKey:e.iconKey});Mj=u_.size});var f_=_(()=>{"use strict"});var el=_(()=>{"use strict";tf();Js();Sm();vd();Pm();Mm();Cd();Po();Od();jm();po();Oo();Nm();pn();Dm();Jp();Kp();Qp();Vd();Te();Qd();Zp();$i();Ro();Yp();Zd();Xp();e_();t_();i_();Wd();xa();a_();Ee();s_();ui();d_();Xd();l_();c_();f_()});var m_=_(()=>{});var eD,tD,nD,rD,iD,p_=_(()=>{m_();X();Ft();B();w();L();dn();ee();sa();yd();eD=Gi("LoggedIn"),tD=Gi("NotLoggedIn"),nD=Gi("BinaryMissing"),rD=Gi("ProbeFailed"),iD=new RegExp("[\\x00-\\x1f\\x7f-\\x9f]")});var __=_(()=>{p_()});var h_=_(()=>{sa()});var y_=_(()=>{"use strict"});var gD,bD,g_=_(()=>{"use strict";gD=64*1024,bD=16*1024});var b_=_(()=>{"use strict"});var S_=_(()=>{"use strict";Te()});var v_=_(()=>{"use strict";__();h_();Po();fn();Te();y_();po();g_();Od();Eo();b_();Hd();S_();el()});function k_(e){let t=e[Ca];if(t===void 0)return ik;let n=Number(t);if(t.trim()===""||!Number.isSafeInteger(n)||n<=0||n>T_)throw new Error(`${Ca} must be an integer number of milliseconds between 1 and ${T_}, got ${JSON.stringify(t)}`);return n}function x_(e){let t=e[wa];if(t===void 0)return rk;let n=Number(t);if(t.trim()===""||!Number.isSafeInteger(n)||n<=0)throw new Error(`${wa} must be a positive integer number of milliseconds, got ${JSON.stringify(t)}`);return n}var rk,wa,ik,Ca,T_,UL,BL,KL,A_=_(()=>{"use strict";Wa();so();yu();gu();Ps();Ps();Ro();Lc();Uc();Io();Kc();el();v_();pn();Te();Oo();Te();Zd();os();rs();rk=18e4,wa="LINZUMI_GUEST_MODEL_CALL_LIVENESS_MS",ik=15*6e4,Ca="LINZUMI_GUEST_ACTIVE_LOOP_BUDGET_MS",T_=2147483647;UL=64*1024,BL=360*60*1e3,KL=600*1e3});var J_={};rh(J_,{CloudTurnError:()=>we,DEFAULT_CLOUD_TURN_TIMEOUT_MS:()=>$_,cloudSupervisorConstsForTest:()=>pk,cloudTurnTimeoutMs:()=>F_,injectTurnSecrets:()=>D_,parseCloudTurnExitLineForTest:()=>mk,parsePreflightOutput:()=>N_,provisionAgentHome:()=>ck,runCloudTurn:()=>fk});import{existsSync as w_}from"node:fs";import{readFile as ok}from"node:fs/promises";import{dirname as ak,join as sk}from"node:path";import{fileURLToPath as dk}from"node:url";import{createHash as lk,randomUUID as uk}from"node:crypto";function F_(e=process.env){let t=e.LINZUMI_CLOUD_TURN_TIMEOUT_MS?.trim();if(t===void 0||t==="")return $_;let n=Number(t);if(!Number.isInteger(n)||n<=0)throw new Error("LINZUMI_CLOUD_TURN_TIMEOUT_MS must be a positive integer");return n}function C_(e,t){if(t!==void 0)return w_(t)?t:void 0;let n=sk(ak(dk(import.meta.url)),e);return w_(n)?n:void 0}function N_(e){let t=e.split(`
21
21
  `).map(i=>i.trim()),n=t.find(i=>i==="TOOLCHAIN_OK"||i==="TOOLCHAIN_MISSING");if(n===void 0)return;let r=i=>{let a=t.find(s=>s.startsWith(`${i} `))?.slice(i.length+1).trim();return a!==void 0&&/^[0-9a-f]{64}$/.test(a)?a:void 0};return{toolchainOk:n==="TOOLCHAIN_OK",supervisorSha256:r("BUNDLE_SUP"),mcpSha256:r("BUNDLE_MCP")}}async function ck(e,t){let n=C_("cloud-supervisor.mjs",t.cloudSupervisorBundlePath),r=C_("mcp-server.mjs",t.mcpServerBundlePath);if(n===void 0)throw new we("cloud agent turn requires dist/cloud-supervisor.mjs (run the CLI build); refusing to run without the guest supervisor bundle");if(r===void 0)throw new we("cloud agent turn requires dist/mcp-server.mjs (run the CLI build); refusing to run without the in-guest MCP bridge bundle");let i=await O_(n,"cloud-supervisor.mjs"),o=await O_(r,"mcp-server.mjs"),a=await e.exec(du(t.codexVersion),{timeout:tl}).catch(()=>{console.warn("cloud_agent_provision_preflight_unavailable",{reason:"transport_failure",codexVersion:t.codexVersion})}),s=a===void 0||a.exitCode!==0?void 0:N_(a.stdout),l=t.force===!0||s?.toolchainOk!==!0;if(l){let d=await e.exec(au(t.codexVersion),{timeout:R_});if(d.exitCode!==0)throw new we(`agent home provision failed (exit ${d.exitCode}): ${d.stderr.slice(0,400)}`);if((await e.exec(su(t.codexVersion),{timeout:tl})).exitCode!==0)throw new we("agent home provision completed but the toolchain check failed (codex/node/CA bundle missing)")}let u=d=>lk("sha256").update(d,"utf8").digest("hex");return(l||s?.supervisorSha256!==u(i))&&await e.writeFile(co,i,420),(l||s?.mcpSha256!==u(o))&&await e.writeFile(fo,o,420),{provisioned:l}}async function O_(e,t){let n;try{n=await ok(e,"utf8")}catch(r){throw new we(`could not read ${t} bundle at ${e}: ${r instanceof Error?r.message:String(r)}`)}if(n.trim()==="")throw new we(`${t} bundle at ${e} is empty`);return n}function D_(e){let t={[mo.mcpAuthFileContents]:e.mcpAuthFileContents};return e.llmProxyToken!==void 0&&e.llmProxyToken!==""&&(t[mo.llmProxyToken]=e.llmProxyToken),t}async function fk(e,t,n={}){if(t.sandbox!=="read-only")throw new we(`cloud turn must run under read-only, got ${JSON.stringify(t.sandbox)}`,!1);if(t.approvalPolicy!=="never")throw new we(`cloud turn must run approvalPolicy never, got ${JSON.stringify(t.approvalPolicy)}`,!1);let r;try{r=t.turnTimeoutMs??F_()}catch(G){throw new we(G instanceof Error?G.message:String(G),!1)}let i,o;try{i=x_(process.env),o=k_(process.env)}catch(G){throw new we(G instanceof Error?G.message:String(G),!1)}let a=uk(),s={codexVersion:t.codexVersion,input:t.input,...t.model===void 0?{}:{model:t.model},...t.reasoningEffort===void 0?{}:{reasoningEffort:t.reasoningEffort},sandbox:t.sandbox,approvalPolicy:t.approvalPolicy,...t.modelProvider===void 0?{}:{modelProvider:t.modelProvider},kandanUrl:t.kandanUrl,...t.threadId===void 0?{}:{threadId:t.threadId},...t.sourceSeq===void 0?{}:{sourceSeq:t.sourceSeq},...t.codexThreadId===void 0?{}:{codexThreadId:t.codexThreadId},...t.ownerUsername===void 0?{}:{ownerUsername:t.ownerUsername},cwd:t.cwd,appServerPort:iu,turnNonce:a},l=pu(s),u=D_(t);u[wa]=String(i),u[Ca]=String(o),await e.exec(es(),{timeout:Oa}).catch(()=>{});let d=!1,m=!1,p="no terminal exit line (stream ended without a result)",f=0,h,c=new Set,y=G=>{let k=JSON.stringify(G);c.has(k)||(c.add(k),n.log?.("guest_turn_failure_evidence",{...G,kandan_thread_id:t.threadId??null,source_seq:t.sourceSeq??null}))},b="",T=G=>{let k=_k(G);if(k!==void 0){y(k);return}let S=nl(G);S!==void 0&&(S.evidence!==void 0&&y(S.evidence),d=!0,m=S.ok,p=S.reason,f=S.turnMs);let E=hk(G);E!==void 0&&console.warn("[linzumi] cloud_turn.active_loop_budget_exceeded",JSON.stringify(E))},g=e.execStream(["node",co,l],{env:u,timeout:Math.ceil(r/1e3)+30})[Symbol.asyncIterator](),R=!1,M,W=new Promise((G,k)=>{M=setTimeout(()=>{R=!0,k(new we(`cloud_turn_timeout: guest turn still running after ${r}ms; aborting the exec stream and failing the turn (retryable)`))},r),M.unref?.()});W.catch(()=>{});let be=!1,A,q=0,$=new Promise((G,k)=>{let S=async()=>{if(be||d)return;let E;try{let x=(await e.exec(cu(a),{timeout:j_})).stdout;if(x.startsWith("EXIT")){let C=x.slice(x.indexOf(`
22
22
  `)+1),K=nl(C.split(`
23
23
  `)[0]??"");if(!be&&!d&&K!==void 0){K.evidence!==void 0&&y(K.evidence),d=!0,m=K.ok,p=K.reason,f=K.turnMs,R=!0,G({markerExit:!0});return}E=void 0}else if(x.startsWith("AGE")){let C=Number.parseInt(x.slice(3).trim(),10);E=Number.isFinite(C)&&C<=G_?"alive":"miss"}else x.startsWith("NONE")&&(E="miss")}catch{E=void 0}if(!(be||d)){if(E==="miss"){if(q+=1,q>=q_){R=!0,k(new we("cloud_turn_guest_vanished: no fresh guest heartbeat and no exit marker for this turn (half-open stream or dead guest); aborting and failing the turn (retryable)"));return}}else E==="alive"&&(q=0);A=setTimeout(()=>{S()},t.livenessPollMs??M_),A.unref?.()}};A=setTimeout(()=>{S()},t.livenessStartupGraceMs??I_),A.unref?.()});$.catch(()=>{});let Se=()=>{be=!0,A!==void 0&&clearTimeout(A)};try{for(;;){let G=await Promise.race([g.next(),W,$]);if("markerExit"in G){Promise.resolve(g.return?.(void 0)).catch(()=>{});break}if(G.done===!0)break;let k=G.value;switch(k.kind){case"stdout":{b+=k.data;let S;for(;(S=b.indexOf(`