@maincode-ai/matilda-code 0.20.0 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/mainy/docs/features/headless.md +37 -0
- package/bundled/mainy/docs/features/mcp.md +3 -3
- package/chunks/{agent-N5H7ZVZN.js → agent-WQRHTEJK.js} +1 -1
- package/chunks/{agent-headless-LBLAX66M.js → agent-headless-VPF3VPXU.js} +1 -1
- package/chunks/{anthropicContentGenerator-DKMAJXYA.js → anthropicContentGenerator-ATLOKYPR.js} +1 -1
- package/chunks/chunk-3YLXGE6T.js +8 -0
- package/chunks/{chunk-TRM7SXZ5.js → chunk-A7VPKVYG.js} +1 -1
- package/chunks/{chunk-GTR4V2PV.js → chunk-DC7LAFZZ.js} +1 -1
- package/chunks/chunk-DORRYU7L.js +101 -0
- package/chunks/{chunk-KP6BLFQS.js → chunk-GIIMOLLN.js} +1 -1
- package/chunks/{chunk-RO6LKQPB.js → chunk-IGQPRDMV.js} +547 -544
- package/chunks/chunk-IMYUVCF7.js +27 -0
- package/chunks/{chunk-3KCDX6MY.js → chunk-ISW2QC5B.js} +1 -1
- package/chunks/chunk-OCXGNAAT.js +8 -0
- package/chunks/{chunk-QT4UNNZ4.js → chunk-QJO23A2D.js} +4 -4
- package/chunks/chunk-RGBIKCMN.js +95 -0
- package/chunks/{chunk-XXZH7C44.js → chunk-SS5WUOSJ.js} +1 -1
- package/chunks/chunk-XJDC3ZQZ.js +8 -0
- package/chunks/{chunk-Z7OHKQ7V.js → chunk-YZVC65QR.js} +2 -2
- package/chunks/{computer-use-LG4QQFMP.js → computer-use-3BJWOZSA.js} +1 -1
- package/chunks/contextCommand-SOQLJJIW.js +3 -0
- package/chunks/edit-ZIPLKFNT.js +38 -0
- package/chunks/{en-ZU6RPTEW.js → en-75JQMW7P.js} +1 -1
- package/chunks/{enter-worktree-OIP2B3NM.js → enter-worktree-MWQ3Z7HX.js} +1 -1
- package/chunks/enterPlanMode-XT6MNE2L.js +18 -0
- package/chunks/{exit-worktree-VN5I5XWV.js → exit-worktree-O7DBPVFA.js} +1 -1
- package/chunks/{exitPlanMode-HE6EEGTO.js → exitPlanMode-FDXKFQJF.js} +14 -14
- package/chunks/geminiContentGenerator-HXWUQ2DI.js +8 -0
- package/chunks/{glob-EGOAJNOQ.js → glob-GYLGTXYL.js} +1 -1
- package/chunks/{grep-JYHW6SSG.js → grep-ZNYUS2MU.js} +1 -1
- package/chunks/{matildaAgentContentGenerator-AKNRQW6A.js → matildaAgentContentGenerator-HG4ABAJG.js} +1 -1
- package/chunks/matildaContentGenerator-WEAUMFNT.js +8 -0
- package/chunks/matildaOAuth2-LKOMJUC6.js +3 -0
- package/chunks/{monitor-IDNOTNUP.js → monitor-755GJUC4.js} +1 -1
- package/chunks/{notebook-edit-4VBYBZFJ.js → notebook-edit-SWCJ3FMF.js} +1 -1
- package/chunks/{openaiContentGenerator-WTRQK5RJ.js → openaiContentGenerator-JIODOCNJ.js} +1 -1
- package/chunks/ripGrep-5GE6ECVF.js +3 -0
- package/chunks/{scheduler-AOKJEAXJ.js → scheduler-VA6HAYT4.js} +1 -1
- package/chunks/{serve-2JJY265V.js → serve-TVYEQNS6.js} +2 -2
- package/chunks/shell-JNZXS437.js +3 -0
- package/chunks/src-MMNXN6E3.js +3 -0
- package/chunks/{team-create-Z6636NPD.js → team-create-CUBBNHIF.js} +1 -1
- package/chunks/{update-goal-DH2TEYYU.js → update-goal-6WDBMJ2I.js} +1 -1
- package/chunks/{web-fetch-5F7C7MXU.js → web-fetch-QP42GV23.js} +1 -1
- package/chunks/{web-search-W2FYCGK5.js → web-search-FURCBRRK.js} +1 -1
- package/chunks/{workflow-M7KXXDO6.js → workflow-WRWIXJCG.js} +2 -2
- package/chunks/write-file-7BFZXGIJ.js +11 -0
- package/cli.js +476 -462
- package/locales/en.js +6 -0
- package/package.json +2 -2
- package/chunks/chunk-7VGUNT5L.js +0 -8
- package/chunks/chunk-CLUEFPSU.js +0 -8
- package/chunks/chunk-CYTN3WRM.js +0 -101
- package/chunks/chunk-IB7TWUWM.js +0 -90
- package/chunks/chunk-LLQVLTPB.js +0 -27
- package/chunks/contextCommand-7KHYFQ6G.js +0 -3
- package/chunks/edit-U4PMKZYZ.js +0 -38
- package/chunks/enterPlanMode-6LZSSWFT.js +0 -17
- package/chunks/geminiContentGenerator-GWGLIDJJ.js +0 -8
- package/chunks/matildaContentGenerator-MXP3V2UQ.js +0 -8
- package/chunks/matildaOAuth2-2IUZAZEO.js +0 -3
- package/chunks/ripGrep-DOB57AMM.js +0 -3
- package/chunks/shell-WFONAKPV.js +0 -3
- package/chunks/src-IHYMMU26.js +0 -3
- package/chunks/write-file-O4DJX4LP.js +0 -11
package/chunks/chunk-LLQVLTPB.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{c as N}from"./chunk-XKDGRW3K.js";import{c as Q}from"./chunk-ESSYHTAZ.js";import{b as X}from"./chunk-IOCF4XSR.js";import{L as F,Y as x}from"./chunk-QWBNNEV2.js";import{b as D}from"./chunk-GZPNIYVZ.js";D();import ie from"crypto";import j from"node:path";import{promises as M}from"node:fs";import{EventEmitter as Ae}from"events";import{randomUUID as se}from"node:crypto";D();import{execFile as de,spawn as ue}from"node:child_process";import{promisify as he}from"node:util";import{platform as me}from"node:os";import{resolve as Z}from"node:path";import{URL as fe,fileURLToPath as pe}from"node:url";D();var le=["www-browser"];function U(o){let e=o.replace(/\\/g,"/").split("/").pop();return!!e&&le.includes(e)}function H(o={}){let r=process.env.BROWSER?.trim()?.match(/^\S+/)?.[0];if(!o.ignoreBrowserBlocklist&&process.platform!=="win32"&&r&&U(r)||process.env.CI||process.env.DEBIAN_FRONTEND==="noninteractive")return!1;let t=!!process.env.SSH_CONNECTION;return!(process.platform==="linux"&&!["DISPLAY","WAYLAND_DISPLAY","MIR_SOCKET"].some(s=>!!process.env[s])||t&&process.platform!=="linux")}var ee=he(de);function ge(o,{allowFile:e=!1,allowedFilePaths:r}={}){let t;try{t=new fe(o)}catch{throw new Error(`Invalid URL: ${o}`)}let i=e?["http:","https:","file:"]:["http:","https:"];if(!i.includes(t.protocol))throw new Error(`Unsafe protocol: ${t.protocol}. Only ${i.join(", ")} are allowed.`);if(t.protocol==="file:"&&e){if(!r?.length)throw new Error("allowedFilePaths is required when allowFile is true");let n=Z(pe(t));if(!r.map(c=>Z(c)).includes(n))throw new Error("File URL is not in the allowed file set")}if(/[\r\n\x00-\x1f]/.test(o))throw new Error("URL contains invalid characters")}async function te(o,e={}){ge(o,e);let r=me(),t,i,n=process.env.BROWSER?.trim(),s=r==="win32"?void 0:Ee(n,o);if(s)try{await re(s.command,s.args);return}catch(l){console.warn(`Failed to open BROWSER command ${s.command}: ${we(l)}. Falling back to the platform browser opener.`)}if(!H({ignoreBrowserBlocklist:!0})){console.warn(`Browser launch is not available in this environment. Please open this URL manually: ${o}`);return}switch(r){case"darwin":t="open",i=[o];break;case"win32":t="powershell.exe",i=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${o.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":t="xdg-open",i=[o];break;default:throw new Error(`Unsupported platform: ${r}`)}let c={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await ee(t,i,c)}catch{if((r==="linux"||r==="freebsd"||r==="openbsd")&&t==="xdg-open"){let a=[{command:"gnome-open",detached:!1},{command:"kde-open",detached:!1},{command:"firefox",detached:!0},{command:"chromium",detached:!0},{command:"google-chrome",detached:!0},{command:"microsoft-edge",detached:!0}];for(let{command:d,detached:p}of a)try{p?await re(d,[o]):await ee(d,[o],c);return}catch{continue}}console.warn(`Failed to open browser automatically. Please open this URL manually: ${o}`);return}}async function re(o,e){let r={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};await new Promise((t,i)=>{let n=ue(o,e,r),s=!1;n.once("error",c=>{s||(s=!0,i(c))}),n.once("spawn",()=>{s||(s=!0,n.unref(),t())})})}function we(o){return o instanceof Error?o.message:String(o)}function Ee(o,e){if(!o)return;let r=ke(o);if(!r){console.warn("Invalid BROWSER environment variable, falling back to platform default.");return}if(U(r.command))return;let t=!1,i=r.args.map(n=>n.includes("%s")?(t=!0,n.replace(/%s/g,()=>e)):n);return t||i.push(e),{command:r.command,args:i}}function ke(o){let e=[],r="",t;for(let s of o){if(t){s===t?t=void 0:r+=s;continue}if(s==='"'||s==="'"){t=s;continue}if(/\s/.test(s)){r&&(e.push(r),r="");continue}r+=s}if(t)return;r&&e.push(r);let[i,...n]=e;if(i)return{command:i,args:n}}function Ye(){return H()}D();import B from"node:path";import{promises as y,unlinkSync as _e}from"node:fs";import{randomUUID as ne}from"node:crypto";var R=x("MATILDA_OAUTH"),Ce="oauth_creds.json",ve="oauth_creds.lock",ye=30*1e3,Te=35e3,De=5e3,oe={maxAttempts:20,attemptInterval:100,maxInterval:2e3};var u=class extends Error{constructor(r,t,i){super(t);this.type=r;this.originalError=i;this.name="TokenManagerError"}};function Re(o){if(!o||typeof o!="object")throw new Error("Invalid credentials format");let e=o,r=["access_token","refresh_token","token_type"];for(let t of r)if(!e[t]||typeof e[t]!="string")throw new Error(`Invalid credentials: missing ${t}`);if(!e.expiry_date||typeof e.expiry_date!="number")throw new Error("Invalid credentials: missing expiry_date");return e}var A=class o{static instance=null;memoryCache={credentials:null,fileModTime:0,lastCheck:0};refreshPromise=null;checkPromise=null;cleanupHandlersRegistered=!1;cleanupFunction=null;lockConfig=oe;constructor(){this.registerCleanupHandlers()}static getInstance(){return o.instance||(o.instance=new o),o.instance}registerCleanupHandlers(){this.cleanupHandlersRegistered||(this.cleanupFunction=()=>{try{let e=this.getLockFilePath();_e(e)}catch{}},process.on("exit",this.cleanupFunction),process.on("SIGINT",this.cleanupFunction),process.on("SIGTERM",this.cleanupFunction),process.on("uncaughtException",this.cleanupFunction),process.on("unhandledRejection",this.cleanupFunction),this.cleanupHandlersRegistered=!0)}async getValidCredentials(e,r=!1){try{if(await this.checkAndReloadIfNeeded(e),!r&&this.memoryCache.credentials&&this.isTokenValid(this.memoryCache.credentials))return this.memoryCache.credentials;let t=this.refreshPromise;t||(t=this.performTokenRefresh(e,r),this.refreshPromise=t);try{return await t}finally{this.refreshPromise===t&&(this.refreshPromise=null)}}catch(t){throw t instanceof u?t:new u("REFRESH_FAILED",`Failed to get valid credentials: ${t instanceof Error?t.message:String(t)}`,t)}}async checkAndReloadIfNeeded(e){if(this.checkPromise){await this.checkPromise;return}if(this.refreshPromise)return;let r=Date.now();if(!(r-this.memoryCache.lastCheck<De)){this.checkPromise=this.performFileCheck(e,r);try{await this.checkPromise}finally{this.checkPromise=null}}}withTimeout(e,r,t="Operation"){let i;return Promise.race([e.finally(()=>{i&&clearTimeout(i)}),new Promise((n,s)=>{i=setTimeout(()=>s(new Error(`${t} timed out after ${r}ms`)),r)})])}async performFileCheck(e,r){this.memoryCache.lastCheck=r;try{let t=this.getCredentialFilePath(),n=(await this.withTimeout(y.stat(t),3e3,"File operation")).mtimeMs;n>this.memoryCache.fileModTime&&(await this.reloadCredentialsFromFile(e),this.memoryCache.fileModTime=n)}catch(t){if(t instanceof Error&&"code"in t&&t.code!=="ENOENT")throw this.updateCacheState(null,0,r),new u("FILE_ACCESS_ERROR",`Failed to access credentials file: ${t.message}`,t);this.memoryCache.fileModTime=0}}async forceFileCheck(e){try{let r=this.getCredentialFilePath(),i=(await y.stat(r)).mtimeMs;i>this.memoryCache.fileModTime&&(await this.reloadCredentialsFromFile(e),this.memoryCache.fileModTime=i,this.memoryCache.lastCheck=Date.now())}catch(r){if(r instanceof Error&&"code"in r&&r.code!=="ENOENT")throw this.updateCacheState(null,0),new u("FILE_ACCESS_ERROR",`Failed to access credentials file during refresh: ${r.message}`,r);this.memoryCache.fileModTime=0}}async reloadCredentialsFromFile(e){try{let r=this.getCredentialFilePath(),t=await y.readFile(r,"utf-8"),i=JSON.parse(t),n=Re(i),s=this.memoryCache.credentials;this.memoryCache.credentials=n;try{e&&e.setCredentials(n)}catch(c){throw this.memoryCache.credentials=s,c}}catch(r){r instanceof Error&&r.message.includes("Invalid credentials")&&R.warn(`Failed to validate credentials file: ${r.message}`),this.memoryCache.credentials=null}}async performTokenRefresh(e,r=!1){let t=Date.now(),i=this.getLockFilePath(),n=!1;try{let s=e.getCredentials();if(!s.refresh_token)throw new u("NO_REFRESH_TOKEN","No refresh token available for token refresh");await this.acquireLock(i),n=!0;let c=Date.now()-t;if(c>5e3&&R.warn(`Token refresh lock acquisition took ${c}ms`),await this.forceFileCheck(e),!r&&this.memoryCache.credentials&&this.isTokenValid(this.memoryCache.credentials))return this.memoryCache.credentials;let l=await e.refreshAccessToken(),a=Date.now()-t;if(a>1e4&&R.warn(`Token refresh operation took ${a}ms`),!l||L(l)){let w=l;throw new u("REFRESH_FAILED",`Token refresh failed: ${w?.error||"Unknown error"} - ${w?.error_description||"No details provided"}`)}let d=l;if(!d.access_token)throw new u("REFRESH_FAILED","Failed to refresh access token: no token returned");let p={access_token:d.access_token,token_type:d.token_type,refresh_token:d.refresh_token||s.refresh_token,resource_url:d.resource_url,expiry_date:Date.now()+d.expires_in*1e3};return this.memoryCache.credentials=p,e.setCredentials(p),await this.saveCredentialsToFile(p),p}catch(s){throw s instanceof O?(R.debug("SharedTokenManager: Clearing memory cache due to credentials clear requirement"),this.memoryCache.credentials=null,this.memoryCache.fileModTime=0,this.refreshPromise=null,new u("REFRESH_FAILED",s.message,s)):s instanceof u?s:s instanceof Error&&(s.message.includes("fetch")||s.message.includes("network")||s.message.includes("timeout"))?new u("NETWORK_ERROR",`Network error during token refresh: ${s.message}`,s):new u("REFRESH_FAILED",`Unexpected error during token refresh: ${s instanceof Error?s.message:String(s)}`,s)}finally{n&&await this.releaseLock(i)}}async saveCredentialsToFile(e){let r=this.getCredentialFilePath(),t=B.dirname(r);try{await this.withTimeout(y.mkdir(t,{recursive:!0,mode:448}),5e3,"File operation")}catch(n){throw new u("FILE_ACCESS_ERROR",`Failed to create credentials directory: ${n instanceof Error?n.message:String(n)}`,n)}let i=JSON.stringify(e,null,2);try{await X(r,i,{mode:384,forceMode:!0,noFollow:!0});let n=await this.withTimeout(y.stat(r),5e3,"File operation");this.memoryCache.fileModTime=n.mtimeMs}catch(n){throw new u("FILE_ACCESS_ERROR",`Failed to write credentials file: ${n instanceof Error?n.message:String(n)}`,n)}}isTokenValid(e){return!e.expiry_date||!e.access_token?!1:Date.now()<e.expiry_date-ye}getCredentialFilePath(){return B.join(F.getGlobalMatildaDir(),Ce)}getLockFilePath(){return B.join(F.getGlobalMatildaDir(),ve)}async acquireLock(e){let{maxAttempts:r,attemptInterval:t,maxInterval:i}=this.lockConfig,n=ne(),s=t;for(let c=0;c<r;c++)try{await y.writeFile(e,n,{flag:"wx"});return}catch(l){if(l.code==="EEXIST"){try{let a=await y.stat(e),d=Date.now()-a.mtimeMs;if(d>Te){let p=`${e}.stale.${ne()}`;try{await y.rename(e,p),await y.unlink(p),R.warn(`Removed stale lock file: ${e} (age: ${d}ms)`);continue}catch(w){R.warn(`Failed to remove stale lock file ${e}: ${w instanceof Error?w.message:String(w)}`)}}}catch(a){R.warn(`Failed to stat lock file ${e}: ${a instanceof Error?a.message:String(a)}`)}await new Promise(a=>setTimeout(a,s)),s=Math.min(s*1.5,i)}else throw new u("FILE_ACCESS_ERROR",`Failed to create lock file: ${l instanceof Error?l.message:String(l)}`,l)}throw new u("LOCK_TIMEOUT","Failed to acquire file lock for token refresh: timeout exceeded")}async releaseLock(e){try{await y.unlink(e)}catch(r){r.code!=="ENOENT"&&R.warn(`Failed to release lock file ${e}: ${r instanceof Error?r.message:String(r)}`)}}updateCacheState(e,r,t){this.memoryCache={credentials:e,fileModTime:r,lastCheck:t??Date.now()}}clearCache(){this.updateCacheState(null,0,0),this.refreshPromise=null,this.checkPromise=null}getCurrentCredentials(){return this.memoryCache.credentials}isRefreshInProgress(){return this.refreshPromise!==null}setLockConfig(e){this.lockConfig={...oe,...e}}cleanup(){this.cleanupFunction&&this.cleanupHandlersRegistered&&(this.cleanupFunction(),process.removeListener("exit",this.cleanupFunction),process.removeListener("SIGINT",this.cleanupFunction),process.removeListener("SIGTERM",this.cleanupFunction),process.removeListener("uncaughtException",this.cleanupFunction),process.removeListener("unhandledRejection",this.cleanupFunction),this.cleanupHandlersRegistered=!1,this.cleanupFunction=null)}getDebugInfo(){let e=!!this.memoryCache.credentials,r=e?!this.isTokenValid(this.memoryCache.credentials):!1;return{hasCredentials:e,credentialsExpired:r,isRefreshing:this.isRefreshInProgress(),cacheAge:Date.now()-this.memoryCache.lastCheck}}};var h=x("MATILDA_OAUTH"),Y="https://chat.matilda.ai",be=`${Y}/api/v1/oauth2/device/code`,K=`${Y}/api/v1/oauth2/token`,z="f0304373b74a44d2b584a3fb70ca9e56",Me="openid profile email model.completion",Se="urn:ietf:params:oauth:grant-type:device_code",Fe=3e4,Oe="oauth_creds.json";function Pe(){return ie.randomBytes(32).toString("base64url")}function Ie(o){let e=ie.createHash("sha256");return e.update(o),e.digest("base64url")}function xe(){let o=Pe(),e=Ie(o);return{code_verifier:o,code_challenge:e}}function W(o){return Object.keys(o).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(o[e])}`).join("&")}function q(o,e){let r=e?"Token refresh timeout":"Token refresh failed";return new Error(`${r}: ${N(o,{url:K})}`,{cause:o})}var O=class extends Error{constructor(r,t){super(r);this.originalError=t;this.name="CredentialsClearRequiredError"}},V=class extends Error{status;oauthError;description;constructor(e){super(`Device token poll failed: ${e.oauthError??"Unknown error"} - ${e.description??"(no description)"}`),this.name="MatildaOAuthPollError",this.oauthError=e.oauthError,this.description=e.description,this.status=e.status}};function G(o){return"device_code"in o}function Le(o){return"access_token"in o&&o.access_token!==null&&o.access_token!==void 0&&typeof o.access_token=="string"&&o.access_token.length>0}function $e(o){return"status"in o&&o.status==="pending"}function L(o){return"error"in o}var J=class{credentials={};sharedManager;constructor(){this.sharedManager=A.getInstance()}setCredentials(e){this.credentials=e}getCredentials(){return this.credentials}async getAccessToken(){try{return{token:(await this.sharedManager.getValidCredentials(this)).access_token}}catch(e){return h.warn("Failed to get access token from shared manager:",e),{token:void 0}}}async requestDeviceAuthorization(e,r){let t={client_id:z,scope:e.scope,code_challenge:e.code_challenge,code_challenge_method:e.code_challenge_method},i=await fetch(be,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json","x-request-id":se()},body:W(t),...r?.signal?{signal:r.signal}:{}});if(!i.ok){let s=await i.text();throw new Error(`Device authorization failed: ${i.status} ${i.statusText}. Response: ${s}`)}let n=await i.json();if(G(n))h.debug("Device authorization result (sanitized):",{ok:!0,expires_in:n.expires_in});else{let s=n;h.debug("Device authorization result (sanitized):",{ok:!1,error:s?.error})}if(!G(n)){let s=n;throw new Error(`Device authorization failed: ${s?.error||"Unknown error"} - ${s?.error_description||"No details provided"}`)}return n}async pollDeviceToken(e,r){let t={grant_type:Se,client_id:z,device_code:e.device_code,code_verifier:e.code_verifier},i=await fetch(K,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:W(t),...r?.signal?{signal:r.signal}:{}});if(!i.ok){let n=await i.text(),s=null;try{s=JSON.parse(n)}catch{let l=new Error(`Device token poll failed: ${i.status} ${i.statusText}. Response: ${n}`);throw l.status=i.status,l}if(i.status===400&&s.error==="authorization_pending")return{status:"pending"};if(i.status===429&&s.error==="slow_down")return{status:"pending",slowDown:!0};throw new V({oauthError:s.error,description:s.error_description,status:i.status})}return await i.json()}async refreshAccessToken(){if(!this.credentials.refresh_token)throw new Error("No refresh token available");let e={grant_type:"refresh_token",refresh_token:this.credentials.refresh_token,client_id:z},{signal:r,cleanup:t}=Q([],{timeoutMs:Fe});h.debug("Refreshing access token...");try{let i;try{i=await fetch(K,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:W(e),signal:r})}catch(a){throw q(a,r.aborted)}if(!i.ok){let a;try{a=await i.text()}catch(d){throw q(d,r.aborted)}throw i.status===400||i.status===401?(await ae(),new O("Refresh token expired or invalid. Please use '/auth' to re-authenticate.",{status:i.status,response:a})):new Error(`Token refresh failed: ${i.status} ${i.statusText}. Response: ${a}`)}let n;try{n=await i.text()}catch(a){throw q(a,r.aborted)}let s;try{s=JSON.parse(n)}catch{throw new Error(`Legacy OAuth refresh returned invalid JSON: ${n||"(empty response body)"}`)}if(L(s)){let a=s;throw new Error(`Token refresh failed: ${a?.error||"Unknown error"} - ${a?.error_description||"No details provided"}`)}let c=s,l={access_token:c.access_token,token_type:c.token_type,refresh_token:c.refresh_token||this.credentials.refresh_token,resource_url:c.resource_url,expiry_date:Date.now()+c.expires_in*1e3};return this.setCredentials(l),s}finally{t()}}},Ne=(t=>(t.AuthUri="auth-uri",t.AuthProgress="auth-progress",t.AuthCancel="auth-cancel",t))(Ne||{}),S=new Ae;async function _r(o,e){let r=new J,t=A.getInstance();try{let i=await t.getValidCredentials(r);return r.setCredentials(i),r}catch(i){if(i instanceof u)switch(i.type){case"NO_REFRESH_TOKEN":h.debug("No refresh token available, proceeding with device flow");break;case"REFRESH_FAILED":h.debug("Token refresh failed, proceeding with device flow");break;case"NETWORK_ERROR":h.warn("Network error during token refresh, trying device flow");break;default:h.warn("Token manager error:",i.message)}if(e?.requireCachedCredentials)throw new Error("Matilda OAuth credentials expired. Please use /auth to re-authenticate with matilda-oauth.");let n=await He(r,o);if(!n.success){n.reason==="timeout"&&S.emit("auth-progress","timeout","Authentication timed out. Please try again or select a different authentication method.");let s=n.message||(()=>{switch(n.reason){case"timeout":return"Legacy OAuth authentication timed out";case"cancelled":return"Legacy OAuth authentication was cancelled by user";case"rate_limit":return"Too many requests for legacy OAuth authentication, please try again later.";case"error":default:return"Legacy OAuth authentication failed"}})();throw new Error(s)}return r}}function Ue(o){let e="Legacy OAuth Device Authorization",r=o,n=Math.min(Math.max(e.length+4,70),80),s=n-4,c=(f,T)=>{if(f.startsWith("http://")||f.startsWith("https://")){let v=[];for(let I=0;I<f.length;I+=T)v.push(f.substring(I,I+T));return v}let b=f.split(" "),C=[],_="";for(let v of b)_.length+v.length+1<=T?_+=(_?" ":"")+v:(_&&C.push(_),_=v.length>T?v.substring(0,T):v);return _&&C.push(_),C},l=" "+e+" ",a=n-2-l.length,d=Math.floor(a/2),p=a-d,w="+"+"-".repeat(d)+l+"-".repeat(p)+"+",E="|"+" ".repeat(n-2)+"|",P="+"+"-".repeat(n-2)+"+",g=c("Please visit the following URL in your browser to authorize:",s),m=c(r,s),k="Waiting for authorization to complete...";process.stderr.write(`
|
|
4
|
-
`+w+`
|
|
5
|
-
`),process.stderr.write(E+`
|
|
6
|
-
`);for(let f of g)process.stderr.write("| "+f+" ".repeat(s-f.length)+` |
|
|
7
|
-
`);process.stderr.write(E+`
|
|
8
|
-
`);for(let f of m)process.stderr.write("| "+f+" ".repeat(s-f.length)+` |
|
|
9
|
-
`);process.stderr.write(E+`
|
|
10
|
-
`),process.stderr.write("| "+k+" ".repeat(s-k.length)+` |
|
|
11
|
-
`),process.stderr.write(E+`
|
|
12
|
-
`),process.stderr.write(P+`
|
|
13
|
-
|
|
14
|
-
`)}async function He(o,e){let r=!1,t=()=>{r=!0};S.once("auth-cancel",t);let i=()=>{if(!r)return null;let c="Authentication cancelled by user.";return h.debug(`
|
|
15
|
-
`+c),S.emit("auth-progress","error",c),{success:!1,reason:"cancelled",message:c}},n=(c,l)=>{S.emit("auth-progress",c,l)},s=async c=>{try{await te(c)}catch(l){let a=l instanceof Error?l.message:String(l);h.warn(`Failed to open browser automatically: ${a}`),h.info(`Please open this URL manually: ${c}`)}};try{let{code_verifier:c,code_challenge:l}=xe(),a=await o.requestDeviceAuthorization({scope:Me,code_challenge:l,code_challenge_method:"S256"});if(!G(a)){let E=a;throw new Error(`Device authorization failed: ${E?.error||"Unknown error"} - ${E?.error_description||"No details provided"}`)}S.emit("auth-uri",a),(e.isBrowserLaunchSuppressed()||!e.isInteractive())&&Ue(a.verification_uri_complete),e.isBrowserLaunchSuppressed()||await s(a.verification_uri_complete),n("polling","Waiting for authorization..."),h.debug(`Waiting for authorization...
|
|
16
|
-
`);let d=2e3,p=Math.ceil(a.expires_in/(d/1e3));for(let E=0;E<p;E++){let P=i();if(P)return P;try{h.debug("polling for token...");let g=await o.pollDeviceToken({device_code:a.device_code,code_verifier:c});if(Le(g)){let m=g,k={access_token:m.access_token,refresh_token:m.refresh_token||void 0,token_type:m.token_type,resource_url:m.resource_url,expiry_date:m.expires_in?Date.now()+m.expires_in*1e3:void 0};return o.setCredentials(k),await Be(k),n("success","Authentication successful! Access token obtained."),h.debug("Authentication successful! Access token obtained."),{success:!0}}if($e(g)){g.slowDown?(d=Math.min(d*1.5,1e4),h.debug(`
|
|
17
|
-
Server requested to slow down, increasing poll interval to ${d}ms'`)):d=2e3,n("polling",`Polling... (attempt ${E+1}/${p})`),await new Promise(f=>{let b=0,C=setInterval(()=>{if(b+=100,r){clearInterval(C),f();return}if(b>=d){clearInterval(C),f();return}},100)});let k=i();if(k)return k;continue}if(L(g)){let m=g;throw new Error(`Token polling failed: ${m?.error||"Unknown error"} - ${m?.error_description||"No details provided"}`)}}catch(g){let m=g instanceof Error?g.message:String(g),k=g instanceof Error?g.status:null,f=(C,_,v="error")=>(n(v,_),{success:!1,reason:C,message:_}),T=i();if(T)return T;if(m.includes("Failed to cache credentials"))return f("error",m);if(m.includes("401")||k===401)return f("error","Device code expired or invalid, please restart the authorization process.");if(m.includes("429")||k===429)return f("rate_limit","Too many requests. The server is rate limiting our requests. Please select a different authentication method or try again later.","rate_limit");let b=`Error polling for token: ${m}`;n("error",b),await new Promise(C=>setTimeout(C,d))}}let w="Authorization timeout, please restart the process.";return n("timeout",w),{success:!1,reason:"timeout",message:w}}catch(c){let a=`Device authorization flow failed: ${N(c,{url:Y})}`;return n("error",a),{success:!1,reason:"error",message:a}}finally{S.off("auth-cancel",t)}}var $=384;async function Be(o,e){let r=ce();try{await M.mkdir(j.dirname(r),{recursive:!0});let t=JSON.stringify(o,null,2),i=`${r}.tmp.${process.pid}.${se()}`;try{await M.writeFile(i,t,{mode:$,...e?.signal?{signal:e.signal}:{}});try{await M.chmod(i,$)}catch(n){if(process.platform!=="win32")throw new Error(`cacheMatildaCredentials: refusing to publish credentials \u2014 chmod 0o${$.toString(8)} on temp file failed: ${n instanceof Error?n.message:String(n)}`);h.warn(`cacheMatildaCredentials: chmod 0o${$.toString(8)} on Windows temp file ${i} failed; relying on NTFS ACL: ${n instanceof Error?n.message:String(n)}`)}await M.rename(i,r)}catch(n){try{await M.unlink(i)}catch{}throw n}try{A.getInstance().clearCache()}catch(n){h.warn(`cacheMatildaCredentials: SharedTokenManager.clearCache failed; in-process callers may serve stale credentials until the next mtime poll: ${n instanceof Error?n.message:String(n)}`)}}catch(t){let i=t instanceof Error?t.message:String(t);throw(t instanceof Error&&"code"in t?t.code:void 0)==="EACCES"?new Error(`Failed to cache credentials: Permission denied (EACCES). Current user has no permission to access \`${r}\`. Please check permissions.`):new Error(`Failed to cache credentials: error when creating folder \`${j.dirname(r)}\` and writing to \`${r}\`. ${i}. Please check permissions.`)}}async function ae(){try{let o=ce();await M.unlink(o),h.debug("Cached legacy OAuth credentials cleared successfully.")}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return;h.warn("Warning: Failed to clear cached legacy OAuth credentials:",o)}finally{try{A.getInstance().clearCache()}catch{}}}function ce(){return j.join(F.getGlobalMatildaDir(),Oe)}var Cr=ae;export{U as a,H as b,te as c,Ye as d,A as e,Pe as f,Ie as g,xe as h,O as i,V as j,G as k,Le as l,$e as m,L as n,J as o,Ne as p,S as q,_r as r,$ as s,Be as t,ae as u,Cr as v};
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2025 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* @license
|
|
25
|
-
* Copyright 2025 Matilda
|
|
26
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
27
|
-
*/
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{c as a,d as b,e as c}from"./chunk-TRM7SXZ5.js";import"./chunk-Z7OHKQ7V.js";import"./chunk-RO6LKQPB.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-KP6BLFQS.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-XXZH7C44.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-GTR4V2PV.js";import"./chunk-S4K76QPI.js";import"./chunk-CYTN3WRM.js";import"./chunk-4F4DA5UI.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import"./chunk-5U3A6KMU.js";import"./chunk-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{a as collectContextData,c as contextCommand,b as formatContextUsageText};
|
package/chunks/edit-U4PMKZYZ.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as G}from"./chunk-I55PXD4N.js";import{Kd as S,Ld as W,Ob as B,Sd as k,de as z,ee as T,ja as b,ke as q,le as H,oe as X}from"./chunk-RO6LKQPB.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-KP6BLFQS.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-XXZH7C44.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-GTR4V2PV.js";import"./chunk-S4K76QPI.js";import"./chunk-CYTN3WRM.js";import"./chunk-4F4DA5UI.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import{Lb as $,Oa as M,_c as j,ca as O,ha as x,wc as F}from"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{w as U}from"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{i as R,p as v,q as A}from"./chunk-5U3A6KMU.js";import"./chunk-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-IOCF4XSR.js";import{A as C,C as L,Y as I,a as w,z as E}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as y}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";y();import*as _ from"node:fs";import*as g from"node:path";y();var ne={"\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 P(r){if(r==="")return r;let t="";for(let e of r)t+=ne[e]??e;return t}var re=[r=>r,r=>r.trimEnd()];function oe(r){return P(r).trimEnd()}function V(r,t,e){if(t.length===0)return 0;if(t.length>r.length)return null;e:for(let i=0;i<=r.length-t.length;i++){for(let n=0;n<t.length;n++)if(e(r[i+n])!==e(t[n]))continue e;return i}return null}function ae(r){let t=r.split(`
|
|
4
|
-
`),e=new Array(t.length+1),i=0;for(let n=0;n<t.length;n++)e[n]=i,i+=t[n].length,n<t.length-1&&(i+=1);return e[t.length]=r.length,{lines:t,offsets:e}}function K(r,t,e,i,n,o){if(n===0)return o?`
|
|
5
|
-
`:"";let c=t[i]??0,s=i+n-1,l=(t[s]??0)+(e[s]?.length??0);if(o){let p=t[i+n];p!==void 0?l=p:r.endsWith(`
|
|
6
|
-
`)&&(l=r.length)}return r.slice(c,l)}function se(r,t){let{lines:e,offsets:i}=ae(r),n=t.split(`
|
|
7
|
-
`),o=t.endsWith(`
|
|
8
|
-
`);if(n.length===0)return null;let c=f=>{for(let l of re){let p=V(e,f,l);if(p!==null)return p}return V(e,f,oe)},s=c(n);if(s!==null)return{slice:K(r,i,e,s,n.length,o),removedTrailingFinalEmptyLine:!1};if(n.at(-1)===""){let f=n.slice(0,-1);if(f.length===0)return null;if(s=c(f),s!==null)return{slice:K(r,i,e,s,f.length,!1),removedTrailingFinalEmptyLine:!0}}return null}function le(r,t){if(t==="")return null;let e=r.indexOf(t);if(e!==-1)return{slice:r.slice(e,e+t.length),removedTrailingFinalEmptyLine:!1};let i=P(r),n=P(t),o=i.indexOf(n);return o!==-1?{slice:r.slice(o,o+t.length),removedTrailingFinalEmptyLine:!1}:se(r,t)}function ce(r){return r.endsWith(`\r
|
|
9
|
-
`)?r.slice(0,-2):r.endsWith(`
|
|
10
|
-
`)||r.endsWith("\r")?r.slice(0,-1):r}function fe(r,t){return t?ce(r):r}function Y(r,t,e){if(r===null||t==="")return{oldString:t,newString:e};let i=le(r,t);return i!==null?{oldString:i.slice,newString:fe(e,i.removedTrailingFinalEmptyLine)}:{oldString:t,newString:e}}function J(r,t,e){if(r===null||t===""||e!==""||t.endsWith(`
|
|
11
|
-
`))return t;let i=`${t}
|
|
12
|
-
`;return r.includes(i)?i:t}function Z(r,t){if(t==="")return 0;let e=0,i=r.indexOf(t);for(;i!==-1;)e++,i=r.indexOf(t,i+t.length);return e}var Q=4,de=1e3;function ee(r,t){let e=t.split(`
|
|
13
|
-
`),i=e.length;if(r===null)return{startLine:1,endLine:i,totalLines:i,content:t};if(r===t||!t)return null;let n=r.split(`
|
|
14
|
-
`),o=0,c=Math.min(n.length,e.length);for(;o<c&&n[o]===e[o];)o++;let s=n.length-1,f=e.length-1;for(;s>=o&&f>=o&&n[s]===e[f];)s--,f--;let l=o+1,p=f+1;if(p-l>de)return null;let m=Math.max(1,l-Q),h=Math.min(i,p+Q),u=e.slice(m-1,h);return{startLine:m,endLine:h,totalLines:i,content:u.join(`
|
|
15
|
-
`)}}var te=I("EDIT_PRIOR_READ");function ie(r,t,e,i){return i?e:r===null?t===""?e:"":t===""&&!i?r:k(r,t,e)}var D=class{constructor(t,e){this.config=t;this.params=e}toolLocations(){return[{path:this.params.file_path}]}async calculateEdit(t){let e=t.replace_all??!1,i=null,n=await x(t.file_path),o=!1,c=t.new_string,s=t.old_string,f=0,l,p=!1,m="utf-8",h="lf";if(!this.config.getFileReadCacheDisabled()){let a=await T(this.config.getFileReadCache(),t.file_path,"editing");if(!a.ok)return{currentContent:null,newContent:"",occurrences:0,error:{display:a.displayMessage,raw:a.rawMessage,type:a.type},isNewFile:!1,encoding:"utf-8",bom:!1,lineEnding:"lf"}}if(n)try{let a=await this.config.getFileSystemService().readTextFile({path:t.file_path});a._meta?.bom!==void 0?p=a._meta.bom:p=a.content.length>0&&a.content.codePointAt(0)===65279,m=a._meta?.encoding||"utf-8",h=X(a.content),i=a.content.replace(/\r\n/g,`
|
|
16
|
-
`),n=!0}catch(a){if(!w(a)||a.code!=="ENOENT")throw a;n=!1}if(n&&!this.config.getFileReadCacheDisabled()){let a=await T(this.config.getFileReadCache(),t.file_path,"editing",{expectExisting:!0});if(!a.ok)return te.warn("post-read TOCTOU rejection",{path:t.file_path,reason:a.type}),{currentContent:null,newContent:"",occurrences:0,error:{display:a.displayMessage,raw:a.rawMessage,type:a.type},isNewFile:!1,encoding:"utf-8",bom:!1,lineEnding:"lf"}}let u=Y(i,s,c);s=u.oldString,c=u.newString,s===""&&!n?o=!0:n?i!==null?(s=J(i,s,c),f=Z(i,s),t.old_string===""?l={display:"Failed to edit. Attempted to create a file that already exists.",raw:`File already exists, cannot create: ${t.file_path}`,type:"attempt_to_create_existing_file"}:f===0?l={display:"Failed to edit, could not find the string to replace.",raw:`Failed to edit, 0 occurrences found for old_string in ${t.file_path}. No edits made. The exact text in old_string was not found. Ensure you're not escaping content incorrectly and check whitespace, indentation, and context. Use ${F.Name} tool to verify.`,type:"edit_no_occurrence_found"}:!e&&f>1?l={display:"Failed to edit because the text matches multiple locations. Provide more context or set replace_all to true.",raw:`Failed to edit. Found ${f} occurrences for old_string in ${t.file_path} but replace_all was not enabled.`,type:"edit_expected_occurrence_mismatch"}:s===c&&(l={display:"No changes to apply. The old_string and new_string are identical.",raw:`No changes to apply. The old_string and new_string are identical in file: ${t.file_path}`,type:"edit_no_change"})):l={display:"Failed to read content of file.",raw:`Failed to read content of existing file: ${t.file_path}`,type:"read_content_failure"}:l={display:"File not found. Cannot apply edit. Use an empty old_string to create a new file.",raw:`File not found: ${t.file_path}`,type:"file_not_found"};let d=l?i??"":ie(i,s,c,o);return!l&&n&&i===d&&(l={display:"No changes to apply. The new content is identical to the current content.",raw:`No changes to apply. The new content is identical to the current content in file: ${t.file_path}`,type:"edit_no_change"}),{currentContent:i,newContent:d,occurrences:f,error:l,isNewFile:o,bom:p,encoding:m,lineEnding:h}}async getDefaultPermission(){let t=this.config.getProjectRoot();return U(g.resolve(this.params.file_path),t)?"allow":"ask"}async getConfirmationDetails(t){let e;try{e=await this.calculateEdit(this.params)}catch(c){if(t.aborted)throw c;let s=c instanceof Error?c.message:String(c);throw new Error(`Error preparing edit: ${s}`)}if(e.error)throw new z(e.error.raw,e.error.type);let i=g.basename(this.params.file_path),n=b(i,e.currentContent??"",e.newContent,"Current","Proposed",S);return{type:"edit",title:`Confirm Edit: ${E(C(this.params.file_path,this.config.getTargetDir()))}`,fileName:i,filePath:this.params.file_path,fileDiff:n,originalContent:e.currentContent,newContent:e.newContent,onConfirm:async c=>{c==="proceed_always"&&this.config.setApprovalMode("auto-edit")}}}getDescription(){let t=C(this.params.file_path,this.config.getTargetDir());return this.params.old_string===""?`Create ${E(t)}`:this.params.old_string===this.params.new_string?`No file changes to ${E(t)}`:E(t)}async execute(t){let e;try{e=await this.calculateEdit(this.params)}catch(i){if(t.aborted)throw i;let n=i instanceof Error?i.message:String(i);return{llmContent:`Error preparing edit: ${n}`,returnDisplay:`Error preparing edit: ${n}`,error:{message:n,type:"edit_preparation_failure"}}}if(e.error)return{llmContent:e.error.raw,returnDisplay:`Error: ${e.error.display}`,error:{message:e.error.raw,type:e.error.type}};try{try{await this.config.getFileHistoryService().trackEdit(this.params.file_path)}catch{}if(!this.config.getFileReadCacheDisabled()){let d=await T(this.config.getFileReadCache(),this.params.file_path,"editing",{expectExisting:!e.isNewFile});if(!d.ok)return te.warn("pre-write TOCTOU rejection",{path:this.params.file_path,reason:d.type}),{llmContent:d.rawMessage,returnDisplay:`Error: ${d.displayMessage}`,error:{message:d.rawMessage,type:d.type}}}if(this.ensureParentDirectoriesExist(this.params.file_path),e.isNewFile){let d=this.config.getDefaultFileEncoding(),a=!1;d===q.UTF8_BOM?a=!0:d===void 0&&(a=H(this.params.file_path)),await this.config.getFileSystemService().writeTextFile({path:this.params.file_path,content:e.newContent,_meta:{bom:a}})}else await this.config.getFileSystemService().writeTextFile({path:this.params.file_path,content:e.newContent,_meta:{bom:e.bom,encoding:e.encoding,lineEnding:e.lineEnding}});this.params.modified_by_user||B.getInstance().recordEdit(this.params.file_path,e.currentContent,e.newContent);try{let d=_.statSync(this.params.file_path);this.config.getFileReadCache().recordWrite(this.params.file_path,d)}catch{}let i=g.basename(this.params.file_path),n=this.params.ai_proposed_content||e.newContent,o=W(i,e.currentContent??"",n,e.newContent),s={fileDiff:b(i,e.currentContent??"",e.newContent,"Current","Proposed",S),fileName:i,originalContent:e.currentContent,newContent:e.newContent,diffStat:o},f=O(this.params.file_path),l=M(this.params.file_path),p=g.extname(this.params.file_path),m=e.isNewFile?"create":"update";$(this.config,new j(N.Name,m,e.newContent.split(`
|
|
17
|
-
`).length,f,p,l));let h=[e.isNewFile?`Created new file: ${this.params.file_path} with provided content.`:`The file: ${this.params.file_path} has been updated.`],u=ee(e.currentContent,e.newContent);if(u){let d=`Showing lines ${u.startLine}-${u.endLine} of ${u.totalLines} from the edited file:
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
${u.content}`;h.push(d)}try{let d=await G(this.config,this.params.file_path);d&&h.push(`
|
|
22
|
-
|
|
23
|
-
${d}`)}catch{}return{llmContent:h.join(" "),returnDisplay:s}}catch(i){let n=i instanceof Error?i.message:String(i);return{llmContent:`Error executing edit: ${n}`,returnDisplay:`Error writing file: ${n}`,error:{message:n,type:"file_write_failure"}}}}ensureParentDirectoriesExist(t){let e=g.dirname(t);_.existsSync(e)||_.mkdirSync(e,{recursive:!0})}},N=class r extends R{constructor(e){super(r.Name,A.EDIT,`Replaces text within a file. By default, replaces a single occurrence. Set \`replace_all\` to true when you intend to modify every instance of \`old_string\`. This tool requires providing significant context around the change to ensure precise targeting. Always use the ${F.Name} tool to examine the file's current content before attempting a text replacement.
|
|
24
|
-
|
|
25
|
-
The user has the ability to modify the \`new_string\` content. If modified, this will be stated in the response.
|
|
26
|
-
|
|
27
|
-
Expectation for required parameters:
|
|
28
|
-
1. \`file_path\` MUST be an absolute path; otherwise an error will be thrown.
|
|
29
|
-
2. \`old_string\` MUST be the exact literal text to replace (including all whitespace, indentation, newlines, and surrounding code etc.).
|
|
30
|
-
3. \`new_string\` MUST be the exact literal text to replace \`old_string\` with (also including all whitespace, indentation, newlines, and surrounding code etc.). Ensure the resulting code is correct and idiomatic.
|
|
31
|
-
4. NEVER escape \`old_string\` or \`new_string\`, that would break the exact literal text requirement.
|
|
32
|
-
**Important:** If ANY of the above are not satisfied, the tool will fail. CRITICAL for \`old_string\`: Must uniquely identify the single instance to change. Include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. If this string matches multiple locations, or does not match exactly, the tool will fail.
|
|
33
|
-
**Multiple replacements:** Set \`replace_all\` to true when you want to replace every occurrence that matches \`old_string\`.`,"edit",{properties:{file_path:{description:"The absolute path to the file to modify. Must start with '/'.",type:"string"},old_string:{description:"The exact literal text to replace, preferably unescaped. For single replacements (default), include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. If this string is not the exact literal text (i.e. you escaped it) or does not match exactly, the tool will fail.",type:"string"},new_string:{description:"The exact literal text to replace `old_string` with, preferably unescaped. Provide the EXACT text. Ensure the resulting code is correct and idiomatic.",type:"string"},replace_all:{type:"boolean",description:"Replace all occurrences of old_string (default false)."}},required:["file_path","old_string","new_string"],type:"object"});this.config=e}static Name=v.EDIT;validateToolParamValues(e){return e.file_path=L(e.file_path.trim()),e.file_path?g.isAbsolute(e.file_path)?null:`File path must be absolute: ${e.file_path}`:"The 'file_path' parameter must be non-empty."}createInvocation(e){return new D(this.config,e)}toAutoClassifierInput(e){let i=e.old_string??"",n=e.new_string??"";return{file_path:e.file_path,old_string_preview:i.slice(0,300),new_string_preview:n.slice(0,300),old_string_truncated:i.length>300,new_string_truncated:n.length>300,lines_changed:(n.match(/\n/g)?.length??0)-(i.match(/\n/g)?.length??0)}}getModifyContext(e){return{getFilePath:i=>i.file_path,getCurrentContent:async i=>{if(await x(i.file_path))try{let{content:o}=await this.config.getFileSystemService().readTextFile({path:i.file_path});return o}catch(o){if(!w(o)||o.code!=="ENOENT")throw o;return""}else return""},getProposedContent:async i=>{if(_.existsSync(i.file_path))try{let{content:n}=await this.config.getFileSystemService().readTextFile({path:i.file_path});return ie(n,i.old_string,i.new_string,i.old_string===""&&n==="")}catch(n){if(!w(n)||n.code!=="ENOENT")throw n;return""}else return""},createUpdatedParams:(i,n,o)=>({...o,ai_proposed_content:i,old_string:i,new_string:n,modified_by_user:!0})}}};export{N as EditTool,ie as applyReplacement};
|
|
34
|
-
/**
|
|
35
|
-
* @license
|
|
36
|
-
* Copyright 2025 Google LLC
|
|
37
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
38
|
-
*/
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import"./chunk-RO6LKQPB.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-KP6BLFQS.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-XXZH7C44.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-GTR4V2PV.js";import"./chunk-S4K76QPI.js";import"./chunk-CYTN3WRM.js";import"./chunk-4F4DA5UI.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{g as l,i as m,p,q as c}from"./chunk-5U3A6KMU.js";import"./chunk-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-IOCF4XSR.js";import{Y as s}from"./chunk-QWBNNEV2.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 h=s("ENTER_PLAN_MODE"),u=`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
|
-
|
|
5
|
-
## When to Use This Tool
|
|
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.
|
|
7
|
-
|
|
8
|
-
## When NOT to Use This Tool
|
|
9
|
-
If the request is already clear, small, and low-risk, you may execute directly without entering plan mode. Do not make speculative small edits before you have thought the change through.
|
|
10
|
-
|
|
11
|
-
## Important
|
|
12
|
-
Do NOT use this tool if the user has explicitly asked you not to use plan mode.`,f={name:"enter_plan_mode",description:u,parametersJsonSchema:{type:"object",properties:{},additionalProperties:!1,$schema:"http://json-schema.org/draft-07/schema#"}},r=class extends l{constructor(e,o){super(o);this.config=e}getDescription(){return"Enter plan mode"}async getDefaultPermission(){return"allow"}async execute(e){let o=this.config.getExperimentalZedIntegration?.()||this.config.getInputFormat?.()==="stream-json";if(!this.config.isInteractive()&&!o)return{llmContent:"Cannot enter plan mode in non-interactive mode without ACP support. The gate exit paths require user interaction.",returnDisplay:"Plan mode unavailable in non-interactive mode."};try{this.config.getApprovalMode()!=="plan"&&this.config.setApprovalMode("plan")}catch(t){let n=t instanceof Error?t.message:String(t);return h.error(`[EnterPlanModeTool] Failed to set approval mode to plan: ${n}`),{llmContent:`Failed to enter plan mode: ${n}`,returnDisplay:`Error entering plan mode: ${n}`}}return{llmContent:"Plan mode is now active. Continue with read-only investigation, ask the user when needed, and use exit_plan_mode when the plan is ready.",returnDisplay:"Entered plan mode."}}},d=class i extends m{constructor(e){super(i.Name,c.ENTER_PLAN_MODE,u,"think",f.parametersJsonSchema,!0,!1,!1,!1,"plan mode enter start");this.config=e}static Name=p.ENTER_PLAN_MODE;createInvocation(e){return new r(this.config,e)}};export{d as EnterPlanModeTool};
|
|
13
|
-
/**
|
|
14
|
-
* @license
|
|
15
|
-
* Copyright 2025 Matilda
|
|
16
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
*/
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as g}from"./chunk-EMWHQSMS.js";import{g as u}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{e as d}from"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-FWDMPRKU.js";import{b as m}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";m();m();var p=class{googleGenAI;contentGeneratorConfig;constructor(e,t){let r=t?.customHeaders,n=r?(()=>{let i=e.httpOptions,s=i?.headers??{},l=Object.fromEntries(Object.entries(r).filter(([a])=>!d(a)));return{...e,httpOptions:{...i??{},headers:{...s,...l}}}})():e;this.googleGenAI=new u(n),this.contentGeneratorConfig=t}buildGenerateContentConfig(e){let t=this.contentGeneratorConfig?.samplingParams,r=e.config||{},n=(i,s,l)=>{let a=r[s];return i!==void 0?i:a!==void 0?a:l};return{...r,temperature:n(t?.temperature,"temperature",1),topP:n(t?.top_p,"topP",.95),topK:n(t?.top_k,"topK",64),maxOutputTokens:n(t?.max_tokens,"maxOutputTokens"),presencePenalty:n(t?.presence_penalty,"presencePenalty"),frequencyPenalty:n(t?.frequency_penalty,"frequencyPenalty"),thinkingConfig:n(this.buildThinkingConfig(),"thinkingConfig",{includeThoughts:!0,thinkingLevel:"THINKING_LEVEL_UNSPECIFIED"})}}buildThinkingConfig(){let e=this.contentGeneratorConfig?.reasoning;if(e===!1)return{includeThoughts:!1};if(e)return{includeThoughts:!0,thinkingLevel:e.effort==="low"?"LOW":e.effort==="high"||e.effort==="max"?"HIGH":"THINKING_LEVEL_UNSPECIFIED"}}async generateContent(e,t){let r={...e,contents:this.stripUnsupportedFields(e.contents),config:this.buildGenerateContentConfig(e)};return this.googleGenAI.models.generateContent(r)}async generateContentStream(e,t){let r={...e,contents:this.stripUnsupportedFields(e.contents),config:this.buildGenerateContentConfig(e)};return this.googleGenAI.models.generateContentStream(r)}stripUnsupportedFields(e){return!e||typeof e=="string"?e:Array.isArray(e)?e.map(t=>this.stripContentFields(t)):this.stripContentFields(e)}stripContentFields(e){if(typeof e=="string")return e;if(!("role"in e)&&!("parts"in e))return this.stripPartFields(e);let t=e;return t.parts?{...t,parts:t.parts.map(r=>this.stripPartFields(r))}:t}stripPartFields(e){if(typeof e=="string")return e;let t={...e};if(t.inlineData){let{displayName:r,...n}=t.inlineData;t.inlineData=n}if(t.fileData){let{displayName:r,...n}=t.fileData;t.fileData=n}if(t.functionResponse?.parts){let r=t.functionResponse.parts.map(n=>{let i=this.convertUnsupportedMediaToText(n);return this.stripPartFields(i)});t.functionResponse={...t.functionResponse,parts:r}}return t}convertUnsupportedMediaToText(e){if(typeof e=="string")return e;let t=e.inlineData?.mimeType||"",r=e.fileData?.mimeType||"";if(t.startsWith("audio/")||t.startsWith("video/")){let n=e.inlineData?.displayName,i=n?` (${n})`:"";return{text:`Unsupported media type for Gemini: ${t}${i}.`}}if(r.startsWith("audio/")||r.startsWith("video/")){let n=e.fileData?.displayName,i=n?` (${n})`:"";return{text:`Unsupported media type for Gemini: ${r}${i}.`}}return e}async countTokens(e){return this.googleGenAI.models.countTokens(e)}async embedContent(e){return this.googleGenAI.models.embedContent(e)}useSummarizedThinking(){return!0}};function T(o,e){let i={...{"User-Agent":o.userAgent||`MatildaCode/0.20.0 (${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
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as o,i as d}from"./chunk-QT4UNNZ4.js";import"./chunk-QCIDUZV6.js";import"./chunk-3KCDX6MY.js";import"./chunk-RO6LKQPB.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-KP6BLFQS.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-XXZH7C44.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{b as u}from"./chunk-GTR4V2PV.js";import"./chunk-S4K76QPI.js";import"./chunk-CYTN3WRM.js";import"./chunk-4F4DA5UI.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{j as s}from"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import"./chunk-5U3A6KMU.js";import{e as c}from"./chunk-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-IOCF4XSR.js";import{Y as i}from"./chunk-QWBNNEV2.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 d{debugLogger=i("MATILDA");matildaClient;sharedManager;currentToken;constructor(e,t,r){let n=new o(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||u,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
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Matilda
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q}from"./chunk-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.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,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{aj as a,bj as b}from"./chunk-RO6LKQPB.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-KP6BLFQS.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-XXZH7C44.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-GTR4V2PV.js";import"./chunk-S4K76QPI.js";import"./chunk-CYTN3WRM.js";import"./chunk-4F4DA5UI.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import"./chunk-5U3A6KMU.js";import"./chunk-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{b as RipGrepTool,a as _resetRipGrepCachesForTest};
|
package/chunks/shell-WFONAKPV.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{re as a,se as b,te as c,ue as d,ve as e,we as f}from"./chunk-RO6LKQPB.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-KP6BLFQS.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-XXZH7C44.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-GTR4V2PV.js";import"./chunk-S4K76QPI.js";import"./chunk-CYTN3WRM.js";import"./chunk-4F4DA5UI.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import"./chunk-5U3A6KMU.js";import"./chunk-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{b as OUTPUT_UPDATE_INTERVAL_MS,f as ShellTool,e as ShellToolInvocation,c as buildLongRunningForegroundHint,d as detectBlockedSleepPattern,a as parseNumstat};
|
package/chunks/src-IHYMMU26.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{$ as ji,$a as jj,$b as lk,$c as kl,$d as em,$e as Pm,$f as Yo,$g as Zp,$h as Zq,$j as Xs,$k as Xt,A as Tg,Aa as Ki,Ab as Oj,Ac as Lk,Ad as Ll,Ae as rm,Ag as yp,Ah as Aq,Ai as vr,Aj as ws,Ak as wt,Al as vu,B as Ug,Ba as Li,Bb as Pj,Bc as Mk,Bd as Ml,Be as sm,Bg as zp,Bh as Bq,Bi as wr,Bj as xs,Bk as xt,Bl as wu,C as Vg,Ca as Mi,Cb as Qj,Cc as Nk,Cd as Nl,Ce as tm,Cg as Ap,Ch as Cq,Ci as xr,Cj as ys,Ck as yt,Cl as xu,D as Wg,Da as Ni,Db as Rj,Dc as Ok,Dd as Ol,De as um,Dg as Bp,Dh as Dq,Di as yr,Dj as zs,Dk as zt,Dl as yu,E as Xg,Ea as Oi,Eb as Sj,Ec as Pk,Ed as Pl,Ee as vm,Ef as xn,Eg as Cp,Eh as Eq,Ei as zr,Ej as As,Ek as At,El as zu,F as Yg,Fa as Pi,Fb as Tj,Fc as Qk,Fd as Ql,Fe as wm,Ff as yn,Fg as Dp,Fh as Fq,Fi as Ar,Fj as Bs,Fk as Bt,Fl as Au,G as Zg,Ga as Qi,Gb as Uj,Gc as Rk,Gd as Rl,Ge as xm,Gf as zn,Gg as Ep,Gh as Gq,Gi as Br,Gj as Cs,Gk as Ct,H as _g,Ha as Ri,Hb as Vj,Hc as Sk,Hd as Sl,He as ym,Hf as An,Hg as Fp,Hh as Hq,Hi as Cr,Hj as Ds,Hk as Dt,Ia as Si,Ib as Wj,Ic as Tk,Id as Tl,Ie as zm,If as Bn,Ig as Gp,Ih as Iq,Ii as Dr,Ij as Es,Ik as Et,J as $g,Ja as Ti,Jb as Xj,Jc as Uk,Jd as Ul,Je as Am,Jf as Cn,Jg as Hp,Jh as Jq,Ji as Er,Jj as Fs,Jk as Ft,K as ah,Ka as Ui,Kb as Yj,Kc as Vk,Ke as Bm,Kf as Dn,Kg as Ip,Kh as Kq,Ki as Fr,Kj as Gs,Kk as Gt,L as bh,La as Vi,Lb as Zj,Lc as Wk,Le as Cm,Lf as En,Lg as Jp,Lh as Lq,Li as Gr,Lj as Hs,Lk as Ht,M as Wh,Ma as Wi,Mb as _j,Mc as Xk,Md as Vl,Me as Dm,Mf as Fn,Mg as Kp,Mh as Mq,Mi as Hr,Mj as Is,Mk as It,N as Xh,Na as Xi,Nb as $j,Nc as Yk,Nd as Wl,Nf as Gn,Ng as Lp,Nh as Nq,Ni as Ir,Nj as Js,Nk as Jt,O as Yh,Oa as Yi,Oc as Zk,Of as Hn,Og as Mp,Oh as Oq,Oi as Jr,Oj as Ks,Ok as Kt,P as Zh,Pa as Zi,Pb as ak,Pc as _k,Pf as In,Pg as Np,Ph as Pq,Pi as Kr,Pj as Ls,Pk as Lt,Q as _h,Qa as _i,Qb as bk,Qc as $k,Qe as Em,Qf as Jn,Qg as Op,Qh as Qq,Qi as Lr,Qj as Ms,Qk as Mt,R as $h,Ra as $i,Rb as ck,Rc as al,Re as Fm,Rf as Rn,Rg as Pp,Rh as Rq,Ri as Mr,Rj as Ns,Rk as Nt,S as ai,Sa as aj,Sb as dk,Sc as bl,Sd as Xl,Se as Gm,Sf as Sn,Sg as Qp,Sh as Sq,Si as Nr,Sj as Os,Sk as Ot,T as bi,Ta as bj,Tb as ek,Tc as cl,Td as Yl,Te as Hm,Tf as Qo,Tg as Rp,Th as Tq,Ti as Or,Tj as Ps,Tk as Pt,U as ci,Ua as cj,Ub as fk,Uc as dl,Ud as Zl,Ue as Im,Uf as Ro,Ug as Sp,Uh as Uq,Ui as Pr,Uj as Qs,Uk as Qt,V as di,Va as dj,Vb as gk,Vc as el,Vd as _l,Ve as Jm,Vf as So,Vg as Tp,Vh as Vq,Vi as Qr,Vj as Rs,Vk as Rt,W as ei,Wa as ej,Wb as hk,Wc as fl,Wd as $l,We as Km,Wf as To,Wg as Up,Wh as Wq,Wi as Rr,Wj as Ss,Wk as St,X as fi,Xa as fj,Xb as ik,Xc as gl,Xd as am,Xe as Lm,Xf as Uo,Xg as Vp,Xh as Xq,Xi as Sr,Xj as Ts,Xk as Tt,Y as gi,Ya as gj,Yc as hl,Yd as bm,Ye as Mm,Yf as Vo,Yg as Wp,Yi as Tr,Yj as Us,Yk as Ut,Z as hi,Za as hj,Zb as jk,Zc as il,Zd as cm,Ze as Nm,Zf as Wo,Zg as Xp,Zi as Ur,Zj as Vs,Zk as Vt,_ as ii,_a as ij,_b as kk,_c as jl,_d as dm,_e as Om,_f as Xo,_g as Yp,_h as Yq,_j as Ws,_k as Wt,a as qa,aa as ki,ab as kj,ac as mk,ad as ll,af as _m,ag as Zo,ah as _p,ai as _q,aj as Vr,ak as Ys,al as Yt,b as ra,ba as li,bb as lj,bc as nk,bd as ml,be as fm,bf as $m,bg as _o,bh as $p,bi as $q,bj as Wr,bk as Zs,bl as Zt,c as sa,ca as mi,cb as mj,cc as ok,cd as nl,ce as gm,cf as an,cg as $o,ch as aq,ci as ar,cj as Xr,ck as _s,cl as _t,d as ta,da as ni,db as nj,dc as pk,dd as ol,df as bn,dg as ap,dh as bq,di as br,dj as Yr,dk as $s,dl as $t,e as ua,ea as oi,eb as oj,ed as pl,ef as cn,eg as bp,eh as cq,ei as cr,ej as Zr,ek as at,el as au,f as va,fa as qi,fb as pj,fc as qk,fd as ql,ff as dn,fg as cp,fh as dq,fi as dr,fj as _r,fk as bt,fl as bu,g as wa,ga as ri,gb as qj,gc as rk,gd as rl,gf as en,gg as dp,gh as eq,gi as er,gj as cs,gk as ct,gl as cu,h as xa,ha as si,hb as rj,hc as sk,hd as sl,hf as fn,hg as ep,hh as fq,hi as fr,hj as ds,hk as dt,hl as du,i as ya,ia as ti,ib as sj,ic as tk,id as tl,if as gn,ig as fp,ih as gq,ii as gr,ij as es,ik as et,il as eu,j as Cg,jb as tj,jc as uk,jd as ul,jf as hn,jg as gp,jh as hq,ji as hr,jj as fs,jk as ft,jl as fu,k as Dg,ka as ui,kb as uj,kc as vk,kd as vl,ke as hm,kf as jn,kg as hp,kh as iq,ki as ir,kj as gs,kk as gt,l as Eg,la as vi,lb as xj,lc as wk,ld as wl,le as im,lf as kn,lg as ip,lh as jq,lj as hs,lk as ht,ll as gu,m as Fg,ma as wi,mb as Aj,mc as xk,md as xl,me as jm,mf as ln,mg as jp,mh as kq,mi as jr,mj as is,mk as it,ml as hu,n as Gg,na as xi,nb as Bj,nc as yk,nd as yl,ne as km,nf as mn,ng as kp,nh as lq,ni as kr,nj as js,nk as jt,nl as iu,o as Hg,oa as yi,ob as Cj,oc as zk,od as zl,oe as lm,of as nn,og as lp,oh as mq,oi as lr,oj as ks,ok as kt,ol as ju,p as Ig,pa as zi,pb as Dj,pc as Ak,pd as Al,pe as mm,pf as on,pg as mp,ph as nq,pi as mr,pj as ls,pk as lt,pl as ku,q as Jg,qa as Ai,qb as Ej,qc as Bk,qd as Bl,qe as nm,qf as pn,qg as np,qh as oq,qi as nr,qj as ms,qk as mt,ql as lu,r as Kg,ra as Bi,rb as Fj,rc as Ck,rd as Cl,rf as qn,rg as op,rh as pq,ri as or,rj as ns,rk as nt,rl as mu,s as Lg,sa as Ci,sb as Gj,sc as Dk,sd as Dl,sf as rn,sg as pp,sh as qq,si as pr,sj as os,sk as ot,sl as nu,t as Mg,ta as Di,tb as Hj,tc as Ek,td as El,tf as sn,tg as qp,th as rq,tj as ps,tk as pt,tl as ou,u as Ng,ua as Ei,ub as Ij,uc as Fk,ud as Fl,uf as tn,ug as rp,uh as sq,uj as qs,uk as qt,ul as pu,v as Og,va as Fi,vb as Jj,vc as Gk,vd as Gl,vf as un,vg as sp,vh as vq,vi as qr,vj as rs,vk as rt,vl as qu,w as Pg,wa as Gi,wb as Kj,wc as Hk,wd as Hl,wf as vn,wg as tp,wh as wq,wi as rr,wj as ss,wk as st,wl as ru,x as Qg,xa as Hi,xb as Lj,xc as Ik,xd as Il,xe as om,xf as wn,xg as up,xh as xq,xi as sr,xj as ts,xk as tt,xl as su,y as Rg,ya as Ii,yb as Mj,yc as Jk,yd as Jl,ye as pm,yg as wp,yh as yq,yi as tr,yj as us,yk as ut,yl as tu,z as Sg,za as Ji,zb as Nj,zc as Kk,zd as Kl,ze as qm,zg as xp,zh as zq,zi as ur,zj as vs,zk as vt,zl as uu}from"./chunk-RO6LKQPB.js";import"./chunk-TZIDSCTF.js";import{a as Tn,b as Un,c as Vn,d as Wn,e as Xn,f as ro,g as so,h as to,i as uo,j as vo,k as wo,l as xo,m as yo}from"./chunk-FUNLOUYI.js";import{a as zo,b as Ao,c as Bo,d as Co,e as Do,f as Eo,g as Fo,h as Go,i as Ho,j as Io,k as Jo,l as Ko,m as Lo,n as Mo,o as No,p as Oo,q as Po}from"./chunk-R3H6IWFK.js";import{a as Yn,b as Zn,c as _n,d as $n,e as ao,f as bo,g as co,h as eo,i as fo,j as go,k as ho,l as io,m as jo,n as ko,o as lo,p as mo,q as no,r as oo,s as po,t as qo}from"./chunk-OMZ5SGMK.js";import{a as pi}from"./chunk-KP6BLFQS.js";import{c as $r,e as as,f as bs}from"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import{b as ch,c as dh,d as eh,e as fh,f as gh,g as hh,h as ih,i as jh,j as kh,k as lh,l as mh,m as nh,n as oh,o as Oh,p as Ph,q as Qh,r as Rh,s as Sh,t as Th,u as Uh,v as Vh}from"./chunk-XXZH7C44.js";import{a as tq,b as uq}from"./chunk-47XR7IMP.js";import{b as vp}from"./chunk-QEI3OETI.js";import{a as Qm,b as Rm,c as Sm,d as Tm,e as Um,f as Vm,g as Wm,h as Xm,i as Ym,j as Zm,k as Kn,l as Ln,m as Mn,n as Nn,o as On,p as Pn,q as Qn}from"./chunk-QKYGQLWC.js";import{c as yj,f as zj}from"./chunk-MNGFXISD.js";import{a as ph,b as qh,c as rh,d as sh,e as th,f as uh,g as vh,h as wh,i as xh,j as yh,k as zh,l as Ah,m as Bh,n as Ch,o as Dh,p as Eh,q as Fh,r as Gh,s as Hh,t as Ih,u as Jh,v as Kh,w as Lh,x as Mh,y as Nh}from"./chunk-4R2OFVPK.js";import{a as vj,b as wj}from"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import{a as $f,c as ag,d as bg,e as cg}from"./chunk-GTR4V2PV.js";import{b as Tf,d as Uf,e as Vf,g as Wf,h as Xf,i as Yf,j as Zf,k as _f}from"./chunk-S4K76QPI.js";import{A as xg,B as yg,C as zg,D as Ag,E as Bg,d as qe,e as re,f as se,h as qf,i as rf,j as sf,m as tf,o as uf,p as vf,q as wf,r as xf,s as yf,t as zf,u as Af,v as Bf,w as Cf,x as Df,y as Ef,z as Ff}from"./chunk-CYTN3WRM.js";import{a as bf,b as cf,c as df,d as ef}from"./chunk-4F4DA5UI.js";import{A as Ye,B as Ze,C as _e,D as $e,E as af,a as ye,b as ze,c as Ae,d as Be,e as Ce,f as De,g as Ee,h as Fe,i as Ge,j as He,k as Ie,l as Je,m as Ke,n as Le,o as Me,p as Ne,q as Oe,r as Pe,s as Qe,t as Re,u as Se,v as Te,w as Ue,x as Ve,y as We,z as Xe}from"./chunk-2XZIKUB6.js";import{c as te,d as ue,e as ve,f as we,g as xe,h as ff,i as gf,j as hf,k as jf,l as kf,m as lf,n as mf,o as nf,p as of,q as pf}from"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{a as Gf,b as Hf,c as If,d as Jf,e as Kf,f as Lf,g as Mf,h as Nf,i as Of,j as Pf,k as Qf,l as Rf,m as Sf}from"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import{$ as cb,A as Qa,Aa as Cb,Ab as uc,B as Ra,Ba as Db,Bb as vc,C as Sa,Ca as Eb,Cb as wc,Cc as Ed,D as Ta,Da as Fb,Db as xc,Dc as Fd,E as Ua,Ea as Gb,Eb as yc,Ec as Gd,F as Va,Fa as Hb,Fb as zc,Fc as Hd,G as Wa,Ga as Ib,Gb as Ac,Gc as Id,H as Xa,Ha as Jb,Hb as Bc,Hc as Jd,I as Ya,Ia as Kb,Ib as Cc,Ic as Kd,Ja as Lb,Jb as Dc,Jc as Ld,Ka as Mb,Kb as Ec,Kc as Md,La as Nb,Lc as Nd,Ma as Ob,Mb as Fc,Mc as Od,Na as Pb,Nb as Gc,Nc as Pd,Ob as Hc,Oc as Qd,Pb as Ic,Pc as Rd,Qa as Qb,Qb as Jc,Rb as Kc,Sc as Sd,Ta as Rb,Tc as Td,Ua as Sb,Ub as Lc,Uc as Ud,Va as Tb,Vb as Mc,Vc as Vd,W as Za,Wa as Ub,Wb as Nc,Wc as Wd,X as _a,Xa as Vb,Xb as Oc,Xc as Xd,Y as $a,Ya as Wb,Yb as Pc,Yc as Yd,Z as ab,Za as Xb,Zb as Qc,Zc as Zd,_ as bb,_a as Yb,aa as db,ab as Zb,b as _,ba as eb,bb as _b,c as $,ca as fb,cb as $b,cc as Rc,cd as _d,d as aa,da as gb,db as ac,dd as $d,e as na,ea as hb,eb as bc,ec as Sc,ed as ae,fa as ib,fb as cc,fc as Tc,g as oa,ga as jb,gb as dc,gc as Uc,gd as be,h as pa,ha as kb,hb as ec,hc as Vc,hd as ce,ia as lb,ib as fc,ic as Wc,ja as mb,jb as gc,jc as Xc,jd as de,ka as nb,kb as hc,kc as Yc,la as ob,lb as ic,lc as Zc,ld as ee,ma as pb,mb as jc,mc as _c,md as fe,n as Da,nb as kc,nc as $c,nd as ge,o as Ea,oa as qb,ob as lc,oc as ad,od as he,p as Fa,pa as rb,pb as mc,pc as bd,pd as ie,q as Ga,qa as sb,qb as nc,qc as cd,qd as je,r as Ha,ra as tb,rb as oc,rc as dd,rd as ke,s as Ia,sa as ub,sb as pc,sc as ed,sd as le,t as Ja,ta as vb,tc as fd,td as me,u as Ka,ua as wb,ud as ne,v as La,va as xb,vd as oe,w as Ma,wa as yb,wb as qc,wc as Dd,wd as pe,x as Na,xa as zb,xb as rc,y as Oa,ya as Ab,yb as sc,z as Pa,za as Bb,zb as tc}from"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{a as gd,b as hd,c as id,d as jd,e as kd,f as ld,g as md,h as nd,i as od,j as pd,k as qd,l as rd,m as sd,n as td,o as ud,p as vd,q as wd,r as xd,s as yd,t as zd,u as Ad,v as Bd,w as Cd}from"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import{a as ba,e as ca,f as da,g as ea,h as fa,i as ga,j as ha,k as ia,l as ja,m as ka,n as la,o as ma,p as za,q as Aa,r as Ba,s as Ca}from"./chunk-5U3A6KMU.js";import{a as dg,b as eg,c as fg,d as gg,f as hg,g as ig,h as jg,i as kg,j as lg,k as mg,l as ng,m as og,n as pg,o as qg,p as rg,q as sg,r as tg,s as ug,t as vg,v as wg}from"./chunk-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-IOCF4XSR.js";import{A,B,C,D,E,F,G,H,I,J,L as K,M as L,Q as O,R as P,U as Q,V as R,W as S,X as T,Y as U,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import{c as M,g as N}from"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{Ea as AGENT_CONTEXT_FILENAME,nn as AGENT_WORKTREE_HEX_LENGTH,mn as AGENT_WORKTREE_PREFIX,on as AGENT_WORKTREE_SLUG_PATTERN,at as ALL_PROVIDERS,ds as APPROVAL_MODES,fs as APPROVAL_MODE_INFO,qa as ARENA_MAX_AGENTS,kd as AUTO_MEMORY_CONSOLIDATION_LOCK_FILENAME,gd as AUTO_MEMORY_DIRNAME,jd as AUTO_MEMORY_EXTRACT_CURSOR_FILENAME,hd as AUTO_MEMORY_INDEX_FILENAME,id as AUTO_MEMORY_METADATA_FILENAME,bk as AUTO_MEMORY_SCHEMA_VERSION,ak as AUTO_MEMORY_TYPES,pl as AUTO_MODE_DENIAL_LIMITS,ip as AUTO_SKILL_THRESHOLD,gu as AbortError,an as AgentCore,Mm as AgentEventEmitter,Lm as AgentEventType,Pm as AgentHeadless,Bn as AgentInteractive,da as AgentStatistics,ua as AgentStatus,ta as AgentTerminateMode,Mh as AgentType,Nd as ApiCancelEvent,Md as ApiErrorEvent,Ld as ApiRequestEvent,pb as ApiRequestPhase,Od as ApiResponseEvent,cs as ApprovalMode,ya as ArenaAgentClient,Fn as ArenaEventEmitter,En as ArenaEventType,Jn as ArenaManager,ra as ArenaSessionStatus,An as AsyncMessageQueue,de as AuthEvent,ns as AuthProviderType,xg as AuthType,To as BACKGROUND_AGENT_CONCURRENCY_ENV,kn as BASELINE_COMMIT_MESSAGE,Ta as BINARY_EXTENSIONS,La as BINARY_FILE_PATTERNS,qu as BTW_MAX_INPUT_LENGTH,_p as BUNDLE_CHUNK_DIR,_o as BackgroundAgentResumeService,Lq as BackgroundShellRegistry,Yo as BackgroundTaskRegistry,q as BadRequestError,ga as BaseDeclarativeTool,ea as BaseToolInvocation,oq as BudgetExhaustedError,wn as BuiltinAgentRegistry,hf as CAPPED_DEFAULT_MAX_TOKENS,Kt as CODE_ACTION_KIND_LABELS,Ek as COMMAND_SUBSTITUTION_WARNING,Na as COMMON_DIRECTORY_EXCLUDES,Ka as COMMON_IGNORE_PATTERNS,ma as CONCURRENCY_SAFE_KINDS,Zs as CUSTOM_API_KEY_ENV_PREFIX,dj as ChatRecordingService,Dm as CloseDiffRequestSchema,$l as ColorMode,hj as CompressionStatus,Jr as ConditionalRulesRegistry,os as Config,Nm as ContextState,Yd as ConversationFinishedEvent,Km as CoreToolScheduler,kg as CredentialsClearRequiredError,rp as CronScheduler,Be as DAEMON_TRACEPARENT_META_KEY,Ce as DAEMON_TRACESTATE_META_KEY,jp as DEFAULT_AUTO_DREAM_MIN_HOURS,kp as DEFAULT_AUTO_DREAM_MIN_SESSIONS,Zo as DEFAULT_BACKGROUND_AGENT_CONTINUATION_MESSAGE,vn as DEFAULT_BUILTIN_SUBAGENT_TYPE,Da as DEFAULT_CONTEXT_FILENAME,Za as DEFAULT_ENCODING,Qa as DEFAULT_FILE_EXCLUDES,wj as DEFAULT_FILE_FILTERING_OPTIONS,Ct as DEFAULT_LSP_COMMAND_CHECK_TIMEOUT_MS,Bt as DEFAULT_LSP_DOCUMENT_OPEN_DELAY_MS,Et as DEFAULT_LSP_DOCUMENT_RETRY_DELAY_MS,Ft as DEFAULT_LSP_MAX_RESTARTS,zt as DEFAULT_LSP_REQUEST_TIMEOUT_MS,Ht as DEFAULT_LSP_SOCKET_MAX_RETRY_DELAY_MS,Gt as DEFAULT_LSP_SOCKET_RETRY_DELAY_MS,yt as DEFAULT_LSP_STARTUP_TIMEOUT_MS,At as DEFAULT_LSP_WARMUP_DELAY_MS,Dt as DEFAULT_LSP_WORKSPACE_SYMBOL_WARMUP_DELAY_MS,df as DEFAULT_MATILDA_EMBEDDING_MODEL,cf as DEFAULT_MATILDA_FLASH_MODEL,bf as DEFAULT_MATILDA_MODEL,So as DEFAULT_MAX_CONCURRENT_BACKGROUND_AGENTS,rs as DEFAULT_MAX_INLINE_MEDIA_BYTES,vj as DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,af as DEFAULT_OTLP_ENDPOINT,gf as DEFAULT_OUTPUT_TOKEN_LIMIT,gs as DEFAULT_PR_ATTRIBUTION_MESSAGE,Wh as DEFAULT_STOP_HOOK_BLOCK_CAP,$e as DEFAULT_TELEMETRY_TARGET,ff as DEFAULT_TOKEN_LIMIT,js as DEFAULT_TOOL_OUTPUT_BATCH_BUDGET,bh as DEFAULT_TOOL_RESULTS_TOTAL_CHARS_THRESHOLD,is as DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,hs as DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,Jt as DIAGNOSTIC_SEVERITY_LABELS,xn as DISPLAY_MODE,gp as DREAM_TASK_TYPE,fa as DeclarativeTool,yh as DefaultHookOutput,Ed as DiscoveredMCPTool,rq as DiscoveredTool,jf as ESCALATED_MAX_TOKENS,$ as EVENT_API_ERROR,aa as EVENT_API_RESPONSE,_ as EVENT_TOOL_CALL,_m as EXCLUDED_TOOLS_FOR_SUBAGENTS,Qq as EXTENSIONS_CONFIG_FILENAME,Pq as EXTENSIONS_DIRECTORY_NAME,Sq as EXTENSION_SETTINGS_FILENAME,$m as EXTERNAL_MESSAGE_PREFIX,fp as EXTRACT_TASK_TYPE,Hd as EndSessionEvent,ke as ExtensionDisableEvent,be as ExtensionEnableEvent,_d as ExtensionInstallEvent,yr as ExtensionManager,qr as ExtensionSettingScope,ae as ExtensionUninstallEvent,xr as ExtensionUpdateState,Gi as FILE_HISTORY_DIR,dn as FORK_SUBAGENT_TYPE,g as FatalAuthenticationError,m as FatalBudgetExceededError,n as FatalCancellationError,j as FatalConfigError,f as FatalError,h as FatalInputError,i as FatalSandboxError,l as FatalToolExecutionError,k as FatalTurnLimitedError,sn as FileDiscoveryService,hm as FileEncoding,Ra as FileExclusions,Ji as FileHistoryService,lb as FileOperation,Oq as FileReadCache,wm as FileSchema,iu as FileSearchFactory,Pd as FlashFallbackEvent,o as ForbiddenError,Rh as GOAL_HOOK_TIMEOUT_MS,Qh as GOAL_HOOK_TIMEOUT_SECONDS,t as GOOGLE_ACCOUNTS_FILENAME,Zj as GeminiChat,qp as GeminiClient,gj as GeminiEventType,rn as GitIgnoreParser,qn as GitWorktreeService,sh as HOOKS_CONFIG_FIELDS,qh as HookEventName,rh as HookPhase,Dr as HookRegistry,Fr as HookSystem,th as HookType,ph as HooksConfigSource,Em as IDEConnectionStatus,om as IDE_DEFINITIONS,rm as IDE_MAX_OPEN_FILES,sm as IDE_MAX_SELECTED_TEXT_LENGTH,tm as IDE_REQUEST_TIMEOUT_MS,bu as IDLE_SPECULATION,Pn as INBOXES_DIR,Ut as INITIAL_FOLLOWUP_STATE,Rq as INSTALL_METADATA_FILENAME,zn as ITermBackend,Fm as IdeClient,Xd as IdeConnectionEvent,Wd as IdeConnectionType,ym as IdeContextNotificationSchema,xm as IdeContextSchema,um as IdeContextStore,zm as IdeDiffAcceptedNotificationSchema,Bm as IdeDiffClosedNotificationSchema,Am as IdeDiffRejectedNotificationSchema,bs as Ignore,Cn as InProcessBackend,tq as InputFormat,lq as InvalidMcpConfigError,Xj as InvalidStreamError,ps as JsonFormatter,vp as KeychainTokenStorage,ka as Kind,Zd as KittySequenceOverflowEvent,Ln as LEADER_NAME,Oi as LITE_READ_BUF_SIZE,Fa as LOCAL_CONTEXT_FILENAME,Ds as Logger,Rd as LoopType,Lt as LspConfigLoader,Mt as LspConnectionFactory,Nt as LspResponseNormalizer,Ot as LspServerManager,ef as MAINLINE_CODER_MODEL,na as MAIN_SOURCE,$f as MATILDA_API_KEY_ENV_KEY,qm as MATILDA_CODE_COMPANION_EXTENSION_NAME,st as MATILDA_CODE_SIMPLE_ENV_VAR,ug as MATILDA_CREDENTIAL_FILE_MODE,s as MATILDA_DIR,tf as MATILDA_OAUTH_MODELS,rc as MATILDA_SESSION_ID_HASH_ATTR,qc as MATILDA_USER_ID_HASH_ATTR,Vo as MAX_CONCURRENT_BACKGROUND_AGENTS,Fq as MAX_CONCURRENT_MONITORS,vi as MAX_DIFF_SIZE_BYTES,ui as MAX_FILES,xi as MAX_FILES_FOR_DETAILS,Ph as MAX_GOAL_ITERATIONS,wi as MAX_LINES_PER_FILE,Jq as MAX_NOTIFICATION_OUTPUT_TAIL_BYTES,Wo as MAX_RETAINED_TERMINAL_AGENTS,Gq as MAX_RETAINED_TERMINAL_MONITORS,Kq as MAX_RETAINED_TERMINAL_SHELLS,Mq as MAX_RETAINED_TERMINAL_WORKFLOWS,Fi as MAX_SNAPSHOTS,Kn as MAX_TEAMMATES,nl as MAX_TRANSCRIPT_MESSAGES,vh as MAX_USER_PROMPT_EXPANSION_ADDITIONAL_CONTEXT_LENGTH,Ep as MCPDiscoveryState,Ap as MCPOAuthProvider,wp as MCPOAuthTokenStorage,ls as MCPServerConfig,Dp as MCPServerStatus,nq as MCP_BUDGET_REARM_FRACTION,mq as MCP_BUDGET_WARN_FRACTION,Bp as MCP_DEFAULT_TIMEOUT_MSEC,Ma as MEDIA_FILE_PATTERNS,Ga as MEMORY_SECTION_HEADER,wu as MOCK_TOOL_GET_CONFIRMATION_DETAILS,vu as MOCK_TOOL_GET_DEFAULT_PERMISSION,sf as MODEL_GENERATION_CONFIG_FIELDS,la as MUTATOR_KINDS,qg as MatildaOAuth2Client,rg as MatildaOAuth2Event,lg as MatildaOAuthPollError,jq as McpBudgetWouldExceedError,Fp as McpClient,qq as McpClientManager,kq as McpServerSpawnFailedError,Fs as McpTransportPool,oe as MemoryDreamEvent,ne as MemoryExtractEvent,lp as MemoryManager,nb as MemoryMetricType,pe as MemoryRecallEvent,Hr as MessageBus,jk as MessageBusType,As as MessageSenderType,yu as MockModifiableTool,xu as MockModifiableToolInvocation,uu as MockTool,vf as ModelRegistry,ce as ModelSlashCommandEvent,wf as ModelsConfig,Iq as MonitorRegistry,Pt as NativeLspClient,Qt as NativeLspService,Sd as NextSpeakerCheckEvent,Gh as NotificationType,zp as OAUTH_AUTH_URL_EVENT,yp as OAUTH_DISPLAY_MESSAGE_EVENT,xp as OAuthUtils,Ts as OPENROUTER_BASE_URL,Ss as OPENROUTER_ENV_KEY,kf as OUTPUT_TOKEN_SAFETY_MARGIN,re as OpenAILogger,Cm as OpenDiffRequestSchema,uq as OutputFormat,_t as OverlayFs,w as PATH_ARG_KEYS,gq as POOLED_TRANSPORTS_DEFAULT,Js as PROVIDER_METADATA_NS,Oa as PYTHON_EXCLUDES,mb as PerformanceMetricType,Cq as PermissionManager,Ih as PermissionMode,Fh as PermissionRequestHookOutput,Lh as PostCompactTrigger,Dh as PostToolBatchHookOutput,Bh as PostToolUseFailureHookOutput,Ah as PostToolUseHookOutput,Kh as PreCompactTrigger,zh as PreToolUseHookOutput,le as PromptSuggestionEvent,ft as ProviderInstallError,zo as RECIPROCAL_CALLER,Yq as REDACTED_URL_CREDENTIAL,Jf as REPORTED_ATTEMPT_PURPOSES,Hf as REPORTED_ATTEMPT_PURPOSE_HEADER,If as REPORTED_OPERATION_HEADER_NAMES,Gf as REPORTED_OPERATION_ID_HEADER,qf as RUNTIME_SNAPSHOT_PREFIX,Ki as RUNTIME_STATUS_SCHEMA_VERSION,Dd as ReadFileTool,Mf as ReportedOperationTracker,Wr as RipGrepTool,Qd as RipgrepFallbackEvent,ue as RuntimeDiagnosticsCollector,Al as SAFE_TOOL_ALLOWLIST,Vi as SESSION_TITLE_MAX_LENGTH,v as SHELL_SPECIAL_CHARS,Qk as SHELL_TOOL_NAMES,hp as SKILL_REVIEW_TASK_TYPE,Xh as STOP_HOOK_BLOCK_CAP_ENV,Wt as SUGGESTION_PROMPT,Xf as SUPPORTED_IMAGE_MIME_TYPES,It as SYMBOL_KIND_LABELS,Pa as SYSTEM_FILE_EXCLUDES,Bj as SYSTEM_REMINDER_CLOSE,Aj as SYSTEM_REMINDER_OPEN,ca as SchemaValidator,up as SdkControlClientTransport,Qb as SemanticAttributes,np as SendMessageType,Jh as SessionEndReason,Wi as SessionService,Hh as SessionStartSource,wr as SettingScope,gm as ShellExecutionService,Aq as SkillActivationRegistry,xq as SkillError,ee as SkillLaunchEvent,Bq as SkillManager,Ud as SlashCommandStatus,sj as SleepInhibitor,N as SpanStatusCode,me as SpeculationEvent,nm as StandardFileSystemService,Gd as StartSessionEvent,Eh as StopHookOutput,K as Storage,Tj as StreamEventType,bn as SubagentError,cn as SubagentErrorCode,Eq as SubagentManager,Dq as SubagentValidator,Nn as TASKS_DIR,Qn as TEAMMATE_COLORS,Mn as TEAMS_DIR,On as TEAM_CONFIG_FILENAME,ri as TERMINAL_CSI_REGEX,qi as TERMINAL_OSC_REGEX,si as TERMINAL_SHIFT_DCS_REGEX,bt as THIRD_PARTY_PROVIDERS,Pk as TOOL_NAME_ALIASES,jt as TOOL_USE_SUMMARY_SYSTEM_PROMPT,Go as TaskOwnershipError,Sn as TeamEventEmitter,Rn as TeamEventType,Ro as TeamManager,_e as TelemetryTarget,Wf as TextTokenizer,yn as TmuxBackend,Kd as ToolCallEvent,ja as ToolConfirmationOutcome,Aa as ToolDisplayNames,Ca as ToolDisplayNamesMigration,ba as ToolErrorType,ob as ToolExecutionPhase,za as ToolNames,Ba as ToolNamesMigration,$d as ToolOutputTruncatedEvent,sq as ToolRegistry,es as TrustGateError,ij as Turn,ld as USER_AUTO_MEMORY_DIRNAME,oa as UiTelemetryService,p as UnauthorizedError,ge as UserFeedbackEvent,fe as UserFeedbackRating,Id as UserPromptEvent,Ch as UserPromptExpansionHookOutput,Jd as UserRetryEvent,M as ValueType,ln as WORKTREES_DIR,en as WORKTREE_BRANCH_PREFIX,gn as WORKTREE_SESSION_FILE,Nq as WorkflowRunRegistry,tn as WorkspaceContext,Gs as WorkspaceMcpBudget,wt as WorkspaceMemoryFileTooLargeError,ut as WorkspaceMemoryWriteTimeoutError,jh as __resetActiveGoalStoreForTests,ai as _recoverObjectsFromLine,Gm as _resetCachedIdeServerHost,ei as _resetEnsuredDirsCacheForTest,Vr as _resetRipGrepCachesForTest,u as _resetValidatePathCacheForTest,Sh as abortGoalForStopHookCap,eu as abortSpeculation,du as acceptSpeculation,uj as acquireSleepInhibitor,ch as activeGoalEquals,Ie as addDaemonRequestAttribute,Hp as addMCPStatusChangeListener,Wb as addModelOutputAttributes,Ub as addSystemPromptAttributes,Xb as addToolInputAttributes,Yb as addToolResultAttributes,Vb as addToolSchemaAttributes,Tb as addUserPromptAttributes,rt as aggregateUsage,Rl as allowEditorTypeInSandbox,Sg as appendToLastTextPart,Fl as applyAutoModeDecision,gt as applyProviderInstallPlan,zj as applySkillAllowedTools,ts as approxBase64Bytes,Ao as assertValidTaskId,fo as assignTeammateColor,W as atomicWriteFile,Z as atomicWriteFileSync,X as atomicWriteJSON,Lo as blockTask,Gj as buildAddedMcpToolsReminder,Jj as buildAddedSkillsReminder,Xi as buildApiHistoryFromConversation,Ij as buildAvailableSkillsReminder,Xo as buildBackgroundEntryLabel,su as buildBtwCacheSafeParams,ru as buildBtwPrompt,Fj as buildDeferredToolsReminder,Hn as buildFallbackApproachSummary,Yk as buildHumanReadableRuleLabel,Ks as buildInstallPlan,Hj as buildMcpServerInstructionsReminder,sp as buildMissedCronNotification,Dg as buildModelIdContext,el as buildPermissionCheckContext,Xk as buildPermissionRules,Rs as buildProviderTemplate,Sf as buildReportedOperationHeaders,Gk as buildShellExecWarnings,yj as buildSkillLlmContent,Kj as buildStartupContextReminder,Qo as buildTeammatePromptAddendum,vg as cacheMatildaCredentials,eq as canUseRipgrep,Le as captureDaemonTelemetryContext,Nk as checkArgumentSafety,Hk as checkCommandPermissions,fr as checkForExtensionUpdate,Ql as checkHasEditorType,cr as checkNpmUpdate,Mo as claimTask,vs as clampInlineMediaPart,lf as clampOutputToContextWindow,ko as classifyShutdownResponse,mt as cleanSummary,Au as cleanupTmpDir,fh as clearActiveGoal,xo as clearAllInboxes,od as clearAutoMemoryRootCache,bp as clearCacheSafeParams,wg as clearCachedCredentialFile,lh as clearGoalTerminalObserver,wo as clearInbox,uc as clearMatildaCorrelationHashes,Af as clearMatildaCredentials,Ni as clearRuntimeStatus,go as clearTeammateColors,mu as clearWelcomeBackState,Zr as clearWorktreeSession,Nr as cliSource,dr as cloneFromGit,tp as collectMemoryDiagnostics,Pj as collectToolCallIdsFromHistory,Ll as commandExists,Vj as compactPendingUserContentToBudget,Uj as compactTextMiddle,Ls as computeModelListVersion,rj as computeThresholds,$i as computeUniqueBranchTitle,Rr as computedSource,Rp as connectAndDiscover,Xp as connectToMcpServer,hq as connectionIdOf,vo as consumeUnread,lr as convertClaudeAgentConfig,nr as convertClaudePluginPackage,mr as convertClaudeToMatildaConfig,bm as convertColorToHex,Jm as convertToFunctionResponse,jr as convertTomlToMarkdown,zr as copyExtension,cb as countFileLines,ii as countLines,$r as crawlCache,Bg as createContentGenerator,Ag as createContentGeneratorConfig,Pe as createDaemonBridgeTelemetry,U as createDebugLogger,dk as createDefaultAutoMemoryExtractCursor,ek as createDefaultAutoMemoryIndex,ck as createDefaultAutoMemoryMetadata,ql as createDenialState,Vt as createFollowupController,cp as createForkedChat,Th as createGoalStopHookCallback,xh as createHookOutput,Gr as createInstructionsLoadedCallback,Cp as createStreamableHttpCompatibilityFetch,Eo as createTask,no as createTeamFile,zu as createTmpDir,it as createToolUseSummaryMessage,Yp as createTransport,$s as customProvider,$a as decodeBufferWithEncodingInfo,Cs as decodeTagName,Rj as dedupeToolCallsById,Vs as deepseekProvider,Qr as defaultSource,Io as deleteTask,po as deleteTeamDirs,Ii as deserializeSnapshots,_a as detectBOM,Dn as detectBackend,Dk as detectCommandSubstitution,Ya as detectEncodingFromBuffer,eb as detectFileEncoding,ib as detectFileType,pm as detectIdeFromEnv,lm as detectLineEnding,Tf as detectRuntime,Nh as detectTodoChanges,Pp as discoverMcpTools,Up as discoverPrompts,Sp as discoverTools,ro as disposeInboxLocks,rk as doesToolInvocationMatch,gr as downloadFromGitHubRelease,br as downloadFromNpmRegistry,Ml as editorCommands,Ke as emitDaemonLog,ys as encodeInsightErrorMessage,ws as encodeInsightProgressMessage,xs as encodeInsightReadyMessage,Bs as encodeTagName,mm as encodeTextFileContent,lc as endHookSpan,$b as endInteractionSpan,cc as endLLMRequestSpan,oc as endSubagentSpan,jc as endToolBlockedOnUserSpan,hc as endToolExecutionSpan,fc as endToolSpan,fk as ensureAutoMemoryScaffold,km as ensureCrlfLineEndings,dq as ensureMacBinarySigned,cq as ensureRipgrepHealthy,fu as ensureToolResultPairing,hk as ensureUserAutoMemoryScaffold,Of as enterReportedOperationContext,Sr as envLayer,B as escapePath,uk as escapeShellArg,Jl as evaluateAutoMode,il as evaluatePermissionFlow,fl as evaluatePermissionRules,$t as evaluateToolCall,Ik as execCommand,Es as executeToolCall,ji as exists,y as expandHomeDir,Oe as extractDaemonTraceContext,Sa as extractExtensionsFromPatterns,ir as extractFile,Qi as extractJsonStringField,Si as extractLastJsonStringField,Ri as extractLastJsonStringFields,ol as extractShellOperations,Im as extractToolFilePaths,yi as fetchGitDiff,zi as fetchGitDiffHunks,kb as fileExists,hu as filter,li as findGitRoot,io as findMemberById,jo as findMemberByName,dt as findProviderByCredentials,ct as findProviderById,hr as findReleaseAsset,ok as fireNotificationHook,pk as firePermissionRequestHook,nk as firePostToolUseFailureHook,mk as firePostToolUseHook,lk as firePreToolUseHook,Rg as flatMapTextParts,zc as forceFlushMetrics,co as formatAgentId,Il as formatClassifierBlockMessage,Cj as formatDateForContext,rl as formatDenialStateLog,In as formatLineStats,cm as formatMemoryUsage,_h as formatStopHookBlockingCapWarning,P as formatTraceparent,Wn as forwardApproval,pn as generateAgentWorktreeSlug,ig as generateCodeChallenge,hg as generateCodeVerifier,_s as generateCustomEnvKey,jg as generatePKCEPair,Xt as generatePromptSuggestion,ht as generateSessionRecap,kk as generateToolUseId,kt as generateToolUseSummary,eo as generateUniqueTeammateName,Fd as generateValidName,dh as getActiveGoal,pc as getActiveInteractionSpan,Tm as getAgentName,Po as getAgentStatuses,Ja as getAllGeminiMdFilenames,Mp as getAllMCPServerStatuses,et as getAllProviderBaseUrls,pj as getArenaSystemReminder,ud as getAutoMemoryConsolidationLockPath,td as getAutoMemoryExtractCursorPath,xd as getAutoMemoryFilePath,rd as getAutoMemoryIndexPath,sd as getAutoMemoryMetadataPath,pd as getAutoMemoryProjectStateDir,nd as getAutoMemoryRoot,vd as getAutoMemoryTopicFilename,wd as getAutoMemoryTopicPath,Hl as getAutoModePermissionDeniedReason,aq as getBuiltinRipgrep,ap as getCacheSafeParams,Va as getCachedEncodingForBuffer,wk as getCommandRoot,xk as getCommandRoots,mj as getCompressionPrompt,lj as getCoreSystemPrompt,Ia as getCurrentGeminiMdFilename,kj as getCustomSystemPrompt,Ms as getDefaultBaseUrlForProtocol,Os as getDefaultModelIds,Tl as getDiffCommand,Dj as getDirectoryContextString,Nl as getEditorExecutable,kl as getEffectivePermissionForConfirmation,ur as getEnvContents,Ej as getEnvironmentContext,c as getErrorMessage,d as getErrorStatus,e as getErrorType,Ar as getExtensionId,Pl as getExternalEditorCommand,Yt as getFilterReason,xj as getFolderStructure,Vg as getFunctionCalls,Xg as getFunctionCallsAsJson,Wg as getFunctionCallsFromParts,Yg as getFunctionCallsFromPartsAsJson,mi as getGitBranch,ni as getGitRepoName,uh as getHookKey,xt as getIdeInstaller,Hm as getIdeServerHost,so as getInboxPath,$n as getInboxesDir,Lj as getInitialChatHistory,qj as getInsightPrompt,nh as getLastGoalTerminal,Un as getLeader,Np as getMCPDiscoveryState,Tt as getMCPServerPrompts,Lp as getMCPServerStatus,bg as getMatildaAuthBaseUrl,Bf as getMatildaAuthStatus,tc as getMatildaCorrelationHashes,xf as getMatildaCredentialsPath,tg as getMatildaOAuthClient,ss as getMaxInlineMediaBytes,md as getMemoryBaseDir,Hq as getMonitorOutputPath,Uf as getOrCreateSharedDispatcher,oj as getPlanModeSystemReminder,D as getProjectHash,nu as getProjectSummaryInfo,nj as getProjectSummaryPrompt,Kg as getRateLimitErrorDetails,Lg as getRateLimitRetryDelayMs,oi as getRecentGitStatus,Lf as getReportedOperationContext,Qg as getResponseText,Ug as getResponseTextFromParts,Zi as getResumePromptTokenCount,_i as getResumeTokenCounts,Wk as getRuleDisplayName,tr as getScopedEnvContents,fm as getShellAbortReasonKind,sk as getShellConfiguration,fb as getSpecificMimeType,Sk as getSpecifierKind,Mj as getStartupContextLength,Zg as getStructuredResponse,_g as getStructuredResponseFromParts,Zf as getSupportedImageFormatsString,Wa as getSystemEncoding,Fo as getTask,Bo as getTaskPath,ao as getTasksDir,Zn as getTeamDir,_n as getTeamFilePath,Um as getTeamName,Ym as getTeammateColor,Rm as getTeammateContext,Yn as getTeamsRootDir,fj as getThoughtText,qt as getTimeRangeBounds,O as getTraceContext,_f as getUnsupportedImageFormatWarning,zd as getUserAutoMemoryIndexPath,yd as getUserAutoMemoryRoot,Ad as getUserAutoMemoryTopicPath,Df as getValidMatildaAccessToken,ku as getWelcomeBackState,mp as globalMemoryManager,ia as hasCycleInSchema,nf as hasExplicitOutputLimit,Wp as hasNetworkTransport,Ak as hasNonFinalTopLevelBackgroundOperator,Fk as hasShellSubstitution,Ck as hasUnsafeMonitorBackgroundOperator,De as hashDaemonWorkspace,Rt as hashMcpServerConfig,Br as hashValue,Er as hookEventSupportsMatcher,Uq as hydrateString,vm as ideContextStore,Qe as initializeDaemonMetrics,wc as initializeTelemetry,Ne as injectDaemonTraceContext,gl as injectPermissionRulesIfMissing,Vp as invokeMcpPrompt,b as isAbortError,Cd as isAnyAutoMemPath,Eg as isApiError,yl as isApproveOutcome,ml as isAutoEditApproved,qd as isAutoMemPath,tt as isBareMode,Yl as isBinary,hb as isBinaryFile,dg as isBrowserCommandBlocked,pr as isClaudePluginConfig,Lk as isCommandAllowed,Kk as isCommandAvailable,Mk as isCommandNeedsPermission,Q as isDebugLoggingDegraded,sl as isDenialFallbackReason,mg as isDeviceAuthorizationSuccess,og as isDeviceTokenPending,ng as isDeviceTokenSuccess,Sl as isEditorAvailable,Zp as isEnabled,pg as isErrorResponse,ks as isGatedMcpScope,Hg as isGenericQuotaExceededError,ki as isGitRepository,Sm as isInProcessTeammate,Bl as isInSafeToolAllowlist,$j as isInvalidArgumentError,Ig as isMatildaQuotaExceededError,Vl as isModifiableDeclarativeTool,a as isNodeError,un as isPathWithinRoot,Jb as isPerformanceMonitoringActive,ll as isPlanModeBlocked,Gg as isProQuotaExceededError,Jg as isRateLimitError,Kf as isReportedOperationHeaderName,te as isRuntimeDiagnosticsEnabled,_j as isSchemaDepthError,$q as isScopedNpmPackage,ms as isSdkMcpServerConfig,xa as isSettledStatus,Fg as isStructuredError,F as isSubpath,G as isSubpaths,wa as isSuccessStatus,Yf as isSupportedImageMimeType,Nj as isSystemReminderContent,Xm as isTeamLead,Wm as isTeammate,vc as isTelemetrySdkInitialized,Ol as isTerminalEditor,va as isTerminalStatus,kr as isTomlFormat,ha as isTool,qk as isToolEnabled,Mg as isTransientCapacityError,Ng as isUnattendedMode,Bd as isUserAutoMemPath,Kl as isValidEditorType,Wj as isValidNonThoughtTextPart,tk as isWindows,gb as isWithinRoot,Oh as judgeGoal,of as knownTokenLimit,Tr as layer,Tp as listMcpPrompts,Jo as listTasks,qo as listTeamNames,as as loadIgnoreRules,Kr as loadServerHierarchicalMemory,pt as loadUsageHistory,Jc as logApiCancel,Ic as logApiError,Fc as logApiRequest,Kc as logApiResponse,$c as logArenaAgentCompleted,ad as logArenaSessionEnded,_c as logArenaSessionStarted,Xc as logAuth,Pc as logChatCompression,Oc as logConversationFinishedEvent,Wc as logExtensionDisable,Vc as logExtensionEnable,Sc as logExtensionInstallEvent,Tc as logExtensionUninstall,Uc as logExtensionUpdateEvent,Gc as logFlashFallback,Nc as logIdeConnection,Qc as logKittySequenceOverflow,ed as logMemoryDream,dd as logMemoryExtract,fd as logMemoryRecall,Rc as logModelSlashCommand,Lc as logNextSpeakerCheck,bd as logPromptSuggestion,Hc as logRipgrepFallback,Yc as logSkillLaunch,Mc as logSlashCommand,cd as logSpeculation,Ac as logStartSession,Dc as logToolCall,Ec as logToolOutputTruncated,Zc as logUserFeedback,Bc as logUserPrompt,Cc as logUserRetry,cg as loginToMatilda,Ff as loginToMatildaWithBrowser,Cf as logoutMatilda,ie as makeArenaAgentCompletedEvent,je as makeArenaSessionEndedEvent,he as makeArenaSessionStartedEvent,Vd as makeChatCompressionEvent,tu as makeFakeConfig,A as makeRelative,Td as makeSlashCommandEvent,_k as matchesCommandPattern,bl as matchesDomainPattern,cl as matchesMcpPattern,al as matchesPathPattern,dl as matchesRule,sg as matildaOAuth2Events,ag as matildaProvider,rr as maybePromptForSettings,Gp as mcpServerRequiresOAuth,pq as mcpTransportOf,or as mergeClaudeConfigs,ot as metricsToUsageRecord,Ws as minimaxProvider,Pr as modelProvidersSource,uf as modelRegistryKey,Ys as modelscopeProvider,Wl as modifyWithEditor,jl as needsConfirmation,im as needsUtf8Bom,mf as normalize,Zl as normalizeContent,Qj as normalizeModelToolCallIds,Bk as normalizeMonitorCommand,Ir as normalizeProxyUrl,yq as normalizeSkillPriority,Yh as normalizeStopHookBlockingCap,mh as notifyGoalTerminal,Do as notifyTasksUpdated,Co as onTasksUpdated,fg as openBrowserSecurely,Ul as openDiff,Us as openRouterProvider,se as openaiLogger,us as oversizedMediaPlaceholder,vq as parse,$h as parseAndFormatApiError,ye as parseBooleanEnvFlag,iq as parseConnectionId,Di as parseDeletedFromNameStatus,Bi as parseGitDiff,er as parseGitHubRepoForReleases,Ai as parseGitNumstat,zs as parseInsightMessage,St as parseInstallSource,bi as parseLineTolerant,_q as parseNpmPackageSource,Uk as parseRule,Vk as parseRules,Ci as parseShortstat,ze as parseTelemetryTargetValue,ej as parseThought,qs as partListUnionToString,Pg as partToString,El as passesAcceptEditsFastPath,Xq as performVariableReplacement,hl as persistPermissionOutcome,nt as persistSessionUsage,Qp as populateMcpServerCommand,Tg as prependToFirstTextPart,jb as processSingleFileContent,sr as promptForSetting,dm as promptIdContext,Qs as providerMatchesCredentials,di as read,gk as readAutoMemoryIndex,bb as readFileWithEncoding,ab as readFileWithEncodingInfo,db as readFileWithLineAndLimit,to as readInbox,Ti as readLastJsonStringFieldSync,Ui as readLastJsonStringFieldsSync,ci as readLines,ou as readManyFiles,yf as readMatildaCredentials,ju as readPathFromWorkspace,Mi as readRuntimeStatus,lo as readTeamFile,ik as readUserAutoMemoryIndex,Xr as readWorktreeSession,jn as readWorktreeSessionMarker,tl as recordAllow,tb as recordApiErrorMetrics,Fb as recordApiRequestBreakdown,sb as recordApiResponseMetrics,yb as recordApiRetry,Lb as recordArenaAgentCompletedMetrics,Mb as recordArenaSessionEndedMetrics,Kb as recordArenaSessionStartedMetrics,Ib as recordBaselineComparison,ul as recordBlock,wb as recordContentRetry,xb as recordContentRetryFailure,Bb as recordCpuUsage,Xe as recordDaemonBridgeError,Ye as recordDaemonCancel,Ue as recordDaemonChannelLifecycle,Je as recordDaemonError,Se as recordDaemonHttpRequest,He as recordDaemonHttpResponse,We as recordDaemonPromptDuration,Ve as recordDaemonPromptQueueWait,Te as recordDaemonSessionLifecycle,xl as recordFallbackApprove,ub as recordFileOperationMetric,gh as recordGoalIteration,vb as recordInvalidChunk,Ob as recordMemoryDreamMetrics,Nb as recordMemoryExtractMetrics,Pb as recordMemoryRecallMetrics,Ab as recordMemoryUsage,Hb as recordPerformanceRegression,Gb as recordPerformanceScore,ah as recordStartupEvent,zb as recordStartupPerformance,Eb as recordTokenEfficiency,rb as recordTokenUsageMetrics,qb as recordToolCallMetrics,Db as recordToolExecutionBreakdown,Cb as recordToolQueueDepth,vl as recordUnavailable,Vq as recursivelyHydrateStrings,Vf as redactProxyCredentials,Sj as redactStructuredOutputArgsForRecording,Zq as redactUrlCredentials,Ef as refreshMatildaCredentials,xc as refreshSessionContext,Re as registerDaemonGaugeCallbacks,Vh as registerGoalHook,Tn as registerLeader,No as releaseOwnedTask,Kp as removeMCPServerStatus,Ip as removeMCPStatusChangeListener,V as renameWithRetry,Y as renameWithRetrySync,Yj as repairOrphanedToolUseTurns,Yi as replayUiTelemetryFromConversation,Ze as reportCliClientEvent,op as reportedAttemptPurposeForSendMessageType,R as resetDebugLoggingState,zl as resetDenialState,Ua as resetEncodingCache,Ko as resetTaskList,jm as resetUtf8BomCache,Vm as resolveActiveTeamName,J as resolveAndValidatePath,Ns as resolveBaseUrl,$p as resolveBundleDir,Jk as resolveCommandPath,yg as resolveContentGeneratorConfigWithSources,Lr as resolveField,Ei as resolveGitDir,ih as resolveGoalLifecycleStatus,Uo as resolveMaxConcurrentBackgroundAgents,Is as resolveMetadataKey,Ur as resolveModelConfig,Cg as resolveModelId,ar as resolveNpmRegistry,qe as resolveOpenAILogDir,Mr as resolveOptionalField,Hs as resolveOwnsModel,H as resolvePath,jj as resolvePathFromEnv,$k as resolvePathPattern,bq as resolveRipgrep,Zh as resolveStopHookBlockingCap,Ae as resolveTelemetrySettings,Rk as resolveToolName,_r as restoreWorktreeContext,Og as retryWithBackoff,au as rewritePathArgs,Qf as runAsyncGeneratorWithReportedOperationContext,ep as runForkedAgent,nc as runInSubagentSpanContext,ec as runInToolSpanContext,fq as runRipgrep,pi as runSideQuery,Me as runWithDaemonTelemetryContext,T as runWithDebugLogSession,dp as runWithForkedChatModel,Pf as runWithReportedAttemptPurpose,Nf as runWithReportedOperationContext,Zm as runWithTeammateIdentity,ve as runtimeDiagnostics,sa as safeAgentId,Xl as safeLiteralReplace,E as sanitizeCwd,Rb as sanitizeHookName,bo as sanitizeName,bj as sanitizeTitle,cj as sanitizeToolCallResultForRecording,wh as sanitizeUserPromptExpansionAdditionalContext,$o as saveCacheSafeParams,lu as saveWelcomeBackRestartChoice,yo as sendStructuredMessage,Hi as serializeSnapshot,am as serializeTerminalToObject,_l as serializeTerminalToText,em as sessionIdContext,eh as setActiveGoal,S as setDebugLogSession,Ha as setGeminiMdFilename,kh as setGoalTerminalObserver,oh as setLastGoalTerminal,Op as setMCPDiscoveryState,sc as setMatildaCorrelationHashes,ho as setMemberActive,$g as setStartupEventSink,Or as settingsSource,z as shortenPath,eg as shouldAttemptBrowserLaunch,Ok as shouldDefaultToNodePty,wl as shouldFallback,Zt as shouldFilterSuggestion,Gl as shouldFirePermissionDeniedForAutoMode,Dl as shouldForceAutoModeReviewForAllow,gg as shouldLaunchBrowser,Cl as shouldRunAutoModeForCall,Ps as shouldShowStep,yc as shutdownTelemetry,tj as sleepInhibitor,vk as splitCommands,Zk as splitCompoundCommand,zq as splitConditionalSkills,kc as startHookSpan,_b as startInteractionSpan,bc as startLLMRequestSpan,cu as startSpeculation,mc as startSubagentSpan,ic as startToolBlockedOnUserSpan,gc as startToolExecutionSpan,dc as startToolSpan,pp as startsReportedOperation,wq as stringify,rf as stripRuntimeSnapshotPrefix,yk as stripShellWrapper,Oj as stripStartupContext,ti as stripTerminalControlSequences,zk as stripTrailingBackgroundAmp,pu as subagentGenerator,Wq as substituteHookVariables,xe as summarizeAnthropicWireRequest,we as summarizeOpenAIWireRequest,Gn as summarizeUnifiedDiff,Qm as teammateIdentityStore,Om as templateString,x as tildeifyPath,r as toFriendlyError,pf as tokenLimit,Tk as toolMatchesRuleToolName,Sb as truncateContent,lt as truncateJson,Zb as truncateSpanError,aj as tryGenerateSessionTitle,oo as tryReclaimStaleTeam,pa as uiTelemetryService,Oo as unassignTeammateTasks,Pi as unescapeJsonString,C as unescapePath,Uh as unregisterGoalHook,Vn as unregisterLeader,hh as updateActiveGoalStatus,Jp as updateMCPServerStatus,vr as updateSetting,L as updateSymlink,Ho as updateTask,zg as validateModelConfig,Cr as validateName,I as validatePath,Tq as validateVariables,Xa as windowsCodePageToEncoding,Ge as withDaemonBridgeSpan,Fe as withDaemonRequestSpan,Ee as withDaemonSpan,ac as withInteractionSpan,Rf as withReportedAttemptPurpose,fn as worktreeBranchForSlug,Xn as wrapConfirmWithBadge,hi as write,fi as writeLine,gi as writeLineSync,zf as writeMatildaCredentials,uo as writeMessage,Li as writeRuntimeStatus,mo as writeTeamFile,vt as writeWorkspaceContextFile,Yr as writeWorktreeSession,hn as writeWorktreeSessionMarker,Xs as zaiProvider};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as V}from"./chunk-I55PXD4N.js";import{Kd as D,Ld as q,Ob as B,de as P,ee as p,ja as F,ke as G,le as H,oe as K}from"./chunk-RO6LKQPB.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-KP6BLFQS.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-XXZH7C44.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-GTR4V2PV.js";import"./chunk-S4K76QPI.js";import"./chunk-CYTN3WRM.js";import"./chunk-4F4DA5UI.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import{Lb as j,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 k}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-LLQVLTPB.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.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"),v=class extends ${constructor(n,t){super(t);this.config=n}toolLocations(){return[{path:this.params.file_path}]}getDescription(){let n=C(this.params.file_path,this.config.getTargetDir());return`Writing to ${w(n)}`}async getDefaultPermission(){let n=this.config.getProjectRoot();return k(g.resolve(this.params.file_path),n)?"allow":"ask"}async getConfirmationDetails(n){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 a=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(a)}`,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(n){let{file_path:t,content:o,ai_proposed_content:a,modified_by_user:c}=this.params,s=await h(t),m="",i=!1,E,R,z=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 r={message:_(e),code:f(e)?e.code:void 0},l=r.code?`Error checking existing file '${t}': ${r.message} (${r.code})`:`Error checking existing file: ${r.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===G.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(z,{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),r=m,l=F(e,r,o,"Original","Written",D),J=q(e,r,a||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 Q=L(t),X=N(t),Z=g.extname(t),ee=s?"update":"create",te=o.split(`
|
|
4
|
-
`).length;j(this.config,new U(b.Name,ee,te,Q,Z,X));let ie={fileDiff:l,fileName:e,originalContent:m,newContent:o,diffStat:J};try{let d=await V(this.config,t);d&&T.push(`
|
|
5
|
-
|
|
6
|
-
${d}`)}catch{}return{llmContent:T.join(" "),returnDisplay:ie}}catch(e){let r,l="file_write_failure";return f(e)?(r=`Error writing to file '${t}': ${e.message} (${e.code})`,e.code==="EACCES"?(r=`Permission denied writing to file: ${t} (${e.code})`,l="permission_denied"):e.code==="ENOSPC"?(r=`No space left on device: ${t} (${e.code})`,l="no_space_left"):e.code==="EISDIR"&&(r=`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?r=`Error writing to file: ${e.message}`:r=`Error writing to file: ${String(e)}`,{llmContent:r,returnDisplay:r,error:{message:r,type:l}}}}},b=class S extends W{constructor(n){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=n}static Name=O.WRITE_FILE;validateToolParamValues(n){let t=I(n.file_path.trim());if(n.file_path=t,!t)return'Missing or empty "file_path"';if(!g.isAbsolute(t))return`File path must be absolute: ${t}`;try{if(y.existsSync(t)&&y.lstatSync(t).isDirectory())return`Path is a directory, not a file: ${t}`}catch(o){return`Error accessing path properties for validation: ${t}. Reason: ${o instanceof Error?o.message:String(o)}`}return null}createInvocation(n){return new v(this.config,n)}toAutoClassifierInput(n){let t=n.content??"";return{file_path:n.file_path,byte_count:Buffer.byteLength(t,"utf8"),content_preview:t.slice(0,300),content_truncated:t.length>300}}getModifyContext(n){return{getFilePath:t=>t.file_path,getCurrentContent:async t=>{if(await h(t.file_path))try{let{content:a}=await this.config.getFileSystemService().readTextFile({path:t.file_path});return a}catch(a){if(!f(a)||a.code!=="ENOENT")throw a;return""}else return""},getProposedContent:async t=>t.content,createUpdatedParams:(t,o,a)=>{let c=a.content;return{...a,ai_proposed_content:c,content:o,modified_by_user:!0}}}}};export{b as WriteFileTool};
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2025 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
11
|
-
*/
|