@maincode-ai/matilda-code 0.20.5 → 0.20.6

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 (34) hide show
  1. package/chunks/{agent-HSHZY2QX.js → agent-HDDH3WWH.js} +1 -1
  2. package/chunks/{agent-headless-EWZCSQN6.js → agent-headless-PFQN5BHX.js} +1 -1
  3. package/chunks/{chunk-RLPVQ5SY.js → chunk-2N335HF6.js} +1 -1
  4. package/chunks/{chunk-KXVDX2LL.js → chunk-5Q5VQLNI.js} +2 -2
  5. package/chunks/{chunk-DYGICU2T.js → chunk-7DA5MA6P.js} +1 -1
  6. package/chunks/{chunk-H4N4VFUI.js → chunk-C3TKJIEI.js} +1 -1
  7. package/chunks/{chunk-GGP2HLPI.js → chunk-HJQPH3VO.js} +2 -2
  8. package/chunks/{chunk-OBPA6QHH.js → chunk-QI53E5X5.js} +1 -1
  9. package/chunks/{computer-use-E54F2OXO.js → computer-use-PAQTNCSC.js} +1 -1
  10. package/chunks/{contextCommand-6MJYOUNZ.js → contextCommand-TA4MSIXB.js} +1 -1
  11. package/chunks/{edit-ECFAMGBL.js → edit-5D3L2LZR.js} +1 -1
  12. package/chunks/{enter-worktree-C3HT4E6R.js → enter-worktree-GKR762NK.js} +1 -1
  13. package/chunks/{enterPlanMode-HJDOWUYD.js → enterPlanMode-XHWKKMOH.js} +1 -1
  14. package/chunks/{exit-worktree-GYSJXOUF.js → exit-worktree-WHVJTOAG.js} +1 -1
  15. package/chunks/{exitPlanMode-OCEXPM5C.js → exitPlanMode-BOVOBSGS.js} +1 -1
  16. package/chunks/{geminiContentGenerator-EY3QPS5X.js → geminiContentGenerator-KPMLIXOP.js} +1 -1
  17. package/chunks/{glob-42PS64FP.js → glob-K2M6NUCW.js} +1 -1
  18. package/chunks/{grep-6J5W5EJ7.js → grep-PAHK7X4N.js} +1 -1
  19. package/chunks/{matildaAgentContentGenerator-JEQ27NF6.js → matildaAgentContentGenerator-M5AWKAVH.js} +1 -1
  20. package/chunks/{matildaContentGenerator-5FZK7UTU.js → matildaContentGenerator-HGOVQHTG.js} +1 -1
  21. package/chunks/{monitor-JGJ5W74B.js → monitor-SOBOKNK5.js} +1 -1
  22. package/chunks/{notebook-edit-K3O75JIG.js → notebook-edit-UGKXTYDI.js} +1 -1
  23. package/chunks/{openaiContentGenerator-32LD27RZ.js → openaiContentGenerator-UZZ7H2SY.js} +1 -1
  24. package/chunks/{ripGrep-2ZK4OFYZ.js → ripGrep-EREDQIDF.js} +1 -1
  25. package/chunks/{scheduler-WNS7XXCZ.js → scheduler-XOTAP6CI.js} +1 -1
  26. package/chunks/{serve-72ANQDL6.js → serve-2VH474KE.js} +1 -1
  27. package/chunks/{shell-Z6CWCFSW.js → shell-ZHIYHTZW.js} +1 -1
  28. package/chunks/{src-PP2X6HOA.js → src-OQLWCXRR.js} +1 -1
  29. package/chunks/{team-create-TV7R2OKS.js → team-create-FPQEBUQV.js} +1 -1
  30. package/chunks/{workflow-IV7OR3QI.js → workflow-RLAMP4TO.js} +2 -2
  31. package/chunks/write-file-XGYYMOYV.js +15 -0
  32. package/cli.js +6 -6
  33. package/package.json +2 -2
  34. package/chunks/write-file-D7TUBP7Q.js +0 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maincode-ai/matilda-code",
3
- "version": "0.20.5",
3
+ "version": "0.20.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "cli.js",
@@ -26,7 +26,7 @@
26
26
  "bundled"
27
27
  ],
28
28
  "config": {
29
- "sandboxImageUri": "ghcr.io/maincode/matilda-code:0.20.5"
29
+ "sandboxImageUri": "ghcr.io/maincode/matilda-code:0.20.6"
30
30
  },
31
31
  "dependencies": {},
32
32
  "optionalDependencies": {
@@ -1,15 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{a as V}from"./chunk-OCXGNAAT.js";import{a as Q}from"./chunk-I55PXD4N.js";import{Kd as v,Ld as G,Ob as q,de as R,ee as g,ja as P,ke as H,le as z,oe as K}from"./chunk-GGP2HLPI.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-GIIMOLLN.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-SS5WUOSJ.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-RLPVQ5SY.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-XJDC3ZQZ.js";import{Lb as j,Oa as N,_c as B,ca as k,ha as y}from"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{w as U}from"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as M,i as $,p as O,q as L}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 D,C as W,Y as A,a as p,c as F,z as C}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as x}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";x();import T from"node:fs";import m from"node:path";var E=A("WRITE_FILE"),re=["filePath","filepath","path","file","filename"];function ne(c){if(!(typeof c.file_path=="string"&&c.file_path.trim()))for(let h of re){let i=c[h];if(typeof i=="string"&&i.trim()){c.file_path=i,delete c[h];return}}}var b=class extends M{constructor(i,t){super(t);this.config=i}toolLocations(){return[{path:this.params.file_path}]}getDescription(){let i=D(this.params.file_path,this.config.getTargetDir());return`Writing to ${C(i)}`}async getDefaultPermission(){let i=this.config.getProjectRoot();return U(m.resolve(this.params.file_path),i)?"allow":"ask"}async getConfirmationDetails(i){let t="",r=await y(this.params.file_path);if(!this.config.getFileReadCacheDisabled()){let o=await g(this.config.getFileReadCache(),this.params.file_path,"overwriting");if(!o.ok)throw new R(o.rawMessage,o.type)}if(r)try{let{content:o}=await this.config.getFileSystemService().readTextFile({path:this.params.file_path});t=o}catch(o){if(p(o)&&o.code==="ENOENT")r=!1;else throw new Error(`Error reading existing file for confirmation: ${F(o)}`)}if(r&&!this.config.getFileReadCacheDisabled()){let o=await g(this.config.getFileReadCache(),this.params.file_path,"overwriting",{expectExisting:!0});if(!o.ok)throw E.warn("post-read TOCTOU rejection (confirmation)",{path:this.params.file_path,reason:o.type}),new R(o.rawMessage,o.type)}let n=D(this.params.file_path,this.config.getTargetDir()),f=m.basename(this.params.file_path),a=P(f,t,this.params.content,"Current","Proposed",v);return{type:"edit",title:`Confirm Write: ${C(n)}`,fileName:f,filePath:this.params.file_path,fileDiff:a,originalContent:t,newContent:this.params.content,onConfirm:async o=>{o==="proceed_always"&&this.config.setApprovalMode("auto-edit")}}}async execute(i){let{file_path:t,content:r,ai_proposed_content:n,modified_by_user:f}=this.params,a=await y(t),d="",o=!1,_,I,Y=m.dirname(t);if(!this.config.getFileReadCacheDisabled()){let e=await g(this.config.getFileReadCache(),t,"overwriting");if(!e.ok)return{llmContent:e.rawMessage,returnDisplay:`Error: ${e.displayMessage}`,error:{message:e.rawMessage,type:e.type}}}if(a)try{let e=await this.config.getFileSystemService().readTextFile({path:t});e._meta?.bom!==void 0?o=e._meta.bom:o=e.content.length>0&&e.content.codePointAt(0)===65279,_=e._meta?.encoding||"utf-8",I=K(e.content),d=e.content,a=!0}catch(e){if(p(e)&&e.code==="ENOENT")a=!1;else{let s={message:F(e),code:p(e)?e.code:void 0},l=s.code?`Error checking existing file '${t}': ${s.message} (${s.code})`:`Error checking existing file: ${s.message}`;return{llmContent:l,returnDisplay:l,error:{message:l,type:"file_write_failure"}}}}if(a&&!this.config.getFileReadCacheDisabled()){let e=await g(this.config.getFileReadCache(),t,"overwriting",{expectExisting:!0});if(!e.ok)return E.warn("post-read TOCTOU rejection (execute)",{path:t,reason:e.type}),{llmContent:e.rawMessage,returnDisplay:`Error: ${e.displayMessage}`,error:{message:e.rawMessage,type:e.type}}}if(!a){let e=this.config.getDefaultFileEncoding();e===H.UTF8_BOM?o=!0:e===void 0&&(o=z(t)),_=void 0}try{await this.config.getFileHistoryService().trackEdit(t)}catch{}if(!this.config.getFileReadCacheDisabled()){let e=await g(this.config.getFileReadCache(),t,"overwriting",{expectExisting:a});if(!e.ok)return E.warn("pre-write TOCTOU rejection",{path:t,reason:e.type}),{llmContent:e.rawMessage,returnDisplay:`Error: ${e.displayMessage}`,error:{message:e.rawMessage,type:e.type}}}a||T.mkdirSync(Y,{recursive:!0});try{await this.config.getFileSystemService().writeTextFile({path:t,content:r,_meta:{bom:o,encoding:_,lineEnding:I}}),f||q.getInstance().recordEdit(t,a?d:null,r);try{let u=T.statSync(t);this.config.getFileReadCache().recordWrite(t,u)}catch{}let e=m.basename(t),s=d,l=P(e,s,r,"Original","Written",v),J=G(e,s,n||r,r),w=[a?`Successfully overwrote file: ${t}.`:`Successfully created and wrote to new file: ${t}.`];f&&w.push(`User modified the \`content\` to be: ${r}`);let X=k(t),Z=N(t),ee=m.extname(t),te=a?"update":"create",ie=r.split(`
4
- `).length;j(this.config,new B(S.Name,te,ie,X,ee,Z));let oe={fileDiff:l,fileName:e,originalContent:d,newContent:r,diffStat:J};try{let u=await Q(this.config,t);u&&w.push(`
5
-
6
- ${u}`)}catch{}return{llmContent:w.join(" "),returnDisplay:oe}}catch(e){let s,l="file_write_failure";return p(e)?(s=`Error writing to file '${t}': ${e.message} (${e.code})`,e.code==="EACCES"?(s=`Permission denied writing to file: ${t} (${e.code})`,l="permission_denied"):e.code==="ENOSPC"?(s=`No space left on device: ${t} (${e.code})`,l="no_space_left"):e.code==="EISDIR"&&(s=`Target is a directory, not a file: ${t} (${e.code})`,l="target_is_directory"),this.config.getDebugMode()&&e.stack&&E.debug("Write file error stack:",e.stack)):e instanceof Error?s=`Error writing to file: ${e.message}`:s=`Error writing to file: ${String(e)}`,{llmContent:s,returnDisplay:s,error:{message:s,type:l}}}}},S=class c extends ${constructor(i){super(c.Name,L.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=i}static Name=O.WRITE_FILE;validateToolParams(i){return ne(i),(typeof i.file_path!="string"||!i.file_path.trim())&&typeof i.content=="string"&&i.content.length>0?'WriteFile requires absolute "file_path" (emit file_path first, then content). Retry with both file_path and content.':super.validateToolParams(i)}validateToolParamValues(i){let t=W(i.file_path.trim());if(i.file_path=t,!t)return'Missing or empty "file_path"';if(!m.isAbsolute(t))return`File path must be absolute: ${t}`;let r=V(this.config,t);if(r)return r;try{if(T.existsSync(t)&&T.lstatSync(t).isDirectory())return`Path is a directory, not a file: ${t}`}catch(n){return`Error accessing path properties for validation: ${t}. Reason: ${n instanceof Error?n.message:String(n)}`}return null}createInvocation(i){return new b(this.config,i)}toAutoClassifierInput(i){let t=i.content??"";return{file_path:i.file_path,byte_count:Buffer.byteLength(t,"utf8"),content_preview:t.slice(0,300),content_truncated:t.length>300}}getModifyContext(i){return{getFilePath:t=>t.file_path,getCurrentContent:async t=>{if(await y(t.file_path))try{let{content:n}=await this.config.getFileSystemService().readTextFile({path:t.file_path});return n}catch(n){if(!p(n)||n.code!=="ENOENT")throw n;return""}else return""},getProposedContent:async t=>t.content,createUpdatedParams:(t,r,n)=>{let f=n.content;return{...n,ai_proposed_content:f,content:r,modified_by_user:!0}}}}};export{S as WriteFileTool,ne as normalizeWriteFilePathAliases};
11
- /**
12
- * @license
13
- * Copyright 2025 Google LLC
14
- * SPDX-License-Identifier: Apache-2.0
15
- */