@maincode-ai/matilda-code 0.21.11 → 0.21.13-nightly.20261026.e0eae1d8c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/mainy/SKILL.md +0 -2
- package/bundled/mainy/docs/_meta.ts +0 -2
- package/bundled/mainy/docs/configuration/auth.md +5 -10
- package/bundled/mainy/docs/configuration/model-providers.md +31 -217
- package/bundled/mainy/docs/configuration/settings.md +48 -9
- package/bundled/mainy/docs/configuration/trusted-folders.md +12 -6
- package/bundled/mainy/docs/features/auto-mode.md +1 -1
- package/bundled/mainy/docs/features/channels/_meta.ts +0 -3
- package/bundled/mainy/docs/features/channels/overview.md +8 -16
- package/bundled/mainy/docs/features/commands.md +4 -4
- package/bundled/mainy/docs/features/hooks.md +9 -7
- package/bundled/mainy/docs/features/language.md +2 -29
- package/bundled/mainy/docs/features/sub-agents.md +1 -1
- package/bundled/mainy/docs/features/worktree.md +3 -5
- package/bundled/mainy/docs/integration-github-action.md +3 -3
- package/bundled/mainy/docs/matilda-serve.md +1 -1
- package/bundled/mainy/docs/quickstart.md +2 -2
- package/bundled/mainy/docs/support/troubleshooting.md +3 -10
- package/chunks/agent-4FTU3WN6.js +3 -0
- package/chunks/agent-headless-QJUVHPFC.js +3 -0
- package/chunks/{askUserQuestion-XWHJY3DM.js → askUserQuestion-QKX4NEFX.js} +1 -1
- package/chunks/{ca-EUJBUYX5.js → ca-C2V7I65K.js} +6 -6
- package/chunks/{chunk-T4P4KEDW.js → chunk-2ONZZ46N.js} +2 -2
- package/chunks/chunk-36K4HBVM.js +7 -0
- package/chunks/{chunk-EQGA7LH7.js → chunk-3B2HABK7.js} +1 -1
- package/chunks/{chunk-5427BPR2.js → chunk-5NMK4Y7C.js} +1 -1
- package/chunks/chunk-5YT4GCK7.js +14 -0
- package/chunks/{chunk-MH2P4YXC.js → chunk-62AFAL4I.js} +10 -10
- package/chunks/chunk-75KP2FVD.js +81 -0
- package/chunks/chunk-7ZODGQO6.js +4 -0
- package/chunks/chunk-BZB7HYRC.js +37 -0
- package/chunks/{chunk-WHG6N5X2.js → chunk-EXNHJQCD.js} +1 -1
- package/chunks/chunk-FCGYRGV4.js +9 -0
- package/chunks/chunk-G4YMVWG4.js +8 -0
- package/chunks/{chunk-4FVBPNTZ.js → chunk-HDARIAVM.js} +1 -1
- package/chunks/{chunk-4YVN5HXG.js → chunk-HM5LCKDB.js} +2 -2
- package/chunks/chunk-IIQ5YERM.js +120 -0
- package/chunks/chunk-JGJ7BVZN.js +101 -0
- package/chunks/{chunk-FFFZ2QMG.js → chunk-JIKQI4MZ.js} +1 -1
- package/chunks/{chunk-SPW5DXX4.js → chunk-LHDCAN7Z.js} +1 -1
- package/chunks/chunk-LZDHANXA.js +89 -0
- package/chunks/{chunk-ELH4YHJR.js → chunk-NOE4UNQN.js} +1 -1
- package/chunks/chunk-OEZS5R3S.js +207 -0
- package/chunks/{chunk-OOEH6ZSV.js → chunk-PTMCLADZ.js} +1 -1
- package/chunks/{chunk-NYEWHSBL.js → chunk-PYZNGIIR.js} +1 -1
- package/chunks/chunk-QJJTUDDA.js +56 -0
- package/chunks/{chunk-GO2GA2GY.js → chunk-R34HYLL4.js} +1 -1
- package/chunks/{chunk-Q55AVE2N.js → chunk-RK4LPGBV.js} +11 -11
- package/chunks/{chunk-JXUDKX6D.js → chunk-RYHMPK5G.js} +1 -1
- package/chunks/chunk-SR7ARGUY.js +13 -0
- package/chunks/chunk-SY6JRCN3.js +2612 -0
- package/chunks/chunk-TUKNB5CQ.js +33 -0
- package/chunks/{chunk-YMIF2DMT.js → chunk-TZ4FRU6B.js} +1 -1
- package/chunks/chunk-U7V7APDV.js +9 -0
- package/chunks/{chunk-SNLH42QJ.js → chunk-UVWZ44ZW.js} +1 -1
- package/chunks/{chunk-HYVP4472.js → chunk-V6UPUMP3.js} +1 -1
- package/chunks/{chunk-4CSSDBOS.js → chunk-VLDZBRTL.js} +10 -10
- package/chunks/{computer-use-SXP25RZQ.js → computer-use-OXAMR75N.js} +1 -1
- package/chunks/contextCommand-ERLW5VWL.js +3 -0
- package/chunks/{cron-create-2UI4AT4Q.js → cron-create-AUDQ6STP.js} +1 -1
- package/chunks/{cron-delete-ZB6BOTFF.js → cron-delete-P5HE3PDD.js} +1 -1
- package/chunks/{cron-list-YYAXNHB6.js → cron-list-NR5FZBK2.js} +1 -1
- package/chunks/{de-DNEPG7S7.js → de-KOUI2CEW.js} +6 -6
- package/chunks/{devtools-5JRKK3E7.js → devtools-G5DWLP2N.js} +1 -1
- package/chunks/dist-XXTQNTKQ.js +42 -0
- package/chunks/dist-ZFZZLIQU.js +3 -0
- package/chunks/edit-REFR5ROS.js +43 -0
- package/chunks/{en-NOD6KQNM.js → en-RMYRLXC2.js} +4 -4
- package/chunks/{enter-worktree-X47BSJLE.js → enter-worktree-WO3DT2G7.js} +1 -1
- package/chunks/{enterPlanMode-F22ZNTYJ.js → enterPlanMode-PLRHEU5A.js} +1 -1
- package/chunks/{exit-worktree-XY5UMDHX.js → exit-worktree-J5PW6DCV.js} +1 -1
- package/chunks/exitPlanMode-KXUPNLCJ.js +120 -0
- package/chunks/{fr-2OE5WLJ4.js → fr-R3QF3LA2.js} +5 -5
- package/chunks/glob-ZVTVRDQO.js +22 -0
- package/chunks/{goal-tools-6QTC3UI7.js → goal-tools-XVKQJL5I.js} +1 -1
- package/chunks/{grep-6TTPZ524.js → grep-R7CWUNNE.js} +1 -1
- package/chunks/{ja-3B6V5KS7.js → ja-A5OQLXUZ.js} +6 -6
- package/chunks/{keychain-token-storage-54BNK6VH.js → keychain-token-storage-IM4UB4P4.js} +1 -1
- package/chunks/{ls-YWZU3FYL.js → ls-DEAFYDVV.js} +1 -1
- package/chunks/{lsp-4CJDKEEC.js → lsp-DL7W47VY.js} +1 -1
- package/chunks/matildaAgentContentGenerator-57EIU5XE.js +8 -0
- package/chunks/mcp-client-X7LEGSP3.js +3 -0
- package/chunks/monitor-KPWTMH3V.js +32 -0
- package/chunks/{multipart-parser-JI75T2O5.js → multipart-parser-FKHYAVGR.js} +1 -1
- package/chunks/notebook-edit-3ZH5M2TC.js +17 -0
- package/chunks/openaiContentGenerator-6PXSD3T7.js +37 -0
- package/chunks/{pt-KP2JCPUY.js → pt-RG3S3KA7.js} +6 -6
- package/chunks/read-file-JNS7WRUP.js +3 -0
- package/chunks/ripGrep-ICJDGIIV.js +3 -0
- package/chunks/{ru-K7IQQKHC.js → ru-5S5HLRT7.js} +5 -5
- package/chunks/scheduler-QC2PPMFP.js +8 -0
- package/chunks/{send-message-OO2HAKCC.js → send-message-V2WYLN5X.js} +1 -1
- package/chunks/{serve-ZQX2WBLF.js → serve-NUVQULZJ.js} +59 -48
- package/chunks/shell-5LNI7URE.js +3 -0
- package/chunks/{skill-KDM3UUML.js → skill-QFATRHQW.js} +1 -1
- package/chunks/src-6UPZ7TVB.js +3 -0
- package/chunks/src-LZEU4AYF.js +5 -0
- package/chunks/{symbol-search-ALYOX5JN.js → symbol-search-WL6ZHUUN.js} +1 -1
- package/chunks/{syntheticOutput-UASKABJH.js → syntheticOutput-3KW6SQAF.js} +1 -1
- package/chunks/task-create-PNW5SN27.js +3 -0
- package/chunks/{task-detach-I67ZE5MX.js → task-detach-B7PDPFBA.js} +1 -1
- package/chunks/task-list-GGZATGK5.js +9 -0
- package/chunks/{task-stop-ERI5X4AO.js → task-stop-UKBBE2KG.js} +1 -1
- package/chunks/{task-update-CD3W556L.js → task-update-4RHVUBUV.js} +1 -1
- package/chunks/{team-create-F4KQRGMB.js → team-create-2TJC3X57.js} +1 -1
- package/chunks/team-delete-4UJ7SU65.js +8 -0
- package/chunks/todoWrite-NEBVKOSG.js +3 -0
- package/chunks/{tool-search-JFCD5W5M.js → tool-search-R5GS64YR.js} +1 -1
- package/chunks/tree-sitter-bash-2SWKO5B7.js +3 -0
- package/chunks/{web-fetch-REWGIRWQ.js → web-fetch-H3XJMAEF.js} +17 -17
- package/chunks/{web-search-OX2DPEVN.js → web-search-Q6RWPEIB.js} +1 -1
- package/chunks/{workflow-SEFYGBED.js → workflow-3A7KN3E3.js} +2 -2
- package/chunks/write-file-O7Q6SKZC.js +15 -0
- package/cli.js +509 -495
- package/locales/ca.js +2 -28
- package/locales/de.js +2 -28
- package/locales/en.js +2 -30
- package/locales/fr.js +2 -30
- package/locales/ja.js +2 -28
- package/locales/pt.js +2 -28
- package/locales/ru.js +2 -28
- package/package.json +2 -2
- package/sandbox-macos-permissive-closed.sb +0 -1
- package/sandbox-macos-permissive-open.sb +0 -1
- package/sandbox-macos-permissive-proxied.sb +0 -1
- package/sandbox-macos-restrictive-closed.sb +3 -1
- package/sandbox-macos-restrictive-open.sb +3 -1
- package/sandbox-macos-restrictive-proxied.sb +3 -1
- package/bundled/mainy/docs/features/channels/dingtalk.md +0 -134
- package/bundled/mainy/docs/features/channels/feishu.md +0 -186
- package/bundled/mainy/docs/features/channels/weixin.md +0 -106
- package/bundled/mainy/docs/integration-jetbrains.md +0 -81
- package/bundled/mainy/docs/integration-zed.md +0 -72
- package/chunks/agent-ZFZ4HJQC.js +0 -3
- package/chunks/agent-headless-KH2BKLP7.js +0 -3
- package/chunks/anthropicContentGenerator-IYZILRDW.js +0 -39
- package/chunks/chunk-25NCTG5H.js +0 -184
- package/chunks/chunk-2HQMJ2IU.js +0 -8
- package/chunks/chunk-3YLXGE6T.js +0 -8
- package/chunks/chunk-4F4DA5UI.js +0 -8
- package/chunks/chunk-4J6DC24J.js +0 -59
- package/chunks/chunk-4Q2SNBUH.js +0 -18
- package/chunks/chunk-6GBNB5Z2.js +0 -3
- package/chunks/chunk-G7R2XEEF.js +0 -7
- package/chunks/chunk-GHBKFIHC.js +0 -35
- package/chunks/chunk-GUFIMKF5.js +0 -65
- package/chunks/chunk-HWOQNYAO.js +0 -27
- package/chunks/chunk-LJR4RZZ2.js +0 -3
- package/chunks/chunk-NIQK6NX3.js +0 -37
- package/chunks/chunk-NVM7W7TG.js +0 -101
- package/chunks/chunk-O44XK65C.js +0 -8
- package/chunks/chunk-OA56BXPD.js +0 -3
- package/chunks/chunk-ODZOYHIC.js +0 -8
- package/chunks/chunk-PA6532AY.js +0 -6
- package/chunks/chunk-QFNFLE2I.js +0 -2625
- package/chunks/chunk-QH7736R5.js +0 -8
- package/chunks/chunk-QN6WSWMM.js +0 -9
- package/chunks/chunk-QN6Y6NPA.js +0 -3
- package/chunks/chunk-RK2AKQAX.js +0 -39
- package/chunks/chunk-SDTWBD62.js +0 -8
- package/chunks/chunk-SUH3UUWZ.js +0 -25
- package/chunks/chunk-U347OO7S.js +0 -9
- package/chunks/chunk-UIRBHC5X.js +0 -3
- package/chunks/chunk-VI74YQQO.js +0 -8
- package/chunks/chunk-VYZOOSMP.js +0 -30
- package/chunks/chunk-W5CGKUM4.js +0 -15
- package/chunks/chunk-WRQLIPXW.js +0 -113
- package/chunks/chunk-WVY2P6WH.js +0 -26
- package/chunks/chunk-WZ75OGYY.js +0 -14
- package/chunks/chunk-XCFLI3OC.js +0 -9
- package/chunks/chunk-XMZIY7XX.js +0 -13
- package/chunks/contextCommand-3GN5CAOK.js +0 -3
- package/chunks/dist-7UYRLSLE.js +0 -3
- package/chunks/dist-ME6647DQ.js +0 -195
- package/chunks/dist-P6SLWL5V.js +0 -42
- package/chunks/dist-VG3ZDJ2A.js +0 -28
- package/chunks/dist-YTCHM57U.js +0 -23
- package/chunks/edit-KX6V4PH3.js +0 -39
- package/chunks/exitPlanMode-G3QLIWJ4.js +0 -90
- package/chunks/fileFromPath-7UCWPD4W.js +0 -3
- package/chunks/geminiContentGenerator-EQEGOXOV.js +0 -8
- package/chunks/glob-KSBEWI3E.js +0 -22
- package/chunks/matildaAgentContentGenerator-OV4U6DJD.js +0 -8
- package/chunks/matildaContentGenerator-ETIAWE22.js +0 -8
- package/chunks/matildaOAuth2-WOY7ZS43.js +0 -3
- package/chunks/monitor-F4K5HOZX.js +0 -32
- package/chunks/notebook-edit-TL7CI5EA.js +0 -17
- package/chunks/openaiContentGenerator-MGASUFQL.js +0 -3
- package/chunks/read-file-6EAPS2KG.js +0 -3
- package/chunks/ripGrep-K6SFFUIE.js +0 -3
- package/chunks/scheduler-TKWPD4LP.js +0 -8
- package/chunks/shell-AZRK5GIO.js +0 -3
- package/chunks/src-SGI6VLOS.js +0 -3
- package/chunks/src-WZTRMETQ.js +0 -5
- package/chunks/task-create-EBJD55TB.js +0 -3
- package/chunks/task-list-5BGX4G5N.js +0 -9
- package/chunks/team-delete-5U3GBFKJ.js +0 -8
- package/chunks/todoWrite-YGG6AZ3A.js +0 -3
- package/chunks/tree-sitter-bash-XNCMPQBK.js +0 -3
- package/chunks/write-file-UAGVBZMC.js +0 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{ba as cu}from"./chunk-MH2P4YXC.js";import{b as f}from"./chunk-GZPNIYVZ.js";import{d as g,f as oo}from"./chunk-OWGSC52X.js";var Dr=g(U=>{"use strict";f();Object.defineProperty(U,"__esModule",{value:!0});U.regexpCode=U.getEsmExportName=U.getProperty=U.safeStringify=U.stringify=U.strConcat=U.addCodeArg=U.str=U._=U.nil=U._Code=U.Name=U.IDENTIFIER=U._CodeOrName=void 0;var Cr=class{};U._CodeOrName=Cr;U.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var jt=class extends Cr{constructor(e){if(super(),!U.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}}};U.Name=jt;var Re=class extends Cr{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 jt&&(r[n.str]=(r[n.str]||0)+1),r),{})}};U._Code=Re;U.nil=new Re("");function lu(t,...e){let r=[t[0]],n=0;for(;n<e.length;)io(r,e[n]),r.push(t[++n]);return new Re(r)}U._=lu;var ao=new Re("+");function du(t,...e){let r=[qr(t[0])],n=0;for(;n<e.length;)r.push(ao),io(r,e[n]),r.push(ao,qr(t[++n]));return Ym(r),new Re(r)}U.str=du;function io(t,e){e instanceof Re?t.push(...e._items):e instanceof jt?t.push(e):t.push(eh(e))}U.addCodeArg=io;function Ym(t){let e=1;for(;e<t.length-1;){if(t[e]===ao){let r=Qm(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Qm(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof jt||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 jt))return`"${t}${e.slice(1)}`}function Zm(t,e){return e.emptyStr()?t:t.emptyStr()?e:du`${t}${e}`}U.strConcat=Zm;function eh(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:qr(Array.isArray(t)?t.join(","):t)}function th(t){return new Re(qr(t))}U.stringify=th;function qr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}U.safeStringify=qr;function rh(t){return typeof t=="string"&&U.IDENTIFIER.test(t)?new Re(`.${t}`):lu`[${t}]`}U.getProperty=rh;function nh(t){if(typeof t=="string"&&U.IDENTIFIER.test(t))return new Re(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}U.getEsmExportName=nh;function sh(t){return new Re(t.toString())}U.regexpCode=sh});var lo=g($e=>{"use strict";f();Object.defineProperty($e,"__esModule",{value:!0});$e.ValueScope=$e.ValueScopeName=$e.Scope=$e.varKinds=$e.UsedValueState=void 0;var ge=Dr(),co=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},zn;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(zn||($e.UsedValueState=zn={}));$e.varKinds={const:new ge.Name("const"),let:new ge.Name("let"),var:new ge.Name("var")};var Ln=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ge.Name?e:this.name(e)}name(e){return new ge.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}}};$e.Scope=Ln;var Un=class extends ge.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,ge._)`.${new ge.Name(r)}[${n}]`}};$e.ValueScopeName=Un;var oh=(0,ge._)`\n`,uo=class extends Ln{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?oh:ge.nil}}get(){return this._scope}name(e){return new Un(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,ge._)`${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=ge.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,zn.Started);let u=r(d);if(u){let l=this.opts.es5?$e.varKinds.var:$e.varKinds.const;o=(0,ge._)`${o}${l} ${d} = ${u};${this.opts._n}`}else if(u=s?.(d))o=(0,ge._)`${o}${u}${this.opts._n}`;else throw new co(d);c.set(d,zn.Completed)})}return o}};$e.ValueScope=uo});var O=g(I=>{"use strict";f();Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var V=Dr(),xe=lo(),ft=Dr();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return ft._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return ft.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return ft.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return ft.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return ft.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return ft.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return ft.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return ft.Name}});var Hn=lo();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return Hn.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return Hn.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return Hn.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return Hn.varKinds}});I.operators={GT:new V._Code(">"),GTE:new V._Code(">="),LT:new V._Code("<"),LTE:new V._Code("<="),EQ:new V._Code("==="),NEQ:new V._Code("!=="),NOT:new V._Code("!"),OR:new V._Code("||"),AND:new V._Code("&&"),ADD:new V._Code("+")};var nt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},fo=class extends nt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?xe.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=Zt(this.rhs,e,r)),this}get names(){return this.rhs instanceof V._CodeOrName?this.rhs.names:{}}},Fn=class extends nt{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 V.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Zt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof V.Name?{}:{...this.lhs.names};return Gn(e,this.rhs)}},po=class extends Fn{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},mo=class extends nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ho=class extends nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},yo=class extends nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},_o=class extends nt{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=Zt(this.code,e,r),this}get names(){return this.code instanceof V._CodeOrName?this.code.names:{}}},Mr=class extends nt{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)||(ah(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Ct(e,r.names),{})}},st=class extends Mr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},go=class extends Mr{},Qt=class extends st{};Qt.kind="else";var At=class t extends st{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 Qt(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(fu(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=Zt(this.condition,e,r),this}get names(){let e=super.names;return Gn(e,this.condition),this.else&&Ct(e,this.else.names),e}};At.kind="if";var It=class extends st{};It.kind="for";var $o=class extends It{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=Zt(this.iteration,e,r),this}get names(){return Ct(super.names,this.iteration.names)}},vo=class extends It{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?xe.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=Gn(super.names,this.from);return Gn(e,this.to)}},Kn=class extends It{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=Zt(this.iterable,e,r),this}get names(){return Ct(super.names,this.iterable.names)}},Vr=class extends st{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)}};Vr.kind="func";var xr=class extends Mr{render(e){return"return "+super.render(e)}};xr.kind="return";var wo=class extends st{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&&Ct(e,this.catch.names),this.finally&&Ct(e,this.finally.names),e}},zr=class extends st{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};zr.kind="catch";var Lr=class extends st{render(e){return"finally"+super.render(e)}};Lr.kind="finally";var bo=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
import{ba as cu}from"./chunk-62AFAL4I.js";import{b as f}from"./chunk-GZPNIYVZ.js";import{d as g,f as oo}from"./chunk-OWGSC52X.js";var Dr=g(U=>{"use strict";f();Object.defineProperty(U,"__esModule",{value:!0});U.regexpCode=U.getEsmExportName=U.getProperty=U.safeStringify=U.stringify=U.strConcat=U.addCodeArg=U.str=U._=U.nil=U._Code=U.Name=U.IDENTIFIER=U._CodeOrName=void 0;var Cr=class{};U._CodeOrName=Cr;U.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var jt=class extends Cr{constructor(e){if(super(),!U.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}}};U.Name=jt;var Re=class extends Cr{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 jt&&(r[n.str]=(r[n.str]||0)+1),r),{})}};U._Code=Re;U.nil=new Re("");function lu(t,...e){let r=[t[0]],n=0;for(;n<e.length;)io(r,e[n]),r.push(t[++n]);return new Re(r)}U._=lu;var ao=new Re("+");function du(t,...e){let r=[qr(t[0])],n=0;for(;n<e.length;)r.push(ao),io(r,e[n]),r.push(ao,qr(t[++n]));return Ym(r),new Re(r)}U.str=du;function io(t,e){e instanceof Re?t.push(...e._items):e instanceof jt?t.push(e):t.push(eh(e))}U.addCodeArg=io;function Ym(t){let e=1;for(;e<t.length-1;){if(t[e]===ao){let r=Qm(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Qm(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof jt||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 jt))return`"${t}${e.slice(1)}`}function Zm(t,e){return e.emptyStr()?t:t.emptyStr()?e:du`${t}${e}`}U.strConcat=Zm;function eh(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:qr(Array.isArray(t)?t.join(","):t)}function th(t){return new Re(qr(t))}U.stringify=th;function qr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}U.safeStringify=qr;function rh(t){return typeof t=="string"&&U.IDENTIFIER.test(t)?new Re(`.${t}`):lu`[${t}]`}U.getProperty=rh;function nh(t){if(typeof t=="string"&&U.IDENTIFIER.test(t))return new Re(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}U.getEsmExportName=nh;function sh(t){return new Re(t.toString())}U.regexpCode=sh});var lo=g($e=>{"use strict";f();Object.defineProperty($e,"__esModule",{value:!0});$e.ValueScope=$e.ValueScopeName=$e.Scope=$e.varKinds=$e.UsedValueState=void 0;var ge=Dr(),co=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},zn;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(zn||($e.UsedValueState=zn={}));$e.varKinds={const:new ge.Name("const"),let:new ge.Name("let"),var:new ge.Name("var")};var Ln=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ge.Name?e:this.name(e)}name(e){return new ge.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}}};$e.Scope=Ln;var Un=class extends ge.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,ge._)`.${new ge.Name(r)}[${n}]`}};$e.ValueScopeName=Un;var oh=(0,ge._)`\n`,uo=class extends Ln{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?oh:ge.nil}}get(){return this._scope}name(e){return new Un(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,ge._)`${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=ge.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,zn.Started);let u=r(d);if(u){let l=this.opts.es5?$e.varKinds.var:$e.varKinds.const;o=(0,ge._)`${o}${l} ${d} = ${u};${this.opts._n}`}else if(u=s?.(d))o=(0,ge._)`${o}${u}${this.opts._n}`;else throw new co(d);c.set(d,zn.Completed)})}return o}};$e.ValueScope=uo});var O=g(I=>{"use strict";f();Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var V=Dr(),xe=lo(),ft=Dr();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return ft._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return ft.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return ft.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return ft.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return ft.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return ft.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return ft.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return ft.Name}});var Hn=lo();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return Hn.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return Hn.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return Hn.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return Hn.varKinds}});I.operators={GT:new V._Code(">"),GTE:new V._Code(">="),LT:new V._Code("<"),LTE:new V._Code("<="),EQ:new V._Code("==="),NEQ:new V._Code("!=="),NOT:new V._Code("!"),OR:new V._Code("||"),AND:new V._Code("&&"),ADD:new V._Code("+")};var nt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},fo=class extends nt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?xe.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=Zt(this.rhs,e,r)),this}get names(){return this.rhs instanceof V._CodeOrName?this.rhs.names:{}}},Fn=class extends nt{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 V.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Zt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof V.Name?{}:{...this.lhs.names};return Gn(e,this.rhs)}},po=class extends Fn{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},mo=class extends nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ho=class extends nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},yo=class extends nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},_o=class extends nt{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=Zt(this.code,e,r),this}get names(){return this.code instanceof V._CodeOrName?this.code.names:{}}},Mr=class extends nt{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)||(ah(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Ct(e,r.names),{})}},st=class extends Mr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},go=class extends Mr{},Qt=class extends st{};Qt.kind="else";var At=class t extends st{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 Qt(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(fu(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=Zt(this.condition,e,r),this}get names(){let e=super.names;return Gn(e,this.condition),this.else&&Ct(e,this.else.names),e}};At.kind="if";var It=class extends st{};It.kind="for";var $o=class extends It{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=Zt(this.iteration,e,r),this}get names(){return Ct(super.names,this.iteration.names)}},vo=class extends It{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?xe.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=Gn(super.names,this.from);return Gn(e,this.to)}},Kn=class extends It{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=Zt(this.iterable,e,r),this}get names(){return Ct(super.names,this.iterable.names)}},Vr=class extends st{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)}};Vr.kind="func";var xr=class extends Mr{render(e){return"return "+super.render(e)}};xr.kind="return";var wo=class extends st{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&&Ct(e,this.catch.names),this.finally&&Ct(e,this.finally.names),e}},zr=class extends st{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};zr.kind="catch";var Lr=class extends st{render(e){return"finally"+super.render(e)}};Lr.kind="finally";var bo=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
4
|
`:""},this._extScope=e,this._scope=new xe.Scope({parent:e}),this._nodes=[new go]}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 fo(e,o,n)),o}const(e,r,n){return this._def(xe.varKinds.const,e,r,n)}let(e,r,n){return this._def(xe.varKinds.let,e,r,n)}var(e,r,n){return this._def(xe.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Fn(e,r,n))}add(e,r){return this._leafNode(new po(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==V.nil&&this._leafNode(new _o(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,V.addCodeArg)(r,s));return r.push("}"),new V._Code(r)}if(e,r,n){if(this._blockNode(new At(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 At(e))}else(){return this._elseNode(new Qt)}endIf(){return this._endBlockNode(At,Qt)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new $o(e),r)}forRange(e,r,n,s,o=this.opts.es5?xe.varKinds.var:xe.varKinds.let){let a=this._scope.toName(e);return this._for(new vo(o,a,r,n),()=>s(a))}forOf(e,r,n,s=xe.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let a=r instanceof V.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,V._)`${a}.length`,i=>{this.var(o,(0,V._)`${a}[${i}]`),n(o)})}return this._for(new Kn("of",s,o,r),()=>n(o))}forIn(e,r,n,s=this.opts.es5?xe.varKinds.var:xe.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,V._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new Kn("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(It)}label(e){return this._leafNode(new mo(e))}break(e){return this._leafNode(new ho(e))}return(e){let r=new xr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(xr)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new wo;if(this._blockNode(s),this.code(e),r){let o=this.name("e");this._currNode=s.catch=new zr(o),r(o)}return n&&(this._currNode=s.finally=new Lr,this.code(n)),this._endBlockNode(zr,Lr)}throw(e){return this._leafNode(new yo(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=V.nil,n,s){return this._blockNode(new Vr(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Vr)}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 At))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}};I.CodeGen=bo;function Ct(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Gn(t,e){return e instanceof V._CodeOrName?Ct(t,e.names):t}function Zt(t,e,r){if(t instanceof V.Name)return n(t);if(!s(t))return t;return new V._Code(t._items.reduce((o,a)=>(a instanceof V.Name&&(a=n(a)),a instanceof V._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 V._Code&&o._items.some(a=>a instanceof V.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function ah(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function fu(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,V._)`!${Eo(t)}`}I.not=fu;var ih=pu(I.operators.AND);function ch(...t){return t.reduce(ih)}I.and=ch;var uh=pu(I.operators.OR);function lh(...t){return t.reduce(uh)}I.or=lh;function pu(t){return(e,r)=>e===V.nil?r:r===V.nil?e:(0,V._)`${Eo(e)} ${t} ${Eo(r)}`}function Eo(t){return t instanceof V.Name?t:(0,V._)`(${t})`}});var M=g(q=>{"use strict";f();Object.defineProperty(q,"__esModule",{value:!0});q.checkStrictMode=q.getErrorPath=q.Type=q.useFunc=q.setEvaluated=q.evaluatedPropsToName=q.mergeEvaluated=q.eachItem=q.unescapeJsonPointer=q.escapeJsonPointer=q.escapeFragment=q.unescapeFragment=q.schemaRefOrVal=q.schemaHasRulesButRef=q.schemaHasRules=q.checkUnknownRules=q.alwaysValidSchema=q.toHash=void 0;var W=O(),dh=Dr();function fh(t){let e={};for(let r of t)e[r]=!0;return e}q.toHash=fh;function ph(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(yu(t,e),!_u(e,t.self.RULES.all))}q.alwaysValidSchema=ph;function yu(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]||vu(t,`unknown keyword: "${o}"`)}q.checkUnknownRules=yu;function _u(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}q.schemaHasRules=_u;function mh(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}q.schemaHasRulesButRef=mh;function hh({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,W._)`${r}`}return(0,W._)`${t}${e}${(0,W.getProperty)(n)}`}q.schemaRefOrVal=hh;function yh(t){return gu(decodeURIComponent(t))}q.unescapeFragment=yh;function _h(t){return encodeURIComponent(Po(t))}q.escapeFragment=_h;function Po(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=Po;function gu(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=gu;function gh(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}q.eachItem=gh;function mu({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,o,a,i)=>{let c=a===void 0?o:a instanceof W.Name?(o instanceof W.Name?t(s,o,a):e(s,o,a),a):o instanceof W.Name?(e(s,a,o),o):r(o,a);return i===W.Name&&!(c instanceof W.Name)?n(s,c):c}}q.mergeEvaluated={props:mu({mergeNames:(t,e,r)=>t.if((0,W._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,W._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,W._)`${r} || {}`).code((0,W._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,W._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,W._)`${r} || {}`),To(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:$u}),items:mu({mergeNames:(t,e,r)=>t.if((0,W._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,W._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,W._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,W._)`${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,W._)`{}`);return e!==void 0&&To(t,r,e),r}q.evaluatedPropsToName=$u;function To(t,e,r){Object.keys(r).forEach(n=>t.assign((0,W._)`${e}${(0,W.getProperty)(n)}`,!0))}q.setEvaluated=To;var hu={};function $h(t,e){return t.scopeValue("func",{ref:e,code:hu[e.code]||(hu[e.code]=new dh._Code(e.code))})}q.useFunc=$h;var So;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(So||(q.Type=So={}));function vh(t,e,r){if(t instanceof W.Name){let n=e===So.Num;return r?n?(0,W._)`"[" + ${t} + "]"`:(0,W._)`"['" + ${t} + "']"`:n?(0,W._)`"/" + ${t}`:(0,W._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,W.getProperty)(t).toString():"/"+Po(t)}q.getErrorPath=vh;function vu(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}q.checkStrictMode=vu});var Oe=g(ko=>{"use strict";f();Object.defineProperty(ko,"__esModule",{value:!0});var ce=O(),wh={data:new ce.Name("data"),valCxt:new ce.Name("valCxt"),instancePath:new ce.Name("instancePath"),parentData:new ce.Name("parentData"),parentDataProperty:new ce.Name("parentDataProperty"),rootData:new ce.Name("rootData"),dynamicAnchors:new ce.Name("dynamicAnchors"),vErrors:new ce.Name("vErrors"),errors:new ce.Name("errors"),this:new ce.Name("this"),self:new ce.Name("self"),scope:new ce.Name("scope"),json:new ce.Name("json"),jsonPos:new ce.Name("jsonPos"),jsonLen:new ce.Name("jsonLen"),jsonPart:new ce.Name("jsonPart")};ko.default=wh});var Ur=g(ue=>{"use strict";f();Object.defineProperty(ue,"__esModule",{value:!0});ue.extendErrors=ue.resetErrorsCount=ue.reportExtraError=ue.reportError=ue.keyword$DataError=ue.keywordError=void 0;var z=O(),Wn=M(),me=Oe();ue.keywordError={message:({keyword:t})=>(0,z.str)`must pass "${t}" keyword validation`};ue.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,z.str)`"${t}" keyword must be ${e} ($data)`:(0,z.str)`"${t}" keyword is invalid ($data)`};function bh(t,e=ue.keywordError,r,n){let{it:s}=t,{gen:o,compositeRule:a,allErrors:i}=s,c=Eu(t,e,r);n??(a||i)?wu(o,c):bu(s,(0,z._)`[${c}]`)}ue.reportError=bh;function Eh(t,e=ue.keywordError,r){let{it:n}=t,{gen:s,compositeRule:o,allErrors:a}=n,i=Eu(t,e,r);wu(s,i),o||a||bu(n,me.default.vErrors)}ue.reportExtraError=Eh;function Sh(t,e){t.assign(me.default.errors,e),t.if((0,z._)`${me.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,z._)`${me.default.vErrors}.length`,e),()=>t.assign(me.default.vErrors,null)))}ue.resetErrorsCount=Sh;function Ph({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,me.default.errors,i=>{t.const(a,(0,z._)`${me.default.vErrors}[${i}]`),t.if((0,z._)`${a}.instancePath === undefined`,()=>t.assign((0,z._)`${a}.instancePath`,(0,z.strConcat)(me.default.instancePath,o.errorPath))),t.assign((0,z._)`${a}.schemaPath`,(0,z.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,z._)`${a}.schema`,r),t.assign((0,z._)`${a}.data`,n))})}ue.extendErrors=Ph;function wu(t,e){let r=t.const("err",e);t.if((0,z._)`${me.default.vErrors} === null`,()=>t.assign(me.default.vErrors,(0,z._)`[${r}]`),(0,z._)`${me.default.vErrors}.push(${r})`),t.code((0,z._)`${me.default.errors}++`)}function bu(t,e){let{gen:r,validateName:n,schemaEnv:s}=t;s.$async?r.throw((0,z._)`new ${t.ValidationError}(${e})`):(r.assign((0,z._)`${n}.errors`,e),r.return(!1))}var qt={keyword:new z.Name("keyword"),schemaPath:new z.Name("schemaPath"),params:new z.Name("params"),propertyName:new z.Name("propertyName"),message:new z.Name("message"),schema:new z.Name("schema"),parentSchema:new z.Name("parentSchema")};function Eu(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,z._)`{}`:Th(t,e,r)}function Th(t,e,r={}){let{gen:n,it:s}=t,o=[kh(s,r),Rh(t,r)];return Oh(t,e,o),n.object(...o)}function kh({errorPath:t},{instancePath:e}){let r=e?(0,z.str)`${t}${(0,Wn.getErrorPath)(e,Wn.Type.Str)}`:t;return[me.default.instancePath,(0,z.strConcat)(me.default.instancePath,r)]}function Rh({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let s=n?e:(0,z.str)`${e}/${t}`;return r&&(s=(0,z.str)`${s}${(0,Wn.getErrorPath)(r,Wn.Type.Str)}`),[qt.schemaPath,s]}function Oh(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([qt.keyword,s],[qt.params,typeof e=="function"?e(t):e||(0,z._)`{}`]),c.messages&&n.push([qt.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([qt.schema,a],[qt.parentSchema,(0,z._)`${u}${l}`],[me.default.data,o]),d&&n.push([qt.propertyName,d])}});var Pu=g(er=>{"use strict";f();Object.defineProperty(er,"__esModule",{value:!0});er.boolOrEmptySchema=er.topBoolOrEmptySchema=void 0;var Nh=Ur(),jh=O(),Ah=Oe(),Ih={message:"boolean schema is false"};function Ch(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Su(t,!1):typeof r=="object"&&r.$async===!0?e.return(Ah.default.data):(e.assign((0,jh._)`${n}.errors`,null),e.return(!0))}er.topBoolOrEmptySchema=Ch;function qh(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Su(t)):r.var(e,!0)}er.boolOrEmptySchema=qh;function Su(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,Nh.reportError)(s,Ih,void 0,e)}});var Ro=g(tr=>{"use strict";f();Object.defineProperty(tr,"__esModule",{value:!0});tr.getRules=tr.isJSONType=void 0;var Dh=["string","number","integer","boolean","null","object","array"],Mh=new Set(Dh);function Vh(t){return typeof t=="string"&&Mh.has(t)}tr.isJSONType=Vh;function xh(){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:{}}}tr.getRules=xh});var Oo=g(pt=>{"use strict";f();Object.defineProperty(pt,"__esModule",{value:!0});pt.shouldUseRule=pt.shouldUseGroup=pt.schemaHasRulesForType=void 0;function zh({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Tu(t,n)}pt.schemaHasRulesForType=zh;function Tu(t,e){return e.rules.some(r=>ku(t,r))}pt.shouldUseGroup=Tu;function ku(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))}pt.shouldUseRule=ku});var Fr=g(le=>{"use strict";f();Object.defineProperty(le,"__esModule",{value:!0});le.reportTypeError=le.checkDataTypes=le.checkDataType=le.coerceAndCheckDataType=le.getJSONTypes=le.getSchemaTypes=le.DataType=void 0;var Lh=Ro(),Uh=Oo(),Fh=Ur(),N=O(),Ru=M(),rr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(rr||(le.DataType=rr={}));function Kh(t){let e=Ou(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}le.getSchemaTypes=Kh;function Ou(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Lh.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}le.getJSONTypes=Ou;function Gh(t,e){let{gen:r,data:n,opts:s}=t,o=Hh(e,s.coerceTypes),a=e.length>0&&!(o.length===0&&e.length===1&&(0,Uh.schemaHasRulesForType)(t,e[0]));if(a){let i=jo(e,n,s.strictNumbers,rr.Wrong);r.if(i,()=>{o.length?Wh(t,e,o):Ao(t)})}return a}le.coerceAndCheckDataType=Gh;var Nu=new Set(["string","number","integer","boolean","null"]);function Hh(t,e){return e?t.filter(r=>Nu.has(r)||e==="array"&&r==="array"):[]}function Wh(t,e,r){let{gen:n,data:s,opts:o}=t,a=n.let("dataType",(0,N._)`typeof ${s}`),i=n.let("coerced",(0,N._)`undefined`);o.coerceTypes==="array"&&n.if((0,N._)`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,N._)`${s}[0]`).assign(a,(0,N._)`typeof ${s}`).if(jo(e,s,o.strictNumbers),()=>n.assign(i,s))),n.if((0,N._)`${i} !== undefined`);for(let d of r)(Nu.has(d)||d==="array"&&o.coerceTypes==="array")&&c(d);n.else(),Ao(t),n.endIf(),n.if((0,N._)`${i} !== undefined`,()=>{n.assign(s,i),Jh(t,i)});function c(d){switch(d){case"string":n.elseIf((0,N._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0,N._)`"" + ${s}`).elseIf((0,N._)`${s} === null`).assign(i,(0,N._)`""`);return;case"number":n.elseIf((0,N._)`${a} == "boolean" || ${s} === null
|
|
5
5
|
|| (${a} == "string" && ${s} && ${s} == +${s})`).assign(i,(0,N._)`+${s}`);return;case"integer":n.elseIf((0,N._)`${a} === "boolean" || ${s} === null
|
|
6
6
|
|| (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(i,(0,N._)`+${s}`);return;case"boolean":n.elseIf((0,N._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(i,!1).elseIf((0,N._)`${s} === "true" || ${s} === 1`).assign(i,!0);return;case"null":n.elseIf((0,N._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(i,null);return;case"array":n.elseIf((0,N._)`${a} === "string" || ${a} === "number"
|
|
@@ -18,7 +18,7 @@ import{ba as cu}from"./chunk-MH2P4YXC.js";import{b as f}from"./chunk-GZPNIYVZ.js
|
|
|
18
18
|
`)}formatDetailed(e,r=Date.now()){let n=this.getSummary(r),s=n.totalToolCalls>0?n.successRate??n.successfulToolCalls/n.totalToolCalls*100:0,o=[];o.push(`\u{1F4CB} Task Completed: ${e}`),o.push(`\u23F1\uFE0F Duration: ${this.fmtDuration(n.totalDurationMs)} | \u{1F501} Rounds: ${n.rounds}`);let a="Poor execution";s>=95?a="Excellent execution":s>=85?a="Good execution":s>=70&&(a="Fair execution"),o.push(`\u2705 Quality: ${a} (${s.toFixed(1)}% tool success)`);let i=n.totalDurationMs,c="Long execution - consider breaking down tasks";if(i<1e4?c="Fast completion - under 10 seconds":i<6e4?c="Good speed - under a minute":i<3e5&&(c="Moderate duration - a few minutes"),o.push(`\u{1F680} Speed: ${c}`),o.push(`\u{1F527} Tools: ${n.totalToolCalls} calls, ${s.toFixed(1)}% success (${n.successfulToolCalls} ok, ${n.failedToolCalls} failed)`),typeof n.totalTokens=="number"){let u=[`in ${n.inputTokens??0}`,`out ${n.outputTokens??0}`];o.push(`\u{1F522} Tokens: ${n.totalTokens.toLocaleString()} (${u.join(", ")})`)}if(n.toolUsage&&n.toolUsage.length){let u=[...n.toolUsage].sort((l,y)=>y.count-l.count).slice(0,5);o.push(`
|
|
19
19
|
Top tools:`);for(let l of u){let y=typeof l.averageDurationMs=="number"?`, avg ${this.fmtDuration(Math.round(l.averageDurationMs))}`:"";o.push(` - ${l.name}: ${l.count} calls (${l.success} ok, ${l.failure} fail${y}${l.lastError?`, last error: ${l.lastError}`:""})`)}}let d=this.generatePerformanceTips(n);if(d.length){o.push(`
|
|
20
20
|
\u{1F4A1} Performance Insights:`);for(let u of d.slice(0,3))o.push(` - ${u}`)}return o.join(`
|
|
21
|
-
`)}fmtDuration(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;if(e<36e5){let s=Math.floor(e/6e4),o=Math.floor(e%6e4/1e3);return`${s}m ${o}s`}let r=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4);return`${r}h ${n}m`}generatePerformanceTips(e){let r=[],n=e.totalToolCalls;if((e.totalToolCalls>0?e.successRate??e.successfulToolCalls/e.totalToolCalls*100:0)<80&&r.push("Low tool success rate - review inputs and error messages"),e.totalDurationMs>6e4&&r.push("Long execution time - consider breaking down complex tasks"),typeof e.totalTokens=="number"&&e.totalTokens>1e5&&r.push("High token usage - consider optimizing prompts or narrowing scope"),typeof e.totalTokens=="number"&&n>0){let c=e.totalTokens/n;c>5e3&&r.push(`High token usage per tool call (~${Math.round(c)} tokens/call)`)}let o=c=>/web|fetch|search/i.test(c);(e.toolUsage||[]).some(c=>o(c.name)&&c.lastError&&/timeout|network/i.test(c.lastError))&&r.push("Network operations had failures - consider increasing timeout or checking connectivity");let i=(e.toolUsage||[]).filter(c=>(c.averageDurationMs??0)>1e4).sort((c,d)=>(d.averageDurationMs??0)-(c.averageDurationMs??0));return i.length&&r.push(`Consider optimizing ${i[0].name} operations (avg ${this.fmtDuration(Math.round(i[0].averageDurationMs))})`),r}};f();var Jm=class{constructor(e){this.params=e}toolLocations(){return[]}getDefaultPermission(){return Promise.resolve("allow")}getConfirmationDetails(e){let r={type:"info",title:`Confirm ${this.constructor.name.replace(/Invocation$/,"")}`,prompt:this.getDescription(),onConfirm:async(n,s)=>{}};return Promise.resolve(r)}},au=class{constructor(e,r,n,s,o,a=!0,i=!1,c=!1,d=!1,u){this.name=e;this.displayName=r;this.description=n;this.kind=s;this.parameterSchema=o;this.isOutputMarkdown=a;this.canUpdateOutput=i;this.shouldDefer=c;this.alwaysLoad=d;this.searchHint=u}get schema(){return{name:this.name,description:this.description,parametersJsonSchema:this.parameterSchema}}get maxOutputChars(){}get truncateKeep(){return"both"}toAutoClassifierInput(e){return""}validateToolParams(e){return null}async buildAndExecute(e,r,n,s){return this.build(e).execute(r,n,s)}silentBuild(e){try{return this.build(e)}catch(r){return r instanceof Error?r:new Error(String(r))}}async validateBuildAndExecute(e,r){let n=this.silentBuild(e);if(n instanceof Error){let s=n.message;return{llmContent:`Error: Invalid parameters provided. Reason: ${s}`,returnDisplay:s,error:{message:s,type:"invalid_tool_params"}}}try{return await n.execute(r)}catch(s){let o=s instanceof Error?s.message:String(s);return{llmContent:`Error: Tool call execution failed. Reason: ${o}`,returnDisplay:o,error:{message:o,type:"execution_failed"}}}}},Bm=class extends au{build(e){let r=this.validateToolParams(e);if(r)throw new Error(r);return this.createInvocation(e)}validateToolParams(e){let r=to.validate(this.schema.parametersJsonSchema,e);return r||this.validateToolParamValues(e)}validateToolParamValues(e){return null}};function VN(t){return typeof t=="object"&&t!==null&&"name"in t&&"build"in t&&typeof t.build=="function"}function xN(t){function e(n){if(!n.startsWith("#/"))return null;let s=n.substring(2).split("/"),o=t;for(let a of s){if(typeof o!="object"||o===null||!Object.prototype.hasOwnProperty.call(o,a))return null;o=o[a]}return o}function r(n,s,o){if(typeof n!="object"||n===null)return!1;if(Array.isArray(n)){for(let a of n)if(r(a,s,o))return!0;return!1}if("$ref"in n&&typeof n.$ref=="string"){let a=n.$ref;if(a==="#/"||o.has(a))return!0;if(s.has(a))return!1;let i=e(a);if(i){s.add(a),o.add(a);let c=r(i,s,o);return o.delete(a),c}}for(let a in n)if(Object.prototype.hasOwnProperty.call(n,a)&&r(n[a],s,o))return!0;return!1}return r(t,new Set,new Set)}var JP=(d=>(d.ProceedOnce="proceed_once",d.ProceedAlways="proceed_always",d.ProceedAlwaysServer="proceed_always_server",d.ProceedAlwaysTool="proceed_always_tool",d.ProceedAlwaysProject="proceed_always_project",d.ProceedAlwaysUser="proceed_always_user",d.ModifyWithEditor="modify_with_editor",d.RestorePrevious="restore_previous",d.Cancel="cancel",d))(JP||{}),BP=(u=>(u.Read="read",u.Edit="edit",u.Delete="delete",u.Move="move",u.Search="search",u.Execute="execute",u.Think="think",u.Fetch="fetch",u.Agent="agent",u.Other="other",u))(BP||{}),zN=["edit","delete","move","execute"],LN=new Set(["read","search","fetch"]);f();var iu={EDIT:"edit",WRITE_FILE:"write_file",READ_FILE:"read_file",GREP:"grep_search",GLOB:"glob",SHELL:"run_shell_command",TODO_WRITE:"todo_write",MEMORY:"save_memory",AGENT:"agent",SKILL:"skill",EXIT_PLAN_MODE:"exit_plan_mode",ENTER_PLAN_MODE:"enter_plan_mode",GET_GOAL:"get_goal",UPDATE_GOAL:"update_goal",WEB_FETCH:"web_fetch",WEB_SEARCH:"web_search",SYMBOL_SEARCH:"symbol_search",LS:"list_directory",LSP:"lsp",ASK_USER_QUESTION:"ask_user_question",CRON_CREATE:"cron_create",CRON_LIST:"cron_list",CRON_DELETE:"cron_delete",TASK_STOP:"task_stop",TASK_DETACH:"task_detach",TASK_CREATE:"task_create",TASK_UPDATE:"task_update",TASK_LIST:"task_list",TEAM_CREATE:"team_create",TEAM_DELETE:"team_delete",SEND_MESSAGE:"send_message",STRUCTURED_OUTPUT:"structured_output",MONITOR:"monitor",NOTEBOOK_EDIT:"notebook_edit",TOOL_SEARCH:"tool_search",ENTER_WORKTREE:"enter_worktree",EXIT_WORKTREE:"exit_worktree",WORKFLOW:"workflow"},no={EDIT:"Edit",WRITE_FILE:"WriteFile",READ_FILE:"ReadFile",GREP:"Grep",GLOB:"Glob",SHELL:"Shell",TODO_WRITE:"TodoWrite",MEMORY:"SaveMemory",AGENT:"Agent",SKILL:"Skill",EXIT_PLAN_MODE:"ExitPlanMode",ENTER_PLAN_MODE:"EnterPlanMode",GET_GOAL:"Goal",UPDATE_GOAL:"UpdateGoal",WEB_FETCH:"WebFetch",WEB_SEARCH:"WebSearch",SYMBOL_SEARCH:"SymbolSearch",LS:"ListFiles",LSP:"Lsp",ASK_USER_QUESTION:"AskUserQuestion",CRON_CREATE:"CronCreate",CRON_LIST:"CronList",CRON_DELETE:"CronDelete",TASK_STOP:"TaskStop",TASK_DETACH:"TaskDetach",TASK_CREATE:"TaskCreate",TASK_UPDATE:"TaskUpdate",TASK_LIST:"TaskList",TEAM_CREATE:"TeamCreate",TEAM_DELETE:"TeamDelete",SEND_MESSAGE:"SendMessage",STRUCTURED_OUTPUT:"StructuredOutput",MONITOR:"Monitor",NOTEBOOK_EDIT:"NotebookEdit",TOOL_SEARCH:"ToolSearch",ENTER_WORKTREE:"EnterWorktree",EXIT_WORKTREE:"ExitWorktree",WORKFLOW:"Workflow"},Xm={search_file_content:iu.GREP,replace:iu.EDIT,task:iu.AGENT};function KN(t){return Object.prototype.hasOwnProperty.call(Xm,t)?Xm[t]??t:t}var GN={SearchFiles:no.GREP,FindFiles:no.GLOB,ReadFolder:no.LS,Task:no.AGENT};export{uu as a,Kr as b,Yo as c,Dm as d,to as e,Wm as f,Jm as g,au as h,Bm as i,VN as j,xN as k,JP as l,BP as m,zN as n,LN as o,iu as p,no as q,Xm as r,KN as s,GN as t};
|
|
21
|
+
`)}fmtDuration(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;if(e<36e5){let s=Math.floor(e/6e4),o=Math.floor(e%6e4/1e3);return`${s}m ${o}s`}let r=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4);return`${r}h ${n}m`}generatePerformanceTips(e){let r=[],n=e.totalToolCalls;if((e.totalToolCalls>0?e.successRate??e.successfulToolCalls/e.totalToolCalls*100:0)<80&&r.push("Low tool success rate - review inputs and error messages"),e.totalDurationMs>6e4&&r.push("Long execution time - consider breaking down complex tasks"),typeof e.totalTokens=="number"&&e.totalTokens>1e5&&r.push("High token usage - consider optimizing prompts or narrowing scope"),typeof e.totalTokens=="number"&&n>0){let c=e.totalTokens/n;c>5e3&&r.push(`High token usage per tool call (~${Math.round(c)} tokens/call)`)}let o=c=>/web|fetch|search/i.test(c);(e.toolUsage||[]).some(c=>o(c.name)&&c.lastError&&/timeout|network/i.test(c.lastError))&&r.push("Network operations had failures - consider increasing timeout or checking connectivity");let i=(e.toolUsage||[]).filter(c=>(c.averageDurationMs??0)>1e4).sort((c,d)=>(d.averageDurationMs??0)-(c.averageDurationMs??0));return i.length&&r.push(`Consider optimizing ${i[0].name} operations (avg ${this.fmtDuration(Math.round(i[0].averageDurationMs))})`),r}};f();var Jm=class{constructor(e){this.params=e}toolLocations(){return[]}getDefaultPermission(){return Promise.resolve("allow")}getConfirmationDetails(e){let r={type:"info",title:`Confirm ${this.constructor.name.replace(/Invocation$/,"")}`,prompt:this.getDescription(),onConfirm:async(n,s)=>{}};return Promise.resolve(r)}},au=class{constructor(e,r,n,s,o,a=!0,i=!1,c=!1,d=!1,u){this.name=e;this.displayName=r;this.description=n;this.kind=s;this.parameterSchema=o;this.isOutputMarkdown=a;this.canUpdateOutput=i;this.shouldDefer=c;this.alwaysLoad=d;this.searchHint=u}get schema(){return{name:this.name,description:this.description,parametersJsonSchema:this.parameterSchema}}get maxOutputChars(){}get truncateKeep(){return"both"}get boundsOwnOutput(){return!1}toAutoClassifierInput(e){return""}validateToolParams(e){return null}async buildAndExecute(e,r,n,s){return this.build(e).execute(r,n,s)}silentBuild(e){try{return this.build(e)}catch(r){return r instanceof Error?r:new Error(String(r))}}async validateBuildAndExecute(e,r){let n=this.silentBuild(e);if(n instanceof Error){let s=n.message;return{llmContent:`Error: Invalid parameters provided. Reason: ${s}`,returnDisplay:s,error:{message:s,type:"invalid_tool_params"}}}try{return await n.execute(r)}catch(s){let o=s instanceof Error?s.message:String(s);return{llmContent:`Error: Tool call execution failed. Reason: ${o}`,returnDisplay:o,error:{message:o,type:"execution_failed"}}}}},Bm=class extends au{build(e){let r=this.validateToolParams(e);if(r)throw new Error(r);return this.createInvocation(e)}validateToolParams(e){let r=to.validate(this.schema.parametersJsonSchema,e);return r||this.validateToolParamValues(e)}validateToolParamValues(e){return null}};function VN(t){return typeof t=="object"&&t!==null&&"name"in t&&"build"in t&&typeof t.build=="function"}function xN(t){function e(n){if(!n.startsWith("#/"))return null;let s=n.substring(2).split("/"),o=t;for(let a of s){if(typeof o!="object"||o===null||!Object.prototype.hasOwnProperty.call(o,a))return null;o=o[a]}return o}function r(n,s,o){if(typeof n!="object"||n===null)return!1;if(Array.isArray(n)){for(let a of n)if(r(a,s,o))return!0;return!1}if("$ref"in n&&typeof n.$ref=="string"){let a=n.$ref;if(a==="#/"||o.has(a))return!0;if(s.has(a))return!1;let i=e(a);if(i){s.add(a),o.add(a);let c=r(i,s,o);return o.delete(a),c}}for(let a in n)if(Object.prototype.hasOwnProperty.call(n,a)&&r(n[a],s,o))return!0;return!1}return r(t,new Set,new Set)}var JP=(d=>(d.ProceedOnce="proceed_once",d.ProceedAlways="proceed_always",d.ProceedAlwaysServer="proceed_always_server",d.ProceedAlwaysTool="proceed_always_tool",d.ProceedAlwaysProject="proceed_always_project",d.ProceedAlwaysUser="proceed_always_user",d.ModifyWithEditor="modify_with_editor",d.RestorePrevious="restore_previous",d.Cancel="cancel",d))(JP||{}),BP=(u=>(u.Read="read",u.Edit="edit",u.Delete="delete",u.Move="move",u.Search="search",u.Execute="execute",u.Think="think",u.Fetch="fetch",u.Agent="agent",u.Other="other",u))(BP||{}),zN=["edit","delete","move","execute"],LN=new Set(["read","search","fetch"]);f();var iu={EDIT:"edit",WRITE_FILE:"write_file",READ_FILE:"read_file",GREP:"grep_search",GLOB:"glob",SHELL:"run_shell_command",TODO_WRITE:"todo_write",MEMORY:"save_memory",AGENT:"agent",SKILL:"skill",EXIT_PLAN_MODE:"exit_plan_mode",ENTER_PLAN_MODE:"enter_plan_mode",GET_GOAL:"get_goal",UPDATE_GOAL:"update_goal",WEB_FETCH:"web_fetch",WEB_SEARCH:"web_search",SYMBOL_SEARCH:"symbol_search",LS:"list_directory",LSP:"lsp",ASK_USER_QUESTION:"ask_user_question",CRON_CREATE:"cron_create",CRON_LIST:"cron_list",CRON_DELETE:"cron_delete",TASK_STOP:"task_stop",TASK_DETACH:"task_detach",TASK_CREATE:"task_create",TASK_UPDATE:"task_update",TASK_LIST:"task_list",TEAM_CREATE:"team_create",TEAM_DELETE:"team_delete",SEND_MESSAGE:"send_message",STRUCTURED_OUTPUT:"structured_output",MONITOR:"monitor",NOTEBOOK_EDIT:"notebook_edit",TOOL_SEARCH:"tool_search",ENTER_WORKTREE:"enter_worktree",EXIT_WORKTREE:"exit_worktree",WORKFLOW:"workflow"},no={EDIT:"Edit",WRITE_FILE:"WriteFile",READ_FILE:"ReadFile",GREP:"Grep",GLOB:"Glob",SHELL:"Shell",TODO_WRITE:"TodoWrite",MEMORY:"SaveMemory",AGENT:"Agent",SKILL:"Skill",EXIT_PLAN_MODE:"ExitPlanMode",ENTER_PLAN_MODE:"EnterPlanMode",GET_GOAL:"Goal",UPDATE_GOAL:"UpdateGoal",WEB_FETCH:"WebFetch",WEB_SEARCH:"WebSearch",SYMBOL_SEARCH:"SymbolSearch",LS:"ListFiles",LSP:"Lsp",ASK_USER_QUESTION:"AskUserQuestion",CRON_CREATE:"CronCreate",CRON_LIST:"CronList",CRON_DELETE:"CronDelete",TASK_STOP:"TaskStop",TASK_DETACH:"TaskDetach",TASK_CREATE:"TaskCreate",TASK_UPDATE:"TaskUpdate",TASK_LIST:"TaskList",TEAM_CREATE:"TeamCreate",TEAM_DELETE:"TeamDelete",SEND_MESSAGE:"SendMessage",STRUCTURED_OUTPUT:"StructuredOutput",MONITOR:"Monitor",NOTEBOOK_EDIT:"NotebookEdit",TOOL_SEARCH:"ToolSearch",ENTER_WORKTREE:"EnterWorktree",EXIT_WORKTREE:"ExitWorktree",WORKFLOW:"Workflow"},Xm={search_file_content:iu.GREP,replace:iu.EDIT,task:iu.AGENT};function KN(t){return Object.prototype.hasOwnProperty.call(Xm,t)?Xm[t]??t:t}var GN={SearchFiles:no.GREP,FindFiles:no.GLOB,ReadFolder:no.LS,Task:no.AGENT};export{uu as a,Kr as b,Yo as c,Dm as d,to as e,Wm as f,Jm as g,au as h,Bm as i,VN as j,xN as k,JP as l,BP as m,zN as n,LN as o,iu as p,no as q,Xm as r,KN as s,GN as t};
|
|
22
22
|
/**
|
|
23
23
|
* @license
|
|
24
24
|
* Copyright 2025 Google LLC
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{b as f}from"./chunk-GZPNIYVZ.js";import{a as L,d as g}from"./chunk-OWGSC52X.js";var D=g((Ee,B)=>{f();var w=1e3,O=w*60,v=O*60,y=v*24,ee=y*7,re=y*365.25;B.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return te(e);if(r==="number"&&isFinite(e))return t.long?se(e):ne(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function te(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),o=(t[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return r*re;case"weeks":case"week":case"w":return r*ee;case"days":case"day":case"d":return r*y;case"hours":case"hour":case"hrs":case"hr":case"h":return r*v;case"minutes":case"minute":case"mins":case"min":case"m":return r*O;case"seconds":case"second":case"secs":case"sec":case"s":return r*w;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function ne(e){var t=Math.abs(e);return t>=y?Math.round(e/y)+"d":t>=v?Math.round(e/v)+"h":t>=O?Math.round(e/O)+"m":t>=w?Math.round(e/w)+"s":e+"ms"}function se(e){var t=Math.abs(e);return t>=y?R(e,t,y,"day"):t>=v?R(e,t,v,"hour"):t>=O?R(e,t,O,"minute"):t>=w?R(e,t,w,"second"):e+" ms"}function R(e,t,r,o){var d=t>=r*1.5;return Math.round(e/r)+" "+o+(d?"s":"")}});var k=g((Re,q)=>{f();function oe(e){r.debug=r,r.default=r,r.coerce=Z,r.disable=J,r.enable=d,r.enabled=W,r.humanize=D(),r.destroy=H,Object.keys(e).forEach(n=>{r[n]=e[n]}),r.names=[],r.skips=[],r.formatters={};function t(n){let s=0;for(let i=0;i<n.length;i++)s=(s<<5)-s+n.charCodeAt(i),s|=0;return r.colors[Math.abs(s)%r.colors.length]}r.selectColor=t;function r(n){let s,i=null,a,b;function l(...p){if(!l.enabled)return;let F=l,E=Number(new Date),K=E-(s||E);F.diff=K,F.prev=s,F.curr=E,s=E,p[0]=r.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let I=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(_,Q)=>{if(_==="%%")return"%";I++;let j=r.formatters[Q];if(typeof j=="function"){let X=p[I];_=j.call(F,X),p.splice(I,1),I--}return _}),r.formatArgs.call(F,p),(F.log||r.log).apply(F,p)}return l.namespace=n,l.useColors=r.useColors(),l.color=r.selectColor(n),l.extend=o,l.destroy=r.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>i!==null?i:(a!==r.namespaces&&(a=r.namespaces,b=r.enabled(n)),b),set:p=>{i=p}}),typeof r.init=="function"&&r.init(l),l}function o(n,s){let i=r(this.namespace+(typeof s>"u"?":":s)+n);return i.log=this.log,i}function d(n){r.save(n),r.namespaces=n,r.names=[],r.skips=[];let s=(typeof n=="string"?n:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let i of s)i[0]==="-"?r.skips.push(i.slice(1)):r.names.push(i)}function m(n,s){let i=0,a=0,b=-1,l=0;for(;i<n.length;)if(a<s.length&&(s[a]===n[i]||s[a]==="*"))s[a]==="*"?(b=a,l=i,a++):(i++,a++);else if(b!==-1)a=b+1,l++,i=l;else return!1;for(;a<s.length&&s[a]==="*";)a++;return a===s.length}function J(){let n=[...r.names,...r.skips.map(s=>"-"+s)].join(",");return r.enable(""),n}function W(n){for(let s of r.skips)if(m(n,s))return!1;for(let s of r.names)if(m(n,s))return!0;return!1}function Z(n){return n instanceof Error?n.stack||n.message:n}function H(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}q.exports=oe});var G=g((C,A)=>{f();C.formatArgs=ce;C.save=ue;C.load=ae;C.useColors=ie;C.storage=le();C.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();C.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ie(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ce(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+A.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(r++,d==="%c"&&(o=r))}),e.splice(o,0,t)}C.log=console.debug||console.log||(()=>{});function ue(e){try{e?C.storage.setItem("debug",e):C.storage.removeItem("debug")}catch{}}function ae(){let e;try{e=C.storage.getItem("debug")||C.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function le(){try{return localStorage}catch{}}A.exports=k()(C);var{formatters:fe}=A.exports;fe.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var U=g((Te,P)=>{"use strict";f();P.exports=(e,t)=>{t=t||process.argv;let r=e.startsWith("-")?"":e.length===1?"-":"--",o=t.indexOf(r+e),d=t.indexOf("--");return o!==-1&&(d===-1?!0:o<d)}});var $=g((Le,z)=>{"use strict";f();var Ce=L("os"),h=U(),u=process.env,x;h("no-color")||h("no-colors")||h("color=false")?x=!1:(h("color")||h("colors")||h("color=true")||h("color=always"))&&(x=!0);"FORCE_COLOR"in u&&(x=u.FORCE_COLOR.length===0||parseInt(u.FORCE_COLOR,10)!==0);function de(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function pe(e){if(x===!1)return 0;if(h("color=16m")||h("color=full")||h("color=truecolor"))return 3;if(h("color=256"))return 2;if(e&&!e.isTTY&&x!==!0)return 0;let t=x?1:0;if(process.platform==="win32"){let r=Ce.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(r=>r in u)||u.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if(u.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in u){let r=parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:(u.TERM==="dumb",t)}function N(e){let t=pe(e);return de(t)}z.exports={supportsColor:N,stdout:N(process.stdout),stderr:N(process.stderr)}});var Y=g((c,T)=>{f();var he=L("tty"),M=L("util");c.init=Oe;c.log=ye;c.formatArgs=Fe;c.save=be;c.load=we;c.useColors=me;c.destroy=M.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");c.colors=[6,2,3,4,5,1];try{let e=$();e&&(e.stderr||e).level>=2&&(c.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}c.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(d,m)=>m.toUpperCase()),o=process.env[t];return/^(yes|on|true|enabled)$/i.test(o)?o=!0:/^(no|off|false|disabled)$/i.test(o)?o=!1:o==="null"?o=null:o=Number(o),e[r]=o,e},{});function me(){return"colors"in c.inspectOpts?!!c.inspectOpts.colors:he.isatty(process.stderr.fd)}function Fe(e){let{namespace:t,useColors:r}=this;if(r){let o=this.color,d="\x1B[3"+(o<8?o:"8;5;"+o),m=` ${d};1m${t} \x1B[0m`;e[0]=m+e[0].split(`
|
|
4
|
+
`).join(`
|
|
5
|
+
`+m),e.push(d+"m+"+T.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=ge()+t+" "+e[0]}function ge(){return c.inspectOpts.hideDate?"":new Date().toISOString()+" "}function ye(...e){return process.stderr.write(M.formatWithOptions(c.inspectOpts,...e)+`
|
|
6
|
+
`)}function be(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function we(){return process.env.DEBUG}function Oe(e){e.inspectOpts={};let t=Object.keys(c.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=c.inspectOpts[t[r]]}T.exports=k()(c);var{formatters:V}=T.exports;V.o=function(e){return this.inspectOpts.colors=this.useColors,M.inspect(e,this.inspectOpts).split(`
|
|
7
|
+
`).map(t=>t.trim()).join(" ")};V.O=function(e){return this.inspectOpts.colors=this.useColors,M.inspect(e,this.inspectOpts)}});var ve=g((Se,S)=>{f();typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?S.exports=G():S.exports=Y()});export{D as a,ve as b};
|
|
@@ -27,4 +27,4 @@ ${n}`;break}case"followup":break;default:{let l=v;throw new Error(`Unknown dispa
|
|
|
27
27
|
Ask the bot operator to approve you with:
|
|
28
28
|
matilda channel pairing approve ${this.name} ${t}`):await this.sendMessage(e,"Too many pending pairing requests. Please try again later.")}};d();d();import{spawn as V}from"node:child_process";import{Readable as Z,Writable as ee}from"node:stream";import{EventEmitter as te}from"node:events";var q=class extends te{child=null;connection=null;options;_availableCommands=[];constructor(e){super(),this.options=e}get availableCommands(){return this._availableCommands}async start(){let{cliEntryPath:e,cwd:t}=this.options,s=[...process.execArgv.filter(r=>!/^--inspect(-brk)?($|=)/.test(r)),e,"--acp"];if(this.options.model&&s.push("--model",this.options.model),this.child=V(process.execPath,s,{cwd:t,stdio:["pipe","pipe","pipe"],env:{...process.env},shell:!1}),this.child.stderr?.on("data",r=>{let a=r.toString().trim();a&&process.stderr.write(`[AcpBridge] ${a}
|
|
29
29
|
`)}),this.child.on("exit",(r,a)=>{process.stderr.write(`[AcpBridge] Process exited (code=${r}, signal=${a})
|
|
30
|
-
`),this.connection=null,this.child=null,this.emit("disconnected",r,a)}),await new Promise(r=>setTimeout(r,1e3)),!this.child||this.child.killed)throw new Error("ACP process failed to start");let o=Z.toWeb(this.child.stdout),i=ee.toWeb(this.child.stdin),n=D(i,o);this.connection=new U(()=>({sessionUpdate:r=>(this.handleSessionUpdate(r),Promise.resolve()),requestPermission:async r=>{let a=Array.isArray(r.options)?r.options:[];return{outcome:{outcome:"selected",optionId:a.find(v=>v.optionId==="proceed_once")?.optionId||a[0]?.optionId||"proceed_once"}}},extNotification:async()=>{}}),n),await this.connection.initialize({protocolVersion:B,clientCapabilities:{}})}async newSession(e){return(await this.ensureConnection().newSession({cwd:e,mcpServers:[]})).sessionId}async loadSession(e,t){return await this.ensureConnection().loadSession({sessionId:e,cwd:t,mcpServers:[]}),e}async prompt(e,t,s){let o=this.ensureConnection(),i=[],n=(a,f)=>{a===e&&i.push(f)};this.on("textChunk",n);let r=[];s?.imageBase64&&s.imageMimeType&&r.push({type:"image",data:s.imageBase64,mimeType:s.imageMimeType}),r.push({type:"text",text:t});try{await o.prompt({sessionId:e,prompt:r})}finally{this.off("textChunk",n)}return i.join("")}async cancelSession(e){await this.ensureConnection().cancel({sessionId:e})}stop(){this.child&&(this.child.kill(),this.child=null),this.connection=null}get isConnected(){return this.child!==null&&!this.child.killed&&this.child.exitCode===null}handleSessionUpdate(e){let{sessionId:t}=e,s=e.update;if(!s)return;switch(s.sessionUpdate){case"agent_message_chunk":{let i=s.content;i?.type==="text"&&i.text&&this.emit("textChunk",t,i.text);break}case"tool_call":{let i={sessionId:t,toolCallId:s.toolCallId,kind:s.kind||"",title:s.title||"",status:s.status||"pending",rawInput:s.rawInput};this.emit("toolCall",i);break}case"available_commands_update":{Array.isArray(s.availableCommands)&&(this._availableCommands=s.availableCommands);break}default:break}this.emit("sessionUpdate",e)}ensureConnection(){if(!this.connection||!this.isConnected)throw new Error("Not connected to ACP agent");return this.connection}};d();export{O as a,
|
|
30
|
+
`),this.connection=null,this.child=null,this.emit("disconnected",r,a)}),await new Promise(r=>setTimeout(r,1e3)),!this.child||this.child.killed)throw new Error("ACP process failed to start");let o=Z.toWeb(this.child.stdout),i=ee.toWeb(this.child.stdin),n=D(i,o);this.connection=new U(()=>({sessionUpdate:r=>(this.handleSessionUpdate(r),Promise.resolve()),requestPermission:async r=>{let a=Array.isArray(r.options)?r.options:[];return{outcome:{outcome:"selected",optionId:a.find(v=>v.optionId==="proceed_once")?.optionId||a[0]?.optionId||"proceed_once"}}},extNotification:async()=>{}}),n),await this.connection.initialize({protocolVersion:B,clientCapabilities:{}})}async newSession(e){return(await this.ensureConnection().newSession({cwd:e,mcpServers:[]})).sessionId}async loadSession(e,t){return await this.ensureConnection().loadSession({sessionId:e,cwd:t,mcpServers:[]}),e}async prompt(e,t,s){let o=this.ensureConnection(),i=[],n=(a,f)=>{a===e&&i.push(f)};this.on("textChunk",n);let r=[];s?.imageBase64&&s.imageMimeType&&r.push({type:"image",data:s.imageBase64,mimeType:s.imageMimeType}),r.push({type:"text",text:t});try{await o.prompt({sessionId:e,prompt:r})}finally{this.off("textChunk",n)}return i.join("")}async cancelSession(e){await this.ensureConnection().cancel({sessionId:e})}stop(){this.child&&(this.child.kill(),this.child=null),this.connection=null}get isConnected(){return this.child!==null&&!this.child.killed&&this.child.exitCode===null}handleSessionUpdate(e){let{sessionId:t}=e,s=e.update;if(!s)return;switch(s.sessionUpdate){case"agent_message_chunk":{let i=s.content;i?.type==="text"&&i.text&&this.emit("textChunk",t,i.text);break}case"tool_call":{let i={sessionId:t,toolCallId:s.toolCallId,kind:s.kind||"",title:s.title||"",status:s.status||"pending",rawInput:s.rawInput};this.emit("toolCall",i);break}case"available_commands_update":{Array.isArray(s.availableCommands)&&(this._availableCommands=s.availableCommands);break}default:break}this.emit("sessionUpdate",e)}ensureConnection(){if(!this.connection||!this.isConnected)throw new Error("Not connected to ACP agent");return this.connection}};d();export{O as a,q as b,I as c,x as d,A as e};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{
|
|
3
|
+
import{k as i,o as c}from"./chunk-SR7ARGUY.js";import{e as l}from"./chunk-2ONZZ46N.js";import{b as g}from"./chunk-GZPNIYVZ.js";g();import{readFile as y}from"node:fs/promises";function S(t){return t?`side-query:${t}`:"side-query"}function T(t,e){return e??t.getFastModel?.()??t.getModel()??c}function x(t){let e=t?.thinkingConfig;return{...t??{},thinkingConfig:e?{includeThoughts:!1,...e}:{includeThoughts:!1}}}async function h(t){let e=t.getOutputLanguageFilePath?.();if(e)try{let n=(await y(e,"utf8")).trim();return n?["Follow the user-visible output language preference below for this side query.",n].join(`
|
|
4
4
|
|
|
5
5
|
`):void 0}catch{return}}function C(t,e){return e?t===void 0?e:typeof t=="string"?`${t}
|
|
6
6
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{l as f,m as h,n as T,o as w,p as x,q as s}from"./chunk-QKYGQLWC.js";import{c as g}from"./chunk-R34HYLL4.js";import{Q as c,b as p}from"./chunk-62AFAL4I.js";import{b as o}from"./chunk-GZPNIYVZ.js";o();function y(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}o();import*as n from"node:fs/promises";import*as a from"node:path";function M(){return a.join(c.getGlobalMatildaDir(),h)}function d(e){return a.join(M(),e)}function l(e){return a.join(d(e),w)}function I(e){return a.join(d(e),x)}function E(e){return a.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 i=new Set(t.map(u=>u.name));if(i.has(r)){let u=[...i].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){return e.map(t=>{let{color:r,...i}=t;return i})}function $(e,t,r){return e.map(i=>i.agentId===t?{...i,isActive:r}:i)}function k(e,t){return e.find(r=>r.agentId===t)}function z(e,t){let r=m(t);return e.find(i=>i.name===r)}function L(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 J(e,t){let r=l(e);await n.mkdir(a.dirname(r),{recursive:!0}),await g(r,t)}async function B(e,t){let r=l(e);await n.mkdir(a.dirname(r),{recursive:!0}),await n.writeFile(r,JSON.stringify(t,null,2)+`
|
|
4
|
+
`,{encoding:"utf-8",flag:"wx"})}async function G(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})])}async function q(){let e=M();try{return(await n.readdir(e,{withFileTypes:!0})).filter(r=>r.isDirectory()).map(r=>r.name)}catch{return[]}}export{y as a,M as b,d as c,l as d,I as e,E as f,m as g,j as h,R as i,C as j,O as k,$ as l,k as m,z as n,L as o,P as p,J as q,B as r,G as s,b as t,q as u};
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Matilda
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright 2025 Matilda
|
|
13
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
*/
|