@maincode-ai/matilda-code 0.21.12 → 0.21.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/bundled/mainy/docs/configuration/model-providers.md +0 -82
  2. package/bundled/mainy/docs/configuration/settings.md +30 -2
  3. package/bundled/mainy/docs/features/auto-mode.md +1 -1
  4. package/bundled/mainy/docs/features/channels/_meta.ts +0 -3
  5. package/bundled/mainy/docs/features/channels/overview.md +8 -16
  6. package/bundled/mainy/docs/features/commands.md +4 -4
  7. package/bundled/mainy/docs/features/hooks.md +9 -7
  8. package/bundled/mainy/docs/features/language.md +2 -29
  9. package/bundled/mainy/docs/features/worktree.md +0 -2
  10. package/bundled/mainy/docs/integration-github-action.md +3 -3
  11. package/bundled/mainy/docs/quickstart.md +2 -2
  12. package/bundled/mainy/docs/support/troubleshooting.md +1 -1
  13. package/chunks/agent-SRAIVZEE.js +3 -0
  14. package/chunks/agent-headless-XRDOZESG.js +3 -0
  15. package/chunks/{anthropicContentGenerator-VKFTAIU3.js → anthropicContentGenerator-LLDIKDMQ.js} +3 -3
  16. package/chunks/{askUserQuestion-2QI4NSFJ.js → askUserQuestion-BNSWGD26.js} +1 -1
  17. package/chunks/{ca-I2HEEIL7.js → ca-NPYL24ME.js} +2 -2
  18. package/chunks/{chunk-YJAKOETP.js → chunk-27HUYW23.js} +2 -2
  19. package/chunks/{chunk-EQGA7LH7.js → chunk-3B2HABK7.js} +1 -1
  20. package/chunks/{chunk-CSJTA7NE.js → chunk-3MTZTNAU.js} +18 -18
  21. package/chunks/{chunk-YRQP3SLC.js → chunk-5OHGYMKP.js} +1 -1
  22. package/chunks/chunk-6I6VGTKD.js +8 -0
  23. package/chunks/{chunk-MCQUPLRE.js → chunk-6M5G5FBH.js} +1 -1
  24. package/chunks/chunk-7ZODGQO6.js +4 -0
  25. package/chunks/chunk-AOOZREGV.js +9 -0
  26. package/chunks/chunk-DHDD5YJC.js +207 -0
  27. package/chunks/{chunk-WV3IUPZS.js → chunk-EZDV7A76.js} +1 -1
  28. package/chunks/{chunk-QVCGLQCI.js → chunk-IJEGHQ7Z.js} +3 -3
  29. package/chunks/{chunk-5C2RJ5RR.js → chunk-LWARA7JY.js} +1 -1
  30. package/chunks/{chunk-VTGICC67.js → chunk-MEV5XQI2.js} +1 -1
  31. package/chunks/{chunk-DOOFGSRV.js → chunk-P5TG5CON.js} +1 -1
  32. package/chunks/{chunk-JRECUFB3.js → chunk-PEKAUGYV.js} +552 -561
  33. package/chunks/chunk-PGUG43HG.js +24 -0
  34. package/chunks/{chunk-CZGZ3KK7.js → chunk-QZI2ZGZY.js} +1 -1
  35. package/chunks/chunk-RI54U73U.js +56 -0
  36. package/chunks/chunk-RPFSFS7Z.js +39 -0
  37. package/chunks/chunk-SOEIVSM5.js +113 -0
  38. package/chunks/{chunk-4J6DC24J.js → chunk-SVSY6AWS.js} +1 -1
  39. package/chunks/{chunk-6E766NPX.js → chunk-TWJLOEAI.js} +1 -1
  40. package/chunks/{chunk-HYVP4472.js → chunk-V6UPUMP3.js} +1 -1
  41. package/chunks/chunk-W4QSMIWO.js +9 -0
  42. package/chunks/chunk-ZX34M2GF.js +14 -0
  43. package/chunks/{computer-use-WKDNUTLD.js → computer-use-J4GAM4M6.js} +1 -1
  44. package/chunks/contextCommand-5F5M7NA4.js +3 -0
  45. package/chunks/{cron-create-F2LXM2OA.js → cron-create-IDWSZENI.js} +1 -1
  46. package/chunks/{cron-delete-DE6Q2S2L.js → cron-delete-NQCDZDUI.js} +1 -1
  47. package/chunks/{cron-list-IAQEJVV7.js → cron-list-Z4XMC3TO.js} +1 -1
  48. package/chunks/{de-AQXFJYZI.js → de-34YZHGC6.js} +2 -2
  49. package/chunks/{devtools-5JRKK3E7.js → devtools-XRQ4YJ5S.js} +1 -1
  50. package/chunks/{dist-P6SLWL5V.js → dist-PH6JW7XD.js} +1 -1
  51. package/chunks/{edit-QQNJZ55P.js → edit-X2S2ZXRN.js} +1 -1
  52. package/chunks/{en-EJLDYIBM.js → en-QLGMD6OS.js} +3 -3
  53. package/chunks/{enter-worktree-5X5SAMBJ.js → enter-worktree-TUCGNCLO.js} +1 -1
  54. package/chunks/{enterPlanMode-HP35SPLN.js → enterPlanMode-SQEZAAIR.js} +1 -1
  55. package/chunks/{exit-worktree-SRKZBEYF.js → exit-worktree-7FLITFZI.js} +1 -1
  56. package/chunks/{exitPlanMode-WSPTGGVN.js → exitPlanMode-O5UUJ3GM.js} +1 -1
  57. package/chunks/{fr-6TDHK7F2.js → fr-EDNBQACJ.js} +3 -3
  58. package/chunks/geminiContentGenerator-FIZFLPU3.js +8 -0
  59. package/chunks/glob-GSFTYAS2.js +22 -0
  60. package/chunks/{goal-tools-C6BSBHCF.js → goal-tools-YQOA6OKU.js} +1 -1
  61. package/chunks/{grep-MVCOBUYW.js → grep-VAB2VSXM.js} +1 -1
  62. package/chunks/{ja-GGNJR7AR.js → ja-LV4RLM3M.js} +2 -2
  63. package/chunks/{ls-JYJXFSXN.js → ls-IZJ3CKZY.js} +1 -1
  64. package/chunks/{lsp-DYDK6XCS.js → lsp-NGLDRHZU.js} +1 -1
  65. package/chunks/matildaAgentContentGenerator-QQHPCFJ5.js +8 -0
  66. package/chunks/matildaContentGenerator-W7Z33ONU.js +8 -0
  67. package/chunks/mcp-client-DXUNIEIB.js +3 -0
  68. package/chunks/monitor-4PFIGAGG.js +32 -0
  69. package/chunks/notebook-edit-MWJYAATJ.js +17 -0
  70. package/chunks/{openaiContentGenerator-2EALAM3U.js → openaiContentGenerator-NDVJL6QL.js} +1 -1
  71. package/chunks/{pt-D6L2QTDM.js → pt-5SQ4DGL7.js} +2 -2
  72. package/chunks/read-file-WPZKPXWA.js +3 -0
  73. package/chunks/ripGrep-7LZDZFTX.js +3 -0
  74. package/chunks/{ru-BNJCHDYO.js → ru-7K24S53N.js} +2 -2
  75. package/chunks/scheduler-DK2MVKXX.js +8 -0
  76. package/chunks/{send-message-P3SMWNEE.js → send-message-TCPX5UDU.js} +1 -1
  77. package/chunks/{serve-FXH6EBQ6.js → serve-GSZPJI2O.js} +59 -48
  78. package/chunks/shell-PRS47PDP.js +3 -0
  79. package/chunks/{skill-HZPFEAPF.js → skill-ETQM5NI3.js} +1 -1
  80. package/chunks/src-UB7DZRYK.js +3 -0
  81. package/chunks/{symbol-search-EAIZPWN7.js → symbol-search-HARHZ5AH.js} +1 -1
  82. package/chunks/{syntheticOutput-432LXITX.js → syntheticOutput-WZDPECYS.js} +1 -1
  83. package/chunks/task-create-XRNIDT4T.js +3 -0
  84. package/chunks/{task-detach-XMSJ3HBM.js → task-detach-TBAVUOTC.js} +1 -1
  85. package/chunks/task-list-Z6BDZZID.js +9 -0
  86. package/chunks/{task-stop-NTS62FLG.js → task-stop-HDSARSJ6.js} +1 -1
  87. package/chunks/{task-update-AR26UFYZ.js → task-update-MW2VT2XV.js} +1 -1
  88. package/chunks/{team-create-PYXFVIR5.js → team-create-VMYNLZCC.js} +1 -1
  89. package/chunks/team-delete-F7QDC2TE.js +8 -0
  90. package/chunks/{todoWrite-5NZ7CHTC.js → todoWrite-SCF5M24M.js} +1 -1
  91. package/chunks/{tool-search-RKZDSRYS.js → tool-search-WX6FOE35.js} +1 -1
  92. package/chunks/{web-fetch-VW3SVDQ6.js → web-fetch-CKYBHGLF.js} +1 -1
  93. package/chunks/{web-search-XQUIZARL.js → web-search-67DFNS5V.js} +1 -1
  94. package/chunks/{workflow-YXNXDRWZ.js → workflow-WBSRQG3N.js} +2 -2
  95. package/chunks/write-file-S5FAX4JJ.js +15 -0
  96. package/cli.js +436 -439
  97. package/locales/ca.js +0 -3
  98. package/locales/de.js +0 -3
  99. package/locales/en.js +0 -3
  100. package/locales/fr.js +0 -3
  101. package/locales/ja.js +0 -3
  102. package/locales/pt.js +0 -3
  103. package/locales/ru.js +0 -3
  104. package/package.json +2 -2
  105. package/sandbox-macos-permissive-closed.sb +0 -1
  106. package/sandbox-macos-permissive-open.sb +0 -1
  107. package/sandbox-macos-permissive-proxied.sb +0 -1
  108. package/sandbox-macos-restrictive-closed.sb +0 -1
  109. package/sandbox-macos-restrictive-open.sb +0 -1
  110. package/sandbox-macos-restrictive-proxied.sb +0 -1
  111. package/bundled/mainy/docs/features/channels/dingtalk.md +0 -134
  112. package/bundled/mainy/docs/features/channels/feishu.md +0 -186
  113. package/bundled/mainy/docs/features/channels/weixin.md +0 -106
  114. package/chunks/agent-WM63A6NK.js +0 -3
  115. package/chunks/agent-headless-QIUBDKPW.js +0 -3
  116. package/chunks/chunk-2MOGYHWM.js +0 -8
  117. package/chunks/chunk-3IRGBRSP.js +0 -113
  118. package/chunks/chunk-6GBNB5Z2.js +0 -3
  119. package/chunks/chunk-6Z2MV7ZY.js +0 -186
  120. package/chunks/chunk-BVOCFLC4.js +0 -56
  121. package/chunks/chunk-FPO57O66.js +0 -39
  122. package/chunks/chunk-LJR4RZZ2.js +0 -3
  123. package/chunks/chunk-MO2HXJG5.js +0 -9
  124. package/chunks/chunk-PA6532AY.js +0 -6
  125. package/chunks/chunk-S3CWEVTS.js +0 -15
  126. package/chunks/chunk-U347OO7S.js +0 -9
  127. package/chunks/chunk-UIRBHC5X.js +0 -3
  128. package/chunks/chunk-WVY2P6WH.js +0 -26
  129. package/chunks/chunk-WZ75OGYY.js +0 -14
  130. package/chunks/chunk-XMZIY7XX.js +0 -13
  131. package/chunks/contextCommand-DAB3HOHY.js +0 -3
  132. package/chunks/dist-ME6647DQ.js +0 -195
  133. package/chunks/dist-VG3ZDJ2A.js +0 -28
  134. package/chunks/dist-YTCHM57U.js +0 -23
  135. package/chunks/geminiContentGenerator-RJ73DQAP.js +0 -8
  136. package/chunks/glob-QQ6LGKDX.js +0 -22
  137. package/chunks/matildaAgentContentGenerator-YUYS4336.js +0 -8
  138. package/chunks/matildaContentGenerator-O4Z2QPCP.js +0 -8
  139. package/chunks/mcp-client-RXVQU5VI.js +0 -3
  140. package/chunks/monitor-77KXDXPR.js +0 -32
  141. package/chunks/notebook-edit-TKJD2EQZ.js +0 -17
  142. package/chunks/read-file-3KUAH6ND.js +0 -3
  143. package/chunks/ripGrep-U2PLKXMY.js +0 -3
  144. package/chunks/scheduler-J7VU2V5Y.js +0 -8
  145. package/chunks/shell-PXR2AXDD.js +0 -3
  146. package/chunks/src-RFAEPLY7.js +0 -3
  147. package/chunks/task-create-Z3QRCMX4.js +0 -3
  148. package/chunks/task-list-GXAJW3JP.js +0 -9
  149. package/chunks/team-delete-OMYVUAQU.js +0 -8
  150. package/chunks/write-file-XDDLTGSG.js +0 -15
@@ -1,10 +1,10 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{Yh as T}from"./chunk-JRECUFB3.js";import{Q as b}from"./chunk-27Q5KW3A.js";import{b as o}from"./chunk-GZPNIYVZ.js";import{b as w}from"./chunk-OWGSC52X.js";o();var B=e=>{process.stdout.write(e.endsWith(`
3
+ import{Qh as T}from"./chunk-PEKAUGYV.js";import{Q as b}from"./chunk-27Q5KW3A.js";import{b as o}from"./chunk-GZPNIYVZ.js";import{b as w}from"./chunk-OWGSC52X.js";o();var B=e=>{process.stdout.write(e.endsWith(`
4
4
  `)?e:`${e}
5
5
  `)},m=e=>{process.stderr.write(e.endsWith(`
6
6
  `)?e:`${e}
7
- `)},W=()=>{console.clear()};o();import*as u from"node:fs";import*as f from"node:path";import{pathToFileURL as N}from"node:url";o();var p=[{code:"en",id:"en-AU",fullName:"Australian English",nativeName:"English (AU)"},{code:"ru",id:"ru-RU",fullName:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"de",id:"de-DE",fullName:"German",nativeName:"Deutsch"},{code:"ja",id:"ja-JP",fullName:"Japanese",nativeName:"\u65E5\u672C\u8A9E"},{code:"pt",id:"pt-BR",fullName:"Portuguese",nativeName:"Portugu\xEAs"},{code:"fr",id:"fr-FR",fullName:"French",nativeName:"Fran\xE7ais"},{code:"ca",id:"ca-ES",fullName:"Catalan",nativeName:"Catal\xE0"}];function A(e){return e.trim().replace(/_/g,"-").toLowerCase()}var M=new Set(["zh","zh-cn","zh-hans","zh-sg","zh-tw","zh-hk","zh-mo","zh-hant","chinese","traditional chinese","simplified chinese","\u4E2D\u6587","\u7B80\u4F53\u4E2D\u6587","\u7E41\u9AD4\u4E2D\u6587","\u7E41\u4F53\u4E2D\u6587"]);function E(e){let t=A(e);return t?M.has(t)?!0:t.startsWith("zh-")||t.startsWith("zh.")||t.startsWith("zh@"):!1}function k(e,t){return e===t||e.startsWith(`${t}-`)||e.startsWith(`${t}.`)||e.startsWith(`${t}@`)}function z(e,t){let n=t.code.toLowerCase(),r=t.id.toLowerCase();if(k(e,r))return r.length;if(k(e,n))return n.length}function l(e){let t=A(e);if(!t)return;if(t==="english"||t==="australian"||t==="australian-english")return"en";let n;for(let r of p){if(t===r.fullName.toLowerCase()||r.nativeName&&t===r.nativeName.toLowerCase())return r.code;let a=z(t,r);a!==void 0&&(!n||a>n.tokenLength)&&(n={code:r.code,tokenLength:a})}return n?.code}function C(e){let t=l(e);return(t?p.find(r=>r.code===t):void 0)?.fullName||"English"}function q(){return[{value:"auto",label:"Auto (detect from system)"},...p.map(e=>({value:e.code,label:e.nativeName?`${e.nativeName} (${e.fullName})`:`${e.fullName} (${e.id})`}))]}o();function h(e){return Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}o();var I=w({"./locales/ca.js":()=>import("./ca-I2HEEIL7.js"),"./locales/de.js":()=>import("./de-AQXFJYZI.js"),"./locales/en.js":()=>import("./en-EJLDYIBM.js"),"./locales/fr.js":()=>import("./fr-6TDHK7F2.js"),"./locales/ja.js":()=>import("./ja-GGNJR7AR.js"),"./locales/pt.js":()=>import("./pt-D6L2QTDM.js"),"./locales/ru.js":()=>import("./ru-BNJCHDYO.js")});var y="en",v={},i={},S={},R=()=>f.join(T(import.meta.url),"locales"),U=()=>f.join(b.getGlobalMatildaDir(),"locales");var D=(e,t=!1)=>{let n=t?U():R();return f.join(n,`${e}.js`)};function O(){let e=process.env.MATILDA_CODE_LANG||process.env.LANG;if(e){let t=l(e);if(t)return t}try{let t=Intl.DateTimeFormat().resolvedOptions().locale,n=l(t);if(n)return n}catch{}return"en"}async function P(e){try{let t=await import(e),n=h(t);return L(n)?{translations:n}:{error:new Error("Module loaded but result is empty or invalid")}}catch(t){return{error:t instanceof Error?t:new Error(String(t))}}}async function $(e){try{let t=await I(`./locales/${e}.js`),n=h(t);return L(n)?{translations:n}:{error:new Error("Module loaded but result is empty or invalid")}}catch(t){return{error:t instanceof Error?t:new Error(String(t))}}}async function j(e){if(i[e])return i[e];let t=S[e];if(t)return t;let n=(async()=>{let r=D(e,!0);if(u.existsSync(U())&&u.existsSync(r)){let s=await P(N(r).href);if(s.translations)return i[e]=s.translations,s.translations;m(`Failed to load translations from user directory for ${e}: ${s.error.message}`)}let a=D(e,!1),x=[];u.existsSync(R())&&u.existsSync(a)&&x.push(N(a).href);let c;for(let s of x){let g=await P(s);if(g.translations)return i[e]=g.translations,g.translations;c=g.error}let d=await $(e);return d.translations?(i[e]=d.translations,d.translations):(c=d.error,c&&m(`Failed to load JS translations for ${e}: ${c.message}`),i[e]={},{})})();return S[e]=n,n.finally(()=>{delete S[e]}),n}function _(e,t){return t?e.replace(/\{\{(\w+)\}\}/g,(n,r)=>t[r]??n):e}function F(e){return e==="auto"?O():E(e)?"en":l(e)??e}async function G(e){y=F(e),v=await j(y)}function le(){return y}function ue(e,t){let n=v[e]??e;return Array.isArray(n)?e:_(n,t)}function ce(e){let t=v[e];return Array.isArray(t)?t:[]}async function de(e){await G(e??"auto")}export{B as a,m as b,W as c,p as d,E as e,l as f,C as g,q as h,O as i,G as j,le as k,ue as l,ce as m,de as n};
7
+ `)},W=()=>{console.clear()};o();import*as u from"node:fs";import*as f from"node:path";import{pathToFileURL as N}from"node:url";o();var p=[{code:"en",id:"en-AU",fullName:"Australian English",nativeName:"English (AU)"},{code:"ru",id:"ru-RU",fullName:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"de",id:"de-DE",fullName:"German",nativeName:"Deutsch"},{code:"ja",id:"ja-JP",fullName:"Japanese",nativeName:"\u65E5\u672C\u8A9E"},{code:"pt",id:"pt-BR",fullName:"Portuguese",nativeName:"Portugu\xEAs"},{code:"fr",id:"fr-FR",fullName:"French",nativeName:"Fran\xE7ais"},{code:"ca",id:"ca-ES",fullName:"Catalan",nativeName:"Catal\xE0"}];function A(e){return e.trim().replace(/_/g,"-").toLowerCase()}var M=new Set(["zh","zh-cn","zh-hans","zh-sg","zh-tw","zh-hk","zh-mo","zh-hant","chinese","traditional chinese","simplified chinese","\u4E2D\u6587","\u7B80\u4F53\u4E2D\u6587","\u7E41\u9AD4\u4E2D\u6587","\u7E41\u4F53\u4E2D\u6587"]);function E(e){let t=A(e);return t?M.has(t)?!0:t.startsWith("zh-")||t.startsWith("zh.")||t.startsWith("zh@"):!1}function k(e,t){return e===t||e.startsWith(`${t}-`)||e.startsWith(`${t}.`)||e.startsWith(`${t}@`)}function z(e,t){let n=t.code.toLowerCase(),r=t.id.toLowerCase();if(k(e,r))return r.length;if(k(e,n))return n.length}function l(e){let t=A(e);if(!t)return;if(t==="english"||t==="australian"||t==="australian-english")return"en";let n;for(let r of p){if(t===r.fullName.toLowerCase()||r.nativeName&&t===r.nativeName.toLowerCase())return r.code;let a=z(t,r);a!==void 0&&(!n||a>n.tokenLength)&&(n={code:r.code,tokenLength:a})}return n?.code}function C(e){let t=l(e);return(t?p.find(r=>r.code===t):void 0)?.fullName||"English"}function q(){return[{value:"auto",label:"Auto (detect from system)"},...p.map(e=>({value:e.code,label:e.nativeName?`${e.nativeName} (${e.fullName})`:`${e.fullName} (${e.id})`}))]}o();function h(e){return Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}o();var I=w({"./locales/ca.js":()=>import("./ca-NPYL24ME.js"),"./locales/de.js":()=>import("./de-34YZHGC6.js"),"./locales/en.js":()=>import("./en-QLGMD6OS.js"),"./locales/fr.js":()=>import("./fr-EDNBQACJ.js"),"./locales/ja.js":()=>import("./ja-LV4RLM3M.js"),"./locales/pt.js":()=>import("./pt-5SQ4DGL7.js"),"./locales/ru.js":()=>import("./ru-7K24S53N.js")});var y="en",v={},i={},S={},R=()=>f.join(T(import.meta.url),"locales"),U=()=>f.join(b.getGlobalMatildaDir(),"locales");var D=(e,t=!1)=>{let n=t?U():R();return f.join(n,`${e}.js`)};function O(){let e=process.env.MATILDA_CODE_LANG||process.env.LANG;if(e){let t=l(e);if(t)return t}try{let t=Intl.DateTimeFormat().resolvedOptions().locale,n=l(t);if(n)return n}catch{}return"en"}async function P(e){try{let t=await import(e),n=h(t);return L(n)?{translations:n}:{error:new Error("Module loaded but result is empty or invalid")}}catch(t){return{error:t instanceof Error?t:new Error(String(t))}}}async function $(e){try{let t=await I(`./locales/${e}.js`),n=h(t);return L(n)?{translations:n}:{error:new Error("Module loaded but result is empty or invalid")}}catch(t){return{error:t instanceof Error?t:new Error(String(t))}}}async function j(e){if(i[e])return i[e];let t=S[e];if(t)return t;let n=(async()=>{let r=D(e,!0);if(u.existsSync(U())&&u.existsSync(r)){let s=await P(N(r).href);if(s.translations)return i[e]=s.translations,s.translations;m(`Failed to load translations from user directory for ${e}: ${s.error.message}`)}let a=D(e,!1),x=[];u.existsSync(R())&&u.existsSync(a)&&x.push(N(a).href);let c;for(let s of x){let g=await P(s);if(g.translations)return i[e]=g.translations,g.translations;c=g.error}let d=await $(e);return d.translations?(i[e]=d.translations,d.translations):(c=d.error,c&&m(`Failed to load JS translations for ${e}: ${c.message}`),i[e]={},{})})();return S[e]=n,n.finally(()=>{delete S[e]}),n}function _(e,t){return t?e.replace(/\{\{(\w+)\}\}/g,(n,r)=>t[r]??n):e}function F(e){return e==="auto"?O():E(e)?"en":l(e)??e}async function G(e){y=F(e),v=await j(y)}function le(){return y}function ue(e,t){let n=v[e]??e;return Array.isArray(n)?e:_(n,t)}function ce(e){let t=v[e];return Array.isArray(t)?t:[]}async function de(e){await G(e??"auto")}export{B as a,m as b,W as c,p as d,E as e,l as f,C as g,q as h,O as i,G as j,le as k,ue as l,ce as m,de as n};
8
8
  /**
9
9
  * @license
10
10
  * Copyright 2025 Matilda Team
@@ -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,M as b,q as c,I as d,x as e,A as f};
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};