@maincode-ai/matilda-code 0.22.0-nightly.20261102.db95a17c4 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/agent-JDATO222.js +3 -0
- package/chunks/agent-headless-ZOFNY4CF.js +3 -0
- package/chunks/{askUserQuestion-7PM7G5YF.js → askUserQuestion-A46IDHKS.js} +1 -1
- package/chunks/{chunk-7MUWF4DK.js → chunk-2LVAK6TV.js} +1 -1
- package/chunks/{chunk-QUYQBKDE.js → chunk-5JCW6FH6.js} +1 -1
- package/chunks/{chunk-WENVHSCJ.js → chunk-6RK6IJY5.js} +1 -1
- package/chunks/{chunk-ESNPNLMQ.js → chunk-7AEOFDY3.js} +1 -1
- package/chunks/{chunk-ZABH4QIL.js → chunk-AEYNMLMW.js} +1 -1
- package/chunks/{chunk-4KS2KEXK.js → chunk-CI5CVVGI.js} +62 -62
- package/chunks/{chunk-4MLFC664.js → chunk-DEN6RR3B.js} +1 -1
- package/chunks/{chunk-QBXL5UBB.js → chunk-FI2FSW7J.js} +1 -1
- package/chunks/{chunk-BVTXZTL3.js → chunk-GCMUSGTT.js} +1 -1
- package/chunks/{chunk-66WJUORA.js → chunk-HRCRNKY2.js} +1 -1
- package/chunks/{chunk-JR5CSCG4.js → chunk-IV6PS6DB.js} +1 -1
- package/chunks/{chunk-CVGGYRNK.js → chunk-KYNP66YS.js} +1 -1
- package/chunks/{chunk-QDWS3VZT.js → chunk-LONWTJOE.js} +1 -1
- package/chunks/{chunk-35BBGAHD.js → chunk-QNXNECWR.js} +458 -460
- package/chunks/{chunk-2QIC3OCV.js → chunk-RH3AEZWO.js} +1 -1
- package/chunks/{chunk-QMZREVY3.js → chunk-SMTY6M3W.js} +1 -1
- package/chunks/{chunk-VVUY7VKR.js → chunk-TDFF4ZGY.js} +1 -1
- package/chunks/chunk-TKEFJ3O3.js +9 -0
- package/chunks/{chunk-S2E5ZRPH.js → chunk-UICLGQTV.js} +1 -1
- package/chunks/{chunk-6U5VOTWB.js → chunk-V2V3OF76.js} +1 -1
- package/chunks/chunk-XPVKH5TC.js +10 -0
- package/chunks/{chunk-33UVJMVE.js → chunk-Y3SZK63U.js} +16 -16
- package/chunks/{chunk-KRVXBQRC.js → chunk-ZABAV4XA.js} +1 -1
- package/chunks/{computer-use-IZGLKENV.js → computer-use-V2DT2IKO.js} +1 -1
- package/chunks/{cron-create-BTSJUVNT.js → cron-create-JINCFLKY.js} +1 -1
- package/chunks/{cron-delete-PTE3RC2W.js → cron-delete-RF6JLUAV.js} +1 -1
- package/chunks/{cron-list-SINKHOIZ.js → cron-list-VXLBAXZ3.js} +1 -1
- package/chunks/{edit-MDQEZ7BA.js → edit-ZB4SONLT.js} +3 -3
- package/chunks/{enter-worktree-SZK65VXF.js → enter-worktree-CAFTW46C.js} +1 -1
- package/chunks/{enterPlanMode-5VWIIVHI.js → enterPlanMode-XSNXJJMC.js} +1 -1
- package/chunks/{exit-worktree-OBHUK4TF.js → exit-worktree-U37YLKJC.js} +1 -1
- package/chunks/{exitPlanMode-SXFQC4G2.js → exitPlanMode-XKAZCVAV.js} +1 -1
- package/chunks/{glob-JKIZ3ZJQ.js → glob-LPIFPVGX.js} +1 -1
- package/chunks/{goal-tools-YJMECZYD.js → goal-tools-VAH424PW.js} +1 -1
- package/chunks/{grep-Q4T5AE6K.js → grep-IF4GTD5A.js} +1 -1
- package/chunks/{keychain-token-storage-4PY5J6U6.js → keychain-token-storage-UTWIIKCK.js} +1 -1
- package/chunks/{ls-BQCCCPIX.js → ls-3EEHZY4W.js} +1 -1
- package/chunks/{lsp-MHJJJ7K3.js → lsp-H4EXPHFD.js} +1 -1
- package/chunks/mcp-client-EUPXG3VF.js +3 -0
- package/chunks/monitor-KBWRPPZ5.js +32 -0
- package/chunks/notebook-edit-K3KNR6DI.js +17 -0
- package/chunks/{openaiContentGenerator-DTKOYRBL.js → openaiContentGenerator-2NF5JGUC.js} +8 -8
- package/chunks/read-file-SRDZKBNS.js +3 -0
- package/chunks/ripGrep-675JNT4W.js +3 -0
- package/chunks/scheduler-O36AJTWS.js +8 -0
- package/chunks/{send-message-S4P5QKSW.js → send-message-5XHDGHSN.js} +1 -1
- package/chunks/shell-A7NRVDCY.js +3 -0
- package/chunks/{skill-V6NTJ4O4.js → skill-FCVSGCSN.js} +1 -1
- package/chunks/{symbol-search-5QJNW7PY.js → symbol-search-ZM3HFCUV.js} +1 -1
- package/chunks/{syntheticOutput-3XIAIUIR.js → syntheticOutput-OIPRFBVD.js} +1 -1
- package/chunks/{task-create-KGPY7O4J.js → task-create-QP44DKH4.js} +1 -1
- package/chunks/{task-detach-ZD3A7225.js → task-detach-AUTU6C4G.js} +1 -1
- package/chunks/{task-list-P7GQWYAD.js → task-list-U2WAGMM7.js} +1 -1
- package/chunks/{task-stop-VFJRBA6P.js → task-stop-GN5WZ3IA.js} +1 -1
- package/chunks/{task-update-OOMH4WRA.js → task-update-26N2AUQT.js} +1 -1
- package/chunks/{team-create-POMZOM44.js → team-create-TN2KN27J.js} +1 -1
- package/chunks/{team-delete-ZJBEQDPE.js → team-delete-XCKD5FBZ.js} +1 -1
- package/chunks/todoWrite-JN3ZV5O2.js +3 -0
- package/chunks/{tool-search-5Z7MO565.js → tool-search-VPMEQKAS.js} +1 -1
- package/chunks/{web-fetch-M4TUYAFG.js → web-fetch-CVAOVOZM.js} +1 -1
- package/chunks/{web-search-CBKF36JM.js → web-search-77CUPTFY.js} +3 -3
- package/chunks/{workflow-F57TWWPS.js → workflow-JNZRGHJ4.js} +2 -2
- package/chunks/write-file-FJCU2PYT.js +15 -0
- package/cli.js +391 -391
- package/package.json +2 -2
- package/chunks/agent-4GIFJO5G.js +0 -3
- package/chunks/agent-headless-DXJESNI4.js +0 -3
- package/chunks/chunk-JNHB73E3.js +0 -9
- package/chunks/mcp-client-CSF5QZEY.js +0 -3
- package/chunks/monitor-JUAVWVLY.js +0 -32
- package/chunks/notebook-edit-NNOMEUER.js +0 -17
- package/chunks/read-file-4EX4B3TB.js +0 -3
- package/chunks/ripGrep-JL6UDNCR.js +0 -3
- package/chunks/scheduler-GCGZAI7D.js +0 -8
- package/chunks/shell-J7EX7B57.js +0 -3
- package/chunks/todoWrite-EWYRFK7W.js +0 -3
- package/chunks/write-file-UK4BVL3M.js +0 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{c as p}from"./chunk-
|
|
3
|
+
import{c as p}from"./chunk-UICLGQTV.js";import{b as h}from"./chunk-7ZODGQO6.js";import{a as M}from"./chunk-GT6MSEK4.js";import{b as d}from"./chunk-7AEOFDY3.js";import{Y as b,c as f}from"./chunk-AEYNMLMW.js";import{b as u}from"./chunk-GZPNIYVZ.js";import{f as E}from"./chunk-OWGSC52X.js";u();var x=null;function D(){x=null}function _(e,r,t){return x?(x.enqueueApproval({teammateName:e,teammateColor:r,details:t}),!0):!1}function P(e,r,t,o){return{...e,title:`[${r}] ${e.title}`,onConfirm:async(i,s)=>{await t(i,s)}}}u();var C=E(h(),1);import*as a from"node:fs/promises";import*as c from"node:path";var w=b("AGENTS_TEAM_MAILBOX"),N={retries:{retries:10,minTimeout:5,maxTimeout:100,factor:2,randomize:!0},stale:5e3,onCompromised:e=>{w.debug("mailbox lock compromised:",e?.message??e)}},g=new Map;function O(e){let r=g.get(e);return r||(r=new M,g.set(e,r)),r}function I(e){let r=p(e),t=0;for(let o of g.keys())c.dirname(o)===r&&(g.delete(o),t++);return t}async function T(e,r){return O(e).runExclusive(async()=>{let t=await C.default.lock(e,N);try{return await r()}finally{await t()}})}function y(e,r){return c.join(p(e),`${r}.json`)}async function B(e,r){let t=y(e,r);try{let o=await a.readFile(t,"utf-8");return JSON.parse(o)}catch(o){if(f(o)&&o.code==="ENOENT")return[];throw o}}var L=5*60*1e3;async function A(e,r,t){let o=y(e,r);await v(o),await T(o,async()=>{let i=await k(o),s=Date.now()-L,l=i.filter(m=>{if(!m.read)return!0;let n=Date.parse(m.timestamp);return Number.isNaN(n)||n>=s});l.push(t),await d(o,l)})}async function W(e,r,t){let o=y(e,r);return await v(o),T(o,async()=>{let i=await k(o),s=n=>!n.read&&(t===void 0||n.type===t),l=i.filter(s);if(l.length===0)return[];let m=i.map(n=>s(n)?{...n,read:!0}:n);return await d(o,m),l})}async function X(e){let r=p(e);await a.rm(r,{recursive:!0,force:!0}),I(e)}async function z(e,r,t){await A(e,r,{from:t.from,text:t.text,timestamp:new Date().toISOString(),read:!1,type:t.type,color:t.color,summary:t.summary})}async function v(e){await a.mkdir(c.dirname(e),{recursive:!0});try{await a.writeFile(e,`[]
|
|
4
4
|
`,{flag:"wx"})}catch(r){if(!f(r)||r.code!=="EEXIST")throw r}}async function k(e){try{let r=await a.readFile(e,"utf-8");return JSON.parse(r)}catch(r){if(f(r)&&r.code==="ENOENT")return[];let t=r instanceof Error?r.message:String(r);w.warn(`Quarantining corrupt inbox at ${e}: ${t}`);try{await a.rename(e,`${e}.corrupt-${Date.now()}`)}catch(o){let i=o instanceof Error?o.message:String(o);throw w.warn(`Failed to quarantine ${e}: ${i}`),r instanceof Error?r:new Error(`Failed to read inbox at ${e}: ${t}`)}return[]}}export{D as a,_ as b,P as c,I as d,y as e,B as f,A as g,W as h,X as i,z as j};
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as c}from"./chunk-V6UPUMP3.js";import{m as u}from"./chunk-
|
|
3
|
+
import{a as c}from"./chunk-V6UPUMP3.js";import{m as u}from"./chunk-KYNP66YS.js";import{b as m}from"./chunk-GZPNIYVZ.js";m();import{AsyncLocalStorage as h}from"node:async_hooks";var a=new h,r=new WeakMap,p={turns:"max_turn_requests",session_turns:"max_turn_requests",loop_detected:"max_turn_requests",continuations:"max_turn_requests",session_tokens:"max_tokens"},k=class{jobs=new Map;joinsJobs;wake;closed=!1;revision=0;task;lastResponse;stop;ended;finished;constructor(e={}){this.joinsJobs=e.joinsJobs??!0}begin(e,t,s=e){this.task||(this.task={startUuid:e,rootUuid:s,recorder:t},this.ended&&this.finish(this.ended).catch(()=>{}))}get taskStartUuid(){return this.task?.startUuid}get taskRef(){return this.task?{startUuid:this.task.startUuid,rootUuid:this.task.rootUuid}:void 0}noteResponse(e){this.lastResponse=e}noteStop(e){this.stop=e}finish(e){let t=this.task;return t?(this.finished??=this.recordOutcome(t,e),this.finished):(this.ended??=e,Promise.resolve(void 0))}async recordOutcome(e,t){let s=this.stop&&(t.outcome==="completed"||t.outcome==="error")?p[this.stop]:t.outcome,i=s==="completed"&&this.lastResponse?.finalAnswer?this.lastResponse:void 0,n=t.limitKind??(s==="max_tokens"||s==="max_turn_requests"?this.stop:void 0);return await e.recorder.recordTaskOutcome({taskStartUuid:e.startUuid,outcome:s,...n?{limitKind:n}:{},...s==="completed"?{finalAnswerUuid:i?i.recordId??i.id:null}:{}}),{outcome:s,...i&&{finalAnswerId:i.id}}}static get current(){return a.getStore()}run(e){return a.run(this,e)}static detached(e){return a.run(void 0,e)}static register(e,t,s){let i=a.getStore();e.originTask??=s?.originTask??i?.taskRef;let n=s?.status==="running"?r.get(s):void 0,o=n??(i?.joinsJobs?i:void 0);if(o){if(n&&s&&n.consume(s),e.completion==="detached"||!n&&e.status!=="running"){o.changed();return}if(r.set(e,o),o.closed){t();return}o.jobs.set(e,t),o.changed()}}static changed(e){e&&r.get(e)?.changed()}static abandoned(e){return r.get(e)?.closed===!0}static detach(e){let t=r.get(e);return!t||t.closed||!t.owns(e)||e.status!=="running"?!1:(e.completion="detached",t.consume(e),t.changed(),!0)}owns(e){return this.jobs.has(e)}consume(e){r.delete(e),this.jobs.delete(e)}get pending(){return this.jobs.size>0}get position(){return this.revision}get paused(){return[...this.jobs.keys()].some(e=>e.status==="paused")}get running(){return[...this.jobs.keys()].filter(e=>e.status==="running")}changed(){this.revision++,this.wake?.()}async wait(e,t,s){this.closed||t.aborted||e!==this.revision||await new Promise(i=>{let n,o=()=>{clearTimeout(n),t.removeEventListener("abort",o),this.wake=void 0,i()};this.wake=o,t.addEventListener("abort",o,{once:!0}),s!==void 0&&(n=setTimeout(o,s))})}close(){this.closed=!0;for(let[e,t]of this.jobs)e.status==="running"&&t();this.changed()}};function g(d,e){let t=s=>{let i=s.description.replace(/[\p{Cc}\s]+/gu," ").trim(),n=Math.max(1,Math.round((e-s.startTime)/6e4));return`background ${s.kind} "${i.length>80?`${i.slice(0,77)}...`:i}" (running ${n} min)`};return{displayText:`Still waiting on ${d.map(t).join(", ")}.`,modelText:d.map(s=>["<task-notification>",`<task-id>${c(s.id)}</task-id>`,`<kind>${s.kind}</kind>`,"<status>running</status>",`<summary>${c(`The ${t(s)} is still running, and this request cannot finish until it does. If the request needs its result, keep waiting. If it should keep running after the request, such as a server or watcher, call ${u.TASK_DETACH}. If it is no longer needed, call ${u.TASK_STOP}.`)}</summary>`,"</task-notification>"].join(`
|
|
4
4
|
`)).join(`
|
|
5
5
|
`)}}export{k as a,g as b};
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{l as i}from"./chunk-
|
|
3
|
+
import{l as i}from"./chunk-IV6PS6DB.js";import{b as o}from"./chunk-GZPNIYVZ.js";o();import l from"node:path";function d(t,n){if(t.getApprovalMode()!=="bogan")return null;let r=l.resolve(n),s=t.getProjectRoot?.()??t.getTargetDir();if(i(r,s))return null;let e=t.getWorkspaceContext?.();if(!e||(typeof e.isPathWithinWorkspaceFresh=="function"?e.isPathWithinWorkspaceFresh(r):e.isPathWithinWorkspace(r)))return null;let a=e.getDirectories?.()??[t.getTargetDir()],p=t.getChannel?.()==="desktop"?"Approve the folder from Matilda Desktop, then retry the write.":"Use --include-directories to add extra roots, or a non-BOGAN approval mode for intentional external writes.";return`Refusing out-of-workspace write in BOGAN mode: ${r}. Workspace root(s): ${a.join(", ")}. This blocks path typos (e.g. writing under $HOME when the project is elsewhere). `+p}export{d as a};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Matilda Team
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{d as f}from"./chunk-XPVKH5TC.js";import{Y as x}from"./chunk-AEYNMLMW.js";import{b as m}from"./chunk-GZPNIYVZ.js";m();var k=x("TRUSTED_HOOKS");var _=(o=>(o.PreToolUse="PreToolUse",o.PostToolUse="PostToolUse",o.PostToolUseFailure="PostToolUseFailure",o.PostToolBatch="PostToolBatch",o.Notification="Notification",o.UserPromptSubmit="UserPromptSubmit",o.UserPromptExpansion="UserPromptExpansion",o.SessionStart="SessionStart",o.Stop="Stop",o.SubagentStart="SubagentStart",o.SubagentStop="SubagentStop",o.PreCompact="PreCompact",o.PostCompact="PostCompact",o.SessionEnd="SessionEnd",o.PermissionRequest="PermissionRequest",o.PermissionDenied="PermissionDenied",o.StopFailure="StopFailure",o.TodoCreated="TodoCreated",o.TodoCompleted="TodoCompleted",o.InstructionsLoaded="InstructionsLoaded",o))(_||{});var b=["enabled","disabled","notifications"];function H(t){let e=t.name??"";switch(t.type){case"command":return e?`${e}:${t.command}`:t.command;case"http":return e?`${e}:${t.url}`:t.url;case"function":return e?`${e}:${t.id??"function"}`:t.id??"function";case"prompt":return e?`${e}:${t.prompt}`:t.prompt;default:return e||"unknown"}}var P=1e4;function S(t){return f(t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),0,P).replace(/&(?:a(?:mp?)?|lt?|gt?)?$/,"")}function I(t,e){switch(t){case"PreToolUse":return new r(e);case"PostToolUse":return new u(e);case"PostToolUseFailure":return new p(e);case"UserPromptExpansion":return new a(e);case"PostToolBatch":return new c(e);case"Stop":case"SubagentStop":return new d(e);case"PermissionRequest":return new l(e);default:return new n(e)}}var n=class{continue;stopReason;suppressOutput;systemMessage;terminalSequence;decision;reason;hookSpecificOutput;constructor(e={}){this.continue=e.continue,this.stopReason=e.stopReason,this.suppressOutput=e.suppressOutput,this.systemMessage=e.systemMessage,this.terminalSequence=e.terminalSequence,this.decision=e.decision,this.reason=e.reason,this.hookSpecificOutput=e.hookSpecificOutput}isBlockingDecision(){return this.decision==="block"||this.decision==="deny"}shouldStopExecution(){return this.continue===!1}getEffectiveReason(){return this.stopReason||this.reason||"No reason provided"}getRawAdditionalContext(){if(this.hookSpecificOutput&&"additionalContext"in this.hookSpecificOutput){let e=this.hookSpecificOutput.additionalContext;return typeof e=="string"?e:void 0}}getAdditionalContext(){let e=this.getRawAdditionalContext();if(e!==void 0)return e.replace(/</g,"<").replace(/>/g,">")}getBlockingError(){return this.isBlockingDecision()?{blocked:!0,reason:this.getEffectiveReason()}:{blocked:!1,reason:""}}shouldClearContext(){return!1}},r=class extends n{getPermissionDecision(){if(this.hookSpecificOutput&&"permissionDecision"in this.hookSpecificOutput){let e=this.hookSpecificOutput.permissionDecision;if(e==="allow"||e==="deny"||e==="ask")return e}if(this.decision==="allow"||this.decision==="approve")return"allow";if(this.decision==="deny"||this.decision==="block")return"deny";if(this.decision==="ask")return"ask"}getPermissionDecisionReason(){if(this.hookSpecificOutput&&"permissionDecisionReason"in this.hookSpecificOutput){let e=this.hookSpecificOutput.permissionDecisionReason;if(typeof e=="string")return e}return this.reason}isDenied(){return this.getPermissionDecision()==="deny"}isAsk(){return this.getPermissionDecision()==="ask"}isAllowed(){return this.getPermissionDecision()==="allow"}},u=class extends n{decision;reason;constructor(e={}){super(e),this.decision=e.decision??"allow",this.reason=e.reason??"No reason provided",e.decision===void 0&&k.debug('PostToolUseHookOutput: No explicit decision set, defaulting to "allow"'),e.reason===void 0&&k.debug('PostToolUseHookOutput: No explicit reason set, defaulting to "No reason provided"')}},p=class extends n{getAdditionalContext(){return super.getAdditionalContext()}},a=class extends n{getAdditionalContext(){let e=this.getRawAdditionalContext();if(e!==void 0)return S(e)}},c=class extends n{shouldStopExecution(){return super.shouldStopExecution()||this.isBlockingDecision()}},d=class extends n{stopReason;constructor(e={}){super(e),this.stopReason=e.stopReason}getStopReason(){if(this.stopReason)return`Stop hook feedback:
|
|
4
|
+
${this.stopReason}`}},l=class extends n{getPermissionDecision(){if(this.hookSpecificOutput&&"decision"in this.hookSpecificOutput){let e=this.hookSpecificOutput.decision;if(typeof e=="object"&&e!==null&&!Array.isArray(e))return e}}isPermissionDenied(){return this.getPermissionDecision()?.behavior==="deny"}getDenyMessage(){return this.getPermissionDecision()?.message}shouldInterrupt(){return this.getPermissionDecision()?.interrupt===!0}getUpdatedToolInput(){return this.getPermissionDecision()?.updatedInput}getUpdatedPermissions(){return this.getPermissionDecision()?.updatedPermissions}};function T(t,e){let h=new Map(t.map(i=>[i.id,i])),s={created:[],completed:[]};for(let i of e){let g=h.get(i.id);g?g.status!=="completed"&&i.status==="completed"&&s.completed.push(i):s.created.push(i)}return s}export{_ as a,b,H as c,S as d,I as e,n as f,r as g,u as h,p as i,a as j,c as k,d as l,l as m,T as n};
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Matilda Team
|
|
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{g as f,h,i as T,j as w,k as x,l as s}from"./chunk-QXSBPCBA.js";import{b as g}from"./chunk-
|
|
3
|
+
import{g as f,h,i as T,j as w,k as x,l as s}from"./chunk-QXSBPCBA.js";import{b as g}from"./chunk-7AEOFDY3.js";import{O as c,c as p}from"./chunk-AEYNMLMW.js";import{b as o}from"./chunk-GZPNIYVZ.js";o();import*as n from"node:fs/promises";import*as i from"node:path";o();function y(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function M(){return i.join(c.getGlobalMatildaDir(),h)}function d(e){return i.join(M(),e)}function l(e){return i.join(d(e),w)}function I(e){return i.join(d(e),x)}function E(e){return i.join(c.getGlobalMatildaDir(),T,e)}function m(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function j(e,t){return`${m(e)}@${m(t)}`}function R(e,t){let r=m(e);if(!r)throw new Error(`Teammate name "${e}" sanitizes to an empty string. Choose a name with at least one alphanumeric character.`);if(r===f)throw new Error(`"${f}" is reserved for the team leader. Choose a different teammate name.`);let a=new Set(t.map(u=>u.name));if(a.has(r)){let u=[...a].join(", ")||"<none>";throw new Error(`A teammate named "${r}" already exists in this team (existing: ${u}). Choose a different name.`)}return r}function C(e){let t=new Set(e.map(r=>r.color).filter(r=>r!==void 0));for(let r of s)if(!t.has(r))return r;return s[e.length%s.length]}function O(e,t){let r=m(t);return e.find(a=>a.name===r)}function $(e){let t=e.trimStart();if(/^shutdown_approved\b/i.test(t))return"shutdown_approved";if(/^shutdown_rejected\b/i.test(t))return"shutdown_rejected"}async function P(e){let t=l(e);try{let r=await n.readFile(t,"utf-8");return JSON.parse(r)}catch(r){if(p(r)&&r.code==="ENOENT")return;throw r}}async function k(e,t){let r=l(e);await n.mkdir(i.dirname(r),{recursive:!0}),await g(r,t)}async function z(e,t){let r=l(e);await n.mkdir(i.dirname(r),{recursive:!0}),await n.writeFile(r,JSON.stringify(t,null,2)+`
|
|
4
4
|
`,{encoding:"utf-8",flag:"wx"})}async function L(e){let t;try{t=await P(e)}catch{return!1}return t?typeof t.leadPid!="number"||t.leadPid<=0||t.leadPid!==process.pid&&y(t.leadPid)?!1:(await b(e),!0):(await b(e),!0)}async function b(e){let t=d(e),r=E(e);await Promise.allSettled([n.rm(t,{recursive:!0,force:!0}),n.rm(r,{recursive:!0,force:!0})])}export{y as a,d as b,I as c,E as d,m as e,j as f,R as g,C as h,O as i,$ as j,k,z as l,L as m,b as n};
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as Ot}from"./chunk-
|
|
3
|
+
import{a as Ot}from"./chunk-GCMUSGTT.js";import{b as At}from"./chunk-V6UPUMP3.js";import{a as Pt}from"./chunk-225CZWD7.js";import{e as te}from"./chunk-TKEFJ3O3.js";import{k as xt,l as Ct,m as Y,p as wt}from"./chunk-KYNP66YS.js";import{Y as de}from"./chunk-AEYNMLMW.js";import{b as y}from"./chunk-GZPNIYVZ.js";y();import{AsyncLocalStorage as Nt}from"node:async_hooks";var ve=new Nt,qe=new Nt;function vr(e,t,o){return e?ve.run(e,()=>o?qe.run(i=>o.billSpend(e.goalId,i),t):t()):t()}y();function Ut(e){return`The Goal spent its autonomous token budget (${e.toLocaleString("en-US")} tokens). Resume the Goal to authorize another budget window, or clear it.`}function be(e){return e.tokenBudget!==void 0&&e.tokensUsed>=e.tokenBudget}function Mt(e){return`The Goal ran its Goal-turn budget (${e.toLocaleString("en-US")} ${e===1?"turn":"turns"}). Resume the Goal to authorize another window of turns, or clear it.`}function Ae(e){return e.turnBudget!==void 0&&e.turnCount>=e.turnBudget}function Hn(e){let t=e/6e4;if(t>=1){let i=Math.round(t);return`${i.toLocaleString("en-US")} ${i===1?"minute":"minutes"}`}let o=Math.max(1,Math.round(e/1e3));return`${o.toLocaleString("en-US")} ${o===1?"second":"seconds"}`}function Lt(e){return`The Goal ran its active-time budget (${Hn(e)}). Resume the Goal to authorize another window of time, or clear it.`}function Ne(e,t){return e.activeTimeBudgetMs!==void 0&&t>=e.activeTimeBudgetMs}function We(e){return e==="token_budget"||e==="turn_budget"||e==="time_budget"}var Sr=`<system-reminder>
|
|
4
4
|
The Goal is paused. Do not continue its objective unless the user resumes it. Treat this message as ordinary conversation.
|
|
5
5
|
</system-reminder>`;function jt(){return{v:2,goal:null,activity:"idle"}}function Er(e){return e.goal!==null&&(e.goal.status==="active"||e.activity==="running")}function Vt(e){return e.status==="blocked"&&e.blockerKind!=="authority"&&e.blockerKind!=="external"&&e.blockerKind!=="infeasible"}var Ft="The objective cannot be satisfied as written; edit or replace the Goal with an objective the evidence allows before resuming it.";function Dt(e){return e.trim()?[...e].length>8e3?"Goal proposal reason exceeds 8000 characters":new TextEncoder().encode(e).byteLength>16e3?"Goal proposal reason exceeds 16000 UTF-8 bytes":null:"Goal proposal reason must not be empty"}var Bt=500;var kr="Interrupted by the user. Run /goal resume to continue.",_r="Paused with /goal pause.",Ir="The session token limit was exceeded before the model request. Start a new session or increase sessionTokenLimit in settings.json before resuming the Goal.",Pr="The headless run finished before the Goal did. Resume the Goal in a later run.",Ht="The conversation was rewound past where this Goal was set. Resume the Goal to work on it from here.",Kt="Three Goal turns in a row recorded nothing to judge and no proposal. Resume the Goal to try again, or edit its objective into one the model can act on and then resume it.";function Be(e){let t=[...e];return t.length<=Bt?e:`${t.slice(0,Bt-1).join("")}\u2026`}function Kn(e){let t=e.trim();return Be(t?`The Goal turn could not finish: ${t}. Run /goal resume to continue.`:"The Goal turn could not finish. Run /goal resume to continue.")}function xr(e){return{reason:Kn(e),failed:!0}}function $t(e){let t=e.trim();return Be(t?`The Goal verifier could not judge the turn: ${t}. Run /goal resume to continue.`:"The Goal verifier could not judge the turn. Run /goal resume to continue.")}function qt(e){return Be(`Two turns in a row ended with the same conditions unmet (${e.join(", ")}). Resume the Goal to try again, or edit its objective first.`)}function Cr(e){let t=e.trim();return Be(t?`The headless run stopped at its ${t} budget. Resume the Goal in a later run.`:"The headless run stopped at a budget. Resume the Goal in a later run.")}y();var Ar=e=>{let t=e/1073741824;return e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${t.toFixed(2)} GB`},$n={"<":"\\u003c",">":"\\u003e","&":"\\u0026"},Wt=e=>e.replace(/[<>&]/g,t=>$n[t]);y();import{randomUUID as P}from"node:crypto";y();y();var qn=new Set(["execution_denied","tool_not_registered","invalid_tool_params"]);function Xe(e){return e?.status==="error"&&e.errorType!==void 0&&qn.has(e.errorType)}function Je(e,t,o){let{goalContext:i}=e;if(!i)return;let a=wt(e.name).toLowerCase();return a===Y.GET_GOAL||a===Y.UPDATE_GOAL||a===Y.TOOL_SEARCH&&Xn(t)?{goalContext:{...i},provenance:"goal_runtime"}:(a===Y.AGENT||a===Y.WORKFLOW)&&!Xe(o)?{goalContext:{...i},provenance:"execution_output"}:{goalContext:{...i}}}function Wn(e){let t=(e??[]).flatMap(o=>{let i=o.functionResponse?.response?.output;return typeof i=="string"?[i]:[]});return t.length>0?t.join(`
|
|
6
6
|
`):void 0}function Xn(e){let o=Wn(e)?.match(/^<functions>\n([\s\S]+)\n<\/functions>$/)?.[1];if(!o)return!1;let i=new Set([Y.GET_GOAL,Y.UPDATE_GOAL]);return o.split(`
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{b as f}from"./chunk-GZPNIYVZ.js";f();function l(r,e,n){if(e===""||!r.includes(e))return r;if(!n.includes("$"))return r.replaceAll(e,n);let t=n.replaceAll("$","$$$$");return r.replaceAll(e,t)}function u(r,e=512){if(!r)return!1;let n=r.length>e?r.subarray(0,e):r;for(let t of n)if(t===0)return!0;return!1}function p(r){let e=r.replace(/^\uFEFF/,"");return e=e.replace(/\r\n/g,`
|
|
4
|
+
`).replace(/\r/g,`
|
|
5
|
+
`),e}function a(r,e,n=r.length){let t=e<0?Math.max(r.length+e,0):Math.min(e,r.length),o=n<0?Math.max(r.length+n,0):Math.min(n,r.length);return c(r,t)&&(t+=1),c(r,o)&&(o-=1),r.slice(t,o)}var s=new RegExp("\\p{Cs}","gu");function i(r){return typeof r=="string"?r.replace(s,"\uFFFD"):Array.isArray(r)?r.map(e=>i(e)):r!==null&&typeof r=="object"&&Object.getPrototypeOf(r)===Object.prototype?Object.fromEntries(Object.entries(r).map(([e,n])=>[i(e),i(n)])):r}function c(r,e){let n=r.charCodeAt(e-1),t=r.charCodeAt(e);return n>=55296&&n<=56319&&t>=56320&&t<=57343}export{l as a,u as b,p as c,a as d,i as e};
|
|
6
|
+
/**
|
|
7
|
+
* @license
|
|
8
|
+
* Copyright 2025 Google LLC
|
|
9
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
10
|
+
*/
|