zen-code 4.10.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +151 -2699
- package/dist/chunk-069q9hkz.js +1 -0
- package/dist/chunk-06trk066.js +1 -0
- package/dist/chunk-0kfw8bwn.js +2 -0
- package/dist/chunk-0mq8786q.js +281 -0
- package/dist/chunk-0qz8rr2k.js +1 -0
- package/dist/chunk-1d47g6nc.js +2 -0
- package/dist/chunk-1gssqf6g.js +88 -0
- package/dist/chunk-1rcc9xzn.js +79 -0
- package/dist/chunk-2bjeg40f.js +1 -0
- package/dist/chunk-2gd8vzrf.js +2 -0
- package/dist/chunk-2gprcgep.js +6 -0
- package/dist/chunk-3k3c686f.js +1 -0
- package/dist/chunk-43h0n2td.js +1 -0
- package/dist/chunk-492hjs9k.js +26 -0
- package/dist/chunk-4eaqmt3c.js +16 -0
- package/dist/chunk-4fs853nh.js +2 -0
- package/dist/chunk-5fe27s34.js +2 -0
- package/dist/chunk-5hqvapp1.js +7 -0
- package/dist/chunk-6b3vfr39.js +2 -0
- package/dist/chunk-6j695pam.js +5 -0
- package/dist/chunk-6saqxa3z.js +2 -0
- package/dist/chunk-78ksrp8v.js +41 -0
- package/dist/chunk-7cx9kda0.js +228 -0
- package/dist/chunk-7qba2raw.js +2 -0
- package/dist/chunk-81b2s97q.js +1 -0
- package/dist/chunk-88w3txtb.js +160 -0
- package/dist/chunk-8ygdre0g.js +1 -0
- package/dist/chunk-9011y634.js +6 -0
- package/dist/chunk-9zcr1qh6.js +1 -0
- package/dist/chunk-a0nr8jva.js +2 -0
- package/dist/chunk-agevsn2e.js +1 -0
- package/dist/chunk-akc3s5aw.js +6 -0
- package/dist/chunk-b0beqmg2.js +2 -0
- package/dist/chunk-b175s7dm.js +1 -0
- package/dist/chunk-bk32cwxa.js +5 -0
- package/dist/chunk-bn077sjq.js +213 -0
- package/dist/chunk-c9yrpb3g.js +18 -0
- package/dist/chunk-cb0f54ar.js +3 -0
- package/dist/chunk-ctqtahz4.js +1 -0
- package/dist/chunk-d2sr8fnm.js +3 -0
- package/dist/chunk-d5gzkkgg.js +1 -0
- package/dist/chunk-dh2f4xyb.js +3 -0
- package/dist/chunk-dr32dt9y.js +1 -0
- package/dist/chunk-dv1vt080.js +1 -0
- package/dist/chunk-dz9sqfph.js +2 -0
- package/dist/chunk-e7mbewmw.js +1 -0
- package/dist/chunk-em03xqy9.js +1 -0
- package/dist/chunk-fkt5b511.js +1 -0
- package/dist/chunk-gphssgy6.js +2 -0
- package/dist/chunk-h2hk7vx4.js +1 -0
- package/dist/chunk-h7ypcqp3.js +279 -0
- package/dist/chunk-j8tq0e8m.js +2 -0
- package/dist/chunk-jd1razfg.js +91 -0
- package/dist/chunk-jhxvctg5.js +8 -0
- package/dist/chunk-kada5fyh.js +1 -0
- package/dist/chunk-kgc6ws03.js +1 -0
- package/dist/chunk-mk8ggmt8.js +17 -0
- package/dist/chunk-mv5m8bf4.js +140 -0
- package/dist/chunk-mv8a5svx.js +1 -0
- package/dist/chunk-n61yv4t5.js +2 -0
- package/dist/chunk-nt2yp4jh.js +1 -0
- package/dist/chunk-p7ew4trx.js +1 -0
- package/dist/chunk-pgnhcznr.js +4 -0
- package/dist/chunk-q8cfxky4.js +8 -0
- package/dist/chunk-q8zsxwd8.js +81 -0
- package/dist/chunk-qfa5v4n5.js +1 -0
- package/dist/chunk-qhzztj83.js +1 -0
- package/dist/chunk-snmkgfbe.js +15 -0
- package/dist/chunk-ss4bh5wb.js +2 -0
- package/dist/chunk-sv0k2v66.js +1 -0
- package/dist/chunk-tbav8trq.js +23 -0
- package/dist/chunk-tmyzfvsy.js +1 -0
- package/dist/chunk-ts4jreym.js +7 -0
- package/dist/chunk-tws3wcnm.js +2 -0
- package/dist/chunk-v0e9bsvt.js +89 -0
- package/dist/chunk-vwj4n000.js +4 -0
- package/dist/chunk-wd6s7gg7.js +175 -0
- package/dist/chunk-y524zd2h.js +54 -0
- package/dist/chunk-yb71zqvt.js +2 -0
- package/dist/chunk-yejgw2hm.js +112 -0
- package/dist/chunk-yfjs6pf8.js +3 -0
- package/dist/chunk-zhqdp4ak.js +2 -0
- package/dist/chunk-zkd3m39v.js +1 -0
- package/dist/cli.js +1 -3116
- package/dist/nonInteractive.js +180 -1950
- package/dist/zen-core.js +644 -0
- package/dist/zen-keyboard.js +3 -358
- package/package.json +5 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{Bl as h}from"./chunk-78ksrp8v.js";import{$l as t,Wl as yw,Yl as d}from"./chunk-4fs853nh.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-qhzztj83.js"),{FileSystemSkillStore:w}=await import("./chunk-p7ew4trx.js"),{FileSystemPluginStore:q}=await import("./chunk-8ygdre0g.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{ow as Ak,tw as Bk};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{vk as We}from"./chunk-j8tq0e8m.js";import{Cl as ou,Il as Oh,Jl as Mh}from"./chunk-yb71zqvt.js";import{$l as _,Wl as Vh,Xl as Ch,Yl as L}from"./chunk-4fs853nh.js";var wu=L((qu)=>{(function(){var u=function(e,h,r){var f,q;q="";while(e.length>0)if(f=e.match(h),f)q+=e.slice(0,f.index),q+=r(f),e=e.slice(f.index+f[0].length);else q+=e,e="";return q};qu.split=function(e){var h,r;if(e==null)e="";if(r=[],h="",u(e,/\s*(?:([^\s\\\'\"]+)|'((?:[^\'\\]|\\.)*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|$)?/,function(f){var q,w,E,M,O,V,F;if(M=f[0],F=f[1],V=f[2],q=f[3],w=f[4],E=f[5],O=f[6],E!=null)throw Error("Unmatched quote");if(h+=F||(V||q||w).replace(/\\(?=.)/,""),O!=null)return r.push(h),h=""}),h)r.push(h);return r},qu.escape=function(e){if(e==null)e="";if(e==null)return"''";return e.replace(/([^A-Za-z0-9_\-.,:\/@\n])/g,"\\$1").replace(/\n/g,`'
|
|
2
|
+
'`)}}).call(qu)});var yu=L((Th,Eu)=>{var _u=_("fs"),k;function nu(){try{return _u.statSync("/.dockerenv"),!0}catch(u){return!1}}function tu(){try{return _u.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch(u){return!1}}Eu.exports=()=>{if(k===void 0)k=nu()||tu();return k}});var Mu=L((zh,b)=>{var su=_("os"),pu=_("fs"),Cu=yu(),Ou=()=>{if(process.platform!=="linux")return!1;if(su.release().toLowerCase().includes("microsoft")){if(Cu())return!1;return!0}try{return pu.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Cu():!1}catch(u){return!1}};if(process.env.__IS_WSL_TEST__)b.exports=Ou;else b.exports=Ou()});var K=L((Me,y)=>{var ue=wu(),g=_("child_process"),a=ou(),ee=Mu(),he=_("path"),fe=_("url"),X=_("os"),l=_("fs"),re=_("net");function ju(u){return JSON.parse(JSON.stringify(u))}Me.clone=ju;var qe=function(u){if(typeof u==="string")return u.replace(/(["$`\\])/g,"\\$1");else return u},we=function(u,e){return u.indexOf(e)!==-1},Lu={u:"urgency",urgency:"urgency",t:"expire-time",time:"expire-time",timeout:"expire-time",e:"expire-time",expire:"expire-time","expire-time":"expire-time",i:"icon",icon:"icon",c:"category",category:"category",subtitle:"category",h:"hint",hint:"hint",a:"app-name","app-name":"app-name"};Me.command=function(u,e,h){if(u=ue.escape(u),process.env.DEBUG&&process.env.DEBUG.indexOf("notifier")!==-1)console.info("node-notifier debug info (command):"),console.info("[notifier path]",u),console.info("[notifier options]",e.join(" "));return g.exec(u+" "+e.join(" "),function(r,f,q){if(r)return h(r);h(q,f)})};Me.fileCommand=function(u,e,h){if(process.env.DEBUG&&process.env.DEBUG.indexOf("notifier")!==-1)console.info("node-notifier debug info (fileCommand):"),console.info("[notifier path]",u),console.info("[notifier options]",e.join(" "));return g.execFile(u,e,function(r,f,q){if(r)return h(r,f);h(q,f)})};Me.fileCommandJson=function(u,e,h){if(process.env.DEBUG&&process.env.DEBUG.indexOf("notifier")!==-1)console.info("node-notifier debug info (fileCommandJson):"),console.info("[notifier path]",u),console.info("[notifier options]",e.join(" "));return g.execFile(u,e,function(r,f,q){if(r)return h(r,f);if(!f)return h(r,{});try{let w=JSON.parse(f);h(!q?null:q,w)}catch(w){h(w,f)}})};Me.immediateFileCommand=function(u,e,h){if(process.env.DEBUG&&process.env.DEBUG.indexOf("notifier")!==-1)console.info("node-notifier debug info (notifier):"),console.info("[notifier path]",u);_e(u,function(r,f){if(!f)return h(Error("Notifier ("+u+") not found on system."));g.execFile(u,e),h()})};function _e(u,e){return l.stat(u,function(h,r){if(!h)return e(h,r.isFile());if(he.extname(u))return e(h,!1);return l.stat(u+".exe",function(f,q){if(f)return e(f,!1);e(f,q.isFile())})})}var m=function(u){if(u.appIcon)u.icon=u.appIcon,delete u.appIcon;return u},N=function(u){if(u.text)u.message=u.text,delete u.text;return u},Yu=function(u){if(u.i)u.icon=u.i,delete u.i;return u};Me.mapToNotifySend=function(u){if(u=m(u),u=N(u),u.timeout===!1)delete u.timeout;if(u.wait===!0)u["expire-time"]=5;for(let e in u){if(e==="message"||e==="title")continue;if(u.hasOwnProperty(e)&&Lu[e]!==e)u[Lu[e]]=u[e],delete u[e]}if(typeof u["expire-time"]>"u")u["expire-time"]=1e4;else if(typeof u["expire-time"]==="number")u["expire-time"]=u["expire-time"]*1000;return u};Me.mapToGrowl=function(u){if(u=m(u),u=Yu(u),u=N(u),u.icon&&!Buffer.isBuffer(u.icon))try{u.icon=l.readFileSync(u.icon)}catch(e){}return u};Me.mapToMac=function(u){if(u=Yu(u),u=N(u),u.icon)u.appIcon=u.icon,delete u.icon;if(u.sound===!0)u.sound="Bottle";if(u.sound===!1)delete u.sound;if(u.sound&&u.sound.indexOf("Notification.")===0)u.sound="Bottle";if(u.wait===!0){if(!u.timeout)u.timeout=5;delete u.wait}if(!u.wait&&!u.timeout)if(u.timeout===!1)delete u.timeout;else u.timeout=10;return u.json=!0,u};function i(u){return Object.prototype.toString.call(u)==="[object Array]"}Me.isArray=i;function Ee(){}Me.actionJackerDecorator=function(u,e,h,r){if(e=ju(e),h=h||Ee,typeof h!=="function")throw TypeError("The second argument must be a function callback. You have passed "+typeof h);return function(f,q){let w=q,E={};if(w&&typeof w==="object")E=w,w=w.activationType;if(w){if(w=w.toLowerCase().trim(),w.match(/^activate|clicked$/))w="activate";if(w.match(/^timedout$/))w="timeout"}if(h.apply(u,[f,w,E]),!r||!w)return;let M=r(w);if(!M)return;u.emit(M,u,e,E)}};Me.constructArgumentList=function(u,e){let h=[];e=e||{};let r=e.initial||[],f=e.keyExtra||"",q=e.allowedArguments||[],w=e.noEscape!==void 0,E=e.allowedArguments!==void 0,M=!!e.explicitTrue,O=!!e.keepNewlines,V=e.wrapper===void 0?'"':e.wrapper,F=function U($){if(i($))return Ju($.map(U).join(","));if(!w)$=qe($);if(typeof $==="string"&&!O)$=Ju($);return V+$+V};r.forEach(function(U){h.push(F(U))});for(let U in u)if(u.hasOwnProperty(U)&&(!E||we(q,U)))if(M&&u[U]===!0)h.push("-"+f+U);else if(M&&u[U]===!1)continue;else h.push("-"+f+U,F(u[U]));return h};function Ju(u){let e=process.platform==="win32"?"\\r\\n":"\\n";return u.replace(/\r?\n/g,e)}var ye=["t","m","b","tb","p","id","s","silent","appID","pid","pipeName","close","install"],Ce="Notification.",Uu="Notification.Default";Me.mapToWin8=function(u){if(u=m(u),u=N(u),u.icon){if(/^file:\/+/.test(u.icon))u.p=new fe.URL(u.icon).pathname.replace(/^\/(\w:\/)/,"$1").replace(/\//g,"\\");else u.p=u.icon;delete u.icon}if(u.message)u.m=u.message.replace(/\x1b/g,""),delete u.message;if(u.title)u.t=u.title,delete u.title;if(u.appName)u.appID=u.appName,delete u.appName;if(typeof u.remove<"u")u.close=u.remove,delete u.remove;if(u.quiet||u.silent)u.silent=u.quiet||u.silent,delete u.quiet;if(typeof u.sound<"u")u.s=u.sound,delete u.sound;if(u.s===!1)u.silent=!0,delete u.s;if(u.s&&u.silent)delete u.s;if(u.s===!0)u.s=Uu;if(u.s&&u.s.indexOf(Ce)!==0)u.s=Uu;if(u.actions&&i(u.actions))u.b=u.actions.join(";"),delete u.actions;for(let e in u)if(u.hasOwnProperty(e)&&ye.indexOf(e)===-1)delete u[e];return u};Me.mapToNotifu=function(u){if(u=m(u),u=N(u),u.icon)u.i=u.icon,delete u.icon;if(u.message)u.m=u.message,delete u.message;if(u.title)u.p=u.title,delete u.title;if(u.time)u.d=u.time,delete u.time;if(u.q!==!1)u.q=!0;else delete u.q;if(u.quiet===!1)delete u.q,delete u.quiet;if(u.sound)delete u.q,delete u.sound;if(u.t)u.d=u.t,delete u.t;if(u.type)u.t=Oe(u.type),delete u.type;return u};Me.isMac=function(){return X.type()==="Darwin"};Me.isMountainLion=function(){return X.type()==="Darwin"&&a.satisfies(n(X.release()),">=12.0.0")};Me.isWin8=function(){return X.type()==="Windows_NT"&&a.satisfies(n(X.release()),">=6.2.9200")};Me.isWSL=function(){return ee};Me.isLessThanWin8=function(){return X.type()==="Windows_NT"&&a.satisfies(n(X.release()),"<6.2.9200")};function n(u){if(u.split(".").length===2)u+=".0";return u}function Oe(u){if(typeof u==="string"||u instanceof String){if(u.toLowerCase()==="info")return"info";if(u.toLowerCase()==="warn")return"warn";if(u.toLowerCase()==="error")return"error"}return"info"}Me.createNamedPipe=(u)=>{let e=Buffer.alloc(1024);return new Promise((h)=>{u.instance=re.createServer((r)=>{r.on("data",(f)=>{e.write(f.toString())}),r.on("end",()=>{u.instance.close()})}),u.instance.listen(u.namedPipe,()=>{h(e)})})}});var Hu=L((Bh,Zu)=>{var $u=_("os"),Te=We(),Q=K(),Ku=_("events").EventEmitter,ze=_("util"),v;Zu.exports=A;function A(u){if(u=Q.clone(u||{}),!(this instanceof A))return new A(u);this.options=u,Ku.call(this)}ze.inherits(A,Ku);function Be(){}function ce(u,e){if(u=Q.clone(u||{}),e=e||Be,typeof e!=="function")throw TypeError("The second argument must be a function callback. You have passed "+typeof e);if(typeof u==="string")u={title:"node-notifier",message:u};if(!u.message)return e(Error("Message is required.")),this;if($u.type()!=="Linux"&&!$u.type().match(/BSD$/))return e(Error("Only supported on Linux and *BSD systems")),this;if(v===!1)return e(Error("notify-send must be installed on the system.")),this;if(v||!!this.options.suppressOsdCheck)return Xu(u,e),this;try{v=!!Te.sync("notify-send"),Xu(u,e)}catch(h){return v=!1,e(h)}return this}Object.defineProperty(A.prototype,"notify",{get:function(){if(!this._notify)this._notify=ce.bind(this);return this._notify}});var De=["urgency","expire-time","icon","category","hint","app-name"];function Xu(u,e){u=Q.mapToNotifySend(u),u.title=u.title||"Node Notification:";let h=[u.title,u.message];delete u.title,delete u.message;let r=Q.constructArgumentList(u,{initial:h,keyExtra:"-",allowedArguments:De});Q.command("notify-send",r,e)}});var t=L((ch,Ru)=>{var ge=_("net");Ru.exports=function(u,e){if(typeof e>"u")e=u,u={};let h=u.port||23053,r=u.host||"localhost",f=ge.connect(h,r);f.setTimeout(100),f.once("connect",function(){f.end(),e(null,!0)}),f.once("error",function(){f.end(),e(null,!1)})}});var Nu=L((Dh,Fu)=>{var me=_("net"),ve=_("crypto"),Vu=_("util").format,xe=_("fs"),J=`\r
|
|
3
|
+
`;function Z(u,e){e=e||{},this.type=u,this.host=e.host||"localhost",this.port=e.port||23053,this.request="GNTP/1.0 "+u+" NONE"+J,this.resources=[],this.attempts=0,this.maxAttempts=5}Z.prototype.parseResp=function(u){var e={},h,r;return u=u.slice(0,u.indexOf(J+J)).split(J),h=u[0],r=u.slice(1),e.state=h.match(/-(OK|ERROR|CALLBACK)/)[0].slice(1),r.forEach(function(f){f=f.split(": "),e[f[0]]=f[1]}),e};Z.prototype.retry=function(){var u=this,e=arguments;setTimeout(function(){u.send.apply(u,e)},750)};Z.prototype.addResource=function(u){var e=ve.createHash("md5").update(u).digest("hex"),h="Identifier: "+e+J+"Length: "+u.length+J+J;return this.resources.push({header:h,file:u}),"x-growl-resource://"+e};Z.prototype.add=function(u,e){if(e===void 0)return;if(/-Icon/.test(u)&&!/^https?:\/\//.test(e)){if(/\.(png|gif|jpe?g)$/.test(e))e=this.addResource(xe.readFileSync(e));else if(e instanceof Buffer)e=this.addResource(e)}this.request+=u+": "+e+J};Z.prototype.newline=function(){this.request+=J};Z.prototype.send=function(u){var e=this,h=me.connect(this.port,this.host),r="";u=u||function(){},this.attempts+=1,h.on("connect",function(){h.write(e.request),e.resources.forEach(function(f){h.write(f.header),h.write(f.file),h.write(J+J)})}),h.on("data",function(f){if(r+=f.toString(),r.slice(r.length-4)!==J+J)return;if(r=e.parseResp(r),r.state==="ERROR"||r.state==="CALLBACK")h.end();else r=""}),h.on("end",function(){if(["200","401","402"].indexOf(r["Error-Code"])>=0)if(e.attempts<=e.maxAttempts)e.retry(u);else{var f='GNTP request to "%s:%d" failed with error code %s (%s)';u(Error(Vu(f,e.host,e.port,r["Error-Code"],r["Error-Description"])))}else u(void 0,r)}),h.on("error",function(){u(Error(Vu('Error while sending GNTP request to "%s:%d"',e.host,e.port))),h.destroy()})};Fu.exports=Z});var Su=L((gh,Au)=>{var Qu=Nu();function S(){this.appname="Growly",this.notifications=void 0,this.labels=void 0,this.count=0,this.registered=!1,this.host=void 0,this.port=void 0}S.prototype.getLabels=function(){return this.notifications.map(function(u){return u.label})};S.prototype.setHost=function(u,e){this.host=u,this.port=e};S.prototype.register=function(u,e,h,r){var f;if(typeof e==="object")h=e,e=void 0;if(h===void 0||!h.length)h=[{label:"default",dispname:"Default Notification",enabled:!0}];if(typeof arguments[arguments.length-1]==="function")r=arguments[arguments.length-1];else r=function(){};this.appname=u,this.notifications=h,this.labels=this.getLabels(),this.registered=!0,f=new Qu("REGISTER",{host:this.host,port:this.port}),f.add("Application-Name",u),f.add("Application-Icon",e),f.add("Notifications-Count",h.length),f.newline(),h.forEach(function(q){if(q.enabled===void 0)q.enabled=!0;f.add("Notification-Name",q.label),f.add("Notification-Display-Name",q.dispname),f.add("Notification-Enabled",q.enabled?"True":"False"),f.add("Notification-Icon",q.icon),f.newline()}),f.send(r)};S.prototype.notify=function(u,e,h){var r=this,f;if(!this.registered){this.register(this.appname,function(q){if(q)console.log(q);r.notify.call(r,u,e,h)});return}if(e=e||{},typeof e==="function")h=e,e={};f=new Qu("NOTIFY",{host:this.host,port:this.port}),f.add("Application-Name",this.appname),f.add("Notification-Name",e.label||this.labels[0]),f.add("Notification-ID",++this.count),f.add("Notification-Title",e.title),f.add("Notification-Text",u),f.add("Notification-Sticky",e.sticky?"True":"False"),f.add("Notification-Priority",e.priority),f.add("Notification-Icon",e.icon),f.add("Notification-Coalescing-ID",e.coalescingId||void 0),f.add("Notification-Callback-Context",h?"context":void 0),f.add("Notification-Callback-Context-Type",h?"string":void 0),f.add("Notification-Callback-Target",void 0),f.newline(),f.send(function(q,w){if(h&&q)h(q);else if(h&&w.state==="CALLBACK")h(void 0,w["Notification-Callback-Result"].toLowerCase())})};Au.exports=new S});var P=L((mh,Wu)=>{var Pe=t(),x=K(),G=Su(),Iu=_("events").EventEmitter,de=_("util");Wu.exports=I;var Gu;function I(u){if(u=x.clone(u||{}),!(this instanceof I))return new I(u);G.appname=u.name||"Node",this.options=u,Iu.call(this)}de.inherits(I,Iu);function ke(u,e){if(G.setHost(this.options.host,this.options.port),u=x.clone(u||{}),typeof u==="string")u={title:"node-notifier",message:u};if(e=x.actionJackerDecorator(this,u,e,function(h){if(h==="click")return"click";if(h==="timedout")return"timeout";return!1}),u=x.mapToGrowl(u),!u.message)return e(Error("Message is required.")),this;if(u.title=u.title||"Node Notification:",Gu||!!u.wait){let h=u.wait?e:be;if(G.notify(u.message,u,h),!u.wait)e();return this}return Pe(G,function(h,r){if(Gu=r,!r)return e(Error("Couldn't connect to growl (might be used as a fallback). Make sure it is running"));G.notify(u.message,u),e()}),this}Object.defineProperty(I.prototype,"notify",{get:function(){if(!this._notify)this._notify=ke.bind(this);return this._notify}});function be(){}});var cu=L((vh,Bu)=>{var __dirname="/Users/konghayao/code/ai/code-graph/node_modules/.bun/node-notifier@10.0.1/node_modules/node-notifier/notifiers",H=K(),le=P(),ae=_("path"),ie=ae.join(__dirname,"../vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier"),zu=_("events").EventEmitter,ne=_("util"),te="You need Mac OS X 10.8 or above to use NotificationCenter, or use Growl fallback with constructor option {withFallback: true}.";Bu.exports=W;function W(u){if(u=H.clone(u||{}),!(this instanceof W))return new W(u);this.options=u,zu.call(this)}ne.inherits(W,zu);var Tu=null;function se(){}function pe(u,e){let h,r=oe();if(u=H.clone(u||{}),Tu=r,typeof u==="string")u={title:"node-notifier",message:u};if(e=e||se,typeof e!=="function")throw TypeError("The second argument must be a function callback. You have passed "+typeof fn);let f=H.actionJackerDecorator(this,u,e,function(w){if(Tu!==r)return!1;if(w==="activate")return"click";if(w==="timeout")return"timeout";if(w==="replied")return"replied";return!1});if(u=H.mapToMac(u),!u.message&&!u.group&&!u.list&&!u.remove)return e(Error("Message, group, remove or list property is required.")),this;let q=H.constructArgumentList(u);if(H.isMountainLion())return H.fileCommandJson(this.options.customPath||ie,q,f),this;if(h||!!this.options.withFallback)return h=h||new le(this.options),h.notify(u,e);return e(Error(te)),this}Object.defineProperty(W.prototype,"notify",{get:function(){if(!this._notify)this._notify=pe.bind(this);return this._notify}});function oe(){return{_ref:"val"}}});var s=L((xh,vu)=>{var __dirname="/Users/konghayao/code/ai/code-graph/node_modules/.bun/node-notifier@10.0.1/node_modules/node-notifier/notifiers",uh=_("path"),eh=uh.resolve(__dirname,"../vendor/notifu/notifu"),hh=t(),Y=K(),fh=p(),Du=P(),rh=_("os"),mu=_("events").EventEmitter,qh=_("util"),d;vu.exports=T;function T(u){if(u=Y.clone(u||{}),!(this instanceof T))return new T(u);this.options=u,mu.call(this)}qh.inherits(T,mu);function wh(){}function _h(u,e){let h,r=this.options;if(u=Y.clone(u||{}),e=e||wh,typeof u==="string")u={title:"node-notifier",message:u};let f=Y.actionJackerDecorator(this,u,e,function(q){if(q==="activate")return"click";if(q==="timeout")return"timeout";return!1});if(!!this.options.withFallback&&Y.isWin8())return h=h||new fh(r),h.notify(u,e);if(!!this.options.withFallback&&(!Y.isLessThanWin8()||d===!0))return h=h||new Du(r),h.notify(u,e);if(!this.options.withFallback||d===!1)return gu(u,r,f),this;return hh(r,function(q,w){if(d=w,d)return h=h||new Du(r),h.notify(u,e);gu(u,r,f)}),this}Object.defineProperty(T.prototype,"notify",{get:function(){if(!this._notify)this._notify=_h.bind(this);return this._notify}});var Eh=["t","d","p","m","i","e","q","w","xp"];function gu(u,e,h){let r=rh.arch()==="x64";u=u||{},u=Y.mapToNotifu(u),u.p=u.p||"Node Notification:";let f=eh+(r?"64":"")+".exe",q=e.customPath||f;if(!u.m)return h(Error("Message is required.")),this;let w=Y.constructArgumentList(u,{wrapper:"",noEscape:!0,explicitTrue:!0,allowedArguments:Eh});if(u.wait)return Y.fileCommand(q,w,function(E,M){let O=yh(E.code);if(O==="error")return h(E,M);return h(null,O)});Y.immediateFileCommand(q,w,h)}function yh(u){switch(u){case 2:return"timeout";case 3:case 6:case 7:return"activate";case 4:return"close";default:return"error"}}});var p=L((Ph,Pu)=>{var __dirname="/Users/konghayao/code/ai/code-graph/node_modules/.bun/node-notifier@10.0.1/node_modules/node-notifier/notifiers",Lh=_("path"),Jh=Lh.resolve(__dirname,"../vendor/snoreToast/snoretoast"),j=K(),Uh=s(),jh=_("os"),{v4:Yh}=(Mh(),Ch(Oh)),xu=_("events").EventEmitter,$h=_("util"),o;Pu.exports=z;function z(u){if(u=j.clone(u||{}),!(this instanceof z))return new z(u);this.options=u,xu.call(this)}$h.inherits(z,xu);function Xh(){}function Kh(u){if(!u)return{};return u.split(";").reduce((e,h)=>{let r=h.split("=");if(r&&r.length===2)e[r[0]]=r[1];return e},{})}function Zh(){return`${j.isWSL()?"/tmp/":"\\\\.\\pipe\\"}notifierPipe-${Yh()}`}function Hh(u,e){u=j.clone(u||{}),e=e||Xh;let h=jh.arch()==="x64",r,f={namedPipe:Zh()};if(typeof u==="string")u={title:"node-notifier",message:u};if(typeof e!=="function")throw TypeError("The second argument must be a function callback. You have passed "+typeof fn);let q=(E,M)=>{let O=Kh(r&&r.toString("utf16le"));if(O.action==="buttonClicked"&&O.button)O.activationType=O.button;else if(O.action)O.activationType=O.action;if(E&&E.code===-1)M(E,O);M(null,O),f.instance&&f.instance.close()},w=(E)=>q(E,j.actionJackerDecorator(this,u,e,(M)=>M==="activate"?"click":M||!1));if(u.title=u.title||"Node Notification:",typeof u.message>"u"&&typeof u.close>"u")return e(Error("Message or ID to close is required.")),this;if(!j.isWin8()&&!j.isWSL()&&!!this.options.withFallback)return o=o||new Uh(this.options),o.notify(u,e);return j.createNamedPipe(f).then((E)=>{r=E,u.pipeName=f.namedPipe;let M=u.customPath||this.options.customPath||Jh+"-x"+(h?"64":"86")+".exe";u=j.mapToWin8(u);let O=j.constructArgumentList(u,{explicitTrue:!0,wrapper:"",keepNewlines:!0,noEscape:!0});j.fileCommand(M,O,w)}),this}Object.defineProperty(z.prototype,"notify",{get:function(){if(!this._notify)this._notify=Hh.bind(this);return this._notify}})});var bu=L((dh,C)=>{var du=_("os"),ku=K(),B=Hu(),uu=cu(),c=p(),eu=P(),hu=s(),R={withFallback:!0},Rh=ku.isWSL()?"WSL":du.type();switch(Rh){case"Linux":C.exports=new B(R),C.exports.Notification=B;break;case"Darwin":C.exports=new uu(R),C.exports.Notification=uu;break;case"Windows_NT":if(ku.isLessThanWin8())C.exports=new hu(R),C.exports.Notification=hu;else C.exports=new c(R),C.exports.Notification=c;break;case"WSL":C.exports=new c(R),C.exports.Notification=c;break;default:if(du.type().match(/BSD$/))C.exports=new B(R),C.exports.Notification=B;else C.exports=new eu(R),C.exports.Notification=eu}C.exports.NotifySend=B;C.exports.NotificationCenter=uu;C.exports.WindowsToaster=c;C.exports.WindowsBalloon=hu;C.exports.Growl=eu});import ru from"node:path";import lu from"node:os";import D from"node:fs";function au(u){let e=u.replace(/^~/,lu.homedir()),h=ru.resolve(e),r=ru.dirname(h);if(!D.existsSync(r))D.mkdirSync(r,{recursive:!0});return h}function iu(u,e){if(!D.existsSync(u)){process.env.DATABASE_INIT="true";return}let h=process.env.SQLITE_MAX_SIZE_MB?parseInt(process.env.SQLITE_MAX_SIZE_MB,10)*1024*1024:void 0,r=e??h??314572800,q=D.statSync(u).size,w=q/1048576;if(q>r){let E=r/1048576;console.trace(`⚠️ Database file is large: ${w.toFixed(2)}MB (limit: ${E.toFixed(2)}MB)`),console.trace(` Path: ${u}`),console.trace(" Set SQLITE_MAX_SIZE_MB to adjust limit")}}function Ah(u){let e=au(u);return process.env.SQLITE_DATABASE_URI=e,iu(e),e}var fu=Vh(bu(),1);function kh(u){if(typeof u==="string")fu.default.notify({title:"Notification",message:u});else fu.default.notify({title:u.title||"Notification",message:u.message,icon:u.icon,sound:u.sound??!0})}var lh={path:process.cwd()};export{Ah as R,kh as S,lh as T};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as x,f as I}from"./chunk-akc3s5aw.js";import"./chunk-b0beqmg2.js";import{Ag as w,Cg as v,sg as C,ug as T,zg as b}from"./chunk-88w3txtb.js";import"./chunk-v0e9bsvt.js";import"./chunk-jhxvctg5.js";import"./chunk-bk32cwxa.js";import"./chunk-qfa5v4n5.js";import"./chunk-78ksrp8v.js";import"./chunk-yb71zqvt.js";import{Wl as K}from"./chunk-4fs853nh.js";var W=K(I(),1),g=[{index:"checkpoints",prefix:"checkpoint:",schema:{"$.thread_id":{type:"TAG",AS:"thread_id"},"$.checkpoint_ns":{type:"TAG",AS:"checkpoint_ns"},"$.checkpoint_id":{type:"TAG",AS:"checkpoint_id"},"$.parent_checkpoint_id":{type:"TAG",AS:"parent_checkpoint_id"},"$.checkpoint_ts":{type:"NUMERIC",AS:"checkpoint_ts"},"$.has_writes":{type:"TAG",AS:"has_writes"},"$.source":{type:"TAG",AS:"source"},"$.step":{type:"NUMERIC",AS:"step"}}},{index:"checkpoint_blobs",prefix:"checkpoint_blob:",schema:{"$.thread_id":{type:"TAG",AS:"thread_id"},"$.checkpoint_ns":{type:"TAG",AS:"checkpoint_ns"},"$.checkpoint_id":{type:"TAG",AS:"checkpoint_id"},"$.channel":{type:"TAG",AS:"channel"},"$.version":{type:"TAG",AS:"version"},"$.type":{type:"TAG",AS:"type"}}},{index:"checkpoint_writes",prefix:"checkpoint_write:",schema:{"$.thread_id":{type:"TAG",AS:"thread_id"},"$.checkpoint_ns":{type:"TAG",AS:"checkpoint_ns"},"$.checkpoint_id":{type:"TAG",AS:"checkpoint_id"},"$.task_id":{type:"TAG",AS:"task_id"},"$.idx":{type:"NUMERIC",AS:"idx"},"$.channel":{type:"TAG",AS:"channel"},"$.type":{type:"TAG",AS:"type"}}}],f=class z extends w{client;ttlConfig;constructor(G,J){super();this.client=G,this.ttlConfig=J}static async fromUrl(G,J){let Z=W.createClient({url:G});await Z.connect();let Q=new z(Z,J);return await Q.ensureIndexes(),Q}static async fromCluster(G,J){let Z=W.createCluster({rootNodes:G});await Z.connect();let Q=new z(Z,J);return await Q.ensureIndexes(),Q}async get(G){return(await this.getTuple(G))?.checkpoint}async getTuple(G){let J=G.configurable?.thread_id,Z=G.configurable?.checkpoint_ns??"",Q=G.configurable?.checkpoint_id;if(!J)return;let Y,E;if(Q)Y=`checkpoint:${J}:${Z}:${Q}`,E=await this.client.json.get(Y);else{let $=`checkpoint:${J}:${Z}:*`,_=await this.client.keys($);if(_.length===0)return;_.sort(),Y=_[_.length-1],E=await this.client.json.get(Y)}if(!E)return;if(this.ttlConfig?.refreshOnRead&&this.ttlConfig?.defaultTTL)await this.applyTTL(Y);let{checkpoint:F,pendingWrites:X}=await this.loadCheckpointWithWrites(E);return await this.createCheckpointTuple(E,F,X)}async put(G,J,Z,Q){await this.ensureIndexes();let Y=G.configurable?.thread_id,E=G.configurable?.checkpoint_ns??"",F=G.configurable?.checkpoint_id;if(!Y)throw Error("thread_id is required");let X=J.id||C(0),$=`checkpoint:${Y}:${E}:${X}`,_=b(J);if(_.channel_values&&Q!==void 0)if(Object.keys(Q).length===0)_.channel_values={};else{let U={};for(let B of Object.keys(Q))if(B in _.channel_values)U[B]=_.channel_values[B];_.channel_values=U}let H={thread_id:Y,checkpoint_ns:E===""?"__empty__":E,checkpoint_id:X,parent_checkpoint_id:F||null,checkpoint:_,metadata:Z,checkpoint_ts:Date.now(),has_writes:"false"};if(this.addSearchableMetadataFields(H,Z),await this.client.json.set($,"$",H),this.ttlConfig?.defaultTTL)await this.applyTTL($);return{configurable:{thread_id:Y,checkpoint_ns:E,checkpoint_id:X}}}async*list(G,J){if(await this.ensureIndexes(),J?.filter!==void 0){let Q=Object.values(J.filter).some((X)=>X===null),Y=[];if(G?.configurable?.thread_id){let X=G.configurable.thread_id.replace(/[-.@]/g,"\\$&");Y.push(`(@thread_id:{${X}})`)}if(G?.configurable?.checkpoint_ns!==void 0){let X=G.configurable.checkpoint_ns;if(X==="")Y.push("(@checkpoint_ns:{__empty__})");else{let $=X.replace(/[-.@]/g,"\\$&");Y.push(`(@checkpoint_ns:{${$}})`)}}if(!J?.before&&J?.filter){for(let[X,$]of Object.entries(J.filter))if($===void 0);else if($===null);else if(typeof $==="string"){let _=x(X),H=x($);Y.push(`(@${_}:{${H}})`)}else if(typeof $==="number"){let _=x(X);Y.push(`(@${_}:[${$} ${$}])`)}else if(typeof $==="object"&&Object.keys($).length===0);}if(Y.length===0)Y.push("*");let E=Y.join(" "),F=J?.limit??10;try{let X=J?.before&&!G?.configurable?.thread_id?1000:J?.before?F*10:F,$=(await this.client.ft.search("checkpoints",E,{LIMIT:{from:0,size:X},SORTBY:{BY:"checkpoint_ts",DIRECTION:"DESC"}})).documents,_=0;for(let H of $){if(_>=F)break;if(J?.before?.configurable?.checkpoint_id){if(H.value.checkpoint_id>=J.before.configurable.checkpoint_id)continue}let U=H.value,B=!0;if((Q||J?.before)&&J?.filter){for(let[M,O]of Object.entries(J.filter))if(O===null){if(U.metadata?.[M]!==null){B=!1;break}}else if(O!==void 0){let A=U.metadata?.[M];if(typeof O==="object"&&O!==null){if(q(A)!==q(O)){B=!1;break}}else if(A!==O){B=!1;break}}if(!B)continue}let{checkpoint:L,pendingWrites:R}=await this.loadCheckpointWithWrites(U);yield await this.createCheckpointTuple(U,L,R),_++}return}catch(X){if(X.message?.includes("no such index"));else throw X}if(G?.configurable?.thread_id){let X=G.configurable.thread_id,$=G.configurable.checkpoint_ns??"",_=`checkpoint:${X}:${$}:*`,H=await this.client.keys(_);H.sort().reverse();let U=H;if(J?.before?.configurable?.checkpoint_id){let R=`checkpoint:${J.before.configurable.thread_id||X}:${J.before.configurable.checkpoint_ns??$}:${J.before.configurable.checkpoint_id}`,M=H.indexOf(R);if(M>0)U=H.slice(M+1);else if(M===0)U=[]}let B=J?.limit??10,L=U.slice(0,B);for(let R of L){let M=await this.client.json.get(R);if(M){let O=!0;for(let[V,S]of Object.entries(J.filter)){let N=M.metadata?.[V];if(S===null){if(N!==null){O=!1;break}}else if(N!==S){O=!1;break}}if(!O)continue;let{checkpoint:A,pendingWrites:P}=await this.loadCheckpointWithWrites(M);yield await this.createCheckpointTuple(M,A,P)}}}else{let X=G?.configurable?.checkpoint_ns!==void 0?`checkpoint:*:${G.configurable.checkpoint_ns===""?"__empty__":G.configurable.checkpoint_ns}:*`:"checkpoint:*",$=await this.client.keys(X),_=[];for(let B of $){let L=await this.client.json.get(B);if(L)_.push({key:B,doc:L})}_.sort((B,L)=>L.doc.checkpoint_ts-B.doc.checkpoint_ts);let H=0,U=J?.limit??10;for(let{doc:B}of _){if(H>=U)break;if(J?.before?.configurable?.checkpoint_id){if(B.checkpoint_id>=J.before.configurable.checkpoint_id)continue}let L=!0;if(J?.filter){for(let[O,A]of Object.entries(J.filter))if(A===null){if(B.metadata?.[O]!==null){L=!1;break}}else if(A!==void 0){let P=B.metadata?.[O];if(typeof A==="object"&&A!==null){if(q(P)!==q(A)){L=!1;break}}else if(P!==A){L=!1;break}}if(!L)continue}let{checkpoint:R,pendingWrites:M}=await this.loadCheckpointWithWrites(B);yield await this.createCheckpointTuple(B,R,M),H++}}return}let Z={...J,filter:{}};yield*this.list(G,Z)}async putWrites(G,J,Z){await this.ensureIndexes();let Q=G.configurable?.thread_id,Y=G.configurable?.checkpoint_ns??"",E=G.configurable?.checkpoint_id;if(!Q||!E)throw Error("thread_id and checkpoint_id are required");let F=[],X=performance.now()*1000;for(let _=0;_<J.length;_++){let[H,U]=J[_],B=`checkpoint_write:${Q}:${Y}:${E}:${Z}:${_}`;F.push(B);let L={thread_id:Q,checkpoint_ns:Y,checkpoint_id:E,task_id:Z,idx:_,channel:H,type:typeof U==="object"?"json":"string",value:U,timestamp:X,global_idx:X+_};await this.client.json.set(B,"$",L)}if(F.length>0){let _=`write_keys_zset:${Q}:${Y}:${E}`,H={};if(F.forEach((U,B)=>{H[U]=X+B}),await this.client.zAdd(_,Object.entries(H).map(([U,B])=>({score:B,value:U}))),this.ttlConfig?.defaultTTL)await this.applyTTL(...F,_)}let $=`checkpoint:${Q}:${Y}:${E}`;if(await this.client.exists($)){let _=await this.client.json.get($);if(_)_.has_writes="true",await this.client.json.set($,"$",_)}}async deleteThread(G){let J=`checkpoint:${G}:*`,Z=await this.client.keys(J);if(Z.length>0)await this.client.del(Z);let Q=`writes:${G}:*`,Y=await this.client.keys(Q);if(Y.length>0)await this.client.del(Y)}async end(){await this.client.quit()}async loadPendingWrites(G,J,Z){let Q=`checkpoint_write:${G}:${J}:${Z}:*`,Y=await this.client.keys(Q);if(Y.length===0)return;let E=[];for(let X of Y){let $=await this.client.json.get(X);if($)E.push($)}E.sort((X,$)=>(X.global_idx||0)-($.global_idx||0));let F=[];for(let X of E){let $=await this.serde.loadsTyped("json",JSON.stringify(X.value));F.push([X.task_id,X.channel,$])}return F}async loadCheckpointWithWrites(G){let J=await this.serde.loadsTyped("json",JSON.stringify(G.checkpoint));if(J.v<4&&G.parent_checkpoint_id!=null){let Q=G.checkpoint_ns==="__empty__"?"":G.checkpoint_ns;await this.migratePendingSends(J,G.thread_id,Q,G.parent_checkpoint_id)}let Z;if(G.has_writes==="true"){let Q=G.checkpoint_ns==="__empty__"?"":G.checkpoint_ns;Z=await this.loadPendingWrites(G.thread_id,Q,G.checkpoint_id)}return{checkpoint:J,pendingWrites:Z}}async migratePendingSends(G,J,Z,Q){let Y=await this.loadPendingWrites(J,Z,Q);if(!Y||Y.length===0)return;let E=Y.filter(([,X])=>X===T);if(E.length===0)return;let F=[];for(let[,,X]of E)F.push(X);G.channel_values??={},G.channel_values[T]=F,G.channel_versions[T]=Object.keys(G.channel_versions).length>0?v(...Object.values(G.channel_versions)):1}async createCheckpointTuple(G,J,Z){let Q=G.checkpoint_ns==="__empty__"?"":G.checkpoint_ns,Y=await this.serde.loadsTyped("json",JSON.stringify(G.metadata));return{config:{configurable:{thread_id:G.thread_id,checkpoint_ns:Q,checkpoint_id:G.checkpoint_id}},checkpoint:J,metadata:Y,parentConfig:G.parent_checkpoint_id?{configurable:{thread_id:G.thread_id,checkpoint_ns:Q,checkpoint_id:G.parent_checkpoint_id}}:void 0,pendingWrites:Z}}addSearchableMetadataFields(G,J){if(!J)return;if("source"in J)G.source=J.source;if("step"in J)G.step=J.step;if("writes"in J)G.writes=typeof J.writes==="object"?JSON.stringify(J.writes):J.writes;if("score"in J)G.score=J.score}async applyTTL(...G){if(!this.ttlConfig?.defaultTTL)return;let J=Math.floor(this.ttlConfig.defaultTTL*60),Z=await Promise.allSettled(G.map((Q)=>this.client.expire(Q,J)));for(let Q=0;Q<Z.length;Q++)if(Z[Q].status==="rejected")console.warn(`Failed to set TTL for key ${G[Q]}:`,Z[Q].reason)}async ensureIndexes(){for(let G of g)try{await this.client.ft.create(G.index,G.schema,{ON:"JSON",PREFIX:G.prefix})}catch(J){if(!J.message?.includes("Index already exists"))console.error(`Failed to create index ${G.index}:`,J.message)}}};function q(z){if(z===null||typeof z!=="object")return JSON.stringify(z);if(Array.isArray(z))return JSON.stringify(z.map((Z)=>q(Z)));let G={},J=Object.keys(z).sort();for(let Z of J)G[Z]=z[Z];return JSON.stringify(G,(Z,Q)=>{if(Q!==null&&typeof Q==="object"&&!Array.isArray(Q)){let Y={},E=Object.keys(Q).sort();for(let F of E)Y[F]=Q[F];return Y}return Q})}export{f as RedisSaver};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{P as v,Q as Z}from"./chunk-q8cfxky4.js";import{U as k,X as Q,Y as G,fa as F,ga as M,ka as O}from"./chunk-h7ypcqp3.js";import"./chunk-bn077sjq.js";import"./chunk-9011y634.js";import"./chunk-v0e9bsvt.js";import"./chunk-j8tq0e8m.js";import"./chunk-bk32cwxa.js";import"./chunk-qfa5v4n5.js";import"./chunk-0kfw8bwn.js";import"./chunk-78ksrp8v.js";import"./chunk-yb71zqvt.js";import{Wl as Y}from"./chunk-4fs853nh.js";var N=Y(k(),1);var y=Y(k(),1);var J=Y(F(),1),h=({pid:z,onClose:A})=>{let[H,R]=y.useState({stdout:"",stderr:""});M((W,X)=>{if(X.escape)A()}),y.useEffect(()=>{let W=()=>{let _=Z.getProcessOutput(z);if(_)R(_)};W();let X=setInterval(W,500);return()=>clearInterval(X)},[z]);let $=I(H.stdout,20),U=I(H.stderr,20);return J.jsxDEV(Q,{flexDirection:"column",padding:1,children:[J.jsxDEV(Q,{justifyContent:"space-between",marginBottom:1,children:[J.jsxDEV(G,{bold:!0,color:"cyan",children:["进程 [",z,"] 输出"]},void 0,!0,void 0,this),J.jsxDEV(G,{dimColor:!0,children:"按 ESC 返回"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV(Q,{flexDirection:"column",marginBottom:1,children:[J.jsxDEV(G,{color:"green",bold:!0,children:"STDOUT:"},void 0,!1,void 0,this),J.jsxDEV(Q,{borderStyle:"single",borderColor:"green",paddingX:1,children:J.jsxDEV(G,{children:$||"(空)"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV(Q,{flexDirection:"column",children:[J.jsxDEV(G,{color:"red",bold:!0,children:"STDERR:"},void 0,!1,void 0,this),J.jsxDEV(Q,{borderStyle:"single",borderColor:"red",paddingX:1,children:J.jsxDEV(G,{children:U||"(空)"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};function I(z,A){let H=z.split(`
|
|
2
|
+
`);if(H.length<=A)return z;return`...${H.slice(-A).join(`
|
|
3
|
+
`)}`}var g=h;var w=Y(F(),1),T=({onClose:z})=>{let[A,H]=N.useState([]),[R,$]=N.useState(null);N.useEffect(()=>{let q=async()=>{let b=await Z.getProcessList();H(b)};q();let K=setInterval(q,1000);return()=>clearInterval(K)},[]);let U=N.useCallback(async()=>{let q=await Z.getProcessList();H(q)},[]),W=N.useCallback((q,K,b)=>{let C=q.status==="running"?"\uD83D\uDFE2":"\uD83D\uDD34",B=f(q.duration);return w.jsxDEV(Q,{flexDirection:"column",children:[w.jsxDEV(Q,{children:[w.jsxDEV(G,{color:"cyan",children:[C," [",q.pid,"]"]},void 0,!0,void 0,this),w.jsxDEV(G,{children:[" ",P(q.command,40)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w.jsxDEV(Q,{paddingLeft:3,children:[w.jsxDEV(G,{dimColor:!0,children:["⏱ ",B]},void 0,!0,void 0,this),w.jsxDEV(G,{dimColor:!0,children:[" | CPU: ",q.cpu.toFixed(1),"%"]},void 0,!0,void 0,this),w.jsxDEV(G,{dimColor:!0,children:[" | MEM: ",(q.memory/1024/1024).toFixed(1),"MB"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},[]),X=N.useCallback((q)=>{Z.killProcess(q.pid)},[]),_=N.useCallback((q)=>{$(q.pid)},[]),L=N.useCallback((q)=>{return w.jsxDEV(G,{dimColor:!0,children:["运行中: ",q.filter((K)=>K.status==="running").length," | 总计: ",q.length," | Enter 查看输出 | Backspace/Delete 关闭进程"]},void 0,!0,void 0,this)},[]),S=N.useMemo(()=>({id:"processes",title:"进程管理器",icon:"⚙️",dataSource:()=>Promise.resolve(A),searchable:!0,searchFields:["command"],renderItem:W,keyExtractor:(q)=>q.pid,onSelect:_,onDelete:X,itemHeight:2,statusInfo:L,keyMap:{r:()=>{U()}}}),[A,W,_,X,L,U]);return w.jsxDEV(w.Fragment,{children:R!==null?w.jsxDEV(v,{name:"ProcessOutputPanel",fallback:null,children:w.jsxDEV(g,{pid:R,onClose:()=>$(null)},void 0,!1,void 0,this)},void 0,!1,void 0,this):w.jsxDEV(O,{config:S,onClose:z},void 0,!1,void 0,this)},void 0,!1,void 0,this)};function f(z){let A=Math.floor(z/1000),H=Math.floor(A/60),R=Math.floor(H/60);if(R>0)return`${R}h ${H%60}m`;if(H>0)return`${H}m ${A%60}s`;return`${A}s`}function P(z,A){return z.length>A?z.slice(0,A-3)+"...":z}var n=T;export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$e as b,Af as C,Bf as D,Cf as E,Df as F,Ef as G,Ff as H,Gf as I,Hf as J,If as K,Jf as L,Kf as M,Lf as N,_e as a,af as c,bf as d,cf as e,df as f,ef as g,ff as h,gf as i,hf as j,if as k,jf as l,kf as m,lf as n,mf as o,nf as p,of as q,pf as r,qf as s,rf as t,sf as u,tf as v,uf as w,vf as x,wf as y,xf as z,yf as A,zf as B}from"./chunk-7cx9kda0.js";import"./chunk-y524zd2h.js";import"./chunk-4eaqmt3c.js";import"./chunk-88w3txtb.js";import"./chunk-6j695pam.js";import"./chunk-9011y634.js";import"./chunk-v0e9bsvt.js";import"./chunk-j8tq0e8m.js";import"./chunk-jhxvctg5.js";import"./chunk-mv5m8bf4.js";import"./chunk-bk32cwxa.js";import"./chunk-qfa5v4n5.js";import"./chunk-0kfw8bwn.js";import"./chunk-78ksrp8v.js";import"./chunk-yb71zqvt.js";import"./chunk-4fs853nh.js";export{L as validateAgentConfig,r as toStandardTool,K as parseAgentMd,u as listSkills,w as listMemories,M as isAgentMdContent,J as humanInTheLoopMiddleware,H as getAgentListFromPackage,q as fromLangChainTool,F as create_task_tool,G as createTaskTool,A as createMCPMiddleware,s as anthropicPromptCachingMiddleware,E as TaskSchema,I as SubAgentsMiddleware,C as SubAgentStateSchema,B as SubAgentSchema,D as SubAgentAnnotation,j as StandardAgent,v as SkillsMiddleware,a as ProviderTypeSchema,d as PromptVersionSchema,c as PromptSchema,b as ModelSchema,f as MiddlewareSchema,i as MiddlewareRegistry,e as MiddlewareCustomParamsSchema,p as MemoryStorage,z as MCPMiddleware,x as LoadMcpToolsSchema,y as ExecuteMcpToolSchema,N as ClaudeAgentLoader,o as BaseStorage,t as AgentsMdMiddleware,l as AgentValidator,m as AgentSerializer,g as AgentSchema,k as AgentRepository,h as AgentPackageSchema,n as AgentPackage};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{writeFileSync as B,readFileSync as C,existsSync as u,mkdirSync as G}from"node:fs";import{join as H,dirname as J}from"node:path";import{randomUUID as K}from"node:crypto";class z{errors=[];filePath;maxEntries;isLoaded=!1;constructor(b){this.filePath=b?.filePath||H(process.cwd(),".zen-code","errors.json"),this.maxEntries=b?.maxEntries||500,this.ensureDirectory()}ensureDirectory(){let b=J(this.filePath);if(!u(b))G(b,{recursive:!0})}loadFromFile(){if(this.isLoaded)return;try{if(u(this.filePath)){let b=C(this.filePath,"utf-8"),q=JSON.parse(b);if(Array.isArray(q))this.errors=q}}catch(b){this.errors=[]}this.isLoaded=!0}saveToFile(){try{let b=JSON.stringify(this.errors,null,2);B(this.filePath,b,"utf-8")}catch(b){process.stderr.write(`[ErrorStore] Failed to save errors: ${b}
|
|
2
|
+
`)}}addError(b){this.loadFromFile();let q={...b,id:K(),timestamp:new Date().toISOString()};if(this.errors.unshift(q),this.errors.length>this.maxEntries)this.errors=this.errors.slice(0,this.maxEntries);return this.saveToFile(),q}getErrors(){return this.loadFromFile(),[...this.errors]}getRecentErrors(b=100){return this.loadFromFile(),this.errors.slice(0,b)}clearAll(){this.errors=[],this.saveToFile()}deleteError(b){this.loadFromFile();let q=this.errors.findIndex((A)=>A.id===b);if(q!==-1)return this.errors.splice(q,1),this.saveToFile(),!0;return!1}getStats(){return this.loadFromFile(),{total:this.errors.length,errors:this.errors.filter((b)=>b.level==="error").length,warnings:this.errors.filter((b)=>b.level==="warning").length}}}var O=new z;
|
|
3
|
+
export{O as Kl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{xf as x}from"./chunk-7cx9kda0.js";import"./chunk-y524zd2h.js";import"./chunk-4eaqmt3c.js";import"./chunk-88w3txtb.js";import"./chunk-6j695pam.js";import"./chunk-9011y634.js";import"./chunk-v0e9bsvt.js";import"./chunk-j8tq0e8m.js";import"./chunk-sv0k2v66.js";import{xk as v}from"./chunk-gphssgy6.js";import"./chunk-2gprcgep.js";import"./chunk-dz9sqfph.js";import"./chunk-c9yrpb3g.js";import"./chunk-jhxvctg5.js";import"./chunk-mv5m8bf4.js";import"./chunk-bk32cwxa.js";import"./chunk-qfa5v4n5.js";import"./chunk-0kfw8bwn.js";import"./chunk-78ksrp8v.js";import"./chunk-yb71zqvt.js";import"./chunk-4fs853nh.js";var u=null;function A(){if(!u)u=(async()=>{let k=new v;return await k.initialize(),k})();return u}class z extends x{constructor(k){super({configProvider:async()=>z.loadConfigFromStore(),cache:k})}static async loadConfigFromStore(){try{let q=await(await A()).getConfig();if(!q.mcp_config||Object.keys(q.mcp_config).length===0)return null;return{servers:q.mcp_config}}catch(k){return console.error("Failed to load MCP config from store:",k),null}}}export{z as MCPWithConfigMiddleware};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{xa as a}from"./chunk-snmkgfbe.js";import"./chunk-y524zd2h.js";import"./chunk-4eaqmt3c.js";import"./chunk-88w3txtb.js";import"./chunk-0mq8786q.js";import"./chunk-tws3wcnm.js";import"./chunk-v0e9bsvt.js";import"./chunk-jhxvctg5.js";import"./chunk-bk32cwxa.js";import"./chunk-qfa5v4n5.js";import"./chunk-0kfw8bwn.js";import"./chunk-78ksrp8v.js";import"./chunk-yb71zqvt.js";import"./chunk-4fs853nh.js";export{a as WebMiddleware};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import k from"fs/promises";import q from"path";import z from"os";class A{pluginsDir;constructor(){let b=z.homedir();this.pluginsDir=q.join(b,".zen-code","plugins")}async listPlugins(){try{let b=await k.readdir(this.pluginsDir,{withFileTypes:!0}),d=[];for(let j of b)if(j.isDirectory()){let v=q.join(this.pluginsDir,j.name,"plugin.json");try{let x=await k.readFile(v,"utf-8"),w=JSON.parse(x);d.push({name:j.name,version:w.version||"0.0.0",enabled:w.enabled!==!1})}catch{}}return d}catch{return[]}}async getPluginConfig(b){let d=q.join(this.pluginsDir,b,"plugin.json");try{let j=await k.readFile(d,"utf-8");return JSON.parse(j)}catch{return null}}async updatePluginConfig(b,d){let j=q.join(this.pluginsDir,b);await k.mkdir(j,{recursive:!0});let v=q.join(j,"plugin.json");await k.writeFile(v,JSON.stringify(d,null,2),"utf-8")}async installPlugin(b,d){let j=q.join(this.pluginsDir,b);await k.mkdir(j,{recursive:!0});let v={name:b,version:"0.0.1",enabled:!0,source:d};await this.updatePluginConfig(b,v)}async uninstallPlugin(b){let d=q.join(this.pluginsDir,b);await k.rm(d,{recursive:!0,force:!0})}}
|
|
2
|
+
export{A as zk};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as P}from"./chunk-5fe27s34.js";import{$ as h,U as S,X as W,Y as w,aa as m,fa as I,ia as A,ka as B}from"./chunk-h7ypcqp3.js";import{Wl as _}from"./chunk-4fs853nh.js";var K=_(S(),1);var q=_(I(),1),b={success:{emoji:"✅",color:"green"},failed:{emoji:"❌",color:"red"},running:{emoji:"\uD83D\uDD04",color:"yellow"},queued:{emoji:"⏳",color:"cyan"},pending:{emoji:"⏸",color:"gray"}},C=({task:J,onClose:Y,onToggle:R,onTrigger:U})=>{let Z=P(),[v,N]=K.default.useState([]),[X,G]=K.default.useState(!0);return K.default.useEffect(()=>{let Q=!1;return(async()=>{try{let $=await Z.cron.getLogs.query({taskId:J.id,limit:10});if(!Q)N($)}catch{}finally{if(!Q)G(!1)}})(),()=>{Q=!0}},[J.id,Z]),m((Q,$)=>{if($.escape||$.ctrl&&Q==="c")Y();else if(Q==="t")R(J.id);else if(Q==="r")U(J.id)}),q.jsxDEV(W,{flexDirection:"column",padding:1,flexGrow:1,children:[q.jsxDEV(W,{marginBottom:1,borderStyle:"round",borderColor:"cyan",padding:1,flexDirection:"column",children:[q.jsxDEV(W,{children:[q.jsxDEV(w,{bold:!0,color:"cyan",children:["⏰ ",J.name]},void 0,!0,void 0,this),q.jsxDEV(h,{},void 0,!1,void 0,this),q.jsxDEV(w,{color:J.enabled?"green":"red",children:J.enabled?"● 启用":"○ 禁用"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.description&&q.jsxDEV(w,{color:"gray",dimColor:!0,children:J.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV(W,{flexDirection:"column",marginBottom:1,children:[q.jsxDEV(W,{children:[q.jsxDEV(w,{color:"yellow",bold:!0,children:["Cron:"," "]},void 0,!0,void 0,this),q.jsxDEV(w,{color:"white",children:J.cron_expression},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV(W,{children:[q.jsxDEV(w,{color:"yellow",bold:!0,children:["Agent:"," "]},void 0,!0,void 0,this),q.jsxDEV(w,{color:"cyan",children:J.agent_id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.max_retries>0&&q.jsxDEV(W,{children:[q.jsxDEV(w,{color:"yellow",bold:!0,children:["最大重试:"," "]},void 0,!0,void 0,this),q.jsxDEV(w,{children:J.max_retries},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV(W,{children:q.jsxDEV(w,{color:"gray",dimColor:!0,children:["Prompt: ",J.prompt.slice(0,60),J.prompt.length>60?"...":""]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV(W,{flexDirection:"column",flexGrow:1,children:[q.jsxDEV(w,{bold:!0,color:"blue",children:"最近执行记录"},void 0,!1,void 0,this),X?q.jsxDEV(w,{color:"gray",children:"加载中..."},void 0,!1,void 0,this):v.length===0?q.jsxDEV(w,{color:"gray",dimColor:!0,children:"暂无执行记录"},void 0,!1,void 0,this):v.slice(0,8).map((Q)=>{let $=b[Q.status]??b.pending,L=new Date(Q.started_at).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return q.jsxDEV(W,{children:[q.jsxDEV(w,{color:$.color,children:[$.emoji," ",L]},void 0,!0,void 0,this),Q.error_message&&q.jsxDEV(w,{color:"red",dimColor:!0,children:[" ",Q.error_message.slice(0,40)]},void 0,!0,void 0,this)]},Q.id,!0,void 0,this)})]},void 0,!0,void 0,this),q.jsxDEV(W,{marginTop:1,children:q.jsxDEV(w,{color:"gray",dimColor:!0,children:"[T] 切换启用 | [R] 手动触发 | [ESC] 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},p=({onClose:J})=>{let Y=P(),[R,U]=K.useState([]),[Z,v]=K.useState(null),[N,X]=K.useState(null),G=K.useCallback(async()=>{let H=await Y.cron.listTasks.query();return U(H),H},[Y]),Q=K.useCallback(async(z)=>{try{await Y.cron.toggleTask.mutate({id:z}),X("任务状态已切换"),setTimeout(()=>X(null),2000);let H=await Y.cron.listTasks.query();if(U(H),Z?.id===z){let F=H.find((O)=>O.id===z);if(F)v(F)}}catch(H){X(`切换失败: ${H instanceof Error?H.message:String(H)}`),setTimeout(()=>X(null),3000)}},[Y,Z]),$=K.useCallback(async(z)=>{try{await Y.cron.triggerTask.mutate({id:z}),X("任务已触发执行"),setTimeout(()=>X(null),2000)}catch(H){X(`触发失败: ${H instanceof Error?H.message:String(H)}`),setTimeout(()=>X(null),3000)}},[Y]),L=K.useCallback(()=>{v(null)},[]),y=K.useCallback((z,H,F)=>{return q.jsxDEV(A,{isSelected:F,children:q.jsxDEV(W,{children:[q.jsxDEV(w,{color:z.enabled?"green":"gray",dimColor:!z.enabled,children:[z.enabled?"●":"○"," ",H+1,". ",z.name]},void 0,!0,void 0,this),q.jsxDEV(h,{},void 0,!1,void 0,this),q.jsxDEV(w,{color:"yellow",dimColor:!0,children:z.cron_expression},void 0,!1,void 0,this),q.jsxDEV(w,{color:"cyan",dimColor:!0,children:[" ",z.agent_id]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},`cron-${z.id}`,!1,void 0,this)},[]),f=K.useCallback((z)=>{let H=z.filter((O)=>O.enabled).length,F=z.length-H;return q.jsxDEV(w,{color:"gray",children:["启用: ",q.jsxDEV(w,{color:"green",children:H},void 0,!1,void 0,this)," | 禁用: ",q.jsxDEV(w,{color:"red",children:F},void 0,!1,void 0,this),N&&q.jsxDEV(w,{color:"yellow",children:[" | ",N]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},[N]),M=K.useMemo(()=>({id:"cron",title:"Cron 定时任务",icon:"⏰",dataSource:G,searchable:!0,searchFields:["name","description","cron_expression","agent_id"],searchPlaceholder:"搜索任务 (名称/cron/agent)...",filterable:!0,filters:[{id:"all",label:"全部",predicate:()=>!0},{id:"enabled",label:"启用",predicate:(z)=>z.enabled},{id:"disabled",label:"禁用",predicate:(z)=>!z.enabled}],defaultFilter:"all",itemHeight:1,visibleCount:15,renderItem:y,onSelect:v,showCount:!0,statusInfo:f}),[G,y,f]);if(Z)return q.jsxDEV(C,{task:Z,onClose:L,onToggle:Q,onTrigger:$},void 0,!1,void 0,this);return q.jsxDEV(B,{config:M,onClose:J},void 0,!1,void 0,this)},g=p;export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ll as I,Ml as v,Nl as x,Pl as b,Ql as _,Tl as d}from"./chunk-mk8ggmt8.js";import{$l as j}from"./chunk-4fs853nh.js";var{create:NQ,defineProperty:p,getOwnPropertyDescriptor:VQ,getOwnPropertyNames:a,getPrototypeOf:BQ}=Object,WQ=Object.prototype.hasOwnProperty,q=(X,Q)=>function(){return Q||(0,X[a(X)[0]])((Q={exports:{}}).exports,Q),Q.exports},FQ=(X,Q,Z,z)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(var Y=a(Q),K=0,J=Y.length,G;K<J;K++)if(G=Y[K],!WQ.call(X,G)&&G!==Z)p(X,G,{get:((H)=>Q[H]).bind(null,G),enumerable:!(z=VQ(Q,G))||z.enumerable})}return X},A=(X,Q,Z)=>(Z=X!=null?NQ(BQ(X)):{},FQ(Q||!X||!X.__esModule?p(Z,"default",{value:X,enumerable:!0}):Z,X)),s=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(X,Q){function Z(z){return Q.exports=Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Y){return typeof Y}:function(Y){return Y&&typeof Symbol=="function"&&Y.constructor===Symbol&&Y!==Symbol.prototype?"symbol":typeof Y},Q.exports.__esModule=!0,Q.exports.default=Q.exports,Z(z)}Q.exports=Z,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),DQ=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(X,Q){var Z=s().default;function z(Y,K){if(Z(Y)!="object"||!Y)return Y;var J=Y[Symbol.toPrimitive];if(J!==void 0){var G=J.call(Y,K||"default");if(Z(G)!="object")return G;throw TypeError("@@toPrimitive must return a primitive value.")}return(K==="string"?String:Number)(Y)}Q.exports=z,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),AQ=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(X,Q){var Z=s().default,z=DQ();function Y(K){var J=z(K,"string");return Z(J)=="symbol"?J:J+""}Q.exports=Y,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),T=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(X,Q){var Z=AQ();function z(Y,K,J){return(K=Z(K))in Y?Object.defineProperty(Y,K,{value:J,enumerable:!0,configurable:!0,writable:!0}):Y[K]=J,Y}Q.exports=z,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),L=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(X,Q){var Z=T();function z(K,J){var G=Object.keys(K);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(K);J&&(H=H.filter(function(N){return Object.getOwnPropertyDescriptor(K,N).enumerable})),G.push.apply(G,H)}return G}function Y(K){for(var J=1;J<arguments.length;J++){var G=arguments[J]!=null?arguments[J]:{};J%2?z(Object(G),!0).forEach(function(H){Z(K,H,G[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties(K,Object.getOwnPropertyDescriptors(G)):z(Object(G)).forEach(function(H){Object.defineProperty(K,H,Object.getOwnPropertyDescriptor(G,H))})}return K}Q.exports=Y,Q.exports.__esModule=!0,Q.exports.default=Q.exports}});function $(X){return(Q)=>{let Z=0,z=null,Y=[];function K(){if(z)return;z=Q.subscribe({next(G){for(let N of Y){var H;(H=N.next)===null||H===void 0||H.call(N,G)}},error(G){for(let N of Y){var H;(H=N.error)===null||H===void 0||H.call(N,G)}},complete(){for(let H of Y){var G;(G=H.complete)===null||G===void 0||G.call(H)}}})}function J(){if(Z===0&&z){let G=z;z=null,G.unsubscribe()}}return I((G)=>{return Z++,Y.push(G),K(),{unsubscribe(){Z--,J();let H=Y.findIndex((N)=>N===G);if(H>-1)Y.splice(H,1)}}})}}var iQ=Symbol();function C(X){let Q=X,Z=[],z=(J)=>{if(Q!==void 0)J.next(Q);Z.push(J)},Y=(J)=>{Z.splice(Z.indexOf(J),1)},K=I((J)=>{return z(J),()=>{Y(J)}});return K.next=(J)=>{if(Q===J)return;Q=J;for(let G of Z)G.next(J)},K.get=()=>Q,K}function o(X){return I((Q)=>{function Z(Y=0,K=X.op){let J=X.links[Y];if(!J)throw Error("No more links to execute - did you forget to add an ending link?");return J({op:K,next(H){return Z(Y+1,H)}})}return Z().subscribe(Q)})}var k=A(T(),1),w=A(L(),1);function r(X){return X instanceof O}function qQ(X){return x(X)&&x(X.error)&&typeof X.error.code==="number"&&typeof X.error.message==="string"}function TQ(X,Q){if(typeof X==="string")return X;if(x(X)&&typeof X.message==="string")return X.message;return Q}var O=class X extends Error{constructor(Q,Z){var z,Y;let K=Z===null||Z===void 0?void 0:Z.cause;super(Q,{cause:K});(0,k.default)(this,"cause",void 0),(0,k.default)(this,"shape",void 0),(0,k.default)(this,"data",void 0),(0,k.default)(this,"meta",void 0),this.meta=Z===null||Z===void 0?void 0:Z.meta,this.cause=K,this.shape=Z===null||Z===void 0||(z=Z.result)===null||z===void 0?void 0:z.error,this.data=Z===null||Z===void 0||(Y=Z.result)===null||Y===void 0?void 0:Y.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,X.prototype)}static from(Q,Z={}){let z=Q;if(r(z)){if(Z.meta)z.meta=(0,w.default)((0,w.default)({},z.meta),Z.meta);return z}if(qQ(z))return new X(z.error.message,(0,w.default)((0,w.default)({},Z),{},{result:z,cause:Z.cause}));return new X(TQ(z,"Unknown error"),(0,w.default)((0,w.default)({},Z),{},{cause:z}))}};function y(X){let Q=X;if(!Q)return{input:{serialize:(Z)=>Z,deserialize:(Z)=>Z},output:{serialize:(Z)=>Z,deserialize:(Z)=>Z}};if("input"in Q)return Q;return{input:Q,output:Q}}var t=(X)=>typeof X==="function";function e(X){if(X)return X;if(typeof window<"u"&&t(window.fetch))return window.fetch;if(typeof globalThis<"u"&&t(globalThis.fetch))return globalThis.fetch;throw Error("No fetch implementation found")}var P=A(L());function h(X){return{url:X.url.toString(),fetch:X.fetch,transformer:y(X.transformer),methodOverride:X.methodOverride}}function IQ(X){let Q={};for(let Z=0;Z<X.length;Z++){let z=X[Z];Q[Z]=z}return Q}var OQ={query:"GET",mutation:"POST",subscription:"PATCH"};function QQ(X){return"input"in X?X.transformer.input.serialize(X.input):IQ(X.inputs.map((Q)=>X.transformer.input.serialize(Q)))}var S=(X)=>{let Q=X.url.split("?"),z=Q[0].replace(/\/$/,"")+"/"+X.path,Y=[];if(Q[1])Y.push(Q[1]);if("inputs"in X)Y.push("batch=1");if(X.type==="query"||X.type==="subscription"){let K=QQ(X);if(K!==void 0&&X.methodOverride!=="POST")Y.push(`input=${encodeURIComponent(JSON.stringify(K))}`)}if(Y.length)z+="?"+Y.join("&");return z},XQ=(X)=>{if(X.type==="query"&&X.methodOverride!=="POST")return;let Q=QQ(X);return Q!==void 0?JSON.stringify(Q):void 0},u=(X)=>{return YQ((0,P.default)((0,P.default)({},X),{},{contentTypeHeader:"application/json",getUrl:S,getBody:XQ}))},EQ=class extends Error{constructor(){super("AbortError");this.name="AbortError",this.message="AbortError"}},wQ=(X)=>{var Q;if(!(X===null||X===void 0?void 0:X.aborted))return;if((Q=X.throwIfAborted)===null||Q===void 0||Q.call(X),typeof DOMException<"u")throw new DOMException("AbortError","AbortError");throw new EQ};async function ZQ(X){var Q;wQ(X.signal);let Z=X.getUrl(X),z=X.getBody(X),Y=(Q=X.methodOverride)!==null&&Q!==void 0?Q:OQ[X.type],K=await(async()=>{let G=await X.headers();if(Symbol.iterator in G)return Object.fromEntries(G);return G})(),J=(0,P.default)((0,P.default)((0,P.default)({},X.contentTypeHeader&&Y!=="GET"?{"content-type":X.contentTypeHeader}:{}),X.trpcAcceptHeader?{"trpc-accept":X.trpcAcceptHeader}:void 0),K);return e(X.fetch)(Z,{method:Y,signal:X.signal,body:z,headers:J})}async function YQ(X){let Q={},Z=await ZQ(X);Q.response=Z;let z=await Z.json();return Q.responseJSON=z,{json:z,meta:Q}}var A0=A(L(),1);var zQ=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function m(X){let Q=null,Z=null,z=()=>{clearTimeout(Z),Z=null,Q=null};function Y(G){let H=[[]],N=0;while(!0){let F=G[N];if(!F)break;let W=H[H.length-1];if(F.aborted){var D;(D=F.reject)===null||D===void 0||D.call(F,Error("Aborted")),N++;continue}if(X.validate(W.concat(F).map((B)=>B.key))){W.push(F),N++;continue}if(W.length===0){var V;(V=F.reject)===null||V===void 0||V.call(F,Error("Input is too big for a single dispatch")),N++;continue}H.push([])}return H}function K(){let G=Y(Q);z();for(let H of G){if(!H.length)continue;let N={items:H};for(let V of H)V.batch=N;X.fetch(N.items.map((V)=>V.key)).then(async(V)=>{await Promise.all(V.map(async(W,U)=>{let B=N.items[U];try{var M;let R=await Promise.resolve(W);(M=B.resolve)===null||M===void 0||M.call(B,R)}catch(R){var f;(f=B.reject)===null||f===void 0||f.call(B,R)}B.batch=null,B.reject=null,B.resolve=null}));for(let W of N.items){var F;(F=W.reject)===null||F===void 0||F.call(W,Error("Missing result")),W.batch=null}}).catch((V)=>{for(let W of N.items){var F;(F=W.reject)===null||F===void 0||F.call(W,V),W.batch=null}})}}function J(G){var H;let N={aborted:!1,key:G,batch:null,resolve:zQ,reject:zQ},D=new Promise((V,F)=>{var W;N.reject=F,N.resolve=V,(W=Q)!==null&&W!==void 0||(Q=[]),Q.push(N)});return(H=Z)!==null&&H!==void 0||(Z=setTimeout(K)),D}return{load:J}}function KQ(...X){let Q=new AbortController,Z=X.length,z=0,Y=()=>{if(++z===Z)Q.abort()};for(let K of X)if(K===null||K===void 0?void 0:K.aborted)Y();else K===null||K===void 0||K.addEventListener("abort",Y,{once:!0});return Q.signal}var g=A(L(),1);function c(X){var Q,Z;let z=h(X),Y=(Q=X.maxURLLength)!==null&&Q!==void 0?Q:1/0,K=(Z=X.maxItems)!==null&&Z!==void 0?Z:1/0;return()=>{let J=(D)=>{return{validate(V){if(Y===1/0&&K===1/0)return!0;if(V.length>K)return!1;let F=V.map((B)=>B.path).join(","),W=V.map((B)=>B.input);return S((0,g.default)((0,g.default)({},z),{},{type:D,path:F,inputs:W,signal:null})).length<=Y},async fetch(V){let F=V.map((R)=>R.path).join(","),W=V.map((R)=>R.input),U=KQ(...V.map((R)=>R.signal)),B=await u((0,g.default)((0,g.default)({},z),{},{path:F,inputs:W,type:D,headers(){if(!X.headers)return{};if(typeof X.headers==="function")return X.headers({opList:V});return X.headers},signal:U}));return(Array.isArray(B.json)?B.json:V.map(()=>B.json)).map((R)=>({meta:B.meta,json:R}))}}},G=m(J("query")),H=m(J("mutation")),N={query:G,mutation:H};return({op:D})=>{return I((V)=>{if(D.type==="subscription")throw Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let W=N[D.type].load(D),U=void 0;return W.then((B)=>{U=B;let M=d(B.json,z.transformer.output);if(!M.ok){V.error(O.from(M.error,{meta:B.meta}));return}V.next({context:B.meta,result:M.result}),V.complete()}).catch((B)=>{V.error(O.from(B,{meta:U===null||U===void 0?void 0:U.meta}))}),()=>{}})}}}var E0=A(L(),1);var l=(X,...Q)=>{return typeof X==="function"?X(...Q):X},f0=A(T(),1);function xQ(){let X,Q;return{promise:new Promise((z,Y)=>{X=z,Q=Y}),resolve:X,reject:Q}}async function PQ(X){let Q=await l(X.url);if(!X.connectionParams)return Q;let z=`${Q.includes("?")?"&":"?"}connectionParams=1`;return Q+z}async function SQ(X,Q){let Z={method:"connectionParams",data:await l(X)};return Q.encode(Z)}var C0=A(T(),1);var E=A(T(),1);function jQ(X){let{promise:Q,resolve:Z,reject:z}=xQ();return X.addEventListener("open",()=>{X.removeEventListener("error",z),Z()}),X.addEventListener("error",z),Q}function fQ(X,{intervalMs:Q,pongTimeoutMs:Z}){let z,Y;function K(){z=setTimeout(()=>{X.send("PING"),Y=setTimeout(()=>{X.close()},Z)},Q)}function J(){clearTimeout(z),K()}function G(){clearTimeout(Y),J()}X.addEventListener("open",K),X.addEventListener("message",({data:H})=>{if(clearTimeout(z),K(),H==="PONG")G()}),X.addEventListener("close",()=>{clearTimeout(z),clearTimeout(Y)})}var CQ=class X{constructor(Q){var Z;if((0,E.default)(this,"id",++X.connectCount),(0,E.default)(this,"WebSocketPonyfill",void 0),(0,E.default)(this,"urlOptions",void 0),(0,E.default)(this,"keepAliveOpts",void 0),(0,E.default)(this,"encoder",void 0),(0,E.default)(this,"wsObservable",C(null)),(0,E.default)(this,"openPromise",null),this.WebSocketPonyfill=(Z=Q.WebSocketPonyfill)!==null&&Z!==void 0?Z:WebSocket,!this.WebSocketPonyfill)throw Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=Q.urlOptions,this.keepAliveOpts=Q.keepAlive,this.encoder=Q.encoder}get ws(){return this.wsObservable.get()}set ws(Q){this.wsObservable.next(Q)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var Q=this;if(Q.openPromise)return Q.openPromise;Q.id=++X.connectCount;let Z=PQ(Q.urlOptions).then((z)=>new Q.WebSocketPonyfill(z));Q.openPromise=Z.then(async(z)=>{if(Q.ws=z,z.binaryType="arraybuffer",z.addEventListener("message",function({data:Y}){if(Y==="PING")this.send("PONG")}),Q.keepAliveOpts.enabled)fQ(z,Q.keepAliveOpts);if(z.addEventListener("close",()=>{if(Q.ws===z)Q.ws=null}),await jQ(z),Q.urlOptions.connectionParams)z.send(await SQ(Q.urlOptions.connectionParams,Q.encoder))});try{await Q.openPromise}finally{Q.openPromise=null}}async close(){var Q=this;try{await Q.openPromise}finally{var Z;(Z=Q.ws)===null||Z===void 0||Z.close()}}};(0,E.default)(CQ,"connectCount",0);var k0=A(T(),1),y0=A(L(),1);var i=A(T(),1),JQ=A(L(),1),kQ=class{constructor(X){(0,i.default)(this,"links",void 0),(0,i.default)(this,"runtime",void 0),(0,i.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=X.links.map((Q)=>Q(this.runtime))}$request(X){var Q;return o({links:this.links,op:(0,JQ.default)((0,JQ.default)({},X),{},{context:(Q=X.context)!==null&&Q!==void 0?Q:{},id:++this.requestId})}).pipe($())}async requestAsPromise(X){var Q=this;try{let Z=Q.$request(X);return(await v(Z)).result.data}catch(Z){throw O.from(Z)}}query(X,Q,Z){return this.requestAsPromise({type:"query",path:X,input:Q,context:Z===null||Z===void 0?void 0:Z.context,signal:Z===null||Z===void 0?void 0:Z.signal})}mutation(X,Q,Z){return this.requestAsPromise({type:"mutation",path:X,input:Q,context:Z===null||Z===void 0?void 0:Z.context,signal:Z===null||Z===void 0?void 0:Z.signal})}subscription(X,Q,Z){return this.$request({type:"subscription",path:X,input:Q,context:Z.context,signal:Z.signal}).subscribe({next(Y){switch(Y.result.type){case"state":{var K;(K=Z.onConnectionStateChange)===null||K===void 0||K.call(Z,Y.result);break}case"started":{var J;(J=Z.onStarted)===null||J===void 0||J.call(Z,{context:Y.context});break}case"stopped":{var G;(G=Z.onStopped)===null||G===void 0||G.call(Z);break}case"data":case void 0:{var H;(H=Z.onData)===null||H===void 0||H.call(Z,Y.result.data);break}}},error(Y){var K;(K=Z.onError)===null||K===void 0||K.call(Z,Y)},complete(){var Y;(Y=Z.onComplete)===null||Y===void 0||Y.call(Z)}})}};var yQ=Symbol.for("trpc_untypedClient"),hQ={query:"query",mutate:"mutation",subscribe:"subscription"},gQ=(X)=>{return hQ[X]};function $Q(X){let Q=b(({path:Z,args:z})=>{let Y=[...Z],K=gQ(Y.pop()),J=Y.join(".");return X[K](J,...z)});return _((Z)=>{if(Z===yQ)return X;return Q[Z]})}function HQ(X){let Q=new kQ(X);return $Q(Q)}var G8=A(L(),1);var N8=A(L(),1);var vQ=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(X,Q){function Z(Y){var K,J,G,H=2;for(typeof Symbol<"u"&&(J=Symbol.asyncIterator,G=Symbol.iterator);H--;){if(J&&(K=Y[J])!=null)return K.call(Y);if(G&&(K=Y[G])!=null)return new z(K.call(Y));J="@@asyncIterator",G="@@iterator"}throw TypeError("Object is not async iterable")}function z(Y){function K(J){if(Object(J)!==J)return Promise.reject(TypeError(J+" is not an object."));var G=J.done;return Promise.resolve(J.value).then(function(H){return{value:H,done:G}})}return z=function(G){this.s=G,this.n=G.next},z.prototype={s:null,n:null,next:function(){return K(this.n.apply(this.s,arguments))},return:function(G){var H=this.s.return;return H===void 0?Promise.resolve({value:G,done:!0}):K(H.apply(this.s,arguments))},throw:function(G){var H=this.s.return;return H===void 0?Promise.reject(G):K(H.apply(this.s,arguments))}},new z(Y)}Q.exports=Z,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),V8=A(vQ(),1);var B8=A(L(),1);var bQ=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(X,Q){function Z(){var z=typeof SuppressedError=="function"?SuppressedError:function(G,H){var N=Error();return N.name="SuppressedError",N.error=G,N.suppressed=H,N},Y={},K=[];function J(G,H){if(H!=null){if(Object(H)!==H)throw TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(G)var N=H[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(N===void 0&&(N=H[Symbol.dispose||Symbol.for("Symbol.dispose")],G))var D=N;if(typeof N!="function")throw TypeError("Object is not disposable.");D&&(N=function(){try{D.call(H)}catch(F){return Promise.reject(F)}}),K.push({v:H,d:N,a:G})}else G&&K.push({d:H,a:G});return H}return{e:Y,u:J.bind(null,!1),a:J.bind(null,!0),d:function(){var H,N=this.e,D=0;function V(){for(;H=K.pop();)try{if(!H.a&&D===1)return D=0,K.push(H),Promise.resolve().then(V);if(H.d){var W=H.d.call(H.v);if(H.a)return D|=2,Promise.resolve(W).then(V,F)}else D|=1}catch(U){return F(U)}if(D===1)return N!==Y?Promise.reject(N):Promise.resolve();if(N!==Y)throw N}function F(W){return N=N!==Y?new z(W,N):W,V()}return V()}}}Q.exports=Z,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),GQ=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(X,Q){function Z(z,Y){this.v=z,this.k=Y}Q.exports=Z,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),_Q=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(X,Q){var Z=GQ();function z(Y){return new Z(Y,0)}Q.exports=z,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),dQ=q({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(X,Q){var Z=GQ();function z(K){return function(){return new Y(K.apply(this,arguments))}}function Y(K){var J,G;function H(D,V){try{var F=K[D](V),W=F.value,U=W instanceof Z;Promise.resolve(U?W.v:W).then(function(B){if(U){var M=D==="return"?"return":"next";if(!W.k||B.done)return H(M,B);B=K[M](B).value}N(F.done?"return":"normal",B)},function(B){H("throw",B)})}catch(B){N("throw",B)}}function N(D,V){switch(D){case"return":J.resolve({value:V,done:!0});break;case"throw":J.reject(V);break;default:J.resolve({value:V,done:!1})}(J=J.next)?H(J.key,J.arg):G=null}this._invoke=function(D,V){return new Promise(function(F,W){var U={key:D,arg:V,resolve:F,reject:W,next:null};G?G=G.next=U:(J=G=U,H(D,V))})},typeof K.return!="function"&&(this.return=void 0)}Y.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Y.prototype.next=function(K){return this._invoke("next",K)},Y.prototype.throw=function(K){return this._invoke("throw",K)},Y.prototype.return=function(K){return this._invoke("return",K)},Q.exports=z,Q.exports.__esModule=!0,Q.exports.default=Q.exports}}),W8=A(bQ(),1),F8=A(_Q(),1),D8=A(dQ(),1),A8=A(L(),1);async function n(X){try{return(await fetch(`${X}/health`,{signal:AbortSignal.timeout(2000)})).ok}catch{return!1}}async function R8(X){try{return(await(await fetch(`${X}/health`)).json()).version||null}catch{return null}}async function uQ(X){let{spawn:Q}=await import("node:child_process"),{existsSync:Z}=await import("node:fs"),z=new URL("../bin/zen-core.ts",import.meta.url).pathname,Y=new URL("./zen-core.js",import.meta.url).pathname,K;if(Z(z))console.warn("DEV MODE"),K=z;else K=Y;Q(process.argv[0],[K],{detached:!0,stdio:"ignore",env:{...process.env,ZEN_CORE_PORT:String(X)}}).unref()}async function mQ(X,Q){let Z=Date.now()+Q;while(Date.now()<Z){if(await n(X))return;await new Promise((z)=>setTimeout(z,300))}throw Error(`zen-core did not start within ${Q}ms`)}async function q8(X){let{existsSync:Q,readFileSync:Z,unlinkSync:z}=await import("node:fs"),{join:Y}=await import("node:path"),{homedir:K}=await import("node:os"),J=Y(K(),".zen-code","zen-core.pid");if(Q(J)){let N=parseInt(Z(J,"utf8").trim());if(!isNaN(N))try{process.kill(N,"SIGTERM");try{z(J)}catch{}return{stopped:!0,message:`zen-core (PID ${N}) stopped`}}catch(D){if(D.code==="ESRCH"){try{z(J)}catch{}return{stopped:!1,message:"zen-core was not running (stale PID file cleaned)"}}}}let H=`http://127.0.0.1:${X??Number(process.env.ZEN_CORE_PORT||8125)}`;if(!await n(H))return{stopped:!1,message:"zen-core is not running"};return{stopped:!1,message:"zen-core is running but PID file not found — kill manually"}}async function T8(X={}){let{port:Q=Number(process.env.ZEN_CORE_PORT||8125),spawnIfNotRunning:Z=!1,timeout:z=1e4}=X,Y=`http://127.0.0.1:${Q}`;if(!await n(Y)){if(!Z)throw Error(`zen-core is not running on port ${Q}`);await uQ(Q),await mQ(Y,z)}return{trpc:HQ({links:[c({url:`${Y}/api/trpc`})]}),apiUrl:`${Y}/api/langgraph`,baseUrl:Y}}export{q8 as stopZenCore,T8 as connectToZenCore,R8 as checkZenCoreVersion};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as U}from"./chunk-ss4bh5wb.js";import"./chunk-2gd8vzrf.js";import{M as g,O as D}from"./chunk-5hqvapp1.js";import{U as C,X as w,Y as X,fa as L,ka as V}from"./chunk-h7ypcqp3.js";import"./chunk-6saqxa3z.js";import"./chunk-6j695pam.js";import"./chunk-qfa5v4n5.js";import"./chunk-0kfw8bwn.js";import"./chunk-78ksrp8v.js";import{Wl as v}from"./chunk-4fs853nh.js";var A=v(C(),1);function E(J){let{historyList:O,refreshHistoryList:Y,setHistoryFilter:Z}=U(),W=J?JSON.stringify(J):null,_=W?["history","list",W]:D.history.list();return g({queryKey:_,queryFn:async()=>{if(J)Z(J);return await Y(),O},staleTime:60000})}var G=v(L(),1),y=({onClose:J})=>{let{currentChatId:O,toHistoryChat:Y,createNewChat:Z,refreshHistoryList:W,historyFilter:_}=U(),b=A.useMemo(()=>({metadata:{path:process.cwd()}}),[]),{data:B=[],refetch:c}=E(b),p=A.useRef(W);A.default.useEffect(()=>{p.current=W},[W]);let j=(z)=>z.toLocaleTimeString(),H=(z)=>{switch(z){case"idle":return{emoji:"\uD83D\uDFE2",color:"green",text:"空闲"};case"busy":return{emoji:"\uD83D\uDFE1",color:"yellow",text:"忙碌"};case"interrupted":return{emoji:"\uD83D\uDFE0",color:"orange",text:"中断"};case"error":return{emoji:"\uD83D\uDD34",color:"red",text:"错误"};default:return{emoji:"⚪",color:"gray",text:z}}},N=A.useCallback(async()=>{return B},[B]),P=A.useCallback((z,$,Q)=>{let S=H(z.status),M=z.thread_id===O,m=j(new Date(z.updated_at)),k=z.title||z.thread_id.slice(-8),x=Q?">":" ",f=M?"▶":" ",T=(()=>{if(M)return{color:"green",bold:!0};else if(Q)return{color:"cyanBright",bold:!0};else return{color:S.color,bold:!1}})();return G.jsxDEV(w,{children:[G.jsxDEV(X,{bold:T.bold,color:T.color,children:[x,f," ",$+1,". ",k]},void 0,!0,void 0,this),G.jsxDEV(w,{flexGrow:1},void 0,!1,void 0,this),G.jsxDEV(X,{dimColor:!0,children:m},void 0,!1,void 0,this)]},z.thread_id,!0,void 0,this)},[O]),F=A.useCallback((z)=>{return z.thread_id===O},[O]),R=A.useCallback(async(z)=>{if(z.value==="new_chat")Z({});else Y(z);J()},[Z,Y,J]),q=A.useCallback((z)=>{let $=z.find((Q)=>Q.thread_id===O);return $?G.jsxDEV(X,{color:"gray",dimColor:!0,children:["当前: ",G.jsxDEV(X,{color:"green",children:$.thread_id.substring(0,8)},void 0,!1,void 0,this),G.jsxDEV(X,{children:[" ",_?.metadata?.path]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null},[O,_]),K=A.useMemo(()=>({}),[]),I=A.useMemo(()=>({id:"history",title:"历史记录",icon:"\uD83D\uDCDC",dataSource:N,searchable:!0,searchFields:["title","thread_id"],searchPlaceholder:"搜索对话标题...",filterable:!1,filters:[],defaultFilter:"all",itemHeight:1,visibleCount:10,renderItem:P,isSelected:F,onSelect:R,showCount:!0,statusInfo:q,keyMap:K}),[N,P,F,R,q,K]);return G.jsxDEV(V,{config:I,onClose:J},void 0,!1,void 0,this)},zz=y;export{zz as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import p from"os";import a from"path";import r from"fs";var t={config:{provider_id:"default",provider_type:"openai",model_id:"glm-5",providers:[{id:"default",type:"openai",apiKey:"",baseUrl:"https://api.openai.com/v1"}],compact_mode:!0}};async function n(e,i){try{let o=await r.promises.readFile(e,"utf-8");return JSON.parse(o)}catch{return i}}async function s(e,i){await r.promises.writeFile(e,JSON.stringify(i,null,2),"utf-8")}class c{zenConfigDir;dbPath;constructor(){let e=p.homedir();this.zenConfigDir=a.join(e,".zen-code"),this.dbPath=a.join(this.zenConfigDir,"settings.json")}async initialize(){await r.promises.mkdir(this.zenConfigDir,{recursive:!0});let e=await n(this.dbPath,t);if(!e.config)await s(this.dbPath,t),this.syncEnvFromConfig(t.config);else await s(this.dbPath,e),this.syncEnvFromConfig(e.config)}async getConfig(){return(await n(this.dbPath,t)).config}async updateConfig(e){let i=await n(this.dbPath,t);Object.assign(i.config,e),await s(this.dbPath,i),this.syncEnvFromConfig(i.config)}syncEnvFromConfig(e){let i=e.providers.find((o)=>o.id===e.provider_id);if(i){if(i.type==="openai")process.env.MODEL_PROVIDER="openai",process.env.OPENAI_API_KEY=i.apiKey,process.env.OPENAI_BASE_URL=i.baseUrl;else if(i.type==="anthropic")process.env.MODEL_PROVIDER="anthropic",process.env.ANTHROPIC_API_KEY=i.apiKey,process.env.ANTHROPIC_BASE_URL=i.baseUrl;else if(i.type==="gemini"||i.type==="google")process.env.MODEL_PROVIDER="gemini",process.env.GOOGLE_API_KEY=i.apiKey,process.env.GOOGLE_BASE_URL=i.baseUrl}}getZenConfigDir(){return this.zenConfigDir}}
|
|
2
|
+
export{c as xk};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as A}from"./chunk-81b2s97q.js";import"./chunk-6b3vfr39.js";import{H as h}from"./chunk-5fe27s34.js";import{M,O as $}from"./chunk-5hqvapp1.js";import{U as C,X as W,Y as X,fa as w,ka as K}from"./chunk-h7ypcqp3.js";import{Wl as F}from"./chunk-4fs853nh.js";var H=F(C(),1);function z({type:L,enabled:N=!0}){let O=h();return M({queryKey:L==="memories"?$.knowledge.memories():$.knowledge.skills(),queryFn:()=>O.knowledge.list.query({type:L}),enabled:N,staleTime:120000})}var J=F(w(),1),E=(L)=>{return L.length>80?L.slice(0,80)+"...":L},V=({onClose:L})=>{let[N,O]=H.useState("memories"),Y=H.useRef(O);H.default.useEffect(()=>{Y.current=O},[O]);let{data:Q=[]}=z({type:"memories",enabled:N==="memories"}),{data:U=[]}=z({type:"skills",enabled:N==="skills"}),Z=H.useCallback(async()=>{return N==="memories"?Q:U},[N,Q,U]),I=H.useCallback((G,f,_)=>{let g=E(G.description);return J.jsxDEV(W,{flexDirection:"column",paddingY:1,children:[J.jsxDEV(W,{children:J.jsxDEV(X,{bold:!0,color:_?"cyan":"gray",children:[f+1,". ",G.name]},void 0,!0,void 0,this)},void 0,!1,void 0,this),J.jsxDEV(W,{paddingY:1,children:J.jsxDEV(X,{color:_?"white":"gray",children:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV(W,{children:J.jsxDEV(X,{color:"cyan",dimColor:!_,children:[A(G.path),G.category&&J.jsxDEV(X,{color:"yellow",children:[" ",G.category]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},G.path,!0,void 0,this)},[]),q=H.useCallback((G)=>{console.log("Selected knowledge item:",G.name)},[]),B=H.useMemo(()=>[{id:"memory",label:"记忆",predicate:(G)=>G.type==="memory"},{id:"skill",label:"技能",predicate:(G)=>G.type==="skill"}],[]),P=H.useMemo(()=>({h:(G)=>{Y.current("memories"),G.setActiveFilter("memory")},s:(G)=>{Y.current("skills"),G.setActiveFilter("skill")}}),[]),R=H.useMemo(()=>({id:"knowledge",title:"知识库",icon:"\uD83D\uDCDA",dataSource:Z,searchable:!0,searchFields:["name","description"],searchPlaceholder:"搜索知识库 (名称/描述/分类)...",filterable:!0,filters:B,defaultFilter:N==="memories"?"memory":"skill",itemHeight:8,visibleCount:3,renderItem:I,showCount:!0,onSelect:q,keyMap:P}),[Z,B,I,q,P,N]);return J.jsxDEV(K,{config:R,onClose:L},void 0,!1,void 0,this)},u=V;export{u as default};
|