@linzumi/cli 1.0.267 → 1.0.268
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/impl-res/cloud-supervisor.mjs +2 -2
- package/dist/impl-res/index.js +260 -257
- package/dist/impl-res/mcp-server.mjs +1 -1
- package/dist/impl-ts/cloud-supervisor.mjs +2 -2
- package/dist/impl-ts/index.js +5 -5
- package/dist/impl-ts/mcp-server.mjs +1 -1
- package/dist/mcp-server.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __linzumiBundleCreateRequire } from 'node:module';
|
|
2
2
|
const require = __linzumiBundleCreateRequire(import.meta.url);
|
|
3
3
|
var GF=Object.create;var Wm=Object.defineProperty;var zF=Object.getOwnPropertyDescriptor;var JF=Object.getOwnPropertyNames;var KF=Object.getPrototypeOf,BF=Object.prototype.hasOwnProperty;var We=(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 F=(e,t)=>()=>(e&&(t=e(e=0)),t);var tt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),WF=(e,t)=>{for(var n in t)Wm(e,n,{get:t[n],enumerable:!0})},HF=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of JF(t))!BF.call(e,r)&&r!==n&&Wm(e,r,{get:()=>t[r],enumerable:!(i=zF(t,r))||i.enumerable});return e};var oa=(e,t,n)=>(n=e!=null?GF(KF(e)):{},HF(t||!e||!e.__esModule?Wm(n,"default",{value:e,enumerable:!0}):n,e));var Hm=F(()=>{});function qt(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 Iu(e){if(e!=null)return qt(e)}function He(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 nt=F(()=>{});function aa(e,t){if(e!==void 0)return t(He(e))}function xt(e,t){if(e!==void 0)return qt(t(He(e)))}function Mn(e,t){if(e!==void 0)return t(He(e))}function Ve(e,t){return e!==void 0?He(e):t}var Ne=F(()=>{Hm();nt()});var Ou=F(()=>{});function sn(e,t,n){return e.reduce(n,t)}var At=F(()=>{Ou();nt()});function ri(e){if(e.RE_EXN_ID==="JsExn")return qt(e._1)}var Ru,ZF,Fr,jue,que,ii=F(()=>{nt();Ru=(e=>t=>t&&typeof t[e]=="string"?t[e]:void 0),ZF=Ru("stack"),Fr=Ru("message"),jue=Ru("name"),que=Ru("fileName")});var tk=tt((Nue,ek)=>{var Ci=We("constants"),QF=process.cwd,$u=null,YF=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return $u||($u=QF.call(process)),$u};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Zm=process.chdir,process.chdir=function(e){$u=null,Zm.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Zm));var Zm;ek.exports=XF;function XF(e){Ci.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=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=r(e.chmodSync),e.fchmodSync=r(e.fchmodSync),e.lchmodSync=r(e.lchmodSync),e.stat=s(e.stat),e.fstat=s(e.fstat),e.lstat=s(e.lstat),e.statSync=d(e.statSync),e.fstatSync=d(e.fstatSync),e.lstatSync=d(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(u,c,p){p&&process.nextTick(p)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(u,c,p,f){f&&process.nextTick(f)},e.lchownSync=function(){}),YF==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(u){function c(p,f,h){var g=Date.now(),_=0;u(p,f,function y(b){if(b&&(b.code==="EACCES"||b.code==="EPERM"||b.code==="EBUSY")&&Date.now()-g<6e4){setTimeout(function(){e.stat(f,function(v,w){v&&v.code==="ENOENT"?u(p,f,y):h(b)})},_),_<100&&(_+=10);return}h&&h(b)})}return Object.setPrototypeOf&&Object.setPrototypeOf(c,u),c})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(u){function c(p,f,h,g,_,y){var b;if(y&&typeof y=="function"){var v=0;b=function(w,A,C){if(w&&w.code==="EAGAIN"&&v<10)return v++,u.call(e,p,f,h,g,_,b);y.apply(this,arguments)}}return u.call(e,p,f,h,g,_,b)}return Object.setPrototypeOf&&Object.setPrototypeOf(c,u),c})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(u){return function(c,p,f,h,g){for(var _=0;;)try{return u.call(e,c,p,f,h,g)}catch(y){if(y.code==="EAGAIN"&&_<10){_++;continue}throw y}}})(e.readSync);function t(u){u.lchmod=function(c,p,f){u.open(c,Ci.O_WRONLY|Ci.O_SYMLINK,p,function(h,g){if(h){f&&f(h);return}u.fchmod(g,p,function(_){u.close(g,function(y){f&&f(_||y)})})})},u.lchmodSync=function(c,p){var f=u.openSync(c,Ci.O_WRONLY|Ci.O_SYMLINK,p),h=!0,g;try{g=u.fchmodSync(f,p),h=!1}finally{if(h)try{u.closeSync(f)}catch{}else u.closeSync(f)}return g}}function n(u){Ci.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(c,p,f,h){u.open(c,Ci.O_SYMLINK,function(g,_){if(g){h&&h(g);return}u.futimes(_,p,f,function(y){u.close(_,function(b){h&&h(y||b)})})})},u.lutimesSync=function(c,p,f){var h=u.openSync(c,Ci.O_SYMLINK),g,_=!0;try{g=u.futimesSync(h,p,f),_=!1}finally{if(_)try{u.closeSync(h)}catch{}else u.closeSync(h)}return g}):u.futimes&&(u.lutimes=function(c,p,f,h){h&&process.nextTick(h)},u.lutimesSync=function(){})}function i(u){return u&&function(c,p,f){return u.call(e,c,p,function(h){l(h)&&(h=null),f&&f.apply(this,arguments)})}}function r(u){return u&&function(c,p){try{return u.call(e,c,p)}catch(f){if(!l(f))throw f}}}function o(u){return u&&function(c,p,f,h){return u.call(e,c,p,f,function(g){l(g)&&(g=null),h&&h.apply(this,arguments)})}}function a(u){return u&&function(c,p,f){try{return u.call(e,c,p,f)}catch(h){if(!l(h))throw h}}}function s(u){return u&&function(c,p,f){typeof p=="function"&&(f=p,p=null);function h(g,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),f&&f.apply(this,arguments)}return p?u.call(e,c,p,h):u.call(e,c,h)}}function d(u){return u&&function(c,p){var f=p?u.call(e,c,p):u.call(e,c);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function l(u){if(!u||u.code==="ENOSYS")return!0;var c=!process.getuid||process.getuid()!==0;return!!(c&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var ik=tt((Fue,rk)=>{var nk=We("stream").Stream;rk.exports=eD;function eD(e){return{ReadStream:t,WriteStream:n};function t(i,r){if(!(this instanceof t))return new t(i,r);nk.call(this);var o=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,r=r||{};for(var a=Object.keys(r),s=0,d=a.length;s<d;s++){var l=a[s];this[l]=r[l]}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(u,c){if(u){o.emit("error",u),o.readable=!1;return}o.fd=c,o.emit("open",c),o._read()})}function n(i,r){if(!(this instanceof n))return new n(i,r);nk.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var o=Object.keys(r),a=0,s=o.length;a<s;a++){var d=o[a];this[d]=r[d]}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 ak=tt((Due,ok)=>{"use strict";ok.exports=nD;var tD=Object.getPrototypeOf||function(e){return e.__proto__};function nD(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:tD(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}});var eh=tt((Lue,Xm)=>{var St=We("fs"),rD=tk(),iD=ik(),oD=ak(),Mu=We("util"),Qt,qu;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Qt=Symbol.for("graceful-fs.queue"),qu=Symbol.for("graceful-fs.previous")):(Qt="___graceful-fs.queue",qu="___graceful-fs.previous");function aD(){}function lk(e,t){Object.defineProperty(e,Qt,{get:function(){return t}})}var ao=aD;Mu.debuglog?ao=Mu.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ao=function(){var e=Mu.format.apply(Mu,arguments);e="GFS4: "+e.split(/\n/).join(`
|
|
4
|
-
GFS4: `),console.error(e)});St[Qt]||(sk=global[Qt]||[],lk(St,sk),St.close=(function(e){function t(n,i){return e.call(St,n,function(r){r||dk(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,qu,{value:e}),t})(St.close),St.closeSync=(function(e){function t(n){e.apply(St,arguments),dk()}return Object.defineProperty(t,qu,{value:e}),t})(St.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ao(St[Qt]),We("assert").equal(St[Qt].length,0)}));var sk;global[Qt]||lk(global,St[Qt]);Xm.exports=Qm(oD(St));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!St.__patched&&(Xm.exports=Qm(St),St.__patched=!0);function Qm(e){rD(e),e.gracefulify=Qm,e.createReadStream=A,e.createWriteStream=C;var t=e.readFile;e.readFile=n;function n(T,E,P){return typeof E=="function"&&(P=E,E=null),R(T,E,P);function R(O,M,J,Z){return t(O,M,function(z){z&&(z.code==="EMFILE"||z.code==="ENFILE")?sa([R,[O,M,J],z,Z||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=r;function r(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return i(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=a);function a(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return o(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var s=e.copyFile;s&&(e.copyFile=d);function d(T,E,P,R){return typeof P=="function"&&(R=P,P=0),O(T,E,P,R);function O(M,J,Z,z,X){return s(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var l=e.readdir;e.readdir=c;var u=/^v[0-5]\./;function c(T,E,P){typeof E=="function"&&(P=E,E=null);var R=u.test(process.version)?function(J,Z,z,X){return l(J,O(J,Z,z,X))}:function(J,Z,z,X){return l(J,Z,O(J,Z,z,X))};return R(T,E,P);function O(M,J,Z,z){return function(X,ee){X&&(X.code==="EMFILE"||X.code==="ENFILE")?sa([R,[M,J,Z],X,z||Date.now(),Date.now()]):(ee&&ee.sort&&ee.sort(),typeof Z=="function"&&Z.call(this,X,ee))}}}if(process.version.substr(0,4)==="v0.8"){var p=iD(e);y=p.ReadStream,v=p.WriteStream}var f=e.ReadStream;f&&(y.prototype=Object.create(f.prototype),y.prototype.open=b);var h=e.WriteStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return y},set:function(T){y=T},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(T){v=T},enumerable:!0,configurable:!0});var g=y;Object.defineProperty(e,"FileReadStream",{get:function(){return g},set:function(T){g=T},enumerable:!0,configurable:!0});var _=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return _},set:function(T){_=T},enumerable:!0,configurable:!0});function y(T,E){return this instanceof y?(f.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function b(){var T=this;k(T.path,T.flags,T.mode,function(E,P){E?(T.autoClose&&T.destroy(),T.emit("error",E)):(T.fd=P,T.emit("open",P),T.read())})}function v(T,E){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function w(){var T=this;k(T.path,T.flags,T.mode,function(E,P){E?(T.destroy(),T.emit("error",E)):(T.fd=P,T.emit("open",P))})}function A(T,E){return new e.ReadStream(T,E)}function C(T,E){return new e.WriteStream(T,E)}var S=e.open;e.open=k;function k(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return S(M,J,Z,function(ee,B){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}return e}function sa(e){ao("ENQUEUE",e[0].name,e[1]),St[Qt].push(e),Ym()}var ju;function dk(){for(var e=Date.now(),t=0;t<St[Qt].length;++t)St[Qt][t].length>2&&(St[Qt][t][3]=e,St[Qt][t][4]=e);Ym()}function Ym(){if(clearTimeout(ju),ju=void 0,St[Qt].length!==0){var e=St[Qt].shift(),t=e[0],n=e[1],i=e[2],r=e[3],o=e[4];if(r===void 0)ao("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-r>=6e4){ao("TIMEOUT",t.name,n);var a=n.pop();typeof a=="function"&&a.call(null,i)}else{var s=Date.now()-o,d=Math.max(o-r,1),l=Math.min(d*1.2,100);s>=l?(ao("RETRY",t.name,n),t.apply(null,n.concat([r]))):St[Qt].push(e)}ju===void 0&&(ju=setTimeout(Ym,0))}}});var ck=tt((Uue,uk)=>{function Vn(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))}uk.exports=Vn;Vn.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Vn.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Vn.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 i=this,r=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n);return this._options.unref&&r.unref(),!0};Vn.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)};Vn.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};Vn.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};Vn.prototype.start=Vn.prototype.try;Vn.prototype.errors=function(){return this._errors};Vn.prototype.attempts=function(){return this._attempts};Vn.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,a=(e[o]||0)+1;e[o]=a,a>=n&&(t=r,n=a)}return t}});var fk=tt(so=>{var sD=ck();so.operation=function(e){var t=so.timeouts(e);return new sD(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};so.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 i=[],r=0;r<t.retries;r++)i.push(this.createTimeout(r,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(r,t)),i.sort(function(o,a){return o-a}),i};so.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout),i};so.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var i in e)typeof e[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],a=e[o];e[o]=function(d){var l=so.operation(t),u=Array.prototype.slice.call(arguments,1),c=u.pop();u.push(function(p){l.retry(p)||(p&&(arguments[0]=l.mainError()),c.apply(this,arguments))}),l.attempt(function(){d.apply(e,u)})}.bind(e,a),e[o].options=t}}});var mk=tt((zue,pk)=>{pk.exports=fk()});var hk=tt((Jue,Nu)=>{Nu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Nu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Nu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var vk=tt((Kue,ua)=>{var ft=global.process,lo=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"};lo(ft)?(gk=We("assert"),da=hk(),yk=/^win/i.test(ft.platform),Vs=We("events"),typeof Vs!="function"&&(Vs=Vs.EventEmitter),ft.__signal_exit_emitter__?zt=ft.__signal_exit_emitter__:(zt=ft.__signal_exit_emitter__=new Vs,zt.count=0,zt.emitted={}),zt.infinite||(zt.setMaxListeners(1/0),zt.infinite=!0),ua.exports=function(e,t){if(!lo(global.process))return function(){};gk.equal(typeof e,"function","a callback must be provided for exit handler"),la===!1&&th();var n="exit";t&&t.alwaysLast&&(n="afterexit");var i=function(){zt.removeListener(n,e),zt.listeners("exit").length===0&&zt.listeners("afterexit").length===0&&Fu()};return zt.on(n,e),i},Fu=function(){!la||!lo(global.process)||(la=!1,da.forEach(function(t){try{ft.removeListener(t,Du[t])}catch{}}),ft.emit=Lu,ft.reallyExit=nh,zt.count-=1)},ua.exports.unload=Fu,uo=function(t,n,i){zt.emitted[t]||(zt.emitted[t]=!0,zt.emit(t,n,i))},Du={},da.forEach(function(e){Du[e]=function(){if(lo(global.process)){var n=ft.listeners(e);n.length===zt.count&&(Fu(),uo("exit",null,e),uo("afterexit",null,e),yk&&e==="SIGHUP"&&(e="SIGINT"),ft.kill(ft.pid,e))}}}),ua.exports.signals=function(){return da},la=!1,th=function(){la||!lo(global.process)||(la=!0,zt.count+=1,da=da.filter(function(t){try{return ft.on(t,Du[t]),!0}catch{return!1}}),ft.emit=bk,ft.reallyExit=_k)},ua.exports.load=th,nh=ft.reallyExit,_k=function(t){lo(global.process)&&(ft.exitCode=t||0,uo("exit",ft.exitCode,null),uo("afterexit",ft.exitCode,null),nh.call(ft,ft.exitCode))},Lu=ft.emit,bk=function(t,n){if(t==="exit"&&lo(global.process)){n!==void 0&&(ft.exitCode=n);var i=Lu.apply(this,arguments);return uo("exit",ft.exitCode,null),uo("afterexit",ft.exitCode,null),i}else return Lu.apply(this,arguments)}):ua.exports=function(){return function(){}};var gk,da,yk,Vs,zt,Fu,uo,Du,la,th,nh,_k,Lu,bk});var Tk=tt((Bue,Zs)=>{"use strict";var dD=We("path"),oh=eh(),lD=mk(),uD=vk(),oi={};function ca(e,t){return t.lockfilePath||`${e}.lock`}function ah(e,t,n){if(!t.realpath)return n(null,dD.resolve(e));t.fs.realpath(e,n)}function rh(e,t,n){t.fs.mkdir(ca(e,t),i=>{if(!i)return n();if(i.code!=="EEXIST")return n(i);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));t.fs.stat(ca(e,t),(r,o)=>{if(r)return r.code==="ENOENT"?rh(e,{...t,stale:0},n):n(r);if(!wk(o,t))return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));kk(e,t,a=>{if(a)return n(a);rh(e,{...t,stale:0},n)})})})}function wk(e,t){return e.mtime.getTime()<Date.now()-t.stale}function kk(e,t,n){t.fs.rmdir(ca(e,t),i=>{if(i&&i.code!=="ENOENT")return n(i);n()})}function ih(e,t){let n=oi[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{let i=Date.now()/1e3;n.updateTimeout=null,t.fs.utimes(ca(e,t),i,i,r=>{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 Sk(e,n,o)}if(r)return r.code==="ENOENT"?Sk(e,n,Object.assign(r,{code:"ECOMPROMISED"})):(n.updateError=r,n.updateDelay=1e3,ih(e,t));n.lastUpdate=Date.now(),n.updateError=null,n.updateDelay=null,ih(e,t)}})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function Sk(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),oi[e]===t&&delete oi[e],t.options.onCompromised(n)}function cD(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:oh,onCompromised:i=>{throw i},...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),ah(e,t,(i,r)=>{if(i)return n(i);let o=lD.operation(t.retries);o.attempt(()=>{rh(r,t,a=>{if(o.retry(a))return;if(a)return n(o.mainError());let s=oi[r]={options:t,lastUpdate:Date.now()};ih(r,t),n(null,d=>{if(s.released)return d&&d(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));xk(r,{...t,realpath:!1},d)})})})})}function xk(e,t,n){t={fs:oh,realpath:!0,...t},ah(e,t,(i,r)=>{if(i)return n(i);let o=oi[r];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 oi[r],kk(r,t,n)})}function fD(e,t,n){t={stale:1e4,realpath:!0,fs:oh,...t},t.stale=Math.max(t.stale||0,2e3),ah(e,t,(i,r)=>{if(i)return n(i);t.fs.stat(ca(r,t),(o,a)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!wk(a,t)))})}function pD(){return oi}uD(()=>{for(let e in oi){let t=oi[e].options;try{t.fs.rmdirSync(ca(e,t))}catch{}}});Zs.exports.lock=cD;Zs.exports.unlock=xk;Zs.exports.check=fD;Zs.exports.getLocks=pD});var Ak=tt((Wue,Ck)=>{"use strict";var mD=eh();function hD(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(i=>{n[i]=(...r)=>{let o=r.pop(),a;try{a=e[`${i}Sync`](...r)}catch(s){return o(s)}o(null,a)}}),n}function gD(e){return(...t)=>new Promise((n,i)=>{t.push((r,o)=>{r?i(r):n(o)}),e(...t)})}function yD(e){return(...t)=>{let n,i;if(t.push((r,o)=>{n=r,i=o}),e(...t),n)throw n;return i}}function _D(e){if(e={...e},e.fs=hD(e.fs||mD),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}Ck.exports={toPromise:gD,toSync:yD,toSyncOptions:_D}});var Pk=tt((Hue,Ai)=>{"use strict";var fa=Tk(),{toPromise:Uu,toSync:Gu,toSyncOptions:sh}=Ak();async function Ek(e,t){let n=await Uu(fa.lock)(e,t);return Uu(n)}function bD(e,t){let n=Gu(fa.lock)(e,sh(t));return Gu(n)}function vD(e,t){return Uu(fa.unlock)(e,t)}function SD(e,t){return Gu(fa.unlock)(e,sh(t))}function wD(e,t){return Uu(fa.check)(e,t)}function kD(e,t){return Gu(fa.check)(e,sh(t))}Ai.exports=Ek;Ai.exports.lock=Ek;Ai.exports.unlock=vD;Ai.exports.lockSync=bD;Ai.exports.unlockSync=SD;Ai.exports.check=wD;Ai.exports.checkSync=kD});var Ik=F(()=>{});var Ok=F(()=>{});var zu=F(()=>{});var Yt=F(()=>{Ik();Ok();zu()});function CD(e){return e==null?!1:typeof e.RE_EXN_ID=="string"}function Jt(e){return CD(e)?e:{RE_EXN_ID:"JsExn",_1:e}}function uh(e){let t=lh[e];if(t!==void 0){let n=t+1|0;return lh[e]=n,e+("/"+n)}return lh[e]=1,e}var lh,Xt=F(()=>{lh={}});import*as $k from"node:child_process";function pa(e){let t=ri(e);if(t===void 0)return{code:void 0,message:"unknown error"};let n=He(t);return{code:Iu(n.code),message:Ve(Fr(n),"unknown error")}}function Mk(e,t,n,i){try{return{TAG:"Ok",_0:$k.execFileSync(e,t,{encoding:"utf8",timeout:n,maxBuffer:i})}}catch(r){let o=Jt(r);return{TAG:"Error",_0:pa(o)}}}var AD,Kt=F(()=>{ii();Ne();AD=oa(Pk(),1);Yt();nt();Xt()});function qk(e){let t=Mk(e,["--version"],1e4,1048576);if(t.TAG!=="Ok")return;let n=jk.exec(t._0);if(n!=null)return Mn(n.slice(1)[0],i=>i)}function Nk(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 jk,Fk=F(()=>{At();Kt();Ne();Yt();jk=new RegExp("(\\d+\\.\\d+\\.\\d+)")});function PD(e,t){let n=Nk(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 Dk(e,t){return PD(qk(e),t)}var Lk=F(()=>{Ne();Fk()});var Uk,ch=F(()=>{Lk();Uk=Dk});var zk,Gk=F(()=>{zk={name:"@linzumi/cli",version:"1.0.267",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:{"test:agent-source":"LINZUMI_CI_QUARANTINE=0 pnpm exec vitest run --config vitest.config.mjs test/channelSession.test.ts test/kandanQueue.test.ts test/llmProxySessionCredential.test.ts test/runnerBridge.test.ts test/threadCodexWorkerIpc.test.ts -t '(?:^| )(retains three busy accepted source snapshots without fusing or interrupting|keeps different accepted agent sources distinct through interrupt pickup|does not install an old mint after its credential is (replaced|stopped)|worker agent capability requires an exact true ready flag|starts an explicitly server-keyed OpenAI agent worker without local OpenAI credentials|applies the accepted OpenAI follow-up model on an existing worker|refuses explicit OpenAI worker creation with (passthrough|missing-token|blank-origin) binding|refuses a private agent turn without an owned relay before Codex|explicitly capable worker receives a private request through ordinary IPC|old worker receives no private agent source descriptor)$'",build:"rescript build ../linzumi-cli-rescript && node scripts/build.mjs","test:actual-commander-parity":"pnpm --dir ../linzumi-cli-rescript build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/ActualCommanderParityConformance.res.mjs","bump-version":"node scripts/bump-cli-version.mjs","codex:history-table":"node scripts/codex_history_table.mjs",test:"npm run test:startup && node --import tsx --test ../linzumi-cli-rescript/src/parity/McpToolCallBoundaryTest.res.mjs && rescript build ../../kandan/server_v2/web/replay_harness && vitest run --config vitest.config.mjs",typecheck:"rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.source.json","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",prepack:"rescript build -q ../linzumi-cli-rescript && node scripts/build.mjs","pack:dry-run":"npm pack --dry-run","record:agent-fixtures":"tsx scripts/record-agent-replay-fixtures.ts","normalize:agent-fixture":"tsx scripts/normalize-agent-replay-fixture.ts","vendor:codex-app-server-protocol":"tsx scripts/vendor-codex-app-server-protocol.ts","replay:agent-fixture":"tsx scripts/replay-agent-fixture.ts","replay:agent-backend":"tsx scripts/replay-agent-backend.ts","vendor:codex-app-server-protocol:check":"tsx scripts/vendor-codex-app-server-protocol.ts --check","replay:agent-backend-browser":"tsx scripts/replay-agent-backend-browser.ts","promote:gstack-claude-smoke-fixture":"tsx scripts/promote-gstack-claude-smoke-fixture.ts","diagnose:claude-probe":"tsx scripts/diagnose-claude-probe.ts","test:startup":"npm run build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/CommanderStartupRefusalConformance.res.mjs"},keywords:["linzumi","kandan","codex","local-runner"],license:"MIT",publishConfig:{access:"public"},dependencies:{"@anthropic-ai/claude-agent-sdk":"0.3.199","@inquirer/prompts":"^7.8.6","@modelcontextprotocol/sdk":"^1.29.0","@openai/codex":"0.153.2",blessed:"^0.1.81","proper-lockfile":"3.2.0",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 fh,Bu=F(()=>{"use strict";Gk();fh=zk.dependencies["@openai/codex"]});async function Jk(e,t,n){let i;try{e(),i=!0}catch{i=!1}let r;try{await t(),r=!0}catch{r=!1}return i&&r?{TAG:"Ok",_0:void 0}:(n("hosted_auth_quota_cleanup_failed reason=owned_process_not_confirmed_reaped"),{TAG:"Error",_0:"cleanup_failed"})}function Kk(e,t){let n=e.quotaWindow,i=e.credits;if(n===void 0&&i===void 0)return{status:"unavailable",reason:"empty_response"};let r=n!==void 0?[n.usedPercent,n.windowMinutes,n.resetsAtMs]:[void 0,void 0,void 0];return{status:"captured",quotaWindow:{usedPercent:r[0],windowMinutes:r[1],resetsAtMs:r[2],capturedAtMs:t,credits:i}}}var Bk=F(()=>{});var Wk,Hk,Vk=F(()=>{Bk();Wk=Jk,Hk=Kk});function Ke(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ph(e){let t=[["threadId",e.threadId],["turnId",e.turnId],["itemId",e.itemId],["processId",e.processId],["requestId",e.requestId]].filter(n=>n[1]!==void 0);return Object.fromEntries(t)}var Et=F(()=>{"use strict"});var Wu=F(()=>{"use strict";Et()});function Xk(e){let t=Dr(e.rateLimits)??Dr(e.rate_limits)??Dr(e.limits)??e,n=[t,...Object.values(t).flatMap(_=>{let y=Dr(_);return y===void 0?[]:[y]})],i=n.reduce((_,y)=>{let b=Fe(y.usedPercent)??Fe(y.used_percent);return b===void 0?_:_===void 0?b:Math.max(_,b)},void 0),o=n.some(_=>Fe(_.remaining)===0||Fe(_.remainingRequests)===0||Fe(_.remaining_requests)===0||Fe(_.remainingTokens)===0||Fe(_.remaining_tokens)===0||Fe(_.retryAfterSeconds)!==void 0||Fe(_.retry_after_seconds)!==void 0)?"rejected":i!==void 0&&i>=80?"allowed_warning":"allowed",a=Dr(t.primary),s=Fe(a?.usedPercent),d=Fe(a?.windowDurationMins),l=Fe(a?.resetsAt),u=Dr(t.credits),c=Yk(u?.hasCredits),p=Yk(u?.unlimited),f=u?.balance,h=c===void 0||p===void 0?void 0:{hasCredits:c,unlimited:p,balance:typeof f=="string"?f:null},g=s===void 0&&d===void 0&&l===void 0?void 0:{...s===void 0?{}:{usedPercent:s},...d===void 0?{}:{windowMinutes:d},...l===void 0?{}:{resetsAtMs:l*1e3}};return{summary:MD(e)??"seen (no details)",status:o,utilizationPercent:i,...g===void 0?{}:{quotaWindow:g},...h===void 0?{}:{credits:h}}}function MD(e){let t=Dr(e.rateLimits)??Dr(e.rate_limits)??Dr(e.limits)??e,n=Zk(t,void 0),i=Object.entries(t).flatMap(([o,a])=>{let s=Dr(a);return s===void 0?[]:[Zk(s,o)]}),r=[n,...i].filter(o=>o!==void 0);return r.length===0?void 0:r.join(" | ")}function Zk(e,t){let n=gr(e.limitName)??gr(e.limit_name)??gr(e.name)??gr(e.type)??t,i=gr(e.planType)??gr(e.plan_type)??gr(e.plan),r=Fe(e.remaining)??Fe(e.remainingRequests)??Fe(e.remaining_requests)??Fe(e.remainingTokens)??Fe(e.remaining_tokens),o=Fe(e.limit)??Fe(e.requestLimit)??Fe(e.request_limit)??Fe(e.limitRequests)??Fe(e.limit_requests)??Fe(e.tokenLimit)??Fe(e.token_limit)??Fe(e.limitTokens)??Fe(e.limit_tokens),a=gr(e.resetAt)??gr(e.reset_at)??gr(e.resetsAt)??gr(e.resets_at)??Qk(e.resetsAt)??Qk(e.resets_at)??Hu(e.resetAfterSeconds)??Hu(e.reset_after_seconds)??Hu(e.retryAfterSeconds)??Hu(e.retry_after_seconds),s=Fe(e.usedPercent)??Fe(e.used_percent),d=Fe(e.windowDurationMins)??Fe(e.window_duration_mins),l=[n,i].filter(f=>f!==void 0).join(" "),u=l===""?void 0:l,p=[r===void 0?void 0:o===void 0?`${r} remaining`:`${r}/${o} remaining`,s===void 0?void 0:`${s}% used`,d===void 0?void 0:`${d}m window`,a===void 0?void 0:`reset ${a}`].filter(f=>f!==void 0);return p.length===0?u===void 0?void 0:`${u} seen (no details)`:u===void 0?p.join(" "):`${u} ${p.join(" ")}`}function Hu(e){let t=Fe(e);return t===void 0?void 0:`${t}s`}function Qk(e){let t=Fe(e);return t===void 0?void 0:new Date(t*1e3).toISOString()}function Dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function gr(e){return typeof e=="string"&&e.trim()!==""?e:void 0}function Yk(e){return typeof e=="boolean"?e:void 0}function Fe(e){if(typeof e=="number"&&Number.isSafeInteger(e))return e;if(typeof e!="string")return;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t.toString()===e.trim()?t:void 0}var ex=F(()=>{"use strict";Wu();Et()});var ai=tt((fce,rx)=>{"use strict";var tx=["nodebuffer","arraybuffer","fragments"],nx=typeof Blob<"u";nx&&tx.push("blob");rx.exports={BINARY_TYPES:tx,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:nx,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Qs=tt((pce,Vu)=>{"use strict";var{EMPTY_BUFFER:jD}=ai(),mh=Buffer[Symbol.species];function qD(e,t){if(e.length===0)return jD;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),i=0;for(let r=0;r<e.length;r++){let o=e[r];n.set(o,i),i+=o.length}return i<t?new mh(n.buffer,n.byteOffset,i):n}function ix(e,t,n,i,r){for(let o=0;o<r;o++)n[i+o]=e[o]^t[o&3]}function ox(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function ND(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function hh(e){if(hh.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new mh(e):ArrayBuffer.isView(e)?t=new mh(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),hh.readOnly=!1),t}Vu.exports={concat:qD,mask:ix,toArrayBuffer:ND,toBuffer:hh,unmask:ox};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=We("bufferutil");Vu.exports.mask=function(t,n,i,r,o){o<48?ix(t,n,i,r,o):e.mask(t,n,i,r,o)},Vu.exports.unmask=function(t,n){t.length<32?ox(t,n):e.unmask(t,n)}}catch{}});var dx=tt((mce,sx)=>{"use strict";var ax=Symbol("kDone"),gh=Symbol("kRun"),yh=class{constructor(t){this[ax]=()=>{this.pending--,this[gh]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[gh]()}[gh](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[ax])}}};sx.exports=yh});var Xs=tt((hce,fx)=>{"use strict";var Ys=We("zlib"),lx=Qs(),FD=dx(),{kStatusCode:ux}=ai(),DD=Buffer[Symbol.species],LD=Buffer.from([0,0,255,255]),Qu=Symbol("permessage-deflate"),si=Symbol("total-length"),ha=Symbol("callback"),Ei=Symbol("buffers"),ga=Symbol("error"),Zu,_h=class{constructor(t,n,i){if(this._maxPayload=i|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,!Zu){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Zu=new FD(r)}}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[ha];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,i=t.find(r=>!(n.serverNoContextTakeover===!1&&r.server_no_context_takeover||r.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>r.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!r.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(i.server_no_context_takeover=!0),n.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(i.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?i.client_max_window_bits=n.clientMaxWindowBits:(i.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}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(i=>{let r=n[i];if(r.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(r=r[0],i==="client_max_window_bits"){if(r!==!0){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${i}": ${r}`);r=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${r}`)}else if(i==="server_max_window_bits"){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${i}": ${r}`);r=o}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(r!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${r}`)}else throw new Error(`Unknown parameter "${i}"`);n[i]=r})}),t}decompress(t,n,i){Zu.add(r=>{this._decompress(t,n,(o,a)=>{r(),i(o,a)})})}compress(t,n,i){Zu.add(r=>{this._compress(t,n,(o,a)=>{r(),i(o,a)})})}_decompress(t,n,i){let r=this._isServer?"client":"server";if(!this._inflate){let o=`${r}_max_window_bits`,a=typeof this.params[o]!="number"?Ys.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=Ys.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[Qu]=this,this._inflate[si]=0,this._inflate[Ei]=[],this._inflate.on("error",GD),this._inflate.on("data",cx)}this._inflate[ha]=i,this._inflate.write(t),n&&this._inflate.write(LD),this._inflate.flush(()=>{let o=this._inflate[ga];if(o){this._inflate.close(),this._inflate=null,i(o);return}let a=lx.concat(this._inflate[Ei],this._inflate[si]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[si]=0,this._inflate[Ei]=[],n&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),i(null,a)})}_compress(t,n,i){let r=this._isServer?"server":"client";if(!this._deflate){let o=`${r}_max_window_bits`,a=typeof this.params[o]!="number"?Ys.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=Ys.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[si]=0,this._deflate[Ei]=[],this._deflate.on("data",UD)}this._deflate[ha]=i,this._deflate.write(t),this._deflate.flush(Ys.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=lx.concat(this._deflate[Ei],this._deflate[si]);n&&(o=new DD(o.buffer,o.byteOffset,o.length-4)),this._deflate[ha]=null,this._deflate[si]=0,this._deflate[Ei]=[],n&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),i(null,o)})}};fx.exports=_h;function UD(e){this[Ei].push(e),this[si]+=e.length}function cx(e){if(this[si]+=e.length,this[Qu]._maxPayload<1||this[si]<=this[Qu]._maxPayload){this[Ei].push(e);return}this[ga]=new RangeError("Max payload size exceeded"),this[ga].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ga][ux]=1009,this.removeListener("data",cx),this.reset()}function GD(e){if(this[Qu]._inflate=null,this[ga]){this[ha](this[ga]);return}e[ux]=1007,this[ha](e)}});var ya=tt((gce,Yu)=>{"use strict";var{isUtf8:px}=We("buffer"),{hasBlob:zD}=ai(),JD=[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 KD(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function bh(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 BD(e){return zD&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Yu.exports={isBlob:BD,isValidStatusCode:KD,isValidUTF8:bh,tokenChars:JD};if(px)Yu.exports.isValidUTF8=function(e){return e.length<24?bh(e):px(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=We("utf-8-validate");Yu.exports.isValidUTF8=function(t){return t.length<32?bh(t):e(t)}}catch{}});var xh=tt((yce,vx)=>{"use strict";var{Writable:WD}=We("stream"),mx=Xs(),{BINARY_TYPES:HD,EMPTY_BUFFER:hx,kStatusCode:VD,kWebSocket:ZD}=ai(),{concat:vh,toArrayBuffer:QD,unmask:YD}=Qs(),{isValidStatusCode:XD,isValidUTF8:gx}=ya(),Xu=Buffer[Symbol.species],Zn=0,yx=1,_x=2,bx=3,Sh=4,wh=5,ec=6,kh=class extends WD{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||HD[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[ZD]=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=Zn}_write(t,n,i){if(this._opcode===8&&this._state==Zn)return i();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(i)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new Xu(i.buffer,i.byteOffset+t,i.length-t),new Xu(i.buffer,i.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let i=this._buffers[0],r=n.length-t;t>=i.length?n.set(this._buffers.shift(),r):(n.set(new Uint8Array(i.buffer,i.byteOffset,t),r),this._buffers[0]=new Xu(i.buffer,i.byteOffset+t,i.length-t)),t-=i.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case Zn:this.getInfo(t);break;case yx:this.getPayloadLength16(t);break;case _x:this.getPayloadLength64(t);break;case bx:this.getMask();break;case Sh:this.getData(t);break;case wh:case ec: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 r=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(r);return}let i=(n[0]&64)===64;if(i&&!this._extensions[mx.extensionName]){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(i){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(!this._fragmented){let r=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let r=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(r);return}if(i){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let r=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(r);return}}else{let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(n[1]&128)===128,this._isServer){if(!this._masked){let r=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(r);return}}else if(this._masked){let r=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(r);return}this._payloadLength===126?this._state=yx:this._payloadLength===127?this._state=_x: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),i=n.readUInt32BE(0);if(i>Math.pow(2,21)-1){let r=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(r);return}this._payloadLength=i*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=bx:this._state=Sh}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Sh}getData(t){let n=hx;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&&YD(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._compressed){this._state=wh,this.decompress(n,t);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(n)),this.dataMessage(t)}decompress(t,n){this._extensions[mx.extensionName].decompress(t,this._fin,(r,o)=>{if(r)return n(r);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===Zn&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=Zn;return}let n=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=vh(i,n):this._binaryType==="arraybuffer"?r=QD(vh(i,n)):this._binaryType==="blob"?r=new Blob(i):r=i,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=Zn):(this._state=ec,setImmediate(()=>{this.emit("message",r,!0),this._state=Zn,this.startLoop(t)}))}else{let r=vh(i,n);if(!this._skipUTF8Validation&&!gx(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(o);return}this._state===wh||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=Zn):(this._state=ec,setImmediate(()=>{this.emit("message",r,!1),this._state=Zn,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,hx),this.end();else{let i=t.readUInt16BE(0);if(!XD(i)){let o=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(o);return}let r=new Xu(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!gx(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(o);return}this._loop=!1,this.emit("conclude",i,r),this.end()}this._state=Zn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Zn):(this._state=ec,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Zn,this.startLoop(n)}))}createError(t,n,i,r,o){this._loop=!1,this._errored=!0;let a=new t(i?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(a,this.createError),a.code=o,a[VD]=r,a}};vx.exports=kh});var Ah=tt((bce,kx)=>{"use strict";var{Duplex:_ce}=We("stream"),{randomFillSync:eL}=We("crypto"),Sx=Xs(),{EMPTY_BUFFER:tL,kWebSocket:nL,NOOP:rL}=ai(),{isBlob:_a,isValidStatusCode:iL}=ya(),{mask:wx,toBuffer:co}=Qs(),Qn=Symbol("kByteLength"),oL=Buffer.alloc(4),tc=8*1024,fo,ba=tc,yr=0,aL=1,sL=2,Th=class e{constructor(t,n,i){this._extensions=n||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=yr,this.onerror=rL,this[nL]=void 0}static frame(t,n){let i,r=!1,o=2,a=!1;n.mask&&(i=n.maskBuffer||oL,n.generateMask?n.generateMask(i):(ba===tc&&(fo===void 0&&(fo=Buffer.alloc(tc)),eL(fo,0,tc),ba=0),i[0]=fo[ba++],i[1]=fo[ba++],i[2]=fo[ba++],i[3]=fo[ba++]),a=(i[0]|i[1]|i[2]|i[3])===0,o=6);let s;typeof t=="string"?(!n.mask||a)&&n[Qn]!==void 0?s=n[Qn]:(t=Buffer.from(t),s=t.length):(s=t.length,r=n.mask&&n.readOnly&&!a);let d=s;s>=65536?(o+=8,d=127):s>125&&(o+=2,d=126);let l=Buffer.allocUnsafe(r?s+o:o);return l[0]=n.fin?n.opcode|128:n.opcode,n.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(s,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),n.mask?(l[1]|=128,l[o-4]=i[0],l[o-3]=i[1],l[o-2]=i[2],l[o-1]=i[3],a?[l,t]:r?(wx(t,i,l,o,s),[l]):(wx(t,i,t,0,s),[l,t])):[l,t]}close(t,n,i,r){let o;if(t===void 0)o=tL;else{if(typeof t!="number"||!iL(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={[Qn]:o.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==yr?this.enqueue([this.dispatch,o,!1,a,r]):this.sendFrame(e.frame(o,a),r)}ping(t,n,i){let r,o;if(typeof t=="string"?(r=Buffer.byteLength(t),o=!1):_a(t)?(r=t.size,o=!1):(t=co(t),r=t.length,o=co.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Qn]:r,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,!1,a,i]):this.getBlobData(t,!1,a,i):this._state!==yr?this.enqueue([this.dispatch,t,!1,a,i]):this.sendFrame(e.frame(t,a),i)}pong(t,n,i){let r,o;if(typeof t=="string"?(r=Buffer.byteLength(t),o=!1):_a(t)?(r=t.size,o=!1):(t=co(t),r=t.length,o=co.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Qn]:r,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,!1,a,i]):this.getBlobData(t,!1,a,i):this._state!==yr?this.enqueue([this.dispatch,t,!1,a,i]):this.sendFrame(e.frame(t,a),i)}send(t,n,i){let r=this._extensions[Sx.extensionName],o=n.binary?2:1,a=n.compress,s,d;typeof t=="string"?(s=Buffer.byteLength(t),d=!1):_a(t)?(s=t.size,d=!1):(t=co(t),s=t.length,d=co.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=s>=r._threshold),this._compress=a):(a=!1,o=0),n.fin&&(this._firstFragment=!0);let l={[Qn]:s,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:d,rsv1:a};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,this._compress,l,i]):this.getBlobData(t,this._compress,l,i):this._state!==yr?this.enqueue([this.dispatch,t,this._compress,l,i]):this.dispatch(t,this._compress,l,i)}getBlobData(t,n,i,r){this._bufferedBytes+=i[Qn],this._state=sL,t.arrayBuffer().then(o=>{if(this._socket.destroyed){let s=new Error("The socket was closed while the blob was being read");process.nextTick(Ch,this,s,r);return}this._bufferedBytes-=i[Qn];let a=co(o);n?this.dispatch(a,n,i,r):(this._state=yr,this.sendFrame(e.frame(a,i),r),this.dequeue())}).catch(o=>{process.nextTick(dL,this,o,r)})}dispatch(t,n,i,r){if(!n){this.sendFrame(e.frame(t,i),r);return}let o=this._extensions[Sx.extensionName];this._bufferedBytes+=i[Qn],this._state=aL,o.compress(t,i.fin,(a,s)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");Ch(this,d,r);return}this._bufferedBytes-=i[Qn],this._state=yr,i.readOnly=!1,this.sendFrame(e.frame(s,i),r),this.dequeue()})}dequeue(){for(;this._state===yr&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Qn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Qn],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)}};kx.exports=Th;function Ch(e,t,n){typeof n=="function"&&n(t);for(let i=0;i<e._queue.length;i++){let r=e._queue[i],o=r[r.length-1];typeof o=="function"&&o(t)}}function dL(e,t,n){Ch(e,t,n),e.onerror(t)}});var Rx=tt((vce,Ox)=>{"use strict";var{kForOnEventAttribute:ed,kListener:Eh}=ai(),xx=Symbol("kCode"),Tx=Symbol("kData"),Cx=Symbol("kError"),Ax=Symbol("kMessage"),Ex=Symbol("kReason"),va=Symbol("kTarget"),Px=Symbol("kType"),Ix=Symbol("kWasClean"),di=class{constructor(t){this[va]=null,this[Px]=t}get target(){return this[va]}get type(){return this[Px]}};Object.defineProperty(di.prototype,"target",{enumerable:!0});Object.defineProperty(di.prototype,"type",{enumerable:!0});var po=class extends di{constructor(t,n={}){super(t),this[xx]=n.code===void 0?0:n.code,this[Ex]=n.reason===void 0?"":n.reason,this[Ix]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[xx]}get reason(){return this[Ex]}get wasClean(){return this[Ix]}};Object.defineProperty(po.prototype,"code",{enumerable:!0});Object.defineProperty(po.prototype,"reason",{enumerable:!0});Object.defineProperty(po.prototype,"wasClean",{enumerable:!0});var Sa=class extends di{constructor(t,n={}){super(t),this[Cx]=n.error===void 0?null:n.error,this[Ax]=n.message===void 0?"":n.message}get error(){return this[Cx]}get message(){return this[Ax]}};Object.defineProperty(Sa.prototype,"error",{enumerable:!0});Object.defineProperty(Sa.prototype,"message",{enumerable:!0});var td=class extends di{constructor(t,n={}){super(t),this[Tx]=n.data===void 0?null:n.data}get data(){return this[Tx]}};Object.defineProperty(td.prototype,"data",{enumerable:!0});var lL={addEventListener(e,t,n={}){for(let r of this.listeners(e))if(!n[ed]&&r[Eh]===t&&!r[ed])return;let i;if(e==="message")i=function(o,a){let s=new td("message",{data:a?o:o.toString()});s[va]=this,nc(t,this,s)};else if(e==="close")i=function(o,a){let s=new po("close",{code:o,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[va]=this,nc(t,this,s)};else if(e==="error")i=function(o){let a=new Sa("error",{error:o,message:o.message});a[va]=this,nc(t,this,a)};else if(e==="open")i=function(){let o=new di("open");o[va]=this,nc(t,this,o)};else return;i[ed]=!!n[ed],i[Eh]=t,n.once?this.once(e,i):this.on(e,i)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[Eh]===t&&!n[ed]){this.removeListener(e,n);break}}};Ox.exports={CloseEvent:po,ErrorEvent:Sa,Event:di,EventTarget:lL,MessageEvent:td};function nc(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}});var Ph=tt((Sce,$x)=>{"use strict";var{tokenChars:nd}=ya();function Lr(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function uL(e){let t=Object.create(null),n=Object.create(null),i=!1,r=!1,o=!1,a,s,d=-1,l=-1,u=-1,c=0;for(;c<e.length;c++)if(l=e.charCodeAt(c),a===void 0)if(u===-1&&nd[l]===1)d===-1&&(d=c);else if(c!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c);let f=e.slice(d,u);l===44?(Lr(t,f,n),n=Object.create(null)):a=f,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);else if(s===void 0)if(u===-1&&nd[l]===1)d===-1&&(d=c);else if(l===32||l===9)u===-1&&d!==-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c),Lr(n,e.slice(d,u),!0),l===44&&(Lr(t,a,n),n=Object.create(null),a=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)s=e.slice(d,c),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(r){if(nd[l]!==1)throw new SyntaxError(`Unexpected character at index ${c}`);d===-1?d=c:i||(i=!0),r=!1}else if(o)if(nd[l]===1)d===-1&&(d=c);else if(l===34&&d!==-1)o=!1,u=c;else if(l===92)r=!0;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(l===34&&e.charCodeAt(c-1)===61)o=!0;else if(u===-1&&nd[l]===1)d===-1&&(d=c);else if(d!==-1&&(l===32||l===9))u===-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c);let f=e.slice(d,u);i&&(f=f.replace(/\\/g,""),i=!1),Lr(n,s,f),l===44&&(Lr(t,a,n),n=Object.create(null),a=void 0),s=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);if(d===-1||o||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=c);let p=e.slice(d,u);return a===void 0?Lr(t,p,n):(s===void 0?Lr(n,p,!0):i?Lr(n,s,p.replace(/\\/g,"")):Lr(n,s,p),Lr(t,a,n)),t}function cL(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(i=>[t].concat(Object.keys(i).map(r=>{let o=i[r];return Array.isArray(o)||(o=[o]),o.map(a=>a===!0?r:`${r}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}$x.exports={format:cL,parse:uL}});var ac=tt((xce,Kx)=>{"use strict";var fL=We("events"),pL=We("https"),mL=We("http"),qx=We("net"),hL=We("tls"),{randomBytes:gL,createHash:yL}=We("crypto"),{Duplex:wce,Readable:kce}=We("stream"),{URL:Ih}=We("url"),Pi=Xs(),_L=xh(),bL=Ah(),{isBlob:vL}=ya(),{BINARY_TYPES:Mx,EMPTY_BUFFER:rc,GUID:SL,kForOnEventAttribute:Oh,kListener:wL,kStatusCode:kL,kWebSocket:Bt,NOOP:Nx}=ai(),{EventTarget:{addEventListener:xL,removeEventListener:TL}}=Rx(),{format:CL,parse:AL}=Ph(),{toBuffer:EL}=Qs(),PL=30*1e3,Fx=Symbol("kAborted"),Rh=[8,13],li=["CONNECTING","OPEN","CLOSING","CLOSED"],IL=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,pt=class e extends fL{constructor(t,n,i){super(),this._binaryType=Mx[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=rc,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?(i=n,n=[]):n=[n]),Dx(this,t,n,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Mx.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,i){let r=new _L({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation}),o=new bL(t,this._extensions,i.generateMask);this._receiver=r,this._sender=o,this._socket=t,r[Bt]=this,o[Bt]=this,t[Bt]=this,r.on("conclude",$L),r.on("drain",ML),r.on("error",jL),r.on("message",qL),r.on("ping",NL),r.on("pong",FL),o.onerror=DL,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",Gx),t.on("data",oc),t.on("end",zx),t.on("error",Jx),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[Pi.extensionName]&&this._extensions[Pi.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){qn(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,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Ux(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=n=void 0):typeof n=="function"&&(i=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){$h(this,t,i);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||rc,n,i)}pong(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=n=void 0):typeof n=="function"&&(i=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){$h(this,t,i);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||rc,n,i)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(i=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){$h(this,t,i);return}let r={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[Pi.extensionName]||(r.compress=!1),this._sender.send(t||rc,r,i)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){qn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(pt,"CONNECTING",{enumerable:!0,value:li.indexOf("CONNECTING")});Object.defineProperty(pt.prototype,"CONNECTING",{enumerable:!0,value:li.indexOf("CONNECTING")});Object.defineProperty(pt,"OPEN",{enumerable:!0,value:li.indexOf("OPEN")});Object.defineProperty(pt.prototype,"OPEN",{enumerable:!0,value:li.indexOf("OPEN")});Object.defineProperty(pt,"CLOSING",{enumerable:!0,value:li.indexOf("CLOSING")});Object.defineProperty(pt.prototype,"CLOSING",{enumerable:!0,value:li.indexOf("CLOSING")});Object.defineProperty(pt,"CLOSED",{enumerable:!0,value:li.indexOf("CLOSED")});Object.defineProperty(pt.prototype,"CLOSED",{enumerable:!0,value:li.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(pt.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(pt.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[Oh])return t[wL];return null},set(t){for(let n of this.listeners(e))if(n[Oh]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[Oh]:!0})}})});pt.prototype.addEventListener=xL;pt.prototype.removeEventListener=TL;Kx.exports=pt;function Dx(e,t,n,i){let r={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Rh[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,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=r.autoPong,!Rh.includes(r.protocolVersion))throw new RangeError(`Unsupported protocol version: ${r.protocolVersion} (supported versions: ${Rh.join(", ")})`);let o;if(t instanceof Ih)o=t;else try{o=new Ih(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:",d;if(o.protocol!=="ws:"&&!a&&!s?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:s&&!o.pathname?d="The URL's pathname is empty":o.hash&&(d="The URL contains a fragment identifier"),d){let g=new SyntaxError(d);if(e._redirects===0)throw g;ic(e,g);return}let l=a?443:80,u=gL(16).toString("base64"),c=a?pL.request:mL.request,p=new Set,f;if(r.createConnection=r.createConnection||(a?RL:OL),r.defaultPort=r.defaultPort||l,r.port=o.port||l,r.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,r.headers={...r.headers,"Sec-WebSocket-Version":r.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},r.path=o.pathname+o.search,r.timeout=r.handshakeTimeout,r.perMessageDeflate&&(f=new Pi(r.perMessageDeflate!==!0?r.perMessageDeflate:{},!1,r.maxPayload),r.headers["Sec-WebSocket-Extensions"]=CL({[Pi.extensionName]:f.offer()})),n.length){for(let g of n){if(typeof g!="string"||!IL.test(g)||p.has(g))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(g)}r.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(r.origin&&(r.protocolVersion<13?r.headers["Sec-WebSocket-Origin"]=r.origin:r.headers.Origin=r.origin),(o.username||o.password)&&(r.auth=`${o.username}:${o.password}`),s){let g=r.path.split(":");r.socketPath=g[0],r.path=g[1]}let h;if(r.followRedirects){if(e._redirects===0){e._originalIpc=s,e._originalSecure=a,e._originalHostOrSocketPath=s?r.socketPath:o.host;let g=i&&i.headers;if(i={...i,headers:{}},g)for(let[_,y]of Object.entries(g))i.headers[_.toLowerCase()]=y}else if(e.listenerCount("redirect")===0){let g=s?e._originalIpc?r.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:o.host===e._originalHostOrSocketPath;(!g||e._originalSecure&&!a)&&(delete r.headers.authorization,delete r.headers.cookie,g||delete r.headers.host,r.auth=void 0)}r.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(r.auth).toString("base64")),h=e._req=c(r),e._redirects&&e.emit("redirect",e.url,h)}else h=e._req=c(r);r.timeout&&h.on("timeout",()=>{qn(e,h,"Opening handshake has timed out")}),h.on("error",g=>{h===null||h[Fx]||(h=e._req=null,ic(e,g))}),h.on("response",g=>{let _=g.headers.location,y=g.statusCode;if(_&&r.followRedirects&&y>=300&&y<400){if(++e._redirects>r.maxRedirects){qn(e,h,"Maximum redirects exceeded");return}h.abort();let b;try{b=new Ih(_,t)}catch{let w=new SyntaxError(`Invalid URL: ${_}`);ic(e,w);return}Dx(e,b,n,i)}else e.emit("unexpected-response",h,g)||qn(e,h,`Unexpected server response: ${g.statusCode}`)}),h.on("upgrade",(g,_,y)=>{if(e.emit("upgrade",g),e.readyState!==pt.CONNECTING)return;h=e._req=null;let b=g.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){qn(e,_,"Invalid Upgrade header");return}let v=yL("sha1").update(u+SL).digest("base64");if(g.headers["sec-websocket-accept"]!==v){qn(e,_,"Invalid Sec-WebSocket-Accept header");return}let w=g.headers["sec-websocket-protocol"],A;if(w!==void 0?p.size?p.has(w)||(A="Server sent an invalid subprotocol"):A="Server sent a subprotocol but none was requested":p.size&&(A="Server sent no subprotocol"),A){qn(e,_,A);return}w&&(e._protocol=w);let C=g.headers["sec-websocket-extensions"];if(C!==void 0){if(!f){qn(e,_,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let S;try{S=AL(C)}catch{qn(e,_,"Invalid Sec-WebSocket-Extensions header");return}let k=Object.keys(S);if(k.length!==1||k[0]!==Pi.extensionName){qn(e,_,"Server indicated an extension that was not requested");return}try{f.accept(S[Pi.extensionName])}catch{qn(e,_,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Pi.extensionName]=f}e.setSocket(_,y,{allowSynchronousEvents:r.allowSynchronousEvents,generateMask:r.generateMask,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation})}),r.finishRequest?r.finishRequest(h,e):h.end()}function ic(e,t){e._readyState=pt.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function OL(e){return e.path=e.socketPath,qx.connect(e)}function RL(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=qx.isIP(e.host)?"":e.host),hL.connect(e)}function qn(e,t,n){e._readyState=pt.CLOSING;let i=new Error(n);Error.captureStackTrace(i,qn),t.setHeader?(t[Fx]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(ic,e,i)):(t.destroy(i),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function $h(e,t,n){if(t){let i=vL(t)?t.size:EL(t).length;e._socket?e._sender._bufferedBytes+=i:e._bufferedAmount+=i}if(n){let i=new Error(`WebSocket is not open: readyState ${e.readyState} (${li[e.readyState]})`);process.nextTick(n,i)}}function $L(e,t){let n=this[Bt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[Bt]!==void 0&&(n._socket.removeListener("data",oc),process.nextTick(Lx,n._socket),e===1005?n.close():n.close(e,t))}function ML(){let e=this[Bt];e.isPaused||e._socket.resume()}function jL(e){let t=this[Bt];t._socket[Bt]!==void 0&&(t._socket.removeListener("data",oc),process.nextTick(Lx,t._socket),t.close(e[kL])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function jx(){this[Bt].emitClose()}function qL(e,t){this[Bt].emit("message",e,t)}function NL(e){let t=this[Bt];t._autoPong&&t.pong(e,!this._isServer,Nx),t.emit("ping",e)}function FL(e){this[Bt].emit("pong",e)}function Lx(e){e.resume()}function DL(e){let t=this[Bt];t.readyState!==pt.CLOSED&&(t.readyState===pt.OPEN&&(t._readyState=pt.CLOSING,Ux(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function Ux(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),PL)}function Gx(){let e=this[Bt];this.removeListener("close",Gx),this.removeListener("data",oc),this.removeListener("end",zx),e._readyState=pt.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[Bt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",jx),e._receiver.on("finish",jx))}function oc(e){this[Bt]._receiver.write(e)||this.pause()}function zx(){let e=this[Bt];e._readyState=pt.CLOSING,e._receiver.end(),this.end()}function Jx(){let e=this[Bt];this.removeListener("error",Jx),this.on("error",Nx),e&&(e._readyState=pt.CLOSING,this.destroy())}});var Vx=tt((Cce,Hx)=>{"use strict";var Tce=ac(),{Duplex:LL}=We("stream");function Bx(e){e.emit("close")}function UL(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Wx(e){this.removeListener("error",Wx),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function GL(e,t){let n=!0,i=new LL({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(o,a){let s=!a&&i._readableState.objectMode?o.toString():o;i.push(s)||e.pause()}),e.once("error",function(o){i.destroyed||(n=!1,i.destroy(o))}),e.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(r,o){if(e.readyState===e.CLOSED){o(r),process.nextTick(Bx,i);return}let a=!1;e.once("error",function(d){a=!0,o(d)}),e.once("close",function(){a||o(r),process.nextTick(Bx,i)}),n&&e.terminate()},i._final=function(r){if(e.readyState===e.CONNECTING){e.once("open",function(){i._final(r)});return}e._socket!==null&&(e._socket._writableState.finished?(r(),i._readableState.endEmitted&&i.destroy()):(e._socket.once("finish",function(){r()}),e.close()))},i._read=function(){e.isPaused&&e.resume()},i._write=function(r,o,a){if(e.readyState===e.CONNECTING){e.once("open",function(){i._write(r,o,a)});return}e.send(r,a)},i.on("end",UL),i.on("error",Wx),i}Hx.exports=GL});var Qx=tt((Ace,Zx)=>{"use strict";var{tokenChars:zL}=ya();function JL(e){let t=new Set,n=-1,i=-1,r=0;for(r;r<e.length;r++){let a=e.charCodeAt(r);if(i===-1&&zL[a]===1)n===-1&&(n=r);else if(r!==0&&(a===32||a===9))i===-1&&n!==-1&&(i=r);else if(a===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${r}`);i===-1&&(i=r);let s=e.slice(n,i);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);t.add(s),n=i=-1}else throw new SyntaxError(`Unexpected character at index ${r}`)}if(n===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let o=e.slice(n,r);if(t.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}Zx.exports={parse:JL}});var i0=tt((Pce,r0)=>{"use strict";var KL=We("events"),sc=We("http"),{Duplex:Ece}=We("stream"),{createHash:BL}=We("crypto"),Yx=Ph(),mo=Xs(),WL=Qx(),HL=ac(),{GUID:VL,kWebSocket:ZL}=ai(),QL=/^[+/0-9A-Za-z]{22}==$/,Xx=0,e0=1,n0=2,Mh=class extends KL{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:HL,...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=sc.createServer((i,r)=>{let o=sc.STATUS_CODES[426];r.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),r.end(o)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=YL(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(r,o,a)=>{this.handleUpgrade(r,o,a,i)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Xx}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===n0){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(rd,this);return}if(t&&this.once("close",t),this._state!==e0)if(this._state=e0,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(rd,this):process.nextTick(rd,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{rd(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,i,r){n.on("error",t0);let o=t.headers["sec-websocket-key"],a=t.headers.upgrade,s=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ho(this,t,n,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){ho(this,t,n,400,"Invalid Upgrade header");return}if(o===void 0||!QL.test(o)){ho(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(s!==13&&s!==8){ho(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){id(n,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=WL.parse(d)}catch{ho(this,t,n,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&u!==void 0){let p=new mo(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let f=Yx.parse(u);f[mo.extensionName]&&(p.accept(f[mo.extensionName]),c[mo.extensionName]=p)}catch{ho(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,g,_)=>{if(!f)return id(n,h||401,g,_);this.completeUpgrade(c,o,l,t,n,i,r)});return}if(!this.options.verifyClient(p))return id(n,401)}this.completeUpgrade(c,o,l,t,n,i,r)}completeUpgrade(t,n,i,r,o,a,s){if(!o.readable||!o.writable)return o.destroy();if(o[ZL])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Xx)return id(o,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${BL("sha1").update(n+VL).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(i.size){let c=this.options.handleProtocols?this.options.handleProtocols(i,r):i.values().next().value;c&&(l.push(`Sec-WebSocket-Protocol: ${c}`),u._protocol=c)}if(t[mo.extensionName]){let c=t[mo.extensionName].params,p=Yx.format({[mo.extensionName]:[c]});l.push(`Sec-WebSocket-Extensions: ${p}`),u._extensions=t}this.emit("headers",l,r),o.write(l.concat(`\r
|
|
4
|
+
GFS4: `),console.error(e)});St[Qt]||(sk=global[Qt]||[],lk(St,sk),St.close=(function(e){function t(n,i){return e.call(St,n,function(r){r||dk(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,qu,{value:e}),t})(St.close),St.closeSync=(function(e){function t(n){e.apply(St,arguments),dk()}return Object.defineProperty(t,qu,{value:e}),t})(St.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ao(St[Qt]),We("assert").equal(St[Qt].length,0)}));var sk;global[Qt]||lk(global,St[Qt]);Xm.exports=Qm(oD(St));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!St.__patched&&(Xm.exports=Qm(St),St.__patched=!0);function Qm(e){rD(e),e.gracefulify=Qm,e.createReadStream=A,e.createWriteStream=C;var t=e.readFile;e.readFile=n;function n(T,E,P){return typeof E=="function"&&(P=E,E=null),R(T,E,P);function R(O,M,J,Z){return t(O,M,function(z){z&&(z.code==="EMFILE"||z.code==="ENFILE")?sa([R,[O,M,J],z,Z||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=r;function r(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return i(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=a);function a(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return o(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var s=e.copyFile;s&&(e.copyFile=d);function d(T,E,P,R){return typeof P=="function"&&(R=P,P=0),O(T,E,P,R);function O(M,J,Z,z,X){return s(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var l=e.readdir;e.readdir=c;var u=/^v[0-5]\./;function c(T,E,P){typeof E=="function"&&(P=E,E=null);var R=u.test(process.version)?function(J,Z,z,X){return l(J,O(J,Z,z,X))}:function(J,Z,z,X){return l(J,Z,O(J,Z,z,X))};return R(T,E,P);function O(M,J,Z,z){return function(X,ee){X&&(X.code==="EMFILE"||X.code==="ENFILE")?sa([R,[M,J,Z],X,z||Date.now(),Date.now()]):(ee&&ee.sort&&ee.sort(),typeof Z=="function"&&Z.call(this,X,ee))}}}if(process.version.substr(0,4)==="v0.8"){var p=iD(e);y=p.ReadStream,v=p.WriteStream}var f=e.ReadStream;f&&(y.prototype=Object.create(f.prototype),y.prototype.open=b);var h=e.WriteStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return y},set:function(T){y=T},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(T){v=T},enumerable:!0,configurable:!0});var g=y;Object.defineProperty(e,"FileReadStream",{get:function(){return g},set:function(T){g=T},enumerable:!0,configurable:!0});var _=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return _},set:function(T){_=T},enumerable:!0,configurable:!0});function y(T,E){return this instanceof y?(f.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function b(){var T=this;k(T.path,T.flags,T.mode,function(E,P){E?(T.autoClose&&T.destroy(),T.emit("error",E)):(T.fd=P,T.emit("open",P),T.read())})}function v(T,E){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function w(){var T=this;k(T.path,T.flags,T.mode,function(E,P){E?(T.destroy(),T.emit("error",E)):(T.fd=P,T.emit("open",P))})}function A(T,E){return new e.ReadStream(T,E)}function C(T,E){return new e.WriteStream(T,E)}var S=e.open;e.open=k;function k(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return S(M,J,Z,function(ee,B){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}return e}function sa(e){ao("ENQUEUE",e[0].name,e[1]),St[Qt].push(e),Ym()}var ju;function dk(){for(var e=Date.now(),t=0;t<St[Qt].length;++t)St[Qt][t].length>2&&(St[Qt][t][3]=e,St[Qt][t][4]=e);Ym()}function Ym(){if(clearTimeout(ju),ju=void 0,St[Qt].length!==0){var e=St[Qt].shift(),t=e[0],n=e[1],i=e[2],r=e[3],o=e[4];if(r===void 0)ao("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-r>=6e4){ao("TIMEOUT",t.name,n);var a=n.pop();typeof a=="function"&&a.call(null,i)}else{var s=Date.now()-o,d=Math.max(o-r,1),l=Math.min(d*1.2,100);s>=l?(ao("RETRY",t.name,n),t.apply(null,n.concat([r]))):St[Qt].push(e)}ju===void 0&&(ju=setTimeout(Ym,0))}}});var ck=tt((Uue,uk)=>{function Vn(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))}uk.exports=Vn;Vn.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Vn.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Vn.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 i=this,r=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n);return this._options.unref&&r.unref(),!0};Vn.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)};Vn.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};Vn.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};Vn.prototype.start=Vn.prototype.try;Vn.prototype.errors=function(){return this._errors};Vn.prototype.attempts=function(){return this._attempts};Vn.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,a=(e[o]||0)+1;e[o]=a,a>=n&&(t=r,n=a)}return t}});var fk=tt(so=>{var sD=ck();so.operation=function(e){var t=so.timeouts(e);return new sD(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};so.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 i=[],r=0;r<t.retries;r++)i.push(this.createTimeout(r,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(r,t)),i.sort(function(o,a){return o-a}),i};so.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout),i};so.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var i in e)typeof e[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],a=e[o];e[o]=function(d){var l=so.operation(t),u=Array.prototype.slice.call(arguments,1),c=u.pop();u.push(function(p){l.retry(p)||(p&&(arguments[0]=l.mainError()),c.apply(this,arguments))}),l.attempt(function(){d.apply(e,u)})}.bind(e,a),e[o].options=t}}});var mk=tt((zue,pk)=>{pk.exports=fk()});var hk=tt((Jue,Nu)=>{Nu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Nu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Nu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var vk=tt((Kue,ua)=>{var ft=global.process,lo=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"};lo(ft)?(gk=We("assert"),da=hk(),yk=/^win/i.test(ft.platform),Vs=We("events"),typeof Vs!="function"&&(Vs=Vs.EventEmitter),ft.__signal_exit_emitter__?zt=ft.__signal_exit_emitter__:(zt=ft.__signal_exit_emitter__=new Vs,zt.count=0,zt.emitted={}),zt.infinite||(zt.setMaxListeners(1/0),zt.infinite=!0),ua.exports=function(e,t){if(!lo(global.process))return function(){};gk.equal(typeof e,"function","a callback must be provided for exit handler"),la===!1&&th();var n="exit";t&&t.alwaysLast&&(n="afterexit");var i=function(){zt.removeListener(n,e),zt.listeners("exit").length===0&&zt.listeners("afterexit").length===0&&Fu()};return zt.on(n,e),i},Fu=function(){!la||!lo(global.process)||(la=!1,da.forEach(function(t){try{ft.removeListener(t,Du[t])}catch{}}),ft.emit=Lu,ft.reallyExit=nh,zt.count-=1)},ua.exports.unload=Fu,uo=function(t,n,i){zt.emitted[t]||(zt.emitted[t]=!0,zt.emit(t,n,i))},Du={},da.forEach(function(e){Du[e]=function(){if(lo(global.process)){var n=ft.listeners(e);n.length===zt.count&&(Fu(),uo("exit",null,e),uo("afterexit",null,e),yk&&e==="SIGHUP"&&(e="SIGINT"),ft.kill(ft.pid,e))}}}),ua.exports.signals=function(){return da},la=!1,th=function(){la||!lo(global.process)||(la=!0,zt.count+=1,da=da.filter(function(t){try{return ft.on(t,Du[t]),!0}catch{return!1}}),ft.emit=bk,ft.reallyExit=_k)},ua.exports.load=th,nh=ft.reallyExit,_k=function(t){lo(global.process)&&(ft.exitCode=t||0,uo("exit",ft.exitCode,null),uo("afterexit",ft.exitCode,null),nh.call(ft,ft.exitCode))},Lu=ft.emit,bk=function(t,n){if(t==="exit"&&lo(global.process)){n!==void 0&&(ft.exitCode=n);var i=Lu.apply(this,arguments);return uo("exit",ft.exitCode,null),uo("afterexit",ft.exitCode,null),i}else return Lu.apply(this,arguments)}):ua.exports=function(){return function(){}};var gk,da,yk,Vs,zt,Fu,uo,Du,la,th,nh,_k,Lu,bk});var Tk=tt((Bue,Zs)=>{"use strict";var dD=We("path"),oh=eh(),lD=mk(),uD=vk(),oi={};function ca(e,t){return t.lockfilePath||`${e}.lock`}function ah(e,t,n){if(!t.realpath)return n(null,dD.resolve(e));t.fs.realpath(e,n)}function rh(e,t,n){t.fs.mkdir(ca(e,t),i=>{if(!i)return n();if(i.code!=="EEXIST")return n(i);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));t.fs.stat(ca(e,t),(r,o)=>{if(r)return r.code==="ENOENT"?rh(e,{...t,stale:0},n):n(r);if(!wk(o,t))return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));kk(e,t,a=>{if(a)return n(a);rh(e,{...t,stale:0},n)})})})}function wk(e,t){return e.mtime.getTime()<Date.now()-t.stale}function kk(e,t,n){t.fs.rmdir(ca(e,t),i=>{if(i&&i.code!=="ENOENT")return n(i);n()})}function ih(e,t){let n=oi[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{let i=Date.now()/1e3;n.updateTimeout=null,t.fs.utimes(ca(e,t),i,i,r=>{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 Sk(e,n,o)}if(r)return r.code==="ENOENT"?Sk(e,n,Object.assign(r,{code:"ECOMPROMISED"})):(n.updateError=r,n.updateDelay=1e3,ih(e,t));n.lastUpdate=Date.now(),n.updateError=null,n.updateDelay=null,ih(e,t)}})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function Sk(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),oi[e]===t&&delete oi[e],t.options.onCompromised(n)}function cD(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:oh,onCompromised:i=>{throw i},...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),ah(e,t,(i,r)=>{if(i)return n(i);let o=lD.operation(t.retries);o.attempt(()=>{rh(r,t,a=>{if(o.retry(a))return;if(a)return n(o.mainError());let s=oi[r]={options:t,lastUpdate:Date.now()};ih(r,t),n(null,d=>{if(s.released)return d&&d(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));xk(r,{...t,realpath:!1},d)})})})})}function xk(e,t,n){t={fs:oh,realpath:!0,...t},ah(e,t,(i,r)=>{if(i)return n(i);let o=oi[r];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 oi[r],kk(r,t,n)})}function fD(e,t,n){t={stale:1e4,realpath:!0,fs:oh,...t},t.stale=Math.max(t.stale||0,2e3),ah(e,t,(i,r)=>{if(i)return n(i);t.fs.stat(ca(r,t),(o,a)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!wk(a,t)))})}function pD(){return oi}uD(()=>{for(let e in oi){let t=oi[e].options;try{t.fs.rmdirSync(ca(e,t))}catch{}}});Zs.exports.lock=cD;Zs.exports.unlock=xk;Zs.exports.check=fD;Zs.exports.getLocks=pD});var Ak=tt((Wue,Ck)=>{"use strict";var mD=eh();function hD(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(i=>{n[i]=(...r)=>{let o=r.pop(),a;try{a=e[`${i}Sync`](...r)}catch(s){return o(s)}o(null,a)}}),n}function gD(e){return(...t)=>new Promise((n,i)=>{t.push((r,o)=>{r?i(r):n(o)}),e(...t)})}function yD(e){return(...t)=>{let n,i;if(t.push((r,o)=>{n=r,i=o}),e(...t),n)throw n;return i}}function _D(e){if(e={...e},e.fs=hD(e.fs||mD),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}Ck.exports={toPromise:gD,toSync:yD,toSyncOptions:_D}});var Pk=tt((Hue,Ai)=>{"use strict";var fa=Tk(),{toPromise:Uu,toSync:Gu,toSyncOptions:sh}=Ak();async function Ek(e,t){let n=await Uu(fa.lock)(e,t);return Uu(n)}function bD(e,t){let n=Gu(fa.lock)(e,sh(t));return Gu(n)}function vD(e,t){return Uu(fa.unlock)(e,t)}function SD(e,t){return Gu(fa.unlock)(e,sh(t))}function wD(e,t){return Uu(fa.check)(e,t)}function kD(e,t){return Gu(fa.check)(e,sh(t))}Ai.exports=Ek;Ai.exports.lock=Ek;Ai.exports.unlock=vD;Ai.exports.lockSync=bD;Ai.exports.unlockSync=SD;Ai.exports.check=wD;Ai.exports.checkSync=kD});var Ik=F(()=>{});var Ok=F(()=>{});var zu=F(()=>{});var Yt=F(()=>{Ik();Ok();zu()});function CD(e){return e==null?!1:typeof e.RE_EXN_ID=="string"}function Jt(e){return CD(e)?e:{RE_EXN_ID:"JsExn",_1:e}}function uh(e){let t=lh[e];if(t!==void 0){let n=t+1|0;return lh[e]=n,e+("/"+n)}return lh[e]=1,e}var lh,Xt=F(()=>{lh={}});import*as $k from"node:child_process";function pa(e){let t=ri(e);if(t===void 0)return{code:void 0,message:"unknown error"};let n=He(t);return{code:Iu(n.code),message:Ve(Fr(n),"unknown error")}}function Mk(e,t,n,i){try{return{TAG:"Ok",_0:$k.execFileSync(e,t,{encoding:"utf8",timeout:n,maxBuffer:i})}}catch(r){let o=Jt(r);return{TAG:"Error",_0:pa(o)}}}var AD,Kt=F(()=>{ii();Ne();AD=oa(Pk(),1);Yt();nt();Xt()});function qk(e){let t=Mk(e,["--version"],1e4,1048576);if(t.TAG!=="Ok")return;let n=jk.exec(t._0);if(n!=null)return Mn(n.slice(1)[0],i=>i)}function Nk(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 jk,Fk=F(()=>{At();Kt();Ne();Yt();jk=new RegExp("(\\d+\\.\\d+\\.\\d+)")});function PD(e,t){let n=Nk(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 Dk(e,t){return PD(qk(e),t)}var Lk=F(()=>{Ne();Fk()});var Uk,ch=F(()=>{Lk();Uk=Dk});var zk,Gk=F(()=>{zk={name:"@linzumi/cli",version:"1.0.268",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:{"test:agent-source":"LINZUMI_CI_QUARANTINE=0 pnpm exec vitest run --config vitest.config.mjs test/channelSession.test.ts test/kandanQueue.test.ts test/llmProxySessionCredential.test.ts test/runnerBridge.test.ts test/threadCodexWorkerIpc.test.ts -t '(?:^| )(retains three busy accepted source snapshots without fusing or interrupting|keeps different accepted agent sources distinct through interrupt pickup|does not install an old mint after its credential is (replaced|stopped)|worker agent capability requires an exact true ready flag|starts an explicitly server-keyed OpenAI agent worker without local OpenAI credentials|applies the accepted OpenAI follow-up model on an existing worker|refuses explicit OpenAI worker creation with (passthrough|missing-token|blank-origin) binding|refuses a private agent turn without an owned relay before Codex|explicitly capable worker receives a private request through ordinary IPC|old worker receives no private agent source descriptor)$'",build:"rescript build ../linzumi-cli-rescript && node scripts/build.mjs","test:actual-commander-parity":"pnpm --dir ../linzumi-cli-rescript build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/ActualCommanderParityConformance.res.mjs","bump-version":"node scripts/bump-cli-version.mjs","codex:history-table":"node scripts/codex_history_table.mjs",test:"npm run test:startup && node --import tsx --test ../linzumi-cli-rescript/src/parity/McpToolCallBoundaryTest.res.mjs && rescript build ../../kandan/server_v2/web/replay_harness && vitest run --config vitest.config.mjs",typecheck:"rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.source.json","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",prepack:"rescript build -q ../linzumi-cli-rescript && node scripts/build.mjs","pack:dry-run":"npm pack --dry-run","record:agent-fixtures":"tsx scripts/record-agent-replay-fixtures.ts","normalize:agent-fixture":"tsx scripts/normalize-agent-replay-fixture.ts","vendor:codex-app-server-protocol":"tsx scripts/vendor-codex-app-server-protocol.ts","replay:agent-fixture":"tsx scripts/replay-agent-fixture.ts","replay:agent-backend":"tsx scripts/replay-agent-backend.ts","vendor:codex-app-server-protocol:check":"tsx scripts/vendor-codex-app-server-protocol.ts --check","replay:agent-backend-browser":"tsx scripts/replay-agent-backend-browser.ts","promote:gstack-claude-smoke-fixture":"tsx scripts/promote-gstack-claude-smoke-fixture.ts","diagnose:claude-probe":"tsx scripts/diagnose-claude-probe.ts","test:startup":"npm run build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/CommanderStartupRefusalConformance.res.mjs"},keywords:["linzumi","kandan","codex","local-runner"],license:"MIT",publishConfig:{access:"public"},dependencies:{"@anthropic-ai/claude-agent-sdk":"0.3.199","@inquirer/prompts":"^7.8.6","@modelcontextprotocol/sdk":"^1.29.0","@openai/codex":"0.153.2",blessed:"^0.1.81","proper-lockfile":"3.2.0",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 fh,Bu=F(()=>{"use strict";Gk();fh=zk.dependencies["@openai/codex"]});async function Jk(e,t,n){let i;try{e(),i=!0}catch{i=!1}let r;try{await t(),r=!0}catch{r=!1}return i&&r?{TAG:"Ok",_0:void 0}:(n("hosted_auth_quota_cleanup_failed reason=owned_process_not_confirmed_reaped"),{TAG:"Error",_0:"cleanup_failed"})}function Kk(e,t){let n=e.quotaWindow,i=e.credits;if(n===void 0&&i===void 0)return{status:"unavailable",reason:"empty_response"};let r=n!==void 0?[n.usedPercent,n.windowMinutes,n.resetsAtMs]:[void 0,void 0,void 0];return{status:"captured",quotaWindow:{usedPercent:r[0],windowMinutes:r[1],resetsAtMs:r[2],capturedAtMs:t,credits:i}}}var Bk=F(()=>{});var Wk,Hk,Vk=F(()=>{Bk();Wk=Jk,Hk=Kk});function Ke(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ph(e){let t=[["threadId",e.threadId],["turnId",e.turnId],["itemId",e.itemId],["processId",e.processId],["requestId",e.requestId]].filter(n=>n[1]!==void 0);return Object.fromEntries(t)}var Et=F(()=>{"use strict"});var Wu=F(()=>{"use strict";Et()});function Xk(e){let t=Dr(e.rateLimits)??Dr(e.rate_limits)??Dr(e.limits)??e,n=[t,...Object.values(t).flatMap(_=>{let y=Dr(_);return y===void 0?[]:[y]})],i=n.reduce((_,y)=>{let b=Fe(y.usedPercent)??Fe(y.used_percent);return b===void 0?_:_===void 0?b:Math.max(_,b)},void 0),o=n.some(_=>Fe(_.remaining)===0||Fe(_.remainingRequests)===0||Fe(_.remaining_requests)===0||Fe(_.remainingTokens)===0||Fe(_.remaining_tokens)===0||Fe(_.retryAfterSeconds)!==void 0||Fe(_.retry_after_seconds)!==void 0)?"rejected":i!==void 0&&i>=80?"allowed_warning":"allowed",a=Dr(t.primary),s=Fe(a?.usedPercent),d=Fe(a?.windowDurationMins),l=Fe(a?.resetsAt),u=Dr(t.credits),c=Yk(u?.hasCredits),p=Yk(u?.unlimited),f=u?.balance,h=c===void 0||p===void 0?void 0:{hasCredits:c,unlimited:p,balance:typeof f=="string"?f:null},g=s===void 0&&d===void 0&&l===void 0?void 0:{...s===void 0?{}:{usedPercent:s},...d===void 0?{}:{windowMinutes:d},...l===void 0?{}:{resetsAtMs:l*1e3}};return{summary:MD(e)??"seen (no details)",status:o,utilizationPercent:i,...g===void 0?{}:{quotaWindow:g},...h===void 0?{}:{credits:h}}}function MD(e){let t=Dr(e.rateLimits)??Dr(e.rate_limits)??Dr(e.limits)??e,n=Zk(t,void 0),i=Object.entries(t).flatMap(([o,a])=>{let s=Dr(a);return s===void 0?[]:[Zk(s,o)]}),r=[n,...i].filter(o=>o!==void 0);return r.length===0?void 0:r.join(" | ")}function Zk(e,t){let n=gr(e.limitName)??gr(e.limit_name)??gr(e.name)??gr(e.type)??t,i=gr(e.planType)??gr(e.plan_type)??gr(e.plan),r=Fe(e.remaining)??Fe(e.remainingRequests)??Fe(e.remaining_requests)??Fe(e.remainingTokens)??Fe(e.remaining_tokens),o=Fe(e.limit)??Fe(e.requestLimit)??Fe(e.request_limit)??Fe(e.limitRequests)??Fe(e.limit_requests)??Fe(e.tokenLimit)??Fe(e.token_limit)??Fe(e.limitTokens)??Fe(e.limit_tokens),a=gr(e.resetAt)??gr(e.reset_at)??gr(e.resetsAt)??gr(e.resets_at)??Qk(e.resetsAt)??Qk(e.resets_at)??Hu(e.resetAfterSeconds)??Hu(e.reset_after_seconds)??Hu(e.retryAfterSeconds)??Hu(e.retry_after_seconds),s=Fe(e.usedPercent)??Fe(e.used_percent),d=Fe(e.windowDurationMins)??Fe(e.window_duration_mins),l=[n,i].filter(f=>f!==void 0).join(" "),u=l===""?void 0:l,p=[r===void 0?void 0:o===void 0?`${r} remaining`:`${r}/${o} remaining`,s===void 0?void 0:`${s}% used`,d===void 0?void 0:`${d}m window`,a===void 0?void 0:`reset ${a}`].filter(f=>f!==void 0);return p.length===0?u===void 0?void 0:`${u} seen (no details)`:u===void 0?p.join(" "):`${u} ${p.join(" ")}`}function Hu(e){let t=Fe(e);return t===void 0?void 0:`${t}s`}function Qk(e){let t=Fe(e);return t===void 0?void 0:new Date(t*1e3).toISOString()}function Dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function gr(e){return typeof e=="string"&&e.trim()!==""?e:void 0}function Yk(e){return typeof e=="boolean"?e:void 0}function Fe(e){if(typeof e=="number"&&Number.isSafeInteger(e))return e;if(typeof e!="string")return;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t.toString()===e.trim()?t:void 0}var ex=F(()=>{"use strict";Wu();Et()});var ai=tt((fce,rx)=>{"use strict";var tx=["nodebuffer","arraybuffer","fragments"],nx=typeof Blob<"u";nx&&tx.push("blob");rx.exports={BINARY_TYPES:tx,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:nx,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Qs=tt((pce,Vu)=>{"use strict";var{EMPTY_BUFFER:jD}=ai(),mh=Buffer[Symbol.species];function qD(e,t){if(e.length===0)return jD;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),i=0;for(let r=0;r<e.length;r++){let o=e[r];n.set(o,i),i+=o.length}return i<t?new mh(n.buffer,n.byteOffset,i):n}function ix(e,t,n,i,r){for(let o=0;o<r;o++)n[i+o]=e[o]^t[o&3]}function ox(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function ND(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function hh(e){if(hh.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new mh(e):ArrayBuffer.isView(e)?t=new mh(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),hh.readOnly=!1),t}Vu.exports={concat:qD,mask:ix,toArrayBuffer:ND,toBuffer:hh,unmask:ox};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=We("bufferutil");Vu.exports.mask=function(t,n,i,r,o){o<48?ix(t,n,i,r,o):e.mask(t,n,i,r,o)},Vu.exports.unmask=function(t,n){t.length<32?ox(t,n):e.unmask(t,n)}}catch{}});var dx=tt((mce,sx)=>{"use strict";var ax=Symbol("kDone"),gh=Symbol("kRun"),yh=class{constructor(t){this[ax]=()=>{this.pending--,this[gh]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[gh]()}[gh](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[ax])}}};sx.exports=yh});var Xs=tt((hce,fx)=>{"use strict";var Ys=We("zlib"),lx=Qs(),FD=dx(),{kStatusCode:ux}=ai(),DD=Buffer[Symbol.species],LD=Buffer.from([0,0,255,255]),Qu=Symbol("permessage-deflate"),si=Symbol("total-length"),ha=Symbol("callback"),Ei=Symbol("buffers"),ga=Symbol("error"),Zu,_h=class{constructor(t,n,i){if(this._maxPayload=i|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,!Zu){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Zu=new FD(r)}}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[ha];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,i=t.find(r=>!(n.serverNoContextTakeover===!1&&r.server_no_context_takeover||r.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>r.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!r.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(i.server_no_context_takeover=!0),n.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(i.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?i.client_max_window_bits=n.clientMaxWindowBits:(i.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}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(i=>{let r=n[i];if(r.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(r=r[0],i==="client_max_window_bits"){if(r!==!0){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${i}": ${r}`);r=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${r}`)}else if(i==="server_max_window_bits"){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${i}": ${r}`);r=o}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(r!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${r}`)}else throw new Error(`Unknown parameter "${i}"`);n[i]=r})}),t}decompress(t,n,i){Zu.add(r=>{this._decompress(t,n,(o,a)=>{r(),i(o,a)})})}compress(t,n,i){Zu.add(r=>{this._compress(t,n,(o,a)=>{r(),i(o,a)})})}_decompress(t,n,i){let r=this._isServer?"client":"server";if(!this._inflate){let o=`${r}_max_window_bits`,a=typeof this.params[o]!="number"?Ys.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=Ys.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[Qu]=this,this._inflate[si]=0,this._inflate[Ei]=[],this._inflate.on("error",GD),this._inflate.on("data",cx)}this._inflate[ha]=i,this._inflate.write(t),n&&this._inflate.write(LD),this._inflate.flush(()=>{let o=this._inflate[ga];if(o){this._inflate.close(),this._inflate=null,i(o);return}let a=lx.concat(this._inflate[Ei],this._inflate[si]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[si]=0,this._inflate[Ei]=[],n&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),i(null,a)})}_compress(t,n,i){let r=this._isServer?"server":"client";if(!this._deflate){let o=`${r}_max_window_bits`,a=typeof this.params[o]!="number"?Ys.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=Ys.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[si]=0,this._deflate[Ei]=[],this._deflate.on("data",UD)}this._deflate[ha]=i,this._deflate.write(t),this._deflate.flush(Ys.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=lx.concat(this._deflate[Ei],this._deflate[si]);n&&(o=new DD(o.buffer,o.byteOffset,o.length-4)),this._deflate[ha]=null,this._deflate[si]=0,this._deflate[Ei]=[],n&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),i(null,o)})}};fx.exports=_h;function UD(e){this[Ei].push(e),this[si]+=e.length}function cx(e){if(this[si]+=e.length,this[Qu]._maxPayload<1||this[si]<=this[Qu]._maxPayload){this[Ei].push(e);return}this[ga]=new RangeError("Max payload size exceeded"),this[ga].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ga][ux]=1009,this.removeListener("data",cx),this.reset()}function GD(e){if(this[Qu]._inflate=null,this[ga]){this[ha](this[ga]);return}e[ux]=1007,this[ha](e)}});var ya=tt((gce,Yu)=>{"use strict";var{isUtf8:px}=We("buffer"),{hasBlob:zD}=ai(),JD=[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 KD(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function bh(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 BD(e){return zD&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Yu.exports={isBlob:BD,isValidStatusCode:KD,isValidUTF8:bh,tokenChars:JD};if(px)Yu.exports.isValidUTF8=function(e){return e.length<24?bh(e):px(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=We("utf-8-validate");Yu.exports.isValidUTF8=function(t){return t.length<32?bh(t):e(t)}}catch{}});var xh=tt((yce,vx)=>{"use strict";var{Writable:WD}=We("stream"),mx=Xs(),{BINARY_TYPES:HD,EMPTY_BUFFER:hx,kStatusCode:VD,kWebSocket:ZD}=ai(),{concat:vh,toArrayBuffer:QD,unmask:YD}=Qs(),{isValidStatusCode:XD,isValidUTF8:gx}=ya(),Xu=Buffer[Symbol.species],Zn=0,yx=1,_x=2,bx=3,Sh=4,wh=5,ec=6,kh=class extends WD{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||HD[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[ZD]=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=Zn}_write(t,n,i){if(this._opcode===8&&this._state==Zn)return i();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(i)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new Xu(i.buffer,i.byteOffset+t,i.length-t),new Xu(i.buffer,i.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let i=this._buffers[0],r=n.length-t;t>=i.length?n.set(this._buffers.shift(),r):(n.set(new Uint8Array(i.buffer,i.byteOffset,t),r),this._buffers[0]=new Xu(i.buffer,i.byteOffset+t,i.length-t)),t-=i.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case Zn:this.getInfo(t);break;case yx:this.getPayloadLength16(t);break;case _x:this.getPayloadLength64(t);break;case bx:this.getMask();break;case Sh:this.getData(t);break;case wh:case ec: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 r=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(r);return}let i=(n[0]&64)===64;if(i&&!this._extensions[mx.extensionName]){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(i){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(!this._fragmented){let r=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let r=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(r);return}if(i){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let r=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(r);return}}else{let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(n[1]&128)===128,this._isServer){if(!this._masked){let r=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(r);return}}else if(this._masked){let r=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(r);return}this._payloadLength===126?this._state=yx:this._payloadLength===127?this._state=_x: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),i=n.readUInt32BE(0);if(i>Math.pow(2,21)-1){let r=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(r);return}this._payloadLength=i*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=bx:this._state=Sh}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Sh}getData(t){let n=hx;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&&YD(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._compressed){this._state=wh,this.decompress(n,t);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(n)),this.dataMessage(t)}decompress(t,n){this._extensions[mx.extensionName].decompress(t,this._fin,(r,o)=>{if(r)return n(r);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===Zn&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=Zn;return}let n=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=vh(i,n):this._binaryType==="arraybuffer"?r=QD(vh(i,n)):this._binaryType==="blob"?r=new Blob(i):r=i,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=Zn):(this._state=ec,setImmediate(()=>{this.emit("message",r,!0),this._state=Zn,this.startLoop(t)}))}else{let r=vh(i,n);if(!this._skipUTF8Validation&&!gx(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(o);return}this._state===wh||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=Zn):(this._state=ec,setImmediate(()=>{this.emit("message",r,!1),this._state=Zn,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,hx),this.end();else{let i=t.readUInt16BE(0);if(!XD(i)){let o=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(o);return}let r=new Xu(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!gx(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(o);return}this._loop=!1,this.emit("conclude",i,r),this.end()}this._state=Zn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Zn):(this._state=ec,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Zn,this.startLoop(n)}))}createError(t,n,i,r,o){this._loop=!1,this._errored=!0;let a=new t(i?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(a,this.createError),a.code=o,a[VD]=r,a}};vx.exports=kh});var Ah=tt((bce,kx)=>{"use strict";var{Duplex:_ce}=We("stream"),{randomFillSync:eL}=We("crypto"),Sx=Xs(),{EMPTY_BUFFER:tL,kWebSocket:nL,NOOP:rL}=ai(),{isBlob:_a,isValidStatusCode:iL}=ya(),{mask:wx,toBuffer:co}=Qs(),Qn=Symbol("kByteLength"),oL=Buffer.alloc(4),tc=8*1024,fo,ba=tc,yr=0,aL=1,sL=2,Th=class e{constructor(t,n,i){this._extensions=n||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=yr,this.onerror=rL,this[nL]=void 0}static frame(t,n){let i,r=!1,o=2,a=!1;n.mask&&(i=n.maskBuffer||oL,n.generateMask?n.generateMask(i):(ba===tc&&(fo===void 0&&(fo=Buffer.alloc(tc)),eL(fo,0,tc),ba=0),i[0]=fo[ba++],i[1]=fo[ba++],i[2]=fo[ba++],i[3]=fo[ba++]),a=(i[0]|i[1]|i[2]|i[3])===0,o=6);let s;typeof t=="string"?(!n.mask||a)&&n[Qn]!==void 0?s=n[Qn]:(t=Buffer.from(t),s=t.length):(s=t.length,r=n.mask&&n.readOnly&&!a);let d=s;s>=65536?(o+=8,d=127):s>125&&(o+=2,d=126);let l=Buffer.allocUnsafe(r?s+o:o);return l[0]=n.fin?n.opcode|128:n.opcode,n.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(s,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),n.mask?(l[1]|=128,l[o-4]=i[0],l[o-3]=i[1],l[o-2]=i[2],l[o-1]=i[3],a?[l,t]:r?(wx(t,i,l,o,s),[l]):(wx(t,i,t,0,s),[l,t])):[l,t]}close(t,n,i,r){let o;if(t===void 0)o=tL;else{if(typeof t!="number"||!iL(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={[Qn]:o.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==yr?this.enqueue([this.dispatch,o,!1,a,r]):this.sendFrame(e.frame(o,a),r)}ping(t,n,i){let r,o;if(typeof t=="string"?(r=Buffer.byteLength(t),o=!1):_a(t)?(r=t.size,o=!1):(t=co(t),r=t.length,o=co.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Qn]:r,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,!1,a,i]):this.getBlobData(t,!1,a,i):this._state!==yr?this.enqueue([this.dispatch,t,!1,a,i]):this.sendFrame(e.frame(t,a),i)}pong(t,n,i){let r,o;if(typeof t=="string"?(r=Buffer.byteLength(t),o=!1):_a(t)?(r=t.size,o=!1):(t=co(t),r=t.length,o=co.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Qn]:r,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,!1,a,i]):this.getBlobData(t,!1,a,i):this._state!==yr?this.enqueue([this.dispatch,t,!1,a,i]):this.sendFrame(e.frame(t,a),i)}send(t,n,i){let r=this._extensions[Sx.extensionName],o=n.binary?2:1,a=n.compress,s,d;typeof t=="string"?(s=Buffer.byteLength(t),d=!1):_a(t)?(s=t.size,d=!1):(t=co(t),s=t.length,d=co.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=s>=r._threshold),this._compress=a):(a=!1,o=0),n.fin&&(this._firstFragment=!0);let l={[Qn]:s,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:d,rsv1:a};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,this._compress,l,i]):this.getBlobData(t,this._compress,l,i):this._state!==yr?this.enqueue([this.dispatch,t,this._compress,l,i]):this.dispatch(t,this._compress,l,i)}getBlobData(t,n,i,r){this._bufferedBytes+=i[Qn],this._state=sL,t.arrayBuffer().then(o=>{if(this._socket.destroyed){let s=new Error("The socket was closed while the blob was being read");process.nextTick(Ch,this,s,r);return}this._bufferedBytes-=i[Qn];let a=co(o);n?this.dispatch(a,n,i,r):(this._state=yr,this.sendFrame(e.frame(a,i),r),this.dequeue())}).catch(o=>{process.nextTick(dL,this,o,r)})}dispatch(t,n,i,r){if(!n){this.sendFrame(e.frame(t,i),r);return}let o=this._extensions[Sx.extensionName];this._bufferedBytes+=i[Qn],this._state=aL,o.compress(t,i.fin,(a,s)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");Ch(this,d,r);return}this._bufferedBytes-=i[Qn],this._state=yr,i.readOnly=!1,this.sendFrame(e.frame(s,i),r),this.dequeue()})}dequeue(){for(;this._state===yr&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Qn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Qn],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)}};kx.exports=Th;function Ch(e,t,n){typeof n=="function"&&n(t);for(let i=0;i<e._queue.length;i++){let r=e._queue[i],o=r[r.length-1];typeof o=="function"&&o(t)}}function dL(e,t,n){Ch(e,t,n),e.onerror(t)}});var Rx=tt((vce,Ox)=>{"use strict";var{kForOnEventAttribute:ed,kListener:Eh}=ai(),xx=Symbol("kCode"),Tx=Symbol("kData"),Cx=Symbol("kError"),Ax=Symbol("kMessage"),Ex=Symbol("kReason"),va=Symbol("kTarget"),Px=Symbol("kType"),Ix=Symbol("kWasClean"),di=class{constructor(t){this[va]=null,this[Px]=t}get target(){return this[va]}get type(){return this[Px]}};Object.defineProperty(di.prototype,"target",{enumerable:!0});Object.defineProperty(di.prototype,"type",{enumerable:!0});var po=class extends di{constructor(t,n={}){super(t),this[xx]=n.code===void 0?0:n.code,this[Ex]=n.reason===void 0?"":n.reason,this[Ix]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[xx]}get reason(){return this[Ex]}get wasClean(){return this[Ix]}};Object.defineProperty(po.prototype,"code",{enumerable:!0});Object.defineProperty(po.prototype,"reason",{enumerable:!0});Object.defineProperty(po.prototype,"wasClean",{enumerable:!0});var Sa=class extends di{constructor(t,n={}){super(t),this[Cx]=n.error===void 0?null:n.error,this[Ax]=n.message===void 0?"":n.message}get error(){return this[Cx]}get message(){return this[Ax]}};Object.defineProperty(Sa.prototype,"error",{enumerable:!0});Object.defineProperty(Sa.prototype,"message",{enumerable:!0});var td=class extends di{constructor(t,n={}){super(t),this[Tx]=n.data===void 0?null:n.data}get data(){return this[Tx]}};Object.defineProperty(td.prototype,"data",{enumerable:!0});var lL={addEventListener(e,t,n={}){for(let r of this.listeners(e))if(!n[ed]&&r[Eh]===t&&!r[ed])return;let i;if(e==="message")i=function(o,a){let s=new td("message",{data:a?o:o.toString()});s[va]=this,nc(t,this,s)};else if(e==="close")i=function(o,a){let s=new po("close",{code:o,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[va]=this,nc(t,this,s)};else if(e==="error")i=function(o){let a=new Sa("error",{error:o,message:o.message});a[va]=this,nc(t,this,a)};else if(e==="open")i=function(){let o=new di("open");o[va]=this,nc(t,this,o)};else return;i[ed]=!!n[ed],i[Eh]=t,n.once?this.once(e,i):this.on(e,i)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[Eh]===t&&!n[ed]){this.removeListener(e,n);break}}};Ox.exports={CloseEvent:po,ErrorEvent:Sa,Event:di,EventTarget:lL,MessageEvent:td};function nc(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}});var Ph=tt((Sce,$x)=>{"use strict";var{tokenChars:nd}=ya();function Lr(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function uL(e){let t=Object.create(null),n=Object.create(null),i=!1,r=!1,o=!1,a,s,d=-1,l=-1,u=-1,c=0;for(;c<e.length;c++)if(l=e.charCodeAt(c),a===void 0)if(u===-1&&nd[l]===1)d===-1&&(d=c);else if(c!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c);let f=e.slice(d,u);l===44?(Lr(t,f,n),n=Object.create(null)):a=f,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);else if(s===void 0)if(u===-1&&nd[l]===1)d===-1&&(d=c);else if(l===32||l===9)u===-1&&d!==-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c),Lr(n,e.slice(d,u),!0),l===44&&(Lr(t,a,n),n=Object.create(null),a=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)s=e.slice(d,c),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(r){if(nd[l]!==1)throw new SyntaxError(`Unexpected character at index ${c}`);d===-1?d=c:i||(i=!0),r=!1}else if(o)if(nd[l]===1)d===-1&&(d=c);else if(l===34&&d!==-1)o=!1,u=c;else if(l===92)r=!0;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(l===34&&e.charCodeAt(c-1)===61)o=!0;else if(u===-1&&nd[l]===1)d===-1&&(d=c);else if(d!==-1&&(l===32||l===9))u===-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c);let f=e.slice(d,u);i&&(f=f.replace(/\\/g,""),i=!1),Lr(n,s,f),l===44&&(Lr(t,a,n),n=Object.create(null),a=void 0),s=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);if(d===-1||o||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=c);let p=e.slice(d,u);return a===void 0?Lr(t,p,n):(s===void 0?Lr(n,p,!0):i?Lr(n,s,p.replace(/\\/g,"")):Lr(n,s,p),Lr(t,a,n)),t}function cL(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(i=>[t].concat(Object.keys(i).map(r=>{let o=i[r];return Array.isArray(o)||(o=[o]),o.map(a=>a===!0?r:`${r}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}$x.exports={format:cL,parse:uL}});var ac=tt((xce,Kx)=>{"use strict";var fL=We("events"),pL=We("https"),mL=We("http"),qx=We("net"),hL=We("tls"),{randomBytes:gL,createHash:yL}=We("crypto"),{Duplex:wce,Readable:kce}=We("stream"),{URL:Ih}=We("url"),Pi=Xs(),_L=xh(),bL=Ah(),{isBlob:vL}=ya(),{BINARY_TYPES:Mx,EMPTY_BUFFER:rc,GUID:SL,kForOnEventAttribute:Oh,kListener:wL,kStatusCode:kL,kWebSocket:Bt,NOOP:Nx}=ai(),{EventTarget:{addEventListener:xL,removeEventListener:TL}}=Rx(),{format:CL,parse:AL}=Ph(),{toBuffer:EL}=Qs(),PL=30*1e3,Fx=Symbol("kAborted"),Rh=[8,13],li=["CONNECTING","OPEN","CLOSING","CLOSED"],IL=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,pt=class e extends fL{constructor(t,n,i){super(),this._binaryType=Mx[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=rc,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?(i=n,n=[]):n=[n]),Dx(this,t,n,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Mx.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,i){let r=new _L({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation}),o=new bL(t,this._extensions,i.generateMask);this._receiver=r,this._sender=o,this._socket=t,r[Bt]=this,o[Bt]=this,t[Bt]=this,r.on("conclude",$L),r.on("drain",ML),r.on("error",jL),r.on("message",qL),r.on("ping",NL),r.on("pong",FL),o.onerror=DL,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",Gx),t.on("data",oc),t.on("end",zx),t.on("error",Jx),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[Pi.extensionName]&&this._extensions[Pi.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){qn(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,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Ux(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=n=void 0):typeof n=="function"&&(i=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){$h(this,t,i);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||rc,n,i)}pong(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=n=void 0):typeof n=="function"&&(i=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){$h(this,t,i);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||rc,n,i)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(i=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){$h(this,t,i);return}let r={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[Pi.extensionName]||(r.compress=!1),this._sender.send(t||rc,r,i)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){qn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(pt,"CONNECTING",{enumerable:!0,value:li.indexOf("CONNECTING")});Object.defineProperty(pt.prototype,"CONNECTING",{enumerable:!0,value:li.indexOf("CONNECTING")});Object.defineProperty(pt,"OPEN",{enumerable:!0,value:li.indexOf("OPEN")});Object.defineProperty(pt.prototype,"OPEN",{enumerable:!0,value:li.indexOf("OPEN")});Object.defineProperty(pt,"CLOSING",{enumerable:!0,value:li.indexOf("CLOSING")});Object.defineProperty(pt.prototype,"CLOSING",{enumerable:!0,value:li.indexOf("CLOSING")});Object.defineProperty(pt,"CLOSED",{enumerable:!0,value:li.indexOf("CLOSED")});Object.defineProperty(pt.prototype,"CLOSED",{enumerable:!0,value:li.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(pt.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(pt.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[Oh])return t[wL];return null},set(t){for(let n of this.listeners(e))if(n[Oh]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[Oh]:!0})}})});pt.prototype.addEventListener=xL;pt.prototype.removeEventListener=TL;Kx.exports=pt;function Dx(e,t,n,i){let r={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Rh[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,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=r.autoPong,!Rh.includes(r.protocolVersion))throw new RangeError(`Unsupported protocol version: ${r.protocolVersion} (supported versions: ${Rh.join(", ")})`);let o;if(t instanceof Ih)o=t;else try{o=new Ih(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:",d;if(o.protocol!=="ws:"&&!a&&!s?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:s&&!o.pathname?d="The URL's pathname is empty":o.hash&&(d="The URL contains a fragment identifier"),d){let g=new SyntaxError(d);if(e._redirects===0)throw g;ic(e,g);return}let l=a?443:80,u=gL(16).toString("base64"),c=a?pL.request:mL.request,p=new Set,f;if(r.createConnection=r.createConnection||(a?RL:OL),r.defaultPort=r.defaultPort||l,r.port=o.port||l,r.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,r.headers={...r.headers,"Sec-WebSocket-Version":r.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},r.path=o.pathname+o.search,r.timeout=r.handshakeTimeout,r.perMessageDeflate&&(f=new Pi(r.perMessageDeflate!==!0?r.perMessageDeflate:{},!1,r.maxPayload),r.headers["Sec-WebSocket-Extensions"]=CL({[Pi.extensionName]:f.offer()})),n.length){for(let g of n){if(typeof g!="string"||!IL.test(g)||p.has(g))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(g)}r.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(r.origin&&(r.protocolVersion<13?r.headers["Sec-WebSocket-Origin"]=r.origin:r.headers.Origin=r.origin),(o.username||o.password)&&(r.auth=`${o.username}:${o.password}`),s){let g=r.path.split(":");r.socketPath=g[0],r.path=g[1]}let h;if(r.followRedirects){if(e._redirects===0){e._originalIpc=s,e._originalSecure=a,e._originalHostOrSocketPath=s?r.socketPath:o.host;let g=i&&i.headers;if(i={...i,headers:{}},g)for(let[_,y]of Object.entries(g))i.headers[_.toLowerCase()]=y}else if(e.listenerCount("redirect")===0){let g=s?e._originalIpc?r.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:o.host===e._originalHostOrSocketPath;(!g||e._originalSecure&&!a)&&(delete r.headers.authorization,delete r.headers.cookie,g||delete r.headers.host,r.auth=void 0)}r.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(r.auth).toString("base64")),h=e._req=c(r),e._redirects&&e.emit("redirect",e.url,h)}else h=e._req=c(r);r.timeout&&h.on("timeout",()=>{qn(e,h,"Opening handshake has timed out")}),h.on("error",g=>{h===null||h[Fx]||(h=e._req=null,ic(e,g))}),h.on("response",g=>{let _=g.headers.location,y=g.statusCode;if(_&&r.followRedirects&&y>=300&&y<400){if(++e._redirects>r.maxRedirects){qn(e,h,"Maximum redirects exceeded");return}h.abort();let b;try{b=new Ih(_,t)}catch{let w=new SyntaxError(`Invalid URL: ${_}`);ic(e,w);return}Dx(e,b,n,i)}else e.emit("unexpected-response",h,g)||qn(e,h,`Unexpected server response: ${g.statusCode}`)}),h.on("upgrade",(g,_,y)=>{if(e.emit("upgrade",g),e.readyState!==pt.CONNECTING)return;h=e._req=null;let b=g.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){qn(e,_,"Invalid Upgrade header");return}let v=yL("sha1").update(u+SL).digest("base64");if(g.headers["sec-websocket-accept"]!==v){qn(e,_,"Invalid Sec-WebSocket-Accept header");return}let w=g.headers["sec-websocket-protocol"],A;if(w!==void 0?p.size?p.has(w)||(A="Server sent an invalid subprotocol"):A="Server sent a subprotocol but none was requested":p.size&&(A="Server sent no subprotocol"),A){qn(e,_,A);return}w&&(e._protocol=w);let C=g.headers["sec-websocket-extensions"];if(C!==void 0){if(!f){qn(e,_,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let S;try{S=AL(C)}catch{qn(e,_,"Invalid Sec-WebSocket-Extensions header");return}let k=Object.keys(S);if(k.length!==1||k[0]!==Pi.extensionName){qn(e,_,"Server indicated an extension that was not requested");return}try{f.accept(S[Pi.extensionName])}catch{qn(e,_,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Pi.extensionName]=f}e.setSocket(_,y,{allowSynchronousEvents:r.allowSynchronousEvents,generateMask:r.generateMask,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation})}),r.finishRequest?r.finishRequest(h,e):h.end()}function ic(e,t){e._readyState=pt.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function OL(e){return e.path=e.socketPath,qx.connect(e)}function RL(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=qx.isIP(e.host)?"":e.host),hL.connect(e)}function qn(e,t,n){e._readyState=pt.CLOSING;let i=new Error(n);Error.captureStackTrace(i,qn),t.setHeader?(t[Fx]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(ic,e,i)):(t.destroy(i),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function $h(e,t,n){if(t){let i=vL(t)?t.size:EL(t).length;e._socket?e._sender._bufferedBytes+=i:e._bufferedAmount+=i}if(n){let i=new Error(`WebSocket is not open: readyState ${e.readyState} (${li[e.readyState]})`);process.nextTick(n,i)}}function $L(e,t){let n=this[Bt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[Bt]!==void 0&&(n._socket.removeListener("data",oc),process.nextTick(Lx,n._socket),e===1005?n.close():n.close(e,t))}function ML(){let e=this[Bt];e.isPaused||e._socket.resume()}function jL(e){let t=this[Bt];t._socket[Bt]!==void 0&&(t._socket.removeListener("data",oc),process.nextTick(Lx,t._socket),t.close(e[kL])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function jx(){this[Bt].emitClose()}function qL(e,t){this[Bt].emit("message",e,t)}function NL(e){let t=this[Bt];t._autoPong&&t.pong(e,!this._isServer,Nx),t.emit("ping",e)}function FL(e){this[Bt].emit("pong",e)}function Lx(e){e.resume()}function DL(e){let t=this[Bt];t.readyState!==pt.CLOSED&&(t.readyState===pt.OPEN&&(t._readyState=pt.CLOSING,Ux(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function Ux(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),PL)}function Gx(){let e=this[Bt];this.removeListener("close",Gx),this.removeListener("data",oc),this.removeListener("end",zx),e._readyState=pt.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[Bt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",jx),e._receiver.on("finish",jx))}function oc(e){this[Bt]._receiver.write(e)||this.pause()}function zx(){let e=this[Bt];e._readyState=pt.CLOSING,e._receiver.end(),this.end()}function Jx(){let e=this[Bt];this.removeListener("error",Jx),this.on("error",Nx),e&&(e._readyState=pt.CLOSING,this.destroy())}});var Vx=tt((Cce,Hx)=>{"use strict";var Tce=ac(),{Duplex:LL}=We("stream");function Bx(e){e.emit("close")}function UL(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Wx(e){this.removeListener("error",Wx),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function GL(e,t){let n=!0,i=new LL({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(o,a){let s=!a&&i._readableState.objectMode?o.toString():o;i.push(s)||e.pause()}),e.once("error",function(o){i.destroyed||(n=!1,i.destroy(o))}),e.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(r,o){if(e.readyState===e.CLOSED){o(r),process.nextTick(Bx,i);return}let a=!1;e.once("error",function(d){a=!0,o(d)}),e.once("close",function(){a||o(r),process.nextTick(Bx,i)}),n&&e.terminate()},i._final=function(r){if(e.readyState===e.CONNECTING){e.once("open",function(){i._final(r)});return}e._socket!==null&&(e._socket._writableState.finished?(r(),i._readableState.endEmitted&&i.destroy()):(e._socket.once("finish",function(){r()}),e.close()))},i._read=function(){e.isPaused&&e.resume()},i._write=function(r,o,a){if(e.readyState===e.CONNECTING){e.once("open",function(){i._write(r,o,a)});return}e.send(r,a)},i.on("end",UL),i.on("error",Wx),i}Hx.exports=GL});var Qx=tt((Ace,Zx)=>{"use strict";var{tokenChars:zL}=ya();function JL(e){let t=new Set,n=-1,i=-1,r=0;for(r;r<e.length;r++){let a=e.charCodeAt(r);if(i===-1&&zL[a]===1)n===-1&&(n=r);else if(r!==0&&(a===32||a===9))i===-1&&n!==-1&&(i=r);else if(a===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${r}`);i===-1&&(i=r);let s=e.slice(n,i);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);t.add(s),n=i=-1}else throw new SyntaxError(`Unexpected character at index ${r}`)}if(n===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let o=e.slice(n,r);if(t.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}Zx.exports={parse:JL}});var i0=tt((Pce,r0)=>{"use strict";var KL=We("events"),sc=We("http"),{Duplex:Ece}=We("stream"),{createHash:BL}=We("crypto"),Yx=Ph(),mo=Xs(),WL=Qx(),HL=ac(),{GUID:VL,kWebSocket:ZL}=ai(),QL=/^[+/0-9A-Za-z]{22}==$/,Xx=0,e0=1,n0=2,Mh=class extends KL{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:HL,...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=sc.createServer((i,r)=>{let o=sc.STATUS_CODES[426];r.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),r.end(o)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=YL(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(r,o,a)=>{this.handleUpgrade(r,o,a,i)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Xx}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===n0){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(rd,this);return}if(t&&this.once("close",t),this._state!==e0)if(this._state=e0,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(rd,this):process.nextTick(rd,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{rd(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,i,r){n.on("error",t0);let o=t.headers["sec-websocket-key"],a=t.headers.upgrade,s=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ho(this,t,n,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){ho(this,t,n,400,"Invalid Upgrade header");return}if(o===void 0||!QL.test(o)){ho(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(s!==13&&s!==8){ho(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){id(n,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=WL.parse(d)}catch{ho(this,t,n,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&u!==void 0){let p=new mo(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let f=Yx.parse(u);f[mo.extensionName]&&(p.accept(f[mo.extensionName]),c[mo.extensionName]=p)}catch{ho(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,g,_)=>{if(!f)return id(n,h||401,g,_);this.completeUpgrade(c,o,l,t,n,i,r)});return}if(!this.options.verifyClient(p))return id(n,401)}this.completeUpgrade(c,o,l,t,n,i,r)}completeUpgrade(t,n,i,r,o,a,s){if(!o.readable||!o.writable)return o.destroy();if(o[ZL])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Xx)return id(o,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${BL("sha1").update(n+VL).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(i.size){let c=this.options.handleProtocols?this.options.handleProtocols(i,r):i.values().next().value;c&&(l.push(`Sec-WebSocket-Protocol: ${c}`),u._protocol=c)}if(t[mo.extensionName]){let c=t[mo.extensionName].params,p=Yx.format({[mo.extensionName]:[c]});l.push(`Sec-WebSocket-Extensions: ${p}`),u._extensions=t}this.emit("headers",l,r),o.write(l.concat(`\r
|
|
5
5
|
`).join(`\r
|
|
6
6
|
`)),o.removeListener("error",t0),u.setSocket(o,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(u),u.on("close",()=>{this.clients.delete(u),this._shouldEmitClose&&!this.clients.size&&process.nextTick(rd,this)})),s(u,r)}};r0.exports=Mh;function YL(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let i of Object.keys(t))e.removeListener(i,t[i])}}function rd(e){e._state=n0,e.emit("close")}function t0(){this.destroy()}function id(e,t,n,i){n=n||sc.STATUS_CODES[t],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(n),...i},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${sc.STATUS_CODES[t]}\r
|
|
7
7
|
`+Object.keys(i).map(r=>`${r}: ${i[r]}`).join(`\r
|
|
@@ -145,7 +145,7 @@ const watchdog = setInterval(() => {
|
|
|
145
145
|
|
|
146
146
|
<linzumi_pr_footer_instruction>
|
|
147
147
|
For any GitHub pull request you open from this session, include this Markdown footer link in the PR description: [Continue this on Linzumi](${e.conversationUrl})
|
|
148
|
-
</linzumi_pr_footer_instruction>`}function Gc(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}var qd=F(()=>{"use strict";ht()});var nA=F(()=>{"use strict";Ua();tA();qd()});var rA=F(()=>{"use strict";ui();Et();ht()});function Nd(e,t){return e.catch(n=>t(Jt(n)))}var Fd=F(()=>{Xt()});var Kc=F(()=>{Kt()});var sy=F(()=>{At();Kt();Ne();$t();Xt();Kc();Ca()});var oA=F(()=>{At();Ca()});var Bge,aA=F(()=>{At();Kt();Ne();Fd();Yt();nt();$t();Xt();sy();Kc();Ca();oA();Bge=1440*60*1e3});var M2,Wge,Bc=F(()=>{Eo();M2=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],Wge=EC(M2)});var sA=F(()=>{});var nye,dA=F(()=>{At();Ne();er();Yt();nt();sA();nye=Object.fromEntries([["granular",Object.fromEntries([["sandbox_approval",!1],["rules",!1],["skill_approval",!1],["request_permissions",!1],["mcp_elicitations",!0]])]])});var Ga=F(()=>{Ne();Bc();sy()});var lye,uye,cye,Ld=F(()=>{At();Ne();Yt();$t();dA();Ga();lye=new RegExp("^https?:\\/\\/","i"),uye=new RegExp("^data:","i"),cye=new RegExp("^file:\\/\\/","i")});var ly=F(()=>{At();Kt();Ne();nt();$t();Ld()});var pA=F(()=>{});var n_e,r_e,i_e,o_e,a_e,s_e,d_e,l_e,u_e,c_e,f_e,p_e,m_e,h_e,g_e,y_e,__e,b_e,v_e,S_e,uy=F(()=>{At();Xg();Ne();fg();Yt();nt();Bc();$t();pA();Ld();Ga();ly();n_e=new RegExp("<[^>]*>","g"),r_e=new RegExp(`data:[^"' )]+`,"g"),i_e=new RegExp("\\s+","g"),o_e=new RegExp("(?:<!doctype\\s+html|<html(?:\\s|>))","i"),a_e=new RegExp("cloudflare|cf-ray|\\bblocked\\b|access denied|\\bchallenge\\b|attention required","i"),s_e=new RegExp("cloudflare|cf-ray","i"),d_e=new RegExp("\\bblocked\\b|access denied","i"),l_e=new RegExp("attention required","i"),u_e=new RegExp("@font-face","i"),c_e=new RegExp("unexpected status (401|403)\\b","i"),f_e=new RegExp("\\b(401|403)\\s+(?:unauthorized|forbidden)\\b","i"),p_e=new RegExp("^(?:model_request_rejected|invalid_request_error|invalid_request|request_rejected|content_policy_violation|content_filter|input_validation_error)$","i"),m_e=new RegExp("\\bmodel request was rejected\\b|\\bmodel_request_rejected\\b","i"),h_e=new RegExp("^provider_outage$","i"),g_e=new RegExp("rejecting requests|experiencing an outage|provider outage","i"),y_e=new RegExp("\\bapply_patch\\b[^]*\\bincompatible\\b|\\bin-flight tool future\\b[^]*\\bfail","i"),__e=new RegExp("\\btools::router\\b[^]*\\bfatal\\b|\\bresponse\\.failed\\b","i"),b_e=new RegExp("(tool.*fatal|fatal.*tool|response[._]failed|tool_failure)","i"),v_e=new RegExp("upstream model stream stalled","i"),S_e=new RegExp("\\(HTTP (\\d{3})\\)")});var T_e,cy=F(()=>{ii();Ne();nt();Xt();Ld();Ga();ly();uy();T_e=10*6e4});var E_e,gA=F(()=>{At();Ne();nt();zu();Xt();cy();Ga();E_e=10*6e4});function fy(e,t){return{message:t,budgetExempt:!1,preserveForRestart:e!==void 0?e:!1}}function vA(e,t){let n=t-e.maxLivePressureAgeMs;return e.activeAckStartedAtMs.some(i=>i<=n)}function Hc(e){return e.replace(iJ,"?").slice(0,128)}function SA(e,t){return sn(e.activeAckStartedAtMs,0,(n,i)=>Math.max(n,t-i))}function oJ(e,t,n,i,r){e.pressureShedCount.contents=e.pressureShedCount.contents+1|0;let o=r!==void 0?r.TAG==="ItemStream"?["item",Hc(r.itemKey),xt(r.turnId,Hc)]:["turn",void 0,Hc(r._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:Hc(i),streamKind:o[0],itemKey:o[1],turnId:o[2]}}function wA(e,t,n,i,r,o){let a=o(),s=oJ(e,t,n,i,r);try{e.onPressureShed(s)}catch{let l=s.branch,u=s.shedCount,c=s.ageMs,p=s.budgetMs,f=s.threadKey,h=s.streamKind,g=s.itemKey,_=s.turnId,y={event:"commander_push.pressure_shed_fallback",branch:l,shedCount:u,ageMs:c,budgetMs:p,threadKey:f,streamKind:h,itemKey:g,turnId:_};try{e.onPressureShedFallback(y)}catch{}}return a}function bA(e){let t=e.now(),n=t-e.maxLivePressureAgeMs,i=vA(e,t),r=[];e.live.activeThreads.forEach(o=>{let a=e.live.pendingByThread.get(o);if(a===void 0)return;let s=a.filter(l=>{let u=l.enqueuedAtMs<=n;if(!i&&!u)return!0;let c=i?"AckPressure":"QueueAge",p;return p=c==="AckPressure"?SA(e,t):t-l.enqueuedAtMs,wA(e,c,p,l.threadKey,l.streamIdentity,()=>aa(l.supersede,f=>f())),!1});s.length!==0?(e.live.pendingByThread.set(o,s),r.push(o)):e.live.pendingByThread.delete(o)}),e.live.activeThreads.splice(0,e.live.activeThreads.length,...r)}function kA(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 i=n.shift();return i!==void 0?(n.length!==0?e.activeThreads.push(t):e.pendingByThread.delete(t),{TAG:"Ok",_0:i}):(e.pendingByThread.delete(t),{TAG:"Error",_0:"Commander push admission thread queue was empty"})}function aJ(e){for(;;){let t=kA(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 i=e.now(),r=vA(e,i),o=n.enqueuedAtMs+e.maxLivePressureAgeMs<=i;if(!r&&!o)return{TAG:"Ok",_0:n};let a=r?"AckPressure":"QueueAge",s;s=a==="AckPressure"?SA(e,i):i-n.enqueuedAtMs,wA(e,a,s,n.threadKey,n.streamIdentity,()=>aa(n.supersede,d=>d()))}}function sJ(e){for(;;){let t=e.priority.activeThreads.length!==0,n=e.live.activeThreads.length!==0,i=e.maxInFlight===1?!0:e.liveInFlight.contents<(e.maxInFlight-1|0),r=n&&i,o=e.consecutivePriority.contents<8,a=0;if(t)a=r&&!o?1:2;else if(r)a=1;else return e.consecutivePriority.contents=0,{TAG:"Ok",_0:void 0};switch(a){case 1:e.consecutivePriority.contents=0;let s=aJ(e);if(s.TAG!=="Ok")return{TAG:"Error",_0:s._0};let d=s._0;if(d!==void 0)return{TAG:"Ok",_0:d};continue;case 2:return e.consecutivePriority.contents=e.consecutivePriority.contents+1|0,kA(e.priority)}}}function dJ(e,t,n,i,r,o){let a=t!==void 0?t:2e3,s=n!==void 0?n:b=>performance.now(),d=i!==void 0?i:(b,v)=>{let w=setTimeout(v,b);return w.unref(),()=>{clearTimeout(w)}},l=r!==void 0?r:b=>{console.warn("commander_push.pressure_shed",b)},u=o!==void 0?o:b=>{console.warn("commander_push.pressure_shed_fallback",b)},c=e>0,p=a>0&&isFinite(a)&&Number.isSafeInteger(a);if(!c)return{TAG:"Error",_0:"Commander push admission maxInFlight must be a positive integer"};if(!p)return{TAG:"Error",_0:"Commander push admission maxLivePressureAgeMs must be positive and finite"};let f={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:b=>{},recomputePressureCheck:()=>{},maxLivePressureAgeMs:a,now:s,schedulePressureCheck:d,activeAckStartedAtMs:[],cancelPressureCheck:{contents:void 0},pressureCheckDeadlineMs:{contents:void 0},onPressureShed:l,onPressureShedFallback:u,pressureShedCount:{contents:0}},h=b=>{let v=f.pressureCheckDeadlineMs.contents;if(v!==void 0){if(v<=b)return;aa(f.cancelPressureCheck.contents,C=>C()),f.pressureCheckDeadlineMs.contents=b;let A=f.schedulePressureCheck(Math.max(1,b-f.now()),()=>{f.cancelPressureCheck.contents=void 0,f.pressureCheckDeadlineMs.contents=void 0,bA(f),f.schedulePump(),f.recomputePressureCheck()});f.cancelPressureCheck.contents=A;return}aa(f.cancelPressureCheck.contents,A=>A()),f.pressureCheckDeadlineMs.contents=b;let w=f.schedulePressureCheck(Math.max(1,b-f.now()),()=>{f.cancelPressureCheck.contents=void 0,f.pressureCheckDeadlineMs.contents=void 0,bA(f),f.schedulePump(),f.recomputePressureCheck()});f.cancelPressureCheck.contents=w},g=()=>{let b={contents:void 0};f.live.pendingByThread.forEach(w=>{w.forEach(A=>{let C=A.enqueuedAtMs+f.maxLivePressureAgeMs,S=b.contents;b.contents=S!==void 0?Math.min(S,C):C})});let v=b.contents;if(v!==void 0)return h(sn(f.activeAckStartedAtMs,v,(w,A)=>Math.min(w,A+f.maxLivePressureAgeMs)))},_=()=>{for(;;){if(f.pumpScheduled.contents=!1,f.inFlight.contents>=f.maxInFlight)return;let b=sJ(f);if(b.TAG==="Ok"){let w=b._0;if(w===void 0)return;let A=f.now();f.inFlight.contents=f.inFlight.contents+1|0,f.activeAckStartedAtMs.push(A),f.live.activeThreads.length!==0&&h(A+f.maxLivePressureAgeMs),w.replaceableLive&&(f.liveInFlight.contents=f.liveInFlight.contents+1|0),Nd(w.task(),C=>{let S=ri(C),k=S!==void 0?Ve(Fr(He(S)),"unknown admission task error"):"unknown admission task error";return w.fail(fy(void 0,k)),Promise.resolve()}).finally(()=>{f.inFlight.contents=f.inFlight.contents-1|0;let C=f.activeAckStartedAtMs.indexOf(A);C!==-1&&f.activeAckStartedAtMs.splice(C,1),w.replaceableLive&&(f.liveInFlight.contents=f.liveInFlight.contents-1|0),f.schedulePump()});continue}let v=b._0;f.priority.pendingByThread.forEach(w=>{w.forEach(A=>A.fail(fy(void 0,v)))}),f.live.pendingByThread.forEach(w=>{w.forEach(A=>A.fail(fy(void 0,v)))}),f.priority.pendingByThread.clear(),f.live.pendingByThread.clear(),f.priority.activeThreads.splice(0,f.priority.activeThreads.length),f.live.activeThreads.splice(0,f.live.activeThreads.length);return}},y=()=>{if(!f.pumpScheduled.contents){f.pumpScheduled.contents=!0,queueMicrotask(_);return}};return f.schedulePump=y,f.armPressureCheck=h,f.recomputePressureCheck=g,{TAG:"Ok",_0:f}}function lJ(e){let t=xt(e[yA],i=>i.trim());if(t===void 0)return{TAG:"Ok",_0:8};if(t==="")return{TAG:"Ok",_0:8};let n=Number(t);return Number.isSafeInteger(n)&&n>=2?{TAG:"Ok",_0:n|0}:{TAG:"Error",_0:yA+" must be an integer of at least 2"}}function uJ(e){let t=xt(e[_A],i=>i.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:_A+" must be a positive integer"}}var yA,_A,iJ,P_e,xA=F(()=>{At();ii();Ne();er();Fd();nt();yA="LINZUMI_COMMANDER_PUSH_MAX_INFLIGHT",_A="LINZUMI_COMMANDER_PUSH_PRESSURE_BUDGET_MS";iJ=new RegExp("[^\\x20-\\x7E]","g");P_e=Ni(lJ(process.env),e=>Ni(uJ(process.env),t=>dJ(e,t,void 0,void 0,void 0,void 0)))});var TA=F(()=>{});var I_e,CA=F(()=>{Eo();Rd();I_e=IC(e=>({joinRef:e.item(0,zg(Le)),ref:e.item(1,zg(Le)),topic:e.item(2,Le),event:e.item(3,Le),payload:e.item(4,Da)}))});var F_e,AA,D_e,L_e,U_e,G_e,EA=F(()=>{xa();At();ii();Kt();Ne();er();Fd();Yt();nt();$t();TA();Xt();gg();CA();hg();F_e=new RegExp("/$"),AA="[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]",D_e=new RegExp(AA),L_e=new RegExp(AA,"g"),U_e=new RegExp("^npm install -g @linzumi\\/cli(@[0-9A-Za-z^~.-]{1,32})?$"),G_e=new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]{1,32})?$")});var PA=F(()=>{At();Ne()});var _J,z_e,J_e,bJ,vJ,K_e,B_e,IA=F(()=>{Eo();Ne();Rd();_J=Wr(e=>({decision:e.m(Le),label:e.m(Le),description:e.m(mn(Le))})),z_e=Wr(e=>({decision:e.m(Le)})),J_e=Wr(e=>({status:e.m(Le),response:e.m(Da)})),bJ=xn("terminal"),vJ=To([xn("interrupted"),xn("processed"),xn("failed"),xn("ignored"),xn("stop_failed")]),K_e=Wr(e=>({disposition:e.m(bJ),thread_id:e.m(Le),seq:e.m(xo),status:e.m(vJ),reason:e.m(AC(Le))})),B_e=Wr(e=>({approval_request_id:e.m(Le),approval_kind:e.m(Le),approval_summary:e.m(Le),approval_reason:e.m(mn(Le)),approval_port:e.m(mn(xo)),approval_pid:e.m(mn(xo)),approval_command:e.m(mn(Le)),approval_cwd:e.m(mn(Le)),approval_process_name:e.m(mn(Le)),approval_process_icon_key:e.m(mn(Le)),approval_process_icon_path:e.m(mn(Le)),approval_choices:e.m(mn(TC(_J))),approval_allowed_actor_slug:e.m(mn(Le)),approval_allowed_actor_user_id:e.m(mn(xo))}))});var Cbe,OA=F(()=>{At();ii();Kt();Ne();er();Fd();aA();Wg();Yt();nt();Bc();$t();_g();Xt();cy();gA();xA();Ld();EA();Ga();uy();PA();Ca();IA();Cbe=new RegExp("^item-\\d+$")});var RA=F(()=>{OA()});var kJ,Pbe,xJ,Ibe,Ud=F(()=>{"use strict";kJ=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],Pbe=new Set(kJ),xJ={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"},Ibe=Object.keys(xJ)});var TJ,qbe,py=F(()=>{"use strict";uc();qh();Ii();Et();TJ=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,qbe=new RegExp(TJ.source,"g")});var $A=F(()=>{});var MA=F(()=>{$A()});var Vc=F(()=>{"use strict";ht();MA()});var jA=F(()=>{Kc()});var Zbe,qA=F(()=>{"use strict";Et();ht();Zbe=1024*1024});var lve,my=F(()=>{"use strict";Et();jA();Sc();qA();lve=1440*60*1e3});var cve,NA=F(()=>{"use strict";cve=10*6e4});var hy=F(()=>{"use strict";ui();ht();Et()});var FA=F(()=>{"use strict"});var gy=F(()=>{"use strict";FA();ui()});var Zc=F(()=>{"use strict";gy();ui();ht();Ud();Vc();hy()});var fSe,DA=F(()=>{"use strict";ht();hy();Zc();fSe=10*6e4});var LA,KSe,UA=F(()=>{"use strict";ui();Yg();RA();Sc();ht();Ud();ty();py();Et();Vc();my();NA();DA();Zc();LA=new Map([["function_call","function_call_output"],["custom_tool_call","custom_tool_call_output"]]),KSe=new Set([...LA.keys(),...LA.values()])});import{execFile as GJ}from"node:child_process";import{promisify as zJ}from"node:util";var VSe,ZSe,QSe,Gd,YSe,GA=F(()=>{"use strict";VSe=zJ(GJ),ZSe=200*1024*1024,QSe=4320*60*1e3,Gd=String.raw`\bgit\s+(?:-[Cc]\s+\S+\s+|-\S+\s+)*`,YSe=[new RegExp(`${Gd}restore\\b`),new RegExp(`${Gd}checkout\\b[^\\n;|&]*(\\s--(\\s|$)|\\s-f\\b|\\s\\.(\\s|$))`),new RegExp(`${Gd}reset\\b[^\\n;|&]*--(hard|merge|keep)\\b`),new RegExp(`${Gd}clean\\b`),new RegExp(`${Gd}stash\\s+(drop|clear|pop)\\b`),/\brm\s+(-[A-Za-z]*f[A-Za-z]*)\b/]});var _y=F(()=>{"use strict";Ua()});var zA=F(()=>{Vg()});var JA=F(()=>{"use strict";Ua();ht();qd();Et()});function BA(e){return Math.ceil(e.length/4)}function by(e){if(!Ke(e))return;let t=mt(e.ir_version),n=tn(e.nodes);if(!(t===void 0||n===void 0))return{irVersion:t,threadTitle:Q(e.thread_title),nodes:n.flatMap(KJ),hasMore:e.has_more===!0,cursor:mt(e.cursor),budget:BJ(e.budget)}}function KJ(e){if(!Ke(e))return[];let t=Q(e.kind),n=mt(e.seq),i=Q(e.body)??"";return t===void 0||n===void 0?[]:[{kind:t,seq:n,at:Q(e.at),engine:Q(e.engine)??"none",body:i,structured:pe(e.structured),actor:pe(e.actor),messageAuthor:Nc(e.message_author,n),attachments:tn(e.attachments)??[],sourceSeq:mt(e.source_seq),streamKey:Q(e.stream_key)}]}function BJ(e){if(!Ke(e))return;let t=mt(e.context_window),n=mt(e.max_emission_tokens);if(!(t===void 0||n===void 0||n<=0))return{model:Q(e.model),contextWindow:t,maxEmissionTokens:n}}function WJ(e,t){let n=t>0?t:KA,i=e.filter(s=>s.kind!=="reasoning"),r=e.length-i.length,o=[],a=0;for(let s=i.length-1;s>=0;s-=1){let d=i[s];if(d===void 0)continue;let l=BA(WA(d,n));if(o.length>0&&a+l>n)break;a+=l,o.unshift(d)}return{tail:o,omittedNodeCount:i.length-o.length,redactedReasoningCount:r,artifacts:HJ(e)}}function HJ(e){let t=new Set,n=new Set,i=0;for(let r of e){if(r.kind==="error"&&(i+=1),r.kind==="file_change")for(let o of VJ(r.structured))t.add(o);if(r.kind==="command_execution"){let o=Q(r.structured?.command)?.trim();o!==void 0&&o!==""&&n.add(o.split(`
|
|
148
|
+
</linzumi_pr_footer_instruction>`}function Gc(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}var qd=F(()=>{"use strict";ht()});var nA=F(()=>{"use strict";Ua();tA();qd()});var rA=F(()=>{"use strict";ui();Et();ht()});function Nd(e,t){return e.catch(n=>t(Jt(n)))}var Fd=F(()=>{Xt()});var Kc=F(()=>{Kt()});var sy=F(()=>{At();Kt();Ne();$t();Xt();Kc();Ca()});var oA=F(()=>{At();Ca()});var Bge,aA=F(()=>{At();Kt();Ne();Fd();Yt();nt();$t();Xt();sy();Kc();Ca();oA();Bge=1440*60*1e3});var M2,Wge,Bc=F(()=>{Eo();M2=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],Wge=EC(M2)});var sA=F(()=>{});var nye,dA=F(()=>{At();Ne();er();Yt();nt();sA();nye=Object.fromEntries([["granular",Object.fromEntries([["sandbox_approval",!1],["rules",!1],["skill_approval",!1],["request_permissions",!1],["mcp_elicitations",!0]])]])});var Ga=F(()=>{Ne();Bc();sy()});var lye,uye,cye,Ld=F(()=>{At();Ne();Yt();$t();dA();Ga();lye=new RegExp("^https?:\\/\\/","i"),uye=new RegExp("^data:","i"),cye=new RegExp("^file:\\/\\/","i")});var ly=F(()=>{At();Kt();Ne();nt();$t();Ld()});var pA=F(()=>{});var n_e,r_e,i_e,o_e,a_e,s_e,d_e,l_e,u_e,c_e,f_e,p_e,m_e,h_e,g_e,y_e,__e,b_e,v_e,S_e,uy=F(()=>{At();Xg();Ne();fg();Yt();nt();Bc();$t();pA();Ld();Ga();ly();n_e=new RegExp("<[^>]*>","g"),r_e=new RegExp(`data:[^"' )]+`,"g"),i_e=new RegExp("\\s+","g"),o_e=new RegExp("(?:<!doctype\\s+html|<html(?:\\s|>))","i"),a_e=new RegExp("cloudflare|cf-ray|\\bblocked\\b|access denied|\\bchallenge\\b|attention required","i"),s_e=new RegExp("cloudflare|cf-ray","i"),d_e=new RegExp("\\bblocked\\b|access denied","i"),l_e=new RegExp("attention required","i"),u_e=new RegExp("@font-face","i"),c_e=new RegExp("unexpected status (401|403)\\b","i"),f_e=new RegExp("\\b(401|403)\\s+(?:unauthorized|forbidden)\\b","i"),p_e=new RegExp("^(?:model_request_rejected|invalid_request_error|invalid_request|request_rejected|content_policy_violation|content_filter|input_validation_error)$","i"),m_e=new RegExp("\\bmodel request was rejected\\b|\\bmodel_request_rejected\\b","i"),h_e=new RegExp("^provider_outage$","i"),g_e=new RegExp("rejecting requests|experiencing an outage|provider outage","i"),y_e=new RegExp("\\bapply_patch\\b[^]*\\bincompatible\\b|\\bin-flight tool future\\b[^]*\\bfail","i"),__e=new RegExp("\\btools::router\\b[^]*\\bfatal\\b|\\bresponse\\.failed\\b","i"),b_e=new RegExp("(tool.*fatal|fatal.*tool|response[._]failed|tool_failure)","i"),v_e=new RegExp("upstream model stream stalled","i"),S_e=new RegExp("\\(HTTP (\\d{3})\\)")});var T_e,cy=F(()=>{ii();Ne();nt();Xt();Ld();Ga();ly();uy();T_e=10*6e4});var E_e,gA=F(()=>{At();Ne();nt();zu();Xt();cy();Ga();E_e=10*6e4});function fy(e,t){return{message:t,budgetExempt:!1,preserveForRestart:e!==void 0?e:!1}}function vA(e,t){let n=t-e.maxLivePressureAgeMs;return e.activeAckStartedAtMs.some(i=>i<=n)}function Hc(e){return e.replace(iJ,"?").slice(0,128)}function SA(e,t){return sn(e.activeAckStartedAtMs,0,(n,i)=>Math.max(n,t-i))}function oJ(e,t,n,i,r){e.pressureShedCount.contents=e.pressureShedCount.contents+1|0;let o=r!==void 0?r.TAG==="ItemStream"?["item",Hc(r.itemKey),xt(r.turnId,Hc)]:["turn",void 0,Hc(r._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:Hc(i),streamKind:o[0],itemKey:o[1],turnId:o[2]}}function wA(e,t,n,i,r,o){let a=o(),s=oJ(e,t,n,i,r);try{e.onPressureShed(s)}catch{let l=s.branch,u=s.shedCount,c=s.ageMs,p=s.budgetMs,f=s.threadKey,h=s.streamKind,g=s.itemKey,_=s.turnId,y={event:"commander_push.pressure_shed_fallback",branch:l,shedCount:u,ageMs:c,budgetMs:p,threadKey:f,streamKind:h,itemKey:g,turnId:_};try{e.onPressureShedFallback(y)}catch{}}return a}function bA(e){let t=e.now(),n=t-e.maxLivePressureAgeMs,i=vA(e,t),r=[];e.live.activeThreads.forEach(o=>{let a=e.live.pendingByThread.get(o);if(a===void 0)return;let s=a.filter(l=>{let u=l.enqueuedAtMs<=n;if(!i&&!u)return!0;let c=i?"AckPressure":"QueueAge",p;return p=c==="AckPressure"?SA(e,t):t-l.enqueuedAtMs,wA(e,c,p,l.threadKey,l.streamIdentity,()=>aa(l.supersede,f=>f())),!1});s.length!==0?(e.live.pendingByThread.set(o,s),r.push(o)):e.live.pendingByThread.delete(o)}),e.live.activeThreads.splice(0,e.live.activeThreads.length,...r)}function kA(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 i=n.shift();return i!==void 0?(n.length!==0?e.activeThreads.push(t):e.pendingByThread.delete(t),{TAG:"Ok",_0:i}):(e.pendingByThread.delete(t),{TAG:"Error",_0:"Commander push admission thread queue was empty"})}function aJ(e){for(;;){let t=kA(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 i=e.now(),r=vA(e,i),o=n.enqueuedAtMs+e.maxLivePressureAgeMs<=i;if(!r&&!o)return{TAG:"Ok",_0:n};let a=r?"AckPressure":"QueueAge",s;s=a==="AckPressure"?SA(e,i):i-n.enqueuedAtMs,wA(e,a,s,n.threadKey,n.streamIdentity,()=>aa(n.supersede,d=>d()))}}function sJ(e){for(;;){let t=e.priority.activeThreads.length!==0,n=e.live.activeThreads.length!==0,i=e.maxInFlight===1?!0:e.liveInFlight.contents<(e.maxInFlight-1|0),r=n&&i,o=e.consecutivePriority.contents<8,a=0;if(t)a=r&&!o?1:2;else if(r)a=1;else return e.consecutivePriority.contents=0,{TAG:"Ok",_0:void 0};switch(a){case 1:e.consecutivePriority.contents=0;let s=aJ(e);if(s.TAG!=="Ok")return{TAG:"Error",_0:s._0};let d=s._0;if(d!==void 0)return{TAG:"Ok",_0:d};continue;case 2:return e.consecutivePriority.contents=e.consecutivePriority.contents+1|0,kA(e.priority)}}}function dJ(e,t,n,i,r,o){let a=t!==void 0?t:2e3,s=n!==void 0?n:b=>performance.now(),d=i!==void 0?i:(b,v)=>{let w=setTimeout(v,b);return w.unref(),()=>{clearTimeout(w)}},l=r!==void 0?r:b=>{console.warn("commander_push.pressure_shed",b)},u=o!==void 0?o:b=>{console.warn("commander_push.pressure_shed_fallback",b)},c=e>0,p=a>0&&isFinite(a)&&Number.isSafeInteger(a);if(!c)return{TAG:"Error",_0:"Commander push admission maxInFlight must be a positive integer"};if(!p)return{TAG:"Error",_0:"Commander push admission maxLivePressureAgeMs must be positive and finite"};let f={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:b=>{},recomputePressureCheck:()=>{},maxLivePressureAgeMs:a,now:s,schedulePressureCheck:d,activeAckStartedAtMs:[],cancelPressureCheck:{contents:void 0},pressureCheckDeadlineMs:{contents:void 0},onPressureShed:l,onPressureShedFallback:u,pressureShedCount:{contents:0}},h=b=>{let v=f.pressureCheckDeadlineMs.contents;if(v!==void 0){if(v<=b)return;aa(f.cancelPressureCheck.contents,C=>C()),f.pressureCheckDeadlineMs.contents=b;let A=f.schedulePressureCheck(Math.max(1,b-f.now()),()=>{f.cancelPressureCheck.contents=void 0,f.pressureCheckDeadlineMs.contents=void 0,bA(f),f.schedulePump(),f.recomputePressureCheck()});f.cancelPressureCheck.contents=A;return}aa(f.cancelPressureCheck.contents,A=>A()),f.pressureCheckDeadlineMs.contents=b;let w=f.schedulePressureCheck(Math.max(1,b-f.now()),()=>{f.cancelPressureCheck.contents=void 0,f.pressureCheckDeadlineMs.contents=void 0,bA(f),f.schedulePump(),f.recomputePressureCheck()});f.cancelPressureCheck.contents=w},g=()=>{let b={contents:void 0};f.live.pendingByThread.forEach(w=>{w.forEach(A=>{let C=A.enqueuedAtMs+f.maxLivePressureAgeMs,S=b.contents;b.contents=S!==void 0?Math.min(S,C):C})});let v=b.contents;if(v!==void 0)return h(sn(f.activeAckStartedAtMs,v,(w,A)=>Math.min(w,A+f.maxLivePressureAgeMs)))},_=()=>{for(;;){if(f.pumpScheduled.contents=!1,f.inFlight.contents>=f.maxInFlight)return;let b=sJ(f);if(b.TAG==="Ok"){let w=b._0;if(w===void 0)return;let A=f.now();f.inFlight.contents=f.inFlight.contents+1|0,f.activeAckStartedAtMs.push(A),f.live.activeThreads.length!==0&&h(A+f.maxLivePressureAgeMs),w.replaceableLive&&(f.liveInFlight.contents=f.liveInFlight.contents+1|0),Nd(w.task(),C=>{let S=ri(C),k=S!==void 0?Ve(Fr(He(S)),"unknown admission task error"):"unknown admission task error";return w.fail(fy(void 0,k)),Promise.resolve()}).finally(()=>{f.inFlight.contents=f.inFlight.contents-1|0;let C=f.activeAckStartedAtMs.indexOf(A);C!==-1&&f.activeAckStartedAtMs.splice(C,1),w.replaceableLive&&(f.liveInFlight.contents=f.liveInFlight.contents-1|0),f.schedulePump()});continue}let v=b._0;f.priority.pendingByThread.forEach(w=>{w.forEach(A=>A.fail(fy(void 0,v)))}),f.live.pendingByThread.forEach(w=>{w.forEach(A=>A.fail(fy(void 0,v)))}),f.priority.pendingByThread.clear(),f.live.pendingByThread.clear(),f.priority.activeThreads.splice(0,f.priority.activeThreads.length),f.live.activeThreads.splice(0,f.live.activeThreads.length);return}},y=()=>{if(!f.pumpScheduled.contents){f.pumpScheduled.contents=!0,queueMicrotask(_);return}};return f.schedulePump=y,f.armPressureCheck=h,f.recomputePressureCheck=g,{TAG:"Ok",_0:f}}function lJ(e){let t=xt(e[yA],i=>i.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:yA+" must be an integer of at least 2"}}function uJ(e){let t=xt(e[_A],i=>i.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:_A+" must be a positive integer"}}var yA,_A,iJ,P_e,xA=F(()=>{At();ii();Ne();er();Fd();nt();yA="LINZUMI_COMMANDER_PUSH_MAX_INFLIGHT",_A="LINZUMI_COMMANDER_PUSH_PRESSURE_BUDGET_MS";iJ=new RegExp("[^\\x20-\\x7E]","g");P_e=Ni(lJ(process.env),e=>Ni(uJ(process.env),t=>dJ(e,t,void 0,void 0,void 0,void 0)))});var TA=F(()=>{});var I_e,CA=F(()=>{Eo();Rd();I_e=IC(e=>({joinRef:e.item(0,zg(Le)),ref:e.item(1,zg(Le)),topic:e.item(2,Le),event:e.item(3,Le),payload:e.item(4,Da)}))});var F_e,AA,D_e,L_e,U_e,G_e,EA=F(()=>{xa();At();ii();Kt();Ne();er();Fd();Yt();nt();$t();TA();Xt();gg();CA();hg();F_e=new RegExp("/$"),AA="[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]",D_e=new RegExp(AA),L_e=new RegExp(AA,"g"),U_e=new RegExp("^npm install -g @linzumi\\/cli(@[0-9A-Za-z^~.-]{1,32})?$"),G_e=new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]{1,32})?$")});var PA=F(()=>{At();Ne()});var _J,z_e,J_e,bJ,vJ,K_e,B_e,IA=F(()=>{Eo();Ne();Rd();_J=Wr(e=>({decision:e.m(Le),label:e.m(Le),description:e.m(mn(Le))})),z_e=Wr(e=>({decision:e.m(Le)})),J_e=Wr(e=>({status:e.m(Le),response:e.m(Da)})),bJ=xn("terminal"),vJ=To([xn("interrupted"),xn("processed"),xn("failed"),xn("ignored"),xn("stop_failed")]),K_e=Wr(e=>({disposition:e.m(bJ),thread_id:e.m(Le),seq:e.m(xo),status:e.m(vJ),reason:e.m(AC(Le))})),B_e=Wr(e=>({approval_request_id:e.m(Le),approval_kind:e.m(Le),approval_summary:e.m(Le),approval_reason:e.m(mn(Le)),approval_port:e.m(mn(xo)),approval_pid:e.m(mn(xo)),approval_command:e.m(mn(Le)),approval_cwd:e.m(mn(Le)),approval_process_name:e.m(mn(Le)),approval_process_icon_key:e.m(mn(Le)),approval_process_icon_path:e.m(mn(Le)),approval_choices:e.m(mn(TC(_J))),approval_allowed_actor_slug:e.m(mn(Le)),approval_allowed_actor_user_id:e.m(mn(xo))}))});var Cbe,OA=F(()=>{At();ii();Kt();Ne();er();Fd();aA();Wg();Yt();nt();Bc();$t();_g();Xt();cy();gA();xA();Ld();EA();Ga();uy();PA();Ca();IA();Cbe=new RegExp("^item-\\d+$")});var RA=F(()=>{OA()});var kJ,Pbe,xJ,Ibe,Ud=F(()=>{"use strict";kJ=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],Pbe=new Set(kJ),xJ={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"},Ibe=Object.keys(xJ)});var TJ,qbe,py=F(()=>{"use strict";uc();qh();Ii();Et();TJ=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,qbe=new RegExp(TJ.source,"g")});var $A=F(()=>{});var MA=F(()=>{$A()});var Vc=F(()=>{"use strict";ht();MA()});var jA=F(()=>{Kc()});var Zbe,qA=F(()=>{"use strict";Et();ht();Zbe=1024*1024});var lve,my=F(()=>{"use strict";Et();jA();Sc();qA();lve=1440*60*1e3});var cve,NA=F(()=>{"use strict";cve=10*6e4});var hy=F(()=>{"use strict";ui();ht();Et()});var FA=F(()=>{"use strict"});var gy=F(()=>{"use strict";FA();ui()});var Zc=F(()=>{"use strict";gy();ui();ht();Ud();Vc();hy()});var fSe,DA=F(()=>{"use strict";ht();hy();Zc();fSe=10*6e4});var LA,KSe,UA=F(()=>{"use strict";ui();Yg();RA();Sc();ht();Ud();ty();py();Et();Vc();my();NA();DA();Zc();LA=new Map([["function_call","function_call_output"],["custom_tool_call","custom_tool_call_output"]]),KSe=new Set([...LA.keys(),...LA.values()])});import{execFile as GJ}from"node:child_process";import{promisify as zJ}from"node:util";var VSe,ZSe,QSe,Gd,YSe,GA=F(()=>{"use strict";VSe=zJ(GJ),ZSe=200*1024*1024,QSe=4320*60*1e3,Gd=String.raw`\bgit\s+(?:-[Cc]\s+\S+\s+|-\S+\s+)*`,YSe=[new RegExp(`${Gd}restore\\b`),new RegExp(`${Gd}checkout\\b[^\\n;|&]*(\\s--(\\s|$)|\\s-f\\b|\\s\\.(\\s|$))`),new RegExp(`${Gd}reset\\b[^\\n;|&]*--(hard|merge|keep)\\b`),new RegExp(`${Gd}clean\\b`),new RegExp(`${Gd}stash\\s+(drop|clear|pop)\\b`),/\brm\s+(-[A-Za-z]*f[A-Za-z]*)\b/]});var _y=F(()=>{"use strict";Ua()});var zA=F(()=>{Vg()});var JA=F(()=>{"use strict";Ua();ht();qd();Et()});function BA(e){return Math.ceil(e.length/4)}function by(e){if(!Ke(e))return;let t=mt(e.ir_version),n=tn(e.nodes);if(!(t===void 0||n===void 0))return{irVersion:t,threadTitle:Q(e.thread_title),nodes:n.flatMap(KJ),hasMore:e.has_more===!0,cursor:mt(e.cursor),budget:BJ(e.budget)}}function KJ(e){if(!Ke(e))return[];let t=Q(e.kind),n=mt(e.seq),i=Q(e.body)??"";return t===void 0||n===void 0?[]:[{kind:t,seq:n,at:Q(e.at),engine:Q(e.engine)??"none",body:i,structured:pe(e.structured),actor:pe(e.actor),messageAuthor:Nc(e.message_author,n),attachments:tn(e.attachments)??[],sourceSeq:mt(e.source_seq),streamKey:Q(e.stream_key)}]}function BJ(e){if(!Ke(e))return;let t=mt(e.context_window),n=mt(e.max_emission_tokens);if(!(t===void 0||n===void 0||n<=0))return{model:Q(e.model),contextWindow:t,maxEmissionTokens:n}}function WJ(e,t){let n=t>0?t:KA,i=e.filter(s=>s.kind!=="reasoning"),r=e.length-i.length,o=[],a=0;for(let s=i.length-1;s>=0;s-=1){let d=i[s];if(d===void 0)continue;let l=BA(WA(d,n));if(o.length>0&&a+l>n)break;a+=l,o.unshift(d)}return{tail:o,omittedNodeCount:i.length-o.length,redactedReasoningCount:r,artifacts:HJ(e)}}function HJ(e){let t=new Set,n=new Set,i=0;for(let r of e){if(r.kind==="error"&&(i+=1),r.kind==="file_change")for(let o of VJ(r.structured))t.add(o);if(r.kind==="command_execution"){let o=Q(r.structured?.command)?.trim();o!==void 0&&o!==""&&n.add(o.split(`
|
|
149
149
|
`,1)[0]??o)}}return{filesTouched:[...t].slice(0,100),commandsRun:[...n].slice(0,100),errorCount:i}}function VJ(e){if(e===void 0)return[];let t=Q(e.path),i=(tn(e.paths)??tn(e.files)??[]).flatMap(r=>{let o=Q(r);if(o!==void 0)return[o];let a=Ke(r)?Q(r.path):void 0;return a===void 0?[]:[a]});return t===void 0?i:[t,...i]}function vy(e){let t=e.budget?.maxEmissionTokens??KA,n=WJ(e.nodes,t),i=tK({resumeFailure:e.resumeFailure,threadTitle:e.threadTitle,linzumiContext:e.linzumiContext,budgeted:n,transcriptEmpty:n.tail.length===0}),r=[Vr(i,"commentary")],o=0;for(let s of n.tail)o+=1,r.push(...ZJ(s,t,o));let a=r.reduce((s,d)=>s+BA(JSON.stringify(d)),0);return{items:r,emittedNodeCount:n.tail.length,omittedNodeCount:n.omittedNodeCount,redactedReasoningCount:n.redactedReasoningCount,emittedTokenEstimate:a,maxEmissionTokens:t}}function ZJ(e,t,n){let i=WA(e,t);switch(e.kind){case"user_message":return[{type:"message",role:"user",content:[{type:"input_text",text:MC(e.messageAuthor,eK(e,i))}]}];case"assistant_message":return[Vr(i,XJ(e))];case"command_execution":return QJ(e,i,n);case"tool_call":return YJ(e,i,n);case"reasoning":return[];case"file_change":return[Vr(`[file change]
|
|
150
150
|
${i}`,"commentary")];case"terminal_input":return[Vr(`[terminal input]
|
|
151
151
|
${i}`,"commentary")];case"tool_result":return[Vr(`[tool result]
|