zen-code 4.9.0 → 4.9.2
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/app.js +187 -144
- package/dist/{chunk-4nsg4vcd.js → chunk-0pss3s5r.js} +1 -1
- package/dist/chunk-0sxrk9sx.js +1 -0
- package/dist/{chunk-gcm4jp0d.js → chunk-0zk0m93z.js} +1 -1
- package/dist/chunk-178yjjsx.js +1 -0
- package/dist/chunk-1p9xzvpt.js +3 -0
- package/dist/{chunk-hfve7nf5.js → chunk-2eh0sv3s.js} +2 -2
- package/dist/chunk-43xrz4wp.js +2 -0
- package/dist/chunk-48ce2wt0.js +1 -0
- package/dist/chunk-48vkm1yn.js +5 -0
- package/dist/{chunk-va71tsw3.js → chunk-55nx49pj.js} +2 -2
- package/dist/chunk-578m1dhj.js +2 -0
- package/dist/{chunk-trjpzw1n.js → chunk-5dsevrtz.js} +3 -3
- package/dist/{chunk-1y82m5kn.js → chunk-62zh99t6.js} +4 -4
- package/dist/chunk-66890qd3.js +2 -0
- package/dist/{chunk-9k5d9vf1.js → chunk-6nfpdtn6.js} +1 -1
- package/dist/chunk-738m8242.js +53 -0
- package/dist/{chunk-98f6hg43.js → chunk-8f2zh5h6.js} +2 -2
- package/dist/{chunk-jbf8ve63.js → chunk-8ty2zfve.js} +1 -1
- package/dist/{chunk-9dahn9h7.js → chunk-94jawhw7.js} +1 -1
- package/dist/chunk-98wjxsna.js +79 -0
- package/dist/chunk-9b7nj74j.js +1 -0
- package/dist/{chunk-wn43r152.js → chunk-9k64296h.js} +1 -1
- package/dist/chunk-9x562s6p.js +1 -0
- package/dist/chunk-a90fm6gz.js +278 -0
- package/dist/chunk-ac5t2ywn.js +100 -0
- package/dist/chunk-ad2hbq42.js +1 -0
- package/dist/chunk-afhxxkmv.js +16 -0
- package/dist/chunk-b4vvgbav.js +1 -0
- package/dist/{chunk-g7pm00z7.js → chunk-b9pcntkv.js} +9 -9
- package/dist/chunk-c7y5efa0.js +1 -0
- package/dist/chunk-cbjnwrt7.js +2 -0
- package/dist/{chunk-g377vrpj.js → chunk-ce53j63y.js} +1 -1
- package/dist/{chunk-kba8akjs.js → chunk-dcs1r9as.js} +1 -1
- package/dist/chunk-dcwnpdtk.js +9 -0
- package/dist/{chunk-b52b0t16.js → chunk-dxec2q4t.js} +1 -1
- package/dist/{chunk-13nyfrmm.js → chunk-e3tyc24s.js} +1 -1
- package/dist/{chunk-ep2es95e.js → chunk-e8hp8d68.js} +3 -3
- package/dist/chunk-fkrydbn4.js +18 -0
- package/dist/chunk-frhhpxxy.js +2 -0
- package/dist/{chunk-ns6tjjkq.js → chunk-fw3nrwpf.js} +1 -1
- package/dist/chunk-gyhxdxb4.js +1 -0
- package/dist/chunk-h1enhch1.js +2 -0
- package/dist/chunk-hcnx1j2z.js +1 -0
- package/dist/chunk-hfegb4pr.js +2 -0
- package/dist/{chunk-mmq834zt.js → chunk-hfypkhky.js} +1 -1
- package/dist/chunk-hmemx3cw.js +2 -0
- package/dist/chunk-hra0748z.js +2 -0
- package/dist/chunk-hsev32dg.js +4 -0
- package/dist/chunk-hyf24r36.js +2 -0
- package/dist/chunk-jb4yt88g.js +6 -0
- package/dist/chunk-jjcmm167.js +1 -0
- package/dist/chunk-jrepjpft.js +2 -0
- package/dist/chunk-k38fjqj7.js +140 -0
- package/dist/{chunk-cs73xbzz.js → chunk-kym9tb01.js} +1 -1
- package/dist/chunk-mt1g6g89.js +1 -0
- package/dist/chunk-p0vzbr7s.js +585 -0
- package/dist/{chunk-heasksrr.js → chunk-pndhbee8.js} +2 -2
- package/dist/{chunk-cggjws6a.js → chunk-pwrscdkf.js} +1 -1
- package/dist/{chunk-j7a40ww9.js → chunk-r019959h.js} +2 -2
- package/dist/chunk-r10bn684.js +1 -0
- package/dist/{chunk-30sq2w0d.js → chunk-r3pe49q4.js} +3 -3
- package/dist/chunk-r4tq44hr.js +1 -0
- package/dist/chunk-rjrnaka2.js +1 -0
- package/dist/{chunk-8g2zdcy0.js → chunk-rt5mpgbg.js} +2 -2
- package/dist/chunk-rztre6k0.js +1 -0
- package/dist/chunk-s77qbhtz.js +3 -0
- package/dist/chunk-t7rwtc17.js +1 -0
- package/dist/chunk-v8g52kan.js +1 -0
- package/dist/chunk-vd6c87cm.js +2 -0
- package/dist/{chunk-rncpxz1b.js → chunk-vfwbx331.js} +2 -2
- package/dist/chunk-vh9zd1v3.js +5 -0
- package/dist/chunk-w2hbsa9j.js +86 -0
- package/dist/chunk-wabmqprd.js +184 -0
- package/dist/chunk-wpy5r9ma.js +40 -0
- package/dist/chunk-x552nspp.js +6 -0
- package/dist/chunk-x90r4sje.js +1 -0
- package/dist/chunk-yndex7hs.js +1 -0
- package/dist/{chunk-7kdvr78m.js → chunk-yqwxbcc7.js} +4 -4
- package/dist/chunk-z8n7y37k.js +1 -0
- package/dist/chunk-zr7sx9hd.js +1 -0
- package/dist/chunk-zxqmghzf.js +1 -0
- package/dist/cli.js +1 -1
- package/dist/nonInteractive.js +2 -2
- package/dist/zen-keyboard.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-02vv5584.js +0 -1
- package/dist/chunk-1edvf7b5.js +0 -1
- package/dist/chunk-1rmnbdef.js +0 -1
- package/dist/chunk-1ttywx0y.js +0 -6
- package/dist/chunk-32ase1cw.js +0 -2
- package/dist/chunk-3490ntd8.js +0 -1
- package/dist/chunk-3pcybja5.js +0 -7
- package/dist/chunk-5rr85f28.js +0 -1
- package/dist/chunk-5x8nxw0t.js +0 -137
- package/dist/chunk-6rfc36jg.js +0 -1
- package/dist/chunk-76h8pe7x.js +0 -2
- package/dist/chunk-8z38ybz7.js +0 -1
- package/dist/chunk-b8dxq9rq.js +0 -1
- package/dist/chunk-cjqarwdn.js +0 -1
- package/dist/chunk-cyexd09c.js +0 -2
- package/dist/chunk-f8ewggk1.js +0 -1
- package/dist/chunk-j9aysaeb.js +0 -1
- package/dist/chunk-jfhc5c0d.js +0 -1
- package/dist/chunk-jxsfzfac.js +0 -2
- package/dist/chunk-m76ya904.js +0 -1
- package/dist/chunk-mjzeawnq.js +0 -6
- package/dist/chunk-nwy6n6b6.js +0 -274
- package/dist/chunk-qd305hg1.js +0 -1
- package/dist/chunk-qez6ejd4.js +0 -1
- package/dist/chunk-r2h3x9zv.js +0 -2
- package/dist/chunk-rz3b356n.js +0 -1
- package/dist/chunk-xhnvpygg.js +0 -2
- package/dist/chunk-xkz5z0zn.js +0 -1
- package/dist/chunk-zwxjkwqd.js +0 -26
- package/dist/chunk-zz32kgt2.js +0 -1
package/dist/chunk-5x8nxw0t.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import{tool as x5}from"@langchain/core/tools";import{z as KQ}from"zod";import{promises as YQ}from"fs";import{resolve as O5,join as R5}from"path";var F5=KQ.object({operation:KQ.enum(["create","list","exists"]).describe("The folder operation to perform"),folder_path:KQ.string().describe("The path to the folder (absolute or relative to cwd)"),description:KQ.string().optional().describe("What you want to do"),recursive:KQ.boolean().default(!0).optional().describe("For create: create parent directories if they do not exist")}).strict(),L0=x5(async({operation:Q,folder_path:X,recursive:Z=!0},V)=>{if(!V.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");try{let $=O5(V.state.cwd,X);switch(Q){case"create":return await YQ.mkdir($,{recursive:Z}),`✓ Folder created successfully at: ${$}`;case"exists":try{await YQ.access($);let J=await YQ.stat($);return`✓ Folder exists at: ${$}
|
|
2
|
-
Type: ${J.isDirectory()?"Directory":"File"}`}catch{return`✗ Folder does not exist at: ${$}`}case"list":try{let J=await YQ.readdir($,{withFileTypes:!0});if(J.length===0)return`Folder is empty: ${$}`;let q=[];q.push(`\uD83D\uDCC1 ${$}
|
|
3
|
-
`);let K=[],Y=[];for(let H of J){let j=R5($,H.name);try{let W=await YQ.stat(j),z=W.size,G=W.mtime.toLocaleDateString(),U=`${H.isDirectory()?"\uD83D\uDCC1":"\uD83D\uDCC4"} ${H.name}${H.isDirectory()?"/":""} (${z} bytes, ${G})`;if(H.isDirectory())K.push(U);else Y.push(U)}catch(W){Y.push(`⚠️ ${H.name} (unreadable)`)}}if(K.length>0)q.push("Directories:"),K.forEach((H)=>q.push(` ${H}`)),q.push("");if(Y.length>0)q.push("Files:"),Y.forEach((H)=>q.push(` ${H}`));return q.push(`
|
|
4
|
-
Total: ${K.length} directories, ${Y.length} files`),q.join(`
|
|
5
|
-
`)}catch(J){if(J.code==="ENOENT")return`✗ Folder not found: ${$}`;if(J.code==="ENOTDIR")return`✗ Path exists but is not a folder: ${$}`;throw J}default:return`✗ Unknown operation: ${Q}`}}catch($){if($.code==="ENOENT")return`✗ Folder not found: ${X}`;if($.code==="EACCES")return`✗ Permission denied: ${X}`;return`✗ Error: ${$.message}`}},{name:"folder_operations",description:`Unified folder operations tool supporting create, list, and existence check. Relative paths are resolved based on the current working directory (cwd).
|
|
6
|
-
|
|
7
|
-
**Operations:**
|
|
8
|
-
- create: Create a folder (supports nested directory creation)
|
|
9
|
-
- list: List all files and subdirectories with metadata
|
|
10
|
-
- exists: Check if a folder exists
|
|
11
|
-
|
|
12
|
-
**Usage Examples:**
|
|
13
|
-
- Create nested folders: {operation: "create", folder_path: "/path/to/nested/folder"}
|
|
14
|
-
- Create with relative path: {operation: "create", folder_path: "data/output"}
|
|
15
|
-
- List contents: {operation: "list", folder_path: "/path/to/folder"}
|
|
16
|
-
- List with relative path: {operation: "list", folder_path: "src"}
|
|
17
|
-
- Check existence: {operation: "exists", folder_path: "path/to/folder"}
|
|
18
|
-
|
|
19
|
-
**Important:**
|
|
20
|
-
- All folder paths can be absolute or relative to cwd
|
|
21
|
-
- Create operation is recursive (creates parent directories if needed)
|
|
22
|
-
- List operation shows file sizes and modification dates
|
|
23
|
-
- Delete operations are not supported for safety reasons. Use terminal commands with user approval if needed.`,schema:F5});import{tool as B7}from"@langchain/core/tools";import{z as nQ}from"zod";var sQ=(Q,X,Z)=>{let V=Q instanceof RegExp?k0(Q,Z):Q,$=X instanceof RegExp?k0(X,Z):X,J=V!==null&&$!=null&&N5(V,$,Z);return J&&{start:J[0],end:J[1],pre:Z.slice(0,J[0]),body:Z.slice(J[0]+V.length,J[1]),post:Z.slice(J[1]+$.length)}},k0=(Q,X)=>{let Z=X.match(Q);return Z?Z[0]:null},N5=(Q,X,Z)=>{let V,$,J,q=void 0,K,Y=Z.indexOf(Q),H=Z.indexOf(X,Y+1),j=Y;if(Y>=0&&H>0){if(Q===X)return[Y,H];V=[],J=Z.length;while(j>=0&&!K){if(j===Y)V.push(j),Y=Z.indexOf(Q,j+1);else if(V.length===1){let W=V.pop();if(W!==void 0)K=[W,H]}else{if($=V.pop(),$!==void 0&&$<J)J=$,q=H;H=Z.indexOf(X,j+1)}j=Y<H&&Y>=0?Y:H}if(V.length&&q!==void 0)K=[J,q]}return K};var A0="\x00SLASH"+Math.random()+"\x00",v0="\x00OPEN"+Math.random()+"\x00",eQ="\x00CLOSE"+Math.random()+"\x00",w0="\x00COMMA"+Math.random()+"\x00",I0="\x00PERIOD"+Math.random()+"\x00",D5=new RegExp(A0,"g"),S5=new RegExp(v0,"g"),T5=new RegExp(eQ,"g"),P5=new RegExp(w0,"g"),b5=new RegExp(I0,"g"),u5=/\\\\/g,y5=/\\{/g,E5=/\\}/g,m5=/\\,/g,f5=/\\./g,g5=1e5;function rQ(Q){return!isNaN(Q)?parseInt(Q,10):Q.charCodeAt(0)}function h5(Q){return Q.replace(u5,A0).replace(y5,v0).replace(E5,eQ).replace(m5,w0).replace(f5,I0)}function d5(Q){return Q.replace(D5,"\\").replace(S5,"{").replace(T5,"}").replace(P5,",").replace(b5,".")}function x0(Q){if(!Q)return[""];let X=[],Z=sQ("{","}",Q);if(!Z)return Q.split(",");let{pre:V,body:$,post:J}=Z,q=V.split(",");q[q.length-1]+="{"+$+"}";let K=x0(J);if(J.length)q[q.length-1]+=K.shift(),q.push.apply(q,K);return X.push.apply(X,q),X}function O0(Q,X={}){if(!Q)return[];let{max:Z=g5}=X;if(Q.slice(0,2)==="{}")Q="\\{\\}"+Q.slice(2);return HQ(h5(Q),Z,!0).map(d5)}function c5(Q){return"{"+Q+"}"}function l5(Q){return/^-?0\d/.test(Q)}function o5(Q,X){return Q<=X}function n5(Q,X){return Q>=X}function HQ(Q,X,Z){let V=[],$=sQ("{","}",Q);if(!$)return[Q];let J=$.pre,q=$.post.length?HQ($.post,X,!1):[""];if(/\$$/.test($.pre))for(let K=0;K<q.length&&K<X;K++){let Y=J+"{"+$.body+"}"+q[K];V.push(Y)}else{let K=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test($.body),Y=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test($.body),H=K||Y,j=$.body.indexOf(",")>=0;if(!H&&!j){if($.post.match(/,(?!,).*\}/))return Q=$.pre+"{"+$.body+eQ+$.post,HQ(Q,X,!0);return[Q]}let W;if(H)W=$.body.split(/\.\./);else if(W=x0($.body),W.length===1&&W[0]!==void 0){if(W=HQ(W[0],X,!1).map(c5),W.length===1)return q.map((G)=>$.pre+W[0]+G)}let z;if(H&&W[0]!==void 0&&W[1]!==void 0){let G=rQ(W[0]),B=rQ(W[1]),U=Math.max(W[0].length,W[1].length),_=W.length===3&&W[2]!==void 0?Math.abs(rQ(W[2])):1,C=o5;if(B<G)_*=-1,C=n5;let k=W.some(l5);z=[];for(let A=G;C(A,B);A+=_){let L;if(Y){if(L=String.fromCharCode(A),L==="\\")L=""}else if(L=String(A),k){let n=U-L.length;if(n>0){let c=Array(n+1).join("0");if(A<0)L="-"+c+L.slice(1);else L=c+L}}z.push(L)}}else{z=[];for(let G=0;G<W.length;G++)z.push.apply(z,HQ(W[G],X,!1))}for(let G=0;G<z.length;G++)for(let B=0;B<q.length&&V.length<X;B++){let U=J+z[G]+q[B];if(!Z||H||U)V.push(U)}}return V}var WQ=(Q)=>{if(typeof Q!=="string")throw TypeError("invalid pattern");if(Q.length>65536)throw TypeError("pattern is too long")};var i5={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},jQ=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),p5=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),R0=(Q)=>Q.join(""),F0=(Q,X)=>{let Z=X;if(Q.charAt(Z)!=="[")throw Error("not in a brace expression");let V=[],$=[],J=Z+1,q=!1,K=!1,Y=!1,H=!1,j=Z,W="";Q:while(J<Q.length){let U=Q.charAt(J);if((U==="!"||U==="^")&&J===Z+1){H=!0,J++;continue}if(U==="]"&&q&&!Y){j=J+1;break}if(q=!0,U==="\\"){if(!Y){Y=!0,J++;continue}}if(U==="["&&!Y){for(let[_,[C,M,k]]of Object.entries(i5))if(Q.startsWith(_,J)){if(W)return["$.",!1,Q.length-Z,!0];if(J+=_.length,k)$.push(C);else V.push(C);K=K||M;continue Q}}if(Y=!1,W){if(U>W)V.push(jQ(W)+"-"+jQ(U));else if(U===W)V.push(jQ(U));W="",J++;continue}if(Q.startsWith("-]",J+1)){V.push(jQ(U+"-")),J+=2;continue}if(Q.startsWith("-",J+1)){W=U,J+=2;continue}V.push(jQ(U)),J++}if(j<J)return["",!1,0,!1];if(!V.length&&!$.length)return["$.",!1,Q.length-Z,!0];if($.length===0&&V.length===1&&/^\\?.$/.test(V[0])&&!H){let U=V[0].length===2?V[0].slice(-1):V[0];return[p5(U),!1,j-Z,!1]}let z="["+(H?"^":"")+R0(V)+"]",G="["+(H?"":"^")+R0($)+"]";return[V.length&&$.length?"("+z+"|"+G+")":V.length?z:G,K,j-Z,!0]};var E=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!0}={})=>{if(Z)return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");return X?Q.replace(/\[([^\/\\{}])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};var a5=new Set(["!","?","+","*","@"]),N0=(Q)=>a5.has(Q),s5="(?!(?:^|/)\\.\\.?(?:$|/))",RQ="(?!\\.)",r5=new Set(["[","."]),e5=new Set(["..","."]),t5=new Set("().*{}+?[]^$\\!"),Q6=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),tQ="[^/]",D0=tQ+"*?",S0=tQ+"+?";class O{type;#Q;#Z;#J=!1;#$=[];#q;#k;#M;#W=!1;#K;#z;#j=!1;constructor(Q,X,Z={}){if(this.type=Q,Q)this.#Z=!0;if(this.#q=X,this.#Q=this.#q?this.#q.#Q:this,this.#K=this.#Q===this?Z:this.#Q.#K,this.#M=this.#Q===this?[]:this.#Q.#M,Q==="!"&&!this.#Q.#W)this.#M.push(this);this.#k=this.#q?this.#q.#$.length:0}get hasMagic(){if(this.#Z!==void 0)return this.#Z;for(let Q of this.#$){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#Z=!0}return this.#Z}toString(){if(this.#z!==void 0)return this.#z;if(!this.type)return this.#z=this.#$.map((Q)=>String(Q)).join("");else return this.#z=this.type+"("+this.#$.map((Q)=>String(Q)).join("|")+")"}#Y(){if(this!==this.#Q)throw Error("should only call on root");if(this.#W)return this;this.toString(),this.#W=!0;let Q;while(Q=this.#M.pop()){if(Q.type!=="!")continue;let X=Q,Z=X.#q;while(Z){for(let V=X.#k+1;!Z.type&&V<Z.#$.length;V++)for(let $ of Q.#$){if(typeof $==="string")throw Error("string part in extglob AST??");$.copyIn(Z.#$[V])}X=Z,Z=X.#q}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof O&&X.#q===this))throw Error("invalid part: "+X);this.#$.push(X)}}toJSON(){let Q=this.type===null?this.#$.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#$.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#W&&this.#q?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#q?.isStart())return!1;if(this.#k===0)return!0;let Q=this.#q;for(let X=0;X<this.#k;X++){let Z=Q.#$[X];if(!(Z instanceof O&&Z.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#q?.type==="!")return!0;if(!this.#q?.isEnd())return!1;if(!this.type)return this.#q?.isEnd();let Q=this.#q?this.#q.#$.length:0;return this.#k===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new O(this.type,Q);for(let Z of this.#$)X.copyIn(Z);return X}static#V(Q,X,Z,V){let $=!1,J=!1,q=-1,K=!1;if(X.type===null){let z=Z,G="";while(z<Q.length){let B=Q.charAt(z++);if($||B==="\\"){$=!$,G+=B;continue}if(J){if(z===q+1){if(B==="^"||B==="!")K=!0}else if(B==="]"&&!(z===q+2&&K))J=!1;G+=B;continue}else if(B==="["){J=!0,q=z,K=!1,G+=B;continue}if(!V.noext&&N0(B)&&Q.charAt(z)==="("){X.push(G),G="";let U=new O(B,X);z=O.#V(Q,U,z,V),X.push(U);continue}G+=B}return X.push(G),z}let Y=Z+1,H=new O(null,X),j=[],W="";while(Y<Q.length){let z=Q.charAt(Y++);if($||z==="\\"){$=!$,W+=z;continue}if(J){if(Y===q+1){if(z==="^"||z==="!")K=!0}else if(z==="]"&&!(Y===q+2&&K))J=!1;W+=z;continue}else if(z==="["){J=!0,q=Y,K=!1,W+=z;continue}if(N0(z)&&Q.charAt(Y)==="("){H.push(W),W="";let G=new O(z,H);H.push(G),Y=O.#V(Q,G,Y,V);continue}if(z==="|"){H.push(W),W="",j.push(H),H=new O(null,X);continue}if(z===")"){if(W===""&&X.#$.length===0)X.#j=!0;return H.push(W),W="",X.push(...j,H),Y}W+=z}return X.type=null,X.#Z=void 0,X.#$=[Q.substring(Z-1)],Y}static fromGlob(Q,X={}){let Z=new O(null,void 0,X);return O.#V(Q,Z,0,X),Z}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,Z,V,$]=this.toRegExpSource();if(!(V||this.#Z||this.#K.nocase&&!this.#K.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return Z;let q=(this.#K.nocase?"i":"")+($?"u":"");return Object.assign(new RegExp(`^${X}$`,q),{_src:X,_glob:Q})}get options(){return this.#K}toRegExpSource(Q){let X=Q??!!this.#K.dot;if(this.#Q===this)this.#Y();if(!this.type){let K=this.isStart()&&this.isEnd()&&!this.#$.some((z)=>typeof z!=="string"),Y=this.#$.map((z)=>{let[G,B,U,_]=typeof z==="string"?O.#A(z,this.#Z,K):z.toRegExpSource(Q);return this.#Z=this.#Z||U,this.#J=this.#J||_,G}).join(""),H="";if(this.isStart()){if(typeof this.#$[0]==="string"){if(!(this.#$.length===1&&e5.has(this.#$[0]))){let G=r5,B=X&&G.has(Y.charAt(0))||Y.startsWith("\\.")&&G.has(Y.charAt(2))||Y.startsWith("\\.\\.")&&G.has(Y.charAt(4)),U=!X&&!Q&&G.has(Y.charAt(0));H=B?s5:U?RQ:""}}}let j="";if(this.isEnd()&&this.#Q.#W&&this.#q?.type==="!")j="(?:$|\\/)";return[H+Y+j,E(Y),this.#Z=!!this.#Z,this.#J]}let Z=this.type==="*"||this.type==="+",V=this.type==="!"?"(?:(?!(?:":"(?:",$=this.#G(X);if(this.isStart()&&this.isEnd()&&!$&&this.type!=="!"){let K=this.toString();return this.#$=[K],this.type=null,this.#Z=void 0,[K,E(this.toString()),!1,!1]}let J=!Z||Q||X||!RQ?"":this.#G(!0);if(J===$)J="";if(J)$=`(?:${$})(?:${J})*?`;let q="";if(this.type==="!"&&this.#j)q=(this.isStart()&&!X?RQ:"")+S0;else{let K=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?RQ:"")+D0+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&J?")":this.type==="*"&&J?")?":`)${this.type}`;q=V+$+K}return[q,E($),this.#Z=!!this.#Z,this.#J]}#G(Q){return this.#$.map((X)=>{if(typeof X==="string")throw Error("string type in extglob ast??");let[Z,V,$,J]=X.toRegExpSource(Q);return this.#J=this.#J||J,Z}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#A(Q,X,Z=!1){let V=!1,$="",J=!1,q=!1;for(let K=0;K<Q.length;K++){let Y=Q.charAt(K);if(V){V=!1,$+=(t5.has(Y)?"\\":"")+Y;continue}if(Y==="*"){if(q)continue;q=!0,$+=Z&&/^[*]+$/.test(Q)?S0:D0,X=!0;continue}else q=!1;if(Y==="\\"){if(K===Q.length-1)$+="\\\\";else V=!0;continue}if(Y==="["){let[H,j,W,z]=F0(Q,K);if(W){$+=H,J=J||j,K+=W-1,X=X||z;continue}}if(Y==="?"){$+=tQ,X=!0;continue}$+=Q6(Y)}return[$,E(Q),!!X,J]}}var ZQ=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!1}={})=>{if(Z)return X?Q.replace(/[?*()[\]{}]/g,"[$&]"):Q.replace(/[?*()[\]\\{}]/g,"\\$&");return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var N=(Q,X,Z={})=>{if(WQ(X),!Z.nocomment&&X.charAt(0)==="#")return!1;return new b(X,Z).match(Q)},X6=/^\*+([^+@!?\*\[\(]*)$/,Z6=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),V6=(Q)=>(X)=>X.endsWith(Q),$6=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},J6=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},q6=/^\*+\.\*+$/,K6=(Q)=>!Q.startsWith(".")&&Q.includes("."),Y6=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),H6=/^\.\*+$/,W6=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),j6=/^\*+$/,z6=(Q)=>Q.length!==0&&!Q.startsWith("."),G6=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",U6=/^\?+([^+@!?\*\[\(]*)?$/,B6=([Q,X=""])=>{let Z=b0([Q]);if(!X)return Z;return X=X.toLowerCase(),(V)=>Z(V)&&V.toLowerCase().endsWith(X)},C6=([Q,X=""])=>{let Z=u0([Q]);if(!X)return Z;return X=X.toLowerCase(),(V)=>Z(V)&&V.toLowerCase().endsWith(X)},M6=([Q,X=""])=>{let Z=u0([Q]);return!X?Z:(V)=>Z(V)&&V.endsWith(X)},_6=([Q,X=""])=>{let Z=b0([Q]);return!X?Z:(V)=>Z(V)&&V.endsWith(X)},b0=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&!Z.startsWith(".")},u0=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&Z!=="."&&Z!==".."},y0=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",T0={win32:{sep:"\\"},posix:{sep:"/"}},L6=y0==="win32"?T0.win32.sep:T0.posix.sep;N.sep=L6;var R=Symbol("globstar **");N.GLOBSTAR=R;var k6="[^/]",A6=k6+"*?",v6="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",w6="(?:(?!(?:\\/|^)\\.).)*?",I6=(Q,X={})=>(Z)=>N(Z,Q,X);N.filter=I6;var P=(Q,X={})=>Object.assign({},Q,X),x6=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return N;let X=N;return Object.assign((V,$,J={})=>X(V,$,P(Q,J)),{Minimatch:class extends X.Minimatch{constructor($,J={}){super($,P(Q,J))}static defaults($){return X.defaults(P(Q,$)).Minimatch}},AST:class extends X.AST{constructor($,J,q={}){super($,J,P(Q,q))}static fromGlob($,J={}){return X.AST.fromGlob($,P(Q,J))}},unescape:(V,$={})=>X.unescape(V,P(Q,$)),escape:(V,$={})=>X.escape(V,P(Q,$)),filter:(V,$={})=>X.filter(V,P(Q,$)),defaults:(V)=>X.defaults(P(Q,V)),makeRe:(V,$={})=>X.makeRe(V,P(Q,$)),braceExpand:(V,$={})=>X.braceExpand(V,P(Q,$)),match:(V,$,J={})=>X.match(V,$,P(Q,J)),sep:X.sep,GLOBSTAR:R})};N.defaults=x6;var E0=(Q,X={})=>{if(WQ(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return O0(Q,{max:X.braceExpandMax})};N.braceExpand=E0;var O6=(Q,X={})=>new b(Q,X).makeRe();N.makeRe=O6;var R6=(Q,X,Z={})=>{let V=new b(X,Z);if(Q=Q.filter(($)=>V.match($)),V.options.nonull&&!Q.length)Q.push(X);return Q};N.match=R6;var P0=/[?*]|[+@!]\(.*?\)|\[|\]/,F6=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class b{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Q,X={}){WQ(Q),X=X||{},this.options=X,this.pattern=Q,this.platform=X.platform||y0,this.isWindows=this.platform==="win32";let Z="allowWindowsEscape";if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X[Z]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Q of this.set)for(let X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...$)=>console.error(...$);this.debug(this.pattern,this.globSet);let Z=this.globSet.map(($)=>this.slashSplit($));this.globParts=this.preprocess(Z),this.debug(this.pattern,this.globParts);let V=this.globParts.map(($,J,q)=>{if(this.isWindows&&this.windowsNoMagicRoot){let K=$[0]===""&&$[1]===""&&($[2]==="?"||!P0.test($[2]))&&!P0.test($[3]),Y=/^[a-z]:/i.test($[0]);if(K)return[...$.slice(0,4),...$.slice(4).map((H)=>this.parse(H))];else if(Y)return[$[0],...$.slice(1).map((H)=>this.parse(H))]}return $.map((K)=>this.parse(K))});if(this.debug(this.pattern,V),this.set=V.filter(($)=>$.indexOf(!1)===-1),this.isWindows)for(let $=0;$<this.set.length;$++){let J=this.set[$];if(J[0]===""&&J[1]===""&&this.globParts[$][2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]))J[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let Z=0;Z<Q.length;Z++)for(let V=0;V<Q[Z].length;V++)if(Q[Z][V]==="**")Q[Z][V]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let Z=-1;while((Z=X.indexOf("**",Z+1))!==-1){let V=Z;while(X[V+1]==="**")V++;if(V!==Z)X.splice(Z,V-Z)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce((Z,V)=>{let $=Z[Z.length-1];if(V==="**"&&$==="**")return Z;if(V===".."){if($&&$!==".."&&$!=="."&&$!=="**")return Z.pop(),Z}return Z.push(V),Z},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let V=1;V<Q.length-1;V++){let $=Q[V];if(V===1&&$===""&&Q[0]==="")continue;if($==="."||$==="")X=!0,Q.splice(V,1),V--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let Z=0;while((Z=Q.indexOf("..",Z+1))!==-1){let V=Q[Z-1];if(V&&V!=="."&&V!==".."&&V!=="**")X=!0,Q.splice(Z-1,2),Z-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let Z of Q){let V=-1;while((V=Z.indexOf("**",V+1))!==-1){let J=V;while(Z[J+1]==="**")J++;if(J>V)Z.splice(V+1,J-V);let q=Z[V+1],K=Z[V+2],Y=Z[V+3];if(q!=="..")continue;if(!K||K==="."||K===".."||!Y||Y==="."||Y==="..")continue;X=!0,Z.splice(V,1);let H=Z.slice(0);H[V]="**",Q.push(H),V--}if(!this.preserveMultipleSlashes){for(let J=1;J<Z.length-1;J++){let q=Z[J];if(J===1&&q===""&&Z[0]==="")continue;if(q==="."||q==="")X=!0,Z.splice(J,1),J--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))X=!0,Z.pop()}let $=0;while(($=Z.indexOf("..",$+1))!==-1){let J=Z[$-1];if(J&&J!=="."&&J!==".."&&J!=="**"){X=!0;let K=$===1&&Z[$+1]==="**"?["."]:[];if(Z.splice($-1,2,...K),Z.length===0)Z.push("");$-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let Z=X+1;Z<Q.length;Z++){let V=this.partsMatch(Q[X],Q[Z],!this.preserveMultipleSlashes);if(V){Q[X]=[],Q[Z]=V;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,Z=!1){let V=0,$=0,J=[],q="";while(V<Q.length&&$<X.length)if(Q[V]===X[$])J.push(q==="b"?X[$]:Q[V]),V++,$++;else if(Z&&Q[V]==="**"&&X[$]===Q[V+1])J.push(Q[V]),V++;else if(Z&&X[$]==="**"&&Q[V]===X[$+1])J.push(X[$]),$++;else if(Q[V]==="*"&&X[$]&&(this.options.dot||!X[$].startsWith("."))&&X[$]!=="**"){if(q==="b")return!1;q="a",J.push(Q[V]),V++,$++}else if(X[$]==="*"&&Q[V]&&(this.options.dot||!Q[V].startsWith("."))&&Q[V]!=="**"){if(q==="a")return!1;q="b",J.push(X[$]),V++,$++}else return!1;return Q.length===X.length&&J}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,Z=0;for(let V=0;V<Q.length&&Q.charAt(V)==="!";V++)X=!X,Z++;if(Z)this.pattern=Q.slice(Z);this.negate=X}matchOne(Q,X,Z=!1){let V=this.options;if(this.isWindows){let B=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),U=!B&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),_=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),C=!_&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),M=U?3:B?0:void 0,k=C?3:_?0:void 0;if(typeof M==="number"&&typeof k==="number"){let[A,L]=[Q[M],X[k]];if(A.toLowerCase()===L.toLowerCase()){if(X[k]=A,k>M)X=X.slice(k);else if(M>k)Q=Q.slice(M)}}}let{optimizationLevel:$=1}=this.options;if($>=2)Q=this.levelTwoFileOptimize(Q);this.debug("matchOne",this,{file:Q,pattern:X}),this.debug("matchOne",Q.length,X.length);for(var J=0,q=0,K=Q.length,Y=X.length;J<K&&q<Y;J++,q++){this.debug("matchOne loop");var H=X[q],j=Q[J];if(this.debug(X,H,j),H===!1)return!1;if(H===R){this.debug("GLOBSTAR",[X,H,j]);var W=J,z=q+1;if(z===Y){this.debug("** at the end");for(;J<K;J++)if(Q[J]==="."||Q[J]===".."||!V.dot&&Q[J].charAt(0)===".")return!1;return!0}while(W<K){var G=Q[W];if(this.debug(`
|
|
24
|
-
globstar while`,Q,W,X,z,G),this.matchOne(Q.slice(W),X.slice(z),Z))return this.debug("globstar found match!",W,K,G),!0;else{if(G==="."||G===".."||!V.dot&&G.charAt(0)==="."){this.debug("dot detected!",Q,W,X,z);break}this.debug("globstar swallow a segment, and continue"),W++}}if(Z){if(this.debug(`
|
|
25
|
-
>>> no match, partial?`,Q,W,X,z),W===K)return!0}return!1}let B;if(typeof H==="string")B=j===H,this.debug("string match",H,j,B);else B=H.test(j),this.debug("pattern match",H,j,B);if(!B)return!1}if(J===K&&q===Y)return!0;else if(J===K)return Z;else if(q===Y)return J===K-1&&Q[J]==="";else throw Error("wtf?")}braceExpand(){return E0(this.pattern,this.options)}parse(Q){WQ(Q);let X=this.options;if(Q==="**")return R;if(Q==="")return"";let Z,V=null;if(Z=Q.match(j6))V=X.dot?G6:z6;else if(Z=Q.match(X6))V=(X.nocase?X.dot?J6:$6:X.dot?V6:Z6)(Z[1]);else if(Z=Q.match(U6))V=(X.nocase?X.dot?C6:B6:X.dot?M6:_6)(Z);else if(Z=Q.match(q6))V=X.dot?Y6:K6;else if(Z=Q.match(H6))V=W6;let $=O.fromGlob(Q,this.options).toMMPattern();if(V&&typeof $==="object")Reflect.defineProperty($,"test",{value:V});return $}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,Z=X.noglobstar?A6:X.dot?v6:w6,V=new Set(X.nocase?["i"]:[]),$=Q.map((K)=>{let Y=K.map((j)=>{if(j instanceof RegExp)for(let W of j.flags.split(""))V.add(W);return typeof j==="string"?F6(j):j===R?R:j._src});Y.forEach((j,W)=>{let z=Y[W+1],G=Y[W-1];if(j!==R||G===R)return;if(G===void 0)if(z!==void 0&&z!==R)Y[W+1]="(?:\\/|"+Z+"\\/)?"+z;else Y[W]=Z;else if(z===void 0)Y[W-1]=G+"(?:\\/|\\/"+Z+")?";else if(z!==R)Y[W-1]=G+"(?:\\/|\\/"+Z+"\\/)"+z,Y[W+1]=R});let H=Y.filter((j)=>j!==R);if(this.partial&&H.length>=1){let j=[];for(let W=1;W<=H.length;W++)j.push(H.slice(0,W).join("/"));return"(?:"+j.join("|")+")"}return H.join("/")}).join("|"),[J,q]=Q.length>1?["(?:",")"]:["",""];if($="^"+J+$+q+"$",this.partial)$="^(?:\\/|"+J+$.slice(1,-1)+q+")$";if(this.negate)$="^(?!"+$+").+$";try{this.regexp=new RegExp($,[...V].join(""))}catch(K){this.regexp=!1}return this.regexp}slashSplit(Q){if(this.preserveMultipleSlashes)return Q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Q))return["",...Q.split(/\/+/)];else return Q.split(/\/+/)}match(Q,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let Z=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let V=this.slashSplit(Q);this.debug(this.pattern,"split",V);let $=this.set;this.debug(this.pattern,"set",$);let J=V[V.length-1];if(!J)for(let q=V.length-2;!J&&q>=0;q--)J=V[q];for(let q=0;q<$.length;q++){let K=$[q],Y=V;if(Z.matchBase&&K.length===1)Y=[J];if(this.matchOne(Y,K,X)){if(Z.flipNegate)return!0;return!this.negate}}if(Z.flipNegate)return!1;return this.negate}static defaults(Q){return N.defaults(Q).Minimatch}}N.AST=O;N.Minimatch=b;N.escape=ZQ;N.unescape=E;import{fileURLToPath as Y7}from"node:url";var N6=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,f0=new Set,Q0=typeof process=="object"&&process?process:{},g0=(Q,X,Z,V)=>{typeof Q0.emitWarning=="function"?Q0.emitWarning(Q,X,Z,V):console.error(`[${Z}] ${X}: ${Q}`)},NQ=globalThis.AbortController,m0=globalThis.AbortSignal;if(typeof NQ>"u"){m0=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,V){this._onabort.push(V)}},NQ=class{constructor(){X()}signal=new m0;abort(Z){if(!this.signal.aborted){this.signal.reason=Z,this.signal.aborted=!0;for(let V of this.signal._onabort)V(Z);this.signal.onabort?.(Z)}}};let Q=Q0.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{Q&&(Q=!1,g0("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",X))}}var D6=(Q)=>!f0.has(Q),Y8=Symbol("type"),i=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),h0=(Q)=>i(Q)?Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?FQ:null:null,FQ=class extends Array{constructor(Q){super(Q),this.fill(0)}},S6=class Q{heap;length;static#Q=!1;static create(X){let Z=h0(X);if(!Z)return[];Q.#Q=!0;let V=new Q(X,Z);return Q.#Q=!1,V}constructor(X,Z){if(!Q.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new Z(X),this.length=0}push(X){this.heap[this.length++]=X}pop(){return this.heap[--this.length]}},zQ=class Q{#Q;#Z;#J;#$;#q;#k;#M;#W;get perf(){return this.#W}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#K;#z;#j;#Y;#V;#G;#A;#L;#U;#F;#B;#I;#x;#C;#_;#v;#O;#X;#b;static unsafeExposeInternals(X){return{starts:X.#x,ttls:X.#C,autopurgeTimers:X.#_,sizes:X.#I,keyMap:X.#j,keyList:X.#Y,valList:X.#V,next:X.#G,prev:X.#A,get head(){return X.#L},get tail(){return X.#U},free:X.#F,isBackgroundFetch:(Z)=>X.#H(Z),backgroundFetch:(Z,V,$,J)=>X.#d(Z,V,$,J),moveToTail:(Z)=>X.#y(Z),indexes:(Z)=>X.#D(Z),rindexes:(Z)=>X.#S(Z),isStale:(Z)=>X.#w(Z)}}get max(){return this.#Q}get maxSize(){return this.#Z}get calculatedSize(){return this.#z}get size(){return this.#K}get fetchMethod(){return this.#k}get memoMethod(){return this.#M}get dispose(){return this.#J}get onInsert(){return this.#$}get disposeAfter(){return this.#q}constructor(X){let{max:Z=0,ttl:V,ttlResolution:$=1,ttlAutopurge:J,updateAgeOnGet:q,updateAgeOnHas:K,allowStale:Y,dispose:H,onInsert:j,disposeAfter:W,noDisposeOnSet:z,noUpdateTTL:G,maxSize:B=0,maxEntrySize:U=0,sizeCalculation:_,fetchMethod:C,memoMethod:M,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:n,ignoreFetchAbort:c,perf:QQ}=X;if(QQ!==void 0&&typeof QQ?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#W=QQ??N6,Z!==0&&!i(Z))throw TypeError("max option must be a nonnegative integer");let XQ=Z?h0(Z):Array;if(!XQ)throw Error("invalid max value: "+Z);if(this.#Q=Z,this.#Z=B,this.maxEntrySize=U||this.#Z,this.sizeCalculation=_,this.sizeCalculation){if(!this.#Z&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw TypeError("memoMethod must be a function if defined");if(this.#M=M,C!==void 0&&typeof C!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#k=C,this.#O=!!C,this.#j=new Map,this.#Y=Array(Z).fill(void 0),this.#V=Array(Z).fill(void 0),this.#G=new XQ(Z),this.#A=new XQ(Z),this.#L=0,this.#U=0,this.#F=S6.create(Z),this.#K=0,this.#z=0,typeof H=="function"&&(this.#J=H),typeof j=="function"&&(this.#$=j),typeof W=="function"?(this.#q=W,this.#B=[]):(this.#q=void 0,this.#B=void 0),this.#v=!!this.#J,this.#b=!!this.#$,this.#X=!!this.#q,this.noDisposeOnSet=!!z,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!n,this.ignoreFetchAbort=!!c,this.maxEntrySize!==0){if(this.#Z!==0&&!i(this.#Z))throw TypeError("maxSize must be a positive integer if specified");if(!i(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#l()}if(this.allowStale=!!Y,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!q,this.updateAgeOnHas=!!K,this.ttlResolution=i($)||$===0?$:1,this.ttlAutopurge=!!J,this.ttl=V||0,this.ttl){if(!i(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#T()}if(this.#Q===0&&this.ttl===0&&this.#Z===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#Z){let aQ="LRU_CACHE_UNBOUNDED";D6(aQ)&&(f0.add(aQ),g0("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",aQ,Q))}}getRemainingTTL(X){return this.#j.has(X)?1/0:0}#T(){let X=new FQ(this.#Q),Z=new FQ(this.#Q);this.#C=X,this.#x=Z;let V=this.ttlAutopurge?Array(this.#Q):void 0;this.#_=V,this.#m=(q,K,Y=this.#W.now())=>{if(Z[q]=K!==0?Y:0,X[q]=K,V?.[q]&&(clearTimeout(V[q]),V[q]=void 0),K!==0&&V){let H=setTimeout(()=>{this.#w(q)&&this.#N(this.#Y[q],"expire")},K+1);H.unref&&H.unref(),V[q]=H}},this.#R=(q)=>{Z[q]=X[q]!==0?this.#W.now():0},this.#P=(q,K)=>{if(X[K]){let Y=X[K],H=Z[K];if(!Y||!H)return;q.ttl=Y,q.start=H,q.now=$||J();let j=q.now-H;q.remainingTTL=Y-j}};let $=0,J=()=>{let q=this.#W.now();if(this.ttlResolution>0){$=q;let K=setTimeout(()=>$=0,this.ttlResolution);K.unref&&K.unref()}return q};this.getRemainingTTL=(q)=>{let K=this.#j.get(q);if(K===void 0)return 0;let Y=X[K],H=Z[K];if(!Y||!H)return 1/0;let j=($||J())-H;return Y-j},this.#w=(q)=>{let K=Z[q],Y=X[q];return!!Y&&!!K&&($||J())-K>Y}}#R=()=>{};#P=()=>{};#m=()=>{};#w=()=>!1;#l(){let X=new FQ(this.#Q);this.#z=0,this.#I=X,this.#E=(Z)=>{this.#z-=X[Z],X[Z]=0},this.#f=(Z,V,$,J)=>{if(this.#H(V))return 0;if(!i($))if(J){if(typeof J!="function")throw TypeError("sizeCalculation must be a function");if($=J(V,Z),!i($))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return $},this.#u=(Z,V,$)=>{if(X[Z]=V,this.#Z){let J=this.#Z-X[Z];for(;this.#z>J;)this.#h(!0)}this.#z+=X[Z],$&&($.entrySize=V,$.totalCalculatedSize=this.#z)}}#E=(X)=>{};#u=(X,Z,V)=>{};#f=(X,Z,V,$)=>{if(V||$)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:X=this.allowStale}={}){if(this.#K)for(let Z=this.#U;!(!this.#g(Z)||((X||!this.#w(Z))&&(yield Z),Z===this.#L));)Z=this.#A[Z]}*#S({allowStale:X=this.allowStale}={}){if(this.#K)for(let Z=this.#L;!(!this.#g(Z)||((X||!this.#w(Z))&&(yield Z),Z===this.#U));)Z=this.#G[Z]}#g(X){return X!==void 0&&this.#j.get(this.#Y[X])===X}*entries(){for(let X of this.#D())this.#V[X]!==void 0&&this.#Y[X]!==void 0&&!this.#H(this.#V[X])&&(yield[this.#Y[X],this.#V[X]])}*rentries(){for(let X of this.#S())this.#V[X]!==void 0&&this.#Y[X]!==void 0&&!this.#H(this.#V[X])&&(yield[this.#Y[X],this.#V[X]])}*keys(){for(let X of this.#D()){let Z=this.#Y[X];Z!==void 0&&!this.#H(this.#V[X])&&(yield Z)}}*rkeys(){for(let X of this.#S()){let Z=this.#Y[X];Z!==void 0&&!this.#H(this.#V[X])&&(yield Z)}}*values(){for(let X of this.#D())this.#V[X]!==void 0&&!this.#H(this.#V[X])&&(yield this.#V[X])}*rvalues(){for(let X of this.#S())this.#V[X]!==void 0&&!this.#H(this.#V[X])&&(yield this.#V[X])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(X,Z={}){for(let V of this.#D()){let $=this.#V[V],J=this.#H($)?$.__staleWhileFetching:$;if(J!==void 0&&X(J,this.#Y[V],this))return this.get(this.#Y[V],Z)}}forEach(X,Z=this){for(let V of this.#D()){let $=this.#V[V],J=this.#H($)?$.__staleWhileFetching:$;J!==void 0&&X.call(Z,J,this.#Y[V],this)}}rforEach(X,Z=this){for(let V of this.#S()){let $=this.#V[V],J=this.#H($)?$.__staleWhileFetching:$;J!==void 0&&X.call(Z,J,this.#Y[V],this)}}purgeStale(){let X=!1;for(let Z of this.#S({allowStale:!0}))this.#w(Z)&&(this.#N(this.#Y[Z],"expire"),X=!0);return X}info(X){let Z=this.#j.get(X);if(Z===void 0)return;let V=this.#V[Z],$=this.#H(V)?V.__staleWhileFetching:V;if($===void 0)return;let J={value:$};if(this.#C&&this.#x){let q=this.#C[Z],K=this.#x[Z];if(q&&K){let Y=q-(this.#W.now()-K);J.ttl=Y,J.start=Date.now()}}return this.#I&&(J.size=this.#I[Z]),J}dump(){let X=[];for(let Z of this.#D({allowStale:!0})){let V=this.#Y[Z],$=this.#V[Z],J=this.#H($)?$.__staleWhileFetching:$;if(J===void 0||V===void 0)continue;let q={value:J};if(this.#C&&this.#x){q.ttl=this.#C[Z];let K=this.#W.now()-this.#x[Z];q.start=Math.floor(Date.now()-K)}this.#I&&(q.size=this.#I[Z]),X.unshift([V,q])}return X}load(X){this.clear();for(let[Z,V]of X){if(V.start){let $=Date.now()-V.start;V.start=this.#W.now()-$}this.set(Z,V.value,V)}}set(X,Z,V={}){if(Z===void 0)return this.delete(X),this;let{ttl:$=this.ttl,start:J,noDisposeOnSet:q=this.noDisposeOnSet,sizeCalculation:K=this.sizeCalculation,status:Y}=V,{noUpdateTTL:H=this.noUpdateTTL}=V,j=this.#f(X,Z,V.size||0,K);if(this.maxEntrySize&&j>this.maxEntrySize)return Y&&(Y.set="miss",Y.maxEntrySizeExceeded=!0),this.#N(X,"set"),this;let W=this.#K===0?void 0:this.#j.get(X);if(W===void 0)W=this.#K===0?this.#U:this.#F.length!==0?this.#F.pop():this.#K===this.#Q?this.#h(!1):this.#K,this.#Y[W]=X,this.#V[W]=Z,this.#j.set(X,W),this.#G[this.#U]=W,this.#A[W]=this.#U,this.#U=W,this.#K++,this.#u(W,j,Y),Y&&(Y.set="add"),H=!1,this.#b&&this.#$?.(Z,X,"add");else{this.#y(W);let z=this.#V[W];if(Z!==z){if(this.#O&&this.#H(z)){z.__abortController.abort(Error("replaced"));let{__staleWhileFetching:G}=z;G!==void 0&&!q&&(this.#v&&this.#J?.(G,X,"set"),this.#X&&this.#B?.push([G,X,"set"]))}else q||(this.#v&&this.#J?.(z,X,"set"),this.#X&&this.#B?.push([z,X,"set"]));if(this.#E(W),this.#u(W,j,Y),this.#V[W]=Z,Y){Y.set="replace";let G=z&&this.#H(z)?z.__staleWhileFetching:z;G!==void 0&&(Y.oldValue=G)}}else Y&&(Y.set="update");this.#b&&this.onInsert?.(Z,X,Z===z?"update":"replace")}if($!==0&&!this.#C&&this.#T(),this.#C&&(H||this.#m(W,$,J),Y&&this.#P(Y,W)),!q&&this.#X&&this.#B){let z=this.#B,G;for(;G=z?.shift();)this.#q?.(...G)}return this}pop(){try{for(;this.#K;){let X=this.#V[this.#L];if(this.#h(!0),this.#H(X)){if(X.__staleWhileFetching)return X.__staleWhileFetching}else if(X!==void 0)return X}}finally{if(this.#X&&this.#B){let X=this.#B,Z;for(;Z=X?.shift();)this.#q?.(...Z)}}}#h(X){let Z=this.#L,V=this.#Y[Z],$=this.#V[Z];return this.#O&&this.#H($)?$.__abortController.abort(Error("evicted")):(this.#v||this.#X)&&(this.#v&&this.#J?.($,V,"evict"),this.#X&&this.#B?.push([$,V,"evict"])),this.#E(Z),this.#_?.[Z]&&(clearTimeout(this.#_[Z]),this.#_[Z]=void 0),X&&(this.#Y[Z]=void 0,this.#V[Z]=void 0,this.#F.push(Z)),this.#K===1?(this.#L=this.#U=0,this.#F.length=0):this.#L=this.#G[Z],this.#j.delete(V),this.#K--,Z}has(X,Z={}){let{updateAgeOnHas:V=this.updateAgeOnHas,status:$}=Z,J=this.#j.get(X);if(J!==void 0){let q=this.#V[J];if(this.#H(q)&&q.__staleWhileFetching===void 0)return!1;if(this.#w(J))$&&($.has="stale",this.#P($,J));else return V&&this.#R(J),$&&($.has="hit",this.#P($,J)),!0}else $&&($.has="miss");return!1}peek(X,Z={}){let{allowStale:V=this.allowStale}=Z,$=this.#j.get(X);if($===void 0||!V&&this.#w($))return;let J=this.#V[$];return this.#H(J)?J.__staleWhileFetching:J}#d(X,Z,V,$){let J=Z===void 0?void 0:this.#V[Z];if(this.#H(J))return J;let q=new NQ,{signal:K}=V;K?.addEventListener("abort",()=>q.abort(K.reason),{signal:q.signal});let Y={signal:q.signal,options:V,context:$},H=(U,_=!1)=>{let{aborted:C}=q.signal,M=V.ignoreFetchAbort&&U!==void 0,k=V.ignoreFetchAbort||!!(V.allowStaleOnFetchAbort&&U!==void 0);if(V.status&&(C&&!_?(V.status.fetchAborted=!0,V.status.fetchError=q.signal.reason,M&&(V.status.fetchAbortIgnored=!0)):V.status.fetchResolved=!0),C&&!M&&!_)return W(q.signal.reason,k);let A=G,L=this.#V[Z];return(L===G||M&&_&&L===void 0)&&(U===void 0?A.__staleWhileFetching!==void 0?this.#V[Z]=A.__staleWhileFetching:this.#N(X,"fetch"):(V.status&&(V.status.fetchUpdated=!0),this.set(X,U,Y.options))),U},j=(U)=>(V.status&&(V.status.fetchRejected=!0,V.status.fetchError=U),W(U,!1)),W=(U,_)=>{let{aborted:C}=q.signal,M=C&&V.allowStaleOnFetchAbort,k=M||V.allowStaleOnFetchRejection,A=k||V.noDeleteOnFetchRejection,L=G;if(this.#V[Z]===G&&(!A||!_&&L.__staleWhileFetching===void 0?this.#N(X,"fetch"):M||(this.#V[Z]=L.__staleWhileFetching)),k)return V.status&&L.__staleWhileFetching!==void 0&&(V.status.returnedStale=!0),L.__staleWhileFetching;if(L.__returned===L)throw U},z=(U,_)=>{let C=this.#k?.(X,J,Y);C&&C instanceof Promise&&C.then((M)=>U(M===void 0?void 0:M),_),q.signal.addEventListener("abort",()=>{(!V.ignoreFetchAbort||V.allowStaleOnFetchAbort)&&(U(void 0),V.allowStaleOnFetchAbort&&(U=(M)=>H(M,!0)))})};V.status&&(V.status.fetchDispatched=!0);let G=new Promise(z).then(H,j),B=Object.assign(G,{__abortController:q,__staleWhileFetching:J,__returned:void 0});return Z===void 0?(this.set(X,B,{...Y.options,status:void 0}),Z=this.#j.get(X)):this.#V[Z]=B,B}#H(X){if(!this.#O)return!1;let Z=X;return!!Z&&Z instanceof Promise&&Z.hasOwnProperty("__staleWhileFetching")&&Z.__abortController instanceof NQ}async fetch(X,Z={}){let{allowStale:V=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,ttl:q=this.ttl,noDisposeOnSet:K=this.noDisposeOnSet,size:Y=0,sizeCalculation:H=this.sizeCalculation,noUpdateTTL:j=this.noUpdateTTL,noDeleteOnFetchRejection:W=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:z=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:B=this.allowStaleOnFetchAbort,context:U,forceRefresh:_=!1,status:C,signal:M}=Z;if(!this.#O)return C&&(C.fetch="get"),this.get(X,{allowStale:V,updateAgeOnGet:$,noDeleteOnStaleGet:J,status:C});let k={allowStale:V,updateAgeOnGet:$,noDeleteOnStaleGet:J,ttl:q,noDisposeOnSet:K,size:Y,sizeCalculation:H,noUpdateTTL:j,noDeleteOnFetchRejection:W,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:B,ignoreFetchAbort:G,status:C,signal:M},A=this.#j.get(X);if(A===void 0){C&&(C.fetch="miss");let L=this.#d(X,A,k,U);return L.__returned=L}else{let L=this.#V[A];if(this.#H(L)){let XQ=V&&L.__staleWhileFetching!==void 0;return C&&(C.fetch="inflight",XQ&&(C.returnedStale=!0)),XQ?L.__staleWhileFetching:L.__returned=L}let n=this.#w(A);if(!_&&!n)return C&&(C.fetch="hit"),this.#y(A),$&&this.#R(A),C&&this.#P(C,A),L;let c=this.#d(X,A,k,U),QQ=c.__staleWhileFetching!==void 0&&V;return C&&(C.fetch=n?"stale":"refresh",QQ&&n&&(C.returnedStale=!0)),QQ?c.__staleWhileFetching:c.__returned=c}}async forceFetch(X,Z={}){let V=await this.fetch(X,Z);if(V===void 0)throw Error("fetch() returned undefined");return V}memo(X,Z={}){let V=this.#M;if(!V)throw Error("no memoMethod provided to constructor");let{context:$,forceRefresh:J,...q}=Z,K=this.get(X,q);if(!J&&K!==void 0)return K;let Y=V(X,K,{options:q,context:$});return this.set(X,Y,q),Y}get(X,Z={}){let{allowStale:V=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,status:q}=Z,K=this.#j.get(X);if(K!==void 0){let Y=this.#V[K],H=this.#H(Y);return q&&this.#P(q,K),this.#w(K)?(q&&(q.get="stale"),H?(q&&V&&Y.__staleWhileFetching!==void 0&&(q.returnedStale=!0),V?Y.__staleWhileFetching:void 0):(J||this.#N(X,"expire"),q&&V&&(q.returnedStale=!0),V?Y:void 0)):(q&&(q.get="hit"),H?Y.__staleWhileFetching:(this.#y(K),$&&this.#R(K),Y))}else q&&(q.get="miss")}#c(X,Z){this.#A[Z]=X,this.#G[X]=Z}#y(X){X!==this.#U&&(X===this.#L?this.#L=this.#G[X]:this.#c(this.#A[X],this.#G[X]),this.#c(this.#U,X),this.#U=X)}delete(X){return this.#N(X,"delete")}#N(X,Z){let V=!1;if(this.#K!==0){let $=this.#j.get(X);if($!==void 0)if(this.#_?.[$]&&(clearTimeout(this.#_?.[$]),this.#_[$]=void 0),V=!0,this.#K===1)this.#o(Z);else{this.#E($);let J=this.#V[$];if(this.#H(J)?J.__abortController.abort(Error("deleted")):(this.#v||this.#X)&&(this.#v&&this.#J?.(J,X,Z),this.#X&&this.#B?.push([J,X,Z])),this.#j.delete(X),this.#Y[$]=void 0,this.#V[$]=void 0,$===this.#U)this.#U=this.#A[$];else if($===this.#L)this.#L=this.#G[$];else{let q=this.#A[$];this.#G[q]=this.#G[$];let K=this.#G[$];this.#A[K]=this.#A[$]}this.#K--,this.#F.push($)}}if(this.#X&&this.#B?.length){let $=this.#B,J;for(;J=$?.shift();)this.#q?.(...J)}return V}clear(){return this.#o("delete")}#o(X){for(let Z of this.#S({allowStale:!0})){let V=this.#V[Z];if(this.#H(V))V.__abortController.abort(Error("deleted"));else{let $=this.#Y[Z];this.#v&&this.#J?.(V,$,X),this.#X&&this.#B?.push([V,$,X])}}if(this.#j.clear(),this.#V.fill(void 0),this.#Y.fill(void 0),this.#C&&this.#x){this.#C.fill(0),this.#x.fill(0);for(let Z of this.#_??[])Z!==void 0&&clearTimeout(Z);this.#_?.fill(void 0)}if(this.#I&&this.#I.fill(0),this.#L=0,this.#U=0,this.#F.length=0,this.#z=0,this.#K=0,this.#X&&this.#B){let Z=this.#B,V;for(;V=Z?.shift();)this.#q?.(...V)}}};import{posix as d6,win32 as W0}from"node:path";import{fileURLToPath as c6}from"node:url";import{lstatSync as l6,readdir as o6,readdirSync as n6,readlinkSync as i6,realpathSync as p6}from"fs";import*as a6 from"node:fs";import{lstat as r6,readdir as e6,readlink as t6,realpath as Q7}from"node:fs/promises";import{EventEmitter as q0}from"node:events";import n0 from"node:stream";import{StringDecoder as T6}from"node:string_decoder";var d0=typeof process==="object"&&process?process:{stdout:null,stderr:null},P6=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof r||Q instanceof n0||b6(Q)||u6(Q)),b6=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof q0&&typeof Q.pipe==="function"&&Q.pipe!==n0.Writable.prototype.pipe,u6=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof q0&&typeof Q.write==="function"&&typeof Q.end==="function",l=Symbol("EOF"),o=Symbol("maybeEmitEnd"),p=Symbol("emittedEnd"),DQ=Symbol("emittingEnd"),GQ=Symbol("emittedError"),SQ=Symbol("closed"),c0=Symbol("read"),TQ=Symbol("flush"),l0=Symbol("flushChunk"),m=Symbol("encoding"),VQ=Symbol("decoder"),w=Symbol("flowing"),UQ=Symbol("paused"),$Q=Symbol("resume"),I=Symbol("buffer"),D=Symbol("pipes"),x=Symbol("bufferLength"),X0=Symbol("bufferPush"),PQ=Symbol("bufferShift"),F=Symbol("objectMode"),v=Symbol("destroyed"),Z0=Symbol("error"),V0=Symbol("emitData"),o0=Symbol("emitEnd"),$0=Symbol("emitEnd2"),g=Symbol("async"),J0=Symbol("abort"),bQ=Symbol("aborted"),BQ=Symbol("signal"),s=Symbol("dataListeners"),T=Symbol("discarded"),CQ=(Q)=>Promise.resolve().then(Q),y6=(Q)=>Q(),E6=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",m6=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,f6=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class K0{src;dest;opts;ondrain;constructor(Q,X,Z){this.src=Q,this.dest=X,this.opts=Z,this.ondrain=()=>Q[$Q](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class i0 extends K0{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,Z){super(Q,X,Z);this.proxyErrors=(V)=>this.dest.emit("error",V),Q.on("error",this.proxyErrors)}}var g6=(Q)=>!!Q.objectMode,h6=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class r extends q0{[w]=!1;[UQ]=!1;[D]=[];[I]=[];[F];[m];[g];[VQ];[l]=!1;[p]=!1;[DQ]=!1;[SQ]=!1;[GQ]=null;[x]=0;[v]=!1;[BQ];[bQ]=!1;[s]=0;[T]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(g6(X))this[F]=!0,this[m]=null;else if(h6(X))this[m]=X.encoding,this[F]=!1;else this[F]=!1,this[m]=null;if(this[g]=!!X.async,this[VQ]=this[m]?new T6(this[m]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[I]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[D]});let{signal:Z}=X;if(Z)if(this[BQ]=Z,Z.aborted)this[J0]();else Z.addEventListener("abort",()=>this[J0]())}get bufferLength(){return this[x]}get encoding(){return this[m]}set encoding(Q){throw Error("Encoding must be set at instantiation time")}setEncoding(Q){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[F]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[g]}set["async"](Q){this[g]=this[g]||!!Q}[J0](){this[bQ]=!0,this.emit("abort",this[BQ]?.reason),this.destroy(this[BQ]?.reason)}get aborted(){return this[bQ]}set aborted(Q){}write(Q,X,Z){if(this[bQ])return!1;if(this[l])throw Error("write after end");if(this[v])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")Z=X,X="utf8";if(!X)X="utf8";let V=this[g]?CQ:y6;if(!this[F]&&!Buffer.isBuffer(Q)){if(f6(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(m6(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[F]){if(this[w]&&this[x]!==0)this[TQ](!0);if(this[w])this.emit("data",Q);else this[X0](Q);if(this[x]!==0)this.emit("readable");if(Z)V(Z);return this[w]}if(!Q.length){if(this[x]!==0)this.emit("readable");if(Z)V(Z);return this[w]}if(typeof Q==="string"&&!(X===this[m]&&!this[VQ]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[m])Q=this[VQ].write(Q);if(this[w]&&this[x]!==0)this[TQ](!0);if(this[w])this.emit("data",Q);else this[X0](Q);if(this[x]!==0)this.emit("readable");if(Z)V(Z);return this[w]}read(Q){if(this[v])return null;if(this[T]=!1,this[x]===0||Q===0||Q&&Q>this[x])return this[o](),null;if(this[F])Q=null;if(this[I].length>1&&!this[F])this[I]=[this[m]?this[I].join(""):Buffer.concat(this[I],this[x])];let X=this[c0](Q||null,this[I][0]);return this[o](),X}[c0](Q,X){if(this[F])this[PQ]();else{let Z=X;if(Q===Z.length||Q===null)this[PQ]();else if(typeof Z==="string")this[I][0]=Z.slice(Q),X=Z.slice(0,Q),this[x]-=Q;else this[I][0]=Z.subarray(Q),X=Z.subarray(0,Q),this[x]-=Q}if(this.emit("data",X),!this[I].length&&!this[l])this.emit("drain");return X}end(Q,X,Z){if(typeof Q==="function")Z=Q,Q=void 0;if(typeof X==="function")Z=X,X="utf8";if(Q!==void 0)this.write(Q,X);if(Z)this.once("end",Z);if(this[l]=!0,this.writable=!1,this[w]||!this[UQ])this[o]();return this}[$Q](){if(this[v])return;if(!this[s]&&!this[D].length)this[T]=!0;if(this[UQ]=!1,this[w]=!0,this.emit("resume"),this[I].length)this[TQ]();else if(this[l])this[o]();else this.emit("drain")}resume(){return this[$Q]()}pause(){this[w]=!1,this[UQ]=!0,this[T]=!1}get destroyed(){return this[v]}get flowing(){return this[w]}get paused(){return this[UQ]}[X0](Q){if(this[F])this[x]+=1;else this[x]+=Q.length;this[I].push(Q)}[PQ](){if(this[F])this[x]-=1;else this[x]-=this[I][0].length;return this[I].shift()}[TQ](Q=!1){do;while(this[l0](this[PQ]())&&this[I].length);if(!Q&&!this[I].length&&!this[l])this.emit("drain")}[l0](Q){return this.emit("data",Q),this[w]}pipe(Q,X){if(this[v])return Q;this[T]=!1;let Z=this[p];if(X=X||{},Q===d0.stdout||Q===d0.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,Z){if(X.end)Q.end()}else if(this[D].push(!X.proxyErrors?new K0(this,Q,X):new i0(this,Q,X)),this[g])CQ(()=>this[$Q]());else this[$Q]();return Q}unpipe(Q){let X=this[D].find((Z)=>Z.dest===Q);if(X){if(this[D].length===1){if(this[w]&&this[s]===0)this[w]=!1;this[D]=[]}else this[D].splice(this[D].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let Z=super.on(Q,X);if(Q==="data"){if(this[T]=!1,this[s]++,!this[D].length&&!this[w])this[$Q]()}else if(Q==="readable"&&this[x]!==0)super.emit("readable");else if(E6(Q)&&this[p])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[GQ]){let V=X;if(this[g])CQ(()=>V.call(this,this[GQ]));else V.call(this,this[GQ])}return Z}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let Z=super.off(Q,X);if(Q==="data"){if(this[s]=this.listeners("data").length,this[s]===0&&!this[T]&&!this[D].length)this[w]=!1}return Z}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[s]=0,!this[T]&&!this[D].length)this[w]=!1}return X}get emittedEnd(){return this[p]}[o](){if(!this[DQ]&&!this[p]&&!this[v]&&this[I].length===0&&this[l]){if(this[DQ]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[SQ])this.emit("close");this[DQ]=!1}}emit(Q,...X){let Z=X[0];if(Q!=="error"&&Q!=="close"&&Q!==v&&this[v])return!1;else if(Q==="data")return!this[F]&&!Z?!1:this[g]?(CQ(()=>this[V0](Z)),!0):this[V0](Z);else if(Q==="end")return this[o0]();else if(Q==="close"){if(this[SQ]=!0,!this[p]&&!this[v])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Q==="error"){this[GQ]=Z,super.emit(Z0,Z);let $=!this[BQ]||this.listeners("error").length?super.emit("error",Z):!1;return this[o](),$}else if(Q==="resume"){let $=super.emit("resume");return this[o](),$}else if(Q==="finish"||Q==="prefinish"){let $=super.emit(Q);return this.removeAllListeners(Q),$}let V=super.emit(Q,...X);return this[o](),V}[V0](Q){for(let Z of this[D])if(Z.dest.write(Q)===!1)this.pause();let X=this[T]?!1:super.emit("data",Q);return this[o](),X}[o0](){if(this[p])return!1;return this[p]=!0,this.readable=!1,this[g]?(CQ(()=>this[$0]()),!0):this[$0]()}[$0](){if(this[VQ]){let X=this[VQ].end();if(X){for(let Z of this[D])Z.dest.write(X);if(!this[T])super.emit("data",X)}}for(let X of this[D])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[F])Q.dataLength=0;let X=this.promise();return this.on("data",(Z)=>{if(Q.push(Z),!this[F])Q.dataLength+=Z.length}),await X,Q}async concat(){if(this[F])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[m]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(v,()=>X(Error("stream destroyed"))),this.on("error",(Z)=>X(Z)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[T]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let V=this.read();if(V!==null)return Promise.resolve({done:!1,value:V});if(this[l])return X();let $,J,q=(j)=>{this.off("data",K),this.off("end",Y),this.off(v,H),X(),J(j)},K=(j)=>{this.off("error",q),this.off("end",Y),this.off(v,H),this.pause(),$({value:j,done:!!this[l]})},Y=()=>{this.off("error",q),this.off("data",K),this.off(v,H),X(),$({done:!0,value:void 0})},H=()=>q(Error("stream destroyed"));return new Promise((j,W)=>{J=W,$=j,this.once(v,H),this.once("error",q),this.once("end",Y),this.once("data",K)})},throw:X,return:X,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[T]=!1;let Q=!1,X=()=>{return this.pause(),this.off(Z0,X),this.off(v,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},Z=()=>{if(Q)return X();let V=this.read();return V===null?X():{done:!1,value:V}};return this.once("end",X),this.once(Z0,X),this.once(v,X),{next:Z,throw:X,return:X,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(Q){if(this[v]){if(Q)this.emit("error",Q);else this.emit(v);return this}this[v]=!0,this[T]=!0,this[I].length=0,this[x]=0;let X=this;if(typeof X.close==="function"&&!this[SQ])X.close();if(Q)this.emit("error",Q);else this.emit(v);return this}static get isStream(){return P6}}var s6=p6.native,_Q={lstatSync:l6,readdir:o6,readdirSync:n6,readlinkSync:i6,realpathSync:s6,promises:{lstat:r6,readdir:e6,readlink:t6,realpath:Q7}},e0=(Q)=>!Q||Q===_Q||Q===a6?_Q:{..._Q,...Q,promises:{..._Q.promises,...Q.promises||{}}},t0=/^\\\\\?\\([a-z]:)\\?$/i,X7=(Q)=>Q.replace(/\//g,"\\").replace(t0,"$1\\"),Z7=/[\\\/]/,y=0,Q5=1,X5=2,h=4,Z5=6,V5=8,e=10,$5=12,u=15,MQ=~u,Y0=16,p0=32,LQ=64,f=128,uQ=256,EQ=512,a0=LQ|f|EQ,V7=1023,H0=(Q)=>Q.isFile()?V5:Q.isDirectory()?h:Q.isSymbolicLink()?e:Q.isCharacterDevice()?X5:Q.isBlockDevice()?Z5:Q.isSocket()?$5:Q.isFIFO()?Q5:y,s0=new zQ({max:4096}),kQ=(Q)=>{let X=s0.get(Q);if(X)return X;let Z=Q.normalize("NFKD");return s0.set(Q,Z),Z},r0=new zQ({max:4096}),yQ=(Q)=>{let X=r0.get(Q);if(X)return X;let Z=kQ(Q.toLowerCase());return r0.set(Q,Z),Z};class j0 extends zQ{constructor(){super({max:256})}}class J5 extends zQ{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var q5=Symbol("PathScurry setAsCwd");class S{name;root;roots;parent;nocase;isCWD=!1;#Q;#Z;get dev(){return this.#Z}#J;get mode(){return this.#J}#$;get nlink(){return this.#$}#q;get uid(){return this.#q}#k;get gid(){return this.#k}#M;get rdev(){return this.#M}#W;get blksize(){return this.#W}#K;get ino(){return this.#K}#z;get size(){return this.#z}#j;get blocks(){return this.#j}#Y;get atimeMs(){return this.#Y}#V;get mtimeMs(){return this.#V}#G;get ctimeMs(){return this.#G}#A;get birthtimeMs(){return this.#A}#L;get atime(){return this.#L}#U;get mtime(){return this.#U}#F;get ctime(){return this.#F}#B;get birthtime(){return this.#B}#I;#x;#C;#_;#v;#O;#X;#b;#T;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=y,Z,V,$,J,q){if(this.name=Q,this.#I=$?yQ(Q):kQ(Q),this.#X=X&V7,this.nocase=$,this.roots=V,this.root=Z||this,this.#b=J,this.#C=q.fullpath,this.#v=q.relative,this.#O=q.relativePosix,this.parent=q.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=e0(q.fs)}depth(){if(this.#x!==void 0)return this.#x;if(!this.parent)return this.#x=0;return this.#x=this.parent.depth()+1}childrenCache(){return this.#b}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),V=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#P(V):this.#P(V)}#P(Q){let X=this;for(let Z of Q)X=X.child(Z);return X}children(){let Q=this.#b.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#b.set(this,X),this.#X&=~Y0,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let Z=this.children(),V=this.nocase?yQ(Q):kQ(Q);for(let K of Z)if(K.#I===V)return K;let $=this.parent?this.sep:"",J=this.#C?this.#C+$+Q:void 0,q=this.newChild(Q,y,{...X,parent:this,fullpath:J});if(!this.canReaddir())q.#X|=f;return Z.push(q),q}relative(){if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let Q=this.name,X=this.parent;if(!X)return this.#v=this.name;let Z=X.relative();return Z+(!Z||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let Q=this.name,X=this.parent;if(!X)return this.#O=this.fullpathPosix();let Z=X.relativePosix();return Z+(!Z||!X.parent?"":"/")+Q}fullpath(){if(this.#C!==void 0)return this.#C;let Q=this.name,X=this.parent;if(!X)return this.#C=this.name;let V=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#C=V}fullpathPosix(){if(this.#_!==void 0)return this.#_;if(this.sep==="/")return this.#_=this.fullpath();if(!this.parent){let V=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(V))return this.#_=`//?/${V}`;else return this.#_=V}let Q=this.parent,X=Q.fullpathPosix(),Z=X+(!X||!Q.parent?"":"/")+this.name;return this.#_=Z}isUnknown(){return(this.#X&u)===y}isType(Q){return this[`is${Q}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#X&u)===V5}isDirectory(){return(this.#X&u)===h}isCharacterDevice(){return(this.#X&u)===X5}isBlockDevice(){return(this.#X&u)===Z5}isFIFO(){return(this.#X&u)===Q5}isSocket(){return(this.#X&u)===$5}isSymbolicLink(){return(this.#X&e)===e}lstatCached(){return this.#X&p0?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#R}readdirCached(){let Q=this.children();return Q.slice(0,Q.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let Q=this.#X&u;return!(Q!==y&&Q!==e||this.#X&uQ||this.#X&f)}calledReaddir(){return!!(this.#X&Y0)}isENOENT(){return!!(this.#X&f)}isNamed(Q){return!this.nocase?this.#I===kQ(Q):this.#I===yQ(Q)}async readlink(){let Q=this.#T;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),Z=(await this.parent.realpath())?.resolve(X);if(Z)return this.#T=Z}catch(X){this.#S(X.code);return}}readlinkSync(){let Q=this.#T;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),Z=this.parent.realpathSync()?.resolve(X);if(Z)return this.#T=Z}catch(X){this.#S(X.code);return}}#m(Q){this.#X|=Y0;for(let X=Q.provisional;X<Q.length;X++){let Z=Q[X];if(Z)Z.#w()}}#w(){if(this.#X&f)return;this.#X=(this.#X|f)&MQ,this.#l()}#l(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#w()}#E(){this.#X|=EQ,this.#u()}#u(){if(this.#X&LQ)return;let Q=this.#X;if((Q&u)===h)Q&=MQ;this.#X=Q|LQ,this.#l()}#f(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#u();else if(Q==="ENOENT")this.#w();else this.children().provisional=0}#D(Q=""){if(Q==="ENOTDIR")this.parent.#u();else if(Q==="ENOENT")this.#w()}#S(Q=""){let X=this.#X;if(X|=uQ,Q==="ENOENT")X|=f;if(Q==="EINVAL"||Q==="UNKNOWN")X&=MQ;if(this.#X=X,Q==="ENOTDIR"&&this.parent)this.parent.#u()}#g(Q,X){return this.#d(Q,X)||this.#h(Q,X)}#h(Q,X){let Z=H0(Q),V=this.newChild(Q.name,Z,{parent:this}),$=V.#X&u;if($!==h&&$!==e&&$!==y)V.#X|=LQ;return X.unshift(V),X.provisional++,V}#d(Q,X){for(let Z=X.provisional;Z<X.length;Z++){let V=X[Z];if((this.nocase?yQ(Q.name):kQ(Q.name))!==V.#I)continue;return this.#H(Q,V,Z,X)}}#H(Q,X,Z,V){let $=X.name;if(X.#X=X.#X&MQ|H0(Q),$!==Q.name)X.name=Q.name;if(Z!==V.provisional){if(Z===V.length-1)V.pop();else V.splice(Z,1);V.unshift(X)}return V.provisional++,X}async lstat(){if((this.#X&f)===0)try{return this.#c(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#D(Q.code)}}lstatSync(){if((this.#X&f)===0)try{return this.#c(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#D(Q.code)}}#c(Q){let{atime:X,atimeMs:Z,birthtime:V,birthtimeMs:$,blksize:J,blocks:q,ctime:K,ctimeMs:Y,dev:H,gid:j,ino:W,mode:z,mtime:G,mtimeMs:B,nlink:U,rdev:_,size:C,uid:M}=Q;this.#L=X,this.#Y=Z,this.#B=V,this.#A=$,this.#W=J,this.#j=q,this.#F=K,this.#G=Y,this.#Z=H,this.#k=j,this.#K=W,this.#J=z,this.#U=G,this.#V=B,this.#$=U,this.#M=_,this.#z=C,this.#q=M;let k=H0(Q);if(this.#X=this.#X&MQ|k|p0,k!==y&&k!==h&&k!==e)this.#X|=LQ}#y=[];#N=!1;#o(Q){this.#N=!1;let X=this.#y.slice();this.#y.length=0,X.forEach((Z)=>Z(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let Z=this.children();if(this.calledReaddir()){let $=Z.slice(0,Z.provisional);if(X)Q(null,$);else queueMicrotask(()=>Q(null,$));return}if(this.#y.push(Q),this.#N)return;this.#N=!0;let V=this.fullpath();this.#Q.readdir(V,{withFileTypes:!0},($,J)=>{if($)this.#f($.code),Z.provisional=0;else{for(let q of J)this.#g(q,Z);this.#m(Z)}this.#o(Z.slice(0,Z.provisional));return})}#n;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#n)await this.#n;else{let Z=()=>{};this.#n=new Promise((V)=>Z=V);try{for(let V of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#g(V,Q);this.#m(Q)}catch(V){this.#f(V.code),Q.provisional=0}this.#n=void 0,Z()}return Q.slice(0,Q.provisional)}readdirSync(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();try{for(let Z of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#g(Z,Q);this.#m(Q)}catch(Z){this.#f(Z.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#X&a0)return!1;let Q=u&this.#X;if(!(Q===y||Q===h||Q===e))return!1;return!0}shouldWalk(Q,X){return(this.#X&h)===h&&!(this.#X&a0)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#R)return this.#R;if((EQ|uQ|f)&this.#X)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#R=this.resolve(Q)}catch(Q){this.#E()}}realpathSync(){if(this.#R)return this.#R;if((EQ|uQ|f)&this.#X)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#R=this.resolve(Q)}catch(Q){this.#E()}}[q5](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),Z=[],V=this;while(V&&V.parent)X.add(V),V.#v=Z.join(this.sep),V.#O=Z.join("/"),V=V.parent,Z.push("..");V=Q;while(V&&V.parent&&!X.has(V))V.#v=void 0,V.#O=void 0,V=V.parent}}class mQ extends S{sep="\\";splitSep=Z7;constructor(Q,X=y,Z,V,$,J,q){super(Q,X,Z,V,$,J,q)}newChild(Q,X=y,Z={}){return new mQ(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}getRootString(Q){return W0.parse(Q).root}getRoot(Q){if(Q=X7(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,Z]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=Z;return this.roots[Q]=new AQ(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(t0,"$1\\"),Q===X}}class fQ extends S{splitSep="/";sep="/";constructor(Q,X=y,Z,V,$,J,q){super(Q,X,Z,V,$,J,q)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=y,Z={}){return new fQ(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}}class z0{root;rootPath;roots;cwd;#Q;#Z;#J;nocase;#$;constructor(Q=process.cwd(),X,Z,{nocase:V,childrenCacheSize:$=16384,fs:J=_Q}={}){if(this.#$=e0(J),Q instanceof URL||Q.startsWith("file://"))Q=c6(Q);let q=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(q),this.#Q=new j0,this.#Z=new j0,this.#J=new J5($);let K=q.substring(this.rootPath.length).split(Z);if(K.length===1&&!K[0])K.pop();if(V===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=V,this.root=this.newRoot(this.#$),this.roots[this.rootPath]=this.root;let Y=this.root,H=K.length-1,j=X.sep,W=this.rootPath,z=!1;for(let G of K){let B=H--;Y=Y.child(G,{relative:Array(B).fill("..").join(j),relativePosix:Array(B).fill("..").join("/"),fullpath:W+=(z?"":j)+G}),z=!0}this.cwd=Y}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#J}resolve(...Q){let X="";for(let $=Q.length-1;$>=0;$--){let J=Q[$];if(!J||J===".")continue;if(X=X?`${J}/${X}`:J,this.isAbsolute(J))break}let Z=this.#Q.get(X);if(Z!==void 0)return Z;let V=this.cwd.resolve(X).fullpath();return this.#Q.set(X,V),V}resolvePosix(...Q){let X="";for(let $=Q.length-1;$>=0;$--){let J=Q[$];if(!J||J===".")continue;if(X=X?`${J}/${X}`:J,this.isAbsolute(J))break}let Z=this.#Z.get(X);if(Z!==void 0)return Z;let V=this.cwd.resolve(X).fullpathPosix();return this.#Z.set(X,V),V}relative(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relative()}relativePosix(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relativePosix()}basename(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.name}dirname(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return(Q.parent||Q).fullpath()}async readdir(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z}=X;if(!Q.canReaddir())return[];else{let V=await Q.readdir();return Z?V:V.map(($)=>$.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0}=X;if(!Q.canReaddir())return[];else if(Z)return Q.readdirSync();else return Q.readdirSync().map((V)=>V.name)}async lstat(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstat()}lstatSync(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstatSync()}async readlink(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.readlink();return X?Z:Z?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q.withFileTypes,Q=this.cwd;let Z=Q.readlinkSync();return X?Z:Z?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.realpath();return X?Z:Z?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q.withFileTypes,Q=this.cwd;let Z=Q.realpathSync();return X?Z:Z?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=[];if(!$||$(Q))q.push(Z?Q:Q.fullpath());let K=new Set,Y=(j,W)=>{K.add(j),j.readdirCB((z,G)=>{if(z)return W(z);let B=G.length;if(!B)return W();let U=()=>{if(--B===0)W()};for(let _ of G){if(!$||$(_))q.push(Z?_:_.fullpath());if(V&&_.isSymbolicLink())_.realpath().then((C)=>C?.isUnknown()?C.lstat():C).then((C)=>C?.shouldWalk(K,J)?Y(C,U):U());else if(_.shouldWalk(K,J))Y(_,U);else U()}},!0)},H=Q;return new Promise((j,W)=>{Y(H,(z)=>{if(z)return W(z);j(q)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=[];if(!$||$(Q))q.push(Z?Q:Q.fullpath());let K=new Set([Q]);for(let Y of K){let H=Y.readdirSync();for(let j of H){if(!$||$(j))q.push(Z?j:j.fullpath());let W=j;if(j.isSymbolicLink()){if(!(V&&(W=j.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(K,J))K.add(W)}}return q}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X;if(!$||$(Q))yield Z?Q:Q.fullpath();let q=new Set([Q]);for(let K of q){let Y=K.readdirSync();for(let H of Y){if(!$||$(H))yield Z?H:H.fullpath();let j=H;if(H.isSymbolicLink()){if(!(V&&(j=H.realpathSync())))continue;if(j.isUnknown())j.lstatSync()}if(j.shouldWalk(q,J))q.add(j)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=new r({objectMode:!0});if(!$||$(Q))q.write(Z?Q:Q.fullpath());let K=new Set,Y=[Q],H=0,j=()=>{let W=!1;while(!W){let z=Y.shift();if(!z){if(H===0)q.end();return}H++,K.add(z);let G=(U,_,C=!1)=>{if(U)return q.emit("error",U);if(V&&!C){let M=[];for(let k of _)if(k.isSymbolicLink())M.push(k.realpath().then((A)=>A?.isUnknown()?A.lstat():A));if(M.length){Promise.all(M).then(()=>G(null,_,!0));return}}for(let M of _)if(M&&(!$||$(M))){if(!q.write(Z?M:M.fullpath()))W=!0}H--;for(let M of _){let k=M.realpathCached()||M;if(k.shouldWalk(K,J))Y.push(k)}if(W&&!q.flowing)q.once("drain",j);else if(!B)j()},B=!0;z.readdirCB(G,!0),B=!1}};return j(),q}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=new r({objectMode:!0}),K=new Set;if(!$||$(Q))q.write(Z?Q:Q.fullpath());let Y=[Q],H=0,j=()=>{let W=!1;while(!W){let z=Y.shift();if(!z){if(H===0)q.end();return}H++,K.add(z);let G=z.readdirSync();for(let B of G)if(!$||$(B)){if(!q.write(Z?B:B.fullpath()))W=!0}H--;for(let B of G){let U=B;if(B.isSymbolicLink()){if(!(V&&(U=B.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(K,J))Y.push(U)}}if(W&&!q.flowing)q.once("drain",j)};return j(),q}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[q5](X)}}class AQ extends z0{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,W0,"\\",{...X,nocase:Z});this.nocase=Z;for(let V=this.cwd;V;V=V.parent)V.nocase=this.nocase}parseRootPath(Q){return W0.parse(Q).root.toUpperCase()}newRoot(Q){return new mQ(this.rootPath,h,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class vQ extends z0{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:Z=!1}=X;super(Q,d6,"/",{...X,nocase:Z});this.nocase=Z}parseRootPath(Q){return"/"}newRoot(Q){return new fQ(this.rootPath,h,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class gQ extends vQ{constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,{...X,nocase:Z})}}var w8=process.platform==="win32"?mQ:fQ,K5=process.platform==="win32"?AQ:process.platform==="darwin"?gQ:vQ;var $7=(Q)=>Q.length>=1,J7=(Q)=>Q.length>=1;class JQ{#Q;#Z;#J;length;#$;#q;#k;#M;#W;#K;#z=!0;constructor(Q,X,Z,V){if(!$7(Q))throw TypeError("empty pattern list");if(!J7(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,Z<0||Z>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#Z=X,this.#J=Z,this.#$=V,this.#J===0){if(this.isUNC()){let[$,J,q,K,...Y]=this.#Q,[H,j,W,z,...G]=this.#Z;if(Y[0]==="")Y.shift(),G.shift();let B=[$,J,q,K,""].join("/"),U=[H,j,W,z,""].join("/");this.#Q=[B,...Y],this.#Z=[U,...G],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[$,...J]=this.#Q,[q,...K]=this.#Z;if(J[0]==="")J.shift(),K.shift();let Y=$+"/",H=q+"/";this.#Q=[Y,...J],this.#Z=[H,...K],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#J]}isString(){return typeof this.#Q[this.#J]==="string"}isGlobstar(){return this.#Q[this.#J]===R}isRegExp(){return this.#Q[this.#J]instanceof RegExp}globString(){return this.#k=this.#k||(this.#J===0?this.isAbsolute()?this.#Z[0]+this.#Z.slice(1).join("/"):this.#Z.join("/"):this.#Z.slice(this.#J).join("/"))}hasMore(){return this.length>this.#J+1}rest(){if(this.#q!==void 0)return this.#q;if(!this.hasMore())return this.#q=null;return this.#q=new JQ(this.#Q,this.#Z,this.#J+1,this.#$),this.#q.#K=this.#K,this.#q.#W=this.#W,this.#q.#M=this.#M,this.#q}isUNC(){let Q=this.#Q;return this.#W!==void 0?this.#W:this.#W=this.#$==="win32"&&this.#J===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#M!==void 0?this.#M:this.#M=this.#$==="win32"&&this.#J===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#K!==void 0?this.#K:this.#K=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#J===0?Q:""}checkFollowGlobstar(){return!(this.#J===0||!this.isGlobstar()||!this.#z)}markFollowGlobstar(){if(this.#J===0||!this.isGlobstar()||!this.#z)return!1;return this.#z=!1,!0}}var q7=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class wQ{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:Z,noext:V,noglobstar:$,platform:J=q7}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=J,this.mmopts={dot:!0,nobrace:X,nocase:Z,noext:V,noglobstar:$,optimizationLevel:2,platform:J,nocomment:!0,nonegate:!0};for(let q of Q)this.add(q)}add(Q){let X=new b(Q,this.mmopts);for(let Z=0;Z<X.set.length;Z++){let V=X.set[Z],$=X.globParts[Z];if(!V||!$)throw Error("invalid pattern object");while(V[0]==="."&&$[0]===".")V.shift(),$.shift();let J=new JQ(V,$,0,this.platform),q=new b(J.globString(),this.mmopts),K=$[$.length-1]==="**",Y=J.isAbsolute();if(Y)this.absolute.push(q);else this.relative.push(q);if(K)if(Y)this.absoluteChildren.push(q);else this.relativeChildren.push(q)}}ignored(Q){let X=Q.fullpath(),Z=`${X}/`,V=Q.relative()||".",$=`${V}/`;for(let J of this.relative)if(J.match(V)||J.match($))return!0;for(let J of this.absolute)if(J.match(X)||J.match(Z))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",Z=(Q.relative()||".")+"/";for(let V of this.relativeChildren)if(V.match(Z))return!0;for(let V of this.absoluteChildren)if(V.match(X))return!0;return!1}}class G0{store;constructor(Q=new Map){this.store=Q}copy(){return new G0(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let Z=Q.fullpath(),V=this.store.get(Z);if(V)V.add(X.globString());else this.store.set(Z,new Set([X.globString()]))}}class Y5{store=new Map;add(Q,X,Z){let V=(X?2:0)|(Z?1:0),$=this.store.get(Q);this.store.set(Q,$===void 0?V:V&$)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class H5{store=new Map;add(Q,X){if(!Q.canReaddir())return;let Z=this.store.get(Q);if(Z){if(!Z.find((V)=>V.globString()===X.globString()))Z.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class IQ{hasWalkedCache;matches=new Y5;subwalks=new H5;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new G0}processPatterns(Q,X){this.patterns=X;let Z=X.map((V)=>[Q,V]);for(let[V,$]of Z){this.hasWalkedCache.storeWalked(V,$);let J=$.root(),q=$.isAbsolute()&&this.opts.absolute!==!1;if(J){V=V.resolve(J==="/"&&this.opts.root!==void 0?this.opts.root:J);let j=$.rest();if(!j){this.matches.add(V,!0,!1);continue}else $=j}if(V.isENOENT())continue;let K,Y,H=!1;while(typeof(K=$.pattern())==="string"&&(Y=$.rest()))V=V.resolve(K),$=Y,H=!0;if(K=$.pattern(),Y=$.rest(),H){if(this.hasWalkedCache.hasWalked(V,$))continue;this.hasWalkedCache.storeWalked(V,$)}if(typeof K==="string"){let j=K===".."||K===""||K===".";this.matches.add(V.resolve(K),q,j);continue}else if(K===R){if(!V.isSymbolicLink()||this.follow||$.checkFollowGlobstar())this.subwalks.add(V,$);let j=Y?.pattern(),W=Y?.rest();if(!Y||(j===""||j===".")&&!W)this.matches.add(V,q,j===""||j===".");else if(j===".."){let z=V.parent||V;if(!W)this.matches.add(z,q,!0);else if(!this.hasWalkedCache.hasWalked(z,W))this.subwalks.add(z,W)}}else if(K instanceof RegExp)this.subwalks.add(V,$)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new IQ(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let Z=this.subwalks.get(Q),V=this.child();for(let $ of X)for(let J of Z){let q=J.isAbsolute(),K=J.pattern(),Y=J.rest();if(K===R)V.testGlobstar($,J,Y,q);else if(K instanceof RegExp)V.testRegExp($,K,Y,q);else V.testString($,K,Y,q)}return V}testGlobstar(Q,X,Z,V){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,V,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if(Z&&X.checkFollowGlobstar())this.subwalks.add(Q,Z);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if(Z){let $=Z.pattern();if(typeof $==="string"&&$!==".."&&$!==""&&$!==".")this.testString(Q,$,Z.rest(),V);else if($===".."){let J=Q.parent||Q;this.subwalks.add(J,Z)}else if($ instanceof RegExp)this.testRegExp(Q,$,Z.rest(),V)}}testRegExp(Q,X,Z,V){if(!X.test(Q.name))return;if(!Z)this.matches.add(Q,V,!1);else this.subwalks.add(Q,Z)}testString(Q,X,Z,V){if(!Q.isNamed(X))return;if(!Z)this.matches.add(Q,V,!1);else this.subwalks.add(Q,Z)}}var K7=(Q,X)=>typeof Q==="string"?new wQ([Q],X):Array.isArray(Q)?new wQ(Q,X):Q;class U0{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#Z;#J;signal;maxDepth;includeChildMatches;constructor(Q,X,Z){if(this.patterns=Q,this.path=X,this.opts=Z,this.#J=!Z.posix&&Z.platform==="win32"?"\\":"/",this.includeChildMatches=Z.includeChildMatches!==!1,Z.ignore||!this.includeChildMatches){if(this.#Z=K7(Z.ignore??[],Z),!this.includeChildMatches&&typeof this.#Z.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Z.maxDepth||1/0,Z.signal)this.signal=Z.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#$(Q){return this.seen.has(Q)||!!this.#Z?.ignored?.(Q)}#q(Q){return!!this.#Z?.childrenIgnored?.(Q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Q=void 0;while(!this.paused&&(Q=this.#Q.shift()))Q()}onResume(Q){if(this.signal?.aborted)return;if(!this.paused)Q();else this.#Q.push(Q)}async matchCheck(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||await Q.realpath(),!Z)return;Q=Z}let $=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let J=await $.realpath();if(J&&(J.isUnknown()||this.opts.stat))await J.lstat()}return this.matchCheckTest($,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#$(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||Q.realpathSync(),!Z)return;Q=Z}let $=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let J=$.realpathSync();if(J&&(J?.isUnknown()||this.opts.stat))J.lstatSync()}return this.matchCheckTest($,X)}matchFinish(Q,X){if(this.#$(Q))return;if(!this.includeChildMatches&&this.#Z?.add){let $=`${Q.relativePosix()}/**`;this.#Z.add($)}let Z=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let V=this.opts.mark&&Q.isDirectory()?this.#J:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if(Z){let $=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit($+V)}else{let $=this.opts.posix?Q.relativePosix():Q.relative(),J=this.opts.dotRelative&&!$.startsWith(".."+this.#J)?"."+this.#J:"";this.matchEmit(!$?"."+V:J+$+V)}}async match(Q,X,Z){let V=await this.matchCheck(Q,Z);if(V)this.matchFinish(V,X)}matchSync(Q,X,Z){let V=this.matchCheckSync(Q,Z);if(V)this.matchFinish(V,X)}walkCB(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2(Q,X,new IQ(this.opts),Z)}walkCB2(Q,X,Z,V){if(this.#q(Q))return V();if(this.signal?.aborted)V();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,Z,V));return}Z.processPatterns(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,K,Y]of Z.matches.entries()){if(this.#$(q))continue;$++,this.match(q,K,Y).then(()=>J())}for(let q of Z.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;$++;let K=q.readdirCached();if(q.calledReaddir())this.walkCB3(q,K,Z,J);else q.readdirCB((Y,H)=>this.walkCB3(q,H,Z,J),!0)}J()}walkCB3(Q,X,Z,V){Z=Z.filterEntries(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,K,Y]of Z.matches.entries()){if(this.#$(q))continue;$++,this.match(q,K,Y).then(()=>J())}for(let[q,K]of Z.subwalks.entries())$++,this.walkCB2(q,K,Z.child(),J);J()}walkCBSync(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2Sync(Q,X,new IQ(this.opts),Z)}walkCB2Sync(Q,X,Z,V){if(this.#q(Q))return V();if(this.signal?.aborted)V();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,Z,V));return}Z.processPatterns(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,K,Y]of Z.matches.entries()){if(this.#$(q))continue;this.matchSync(q,K,Y)}for(let q of Z.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;$++;let K=q.readdirSync();this.walkCB3Sync(q,K,Z,J)}J()}walkCB3Sync(Q,X,Z,V){Z=Z.filterEntries(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,K,Y]of Z.matches.entries()){if(this.#$(q))continue;this.matchSync(q,K,Y)}for(let[q,K]of Z.subwalks.entries())$++,this.walkCB2Sync(q,K,Z.child(),J);J()}}class hQ extends U0{matches=new Set;constructor(Q,X,Z){super(Q,X,Z)}matchEmit(Q){this.matches.add(Q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Q,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(this.signal.reason);else Q(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class dQ extends U0{results;constructor(Q,X,Z){super(Q,X,Z);this.results=new r({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Q){if(this.results.write(Q),!this.results.flowing)this.pause()}stream(){let Q=this.path;if(Q.isUnknown())Q.lstat().then(()=>{this.walkCB(Q,this.patterns,()=>this.results.end())});else this.walkCB(Q,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var H7=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class d{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(Q,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=Y7(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((K)=>K.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((K)=>K.includes("/")?K:`./**/${K}`)}if(this.pattern=Q,this.platform=X.platform||H7,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let K=X.platform==="win32"?AQ:X.platform==="darwin"?gQ:X.platform?vQ:K5;this.scurry=new K(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let Z=this.platform==="darwin"||this.platform==="win32",V={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Z,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},$=this.pattern.map((K)=>new b(K,V)),[J,q]=$.reduce((K,Y)=>{return K[0].push(...Y.set),K[1].push(...Y.globParts),K},[[],[]]);this.patterns=J.map((K,Y)=>{let H=q[Y];if(!H)throw Error("invalid pattern object");return new JQ(K,H,0,this.platform)})}async walk(){return[...await new hQ(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new hQ(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new dQ(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new dQ(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var B0=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let Z of Q)if(new b(Z,X).hasMagic())return!0;return!1};function lQ(Q,X={}){return new d(Q,X).streamSync()}function j5(Q,X={}){return new d(Q,X).stream()}function z5(Q,X={}){return new d(Q,X).walkSync()}async function W5(Q,X={}){return new d(Q,X).walk()}function oQ(Q,X={}){return new d(Q,X).iterateSync()}function G5(Q,X={}){return new d(Q,X).iterate()}var W7=lQ,j7=Object.assign(j5,{sync:lQ}),z7=oQ,G7=Object.assign(G5,{sync:oQ}),U7=Object.assign(z5,{stream:lQ,iterate:oQ}),cQ=Object.assign(W5,{glob:W5,globSync:z5,sync:U7,globStream:j5,stream:j7,globStreamSync:lQ,streamSync:W7,globIterate:G5,iterate:G7,globIterateSync:oQ,iterateSync:z7,Glob:d,hasMagic:B0,escape:ZQ,unescape:E});cQ.glob=cQ;import{resolve as C7}from"path";var M7=nQ.object({description:nQ.string().optional().describe("what you want to do"),pattern:nQ.string().describe("The glob pattern to match files against"),path:nQ.string().optional().describe('The directory to search in. Can be absolute or relative to cwd. If not specified, the current working directory (cwd) will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.')}),U5=B7(async({pattern:Q,path:X},Z)=>{if(!Z.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let V=X?C7(Z.state.cwd,X):Z.state.cwd,$=await cQ(Q,{ignore:["node_modules",".git","dist","build",".next",".turbo","coverage",".nyc_output","temp",".cache","vendor","venv","__pycache__","*.pyc","target","out",".output"],cwd:V,absolute:!0});if($.length===0)return"No files found.";return $.join(`
|
|
26
|
-
`)},{name:"glob_files",description:`- Fast file pattern matching tool that works with any codebase size
|
|
27
|
-
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
28
|
-
- Returns matching file paths sorted by modification time
|
|
29
|
-
- Use this tool when you need to find files by name patterns
|
|
30
|
-
- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
|
|
31
|
-
- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.`,schema:M7});import{tool as v7}from"@langchain/core/tools";import{z as xQ}from"zod";import{execa as J9}from"execa";import K9 from"extract-zip";import H9 from"fs-extra";import{dirname as _7,join as L7}from"node:path";import{fileURLToPath as k7}from"node:url";import{pathExists as G9}from"path-exists";import{temporaryFile as B9}from"tempy";import{xdgCache as M9}from"xdg-basedir";var A7=_7(k7(import.meta.url));var _9=process.env.RIPGREP_VERSION||"v15.0.0";var B5=L7(A7,`rg${process.platform==="win32"?".exe":""}`);import{execa as w7}from"execa";import{resolve as I7}from"path";var x7=async(Q,X,Z={})=>{let{timeout:V=15000,cwd:$}=Z;try{let J=await w7(Q,X,{cwd:$||process.cwd(),timeout:V,reject:!1,stripFinalNewline:!1,stdio:["pipe","pipe","pipe"],env:process.env});return{code:J.exitCode??0,stdout:J.stdout,stderr:J.stderr}}catch(J){if(J.timedOut)return{code:124,stdout:J.stdout||"",stderr:(J.stderr||"")+`
|
|
32
|
-
Process timed out`};return{code:J.exitCode||1,stdout:J.stdout||"",stderr:J.stderr||J.message||"Unknown error"}}},C5=v7(async({args:Q,head_limit:X},Z)=>{if(!Z.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");if(!Q||Q.length===0)return"Error: No arguments provided. Please provide ripgrep arguments.";if(!X&&!Q.includes("--max-count"))X=500;let V=Q[Q.length-1],$=[...Q];if(V&&!V.startsWith("-"))$[$.length-1]=I7(Z.state.cwd,V);let J=await x7(B5,$,{timeout:15000,cwd:Z.state.cwd});if(X&&J.stdout){let q=J.stdout.split(`
|
|
33
|
-
`);if(q.length>X)J.stdout=q.slice(0,X).join(`
|
|
34
|
-
`)}if(J.code!==0&&J.stderr){if(J.code===1&&J.stdout==="")return"No matches found.";if(J.code===124||J.stderr.includes("timeout")||J.stderr.includes("timed out"))return"Error: Search timed out after 15 seconds. Please use a more specific pattern or limit the search scope with type/glob/path parameters.";return`Error executing ripgrep: ${J.stderr}`}return J.stdout||"No matches found."},{name:"search_files_rg",description:`Ripgrep (rg) - A fast text search tool that recursively searches directories for regex patterns
|
|
35
|
-
|
|
36
|
-
⚠️ IMPORTANT USAGE GUIDELINES:
|
|
37
|
-
- This tool wraps the ripgrep (rg) command-line tool
|
|
38
|
-
- Use this ONLY for searching TEXT PATTERNS within file contents
|
|
39
|
-
- For reading entire files, use the Read tool instead
|
|
40
|
-
- For finding files by name patterns, use the Glob tool instead
|
|
41
|
-
|
|
42
|
-
\uD83D\uDD0D SEARCH PATH REQUIREMENT:
|
|
43
|
-
- MUST always specify a search path at the end of args array
|
|
44
|
-
- If no specific path needed, use "./" for current directory
|
|
45
|
-
- Never omit the path parameter - ripgrep requires it
|
|
46
|
-
- Relative paths are resolved relative to the current working directory (cwd)
|
|
47
|
-
|
|
48
|
-
Usage - Pass ripgrep (rg) arguments as an array:
|
|
49
|
-
The args array corresponds directly to 'rg [OPTIONS] PATTERN [PATH...]'
|
|
50
|
-
|
|
51
|
-
Examples:
|
|
52
|
-
- Search pattern in current directory: ["PATTERN", "./"]
|
|
53
|
-
- Search in specific path: ["PATTERN", "src/"]
|
|
54
|
-
- Search with file type filter: ["--type", "ts", "PATTERN", "./"]
|
|
55
|
-
- Case insensitive search: ["-i", "PATTERN", "./"]
|
|
56
|
-
- Show line numbers: ["-n", "PATTERN", "./"]
|
|
57
|
-
- Show context lines: ["-C", "3", "PATTERN", "./"]
|
|
58
|
-
- Only show file names: ["-l", "PATTERN", "./"]
|
|
59
|
-
- Count matches: ["-c", "PATTERN", "./"]
|
|
60
|
-
- Multiple options: ["-n", "-i", "--type", "js", "function", "src/"]
|
|
61
|
-
|
|
62
|
-
Common ripgrep (rg) options:
|
|
63
|
-
- -i, --ignore-case: Case insensitive search
|
|
64
|
-
- -n, --line-number: Show line numbers
|
|
65
|
-
- -A NUM: Show NUM lines after each match
|
|
66
|
-
- -B NUM: Show NUM lines before each match
|
|
67
|
-
- -C NUM: Show NUM lines around each match
|
|
68
|
-
- -l, --files-with-matches: Only show file paths that match
|
|
69
|
-
- -c, --count: Only show count of matches per file
|
|
70
|
-
- --type TYPE: Only search files of TYPE (js, ts, py, rust, etc.)
|
|
71
|
-
- --glob PATTERN: Include/exclude files matching PATTERN
|
|
72
|
-
- --max-count NUM: Stop after NUM matches per file
|
|
73
|
-
- --no-ignore: Don't respect .gitignore files
|
|
74
|
-
- --hidden: Search hidden files and directories
|
|
75
|
-
|
|
76
|
-
Performance:
|
|
77
|
-
- 15 second timeout per search
|
|
78
|
-
- Results limited to 500 lines by default (use head_limit parameter)
|
|
79
|
-
- Respects .gitignore by default (use --no-ignore to override)
|
|
80
|
-
`,schema:xQ.object({description:xQ.string().optional().describe("what you want to do"),args:xQ.array(xQ.string()).describe('Ripgrep (rg) command arguments as array. Format: [OPTIONS...] PATTERN [PATH...]. MUST include path at end! Examples: ["import", "./"] (search "import" in current dir), ["-n", "-i", "function", "./"] (search "function" with line numbers, case insensitive), ["--type", "ts", "export", "src/"] (search "export" in TypeScript files in src/).'),head_limit:xQ.number().optional().describe("Limit output to first N lines. If not specified and no --max-count in args, defaults to 500 lines for performance.")})});import{tool as O7}from"@langchain/core/tools";import{z as OQ}from"zod";import{promises as R7}from"fs";import{resolve as F7}from"path";var C0=2000,N7=OQ.object({description:OQ.string().optional().describe("what you want to do"),file_path:OQ.string().describe("The path to the file to read (absolute or relative to cwd)"),offset:OQ.number().default(0).optional().describe("The line number to start reading from. Only provide if the file is too large to read at once"),limit:OQ.number().default(C0).optional().describe("The number of lines to read. Only provide if the file is too large to read at once.")}),M5=O7(async({file_path:Q,offset:X,limit:Z},V)=>{try{if(!V.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let $=F7(V.state.cwd,Q),q=(await R7.readFile($,"utf-8")).split(`
|
|
81
|
-
`);if(X)q=q.slice(X-1);if(Z)q=q.slice(0,Z);return q.join(`
|
|
82
|
-
`)}catch($){if($.code==="ENOENT")return`Error: File not found at ${Q}`;throw $}},{name:"read_file",description:`Reads a file from the local filesystem. Relative paths are resolved based on the current working directory (cwd).
|
|
83
|
-
Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
|
|
84
|
-
|
|
85
|
-
Usage:
|
|
86
|
-
- The file_path parameter can be either an absolute path or a relative path
|
|
87
|
-
- Relative paths are resolved relative to the current working directory (cwd)
|
|
88
|
-
- By default, it reads up to ${C0} lines starting from the beginning of the file
|
|
89
|
-
- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters
|
|
90
|
-
- Any lines longer than ${C0} characters will be truncated
|
|
91
|
-
- Results are returned using cat -n format, with line numbers starting at 1
|
|
92
|
-
- This tool allows You to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as You is a multimodal LLM.
|
|
93
|
-
- This tool can read PDF files (.pdf). PDFs are processed page by page, extracting both text and visual content for analysis.
|
|
94
|
-
- This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
|
|
95
|
-
- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful.
|
|
96
|
-
- You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/123/abc/T/TemporaryItems/NSIRD_screencaptureui_ZfB1tD/Screenshot.png
|
|
97
|
-
- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.`,schema:N7});import{tool as D7}from"@langchain/core/tools";import{z as iQ}from"zod";import{promises as S7}from"fs";import{resolve as T7}from"path";var _5=D7(async({file_path:Q,content:X},Z)=>{if(!Z.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");try{let V=T7(Z.state.cwd,Q);return await S7.writeFile(V,X,"utf-8"),`File ${V} has been written successfully.`}catch(V){return`Error writing file: ${V.message}`}},{name:"write_file",description:`Writes a file to the local filesystem. Relative paths are resolved based on the current working directory (cwd).
|
|
98
|
-
Usage:
|
|
99
|
-
- This tool will overwrite the existing file if there is one at the provided path.
|
|
100
|
-
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
|
|
101
|
-
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
102
|
-
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
|
103
|
-
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`,schema:iQ.object({description:iQ.string().optional().describe("what you want to do"),file_path:iQ.string().describe("The path to the file to write (absolute or relative to cwd)"),content:iQ.string().describe("The content to write to the file")})});import{tool as P7}from"@langchain/core/tools";import{z as qQ}from"zod";import{promises as M0}from"fs";import{resolve as b7}from"path";var u7=qQ.object({description:qQ.string().optional().describe("what you want to do"),file_path:qQ.string().describe("The path to the file to modify (absolute or relative to cwd)"),old_string:qQ.string().describe("The text to replace"),new_string:qQ.string().describe("The text to replace it with (must be different from old_string)"),replace_all:qQ.boolean().optional().default(!1).describe("Replace all occurences of old_string (default false)")}),L5=P7(async({file_path:Q,old_string:X,new_string:Z,replace_all:V=!1},$)=>{try{if(!$.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let J=b7($.state.cwd,Q),q=await M0.readFile(J,"utf-8");if(V){if(!q.includes(X))return`Error: old_string not found in ${J}`;let K=q.split(X).join(Z);return await M0.writeFile(J,K,"utf-8"),`File ${J} has been edited successfully. Replaced all occurrences of old_string.`}else{let K=q.split(X);if(K.length===1)return`Error: old_string not found in ${J}`;if(K.length>2)return`Error: old_string is not unique in ${J} (found ${K.length-1} occurrences). Please provide more context or set replace_all to true.`;let Y=q.replace(X,Z);return await M0.writeFile(J,Y,"utf-8"),`File ${J} has been edited successfully. Replaced single occurrence of old_string.`}}catch(J){if(J.code==="ENOENT")return`Error: File not found at ${Q}`;throw J}},{name:"edit_file",description:`Performs exact string replacements in files. Relative paths are resolved based on the current working directory (cwd).
|
|
104
|
-
|
|
105
|
-
Usage:
|
|
106
|
-
- You must use your \`Read\` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
|
|
107
|
-
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
|
|
108
|
-
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
109
|
-
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
|
110
|
-
- The edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`.
|
|
111
|
-
- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.`,schema:u7});class k5{name="FilesystemMiddleware";contextSchema=void 0;stateSchema=void 0;tools=[M5,_5,L5,U5,C5,L0];async execute(){return this}}var t=new Map;import{tool as y7}from"@langchain/core/tools";import{z as a}from"zod";import{execa as A5}from"execa";var pQ=process.platform==="win32",v5=pQ?"cmd.exe":"/bin/bash",w5=pQ?["/d","/s","/c"]:["-c"],_0=y7(async({command:Q,timeout:X,run_in_background:Z,kill_process_id:V,get_output_id:$,filter:J},q)=>{if(V){let K=parseInt(V,10),Y=t.get(K);if(!Y)return`Error: No background process found with ID ${V}.`;return Y.process.kill(),t.delete(K),`Successfully killed process with ID ${V}.`}if($){let K=parseInt($,10),Y=t.get(K);if(!Y)return`Error: No background process found with ID ${$}.`;let H=Y.stdout.join(""),j=Y.stderr.join("");if(Y.stdout=[],Y.stderr=[],J){let z=new RegExp(J);H=H.split(`
|
|
112
|
-
`).filter((G)=>z.test(G)).join(`
|
|
113
|
-
`),j=j.split(`
|
|
114
|
-
`).filter((G)=>z.test(G)).join(`
|
|
115
|
-
`)}let W="";if(H)W+=`STDOUT:
|
|
116
|
-
${H}
|
|
117
|
-
`;if(j)W+=`STDERR:
|
|
118
|
-
${j}
|
|
119
|
-
`;return W||"No new output since last check."}if(!Q)return"Error: 'command' argument is required unless using 'kill_process_id' or 'get_output_id'.";if(!q.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");if(Z)try{let K=A5(v5,[...w5,Q],{cwd:q.state.cwd,timeout:X??20000,reject:!1,windowsVerbatimArguments:pQ});if(!K.pid)return"Failed to start command in background.";let Y={process:K,stdout:[],stderr:[],command:Q,startTime:Date.now()};return t.set(K.pid,Y),K.stdout?.on("data",(H)=>{Y.stdout.push(H.toString())}),K.stderr?.on("data",(H)=>{Y.stderr.push(H.toString())}),K.on("close",()=>{}),`Command started in background with ID: ${K.pid}`}catch(K){return`Error starting background command: ${K}`}else try{let K=await A5(v5,[...w5,Q],{cwd:q.state.cwd,timeout:X??20000,reject:!1,windowsVerbatimArguments:pQ});if(K.exitCode!==0)return K.stderr;return K.stdout}catch(K){return`Error executing command: ${K}`}},{name:"terminal",description:`Executes commands in a persistent shell session (Bash on Linux/macOS, CMD on Windows). Commands are executed in the current working directory (cwd).
|
|
120
|
-
Features:
|
|
121
|
-
- Run commands (foreground or background)
|
|
122
|
-
- Retrieve background process output
|
|
123
|
-
- Kill background processes
|
|
124
|
-
- Cross-platform support (auto-detects OS)
|
|
125
|
-
|
|
126
|
-
Usage:
|
|
127
|
-
1. Run Command: Provide \`command\`. Optional: \`run_in_background\`, \`timeout\`.
|
|
128
|
-
2. Check Output: Provide \`get_output_id\`. Optional: \`filter\`.
|
|
129
|
-
3. Kill Process: Provide \`kill_process_id\`.
|
|
130
|
-
|
|
131
|
-
Notes:
|
|
132
|
-
- For file paths with spaces, ALWAYS use quotes: "path/to file"
|
|
133
|
-
- Commands are executed relative to the current working directory (cwd)
|
|
134
|
-
- Avoid interactive commands (like top, vim)
|
|
135
|
-
- Use '&&' or ';' to chain commands (PowerShell/CMD syntax varies, simple chaining often works)
|
|
136
|
-
- CAN'T BATCH CALL THIS TOOL!
|
|
137
|
-
`,schema:a.object({description:a.string().describe("what you want to do"),command:a.string().optional().describe("The command to execute (required for running commands)"),timeout:a.number().optional().describe("Timeout in ms (default: 20000)"),run_in_background:a.boolean().optional().describe("Run command in background"),kill_process_id:a.string().optional().describe("ID of process to kill"),get_output_id:a.string().optional().describe("ID of process to get output from"),filter:a.string().optional().describe("Regex to filter output (only for get_output_id)")})});class I5{name="TerminalMiddleware";contextSchema=void 0;stateSchema=void 0;tools=[_0];async execute(){return this}}export{L0 as Fa,U5 as Ga,M5 as Ha,L5 as Ia,k5 as Ja,t as Ka,I5 as La};
|
package/dist/chunk-6rfc36jg.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as t,e as r}from"./chunk-j7a40ww9.js";import{M as o}from"./chunk-rncpxz1b.js";import{N as T}from"./chunk-hfve7nf5.js";import"./chunk-va71tsw3.js";import{ea as v,fa as Z,ga as H,ja as p,oa as c,pa as E,ra as i,ta as s}from"./chunk-nwy6n6b6.js";import"./chunk-5rr85f28.js";import"./chunk-cggjws6a.js";import"./chunk-cyexd09c.js";import"./chunk-r2h3x9zv.js";import"./chunk-1ttywx0y.js";import{ub as I}from"./chunk-kba8akjs.js";var qq=I(v(),1);var _=I(v(),1);var $=I(E(),1),a={openai:"\uD83E\uDD16",anthropic:"\uD83E\uDDE0",gemini:"✨",default:"\uD83D\uDD2E"};var Gq=({onClose:L})=>{let{extraParams:B,config:U,updateConfig:K}=T(),[X,A]=_.useState(""),j=_.useRef([]),G=_.useMemo(()=>{if(!U?.providers||U.providers.length===0)return[];return U.providers.map((q)=>{let Y=q.type||"default";return{id:q.id,label:q.id,icon:a[Y]||a.default,config:q}})},[U?.providers]);_.useMemo(()=>{if(G.length>0&&!X){let q=G.find((Y)=>Y.id===B.provider_id);A(q?.id||G[0].id)}},[G,B.provider_id,X]);let h=G.find((q)=>q.id===X),{data:V,isLoading:w,error:b}=t({provider:h?.config||null,enabled:!!X}),l=_.useMemo(()=>{let q=(V||[]).map((Y)=>({id:Y.id,name:Y.name}));return j.current=q,q},[V]),P=_.useCallback(async()=>{return j.current},[]),R=_.useCallback((q,Y,C)=>{let y=q.id===B.provider_id+"-"+q.id;return $.jsxDEV(i,{isSelected:C,isCurrent:y,children:[$.jsxDEV(H,{bold:!0,children:[Y+1,". ",q.id]},void 0,!0,void 0,this),$.jsxDEV(H,{dimColor:!0,children:[" ",q.name!==q.id?`(${q.name})`:""]},void 0,!0,void 0,this)]},`model-${Y}-${q.id}`,!0,void 0,this)},[B.provider_id]),m=_.useCallback((q)=>{return q.id===B.provider_id+"-"+q.id},[B.provider_id]),k=_.useCallback(async(q)=>{let C=G.find((y)=>y.id===X)?.config.type||"openai";await K({provider_id:X,provider_type:C,model_id:q.id}),L()},[K,X,L,G]),g=_.useCallback(async(q)=>{if(G.length<=1)return;let Y=G.findIndex((u)=>u.id===X),C=q==="left"?(Y-1+G.length)%G.length:(Y+1)%G.length,y=G[C];A(y.id),await K({provider_id:y.id,provider_type:y.config.type})},[X,G,K]),f=_.useMemo(()=>{let q=h?.label||"加载中...";return{id:`model-${X}`,title:`模型选择 - ${q}`,icon:h?.icon||"\uD83D\uDD2E",dataSource:P,searchable:!0,searchFields:["id","name"],searchPlaceholder:"搜索模型...",itemHeight:1,visibleCount:10,renderItem:R,isSelected:m,onSelect:k,showCount:!0,keyMap:{leftArrow:(Y)=>{g("left")},rightArrow:(Y)=>{g("right")}}}},[X,h,P,R,m,k,g]);if(G.length===0)return $.jsxDEV(Z,{flexDirection:"column",paddingX:2,paddingY:1,children:[$.jsxDEV(H,{color:"yellow",children:"⚠️ 未配置任何 Provider"},void 0,!1,void 0,this),$.jsxDEV(H,{color:"gray",dimColor:!0,children:"请先配置 Provider 后再查看模型列表"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let D=h?.config.apiKey;return $.jsxDEV(Z,{flexDirection:"column",children:[$.jsxDEV(Z,{gap:1,paddingX:1,paddingY:1,children:G.map((q,Y)=>$.jsxDEV(H,{bold:q.id===X,color:q.id===X?"cyan":"gray",children:[q.icon," ",q.label,q.id===X&&" [当前]",q.id===X&&!D&&" (未配置 API Key)"]},`provider-tab-${Y}-${q.id}`,!0,void 0,this))},void 0,!1,void 0,this),w?$.jsxDEV(Z,{paddingX:2,paddingY:1,children:$.jsxDEV(H,{color:"gray",children:"加载模型列表中..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):b?$.jsxDEV(Z,{paddingX:2,paddingY:1,children:$.jsxDEV(H,{color:"red",children:["加载失败: ",b.message]},void 0,!0,void 0,this)},void 0,!1,void 0,this):!D?$.jsxDEV(Z,{paddingX:2,paddingY:1,children:$.jsxDEV(H,{color:"yellow",children:"请先配置 API Key"},void 0,!1,void 0,this)},void 0,!1,void 0,this):$.jsxDEV(s,{config:f,onClose:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},d=Gq;var z=I(v(),1);var W=I(E(),1),Hq=({onClose:L})=>{let{config:B,updateConfig:U}=T(),[K,X]=z.useState("list"),[A,j]=z.useState(null),[G,h]=z.useState(0),[V,w]=z.useState(null),b=z.useCallback(()=>w(null),[]);o(b,V?3000:null);let l=z.useRef(K),P=z.useRef(G),R=z.useRef([]),m=z.useRef(!0);z.useEffect(()=>{l.current=K},[K]),z.useEffect(()=>{P.current=G},[G]);let k=B?.providers||[];z.useEffect(()=>{R.current=k},[k]);let g=z.useCallback(()=>{m.current=!0,j(null),X("form"),w(null)},[]),f=z.useCallback(()=>{let J=R.current,Q=P.current,N=J[Q];if(!N)return;m.current=!1,j(N),X("form"),w(null)},[]),D=z.useCallback(()=>{X("list"),j(null),w(null)},[]),q=z.useCallback(async(J)=>{let Q=R.current,N=m.current,O=N?[...Q,J]:Q.map((F)=>F.id===J.id?J:F);if(await U({providers:O}),w(N?`已添加 Provider: ${J.id}`:`已更新 Provider: ${J.id}`),N){let F=O.findIndex((S)=>S.id===J.id);h(F>=0?F:0)}X("list"),j(null),w(null)},[U]),Y=z.useCallback(async()=>{let J=R.current,Q=P.current,N=J[Q];if(!N)return;if(J.length<=1){w("无法删除最后一个 Provider");return}let O=J.filter((S)=>S.id!==N.id);await U({providers:O});let F=Math.min(Q,O.length-1);h(F>=0?F:0),w(`已删除 Provider: ${N.id}`)},[U]),C=z.useRef(g),y=z.useRef(f),u=z.useRef(Y),x=z.useRef(D),n=z.useRef(L);z.useEffect(()=>{C.current=g},[g]),z.useEffect(()=>{y.current=f},[f]),z.useEffect(()=>{u.current=Y},[Y]),z.useEffect(()=>{x.current=D},[D]),z.useEffect(()=>{n.current=L},[L]),c((J,Q)=>{let N=l.current,O=R.current,F=P.current;if(N==="form"){if(Q.escape)x.current();return}if(Q.upArrow)h((S)=>S>0?S-1:O.length-1);else if(Q.downArrow)h((S)=>S<O.length-1?S+1:0);else if(J==="n"||J==="N")C.current();else if((J==="e"||J==="E"||Q.return)&&O[F])y.current();else if((J==="d"||J==="D")&&O[F])u.current();else if(Q.escape)n.current()},{isActive:!0});let zq=z.useMemo(()=>{if(k.length===0)return W.jsxDEV(Z,{paddingX:2,paddingY:1,children:W.jsxDEV(H,{color:"yellow",children:"未配置任何 Provider"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return W.jsxDEV(Z,{flexDirection:"column",paddingX:2,gap:1,children:[k.map((J,Q)=>{let N=!!J.apiKey,O=N?"green":"yellow";return W.jsxDEV(Z,{marginBottom:0,gap:1,children:[W.jsxDEV(H,{color:Q===G?"cyan":"gray",bold:Q===G,children:Q===G?">":" "},void 0,!1,void 0,this),W.jsxDEV(H,{bold:Q===G,color:Q===G?"cyan":void 0,children:J.id},void 0,!1,void 0,this),W.jsxDEV(p,{},void 0,!1,void 0,this),W.jsxDEV(H,{color:"gray",dimColor:Q!==G,children:[" ",J.type]},void 0,!0,void 0,this),W.jsxDEV(H,{color:O,dimColor:Q!==G,children:[" ","[",N?"已配置":"未配置","]"]},void 0,!0,void 0,this)]},`provider-${Q}-${J.id}`,!0,void 0,this)}),W.jsxDEV(Z,{marginTop:1,children:W.jsxDEV(H,{color:"gray",dimColor:!0,children:[W.jsxDEV(H,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",W.jsxDEV(H,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 新增 ",W.jsxDEV(H,{color:"cyan",children:"d"},void 0,!1,void 0,this)," ","删除 ",W.jsxDEV(H,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 关闭"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},[k,G]);return W.jsxDEV(Z,{flexDirection:"column",children:[W.jsxDEV(Z,{paddingX:2,paddingY:1,children:W.jsxDEV(H,{bold:!0,color:"cyan",children:"Providers"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K==="list"?zq:W.jsxDEV(r,{provider:A||void 0,onCancel:D,onSave:q},void 0,!1,void 0,this),V&&W.jsxDEV(Z,{paddingX:2,paddingY:0,children:W.jsxDEV(H,{color:"green",children:V},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},e=Hq;var M=I(E(),1),Jq=({onClose:L,initialTab:B="model"})=>{let[U,K]=qq.useState(B);return c((X,A)=>{if(A.leftArrow&&A.alt)K("model");else if(A.rightArrow&&A.alt)K("provider");else if(A.escape)L()},{isActive:!0}),M.jsxDEV(Z,{flexDirection:"column",width:"100%",borderStyle:"single",borderDimColor:!0,children:[M.jsxDEV(Z,{flexDirection:"column",paddingX:0,paddingY:0,children:[U==="model"&&M.jsxDEV(d,{onClose:L},void 0,!1,void 0,this),U==="provider"&&M.jsxDEV(e,{onClose:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M.jsxDEV(Z,{flexDirection:"row",gap:2,paddingX:2,paddingY:1,borderTop:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:"single",borderColor:"gray",children:[M.jsxDEV(H,{bold:U==="model",color:U==="model"?"cyan":"gray",children:"\uD83E\uDD16 Model"},void 0,!1,void 0,this),M.jsxDEV(H,{bold:U==="provider",color:U==="provider"?"cyan":"gray",children:"\uD83D\uDD0C Provider"},void 0,!1,void 0,this),M.jsxDEV(p,{},void 0,!1,void 0,this),M.jsxDEV(H,{dimColor:!0,children:"Alt+ < >"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},Iq=Jq;export{Iq as default};
|
package/dist/chunk-76h8pe7x.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Na as x,Qa as z}from"./chunk-zwxjkwqd.js";import{SubAgentsMiddleware as H,getAgentListFromPackage as J}from"@langgraph-js/standard-agent";import{SubAgentsMiddleware as U,getAgentListFromPackage as W}from"@langgraph-js/standard-agent";async function Q(q){let B=await J(q);return new H({agents:B,stateSchema:x,async createAgent(D,E,G){return await z(E.subagent_id,q,G,{},{parent_id:D})}})}
|
|
2
|
-
export{Q as xa,U as ya,W as za};
|
package/dist/chunk-8z38ybz7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{nb as a}from"./chunk-cggjws6a.js";import"./chunk-kba8akjs.js";export{a as FileSystemPluginStore};
|
package/dist/chunk-b8dxq9rq.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as U}from"./chunk-mjzeawnq.js";import"./chunk-heasksrr.js";import{T as g,V as D}from"./chunk-va71tsw3.js";import{ea as C,fa as w,ga as X,pa as L,ta as V}from"./chunk-nwy6n6b6.js";import{ub as v}from"./chunk-kba8akjs.js";var A=v(C(),1);function E(J){let{historyList:O,refreshHistoryList:Y,setHistoryFilter:Z}=U(),W=J?JSON.stringify(J):null,_=W?["history","list",W]:D.history.list();return g({queryKey:_,queryFn:async()=>{if(J)Z(J);return await Y(),O},staleTime:60000})}var G=v(L(),1),y=({onClose:J})=>{let{currentChatId:O,toHistoryChat:Y,createNewChat:Z,refreshHistoryList:W,historyFilter:_}=U(),b=A.useMemo(()=>({metadata:{path:process.cwd()}}),[]),{data:B=[],refetch:c}=E(b),p=A.useRef(W);A.default.useEffect(()=>{p.current=W},[W]);let j=(z)=>z.toLocaleTimeString(),H=(z)=>{switch(z){case"idle":return{emoji:"\uD83D\uDFE2",color:"green",text:"空闲"};case"busy":return{emoji:"\uD83D\uDFE1",color:"yellow",text:"忙碌"};case"interrupted":return{emoji:"\uD83D\uDFE0",color:"orange",text:"中断"};case"error":return{emoji:"\uD83D\uDD34",color:"red",text:"错误"};default:return{emoji:"⚪",color:"gray",text:z}}},N=A.useCallback(async()=>{return B},[B]),P=A.useCallback((z,$,Q)=>{let S=H(z.status),M=z.thread_id===O,m=j(new Date(z.updated_at)),k=z.title||z.thread_id.slice(-8),x=Q?">":" ",f=M?"▶":" ",T=(()=>{if(M)return{color:"green",bold:!0};else if(Q)return{color:"cyanBright",bold:!0};else return{color:S.color,bold:!1}})();return G.jsxDEV(w,{children:[G.jsxDEV(X,{bold:T.bold,color:T.color,children:[x,f," ",$+1,". ",k]},void 0,!0,void 0,this),G.jsxDEV(w,{flexGrow:1},void 0,!1,void 0,this),G.jsxDEV(X,{dimColor:!0,children:m},void 0,!1,void 0,this)]},z.thread_id,!0,void 0,this)},[O]),F=A.useCallback((z)=>{return z.thread_id===O},[O]),R=A.useCallback(async(z)=>{if(z.value==="new_chat")Z({});else Y(z);J()},[Z,Y,J]),q=A.useCallback((z)=>{let $=z.find((Q)=>Q.thread_id===O);return $?G.jsxDEV(X,{color:"gray",dimColor:!0,children:["当前: ",G.jsxDEV(X,{color:"green",children:$.thread_id.substring(0,8)},void 0,!1,void 0,this),G.jsxDEV(X,{children:[" ",_?.metadata?.path]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null},[O,_]),K=A.useMemo(()=>({}),[]),I=A.useMemo(()=>({id:"history",title:"历史记录",icon:"\uD83D\uDCDC",dataSource:N,searchable:!0,searchFields:["title","thread_id"],searchPlaceholder:"搜索对话标题...",filterable:!1,filters:[],defaultFilter:"all",itemHeight:1,visibleCount:10,renderItem:P,isSelected:F,onSelect:R,showCount:!0,statusInfo:q,keyMap:K}),[N,P,F,R,q,K]);return G.jsxDEV(V,{config:I,onClose:J},void 0,!1,void 0,this)},zz=y;export{zz as default};
|
package/dist/chunk-cjqarwdn.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{x as M}from"./chunk-cs73xbzz.js";import"./chunk-rncpxz1b.js";import{T as A,V as _}from"./chunk-va71tsw3.js";import{ea as g,fa as X,ga as Y,pa as C,ta as K}from"./chunk-nwy6n6b6.js";import{Ba as R}from"./chunk-xhnvpygg.js";import{ub as Q}from"./chunk-kba8akjs.js";var F=Q(g(),1);import{listSkills as V}from"@langgraph-js/standard-agent";import{join as w}from"path";function $({type:G,enabled:J=!0}){return A({queryKey:G==="memories"?_.knowledge.memories():_.knowledge.skills(),queryFn:async()=>{let L=w(process.cwd(),".claude",G),N=w(process.env.HOME||"",".deepagents/code",G);try{if(G==="memories")return R(N,L).map((W)=>({...W,type:"memory"}));else return V(N,L).map((W)=>({...W,type:"skill"}))}catch(O){return console.warn(`Failed to load ${G}:`,O),[]}},enabled:J,staleTime:120000})}var H=Q(C(),1),S=(G)=>{return G.length>80?G.slice(0,80)+"...":G},k=({onClose:G})=>{let[J,L]=F.useState("memories"),N=F.useRef(L);F.default.useEffect(()=>{N.current=L},[L]);let{data:O=[]}=$({type:"memories",enabled:J==="memories"}),{data:W=[]}=$({type:"skills",enabled:J==="skills"}),U=F.useCallback(async()=>{return J==="memories"?O:W},[J,O,W]),q=F.useCallback((z,h,Z)=>{let E=S(z.description);return H.jsxDEV(X,{flexDirection:"column",paddingY:1,children:[H.jsxDEV(X,{children:H.jsxDEV(Y,{bold:!0,color:Z?"cyan":"gray",children:[h+1,". ",z.name]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV(X,{paddingY:1,children:H.jsxDEV(Y,{color:Z?"white":"gray",children:E},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV(X,{children:H.jsxDEV(Y,{color:"cyan",dimColor:!Z,children:[M(z.path),z.category&&H.jsxDEV(Y,{color:"yellow",children:[" ",z.category]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},z.path,!0,void 0,this)},[]),I=F.useCallback((z)=>{console.log("Selected knowledge item:",z.name)},[]),P=F.useMemo(()=>[{id:"memory",label:"记忆",predicate:(z)=>z.type==="memory"},{id:"skill",label:"技能",predicate:(z)=>z.type==="skill"}],[]),B=F.useMemo(()=>({h:(z)=>{N.current("memories"),z.setActiveFilter("memory")},s:(z)=>{N.current("skills"),z.setActiveFilter("skill")}}),[]),f=F.useMemo(()=>({id:"knowledge",title:"知识库",icon:"\uD83D\uDCDA",dataSource:U,searchable:!0,searchFields:["name","description"],searchPlaceholder:"搜索知识库 (名称/描述/分类)...",filterable:!0,filters:P,defaultFilter:J==="memories"?"memory":"skill",itemHeight:8,visibleCount:3,renderItem:q,showCount:!0,onSelect:I,keyMap:B}),[U,P,q,I,B,J]);return H.jsxDEV(K,{config:f,onClose:G},void 0,!1,void 0,this)},l=k;export{l as default};
|
package/dist/chunk-cyexd09c.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{yb as W}from"./chunk-kba8akjs.js";import X from"micromatch";import{z as E}from"zod";var T;((D)=>{D.ALLOW="allow";D.ASK="ask";D.DENY="deny"})(T||={});var _=E.object({tool:E.string(),specifier:E.string().optional(),action:E.nativeEnum(T)}),$=E.object({allow:E.array(E.string()).optional(),ask:E.array(E.string()).optional(),deny:E.array(E.string()).optional(),defaultMode:E.nativeEnum(T).optional()}),v=E.object({name:E.string(),args:E.record(E.string(),E.any())});class Q{rules;defaultMode;patternCache=new Map;constructor(x){this.rules=x.rules,this.defaultMode=x.defaultMode||"ask",this.rules.sort((q,B)=>{let D={deny:0,ask:1,allow:2},H=D[q.action]-D[B.action];if(H!==0)return H;let J=q.specifier==null?1:0,N=B.specifier==null?1:0;return J-N})}checkPermission(x){for(let q of this.rules)if(this.matchRule(q,x))return{allowed:q.action==="allow"||q.action==="ask",requiresApproval:q.action==="ask",matchedRule:q,reason:this.getReason(q)};return{allowed:this.defaultMode==="allow"||this.defaultMode==="ask",requiresApproval:this.defaultMode==="ask",reason:`No matching rule, using default mode: ${this.defaultMode}`}}matchRule(x,q){if(x.tool!==q.name)return!1;if(!x.specifier)return!0;let B=this.argsToString(q.args);if(q.name==="Bash")return this.matchBashCommand(x.specifier,B);if(x.specifier.endsWith(" ")&&!/[*?[\\]/.test(x.specifier))return B.startsWith(x.specifier);return this.matchGlob(x.specifier,B)}matchBashCommand(x,q){if(/[;&|]/.test(q))return!1;let D=/[<>()]/;if(D.test(q)){let H=q.split(D)[0].trim();return this.matchBashPattern(x,H)}return this.matchBashPattern(x,q)}matchBashPattern(x,q){if(x.endsWith(" "))return q.startsWith(x);return this.matchGlob(x,q)}matchGlob(x,q){try{let B=x.replace(/^\.\//,""),D=q.replace(/^\.\//,""),H=`${x}::${q}`,J=this.patternCache.get(H);if(J!==void 0)return J;let N=X.isMatch(D,B,{nocase:!1,dot:!0});return this.cacheResult(H,N),N}catch(B){return q===x}}cacheResult(x,q){if(this.patternCache.size>1000){let B=this.patternCache.keys().next().value;if(B)this.patternCache.delete(B)}this.patternCache.set(x,q)}argsToString(x){if(typeof x==="object"&&x!==null){if("command"in x&&x.command)return String(x.command);if("file_path"in x&&x.file_path)return String(x.file_path);return Object.values(x).flat().join(" ")}return String(x)}getReason(x){let q=x.action.toUpperCase(),B=x.tool,D=x.specifier?`(${x.specifier})`:"";return`${q} rule matched: ${B}${D}`}static parseRule(x,q){let B=x.match(/^(\w+)(?:\((.*)\))?$/);if(!B)throw Error(`Invalid permission rule format: ${x}`);let[,D,H]=B;return{tool:D,specifier:H,action:q}}static fromConfig(x){let q=[];for(let B of x.allow||[])q.push(Q.parseRule(B,"allow"));for(let B of x.ask||[])q.push(Q.parseRule(B,"ask"));for(let B of x.deny||[])q.push(Q.parseRule(B,"deny"));return new Q({rules:q,defaultMode:x.defaultMode||"ask"})}clearCache(){this.patternCache.clear()}getCacheSize(){return this.patternCache.size}}class L{configStore;toolNameMapper={};constructor(x){this.configStore=x}static instance=null;static getInstance(x){if(!L.instance){if(!x)throw Error("PermissionStore not initialized. Provide configStore on first call.");L.instance=new L(x)}return L.instance}static resetInstance(){L.instance=null}async getPermissions(){let x=await this.configStore.getConfig();if(x.permissions)return Q.fromConfig(x.permissions);return}async checkBashPermission(x,q){return(await this.getPermissions())?.checkPermission({name:"Bash",args:{command:x,cwd:q}})}async checkReadPermission(x){return(await this.getPermissions())?.checkPermission({name:"Read",args:{file_path:x}})}async checkWritePermission(x){return(await this.getPermissions())?.checkPermission({name:"Write",args:{file_path:x}})}}class V{configStore;skillStore;pluginStore;remoteStore;permissionStore;_initialized=!1;constructor(x,q,B,D){this.configStore=x,this.skillStore=q,this.pluginStore=B,this.remoteStore=D,this.permissionStore=L.getInstance(x)}async initialize(){if(this._initialized)return;if("initialize"in this.configStore&&typeof this.configStore.initialize==="function")await this.configStore.initialize();if("initialize"in this.skillStore&&typeof this.skillStore.initialize==="function")await this.skillStore.initialize();if("initialize"in this.pluginStore&&typeof this.pluginStore.initialize==="function")await this.pluginStore.initialize();this._initialized=!0}async ensureInitialized(){if(!this._initialized)throw Error("ConfigManager not initialized. Call await manager.initialize() first.")}async getConfig(){return await this.ensureInitialized(),await this.configStore.getConfig()}async updateConfig(x){return await this.ensureInitialized(),await this.configStore.updateConfig(x)}async listSkills(){return await this.ensureInitialized(),await this.skillStore.listSkills()}async getSkill(x){return await this.ensureInitialized(),await this.skillStore.getSkill(x)}async saveSkill(x,q){return await this.ensureInitialized(),await this.skillStore.saveSkill(x,q)}async deleteSkill(x){return await this.ensureInitialized(),await this.skillStore.deleteSkill(x)}async syncSkillsFromRemote(){if(await this.ensureInitialized(),!this.remoteStore)throw Error("Remote store not configured");return await this.skillStore.syncFromRemote(this.remoteStore)}async listPlugins(){return await this.ensureInitialized(),await this.pluginStore.listPlugins()}async getPluginConfig(x){return await this.ensureInitialized(),await this.pluginStore.getPluginConfig(x)}async updatePluginConfig(x,q){return await this.ensureInitialized(),await this.pluginStore.updatePluginConfig(x,q)}async installPlugin(x,q){return await this.ensureInitialized(),await this.pluginStore.installPlugin(x,q)}async uninstallPlugin(x){return await this.ensureInitialized(),await this.pluginStore.uninstallPlugin(x)}async checkBashPermission(x,q){return await this.ensureInitialized(),await this.permissionStore.checkBashPermission(x,q)}async checkReadPermission(x){return await this.ensureInitialized(),await this.permissionStore.checkReadPermission(x)}async checkWritePermission(x){return await this.ensureInitialized(),await this.permissionStore.checkWritePermission(x)}async getPermissionMatcher(){return await this.ensureInitialized(),await this.permissionStore.getPermissions()}getConfigPath(){return this.configStore?.dbPath}}async function y(){let{FileSystemConfigStore:x}=await import("./chunk-1edvf7b5.js"),{FileSystemSkillStore:q}=await import("./chunk-qd305hg1.js"),{FileSystemPluginStore:B}=await import("./chunk-8z38ybz7.js"),D=new x,H=new q,J=new B,N=new V(D,H,J);return await N.initialize(),N}async function z(x){let{configStore:q,skillStore:B,pluginStore:D,remoteStore:H}=x,J=new V(q,B,D,H);return await J.initialize(),J}
|
|
2
|
-
export{V as ob,y as pb,z as qb};
|
package/dist/chunk-f8ewggk1.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as C,T as S,U as y,V as w}from"./chunk-va71tsw3.js";import{ea as l,fa as Z,ga as J,ja as d,oa as V,pa as m,ra as D,ta as u}from"./chunk-nwy6n6b6.js";import{ub as q,yb as p}from"./chunk-kba8akjs.js";var L=q(l(),1);function f({filter:H,enabled:M=!0}){return S({queryKey:w.tasks.list(H),queryFn:async()=>{let{getTasksStore:X}=await import("./chunk-jfhc5c0d.js"),Y=X(process.cwd());if(await Y.initialize(),H)return await Y.getTasksByStatus(H);return await Y.getAllTasks()},enabled:M,staleTime:30000})}function I(){let H=C();return y({mutationFn:async(M)=>{let{getTasksStore:X}=await import("./chunk-jfhc5c0d.js"),Y=X(process.cwd());return await Y.initialize(),await Y.deleteTask(M)},onSuccess:(M,X)=>{H.invalidateQueries({queryKey:w.tasks.all}),H.removeQueries({queryKey:w.tasks.detail(X)})}})}var z=q(m(),1),F={pickup:{emoji:"\uD83D\uDCE5",color:"cyan",label:"待领取"},running:{emoji:"\uD83D\uDD04",color:"yellow",label:"运行中"},complete:{emoji:"✅",color:"green",label:"已完成"},error:{emoji:"❌",color:"red",label:"失败"},review:{emoji:"\uD83D\uDC40",color:"blue",label:"待审核"},feedback:{emoji:"\uD83D\uDCAC",color:"magenta",label:"待反馈"}},E={simple:{emoji:"\uD83D\uDFE2",label:"简单"},medium:{emoji:"\uD83D\uDFE1",label:"中等"},complex:{emoji:"\uD83D\uDD34",label:"复杂"}},i=({task:H,onClose:M,onExecuteTask:X,onDelete:Y})=>{V((K,Q)=>{if(Q.escape)M();else if(Q.return&&X){if(H.status==="pickup"||H.status==="error"||H.status==="feedback")X(H)}else if((Q.backspace||Q.delete)&&Y)Y(H)});let R=H.status?F[H.status]:F.pickup,A=H.status==="pickup"||H.status==="error"||H.status==="feedback",G=H.complexity?E[H.complexity]:null;return z.jsxDEV(Z,{flexDirection:"column",paddingX:1,children:[z.jsxDEV(Z,{borderStyle:"single",paddingX:1,marginBottom:1,children:[z.jsxDEV(J,{bold:!0,color:"cyan",children:[R.emoji," 任务预览"]},void 0,!0,void 0,this),z.jsxDEV(Z,{flexGrow:1},void 0,!1,void 0,this),A&&X&&z.jsxDEV(J,{color:"green",children:"Enter 执行"},void 0,!1,void 0,this),Y&&z.jsxDEV(z.Fragment,{children:[A&&X&&z.jsxDEV(J,{dimColor:!0,children:" | "},void 0,!1,void 0,this),z.jsxDEV(J,{color:"red",children:"Delete 删除"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(J,{dimColor:!0,children:" | "},void 0,!1,void 0,this),z.jsxDEV(J,{dimColor:!0,children:"Esc 退出"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(Z,{marginBottom:1,children:z.jsxDEV(J,{bold:!0,color:"white",children:H.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(Z,{marginBottom:1,children:[z.jsxDEV(J,{color:R.color,children:[R.emoji," ",R.label]},void 0,!0,void 0,this),G&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV(J,{children:" • "},void 0,!1,void 0,this),z.jsxDEV(J,{children:[G.emoji," ",G.label]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.estimatedTime&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV(J,{children:" • "},void 0,!1,void 0,this),z.jsxDEV(J,{children:["⏱️ ",H.estimatedTime]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(Z,{marginBottom:1,flexDirection:"column",children:[z.jsxDEV(J,{color:"gray",bold:!0,children:"描述:"},void 0,!1,void 0,this),z.jsxDEV(J,{children:H.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(Z,{marginBottom:1,children:[z.jsxDEV(J,{color:"gray",children:"ID: "},void 0,!1,void 0,this),z.jsxDEV(J,{dimColor:!0,children:H.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.agentType&&z.jsxDEV(Z,{marginBottom:1,children:[z.jsxDEV(J,{color:"gray",children:"建议 Agent: "},void 0,!1,void 0,this),z.jsxDEV(J,{color:"yellow",children:H.agentType},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.assignedTo&&z.jsxDEV(Z,{marginBottom:1,children:[z.jsxDEV(J,{color:"gray",children:"分配给: "},void 0,!1,void 0,this),z.jsxDEV(J,{color:"blue",children:H.assignedTo},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.threadId&&z.jsxDEV(Z,{marginBottom:1,children:[z.jsxDEV(J,{color:"gray",children:"Thread ID: "},void 0,!1,void 0,this),z.jsxDEV(J,{dimColor:!0,children:H.threadId},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.dependencies&&H.dependencies.length>0&&z.jsxDEV(Z,{marginBottom:1,flexDirection:"column",children:[z.jsxDEV(J,{color:"gray",bold:!0,children:"依赖任务:"},void 0,!1,void 0,this),z.jsxDEV(J,{dimColor:!0,children:H.dependencies.join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.acceptanceCriteria&&H.acceptanceCriteria.length>0&&z.jsxDEV(Z,{marginBottom:1,flexDirection:"column",children:[z.jsxDEV(J,{color:"gray",bold:!0,children:"验收标准:"},void 0,!1,void 0,this),H.acceptanceCriteria.map((K,Q)=>z.jsxDEV(J,{dimColor:!0,children:[Q+1,". ",K]},`ac-${Q}-${H.id}`,!0,void 0,this))]},void 0,!0,void 0,this),H.children&&H.children.length>0&&z.jsxDEV(Z,{flexDirection:"column",children:[z.jsxDEV(J,{color:"gray",bold:!0,children:["子任务 (",H.children.length,"):"]},void 0,!0,void 0,this),H.children.map((K,Q)=>{let U=K.status?F[K.status]:F.pickup;return z.jsxDEV(Z,{children:z.jsxDEV(J,{color:U.color,children:[U.emoji," ",Q+1,". ",K.title]},void 0,!0,void 0,this)},`child-task-${Q}-${K.id||Q}`,!1,void 0,this)})]},void 0,!0,void 0,this),H.status==="error"&&H.error&&z.jsxDEV(Z,{marginTop:1,flexDirection:"column",borderStyle:"single",paddingX:1,children:[z.jsxDEV(J,{color:"red",bold:!0,children:"错误:"},void 0,!1,void 0,this),z.jsxDEV(J,{color:"red",children:H.error.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},j=i;var $=q(m(),1),P={pickup:{emoji:"\uD83D\uDCE5",color:"cyan",label:"待领取"},running:{emoji:"\uD83D\uDD04",color:"yellow",label:"运行中"},complete:{emoji:"✅",color:"green",label:"已完成"},error:{emoji:"❌",color:"red",label:"失败"},review:{emoji:"\uD83D\uDC40",color:"blue",label:"待审核"},feedback:{emoji:"\uD83D\uDCAC",color:"magenta",label:"待反馈"}},r={simple:{emoji:"\uD83D\uDFE2",label:"简单"},medium:{emoji:"\uD83D\uDFE1",label:"中等"},complex:{emoji:"\uD83D\uDD34",label:"复杂"}},n=({onClose:H,onExecuteTask:M})=>{let{data:X=[]}=f(),Y=I(),[R,A]=L.useState(null),G=L.useRef(A),K=L.useRef(M);L.default.useEffect(()=>{G.current=A},[A]),L.default.useEffect(()=>{K.current=M},[M]);let Q=L.useCallback(()=>{A(null)},[]),U=L.useCallback(async(W)=>{await Y.mutateAsync(W.id),A((N)=>N?.id===W.id?null:N)},[Y]),v=L.useCallback((W,N,B)=>{let O=W.status?P[W.status]:P.pickup,_=W.complexity?r[W.complexity]:null;return $.jsxDEV(D,{isSelected:B,children:$.jsxDEV(Z,{children:[$.jsxDEV(J,{color:"cyan",dimColor:O===P.complete,children:[O.emoji," ",N+1,". ",W.title]},void 0,!0,void 0,this),$.jsxDEV(d,{},void 0,!1,void 0,this),$.jsxDEV(J,{color:"yellow",dimColor:!0,children:O.label},void 0,!1,void 0,this),_&&$.jsxDEV(J,{dimColor:!0,children:[_.emoji," ",_.label]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},`task-${W.id}`,!1,void 0,this)},[]),g=L.useCallback((W)=>{let N=W.filter((b)=>b.status==="running").length,B=W.filter((b)=>b.status==="complete").length,O=W.filter((b)=>b.status==="error").length,_=W.filter((b)=>b.status==="pickup"||b.status==="error"||b.status==="feedback").length;return $.jsxDEV(J,{color:"gray",children:["运行: ",N," | 完成: ",B," | 失败: ",O,_>0&&$.jsxDEV(J,{color:"green",children:[" | 可执行: ",_]},void 0,!0,void 0,this),$.jsxDEV(J,{dimColor:!0,children:" | Backspace 删除"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},[]),h=L.useCallback((W)=>{G.current(W)},[]),c=L.default.useMemo(()=>({id:"tasks",title:"任务看板",icon:"\uD83D\uDCCB",dataSource:async()=>X,searchable:!0,searchFields:["title","description"],searchPlaceholder:"搜索任务...",filterable:!0,filters:[{id:"all",label:"全部",predicate:()=>!0},{id:"pickup",label:"待领取",predicate:(W)=>W.status==="pickup"},{id:"running",label:"运行中",predicate:(W)=>W.status==="running"},{id:"complete",label:"已完成",predicate:(W)=>W.status==="complete"},{id:"error",label:"失败",predicate:(W)=>W.status==="error"}],defaultFilter:"all",itemHeight:3,visibleCount:10,renderItem:v,onSelect:h,onDelete:U,showCount:!0,statusInfo:g}),[X,v,g,h,U]);return $.jsxDEV($.Fragment,{children:R?$.jsxDEV(j,{task:R,onClose:Q,onExecuteTask:M,onDelete:U},void 0,!1,void 0,this):$.jsxDEV(u,{config:c,onClose:H},void 0,!1,void 0,this)},void 0,!1,void 0,this)},Zz=n;export{Zz as default};
|
package/dist/chunk-j9aysaeb.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R,T as v,U as _,V as b}from"./chunk-va71tsw3.js";import{ea as S,fa as J,ga as W,oa as q,pa as h}from"./chunk-nwy6n6b6.js";import{rb as U}from"./chunk-9dahn9h7.js";import{ub as w}from"./chunk-kba8akjs.js";var G=w(S(),1);function M({limit:X=100,enabled:H=!0}={}){return v({queryKey:b.errors.list(),queryFn:async()=>{return U.getRecentErrors(X)},enabled:H,staleTime:5000,refetchInterval:5000})}function O(){let X=R();return _({mutationFn:async(H)=>{return U.deleteError(H)},onSuccess:()=>{X.invalidateQueries({queryKey:b.errors.all})}})}function Q(){let X=R();return _({mutationFn:async()=>{U.clearAll()},onSuccess:()=>{X.invalidateQueries({queryKey:b.errors.all})}})}var z=w(h(),1);import{join as B}from"node:path";var T={error:{emoji:"❌",color:"red",label:"错误"},warning:{emoji:"⚠️",color:"yellow",label:"警告"}},p={Agent:{emoji:"\uD83E\uDD16",label:"Agent"},Tool:{emoji:"\uD83D\uDD27",label:"Tool"},Terminal:{emoji:"\uD83D\uDCBB",label:"Terminal"},System:{emoji:"⚙️",label:"System"},Unknown:{emoji:"❓",label:"Unknown"}};function g(X){let H=new Date(X),Z=new Date,P=Z.getTime()-H.getTime();if(P<60000)return"刚刚";if(P<3600000)return`${Math.floor(P/60000)}分钟前`;if(H.toDateString()===Z.toDateString())return H.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return H.toLocaleDateString("zh-CN",{month:"short",day:"numeric"})}function c(X,H=80){if(X.length<=H)return X;return X.slice(0,H-3)+"..."}var d=({onClose:X})=>{let{data:H=[],isLoading:Z}=M({limit:50}),P=O(),N=Q(),L=G.useCallback(async()=>{await N.mutateAsync()},[N]);q((Y,A)=>{if(A.escape)X();if(A.ctrl&&Y==="l")L()},{isActive:!0});let f=B(process.cwd(),".zen-code","errors.json"),F=G.default.useMemo(()=>{let Y=H.filter(($)=>$.level==="error").length,A=H.filter(($)=>$.level==="warning").length;return{errorCount:Y,warningCount:A}},[H]);return z.jsxDEV(J,{flexDirection:"column",paddingX:1,paddingY:1,children:[z.jsxDEV(J,{marginBottom:1,children:[z.jsxDEV(W,{bold:!0,color:"cyan",children:"\uD83D\uDCCB 错误日志"},void 0,!1,void 0,this),z.jsxDEV(J,{marginLeft:2,children:[z.jsxDEV(W,{color:"red",children:["❌ ",F.errorCount]},void 0,!0,void 0,this),z.jsxDEV(W,{children:" "},void 0,!1,void 0,this),z.jsxDEV(W,{color:"yellow",children:["⚠️ ",F.warningCount]},void 0,!0,void 0,this),z.jsxDEV(W,{dimColor:!0,children:["| Total: ",H.length]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z&&z.jsxDEV(J,{marginBottom:1,children:z.jsxDEV(W,{dimColor:!0,children:"加载中..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),!Z&&H.length>0&&z.jsxDEV(J,{flexDirection:"column",children:H.slice(0,20).map((Y,A)=>{let $=T[Y.level],K=p[Y.source]||p.Unknown,k=g(Y.timestamp),I=c(Y.message);return z.jsxDEV(J,{flexDirection:"column",marginBottom:1,children:[z.jsxDEV(J,{children:z.jsxDEV(W,{color:$.color,children:[$.emoji," ",I]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(J,{marginLeft:2,children:[z.jsxDEV(W,{dimColor:!0,children:[K.emoji," ",K.label," | ",k]},void 0,!0,void 0,this),Y.file&&z.jsxDEV(W,{dimColor:!0,color:"gray",children:[" ","| \uD83D\uDCC4 ",Y.file,Y.line&&`:${Y.line}`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},Y.id,!0,void 0,this)})},void 0,!1,void 0,this),!Z&&H.length===0&&z.jsxDEV(J,{flexDirection:"column",marginBottom:1,children:[z.jsxDEV(J,{marginBottom:1,children:z.jsxDEV(W,{dimColor:!0,children:"暂无错误记录"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(J,{marginBottom:1,children:z.jsxDEV(W,{dimColor:!0,children:"错误将自动收集到:"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(J,{marginBottom:1,children:z.jsxDEV(W,{color:"yellow",children:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(J,{marginTop:1,children:z.jsxDEV(W,{dimColor:!0,children:"按 ESC 返回 | Ctrl+L 清空所有"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},E=d;export{E as default};
|
package/dist/chunk-jfhc5c0d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$a as n,Ua as b,Va as h,Wa as i,Xa as j,Ya as k,Za as l,_a as m,ab as o,bb as p,cb as q,db as r,eb as s,fb as t,gb as u,hb as v,ib as w,jb as x,kb as y,lb as z,mb as A}from"./chunk-5rr85f28.js";import{nb as e}from"./chunk-cggjws6a.js";import{ob as a,pb as f,qb as g}from"./chunk-cyexd09c.js";import{sb as c}from"./chunk-r2h3x9zv.js";import{tb as d}from"./chunk-1ttywx0y.js";import"./chunk-kba8akjs.js";export{i as createServerWithManager,m as createRemoteManager,f as createFSManager,g as createCustomManager,h as createConfigServer,y as TaskStoreSchema,A as TaskStoreManager,t as TaskStatusSchema,w as TaskNodeSchema,v as TaskExecutionSchema,x as TaskExecutionRecordSchema,s as SparkStoreSchema,z as SparkStoreManager,p as SparkStatusSchema,q as SparkSourceSchema,o as SparkPrioritySchema,n as SparkItemTypeSchema,r as SparkItemSchema,k as RemoteSkillStore,l as RemotePluginStore,j as RemoteConfigStore,d as FileSystemSkillStore,e as FileSystemPluginStore,c as FileSystemConfigStore,b as ConfigServer,a as ConfigManager,u as AgentTypeSchema};
|
package/dist/chunk-jxsfzfac.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ub as v5,vb as F,yb as _}from"./chunk-kba8akjs.js";var i=F((n)=>{Object.defineProperty(n,"__esModule",{value:!0});n.default=void 0;var c5=n.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var t=F((o)=>{Object.defineProperty(o,"__esModule",{value:!0});o.default=void 0;var p5=o.default="00000000-0000-0000-0000-000000000000"});var Q0=F((s)=>{Object.defineProperty(s,"__esModule",{value:!0});s.default=void 0;var o5=s.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var V=F((Z0)=>{Object.defineProperty(Z0,"__esModule",{value:!0});Z0.default=void 0;var W1=Y1(Q0());function Y1(Q){return Q&&Q.__esModule?Q:{default:Q}}function F1(Q){return typeof Q==="string"&&W1.default.test(Q)}var t5=Z0.default=F1});var T=F((X0)=>{Object.defineProperty(X0,"__esModule",{value:!0});X0.default=void 0;var U1=D1(V());function D1(Q){return Q&&Q.__esModule?Q:{default:Q}}function z1(Q){if(!(0,U1.default)(Q))throw TypeError("Invalid UUID");let Z,X=new Uint8Array(16);return X[0]=(Z=parseInt(Q.slice(0,8),16))>>>24,X[1]=Z>>>16&255,X[2]=Z>>>8&255,X[3]=Z&255,X[4]=(Z=parseInt(Q.slice(9,13),16))>>>8,X[5]=Z&255,X[6]=(Z=parseInt(Q.slice(14,18),16))>>>8,X[7]=Z&255,X[8]=(Z=parseInt(Q.slice(19,23),16))>>>8,X[9]=Z&255,X[10]=(Z=parseInt(Q.slice(24,36),16))/1099511627776&255,X[11]=Z/4294967296&255,X[12]=Z>>>24&255,X[13]=Z>>>16&255,X[14]=Z>>>8&255,X[15]=Z&255,X}var e5=X0.default=z1});var R=F((A0)=>{Object.defineProperty(A0,"__esModule",{value:!0});A0.default=void 0;A0.unsafeStringify=P0;var H1=O1(V());function O1(Q){return Q&&Q.__esModule?Q:{default:Q}}var U=[];for(let Q=0;Q<256;++Q)U.push((Q+256).toString(16).slice(1));function P0(Q,Z=0){return(U[Q[Z+0]]+U[Q[Z+1]]+U[Q[Z+2]]+U[Q[Z+3]]+"-"+U[Q[Z+4]]+U[Q[Z+5]]+"-"+U[Q[Z+6]]+U[Q[Z+7]]+"-"+U[Q[Z+8]]+U[Q[Z+9]]+"-"+U[Q[Z+10]]+U[Q[Z+11]]+U[Q[Z+12]]+U[Q[Z+13]]+U[Q[Z+14]]+U[Q[Z+15]]).toLowerCase()}function w1(Q,Z=0){let X=P0(Q,Z);if(!(0,H1.default)(X))throw TypeError("Stringified UUID is invalid");return X}var Z6=A0.default=w1});var q=F((W0)=>{Object.defineProperty(W0,"__esModule",{value:!0});W0.default=V1;var R1=K1(_("node:crypto"));function K1(Q){return Q&&Q.__esModule?Q:{default:Q}}var N=new Uint8Array(256),E=N.length;function V1(){if(E>N.length-16)R1.default.randomFillSync(N),E=0;return N.slice(E,E+=16)}});var g=F((Y0)=>{Object.defineProperty(Y0,"__esModule",{value:!0});Y0.default=void 0;var S1=N1(q()),E1=R();function N1(Q){return Q&&Q.__esModule?Q:{default:Q}}var C,f,I=0,B=0;function _1(Q,Z,X){let G=Z&&X||0,J=Z||Array(16);Q=Q||{};let{node:P,clockseq:W}=Q;if(!Q._v6){if(!P)P=C;if(W==null)W=f}if(P==null||W==null){let O=Q.random||(Q.rng||S1.default)();if(P==null){if(P=[O[0],O[1],O[2],O[3],O[4],O[5]],!C&&!Q._v6)P[0]|=1,C=P}if(W==null){if(W=(O[6]<<8|O[7])&16383,f===void 0&&!Q._v6)f=W}}let A=Q.msecs!==void 0?Q.msecs:Date.now(),Y=Q.nsecs!==void 0?Q.nsecs:B+1,M=A-I+(Y-B)/1e4;if(M<0&&Q.clockseq===void 0)W=W+1&16383;if((M<0||A>I)&&Q.nsecs===void 0)Y=0;if(Y>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");I=A,B=Y,f=W,A+=12219292800000;let L=((A&268435455)*1e4+Y)%4294967296;J[G++]=L>>>24&255,J[G++]=L>>>16&255,J[G++]=L>>>8&255,J[G++]=L&255;let S=A/4294967296*1e4&268435455;J[G++]=S>>>8&255,J[G++]=S&255,J[G++]=S>>>24&15|16,J[G++]=S>>>16&255,J[G++]=W>>>8|128,J[G++]=W&255;for(let O=0;O<6;++O)J[G+O]=P[O];return Z||(0,E1.unsafeStringify)(J)}var J6=Y0.default=_1});var u=F((U0)=>{Object.defineProperty(U0,"__esModule",{value:!0});U0.default=$1;var q1=x1(T()),f1=R();function x1(Q){return Q&&Q.__esModule?Q:{default:Q}}function $1(Q){let Z=typeof Q==="string"?(0,q1.default)(Q):Q,X=C1(Z);return typeof Q==="string"?(0,f1.unsafeStringify)(X):X}function C1(Q,Z=!1){return Uint8Array.of((Q[6]&15)<<4|Q[7]>>4&15,(Q[7]&15)<<4|(Q[4]&240)>>4,(Q[4]&15)<<4|(Q[5]&240)>>4,(Q[5]&15)<<4|(Q[0]&240)>>4,(Q[0]&15)<<4|(Q[1]&240)>>4,(Q[1]&15)<<4|(Q[2]&240)>>4,96|Q[2]&15,Q[3],Q[8],Q[9],Q[10],Q[11],Q[12],Q[13],Q[14],Q[15])}});var j=F((D0)=>{Object.defineProperty(D0,"__esModule",{value:!0});D0.URL=D0.DNS=void 0;D0.default=h1;var B1=R(),g1=u1(T());function u1(Q){return Q&&Q.__esModule?Q:{default:Q}}function j1(Q){Q=unescape(encodeURIComponent(Q));let Z=[];for(let X=0;X<Q.length;++X)Z.push(Q.charCodeAt(X));return Z}var v1=D0.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",m1=D0.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function h1(Q,Z,X){function G(J,P,W,A){var Y;if(typeof J==="string")J=j1(J);if(typeof P==="string")P=(0,g1.default)(P);if(((Y=P)===null||Y===void 0?void 0:Y.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let M=new Uint8Array(16+J.length);if(M.set(P),M.set(J,P.length),M=X(M),M[6]=M[6]&15|Z,M[8]=M[8]&63|128,W){A=A||0;for(let L=0;L<16;++L)W[A+L]=M[L];return W}return(0,B1.unsafeStringify)(M)}try{G.name=Q}catch(J){}return G.DNS=v1,G.URL=m1,G}});var w0=F((H0)=>{Object.defineProperty(H0,"__esModule",{value:!0});H0.default=void 0;var d1=b1(_("node:crypto"));function b1(Q){return Q&&Q.__esModule?Q:{default:Q}}function k1(Q){if(Array.isArray(Q))Q=Buffer.from(Q);else if(typeof Q==="string")Q=Buffer.from(Q,"utf8");return d1.default.createHash("md5").update(Q).digest()}var W6=H0.default=k1});var V0=F((R0)=>{Object.defineProperty(R0,"__esModule",{value:!0});R0.default=void 0;var r1=L0(j()),c1=L0(w0());function L0(Q){return Q&&Q.__esModule?Q:{default:Q}}var n1=(0,r1.default)("v3",48,c1.default),F6=R0.default=n1});var E0=F((T0)=>{Object.defineProperty(T0,"__esModule",{value:!0});T0.default=void 0;var p1=i1(_("node:crypto"));function i1(Q){return Q&&Q.__esModule?Q:{default:Q}}var D6=T0.default={randomUUID:p1.default.randomUUID}});var x0=F((q0)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.default=void 0;var N0=_0(E0()),o1=_0(q()),a1=R();function _0(Q){return Q&&Q.__esModule?Q:{default:Q}}function t1(Q,Z,X){if(N0.default.randomUUID&&!Z&&!Q)return N0.default.randomUUID();Q=Q||{};let G=Q.random||(Q.rng||o1.default)();if(G[6]=G[6]&15|64,G[8]=G[8]&63|128,Z){X=X||0;for(let J=0;J<16;++J)Z[X+J]=G[J];return Z}return(0,a1.unsafeStringify)(G)}var H6=q0.default=t1});var I0=F(($0)=>{Object.defineProperty($0,"__esModule",{value:!0});$0.default=void 0;var s1=e1(_("node:crypto"));function e1(Q){return Q&&Q.__esModule?Q:{default:Q}}function Q5(Q){if(Array.isArray(Q))Q=Buffer.from(Q);else if(typeof Q==="string")Q=Buffer.from(Q,"utf8");return s1.default.createHash("sha1").update(Q).digest()}var w6=$0.default=Q5});var j0=F((g0)=>{Object.defineProperty(g0,"__esModule",{value:!0});g0.default=void 0;var Z5=B0(j()),G5=B0(I0());function B0(Q){return Q&&Q.__esModule?Q:{default:Q}}var X5=(0,Z5.default)("v5",80,G5.default),R6=g0.default=X5});var h0=F((m0)=>{Object.defineProperty(m0,"__esModule",{value:!0});m0.default=M5;var J5=R(),P5=v0(g()),A5=v0(u());function v0(Q){return Q&&Q.__esModule?Q:{default:Q}}function M5(Q={},Z,X=0){let G=(0,P5.default)({...Q,_v6:!0},new Uint8Array(16));if(G=(0,A5.default)(G),Z){for(let J=0;J<16;J++)Z[X+J]=G[J];return Z}return(0,J5.unsafeStringify)(G)}});var l0=F((y0)=>{Object.defineProperty(y0,"__esModule",{value:!0});y0.default=D5;var Y5=U5(T()),F5=R();function U5(Q){return Q&&Q.__esModule?Q:{default:Q}}function D5(Q){let Z=typeof Q==="string"?(0,Y5.default)(Q):Q,X=z5(Z);return typeof Q==="string"?(0,F5.unsafeStringify)(X):X}function z5(Q){return Uint8Array.of((Q[3]&15)<<4|Q[4]>>4&15,(Q[4]&15)<<4|(Q[5]&240)>>4,(Q[5]&15)<<4|Q[6]&15,Q[7],(Q[1]&15)<<4|(Q[2]&240)>>4,(Q[2]&15)<<4|(Q[3]&240)>>4,16|(Q[0]&240)>>4,(Q[0]&15)<<4|(Q[1]&240)>>4,Q[8],Q[9],Q[10],Q[11],Q[12],Q[13],Q[14],Q[15])}});var c0=F((k0)=>{Object.defineProperty(k0,"__esModule",{value:!0});k0.default=void 0;var O5=L5(q()),w5=R();function L5(Q){return Q&&Q.__esModule?Q:{default:Q}}var d0=null,b0=null,w=0;function R5(Q,Z,X){Q=Q||{};let G=Z&&X||0,J=Z||new Uint8Array(16),P=Q.random||(Q.rng||O5.default)(),W=Q.msecs!==void 0?Q.msecs:Date.now(),A=Q.seq!==void 0?Q.seq:null,Y=b0,M=d0;if(W>w&&Q.msecs===void 0){if(w=W,A!==null)Y=null,M=null}if(A!==null){if(A>2147483647)A=2147483647;Y=A>>>19&4095,M=A&524287}if(Y===null||M===null)Y=P[6]&127,Y=Y<<8|P[7],M=P[8]&63,M=M<<8|P[9],M=M<<5|P[10]>>>3;if(W+1e4>w&&A===null){if(++M>524287){if(M=0,++Y>4095)Y=0,w++}}else w=W;return b0=Y,d0=M,J[G++]=w/1099511627776&255,J[G++]=w/4294967296&255,J[G++]=w/16777216&255,J[G++]=w/65536&255,J[G++]=w/256&255,J[G++]=w&255,J[G++]=Y>>>4&15|112,J[G++]=Y&255,J[G++]=M>>>13&63|128,J[G++]=M>>>5&255,J[G++]=M<<3&255|P[10]&7,J[G++]=P[11],J[G++]=P[12],J[G++]=P[13],J[G++]=P[14],J[G++]=P[15],Z||(0,w5.unsafeStringify)(J)}var S6=k0.default=R5});var i0=F((n0)=>{Object.defineProperty(n0,"__esModule",{value:!0});n0.default=void 0;var K5=V5(V());function V5(Q){return Q&&Q.__esModule?Q:{default:Q}}function T5(Q){if(!(0,K5.default)(Q))throw TypeError("Invalid UUID");return parseInt(Q.slice(14,15),16)}var N6=n0.default=T5});var o0=F((D)=>{Object.defineProperty(D,"__esModule",{value:!0});Object.defineProperty(D,"MAX",{enumerable:!0,get:function(){return S5.default}});Object.defineProperty(D,"NIL",{enumerable:!0,get:function(){return E5.default}});Object.defineProperty(D,"parse",{enumerable:!0,get:function(){return N5.default}});Object.defineProperty(D,"stringify",{enumerable:!0,get:function(){return _5.default}});Object.defineProperty(D,"v1",{enumerable:!0,get:function(){return q5.default}});Object.defineProperty(D,"v1ToV6",{enumerable:!0,get:function(){return f5.default}});Object.defineProperty(D,"v3",{enumerable:!0,get:function(){return x5.default}});Object.defineProperty(D,"v4",{enumerable:!0,get:function(){return $5.default}});Object.defineProperty(D,"v5",{enumerable:!0,get:function(){return C5.default}});Object.defineProperty(D,"v6",{enumerable:!0,get:function(){return I5.default}});Object.defineProperty(D,"v6ToV1",{enumerable:!0,get:function(){return B5.default}});Object.defineProperty(D,"v7",{enumerable:!0,get:function(){return g5.default}});Object.defineProperty(D,"validate",{enumerable:!0,get:function(){return u5.default}});Object.defineProperty(D,"version",{enumerable:!0,get:function(){return j5.default}});var S5=H(i()),E5=H(t()),N5=H(T()),_5=H(R()),q5=H(g()),f5=H(u()),x5=H(V0()),$5=H(x0()),C5=H(j0()),I5=H(h0()),B5=H(l0()),g5=H(c0()),u5=H(V()),j5=H(i0());function H(Q){return Q&&Q.__esModule?Q:{default:Q}}});var z=v5(o0(),1),f6=z.default.v1,x6=z.default.v1ToV6,$6=z.default.v3,C6=z.default.v4,m5=z.default.v5,a0=z.default.v6,I6=z.default.v6ToV1,B6=z.default.v7,g6=z.default.NIL,u6=z.default.MAX,j6=z.default.version,v6=z.default.validate,m6=z.default.stringify,h6=z.default.parse;function t0(Q){return a0({clockseq:Q})}var s0="__pregel_tasks",v="__error__",m="__scheduled__",h="__interrupt__",y="__resume__";var e0="[...]",h5="[Circular]",x=[],K=[];function y5(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Q1(Q,Z,X,G){if(typeof G>"u")G=y5();d(Q,"",0,[],void 0,0,G);var J;try{if(K.length===0)J=JSON.stringify(Q,Z,X);else J=JSON.stringify(Q,l5(Z),X)}catch(W){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{while(x.length!==0){var P=x.pop();if(P.length===4)Object.defineProperty(P[0],P[1],P[3]);else P[0][P[1]]=P[2]}}return J}function l(Q,Z,X,G){var J=Object.getOwnPropertyDescriptor(G,X);if(J.get!==void 0)if(J.configurable)Object.defineProperty(G,X,{value:Q}),x.push([G,X,Z,J]);else K.push([Z,X,Q]);else G[X]=Q,x.push([G,X,Z])}function d(Q,Z,X,G,J,P,W){P+=1;var A;if(typeof Q==="object"&&Q!==null){for(A=0;A<G.length;A++)if(G[A]===Q){l(h5,Q,Z,J);return}if(typeof W.depthLimit<"u"&&P>W.depthLimit){l(e0,Q,Z,J);return}if(typeof W.edgesLimit<"u"&&X+1>W.edgesLimit){l(e0,Q,Z,J);return}if(G.push(Q),Array.isArray(Q))for(A=0;A<Q.length;A++)d(Q[A],A,A,G,Q,P,W);else{var Y=Object.keys(Q);for(A=0;A<Y.length;A++){var M=Y[A];d(Q[M],M,A,G,Q,P,W)}}G.pop()}}function l5(Q){return Q=typeof Q<"u"?Q:function(Z,X){return X},function(Z,X){if(K.length>0)for(var G=0;G<K.length;G++){var J=K[G];if(J[1]===Z&&J[0]===X){X=J[2],K.splice(G,1);break}}return Q.call(this,Z,X)}}import{load as d5}from"@langchain/core/load";function b5(Q){return Q!==null&&Q.lc===1&&Q.type==="constructor"&&Array.isArray(Q.id)}async function k(Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))return await Promise.all(Q.map((X)=>k(X)));else{let Z={};for(let[X,G]of Object.entries(Q))Z[X]=await k(G);if(Z.lc===2&&Z.type==="undefined")return;else if(Z.lc===2&&Z.type==="constructor"&&Array.isArray(Z.id))try{let X=Z.id[Z.id.length-1],G;switch(X){case"Set":G=Set;break;case"Map":G=Map;break;case"RegExp":G=RegExp;break;case"Error":G=Error;break;default:return Z}if(Z.method)return G[Z.method](...Z.args||[]);else return new G(...Z.args||[])}catch(X){return Z}else if(b5(Z))return d5(JSON.stringify(Z));return Z}return Q}function b(Q,Z,X,G){return{lc:2,type:"constructor",id:[Q.name],method:Z??null,args:X??[],kwargs:G??{}}}function k5(Q){if(Q===void 0)return{lc:2,type:"undefined"};else if(Q instanceof Set||Q instanceof Map)return b(Q.constructor,void 0,[Array.from(Q)]);else if(Q instanceof RegExp)return b(RegExp,void 0,[Q.source,Q.flags]);else if(Q instanceof Error)return b(Q.constructor,void 0,[Q.message]);else if(Q?.lg_name==="Send")return{node:Q.node,args:Q.args};else return Q}var $=class{_dumps(Q){return new TextEncoder().encode(Q1(Q,(X,G)=>{return k5(G)}))}async dumpsTyped(Q){if(Q instanceof Uint8Array)return["bytes",Q];else return["json",this._dumps(Q)]}async _loads(Q){let Z=JSON.parse(Q);return k(Z)}async loadsTyped(Q,Z){if(Q==="bytes")return typeof Z==="string"?new TextEncoder().encode(Z):Z;else if(Q==="json")return this._loads(typeof Z==="string"?Z:new TextDecoder().decode(Z));else throw Error(`Unknown serialization type: ${Q}`)}};function r(Q){if(typeof Q!=="object"||Q===null)return Q;let Z=Array.isArray(Q)?[]:{};for(let X in Q)if(Object.prototype.hasOwnProperty.call(Q,X))Z[X]=r(Q[X]);return Z}function Z1(Q){return{v:Q.v,id:Q.id,ts:Q.ts,channel_values:{...Q.channel_values},channel_versions:{...Q.channel_versions},versions_seen:r(Q.versions_seen)}}var G1=class{serde=new $;constructor(Q){this.serde=Q||this.serde}async get(Q){let Z=await this.getTuple(Q);return Z?Z.checkpoint:void 0}getNextVersion(Q){if(typeof Q==="string")throw Error("Please override this method to use string versions.");return Q!==void 0&&typeof Q==="number"?Q+1:1}};function X1(Q,Z){if(typeof Q==="number"&&typeof Z==="number")return Math.sign(Q-Z);return String(Q).localeCompare(String(Z))}function J1(...Q){return Q.reduce((Z,X,G)=>{if(G===0)return X;return X1(Z,X)>=0?Z:X})}var P1={[v]:-1,[m]:-2,[h]:-3,[y]:-4};function A1(Q){return Q.configurable?.checkpoint_id||Q.configurable?.thread_ts||""}var c=class{serde=new $;constructor(Q){this.serde=Q||this.serde}};
|
|
2
|
-
export{t0 as W,s0 as X,Z1 as Y,G1 as Z,J1 as _,P1 as $,A1 as aa};
|
package/dist/chunk-m76ya904.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as x,b as I}from"./chunk-8g2zdcy0.js";import"./chunk-98f6hg43.js";import{W as C,X as T,Y as b,Z as w,_ as v}from"./chunk-jxsfzfac.js";import{ub as K}from"./chunk-kba8akjs.js";var W=K(I(),1),g=[{index:"checkpoints",prefix:"checkpoint:",schema:{"$.thread_id":{type:"TAG",AS:"thread_id"},"$.checkpoint_ns":{type:"TAG",AS:"checkpoint_ns"},"$.checkpoint_id":{type:"TAG",AS:"checkpoint_id"},"$.parent_checkpoint_id":{type:"TAG",AS:"parent_checkpoint_id"},"$.checkpoint_ts":{type:"NUMERIC",AS:"checkpoint_ts"},"$.has_writes":{type:"TAG",AS:"has_writes"},"$.source":{type:"TAG",AS:"source"},"$.step":{type:"NUMERIC",AS:"step"}}},{index:"checkpoint_blobs",prefix:"checkpoint_blob:",schema:{"$.thread_id":{type:"TAG",AS:"thread_id"},"$.checkpoint_ns":{type:"TAG",AS:"checkpoint_ns"},"$.checkpoint_id":{type:"TAG",AS:"checkpoint_id"},"$.channel":{type:"TAG",AS:"channel"},"$.version":{type:"TAG",AS:"version"},"$.type":{type:"TAG",AS:"type"}}},{index:"checkpoint_writes",prefix:"checkpoint_write:",schema:{"$.thread_id":{type:"TAG",AS:"thread_id"},"$.checkpoint_ns":{type:"TAG",AS:"checkpoint_ns"},"$.checkpoint_id":{type:"TAG",AS:"checkpoint_id"},"$.task_id":{type:"TAG",AS:"task_id"},"$.idx":{type:"NUMERIC",AS:"idx"},"$.channel":{type:"TAG",AS:"channel"},"$.type":{type:"TAG",AS:"type"}}}],f=class z extends w{client;ttlConfig;constructor(G,J){super();this.client=G,this.ttlConfig=J}static async fromUrl(G,J){let Z=W.createClient({url:G});await Z.connect();let Q=new z(Z,J);return await Q.ensureIndexes(),Q}static async fromCluster(G,J){let Z=W.createCluster({rootNodes:G});await Z.connect();let Q=new z(Z,J);return await Q.ensureIndexes(),Q}async get(G){return(await this.getTuple(G))?.checkpoint}async getTuple(G){let J=G.configurable?.thread_id,Z=G.configurable?.checkpoint_ns??"",Q=G.configurable?.checkpoint_id;if(!J)return;let Y,E;if(Q)Y=`checkpoint:${J}:${Z}:${Q}`,E=await this.client.json.get(Y);else{let $=`checkpoint:${J}:${Z}:*`,_=await this.client.keys($);if(_.length===0)return;_.sort(),Y=_[_.length-1],E=await this.client.json.get(Y)}if(!E)return;if(this.ttlConfig?.refreshOnRead&&this.ttlConfig?.defaultTTL)await this.applyTTL(Y);let{checkpoint:F,pendingWrites:X}=await this.loadCheckpointWithWrites(E);return await this.createCheckpointTuple(E,F,X)}async put(G,J,Z,Q){await this.ensureIndexes();let Y=G.configurable?.thread_id,E=G.configurable?.checkpoint_ns??"",F=G.configurable?.checkpoint_id;if(!Y)throw Error("thread_id is required");let X=J.id||C(0),$=`checkpoint:${Y}:${E}:${X}`,_=b(J);if(_.channel_values&&Q!==void 0)if(Object.keys(Q).length===0)_.channel_values={};else{let U={};for(let B of Object.keys(Q))if(B in _.channel_values)U[B]=_.channel_values[B];_.channel_values=U}let H={thread_id:Y,checkpoint_ns:E===""?"__empty__":E,checkpoint_id:X,parent_checkpoint_id:F||null,checkpoint:_,metadata:Z,checkpoint_ts:Date.now(),has_writes:"false"};if(this.addSearchableMetadataFields(H,Z),await this.client.json.set($,"$",H),this.ttlConfig?.defaultTTL)await this.applyTTL($);return{configurable:{thread_id:Y,checkpoint_ns:E,checkpoint_id:X}}}async*list(G,J){if(await this.ensureIndexes(),J?.filter!==void 0){let Q=Object.values(J.filter).some((X)=>X===null),Y=[];if(G?.configurable?.thread_id){let X=G.configurable.thread_id.replace(/[-.@]/g,"\\$&");Y.push(`(@thread_id:{${X}})`)}if(G?.configurable?.checkpoint_ns!==void 0){let X=G.configurable.checkpoint_ns;if(X==="")Y.push("(@checkpoint_ns:{__empty__})");else{let $=X.replace(/[-.@]/g,"\\$&");Y.push(`(@checkpoint_ns:{${$}})`)}}if(!J?.before&&J?.filter){for(let[X,$]of Object.entries(J.filter))if($===void 0);else if($===null);else if(typeof $==="string"){let _=x(X),H=x($);Y.push(`(@${_}:{${H}})`)}else if(typeof $==="number"){let _=x(X);Y.push(`(@${_}:[${$} ${$}])`)}else if(typeof $==="object"&&Object.keys($).length===0);}if(Y.length===0)Y.push("*");let E=Y.join(" "),F=J?.limit??10;try{let X=J?.before&&!G?.configurable?.thread_id?1000:J?.before?F*10:F,$=(await this.client.ft.search("checkpoints",E,{LIMIT:{from:0,size:X},SORTBY:{BY:"checkpoint_ts",DIRECTION:"DESC"}})).documents,_=0;for(let H of $){if(_>=F)break;if(J?.before?.configurable?.checkpoint_id){if(H.value.checkpoint_id>=J.before.configurable.checkpoint_id)continue}let U=H.value,B=!0;if((Q||J?.before)&&J?.filter){for(let[M,O]of Object.entries(J.filter))if(O===null){if(U.metadata?.[M]!==null){B=!1;break}}else if(O!==void 0){let A=U.metadata?.[M];if(typeof O==="object"&&O!==null){if(q(A)!==q(O)){B=!1;break}}else if(A!==O){B=!1;break}}if(!B)continue}let{checkpoint:L,pendingWrites:R}=await this.loadCheckpointWithWrites(U);yield await this.createCheckpointTuple(U,L,R),_++}return}catch(X){if(X.message?.includes("no such index"));else throw X}if(G?.configurable?.thread_id){let X=G.configurable.thread_id,$=G.configurable.checkpoint_ns??"",_=`checkpoint:${X}:${$}:*`,H=await this.client.keys(_);H.sort().reverse();let U=H;if(J?.before?.configurable?.checkpoint_id){let R=`checkpoint:${J.before.configurable.thread_id||X}:${J.before.configurable.checkpoint_ns??$}:${J.before.configurable.checkpoint_id}`,M=H.indexOf(R);if(M>0)U=H.slice(M+1);else if(M===0)U=[]}let B=J?.limit??10,L=U.slice(0,B);for(let R of L){let M=await this.client.json.get(R);if(M){let O=!0;for(let[V,S]of Object.entries(J.filter)){let N=M.metadata?.[V];if(S===null){if(N!==null){O=!1;break}}else if(N!==S){O=!1;break}}if(!O)continue;let{checkpoint:A,pendingWrites:P}=await this.loadCheckpointWithWrites(M);yield await this.createCheckpointTuple(M,A,P)}}}else{let X=G?.configurable?.checkpoint_ns!==void 0?`checkpoint:*:${G.configurable.checkpoint_ns===""?"__empty__":G.configurable.checkpoint_ns}:*`:"checkpoint:*",$=await this.client.keys(X),_=[];for(let B of $){let L=await this.client.json.get(B);if(L)_.push({key:B,doc:L})}_.sort((B,L)=>L.doc.checkpoint_ts-B.doc.checkpoint_ts);let H=0,U=J?.limit??10;for(let{doc:B}of _){if(H>=U)break;if(J?.before?.configurable?.checkpoint_id){if(B.checkpoint_id>=J.before.configurable.checkpoint_id)continue}let L=!0;if(J?.filter){for(let[O,A]of Object.entries(J.filter))if(A===null){if(B.metadata?.[O]!==null){L=!1;break}}else if(A!==void 0){let P=B.metadata?.[O];if(typeof A==="object"&&A!==null){if(q(P)!==q(A)){L=!1;break}}else if(P!==A){L=!1;break}}if(!L)continue}let{checkpoint:R,pendingWrites:M}=await this.loadCheckpointWithWrites(B);yield await this.createCheckpointTuple(B,R,M),H++}}return}let Z={...J,filter:{}};yield*this.list(G,Z)}async putWrites(G,J,Z){await this.ensureIndexes();let Q=G.configurable?.thread_id,Y=G.configurable?.checkpoint_ns??"",E=G.configurable?.checkpoint_id;if(!Q||!E)throw Error("thread_id and checkpoint_id are required");let F=[],X=performance.now()*1000;for(let _=0;_<J.length;_++){let[H,U]=J[_],B=`checkpoint_write:${Q}:${Y}:${E}:${Z}:${_}`;F.push(B);let L={thread_id:Q,checkpoint_ns:Y,checkpoint_id:E,task_id:Z,idx:_,channel:H,type:typeof U==="object"?"json":"string",value:U,timestamp:X,global_idx:X+_};await this.client.json.set(B,"$",L)}if(F.length>0){let _=`write_keys_zset:${Q}:${Y}:${E}`,H={};if(F.forEach((U,B)=>{H[U]=X+B}),await this.client.zAdd(_,Object.entries(H).map(([U,B])=>({score:B,value:U}))),this.ttlConfig?.defaultTTL)await this.applyTTL(...F,_)}let $=`checkpoint:${Q}:${Y}:${E}`;if(await this.client.exists($)){let _=await this.client.json.get($);if(_)_.has_writes="true",await this.client.json.set($,"$",_)}}async deleteThread(G){let J=`checkpoint:${G}:*`,Z=await this.client.keys(J);if(Z.length>0)await this.client.del(Z);let Q=`writes:${G}:*`,Y=await this.client.keys(Q);if(Y.length>0)await this.client.del(Y)}async end(){await this.client.quit()}async loadPendingWrites(G,J,Z){let Q=`checkpoint_write:${G}:${J}:${Z}:*`,Y=await this.client.keys(Q);if(Y.length===0)return;let E=[];for(let X of Y){let $=await this.client.json.get(X);if($)E.push($)}E.sort((X,$)=>(X.global_idx||0)-($.global_idx||0));let F=[];for(let X of E){let $=await this.serde.loadsTyped("json",JSON.stringify(X.value));F.push([X.task_id,X.channel,$])}return F}async loadCheckpointWithWrites(G){let J=await this.serde.loadsTyped("json",JSON.stringify(G.checkpoint));if(J.v<4&&G.parent_checkpoint_id!=null){let Q=G.checkpoint_ns==="__empty__"?"":G.checkpoint_ns;await this.migratePendingSends(J,G.thread_id,Q,G.parent_checkpoint_id)}let Z;if(G.has_writes==="true"){let Q=G.checkpoint_ns==="__empty__"?"":G.checkpoint_ns;Z=await this.loadPendingWrites(G.thread_id,Q,G.checkpoint_id)}return{checkpoint:J,pendingWrites:Z}}async migratePendingSends(G,J,Z,Q){let Y=await this.loadPendingWrites(J,Z,Q);if(!Y||Y.length===0)return;let E=Y.filter(([,X])=>X===T);if(E.length===0)return;let F=[];for(let[,,X]of E)F.push(X);G.channel_values??={},G.channel_values[T]=F,G.channel_versions[T]=Object.keys(G.channel_versions).length>0?v(...Object.values(G.channel_versions)):1}async createCheckpointTuple(G,J,Z){let Q=G.checkpoint_ns==="__empty__"?"":G.checkpoint_ns,Y=await this.serde.loadsTyped("json",JSON.stringify(G.metadata));return{config:{configurable:{thread_id:G.thread_id,checkpoint_ns:Q,checkpoint_id:G.checkpoint_id}},checkpoint:J,metadata:Y,parentConfig:G.parent_checkpoint_id?{configurable:{thread_id:G.thread_id,checkpoint_ns:Q,checkpoint_id:G.parent_checkpoint_id}}:void 0,pendingWrites:Z}}addSearchableMetadataFields(G,J){if(!J)return;if("source"in J)G.source=J.source;if("step"in J)G.step=J.step;if("writes"in J)G.writes=typeof J.writes==="object"?JSON.stringify(J.writes):J.writes;if("score"in J)G.score=J.score}async applyTTL(...G){if(!this.ttlConfig?.defaultTTL)return;let J=Math.floor(this.ttlConfig.defaultTTL*60),Z=await Promise.allSettled(G.map((Q)=>this.client.expire(Q,J)));for(let Q=0;Q<Z.length;Q++)if(Z[Q].status==="rejected")console.warn(`Failed to set TTL for key ${G[Q]}:`,Z[Q].reason)}async ensureIndexes(){for(let G of g)try{await this.client.ft.create(G.index,G.schema,{ON:"JSON",PREFIX:G.prefix})}catch(J){if(!J.message?.includes("Index already exists"))console.error(`Failed to create index ${G.index}:`,J.message)}}};function q(z){if(z===null||typeof z!=="object")return JSON.stringify(z);if(Array.isArray(z))return JSON.stringify(z.map((Z)=>q(Z)));let G={},J=Object.keys(z).sort();for(let Z of J)G[Z]=z[Z];return JSON.stringify(G,(Z,Q)=>{if(Q!==null&&typeof Q==="object"&&!Array.isArray(Q)){let Y={},E=Object.keys(Q).sort();for(let F of E)Y[F]=Q[F];return Y}return Q})}export{f as RedisSaver};
|