zen-code 4.9.2 → 4.10.1

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.
Files changed (86) hide show
  1. package/dist/app.js +2606 -182
  2. package/dist/cli.js +3116 -1
  3. package/dist/nonInteractive.js +2084 -4
  4. package/dist/zen-keyboard.js +358 -3
  5. package/package.json +37 -37
  6. package/dist/chunk-0pss3s5r.js +0 -88
  7. package/dist/chunk-0sxrk9sx.js +0 -1
  8. package/dist/chunk-0zk0m93z.js +0 -26
  9. package/dist/chunk-178yjjsx.js +0 -1
  10. package/dist/chunk-1p9xzvpt.js +0 -3
  11. package/dist/chunk-2eh0sv3s.js +0 -2
  12. package/dist/chunk-43xrz4wp.js +0 -2
  13. package/dist/chunk-48ce2wt0.js +0 -1
  14. package/dist/chunk-48vkm1yn.js +0 -5
  15. package/dist/chunk-55nx49pj.js +0 -7
  16. package/dist/chunk-578m1dhj.js +0 -2
  17. package/dist/chunk-5dsevrtz.js +0 -91
  18. package/dist/chunk-62zh99t6.js +0 -298
  19. package/dist/chunk-66890qd3.js +0 -2
  20. package/dist/chunk-6nfpdtn6.js +0 -1
  21. package/dist/chunk-738m8242.js +0 -53
  22. package/dist/chunk-8f2zh5h6.js +0 -2
  23. package/dist/chunk-8ty2zfve.js +0 -3
  24. package/dist/chunk-94jawhw7.js +0 -3
  25. package/dist/chunk-98wjxsna.js +0 -79
  26. package/dist/chunk-9b7nj74j.js +0 -1
  27. package/dist/chunk-9k64296h.js +0 -4
  28. package/dist/chunk-9x562s6p.js +0 -1
  29. package/dist/chunk-a90fm6gz.js +0 -278
  30. package/dist/chunk-ac5t2ywn.js +0 -100
  31. package/dist/chunk-ad2hbq42.js +0 -1
  32. package/dist/chunk-afhxxkmv.js +0 -16
  33. package/dist/chunk-b4vvgbav.js +0 -1
  34. package/dist/chunk-b9pcntkv.js +0 -253
  35. package/dist/chunk-c7y5efa0.js +0 -1
  36. package/dist/chunk-cbjnwrt7.js +0 -2
  37. package/dist/chunk-ce53j63y.js +0 -3
  38. package/dist/chunk-dcs1r9as.js +0 -2
  39. package/dist/chunk-dcwnpdtk.js +0 -9
  40. package/dist/chunk-dxec2q4t.js +0 -23
  41. package/dist/chunk-e3tyc24s.js +0 -310
  42. package/dist/chunk-e8hp8d68.js +0 -81
  43. package/dist/chunk-fkrydbn4.js +0 -18
  44. package/dist/chunk-frhhpxxy.js +0 -2
  45. package/dist/chunk-fw3nrwpf.js +0 -1
  46. package/dist/chunk-gyhxdxb4.js +0 -1
  47. package/dist/chunk-h1enhch1.js +0 -2
  48. package/dist/chunk-hcnx1j2z.js +0 -1
  49. package/dist/chunk-hfegb4pr.js +0 -2
  50. package/dist/chunk-hfypkhky.js +0 -2
  51. package/dist/chunk-hmemx3cw.js +0 -2
  52. package/dist/chunk-hra0748z.js +0 -2
  53. package/dist/chunk-hsev32dg.js +0 -4
  54. package/dist/chunk-hyf24r36.js +0 -2
  55. package/dist/chunk-jb4yt88g.js +0 -6
  56. package/dist/chunk-jjcmm167.js +0 -1
  57. package/dist/chunk-jrepjpft.js +0 -2
  58. package/dist/chunk-k38fjqj7.js +0 -140
  59. package/dist/chunk-kym9tb01.js +0 -1
  60. package/dist/chunk-mt1g6g89.js +0 -1
  61. package/dist/chunk-p0vzbr7s.js +0 -585
  62. package/dist/chunk-pndhbee8.js +0 -2
  63. package/dist/chunk-pwrscdkf.js +0 -2
  64. package/dist/chunk-r019959h.js +0 -2
  65. package/dist/chunk-r10bn684.js +0 -1
  66. package/dist/chunk-r3pe49q4.js +0 -8
  67. package/dist/chunk-r4tq44hr.js +0 -1
  68. package/dist/chunk-rjrnaka2.js +0 -1
  69. package/dist/chunk-rt5mpgbg.js +0 -6
  70. package/dist/chunk-rztre6k0.js +0 -1
  71. package/dist/chunk-s77qbhtz.js +0 -3
  72. package/dist/chunk-t7rwtc17.js +0 -1
  73. package/dist/chunk-v8g52kan.js +0 -1
  74. package/dist/chunk-vd6c87cm.js +0 -2
  75. package/dist/chunk-vfwbx331.js +0 -2
  76. package/dist/chunk-vh9zd1v3.js +0 -5
  77. package/dist/chunk-w2hbsa9j.js +0 -86
  78. package/dist/chunk-wabmqprd.js +0 -184
  79. package/dist/chunk-wpy5r9ma.js +0 -40
  80. package/dist/chunk-x552nspp.js +0 -6
  81. package/dist/chunk-x90r4sje.js +0 -1
  82. package/dist/chunk-yndex7hs.js +0 -1
  83. package/dist/chunk-yqwxbcc7.js +0 -31
  84. package/dist/chunk-z8n7y37k.js +0 -1
  85. package/dist/chunk-zr7sx9hd.js +0 -1
  86. package/dist/chunk-zxqmghzf.js +0 -1
@@ -1,2 +0,0 @@
1
- import{createRequire as k}from"node:module";var g=Object.create;var{getPrototypeOf:h,defineProperty:f,getOwnPropertyNames:i}=Object;var j=Object.prototype.hasOwnProperty;var l=(a,b,c)=>{c=a!=null?g(h(a)):{};let d=b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c;for(let e of i(a))if(!j.call(d,e))f(d,e,{get:()=>a[e],enumerable:!0});return d};var m=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var n=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0,configurable:!0,set:(d)=>b[c]=()=>d})};var o=(a,b)=>()=>(a&&(b=a(a=0)),b);var q=k(import.meta.url);
2
- export{l as pq,m as qq,n as rq,o as sq,q as tq};
@@ -1,9 +0,0 @@
1
- import{ri as o}from"./chunk-cbjnwrt7.js";import{Dk as S,Hj as K0,Ij as D0,Ik as y0,Jj as Y0,Nk as j0,Pi as Z0,al as L0,cl as p0,ej as N0,fj as w0,gl as R0,hk as u,ik as B0,jk as x0,kj as C,lj as V0,ll as A,mj as f,mk as I0,nk as M0,ok as $0,pk as q0,pl as c,rk as T0,vi as F,xj as r}from"./chunk-w2hbsa9j.js";import{El as Q0}from"./chunk-rztre6k0.js";import{pq as a0,qq as C0}from"./chunk-dcs1r9as.js";var v0=C0((t0)=>{t0.byteLength=u0;t0.toByteArray=g0;t0.fromByteArray=m0;var M=[],N=[],f0=typeof Uint8Array<"u"?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(T=0,s=d.length;T<s;++T)M[T]=d[T],N[d.charCodeAt(T)]=T;var T,s;N[45]=62;N[95]=63;function O0(w){var x=w.length;if(x%4>0)throw Error("Invalid string. Length must be a multiple of 4");var $=w.indexOf("=");if($===-1)$=x;var q=$===x?0:4-$%4;return[$,q]}function u0(w){var x=O0(w),$=x[0],q=x[1];return($+q)*3/4-q}function h0(w,x,$){return(x+$)*3/4-$}function g0(w){var x,$=O0(w),q=$[0],W=$[1],Q=new f0(h0(w,q,W)),J=0,Y=W>0?q-4:q,Z;for(Z=0;Z<Y;Z+=4)x=N[w.charCodeAt(Z)]<<18|N[w.charCodeAt(Z+1)]<<12|N[w.charCodeAt(Z+2)]<<6|N[w.charCodeAt(Z+3)],Q[J++]=x>>16&255,Q[J++]=x>>8&255,Q[J++]=x&255;if(W===2)x=N[w.charCodeAt(Z)]<<2|N[w.charCodeAt(Z+1)]>>4,Q[J++]=x&255;if(W===1)x=N[w.charCodeAt(Z)]<<10|N[w.charCodeAt(Z+1)]<<4|N[w.charCodeAt(Z+2)]>>2,Q[J++]=x>>8&255,Q[J++]=x&255;return Q}function H0(w){return M[w>>18&63]+M[w>>12&63]+M[w>>6&63]+M[w&63]}function r0(w,x,$){var q,W=[];for(var Q=x;Q<$;Q+=3)q=(w[Q]<<16&16711680)+(w[Q+1]<<8&65280)+(w[Q+2]&255),W.push(H0(q));return W.join("")}function m0(w){var x,$=w.length,q=$%3,W=[],Q=16383;for(var J=0,Y=$-q;J<Y;J+=Q)W.push(r0(w,J,J+Q>Y?Y:J+Q));if(q===1)x=w[$-1],W.push(M[x>>2]+M[x<<4&63]+"==");else if(q===2)x=(w[$-2]<<8)+w[$-1],W.push(M[x>>10]+M[x>>4&63]+M[x<<2&63]+"=");return W.join("")}});var U="0123456789abcdef".split(""),_0=[-2147483648,8388608,32768,128],B=[24,16,8,0],L=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],P=[];function I(w,x){if(x)P[0]=P[16]=P[1]=P[2]=P[3]=P[4]=P[5]=P[6]=P[7]=P[8]=P[9]=P[10]=P[11]=P[12]=P[13]=P[14]=P[15]=0,this.blocks=P;else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];if(w)this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428;else this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225;this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=w}I.prototype.update=function(w){if(this.finalized)return;var x,$=typeof w;if($!=="string"){if($==="object"){if(w===null)throw Error(ERROR);else if(ARRAY_BUFFER&&w.constructor===ArrayBuffer)w=new Uint8Array(w);else if(!Array.isArray(w)){if(!ARRAY_BUFFER||!ArrayBuffer.isView(w))throw Error(ERROR)}}else throw Error(ERROR);x=!0}var q,W=0,Q,J=w.length,Y=this.blocks;while(W<J){if(this.hashed)this.hashed=!1,Y[0]=this.block,this.block=Y[16]=Y[1]=Y[2]=Y[3]=Y[4]=Y[5]=Y[6]=Y[7]=Y[8]=Y[9]=Y[10]=Y[11]=Y[12]=Y[13]=Y[14]=Y[15]=0;if(x)for(Q=this.start;W<J&&Q<64;++W)Y[Q>>>2]|=w[W]<<B[Q++&3];else for(Q=this.start;W<J&&Q<64;++W)if(q=w.charCodeAt(W),q<128)Y[Q>>>2]|=q<<B[Q++&3];else if(q<2048)Y[Q>>>2]|=(192|q>>>6)<<B[Q++&3],Y[Q>>>2]|=(128|q&63)<<B[Q++&3];else if(q<55296||q>=57344)Y[Q>>>2]|=(224|q>>>12)<<B[Q++&3],Y[Q>>>2]|=(128|q>>>6&63)<<B[Q++&3],Y[Q>>>2]|=(128|q&63)<<B[Q++&3];else q=65536+((q&1023)<<10|w.charCodeAt(++W)&1023),Y[Q>>>2]|=(240|q>>>18)<<B[Q++&3],Y[Q>>>2]|=(128|q>>>12&63)<<B[Q++&3],Y[Q>>>2]|=(128|q>>>6&63)<<B[Q++&3],Y[Q>>>2]|=(128|q&63)<<B[Q++&3];if(this.lastByteIndex=Q,this.bytes+=Q-this.start,Q>=64)this.block=Y[16],this.start=Q-64,this.hash(),this.hashed=!0;else this.start=Q}if(this.bytes>4294967295)this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296;return this};I.prototype.finalize=function(){if(this.finalized)return;this.finalized=!0;var w=this.blocks,x=this.lastByteIndex;if(w[16]=this.block,w[x>>>2]|=_0[x&3],this.block=w[16],x>=56){if(!this.hashed)this.hash();w[0]=this.block,w[16]=w[1]=w[2]=w[3]=w[4]=w[5]=w[6]=w[7]=w[8]=w[9]=w[10]=w[11]=w[12]=w[13]=w[14]=w[15]=0}w[14]=this.hBytes<<3|this.bytes>>>29,w[15]=this.bytes<<3,this.hash()};I.prototype.hash=function(){var w=this.h0,x=this.h1,$=this.h2,q=this.h3,W=this.h4,Q=this.h5,J=this.h6,Y=this.h7,Z=this.blocks,O,v,G,z,D,K,V,y,h,g,j;for(O=16;O<64;++O)D=Z[O-15],v=(D>>>7|D<<25)^(D>>>18|D<<14)^D>>>3,D=Z[O-2],G=(D>>>17|D<<15)^(D>>>19|D<<13)^D>>>10,Z[O]=Z[O-16]+v+Z[O-7]+G<<0;j=x&$;for(O=0;O<64;O+=4){if(this.first){if(this.is224)y=300032,D=Z[0]-1413257819,Y=D-150054599<<0,q=D+24177077<<0;else y=704751109,D=Z[0]-210244248,Y=D-1521486534<<0,q=D+143694565<<0;this.first=!1}else v=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),G=(W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7),y=w&x,z=y^w&$^j,V=W&Q^~W&J,D=Y+G+V+L[O]+Z[O],K=v+z,Y=q+D<<0,q=D+K<<0;v=(q>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),G=(Y>>>6|Y<<26)^(Y>>>11|Y<<21)^(Y>>>25|Y<<7),h=q&w,z=h^q&x^y,V=J&Y^~J&W,D=Q+G+V+L[O+1]+Z[O+1],K=v+z,J=$+D<<0,$=D+K<<0,v=($>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),G=(J>>>6|J<<26)^(J>>>11|J<<21)^(J>>>25|J<<7),g=$&q,z=g^$&w^h,V=Q&J^~Q&Y,D=W+G+V+L[O+2]+Z[O+2],K=v+z,Q=x+D<<0,x=D+K<<0,v=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),G=(Q>>>6|Q<<26)^(Q>>>11|Q<<21)^(Q>>>25|Q<<7),j=x&$,z=j^x&q^g,V=Q&J^~Q&Y,D=W+G+V+L[O+3]+Z[O+3],K=v+z,W=w+D<<0,w=D+K<<0,this.chromeBugWorkAround=!0}this.h0=this.h0+w<<0,this.h1=this.h1+x<<0,this.h2=this.h2+$<<0,this.h3=this.h3+q<<0,this.h4=this.h4+W<<0,this.h5=this.h5+Q<<0,this.h6=this.h6+J<<0,this.h7=this.h7+Y<<0};I.prototype.hex=function(){this.finalize();var w=this.h0,x=this.h1,$=this.h2,q=this.h3,W=this.h4,Q=this.h5,J=this.h6,Y=this.h7,Z=U[w>>>28&15]+U[w>>>24&15]+U[w>>>20&15]+U[w>>>16&15]+U[w>>>12&15]+U[w>>>8&15]+U[w>>>4&15]+U[w&15]+U[x>>>28&15]+U[x>>>24&15]+U[x>>>20&15]+U[x>>>16&15]+U[x>>>12&15]+U[x>>>8&15]+U[x>>>4&15]+U[x&15]+U[$>>>28&15]+U[$>>>24&15]+U[$>>>20&15]+U[$>>>16&15]+U[$>>>12&15]+U[$>>>8&15]+U[$>>>4&15]+U[$&15]+U[q>>>28&15]+U[q>>>24&15]+U[q>>>20&15]+U[q>>>16&15]+U[q>>>12&15]+U[q>>>8&15]+U[q>>>4&15]+U[q&15]+U[W>>>28&15]+U[W>>>24&15]+U[W>>>20&15]+U[W>>>16&15]+U[W>>>12&15]+U[W>>>8&15]+U[W>>>4&15]+U[W&15]+U[Q>>>28&15]+U[Q>>>24&15]+U[Q>>>20&15]+U[Q>>>16&15]+U[Q>>>12&15]+U[Q>>>8&15]+U[Q>>>4&15]+U[Q&15]+U[J>>>28&15]+U[J>>>24&15]+U[J>>>20&15]+U[J>>>16&15]+U[J>>>12&15]+U[J>>>8&15]+U[J>>>4&15]+U[J&15];if(!this.is224)Z+=U[Y>>>28&15]+U[Y>>>24&15]+U[Y>>>20&15]+U[Y>>>16&15]+U[Y>>>12&15]+U[Y>>>8&15]+U[Y>>>4&15]+U[Y&15];return Z};I.prototype.toString=I.prototype.hex;I.prototype.digest=function(){this.finalize();var w=this.h0,x=this.h1,$=this.h2,q=this.h3,W=this.h4,Q=this.h5,J=this.h6,Y=this.h7,Z=[w>>>24&255,w>>>16&255,w>>>8&255,w&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255,$>>>24&255,$>>>16&255,$>>>8&255,$&255,q>>>24&255,q>>>16&255,q>>>8&255,q&255,W>>>24&255,W>>>16&255,W>>>8&255,W&255,Q>>>24&255,Q>>>16&255,Q>>>8&255,Q&255,J>>>24&255,J>>>16&255,J>>>8&255,J&255];if(!this.is224)Z.push(Y>>>24&255,Y>>>16&255,Y>>>8&255,Y&255);return Z};I.prototype.array=I.prototype.digest;I.prototype.arrayBuffer=function(){this.finalize();var w=new ArrayBuffer(this.is224?28:32),x=new DataView(w);if(x.setUint32(0,this.h0),x.setUint32(4,this.h1),x.setUint32(8,this.h2),x.setUint32(12,this.h3),x.setUint32(16,this.h4),x.setUint32(20,this.h5),x.setUint32(24,this.h6),!this.is224)x.setUint32(28,this.h7);return w};var p=(...w)=>{return new I(!1,!0).update(w.join("")).hex()};var K1=F({sha256:()=>p});var I1=F({BaseCache:()=>U0,InMemoryCache:()=>H,defaultHashKeyEncoder:()=>J0,deserializeStoredGeneration:()=>c0,serializeGeneration:()=>b0}),J0=(...w)=>p(w.join("_"));function c0(w){if(w.message!==void 0)return{text:w.text,message:Y0(w.message)};else return{text:w.text}}function b0(w){let x={text:w.text};if(w.message!==void 0)x.message=w.message.toDict();return x}var U0=class{keyEncoder=J0;makeDefaultKeyEncoder(w){this.keyEncoder=w}},k0=new Map,H=class w extends U0{cache;constructor(x){super();this.cache=x??new Map}lookup(x,$){return Promise.resolve(this.cache.get(this.keyEncoder(x,$))??null)}async update(x,$,q){this.cache.set(this.keyEncoder(x,$),q)}static global(){return new w(k0)}};var R1=F({BasePromptValue:()=>R,ChatPromptValue:()=>t,ImagePromptValue:()=>S0,StringPromptValue:()=>m}),R=class extends Z0{},m=class extends R{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(w){super({value:w});this.value=w}toString(){return this.value}toChatMessages(){return[new r(this.value)]}},t=class extends R{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(w){if(Array.isArray(w))w={messages:w};super(w);this.messages=w.messages}toString(){return D0(this.messages)}toChatMessages(){return this.messages}},S0=class extends R{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(w){if(!("imageUrl"in w))w={imageUrl:w};super(w);this.imageUrl=w.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new r({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var z0=a0(v0(),1),n0=Object.defineProperty,e0=(w,x,$)=>(x in w)?n0(w,x,{enumerable:!0,configurable:!0,writable:!0,value:$}):w[x]=$,l0=(w,x,$)=>{return e0(w,typeof x!=="symbol"?x+"":x,$),$};function o0(w,x){let $=Array.from({length:w.length},(q,W)=>({start:W,end:W+1}));while($.length>1){let q=null;for(let W=0;W<$.length-1;W++){let Q=w.slice($[W].start,$[W+1].end),J=x.get(Q.join(","));if(J==null)continue;if(q==null||J<q[0])q=[J,W]}if(q!=null){let W=q[1];$[W]={start:$[W].start,end:$[W+1].end},$.splice(W+1,1)}else break}return $}function w1(w,x){if(w.length===1)return[x.get(w.join(","))];return o0(w,x).map(($)=>x.get(w.slice($.start,$.end).join(","))).filter(($)=>$!=null)}function x1(w){return w.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var i=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(w,x){this.patStr=w.pat_str;let $=w.bpe_ranks.split(`
2
- `).filter(Boolean).reduce((q,W)=>{let[Q,J,...Y]=W.split(" "),Z=Number.parseInt(J,10);return Y.forEach((O,v)=>q[O]=Z+v),q},{});for(let[q,W]of Object.entries($)){let Q=z0.default.toByteArray(q);this.rankMap.set(Q.join(","),W),this.textMap.set(W,Q)}this.specialTokens={...w.special_tokens,...x},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((q,[W,Q])=>{return q[Q]=this.textEncoder.encode(W),q},{})}encode(w,x=[],$="all"){let q=new RegExp(this.patStr,"ug"),W=i.specialTokenRegex(Object.keys(this.specialTokens)),Q=[],J=new Set(x==="all"?Object.keys(this.specialTokens):x),Y=new Set($==="all"?Object.keys(this.specialTokens).filter((O)=>!J.has(O)):$);if(Y.size>0){let O=i.specialTokenRegex([...Y]),v=w.match(O);if(v!=null)throw Error(`The text contains a special token that is not allowed: ${v[0]}`)}let Z=0;while(!0){let O=null,v=Z;while(!0){if(W.lastIndex=v,O=W.exec(w),O==null||J.has(O[0]))break;v=O.index+1}let G=O?.index??w.length;for(let D of w.substring(Z,G).matchAll(q)){let K=this.textEncoder.encode(D[0]),V=this.rankMap.get(K.join(","));if(V!=null){Q.push(V);continue}Q.push(...w1(K,this.rankMap))}if(O==null)break;let z=this.specialTokens[O[0]];Q.push(z),Z=O.index+O[0].length}return Q}decode(w){let x=[],$=0;for(let Q=0;Q<w.length;++Q){let J=w[Q],Y=this.textMap.get(J)??this.inverseSpecialTokens[J];if(Y!=null)x.push(Y),$+=Y.length}let q=new Uint8Array($),W=0;for(let Q of x)q.set(Q,W),W+=Q.length;return this.textDecoder.decode(q)}},X=i;l0(X,"specialTokenRegex",(w)=>{return new RegExp(w.map((x)=>x1(x)).join("|"),"g")});function a(w){switch(w){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw Error("Unknown model")}}var H1=F({encodingForModel:()=>_,getEncoding:()=>G0}),E={},$1=new A({});async function G0(w){if(!(w in E))E[w]=$1.fetch(`https://tiktoken.pages.dev/js/${w}.json`).then((x)=>x.json()).then((x)=>new X(x)).catch((x)=>{throw delete E[w],x});return await E[w]}async function _(w){return G0(a(w))}var e1=F({BaseLangChain:()=>k,BaseLanguageModel:()=>J1,calculateMaxTokens:()=>W1,getEmbeddingContextSize:()=>q1,getModelContextSize:()=>P0,getModelNameForTiktoken:()=>b,isOpenAITool:()=>Q1}),b=(w)=>{if(w.startsWith("gpt-5"))return"gpt-5";if(w.startsWith("gpt-3.5-turbo-16k"))return"gpt-3.5-turbo-16k";if(w.startsWith("gpt-3.5-turbo-"))return"gpt-3.5-turbo";if(w.startsWith("gpt-4-32k"))return"gpt-4-32k";if(w.startsWith("gpt-4-"))return"gpt-4";if(w.startsWith("gpt-4o"))return"gpt-4o";return w},q1=(w)=>{switch(w){case"text-embedding-ada-002":return 8191;default:return 2046}},P0=(w)=>{switch(b(w)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 400000;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128000;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128000;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8000;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 200000;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function Q1(w){if(typeof w!=="object"||!w)return!1;if("type"in w&&w.type==="function"&&"function"in w&&typeof w.function==="object"&&w.function&&"name"in w.function&&"parameters"in w.function)return!0;return!1}var W1=async({prompt:w,modelName:x})=>{let $;try{$=(await _(b(x))).encode(w).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),$=Math.ceil(w.length/4)}return P0(x)-$},Y1=()=>!1,k=class extends c{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(w){super(w);this.verbose=w.verbose??Y1(),this.callbacks=w.callbacks,this.tags=w.tags??[],this.metadata=w.metadata??{}}},J1=class extends k{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:w,callbackManager:x,...$}){let{cache:q,...W}=$;super({callbacks:w??x,...W});if(typeof q==="object")this.cache=q;else if(q)this.cache=H.global();else this.cache=void 0;this.caller=new A($??{})}_encoding;async getNumTokens(w){let x;if(typeof w==="string")x=w;else x=w.map((q)=>{if(typeof q==="string")return q;if(q.type==="text"&&"text"in q)return q.text;return""}).join("");let $=Math.ceil(x.length/4);if(!this._encoding)try{this._encoding=await _("modelName"in this?b(this.modelName):"gpt2")}catch(q){console.warn("Failed to calculate number of tokens, falling back to approximate count",q)}if(this._encoding)try{$=this._encoding.encode(x).length}catch(q){console.warn("Failed to calculate number of tokens, falling back to approximate count",q)}return $}static _convertInputToPromptValue(w){if(typeof w==="string")return new m(w);else if(Array.isArray(w))return new t(w.map(K0));else return w}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:w,...x}){let $={...this._identifyingParams(),...x,_type:this._llmType(),_model:this._modelType()};return Object.entries($).filter(([q,W])=>W!==void 0).map(([q,W])=>`${q}:${JSON.stringify(W)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(w){throw Error("Use .toJSON() instead")}get profile(){return{}}};function n(w){return w!==void 0&&Array.isArray(w.lc_namespace)}function e(w){return w!==void 0&&c.isRunnable(w)&&"lc_name"in w.constructor&&typeof w.constructor.lc_name==="function"&&w.constructor.lc_name()==="RunnableToolLike"}function l(w){return!!w&&typeof w==="object"&&"name"in w&&"schema"in w&&(S(w.schema)||w.schema!=null&&typeof w.schema==="object"&&("type"in w.schema)&&typeof w.schema.type==="string"&&["null","boolean","object","array","number","string"].includes(w.schema.type))}function F0(w){return l(w)||e(w)||n(w)}var I4=F({BaseToolkit:()=>U1,DynamicStructuredTool:()=>A0,DynamicTool:()=>E0,StructuredTool:()=>W0,Tool:()=>X0,ToolInputParsingException:()=>f,isLangChainTool:()=>F0,isRunnableToolLike:()=>e,isStructuredTool:()=>n,isStructuredToolParams:()=>l,tool:()=>Z1}),W0=class extends k{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(w){super(w??{});this.verboseParsingErrors=w?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=w?.responseFormat??this.responseFormat,this.defaultConfig=w?.defaultConfig??this.defaultConfig,this.metadata=w?.metadata??this.metadata,this.extras=w?.extras??this.extras}async invoke(w,x){let $,q=M0(I0(this.defaultConfig,x));if(C(w))$=w.args,q={...q,toolCall:w};else $=w;return this.call($,q)}async call(w,x,$){let q=C(w)?w.args:w,W;if(S(this.schema))try{W=await y0(this.schema,q)}catch(z){let D="Received tool input did not match expected schema";if(this.verboseParsingErrors)D=`${D}
3
- Details: ${z.message}`;if(L0(z))D=`${D}
4
-
5
- ${o.prettifyError(z)}`;throw new f(D,JSON.stringify(w))}else{let z=p0(q,this.schema);if(!z.valid){let D="Received tool input did not match expected schema";if(this.verboseParsingErrors)D=`${D}
6
- Details: ${z.errors.map((K)=>`${K.keywordLocation}: ${K.error}`).join(`
7
- `)}`;throw new f(D,JSON.stringify(w))}W=q}let Q=u(x),J=await B0.configure(Q.callbacks,this.callbacks,Q.tags||$,this.tags,Q.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof w==="string"?w:JSON.stringify(w),Q.runId,void 0,void 0,void 0,Q.runName);delete Q.runId;let Y;try{Y=await this._call(W,J,Q)}catch(z){throw await J?.handleToolError(z),z}let Z,O;if(this.responseFormat==="content_and_artifact")if(Array.isArray(Y)&&Y.length===2)[Z,O]=Y;else throw Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
8
- Result: ${JSON.stringify(Y)}`);else Z=Y;let v;if(C(w))v=w.id;if(!v&&V0(Q))v=Q.toolCall.id;let G=D1({content:Z,artifact:O,toolCallId:v,name:this.name,metadata:this.metadata});return await J?.handleToolEnd(G),G}},X0=class extends W0{schema=Q0.object({input:Q0.string().optional()}).transform((w)=>w.input);constructor(w){super(w)}call(w,x){let $=typeof w==="string"||w==null?{input:w}:w;return super.call($,x)}},E0=class extends X0{static lc_name(){return"DynamicTool"}name;description;func;constructor(w){super(w);this.name=w.name,this.description=w.description,this.func=w.func,this.returnDirect=w.returnDirect??this.returnDirect}async call(w,x){let $=u(x);if($.runName===void 0)$.runName=this.name;return super.call(w,$)}async _call(w,x,$){return this.func(w,x,$)}},A0=class extends W0{static lc_name(){return"DynamicStructuredTool"}description;func;schema;constructor(w){super(w);this.name=w.name,this.description=w.description,this.func=w.func,this.returnDirect=w.returnDirect??this.returnDirect,this.schema=w.schema}async call(w,x,$){let q=u(x);if(q.runName===void 0)q.runName=this.name;return super.call(w,q,$)}_call(w,x,$){return this.func(w,x,$)}},U1=class{getTools(){return this.tools}};function Z1(w,x){let $=j0(x.schema),q=R0(x.schema);if(!x.schema||$||q)return new E0({...x,description:x.description??x.schema?.description??`${x.name} tool`,func:async(J,Y,Z)=>{return new Promise((O,v)=>{let G=$0(Z,{callbacks:Y?.getChild()});x0.runWithConfig(q0(G),async()=>{try{O(w(J,G))}catch(z){v(z)}})})}});let W=x.schema,Q=x.description??x.schema.description??`${x.name} tool`;return new A0({...x,description:Q,schema:W,func:async(J,Y,Z)=>{return new Promise((O,v)=>{let G,z=()=>{if(Z?.signal&&G)Z.signal.removeEventListener("abort",G)};if(Z?.signal)G=()=>{z(),v(T0(Z.signal))},Z.signal.addEventListener("abort",G,{once:!0});let D=$0(Z,{callbacks:Y?.getChild()});x0.runWithConfig(q0(D),async()=>{try{let K=await w(J,D);if(Z?.signal?.aborted){z();return}z(),O(K)}catch(K){z(),v(K)}})})}})}function D1(w){let{content:x,artifact:$,toolCallId:q,metadata:W}=w;if(q&&!N0(x))if(typeof x==="string"||Array.isArray(x)&&x.every((Q)=>typeof Q==="object"))return new w0({status:"success",content:x,artifact:$,tool_call_id:q,name:w.name,metadata:W});else return new w0({status:"success",content:O1(x),artifact:$,tool_call_id:q,name:w.name,metadata:W});else return x}function O1(w){try{return JSON.stringify(w)??""}catch(x){return`${w}`}}
9
- export{p as Ah,K1 as Bh,I1 as Ch,R1 as Dh,m as Eh,t as Fh,S0 as Gh,H1 as Hh,e1 as Ih,P0 as Jh,Q1 as Kh,J1 as Lh,n as Mh,e as Nh,l as Oh,F0 as Ph,I4 as Qh,W0 as Rh,X0 as Sh,E0 as Th,A0 as Uh,Z1 as Vh};
@@ -1,23 +0,0 @@
1
- import{Bd as x,Kd as w,ie as z}from"./chunk-hsev32dg.js";import"./chunk-dcs1r9as.js";class J{constructor(h){this.pool=h,this.db=new x({dialect:new z({pool:h})})}db;dateToDb(h){return h}dbToDate(h){return h instanceof Date?h:new Date(h)}jsonToDb(h){return h}dbToJson(h){return h}buildJsonQuery(h,C,H,I){return w`${w.ref(C)}->>${w.lit(H)} = ${w.lit(JSON.stringify(I))}`}now(){return new Date}async createTables(h){await w`
2
- CREATE TABLE IF NOT EXISTS threads (
3
- thread_id TEXT PRIMARY KEY,
4
- created_at TIMESTAMP NOT NULL,
5
- updated_at TIMESTAMP NOT NULL,
6
- metadata JSONB NOT NULL DEFAULT '{}',
7
- status TEXT NOT NULL DEFAULT 'idle',
8
- values JSONB,
9
- interrupts JSONB NOT NULL DEFAULT '{}'
10
- )
11
- `.execute(h),await w`
12
- CREATE TABLE IF NOT EXISTS runs (
13
- run_id TEXT PRIMARY KEY,
14
- thread_id TEXT NOT NULL,
15
- assistant_id TEXT NOT NULL,
16
- created_at TIMESTAMP NOT NULL,
17
- updated_at TIMESTAMP NOT NULL,
18
- status TEXT NOT NULL DEFAULT 'pending',
19
- metadata JSONB NOT NULL DEFAULT '{}',
20
- multitask_strategy TEXT NOT NULL DEFAULT 'reject',
21
- FOREIGN KEY (thread_id) REFERENCES threads(thread_id) ON DELETE CASCADE
22
- )
23
- `.execute(h)}async createIndexes(h){await w`CREATE INDEX IF NOT EXISTS idx_threads_status ON threads(status)`.execute(h),await w`CREATE INDEX IF NOT EXISTS idx_threads_created_at ON threads(created_at)`.execute(h),await w`CREATE INDEX IF NOT EXISTS idx_threads_updated_at ON threads(updated_at)`.execute(h),await w`CREATE INDEX IF NOT EXISTS idx_runs_thread_id ON runs(thread_id)`.execute(h),await w`CREATE INDEX IF NOT EXISTS idx_runs_status ON runs(status)`.execute(h)}}export{J as PostgresAdapter};
@@ -1,310 +0,0 @@
1
- var c=`# Zen Code
2
-
3
- 你是 Zen Code,一个高度自主的编程智能体。你具备独立思考、规划和执行复杂任务的能力。
4
-
5
- ---
6
-
7
- ## 一、核心认知模型
8
-
9
- ### 1.1 思维框架
10
-
11
- 你采用 **观察-推理-行动-反思** 循环(ORAR):
12
-
13
- \`\`\`
14
- OBSERVE → REASON → ACT → REFLECT
15
- ↑ ↓
16
- ←←←←←←←←←←←←←←←←←←←←←←←←←
17
- \`\`\`
18
-
19
- - **观察 (Observe)**: 收集信息、理解上下文、识别约束
20
- - **推理 (Reason)**: 分析问题、评估方案、规划路径
21
- - **行动 (Act)**: 执行操作、生成代码、调用工具
22
- - **反思 (Reflect)**: 验证结果、学习教训、优化策略
23
-
24
- ### 1.2 自主决策等级
25
-
26
- 根据任务风险自动选择决策模式:
27
-
28
- | 等级 | 触发条件 | 行为模式 |
29
- |------|----------|----------|
30
- | **L1 自动** | 只读操作、低风险修改 | 直接执行,事后汇报 |
31
- | **L2 通知** | 中等修改、可逆操作 | 执行并详细说明 |
32
- | **L3 确认** | 高风险操作、架构变更 | 先询问再执行 |
33
-
34
- **L1 自动执行**:文件读取、代码搜索、类型检查、格式化
35
- **L2 通知执行**:单文件修改、添加测试、重构局部代码
36
- **L3 需确认**:多文件架构变更、添加依赖、删除代码、执行脚本
37
-
38
- ### 1.3 任务复杂度评估
39
-
40
- 接收任务后立即评估:
41
-
42
- \`\`\`
43
- 简单 (S): 单点修改,<5分钟,直接执行
44
- 中等 (M): 多文件协调,5-30分钟,制定计划
45
- 复杂 (C): 架构变更,>30分钟,使用 todo_write 分解
46
- \`\`\`
47
-
48
- ---
49
-
50
- ## 二、信息收集策略
51
-
52
- ### 2.1 递进式探索
53
-
54
- 从宏观到微观,按需深入:
55
-
56
- \`\`\`
57
- Level 1: 项目结构 (AGENTS.md、README.md、package.json)
58
-
59
- Level 2: 模块边界 (入口文件、类型定义、配置文件)
60
-
61
- Level 3: 实现细节 (具体函数、测试用例、依赖关系)
62
- \`\`\`
63
-
64
- ### 2.2 搜索策略矩阵
65
-
66
- | 目标 | 首选工具 | 备选策略 |
67
- |------|----------|----------|
68
- | 找函数/类定义 | \`search_files_rg\` 正则 | glob + 读取 |
69
- | 找文件位置 | \`glob_files\` 模式 | 目录遍历 |
70
- | 理解调用关系 | grep 引用 + 读取上下文 | 类型定义追踪 |
71
- | 找配置项 | grep 配置文件 | 环境变量搜索 |
72
-
73
- ### 2.3 上下文构建原则
74
-
75
- - **最小必要**:只读取完成任务所需的信息
76
- - **关联发现**:通过 import/export 追踪依赖
77
- - **类型优先**:先看接口定义,再看实现
78
- - **测试参考**:测试用例揭示使用方式和边界
79
-
80
- ---
81
-
82
- ## 三、执行策略
83
-
84
- ### 3.1 代码修改原则
85
-
86
- **保守修改**:
87
- - 只改必须改的部分
88
- - 保持与现有代码风格一致
89
- - 优先使用项目已有的模式和工具
90
-
91
- **安全边界**:
92
- - 修改前理解影响范围
93
- - 一次只改一个关注点
94
- - 保持向后兼容,除非明确要求破坏性变更
95
-
96
- ### 3.2 错误处理策略
97
-
98
- 遇到错误时按优先级尝试:
99
-
100
- 1. **理解错误**:分析错误信息,定位根因
101
- 2. **局部修复**:尝试最小范围修复
102
- 3. **扩大搜索**:收集更多上下文
103
- 4. **替代方案**:尝试不同实现路径
104
- 5. **请求协助**:使用 \`ask_user_questions\` 询问方向
105
-
106
- ### 3.3 验证循环
107
-
108
- 每个修改后执行验证:
109
-
110
- \`\`\`
111
- 修改代码 → 检查语法 → 运行相关测试 → 确认无副作用
112
- \`\`\`
113
-
114
- ---
115
-
116
- ## 四、输出规范
117
-
118
- ### 4.1 简洁原则
119
-
120
- - **无寒暄**:直接进入主题
121
- - **无冗余**:不重复用户已知信息
122
- - **结构化**:使用列表和代码块
123
-
124
- ### 4.2 信息层级
125
-
126
- **必要信息** - 总是包含:
127
- - 执行了什么操作
128
- - 修改了哪些文件
129
- - 关键结果或发现
130
-
131
- **补充信息** - 按需包含:
132
- - 替代方案说明
133
- - 潜在风险提示
134
- - 后续建议
135
-
136
- **详细信息** - 需要时写入文件:
137
- - 完整分析报告
138
- - 大量代码展示
139
- - 详细调试日志
140
-
141
- ### 4.3 代码展示
142
-
143
- \`\`\`diff
144
- # 只展示变更的关键部分
145
- + // 新增代码
146
- - // 删除代码
147
- // 上下文(少量)
148
- \`\`\`
149
-
150
- ### 4.4 长度控制
151
-
152
- - 单次回复 < 50 行
153
- - 超过时使用 \`write_file\` 保存详情
154
- - 或使用 \`ask_user_questions\` 分步展开
155
-
156
- ---
157
-
158
- ## 五、编码标准
159
-
160
- ### 5.1 技术选型优先级
161
-
162
- 1. 项目已有方案 > 引入新方案
163
- 2. 标准库 > 轻量第三方库 > 重型框架
164
- 3. 成熟稳定 > 新潮技术
165
- 4. 类型安全 > 便捷
166
-
167
- ### 5.2 代码质量
168
-
169
- **必须**:
170
- - 类型完整(禁用 any)
171
- - 错误处理(无静默失败)
172
- - 可读性(描述性命名)
173
-
174
- **推荐**:
175
- - 函数式风格(纯函数、不可变)
176
- - 单一职责(一个函数做一件事)
177
- - 组合优于继承
178
-
179
- ### 5.3 命名规范
180
-
181
- | 类型 | 规范 | 示例 |
182
- |------|------|------|
183
- | 布尔值 | is/has/should 前缀 | isLoading, hasError |
184
- | 事件处理 | handle/on 前缀 | handleClick, onSubmit |
185
- | 异步函数 | 动词开头 | fetchUser, createTask |
186
- | 常量 | UPPER_SNAKE_CASE | MAX_RETRY_COUNT |
187
-
188
- ### 5.4 Git 规范
189
-
190
- Angular 格式:\`type(scope): subject\`
191
-
192
- 类型:feat, fix, refactor, docs, test, chore
193
-
194
- 示例:\`feat(auth): add JWT refresh token\`
195
-
196
- ---
197
-
198
- ## 六、工具使用指南
199
-
200
- ### 6.1 性能意识
201
-
202
- | 操作类型 | 耗时 | 策略 |
203
- |----------|------|------|
204
- | 读取/搜索 | <0.5s | 优先使用 |
205
- | 执行命令 | 0.5-5s | 按需使用 |
206
- | 全项目扫描 | >5s | 避免使用 |
207
-
208
- ### 6.2 路径规范
209
-
210
- 所有文件路径必须使用绝对路径。
211
-
212
- ### 6.3 文件操作
213
-
214
- **移动/重命名**:使用 terminal 执行 \`mv\` 命令
215
- **批量修改**:使用 \`edit_file\` 的 \`replace_all\` 参数
216
- **新建目录**:使用 \`folder_operations\` 的 create 操作
217
-
218
- ### 6.4 并行执行
219
-
220
- 无依赖的操作可以并行调用多个工具,提高效率。
221
-
222
- ---
223
-
224
- ## 七、协作模式
225
-
226
- ### 7.1 与用户协作
227
-
228
- **主动沟通**:
229
- - 发现潜在问题时提前告知
230
- - 有多个可行方案时请求选择
231
- - 任务完成时提供后续建议
232
-
233
- **避免**:
234
- - 假设用户意图(不确定就问)
235
- - 隐藏风险或问题
236
- - 过度询问显而易见的事情
237
-
238
- ### 7.2 任务管理
239
-
240
- **简单任务**:直接执行
241
- **复杂任务**:使用 todo_write 分解追踪
242
-
243
- ### 7.3 知识积累
244
-
245
- 执行任务中发现的重要信息:
246
- - 项目特有约定
247
- - 踩坑经验
248
- - 最佳实践
249
-
250
- 可建议用户记录到 .claude/memories/ 或 AGENTS.md
251
-
252
- ---
253
-
254
- ## 八、安全边界
255
-
256
- ### 8.1 绝对禁止
257
-
258
- - 编写/解释恶意代码
259
- - 删除无法恢复的数据(未备份)
260
- - 暴露敏感信息(密钥、密码)
261
- - 绕过安全检查
262
-
263
- ### 8.2 谨慎操作
264
-
265
- 以下操作需要 L3 确认:
266
- - 执行未知脚本
267
- - 修改安全相关配置
268
- - 访问网络/外部服务
269
- - 修改系统级文件
270
-
271
- ---
272
-
273
- ## 九、自我提升
274
-
275
- ### 9.1 持续学习
276
-
277
- - 从每次交互中学习项目约定
278
- - 识别并适应用户偏好
279
- - 发现可复用的模式
280
-
281
- ### 9.2 元认知
282
-
283
- 定期反思:
284
- - 这次任务我做得如何?
285
- - 有没有更好的方法?
286
- - 用户的真实需求是什么?
287
-
288
- ---
289
-
290
- ## 附录:决策速查
291
-
292
- \`\`\`
293
- 任务来了
294
-
295
- 评估复杂度 → S: 直接做 → 完成汇报
296
- ↓ M/C
297
- 需要更多信息? → 是 → 收集信息(递进式)
298
- ↓ 否
299
- 有风险? → L3 → 询问确认
300
- ↓ L1/L2
301
- 执行 → 验证 → 反思 → 输出结果
302
- \`\`\`
303
-
304
- `;async function f(b){return`
305
- ## 环境信息
306
- 工作目录: ${process.cwd()}
307
- 平台: ${process.platform}
308
- 日期: ${new Date().toLocaleDateString()}
309
- `}
310
- export{c as qf,f as rf};
@@ -1,81 +0,0 @@
1
- import{Bd as v,Kd as A}from"./chunk-hsev32dg.js";import{bh as R,dh as Q,sh as b,th as x,vh as _,wh as C,xh as f}from"./chunk-ac5t2ywn.js";import"./chunk-dcwnpdtk.js";import"./chunk-cbjnwrt7.js";import"./chunk-vh9zd1v3.js";import"./chunk-w2hbsa9j.js";import"./chunk-rztre6k0.js";import"./chunk-wpy5r9ma.js";import"./chunk-h1enhch1.js";import"./chunk-hyf24r36.js";import{pq as m,tq as j}from"./chunk-dcs1r9as.js";var K={maxRetries:3,baseDelayMs:100,nonRetryablePatterns:["database disk image is malformed","database is malformed","cannot rollback","no transaction is active","database or disk is full"],isRetryableError:(J)=>{let $=J?.message?.toLowerCase()||"";for(let B of K.nonRetryablePatterns)if($.includes(B.toLowerCase()))return!1;return $.includes("sqlite_busy")||$.includes("database is locked")||$==="sqlite_busy"||$==="database is locked"}};async function T(J,$){let B=null;for(let H=0;H<K.maxRetries;H++)try{return await J()}catch(Z){B=Z;let U=Z?.message?.toLowerCase()||"";if(!K.isRetryableError(Z)){if(U.includes("malformed")){let D=Error(`SQLite database is corrupted: ${Z.message}
2
-
3
- Context: ${$||"unknown"}
4
-
5
- Possible causes:
6
- 1. Database file was manually deleted or modified
7
- 2. Disk I/O errors during write operations
8
- 3. Concurrent access without proper locking
9
-
10
- Recovery options:
11
- - Delete the database file to start fresh (data will be lost)
12
- - Use SQLite recovery tools: sqlite3 <db> ".recover" > recover.sql
13
- - Switch to PostgreSQL/Redis for production use`);throw D.name="SQLiteCorruptError",D.cause=Z,D}throw Z}if(H<K.maxRetries-1){let D=K.baseDelayMs*Math.pow(2,H);console.warn(`SQLite lock detected${$?` (${$})`:""}, retrying in ${D}ms (attempt ${H+1}/${K.maxRetries})`),await new Promise((X)=>setTimeout(X,D))}}throw B}function E(J){if(J===null||typeof J!=="object")return JSON.stringify(J);if(Array.isArray(J))return JSON.stringify(J.map((H)=>E(H)));let $={},B=Object.keys(J).sort();for(let H of B)$[H]=J[H];return JSON.stringify($,(H,Z)=>{if(Z!==null&&typeof Z==="object"&&!Array.isArray(Z)){let U={},D=Object.keys(Z).sort();for(let X of D)U[X]=Z[X];return U}return Z})}class N extends x{db;isSetup;constructor(J,$){super($);this.db=new v({dialect:J}),this.isSetup=!1}static async fromConnStringAsync(J){let $;if(globalThis.Bun){console.log("LG | Using BunSqliteDialect "+J);let{BunSqliteDialect:B}=await import("./chunk-gyhxdxb4.js");$=new N(new B({url:J}))}else{console.log("LG | Using NodeWasmDialect");let{default:B}=await import("./chunk-x90r4sje.js").then((m)=>m(m.default,1)),{NodeWasmDialect:H}=await import("./chunk-yndex7hs.js");console.log(J);let Z=new H({database:new B.Database(J)});$=new N(Z)}return await $.setup(),$}async setup(){if(this.isSetup)return;await A`PRAGMA busy_timeout = 5000`.execute(this.db),await A`PRAGMA journal_mode = WAL`.execute(this.db),await A`PRAGMA synchronous = NORMAL`.execute(this.db),await A`PRAGMA wal_autocheckpoint = 1000`.execute(this.db),await A`
14
- CREATE TABLE IF NOT EXISTS shallow_checkpoints (
15
- thread_id TEXT NOT NULL,
16
- checkpoint_ns TEXT NOT NULL DEFAULT '',
17
- checkpoint_id TEXT NOT NULL,
18
- parent_checkpoint_id TEXT,
19
- type TEXT,
20
- checkpoint BLOB,
21
- metadata BLOB,
22
- checkpoint_ts INTEGER NOT NULL DEFAULT 0,
23
- PRIMARY KEY (thread_id, checkpoint_ns)
24
- )`.execute(this.db),await A`
25
- CREATE INDEX IF NOT EXISTS idx_shallow_checkpoints_ts
26
- ON shallow_checkpoints(checkpoint_ts DESC)`.execute(this.db),await A`
27
- CREATE TABLE IF NOT EXISTS writes (
28
- thread_id TEXT NOT NULL,
29
- checkpoint_ns TEXT NOT NULL DEFAULT '',
30
- checkpoint_id TEXT NOT NULL,
31
- task_id TEXT NOT NULL,
32
- idx INTEGER NOT NULL,
33
- channel TEXT NOT NULL,
34
- type TEXT,
35
- value BLOB,
36
- PRIMARY KEY (thread_id, checkpoint_ns, checkpoint_id, task_id, idx)
37
- )`.execute(this.db),this.isSetup=!0}async get(J){return(await this.getTuple(J))?.checkpoint}async getTuple(J){await this.setup();let $=J.configurable?.thread_id,B=J.configurable?.checkpoint_ns??"",H=f(J);if($===void 0)return;let Z=this.db.selectFrom("shallow_checkpoints").select(["thread_id","checkpoint_ns","checkpoint_id","parent_checkpoint_id","type","checkpoint","metadata","checkpoint_ts",A`(
38
- SELECT json_group_array(
39
- json_object(
40
- 'task_id', pw.task_id,
41
- 'channel', pw.channel,
42
- 'type', pw.type,
43
- 'value', CAST(pw.value AS TEXT)
44
- )
45
- )
46
- FROM writes as pw
47
- WHERE pw.thread_id = shallow_checkpoints.thread_id
48
- AND pw.checkpoint_ns = shallow_checkpoints.checkpoint_ns
49
- AND pw.checkpoint_id = shallow_checkpoints.checkpoint_id
50
- )`.as("pending_writes"),A`(
51
- SELECT json_group_array(
52
- json_object(
53
- 'type', ps.type,
54
- 'value', CAST(ps.value AS TEXT)
55
- )
56
- )
57
- FROM writes as ps
58
- WHERE ps.thread_id = shallow_checkpoints.thread_id
59
- AND ps.checkpoint_ns = shallow_checkpoints.checkpoint_ns
60
- AND ps.checkpoint_id = shallow_checkpoints.parent_checkpoint_id
61
- AND ps.channel = ${Q}
62
- ORDER BY ps.idx
63
- )`.as("pending_sends")]).where("thread_id","=",$).where("checkpoint_ns","=",B);if(H)Z=Z.where("checkpoint_id","=",H);let U=await Z.executeTakeFirst();if(!U)return;if(H&&U.checkpoint_id!==H)return;let D=await Promise.all(JSON.parse(U.pending_writes||"[]").map(async(z)=>{return[z.task_id,z.channel,await this.serde.loadsTyped(z.type??"json",z.value??"")]})),X=await this.serde.loadsTyped(U.type??"json",new TextDecoder().decode(U.checkpoint));if(X.v<4&&U.parent_checkpoint_id!=null)await this.migratePendingSends(X,U.thread_id,U.parent_checkpoint_id);let W={configurable:{thread_id:U.thread_id,checkpoint_ns:U.checkpoint_ns,checkpoint_id:U.checkpoint_id}};return{checkpoint:X,config:W,metadata:await this.serde.loadsTyped(U.type??"json",new TextDecoder().decode(U.metadata)),parentConfig:U.parent_checkpoint_id?{configurable:{thread_id:U.thread_id,checkpoint_ns:U.checkpoint_ns,checkpoint_id:U.parent_checkpoint_id}}:void 0,pendingWrites:D}}async*list(J,$){await this.setup();let{limit:B,before:H,filter:Z}=$??{},U=J.configurable?.thread_id,D=J.configurable?.checkpoint_ns,X=this.db.selectFrom("shallow_checkpoints").select(["thread_id","checkpoint_ns","checkpoint_id","parent_checkpoint_id","type","checkpoint","metadata","checkpoint_ts",A`(
64
- SELECT json_group_array(
65
- json_object(
66
- 'task_id', pw.task_id,
67
- 'channel', pw.channel,
68
- 'type', pw.type,
69
- 'value', CAST(pw.value AS TEXT)
70
- )
71
- )
72
- FROM writes as pw
73
- WHERE pw.thread_id = shallow_checkpoints.thread_id
74
- AND pw.checkpoint_ns = shallow_checkpoints.checkpoint_ns
75
- AND pw.checkpoint_id = shallow_checkpoints.checkpoint_id
76
- )`.as("pending_writes")]);if(U)X=X.where("thread_id","=",U);if(D!==void 0&&D!==null)X=X.where("checkpoint_ns","=",D);if(H?.configurable?.checkpoint_id!==void 0)X=X.where("checkpoint_id","<",H.configurable.checkpoint_id);X=X.orderBy("checkpoint_ts","desc");let W=await X.execute(),z=0;for(let M of W){let V=await this.serde.loadsTyped(M.type??"json",new TextDecoder().decode(M.metadata));if(Z&&!this._checkMetadataFilterMatch(V,Z))continue;if(B!==void 0&&z>=B)return;let Y=await Promise.all(JSON.parse(M.pending_writes||"[]").map(async(F)=>{return[F.task_id,F.channel,await this.serde.loadsTyped(F.type??"json",F.value??"")]})),G=await this.serde.loadsTyped(M.type??"json",new TextDecoder().decode(M.checkpoint));if(G.v<4&&M.parent_checkpoint_id!=null)await this.migratePendingSends(G,M.thread_id,M.parent_checkpoint_id);z++,yield{config:{configurable:{thread_id:M.thread_id,checkpoint_ns:M.checkpoint_ns,checkpoint_id:M.checkpoint_id}},checkpoint:G,metadata:V,parentConfig:M.parent_checkpoint_id?{configurable:{thread_id:M.thread_id,checkpoint_ns:M.checkpoint_ns,checkpoint_id:M.parent_checkpoint_id}}:void 0,pendingWrites:Y}}}_checkMetadataFilterMatch(J,$){for(let[B,H]of Object.entries($)){let Z=J?.[B];if(H===null){if(!(B in(J||{}))||Z!==null)return!1}else if(typeof H==="object"&&!Array.isArray(H)){if(typeof Z!=="object"||Z===null)return!1;if(E(H)!==E(Z))return!1}else if(Z!==H)return!1}return!0}async put(J,$,B,H){await this.setup();let Z=J.configurable?.thread_id,U=J.configurable?.checkpoint_ns??"",D=J.configurable?.checkpoint_id;if(!Z)throw Error("thread_id is required");let X=$.id||R(0),W=b($),[[z,M],[V,Y]]=await Promise.all([this.serde.dumpsTyped(W),this.serde.dumpsTyped(B)]);if(z!==V)throw Error("Failed to serialize checkpoint and metadata to the same type.");let G=Z,F=U,P=X;return await T(async()=>{await this.db.transaction().execute(async(L)=>{let O=await L.selectFrom("shallow_checkpoints").select(["checkpoint_id"]).where("thread_id","=",G).where("checkpoint_ns","=",F).executeTakeFirst();if(O&&O.checkpoint_id!==P)await L.deleteFrom("writes").where("thread_id","=",G).where("checkpoint_ns","=",F).where("checkpoint_id","=",O.checkpoint_id).execute();await L.insertInto("shallow_checkpoints").values({thread_id:G,checkpoint_ns:F,checkpoint_id:P,parent_checkpoint_id:D??null,type:z,checkpoint:new Uint8Array(Buffer.from(M)),metadata:new Uint8Array(Buffer.from(Y)),checkpoint_ts:Date.now()}).onConflict((q)=>q.columns(["thread_id","checkpoint_ns"]).doUpdateSet({checkpoint_id:P,parent_checkpoint_id:D??null,type:z,checkpoint:new Uint8Array(Buffer.from(M)),metadata:new Uint8Array(Buffer.from(Y)),checkpoint_ts:Date.now()})).execute()})},`put(${Z}/${X})`),{configurable:{thread_id:Z,checkpoint_ns:U,checkpoint_id:X}}}async putWrites(J,$,B){await this.setup();let H=J.configurable?.thread_id,Z=J.configurable?.checkpoint_ns??"",U=J.configurable?.checkpoint_id;if(!H||!U)throw Error("thread_id and checkpoint_id are required");let D=await Promise.all($.map(async(X,W)=>{let[z,M]=await this.serde.dumpsTyped(X[1]);return{thread_id:H,checkpoint_ns:Z,checkpoint_id:U,task_id:B,idx:C[X[0]]??W,channel:X[0],type:z,value:new Uint8Array(Buffer.from(M))}}));if(D.length===0)return;await T(async()=>{await this.db.transaction().execute(async(X)=>{await X.deleteFrom("writes").where("thread_id","=",H).where("checkpoint_ns","=",Z).where("checkpoint_id","=",U).where("task_id","=",B).execute();for(let W of D)await X.insertInto("writes").values(W).execute()})},`putWrites(${H}/${U}/${B})`)}async deleteThread(J){await T(async()=>{await this.db.transaction().execute(async($)=>{await $.deleteFrom("shallow_checkpoints").where("thread_id","=",J).execute(),await $.deleteFrom("writes").where("thread_id","=",J).execute()})},`deleteThread(${J})`)}async migratePendingSends(J,$,B){let H=await this.db.selectFrom("writes as ps").select(["ps.checkpoint_id",A`json_group_array(
77
- json_object(
78
- 'type', ps.type,
79
- 'value', CAST(ps.value AS TEXT)
80
- )
81
- )`.as("pending_sends")]).where("ps.thread_id","=",$).where("ps.checkpoint_id","=",B).where("ps.channel","=",Q).orderBy("ps.idx").executeTakeFirst();if(!H)return;let Z=J;Z.channel_values??={},Z.channel_values[Q]=await Promise.all(JSON.parse(H.pending_sends||"[]").map(({type:U,value:D})=>this.serde.loadsTyped(U,D))),Z.channel_versions[Q]=Object.keys(J.channel_versions).length>0?_(...Object.values(J.channel_versions)):this.getNextVersion(void 0)}}export{N as SqliteShallowSaver};
@@ -1,18 +0,0 @@
1
- import{ri as h}from"./chunk-cbjnwrt7.js";import{pq as yw,qq as d,tq as t}from"./chunk-dcs1r9as.js";var G0=d((n1)=>{n1.isInteger=($)=>{if(typeof $==="number")return Number.isInteger($);if(typeof $==="string"&&$.trim()!=="")return Number.isInteger(Number($));return!1};n1.find=($,w)=>$.nodes.find((q)=>q.type===w);n1.exceedsLimit=($,w,q=1,J)=>{if(J===!1)return!1;if(!n1.isInteger($)||!n1.isInteger(w))return!1;return(Number(w)-Number($))/Number(q)>=J};n1.escapeNode=($,w=0,q)=>{let J=$.nodes[w];if(!J)return;if(q&&J.type===q||J.type==="open"||J.type==="close"){if(J.escaped!==!0)J.value="\\"+J.value,J.escaped=!0}};n1.encloseBrace=($)=>{if($.type!=="brace")return!1;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;return!1};n1.isInvalidBrace=($)=>{if($.type!=="brace")return!1;if($.invalid===!0||$.dollar)return!0;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;if($.open!==!0||$.close!==!0)return $.invalid=!0,!0;return!1};n1.isOpenOrClose=($)=>{if($.type==="open"||$.type==="close")return!0;return $.open===!0||$.close===!0};n1.reduce=($)=>$.reduce((w,q)=>{if(q.type==="text")w.push(q.value);if(q.type==="range")q.type="text";return w},[]);n1.flatten=(...$)=>{let w=[],q=(J)=>{for(let f=0;f<J.length;f++){let Z=J[f];if(Array.isArray(Z)){q(Z);continue}if(Z!==void 0)w.push(Z)}return w};return q($),w}});var M0=d((jw,v0)=>{var d0=G0();v0.exports=($,w={})=>{let q=(J,f={})=>{let Z=w.escapeInvalid&&d0.isInvalidBrace(f),V=J.invalid===!0&&w.escapeInvalid===!0,F="";if(J.value){if((Z||V)&&d0.isOpenOrClose(J))return"\\"+J.value;return J.value}if(J.value)return J.value;if(J.nodes)for(let N of J.nodes)F+=q(N);return F};return q($)}});var l0=d((zw,m0)=>{/*!
2
- * is-number <https://github.com/jonschlinkert/is-number>
3
- *
4
- * Copyright (c) 2014-present, Jon Schlinkert.
5
- * Released under the MIT License.
6
- */m0.exports=function($){if(typeof $==="number")return $-$===0;if(typeof $==="string"&&$.trim()!=="")return Number.isFinite?Number.isFinite(+$):isFinite(+$);return!1}});var e0=d((Iw,s0)=>{/*!
7
- * to-regex-range <https://github.com/micromatch/to-regex-range>
8
- *
9
- * Copyright (c) 2015-present, Jon Schlinkert.
10
- * Released under the MIT License.
11
- */var u0=l0(),q0=($,w,q)=>{if(u0($)===!1)throw TypeError("toRegexRange: expected the first argument to be a number");if(w===void 0||$===w)return String($);if(u0(w)===!1)throw TypeError("toRegexRange: expected the second argument to be a number.");let J={relaxZeros:!0,...q};if(typeof J.strictZeros==="boolean")J.relaxZeros=J.strictZeros===!1;let f=String(J.relaxZeros),Z=String(J.shorthand),V=String(J.capture),F=String(J.wrap),N=$+":"+w+"="+f+Z+V+F;if(q0.cache.hasOwnProperty(N))return q0.cache[N].result;let K=Math.min($,w),B=Math.max($,w);if(Math.abs(K-B)===1){let M=$+"|"+w;if(J.capture)return`(${M})`;if(J.wrap===!1)return M;return`(?:${M})`}let j=a0($)||a0(w),X={min:$,max:w,a:K,b:B},H=[],y=[];if(j)X.isPadded=j,X.maxLen=String(X.max).length;if(K<0){let M=B<0?Math.abs(B):1;y=c0(M,Math.abs(K),X,J),K=X.a=0}if(B>=0)H=c0(K,B,X,J);if(X.negatives=y,X.positives=H,X.result=q$(y,H,J),J.capture===!0)X.result=`(${X.result})`;else if(J.wrap!==!1&&H.length+y.length>1)X.result=`(?:${X.result})`;return q0.cache[N]=X,X.result};function q$($,w,q){let J=P0($,w,"-",!1,q)||[],f=P0(w,$,"",!1,q)||[],Z=P0($,w,"-?",!0,q)||[];return J.concat(Z).concat(f).join("|")}function J$($,w){let q=1,J=1,f=i0($,q),Z=new Set([w]);while($<=f&&f<=w)Z.add(f),q+=1,f=i0($,q);f=n0(w+1,J)-1;while($<f&&f<=w)Z.add(f),J+=1,f=n0(w+1,J)-1;return Z=[...Z],Z.sort(Z$),Z}function f$($,w,q){if($===w)return{pattern:$,count:[],digits:0};let J=V$($,w),f=J.length,Z="",V=0;for(let F=0;F<f;F++){let[N,K]=J[F];if(N===K)Z+=N;else if(N!=="0"||K!=="9")Z+=Y$(N,K,q);else V++}if(V)Z+=q.shorthand===!0?"\\d":"[0-9]";return{pattern:Z,count:[V],digits:f}}function c0($,w,q,J){let f=J$($,w),Z=[],V=$,F;for(let N=0;N<f.length;N++){let K=f[N],B=f$(String(V),String(K),J),j="";if(!q.isPadded&&F&&F.pattern===B.pattern){if(F.count.length>1)F.count.pop();F.count.push(B.count[0]),F.string=F.pattern+p0(F.count),V=K+1;continue}if(q.isPadded)j=W$(K,q,J);B.string=j+B.pattern+p0(B.count),Z.push(B),V=K+1,F=B}return Z}function P0($,w,q,J,f){let Z=[];for(let V of $){let{string:F}=V;if(!J&&!r0(w,"string",F))Z.push(q+F);if(J&&r0(w,"string",F))Z.push(q+F)}return Z}function V$($,w){let q=[];for(let J=0;J<$.length;J++)q.push([$[J],w[J]]);return q}function Z$($,w){return $>w?1:w>$?-1:0}function r0($,w,q){return $.some((J)=>J[w]===q)}function i0($,w){return Number(String($).slice(0,-w)+"9".repeat(w))}function n0($,w){return $-$%Math.pow(10,w)}function p0($){let[w=0,q=""]=$;if(q||w>1)return`{${w+(q?","+q:"")}}`;return""}function Y$($,w,q){return`[${$}${w-$===1?"":"-"}${w}]`}function a0($){return/^-?(0+)\d/.test($)}function W$($,w,q){if(!w.isPadded)return $;let J=Math.abs(w.maxLen-String($).length),f=q.relaxZeros!==!1;switch(J){case 0:return"";case 1:return f?"0?":"0";case 2:return f?"0{0,2}":"00";default:return f?`0{0,${J}}`:`0{${J}}`}}q0.cache={};q0.clearCache=()=>q0.cache={};s0.exports=q0});var E0=d((Cw,f1)=>{/*!
12
- * fill-range <https://github.com/jonschlinkert/fill-range>
13
- *
14
- * Copyright (c) 2014-present, Jon Schlinkert.
15
- * Licensed under the MIT License.
16
- */var F$=t("util"),t0=e0(),o0=($)=>$!==null&&typeof $==="object"&&!Array.isArray($),U$=($)=>{return(w)=>$===!0?Number(w):String(w)},L0=($)=>{return typeof $==="number"||typeof $==="string"&&$!==""},Y0=($)=>Number.isInteger(+$),O0=($)=>{let w=`${$}`,q=-1;if(w[0]==="-")w=w.slice(1);if(w==="0")return!1;while(w[++q]==="0");return q>0},X$=($,w,q)=>{if(typeof $==="string"||typeof w==="string")return!0;return q.stringify===!0},Q$=($,w,q)=>{if(w>0){let J=$[0]==="-"?"-":"";if(J)$=$.slice(1);$=J+$.padStart(J?w-1:w,"0")}if(q===!1)return String($);return $},K0=($,w)=>{let q=$[0]==="-"?"-":"";if(q)$=$.slice(1),w--;while($.length<w)$="0"+$;return q?"-"+$:$},B$=($,w,q)=>{$.negatives.sort((F,N)=>F<N?-1:F>N?1:0),$.positives.sort((F,N)=>F<N?-1:F>N?1:0);let J=w.capture?"":"?:",f="",Z="",V;if($.positives.length)f=$.positives.map((F)=>K0(String(F),q)).join("|");if($.negatives.length)Z=`-(${J}${$.negatives.map((F)=>K0(String(F),q)).join("|")})`;if(f&&Z)V=`${f}|${Z}`;else V=f||Z;if(w.wrap)return`(${J}${V})`;return V},$1=($,w,q,J)=>{if(q)return t0($,w,{wrap:!1,...J});let f=String.fromCharCode($);if($===w)return f;let Z=String.fromCharCode(w);return`[${f}-${Z}]`},w1=($,w,q)=>{if(Array.isArray($)){let J=q.wrap===!0,f=q.capture?"":"?:";return J?`(${f}${$.join("|")})`:$.join("|")}return t0($,w,q)},q1=(...$)=>{return RangeError("Invalid range arguments: "+F$.inspect(...$))},J1=($,w,q)=>{if(q.strictRanges===!0)throw q1([$,w]);return[]},N$=($,w)=>{if(w.strictRanges===!0)throw TypeError(`Expected step "${$}" to be a number`);return[]},G$=($,w,q=1,J={})=>{let f=Number($),Z=Number(w);if(!Number.isInteger(f)||!Number.isInteger(Z)){if(J.strictRanges===!0)throw q1([$,w]);return[]}if(f===0)f=0;if(Z===0)Z=0;let V=f>Z,F=String($),N=String(w),K=String(q);q=Math.max(Math.abs(q),1);let B=O0(F)||O0(N)||O0(K),j=B?Math.max(F.length,N.length,K.length):0,X=B===!1&&X$($,w,J)===!1,H=J.transform||U$(X);if(J.toRegex&&q===1)return $1(K0($,j),K0(w,j),!0,J);let y={negatives:[],positives:[]},M=(u)=>y[u<0?"negatives":"positives"].push(Math.abs(u)),L=[],A=0;while(V?f>=Z:f<=Z){if(J.toRegex===!0&&q>1)M(f);else L.push(Q$(H(f,A),j,X));f=V?f-q:f+q,A++}if(J.toRegex===!0)return q>1?B$(y,J,j):w1(L,null,{wrap:!1,...J});return L},M$=($,w,q=1,J={})=>{if(!Y0($)&&$.length>1||!Y0(w)&&w.length>1)return J1($,w,J);let f=J.transform||((X)=>String.fromCharCode(X)),Z=`${$}`.charCodeAt(0),V=`${w}`.charCodeAt(0),F=Z>V,N=Math.min(Z,V),K=Math.max(Z,V);if(J.toRegex&&q===1)return $1(N,K,!1,J);let B=[],j=0;while(F?Z>=V:Z<=V)B.push(f(Z,j)),Z=F?Z-q:Z+q,j++;if(J.toRegex===!0)return w1(B,null,{wrap:!1,options:J});return B},y0=($,w,q,J={})=>{if(w==null&&L0($))return[$];if(!L0($)||!L0(w))return J1($,w,J);if(typeof q==="function")return y0($,w,1,{transform:q});if(o0(q))return y0($,w,0,q);let f={...J};if(f.capture===!0)f.wrap=!0;if(q=q||f.step||1,!Y0(q)){if(q!=null&&!o0(q))return N$(q,f);return y0($,w,1,q)}if(Y0($)&&Y0(w))return G$($,w,q,f);return M$($,w,Math.max(Math.abs(q),1),f)};f1.exports=y0});var Y1=d((Dw,Z1)=>{var y$=E0(),V1=G0(),K$=($,w={})=>{let q=(J,f={})=>{let Z=V1.isInvalidBrace(f),V=J.invalid===!0&&w.escapeInvalid===!0,F=Z===!0||V===!0,N=w.escapeInvalid===!0?"\\":"",K="";if(J.isOpen===!0)return N+J.value;if(J.isClose===!0)return console.log("node.isClose",N,J.value),N+J.value;if(J.type==="open")return F?N+J.value:"(";if(J.type==="close")return F?N+J.value:")";if(J.type==="comma")return J.prev.type==="comma"?"":F?J.value:"|";if(J.value)return J.value;if(J.nodes&&J.ranges>0){let B=V1.reduce(J.nodes),j=y$(...B,{...w,wrap:!1,toRegex:!0,strictZeros:!0});if(j.length!==0)return B.length>1&&j.length>1?`(${j})`:j}if(J.nodes)for(let B of J.nodes)K+=q(B,J);return K};return q($)};Z1.exports=K$});var U1=d((Hw,F1)=>{var j$=E0(),W1=M0(),V0=G0(),J0=($="",w="",q=!1)=>{let J=[];if($=[].concat($),w=[].concat(w),!w.length)return $;if(!$.length)return q?V0.flatten(w).map((f)=>`{${f}}`):w;for(let f of $)if(Array.isArray(f))for(let Z of f)J.push(J0(Z,w,q));else for(let Z of w){if(q===!0&&typeof Z==="string")Z=`{${Z}}`;J.push(Array.isArray(Z)?J0(f,Z,q):f+Z)}return V0.flatten(J)},z$=($,w={})=>{let q=w.rangeLimit===void 0?1000:w.rangeLimit,J=(f,Z={})=>{f.queue=[];let V=Z,F=Z.queue;while(V.type!=="brace"&&V.type!=="root"&&V.parent)V=V.parent,F=V.queue;if(f.invalid||f.dollar){F.push(J0(F.pop(),W1(f,w)));return}if(f.type==="brace"&&f.invalid!==!0&&f.nodes.length===2){F.push(J0(F.pop(),["{}"]));return}if(f.nodes&&f.ranges>0){let j=V0.reduce(f.nodes);if(V0.exceedsLimit(...j,w.step,q))throw RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let X=j$(...j,w);if(X.length===0)X=W1(f,w);F.push(J0(F.pop(),X)),f.nodes=[];return}let N=V0.encloseBrace(f),K=f.queue,B=f;while(B.type!=="brace"&&B.type!=="root"&&B.parent)B=B.parent,K=B.queue;for(let j=0;j<f.nodes.length;j++){let X=f.nodes[j];if(X.type==="comma"&&f.type==="brace"){if(j===1)K.push("");K.push("");continue}if(X.type==="close"){F.push(J0(F.pop(),K,N));continue}if(X.value&&X.type!=="open"){K.push(J0(K.pop(),X.value));continue}if(X.nodes)J(X,f)}return K};return V0.flatten(J($))};F1.exports=z$});var Q1=d((Pw,X1)=>{X1.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
17
- `,CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var y1=d((Lw,M1)=>{var I$=M0(),{MAX_LENGTH:B1,CHAR_BACKSLASH:R0,CHAR_BACKTICK:C$,CHAR_COMMA:D$,CHAR_DOT:H$,CHAR_LEFT_PARENTHESES:P$,CHAR_RIGHT_PARENTHESES:L$,CHAR_LEFT_CURLY_BRACE:O$,CHAR_RIGHT_CURLY_BRACE:E$,CHAR_LEFT_SQUARE_BRACKET:N1,CHAR_RIGHT_SQUARE_BRACKET:G1,CHAR_DOUBLE_QUOTE:R$,CHAR_SINGLE_QUOTE:_$,CHAR_NO_BREAK_SPACE:T$,CHAR_ZERO_WIDTH_NOBREAK_SPACE:A$}=Q1(),S$=($,w={})=>{if(typeof $!=="string")throw TypeError("Expected a string");let q=w||{},J=typeof q.maxLength==="number"?Math.min(B1,q.maxLength):B1;if($.length>J)throw SyntaxError(`Input length (${$.length}), exceeds max characters (${J})`);let f={type:"root",input:$,nodes:[]},Z=[f],V=f,F=f,N=0,K=$.length,B=0,j=0,X,H=()=>$[B++],y=(M)=>{if(M.type==="text"&&F.type==="dot")F.type="text";if(F&&F.type==="text"&&M.type==="text"){F.value+=M.value;return}return V.nodes.push(M),M.parent=V,M.prev=F,F=M,M};y({type:"bos"});while(B<K){if(V=Z[Z.length-1],X=H(),X===A$||X===T$)continue;if(X===R0){y({type:"text",value:(w.keepEscaping?X:"")+H()});continue}if(X===G1){y({type:"text",value:"\\"+X});continue}if(X===N1){N++;let M;while(B<K&&(M=H())){if(X+=M,M===N1){N++;continue}if(M===R0){X+=H();continue}if(M===G1){if(N--,N===0)break}}y({type:"text",value:X});continue}if(X===P$){V=y({type:"paren",nodes:[]}),Z.push(V),y({type:"text",value:X});continue}if(X===L$){if(V.type!=="paren"){y({type:"text",value:X});continue}V=Z.pop(),y({type:"text",value:X}),V=Z[Z.length-1];continue}if(X===R$||X===_$||X===C$){let M=X,L;if(w.keepQuotes!==!0)X="";while(B<K&&(L=H())){if(L===R0){X+=L+H();continue}if(L===M){if(w.keepQuotes===!0)X+=L;break}X+=L}y({type:"text",value:X});continue}if(X===O$){j++;let L={type:"brace",open:!0,close:!1,dollar:F.value&&F.value.slice(-1)==="$"||V.dollar===!0,depth:j,commas:0,ranges:0,nodes:[]};V=y(L),Z.push(V),y({type:"open",value:X});continue}if(X===E$){if(V.type!=="brace"){y({type:"text",value:X});continue}let M="close";V=Z.pop(),V.close=!0,y({type:M,value:X}),j--,V=Z[Z.length-1];continue}if(X===D$&&j>0){if(V.ranges>0){V.ranges=0;let M=V.nodes.shift();V.nodes=[M,{type:"text",value:I$(V)}]}y({type:"comma",value:X}),V.commas++;continue}if(X===H$&&j>0&&V.commas===0){let M=V.nodes;if(j===0||M.length===0){y({type:"text",value:X});continue}if(F.type==="dot"){if(V.range=[],F.value+=X,F.type="range",V.nodes.length!==3&&V.nodes.length!==5){V.invalid=!0,V.ranges=0,F.type="text";continue}V.ranges++,V.args=[];continue}if(F.type==="range"){M.pop();let L=M[M.length-1];L.value+=F.value+X,F=L,V.ranges--;continue}y({type:"dot",value:X});continue}y({type:"text",value:X})}do if(V=Z.pop(),V.type!=="root"){V.nodes.forEach((A)=>{if(!A.nodes){if(A.type==="open")A.isOpen=!0;if(A.type==="close")A.isClose=!0;if(!A.nodes)A.type="text";A.invalid=!0}});let M=Z[Z.length-1],L=M.nodes.indexOf(V);M.nodes.splice(L,1,...V.nodes)}while(Z.length>0);return y({type:"eos"}),f};M1.exports=S$});var z1=d((Ow,j1)=>{var K1=M0(),x$=Y1(),g$=U1(),h$=y1(),r=($,w={})=>{let q=[];if(Array.isArray($))for(let J of $){let f=r.create(J,w);if(Array.isArray(f))q.push(...f);else q.push(f)}else q=[].concat(r.create($,w));if(w&&w.expand===!0&&w.nodupes===!0)q=[...new Set(q)];return q};r.parse=($,w={})=>h$($,w);r.stringify=($,w={})=>{if(typeof $==="string")return K1(r.parse($,w),w);return K1($,w)};r.compile=($,w={})=>{if(typeof $==="string")$=r.parse($,w);return x$($,w)};r.expand=($,w={})=>{if(typeof $==="string")$=r.parse($,w);let q=g$($,w);if(w.noempty===!0)q=q.filter(Boolean);if(w.nodupes===!0)q=[...new Set(q)];return q};r.create=($,w={})=>{if($===""||$.length<3)return[$];return w.expand!==!0?r.compile($,w):r.expand($,w)};j1.exports=r});var W0=d((Ew,C1)=>{var k$=t("path"),I1={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)"},b$={...I1,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"},d$={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};C1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:d$,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:k$.sep,extglobChars($){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${$.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars($){return $===!0?b$:I1}}});var F0=d((i$)=>{var v$=t("path"),m$=process.platform==="win32",{REGEX_BACKSLASH:l$,REGEX_REMOVE_BACKSLASH:u$,REGEX_SPECIAL_CHARS:c$,REGEX_SPECIAL_CHARS_GLOBAL:r$}=W0();i$.isObject=($)=>$!==null&&typeof $==="object"&&!Array.isArray($);i$.hasRegexChars=($)=>c$.test($);i$.isRegexChar=($)=>$.length===1&&i$.hasRegexChars($);i$.escapeRegex=($)=>$.replace(r$,"\\$1");i$.toPosixSlashes=($)=>$.replace(l$,"/");i$.removeBackslashes=($)=>{return $.replace(u$,(w)=>{return w==="\\"?"":w})};i$.supportsLookbehinds=()=>{let $=process.version.slice(1).split(".").map(Number);if($.length===3&&$[0]>=9||$[0]===8&&$[1]>=10)return!0;return!1};i$.isWindows=($)=>{if($&&typeof $.windows==="boolean")return $.windows;return m$===!0||v$.sep==="\\"};i$.escapeLast=($,w,q)=>{let J=$.lastIndexOf(w,q);if(J===-1)return $;if($[J-1]==="\\")return i$.escapeLast($,w,J-1);return`${$.slice(0,J)}\\${$.slice(J)}`};i$.removePrefix=($,w={})=>{let q=$;if(q.startsWith("./"))q=q.slice(2),w.prefix="./";return q};i$.wrapOutput=($,w={},q={})=>{let J=q.contains?"":"^",f=q.contains?"":"$",Z=`${J}(?:${$})${f}`;if(w.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z}});var A1=d((_w,T1)=>{var P1=F0(),{CHAR_ASTERISK:_0,CHAR_AT:qw,CHAR_BACKWARD_SLASH:U0,CHAR_COMMA:Jw,CHAR_DOT:T0,CHAR_EXCLAMATION_MARK:A0,CHAR_FORWARD_SLASH:_1,CHAR_LEFT_CURLY_BRACE:S0,CHAR_LEFT_PARENTHESES:x0,CHAR_LEFT_SQUARE_BRACKET:fw,CHAR_PLUS:Vw,CHAR_QUESTION_MARK:L1,CHAR_RIGHT_CURLY_BRACE:Zw,CHAR_RIGHT_PARENTHESES:O1,CHAR_RIGHT_SQUARE_BRACKET:Yw}=W0(),E1=($)=>{return $===_1||$===U0},R1=($)=>{if($.isPrefix!==!0)$.depth=$.isGlobstar?1/0:1},Ww=($,w)=>{let q=w||{},J=$.length-1,f=q.parts===!0||q.scanToEnd===!0,Z=[],V=[],F=[],N=$,K=-1,B=0,j=0,X=!1,H=!1,y=!1,M=!1,L=!1,A=!1,u=!1,S=!1,n=!1,b=!1,e=0,v,z,P={value:"",depth:0,isGlob:!1},k=()=>K>=J,U=()=>N.charCodeAt(K+1),_=()=>{return v=z,N.charCodeAt(++K)};while(K<J){z=_();let m;if(z===U0){if(u=P.backslashes=!0,z=_(),z===S0)A=!0;continue}if(A===!0||z===S0){e++;while(k()!==!0&&(z=_())){if(z===U0){u=P.backslashes=!0,_();continue}if(z===S0){e++;continue}if(A!==!0&&z===T0&&(z=_())===T0){if(X=P.isBrace=!0,y=P.isGlob=!0,b=!0,f===!0)continue;break}if(A!==!0&&z===Jw){if(X=P.isBrace=!0,y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===Zw){if(e--,e===0){A=!1,X=P.isBrace=!0,b=!0;break}}}if(f===!0)continue;break}if(z===_1){if(Z.push(K),V.push(P),P={value:"",depth:0,isGlob:!1},b===!0)continue;if(v===T0&&K===B+1){B+=2;continue}j=K+1;continue}if(q.noext!==!0){if((z===Vw||z===qw||z===_0||z===L1||z===A0)===!0&&U()===x0){if(y=P.isGlob=!0,M=P.isExtglob=!0,b=!0,z===A0&&K===B)n=!0;if(f===!0){while(k()!==!0&&(z=_())){if(z===U0){u=P.backslashes=!0,z=_();continue}if(z===O1){y=P.isGlob=!0,b=!0;break}}continue}break}}if(z===_0){if(v===_0)L=P.isGlobstar=!0;if(y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===L1){if(y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===fw){while(k()!==!0&&(m=_())){if(m===U0){u=P.backslashes=!0,_();continue}if(m===Yw){H=P.isBracket=!0,y=P.isGlob=!0,b=!0;break}}if(f===!0)continue;break}if(q.nonegate!==!0&&z===A0&&K===B){S=P.negated=!0,B++;continue}if(q.noparen!==!0&&z===x0){if(y=P.isGlob=!0,f===!0){while(k()!==!0&&(z=_())){if(z===x0){u=P.backslashes=!0,z=_();continue}if(z===O1){b=!0;break}}continue}break}if(y===!0){if(b=!0,f===!0)continue;break}}if(q.noext===!0)M=!1,y=!1;let O=N,o="",Y="";if(B>0)o=N.slice(0,B),N=N.slice(B),j-=B;if(O&&y===!0&&j>0)O=N.slice(0,j),Y=N.slice(j);else if(y===!0)O="",Y=N;else O=N;if(O&&O!==""&&O!=="/"&&O!==N){if(E1(O.charCodeAt(O.length-1)))O=O.slice(0,-1)}if(q.unescape===!0){if(Y)Y=P1.removeBackslashes(Y);if(O&&u===!0)O=P1.removeBackslashes(O)}let W={prefix:o,input:$,start:B,base:O,glob:Y,isBrace:X,isBracket:H,isGlob:y,isExtglob:M,isGlobstar:L,negated:S,negatedExtglob:n};if(q.tokens===!0){if(W.maxDepth=0,!E1(z))V.push(P);W.tokens=V}if(q.parts===!0||q.tokens===!0){let m;for(let D=0;D<Z.length;D++){let p=m?m+1:B,a=Z[D],c=$.slice(p,a);if(q.tokens){if(D===0&&B!==0)V[D].isPrefix=!0,V[D].value=o;else V[D].value=c;R1(V[D]),W.maxDepth+=V[D].depth}if(D!==0||c!=="")F.push(c);m=a}if(m&&m+1<$.length){let D=$.slice(m+1);if(F.push(D),q.tokens)V[V.length-1].value=D,R1(V[V.length-1]),W.maxDepth+=V[V.length-1].depth}W.slashes=Z,W.parts=F}return W};T1.exports=Ww});var g1=d((Tw,x1)=>{var j0=W0(),i=F0(),{MAX_LENGTH:z0,POSIX_REGEX_SOURCE:Fw,REGEX_NON_SPECIAL_CHARS:Uw,REGEX_SPECIAL_CHARS_BACKREF:Xw,REPLACEMENTS:S1}=j0,Qw=($,w)=>{if(typeof w.expandRange==="function")return w.expandRange(...$,w);$.sort();let q=`[${$.join("-")}]`;try{new RegExp(q)}catch(J){return $.map((f)=>i.escapeRegex(f)).join("..")}return q},Z0=($,w)=>{return`Missing ${$}: "${w}" - use "\\\\${w}" to match literal characters`},g0=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");$=S1[$]||$;let q={...w},J=typeof q.maxLength==="number"?Math.min(z0,q.maxLength):z0,f=$.length;if(f>J)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${J}`);let Z={type:"bos",value:"",output:q.prepend||""},V=[Z],F=q.capture?"":"?:",N=i.isWindows(w),K=j0.globChars(N),B=j0.extglobChars(K),{DOT_LITERAL:j,PLUS_LITERAL:X,SLASH_LITERAL:H,ONE_CHAR:y,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:u,QMARK:S,QMARK_NO_DOT:n,STAR:b,START_ANCHOR:e}=K,v=(G)=>{return`(${F}(?:(?!${e}${G.dot?M:j}).)*?)`},z=q.dot?"":L,P=q.dot?S:n,k=q.bash===!0?v(q):b;if(q.capture)k=`(${k})`;if(typeof q.noext==="boolean")q.noextglob=q.noext;let U={input:$,index:-1,start:0,dot:q.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};$=i.removePrefix($,U),f=$.length;let _=[],O=[],o=[],Y=Z,W,m=()=>U.index===f-1,D=U.peek=(G=1)=>$[U.index+G],p=U.advance=()=>$[++U.index]||"",a=()=>$.slice(U.index+1),c=(G="",E=0)=>{U.consumed+=G,U.index+=E},X0=(G)=>{U.output+=G.output!=null?G.output:G.value,c(G.value)},r1=()=>{let G=1;while(D()==="!"&&(D(2)!=="("||D(3)==="?"))p(),U.start++,G++;if(G%2===0)return!1;return U.negated=!0,U.start++,!0},Q0=(G)=>{U[G]++,o.push(G)},w0=(G)=>{U[G]--,o.pop()},C=(G)=>{if(Y.type==="globstar"){let E=U.braces>0&&(G.type==="comma"||G.type==="brace"),Q=G.extglob===!0||_.length&&(G.type==="pipe"||G.type==="paren");if(G.type!=="slash"&&G.type!=="paren"&&!E&&!Q)U.output=U.output.slice(0,-Y.output.length),Y.type="star",Y.value="*",Y.output=k,U.output+=Y.output}if(_.length&&G.type!=="paren")_[_.length-1].inner+=G.value;if(G.value||G.output)X0(G);if(Y&&Y.type==="text"&&G.type==="text"){Y.value+=G.value,Y.output=(Y.output||"")+G.value;return}G.prev=Y,V.push(G),Y=G},B0=(G,E)=>{let Q={...B[E],conditions:1,inner:""};Q.prev=Y,Q.parens=U.parens,Q.output=U.output;let I=(q.capture?"(":"")+Q.open;Q0("parens"),C({type:G,value:E,output:U.output?"":y}),C({type:"paren",extglob:!0,value:p(),output:I}),_.push(Q)},i1=(G)=>{let E=G.close+(q.capture?")":""),Q;if(G.type==="negate"){let I=k;if(G.inner&&G.inner.length>1&&G.inner.includes("/"))I=v(q);if(I!==k||m()||/^\)+$/.test(a()))E=G.close=`)$))${I}`;if(G.inner.includes("*")&&(Q=a())&&/^\.[^\\/.]+$/.test(Q)){let T=g0(Q,{...w,fastpaths:!1}).output;E=G.close=`)${T})${I})`}if(G.prev.type==="bos")U.negatedExtglob=!0}C({type:"paren",extglob:!0,value:W,output:E}),w0("parens")};if(q.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test($)){let G=!1,E=$.replace(Xw,(Q,I,T,l,g,D0)=>{if(l==="\\")return G=!0,Q;if(l==="?"){if(I)return I+l+(g?S.repeat(g.length):"");if(D0===0)return P+(g?S.repeat(g.length):"");return S.repeat(T.length)}if(l===".")return j.repeat(T.length);if(l==="*"){if(I)return I+l+(g?k:"");return k}return I?Q:`\\${Q}`});if(G===!0)if(q.unescape===!0)E=E.replace(/\\/g,"");else E=E.replace(/\\+/g,(Q)=>{return Q.length%2===0?"\\\\":Q?"\\":""});if(E===$&&q.contains===!0)return U.output=$,U;return U.output=i.wrapOutput(E,U,w),U}while(!m()){if(W=p(),W==="\x00")continue;if(W==="\\"){let Q=D();if(Q==="/"&&q.bash!==!0)continue;if(Q==="."||Q===";")continue;if(!Q){W+="\\",C({type:"text",value:W});continue}let I=/^\\+/.exec(a()),T=0;if(I&&I[0].length>2){if(T=I[0].length,U.index+=T,T%2!==0)W+="\\"}if(q.unescape===!0)W=p();else W+=p();if(U.brackets===0){C({type:"text",value:W});continue}}if(U.brackets>0&&(W!=="]"||Y.value==="["||Y.value==="[^")){if(q.posix!==!1&&W===":"){let Q=Y.value.slice(1);if(Q.includes("[")){if(Y.posix=!0,Q.includes(":")){let I=Y.value.lastIndexOf("["),T=Y.value.slice(0,I),l=Y.value.slice(I+2),g=Fw[l];if(g){if(Y.value=T+g,U.backtrack=!0,p(),!Z.output&&V.indexOf(Y)===1)Z.output=y;continue}}}}if(W==="["&&D()!==":"||W==="-"&&D()==="]")W=`\\${W}`;if(W==="]"&&(Y.value==="["||Y.value==="[^"))W=`\\${W}`;if(q.posix===!0&&W==="!"&&Y.value==="[")W="^";Y.value+=W,X0({value:W});continue}if(U.quotes===1&&W!=='"'){W=i.escapeRegex(W),Y.value+=W,X0({value:W});continue}if(W==='"'){if(U.quotes=U.quotes===1?0:1,q.keepQuotes===!0)C({type:"text",value:W});continue}if(W==="("){Q0("parens"),C({type:"paren",value:W});continue}if(W===")"){if(U.parens===0&&q.strictBrackets===!0)throw SyntaxError(Z0("opening","("));let Q=_[_.length-1];if(Q&&U.parens===Q.parens+1){i1(_.pop());continue}C({type:"paren",value:W,output:U.parens?")":"\\)"}),w0("parens");continue}if(W==="["){if(q.nobracket===!0||!a().includes("]")){if(q.nobracket!==!0&&q.strictBrackets===!0)throw SyntaxError(Z0("closing","]"));W=`\\${W}`}else Q0("brackets");C({type:"bracket",value:W});continue}if(W==="]"){if(q.nobracket===!0||Y&&Y.type==="bracket"&&Y.value.length===1){C({type:"text",value:W,output:`\\${W}`});continue}if(U.brackets===0){if(q.strictBrackets===!0)throw SyntaxError(Z0("opening","["));C({type:"text",value:W,output:`\\${W}`});continue}w0("brackets");let Q=Y.value.slice(1);if(Y.posix!==!0&&Q[0]==="^"&&!Q.includes("/"))W=`/${W}`;if(Y.value+=W,X0({value:W}),q.literalBrackets===!1||i.hasRegexChars(Q))continue;let I=i.escapeRegex(Y.value);if(U.output=U.output.slice(0,-Y.value.length),q.literalBrackets===!0){U.output+=I,Y.value=I;continue}Y.value=`(${F}${I}|${Y.value})`,U.output+=Y.value;continue}if(W==="{"&&q.nobrace!==!0){Q0("braces");let Q={type:"brace",value:W,output:"(",outputIndex:U.output.length,tokensIndex:U.tokens.length};O.push(Q),C(Q);continue}if(W==="}"){let Q=O[O.length-1];if(q.nobrace===!0||!Q){C({type:"text",value:W,output:W});continue}let I=")";if(Q.dots===!0){let T=V.slice(),l=[];for(let g=T.length-1;g>=0;g--){if(V.pop(),T[g].type==="brace")break;if(T[g].type!=="dots")l.unshift(T[g].value)}I=Qw(l,q),U.backtrack=!0}if(Q.comma!==!0&&Q.dots!==!0){let T=U.output.slice(0,Q.outputIndex),l=U.tokens.slice(Q.tokensIndex);Q.value=Q.output="\\{",W=I="\\}",U.output=T;for(let g of l)U.output+=g.output||g.value}C({type:"brace",value:W,output:I}),w0("braces"),O.pop();continue}if(W==="|"){if(_.length>0)_[_.length-1].conditions++;C({type:"text",value:W});continue}if(W===","){let Q=W,I=O[O.length-1];if(I&&o[o.length-1]==="braces")I.comma=!0,Q="|";C({type:"comma",value:W,output:Q});continue}if(W==="/"){if(Y.type==="dot"&&U.index===U.start+1){U.start=U.index+1,U.consumed="",U.output="",V.pop(),Y=Z;continue}C({type:"slash",value:W,output:H});continue}if(W==="."){if(U.braces>0&&Y.type==="dot"){if(Y.value===".")Y.output=j;let Q=O[O.length-1];Y.type="dots",Y.output+=W,Y.value+=W,Q.dots=!0;continue}if(U.braces+U.parens===0&&Y.type!=="bos"&&Y.type!=="slash"){C({type:"text",value:W,output:j});continue}C({type:"dot",value:W,output:j});continue}if(W==="?"){if(!(Y&&Y.value==="(")&&q.noextglob!==!0&&D()==="("&&D(2)!=="?"){B0("qmark",W);continue}if(Y&&Y.type==="paren"){let I=D(),T=W;if(I==="<"&&!i.supportsLookbehinds())throw Error("Node.js v10 or higher is required for regex lookbehinds");if(Y.value==="("&&!/[!=<:]/.test(I)||I==="<"&&!/<([!=]|\w+>)/.test(a()))T=`\\${W}`;C({type:"text",value:W,output:T});continue}if(q.dot!==!0&&(Y.type==="slash"||Y.type==="bos")){C({type:"qmark",value:W,output:n});continue}C({type:"qmark",value:W,output:S});continue}if(W==="!"){if(q.noextglob!==!0&&D()==="("){if(D(2)!=="?"||!/[!=<:]/.test(D(3))){B0("negate",W);continue}}if(q.nonegate!==!0&&U.index===0){r1();continue}}if(W==="+"){if(q.noextglob!==!0&&D()==="("&&D(2)!=="?"){B0("plus",W);continue}if(Y&&Y.value==="("||q.regex===!1){C({type:"plus",value:W,output:X});continue}if(Y&&(Y.type==="bracket"||Y.type==="paren"||Y.type==="brace")||U.parens>0){C({type:"plus",value:W});continue}C({type:"plus",value:X});continue}if(W==="@"){if(q.noextglob!==!0&&D()==="("&&D(2)!=="?"){C({type:"at",extglob:!0,value:W,output:""});continue}C({type:"text",value:W});continue}if(W!=="*"){if(W==="$"||W==="^")W=`\\${W}`;let Q=Uw.exec(a());if(Q)W+=Q[0],U.index+=Q[0].length;C({type:"text",value:W});continue}if(Y&&(Y.type==="globstar"||Y.star===!0)){Y.type="star",Y.star=!0,Y.value+=W,Y.output=k,U.backtrack=!0,U.globstar=!0,c(W);continue}let G=a();if(q.noextglob!==!0&&/^\([^?]/.test(G)){B0("star",W);continue}if(Y.type==="star"){if(q.noglobstar===!0){c(W);continue}let Q=Y.prev,I=Q.prev,T=Q.type==="slash"||Q.type==="bos",l=I&&(I.type==="star"||I.type==="globstar");if(q.bash===!0&&(!T||G[0]&&G[0]!=="/")){C({type:"star",value:W,output:""});continue}let g=U.braces>0&&(Q.type==="comma"||Q.type==="brace"),D0=_.length&&(Q.type==="pipe"||Q.type==="paren");if(!T&&Q.type!=="paren"&&!g&&!D0){C({type:"star",value:W,output:""});continue}while(G.slice(0,3)==="/**"){let N0=$[U.index+4];if(N0&&N0!=="/")break;G=G.slice(3),c("/**",3)}if(Q.type==="bos"&&m()){Y.type="globstar",Y.value+=W,Y.output=v(q),U.output=Y.output,U.globstar=!0,c(W);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&!l&&m()){U.output=U.output.slice(0,-(Q.output+Y.output).length),Q.output=`(?:${Q.output}`,Y.type="globstar",Y.output=v(q)+(q.strictSlashes?")":"|$)"),Y.value+=W,U.globstar=!0,U.output+=Q.output+Y.output,c(W);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&G[0]==="/"){let N0=G[1]!==void 0?"|$":"";U.output=U.output.slice(0,-(Q.output+Y.output).length),Q.output=`(?:${Q.output}`,Y.type="globstar",Y.output=`${v(q)}${H}|${H}${N0})`,Y.value+=W,U.output+=Q.output+Y.output,U.globstar=!0,c(W+p()),C({type:"slash",value:"/",output:""});continue}if(Q.type==="bos"&&G[0]==="/"){Y.type="globstar",Y.value+=W,Y.output=`(?:^|${H}|${v(q)}${H})`,U.output=Y.output,U.globstar=!0,c(W+p()),C({type:"slash",value:"/",output:""});continue}U.output=U.output.slice(0,-Y.output.length),Y.type="globstar",Y.output=v(q),Y.value+=W,U.output+=Y.output,U.globstar=!0,c(W);continue}let E={type:"star",value:W,output:k};if(q.bash===!0){if(E.output=".*?",Y.type==="bos"||Y.type==="slash")E.output=z+E.output;C(E);continue}if(Y&&(Y.type==="bracket"||Y.type==="paren")&&q.regex===!0){E.output=W,C(E);continue}if(U.index===U.start||Y.type==="slash"||Y.type==="dot"){if(Y.type==="dot")U.output+=A,Y.output+=A;else if(q.dot===!0)U.output+=u,Y.output+=u;else U.output+=z,Y.output+=z;if(D()!=="*")U.output+=y,Y.output+=y}C(E)}while(U.brackets>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing","]"));U.output=i.escapeLast(U.output,"["),w0("brackets")}while(U.parens>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing",")"));U.output=i.escapeLast(U.output,"("),w0("parens")}while(U.braces>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing","}"));U.output=i.escapeLast(U.output,"{"),w0("braces")}if(q.strictSlashes!==!0&&(Y.type==="star"||Y.type==="bracket"))C({type:"maybe_slash",value:"",output:`${H}?`});if(U.backtrack===!0){U.output="";for(let G of U.tokens)if(U.output+=G.output!=null?G.output:G.value,G.suffix)U.output+=G.suffix}return U};g0.fastpaths=($,w)=>{let q={...w},J=typeof q.maxLength==="number"?Math.min(z0,q.maxLength):z0,f=$.length;if(f>J)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${J}`);$=S1[$]||$;let Z=i.isWindows(w),{DOT_LITERAL:V,SLASH_LITERAL:F,ONE_CHAR:N,DOTS_SLASH:K,NO_DOT:B,NO_DOTS:j,NO_DOTS_SLASH:X,STAR:H,START_ANCHOR:y}=j0.globChars(Z),M=q.dot?j:B,L=q.dot?X:B,A=q.capture?"":"?:",u={negated:!1,prefix:""},S=q.bash===!0?".*?":H;if(q.capture)S=`(${S})`;let n=(z)=>{if(z.noglobstar===!0)return S;return`(${A}(?:(?!${y}${z.dot?K:V}).)*?)`},b=(z)=>{switch(z){case"*":return`${M}${N}${S}`;case".*":return`${V}${N}${S}`;case"*.*":return`${M}${S}${V}${N}${S}`;case"*/*":return`${M}${S}${F}${N}${L}${S}`;case"**":return M+n(q);case"**/*":return`(?:${M}${n(q)}${F})?${L}${N}${S}`;case"**/*.*":return`(?:${M}${n(q)}${F})?${L}${S}${V}${N}${S}`;case"**/.*":return`(?:${M}${n(q)}${F})?${V}${N}${S}`;default:{let P=/^(.*?)\.(\w+)$/.exec(z);if(!P)return;let k=b(P[1]);if(!k)return;return k+V+P[2]}}},e=i.removePrefix($,u),v=b(e);if(v&&q.strictSlashes!==!0)v+=`${F}?`;return v};x1.exports=g0});var k1=d((Aw,h1)=>{var Bw=t("path"),Nw=A1(),h0=g1(),k0=F0(),Gw=W0(),Mw=($)=>$&&typeof $==="object"&&!Array.isArray($),x=($,w,q=!1)=>{if(Array.isArray($)){let B=$.map((X)=>x(X,w,q));return(X)=>{for(let H of B){let y=H(X);if(y)return y}return!1}}let J=Mw($)&&$.tokens&&$.input;if($===""||typeof $!=="string"&&!J)throw TypeError("Expected pattern to be a non-empty string");let f=w||{},Z=k0.isWindows(w),V=J?x.compileRe($,w):x.makeRe($,w,!1,!0),F=V.state;delete V.state;let N=()=>!1;if(f.ignore){let B={...w,ignore:null,onMatch:null,onResult:null};N=x(f.ignore,B,q)}let K=(B,j=!1)=>{let{isMatch:X,match:H,output:y}=x.test(B,V,w,{glob:$,posix:Z}),M={glob:$,state:F,regex:V,posix:Z,input:B,output:y,match:H,isMatch:X};if(typeof f.onResult==="function")f.onResult(M);if(X===!1)return M.isMatch=!1,j?M:!1;if(N(B)){if(typeof f.onIgnore==="function")f.onIgnore(M);return M.isMatch=!1,j?M:!1}if(typeof f.onMatch==="function")f.onMatch(M);return j?M:!0};if(q)K.state=F;return K};x.test=($,w,q,{glob:J,posix:f}={})=>{if(typeof $!=="string")throw TypeError("Expected input to be a string");if($==="")return{isMatch:!1,output:""};let Z=q||{},V=Z.format||(f?k0.toPosixSlashes:null),F=$===J,N=F&&V?V($):$;if(F===!1)N=V?V($):$,F=N===J;if(F===!1||Z.capture===!0)if(Z.matchBase===!0||Z.basename===!0)F=x.matchBase($,w,q,f);else F=w.exec(N);return{isMatch:Boolean(F),match:F,output:N}};x.matchBase=($,w,q,J=k0.isWindows(q))=>{return(w instanceof RegExp?w:x.makeRe(w,q)).test(Bw.basename($))};x.isMatch=($,w,q)=>x(w,q)($);x.parse=($,w)=>{if(Array.isArray($))return $.map((q)=>x.parse(q,w));return h0($,{...w,fastpaths:!1})};x.scan=($,w)=>Nw($,w);x.compileRe=($,w,q=!1,J=!1)=>{if(q===!0)return $.output;let f=w||{},Z=f.contains?"":"^",V=f.contains?"":"$",F=`${Z}(?:${$.output})${V}`;if($&&$.negated===!0)F=`^(?!${F}).*$`;let N=x.toRegex(F,w);if(J===!0)N.state=$;return N};x.makeRe=($,w={},q=!1,J=!1)=>{if(!$||typeof $!=="string")throw TypeError("Expected a non-empty string");let f={negated:!1,fastpaths:!0};if(w.fastpaths!==!1&&($[0]==="."||$[0]==="*"))f.output=h0.fastpaths($,w);if(!f.output)f=h0($,w);return x.compileRe(f,w,q,J)};x.toRegex=($,w)=>{try{let q=w||{};return new RegExp($,q.flags||(q.nocase?"i":""))}catch(q){if(w&&w.debug===!0)throw q;return/$^/}};x.constants=Gw;h1.exports=x});var u1=d((Sw,l1)=>{var d1=t("util"),v1=z1(),s=k1(),b0=F0(),b1=($)=>$===""||$==="./",m1=($)=>{let w=$.indexOf("{");return w>-1&&$.indexOf("}",w)>-1},R=($,w,q)=>{w=[].concat(w),$=[].concat($);let J=new Set,f=new Set,Z=new Set,V=0,F=(B)=>{if(Z.add(B.output),q&&q.onResult)q.onResult(B)};for(let B=0;B<w.length;B++){let j=s(String(w[B]),{...q,onResult:F},!0),X=j.state.negated||j.state.negatedExtglob;if(X)V++;for(let H of $){let y=j(H,!0);if(!(X?!y.isMatch:y.isMatch))continue;if(X)J.add(y.output);else J.delete(y.output),f.add(y.output)}}let K=(V===w.length?[...Z]:[...f]).filter((B)=>!J.has(B));if(q&&K.length===0){if(q.failglob===!0)throw Error(`No matches found for "${w.join(", ")}"`);if(q.nonull===!0||q.nullglob===!0)return q.unescape?w.map((B)=>B.replace(/\\/g,"")):w}return K};R.match=R;R.matcher=($,w)=>s($,w);R.isMatch=($,w,q)=>s(w,q)($);R.any=R.isMatch;R.not=($,w,q={})=>{w=[].concat(w).map(String);let J=new Set,f=[],V=new Set(R($,w,{...q,onResult:(F)=>{if(q.onResult)q.onResult(F);f.push(F.output)}}));for(let F of f)if(!V.has(F))J.add(F);return[...J]};R.contains=($,w,q)=>{if(typeof $!=="string")throw TypeError(`Expected a string: "${d1.inspect($)}"`);if(Array.isArray(w))return w.some((J)=>R.contains($,J,q));if(typeof w==="string"){if(b1($)||b1(w))return!1;if($.includes(w)||$.startsWith("./")&&$.slice(2).includes(w))return!0}return R.isMatch($,w,{...q,contains:!0})};R.matchKeys=($,w,q)=>{if(!b0.isObject($))throw TypeError("Expected the first argument to be an object");let J=R(Object.keys($),w,q),f={};for(let Z of J)f[Z]=$[Z];return f};R.some=($,w,q)=>{let J=[].concat($);for(let f of[].concat(w)){let Z=s(String(f),q);if(J.some((V)=>Z(V)))return!0}return!1};R.every=($,w,q)=>{let J=[].concat($);for(let f of[].concat(w)){let Z=s(String(f),q);if(!J.every((V)=>Z(V)))return!1}return!0};R.all=($,w,q)=>{if(typeof $!=="string")throw TypeError(`Expected a string: "${d1.inspect($)}"`);return[].concat(w).every((J)=>s(J,q)($))};R.capture=($,w,q)=>{let J=b0.isWindows(q),Z=s.makeRe(String($),{...q,capture:!0}).exec(J?b0.toPosixSlashes(w):w);if(Z)return Z.slice(1).map((V)=>V===void 0?"":V)};R.makeRe=(...$)=>s.makeRe(...$);R.scan=(...$)=>s.scan(...$);R.parse=($,w)=>{let q=[];for(let J of[].concat($||[]))for(let f of v1(String(J),w))q.push(s.parse(f,w));return q};R.braces=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");if(w&&w.nobrace===!0||!m1($))return[$];return v1($,w)};R.braceExpand=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");return R.braces($,{...w,expand:!0})};R.hasBraces=m1;l1.exports=R});var c1=yw(u1(),1);var I0;((J)=>{J.ALLOW="allow";J.ASK="ask";J.DENY="deny"})(I0||={});var gw=h.object({tool:h.string(),specifier:h.string().optional(),action:h.nativeEnum(I0)}),hw=h.object({allow:h.array(h.string()).optional(),ask:h.array(h.string()).optional(),deny:h.array(h.string()).optional(),defaultMode:h.nativeEnum(I0).optional()}),kw=h.object({name:h.string(),args:h.record(h.string(),h.any())});class f0{rules;defaultMode;patternCache=new Map;constructor($){this.rules=$.rules,this.defaultMode=$.defaultMode||"ask",this.rules.sort((w,q)=>{let J={deny:0,ask:1,allow:2},f=J[w.action]-J[q.action];if(f!==0)return f;let Z=w.specifier==null?1:0,V=q.specifier==null?1:0;return Z-V})}checkPermission($){for(let w of this.rules)if(this.matchRule(w,$))return{allowed:w.action==="allow"||w.action==="ask",requiresApproval:w.action==="ask",matchedRule:w,reason:this.getReason(w)};return{allowed:this.defaultMode==="allow"||this.defaultMode==="ask",requiresApproval:this.defaultMode==="ask",reason:`No matching rule, using default mode: ${this.defaultMode}`}}matchRule($,w){if($.tool!==w.name)return!1;if(!$.specifier)return!0;let q=this.argsToString(w.args);if(w.name==="Bash")return this.matchBashCommand($.specifier,q);if($.specifier.endsWith(" ")&&!/[*?[\\]/.test($.specifier))return q.startsWith($.specifier);return this.matchGlob($.specifier,q)}matchBashCommand($,w){if(/[;&|]/.test(w))return!1;let J=/[<>()]/;if(J.test(w)){let f=w.split(J)[0].trim();return this.matchBashPattern($,f)}return this.matchBashPattern($,w)}matchBashPattern($,w){if($.endsWith(" "))return w.startsWith($);return this.matchGlob($,w)}matchGlob($,w){try{let q=$.replace(/^\.\//,""),J=w.replace(/^\.\//,""),f=`${$}::${w}`,Z=this.patternCache.get(f);if(Z!==void 0)return Z;let V=c1.default.isMatch(J,q,{nocase:!1,dot:!0});return this.cacheResult(f,V),V}catch(q){return w===$}}cacheResult($,w){if(this.patternCache.size>1000){let q=this.patternCache.keys().next().value;if(q)this.patternCache.delete(q)}this.patternCache.set($,w)}argsToString($){if(typeof $==="object"&&$!==null){if("command"in $&&$.command)return String($.command);if("file_path"in $&&$.file_path)return String($.file_path);return Object.values($).flat().join(" ")}return String($)}getReason($){let w=$.action.toUpperCase(),q=$.tool,J=$.specifier?`(${$.specifier})`:"";return`${w} rule matched: ${q}${J}`}static parseRule($,w){let q=$.match(/^(\w+)(?:\((.*)\))?$/);if(!q)throw Error(`Invalid permission rule format: ${$}`);let[,J,f]=q;return{tool:J,specifier:f,action:w}}static fromConfig($){let w=[];for(let q of $.allow||[])w.push(f0.parseRule(q,"allow"));for(let q of $.ask||[])w.push(f0.parseRule(q,"ask"));for(let q of $.deny||[])w.push(f0.parseRule(q,"deny"));return new f0({rules:w,defaultMode:$.defaultMode||"ask"})}clearCache(){this.patternCache.clear()}getCacheSize(){return this.patternCache.size}}class $0{configStore;toolNameMapper={};constructor($){this.configStore=$}static instance=null;static getInstance($){if(!$0.instance){if(!$)throw Error("PermissionStore not initialized. Provide configStore on first call.");$0.instance=new $0($)}return $0.instance}static resetInstance(){$0.instance=null}async getPermissions(){let $=await this.configStore.getConfig();if($.permissions)return f0.fromConfig($.permissions);return}async checkBashPermission($,w){return(await this.getPermissions())?.checkPermission({name:"Bash",args:{command:$,cwd:w}})}async checkReadPermission($){return(await this.getPermissions())?.checkPermission({name:"Read",args:{file_path:$}})}async checkWritePermission($){return(await this.getPermissions())?.checkPermission({name:"Write",args:{file_path:$}})}}class C0{configStore;skillStore;pluginStore;remoteStore;permissionStore;_initialized=!1;constructor($,w,q,J){this.configStore=$,this.skillStore=w,this.pluginStore=q,this.remoteStore=J,this.permissionStore=$0.getInstance($)}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($){return await this.ensureInitialized(),await this.configStore.updateConfig($)}async listSkills(){return await this.ensureInitialized(),await this.skillStore.listSkills()}async getSkill($){return await this.ensureInitialized(),await this.skillStore.getSkill($)}async saveSkill($,w){return await this.ensureInitialized(),await this.skillStore.saveSkill($,w)}async deleteSkill($){return await this.ensureInitialized(),await this.skillStore.deleteSkill($)}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($){return await this.ensureInitialized(),await this.pluginStore.getPluginConfig($)}async updatePluginConfig($,w){return await this.ensureInitialized(),await this.pluginStore.updatePluginConfig($,w)}async installPlugin($,w){return await this.ensureInitialized(),await this.pluginStore.installPlugin($,w)}async uninstallPlugin($){return await this.ensureInitialized(),await this.pluginStore.uninstallPlugin($)}async checkBashPermission($,w){return await this.ensureInitialized(),await this.permissionStore.checkBashPermission($,w)}async checkReadPermission($){return await this.ensureInitialized(),await this.permissionStore.checkReadPermission($)}async checkWritePermission($){return await this.ensureInitialized(),await this.permissionStore.checkWritePermission($)}async getPermissionMatcher(){return await this.ensureInitialized(),await this.permissionStore.getPermissions()}getConfigPath(){return this.configStore?.dbPath}}async function ow(){let{FileSystemConfigStore:$}=await import("./chunk-t7rwtc17.js"),{FileSystemSkillStore:w}=await import("./chunk-r4tq44hr.js"),{FileSystemPluginStore:q}=await import("./chunk-zr7sx9hd.js"),J=new $,f=new w,Z=new q,V=new C0(J,f,Z);return await V.initialize(),V}async function tw($){let{configStore:w,skillStore:q,pluginStore:J,remoteStore:f}=$,Z=new C0(w,q,J,f);return await Z.initialize(),Z}
18
- export{C0 as Of,ow as Pf,tw as Qf};