@maincode-ai/matilda-code 0.20.3 → 0.20.5
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/chunks/{agent-4RNSEEZX.js → agent-HSHZY2QX.js} +1 -1
- package/chunks/{agent-headless-NTXMW3FM.js → agent-headless-EWZCSQN6.js} +1 -1
- package/chunks/{chunk-6LIUW5R5.js → chunk-DYGICU2T.js} +1 -1
- package/chunks/{chunk-N3IX4XMF.js → chunk-GGP2HLPI.js} +2 -2
- package/chunks/{chunk-G7EIDUS7.js → chunk-H4N4VFUI.js} +1 -1
- package/chunks/{chunk-74AGGXB5.js → chunk-KXVDX2LL.js} +2 -2
- package/chunks/{chunk-KVSZW6OQ.js → chunk-OBPA6QHH.js} +1 -1
- package/chunks/{chunk-EYNNHFKW.js → chunk-RLPVQ5SY.js} +1 -1
- package/chunks/{computer-use-P4IDYC4J.js → computer-use-E54F2OXO.js} +1 -1
- package/chunks/{contextCommand-SKFGK2SU.js → contextCommand-6MJYOUNZ.js} +1 -1
- package/chunks/{edit-TV6P3WT7.js → edit-ECFAMGBL.js} +1 -1
- package/chunks/{enter-worktree-AG6GXV2J.js → enter-worktree-C3HT4E6R.js} +1 -1
- package/chunks/{enterPlanMode-VGWKDJPK.js → enterPlanMode-HJDOWUYD.js} +1 -1
- package/chunks/{exit-worktree-YO6O6AAY.js → exit-worktree-GYSJXOUF.js} +1 -1
- package/chunks/{exitPlanMode-KWX6IZOJ.js → exitPlanMode-OCEXPM5C.js} +1 -1
- package/chunks/{geminiContentGenerator-CIOHRT3R.js → geminiContentGenerator-EY3QPS5X.js} +1 -1
- package/chunks/{glob-GKPKCGEX.js → glob-42PS64FP.js} +1 -1
- package/chunks/{grep-PFYOVGTY.js → grep-6J5W5EJ7.js} +1 -1
- package/chunks/{matildaAgentContentGenerator-GS7RFWO6.js → matildaAgentContentGenerator-JEQ27NF6.js} +1 -1
- package/chunks/{matildaContentGenerator-5IHYJWWO.js → matildaContentGenerator-5FZK7UTU.js} +1 -1
- package/chunks/{monitor-WK5UBQTK.js → monitor-JGJ5W74B.js} +1 -1
- package/chunks/{notebook-edit-HZV3U5VO.js → notebook-edit-K3O75JIG.js} +1 -1
- package/chunks/{openaiContentGenerator-UZ7WXC3H.js → openaiContentGenerator-32LD27RZ.js} +1 -1
- package/chunks/{ripGrep-RMUZ7V7N.js → ripGrep-2ZK4OFYZ.js} +1 -1
- package/chunks/{scheduler-G6SSULHS.js → scheduler-WNS7XXCZ.js} +1 -1
- package/chunks/{serve-JQWFCHWK.js → serve-72ANQDL6.js} +1 -1
- package/chunks/{shell-BRCQH7TH.js → shell-Z6CWCFSW.js} +1 -1
- package/chunks/{src-Z4L3TPJT.js → src-PP2X6HOA.js} +1 -1
- package/chunks/{team-create-44CXVJIN.js → team-create-TV7R2OKS.js} +1 -1
- package/chunks/{workflow-VLVLE6WL.js → workflow-IV7OR3QI.js} +2 -2
- package/chunks/write-file-D7TUBP7Q.js +15 -0
- package/cli.js +395 -395
- package/package.json +2 -2
- package/chunks/write-file-TDEGAPPB.js +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maincode-ai/matilda-code",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.5",
|
|
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.
|
|
29
|
+
"sandboxImageUri": "ghcr.io/maincode/matilda-code:0.20.5"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {},
|
|
32
32
|
"optionalDependencies": {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as Y}from"./chunk-OCXGNAAT.js";import{a as V}from"./chunk-I55PXD4N.js";import{Kd as D,Ld as G,Ob as B,de as P,ee as p,ja as F,ke as q,le as H,oe as K}from"./chunk-N3IX4XMF.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-EYNNHFKW.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 k,Oa as N,_c as U,ca as L,ha as h}from"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{w as j}from"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as $,i as W,p as O,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{A as C,C as I,Y as M,a as f,c as _,z as w}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 y from"node:fs";import g from"node:path";var u=M("WRITE_FILE"),b=class extends ${constructor(a,t){super(t);this.config=a}toolLocations(){return[{path:this.params.file_path}]}getDescription(){let a=C(this.params.file_path,this.config.getTargetDir());return`Writing to ${w(a)}`}async getDefaultPermission(){let a=this.config.getProjectRoot();return j(g.resolve(this.params.file_path),a)?"allow":"ask"}async getConfirmationDetails(a){let t="",o=await h(this.params.file_path);if(!this.config.getFileReadCacheDisabled()){let i=await p(this.config.getFileReadCache(),this.params.file_path,"overwriting");if(!i.ok)throw new P(i.rawMessage,i.type)}if(o)try{let{content:i}=await this.config.getFileSystemService().readTextFile({path:this.params.file_path});t=i}catch(i){if(f(i)&&i.code==="ENOENT")o=!1;else throw new Error(`Error reading existing file for confirmation: ${_(i)}`)}if(o&&!this.config.getFileReadCacheDisabled()){let i=await p(this.config.getFileReadCache(),this.params.file_path,"overwriting",{expectExisting:!0});if(!i.ok)throw u.warn("post-read TOCTOU rejection (confirmation)",{path:this.params.file_path,reason:i.type}),new P(i.rawMessage,i.type)}let r=C(this.params.file_path,this.config.getTargetDir()),c=g.basename(this.params.file_path),s=F(c,t,this.params.content,"Current","Proposed",D);return{type:"edit",title:`Confirm Write: ${w(r)}`,fileName:c,filePath:this.params.file_path,fileDiff:s,originalContent:t,newContent:this.params.content,onConfirm:async i=>{i==="proceed_always"&&this.config.setApprovalMode("auto-edit")}}}async execute(a){let{file_path:t,content:o,ai_proposed_content:r,modified_by_user:c}=this.params,s=await h(t),m="",i=!1,E,R,J=g.dirname(t);if(!this.config.getFileReadCacheDisabled()){let e=await p(this.config.getFileReadCache(),t,"overwriting");if(!e.ok)return{llmContent:e.rawMessage,returnDisplay:`Error: ${e.displayMessage}`,error:{message:e.rawMessage,type:e.type}}}if(s)try{let e=await this.config.getFileSystemService().readTextFile({path:t});e._meta?.bom!==void 0?i=e._meta.bom:i=e.content.length>0&&e.content.codePointAt(0)===65279,E=e._meta?.encoding||"utf-8",R=K(e.content),m=e.content,s=!0}catch(e){if(f(e)&&e.code==="ENOENT")s=!1;else{let n={message:_(e),code:f(e)?e.code:void 0},l=n.code?`Error checking existing file '${t}': ${n.message} (${n.code})`:`Error checking existing file: ${n.message}`;return{llmContent:l,returnDisplay:l,error:{message:l,type:"file_write_failure"}}}}if(s&&!this.config.getFileReadCacheDisabled()){let e=await p(this.config.getFileReadCache(),t,"overwriting",{expectExisting:!0});if(!e.ok)return u.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(!s){let e=this.config.getDefaultFileEncoding();e===q.UTF8_BOM?i=!0:e===void 0&&(i=H(t)),E=void 0}try{await this.config.getFileHistoryService().trackEdit(t)}catch{}if(!this.config.getFileReadCacheDisabled()){let e=await p(this.config.getFileReadCache(),t,"overwriting",{expectExisting:s});if(!e.ok)return u.warn("pre-write TOCTOU rejection",{path:t,reason:e.type}),{llmContent:e.rawMessage,returnDisplay:`Error: ${e.displayMessage}`,error:{message:e.rawMessage,type:e.type}}}s||y.mkdirSync(J,{recursive:!0});try{await this.config.getFileSystemService().writeTextFile({path:t,content:o,_meta:{bom:i,encoding:E,lineEnding:R}}),c||B.getInstance().recordEdit(t,s?m:null,o);try{let d=y.statSync(t);this.config.getFileReadCache().recordWrite(t,d)}catch{}let e=g.basename(t),n=m,l=F(e,n,o,"Original","Written",D),Q=G(e,n,r||o,o),T=[s?`Successfully overwrote file: ${t}.`:`Successfully created and wrote to new file: ${t}.`];c&&T.push(`User modified the \`content\` to be: ${o}`);let X=L(t),Z=N(t),ee=g.extname(t),te=s?"update":"create",ie=o.split(`
|
|
4
|
-
`).length;k(this.config,new U(v.Name,te,ie,X,ee,Z));let oe={fileDiff:l,fileName:e,originalContent:m,newContent:o,diffStat:Q};try{let d=await V(this.config,t);d&&T.push(`
|
|
5
|
-
|
|
6
|
-
${d}`)}catch{}return{llmContent:T.join(" "),returnDisplay:oe}}catch(e){let n,l="file_write_failure";return f(e)?(n=`Error writing to file '${t}': ${e.message} (${e.code})`,e.code==="EACCES"?(n=`Permission denied writing to file: ${t} (${e.code})`,l="permission_denied"):e.code==="ENOSPC"?(n=`No space left on device: ${t} (${e.code})`,l="no_space_left"):e.code==="EISDIR"&&(n=`Target is a directory, not a file: ${t} (${e.code})`,l="target_is_directory"),this.config.getDebugMode()&&e.stack&&u.debug("Write file error stack:",e.stack)):e instanceof Error?n=`Error writing to file: ${e.message}`:n=`Error writing to file: ${String(e)}`,{llmContent:n,returnDisplay:n,error:{message:n,type:l}}}}},v=class S extends W{constructor(a){super(S.Name,A.WRITE_FILE,"Writes content to a specified file in the local filesystem. The file_path argument MUST be an absolute path. Always construct it by combining the project root with the file's relative path (e.g. project root '/path/to/project/' + relative 'foo/bar.txt' = '/path/to/project/foo/bar.txt'). If the user provides a relative path, resolve it against the project root first.\n\nThe user has the ability to modify `content`. If modified, this will be stated in the response.","edit",{properties:{file_path:{description:"The absolute path to the file to write to (e.g., '/home/user/project/file.txt'). Relative paths are not supported.",type:"string"},content:{description:"The content to write to the file.",type:"string"}},required:["file_path","content"],type:"object"});this.config=a}static Name=O.WRITE_FILE;validateToolParamValues(a){let t=I(a.file_path.trim());if(a.file_path=t,!t)return'Missing or empty "file_path"';if(!g.isAbsolute(t))return`File path must be absolute: ${t}`;let o=Y(this.config,t);if(o)return o;try{if(y.existsSync(t)&&y.lstatSync(t).isDirectory())return`Path is a directory, not a file: ${t}`}catch(r){return`Error accessing path properties for validation: ${t}. Reason: ${r instanceof Error?r.message:String(r)}`}return null}createInvocation(a){return new b(this.config,a)}toAutoClassifierInput(a){let t=a.content??"";return{file_path:a.file_path,byte_count:Buffer.byteLength(t,"utf8"),content_preview:t.slice(0,300),content_truncated:t.length>300}}getModifyContext(a){return{getFilePath:t=>t.file_path,getCurrentContent:async t=>{if(await h(t.file_path))try{let{content:r}=await this.config.getFileSystemService().readTextFile({path:t.file_path});return r}catch(r){if(!f(r)||r.code!=="ENOENT")throw r;return""}else return""},getProposedContent:async t=>t.content,createUpdatedParams:(t,o,r)=>{let c=r.content;return{...r,ai_proposed_content:c,content:o,modified_by_user:!0}}}}};export{v as WriteFileTool};
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2025 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
11
|
-
*/
|