agentica 0.15.5 → 0.15.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -85,11 +85,11 @@ execute: new ${s}Service(),
|
|
|
85
85
|
`,_=Buffer.byteLength(F);let E=Math.floor(Math.log(_)/Math.log(10))+1;return _+E>=Math.pow(10,E)&&(E+=1),E+_+F}}s.parse=(e,a,D)=>new s(r(i(e),a),D);const r=(e,a)=>a?Object.keys(e).reduce((D,F)=>(D[F]=e[F],D),a):e,i=e=>e.replace(/\n$/,"").split(`
|
|
86
86
|
`).reduce(o,Object.create(null)),o=(e,a)=>{const D=parseInt(a,10);if(D!==Buffer.byteLength(a)+1)return e;a=a.slice((D+" ").length);const F=a.split("="),_=F.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!_)return e;const E=F.join("=");return e[_]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(_)?new Date(E*1e3):/^[0-9]+$/.test(E)?+E:E,e};return qt=s,qt}var Vt,Rs;function Pe(){return Rs||(Rs=1,Vt=u=>{let t=u.length-1,s=-1;for(;t>-1&&u.charAt(t)==="/";)s=t,t--;return s===-1?u:u.slice(0,s)}),Vt}var Gt,Bs;function Yt(){return Bs||(Bs=1,Gt=u=>class extends u{warn(t,s,r={}){this.file&&(r.file=this.file),this.cwd&&(r.cwd=this.cwd),r.code=s instanceof Error&&s.code||t,r.tarCode=t,!this.strict&&r.recoverable!==!1?(s instanceof Error&&(r=Object.assign(s,r),s=s.message),this.emit("warn",r.tarCode,s,r)):s instanceof Error?this.emit("error",Object.assign(s,r)):this.emit("error",Object.assign(new Error(`${t}: ${s}`),r))}}),Gt}var Kt,xs;function Ts(){if(xs)return Kt;xs=1;const u=["|","<",">","?",":"],t=u.map(i=>String.fromCharCode(61440+i.charCodeAt(0))),s=new Map(u.map((i,o)=>[i,t[o]])),r=new Map(t.map((i,o)=>[i,u[o]]));return Kt={encode:i=>u.reduce((o,e)=>o.split(e).join(s.get(e)),i),decode:i=>t.reduce((o,e)=>o.split(e).join(r.get(e)),i)},Kt}var Zt,$s;function Ns(){if($s)return Zt;$s=1;const{isAbsolute:u,parse:t}=ce.win32;return Zt=s=>{let r="",i=t(s);for(;u(s)||i.root;){const o=s.charAt(0)==="/"&&s.slice(0,4)!=="//?/"?"/":i.root;s=s.slice(o.length),r+=o,i=t(s)}return[r,s]},Zt}var Xt,Is;function Mn(){return Is||(Is=1,Xt=(u,t,s)=>(u&=4095,s&&(u=(u|384)&-19),t&&(u&256&&(u|=64),u&32&&(u|=8),u&4&&(u|=1)),u)),Xt}var Jt,Ls;function Ms(){if(Ls)return Jt;Ls=1;const{Minipass:u}=It(),t=Wt(),s=Me(),r=ge,i=ce,o=Le(),e=Pe(),a=(w,l)=>l?(w=o(w).replace(/^\.(\/|$)/,""),e(l)+"/"+w):o(w),D=16*1024*1024,F=Symbol("process"),_=Symbol("file"),E=Symbol("directory"),C=Symbol("symlink"),b=Symbol("hardlink"),y=Symbol("header"),v=Symbol("read"),S=Symbol("lstat"),A=Symbol("onlstat"),n=Symbol("onread"),h=Symbol("onreadlink"),f=Symbol("openfile"),d=Symbol("onopenfile"),c=Symbol("close"),g=Symbol("mode"),R=Symbol("awaitDrain"),B=Symbol("ondrain"),x=Symbol("prefix"),M=Symbol("hadError"),P=Yt(),j=Ts(),q=Ns(),K=Mn(),N=P(class extends u{constructor(l,p){if(p=p||{},super(p),typeof l!="string")throw new TypeError("path is required");this.path=o(l),this.portable=!!p.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=p.maxReadSize||D,this.linkCache=p.linkCache||new Map,this.statCache=p.statCache||new Map,this.preservePaths=!!p.preservePaths,this.cwd=o(p.cwd||process.cwd()),this.strict=!!p.strict,this.noPax=!!p.noPax,this.noMtime=!!p.noMtime,this.mtime=p.mtime||null,this.prefix=p.prefix?o(p.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof p.onwarn=="function"&&this.on("warn",p.onwarn);let L=!1;if(!this.preservePaths){const[H,J]=q(this.path);H&&(this.path=J,L=H)}this.win32=!!p.win32||process.platform==="win32",this.win32&&(this.path=j.decode(this.path.replace(/\\/g,"/")),l=l.replace(/\\/g,"/")),this.absolute=o(p.absolute||i.resolve(this.cwd,l)),this.path===""&&(this.path="./"),L&&this.warn("TAR_ENTRY_INFO",`stripping ${L} from absolute path`,{entry:this,path:L+this.path}),this.statCache.has(this.absolute)?this[A](this.statCache.get(this.absolute)):this[S]()}emit(l,...p){return l==="error"&&(this[M]=!0),super.emit(l,...p)}[S](){r.lstat(this.absolute,(l,p)=>{if(l)return this.emit("error",l);this[A](p)})}[A](l){this.statCache.set(this.absolute,l),this.stat=l,l.isFile()||(l.size=0),this.type=ee(l),this.emit("stat",l),this[F]()}[F](){switch(this.type){case"File":return this[_]();case"Directory":return this[E]();case"SymbolicLink":return this[C]();default:return this.end()}}[g](l){return K(l,this.type==="Directory",this.portable)}[x](l){return a(l,this.prefix)}[y](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new s({path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,mode:this[g](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new t({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[E](){this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[y](),this.end()}[C](){r.readlink(this.absolute,(l,p)=>{if(l)return this.emit("error",l);this[h](p)})}[h](l){this.linkpath=o(l),this[y](),this.end()}[b](l){this.type="Link",this.linkpath=o(i.relative(this.cwd,l)),this.stat.size=0,this[y](),this.end()}[_](){if(this.stat.nlink>1){const l=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(l)){const p=this.linkCache.get(l);if(p.indexOf(this.cwd)===0)return this[b](p)}this.linkCache.set(l,this.absolute)}if(this[y](),this.stat.size===0)return this.end();this[f]()}[f](){r.open(this.absolute,"r",(l,p)=>{if(l)return this.emit("error",l);this[d](p)})}[d](l){if(this.fd=l,this[M])return this[c]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const p=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(p),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[v]()}[v](){const{fd:l,buf:p,offset:L,length:H,pos:J}=this;r.read(l,p,L,H,J,($,W)=>{if($)return this[c](()=>this.emit("error",$));this[n](W)})}[c](l){r.close(this.fd,l)}[n](l){if(l<=0&&this.remain>0){const H=new Error("encountered unexpected EOF");return H.path=this.absolute,H.syscall="read",H.code="EOF",this[c](()=>this.emit("error",H))}if(l>this.remain){const H=new Error("did not encounter expected EOF");return H.path=this.absolute,H.syscall="read",H.code="EOF",this[c](()=>this.emit("error",H))}if(l===this.remain)for(let H=l;H<this.length&&l<this.blockRemain;H++)this.buf[H+this.offset]=0,l++,this.remain++;const p=this.offset===0&&l===this.buf.length?this.buf:this.buf.slice(this.offset,this.offset+l);this.write(p)?this[B]():this[R](()=>this[B]())}[R](l){this.once("drain",l)}write(l){if(this.blockRemain<l.length){const p=new Error("writing more data than expected");return p.path=this.absolute,this.emit("error",p)}return this.remain-=l.length,this.blockRemain-=l.length,this.pos+=l.length,this.offset+=l.length,super.write(l)}[B](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[c](l=>l?this.emit("error",l):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[v]()}});class V extends N{[S](){this[A](r.lstatSync(this.absolute))}[C](){this[h](r.readlinkSync(this.absolute))}[f](){this[d](r.openSync(this.absolute,"r"))}[v](){let l=!0;try{const{fd:p,buf:L,offset:H,length:J,pos:$}=this,W=r.readSync(p,L,H,J,$);this[n](W),l=!1}finally{if(l)try{this[c](()=>{})}catch{}}}[R](l){l()}[c](l){r.closeSync(this.fd),l()}}const G=P(class extends u{constructor(l,p){p=p||{},super(p),this.preservePaths=!!p.preservePaths,this.portable=!!p.portable,this.strict=!!p.strict,this.noPax=!!p.noPax,this.noMtime=!!p.noMtime,this.readEntry=l,this.type=l.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=p.prefix||null,this.path=o(l.path),this.mode=this[g](l.mode),this.uid=this.portable?null:l.uid,this.gid=this.portable?null:l.gid,this.uname=this.portable?null:l.uname,this.gname=this.portable?null:l.gname,this.size=l.size,this.mtime=this.noMtime?null:p.mtime||l.mtime,this.atime=this.portable?null:l.atime,this.ctime=this.portable?null:l.ctime,this.linkpath=o(l.linkpath),typeof p.onwarn=="function"&&this.on("warn",p.onwarn);let L=!1;if(!this.preservePaths){const[H,J]=q(this.path);H&&(this.path=J,L=H)}this.remain=l.size,this.blockRemain=l.startBlockSize,this.header=new s({path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),L&&this.warn("TAR_ENTRY_INFO",`stripping ${L} from absolute path`,{entry:this,path:L+this.path}),this.header.encode()&&!this.noPax&&super.write(new t({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),l.pipe(this)}[x](l){return a(l,this.prefix)}[g](l){return K(l,this.type==="Directory",this.portable)}write(l){const p=l.length;if(p>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=p,super.write(l)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});N.Sync=V,N.Tar=G;const ee=w=>w.isFile()?"File":w.isDirectory()?"Directory":w.isSymbolicLink()?"SymbolicLink":"Unsupported";return Jt=N,Jt}var Qt,Ps;function Pn(){return Ps||(Ps=1,Qt=function(u){u.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),Qt}var ei,ks;function Hs(){if(ks)return ei;ks=1,ei=u,u.Node=i,u.create=u;function u(o){var e=this;if(e instanceof u||(e=new u),e.tail=null,e.head=null,e.length=0,o&&typeof o.forEach=="function")o.forEach(function(F){e.push(F)});else if(arguments.length>0)for(var a=0,D=arguments.length;a<D;a++)e.push(arguments[a]);return e}u.prototype.removeNode=function(o){if(o.list!==this)throw new Error("removing node which does not belong to this list");var e=o.next,a=o.prev;return e&&(e.prev=a),a&&(a.next=e),o===this.head&&(this.head=e),o===this.tail&&(this.tail=a),o.list.length--,o.next=null,o.prev=null,o.list=null,e},u.prototype.unshiftNode=function(o){if(o!==this.head){o.list&&o.list.removeNode(o);var e=this.head;o.list=this,o.next=e,e&&(e.prev=o),this.head=o,this.tail||(this.tail=o),this.length++}},u.prototype.pushNode=function(o){if(o!==this.tail){o.list&&o.list.removeNode(o);var e=this.tail;o.list=this,o.prev=e,e&&(e.next=o),this.tail=o,this.head||(this.head=o),this.length++}},u.prototype.push=function(){for(var o=0,e=arguments.length;o<e;o++)s(this,arguments[o]);return this.length},u.prototype.unshift=function(){for(var o=0,e=arguments.length;o<e;o++)r(this,arguments[o]);return this.length},u.prototype.pop=function(){if(this.tail){var o=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,o}},u.prototype.shift=function(){if(this.head){var o=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,o}},u.prototype.forEach=function(o,e){e=e||this;for(var a=this.head,D=0;a!==null;D++)o.call(e,a.value,D,this),a=a.next},u.prototype.forEachReverse=function(o,e){e=e||this;for(var a=this.tail,D=this.length-1;a!==null;D--)o.call(e,a.value,D,this),a=a.prev},u.prototype.get=function(o){for(var e=0,a=this.head;a!==null&&e<o;e++)a=a.next;if(e===o&&a!==null)return a.value},u.prototype.getReverse=function(o){for(var e=0,a=this.tail;a!==null&&e<o;e++)a=a.prev;if(e===o&&a!==null)return a.value},u.prototype.map=function(o,e){e=e||this;for(var a=new u,D=this.head;D!==null;)a.push(o.call(e,D.value,this)),D=D.next;return a},u.prototype.mapReverse=function(o,e){e=e||this;for(var a=new u,D=this.tail;D!==null;)a.push(o.call(e,D.value,this)),D=D.prev;return a},u.prototype.reduce=function(o,e){var a,D=this.head;if(arguments.length>1)a=e;else if(this.head)D=this.head.next,a=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var F=0;D!==null;F++)a=o(a,D.value,F),D=D.next;return a},u.prototype.reduceReverse=function(o,e){var a,D=this.tail;if(arguments.length>1)a=e;else if(this.tail)D=this.tail.prev,a=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var F=this.length-1;D!==null;F--)a=o(a,D.value,F),D=D.prev;return a},u.prototype.toArray=function(){for(var o=new Array(this.length),e=0,a=this.head;a!==null;e++)o[e]=a.value,a=a.next;return o},u.prototype.toArrayReverse=function(){for(var o=new Array(this.length),e=0,a=this.tail;a!==null;e++)o[e]=a.value,a=a.prev;return o},u.prototype.slice=function(o,e){e=e||this.length,e<0&&(e+=this.length),o=o||0,o<0&&(o+=this.length);var a=new u;if(e<o||e<0)return a;o<0&&(o=0),e>this.length&&(e=this.length);for(var D=0,F=this.head;F!==null&&D<o;D++)F=F.next;for(;F!==null&&D<e;D++,F=F.next)a.push(F.value);return a},u.prototype.sliceReverse=function(o,e){e=e||this.length,e<0&&(e+=this.length),o=o||0,o<0&&(o+=this.length);var a=new u;if(e<o||e<0)return a;o<0&&(o=0),e>this.length&&(e=this.length);for(var D=this.length,F=this.tail;F!==null&&D>e;D--)F=F.prev;for(;F!==null&&D>o;D--,F=F.prev)a.push(F.value);return a},u.prototype.splice=function(o,e,...a){o>this.length&&(o=this.length-1),o<0&&(o=this.length+o);for(var D=0,F=this.head;F!==null&&D<o;D++)F=F.next;for(var _=[],D=0;F&&D<e;D++)_.push(F.value),F=this.removeNode(F);F===null&&(F=this.tail),F!==this.head&&F!==this.tail&&(F=F.prev);for(var D=0;D<a.length;D++)F=t(this,F,a[D]);return _},u.prototype.reverse=function(){for(var o=this.head,e=this.tail,a=o;a!==null;a=a.prev){var D=a.prev;a.prev=a.next,a.next=D}return this.head=e,this.tail=o,this};function t(o,e,a){var D=e===o.head?new i(a,null,e,o):new i(a,e,e.next,o);return D.next===null&&(o.tail=D),D.prev===null&&(o.head=D),o.length++,D}function s(o,e){o.tail=new i(e,o.tail,null,o),o.head||(o.head=o.tail),o.length++}function r(o,e){o.head=new i(e,null,o.head,o),o.tail||(o.tail=o.head),o.length++}function i(o,e,a,D){if(!(this instanceof i))return new i(o,e,a,D);this.list=D,this.value=o,e?(e.next=this,this.prev=e):this.prev=null,a?(a.prev=this,this.next=a):this.next=null}try{Pn()(u)}catch{}return ei}var ti,Us;function ii(){if(Us)return ti;Us=1;class u{constructor(w,l){this.path=w||"./",this.absolute=l,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}}const{Minipass:t}=It(),s=ys(),r=Ht(),i=Ms(),o=i.Sync,e=i.Tar,a=Hs(),D=Buffer.alloc(1024),F=Symbol("onStat"),_=Symbol("ended"),E=Symbol("queue"),C=Symbol("current"),b=Symbol("process"),y=Symbol("processing"),v=Symbol("processJob"),S=Symbol("jobs"),A=Symbol("jobDone"),n=Symbol("addFSEntry"),h=Symbol("addTarEntry"),f=Symbol("stat"),d=Symbol("readdir"),c=Symbol("onreaddir"),g=Symbol("pipe"),R=Symbol("entry"),B=Symbol("entryOpt"),x=Symbol("writeEntryClass"),M=Symbol("write"),P=Symbol("ondrain"),j=ge,q=ce,K=Yt(),N=Le(),V=K(class extends t{constructor(w){if(super(w),w=w||Object.create(null),this.opt=w,this.file=w.file||"",this.cwd=w.cwd||process.cwd(),this.maxReadSize=w.maxReadSize,this.preservePaths=!!w.preservePaths,this.strict=!!w.strict,this.noPax=!!w.noPax,this.prefix=N(w.prefix||""),this.linkCache=w.linkCache||new Map,this.statCache=w.statCache||new Map,this.readdirCache=w.readdirCache||new Map,this[x]=i,typeof w.onwarn=="function"&&this.on("warn",w.onwarn),this.portable=!!w.portable,this.zip=null,w.gzip||w.brotli){if(w.gzip&&w.brotli)throw new TypeError("gzip and brotli are mutually exclusive");w.gzip&&(typeof w.gzip!="object"&&(w.gzip={}),this.portable&&(w.gzip.portable=!0),this.zip=new s.Gzip(w.gzip)),w.brotli&&(typeof w.brotli!="object"&&(w.brotli={}),this.zip=new s.BrotliCompress(w.brotli)),this.zip.on("data",l=>super.write(l)),this.zip.on("end",l=>super.end()),this.zip.on("drain",l=>this[P]()),this.on("resume",l=>this.zip.resume())}else this.on("drain",this[P]);this.noDirRecurse=!!w.noDirRecurse,this.follow=!!w.follow,this.noMtime=!!w.noMtime,this.mtime=w.mtime||null,this.filter=typeof w.filter=="function"?w.filter:l=>!0,this[E]=new a,this[S]=0,this.jobs=+w.jobs||4,this[y]=!1,this[_]=!1}[M](w){return super.write(w)}add(w){return this.write(w),this}end(w){return w&&this.write(w),this[_]=!0,this[b](),this}write(w){if(this[_])throw new Error("write after end");return w instanceof r?this[h](w):this[n](w),this.flowing}[h](w){const l=N(q.resolve(this.cwd,w.path));if(!this.filter(w.path,w))w.resume();else{const p=new u(w.path,l,!1);p.entry=new e(w,this[B](p)),p.entry.on("end",L=>this[A](p)),this[S]+=1,this[E].push(p)}this[b]()}[n](w){const l=N(q.resolve(this.cwd,w));this[E].push(new u(w,l)),this[b]()}[f](w){w.pending=!0,this[S]+=1;const l=this.follow?"stat":"lstat";j[l](w.absolute,(p,L)=>{w.pending=!1,this[S]-=1,p?this.emit("error",p):this[F](w,L)})}[F](w,l){this.statCache.set(w.absolute,l),w.stat=l,this.filter(w.path,l)||(w.ignore=!0),this[b]()}[d](w){w.pending=!0,this[S]+=1,j.readdir(w.absolute,(l,p)=>{if(w.pending=!1,this[S]-=1,l)return this.emit("error",l);this[c](w,p)})}[c](w,l){this.readdirCache.set(w.absolute,l),w.readdir=l,this[b]()}[b](){if(!this[y]){this[y]=!0;for(let w=this[E].head;w!==null&&this[S]<this.jobs;w=w.next)if(this[v](w.value),w.value.ignore){const l=w.next;this[E].removeNode(w),w.next=l}this[y]=!1,this[_]&&!this[E].length&&this[S]===0&&(this.zip?this.zip.end(D):(super.write(D),super.end()))}}get[C](){return this[E]&&this[E].head&&this[E].head.value}[A](w){this[E].shift(),this[S]-=1,this[b]()}[v](w){if(!w.pending){if(w.entry){w===this[C]&&!w.piped&&this[g](w);return}if(w.stat||(this.statCache.has(w.absolute)?this[F](w,this.statCache.get(w.absolute)):this[f](w)),!!w.stat&&!w.ignore&&!(!this.noDirRecurse&&w.stat.isDirectory()&&!w.readdir&&(this.readdirCache.has(w.absolute)?this[c](w,this.readdirCache.get(w.absolute)):this[d](w),!w.readdir))){if(w.entry=this[R](w),!w.entry){w.ignore=!0;return}w===this[C]&&!w.piped&&this[g](w)}}}[B](w){return{onwarn:(l,p,L)=>this.warn(l,p,L),noPax:this.noPax,cwd:this.cwd,absolute:w.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[R](w){this[S]+=1;try{return new this[x](w.path,this[B](w)).on("end",()=>this[A](w)).on("error",l=>this.emit("error",l))}catch(l){this.emit("error",l)}}[P](){this[C]&&this[C].entry&&this[C].entry.resume()}[g](w){w.piped=!0,w.readdir&&w.readdir.forEach(L=>{const H=w.path,J=H==="./"?"":H.replace(/\/*$/,"/");this[n](J+L)});const l=w.entry,p=this.zip;p?l.on("data",L=>{p.write(L)||l.pause()}):l.on("data",L=>{super.write(L)||l.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}});class G extends V{constructor(w){super(w),this[x]=o}pause(){}resume(){}[f](w){const l=this.follow?"statSync":"lstatSync";this[F](w,j[l](w.absolute))}[d](w,l){this[c](w,j.readdirSync(w.absolute))}[g](w){const l=w.entry,p=this.zip;w.readdir&&w.readdir.forEach(L=>{const H=w.path,J=H==="./"?"":H.replace(/\/*$/,"/");this[n](J+L)}),p?l.on("data",L=>{p.write(L)}):l.on("data",L=>{super[M](L)})}}return V.Sync=G,ti=V,ti}var Re={},js;function ke(){if(js)return Re;js=1;const u=Cs(),t=xe.EventEmitter,s=ge;let r=s.writev;if(!r){const w=process.binding("fs"),l=w.FSReqWrap||w.FSReqCallback;r=(p,L,H,J)=>{const $=(z,O)=>J(z,O,L),W=new l;W.oncomplete=$,w.writeBuffers(p,L,H,W)}}const i=Symbol("_autoClose"),o=Symbol("_close"),e=Symbol("_ended"),a=Symbol("_fd"),D=Symbol("_finished"),F=Symbol("_flags"),_=Symbol("_flush"),E=Symbol("_handleChunk"),C=Symbol("_makeBuf"),b=Symbol("_mode"),y=Symbol("_needDrain"),v=Symbol("_onerror"),S=Symbol("_onopen"),A=Symbol("_onread"),n=Symbol("_onwrite"),h=Symbol("_open"),f=Symbol("_path"),d=Symbol("_pos"),c=Symbol("_queue"),g=Symbol("_read"),R=Symbol("_readSize"),B=Symbol("_reading"),x=Symbol("_remain"),M=Symbol("_size"),P=Symbol("_write"),j=Symbol("_writing"),q=Symbol("_defaultFlag"),K=Symbol("_errored");class N extends u{constructor(l,p){if(p=p||{},super(p),this.readable=!0,this.writable=!1,typeof l!="string")throw new TypeError("path must be a string");this[K]=!1,this[a]=typeof p.fd=="number"?p.fd:null,this[f]=l,this[R]=p.readSize||16*1024*1024,this[B]=!1,this[M]=typeof p.size=="number"?p.size:1/0,this[x]=this[M],this[i]=typeof p.autoClose=="boolean"?p.autoClose:!0,typeof this[a]=="number"?this[g]():this[h]()}get fd(){return this[a]}get path(){return this[f]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[h](){s.open(this[f],"r",(l,p)=>this[S](l,p))}[S](l,p){l?this[v](l):(this[a]=p,this.emit("open",p),this[g]())}[C](){return Buffer.allocUnsafe(Math.min(this[R],this[x]))}[g](){if(!this[B]){this[B]=!0;const l=this[C]();if(l.length===0)return process.nextTick(()=>this[A](null,0,l));s.read(this[a],l,0,l.length,null,(p,L,H)=>this[A](p,L,H))}}[A](l,p,L){this[B]=!1,l?this[v](l):this[E](p,L)&&this[g]()}[o](){if(this[i]&&typeof this[a]=="number"){const l=this[a];this[a]=null,s.close(l,p=>p?this.emit("error",p):this.emit("close"))}}[v](l){this[B]=!0,this[o](),this.emit("error",l)}[E](l,p){let L=!1;return this[x]-=l,l>0&&(L=super.write(l<p.length?p.slice(0,l):p)),(l===0||this[x]<=0)&&(L=!1,this[o](),super.end()),L}emit(l,p){switch(l){case"prefinish":case"finish":break;case"drain":typeof this[a]=="number"&&this[g]();break;case"error":return this[K]?void 0:(this[K]=!0,super.emit(l,p));default:return super.emit(l,p)}}}class V extends N{[h](){let l=!0;try{this[S](null,s.openSync(this[f],"r")),l=!1}finally{l&&this[o]()}}[g](){let l=!0;try{if(!this[B]){this[B]=!0;do{const p=this[C](),L=p.length===0?0:s.readSync(this[a],p,0,p.length,null);if(!this[E](L,p))break}while(!0);this[B]=!1}l=!1}finally{l&&this[o]()}}[o](){if(this[i]&&typeof this[a]=="number"){const l=this[a];this[a]=null,s.closeSync(l),this.emit("close")}}}class G extends t{constructor(l,p){p=p||{},super(p),this.readable=!1,this.writable=!0,this[K]=!1,this[j]=!1,this[e]=!1,this[y]=!1,this[c]=[],this[f]=l,this[a]=typeof p.fd=="number"?p.fd:null,this[b]=p.mode===void 0?438:p.mode,this[d]=typeof p.start=="number"?p.start:null,this[i]=typeof p.autoClose=="boolean"?p.autoClose:!0;const L=this[d]!==null?"r+":"w";this[q]=p.flags===void 0,this[F]=this[q]?L:p.flags,this[a]===null&&this[h]()}emit(l,p){if(l==="error"){if(this[K])return;this[K]=!0}return super.emit(l,p)}get fd(){return this[a]}get path(){return this[f]}[v](l){this[o](),this[j]=!0,this.emit("error",l)}[h](){s.open(this[f],this[F],this[b],(l,p)=>this[S](l,p))}[S](l,p){this[q]&&this[F]==="r+"&&l&&l.code==="ENOENT"?(this[F]="w",this[h]()):l?this[v](l):(this[a]=p,this.emit("open",p),this[_]())}end(l,p){return l&&this.write(l,p),this[e]=!0,!this[j]&&!this[c].length&&typeof this[a]=="number"&&this[n](null,0),this}write(l,p){return typeof l=="string"&&(l=Buffer.from(l,p)),this[e]?(this.emit("error",new Error("write() after end()")),!1):this[a]===null||this[j]||this[c].length?(this[c].push(l),this[y]=!0,!1):(this[j]=!0,this[P](l),!0)}[P](l){s.write(this[a],l,0,l.length,this[d],(p,L)=>this[n](p,L))}[n](l,p){l?this[v](l):(this[d]!==null&&(this[d]+=p),this[c].length?this[_]():(this[j]=!1,this[e]&&!this[D]?(this[D]=!0,this[o](),this.emit("finish")):this[y]&&(this[y]=!1,this.emit("drain"))))}[_](){if(this[c].length===0)this[e]&&this[n](null,0);else if(this[c].length===1)this[P](this[c].pop());else{const l=this[c];this[c]=[],r(this[a],l,this[d],(p,L)=>this[n](p,L))}}[o](){if(this[i]&&typeof this[a]=="number"){const l=this[a];this[a]=null,s.close(l,p=>p?this.emit("error",p):this.emit("close"))}}}class ee extends G{[h](){let l;if(this[q]&&this[F]==="r+")try{l=s.openSync(this[f],this[F],this[b])}catch(p){if(p.code==="ENOENT")return this[F]="w",this[h]();throw p}else l=s.openSync(this[f],this[F],this[b]);this[S](null,l)}[o](){if(this[i]&&typeof this[a]=="number"){const l=this[a];this[a]=null,s.closeSync(l),this.emit("close")}}[P](l){let p=!0;try{this[n](null,s.writeSync(this[a],l,0,l.length,this[d])),p=!1}finally{if(p)try{this[o]()}catch{}}}}return Re.ReadStream=N,Re.ReadStreamSync=V,Re.WriteStream=G,Re.WriteStreamSync=ee,Re}var si,zs;function ri(){if(zs)return si;zs=1;const u=Yt(),t=Me(),s=xe,r=Hs(),i=1024*1024,o=Ht(),e=Wt(),a=ys(),{nextTick:D}=xi,F=Buffer.from([31,139]),_=Symbol("state"),E=Symbol("writeEntry"),C=Symbol("readEntry"),b=Symbol("nextEntry"),y=Symbol("processEntry"),v=Symbol("extendedHeader"),S=Symbol("globalExtendedHeader"),A=Symbol("meta"),n=Symbol("emitMeta"),h=Symbol("buffer"),f=Symbol("queue"),d=Symbol("ended"),c=Symbol("emittedEnd"),g=Symbol("emit"),R=Symbol("unzip"),B=Symbol("consumeChunk"),x=Symbol("consumeChunkSub"),M=Symbol("consumeBody"),P=Symbol("consumeMeta"),j=Symbol("consumeHeader"),q=Symbol("consuming"),K=Symbol("bufferConcat"),N=Symbol("maybeEnd"),V=Symbol("writing"),G=Symbol("aborted"),ee=Symbol("onDone"),w=Symbol("sawValidEntry"),l=Symbol("sawNullBlock"),p=Symbol("sawEOF"),L=Symbol("closeStream"),H=J=>!0;return si=u(class extends s{constructor($){$=$||{},super($),this.file=$.file||"",this[w]=null,this.on(ee,z=>{(this[_]==="begin"||this[w]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone?this.on(ee,$.ondone):this.on(ee,z=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||i,this.filter=typeof $.filter=="function"?$.filter:H;const W=$.file&&($.file.endsWith(".tar.br")||$.file.endsWith(".tbr"));this.brotli=!$.gzip&&$.brotli!==void 0?$.brotli:W?void 0:!1,this.writable=!0,this.readable=!1,this[f]=new r,this[h]=null,this[C]=null,this[E]=null,this[_]="begin",this[A]="",this[v]=null,this[S]=null,this[d]=!1,this[R]=null,this[G]=!1,this[l]=!1,this[p]=!1,this.on("end",()=>this[L]()),typeof $.onwarn=="function"&&this.on("warn",$.onwarn),typeof $.onentry=="function"&&this.on("entry",$.onentry)}[j]($,W){this[w]===null&&(this[w]=!1);let z;try{z=new t($,W,this[v],this[S])}catch(O){return this.warn("TAR_ENTRY_INVALID",O)}if(z.nullBlock)this[l]?(this[p]=!0,this[_]==="begin"&&(this[_]="header"),this[g]("eof")):(this[l]=!0,this[g]("nullBlock"));else if(this[l]=!1,!z.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:z});else if(!z.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:z});else{const O=z.type;if(/^(Symbolic)?Link$/.test(O)&&!z.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:z});else if(!/^(Symbolic)?Link$/.test(O)&&z.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:z});else{const T=this[E]=new o(z,this[v],this[S]);if(!this[w])if(T.remain){const Y=()=>{T.invalid||(this[w]=!0)};T.on("end",Y)}else this[w]=!0;T.meta?T.size>this.maxMetaEntrySize?(T.ignore=!0,this[g]("ignoredEntry",T),this[_]="ignore",T.resume()):T.size>0&&(this[A]="",T.on("data",Y=>this[A]+=Y),this[_]="meta"):(this[v]=null,T.ignore=T.ignore||!this.filter(T.path,T),T.ignore?(this[g]("ignoredEntry",T),this[_]=T.remain?"ignore":"header",T.resume()):(T.remain?this[_]="body":(this[_]="header",T.end()),this[C]?this[f].push(T):(this[f].push(T),this[b]())))}}}[L](){D(()=>this.emit("close"))}[y]($){let W=!0;return $?Array.isArray($)?this.emit.apply(this,$):(this[C]=$,this.emit("entry",$),$.emittedEnd||($.on("end",z=>this[b]()),W=!1)):(this[C]=null,W=!1),W}[b](){do;while(this[y](this[f].shift()));if(!this[f].length){const $=this[C];!$||$.flowing||$.size===$.remain?this[V]||this.emit("drain"):$.once("drain",z=>this.emit("drain"))}}[M]($,W){const z=this[E],O=z.blockRemain,T=O>=$.length&&W===0?$:$.slice(W,W+O);return z.write(T),z.blockRemain||(this[_]="header",this[E]=null,z.end()),T.length}[P]($,W){const z=this[E],O=this[M]($,W);return this[E]||this[n](z),O}[g]($,W,z){!this[f].length&&!this[C]?this.emit($,W,z):this[f].push([$,W,z])}[n]($){switch(this[g]("meta",this[A]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[v]=e.parse(this[A],this[v],!1);break;case"GlobalExtendedHeader":this[S]=e.parse(this[A],this[S],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[v]=this[v]||Object.create(null),this[v].path=this[A].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[v]=this[v]||Object.create(null),this[v].linkpath=this[A].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+$.type)}}abort($){this[G]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($){if(this[G])return;if((this[R]===null||this.brotli===void 0&&this[R]===!1)&&$){if(this[h]&&($=Buffer.concat([this[h],$]),this[h]=null),$.length<F.length)return this[h]=$,!0;for(let T=0;this[R]===null&&T<F.length;T++)$[T]!==F[T]&&(this[R]=!1);const O=this.brotli===void 0;if(this[R]===!1&&O)if($.length<512)if(this[d])this.brotli=!0;else return this[h]=$,!0;else try{new t($.slice(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[R]===null||this[R]===!1&&this.brotli){const T=this[d];this[d]=!1,this[R]=this[R]===null?new a.Unzip:new a.BrotliDecompress,this[R].on("data",ue=>this[B](ue)),this[R].on("error",ue=>this.abort(ue)),this[R].on("end",ue=>{this[d]=!0,this[B]()}),this[V]=!0;const Y=this[R][T?"end":"write"]($);return this[V]=!1,Y}}this[V]=!0,this[R]?this[R].write($):this[B]($),this[V]=!1;const z=this[f].length?!1:this[C]?this[C].flowing:!0;return!z&&!this[f].length&&this[C].once("drain",O=>this.emit("drain")),z}[K]($){$&&!this[G]&&(this[h]=this[h]?Buffer.concat([this[h],$]):$)}[N](){if(this[d]&&!this[c]&&!this[G]&&!this[q]){this[c]=!0;const $=this[E];if($&&$.blockRemain){const W=this[h]?this[h].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${W} available)`,{entry:$}),this[h]&&$.write(this[h]),$.end()}this[g](ee)}}[B]($){if(this[q])this[K]($);else if(!$&&!this[h])this[N]();else{if(this[q]=!0,this[h]){this[K]($);const W=this[h];this[h]=null,this[x](W)}else this[x]($);for(;this[h]&&this[h].length>=512&&!this[G]&&!this[p];){const W=this[h];this[h]=null,this[x](W)}this[q]=!1}(!this[h]||this[d])&&this[N]()}[x]($){let W=0;const z=$.length;for(;W+512<=z&&!this[G]&&!this[p];)switch(this[_]){case"begin":case"header":this[j]($,W),W+=512;break;case"ignore":case"body":W+=this[M]($,W);break;case"meta":W+=this[P]($,W);break;default:throw new Error("invalid state: "+this[_])}W<z&&(this[h]?this[h]=Buffer.concat([$.slice(W),this[h]]):this[h]=$.slice(W))}end($){this[G]||(this[R]?this[R].end($):(this[d]=!0,this.brotli===void 0&&($=$||Buffer.alloc(0)),this.write($)))}}),si}var ni,qs;function ui(){if(qs)return ni;qs=1;const u=Ie(),t=ri(),s=ge,r=ke(),i=ce,o=Pe();ni=(E,C,b)=>{typeof E=="function"?(b=E,C=null,E={}):Array.isArray(E)&&(C=E,E={}),typeof C=="function"&&(b=C,C=null),C?C=Array.from(C):C=[];const y=u(E);if(y.sync&&typeof b=="function")throw new TypeError("callback not supported for sync tar functions");if(!y.file&&typeof b=="function")throw new TypeError("callback only supported with file option");return C.length&&a(y,C),y.noResume||e(y),y.file&&y.sync?D(y):y.file?F(y,b):_(y)};const e=E=>{const C=E.onentry;E.onentry=C?b=>{C(b),b.resume()}:b=>b.resume()},a=(E,C)=>{const b=new Map(C.map(S=>[o(S),!0])),y=E.filter,v=(S,A)=>{const n=A||i.parse(S).root||".",h=S===n?!1:b.has(S)?b.get(S):v(i.dirname(S),n);return b.set(S,h),h};E.filter=y?(S,A)=>y(S,A)&&v(o(S)):S=>v(o(S))},D=E=>{const C=_(E),b=E.file;let y=!0,v;try{const S=s.statSync(b),A=E.maxReadSize||16*1024*1024;if(S.size<A)C.end(s.readFileSync(b));else{let n=0;const h=Buffer.allocUnsafe(A);for(v=s.openSync(b,"r");n<S.size;){const f=s.readSync(v,h,0,A,n);n+=f,C.write(h.slice(0,f))}C.end()}y=!1}finally{if(y&&v)try{s.closeSync(v)}catch{}}},F=(E,C)=>{const b=new t(E),y=E.maxReadSize||16*1024*1024,v=E.file,S=new Promise((A,n)=>{b.on("error",n),b.on("end",A),s.stat(v,(h,f)=>{if(h)n(h);else{const d=new r.ReadStream(v,{readSize:y,size:f.size});d.on("error",n),d.pipe(b)}})});return C?S.then(C,C):S},_=E=>new t(E);return ni}var oi,Ws;function kn(){if(Ws)return oi;Ws=1;const u=Ie(),t=ii(),s=ke(),r=ui(),i=ce;oi=(E,C,b)=>{if(typeof C=="function"&&(b=C),Array.isArray(E)&&(C=E,E={}),!C||!Array.isArray(C)||!C.length)throw new TypeError("no files or directories specified");C=Array.from(C);const y=u(E);if(y.sync&&typeof b=="function")throw new TypeError("callback not supported for sync tar functions");if(!y.file&&typeof b=="function")throw new TypeError("callback only supported with file option");return y.file&&y.sync?o(y,C):y.file?e(y,C,b):y.sync?F(y,C):_(y,C)};const o=(E,C)=>{const b=new t.Sync(E),y=new s.WriteStreamSync(E.file,{mode:E.mode||438});b.pipe(y),a(b,C)},e=(E,C,b)=>{const y=new t(E),v=new s.WriteStream(E.file,{mode:E.mode||438});y.pipe(v);const S=new Promise((A,n)=>{v.on("error",n),v.on("close",A),y.on("error",n)});return D(y,C),b?S.then(b,b):S},a=(E,C)=>{C.forEach(b=>{b.charAt(0)==="@"?r({file:i.resolve(E.cwd,b.slice(1)),sync:!0,noResume:!0,onentry:y=>E.add(y)}):E.add(b)}),E.end()},D=(E,C)=>{for(;C.length;){const b=C.shift();if(b.charAt(0)==="@")return r({file:i.resolve(E.cwd,b.slice(1)),noResume:!0,onentry:y=>E.add(y)}).then(y=>D(E,C));E.add(b)}E.end()},F=(E,C)=>{const b=new t.Sync(E);return a(b,C),b},_=(E,C)=>{const b=new t(E);return D(b,C),b};return oi}var ai,Vs;function Gs(){if(Vs)return ai;Vs=1;const u=Ie(),t=ii(),s=ge,r=ke(),i=ui(),o=ce,e=Me();ai=(C,b,y)=>{const v=u(C);if(!v.file)throw new TypeError("file is required");if(v.gzip||v.brotli||v.file.endsWith(".br")||v.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!b||!Array.isArray(b)||!b.length)throw new TypeError("no files or directories specified");return b=Array.from(b),v.sync?a(v,b):F(v,b,y)};const a=(C,b)=>{const y=new t.Sync(C);let v=!0,S,A;try{try{S=s.openSync(C.file,"r+")}catch(f){if(f.code==="ENOENT")S=s.openSync(C.file,"w+");else throw f}const n=s.fstatSync(S),h=Buffer.alloc(512);e:for(A=0;A<n.size;A+=512){for(let c=0,g=0;c<512;c+=g){if(g=s.readSync(S,h,c,h.length-c,A+c),A===0&&h[0]===31&&h[1]===139)throw new Error("cannot append to compressed archives");if(!g)break e}const f=new e(h);if(!f.cksumValid)break;const d=512*Math.ceil(f.size/512);if(A+d+512>n.size)break;A+=d,C.mtimeCache&&C.mtimeCache.set(f.path,f.mtime)}v=!1,D(C,y,A,S,b)}finally{if(v)try{s.closeSync(S)}catch{}}},D=(C,b,y,v,S)=>{const A=new r.WriteStreamSync(C.file,{fd:v,start:y});b.pipe(A),_(b,S)},F=(C,b,y)=>{b=Array.from(b);const v=new t(C),S=(n,h,f)=>{const d=(x,M)=>{x?s.close(n,P=>f(x)):f(null,M)};let c=0;if(h===0)return d(null,0);let g=0;const R=Buffer.alloc(512),B=(x,M)=>{if(x)return d(x);if(g+=M,g<512&&M)return s.read(n,R,g,R.length-g,c+g,B);if(c===0&&R[0]===31&&R[1]===139)return d(new Error("cannot append to compressed archives"));if(g<512)return d(null,c);const P=new e(R);if(!P.cksumValid)return d(null,c);const j=512*Math.ceil(P.size/512);if(c+j+512>h||(c+=j+512,c>=h))return d(null,c);C.mtimeCache&&C.mtimeCache.set(P.path,P.mtime),g=0,s.read(n,R,0,512,c,B)};s.read(n,R,0,512,c,B)},A=new Promise((n,h)=>{v.on("error",h);let f="r+";const d=(c,g)=>{if(c&&c.code==="ENOENT"&&f==="r+")return f="w+",s.open(C.file,f,d);if(c)return h(c);s.fstat(g,(R,B)=>{if(R)return s.close(g,()=>h(R));S(g,B.size,(x,M)=>{if(x)return h(x);const P=new r.WriteStream(C.file,{fd:g,start:M});v.pipe(P),P.on("error",h),P.on("close",n),E(v,b)})})};s.open(C.file,f,d)});return y?A.then(y,y):A},_=(C,b)=>{b.forEach(y=>{y.charAt(0)==="@"?i({file:o.resolve(C.cwd,y.slice(1)),sync:!0,noResume:!0,onentry:v=>C.add(v)}):C.add(y)}),C.end()},E=(C,b)=>{for(;b.length;){const y=b.shift();if(y.charAt(0)==="@")return i({file:o.resolve(C.cwd,y.slice(1)),noResume:!0,onentry:v=>C.add(v)}).then(v=>E(C,b));C.add(y)}C.end()};return ai}var hi,Ys;function Hn(){if(Ys)return hi;Ys=1;const u=Ie(),t=Gs();hi=(r,i,o)=>{const e=u(r);if(!e.file)throw new TypeError("file is required");if(e.gzip||e.brotli||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!i||!Array.isArray(i)||!i.length)throw new TypeError("no files or directories specified");return i=Array.from(i),s(e),t(e,i,o)};const s=r=>{const i=r.filter;r.mtimeCache||(r.mtimeCache=new Map),r.filter=i?(o,e)=>i(o,e)&&!(r.mtimeCache.get(o)>e.mtime):(o,e)=>!(r.mtimeCache.get(o)>e.mtime)};return hi}var Qe={exports:{}},li,Ks;function Un(){if(Ks)return li;Ks=1;const{promisify:u}=Sr,t=ge;return li=r=>{if(!r)r={mode:511,fs:t};else if(typeof r=="object")r={mode:511,fs:t,...r};else if(typeof r=="number")r={mode:r,fs:t};else if(typeof r=="string")r={mode:parseInt(r,8),fs:t};else throw new TypeError("invalid options argument");return r.mkdir=r.mkdir||r.fs.mkdir||t.mkdir,r.mkdirAsync=u(r.mkdir),r.stat=r.stat||r.fs.stat||t.stat,r.statAsync=u(r.stat),r.statSync=r.statSync||r.fs.statSync||t.statSync,r.mkdirSync=r.mkdirSync||r.fs.mkdirSync||t.mkdirSync,r},li}var ci,Zs;function jn(){if(Zs)return ci;Zs=1;const u=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:t,parse:s}=ce;return ci=i=>{if(/\0/.test(i))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:i,code:"ERR_INVALID_ARG_VALUE"});if(i=t(i),u==="win32"){const o=/[*|"<>?:]/,{root:e}=s(i);if(o.test(i.substr(e.length)))throw Object.assign(new Error("Illegal characters in path."),{path:i,code:"EINVAL"})}return i},ci}var Di,Xs;function zn(){if(Xs)return Di;Xs=1;const{dirname:u}=ce,t=(r,i,o=void 0)=>o===i?Promise.resolve():r.statAsync(i).then(e=>e.isDirectory()?o:void 0,e=>e.code==="ENOENT"?t(r,u(i),i):void 0),s=(r,i,o=void 0)=>{if(o!==i)try{return r.statSync(i).isDirectory()?o:void 0}catch(e){return e.code==="ENOENT"?s(r,u(i),i):void 0}};return Di={findMade:t,findMadeSync:s},Di}var fi,Js;function Qs(){if(Js)return fi;Js=1;const{dirname:u}=ce,t=(r,i,o)=>{i.recursive=!1;const e=u(r);return e===r?i.mkdirAsync(r,i).catch(a=>{if(a.code!=="EISDIR")throw a}):i.mkdirAsync(r,i).then(()=>o||r,a=>{if(a.code==="ENOENT")return t(e,i).then(D=>t(r,i,D));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;return i.statAsync(r).then(D=>{if(D.isDirectory())return o;throw a},()=>{throw a})})},s=(r,i,o)=>{const e=u(r);if(i.recursive=!1,e===r)try{return i.mkdirSync(r,i)}catch(a){if(a.code!=="EISDIR")throw a;return}try{return i.mkdirSync(r,i),o||r}catch(a){if(a.code==="ENOENT")return s(r,i,s(e,i,o));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;try{if(!i.statSync(r).isDirectory())throw a}catch{throw a}}};return fi={mkdirpManual:t,mkdirpManualSync:s},fi}var di,er;function qn(){if(er)return di;er=1;const{dirname:u}=ce,{findMade:t,findMadeSync:s}=zn(),{mkdirpManual:r,mkdirpManualSync:i}=Qs();return di={mkdirpNative:(a,D)=>(D.recursive=!0,u(a)===a?D.mkdirAsync(a,D):t(D,a).then(_=>D.mkdirAsync(a,D).then(()=>_).catch(E=>{if(E.code==="ENOENT")return r(a,D);throw E}))),mkdirpNativeSync:(a,D)=>{if(D.recursive=!0,u(a)===a)return D.mkdirSync(a,D);const _=s(D,a);try{return D.mkdirSync(a,D),_}catch(E){if(E.code==="ENOENT")return i(a,D);throw E}}},di}var mi,tr;function Wn(){if(tr)return mi;tr=1;const u=ge,s=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),r=+s[0]>10||+s[0]==10&&+s[1]>=12;return mi={useNative:r?e=>e.mkdir===u.mkdir:()=>!1,useNativeSync:r?e=>e.mkdirSync===u.mkdirSync:()=>!1},mi}var pi,ir;function Vn(){if(ir)return pi;ir=1;const u=Un(),t=jn(),{mkdirpNative:s,mkdirpNativeSync:r}=qn(),{mkdirpManual:i,mkdirpManualSync:o}=Qs(),{useNative:e,useNativeSync:a}=Wn(),D=(_,E)=>(_=t(_),E=u(E),e(E)?s(_,E):i(_,E)),F=(_,E)=>(_=t(_),E=u(E),a(E)?r(_,E):o(_,E));return D.sync=F,D.native=(_,E)=>s(t(_),u(E)),D.manual=(_,E)=>i(t(_),u(E)),D.nativeSync=(_,E)=>r(t(_),u(E)),D.manualSync=(_,E)=>o(t(_),u(E)),pi=D,pi}var Ei,sr;function Gn(){if(sr)return Ei;sr=1;const u=ge,t=ce,s=u.lchown?"lchown":"chown",r=u.lchownSync?"lchownSync":"chownSync",i=u.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),o=(A,n,h)=>{try{return u[r](A,n,h)}catch(f){if(f.code!=="ENOENT")throw f}},e=(A,n,h)=>{try{return u.chownSync(A,n,h)}catch(f){if(f.code!=="ENOENT")throw f}},a=i?(A,n,h,f)=>d=>{!d||d.code!=="EISDIR"?f(d):u.chown(A,n,h,f)}:(A,n,h,f)=>f,D=i?(A,n,h)=>{try{return o(A,n,h)}catch(f){if(f.code!=="EISDIR")throw f;e(A,n,h)}}:(A,n,h)=>o(A,n,h),F=process.version;let _=(A,n,h)=>u.readdir(A,n,h),E=(A,n)=>u.readdirSync(A,n);/^v4\./.test(F)&&(_=(A,n,h)=>u.readdir(A,h));const C=(A,n,h,f)=>{u[s](A,n,h,a(A,n,h,d=>{f(d&&d.code!=="ENOENT"?d:null)}))},b=(A,n,h,f,d)=>{if(typeof n=="string")return u.lstat(t.resolve(A,n),(c,g)=>{if(c)return d(c.code!=="ENOENT"?c:null);g.name=n,b(A,g,h,f,d)});if(n.isDirectory())y(t.resolve(A,n.name),h,f,c=>{if(c)return d(c);const g=t.resolve(A,n.name);C(g,h,f,d)});else{const c=t.resolve(A,n.name);C(c,h,f,d)}},y=(A,n,h,f)=>{_(A,{withFileTypes:!0},(d,c)=>{if(d){if(d.code==="ENOENT")return f();if(d.code!=="ENOTDIR"&&d.code!=="ENOTSUP")return f(d)}if(d||!c.length)return C(A,n,h,f);let g=c.length,R=null;const B=x=>{if(!R){if(x)return f(R=x);if(--g===0)return C(A,n,h,f)}};c.forEach(x=>b(A,x,n,h,B))})},v=(A,n,h,f)=>{if(typeof n=="string")try{const d=u.lstatSync(t.resolve(A,n));d.name=n,n=d}catch(d){if(d.code==="ENOENT")return;throw d}n.isDirectory()&&S(t.resolve(A,n.name),h,f),D(t.resolve(A,n.name),h,f)},S=(A,n,h)=>{let f;try{f=E(A,{withFileTypes:!0})}catch(d){if(d.code==="ENOENT")return;if(d.code==="ENOTDIR"||d.code==="ENOTSUP")return D(A,n,h);throw d}return f&&f.length&&f.forEach(d=>v(A,d,n,h)),D(A,n,h)};return Ei=y,y.sync=S,Ei}var rr;function Yn(){if(rr)return Qe.exports;rr=1;const u=Vn(),t=ge,s=ce,r=Gn(),i=Le();class o extends Error{constructor(y,v){super("Cannot extract through symbolic link"),this.path=v,this.symlink=y}get name(){return"SylinkError"}}class e extends Error{constructor(y,v){super(v+": Cannot cd into '"+y+"'"),this.path=y,this.code=v}get name(){return"CwdError"}}const a=(b,y)=>b.get(i(y)),D=(b,y,v)=>b.set(i(y),v),F=(b,y)=>{t.stat(b,(v,S)=>{(v||!S.isDirectory())&&(v=new e(b,v&&v.code||"ENOTDIR")),y(v)})};Qe.exports=(b,y,v)=>{b=i(b);const S=y.umask,A=y.mode|448,n=(A&S)!==0,h=y.uid,f=y.gid,d=typeof h=="number"&&typeof f=="number"&&(h!==y.processUid||f!==y.processGid),c=y.preserve,g=y.unlink,R=y.cache,B=i(y.cwd),x=(j,q)=>{j?v(j):(D(R,b,!0),q&&d?r(q,h,f,K=>x(K)):n?t.chmod(b,A,v):v())};if(R&&a(R,b)===!0)return x();if(b===B)return F(b,x);if(c)return u(b,{mode:A}).then(j=>x(null,j),x);const P=i(s.relative(B,b)).split("/");_(B,P,A,R,g,B,null,x)};const _=(b,y,v,S,A,n,h,f)=>{if(!y.length)return f(null,h);const d=y.shift(),c=i(s.resolve(b+"/"+d));if(a(S,c))return _(c,y,v,S,A,n,h,f);t.mkdir(c,v,E(c,y,v,S,A,n,h,f))},E=(b,y,v,S,A,n,h,f)=>d=>{d?t.lstat(b,(c,g)=>{if(c)c.path=c.path&&i(c.path),f(c);else if(g.isDirectory())_(b,y,v,S,A,n,h,f);else if(A)t.unlink(b,R=>{if(R)return f(R);t.mkdir(b,v,E(b,y,v,S,A,n,h,f))});else{if(g.isSymbolicLink())return f(new o(b,b+"/"+y.join("/")));f(d)}}):(h=h||b,_(b,y,v,S,A,n,h,f))},C=b=>{let y=!1,v="ENOTDIR";try{y=t.statSync(b).isDirectory()}catch(S){v=S.code}finally{if(!y)throw new e(b,v)}};return Qe.exports.sync=(b,y)=>{b=i(b);const v=y.umask,S=y.mode|448,A=(S&v)!==0,n=y.uid,h=y.gid,f=typeof n=="number"&&typeof h=="number"&&(n!==y.processUid||h!==y.processGid),d=y.preserve,c=y.unlink,g=y.cache,R=i(y.cwd),B=j=>{D(g,b,!0),j&&f&&r.sync(j,n,h),A&&t.chmodSync(b,S)};if(g&&a(g,b)===!0)return B();if(b===R)return C(R),B();if(d)return B(u.sync(b,S));const M=i(s.relative(R,b)).split("/");let P=null;for(let j=M.shift(),q=R;j&&(q+="/"+j);j=M.shift())if(q=i(s.resolve(q)),!a(g,q))try{t.mkdirSync(q,S),P=P||q,D(g,q,!0)}catch{const N=t.lstatSync(q);if(N.isDirectory()){D(g,q,!0);continue}else if(c){t.unlinkSync(q),t.mkdirSync(q,S),P=P||q,D(g,q,!0);continue}else if(N.isSymbolicLink())return new o(q,q+"/"+M.join("/"))}return B(P)},Qe.exports}var gi,nr;function ur(){if(nr)return gi;nr=1;const u=Object.create(null),{hasOwnProperty:t}=Object.prototype;return gi=s=>(t.call(u,s)||(u[s]=s.normalize("NFD")),u[s]),gi}var Ci,or;function Kn(){if(or)return Ci;or=1;const u=ht,t=ur(),s=Pe(),{join:r}=ce,o=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32";return Ci=()=>{const e=new Map,a=new Map,D=v=>v.split("/").slice(0,-1).reduce((A,n)=>(A.length&&(n=r(A[A.length-1],n)),A.push(n||"/"),A),[]),F=new Set,_=v=>{const S=a.get(v);if(!S)throw new Error("function does not have any path reservations");return{paths:S.paths.map(A=>e.get(A)),dirs:[...S.dirs].map(A=>e.get(A))}},E=v=>{const{paths:S,dirs:A}=_(v);return S.every(n=>n[0]===v)&&A.every(n=>n[0]instanceof Set&&n[0].has(v))},C=v=>F.has(v)||!E(v)?!1:(F.add(v),v(()=>b(v)),!0),b=v=>{if(!F.has(v))return!1;const{paths:S,dirs:A}=a.get(v),n=new Set;return S.forEach(h=>{const f=e.get(h);u.equal(f[0],v),f.length===1?e.delete(h):(f.shift(),typeof f[0]=="function"?n.add(f[0]):f[0].forEach(d=>n.add(d)))}),A.forEach(h=>{const f=e.get(h);u(f[0]instanceof Set),f[0].size===1&&f.length===1?e.delete(h):f[0].size===1?(f.shift(),n.add(f[0])):f[0].delete(v)}),F.delete(v),n.forEach(h=>C(h)),!0};return{check:E,reserve:(v,S)=>{v=o?["win32 parallelization disabled"]:v.map(n=>s(r(t(n))).toLowerCase());const A=new Set(v.map(n=>D(n)).reduce((n,h)=>n.concat(h)));return a.set(S,{dirs:A,paths:v}),v.forEach(n=>{const h=e.get(n);h?h.push(S):e.set(n,[S])}),A.forEach(n=>{const h=e.get(n);h?h[h.length-1]instanceof Set?h[h.length-1].add(S):h.push(new Set([S])):e.set(n,[new Set([S])])}),C(S)}}},Ci}var Fi,ar;function Zn(){if(ar)return Fi;ar=1;const t=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",s=lt.__FAKE_TESTING_FS__||ge,{O_CREAT:r,O_TRUNC:i,O_WRONLY:o,UV_FS_O_FILEMAP:e=0}=s.constants,a=t&&!!e,D=512*1024,F=e|i|r|o;return Fi=a?_=>_<D?F:"w":()=>"w",Fi}var yi,hr;function lr(){if(hr)return yi;hr=1;const u=ht,t=ri(),s=ge,r=ke(),i=ce,o=Yn(),e=Ts(),a=Kn(),D=Ns(),F=Le(),_=Pe(),E=ur(),C=Symbol("onEntry"),b=Symbol("checkFs"),y=Symbol("checkFs2"),v=Symbol("pruneCache"),S=Symbol("isReusable"),A=Symbol("makeFs"),n=Symbol("file"),h=Symbol("directory"),f=Symbol("link"),d=Symbol("symlink"),c=Symbol("hardlink"),g=Symbol("unsupported"),R=Symbol("checkPath"),B=Symbol("mkdir"),x=Symbol("onError"),M=Symbol("pending"),P=Symbol("pend"),j=Symbol("unpend"),q=Symbol("ended"),K=Symbol("maybeClose"),N=Symbol("skip"),V=Symbol("doChown"),G=Symbol("uid"),ee=Symbol("gid"),w=Symbol("checkedCwd"),l=Or,p=Zn(),H=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",J=1024,$=(te,m)=>{if(!H)return s.unlink(te,m);const k=te+".DELETE."+l.randomBytes(16).toString("hex");s.rename(te,k,U=>{if(U)return m(U);s.unlink(k,m)})},W=te=>{if(!H)return s.unlinkSync(te);const m=te+".DELETE."+l.randomBytes(16).toString("hex");s.renameSync(te,m),s.unlinkSync(m)},z=(te,m,k)=>te===te>>>0?te:m===m>>>0?m:k,O=te=>_(F(E(te))).toLowerCase(),T=(te,m)=>{m=O(m);for(const k of te.keys()){const U=O(k);(U===m||U.indexOf(m+"/")===0)&&te.delete(k)}},Y=te=>{for(const m of te.keys())te.delete(m)};class ue extends t{constructor(m){if(m||(m={}),m.ondone=k=>{this[q]=!0,this[K]()},super(m),this[w]=!1,this.reservations=a(),this.transform=typeof m.transform=="function"?m.transform:null,this.writable=!0,this.readable=!1,this[M]=0,this[q]=!1,this.dirCache=m.dirCache||new Map,typeof m.uid=="number"||typeof m.gid=="number"){if(typeof m.uid!="number"||typeof m.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(m.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=m.uid,this.gid=m.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;m.preserveOwner===void 0&&typeof m.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!m.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.maxDepth=typeof m.maxDepth=="number"?m.maxDepth:J,this.forceChown=m.forceChown===!0,this.win32=!!m.win32||H,this.newer=!!m.newer,this.keep=!!m.keep,this.noMtime=!!m.noMtime,this.preservePaths=!!m.preservePaths,this.unlink=!!m.unlink,this.cwd=F(i.resolve(m.cwd||process.cwd())),this.strip=+m.strip||0,this.processUmask=m.noChmod?0:process.umask(),this.umask=typeof m.umask=="number"?m.umask:this.processUmask,this.dmode=m.dmode||511&~this.umask,this.fmode=m.fmode||438&~this.umask,this.on("entry",k=>this[C](k))}warn(m,k,U={}){return(m==="TAR_BAD_ARCHIVE"||m==="TAR_ABORT")&&(U.recoverable=!1),super.warn(m,k,U)}[K](){this[q]&&this[M]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[R](m){const k=F(m.path),U=k.split("/");if(this.strip){if(U.length<this.strip)return!1;if(m.type==="Link"){const Z=F(m.linkpath).split("/");if(Z.length>=this.strip)m.linkpath=Z.slice(this.strip).join("/");else return!1}U.splice(0,this.strip),m.path=U.join("/")}if(isFinite(this.maxDepth)&&U.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:m,path:k,depth:U.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(U.includes("..")||H&&/^[a-z]:\.\.$/i.test(U[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:m,path:k}),!1;const[Z,X]=D(k);Z&&(m.path=X,this.warn("TAR_ENTRY_INFO",`stripping ${Z} from absolute path`,{entry:m,path:k}))}if(i.isAbsolute(m.path)?m.absolute=F(i.resolve(m.path)):m.absolute=F(i.resolve(this.cwd,m.path)),!this.preservePaths&&m.absolute.indexOf(this.cwd+"/")!==0&&m.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:m,path:F(m.path),resolvedPath:m.absolute,cwd:this.cwd}),!1;if(m.absolute===this.cwd&&m.type!=="Directory"&&m.type!=="GNUDumpDir")return!1;if(this.win32){const{root:Z}=i.win32.parse(m.absolute);m.absolute=Z+e.encode(m.absolute.slice(Z.length));const{root:X}=i.win32.parse(m.path);m.path=X+e.encode(m.path.slice(X.length))}return!0}[C](m){if(!this[R](m))return m.resume();switch(u.equal(typeof m.absolute,"string"),m.type){case"Directory":case"GNUDumpDir":m.mode&&(m.mode=m.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[b](m);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[g](m)}}[x](m,k){m.name==="CwdError"?this.emit("error",m):(this.warn("TAR_ENTRY_ERROR",m,{entry:k}),this[j](),k.resume())}[B](m,k,U){o(F(m),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:k,noChmod:this.noChmod},U)}[V](m){return this.forceChown||this.preserveOwner&&(typeof m.uid=="number"&&m.uid!==this.processUid||typeof m.gid=="number"&&m.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[G](m){return z(this.uid,m.uid,this.processUid)}[ee](m){return z(this.gid,m.gid,this.processGid)}[n](m,k){const U=m.mode&4095||this.fmode,Z=new r.WriteStream(m.absolute,{flags:p(m.size),mode:U,autoClose:!1});Z.on("error",se=>{Z.fd&&s.close(Z.fd,()=>{}),Z.write=()=>!0,this[x](se,m),k()});let X=1;const ne=se=>{if(se){Z.fd&&s.close(Z.fd,()=>{}),this[x](se,m),k();return}--X===0&&s.close(Z.fd,he=>{he?this[x](he,m):this[j](),k()})};Z.on("finish",se=>{const he=m.absolute,Fe=Z.fd;if(m.mtime&&!this.noMtime){X++;const ye=m.atime||new Date,_e=m.mtime;s.futimes(Fe,ye,_e,Be=>Be?s.utimes(he,ye,_e,nt=>ne(nt&&Be)):ne())}if(this[V](m)){X++;const ye=this[G](m),_e=this[ee](m);s.fchown(Fe,ye,_e,Be=>Be?s.chown(he,ye,_e,nt=>ne(nt&&Be)):ne())}ne()});const ie=this.transform&&this.transform(m)||m;ie!==m&&(ie.on("error",se=>{this[x](se,m),k()}),m.pipe(ie)),ie.pipe(Z)}[h](m,k){const U=m.mode&4095||this.dmode;this[B](m.absolute,U,Z=>{if(Z){this[x](Z,m),k();return}let X=1;const ne=ie=>{--X===0&&(k(),this[j](),m.resume())};m.mtime&&!this.noMtime&&(X++,s.utimes(m.absolute,m.atime||new Date,m.mtime,ne)),this[V](m)&&(X++,s.chown(m.absolute,this[G](m),this[ee](m),ne)),ne()})}[g](m){m.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${m.type}`,{entry:m}),m.resume()}[d](m,k){this[f](m,m.linkpath,"symlink",k)}[c](m,k){const U=F(i.resolve(this.cwd,m.linkpath));this[f](m,U,"link",k)}[P](){this[M]++}[j](){this[M]--,this[K]()}[N](m){this[j](),m.resume()}[S](m,k){return m.type==="File"&&!this.unlink&&k.isFile()&&k.nlink<=1&&!H}[b](m){this[P]();const k=[m.path];m.linkpath&&k.push(m.linkpath),this.reservations.reserve(k,U=>this[y](m,U))}[v](m){m.type==="SymbolicLink"?Y(this.dirCache):m.type!=="Directory"&&T(this.dirCache,m.absolute)}[y](m,k){this[v](m);const U=ie=>{this[v](m),k(ie)},Z=()=>{this[B](this.cwd,this.dmode,ie=>{if(ie){this[x](ie,m),U();return}this[w]=!0,X()})},X=()=>{if(m.absolute!==this.cwd){const ie=F(i.dirname(m.absolute));if(ie!==this.cwd)return this[B](ie,this.dmode,se=>{if(se){this[x](se,m),U();return}ne()})}ne()},ne=()=>{s.lstat(m.absolute,(ie,se)=>{if(se&&(this.keep||this.newer&&se.mtime>m.mtime)){this[N](m),U();return}if(ie||this[S](m,se))return this[A](null,m,U);if(se.isDirectory()){if(m.type==="Directory"){const he=!this.noChmod&&m.mode&&(se.mode&4095)!==m.mode,Fe=ye=>this[A](ye,m,U);return he?s.chmod(m.absolute,m.mode,Fe):Fe()}if(m.absolute!==this.cwd)return s.rmdir(m.absolute,he=>this[A](he,m,U))}if(m.absolute===this.cwd)return this[A](null,m,U);$(m.absolute,he=>this[A](he,m,U))})};this[w]?X():Z()}[A](m,k,U){if(m){this[x](m,k),U();return}switch(k.type){case"File":case"OldFile":case"ContiguousFile":return this[n](k,U);case"Link":return this[c](k,U);case"SymbolicLink":return this[d](k,U);case"Directory":case"GNUDumpDir":return this[h](k,U)}}[f](m,k,U,Z){s[U](k,m.absolute,X=>{X?this[x](X,m):(this[j](),m.resume()),Z()})}}const le=te=>{try{return[null,te()]}catch(m){return[m,null]}};class Ue extends ue{[A](m,k){return super[A](m,k,()=>{})}[b](m){if(this[v](m),!this[w]){const X=this[B](this.cwd,this.dmode);if(X)return this[x](X,m);this[w]=!0}if(m.absolute!==this.cwd){const X=F(i.dirname(m.absolute));if(X!==this.cwd){const ne=this[B](X,this.dmode);if(ne)return this[x](ne,m)}}const[k,U]=le(()=>s.lstatSync(m.absolute));if(U&&(this.keep||this.newer&&U.mtime>m.mtime))return this[N](m);if(k||this[S](m,U))return this[A](null,m);if(U.isDirectory()){if(m.type==="Directory"){const ne=!this.noChmod&&m.mode&&(U.mode&4095)!==m.mode,[ie]=ne?le(()=>{s.chmodSync(m.absolute,m.mode)}):[];return this[A](ie,m)}const[X]=le(()=>s.rmdirSync(m.absolute));this[A](X,m)}const[Z]=m.absolute===this.cwd?[]:le(()=>W(m.absolute));this[A](Z,m)}[n](m,k){const U=m.mode&4095||this.fmode,Z=ie=>{let se;try{s.closeSync(X)}catch(he){se=he}(ie||se)&&this[x](ie||se,m),k()};let X;try{X=s.openSync(m.absolute,p(m.size),U)}catch(ie){return Z(ie)}const ne=this.transform&&this.transform(m)||m;ne!==m&&(ne.on("error",ie=>this[x](ie,m)),m.pipe(ne)),ne.on("data",ie=>{try{s.writeSync(X,ie,0,ie.length)}catch(se){Z(se)}}),ne.on("end",ie=>{let se=null;if(m.mtime&&!this.noMtime){const he=m.atime||new Date,Fe=m.mtime;try{s.futimesSync(X,he,Fe)}catch(ye){try{s.utimesSync(m.absolute,he,Fe)}catch{se=ye}}}if(this[V](m)){const he=this[G](m),Fe=this[ee](m);try{s.fchownSync(X,he,Fe)}catch(ye){try{s.chownSync(m.absolute,he,Fe)}catch{se=se||ye}}}Z(se)})}[h](m,k){const U=m.mode&4095||this.dmode,Z=this[B](m.absolute,U);if(Z){this[x](Z,m),k();return}if(m.mtime&&!this.noMtime)try{s.utimesSync(m.absolute,m.atime||new Date,m.mtime)}catch{}if(this[V](m))try{s.chownSync(m.absolute,this[G](m),this[ee](m))}catch{}k(),m.resume()}[B](m,k){try{return o.sync(F(m),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:k})}catch(U){return U}}[f](m,k,U,Z){try{s[U+"Sync"](k,m.absolute),Z(),m.resume()}catch(X){return this[x](X,m)}}}return ue.Sync=Ue,yi=ue,yi}var bi,cr;function Xn(){if(cr)return bi;cr=1;const u=Ie(),t=lr(),s=ge,r=ke(),i=ce,o=Pe();bi=(E,C,b)=>{typeof E=="function"?(b=E,C=null,E={}):Array.isArray(E)&&(C=E,E={}),typeof C=="function"&&(b=C,C=null),C?C=Array.from(C):C=[];const y=u(E);if(y.sync&&typeof b=="function")throw new TypeError("callback not supported for sync tar functions");if(!y.file&&typeof b=="function")throw new TypeError("callback only supported with file option");return C.length&&e(y,C),y.file&&y.sync?a(y):y.file?D(y,b):y.sync?F(y):_(y)};const e=(E,C)=>{const b=new Map(C.map(S=>[o(S),!0])),y=E.filter,v=(S,A)=>{const n=A||i.parse(S).root||".",h=S===n?!1:b.has(S)?b.get(S):v(i.dirname(S),n);return b.set(S,h),h};E.filter=y?(S,A)=>y(S,A)&&v(o(S)):S=>v(o(S))},a=E=>{const C=new t.Sync(E),b=E.file,y=s.statSync(b),v=E.maxReadSize||16*1024*1024;new r.ReadStreamSync(b,{readSize:v,size:y.size}).pipe(C)},D=(E,C)=>{const b=new t(E),y=E.maxReadSize||16*1024*1024,v=E.file,S=new Promise((A,n)=>{b.on("error",n),b.on("close",A),s.stat(v,(h,f)=>{if(h)n(h);else{const d=new r.ReadStream(v,{readSize:y,size:f.size});d.on("error",n),d.pipe(b)}})});return C?S.then(C,C):S},F=E=>new t.Sync(E),_=E=>new t(E);return bi}var Dr;function Jn(){return Dr||(Dr=1,ae.c=ae.create=kn(),ae.r=ae.replace=Gs(),ae.t=ae.list=ui(),ae.u=ae.update=Hn(),ae.x=ae.extract=Xn(),ae.Pack=ii(),ae.Unpack=lr(),ae.Parse=ri(),ae.ReadEntry=Ht(),ae.WriteEntry=Ms(),ae.Header=Me(),ae.Pax=Wt(),ae.types=As()),ae}var Qn=Jn();class eu extends Error{}class fr extends Error{}class tu extends Error{}class iu extends Error{}const dr=async(u,t)=>{const s=new URL(u),r=we.basename(s.pathname);return{name:r,version:void 0,subdir:void 0,url:s.href,tar:s.href,defaultDir:r,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:void 0}},mr=async(u,t)=>{const s=et(u),r=await wi(s,t,async()=>(await(await He(`https://api.github.com/repos/${s.repo}`)).json())?.default_branch);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:{...t.auth?{Authorization:`Bearer ${t.auth}`}:{},Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`https://github.com/${s.repo}/tree/${r}${s.subdir}`,tar:`https://api.github.com/repos/${s.repo}/tarball/${r}`}},su=async(u,t)=>{const s=et(u),r=await wi(s,t,async()=>(await(await He(`https://gitlab.com/api/v4/projects/${encodeURIComponent(s.repo)}`)).json())?.default_branch);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:{...t.auth?{Authorization:`Bearer ${t.auth}`}:{},"sec-fetch-mode":"same-origin"},url:`https://gitlab.com/${s.repo}/tree/${r}${s.subdir}`,tar:`https://gitlab.com/${s.repo}/-/archive/${r}.tar.gz`}},ru=async(u,t)=>{const s=et(u),r=await wi(s,t,async()=>(await(await He(`https://api.bitbucket.org/2.0/repositories/${s.repo}`)).json())?.mainbranch?.name);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:{},url:`https://bitbucket.com/${s.repo}/src/${r}${s.subdir}`,tar:`https://bitbucket.org/${s.repo}/get/${r}.tar.gz`}},nu=(u,t)=>{const s=et(u),r=s.ref||"main";return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:{},url:`https://git.sr.ht/~${s.repo}/tree/${r}/item${s.subdir}`,tar:`https://git.sr.ht/~${s.repo}/archive/${r}.tar.gz`}},uu={http:dr,https:dr,github:mr,gh:mr,gitlab:su,bitbucket:ru,sourcehut:nu};async function wi(u,t,s){if(u.ref)return u.ref;if(t.offline!==!0)try{const r=await s();if(r)return r}catch(r){_i(`Failed to fetch ref for ${u.repo}`,r)}return"main"}const ou=/^([\w-.]+):/;function au(u,t,s){t||="github";let r=u;const i=u.match(ou);i&&(t=i[1],t!=="http"&&t!=="https"&&(r=u.slice(i[0].length)));const o=s?.[t]||uu[t];return{source:r,providerName:t,provider:o}}async function hu(u,t,s={}){const r=t+".json",i=JSON.parse(await Oe.readFile(r,"utf8").catch(()=>"{}")),e=(await He(u,{...s,method:"HEAD"}).catch(()=>{}))?.headers.get("etag");if(i.etag===e&&Ae.existsSync(t))return;typeof e=="string"&&(i.etag=e);const a=await He(u,{headers:s.headers});if(a.status>=400)throw new fr(`Failed to download ${u}: ${a.status} ${a.statusText}`);if(a.body==null)throw new fr(`Failed to download ${u}: empty response body`);await Oe.mkdir(we.dirname(t),{recursive:!0});const D=Ae.createWriteStream(t);await Ri(Ar)(a.body,D),await Oe.writeFile(r,JSON.stringify(i),"utf8")}const lu=/^(?<repo>[\w\-.]+\/[\w\-.]+)(?<subdir>[^#]+)?(?<ref>#[\w\-./@]+)?/;function et(u){const t=u.match(lu)?.groups||{};return{repo:t.repo,subdir:t.subdir||"/",ref:t.ref?.slice(1)}}function _i(...u){process.env.DEBUG&&console.debug("[giget]",...u)}async function He(u,t={}){t.headers?.["sec-fetch-mode"]&&(t.mode=t.headers["sec-fetch-mode"]);const s=await fetch(u,t).catch(r=>{throw new Error(`Failed to fetch ${u}`,{cause:r})});if(t.validateStatus&&s.status>=400)throw new Error(`Failed to fetch ${u}: ${s.status} ${s.statusText}`);return s}function cu(){return process.env.XDG_CACHE_HOME?we.resolve(process.env.XDG_CACHE_HOME,"bluwy-giget"):we.resolve(_r.homedir(),".cache/bluwy-giget")}async function Du(u,t,s){s==="/"&&(s=void 0),s&&(s.startsWith("/")&&(s=s.slice(1)),s.endsWith("/")||(s+="/"));let r=!1;if(await Oe.mkdir(t,{recursive:!0}),await Qn.extract({file:u,cwd:t,onentry(i){i.path=i.path.split("/").splice(1).join("/"),s&&(i.path.startsWith(s)?(i.path=i.path.slice(s.length-1),r=!0):i.path="")}}),s&&!r)throw await Oe.rm(t,{recursive:!0,force:!0}),new tu(`Subdirectory not found in tar: ${s}`)}async function fu(u,t={}){const{source:s,providerName:r,provider:i}=au(u,t.provider,t.providers);if(!i)throw new eu(`Unsupported provider: ${r}`);const o={...t.providerOptions,offline:t.offline},e=await Promise.resolve().then(()=>i(s,o)).catch(E=>{throw new Error(`The ${r} provider failed with errors`,{cause:E})});e.name=(e.name||"template").replace(/[^\da-z-]/gi,"-"),e.defaultDir=(e.defaultDir||e.name).replace(/[^\da-z-]/gi,"-");const a=we.resolve(cu(),r,e.name),D=we.resolve(a,(e.version||e.name)+".tar.gz");if((t.offline==="prefer"?!Ae.existsSync(D):!t.offline)&&(await hu(e.tar,D,{headers:e.headers}).catch(E=>{if(!Ae.existsSync(D))throw E;_i("Download error. Using cached version:",E)}),_i(`Downloaded ${e.tar} to ${D}`)),!Ae.existsSync(D))throw new Error(`Tarball not found: ${D} (offline: ${t.offline})`);const F=we.resolve(t.cwd||"."),_=we.resolve(F,t.dir||e.defaultDir);if(t.force==="clean")await Oe.rm(_,{recursive:!0,force:!0});else if(!t.force&&Ae.existsSync(_)&&Ae.readdirSync(_).length>0)throw new iu(`Destination ${_} already exists.`);return await Du(D,_,e.subdir),{info:e,source:s,dir:_}}async function tt({template:u,project:t}){await fu(`wrtnlabs/agentica.template.${u}`,{provider:"github",dir:t}),await yr(be(t,".github"),{force:!0,recursive:!0})}async function it({projectPath:u,dotEnvfileName:t,apiKeys:s}){if(!ut(u))throw new Error(`${u} directory does not exist.`);const r=be(u,t??".env"),i=(ut(r)?`
|
|
87
87
|
`:"")+s.map(({key:o,value:e})=>`${o}=${e}`).join(`
|
|
88
|
-
`);await br(r,i)}function du({packageManager:u,pkg:t}){switch(u){case"npm":return`npm install ${t}`;case"yarn":return t!=null?`yarn add ${t}`:"yarn";case"pnpm":return`pnpm install ${t}`;case"bun":return`bun install ${t}`;default:throw new Error(`Unsupported package manager: ${u}`)}}function mu({packageManager:u,command:t}){switch(u){case"npm":return`npm run ${t}`;case"yarn":return`yarn ${t}`;case"pnpm":return`pnpm ${t}`;case"bun":return`bun ${t}`;default:throw new Error(`Unsupported package manager: ${u}`)}}function pu(){const u=oe.env.npm_config_user_agent;switch(!0){case u?.startsWith("npm"):return"npm";case u?.startsWith("yarn"):return"yarn";case u?.startsWith("pnpm"):return"pnpm";case u?.startsWith("bun"):return"bun";default:return"npm"}}async function st({packageManager:u,projectAbsolutePath:t,services:s}){const r=s.length>0?[...s.map(e=>xn(e))].join(" "):void 0,i=du({packageManager:u,pkg:r}),o=is();o.start("\u{1F4E6} Package installation in progress..."),await ds(i,{cwd:t}),o.stop("\u2705 Package installation completed")}async function Ai({packageManager:u,projectAbsolutePath:t}){const s=mu({packageManager:u,command:"prepare"}),r=is();r.start("\u{1F4E6} Package installation in progress..."),await ds(s,{cwd:t}),r.stop("\u2705 Package installation completed")}async function Eu({template:u}){const t={template:u,services:[]};{const s=await wt({message:"Enter the project directory path:",placeholder:"./my-agentica-project",validate(i){if(i==="")return"Please enter a directory path";if(i[0]!==".")return"Please enter a relative path.";if(ut(i))return"Directory already exists"}});ve(s)&&oe.exit(0);const r=be(oe.cwd(),s);t.projectAbsolutePath=r}{const s=await es({message:"Which package manager do you want to use?",initialValue:pu(),options:[{value:"npm",label:"npm"},{value:"pnpm",label:"pnpm"},{value:"yarn",label:`yarn (${pe.blueBright("berry is not supported")})`},{value:"bun",label:"bun"}]});ve(s)&&oe.exit(0),De.info(`\u{1F4E6} Using ${s} as package manager`),t.packageManager=s}if(t.template==null){const s=await es({message:"Which project type do you want to start?",options:[{value:"standalone",label:`Standalone ${pe.blueBright("Agent Server")}`},{value:"nodejs",label:`NodeJS ${pe.blueBright("Agent Server")}`},{value:"nestjs",label:`NestJS ${pe.blueBright("Agent Server")}`},{value:"react",label:`React ${pe.blueBright("Application")}`},{value:"nestjs+react",label:`NestJS + React ${pe.blueBright("Agent Server + Client Application")}`},{value:"nodejs+react",label:`NodeJS + React ${pe.blueBright("Agent Server + Client Application")}`}]});ve(s)&&oe.exit(0),t.template=s}if(t.template!=="standalone"){const s=await wt({message:"Server Port(if project is client app, this port mean ws server port):",initialValue:"3000",validate(r){if(Number.isNaN(Number.parseInt(r)))return"Port must be an integer"}});ve(s)&&oe.exit(0),t.port=Number(s)}if(t.template!=="react"){const s=(await Nn()).sort((i,o)=>i.displayName.localeCompare(o.displayName)).map(({displayName:i,serviceName:o})=>({label:i,value:o})),r=await gn({message:`Which connectors do you want to include? (Press ${pe.cyan("<space>")} to select, ${pe.cyan("<a>")} to select all, ${pe.cyan("<enter>")} to proceed)`,options:s,required:!1});ve(r)&&oe.exit(0),t.services=r}{const s=await En({message:"Enter your OpenAI API key?",initialValue:!1});if(ve(s)&&oe.exit(0),s){const r=await wt({message:"Please enter your OPENAI API key:"});ve(r)&&oe.exit(0),t.openAIKey=r}else t.openAIKey=null}try{(()=>{const s=e=>(e.packageManager==="npm"||e.packageManager==="yarn"||e.packageManager==="pnpm"||e.packageManager==="bun")&&typeof e.projectAbsolutePath=="string"&&(e.template==="nodejs"||e.template==="nestjs"||e.template==="react"||e.template==="standalone"||e.template==="nestjs+react"||e.template==="nodejs+react")&&(e.openAIKey===null||typeof e.openAIKey=="string")&&(e.port===void 0||typeof e.port=="number")&&Array.isArray(e.services)&&e.services.every(a=>typeof a=="string"),r=(e,a,D=!0)=>(e.packageManager==="npm"||e.packageManager==="yarn"||e.packageManager==="pnpm"||e.packageManager==="bun"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:e.packageManager},o))&&(typeof e.projectAbsolutePath=="string"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".projectAbsolutePath",expected:"string",value:e.projectAbsolutePath},o))&&(e.template==="nodejs"||e.template==="nestjs"||e.template==="react"||e.template==="standalone"||e.template==="nestjs+react"||e.template==="nodejs+react"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".template",expected:'("nestjs" | "nestjs+react" | "nodejs" | "nodejs+react" | "react" | "standalone")',value:e.template},o))&&(e.openAIKey===null||typeof e.openAIKey=="string"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".openAIKey",expected:"(null | string)",value:e.openAIKey},o))&&(e.port===void 0||typeof e.port=="number"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".port",expected:"(number | undefined)",value:e.port},o))&&((Array.isArray(e.services)||me._assertGuard(D,{method:"typia.assertGuard",path:a+".services",expected:"Array<string>",value:e.services},o))&&e.services.every((F,_)=>typeof F=="string"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".services["+_+"]",expected:"string",value:F},o))||me._assertGuard(D,{method:"typia.assertGuard",path:a+".services",expected:"Array<string>",value:e.services},o)),i=e=>typeof e=="object"&&e!==null&&s(e);let o;return(e,a)=>{i(e)===!1&&(o=a,((D,F,_=!0)=>(typeof D=="object"&&D!==null||me._assertGuard(!0,{method:"typia.assertGuard",path:F+"",expected:"__type",value:D},o))&&r(D,F+"",!0)||me._assertGuard(!0,{method:"typia.assertGuard",path:F+"",expected:"__type",value:D},o))(e,"$input",!0))}})()(t)}catch(s){throw new Error(`\u274C ${s.toString()}`)}return t}async function gu({projectAbsolutePath:u,context:t}){await tt({template:"standalone",project:u}),De.success("\u2705 Template downloaded");const s=xt(t.services),r=Bt(t.services),i=be(u,"src/index.ts"),o=await ot(i,"utf-8"),e=Tt({content:o,importCode:s,connectorCode:r}),a=await Ot(e);await at(i,a),await it({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""}]}),De.success("\u2705 .env created"),await st({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services}),await Ai({packageManager:t.packageManager,projectAbsolutePath:u})}async function pr({projectAbsolutePath:u,context:t}){await tt({template:"nodejs",project:u}),De.success("\u2705 Template downloaded");const s=xt(t.services),r=Bt(t.services),i=be(u,"src/index.ts"),o=await ot(i,"utf-8").then(D=>t.services.length===0?D:D.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
|
|
88
|
+
`);await br(r,i)}function du({packageManager:u,pkg:t}){switch(u){case"npm":return`npm install ${t??""}`;case"yarn":return t!=null?`yarn add ${t}`:"yarn";case"pnpm":return`pnpm install ${t??""}`;case"bun":return`bun install ${t??""}`;default:throw new Error(`Unsupported package manager: ${u}`)}}function mu({packageManager:u,command:t}){switch(u){case"npm":return`npm run ${t}`;case"yarn":return`yarn ${t}`;case"pnpm":return`pnpm ${t}`;case"bun":return`bun ${t}`;default:throw new Error(`Unsupported package manager: ${u}`)}}function pu(){const u=oe.env.npm_config_user_agent;switch(!0){case u?.startsWith("npm"):return"npm";case u?.startsWith("yarn"):return"yarn";case u?.startsWith("pnpm"):return"pnpm";case u?.startsWith("bun"):return"bun";default:return"npm"}}async function st({packageManager:u,projectAbsolutePath:t,services:s}){const r=s.length>0?[...s.map(e=>xn(e))].join(" "):void 0,i=du({packageManager:u,pkg:r}),o=is();o.start("\u{1F4E6} Package installation in progress..."),await ds(i,{cwd:t}),o.stop("\u2705 Package installation completed")}async function Ai({packageManager:u,projectAbsolutePath:t}){const s=mu({packageManager:u,command:"prepare"}),r=is();r.start("\u{1F4E6} Package installation in progress..."),await ds(s,{cwd:t}),r.stop("\u2705 Package installation completed")}async function Eu({template:u}){const t={template:u,services:[]};{const s=await wt({message:"Enter the project directory path:",placeholder:"./my-agentica-project",validate(i){if(i==="")return"Please enter a directory path";if(i[0]!==".")return"Please enter a relative path.";if(ut(i))return"Directory already exists"}});ve(s)&&oe.exit(0);const r=be(oe.cwd(),s);t.projectAbsolutePath=r}{const s=await es({message:"Which package manager do you want to use?",initialValue:pu(),options:[{value:"npm",label:"npm"},{value:"pnpm",label:"pnpm"},{value:"yarn",label:`yarn (${pe.blueBright("berry is not supported")})`},{value:"bun",label:"bun"}]});ve(s)&&oe.exit(0),De.info(`\u{1F4E6} Using ${s} as package manager`),t.packageManager=s}if(t.template==null){const s=await es({message:"Which project type do you want to start?",options:[{value:"standalone",label:`Standalone ${pe.blueBright("Agent Server")}`},{value:"nodejs",label:`NodeJS ${pe.blueBright("Agent Server")}`},{value:"nestjs",label:`NestJS ${pe.blueBright("Agent Server")}`},{value:"react",label:`React ${pe.blueBright("Application")}`},{value:"nestjs+react",label:`NestJS + React ${pe.blueBright("Agent Server + Client Application")}`},{value:"nodejs+react",label:`NodeJS + React ${pe.blueBright("Agent Server + Client Application")}`}]});ve(s)&&oe.exit(0),t.template=s}if(t.template!=="standalone"){const s=await wt({message:"Server Port(if project is client app, this port mean ws server port):",initialValue:"3000",validate(r){if(Number.isNaN(Number.parseInt(r)))return"Port must be an integer"}});ve(s)&&oe.exit(0),t.port=Number(s)}if(t.template!=="react"){const s=(await Nn()).sort((i,o)=>i.displayName.localeCompare(o.displayName)).map(({displayName:i,serviceName:o})=>({label:i,value:o})),r=await gn({message:`Which connectors do you want to include? (Press ${pe.cyan("<space>")} to select, ${pe.cyan("<a>")} to select all, ${pe.cyan("<enter>")} to proceed)`,options:s,required:!1});ve(r)&&oe.exit(0),t.services=r}{const s=await En({message:"Enter your OpenAI API key?",initialValue:!1});if(ve(s)&&oe.exit(0),s){const r=await wt({message:"Please enter your OPENAI API key:"});ve(r)&&oe.exit(0),t.openAIKey=r}else t.openAIKey=null}try{(()=>{const s=e=>(e.packageManager==="npm"||e.packageManager==="yarn"||e.packageManager==="pnpm"||e.packageManager==="bun")&&typeof e.projectAbsolutePath=="string"&&(e.template==="nodejs"||e.template==="nestjs"||e.template==="react"||e.template==="standalone"||e.template==="nestjs+react"||e.template==="nodejs+react")&&(e.openAIKey===null||typeof e.openAIKey=="string")&&(e.port===void 0||typeof e.port=="number")&&Array.isArray(e.services)&&e.services.every(a=>typeof a=="string"),r=(e,a,D=!0)=>(e.packageManager==="npm"||e.packageManager==="yarn"||e.packageManager==="pnpm"||e.packageManager==="bun"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:e.packageManager},o))&&(typeof e.projectAbsolutePath=="string"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".projectAbsolutePath",expected:"string",value:e.projectAbsolutePath},o))&&(e.template==="nodejs"||e.template==="nestjs"||e.template==="react"||e.template==="standalone"||e.template==="nestjs+react"||e.template==="nodejs+react"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".template",expected:'("nestjs" | "nestjs+react" | "nodejs" | "nodejs+react" | "react" | "standalone")',value:e.template},o))&&(e.openAIKey===null||typeof e.openAIKey=="string"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".openAIKey",expected:"(null | string)",value:e.openAIKey},o))&&(e.port===void 0||typeof e.port=="number"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".port",expected:"(number | undefined)",value:e.port},o))&&((Array.isArray(e.services)||me._assertGuard(D,{method:"typia.assertGuard",path:a+".services",expected:"Array<string>",value:e.services},o))&&e.services.every((F,_)=>typeof F=="string"||me._assertGuard(D,{method:"typia.assertGuard",path:a+".services["+_+"]",expected:"string",value:F},o))||me._assertGuard(D,{method:"typia.assertGuard",path:a+".services",expected:"Array<string>",value:e.services},o)),i=e=>typeof e=="object"&&e!==null&&s(e);let o;return(e,a)=>{i(e)===!1&&(o=a,((D,F,_=!0)=>(typeof D=="object"&&D!==null||me._assertGuard(!0,{method:"typia.assertGuard",path:F+"",expected:"__type",value:D},o))&&r(D,F+"",!0)||me._assertGuard(!0,{method:"typia.assertGuard",path:F+"",expected:"__type",value:D},o))(e,"$input",!0))}})()(t)}catch(s){throw new Error(`\u274C ${s.toString()}`)}return t}async function gu({projectAbsolutePath:u,context:t}){await tt({template:"standalone",project:u}),De.success("\u2705 Template downloaded");const s=xt(t.services),r=Bt(t.services),i=be(u,"src/index.ts"),o=await ot(i,"utf-8"),e=Tt({content:o,importCode:s,connectorCode:r}),a=await Ot(e);await at(i,a),await it({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""}]}),De.success("\u2705 .env created"),await st({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services}),await Ai({packageManager:t.packageManager,projectAbsolutePath:u})}async function pr({projectAbsolutePath:u,context:t}){await tt({template:"nodejs",project:u}),De.success("\u2705 Template downloaded");const s=xt(t.services),r=Bt(t.services),i=be(u,"src/index.ts"),o=await ot(i,"utf-8").then(D=>t.services.length===0?D:D.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
|
|
89
89
|
`)),e=Tt({content:o,importCode:s,connectorCode:r}),a=await Ot(e);await at(i,a),await it({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"PORT",value:t.port?.toString()??"3000"}]}),De.success("\u2705 .env created"),await st({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services}),await Ai({packageManager:t.packageManager,projectAbsolutePath:u})}async function Er({projectAbsolutePath:u,context:t}){await tt({template:"nestjs",project:u}),De.success("\u2705 Template downloaded");const s=xt(t.services),r=Bt(t.services),i=be(u,"src/controllers/chat/ChatController.ts"),o=await ot(i,"utf-8").then(D=>t.services.length===0?D:D.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
|
|
90
90
|
`)),e=Tt({content:o,importCode:s,connectorCode:r}),a=await Ot(e);await at(i,a),await it({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"API_PORT",value:t.port?.toString()??"3000"}]}),De.success("\u2705 .env created"),await st({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services}),await Ai({packageManager:t.packageManager,projectAbsolutePath:u})}async function vi({projectAbsolutePath:u,context:t}){await tt({template:"react",project:u}),De.success("\u2705 Template downloaded"),await it({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"VITE_AGENTICA_WS_URL",value:`ws://localhost:${t.port}/chat`}]}),De.success("\u2705 .env created"),await st({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services})}async function Cu({template:u}){ts("Agentica Start Wizard");const t=await Eu({template:u}),{projectAbsolutePath:s}=t;switch(t.template){case"standalone":await gu({projectAbsolutePath:s,context:t});break;case"nodejs":await pr({projectAbsolutePath:s,context:t});break;case"nestjs":await Er({projectAbsolutePath:s,context:t});break;case"react":await vi({projectAbsolutePath:s,context:t});break;case"nestjs+react":await Er({projectAbsolutePath:be(s,"server"),context:t}),await vi({projectAbsolutePath:be(s,"client"),context:t});break;case"nodejs+react":await pr({projectAbsolutePath:be(s,"server"),context:t}),await vi({projectAbsolutePath:be(s,"client"),context:t});break;default:throw t.template,new Error(`\u274C Template ${t.template} not supported`)}Cn(`
|
|
91
91
|
\u{1F389} Project ${s} created
|
|
92
92
|
\u26A0\uFE0F ${pe.yellow("Note:")} Please implement constructor values for each controller generated in agent.ts or index.ts
|
|
93
|
-
`)}const Fu="0.15.
|
|
93
|
+
`)}const Fu="0.15.6",rt=new An;rt.version(Fu),rt.command("start").description("Start a new project").option("-p, --project [nodejs|nestjs|react|nestjs+react|standalone]","The project type").action(async u=>{if(u.project===!0){De.error(`
|
|
94
94
|
\u274C The value of ${pe.redBright("--project")} is required`);return}if(!(t=>t===void 0||t==="nodejs"||t==="nestjs"||t==="react"||t==="standalone"||t==="nestjs+react"||t==="nodejs+react")(u.project)){De.error(`
|
|
95
95
|
\u274C The value of ${pe.redBright("--project")} is invalid`);return}ts(`\u{1F680} ${pe.blueBright("Agentica")} Setup Wizard`),await Cu({template:u.project})});function yu(){rt.parse(oe.argv)}export{rt as program,yu as run};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentica",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.6",
|
|
5
5
|
"description": "Agentic AI Library specialized in LLM Function Calling",
|
|
6
6
|
"author": "Wrtn Technologies",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"package.json"
|
|
38
38
|
],
|
|
39
39
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
40
|
+
"node": ">=18.18.0"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
43
|
"prettier": ">=2.4.0"
|