@maincode-ai/matilda-code 0.21.3 → 0.21.4-nightly.20260905.7e39d84e0
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-66S7STX2.js +3 -0
- package/chunks/agent-headless-WW2OBVUG.js +3 -0
- package/chunks/{anthropicContentGenerator-EFVV6ZTA.js → anthropicContentGenerator-OPPJPVDU.js} +1 -1
- package/chunks/{askUserQuestion-MFLZ7MGJ.js → askUserQuestion-A2QN7TVJ.js} +1 -1
- package/chunks/{chunk-FT76AZPN.js → chunk-2I2V4XUL.js} +1 -1
- package/chunks/{chunk-ZYW5GLYY.js → chunk-33AEA6HT.js} +1 -1
- package/chunks/{chunk-5U3A6KMU.js → chunk-AEKLF65D.js} +1 -1
- package/chunks/{chunk-FUNLOUYI.js → chunk-CENHHSEM.js} +1 -1
- package/chunks/{chunk-QLEJOI4X.js → chunk-DGVOK3TF.js} +1 -1
- package/chunks/{chunk-QCIDUZV6.js → chunk-E5TINV2P.js} +1 -1
- package/chunks/{chunk-UY2R3ZQ4.js → chunk-FSHP4T24.js} +1 -1
- package/chunks/{chunk-IZ6YBZWM.js → chunk-GGEDWMSK.js} +1 -1
- package/chunks/{chunk-MNGFXISD.js → chunk-GQ2YYAZL.js} +1 -1
- package/chunks/{chunk-DBSJNFFU.js → chunk-H3FY5RLL.js} +1 -1
- package/chunks/{chunk-R3H6IWFK.js → chunk-HDKF447N.js} +1 -1
- package/chunks/{chunk-SUORCDGS.js → chunk-HT7HN5OM.js} +1 -1
- package/chunks/{chunk-EMWHQSMS.js → chunk-J3CHXXMF.js} +1 -1
- package/chunks/{chunk-QEI3OETI.js → chunk-KCXJKSZQ.js} +1 -1
- package/chunks/{chunk-6QP5C76Y.js → chunk-KLXSWVST.js} +1 -1
- package/chunks/{chunk-JDXISO3F.js → chunk-L7XRWU2E.js} +15 -15
- package/chunks/{chunk-7LNKXNEZ.js → chunk-LTO2UENO.js} +465 -465
- package/chunks/{chunk-LQWORCPO.js → chunk-M3ORBG44.js} +1 -1
- package/chunks/{chunk-OMZ5SGMK.js → chunk-PGDQTSIQ.js} +1 -1
- package/chunks/{chunk-FU2PKCG5.js → chunk-PGQHFMLT.js} +2 -2
- package/chunks/{chunk-IOCF4XSR.js → chunk-PLMDDD2P.js} +1 -1
- package/chunks/{chunk-4R2OFVPK.js → chunk-QR3OCHRD.js} +1 -1
- package/chunks/{chunk-NDR7ZFUA.js → chunk-R24IGHRQ.js} +1 -1
- package/chunks/{chunk-IMYUVCF7.js → chunk-UCSBOBSQ.js} +1 -1
- package/chunks/{chunk-S4K76QPI.js → chunk-V2MZCFBR.js} +1 -1
- package/chunks/{chunk-C2ZWB2NT.js → chunk-VU5XQRL6.js} +1 -1
- package/chunks/chunk-WGPRIGRF.js +14 -0
- package/chunks/{chunk-XKDGRW3K.js → chunk-YLQBVW4X.js} +1 -1
- package/chunks/{chunk-MJEXA2MA.js → chunk-YTWIKYJZ.js} +1 -1
- package/chunks/{computer-use-MCXFHFTP.js → computer-use-AVIK6OQX.js} +1 -1
- package/chunks/contextCommand-25B3YHXE.js +3 -0
- package/chunks/{cron-create-JHL5JGIM.js → cron-create-5RCP4NWY.js} +1 -1
- package/chunks/{cron-delete-K2R3KI2W.js → cron-delete-SBFRG4DY.js} +1 -1
- package/chunks/{cron-list-R3YHZBHA.js → cron-list-PL23TX2P.js} +1 -1
- package/chunks/{edit-KNZAPSGJ.js → edit-3QIFPPE3.js} +1 -1
- package/chunks/{enter-worktree-LJ66TFYR.js → enter-worktree-VHXSTMZA.js} +1 -1
- package/chunks/{enterPlanMode-P6EIGU3Y.js → enterPlanMode-XXKG5DRM.js} +1 -1
- package/chunks/{exit-worktree-QVQ3TLW5.js → exit-worktree-VSHFYAG3.js} +1 -1
- package/chunks/{exitPlanMode-I7SGPSG4.js → exitPlanMode-C656BEZX.js} +1 -1
- package/chunks/{geminiContentGenerator-SBVCQ423.js → geminiContentGenerator-WWRUHB75.js} +1 -1
- package/chunks/{glob-F5YOX6YA.js → glob-AWUA3QPG.js} +1 -1
- package/chunks/{grep-UOIHSM5U.js → grep-JYO3OWGL.js} +1 -1
- package/chunks/{keychain-token-storage-EAJ6RT4S.js → keychain-token-storage-6UB2PPV5.js} +1 -1
- package/chunks/{ls-4QPI2E7A.js → ls-IBFBZA4Z.js} +1 -1
- package/chunks/{lsp-P3GKBOP3.js → lsp-NSER2J4W.js} +1 -1
- package/chunks/{matildaAgentContentGenerator-EIQI4YCP.js → matildaAgentContentGenerator-NKCO47ZA.js} +1 -1
- package/chunks/{matildaContentGenerator-QMMGDPIK.js → matildaContentGenerator-RUK6DIEU.js} +1 -1
- package/chunks/{matildaOAuth2-LKOMJUC6.js → matildaOAuth2-PAVSTTZX.js} +1 -1
- package/chunks/{monitor-GDKHPTET.js → monitor-F74IK7WB.js} +1 -1
- package/chunks/{notebook-edit-LWH7H4WX.js → notebook-edit-VXDGVDRM.js} +1 -1
- package/chunks/{openaiContentGenerator-TNZ6SB7H.js → openaiContentGenerator-OJLDRGIB.js} +1 -1
- package/chunks/read-file-XN45MWM5.js +3 -0
- package/chunks/ripGrep-SFYJBDUG.js +3 -0
- package/chunks/{scheduler-EX674HYK.js → scheduler-V53IIFDL.js} +1 -1
- package/chunks/{send-message-K3T7GVHO.js → send-message-LDEJYKCJ.js} +1 -1
- package/chunks/{serve-FZ4FTA5D.js → serve-OLZWOGBC.js} +31 -31
- package/chunks/shell-ZHOJ26SW.js +3 -0
- package/chunks/{skill-KSYY6BM6.js → skill-S3OBISHW.js} +1 -1
- package/chunks/src-M62ILRLU.js +3 -0
- package/chunks/{symbol-search-3A66G4MP.js → symbol-search-G2EYFRRI.js} +1 -1
- package/chunks/{syntheticOutput-LLA4WQR7.js → syntheticOutput-CZD3GGPK.js} +1 -1
- package/chunks/task-create-T4SMA2CY.js +3 -0
- package/chunks/{task-list-6I64SK7E.js → task-list-2MTWQAW3.js} +1 -1
- package/chunks/{task-stop-UKRXMCZV.js → task-stop-JIMRQAPK.js} +1 -1
- package/chunks/{task-update-XZWORLJB.js → task-update-6MNKPW5Q.js} +1 -1
- package/chunks/{team-create-7PFAVYVV.js → team-create-FLLJNJPR.js} +1 -1
- package/chunks/{team-delete-DEPXAMUE.js → team-delete-7L34NVB2.js} +1 -1
- package/chunks/{todoWrite-DKJAYA4S.js → todoWrite-WZSVK5VK.js} +1 -1
- package/chunks/{tool-search-7D46IF5G.js → tool-search-K64UPG77.js} +1 -1
- package/chunks/{update-goal-EUJYH23K.js → update-goal-YNM23ENT.js} +1 -1
- package/chunks/{web-fetch-UGTFUOQN.js → web-fetch-EZTOVGZB.js} +1 -1
- package/chunks/{web-search-FURCBRRK.js → web-search-FZIMUA45.js} +1 -1
- package/chunks/{workflow-2TGFLD2R.js → workflow-KCEFM5NP.js} +2 -2
- package/chunks/{write-file-DQ6NYEJ7.js → write-file-CTKNW3L2.js} +1 -1
- package/cli.js +320 -320
- package/package.json +2 -2
- package/chunks/agent-WBKEN3MM.js +0 -3
- package/chunks/agent-headless-OJM6RWIA.js +0 -3
- package/chunks/chunk-QWBNNEV2.js +0 -14
- package/chunks/contextCommand-G4LS5GW6.js +0 -3
- package/chunks/read-file-URGJTANM.js +0 -3
- package/chunks/ripGrep-SL4ICAX6.js +0 -3
- package/chunks/shell-LLU55LCI.js +0 -3
- package/chunks/src-UXJDJ3RJ.js +0 -3
- package/chunks/task-create-ZZTSVXZN.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as c}from"./chunk-4F4DA5UI.js";import{k as i}from"./chunk-SDTWBD62.js";import{e as l}from"./chunk-
|
|
3
|
+
import{a as c}from"./chunk-4F4DA5UI.js";import{k as i}from"./chunk-SDTWBD62.js";import{e as l}from"./chunk-AEKLF65D.js";import{b as m}from"./chunk-GZPNIYVZ.js";m();import{readFile as y}from"node:fs/promises";function S(t){return t?`side-query:${t}`:"side-query"}function T(t,e){return e??t.getFastModel?.()??t.getModel()??c}function x(t){let e=t?.thinkingConfig;return{...t??{},thinkingConfig:e?{includeThoughts:!1,...e}:{includeThoughts:!1}}}async function C(t){let e=t.getOutputLanguageFilePath?.();if(e)try{let n=(await y(e,"utf8")).trim();return n?["Follow the user-visible output language preference below for this side query.",n].join(`
|
|
4
4
|
|
|
5
5
|
`):void 0}catch{return}}function h(t,e){return e?t===void 0?e:typeof t=="string"?`${t}
|
|
6
6
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{e as $,l as k,n as lt}from"./chunk-FWDMPRKU.js";import{b as c}from"./chunk-GZPNIYVZ.js";c();function G(t){return t instanceof Error&&"code"in t}function Nt(t){return!t||typeof t!="object"?!1:!!(t instanceof Error&&t.name==="AbortError"||G(t)&&t.code==="ABORT_ERR")}function $t(t){if(t instanceof Error){let e=t.cause;return e instanceof Error&&e.message!==t.message?`${t.message} (cause: ${e.message})`:t.message}try{return String(t)}catch{return"Failed to get error details"}}function Bt(t){if(typeof t!="object"||t===null)return;let e=t,n=e.status??e.statusCode??e.response?.status??e.error?.code;if(typeof n=="number"&&n>=100&&n<=599)return n;if(typeof e.message=="string"){let r=e.message.match(/HTTP_STATUS\/(\d{3})\b/);if(r){let o=Number(r[1]);if(o>=100&&o<=599)return o}}}function Ot(t){if(typeof t!="object"||t===null)return"unknown";let e=t instanceof Error&&t.constructor.name!=="Error"?t.constructor.name:void 0,n=t.type,r=e??n??(t instanceof Error?t.name:"unknown"),o=t instanceof Error?t.cause:void 0,i=o&&typeof o=="object"&&"code"in o?o.code:void 0;return i?`${r}:${i}`:r}var d=class extends Error{constructor(n,r){super(n);this.exitCode=r}},B=class extends d{constructor(e){super(e,41)}},O=class extends d{constructor(e){super(e,42)}},W=class extends d{constructor(e){super(e,44)}},E=class extends d{constructor(e){super(e,52)}},_=class extends d{constructor(e){super(e,53)}},F=class extends d{constructor(e){super(e,54)}},U=class extends d{constructor(e){super(e,55)}},H=class extends d{constructor(e){super(e,130)}},I=class extends Error{},L=class extends Error{},M=class extends Error{};function Wt(t){if(t&&typeof t=="object"&&"response"in t){let n=gt(t);if(n.error&&n.error.message&&n.error.code)switch(n.error.code){case 400:return new M(n.error.message);case 401:return new L(n.error.message);case 403:return new I(n.error.message);default:}}return t}function gt(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}c();import pt from"node:fs";import p from"node:path";import f from"node:os";import*as z from"node:crypto";var P=".matilda",Jt="google_accounts.json",b=new Map,dt=1024;function Kt(){b.clear()}var V=/[ \t()[\]{};|*?$`'"#&<>!~,]/,Xt=["file_path","path","filePath","notebook_path"],ft=(()=>{let t=V.source.slice(1,-1);return new RegExp(`\\\\([${t}])`,"g")})();function Zt(t){let e=f.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Yt(t){if(!t)return"";let e=t;return t.toLowerCase().startsWith("%userprofile%")?e=f.homedir()+t.substring(13):(t==="~"||t.startsWith("~/"))&&(e=f.homedir()+t.substring(1)),p.normalize(e)}function qt(t,e=80){if(t.length<=e)return t;let n=p.sep,r="...";if(e<10)return t.substring(0,e-3)+r;let i=p.parse(t).root,u=t.substring(i.length).split(n).filter(a=>a!=="");if(u.length===0)return i.length<=e?i:i.substring(0,e-3)+r;if(u.length===1){let a=i+u[0];if(a.length<=e)return a;let h=Math.floor((e-3)/2),x=a.substring(0,h),R=a.substring(a.length-h);return`${x}${r}${R}`}let l=i+u[0],j=[];for(let a=u.length-1;a>=1;a--){let h=u[a],x=[h,...j].join(n),R=a>1,y;if(R?y=l+n+r+n+x:y=l+n+x,y.length<=e){if(j.unshift(h),a===1)return y}else break}if(j.length===0){let a=Math.floor((e-3)/2),h=t.substring(0,a),x=t.substring(t.length-a);return`${h}${r}${x}`}return l+n+r+n+j.join(n)}function Qt(t,e){let n=p.resolve(t),r=p.resolve(e);return X(r,n)?p.relative(r,n)||".":n}function te(t){let e="";for(let n=0;n<t.length;n++){let r=t[n],o=0;for(let g=n-1;g>=0&&t[g]==="\\";g--)o++;!(o%2===1)&&V.test(r)?e+="\\"+r:e+=r}return e}function ee(t){return f.platform()==="win32"?t:t.replace(ft,"$1")}function J(t){let e=f.platform()==="win32"?t.toLowerCase():t;return z.createHash("sha256").update(e).digest("hex")}function K(t){return(f.platform()==="win32"?t.toLowerCase():t).replace(/[^a-zA-Z0-9]/g,"-")}function X(t,e){let r=f.platform()==="win32"?p.win32:p,o=r.relative(t,e);return!o.startsWith(`..${r.sep}`)&&o!==".."&&!r.isAbsolute(o)}function ne(t,e){return t.some(n=>X(n,e))}function ht(t=process.cwd(),e){let n=f.homedir();return e==="~"?n:e.startsWith("~/")?p.join(n,e.slice(2)):p.isAbsolute(e)?e:p.resolve(t,e)}function mt(t,e,n={}){let{allowFiles:r=!1,allowExternalPaths:o=!1}=n,g=t.getWorkspaceContext().isPathWithinWorkspace(e);if(!o&&!g)throw new Error("Path is not within workspace");if(o&&!g)return;let u=b.get(e);if(u===void 0){try{u=pt.statSync(e).isDirectory()}catch(l){throw G(l)&&l.code==="ENOENT"?new Error(`Path does not exist: ${e}`):l}if(b.size>=dt){let l=b.keys().next().value;l!==void 0&&b.delete(l)}b.set(e,u)}if(!r&&!u)throw new Error(`Path is not a directory: ${e}`)}function re(t,e,n={}){let r=t.getTargetDir();if(!e)return r;let o=ht(r,e);return mt(t,o,n),o}c();import*as s from"node:path";import*as m from"node:os";import*as S from"node:fs";import{AsyncLocalStorage as Dt}from"node:async_hooks";var xt="google_accounts.json",bt="oauth_creds.json",Et=[".matilda",".agents"],Z="tmp",Pt="bin",wt="projects",vt="ide",jt="plans",yt="debug",St="arena",D=class t{targetDir;pinnedRuntimeBaseDir;static runtimeBaseDir=null;static runtimeBaseDirContext=new Dt;constructor(e,n){this.targetDir=e,this.pinnedRuntimeBaseDir=n?t.resolvePath(n):void 0}getRuntimeBaseDir(){return this.pinnedRuntimeBaseDir??t.getRuntimeBaseDir()}static resolvePath(e,n){let r=e;if(r==="~"||r.startsWith("~/")||r.startsWith("~\\")){let o=r==="~"?[]:r.slice(2).split(/[/\\]+/).filter(Boolean);r=s.join(m.homedir(),...o)}return s.isAbsolute(r)||(r=n?s.resolve(n,r):s.resolve(r)),r}static sanitizePlanSessionId(e){return s.basename(e.replace(/\\/g,"/")).replace(/^\.+/g,"_").replace(/[<>:"|?*\x00-\x1F]/g,"_")||"_"}static resolveRuntimeBaseDir(e,n){return e?t.resolvePath(e,n):null}static setRuntimeBaseDir(e,n){t.runtimeBaseDir=t.resolveRuntimeBaseDir(e,n)}static runWithRuntimeBaseDir(e,n,r){let o=t.resolveRuntimeBaseDir(e,n);return t.runtimeBaseDirContext.run(o,r)}static getRuntimeBaseDir(){let e=process.env.MATILDA_RUNTIME_DIR;if(e)return t.resolveRuntimeBaseDir(e)??t.getGlobalMatildaDir();let n=t.runtimeBaseDirContext.getStore();return n!==void 0?n??t.getGlobalMatildaDir():t.runtimeBaseDir?t.runtimeBaseDir:t.getGlobalMatildaDir()}static getGlobalMatildaDir(){let e=process.env.MATILDA_HOME;if(e)return t.resolvePath(e);let n=m.homedir();return n?s.join(n,P):s.join(m.tmpdir(),".matilda")}static getMcpOAuthTokensPath(){return s.join(t.getGlobalMatildaDir(),"mcp-oauth-tokens.json")}static getGlobalSettingsPath(){return s.join(t.getGlobalMatildaDir(),"settings.json")}static getInstallationIdPath(){return s.join(t.getGlobalMatildaDir(),"installation_id")}static getGoogleAccountsPath(){return s.join(t.getGlobalMatildaDir(),xt)}static getUserCommandsDir(){return s.join(t.getGlobalMatildaDir(),"commands")}static getGlobalMemoryFilePath(){return s.join(t.getGlobalMatildaDir(),"memory.md")}static getGlobalTempDir(){return s.join(t.getRuntimeBaseDir(),Z)}static getGlobalDebugDir(){return s.join(t.getRuntimeBaseDir(),yt)}static getDebugLogPath(e){return s.join(t.getGlobalDebugDir(),`${e}.txt`)}static getGlobalIdeDir(){return s.join(t.getGlobalMatildaDir(),vt)}static resolvePathThroughExistingAncestor(e){let n=e;for(;;)try{let r=S.realpathSync(n),o=s.relative(n,e);return s.join(r,o)}catch(r){if(r.code!=="ENOENT")throw r;let o=s.dirname(n);if(o===n)return e;n=o}}static isPathWithinDirectory(e,n){let r=t.resolvePathThroughExistingAncestor(n),o=t.resolvePathThroughExistingAncestor(e),i=s.relative(r,o);return i===""||!i.startsWith("..")&&!s.isAbsolute(i)}static assertPathWithinDirectory(e,n,r){if(!t.isPathWithinDirectory(e,n))throw new E(r)}static getPlansDir(e,n){let r=n?.trim();if(r){if(!e)throw new E("projectRoot is required when plansDirectory is configured.");let o=s.resolve(e),i=t.resolvePath(r,o);return t.assertPathWithinDirectory(i,o,"plansDirectory must resolve within the project root."),i}return s.join(t.getGlobalMatildaDir(),jt)}static getPlanFilePath(e,n,r){return s.join(t.getPlansDir(n,r),`${t.sanitizePlanSessionId(e)}.md`)}static getGlobalBinDir(){return s.join(t.getGlobalMatildaDir(),Pt)}static getGlobalArenaDir(){return s.join(t.getGlobalMatildaDir(),St)}getMatildaDir(){return s.join(this.targetDir,P)}getProjectDir(){let e=K(this.getProjectRoot()),n=s.join(this.getRuntimeBaseDir(),wt);return s.join(n,e)}getProjectTempDir(){let e=J(this.getProjectRoot()),n=s.join(this.getRuntimeBaseDir(),Z);return s.join(n,e)}getToolResultsDir(){return s.join(this.getProjectTempDir(),"tool-results")}ensureProjectTempDirExists(){S.mkdirSync(this.getProjectTempDir(),{recursive:!0})}static getOAuthCredsPath(){return s.join(t.getGlobalMatildaDir(),bt)}getProjectRoot(){return this.targetDir}getWorkspaceSettingsPath(){return s.join(this.getMatildaDir(),"settings.json")}getProjectCommandsDir(){return s.join(this.getMatildaDir(),"commands")}getRuntimeStatusPath(e){return s.join(this.getProjectDir(),"chats",`${e}.runtime.json`)}getProjectTempCheckpointsDir(){return s.join(this.getProjectTempDir(),"checkpoints")}getExtensionsDir(){return s.join(this.getMatildaDir(),"extensions")}getExtensionsConfigPath(){return s.join(this.getExtensionsDir(),"matilda-extension.json")}getUserSkillsDirs(){let e=m.homedir()||m.tmpdir();return Et.map(n=>n===P?s.join(t.getGlobalMatildaDir(),"skills"):s.join(e,n,"skills"))}static getUserExtensionsDir(){return s.join(t.getGlobalMatildaDir(),"extensions")}getHistoryFilePath(){return s.join(this.getProjectTempDir(),"shell_history")}};c();import{promises as N}from"node:fs";import Y from"node:path";async function q(t,e,n){let{fallbackCopy:r=!0}=n??{},o=Y.dirname(t),i=Y.relative(o,e);try{await N.unlink(t)}catch{}try{await N.symlink(i,t);return}catch{}if(r)try{await N.copyFile(e,t)}catch{}}c();lt();c();var Q,tt;function me(t,e){Q=t,tt=e}function et(){return Q}function De(){return tt}function nt(t){let e=t?.spanContext();return e&&$(e)?{traceId:e.traceId,spanId:e.spanId,traceFlags:e.traceFlags}:null}function Ct(){try{return nt(k.getActiveSpan())}catch{return null}}function At(){try{let t=et();return nt(t?k.getSpan(t):void 0)}catch{return null}}function rt(){return Ct()??At()}function ve(t){let e=(t.traceFlags&255).toString(16).padStart(2,"0");return`00-${t.traceId}-${t.spanId}-${e}`}var st=!1;function je(t){st=t}function ye(){return st}c();import{promises as ot}from"node:fs";import Tt from"node:path";import{AsyncLocalStorage as Rt}from"node:async_hooks";import kt from"node:util";var v=null,A=null,T=!1,it=null,at=new Rt;function ct(){let t=process.env.MATILDA_DEBUG_LOG_FILE;if(!t)return!1;let e=t.trim().toLowerCase();return!["","0","false","off","no"].includes(e)}function w(){return at.getStore()??it}function ut(){let t=D.getGlobalDebugDir();return(!v||A!==t)&&(A=t,v=ot.mkdir(t,{recursive:!0}).then(()=>{}).catch(()=>{T=!0,v=null,A=null})),v??Promise.resolve()}function It(t){return t.map(e=>e instanceof Error?e.stack??`${e.name}: ${e.message}`:e).map(e=>typeof e=="string"?e:kt.inspect(e)).join(" ")}function Lt(t,e,n,r){let o=new Date().toISOString(),i=n?` [${n}]`:"",g=r?` [trace_id=${r.traceId} span_id=${r.spanId}]`:"";return`${o} [${t}]${i}${g} ${e}
|
|
4
|
+
`}function C(t,e,n,r){if(!ct())return;let o=t.getSessionId(),i=D.getDebugLogPath(o),g=It(r),u=rt(),l=Lt(e,g,n,u);ut().then(()=>ot.appendFile(i,l,"utf8")).catch(()=>{T=!0})}function Ge(){return T}function Ne(){T=!1,v=null,A=null}var Mt="latest";function Gt(t){if(!ct())return;let e=Tt.join(D.getGlobalDebugDir(),Mt),n=D.getDebugLogPath(t);ut().then(()=>q(e,n,{fallbackCopy:!1})).catch(()=>{})}function $e(t){it=t??null,t&&Gt(t.getSessionId())}function Be(t,e){return at.run(t,e)}function Oe(t){return{isEnabled:()=>w()!==null,debug:(...e)=>{let n=w();n&&C(n,"DEBUG",t,e)},info:(...e)=>{let n=w();n&&C(n,"INFO",t,e)},warn:(...e)=>{let n=w();n&&C(n,"WARN",t,e)},error:(...e)=>{let n=w();n&&C(n,"ERROR",t,e)}}}export{G as a,Nt as b,$t as c,Bt as d,Ot as e,d as f,B as g,O as h,W as i,E as j,_ as k,F as l,U as m,H as n,I as o,L as p,M as q,Wt as r,P as s,Jt as t,Kt as u,V as v,Xt as w,Zt as x,Yt as y,qt as z,Qt as A,te as B,ee as C,J as D,K as E,X as F,ne as G,ht as H,mt as I,re as J,Et as K,D as L,q as M,me as N,De as O,Ct as P,rt as Q,ve as R,je as S,ye as T,Ge as U,Ne as V,$e as W,Be as X,Oe as Y};
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2025 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright 2025 Matilda
|
|
13
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a,c}from"./chunk-
|
|
3
|
+
import{a,c}from"./chunk-WGPRIGRF.js";import{b as E}from"./chunk-GZPNIYVZ.js";E();import{URL as g}from"node:url";var l=[/^10\./,/^127\./,/^172\.(1[6-9]|2[0-9]|3[0-1])\./,/^192\.168\./,/^::1$/,/^fc00:/,/^fe80:/],f=new Set(["UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","SELF_SIGNED_CERT_IN_CHAIN","DEPTH_ZERO_SELF_SIGNED_CERT","CERT_HAS_EXPIRED","ERR_TLS_CERT_ALTNAME_INVALID"]),T=new Set([...f,"ECONNRESET","ETIMEDOUT","ECONNREFUSED","ENOTFOUND","EAI_AGAIN","EHOSTUNREACH","ENETUNREACH"]),u=class extends Error{constructor(t,o){super(t);this.code=o;this.name="FetchError"}};function S(n){try{let e=new g(n).hostname;return l.some(t=>t.test(e))}catch{return!1}}async function A(n,e,t){let o=new AbortController,r=setTimeout(()=>o.abort(),e);try{return await fetch(n,{signal:o.signal,headers:t})}catch(s){throw a(s)&&s.code==="ABORT_ERR"?new u(`Request timed out after ${e}ms`,"ETIMEDOUT"):new u(c(s))}finally{clearTimeout(r)}}function i(n){if(!(!n||typeof n!="object")&&"code"in n&&typeof n.code=="string")return n.code}function h(n){if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return String(n);if(n instanceof Error)return n.message;if(!n||typeof n!="object")return;let e=n.message;if(typeof e=="string")return e}function m(n){if(!(n instanceof Error))return;let e=n.cause;if(!e)return;let t=i(e),o=h(e);if(!(!t&&!o))return t&&o&&!o.includes(t)?`${t}: ${o}`:o??t}function N(n,e={}){let t=c(n),o=n instanceof Error?i(n.cause)??i(n):i(n),r=m(n),s=[t,r?`(cause: ${r})`:void 0].filter(Boolean).join(" "),d=t.toLowerCase().includes("fetch failed")||o!=null&&T.has(o),R=o!=null&&f.has(o);if(!d)return s;let _=["","Troubleshooting:",...e.url?[`- Confirm you can reach ${e.url} from this machine.`]:[],"- If you are behind a proxy, pass `--proxy <url>` (or set `proxy` in settings).",...R?["- If your network uses a corporate TLS inspection CA, set `NODE_EXTRA_CA_CERTS` to your CA bundle."]:[]];return`${s}${_.join(`
|
|
4
4
|
`)}`}export{S as a,A as b,N as c};
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{w as i}from"./chunk-
|
|
3
|
+
import{w as i}from"./chunk-FSHP4T24.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
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Matilda Team
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Ii as K,wf as X,yf as H}from"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{i as S}from"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as B,i as G}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.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
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{c as a,d as b,e as c}from"./chunk-33AEA6HT.js";import"./chunk-H3FY5RLL.js";import"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.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};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as p,c as f}from"./chunk-TXMXCR7D.js";import{a as y}from"./chunk-YULUB745.js";import{a as n}from"./chunk-
|
|
3
|
+
import{a as p,c as f}from"./chunk-TXMXCR7D.js";import{a as y}from"./chunk-YULUB745.js";import{a as n}from"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import{g as m,i as c,p as d,q as h}from"./chunk-AEKLF65D.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as u}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";u();var i=class extends m{constructor(e,t){super(t);this.config=e}getDescription(){return`${this.params.cron}: ${this.params.prompt}`}async getDefaultPermission(){return"ask"}async execute(){let e=this.config.getCronScheduler(),t=this.params.recurring!==!1,s=this.params.durable===!0;try{p(this.params.cron),f(this.params.cron,new Date);let r=s?await e.createDurable(this.params.cron,this.params.prompt,t):e.create(this.params.cron,this.params.prompt,t),o=y(r.cronExpr),w=`Scheduled ${r.id} (${o})${s?" [durable]":""}`,l=s?`Persisted to ${n}`:"Session-only (not written to disk, dies when Matilda exits)";return{llmContent:t?`Scheduled recurring job ${r.id} (${r.cronExpr}). ${l}. Auto-expires after 7 days. Use CronDelete to cancel sooner.`:`Scheduled one-shot task ${r.id} (${r.cronExpr}). ${l}. It will fire once then auto-delete.`,returnDisplay:w}}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error creating cron job: ${o}`,returnDisplay:o,error:{message:o}}}}},g=class a extends c{constructor(e){super(a.Name,h.CRON_CREATE,`Schedule a prompt to be enqueued at a future time. Use for both recurring schedules and one-shot reminders.
|
|
4
4
|
|
|
5
5
|
Uses standard 5-field cron in the user's local timezone: minute hour day-of-month month day-of-week. "0 9 * * *" means 9am local \u2014 no timezone conversion needed.
|
|
6
6
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as d,f as u}from"./chunk-
|
|
3
|
+
import{a as d,f as u}from"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import{g as l,i as c,p as m,q as p}from"./chunk-AEKLF65D.js";import"./chunk-PLMDDD2P.js";import{c as n}from"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as i}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";i();var s=class extends l{constructor(r,o){super(o);this.config=r}getDescription(){return this.params.id}async execute(){let r=this.config.getCronScheduler(),o;try{o=await r.delete(this.params.id),o||(o=await u(this.config.getProjectRoot(),[this.params.id])>0)}catch(e){let t=`Failed to cancel job ${this.params.id}: ${n(e)}`;return{llmContent:t,returnDisplay:t,error:{message:t}}}if(o){let e=`Cancelled job ${this.params.id}.`,t=`Cancelled ${this.params.id}`;return{llmContent:e,returnDisplay:t}}else{let e=`Job ${this.params.id} not found.`;return{llmContent:e,returnDisplay:e,error:{message:e}}}}},f=class a extends c{constructor(r){super(a.Name,p.CRON_DELETE,`Cancel a cron job previously scheduled with CronCreate. Removes it from the in-memory session store or from ${d} (durable jobs).`,"other",{type:"object",properties:{id:{type:"string",description:"Job ID returned by CronCreate."}},required:["id"],additionalProperties:!1},!0,!1,!0,!1,"cron delete cancel remove");this.config=r}static Name=m.CRON_DELETE;createInvocation(r){return new s(this.config,r)}};export{f as CronDeleteTool};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as m}from"./chunk-YULUB745.js";import{a as d,c as g}from"./chunk-
|
|
3
|
+
import{a as m}from"./chunk-YULUB745.js";import{a as d,c as g}from"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import{g as l,i as c,p,q as u}from"./chunk-AEKLF65D.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as a}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";a();var s=class extends l{constructor(e,t){super(t);this.config=e}getDescription(){return""}async execute(){let e=this.config.getCronScheduler(),t;try{t=await g(this.config.getProjectRoot())}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error listing cron jobs: ${o}`,returnDisplay:o,error:{message:o}}}let n=[...t.map(r=>({id:r.id,cron:r.cron,prompt:r.prompt,recurring:r.recurring,durable:!0})),...e.list().filter(r=>!r.durable).map(r=>({id:r.id,cron:r.cronExpr,prompt:r.prompt,recurring:r.recurring,durable:!1}))];if(n.length===0){let r="No active cron jobs.";return{llmContent:r,returnDisplay:r}}let y=n.map(r=>{let o=r.recurring?"recurring":"one-shot",h=r.durable?"durable":"session-only";return`${r.id} \u2014 ${r.cron} (${o}) [${h}]: ${r.prompt}`}).join(`
|
|
4
4
|
`),T=n.map(r=>`${r.id} ${m(r.cron)} [${r.durable?"durable":"session-only"}]`).join(`
|
|
5
5
|
`);return{llmContent:y,returnDisplay:T}}},f=class i extends c{constructor(e){super(i.Name,u.CRON_LIST,`List all cron jobs scheduled via CronCreate, both session-only and durable (${d}).`,"other",{type:"object",properties:{},additionalProperties:!1},!0,!1,!0,!1,"cron list scheduled jobs");this.config=e}static Name=p.CRON_LIST;createInvocation(e){return new s(this.config,e)}};export{f as CronListTool};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as y}from"./chunk-
|
|
3
|
+
import{a as y}from"./chunk-YTWIKYJZ.js";import{Me as R,Ne as x,Te as X,Ue as V,Xe as Q,_e as Y,ja as I,re as A,se as G,uc as q,ze as K}from"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.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-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{w as B}from"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{i as k,p as P,q as W}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{A as S,C as M,Y as $,a as C,z as w}from"./chunk-WGPRIGRF.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
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
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
6
|
`)&&(c=n.length)}return n.slice(f,c)}function de(n,t){let{lines:i,offsets:e}=fe(n),r=t.split(`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Pj as T,Uf as W,ag as s}from"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as $,i as E,p as m,q as R}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as b}from"./chunk-WGPRIGRF.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-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as m,i as u,p as d,q as c}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as p}from"./chunk-WGPRIGRF.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{Oj as C,Qj as x,Sf as k,Vf as W,ag as l}from"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as E,i as R,p as c,q as T}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as b,a as $}from"./chunk-WGPRIGRF.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{I as w,If as M,lg as $}from"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as G,i as R,p as T,q as _}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as f}from"./chunk-WGPRIGRF.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-
|
|
3
|
+
import{a as g}from"./chunk-J3CHXXMF.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-PLMDDD2P.js";import"./chunk-WGPRIGRF.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.4-nightly.20260905.7e39d84e0 (${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{Qe as _,Re as j}from"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import{b as D}from"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{g as k}from"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as M,i as C,p as N,q as A}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{C as $,F as O,J as v,Y as R,c as x}from"./chunk-WGPRIGRF.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{Kj as K,Lj as Y,Re as z,aa as q,fd as F}from"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{g as _}from"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as U,i as V,p as H,q as J}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{C as O,F as W,J as S,Y as j,a as I,c as P}from"./chunk-WGPRIGRF.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}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{b as a}from"./chunk-
|
|
3
|
+
import{b as a}from"./chunk-KCXJKSZQ.js";import"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{a as KeychainTokenStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{b as d}from"./chunk-RNKDFE2S.js";import{g as N}from"./chunk-
|
|
3
|
+
import{b as d}from"./chunk-RNKDFE2S.js";import{g as N}from"./chunk-FSHP4T24.js";import{g as C,i as x,p as w,q as F}from"./chunk-AEKLF65D.js";import{A as I,C as S,F as u,G as L,L as R,Y as O,z as E}from"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as v}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";v();import y from"node:fs/promises";import s from"node:path";var A=O("LS"),U=100,T=class extends C{constructor(t,e){super(e);this.config=t}shouldIgnore(t,e){if(!e||e.length===0)return!1;for(let i of e){let a=i.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");if(new RegExp(`^${a}$`).test(t))return!0}return!1}getDescription(){let t=I(this.params.path,this.config.getTargetDir());return E(t)}async getDefaultPermission(){let t=s.resolve(this.params.path),e=this.config.getWorkspaceContext(),i=this.config.storage.getUserSkillsDirs(),a=R.getUserExtensionsDir();return e.isPathWithinWorkspace(t)||L(i,t)||u(a,t)||u(N(),t)?"allow":"ask"}errorResult(t,e,i){return{llmContent:t,returnDisplay:`Error: ${e}`,error:{message:t,type:i}}}async execute(t){try{let e=await y.stat(this.params.path);if(!e)return this.errorResult(`Error: Directory not found or inaccessible: ${this.params.path}`,"Directory not found or inaccessible.","file_not_found");if(!e.isDirectory())return this.errorResult(`Error: Path is not a directory: ${this.params.path}`,"Path is not a directory.","path_is_not_a_directory");let i=await y.readdir(this.params.path);if(i.length===0)return{llmContent:`Directory ${this.params.path} is empty.`,returnDisplay:"Directory is empty."};let a=i.map(r=>s.relative(this.config.getTargetDir(),s.join(this.params.path,r))),_=this.config.getFileService(),{filteredPaths:k,gitIgnoredCount:P,matildaIgnoredCount:b}=_.filterFilesWithReport(a,{respectGitIgnore:this.params.file_filtering_options?.respect_git_ignore??this.config.getFileFilteringOptions().respectGitIgnore??d.respectGitIgnore,respectMatildaIgnore:this.params.file_filtering_options?.respect_matilda_ignore??this.config.getFileFilteringOptions().respectMatildaIgnore??d.respectMatildaIgnore}),l=[];for(let r of k){let o=s.resolve(this.config.getTargetDir(),r);if(!this.shouldIgnore(s.basename(o),this.params.ignore))try{let c=await y.stat(o),$=c.isDirectory();l.push({name:s.basename(o),path:o,isDirectory:$,size:$?0:c.size,modifiedTime:c.mtime})}catch(c){A.warn(`Error accessing ${o}: ${c}`)}}l.sort((r,o)=>r.isDirectory&&!o.isDirectory?-1:!r.isDirectory&&o.isDirectory?1:r.name.localeCompare(o.name));let p=l.length,g=Math.min(U,this.config.getTruncateToolOutputLines()),m=p>g,W=(m?l.slice(0,g):l).map(r=>`${r.isDirectory?"[DIR] ":""}${r.name}`).join(`
|
|
4
4
|
`),h=`Listed ${p} item(s) in ${this.params.path}:
|
|
5
5
|
---
|
|
6
6
|
${W}`;if(m){let r=p-g;h+=`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{g as b,i as D,p as R,q as N}from"./chunk-
|
|
3
|
+
import{g as b,i as D,p as R,q as N}from"./chunk-AEKLF65D.js";import{C as P}from"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as S}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";S();import $ from"node:path";import{fileURLToPath as L,pathToFileURL as q}from"node:url";var O=new Set(["goToDefinition","findReferences","hover","goToImplementation","prepareCallHierarchy"]),A=new Set(["documentSymbol","diagnostics"]),E=new Set(["workspaceSymbol"]),U=new Set(["incomingCalls","outgoingCalls"]),W=new Set(["codeActions"]),C=class extends b{constructor(t,e){super(e);this.config=t}getDescription(){let t=this.getOperationLabel();return this.params.operation==="workspaceSymbol"?`LSP ${t} for "${this.params.query??""}"`:this.params.operation==="documentSymbol"?this.params.filePath?`LSP ${t} for ${this.params.filePath}`:`LSP ${t}`:this.params.operation==="incomingCalls"||this.params.operation==="outgoingCalls"?`LSP ${t} for ${this.describeCallHierarchyItemShort()}`:this.params.filePath&&this.params.line!==void 0?`LSP ${t} at ${this.params.filePath}:${this.params.line}:${this.params.character??1}`:this.params.filePath?`LSP ${t} for ${this.params.filePath}`:`LSP ${t}`}async execute(t){let e=this.config.getLspClient();if(!e||!this.config.isLspEnabled()){let r=`LSP ${this.getOperationLabel()} is unavailable (LSP disabled or not initialized).`;return{llmContent:r,returnDisplay:r}}switch(this.params.operation){case"goToDefinition":return this.executeDefinitions(e);case"findReferences":return this.executeReferences(e);case"hover":return this.executeHover(e);case"documentSymbol":return this.executeDocumentSymbols(e);case"workspaceSymbol":return this.executeWorkspaceSymbols(e);case"goToImplementation":return this.executeImplementations(e);case"prepareCallHierarchy":return this.executePrepareCallHierarchy(e);case"incomingCalls":return this.executeIncomingCalls(e);case"outgoingCalls":return this.executeOutgoingCalls(e);case"diagnostics":return this.executeDiagnostics(e);case"workspaceDiagnostics":return this.executeWorkspaceDiagnostics(e);case"codeActions":return this.executeCodeActions(e);default:{let r=`Unsupported LSP operation: ${this.params.operation}`;return{llmContent:r,returnDisplay:r}}}}async executeDefinitions(t){let e=this.resolveLocationTarget();if("error"in e)return{llmContent:e.error,returnDisplay:e.error};let r=this.params.limit??20,i=[];try{i=await t.definitions(e.location,this.params.serverName,r)}catch(n){let c=`LSP go-to-definition failed: ${n?.message||String(n)}`;return{llmContent:c,returnDisplay:c}}if(!i.length){let n=`No definitions found for ${e.description}.`;return{llmContent:n,returnDisplay:n}}let s=this.config.getProjectRoot(),a=i.slice(0,r).map((n,c)=>`${c+1}. ${this.formatLocationWithServer(n,s)}`);return{llmContent:[`Definitions for ${e.description}:`,...a].join(`
|
|
4
4
|
`),returnDisplay:a.join(`
|
|
5
5
|
`)}}async executeImplementations(t){let e=this.resolveLocationTarget();if("error"in e)return{llmContent:e.error,returnDisplay:e.error};let r=this.params.limit??20,i=[];try{i=await t.implementations(e.location,this.params.serverName,r)}catch(n){let c=`LSP go-to-implementation failed: ${n?.message||String(n)}`;return{llmContent:c,returnDisplay:c}}if(!i.length){let n=`No implementations found for ${e.description}.`;return{llmContent:n,returnDisplay:n}}let s=this.config.getProjectRoot(),a=i.slice(0,r).map((n,c)=>`${c+1}. ${this.formatLocationWithServer(n,s)}`);return{llmContent:[`Implementations for ${e.description}:`,...a].join(`
|
|
6
6
|
`),returnDisplay:a.join(`
|
package/chunks/{matildaAgentContentGenerator-EIQI4YCP.js → matildaAgentContentGenerator-NKCO47ZA.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{M as F,N as U,O as j,g as x,la as $}from"./chunk-
|
|
3
|
+
import{M as F,N as U,O as j,g as x,la as $}from"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import{b as m,e as b}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{k as O,n as I}from"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import"./chunk-AEKLF65D.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{p as P}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as w}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";w();w();var W="2026-06-23",H="auto",J="instant",V=12e4,h=18e4,X=5e4,v=16e3,k=class extends Error{code="EMATILDA_STREAM_INCOMPLETE";constructor(){super("Matilda agent stream ended without an authoritative done signal."),this.name="MatildaAgentStreamProtocolError"}},B=["Treat this as Matilda Code traffic.","Prefer the code specialist path for implementation, debugging, refactoring, tests, repo edits, and code review.","Use the fast instruct path for simple coordination, status, clarification, or non-code conversational replies.","Keep the response concise and action-oriented."].join(" "),K=["You are powering Matilda Code, an interactive terminal coding agent.","Matilda Code owns the local agent loop: codebase reads, edits, shell commands, approvals, memory, subagents, skills, and MCP tools run through the CLI.","Use the conversation context and tool results as facts. Do not claim to have inspected files, run commands, or edited code unless that action appears in the provided context.",`When the user gives a vague starter such as "let's code" without a concrete development task, ask a concise clarifying question instead of inventing an app or dumping code.`].join(" ");function z(n){let e=(n||"https://matilda.maincode.com/api/v1").trim().replace(/\/+$/,"");return/\/api\/v1$/i.test(e)?e.replace(/\/api\/v1$/i,"/api"):/\/api$/i.test(e)?e:`${e}/api`}function T(n){try{let e=JSON.parse(n);return e&&typeof e=="object"?e:void 0}catch{return}}function u(n,e){let o=T(n)?.[e];return typeof o=="string"?o:void 0}function D(n){return S(n)}function S(n){return typeof n=="string"?n:Array.isArray(n)?n.map(e=>{if(typeof e=="string")return e;if(!e||typeof e!="object")return"";let t=e;return typeof t.text=="string"?t.text:t.image_url?"[image omitted: Matilda native chat accepts text only]":t.input_audio?"[audio omitted: Matilda native chat accepts text only]":t.file?"[file omitted: Matilda native chat accepts text only]":""}).filter(Boolean).join(`
|
|
4
4
|
`):""}function g(n,e){if(n.length<=e)return n;let t=`
|
|
5
5
|
[...omitted to fit Matilda native agent context...]
|
|
6
6
|
`,o=e-t.length,s=Math.floor(o*.6),i=o-s;return`${n.slice(0,s)}${t}${n.slice(-i)}`}function Q(n){return(n.candidates?.[0]?.content?.parts??[]).map(t=>typeof t=="string"?t:"thought"in t&&t.thought?"":"text"in t&&t.text||"").join("")}function Y(n){let e=T(n),t=typeof e?.output_tokens=="number"?e.output_tokens:void 0;if(t!==void 0)return{promptTokenCount:0,candidatesTokenCount:t,totalTokenCount:t,usageIsIncomplete:!0}}function C(n){return JSON.stringify(n).length}function Z(n){if(C(n)<=h)return n;let e=`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as d,i as u}from"./chunk-
|
|
3
|
+
import{a as d,i as u}from"./chunk-GGEDWMSK.js";import"./chunk-E5TINV2P.js";import"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import{d as o}from"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{k as s}from"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import"./chunk-AEKLF65D.js";import{c}from"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as i}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as a}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";a();var l=class extends u{debugLogger=i("MATILDA");matildaClient;sharedManager;currentToken;constructor(e,t,r){let n=new d(t,r);super(t,r,n),this.matildaClient=e,this.sharedManager=c.getInstance(),t?.baseUrl&&t?.apiKey&&(this.pipeline.client.baseURL=t?.baseUrl,this.pipeline.client.apiKey=t?.apiKey)}getCurrentEndpoint(e){let t=e||o,r="/v1",n=t.startsWith("http")?t:`https://${t}`;return n.endsWith(r)||n.endsWith("/api/v1")||n.endsWith("/api/v1/code")?n:`${n}${r}`}shouldSuppressErrorLogging(e,t){return this.isAuthError(e)}async getValidToken(){try{let e=await this.sharedManager.getValidCredentials(this.matildaClient);if(!e.access_token)throw new Error("No access token available");return{token:e.access_token,endpoint:this.getCurrentEndpoint(e.resource_url)}}catch(e){throw this.isAuthError(e)?e:(this.debugLogger.warn("Failed to get token from shared manager:",e),new Error("Failed to obtain a valid legacy OAuth access token. Please re-authenticate with Matilda."))}}async executeWithCredentialManagement(e){let t=async()=>{let{token:r,endpoint:n}=await this.getValidToken();return this.pipeline.client.apiKey=r,this.pipeline.client.baseURL=n,await e()};try{return await t()}catch(r){if(this.isAuthError(r))return await this.sharedManager.getValidCredentials(this.matildaClient,!0),await s("retry",t);throw r}}async generateContent(e,t){return this.executeWithCredentialManagement(()=>super.generateContent(e,t))}async generateContentStream(e,t){return this.executeWithCredentialManagement(()=>super.generateContentStream(e,t))}async countTokens(e){return super.countTokens(e)}async embedContent(e){return this.executeWithCredentialManagement(()=>super.embedContent(e))}isAuthError(e){if(!e)return!1;let t=e instanceof Error?e.message.toLowerCase():String(e).toLowerCase(),r=e,n=r?.status||r?.code;return n===401||n===403||n==="401"||n==="403"||t.includes("unauthorized")||t.includes("forbidden")||t.includes("invalid api key")||t.includes("invalid access token")||t.includes("token expired")||t.includes("authentication")||t.includes("access denied")||t.includes("token")&&t.includes("expired")}getCurrentToken(){return this.currentToken?this.currentToken:this.sharedManager.getCurrentCredentials()?.access_token||null}clearToken(){this.currentToken=void 0,this.sharedManager.clearCache()}};export{l as MatildaContentGenerator};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Matilda
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l,p as m,q as n,r as o,s as p,t as q}from"./chunk-
|
|
3
|
+
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l,p as m,q as n,r as o,s as p,t as q}from"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{d as CredentialsClearRequiredError,n as MATILDA_CREDENTIAL_FILE_MODE,j as MatildaOAuth2Client,k as MatildaOAuth2Event,e as MatildaOAuthPollError,o as cacheMatildaCredentials,q as clearCachedCredentialFile,p as clearMatildaCredentials,b as generateCodeChallenge,a as generateCodeVerifier,c as generatePKCEPair,m as getMatildaOAuthClient,f as isDeviceAuthorizationSuccess,h as isDeviceTokenPending,g as isDeviceTokenSuccess,i as isErrorResponse,l as matildaOAuth2Events};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Ec as tt,Je as st,Oe as L,Pc as et,Pe as at,Sc as ot,Tc as A,Yc as C,Zc as nt,bd as it,pi as P,ri as lt,ye as rt}from"./chunk-LTO2UENO.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-PGQHFMLT.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as Z,i as q,p as Y,q as Q}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{G as J,Y as K,c as m}from"./chunk-WGPRIGRF.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();import{spawn as ct}from"node:child_process";import mt from"node:path";import{randomUUID as wt}from"node:crypto";var u=K("MONITOR"),Et=1e3,O=1e4,St=3e5,N=6e5,dt=80,R=4096,ut=5,ft=1e3;function pt(l){return l.length>dt?l.slice(0,dt-1)+"\u2026":l}var kt=new Set(["task-notification","task-id","tool-use-id","kind","status","event-count","summary","result"]),xt=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)>/g;function gt(l){let y="";for(let t=0;t<l.length;t++){let o=l.charCodeAt(t);if(o===9){y+=l[t];continue}o<32||o>=128&&o<=159||(y+=l[t])}return y=y.replace(xt,(t,o,a)=>kt.has(String(a).toLowerCase())?o==="/"?`</\u200B${a}>`:`<\u200B${a}>`:t),y}var U=class extends Z{constructor(t,o){super(o);this.config=t}callId;setCallId(t){this.callId=t}getDescription(){let t=this.params.description||C(this.params.command).spawnCommand;return`Monitor: ${pt(t)}`}async getDefaultPermission(){let t=C(this.params.command).safetyCommand;try{if(await L(t))return"allow"}catch(o){u.warn("AST read-only check failed, falling back to ask:",o)}return"ask"}async getConfirmationDetails(t){let o=C(this.params.command),a=ot(o.safetyCommand),f=[];for(let s of a){let p=!1;try{p=await L(s)}catch(d){u.warn("AST read-only check failed for monitor sub-command, falling back to ask:",d)}p||f.push(s)}let S=f.length>0?f:a,M=[...new Set(S.map(s=>A(s)).filter(s=>!!s))],v=[];try{let s=[];for(let p of S){let d=await at(p);s.push(...d)}v=[...new Set(s)].map(p=>`Monitor(${p})`)}catch(s){u.warn("Failed to extract monitor command rules:",s),v=[`Monitor(${o.safetyCommand})`]}let i=it(o.safetyCommand,this.params.command),c={type:"exec",title:"Monitor",command:o.spawnCommand,rootCommand:M.join(", ")||(A(o.safetyCommand)??o.spawnCommand),permissionRules:v,onConfirm:async(s,p)=>{}};return i&&(c.warnings=i),c}async execute(t){if(t.aborted)return{llmContent:"Monitor was cancelled before it could start.",returnDisplay:"Monitor cancelled."};let o=C(this.params.command),a=o.spawnCommand;o.strippedTrailingAmp&&u.warn("Stripped trailing & from monitor command \u2014 monitor lifecycle handles backgrounding");let f=gt(this.params.description||a),S=pt(f),M=Math.min(this.params.max_events??Et,O),v=Math.min(this.params.idle_timeout_ms??St,N),i=`mon_${wt().replace(/-/g,"").slice(0,16)}`,c=this.config.getMonitorRegistry(),s=tt()??void 0;if(c.getRunning().length>=P)return{llmContent:`Cannot start monitor: maximum concurrent monitors (${P}) reached. Stop an existing monitor first.`,returnDisplay:"Monitor rejected: too many concurrent monitors."};let d=new AbortController,g={monitorId:i,command:a,description:f,status:"running",startTime:Date.now(),abortController:d,toolUseId:this.callId,eventCount:0,lastEventTime:0,maxEvents:M,idleTimeoutMs:v,droppedLines:0,outputFile:lt(this.config.storage.getProjectDir(),this.config.getSessionId(),i),...s?{ownerAgentId:s}:{}},{executable:yt,argsPrefix:vt}=et(),n;try{n=ct(yt,[...vt,a],{cwd:this.params.directory||this.config.getTargetDir(),stdio:["ignore","pipe","pipe"],detached:!0,env:{...process.env,MATILDA_CODE:"1",TERM:"dumb",PAGER:"cat",...st()}})}catch(e){return{llmContent:`Monitor failed to start: ${m(e)}`,returnDisplay:`Monitor failed: ${m(e)}`}}g.pid=n.pid;let b=!1,w,D=e=>{w??=e};n.on("error",D);let B={value:""},G={value:""},k=ut,I=Date.now(),$=e=>{let r=gt(e);if(r.length===0||r.trim().length===0)return;let T=Date.now(),_=T-I;if(_<0)u.warn(`Monitor ${i}: clock moved backwards by ${-_}ms, resetting refill timestamp`),I=T;else{let h=Math.floor(_/ft);h>0&&(k=Math.min(ut,k+h),I+=h*ft)}k>0?(k--,c.emitEvent(i,r)):g.droppedLines++},j=()=>{for(let e of[B,G]){let r=e.value.trim();r.length>0&&$(r),e.value=""}},Tt=()=>{if(!(b||!n.pid))if(process.platform==="win32")ct("taskkill",["/pid",n.pid.toString(),"/f","/t"],{stdio:"ignore"}).on("error",r=>u.warn(`Monitor taskkill failed for pid ${n.pid}: ${m(r)}`));else{try{process.kill(-n.pid,"SIGTERM")}catch(e){u.warn(`Monitor ${i} SIGTERM failed (pid=${n.pid}): ${m(e)}`)}setTimeout(()=>{if(!b&&n.pid)try{process.kill(-n.pid,"SIGKILL")}catch(e){u.warn(`Monitor ${i} SIGKILL escalation failed (pid=${n.pid}): ${m(e)}`)}},200).unref?.()}},E=()=>{j(),Tt()};d.signal.addEventListener("abort",E,{once:!0}),d.signal.aborted&&E();try{c.register(g)}catch(e){return E(),d.signal.removeEventListener("abort",E),n.stdout?.destroy?.(),n.stderr?.destroy?.(),n.removeListener("error",D),n.on("error",()=>{}),{llmContent:`Monitor failed to start: ${m(e)}`,returnDisplay:`Monitor failed: ${m(e)}`}}let z=(e,r)=>{if(g.status!=="running")return;let T=rt(r.toString("utf-8"));if(e.value+=T,!e.value.includes(`
|
|
4
4
|
`)&&e.value.length>R){let h=e.value.trim();h.length>0&&$(h.slice(0,R)+"..."),e.value="";return}let _=e.value.split(`
|
|
5
5
|
`);e.value=_.pop()??"";for(let h of _){let x=h.trim();if(x.length===0)continue;let bt=x.length>R?x.slice(0,R)+"...":x;$(bt)}};n.stdout?.on("data",e=>z(B,e)),n.stderr?.on("data",e=>z(G,e));let F=!1,X=()=>{F||(F=!0,j(),d.signal.removeEventListener("abort",E),g.droppedLines>0&&u.info(`Monitor ${i} dropped ${g.droppedLines} lines due to throttling`))},V=null,_t=(e,r)=>{g.status==="running"&&(d.signal.aborted?c.cancel(i):e!==null&&e!==0?c.fail(i,`Exit code ${e}`):r?c.fail(i,`Killed by signal ${r}`):c.complete(i,e))},Ct=(e,r)=>{b=!0,V={code:e,sig:r}},Mt=(e,r)=>{b=!0,X();let T=V??{code:e,sig:r};_t(T.code,T.sig)},W=e=>{b=!0,X(),g.status==="running"&&c.fail(i,m(e))};return n.on("exit",Ct),n.on("close",Mt),n.on("error",W),n.removeListener("error",D),w?(W(w),{llmContent:`Monitor failed to start: ${m(w)}`,returnDisplay:`Monitor failed: ${m(w)}`}):{llmContent:`Monitor started.
|
|
6
6
|
id: ${i}
|