@humain/humain-code 0.4.14 → 0.4.17

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 (315) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +1 -1
  3. package/dist/bundle/agent-monitor.js +1 -1
  4. package/dist/bundle/chunks/anthropic-messages-TSNY5MWH.js +67 -0
  5. package/dist/bundle/chunks/azure-openai-responses-Z4DCXO2G.js +15 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +59 -42
  7. package/dist/bundle/chunks/{chunk-HDA2IGKA.js → chunk-4NFYTS4C.js} +8 -8
  8. package/dist/bundle/chunks/{chunk-MF2NEHP4.js → chunk-4XU7TDAL.js} +939 -560
  9. package/dist/bundle/chunks/{chunk-LUL775V7.js → chunk-5K5RFXXO.js} +4 -4
  10. package/dist/bundle/chunks/chunk-65U7MPF4.js +1790 -0
  11. package/dist/bundle/chunks/{chunk-AIXI6RIE.js → chunk-7PRU6YW3.js} +114 -82
  12. package/dist/bundle/chunks/{chunk-KA7K6ECX.js → chunk-AOL6QG6L.js} +2254 -2416
  13. package/dist/bundle/chunks/chunk-AWCJWXGD.js +212 -0
  14. package/dist/bundle/chunks/{chunk-NNKA2PAP.js → chunk-FHVNUUBF.js} +1 -1
  15. package/dist/bundle/chunks/chunk-FZUJXM6D.js +816 -0
  16. package/dist/bundle/chunks/chunk-IJYVMOB4.js +6 -0
  17. package/dist/bundle/chunks/chunk-LG2PJ6JN.js +131 -0
  18. package/dist/bundle/chunks/chunk-NCQ6WAQK.js +125 -0
  19. package/dist/bundle/chunks/{chunk-Z74ZYQPX.js → chunk-OKALNPTJ.js} +80 -210
  20. package/dist/bundle/chunks/{chunk-OX2IBCCA.js → chunk-PTP2ZHFQ.js} +88 -82
  21. package/dist/bundle/chunks/chunk-PY7SOXCA.js +10 -0
  22. package/dist/bundle/chunks/chunk-Q7VXYXY3.js +7 -0
  23. package/dist/bundle/chunks/{chunk-COF5P635.js → chunk-QEF72EIZ.js} +13 -13
  24. package/dist/bundle/chunks/{chunk-EYIYBQAR.js → chunk-RXOCQRBG.js} +1 -1
  25. package/dist/bundle/chunks/{chunk-BVHXWQLD.js → chunk-SCBU5WOP.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-UDVC7A5S.js → chunk-TIFFHHW6.js} +16 -14
  27. package/dist/bundle/chunks/{chunk-L3J4P5JR.js → chunk-UGJAAWNC.js} +1 -1
  28. package/dist/bundle/chunks/chunk-V76YPIMT.js +48 -0
  29. package/dist/bundle/chunks/{chunk-Y3RFGBG2.js → chunk-X3O5MCKJ.js} +1 -1
  30. package/dist/bundle/chunks/{chunk-KK3KUUMM.js → chunk-X6OTEVGA.js} +71 -66
  31. package/dist/bundle/chunks/chunk-Y26OS23T.js +80 -0
  32. package/dist/bundle/chunks/chunk-YDBNMIA3.js +34 -0
  33. package/dist/bundle/chunks/{chunk-UHLW4KJ7.js → chunk-ZRGFX6T6.js} +92 -89
  34. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-JGN7NZCV.js → cloudflare-workers-ai-system-one-MUJQ6LT2.js} +1 -1
  35. package/dist/bundle/chunks/{compat-OQMUE3QD.js → compat-ARQPWKBQ.js} +8 -8
  36. package/dist/bundle/chunks/{dist-65YQEF26.js → dist-D7M52E3X.js} +1733 -1053
  37. package/dist/bundle/chunks/dist-LKDZAEUQ.js +7 -0
  38. package/dist/bundle/chunks/{dist-JXEXN6S2.js → dist-XVXV2CL4.js} +1 -1
  39. package/dist/bundle/chunks/dist-cjs-AXBW3N4F.js +182 -0
  40. package/dist/bundle/chunks/{easter-egg-3d-ZJ2JUFOA.js → easter-egg-3d-4SUPLBUF.js} +1 -1
  41. package/dist/bundle/chunks/{execute-LRTXH4YJ.js → execute-NTO3U76E.js} +10 -9
  42. package/dist/bundle/chunks/{extract-OZW5JHG6.js → extract-BKBHK4AK.js} +14 -13
  43. package/dist/bundle/chunks/github-copilot.js +34 -47
  44. package/dist/bundle/chunks/{google-generative-ai-YXXFSTX7.js → google-generative-ai-SJ4JO2MY.js} +2 -2
  45. package/dist/bundle/chunks/{google-vertex-3IVWLYJ5.js → google-vertex-KNLNNDET.js} +2 -2
  46. package/dist/bundle/chunks/host-63SNKK5Y.js +2 -0
  47. package/dist/bundle/chunks/jiti-static-loader-7OZNBOCI.js +2 -0
  48. package/dist/bundle/chunks/{mistral-conversations-Y7GWO3QB.js → mistral-conversations-G3GN6CMT.js} +20 -20
  49. package/dist/bundle/chunks/{node-SPBTZUUS.js → node-DZCAT4Q6.js} +1 -1
  50. package/dist/bundle/chunks/{openai-codex-responses-NSXWHIDT.js → openai-codex-responses-FJFDAWHI.js} +17 -17
  51. package/dist/bundle/chunks/openai-completions-IC7WRLTI.js +82 -0
  52. package/dist/bundle/chunks/{openai-decisions-QWEISDVO.js → openai-decisions-HESOHYZB.js} +1 -1
  53. package/dist/bundle/chunks/openai-responses-XXCYDFSM.js +24 -0
  54. package/dist/bundle/chunks/{openrouter-images-BMVMAROU.js → openrouter-images-DT2HMZNO.js} +1 -1
  55. package/dist/bundle/chunks/pdfjs-EK6K7CXX.js +3593 -0
  56. package/dist/bundle/chunks/{pi-messages-XNEG23NU.js → pi-messages-SAOV3JNW.js} +1 -1
  57. package/dist/bundle/chunks/{typesafe-system-one-62YHYXZV.js → typesafe-system-one-HCMGHK6A.js} +1 -1
  58. package/dist/bundle/chunks/{undici-7EW63V4X.js → undici-N4LWJ3S3.js} +1 -1
  59. package/dist/bundle/chunks/virtual-modules-LP2ULVLW.js +5 -0
  60. package/dist/bundle/cli-runtime.js +3 -3
  61. package/dist/bundle/cli.js +2 -2
  62. package/dist/bundle/flow/package.json +6 -5
  63. package/dist/bundle/index.js +8 -8
  64. package/dist/bundle/rpc-entry.js +3 -3
  65. package/dist/cli/credential-print.d.ts.map +1 -1
  66. package/dist/cli/credential-print.js +4 -4
  67. package/dist/cli/credential-print.js.map +1 -1
  68. package/dist/coordination/adapter/index.d.ts.map +1 -1
  69. package/dist/coordination/adapter/index.js +1 -1
  70. package/dist/coordination/adapter/index.js.map +1 -1
  71. package/dist/coordination/adapter/integration-notices.d.ts +1 -1
  72. package/dist/coordination/adapter/integration-notices.d.ts.map +1 -1
  73. package/dist/coordination/adapter/integration-notices.js +5 -2
  74. package/dist/coordination/adapter/integration-notices.js.map +1 -1
  75. package/dist/coordination/broker/extension-state.js +3 -3
  76. package/dist/coordination/broker/extension-state.js.map +1 -1
  77. package/dist/coordination/transport/framing.d.ts.map +1 -1
  78. package/dist/coordination/transport/framing.js +2 -1
  79. package/dist/coordination/transport/framing.js.map +1 -1
  80. package/dist/core/account-reporting.d.ts +3 -1
  81. package/dist/core/account-reporting.d.ts.map +1 -1
  82. package/dist/core/account-reporting.js +12 -2
  83. package/dist/core/account-reporting.js.map +1 -1
  84. package/dist/core/agent-session-services.d.ts.map +1 -1
  85. package/dist/core/agent-session-services.js +39 -36
  86. package/dist/core/agent-session-services.js.map +1 -1
  87. package/dist/core/agent-session.d.ts +4 -2
  88. package/dist/core/agent-session.d.ts.map +1 -1
  89. package/dist/core/agent-session.js +5 -4
  90. package/dist/core/agent-session.js.map +1 -1
  91. package/dist/core/codex-usage.d.ts +11 -2
  92. package/dist/core/codex-usage.d.ts.map +1 -1
  93. package/dist/core/codex-usage.js +74 -2
  94. package/dist/core/codex-usage.js.map +1 -1
  95. package/dist/core/export-html/template.js +21 -16
  96. package/dist/core/model-config.d.ts +33 -8
  97. package/dist/core/model-config.d.ts.map +1 -1
  98. package/dist/core/model-config.js +22 -4
  99. package/dist/core/model-config.js.map +1 -1
  100. package/dist/core/model-resolver.d.ts +56 -43
  101. package/dist/core/model-resolver.d.ts.map +1 -1
  102. package/dist/core/model-resolver.js +256 -361
  103. package/dist/core/model-resolver.js.map +1 -1
  104. package/dist/core/model-runtime.d.ts +6 -3
  105. package/dist/core/model-runtime.d.ts.map +1 -1
  106. package/dist/core/model-runtime.js +19 -5
  107. package/dist/core/model-runtime.js.map +1 -1
  108. package/dist/core/models-store.d.ts.map +1 -1
  109. package/dist/core/models-store.js +7 -2
  110. package/dist/core/models-store.js.map +1 -1
  111. package/dist/core/oauth-account-pool.d.ts +9 -1
  112. package/dist/core/oauth-account-pool.d.ts.map +1 -1
  113. package/dist/core/oauth-account-pool.js +63 -12
  114. package/dist/core/oauth-account-pool.js.map +1 -1
  115. package/dist/core/prompt-templates.d.ts.map +1 -1
  116. package/dist/core/prompt-templates.js +7 -2
  117. package/dist/core/prompt-templates.js.map +1 -1
  118. package/dist/core/settings-defaults.d.ts +2 -0
  119. package/dist/core/settings-defaults.d.ts.map +1 -1
  120. package/dist/core/settings-defaults.js +2 -0
  121. package/dist/core/settings-defaults.js.map +1 -1
  122. package/dist/core/settings-manager.d.ts +4 -2
  123. package/dist/core/settings-manager.d.ts.map +1 -1
  124. package/dist/core/settings-manager.js +11 -0
  125. package/dist/core/settings-manager.js.map +1 -1
  126. package/dist/core/settings-schema.d.ts +4 -0
  127. package/dist/core/settings-schema.d.ts.map +1 -1
  128. package/dist/core/settings-schema.js +8 -0
  129. package/dist/core/settings-schema.js.map +1 -1
  130. package/dist/core/slash-commands.js +1 -1
  131. package/dist/core/slash-commands.js.map +1 -1
  132. package/dist/core/tools/render-utils.d.ts +2 -0
  133. package/dist/core/tools/render-utils.d.ts.map +1 -1
  134. package/dist/core/tools/render-utils.js +21 -0
  135. package/dist/core/tools/render-utils.js.map +1 -1
  136. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  137. package/dist/core/tools/renderers/read.js +7 -10
  138. package/dist/core/tools/renderers/read.js.map +1 -1
  139. package/dist/core/tools/subagent.d.ts.map +1 -1
  140. package/dist/core/tools/subagent.js +4 -7
  141. package/dist/core/tools/subagent.js.map +1 -1
  142. package/dist/core/trace/redaction.d.ts.map +1 -1
  143. package/dist/core/trace/redaction.js +3 -1
  144. package/dist/core/trace/redaction.js.map +1 -1
  145. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  146. package/dist/extensions/codemode/execute.js +12 -0
  147. package/dist/extensions/codemode/execute.js.map +1 -1
  148. package/dist/extensions/codemode/index.d.ts.map +1 -1
  149. package/dist/extensions/codemode/index.js +5 -0
  150. package/dist/extensions/codemode/index.js.map +1 -1
  151. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +74 -20
  152. package/dist/humain/flow-accounts-host.d.ts.map +1 -1
  153. package/dist/humain/flow-accounts-host.js +3 -0
  154. package/dist/humain/flow-accounts-host.js.map +1 -1
  155. package/dist/humain/flow-command.d.ts +1 -1
  156. package/dist/humain/flow-command.d.ts.map +1 -1
  157. package/dist/humain/flow-command.js +8 -1
  158. package/dist/humain/flow-command.js.map +1 -1
  159. package/dist/humain/flow-loader.js +1 -1
  160. package/dist/humain/flow-loader.js.map +1 -1
  161. package/dist/humain/node-provider.d.ts.map +1 -1
  162. package/dist/humain/node-provider.js +2 -0
  163. package/dist/humain/node-provider.js.map +1 -1
  164. package/dist/humain/trace-capture/index.js +3 -3
  165. package/dist/humain/trace-capture/index.js.map +1 -1
  166. package/dist/humain/web-access/vendor/credential-source.d.ts +2 -0
  167. package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
  168. package/dist/humain/web-access/vendor/credential-source.js +50 -4
  169. package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
  170. package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
  171. package/dist/humain/web-access/vendor/curator-page.js +3 -1
  172. package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
  173. package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
  174. package/dist/humain/web-access/vendor/curator-server.js +2 -0
  175. package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
  176. package/dist/humain/web-access/vendor/deepseek.d.ts +4 -0
  177. package/dist/humain/web-access/vendor/deepseek.d.ts.map +1 -0
  178. package/dist/humain/web-access/vendor/deepseek.js +201 -0
  179. package/dist/humain/web-access/vendor/deepseek.js.map +1 -0
  180. package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
  181. package/dist/humain/web-access/vendor/extract.js +4 -2
  182. package/dist/humain/web-access/vendor/extract.js.map +1 -1
  183. package/dist/humain/web-access/vendor/gemini-adc.d.ts.map +1 -1
  184. package/dist/humain/web-access/vendor/gemini-adc.js +49 -5
  185. package/dist/humain/web-access/vendor/gemini-adc.js.map +1 -1
  186. package/dist/humain/web-access/vendor/gemini-search.d.ts +3 -3
  187. package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
  188. package/dist/humain/web-access/vendor/gemini-search.js +11 -4
  189. package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
  190. package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
  191. package/dist/humain/web-access/vendor/index.js +16 -1
  192. package/dist/humain/web-access/vendor/index.js.map +1 -1
  193. package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
  194. package/dist/humain/web-access/vendor/page-query.js +12 -6
  195. package/dist/humain/web-access/vendor/page-query.js.map +1 -1
  196. package/dist/humain/web-access/vendor/query-rewrite.d.ts.map +1 -1
  197. package/dist/humain/web-access/vendor/query-rewrite.js +11 -4
  198. package/dist/humain/web-access/vendor/query-rewrite.js.map +1 -1
  199. package/dist/humain/web-access/vendor/searxng.d.ts.map +1 -1
  200. package/dist/humain/web-access/vendor/searxng.js +2 -1
  201. package/dist/humain/web-access/vendor/searxng.js.map +1 -1
  202. package/dist/humain/web-access/vendor/ssrf-protection.d.ts +1 -0
  203. package/dist/humain/web-access/vendor/ssrf-protection.d.ts.map +1 -1
  204. package/dist/humain/web-access/vendor/ssrf-protection.js +10 -0
  205. package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
  206. package/dist/humain/web-access/vendor/summary-review.d.ts.map +1 -1
  207. package/dist/humain/web-access/vendor/summary-review.js +17 -6
  208. package/dist/humain/web-access/vendor/summary-review.js.map +1 -1
  209. package/dist/humain/web-access/vendor/utils.d.ts +2 -0
  210. package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
  211. package/dist/humain/web-access/vendor/utils.js +18 -0
  212. package/dist/humain/web-access/vendor/utils.js.map +1 -1
  213. package/dist/humain/web-access/vendor/web-tool-core.d.ts +2 -0
  214. package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
  215. package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
  216. package/dist/index.d.ts +1 -0
  217. package/dist/index.d.ts.map +1 -1
  218. package/dist/index.js.map +1 -1
  219. package/dist/main.d.ts.map +1 -1
  220. package/dist/main.js +1 -0
  221. package/dist/main.js.map +1 -1
  222. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  223. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  224. package/dist/modes/interactive/components/settings-selector.js +10 -0
  225. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  226. package/dist/modes/interactive/components/status-indicator.d.ts +5 -0
  227. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  228. package/dist/modes/interactive/components/status-indicator.js +27 -2
  229. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  230. package/dist/modes/interactive/components/tool-execution.d.ts +2 -1
  231. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  232. package/dist/modes/interactive/components/tool-execution.js +4 -2
  233. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  234. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  235. package/dist/modes/interactive/components/tree-selector.js +2 -9
  236. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  237. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  238. package/dist/modes/interactive/interactive-mode.js +28 -14
  239. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  240. package/dist/modes/interactive/oauth-account-format.d.ts +4 -4
  241. package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
  242. package/dist/modes/interactive/oauth-account-format.js +5 -2
  243. package/dist/modes/interactive/oauth-account-format.js.map +1 -1
  244. package/dist/modes/interactive/session-share.d.ts.map +1 -1
  245. package/dist/modes/interactive/session-share.js +9 -2
  246. package/dist/modes/interactive/session-share.js.map +1 -1
  247. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  248. package/dist/modes/rpc/rpc-mode.js +16 -4
  249. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  250. package/dist/utils/tools-manager.d.ts.map +1 -1
  251. package/dist/utils/tools-manager.js +2 -1
  252. package/dist/utils/tools-manager.js.map +1 -1
  253. package/docs/cli.md +3 -3
  254. package/docs/codemode.md +3 -1
  255. package/docs/coordination.md +6 -0
  256. package/docs/docs.json +4 -0
  257. package/docs/environment-variables.md +4 -0
  258. package/docs/flow.md +20 -2
  259. package/docs/humain-code-forge-flow-walkthrough.md +1 -1
  260. package/docs/humain-code.md +2 -4
  261. package/docs/json.md +2 -2
  262. package/docs/llama-cpp.md +1 -1
  263. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  264. package/docs/rpc-commands.md +1 -1
  265. package/docs/rpc.md +9 -1
  266. package/docs/sessions.md +1 -1
  267. package/docs/settings.md +2 -0
  268. package/docs/trace.md +4 -0
  269. package/docs/usage.md +1 -1
  270. package/examples/extensions/custom-provider-anthropic/package-lock.json +16 -6
  271. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  272. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  273. package/examples/extensions/gondolin/package-lock.json +16 -16
  274. package/examples/extensions/gondolin/package.json +1 -1
  275. package/examples/extensions/minimal-mode.ts +4 -4
  276. package/examples/extensions/sandbox/package-lock.json +6 -6
  277. package/examples/extensions/sandbox/package.json +2 -2
  278. package/examples/extensions/with-deps/package-lock.json +2 -2
  279. package/examples/extensions/with-deps/package.json +1 -1
  280. package/examples/plugins/pi-example-plugin/package.json +2 -2
  281. package/examples/rpc-subagent-progress-host.ts +6 -2
  282. package/npm-shrinkwrap.json +129 -171
  283. package/package.json +19 -19
  284. package/schemas/models.schema.json +9 -5
  285. package/schemas/settings.schema.json +32 -0
  286. package/src/coordination/UPSTREAM.md +31 -1
  287. package/src/coordination/upstream.json +3 -3
  288. package/src/humain/adhd/UPSTREAM.md +8 -0
  289. package/src/humain/caveman/UPSTREAM.md +19 -3
  290. package/src/humain/caveman/upstream.json +2 -2
  291. package/src/humain/ponytail/UPSTREAM.md +23 -2
  292. package/src/humain/ponytail/upstream.json +8 -8
  293. package/src/humain/ponytail/vendor/skills/ponytail/SKILL.md +1 -1
  294. package/src/humain/ponytail/vendor/skills/ponytail-debt/SKILL.md +1 -2
  295. package/src/humain/ponytail/vendor/skills/ponytail-gain/SKILL.md +0 -1
  296. package/src/humain/web-access/UPSTREAM.md +45 -1
  297. package/src/humain/web-access/upstream.json +4 -4
  298. package/dist/bundle/chunks/anthropic-messages-YSAHA7QM.js +0 -67
  299. package/dist/bundle/chunks/azure-openai-responses-Z5XYDPHS.js +0 -15
  300. package/dist/bundle/chunks/chunk-2TTB6GIB.js +0 -47
  301. package/dist/bundle/chunks/chunk-4DXXZHY2.js +0 -540
  302. package/dist/bundle/chunks/chunk-A7QKOI62.js +0 -572
  303. package/dist/bundle/chunks/chunk-FRUFMISJ.js +0 -505
  304. package/dist/bundle/chunks/chunk-IUKCPYKD.js +0 -1786
  305. package/dist/bundle/chunks/chunk-MG5PX4KU.js +0 -31
  306. package/dist/bundle/chunks/chunk-RYC5BYVE.js +0 -5
  307. package/dist/bundle/chunks/chunk-YJ3NQWES.js +0 -9
  308. package/dist/bundle/chunks/dist-MNSGVI4C.js +0 -7
  309. package/dist/bundle/chunks/dist-cjs-4BMVQ74V.js +0 -179
  310. package/dist/bundle/chunks/host-2RMBOGA7.js +0 -2
  311. package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +0 -2
  312. package/dist/bundle/chunks/openai-completions-WGBQHTYA.js +0 -79
  313. package/dist/bundle/chunks/openai-responses-OKGCSIEY.js +0 -23
  314. package/dist/bundle/chunks/pdfjs-6UVU6XFX.js +0 -3564
  315. package/dist/bundle/chunks/virtual-modules-5KW36RPG.js +0 -5
@@ -1,7 +1,8 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
2
  import{CredentialResolutionError,DEFAULT_MODEL,activityMonitor,askPerplexity,assertAuthFetchUrl,authFetchRedirectGuard,checkGhAvailable,extractGitHub,extractWithFirecrawl,extractWithKagi,extractWithOllama,extractWithParallel,extractWithParallelMcp,extractWithQuerit,extractWithSearch1API,extractWithTinyFish,fetchGeminiApi,fetchRemoteUrl,formatSeconds,getApiKey,getBrowserCookiesForHosts,getLastBrowserCookieDiagnostic,getUploadBase,getVersionedApiBase,getWebSearchConfigPath,hasCredentialSource,isFirecrawlAvailable,
3
- isGatewayConfigured,isGeminiAdcAvailable,isGeminiApiAvailable,isGeminiApiAvailableWithVideo,isGeminiWebAvailable,isKagiExtractAvailable,isLoopbackHostname,isOllamaFetchAvailable,isParallelAvailable,isPerplexityAvailable,isQueritAvailable,isSearch1APIAvailable,isTimeoutError,isTinyFishAvailable,loadFetchContentDomainPolicy,loadFetchContentRedirectPolicy,loadSsrfConfig,mapFfmpegError,pLimit,parseGitHubUrl,queryGeminiApiWithInlineData,queryGeminiApiWithVideo,queryWithCookies,readExecError,redactCredential,
4
- redactGeminiApiResponse,resolveCredential,rewriteUploadUrlOrigin,showGhHint,trimErrorText,validateRemoteUrl}from"./chunk-OX2IBCCA.js";import"./chunk-BVHXWQLD.js";import"./chunk-YRCLNWFV.js";import"./chunk-FRUFMISJ.js";import"./chunk-YJ3NQWES.js";import"./chunk-DBL35X7L.js";import"./chunk-MG5PX4KU.js";import"./chunk-LUL775V7.js";import"./chunk-RYC5BYVE.js";import"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";import{existsSync as existsSync10,readFileSync as readFileSync10}from"node:fs";function extractRSCContent(html){if(!html.includes("self.__next_f.push"))return null;let chunkMap=new Map,scriptRegex=/<script>self\.__next_f\.push\(\[1,"([\s\S]*?)"\]\)<\/script>/g;for(let match of html.matchAll(scriptRegex)){let content2;try{content2=JSON.parse('"'+match[1]+'"')}catch{continue}for(let line of content2.split(`
3
+ isGatewayConfigured,isGeminiAdcAvailable,isGeminiApiAvailable,isGeminiApiAvailableWithVideo,isGeminiWebAvailable,isKagiExtractAvailable,isLoopbackHostname,isOllamaFetchAvailable,isParallelAvailable,isPerplexityAvailable,isQueritAvailable,isSearch1APIAvailable,isTimeoutError,isTinyFishAvailable,loadFetchContentDomainPolicy,loadFetchContentRedirectPolicy,loadFetchContentUserAgent,loadSsrfConfig,mapFfmpegError,pLimit,parseGitHubUrl,queryGeminiApiWithInlineData,queryGeminiApiWithVideo,queryWithCookies,
4
+ readExecError,redactCredential,redactGeminiApiResponse,resolveCredential,rewriteUploadUrlOrigin,showGhHint,trimErrorText,validateRemoteUrl}from"./chunk-PTP2ZHFQ.js";import"./chunk-SCBU5WOP.js";import"./chunk-YRCLNWFV.js";import"./chunk-Y26OS23T.js";import"./chunk-PY7SOXCA.js";import"./chunk-DBL35X7L.js";import"./chunk-YDBNMIA3.js";import"./chunk-5K5RFXXO.js";import"./chunk-IJYVMOB4.js";import"./chunk-VEYTRNQC.js";import"./chunk-AWCJWXGD.js";
5
+ import"./chunk-OKALNPTJ.js";import"./chunk-JXWJOIH4.js";import{existsSync as existsSync10,readFileSync as readFileSync10}from"node:fs";function extractRSCContent(html){if(!html.includes("self.__next_f.push"))return null;let chunkMap=new Map,scriptRegex=/<script>self\.__next_f\.push\(\[1,"([\s\S]*?)"\]\)<\/script>/g;for(let match of html.matchAll(scriptRegex)){let content2;try{content2=JSON.parse('"'+match[1]+'"')}catch{continue}for(let line of content2.split(`
5
6
  `)){if(!line.trim())continue;let colonIdx=line.indexOf(":");if(colonIdx<=0||colonIdx>4)continue;let id=line.slice(0,colonIdx);if(!/^[0-9a-f]+$/i.test(id))continue;let payload=line.slice(colonIdx+1);if(!payload)continue;let existing=chunkMap.get(id);(!existing||payload.length>existing.length)&&chunkMap.set(id,payload)}}if(chunkMap.size===0)return null;let title=html.match(/<title[^>]*>([^<]+)<\/title>/)?.[1]?.split("|")[0]?.trim()||"",parsedCache=new Map;function getParsedChunk(id){if(parsedCache.
6
7
  has(id))return parsedCache.get(id);let chunk=chunkMap.get(id);if(!chunk||!chunk.startsWith("["))return parsedCache.set(id,null),null;try{let parsed=JSON.parse(chunk);return parsedCache.set(id,parsed),parsed}catch{return parsedCache.set(id,null),null}}let visitedRefs=new Set;function extractNode(node,ctx={inTable:!1,inCode:!1}){if(node==null)return"";if(typeof node=="string"){let refMatch=node.match(/^\$L([0-9a-f]+)$/i);if(refMatch){let refId=refMatch[1];if(visitedRefs.has(refId))return"";visitedRefs.
7
8
  add(refId);let refNode=getParsedChunk(refId),result=refNode?extractNode(refNode,ctx):"";return visitedRefs.delete(refId),result}return!ctx.inCode&&(node==="$undefined"||node==="$"||/^\$[A-Z]/.test(node))?"":node.trim()?node:""}if(typeof node=="number")return String(node);if(typeof node=="boolean"||!Array.isArray(node))return"";if(node[0]==="$"&&typeof node[1]=="string"){let tag=node[1],props=node[3]||{};if(["script","style","svg","path","circle","link","meta","template","button","input","nav","f\
@@ -88,8 +89,8 @@ maxPages)throw new Error(`Gemini PDF extraction returned ${markers.length} page
88
89
  match(/^(<!-- Page 1 -->\s*\n+)#\s+(.+?)\s*\n+/);return!match||normalizeTitle(match[2])!==normalizeTitle(title)?markdown:`${match[1]}${markdown.slice(match[0].length)}`.trim()}function normalizeTitle(value){return value.normalize("NFKC").toLocaleLowerCase().replace(/[`*_~]/g,"").replace(/[\p{P}\p{S}\s]+/gu,"")}var PDF_PROVIDER_VALUES=new Set(["auto","endpoint","gemini","datalab","unpdf"]),DEFAULT_PDF_MAX_SIZE_MB=20,MAX_PDF_MAX_SIZE_MB=50,MAX_DATALAB_TIMEOUT_MS=3e5,DEFAULT_MAX_PAGES=100,DEFAULT_OUTPUT_DIR=join(tmpdir(),"pi-web-pdf"),CONFIG_PATH3=getWebSearchConfigPath(),PAGE_MARKER_PATTERN2=/^<!-- Page (\d+) -->$/gm;function loadPDFConfig(){if(!existsSync3(CONFIG_PATH3))return{enabled:!0,maxSizeMB:DEFAULT_PDF_MAX_SIZE_MB,maxPages:DEFAULT_MAX_PAGES,provider:"auto",datalabMode:normalizeDatalabMode(process.
89
90
  env.DATALAB_MODE),datalabTimeoutMs:DEFAULT_DATALAB_TIMEOUT_MS};let rawText=readFileSync3(CONFIG_PATH3,"utf-8"),raw;try{raw=JSON.parse(rawText)}catch(err){let message=err instanceof Error?err.message:String(err);throw new Error(`Failed to parse ${CONFIG_PATH3}: ${message}`)}let root=raw&&typeof raw=="object"?raw:{},pdf=root.pdf&&typeof root.pdf=="object"?root.pdf:{},enabled=pdf.enabled!==!1,configured=pdf.maxSizeMB,normalized=typeof configured=="number"&&Number.isFinite(configured)&&configured>0?
90
91
  Math.min(configured,MAX_PDF_MAX_SIZE_MB):DEFAULT_PDF_MAX_SIZE_MB,configuredMaxPages=pdf.maxPages,maxPages=typeof configuredMaxPages=="number"&&Number.isFinite(configuredMaxPages)&&configuredMaxPages>0?Math.max(1,Math.floor(configuredMaxPages)):DEFAULT_MAX_PAGES,provider=typeof pdf.provider=="string"&&PDF_PROVIDER_VALUES.has(pdf.provider)?pdf.provider:"auto",datalabMode=typeof pdf.datalabMode=="string"&&DATALAB_MODE_VALUES.has(pdf.datalabMode)?pdf.datalabMode:normalizeDatalabMode(process.env.DATALAB_MODE),
91
- configuredTimeout=pdf.datalabTimeoutMs,datalabTimeoutMs=typeof configuredTimeout=="number"&&Number.isFinite(configuredTimeout)&&configuredTimeout>0?Math.min(configuredTimeout,MAX_DATALAB_TIMEOUT_MS):DEFAULT_DATALAB_TIMEOUT_MS;return{enabled,maxSizeMB:normalized,maxPages,provider,datalabMode,datalabTimeoutMs}}async function getUnpdf(){if(typeof Promise.try!="function"){let{default:promiseTry}=await import("./promise-YD7KSL5D.js");promiseTry.shim()}let[unpdf,pdfjs]=await Promise.all([import("./dist-JXEXN6S2.js"),
92
- import("./pdfjs-6UVU6XFX.js")]),{VerbosityLevel}=pdfjs;return{getDocumentProxy:unpdf.getDocumentProxy,VerbosityLevel}}async function extractPDFToMarkdown(buffer,url,options={}){let{maxPages,outputDir=DEFAULT_OUTPUT_DIR,filename,signal,geminiTimeoutMs}=options,pdfConfig=loadPDFConfig(),safeMaxPages=maxPages===void 0?pdfConfig.maxPages:Number.isFinite(maxPages)?Math.max(1,Math.floor(maxPages)):DEFAULT_MAX_PAGES,urlTitle=extractTitleFromURL(url),provider=pdfConfig.provider;if(provider==="auto"||
92
+ configuredTimeout=pdf.datalabTimeoutMs,datalabTimeoutMs=typeof configuredTimeout=="number"&&Number.isFinite(configuredTimeout)&&configuredTimeout>0?Math.min(configuredTimeout,MAX_DATALAB_TIMEOUT_MS):DEFAULT_DATALAB_TIMEOUT_MS;return{enabled,maxSizeMB:normalized,maxPages,provider,datalabMode,datalabTimeoutMs}}async function getUnpdf(){if(typeof Promise.try!="function"){let{default:promiseTry}=await import("./promise-YD7KSL5D.js");promiseTry.shim()}let[unpdf,pdfjs]=await Promise.all([import("./dist-XVXV2CL4.js"),
93
+ import("./pdfjs-EK6K7CXX.js")]),{VerbosityLevel}=pdfjs;return{getDocumentProxy:unpdf.getDocumentProxy,VerbosityLevel}}async function extractPDFToMarkdown(buffer,url,options={}){let{maxPages,outputDir=DEFAULT_OUTPUT_DIR,filename,signal,geminiTimeoutMs}=options,pdfConfig=loadPDFConfig(),safeMaxPages=maxPages===void 0?pdfConfig.maxPages:Number.isFinite(maxPages)?Math.max(1,Math.floor(maxPages)):DEFAULT_MAX_PAGES,urlTitle=extractTitleFromURL(url),provider=pdfConfig.provider;if(provider==="auto"||
93
94
  provider==="endpoint"){if(provider==="endpoint"&&!isEndpointApiAvailable())throw new Error('PDF provider "endpoint" requires a configured pdf.endpointUrl');try{if(isEndpointApiAvailable()){let result=await extractPDFViaEndpoint(buffer,{maxPages:safeMaxPages,...signal?{signal}:{}});return writeMarkdownResult({markdownBody:result.markdown,title:urlTitle,pages:result.pages??countPageMarkers2(result.markdown),outputDir,filename,url})}}catch(err){if(shouldRethrowExtractionError(err,signal))throw err}}
94
95
  if(provider==="auto"||provider==="datalab")try{if(isDatalabApiAvailable()){let result=await extractPDFViaDatalab(buffer,{maxPages:safeMaxPages,title:urlTitle,mode:pdfConfig.datalabMode,timeoutMs:pdfConfig.datalabTimeoutMs,...signal?{signal}:{}});return writeMarkdownResult({markdownBody:result.markdown,title:urlTitle,pages:result.pages,outputDir,filename,url})}}catch(err){if(shouldRethrowExtractionError(err,signal))throw err}if(provider==="auto"||provider==="gemini")try{if(isGeminiApiAvailable()){
95
96
  let markdownBody=await extractPDFViaGemini(buffer,{maxPages:safeMaxPages,title:urlTitle,...signal?{signal}:{},...geminiTimeoutMs!==void 0?{timeoutMs:geminiTimeoutMs}:{}});return writeMarkdownResult({markdownBody,title:urlTitle,pages:countPageMarkers2(markdownBody),outputDir,filename,url})}}catch(err){if(shouldRethrowExtractionError(err,signal))throw err}let{getDocumentProxy,VerbosityLevel}=await getUnpdf(),pdf=await getDocumentProxy(new Uint8Array(buffer),{verbosity:VerbosityLevel.ERRORS}),metadata=await pdf.
@@ -306,9 +307,9 @@ indexOf("-",1);if(dashIdx>0){let start=parseTimestamp(ts.slice(0,dashIdx)),end=p
306
307
  let timestamps=[];for(let t=start;t<=end&&timestamps.length<maxFrames;t+=MIN_FRAME_INTERVAL)timestamps.push(t);return timestamps}return Array.from({length:maxFrames},(_,i)=>Math.round(start+i*idealInterval))}function buildFrameResult(url,label,requestedCount,frames,error,duration){if(frames.length===0){let msg=error??"Frame extraction failed";return{url,title:`Frames ${label} (0/${requestedCount})`,content:msg,error:msg}}return{url,title:`Frames ${label} (${frames.length}/${requestedCount})`,content:`${frames.
307
308
  length} frames extracted from ${label}`,error:null,frames,...duration!==void 0?{duration}:{}}}async function extractLocalFrames(filePath,timestamps){let results=await Promise.all(timestamps.map(async t=>{let frame=await extractVideoFrame(filePath,t);return"error"in frame?{error:frame.error}:{...frame,timestamp:formatSeconds(t)}})),frames=results.filter(f=>"data"in f),firstError=results.find(f=>"error"in f);return{frames,error:frames.length===0&&firstError?firstError.error:null}}function safeVideoInfo(url){
308
309
  try{let info=isVideoFile(url);return info?{status:"video",info}:{status:"not-video"}}catch(err){return{status:"invalid",error:errorMessage5(err)}}}async function extractContent(url,signal,options){if(signal?.aborted)return{url,title:"",content:"",error:"Aborted"};let redirectPolicy;try{redirectPolicy=options?.redirects??loadFetchContentRedirectPolicy()}catch(err){return{url,title:"",content:"",error:errorMessage5(err)}}let remoteUrl=null;try{let parsed=new URL(url);(parsed.protocol==="http:"||parsed.
309
- protocol==="https:")&&(remoteUrl=parsed)}catch{}if(remoteUrl)try{let ssrf=loadSsrfConfig(),domainPolicy=loadFetchContentDomainPolicy();await validateRemoteUrl(remoteUrl,{allowRanges:ssrf.allowRanges,trustEnvProxy:ssrf.trustEnvProxy,domainPolicy,proxy:options?.proxy,...options?.lookup?{lookup:options.lookup}:{}})}catch(err){return{url,title:"",content:"",error:errorMessage5(err)}}if(options?.authFetchProfile||options?.mode==="raw")try{return await extractViaHttp(url,resolveFetchTimeoutMs(options),
310
- signal,options)}catch(err){return{url,title:"",content:"",error:errorMessage5(err)}}if(redirectPolicy){if(parseGitHubIssuePrUrl(url))return redirectPolicyRouteRefusal(url,"GitHub issue/PR");if(parseGitHubUrl(url))return redirectPolicyRouteRefusal(url,"GitHub repository");if(isYouTubeURL(url).isYouTube)return redirectPolicyRouteRefusal(url,"YouTube")}if(options?.frames||options?.timestamp){let disabled=imageGateError();if(disabled)return{url,title:"",content:"",error:disabled}}if(options?.frames&&
311
- !options.timestamp){let frameCount=options.frames,ytInfo2=isYouTubeURL(url);if(ytInfo2.isYouTube&&ytInfo2.videoId){let streamInfo=await getYouTubeStreamInfo(ytInfo2.videoId);if("error"in streamInfo)return{url,title:"Frames",content:streamInfo.error,error:streamInfo.error};if(streamInfo.duration===null){let error="Cannot determine video duration. Use a timestamp range instead.";return{url,title:"Frames",content:error,error}}let dur=Math.floor(streamInfo.duration),timestamps=computeRangeTimestamps(
310
+ protocol==="https:")&&(remoteUrl=parsed)}catch{}if(remoteUrl)try{let ssrf=loadSsrfConfig(),domainPolicy=loadFetchContentDomainPolicy();loadFetchContentUserAgent(),await validateRemoteUrl(remoteUrl,{allowRanges:ssrf.allowRanges,trustEnvProxy:ssrf.trustEnvProxy,domainPolicy,proxy:options?.proxy,...options?.lookup?{lookup:options.lookup}:{}})}catch(err){return{url,title:"",content:"",error:errorMessage5(err)}}if(options?.authFetchProfile||options?.mode==="raw")try{return await extractViaHttp(url,resolveFetchTimeoutMs(
311
+ options),signal,options)}catch(err){return{url,title:"",content:"",error:errorMessage5(err)}}if(redirectPolicy){if(parseGitHubIssuePrUrl(url))return redirectPolicyRouteRefusal(url,"GitHub issue/PR");if(parseGitHubUrl(url))return redirectPolicyRouteRefusal(url,"GitHub repository");if(isYouTubeURL(url).isYouTube)return redirectPolicyRouteRefusal(url,"YouTube")}if(options?.frames||options?.timestamp){let disabled=imageGateError();if(disabled)return{url,title:"",content:"",error:disabled}}if(options?.
312
+ frames&&!options.timestamp){let frameCount=options.frames,ytInfo2=isYouTubeURL(url);if(ytInfo2.isYouTube&&ytInfo2.videoId){let streamInfo=await getYouTubeStreamInfo(ytInfo2.videoId);if("error"in streamInfo)return{url,title:"Frames",content:streamInfo.error,error:streamInfo.error};if(streamInfo.duration===null){let error="Cannot determine video duration. Use a timestamp range instead.";return{url,title:"Frames",content:error,error}}let dur=Math.floor(streamInfo.duration),timestamps=computeRangeTimestamps(
312
313
  0,dur,frameCount),result=await extractYouTubeFrames(ytInfo2.videoId,timestamps,streamInfo),label=`${formatSeconds(0)}-${formatSeconds(dur)}`;return buildFrameResult(url,label,timestamps.length,result.frames,result.error,streamInfo.duration)}let localVideo2=safeVideoInfo(url);if(localVideo2.status==="invalid")return{url,title:"",content:"",error:localVideo2.error};if(localVideo2.status==="video"){let durationResult=await getLocalVideoDuration(localVideo2.info.absolutePath);if(typeof durationResult!=
313
314
  "number")return{url,title:"Frames",content:durationResult.error,error:durationResult.error};let dur=Math.floor(durationResult),timestamps=computeRangeTimestamps(0,dur,frameCount),result=await extractLocalFrames(localVideo2.info.absolutePath,timestamps),label=`${formatSeconds(0)}-${formatSeconds(dur)}`;return buildFrameResult(url,label,timestamps.length,result.frames,result.error,durationResult)}return{url,title:"",content:"",error:"Frame extraction only works with YouTube and local video files"}}
314
315
  if(options?.timestamp){let spec=parseTimestampSpec(options.timestamp);if(!spec)return{url,title:"",content:"",error:`Invalid timestamp format: "${options.timestamp}". Use "H:MM:SS", "MM:SS", "85", or "start-end".`};let frameCount=options.frames,ytInfo2=isYouTubeURL(url);if(ytInfo2.isYouTube&&ytInfo2.videoId){let streamInfo=await getYouTubeStreamInfo(ytInfo2.videoId);if("error"in streamInfo){if(spec.type==="range"){let label=`${formatSeconds(spec.start)}-${formatSeconds(spec.end)}`;return{url,title:`\
@@ -348,13 +349,13 @@ response,maxBytes,()=>responseSizeLimitError(maxBytes)),charset=response.headers
348
349
  mimeType==="application/xhtml+xml"||mimeType==="application/javascript"||mimeType==="application/x-javascript"||mimeType.endsWith("+json")||mimeType.endsWith("+xml")}async function readResponseBufferWithLimit(response,maxBytes,buildError){let reader=response.body?.getReader();if(!reader){let buffer=await response.arrayBuffer();if(buffer.byteLength>maxBytes)throw buildError();return buffer}let chunks=[],totalBytes=0;try{for(;;){let{done,value}=await reader.read();if(done)break;if(value){if(totalBytes+=
349
350
  value.byteLength,totalBytes>maxBytes)throw await reader.cancel(),buildError();chunks.push(value)}}}finally{reader.releaseLock()}let combined=new Uint8Array(totalBytes),offset=0;for(let chunk of chunks)combined.set(chunk,offset),offset+=chunk.byteLength;return combined.buffer}function pdfSizeLimitError(maxSizeMB){return new Error(`PDF exceeds configured pdf.maxSizeMB limit (${maxSizeMB} MB)`)}function responseSizeLimitError(maxBytes){return new Error(`Response too large (${Math.round(maxBytes/1024/
350
351
  1024)}MB)`)}var BROWSER_ACCEPT="text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",MARKDOWN_FIRST_ACCEPT="text/markdown,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,image/avif;q=0.9,image/webp;q=0.9,image/apng;q=0.9,*/*;q=0.7";async function extractViaHttp(url,timeoutMs,signal,options,preferMarkdown=options?.mode!=="raw"){let activityId=activityMonitor.logStart({type:"fetch",url}),controller=new AbortController,startedAt=Date.now(),
351
- timeoutId=setTimeout(()=>controller.abort(),timeoutMs),onAbort=()=>controller.abort();signal?.addEventListener("abort",onAbort);try{let ssrf=loadSsrfConfig(),domainPolicy=loadFetchContentDomainPolicy(),redirects=options?.redirects??loadFetchContentRedirectPolicy(),authProfile=options?.authFetchProfile,requestInit={signal:controller.signal,__proxy:options?.proxy,headers:{"User-Agent":"OpenAI File Downloader, XaiImageApiFetch/1.0",Accept:preferMarkdown?MARKDOWN_FIRST_ACCEPT:BROWSER_ACCEPT,"Accept-\
352
- Language":"en-US,en;q=0.9","Cache-Control":"no-cache","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1"}},response=authProfile?await fetchAuthenticatedRemoteUrl(url,requestInit,{ssrf,domainPolicy,redirects,proxy:options?.proxy,...options?.lookup?{lookup:options.lookup}:{}},authProfile):await fetchRemoteUrl(url,requestInit,{allowRanges:ssrf.allowRanges,trustEnvProxy:ssrf.trustEnvProxy,domainPolicy,redirects,proxy:options?.
353
- proxy,...options?.lookup?{lookup:options.lookup}:{}});if(!response.ok&&options?.mode!=="raw")return activityMonitor.logComplete(activityId,response.status),{url,title:"",content:"",error:`HTTP ${response.status}: ${response.statusText}`,status:response.status};let contentLengthHeader=response.headers.get("content-length"),contentType=response.headers.get("content-type")||"",mimeType=contentType.split(";",1)[0]?.trim().toLowerCase()??"",isPDFContent=isPDF(url,contentType),pdfConfig=isPDFContent?loadPDFConfig():
354
- null;if(isPDFContent&&pdfConfig&&!pdfConfig.enabled)return activityMonitor.logComplete(activityId,response.status),{url,title:"",content:"",error:"PDF extraction is disabled by pdf.enabled",mimeType,status:response.status};let maxResponseSize=(pdfConfig?.maxSizeMB??5)*1024*1024;if(contentLengthHeader){let contentLength=Number.parseInt(contentLengthHeader,10);if(Number.isFinite(contentLength)&&contentLength>maxResponseSize)return activityMonitor.logComplete(activityId,response.status),{url,title:"",
355
- content:"",error:pdfConfig?pdfSizeLimitError(pdfConfig.maxSizeMB).message:`Response too large (${Math.round(contentLength/1024/1024)}MB)`}}if(options?.mode==="raw"){if(!isTextContentType(contentType))return activityMonitor.logComplete(activityId,response.status),{url,title:"",content:"",error:`Unsupported content type in raw mode: ${mimeType||"missing"}${isPDFContent?'; retry without mode for Markdown, or with mode "answer" and a prompt':""}`,mimeType,status:response.status};let text2=await readTextResponseWithLimit(
352
+ timeoutId=setTimeout(()=>controller.abort(),timeoutMs),onAbort=()=>controller.abort();signal?.addEventListener("abort",onAbort);try{let ssrf=loadSsrfConfig(),domainPolicy=loadFetchContentDomainPolicy(),redirects=options?.redirects??loadFetchContentRedirectPolicy(),authProfile=options?.authFetchProfile,requestInit={signal:controller.signal,__proxy:options?.proxy,headers:{"User-Agent":loadFetchContentUserAgent(),Accept:preferMarkdown?MARKDOWN_FIRST_ACCEPT:BROWSER_ACCEPT,"Accept-Language":"en-US,en\
353
+ ;q=0.9","Cache-Control":"no-cache","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1"}},response=authProfile?await fetchAuthenticatedRemoteUrl(url,requestInit,{ssrf,domainPolicy,redirects,proxy:options?.proxy,...options?.lookup?{lookup:options.lookup}:{}},authProfile):await fetchRemoteUrl(url,requestInit,{allowRanges:ssrf.allowRanges,trustEnvProxy:ssrf.trustEnvProxy,domainPolicy,redirects,proxy:options?.proxy,...options?.
354
+ lookup?{lookup:options.lookup}:{}});if(!response.ok&&options?.mode!=="raw")return activityMonitor.logComplete(activityId,response.status),{url,title:"",content:"",error:`HTTP ${response.status}: ${response.statusText}`,status:response.status};let contentLengthHeader=response.headers.get("content-length"),contentType=response.headers.get("content-type")||"",mimeType=contentType.split(";",1)[0]?.trim().toLowerCase()??"",isPDFContent=isPDF(url,contentType),pdfConfig=isPDFContent?loadPDFConfig():null;
355
+ if(isPDFContent&&pdfConfig&&!pdfConfig.enabled)return activityMonitor.logComplete(activityId,response.status),{url,title:"",content:"",error:"PDF extraction is disabled by pdf.enabled",mimeType,status:response.status};let maxResponseSize=(pdfConfig?.maxSizeMB??5)*1024*1024;if(contentLengthHeader){let contentLength=Number.parseInt(contentLengthHeader,10);if(Number.isFinite(contentLength)&&contentLength>maxResponseSize)return activityMonitor.logComplete(activityId,response.status),{url,title:"",content:"",
356
+ error:pdfConfig?pdfSizeLimitError(pdfConfig.maxSizeMB).message:`Response too large (${Math.round(contentLength/1024/1024)}MB)`}}if(options?.mode==="raw"){if(!isTextContentType(contentType))return activityMonitor.logComplete(activityId,response.status),{url,title:"",content:"",error:`Unsupported content type in raw mode: ${mimeType||"missing"}${isPDFContent?'; retry without mode for Markdown, or with mode "answer" and a prompt':""}`,mimeType,status:response.status};let text2=await readTextResponseWithLimit(
356
357
  response,maxResponseSize);return activityMonitor.logComplete(activityId,response.status),{url,title:extractTextTitle(text2,url),content:text2,error:null,mimeType,status:response.status}}if(SUPPORTED_IMAGE_TYPES.has(mimeType)){let disabled=imageGateError();if(disabled)return activityMonitor.logComplete(activityId,response.status),{url,title:"",content:"",error:disabled,mimeType,status:response.status};if(options?.rejectDirectImages)return activityMonitor.logComplete(activityId,response.status),{url,
357
- title:"",content:"",error:options.rejectDirectImages,mimeType,status:response.status};try{let buffer=await readResponseBufferWithLimit(response,maxResponseSize,()=>responseSizeLimitError(maxResponseSize)),{resizeImage}=await import("./host-2RMBOGA7.js"),resized=await resizeImage(new Uint8Array(buffer),mimeType,{maxWidth:2e3,maxHeight:2e3});if(activityMonitor.logComplete(activityId,response.status),!resized)return{url,title:"",content:"",error:`Could not decode image: ${mimeType}`,mimeType,
358
+ title:"",content:"",error:options.rejectDirectImages,mimeType,status:response.status};try{let buffer=await readResponseBufferWithLimit(response,maxResponseSize,()=>responseSizeLimitError(maxResponseSize)),{resizeImage}=await import("./host-63SNKK5Y.js"),resized=await resizeImage(new Uint8Array(buffer),mimeType,{maxWidth:2e3,maxHeight:2e3});if(activityMonitor.logComplete(activityId,response.status),!resized)return{url,title:"",content:"",error:`Could not decode image: ${mimeType}`,mimeType,
358
359
  status:response.status};let title=new URL(response.url||url).pathname.split("/").pop()||url;return{url,title,content:`Image fetched (${resized.width}\xD7${resized.height}, ${resized.mimeType})`,error:null,thumbnail:{data:resized.data,mimeType:resized.mimeType},mimeType:resized.mimeType,status:response.status}}catch(err){let message=errorMessage5(err);return activityMonitor.logError(activityId,message),{url,title:"",content:"",error:message,mimeType,status:response.status}}}if(isPDFContent&&pdfConfig)
359
360
  try{let buffer=await readPDFResponseBuffer(response,pdfConfig.maxSizeMB);if(signal?.aborted)return abortedResult(url);let result=await extractPDFToMarkdown(buffer,url,{signal});return activityMonitor.logComplete(activityId,response.status),{url,title:result.title,content:options?.mode==="answer"?result.content:`PDF extracted and saved to: ${result.outputPath}
360
361
 
@@ -4,53 +4,40 @@ de-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},th
4
4
  maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5 (latest)",api:"anthro\
5
5
  pic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},
6
6
  type:"chat"},"chat:claude-haiku-5.5":{id:"claude-haiku-5.5",name:"Claude Haiku 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:1e5,input:.5,output:2.5,cacheRead:.05,cacheWrite:.625}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"\
7
- copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.7":{id:"claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","ima\
8
- ge"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.8":{
9
- id:"claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,
10
- supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5":{id:"claude-opus-5",name:"Claude Opus 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHu\
11
- bCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5.5":{id:"claude-opus-5.5",name:"Claude Opus 5.5",api:"anthropic-messages",provider:"gith\
12
- ub-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.2,cacheWrite:5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"\
13
- medium",high:"high",xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Ed\
14
- itor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5":{id:"claude-sonnet-5",name:"Claude Sonnet 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","imag\
15
- e"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5.5":{id:"claude-sonnet-5.5",name:"Clau\
16
- de Sonnet 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},
17
- thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-completions":{"chat:gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:2e5,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilo\
18
- tChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-3.6-flash":{id:"gemini-3.6-flash",name:"Gemini 3.6 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubco\
19
- pilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"\
20
- chat"},"chat:gemini-3.7-flash":{id:"gemini-3.7-flash",name:"Gemini 3.7 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,
21
- supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-3.8-flash":{id:"gemini-3.8-flash",name:"Gemini 3.8 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitH\
22
- ubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-4-argon":{id:"gemini-4-argon",name:"Gemini 4 Argon",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.github\
23
- copilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:0},contextWindow:1048576,maxTokens:65536,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"\
24
- chat"},"chat:kimi-k2.7-code":{id:"kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:256e3,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,
25
- supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:kimi-k3":{id:"kimi-k3",name:"Kimi K3",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:0},contextWindow:1048576,maxTokens:131072,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vsco\
26
- de/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-responses":{"chat:gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcop\
27
- ilot.com",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:264e3,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,
28
- jpegQuality:80}}},type:"chat"},"chat:gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{
29
- off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0,tiers:[{inputTokensAbove:272e3,input:5,
30
- output:22.5,cacheRead:.5,cacheWrite:0}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,
31
- maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},
32
- thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],
33
- cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",
34
- api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:272e3,input:10,output:45,cacheRead:1,cacheWrite:0}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"\
35
- low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-luna":{id:"gpt-5.6-luna",name:"GPT-5.6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,
36
- cacheWrite:.25,tiers:[{inputTokensAbove:2e5,input:.4,output:1.8,cacheRead:.04,cacheWrite:.5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},
37
- inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-sol":{id:"gpt-5.6-sol",name:"GPT-5.6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.4,cacheWrite:5,tiers:[{inputTokensAbove:272e3,input:8,output:30,cacheRead:.8,cacheWrite:10}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotCha\
38
- t/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-terra":{id:"gpt-5.6-terra",name:"GPT-5.6 Terra",
39
- api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:18,cacheRead:.4,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"\
40
- low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-astra":{id:"gpt-6-astra",name:"GPT-6 Astra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,
41
- cacheWrite:12.5,tiers:[{inputTokensAbove:272e3,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},
42
- inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-luna":{id:"gpt-6-luna",name:"GPT-6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:272e3,input:.2,output:.75,cacheRead:.02,cacheWrite:.25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilo\
43
- tChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-sol":{id:"gpt-6-sol",name:"GPT-6 Sol",api:"op\
44
- enai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.4,cacheWrite:5}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,
45
- low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6.1-sol":{id:"gpt-6.1-sol",name:"GPT-6.1 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5,
46
- tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.2,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{
47
- resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.5":{id:"grok-4.5",name:"Grok 4.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.\
48
- 107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.6":{id:"grok-4.6",name:"Grok 4.6",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,
49
- cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"\
50
- chat"},"chat:grok-4.7":{id:"grok-4.7",name:"Grok 4.7",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"\
51
- vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:mai-code-1-flash-picker":{id:"mai-code-1-flash-picker",name:"MAI-Code-1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:256e3,
52
- maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},type:"chat"},"chat:mai-code-1.1-flash":{id:"mai-code-1.1-flash",name:"MAI-Code-1.1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text",
53
- "image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}}};function flattenModelCatalog(groups,type){return Object.fromEntries(Object.values(groups).flatMap(models=>Object.values(models)).filter(model=>model.type===type).map(model=>[model.id,model]))}function flattenChatModelCatalog(_provider,groups){return flattenModelCatalog(groups,"chat")}function flattenImageModelCatalog(_provider,groups){return flattenModelCatalog(groups,"image")}function flattenClassifierModelCatalog(_provider,groups){return flattenModelCatalog(groups,"classifier")}var GITHUB_COPILOT_MODELS=flattenChatModelCatalog("github-copilot",github_copilot_default),GITHUB_COPILOT_IMAGE_MODELS=flattenImageModelCatalog("github-copilot",github_copilot_default),GITHUB_COPILOT_CLASSIFIER_MODELS=flattenClassifierModelCatalog("github-copilot",github_copilot_default);function sleep(ms,signal){return new Promise((resolve,reject)=>{signal.throwIfAborted();let onAbort=()=>{clearTimeout(timeout),reject(signal.reason)},timeout=setTimeout(()=>{signal.removeEventListener("abort",onAbort),resolve()},ms);signal.addEventListener("abort",onAbort,{once:!0})})}var CANCEL_MESSAGE="Login cancelled",TIMEOUT_MESSAGE="Device flow timed out",SLOW_DOWN_TIMEOUT_MESSAGE="Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";function abortableSleep(ms,signal,cancelMessage){return new Promise((resolve,reject)=>{if(signal.aborted){reject(new Error(cancelMessage));return}let onAbort=()=>{clearTimeout(timeout),reject(new Error(cancelMessage))},timeout=setTimeout(()=>{signal.removeEventListener("abort",onAbort),resolve()},ms);signal.addEventListener("abort",onAbort,{once:!0})})}async function pollOAuthDeviceCodeFlow(options){let deadline=typeof options.expiresInSeconds=="number"?Date.now()+options.expiresInSeconds*1e3:Number.
7
+ copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.8":{id:"claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","ima\
8
+ ge"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},
9
+ type:"chat"},"chat:claude-opus-5":{id:"claude-opus-5",name:"Claude Opus 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,
10
+ forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5.5":{id:"claude-opus-5.5",name:"Claude Opus 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.2,cacheWrite:5},contextWindow:1e6,maxTokens:128e3,
11
+ headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-4.6":{id:"cla\
12
+ ude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0},
13
+ inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5":{id:"claude-sonnet-5",name:"Claude Sonnet 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Versi\
14
+ on":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5.5":{id:"claude-sonnet-5.5",name:"Claude Sonnet 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5},
15
+ contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-completions":{"chat:gemini-3.8-flash":{id:"gemini-\
16
+ 3.8-flash",name:"Gemini 3.8 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,
17
+ supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-4-argon":{id:"gemini-4-argon",name:"Gemini 4 Argon",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:0},contextWindow:1048576,maxTokens:65536,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.\
18
+ 107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:kimi-k3":{id:"kimi-k3",name:"Kimi K3",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,
19
+ cacheRead:.3,cacheWrite:0},contextWindow:1048576,maxTokens:131072,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-responses":{"chat:\
20
+ gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",
21
+ medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,headers:{"User-Agent":"\
22
+ GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-luna":{id:"gpt-5.6-luna",name:"GPT-5.6 Luna",api:"openai-responses",provider:"github-copilot",
23
+ baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25,tiers:[{inputTokensAbove:2e5,input:.4,output:1.8,cacheRead:.04,cacheWrite:.5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"\
24
+ high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-sol":{id:"gpt-5.6-sol",name:"GPT-5.6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.4,cacheWrite:5,tiers:[{inputTokensAbove:272e3,
25
+ input:8,output:30,cacheRead:.8,cacheWrite:10}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,
26
+ maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-terra":{id:"gpt-5.6-terra",name:"GPT-5.6 Terra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:18,cacheRead:.4,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Edit\
27
+ or-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-astra":{id:"gpt-6-astra",name:"GPT-6 Astra",api:"openai-responses",provider:"github-copilot",baseUrl:"\
28
+ https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5,tiers:[{inputTokensAbove:272e3,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xh\
29
+ igh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-luna":{id:"gpt-6-luna",name:"GPT-6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:272e3,input:.2,
30
+ output:.75,cacheRead:.02,cacheWrite:.25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,
31
+ maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-sol":{id:"gpt-6-sol",name:"GPT-6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.4,cacheWrite:5}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Vers\
32
+ ion":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6.1-sol":{id:"gpt-6.1-sol",name:"GPT-6.1 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://ap\
33
+ i.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.2,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"\
34
+ max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.5":{id:"grok-4.5",name:"Grok 4.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,
35
+ cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.6":{id:"grok-4.6",name:"Grok 4.6",api:"openai-responses",provider:"\
36
+ github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"\
37
+ high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.7":{id:"grok-4.7",name:"Grok 4.7",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"Gi\
38
+ tHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:mai-code-1.1-flash":{id:"mai-code-1.1-flash",name:"MAI-Code-1.1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.ind\
39
+ ividual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},
40
+ type:"chat"}}};function flattenModelCatalog(groups,type){return Object.fromEntries(Object.values(groups).flatMap(models=>Object.values(models)).filter(model=>model.type===type).map(model=>[model.id,model]))}function flattenChatModelCatalog(_provider,groups){return flattenModelCatalog(groups,"chat")}function flattenImageModelCatalog(_provider,groups){return flattenModelCatalog(groups,"image")}function flattenClassifierModelCatalog(_provider,groups){return flattenModelCatalog(groups,"classifier")}var GITHUB_COPILOT_MODELS=flattenChatModelCatalog("github-copilot",github_copilot_default),GITHUB_COPILOT_IMAGE_MODELS=flattenImageModelCatalog("github-copilot",github_copilot_default),GITHUB_COPILOT_CLASSIFIER_MODELS=flattenClassifierModelCatalog("github-copilot",github_copilot_default);function sleep(ms,signal){return new Promise((resolve,reject)=>{signal.throwIfAborted();let onAbort=()=>{clearTimeout(timeout),reject(signal.reason)},timeout=setTimeout(()=>{signal.removeEventListener("abort",onAbort),resolve()},ms);signal.addEventListener("abort",onAbort,{once:!0})})}var CANCEL_MESSAGE="Login cancelled",TIMEOUT_MESSAGE="Device flow timed out",SLOW_DOWN_TIMEOUT_MESSAGE="Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";function abortableSleep(ms,signal,cancelMessage){return new Promise((resolve,reject)=>{if(signal.aborted){reject(new Error(cancelMessage));return}let onAbort=()=>{clearTimeout(timeout),reject(new Error(cancelMessage))},timeout=setTimeout(()=>{signal.removeEventListener("abort",onAbort),resolve()},ms);signal.addEventListener("abort",onAbort,{once:!0})})}async function pollOAuthDeviceCodeFlow(options){let deadline=typeof options.expiresInSeconds=="number"?Date.now()+options.expiresInSeconds*1e3:Number.
54
41
  POSITIVE_INFINITY,intervalMs=Math.max(1e3,Math.floor((options.intervalSeconds??5)*1e3)),slowDownResponses=0;if(options.waitBeforeFirstPoll){let remainingMs=deadline-Date.now();remainingMs>0&&await abortableSleep(Math.min(intervalMs,remainingMs),options.signal,CANCEL_MESSAGE)}for(;Date.now()<deadline;){if(options.signal.aborted)throw new Error(CANCEL_MESSAGE);let result=await options.poll();if(result.status==="complete")return result.value;if(result.status==="failed")throw new Error(result.message);
55
42
  result.status==="slow_down"&&(slowDownResponses+=1,intervalMs=typeof result.intervalSeconds=="number"&&Number.isFinite(result.intervalSeconds)&&result.intervalSeconds>0?Math.max(1e3,Math.floor(result.intervalSeconds*1e3)):Math.max(1e3,intervalMs+5e3));let remainingMs=deadline-Date.now();if(remainingMs<=0)break;await abortableSleep(Math.min(intervalMs,remainingMs),options.signal,CANCEL_MESSAGE)}throw new Error(slowDownResponses>0?SLOW_DOWN_TIMEOUT_MESSAGE:TIMEOUT_MESSAGE)}var decode=s=>atob(s),CLIENT_ID=decode("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),COPILOT_HEADERS={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},COPILOT_API_VERSION="2026-06-01";function normalizeDomain(input){let trimmed=input.trim();if(!trimmed)return null;try{return(trimmed.includes("://")?new URL(trimmed):new URL(`https://${trimmed}`)).hostname}catch{return null}}function getUrls(domain){return{
56
43
  deviceCodeUrl:`https://${domain}/login/device/code`,accessTokenUrl:`https://${domain}/login/oauth/access_token`,copilotTokenUrl:`https://api.${domain}/copilot_internal/v2/token`}}function getBaseUrlFromToken(token){let match=token.match(/proxy-ep=([^;]+)/);return match?`https://${match[1].replace(/^proxy\./,"api.")}`:null}function getGitHubCopilotBaseUrl(token,enterpriseDomain){if(token){let urlFromToken=getBaseUrlFromToken(token);if(urlFromToken)return urlFromToken}return enterpriseDomain?`http\
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{GoogleGenAI,convertMessages,convertTools,getDisabledGoogleThinkingConfig,isThinkingPart,mapStopReason,resolveGoogleFunctionCallingMode,resolveGoogleThinkingLevel,retainThoughtSignature,retryGoogleRequest,supportsGoogleStrictToolSampling,toGoogleSdkThinkingLevel,toGoogleThinkingLevel,usesGoogleThinkingLevel}from"./chunk-KK3KUUMM.js";import"./chunk-Z33NNMNB.js";import{formatProviderError,normalizeProviderError}from"./chunk-MVYV6MJY.js";import{buildBaseOptions,getPiUserAgent}from"./chunk-UDVC7A5S.js";
3
- import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{createRequestObserver,observeFetch,providerHeadersToRecord}from"./chunk-5CDES42D.js";import{calculateCost,clampThinkingLevel,collapseSystemMessages,getCurrentTools,getInitialSystemMessage,getSystemMessageText}from"./chunk-LUL775V7.js";import{AssistantMessageEventStream}from"./chunk-RYC5BYVE.js";import"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var toolCallCounter=0,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=collapseSystemMessages(context);return(async()=>{let output={role:"assistant",content:[],api:"google-generative-ai",provider:model.provider,model:model.id,usage:{usageIncomplete:!0,input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{if(options?.fetch&&options.fetch!==globalThis.
2
+ import{GoogleGenAI,convertMessages,convertTools,getDisabledGoogleThinkingConfig,isThinkingPart,mapStopReason,resolveGoogleFunctionCallingMode,resolveGoogleThinkingLevel,retainThoughtSignature,retryGoogleRequest,supportsGoogleStrictToolSampling,toGoogleSdkThinkingLevel,toGoogleThinkingLevel,usesGoogleThinkingLevel}from"./chunk-X6OTEVGA.js";import"./chunk-Z33NNMNB.js";import{formatProviderError,normalizeProviderError}from"./chunk-MVYV6MJY.js";import{buildBaseOptions,getPiUserAgent}from"./chunk-TIFFHHW6.js";
3
+ import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{createRequestObserver,observeFetch,providerHeadersToRecord}from"./chunk-5CDES42D.js";import{calculateCost,clampThinkingLevel,collapseSystemMessages,getCurrentTools,getInitialSystemMessage,getSystemMessageText}from"./chunk-5K5RFXXO.js";import{AssistantMessageEventStream}from"./chunk-IJYVMOB4.js";import"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var toolCallCounter=0,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=collapseSystemMessages(context);return(async()=>{let output={role:"assistant",content:[],api:"google-generative-ai",provider:model.provider,model:model.id,usage:{usageIncomplete:!0,input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{if(options?.fetch&&options.fetch!==globalThis.
4
4
  fetch)throw new Error("Custom fetch is not supported by the Google Generative AI adapter");let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let observe=createRequestObserver(options,{api:model.api,provider:model.provider,model:model.id,operation:"chat"}),client=createClient(model,apiKey,options?.headers,observeFetch(void 0,observe)),params=buildParams(model,normalizedContext,options),nextParams=await options?.onPayload?.(params,model);nextParams!==
5
5
  void 0&&(params=nextParams);let googleStream=await retryGoogleRequest(()=>client.models.generateContentStream(params),options);stream2.push({type:"start",partial:output});let currentBlock=null,blocks=output.content,blockIndex=()=>blocks.length-1;for await(let chunk of googleStream){await options?.onProviderStreamEvent?.(chunk,model),output.responseId||=chunk.responseId;let candidate=chunk.candidates?.[0];if(candidate?.content?.parts)for(let part of candidate.content.parts){if(part.text!==void 0){
6
6
  let isThinking=isThinkingPart(part);(!currentBlock||isThinking&&currentBlock.type!=="thinking"||!isThinking&&currentBlock.type!=="text")&&(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blocks.length-1,content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),isThinking?(currentBlock={type:"thinking",thinking:"",thinkingSignature:void 0},output.content.push(currentBlock),
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{GoogleGenAI,ResourceScope,convertMessages,convertTools,getDisabledGoogleThinkingConfig,isThinkingPart,mapStopReason,resolveGoogleFunctionCallingMode,resolveGoogleThinkingLevel,retainThoughtSignature,retryGoogleRequest,supportsGoogleStrictToolSampling,toGoogleSdkThinkingLevel,toGoogleThinkingLevel,usesGoogleThinkingLevel}from"./chunk-KK3KUUMM.js";import"./chunk-Z33NNMNB.js";import{formatProviderError,normalizeProviderError}from"./chunk-MVYV6MJY.js";import{buildBaseOptions,
3
- getPiUserAgent}from"./chunk-UDVC7A5S.js";import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{createRequestObserver,observeFetch,providerHeadersToRecord}from"./chunk-5CDES42D.js";import{getProviderEnvValue}from"./chunk-FACBDLFU.js";import{calculateCost,clampThinkingLevel,collapseSystemMessages,getCurrentTools,getInitialSystemMessage,getSystemMessageText}from"./chunk-LUL775V7.js";import{AssistantMessageEventStream}from"./chunk-RYC5BYVE.js";
2
+ import{GoogleGenAI,ResourceScope,convertMessages,convertTools,getDisabledGoogleThinkingConfig,isThinkingPart,mapStopReason,resolveGoogleFunctionCallingMode,resolveGoogleThinkingLevel,retainThoughtSignature,retryGoogleRequest,supportsGoogleStrictToolSampling,toGoogleSdkThinkingLevel,toGoogleThinkingLevel,usesGoogleThinkingLevel}from"./chunk-X6OTEVGA.js";import"./chunk-Z33NNMNB.js";import{formatProviderError,normalizeProviderError}from"./chunk-MVYV6MJY.js";import{buildBaseOptions,
3
+ getPiUserAgent}from"./chunk-TIFFHHW6.js";import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{createRequestObserver,observeFetch,providerHeadersToRecord}from"./chunk-5CDES42D.js";import{getProviderEnvValue}from"./chunk-FACBDLFU.js";import{calculateCost,clampThinkingLevel,collapseSystemMessages,getCurrentTools,getInitialSystemMessage,getSystemMessageText}from"./chunk-5K5RFXXO.js";import{AssistantMessageEventStream}from"./chunk-IJYVMOB4.js";
4
4
  import"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var API_VERSION="v1",GCP_VERTEX_CREDENTIALS_MARKER="gcp-vertex-credentials",toolCallCounter=0,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=collapseSystemMessages(context);return(async()=>{let output={role:"assistant",content:[],api:"google-vertex",provider:model.provider,model:model.id,usage:{usageIncomplete:!0,input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.
5
5
  now()};try{if(options?.fetch&&options.fetch!==globalThis.fetch)throw new Error("Custom fetch is not supported by the Google Vertex adapter");let apiKey=resolveApiKey(options),observe=createRequestObserver(options,{api:model.api,provider:model.provider,model:model.id,operation:"chat"}),observedFetch=observeFetch(void 0,observe),client=apiKey?createClientWithApiKey(model,apiKey,options?.headers,observedFetch):createClient(model,resolveProject(options),resolveLocation(options),options?.headers,options?.
6
6
  env,observedFetch),params=buildParams(model,normalizedContext,options),nextParams=await options?.onPayload?.(params,model);nextParams!==void 0&&(params=nextParams);let googleStream=await retryGoogleRequest(()=>client.models.generateContentStream(params),options);stream2.push({type:"start",partial:output});let currentBlock=null,blocks=output.content,blockIndex=()=>blocks.length-1;for await(let chunk of googleStream){await options?.onProviderStreamEvent?.(chunk,model),output.responseId||=chunk.responseId;
@@ -0,0 +1,2 @@
1
+ import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
+ import{buildSessionContext,resizeImage}from"./chunk-SCBU5WOP.js";import{getAgentDir}from"./chunk-YRCLNWFV.js";import"./chunk-Y26OS23T.js";import"./chunk-PY7SOXCA.js";import"./chunk-DBL35X7L.js";import"./chunk-YDBNMIA3.js";import"./chunk-5K5RFXXO.js";import"./chunk-IJYVMOB4.js";import"./chunk-VEYTRNQC.js";import"./chunk-AWCJWXGD.js";import"./chunk-OKALNPTJ.js";import"./chunk-JXWJOIH4.js";export{buildSessionContext,getAgentDir,resizeImage};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
+ import"./chunk-JXWJOIH4.js";var{createJiti}=process.versions.bun?await import("jiti/static"):await import("jiti");export{createJiti};
@@ -1,18 +1,18 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{combineAbortSignals}from"./chunk-L6Z6JKKC.js";import{shortHash}from"./chunk-PJACZCIR.js";import{buildBaseOptions,getJsonSchemaToolParameters,getPiUserAgent,resolveJsonSchemaStrictSampling,transformMessages}from"./chunk-UDVC7A5S.js";import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{createRequestObserver,headersToRecord}from"./chunk-5CDES42D.js";import{parseStreamingJson,parseStreamingJsonWhileStreaming}from"./chunk-MG5PX4KU.js";
3
- import{calculateCost,clampThinkingLevel,getCurrentTools,getSystemMessageText,renderSystemMessageUpdate,resolveTranscript}from"./chunk-LUL775V7.js";import{AssistantMessageEventStream}from"./chunk-RYC5BYVE.js";import"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var MISTRAL_TOOL_CALL_ID_LENGTH=9,MAX_MISTRAL_ERROR_BODY_CHARS=4e3,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=resolveTranscript(context,model.compat?.supportsMidConvoSystemMessages);return(async()=>{let output=createOutput(model);try{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let normalizeMistralToolCallId=createMistralToolCallIdNormalizer(),transformedMessages=transformMessages(normalizedContext.
4
- messages,model,id=>normalizeMistralToolCallId(id)),payload=buildChatPayload(model,normalizedContext,transformedMessages,options),nextPayload=await options?.onPayload?.(payload,model);nextPayload!==void 0&&(payload=nextPayload);let mistralStream=await requestMistralStream(model,payload,apiKey,options);if(stream2.push({type:"start",partial:output}),await consumeChatStream(model,output,stream2,mistralStream,options?.onProviderStreamEvent),options?.signal?.aborted)throw new Error("Request was aborte\
5
- d");if(output.stopReason==="pending")throw new Error("Mistral stream ended without a finish reason");if(output.stopReason==="aborted"||output.stopReason==="error")throw new Error(output.errorMessage||"An unknown error occurred");stream2.push({type:"done",reason:output.stopReason,message:output}),stream2.end()}catch(error){for(let block of output.content){let partialArgs=block.partialArgs;block.type==="toolCall"&&partialArgs!==void 0&&(block.arguments=parseStreamingJson(partialArgs)),delete block.
6
- partialArgs}output.usage.usageIncomplete=!0,output.stopReason=options?.signal?.aborted?"aborted":"error",output.errorMessage=formatMistralError(error),stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}})(),stream2},streamSimple=(model,context,options)=>{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let base={...buildBaseOptions(model,context,options,apiKey),toolChoice:options?.toolChoice},clampedReasoning=options?.
7
- reasoning?clampThinkingLevel(model,options.reasoning):void 0,reasoning=clampedReasoning==="off"?void 0:clampedReasoning,effortMap=model.reasoning?model.thinkingLevelMap:void 0,reasoningEffort=effortMap?reasoning?effortMap[reasoning]??"high":effortMap.off??void 0:void 0;return stream(model,context,{...base,promptMode:model.reasoning&&!effortMap&&reasoning?"reasoning":void 0,reasoningEffort})};function createOutput(model){return{role:"assistant",content:[],api:model.api,provider:model.provider,model:model.
8
- id,usage:{usageIncomplete:!0,input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()}}function createMistralToolCallIdNormalizer(){let idMap=new Map,reverseMap=new Map;return id=>{let existing=idMap.get(id);if(existing)return existing;let attempt=0;for(;;){let candidate=deriveMistralToolCallId(id,attempt),owner=reverseMap.get(candidate);if(!owner||owner===id)return idMap.set(id,candidate),reverseMap.
9
- set(candidate,id),candidate;attempt++}}}function deriveMistralToolCallId(id,attempt){let normalized=id.replace(/[^a-zA-Z0-9]/g,"");if(attempt===0&&normalized.length===MISTRAL_TOOL_CALL_ID_LENGTH)return normalized;let seedBase=normalized||id,seed=attempt===0?seedBase:`${seedBase}:${attempt}`;return shortHash(seed).replace(/[^a-zA-Z0-9]/g,"").slice(0,MISTRAL_TOOL_CALL_ID_LENGTH)}function formatMistralError(error){if(error instanceof Error){let httpError=error,statusCode=typeof httpError.statusCode==
10
- "number"?httpError.statusCode:void 0,bodyText=typeof httpError.body=="string"?httpError.body.trim():void 0;return statusCode!==void 0&&bodyText?`Mistral API error (${statusCode}): ${truncateErrorText(bodyText,MAX_MISTRAL_ERROR_BODY_CHARS)}`:statusCode!==void 0?`Mistral API error (${statusCode}): ${error.message}`:error.message}return safeJsonStringify(error)}function truncateErrorText(text,maxChars){return text.length<=maxChars?text:`${text.slice(0,maxChars)}... [truncated ${text.length-maxChars}\
11
- chars]`}function safeJsonStringify(value){try{let serialized=JSON.stringify(value);return serialized===void 0?String(value):serialized}catch{return String(value)}}async function requestMistralStream(model,payload,apiKey,options){let baseUrl=new URL(model.baseUrl);baseUrl.pathname=`${baseUrl.pathname.replace(/\/+$/u,"")}/`;let url=new URL("v1/chat/completions",baseUrl),headers=buildMistralHeaders(model,apiKey,options),body=JSON.stringify(toMistralWirePayload(payload));await createRequestObserver(
12
- options,{api:model.api,provider:model.provider,model:model.id,operation:"chat"})(body);let timeoutMs=options?.timeoutMs??6e4,headerTimeoutSignal=AbortSignal.timeout(timeoutMs),combinedSignal=combineAbortSignals([options?.signal,headerTimeoutSignal]),response;try{response=await(options?.fetch??globalThis.fetch)(url,{method:"POST",headers,body,signal:combinedSignal.signal})}catch(error){throw headerTimeoutSignal.aborted&&!options?.signal?.aborted?new Error(`Mistral response headers timed out after\
13
- ${timeoutMs}ms`):error}finally{combinedSignal.cleanup()}if(await options?.onResponse?.({status:response.status,headers:headersToRecord(response.headers)},model),!response.ok){let body2=await response.text();throw new MistralHttpError(response.status,body2,response.statusText)}if(!response.body)throw new Error("Mistral response has no body");return readMistralEvents(response.body,options?.signal)}var MistralHttpError=class extends Error{statusCode;body;constructor(statusCode,body,statusText){super(
14
- statusText||`Request failed with status ${statusCode}`),this.name="MistralHttpError",this.statusCode=statusCode,this.body=body}};function buildMistralHeaders(model,apiKey,options){let headers=new Headers({"User-Agent":getPiUserAgent(),accept:"text/event-stream",authorization:`Bearer ${apiKey}`,"content-type":"application/json"});applyMistralHeaderOverrides(headers,model.headers),applyMistralHeaderOverrides(headers,options?.headers);let hasExplicitAffinity=hasMistralHeaderOverride(model.headers,"\
15
- x-affinity")||hasMistralHeaderOverride(options?.headers,"x-affinity");return shouldUsePromptCaching(options)&&!hasExplicitAffinity&&headers.set("x-affinity",options.sessionId),headers}function applyMistralHeaderOverrides(headers,overrides){if(overrides)for(let[name,value]of Object.entries(overrides))value===null?headers.delete(name):headers.set(name,value)}function hasMistralHeaderOverride(overrides,target){return!!overrides&&Object.keys(overrides).some(name=>name.toLowerCase()===target)}function toMistralWirePayload(payload){
2
+ import{combineAbortSignals}from"./chunk-L6Z6JKKC.js";import{shortHash}from"./chunk-PJACZCIR.js";import{cacheJsonSerialization}from"./chunk-Q7VXYXY3.js";import{buildBaseOptions,getJsonSchemaToolParameters,getPiUserAgent,resolveJsonSchemaStrictSampling,transformMessages}from"./chunk-TIFFHHW6.js";import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{createRequestObserver,headersToRecord}from"./chunk-5CDES42D.js";
3
+ import{parseStreamingJson,parseStreamingJsonWhileStreaming,parseToolCallArguments}from"./chunk-YDBNMIA3.js";import{calculateCost,clampThinkingLevel,getCurrentTools,getSystemMessageText,renderSystemMessageUpdate,resolveTranscript}from"./chunk-5K5RFXXO.js";import{AssistantMessageEventStream}from"./chunk-IJYVMOB4.js";import"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var MISTRAL_TOOL_CALL_ID_LENGTH=9,MAX_MISTRAL_ERROR_BODY_CHARS=4e3,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=resolveTranscript(context,model.compat?.supportsMidConvoSystemMessages);return(async()=>{let output=createOutput(model);try{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let normalizeMistralToolCallId=createMistralToolCallIdNormalizer(),transformedMessages=transformMessages(normalizedContext.
4
+ messages,model,id=>normalizeMistralToolCallId(id)),payload=buildChatPayload(model,normalizedContext,transformedMessages,options),onPayload=options?.onPayload,nextPayload=await onPayload?.call(options,payload,model);nextPayload!==void 0&&(payload=nextPayload);let mistralStream=await requestMistralStream(model,payload,apiKey,!!onPayload,options);if(stream2.push({type:"start",partial:output}),await consumeChatStream(model,output,stream2,mistralStream,options?.onProviderStreamEvent),options?.signal?.
5
+ aborted)throw new Error("Request was aborted");if(output.stopReason==="pending")throw new Error("Mistral stream ended without a finish reason");if(output.stopReason==="aborted"||output.stopReason==="error")throw new Error(output.errorMessage||"An unknown error occurred");stream2.push({type:"done",reason:output.stopReason,message:output}),stream2.end()}catch(error){for(let block of output.content){let partialArgs=block.partialArgs;block.type==="toolCall"&&partialArgs!==void 0&&(block.arguments=parseStreamingJson(
6
+ partialArgs)),delete block.partialArgs}output.usage.usageIncomplete=!0,output.stopReason=options?.signal?.aborted?"aborted":"error",output.errorMessage=formatMistralError(error),stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}})(),stream2},streamSimple=(model,context,options)=>{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let base={...buildBaseOptions(model,context,options,apiKey),toolChoice:options?.toolChoice},
7
+ clampedReasoning=options?.reasoning?clampThinkingLevel(model,options.reasoning):void 0,reasoning=clampedReasoning==="off"?void 0:clampedReasoning,effortMap=model.reasoning?model.thinkingLevelMap:void 0,reasoningEffort=effortMap?reasoning?effortMap[reasoning]??"high":effortMap.off??void 0:void 0;return stream(model,context,{...base,promptMode:model.reasoning&&!effortMap&&reasoning?"reasoning":void 0,reasoningEffort})};function createOutput(model){return{role:"assistant",content:[],api:model.api,provider:model.
8
+ provider,model:model.id,usage:{usageIncomplete:!0,input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()}}function createMistralToolCallIdNormalizer(){let idMap=new Map,reverseMap=new Map;return id=>{let existing=idMap.get(id);if(existing)return existing;let attempt=0;for(;;){let candidate=deriveMistralToolCallId(id,attempt),owner=reverseMap.get(candidate);if(!owner||owner===id)return idMap.set(id,
9
+ candidate),reverseMap.set(candidate,id),candidate;attempt++}}}function deriveMistralToolCallId(id,attempt){let normalized=id.replace(/[^a-zA-Z0-9]/g,"");if(attempt===0&&normalized.length===MISTRAL_TOOL_CALL_ID_LENGTH)return normalized;let seedBase=normalized||id,seed=attempt===0?seedBase:`${seedBase}:${attempt}`;return shortHash(seed).replace(/[^a-zA-Z0-9]/g,"").slice(0,MISTRAL_TOOL_CALL_ID_LENGTH)}function formatMistralError(error){if(error instanceof Error){let httpError=error,statusCode=typeof httpError.
10
+ statusCode=="number"?httpError.statusCode:void 0,bodyText=typeof httpError.body=="string"?httpError.body.trim():void 0;return statusCode!==void 0&&bodyText?`Mistral API error (${statusCode}): ${truncateErrorText(bodyText,MAX_MISTRAL_ERROR_BODY_CHARS)}`:statusCode!==void 0?`Mistral API error (${statusCode}): ${error.message}`:error.message}return safeJsonStringify(error)}function truncateErrorText(text,maxChars){return text.length<=maxChars?text:`${text.slice(0,maxChars)}... [truncated ${text.length-
11
+ maxChars} chars]`}function safeJsonStringify(value){try{let serialized=JSON.stringify(value);return serialized===void 0?String(value):serialized}catch{return String(value)}}async function requestMistralStream(model,payload,apiKey,usedPayloadHook,options){let baseUrl=new URL(model.baseUrl);baseUrl.pathname=`${baseUrl.pathname.replace(/\/+$/u,"")}/`;let url=new URL("v1/chat/completions",baseUrl),headers=buildMistralHeaders(model,apiKey,options),wirePayload=toMistralWirePayload(payload);usedPayloadHook||
12
+ cacheJsonSerialization(wirePayload.messages);let body=JSON.stringify(wirePayload);await createRequestObserver(options,{api:model.api,provider:model.provider,model:model.id,operation:"chat"})(body);let timeoutMs=options?.timeoutMs??6e4,headerTimeoutSignal=AbortSignal.timeout(timeoutMs),combinedSignal=combineAbortSignals([options?.signal,headerTimeoutSignal]),response;try{response=await(options?.fetch??globalThis.fetch)(url,{method:"POST",headers,body,signal:combinedSignal.signal})}catch(error){throw headerTimeoutSignal.
13
+ aborted&&!options?.signal?.aborted?new Error(`Mistral response headers timed out after ${timeoutMs}ms`):error}finally{combinedSignal.cleanup()}if(await options?.onResponse?.({status:response.status,headers:headersToRecord(response.headers)},model),!response.ok){let body2=await response.text();throw new MistralHttpError(response.status,body2,response.statusText)}if(!response.body)throw new Error("Mistral response has no body");return readMistralEvents(response.body,options?.signal)}var MistralHttpError=class extends Error{statusCode;body;constructor(statusCode,body,statusText){
14
+ super(statusText||`Request failed with status ${statusCode}`),this.name="MistralHttpError",this.statusCode=statusCode,this.body=body}};function buildMistralHeaders(model,apiKey,options){let headers=new Headers({"User-Agent":getPiUserAgent(),accept:"text/event-stream",authorization:`Bearer ${apiKey}`,"content-type":"application/json"});applyMistralHeaderOverrides(headers,model.headers),applyMistralHeaderOverrides(headers,options?.headers);let hasExplicitAffinity=hasMistralHeaderOverride(model.headers,
15
+ "x-affinity")||hasMistralHeaderOverride(options?.headers,"x-affinity");return shouldUsePromptCaching(options)&&!hasExplicitAffinity&&headers.set("x-affinity",options.sessionId),headers}function applyMistralHeaderOverrides(headers,overrides){if(overrides)for(let[name,value]of Object.entries(overrides))value===null?headers.delete(name):headers.set(name,value)}function hasMistralHeaderOverride(overrides,target){return!!overrides&&Object.keys(overrides).some(name=>name.toLowerCase()===target)}function toMistralWirePayload(payload){
16
16
  let wirePayload={...payload};for(let[source,target]of[["topP","top_p"],["maxTokens","max_tokens"],["randomSeed","random_seed"],["responseFormat","response_format"],["toolChoice","tool_choice"],["presencePenalty","presence_penalty"],["frequencyPenalty","frequency_penalty"],["parallelToolCalls","parallel_tool_calls"],["reasoningEffort","reasoning_effort"],["promptMode","prompt_mode"],["promptCacheKey","prompt_cache_key"],["safePrompt","safe_prompt"]])remapMistralProperty(wirePayload,source,target);
17
17
  wirePayload.messages=payload.messages.map(message=>toMistralWireMessage(message));let responseFormat=wirePayload.response_format;if(isMistralRecord(responseFormat)){let wireResponseFormat={...responseFormat};remapMistralProperty(wireResponseFormat,"jsonSchema","json_schema");let jsonSchema=wireResponseFormat.json_schema;if(isMistralRecord(jsonSchema)){let wireJsonSchema={...jsonSchema};remapMistralProperty(wireJsonSchema,"schemaDefinition","schema"),wireResponseFormat.json_schema=wireJsonSchema}
18
18
  wirePayload.response_format=wireResponseFormat}return wirePayload}function toMistralWireMessage(message){let wireMessage={...message};return remapMistralProperty(wireMessage,"toolCalls","tool_calls"),remapMistralProperty(wireMessage,"toolCallId","tool_call_id"),Array.isArray(message.content)&&(wireMessage.content=message.content.map(chunk=>toMistralWireContentChunk(chunk))),wireMessage}function toMistralWireContentChunk(chunk){let wireChunk={...chunk};for(let[source,target]of[["imageUrl","image_\
@@ -32,12 +32,12 @@ deltaText);if(!thinkingDelta)continue;currentBlock?.type!=="thinking"&&(finishCu
32
32
  currentBlock?.type!=="text"&&(finishCurrentBlock(currentBlock),currentBlock={type:"text",text:""},output.content.push(currentBlock),stream2.push({type:"text_start",contentIndex:blockIndex(),partial:output})),currentBlock.text+=textDelta,stream2.push({type:"text_delta",contentIndex:blockIndex(),delta:textDelta,partial:output})}}}let toolCalls=delta.tool_calls||[];for(let toolCall of toolCalls){currentBlock&&(finishCurrentBlock(currentBlock),currentBlock=null);let callId=toolCall.id&&toolCall.id!==
33
33
  "null"?toolCall.id:deriveMistralToolCallId(`toolcall:${toolCall.index??0}`,0),key=toolCall.index??callId,existingIndex=toolBlocksByKey.get(key),block;if(existingIndex!==void 0){let existing=output.content[existingIndex];existing?.type==="toolCall"&&(block=existing)}block||(block={type:"toolCall",id:callId,name:toolCall.function.name,arguments:{},partialArgs:""},output.content.push(block),toolBlocksByKey.set(key,output.content.length-1),stream2.push({type:"toolcall_start",contentIndex:output.content.
34
34
  length-1,partial:output}));let argsDelta=typeof toolCall.function.arguments=="string"?toolCall.function.arguments:JSON.stringify(toolCall.function.arguments||{});block.partialArgs=(block.partialArgs||"")+argsDelta,block.arguments=parseStreamingJsonWhileStreaming(block,block.partialArgs,block.arguments),stream2.push({type:"toolcall_delta",contentIndex:toolBlocksByKey.get(key),delta:argsDelta,partial:output})}}finishCurrentBlock(currentBlock);for(let index of toolBlocksByKey.values()){let block=output.
35
- content[index];if(block.type!=="toolCall")continue;let toolBlock=block;toolBlock.arguments=parseStreamingJson(toolBlock.partialArgs),delete toolBlock.partialArgs,stream2.push({type:"toolcall_end",contentIndex:index,toolCall:toolBlock,partial:output})}}function toFunctionTools(tools){return tools.map(tool=>{let strict=resolveJsonSchemaStrictSampling(tool,!0);return{type:"function",function:{name:tool.name,description:tool.description,parameters:stripSymbolKeys(getJsonSchemaToolParameters(tool,strict)),
36
- strict:strict??!1}}})}function stripSymbolKeys(value){if(Array.isArray(value))return value.map(item=>stripSymbolKeys(item));if(value&&typeof value=="object"){let result={};for(let[key,entry]of Object.entries(value))result[key]=stripSymbolKeys(entry);return result}return value}function toChatMessages(messages,supportsImages){let result=[];for(let[index,msg]of messages.entries()){if(msg.role==="system"){let text=index===0?getSystemMessageText(msg):renderSystemMessageUpdate(msg);text.length>0&&result.
37
- push({role:"system",content:sanitizeSurrogates(text)});continue}if(msg.role==="user"){if(typeof msg.content=="string"){result.push({role:"user",content:sanitizeSurrogates(msg.content)});continue}let hadImages=msg.content.some(item=>item.type==="image"),content=msg.content.filter(item=>item.type==="text"||supportsImages).map(item=>item.type==="text"?{type:"text",text:sanitizeSurrogates(item.text)}:{type:"image_url",imageUrl:`data:${item.mimeType};base64,${item.data}`});if(content.length>0){result.
38
- push({role:"user",content});continue}hadImages&&!supportsImages&&result.push({role:"user",content:"(image omitted: model does not support images)"});continue}if(msg.role==="assistant"){let contentParts=[],toolCalls=[];for(let block of msg.content){if(block.type==="text"){block.text.trim().length>0&&contentParts.push({type:"text",text:sanitizeSurrogates(block.text)});continue}if(block.type==="thinking"){block.thinking.trim().length>0&&contentParts.push({type:"thinking",thinking:[{type:"text",text:sanitizeSurrogates(
39
- block.thinking)}]});continue}toolCalls.push({id:block.id,type:"function",function:{name:block.name,arguments:JSON.stringify(block.arguments||{})},index:0})}let assistantMessage={role:"assistant",prefix:!1};contentParts.length>0&&(assistantMessage.content=contentParts),toolCalls.length>0&&(assistantMessage.toolCalls=toolCalls),(contentParts.length>0||toolCalls.length>0)&&result.push(assistantMessage);continue}let toolContent=[],textResult=msg.content.filter(part=>part.type==="text").map(part=>part.
40
- type==="text"?sanitizeSurrogates(part.text):"").join(`
35
+ content[index];if(block.type!=="toolCall")continue;let toolBlock=block;Object.assign(toolBlock,parseToolCallArguments(toolBlock.partialArgs)),delete toolBlock.partialArgs,stream2.push({type:"toolcall_end",contentIndex:index,toolCall:toolBlock,partial:output})}}function toFunctionTools(tools){return tools.map(tool=>{let strict=resolveJsonSchemaStrictSampling(tool,!0);return{type:"function",function:{name:tool.name,description:tool.description,parameters:stripSymbolKeys(getJsonSchemaToolParameters(
36
+ tool,strict)),strict:strict??!1}}})}function stripSymbolKeys(value){if(Array.isArray(value))return value.map(item=>stripSymbolKeys(item));if(value&&typeof value=="object"){let result={};for(let[key,entry]of Object.entries(value))result[key]=stripSymbolKeys(entry);return result}return value}function toChatMessages(messages,supportsImages){let result=[];for(let[index,msg]of messages.entries()){if(msg.role==="system"){let text=index===0?getSystemMessageText(msg):renderSystemMessageUpdate(msg);text.
37
+ length>0&&result.push({role:"system",content:sanitizeSurrogates(text)});continue}if(msg.role==="user"){if(typeof msg.content=="string"){result.push({role:"user",content:sanitizeSurrogates(msg.content)});continue}let hadImages=msg.content.some(item=>item.type==="image"),content=msg.content.filter(item=>item.type==="text"||supportsImages).map(item=>item.type==="text"?{type:"text",text:sanitizeSurrogates(item.text)}:{type:"image_url",imageUrl:`data:${item.mimeType};base64,${item.data}`});if(content.
38
+ length>0){result.push({role:"user",content});continue}hadImages&&!supportsImages&&result.push({role:"user",content:"(image omitted: model does not support images)"});continue}if(msg.role==="assistant"){let contentParts=[],toolCalls=[];for(let block of msg.content){if(block.type==="text"){block.text.trim().length>0&&contentParts.push({type:"text",text:sanitizeSurrogates(block.text)});continue}if(block.type==="thinking"){block.thinking.trim().length>0&&contentParts.push({type:"thinking",thinking:[
39
+ {type:"text",text:sanitizeSurrogates(block.thinking)}]});continue}toolCalls.push({id:block.id,type:"function",function:{name:block.name,arguments:JSON.stringify(block.arguments||{})},index:0})}let assistantMessage={role:"assistant",prefix:!1};contentParts.length>0&&(assistantMessage.content=contentParts),toolCalls.length>0&&(assistantMessage.toolCalls=toolCalls),(contentParts.length>0||toolCalls.length>0)&&result.push(assistantMessage);continue}let toolContent=[],textResult=msg.content.filter(part=>part.
40
+ type==="text").map(part=>part.type==="text"?sanitizeSurrogates(part.text):"").join(`
41
41
  `),hasImages=msg.content.some(part=>part.type==="image"),toolText=buildToolResultText(textResult,hasImages,supportsImages,msg.isError);toolContent.push({type:"text",text:toolText});for(let part of msg.content)supportsImages&&part.type==="image"&&toolContent.push({type:"image_url",imageUrl:`data:${part.mimeType};base64,${part.data}`});result.push({role:"tool",toolCallId:msg.toolCallId,name:msg.toolName,content:toolContent})}return result}function buildToolResultText(text,hasImages,supportsImages,isError){
42
42
  let trimmed=text.trim(),errorPrefix=isError?"[tool error] ":"";return trimmed.length>0?`${errorPrefix}${trimmed}${hasImages&&!supportsImages?`
43
43
  [tool image omitted: model does not support images]`:""}`:hasImages?supportsImages?isError?"[tool error] (see attached image)":"(see attached image)":isError?"[tool error] (image omitted: model does not support images)":"(image omitted: model does not support images)":isError?"[tool error] (no tool output)":"(no tool output)"}function mapToolChoice(choice){if(choice)return choice==="auto"||choice==="none"||choice==="any"||choice==="required"?choice:{type:"function",function:{name:choice.function.
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{AnthropicError,DEFAULT_MEMORY_SYNC_INTERVAL_MS,MIN_MEMORY_SYNC_INTERVAL_MS,ToolError,__classPrivateFieldGet,__classPrivateFieldSet,checkMemorySyncInterval,decodeUTF8,encodeUTF8,isStatus,loggerFor,promiseWithResolvers}from"./chunk-A7QKOI62.js";import{child_process,crypto,fs,path,stream,util}from"./chunk-7ZC4UXSL.js";import"./chunk-JXWJOIH4.js";import*as fs4 from"node:fs/promises";import*as fssync from"node:fs";import*as path2 from"node:path";import*as cp from"node:child_process";import*as crypto2 from"node:crypto";import*as readline from"node:readline";function betaTool(options){if(options.inputSchema.type!=="object")throw new Error(`JSON schema for tool "${options.name}" must be an object, but got ${options.inputSchema.type}`);return{type:"custom",name:options.name,input_schema:options.inputSchema,description:options.description,run:options.run,parse:content=>content,...options.close?{close:options.close}:{}}}var fs2=fs.promises,DIR_CREATE_MODE=448,FILE_CREATE_MODE=384;function isWithin(root,p){let rel=path.relative(root,p);return rel===""||!rel.startsWith(".."+path.sep)&&rel!==".."&&!path.isAbsolute(rel)}async function containingRoot(roots,target){for(let root of roots)if(isWithin(await canonicalize(path.resolve(root)),target))return root}var MAX_SYMLINK_HOPS=40;function errnoCode(err){let code=err?.code;return typeof code=="string"?code:void 0}async function canonicalize(abs){let tail=[],prefix=abs,
2
+ import{AnthropicError,DEFAULT_MEMORY_SYNC_INTERVAL_MS,MIN_MEMORY_SYNC_INTERVAL_MS,ToolError,__classPrivateFieldGet,__classPrivateFieldSet,checkMemorySyncInterval,decodeUTF8,encodeUTF8,isStatus,loggerFor,promiseWithResolvers}from"./chunk-FZUJXM6D.js";import{child_process,crypto,fs,path,stream,util}from"./chunk-7ZC4UXSL.js";import"./chunk-JXWJOIH4.js";import*as fs4 from"node:fs/promises";import*as fssync from"node:fs";import*as path2 from"node:path";import*as cp from"node:child_process";import*as crypto2 from"node:crypto";import*as readline from"node:readline";function betaTool(options){if(options.inputSchema.type!=="object")throw new Error(`JSON schema for tool "${options.name}" must be an object, but got ${options.inputSchema.type}`);return{type:"custom",name:options.name,input_schema:options.inputSchema,description:options.description,run:options.run,parse:content=>content,...options.close?{close:options.close}:{}}}var fs2=fs.promises,DIR_CREATE_MODE=448,FILE_CREATE_MODE=384;function isWithin(root,p){let rel=path.relative(root,p);return rel===""||!rel.startsWith(".."+path.sep)&&rel!==".."&&!path.isAbsolute(rel)}async function containingRoot(roots,target){for(let root of roots)if(isWithin(await canonicalize(path.resolve(root)),target))return root}var MAX_SYMLINK_HOPS=40;function errnoCode(err){let code=err?.code;return typeof code=="string"?code:void 0}async function canonicalize(abs){let tail=[],prefix=abs,
3
3
  hops=0;for(;;){let real;try{real=await fs2.realpath(prefix)}catch(realpathErr){let isLink;try{isLink=(await fs2.lstat(prefix)).isSymbolicLink()}catch(lstatErr){let code=errnoCode(lstatErr);if(code!=="ENOENT"&&code!=="ENOTDIR")throw lstatErr;let parent=path.dirname(prefix);if(parent===prefix)throw lstatErr;tail.push(path.basename(prefix)),prefix=parent;continue}if(!isLink)throw realpathErr;if(++hops>MAX_SYMLINK_HOPS)throw Object.assign(new Error("too many levels of symbolic links"),{code:"ELOOP"});
4
4
  prefix=path.resolve(path.dirname(prefix),await fs2.readlink(prefix));continue}return tail.length?path.join(real,...tail.reverse()):real}}async function confineToRoot(root,p,opts){let allowedRoots=opts?.allowedRoots??[],realRoot=await canonicalize(path.resolve(root)),real;try{real=await canonicalize(path.resolve(realRoot,p))}catch(err){throw new ToolError(fsErrorMessage(err,`path ${JSON.stringify(p)}`))}if(isWithin(realRoot,real)||await containingRoot(allowedRoots,real)!==void 0)return real;let permitted=allowedRoots.
5
5
  length?"the session's working directory and its other permitted directories":"the session's working directory";throw new ToolError(`path ${JSON.stringify(p)} is outside ${permitted}`)}async function atomicWriteFile(targetPath,content){let dir=path.dirname(targetPath),tempPath=path.join(dir,`.tmp-${process.pid}-${crypto.randomUUID()}`),existingMode=await fs2.stat(targetPath).then(st=>st.mode&511,()=>{}),handle;try{handle=await fs2.open(tempPath,"wx",FILE_CREATE_MODE),existingMode!==void 0&&await handle.