@maincode-ai/matilda-code 0.22.1-preview.0 → 0.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/chunks/agent-IJOGVY62.js +3 -0
  2. package/chunks/agent-headless-FZGKJCVK.js +3 -0
  3. package/chunks/{askUserQuestion-A46IDHKS.js → askUserQuestion-DHYKAZWH.js} +1 -1
  4. package/chunks/ca-HHQCT6S2.js +23 -0
  5. package/chunks/chunk-3BT7ZYAM.js +121 -0
  6. package/chunks/chunk-3IG6LNQ3.js +2581 -0
  7. package/chunks/{chunk-6RK6IJY5.js → chunk-46FFWNRO.js} +1 -1
  8. package/chunks/chunk-55YW6EUC.js +8 -0
  9. package/chunks/chunk-BQDEPKIG.js +46 -0
  10. package/chunks/{chunk-LONWTJOE.js → chunk-BS7Q7KA6.js} +8 -8
  11. package/chunks/chunk-DZKI2CAC.js +3 -0
  12. package/chunks/{chunk-TDFF4ZGY.js → chunk-E2KMVG7F.js} +1 -1
  13. package/chunks/chunk-FY3LL4OC.js +8 -0
  14. package/chunks/chunk-HJK3NKAR.js +8 -0
  15. package/chunks/{chunk-ZABAV4XA.js → chunk-HRD7WD3P.js} +3 -3
  16. package/chunks/{chunk-YY64FVJG.js → chunk-L2FKLLEC.js} +1 -1
  17. package/chunks/chunk-MZ73LBEY.js +9 -0
  18. package/chunks/chunk-N2BE647T.js +10 -0
  19. package/chunks/{chunk-6T25BBKH.js → chunk-OF7ORAN6.js} +53 -53
  20. package/chunks/{chunk-UICLGQTV.js → chunk-OWEBLTAN.js} +1 -1
  21. package/chunks/{chunk-KYNP66YS.js → chunk-P24OL22U.js} +8 -8
  22. package/chunks/chunk-PFXCFIHY.js +8 -0
  23. package/chunks/chunk-REUZDMLM.js +80 -0
  24. package/chunks/chunk-VWE5BSHV.js +56 -0
  25. package/chunks/{chunk-FI2FSW7J.js → chunk-VWM3GUBH.js} +1 -1
  26. package/chunks/chunk-WL27X35X.js +44 -0
  27. package/chunks/chunk-ZUQRP3N6.js +9 -0
  28. package/chunks/{computer-use-2YIT7SIT.js → computer-use-5T3ZH24D.js} +7 -7
  29. package/chunks/{cron-create-JINCFLKY.js → cron-create-5RRFCP36.js} +1 -1
  30. package/chunks/{cron-delete-RF6JLUAV.js → cron-delete-7DTRWCSV.js} +1 -1
  31. package/chunks/{cron-list-VXLBAXZ3.js → cron-list-HY6XJD7D.js} +1 -1
  32. package/chunks/de-MJBGC47E.js +23 -0
  33. package/chunks/{edit-6S3DRURW.js → edit-Y7YSDGLT.js} +17 -17
  34. package/chunks/en-JITX7JKV.js +23 -0
  35. package/chunks/{enter-worktree-57EOUOC4.js → enter-worktree-5ZGIYDUE.js} +1 -1
  36. package/chunks/{enterPlanMode-EWO2LZ5G.js → enterPlanMode-TWD4MXCW.js} +1 -1
  37. package/chunks/{exit-worktree-T7IHIQX5.js → exit-worktree-3F5UY76U.js} +1 -1
  38. package/chunks/{exitPlanMode-YW7MKP6A.js → exitPlanMode-HWK5EUVS.js} +1 -1
  39. package/chunks/fr-WT3R2JCR.js +23 -0
  40. package/chunks/{glob-EYNPF6KD.js → glob-H7DNNPJ4.js} +1 -1
  41. package/chunks/{goal-tools-F2V2CXAF.js → goal-tools-CJINJJ3Y.js} +1 -1
  42. package/chunks/grep-5MCMGW6A.js +22 -0
  43. package/chunks/ja-OEXP6Z3S.js +23 -0
  44. package/chunks/{keychain-token-storage-UTWIIKCK.js → keychain-token-storage-BCODB632.js} +1 -1
  45. package/chunks/ls-JORGCXES.js +15 -0
  46. package/chunks/{lsp-H4EXPHFD.js → lsp-Y46R5DO5.js} +1 -1
  47. package/chunks/mcp-client-54J5M542.js +3 -0
  48. package/chunks/monitor-BRJR6PR3.js +32 -0
  49. package/chunks/notebook-edit-UCCVQ4JP.js +17 -0
  50. package/chunks/openaiContentGenerator-H6JOS3XU.js +52 -0
  51. package/chunks/pt-PCVIFK7H.js +23 -0
  52. package/chunks/read-file-LVMBCRCT.js +3 -0
  53. package/chunks/ripGrep-F6AJSDKU.js +3 -0
  54. package/chunks/ru-CB5SIZZM.js +23 -0
  55. package/chunks/scheduler-XAOD6LG6.js +8 -0
  56. package/chunks/{send-message-5XHDGHSN.js → send-message-VY4DP63A.js} +1 -1
  57. package/chunks/shell-QUDC6MJK.js +3 -0
  58. package/chunks/{skill-AR3SRFYF.js → skill-5EMGSWRM.js} +4 -4
  59. package/chunks/symbol-search-YNGX4Z5T.js +19 -0
  60. package/chunks/{syntheticOutput-OIPRFBVD.js → syntheticOutput-4JANVS4D.js} +1 -1
  61. package/chunks/{task-create-QP44DKH4.js → task-create-NRBVXURQ.js} +1 -1
  62. package/chunks/{task-detach-AUTU6C4G.js → task-detach-VHDDAO2K.js} +1 -1
  63. package/chunks/{task-list-U2WAGMM7.js → task-list-T2IET466.js} +1 -1
  64. package/chunks/{task-stop-GN5WZ3IA.js → task-stop-OEAEE5R7.js} +1 -1
  65. package/chunks/{task-update-26N2AUQT.js → task-update-4ANRU74G.js} +1 -1
  66. package/chunks/{team-create-RPZE626O.js → team-create-G4N2NCFN.js} +1 -1
  67. package/chunks/team-delete-M4ORNSTT.js +8 -0
  68. package/chunks/{todoWrite-JN3ZV5O2.js → todoWrite-RN2OP46T.js} +1 -1
  69. package/chunks/{tool-search-RDU7B45X.js → tool-search-WEUURHFZ.js} +1 -1
  70. package/chunks/{web-fetch-6RRSCIUU.js → web-fetch-VA2BZ4VR.js} +1 -1
  71. package/chunks/{web-search-3IXDQD7D.js → web-search-OVFXJQDS.js} +3 -5
  72. package/chunks/{workflow-P6YL6ZHY.js → workflow-6VMVM5BG.js} +2 -2
  73. package/chunks/write-file-5ZAZVXBB.js +15 -0
  74. package/cli.js +471 -455
  75. package/locales/ca.js +6 -2
  76. package/locales/de.js +6 -2
  77. package/locales/en.js +35 -2
  78. package/locales/fr.js +6 -2
  79. package/locales/ja.js +6 -2
  80. package/locales/pt.js +6 -2
  81. package/locales/ru.js +6 -2
  82. package/package.json +2 -2
  83. package/chunks/agent-BXVCIBXW.js +0 -3
  84. package/chunks/agent-headless-64NUELGA.js +0 -3
  85. package/chunks/ca-JKEHLTNL.js +0 -23
  86. package/chunks/chunk-5JCW6FH6.js +0 -8
  87. package/chunks/chunk-7AEOFDY3.js +0 -8
  88. package/chunks/chunk-7YEKK577.js +0 -2602
  89. package/chunks/chunk-A5QKQKJW.js +0 -56
  90. package/chunks/chunk-AEYNMLMW.js +0 -36
  91. package/chunks/chunk-BSSOFLAZ.js +0 -80
  92. package/chunks/chunk-DEN6RR3B.js +0 -3
  93. package/chunks/chunk-HRCRNKY2.js +0 -8
  94. package/chunks/chunk-IV6PS6DB.js +0 -8
  95. package/chunks/chunk-RH3AEZWO.js +0 -9
  96. package/chunks/chunk-S6SR7XG2.js +0 -121
  97. package/chunks/chunk-SMTY6M3W.js +0 -10
  98. package/chunks/chunk-TKEFJ3O3.js +0 -9
  99. package/chunks/chunk-ZSGBDQXU.js +0 -11
  100. package/chunks/de-GMGNR5CZ.js +0 -23
  101. package/chunks/en-3NQMLVKW.js +0 -23
  102. package/chunks/fr-WS3EBB36.js +0 -23
  103. package/chunks/grep-CDC2COXY.js +0 -22
  104. package/chunks/ja-GBCDQ43R.js +0 -23
  105. package/chunks/ls-3EEHZY4W.js +0 -15
  106. package/chunks/mcp-client-3GTPI6IS.js +0 -3
  107. package/chunks/monitor-AHLS4MYF.js +0 -32
  108. package/chunks/notebook-edit-6HEQYPZ3.js +0 -17
  109. package/chunks/openaiContentGenerator-CQQ7EBHB.js +0 -47
  110. package/chunks/pt-VID6J2CM.js +0 -23
  111. package/chunks/read-file-EWNDGS3Y.js +0 -3
  112. package/chunks/ripGrep-6BXNDTIT.js +0 -3
  113. package/chunks/ru-EB6V6EAN.js +0 -23
  114. package/chunks/scheduler-FLVTLJFY.js +0 -8
  115. package/chunks/shell-FVBBSL2E.js +0 -3
  116. package/chunks/symbol-search-ZM3HFCUV.js +0 -19
  117. package/chunks/team-delete-XCKD5FBZ.js +0 -8
  118. package/chunks/write-file-BYAPFQ5P.js +0 -15
@@ -1,8 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{b as E}from"./chunk-7ZATDBWL.js";import{Ba as P}from"./chunk-7YEKK577.js";import"./chunk-HRCRNKY2.js";import"./chunk-ZSGBDQXU.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-DEN6RR3B.js";import"./chunk-RH3AEZWO.js";import"./chunk-UICLGQTV.js";import"./chunk-A5QKQKJW.js";import"./chunk-YY64FVJG.js";import"./chunk-SMTY6M3W.js";import"./chunk-QXSBPCBA.js";import"./chunk-ZABAV4XA.js";import"./chunk-V6UPUMP3.js";import"./chunk-5B2QERWR.js";import"./chunk-5JCW6FH6.js";import"./chunk-BSSOFLAZ.js";import"./chunk-7ZODGQO6.js";import"./chunk-GT6MSEK4.js";import"./chunk-S6SR7XG2.js";import"./chunk-225CZWD7.js";import"./chunk-LBQNFSZ2.js";import"./chunk-FPGKJJJY.js";import"./chunk-6T25BBKH.js";import"./chunk-IV6PS6DB.js";import"./chunk-6RK6IJY5.js";import"./chunk-LONWTJOE.js";import"./chunk-TKEFJ3O3.js";import"./chunk-7AEOFDY3.js";import"./chunk-XPVKH5TC.js";import"./chunk-KYNP66YS.js";import{O as l,Y as c}from"./chunk-AEYNMLMW.js";import"./chunk-UM6CLO7D.js";import"./chunk-HEJO7OBH.js";import{b as s}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";s();import{stat as V}from"node:fs/promises";import{join as p}from"node:path";s();import{readdir as N,stat as H,rm as F,rmdir as A}from"node:fs/promises";import{join as y}from"node:path";var k=c("HOUSEKEEPING"),U=24*60*60*1e3,$=60*60*1e3,_=20;function T(e){let t=e>0?e*U:$;return new Date(Date.now()-t)}async function b(e){let t={removed:0,errors:0},r=y(l.getGlobalMatildaDir(),P),i=e.excludeSessionIds??new Set,o;try{o=await N(r,{withFileTypes:!0})}catch(n){return G(n)||k.error("readdir failed",n),t}let a=o.filter(n=>n.isDirectory()&&!i.has(n.name)).map(n=>y(r,n.name));for(let n=0;n<a.length;n+=_){let v=a.slice(n,n+_);await Promise.all(v.map(async g=>{try{(await H(g)).mtime<e.cutoffDate&&(await F(g,{recursive:!0,force:!0}),t.removed++)}catch(w){t.errors++,k.error(`failed to sweep ${g}`,w)}}))}return await A(r).catch(()=>{}),t}function G(e){return e?.code==="ENOENT"}s();import{mkdir as Y,open as K,stat as I,unlink as D,writeFile as j}from"node:fs/promises";import{dirname as B}from"node:path";var m=c("HOUSEKEEPING"),q=24*60*60*1e3,J=60*60*1e3;async function R(e,t){let r=e.minIntervalMs??q,i=e.staleLockMs??J;if(await Y(B(e.lockPath),{recursive:!0,mode:448}).catch(()=>{}),await C(e.markerPath,r,e.name))return!1;let o=await h(e.lockPath);if(!o){try{let a=await I(e.lockPath);Date.now()-a.mtimeMs>i&&(await D(e.lockPath).catch(()=>{}),o=await h(e.lockPath))}catch{o=await h(e.lockPath)}if(!o)return m.debug(`${e.name}: skipping, lock held`),!1}try{if(await C(e.markerPath,r,e.name))return!1;let a=!1;try{await t(),a=!0}finally{if(a)try{await j(e.markerPath,new Date().toISOString())}catch(n){m.debug(`${e.name}: marker write failed (cleanup succeeded)`,n)}}return a}finally{await D(e.lockPath).catch(()=>{m.debug(`${e.name}: lock unlink failed (harmless)`)})}}async function C(e,t,r){try{let i=await I(e),o=Date.now()-i.mtimeMs;if(o<t)return m.debug(`${r}: skipping, ran ${o}ms ago`),!0}catch{}return!1}async function h(e){try{return await(await K(e,"wx")).close(),!0}catch(t){if(t?.code==="EEXIST")return!1;throw t}}var u=c("HOUSEKEEPING"),O=10*60*1e3,W=24*60*60*1e3,X=60*1e3,z=7*24*60*60*1e3,Q=60*1e3,f=".file-history-cleanup",d=!1;function pe(e,t){d||(d=!0,Z(e,t).catch(r=>{d=!1,u.error("scheduleFirstPass failed; chain will retry on next start",r)}))}async function Z(e,t){let r=p(l.getGlobalMatildaDir(),f),i=await L(r)?Q:O;u.debug(`first pass in ${i/1e3}s`),setTimeout(()=>S(e,t),i).unref()}async function L(e){try{let t=await V(e);return Date.now()-t.mtimeMs>z}catch{return!0}}async function M(e,t){if(E()<X){u.debug("user active, deferring 10 min"),setTimeout(()=>S(e,t),O).unref();return}try{await x(e,t)}catch(r){u.error("housekeeping pass failed; will retry next cycle",r)}setTimeout(()=>S(e,t),W).unref()}function S(e,t){M(e,t).catch(r=>{u.error("runPass rejected unexpectedly",r)})}async function x(e,t){let r=t.merged.general?.cleanupPeriodDays??30,i=T(r),o=e.getSessionId(),a=l.getGlobalMatildaDir();await R({name:"file-history-cleanup",markerPath:p(a,f),lockPath:p(a,f+".lock")},async()=>{let n=await b({cutoffDate:i,excludeSessionIds:new Set([o])});u.debug(`file-history: removed=${n.removed} errors=${n.errors}`)})}function Se(){d=!1}var we=L,Pe=x,Ee=M,ye=f;export{ye as _FILE_HISTORY_MARKER_FOR_TESTING,we as _needsCatchUpForTesting,Se as _resetForTesting,Pe as _runHousekeepingForTesting,Ee as _runPassForTesting,pe as startBackgroundHousekeeping};
4
- /**
5
- * @license
6
- * Copyright 2025 Google LLC
7
- * SPDX-License-Identifier: Apache-2.0
8
- */
@@ -1,3 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{fc as a,gc as b,hc as c,ic as d,jc as e,kc as f,lc as g}from"./chunk-7YEKK577.js";import"./chunk-HRCRNKY2.js";import"./chunk-ZSGBDQXU.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-DEN6RR3B.js";import"./chunk-RH3AEZWO.js";import"./chunk-UICLGQTV.js";import"./chunk-A5QKQKJW.js";import"./chunk-YY64FVJG.js";import"./chunk-SMTY6M3W.js";import"./chunk-QXSBPCBA.js";import"./chunk-ZABAV4XA.js";import"./chunk-V6UPUMP3.js";import"./chunk-5B2QERWR.js";import"./chunk-5JCW6FH6.js";import"./chunk-BSSOFLAZ.js";import"./chunk-7ZODGQO6.js";import"./chunk-GT6MSEK4.js";import"./chunk-S6SR7XG2.js";import"./chunk-225CZWD7.js";import"./chunk-LBQNFSZ2.js";import"./chunk-FPGKJJJY.js";import"./chunk-6T25BBKH.js";import"./chunk-IV6PS6DB.js";import"./chunk-6RK6IJY5.js";import"./chunk-LONWTJOE.js";import"./chunk-TKEFJ3O3.js";import"./chunk-7AEOFDY3.js";import"./chunk-XPVKH5TC.js";import"./chunk-KYNP66YS.js";import"./chunk-AEYNMLMW.js";import"./chunk-UM6CLO7D.js";import"./chunk-HEJO7OBH.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{b as OUTPUT_UPDATE_INTERVAL_MS,g as ShellTool,f as ShellToolInvocation,c as buildLongRunningForegroundHint,d as detectBlockedSleepPattern,a as parseNumstat,e as repairLeakedShellToolArgMarkup};
@@ -1,19 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{c as w,d as A}from"./chunk-ZSGBDQXU.js";import{f as h,g as x,m as d,n as S}from"./chunk-KYNP66YS.js";import{Y as g}from"./chunk-AEYNMLMW.js";import"./chunk-HEJO7OBH.js";import{b as u}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";u();import C from"node:path";u();import k from"node:fs/promises";import f from"node:path";u();var D={".ts":"typescript",".tsx":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".go":"go",".rs":"rust",".java":"java"},T={typescript:[{kind:"interface",re:/^\s*(?:export\s+)?interface\s+([A-Za-z_$][\w$]*)/},{kind:"type",re:/^\s*(?:export\s+)?type\s+([A-Za-z_$][\w$]*)\s*=/},{kind:"enum",re:/^\s*(?:export\s+)?enum\s+([A-Za-z_$][\w$]*)/},{kind:"class",re:/^\s*(?:export\s+)?(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/},{kind:"function",re:/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)/},{kind:"const",re:/^\s*(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:\(|function\b)/},{kind:"method",re:/^\s+(?:public|private|protected|async|static|readonly|\s)*([A-Za-z_$][\w$]*)\s*\([^;]*\)\s*[:{]/}],javascript:[{kind:"class",re:/^\s*(?:export\s+)?class\s+([A-Za-z_$][\w$]*)/},{kind:"function",re:/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)/},{kind:"const",re:/^\s*(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:\(|function\b)/}],python:[{kind:"class",re:/^\s*class\s+([A-Za-z_][\w]*)\s*[(:]/},{kind:"function",re:/^\s*(?:async\s+)?def\s+([A-Za-z_][\w]*)\s*\(/}],go:[{kind:"function",re:/^func\s+(?:\([^)]+\)\s+)?([A-Za-z_][\w]*)\s*\(/},{kind:"type",re:/^type\s+([A-Za-z_][\w]*)\s+(?:struct|interface|func|=)/}],rust:[{kind:"function",re:/^\s*(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?fn\s+([A-Za-z_][\w]*)/},{kind:"class",re:/^\s*(?:pub(?:\([^)]*\))?\s+)?(?:struct|enum|trait)\s+([A-Za-z_][\w]*)/}],java:[{kind:"class",re:/^\s*(?:public|private|protected)?\s*(?:abstract|final)?\s*class\s+([A-Za-z_][\w]*)/},{kind:"interface",re:/^\s*(?:public|private|protected)?\s*interface\s+([A-Za-z_][\w]*)/},{kind:"method",re:/^\s+(?:public|private|protected)\s+(?:static\s+)?[\w<>,\s[\]]+\s+([A-Za-z_][\w]*)\s*\(/}]};function y(m){let i=m.toLowerCase(),t=i.lastIndexOf(".");if(!(t<0))return D[i.slice(t)]}function _(m,i){let t=y(m);if(!t)return[];let o=T[t];if(!o)return[];let a=[],r=i.split(/\r?\n/);for(let e=0;e<r.length;e++){let s=r[e];for(let{kind:c,re:n}of o){let l=n.exec(s);if(l?.[1]&&!(l[1]==="if"||l[1]==="for"||l[1]==="while"||l[1]==="switch")){a.push({name:l[1],kind:c,filePath:m,line:e+1,snippet:s.trim().slice(0,200)});break}}}return a}var z=2e3,E=512*1024,p=class{constructor(i,t,o={}){this.rootDir=i;this.filePaths=t;this.opts=o}symbols=[];built=!1;async build(i){let t=this.opts.maxFiles??z,o=this.opts.maxFileBytes??E,a=[],r=0;for(let e of this.filePaths){if(i?.aborted||r>=t)break;let s=f.isAbsolute(e)?e:f.join(this.rootDir,e);if(!y(s))continue;let c;try{let l=await k.stat(s);if(!l.isFile()||l.size>o)continue;c=await k.readFile(s,"utf8")}catch{continue}let n=f.relative(this.rootDir,s)||s;a.push(..._(n,c)),r+=1}return this.symbols=a,this.built=!0,this.symbols.length}isBuilt(){return this.built}size(){return this.symbols.length}search(i){let t=i.query.trim().toLowerCase();if(!t)return[];let o=i.maxResults??25,a=i.pathPrefix?.replace(/\\/g,"/").toLowerCase(),r=[];for(let e of this.symbols){if(i.kind&&e.kind!==i.kind||a&&!e.filePath.replace(/\\/g,"/").toLowerCase().includes(a))continue;let s=e.name.toLowerCase(),c=0;if(s===t)c=100;else if(s.startsWith(t))c=80;else if(s.includes(t))c=50;else if(e.snippet.toLowerCase().includes(t))c=20;else continue;r.push({s:e,score:c})}return r.sort((e,s)=>s.score-e.score||e.s.filePath.localeCompare(s.s.filePath)),r.slice(0,o).map(e=>e.s)}};var $=g("SYMBOL_SEARCH"),v=new Map,F=6e4,b=class extends h{constructor(t,o){super(o);this.config=t}async getDefaultPermission(){return"allow"}getDescription(){return`Find symbol \`${this.params.query}\``}async execute(t){let o=this.params.query?.trim();if(!o)return{llmContent:"Error: query is required",returnDisplay:"Error: query is required",error:{message:"query is required",type:"invalid_tool_params"}};let a=this.config.getTargetDir();try{let r=await this.getOrBuildIndex(a,t),e=r.search({query:o,pathPrefix:this.params.path,kind:this.params.kind,maxResults:this.params.max_results??25});if(e.length===0)return{llmContent:`No symbols matching "${o}". Try grep_search for textual matches.`,returnDisplay:"No symbols found"};let s=e.map(n=>`${n.kind} ${n.name} \u2014 ${n.filePath}:${n.line}
4
- ${n.snippet}`);return{llmContent:[`Found ${e.length} symbol(s) for "${o}" (index size ${r.size()}):`,...s].join(`
5
- `),returnDisplay:`Found ${e.length} symbol(s)`}}catch(r){let e=r instanceof Error?r.message:String(r);return $.debug(`symbol_search failed: ${e}`),{llmContent:`symbol_search failed: ${e}`,returnDisplay:"symbol_search failed",error:{message:e,type:"execution_failed"}}}}async getOrBuildIndex(t,o){let a=v.get(t);if(a&&Date.now()-a.builtAt<F&&a.index.isBuilt())return a.index;let r=A({projectRoot:t,useGitignore:!0,useMatildaignore:!0,ignoreDirs:["node_modules","dist",".git","coverage","vendor"]}),e=[];try{e=await w({crawlDirectory:t,cwd:t,ignore:r,useGitignore:!0,maxDepth:12,maxFiles:5e3,cache:!0,cacheTtl:60})}catch(n){$.debug(`crawl failed, indexing empty: ${n instanceof Error?n.message:String(n)}`),e=[]}if(o.aborted)throw new Error("symbol_search aborted");let s=e.map(n=>C.isAbsolute(n)&&C.relative(t,n)||n),c=new p(t,s);return await c.build(o),v.set(t,{index:c,builtAt:Date.now()}),c}},P=class extends x{constructor(t){super(d.SYMBOL_SEARCH,S.SYMBOL_SEARCH,"Search the workspace for code symbols (functions, classes, types, methods) by name. Prefer this over blind grep when looking for definitions. Falls back gracefully when a language is not indexed.","search",{type:"object",properties:{query:{type:"string",description:"Symbol name or substring to find"},path:{type:"string",description:"Optional path prefix to limit the search"},kind:{type:"string",enum:["function","class","method","interface","type","const","enum"],description:"Optional symbol kind filter"},max_results:{type:"number",description:"Maximum results to return (default 25)"}},required:["query"]});this.config=t}static Name=d.SYMBOL_SEARCH;createInvocation(t){return new b(this.config,t)}};export{P as SymbolSearchTool};
6
- /**
7
- * @license
8
- * Copyright 2026 Matilda Team
9
- * SPDX-License-Identifier: Apache-2.0
10
- *
11
- * Lightweight symbol extraction for the symbol_search tool.
12
- * Regex-based MVP — tree-sitter grammars can replace per language later
13
- * without changing the CodeIndex / tool surface.
14
- */
15
- /**
16
- * @license
17
- * Copyright 2026 Matilda Team
18
- * SPDX-License-Identifier: Apache-2.0
19
- */
@@ -1,8 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{a as T,d as f}from"./chunk-RH3AEZWO.js";import{n as o}from"./chunk-UICLGQTV.js";import{e as g}from"./chunk-QXSBPCBA.js";import"./chunk-7ZODGQO6.js";import"./chunk-GT6MSEK4.js";import"./chunk-7AEOFDY3.js";import{f as l,g as c,m as p,n as u}from"./chunk-KYNP66YS.js";import{Y as i}from"./chunk-AEYNMLMW.js";import"./chunk-HEJO7OBH.js";import{b as m}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";m();var E=i("TEAM_DELETE"),r=class extends l{constructor(t,n){super(n);this.config=t}getDescription(){return"Delete current team"}async execute(){if(g()){let e="Only the team leader can delete the team.";return{llmContent:e,returnDisplay:e,error:{message:e}}}let t=this.config.getTeamManager();if(!t){let e="No active team to delete.";return{llmContent:e,returnDisplay:e,error:{message:e}}}let a=t.getTeamFile().name;try{await t.cleanup()}catch(e){E.warn("Team cleanup failed; resetting team state anyway:",e)}await o(a),await new Promise(e=>setTimeout(e,250)),await o(a),f(a),this.config.setTeamManager(null),this.config.setTeamContext(null),T();let y={type:"team_result",teamName:a,action:"deleted"};return{llmContent:`Team "${a}" deleted.`,returnDisplay:y}}},d=class s extends c{constructor(t){super(s.Name,u.TEAM_DELETE,"Delete the current team. Stops all teammates, cleans up team files, tasks, and inboxes. Only the team leader can use this.","delete",{type:"object",properties:{},additionalProperties:!1});this.config=t}static Name=p.TEAM_DELETE;createInvocation(t){return new r(this.config,t)}};export{d as TeamDeleteTool};
4
- /**
5
- * @license
6
- * Copyright 2025 Matilda
7
- * SPDX-License-Identifier: Apache-2.0
8
- */
@@ -1,15 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{a as _}from"./chunk-TDFF4ZGY.js";import{Nb as k,Ob as q,Yb as C,Zb as u,bc as G,cc as Q,dc as V,ec as Y,gb as Z,ya as S}from"./chunk-7YEKK577.js";import"./chunk-HRCRNKY2.js";import"./chunk-ZSGBDQXU.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-DEN6RR3B.js";import"./chunk-RH3AEZWO.js";import"./chunk-UICLGQTV.js";import"./chunk-A5QKQKJW.js";import"./chunk-YY64FVJG.js";import"./chunk-SMTY6M3W.js";import"./chunk-QXSBPCBA.js";import"./chunk-ZABAV4XA.js";import"./chunk-V6UPUMP3.js";import"./chunk-5B2QERWR.js";import"./chunk-5JCW6FH6.js";import"./chunk-BSSOFLAZ.js";import"./chunk-7ZODGQO6.js";import"./chunk-GT6MSEK4.js";import"./chunk-S6SR7XG2.js";import"./chunk-225CZWD7.js";import"./chunk-LBQNFSZ2.js";import"./chunk-FPGKJJJY.js";import{C as w,Db as K,H as B,xa as z,z as U}from"./chunk-6T25BBKH.js";import{l as H}from"./chunk-IV6PS6DB.js";import"./chunk-6RK6IJY5.js";import"./chunk-LONWTJOE.js";import"./chunk-TKEFJ3O3.js";import"./chunk-7AEOFDY3.js";import"./chunk-XPVKH5TC.js";import{f as $,g as N,m as L,n as j}from"./chunk-KYNP66YS.js";import{C as R,D as b,F as O,Y as M,c as d,e as D}from"./chunk-AEYNMLMW.js";import"./chunk-UM6CLO7D.js";import"./chunk-HEJO7OBH.js";import{b as I}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";I();import P from"node:fs";import y from"node:path";var F=M("WRITE_FILE"),ae=["filePath","filepath","path","file","filename"];function le(f){if(!(typeof f.file_path=="string"&&f.file_path.trim()))for(let a of ae){let o=f[a];if(typeof o=="string"&&o.trim()){f.file_path=o,delete f[a];return}}}function ce(f){let a=f.content;if(typeof a!="string"||!a.includes("<arg_")&&!a.includes("</arg_"))return;let o={},e=/<arg_key>\s*([A-Za-z_][\w]*)\s*<\/arg_key>\s*<arg_value>\s*([\s\S]+?)(?:<\/arg_value>|(?=<arg_key\b)|$)/gi,r;for(;(r=e.exec(a))!==null;){let i=r[1].toLowerCase(),n=r[2].trim();n&&(o[i]=n)}let l=/(?:^|[^>])([A-Za-z_][\w]*)\s*<\/arg_key>\s*<arg_value>\s*([\s\S]+?)(?:<\/arg_value>|(?=<arg_key\b)|(?=[A-Za-z_][\w]*\s*<\/arg_key>)|$)/gi;for(;(r=l.exec(a))!==null;){let i=r[1].toLowerCase(),n=r[2].trim();(n&&!o[i]||n&&n.length>=(o[i]?.length??0))&&(o[i]=n)}let h=[a.search(/<arg_key\b/i),a.search(/<\/arg_key\b/i),a.search(/<arg_value\b/i)].filter(i=>i>=0),g=h.length>0?Math.min(...h):-1;if(g>=0&&a.slice(g,g+10).startsWith("</arg_key")){let i=a.slice(0,g),n=/([A-Za-z_][\w]*)\s*$/.exec(i);n&&(g=n.index)}let c=g>=0?a.slice(0,g).trimEnd():a;c=c.replace(/<\/?arg_(?:key|value)\b[^>]*>/gi,"").trimEnd(),f.content=c;let m=new Set(["file_path","filepath","path","file","filename"]);for(let[i,n]of Object.entries(o))!m.has(i)||!n||!n.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(n)||(typeof f.file_path!="string"||!String(f.file_path).trim()||n.length>String(f.file_path).length)&&(f.file_path=n)}var A=class extends ${constructor(o,e){super(e);this.config=o}toolLocations(){return[{path:this.params.file_path}]}getDescription(){let o=b(this.params.file_path,this.config.getTargetDir());return`Writing to ${R(o)}`}async getDefaultPermission(){let o=this.config.getProjectRoot();return H(y.resolve(this.params.file_path),o)?"allow":"ask"}async getConfirmationDetails(o){let e=_(this.config,this.params.file_path);if(e)throw new C(e,"path_not_in_workspace");let r="",l=await w(this.params.file_path);if(!this.config.getFileReadCacheDisabled()){let i=await u(this.config.getFileReadCache(),this.params.file_path,"overwriting");if(!i.ok)throw new C(i.rawMessage,i.type)}if(l)try{let{content:i}=await this.config.getFileSystemService().readTextFile({path:this.params.file_path});r=i}catch(i){if(d(i)&&i.code==="ENOENT")l=!1;else throw new Error(`Error reading existing file for confirmation: ${D(i)}`)}if(l&&!this.config.getFileReadCacheDisabled()){let i=await u(this.config.getFileReadCache(),this.params.file_path,"overwriting",{expectExisting:!0});if(!i.ok)throw F.warn("post-read TOCTOU rejection (confirmation)",{path:this.params.file_path,reason:i.type}),new C(i.rawMessage,i.type)}let h=b(this.params.file_path,this.config.getTargetDir()),g=y.basename(this.params.file_path),c=S(g,r,this.params.content,"Current","Proposed",k);return{type:"edit",title:`Confirm Write: ${R(h)}`,fileName:g,filePath:this.params.file_path,fileDiff:c,originalContent:r,newContent:this.params.content,onConfirm:async i=>{i==="proceed_always"&&this.config.setApprovalMode("auto-edit")}}}async execute(o){let{file_path:e,content:r,ai_proposed_content:l,modified_by_user:h}=this.params,g=_(this.config,e);if(g)return{llmContent:g,returnDisplay:g,error:{message:g,type:"path_not_in_workspace"}};let c=await w(e),m="",i=!1,n,W,J=y.dirname(e);if(!this.config.getFileReadCacheDisabled()){let t=await u(this.config.getFileReadCache(),e,"overwriting");if(!t.ok)return{llmContent:t.rawMessage,returnDisplay:`Error: ${t.displayMessage}`,error:{message:t.rawMessage,type:t.type}}}if(c)try{let t=await this.config.getFileSystemService().readTextFile({path:e});t._meta?.bom!==void 0?i=t._meta.bom:i=t.content.length>0&&t.content.codePointAt(0)===65279,n=t._meta?.encoding||"utf-8",W=V(t.content),m=t.content,c=!0}catch(t){if(d(t)&&t.code==="ENOENT")c=!1;else{let s={message:D(t),code:d(t)?t.code:void 0},p=s.code?`Error checking existing file '${e}': ${s.message} (${s.code})`:`Error checking existing file: ${s.message}`;return{llmContent:p,returnDisplay:p,error:{message:p,type:"file_write_failure"}}}}if(c&&!this.config.getFileReadCacheDisabled()){let t=await u(this.config.getFileReadCache(),e,"overwriting",{expectExisting:!0});if(!t.ok)return F.warn("post-read TOCTOU rejection (execute)",{path:e,reason:t.type}),{llmContent:t.rawMessage,returnDisplay:`Error: ${t.displayMessage}`,error:{message:t.rawMessage,type:t.type}}}if(!c){let t=this.config.getDefaultFileEncoding();t===G.UTF8_BOM?i=!0:t===void 0&&(i=Q(e)),n=void 0}try{await this.config.getFileHistoryService().trackEdit(e)}catch{}if(!this.config.getFileReadCacheDisabled()){let t=await u(this.config.getFileReadCache(),e,"overwriting",{expectExisting:c});if(!t.ok)return F.warn("pre-write TOCTOU rejection",{path:e,reason:t.type}),{llmContent:t.rawMessage,returnDisplay:`Error: ${t.displayMessage}`,error:{message:t.rawMessage,type:t.type}}}let E=_(this.config,e);if(E)return{llmContent:E,returnDisplay:E,error:{message:E,type:"path_not_in_workspace"}};c||P.mkdirSync(J,{recursive:!0});try{let t=_(this.config,e);if(t)return{llmContent:t,returnDisplay:t,error:{message:t,type:"path_not_in_workspace"}};await this.config.getFileSystemService().writeTextFile({path:e,content:r,_meta:{bom:i,encoding:n,lineEnding:W}}),h||Z.getInstance().recordEdit(e,c?m:null,r);try{let T=P.statSync(e);this.config.getFileReadCache().recordWrite(e,T)}catch{}let s=y.basename(e),p=m,X=S(s,p,r,"Original","Written",k),ee=q(s,p,l||r,r),v=[c?`Successfully overwrote file: ${e}.`:`Successfully created and wrote to new file: ${e}.`];h&&v.push(`User modified the \`content\` to be: ${r}`);let te=U(e),ie=B(e),oe=y.extname(e),re=c?"update":"create",ne=r.split(`
4
- `).length;z(this.config,new K(x.Name,re,ne,te,oe,ie));let se={fileDiff:X,fileName:s,originalContent:m,newContent:r,diffStat:ee};try{let T=await Y(this.config,e);T&&v.push(`
5
-
6
- ${T}`)}catch{}return{llmContent:v.join(" "),returnDisplay:se}}catch(t){let s,p="file_write_failure";return d(t)?(s=`Error writing to file '${e}': ${t.message} (${t.code})`,t.code==="EACCES"?(s=`Permission denied writing to file: ${e} (${t.code})`,p="permission_denied"):t.code==="ENOSPC"?(s=`No space left on device: ${e} (${t.code})`,p="no_space_left"):t.code==="EISDIR"&&(s=`Target is a directory, not a file: ${e} (${t.code})`,p="target_is_directory"),this.config.getDebugMode()&&t.stack&&F.debug("Write file error stack:",t.stack)):t instanceof Error?s=`Error writing to file: ${t.message}`:s=`Error writing to file: ${String(t)}`,{llmContent:s,returnDisplay:s,error:{message:s,type:p}}}}},x=class f extends N{constructor(o){super(f.Name,j.WRITE_FILE,`Writes content to a specified file in the local filesystem.
7
-
8
- CRITICAL: Always emit file_path FIRST (absolute path), then content. Never omit file_path. Construct absolute paths from the project root + relative path (e.g. '/path/to/project/' + 'foo/bar.txt'). Relative paths are not supported.
9
-
10
- The user has the ability to modify \`content\`. If modified, this will be stated in the response.`,"edit",{properties:{file_path:{description:"REQUIRED. Absolute path to write (e.g. '/home/user/project/src/auth.ts'). Emit this BEFORE content.",type:"string"},content:{description:"The full file contents to write. Only after file_path is set.",type:"string"}},required:["file_path","content"],type:"object"});this.config=o}static Name=L.WRITE_FILE;validateToolParams(o){let e=o;return ce(e),le(e),(typeof o.file_path!="string"||!o.file_path.trim())&&typeof o.content=="string"&&o.content.length>0?'WriteFile requires absolute "file_path" (emit file_path first, then content). Retry with both file_path and content.':super.validateToolParams(o)}validateToolParamValues(o){let e=O(o.file_path.trim());if(o.file_path=e,!e)return'Missing or empty "file_path"';if(!y.isAbsolute(e))return`File path must be absolute: ${e}`;try{if(P.existsSync(e)&&P.lstatSync(e).isDirectory())return`Path is a directory, not a file: ${e}`}catch(r){return`Error accessing path properties for validation: ${e}. Reason: ${r instanceof Error?r.message:String(r)}`}return null}createInvocation(o){return new A(this.config,o)}toAutoClassifierInput(o){let e=o.content??"";return{file_path:o.file_path,byte_count:Buffer.byteLength(e,"utf8"),content_preview:e.slice(0,300),content_truncated:e.length>300}}getModifyContext(o){return{getFilePath:e=>e.file_path,getCurrentContent:async e=>{if(await w(e.file_path))try{let{content:l}=await this.config.getFileSystemService().readTextFile({path:e.file_path});return l}catch(l){if(!d(l)||l.code!=="ENOENT")throw l;return""}else return""},getProposedContent:async e=>e.content,createUpdatedParams:(e,r,l)=>{let h=l.content;return{...l,ai_proposed_content:h,content:r,modified_by_user:!0}}}}};export{x as WriteFileTool,le as normalizeWriteFilePathAliases,ce as repairLeakedWriteFileToolArgMarkup};
11
- /**
12
- * @license
13
- * Copyright 2025 Google LLC
14
- * SPDX-License-Identifier: Apache-2.0
15
- */