@maincode-ai/matilda-code 0.22.0 → 0.22.1-nightly.20261103.3b689f684
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-73Z76V73.js +3 -0
- package/chunks/agent-headless-IAWU4ADB.js +3 -0
- package/chunks/{askUserQuestion-RZYBOPLR.js → askUserQuestion-A46IDHKS.js} +1 -1
- package/chunks/{chunk-ARAB5QTM.js → chunk-2MG7GIHQ.js} +62 -62
- package/chunks/{chunk-453BANK3.js → chunk-5JCW6FH6.js} +1 -1
- package/chunks/{chunk-4UGPARBR.js → chunk-5N2436VD.js} +1 -1
- package/chunks/{chunk-LM6OIN4B.js → chunk-6RK6IJY5.js} +1 -1
- package/chunks/{chunk-J3ZCE3TA.js → chunk-7AEOFDY3.js} +1 -1
- package/chunks/{chunk-NBLBE7PE.js → chunk-ACOVNDTS.js} +453 -460
- package/chunks/{chunk-7E2YCGHS.js → chunk-AEYNMLMW.js} +12 -12
- package/chunks/{chunk-5ETLURI6.js → chunk-DEN6RR3B.js} +1 -1
- package/chunks/{chunk-2XSB5XHX.js → chunk-FI2FSW7J.js} +1 -1
- package/chunks/chunk-FJW6RBIX.js +13 -0
- package/chunks/{chunk-MGRXOZAG.js → chunk-HRCRNKY2.js} +1 -1
- package/chunks/{chunk-ILHNCXBC.js → chunk-IV6PS6DB.js} +1 -1
- package/chunks/{chunk-POGNX7U3.js → chunk-KYNP66YS.js} +1 -1
- package/chunks/{chunk-RPXRN7E6.js → chunk-LONWTJOE.js} +1 -1
- package/chunks/chunk-NJOADJ2N.js +120 -0
- package/chunks/{chunk-G3F3ZCH2.js → chunk-RH3AEZWO.js} +1 -1
- package/chunks/{chunk-7B65UIHB.js → chunk-SMTY6M3W.js} +1 -1
- package/chunks/{chunk-IHWAOFCQ.js → chunk-TDFF4ZGY.js} +1 -1
- package/chunks/chunk-TKEFJ3O3.js +9 -0
- package/chunks/{chunk-V4VILMIK.js → chunk-UICLGQTV.js} +1 -1
- package/chunks/{chunk-PQZ6HKKW.js → chunk-UP7B3YAK.js} +1 -1
- package/chunks/{chunk-6NXVLJ3X.js → chunk-WEQGQM4U.js} +1 -1
- package/chunks/chunk-XPVKH5TC.js +10 -0
- package/chunks/{chunk-LMZBADPW.js → chunk-ZABAV4XA.js} +1 -1
- package/chunks/{computer-use-PBCWDTJR.js → computer-use-GIRJZZ76.js} +1 -1
- package/chunks/{cron-create-PHQ43NYA.js → cron-create-JINCFLKY.js} +1 -1
- package/chunks/{cron-delete-7RCQIU2U.js → cron-delete-RF6JLUAV.js} +1 -1
- package/chunks/{cron-list-KKNLLMNN.js → cron-list-VXLBAXZ3.js} +1 -1
- package/chunks/{edit-ELHNQB5E.js → edit-UQLWVIRC.js} +3 -3
- package/chunks/{enter-worktree-UZIBOBV3.js → enter-worktree-DYAZE6I7.js} +1 -1
- package/chunks/{enterPlanMode-UHY3DZXE.js → enterPlanMode-QW6R7CQO.js} +1 -1
- package/chunks/{exit-worktree-HLG4PDMX.js → exit-worktree-6FZERYQO.js} +1 -1
- package/chunks/{exitPlanMode-V4HYNH3J.js → exitPlanMode-5UQLPHDN.js} +1 -1
- package/chunks/{glob-C5CTWXLP.js → glob-ZIKZWFWC.js} +1 -1
- package/chunks/{goal-tools-BGIWEJ3K.js → goal-tools-PZP7UM37.js} +1 -1
- package/chunks/{grep-BEFTGKHW.js → grep-4GHOQEYK.js} +1 -1
- package/chunks/{keychain-token-storage-FEJZYJBB.js → keychain-token-storage-UTWIIKCK.js} +1 -1
- package/chunks/{ls-XH55NAD3.js → ls-3EEHZY4W.js} +1 -1
- package/chunks/{lsp-BKDCR37G.js → lsp-H4EXPHFD.js} +1 -1
- package/chunks/mcp-client-KH5MXEZC.js +3 -0
- package/chunks/monitor-HC5SO3SW.js +32 -0
- package/chunks/notebook-edit-HMRSJ72X.js +17 -0
- package/chunks/openaiContentGenerator-NN5LMPRL.js +47 -0
- package/chunks/read-file-CENARELG.js +3 -0
- package/chunks/ripGrep-OW2EOJFG.js +3 -0
- package/chunks/scheduler-BGS7IPFQ.js +8 -0
- package/chunks/{send-message-GJSEMAZB.js → send-message-5XHDGHSN.js} +1 -1
- package/chunks/shell-PLAQFZQ2.js +3 -0
- package/chunks/{skill-3RWNSUNE.js → skill-7IQGFSSZ.js} +1 -1
- package/chunks/{symbol-search-4VM6J5Y4.js → symbol-search-ZM3HFCUV.js} +1 -1
- package/chunks/{syntheticOutput-O7LEF3AM.js → syntheticOutput-OIPRFBVD.js} +1 -1
- package/chunks/{task-create-N4IRJBTF.js → task-create-QP44DKH4.js} +1 -1
- package/chunks/{task-detach-RGNQUX3H.js → task-detach-AUTU6C4G.js} +1 -1
- package/chunks/{task-list-Z7JUB4QK.js → task-list-U2WAGMM7.js} +1 -1
- package/chunks/{task-stop-L2OWK2PJ.js → task-stop-GN5WZ3IA.js} +1 -1
- package/chunks/{task-update-H5AXVXDS.js → task-update-26N2AUQT.js} +1 -1
- package/chunks/{team-create-FWTIQ2FT.js → team-create-VFSS5FGH.js} +1 -1
- package/chunks/{team-delete-D45ALROH.js → team-delete-XCKD5FBZ.js} +1 -1
- package/chunks/todoWrite-JN3ZV5O2.js +3 -0
- package/chunks/{tool-search-X6UUCSPU.js → tool-search-L7ARWLCL.js} +1 -1
- package/chunks/{web-fetch-244KUWSX.js → web-fetch-CDKF5T6F.js} +1 -1
- package/chunks/{web-search-YRZ3BZ3X.js → web-search-2EU2CLCV.js} +3 -3
- package/chunks/{workflow-EP4AFR24.js → workflow-6MXDNPZX.js} +2 -2
- package/chunks/write-file-AGN74CMO.js +15 -0
- package/cli.js +406 -405
- package/package.json +2 -2
- package/chunks/agent-IUINB66G.js +0 -3
- package/chunks/agent-headless-YA2RKYEZ.js +0 -3
- package/chunks/chunk-DUB7JMQV.js +0 -13
- package/chunks/chunk-RHSUTILA.js +0 -9
- package/chunks/chunk-V2VUANFI.js +0 -120
- package/chunks/mcp-client-GAQG7MCT.js +0 -3
- package/chunks/monitor-NSVUUKCM.js +0 -32
- package/chunks/notebook-edit-AXKYC64C.js +0 -17
- package/chunks/openaiContentGenerator-66YY6CIM.js +0 -47
- package/chunks/read-file-YFJMLS7V.js +0 -3
- package/chunks/ripGrep-BEHEB23R.js +0 -3
- package/chunks/scheduler-GKQOREMS.js +0 -8
- package/chunks/shell-J5Q2UEXH.js +0 -3
- package/chunks/todoWrite-LCQOQBI7.js +0 -3
- package/chunks/write-file-EXWGRN4Q.js +0 -15
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as f}from"./chunk-GT6MSEK4.js";import{b as g}from"./chunk-
|
|
3
|
+
import{a as f}from"./chunk-GT6MSEK4.js";import{b as g}from"./chunk-7AEOFDY3.js";import{G as d,O as m,Y as p}from"./chunk-AEYNMLMW.js";import{b as u}from"./chunk-GZPNIYVZ.js";u();import*as a from"node:fs/promises";import*as s from"node:path";var x=p("CRON_TASKS_FILE"),T="scheduled_tasks.json",L=`~/.matilda/tmp/<project-hash>/${T}`,E=15,w=2e3,b=3e3,P=0,h=new Map;function C(e){let t=h.get(e);return t||(t=new f,h.set(e,t)),t}function c(e){return s.join(m.getGlobalTempDir(),d(e),T)}async function k(e){let t=c(e),i;try{i=await a.readFile(t,"utf-8")}catch(o){if(o.code==="ENOENT")return[];throw o}let r;try{r=JSON.parse(i)}catch{throw new Error(`Malformed JSON in ${t} \u2014 fix or delete the file; refusing to treat it as an empty schedule.`)}if(!Array.isArray(r))throw new Error(`Expected a JSON array in ${t} \u2014 fix or delete the file; refusing to treat it as an empty schedule.`);let n=r.filter(A);return n.length!==r.length&&x.warn(`Dropped ${r.length-n.length} invalid task entr${r.length-n.length===1?"y":"ies"} from ${t}; a later write will persist without ${r.length-n.length===1?"it":"them"}.`),n}async function D(e,t){let i=c(e);await a.mkdir(s.dirname(i),{recursive:!0}),await g(i,t,{noFollow:!0})}async function _(e){let t=`${e}.lock`;await a.mkdir(s.dirname(t),{recursive:!0});let i=Date.now()+b;for(;;){if(Date.now()>i)throw new Error(`Timed out waiting for scheduled-tasks lock (${t})`);try{return await a.writeFile(t,String(process.pid),{flag:"wx"}),async()=>{await a.unlink(t).catch(()=>{})}}catch(r){if(r.code!=="EEXIST")throw r}try{let r=await a.stat(t);if(Date.now()-r.mtimeMs>w){let n=`${t}.stale.${process.pid}.${P++}`;try{await a.rename(t,n)}catch{continue}let o=await a.stat(n).catch(()=>null);o&&Date.now()-o.mtimeMs<=w&&await a.link(n,t).catch(()=>{}),await a.unlink(n).catch(()=>{});continue}}catch{continue}await new Promise(r=>setTimeout(r,E))}}async function y(e,t){let i=c(e);return C(i).runExclusive(async()=>{let r=await _(i);try{let n=await k(e),o=t(n);o!==n&&await D(e,o)}finally{await r()}})}async function F(e,t){await y(e,i=>[...i,t])}async function J(e,t){let i=new Set(t);if(!(await k(e)).some(o=>i.has(o.id)))return 0;let n=0;return await y(e,o=>{let l=o.filter(S=>!i.has(S.id));return n=o.length-l.length,n===0?o:l}),n}function A(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.id=="string"&&typeof t.cron=="string"&&typeof t.prompt=="string"&&typeof t.recurring=="boolean"&&typeof t.createdAt=="number"&&(t.lastFiredAt===null||typeof t.lastFiredAt=="number")}export{L as a,c as b,k as c,y as d,F as e,J as f};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{d as f}from"./chunk-
|
|
3
|
+
import{d as f}from"./chunk-HRCRNKY2.js";import{d as u}from"./chunk-QXSBPCBA.js";import{f as m,g as c,m as l,n as p}from"./chunk-KYNP66YS.js";import{b as n}from"./chunk-GZPNIYVZ.js";n();var o=2e3;function T(e){return e.length<=o?e:`${e.slice(0,o)}
|
|
4
4
|
\u2026 (${e.length-o} more characters)`}var s=class extends m{constructor(t,r){super(r);this.config=t}getDescription(){return`Create task: ${this.params.subject}`}async getDefaultPermission(){return"ask"}getConfirmationDetails(t){let r={type:"info",title:"Confirm TaskCreate",prompt:`Create task: ${this.params.subject}
|
|
5
5
|
|
|
6
6
|
`+T(this.params.description),onConfirm:async()=>{}};return Promise.resolve(r)}async execute(){let t=u(this.config.getTeamContext()?.teamName);if(!t){let a="No active team. Create a team first.";return{llmContent:a,returnDisplay:a,error:{message:a}}}let r=await f(t,{subject:this.params.subject,description:this.params.description,activeForm:this.params.activeForm,metadata:this.params.metadata}),i=`Task #${r.id} created: "${r.subject}"`;return{llmContent:i,returnDisplay:i}}},d=class e extends c{constructor(t){super(e.Name,p.TASK_CREATE,"Create a new task in the team task list. Tasks are automatically assigned to idle teammates.","other",{type:"object",properties:{subject:{type:"string",description:"Short title for the task.",maxLength:200},description:{type:"string",description:"Detailed description of the task.",maxLength:1e4},activeForm:{type:"string",maxLength:200,description:'Present tense label for UI (e.g., "Running tests").'},metadata:{type:"object",description:"Optional arbitrary metadata."}},required:["subject","description"],additionalProperties:!1});this.config=t}static Name=l.TASK_CREATE;createInvocation(t){return new s(this.config,t)}toAutoClassifierInput(t){return{subject:t.subject,description:t.description}}};export{T as a,d as b};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{b as r}from"./chunk-GZPNIYVZ.js";r();r();var x="MATILDA_API_KEY";var d="matilda-code-1.0",l="Matilda",O="https://matilda.maincode.com/api/v1/code",w={id:"matilda",label:"Matilda",description:"Connect to the Matilda Core code API endpoint",protocol:"openai",baseUrl:O,envKey:x,models:[{id:d,displayName:l,contextWindowSize:1048576,description:"Matilda Code model",generationConfig:{openAIRequestProfile:"matilda-code",timeout:6e5,samplingParams:{max_tokens:65536,chat_template_kwargs:{enable_thinking:!0}},schemaCompliance:"openapi_30",splitToolMedia:!0,customHeaders:{"User-Agent":"MatildaCode/0.1"}}}],documentationUrl:"https://matilda.maincode.help/welcome/external-api"};var b=d,v="text-embedding-v4";r();import{AsyncLocalStorage as D}from"node:async_hooks";import{randomUUID as f}from"node:crypto";r();import{AsyncLocalStorage as P}from"node:async_hooks";var m=new P;var A="x-matilda-reported-operation-id",E="x-matilda-reported-attempt-purpose",y=[A,E],I=new Set(y),C=["answer","tool_followup","continuation","retry","compaction","unknown"],M=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,L=new Set(C),c=new D,_=new WeakSet;function T(){return f()}function a(t,e){let o=Object.freeze({operationId:t,attemptPurpose:e});return _.add(o),o}function q(t){return I.has(t.toLowerCase())}function s(){let t=c.getStore();return t&&_.has(t)?t:void 0}var R=class{activeOperationId;begin(e){return this.activeOperationId=T(),a(this.activeOperationId,e)}continue(e){let o=s()?.operationId??this.activeOperationId??T();return this.activeOperationId=o,a(o,e)}};function p(t,e){return c.run(t,e)}function z(t){c.enterWith(t)}function B(t,e){let o=s();return o?p(a(o.operationId,t),e):e()}function h(t,e){let o={next:(...n)=>p(t,()=>e.next(...n)),return:n=>p(t,()=>e.return(n)),throw:n=>p(t,()=>e.throw(n)),[Symbol.asyncIterator]:()=>o},i=Symbol.asyncDispose,u=i&&e[i];return i&&typeof u=="function"&&(o[i]=()=>p(t,()=>u.call(e))),o}function F(t,e){let o=s();return o?h(a(o.operationId,t),e):e}function V(){let t=s();if(!t||!M.test(t.operationId))return{};let e=m.getStore()?.attempt,o=e!==void 0&&e>1?"retry":t.attemptPurpose;return L.has(o)?{[A]:t.operationId,[E]:o}:{}}export{m as a,A as b,E as c,y as d,q as e,s as f,R as g,p as h,z as i,B as j,h as k,F as l,V as m,x as n,d as o,l as p,O as q,w as r,b as s,v as t};
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Matilda Team
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2025 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{d as T}from"./chunk-
|
|
3
|
+
import{d as T}from"./chunk-UICLGQTV.js";import{b as W}from"./chunk-7ZODGQO6.js";import{a as P}from"./chunk-GT6MSEK4.js";import{b as g}from"./chunk-7AEOFDY3.js";import{Y as _,c as l}from"./chunk-AEYNMLMW.js";import{b as x}from"./chunk-GZPNIYVZ.js";import{f as U}from"./chunk-OWGSC52X.js";x();var F=U(W(),1);import*as d from"node:fs/promises";import{constants as B}from"node:fs";import*as b from"node:path";var f=_("AGENTS_TEAM_TASKS"),$=32768,v=16;function M(r){if(!r)return;let e=Buffer.byteLength(JSON.stringify(r),"utf-8");if(e>$)throw new Error(`Task metadata is too large (${e} bytes; max ${$}). Trim the payload or store the bulk content elsewhere.`)}var X={retries:{retries:30,minTimeout:5,maxTimeout:100,factor:2,randomize:!0},stale:5e3,onCompromised:r=>{f.warn("task lock compromised:",r?.message??r)}},A=new Map;function K(r){let e=A.get(r);return e||(e=new P,A.set(r,e)),e}async function h(r,e,t){return K(r).runExclusive(async()=>{let i;try{i=await F.default.lock(r,X)}catch(o){if(l(o)&&o.code==="ENOENT")return t();throw o}try{return await e()}finally{await i()}})}var q="__reciprocal__",j=new Map;function z(r){let e=j.get(r);return e||(e=new P,j.set(r,e)),e}function Y(r){if(!/^[1-9]\d*$/.test(r))throw new Error(`Invalid task ID "${r}". Task IDs must be positive integers.`)}function m(r,e){return Y(e),b.join(T(r),`${e}.json`)}var O=new Set;function ae(r){return O.add(r),()=>{O.delete(r)}}function k(r){for(let e of O)try{e(r)}catch(t){f.warn(`task update listener failed: ${t}`)}}async function ie(r,e){M(e.metadata);let t=T(r);await d.mkdir(t,{recursive:!0});let i=15;for(let o=0;o<i;o++){let c=await Z(t),s={id:c,subject:e.subject,description:e.description,activeForm:e.activeForm,owner:e.owner,status:"pending",blocks:[],blockedBy:[],metadata:e.metadata},n=b.join(t,`${c}.json`);try{await(await d.open(n,B.O_WRONLY|B.O_CREAT|B.O_EXCL)).close()}catch(a){if(l(a)&&a.code==="EEXIST")continue;throw a}try{await g(n,s)}catch(a){throw await d.unlink(n).catch(()=>{}),a}return k(r),s}throw new Error(`Failed to create task after ${i} attempts (ID contention).`)}async function oe(r,e){let t=m(r,e);try{let i=await d.readFile(t,"utf-8");return JSON.parse(i)}catch(i){if(l(i)&&i.code==="ENOENT")return;throw i}}var p=class extends Error{constructor(t,i,o){super(`Task #${t} is owned by "${o}". Only the leader or the owner can change status / owner / subject / description / blocks.`);this.taskId=t;this.callerName=i;this.actualOwner=o;this.name="TaskOwnershipError"}};async function ce(r,e,t,i){let o=m(r,e);return h(o,async()=>{let c;try{c=await d.readFile(o,"utf-8")}catch(n){if(l(n)&&n.code==="ENOENT")return;throw n}let s=JSON.parse(c);if(i?.callerName!==void 0&&i.callerName!==q&&(t.status!==void 0||t.owner!==void 0||t.subject!==void 0||t.description!==void 0||(t.addBlocks?.length??0)>0||(t.addBlockedBy?.length??0)>0)&&s.owner&&s.owner!==i.callerName)throw new p(e,i.callerName,s.owner);if(t.addBlocks?.length){let n=new Set(s.blocks);for(let a of t.addBlocks)n.add(a);s.blocks=Array.from(n)}if(t.addBlockedBy?.length){let n=new Set(s.blockedBy);for(let a of t.addBlockedBy)n.add(a);s.blockedBy=Array.from(n)}if(t.status!==void 0&&(s.status=t.status,t.status==="completed"&&s.blocks.length>0&&await Q(r,e,s.blocks)),t.owner!==void 0&&(s.owner=t.owner?t.owner:void 0),t.subject!==void 0&&(s.subject=t.subject),t.description!==void 0&&(s.description=t.description),t.activeForm!==void 0&&(s.activeForm=t.activeForm??void 0),t.metadata!==void 0){s.metadata=s.metadata??{};for(let[n,a]of Object.entries(t.metadata))n==="__proto__"||n==="constructor"||n==="prototype"||(a===null?delete s.metadata[n]:s.metadata[n]=a);Object.keys(s.metadata).length===0&&(s.metadata=void 0),M(s.metadata)}return await g(o,s),k(r),s},()=>{})}async function de(r,e,t){let i=m(r,e),o=await h(i,async()=>{let s;try{let a=await d.readFile(i,"utf-8");s=JSON.parse(a)}catch(a){if(l(a)&&a.code==="ENOENT")return null;throw a}if(t?.callerName!==void 0&&s.owner&&s.owner!==t.callerName)throw new p(e,t.callerName,s.owner);let n=new Set([...s.blocks,...s.blockedBy]);n.delete(e);try{await d.unlink(i)}catch(a){if(l(a)&&a.code==="ENOENT")return null;throw a}return n},()=>null);if(o===null)return!1;let c=await Promise.allSettled(Array.from(o).map(s=>G(r,s,e)));for(let s of c)s.status==="rejected"&&f.warn(`deleteTask(${e}): edge cleanup failed: ${s.reason}`);return k(r),!0}async function G(r,e,t){let i=m(r,e);await h(i,async()=>{try{let o=await d.readFile(i,"utf-8"),c=JSON.parse(o),s=c.blocks.length,n=c.blockedBy.length;if(c.blocks=c.blocks.filter(a=>a!==t),c.blockedBy=c.blockedBy.filter(a=>a!==t),c.blocks.length===s&&c.blockedBy.length===n)return;await g(i,c)}catch(o){if(l(o)&&o.code==="ENOENT")return;throw o}},()=>{})}async function R(r,e){let t=T(r),i;try{i=await d.readdir(t)}catch(n){if(l(n)&&n.code==="ENOENT")return[];let a=n instanceof Error?n.message:String(n);throw f.warn(`Failed to list tasks dir ${t}: ${a}`),n instanceof Error?n:new Error(a)}let o=i.filter(n=>n.endsWith(".json")),c=[];for(let n=0;n<o.length;n+=v){let a=o.slice(n,n+v),w=await Promise.all(a.map(async C=>{let y=b.join(t,C),S;try{S=await d.readFile(y,"utf-8")}catch(u){if(l(u)&&u.code==="ENOENT")return;let E=u instanceof Error?u.message:String(u);f.warn(`Failed to read task file ${y}: ${E}`);return}if(S.trim()!=="")try{return JSON.parse(S)}catch(u){let E=u instanceof Error?u.message:String(u);f.warn(`Quarantining corrupt task file ${y}: ${E}`);let D=`${y}.corrupt-${Date.now()}`;try{await d.rename(y,D)}catch(N){let J=N instanceof Error?N.message:String(N);f.warn(`Failed to quarantine ${y}: ${J}`)}return}}));c.push(...w)}let s=c.filter(n=>n!==void 0);return s.sort((n,a)=>Number(n.id)-Number(a.id)),e?s.filter(n=>!(e.status!==void 0&&n.status!==e.status||e.owner!==void 0&&n.owner!==e.owner||e.blockedBy!==void 0&&!n.blockedBy.includes(e.blockedBy))):s}async function le(r){let e=T(r);await d.rm(e,{recursive:!0,force:!0}),k(r)}async function Q(r,e,t){let i=await Promise.allSettled(t.map(async o=>{let c=m(r,o);await h(c,async()=>{let s;try{s=await d.readFile(c,"utf-8")}catch(w){if(l(w)&&w.code==="ENOENT")return;throw w}let n=JSON.parse(s),a=n.blockedBy.length;n.blockedBy=n.blockedBy.filter(w=>w!==e),n.blockedBy.length!==a&&await g(c,n)},()=>{})}));for(let o of i)o.status==="rejected"&&f.warn(`unblockDependents(${e}): ${o.reason}`);k(r)}async function ue(r,e,t,i){return i?.checkAgentBusy?z(t).runExclusive(()=>L(r,e,t,i,!0)):L(r,e,t,i,!1)}async function L(r,e,t,i,o){if(o&&await V(r,t))return;let c=m(r,e);return h(c,async()=>{let s;try{s=await d.readFile(c,"utf-8")}catch(a){if(l(a)&&a.code==="ENOENT")return;throw a}let n=JSON.parse(s);if(n.status==="pending"&&!n.owner)return n.owner=i?.ownerName??t,n.status="in_progress",await g(c,n),k(r),n},()=>{})}async function V(r,e){let t=await R(r,{status:"in_progress"}),i=e.split("@")[0];return t.some(o=>o.owner===e||o.owner===i)}async function H(r,e,t){let i=m(r,e);return h(i,async()=>{let o;try{o=await d.readFile(i,"utf-8")}catch(s){if(l(s)&&s.code==="ENOENT")return!1;throw s}let c=JSON.parse(o);return c.status!=="in_progress"||c.owner!==t?!1:(c.owner=void 0,c.status="pending",await g(i,c),!0)},()=>!1)}async function fe(r,e){let t=e.split("@")[0],o=(await R(r,{status:"in_progress"})).filter(a=>a.owner===e||a.owner===t),c=await Promise.allSettled(o.map(a=>H(r,a.id,a.owner))),s=c.filter(a=>a.status==="rejected");s.length>0&&f.warn(`unassignTeammateTasks: ${s.length}/${o.length} task(s) failed to unassign for ${e}`);let n=c.filter(a=>a.status==="fulfilled"&&a.value===!0).length;return n>0&&k(r),n}async function Z(r){let e;try{e=await d.readdir(r)}catch{return"1"}let t=0;for(let i of e){if(!i.endsWith(".json"))continue;let o=parseInt(i.replace(".json",""),10);!isNaN(o)&&o>t&&(t=o)}return String(t+1)}export{q as a,Y as b,ae as c,ie as d,oe as e,p as f,ce as g,de as h,R as i,le as j,ue as k,fe as l};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Matilda
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{H as h,K as g,O as l,z as m}from"./chunk-AEYNMLMW.js";import{b as p}from"./chunk-GZPNIYVZ.js";p();import*as s from"node:fs";import*as t from"node:path";var M="memory",f="MEMORY.md",d="meta.json",x="extract-cursor.json",R="consolidation.lock",O="memories";function T(r){let o=t.resolve(r);for(;;){let e=t.join(o,".git");if(s.existsSync(e))return o;let n=t.dirname(o);if(n===o)return null;o=n}}function D(r){let o=T(r);if(!o)return null;try{let e=s.readFileSync(t.join(o,".git"),"utf-8").trim();if(!e.startsWith("gitdir:"))return o;let n=t.resolve(o,e.slice(7).trim()),i=t.resolve(n,s.readFileSync(t.join(n,"commondir"),"utf-8").trim());return t.resolve(t.dirname(n))!==t.join(i,"worktrees")||s.realpathSync(s.readFileSync(t.join(n,"gitdir"),"utf-8").trim())!==t.join(s.realpathSync(o),".git")?o:t.basename(i)!==".git"?i.normalize("NFC"):t.dirname(i).normalize("NFC")}catch{return o}}function y(){return process.env.MATILDA_CODE_MEMORY_BASE_DIR?g(void 0,process.env.MATILDA_CODE_MEMORY_BASE_DIR):l.getRuntimeBaseDir()}var A=new Map;function u(r){let o=process.env.MATILDA_CODE_MEMORY_LOCAL==="1",e=o?"":y(),n=`${o?"local":e}\0${r}`,i=A.get(n);if(i!==void 0)return i;let a;if(o)a=t.join(r,m,M);else{let E=D(r)??t.resolve(r);a=t.join(e,"projects",h(E),M)}return A.set(n,a),a}function c(r){return t.dirname(u(r))}function j(r,o){let e=t.normalize(r),n=t.normalize(u(o)),i=t.relative(n,e);return i===""||!i.startsWith("..")&&!t.isAbsolute(i)}function L(r){return t.join(u(r),f)}function S(r){return t.join(c(r),d)}function v(r){return t.join(c(r),x)}function U(r){return t.join(c(r),R)}function _(){return t.join(y(),O)}function F(){return t.join(_(),f)}function I(r){let o=t.normalize(r),e=t.normalize(_()),n=t.relative(e,o);return n===""||!n.startsWith("..")&&!t.isAbsolute(n)}function N(r,o){return j(r,o)||I(r)}export{f as a,y as b,u as c,c as d,j as e,L as f,S as g,v as h,U as i,_ as j,F as k,N as l};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Google LLC
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{V as iu}from"./chunk-7E2YCGHS.js";import{b as f}from"./chunk-GZPNIYVZ.js";import{d as g,f as so}from"./chunk-OWGSC52X.js";var qr=g(L=>{"use strict";f();Object.defineProperty(L,"__esModule",{value:!0});L.regexpCode=L.getEsmExportName=L.getProperty=L.safeStringify=L.stringify=L.strConcat=L.addCodeArg=L.str=L._=L.nil=L._Code=L.Name=L.IDENTIFIER=L._CodeOrName=void 0;var Ir=class{};L._CodeOrName=Ir;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Nt=class extends Ir{constructor(e){if(super(),!L.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};L.Name=Nt;var ke=class extends Ir{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Nt&&(r[n.str]=(r[n.str]||0)+1),r),{})}};L._Code=ke;L.nil=new ke("");function cu(t,...e){let r=[t[0]],n=0;for(;n<e.length;)ao(r,e[n]),r.push(t[++n]);return new ke(r)}L._=cu;var oo=new ke("+");function uu(t,...e){let r=[Cr(t[0])],n=0;for(;n<e.length;)r.push(oo),ao(r,e[n]),r.push(oo,Cr(t[++n]));return Bm(r),new ke(r)}L.str=uu;function ao(t,e){e instanceof ke?t.push(...e._items):e instanceof Nt?t.push(e):t.push(Qm(e))}L.addCodeArg=ao;function Bm(t){let e=1;for(;e<t.length-1;){if(t[e]===oo){let r=Xm(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Xm(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Nt||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Nt))return`"${t}${e.slice(1)}`}function Ym(t,e){return e.emptyStr()?t:t.emptyStr()?e:uu`${t}${e}`}L.strConcat=Ym;function Qm(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Cr(Array.isArray(t)?t.join(","):t)}function Zm(t){return new ke(Cr(t))}L.stringify=Zm;function Cr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Cr;function eh(t){return typeof t=="string"&&L.IDENTIFIER.test(t)?new ke(`.${t}`):cu`[${t}]`}L.getProperty=eh;function th(t){if(typeof t=="string"&&L.IDENTIFIER.test(t))return new ke(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}L.getEsmExportName=th;function rh(t){return new ke(t.toString())}L.regexpCode=rh});var uo=g(ge=>{"use strict";f();Object.defineProperty(ge,"__esModule",{value:!0});ge.ValueScope=ge.ValueScopeName=ge.Scope=ge.varKinds=ge.UsedValueState=void 0;var _e=qr(),io=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},xn;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(xn||(ge.UsedValueState=xn={}));ge.varKinds={const:new _e.Name("const"),let:new _e.Name("let"),var:new _e.Name("var")};var zn=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof _e.Name?e:this.name(e)}name(e){return new _e.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ge.Scope=zn;var Ln=class extends _e.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,_e._)`.${new _e.Name(r)}[${n}]`}};ge.ValueScopeName=Ln;var nh=(0,_e._)`\n`,co=class extends zn{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?nh:_e.nil}}get(){return this._scope}name(e){return new Ln(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,a=(n=r.key)!==null&&n!==void 0?n:r.ref,i=this._values[o];if(i){let u=i.get(a);if(u)return u}else i=this._values[o]=new Map;i.set(a,s);let c=this._scope[o]||(this._scope[o]=[]),d=c.length;return c[d]=r.ref,s.setValue(r,{property:o,itemIndex:d}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,_e._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let o=_e.nil;for(let a in e){let i=e[a];if(!i)continue;let c=n[a]=n[a]||new Map;i.forEach(d=>{if(c.has(d))return;c.set(d,xn.Started);let u=r(d);if(u){let l=this.opts.es5?ge.varKinds.var:ge.varKinds.const;o=(0,_e._)`${o}${l} ${d} = ${u};${this.opts._n}`}else if(u=s?.(d))o=(0,_e._)`${o}${u}${this.opts._n}`;else throw new io(d);c.set(d,xn.Completed)})}return o}};ge.ValueScope=co});var R=g(A=>{"use strict";f();Object.defineProperty(A,"__esModule",{value:!0});A.or=A.and=A.not=A.CodeGen=A.operators=A.varKinds=A.ValueScopeName=A.ValueScope=A.Scope=A.Name=A.regexpCode=A.stringify=A.getProperty=A.nil=A.strConcat=A.str=A._=void 0;var M=qr(),Ve=uo(),dt=qr();Object.defineProperty(A,"_",{enumerable:!0,get:function(){return dt._}});Object.defineProperty(A,"str",{enumerable:!0,get:function(){return dt.str}});Object.defineProperty(A,"strConcat",{enumerable:!0,get:function(){return dt.strConcat}});Object.defineProperty(A,"nil",{enumerable:!0,get:function(){return dt.nil}});Object.defineProperty(A,"getProperty",{enumerable:!0,get:function(){return dt.getProperty}});Object.defineProperty(A,"stringify",{enumerable:!0,get:function(){return dt.stringify}});Object.defineProperty(A,"regexpCode",{enumerable:!0,get:function(){return dt.regexpCode}});Object.defineProperty(A,"Name",{enumerable:!0,get:function(){return dt.Name}});var Gn=uo();Object.defineProperty(A,"Scope",{enumerable:!0,get:function(){return Gn.Scope}});Object.defineProperty(A,"ValueScope",{enumerable:!0,get:function(){return Gn.ValueScope}});Object.defineProperty(A,"ValueScopeName",{enumerable:!0,get:function(){return Gn.ValueScopeName}});Object.defineProperty(A,"varKinds",{enumerable:!0,get:function(){return Gn.varKinds}});A.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var rt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},lo=class extends rt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Ve.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Qt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},Un=class extends rt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Qt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return Kn(e,this.rhs)}},fo=class extends Un{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},po=class extends rt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},mo=class extends rt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},ho=class extends rt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},yo=class extends rt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Qt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Dr=class extends rt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(e,r)||(sh(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>It(e,r.names),{})}},nt=class extends Dr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},_o=class extends Dr{},Yt=class extends nt{};Yt.kind="else";var jt=class t extends nt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Yt(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(lu(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Qt(this.condition,e,r),this}get names(){let e=super.names;return Kn(e,this.condition),this.else&&It(e,this.else.names),e}};jt.kind="if";var At=class extends nt{};At.kind="for";var go=class extends At{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Qt(this.iteration,e,r),this}get names(){return It(super.names,this.iteration.names)}},$o=class extends At{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?Ve.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return`for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=Kn(super.names,this.from);return Kn(e,this.to)}},Fn=class extends At{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Qt(this.iterable,e,r),this}get names(){return It(super.names,this.iterable.names)}},Mr=class extends nt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Mr.kind="func";var Vr=class extends Dr{render(e){return"return "+super.render(e)}};Vr.kind="return";var vo=class extends nt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&It(e,this.catch.names),this.finally&&It(e,this.finally.names),e}},xr=class extends nt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};xr.kind="catch";var zr=class extends nt{render(e){return"finally"+super.render(e)}};zr.kind="finally";var wo=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
import{Y as iu}from"./chunk-AEYNMLMW.js";import{b as f}from"./chunk-GZPNIYVZ.js";import{d as g,f as so}from"./chunk-OWGSC52X.js";var qr=g(L=>{"use strict";f();Object.defineProperty(L,"__esModule",{value:!0});L.regexpCode=L.getEsmExportName=L.getProperty=L.safeStringify=L.stringify=L.strConcat=L.addCodeArg=L.str=L._=L.nil=L._Code=L.Name=L.IDENTIFIER=L._CodeOrName=void 0;var Ir=class{};L._CodeOrName=Ir;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Nt=class extends Ir{constructor(e){if(super(),!L.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};L.Name=Nt;var ke=class extends Ir{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Nt&&(r[n.str]=(r[n.str]||0)+1),r),{})}};L._Code=ke;L.nil=new ke("");function cu(t,...e){let r=[t[0]],n=0;for(;n<e.length;)ao(r,e[n]),r.push(t[++n]);return new ke(r)}L._=cu;var oo=new ke("+");function uu(t,...e){let r=[Cr(t[0])],n=0;for(;n<e.length;)r.push(oo),ao(r,e[n]),r.push(oo,Cr(t[++n]));return Bm(r),new ke(r)}L.str=uu;function ao(t,e){e instanceof ke?t.push(...e._items):e instanceof Nt?t.push(e):t.push(Qm(e))}L.addCodeArg=ao;function Bm(t){let e=1;for(;e<t.length-1;){if(t[e]===oo){let r=Xm(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Xm(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Nt||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Nt))return`"${t}${e.slice(1)}`}function Ym(t,e){return e.emptyStr()?t:t.emptyStr()?e:uu`${t}${e}`}L.strConcat=Ym;function Qm(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Cr(Array.isArray(t)?t.join(","):t)}function Zm(t){return new ke(Cr(t))}L.stringify=Zm;function Cr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Cr;function eh(t){return typeof t=="string"&&L.IDENTIFIER.test(t)?new ke(`.${t}`):cu`[${t}]`}L.getProperty=eh;function th(t){if(typeof t=="string"&&L.IDENTIFIER.test(t))return new ke(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}L.getEsmExportName=th;function rh(t){return new ke(t.toString())}L.regexpCode=rh});var uo=g(ge=>{"use strict";f();Object.defineProperty(ge,"__esModule",{value:!0});ge.ValueScope=ge.ValueScopeName=ge.Scope=ge.varKinds=ge.UsedValueState=void 0;var _e=qr(),io=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},xn;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(xn||(ge.UsedValueState=xn={}));ge.varKinds={const:new _e.Name("const"),let:new _e.Name("let"),var:new _e.Name("var")};var zn=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof _e.Name?e:this.name(e)}name(e){return new _e.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ge.Scope=zn;var Ln=class extends _e.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,_e._)`.${new _e.Name(r)}[${n}]`}};ge.ValueScopeName=Ln;var nh=(0,_e._)`\n`,co=class extends zn{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?nh:_e.nil}}get(){return this._scope}name(e){return new Ln(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,a=(n=r.key)!==null&&n!==void 0?n:r.ref,i=this._values[o];if(i){let u=i.get(a);if(u)return u}else i=this._values[o]=new Map;i.set(a,s);let c=this._scope[o]||(this._scope[o]=[]),d=c.length;return c[d]=r.ref,s.setValue(r,{property:o,itemIndex:d}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,_e._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let o=_e.nil;for(let a in e){let i=e[a];if(!i)continue;let c=n[a]=n[a]||new Map;i.forEach(d=>{if(c.has(d))return;c.set(d,xn.Started);let u=r(d);if(u){let l=this.opts.es5?ge.varKinds.var:ge.varKinds.const;o=(0,_e._)`${o}${l} ${d} = ${u};${this.opts._n}`}else if(u=s?.(d))o=(0,_e._)`${o}${u}${this.opts._n}`;else throw new io(d);c.set(d,xn.Completed)})}return o}};ge.ValueScope=co});var R=g(A=>{"use strict";f();Object.defineProperty(A,"__esModule",{value:!0});A.or=A.and=A.not=A.CodeGen=A.operators=A.varKinds=A.ValueScopeName=A.ValueScope=A.Scope=A.Name=A.regexpCode=A.stringify=A.getProperty=A.nil=A.strConcat=A.str=A._=void 0;var M=qr(),Ve=uo(),dt=qr();Object.defineProperty(A,"_",{enumerable:!0,get:function(){return dt._}});Object.defineProperty(A,"str",{enumerable:!0,get:function(){return dt.str}});Object.defineProperty(A,"strConcat",{enumerable:!0,get:function(){return dt.strConcat}});Object.defineProperty(A,"nil",{enumerable:!0,get:function(){return dt.nil}});Object.defineProperty(A,"getProperty",{enumerable:!0,get:function(){return dt.getProperty}});Object.defineProperty(A,"stringify",{enumerable:!0,get:function(){return dt.stringify}});Object.defineProperty(A,"regexpCode",{enumerable:!0,get:function(){return dt.regexpCode}});Object.defineProperty(A,"Name",{enumerable:!0,get:function(){return dt.Name}});var Gn=uo();Object.defineProperty(A,"Scope",{enumerable:!0,get:function(){return Gn.Scope}});Object.defineProperty(A,"ValueScope",{enumerable:!0,get:function(){return Gn.ValueScope}});Object.defineProperty(A,"ValueScopeName",{enumerable:!0,get:function(){return Gn.ValueScopeName}});Object.defineProperty(A,"varKinds",{enumerable:!0,get:function(){return Gn.varKinds}});A.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var rt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},lo=class extends rt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Ve.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Qt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},Un=class extends rt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Qt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return Kn(e,this.rhs)}},fo=class extends Un{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},po=class extends rt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},mo=class extends rt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},ho=class extends rt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},yo=class extends rt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Qt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Dr=class extends rt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(e,r)||(sh(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>It(e,r.names),{})}},nt=class extends Dr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},_o=class extends Dr{},Yt=class extends nt{};Yt.kind="else";var jt=class t extends nt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Yt(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(lu(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Qt(this.condition,e,r),this}get names(){let e=super.names;return Kn(e,this.condition),this.else&&It(e,this.else.names),e}};jt.kind="if";var At=class extends nt{};At.kind="for";var go=class extends At{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Qt(this.iteration,e,r),this}get names(){return It(super.names,this.iteration.names)}},$o=class extends At{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?Ve.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return`for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=Kn(super.names,this.from);return Kn(e,this.to)}},Fn=class extends At{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Qt(this.iterable,e,r),this}get names(){return It(super.names,this.iterable.names)}},Mr=class extends nt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Mr.kind="func";var Vr=class extends Dr{render(e){return"return "+super.render(e)}};Vr.kind="return";var vo=class extends nt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&It(e,this.catch.names),this.finally&&It(e,this.finally.names),e}},xr=class extends nt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};xr.kind="catch";var zr=class extends nt{render(e){return"finally"+super.render(e)}};zr.kind="finally";var wo=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
4
|
`:""},this._extScope=e,this._scope=new Ve.Scope({parent:e}),this._nodes=[new _o]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,s){let o=this._scope.toName(r);return n!==void 0&&s&&(this._constants[o.str]=n),this._leafNode(new lo(e,o,n)),o}const(e,r,n){return this._def(Ve.varKinds.const,e,r,n)}let(e,r,n){return this._def(Ve.varKinds.let,e,r,n)}var(e,r,n){return this._def(Ve.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Un(e,r,n))}add(e,r){return this._leafNode(new fo(e,A.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new yo(e)),this}object(...e){let r=["{"];for(let[n,s]of e)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,s));return r.push("}"),new M._Code(r)}if(e,r,n){if(this._blockNode(new jt(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new jt(e))}else(){return this._elseNode(new Yt)}endIf(){return this._endBlockNode(jt,Yt)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new go(e),r)}forRange(e,r,n,s,o=this.opts.es5?Ve.varKinds.var:Ve.varKinds.let){let a=this._scope.toName(e);return this._for(new $o(o,a,r,n),()=>s(a))}forOf(e,r,n,s=Ve.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let a=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${a}.length`,i=>{this.var(o,(0,M._)`${a}[${i}]`),n(o)})}return this._for(new Fn("of",s,o,r),()=>n(o))}forIn(e,r,n,s=this.opts.es5?Ve.varKinds.var:Ve.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new Fn("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(At)}label(e){return this._leafNode(new po(e))}break(e){return this._leafNode(new mo(e))}return(e){let r=new Vr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Vr)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new vo;if(this._blockNode(s),this.code(e),r){let o=this.name("e");this._currNode=s.catch=new xr(o),r(o)}return n&&(this._currNode=s.finally=new zr,this.code(n)),this._endBlockNode(xr,zr)}throw(e){return this._leafNode(new ho(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,n,s){return this._blockNode(new Mr(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Mr)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof jt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};A.CodeGen=wo;function It(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Kn(t,e){return e instanceof M._CodeOrName?It(t,e.names):t}function Qt(t,e,r){if(t instanceof M.Name)return n(t);if(!s(t))return t;return new M._Code(t._items.reduce((o,a)=>(a instanceof M.Name&&(a=n(a)),a instanceof M._Code?o.push(...a._items):o.push(a),o),[]));function n(o){let a=r[o.str];return a===void 0||e[o.str]!==1?o:(delete e[o.str],a)}function s(o){return o instanceof M._Code&&o._items.some(a=>a instanceof M.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function sh(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function lu(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${bo(t)}`}A.not=lu;var oh=du(A.operators.AND);function ah(...t){return t.reduce(oh)}A.and=ah;var ih=du(A.operators.OR);function ch(...t){return t.reduce(ih)}A.or=ch;function du(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${bo(e)} ${t} ${bo(r)}`}function bo(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var D=g(C=>{"use strict";f();Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var H=R(),uh=qr();function lh(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=lh;function dh(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(mu(t,e),!hu(e,t.self.RULES.all))}C.alwaysValidSchema=dh;function mu(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let s=n.RULES.keywords;for(let o in e)s[o]||gu(t,`unknown keyword: "${o}"`)}C.checkUnknownRules=mu;function hu(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=hu;function fh(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=fh;function ph({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,H._)`${r}`}return(0,H._)`${t}${e}${(0,H.getProperty)(n)}`}C.schemaRefOrVal=ph;function mh(t){return yu(decodeURIComponent(t))}C.unescapeFragment=mh;function hh(t){return encodeURIComponent(So(t))}C.escapeFragment=hh;function So(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=So;function yu(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=yu;function yh(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=yh;function fu({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,o,a,i)=>{let c=a===void 0?o:a instanceof H.Name?(o instanceof H.Name?t(s,o,a):e(s,o,a),a):o instanceof H.Name?(e(s,a,o),o):r(o,a);return i===H.Name&&!(c instanceof H.Name)?n(s,c):c}}C.mergeEvaluated={props:fu({mergeNames:(t,e,r)=>t.if((0,H._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,H._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,H._)`${r} || {}`).code((0,H._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,H._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,H._)`${r} || {}`),Po(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:_u}),items:fu({mergeNames:(t,e,r)=>t.if((0,H._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,H._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,H._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,H._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function _u(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,H._)`{}`);return e!==void 0&&Po(t,r,e),r}C.evaluatedPropsToName=_u;function Po(t,e,r){Object.keys(r).forEach(n=>t.assign((0,H._)`${e}${(0,H.getProperty)(n)}`,!0))}C.setEvaluated=Po;var pu={};function _h(t,e){return t.scopeValue("func",{ref:e,code:pu[e.code]||(pu[e.code]=new uh._Code(e.code))})}C.useFunc=_h;var Eo;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Eo||(C.Type=Eo={}));function gh(t,e,r){if(t instanceof H.Name){let n=e===Eo.Num;return r?n?(0,H._)`"[" + ${t} + "]"`:(0,H._)`"['" + ${t} + "']"`:n?(0,H._)`"/" + ${t}`:(0,H._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,H.getProperty)(t).toString():"/"+So(t)}C.getErrorPath=gh;function gu(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=gu});var Re=g(To=>{"use strict";f();Object.defineProperty(To,"__esModule",{value:!0});var ie=R(),$h={data:new ie.Name("data"),valCxt:new ie.Name("valCxt"),instancePath:new ie.Name("instancePath"),parentData:new ie.Name("parentData"),parentDataProperty:new ie.Name("parentDataProperty"),rootData:new ie.Name("rootData"),dynamicAnchors:new ie.Name("dynamicAnchors"),vErrors:new ie.Name("vErrors"),errors:new ie.Name("errors"),this:new ie.Name("this"),self:new ie.Name("self"),scope:new ie.Name("scope"),json:new ie.Name("json"),jsonPos:new ie.Name("jsonPos"),jsonLen:new ie.Name("jsonLen"),jsonPart:new ie.Name("jsonPart")};To.default=$h});var Lr=g(ce=>{"use strict";f();Object.defineProperty(ce,"__esModule",{value:!0});ce.extendErrors=ce.resetErrorsCount=ce.reportExtraError=ce.reportError=ce.keyword$DataError=ce.keywordError=void 0;var x=R(),Hn=D(),pe=Re();ce.keywordError={message:({keyword:t})=>(0,x.str)`must pass "${t}" keyword validation`};ce.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,x.str)`"${t}" keyword must be ${e} ($data)`:(0,x.str)`"${t}" keyword is invalid ($data)`};function vh(t,e=ce.keywordError,r,n){let{it:s}=t,{gen:o,compositeRule:a,allErrors:i}=s,c=wu(t,e,r);n??(a||i)?$u(o,c):vu(s,(0,x._)`[${c}]`)}ce.reportError=vh;function wh(t,e=ce.keywordError,r){let{it:n}=t,{gen:s,compositeRule:o,allErrors:a}=n,i=wu(t,e,r);$u(s,i),o||a||vu(n,pe.default.vErrors)}ce.reportExtraError=wh;function bh(t,e){t.assign(pe.default.errors,e),t.if((0,x._)`${pe.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,x._)`${pe.default.vErrors}.length`,e),()=>t.assign(pe.default.vErrors,null)))}ce.resetErrorsCount=bh;function Eh({gen:t,keyword:e,schemaValue:r,data:n,errsCount:s,it:o}){if(s===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",s,pe.default.errors,i=>{t.const(a,(0,x._)`${pe.default.vErrors}[${i}]`),t.if((0,x._)`${a}.instancePath === undefined`,()=>t.assign((0,x._)`${a}.instancePath`,(0,x.strConcat)(pe.default.instancePath,o.errorPath))),t.assign((0,x._)`${a}.schemaPath`,(0,x.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,x._)`${a}.schema`,r),t.assign((0,x._)`${a}.data`,n))})}ce.extendErrors=Eh;function $u(t,e){let r=t.const("err",e);t.if((0,x._)`${pe.default.vErrors} === null`,()=>t.assign(pe.default.vErrors,(0,x._)`[${r}]`),(0,x._)`${pe.default.vErrors}.push(${r})`),t.code((0,x._)`${pe.default.errors}++`)}function vu(t,e){let{gen:r,validateName:n,schemaEnv:s}=t;s.$async?r.throw((0,x._)`new ${t.ValidationError}(${e})`):(r.assign((0,x._)`${n}.errors`,e),r.return(!1))}var Ct={keyword:new x.Name("keyword"),schemaPath:new x.Name("schemaPath"),params:new x.Name("params"),propertyName:new x.Name("propertyName"),message:new x.Name("message"),schema:new x.Name("schema"),parentSchema:new x.Name("parentSchema")};function wu(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,x._)`{}`:Sh(t,e,r)}function Sh(t,e,r={}){let{gen:n,it:s}=t,o=[Ph(s,r),Th(t,r)];return kh(t,e,o),n.object(...o)}function Ph({errorPath:t},{instancePath:e}){let r=e?(0,x.str)`${t}${(0,Hn.getErrorPath)(e,Hn.Type.Str)}`:t;return[pe.default.instancePath,(0,x.strConcat)(pe.default.instancePath,r)]}function Th({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let s=n?e:(0,x.str)`${e}/${t}`;return r&&(s=(0,x.str)`${s}${(0,Hn.getErrorPath)(r,Hn.Type.Str)}`),[Ct.schemaPath,s]}function kh(t,{params:e,message:r},n){let{keyword:s,data:o,schemaValue:a,it:i}=t,{opts:c,propertyName:d,topSchemaRef:u,schemaPath:l}=i;n.push([Ct.keyword,s],[Ct.params,typeof e=="function"?e(t):e||(0,x._)`{}`]),c.messages&&n.push([Ct.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Ct.schema,a],[Ct.parentSchema,(0,x._)`${u}${l}`],[pe.default.data,o]),d&&n.push([Ct.propertyName,d])}});var Eu=g(Zt=>{"use strict";f();Object.defineProperty(Zt,"__esModule",{value:!0});Zt.boolOrEmptySchema=Zt.topBoolOrEmptySchema=void 0;var Rh=Lr(),Oh=R(),Nh=Re(),jh={message:"boolean schema is false"};function Ah(t){let{gen:e,schema:r,validateName:n}=t;r===!1?bu(t,!1):typeof r=="object"&&r.$async===!0?e.return(Nh.default.data):(e.assign((0,Oh._)`${n}.errors`,null),e.return(!0))}Zt.topBoolOrEmptySchema=Ah;function Ih(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),bu(t)):r.var(e,!0)}Zt.boolOrEmptySchema=Ih;function bu(t,e){let{gen:r,data:n}=t,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Rh.reportError)(s,jh,void 0,e)}});var ko=g(er=>{"use strict";f();Object.defineProperty(er,"__esModule",{value:!0});er.getRules=er.isJSONType=void 0;var Ch=["string","number","integer","boolean","null","object","array"],qh=new Set(Ch);function Dh(t){return typeof t=="string"&&qh.has(t)}er.isJSONType=Dh;function Mh(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}er.getRules=Mh});var Ro=g(ft=>{"use strict";f();Object.defineProperty(ft,"__esModule",{value:!0});ft.shouldUseRule=ft.shouldUseGroup=ft.schemaHasRulesForType=void 0;function Vh({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Su(t,n)}ft.schemaHasRulesForType=Vh;function Su(t,e){return e.rules.some(r=>Pu(t,r))}ft.shouldUseGroup=Su;function Pu(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ft.shouldUseRule=Pu});var Ur=g(ue=>{"use strict";f();Object.defineProperty(ue,"__esModule",{value:!0});ue.reportTypeError=ue.checkDataTypes=ue.checkDataType=ue.coerceAndCheckDataType=ue.getJSONTypes=ue.getSchemaTypes=ue.DataType=void 0;var xh=ko(),zh=Ro(),Lh=Lr(),O=R(),Tu=D(),tr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(tr||(ue.DataType=tr={}));function Uh(t){let e=ku(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}ue.getSchemaTypes=Uh;function ku(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(xh.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}ue.getJSONTypes=ku;function Fh(t,e){let{gen:r,data:n,opts:s}=t,o=Kh(e,s.coerceTypes),a=e.length>0&&!(o.length===0&&e.length===1&&(0,zh.schemaHasRulesForType)(t,e[0]));if(a){let i=No(e,n,s.strictNumbers,tr.Wrong);r.if(i,()=>{o.length?Gh(t,e,o):jo(t)})}return a}ue.coerceAndCheckDataType=Fh;var Ru=new Set(["string","number","integer","boolean","null"]);function Kh(t,e){return e?t.filter(r=>Ru.has(r)||e==="array"&&r==="array"):[]}function Gh(t,e,r){let{gen:n,data:s,opts:o}=t,a=n.let("dataType",(0,O._)`typeof ${s}`),i=n.let("coerced",(0,O._)`undefined`);o.coerceTypes==="array"&&n.if((0,O._)`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,O._)`${s}[0]`).assign(a,(0,O._)`typeof ${s}`).if(No(e,s,o.strictNumbers),()=>n.assign(i,s))),n.if((0,O._)`${i} !== undefined`);for(let d of r)(Ru.has(d)||d==="array"&&o.coerceTypes==="array")&&c(d);n.else(),jo(t),n.endIf(),n.if((0,O._)`${i} !== undefined`,()=>{n.assign(s,i),Hh(t,i)});function c(d){switch(d){case"string":n.elseIf((0,O._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0,O._)`"" + ${s}`).elseIf((0,O._)`${s} === null`).assign(i,(0,O._)`""`);return;case"number":n.elseIf((0,O._)`${a} == "boolean" || ${s} === null
|
|
5
5
|
|| (${a} == "string" && ${s} && ${s} == +${s})`).assign(i,(0,O._)`+${s}`);return;case"integer":n.elseIf((0,O._)`${a} === "boolean" || ${s} === null
|
|
6
6
|
|| (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(i,(0,O._)`+${s}`);return;case"boolean":n.elseIf((0,O._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(i,!1).elseIf((0,O._)`${s} === "true" || ${s} === 1`).assign(i,!0);return;case"null":n.elseIf((0,O._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(i,null);return;case"array":n.elseIf((0,O._)`${a} === "string" || ${a} === "number"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{n as A}from"./chunk-
|
|
3
|
+
import{n as A}from"./chunk-TKEFJ3O3.js";import{a as C}from"./chunk-7AEOFDY3.js";import{f as O,g as S,m as W,n as P}from"./chunk-KYNP66YS.js";import{O as T,Y as I}from"./chunk-AEYNMLMW.js";import{b as E}from"./chunk-GZPNIYVZ.js";E();import*as h from"fs/promises";import*as f from"fs";import*as u from"path";var R=I("TODO_WRITE"),z={name:"todo_write",description:"Creates and manages a structured task list for your current coding session. This helps track progress, organize complex tasks, and demonstrate thoroughness.",parametersJsonSchema:{type:"object",properties:{todos:{type:"array",items:{type:"object",properties:{content:{type:"string",minLength:1},status:{type:"string",enum:["pending","in_progress","completed"]},id:{type:"string"}},required:["content","status","id"],additionalProperties:!1},description:"The updated todo list"}},required:["todos"],$schema:"http://json-schema.org/draft-07/schema#"}},j=`
|
|
4
4
|
Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
5
5
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
6
6
|
|