@maincode-ai/matilda-code 0.21.2 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/chunks/{agent-B4THN25M.js → agent-WBKEN3MM.js} +1 -1
- package/chunks/{agent-headless-CR55Q5QA.js → agent-headless-OJM6RWIA.js} +1 -1
- package/chunks/{anthropicContentGenerator-GW3P6NLQ.js → anthropicContentGenerator-EFVV6ZTA.js} +1 -1
- package/chunks/{chunk-CFBZKYFB.js → chunk-6QP5C76Y.js} +52 -52
- package/chunks/{chunk-MAQJCFZU.js → chunk-7LNKXNEZ.js} +526 -517
- package/chunks/{chunk-GIIMOLLN.js → chunk-C2ZWB2NT.js} +1 -1
- package/chunks/{chunk-NUJ63BIE.js → chunk-DBSJNFFU.js} +1 -1
- package/chunks/{chunk-SS5WUOSJ.js → chunk-FT76AZPN.js} +1 -1
- package/chunks/chunk-FU2PKCG5.js +108 -0
- package/chunks/{chunk-QEUJHX22.js → chunk-IZ6YBZWM.js} +13 -13
- package/chunks/{chunk-M3G4PG2T.js → chunk-JDXISO3F.js} +4 -4
- package/chunks/chunk-MJEXA2MA.js +8 -0
- package/chunks/chunk-MTMU7JYZ.js +11 -0
- package/chunks/chunk-SDTWBD62.js +8 -0
- package/chunks/{chunk-JEDNTIM3.js → chunk-ZYW5GLYY.js} +1 -1
- package/chunks/{computer-use-STZBQBFP.js → computer-use-MCXFHFTP.js} +1 -1
- package/chunks/{contextCommand-LB5MHXJY.js → contextCommand-G4LS5GW6.js} +1 -1
- package/chunks/edit-KNZAPSGJ.js +39 -0
- package/chunks/{enter-worktree-V6TA7IPP.js → enter-worktree-LJ66TFYR.js} +1 -1
- package/chunks/{enterPlanMode-KQCLOC2K.js → enterPlanMode-P6EIGU3Y.js} +1 -1
- package/chunks/{exit-worktree-B3SWF6PM.js → exit-worktree-QVQ3TLW5.js} +1 -1
- package/chunks/{exitPlanMode-7OHF37SX.js → exitPlanMode-I7SGPSG4.js} +1 -1
- package/chunks/{geminiContentGenerator-6VRAJ3BI.js → geminiContentGenerator-SBVCQ423.js} +1 -1
- package/chunks/{glob-ZAZPTZD5.js → glob-F5YOX6YA.js} +1 -1
- package/chunks/{grep-DNYRXQWA.js → grep-UOIHSM5U.js} +1 -1
- package/chunks/{matildaAgentContentGenerator-S26H4H3W.js → matildaAgentContentGenerator-EIQI4YCP.js} +10 -10
- package/chunks/{matildaContentGenerator-UFATU4UK.js → matildaContentGenerator-QMMGDPIK.js} +1 -1
- package/chunks/{monitor-HQXCJQ3M.js → monitor-GDKHPTET.js} +1 -1
- package/chunks/notebook-edit-LWH7H4WX.js +17 -0
- package/chunks/{openaiContentGenerator-XAPZXISY.js → openaiContentGenerator-TNZ6SB7H.js} +1 -1
- package/chunks/{read-file-HEVXSNSO.js → read-file-URGJTANM.js} +1 -1
- package/chunks/{ripGrep-BNBRX7HQ.js → ripGrep-SL4ICAX6.js} +1 -1
- package/chunks/{scheduler-3K7OROFK.js → scheduler-EX674HYK.js} +1 -1
- package/chunks/{serve-MBVRWSOA.js → serve-FZ4FTA5D.js} +7 -7
- package/chunks/{shell-3YF6VEDO.js → shell-LLU55LCI.js} +1 -1
- package/chunks/{skill-4GKPLUND.js → skill-KSYY6BM6.js} +1 -1
- package/chunks/src-UXJDJ3RJ.js +3 -0
- package/chunks/{symbol-search-WVNUJRET.js → symbol-search-3A66G4MP.js} +1 -1
- package/chunks/{team-create-2LLJKRSY.js → team-create-7PFAVYVV.js} +1 -1
- package/chunks/{tool-search-47TA6SG4.js → tool-search-7D46IF5G.js} +1 -1
- package/chunks/{update-goal-6WDBMJ2I.js → update-goal-EUJYH23K.js} +1 -1
- package/chunks/{web-fetch-QP42GV23.js → web-fetch-UGTFUOQN.js} +1 -1
- package/chunks/{workflow-EIZTKOPX.js → workflow-2TGFLD2R.js} +2 -2
- package/chunks/write-file-DQ6NYEJ7.js +15 -0
- package/cli.js +443 -444
- package/package.json +2 -2
- package/sandbox-macos-restrictive-open.sb +22 -2
- package/chunks/chunk-I55PXD4N.js +0 -10
- package/chunks/chunk-KFULPF66.js +0 -107
- package/chunks/chunk-OCXGNAAT.js +0 -8
- package/chunks/chunk-RBG4ERTN.js +0 -11
- package/chunks/chunk-XJDC3ZQZ.js +0 -8
- package/chunks/edit-EP7HIW5W.js +0 -39
- package/chunks/notebook-edit-S63FQCCF.js +0 -17
- package/chunks/src-4XJIGVTS.js +0 -3
- package/chunks/write-file-YT7UT6TX.js +0 -15
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{w as i}from"./chunk-UY2R3ZQ4.js";import{b as o}from"./chunk-GZPNIYVZ.js";o();import l from"node:path";function d(t,n){if(t.getApprovalMode()!=="bogan")return null;let r=l.resolve(n),s=t.getProjectRoot?.()??t.getTargetDir();if(i(r,s))return null;let e=t.getWorkspaceContext?.();if(!e||(typeof e.isPathWithinWorkspaceFresh=="function"?e.isPathWithinWorkspaceFresh(r):e.isPathWithinWorkspace(r)))return null;let a=e.getDirectories?.()??[t.getTargetDir()],p=t.getChannel?.()==="desktop"?"Approve the folder from Matilda Desktop, then retry the write.":"Use --include-directories to add extra roots, or a non-BOGAN approval mode for intentional external writes.";return`Refusing out-of-workspace write in BOGAN mode: ${r}. Workspace root(s): ${a.join(", ")}. This blocks path typos (e.g. writing under $HOME when the project is elsewhere). `+p}export{d as a};
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2025 Matilda Team
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{b as g}from"./chunk-GZPNIYVZ.js";import{a as re,d as I,e as Rn,f as ut}from"./chunk-OWGSC52X.js";var ft=I(Y=>{"use strict";g();Object.defineProperty(Y,"__esModule",{value:!0});Y.normalizePath=Y.isRootDirectory=Y.convertSlashes=Y.cleanPath=void 0;var at=re("path");function Ut(e){let t=(0,at.normalize)(e);return t.length>1&&t[t.length-1]===at.sep&&(t=t.substring(0,t.length-1)),t}Y.cleanPath=Ut;var An=/[\\/]/g;function Qt(e,t){return e.replace(An,t)}Y.convertSlashes=Qt;var En=/^[a-z]:[\\/]$/i;function Sn(e){return e==="/"||En.test(e)}Y.isRootDirectory=Sn;function xn(e,t){let{resolvePaths:r,normalizePath:n,pathSeparator:s}=t,i=process.platform==="win32"&&e.includes("/")||e.startsWith(".");if(r&&(e=(0,at.resolve)(e)),(n||i)&&(e=Ut(e)),e===".")return"";let c=e[e.length-1]!==s;return Qt(c?e+s:e,s)}Y.normalizePath=xn});var Yt=I(le=>{"use strict";g();Object.defineProperty(le,"__esModule",{value:!0});le.build=le.joinDirectoryPath=le.joinPathWithBasePath=void 0;var Cn=re("path"),wn=ft();function Vt(e,t){return t+e}le.joinPathWithBasePath=Vt;function vn(e,t){return function(r,n){return n.startsWith(e)?n.replace(e,"")+r:(0,wn.convertSlashes)((0,Cn.relative)(e,n),t.pathSeparator)+t.pathSeparator+r}}function $n(e){return e}function Pn(e,t,r){return t+e+r}le.joinDirectoryPath=Pn;function Tn(e,t){let{relativePaths:r,includeBasePath:n}=t;return r&&e?vn(e,t):n?Vt:$n}le.build=Tn});var Zt=I(ke=>{"use strict";g();Object.defineProperty(ke,"__esModule",{value:!0});ke.build=void 0;function On(e){return function(t,r){r.push(t.substring(e.length)||".")}}function Ln(e){return function(t,r,n){let s=t.substring(e.length)||".";n.every(i=>i(s,!0))&&r.push(s)}}var Fn=(e,t)=>{t.push(e||".")},Dn=(e,t,r)=>{let n=e||".";r.every(s=>s(n,!0))&&t.push(n)},kn=()=>{};function Hn(e,t){let{includeDirs:r,filters:n,relativePaths:s}=t;return r?s?n&&n.length?Ln(e):On(e):n&&n.length?Dn:Fn:kn}ke.build=Hn});var Jt=I(He=>{"use strict";g();Object.defineProperty(He,"__esModule",{value:!0});He.build=void 0;var In=(e,t,r,n)=>{n.every(s=>s(e,!1))&&r.files++},Mn=(e,t,r,n)=>{n.every(s=>s(e,!1))&&t.push(e)},Nn=(e,t,r,n)=>{r.files++},Gn=(e,t)=>{t.push(e)},jn=()=>{};function Bn(e){let{excludeFiles:t,filters:r,onlyCounts:n}=e;return t?jn:r&&r.length?n?In:Mn:n?Nn:Gn}He.build=Bn});var er=I(Ie=>{"use strict";g();Object.defineProperty(Ie,"__esModule",{value:!0});Ie.build=void 0;var qn=e=>e,Wn=()=>[""].slice(0,0);function Xn(e){return e.group?Wn:qn}Ie.build=Xn});var tr=I(Me=>{"use strict";g();Object.defineProperty(Me,"__esModule",{value:!0});Me.build=void 0;var zn=(e,t,r)=>{e.push({directory:t,files:r,dir:t})},Kn=()=>{};function Un(e){return e.group?zn:Kn}Me.build=Un});var sr=I(pe=>{"use strict";g();var Qn=pe&&pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pe,"__esModule",{value:!0});pe.build=void 0;var Ne=Qn(re("fs")),rr=re("path"),Vn=function(e,t,r){let{queue:n,options:{suppressErrors:s}}=t;n.enqueue(),Ne.default.realpath(e,(i,c)=>{if(i)return n.dequeue(s?null:i,t);Ne.default.stat(c,(a,h)=>{if(a)return n.dequeue(s?null:a,t);if(h.isDirectory()&&nr(e,c,t))return n.dequeue(null,t);r(h,c),n.dequeue(null,t)})})},Yn=function(e,t,r){let{queue:n,options:{suppressErrors:s}}=t;n.enqueue();try{let i=Ne.default.realpathSync(e),c=Ne.default.statSync(i);if(c.isDirectory()&&nr(e,i,t))return;r(c,i)}catch(i){if(!s)throw i}};function Zn(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?Yn:Vn}pe.build=Zn;function nr(e,t,r){if(r.options.useRealPaths)return Jn(t,r);let n=(0,rr.dirname)(e),s=1;for(;n!==r.root&&s<2;){let i=r.symlinks.get(n);!!i&&(i===t||i.startsWith(t)||t.startsWith(i))?s++:n=(0,rr.dirname)(n)}return r.symlinks.set(e,t),s>1}function Jn(e,t){return t.visited.includes(e+t.options.pathSeparator)}});var ir=I(je=>{"use strict";g();Object.defineProperty(je,"__esModule",{value:!0});je.build=void 0;var es=e=>e.counts,ts=e=>e.groups,rs=e=>e.paths,ns=e=>e.paths.slice(0,e.options.maxFiles),ss=(e,t,r)=>(Ge(t,r,e.counts,e.options.suppressErrors),null),is=(e,t,r)=>(Ge(t,r,e.paths,e.options.suppressErrors),null),os=(e,t,r)=>(Ge(t,r,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),us=(e,t,r)=>(Ge(t,r,e.groups,e.options.suppressErrors),null);function Ge(e,t,r,n){t(e&&!n?e:null,r)}function ls(e,t){let{onlyCounts:r,group:n,maxFiles:s}=e;return r?t?es:ss:n?t?ts:us:s?t?ns:os:t?rs:is}je.build=ls});var lr=I(ge=>{"use strict";g();var cs=ge&&ge.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ge,"__esModule",{value:!0});ge.build=void 0;var or=cs(re("fs")),ur={withFileTypes:!0},as=(e,t,r,n,s)=>{if(e.queue.enqueue(),n<0)return e.queue.dequeue(null,e);e.visited.push(t),e.counts.directories++,or.default.readdir(t||".",ur,(i,c=[])=>{s(c,r,n),e.queue.dequeue(e.options.suppressErrors?null:i,e)})},fs=(e,t,r,n,s)=>{if(n<0)return;e.visited.push(t),e.counts.directories++;let i=[];try{i=or.default.readdirSync(t||".",ur)}catch(c){if(!e.options.suppressErrors)throw c}s(i,r,n)};function hs(e){return e?fs:as}ge.build=hs});var cr=I(Be=>{"use strict";g();Object.defineProperty(Be,"__esModule",{value:!0});Be.Queue=void 0;var ht=class{onQueueEmpty;count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}};Be.Queue=ht});var ar=I(qe=>{"use strict";g();Object.defineProperty(qe,"__esModule",{value:!0});qe.Counter=void 0;var dt=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}};qe.Counter=dt});var _t=I(Z=>{"use strict";g();var ds=Z&&Z.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ps=Z&&Z.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ce=Z&&Z.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ds(t,e,r);return ps(t,e),t};Object.defineProperty(Z,"__esModule",{value:!0});Z.Walker=void 0;var fr=re("path"),We=ft(),pt=ce(Yt()),gs=ce(Zt()),_s=ce(Jt()),bs=ce(er()),Rs=ce(tr()),ms=ce(sr()),ys=ce(ir()),As=ce(lr()),Es=cr(),Ss=ar(),gt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,n){this.isSynchronous=!n,this.callbackInvoker=ys.build(r,this.isSynchronous),this.root=(0,We.normalizePath)(t,r),this.state={root:(0,We.isRootDirectory)(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new Ss.Counter,options:r,queue:new Es.Queue((s,i)=>this.callbackInvoker(i,s,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new AbortController},this.joinPath=pt.build(this.root,r),this.pushDirectory=gs.build(this.root,r),this.pushFile=_s.build(r),this.getArray=bs.build(r),this.groupFiles=Rs.build(r),this.resolveSymlink=ms.build(r,this.isSynchronous),this.walkDirectory=As.build(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,n)=>{let{paths:s,options:{filters:i,resolveSymlinks:c,excludeSymlinks:a,exclude:h,maxFiles:d,signal:b,useRealPaths:E,pathSeparator:S},controller:D}=this.state;if(D.signal.aborted||b&&b.aborted||d&&s.length>d)return;let R=this.getArray(this.state.paths);for(let y=0;y<t.length;++y){let $=t[y];if($.isFile()||$.isSymbolicLink()&&!c&&!a){let C=this.joinPath($.name,r);this.pushFile(C,R,this.state.counts,i)}else if($.isDirectory()){let C=pt.joinDirectoryPath($.name,r,this.state.options.pathSeparator);if(h&&h($.name,C))continue;this.pushDirectory(C,s,i),this.walkDirectory(this.state,C,C,n-1,this.walk)}else if(this.resolveSymlink&&$.isSymbolicLink()){let C=pt.joinPathWithBasePath($.name,r);this.resolveSymlink(C,this.state,(v,L)=>{if(v.isDirectory()){if(L=(0,We.normalizePath)(L,this.state.options),h&&h($.name,E?L:C+S))return;this.walkDirectory(this.state,L,E?L:C+S,n-1,this.walk)}else{L=E?L:C;let W=(0,fr.basename)(L),A=(0,We.normalizePath)((0,fr.dirname)(L),this.state.options);L=this.joinPath(W,A),this.pushFile(L,R,this.state.counts,i)}})}}this.groupFiles(this.state.groups,r,R)}};Z.Walker=gt});var dr=I(_e=>{"use strict";g();Object.defineProperty(_e,"__esModule",{value:!0});_e.callback=_e.promise=void 0;var xs=_t();function Cs(e,t){return new Promise((r,n)=>{hr(e,t,(s,i)=>{if(s)return n(s);r(i)})})}_e.promise=Cs;function hr(e,t,r){new xs.Walker(e,t,r).start()}_e.callback=hr});var pr=I(Xe=>{"use strict";g();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.sync=void 0;var ws=_t();function vs(e,t){return new ws.Walker(e,t).start()}Xe.sync=vs});var _r=I(ze=>{"use strict";g();Object.defineProperty(ze,"__esModule",{value:!0});ze.APIBuilder=void 0;var gr=dr(),$s=pr(),bt=class{root;options;constructor(t,r){this.root=t,this.options=r}withPromise(){return(0,gr.promise)(this.root,this.options)}withCallback(t){(0,gr.callback)(this.root,this.options,t)}sync(){return(0,$s.sync)(this.root,this.options)}};ze.APIBuilder=bt});var Ee=I((Do,Ar)=>{"use strict";g();var J="\\\\/",br=`[^${J}]`,ne="\\.",Ps="\\+",Ts="\\?",Ke="\\/",Os="(?=.)",Rr="[^/]",Rt=`(?:${Ke}|$)`,mr=`(?:^|${Ke})`,mt=`${ne}{1,2}${Rt}`,Ls=`(?!${ne})`,Fs=`(?!${mr}${mt})`,Ds=`(?!${ne}{0,1}${Rt})`,ks=`(?!${mt})`,Hs=`[^.${Ke}]`,Is=`${Rr}*?`,Ms="/",yr={DOT_LITERAL:ne,PLUS_LITERAL:Ps,QMARK_LITERAL:Ts,SLASH_LITERAL:Ke,ONE_CHAR:Os,QMARK:Rr,END_ANCHOR:Rt,DOTS_SLASH:mt,NO_DOT:Ls,NO_DOTS:Fs,NO_DOT_SLASH:Ds,NO_DOTS_SLASH:ks,QMARK_NO_DOT:Hs,STAR:Is,START_ANCHOR:mr,SEP:Ms},Ns={...yr,SLASH_LITERAL:`[${J}]`,QMARK:br,STAR:`${br}*?`,DOTS_SLASH:`${ne}{1,2}(?:[${J}]|$)`,NO_DOT:`(?!${ne})`,NO_DOTS:`(?!(?:^|[${J}])${ne}{1,2}(?:[${J}]|$))`,NO_DOT_SLASH:`(?!${ne}{0,1}(?:[${J}]|$))`,NO_DOTS_SLASH:`(?!${ne}{1,2}(?:[${J}]|$))`,QMARK_NO_DOT:`[^.${J}]`,START_ANCHOR:`(?:^|[${J}])`,END_ANCHOR:`(?:[${J}]|$)`,SEP:"\\"},Gs={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"};Ar.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Gs,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:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},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,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?Ns:yr}}});var Se=I(K=>{"use strict";g();var{REGEX_BACKSLASH:js,REGEX_REMOVE_BACKSLASH:Bs,REGEX_SPECIAL_CHARS:qs,REGEX_SPECIAL_CHARS_GLOBAL:Ws}=Ee();K.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);K.hasRegexChars=e=>qs.test(e);K.isRegexChar=e=>e.length===1&&K.hasRegexChars(e);K.escapeRegex=e=>e.replace(Ws,"\\$1");K.toPosixSlashes=e=>e.replace(js,"/");K.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let e=navigator.platform.toLowerCase();return e==="win32"||e==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};K.removeBackslashes=e=>e.replace(Bs,t=>t==="\\"?"":t);K.escapeLast=(e,t,r)=>{let n=e.lastIndexOf(t,r);return n===-1?e:e[n-1]==="\\"?K.escapeLast(e,t,n-1):`${e.slice(0,n)}\\${e.slice(n)}`};K.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r};K.wrapOutput=(e,t={},r={})=>{let n=r.contains?"":"^",s=r.contains?"":"$",i=`${n}(?:${e})${s}`;return t.negated===!0&&(i=`(?:^(?!${i}).*$)`),i};K.basename=(e,{windows:t}={})=>{let r=e.split(t?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var Pr=I((Mo,$r)=>{"use strict";g();var Er=Se(),{CHAR_ASTERISK:yt,CHAR_AT:Xs,CHAR_BACKWARD_SLASH:xe,CHAR_COMMA:zs,CHAR_DOT:At,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:vr,CHAR_LEFT_CURLY_BRACE:St,CHAR_LEFT_PARENTHESES:xt,CHAR_LEFT_SQUARE_BRACKET:Ks,CHAR_PLUS:Us,CHAR_QUESTION_MARK:Sr,CHAR_RIGHT_CURLY_BRACE:Qs,CHAR_RIGHT_PARENTHESES:xr,CHAR_RIGHT_SQUARE_BRACKET:Vs}=Ee(),Cr=e=>e===vr||e===xe,wr=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},Ys=(e,t)=>{let r=t||{},n=e.length-1,s=r.parts===!0||r.scanToEnd===!0,i=[],c=[],a=[],h=e,d=-1,b=0,E=0,S=!1,D=!1,R=!1,y=!1,$=!1,C=!1,v=!1,L=!1,W=!1,A=!1,P=0,F,m,_={value:"",depth:0,isGlob:!1},o=()=>d>=n,B=()=>h.charCodeAt(d+1),M=()=>(F=m,h.charCodeAt(++d));for(;d<n;){m=M();let T;if(m===xe){v=_.backslashes=!0,m=M(),m===St&&(C=!0);continue}if(C===!0||m===St){for(P++;o()!==!0&&(m=M());){if(m===xe){v=_.backslashes=!0,M();continue}if(m===St){P++;continue}if(C!==!0&&m===At&&(m=M())===At){if(S=_.isBrace=!0,R=_.isGlob=!0,A=!0,s===!0)continue;break}if(C!==!0&&m===zs){if(S=_.isBrace=!0,R=_.isGlob=!0,A=!0,s===!0)continue;break}if(m===Qs&&(P--,P===0)){C=!1,S=_.isBrace=!0,A=!0;break}}if(s===!0)continue;break}if(m===vr){if(i.push(d),c.push(_),_={value:"",depth:0,isGlob:!1},A===!0)continue;if(F===At&&d===b+1){b+=2;continue}E=d+1;continue}if(r.noext!==!0&&(m===Us||m===Xs||m===yt||m===Sr||m===Et)===!0&&B()===xt){if(R=_.isGlob=!0,y=_.isExtglob=!0,A=!0,m===Et&&d===b&&(W=!0),s===!0){for(;o()!==!0&&(m=M());){if(m===xe){v=_.backslashes=!0,m=M();continue}if(m===xr){R=_.isGlob=!0,A=!0;break}}continue}break}if(m===yt){if(F===yt&&($=_.isGlobstar=!0),R=_.isGlob=!0,A=!0,s===!0)continue;break}if(m===Sr){if(R=_.isGlob=!0,A=!0,s===!0)continue;break}if(m===Ks){for(;o()!==!0&&(T=M());){if(T===xe){v=_.backslashes=!0,M();continue}if(T===Vs){D=_.isBracket=!0,R=_.isGlob=!0,A=!0;break}}if(s===!0)continue;break}if(r.nonegate!==!0&&m===Et&&d===b){L=_.negated=!0,b++;continue}if(r.noparen!==!0&&m===xt){if(R=_.isGlob=!0,s===!0){for(;o()!==!0&&(m=M());){if(m===xt){v=_.backslashes=!0,m=M();continue}if(m===xr){A=!0;break}}continue}break}if(R===!0){if(A=!0,s===!0)continue;break}}r.noext===!0&&(y=!1,R=!1);let k=h,u="",l="";b>0&&(u=h.slice(0,b),h=h.slice(b),E-=b),k&&R===!0&&E>0?(k=h.slice(0,E),l=h.slice(E)):R===!0?(k="",l=h):k=h,k&&k!==""&&k!=="/"&&k!==h&&Cr(k.charCodeAt(k.length-1))&&(k=k.slice(0,-1)),r.unescape===!0&&(l&&(l=Er.removeBackslashes(l)),k&&v===!0&&(k=Er.removeBackslashes(k)));let U={prefix:u,input:e,start:b,base:k,glob:l,isBrace:S,isBracket:D,isGlob:R,isExtglob:y,isGlobstar:$,negated:L,negatedExtglob:W};if(r.tokens===!0&&(U.maxDepth=0,Cr(m)||c.push(_),U.tokens=c),r.parts===!0||r.tokens===!0){let T;for(let N=0;N<i.length;N++){let te=T?T+1:b,Q=i[N],ue=e.slice(te,Q);r.tokens&&(N===0&&b!==0?(c[N].isPrefix=!0,c[N].value=u):c[N].value=ue,wr(c[N]),U.maxDepth+=c[N].depth),(N!==0||ue!=="")&&a.push(ue),T=Q}if(T&&T+1<e.length){let N=e.slice(T+1);a.push(N),r.tokens&&(c[c.length-1].value=N,wr(c[c.length-1]),U.maxDepth+=c[c.length-1].depth)}U.slashes=i,U.parts=a}return U};$r.exports=Ys});var Lr=I((Go,Or)=>{"use strict";g();var Ue=Ee(),ee=Se(),{MAX_LENGTH:Qe,POSIX_REGEX_SOURCE:Zs,REGEX_NON_SPECIAL_CHARS:Js,REGEX_SPECIAL_CHARS_BACKREF:ei,REPLACEMENTS:Tr}=Ue,ti=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let r=`[${e.join("-")}]`;try{new RegExp(r)}catch{return e.map(s=>ee.escapeRegex(s)).join("..")}return r},be=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,Ct=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=Tr[e]||e;let r={...t},n=typeof r.maxLength=="number"?Math.min(Qe,r.maxLength):Qe,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},c=[i],a=r.capture?"":"?:",h=Ue.globChars(r.windows),d=Ue.extglobChars(h),{DOT_LITERAL:b,PLUS_LITERAL:E,SLASH_LITERAL:S,ONE_CHAR:D,DOTS_SLASH:R,NO_DOT:y,NO_DOT_SLASH:$,NO_DOTS_SLASH:C,QMARK:v,QMARK_NO_DOT:L,STAR:W,START_ANCHOR:A}=h,P=p=>`(${a}(?:(?!${A}${p.dot?R:b}).)*?)`,F=r.dot?"":y,m=r.dot?v:L,_=r.bash===!0?P(r):W;r.capture&&(_=`(${_})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let o={input:e,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:c};e=ee.removePrefix(e,o),s=e.length;let B=[],M=[],k=[],u=i,l,U=()=>o.index===s-1,T=o.peek=(p=1)=>e[o.index+p],N=o.advance=()=>e[++o.index]||"",te=()=>e.slice(o.index+1),Q=(p="",H=0)=>{o.consumed+=p,o.index+=H},ue=p=>{o.output+=p.output!=null?p.output:p.value,Q(p.value)},_n=()=>{let p=1;for(;T()==="!"&&(T(2)!=="("||T(3)==="?");)N(),o.start++,p++;return p%2===0?!1:(o.negated=!0,o.start++,!0)},Le=p=>{o[p]++,k.push(p)},fe=p=>{o[p]--,k.pop()},w=p=>{if(u.type==="globstar"){let H=o.braces>0&&(p.type==="comma"||p.type==="brace"),f=p.extglob===!0||B.length&&(p.type==="pipe"||p.type==="paren");p.type!=="slash"&&p.type!=="paren"&&!H&&!f&&(o.output=o.output.slice(0,-u.output.length),u.type="star",u.value="*",u.output=_,o.output+=u.output)}if(B.length&&p.type!=="paren"&&(B[B.length-1].inner+=p.value),(p.value||p.output)&&ue(p),u&&u.type==="text"&&p.type==="text"){u.output=(u.output||u.value)+p.value,u.value+=p.value;return}p.prev=u,c.push(p),u=p},Fe=(p,H)=>{let f={...d[H],conditions:1,inner:""};f.prev=u,f.parens=o.parens,f.output=o.output;let x=(r.capture?"(":"")+f.open;Le("parens"),w({type:p,value:H,output:o.output?"":D}),w({type:"paren",extglob:!0,value:N(),output:x}),B.push(f)},bn=p=>{let H=p.close+(r.capture?")":""),f;if(p.type==="negate"){let x=_;if(p.inner&&p.inner.length>1&&p.inner.includes("/")&&(x=P(r)),(x!==_||U()||/^\)+$/.test(te()))&&(H=p.close=`)$))${x}`),p.inner.includes("*")&&(f=te())&&/^\.[^\\/.]+$/.test(f)){let G=Ct(f,{...t,fastpaths:!1}).output;H=p.close=`)${G})${x})`}p.prev.type==="bos"&&(o.negatedExtglob=!0)}w({type:"paren",extglob:!0,value:l,output:H}),fe("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let p=!1,H=e.replace(ei,(f,x,G,z,q,ot)=>z==="\\"?(p=!0,f):z==="?"?x?x+z+(q?v.repeat(q.length):""):ot===0?m+(q?v.repeat(q.length):""):v.repeat(G.length):z==="."?b.repeat(G.length):z==="*"?x?x+z+(q?_:""):_:x?f:`\\${f}`);return p===!0&&(r.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,f=>f.length%2===0?"\\\\":f?"\\":"")),H===e&&r.contains===!0?(o.output=e,o):(o.output=ee.wrapOutput(H,o,t),o)}for(;!U();){if(l=N(),l==="\0")continue;if(l==="\\"){let f=T();if(f==="/"&&r.bash!==!0||f==="."||f===";")continue;if(!f){l+="\\",w({type:"text",value:l});continue}let x=/^\\+/.exec(te()),G=0;if(x&&x[0].length>2&&(G=x[0].length,o.index+=G,G%2!==0&&(l+="\\")),r.unescape===!0?l=N():l+=N(),o.brackets===0){w({type:"text",value:l});continue}}if(o.brackets>0&&(l!=="]"||u.value==="["||u.value==="[^")){if(r.posix!==!1&&l===":"){let f=u.value.slice(1);if(f.includes("[")&&(u.posix=!0,f.includes(":"))){let x=u.value.lastIndexOf("["),G=u.value.slice(0,x),z=u.value.slice(x+2),q=Zs[z];if(q){u.value=G+q,o.backtrack=!0,N(),!i.output&&c.indexOf(u)===1&&(i.output=D);continue}}}(l==="["&&T()!==":"||l==="-"&&T()==="]")&&(l=`\\${l}`),l==="]"&&(u.value==="["||u.value==="[^")&&(l=`\\${l}`),r.posix===!0&&l==="!"&&u.value==="["&&(l="^"),u.value+=l,ue({value:l});continue}if(o.quotes===1&&l!=='"'){l=ee.escapeRegex(l),u.value+=l,ue({value:l});continue}if(l==='"'){o.quotes=o.quotes===1?0:1,r.keepQuotes===!0&&w({type:"text",value:l});continue}if(l==="("){Le("parens"),w({type:"paren",value:l});continue}if(l===")"){if(o.parens===0&&r.strictBrackets===!0)throw new SyntaxError(be("opening","("));let f=B[B.length-1];if(f&&o.parens===f.parens+1){bn(B.pop());continue}w({type:"paren",value:l,output:o.parens?")":"\\)"}),fe("parens");continue}if(l==="["){if(r.nobracket===!0||!te().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(be("closing","]"));l=`\\${l}`}else Le("brackets");w({type:"bracket",value:l});continue}if(l==="]"){if(r.nobracket===!0||u&&u.type==="bracket"&&u.value.length===1){w({type:"text",value:l,output:`\\${l}`});continue}if(o.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(be("opening","["));w({type:"text",value:l,output:`\\${l}`});continue}fe("brackets");let f=u.value.slice(1);if(u.posix!==!0&&f[0]==="^"&&!f.includes("/")&&(l=`/${l}`),u.value+=l,ue({value:l}),r.literalBrackets===!1||ee.hasRegexChars(f))continue;let x=ee.escapeRegex(u.value);if(o.output=o.output.slice(0,-u.value.length),r.literalBrackets===!0){o.output+=x,u.value=x;continue}u.value=`(${a}${x}|${u.value})`,o.output+=u.value;continue}if(l==="{"&&r.nobrace!==!0){Le("braces");let f={type:"brace",value:l,output:"(",outputIndex:o.output.length,tokensIndex:o.tokens.length};M.push(f),w(f);continue}if(l==="}"){let f=M[M.length-1];if(r.nobrace===!0||!f){w({type:"text",value:l,output:l});continue}let x=")";if(f.dots===!0){let G=c.slice(),z=[];for(let q=G.length-1;q>=0&&(c.pop(),G[q].type!=="brace");q--)G[q].type!=="dots"&&z.unshift(G[q].value);x=ti(z,r),o.backtrack=!0}if(f.comma!==!0&&f.dots!==!0){let G=o.output.slice(0,f.outputIndex),z=o.tokens.slice(f.tokensIndex);f.value=f.output="\\{",l=x="\\}",o.output=G;for(let q of z)o.output+=q.output||q.value}w({type:"brace",value:l,output:x}),fe("braces"),M.pop();continue}if(l==="|"){B.length>0&&B[B.length-1].conditions++,w({type:"text",value:l});continue}if(l===","){let f=l,x=M[M.length-1];x&&k[k.length-1]==="braces"&&(x.comma=!0,f="|"),w({type:"comma",value:l,output:f});continue}if(l==="/"){if(u.type==="dot"&&o.index===o.start+1){o.start=o.index+1,o.consumed="",o.output="",c.pop(),u=i;continue}w({type:"slash",value:l,output:S});continue}if(l==="."){if(o.braces>0&&u.type==="dot"){u.value==="."&&(u.output=b);let f=M[M.length-1];u.type="dots",u.output+=l,u.value+=l,f.dots=!0;continue}if(o.braces+o.parens===0&&u.type!=="bos"&&u.type!=="slash"){w({type:"text",value:l,output:b});continue}w({type:"dot",value:l,output:b});continue}if(l==="?"){if(!(u&&u.value==="(")&&r.noextglob!==!0&&T()==="("&&T(2)!=="?"){Fe("qmark",l);continue}if(u&&u.type==="paren"){let x=T(),G=l;(u.value==="("&&!/[!=<:]/.test(x)||x==="<"&&!/<([!=]|\w+>)/.test(te()))&&(G=`\\${l}`),w({type:"text",value:l,output:G});continue}if(r.dot!==!0&&(u.type==="slash"||u.type==="bos")){w({type:"qmark",value:l,output:L});continue}w({type:"qmark",value:l,output:v});continue}if(l==="!"){if(r.noextglob!==!0&&T()==="("&&(T(2)!=="?"||!/[!=<:]/.test(T(3)))){Fe("negate",l);continue}if(r.nonegate!==!0&&o.index===0){_n();continue}}if(l==="+"){if(r.noextglob!==!0&&T()==="("&&T(2)!=="?"){Fe("plus",l);continue}if(u&&u.value==="("||r.regex===!1){w({type:"plus",value:l,output:E});continue}if(u&&(u.type==="bracket"||u.type==="paren"||u.type==="brace")||o.parens>0){w({type:"plus",value:l});continue}w({type:"plus",value:E});continue}if(l==="@"){if(r.noextglob!==!0&&T()==="("&&T(2)!=="?"){w({type:"at",extglob:!0,value:l,output:""});continue}w({type:"text",value:l});continue}if(l!=="*"){(l==="$"||l==="^")&&(l=`\\${l}`);let f=Js.exec(te());f&&(l+=f[0],o.index+=f[0].length),w({type:"text",value:l});continue}if(u&&(u.type==="globstar"||u.star===!0)){u.type="star",u.star=!0,u.value+=l,u.output=_,o.backtrack=!0,o.globstar=!0,Q(l);continue}let p=te();if(r.noextglob!==!0&&/^\([^?]/.test(p)){Fe("star",l);continue}if(u.type==="star"){if(r.noglobstar===!0){Q(l);continue}let f=u.prev,x=f.prev,G=f.type==="slash"||f.type==="bos",z=x&&(x.type==="star"||x.type==="globstar");if(r.bash===!0&&(!G||p[0]&&p[0]!=="/")){w({type:"star",value:l,output:""});continue}let q=o.braces>0&&(f.type==="comma"||f.type==="brace"),ot=B.length&&(f.type==="pipe"||f.type==="paren");if(!G&&f.type!=="paren"&&!q&&!ot){w({type:"star",value:l,output:""});continue}for(;p.slice(0,3)==="/**";){let De=e[o.index+4];if(De&&De!=="/")break;p=p.slice(3),Q("/**",3)}if(f.type==="bos"&&U()){u.type="globstar",u.value+=l,u.output=P(r),o.output=u.output,o.globstar=!0,Q(l);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&!z&&U()){o.output=o.output.slice(0,-(f.output+u.output).length),f.output=`(?:${f.output}`,u.type="globstar",u.output=P(r)+(r.strictSlashes?")":"|$)"),u.value+=l,o.globstar=!0,o.output+=f.output+u.output,Q(l);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&p[0]==="/"){let De=p[1]!==void 0?"|$":"";o.output=o.output.slice(0,-(f.output+u.output).length),f.output=`(?:${f.output}`,u.type="globstar",u.output=`${P(r)}${S}|${S}${De})`,u.value+=l,o.output+=f.output+u.output,o.globstar=!0,Q(l+N()),w({type:"slash",value:"/",output:""});continue}if(f.type==="bos"&&p[0]==="/"){u.type="globstar",u.value+=l,u.output=`(?:^|${S}|${P(r)}${S})`,o.output=u.output,o.globstar=!0,Q(l+N()),w({type:"slash",value:"/",output:""});continue}o.output=o.output.slice(0,-u.output.length),u.type="globstar",u.output=P(r),u.value+=l,o.output+=u.output,o.globstar=!0,Q(l);continue}let H={type:"star",value:l,output:_};if(r.bash===!0){H.output=".*?",(u.type==="bos"||u.type==="slash")&&(H.output=F+H.output),w(H);continue}if(u&&(u.type==="bracket"||u.type==="paren")&&r.regex===!0){H.output=l,w(H);continue}(o.index===o.start||u.type==="slash"||u.type==="dot")&&(u.type==="dot"?(o.output+=$,u.output+=$):r.dot===!0?(o.output+=C,u.output+=C):(o.output+=F,u.output+=F),T()!=="*"&&(o.output+=D,u.output+=D)),w(H)}for(;o.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(be("closing","]"));o.output=ee.escapeLast(o.output,"["),fe("brackets")}for(;o.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(be("closing",")"));o.output=ee.escapeLast(o.output,"("),fe("parens")}for(;o.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(be("closing","}"));o.output=ee.escapeLast(o.output,"{"),fe("braces")}if(r.strictSlashes!==!0&&(u.type==="star"||u.type==="bracket")&&w({type:"maybe_slash",value:"",output:`${S}?`}),o.backtrack===!0){o.output="";for(let p of o.tokens)o.output+=p.output!=null?p.output:p.value,p.suffix&&(o.output+=p.suffix)}return o};Ct.fastpaths=(e,t)=>{let r={...t},n=typeof r.maxLength=="number"?Math.min(Qe,r.maxLength):Qe,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);e=Tr[e]||e;let{DOT_LITERAL:i,SLASH_LITERAL:c,ONE_CHAR:a,DOTS_SLASH:h,NO_DOT:d,NO_DOTS:b,NO_DOTS_SLASH:E,STAR:S,START_ANCHOR:D}=Ue.globChars(r.windows),R=r.dot?b:d,y=r.dot?E:d,$=r.capture?"":"?:",C={negated:!1,prefix:""},v=r.bash===!0?".*?":S;r.capture&&(v=`(${v})`);let L=F=>F.noglobstar===!0?v:`(${$}(?:(?!${D}${F.dot?h:i}).)*?)`,W=F=>{switch(F){case"*":return`${R}${a}${v}`;case".*":return`${i}${a}${v}`;case"*.*":return`${R}${v}${i}${a}${v}`;case"*/*":return`${R}${v}${c}${a}${y}${v}`;case"**":return R+L(r);case"**/*":return`(?:${R}${L(r)}${c})?${y}${a}${v}`;case"**/*.*":return`(?:${R}${L(r)}${c})?${y}${v}${i}${a}${v}`;case"**/.*":return`(?:${R}${L(r)}${c})?${i}${a}${v}`;default:{let m=/^(.*?)\.(\w+)$/.exec(F);if(!m)return;let _=W(m[1]);return _?_+i+m[2]:void 0}}},A=ee.removePrefix(e,C),P=W(A);return P&&r.strictSlashes!==!0&&(P+=`${c}?`),P};Or.exports=Ct});var kr=I((Bo,Dr)=>{"use strict";g();var ri=Pr(),wt=Lr(),Fr=Se(),ni=Ee(),si=e=>e&&typeof e=="object"&&!Array.isArray(e),j=(e,t,r=!1)=>{if(Array.isArray(e)){let b=e.map(S=>j(S,t,r));return S=>{for(let D of b){let R=D(S);if(R)return R}return!1}}let n=si(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=t||{},i=s.windows,c=n?j.compileRe(e,t):j.makeRe(e,t,!1,!0),a=c.state;delete c.state;let h=()=>!1;if(s.ignore){let b={...t,ignore:null,onMatch:null,onResult:null};h=j(s.ignore,b,r)}let d=(b,E=!1)=>{let{isMatch:S,match:D,output:R}=j.test(b,c,t,{glob:e,posix:i}),y={glob:e,state:a,regex:c,posix:i,input:b,output:R,match:D,isMatch:S};return typeof s.onResult=="function"&&s.onResult(y),S===!1?(y.isMatch=!1,E?y:!1):h(b)?(typeof s.onIgnore=="function"&&s.onIgnore(y),y.isMatch=!1,E?y:!1):(typeof s.onMatch=="function"&&s.onMatch(y),E?y:!0)};return r&&(d.state=a),d};j.test=(e,t,r,{glob:n,posix:s}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let i=r||{},c=i.format||(s?Fr.toPosixSlashes:null),a=e===n,h=a&&c?c(e):e;return a===!1&&(h=c?c(e):e,a=h===n),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=j.matchBase(e,t,r,s):a=t.exec(h)),{isMatch:!!a,match:a,output:h}};j.matchBase=(e,t,r)=>(t instanceof RegExp?t:j.makeRe(t,r)).test(Fr.basename(e));j.isMatch=(e,t,r)=>j(t,r)(e);j.parse=(e,t)=>Array.isArray(e)?e.map(r=>j.parse(r,t)):wt(e,{...t,fastpaths:!1});j.scan=(e,t)=>ri(e,t);j.compileRe=(e,t,r=!1,n=!1)=>{if(r===!0)return e.output;let s=t||{},i=s.contains?"":"^",c=s.contains?"":"$",a=`${i}(?:${e.output})${c}`;e&&e.negated===!0&&(a=`^(?!${a}).*$`);let h=j.toRegex(a,t);return n===!0&&(h.state=e),h};j.makeRe=(e,t={},r=!1,n=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(s.output=wt.fastpaths(e,t)),s.output||(s=wt(e,t)),j.compileRe(s,t,r,n)};j.toRegex=(e,t)=>{try{let r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(r){if(t&&t.debug===!0)throw r;return/$^/}};j.constants=ni;Dr.exports=j});var vt=I((Wo,Mr)=>{"use strict";g();var Hr=kr(),ii=Se();function Ir(e,t,r=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:ii.isWindows()}),Hr(e,t,r)}Object.assign(Ir,Hr);Mr.exports=Ir});var jr=I(Ve=>{"use strict";g();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.Builder=void 0;var oi=re("path"),Nr=_r(),Gr=null;try{re.resolve("picomatch"),Gr=vt()}catch{}var $t=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:oi.sep,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Nr.APIBuilder(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Nr.APIBuilder(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let n=this.globFunction||Gr;if(!n)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=n(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(i=>s(i)),this}};Ve.Builder=$t});var qr=I(Br=>{"use strict";g();Object.defineProperty(Br,"__esModule",{value:!0})});var Wr=I(se=>{"use strict";g();var ui=se&&se.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),li=se&&se.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ui(t,e,r)};Object.defineProperty(se,"__esModule",{value:!0});se.fdir=void 0;var ci=jr();Object.defineProperty(se,"fdir",{enumerable:!0,get:function(){return ci.Builder}});li(qr(),se)});var dn=I((iu,st)=>{g();function un(e){return Array.isArray(e)?e:[e]}var Fi=void 0,Mt="",sn=" ",It="\\",Di=/^\s+$/,ki=/(?:[^\\]|^)\\$/,Hi=/^\\!/,Ii=/^\\#/,Mi=/\r?\n/g,Ni=/^\.{0,2}\/|^\.{1,2}$/,Gi=/\/$/,me="/",ln="node-ignore";typeof Symbol<"u"&&(ln=Symbol.for("node-ignore"));var cn=ln,ye=(e,t,r)=>(Object.defineProperty(e,t,{value:r}),r),ji=/([0-z])-([0-z])/g,an=()=>!1,Bi=e=>e.replace(ji,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:Mt),qi=e=>{let{length:t}=e;return e.slice(0,t-t%2)},Wi=[[/^\uFEFF/,()=>Mt],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,r)=>t+(r.indexOf("\\")===0?sn:Mt)],[/(\\+?)\s/g,(e,t)=>{let{length:r}=t;return t.slice(0,r-r%2)+sn}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,r)=>t+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return t+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>It],[/\\\\/g,()=>It],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,r,n,s)=>t===It?`\\[${r}${qi(n)}${s}`:s==="]"&&n.length%2===0?`[${Bi(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],Xi=/(^|\\\/)?\\\*$/,Oe="regex",rt="checkRegex",on="_",zi={[Oe](e,t){return`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`},[rt](e,t){return`${t?`${t}[^/]*`:"[^/]*"}(?=$|\\/$)`}},Ki=e=>Wi.reduce((t,[r,n])=>t.replace(r,n.bind(e)),e),nt=e=>typeof e=="string",Ui=e=>e&&nt(e)&&!Di.test(e)&&!ki.test(e)&&e.indexOf("#")!==0,Qi=e=>e.split(Mi).filter(Boolean),Nt=class{constructor(t,r,n,s,i,c){this.pattern=t,this.mark=r,this.negative=i,ye(this,"body",n),ye(this,"ignoreCase",s),ye(this,"regexPrefix",c)}get regex(){let t=on+Oe;return this[t]?this[t]:this._make(Oe,t)}get checkRegex(){let t=on+rt;return this[t]?this[t]:this._make(rt,t)}_make(t,r){let n=this.regexPrefix.replace(Xi,zi[t]),s=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return ye(this,r,s)}},Vi=({pattern:e,mark:t},r)=>{let n=!1,s=e;s.indexOf("!")===0&&(n=!0,s=s.substr(1)),s=s.replace(Hi,"!").replace(Ii,"#");let i=Ki(s);return new Nt(e,t,s,r,n,i)},Gt=class{constructor(t){this._ignoreCase=t,this._rules=[]}_add(t){if(t&&t[cn]){this._rules=this._rules.concat(t._rules._rules),this._added=!0;return}if(nt(t)&&(t={pattern:t}),Ui(t.pattern)){let r=Vi(t,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(t){return this._added=!1,un(nt(t)?Qi(t):t).forEach(this._add,this),this._added}test(t,r,n){let s=!1,i=!1,c;this._rules.forEach(h=>{let{negative:d}=h;i===d&&s!==i||d&&!s&&!i&&!r||!h[n].test(t)||(s=!d,i=d,c=d?Fi:h)});let a={ignored:s,unignored:i};return c&&(a.rule=c),a}},Yi=(e,t)=>{throw new t(e)},oe=(e,t,r)=>nt(e)?e?oe.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${t}\``,TypeError),fn=e=>Ni.test(e);oe.isNotRelative=fn;oe.convert=e=>e;var jt=class{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){ye(this,cn,!0),this._rules=new Gt(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(t){return this._rules.add(t)&&this._initCache(),this}addPattern(t){return this.add(t)}_test(t,r,n,s){let i=t&&oe.convert(t);return oe(i,t,this._strictPathCheck?Yi:an),this._t(i,r,n,s)}checkIgnore(t){if(!Gi.test(t))return this.test(t);let r=t.split(me).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(me)+me,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(t,!1,rt)}_t(t,r,n,s){if(t in r)return r[t];if(s||(s=t.split(me).filter(Boolean)),s.pop(),!s.length)return r[t]=this._rules.test(t,n,Oe);let i=this._t(s.join(me)+me,r,n,s);return r[t]=i.ignored?i:this._rules.test(t,n,Oe)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return un(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},Bt=e=>new jt(e),Zi=e=>oe(e&&oe.convert(e),e,an),hn=()=>{let e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");oe.convert=e;let t=/^[a-z]:\//i;oe.isNotRelative=r=>t.test(r)||fn(r)};typeof process<"u"&&process.platform==="win32"&&hn();st.exports=Bt;Bt.default=Bt;st.exports.isPathValid=Zi;ye(st.exports,Symbol.for("setupWindows"),hn)});var Kt={};Rn(Kt,{MAX_CACHE_ENTRIES:()=>Xt,MAX_TOTAL_PATHS:()=>zt,clear:()=>yn,getCacheKey:()=>lt,read:()=>ct,write:()=>Ae});g();import mn from"node:crypto";var X=new Map,V=new Map,Xt=256,zt=5e4,lt=(e,t,r,n,s=!0)=>{let i=mn.createHash("sha256");return i.update(e),i.update(t),i.update(s?"gitignore":"no-gitignore"),r!==void 0&&i.update(String(r)),n!==void 0&&i.update(`maxFiles:${n}`),i.digest("hex")},ct=e=>{let t=X.get(e);return t!==void 0&&(X.delete(e),X.set(e,t)),t},Ae=(e,t,r)=>{for(V.has(e)&&clearTimeout(V.get(e));X.size>=Xt&&!X.has(e);){let i=X.keys().next().value;i&&(X.delete(i),V.has(i)&&(clearTimeout(V.get(i)),V.delete(i)))}let n=0;for(let[i,c]of X)i!==e&&(n+=c.length);for(;n+t.length>zt&&X.size>0;){let i,c=0;for(let[a,h]of X)a!==e&&h.length>c&&(c=h.length,i=a);if(i)n-=X.get(i).length,X.delete(i),V.has(i)&&(clearTimeout(V.get(i)),V.delete(i));else break}X.has(e)&&X.delete(e),X.set(e,t);let s=setTimeout(()=>{X.delete(e),V.delete(e)},r);V.set(e,s)},yn=()=>{for(let e of V.values())clearTimeout(e);X.clear(),V.clear()};g();var Ur=ut(Wr(),1);import O from"node:path";import ie from"node:fs";import{spawn as ai}from"node:child_process";function $e(e){return e.split(O.sep).join(O.posix.sep)}function Pt(e,t=!1){let r=$e(e);for(;r.startsWith("./");)r=r.slice(2);return t?r.replace(/\/+$/,""):r}function Qr(){return process.platform==="win32"||process.platform==="darwin"}function fi(e,t){let r=e.replace(/\/+$/,""),n=t.replace(/\/+$/,"");return r===n?!0:Qr()?r.toLowerCase()===n.toLowerCase():!1}function hi(e,t){let r=`${t}/`;if(e.startsWith(r)){let n=e.slice(r.length);return n===""?null:n}if(Qr()){let n=`${t.toLowerCase()}/`;if(e.toLowerCase().startsWith(n)){let i=e.slice(n.length);return i===""?null:i}}return null}var di=5e3,pi=3e4,gi=200,_i=50,Ce=4096,Lt=new Map;function bi(e){for(;e.size>gi;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function Ri(e,t){let r=e.get(t);if(r){if(Date.now()-r.cachedAt>pi){e.delete(t);return}return r.value}}function Re(e,t,r){e.set(t,{value:r,cachedAt:Date.now()}),bi(e)}function mi(e){let t=e.trim();return t.length<=Ce?t:`${t.slice(0,Ce)}\u2026`}function yi(e){return e.map(t=>/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("/")&&t.length>1?"<abs-path>":t.includes(O.sep)&&t.length>32?"<path>":t).join(" ")}function Ye(e,t,r,n){let s=[`[crawler] ${e}:`,t,yi(r)];n.code!==void 0&&n.code!==null&&s.push(`exit=${String(n.code)}`),n.stderr&&n.stderr.length>0&&s.push(mi(n.stderr)),console.warn(s.join(" "))}function et(e){return["-c","core.fsmonitor=false","-c","core.untrackedCache=false","-c","core.quotePath=false",...e]}function Ze(e){return $e(O.resolve(e))}function Ai(e){return[Ze(e.crawlDirectory),Ze(e.cwd),e.ignore.getFingerprint(),e.useGitignore===!1?"no-gitignore":"gitignore",e.maxDepth===void 0?"undefined":String(e.maxDepth),e.maxFiles===void 0?"undefined":String(e.maxFiles)].join("|")}function Xr(e){let t=Lt.get(e);return t===void 0?!1:Date.now()-t<di}function Ft(e){Lt.set(e,Date.now())}var ae=new Map,he=new Map;function Ei(){for(;ae.size>=_i;){let e=ae.keys().next().value;if(e===void 0)break;ae.delete(e),Lt.delete(e)}}function Si(e){let t=Ze(e),r=Ri(he,t);if(r!==void 0)return r;let n=e;for(;n;){let s=O.join(n,".git");try{let c=ie.statSync(s);if(c.isDirectory())return Re(he,t,s),s;if(c.isFile()){let h=ie.readFileSync(s,"utf8").trim().match(/^gitdir:\s*(.+)$/i);if(!h)return Re(he,t,null),null;let d=h[1].trim(),b=O.isAbsolute(d)?O.resolve(d):O.resolve(n,d);try{b=ie.realpathSync(b);try{ie.statSync(O.join(b,"HEAD"))}catch{ie.statSync(O.join(b,"index"))}}catch{return Re(he,t,null),null}return Re(he,t,b),b}}catch(c){if(c.code!=="ENOENT")return Re(he,t,null),null}let i=O.dirname(n);if(i===n)break;n=i}return Re(he,t,null),null}function tt(e){try{let t=Si(e);if(!t)return null;let r=O.join(t,"index");return ie.statSync(r).mtimeMs}catch{}return null}function xi(e,t){let r=tt(t),n=ae.get(e);return n?r!==null&&n.gitRootMtimeMs!==null?r<n.gitRootMtimeMs||!Xr(e):r===null&&n.gitRootMtimeMs===null?!Xr(e):!0:!0}function Ci(e,t){let r=ae.get(e);if(!r)return;let n=tt(t);ae.set(e,{...r,gitRootMtimeMs:n})}function Dt(e,t,r,n,s){Ei();let i=tt(t);ae.set(e,{gitRootMtimeMs:i,untrackedFingerprint:n===void 0?null:Je(n),deletedFingerprint:s===void 0?null:Je(s),fileList:r})}function Je(e){let t=5381;for(let r of e){for(let n=0;n<r.length;n++)t=(t<<5)+t+r.charCodeAt(n)>>>0;t=(t<<5)+t+10>>>0}return`${e.length}:${t}`}function wi(e,t=[0]){return e!==null&&t.includes(e)}function vi(e,t,r,n=2e4,s){let i=s?.collectLines!==!1;return new Promise(c=>{let a=[],h=!1,d=!1,b=!1,E="",S=0,D=(A,P)=>{h||(h=!0,c({success:A,lines:P}))},R="",y;try{y=ai(e,t,{cwd:r,windowsHide:!0,stdio:["ignore","pipe","pipe"],...e==="git"?{env:{...process.env,GIT_DIR:void 0,GIT_WORK_TREE:void 0,GIT_INDEX_FILE:void 0}}:{}})}catch(A){s?.silentOnFailure||Ye("command spawn threw",e,t,{stderr:A instanceof Error?A.message:String(A)}),D(!1,[]);return}y.stderr&&(y.stderr.setEncoding("utf8"),y.stderr.on("data",A=>{R.length<Ce&&(R+=A,R.length>Ce&&(R=R.slice(0,Ce)))}));let $=()=>{if(!y.killed)try{y.kill()}catch{}},C=A=>{let P=A.endsWith("\r")?A.slice(0,-1):A;if(P.length===0)return!0;if(s?.onLine&&!s.onLine(P))return b=!0,$(),!1;i&&a.push(P),S++;let F=s?.yieldEveryLines;return F!==void 0&&F>0&&S%F===0&&y.stdout&&typeof y.stdout.pause=="function"&&(y.stdout.pause(),setImmediate(()=>{try{y.stdout?.resume()}catch{}})),!0},v=A=>{if(E+=A,(s?.recordDelimiter??`
|
|
4
|
+
`)==="\0"){for(;;){let F=E.indexOf("\0");if(F===-1)break;let m=E.slice(0,F);if(E=E.slice(F+1),!C(m))break}return}for(;;){let F=E.indexOf(`
|
|
5
|
+
`);if(F===-1)break;let m=E.slice(0,F);if(E=E.slice(F+1),!C(m))break}},L=()=>{E.length!==0&&(C(E),E="")},W;n>0&&(W=setTimeout(()=>{d=!0,$()},n)),y.stdout.setEncoding("utf8"),y.stdout.on("data",A=>{v(A)}),y.on("error",A=>{W&&clearTimeout(W),s?.silentOnFailure||Ye("command spawn failed",e,t,{stderr:`${String(A.code??"")} ${String(A)}`.trim()}),D(!1,[])}),y.on("close",A=>{if(W&&clearTimeout(W),b){D(!0,a);return}if(d){s?.silentOnFailure||Ye("command timed out",e,t,{code:A,stderr:R}),D(!1,[]);return}L();let P=wi(A,s?.successExitCodes);!P&&!s?.silentOnFailure&&Ye("command failed",e,t,{code:A,stderr:R}),D(P,P?a:[])})})}var Pe=vi;function Te(e){return $e(e)}function de(e,t){let r=O.resolve(e),n=O.resolve(t),s=r,i=n;try{s=ie.realpathSync(r)}catch{}try{i=ie.realpathSync(n)}catch{}let c=O.relative(s,i),a=$e(c);return a===""?".":a}function ve(e){return!e||e==="."||O.posix.isAbsolute(e)?!1:e!==".."&&!e.startsWith("../")&&!e.includes("/../")}function $i(e,t){let r=O.resolve(e),n=O.isAbsolute(t)?t:O.join(r,t),s=O.relative(r,n);return s=$e(s),!s||s.startsWith("..")||O.posix.isAbsolute(s)?null:ve(s)?s:null}function Vr(e){if(e===".")return-1;let t=e.endsWith("/")?e.slice(0,-1):e;return t.length===0?-1:t.split("/").length-1}function Yr(e,t){if(e==="."||t===""||t===".")return e;let r=t.endsWith("/")?t:`${t}/`;return e===t?".":e.startsWith(r)?e.slice(r.length)||".":e}function kt(e,t,r,n){let s=t.maxDepth,i=t.ignore.getDirectoryFilter(),c=t.ignore.getFileFilter();return e.filter(a=>{if(s!==void 0&&a!=="."){let h=r?Yr(a,r):a;if(Vr(h)>s)return!1}return a==="."?!0:a.endsWith("/")?ve(a.slice(0,-1))?!i(a):!1:n?.has(a)?!0:!ve(a)||Zr(a,i)?!1:!c(a)})}function Zr(e,t){let r=e.split("/"),n="";for(let s=0;s<r.length-1;s++)if(n=n?`${n}/${r[s]}`:r[s],t(`${n}/`))return!0;return!1}var Jr=1e3;async function Pi(e){e>0&&e%Jr===0&&await new Promise(t=>setImmediate(t))}async function en(e){let t=await Pe("git",et(["rev-parse","--show-toplevel"]),e,5e3,{silentOnFailure:!0});return!t.success||t.lines.length===0?null:Te(t.lines[0])}function Tt(e,t,r){return!(!ve(e)||Zr(e,t)||r(e))}function we(e,t){return t!==void 0&&e>=t}function Ot(e,t,r){if(r===void 0)return!0;let n=Yr(e,t);return Vr(n)<=r}async function tn(e,t,r){let n=["--literal-pathspecs","ls-files","-z","--others"];r&&n.push("--exclude-standard"),t&&t!=="."&&n.push(t);let s=await Pe("git",et(n),e,1e4,{silentOnFailure:!0,recordDelimiter:"\0"});return s.success?s.lines.map(i=>Te(i)):null}async function rn(e,t){let r=["--literal-pathspecs","ls-files","-z","--deleted"];t&&t!=="."&&r.push(t);let n=await Pe("git",et(r),e,1e4,{silentOnFailure:!0,recordDelimiter:"\0"});return n.success?n.lines.map(s=>Te(s)):null}async function zr(e,t,r){if(e.gitRootMtimeMs===null&&e.untrackedFingerprint===null&&e.deletedFingerprint===null)return{changed:!1};let n=await en(t);if(e.untrackedFingerprint===null&&e.deletedFingerprint===null)return n?{changed:!0}:{changed:!1};if(!n)return{changed:!0};let s=de(n,t),[i,c]=await Promise.all([tn(n,s,r),rn(n,s)]);return i===null||c===null?{changed:!0}:Je(i)!==e.untrackedFingerprint||Je(c)!==e.deletedFingerprint?{changed:!0,prefetch:{gitRoot:n,untrackedFiles:i,deletedFiles:c}}:{changed:!1}}function Kr(e,t,r,n,s){let i=Pt(e,!1);if(t&&t!=="."){let c=hi(i,n);if(c!==null)return O.posix.join(s,c);if(fi(i,n))return`${i.replace(/\/+$/,"")}/`;let a=i.replace(/\/+$/,"");return O.posix.join(s,a)}return O.posix.join(s,i.replace(/\/+$/,""))}async function Ti(e,t,r,n,s){let i,c,a;if(s)i=s.gitRoot,c=s.untrackedFiles,a=s.deletedFiles;else{if(i=await en(t),!i)return{success:!1,files:[],gitRepoListingFailed:!1};let _=de(i,t),o=await Promise.all([tn(i,_,n.useGitignore!==!1),rn(i,_)]);c=o[0],a=o[1]}if(!i)return{success:!1,files:[],gitRepoListingFailed:!1};if(!s&&(c===null||a===null))return{success:!1,files:[],gitRepoListingFailed:!0};let h=de(r,t),d=de(i,t),b=Pt(d,!0),E=Pt(h,!0),S=n.ignore.getDirectoryFilter(),D=n.ignore.getFileFilter(),R=["--literal-pathspecs","ls-files","--cached","--recurse-submodules"];R.push("-t"),d&&d!=="."&&R.push(d);let y=new Set(a),$=new Set,C=0,v=_=>_.length===0?null:_.length>=3&&/\s/.test(_[1])&&/[A-Za-z]/.test(_[0])?{status:_[0].toUpperCase(),filePath:_.slice(2)}:{status:null,filePath:_},L=_=>{if(we(C,n.maxFiles))return!1;let o=v(_);if(!o||o.status==="S")return!0;let B=Te(o.filePath);if(y.has(B))return!0;let M;try{M=ie.lstatSync(O.join(i,...B.split("/")))}catch{return!0}if(M.isDirectory()||d&&d!=="."&&B===d)return!0;let k=Kr(B,d,h,b,E);if(!Tt(k,S,D))return!0;let u=$.size;return $.add(k),$.size>u&&Ot(k,h,n.maxDepth)&&C++,!we(C,n.maxFiles)},W=await Pe("git",et(R),i,2e4,{collectLines:!1,onLine:L,yieldEveryLines:Jr});if(!W.success)return{success:!1,files:[],gitRepoListingFailed:!0};for(let _ of W.lines)if(!L(_))break;let A=0;if(c!==null)for(let _ of c){if(we(C,n.maxFiles))break;await Pi(A++);let o=Kr(_,d,h,b,E);Tt(o,S,D)&&($.has(o)||($.add(o),Ot(o,h,n.maxDepth)&&C++))}let P=nn($),F=kt(P,n,h,$),m=Ht(F,n.maxFiles);return Dt(e,t,m,c===null?void 0:c,a===null?void 0:a),Ft(e),{success:!0,files:m}}function nn(e){let t=new Set;for(let r of e){let n=r.split("/"),s="";for(let i=0;i<n.length-1;i++)s=s?s+"/"+n[i]:n[i],t.add(s+"/")}return[".",...Array.from(t),...Array.from(e)]}async function Oi(e,t,r,n){let s=["--files","--no-require-git","--hidden"];n.useGitignore===!1&&s.push("--no-ignore");let i=de(r,t),c=n.ignore.getDirectoryFilter(),a=n.ignore.getFileFilter(),h=new Set,d=0,b=y=>{if(we(d,n.maxFiles))return!1;let $=Te(y),C=O.posix.join(i,$);if(!Tt(C,c,a))return!0;let v=h.size;return h.add(C),h.size>v&&Ot(C,i,n.maxDepth)&&d++,!we(d,n.maxFiles)},E=await Pe("rg",s,t,2e4,{collectLines:!1,onLine:b,successExitCodes:[0,1]});if(!E.success)return{success:!1,files:[]};for(let y of E.lines)if(!b(y))break;let S=nn(h),D=kt(S,n,i,h),R=Ht(D,n.maxFiles);return Dt(e,t,R),Ft(e),{success:!0,files:R}}async function Li(e){let t=de(e.cwd,e.crawlDirectory),r;try{let s=e.ignore.getDirectoryFilter(),i=e.ignore.getFileFilter(),c=new Ur.fdir().withRelativePaths().withDirs().withPathSeparator("/").exclude((a,h)=>{let d=$i(e.crawlDirectory,h);return d?s(`${d}/`):!1}).filter((a,h)=>{if(h)return!0;let d=O.posix.join(t,a);return ve(d)?!i(d):!1});e.maxDepth!==void 0&&c.withMaxDepth(e.maxDepth),r=await c.crawl(e.crawlDirectory).withPromise()}catch{return[]}let n=r.filter(s=>s.length>0&&s!==".").map(s=>O.posix.join(t,s));if(t!=="."){let s=t.endsWith("/")?t:`${t}/`;if(!n.includes(s))return[s,...n]}return n}async function ru(e){let t=Ai(e),r=e.cache?lt(Ze(e.crawlDirectory),e.ignore.getFingerprint(),e.maxDepth,e.maxFiles,e.useGitignore!==!1):void 0;if(e.cache){let d=ct(r);if(d)return d}let n;if(!e.cache){let d=ae.get(t);if(d){let b=tt(e.crawlDirectory);if(b!==null&&d.gitRootMtimeMs!==null&&b>d.gitRootMtimeMs){let S=await zr(d,e.crawlDirectory,e.useGitignore!==!1);if(!S.changed)return Ci(t,e.crawlDirectory),d.fileList;n=S.prefetch}else if(!xi(t,e.crawlDirectory)){let S=await zr(d,e.crawlDirectory,e.useGitignore!==!1);if(!S.changed)return d.fileList;n=S.prefetch}}}let s=await Ti(t,e.crawlDirectory,e.cwd,e,n);if(s.success){let d=s.files;return e.cache&&Ae(r,d,e.cacheTtl*1e3),d}s.gitRepoListingFailed&&console.warn("[crawler] falling back to ripgrep (git ls-files unavailable)");let i=await Oi(t,e.crawlDirectory,e.cwd,e);if(i.success){let d=i.files;return e.cache&&Ae(r,d,e.cacheTtl*1e3),d}console.warn("[crawler] falling back to fdir (ripgrep unavailable)");let c=de(e.cwd,e.crawlDirectory),a=await Li(e);a=kt(a,e,c),a.length===0?a=["."]:a[0]!=="."&&(a=[".",...a]);let h=Ht(a,e.maxFiles);return Dt(t,e.crawlDirectory,h),Ft(t),e.cache&&Ae(r,h,e.cacheTtl*1e3),h}function Ht(e,t){if(t===void 0||e.length<=t)return e;let r=e.slice(0,t),n=i=>i!=="."&&!i.endsWith("/");if(r.some(n))return r;let s=e.findIndex(n);return s===-1?r:e.slice(0,s+1)}g();var qt=ut(dn(),1),gn=ut(vt(),1);import it from"node:fs";import pn from"node:path";var Ji=(0,gn.default)("**/*[*.]*"),eo=[".git","node_modules",".venv","venv","__pycache__",".mypy_cache",".pytest_cache",".ruff_cache",".next",".nuxt",".turbo",".cache","target",".gradle",".terraform"];function cu(e){let t=new Wt,r=new Set([...eo,...e.ignoreDirs]);if(t.add([...r].map(n=>n.endsWith("/")?n:`${n}/`)),e.useGitignore){let n=pn.join(e.projectRoot,".gitignore");it.existsSync(n)&&t.add(it.readFileSync(n,"utf8"))}if(e.useMatildaignore){let n=pn.join(e.projectRoot,".matildaignore");it.existsSync(n)&&t.add(it.readFileSync(n,"utf8"))}return t}var Wt=class{allPatterns=[];dirIgnorer=(0,qt.default)();fileIgnorer=(0,qt.default)();add(t){typeof t=="string"&&(t=t.split(/\r?\n/));for(let r of t){let n=r.trim();if(n===""||n.startsWith("#"))continue;this.allPatterns.push(n),n.endsWith("/")&&!n.startsWith("!")?this.dirIgnorer.add(n):(this.fileIgnorer.add(n),Ji(n)||this.dirIgnorer.add(n))}return this}getDirectoryFilter(){return t=>this.dirIgnorer.ignores(t)}getFileFilter(){return t=>this.fileIgnorer.ignores(t)}getFingerprint(){return this.allPatterns.join(`
|
|
6
|
+
`)}};export{vt as a,dn as b,Kt as c,ru as d,cu as e,Wt as f};
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright 2025 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
11
|
+
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{b as i}from"./chunk-GZPNIYVZ.js";i();import{AsyncLocalStorage as P}from"node:async_hooks";import{randomUUID as f}from"node:crypto";i();import{AsyncLocalStorage as E}from"node:async_hooks";var c=new E;var x="x-matilda-reported-operation-id",m="x-matilda-reported-attempt-purpose",A=[x,m],y=new Set(A),l=["answer","tool_followup","continuation","retry","compaction","unknown"],_=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,C=new Set(l),u=new P,O=new WeakSet;function R(){return f()}function s(t,e){let o=Object.freeze({operationId:t,attemptPurpose:e});return O.add(o),o}function g(t){return y.has(t.toLowerCase())}function a(){let t=u.getStore();return t&&O.has(t)?t:void 0}var T=class{activeOperationId;begin(e){return this.activeOperationId=R(),s(this.activeOperationId,e)}continue(e){let o=a()?.operationId??this.activeOperationId??R();return this.activeOperationId=o,s(o,e)}};function n(t,e){return u.run(t,e)}function v(t){u.enterWith(t)}function M(t,e){let o=a();return o?n(s(o.operationId,t),e):e()}function I(t,e){let o={next:(...r)=>n(t,()=>e.next(...r)),return:r=>n(t,()=>e.return(r)),throw:r=>n(t,()=>e.throw(r)),[Symbol.asyncIterator]:()=>o},p=Symbol.asyncDispose,d=p&&e[p];return p&&typeof d=="function"&&(o[p]=()=>n(t,()=>d.call(e))),o}function k(t,e){let o=a();return o?I(s(o.operationId,t),e):e}function Y(){let t=a();if(!t||!_.test(t.operationId))return{};let e=c.getStore()?.attempt,o=e!==void 0&&e>1?"retry":t.attemptPurpose;return C.has(o)?{[x]:t.operationId,[m]:o}:{}}export{c as a,x as b,m as c,A as d,l as e,g as f,a as g,T as h,n as i,v as j,M as k,I as l,k as m,Y as n};
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Matilda Team
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{l as k}from"./chunk-
|
|
3
|
+
import{l as k}from"./chunk-DBSJNFFU.js";import{Ib as It,Ob as St}from"./chunk-7LNKXNEZ.js";import{c as Tt}from"./chunk-MNGFXISD.js";import{m as Ct}from"./chunk-QLEJOI4X.js";import{Cc as ht,h as nt}from"./chunk-6QP5C76Y.js";import{p as st}from"./chunk-5U3A6KMU.js";import{b as C}from"./chunk-GZPNIYVZ.js";import{d as gt,f as Bt}from"./chunk-OWGSC52X.js";var Mt=gt(i=>{"use strict";C();var at=Symbol.for("react.transitional.element"),$t=Symbol.for("react.portal"),Gt=Symbol.for("react.fragment"),jt=Symbol.for("react.strict_mode"),Wt=Symbol.for("react.profiler"),qt=Symbol.for("react.consumer"),Ft=Symbol.for("react.context"),Yt=Symbol.for("react.forward_ref"),Kt=Symbol.for("react.suspense"),Jt=Symbol.for("react.memo"),kt=Symbol.for("react.lazy"),zt=Symbol.for("react.activity"),xt=Symbol.iterator;function Qt(t){return t===null||typeof t!="object"?null:(t=xt&&t[xt]||t["@@iterator"],typeof t=="function"?t:null)}var Rt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},vt=Object.assign,Et={};function v(t,e,s){this.props=t,this.context=e,this.refs=Et,this.updater=s||Rt}v.prototype.isReactComponent={};v.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};v.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function At(){}At.prototype=v.prototype;function ut(t,e,s){this.props=t,this.context=e,this.refs=Et,this.updater=s||Rt}var mt=ut.prototype=new At;mt.constructor=ut;vt(mt,v.prototype);mt.isPureReactComponent=!0;var bt=Array.isArray;function it(){}var p={H:null,A:null,T:null,S:null},wt=Object.prototype.hasOwnProperty;function lt(t,e,s){var o=s.ref;return{$$typeof:at,type:t,key:e,ref:o!==void 0?o:null,props:s}}function Vt(t,e){return lt(t.type,e,t.props)}function pt(t){return typeof t=="object"&&t!==null&&t.$$typeof===at}function Xt(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(s){return e[s]})}var _t=/\/+/g;function rt(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Xt(""+t.key):e.toString(36)}function Zt(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(it,it):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function R(t,e,s,o,n){var a=typeof t;(a==="undefined"||a==="boolean")&&(t=null);var m=!1;if(t===null)m=!0;else switch(a){case"bigint":case"string":case"number":m=!0;break;case"object":switch(t.$$typeof){case at:case $t:m=!0;break;case kt:return m=t._init,R(m(t._payload),e,s,o,n)}}if(m)return n=n(t),m=o===""?"."+rt(t,0):o,bt(n)?(s="",m!=null&&(s=m.replace(_t,"$&/")+"/"),R(n,e,s,"",function(g){return g})):n!=null&&(pt(n)&&(n=Vt(n,s+(n.key==null||t&&t.key===n.key?"":(""+n.key).replace(_t,"$&/")+"/")+m)),e.push(n)),1;m=0;var d=o===""?".":o+":";if(bt(t))for(var c=0;c<t.length;c++)o=t[c],a=d+rt(o,c),m+=R(o,e,s,a,n);else if(c=Qt(t),typeof c=="function")for(t=c.call(t),c=0;!(o=t.next()).done;)o=o.value,a=d+rt(o,c++),m+=R(o,e,s,a,n);else if(a==="object"){if(typeof t.then=="function")return R(Zt(t),e,s,o,n);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return m}function B(t,e,s){if(t==null)return t;var o=[],n=0;return R(t,o,"","",function(a){return e.call(s,a,n++)}),o}function te(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(s){(t._status===0||t._status===-1)&&(t._status=1,t._result=s)},function(s){(t._status===0||t._status===-1)&&(t._status=2,t._result=s)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Ht=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ee={map:B,forEach:function(t,e,s){B(t,function(){e.apply(this,arguments)},s)},count:function(t){var e=0;return B(t,function(){e++}),e},toArray:function(t){return B(t,function(e){return e})||[]},only:function(t){if(!pt(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};i.Activity=zt;i.Children=ee;i.Component=v;i.Fragment=Gt;i.Profiler=Wt;i.PureComponent=ut;i.StrictMode=jt;i.Suspense=Kt;i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=p;i.__COMPILER_RUNTIME={__proto__:null,c:function(t){return p.H.useMemoCache(t)}};i.cache=function(t){return function(){return t.apply(null,arguments)}};i.cacheSignal=function(){return null};i.cloneElement=function(t,e,s){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var o=vt({},t.props),n=t.key;if(e!=null)for(a in e.key!==void 0&&(n=""+e.key),e)!wt.call(e,a)||a==="key"||a==="__self"||a==="__source"||a==="ref"&&e.ref===void 0||(o[a]=e[a]);var a=arguments.length-2;if(a===1)o.children=s;else if(1<a){for(var m=Array(a),d=0;d<a;d++)m[d]=arguments[d+2];o.children=m}return lt(t.type,n,o)};i.createContext=function(t){return t={$$typeof:Ft,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:qt,_context:t},t};i.createElement=function(t,e,s){var o,n={},a=null;if(e!=null)for(o in e.key!==void 0&&(a=""+e.key),e)wt.call(e,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(n[o]=e[o]);var m=arguments.length-2;if(m===1)n.children=s;else if(1<m){for(var d=Array(m),c=0;c<m;c++)d[c]=arguments[c+2];n.children=d}if(t&&t.defaultProps)for(o in m=t.defaultProps,m)n[o]===void 0&&(n[o]=m[o]);return lt(t,a,n)};i.createRef=function(){return{current:null}};i.forwardRef=function(t){return{$$typeof:Yt,render:t}};i.isValidElement=pt;i.lazy=function(t){return{$$typeof:kt,_payload:{_status:-1,_result:t},_init:te}};i.memo=function(t,e){return{$$typeof:Jt,type:t,compare:e===void 0?null:e}};i.startTransition=function(t){var e=p.T,s={};p.T=s;try{var o=t(),n=p.S;n!==null&&n(s,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(it,Ht)}catch(a){Ht(a)}finally{e!==null&&s.types!==null&&(e.types=s.types),p.T=e}};i.unstable_useCacheRefresh=function(){return p.H.useCacheRefresh()};i.use=function(t){return p.H.use(t)};i.useActionState=function(t,e,s){return p.H.useActionState(t,e,s)};i.useCallback=function(t,e){return p.H.useCallback(t,e)};i.useContext=function(t){return p.H.useContext(t)};i.useDebugValue=function(){};i.useDeferredValue=function(t,e){return p.H.useDeferredValue(t,e)};i.useEffect=function(t,e){return p.H.useEffect(t,e)};i.useEffectEvent=function(t){return p.H.useEffectEvent(t)};i.useId=function(){return p.H.useId()};i.useImperativeHandle=function(t,e,s){return p.H.useImperativeHandle(t,e,s)};i.useInsertionEffect=function(t,e){return p.H.useInsertionEffect(t,e)};i.useLayoutEffect=function(t,e){return p.H.useLayoutEffect(t,e)};i.useMemo=function(t,e){return p.H.useMemo(t,e)};i.useOptimistic=function(t,e){return p.H.useOptimistic(t,e)};i.useReducer=function(t,e,s){return p.H.useReducer(t,e,s)};i.useRef=function(t){return p.H.useRef(t)};i.useState=function(t){return p.H.useState(t)};i.useSyncExternalStore=function(t,e,s){return p.H.useSyncExternalStore(t,e,s)};i.useTransition=function(){return p.H.useTransition()};i.version="19.2.4"});var Dt=gt((de,Pt)=>{"use strict";C();Pt.exports=Mt()});C();C();C();var fe=Bt(Dt(),1);var oe=["achieved","aborted","failed"];function ge(t){return oe.includes(t)}function ne(t,e){return t>=e.hard?"hard":t>=e.auto?"auto":t>=e.warn?"warn":"safe"}function T(t){if(!t||t.length===0)return 0;let e=0,s=0;for(let o=0;o<t.length;o++)t.charCodeAt(o)<128?e++:s++;return Math.ceil(e/4+s*1.5)}function se(t){if(!t||t.trim().length===0)return[];let e=[],s=/--- Context from: (.+?) ---\n([\s\S]*?)--- End of Context from: \1 ---/g,o;for(;(o=s.exec(t))!==null;){let n=o[1],a=o[2];e.push({path:n,tokens:T(a)})}return e.length===0&&t.trim().length>0&&e.push({path:k("memory"),tokens:T(t)}),e}async function re(t,e){let s=t.getModelDisplayName()||"unknown",o=t.getContentGeneratorConfig(),n=o.contextWindowSize??131072,a=nt.getLastPromptTokenCount(),m=nt.getLastCachedContentTokenCount(),d=It(void 0,s),c=T(d),g=t.getToolRegistry(),M=g?g.getAllTools():[],r=g?g.getFunctionDeclarations():[],P=JSON.stringify(r),_=T(P),H=[],x=[];for(let u of M){if(u.shouldDefer&&!u.alwaysLoad&&!g?.isDeferredToolRevealed(u.name))continue;let h=JSON.stringify(u.schema),S=T(h);u instanceof ht?x.push({name:`${u.serverName}__${u.serverToolName||u.name}`,tokens:S}):u.name!==st.SKILL&&H.push({name:u.name,tokens:S})}let l=t.getUserMemory(),y=se(l),$=y.reduce((u,h)=>u+h.tokens,0),E=M.find(u=>u.name===st.SKILL),G=E?T(JSON.stringify(E.schema)):0,Nt=E&&"getLoadedSkillNames"in E?E.getLoadedSkillNames():new Set,dt=t.getSkillManager(),Ut=dt?await dt.listSkills():[],D=0,j=Ut.map(u=>{let h=T(`<skill>
|
|
4
4
|
<name>
|
|
5
5
|
${u.name}
|
|
6
6
|
</name>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Hi as K,vf as X,xf as H}from"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{i as S}from"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as B,i as G}from"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as d}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";d();d();d();import{homedir as ye}from"node:os";d();import{join as I}from"node:path";import{homedir as R}from"node:os";var l="0.5.2",ue="https://matilda.maincode.com/assets/computer-use",me="https://github.com/trycua/cua/releases/download";function E(e=process.platform,t=process.arch,o=l){let r=o;if(e==="darwin"){let n=`cua-driver-rs-${r}-${t==="arm64"?"darwin-arm64":"darwin-x86_64"}`;return{asset:`${n}.tar.gz`,extractDir:n,binaryRelPath:"CuaDriver.app/Contents/MacOS/cua-driver",hasApp:!0}}if(e==="linux"){if(t!=="x64")throw new Error(`Computer Use: unsupported Linux arch '${t}' (only x64).`);return{asset:`cua-driver-rs-${r}-linux-x86_64-binary.tar.gz`,extractDir:".",binaryRelPath:"cua-driver",hasApp:!1}}if(e==="win32"){let n=`cua-driver-rs-${r}-${t==="arm64"?"windows-arm64":"windows-x86_64"}`;return{asset:`${n}.zip`,extractDir:n,binaryRelPath:"cua-driver.exe",hasApp:!1}}throw new Error(`Computer Use: unsupported platform '${e}'.`)}function U(e,t=process.env,o=l){let r=[],i=t.MATILDA_COMPUTER_USE_DOWNLOAD_HOST;return i&&r.push(`${ge(i)}/cua-driver-rs/v${o}/${e}`),r.push(`${ue}/cua-driver-rs/v${o}/${e}`),r.push(`${me}/cua-driver-rs-v${o}/${e}`),r}function J(e=process.env,t=l){return U("checksums.txt",e,t)}var he="MATILDA_COMPUTER_USE_MAX_IMAGE_DIMENSION";function V(e){if(e===void 0||typeof e=="string"&&e.trim()==="")return;let t=typeof e=="number"?e:Number(e);if(!(!Number.isInteger(t)||t<0))return t}function Y(e,t=process.env){let o=V(t[he]);return o!==void 0?o:V(e)}function fe(e=R()){return I(e,".matilda","computer-use")}function N(e=R(),t=l){return I(fe(e),`cua-driver-rs-${t}`)}function u(e=R(),t=process.platform,o=process.arch,r=l){let i=E(t,o,r);return I(N(e,r),i.extractDir,i.binaryRelPath)}function h(e=l){return`cua-driver-rs@${e}`}function ge(e){return e.endsWith("/")?e.slice(0,-1):e}var f=class e{static singleton;binary;onProgress;maxImageDimension;client;startPromise;constructor(t){this.binary=t.binary,this.onProgress=t.onProgress??(()=>{}),this.maxImageDimension=t.maxImageDimension}setMaxImageDimension(t){this.maxImageDimension=t}static shared(){return e.singleton||(e.singleton=new e({binary:u(ye())})),e.singleton}static setSharedForTest(t){e.singleton=t}isStarted(){return this.client!==void 0}async start(t){if(!this.client)return this.startPromise?this.startPromise:(this.startPromise=this.doStart(t).finally(()=>{this.startPromise=void 0}),this.startPromise)}async doStart(t){let o=t??this.onProgress;o("Starting Computer Use driver...");let r=new H({command:this.binary,args:["mcp"],env:{...process.env}}),i=new X({name:"matilda-code-computer-use",version:"1.0.0"},{capabilities:{}});await i.connect(r),this.client=i,await this.applyRuntimeConfig(i,o)}async applyRuntimeConfig(t,o){if(this.maxImageDimension!==void 0)try{await t.callTool({name:"set_config",arguments:{max_image_dimension:this.maxImageDimension}})}catch(r){let i=r instanceof Error?r.message:String(r);o(`Computer Use: could not apply max_image_dimension=${this.maxImageDimension} (${i}); using driver default.`)}}async listTools(){if(!this.client)throw new Error("ComputerUseClient not started");return this.client.listTools()}async callTool(t,o){if(!this.client)throw new Error("ComputerUseClient not started");try{return await this.client.callTool({name:t,arguments:o})}catch(r){if(!Q(r))throw r;let i=r;for(let n=0;n<3;n++){if(await this.stop(),await this.start(),!this.client)throw new Error("ComputerUseClient reconnect failed");try{return await this.client.callTool({name:t,arguments:o})}catch(s){if(!Q(s))throw s;i=s,await new Promise(a=>setTimeout(a,1e3))}}throw i}}async stop(){let t=this.client;if(this.client=void 0,t)try{await t.close()}catch{}}};function Q(e){let t=e instanceof Error?e.message:String(e);return/connection closed|not connected|connection refused|daemon transport error|os error 61/i.test(t)}d();var M=["bring_to_front","check_for_update","check_permissions","click","double_click","drag","end_session","get_accessibility_tree","get_agent_cursor_state","get_config","get_cursor_position","get_recording_state","get_screen_size","get_window_state","hotkey","kill_app","launch_app","list_apps","list_windows","move_cursor","page","press_key","replay_trajectory","right_click","scroll","set_agent_cursor_enabled","set_agent_cursor_motion","set_agent_cursor_style","set_config","set_value","start_recording","start_session","stop_recording","type_text","zoom"],g={bring_to_front:{description:'Activate a window so subsequent input tools with `dispatch:"foreground"` land on it without a per-call SetForegroundWindow flash. **Windows-only:** on macOS this tool returns an error pointing to the platform-native `NSRunningApplication.activate` (which the macOS input tools don\'t need because CGEvent.postToPid reaches backgrounded windows). On Linux this tool also stubs out; use `wmctrl -a` or `xdotool windowactivate` if you need explicit activation.',parameterSchema:{additionalProperties:!1,properties:{pid:{type:"integer"},window_id:{type:"integer"}},required:["pid"],type:"object"}},check_for_update:{description:"Check whether a newer cua-driver-rs release is available on GitHub. Returns the current and latest versions, an `update_available` boolean, the install one-liner, and the release notes URL. Read-only \u2014 never installs. Mirror of `cua-driver check-update --json`.",parameterSchema:{additionalProperties:!1,properties:{},type:"object"}},check_permissions:{description:"Report TCC permission status for Accessibility and Screen Recording. By default also raises the system permission dialogs for any missing grants \u2014 Apple's request APIs are no-ops when the grant is already active, so this is safe to call repeatedly. Pass {\"prompt\": false} for a purely read-only status check.\n\nReturns: `accessibility` + `screen_recording` (booleans from the TCC preflight APIs), `screen_recording_capturable` (a live ScreenCaptureKit probe \u2014 if it disagrees with `screen_recording`, the preflight grant belongs to a different process), and `source` (which TCC identity the booleans reflect: the CuaDriver daemon vs the launching terminal/IDE). macOS attributes grants to the responsible process, so a standalone call from a terminal reports the terminal's grants, not the driver's.",parameterSchema:{additionalProperties:!1,properties:{prompt:{description:"Raise the system permission prompts for missing grants. Default true.",type:"boolean"}},type:"object"}},click:{description:`Left-click against a target pid. **Prefer \`element_index\` over pixel coordinates** \u2014 element_index works on backgrounded / minimized / hidden / off-Space windows, surfaces a stable handle that survives rebuilds, and tells you what you're clicking via the cached element's role + label. Reach for \`x, y\` only when the target is a canvas / video / WebGL / custom-drawn surface that doesn't appear in the AX tree.
|
|
4
4
|
|
|
5
5
|
Two addressing modes:
|
|
6
6
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{c as a,d as b,e as c}from"./chunk-
|
|
3
|
+
import{c as a,d as b,e as c}from"./chunk-ZYW5GLYY.js";import"./chunk-DBSJNFFU.js";import"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{a as collectContextData,c as contextCommand,b as formatContextUsageText};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{a as y}from"./chunk-MJEXA2MA.js";import{Le as R,Me as x,Se as X,Te as V,We as Q,Ze as Y,ja as I,qe as A,re as G,tc as q,ye as K}from"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{Lb as z,Oa as j,_c as H,ca as U,ha as N,wc as D}from"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{w as B}from"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{i as k,p as P,q as W}from"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import{A as S,C as M,Y as $,a as C,z as w}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as T}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";T();import*as m from"node:fs";import*as u from"node:path";T();var se={"\u2010":"-","\u2011":"-","\u2012":"-","\u2013":"-","\u2014":"-","\u2015":"-","\u2212":"-","\u2018":"'","\u2019":"'","\u201A":"'","\u201B":"'","\u201C":'"',"\u201D":'"',"\u201E":'"',"\u201F":'"',"\xA0":" ","\u2002":" ","\u2003":" ","\u2004":" ","\u2005":" ","\u2006":" ","\u2007":" ","\u2008":" ","\u2009":" ","\u200A":" ","\u202F":" ","\u205F":" ","\u3000":" "};function L(n){if(n==="")return n;let t="";for(let i of n)t+=se[i]??i;return t}var ae=[n=>n,n=>n.trimEnd()];function ce(n){return L(n).trimEnd()}function J(n,t,i){if(t.length===0)return 0;if(t.length>n.length)return null;e:for(let e=0;e<=n.length-t.length;e++){for(let r=0;r<t.length;r++)if(i(n[e+r])!==i(t[r]))continue e;return e}return null}function fe(n){let t=n.split(`
|
|
4
|
+
`),i=new Array(t.length+1),e=0;for(let r=0;r<t.length;r++)i[r]=e,e+=t[r].length,r<t.length-1&&(e+=1);return i[t.length]=n.length,{lines:t,offsets:i}}function Z(n,t,i,e,r,o){if(r===0)return o?`
|
|
5
|
+
`:"";let f=t[e]??0,l=e+r-1,c=(t[l]??0)+(i[l]?.length??0);if(o){let g=t[e+r];g!==void 0?c=g:n.endsWith(`
|
|
6
|
+
`)&&(c=n.length)}return n.slice(f,c)}function de(n,t){let{lines:i,offsets:e}=fe(n),r=t.split(`
|
|
7
|
+
`),o=t.endsWith(`
|
|
8
|
+
`);if(r.length===0)return null;let f=a=>{for(let c of ae){let g=J(i,a,c);if(g!==null)return g}return J(i,a,ce)},l=f(r);if(l!==null)return{slice:Z(n,e,i,l,r.length,o),removedTrailingFinalEmptyLine:!1};if(r.at(-1)===""){let a=r.slice(0,-1);if(a.length===0)return null;if(l=f(a),l!==null)return{slice:Z(n,e,i,l,a.length,!1),removedTrailingFinalEmptyLine:!0}}return null}function ge(n,t){if(t==="")return null;let i=n.indexOf(t);if(i!==-1)return{slice:n.slice(i,i+t.length),removedTrailingFinalEmptyLine:!1};let e=L(n),r=L(t),o=e.indexOf(r);return o!==-1?{slice:n.slice(o,o+t.length),removedTrailingFinalEmptyLine:!1}:de(n,t)}function ue(n){return n.endsWith(`\r
|
|
9
|
+
`)?n.slice(0,-2):n.endsWith(`
|
|
10
|
+
`)||n.endsWith("\r")?n.slice(0,-1):n}function pe(n,t){return t?ue(n):n}function te(n,t,i){if(n===null||t==="")return{oldString:t,newString:i};let e=ge(n,t);return e!==null?{oldString:e.slice,newString:pe(i,e.removedTrailingFinalEmptyLine)}:{oldString:t,newString:i}}function ne(n,t,i){if(n===null||t===""||i!==""||t.endsWith(`
|
|
11
|
+
`))return t;let e=`${t}
|
|
12
|
+
`;return n.includes(e)?e:t}function ie(n,t){if(t==="")return 0;let i=0,e=n.indexOf(t);for(;e!==-1;)i++,e=n.indexOf(t,e+t.length);return i}var ee=4,he=1e3;function re(n,t){let i=t.split(`
|
|
13
|
+
`),e=i.length;if(n===null)return{startLine:1,endLine:e,totalLines:e,content:t};if(n===t||!t)return null;let r=n.split(`
|
|
14
|
+
`),o=0,f=Math.min(r.length,i.length);for(;o<f&&r[o]===i[o];)o++;let l=r.length-1,a=i.length-1;for(;l>=o&&a>=o&&r[l]===i[a];)l--,a--;let c=o+1,g=a+1;if(g-c>he)return null;let p=Math.max(1,c-ee),h=Math.min(e,g+ee),_=i.slice(p-1,h);return{startLine:p,endLine:h,totalLines:e,content:_.join(`
|
|
15
|
+
`)}}var oe=$("EDIT_PRIOR_READ");function le(n,t,i,e){return e?i:n===null?t===""?i:"":t===""&&!e?n:K(n,t,i)}var me=["filePath","filepath","path","file","filename"],_e=["oldString","oldText","old_text","previous_string","previousString"],Ee=["newString","newText","new_text","content"];function we(n){if(!(typeof n.file_path=="string"&&n.file_path.trim()))for(let t of me){let i=n[t];if(typeof i=="string"&&i.trim()){n.file_path=i,delete n[t];break}}if(n.old_string===void 0||n.old_string===null){for(let t of _e)if(n[t]!==void 0&&n[t]!==null){n.old_string=n[t],delete n[t];break}}if(n.new_string===void 0||n.new_string===null){for(let t of Ee)if(n[t]!==void 0&&n[t]!==null){n.new_string=n[t],delete n[t];break}}(n.old_string===void 0||n.old_string===null)&&typeof n.new_string=="string"&&typeof n.file_path=="string"&&n.file_path.trim()&&(n.old_string="",n.full_file_replace=!0)}var v=class{constructor(t,i){this.config=t;this.params=i}toolLocations(){return[{path:this.params.file_path}]}async calculateEdit(t){let i=t.replace_all??!1,e=null,r=await N(t.file_path),o=!1,f=t.new_string,l=t.old_string,a=0,c,g=!1,p="utf-8",h="lf";if(!this.config.getFileReadCacheDisabled()){let s=await x(this.config.getFileReadCache(),t.file_path,"editing");if(!s.ok)return{currentContent:null,newContent:"",occurrences:0,error:{display:s.displayMessage,raw:s.rawMessage,type:s.type},isNewFile:!1,encoding:"utf-8",bom:!1,lineEnding:"lf"}}if(r)try{let s=await this.config.getFileSystemService().readTextFile({path:t.file_path});s._meta?.bom!==void 0?g=s._meta.bom:g=s.content.length>0&&s.content.codePointAt(0)===65279,p=s._meta?.encoding||"utf-8",h=Q(s.content),e=s.content.replace(/\r\n/g,`
|
|
16
|
+
`),r=!0}catch(s){if(!C(s)||s.code!=="ENOENT")throw s;r=!1}if(r&&!this.config.getFileReadCacheDisabled()){let s=await x(this.config.getFileReadCache(),t.file_path,"editing",{expectExisting:!0});if(!s.ok)return oe.warn("post-read TOCTOU rejection",{path:t.file_path,reason:s.type}),{currentContent:null,newContent:"",occurrences:0,error:{display:s.displayMessage,raw:s.rawMessage,type:s.type},isNewFile:!1,encoding:"utf-8",bom:!1,lineEnding:"lf"}}if(t.full_file_replace)o=!r,r&&e!==null?(a=1,l=e,f=t.new_string):r||(l="",f=t.new_string);else{let s=te(e,l,f);l=s.oldString,f=s.newString,l===""&&!r?o=!0:r?e!==null?(l=ne(e,l,f),a=ie(e,l),t.old_string===""?c={display:"Failed to edit. Attempted to create a file that already exists.",raw:`File already exists, cannot create: ${t.file_path}`,type:"attempt_to_create_existing_file"}:a===0?c={display:"Failed to edit, could not find the string to replace.",raw:`Failed to edit, 0 occurrences found for old_string in ${t.file_path}. No edits made. The exact text in old_string was not found. Ensure you're not escaping content incorrectly and check whitespace, indentation, and context. Use ${D.Name} tool to verify.`,type:"edit_no_occurrence_found"}:!i&&a>1?c={display:"Failed to edit because the text matches multiple locations. Provide more context or set replace_all to true.",raw:`Failed to edit. Found ${a} occurrences for old_string in ${t.file_path} but replace_all was not enabled.`,type:"edit_expected_occurrence_mismatch"}:l===f&&(c={display:"No changes to apply. The old_string and new_string are identical.",raw:`No changes to apply. The old_string and new_string are identical in file: ${t.file_path}`,type:"edit_no_change"})):c={display:"Failed to read content of file.",raw:`Failed to read content of existing file: ${t.file_path}`,type:"read_content_failure"}:c={display:"File not found. Cannot apply edit. Use an empty old_string to create a new file.",raw:`File not found: ${t.file_path}`,type:"file_not_found"}}let _=c?e??"":t.full_file_replace?t.new_string:le(e,l,f,o);return!c&&r&&e===_&&(c={display:"No changes to apply. The new content is identical to the current content.",raw:`No changes to apply. The new content is identical to the current content in file: ${t.file_path}`,type:"edit_no_change"}),{currentContent:e,newContent:_,occurrences:a,error:c,isNewFile:o,bom:g,encoding:p,lineEnding:h}}async getDefaultPermission(){let t=this.config.getProjectRoot();return B(u.resolve(this.params.file_path),t)?"allow":"ask"}async getConfirmationDetails(t){let i=y(this.config,this.params.file_path);if(i)throw new R(i,"path_not_in_workspace");let e;try{e=await this.calculateEdit(this.params)}catch(l){if(t.aborted)throw l;let a=l instanceof Error?l.message:String(l);throw new Error(`Error preparing edit: ${a}`)}if(e.error)throw new R(e.error.raw,e.error.type);let r=u.basename(this.params.file_path),o=I(r,e.currentContent??"",e.newContent,"Current","Proposed",A);return{type:"edit",title:`Confirm Edit: ${w(S(this.params.file_path,this.config.getTargetDir()))}`,fileName:r,filePath:this.params.file_path,fileDiff:o,originalContent:e.currentContent,newContent:e.newContent,onConfirm:async l=>{l==="proceed_always"&&this.config.setApprovalMode("auto-edit")}}}getDescription(){let t=S(this.params.file_path,this.config.getTargetDir());return this.params.old_string===""?`Create ${w(t)}`:this.params.old_string===this.params.new_string?`No file changes to ${w(t)}`:w(t)}async execute(t){let i=y(this.config,this.params.file_path);if(i)return{llmContent:i,returnDisplay:i,error:{message:i,type:"path_not_in_workspace"}};let e;try{e=await this.calculateEdit(this.params)}catch(r){if(t.aborted)throw r;let o=r instanceof Error?r.message:String(r);return{llmContent:`Error preparing edit: ${o}`,returnDisplay:`Error preparing edit: ${o}`,error:{message:o,type:"edit_preparation_failure"}}}if(e.error)return{llmContent:e.error.raw,returnDisplay:`Error: ${e.error.display}`,error:{message:e.error.raw,type:e.error.type}};try{try{await this.config.getFileHistoryService().trackEdit(this.params.file_path)}catch{}if(!this.config.getFileReadCacheDisabled()){let d=await x(this.config.getFileReadCache(),this.params.file_path,"editing",{expectExisting:!e.isNewFile});if(!d.ok)return oe.warn("pre-write TOCTOU rejection",{path:this.params.file_path,reason:d.type}),{llmContent:d.rawMessage,returnDisplay:`Error: ${d.displayMessage}`,error:{message:d.rawMessage,type:d.type}}}let r=y(this.config,this.params.file_path);if(r)return{llmContent:r,returnDisplay:r,error:{message:r,type:"path_not_in_workspace"}};this.ensureParentDirectoriesExist(this.params.file_path);let o=y(this.config,this.params.file_path);if(o)return{llmContent:o,returnDisplay:o,error:{message:o,type:"path_not_in_workspace"}};if(e.isNewFile){let d=this.config.getDefaultFileEncoding(),b=!1;d===X.UTF8_BOM?b=!0:d===void 0&&(b=V(this.params.file_path)),await this.config.getFileSystemService().writeTextFile({path:this.params.file_path,content:e.newContent,_meta:{bom:b}})}else await this.config.getFileSystemService().writeTextFile({path:this.params.file_path,content:e.newContent,_meta:{bom:e.bom,encoding:e.encoding,lineEnding:e.lineEnding}});this.params.modified_by_user||q.getInstance().recordEdit(this.params.file_path,e.currentContent,e.newContent);try{let d=m.statSync(this.params.file_path);this.config.getFileReadCache().recordWrite(this.params.file_path,d)}catch{}let f=u.basename(this.params.file_path),l=this.params.ai_proposed_content||e.newContent,a=G(f,e.currentContent??"",l,e.newContent),g={fileDiff:I(f,e.currentContent??"",e.newContent,"Current","Proposed",A),fileName:f,originalContent:e.currentContent,newContent:e.newContent,diffStat:a},p=U(this.params.file_path),h=j(this.params.file_path),_=u.extname(this.params.file_path),s=e.isNewFile?"create":"update";z(this.config,new H(O.Name,s,e.newContent.split(`
|
|
17
|
+
`).length,p,_,h));let F=[e.isNewFile?`Created new file: ${this.params.file_path} with provided content.`:`The file: ${this.params.file_path} has been updated.`],E=re(e.currentContent,e.newContent);if(E){let d=`Showing lines ${E.startLine}-${E.endLine} of ${E.totalLines} from the edited file:
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
${E.content}`;F.push(d)}try{let d=await Y(this.config,this.params.file_path);d&&F.push(`
|
|
22
|
+
|
|
23
|
+
${d}`)}catch{}return{llmContent:F.join(" "),returnDisplay:g}}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error executing edit: ${o}`,returnDisplay:`Error writing file: ${o}`,error:{message:o,type:"file_write_failure"}}}}ensureParentDirectoriesExist(t){let i=u.dirname(t);m.existsSync(i)||m.mkdirSync(i,{recursive:!0})}},O=class n extends k{constructor(i){super(n.Name,W.EDIT,`Replaces text within a file. By default, replaces a single occurrence. Set \`replace_all\` to true when you intend to modify every instance of \`old_string\`. This tool requires providing significant context around the change to ensure precise targeting. Always use the ${D.Name} tool to examine the file's current content before attempting a text replacement.
|
|
24
|
+
|
|
25
|
+
The user has the ability to modify the \`new_string\` content. If modified, this will be stated in the response.
|
|
26
|
+
|
|
27
|
+
Expectation for required parameters:
|
|
28
|
+
1. \`file_path\` MUST be an absolute path; otherwise an error will be thrown.
|
|
29
|
+
2. \`old_string\` MUST be the exact literal text to replace (including all whitespace, indentation, newlines, and surrounding code etc.). For a full-file rewrite prefer \`${P.WRITE_FILE}\`; if you omit \`old_string\` and only pass \`new_string\`, the tool overwrites the entire file.
|
|
30
|
+
3. \`new_string\` MUST be the exact literal text to replace \`old_string\` with (also including all whitespace, indentation, newlines, and surrounding code etc.). Ensure the resulting code is correct and idiomatic.
|
|
31
|
+
4. NEVER escape \`old_string\` or \`new_string\`, that would break the exact literal text requirement.
|
|
32
|
+
**Important:** If ANY of the above are not satisfied, the tool will fail. CRITICAL for \`old_string\`: Must uniquely identify the single instance to change. Include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. If this string matches multiple locations, or does not match exactly, the tool will fail.
|
|
33
|
+
**Multiple replacements:** Set \`replace_all\` to true when you want to replace every occurrence that matches \`old_string\`.
|
|
34
|
+
**New files:** Pass an empty \`old_string\` to create a file that does not exist yet.`,"edit",{properties:{file_path:{description:"The absolute path to the file to modify. Must start with '/'.",type:"string"},old_string:{description:"The exact literal text to replace, preferably unescaped. For single replacements (default), include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. If this string is not the exact literal text (i.e. you escaped it) or does not match exactly, the tool will fail. Omit only when intentionally overwriting the entire file with new_string (prefer write_file for that). Empty string creates a new file when the path does not exist.",type:"string"},new_string:{description:"The exact literal text to replace `old_string` with, preferably unescaped. Provide the EXACT text. Ensure the resulting code is correct and idiomatic.",type:"string"},replace_all:{type:"boolean",description:"Replace all occurrences of old_string (default false)."}},required:["file_path","old_string","new_string"],type:"object"});this.config=i}static Name=P.EDIT;validateToolParams(i){return we(i),super.validateToolParams(i)}validateToolParamValues(i){return i.file_path=M(i.file_path.trim()),i.file_path?u.isAbsolute(i.file_path)?typeof i.new_string!="string"?"The 'new_string' parameter must be a string.":null:`File path must be absolute: ${i.file_path}`:"The 'file_path' parameter must be non-empty."}createInvocation(i){return new v(this.config,i)}toAutoClassifierInput(i){let e=i.old_string??"",r=i.new_string??"";return{file_path:i.file_path,old_string_preview:e.slice(0,300),new_string_preview:r.slice(0,300),old_string_truncated:e.length>300,new_string_truncated:r.length>300,lines_changed:(r.match(/\n/g)?.length??0)-(e.match(/\n/g)?.length??0)}}getModifyContext(i){return{getFilePath:e=>e.file_path,getCurrentContent:async e=>{if(await N(e.file_path))try{let{content:o}=await this.config.getFileSystemService().readTextFile({path:e.file_path});return o}catch(o){if(!C(o)||o.code!=="ENOENT")throw o;return""}else return""},getProposedContent:async e=>{if(e.full_file_replace)return e.new_string;if(m.existsSync(e.file_path))try{let{content:r}=await this.config.getFileSystemService().readTextFile({path:e.file_path});return le(r,e.old_string,e.new_string,e.old_string===""&&r==="")}catch(r){if(!C(r)||r.code!=="ENOENT")throw r;return""}else return""},createUpdatedParams:(e,r,o)=>({...o,ai_proposed_content:e,old_string:e,new_string:r,modified_by_user:!0})}}};export{O as EditTool,le as applyReplacement,we as normalizeEditToolParams};
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2025 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
39
|
+
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{$f as s,Oj as T,Tf as W}from"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as $,i as E,p as m,q as R}from"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import{Y as b}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as y}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";y();var o=b("ENTER_WORKTREE"),P=`Creates an isolated git worktree at \`<projectRoot>/.matilda/worktrees/<slug>\` and returns its absolute path so subsequent file edits, shell commands, and other tools can operate inside it.
|
|
4
4
|
|
|
5
5
|
## When to Use
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{I as r}from"./chunk-
|
|
3
|
+
import{I as r}from"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as m,i as u,p as d,q as c}from"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import{Y as p}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as l}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";l();var y=p("ENTER_PLAN_MODE"),g=`Use this tool to lower into plan mode before doing uncertain or complex work. Entering plan mode is a privilege reduction, so it does not require user confirmation.
|
|
4
4
|
|
|
5
5
|
## When to Use This Tool
|
|
6
6
|
Use this tool when the task is not yet clear enough to safely execute, for example when it requires multi-file changes, design choices, investigation before a plan can be summarized, or when requirements are ambiguous. While investigating, if complexity rises or you find yourself repeatedly needing to ask the user, enter plan mode and consolidate a plan.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{$f as l,Nj as C,Pj as x,Rf as k,Uf as W}from"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as E,i as R,p as c,q as T}from"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import{Y as b,a as $}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as y}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";y();import*as S from"node:fs/promises";var h=b("EXIT_WORKTREE"),O=`Exits a worktree previously created by ${c.ENTER_WORKTREE}.
|
|
4
4
|
|
|
5
5
|
## Behavior
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as k}from"./chunk-ILBTI4K5.js";import{
|
|
3
|
+
import{a as k}from"./chunk-ILBTI4K5.js";import{Hf as M,I as w,kg as $}from"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as G,i as R,p as T,q as _}from"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import{Y as f}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as h}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";h();h();h();var E=f("GATE_REVIEW_AGENTS");function L(n){return`You are a Plan Design Reviewer for the Plan Approval Gate. Review the plan across three dimensions:
|
|
4
4
|
|
|
5
5
|
1. **Request Fit** \u2014 Does the plan fulfill every part of the user's original request and respect all explicit constraints? Does it do anything the user explicitly asked NOT to do?
|
|
6
6
|
2. **System Fit** \u2014 Does the plan align with the codebase structure, file paths, function names, permission model, and integration boundaries found during investigation?
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as g}from"./chunk-EMWHQSMS.js";import{g as u}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{f as d}from"./chunk-
|
|
3
|
+
import{a as g}from"./chunk-EMWHQSMS.js";import{g as u}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{f as d}from"./chunk-SDTWBD62.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-FWDMPRKU.js";import{b as m}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";m();m();var p=class{googleGenAI;contentGeneratorConfig;constructor(e,t){let r=t?.customHeaders,n=r?(()=>{let i=e.httpOptions,s=i?.headers??{},l=Object.fromEntries(Object.entries(r).filter(([a])=>!d(a)));return{...e,httpOptions:{...i??{},headers:{...s,...l}}}})():e;this.googleGenAI=new u(n),this.contentGeneratorConfig=t}buildGenerateContentConfig(e){let t=this.contentGeneratorConfig?.samplingParams,r=e.config||{},n=(i,s,l)=>{let a=r[s];return i!==void 0?i:a!==void 0?a:l};return{...r,temperature:n(t?.temperature,"temperature",1),topP:n(t?.top_p,"topP",.95),topK:n(t?.top_k,"topK",64),maxOutputTokens:n(t?.max_tokens,"maxOutputTokens"),presencePenalty:n(t?.presence_penalty,"presencePenalty"),frequencyPenalty:n(t?.frequency_penalty,"frequencyPenalty"),thinkingConfig:n(this.buildThinkingConfig(),"thinkingConfig",{includeThoughts:!0,thinkingLevel:"THINKING_LEVEL_UNSPECIFIED"})}}buildThinkingConfig(){let e=this.contentGeneratorConfig?.reasoning;if(e===!1)return{includeThoughts:!1};if(e)return{includeThoughts:!0,thinkingLevel:e.effort==="low"?"LOW":e.effort==="high"||e.effort==="max"?"HIGH":"THINKING_LEVEL_UNSPECIFIED"}}async generateContent(e,t){let r={...e,contents:this.stripUnsupportedFields(e.contents),config:this.buildGenerateContentConfig(e)};return this.googleGenAI.models.generateContent(r)}async generateContentStream(e,t){let r={...e,contents:this.stripUnsupportedFields(e.contents),config:this.buildGenerateContentConfig(e)};return this.googleGenAI.models.generateContentStream(r)}stripUnsupportedFields(e){return!e||typeof e=="string"?e:Array.isArray(e)?e.map(t=>this.stripContentFields(t)):this.stripContentFields(e)}stripContentFields(e){if(typeof e=="string")return e;if(!("role"in e)&&!("parts"in e))return this.stripPartFields(e);let t=e;return t.parts?{...t,parts:t.parts.map(r=>this.stripPartFields(r))}:t}stripPartFields(e){if(typeof e=="string")return e;let t={...e};if(t.inlineData){let{displayName:r,...n}=t.inlineData;t.inlineData=n}if(t.fileData){let{displayName:r,...n}=t.fileData;t.fileData=n}if(t.functionResponse?.parts){let r=t.functionResponse.parts.map(n=>{let i=this.convertUnsupportedMediaToText(n);return this.stripPartFields(i)});t.functionResponse={...t.functionResponse,parts:r}}return t}convertUnsupportedMediaToText(e){if(typeof e=="string")return e;let t=e.inlineData?.mimeType||"",r=e.fileData?.mimeType||"";if(t.startsWith("audio/")||t.startsWith("video/")){let n=e.inlineData?.displayName,i=n?` (${n})`:"";return{text:`Unsupported media type for Gemini: ${t}${i}.`}}if(r.startsWith("audio/")||r.startsWith("video/")){let n=e.fileData?.displayName,i=n?` (${n})`:"";return{text:`Unsupported media type for Gemini: ${r}${i}.`}}return e}async countTokens(e){return this.googleGenAI.models.countTokens(e)}async embedContent(e){return this.googleGenAI.models.embedContent(e)}useSummarizedThinking(){return!0}};function T(o,e){let i={...{"User-Agent":o.userAgent||`MatildaCode/0.21.3 (${process.platform}; ${process.arch})`}};if(e?.getUsageStatisticsEnabled()){let f=new g().getInstallationId();i={...i,"x-gemini-api-privileged-user-id":`${f}`}}let s=o.baseUrl?{headers:i,baseUrl:o.baseUrl}:{headers:i};return new p({apiKey:o.apiKey===""?void 0:o.apiKey,vertexai:o.vertexai,httpOptions:s},o)}export{p as GeminiContentGenerator,T as createGeminiContentGenerator};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Google LLC
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Pe as _,Qe as j}from"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import{b as D}from"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{g as k}from"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as M,i as C,p as N,q as A}from"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import{C as $,F as O,J as v,Y as R,c as x}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as L}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";L();import z from"node:fs";import T from"node:path";var V=R("GLOB"),Y=100,B=2e4,W=15e3,q=500;function K(u,g,t){let e=[...u];return e.sort((r,s)=>{let c=r.mtimeMs??0,a=s.mtimeMs??0,o=g-c<t,l=g-a<t;return o&&l?a-c:o?-1:l?1:r.fullpath().localeCompare(s.fullpath())}),e}var S=class extends M{constructor(t,e){super(e);this.config=t;this.fileService=t.getFileService()}fileService;getDescription(){let t=`'${this.params.pattern}'`;return this.params.path&&(t+=` in path '${this.params.path}'`),t}async getDefaultPermission(){if(!this.params.path)return"allow";let t=this.config.getWorkspaceContext(),e=T.resolve(this.config.getTargetDir(),this.params.path);return t.isPathWithinWorkspace(e)||O(k(),e)?"allow":"ask"}async globInDirectory(t,e,r){let s=e,c=T.join(t,s);z.existsSync(c)&&(s=_(s));let a=j(s,{cwd:t,withFileTypes:!0,nodir:!0,stat:!0,nocase:!0,dot:!0,ignore:this.config.getFileExclusions().getGlobExcludes(),follow:!1,signal:r}),o=[],l=Date.now(),p=null;for await(let n of a){if(o.push(n),o.length>=B){p="count";break}if(Date.now()-l>W){p="time";break}o.length%q===0&&await new Promise(b=>setImmediate(b))}p&&a.destroy?.();let d=this.config.getTargetDir(),P=o.map(n=>T.relative(d,n.fullpath())),{filteredPaths:m}=this.fileService.filterFilesWithReport(P,this.getFileFilteringOptions()),h=n=>process.platform==="win32"||process.platform==="darwin"?n.toLowerCase():n,f=new Set(m.map(n=>h(T.resolve(d,n))));return{entries:o.filter(n=>f.has(h(n.fullpath()))),limited:p}}async execute(t){try{let e=[],r;if(this.params.path){let i=v(this.config,this.params.path,{allowExternalPaths:!0});e.push(i),r=`within ${i}`}else{let i=this.config.getWorkspaceContext().getDirectories();e.push(...i),r=i.length>1?`across ${i.length} workspace directories`:"in the workspace directory"}let s=this.params.pattern,c=[],a=new Set,o=null;for(let i of e){let{entries:F,limited:E}=await this.globInDirectory(i,s,t);E&&(o=E);for(let G of F){let I=G.fullpath();a.has(I)||(a.add(I),c.push(G))}}let l=c,p=o==="time"?`
|
|
4
4
|
|
|
5
5
|
[Search stopped after ${W/1e3}s before scanning the whole tree. Results may be incomplete \u2014 narrow the search by passing a more specific 'path' or pattern.]`:o==="count"?`
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Jj as K,Kj as Y,Qe as z,aa as q,ed as F}from"./chunk-7LNKXNEZ.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-C2ZWB2NT.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-FT76AZPN.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-FU2PKCG5.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-QLEJOI4X.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6QP5C76Y.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{g as _}from"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as U,i as V,p as H,q as J}from"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import{C as O,F as W,J as S,Y as j,a as I,c as P}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as B}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";B();import tt from"node:fs/promises";import y from"node:path";import{EOL as et}from"node:os";import{spawn as X}from"node:child_process";var k=j("GREP"),M=class extends U{constructor(e,s){super(s);this.config=e;this.fileExclusions=e.getFileExclusions()}fileExclusions;async getDefaultPermission(){if(!this.params.path)return"allow";let e=this.config.getWorkspaceContext(),s=y.resolve(this.config.getTargetDir(),this.params.path);return e.isPathWithinWorkspace(s)||W(_(),s)?"allow":"ask"}async execute(e){try{let s=[],i;if(this.params.path){let t=S(this.config,this.params.path,{allowExternalPaths:!0});s.push(t),i=`in path "${this.params.path}"`}else{let t=this.config.getWorkspaceContext().getDirectories();s.push(...t),i=t.length>1?`across ${t.length} workspace directories`:"in the workspace directory"}let l=[];for(let t of s){let o=await this.performGrepSearch({pattern:this.params.pattern,path:t,glob:this.params.glob,signal:e});if(s.length>1)for(let a of o)y.isAbsolute(a.filePath)||(a.filePath=y.resolve(t,a.filePath));l.push(...o)}if(s.length>1){let t=new Set;l=l.filter(o=>{let a=`${o.filePath}:${o.lineNumber}`;return t.has(a)?!1:(t.add(a),!0)})}let f=this.params.glob?` (filter: "${this.params.glob}")`:"";if(l.length===0)return{llmContent:`No matches found for pattern "${this.params.pattern}" ${i}${f}.`,returnDisplay:"No matches found"};let h=this.config.getTruncateToolOutputThreshold(),w=Math.min(this.config.getTruncateToolOutputLines(),this.params.limit??Number.POSITIVE_INFINITY),$=!1,C=l;l.length>w&&(C=l.slice(0,w),$=!0);let E=l.length,x=E===1?"match":"matches",G=`Found ${E} ${x} for pattern "${this.params.pattern}" ${i}${f}:
|
|
4
4
|
---
|
|
5
5
|
`,v=C.reduce((t,o)=>{let a=o.filePath;return t[a]||(t[a]=[]),t[a].push(o),t[a].sort((L,D)=>L.lineNumber-D.lineNumber),t},{}),n="",g=[],m=!1,c=(t,o)=>Number.isFinite(h)&&n.length+t.length>h?(n+=t.slice(0,Math.max(h-n.length,0)),n+="...",o&&g.push(o),m=!0,!1):(n+=t,o&&g.push(o),!0);for(let t in v){if(!c(`File: ${t}
|
|
6
6
|
`))break;let o=!1;for(let a of v[t]){let L=a.line.trim();if(!c(`L${a.lineNumber}: ${L}
|