@maincode-ai/matilda-code 0.21.11 → 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 (174) hide show
  1. package/bundled/mainy/docs/configuration/model-providers.md +0 -82
  2. package/bundled/mainy/docs/configuration/settings.md +46 -7
  3. package/bundled/mainy/docs/configuration/trusted-folders.md +12 -6
  4. package/bundled/mainy/docs/features/auto-mode.md +1 -1
  5. package/bundled/mainy/docs/features/channels/_meta.ts +0 -3
  6. package/bundled/mainy/docs/features/channels/overview.md +8 -16
  7. package/bundled/mainy/docs/features/commands.md +4 -4
  8. package/bundled/mainy/docs/features/hooks.md +9 -7
  9. package/bundled/mainy/docs/features/language.md +2 -29
  10. package/bundled/mainy/docs/features/worktree.md +0 -2
  11. package/bundled/mainy/docs/integration-github-action.md +3 -3
  12. package/bundled/mainy/docs/quickstart.md +2 -2
  13. package/bundled/mainy/docs/support/troubleshooting.md +1 -1
  14. package/chunks/agent-SRAIVZEE.js +3 -0
  15. package/chunks/agent-headless-XRDOZESG.js +3 -0
  16. package/chunks/{anthropicContentGenerator-IYZILRDW.js → anthropicContentGenerator-LLDIKDMQ.js} +3 -3
  17. package/chunks/{askUserQuestion-XWHJY3DM.js → askUserQuestion-BNSWGD26.js} +1 -1
  18. package/chunks/{ca-EUJBUYX5.js → ca-NPYL24ME.js} +2 -2
  19. package/chunks/{chunk-4YVN5HXG.js → chunk-27HUYW23.js} +2 -2
  20. package/chunks/{chunk-MH2P4YXC.js → chunk-27Q5KW3A.js} +2 -2
  21. package/chunks/{chunk-NYEWHSBL.js → chunk-2HTPVSGT.js} +1 -1
  22. package/chunks/{chunk-EQGA7LH7.js → chunk-3B2HABK7.js} +1 -1
  23. package/chunks/chunk-3MTZTNAU.js +101 -0
  24. package/chunks/{chunk-WHG6N5X2.js → chunk-5OHGYMKP.js} +1 -1
  25. package/chunks/{chunk-QH7736R5.js → chunk-6EQMZNIY.js} +1 -1
  26. package/chunks/chunk-6I6VGTKD.js +8 -0
  27. package/chunks/{chunk-5427BPR2.js → chunk-6M5G5FBH.js} +1 -1
  28. package/chunks/{chunk-4FVBPNTZ.js → chunk-6T2GIM76.js} +1 -1
  29. package/chunks/chunk-7ZODGQO6.js +4 -0
  30. package/chunks/chunk-AOOZREGV.js +9 -0
  31. package/chunks/{chunk-JXUDKX6D.js → chunk-DE3HKC2W.js} +1 -1
  32. package/chunks/chunk-DHDD5YJC.js +207 -0
  33. package/chunks/{chunk-SPW5DXX4.js → chunk-EZDV7A76.js} +1 -1
  34. package/chunks/{chunk-ODZOYHIC.js → chunk-GOJCMVJJ.js} +1 -1
  35. package/chunks/{chunk-FFFZ2QMG.js → chunk-GTVCJCHR.js} +1 -1
  36. package/chunks/{chunk-Q55AVE2N.js → chunk-IJEGHQ7Z.js} +11 -11
  37. package/chunks/{chunk-SUH3UUWZ.js → chunk-JCE3JAVC.js} +1 -1
  38. package/chunks/chunk-KHHJYBR5.js +9 -0
  39. package/chunks/{chunk-GO2GA2GY.js → chunk-LUNDTQ3G.js} +1 -1
  40. package/chunks/{chunk-NIQK6NX3.js → chunk-LWARA7JY.js} +1 -1
  41. package/chunks/{chunk-YMIF2DMT.js → chunk-MEV5XQI2.js} +1 -1
  42. package/chunks/{chunk-4CSSDBOS.js → chunk-P5TG5CON.js} +10 -10
  43. package/chunks/chunk-PEKAUGYV.js +2621 -0
  44. package/chunks/chunk-PGUG43HG.js +24 -0
  45. package/chunks/{chunk-ELH4YHJR.js → chunk-PGXQZVLX.js} +1 -1
  46. package/chunks/{chunk-SNLH42QJ.js → chunk-QZI2ZGZY.js} +1 -1
  47. package/chunks/chunk-RI54U73U.js +56 -0
  48. package/chunks/chunk-RPFSFS7Z.js +39 -0
  49. package/chunks/chunk-SOEIVSM5.js +113 -0
  50. package/chunks/{chunk-4J6DC24J.js → chunk-SVSY6AWS.js} +1 -1
  51. package/chunks/{chunk-T4P4KEDW.js → chunk-TWJLOEAI.js} +2 -2
  52. package/chunks/{chunk-HYVP4472.js → chunk-V6UPUMP3.js} +1 -1
  53. package/chunks/chunk-W4QSMIWO.js +9 -0
  54. package/chunks/chunk-WC2VTVCE.js +27 -0
  55. package/chunks/{chunk-GUFIMKF5.js → chunk-YV3PUOBU.js} +1 -1
  56. package/chunks/chunk-ZX34M2GF.js +14 -0
  57. package/chunks/{computer-use-SXP25RZQ.js → computer-use-J4GAM4M6.js} +1 -1
  58. package/chunks/contextCommand-5F5M7NA4.js +3 -0
  59. package/chunks/{cron-create-2UI4AT4Q.js → cron-create-IDWSZENI.js} +1 -1
  60. package/chunks/{cron-delete-ZB6BOTFF.js → cron-delete-NQCDZDUI.js} +1 -1
  61. package/chunks/{cron-list-YYAXNHB6.js → cron-list-Z4XMC3TO.js} +1 -1
  62. package/chunks/{de-DNEPG7S7.js → de-34YZHGC6.js} +3 -3
  63. package/chunks/{devtools-5JRKK3E7.js → devtools-XRQ4YJ5S.js} +1 -1
  64. package/chunks/{dist-P6SLWL5V.js → dist-PH6JW7XD.js} +1 -1
  65. package/chunks/edit-X2S2ZXRN.js +43 -0
  66. package/chunks/{en-NOD6KQNM.js → en-QLGMD6OS.js} +3 -3
  67. package/chunks/{enter-worktree-X47BSJLE.js → enter-worktree-TUCGNCLO.js} +1 -1
  68. package/chunks/{enterPlanMode-F22ZNTYJ.js → enterPlanMode-SQEZAAIR.js} +1 -1
  69. package/chunks/{exit-worktree-XY5UMDHX.js → exit-worktree-7FLITFZI.js} +1 -1
  70. package/chunks/exitPlanMode-O5UUJ3GM.js +120 -0
  71. package/chunks/{fr-2OE5WLJ4.js → fr-EDNBQACJ.js} +3 -3
  72. package/chunks/geminiContentGenerator-FIZFLPU3.js +8 -0
  73. package/chunks/glob-GSFTYAS2.js +22 -0
  74. package/chunks/{goal-tools-6QTC3UI7.js → goal-tools-YQOA6OKU.js} +1 -1
  75. package/chunks/{grep-6TTPZ524.js → grep-VAB2VSXM.js} +1 -1
  76. package/chunks/{ja-3B6V5KS7.js → ja-LV4RLM3M.js} +3 -3
  77. package/chunks/{keychain-token-storage-54BNK6VH.js → keychain-token-storage-KQK6MNOJ.js} +1 -1
  78. package/chunks/{ls-YWZU3FYL.js → ls-IZJ3CKZY.js} +1 -1
  79. package/chunks/{lsp-4CJDKEEC.js → lsp-NGLDRHZU.js} +1 -1
  80. package/chunks/matildaAgentContentGenerator-QQHPCFJ5.js +8 -0
  81. package/chunks/matildaContentGenerator-W7Z33ONU.js +8 -0
  82. package/chunks/{matildaOAuth2-WOY7ZS43.js → matildaOAuth2-7COTQQR2.js} +1 -1
  83. package/chunks/mcp-client-DXUNIEIB.js +3 -0
  84. package/chunks/monitor-4PFIGAGG.js +32 -0
  85. package/chunks/notebook-edit-MWJYAATJ.js +17 -0
  86. package/chunks/{openaiContentGenerator-MGASUFQL.js → openaiContentGenerator-NDVJL6QL.js} +1 -1
  87. package/chunks/{pt-KP2JCPUY.js → pt-5SQ4DGL7.js} +3 -3
  88. package/chunks/read-file-WPZKPXWA.js +3 -0
  89. package/chunks/ripGrep-7LZDZFTX.js +3 -0
  90. package/chunks/{ru-K7IQQKHC.js → ru-7K24S53N.js} +3 -3
  91. package/chunks/scheduler-DK2MVKXX.js +8 -0
  92. package/chunks/{send-message-OO2HAKCC.js → send-message-TCPX5UDU.js} +1 -1
  93. package/chunks/{serve-ZQX2WBLF.js → serve-GSZPJI2O.js} +59 -48
  94. package/chunks/shell-PRS47PDP.js +3 -0
  95. package/chunks/{skill-KDM3UUML.js → skill-ETQM5NI3.js} +1 -1
  96. package/chunks/src-UB7DZRYK.js +3 -0
  97. package/chunks/{symbol-search-ALYOX5JN.js → symbol-search-HARHZ5AH.js} +1 -1
  98. package/chunks/{syntheticOutput-UASKABJH.js → syntheticOutput-WZDPECYS.js} +1 -1
  99. package/chunks/task-create-XRNIDT4T.js +3 -0
  100. package/chunks/{task-detach-I67ZE5MX.js → task-detach-TBAVUOTC.js} +1 -1
  101. package/chunks/task-list-Z6BDZZID.js +9 -0
  102. package/chunks/{task-stop-ERI5X4AO.js → task-stop-HDSARSJ6.js} +1 -1
  103. package/chunks/{task-update-CD3W556L.js → task-update-MW2VT2XV.js} +1 -1
  104. package/chunks/{team-create-F4KQRGMB.js → team-create-VMYNLZCC.js} +1 -1
  105. package/chunks/team-delete-F7QDC2TE.js +8 -0
  106. package/chunks/todoWrite-SCF5M24M.js +3 -0
  107. package/chunks/{tool-search-JFCD5W5M.js → tool-search-WX6FOE35.js} +1 -1
  108. package/chunks/tree-sitter-bash-2SWKO5B7.js +3 -0
  109. package/chunks/{web-fetch-REWGIRWQ.js → web-fetch-CKYBHGLF.js} +13 -13
  110. package/chunks/{web-search-OX2DPEVN.js → web-search-67DFNS5V.js} +1 -1
  111. package/chunks/{workflow-SEFYGBED.js → workflow-WBSRQG3N.js} +2 -2
  112. package/chunks/write-file-S5FAX4JJ.js +15 -0
  113. package/cli.js +462 -455
  114. package/locales/ca.js +1 -3
  115. package/locales/de.js +1 -3
  116. package/locales/en.js +1 -3
  117. package/locales/fr.js +1 -3
  118. package/locales/ja.js +1 -3
  119. package/locales/pt.js +1 -3
  120. package/locales/ru.js +1 -3
  121. package/package.json +2 -2
  122. package/sandbox-macos-permissive-closed.sb +0 -1
  123. package/sandbox-macos-permissive-open.sb +0 -1
  124. package/sandbox-macos-permissive-proxied.sb +0 -1
  125. package/sandbox-macos-restrictive-closed.sb +3 -1
  126. package/sandbox-macos-restrictive-open.sb +3 -1
  127. package/sandbox-macos-restrictive-proxied.sb +3 -1
  128. package/bundled/mainy/docs/features/channels/dingtalk.md +0 -134
  129. package/bundled/mainy/docs/features/channels/feishu.md +0 -186
  130. package/bundled/mainy/docs/features/channels/weixin.md +0 -106
  131. package/chunks/agent-ZFZ4HJQC.js +0 -3
  132. package/chunks/agent-headless-KH2BKLP7.js +0 -3
  133. package/chunks/chunk-25NCTG5H.js +0 -184
  134. package/chunks/chunk-2HQMJ2IU.js +0 -8
  135. package/chunks/chunk-6GBNB5Z2.js +0 -3
  136. package/chunks/chunk-GHBKFIHC.js +0 -35
  137. package/chunks/chunk-HWOQNYAO.js +0 -27
  138. package/chunks/chunk-LJR4RZZ2.js +0 -3
  139. package/chunks/chunk-NVM7W7TG.js +0 -101
  140. package/chunks/chunk-PA6532AY.js +0 -6
  141. package/chunks/chunk-QFNFLE2I.js +0 -2625
  142. package/chunks/chunk-QN6WSWMM.js +0 -9
  143. package/chunks/chunk-RK2AKQAX.js +0 -39
  144. package/chunks/chunk-U347OO7S.js +0 -9
  145. package/chunks/chunk-UIRBHC5X.js +0 -3
  146. package/chunks/chunk-W5CGKUM4.js +0 -15
  147. package/chunks/chunk-WRQLIPXW.js +0 -113
  148. package/chunks/chunk-WVY2P6WH.js +0 -26
  149. package/chunks/chunk-WZ75OGYY.js +0 -14
  150. package/chunks/chunk-XCFLI3OC.js +0 -9
  151. package/chunks/chunk-XMZIY7XX.js +0 -13
  152. package/chunks/contextCommand-3GN5CAOK.js +0 -3
  153. package/chunks/dist-ME6647DQ.js +0 -195
  154. package/chunks/dist-VG3ZDJ2A.js +0 -28
  155. package/chunks/dist-YTCHM57U.js +0 -23
  156. package/chunks/edit-KX6V4PH3.js +0 -39
  157. package/chunks/exitPlanMode-G3QLIWJ4.js +0 -90
  158. package/chunks/geminiContentGenerator-EQEGOXOV.js +0 -8
  159. package/chunks/glob-KSBEWI3E.js +0 -22
  160. package/chunks/matildaAgentContentGenerator-OV4U6DJD.js +0 -8
  161. package/chunks/matildaContentGenerator-ETIAWE22.js +0 -8
  162. package/chunks/monitor-F4K5HOZX.js +0 -32
  163. package/chunks/notebook-edit-TL7CI5EA.js +0 -17
  164. package/chunks/read-file-6EAPS2KG.js +0 -3
  165. package/chunks/ripGrep-K6SFFUIE.js +0 -3
  166. package/chunks/scheduler-TKWPD4LP.js +0 -8
  167. package/chunks/shell-AZRK5GIO.js +0 -3
  168. package/chunks/src-SGI6VLOS.js +0 -3
  169. package/chunks/task-create-EBJD55TB.js +0 -3
  170. package/chunks/task-list-5BGX4G5N.js +0 -9
  171. package/chunks/team-delete-5U3GBFKJ.js +0 -8
  172. package/chunks/todoWrite-YGG6AZ3A.js +0 -3
  173. package/chunks/tree-sitter-bash-XNCMPQBK.js +0 -3
  174. package/chunks/write-file-UAGVBZMC.js +0 -15
@@ -21,7 +21,7 @@ This guide provides solutions to common issues and debugging tips, including top
21
21
  - **Error: `Device authorization flow failed: fetch failed`**
22
22
  - **Cause:** Node.js could not reach Matilda OAuth endpoints (often a proxy or SSL/TLS trust issue). When available, Matilda Code will also print the underlying error cause (for example: `UNABLE_TO_VERIFY_LEAF_SIGNATURE`). Note: this error is specific to the legacy Matilda OAuth flow.
23
23
  - **Solution:**
24
- - If you are still using Matilda OAuth, switch to API Key or Coding Plan via `/auth`.
24
+ - If you are still using Matilda OAuth, switch to a Matilda account or API token via `/auth`.
25
25
  - If you are behind a proxy, set it via `matilda --proxy <url>` (or the `proxy` setting in `settings.json`).
26
26
  - If your network uses a corporate TLS inspection CA, set `NODE_EXTRA_CA_CERTS` as described above.
27
27
 
@@ -0,0 +1,3 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import{Pg as a,Qg as b,Rg as c,Sg as d,Tg as e,Ug as f}from"./chunk-PEKAUGYV.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-W4QSMIWO.js";import"./chunk-6I6VGTKD.js";import"./chunk-ZX34M2GF.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-EZDV7A76.js";import"./chunk-RNKDFE2S.js";import"./chunk-RI54U73U.js";import"./chunk-6M5G5FBH.js";import"./chunk-QZI2ZGZY.js";import"./chunk-V6UPUMP3.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-P5TG5CON.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-IJEGHQ7Z.js";import"./chunk-PGUG43HG.js";import"./chunk-7ZODGQO6.js";import"./chunk-TISQNFB5.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-SOEIVSM5.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-SVSY6AWS.js";import"./chunk-AOOZREGV.js";import"./chunk-SDTWBD62.js";import"./chunk-DHDD5YJC.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-5OHGYMKP.js";import"./chunk-TWJLOEAI.js";import"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{f as AgentTool,b as TOOL_REGISTRY_REBUILT,e as createApprovalModeOverride,c as hasRebuiltToolRegistry,d as rebuildToolRegistryOnOverride,a as resolveSubagentApprovalMode};
@@ -0,0 +1,3 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import{ng as a,og as b,pg as c}from"./chunk-PEKAUGYV.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-W4QSMIWO.js";import"./chunk-6I6VGTKD.js";import"./chunk-ZX34M2GF.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-EZDV7A76.js";import"./chunk-RNKDFE2S.js";import"./chunk-RI54U73U.js";import"./chunk-6M5G5FBH.js";import"./chunk-QZI2ZGZY.js";import"./chunk-V6UPUMP3.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-P5TG5CON.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-IJEGHQ7Z.js";import"./chunk-PGUG43HG.js";import"./chunk-7ZODGQO6.js";import"./chunk-TISQNFB5.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-SOEIVSM5.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-SVSY6AWS.js";import"./chunk-AOOZREGV.js";import"./chunk-SDTWBD62.js";import"./chunk-DHDD5YJC.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-5OHGYMKP.js";import"./chunk-TWJLOEAI.js";import"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{c as AgentHeadless,a as ContextState,b as templateString};
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{a as xr,b as Tr}from"./chunk-QN6Y6NPA.js";import{a as M,b as rt,c as Se,d as Pn}from"./chunk-4Q2SNBUH.js";import{a as En}from"./chunk-ODZOYHIC.js";import{c as An,f as we}from"./chunk-GUFIMKF5.js";import{b as _n,c as wn,d as Sn,g as nt,o as Cn,t as xn,v as Tn}from"./chunk-SUH3UUWZ.js";import{b as ee,e as tt}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{f as kn}from"./chunk-SDTWBD62.js";import{ba as bn}from"./chunk-MH2P4YXC.js";import{a as Cr}from"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as c}from"./chunk-GZPNIYVZ.js";import{a as et,d as _e,f as jt}from"./chunk-OWGSC52X.js";var jn=_e((oo,Ln)=>{"use strict";c();var Or=et("util"),Br=Cr();Ln.exports=function(r){if(typeof r=="number")return r;var e=Br(r);if(e===void 0){var t=new Error(Or.format("humanize-ms(%j) result undefined",r));console.warn(t.stack)}return e}});var ct=_e((ao,qn)=>{"use strict";c();qn.exports={CURRENT_ID:Symbol("agentkeepalive#currentId"),CREATE_ID:Symbol("agentkeepalive#createId"),INIT_SOCKET:Symbol("agentkeepalive#initSocket"),CREATE_HTTPS_CONNECTION:Symbol("agentkeepalive#createHttpsConnection"),SOCKET_CREATED_TIME:Symbol("agentkeepalive#socketCreatedTime"),SOCKET_NAME:Symbol("agentkeepalive#socketName"),SOCKET_REQUEST_COUNT:Symbol("agentkeepalive#socketRequestCount"),SOCKET_REQUEST_FINISHED_COUNT:Symbol("agentkeepalive#socketRequestFinishedCount")}});var Kt=_e((uo,$n)=>{"use strict";c();var Lr=et("http").Agent,$t=jn(),P=et("util").debuglog("agentkeepalive"),{INIT_SOCKET:Dn,CURRENT_ID:ut,CREATE_ID:Nn,SOCKET_CREATED_TIME:Un,SOCKET_NAME:R,SOCKET_REQUEST_COUNT:v,SOCKET_REQUEST_FINISHED_COUNT:j}=ct(),Ht=1,Gt=parseInt(process.version.split(".",1)[0].substring(1));Gt>=11&&Gt<=12?Ht=2:Gt>=13&&(Ht=3);function ke(r){console.log("[agentkeepalive:deprecated] %s",r)}var Jt=class extends Lr{constructor(e){e=e||{},e.keepAlive=e.keepAlive!==!1,e.freeSocketTimeout===void 0&&(e.freeSocketTimeout=4e3),e.keepAliveTimeout&&(ke("options.keepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.keepAliveTimeout,delete e.keepAliveTimeout),e.freeSocketKeepAliveTimeout&&(ke("options.freeSocketKeepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.freeSocketKeepAliveTimeout,delete e.freeSocketKeepAliveTimeout),e.timeout===void 0&&(e.timeout=Math.max(e.freeSocketTimeout*2,8e3)),e.timeout=$t(e.timeout),e.freeSocketTimeout=$t(e.freeSocketTimeout),e.socketActiveTTL=e.socketActiveTTL?$t(e.socketActiveTTL):0,super(e),this[ut]=0,this.createSocketCount=0,this.createSocketCountLastCheck=0,this.createSocketErrorCount=0,this.createSocketErrorCountLastCheck=0,this.closeSocketCount=0,this.closeSocketCountLastCheck=0,this.errorSocketCount=0,this.errorSocketCountLastCheck=0,this.requestCount=0,this.requestCountLastCheck=0,this.timeoutSocketCount=0,this.timeoutSocketCountLastCheck=0,this.on("free",t=>{let n=this.calcSocketTimeout(t);n>0&&t.timeout!==n&&t.setTimeout(n)})}get freeSocketKeepAliveTimeout(){return ke("agent.freeSocketKeepAliveTimeout is deprecated, please use agent.options.freeSocketTimeout instead"),this.options.freeSocketTimeout}get timeout(){return ke("agent.timeout is deprecated, please use agent.options.timeout instead"),this.options.timeout}get socketActiveTTL(){return ke("agent.socketActiveTTL is deprecated, please use agent.options.socketActiveTTL instead"),this.options.socketActiveTTL}calcSocketTimeout(e){let t=this.options.freeSocketTimeout,n=this.options.socketActiveTTL;if(n){let s=Date.now()-e[Un],o=n-s;if(o<=0)return o;t&&o<t&&(t=o)}if(t)return e.freeSocketTimeout||e.freeSocketKeepAliveTimeout||t}keepSocketAlive(e){let t=super.keepSocketAlive(e);if(!t)return t;let n=this.calcSocketTimeout(e);return typeof n>"u"?!0:n<=0?(P("%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s",e[R],e[v],e[j],n),!1):(e.timeout!==n&&e.setTimeout(n),!0)}reuseSocket(...e){super.reuseSocket(...e);let t=e[0],n=e[1];n.reusedSocket=!0;let s=this.options.timeout;Ce(t)!==s&&(t.setTimeout(s),P("%s reset timeout to %sms",t[R],s)),t[v]++,P("%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms",t[R],t[v],t[j],Ce(t))}[Nn](){let e=this[ut]++;return this[ut]===Number.MAX_SAFE_INTEGER&&(this[ut]=0),e}[Dn](e,t){t.timeout&&(Ce(e)||e.setTimeout(t.timeout)),this.options.keepAlive&&e.setNoDelay(!0),this.createSocketCount++,this.options.socketActiveTTL&&(e[Un]=Date.now()),e[R]=`sock[${this[Nn]()}#${t._agentKey}]`.split("-----BEGIN",1)[0],e[v]=1,e[j]=0,jr(this,e,t)}createConnection(e,t){let n=!1,s=(i,a)=>{if(!n){if(n=!0,i)return this.createSocketErrorCount++,t(i);this[Dn](a,e),t(i,a)}},o=super.createConnection(e,s);return o&&s(null,o),o}get statusChanged(){let e=this.createSocketCount!==this.createSocketCountLastCheck||this.createSocketErrorCount!==this.createSocketErrorCountLastCheck||this.closeSocketCount!==this.closeSocketCountLastCheck||this.errorSocketCount!==this.errorSocketCountLastCheck||this.timeoutSocketCount!==this.timeoutSocketCountLastCheck||this.requestCount!==this.requestCountLastCheck;return e&&(this.createSocketCountLastCheck=this.createSocketCount,this.createSocketErrorCountLastCheck=this.createSocketErrorCount,this.closeSocketCountLastCheck=this.closeSocketCount,this.errorSocketCountLastCheck=this.errorSocketCount,this.timeoutSocketCountLastCheck=this.timeoutSocketCount,this.requestCountLastCheck=this.requestCount),e}getCurrentStatus(){return{createSocketCount:this.createSocketCount,createSocketErrorCount:this.createSocketErrorCount,closeSocketCount:this.closeSocketCount,errorSocketCount:this.errorSocketCount,timeoutSocketCount:this.timeoutSocketCount,requestCount:this.requestCount,freeSockets:Wt(this.freeSockets),sockets:Wt(this.sockets),requests:Wt(this.requests)}}};function Ce(r){return r.timeout||r._idleTimeout}function jr(r,e,t){P("%s create, timeout %sms",e[R],Ce(e));function n(){if(!e._httpMessage&&e[v]===1)return;e[j]++,r.requestCount++,P("%s(requests: %s, finished: %s) free",e[R],e[v],e[j]);let u=r.getName(t);e.writable&&r.requests[u]&&r.requests[u].length&&(e[v]++,P("%s(requests: %s, finished: %s) will be reuse on agent free event",e[R],e[v],e[j]))}e.on("free",n);function s(u){P("%s(requests: %s, finished: %s) close, isError: %s",e[R],e[v],e[j],u),r.closeSocketCount++}e.on("close",s);function o(){let u=e.listeners("timeout").length,l=Ce(e),y=e._httpMessage,g=y&&y.listeners("timeout").length||0;P("%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s",e[R],e[v],e[j],l,u,Ht,!!y,g),P.enabled&&P("timeout listeners: %s",e.listeners("timeout").map(_=>_.name).join(", ")),r.timeoutSocketCount++;let h=r.getName(t);if(r.freeSockets[h]&&r.freeSockets[h].indexOf(e)!==-1)e.destroy(),r.removeSocket(e,t),P("%s is free, destroy quietly",e[R]);else if(g===0){let _=new Error("Socket timeout");_.code="ERR_SOCKET_TIMEOUT",_.timeout=l,e.destroy(_),r.removeSocket(e,t),P("%s destroy with timeout error",e[R])}}e.on("timeout",o);function i(u){let l=e.listeners("error").length;P("%s(requests: %s, finished: %s) error: %s, listenerCount: %s",e[R],e[v],e[j],u,l),r.errorSocketCount++,l===1&&(P("%s emit uncaught error event",e[R]),e.removeListener("error",i),e.emit("error",u))}e.on("error",i);function a(){P("%s(requests: %s, finished: %s) agentRemove",e[R],e[v],e[j]),e.removeListener("close",s),e.removeListener("error",i),e.removeListener("free",n),e.removeListener("timeout",o),e.removeListener("agentRemove",a)}e.on("agentRemove",a)}$n.exports=Jt;function Wt(r){let e={};for(let t in r)e[t]=r[t].length;return e}});var Hn=_e((fo,Wn)=>{"use strict";c();var Xt=et("https").Agent,qr=Kt(),{INIT_SOCKET:Dr,CREATE_HTTPS_CONNECTION:Gn}=ct(),xe=class extends qr{constructor(e){super(e),this.defaultPort=443,this.protocol="https:",this.maxCachedSessions=this.options.maxCachedSessions,this.maxCachedSessions===void 0&&(this.maxCachedSessions=100),this._sessionCache={map:{},list:[]}}createConnection(e,t){let n=this[Gn](e,t);return this[Dr](n,e),n}};xe.prototype[Gn]=Xt.prototype.createConnection;["getName","_getSession","_cacheSession","_evictSession"].forEach(function(r){typeof Xt.prototype[r]=="function"&&(xe.prototype[r]=Xt.prototype[r])});Wn.exports=xe});var Kn=_e((po,Te)=>{"use strict";c();var Jn=Kt();Te.exports=Jn;Te.exports.HttpAgent=Jn;Te.exports.HttpsAgent=Hn();Te.exports.constants=ct()});c();c();c();c();c();var te="0.36.3";c();c();c();var Rn=!1,ne,qt,Ar,Er,Pr,Mn,Rr,st,Dt,vn,Nt,ot,In;function Fn(r,e={auto:!1}){if(Rn)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${r.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(ne)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${r.kind}'\` after \`import '@anthropic-ai/sdk/shims/${ne}'\``);Rn=e.auto,ne=r.kind,qt=r.fetch,Ar=r.Request,Er=r.Response,Pr=r.Headers,Mn=r.FormData,Rr=r.Blob,st=r.File,Dt=r.ReadableStream,vn=r.getMultipartRequestOptions,Nt=r.getDefaultAgent,ot=r.fileFromPath,In=r.isFsReadStream}c();var X=jt(xr(),1);c();c();import{inspect as Ir}from"util";c();var On=r=>r instanceof rt;c();import{deprecate as vr}from"util";var Bn=vr(()=>{},'Constructor "entries" argument is not spec-compliant and will be removed in next major release.');var B=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},it,L,Ut,at=class{constructor(e){it.add(this),L.set(this,new Map),e&&(Bn(),e.forEach(({name:t,value:n,fileName:s})=>this.append(t,n,s)))}static[(L=new WeakMap,it=new WeakSet,Symbol.hasInstance)](e){return!!(e&&M(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&M(e.append)&&M(e.set)&&M(e.get)&&M(e.getAll)&&M(e.has)&&M(e.delete)&&M(e.entries)&&M(e.values)&&M(e.keys)&&M(e[Symbol.iterator])&&M(e.forEach))}append(e,t,n){B(this,it,"m",Ut).call(this,{name:e,fileName:n,append:!0,rawValue:t,argsLength:arguments.length})}set(e,t,n){B(this,it,"m",Ut).call(this,{name:e,fileName:n,append:!1,rawValue:t,argsLength:arguments.length})}get(e){let t=B(this,L,"f").get(String(e));return t?t[0]:null}getAll(e){let t=B(this,L,"f").get(String(e));return t?t.slice():[]}has(e){return B(this,L,"f").has(String(e))}delete(e){B(this,L,"f").delete(String(e))}*keys(){for(let e of B(this,L,"f").keys())yield e}*entries(){for(let e of this.keys()){let t=this.getAll(e);for(let n of t)yield[e,n]}}*values(){for(let[,e]of this)yield e}[(Ut=function({name:t,rawValue:n,append:s,fileName:o,argsLength:i}){let a=s?"append":"set";if(i<2)throw new TypeError(`Failed to execute '${a}' on 'FormData': 2 arguments required, but only ${i} present.`);t=String(t);let u;if(Pn(n))u=o===void 0?n:new Se([n],o,{type:n.type,lastModified:n.lastModified});else if(On(n))u=new Se([n],o===void 0?"blob":o,{type:n.type});else{if(o)throw new TypeError(`Failed to execute '${a}' on 'FormData': parameter 2 is not of type 'Blob'.`);u=String(n)}let l=B(this,L,"f").get(t);if(!l)return void B(this,L,"f").set(t,[u]);if(!s)return void B(this,L,"f").set(t,[u]);l.push(u)},Symbol.iterator)](){return this.entries()}forEach(e,t){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"FormData"}[Ir.custom](){return this[Symbol.toStringTag]}};var Zt=jt(Kn(),1),Yn=jt(Tr(),1);import{ReadStream as Kr}from"node:fs";c();c();c();var Xn="abcdefghijklmnopqrstuvwxyz0123456789";function Nr(){let r=16,e="";for(;r--;)e+=Xn[Math.random()*Xn.length<<0];return e}var zn=Nr;c();var Ur=r=>Object.prototype.toString.call(r).slice(8,-1).toLowerCase();function $r(r){if(Ur(r)!=="object")return!1;let e=Object.getPrototypeOf(r);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}var zt=$r;c();var Gr=r=>String(r).replace(/\r|\n/g,(e,t,n)=>e==="\r"&&n[t+1]!==`
3
+ import{a as xr,b as Tr}from"./chunk-QN6Y6NPA.js";import{a as M,b as rt,c as Se,d as Pn}from"./chunk-4Q2SNBUH.js";import{a as En}from"./chunk-GOJCMVJJ.js";import{c as An,f as we}from"./chunk-YV3PUOBU.js";import{b as wn,c as Sn,d as kn,g as nt,o as Cn,t as xn,v as Tn}from"./chunk-JCE3JAVC.js";import{b as ee,e as tt}from"./chunk-SVSY6AWS.js";import"./chunk-AOOZREGV.js";import{f as bn}from"./chunk-SDTWBD62.js";import{ba as _n}from"./chunk-27Q5KW3A.js";import{a as Cr}from"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as c}from"./chunk-GZPNIYVZ.js";import{a as et,d as _e,f as jt}from"./chunk-OWGSC52X.js";var jn=_e((oo,Ln)=>{"use strict";c();var Or=et("util"),Br=Cr();Ln.exports=function(r){if(typeof r=="number")return r;var e=Br(r);if(e===void 0){var t=new Error(Or.format("humanize-ms(%j) result undefined",r));console.warn(t.stack)}return e}});var ct=_e((ao,qn)=>{"use strict";c();qn.exports={CURRENT_ID:Symbol("agentkeepalive#currentId"),CREATE_ID:Symbol("agentkeepalive#createId"),INIT_SOCKET:Symbol("agentkeepalive#initSocket"),CREATE_HTTPS_CONNECTION:Symbol("agentkeepalive#createHttpsConnection"),SOCKET_CREATED_TIME:Symbol("agentkeepalive#socketCreatedTime"),SOCKET_NAME:Symbol("agentkeepalive#socketName"),SOCKET_REQUEST_COUNT:Symbol("agentkeepalive#socketRequestCount"),SOCKET_REQUEST_FINISHED_COUNT:Symbol("agentkeepalive#socketRequestFinishedCount")}});var Kt=_e((uo,$n)=>{"use strict";c();var Lr=et("http").Agent,$t=jn(),P=et("util").debuglog("agentkeepalive"),{INIT_SOCKET:Dn,CURRENT_ID:ut,CREATE_ID:Nn,SOCKET_CREATED_TIME:Un,SOCKET_NAME:R,SOCKET_REQUEST_COUNT:v,SOCKET_REQUEST_FINISHED_COUNT:j}=ct(),Ht=1,Gt=parseInt(process.version.split(".",1)[0].substring(1));Gt>=11&&Gt<=12?Ht=2:Gt>=13&&(Ht=3);function ke(r){console.log("[agentkeepalive:deprecated] %s",r)}var Jt=class extends Lr{constructor(e){e=e||{},e.keepAlive=e.keepAlive!==!1,e.freeSocketTimeout===void 0&&(e.freeSocketTimeout=4e3),e.keepAliveTimeout&&(ke("options.keepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.keepAliveTimeout,delete e.keepAliveTimeout),e.freeSocketKeepAliveTimeout&&(ke("options.freeSocketKeepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.freeSocketKeepAliveTimeout,delete e.freeSocketKeepAliveTimeout),e.timeout===void 0&&(e.timeout=Math.max(e.freeSocketTimeout*2,8e3)),e.timeout=$t(e.timeout),e.freeSocketTimeout=$t(e.freeSocketTimeout),e.socketActiveTTL=e.socketActiveTTL?$t(e.socketActiveTTL):0,super(e),this[ut]=0,this.createSocketCount=0,this.createSocketCountLastCheck=0,this.createSocketErrorCount=0,this.createSocketErrorCountLastCheck=0,this.closeSocketCount=0,this.closeSocketCountLastCheck=0,this.errorSocketCount=0,this.errorSocketCountLastCheck=0,this.requestCount=0,this.requestCountLastCheck=0,this.timeoutSocketCount=0,this.timeoutSocketCountLastCheck=0,this.on("free",t=>{let n=this.calcSocketTimeout(t);n>0&&t.timeout!==n&&t.setTimeout(n)})}get freeSocketKeepAliveTimeout(){return ke("agent.freeSocketKeepAliveTimeout is deprecated, please use agent.options.freeSocketTimeout instead"),this.options.freeSocketTimeout}get timeout(){return ke("agent.timeout is deprecated, please use agent.options.timeout instead"),this.options.timeout}get socketActiveTTL(){return ke("agent.socketActiveTTL is deprecated, please use agent.options.socketActiveTTL instead"),this.options.socketActiveTTL}calcSocketTimeout(e){let t=this.options.freeSocketTimeout,n=this.options.socketActiveTTL;if(n){let s=Date.now()-e[Un],o=n-s;if(o<=0)return o;t&&o<t&&(t=o)}if(t)return e.freeSocketTimeout||e.freeSocketKeepAliveTimeout||t}keepSocketAlive(e){let t=super.keepSocketAlive(e);if(!t)return t;let n=this.calcSocketTimeout(e);return typeof n>"u"?!0:n<=0?(P("%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s",e[R],e[v],e[j],n),!1):(e.timeout!==n&&e.setTimeout(n),!0)}reuseSocket(...e){super.reuseSocket(...e);let t=e[0],n=e[1];n.reusedSocket=!0;let s=this.options.timeout;Ce(t)!==s&&(t.setTimeout(s),P("%s reset timeout to %sms",t[R],s)),t[v]++,P("%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms",t[R],t[v],t[j],Ce(t))}[Nn](){let e=this[ut]++;return this[ut]===Number.MAX_SAFE_INTEGER&&(this[ut]=0),e}[Dn](e,t){t.timeout&&(Ce(e)||e.setTimeout(t.timeout)),this.options.keepAlive&&e.setNoDelay(!0),this.createSocketCount++,this.options.socketActiveTTL&&(e[Un]=Date.now()),e[R]=`sock[${this[Nn]()}#${t._agentKey}]`.split("-----BEGIN",1)[0],e[v]=1,e[j]=0,jr(this,e,t)}createConnection(e,t){let n=!1,s=(i,a)=>{if(!n){if(n=!0,i)return this.createSocketErrorCount++,t(i);this[Dn](a,e),t(i,a)}},o=super.createConnection(e,s);return o&&s(null,o),o}get statusChanged(){let e=this.createSocketCount!==this.createSocketCountLastCheck||this.createSocketErrorCount!==this.createSocketErrorCountLastCheck||this.closeSocketCount!==this.closeSocketCountLastCheck||this.errorSocketCount!==this.errorSocketCountLastCheck||this.timeoutSocketCount!==this.timeoutSocketCountLastCheck||this.requestCount!==this.requestCountLastCheck;return e&&(this.createSocketCountLastCheck=this.createSocketCount,this.createSocketErrorCountLastCheck=this.createSocketErrorCount,this.closeSocketCountLastCheck=this.closeSocketCount,this.errorSocketCountLastCheck=this.errorSocketCount,this.timeoutSocketCountLastCheck=this.timeoutSocketCount,this.requestCountLastCheck=this.requestCount),e}getCurrentStatus(){return{createSocketCount:this.createSocketCount,createSocketErrorCount:this.createSocketErrorCount,closeSocketCount:this.closeSocketCount,errorSocketCount:this.errorSocketCount,timeoutSocketCount:this.timeoutSocketCount,requestCount:this.requestCount,freeSockets:Wt(this.freeSockets),sockets:Wt(this.sockets),requests:Wt(this.requests)}}};function Ce(r){return r.timeout||r._idleTimeout}function jr(r,e,t){P("%s create, timeout %sms",e[R],Ce(e));function n(){if(!e._httpMessage&&e[v]===1)return;e[j]++,r.requestCount++,P("%s(requests: %s, finished: %s) free",e[R],e[v],e[j]);let u=r.getName(t);e.writable&&r.requests[u]&&r.requests[u].length&&(e[v]++,P("%s(requests: %s, finished: %s) will be reuse on agent free event",e[R],e[v],e[j]))}e.on("free",n);function s(u){P("%s(requests: %s, finished: %s) close, isError: %s",e[R],e[v],e[j],u),r.closeSocketCount++}e.on("close",s);function o(){let u=e.listeners("timeout").length,l=Ce(e),y=e._httpMessage,g=y&&y.listeners("timeout").length||0;P("%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s",e[R],e[v],e[j],l,u,Ht,!!y,g),P.enabled&&P("timeout listeners: %s",e.listeners("timeout").map(_=>_.name).join(", ")),r.timeoutSocketCount++;let h=r.getName(t);if(r.freeSockets[h]&&r.freeSockets[h].indexOf(e)!==-1)e.destroy(),r.removeSocket(e,t),P("%s is free, destroy quietly",e[R]);else if(g===0){let _=new Error("Socket timeout");_.code="ERR_SOCKET_TIMEOUT",_.timeout=l,e.destroy(_),r.removeSocket(e,t),P("%s destroy with timeout error",e[R])}}e.on("timeout",o);function i(u){let l=e.listeners("error").length;P("%s(requests: %s, finished: %s) error: %s, listenerCount: %s",e[R],e[v],e[j],u,l),r.errorSocketCount++,l===1&&(P("%s emit uncaught error event",e[R]),e.removeListener("error",i),e.emit("error",u))}e.on("error",i);function a(){P("%s(requests: %s, finished: %s) agentRemove",e[R],e[v],e[j]),e.removeListener("close",s),e.removeListener("error",i),e.removeListener("free",n),e.removeListener("timeout",o),e.removeListener("agentRemove",a)}e.on("agentRemove",a)}$n.exports=Jt;function Wt(r){let e={};for(let t in r)e[t]=r[t].length;return e}});var Hn=_e((fo,Wn)=>{"use strict";c();var Xt=et("https").Agent,qr=Kt(),{INIT_SOCKET:Dr,CREATE_HTTPS_CONNECTION:Gn}=ct(),xe=class extends qr{constructor(e){super(e),this.defaultPort=443,this.protocol="https:",this.maxCachedSessions=this.options.maxCachedSessions,this.maxCachedSessions===void 0&&(this.maxCachedSessions=100),this._sessionCache={map:{},list:[]}}createConnection(e,t){let n=this[Gn](e,t);return this[Dr](n,e),n}};xe.prototype[Gn]=Xt.prototype.createConnection;["getName","_getSession","_cacheSession","_evictSession"].forEach(function(r){typeof Xt.prototype[r]=="function"&&(xe.prototype[r]=Xt.prototype[r])});Wn.exports=xe});var Kn=_e((po,Te)=>{"use strict";c();var Jn=Kt();Te.exports=Jn;Te.exports.HttpAgent=Jn;Te.exports.HttpsAgent=Hn();Te.exports.constants=ct()});c();c();c();c();c();var te="0.36.3";c();c();c();var Rn=!1,ne,qt,Ar,Er,Pr,Mn,Rr,st,Dt,vn,Nt,ot,In;function Fn(r,e={auto:!1}){if(Rn)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${r.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(ne)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${r.kind}'\` after \`import '@anthropic-ai/sdk/shims/${ne}'\``);Rn=e.auto,ne=r.kind,qt=r.fetch,Ar=r.Request,Er=r.Response,Pr=r.Headers,Mn=r.FormData,Rr=r.Blob,st=r.File,Dt=r.ReadableStream,vn=r.getMultipartRequestOptions,Nt=r.getDefaultAgent,ot=r.fileFromPath,In=r.isFsReadStream}c();var X=jt(xr(),1);c();c();import{inspect as Ir}from"util";c();var On=r=>r instanceof rt;c();import{deprecate as vr}from"util";var Bn=vr(()=>{},'Constructor "entries" argument is not spec-compliant and will be removed in next major release.');var B=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},it,L,Ut,at=class{constructor(e){it.add(this),L.set(this,new Map),e&&(Bn(),e.forEach(({name:t,value:n,fileName:s})=>this.append(t,n,s)))}static[(L=new WeakMap,it=new WeakSet,Symbol.hasInstance)](e){return!!(e&&M(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&M(e.append)&&M(e.set)&&M(e.get)&&M(e.getAll)&&M(e.has)&&M(e.delete)&&M(e.entries)&&M(e.values)&&M(e.keys)&&M(e[Symbol.iterator])&&M(e.forEach))}append(e,t,n){B(this,it,"m",Ut).call(this,{name:e,fileName:n,append:!0,rawValue:t,argsLength:arguments.length})}set(e,t,n){B(this,it,"m",Ut).call(this,{name:e,fileName:n,append:!1,rawValue:t,argsLength:arguments.length})}get(e){let t=B(this,L,"f").get(String(e));return t?t[0]:null}getAll(e){let t=B(this,L,"f").get(String(e));return t?t.slice():[]}has(e){return B(this,L,"f").has(String(e))}delete(e){B(this,L,"f").delete(String(e))}*keys(){for(let e of B(this,L,"f").keys())yield e}*entries(){for(let e of this.keys()){let t=this.getAll(e);for(let n of t)yield[e,n]}}*values(){for(let[,e]of this)yield e}[(Ut=function({name:t,rawValue:n,append:s,fileName:o,argsLength:i}){let a=s?"append":"set";if(i<2)throw new TypeError(`Failed to execute '${a}' on 'FormData': 2 arguments required, but only ${i} present.`);t=String(t);let u;if(Pn(n))u=o===void 0?n:new Se([n],o,{type:n.type,lastModified:n.lastModified});else if(On(n))u=new Se([n],o===void 0?"blob":o,{type:n.type});else{if(o)throw new TypeError(`Failed to execute '${a}' on 'FormData': parameter 2 is not of type 'Blob'.`);u=String(n)}let l=B(this,L,"f").get(t);if(!l)return void B(this,L,"f").set(t,[u]);if(!s)return void B(this,L,"f").set(t,[u]);l.push(u)},Symbol.iterator)](){return this.entries()}forEach(e,t){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"FormData"}[Ir.custom](){return this[Symbol.toStringTag]}};var Zt=jt(Kn(),1),Yn=jt(Tr(),1);import{ReadStream as Kr}from"node:fs";c();c();c();var Xn="abcdefghijklmnopqrstuvwxyz0123456789";function Nr(){let r=16,e="";for(;r--;)e+=Xn[Math.random()*Xn.length<<0];return e}var zn=Nr;c();var Ur=r=>Object.prototype.toString.call(r).slice(8,-1).toLowerCase();function $r(r){if(Ur(r)!=="object")return!1;let e=Object.getPrototypeOf(r);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}var zt=$r;c();var Gr=r=>String(r).replace(/\r|\n/g,(e,t,n)=>e==="\r"&&n[t+1]!==`
4
4
  `||e===`
5
5
  `&&n[t-1]!=="\r"?`\r
6
6
  `:e),Vt=Gr;c();var Wr=r=>String(r).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),Qt=Wr;c();c();var Hr=r=>typeof r=="function",U=Hr;var re=r=>!!(r&&typeof r=="object"&&U(r.constructor)&&r[Symbol.toStringTag]==="File"&&U(r.stream)&&r.name!=null&&r.size!=null&&r.lastModified!=null);c();var Vn=r=>!!(r&&U(r.constructor)&&r[Symbol.toStringTag]==="FormData"&&U(r.append)&&U(r.getAll)&&U(r.entries)&&U(r[Symbol.iterator]));var Ae=function(r,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},w=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},lt,K,Ee,ft,Pe,se,Re,Me,ht,Yt,Jr={enableAdditionalHeaders:!1},dt=class{constructor(e,t,n){if(lt.add(this),K.set(this,`\r
@@ -20,9 +20,9 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
20
20
 
21
21
  Human:`;b.AI_PROMPT=`
22
22
 
23
- Assistant:`;b.DEFAULT_TIMEOUT=6e5;b.AnthropicError=f;b.APIError=C;b.APIConnectionError=z;b.APIConnectionTimeoutError=le;b.APIUserAbortError=T;b.NotFoundError=Oe;b.ConflictError=Be;b.RateLimitError=je;b.BadRequestError=ve;b.AuthenticationError=Ie;b.InternalServerError=qe;b.PermissionDeniedError=Fe;b.UnprocessableEntityError=Le;b.toFile=er;b.fileFromPath=ot;b.Completions=ae;b.Messages=H;b.Models=Z;b.ModelInfosPage=ue;b.Beta=N;var{HUMAN_PROMPT:Xa,AI_PROMPT:za}=b,_r=b;c();c();function Ye(r){let{inputTokens:e,cacheReadTokens:t,cacheCreationTokens:n,outputTokens:s}=r,i=n===0&&t>0&&e>=t?e:e+t+n;return{promptTokenCount:i,candidatesTokenCount:s,totalTokenCount:i+s,cachedContentTokenCount:t}}var Lt=class{model;schemaCompliance;enableCacheControl;constructor(e,t="auto",n=!0){this.model=e,this.schemaCompliance=t,this.enableCacheControl=n}convertGeminiRequestToAnthropic(e,t={}){let n=[],s=this.extractTextFromContentUnion(e.config?.systemInstruction);this.processContents(e.contents,n),t.stripAssistantThinking&&this.stripThinkingFromAssistantMessages(n),t.normalizeAssistantThinkingSignature&&this.fillMissingThinkingSignatures(n),t.injectThinkingOnToolUseTurns&&this.injectEmptyThinkingOnToolUseTurns(n);let o=t.enableCacheControl??this.enableCacheControl,i=t.useGlobalCacheScope??!1,a=o?this.buildSystemWithCacheControl(s,i):s;return o&&this.addCacheControlToMessages(n),{system:a,messages:n}}async convertGeminiToolsToAnthropic(e,t={}){let n=[];for(let i of e){let a;if("tool"in i?a=await i.tool():a=i,!!a.functionDeclarations)for(let u of a.functionDeclarations){if(!u.name||!u.description)continue;let l;u.parametersJsonSchema?l={...u.parametersJsonSchema}:u.parameters&&(l=u.parameters),l||(l={type:"object",properties:{}}),l=Sn(l,this.schemaCompliance),typeof l.type!="string"&&(l.type="object"),n.push({name:u.name,description:u.description,input_schema:l})}}let s=t.enableCacheControl??this.enableCacheControl,o=t.useGlobalCacheScope??!1;if(s&&n.length>0){let i=n.length-1;n[i]={...n[i],cache_control:o?{type:"ephemeral",scope:"global"}:{type:"ephemeral"}}}return n}convertAnthropicResponseToGemini(e){let t=new tt,n=[];for(let i of e.content||[]){let a=String(i.type||"");if(a==="text"){let u=typeof i.text=="string"?i.text:"";u&&n.push({text:u})}else if(a==="tool_use"){let u=i,l=this.safeInputToArgs(u.input);if(l===null)continue;n.push({functionCall:{id:typeof u.id=="string"?u.id:void 0,name:typeof u.name=="string"?u.name:void 0,args:l}})}else if(a==="thinking"){let u=typeof i.thinking=="string"?i.thinking:"",l=typeof i.signature=="string"?i.signature:"";if(u||l){let y={text:u,thought:!0,thoughtSignature:l};n.push(y)}}else a==="redacted_thinking"&&n.push({text:"",thought:!0})}let s={content:{parts:n,role:"model"},index:0,safetyRatings:[]},o=this.mapAnthropicFinishReasonToGemini(e.stop_reason);return o&&(s.finishReason=o),t.candidates=[s],t.responseId=e.id,t.createTime=Date.now().toString(),t.modelVersion=e.model||this.model,t.promptFeedback={safetyRatings:[]},e.usage&&(t.usageMetadata=Ye({inputTokens:e.usage.input_tokens||0,cacheReadTokens:e.usage.cache_read_input_tokens||0,cacheCreationTokens:e.usage.cache_creation_input_tokens||0,outputTokens:e.usage.output_tokens||0})),t}processContents(e,t){if(Array.isArray(e))for(let n of e)this.processContent(n,t);else e&&this.processContent(e,t)}processContent(e,t){if(typeof e=="string"){t.push({role:"user",content:[{type:"text",text:e}]});return}if(!this.isContentObject(e))return;let n=e.parts||[],s=e.role==="model"?"assistant":"user",o=[],i=0;for(let a of n){if(typeof a=="string"){o.push({type:"text",text:a});continue}if("text"in a&&"thought"in a&&a.thought&&s==="assistant"){let l={type:"thinking",thinking:a.text||""};"thoughtSignature"in a&&typeof a.thoughtSignature=="string"&&(l.signature=a.thoughtSignature),o.push(l)}"text"in a&&a.text&&!("thought"in a&&a.thought)&&o.push({type:"text",text:a.text});let u=this.createMediaBlockFromPart(a);if(u&&o.push(u),"functionCall"in a&&a.functionCall&&s==="assistant"&&(o.push({type:"tool_use",id:a.functionCall.id||`tool_${i}`,name:a.functionCall.name||"",input:a.functionCall.args||{}}),i+=1),a.functionResponse){let l=this.createToolResultBlock(a.functionResponse);l&&s==="user"&&o.push(l)}}o.length>0&&t.push({role:s,content:o})}createToolResultBlock(e){let t=this.extractFunctionResponseContent(e.response),n=[];for(let o of e.parts||[]){let i=this.createMediaBlockFromPart(o);i&&n.push(i)}let s;if(n.length>0){let o=[];t&&o.push({type:"text",text:t}),o.push(...n),s=o}else s=t;return{type:"tool_result",tool_use_id:e.id||"",content:s}}createMediaBlockFromPart(e){if(e.inlineData?.mimeType&&e.inlineData?.data){if(this.isSupportedAnthropicImageMimeType(e.inlineData.mimeType))return{type:"image",source:{type:"base64",media_type:e.inlineData.mimeType,data:e.inlineData.data}};if(e.inlineData.mimeType==="application/pdf")return{type:"document",source:{type:"base64",media_type:"application/pdf",data:e.inlineData.data}};let t=e.inlineData.displayName?` (${e.inlineData.displayName})`:"";return{type:"text",text:`Unsupported inline media type: ${e.inlineData.mimeType}${t}.`}}if(e.fileData?.mimeType&&e.fileData?.fileUri){let t=e.fileData.displayName?` (${e.fileData.displayName})`:"",n=e.fileData.fileUri;return this.isSupportedAnthropicImageMimeType(e.fileData.mimeType)?{type:"image",source:{type:"url",url:n}}:e.fileData.mimeType==="application/pdf"?{type:"document",source:{type:"url",url:n}}:{type:"text",text:`Unsupported file media type: ${e.fileData.mimeType}${t}.`}}return null}isSupportedAnthropicImageMimeType(e){return e==="image/jpeg"||e==="image/png"||e==="image/gif"||e==="image/webp"}extractTextFromContentUnion(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>this.extractTextFromContentUnion(t)).filter(Boolean).join(`
23
+ Assistant:`;b.DEFAULT_TIMEOUT=6e5;b.AnthropicError=f;b.APIError=C;b.APIConnectionError=z;b.APIConnectionTimeoutError=le;b.APIUserAbortError=T;b.NotFoundError=Oe;b.ConflictError=Be;b.RateLimitError=je;b.BadRequestError=ve;b.AuthenticationError=Ie;b.InternalServerError=qe;b.PermissionDeniedError=Fe;b.UnprocessableEntityError=Le;b.toFile=er;b.fileFromPath=ot;b.Completions=ae;b.Messages=H;b.Models=Z;b.ModelInfosPage=ue;b.Beta=N;var{HUMAN_PROMPT:Xa,AI_PROMPT:za}=b,_r=b;c();c();function Ye(r){let{inputTokens:e,cacheReadTokens:t,cacheCreationTokens:n,outputTokens:s}=r,i=n===0&&t>0&&e>=t?e:e+t+n;return{promptTokenCount:i,candidatesTokenCount:s,totalTokenCount:i+s,cachedContentTokenCount:t}}var Lt=class{model;schemaCompliance;enableCacheControl;constructor(e,t="auto",n=!0){this.model=e,this.schemaCompliance=t,this.enableCacheControl=n}convertGeminiRequestToAnthropic(e,t={}){let n=[],s=this.extractTextFromContentUnion(e.config?.systemInstruction);this.processContents(e.contents,n),t.stripAssistantThinking&&this.stripThinkingFromAssistantMessages(n),t.normalizeAssistantThinkingSignature&&this.fillMissingThinkingSignatures(n),t.injectThinkingOnToolUseTurns&&this.injectEmptyThinkingOnToolUseTurns(n);let o=t.enableCacheControl??this.enableCacheControl,i=t.useGlobalCacheScope??!1,a=o?this.buildSystemWithCacheControl(s,i):s;return o&&this.addCacheControlToMessages(n),{system:a,messages:n}}async convertGeminiToolsToAnthropic(e,t={}){let n=[];for(let i of e){let a;if("tool"in i?a=await i.tool():a=i,!!a.functionDeclarations)for(let u of a.functionDeclarations){if(!u.name||!u.description)continue;let l;u.parametersJsonSchema?l={...u.parametersJsonSchema}:u.parameters&&(l=u.parameters),l||(l={type:"object",properties:{}}),l=kn(l,this.schemaCompliance),typeof l.type!="string"&&(l.type="object"),n.push({name:u.name,description:u.description,input_schema:l})}}let s=t.enableCacheControl??this.enableCacheControl,o=t.useGlobalCacheScope??!1;if(s&&n.length>0){let i=n.length-1;n[i]={...n[i],cache_control:o?{type:"ephemeral",scope:"global"}:{type:"ephemeral"}}}return n}convertAnthropicResponseToGemini(e){let t=new tt,n=[];for(let i of e.content||[]){let a=String(i.type||"");if(a==="text"){let u=typeof i.text=="string"?i.text:"";u&&n.push({text:u})}else if(a==="tool_use"){let u=i,l=this.safeInputToArgs(u.input);if(l===null)continue;n.push({functionCall:{id:typeof u.id=="string"?u.id:void 0,name:typeof u.name=="string"?u.name:void 0,args:l}})}else if(a==="thinking"){let u=typeof i.thinking=="string"?i.thinking:"",l=typeof i.signature=="string"?i.signature:"";if(u||l){let y={text:u,thought:!0,thoughtSignature:l};n.push(y)}}else a==="redacted_thinking"&&n.push({text:"",thought:!0})}let s={content:{parts:n,role:"model"},index:0,safetyRatings:[]},o=this.mapAnthropicFinishReasonToGemini(e.stop_reason);return o&&(s.finishReason=o),t.candidates=[s],t.responseId=e.id,t.createTime=Date.now().toString(),t.modelVersion=e.model||this.model,t.promptFeedback={safetyRatings:[]},e.usage&&(t.usageMetadata=Ye({inputTokens:e.usage.input_tokens||0,cacheReadTokens:e.usage.cache_read_input_tokens||0,cacheCreationTokens:e.usage.cache_creation_input_tokens||0,outputTokens:e.usage.output_tokens||0})),t}processContents(e,t){if(Array.isArray(e))for(let n of e)this.processContent(n,t);else e&&this.processContent(e,t)}processContent(e,t){if(typeof e=="string"){t.push({role:"user",content:[{type:"text",text:e}]});return}if(!this.isContentObject(e))return;let n=e.parts||[],s=e.role==="model"?"assistant":"user",o=[],i=0;for(let a of n){if(typeof a=="string"){o.push({type:"text",text:a});continue}if("text"in a&&"thought"in a&&a.thought&&s==="assistant"){let l={type:"thinking",thinking:a.text||""};"thoughtSignature"in a&&typeof a.thoughtSignature=="string"&&(l.signature=a.thoughtSignature),o.push(l)}"text"in a&&a.text&&!("thought"in a&&a.thought)&&o.push({type:"text",text:a.text});let u=this.createMediaBlockFromPart(a);if(u&&o.push(u),"functionCall"in a&&a.functionCall&&s==="assistant"&&(o.push({type:"tool_use",id:a.functionCall.id||`tool_${i}`,name:a.functionCall.name||"",input:a.functionCall.args||{}}),i+=1),a.functionResponse){let l=this.createToolResultBlock(a.functionResponse);l&&s==="user"&&o.push(l)}}o.length>0&&t.push({role:s,content:o})}createToolResultBlock(e){let t=this.extractFunctionResponseContent(e.response),n=[];for(let o of e.parts||[]){let i=this.createMediaBlockFromPart(o);i&&n.push(i)}let s;if(n.length>0){let o=[];t&&o.push({type:"text",text:t}),o.push(...n),s=o}else s=t;return{type:"tool_result",tool_use_id:e.id||"",content:s}}createMediaBlockFromPart(e){if(e.inlineData?.mimeType&&e.inlineData?.data){if(this.isSupportedAnthropicImageMimeType(e.inlineData.mimeType))return{type:"image",source:{type:"base64",media_type:e.inlineData.mimeType,data:e.inlineData.data}};if(e.inlineData.mimeType==="application/pdf")return{type:"document",source:{type:"base64",media_type:"application/pdf",data:e.inlineData.data}};let t=e.inlineData.displayName?` (${e.inlineData.displayName})`:"";return{type:"text",text:`Unsupported inline media type: ${e.inlineData.mimeType}${t}.`}}if(e.fileData?.mimeType&&e.fileData?.fileUri){let t=e.fileData.displayName?` (${e.fileData.displayName})`:"",n=e.fileData.fileUri;return this.isSupportedAnthropicImageMimeType(e.fileData.mimeType)?{type:"image",source:{type:"url",url:n}}:e.fileData.mimeType==="application/pdf"?{type:"document",source:{type:"url",url:n}}:{type:"text",text:`Unsupported file media type: ${e.fileData.mimeType}${t}.`}}return null}isSupportedAnthropicImageMimeType(e){return e==="image/jpeg"||e==="image/png"||e==="image/gif"||e==="image/webp"}extractTextFromContentUnion(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>this.extractTextFromContentUnion(t)).filter(Boolean).join(`
24
24
  `):typeof e=="object"&&e!==null&&"parts"in e&&e.parts?.map(n=>typeof n=="string"?n:"text"in n&&n.text||"").filter(Boolean).join(`
25
- `)||""}extractFunctionResponseContent(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){let t=e,n=t.output;if(typeof n=="string")return n;let s=t.error;if(typeof s=="string")return s}try{return JSON.stringify(e)??String(e)}catch{return String(e)}}safeInputToArgs(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:typeof e=="string"?_n(e):e==null?{}:null}mapAnthropicFinishReasonToGemini(e){return e?{end_turn:ee.STOP,stop_sequence:ee.STOP,tool_use:ee.STOP,max_tokens:ee.MAX_TOKENS,content_filter:ee.SAFETY}[e]||ee.FINISH_REASON_UNSPECIFIED:void 0}isContentObject(e){return typeof e=="object"&&e!==null&&"role"in e&&"parts"in e&&Array.isArray(e.parts)}buildSystemWithCacheControl(e,t){return e&&[{type:"text",text:e,cache_control:t?{type:"ephemeral",scope:"global"}:{type:"ephemeral"}}]}stripThinkingFromAssistantMessages(e){for(let t of e){if(t.role!=="assistant"||!Array.isArray(t.content))continue;let n=t.content.filter(s=>{let o=s.type;return o!=="thinking"&&o!=="redacted_thinking"});n.length!==0&&n.length!==t.content.length&&(t.content=n)}}fillMissingThinkingSignatures(e){for(let t of e){if(t.role!=="assistant"||!Array.isArray(t.content))continue;let n=!1,s=t.content.map(o=>{let i=o;return i.type==="thinking"&&typeof i.signature!="string"?(n=!0,{...o,signature:""}):o});n&&(t.content=s)}}injectEmptyThinkingOnToolUseTurns(e){for(let t of e){if(t.role!=="assistant"||!Array.isArray(t.content))continue;let n=t.content;if(!n.some(a=>a.type==="tool_use")||n.some(a=>{let u=a.type;return u==="thinking"||u==="redacted_thinking"}))continue;let i={type:"thinking",thinking:"",signature:""};t.content=[i,...n]}}addCacheControlToMessages(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role==="user"){let s=Array.isArray(n.content)?n.content:[{type:"text",text:n.content}];if(s.length>0){let o=s[s.length-1];if(typeof o=="object"&&"type"in o){let i=o.type,a=i==="text"&&(!("text"in o)||!o.text);(i==="text"||i==="tool_result")&&!a&&(o.cache_control={type:"ephemeral"})}n.content=s}break}}}};var yn=bn("ANTHROPIC");function kr(r){let e=r.baseUrl??"";if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t==="api.deepseek.com"||t.endsWith(".api.deepseek.com")}catch{return!1}}function Os(r){return kr(r)?!0:(r.model??"").toLowerCase().includes("deepseek")}function Bs(r){let e=r.baseUrl?.trim();if(e)return e;let t=process.env.ANTHROPIC_BASE_URL?.trim();return t||"https://api.anthropic.com"}function wr(r){try{let e=new URL(Bs(r)).hostname.toLowerCase();return e==="api.anthropic.com"||e.endsWith(".anthropic.com")}catch{return!1}}function Sr(r,e){for(let t of r){if(e.jsonEscape){e.jsonEscape=!1;continue}if(t==="\\"&&e.inJsonString){e.jsonEscape=!0;continue}if(t==='"'){e.inJsonString=!e.inJsonString;continue}e.inJsonString||(t==="{"||t==="["?e.jsonDepth+=1:(t==="}"||t==="]")&&e.jsonDepth>0&&(e.jsonDepth-=1))}}function Ls(r){return r.jsonDepth>0||r.inJsonString}function js(r){let e=r.trim();if(!e)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{let t=wn(e);if(t&&t!==e)try{let n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n))return n}catch{}return}}var Ze=class{constructor(e,t){this.contentGeneratorConfig=e;this.cliConfig=t;let n=!wr(e),s=this.buildHeaders(n),o=e.baseUrl,i=An("anthropic",this.cliConfig.getProxy());this.client=new _r({...n?{authToken:e.apiKey,apiKey:null}:{apiKey:e.apiKey,authToken:null},baseURL:o,timeout:e.timeout||6e5,maxRetries:e.maxRetries,defaultHeaders:s,...i}),this.converter=new Lt(e.model,e.schemaCompliance,e.enableCacheControl)}client;converter;effortClampWarned=!1;async generateContent(e){let t;try{let n=await this.buildRequest(e);nt.recordAnthropicWireRequest(n);let s=this.buildPerRequestHeaders(n);t=await this.client.messages.create(n,{signal:e.config?.abortSignal,...s?{headers:s}:{}})}catch(n){throw we(n)}return this.converter.convertAnthropicResponseToGemini(t)}async generateContentStream(e){let t=await this.buildRequest(e),n=this.buildPerRequestHeaders(t),s={...t,stream:!0};nt.recordAnthropicWireRequest(s);let o;try{o=await this.client.messages.create(s,{signal:e.config?.abortSignal,...n?{headers:n}:{}})}catch(i){throw we(i)}return this.processStreamWithEmptyFallback(this.redactStreamErrors(o),t,e.config?.abortSignal,n)}async countTokens(e){try{return{totalTokens:(await new En().calculateTokens(e)).totalTokens}}catch(t){yn.warn("Failed to calculate tokens with tokenizer, falling back to simple method:",t);let n=JSON.stringify(e.contents);return{totalTokens:Math.ceil(n.length/4)}}}async embedContent(e){throw new Error("Anthropic does not support embeddings.")}useSummarizedThinking(){return!1}buildHeaders(e){let t=this.cliConfig.getCliVersion()||"unknown",n=e?`claude-cli/${t} (external, cli)`:`MatildaCode/${t} (${process.platform}; ${process.arch})`,{customHeaders:s}=this.contentGeneratorConfig,o={"User-Agent":n};if(e&&(o["x-app"]="cli"),s)for(let[i,a]of Object.entries(s))i.toLowerCase()==="anthropic-beta"||kn(i)||(o[i]=a);return o}buildPerRequestHeaders(e){let t=[];for(let s of this.collectCustomBetaFlags())t.push(s);return e.thinking&&t.push("interleaved-thinking-2025-05-14"),e.output_config&&t.push("effort-2025-11-24"),this.hasGlobalCacheScopeOnWire(e)&&t.push("prompt-caching-scope-2026-01-05"),t.length===0?void 0:{"anthropic-beta":Array.from(new Set(t)).join(",")}}useGlobalCacheScope(){return this.contentGeneratorConfig.enableCacheControl!==!1&&wr(this.contentGeneratorConfig)}hasGlobalCacheScopeOnWire(e){let t=n=>{if(!n||typeof n!="object")return!1;let s=n.cache_control;return!s||typeof s!="object"?!1:s.scope==="global"};if(Array.isArray(e.system)){for(let n of e.system)if(t(n))return!0}if(Array.isArray(e.tools)){for(let n of e.tools)if(t(n))return!0}return!1}collectCustomBetaFlags(){let e=this.contentGeneratorConfig.customHeaders;if(!e)return[];let t=[];for(let[n,s]of Object.entries(e))if(n.toLowerCase()==="anthropic-beta"&&!(typeof s!="string"||!s))for(let o of s.split(",")){let i=o.trim();i&&t.push(i)}return t}async buildRequest(e){let t=this.buildSamplingParameters(e),n=this.resolveEffectiveEffort(e),s=this.buildThinkingConfig(e,n),o=this.buildOutputConfig(e,n),i=Os(this.contentGeneratorConfig),a=i&&!!s,u=i&&!s,l=this.contentGeneratorConfig.enableCacheControl!==!1,y=this.useGlobalCacheScope(),g=e.config?.tools?await this.converter.convertGeminiToolsToAnthropic(e.config.tools,{enableCacheControl:l,useGlobalCacheScope:y}):void 0,h=y&&!!g&&g.length>0,_=y&&!h,{system:S,messages:k}=this.converter.convertGeminiRequestToAnthropic(e,{normalizeAssistantThinkingSignature:a,injectThinkingOnToolUseTurns:a,stripAssistantThinking:u,enableCacheControl:l,useGlobalCacheScope:_});return{model:this.contentGeneratorConfig.model,system:S,messages:k,tools:g,...t,...s?{thinking:s}:{},...o?{output_config:o}:{}}}buildSamplingParameters(e){let t=this.contentGeneratorConfig.samplingParams,n=e.config||{},s=(y,g)=>{let h=t?.[y],_=g?n[g]:void 0;return h!==void 0?h:_},o=s("max_tokens","maxOutputTokens"),i=this.contentGeneratorConfig.model,a=Tn(i,"output"),u=xn(i),l;if(o!=null)l=u?Math.min(o,a):o;else{let y=process.env.MATILDA_CODE_MAX_OUTPUT_TOKENS,g=y?parseInt(y,10):NaN;!isNaN(g)&&g>0?l=u?Math.min(g,a):g:l=Math.min(a,8e3)}return{max_tokens:l,temperature:s("temperature","temperature")??1,top_p:s("top_p","topP"),top_k:s("top_k","topK")}}resolveEffectiveEffort(e){if(e.config?.thinkingConfig?.includeThoughts===!1)return;let t=this.contentGeneratorConfig.reasoning;if(t===!1||t===void 0)return;let n=t.effort;if(n!==void 0)return n==="max"&&!kr(this.contentGeneratorConfig)?(this.effortClampWarned||(yn.warn("reasoning.effort='max' is a DeepSeek extension; clamping to 'high' for non-DeepSeek anthropic provider to avoid HTTP 400."),this.effortClampWarned=!0),"high"):n}modelSupportsAdaptiveThinking(){let t=(this.contentGeneratorConfig.model||"").toLowerCase().match(/claude-(?:opus|sonnet|haiku)-(\d+)-(\d+)/);if(!t)return!1;let n=Number.parseInt(t[1],10),s=Number.parseInt(t[2],10);return n>4||n===4&&s>=6}buildThinkingConfig(e,t){if(e.config?.thinkingConfig?.includeThoughts===!1)return;let n=this.contentGeneratorConfig.reasoning;return n===!1?void 0:n?.budget_tokens!==void 0?{type:"enabled",budget_tokens:n.budget_tokens}:this.modelSupportsAdaptiveThinking()?{type:"adaptive"}:{type:"enabled",budget_tokens:t==="low"?16e3:t==="max"?128e3:t==="high"?64e3:32e3}}buildOutputConfig(e,t){if(t!==void 0)return{effort:t}}async*redactStreamErrors(e){try{for await(let t of e)yield t}catch(t){throw we(t)}}async*processStream(e){let t,n=this.contentGeneratorConfig.model,s=0,o=0,i=0,a=0,u,l=!1,y=new Map,g=[];for await(let h of e)switch(h.type){case"message_start":{t=h.message.id??t,n=h.message.model??n,s=h.message.usage?.cache_read_input_tokens??s,o=h.message.usage?.cache_creation_input_tokens??o,i=h.message.usage?.input_tokens??i;break}case"content_block_start":{let _=h.index??0,S=String(h.content_block.type||"text"),k=S==="tool_use"&&"input"in h.content_block?JSON.stringify(h.content_block.input):"",m={type:S,id:"id"in h.content_block?h.content_block.id:void 0,name:"name"in h.content_block?h.content_block.name:void 0,inputJson:k!=="{}"?k:"",signature:S==="thinking"&&"signature"in h.content_block&&typeof h.content_block.signature=="string"?h.content_block.signature:"",jsonDepth:0,inJsonString:!1,jsonEscape:!1};m.inputJson&&Sr(m.inputJson,m),y.set(_,m);break}case"content_block_delta":{let _=h.index??0,S=h.delta.type||"",k=y.get(_);if(S==="text_delta"){let m="text"in h.delta?h.delta.text:"";if(m){let J=this.buildGeminiChunk({text:m},t,n);g.push(J),yield J}}else if(S==="thinking_delta"){let m=h.delta.thinking||"";if(m){let J=this.buildGeminiChunk({text:m,thought:!0},t,n);g.push(J),yield J}}else if(S==="signature_delta"&&k){let m=h.delta.signature||"";if(m){k.signature+=m;let J=this.buildGeminiChunk({thought:!0,thoughtSignature:m},t,n);g.push(J),yield J}}else if(S==="input_json_delta"&&k){let m=h.delta.partial_json||"";m&&(k.inputJson+=m,Sr(m,k))}break}case"content_block_stop":{let _=h.index??0,S=y.get(_);if(S?.type==="tool_use")if(Ls(S))l=!0;else{let k=js(S.inputJson);if(k!==void 0){let m=this.buildGeminiChunk({functionCall:{id:S.id,name:S.name,args:k}},t,n);g.push(m),yield m}}y.delete(_);break}case"message_delta":{let _=h.delta.stop_reason;_&&(u=_),l&&u!=="max_tokens"&&(u="max_tokens");let S=h.usage,k=S&&typeof S=="object"?S:void 0;if(h.usage?.output_tokens!==void 0&&(a=h.usage.output_tokens),k?.input_tokens!==void 0){let m=k.input_tokens;typeof m=="number"&&(i=m)}if(k?.cache_read_input_tokens!==void 0){let m=k.cache_read_input_tokens;typeof m=="number"&&(s=m)}if(k?.cache_creation_input_tokens!==void 0){let m=k.cache_creation_input_tokens;typeof m=="number"&&(o=m)}if(u||h.usage){let m=this.buildGeminiChunk(void 0,t,n,u,Ye({inputTokens:i,cacheReadTokens:s,cacheCreationTokens:o,outputTokens:a}));g.push(m),yield m}break}case"message_stop":{if(l&&u!=="max_tokens"&&(u="max_tokens"),i||a){let _=this.buildGeminiChunk(void 0,t,n,u,Ye({inputTokens:i,cacheReadTokens:s,cacheCreationTokens:o,outputTokens:a}));g.push(_),yield _}break}default:break}}async*processStreamWithEmptyFallback(e,t,n,s){let o=!1,i=!1;for await(let u of this.processStream(e)){let l=u.candidates??[];i||=l.some(y=>y.finishReason!==void 0),o||=l.some(y=>y.content?.parts?.some(g=>g.text||g.thought||g.thoughtSignature||g.functionCall)),yield u}if(o||i)return;yn.warn("Anthropic stream ended without assistant payload or finish reason; probing once with a non-streaming request to surface provider errors.");let a;try{nt.recordAnthropicWireRequest(t),a=await this.client.messages.create(t,{signal:n,...s?{headers:s}:{}}),yield this.converter.convertAnthropicResponseToGemini(a)}catch(u){throw we(u)}}buildGeminiChunk(e,t,n,s,o){let i=new tt;i.responseId=t,i.createTime=Date.now().toString(),i.modelVersion=n||this.contentGeneratorConfig.model,i.promptFeedback={safetyRatings:[]};let a=e?[e]:[],u=s!==void 0?this.converter.mapAnthropicFinishReasonToGemini(s):void 0;return i.candidates=[{content:{parts:a,role:"model"},index:0,safetyRatings:[],...u?{finishReason:u}:{}}],o&&(i.usageMetadata=o),i}};function Sc(r,e){return new Ze(r,e)}export{Ze as AnthropicContentGenerator,Sc as createAnthropicContentGenerator};
25
+ `)||""}extractFunctionResponseContent(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){let t=e,n=t.output;if(typeof n=="string")return n;let s=t.error;if(typeof s=="string")return s}try{return JSON.stringify(e)??String(e)}catch{return String(e)}}safeInputToArgs(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:typeof e=="string"?wn(e):e==null?{}:null}mapAnthropicFinishReasonToGemini(e){return e?{end_turn:ee.STOP,stop_sequence:ee.STOP,tool_use:ee.STOP,max_tokens:ee.MAX_TOKENS,content_filter:ee.SAFETY}[e]||ee.FINISH_REASON_UNSPECIFIED:void 0}isContentObject(e){return typeof e=="object"&&e!==null&&"role"in e&&"parts"in e&&Array.isArray(e.parts)}buildSystemWithCacheControl(e,t){return e&&[{type:"text",text:e,cache_control:t?{type:"ephemeral",scope:"global"}:{type:"ephemeral"}}]}stripThinkingFromAssistantMessages(e){for(let t of e){if(t.role!=="assistant"||!Array.isArray(t.content))continue;let n=t.content.filter(s=>{let o=s.type;return o!=="thinking"&&o!=="redacted_thinking"});n.length!==0&&n.length!==t.content.length&&(t.content=n)}}fillMissingThinkingSignatures(e){for(let t of e){if(t.role!=="assistant"||!Array.isArray(t.content))continue;let n=!1,s=t.content.map(o=>{let i=o;return i.type==="thinking"&&typeof i.signature!="string"?(n=!0,{...o,signature:""}):o});n&&(t.content=s)}}injectEmptyThinkingOnToolUseTurns(e){for(let t of e){if(t.role!=="assistant"||!Array.isArray(t.content))continue;let n=t.content;if(!n.some(a=>a.type==="tool_use")||n.some(a=>{let u=a.type;return u==="thinking"||u==="redacted_thinking"}))continue;let i={type:"thinking",thinking:"",signature:""};t.content=[i,...n]}}addCacheControlToMessages(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role==="user"){let s=Array.isArray(n.content)?n.content:[{type:"text",text:n.content}];if(s.length>0){let o=s[s.length-1];if(typeof o=="object"&&"type"in o){let i=o.type,a=i==="text"&&(!("text"in o)||!o.text);(i==="text"||i==="tool_result")&&!a&&(o.cache_control={type:"ephemeral"})}n.content=s}break}}}};var yn=_n("ANTHROPIC");function kr(r){let e=r.baseUrl??"";if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t==="api.deepseek.com"||t.endsWith(".api.deepseek.com")}catch{return!1}}function Os(r){return kr(r)?!0:(r.model??"").toLowerCase().includes("deepseek")}function Bs(r){let e=r.baseUrl?.trim();if(e)return e;let t=process.env.ANTHROPIC_BASE_URL?.trim();return t||"https://api.anthropic.com"}function wr(r){try{let e=new URL(Bs(r)).hostname.toLowerCase();return e==="api.anthropic.com"||e.endsWith(".anthropic.com")}catch{return!1}}function Sr(r,e){for(let t of r){if(e.jsonEscape){e.jsonEscape=!1;continue}if(t==="\\"&&e.inJsonString){e.jsonEscape=!0;continue}if(t==='"'){e.inJsonString=!e.inJsonString;continue}e.inJsonString||(t==="{"||t==="["?e.jsonDepth+=1:(t==="}"||t==="]")&&e.jsonDepth>0&&(e.jsonDepth-=1))}}function Ls(r){return r.jsonDepth>0||r.inJsonString}function js(r){let e=r.trim();if(!e)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{let t=Sn(e);if(t&&t!==e)try{let n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n))return n}catch{}return}}var Ze=class{constructor(e,t){this.contentGeneratorConfig=e;this.cliConfig=t;let n=!wr(e),s=this.buildHeaders(n),o=e.baseUrl,i=An("anthropic",this.cliConfig.getProxy());this.client=new _r({...n?{authToken:e.apiKey,apiKey:null}:{apiKey:e.apiKey,authToken:null},baseURL:o,timeout:e.timeout||6e5,maxRetries:e.maxRetries,defaultHeaders:s,...i}),this.converter=new Lt(e.model,e.schemaCompliance,e.enableCacheControl)}client;converter;effortClampWarned=!1;async generateContent(e){let t;try{let n=await this.buildRequest(e);nt.recordAnthropicWireRequest(n);let s=this.buildPerRequestHeaders(n);t=await this.client.messages.create(n,{signal:e.config?.abortSignal,...s?{headers:s}:{}})}catch(n){throw we(n)}return this.converter.convertAnthropicResponseToGemini(t)}async generateContentStream(e){let t=await this.buildRequest(e),n=this.buildPerRequestHeaders(t),s={...t,stream:!0};nt.recordAnthropicWireRequest(s);let o;try{o=await this.client.messages.create(s,{signal:e.config?.abortSignal,...n?{headers:n}:{}})}catch(i){throw we(i)}return this.processStreamWithEmptyFallback(this.redactStreamErrors(o),t,e.config?.abortSignal,n)}async countTokens(e){try{return{totalTokens:(await new En().calculateTokens(e)).totalTokens}}catch(t){yn.warn("Failed to calculate tokens with tokenizer, falling back to simple method:",t);let n=JSON.stringify(e.contents);return{totalTokens:Math.ceil(n.length/4)}}}async embedContent(e){throw new Error("Anthropic does not support embeddings.")}useSummarizedThinking(){return!1}buildHeaders(e){let t=this.cliConfig.getCliVersion()||"unknown",n=e?`claude-cli/${t} (external, cli)`:`MatildaCode/${t} (${process.platform}; ${process.arch})`,{customHeaders:s}=this.contentGeneratorConfig,o={"User-Agent":n};if(e&&(o["x-app"]="cli"),s)for(let[i,a]of Object.entries(s))i.toLowerCase()==="anthropic-beta"||bn(i)||(o[i]=a);return o}buildPerRequestHeaders(e){let t=[];for(let s of this.collectCustomBetaFlags())t.push(s);return e.thinking&&t.push("interleaved-thinking-2025-05-14"),e.output_config&&t.push("effort-2025-11-24"),this.hasGlobalCacheScopeOnWire(e)&&t.push("prompt-caching-scope-2026-01-05"),t.length===0?void 0:{"anthropic-beta":Array.from(new Set(t)).join(",")}}useGlobalCacheScope(){return this.contentGeneratorConfig.enableCacheControl!==!1&&wr(this.contentGeneratorConfig)}hasGlobalCacheScopeOnWire(e){let t=n=>{if(!n||typeof n!="object")return!1;let s=n.cache_control;return!s||typeof s!="object"?!1:s.scope==="global"};if(Array.isArray(e.system)){for(let n of e.system)if(t(n))return!0}if(Array.isArray(e.tools)){for(let n of e.tools)if(t(n))return!0}return!1}collectCustomBetaFlags(){let e=this.contentGeneratorConfig.customHeaders;if(!e)return[];let t=[];for(let[n,s]of Object.entries(e))if(n.toLowerCase()==="anthropic-beta"&&!(typeof s!="string"||!s))for(let o of s.split(",")){let i=o.trim();i&&t.push(i)}return t}async buildRequest(e){let t=this.buildSamplingParameters(e),n=this.resolveEffectiveEffort(e),s=this.buildThinkingConfig(e,n),o=this.buildOutputConfig(e,n),i=Os(this.contentGeneratorConfig),a=i&&!!s,u=i&&!s,l=this.contentGeneratorConfig.enableCacheControl!==!1,y=this.useGlobalCacheScope(),g=e.config?.tools?await this.converter.convertGeminiToolsToAnthropic(e.config.tools,{enableCacheControl:l,useGlobalCacheScope:y}):void 0,h=y&&!!g&&g.length>0,_=y&&!h,{system:S,messages:k}=this.converter.convertGeminiRequestToAnthropic(e,{normalizeAssistantThinkingSignature:a,injectThinkingOnToolUseTurns:a,stripAssistantThinking:u,enableCacheControl:l,useGlobalCacheScope:_});return{model:this.contentGeneratorConfig.model,system:S,messages:k,tools:g,...t,...s?{thinking:s}:{},...o?{output_config:o}:{}}}buildSamplingParameters(e){let t=this.contentGeneratorConfig.samplingParams,n=e.config||{},s=(y,g)=>{let h=t?.[y],_=g?n[g]:void 0;return h!==void 0?h:_},o=s("max_tokens","maxOutputTokens"),i=this.contentGeneratorConfig.model,a=Tn(i,"output"),u=xn(i),l;if(o!=null)l=u?Math.min(o,a):o;else{let y=process.env.MATILDA_CODE_MAX_OUTPUT_TOKENS,g=y?parseInt(y,10):NaN;!isNaN(g)&&g>0?l=u?Math.min(g,a):g:l=Math.min(a,8e3)}return{max_tokens:l,temperature:s("temperature","temperature")??1,top_p:s("top_p","topP"),top_k:s("top_k","topK")}}resolveEffectiveEffort(e){if(e.config?.thinkingConfig?.includeThoughts===!1)return;let t=this.contentGeneratorConfig.reasoning;if(t===!1||t===void 0)return;let n=t.effort;if(n!==void 0)return n==="max"&&!kr(this.contentGeneratorConfig)?(this.effortClampWarned||(yn.warn("reasoning.effort='max' is a DeepSeek extension; clamping to 'high' for non-DeepSeek anthropic provider to avoid HTTP 400."),this.effortClampWarned=!0),"high"):n}modelSupportsAdaptiveThinking(){let t=(this.contentGeneratorConfig.model||"").toLowerCase().match(/claude-(?:opus|sonnet|haiku)-(\d+)-(\d+)/);if(!t)return!1;let n=Number.parseInt(t[1],10),s=Number.parseInt(t[2],10);return n>4||n===4&&s>=6}buildThinkingConfig(e,t){if(e.config?.thinkingConfig?.includeThoughts===!1)return;let n=this.contentGeneratorConfig.reasoning;return n===!1?void 0:n?.budget_tokens!==void 0?{type:"enabled",budget_tokens:n.budget_tokens}:this.modelSupportsAdaptiveThinking()?{type:"adaptive"}:{type:"enabled",budget_tokens:t==="low"?16e3:t==="max"?128e3:t==="high"?64e3:32e3}}buildOutputConfig(e,t){if(t!==void 0)return{effort:t}}async*redactStreamErrors(e){try{for await(let t of e)yield t}catch(t){throw we(t)}}async*processStream(e){let t,n=this.contentGeneratorConfig.model,s=0,o=0,i=0,a=0,u,l=!1,y=new Map,g=[];for await(let h of e)switch(h.type){case"message_start":{t=h.message.id??t,n=h.message.model??n,s=h.message.usage?.cache_read_input_tokens??s,o=h.message.usage?.cache_creation_input_tokens??o,i=h.message.usage?.input_tokens??i;break}case"content_block_start":{let _=h.index??0,S=String(h.content_block.type||"text"),k=S==="tool_use"&&"input"in h.content_block?JSON.stringify(h.content_block.input):"",m={type:S,id:"id"in h.content_block?h.content_block.id:void 0,name:"name"in h.content_block?h.content_block.name:void 0,inputJson:k!=="{}"?k:"",signature:S==="thinking"&&"signature"in h.content_block&&typeof h.content_block.signature=="string"?h.content_block.signature:"",jsonDepth:0,inJsonString:!1,jsonEscape:!1};m.inputJson&&Sr(m.inputJson,m),y.set(_,m);break}case"content_block_delta":{let _=h.index??0,S=h.delta.type||"",k=y.get(_);if(S==="text_delta"){let m="text"in h.delta?h.delta.text:"";if(m){let J=this.buildGeminiChunk({text:m},t,n);g.push(J),yield J}}else if(S==="thinking_delta"){let m=h.delta.thinking||"";if(m){let J=this.buildGeminiChunk({text:m,thought:!0},t,n);g.push(J),yield J}}else if(S==="signature_delta"&&k){let m=h.delta.signature||"";if(m){k.signature+=m;let J=this.buildGeminiChunk({thought:!0,thoughtSignature:m},t,n);g.push(J),yield J}}else if(S==="input_json_delta"&&k){let m=h.delta.partial_json||"";m&&(k.inputJson+=m,Sr(m,k))}break}case"content_block_stop":{let _=h.index??0,S=y.get(_);if(S?.type==="tool_use")if(Ls(S))l=!0;else{let k=js(S.inputJson);if(k!==void 0){let m=this.buildGeminiChunk({functionCall:{id:S.id,name:S.name,args:k}},t,n);g.push(m),yield m}}y.delete(_);break}case"message_delta":{let _=h.delta.stop_reason;_&&(u=_),l&&u!=="max_tokens"&&(u="max_tokens");let S=h.usage,k=S&&typeof S=="object"?S:void 0;if(h.usage?.output_tokens!==void 0&&(a=h.usage.output_tokens),k?.input_tokens!==void 0){let m=k.input_tokens;typeof m=="number"&&(i=m)}if(k?.cache_read_input_tokens!==void 0){let m=k.cache_read_input_tokens;typeof m=="number"&&(s=m)}if(k?.cache_creation_input_tokens!==void 0){let m=k.cache_creation_input_tokens;typeof m=="number"&&(o=m)}if(u||h.usage){let m=this.buildGeminiChunk(void 0,t,n,u,Ye({inputTokens:i,cacheReadTokens:s,cacheCreationTokens:o,outputTokens:a}));g.push(m),yield m}break}case"message_stop":{if(l&&u!=="max_tokens"&&(u="max_tokens"),i||a){let _=this.buildGeminiChunk(void 0,t,n,u,Ye({inputTokens:i,cacheReadTokens:s,cacheCreationTokens:o,outputTokens:a}));g.push(_),yield _}break}default:break}}async*processStreamWithEmptyFallback(e,t,n,s){let o=!1,i=!1;for await(let u of this.processStream(e)){let l=u.candidates??[];i||=l.some(y=>y.finishReason!==void 0),o||=l.some(y=>y.content?.parts?.some(g=>g.text||g.thought||g.thoughtSignature||g.functionCall)),yield u}if(o||i)return;yn.warn("Anthropic stream ended without assistant payload or finish reason; probing once with a non-streaming request to surface provider errors.");let a;try{nt.recordAnthropicWireRequest(t),a=await this.client.messages.create(t,{signal:n,...s?{headers:s}:{}}),yield this.converter.convertAnthropicResponseToGemini(a)}catch(u){throw we(u)}}buildGeminiChunk(e,t,n,s,o){let i=new tt;i.responseId=t,i.createTime=Date.now().toString(),i.modelVersion=n||this.contentGeneratorConfig.model,i.promptFeedback={safetyRatings:[]};let a=e?[e]:[],u=s!==void 0?this.converter.mapAnthropicFinishReasonToGemini(s):void 0;return i.candidates=[{content:{parts:a,role:"model"},index:0,safetyRatings:[],...u?{finishReason:u}:{}}],o&&(i.usageMetadata=o),i}};function Sc(r,e){return new Ze(r,e)}export{Ze as AnthropicContentGenerator,Sc as createAnthropicContentGenerator};
26
26
  /**
27
27
  * @license
28
28
  * Copyright 2025 Matilda
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{a as r}from"./chunk-ILBTI4K5.js";import"./chunk-47XR7IMP.js";import{g as m,i as h,p as f,q as g}from"./chunk-T4P4KEDW.js";import{ba as d}from"./chunk-MH2P4YXC.js";import"./chunk-FWDMPRKU.js";import{b as p}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";p();var a=d("ASK_USER_QUESTION"),b=`Use this tool when you need to ask the user questions during execution. This allows you to:
3
+ import{a as r}from"./chunk-ILBTI4K5.js";import"./chunk-47XR7IMP.js";import{g as m,i as h,p as f,q as g}from"./chunk-TWJLOEAI.js";import{ba as d}from"./chunk-27Q5KW3A.js";import"./chunk-FWDMPRKU.js";import{b as p}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";p();var a=d("ASK_USER_QUESTION"),b=`Use this tool when you need to ask the user questions during execution. This allows you to:
4
4
  1. Gather user preferences or requirements
5
5
  2. Clarify ambiguous instructions
6
6
  3. Get decisions on implementation choices as you work