@maincode-ai/matilda-code 0.21.3 → 0.21.4-nightly.20260906.7e39d84e0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/agent-TPP7RVJI.js +3 -0
- package/chunks/agent-headless-6YGQNK5D.js +3 -0
- package/chunks/{anthropicContentGenerator-EFVV6ZTA.js → anthropicContentGenerator-OPPJPVDU.js} +1 -1
- package/chunks/{askUserQuestion-MFLZ7MGJ.js → askUserQuestion-A2QN7TVJ.js} +1 -1
- package/chunks/{chunk-FT76AZPN.js → chunk-2I2V4XUL.js} +1 -1
- package/chunks/{chunk-JDXISO3F.js → chunk-7YW6IUGF.js} +15 -15
- package/chunks/{chunk-5U3A6KMU.js → chunk-AEKLF65D.js} +1 -1
- package/chunks/{chunk-ZYW5GLYY.js → chunk-B5CUDYSI.js} +1 -1
- package/chunks/{chunk-FUNLOUYI.js → chunk-CENHHSEM.js} +1 -1
- package/chunks/{chunk-FU2PKCG5.js → chunk-CKIXP6AV.js} +2 -2
- package/chunks/{chunk-QLEJOI4X.js → chunk-DGVOK3TF.js} +1 -1
- package/chunks/{chunk-QCIDUZV6.js → chunk-E5TINV2P.js} +1 -1
- package/chunks/{chunk-UY2R3ZQ4.js → chunk-FSHP4T24.js} +1 -1
- package/chunks/{chunk-MNGFXISD.js → chunk-GQ2YYAZL.js} +1 -1
- package/chunks/{chunk-R3H6IWFK.js → chunk-HDKF447N.js} +1 -1
- package/chunks/{chunk-SUORCDGS.js → chunk-HT7HN5OM.js} +1 -1
- package/chunks/{chunk-EMWHQSMS.js → chunk-J3CHXXMF.js} +1 -1
- package/chunks/{chunk-DBSJNFFU.js → chunk-KA6DHH7N.js} +1 -1
- package/chunks/{chunk-QEI3OETI.js → chunk-KCXJKSZQ.js} +1 -1
- package/chunks/{chunk-6QP5C76Y.js → chunk-KLXSWVST.js} +1 -1
- package/chunks/{chunk-LQWORCPO.js → chunk-M3ORBG44.js} +1 -1
- package/chunks/{chunk-OMZ5SGMK.js → chunk-PGDQTSIQ.js} +1 -1
- package/chunks/{chunk-IOCF4XSR.js → chunk-PLMDDD2P.js} +1 -1
- package/chunks/{chunk-4R2OFVPK.js → chunk-QR3OCHRD.js} +1 -1
- package/chunks/{chunk-NDR7ZFUA.js → chunk-R24IGHRQ.js} +1 -1
- package/chunks/{chunk-7LNKXNEZ.js → chunk-TJNV45ZB.js} +465 -465
- package/chunks/{chunk-IMYUVCF7.js → chunk-UCSBOBSQ.js} +1 -1
- package/chunks/{chunk-S4K76QPI.js → chunk-V2MZCFBR.js} +1 -1
- package/chunks/{chunk-C2ZWB2NT.js → chunk-VU5XQRL6.js} +1 -1
- package/chunks/chunk-WGPRIGRF.js +14 -0
- package/chunks/{chunk-IZ6YBZWM.js → chunk-WOOIHZLE.js} +1 -1
- package/chunks/{chunk-XKDGRW3K.js → chunk-YLQBVW4X.js} +1 -1
- package/chunks/{chunk-MJEXA2MA.js → chunk-YTWIKYJZ.js} +1 -1
- package/chunks/{computer-use-MCXFHFTP.js → computer-use-ZW3DJCJF.js} +1 -1
- package/chunks/contextCommand-7WJPNUMS.js +3 -0
- package/chunks/{cron-create-JHL5JGIM.js → cron-create-5RCP4NWY.js} +1 -1
- package/chunks/{cron-delete-K2R3KI2W.js → cron-delete-SBFRG4DY.js} +1 -1
- package/chunks/{cron-list-R3YHZBHA.js → cron-list-PL23TX2P.js} +1 -1
- package/chunks/{edit-KNZAPSGJ.js → edit-UZKSFID4.js} +1 -1
- package/chunks/{enter-worktree-LJ66TFYR.js → enter-worktree-7IJ7KNDU.js} +1 -1
- package/chunks/{enterPlanMode-P6EIGU3Y.js → enterPlanMode-VFMLHBIA.js} +1 -1
- package/chunks/{exit-worktree-QVQ3TLW5.js → exit-worktree-RL6F57YT.js} +1 -1
- package/chunks/{exitPlanMode-I7SGPSG4.js → exitPlanMode-WL3DLBBP.js} +1 -1
- package/chunks/{geminiContentGenerator-SBVCQ423.js → geminiContentGenerator-7S6SZOUI.js} +1 -1
- package/chunks/{glob-F5YOX6YA.js → glob-CFOX6VFL.js} +1 -1
- package/chunks/{grep-UOIHSM5U.js → grep-AIWZ4IVB.js} +1 -1
- package/chunks/{keychain-token-storage-EAJ6RT4S.js → keychain-token-storage-6UB2PPV5.js} +1 -1
- package/chunks/{ls-4QPI2E7A.js → ls-IBFBZA4Z.js} +1 -1
- package/chunks/{lsp-P3GKBOP3.js → lsp-NSER2J4W.js} +1 -1
- package/chunks/{matildaAgentContentGenerator-EIQI4YCP.js → matildaAgentContentGenerator-AQRSR5YF.js} +1 -1
- package/chunks/{matildaContentGenerator-QMMGDPIK.js → matildaContentGenerator-GOPZOIWI.js} +1 -1
- package/chunks/{matildaOAuth2-LKOMJUC6.js → matildaOAuth2-PAVSTTZX.js} +1 -1
- package/chunks/{monitor-GDKHPTET.js → monitor-SNYFHBY2.js} +1 -1
- package/chunks/{notebook-edit-LWH7H4WX.js → notebook-edit-LKQ4A7AE.js} +1 -1
- package/chunks/{openaiContentGenerator-TNZ6SB7H.js → openaiContentGenerator-3TUXUNSH.js} +1 -1
- package/chunks/read-file-XN45MWM5.js +3 -0
- package/chunks/ripGrep-JXFQR3F3.js +3 -0
- package/chunks/{scheduler-EX674HYK.js → scheduler-Y5MLAHUF.js} +1 -1
- package/chunks/{send-message-K3T7GVHO.js → send-message-LDEJYKCJ.js} +1 -1
- package/chunks/{serve-FZ4FTA5D.js → serve-6KUJVACJ.js} +31 -31
- package/chunks/shell-CGCTGZWB.js +3 -0
- package/chunks/{skill-KSYY6BM6.js → skill-LWCTVLKB.js} +1 -1
- package/chunks/src-NXWYSLKZ.js +3 -0
- package/chunks/{symbol-search-3A66G4MP.js → symbol-search-G2EYFRRI.js} +1 -1
- package/chunks/{syntheticOutput-LLA4WQR7.js → syntheticOutput-CZD3GGPK.js} +1 -1
- package/chunks/task-create-T4SMA2CY.js +3 -0
- package/chunks/{task-list-6I64SK7E.js → task-list-2MTWQAW3.js} +1 -1
- package/chunks/{task-stop-UKRXMCZV.js → task-stop-JIMRQAPK.js} +1 -1
- package/chunks/{task-update-XZWORLJB.js → task-update-6MNKPW5Q.js} +1 -1
- package/chunks/{team-create-7PFAVYVV.js → team-create-BGCVW6C3.js} +1 -1
- package/chunks/{team-delete-DEPXAMUE.js → team-delete-7L34NVB2.js} +1 -1
- package/chunks/{todoWrite-DKJAYA4S.js → todoWrite-WZSVK5VK.js} +1 -1
- package/chunks/{tool-search-7D46IF5G.js → tool-search-K64UPG77.js} +1 -1
- package/chunks/{update-goal-EUJYH23K.js → update-goal-YNM23ENT.js} +1 -1
- package/chunks/{web-fetch-UGTFUOQN.js → web-fetch-EZTOVGZB.js} +1 -1
- package/chunks/{web-search-FURCBRRK.js → web-search-FZIMUA45.js} +1 -1
- package/chunks/{workflow-2TGFLD2R.js → workflow-7INCT45S.js} +2 -2
- package/chunks/{write-file-DQ6NYEJ7.js → write-file-Y7F2BRJJ.js} +1 -1
- package/cli.js +320 -320
- package/package.json +2 -2
- package/chunks/agent-WBKEN3MM.js +0 -3
- package/chunks/agent-headless-OJM6RWIA.js +0 -3
- package/chunks/chunk-QWBNNEV2.js +0 -14
- package/chunks/contextCommand-G4LS5GW6.js +0 -3
- package/chunks/read-file-URGJTANM.js +0 -3
- package/chunks/ripGrep-SL4ICAX6.js +0 -3
- package/chunks/shell-LLU55LCI.js +0 -3
- package/chunks/src-UXJDJ3RJ.js +0 -3
- package/chunks/task-create-ZZTSVXZN.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as c}from"./chunk-4F4DA5UI.js";import{k as i}from"./chunk-SDTWBD62.js";import{e as l}from"./chunk-
|
|
3
|
+
import{a as c}from"./chunk-4F4DA5UI.js";import{k as i}from"./chunk-SDTWBD62.js";import{e as l}from"./chunk-AEKLF65D.js";import{b as m}from"./chunk-GZPNIYVZ.js";m();import{readFile as y}from"node:fs/promises";function S(t){return t?`side-query:${t}`:"side-query"}function T(t,e){return e??t.getFastModel?.()??t.getModel()??c}function x(t){let e=t?.thinkingConfig;return{...t??{},thinkingConfig:e?{includeThoughts:!1,...e}:{includeThoughts:!1}}}async function C(t){let e=t.getOutputLanguageFilePath?.();if(e)try{let n=(await y(e,"utf8")).trim();return n?["Follow the user-visible output language preference below for this side query.",n].join(`
|
|
4
4
|
|
|
5
5
|
`):void 0}catch{return}}function h(t,e){return e?t===void 0?e:typeof t=="string"?`${t}
|
|
6
6
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{e as $,l as k,n as lt}from"./chunk-FWDMPRKU.js";import{b as c}from"./chunk-GZPNIYVZ.js";c();function G(t){return t instanceof Error&&"code"in t}function Nt(t){return!t||typeof t!="object"?!1:!!(t instanceof Error&&t.name==="AbortError"||G(t)&&t.code==="ABORT_ERR")}function $t(t){if(t instanceof Error){let e=t.cause;return e instanceof Error&&e.message!==t.message?`${t.message} (cause: ${e.message})`:t.message}try{return String(t)}catch{return"Failed to get error details"}}function Bt(t){if(typeof t!="object"||t===null)return;let e=t,n=e.status??e.statusCode??e.response?.status??e.error?.code;if(typeof n=="number"&&n>=100&&n<=599)return n;if(typeof e.message=="string"){let r=e.message.match(/HTTP_STATUS\/(\d{3})\b/);if(r){let o=Number(r[1]);if(o>=100&&o<=599)return o}}}function Ot(t){if(typeof t!="object"||t===null)return"unknown";let e=t instanceof Error&&t.constructor.name!=="Error"?t.constructor.name:void 0,n=t.type,r=e??n??(t instanceof Error?t.name:"unknown"),o=t instanceof Error?t.cause:void 0,i=o&&typeof o=="object"&&"code"in o?o.code:void 0;return i?`${r}:${i}`:r}var d=class extends Error{constructor(n,r){super(n);this.exitCode=r}},B=class extends d{constructor(e){super(e,41)}},O=class extends d{constructor(e){super(e,42)}},W=class extends d{constructor(e){super(e,44)}},E=class extends d{constructor(e){super(e,52)}},_=class extends d{constructor(e){super(e,53)}},F=class extends d{constructor(e){super(e,54)}},U=class extends d{constructor(e){super(e,55)}},H=class extends d{constructor(e){super(e,130)}},I=class extends Error{},L=class extends Error{},M=class extends Error{};function Wt(t){if(t&&typeof t=="object"&&"response"in t){let n=gt(t);if(n.error&&n.error.message&&n.error.code)switch(n.error.code){case 400:return new M(n.error.message);case 401:return new L(n.error.message);case 403:return new I(n.error.message);default:}}return t}function gt(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}c();import pt from"node:fs";import p from"node:path";import f from"node:os";import*as z from"node:crypto";var P=".matilda",Jt="google_accounts.json",b=new Map,dt=1024;function Kt(){b.clear()}var V=/[ \t()[\]{};|*?$`'"#&<>!~,]/,Xt=["file_path","path","filePath","notebook_path"],ft=(()=>{let t=V.source.slice(1,-1);return new RegExp(`\\\\([${t}])`,"g")})();function Zt(t){let e=f.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Yt(t){if(!t)return"";let e=t;return t.toLowerCase().startsWith("%userprofile%")?e=f.homedir()+t.substring(13):(t==="~"||t.startsWith("~/"))&&(e=f.homedir()+t.substring(1)),p.normalize(e)}function qt(t,e=80){if(t.length<=e)return t;let n=p.sep,r="...";if(e<10)return t.substring(0,e-3)+r;let i=p.parse(t).root,u=t.substring(i.length).split(n).filter(a=>a!=="");if(u.length===0)return i.length<=e?i:i.substring(0,e-3)+r;if(u.length===1){let a=i+u[0];if(a.length<=e)return a;let h=Math.floor((e-3)/2),x=a.substring(0,h),R=a.substring(a.length-h);return`${x}${r}${R}`}let l=i+u[0],j=[];for(let a=u.length-1;a>=1;a--){let h=u[a],x=[h,...j].join(n),R=a>1,y;if(R?y=l+n+r+n+x:y=l+n+x,y.length<=e){if(j.unshift(h),a===1)return y}else break}if(j.length===0){let a=Math.floor((e-3)/2),h=t.substring(0,a),x=t.substring(t.length-a);return`${h}${r}${x}`}return l+n+r+n+j.join(n)}function Qt(t,e){let n=p.resolve(t),r=p.resolve(e);return X(r,n)?p.relative(r,n)||".":n}function te(t){let e="";for(let n=0;n<t.length;n++){let r=t[n],o=0;for(let g=n-1;g>=0&&t[g]==="\\";g--)o++;!(o%2===1)&&V.test(r)?e+="\\"+r:e+=r}return e}function ee(t){return f.platform()==="win32"?t:t.replace(ft,"$1")}function J(t){let e=f.platform()==="win32"?t.toLowerCase():t;return z.createHash("sha256").update(e).digest("hex")}function K(t){return(f.platform()==="win32"?t.toLowerCase():t).replace(/[^a-zA-Z0-9]/g,"-")}function X(t,e){let r=f.platform()==="win32"?p.win32:p,o=r.relative(t,e);return!o.startsWith(`..${r.sep}`)&&o!==".."&&!r.isAbsolute(o)}function ne(t,e){return t.some(n=>X(n,e))}function ht(t=process.cwd(),e){let n=f.homedir();return e==="~"?n:e.startsWith("~/")?p.join(n,e.slice(2)):p.isAbsolute(e)?e:p.resolve(t,e)}function mt(t,e,n={}){let{allowFiles:r=!1,allowExternalPaths:o=!1}=n,g=t.getWorkspaceContext().isPathWithinWorkspace(e);if(!o&&!g)throw new Error("Path is not within workspace");if(o&&!g)return;let u=b.get(e);if(u===void 0){try{u=pt.statSync(e).isDirectory()}catch(l){throw G(l)&&l.code==="ENOENT"?new Error(`Path does not exist: ${e}`):l}if(b.size>=dt){let l=b.keys().next().value;l!==void 0&&b.delete(l)}b.set(e,u)}if(!r&&!u)throw new Error(`Path is not a directory: ${e}`)}function re(t,e,n={}){let r=t.getTargetDir();if(!e)return r;let o=ht(r,e);return mt(t,o,n),o}c();import*as s from"node:path";import*as m from"node:os";import*as S from"node:fs";import{AsyncLocalStorage as Dt}from"node:async_hooks";var xt="google_accounts.json",bt="oauth_creds.json",Et=[".matilda",".agents"],Z="tmp",Pt="bin",wt="projects",vt="ide",jt="plans",yt="debug",St="arena",D=class t{targetDir;pinnedRuntimeBaseDir;static runtimeBaseDir=null;static runtimeBaseDirContext=new Dt;constructor(e,n){this.targetDir=e,this.pinnedRuntimeBaseDir=n?t.resolvePath(n):void 0}getRuntimeBaseDir(){return this.pinnedRuntimeBaseDir??t.getRuntimeBaseDir()}static resolvePath(e,n){let r=e;if(r==="~"||r.startsWith("~/")||r.startsWith("~\\")){let o=r==="~"?[]:r.slice(2).split(/[/\\]+/).filter(Boolean);r=s.join(m.homedir(),...o)}return s.isAbsolute(r)||(r=n?s.resolve(n,r):s.resolve(r)),r}static sanitizePlanSessionId(e){return s.basename(e.replace(/\\/g,"/")).replace(/^\.+/g,"_").replace(/[<>:"|?*\x00-\x1F]/g,"_")||"_"}static resolveRuntimeBaseDir(e,n){return e?t.resolvePath(e,n):null}static setRuntimeBaseDir(e,n){t.runtimeBaseDir=t.resolveRuntimeBaseDir(e,n)}static runWithRuntimeBaseDir(e,n,r){let o=t.resolveRuntimeBaseDir(e,n);return t.runtimeBaseDirContext.run(o,r)}static getRuntimeBaseDir(){let e=process.env.MATILDA_RUNTIME_DIR;if(e)return t.resolveRuntimeBaseDir(e)??t.getGlobalMatildaDir();let n=t.runtimeBaseDirContext.getStore();return n!==void 0?n??t.getGlobalMatildaDir():t.runtimeBaseDir?t.runtimeBaseDir:t.getGlobalMatildaDir()}static getGlobalMatildaDir(){let e=process.env.MATILDA_HOME;if(e)return t.resolvePath(e);let n=m.homedir();return n?s.join(n,P):s.join(m.tmpdir(),".matilda")}static getMcpOAuthTokensPath(){return s.join(t.getGlobalMatildaDir(),"mcp-oauth-tokens.json")}static getGlobalSettingsPath(){return s.join(t.getGlobalMatildaDir(),"settings.json")}static getInstallationIdPath(){return s.join(t.getGlobalMatildaDir(),"installation_id")}static getGoogleAccountsPath(){return s.join(t.getGlobalMatildaDir(),xt)}static getUserCommandsDir(){return s.join(t.getGlobalMatildaDir(),"commands")}static getGlobalMemoryFilePath(){return s.join(t.getGlobalMatildaDir(),"memory.md")}static getGlobalTempDir(){return s.join(t.getRuntimeBaseDir(),Z)}static getGlobalDebugDir(){return s.join(t.getRuntimeBaseDir(),yt)}static getDebugLogPath(e){return s.join(t.getGlobalDebugDir(),`${e}.txt`)}static getGlobalIdeDir(){return s.join(t.getGlobalMatildaDir(),vt)}static resolvePathThroughExistingAncestor(e){let n=e;for(;;)try{let r=S.realpathSync(n),o=s.relative(n,e);return s.join(r,o)}catch(r){if(r.code!=="ENOENT")throw r;let o=s.dirname(n);if(o===n)return e;n=o}}static isPathWithinDirectory(e,n){let r=t.resolvePathThroughExistingAncestor(n),o=t.resolvePathThroughExistingAncestor(e),i=s.relative(r,o);return i===""||!i.startsWith("..")&&!s.isAbsolute(i)}static assertPathWithinDirectory(e,n,r){if(!t.isPathWithinDirectory(e,n))throw new E(r)}static getPlansDir(e,n){let r=n?.trim();if(r){if(!e)throw new E("projectRoot is required when plansDirectory is configured.");let o=s.resolve(e),i=t.resolvePath(r,o);return t.assertPathWithinDirectory(i,o,"plansDirectory must resolve within the project root."),i}return s.join(t.getGlobalMatildaDir(),jt)}static getPlanFilePath(e,n,r){return s.join(t.getPlansDir(n,r),`${t.sanitizePlanSessionId(e)}.md`)}static getGlobalBinDir(){return s.join(t.getGlobalMatildaDir(),Pt)}static getGlobalArenaDir(){return s.join(t.getGlobalMatildaDir(),St)}getMatildaDir(){return s.join(this.targetDir,P)}getProjectDir(){let e=K(this.getProjectRoot()),n=s.join(this.getRuntimeBaseDir(),wt);return s.join(n,e)}getProjectTempDir(){let e=J(this.getProjectRoot()),n=s.join(this.getRuntimeBaseDir(),Z);return s.join(n,e)}getToolResultsDir(){return s.join(this.getProjectTempDir(),"tool-results")}ensureProjectTempDirExists(){S.mkdirSync(this.getProjectTempDir(),{recursive:!0})}static getOAuthCredsPath(){return s.join(t.getGlobalMatildaDir(),bt)}getProjectRoot(){return this.targetDir}getWorkspaceSettingsPath(){return s.join(this.getMatildaDir(),"settings.json")}getProjectCommandsDir(){return s.join(this.getMatildaDir(),"commands")}getRuntimeStatusPath(e){return s.join(this.getProjectDir(),"chats",`${e}.runtime.json`)}getProjectTempCheckpointsDir(){return s.join(this.getProjectTempDir(),"checkpoints")}getExtensionsDir(){return s.join(this.getMatildaDir(),"extensions")}getExtensionsConfigPath(){return s.join(this.getExtensionsDir(),"matilda-extension.json")}getUserSkillsDirs(){let e=m.homedir()||m.tmpdir();return Et.map(n=>n===P?s.join(t.getGlobalMatildaDir(),"skills"):s.join(e,n,"skills"))}static getUserExtensionsDir(){return s.join(t.getGlobalMatildaDir(),"extensions")}getHistoryFilePath(){return s.join(this.getProjectTempDir(),"shell_history")}};c();import{promises as N}from"node:fs";import Y from"node:path";async function q(t,e,n){let{fallbackCopy:r=!0}=n??{},o=Y.dirname(t),i=Y.relative(o,e);try{await N.unlink(t)}catch{}try{await N.symlink(i,t);return}catch{}if(r)try{await N.copyFile(e,t)}catch{}}c();lt();c();var Q,tt;function me(t,e){Q=t,tt=e}function et(){return Q}function De(){return tt}function nt(t){let e=t?.spanContext();return e&&$(e)?{traceId:e.traceId,spanId:e.spanId,traceFlags:e.traceFlags}:null}function Ct(){try{return nt(k.getActiveSpan())}catch{return null}}function At(){try{let t=et();return nt(t?k.getSpan(t):void 0)}catch{return null}}function rt(){return Ct()??At()}function ve(t){let e=(t.traceFlags&255).toString(16).padStart(2,"0");return`00-${t.traceId}-${t.spanId}-${e}`}var st=!1;function je(t){st=t}function ye(){return st}c();import{promises as ot}from"node:fs";import Tt from"node:path";import{AsyncLocalStorage as Rt}from"node:async_hooks";import kt from"node:util";var v=null,A=null,T=!1,it=null,at=new Rt;function ct(){let t=process.env.MATILDA_DEBUG_LOG_FILE;if(!t)return!1;let e=t.trim().toLowerCase();return!["","0","false","off","no"].includes(e)}function w(){return at.getStore()??it}function ut(){let t=D.getGlobalDebugDir();return(!v||A!==t)&&(A=t,v=ot.mkdir(t,{recursive:!0}).then(()=>{}).catch(()=>{T=!0,v=null,A=null})),v??Promise.resolve()}function It(t){return t.map(e=>e instanceof Error?e.stack??`${e.name}: ${e.message}`:e).map(e=>typeof e=="string"?e:kt.inspect(e)).join(" ")}function Lt(t,e,n,r){let o=new Date().toISOString(),i=n?` [${n}]`:"",g=r?` [trace_id=${r.traceId} span_id=${r.spanId}]`:"";return`${o} [${t}]${i}${g} ${e}
|
|
4
|
+
`}function C(t,e,n,r){if(!ct())return;let o=t.getSessionId(),i=D.getDebugLogPath(o),g=It(r),u=rt(),l=Lt(e,g,n,u);ut().then(()=>ot.appendFile(i,l,"utf8")).catch(()=>{T=!0})}function Ge(){return T}function Ne(){T=!1,v=null,A=null}var Mt="latest";function Gt(t){if(!ct())return;let e=Tt.join(D.getGlobalDebugDir(),Mt),n=D.getDebugLogPath(t);ut().then(()=>q(e,n,{fallbackCopy:!1})).catch(()=>{})}function $e(t){it=t??null,t&&Gt(t.getSessionId())}function Be(t,e){return at.run(t,e)}function Oe(t){return{isEnabled:()=>w()!==null,debug:(...e)=>{let n=w();n&&C(n,"DEBUG",t,e)},info:(...e)=>{let n=w();n&&C(n,"INFO",t,e)},warn:(...e)=>{let n=w();n&&C(n,"WARN",t,e)},error:(...e)=>{let n=w();n&&C(n,"ERROR",t,e)}}}export{G as a,Nt as b,$t as c,Bt as d,Ot as e,d as f,B as g,O as h,W as i,E as j,_ as k,F as l,U as m,H as n,I as o,L as p,M as q,Wt as r,P as s,Jt as t,Kt as u,V as v,Xt as w,Zt as x,Yt as y,qt as z,Qt as A,te as B,ee as C,J as D,K as E,X as F,ne as G,ht as H,mt as I,re as J,Et as K,D as L,q as M,me as N,De as O,Ct as P,rt as Q,ve as R,je as S,ye as T,Ge as U,Ne as V,$e as W,Be as X,Oe as Y};
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2025 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright 2025 Matilda
|
|
13
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as ls}from"./chunk-QCIDUZV6.js";import{c as yr,f as Te}from"./chunk-S4K76QPI.js";import{M as Zn,N as es,O as qt,Q as ts,R as Cr,S as rs,a as Vn,g as ve,h as Kn,la as as}from"./chunk-FU2PKCG5.js";import{a as is}from"./chunk-DC7LAFZZ.js";import{a as Xn,g as zn,k as Yn,l as mr,o as ns,t as ss,v as os}from"./chunk-QLEJOI4X.js";import{e as Jn}from"./chunk-4J6DC24J.js";import{b as gr,c as _r,f as Qn,n as br}from"./chunk-SDTWBD62.js";import{b as rn}from"./chunk-ESSYHTAZ.js";import{Y as he,b as qn,p as tn}from"./chunk-QWBNNEV2.js";import{b as a}from"./chunk-GZPNIYVZ.js";a();a();a();a();a();a();a();a();function A(n,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!s:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,t):s?s.value=t:e.set(n,t),t}function c(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)}a();var nn=function(){let{crypto:n}=globalThis;if(n?.randomUUID)return nn=n.randomUUID.bind(n),n.randomUUID();let e=new Uint8Array(1),t=n?()=>n.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>(+r^t()&15>>+r/4).toString(16))};a();a();a();function Jt(n){return typeof n=="object"&&n!==null&&("name"in n&&n.name==="AbortError"||"message"in n&&String(n.message).includes("FetchRequestCanceledException"))}var Xt=n=>{if(n instanceof Error)return n;if(typeof n=="object"&&n!==null){try{if(Object.prototype.toString.call(n)==="[object Error]"){let e=new Error(n.message,n.cause?{cause:n.cause}:{});return n.stack&&(e.stack=n.stack),n.cause&&!e.cause&&(e.cause=n.cause),n.name&&(e.name=n.name),e}}catch{}try{return new Error(JSON.stringify(n))}catch{}}return new Error(n)};var y=class extends Error{},$=class n extends y{constructor(e,t,r,s){super(`${n.makeMessage(e,t,r)}`),this.status=e,this.headers=s,this.requestID=s?.get("x-request-id"),this.error=t;let o=t;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,t,r){let s=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,t,r,s){if(!e||!s)return new me({message:r,cause:Xt(t)});let o=t?.error;return e===400?new it(e,o,r,s):e===401?new at(e,o,r,s):e===403?new lt(e,o,r,s):e===404?new ct(e,o,r,s):e===409?new ut(e,o,r,s):e===422?new ft(e,o,r,s):e===429?new pt(e,o,r,s):e>=500?new dt(e,o,r,s):new n(e,o,r,s)}},k=class extends ${constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},me=class extends ${constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},ge=class extends me{constructor({message:e}={}){super({message:e??"Request timed out."})}},it=class extends ${},at=class extends ${},lt=class extends ${},ct=class extends ${},ut=class extends ${},ft=class extends ${},pt=class extends ${},dt=class extends ${},ht=class extends y{constructor(){super("Could not parse response content as the length limit was reached")}},mt=class extends y{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Z=class extends Error{constructor(e){super(e)}};var go=/^[a-z][a-z0-9+.-]*:/i,cs=n=>go.test(n),W=n=>(W=Array.isArray,W(n)),sn=W;function us(n){return typeof n!="object"?{}:n??{}}function fs(n){if(!n)return!0;for(let e in n)return!1;return!0}function ps(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Vt(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)}var ds=(n,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new y(`${n} must be an integer`);if(e<0)throw new y(`${n} must be a positive integer`);return e};var hs=n=>{try{return JSON.parse(n)}catch{return}};a();var ee=n=>new Promise(e=>setTimeout(e,n));a();a();var _e="5.11.0";var bs=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function _o(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var bo=()=>{let n=_o();if(n==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":gs(Deno.build.os),"X-Stainless-Arch":ms(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(n==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":gs(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ms(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Co();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Co(){if(typeof navigator>"u"||!navigator)return null;let n=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of n){let r=t.exec(navigator.userAgent);if(r){let s=r[1]||0,o=r[2]||0,i=r[3]||0;return{browser:e,version:`${s}.${o}.${i}`}}}return null}var ms=n=>n==="x32"?"x32":n==="x86_64"||n==="x64"?"x64":n==="arm"?"arm":n==="aarch64"||n==="arm64"?"arm64":n?`other:${n}`:"unknown",gs=n=>(n=n.toLowerCase(),n.includes("ios")?"iOS":n==="android"?"Android":n==="darwin"?"MacOS":n==="win32"?"Windows":n==="freebsd"?"FreeBSD":n==="openbsd"?"OpenBSD":n==="linux"?"Linux":n?`Other:${n}`:"Unknown"),_s,Cs=()=>_s??(_s=bo());a();function ys(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function on(...n){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...n)}function wr(n){let e=Symbol.asyncIterator in n?n[Symbol.asyncIterator]():n[Symbol.iterator]();return on({start(){},async pull(t){let{done:r,value:s}=await e.next();r?t.close():t.enqueue(s)},async cancel(){await e.return?.()}})}function an(n){if(n[Symbol.asyncIterator])return n;let e=n.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function ws(n){if(n===null||typeof n!="object")return;if(n[Symbol.asyncIterator]){await n[Symbol.asyncIterator]().return?.();return}let e=n.getReader(),t=e.cancel();e.releaseLock(),await t}a();var As=({headers:n,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});a();a();var Ar="RFC3986",ln=n=>String(n),xr={RFC1738:n=>String(n).replace(/%20/g,"+"),RFC3986:ln},cn="RFC1738";a();a();var Ir=(n,e)=>(Ir=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ir(n,e)),te=(()=>{let n=[];for(let e=0;e<256;++e)n.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return n})();var un=1024,xs=(n,e,t,r,s)=>{if(n.length===0)return n;let o=n;if(typeof n=="symbol"?o=Symbol.prototype.toString.call(n):typeof n!="string"&&(o=String(n)),t==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});let i="";for(let l=0;l<o.length;l+=un){let u=o.length>=un?o.slice(l,l+un):o,d=[];for(let g=0;g<u.length;++g){let p=u.charCodeAt(g);if(p===45||p===46||p===95||p===126||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||s===cn&&(p===40||p===41)){d[d.length]=u.charAt(g);continue}if(p<128){d[d.length]=te[p];continue}if(p<2048){d[d.length]=te[192|p>>6]+te[128|p&63];continue}if(p<55296||p>=57344){d[d.length]=te[224|p>>12]+te[128|p>>6&63]+te[128|p&63];continue}g+=1,p=65536+((p&1023)<<10|u.charCodeAt(g)&1023),d[d.length]=te[240|p>>18]+te[128|p>>12&63]+te[128|p>>6&63]+te[128|p&63]}i+=d.join("")}return i};function Is(n){return!n||typeof n!="object"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function fn(n,e){if(W(n)){let t=[];for(let r=0;r<n.length;r+=1)t.push(e(n[r]));return t}return e(n)}var Rs={brackets(n){return String(n)+"[]"},comma:"comma",indices(n,e){return String(n)+"["+e+"]"},repeat(n){return String(n)}},Os=function(n,e){Array.prototype.push.apply(n,W(e)?e:[e])},Ps,N={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:xs,encodeValuesOnly:!1,format:Ar,formatter:ln,indices:!1,serializeDate(n){return(Ps??(Ps=Function.prototype.call.bind(Date.prototype.toISOString)))(n)},skipNulls:!1,strictNullHandling:!1};function Ao(n){return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||typeof n=="symbol"||typeof n=="bigint"}var pn={};function Ss(n,e,t,r,s,o,i,l,u,d,g,p,b,f,x,C,P,O){let w=n,U=O,S=0,J=!1;for(;(U=U.get(pn))!==void 0&&!J;){let T=U.get(n);if(S+=1,typeof T<"u"){if(T===S)throw new RangeError("Cyclic object value");J=!0}typeof U.get(pn)>"u"&&(S=0)}if(typeof d=="function"?w=d(e,w):w instanceof Date?w=b?.(w):t==="comma"&&W(w)&&(w=fn(w,function(T){return T instanceof Date?b?.(T):T})),w===null){if(o)return u&&!C?u(e,N.encoder,P,"key",f):e;w=""}if(Ao(w)||Is(w)){if(u){let T=C?e:u(e,N.encoder,P,"key",f);return[x?.(T)+"="+x?.(u(w,N.encoder,P,"value",f))]}return[x?.(e)+"="+x?.(String(w))]}let H=[];if(typeof w>"u")return H;let E;if(t==="comma"&&W(w))C&&u&&(w=fn(w,u)),E=[{value:w.length>0?w.join(",")||null:void 0}];else if(W(d))E=d;else{let T=Object.keys(w);E=g?T.sort(g):T}let D=l?String(e).replace(/\./g,"%2E"):String(e),G=r&&W(w)&&w.length===1?D+"[]":D;if(s&&W(w)&&w.length===0)return G+"[]";for(let T=0;T<E.length;++T){let M=E[T],Wn=typeof M=="object"&&typeof M.value<"u"?M.value:w[M];if(i&&Wn===null)continue;let en=p&&l?M.replace(/\./g,"%2E"):M,ho=W(w)?typeof t=="function"?t(G,en):G:G+(p?"."+en:"["+en+"]");O.set(n,S);let Hn=new WeakMap;Hn.set(pn,O),Os(H,Ss(Wn,ho,t,r,s,o,i,l,t==="comma"&&C&&W(w)?null:u,d,g,p,b,f,x,C,P,Hn))}return H}function xo(n=N){if(typeof n.allowEmptyArrays<"u"&&typeof n.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof n.encodeDotInKeys<"u"&&typeof n.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(n.encoder!==null&&typeof n.encoder<"u"&&typeof n.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=n.charset||N.charset;if(typeof n.charset<"u"&&n.charset!=="utf-8"&&n.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=Ar;if(typeof n.format<"u"){if(!Ir(xr,n.format))throw new TypeError("Unknown format option provided.");t=n.format}let r=xr[t],s=N.filter;(typeof n.filter=="function"||W(n.filter))&&(s=n.filter);let o;if(n.arrayFormat&&n.arrayFormat in Rs?o=n.arrayFormat:"indices"in n?o=n.indices?"indices":"repeat":o=N.arrayFormat,"commaRoundTrip"in n&&typeof n.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let i=typeof n.allowDots>"u"?n.encodeDotInKeys?!0:N.allowDots:!!n.allowDots;return{addQueryPrefix:typeof n.addQueryPrefix=="boolean"?n.addQueryPrefix:N.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof n.allowEmptyArrays=="boolean"?!!n.allowEmptyArrays:N.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof n.charsetSentinel=="boolean"?n.charsetSentinel:N.charsetSentinel,commaRoundTrip:!!n.commaRoundTrip,delimiter:typeof n.delimiter>"u"?N.delimiter:n.delimiter,encode:typeof n.encode=="boolean"?n.encode:N.encode,encodeDotInKeys:typeof n.encodeDotInKeys=="boolean"?n.encodeDotInKeys:N.encodeDotInKeys,encoder:typeof n.encoder=="function"?n.encoder:N.encoder,encodeValuesOnly:typeof n.encodeValuesOnly=="boolean"?n.encodeValuesOnly:N.encodeValuesOnly,filter:s,format:t,formatter:r,serializeDate:typeof n.serializeDate=="function"?n.serializeDate:N.serializeDate,skipNulls:typeof n.skipNulls=="boolean"?n.skipNulls:N.skipNulls,sort:typeof n.sort=="function"?n.sort:null,strictNullHandling:typeof n.strictNullHandling=="boolean"?n.strictNullHandling:N.strictNullHandling}}function dn(n,e={}){let t=n,r=xo(e),s,o;typeof r.filter=="function"?(o=r.filter,t=o("",t)):W(r.filter)&&(o=r.filter,s=o);let i=[];if(typeof t!="object"||t===null)return"";let l=Rs[r.arrayFormat],u=l==="comma"&&r.commaRoundTrip;s||(s=Object.keys(t)),r.sort&&s.sort(r.sort);let d=new WeakMap;for(let b=0;b<s.length;++b){let f=s[b];r.skipNulls&&t[f]===null||Os(i,Ss(t[f],f,l,u,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,d))}let g=i.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),g.length>0?p+g:""}a();a();a();a();a();function Ts(n){let e=0;for(let s of n)e+=s.length;let t=new Uint8Array(e),r=0;for(let s of n)t.set(s,r),r+=s.length;return t}var Es;function gt(n){let e;return(Es??(e=new globalThis.TextEncoder,Es=e.encode.bind(e)))(n)}var vs;function hn(n){let e;return(vs??(e=new globalThis.TextDecoder,vs=e.decode.bind(e)))(n)}var X,V,ke=class{constructor(){X.set(this,void 0),V.set(this,void 0),A(this,X,new Uint8Array,"f"),A(this,V,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?gt(e):e;A(this,X,Ts([c(this,X,"f"),t]),"f");let r=[],s;for(;(s=Po(c(this,X,"f"),c(this,V,"f")))!=null;){if(s.carriage&&c(this,V,"f")==null){A(this,V,s.index,"f");continue}if(c(this,V,"f")!=null&&(s.index!==c(this,V,"f")+1||s.carriage)){r.push(hn(c(this,X,"f").subarray(0,c(this,V,"f")-1))),A(this,X,c(this,X,"f").subarray(c(this,V,"f")),"f"),A(this,V,null,"f");continue}let o=c(this,V,"f")!==null?s.preceding-1:s.preceding,i=hn(c(this,X,"f").subarray(0,o));r.push(i),A(this,X,c(this,X,"f").subarray(s.index),"f"),A(this,V,null,"f")}return r}flush(){return c(this,X,"f").length?this.decode(`
|
|
3
|
+
import{a as ls}from"./chunk-E5TINV2P.js";import{c as yr,f as Te}from"./chunk-V2MZCFBR.js";import{M as Zn,N as es,O as qt,Q as ts,R as Cr,S as rs,a as Vn,g as ve,h as Kn,la as as}from"./chunk-CKIXP6AV.js";import{a as is}from"./chunk-DC7LAFZZ.js";import{a as Xn,g as zn,k as Yn,l as mr,o as ns,t as ss,v as os}from"./chunk-DGVOK3TF.js";import{e as Jn}from"./chunk-4J6DC24J.js";import{b as gr,c as _r,f as Qn,n as br}from"./chunk-SDTWBD62.js";import{b as rn}from"./chunk-ESSYHTAZ.js";import{Y as he,b as qn,p as tn}from"./chunk-WGPRIGRF.js";import{b as a}from"./chunk-GZPNIYVZ.js";a();a();a();a();a();a();a();a();function A(n,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!s:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,t):s?s.value=t:e.set(n,t),t}function c(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)}a();var nn=function(){let{crypto:n}=globalThis;if(n?.randomUUID)return nn=n.randomUUID.bind(n),n.randomUUID();let e=new Uint8Array(1),t=n?()=>n.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>(+r^t()&15>>+r/4).toString(16))};a();a();a();function Jt(n){return typeof n=="object"&&n!==null&&("name"in n&&n.name==="AbortError"||"message"in n&&String(n.message).includes("FetchRequestCanceledException"))}var Xt=n=>{if(n instanceof Error)return n;if(typeof n=="object"&&n!==null){try{if(Object.prototype.toString.call(n)==="[object Error]"){let e=new Error(n.message,n.cause?{cause:n.cause}:{});return n.stack&&(e.stack=n.stack),n.cause&&!e.cause&&(e.cause=n.cause),n.name&&(e.name=n.name),e}}catch{}try{return new Error(JSON.stringify(n))}catch{}}return new Error(n)};var y=class extends Error{},$=class n extends y{constructor(e,t,r,s){super(`${n.makeMessage(e,t,r)}`),this.status=e,this.headers=s,this.requestID=s?.get("x-request-id"),this.error=t;let o=t;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,t,r){let s=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,t,r,s){if(!e||!s)return new me({message:r,cause:Xt(t)});let o=t?.error;return e===400?new it(e,o,r,s):e===401?new at(e,o,r,s):e===403?new lt(e,o,r,s):e===404?new ct(e,o,r,s):e===409?new ut(e,o,r,s):e===422?new ft(e,o,r,s):e===429?new pt(e,o,r,s):e>=500?new dt(e,o,r,s):new n(e,o,r,s)}},k=class extends ${constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},me=class extends ${constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},ge=class extends me{constructor({message:e}={}){super({message:e??"Request timed out."})}},it=class extends ${},at=class extends ${},lt=class extends ${},ct=class extends ${},ut=class extends ${},ft=class extends ${},pt=class extends ${},dt=class extends ${},ht=class extends y{constructor(){super("Could not parse response content as the length limit was reached")}},mt=class extends y{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Z=class extends Error{constructor(e){super(e)}};var go=/^[a-z][a-z0-9+.-]*:/i,cs=n=>go.test(n),W=n=>(W=Array.isArray,W(n)),sn=W;function us(n){return typeof n!="object"?{}:n??{}}function fs(n){if(!n)return!0;for(let e in n)return!1;return!0}function ps(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Vt(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)}var ds=(n,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new y(`${n} must be an integer`);if(e<0)throw new y(`${n} must be a positive integer`);return e};var hs=n=>{try{return JSON.parse(n)}catch{return}};a();var ee=n=>new Promise(e=>setTimeout(e,n));a();a();var _e="5.11.0";var bs=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function _o(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var bo=()=>{let n=_o();if(n==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":gs(Deno.build.os),"X-Stainless-Arch":ms(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(n==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":gs(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ms(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Co();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_e,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Co(){if(typeof navigator>"u"||!navigator)return null;let n=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of n){let r=t.exec(navigator.userAgent);if(r){let s=r[1]||0,o=r[2]||0,i=r[3]||0;return{browser:e,version:`${s}.${o}.${i}`}}}return null}var ms=n=>n==="x32"?"x32":n==="x86_64"||n==="x64"?"x64":n==="arm"?"arm":n==="aarch64"||n==="arm64"?"arm64":n?`other:${n}`:"unknown",gs=n=>(n=n.toLowerCase(),n.includes("ios")?"iOS":n==="android"?"Android":n==="darwin"?"MacOS":n==="win32"?"Windows":n==="freebsd"?"FreeBSD":n==="openbsd"?"OpenBSD":n==="linux"?"Linux":n?`Other:${n}`:"Unknown"),_s,Cs=()=>_s??(_s=bo());a();function ys(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function on(...n){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...n)}function wr(n){let e=Symbol.asyncIterator in n?n[Symbol.asyncIterator]():n[Symbol.iterator]();return on({start(){},async pull(t){let{done:r,value:s}=await e.next();r?t.close():t.enqueue(s)},async cancel(){await e.return?.()}})}function an(n){if(n[Symbol.asyncIterator])return n;let e=n.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function ws(n){if(n===null||typeof n!="object")return;if(n[Symbol.asyncIterator]){await n[Symbol.asyncIterator]().return?.();return}let e=n.getReader(),t=e.cancel();e.releaseLock(),await t}a();var As=({headers:n,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});a();a();var Ar="RFC3986",ln=n=>String(n),xr={RFC1738:n=>String(n).replace(/%20/g,"+"),RFC3986:ln},cn="RFC1738";a();a();var Ir=(n,e)=>(Ir=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ir(n,e)),te=(()=>{let n=[];for(let e=0;e<256;++e)n.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return n})();var un=1024,xs=(n,e,t,r,s)=>{if(n.length===0)return n;let o=n;if(typeof n=="symbol"?o=Symbol.prototype.toString.call(n):typeof n!="string"&&(o=String(n)),t==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});let i="";for(let l=0;l<o.length;l+=un){let u=o.length>=un?o.slice(l,l+un):o,d=[];for(let g=0;g<u.length;++g){let p=u.charCodeAt(g);if(p===45||p===46||p===95||p===126||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||s===cn&&(p===40||p===41)){d[d.length]=u.charAt(g);continue}if(p<128){d[d.length]=te[p];continue}if(p<2048){d[d.length]=te[192|p>>6]+te[128|p&63];continue}if(p<55296||p>=57344){d[d.length]=te[224|p>>12]+te[128|p>>6&63]+te[128|p&63];continue}g+=1,p=65536+((p&1023)<<10|u.charCodeAt(g)&1023),d[d.length]=te[240|p>>18]+te[128|p>>12&63]+te[128|p>>6&63]+te[128|p&63]}i+=d.join("")}return i};function Is(n){return!n||typeof n!="object"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function fn(n,e){if(W(n)){let t=[];for(let r=0;r<n.length;r+=1)t.push(e(n[r]));return t}return e(n)}var Rs={brackets(n){return String(n)+"[]"},comma:"comma",indices(n,e){return String(n)+"["+e+"]"},repeat(n){return String(n)}},Os=function(n,e){Array.prototype.push.apply(n,W(e)?e:[e])},Ps,N={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:xs,encodeValuesOnly:!1,format:Ar,formatter:ln,indices:!1,serializeDate(n){return(Ps??(Ps=Function.prototype.call.bind(Date.prototype.toISOString)))(n)},skipNulls:!1,strictNullHandling:!1};function Ao(n){return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||typeof n=="symbol"||typeof n=="bigint"}var pn={};function Ss(n,e,t,r,s,o,i,l,u,d,g,p,b,f,x,C,P,O){let w=n,U=O,S=0,J=!1;for(;(U=U.get(pn))!==void 0&&!J;){let T=U.get(n);if(S+=1,typeof T<"u"){if(T===S)throw new RangeError("Cyclic object value");J=!0}typeof U.get(pn)>"u"&&(S=0)}if(typeof d=="function"?w=d(e,w):w instanceof Date?w=b?.(w):t==="comma"&&W(w)&&(w=fn(w,function(T){return T instanceof Date?b?.(T):T})),w===null){if(o)return u&&!C?u(e,N.encoder,P,"key",f):e;w=""}if(Ao(w)||Is(w)){if(u){let T=C?e:u(e,N.encoder,P,"key",f);return[x?.(T)+"="+x?.(u(w,N.encoder,P,"value",f))]}return[x?.(e)+"="+x?.(String(w))]}let H=[];if(typeof w>"u")return H;let E;if(t==="comma"&&W(w))C&&u&&(w=fn(w,u)),E=[{value:w.length>0?w.join(",")||null:void 0}];else if(W(d))E=d;else{let T=Object.keys(w);E=g?T.sort(g):T}let D=l?String(e).replace(/\./g,"%2E"):String(e),G=r&&W(w)&&w.length===1?D+"[]":D;if(s&&W(w)&&w.length===0)return G+"[]";for(let T=0;T<E.length;++T){let M=E[T],Wn=typeof M=="object"&&typeof M.value<"u"?M.value:w[M];if(i&&Wn===null)continue;let en=p&&l?M.replace(/\./g,"%2E"):M,ho=W(w)?typeof t=="function"?t(G,en):G:G+(p?"."+en:"["+en+"]");O.set(n,S);let Hn=new WeakMap;Hn.set(pn,O),Os(H,Ss(Wn,ho,t,r,s,o,i,l,t==="comma"&&C&&W(w)?null:u,d,g,p,b,f,x,C,P,Hn))}return H}function xo(n=N){if(typeof n.allowEmptyArrays<"u"&&typeof n.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof n.encodeDotInKeys<"u"&&typeof n.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(n.encoder!==null&&typeof n.encoder<"u"&&typeof n.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=n.charset||N.charset;if(typeof n.charset<"u"&&n.charset!=="utf-8"&&n.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=Ar;if(typeof n.format<"u"){if(!Ir(xr,n.format))throw new TypeError("Unknown format option provided.");t=n.format}let r=xr[t],s=N.filter;(typeof n.filter=="function"||W(n.filter))&&(s=n.filter);let o;if(n.arrayFormat&&n.arrayFormat in Rs?o=n.arrayFormat:"indices"in n?o=n.indices?"indices":"repeat":o=N.arrayFormat,"commaRoundTrip"in n&&typeof n.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let i=typeof n.allowDots>"u"?n.encodeDotInKeys?!0:N.allowDots:!!n.allowDots;return{addQueryPrefix:typeof n.addQueryPrefix=="boolean"?n.addQueryPrefix:N.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof n.allowEmptyArrays=="boolean"?!!n.allowEmptyArrays:N.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof n.charsetSentinel=="boolean"?n.charsetSentinel:N.charsetSentinel,commaRoundTrip:!!n.commaRoundTrip,delimiter:typeof n.delimiter>"u"?N.delimiter:n.delimiter,encode:typeof n.encode=="boolean"?n.encode:N.encode,encodeDotInKeys:typeof n.encodeDotInKeys=="boolean"?n.encodeDotInKeys:N.encodeDotInKeys,encoder:typeof n.encoder=="function"?n.encoder:N.encoder,encodeValuesOnly:typeof n.encodeValuesOnly=="boolean"?n.encodeValuesOnly:N.encodeValuesOnly,filter:s,format:t,formatter:r,serializeDate:typeof n.serializeDate=="function"?n.serializeDate:N.serializeDate,skipNulls:typeof n.skipNulls=="boolean"?n.skipNulls:N.skipNulls,sort:typeof n.sort=="function"?n.sort:null,strictNullHandling:typeof n.strictNullHandling=="boolean"?n.strictNullHandling:N.strictNullHandling}}function dn(n,e={}){let t=n,r=xo(e),s,o;typeof r.filter=="function"?(o=r.filter,t=o("",t)):W(r.filter)&&(o=r.filter,s=o);let i=[];if(typeof t!="object"||t===null)return"";let l=Rs[r.arrayFormat],u=l==="comma"&&r.commaRoundTrip;s||(s=Object.keys(t)),r.sort&&s.sort(r.sort);let d=new WeakMap;for(let b=0;b<s.length;++b){let f=s[b];r.skipNulls&&t[f]===null||Os(i,Ss(t[f],f,l,u,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,d))}let g=i.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),g.length>0?p+g:""}a();a();a();a();a();function Ts(n){let e=0;for(let s of n)e+=s.length;let t=new Uint8Array(e),r=0;for(let s of n)t.set(s,r),r+=s.length;return t}var Es;function gt(n){let e;return(Es??(e=new globalThis.TextEncoder,Es=e.encode.bind(e)))(n)}var vs;function hn(n){let e;return(vs??(e=new globalThis.TextDecoder,vs=e.decode.bind(e)))(n)}var X,V,ke=class{constructor(){X.set(this,void 0),V.set(this,void 0),A(this,X,new Uint8Array,"f"),A(this,V,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?gt(e):e;A(this,X,Ts([c(this,X,"f"),t]),"f");let r=[],s;for(;(s=Po(c(this,X,"f"),c(this,V,"f")))!=null;){if(s.carriage&&c(this,V,"f")==null){A(this,V,s.index,"f");continue}if(c(this,V,"f")!=null&&(s.index!==c(this,V,"f")+1||s.carriage)){r.push(hn(c(this,X,"f").subarray(0,c(this,V,"f")-1))),A(this,X,c(this,X,"f").subarray(c(this,V,"f")),"f"),A(this,V,null,"f");continue}let o=c(this,V,"f")!==null?s.preceding-1:s.preceding,i=hn(c(this,X,"f").subarray(0,o));r.push(i),A(this,X,c(this,X,"f").subarray(s.index),"f"),A(this,V,null,"f")}return r}flush(){return c(this,X,"f").length?this.decode(`
|
|
4
4
|
`):[]}};X=new WeakMap,V=new WeakMap;ke.NEWLINE_CHARS=new Set([`
|
|
5
5
|
`,"\r"]);ke.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Po(n,e){for(let s=e??0;s<n.length;s++){if(n[s]===10)return{preceding:s,index:s+1,carriage:!1};if(n[s]===13)return{preceding:s,index:s+1,carriage:!0}}return null}function ks(n){for(let r=0;r<n.length-1;r++){if(n[r]===10&&n[r+1]===10||n[r]===13&&n[r+1]===13)return r+2;if(n[r]===13&&n[r+1]===10&&r+3<n.length&&n[r+2]===13&&n[r+3]===10)return r+4}return-1}a();var Rr={off:0,error:200,warn:300,info:400,debug:500},mn=(n,e,t)=>{if(n){if(ps(Rr,n))return n;v(t).warn(`${e} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(Rr))}`)}};function Kt(){}function Pr(n,e,t){return!e||Rr[n]>Rr[t]?Kt:e[n].bind(e)}var Ro={error:Kt,warn:Kt,info:Kt,debug:Kt},Ms=new WeakMap;function v(n){let e=n.logger,t=n.logLevel??"off";if(!e)return Ro;let r=Ms.get(e);if(r&&r[0]===t)return r[1];let s={error:Pr("error",e,t),warn:Pr("warn",e,t),info:Pr("info",e,t),debug:Pr("debug",e,t)};return Ms.set(e,[t,s]),s}var le=n=>(n.options&&(n.options={...n.options},delete n.options.headers),n.headers&&(n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([e,t])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":t]))),"retryOfRequestLogID"in n&&(n.retryOfRequestLogID&&(n.retryOf=n.retryOfRequestLogID),delete n.retryOfRequestLogID),n);var zt,re=class n{constructor(e,t,r){this.iterator=e,zt.set(this,void 0),this.controller=t,A(this,zt,r,"f")}static fromSSEResponse(e,t,r){let s=!1,o=r?v(r):console;async function*i(){if(s)throw new y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let l=!1;try{for await(let u of Oo(e,t))if(!l){if(u.data.startsWith("[DONE]")){l=!0;continue}if(u.event===null||!u.event.startsWith("thread.")){let d;try{d=JSON.parse(u.data)}catch(g){throw o.error("Could not parse message into JSON:",u.data),o.error("From chunk:",u.raw),g}if(d&&d.error)throw new $(void 0,d.error,void 0,e.headers);yield d}else{let d;try{d=JSON.parse(u.data)}catch(g){throw console.error("Could not parse message into JSON:",u.data),console.error("From chunk:",u.raw),g}if(u.event=="error")throw new $(void 0,d.error,d.message,void 0);yield{event:u.event,data:d}}}l=!0}catch(u){if(Jt(u))return;throw u}finally{l||t.abort()}}return new n(i,t,r)}static fromReadableStream(e,t,r){let s=!1;async function*o(){let l=new ke,u=an(e);for await(let d of u)for(let g of l.decode(d))yield g;for(let d of l.flush())yield d}async function*i(){if(s)throw new y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let l=!1;try{for await(let u of o())l||u&&(yield JSON.parse(u));l=!0}catch(u){if(Jt(u))return;throw u}finally{l||t.abort()}}return new n(i,t,r)}[(zt=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],r=this.iterator(),s=o=>({next:()=>{if(o.length===0){let i=r.next();e.push(i),t.push(i)}return o.shift()}});return[new n(()=>s(e),this.controller,c(this,zt,"f")),new n(()=>s(t),this.controller,c(this,zt,"f"))]}toReadableStream(){let e=this,t;return on({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{let{value:s,done:o}=await t.next();if(o)return r.close();let i=gt(JSON.stringify(s)+`
|
|
6
6
|
`);r.enqueue(i)}catch(s){r.error(s)}},async cancel(){await t.return?.()}})}};async function*Oo(n,e){if(!n.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new y("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new y("Attempted to iterate over a response with no body");let t=new gn,r=new ke,s=an(n.body);for await(let o of So(s))for(let i of r.decode(o)){let l=t.decode(i);l&&(yield l)}for(let o of r.flush()){let i=t.decode(o);i&&(yield i)}}async function*So(n){let e=new Uint8Array;for await(let t of n){if(t==null)continue;let r=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?gt(t):t,s=new Uint8Array(e.length+r.length);s.set(e),s.set(r,e.length),e=s;let o;for(;(o=ks(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}var gn=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a,c}from"./chunk-
|
|
3
|
+
import{a,c}from"./chunk-WGPRIGRF.js";import{b as E}from"./chunk-GZPNIYVZ.js";E();import{URL as g}from"node:url";var l=[/^10\./,/^127\./,/^172\.(1[6-9]|2[0-9]|3[0-1])\./,/^192\.168\./,/^::1$/,/^fc00:/,/^fe80:/],f=new Set(["UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","SELF_SIGNED_CERT_IN_CHAIN","DEPTH_ZERO_SELF_SIGNED_CERT","CERT_HAS_EXPIRED","ERR_TLS_CERT_ALTNAME_INVALID"]),T=new Set([...f,"ECONNRESET","ETIMEDOUT","ECONNREFUSED","ENOTFOUND","EAI_AGAIN","EHOSTUNREACH","ENETUNREACH"]),u=class extends Error{constructor(t,o){super(t);this.code=o;this.name="FetchError"}};function S(n){try{let e=new g(n).hostname;return l.some(t=>t.test(e))}catch{return!1}}async function A(n,e,t){let o=new AbortController,r=setTimeout(()=>o.abort(),e);try{return await fetch(n,{signal:o.signal,headers:t})}catch(s){throw a(s)&&s.code==="ABORT_ERR"?new u(`Request timed out after ${e}ms`,"ETIMEDOUT"):new u(c(s))}finally{clearTimeout(r)}}function i(n){if(!(!n||typeof n!="object")&&"code"in n&&typeof n.code=="string")return n.code}function h(n){if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return String(n);if(n instanceof Error)return n.message;if(!n||typeof n!="object")return;let e=n.message;if(typeof e=="string")return e}function m(n){if(!(n instanceof Error))return;let e=n.cause;if(!e)return;let t=i(e),o=h(e);if(!(!t&&!o))return t&&o&&!o.includes(t)?`${t}: ${o}`:o??t}function N(n,e={}){let t=c(n),o=n instanceof Error?i(n.cause)??i(n):i(n),r=m(n),s=[t,r?`(cause: ${r})`:void 0].filter(Boolean).join(" "),d=t.toLowerCase().includes("fetch failed")||o!=null&&T.has(o),R=o!=null&&f.has(o);if(!d)return s;let _=["","Troubleshooting:",...e.url?[`- Confirm you can reach ${e.url} from this machine.`]:[],"- If you are behind a proxy, pass `--proxy <url>` (or set `proxy` in settings).",...R?["- If your network uses a corporate TLS inspection CA, set `NODE_EXTRA_CA_CERTS` to your CA bundle."]:[]];return`${s}${_.join(`
|
|
4
4
|
`)}`}export{S as a,A as b,N as c};
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{w as i}from"./chunk-
|
|
3
|
+
import{w as i}from"./chunk-FSHP4T24.js";import{b as o}from"./chunk-GZPNIYVZ.js";o();import l from"node:path";function d(t,n){if(t.getApprovalMode()!=="bogan")return null;let r=l.resolve(n),s=t.getProjectRoot?.()??t.getTargetDir();if(i(r,s))return null;let e=t.getWorkspaceContext?.();if(!e||(typeof e.isPathWithinWorkspaceFresh=="function"?e.isPathWithinWorkspaceFresh(r):e.isPathWithinWorkspace(r)))return null;let a=e.getDirectories?.()??[t.getTargetDir()],p=t.getChannel?.()==="desktop"?"Approve the folder from Matilda Desktop, then retry the write.":"Use --include-directories to add extra roots, or a non-BOGAN approval mode for intentional external writes.";return`Refusing out-of-workspace write in BOGAN mode: ${r}. Workspace root(s): ${a.join(", ")}. This blocks path typos (e.g. writing under $HOME when the project is elsewhere). `+p}export{d as a};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Matilda Team
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Ii as K,wf as X,yf as H}from"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{i as S}from"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as B,i as G}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as d}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";d();d();d();import{homedir as ye}from"node:os";d();import{join as I}from"node:path";import{homedir as R}from"node:os";var l="0.5.2",ue="https://matilda.maincode.com/assets/computer-use",me="https://github.com/trycua/cua/releases/download";function E(e=process.platform,t=process.arch,o=l){let r=o;if(e==="darwin"){let n=`cua-driver-rs-${r}-${t==="arm64"?"darwin-arm64":"darwin-x86_64"}`;return{asset:`${n}.tar.gz`,extractDir:n,binaryRelPath:"CuaDriver.app/Contents/MacOS/cua-driver",hasApp:!0}}if(e==="linux"){if(t!=="x64")throw new Error(`Computer Use: unsupported Linux arch '${t}' (only x64).`);return{asset:`cua-driver-rs-${r}-linux-x86_64-binary.tar.gz`,extractDir:".",binaryRelPath:"cua-driver",hasApp:!1}}if(e==="win32"){let n=`cua-driver-rs-${r}-${t==="arm64"?"windows-arm64":"windows-x86_64"}`;return{asset:`${n}.zip`,extractDir:n,binaryRelPath:"cua-driver.exe",hasApp:!1}}throw new Error(`Computer Use: unsupported platform '${e}'.`)}function U(e,t=process.env,o=l){let r=[],i=t.MATILDA_COMPUTER_USE_DOWNLOAD_HOST;return i&&r.push(`${ge(i)}/cua-driver-rs/v${o}/${e}`),r.push(`${ue}/cua-driver-rs/v${o}/${e}`),r.push(`${me}/cua-driver-rs-v${o}/${e}`),r}function J(e=process.env,t=l){return U("checksums.txt",e,t)}var he="MATILDA_COMPUTER_USE_MAX_IMAGE_DIMENSION";function V(e){if(e===void 0||typeof e=="string"&&e.trim()==="")return;let t=typeof e=="number"?e:Number(e);if(!(!Number.isInteger(t)||t<0))return t}function Y(e,t=process.env){let o=V(t[he]);return o!==void 0?o:V(e)}function fe(e=R()){return I(e,".matilda","computer-use")}function N(e=R(),t=l){return I(fe(e),`cua-driver-rs-${t}`)}function u(e=R(),t=process.platform,o=process.arch,r=l){let i=E(t,o,r);return I(N(e,r),i.extractDir,i.binaryRelPath)}function h(e=l){return`cua-driver-rs@${e}`}function ge(e){return e.endsWith("/")?e.slice(0,-1):e}var f=class e{static singleton;binary;onProgress;maxImageDimension;client;startPromise;constructor(t){this.binary=t.binary,this.onProgress=t.onProgress??(()=>{}),this.maxImageDimension=t.maxImageDimension}setMaxImageDimension(t){this.maxImageDimension=t}static shared(){return e.singleton||(e.singleton=new e({binary:u(ye())})),e.singleton}static setSharedForTest(t){e.singleton=t}isStarted(){return this.client!==void 0}async start(t){if(!this.client)return this.startPromise?this.startPromise:(this.startPromise=this.doStart(t).finally(()=>{this.startPromise=void 0}),this.startPromise)}async doStart(t){let o=t??this.onProgress;o("Starting Computer Use driver...");let r=new H({command:this.binary,args:["mcp"],env:{...process.env}}),i=new X({name:"matilda-code-computer-use",version:"1.0.0"},{capabilities:{}});await i.connect(r),this.client=i,await this.applyRuntimeConfig(i,o)}async applyRuntimeConfig(t,o){if(this.maxImageDimension!==void 0)try{await t.callTool({name:"set_config",arguments:{max_image_dimension:this.maxImageDimension}})}catch(r){let i=r instanceof Error?r.message:String(r);o(`Computer Use: could not apply max_image_dimension=${this.maxImageDimension} (${i}); using driver default.`)}}async listTools(){if(!this.client)throw new Error("ComputerUseClient not started");return this.client.listTools()}async callTool(t,o){if(!this.client)throw new Error("ComputerUseClient not started");try{return await this.client.callTool({name:t,arguments:o})}catch(r){if(!Q(r))throw r;let i=r;for(let n=0;n<3;n++){if(await this.stop(),await this.start(),!this.client)throw new Error("ComputerUseClient reconnect failed");try{return await this.client.callTool({name:t,arguments:o})}catch(s){if(!Q(s))throw s;i=s,await new Promise(a=>setTimeout(a,1e3))}}throw i}}async stop(){let t=this.client;if(this.client=void 0,t)try{await t.close()}catch{}}};function Q(e){let t=e instanceof Error?e.message:String(e);return/connection closed|not connected|connection refused|daemon transport error|os error 61/i.test(t)}d();var M=["bring_to_front","check_for_update","check_permissions","click","double_click","drag","end_session","get_accessibility_tree","get_agent_cursor_state","get_config","get_cursor_position","get_recording_state","get_screen_size","get_window_state","hotkey","kill_app","launch_app","list_apps","list_windows","move_cursor","page","press_key","replay_trajectory","right_click","scroll","set_agent_cursor_enabled","set_agent_cursor_motion","set_agent_cursor_style","set_config","set_value","start_recording","start_session","stop_recording","type_text","zoom"],g={bring_to_front:{description:'Activate a window so subsequent input tools with `dispatch:"foreground"` land on it without a per-call SetForegroundWindow flash. **Windows-only:** on macOS this tool returns an error pointing to the platform-native `NSRunningApplication.activate` (which the macOS input tools don\'t need because CGEvent.postToPid reaches backgrounded windows). On Linux this tool also stubs out; use `wmctrl -a` or `xdotool windowactivate` if you need explicit activation.',parameterSchema:{additionalProperties:!1,properties:{pid:{type:"integer"},window_id:{type:"integer"}},required:["pid"],type:"object"}},check_for_update:{description:"Check whether a newer cua-driver-rs release is available on GitHub. Returns the current and latest versions, an `update_available` boolean, the install one-liner, and the release notes URL. Read-only \u2014 never installs. Mirror of `cua-driver check-update --json`.",parameterSchema:{additionalProperties:!1,properties:{},type:"object"}},check_permissions:{description:"Report TCC permission status for Accessibility and Screen Recording. By default also raises the system permission dialogs for any missing grants \u2014 Apple's request APIs are no-ops when the grant is already active, so this is safe to call repeatedly. Pass {\"prompt\": false} for a purely read-only status check.\n\nReturns: `accessibility` + `screen_recording` (booleans from the TCC preflight APIs), `screen_recording_capturable` (a live ScreenCaptureKit probe \u2014 if it disagrees with `screen_recording`, the preflight grant belongs to a different process), and `source` (which TCC identity the booleans reflect: the CuaDriver daemon vs the launching terminal/IDE). macOS attributes grants to the responsible process, so a standalone call from a terminal reports the terminal's grants, not the driver's.",parameterSchema:{additionalProperties:!1,properties:{prompt:{description:"Raise the system permission prompts for missing grants. Default true.",type:"boolean"}},type:"object"}},click:{description:`Left-click against a target pid. **Prefer \`element_index\` over pixel coordinates** \u2014 element_index works on backgrounded / minimized / hidden / off-Space windows, surfaces a stable handle that survives rebuilds, and tells you what you're clicking via the cached element's role + label. Reach for \`x, y\` only when the target is a canvas / video / WebGL / custom-drawn surface that doesn't appear in the AX tree.
|
|
4
4
|
|
|
5
5
|
Two addressing modes:
|
|
6
6
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{c as a,d as b,e as c}from"./chunk-B5CUDYSI.js";import"./chunk-KA6DHH7N.js";import"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{a as collectContextData,c as contextCommand,b as formatContextUsageText};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as p,c as f}from"./chunk-TXMXCR7D.js";import{a as y}from"./chunk-YULUB745.js";import{a as n}from"./chunk-
|
|
3
|
+
import{a as p,c as f}from"./chunk-TXMXCR7D.js";import{a as y}from"./chunk-YULUB745.js";import{a as n}from"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import{g as m,i as c,p as d,q as h}from"./chunk-AEKLF65D.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as u}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";u();var i=class extends m{constructor(e,t){super(t);this.config=e}getDescription(){return`${this.params.cron}: ${this.params.prompt}`}async getDefaultPermission(){return"ask"}async execute(){let e=this.config.getCronScheduler(),t=this.params.recurring!==!1,s=this.params.durable===!0;try{p(this.params.cron),f(this.params.cron,new Date);let r=s?await e.createDurable(this.params.cron,this.params.prompt,t):e.create(this.params.cron,this.params.prompt,t),o=y(r.cronExpr),w=`Scheduled ${r.id} (${o})${s?" [durable]":""}`,l=s?`Persisted to ${n}`:"Session-only (not written to disk, dies when Matilda exits)";return{llmContent:t?`Scheduled recurring job ${r.id} (${r.cronExpr}). ${l}. Auto-expires after 7 days. Use CronDelete to cancel sooner.`:`Scheduled one-shot task ${r.id} (${r.cronExpr}). ${l}. It will fire once then auto-delete.`,returnDisplay:w}}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error creating cron job: ${o}`,returnDisplay:o,error:{message:o}}}}},g=class a extends c{constructor(e){super(a.Name,h.CRON_CREATE,`Schedule a prompt to be enqueued at a future time. Use for both recurring schedules and one-shot reminders.
|
|
4
4
|
|
|
5
5
|
Uses standard 5-field cron in the user's local timezone: minute hour day-of-month month day-of-week. "0 9 * * *" means 9am local \u2014 no timezone conversion needed.
|
|
6
6
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as d,f as u}from"./chunk-
|
|
3
|
+
import{a as d,f as u}from"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import{g as l,i as c,p as m,q as p}from"./chunk-AEKLF65D.js";import"./chunk-PLMDDD2P.js";import{c as n}from"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as i}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";i();var s=class extends l{constructor(r,o){super(o);this.config=r}getDescription(){return this.params.id}async execute(){let r=this.config.getCronScheduler(),o;try{o=await r.delete(this.params.id),o||(o=await u(this.config.getProjectRoot(),[this.params.id])>0)}catch(e){let t=`Failed to cancel job ${this.params.id}: ${n(e)}`;return{llmContent:t,returnDisplay:t,error:{message:t}}}if(o){let e=`Cancelled job ${this.params.id}.`,t=`Cancelled ${this.params.id}`;return{llmContent:e,returnDisplay:t}}else{let e=`Job ${this.params.id} not found.`;return{llmContent:e,returnDisplay:e,error:{message:e}}}}},f=class a extends c{constructor(r){super(a.Name,p.CRON_DELETE,`Cancel a cron job previously scheduled with CronCreate. Removes it from the in-memory session store or from ${d} (durable jobs).`,"other",{type:"object",properties:{id:{type:"string",description:"Job ID returned by CronCreate."}},required:["id"],additionalProperties:!1},!0,!1,!0,!1,"cron delete cancel remove");this.config=r}static Name=m.CRON_DELETE;createInvocation(r){return new s(this.config,r)}};export{f as CronDeleteTool};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as m}from"./chunk-YULUB745.js";import{a as d,c as g}from"./chunk-
|
|
3
|
+
import{a as m}from"./chunk-YULUB745.js";import{a as d,c as g}from"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import{g as l,i as c,p,q as u}from"./chunk-AEKLF65D.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as a}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";a();var s=class extends l{constructor(e,t){super(t);this.config=e}getDescription(){return""}async execute(){let e=this.config.getCronScheduler(),t;try{t=await g(this.config.getProjectRoot())}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error listing cron jobs: ${o}`,returnDisplay:o,error:{message:o}}}let n=[...t.map(r=>({id:r.id,cron:r.cron,prompt:r.prompt,recurring:r.recurring,durable:!0})),...e.list().filter(r=>!r.durable).map(r=>({id:r.id,cron:r.cronExpr,prompt:r.prompt,recurring:r.recurring,durable:!1}))];if(n.length===0){let r="No active cron jobs.";return{llmContent:r,returnDisplay:r}}let y=n.map(r=>{let o=r.recurring?"recurring":"one-shot",h=r.durable?"durable":"session-only";return`${r.id} \u2014 ${r.cron} (${o}) [${h}]: ${r.prompt}`}).join(`
|
|
4
4
|
`),T=n.map(r=>`${r.id} ${m(r.cron)} [${r.durable?"durable":"session-only"}]`).join(`
|
|
5
5
|
`);return{llmContent:y,returnDisplay:T}}},f=class i extends c{constructor(e){super(i.Name,u.CRON_LIST,`List all cron jobs scheduled via CronCreate, both session-only and durable (${d}).`,"other",{type:"object",properties:{},additionalProperties:!1},!0,!1,!0,!1,"cron list scheduled jobs");this.config=e}static Name=p.CRON_LIST;createInvocation(e){return new s(this.config,e)}};export{f as CronListTool};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as y}from"./chunk-
|
|
3
|
+
import{a as y}from"./chunk-YTWIKYJZ.js";import{Me as R,Ne as x,Te as X,Ue as V,Xe as Q,_e as Y,ja as I,re as A,se as G,uc as q,ze as K}from"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{Lb as z,Oa as j,_c as H,ca as U,ha as N,wc as D}from"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{w as B}from"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{i as k,p as P,q as W}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{A as S,C as M,Y as $,a as C,z as w}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as T}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";T();import*as m from"node:fs";import*as u from"node:path";T();var se={"\u2010":"-","\u2011":"-","\u2012":"-","\u2013":"-","\u2014":"-","\u2015":"-","\u2212":"-","\u2018":"'","\u2019":"'","\u201A":"'","\u201B":"'","\u201C":'"',"\u201D":'"',"\u201E":'"',"\u201F":'"',"\xA0":" ","\u2002":" ","\u2003":" ","\u2004":" ","\u2005":" ","\u2006":" ","\u2007":" ","\u2008":" ","\u2009":" ","\u200A":" ","\u202F":" ","\u205F":" ","\u3000":" "};function L(n){if(n==="")return n;let t="";for(let i of n)t+=se[i]??i;return t}var ae=[n=>n,n=>n.trimEnd()];function ce(n){return L(n).trimEnd()}function J(n,t,i){if(t.length===0)return 0;if(t.length>n.length)return null;e:for(let e=0;e<=n.length-t.length;e++){for(let r=0;r<t.length;r++)if(i(n[e+r])!==i(t[r]))continue e;return e}return null}function fe(n){let t=n.split(`
|
|
4
4
|
`),i=new Array(t.length+1),e=0;for(let r=0;r<t.length;r++)i[r]=e,e+=t[r].length,r<t.length-1&&(e+=1);return i[t.length]=n.length,{lines:t,offsets:i}}function Z(n,t,i,e,r,o){if(r===0)return o?`
|
|
5
5
|
`:"";let f=t[e]??0,l=e+r-1,c=(t[l]??0)+(i[l]?.length??0);if(o){let g=t[e+r];g!==void 0?c=g:n.endsWith(`
|
|
6
6
|
`)&&(c=n.length)}return n.slice(f,c)}function de(n,t){let{lines:i,offsets:e}=fe(n),r=t.split(`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Pj as T,Uf as W,ag as s}from"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as $,i as E,p as m,q as R}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as b}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as y}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";y();var o=b("ENTER_WORKTREE"),P=`Creates an isolated git worktree at \`<projectRoot>/.matilda/worktrees/<slug>\` and returns its absolute path so subsequent file edits, shell commands, and other tools can operate inside it.
|
|
4
4
|
|
|
5
5
|
## When to Use
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{I as r}from"./chunk-
|
|
3
|
+
import{I as r}from"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as m,i as u,p as d,q as c}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as p}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as l}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";l();var y=p("ENTER_PLAN_MODE"),g=`Use this tool to lower into plan mode before doing uncertain or complex work. Entering plan mode is a privilege reduction, so it does not require user confirmation.
|
|
4
4
|
|
|
5
5
|
## When to Use This Tool
|
|
6
6
|
Use this tool when the task is not yet clear enough to safely execute, for example when it requires multi-file changes, design choices, investigation before a plan can be summarized, or when requirements are ambiguous. While investigating, if complexity rises or you find yourself repeatedly needing to ask the user, enter plan mode and consolidate a plan.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Oj as C,Qj as x,Sf as k,Vf as W,ag as l}from"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as E,i as R,p as c,q as T}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as b,a as $}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as y}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";y();import*as S from"node:fs/promises";var h=b("EXIT_WORKTREE"),O=`Exits a worktree previously created by ${c.ENTER_WORKTREE}.
|
|
4
4
|
|
|
5
5
|
## Behavior
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as k}from"./chunk-ILBTI4K5.js";import{
|
|
3
|
+
import{a as k}from"./chunk-ILBTI4K5.js";import{I as w,If as M,lg as $}from"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as G,i as R,p as T,q as _}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{Y as f}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as h}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";h();h();h();var E=f("GATE_REVIEW_AGENTS");function L(n){return`You are a Plan Design Reviewer for the Plan Approval Gate. Review the plan across three dimensions:
|
|
4
4
|
|
|
5
5
|
1. **Request Fit** \u2014 Does the plan fulfill every part of the user's original request and respect all explicit constraints? Does it do anything the user explicitly asked NOT to do?
|
|
6
6
|
2. **System Fit** \u2014 Does the plan align with the codebase structure, file paths, function names, permission model, and integration boundaries found during investigation?
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as g}from"./chunk-
|
|
3
|
+
import{a as g}from"./chunk-J3CHXXMF.js";import{g as u}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{f as d}from"./chunk-SDTWBD62.js";import"./chunk-PLMDDD2P.js";import"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as m}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";m();m();var p=class{googleGenAI;contentGeneratorConfig;constructor(e,t){let r=t?.customHeaders,n=r?(()=>{let i=e.httpOptions,s=i?.headers??{},l=Object.fromEntries(Object.entries(r).filter(([a])=>!d(a)));return{...e,httpOptions:{...i??{},headers:{...s,...l}}}})():e;this.googleGenAI=new u(n),this.contentGeneratorConfig=t}buildGenerateContentConfig(e){let t=this.contentGeneratorConfig?.samplingParams,r=e.config||{},n=(i,s,l)=>{let a=r[s];return i!==void 0?i:a!==void 0?a:l};return{...r,temperature:n(t?.temperature,"temperature",1),topP:n(t?.top_p,"topP",.95),topK:n(t?.top_k,"topK",64),maxOutputTokens:n(t?.max_tokens,"maxOutputTokens"),presencePenalty:n(t?.presence_penalty,"presencePenalty"),frequencyPenalty:n(t?.frequency_penalty,"frequencyPenalty"),thinkingConfig:n(this.buildThinkingConfig(),"thinkingConfig",{includeThoughts:!0,thinkingLevel:"THINKING_LEVEL_UNSPECIFIED"})}}buildThinkingConfig(){let e=this.contentGeneratorConfig?.reasoning;if(e===!1)return{includeThoughts:!1};if(e)return{includeThoughts:!0,thinkingLevel:e.effort==="low"?"LOW":e.effort==="high"||e.effort==="max"?"HIGH":"THINKING_LEVEL_UNSPECIFIED"}}async generateContent(e,t){let r={...e,contents:this.stripUnsupportedFields(e.contents),config:this.buildGenerateContentConfig(e)};return this.googleGenAI.models.generateContent(r)}async generateContentStream(e,t){let r={...e,contents:this.stripUnsupportedFields(e.contents),config:this.buildGenerateContentConfig(e)};return this.googleGenAI.models.generateContentStream(r)}stripUnsupportedFields(e){return!e||typeof e=="string"?e:Array.isArray(e)?e.map(t=>this.stripContentFields(t)):this.stripContentFields(e)}stripContentFields(e){if(typeof e=="string")return e;if(!("role"in e)&&!("parts"in e))return this.stripPartFields(e);let t=e;return t.parts?{...t,parts:t.parts.map(r=>this.stripPartFields(r))}:t}stripPartFields(e){if(typeof e=="string")return e;let t={...e};if(t.inlineData){let{displayName:r,...n}=t.inlineData;t.inlineData=n}if(t.fileData){let{displayName:r,...n}=t.fileData;t.fileData=n}if(t.functionResponse?.parts){let r=t.functionResponse.parts.map(n=>{let i=this.convertUnsupportedMediaToText(n);return this.stripPartFields(i)});t.functionResponse={...t.functionResponse,parts:r}}return t}convertUnsupportedMediaToText(e){if(typeof e=="string")return e;let t=e.inlineData?.mimeType||"",r=e.fileData?.mimeType||"";if(t.startsWith("audio/")||t.startsWith("video/")){let n=e.inlineData?.displayName,i=n?` (${n})`:"";return{text:`Unsupported media type for Gemini: ${t}${i}.`}}if(r.startsWith("audio/")||r.startsWith("video/")){let n=e.fileData?.displayName,i=n?` (${n})`:"";return{text:`Unsupported media type for Gemini: ${r}${i}.`}}return e}async countTokens(e){return this.googleGenAI.models.countTokens(e)}async embedContent(e){return this.googleGenAI.models.embedContent(e)}useSummarizedThinking(){return!0}};function T(o,e){let i={...{"User-Agent":o.userAgent||`MatildaCode/0.21.4-nightly.20260906.7e39d84e0 (${process.platform}; ${process.arch})`}};if(e?.getUsageStatisticsEnabled()){let f=new g().getInstallationId();i={...i,"x-gemini-api-privileged-user-id":`${f}`}}let s=o.baseUrl?{headers:i,baseUrl:o.baseUrl}:{headers:i};return new p({apiKey:o.apiKey===""?void 0:o.apiKey,vertexai:o.vertexai,httpOptions:s},o)}export{p as GeminiContentGenerator,T as createGeminiContentGenerator};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Google LLC
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Qe as _,Re as j}from"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import{b as D}from"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{g as k}from"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as M,i as C,p as N,q as A}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{C as $,F as O,J as v,Y as R,c as x}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as L}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";L();import z from"node:fs";import T from"node:path";var V=R("GLOB"),Y=100,B=2e4,W=15e3,q=500;function K(u,g,t){let e=[...u];return e.sort((r,s)=>{let c=r.mtimeMs??0,a=s.mtimeMs??0,o=g-c<t,l=g-a<t;return o&&l?a-c:o?-1:l?1:r.fullpath().localeCompare(s.fullpath())}),e}var S=class extends M{constructor(t,e){super(e);this.config=t;this.fileService=t.getFileService()}fileService;getDescription(){let t=`'${this.params.pattern}'`;return this.params.path&&(t+=` in path '${this.params.path}'`),t}async getDefaultPermission(){if(!this.params.path)return"allow";let t=this.config.getWorkspaceContext(),e=T.resolve(this.config.getTargetDir(),this.params.path);return t.isPathWithinWorkspace(e)||O(k(),e)?"allow":"ask"}async globInDirectory(t,e,r){let s=e,c=T.join(t,s);z.existsSync(c)&&(s=_(s));let a=j(s,{cwd:t,withFileTypes:!0,nodir:!0,stat:!0,nocase:!0,dot:!0,ignore:this.config.getFileExclusions().getGlobExcludes(),follow:!1,signal:r}),o=[],l=Date.now(),p=null;for await(let n of a){if(o.push(n),o.length>=B){p="count";break}if(Date.now()-l>W){p="time";break}o.length%q===0&&await new Promise(b=>setImmediate(b))}p&&a.destroy?.();let d=this.config.getTargetDir(),P=o.map(n=>T.relative(d,n.fullpath())),{filteredPaths:m}=this.fileService.filterFilesWithReport(P,this.getFileFilteringOptions()),h=n=>process.platform==="win32"||process.platform==="darwin"?n.toLowerCase():n,f=new Set(m.map(n=>h(T.resolve(d,n))));return{entries:o.filter(n=>f.has(h(n.fullpath()))),limited:p}}async execute(t){try{let e=[],r;if(this.params.path){let i=v(this.config,this.params.path,{allowExternalPaths:!0});e.push(i),r=`within ${i}`}else{let i=this.config.getWorkspaceContext().getDirectories();e.push(...i),r=i.length>1?`across ${i.length} workspace directories`:"in the workspace directory"}let s=this.params.pattern,c=[],a=new Set,o=null;for(let i of e){let{entries:F,limited:E}=await this.globInDirectory(i,s,t);E&&(o=E);for(let G of F){let I=G.fullpath();a.has(I)||(a.add(I),c.push(G))}}let l=c,p=o==="time"?`
|
|
4
4
|
|
|
5
5
|
[Search stopped after ${W/1e3}s before scanning the whole tree. Results may be incomplete \u2014 narrow the search by passing a more specific 'path' or pattern.]`:o==="count"?`
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{Kj as K,Lj as Y,Re as z,aa as q,fd as F}from"./chunk-TJNV45ZB.js";import"./chunk-TZIDSCTF.js";import"./chunk-CENHHSEM.js";import"./chunk-HDKF447N.js";import"./chunk-PGDQTSIQ.js";import"./chunk-VU5XQRL6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-M3ORBG44.js";import"./chunk-TISQNFB5.js";import"./chunk-2I2V4XUL.js";import"./chunk-47XR7IMP.js";import"./chunk-KCXJKSZQ.js";import"./chunk-QKYGQLWC.js";import"./chunk-GQ2YYAZL.js";import"./chunk-QR3OCHRD.js";import"./chunk-RNKDFE2S.js";import"./chunk-J3CHXXMF.js";import"./chunk-V2MZCFBR.js";import"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{g as _}from"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import{g as U,i as V,p as H,q as J}from"./chunk-AEKLF65D.js";import"./chunk-UCSBOBSQ.js";import"./chunk-YLQBVW4X.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{C as O,F as W,J as S,Y as j,a as I,c as P}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as B}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";B();import tt from"node:fs/promises";import y from"node:path";import{EOL as et}from"node:os";import{spawn as X}from"node:child_process";var k=j("GREP"),M=class extends U{constructor(e,s){super(s);this.config=e;this.fileExclusions=e.getFileExclusions()}fileExclusions;async getDefaultPermission(){if(!this.params.path)return"allow";let e=this.config.getWorkspaceContext(),s=y.resolve(this.config.getTargetDir(),this.params.path);return e.isPathWithinWorkspace(s)||W(_(),s)?"allow":"ask"}async execute(e){try{let s=[],i;if(this.params.path){let t=S(this.config,this.params.path,{allowExternalPaths:!0});s.push(t),i=`in path "${this.params.path}"`}else{let t=this.config.getWorkspaceContext().getDirectories();s.push(...t),i=t.length>1?`across ${t.length} workspace directories`:"in the workspace directory"}let l=[];for(let t of s){let o=await this.performGrepSearch({pattern:this.params.pattern,path:t,glob:this.params.glob,signal:e});if(s.length>1)for(let a of o)y.isAbsolute(a.filePath)||(a.filePath=y.resolve(t,a.filePath));l.push(...o)}if(s.length>1){let t=new Set;l=l.filter(o=>{let a=`${o.filePath}:${o.lineNumber}`;return t.has(a)?!1:(t.add(a),!0)})}let f=this.params.glob?` (filter: "${this.params.glob}")`:"";if(l.length===0)return{llmContent:`No matches found for pattern "${this.params.pattern}" ${i}${f}.`,returnDisplay:"No matches found"};let h=this.config.getTruncateToolOutputThreshold(),w=Math.min(this.config.getTruncateToolOutputLines(),this.params.limit??Number.POSITIVE_INFINITY),$=!1,C=l;l.length>w&&(C=l.slice(0,w),$=!0);let E=l.length,x=E===1?"match":"matches",G=`Found ${E} ${x} for pattern "${this.params.pattern}" ${i}${f}:
|
|
4
4
|
---
|
|
5
5
|
`,v=C.reduce((t,o)=>{let a=o.filePath;return t[a]||(t[a]=[]),t[a].push(o),t[a].sort((L,D)=>L.lineNumber-D.lineNumber),t},{}),n="",g=[],m=!1,c=(t,o)=>Number.isFinite(h)&&n.length+t.length>h?(n+=t.slice(0,Math.max(h-n.length,0)),n+="...",o&&g.push(o),m=!0,!1):(n+=t,o&&g.push(o),!0);for(let t in v){if(!c(`File: ${t}
|
|
6
6
|
`))break;let o=!1;for(let a of v[t]){let L=a.line.trim();if(!c(`L${a.lineNumber}: ${L}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{b as a}from"./chunk-
|
|
3
|
+
import{b as a}from"./chunk-KCXJKSZQ.js";import"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{a as KeychainTokenStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{b as d}from"./chunk-RNKDFE2S.js";import{g as N}from"./chunk-
|
|
3
|
+
import{b as d}from"./chunk-RNKDFE2S.js";import{g as N}from"./chunk-FSHP4T24.js";import{g as C,i as x,p as w,q as F}from"./chunk-AEKLF65D.js";import{A as I,C as S,F as u,G as L,L as R,Y as O,z as E}from"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as v}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";v();import y from"node:fs/promises";import s from"node:path";var A=O("LS"),U=100,T=class extends C{constructor(t,e){super(e);this.config=t}shouldIgnore(t,e){if(!e||e.length===0)return!1;for(let i of e){let a=i.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");if(new RegExp(`^${a}$`).test(t))return!0}return!1}getDescription(){let t=I(this.params.path,this.config.getTargetDir());return E(t)}async getDefaultPermission(){let t=s.resolve(this.params.path),e=this.config.getWorkspaceContext(),i=this.config.storage.getUserSkillsDirs(),a=R.getUserExtensionsDir();return e.isPathWithinWorkspace(t)||L(i,t)||u(a,t)||u(N(),t)?"allow":"ask"}errorResult(t,e,i){return{llmContent:t,returnDisplay:`Error: ${e}`,error:{message:t,type:i}}}async execute(t){try{let e=await y.stat(this.params.path);if(!e)return this.errorResult(`Error: Directory not found or inaccessible: ${this.params.path}`,"Directory not found or inaccessible.","file_not_found");if(!e.isDirectory())return this.errorResult(`Error: Path is not a directory: ${this.params.path}`,"Path is not a directory.","path_is_not_a_directory");let i=await y.readdir(this.params.path);if(i.length===0)return{llmContent:`Directory ${this.params.path} is empty.`,returnDisplay:"Directory is empty."};let a=i.map(r=>s.relative(this.config.getTargetDir(),s.join(this.params.path,r))),_=this.config.getFileService(),{filteredPaths:k,gitIgnoredCount:P,matildaIgnoredCount:b}=_.filterFilesWithReport(a,{respectGitIgnore:this.params.file_filtering_options?.respect_git_ignore??this.config.getFileFilteringOptions().respectGitIgnore??d.respectGitIgnore,respectMatildaIgnore:this.params.file_filtering_options?.respect_matilda_ignore??this.config.getFileFilteringOptions().respectMatildaIgnore??d.respectMatildaIgnore}),l=[];for(let r of k){let o=s.resolve(this.config.getTargetDir(),r);if(!this.shouldIgnore(s.basename(o),this.params.ignore))try{let c=await y.stat(o),$=c.isDirectory();l.push({name:s.basename(o),path:o,isDirectory:$,size:$?0:c.size,modifiedTime:c.mtime})}catch(c){A.warn(`Error accessing ${o}: ${c}`)}}l.sort((r,o)=>r.isDirectory&&!o.isDirectory?-1:!r.isDirectory&&o.isDirectory?1:r.name.localeCompare(o.name));let p=l.length,g=Math.min(U,this.config.getTruncateToolOutputLines()),m=p>g,W=(m?l.slice(0,g):l).map(r=>`${r.isDirectory?"[DIR] ":""}${r.name}`).join(`
|
|
4
4
|
`),h=`Listed ${p} item(s) in ${this.params.path}:
|
|
5
5
|
---
|
|
6
6
|
${W}`;if(m){let r=p-g;h+=`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{g as b,i as D,p as R,q as N}from"./chunk-
|
|
3
|
+
import{g as b,i as D,p as R,q as N}from"./chunk-AEKLF65D.js";import{C as P}from"./chunk-WGPRIGRF.js";import"./chunk-FWDMPRKU.js";import{b as S}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";S();import $ from"node:path";import{fileURLToPath as L,pathToFileURL as q}from"node:url";var O=new Set(["goToDefinition","findReferences","hover","goToImplementation","prepareCallHierarchy"]),A=new Set(["documentSymbol","diagnostics"]),E=new Set(["workspaceSymbol"]),U=new Set(["incomingCalls","outgoingCalls"]),W=new Set(["codeActions"]),C=class extends b{constructor(t,e){super(e);this.config=t}getDescription(){let t=this.getOperationLabel();return this.params.operation==="workspaceSymbol"?`LSP ${t} for "${this.params.query??""}"`:this.params.operation==="documentSymbol"?this.params.filePath?`LSP ${t} for ${this.params.filePath}`:`LSP ${t}`:this.params.operation==="incomingCalls"||this.params.operation==="outgoingCalls"?`LSP ${t} for ${this.describeCallHierarchyItemShort()}`:this.params.filePath&&this.params.line!==void 0?`LSP ${t} at ${this.params.filePath}:${this.params.line}:${this.params.character??1}`:this.params.filePath?`LSP ${t} for ${this.params.filePath}`:`LSP ${t}`}async execute(t){let e=this.config.getLspClient();if(!e||!this.config.isLspEnabled()){let r=`LSP ${this.getOperationLabel()} is unavailable (LSP disabled or not initialized).`;return{llmContent:r,returnDisplay:r}}switch(this.params.operation){case"goToDefinition":return this.executeDefinitions(e);case"findReferences":return this.executeReferences(e);case"hover":return this.executeHover(e);case"documentSymbol":return this.executeDocumentSymbols(e);case"workspaceSymbol":return this.executeWorkspaceSymbols(e);case"goToImplementation":return this.executeImplementations(e);case"prepareCallHierarchy":return this.executePrepareCallHierarchy(e);case"incomingCalls":return this.executeIncomingCalls(e);case"outgoingCalls":return this.executeOutgoingCalls(e);case"diagnostics":return this.executeDiagnostics(e);case"workspaceDiagnostics":return this.executeWorkspaceDiagnostics(e);case"codeActions":return this.executeCodeActions(e);default:{let r=`Unsupported LSP operation: ${this.params.operation}`;return{llmContent:r,returnDisplay:r}}}}async executeDefinitions(t){let e=this.resolveLocationTarget();if("error"in e)return{llmContent:e.error,returnDisplay:e.error};let r=this.params.limit??20,i=[];try{i=await t.definitions(e.location,this.params.serverName,r)}catch(n){let c=`LSP go-to-definition failed: ${n?.message||String(n)}`;return{llmContent:c,returnDisplay:c}}if(!i.length){let n=`No definitions found for ${e.description}.`;return{llmContent:n,returnDisplay:n}}let s=this.config.getProjectRoot(),a=i.slice(0,r).map((n,c)=>`${c+1}. ${this.formatLocationWithServer(n,s)}`);return{llmContent:[`Definitions for ${e.description}:`,...a].join(`
|
|
4
4
|
`),returnDisplay:a.join(`
|
|
5
5
|
`)}}async executeImplementations(t){let e=this.resolveLocationTarget();if("error"in e)return{llmContent:e.error,returnDisplay:e.error};let r=this.params.limit??20,i=[];try{i=await t.implementations(e.location,this.params.serverName,r)}catch(n){let c=`LSP go-to-implementation failed: ${n?.message||String(n)}`;return{llmContent:c,returnDisplay:c}}if(!i.length){let n=`No implementations found for ${e.description}.`;return{llmContent:n,returnDisplay:n}}let s=this.config.getProjectRoot(),a=i.slice(0,r).map((n,c)=>`${c+1}. ${this.formatLocationWithServer(n,s)}`);return{llmContent:[`Implementations for ${e.description}:`,...a].join(`
|
|
6
6
|
`),returnDisplay:a.join(`
|
package/chunks/{matildaAgentContentGenerator-EIQI4YCP.js → matildaAgentContentGenerator-AQRSR5YF.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{M as F,N as U,O as j,g as x,la as $}from"./chunk-
|
|
3
|
+
import{M as F,N as U,O as j,g as x,la as $}from"./chunk-CKIXP6AV.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-DGVOK3TF.js";import{b as m,e as b}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{k as O,n as I}from"./chunk-SDTWBD62.js";import"./chunk-KLXSWVST.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-FSHP4T24.js";import"./chunk-R24IGHRQ.js";import"./chunk-AEKLF65D.js";import"./chunk-3YLXGE6T.js";import"./chunk-PLMDDD2P.js";import{p as P}from"./chunk-WGPRIGRF.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as w}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";w();w();var W="2026-06-23",H="auto",J="instant",V=12e4,h=18e4,X=5e4,v=16e3,k=class extends Error{code="EMATILDA_STREAM_INCOMPLETE";constructor(){super("Matilda agent stream ended without an authoritative done signal."),this.name="MatildaAgentStreamProtocolError"}},B=["Treat this as Matilda Code traffic.","Prefer the code specialist path for implementation, debugging, refactoring, tests, repo edits, and code review.","Use the fast instruct path for simple coordination, status, clarification, or non-code conversational replies.","Keep the response concise and action-oriented."].join(" "),K=["You are powering Matilda Code, an interactive terminal coding agent.","Matilda Code owns the local agent loop: codebase reads, edits, shell commands, approvals, memory, subagents, skills, and MCP tools run through the CLI.","Use the conversation context and tool results as facts. Do not claim to have inspected files, run commands, or edited code unless that action appears in the provided context.",`When the user gives a vague starter such as "let's code" without a concrete development task, ask a concise clarifying question instead of inventing an app or dumping code.`].join(" ");function z(n){let e=(n||"https://matilda.maincode.com/api/v1").trim().replace(/\/+$/,"");return/\/api\/v1$/i.test(e)?e.replace(/\/api\/v1$/i,"/api"):/\/api$/i.test(e)?e:`${e}/api`}function T(n){try{let e=JSON.parse(n);return e&&typeof e=="object"?e:void 0}catch{return}}function u(n,e){let o=T(n)?.[e];return typeof o=="string"?o:void 0}function D(n){return S(n)}function S(n){return typeof n=="string"?n:Array.isArray(n)?n.map(e=>{if(typeof e=="string")return e;if(!e||typeof e!="object")return"";let t=e;return typeof t.text=="string"?t.text:t.image_url?"[image omitted: Matilda native chat accepts text only]":t.input_audio?"[audio omitted: Matilda native chat accepts text only]":t.file?"[file omitted: Matilda native chat accepts text only]":""}).filter(Boolean).join(`
|
|
4
4
|
`):""}function g(n,e){if(n.length<=e)return n;let t=`
|
|
5
5
|
[...omitted to fit Matilda native agent context...]
|
|
6
6
|
`,o=e-t.length,s=Math.floor(o*.6),i=o-s;return`${n.slice(0,s)}${t}${n.slice(-i)}`}function Q(n){return(n.candidates?.[0]?.content?.parts??[]).map(t=>typeof t=="string"?t:"thought"in t&&t.thought?"":"text"in t&&t.text||"").join("")}function Y(n){let e=T(n),t=typeof e?.output_tokens=="number"?e.output_tokens:void 0;if(t!==void 0)return{promptTokenCount:0,candidatesTokenCount:t,totalTokenCount:t,usageIsIncomplete:!0}}function C(n){return JSON.stringify(n).length}function Z(n){if(C(n)<=h)return n;let e=`
|