@maincode-ai/matilda-code 0.21.11-preview.0 → 0.21.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/bundled/mainy/docs/configuration/settings.md +6 -4
  2. package/bundled/mainy/docs/configuration/trusted-folders.md +12 -6
  3. package/chunks/agent-WM63A6NK.js +3 -0
  4. package/chunks/agent-headless-QIUBDKPW.js +3 -0
  5. package/chunks/{ca-EUJBUYX5.js → ca-I2HEEIL7.js} +1 -1
  6. package/chunks/{chunk-P3G4HEXP.js → chunk-3IRGBRSP.js} +10 -10
  7. package/chunks/{chunk-KLWMEGO4.js → chunk-5C2RJ5RR.js} +1 -1
  8. package/chunks/{chunk-JA43M5MZ.js → chunk-6Z2MV7ZY.js} +53 -53
  9. package/chunks/chunk-BVOCFLC4.js +56 -0
  10. package/chunks/chunk-CSJTA7NE.js +101 -0
  11. package/chunks/{chunk-PW3LFA6D.js → chunk-DOOFGSRV.js} +1 -1
  12. package/chunks/{chunk-F62NM4KX.js → chunk-FPO57O66.js} +6 -6
  13. package/chunks/{chunk-3WBC3IIX.js → chunk-JRECUFB3.js} +674 -675
  14. package/chunks/chunk-KHHJYBR5.js +9 -0
  15. package/chunks/{chunk-AQQOBDEP.js → chunk-QVCGLQCI.js} +1 -1
  16. package/chunks/{chunk-ZYCVL46M.js → chunk-WC2VTVCE.js} +1 -1
  17. package/chunks/{chunk-6RCVKDFR.js → chunk-YJAKOETP.js} +2 -2
  18. package/chunks/{computer-use-2UBC2SKZ.js → computer-use-WKDNUTLD.js} +1 -1
  19. package/chunks/contextCommand-DAB3HOHY.js +3 -0
  20. package/chunks/{cron-create-FMTLQJXE.js → cron-create-F2LXM2OA.js} +1 -1
  21. package/chunks/{cron-delete-LWKY3QSE.js → cron-delete-DE6Q2S2L.js} +1 -1
  22. package/chunks/{cron-list-DJTIFK2L.js → cron-list-IAQEJVV7.js} +1 -1
  23. package/chunks/{de-DNEPG7S7.js → de-AQXFJYZI.js} +1 -1
  24. package/chunks/{edit-MR52FAWW.js → edit-QQNJZ55P.js} +2 -2
  25. package/chunks/{en-NOD6KQNM.js → en-EJLDYIBM.js} +1 -1
  26. package/chunks/{enter-worktree-HFTCLHRB.js → enter-worktree-5X5SAMBJ.js} +1 -1
  27. package/chunks/{enterPlanMode-R54IR74J.js → enterPlanMode-HP35SPLN.js} +1 -1
  28. package/chunks/{exit-worktree-NK6IMLGE.js → exit-worktree-SRKZBEYF.js} +1 -1
  29. package/chunks/{exitPlanMode-X2M6ZV3X.js → exitPlanMode-WSPTGGVN.js} +1 -1
  30. package/chunks/{fr-2OE5WLJ4.js → fr-6TDHK7F2.js} +1 -1
  31. package/chunks/{geminiContentGenerator-KKK5RWAE.js → geminiContentGenerator-RJ73DQAP.js} +1 -1
  32. package/chunks/{glob-RKSORKHR.js → glob-QQ6LGKDX.js} +1 -1
  33. package/chunks/{goal-tools-RSICRXWC.js → goal-tools-C6BSBHCF.js} +1 -1
  34. package/chunks/{grep-7O4QFORW.js → grep-MVCOBUYW.js} +1 -1
  35. package/chunks/{ja-3B6V5KS7.js → ja-GGNJR7AR.js} +1 -1
  36. package/chunks/{matildaAgentContentGenerator-JRJ35MC7.js → matildaAgentContentGenerator-YUYS4336.js} +1 -1
  37. package/chunks/{matildaContentGenerator-3EXH3FBK.js → matildaContentGenerator-O4Z2QPCP.js} +1 -1
  38. package/chunks/{matildaOAuth2-XE7AHBSI.js → matildaOAuth2-7COTQQR2.js} +1 -1
  39. package/chunks/mcp-client-RXVQU5VI.js +3 -0
  40. package/chunks/monitor-77KXDXPR.js +32 -0
  41. package/chunks/{notebook-edit-6SCNZBO3.js → notebook-edit-TKJD2EQZ.js} +1 -1
  42. package/chunks/{openaiContentGenerator-5SBB3YKW.js → openaiContentGenerator-2EALAM3U.js} +1 -1
  43. package/chunks/{pt-KP2JCPUY.js → pt-D6L2QTDM.js} +1 -1
  44. package/chunks/{read-file-DZTYS4MO.js → read-file-3KUAH6ND.js} +1 -1
  45. package/chunks/ripGrep-U2PLKXMY.js +3 -0
  46. package/chunks/{ru-K7IQQKHC.js → ru-BNJCHDYO.js} +1 -1
  47. package/chunks/{scheduler-NPTZJ56A.js → scheduler-J7VU2V5Y.js} +1 -1
  48. package/chunks/{serve-3VNHJIGD.js → serve-FXH6EBQ6.js} +36 -36
  49. package/chunks/shell-PXR2AXDD.js +3 -0
  50. package/chunks/{skill-OQVVXONF.js → skill-HZPFEAPF.js} +1 -1
  51. package/chunks/src-RFAEPLY7.js +3 -0
  52. package/chunks/task-create-Z3QRCMX4.js +1 -1
  53. package/chunks/{task-list-MNHMRJN3.js → task-list-GXAJW3JP.js} +1 -1
  54. package/chunks/{task-update-DA5K2V7E.js → task-update-AR26UFYZ.js} +1 -1
  55. package/chunks/{team-create-AATX26NE.js → team-create-PYXFVIR5.js} +1 -1
  56. package/chunks/{team-delete-RRYZ6KMB.js → team-delete-OMYVUAQU.js} +1 -1
  57. package/chunks/{todoWrite-Y6RP55AO.js → todoWrite-5NZ7CHTC.js} +1 -1
  58. package/chunks/{tool-search-EZAYWDKE.js → tool-search-RKZDSRYS.js} +1 -1
  59. package/chunks/tree-sitter-bash-2SWKO5B7.js +3 -0
  60. package/chunks/{web-fetch-ZTPXSREL.js → web-fetch-VW3SVDQ6.js} +13 -13
  61. package/chunks/{workflow-J6YT6B4V.js → workflow-YXNXDRWZ.js} +2 -2
  62. package/chunks/{write-file-MO5WWZWG.js → write-file-XDDLTGSG.js} +1 -1
  63. package/cli.js +443 -440
  64. package/locales/ca.js +1 -0
  65. package/locales/de.js +1 -0
  66. package/locales/en.js +1 -0
  67. package/locales/fr.js +1 -0
  68. package/locales/ja.js +1 -0
  69. package/locales/pt.js +1 -0
  70. package/locales/ru.js +1 -0
  71. package/package.json +2 -2
  72. package/sandbox-macos-restrictive-closed.sb +3 -0
  73. package/sandbox-macos-restrictive-open.sb +3 -0
  74. package/sandbox-macos-restrictive-proxied.sb +3 -0
  75. package/chunks/agent-BU623AHW.js +0 -3
  76. package/chunks/agent-headless-T24DLERB.js +0 -3
  77. package/chunks/chunk-ET7ZXQ3A.js +0 -9
  78. package/chunks/chunk-I5H6ZXLS.js +0 -101
  79. package/chunks/chunk-WXCEBLRE.js +0 -56
  80. package/chunks/contextCommand-CRHIC6JS.js +0 -3
  81. package/chunks/monitor-7O2YTGFR.js +0 -32
  82. package/chunks/ripGrep-LVBZPZPH.js +0 -3
  83. package/chunks/shell-SXPNBWTX.js +0 -3
  84. package/chunks/src-PJF3I6FQ.js +0 -3
  85. package/chunks/tree-sitter-bash-XNCMPQBK.js +0 -3
@@ -0,0 +1,9 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import{d as m}from"./chunk-27Q5KW3A.js";import{b as w}from"./chunk-GZPNIYVZ.js";w();import{URL as E}from"node:url";var p=[/^10\./,/^127\./,/^172\.(1[6-9]|2[0-9]|3[0-1])\./,/^192\.168\./,/^::1$/,/^fc00:/,/^fe80:/],T=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"]),S=new Set([...T,"ECONNRESET","ETIMEDOUT","ECONNREFUSED","ENOTFOUND","EAI_AGAIN","EHOSTUNREACH","ENETUNREACH"]),o=class extends Error{constructor(n,s){super(n);this.code=s;this.name="FetchError"}};function N(e){try{let t=new E(e).hostname;return p.some(n=>n.test(t))}catch{return!1}}var b=new Set([301,302,303,307,308]);function _(e,t){try{let n=new E(e),s=new E(t),f=n.protocol==="http:"&&s.protocol==="https:";return s.protocol!==n.protocol&&!f||s.port!==n.port||s.username||s.password?!1:s.hostname===n.hostname}catch{return!1}}async function U(e,t){let n=AbortSignal.timeout(t.timeoutMs),s=t.signal?AbortSignal.any([t.signal,n]):n,f=a=>t.signal?.aborted?new o("Request aborted","ABORT_ERR"):n.aborted?new o(`Request timed out after ${t.timeoutMs}ms`,"ETIMEDOUT"):a instanceof o?a:new o(m(a),d(a)),i=e;for(let a=0;a<=t.maxRedirects;a++){let r;try{r=await fetch(i,{signal:s,headers:t.headers,redirect:"manual"})}catch(c){throw f(c)}if(b.has(r.status)){let c=r.headers.get("location");if(await r.body?.cancel().catch(()=>{}),!c)throw new o("Redirect response missing Location header");let u;try{u=new E(c,i).toString()}catch{throw new o(`Redirect response has a malformed Location header: ${c}`)}if(!_(i,u))return{kind:"cross-host-redirect",originalUrl:i,redirectUrl:u,status:r.status};i=u;continue}let l=r.headers.get("content-type")??"";if(r.status<200||r.status>=300)return await r.body?.cancel().catch(()=>{}),{kind:"response",status:r.status,statusText:r.statusText,contentType:l,body:Buffer.alloc(0),finalUrl:i};let h=Number(r.headers.get("content-length"));if(Number.isFinite(h)&&h>t.maxBytes)throw await r.body?.cancel().catch(()=>{}),new o(`Response too large: ${h} bytes exceeds the ${t.maxBytes}-byte limit`,"EMSGSIZE");let R=[],g=0;if(r.body){let c=r.body.getReader();try{for(;;){let{done:u,value:y}=await c.read();if(u)break;if(g+=y.byteLength,g>t.maxBytes)throw new o(`Response too large: exceeded the ${t.maxBytes}-byte limit while reading`,"EMSGSIZE");R.push(y)}}catch(u){throw await c.cancel().catch(()=>{}),f(u)}finally{c.releaseLock()}}return{kind:"response",status:r.status,statusText:r.statusText,contentType:l,body:Buffer.concat(R,g),finalUrl:i}}throw new o(`Too many redirects (more than ${t.maxRedirects})`,"EMAXREDIRECTS")}function d(e){if(!(!e||typeof e!="object")&&"code"in e&&typeof e.code=="string")return e.code}function A(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);if(e instanceof Error)return e.message;if(!e||typeof e!="object")return;let t=e.message;if(typeof t=="string")return t}function x(e){if(!(e instanceof Error))return;let t=e.cause;if(!t)return;let n=d(t),s=A(t);if(!(!n&&!s))return n&&s&&!s.includes(n)?`${n}: ${s}`:s??n}function L(e,t={}){let n=m(e),s=e instanceof Error?d(e.cause)??d(e):d(e),f=x(e),i=[n,f?`(cause: ${f})`:void 0].filter(Boolean).join(" "),a=n.toLowerCase().includes("fetch failed")||s!=null&&S.has(s),r=s!=null&&T.has(s);if(!a)return i;let l=["","Troubleshooting:",...t.url?[`- Confirm you can reach ${t.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`${i}${l.join(`
4
+ `)}`}export{N as a,U as b,L as c};
5
+ /**
6
+ * @license
7
+ * Copyright 2025 Google LLC
8
+ * SPDX-License-Identifier: Apache-2.0
9
+ */
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{M as j,N as L,O as W,g as F,ia as B,na as _}from"./chunk-P3G4HEXP.js";import{b as m,e as w}from"./chunk-4J6DC24J.js";import{k as U,n as D}from"./chunk-SDTWBD62.js";import{q as b,s as x,t as O,u as I}from"./chunk-27Q5KW3A.js";import{b as $}from"./chunk-GZPNIYVZ.js";$();var K="2026-06-23",z="auto",Y="instant",Q=12e4,h=18e4,Z=5e4,R=16e3,E=class extends Error{constructor(t,s){super(t);this.status=s;this.name="MatildaAgentHttpError"}},S=class extends Error{code="EMATILDA_STREAM_INCOMPLETE";constructor(){super("Matilda agent stream ended without an authoritative done signal."),this.name="MatildaAgentStreamProtocolError"}},q=["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(" "),ee=["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 te(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 y(n){try{let e=JSON.parse(n);return e&&typeof e=="object"?e:void 0}catch{return}}var ne="Your message was blocked by our content safety system.";function se(n){let e=y(n);if(!e||e.error!=="content_blocked")return;let t=Array.isArray(e.categories)?e.categories.filter(o=>typeof o=="string"):[],s=typeof e.assistant_message=="string"&&e.assistant_message.trim().length>0?e.assistant_message:typeof e.message=="string"?e.message:ne;return{categories:t,severity:typeof e.severity=="string"?e.severity:void 0,assistantMessage:s}}function u(n,e){let s=y(n)?.[e];return typeof s=="string"?s:void 0}function H(n){return P(n)}function P(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(`
3
+ import{M as j,N as L,O as W,g as F,ia as B,na as _}from"./chunk-3IRGBRSP.js";import{b as m,e as w}from"./chunk-4J6DC24J.js";import{k as U,n as D}from"./chunk-SDTWBD62.js";import{q as b,s as x,t as O,u as I}from"./chunk-27Q5KW3A.js";import{b as $}from"./chunk-GZPNIYVZ.js";$();var K="2026-06-23",z="auto",Y="instant",Q=12e4,h=18e4,Z=5e4,R=16e3,E=class extends Error{constructor(t,s){super(t);this.status=s;this.name="MatildaAgentHttpError"}},S=class extends Error{code="EMATILDA_STREAM_INCOMPLETE";constructor(){super("Matilda agent stream ended without an authoritative done signal."),this.name="MatildaAgentStreamProtocolError"}},q=["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(" "),ee=["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 te(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 y(n){try{let e=JSON.parse(n);return e&&typeof e=="object"?e:void 0}catch{return}}var ne="Your message was blocked by our content safety system.";function se(n){let e=y(n);if(!e||e.error!=="content_blocked")return;let t=Array.isArray(e.categories)?e.categories.filter(o=>typeof o=="string"):[],s=typeof e.assistant_message=="string"&&e.assistant_message.trim().length>0?e.assistant_message:typeof e.message=="string"?e.message:ne;return{categories:t,severity:typeof e.severity=="string"?e.severity:void 0,assistantMessage:s}}function u(n,e){let s=y(n)?.[e];return typeof s=="string"?s:void 0}function H(n){return P(n)}function P(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 f(n,e){if(n.length<=e)return n;let t=`
5
5
  [...omitted to fit Matilda native agent context...]
6
6
  `,s=e-t.length,o=Math.floor(s*.6),i=s-o;return`${n.slice(0,o)}${t}${n.slice(-i)}`}function oe(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 ae(n){let e=y(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 ie(n){if(C(n)<=h)return n;let e=`
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{c as U}from"./chunk-ET7ZXQ3A.js";import{c as Q}from"./chunk-VI74YQQO.js";import{a as Y,b as N}from"./chunk-3YLXGE6T.js";import{b as X}from"./chunk-LUNDTQ3G.js";import{Q as S,ba as I}from"./chunk-27Q5KW3A.js";import{b as M}from"./chunk-GZPNIYVZ.js";M();import ie from"crypto";import q from"node:path";import{promises as b}from"node:fs";import{EventEmitter as Re}from"events";import{randomUUID as se}from"node:crypto";M();import{execFile as le,spawn as de}from"node:child_process";import{promisify as he}from"node:util";import{platform as ue}from"node:os";import{resolve as Z}from"node:path";import{URL as fe,fileURLToPath as me}from"node:url";var ee=he(le);function pe(i,{allowFile:e=!1,allowedFilePaths:r}={}){let t;try{t=new fe(i)}catch{throw new Error(`Invalid URL: ${i}`)}let o=e?["http:","https:","file:"]:["http:","https:"];if(!o.includes(t.protocol))throw new Error(`Unsafe protocol: ${t.protocol}. Only ${o.join(", ")} are allowed.`);if(t.protocol==="file:"&&e){if(!r?.length)throw new Error("allowedFilePaths is required when allowFile is true");let n=Z(me(t));if(!r.map(c=>Z(c)).includes(n))throw new Error("File URL is not in the allowed file set")}if(/[\r\n\x00-\x1f]/.test(i))throw new Error("URL contains invalid characters")}async function te(i,e={}){pe(i,e);let r=ue(),t,o,n=process.env.BROWSER?.trim(),s=r==="win32"?void 0:we(n,i);if(s)try{await re(s.command,s.args);return}catch(l){console.warn(`Failed to open BROWSER command ${s.command}: ${ge(l)}. Falling back to the platform browser opener.`)}if(!N({ignoreBrowserBlocklist:!0})){console.warn(`Browser launch is not available in this environment. Please open this URL manually: ${i}`);return}switch(r){case"darwin":t="open",o=[i];break;case"win32":t="powershell.exe",o=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${i.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":t="xdg-open",o=[i];break;default:throw new Error(`Unsupported platform: ${r}`)}let c={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await ee(t,o,c)}catch{if((r==="linux"||r==="freebsd"||r==="openbsd")&&t==="xdg-open"){let a=[{command:"gnome-open",detached:!1},{command:"kde-open",detached:!1},{command:"firefox",detached:!0},{command:"chromium",detached:!0},{command:"google-chrome",detached:!0},{command:"microsoft-edge",detached:!0}];for(let{command:d,detached:p}of a)try{p?await re(d,[i]):await ee(d,[i],c);return}catch{continue}}console.warn(`Failed to open browser automatically. Please open this URL manually: ${i}`);return}}async function re(i,e){let r={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};await new Promise((t,o)=>{let n=de(i,e,r),s=!1;n.once("error",c=>{s||(s=!0,o(c))}),n.once("spawn",()=>{s||(s=!0,n.unref(),t())})})}function ge(i){return i instanceof Error?i.message:String(i)}function we(i,e){if(!i)return;let r=ke(i);if(!r){console.warn("Invalid BROWSER environment variable, falling back to platform default.");return}if(Y(r.command))return;let t=!1,o=r.args.map(n=>n.includes("%s")?(t=!0,n.replace(/%s/g,()=>e)):n);return t||o.push(e),{command:r.command,args:o}}function ke(i){let e=[],r="",t;for(let s of i){if(t){s===t?t=void 0:r+=s;continue}if(s==='"'||s==="'"){t=s;continue}if(/\s/.test(s)){r&&(e.push(r),r="");continue}r+=s}if(t)return;r&&e.push(r);let[o,...n]=e;if(o)return{command:o,args:n}}function Ve(){return N()}M();import H from"node:path";import{promises as y,unlinkSync as Ee}from"node:fs";import{randomUUID as ne}from"node:crypto";var D=I("MATILDA_OAUTH"),_e="oauth_creds.json",Ce="oauth_creds.lock",ve=30*1e3,ye=35e3,Te=5e3,oe={maxAttempts:20,attemptInterval:100,maxInterval:2e3};var h=class extends Error{constructor(r,t,o){super(t);this.type=r;this.originalError=o;this.name="TokenManagerError"}};function De(i){if(!i||typeof i!="object")throw new Error("Invalid credentials format");let e=i,r=["access_token","refresh_token","token_type"];for(let t of r)if(!e[t]||typeof e[t]!="string")throw new Error(`Invalid credentials: missing ${t}`);if(!e.expiry_date||typeof e.expiry_date!="number")throw new Error("Invalid credentials: missing expiry_date");return e}var R=class i{static instance=null;memoryCache={credentials:null,fileModTime:0,lastCheck:0};refreshPromise=null;checkPromise=null;cleanupHandlersRegistered=!1;cleanupFunction=null;lockConfig=oe;constructor(){this.registerCleanupHandlers()}static getInstance(){return i.instance||(i.instance=new i),i.instance}registerCleanupHandlers(){this.cleanupHandlersRegistered||(this.cleanupFunction=()=>{try{let e=this.getLockFilePath();Ee(e)}catch{}},process.on("exit",this.cleanupFunction),this.cleanupHandlersRegistered=!0)}async getValidCredentials(e,r=!1){try{if(await this.checkAndReloadIfNeeded(e),!r&&this.memoryCache.credentials&&this.isTokenValid(this.memoryCache.credentials))return this.memoryCache.credentials;let t=this.refreshPromise;t||(t=this.performTokenRefresh(e,r),this.refreshPromise=t);try{return await t}finally{this.refreshPromise===t&&(this.refreshPromise=null)}}catch(t){throw t instanceof h?t:new h("REFRESH_FAILED",`Failed to get valid credentials: ${t instanceof Error?t.message:String(t)}`,t)}}async checkAndReloadIfNeeded(e){if(this.checkPromise){await this.checkPromise;return}if(this.refreshPromise)return;let r=Date.now();if(!(r-this.memoryCache.lastCheck<Te)){this.checkPromise=this.performFileCheck(e,r);try{await this.checkPromise}finally{this.checkPromise=null}}}withTimeout(e,r,t="Operation"){let o;return Promise.race([e.finally(()=>{o&&clearTimeout(o)}),new Promise((n,s)=>{o=setTimeout(()=>s(new Error(`${t} timed out after ${r}ms`)),r)})])}async performFileCheck(e,r){this.memoryCache.lastCheck=r;try{let t=this.getCredentialFilePath(),n=(await this.withTimeout(y.stat(t),3e3,"File operation")).mtimeMs;n>this.memoryCache.fileModTime&&(await this.reloadCredentialsFromFile(e),this.memoryCache.fileModTime=n)}catch(t){if(t instanceof Error&&"code"in t&&t.code!=="ENOENT")throw this.updateCacheState(null,0,r),new h("FILE_ACCESS_ERROR",`Failed to access credentials file: ${t.message}`,t);this.memoryCache.fileModTime=0}}async forceFileCheck(e){try{let r=this.getCredentialFilePath(),o=(await y.stat(r)).mtimeMs;o>this.memoryCache.fileModTime&&(await this.reloadCredentialsFromFile(e),this.memoryCache.fileModTime=o,this.memoryCache.lastCheck=Date.now())}catch(r){if(r instanceof Error&&"code"in r&&r.code!=="ENOENT")throw this.updateCacheState(null,0),new h("FILE_ACCESS_ERROR",`Failed to access credentials file during refresh: ${r.message}`,r);this.memoryCache.fileModTime=0}}async reloadCredentialsFromFile(e){try{let r=this.getCredentialFilePath(),t=await y.readFile(r,"utf-8"),o=JSON.parse(t),n=De(o),s=this.memoryCache.credentials;this.memoryCache.credentials=n;try{e&&e.setCredentials(n)}catch(c){throw this.memoryCache.credentials=s,c}}catch(r){r instanceof Error&&r.message.includes("Invalid credentials")&&D.warn(`Failed to validate credentials file: ${r.message}`),this.memoryCache.credentials=null}}async performTokenRefresh(e,r=!1){let t=Date.now(),o=this.getLockFilePath(),n=!1;try{let s=e.getCredentials();if(!s.refresh_token)throw new h("NO_REFRESH_TOKEN","No refresh token available for token refresh");await this.acquireLock(o),n=!0;let c=Date.now()-t;if(c>5e3&&D.warn(`Token refresh lock acquisition took ${c}ms`),await this.forceFileCheck(e),!r&&this.memoryCache.credentials&&this.isTokenValid(this.memoryCache.credentials))return this.memoryCache.credentials;let l=await e.refreshAccessToken(),a=Date.now()-t;if(a>1e4&&D.warn(`Token refresh operation took ${a}ms`),!l||L(l)){let w=l;throw new h("REFRESH_FAILED",`Token refresh failed: ${w?.error||"Unknown error"} - ${w?.error_description||"No details provided"}`)}let d=l;if(!d.access_token)throw new h("REFRESH_FAILED","Failed to refresh access token: no token returned");let p={access_token:d.access_token,token_type:d.token_type,refresh_token:d.refresh_token||s.refresh_token,resource_url:d.resource_url,expiry_date:Date.now()+d.expires_in*1e3};return this.memoryCache.credentials=p,e.setCredentials(p),await this.saveCredentialsToFile(p),p}catch(s){throw s instanceof F?(D.debug("SharedTokenManager: Clearing memory cache due to credentials clear requirement"),this.memoryCache.credentials=null,this.memoryCache.fileModTime=0,this.refreshPromise=null,new h("REFRESH_FAILED",s.message,s)):s instanceof h?s:s instanceof Error&&(s.message.includes("fetch")||s.message.includes("network")||s.message.includes("timeout"))?new h("NETWORK_ERROR",`Network error during token refresh: ${s.message}`,s):new h("REFRESH_FAILED",`Unexpected error during token refresh: ${s instanceof Error?s.message:String(s)}`,s)}finally{n&&await this.releaseLock(o)}}async saveCredentialsToFile(e){let r=this.getCredentialFilePath(),t=H.dirname(r);try{await this.withTimeout(y.mkdir(t,{recursive:!0,mode:448}),5e3,"File operation")}catch(n){throw new h("FILE_ACCESS_ERROR",`Failed to create credentials directory: ${n instanceof Error?n.message:String(n)}`,n)}let o=JSON.stringify(e,null,2);try{await X(r,o,{mode:384,forceMode:!0,noFollow:!0});let n=await this.withTimeout(y.stat(r),5e3,"File operation");this.memoryCache.fileModTime=n.mtimeMs}catch(n){throw new h("FILE_ACCESS_ERROR",`Failed to write credentials file: ${n instanceof Error?n.message:String(n)}`,n)}}isTokenValid(e){return!e.expiry_date||!e.access_token?!1:Date.now()<e.expiry_date-ve}getCredentialFilePath(){return H.join(S.getGlobalMatildaDir(),_e)}getLockFilePath(){return H.join(S.getGlobalMatildaDir(),Ce)}async acquireLock(e){let{maxAttempts:r,attemptInterval:t,maxInterval:o}=this.lockConfig,n=ne(),s=t;for(let c=0;c<r;c++)try{await y.writeFile(e,n,{flag:"wx"});return}catch(l){if(l.code==="EEXIST"){try{let a=await y.stat(e),d=Date.now()-a.mtimeMs;if(d>ye){let p=`${e}.stale.${ne()}`;try{await y.rename(e,p),await y.unlink(p),D.warn(`Removed stale lock file: ${e} (age: ${d}ms)`);continue}catch(w){D.warn(`Failed to remove stale lock file ${e}: ${w instanceof Error?w.message:String(w)}`)}}}catch(a){D.warn(`Failed to stat lock file ${e}: ${a instanceof Error?a.message:String(a)}`)}await new Promise(a=>setTimeout(a,s)),s=Math.min(s*1.5,o)}else throw new h("FILE_ACCESS_ERROR",`Failed to create lock file: ${l instanceof Error?l.message:String(l)}`,l)}throw new h("LOCK_TIMEOUT","Failed to acquire file lock for token refresh: timeout exceeded")}async releaseLock(e){try{await y.unlink(e)}catch(r){r.code!=="ENOENT"&&D.warn(`Failed to release lock file ${e}: ${r instanceof Error?r.message:String(r)}`)}}updateCacheState(e,r,t){this.memoryCache={credentials:e,fileModTime:r,lastCheck:t??Date.now()}}clearCache(){this.updateCacheState(null,0,0),this.refreshPromise=null,this.checkPromise=null}getCurrentCredentials(){return this.memoryCache.credentials}isRefreshInProgress(){return this.refreshPromise!==null}setLockConfig(e){this.lockConfig={...oe,...e}}cleanup(){this.cleanupFunction&&this.cleanupHandlersRegistered&&(this.cleanupFunction(),process.removeListener("exit",this.cleanupFunction),this.cleanupHandlersRegistered=!1,this.cleanupFunction=null)}getDebugInfo(){let e=!!this.memoryCache.credentials,r=e?!this.isTokenValid(this.memoryCache.credentials):!1;return{hasCredentials:e,credentialsExpired:r,isRefreshing:this.isRefreshInProgress(),cacheAge:Date.now()-this.memoryCache.lastCheck}}};var u=I("MATILDA_OAUTH"),G="https://chat.matilda.ai",Ae=`${G}/api/v1/oauth2/device/code`,K=`${G}/api/v1/oauth2/token`,z="f0304373b74a44d2b584a3fb70ca9e56",Me="openid profile email model.completion",be="urn:ietf:params:oauth:grant-type:device_code",Pe=3e4,Se="oauth_creds.json";function Fe(){return ie.randomBytes(32).toString("base64url")}function Oe(i){let e=ie.createHash("sha256");return e.update(i),e.digest("base64url")}function xe(){let i=Fe(),e=Oe(i);return{code_verifier:i,code_challenge:e}}function B(i){return Object.keys(i).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`).join("&")}function W(i,e){let r=e?"Token refresh timeout":"Token refresh failed";return new Error(`${r}: ${U(i,{url:K})}`,{cause:i})}var F=class extends Error{constructor(r,t){super(r);this.originalError=t;this.name="CredentialsClearRequiredError"}},j=class extends Error{status;oauthError;description;constructor(e){super(`Device token poll failed: ${e.oauthError??"Unknown error"} - ${e.description??"(no description)"}`),this.name="MatildaOAuthPollError",this.oauthError=e.oauthError,this.description=e.description,this.status=e.status}};function V(i){return"device_code"in i}function Ie(i){return"access_token"in i&&i.access_token!==null&&i.access_token!==void 0&&typeof i.access_token=="string"&&i.access_token.length>0}function Le(i){return"status"in i&&i.status==="pending"}function L(i){return"error"in i}var J=class{credentials={};sharedManager;constructor(){this.sharedManager=R.getInstance()}setCredentials(e){this.credentials=e}getCredentials(){return this.credentials}async getAccessToken(){try{return{token:(await this.sharedManager.getValidCredentials(this)).access_token}}catch(e){return u.warn("Failed to get access token from shared manager:",e),{token:void 0}}}async requestDeviceAuthorization(e,r){let t={client_id:z,scope:e.scope,code_challenge:e.code_challenge,code_challenge_method:e.code_challenge_method},o=await fetch(Ae,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json","x-request-id":se()},body:B(t),...r?.signal?{signal:r.signal}:{}});if(!o.ok){let s=await o.text();throw new Error(`Device authorization failed: ${o.status} ${o.statusText}. Response: ${s}`)}let n=await o.json();if(V(n))u.debug("Device authorization result (sanitized):",{ok:!0,expires_in:n.expires_in});else{let s=n;u.debug("Device authorization result (sanitized):",{ok:!1,error:s?.error})}if(!V(n)){let s=n;throw new Error(`Device authorization failed: ${s?.error||"Unknown error"} - ${s?.error_description||"No details provided"}`)}return n}async pollDeviceToken(e,r){let t={grant_type:be,client_id:z,device_code:e.device_code,code_verifier:e.code_verifier},o=await fetch(K,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:B(t),...r?.signal?{signal:r.signal}:{}});if(!o.ok){let n=await o.text(),s=null;try{s=JSON.parse(n)}catch{let l=new Error(`Device token poll failed: ${o.status} ${o.statusText}. Response: ${n}`);throw l.status=o.status,l}if(o.status===400&&s.error==="authorization_pending")return{status:"pending"};if(o.status===429&&s.error==="slow_down")return{status:"pending",slowDown:!0};throw new j({oauthError:s.error,description:s.error_description,status:o.status})}return await o.json()}async refreshAccessToken(){if(!this.credentials.refresh_token)throw new Error("No refresh token available");let e={grant_type:"refresh_token",refresh_token:this.credentials.refresh_token,client_id:z},{signal:r,cleanup:t}=Q([],{timeoutMs:Pe});u.debug("Refreshing access token...");try{let o;try{o=await fetch(K,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:B(e),signal:r})}catch(a){throw W(a,r.aborted)}if(!o.ok){let a;try{a=await o.text()}catch(d){throw W(d,r.aborted)}throw o.status===400||o.status===401?(await ae(),new F("Refresh token expired or invalid. Please use '/auth' to re-authenticate.",{status:o.status,response:a})):new Error(`Token refresh failed: ${o.status} ${o.statusText}. Response: ${a}`)}let n;try{n=await o.text()}catch(a){throw W(a,r.aborted)}let s;try{s=JSON.parse(n)}catch{throw new Error(`Legacy OAuth refresh returned invalid JSON: ${n||"(empty response body)"}`)}if(L(s)){let a=s;throw new Error(`Token refresh failed: ${a?.error||"Unknown error"} - ${a?.error_description||"No details provided"}`)}let c=s,l={access_token:c.access_token,token_type:c.token_type,refresh_token:c.refresh_token||this.credentials.refresh_token,resource_url:c.resource_url,expiry_date:Date.now()+c.expires_in*1e3};return this.setCredentials(l),s}finally{t()}}},$e=(t=>(t.AuthUri="auth-uri",t.AuthProgress="auth-progress",t.AuthCancel="auth-cancel",t))($e||{}),P=new Re;async function wr(i,e){let r=new J,t=R.getInstance();try{let o=await t.getValidCredentials(r);return r.setCredentials(o),r}catch(o){if(o instanceof h)switch(o.type){case"NO_REFRESH_TOKEN":u.debug("No refresh token available, proceeding with device flow");break;case"REFRESH_FAILED":u.debug("Token refresh failed, proceeding with device flow");break;case"NETWORK_ERROR":u.warn("Network error during token refresh, trying device flow");break;default:u.warn("Token manager error:",o.message)}if(e?.requireCachedCredentials)throw new Error("Matilda OAuth credentials expired. Please use /auth to re-authenticate with matilda-oauth.");let n=await Ue(r,i);if(!n.success){n.reason==="timeout"&&P.emit("auth-progress","timeout","Authentication timed out. Please try again or select a different authentication method.");let s=n.message||(()=>{switch(n.reason){case"timeout":return"Legacy OAuth authentication timed out";case"cancelled":return"Legacy OAuth authentication was cancelled by user";case"rate_limit":return"Too many requests for legacy OAuth authentication, please try again later.";case"error":default:return"Legacy OAuth authentication failed"}})();throw new Error(s)}return r}}function Ne(i){let e="Legacy OAuth Device Authorization",r=i,n=Math.min(Math.max(e.length+4,70),80),s=n-4,c=(m,T)=>{if(m.startsWith("http://")||m.startsWith("https://")){let v=[];for(let x=0;x<m.length;x+=T)v.push(m.substring(x,x+T));return v}let A=m.split(" "),C=[],_="";for(let v of A)_.length+v.length+1<=T?_+=(_?" ":"")+v:(_&&C.push(_),_=v.length>T?v.substring(0,T):v);return _&&C.push(_),C},l=" "+e+" ",a=n-2-l.length,d=Math.floor(a/2),p=a-d,w="+"+"-".repeat(d)+l+"-".repeat(p)+"+",k="|"+" ".repeat(n-2)+"|",O="+"+"-".repeat(n-2)+"+",g=c("Please visit the following URL in your browser to authorize:",s),f=c(r,s),E="Waiting for authorization to complete...";process.stderr.write(`
3
+ import{c as U}from"./chunk-KHHJYBR5.js";import{c as Q}from"./chunk-VI74YQQO.js";import{a as Y,b as N}from"./chunk-3YLXGE6T.js";import{b as X}from"./chunk-LUNDTQ3G.js";import{Q as S,ba as I}from"./chunk-27Q5KW3A.js";import{b as M}from"./chunk-GZPNIYVZ.js";M();import ie from"crypto";import q from"node:path";import{promises as b}from"node:fs";import{EventEmitter as Re}from"events";import{randomUUID as se}from"node:crypto";M();import{execFile as le,spawn as de}from"node:child_process";import{promisify as he}from"node:util";import{platform as ue}from"node:os";import{resolve as Z}from"node:path";import{URL as fe,fileURLToPath as me}from"node:url";var ee=he(le);function pe(i,{allowFile:e=!1,allowedFilePaths:r}={}){let t;try{t=new fe(i)}catch{throw new Error(`Invalid URL: ${i}`)}let o=e?["http:","https:","file:"]:["http:","https:"];if(!o.includes(t.protocol))throw new Error(`Unsafe protocol: ${t.protocol}. Only ${o.join(", ")} are allowed.`);if(t.protocol==="file:"&&e){if(!r?.length)throw new Error("allowedFilePaths is required when allowFile is true");let n=Z(me(t));if(!r.map(c=>Z(c)).includes(n))throw new Error("File URL is not in the allowed file set")}if(/[\r\n\x00-\x1f]/.test(i))throw new Error("URL contains invalid characters")}async function te(i,e={}){pe(i,e);let r=ue(),t,o,n=process.env.BROWSER?.trim(),s=r==="win32"?void 0:we(n,i);if(s)try{await re(s.command,s.args);return}catch(l){console.warn(`Failed to open BROWSER command ${s.command}: ${ge(l)}. Falling back to the platform browser opener.`)}if(!N({ignoreBrowserBlocklist:!0})){console.warn(`Browser launch is not available in this environment. Please open this URL manually: ${i}`);return}switch(r){case"darwin":t="open",o=[i];break;case"win32":t="powershell.exe",o=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${i.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":t="xdg-open",o=[i];break;default:throw new Error(`Unsupported platform: ${r}`)}let c={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await ee(t,o,c)}catch{if((r==="linux"||r==="freebsd"||r==="openbsd")&&t==="xdg-open"){let a=[{command:"gnome-open",detached:!1},{command:"kde-open",detached:!1},{command:"firefox",detached:!0},{command:"chromium",detached:!0},{command:"google-chrome",detached:!0},{command:"microsoft-edge",detached:!0}];for(let{command:d,detached:p}of a)try{p?await re(d,[i]):await ee(d,[i],c);return}catch{continue}}console.warn(`Failed to open browser automatically. Please open this URL manually: ${i}`);return}}async function re(i,e){let r={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};await new Promise((t,o)=>{let n=de(i,e,r),s=!1;n.once("error",c=>{s||(s=!0,o(c))}),n.once("spawn",()=>{s||(s=!0,n.unref(),t())})})}function ge(i){return i instanceof Error?i.message:String(i)}function we(i,e){if(!i)return;let r=ke(i);if(!r){console.warn("Invalid BROWSER environment variable, falling back to platform default.");return}if(Y(r.command))return;let t=!1,o=r.args.map(n=>n.includes("%s")?(t=!0,n.replace(/%s/g,()=>e)):n);return t||o.push(e),{command:r.command,args:o}}function ke(i){let e=[],r="",t;for(let s of i){if(t){s===t?t=void 0:r+=s;continue}if(s==='"'||s==="'"){t=s;continue}if(/\s/.test(s)){r&&(e.push(r),r="");continue}r+=s}if(t)return;r&&e.push(r);let[o,...n]=e;if(o)return{command:o,args:n}}function Ve(){return N()}M();import H from"node:path";import{promises as y,unlinkSync as Ee}from"node:fs";import{randomUUID as ne}from"node:crypto";var D=I("MATILDA_OAUTH"),_e="oauth_creds.json",Ce="oauth_creds.lock",ve=30*1e3,ye=35e3,Te=5e3,oe={maxAttempts:20,attemptInterval:100,maxInterval:2e3};var h=class extends Error{constructor(r,t,o){super(t);this.type=r;this.originalError=o;this.name="TokenManagerError"}};function De(i){if(!i||typeof i!="object")throw new Error("Invalid credentials format");let e=i,r=["access_token","refresh_token","token_type"];for(let t of r)if(!e[t]||typeof e[t]!="string")throw new Error(`Invalid credentials: missing ${t}`);if(!e.expiry_date||typeof e.expiry_date!="number")throw new Error("Invalid credentials: missing expiry_date");return e}var R=class i{static instance=null;memoryCache={credentials:null,fileModTime:0,lastCheck:0};refreshPromise=null;checkPromise=null;cleanupHandlersRegistered=!1;cleanupFunction=null;lockConfig=oe;constructor(){this.registerCleanupHandlers()}static getInstance(){return i.instance||(i.instance=new i),i.instance}registerCleanupHandlers(){this.cleanupHandlersRegistered||(this.cleanupFunction=()=>{try{let e=this.getLockFilePath();Ee(e)}catch{}},process.on("exit",this.cleanupFunction),this.cleanupHandlersRegistered=!0)}async getValidCredentials(e,r=!1){try{if(await this.checkAndReloadIfNeeded(e),!r&&this.memoryCache.credentials&&this.isTokenValid(this.memoryCache.credentials))return this.memoryCache.credentials;let t=this.refreshPromise;t||(t=this.performTokenRefresh(e,r),this.refreshPromise=t);try{return await t}finally{this.refreshPromise===t&&(this.refreshPromise=null)}}catch(t){throw t instanceof h?t:new h("REFRESH_FAILED",`Failed to get valid credentials: ${t instanceof Error?t.message:String(t)}`,t)}}async checkAndReloadIfNeeded(e){if(this.checkPromise){await this.checkPromise;return}if(this.refreshPromise)return;let r=Date.now();if(!(r-this.memoryCache.lastCheck<Te)){this.checkPromise=this.performFileCheck(e,r);try{await this.checkPromise}finally{this.checkPromise=null}}}withTimeout(e,r,t="Operation"){let o;return Promise.race([e.finally(()=>{o&&clearTimeout(o)}),new Promise((n,s)=>{o=setTimeout(()=>s(new Error(`${t} timed out after ${r}ms`)),r)})])}async performFileCheck(e,r){this.memoryCache.lastCheck=r;try{let t=this.getCredentialFilePath(),n=(await this.withTimeout(y.stat(t),3e3,"File operation")).mtimeMs;n>this.memoryCache.fileModTime&&(await this.reloadCredentialsFromFile(e),this.memoryCache.fileModTime=n)}catch(t){if(t instanceof Error&&"code"in t&&t.code!=="ENOENT")throw this.updateCacheState(null,0,r),new h("FILE_ACCESS_ERROR",`Failed to access credentials file: ${t.message}`,t);this.memoryCache.fileModTime=0}}async forceFileCheck(e){try{let r=this.getCredentialFilePath(),o=(await y.stat(r)).mtimeMs;o>this.memoryCache.fileModTime&&(await this.reloadCredentialsFromFile(e),this.memoryCache.fileModTime=o,this.memoryCache.lastCheck=Date.now())}catch(r){if(r instanceof Error&&"code"in r&&r.code!=="ENOENT")throw this.updateCacheState(null,0),new h("FILE_ACCESS_ERROR",`Failed to access credentials file during refresh: ${r.message}`,r);this.memoryCache.fileModTime=0}}async reloadCredentialsFromFile(e){try{let r=this.getCredentialFilePath(),t=await y.readFile(r,"utf-8"),o=JSON.parse(t),n=De(o),s=this.memoryCache.credentials;this.memoryCache.credentials=n;try{e&&e.setCredentials(n)}catch(c){throw this.memoryCache.credentials=s,c}}catch(r){r instanceof Error&&r.message.includes("Invalid credentials")&&D.warn(`Failed to validate credentials file: ${r.message}`),this.memoryCache.credentials=null}}async performTokenRefresh(e,r=!1){let t=Date.now(),o=this.getLockFilePath(),n=!1;try{let s=e.getCredentials();if(!s.refresh_token)throw new h("NO_REFRESH_TOKEN","No refresh token available for token refresh");await this.acquireLock(o),n=!0;let c=Date.now()-t;if(c>5e3&&D.warn(`Token refresh lock acquisition took ${c}ms`),await this.forceFileCheck(e),!r&&this.memoryCache.credentials&&this.isTokenValid(this.memoryCache.credentials))return this.memoryCache.credentials;let l=await e.refreshAccessToken(),a=Date.now()-t;if(a>1e4&&D.warn(`Token refresh operation took ${a}ms`),!l||L(l)){let w=l;throw new h("REFRESH_FAILED",`Token refresh failed: ${w?.error||"Unknown error"} - ${w?.error_description||"No details provided"}`)}let d=l;if(!d.access_token)throw new h("REFRESH_FAILED","Failed to refresh access token: no token returned");let p={access_token:d.access_token,token_type:d.token_type,refresh_token:d.refresh_token||s.refresh_token,resource_url:d.resource_url,expiry_date:Date.now()+d.expires_in*1e3};return this.memoryCache.credentials=p,e.setCredentials(p),await this.saveCredentialsToFile(p),p}catch(s){throw s instanceof F?(D.debug("SharedTokenManager: Clearing memory cache due to credentials clear requirement"),this.memoryCache.credentials=null,this.memoryCache.fileModTime=0,this.refreshPromise=null,new h("REFRESH_FAILED",s.message,s)):s instanceof h?s:s instanceof Error&&(s.message.includes("fetch")||s.message.includes("network")||s.message.includes("timeout"))?new h("NETWORK_ERROR",`Network error during token refresh: ${s.message}`,s):new h("REFRESH_FAILED",`Unexpected error during token refresh: ${s instanceof Error?s.message:String(s)}`,s)}finally{n&&await this.releaseLock(o)}}async saveCredentialsToFile(e){let r=this.getCredentialFilePath(),t=H.dirname(r);try{await this.withTimeout(y.mkdir(t,{recursive:!0,mode:448}),5e3,"File operation")}catch(n){throw new h("FILE_ACCESS_ERROR",`Failed to create credentials directory: ${n instanceof Error?n.message:String(n)}`,n)}let o=JSON.stringify(e,null,2);try{await X(r,o,{mode:384,forceMode:!0,noFollow:!0});let n=await this.withTimeout(y.stat(r),5e3,"File operation");this.memoryCache.fileModTime=n.mtimeMs}catch(n){throw new h("FILE_ACCESS_ERROR",`Failed to write credentials file: ${n instanceof Error?n.message:String(n)}`,n)}}isTokenValid(e){return!e.expiry_date||!e.access_token?!1:Date.now()<e.expiry_date-ve}getCredentialFilePath(){return H.join(S.getGlobalMatildaDir(),_e)}getLockFilePath(){return H.join(S.getGlobalMatildaDir(),Ce)}async acquireLock(e){let{maxAttempts:r,attemptInterval:t,maxInterval:o}=this.lockConfig,n=ne(),s=t;for(let c=0;c<r;c++)try{await y.writeFile(e,n,{flag:"wx"});return}catch(l){if(l.code==="EEXIST"){try{let a=await y.stat(e),d=Date.now()-a.mtimeMs;if(d>ye){let p=`${e}.stale.${ne()}`;try{await y.rename(e,p),await y.unlink(p),D.warn(`Removed stale lock file: ${e} (age: ${d}ms)`);continue}catch(w){D.warn(`Failed to remove stale lock file ${e}: ${w instanceof Error?w.message:String(w)}`)}}}catch(a){D.warn(`Failed to stat lock file ${e}: ${a instanceof Error?a.message:String(a)}`)}await new Promise(a=>setTimeout(a,s)),s=Math.min(s*1.5,o)}else throw new h("FILE_ACCESS_ERROR",`Failed to create lock file: ${l instanceof Error?l.message:String(l)}`,l)}throw new h("LOCK_TIMEOUT","Failed to acquire file lock for token refresh: timeout exceeded")}async releaseLock(e){try{await y.unlink(e)}catch(r){r.code!=="ENOENT"&&D.warn(`Failed to release lock file ${e}: ${r instanceof Error?r.message:String(r)}`)}}updateCacheState(e,r,t){this.memoryCache={credentials:e,fileModTime:r,lastCheck:t??Date.now()}}clearCache(){this.updateCacheState(null,0,0),this.refreshPromise=null,this.checkPromise=null}getCurrentCredentials(){return this.memoryCache.credentials}isRefreshInProgress(){return this.refreshPromise!==null}setLockConfig(e){this.lockConfig={...oe,...e}}cleanup(){this.cleanupFunction&&this.cleanupHandlersRegistered&&(this.cleanupFunction(),process.removeListener("exit",this.cleanupFunction),this.cleanupHandlersRegistered=!1,this.cleanupFunction=null)}getDebugInfo(){let e=!!this.memoryCache.credentials,r=e?!this.isTokenValid(this.memoryCache.credentials):!1;return{hasCredentials:e,credentialsExpired:r,isRefreshing:this.isRefreshInProgress(),cacheAge:Date.now()-this.memoryCache.lastCheck}}};var u=I("MATILDA_OAUTH"),G="https://chat.matilda.ai",Ae=`${G}/api/v1/oauth2/device/code`,K=`${G}/api/v1/oauth2/token`,z="f0304373b74a44d2b584a3fb70ca9e56",Me="openid profile email model.completion",be="urn:ietf:params:oauth:grant-type:device_code",Pe=3e4,Se="oauth_creds.json";function Fe(){return ie.randomBytes(32).toString("base64url")}function Oe(i){let e=ie.createHash("sha256");return e.update(i),e.digest("base64url")}function xe(){let i=Fe(),e=Oe(i);return{code_verifier:i,code_challenge:e}}function B(i){return Object.keys(i).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`).join("&")}function W(i,e){let r=e?"Token refresh timeout":"Token refresh failed";return new Error(`${r}: ${U(i,{url:K})}`,{cause:i})}var F=class extends Error{constructor(r,t){super(r);this.originalError=t;this.name="CredentialsClearRequiredError"}},j=class extends Error{status;oauthError;description;constructor(e){super(`Device token poll failed: ${e.oauthError??"Unknown error"} - ${e.description??"(no description)"}`),this.name="MatildaOAuthPollError",this.oauthError=e.oauthError,this.description=e.description,this.status=e.status}};function V(i){return"device_code"in i}function Ie(i){return"access_token"in i&&i.access_token!==null&&i.access_token!==void 0&&typeof i.access_token=="string"&&i.access_token.length>0}function Le(i){return"status"in i&&i.status==="pending"}function L(i){return"error"in i}var J=class{credentials={};sharedManager;constructor(){this.sharedManager=R.getInstance()}setCredentials(e){this.credentials=e}getCredentials(){return this.credentials}async getAccessToken(){try{return{token:(await this.sharedManager.getValidCredentials(this)).access_token}}catch(e){return u.warn("Failed to get access token from shared manager:",e),{token:void 0}}}async requestDeviceAuthorization(e,r){let t={client_id:z,scope:e.scope,code_challenge:e.code_challenge,code_challenge_method:e.code_challenge_method},o=await fetch(Ae,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json","x-request-id":se()},body:B(t),...r?.signal?{signal:r.signal}:{}});if(!o.ok){let s=await o.text();throw new Error(`Device authorization failed: ${o.status} ${o.statusText}. Response: ${s}`)}let n=await o.json();if(V(n))u.debug("Device authorization result (sanitized):",{ok:!0,expires_in:n.expires_in});else{let s=n;u.debug("Device authorization result (sanitized):",{ok:!1,error:s?.error})}if(!V(n)){let s=n;throw new Error(`Device authorization failed: ${s?.error||"Unknown error"} - ${s?.error_description||"No details provided"}`)}return n}async pollDeviceToken(e,r){let t={grant_type:be,client_id:z,device_code:e.device_code,code_verifier:e.code_verifier},o=await fetch(K,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:B(t),...r?.signal?{signal:r.signal}:{}});if(!o.ok){let n=await o.text(),s=null;try{s=JSON.parse(n)}catch{let l=new Error(`Device token poll failed: ${o.status} ${o.statusText}. Response: ${n}`);throw l.status=o.status,l}if(o.status===400&&s.error==="authorization_pending")return{status:"pending"};if(o.status===429&&s.error==="slow_down")return{status:"pending",slowDown:!0};throw new j({oauthError:s.error,description:s.error_description,status:o.status})}return await o.json()}async refreshAccessToken(){if(!this.credentials.refresh_token)throw new Error("No refresh token available");let e={grant_type:"refresh_token",refresh_token:this.credentials.refresh_token,client_id:z},{signal:r,cleanup:t}=Q([],{timeoutMs:Pe});u.debug("Refreshing access token...");try{let o;try{o=await fetch(K,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:B(e),signal:r})}catch(a){throw W(a,r.aborted)}if(!o.ok){let a;try{a=await o.text()}catch(d){throw W(d,r.aborted)}throw o.status===400||o.status===401?(await ae(),new F("Refresh token expired or invalid. Please use '/auth' to re-authenticate.",{status:o.status,response:a})):new Error(`Token refresh failed: ${o.status} ${o.statusText}. Response: ${a}`)}let n;try{n=await o.text()}catch(a){throw W(a,r.aborted)}let s;try{s=JSON.parse(n)}catch{throw new Error(`Legacy OAuth refresh returned invalid JSON: ${n||"(empty response body)"}`)}if(L(s)){let a=s;throw new Error(`Token refresh failed: ${a?.error||"Unknown error"} - ${a?.error_description||"No details provided"}`)}let c=s,l={access_token:c.access_token,token_type:c.token_type,refresh_token:c.refresh_token||this.credentials.refresh_token,resource_url:c.resource_url,expiry_date:Date.now()+c.expires_in*1e3};return this.setCredentials(l),s}finally{t()}}},$e=(t=>(t.AuthUri="auth-uri",t.AuthProgress="auth-progress",t.AuthCancel="auth-cancel",t))($e||{}),P=new Re;async function wr(i,e){let r=new J,t=R.getInstance();try{let o=await t.getValidCredentials(r);return r.setCredentials(o),r}catch(o){if(o instanceof h)switch(o.type){case"NO_REFRESH_TOKEN":u.debug("No refresh token available, proceeding with device flow");break;case"REFRESH_FAILED":u.debug("Token refresh failed, proceeding with device flow");break;case"NETWORK_ERROR":u.warn("Network error during token refresh, trying device flow");break;default:u.warn("Token manager error:",o.message)}if(e?.requireCachedCredentials)throw new Error("Matilda OAuth credentials expired. Please use /auth to re-authenticate with matilda-oauth.");let n=await Ue(r,i);if(!n.success){n.reason==="timeout"&&P.emit("auth-progress","timeout","Authentication timed out. Please try again or select a different authentication method.");let s=n.message||(()=>{switch(n.reason){case"timeout":return"Legacy OAuth authentication timed out";case"cancelled":return"Legacy OAuth authentication was cancelled by user";case"rate_limit":return"Too many requests for legacy OAuth authentication, please try again later.";case"error":default:return"Legacy OAuth authentication failed"}})();throw new Error(s)}return r}}function Ne(i){let e="Legacy OAuth Device Authorization",r=i,n=Math.min(Math.max(e.length+4,70),80),s=n-4,c=(m,T)=>{if(m.startsWith("http://")||m.startsWith("https://")){let v=[];for(let x=0;x<m.length;x+=T)v.push(m.substring(x,x+T));return v}let A=m.split(" "),C=[],_="";for(let v of A)_.length+v.length+1<=T?_+=(_?" ":"")+v:(_&&C.push(_),_=v.length>T?v.substring(0,T):v);return _&&C.push(_),C},l=" "+e+" ",a=n-2-l.length,d=Math.floor(a/2),p=a-d,w="+"+"-".repeat(d)+l+"-".repeat(p)+"+",k="|"+" ".repeat(n-2)+"|",O="+"+"-".repeat(n-2)+"+",g=c("Please visit the following URL in your browser to authorize:",s),f=c(r,s),E="Waiting for authorization to complete...";process.stderr.write(`
4
4
  `+w+`
5
5
  `),process.stderr.write(k+`
6
6
  `);for(let m of g)process.stderr.write("| "+m+" ".repeat(s-m.length)+` |
@@ -1,10 +1,10 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{Wh as T}from"./chunk-3WBC3IIX.js";import{Q as b}from"./chunk-27Q5KW3A.js";import{b as o}from"./chunk-GZPNIYVZ.js";import{b as w}from"./chunk-OWGSC52X.js";o();var B=e=>{process.stdout.write(e.endsWith(`
3
+ import{Yh as T}from"./chunk-JRECUFB3.js";import{Q as b}from"./chunk-27Q5KW3A.js";import{b as o}from"./chunk-GZPNIYVZ.js";import{b as w}from"./chunk-OWGSC52X.js";o();var B=e=>{process.stdout.write(e.endsWith(`
4
4
  `)?e:`${e}
5
5
  `)},m=e=>{process.stderr.write(e.endsWith(`
6
6
  `)?e:`${e}
7
- `)},W=()=>{console.clear()};o();import*as u from"node:fs";import*as f from"node:path";import{pathToFileURL as N}from"node:url";o();var p=[{code:"en",id:"en-AU",fullName:"Australian English",nativeName:"English (AU)"},{code:"ru",id:"ru-RU",fullName:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"de",id:"de-DE",fullName:"German",nativeName:"Deutsch"},{code:"ja",id:"ja-JP",fullName:"Japanese",nativeName:"\u65E5\u672C\u8A9E"},{code:"pt",id:"pt-BR",fullName:"Portuguese",nativeName:"Portugu\xEAs"},{code:"fr",id:"fr-FR",fullName:"French",nativeName:"Fran\xE7ais"},{code:"ca",id:"ca-ES",fullName:"Catalan",nativeName:"Catal\xE0"}];function A(e){return e.trim().replace(/_/g,"-").toLowerCase()}var M=new Set(["zh","zh-cn","zh-hans","zh-sg","zh-tw","zh-hk","zh-mo","zh-hant","chinese","traditional chinese","simplified chinese","\u4E2D\u6587","\u7B80\u4F53\u4E2D\u6587","\u7E41\u9AD4\u4E2D\u6587","\u7E41\u4F53\u4E2D\u6587"]);function E(e){let t=A(e);return t?M.has(t)?!0:t.startsWith("zh-")||t.startsWith("zh.")||t.startsWith("zh@"):!1}function k(e,t){return e===t||e.startsWith(`${t}-`)||e.startsWith(`${t}.`)||e.startsWith(`${t}@`)}function z(e,t){let n=t.code.toLowerCase(),r=t.id.toLowerCase();if(k(e,r))return r.length;if(k(e,n))return n.length}function l(e){let t=A(e);if(!t)return;if(t==="english"||t==="australian"||t==="australian-english")return"en";let n;for(let r of p){if(t===r.fullName.toLowerCase()||r.nativeName&&t===r.nativeName.toLowerCase())return r.code;let a=z(t,r);a!==void 0&&(!n||a>n.tokenLength)&&(n={code:r.code,tokenLength:a})}return n?.code}function C(e){let t=l(e);return(t?p.find(r=>r.code===t):void 0)?.fullName||"English"}function q(){return[{value:"auto",label:"Auto (detect from system)"},...p.map(e=>({value:e.code,label:e.nativeName?`${e.nativeName} (${e.fullName})`:`${e.fullName} (${e.id})`}))]}o();function h(e){return Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}o();var I=w({"./locales/ca.js":()=>import("./ca-EUJBUYX5.js"),"./locales/de.js":()=>import("./de-DNEPG7S7.js"),"./locales/en.js":()=>import("./en-NOD6KQNM.js"),"./locales/fr.js":()=>import("./fr-2OE5WLJ4.js"),"./locales/ja.js":()=>import("./ja-3B6V5KS7.js"),"./locales/pt.js":()=>import("./pt-KP2JCPUY.js"),"./locales/ru.js":()=>import("./ru-K7IQQKHC.js")});var y="en",v={},i={},S={},R=()=>f.join(T(import.meta.url),"locales"),U=()=>f.join(b.getGlobalMatildaDir(),"locales");var D=(e,t=!1)=>{let n=t?U():R();return f.join(n,`${e}.js`)};function O(){let e=process.env.MATILDA_CODE_LANG||process.env.LANG;if(e){let t=l(e);if(t)return t}try{let t=Intl.DateTimeFormat().resolvedOptions().locale,n=l(t);if(n)return n}catch{}return"en"}async function P(e){try{let t=await import(e),n=h(t);return L(n)?{translations:n}:{error:new Error("Module loaded but result is empty or invalid")}}catch(t){return{error:t instanceof Error?t:new Error(String(t))}}}async function $(e){try{let t=await I(`./locales/${e}.js`),n=h(t);return L(n)?{translations:n}:{error:new Error("Module loaded but result is empty or invalid")}}catch(t){return{error:t instanceof Error?t:new Error(String(t))}}}async function j(e){if(i[e])return i[e];let t=S[e];if(t)return t;let n=(async()=>{let r=D(e,!0);if(u.existsSync(U())&&u.existsSync(r)){let s=await P(N(r).href);if(s.translations)return i[e]=s.translations,s.translations;m(`Failed to load translations from user directory for ${e}: ${s.error.message}`)}let a=D(e,!1),x=[];u.existsSync(R())&&u.existsSync(a)&&x.push(N(a).href);let c;for(let s of x){let g=await P(s);if(g.translations)return i[e]=g.translations,g.translations;c=g.error}let d=await $(e);return d.translations?(i[e]=d.translations,d.translations):(c=d.error,c&&m(`Failed to load JS translations for ${e}: ${c.message}`),i[e]={},{})})();return S[e]=n,n.finally(()=>{delete S[e]}),n}function _(e,t){return t?e.replace(/\{\{(\w+)\}\}/g,(n,r)=>t[r]??n):e}function F(e){return e==="auto"?O():E(e)?"en":l(e)??e}async function G(e){y=F(e),v=await j(y)}function le(){return y}function ue(e,t){let n=v[e]??e;return Array.isArray(n)?e:_(n,t)}function ce(e){let t=v[e];return Array.isArray(t)?t:[]}async function de(e){await G(e??"auto")}export{B as a,m as b,W as c,p as d,E as e,l as f,C as g,q as h,O as i,G as j,le as k,ue as l,ce as m,de as n};
7
+ `)},W=()=>{console.clear()};o();import*as u from"node:fs";import*as f from"node:path";import{pathToFileURL as N}from"node:url";o();var p=[{code:"en",id:"en-AU",fullName:"Australian English",nativeName:"English (AU)"},{code:"ru",id:"ru-RU",fullName:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"de",id:"de-DE",fullName:"German",nativeName:"Deutsch"},{code:"ja",id:"ja-JP",fullName:"Japanese",nativeName:"\u65E5\u672C\u8A9E"},{code:"pt",id:"pt-BR",fullName:"Portuguese",nativeName:"Portugu\xEAs"},{code:"fr",id:"fr-FR",fullName:"French",nativeName:"Fran\xE7ais"},{code:"ca",id:"ca-ES",fullName:"Catalan",nativeName:"Catal\xE0"}];function A(e){return e.trim().replace(/_/g,"-").toLowerCase()}var M=new Set(["zh","zh-cn","zh-hans","zh-sg","zh-tw","zh-hk","zh-mo","zh-hant","chinese","traditional chinese","simplified chinese","\u4E2D\u6587","\u7B80\u4F53\u4E2D\u6587","\u7E41\u9AD4\u4E2D\u6587","\u7E41\u4F53\u4E2D\u6587"]);function E(e){let t=A(e);return t?M.has(t)?!0:t.startsWith("zh-")||t.startsWith("zh.")||t.startsWith("zh@"):!1}function k(e,t){return e===t||e.startsWith(`${t}-`)||e.startsWith(`${t}.`)||e.startsWith(`${t}@`)}function z(e,t){let n=t.code.toLowerCase(),r=t.id.toLowerCase();if(k(e,r))return r.length;if(k(e,n))return n.length}function l(e){let t=A(e);if(!t)return;if(t==="english"||t==="australian"||t==="australian-english")return"en";let n;for(let r of p){if(t===r.fullName.toLowerCase()||r.nativeName&&t===r.nativeName.toLowerCase())return r.code;let a=z(t,r);a!==void 0&&(!n||a>n.tokenLength)&&(n={code:r.code,tokenLength:a})}return n?.code}function C(e){let t=l(e);return(t?p.find(r=>r.code===t):void 0)?.fullName||"English"}function q(){return[{value:"auto",label:"Auto (detect from system)"},...p.map(e=>({value:e.code,label:e.nativeName?`${e.nativeName} (${e.fullName})`:`${e.fullName} (${e.id})`}))]}o();function h(e){return Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}o();var I=w({"./locales/ca.js":()=>import("./ca-I2HEEIL7.js"),"./locales/de.js":()=>import("./de-AQXFJYZI.js"),"./locales/en.js":()=>import("./en-EJLDYIBM.js"),"./locales/fr.js":()=>import("./fr-6TDHK7F2.js"),"./locales/ja.js":()=>import("./ja-GGNJR7AR.js"),"./locales/pt.js":()=>import("./pt-D6L2QTDM.js"),"./locales/ru.js":()=>import("./ru-BNJCHDYO.js")});var y="en",v={},i={},S={},R=()=>f.join(T(import.meta.url),"locales"),U=()=>f.join(b.getGlobalMatildaDir(),"locales");var D=(e,t=!1)=>{let n=t?U():R();return f.join(n,`${e}.js`)};function O(){let e=process.env.MATILDA_CODE_LANG||process.env.LANG;if(e){let t=l(e);if(t)return t}try{let t=Intl.DateTimeFormat().resolvedOptions().locale,n=l(t);if(n)return n}catch{}return"en"}async function P(e){try{let t=await import(e),n=h(t);return L(n)?{translations:n}:{error:new Error("Module loaded but result is empty or invalid")}}catch(t){return{error:t instanceof Error?t:new Error(String(t))}}}async function $(e){try{let t=await I(`./locales/${e}.js`),n=h(t);return L(n)?{translations:n}:{error:new Error("Module loaded but result is empty or invalid")}}catch(t){return{error:t instanceof Error?t:new Error(String(t))}}}async function j(e){if(i[e])return i[e];let t=S[e];if(t)return t;let n=(async()=>{let r=D(e,!0);if(u.existsSync(U())&&u.existsSync(r)){let s=await P(N(r).href);if(s.translations)return i[e]=s.translations,s.translations;m(`Failed to load translations from user directory for ${e}: ${s.error.message}`)}let a=D(e,!1),x=[];u.existsSync(R())&&u.existsSync(a)&&x.push(N(a).href);let c;for(let s of x){let g=await P(s);if(g.translations)return i[e]=g.translations,g.translations;c=g.error}let d=await $(e);return d.translations?(i[e]=d.translations,d.translations):(c=d.error,c&&m(`Failed to load JS translations for ${e}: ${c.message}`),i[e]={},{})})();return S[e]=n,n.finally(()=>{delete S[e]}),n}function _(e,t){return t?e.replace(/\{\{(\w+)\}\}/g,(n,r)=>t[r]??n):e}function F(e){return e==="auto"?O():E(e)?"en":l(e)??e}async function G(e){y=F(e),v=await j(y)}function le(){return y}function ue(e,t){let n=v[e]??e;return Array.isArray(n)?e:_(n,t)}function ce(e){let t=v[e];return Array.isArray(t)?t:[]}async function de(e){await G(e??"auto")}export{B as a,m as b,W as c,p as d,E as e,l as f,C as g,q as h,O as i,G as j,le as k,ue as l,ce as m,de as n};
8
8
  /**
9
9
  * @license
10
10
  * Copyright 2025 Matilda Team
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{Df as H,Ff as K,Ne as x,Si as V}from"./chunk-3WBC3IIX.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-MTMU7JYZ.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-WXCEBLRE.js";import"./chunk-MCQUPLRE.js";import"./chunk-47XR7IMP.js";import"./chunk-GTVCJCHR.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-QKYGQLWC.js";import"./chunk-6EQMZNIY.js";import"./chunk-PW3LFA6D.js";import"./chunk-DE3HKC2W.js";import"./chunk-AQQOBDEP.js";import"./chunk-YV3PUOBU.js";import"./chunk-P3G4HEXP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{i as S}from"./chunk-JA43M5MZ.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-YRQP3SLC.js";import{g as G,i as X}from"./chunk-6E766NPX.js";import"./chunk-ZYCVL46M.js";import"./chunk-ET7ZXQ3A.js";import"./chunk-VI74YQQO.js";import"./chunk-3YLXGE6T.js";import"./chunk-LUNDTQ3G.js";import"./chunk-27Q5KW3A.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 we}from"node:os";d();import{join as R}from"node:path";import{homedir as E}from"node:os";var l="0.5.2",me="https://matilda.maincode.com/assets/computer-use",he="https://github.com/trycua/cua/releases/download";function U(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 N(e,t=process.env,o=l){let r=[],i=t.MATILDA_COMPUTER_USE_DOWNLOAD_HOST;return i&&r.push(`${ye(i)}/cua-driver-rs/v${o}/${e}`),r.push(`${me}/cua-driver-rs/v${o}/${e}`),r.push(`${he}/cua-driver-rs-v${o}/${e}`),r}function Y(e=process.env,t=l){return N("checksums.txt",e,t)}var fe="MATILDA_COMPUTER_USE_MAX_IMAGE_DIMENSION";function J(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 Q(e,t=process.env){let o=J(t[fe]);return o!==void 0?o:J(e)}function ge(e=E()){return R(e,".matilda","computer-use")}function M(e=E(),t=l){return R(ge(e),`cua-driver-rs-${t}`)}function u(e=E(),t=process.platform,o=process.arch,r=l){let i=U(t,o,r);return R(M(e,r),i.extractDir,i.binaryRelPath)}function h(e=l){return`cua-driver-rs@${e}`}function ye(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(we())})),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 K({command:this.binary,args:["mcp"],env:x()}),i=new H({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(!Z(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(!Z(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 Z(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 j=["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.
3
+ import{Ui as V,k as H,l as K,u as x}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{i as S}from"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import{g as G,i as X}from"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.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 we}from"node:os";d();import{join as R}from"node:path";import{homedir as E}from"node:os";var l="0.5.2",me="https://matilda.maincode.com/assets/computer-use",he="https://github.com/trycua/cua/releases/download";function U(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 N(e,t=process.env,o=l){let r=[],i=t.MATILDA_COMPUTER_USE_DOWNLOAD_HOST;return i&&r.push(`${ye(i)}/cua-driver-rs/v${o}/${e}`),r.push(`${me}/cua-driver-rs/v${o}/${e}`),r.push(`${he}/cua-driver-rs-v${o}/${e}`),r}function Y(e=process.env,t=l){return N("checksums.txt",e,t)}var fe="MATILDA_COMPUTER_USE_MAX_IMAGE_DIMENSION";function J(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 Q(e,t=process.env){let o=J(t[fe]);return o!==void 0?o:J(e)}function ge(e=E()){return R(e,".matilda","computer-use")}function M(e=E(),t=l){return R(ge(e),`cua-driver-rs-${t}`)}function u(e=E(),t=process.platform,o=process.arch,r=l){let i=U(t,o,r);return R(M(e,r),i.extractDir,i.binaryRelPath)}function h(e=l){return`cua-driver-rs@${e}`}function ye(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(we())})),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 K({command:this.binary,args:["mcp"],env:x()}),i=new H({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(!Z(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(!Z(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 Z(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 j=["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-5C2RJ5RR.js";import"./chunk-YJAKOETP.js";import"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.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-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import{g as m,i as c,p as d,q as h}from"./chunk-6E766NPX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-27Q5KW3A.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.
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-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import"./chunk-LUNDTQ3G.js";import{g as m,i as c,p as d,q as h}from"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.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-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import{g as l,i as c,p as m,q as p}from"./chunk-6E766NPX.js";import"./chunk-LUNDTQ3G.js";import{d as n}from"./chunk-27Q5KW3A.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};
3
+ import{a as d,f as u}from"./chunk-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import"./chunk-LUNDTQ3G.js";import{g as l,i as c,p as m,q as p}from"./chunk-6E766NPX.js";import{d as n}from"./chunk-27Q5KW3A.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-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import{g as l,i as c,p,q as u}from"./chunk-6E766NPX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-27Q5KW3A.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(`
3
+ import{a as m}from"./chunk-YULUB745.js";import{a as d,c as g}from"./chunk-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import"./chunk-LUNDTQ3G.js";import{g as l,i as c,p,q as u}from"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.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};
@@ -4,7 +4,7 @@ import{b as e}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";e();var n={"
4
4
  - {{directories}}`,"Error refreshing memory: {{error}}":"Fehler beim Aktualisieren des Speichers: {{error}}","Successfully added directories:\n- {{directories}}":`Verzeichnisse erfolgreich hinzugef\xFCgt:
5
5
  - {{directories}}`,"Current workspace directories:\n{{directories}}":`Aktuelle Arbeitsbereichsverzeichnisse:
6
6
  {{directories}}`,"Please open the following URL in your browser to view the documentation:\n{{url}}":`Bitte \xF6ffnen Sie folgende URL in Ihrem Browser, um die Dokumentation anzusehen:
7
- {{url}}`,"Opening documentation in your browser: {{url}}":"Dokumentation wird in Ihrem Browser ge\xF6ffnet: {{url}}","Do you want to proceed?":"M\xF6chten Sie fortfahren?","Yes, allow once":"Ja, einmal erlauben","Allow always":"Immer erlauben",Yes:"Ja",No:"Nein","No (Esc)":"Nein (Esc)","Manage MCP servers":"MCP servers verwalten","Server Detail":"Serverdetails",Tools:"Werkzeuge","Tool Detail":"Werkzeugdetails","Loading...":"L\xE4dt...","Unknown step":"Unbekannter Schritt","Esc to back":"Esc zur\xFCck","\u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to close":"\u2191\u2193 navigieren \xB7 Enter ausw\xE4hlen \xB7 Esc schlie\xDFen","\u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to back":"\u2191\u2193 navigieren \xB7 Enter ausw\xE4hlen \xB7 Esc zur\xFCck","\u2191\u2193 to navigate \xB7 Enter to confirm \xB7 Esc to back":"\u2191\u2193 navigieren \xB7 Enter best\xE4tigen \xB7 Esc zur\xFCck","User Settings (global)":"Benutzereinstellungen (global)","Workspace Settings (project-specific)":"Arbeitsbereichseinstellungen (projektspezifisch)","Disable server:":"Server deaktivieren:","Select where to add the server to the exclude list:":"W\xE4hlen Sie, wo der Server zur Ausschlussliste hinzugef\xFCgt werden soll:","Press Enter to confirm, Esc to cancel":"Enter zum Best\xE4tigen, Esc zum Abbrechen",Disable:"Deaktivieren",Enable:"Aktivieren",Authenticate:"Authentifizieren","Re-authenticate":"Erneut authentifizieren","Clear Authentication":"Authentifizierung l\xF6schen",disabled:"deaktiviert",enabled:"aktiviert","Server:":"Server:",Reconnect:"Neu verbinden","View tools":"Werkzeuge anzeigen","Status:":"Status:","Command:":"Befehl:","Working Directory:":"Arbeitsverzeichnis:","No server selected":"Kein Server ausgew\xE4hlt","Error:":"Fehler:",tool:"Werkzeug",tools:"Werkzeuge",connected:"verbunden",connecting:"verbindet",disconnected:"getrennt",error:"Fehler","User MCPs":"Benutzer-MCPs","Project MCPs":"Projekt-MCPs","Extension MCPs":"Erweiterungs-MCPs",server:"Server",servers:"Server","Add MCP servers to your settings to get started.":"F\xFCgen Sie MCP servers zu Ihren Einstellungen hinzu, um zu beginnen.","Run matilda --debug to see error logs":"F\xFChren Sie matilda --debug aus, um Fehlerprotokolle anzuzeigen","OAuth Authentication":"OAuth-Authentifizierung","Authenticating... Please complete the login in your browser.":"Authentifizierung l\xE4uft... Bitte schlie\xDFen Sie die Anmeldung in Ihrem Browser ab.","No tools available for this server.":"Keine Werkzeuge f\xFCr diesen Server verf\xFCgbar.",destructive:"destruktiv","read-only":"schreibgesch\xFCtzt","open-world":"offene Welt",idempotent:"idempotent","Tools for {{serverName}}":"Werkzeuge f\xFCr {{serverName}}","{{current}}/{{total}}":"{{current}}/{{total}}",required:"erforderlich",Parameters:"Parameter","No tool selected":"Kein Werkzeug ausgew\xE4hlt",Server:"Server","{{count}} invalid tools":"{{count}} ung\xFCltige Werkzeuge",invalid:"ung\xFCltig","invalid: {{reason}}":"ung\xFCltig: {{reason}}","missing name":"Name fehlt","missing description":"Beschreibung fehlt","(unnamed)":"(unbenannt)","Warning: This tool cannot be called by the LLM":"Warnung: Dieses Werkzeug kann nicht vom LLM aufgerufen werden",Reason:"Grund","Tools must have both name and description to be used by the LLM.":"Werkzeuge m\xFCssen sowohl einen Namen als auch eine Beschreibung haben, um vom LLM verwendet zu werden.","Modify in progress:":"\xC4nderung in Bearbeitung:","Save and close external editor to continue":"Speichern und externen Editor schlie\xDFen, um fortzufahren","Apply this change?":"Diese \xC4nderung anwenden?","Yes, allow always":"Ja, immer erlauben","Modify with external editor":"Mit externem Editor bearbeiten","No, suggest changes (Esc)":"Nein, \xC4nderungen vorschlagen (Esc)","Allow execution of: '{{command}}'?":"Ausf\xFChrung erlauben von: '{{command}}'?","Always allow in this project":"In diesem Projekt immer erlauben","Always allow {{action}} in this project":"{{action}} in diesem Projekt immer erlauben","Always allow for this user":"F\xFCr diesen Benutzer immer erlauben","Always allow {{action}} for this user":"{{action}} f\xFCr diesen Benutzer immer erlauben","Yes, restore previous mode ({{mode}})":"Ja, vorherigen Modus wiederherstellen ({{mode}})","Yes, and auto-accept edits":"Ja, und \xC4nderungen automatisch akzeptieren","Yes, and manually approve edits":"Ja, und \xC4nderungen manuell genehmigen","No, keep planning (Esc)":"Nein, weiter planen (Esc)","URLs to fetch:":"Abzurufende URLs:","MCP Server: {{server}}":"MCP Server: {{server}}","Tool: {{tool}}":"Werkzeug: {{tool}}",'Allow execution of MCP tool "{{tool}}" from server "{{server}}"?':'Ausf\xFChrung von MCP tool "{{tool}}" von MCP server "{{server}}" erlauben?',"Shell Command Execution":"Shell-Befehlsausf\xFChrung","A custom command wants to run the following shell commands:":"Ein benutzerdefinierter Befehl m\xF6chte folgende Shell-Befehle ausf\xFChren:","Current Plan:":"Aktueller Plan:","Progress: {{done}}/{{total}} tasks completed":"Fortschritt: {{done}}/{{total}} Aufgaben abgeschlossen",", {{inProgress}} in progress":", {{inProgress}} in Bearbeitung","Pending Tasks:":"Ausstehende Aufgaben:","What would you like to do?":"Was m\xF6chten Sie tun?","Choose how to proceed with your session:":"W\xE4hlen Sie, wie Sie mit Ihrer Sitzung fortfahren m\xF6chten:","Start new chat session":"Neue Chat-Sitzung starten","Continue previous conversation":"Vorheriges Gespr\xE4ch fortsetzen","\u{1F44B} Welcome back! (Last updated: {{timeAgo}})":"\u{1F44B} Willkommen zur\xFCck! (Zuletzt aktualisiert: {{timeAgo}})","\u{1F3AF} Overall Goal:":"\u{1F3AF} Gesamtziel:","Connect a Provider":"Anbieter verbinden","You must connect a provider to proceed. Press Ctrl+C again to exit.":"Sie m\xFCssen einen Anbieter verbinden, um fortzufahren. Dr\xFCcken Sie erneut Ctrl+C zum Beenden.","Terms of Services and Privacy Notice":"Nutzungsbedingungen und Datenschutzhinweis","Matilda OAuth":"Matilda OAuth","Matilda OAuth free tier was discontinued on 2026-04-15. Please select a model from another provider or run /auth to switch.":"Das kostenlose Matilda OAuth-Angebot wurde am 2026-04-15 eingestellt. Bitte w\xE4hlen Sie ein Modell eines anderen Anbieter oder f\xFChren Sie /auth aus, um zu wechseln.","\n\u26A0 Matilda OAuth free tier was discontinued on 2026-04-15. Please select another option.\n":`
7
+ {{url}}`,"Opening documentation in your browser: {{url}}":"Dokumentation wird in Ihrem Browser ge\xF6ffnet: {{url}}","Do you want to proceed?":"M\xF6chten Sie fortfahren?","Yes, allow once":"Ja, einmal erlauben","Allow always":"Immer erlauben",Yes:"Ja",No:"Nein","No (Esc)":"Nein (Esc)","Manage MCP servers":"MCP servers verwalten","Server Detail":"Serverdetails",Tools:"Werkzeuge","Tool Detail":"Werkzeugdetails","Loading...":"L\xE4dt...","Unknown step":"Unbekannter Schritt","Esc to back":"Esc zur\xFCck","\u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to close":"\u2191\u2193 navigieren \xB7 Enter ausw\xE4hlen \xB7 Esc schlie\xDFen","\u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to back":"\u2191\u2193 navigieren \xB7 Enter ausw\xE4hlen \xB7 Esc zur\xFCck","\u2191\u2193 to navigate \xB7 Enter to confirm \xB7 Esc to back":"\u2191\u2193 navigieren \xB7 Enter best\xE4tigen \xB7 Esc zur\xFCck","User Settings (global)":"Benutzereinstellungen (global)","Workspace Settings (project-specific)":"Arbeitsbereichseinstellungen (projektspezifisch)","Disable server:":"Server deaktivieren:","Select where to add the server to the exclude list:":"W\xE4hlen Sie, wo der Server zur Ausschlussliste hinzugef\xFCgt werden soll:","Press Enter to confirm, Esc to cancel":"Enter zum Best\xE4tigen, Esc zum Abbrechen",Disable:"Deaktivieren",Enable:"Aktivieren",Authenticate:"Authentifizieren","Re-authenticate":"Erneut authentifizieren","Clear Authentication":"Authentifizierung l\xF6schen",disabled:"deaktiviert",enabled:"aktiviert","Server:":"Server:",Reconnect:"Neu verbinden","View tools":"Werkzeuge anzeigen","Status:":"Status:","Command:":"Befehl:","Working Directory:":"Arbeitsverzeichnis:","Last stderr output:":"Letzte stderr-Ausgabe:","No server selected":"Kein Server ausgew\xE4hlt","Error:":"Fehler:",tool:"Werkzeug",tools:"Werkzeuge",connected:"verbunden",connecting:"verbindet",disconnected:"getrennt",error:"Fehler","User MCPs":"Benutzer-MCPs","Project MCPs":"Projekt-MCPs","Extension MCPs":"Erweiterungs-MCPs",server:"Server",servers:"Server","Add MCP servers to your settings to get started.":"F\xFCgen Sie MCP servers zu Ihren Einstellungen hinzu, um zu beginnen.","Run matilda --debug to see error logs":"F\xFChren Sie matilda --debug aus, um Fehlerprotokolle anzuzeigen","OAuth Authentication":"OAuth-Authentifizierung","Authenticating... Please complete the login in your browser.":"Authentifizierung l\xE4uft... Bitte schlie\xDFen Sie die Anmeldung in Ihrem Browser ab.","No tools available for this server.":"Keine Werkzeuge f\xFCr diesen Server verf\xFCgbar.",destructive:"destruktiv","read-only":"schreibgesch\xFCtzt","open-world":"offene Welt",idempotent:"idempotent","Tools for {{serverName}}":"Werkzeuge f\xFCr {{serverName}}","{{current}}/{{total}}":"{{current}}/{{total}}",required:"erforderlich",Parameters:"Parameter","No tool selected":"Kein Werkzeug ausgew\xE4hlt",Server:"Server","{{count}} invalid tools":"{{count}} ung\xFCltige Werkzeuge",invalid:"ung\xFCltig","invalid: {{reason}}":"ung\xFCltig: {{reason}}","missing name":"Name fehlt","missing description":"Beschreibung fehlt","(unnamed)":"(unbenannt)","Warning: This tool cannot be called by the LLM":"Warnung: Dieses Werkzeug kann nicht vom LLM aufgerufen werden",Reason:"Grund","Tools must have both name and description to be used by the LLM.":"Werkzeuge m\xFCssen sowohl einen Namen als auch eine Beschreibung haben, um vom LLM verwendet zu werden.","Modify in progress:":"\xC4nderung in Bearbeitung:","Save and close external editor to continue":"Speichern und externen Editor schlie\xDFen, um fortzufahren","Apply this change?":"Diese \xC4nderung anwenden?","Yes, allow always":"Ja, immer erlauben","Modify with external editor":"Mit externem Editor bearbeiten","No, suggest changes (Esc)":"Nein, \xC4nderungen vorschlagen (Esc)","Allow execution of: '{{command}}'?":"Ausf\xFChrung erlauben von: '{{command}}'?","Always allow in this project":"In diesem Projekt immer erlauben","Always allow {{action}} in this project":"{{action}} in diesem Projekt immer erlauben","Always allow for this user":"F\xFCr diesen Benutzer immer erlauben","Always allow {{action}} for this user":"{{action}} f\xFCr diesen Benutzer immer erlauben","Yes, restore previous mode ({{mode}})":"Ja, vorherigen Modus wiederherstellen ({{mode}})","Yes, and auto-accept edits":"Ja, und \xC4nderungen automatisch akzeptieren","Yes, and manually approve edits":"Ja, und \xC4nderungen manuell genehmigen","No, keep planning (Esc)":"Nein, weiter planen (Esc)","URLs to fetch:":"Abzurufende URLs:","MCP Server: {{server}}":"MCP Server: {{server}}","Tool: {{tool}}":"Werkzeug: {{tool}}",'Allow execution of MCP tool "{{tool}}" from server "{{server}}"?':'Ausf\xFChrung von MCP tool "{{tool}}" von MCP server "{{server}}" erlauben?',"Shell Command Execution":"Shell-Befehlsausf\xFChrung","A custom command wants to run the following shell commands:":"Ein benutzerdefinierter Befehl m\xF6chte folgende Shell-Befehle ausf\xFChren:","Current Plan:":"Aktueller Plan:","Progress: {{done}}/{{total}} tasks completed":"Fortschritt: {{done}}/{{total}} Aufgaben abgeschlossen",", {{inProgress}} in progress":", {{inProgress}} in Bearbeitung","Pending Tasks:":"Ausstehende Aufgaben:","What would you like to do?":"Was m\xF6chten Sie tun?","Choose how to proceed with your session:":"W\xE4hlen Sie, wie Sie mit Ihrer Sitzung fortfahren m\xF6chten:","Start new chat session":"Neue Chat-Sitzung starten","Continue previous conversation":"Vorheriges Gespr\xE4ch fortsetzen","\u{1F44B} Welcome back! (Last updated: {{timeAgo}})":"\u{1F44B} Willkommen zur\xFCck! (Zuletzt aktualisiert: {{timeAgo}})","\u{1F3AF} Overall Goal:":"\u{1F3AF} Gesamtziel:","Connect a Provider":"Anbieter verbinden","You must connect a provider to proceed. Press Ctrl+C again to exit.":"Sie m\xFCssen einen Anbieter verbinden, um fortzufahren. Dr\xFCcken Sie erneut Ctrl+C zum Beenden.","Terms of Services and Privacy Notice":"Nutzungsbedingungen und Datenschutzhinweis","Matilda OAuth":"Matilda OAuth","Matilda OAuth free tier was discontinued on 2026-04-15. Please select a model from another provider or run /auth to switch.":"Das kostenlose Matilda OAuth-Angebot wurde am 2026-04-15 eingestellt. Bitte w\xE4hlen Sie ein Modell eines anderen Anbieter oder f\xFChren Sie /auth aus, um zu wechseln.","\n\u26A0 Matilda OAuth free tier was discontinued on 2026-04-15. Please select another option.\n":`
8
8
  \u26A0 Das kostenlose Matilda OAuth-Kontingent wurde am 2026-04-15 eingestellt. Bitte w\xE4hlen Sie eine andere Option.
9
9
  `,"Bring your own API key":"Eigenen API Key verwenden","Browser-based authentication with third-party providers (e.g. OpenRouter, ModelScope)":"Browserbasierte Authentifizierung mit externen Anbietern (z. B. OpenRouter, ModelScope)","Authentication is enforced to be {{enforcedType}}, but you are currently using {{currentType}}.":"Authentifizierung ist auf {{enforcedType}} festgelegt, aber Sie verwenden derzeit {{currentType}}.","Matilda OAuth Authentication":"Matilda OAuth-Authentifizierung","Please visit this URL to authorize:":"Bitte besuchen Sie diese URL zur Autorisierung:","Waiting for authorization":"Warten auf Autorisierung","Time remaining:":"Verbleibende Zeit:","Matilda OAuth Authentication Timeout":"Matilda OAuth-Authentifizierung abgelaufen","OAuth token expired (over {{seconds}} seconds). Please select authentication method again.":"OAuth-Token abgelaufen (\xFCber {{seconds}} Sekunden). Bitte w\xE4hlen Sie erneut eine Authentifizierungsmethode.","Press any key to return to authentication type selection.":"Dr\xFCcken Sie eine beliebige Taste, um zur Authentifizierungstypauswahl zur\xFCckzukehren.","Waiting for Matilda OAuth authentication...":"Warten auf Matilda OAuth-Authentifizierung...","Authentication timed out. Please try again.":"Authentifizierung abgelaufen. Bitte versuchen Sie es erneut.","Waiting for auth... (Press Esc or Ctrl+C to cancel)":"Warten auf Authentifizierung... (Esc oder Ctrl+C zum Abbrechen dr\xFCcken)","Missing API key for OpenAI-compatible auth. Set settings.security.auth.apiKey, or set the {{envKeyHint}} environment variable.":"API Key f\xFCr OpenAI-kompatible Authentifizierung fehlt. Setzen Sie settings.security.auth.apiKey oder die Umgebungsvariable {{envKeyHint}}.","{{envKeyHint}} environment variable not found. Please set it in your .env file or environment variables.":"Umgebungsvariable {{envKeyHint}} wurde nicht gefunden. Bitte legen Sie sie in Ihrer .env-Datei oder den Systemumgebungsvariablen fest.","{{envKeyHint}} environment variable not found (or set settings.security.auth.apiKey). Please set it in your .env file or environment variables.":"Umgebungsvariable {{envKeyHint}} wurde nicht gefunden (oder setzen Sie settings.security.auth.apiKey). Bitte legen Sie sie in Ihrer .env-Datei oder den Systemumgebungsvariablen fest.","Missing API key for OpenAI-compatible auth. Set the {{envKeyHint}} environment variable.":"API Key f\xFCr OpenAI-kompatible Authentifizierung fehlt. Setzen Sie die Umgebungsvariable {{envKeyHint}}.","Anthropic provider missing required baseUrl in modelProviders[].baseUrl.":"Anthropic-Anbieter fehlt erforderliche baseUrl in modelProviders[].baseUrl.","ANTHROPIC_BASE_URL environment variable not found.":"Umgebungsvariable ANTHROPIC_BASE_URL wurde nicht gefunden.","Invalid auth method selected.":"Ung\xFCltige Authentifizierungsmethode ausgew\xE4hlt.","Failed to authenticate. Message: {{message}}":"Authentifizierung fehlgeschlagen. Meldung: {{message}}","Authenticated successfully with {{authType}} credentials.":"Erfolgreich mit {{authType}}-Anmeldedaten authentifiziert.",'Invalid MATILDA_DEFAULT_AUTH_TYPE value: "{{value}}". Valid values are: {{validValues}}':'Ung\xFCltiger MATILDA_DEFAULT_AUTH_TYPE-Wert: "{{value}}". G\xFCltige Werte sind: {{validValues}}',"Select Model":"Modell ausw\xE4hlen","API Key":"API Key","(default)":"(Standard)","(not set)":"(nicht gesetzt)",Modality:"Modalit\xE4t","Context Window":"Kontextfenster",text:"Text","text-only":"nur Text",image:"Bild",pdf:"PDF",audio:"Audio",video:"Video","not set":"nicht gesetzt",none:"keine",unknown:"unbekannt","Manage folder trust settings":"Ordnervertrauenseinstellungen verwalten","Manage permission rules":"permission rules verwalten",Allow:"Erlauben",Ask:"Fragen",Deny:"Verweigern",Workspace:"Arbeitsbereich","Matilda won't ask before using allowed tools.":"Matilda fragt nicht, bevor erlaubte Tools verwendet werden.","Matilda will ask before using these tools.":"Matilda fragt, bevor diese Tools verwendet werden.","Matilda is not allowed to use denied tools.":"Matilda darf verweigerte Tools nicht verwenden.","Manage trusted directories for this workspace.":"Vertrauensw\xFCrdige Verzeichnisse f\xFCr diesen Arbeitsbereich verwalten.","Any use of the {{tool}} tool":"Jede Verwendung des {{tool}}-Tools","{{tool}} commands matching '{{pattern}}'":"{{tool}}-Befehle, die '{{pattern}}' entsprechen","From user settings":"Aus Benutzereinstellungen","From project settings":"Aus Projekteinstellungen","From session":"Aus Sitzung","Project settings":"Projekteinstellungen","Checked in at .matilda/settings.json":"Eingecheckt in .matilda/settings.json","User settings":"Benutzereinstellungen","Saved in at ~/.matilda/settings.json":"Gespeichert in ~/.matilda/settings.json","Add a new rule\u2026":"Neue Regel hinzuf\xFCgen\u2026","Add {{type}} permission rule":"{{type}} permission rule hinzuf\xFCgen","Permission rules are a tool name, optionally followed by a specifier in parentheses.":"permission rules sind ein Toolname, optional gefolgt von einem Bezeichner in Klammern.","e.g.,":"z.B.",or:"oder","Enter permission rule\u2026":"permission rule eingeben\u2026","Enter to submit \xB7 Esc to cancel":"Enter zum Absenden \xB7 Esc zum Abbrechen","Where should this rule be saved?":"Wo soll diese Regel gespeichert werden?","Enter to confirm \xB7 Esc to cancel":"Enter zum Best\xE4tigen \xB7 Esc zum Abbrechen","Delete {{type}} rule?":"{{type}}-Regel l\xF6schen?","Are you sure you want to delete this permission rule?":"Sind Sie sicher, dass Sie diese permission rule l\xF6schen m\xF6chten?","Permissions:":"Berechtigungen:","(\u2190/\u2192 or tab to cycle)":"(\u2190/\u2192 oder Tab zum Wechseln)","Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Type to search \xB7 Esc to cancel":"\u2191\u2193 navigieren \xB7 Enter ausw\xE4hlen \xB7 Tippen suchen \xB7 Esc abbrechen","Search\u2026":"Suche\u2026","Add directory\u2026":"Verzeichnis hinzuf\xFCgen\u2026","Add directory to workspace":"Verzeichnis zum Arbeitsbereich hinzuf\xFCgen","Matilda can read files in the workspace, and make edits when auto-accept edits is on.":"Matilda kann Dateien im Arbeitsbereich lesen und Bearbeitungen vornehmen, wenn die automatische Akzeptierung aktiviert ist.","Matilda will be able to read files in this directory and make edits when auto-accept edits is on.":"Matilda kann Dateien in diesem Verzeichnis lesen und Bearbeitungen vornehmen, wenn die automatische Akzeptierung aktiviert ist.","Enter the path to the directory:":"Pfad zum Verzeichnis eingeben:","Enter directory path\u2026":"Verzeichnispfad eingeben\u2026","Tab to complete \xB7 Enter to add \xB7 Esc to cancel":"Tab zum Vervollst\xE4ndigen \xB7 Enter zum Hinzuf\xFCgen \xB7 Esc zum Abbrechen","Remove directory?":"Verzeichnis entfernen?","Are you sure you want to remove this directory from the workspace?":"M\xF6chten Sie dieses Verzeichnis wirklich aus dem Arbeitsbereich entfernen?"," (Original working directory)":" (Urspr\xFCngliches Arbeitsverzeichnis)"," (from settings)":" (aus Einstellungen)","Directory does not exist.":"Verzeichnis existiert nicht.","Path is not a directory.":"Pfad ist kein Verzeichnis.","This directory is already in the workspace.":"Dieses Verzeichnis ist bereits im Arbeitsbereich.","Already covered by existing directory: {{dir}}":"Bereits durch vorhandenes Verzeichnis abgedeckt: {{dir}}","Using:":"Verwendet:","{{count}} open file":"{{count}} ge\xF6ffnete Datei","{{count}} open files":"{{count}} ge\xF6ffnete Dateien","(Ctrl+G to view)":"(Ctrl+G zum Anzeigen)","{{count}} {{name}} file":"{{count}} {{name}}-Datei","{{count}} {{name}} files":"{{count}} {{name}}-Dateien","{{count}} MCP server":"{{count}} MCP server","{{count}} MCP servers":"{{count}} MCP servers","{{count}} Blocked":"{{count}} blockiert","(Alt+S to view)":"(Alt+S zum Anzeigen)","(Alt+S to toggle)":"(Alt+S zum Umschalten)","Press Ctrl+C again to exit.":"Dr\xFCcken Sie erneut Ctrl+C zum Beenden.","Press Ctrl+D again to exit.":"Dr\xFCcken Sie erneut Ctrl+D zum Beenden.","Press Esc again to clear.":"Dr\xFCcken Sie erneut Esc zum L\xF6schen.","Press Enter (empty) to send now \xB7 \u2191 to edit":"Dr\xFCcken Sie \u2191, um Nachrichten in der Warteschlange zu bearbeiten","Steering with queued message\u2026":"Steering with queued message\u2026","Request cancelled.":"Request cancelled.","No MCP servers configured.":"Keine MCP servers konfiguriert.","\u23F3 MCP servers are starting up ({{count}} initializing)...":"\u23F3 MCP servers werden gestartet ({{count}} werden initialisiert)...","Note: First startup may take longer. Tool availability will update automatically.":"Hinweis: Der erste Start kann l\xE4nger dauern. Werkzeugverf\xFCgbarkeit wird automatisch aktualisiert.","Configured MCP servers:":"Konfigurierte MCP servers:",Ready:"Bereit","Starting... (first startup may take longer)":"Wird gestartet... (erster Start kann l\xE4nger dauern)",Disconnected:"Getrennt","{{count}} tool":"{{count}} Werkzeug","{{count}} tools":"{{count}} Werkzeuge","{{count}} prompt":"{{count}} Prompt","{{count}} prompts":"{{count}} Prompts","(from {{extensionName}})":"(von {{extensionName}})",OAuth:"OAuth","OAuth expired":"OAuth abgelaufen","OAuth not authenticated":"OAuth nicht authentifiziert","tools and prompts will appear when ready":"Werkzeuge und Prompts werden angezeigt, wenn bereit","{{count}} tools cached":"{{count}} Werkzeuge zwischengespeichert","Tools:":"Werkzeuge:","Parameters:":"Parameter:",Blocked:"Blockiert","\u{1F4A1} Tips:":"\u{1F4A1} Tipps:",Use:"Verwenden","to show server and tool descriptions":"um Server- und Werkzeugbeschreibungen anzuzeigen","to show tool parameter schemas":"um tool parameter schemas anzuzeigen","to hide descriptions":"um Beschreibungen auszublenden","to authenticate with OAuth-enabled servers":"um sich bei OAuth-f\xE4higen Servern zu authentifizieren",Press:"Dr\xFCcken Sie","to toggle tool descriptions on/off":"um Werkzeugbeschreibungen ein-/auszuschalten","Starting OAuth authentication for MCP server '{{name}}'...":"OAuth-Authentifizierung f\xFCr MCP server '{{name}}' wird gestartet...","Time for Matilda to sleep. Catchya!":"Zeit f\xFCr Matilda, schlafen zu gehen. Bis dann!","To continue this session, run":"Um diese Sitzung fortzusetzen, f\xFChren Sie aus","Interaction Summary":"Interaktionszusammenfassung","Session ID:":"Sitzungs-ID:","Tool Calls:":"Werkzeugaufrufe:","Success Rate:":"Erfolgsrate:","User Agreement:":"Benutzerzustimmung:",reviewed:"\xFCberpr\xFCft","Code Changes:":"Code\xE4nderungen:",Performance:"Leistung","Wall Time:":"Gesamtzeit:","Agent Active:":"Agent aktiv:","API Time:":"API-Zeit:","Tool Time:":"Werkzeugzeit:","Session Stats":"Sitzungsstatistiken","Model Usage":"Modellnutzung",Reqs:"Anfragen","Input Tokens":"Eingabe-Token","Output Tokens":"Ausgabe-Token","Savings Highlight:":"Einsparungen:","of input tokens were served from the cache, reducing costs.":"der Eingabe-Token wurden aus dem Cache bedient, was die Kosten reduziert.","Tip: For a full token breakdown, run `/stats model`.":"Tipp: F\xFCr eine vollst\xE4ndige Token-Aufschl\xFCsselung f\xFChren Sie `/stats model` aus.","Model Stats For Nerds":"Modellstatistiken f\xFCr Nerds","Tool Stats For Nerds":"Werkzeugstatistiken f\xFCr Nerds",Metric:"Metrik",API:"API",Requests:"Anfragen",Errors:"Fehler","Avg Latency":"Durchschn. Latenz",Tokens:"Token",Total:"Gesamt",Cached:"Zwischengespeichert",Thoughts:"Gedanken",Output:"Ausgabe","Nothing to show yet \u2014 no API calls this session.":"In dieser Sitzung wurden keine API-Aufrufe gemacht.","Tool Name":"Werkzeugname",Calls:"Aufrufe","Success Rate":"Erfolgsrate","Avg Duration":"Durchschn. Dauer","User Decision Summary":"Benutzerentscheidungs-Zusammenfassung","Total Reviewed Suggestions:":"Insgesamt \xFCberpr\xFCfter Vorschl\xE4ge:"," \xBB Accepted:":" \xBB Akzeptiert:"," \xBB Rejected:":" \xBB Abgelehnt:"," \xBB Modified:":" \xBB Ge\xE4ndert:"," Overall Agreement Rate:":" Gesamtzustimmungsrate:","No tool calls have been made in this session.":"In dieser Sitzung wurden keine Werkzeugaufrufe gemacht.","Session start time is unavailable, cannot calculate stats.":"Sitzungsstartzeit nicht verf\xFCgbar, Statistiken k\xF6nnen nicht berechnet werden.",Activity:"Aktivit\xE4t",Efficiency:"Effizienz",Today:"Heute","Token Trend":"Token-Trend","Cache Hit Rate":"Cache-Trefferquote","Tool Success":"Tool-Erfolgsrate","Tool Leaderboard":"Tool-Rangliste",Time:"Zeit",Success:"Erfolg",Cache:"Cache",Latency:"Latenz","Code Impact":"Code-\xC4nderungen",net:"netto",streak:"Serie",best:"Rekord","Command Format Migration":"Befehlsformat-Migration","Found {{count}} TOML command file:":"{{count}} TOML-Befehlsdatei gefunden:","Found {{count}} TOML command files:":"{{count}} TOML-Befehlsdateien gefunden:","Current tasks":"Aktuelle Aufgaben","Background tasks":"Hintergrundaufgaben","No tasks currently running":"Derzeit laufen keine Aufgaben","No entry to show.":"Kein Eintrag zum Anzeigen.","needs approval":"wartet auf Genehmigung","Background agent needs approval":"Hintergrund-Agent wartet auf Genehmigung","Approve or deny the request above":"Genehmigen oder lehnen Sie die obige Anfrage ab",Running:"L\xE4uft",Paused:"Pausiert",Completed:"Abgeschlossen",Failed:"Fehlgeschlagen",Stopped:"Gestoppt",Shell:"Shell",Monitor:"Monitor",Command:"Befehl",Dream:"Dream","[dream] memory consolidation":"[dream] Speicher-Konsolidierung","[dream] memory consolidation (reviewing {{count}} session)":"[dream] Speicher-Konsolidierung (pr\xFCft {{count}} Sitzung)","[dream] memory consolidation (reviewing {{count}} sessions)":"[dream] Speicher-Konsolidierung (pr\xFCft {{count}} Sitzungen)","... and {{count}} more":"... und {{count}} weitere","The TOML format is deprecated. Would you like to migrate them to Markdown format?":"Das TOML-Format ist veraltet. M\xF6chten Sie sie ins Markdown-Format migrieren?","(Backups will be created and original files will be preserved)":"(Backups werden erstellt und Originaldateien werden beibehalten)","Waiting for user confirmation...":"Warten auf Benutzerbest\xE4tigung...","Themes with a bit of home: Wattle, Outback, Reef, Southern Cross \u2014 try /theme.":"Themes with a bit of home: Wattle, Outback, Reef, Southern Cross \u2014 try /theme.","Need a breather? /aussie hops a little Matilda easter egg across the terminal.":"Need a breather? /aussie hops a little Matilda easter egg across the terminal.","Show the {{animal}} hop":"Show the {{animal}} hop",'Unknown Aussie animal "{{name}}". Try: {{animals}}':'Unknown Aussie animal "{{name}}". Try: {{animals}}',WITTY_LOADING_PHRASES:["Auf gut Gl\xFCck!","Genialit\xE4t wird ausgeliefert...","Die Serifen werden aufgemalt...","Durch den Schleimpilz navigieren...","Die digitalen Geister werden befragt...","Splines werden retikuliert...","Die KI-Hamster werden aufgew\xE4rmt...","Die Zaubermuschel wird befragt...","Witzige Erwiderung wird generiert...","Die Algorithmen werden poliert...","Perfektion braucht Zeit (mein Code auch)...","Frische Bytes werden gebr\xFCht...","Elektronen werden gez\xE4hlt...","Kognitive Prozessoren werden aktiviert...","Auf Syntaxfehler im Universum wird gepr\xFCft...","Einen Moment, Humor wird optimiert...","Pointen werden gemischt...","Neuronale Netze werden entwirrt...","Brillanz wird kompiliert...","wit.exe wird geladen...","Die Wolke der Weisheit wird beschworen...","Eine witzige Antwort wird vorbereitet...","Einen Moment, ich debugge die Realit\xE4t...","Die Optionen werden verwirrt...","Kosmische Frequenzen werden eingestellt...","Eine Antwort wird erstellt, die Ihrer Geduld w\xFCrdig ist...","Die Einsen und Nullen werden kompiliert...","Abh\xE4ngigkeiten werden aufgel\xF6st... und existenzielle Krisen...","Erinnerungen werden defragmentiert... sowohl RAM als auch pers\xF6nliche...","Das Humor-Modul wird neu gestartet...","Das Wesentliche wird zwischengespeichert (haupts\xE4chlich Katzen-Memes)...","F\xFCr l\xE4cherliche Geschwindigkeit wird optimiert","Bits werden getauscht... sagen Sie es nicht den Bytes...","Garbage Collection l\xE4uft... bin gleich zur\xFCck...","Das Internet wird zusammengebaut...","Kaffee wird in Code umgewandelt...","Die Syntax der Realit\xE4t wird aktualisiert...","Die Synapsen werden neu verdrahtet...","Ein verlegtes Semikolon wird gesucht...","Die Zahnr\xE4der werden geschmiert...","Die Server werden vorgeheizt...","Der Fluxkompensator wird kalibriert...","Der Unwahrscheinlichkeitsantrieb wird aktiviert...","Die Macht wird kanalisiert...","Die Sterne werden f\xFCr optimale Antwort ausgerichtet...","So sagen wir alle...","Die n\xE4chste gro\xDFe Idee wird geladen...","Einen Moment, ich bin in der Zone...","Bereite mich vor, Sie mit Brillanz zu blenden...","Einen Augenblick, ich poliere meinen Witz...","Halten Sie durch, ich erschaffe ein Meisterwerk...","Einen Moment, ich debugge das Universum...","Einen Moment, ich richte die Pixel aus...","Einen Moment, ich optimiere den Humor...","Einen Moment, ich tune die Algorithmen...","Warp-Geschwindigkeit aktiviert...","Mehr Dilithium-Kristalle werden gesucht...","Keine Panik...","Dem wei\xDFen Kaninchen wird gefolgt...","Die Wahrheit ist hier drin... irgendwo...","Auf die Kassette wird gepustet...","Ladevorgang... Machen Sie eine Fassrolle!","Auf den Respawn wird gewartet...","Der Kessel-Flug wird in weniger als 12 Parsec beendet...","Der Kuchen ist keine L\xFCge, er l\xE4dt nur noch...","Am Charaktererstellungsbildschirm wird herumgefummelt...","Einen Moment, ich suche das richtige Meme...","'A' wird zum Fortfahren gedr\xFCckt...","Digitale Katzen werden geh\xFCtet...","Die Pixel werden poliert...","Ein passender Ladebildschirm-Witz wird gesucht...","Ich lenke Sie mit diesem witzigen Spruch ab...","Fast da... wahrscheinlich...","Unsere Hamster arbeiten so schnell sie k\xF6nnen...","Cloudy wird am Kopf gestreichelt...","Die Katze wird gestreichelt...","Meinen Chef rickrollen...","Never gonna give you up, never gonna let you down...","Auf den Bass wird geschlagen...","Die Schnozbeeren werden probiert...","I'm going the distance, I'm going for speed...","Ist dies das wahre Leben? Ist dies nur Fantasie?...","Ich habe ein gutes Gef\xFChl dabei...","Den B\xE4ren wird gestupst...","Recherche zu den neuesten Memes...","\xDCberlege, wie ich das witziger machen kann...","Hmmm... lassen Sie mich nachdenken...","Wie nennt man einen Fisch ohne Augen? Ein Fsh...","Warum ging der Computer zur Therapie? Er hatte zu viele Bytes...","Warum m\xF6gen Programmierer keine Natur? Sie hat zu viele Bugs...","Warum bevorzugen Programmierer den Dunkelmodus? Weil Licht Bugs anzieht...","Warum ging der Entwickler pleite? Er hat seinen ganzen Cache aufgebraucht...","Was kann man mit einem kaputten Bleistift machen? Nichts, er ist sinnlos...","Perkussive Wartung wird angewendet...","Die richtige USB-Ausrichtung wird gesucht...","Es wird sichergestellt, dass der magische Rauch in den Kabeln bleibt...","Versuche Vim zu beenden...","Das Hamsterrad wird angeworfen...","Das ist kein Bug, das ist ein undokumentiertes Feature...","Engage.","Ich komme wieder... mit einer Antwort.","Mein anderer Prozess ist eine TARDIS...","Mit dem Maschinengeist wird kommuniziert...","Die Gedanken marinieren lassen...","Gerade erinnert, wo ich meine Schl\xFCssel hingelegt habe...","\xDCber die Kugel wird nachgedacht...","Ich habe Dinge gesehen, die Sie nicht glauben w\xFCrden... wie einen Benutzer, der Lademeldungen liest.","Nachdenklicher Blick wird initiiert...","Was ist der Lieblingssnack eines Computers? Mikrochips.","Warum tragen Java-Entwickler Brillen? Weil sie nicht C#.","Der Laser wird aufgeladen... pew pew!","Durch Null wird geteilt... nur Spa\xDF!","Suche nach einem erwachsenen Aufseh... ich meine, Verarbeitung.","Es piept und boopt.","Pufferung... weil auch KIs einen Moment brauchen.","Quantenteilchen werden f\xFCr schnellere Antwort verschr\xE4nkt...","Das Chrom wird poliert... an den Algorithmen.","Sind Sie nicht unterhalten? (Arbeite daran!)","Die Code-Gremlins werden beschworen... zum Helfen, nat\xFCrlich.","Warte nur auf das Einwahlton-Ende...","Das Humor-O-Meter wird neu kalibriert.","Mein anderer Ladebildschirm ist noch lustiger.","Ziemlich sicher, dass irgendwo eine Katze \xFCber die Tastatur l\xE4uft...","Verbessern... Verbessern... L\xE4dt noch.","Das ist kein Bug, das ist ein Feature... dieses Ladebildschirms.","Haben Sie versucht, es aus- und wieder einzuschalten? (Den Ladebildschirm, nicht mich.)","Zus\xE4tzliche Pylonen werden gebaut..."],"Enter value...":"Wert eingeben...","Enter sensitive value...":"Sensiblen Wert eingeben...","Press Enter to submit, Escape to cancel":"Enter zum Absenden, Escape zum Abbrechen dr\xFCcken","Markdown file already exists: {{filename}}":"Markdown-Datei existiert bereits: {{filename}}","TOML Command Format Deprecation Notice":"TOML-Befehlsformat Veraltet-Hinweis","Found {{count}} command file(s) in TOML format:":"{{count}} Befehlsdatei(en) im TOML-Format gefunden:","The TOML format for commands is being deprecated in favor of Markdown format.":"Das TOML-Format f\xFCr Befehle wird zugunsten des Markdown-Formats eingestellt.","Markdown format is more readable and easier to edit.":"Das Markdown-Format ist lesbarer und einfacher zu bearbeiten.","You can migrate these files automatically using:":"Sie k\xF6nnen diese Dateien automatisch migrieren mit:","Or manually convert each file:":"Oder jede Datei manuell konvertieren:",'TOML: prompt = "..." / description = "..."':'TOML: prompt = "..." / description = "..."',"Markdown: YAML frontmatter + content":"Markdown: YAML-Frontmatter + Inhalt","The migration tool will:":"Das Migrationstool wird:","Convert TOML files to Markdown":"TOML-Dateien in Markdown konvertieren","Create backups of original files":"Sicherungen der Originaldateien erstellen","Preserve all command functionality":"Alle Befehlsfunktionen beibehalten","TOML format will continue to work for now, but migration is recommended.":"Das TOML-Format funktioniert vorerst weiter, aber eine Migration wird empfohlen.","Open extensions page in your browser":"Erweiterungsseite im Browser \xF6ffnen","Unknown extensions source: {{source}}.":"Unbekannte Erweiterungsquelle: {{source}}.","Would open extensions page in your browser: {{url}} (skipped in test environment)":"W\xFCrde Erweiterungsseite im Browser \xF6ffnen: {{url}} (\xFCbersprungen in Testumgebung)","View available extensions at {{url}}":"Verf\xFCgbare Erweiterungen ansehen unter {{url}}","Opening extensions page in your browser: {{url}}":"Erweiterungsseite wird im Browser ge\xF6ffnet: {{url}}","Failed to open browser. Check out the extensions gallery at {{url}}":"Browser konnte nicht ge\xF6ffnet werden. Besuchen Sie die Erweiterungsgalerie unter {{url}}","When the yarn gets long, /compress summarises history and frees context.":"Verwenden Sie /compress, wenn die Unterhaltung lang wird, um den Verlauf zusammenzufassen und Kontext freizugeben.","Fresh start with /clear or /new \u2014 the previous yarn stays in history.":"Starten Sie eine neue Idee mit /clear oder /new; die vorherige Sitzung bleibt im Verlauf verf\xFCgbar.","Something crook? /bug sends it to the maintainers.":"Verwenden Sie /bug, um Probleme an die Betreuer zu melden, wenn etwas schiefgeht.","Switch providers quickly with /auth.":"Wechseln Sie den Authentifizierungstyp schnell mit /auth.","Run any shell command with ! (e.g. !ls) without leaving Matilda.":"Sie k\xF6nnen beliebige Shell-Befehle in Matilda mit ! ausf\xFChren (z. B. !ls).","Type / for the command menu \u2014 Tab autocompletes slash commands and saved prompts.":"Geben Sie / ein, um das Befehlsmen\xFC zu \xF6ffnen; Tab vervollst\xE4ndigt Slash-Befehle und gespeicherte Prompts.","Pick up where you left off with matilda --continue or matilda --resume.":"Sie k\xF6nnen eine fr\xFChere Unterhaltung mit matilda --continue oder matilda --resume fortsetzen.","Cycle permission modes with Shift+Tab, or jump with /approval-mode (try bogan for full auto).":"Sie k\xF6nnen den Berechtigungsmodus schnell mit Shift+Tab oder /approval-mode wechseln.","Cycle permission modes with Tab, or jump straight with /approval-mode (try bogan for full auto).":"Sie k\xF6nnen den Berechtigungsmodus schnell mit Tab oder /approval-mode wechseln.","Try /insight for a personalised squiz at patterns in your chat history.":"Probieren Sie /insight, um personalisierte Erkenntnisse aus Ihrem Chatverlauf zu erstellen.","Press Ctrl+O for compact mode \u2014 hide tool output for a cleaner view.":"Ctrl+O dr\xFCcken, um den Kompaktmodus umzuschalten \u2014 Tool-Ausgabe ausblenden.","Drop a MATILDA.md in the project so Matilda keeps persistent context.":"F\xFCgen Sie eine MATILDA.md-Datei hinzu, um Matilda dauerhaften Projektkontext zu geben.","Duck out of the main thread with /btw \u2014 quick side question, same chat.":"Verwenden Sie /btw, um eine kurze Nebenfrage zu stellen, ohne die Unterhaltung zu unterbrechen.","Context is almost full! Run /compress now or start /new to continue.":"Der Kontext ist fast voll! F\xFChren Sie jetzt /compress aus oder starten Sie /new, um fortzufahren.","Context is getting full. Use /compress to free up space.":"Der Kontext f\xFCllt sich. Verwenden Sie /compress, um Platz freizugeben.","Conversation getting long? /compress rolls it up and frees context.":"Lange Unterhaltung? /compress fasst den Verlauf zusammen, um Kontext freizugeben.","You can configure your API key and models in settings.json":"Sie k\xF6nnen Ihren API Key und Modelle in settings.json konfigurieren","Refer to the documentation for setup instructions":"Einrichtungsanweisungen finden Sie in der Dokumentation","API key cannot be empty.":"API Key darf nicht leer sein.",Custom:"Benutzerdefiniert","Choose based on where your account is registered":"W\xE4hlen Sie basierend auf dem Registrierungsort Ihres Kontos","New model configurations are available for {{region}}. Update now?":"Neue Modellkonfigurationen sind f\xFCr {{region}} verf\xFCgbar. Jetzt aktualisieren?",'{{region}} configuration updated successfully. Model switched to "{{model}}".':'{{region}}-Konfiguration erfolgreich aktualisiert. Modell auf "{{model}}" umgeschaltet.',"Context Usage":"Kontextnutzung","% used":"% verwendet","% context used":"% Kontext verwendet","Context exceeds limit! Use /compress or /clear to reduce.":"Kontext \xFCberschreitet Limit! Verwenden Sie /compress oder /clear zum Reduzieren.","No API response yet. Send a message to see actual usage.":"Noch keine API-Antwort. Senden Sie eine Nachricht, um die tats\xE4chliche Nutzung anzuzeigen.","Estimated pre-conversation overhead":"Gesch\xE4tzte Vorabkosten vor der Unterhaltung","Context window":"Kontextfenster",tokens:"Tokens",Used:"Verwendet",Free:"Frei","Autocompact buffer":"Autokomprimierungs-Puffer","Usage by category":"Verwendung nach Kategorie","System prompt":"System-Prompt","Built-in tools":"Integrierte Tools","MCP tools":"MCP tools","Memory files":"Speicherdateien",Skills:"F\xE4higkeiten",Messages:"Nachrichten","Run /context detail for per-item breakdown.":"F\xFChren Sie /context detail f\xFCr eine Aufschl\xFCsselung nach Elementen aus.",active:"aktiv","body loaded":"Inhalt geladen",memory:"Speicher","{{region}} configuration updated successfully.":"{{region}}-Konfiguration erfolgreich aktualisiert.","Authenticated successfully with {{region}}. API key and model configs saved to settings.json.":"Erfolgreich mit {{region}} authentifiziert. API Key und Modellkonfigurationen wurden in settings.json gespeichert.","Type something...":"Etwas eingeben...",Submit:"Senden","Submit answers":"Antworten senden",Cancel:"Abbrechen","Your answers:":"Ihre Antworten:","(not answered)":"(nicht beantwortet)","Ready to submit your answers?":"Bereit, Ihre Antworten zu senden?","\u2191/\u2193: Navigate | \u2190/\u2192: Switch tabs | Enter: Select":"\u2191/\u2193: Navigieren | \u2190/\u2192: Tabs wechseln | Enter: Ausw\xE4hlen","\u2191/\u2193: Navigate | Enter: Select | Esc: Cancel":"\u2191/\u2193: Navigieren | Enter: Ausw\xE4hlen | Esc: Abbrechen","Authenticate using Matilda OAuth":"Mit Matilda OAuth authentifizieren","Show current authentication status":"Aktuellen Authentifizierungsstatus anzeigen","Authentication completed successfully.":"Authentifizierung erfolgreich abgeschlossen.","Starting Matilda OAuth authentication...":"Matilda OAuth-Authentifizierung wird gestartet...","Successfully authenticated with Matilda OAuth.":"Erfolgreich mit Matilda OAuth authentifiziert.","Failed to authenticate with Matilda OAuth: {{error}}":"Authentifizierung mit Matilda OAuth fehlgeschlagen: {{error}}",Global:"Global","Select authentication method:":"Authentifizierungsmethode ausw\xE4hlen:","\n=== Authentication Status ===\n":`
10
10
  === Authentifizierungsstatus ===
@@ -1,11 +1,11 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{a as C}from"./chunk-6T2GIM76.js";import{Ce as G,Dc as X,Se as R,Te as S,Ze as K,_e as V,bf as Q,ef as Y,ha as D,ue as L,ve as q}from"./chunk-3WBC3IIX.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-MTMU7JYZ.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-WXCEBLRE.js";import"./chunk-MCQUPLRE.js";import"./chunk-47XR7IMP.js";import"./chunk-GTVCJCHR.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-QKYGQLWC.js";import"./chunk-6EQMZNIY.js";import"./chunk-PW3LFA6D.js";import"./chunk-DE3HKC2W.js";import"./chunk-AQQOBDEP.js";import"./chunk-YV3PUOBU.js";import"./chunk-P3G4HEXP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{Mb as j,Pa as H,ca as U,dd as B,ia as P,wc as A}from"./chunk-JA43M5MZ.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{w as z}from"./chunk-PGXQZVLX.js";import"./chunk-YRQP3SLC.js";import{i as k,p as F,q as W}from"./chunk-6E766NPX.js";import"./chunk-ZYCVL46M.js";import"./chunk-ET7ZXQ3A.js";import"./chunk-VI74YQQO.js";import"./chunk-3YLXGE6T.js";import"./chunk-LUNDTQ3G.js";import{D as T,E as I,G as v,b as x,ba as $}from"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";b();import*as _ from"node:fs";import*as p from"node:path";b();var re={"\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":" "},ue=new RegExp(`[${Object.keys(re).join("")}]`,"g");function w(n){return n.replace(ue,t=>re[t])}var he=[n=>n,n=>n.trimEnd()];function pe(n){return w(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 me(n){let t=n.split(`
3
+ import{a as C}from"./chunk-6T2GIM76.js";import{Ef as R,Ff as S,Jf as K,Kf as V,Nf as Q,Qf as Y,Ua as D,if as L,jf as q,od as X,qf as G}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{Mb as j,Pa as H,ca as U,cd as B,ia as P,wc as A}from"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{w as z}from"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import{i as k,p as F,q as W}from"./chunk-6E766NPX.js";import{D as T,E as I,G as v,b as x,ba as $}from"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";b();import*as _ from"node:fs";import*as p from"node:path";b();var re={"\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":" "},ue=new RegExp(`[${Object.keys(re).join("")}]`,"g");function w(n){return n.replace(ue,t=>re[t])}var he=[n=>n,n=>n.trimEnd()];function pe(n){return w(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 me(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 l=t[e]??0,s=e+r-1,f=(t[s]??0)+(i[s]?.length??0);if(o){let g=t[e+r];g!==void 0?f=g:n.endsWith(`
6
6
  `)&&(f=n.length)}return n.slice(l,f)}function _e(n,t){let{lines:i,offsets:e}=me(n),r=t.split(`
7
7
  `),o=t.endsWith(`
8
- `);if(r.length===0)return null;let l=c=>{for(let f of he){let g=J(i,c,f);if(g!==null)return g}return J(i,c,pe)},s=l(r);if(s!==null)return{slice:Z(n,e,i,s,r.length,o),removedTrailingFinalEmptyLine:!1};if(r.at(-1)===""){let c=r.slice(0,-1);if(c.length===0)return null;if(s=l(c),s!==null)return{slice:Z(n,e,i,s,c.length,!1),removedTrailingFinalEmptyLine:!0}}return null}function we(n,t){if(t==="")return null;let i=n.indexOf(t);if(i!==-1)return{slice:n.slice(i,i+t.length),removedTrailingFinalEmptyLine:!1};let e=w(n),r=w(t),o=e.indexOf(r);return o!==-1?{slice:n.slice(o,o+t.length),removedTrailingFinalEmptyLine:!1}:_e(n,t)}function Ee(n){return n.endsWith(`\r
8
+ `);if(r.length===0)return null;let l=c=>{for(let f of he){let g=J(i,c,f);if(g!==null)return g}return J(i,c,pe)},s=l(r);if(s!==null)return{slice:Z(n,e,i,s,r.length-(o?1:0),o),removedTrailingFinalEmptyLine:!1};if(r.at(-1)===""){let c=r.slice(0,-1);if(c.length===0)return null;if(s=l(c),s!==null)return{slice:Z(n,e,i,s,c.length,!1),removedTrailingFinalEmptyLine:!0}}return null}function we(n,t){if(t==="")return null;let i=n.indexOf(t);if(i!==-1)return{slice:n.slice(i,i+t.length),removedTrailingFinalEmptyLine:!1};let e=w(n),r=w(t),o=e.indexOf(r);return o!==-1?{slice:n.slice(o,o+t.length),removedTrailingFinalEmptyLine:!1}:_e(n,t)}function Ee(n){return n.endsWith(`\r
9
9
  `)?n.slice(0,-2):n.endsWith(`
10
10
  `)||n.endsWith("\r")?n.slice(0,-1):n}function ye(n,t){return t?Ee(n):n}function oe(n,t,i){if(n===null||t==="")return{oldString:t,newString:i};let e=we(n,t);return e!==null?{oldString:e.slice,newString:ye(i,e.removedTrailingFinalEmptyLine)}:{oldString:t,newString:i}}function se(n,t,i){if(n===null||t===""||i!==""||t.endsWith(`
11
11
  `))return t;let e=`${t}