@qqbrowser/qbot-dsh 0.1.0 → 0.1.2

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 (629) hide show
  1. package/cordis.patch.yml +50 -0
  2. package/lib/args-w1okyL78.js +9 -0
  3. package/lib/bin.js +1 -2
  4. package/lib/client.js +1 -0
  5. package/lib/content-review-CqDoh3wY.js +1 -0
  6. package/lib/content-review.js +1 -0
  7. package/lib/dump-config-CIL0Goqj.js +1 -0
  8. package/lib/gateway-port-CSFbDyoZ.js +1 -0
  9. package/lib/index.js +1 -0
  10. package/lib/llm-gateway-openai.js +17 -0
  11. package/lib/native-protocol-DdrIh89-.js +2 -0
  12. package/lib/{plugin-DNAeLZbb.js → plugin-viWCLnSr.js} +1 -1
  13. package/lib/profile-boot-CxJUSdnu.js +1 -0
  14. package/lib/profile-boot-DCgBQ4qO.js +8 -0
  15. package/lib/qb-auth-C2ofR1zn.js +4 -0
  16. package/lib/qb-auth.js +1 -0
  17. package/lib/web-search-dsh.js +1 -0
  18. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-cjs/index.js +7 -2
  19. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +3 -0
  20. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +3 -0
  21. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +1 -1
  22. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-cjs/index.js +7 -2
  23. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +3 -0
  24. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +3 -0
  25. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +1 -1
  26. package/node_modules/@deepseek-ai/cordis-plugin-hmr/package.json +1 -1
  27. package/node_modules/@deepseek-ai/dsh-agent/package.json +1 -1
  28. package/node_modules/@deepseek-ai/dsh-agent-default-model/package.json +1 -1
  29. package/node_modules/@deepseek-ai/dsh-agent-instructions/lib/index.js +3 -3
  30. package/node_modules/@deepseek-ai/dsh-agent-instructions/package.json +1 -1
  31. package/node_modules/@deepseek-ai/dsh-agent-loop/package.json +1 -1
  32. package/node_modules/@deepseek-ai/dsh-agent-presets/package.json +1 -1
  33. package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/package.json +1 -1
  34. package/node_modules/@deepseek-ai/dsh-anonymous-user-id/package.json +1 -1
  35. package/node_modules/@deepseek-ai/dsh-api-gateway/package.json +1 -1
  36. package/node_modules/@deepseek-ai/dsh-api-remotes/package.json +1 -1
  37. package/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +12 -12
  38. package/node_modules/@deepseek-ai/dsh-app-boot/package.json +1 -1
  39. package/node_modules/@deepseek-ai/dsh-atomic-write/package.json +1 -1
  40. package/node_modules/@deepseek-ai/dsh-attachment/package.json +1 -1
  41. package/node_modules/@deepseek-ai/dsh-attachment-local/lib/index.js +1 -1
  42. package/node_modules/@deepseek-ai/dsh-attachment-local/package.json +1 -1
  43. package/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +6 -37
  44. package/node_modules/@deepseek-ai/dsh-base/package.json +1 -1
  45. package/node_modules/@deepseek-ai/dsh-bash-local/package.json +1 -1
  46. package/node_modules/@deepseek-ai/dsh-bash-sandbox/package.json +1 -1
  47. package/node_modules/@deepseek-ai/dsh-brand/package.json +1 -1
  48. package/node_modules/@deepseek-ai/dsh-client-connection/package.json +1 -1
  49. package/node_modules/@deepseek-ai/dsh-client-hmr/package.json +1 -1
  50. package/node_modules/@deepseek-ai/dsh-client-locale/lib/client.js +1 -1
  51. package/node_modules/@deepseek-ai/dsh-client-locale/package.json +1 -1
  52. package/node_modules/@deepseek-ai/dsh-client-modules/package.json +1 -1
  53. package/node_modules/@deepseek-ai/dsh-client-runtime/package.json +1 -1
  54. package/node_modules/@deepseek-ai/dsh-client-schema-form/package.json +1 -1
  55. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/client.js +1 -1
  56. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/package.json +1 -1
  57. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/package.json +1 -1
  58. package/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +1 -1
  59. package/node_modules/@deepseek-ai/dsh-client-ui-commands/package.json +1 -1
  60. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +8 -8
  61. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/package.json +1 -1
  62. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/lib/client.js +3 -3
  63. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/package.json +1 -1
  64. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +1 -1
  65. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/package.json +1 -1
  66. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/lib/client.js +1 -1
  67. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/package.json +1 -1
  68. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-native/package.json +1 -1
  69. package/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +1 -1
  70. package/node_modules/@deepseek-ai/dsh-client-ui-goal/package.json +1 -1
  71. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/lib/client.js +1 -1
  72. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/package.json +1 -1
  73. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/client.js +1 -1
  74. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/package.json +1 -1
  75. package/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +1 -1
  76. package/node_modules/@deepseek-ai/dsh-client-ui-layout/package.json +1 -1
  77. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/lib/client.js +1 -1
  78. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/package.json +1 -1
  79. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +1 -1
  80. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/package.json +1 -1
  81. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/lib/client.js +1 -1
  82. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/package.json +1 -1
  83. package/node_modules/@deepseek-ai/dsh-client-ui-plan/lib/client.js +1 -1
  84. package/node_modules/@deepseek-ai/dsh-client-ui-plan/package.json +1 -1
  85. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +1 -1
  86. package/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/client.js +1 -1
  87. package/node_modules/@deepseek-ai/dsh-client-ui-settings/package.json +1 -1
  88. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +1 -1
  89. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/package.json +1 -1
  90. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +3 -3
  91. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/package.json +1 -1
  92. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +1 -1
  93. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/package.json +1 -1
  94. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/client.js +1 -1
  95. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/package.json +1 -1
  96. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  97. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/package.json +1 -1
  98. package/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/client.js +3 -3
  99. package/node_modules/@deepseek-ai/dsh-client-ui-skill/package.json +1 -1
  100. package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +1 -1
  101. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +1 -1
  102. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/package.json +1 -1
  103. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
  104. package/node_modules/@deepseek-ai/dsh-client-ui-theme/package.json +1 -1
  105. package/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +4 -4
  106. package/node_modules/@deepseek-ai/dsh-client-ui-tool/package.json +1 -1
  107. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +14 -14
  108. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/package.json +1 -1
  109. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/client.js +1 -1
  110. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/package.json +1 -1
  111. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/lib/client.js +1 -1
  112. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/package.json +1 -1
  113. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +1 -1
  114. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +1 -1
  115. package/node_modules/@deepseek-ai/dsh-client-web/package.json +1 -1
  116. package/node_modules/@deepseek-ai/dsh-client-web-react/package.json +1 -1
  117. package/node_modules/@deepseek-ai/dsh-cmdline/lib/index.js +1 -1
  118. package/node_modules/@deepseek-ai/dsh-cmdline/package.json +1 -1
  119. package/node_modules/@deepseek-ai/dsh-code-runtime/package.json +1 -1
  120. package/node_modules/@deepseek-ai/dsh-code-runtime-worker-thread/package.json +1 -1
  121. package/node_modules/@deepseek-ai/dsh-command-compact/package.json +1 -1
  122. package/node_modules/@deepseek-ai/dsh-command-feedback/package.json +1 -1
  123. package/node_modules/@deepseek-ai/dsh-command-goal/package.json +1 -1
  124. package/node_modules/@deepseek-ai/dsh-commands/package.json +1 -1
  125. package/node_modules/@deepseek-ai/dsh-compaction/package.json +1 -1
  126. package/node_modules/@deepseek-ai/dsh-compaction-basic/package.json +1 -1
  127. package/node_modules/@deepseek-ai/dsh-compaction-tool-result-pruner/package.json +1 -1
  128. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/package.json +1 -1
  129. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/package.json +1 -1
  130. package/node_modules/@deepseek-ai/dsh-credentials/package.json +1 -1
  131. package/node_modules/@deepseek-ai/dsh-credentials-local/lib/index.js +1 -1
  132. package/node_modules/@deepseek-ai/dsh-credentials-local/package.json +1 -1
  133. package/node_modules/@deepseek-ai/dsh-fs/package.json +1 -1
  134. package/node_modules/@deepseek-ai/dsh-fs-local/package.json +1 -1
  135. package/node_modules/@deepseek-ai/dsh-fs-observation-policy/package.json +1 -1
  136. package/node_modules/@deepseek-ai/dsh-fs-sandbox/package.json +1 -1
  137. package/node_modules/@deepseek-ai/dsh-goal/package.json +1 -1
  138. package/node_modules/@deepseek-ai/dsh-goal-round-driver/package.json +1 -1
  139. package/node_modules/@deepseek-ai/dsh-headless/lib/index.js +4 -4
  140. package/node_modules/@deepseek-ai/dsh-headless/lib/startup.js +3 -3
  141. package/node_modules/@deepseek-ai/dsh-headless/package.json +1 -1
  142. package/node_modules/@deepseek-ai/dsh-home-paths/lib/index.js +1 -1
  143. package/node_modules/@deepseek-ai/dsh-home-paths/package.json +1 -1
  144. package/node_modules/@deepseek-ai/dsh-host-apiproxy/package.json +1 -1
  145. package/node_modules/@deepseek-ai/dsh-host-directory-picker/package.json +1 -1
  146. package/node_modules/@deepseek-ai/dsh-host-directory-picker-auto/package.json +1 -1
  147. package/node_modules/@deepseek-ai/dsh-host-directory-picker-browse/package.json +1 -1
  148. package/node_modules/@deepseek-ai/dsh-host-directory-picker-native/package.json +1 -1
  149. package/node_modules/@deepseek-ai/dsh-host-frontend-static/package.json +1 -1
  150. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/package.json +1 -1
  151. package/node_modules/@deepseek-ai/dsh-host-webserver/lib/index.js +1 -1
  152. package/node_modules/@deepseek-ai/dsh-host-webserver/package.json +1 -1
  153. package/node_modules/@deepseek-ai/dsh-invariants/package.json +1 -1
  154. package/node_modules/@deepseek-ai/dsh-jobs/package.json +1 -1
  155. package/node_modules/@deepseek-ai/dsh-jobs-local/package.json +1 -1
  156. package/node_modules/@deepseek-ai/dsh-launch-environment/package.json +1 -1
  157. package/node_modules/@deepseek-ai/dsh-llm/package.json +1 -1
  158. package/node_modules/@deepseek-ai/dsh-llm-deepseek/package.json +1 -1
  159. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +1 -1
  160. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +1 -1
  161. package/node_modules/@deepseek-ai/dsh-llm-retry/package.json +1 -1
  162. package/node_modules/@deepseek-ai/dsh-mcp-client/package.json +1 -1
  163. package/node_modules/@deepseek-ai/dsh-message-feedback/package.json +1 -1
  164. package/node_modules/@deepseek-ai/dsh-native-command/package.json +1 -1
  165. package/node_modules/@deepseek-ai/dsh-output-retention/package.json +1 -1
  166. package/node_modules/@deepseek-ai/dsh-permission-presets/package.json +1 -1
  167. package/node_modules/@deepseek-ai/dsh-persona/package.json +1 -1
  168. package/node_modules/@deepseek-ai/dsh-plan-mode/package.json +1 -1
  169. package/node_modules/@deepseek-ai/dsh-pwsh-local/package.json +1 -1
  170. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/package.json +1 -1
  171. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/package.json +1 -1
  172. package/node_modules/@deepseek-ai/dsh-sandbox/package.json +1 -1
  173. package/node_modules/@deepseek-ai/dsh-sandbox-local/package.json +1 -1
  174. package/node_modules/@deepseek-ai/dsh-sandbox-policy/package.json +1 -1
  175. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/index.js +1 -1
  176. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/runner.js +1 -1
  177. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/package.json +1 -1
  178. package/node_modules/@deepseek-ai/dsh-schedule/package.json +1 -1
  179. package/node_modules/@deepseek-ai/dsh-scope/package.json +1 -1
  180. package/node_modules/@deepseek-ai/dsh-session/package.json +1 -1
  181. package/node_modules/@deepseek-ai/dsh-session-checkpoint-policy/package.json +1 -1
  182. package/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +1 -1
  183. package/node_modules/@deepseek-ai/dsh-session-log-export/package.json +1 -1
  184. package/node_modules/@deepseek-ai/dsh-session-persistence/package.json +1 -1
  185. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/package.json +1 -1
  186. package/node_modules/@deepseek-ai/dsh-session-projection/package.json +1 -1
  187. package/node_modules/@deepseek-ai/dsh-session-projection-cache/package.json +1 -1
  188. package/node_modules/@deepseek-ai/dsh-session-query/package.json +1 -1
  189. package/node_modules/@deepseek-ai/dsh-session-query-sqlite/package.json +1 -1
  190. package/node_modules/@deepseek-ai/dsh-session-reference/package.json +1 -1
  191. package/node_modules/@deepseek-ai/dsh-session-stats/package.json +1 -1
  192. package/node_modules/@deepseek-ai/dsh-session-telemetry/package.json +1 -1
  193. package/node_modules/@deepseek-ai/dsh-session-telemetry-otel/package.json +1 -1
  194. package/node_modules/@deepseek-ai/dsh-session-title/package.json +1 -1
  195. package/node_modules/@deepseek-ai/dsh-session-title-first-prompt-llm/package.json +1 -1
  196. package/node_modules/@deepseek-ai/dsh-session-title-llm/package.json +1 -1
  197. package/node_modules/@deepseek-ai/dsh-settings/package.json +1 -1
  198. package/node_modules/@deepseek-ai/dsh-settings-file/package.json +1 -1
  199. package/node_modules/@deepseek-ai/dsh-shell/package.json +1 -1
  200. package/node_modules/@deepseek-ai/dsh-shell-env/lib/index.js +1 -1
  201. package/node_modules/@deepseek-ai/dsh-shell-env/package.json +1 -1
  202. package/node_modules/@deepseek-ai/dsh-skill/package.json +1 -1
  203. package/node_modules/@deepseek-ai/dsh-skill-badge/package.json +1 -1
  204. package/node_modules/@deepseek-ai/dsh-skill-filesystem/package.json +1 -1
  205. package/node_modules/@deepseek-ai/dsh-spill/package.json +1 -1
  206. package/node_modules/@deepseek-ai/dsh-spill-local/package.json +1 -1
  207. package/node_modules/@deepseek-ai/dsh-spill-policy/package.json +1 -1
  208. package/node_modules/@deepseek-ai/dsh-storage/package.json +1 -1
  209. package/node_modules/@deepseek-ai/dsh-storage-domain/package.json +1 -1
  210. package/node_modules/@deepseek-ai/dsh-storage-json/package.json +1 -1
  211. package/node_modules/@deepseek-ai/dsh-subagent/package.json +1 -1
  212. package/node_modules/@deepseek-ai/dsh-subagent-fork-in-process/package.json +1 -1
  213. package/node_modules/@deepseek-ai/dsh-subagent-in-process-driver/package.json +1 -1
  214. package/node_modules/@deepseek-ai/dsh-subagent-spawn-in-process/package.json +1 -1
  215. package/node_modules/@deepseek-ai/dsh-subprocess/lib/index.js +1 -1
  216. package/node_modules/@deepseek-ai/dsh-subprocess/package.json +1 -1
  217. package/node_modules/@deepseek-ai/dsh-subprocess-local/package.json +1 -1
  218. package/node_modules/@deepseek-ai/dsh-system-prompt/package.json +1 -1
  219. package/node_modules/@deepseek-ai/dsh-terminal/package.json +1 -1
  220. package/node_modules/@deepseek-ai/dsh-terminal-bash/package.json +1 -1
  221. package/node_modules/@deepseek-ai/dsh-time-context/package.json +1 -1
  222. package/node_modules/@deepseek-ai/dsh-timeout/package.json +1 -1
  223. package/node_modules/@deepseek-ai/dsh-tmux-context/package.json +1 -1
  224. package/node_modules/@deepseek-ai/dsh-token-meter/package.json +1 -1
  225. package/node_modules/@deepseek-ai/dsh-tool-ask-user/package.json +1 -1
  226. package/node_modules/@deepseek-ai/dsh-tool-bash/package.json +1 -1
  227. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/package.json +1 -1
  228. package/node_modules/@deepseek-ai/dsh-tool-call-timeout-policy/package.json +1 -1
  229. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/index.js +5 -29
  230. package/node_modules/@deepseek-ai/dsh-tool-cordis/package.json +1 -1
  231. package/node_modules/@deepseek-ai/dsh-tool-fs/package.json +1 -1
  232. package/node_modules/@deepseek-ai/dsh-tool-fs-search/package.json +1 -1
  233. package/node_modules/@deepseek-ai/dsh-tool-goal/package.json +1 -1
  234. package/node_modules/@deepseek-ai/dsh-tool-jobs/package.json +1 -1
  235. package/node_modules/@deepseek-ai/dsh-tool-pwsh/package.json +1 -1
  236. package/node_modules/@deepseek-ai/dsh-tool-ralph/package.json +1 -1
  237. package/node_modules/@deepseek-ai/dsh-tool-skill/package.json +1 -1
  238. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/package.json +1 -1
  239. package/node_modules/@deepseek-ai/dsh-tool-subagent/package.json +1 -1
  240. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/package.json +1 -1
  241. package/node_modules/@deepseek-ai/dsh-tool-subagent-report/package.json +1 -1
  242. package/node_modules/@deepseek-ai/dsh-tool-todo/package.json +1 -1
  243. package/node_modules/@deepseek-ai/dsh-tool-web/package.json +1 -1
  244. package/node_modules/@deepseek-ai/dsh-tool-workflow/package.json +1 -1
  245. package/node_modules/@deepseek-ai/dsh-tools/package.json +1 -1
  246. package/node_modules/@deepseek-ai/dsh-typert-loader/package.json +1 -1
  247. package/node_modules/@deepseek-ai/dsh-typert-protocol/package.json +1 -1
  248. package/node_modules/@deepseek-ai/dsh-typert-registry/package.json +1 -1
  249. package/node_modules/@deepseek-ai/dsh-user-approval/package.json +1 -1
  250. package/node_modules/@deepseek-ai/dsh-user-questions/package.json +1 -1
  251. package/node_modules/@deepseek-ai/dsh-web/lib/index.js +1 -1
  252. package/node_modules/@deepseek-ai/dsh-web/package.json +1 -1
  253. package/node_modules/@deepseek-ai/dsh-web-app/cordis.patch.yml +0 -1
  254. package/node_modules/@deepseek-ai/dsh-web-app/lib/index.js +1 -1
  255. package/node_modules/@deepseek-ai/dsh-web-app/lib/startup.js +4 -5
  256. package/node_modules/@deepseek-ai/dsh-web-app/package.json +1 -1
  257. package/node_modules/@deepseek-ai/dsh-web-frontend/package.json +1 -1
  258. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/package.json +1 -1
  259. package/node_modules/@deepseek-ai/dsh-workflow/package.json +1 -1
  260. package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/lib/worker.cjs +9 -8
  261. package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/package.json +1 -1
  262. package/node_modules/@deepseek-ai/dsh-workspace/package.json +1 -1
  263. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +5 -5
  264. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +1 -1
  265. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -1
  266. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -1
  267. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -1
  268. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +3 -3
  269. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +4 -4
  270. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +5 -5
  271. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +6 -6
  272. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +1 -1
  273. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -1
  274. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -2
  275. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -1
  276. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +1 -1
  277. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +1 -1
  278. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  279. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  280. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  281. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  282. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  283. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  284. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  285. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  286. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  287. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  288. package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  289. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  290. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  291. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  292. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +5 -5
  293. package/node_modules/@earendil-works/pi-ai/package.json +1 -1
  294. package/node_modules/@koromix/koffi-darwin-arm64/darwin_arm64/koffi.node +0 -0
  295. package/node_modules/@koromix/koffi-darwin-arm64/package.json +1 -1
  296. package/node_modules/@koromix/koffi-darwin-x64/darwin_x64/koffi.node +0 -0
  297. package/node_modules/@koromix/koffi-darwin-x64/package.json +1 -1
  298. package/node_modules/@koromix/koffi-win32-x64/package.json +1 -1
  299. package/node_modules/@koromix/koffi-win32-x64/win32_x64/koffi.node +0 -0
  300. package/node_modules/@smithy/core/dist-cjs/index.js +3 -1
  301. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +126 -39
  302. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +14 -3
  303. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +3 -1
  304. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +3 -1
  305. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +10 -1
  306. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +10 -1
  307. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +16 -2
  308. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +4 -1
  309. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +4 -1
  310. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -1
  311. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +4 -1
  312. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -1
  313. package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +7 -0
  314. package/node_modules/@smithy/core/dist-es/legacy-root-exports/util-identity-and-auth/DefaultIdentityProviderConfig.js +3 -0
  315. package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-decode.js +29 -13
  316. package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-encode.js +12 -4
  317. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +9 -0
  318. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +7 -0
  319. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeDeserializer2.js +44 -15
  320. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeSerializer2.js +22 -4
  321. package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +5 -0
  322. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/checksum.js +3 -0
  323. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/get-value-from-text-node.js +4 -1
  324. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/object-mapping.js +6 -1
  325. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/serde-json.js +4 -1
  326. package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/resolveEndpoint.js +3 -0
  327. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +7 -0
  328. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +4 -1
  329. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +9 -0
  330. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +5 -0
  331. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +3 -0
  332. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/parseRetryAfterHeader.js +4 -1
  333. package/node_modules/@smithy/core/dist-es/submodules/serde/index.browser.js +1 -0
  334. package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
  335. package/node_modules/@smithy/core/dist-es/submodules/serde/index.native.js +1 -0
  336. package/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js +3 -0
  337. package/node_modules/@smithy/core/dist-es/submodules/transport/hasOwn.js +3 -0
  338. package/node_modules/@smithy/core/dist-es/submodules/transport/index.js +1 -0
  339. package/node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js +3 -0
  340. package/node_modules/@smithy/core/package.json +1 -1
  341. package/node_modules/@smithy/signature-v4/dist-cjs/index.js +19 -7
  342. package/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js +4 -1
  343. package/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js +4 -1
  344. package/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js +4 -1
  345. package/node_modules/@smithy/signature-v4/dist-es/headerUtil.js +10 -3
  346. package/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js +4 -1
  347. package/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js +4 -1
  348. package/node_modules/@smithy/signature-v4/package.json +1 -1
  349. package/node_modules/koffi/package.json +1 -1
  350. package/node_modules/koffi/src/koffi/index.cjs +1 -1
  351. package/node_modules/koffi/src/koffi/index.js +1 -1
  352. package/node_modules/koffi/src/koffi/indirect.cjs +1 -1
  353. package/node_modules/koffi/src/koffi/indirect.js +1 -1
  354. package/node_modules/negotiator/lib/accept.js +54 -0
  355. package/node_modules/negotiator/lib/charset.js +10 -34
  356. package/node_modules/negotiator/lib/encoding.js +9 -30
  357. package/node_modules/negotiator/lib/language.js +15 -36
  358. package/node_modules/negotiator/lib/mediaType.js +16 -134
  359. package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
  360. package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
  361. package/node_modules/negotiator/node_modules/content-type/package.json +1 -0
  362. package/node_modules/negotiator/package.json +1 -1
  363. package/node_modules/typebox/build/compile/validator.mjs +1 -1
  364. package/node_modules/typebox/build/format/_idna.mjs +1 -1
  365. package/node_modules/typebox/build/format/_puny.mjs +1 -1
  366. package/node_modules/typebox/build/format/uuid.mjs +1 -1
  367. package/node_modules/typebox/build/guard/emit.mjs +1 -1
  368. package/node_modules/typebox/build/guard/guard.mjs +1 -1
  369. package/node_modules/typebox/build/guard/string.mjs +1 -1
  370. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
  371. package/node_modules/typebox/build/schema/engine/_guard.mjs +1 -0
  372. package/node_modules/typebox/build/schema/engine/boolean.mjs +1 -1
  373. package/node_modules/typebox/build/schema/engine/index.mjs +1 -1
  374. package/node_modules/typebox/build/schema/engine/schema.mjs +1 -1
  375. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  376. package/node_modules/typebox/build/schema/types/_guard.mjs +1 -0
  377. package/node_modules/typebox/build/schema/types/index.mjs +1 -1
  378. package/node_modules/typebox/build/schema/types/schema.mjs +1 -1
  379. package/node_modules/typebox/build/system/locale/ar_001.mjs +1 -1
  380. package/node_modules/typebox/build/system/locale/bn_BD.mjs +1 -1
  381. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +1 -1
  382. package/node_modules/typebox/build/system/locale/de_DE.mjs +1 -1
  383. package/node_modules/typebox/build/system/locale/el_GR.mjs +1 -1
  384. package/node_modules/typebox/build/system/locale/en_US.mjs +1 -1
  385. package/node_modules/typebox/build/system/locale/es_419.mjs +1 -1
  386. package/node_modules/typebox/build/system/locale/es_AR.mjs +1 -1
  387. package/node_modules/typebox/build/system/locale/es_ES.mjs +1 -1
  388. package/node_modules/typebox/build/system/locale/es_MX.mjs +1 -1
  389. package/node_modules/typebox/build/system/locale/fa_IR.mjs +1 -1
  390. package/node_modules/typebox/build/system/locale/fil_PH.mjs +1 -1
  391. package/node_modules/typebox/build/system/locale/fr_CA.mjs +1 -1
  392. package/node_modules/typebox/build/system/locale/fr_FR.mjs +1 -1
  393. package/node_modules/typebox/build/system/locale/ha_NG.mjs +1 -1
  394. package/node_modules/typebox/build/system/locale/hi_IN.mjs +1 -1
  395. package/node_modules/typebox/build/system/locale/hu_HU.mjs +1 -1
  396. package/node_modules/typebox/build/system/locale/id_ID.mjs +1 -1
  397. package/node_modules/typebox/build/system/locale/it_IT.mjs +1 -1
  398. package/node_modules/typebox/build/system/locale/ja_JP.mjs +1 -1
  399. package/node_modules/typebox/build/system/locale/ko_KR.mjs +1 -1
  400. package/node_modules/typebox/build/system/locale/ms_MY.mjs +1 -1
  401. package/node_modules/typebox/build/system/locale/nl_NL.mjs +1 -1
  402. package/node_modules/typebox/build/system/locale/pl_PL.mjs +1 -1
  403. package/node_modules/typebox/build/system/locale/pt_BR.mjs +1 -1
  404. package/node_modules/typebox/build/system/locale/pt_PT.mjs +1 -1
  405. package/node_modules/typebox/build/system/locale/ro_RO.mjs +1 -1
  406. package/node_modules/typebox/build/system/locale/ru_RU.mjs +1 -1
  407. package/node_modules/typebox/build/system/locale/sv_SE.mjs +1 -1
  408. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +1 -1
  409. package/node_modules/typebox/build/system/locale/th_TH.mjs +1 -1
  410. package/node_modules/typebox/build/system/locale/tr_TR.mjs +1 -1
  411. package/node_modules/typebox/build/system/locale/uk_UA.mjs +1 -1
  412. package/node_modules/typebox/build/system/locale/ur_PK.mjs +1 -1
  413. package/node_modules/typebox/build/system/locale/vi_VN.mjs +1 -1
  414. package/node_modules/typebox/build/system/locale/yo_NG.mjs +1 -1
  415. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +1 -1
  416. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +1 -1
  417. package/node_modules/typebox/build/system/memory/clone.mjs +1 -1
  418. package/node_modules/typebox/build/system/settings/settings.mjs +1 -1
  419. package/node_modules/typebox/build/type/action/_optional.mjs +1 -0
  420. package/node_modules/typebox/build/type/action/_readonly.mjs +1 -0
  421. package/node_modules/typebox/build/type/action/awaited.mjs +1 -0
  422. package/node_modules/typebox/build/type/action/conditional.mjs +1 -1
  423. package/node_modules/typebox/build/type/action/index.mjs +1 -1
  424. package/node_modules/typebox/build/type/action/mapped.mjs +1 -1
  425. package/node_modules/typebox/build/type/action/module.mjs +1 -1
  426. package/node_modules/typebox/build/type/action/options.mjs +1 -0
  427. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +1 -0
  428. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  429. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +1 -1
  430. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +1 -1
  431. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +1 -1
  432. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +1 -1
  433. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +1 -1
  434. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +1 -1
  435. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +1 -1
  436. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +1 -1
  437. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +1 -0
  438. package/node_modules/typebox/build/type/engine/enum/index.mjs +1 -1
  439. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +1 -1
  440. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +1 -1
  441. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +1 -1
  442. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +1 -1
  443. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +1 -1
  444. package/node_modules/typebox/build/type/engine/extract/operation.mjs +1 -1
  445. package/node_modules/typebox/build/type/engine/index.mjs +1 -1
  446. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +1 -1
  447. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +1 -1
  448. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +1 -1
  449. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +1 -1
  450. package/node_modules/typebox/build/type/engine/instantiate.mjs +1 -1
  451. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +1 -1
  452. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +1 -1
  453. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +1 -1
  454. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +1 -1
  455. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +1 -1
  456. package/node_modules/typebox/build/type/engine/object/from_type.mjs +1 -1
  457. package/node_modules/typebox/build/type/engine/object/from_union.mjs +1 -1
  458. package/node_modules/typebox/build/type/engine/options/index.mjs +1 -0
  459. package/node_modules/typebox/build/type/engine/options/instantiate.mjs +1 -0
  460. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +1 -1
  461. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +1 -1
  462. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +1 -1
  463. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +1 -1
  464. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +1 -1
  465. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +1 -1
  466. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +1 -1
  467. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +1 -1
  468. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +1 -1
  469. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +1 -1
  470. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +1 -1
  471. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +1 -1
  472. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +1 -1
  473. package/node_modules/typebox/build/type/engine/required/from_object.mjs +1 -1
  474. package/node_modules/typebox/build/type/engine/required/from_type.mjs +1 -1
  475. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +1 -1
  476. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +1 -1
  477. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  478. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +1 -1
  479. package/node_modules/typebox/build/type/extends/async_iterator.mjs +1 -0
  480. package/node_modules/typebox/build/type/extends/enum.mjs +1 -1
  481. package/node_modules/typebox/build/type/extends/extends_left.mjs +1 -1
  482. package/node_modules/typebox/build/type/extends/extends_right.mjs +1 -1
  483. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  484. package/node_modules/typebox/build/type/extends/iterator.mjs +1 -0
  485. package/node_modules/typebox/build/type/extends/object.mjs +1 -1
  486. package/node_modules/typebox/build/type/extends/parameters.mjs +1 -1
  487. package/node_modules/typebox/build/type/extends/promise.mjs +1 -0
  488. package/node_modules/typebox/build/type/extends/template_literal.mjs +1 -1
  489. package/node_modules/typebox/build/type/extends/tuple.mjs +1 -1
  490. package/node_modules/typebox/build/type/extends/union.mjs +1 -1
  491. package/node_modules/typebox/build/type/script/mapping.mjs +1 -1
  492. package/node_modules/typebox/build/type/script/parser.mjs +6 -6
  493. package/node_modules/typebox/build/type/script/script.mjs +1 -1
  494. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  495. package/node_modules/typebox/build/type/script/token/until.mjs +1 -1
  496. package/node_modules/typebox/build/type/types/_immutable.mjs +1 -1
  497. package/node_modules/typebox/build/type/types/_optional.mjs +1 -1
  498. package/node_modules/typebox/build/type/types/_readonly.mjs +1 -1
  499. package/node_modules/typebox/build/type/types/_refine.mjs +1 -1
  500. package/node_modules/typebox/build/type/types/async_iterator.mjs +1 -0
  501. package/node_modules/typebox/build/type/types/base.mjs +1 -0
  502. package/node_modules/typebox/build/type/types/call.mjs +1 -1
  503. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  504. package/node_modules/typebox/build/type/types/enum.mjs +1 -1
  505. package/node_modules/typebox/build/type/types/index.mjs +1 -1
  506. package/node_modules/typebox/build/type/types/iterator.mjs +1 -0
  507. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  508. package/node_modules/typebox/build/type/types/promise.mjs +1 -0
  509. package/node_modules/typebox/build/type/types/record.mjs +1 -1
  510. package/node_modules/typebox/build/typebox.mjs +1 -1
  511. package/node_modules/typebox/build/value/clean/clean.mjs +1 -1
  512. package/node_modules/typebox/build/value/clean/from_base.mjs +1 -0
  513. package/node_modules/typebox/build/value/clean/from_intersect.mjs +1 -1
  514. package/node_modules/typebox/build/value/clean/from_type.mjs +1 -1
  515. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -1
  516. package/node_modules/typebox/build/value/clone/clone.mjs +1 -1
  517. package/node_modules/typebox/build/value/codec/decode.mjs +1 -1
  518. package/node_modules/typebox/build/value/codec/encode.mjs +1 -1
  519. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -1
  520. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -1
  521. package/node_modules/typebox/build/value/codec/from_record.mjs +1 -1
  522. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -1
  523. package/node_modules/typebox/build/value/codec/from_union.mjs +1 -1
  524. package/node_modules/typebox/build/value/convert/from_base.mjs +1 -0
  525. package/node_modules/typebox/build/value/convert/from_enum.mjs +1 -1
  526. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +1 -1
  527. package/node_modules/typebox/build/value/convert/from_type.mjs +1 -1
  528. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +1 -0
  529. package/node_modules/typebox/build/value/create/from_base.mjs +1 -0
  530. package/node_modules/typebox/build/value/create/from_enum.mjs +1 -1
  531. package/node_modules/typebox/build/value/create/from_iterator.mjs +1 -0
  532. package/node_modules/typebox/build/value/create/from_promise.mjs +1 -0
  533. package/node_modules/typebox/build/value/create/from_type.mjs +1 -1
  534. package/node_modules/typebox/build/value/default/from_base.mjs +1 -0
  535. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  536. package/node_modules/typebox/build/value/default/from_type.mjs +1 -1
  537. package/node_modules/typebox/build/value/index.mjs +1 -1
  538. package/node_modules/typebox/build/value/mutate/error.mjs +1 -0
  539. package/node_modules/typebox/build/value/mutate/from_array.mjs +1 -0
  540. package/node_modules/typebox/build/value/mutate/from_object.mjs +1 -0
  541. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +1 -0
  542. package/node_modules/typebox/build/value/mutate/from_value.mjs +1 -0
  543. package/node_modules/typebox/build/value/mutate/index.mjs +1 -0
  544. package/node_modules/typebox/build/value/mutate/mutate.mjs +1 -0
  545. package/node_modules/typebox/build/value/repair/from_base.mjs +1 -0
  546. package/node_modules/typebox/build/value/repair/from_enum.mjs +1 -1
  547. package/node_modules/typebox/build/value/repair/from_type.mjs +1 -1
  548. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +1 -1
  549. package/node_modules/typebox/build/value/value.mjs +1 -1
  550. package/node_modules/typebox/package.json +1 -1
  551. package/package.json +1 -1
  552. package/lib/args-DcHS9iff.js +0 -9
  553. package/lib/dump-config-xQTUTTDD.js +0 -1
  554. package/lib/profile-boot-BkordgJK.js +0 -1
  555. package/lib/profile-boot-DDo03lXi.js +0 -8
  556. package/node_modules/@deepseek-ai/dsh-content-review/LICENSE +0 -21
  557. package/node_modules/@deepseek-ai/dsh-content-review/lib/index.js +0 -1
  558. package/node_modules/@deepseek-ai/dsh-content-review/lib/invariant.js +0 -1
  559. package/node_modules/@deepseek-ai/dsh-content-review/package.json +0 -1
  560. package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/LICENSE +0 -21
  561. package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/lib/index.js +0 -1
  562. package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/lib/invariant.js +0 -1
  563. package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/package.json +0 -1
  564. package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/LICENSE +0 -21
  565. package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/lib/index.js +0 -17
  566. package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/lib/invariant.js +0 -1
  567. package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/package.json +0 -1
  568. package/node_modules/@deepseek-ai/dsh-qb-auth/LICENSE +0 -21
  569. package/node_modules/@deepseek-ai/dsh-qb-auth/lib/index.js +0 -4
  570. package/node_modules/@deepseek-ai/dsh-qb-auth/lib/invariant.js +0 -1
  571. package/node_modules/@deepseek-ai/dsh-qb-auth/package.json +0 -1
  572. package/node_modules/@deepseek-ai/dsh-web-search-dsh/LICENSE +0 -21
  573. package/node_modules/@deepseek-ai/dsh-web-search-dsh/lib/index.js +0 -1
  574. package/node_modules/@deepseek-ai/dsh-web-search-dsh/lib/invariant.js +0 -1
  575. package/node_modules/@deepseek-ai/dsh-web-search-dsh/package.json +0 -1
  576. package/node_modules/@napi-rs/xattr/LICENSE +0 -21
  577. package/node_modules/@napi-rs/xattr/index.js +0 -567
  578. package/node_modules/@napi-rs/xattr/package.json +0 -1
  579. package/node_modules/@napi-rs/xattr-darwin-arm64/package.json +0 -1
  580. package/node_modules/@napi-rs/xattr-darwin-arm64/xattr.darwin-arm64.node +0 -0
  581. package/node_modules/@napi-rs/xattr-darwin-x64/package.json +0 -1
  582. package/node_modules/@napi-rs/xattr-darwin-x64/xattr.darwin-x64.node +0 -0
  583. package/node_modules/@parcel/watcher/LICENSE +0 -21
  584. package/node_modules/@parcel/watcher/index.js +0 -44
  585. package/node_modules/@parcel/watcher/index.js.flow +0 -45
  586. package/node_modules/@parcel/watcher/package.json +0 -1
  587. package/node_modules/@parcel/watcher/scripts/build-from-source.js +0 -16
  588. package/node_modules/@parcel/watcher/wrapper.js +0 -88
  589. package/node_modules/@parcel/watcher-darwin-arm64/LICENSE +0 -21
  590. package/node_modules/@parcel/watcher-darwin-arm64/package.json +0 -1
  591. package/node_modules/@parcel/watcher-darwin-arm64/watcher.node +0 -0
  592. package/node_modules/@parcel/watcher-darwin-x64/LICENSE +0 -21
  593. package/node_modules/@parcel/watcher-darwin-x64/package.json +0 -1
  594. package/node_modules/@parcel/watcher-darwin-x64/watcher.node +0 -0
  595. package/node_modules/@parcel/watcher-win32-x64/LICENSE +0 -21
  596. package/node_modules/@parcel/watcher-win32-x64/package.json +0 -1
  597. package/node_modules/@parcel/watcher-win32-x64/watcher.node +0 -0
  598. package/node_modules/is-extglob/LICENSE +0 -21
  599. package/node_modules/is-extglob/index.js +0 -20
  600. package/node_modules/is-extglob/package.json +0 -1
  601. package/node_modules/is-glob/LICENSE +0 -21
  602. package/node_modules/is-glob/index.js +0 -150
  603. package/node_modules/is-glob/package.json +0 -1
  604. package/node_modules/typebox/build/type/action/_add_immutable.mjs +0 -1
  605. package/node_modules/typebox/build/type/action/_add_optional.mjs +0 -1
  606. package/node_modules/typebox/build/type/action/_add_readonly.mjs +0 -1
  607. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +0 -1
  608. package/node_modules/typebox/build/type/action/_remove_optional.mjs +0 -1
  609. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +0 -1
  610. package/node_modules/typebox/build/type/action/with.mjs +0 -1
  611. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +0 -1
  612. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +0 -1
  613. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +0 -1
  614. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +0 -1
  615. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +0 -1
  616. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +0 -1
  617. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +0 -1
  618. package/node_modules/typebox/build/type/engine/priority/index.mjs +0 -1
  619. package/node_modules/typebox/build/type/engine/priority/priority.mjs +0 -1
  620. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +0 -1
  621. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +0 -1
  622. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +0 -1
  623. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +0 -1
  624. package/node_modules/typebox/build/type/engine/with/instantiate.mjs +0 -1
  625. package/node_modules/typebox/build/type/extends/dependent.mjs +0 -1
  626. package/node_modules/typebox/build/type/extends/record.mjs +0 -1
  627. package/node_modules/typebox/build/type/types/dependent.mjs +0 -1
  628. /package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/{types-D2_FQYSK.js → types-DE3U0cmQ.js} +0 -0
  629. /package/node_modules/typebox/build/type/engine/{with → awaited}/index.mjs +0 -0
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-workflow","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/dsh-workflow":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-workflow","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/dsh-workflow":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tools","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./presentation":{"types":"./lib/types/presentation.d.ts","default":"./lib/types/presentation.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-scope":"^0.1.0","@deepseek-ai/dsh-code-runtime":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-user-approval":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tools","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./presentation":{"types":"./lib/types/presentation.d.ts","default":"./lib/types/presentation.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-code-runtime":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-scope":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/dsh-user-approval":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-session":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-typert-loader","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/cordis-plugin-loader":"^1.0.2","@deepseek-ai/dsh-typert-registry":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-typert-loader","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/cordis-plugin-loader":"^1.0.2","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-typert-registry":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-typert-protocol","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"}}
1
+ {"name":"@deepseek-ai/dsh-typert-protocol","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-typert-registry","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./client":{"types":"./lib/types/client/index.d.ts","default":"./lib/client.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"dsh":{"client":{"inject":[],"platform":"web","immediately":true}},"license":"MIT","dependencies":{"zod":"^4.4.3","@deepseek-ai/dsh-typert-protocol":"^0.1.0"},"peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"}}
1
+ {"name":"@deepseek-ai/dsh-typert-registry","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./client":{"types":"./lib/types/client/index.d.ts","default":"./lib/client.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"dsh":{"client":{"inject":[],"platform":"web","immediately":true}},"license":"MIT","dependencies":{"zod":"^4.4.3","@deepseek-ai/dsh-typert-protocol":"^0.1.0-rc.7"},"peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-user-approval","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-brand":"^0.1.0","@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-scope":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-user-approval","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-brand":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-scope":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-user-questions","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"}}
1
+ {"name":"@deepseek-ai/dsh-user-questions","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"}}
@@ -1 +1 @@
1
- var f=Object.defineProperty;var h=(e,r)=>f(e,"name",{value:r,configurable:!0});import{Service as l}from"@deepseek-ai/cordis";import a from"@deepseek-ai/schemastery";import{HarnessError as P}from"@deepseek-ai/dsh-llm";var s=class extends P{static{h(this,"WebError")}},n=class extends l{static{h(this,"WebRuntime")}static Config=a.object({searchProvider:a.string(),fetchProvider:a.string()});searchProviders=new Map;fetchProviders=new Map;searchSelector;searchProviderId;fetchProviderId;constructor(e,r={}){super(e,"web"),this.searchProviderId=r.searchProvider??process.env.DSH_WEB_SEARCH_PROVIDER,this.fetchProviderId=r.fetchProvider??process.env.DSH_WEB_FETCH_PROVIDER}registerSearchProvider(e){return this.registerProvider(this.searchProviders,e)}registerSearchProviderSelector(e){if(this.searchSelector!==void 0)throw new s("a web search provider selector is already registered","WEB_DUPLICATE_PROVIDER_SELECTOR");const r=this.ctx.effect(()=>(this.searchSelector=e,()=>{this.searchSelector=void 0}),"web.registerSearchProviderSelector()");return()=>{r()}}registerFetchProvider(e){return this.registerProvider(this.fetchProviders,e)}registerProvider(e,r){if(e.has(r.id))throw new s(`a web provider with id "${r.id}" is already registered`,"WEB_DUPLICATE_PROVIDER");const t=this.ctx.effect(function*(){e.set(r.id,r),yield()=>e.delete(r.id)},"web.registerProvider()");return()=>{t()}}async search(e,r){const t=this.searchSelector;return this.searchProviderId!==void 0||t===void 0?this.searchOnce(e,this.searchProviderId,r):this.searchWithSelector(e,t,r)}async searchOnce(e,r,t){return u(await v({providers:this.searchProviders,...r!==void 0?{configuredId:r}:{}}).search(e,t),e.maxResults)}async searchWithSelector(e,r,t){const o=[];let c;for(;;){const i=r(this.searchProviders,[...o]);if(i===void 0||o.includes(i)){if(c!==void 0)throw c;return this.searchOnce(e,void 0,t)}try{return await this.searchOnce(e,i,t)}catch(d){if(!(d instanceof s)||d.code==="WEB_ABORTED")throw d;this.ctx.logger.warn(`web: search provider "${i}" failed (${d.code}); asking the selector for the next candidate`),o.push(i),c=d}}}async fetch(e,r){return v({providers:this.fetchProviders,...this.fetchProviderId!==void 0?{configuredId:this.fetchProviderId}:{}}).fetch(e,r)}};function v(e){const{configuredId:r,providers:t}=e;if(r!==void 0){const i=t.get(r);if(!i)throw new s(`configured web provider "${r}" is not registered`,"WEB_PROVIDER_CONFIGURED_MISSING");if(!i.available())throw new s(`configured web provider "${r}" is registered but unavailable`,"WEB_PROVIDER_CONFIGURED_UNAVAILABLE");return i}const o=[...t.values()].filter(i=>i.available()),[c]=o;if(c===void 0)throw new s("no usable web provider is registered","WEB_PROVIDER_UNAVAILABLE");if(o.length>1)throw new s(`multiple usable web providers are registered (${o.map(i=>i.id).join(", ")}); configure one explicitly`,"WEB_PROVIDER_AMBIGUOUS");return c}h(v,"resolveProvider");function u(e,r){return r===void 0||e.sources.length<=r?e:{...e,sources:e.sources.slice(0,r),truncated:!0}}h(u,"capSources");export{s as WebError,n as WebRuntime,n as default};
1
+ var v=Object.defineProperty;var t=(e,r)=>v(e,"name",{value:r,configurable:!0});import{Service as f}from"@deepseek-ai/cordis";import c from"@deepseek-ai/schemastery";import{HarnessError as P}from"@deepseek-ai/dsh-llm";var s=class extends P{static{t(this,"WebError")}},a=class extends f{static{t(this,"WebRuntime")}static Config=c.object({searchProvider:c.string(),fetchProvider:c.string()});searchProviders=new Map;fetchProviders=new Map;searchProviderId;fetchProviderId;constructor(e,r={}){super(e,"web"),this.searchProviderId=r.searchProvider??process.env.DSH_WEB_SEARCH_PROVIDER,this.fetchProviderId=r.fetchProvider??process.env.DSH_WEB_FETCH_PROVIDER}registerSearchProvider(e){return this.registerProvider(this.searchProviders,e)}registerFetchProvider(e){return this.registerProvider(this.fetchProviders,e)}registerProvider(e,r){if(e.has(r.id))throw new s(`a web provider with id "${r.id}" is already registered`,"WEB_DUPLICATE_PROVIDER");const o=this.ctx.effect(function*(){e.set(r.id,r),yield()=>e.delete(r.id)},"web.registerProvider()");return()=>{o()}}async search(e,r){return u(await h({providers:this.searchProviders,...this.searchProviderId!==void 0?{configuredId:this.searchProviderId}:{}}).search(e,r),e.maxResults)}async fetch(e,r){return h({providers:this.fetchProviders,...this.fetchProviderId!==void 0?{configuredId:this.fetchProviderId}:{}}).fetch(e,r)}};function h(e){const{configuredId:r,providers:o}=e;if(r!==void 0){const i=o.get(r);if(!i)throw new s(`configured web provider "${r}" is not registered`,"WEB_PROVIDER_CONFIGURED_MISSING");if(!i.available())throw new s(`configured web provider "${r}" is registered but unavailable`,"WEB_PROVIDER_CONFIGURED_UNAVAILABLE");return i}const d=[...o.values()].filter(i=>i.available()),[n]=d;if(n===void 0)throw new s("no usable web provider is registered","WEB_PROVIDER_UNAVAILABLE");if(d.length>1)throw new s(`multiple usable web providers are registered (${d.map(i=>i.id).join(", ")}); configure one explicitly`,"WEB_PROVIDER_AMBIGUOUS");return n}t(h,"resolveProvider");function u(e,r){return r===void 0||e.sources.length<=r?e:{...e,sources:e.sources.slice(0,r),truncated:!0}}t(u,"capSources");export{s as WebError,a as WebRuntime,a as default};
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-web","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-web","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -62,7 +62,6 @@
62
62
  printUrl: true
63
63
  surfaceContext: true
64
64
  trustedHosts: !!js ctx.webStartup.trustedHosts
65
- nativeProtocol: !!js ctx.webStartup.nativeProtocol
66
65
  - id: client-hmr
67
66
  name: '@deepseek-ai/dsh-client-hmr'
68
67
  - id: modules
@@ -1 +1 @@
1
- var b=Object.defineProperty;var o=(e,t)=>b(e,"name",{value:t,configurable:!0});import{createRequire as w}from"node:module";import{networkInterfaces as f}from"node:os";import{fileURLToPath as m}from"node:url";import i from"@deepseek-ai/schemastery";import{addHarnessSourceSection as g}from"@deepseek-ai/dsh-app-boot";import*as S from"@deepseek-ai/dsh-host-frontend-static";const y="web-app",R=m(new URL("../../../..",import.meta.url)),U="webRuntime",E=["webServer"],_=i.object({printUrl:i.boolean().default(!0),surfaceContext:i.boolean().default(!0),trustedHosts:i.array(String).default([]),nativeProtocol:i.const("jsonl-v1")}),c="DSH_WEB_URL",a="127.0.0.1",H="0.0.0.0";function h(e,t){const n=e===H?Object.values(f()).flat().filter(s=>s!==void 0&&s.family==="IPv4"&&!s.internal).map(s=>s.address):[];return{lanAddresses:n,trustedHosts:[...n,...t]}}o(h,"resolveLanTrust");function I(e){return`You are interacting with the user through the DeepSeek Harness Web GUI at ${e}. When the user refers to "this page", "this GUI", or "this app" without naming another target, they mean this GUI. The browser provides no implicit DOM, route, or screenshot context. The client-plugin HMR receiver is active, but client-plugin changes reload without a refresh only while \`pnpm run dev:web\` is also running from this same checkout to rebuild their bundles; verify that watcher before promising automatic updates. Every other change — the apps/web shell and plain packages — requires rebuilding the affected Web artifacts and verifying this existing URL after a page refresh. Starting another server does not update this GUI. The apps/web Vite entry builds the shell but is not a standalone application because only qbot-dsh web injects window.__DSH_BOOT__. Do not start a replacement server unless the user asks; if one is needed, use a managed background job and verify its exact URL.`}o(I,"webSurfacePrompt");function l(e){const t=e.get("webServer")?.port;if(t===void 0)throw new Error("web-app: webServer service missing while resolving Web runtime");return`http://${a}:${String(t)}`}o(l,"localWebUrl");function P(){const e=w(import.meta.url);try{return e.resolve("@deepseek-ai/dsh-web-frontend/dist/index.html")}catch{throw new Error("web-app: frontend dist not built; run pnpm run build from the repository root first")}}o(P,"resolveDistIndex");const v={resolveDistIndex:P};function T(e,t){const n=t.nativeProtocol===void 0?void 0:e.get("nativeProtocol");if(t.nativeProtocol!==void 0&&n?.name!==t.nativeProtocol)throw new Error("web-app: native protocol selected without its launcher-owned writer");if(n!==void 0&&e.webServer.host!==a)throw new Error("web-app: native protocol requires the HTTP server to listen on 127.0.0.1");const s=h(e.webServer.host,t.trustedHosts);if(e.provide(U,s),e.plugin(S,{distIndex:v.resolveDistIndex()}),t.surfaceContext&&(e.inject(["systemPrompt"],r=>{g(r,R),r.systemPrompt.section({name:"app:web-surface",order:-98,text:o(()=>I(l(r)),"text")})}),e.inject(["shellEnv"],r=>{r.shellEnv.register({name:"web-runtime",variables:{[c]:{description:"Canonical local URL of the DeepSeek Harness Web GUI serving this session."}},resolve:o(()=>({[c]:l(r)}),"resolve")})})),t.printUrl||n!==void 0){const r=o(()=>{const p=s.lanAddresses[0],u=e.webServer.port;n!==void 0?n.emitReady({host:a,port:u,pid:process.pid}):console.log(`qbot-dsh web: ${l(e)}${p===void 0?"":` (LAN: http://${p}:${String(u)})`}`)},"announceReady"),d=e.get("loader")?.await();d===void 0?r():d.then(()=>{e.get("webServer")!==void 0&&r()},()=>{})}}o(T,"apply");export{_ as Config,T as apply,E as inject,v as internals,y as name,h as resolveLanTrust};
1
+ var c=Object.defineProperty;var n=(e,r)=>c(e,"name",{value:r,configurable:!0});import{createRequire as f}from"node:module";import{networkInterfaces as b}from"node:os";import{fileURLToPath as m}from"node:url";import o from"@deepseek-ai/schemastery";import{addHarnessSourceSection as v}from"@deepseek-ai/dsh-app-boot";import*as w from"@deepseek-ai/dsh-host-frontend-static";const g="web-app",S=m(new URL("../../../..",import.meta.url)),U="webRuntime",y=["webServer"],R=o.object({printUrl:o.boolean().default(!0),surfaceContext:o.boolean().default(!0),trustedHosts:o.array(String).default([])}),u="DSH_WEB_URL",_="127.0.0.1",E="0.0.0.0";function d(e,r){const s=e===E?Object.values(b()).flat().filter(t=>t!==void 0&&t.family==="IPv4"&&!t.internal).map(t=>t.address):[];return{lanAddresses:s,trustedHosts:[...s,...r]}}n(d,"resolveLanTrust");function I(e){return`You are interacting with the user through the DeepSeek Harness Web GUI at ${e}. When the user refers to "this page", "this GUI", or "this app" without naming another target, they mean this GUI. The browser provides no implicit DOM, route, or screenshot context. The client-plugin HMR receiver is active, but client-plugin changes reload without a refresh only while \`pnpm run dev:web\` is also running from this same checkout to rebuild their bundles; verify that watcher before promising automatic updates. Every other change — the apps/web shell and plain packages — requires rebuilding the affected Web artifacts and verifying this existing URL after a page refresh. Starting another server does not update this GUI. The apps/web Vite entry builds the shell but is not a standalone application because only dsh web injects window.__DSH_BOOT__. Do not start a replacement server unless the user asks; if one is needed, use a managed background job and verify its exact URL.`}n(I,"webSurfacePrompt");function i(e){const r=e.get("webServer")?.port;if(r===void 0)throw new Error("web-app: webServer service missing while resolving Web runtime");return`http://${_}:${String(r)}`}n(i,"localWebUrl");function H(){const e=f(import.meta.url);try{return e.resolve("@deepseek-ai/dsh-web-frontend/dist/index.html")}catch{throw new Error("web-app: frontend dist not built; run pnpm run build from the repository root first")}}n(H,"resolveDistIndex");const p={resolveDistIndex:H};function L(e,r){const s=d(e.webServer.host,r.trustedHosts);if(e.provide(U,s),e.plugin(w,{distIndex:p.resolveDistIndex()}),r.surfaceContext&&(e.inject(["systemPrompt"],t=>{v(t,S),t.systemPrompt.section({name:"app:web-surface",order:-98,text:n(()=>I(i(t)),"text")})}),e.inject(["shellEnv"],t=>{t.shellEnv.register({name:"web-runtime",variables:{[u]:{description:"Canonical local URL of the DeepSeek Harness Web GUI serving this session."}},resolve:n(()=>({[u]:i(t)}),"resolve")})})),r.printUrl){const t=n(()=>{const l=s.lanAddresses[0],h=e.webServer.port;console.log(`dsh web: ${i(e)}${l===void 0?"":` (LAN: http://${l}:${String(h)})`}`)},"printUrl"),a=e.get("loader")?.await();a===void 0?t():a.then(()=>{e.get("webServer")!==void 0&&t()},()=>{})}}n(L,"apply");export{R as Config,L as apply,y as inject,p as internals,g as name,d as resolveLanTrust};
@@ -1,6 +1,5 @@
1
- var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import{Command as a}from"commander";import{parseCmdline as l}from"@deepseek-ai/dsh-cmdline";const h="web-startup",d=["cmdlineArgs"],n="webStartup",s="jsonl-v1";function c(){return new a().name("qbot-dsh --profile web").description("Serve the DeepSeek Harness browser UI.").helpOption("-h, --help","show this help").option("--host <host>","bind host").option("--port <port>","listen port; pass 0 to let the OS pick a free one").option("--trusted-host <authority...>","extra authority the /api browser-trust fence accepts (host or host:port; repeatable)").option("--native-protocol <protocol>","reserve stdout for a native host protocol (jsonl-v1)").addHelpText("after",`
1
+ var p=Object.defineProperty;var r=(e,o)=>p(e,"name",{value:o,configurable:!0});import{Command as n}from"commander";import{parseCmdline as i}from"@deepseek-ai/dsh-cmdline";const a="web-startup",h=["cmdlineArgs"],s="webStartup";function d(){return new n().name("dsh --profile web").description("Serve the DeepSeek Harness browser UI.").helpOption("-h, --help","show this help").option("--host <host>","bind host").option("--port <port>","listen port; pass 0 to let the OS pick a free one").option("--trusted-host <authority...>","extra authority the /api browser-trust fence accepts (host or host:port; repeatable)").addHelpText("after",`
2
2
  Examples:
3
- qbot-dsh --profile web serve on the composed host and port
4
- qbot-dsh --profile web --port 8080 serve on another port
5
- qbot-dsh --profile web --port 0 --native-protocol=jsonl-v1
6
- `)}r(c,"webCommand");function i(e,t,o){return e.get("nativeProtocol")?.emitError("WEB_STARTUP_FAILED"),t.error(o)}r(i,"usageError");function u(e){const t=c();t.action(()=>{const o=t.opts();o.host==="0.0.0.0"&&i(e,t,"error: --host 0.0.0.0 is intentionally not supported yet for safety: it would expose remote code execution to the network; use 127.0.0.1 instead"),o.port!==void 0&&!/^\d+$/.test(o.port)&&i(e,t,`error: --port must be a number, got ${JSON.stringify(o.port)}`),o.nativeProtocol!==void 0&&o.nativeProtocol!==s&&t.error(`error: --native-protocol must be ${s}, got ${JSON.stringify(o.nativeProtocol)}`),e.provide(n,{...o.host!==void 0&&{host:o.host},...o.port!==void 0&&{port:Number(o.port)},trustedHosts:o.trustedHost??[],...o.nativeProtocol!==void 0&&{nativeProtocol:s}})}),l(e,t)}r(u,"apply");export{n as WEB_STARTUP_SERVICE,u as apply,d as inject,h as name};
3
+ dsh --profile web serve on the composed host and port
4
+ dsh --profile web --port 8080 serve on another port
5
+ `)}r(d,"webCommand");function m(e){const o=d();o.action(()=>{const t=o.opts();t.host==="0.0.0.0"&&o.error("error: --host 0.0.0.0 is intentionally not supported yet for safety: it would expose remote code execution to the network; use 127.0.0.1 instead"),t.port!==void 0&&!/^\d+$/.test(t.port)&&o.error(`error: --port must be a number, got ${JSON.stringify(t.port)}`),e.provide(s,{...t.host!==void 0&&{host:t.host},...t.port!==void 0&&{port:Number(t.port)},trustedHosts:t.trustedHost??[]})}),i(e,o)}r(m,"apply");export{s as WEB_STARTUP_SERVICE,m as apply,h as inject,a as name};
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-web-app","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./startup":{"types":"./lib/types/startup.d.ts","default":"./lib/startup.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./cordis.patch.yml":"./cordis.patch.yml","./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","dsh":{"bundle":{"patch":"./cordis.patch.yml"}},"dependencies":{"commander":"^15.0.0","@deepseek-ai/dsh-api-remotes":"^0.1.0","@deepseek-ai/dsh-app-boot":"^0.1.0","@deepseek-ai/dsh-client-modules":"^0.1.0","@deepseek-ai/dsh-client-connection":"^0.1.0","@deepseek-ai/dsh-client-locale":"^0.1.0","@deepseek-ai/dsh-client-runtime":"^0.1.0","@deepseek-ai/dsh-client-ui-commands":"^0.1.0","@deepseek-ai/dsh-client-ui-conversation":"^0.1.0","@deepseek-ai/dsh-client-ui-cordis":"^0.1.0","@deepseek-ai/dsh-agent-presets":"^0.1.0","@deepseek-ai/dsh-client-ui-directory-picker-browse":"^0.1.0","@deepseek-ai/dsh-client-ui-directory-picker-native":"^0.1.0","@deepseek-ai/dsh-client-hmr":"^0.1.0","@deepseek-ai/dsh-client-ui-deliverables":"^0.1.0","@deepseek-ai/dsh-client-ui-message-feedback":"^0.1.0","@deepseek-ai/dsh-client-ui-agent-preset":"^0.1.0","@deepseek-ai/dsh-client-ui-goal":"^0.1.0","@deepseek-ai/dsh-client-ui-settings-models":"^0.1.0","@deepseek-ai/dsh-client-ui-model-selection":"^0.1.0","@deepseek-ai/dsh-client-ui-layout":"^0.1.0","@deepseek-ai/dsh-client-ui-settings-plugin-inventory":"^0.1.0","@deepseek-ai/dsh-client-ui-permission-presets":"^0.1.0","@deepseek-ai/dsh-client-ui-settings-plugins":"^0.1.0","@deepseek-ai/dsh-client-ui-plan":"^0.1.0","@deepseek-ai/dsh-client-ui-settings":"^0.1.0","@deepseek-ai/dsh-client-ui-settings-general":"^0.1.0","@deepseek-ai/dsh-client-ui-sidebar":"^0.1.0","@deepseek-ai/dsh-client-ui-skill":"^0.1.0","@deepseek-ai/dsh-client-ui-input-trigger":"^0.1.0","@deepseek-ai/dsh-client-ui-subagent":"^0.1.0","@deepseek-ai/dsh-client-ui-jobs":"^0.1.0","@deepseek-ai/dsh-cmdline":"^0.1.0","@deepseek-ai/dsh-client-ui-theme":"^0.1.0","@deepseek-ai/dsh-client-ui-user-questions":"^0.1.0","@deepseek-ai/dsh-cordis-host-runner":"^0.1.0","@deepseek-ai/dsh-client-ui-tool":"^0.1.0","@deepseek-ai/dsh-web-frontend":"^0.1.0","@deepseek-ai/dsh-client-ui-workflow-run":"^0.1.0","@deepseek-ai/dsh-client-ui-trajectory":"^0.1.0","@deepseek-ai/dsh-client-ui-workspace":"^0.1.0","@deepseek-ai/dsh-cordis-client-runner":"^0.1.0","@deepseek-ai/dsh-host-frontend-static":"^0.1.0","@deepseek-ai/dsh-code-runtime-worker-thread":"^0.1.0","@deepseek-ai/dsh-host-directory-picker-auto":"^0.1.0","@deepseek-ai/dsh-host-directory-picker-browse":"^0.1.0","@deepseek-ai/dsh-host-webserver":"^0.1.0","@deepseek-ai/dsh-host-directory-picker-native":"^0.1.0","@deepseek-ai/dsh-host-apiproxy":"^0.1.0","@deepseek-ai/dsh-session-log-export":"^0.1.0","@deepseek-ai/dsh-message-feedback":"^0.1.0","@deepseek-ai/dsh-storage":"^0.1.0","@deepseek-ai/dsh-host-plugin-inventory":"^0.1.0","@deepseek-ai/dsh-session-projection-cache":"^0.1.0","@deepseek-ai/dsh-storage-json":"^0.1.0","@deepseek-ai/schemastery":"^3.18.1","@deepseek-ai/dsh-workspace":"^0.1.0","@deepseek-ai/dsh-session-stats":"^0.1.0","@deepseek-ai/dsh-storage-domain":"^0.1.0"},"peerDependencies":{"@deepseek-ai/cordis-plugin-loader":"^1.0.2","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-shell-env":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"}}
1
+ {"name":"@deepseek-ai/dsh-web-app","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./startup":{"types":"./lib/types/startup.d.ts","default":"./lib/startup.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./cordis.patch.yml":"./cordis.patch.yml","./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","dsh":{"bundle":{"patch":"./cordis.patch.yml"}},"dependencies":{"commander":"^15.0.0","@deepseek-ai/dsh-agent-presets":"^0.1.0-rc.7","@deepseek-ai/dsh-client-hmr":"^0.1.0-rc.7","@deepseek-ai/dsh-app-boot":"^0.1.0-rc.7","@deepseek-ai/dsh-client-locale":"^0.1.0-rc.7","@deepseek-ai/dsh-client-connection":"^0.1.0-rc.7","@deepseek-ai/dsh-api-remotes":"^0.1.0-rc.7","@deepseek-ai/dsh-client-modules":"^0.1.0-rc.7","@deepseek-ai/dsh-client-runtime":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-commands":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-cordis":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-agent-preset":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-deliverables":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-directory-picker-browse":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-directory-picker-native":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-message-feedback":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-conversation":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-goal":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-layout":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-settings-models":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-settings-plugin-inventory":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-permission-presets":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-plan":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-settings-plugins":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-user-questions":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-settings":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-model-selection":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-skill":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-sidebar":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-input-trigger":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-settings-general":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-subagent":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-theme":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-jobs":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-tool":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-trajectory":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-workspace":"^0.1.0-rc.7","@deepseek-ai/dsh-client-ui-workflow-run":"^0.1.0-rc.7","@deepseek-ai/dsh-cmdline":"^0.1.0-rc.7","@deepseek-ai/dsh-cordis-client-runner":"^0.1.0-rc.7","@deepseek-ai/dsh-code-runtime-worker-thread":"^0.1.0-rc.7","@deepseek-ai/dsh-cordis-host-runner":"^0.1.0-rc.7","@deepseek-ai/dsh-web-frontend":"^0.1.0-rc.7","@deepseek-ai/dsh-host-frontend-static":"^0.1.0-rc.7","@deepseek-ai/dsh-host-apiproxy":"^0.1.0-rc.7","@deepseek-ai/dsh-host-directory-picker-auto":"^0.1.0-rc.7","@deepseek-ai/dsh-host-directory-picker-native":"^0.1.0-rc.7","@deepseek-ai/dsh-host-plugin-inventory":"^0.1.0-rc.7","@deepseek-ai/dsh-host-webserver":"^0.1.0-rc.7","@deepseek-ai/dsh-session-projection-cache":"^0.1.0-rc.7","@deepseek-ai/dsh-host-directory-picker-browse":"^0.1.0-rc.7","@deepseek-ai/dsh-message-feedback":"^0.1.0-rc.7","@deepseek-ai/dsh-session-stats":"^0.1.0-rc.7","@deepseek-ai/dsh-session-log-export":"^0.1.0-rc.7","@deepseek-ai/dsh-storage-domain":"^0.1.0-rc.7","@deepseek-ai/dsh-storage-json":"^0.1.0-rc.7","@deepseek-ai/dsh-workspace":"^0.1.0-rc.7","@deepseek-ai/dsh-storage":"^0.1.0-rc.7","@deepseek-ai/schemastery":"^3.18.1"},"peerDependencies":{"@deepseek-ai/cordis-plugin-loader":"^1.0.2","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-shell-env":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-web-frontend","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","exports":{"./dist/*":"./dist/*","./package.json":"./package.json"},"license":"MIT","dependencies":{"react":"^18.2.0","react-dom":"^18.2.0","@deepseek-ai/dsh-client-web":"^0.1.0"}}
1
+ {"name":"@deepseek-ai/dsh-web-frontend","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","exports":{"./dist/*":"./dist/*","./package.json":"./package.json"},"license":"MIT","dependencies":{"react":"^18.2.0","react-dom":"^18.2.0","@deepseek-ai/dsh-client-web":"^0.1.0-rc.7"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-web-search-deepseek","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-credentials":"^0.1.0","@deepseek-ai/dsh-launch-environment":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-web":"^0.1.0","@deepseek-ai/dsh-settings":"^0.1.0"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-web-search-deepseek","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-credentials":"^0.1.0-rc.7","@deepseek-ai/dsh-launch-environment":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-web":"^0.1.0-rc.7","@deepseek-ai/dsh-settings":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-workflow","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-brand":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-session":"^0.1.0"}}
1
+ {"name":"@deepseek-ai/dsh-workflow","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-brand":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7"}}
@@ -76,14 +76,15 @@ var HostToWorkerType;
76
76
  })(HostToWorkerType || (HostToWorkerType = {}));
77
77
  //#endregion
78
78
  //#region lib/types/realm.js
79
- /**
80
- * Materializes values leaving the script vm into plain JSON before they cross the worker
81
- * boundary, and renders thrown script values without rejecting the run. The walk rejects
82
- * values that JSON cannot preserve but trusts model-written workflow scripts: getters and proxy traps may
83
- * run, and the vm is not a security boundary. The worker provides host-loop isolation and
84
- * forced termination, not hostile-value containment.
85
- * @module @deepseek-ai/dsh-workflow-worker-thread/realm
86
- */
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
87
88
  /** Thrown by {@link materializeFromRealm}; the caller wraps it into the right `WorkflowError` code. */
88
89
  var MaterializeError = class extends Error {
89
90
  path;
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-workflow-worker-thread","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./worker":{"types":"./lib/types/worker.d.ts","default":"./lib/worker.cjs"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-brand":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-subagent":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/dsh-workflow":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-session":"^0.1.0"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-workflow-worker-thread","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./worker":{"types":"./lib/types/worker.d.ts","default":"./lib/worker.cjs"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-brand":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-subagent":"^0.1.0-rc.7","@deepseek-ai/dsh-workflow":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-workspace","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-storage-domain":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0","@deepseek-ai/dsh-brand":"^0.1.0","@deepseek-ai/dsh-storage":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-session-persistence":"^0.1.0"},"dependencies":{"zod":"^4.4.3"}}
1
+ {"name":"@deepseek-ai/dsh-workspace","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-storage-domain":"^0.1.0-rc.7","@deepseek-ai/dsh-brand":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-session-persistence":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-storage":"^0.1.0-rc.7"},"dependencies":{"zod":"^4.4.3"}}
@@ -1,5 +1,5 @@
1
- var N=Object.defineProperty;var f=(e,r)=>N(e,"name",{value:r,configurable:!0});import b from"@anthropic-ai/sdk";import{calculateCost as S}from"../models.js";import{splitDeferredTools as j}from"../utils/deferred-tools.js";import{AssistantMessageEventStream as B}from"../utils/event-stream.js";import{headersToRecord as O}from"../utils/headers.js";import{parseJsonWithRepair as P,parseStreamingJson as E}from"../utils/json-parse.js";import{getProviderEnvValue as W}from"../utils/provider-env.js";import{retryProviderRequest as H}from"../utils/provider-retry.js";import{sanitizeSurrogates as k}from"../utils/sanitize-unicode.js";import{resolveJsonSchemaStrictSampling as D}from"./constrained-sampling.js";import{buildCopilotDynamicHeaders as J,hasCopilotVisionInput as U}from"./github-copilot-headers.js";import{adjustMaxTokensForThinking as q,buildBaseOptions as z,clampMaxTokensToContext as $}from"./simple-options.js";import{transformMessages as G}from"./transform-messages.js";function C(e,r){return e||(W("PI_CACHE_RETENTION",r)==="long"?"long":"short")}f(C,"resolveCacheRetention");function F(e,r,n){const a=C(r,n);if(a==="none")return{retention:a};const t=a==="long"&&_(e).supportsLongCacheRetention?"1h":void 0;return{retention:a,cacheControl:{type:"ephemeral",...t&&{ttl:t}}}}f(F,"getCacheControl");const K="2.1.75",V=["Read","Write","Edit","Bash","Grep","Glob","AskUserQuestion","EnterPlanMode","ExitPlanMode","KillShell","NotebookEdit","Skill","Task","TaskOutput","TodoWrite","WebFetch","WebSearch"],Q=new Map(V.map(e=>[e.toLowerCase(),e])),y=f(e=>Q.get(e.toLowerCase())??e,"toClaudeCodeName"),Y=f((e,r)=>{if(r&&r.length>0){const n=e.toLowerCase(),a=r.find(t=>t.name.toLowerCase()===n);if(a)return a.name}return e},"fromClaudeCodeName");function Z(e){if(!e.some(t=>t.type==="image"))return k(e.map(t=>t.text).join(`
2
- `));const n=e.map(t=>t.type==="text"?{type:"text",text:k(t.text)}:{type:"image",source:{type:"base64",media_type:t.mimeType,data:t.data}});return n.some(t=>t.type==="text")||n.unshift({type:"text",text:"(see attached image)"}),n}f(Z,"convertContentBlocks");const X="fine-grained-tool-streaming-2025-05-14",ee="interleaved-thinking-2025-05-14";function _(e){return{supportsEagerToolInputStreaming:e.compat?.supportsEagerToolInputStreaming??!0,supportsLongCacheRetention:e.compat?.supportsLongCacheRetention??!0,sendSessionAffinityHeaders:e.compat?.sendSessionAffinityHeaders??!1,supportsCacheControlOnTools:e.compat?.supportsCacheControlOnTools??!0,supportsTemperature:e.compat?.supportsTemperature??!0,allowEmptySignature:e.compat?.allowEmptySignature??!1,supportsStrictTools:e.compat?.supportsStrictTools??!1,supportsToolReferences:e.compat?.supportsToolReferences??te(e)}}f(_,"getAnthropicCompat");function te(e){if(e.provider!=="anthropic"||e.id.includes("haiku"))return!1;const r=e.id.match(/^claude-(?:opus|sonnet|fable)-(\d+)(?:-(\d+))?(?:-|$)/);if(!r)return!1;const n=Number(r[1]),a=r[2]&&r[2].length<8?Number(r[2]):0;return n>4||n===4&&a>=5}f(te,"defaultSupportsToolReferences");function w(...e){const r={};for(const n of e)n&&Object.assign(r,n);return r}f(w,"mergeHeaders");function T(e,r){if(!e)return!1;const n=r.toLowerCase();for(const[a,t]of Object.entries(e))if(a.toLowerCase()===n&&t!==null&&t.trim().length>0)return!0;return!1}f(T,"hasHeader");function I(e,r,n){if(!r&&!(T(n,"authorization")||T(n,"x-api-key")||T(n,"cf-aig-authorization")))throw new Error(`No API key for provider: ${e}`)}f(I,"assertRequestAuth");const ne=new Set(["message_start","message_delta","message_stop","content_block_start","content_block_delta","content_block_stop"]);function A(e){if(!e.event&&e.data.length===0)return null;const r={event:e.event,data:e.data.join(`
3
- `),raw:[...e.raw]};return e.event=null,e.data=[],e.raw=[],r}f(A,"flushSseEvent");function R(e,r){if(e==="")return A(r);if(r.raw.push(e),e.startsWith(":"))return null;const n=e.indexOf(":"),a=n===-1?e:e.slice(0,n);let t=n===-1?"":e.slice(n+1);return t.startsWith(" ")&&(t=t.slice(1)),a==="event"?r.event=t:a==="data"&&r.data.push(t),null}f(R,"decodeSseLine");function se(e){const r=e.indexOf("\r"),n=e.indexOf(`
4
- `);return r===-1?n:n===-1?r:Math.min(r,n)}f(se,"nextLineBreakIndex");function x(e){const r=se(e);if(r===-1)return null;let n=r+1;return e[r]==="\r"&&e[n]===`
5
- `&&(n+=1),{line:e.slice(0,r),rest:e.slice(n)}}f(x,"consumeLine");async function*re(e,r){const n=e.getReader(),a=new TextDecoder,t={event:null,data:[],raw:[]};let o="";try{for(;;){if(r?.aborted)throw new Error("Request was aborted");const{value:l,done:p}=await n.read();if(p)break;o+=a.decode(l,{stream:!0});let d=x(o);for(;d;){o=d.rest;const u=R(d.line,t);u&&(yield u),d=x(o)}}o+=a.decode();let c=x(o);for(;c;){o=c.rest;const l=R(c.line,t);l&&(yield l),c=x(o)}if(o.length>0){const l=R(o,t);l&&(yield l)}const h=A(t);h&&(yield h)}finally{n.releaseLock()}}f(re,"iterateSseMessages");async function*ae(e,r){if(!e.body)throw new Error("Attempted to iterate over an Anthropic response with no body");let n=!1,a=!1;for await(const t of re(e.body,r)){if(t.event==="error")throw new Error(t.data);if(ne.has(t.event??""))try{const o=P(t.data);o.type==="message_start"?n=!0:o.type==="message_stop"&&(a=!0),yield o}catch(o){const c=o instanceof Error?o.message:String(o);throw new Error(`Could not parse Anthropic SSE event ${t.event}: ${c}; data=${t.data}; raw=${t.raw.join("\\n")}`)}}if(n&&!a)throw new Error("Anthropic stream ended before message_stop")}f(ae,"iterateAnthropicEvents");export const stream=f((e,r,n)=>{const a=new B;return(async()=>{const t={role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{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{let o,c;if(n?.client)o=n.client,c=!1;else{const s=n?.apiKey;I(e.provider,s,n?.headers);let i;if(e.provider==="github-copilot"){const L=U(r.messages);i=J({messages:r.messages,hasImages:L})}const m=C(n?.cacheRetention,n?.env)==="none"?void 0:n?.sessionId,v=ce(e,s,n?.interleavedThinking??!0,ge(e,r),n?.headers,n?.fetch,i,m);o=v.client,c=v.isOAuthToken}let h=ue(e,r,c,n);const l=await n?.onPayload?.(h,e);l!==void 0&&(h=l);const p={...n?.signal?{signal:n.signal}:{},...n?.timeoutMs!==void 0?{timeout:n.timeoutMs}:{},maxRetries:0},d=await H(()=>o.messages.create({...h,stream:!0},p).asResponse(),{maxRetries:n?.maxRetries,maxRetryDelayMs:n?.maxRetryDelayMs,signal:n?.signal});await n?.onResponse?.({status:d.status,headers:O(d.headers)},e),a.push({type:"start",partial:t});const u=t.content;for await(const s of ae(d,n?.signal))if(s.type==="message_start")t.responseId=s.message.id,t.usage.input=s.message.usage.input_tokens||0,t.usage.output=s.message.usage.output_tokens||0,t.usage.cacheRead=s.message.usage.cache_read_input_tokens||0,t.usage.cacheWrite=s.message.usage.cache_creation_input_tokens||0,t.usage.cacheWrite1h=s.message.usage.cache_creation?.ephemeral_1h_input_tokens||0,t.usage.totalTokens=t.usage.input+t.usage.output+t.usage.cacheRead+t.usage.cacheWrite,S(e,t.usage);else if(s.type==="content_block_start"){if(s.content_block.type==="text"){const i={type:"text",text:"",index:s.index};t.content.push(i),a.push({type:"text_start",contentIndex:t.content.length-1,partial:t})}else if(s.content_block.type==="thinking"){const i={type:"thinking",thinking:"",thinkingSignature:"",index:s.index};t.content.push(i),a.push({type:"thinking_start",contentIndex:t.content.length-1,partial:t})}else if(s.content_block.type==="redacted_thinking"){const i={type:"thinking",thinking:"[Reasoning redacted]",thinkingSignature:s.content_block.data,redacted:!0,index:s.index};t.content.push(i),a.push({type:"thinking_start",contentIndex:t.content.length-1,partial:t})}else if(s.content_block.type==="tool_use"){const i={type:"toolCall",id:s.content_block.id,name:c?Y(s.content_block.name,r.tools):s.content_block.name,arguments:s.content_block.input??{},partialJson:"",index:s.index};t.content.push(i),a.push({type:"toolcall_start",contentIndex:t.content.length-1,partial:t})}}else if(s.type==="content_block_delta"){if(s.delta.type==="text_delta"){const i=u.findIndex(m=>m.index===s.index),g=u[i];g&&g.type==="text"&&(g.text+=s.delta.text,a.push({type:"text_delta",contentIndex:i,delta:s.delta.text,partial:t}))}else if(s.delta.type==="thinking_delta"){const i=u.findIndex(m=>m.index===s.index),g=u[i];g&&g.type==="thinking"&&(g.thinking+=s.delta.thinking,a.push({type:"thinking_delta",contentIndex:i,delta:s.delta.thinking,partial:t}))}else if(s.delta.type==="input_json_delta"){const i=u.findIndex(m=>m.index===s.index),g=u[i];g&&g.type==="toolCall"&&(g.partialJson+=s.delta.partial_json,g.arguments=E(g.partialJson),a.push({type:"toolcall_delta",contentIndex:i,delta:s.delta.partial_json,partial:t}))}else if(s.delta.type==="signature_delta"){const i=u.findIndex(m=>m.index===s.index),g=u[i];g&&g.type==="thinking"&&(g.thinkingSignature=g.thinkingSignature||"",g.thinkingSignature+=s.delta.signature)}}else if(s.type==="content_block_stop"){const i=u.findIndex(m=>m.index===s.index),g=u[i];g&&(delete g.index,g.type==="text"?a.push({type:"text_end",contentIndex:i,content:g.text,partial:t}):g.type==="thinking"?a.push({type:"thinking_end",contentIndex:i,content:g.thinking,partial:t}):g.type==="toolCall"&&(g.arguments=E(g.partialJson),delete g.partialJson,a.push({type:"toolcall_end",contentIndex:i,toolCall:g,partial:t})))}else if(s.type==="message_delta"){if(s.delta.stop_reason){t.rawStopReason=s.delta.stop_reason;const i=fe(s.delta.stop_reason,s.delta.stop_details);t.stopReason=i.stopReason,i.errorMessage&&(t.errorMessage=i.errorMessage)}if(s.usage){s.usage.input_tokens!=null&&(t.usage.input=s.usage.input_tokens),s.usage.output_tokens!=null&&(t.usage.output=s.usage.output_tokens),s.usage.cache_read_input_tokens!=null&&(t.usage.cacheRead=s.usage.cache_read_input_tokens),s.usage.cache_creation_input_tokens!=null&&(t.usage.cacheWrite=s.usage.cache_creation_input_tokens);const i=s.usage.output_tokens_details?.thinking_tokens;i!=null&&(t.usage.reasoning=i)}t.usage.totalTokens=t.usage.input+t.usage.output+t.usage.cacheRead+t.usage.cacheWrite,S(e,t.usage)}if(n?.signal?.aborted)throw new Error("Request was aborted");if(t.stopReason==="pending")throw new Error("Anthropic stream ended without a stop reason");if(t.stopReason==="aborted"||t.stopReason==="error")throw new Error(t.errorMessage||"An unknown error occurred");a.push({type:"done",reason:t.stopReason,message:t}),a.end()}catch(o){for(const c of t.content)delete c.index,delete c.partialJson;t.stopReason=n?.signal?.aborted?"aborted":"error",t.errorMessage=o instanceof Error?o.message:JSON.stringify(o),a.push({type:"error",reason:t.stopReason,error:t}),a.end()}})(),a},"stream");function oe(e,r){const n=r?e.thinkingLevelMap?.[r]:void 0;if(typeof n=="string")return n;switch(r){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}f(oe,"mapThinkingLevelToEffort");export const streamSimple=f((e,r,n)=>{I(e.provider,n?.apiKey,n?.headers);const a=z(e,r,n,n?.apiKey);if(!n?.reasoning)return stream(e,r,{...a,thinkingEnabled:!1});if(e.compat?.forceAdaptiveThinking===!0){const c=oe(e,n.reasoning);return stream(e,r,{...a,thinkingEnabled:!0,effort:c})}const t=q(a.maxTokens,e.maxTokens,n.reasoning,n.thinkingBudgets),o=$(e,r,t.maxTokens);return stream(e,r,{...a,maxTokens:o,thinkingEnabled:!0,thinkingBudgetTokens:Math.min(t.thinkingBudget,Math.max(0,o-1024))})},"streamSimple");function ie(e){return e.includes("sk-ant-oat")}f(ie,"isOAuthToken");function ce(e,r,n,a,t,o,c,h){const l=n&&e.compat?.forceAdaptiveThinking!==!0,p=[];if(a&&p.push(X),l&&p.push(ee),e.provider==="github-copilot")return{client:new b({apiKey:null,authToken:r??null,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:o,defaultHeaders:w({accept:"application/json","anthropic-dangerous-direct-browser-access":"true",...p.length>0?{"anthropic-beta":p.join(",")}:{}},e.headers,c,t)}),isOAuthToken:!1};if(r&&ie(r))return{client:new b({apiKey:null,authToken:r,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:o,defaultHeaders:w({accept:"application/json","anthropic-dangerous-direct-browser-access":"true","anthropic-beta":["claude-code-20250219","oauth-2025-04-20",...p].join(","),"user-agent":`claude-cli/${K}`,"x-app":"cli"},e.headers,t)}),isOAuthToken:!0};const d=h&&_(e).sendSessionAffinityHeaders?{"x-session-affinity":h}:{},u=w({accept:"application/json","anthropic-dangerous-direct-browser-access":"true",...p.length>0?{"anthropic-beta":p.join(",")}:{}},d,e.headers,t);return{client:new b({apiKey:r??null,authToken:null,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:o,defaultHeaders:u}),isOAuthToken:!1}}f(ce,"createClient");function ue(e,r,n,a){const{cacheControl:t}=F(e,a?.cacheRetention,a?.env),o=_(e),c=G(r.messages,e,le),h=n?y:i=>i,l=j({...r,messages:c},o.supportsToolReferences,h);let p=l.immediate,d=[...l.deferred.values()];p.length===0&&d.length>0&&(p=d,d=[]);const u=new Set(d.map(i=>h(i.name))),s={model:e.id,messages:de(c,n,t,o.allowEmptySignature,u,h),max_tokens:a?.maxTokens??e.maxTokens,stream:!0};if(n?(s.system=[{type:"text",text:"You are Claude Code, Anthropic's official CLI for Claude.",...t?{cache_control:t}:{}}],r.systemPrompt&&s.system.push({type:"text",text:k(r.systemPrompt),...t?{cache_control:t}:{}})):r.systemPrompt&&(s.system=[{type:"text",text:k(r.systemPrompt),...t?{cache_control:t}:{}}]),a?.temperature!==void 0&&!a?.thinkingEnabled&&o.supportsTemperature&&(s.temperature=a.temperature),(p.length>0||d.length>0)&&(s.tools=[...M(p,n,o.supportsEagerToolInputStreaming,o.supportsStrictTools,o.supportsCacheControlOnTools?t:void 0),...M(d,n,o.supportsEagerToolInputStreaming,o.supportsStrictTools,void 0,!0)]),e.reasoning)if(a?.thinkingEnabled){const i=a.thinkingDisplay??"summarized";e.compat?.forceAdaptiveThinking===!0?(s.thinking={type:"adaptive",display:i},a.effort&&(s.output_config=a.effort==="xhigh"?{effort:a.effort}:{effort:a.effort})):s.thinking={type:"enabled",budget_tokens:a.thinkingBudgetTokens||1024,display:i}}else a?.thinkingEnabled===!1&&e.thinkingLevelMap?.off!==null&&(s.thinking={type:"disabled"});if(a?.metadata){const i=a.metadata.user_id;typeof i=="string"&&(s.metadata={user_id:i})}return a?.toolChoice&&(typeof a.toolChoice=="string"?s.tool_choice={type:a.toolChoice}:s.tool_choice=a.toolChoice),s}f(ue,"buildParams");function le(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)}f(le,"normalizeToolCallId");function pe(e,r,n,a,t){const o=[];for(const h of e.addedToolNames??[]){const l=t(h);!n.has(l)||a.has(l)||(a.add(l),o.push({type:"tool_reference",tool_name:r?y(h):h}))}const c=Z(e.content);return{toolResult:{type:"tool_result",tool_use_id:e.toolCallId,content:o.length>0?o:c,is_error:e.isError},siblingContent:o.length===0?[]:typeof c=="string"?[{type:"text",text:c}]:c}}f(pe,"convertToolResult");function de(e,r,n,a=!1,t=new Set,o=c=>c){const c=[],h=new Set;for(let l=0;l<e.length;l++){const p=e[l];if(p.role==="user")if(typeof p.content=="string")p.content.trim().length>0&&c.push({role:"user",content:k(p.content)});else{const u=p.content.map(s=>s.type==="text"?{type:"text",text:k(s.text)}:{type:"image",source:{type:"base64",media_type:s.mimeType,data:s.data}}).filter(s=>s.type==="text"?s.text.trim().length>0:!0);if(u.length===0)continue;c.push({role:"user",content:u})}else if(p.role==="assistant"){const d=[];for(const u of p.content)if(u.type==="text"){if(u.text.trim().length===0)continue;d.push({type:"text",text:k(u.text)})}else if(u.type==="thinking"){if(u.redacted){d.push({type:"redacted_thinking",data:u.thinkingSignature});continue}const s=u.thinkingSignature,i=!!s&&s.trim().length>0;if(u.thinking.trim().length===0&&!i)continue;i?d.push({type:"thinking",thinking:k(u.thinking),signature:s}):d.push(a?{type:"thinking",thinking:k(u.thinking),signature:""}:{type:"text",text:k(u.thinking)})}else u.type==="toolCall"&&d.push({type:"tool_use",id:u.id,name:r?y(u.name):u.name,input:u.arguments??{}});if(d.length===0)continue;c.push({role:"assistant",content:d})}else if(p.role==="toolResult"){const d=[],u=[];let s=l;for(;s<e.length&&e[s].role==="toolResult";){const i=pe(e[s],r,t,h,o);d.push(i.toolResult),u.push(...i.siblingContent),s++}l=s-1,c.push({role:"user",content:[...d,...u]})}}if(n&&c.length>0){const l=c[c.length-1];if(l.role==="user")if(Array.isArray(l.content)){const p=l.content[l.content.length-1];p&&(p.type==="text"||p.type==="image"||p.type==="tool_result")&&(p.cache_control=n)}else typeof l.content=="string"&&(l.content=[{type:"text",text:l.content,cache_control:n}])}return c}f(de,"convertMessages");function ge(e,r){return!!r.tools?.length&&!_(e).supportsEagerToolInputStreaming}f(ge,"shouldUseFineGrainedToolStreamingBeta");function M(e,r,n,a,t,o=!1){return e?e.map((c,h)=>{const l=D(c,a),p=c.parameters,d={type:"object",properties:p.properties??{},required:p.required??[]},u=l===!0?{...c.parameters,...d}:d;return{name:r?y(c.name):c.name,description:c.description,...n?{eager_input_streaming:!0}:{},...l===!0?{strict:!0}:{},input_schema:u,...o?{defer_loading:!0}:{},...t&&h===e.length-1?{cache_control:t}:{}}}):[]}f(M,"convertTools");function fe(e,r){switch(e){case"end_turn":return{stopReason:"stop"};case"max_tokens":return{stopReason:"length"};case"tool_use":return{stopReason:"toolUse"};case"refusal":return{stopReason:"error",errorMessage:r?.explanation||"The model refused to complete the request"};case"pause_turn":return{stopReason:"stop"};case"stop_sequence":return{stopReason:"stop"};case"sensitive":return{stopReason:"error",errorMessage:"Provider stopped with: sensitive"};default:throw new Error(`Unhandled stop reason: ${e}`)}}f(fe,"mapStopReason");
1
+ var N=Object.defineProperty;var f=(e,r)=>N(e,"name",{value:r,configurable:!0});import b from"@anthropic-ai/sdk";import{calculateCost as S}from"../models.js";import{splitDeferredTools as j}from"../utils/deferred-tools.js";import{AssistantMessageEventStream as B}from"../utils/event-stream.js";import{headersToRecord as O}from"../utils/headers.js";import{parseJsonWithRepair as P,parseStreamingJson as C}from"../utils/json-parse.js";import{getProviderEnvValue as W}from"../utils/provider-env.js";import{retryProviderRequest as H}from"../utils/provider-retry.js";import{sanitizeSurrogates as k}from"../utils/sanitize-unicode.js";import{resolveJsonSchemaStrictSampling as D}from"./constrained-sampling.js";import{buildCopilotDynamicHeaders as J,hasCopilotVisionInput as U}from"./github-copilot-headers.js";import{adjustMaxTokensForThinking as q,buildBaseOptions as z,clampMaxTokensToContext as $}from"./simple-options.js";import{transformMessages as G}from"./transform-messages.js";function E(e,r){return e||(W("PI_CACHE_RETENTION",r)==="long"?"long":"short")}f(E,"resolveCacheRetention");function F(e,r,s){const a=E(r,s);if(a==="none")return{retention:a};const t=a==="long"&&_(e).supportsLongCacheRetention?"1h":void 0;return{retention:a,cacheControl:{type:"ephemeral",...t&&{ttl:t}}}}f(F,"getCacheControl");const K="2.1.75",V=["Read","Write","Edit","Bash","Grep","Glob","AskUserQuestion","EnterPlanMode","ExitPlanMode","KillShell","NotebookEdit","Skill","Task","TaskOutput","TodoWrite","WebFetch","WebSearch"],Q=new Map(V.map(e=>[e.toLowerCase(),e])),y=f(e=>Q.get(e.toLowerCase())??e,"toClaudeCodeName"),Y=f((e,r)=>{if(r&&r.length>0){const s=e.toLowerCase(),a=r.find(t=>t.name.toLowerCase()===s);if(a)return a.name}return e},"fromClaudeCodeName");function Z(e){if(!e.some(t=>t.type==="image"))return k(e.map(t=>t.text).join(`
2
+ `));const s=e.map(t=>t.type==="text"?{type:"text",text:k(t.text)}:{type:"image",source:{type:"base64",media_type:t.mimeType,data:t.data}});return s.some(t=>t.type==="text")||s.unshift({type:"text",text:"(see attached image)"}),s}f(Z,"convertContentBlocks");const X="fine-grained-tool-streaming-2025-05-14",ee="interleaved-thinking-2025-05-14";function _(e){return{supportsEagerToolInputStreaming:e.compat?.supportsEagerToolInputStreaming??!0,supportsLongCacheRetention:e.compat?.supportsLongCacheRetention??!0,sendSessionAffinityHeaders:e.compat?.sendSessionAffinityHeaders??!1,supportsCacheControlOnTools:e.compat?.supportsCacheControlOnTools??!0,supportsTemperature:e.compat?.supportsTemperature??!0,allowEmptySignature:e.compat?.allowEmptySignature??!1,supportsStrictTools:e.compat?.supportsStrictTools??!1,supportsToolReferences:e.compat?.supportsToolReferences??te(e)}}f(_,"getAnthropicCompat");function te(e){if(e.provider!=="anthropic"||e.id.includes("haiku"))return!1;const r=e.id.match(/^claude-(?:opus|sonnet|fable)-(\d+)(?:-(\d+))?(?:-|$)/);if(!r)return!1;const s=Number(r[1]),a=r[2]&&r[2].length<8?Number(r[2]):0;return s>4||s===4&&a>=5}f(te,"defaultSupportsToolReferences");function T(...e){const r={};for(const s of e)s&&Object.assign(r,s);return r}f(T,"mergeHeaders");function w(e,r){if(!e)return!1;const s=r.toLowerCase();for(const[a,t]of Object.entries(e))if(a.toLowerCase()===s&&t!==null&&t.trim().length>0)return!0;return!1}f(w,"hasHeader");function I(e,r,s){if(!r&&!(w(s,"authorization")||w(s,"x-api-key")||w(s,"cf-aig-authorization")))throw new Error(`No API key for provider: ${e}`)}f(I,"assertRequestAuth");const ne=new Set(["message_start","message_delta","message_stop","content_block_start","content_block_delta","content_block_stop"]);function A(e){if(!e.event&&e.data.length===0)return null;const r={event:e.event,data:e.data.join(`
3
+ `),raw:[...e.raw]};return e.event=null,e.data=[],e.raw=[],r}f(A,"flushSseEvent");function R(e,r){if(e==="")return A(r);if(r.raw.push(e),e.startsWith(":"))return null;const s=e.indexOf(":"),a=s===-1?e:e.slice(0,s);let t=s===-1?"":e.slice(s+1);return t.startsWith(" ")&&(t=t.slice(1)),a==="event"?r.event=t:a==="data"&&r.data.push(t),null}f(R,"decodeSseLine");function se(e){const r=e.indexOf("\r"),s=e.indexOf(`
4
+ `);return r===-1?s:s===-1?r:Math.min(r,s)}f(se,"nextLineBreakIndex");function x(e){const r=se(e);if(r===-1)return null;let s=r+1;return e[r]==="\r"&&e[s]===`
5
+ `&&(s+=1),{line:e.slice(0,r),rest:e.slice(s)}}f(x,"consumeLine");async function*re(e,r){const s=e.getReader(),a=new TextDecoder,t={event:null,data:[],raw:[]};let o="";try{for(;;){if(r?.aborted)throw new Error("Request was aborted");const{value:u,done:g}=await s.read();if(g)break;o+=a.decode(u,{stream:!0});let p=x(o);for(;p;){o=p.rest;const l=R(p.line,t);l&&(yield l),p=x(o)}}o+=a.decode();let c=x(o);for(;c;){o=c.rest;const u=R(c.line,t);u&&(yield u),c=x(o)}if(o.length>0){const u=R(o,t);u&&(yield u)}const h=A(t);h&&(yield h)}finally{s.releaseLock()}}f(re,"iterateSseMessages");async function*ae(e,r){if(!e.body)throw new Error("Attempted to iterate over an Anthropic response with no body");let s=!1,a=!1;for await(const t of re(e.body,r)){if(t.event==="error")throw new Error(t.data);if(ne.has(t.event??""))try{const o=P(t.data);o.type==="message_start"?s=!0:o.type==="message_stop"&&(a=!0),yield o}catch(o){const c=o instanceof Error?o.message:String(o);throw new Error(`Could not parse Anthropic SSE event ${t.event}: ${c}; data=${t.data}; raw=${t.raw.join("\\n")}`)}}if(s&&!a)throw new Error("Anthropic stream ended before message_stop")}f(ae,"iterateAnthropicEvents");export const stream=f((e,r,s)=>{const a=new B;return(async()=>{const t={role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let o,c;if(s?.client)o=s.client,c=!1;else{const n=s?.apiKey;I(e.provider,n,s?.headers);let i;if(e.provider==="github-copilot"){const L=U(r.messages);i=J({messages:r.messages,hasImages:L})}const m=E(s?.cacheRetention,s?.env)==="none"?void 0:s?.sessionId,v=ce(e,n,s?.interleavedThinking??!0,fe(e,r),s?.headers,i,m);o=v.client,c=v.isOAuthToken}let h=ue(e,r,c,s);const u=await s?.onPayload?.(h,e);u!==void 0&&(h=u);const g={...s?.signal?{signal:s.signal}:{},...s?.timeoutMs!==void 0?{timeout:s.timeoutMs}:{},maxRetries:0},p=await H(()=>o.messages.create({...h,stream:!0},g).asResponse(),{maxRetries:s?.maxRetries,maxRetryDelayMs:s?.maxRetryDelayMs,signal:s?.signal});await s?.onResponse?.({status:p.status,headers:O(p.headers)},e),a.push({type:"start",partial:t});const l=t.content;for await(const n of ae(p,s?.signal))if(n.type==="message_start")t.responseId=n.message.id,t.usage.input=n.message.usage.input_tokens||0,t.usage.output=n.message.usage.output_tokens||0,t.usage.cacheRead=n.message.usage.cache_read_input_tokens||0,t.usage.cacheWrite=n.message.usage.cache_creation_input_tokens||0,t.usage.cacheWrite1h=n.message.usage.cache_creation?.ephemeral_1h_input_tokens||0,t.usage.totalTokens=t.usage.input+t.usage.output+t.usage.cacheRead+t.usage.cacheWrite,S(e,t.usage);else if(n.type==="content_block_start"){if(n.content_block.type==="text"){const i={type:"text",text:"",index:n.index};t.content.push(i),a.push({type:"text_start",contentIndex:t.content.length-1,partial:t})}else if(n.content_block.type==="thinking"){const i={type:"thinking",thinking:"",thinkingSignature:"",index:n.index};t.content.push(i),a.push({type:"thinking_start",contentIndex:t.content.length-1,partial:t})}else if(n.content_block.type==="redacted_thinking"){const i={type:"thinking",thinking:"[Reasoning redacted]",thinkingSignature:n.content_block.data,redacted:!0,index:n.index};t.content.push(i),a.push({type:"thinking_start",contentIndex:t.content.length-1,partial:t})}else if(n.content_block.type==="tool_use"){const i={type:"toolCall",id:n.content_block.id,name:c?Y(n.content_block.name,r.tools):n.content_block.name,arguments:n.content_block.input??{},partialJson:"",index:n.index};t.content.push(i),a.push({type:"toolcall_start",contentIndex:t.content.length-1,partial:t})}}else if(n.type==="content_block_delta"){if(n.delta.type==="text_delta"){const i=l.findIndex(m=>m.index===n.index),d=l[i];d&&d.type==="text"&&(d.text+=n.delta.text,a.push({type:"text_delta",contentIndex:i,delta:n.delta.text,partial:t}))}else if(n.delta.type==="thinking_delta"){const i=l.findIndex(m=>m.index===n.index),d=l[i];d&&d.type==="thinking"&&(d.thinking+=n.delta.thinking,a.push({type:"thinking_delta",contentIndex:i,delta:n.delta.thinking,partial:t}))}else if(n.delta.type==="input_json_delta"){const i=l.findIndex(m=>m.index===n.index),d=l[i];d&&d.type==="toolCall"&&(d.partialJson+=n.delta.partial_json,d.arguments=C(d.partialJson),a.push({type:"toolcall_delta",contentIndex:i,delta:n.delta.partial_json,partial:t}))}else if(n.delta.type==="signature_delta"){const i=l.findIndex(m=>m.index===n.index),d=l[i];d&&d.type==="thinking"&&(d.thinkingSignature=d.thinkingSignature||"",d.thinkingSignature+=n.delta.signature)}}else if(n.type==="content_block_stop"){const i=l.findIndex(m=>m.index===n.index),d=l[i];d&&(delete d.index,d.type==="text"?a.push({type:"text_end",contentIndex:i,content:d.text,partial:t}):d.type==="thinking"?a.push({type:"thinking_end",contentIndex:i,content:d.thinking,partial:t}):d.type==="toolCall"&&(d.arguments=C(d.partialJson),delete d.partialJson,a.push({type:"toolcall_end",contentIndex:i,toolCall:d,partial:t})))}else if(n.type==="message_delta"){if(n.delta.stop_reason){const i=ge(n.delta.stop_reason,n.delta.stop_details);t.stopReason=i.stopReason,i.errorMessage&&(t.errorMessage=i.errorMessage)}if(n.usage){n.usage.input_tokens!=null&&(t.usage.input=n.usage.input_tokens),n.usage.output_tokens!=null&&(t.usage.output=n.usage.output_tokens),n.usage.cache_read_input_tokens!=null&&(t.usage.cacheRead=n.usage.cache_read_input_tokens),n.usage.cache_creation_input_tokens!=null&&(t.usage.cacheWrite=n.usage.cache_creation_input_tokens);const i=n.usage.output_tokens_details?.thinking_tokens;i!=null&&(t.usage.reasoning=i)}t.usage.totalTokens=t.usage.input+t.usage.output+t.usage.cacheRead+t.usage.cacheWrite,S(e,t.usage)}if(s?.signal?.aborted)throw new Error("Request was aborted");if(t.stopReason==="aborted"||t.stopReason==="error")throw new Error(t.errorMessage||"An unknown error occurred");a.push({type:"done",reason:t.stopReason,message:t}),a.end()}catch(o){for(const c of t.content)delete c.index,delete c.partialJson;t.stopReason=s?.signal?.aborted?"aborted":"error",t.errorMessage=o instanceof Error?o.message:JSON.stringify(o),a.push({type:"error",reason:t.stopReason,error:t}),a.end()}})(),a},"stream");function oe(e,r){const s=r?e.thinkingLevelMap?.[r]:void 0;if(typeof s=="string")return s;switch(r){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}f(oe,"mapThinkingLevelToEffort");export const streamSimple=f((e,r,s)=>{I(e.provider,s?.apiKey,s?.headers);const a=z(e,r,s,s?.apiKey);if(!s?.reasoning)return stream(e,r,{...a,thinkingEnabled:!1});if(e.compat?.forceAdaptiveThinking===!0){const c=oe(e,s.reasoning);return stream(e,r,{...a,thinkingEnabled:!0,effort:c})}const t=q(a.maxTokens,e.maxTokens,s.reasoning,s.thinkingBudgets),o=$(e,r,t.maxTokens);return stream(e,r,{...a,maxTokens:o,thinkingEnabled:!0,thinkingBudgetTokens:Math.min(t.thinkingBudget,Math.max(0,o-1024))})},"streamSimple");function ie(e){return e.includes("sk-ant-oat")}f(ie,"isOAuthToken");function ce(e,r,s,a,t,o,c){const h=s&&e.compat?.forceAdaptiveThinking!==!0,u=[];if(a&&u.push(X),h&&u.push(ee),e.provider==="github-copilot")return{client:new b({apiKey:null,authToken:r??null,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:T({accept:"application/json","anthropic-dangerous-direct-browser-access":"true",...u.length>0?{"anthropic-beta":u.join(",")}:{}},e.headers,o,t)}),isOAuthToken:!1};if(r&&ie(r))return{client:new b({apiKey:null,authToken:r,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:T({accept:"application/json","anthropic-dangerous-direct-browser-access":"true","anthropic-beta":["claude-code-20250219","oauth-2025-04-20",...u].join(","),"user-agent":`claude-cli/${K}`,"x-app":"cli"},e.headers,t)}),isOAuthToken:!0};const g=c&&_(e).sendSessionAffinityHeaders?{"x-session-affinity":c}:{},p=T({accept:"application/json","anthropic-dangerous-direct-browser-access":"true",...u.length>0?{"anthropic-beta":u.join(",")}:{}},g,e.headers,t);return{client:new b({apiKey:r??null,authToken:null,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:p}),isOAuthToken:!1}}f(ce,"createClient");function ue(e,r,s,a){const{cacheControl:t}=F(e,a?.cacheRetention,a?.env),o=_(e),c=G(r.messages,e,le),h=s?y:i=>i,u=j({...r,messages:c},o.supportsToolReferences,h);let g=u.immediate,p=[...u.deferred.values()];g.length===0&&p.length>0&&(g=p,p=[]);const l=new Set(p.map(i=>h(i.name))),n={model:e.id,messages:de(c,s,t,o.allowEmptySignature,l,h),max_tokens:a?.maxTokens??e.maxTokens,stream:!0};if(s?(n.system=[{type:"text",text:"You are Claude Code, Anthropic's official CLI for Claude.",...t?{cache_control:t}:{}}],r.systemPrompt&&n.system.push({type:"text",text:k(r.systemPrompt),...t?{cache_control:t}:{}})):r.systemPrompt&&(n.system=[{type:"text",text:k(r.systemPrompt),...t?{cache_control:t}:{}}]),a?.temperature!==void 0&&!a?.thinkingEnabled&&o.supportsTemperature&&(n.temperature=a.temperature),(g.length>0||p.length>0)&&(n.tools=[...M(g,s,o.supportsEagerToolInputStreaming,o.supportsStrictTools,o.supportsCacheControlOnTools?t:void 0),...M(p,s,o.supportsEagerToolInputStreaming,o.supportsStrictTools,void 0,!0)]),e.reasoning)if(a?.thinkingEnabled){const i=a.thinkingDisplay??"summarized";e.compat?.forceAdaptiveThinking===!0?(n.thinking={type:"adaptive",display:i},a.effort&&(n.output_config=a.effort==="xhigh"?{effort:a.effort}:{effort:a.effort})):n.thinking={type:"enabled",budget_tokens:a.thinkingBudgetTokens||1024,display:i}}else a?.thinkingEnabled===!1&&e.thinkingLevelMap?.off!==null&&(n.thinking={type:"disabled"});if(a?.metadata){const i=a.metadata.user_id;typeof i=="string"&&(n.metadata={user_id:i})}return a?.toolChoice&&(typeof a.toolChoice=="string"?n.tool_choice={type:a.toolChoice}:n.tool_choice=a.toolChoice),n}f(ue,"buildParams");function le(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)}f(le,"normalizeToolCallId");function pe(e,r,s,a,t){const o=[];for(const h of e.addedToolNames??[]){const u=t(h);!s.has(u)||a.has(u)||(a.add(u),o.push({type:"tool_reference",tool_name:r?y(h):h}))}const c=Z(e.content);return{toolResult:{type:"tool_result",tool_use_id:e.toolCallId,content:o.length>0?o:c,is_error:e.isError},siblingContent:o.length===0?[]:typeof c=="string"?[{type:"text",text:c}]:c}}f(pe,"convertToolResult");function de(e,r,s,a=!1,t=new Set,o=c=>c){const c=[],h=new Set;for(let u=0;u<e.length;u++){const g=e[u];if(g.role==="user")if(typeof g.content=="string")g.content.trim().length>0&&c.push({role:"user",content:k(g.content)});else{const l=g.content.map(n=>n.type==="text"?{type:"text",text:k(n.text)}:{type:"image",source:{type:"base64",media_type:n.mimeType,data:n.data}}).filter(n=>n.type==="text"?n.text.trim().length>0:!0);if(l.length===0)continue;c.push({role:"user",content:l})}else if(g.role==="assistant"){const p=[];for(const l of g.content)if(l.type==="text"){if(l.text.trim().length===0)continue;p.push({type:"text",text:k(l.text)})}else if(l.type==="thinking"){if(l.redacted){p.push({type:"redacted_thinking",data:l.thinkingSignature});continue}const n=l.thinkingSignature,i=!!n&&n.trim().length>0;if(l.thinking.trim().length===0&&!i)continue;i?p.push({type:"thinking",thinking:k(l.thinking),signature:n}):p.push(a?{type:"thinking",thinking:k(l.thinking),signature:""}:{type:"text",text:k(l.thinking)})}else l.type==="toolCall"&&p.push({type:"tool_use",id:l.id,name:r?y(l.name):l.name,input:l.arguments??{}});if(p.length===0)continue;c.push({role:"assistant",content:p})}else if(g.role==="toolResult"){const p=[],l=[];let n=u;for(;n<e.length&&e[n].role==="toolResult";){const i=pe(e[n],r,t,h,o);p.push(i.toolResult),l.push(...i.siblingContent),n++}u=n-1,c.push({role:"user",content:[...p,...l]})}}if(s&&c.length>0){const u=c[c.length-1];if(u.role==="user")if(Array.isArray(u.content)){const g=u.content[u.content.length-1];g&&(g.type==="text"||g.type==="image"||g.type==="tool_result")&&(g.cache_control=s)}else typeof u.content=="string"&&(u.content=[{type:"text",text:u.content,cache_control:s}])}return c}f(de,"convertMessages");function fe(e,r){return!!r.tools?.length&&!_(e).supportsEagerToolInputStreaming}f(fe,"shouldUseFineGrainedToolStreamingBeta");function M(e,r,s,a,t,o=!1){return e?e.map((c,h)=>{const u=D(c,a),g=c.parameters,p={type:"object",properties:g.properties??{},required:g.required??[]},l=u===!0?{...c.parameters,...p}:p;return{name:r?y(c.name):c.name,description:c.description,...s?{eager_input_streaming:!0}:{},...u===!0?{strict:!0}:{},input_schema:l,...o?{defer_loading:!0}:{},...t&&h===e.length-1?{cache_control:t}:{}}}):[]}f(M,"convertTools");function ge(e,r){switch(e){case"end_turn":return{stopReason:"stop"};case"max_tokens":return{stopReason:"length"};case"tool_use":return{stopReason:"toolUse"};case"refusal":return{stopReason:"error",errorMessage:r?.explanation||"The model refused to complete the request"};case"pause_turn":return{stopReason:"stop"};case"stop_sequence":return{stopReason:"stop"};case"sensitive":return{stopReason:"error"};default:throw new Error(`Unhandled stop reason: ${e}`)}}f(ge,"mapStopReason");
@@ -1 +1 @@
1
- var R=Object.defineProperty;var i=(r,a)=>R(r,"name",{value:a,configurable:!0});import{AzureOpenAI as h}from"openai";import{clampThinkingLevel as g}from"../models.js";import{formatProviderError as y,normalizeProviderError as _}from"../utils/error-body.js";import{AssistantMessageEventStream as I}from"../utils/event-stream.js";import{headersToRecord as O}from"../utils/headers.js";import{getProviderEnvValue as m}from"../utils/provider-env.js";import{retryProviderRequest as v}from"../utils/provider-retry.js";import{createGrammarToolInputProperties as d}from"./constrained-sampling.js";import{clampOpenAIPromptCacheKey as w}from"./openai-prompt-cache.js";import{convertResponsesMessages as U,convertResponsesTools as P,processResponsesStream as N}from"./openai-responses-shared.js";import{buildBaseOptions as z}from"./simple-options.js";const S="v1",M=new Set(["openai","openai-codex","opencode","azure-openai-responses"]),b=16;function T(r){const a=new Map;if(!r)return a;for(const e of r.split(",")){const n=e.trim();if(!n)continue;const[s,t]=n.split("=",2);!s||!t||a.set(s.trim(),t.trim())}return a}i(T,"parseDeploymentNameMap");function L(r,a){return a?.azureDeploymentName?a.azureDeploymentName:T(m("AZURE_OPENAI_DEPLOYMENT_NAME_MAP",a?.env)).get(r.id)||r.id}i(L,"resolveDeploymentName");function k(r){return y(_(r),"Azure OpenAI API error")}i(k,"formatAzureOpenAIError");export const stream=i((r,a,e)=>{const n=new I;return(async()=>{const s=L(r,e),t={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.id,usage:{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{const o=e?.apiKey;if(!o)throw new Error(`No API key for provider: ${r.provider}`);const p=Z(r,o,e),c=d(a.tools,r.compat?.supportsOpenAIGrammarTools??!1);let u=V(r,a,e,s,c);const f=await e?.onPayload?.(u,r);f!==void 0&&(u=f);const A={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:0},{data:E,response:l}=await v(()=>p.responses.create(u,A).withResponse(),{maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,signal:e?.signal});if(await e?.onResponse?.({status:l.status,headers:O(l.headers)},r),n.push({type:"start",partial:t}),await N(E,t,n,r,{grammarToolInputProperties:c}),e?.signal?.aborted)throw new Error("Request was aborted");if(t.stopReason==="pending")throw new Error("Azure OpenAI Responses stream ended without a stop reason");if(t.stopReason==="aborted"||t.stopReason==="error")throw new Error("An unknown error occurred");n.push({type:"done",reason:t.stopReason,message:t}),n.end()}catch(o){for(const p of t.content)delete p.index,delete p.partialJson,delete p.customInput;t.stopReason=e?.signal?.aborted?"aborted":"error",t.errorMessage=k(o),n.push({type:"error",reason:t.stopReason,error:t}),n.end()}})(),n},"stream"),streamSimple=i((r,a,e)=>{const n=e?.apiKey;if(!n)throw new Error(`No API key for provider: ${r.provider}`);const s=z(r,a,e,n),t=e?.reasoning?g(r,e.reasoning):void 0;return stream(r,a,{...s,reasoningEffort:t==="off"?void 0:t})},"streamSimple");function D(r){const a=r.trim().replace(/\/+$/,"");let e;try{e=new URL(a)}catch{throw new Error(`Invalid Azure OpenAI base URL: ${r}`)}const n=e.hostname.endsWith(".openai.azure.com")||e.hostname.endsWith(".cognitiveservices.azure.com")||e.hostname.endsWith(".ai.azure.com"),s=e.pathname.replace(/\/+$/,"");return n&&(s===""||s==="/"||s==="/openai"||s==="/openai/v1/responses")&&(e.pathname="/openai/v1",e.search=""),e.toString().replace(/\/+$/,"")}i(D,"normalizeAzureBaseUrl");function B(r){return`https://${r}.openai.azure.com/openai/v1`}i(B,"buildDefaultBaseUrl");function x(r,a){const e=a?.azureApiVersion||m("AZURE_OPENAI_API_VERSION",a?.env)||S,n=a?.azureBaseUrl?.trim()||m("AZURE_OPENAI_BASE_URL",a?.env)?.trim()||void 0,s=a?.azureResourceName||m("AZURE_OPENAI_RESOURCE_NAME",a?.env);let t=n;if(!t&&s&&(t=B(s)),!t&&r.baseUrl&&(t=r.baseUrl),!t)throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:D(t),apiVersion:e}}i(x,"resolveAzureConfig");function Z(r,a,e){const n={...r.headers};e?.headers&&Object.assign(n,e.headers);const{baseUrl:s,apiVersion:t}=x(r,e);return new h({apiKey:a,apiVersion:t,dangerouslyAllowBrowser:!0,fetch:e?.fetch,defaultHeaders:n,baseURL:s})}i(Z,"createClient");function V(r,a,e,n,s=d(a.tools,r.compat?.supportsOpenAIGrammarTools??!1)){const t=U(r,a,M,{grammarToolInputProperties:s}),o={model:n,input:t,stream:!0,prompt_cache_key:w(e?.sessionId),store:!1};if(e?.maxTokens&&(o.max_output_tokens=Math.max(e.maxTokens,b)),e?.temperature!==void 0&&(o.temperature=e?.temperature),a.tools&&a.tools.length>0&&(o.tools=P(a.tools,{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1})),r.reasoning)if(e?.reasoningEffort||e?.reasoningSummary){const p=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:"medium";o.reasoning={effort:p,summary:e?.reasoningSummary||"auto"},o.include=["reasoning.encrypted_content"]}else r.thinkingLevelMap?.off!==null&&(o.reasoning={effort:r.thinkingLevelMap?.off??"none"});return o}i(V,"buildParams");
1
+ var R=Object.defineProperty;var i=(r,a)=>R(r,"name",{value:a,configurable:!0});import{AzureOpenAI as h}from"openai";import{clampThinkingLevel as g}from"../models.js";import{formatProviderError as y,normalizeProviderError as _}from"../utils/error-body.js";import{AssistantMessageEventStream as I}from"../utils/event-stream.js";import{headersToRecord as v}from"../utils/headers.js";import{getProviderEnvValue as m}from"../utils/provider-env.js";import{retryProviderRequest as O}from"../utils/provider-retry.js";import{createGrammarToolInputProperties as d}from"./constrained-sampling.js";import{clampOpenAIPromptCacheKey as U}from"./openai-prompt-cache.js";import{convertResponsesMessages as P,convertResponsesTools as w,processResponsesStream as N}from"./openai-responses-shared.js";import{buildBaseOptions as z}from"./simple-options.js";const S="v1",M=new Set(["openai","openai-codex","opencode","azure-openai-responses"]),b=16;function T(r){const a=new Map;if(!r)return a;for(const e of r.split(",")){const n=e.trim();if(!n)continue;const[s,t]=n.split("=",2);!s||!t||a.set(s.trim(),t.trim())}return a}i(T,"parseDeploymentNameMap");function L(r,a){return a?.azureDeploymentName?a.azureDeploymentName:T(m("AZURE_OPENAI_DEPLOYMENT_NAME_MAP",a?.env)).get(r.id)||r.id}i(L,"resolveDeploymentName");function k(r){return y(_(r),"Azure OpenAI API error")}i(k,"formatAzureOpenAIError");export const stream=i((r,a,e)=>{const n=new I;return(async()=>{const s=L(r,e),t={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{const o=e?.apiKey;if(!o)throw new Error(`No API key for provider: ${r.provider}`);const p=Z(r,o,e),c=d(a.tools,r.compat?.supportsOpenAIGrammarTools??!1);let u=V(r,a,e,s,c);const f=await e?.onPayload?.(u,r);f!==void 0&&(u=f);const A={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:0},{data:E,response:l}=await O(()=>p.responses.create(u,A).withResponse(),{maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,signal:e?.signal});if(await e?.onResponse?.({status:l.status,headers:v(l.headers)},r),n.push({type:"start",partial:t}),await N(E,t,n,r,{grammarToolInputProperties:c}),e?.signal?.aborted)throw new Error("Request was aborted");if(t.stopReason==="aborted"||t.stopReason==="error")throw new Error("An unknown error occurred");n.push({type:"done",reason:t.stopReason,message:t}),n.end()}catch(o){for(const p of t.content)delete p.index,delete p.partialJson,delete p.customInput;t.stopReason=e?.signal?.aborted?"aborted":"error",t.errorMessage=k(o),n.push({type:"error",reason:t.stopReason,error:t}),n.end()}})(),n},"stream"),streamSimple=i((r,a,e)=>{const n=e?.apiKey;if(!n)throw new Error(`No API key for provider: ${r.provider}`);const s=z(r,a,e,n),t=e?.reasoning?g(r,e.reasoning):void 0;return stream(r,a,{...s,reasoningEffort:t==="off"?void 0:t})},"streamSimple");function D(r){const a=r.trim().replace(/\/+$/,"");let e;try{e=new URL(a)}catch{throw new Error(`Invalid Azure OpenAI base URL: ${r}`)}const n=e.hostname.endsWith(".openai.azure.com")||e.hostname.endsWith(".cognitiveservices.azure.com")||e.hostname.endsWith(".ai.azure.com"),s=e.pathname.replace(/\/+$/,"");return n&&(s===""||s==="/"||s==="/openai"||s==="/openai/v1/responses")&&(e.pathname="/openai/v1",e.search=""),e.toString().replace(/\/+$/,"")}i(D,"normalizeAzureBaseUrl");function B(r){return`https://${r}.openai.azure.com/openai/v1`}i(B,"buildDefaultBaseUrl");function x(r,a){const e=a?.azureApiVersion||m("AZURE_OPENAI_API_VERSION",a?.env)||S,n=a?.azureBaseUrl?.trim()||m("AZURE_OPENAI_BASE_URL",a?.env)?.trim()||void 0,s=a?.azureResourceName||m("AZURE_OPENAI_RESOURCE_NAME",a?.env);let t=n;if(!t&&s&&(t=B(s)),!t&&r.baseUrl&&(t=r.baseUrl),!t)throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:D(t),apiVersion:e}}i(x,"resolveAzureConfig");function Z(r,a,e){const n={...r.headers};e?.headers&&Object.assign(n,e.headers);const{baseUrl:s,apiVersion:t}=x(r,e);return new h({apiKey:a,apiVersion:t,dangerouslyAllowBrowser:!0,defaultHeaders:n,baseURL:s})}i(Z,"createClient");function V(r,a,e,n,s=d(a.tools,r.compat?.supportsOpenAIGrammarTools??!1)){const t=P(r,a,M,{grammarToolInputProperties:s}),o={model:n,input:t,stream:!0,prompt_cache_key:U(e?.sessionId),store:!1};if(e?.maxTokens&&(o.max_output_tokens=Math.max(e.maxTokens,b)),e?.temperature!==void 0&&(o.temperature=e?.temperature),a.tools&&a.tools.length>0&&(o.tools=w(a.tools,{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1})),r.reasoning)if(e?.reasoningEffort||e?.reasoningSummary){const p=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:"medium";o.reasoning={effort:p,summary:e?.reasoningSummary||"auto"},o.include=["reasoning.encrypted_content"]}else r.thinkingLevelMap?.off!==null&&(o.reasoning={effort:r.thinkingLevelMap?.off??"none"});return o}i(V,"buildParams");
@@ -1 +1 @@
1
- var j=Object.defineProperty;var c=(e,n)=>j(e,"name",{value:n,configurable:!0});import{BedrockRuntimeClient as X,BedrockRuntimeServiceException as G,StopReason as E,CachePointType as P,CacheTTL as D,ConversationRole as x,ConverseStreamCommand as V,ImageFormat as S,ToolResultStatus as R}from"@aws-sdk/client-bedrock-runtime";import{NodeHttpHandler as W}from"@smithy/node-http-handler";import{HttpProxyAgent as Y}from"http-proxy-agent";import{HttpsProxyAgent as Q}from"https-proxy-agent";import{calculateCost as Z}from"../models.js";import{normalizeProviderError as ee}from"../utils/error-body.js";import{AssistantMessageEventStream as te}from"../utils/event-stream.js";import{providerHeadersToRecord as ne}from"../utils/headers.js";import{parseStreamingJson as H}from"../utils/json-parse.js";import{resolveHttpProxyUrlForTarget as re}from"../utils/node-http-proxy.js";import{getProviderEnvValue as f}from"../utils/provider-env.js";import{sanitizeSurrogates as _}from"../utils/sanitize-unicode.js";import{resolveJsonSchemaStrictSampling as oe}from"./constrained-sampling.js";import{adjustMaxTokensForThinking as ae,buildBaseOptions as se,clampMaxTokensToContext as ie,clampReasoning as ce}from"./simple-options.js";import{transformMessages as ue}from"./transform-messages.js";const B="<empty>";export const stream=c((e,n,t={})=>{const o=new te;return(async()=>{const r={role:"assistant",content:[],api:"bedrock-converse-stream",provider:e.provider,model:e.id,usage:{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()},a=r.content,u=t.profile||t.env?.AWS_PROFILE,s={profile:u||f("AWS_PROFILE",t.env)},i=K(t),d=!!f("AWS_PROFILE"),g=q(e.baseUrl),w=Ae(e.baseUrl,i,d);w&&(s.endpoint=e.baseUrl);const y=f("AWS_BEDROCK_SKIP_AUTH",t.env)==="1",A=t.bearerToken||t.apiKey||f("AWS_BEARER_TOKEN_BEDROCK",t.env)||void 0,F=A!==void 0&&!y;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun)){const h=e.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);h?s.region=h[1]:i?s.region=i:g&&w?s.region=g:d||(s.region="us-east-1"),y&&(s.credentials={accessKeyId:"dummy-access-key",secretAccessKey:"dummy-secret-key"});const p=ve(t.env);!y&&p&&!u&&(s.credentials=p);const m=re(e.baseUrl,t.env);m?s.requestHandler=new W({httpAgent:new Y(m),httpsAgent:new Q(m)}):f("AWS_BEDROCK_FORCE_HTTP1",t.env)==="1"&&(s.requestHandler=new W)}else s.region=i||(g&&w?g:void 0)||"us-east-1";F&&(s.token={token:A},s.authSchemePreference=["httpBearerAuth"]);try{const h=new X(s),p=ne(t.headers);p&&he(h,p);const m=Ce(t.cacheRetention,t.env),U=t.maxTokens??(C(e)?e.maxTokens:void 0);let b={modelId:e.id,messages:_e(n,e,m,t.env),system:we(n.systemPrompt,e,m,t.env),inferenceConfig:{...U!==void 0&&{maxTokens:U},...t.temperature!==void 0&&{temperature:t.temperature}},toolConfig:Be(n.tools,t.toolChoice,e.compat?.supportsStrictMode??!1),additionalModelRequestFields:Oe(e,t),...t.requestMetadata!==void 0&&{requestMetadata:t.requestMetadata}};const O=await t?.onPayload?.(b,e);O!==void 0&&(b=O);const $=new V(b),k=await h.send($,{abortSignal:t.signal});if(k.$metadata.httpStatusCode!==void 0){const l={};k.$metadata.requestId&&(l["x-amzn-requestid"]=k.$metadata.requestId),await t?.onResponse?.({status:k.$metadata.httpStatusCode,headers:l},e)}for await(const l of k.stream)if(l.messageStart){if(l.messageStart.role!==x.ASSISTANT)throw new Error("Unexpected assistant message start but got user message start instead");o.push({type:"start",partial:r})}else if(l.contentBlockStart)me(l.contentBlockStart,a,r,o);else if(l.contentBlockDelta)ke(l.contentBlockDelta,a,r,o);else if(l.contentBlockStop)xe(l.contentBlockStop,a,r,o);else if(l.messageStop){r.rawStopReason=l.messageStop.stopReason;const{stopReason:J,errorMessage:M}=Ie(l.messageStop.stopReason);r.stopReason=J,M&&(r.errorMessage=M)}else if(l.metadata)Ee(l.metadata,e,r);else{if(l.internalServerException)throw l.internalServerException;if(l.modelStreamErrorException)throw l.modelStreamErrorException;if(l.validationException)throw l.validationException;if(l.throttlingException)throw l.throttlingException;if(l.serviceUnavailableException)throw l.serviceUnavailableException}if(t.signal?.aborted)throw new Error("Request was aborted");if(r.stopReason==="pending")throw new Error("Bedrock stream ended without a stop reason");if(r.stopReason==="error"||r.stopReason==="aborted")throw new Error(r.errorMessage||"An unknown error occurred");o.push({type:"done",reason:r.stopReason,message:r}),o.end()}catch(h){for(const p of r.content)delete p.index,delete p.partialJson;r.stopReason=t.signal?.aborted?"aborted":"error",r.errorMessage=ge(h),o.push({type:"error",reason:r.stopReason,error:r}),o.end()}})(),o},"stream");const de={InternalServerException:"Internal server error",ModelStreamErrorException:"Model stream error",ValidationException:"Validation error",ThrottlingException:"Throttling error",ServiceUnavailableException:"Service unavailable"},le="https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html";function ge(e){const n=ee(e),t=!n.messageCarriesBody&&n.status!==void 0&&n.body!==void 0?`${n.status}: ${n.body}`:n.message,o=/data retention mode/i.test(t)?` See ${le} for supported data retention modes.`:"";return e instanceof G?`${de[e.name]??e.name}: ${t}${o}`:`${t}${o}`}c(ge,"formatBedrockError");const fe=new Set(["authorization","host"]);function pe(e){const n=e.toLowerCase();return n.startsWith("x-amz-")||fe.has(n)}c(pe,"isReservedHeader");function he(e,n){const t=c(o=>async r=>{const a=r.request;if(a&&typeof a=="object"&&"headers"in a){const u=a.headers;for(const[s,i]of Object.entries(n))pe(s)||(u[s]=i)}return o(r)},"middleware");e.middlewareStack.add(t,{step:"build",name:"pi-ai-custom-headers",priority:"low"})}c(he,"addCustomHeadersMiddleware");export const streamSimple=c((e,n,t)=>{const o=se(e,n,t,void 0);if(!t?.reasoning)return stream(e,n,{...o,reasoning:void 0});if(C(e)){if(v(e.id,e.name))return stream(e,n,{...o,reasoning:t.reasoning,thinkingBudgets:t.thinkingBudgets});const r=ae(o.maxTokens,e.maxTokens,t.reasoning,t.thinkingBudgets),a=ie(e,n,r.maxTokens);return stream(e,n,{...o,maxTokens:a,reasoning:t.reasoning,thinkingBudgets:{...t.thinkingBudgets||{},[ce(t.reasoning)]:Math.min(r.thinkingBudget,Math.max(0,a-1024))}})}return stream(e,n,{...o,reasoning:t.reasoning,thinkingBudgets:t.thinkingBudgets})},"streamSimple");function me(e,n,t,o){const r=e.contentBlockIndex,a=e.start;if(a?.toolUse){const u={type:"toolCall",id:a.toolUse.toolUseId||"",name:a.toolUse.name||"",arguments:{},partialJson:"",index:r};t.content.push(u),o.push({type:"toolcall_start",contentIndex:n.length-1,partial:t})}}c(me,"handleContentBlockStart");function ke(e,n,t,o){const r=e.contentBlockIndex,a=e.delta;let u=n.findIndex(i=>i.index===r),s=n[u];if(a?.text!==void 0){if(!s){const i={type:"text",text:"",index:r};t.content.push(i),u=n.length-1,s=n[u],o.push({type:"text_start",contentIndex:u,partial:t})}s.type==="text"&&(s.text+=a.text,o.push({type:"text_delta",contentIndex:u,delta:a.text,partial:t}))}else if(a?.toolUse&&s?.type==="toolCall")s.partialJson=(s.partialJson||"")+(a.toolUse.input||""),s.arguments=H(s.partialJson),o.push({type:"toolcall_delta",contentIndex:u,delta:a.toolUse.input||"",partial:t});else if(a?.reasoningContent){let i=s,d=u;if(!i){const g={type:"thinking",thinking:"",thinkingSignature:"",index:r};t.content.push(g),d=n.length-1,i=n[d],o.push({type:"thinking_start",contentIndex:d,partial:t})}i?.type==="thinking"&&(a.reasoningContent.text&&(i.thinking+=a.reasoningContent.text,o.push({type:"thinking_delta",contentIndex:d,delta:a.reasoningContent.text,partial:t})),a.reasoningContent.signature&&(i.thinkingSignature=(i.thinkingSignature||"")+a.reasoningContent.signature))}}c(ke,"handleContentBlockDelta");function Ee(e,n,t){e.usage&&(t.usage.input=e.usage.inputTokens||0,t.usage.output=e.usage.outputTokens||0,t.usage.cacheRead=e.usage.cacheReadInputTokens||0,t.usage.cacheWrite=e.usage.cacheWriteInputTokens||0,t.usage.totalTokens=e.usage.totalTokens||t.usage.input+t.usage.output,Z(n,t.usage))}c(Ee,"handleMetadata");function xe(e,n,t,o){const r=n.findIndex(u=>u.index===e.contentBlockIndex),a=n[r];if(a)switch(delete a.index,a.type){case"text":o.push({type:"text_end",contentIndex:r,content:a.text,partial:t});break;case"thinking":o.push({type:"thinking_end",contentIndex:r,content:a.thinking,partial:t});break;case"toolCall":a.arguments=H(a.partialJson),delete a.partialJson,o.push({type:"toolcall_end",contentIndex:r,toolCall:a,partial:t});break}}c(xe,"handleContentBlockStop");function I(e,n){return(n?[e,n]:[e]).flatMap(o=>{const r=o.toLowerCase();return[r,r.replace(/[\s_.:]+/g,"-")]})}c(I,"getModelMatchCandidates");function v(e,n){return I(e,n).some(o=>o.includes("opus-4-6")||o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-4-6")||o.includes("sonnet-5")||o.includes("fable-5"))}c(v,"supportsAdaptiveThinking");function Se(e){return I(e.id,e.name).some(t=>t.includes("opus-4-7")||t.includes("opus-4-8")||t.includes("opus-5")||t.includes("sonnet-5")||t.includes("fable-5"))}c(Se,"supportsNativeXhighEffort");function Re(e,n){if(n==="xhigh"&&Se(e))return"xhigh";const t=n?e.thinkingLevelMap?.[n]:void 0;if(typeof t=="string")return t;switch(n){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}c(Re,"mapThinkingLevelToEffort");function Ce(e,n){return e||(f("PI_CACHE_RETENTION",n)==="long"?"long":"short")}c(Ce,"resolveCacheRetention");function C(e){const n=e.id.toLowerCase(),t=e.name?.toLowerCase()??"";return n.includes("anthropic.claude")||n.includes("anthropic/claude")||t.includes("anthropic.claude")||t.includes("anthropic/claude")||t.includes("claude")}c(C,"isAnthropicClaudeModel");function L(e,n){const t=I(e.id,e.name);return t.some(r=>r.includes("claude"))?!!(t.some(r=>r.includes("fable-5")||r.includes("opus-5")||r.includes("sonnet-5"))||t.some(r=>r.includes("-4-"))||t.some(r=>r.includes("claude-3-7-sonnet"))||t.some(r=>r.includes("claude-3-5-haiku"))):f("AWS_BEDROCK_FORCE_CACHE",n)==="1"}c(L,"supportsPromptCaching");function Te(e){return C(e)}c(Te,"supportsThinkingSignature");function we(e,n,t,o){if(!e)return;const r=[{text:_(e)}];return t!=="none"&&L(n,o)&&r.push({cachePoint:{type:P.DEFAULT,...t==="long"?{ttl:D.ONE_HOUR}:{}}}),r}c(we,"buildSystemPrompt");function ye(e){const n=e.replace(/[^a-zA-Z0-9_-]/g,"_");return n.length>64?n.slice(0,64):n}c(ye,"normalizeToolCallId");function T(e){const n=_(e);return n.trim().length===0?void 0:{text:n}}c(T,"createNonBlankTextBlock");function be(e){return T(e)??{text:B}}c(be,"createRequiredTextBlock");function N(e){const n=[];for(const t of e)if(t.type==="image")n.push({image:z(t.mimeType,t.data)});else{const o=T(t.text);o&&n.push(o)}return n.length===0&&n.push({text:B}),n}c(N,"convertToolResultContent");function _e(e,n,t,o){const r=[],a=ue(e.messages,n,ye);for(let u=0;u<a.length;u++){const s=a[u];switch(s.role){case"user":{const i=[];if(typeof s.content=="string")i.push(be(s.content));else{for(const d of s.content)switch(d.type){case"text":{const g=T(d.text);g&&i.push(g);break}case"image":i.push({image:z(d.mimeType,d.data)});break;default:continue}i.length===0&&i.push({text:B})}r.push({role:x.USER,content:i});break}case"assistant":{if(s.content.length===0)continue;const i=[];for(const d of s.content)switch(d.type){case"text":{const g=T(d.text);if(!g)continue;i.push(g);break}case"toolCall":i.push({toolUse:{toolUseId:d.id,name:d.name,input:d.arguments}});break;case"thinking":{const g=_(d.thinking);if(g.trim().length===0)continue;Te(n)?!d.thinkingSignature||d.thinkingSignature.trim().length===0?i.push({text:g}):i.push({reasoningContent:{reasoningText:{text:g,signature:d.thinkingSignature}}}):i.push({reasoningContent:{reasoningText:{text:g}}});break}default:continue}if(i.length===0)continue;r.push({role:x.ASSISTANT,content:i});break}case"toolResult":{const i=[];i.push({toolResult:{toolUseId:s.toolCallId,content:N(s.content),status:s.isError?R.ERROR:R.SUCCESS}});let d=u+1;for(;d<a.length&&a[d].role==="toolResult";){const g=a[d];i.push({toolResult:{toolUseId:g.toolCallId,content:N(g.content),status:g.isError?R.ERROR:R.SUCCESS}}),d++}u=d-1,r.push({role:x.USER,content:i});break}default:continue}}if(t!=="none"&&L(n,o)&&r.length>0){const u=r[r.length-1];u.role===x.USER&&u.content&&u.content.push({cachePoint:{type:P.DEFAULT,...t==="long"?{ttl:D.ONE_HOUR}:{}}})}return r}c(_e,"convertMessages");function Be(e,n,t){if(!e?.length||n==="none")return;const o=e.map(a=>{const u=oe(a,t);return{toolSpec:{name:a.name,description:a.description,inputSchema:{json:a.parameters},...u===!0?{strict:!0}:{}}}});let r;switch(n){case"auto":r={auto:{}};break;case"any":r={any:{}};break;default:n?.type==="tool"&&(r={tool:{name:n.name}})}return{tools:o,toolChoice:r}}c(Be,"convertToolConfig");function Ie(e){switch(e){case E.END_TURN:case E.STOP_SEQUENCE:return{stopReason:"stop"};case E.MAX_TOKENS:case E.MODEL_CONTEXT_WINDOW_EXCEEDED:return{stopReason:"length"};case E.TOOL_USE:return{stopReason:"toolUse"};default:return e?{stopReason:"error",errorMessage:`Provider stopped with: ${e}`}:{stopReason:"error"}}}c(Ie,"mapStopReason");function K(e){return e.region||f("AWS_REGION",e.env)||f("AWS_DEFAULT_REGION",e.env)||void 0}c(K,"getConfiguredBedrockRegion");function ve(e){const n=f("AWS_ACCESS_KEY_ID",e),t=f("AWS_SECRET_ACCESS_KEY",e);if(!n||!t)return;const o=f("AWS_SESSION_TOKEN",e);return{accessKeyId:n,secretAccessKey:t,...o?{sessionToken:o}:{}}}c(ve,"getConfiguredBedrockCredentials");function q(e){if(e)try{const{hostname:n}=new URL(e);return n.toLowerCase().match(/^bedrock-runtime(?:-fips)?\.([a-z0-9-]+)\.amazonaws\.com(?:\.cn)?$/)?.[1]}catch{return}}c(q,"getStandardBedrockEndpointRegion");function Ae(e,n,t){return q(e)?!n&&!t:!0}c(Ae,"shouldUseExplicitBedrockEndpoint");function Ue(e,n){if(K(n)?.toLowerCase().startsWith("us-gov-"))return!0;const o=e.id.toLowerCase();return o.startsWith("us-gov.")||o.startsWith("arn:aws-us-gov:")}c(Ue,"isGovCloudBedrockTarget");function Oe(e,n){if(!(!n.reasoning||!e.reasoning)&&C(e)){const t=Ue(e,n)?void 0:n.thinkingDisplay??"summarized",o=v(e.id,e.name)?{thinking:{type:"adaptive",...t!==void 0?{display:t}:{}},output_config:{effort:Re(e,n.reasoning)}}:(()=>{const r={minimal:1024,low:2048,medium:8192,high:16384,xhigh:16384,max:16384},a=n.reasoning==="xhigh"||n.reasoning==="max"?"high":n.reasoning;return{thinking:{type:"enabled",budget_tokens:n.thinkingBudgets?.[a]??r[n.reasoning],...t!==void 0?{display:t}:{}}}})();return!v(e.id,e.name)&&(n.interleavedThinking??!0)&&(o.anthropic_beta=["interleaved-thinking-2025-05-14"]),o}}c(Oe,"buildAdditionalModelRequestFields");function z(e,n){let t;switch(e){case"image/jpeg":case"image/jpg":t=S.JPEG;break;case"image/png":t=S.PNG;break;case"image/gif":t=S.GIF;break;case"image/webp":t=S.WEBP;break;default:throw new Error(`Unknown image type: ${e}`)}const o=atob(n),r=new Uint8Array(o.length);for(let a=0;a<o.length;a++)r[a]=o.charCodeAt(a);return{source:{bytes:r},format:t}}c(z,"createImageBlock");
1
+ var J=Object.defineProperty;var c=(e,n)=>J(e,"name",{value:n,configurable:!0});import{BedrockRuntimeClient as j,BedrockRuntimeServiceException as X,StopReason as E,CachePointType as O,CacheTTL as D,ConversationRole as x,ConverseStreamCommand as G,ImageFormat as S,ToolResultStatus as R}from"@aws-sdk/client-bedrock-runtime";import{NodeHttpHandler as P}from"@smithy/node-http-handler";import{HttpProxyAgent as V}from"http-proxy-agent";import{HttpsProxyAgent as Y}from"https-proxy-agent";import{calculateCost as Q}from"../models.js";import{normalizeProviderError as Z}from"../utils/error-body.js";import{AssistantMessageEventStream as ee}from"../utils/event-stream.js";import{providerHeadersToRecord as te}from"../utils/headers.js";import{parseStreamingJson as H}from"../utils/json-parse.js";import{resolveHttpProxyUrlForTarget as ne}from"../utils/node-http-proxy.js";import{getProviderEnvValue as f}from"../utils/provider-env.js";import{sanitizeSurrogates as b}from"../utils/sanitize-unicode.js";import{resolveJsonSchemaStrictSampling as re}from"./constrained-sampling.js";import{adjustMaxTokensForThinking as ae,buildBaseOptions as oe,clampMaxTokensToContext as se,clampReasoning as ie}from"./simple-options.js";import{transformMessages as ce}from"./transform-messages.js";const _="<empty>";export const stream=c((e,n,t={})=>{const a=new ee;return(async()=>{const r={role:"assistant",content:[],api:"bedrock-converse-stream",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()},o=r.content,s={profile:t.profile||f("AWS_PROFILE",t.env)},d=L(t),i=!!f("AWS_PROFILE"),u=K(e.baseUrl),g=ve(e.baseUrl,d,i);g&&(s.endpoint=e.baseUrl);const y=f("AWS_BEDROCK_SKIP_AUTH",t.env)==="1",v=t.bearerToken||t.apiKey||f("AWS_BEARER_TOKEN_BEDROCK",t.env)||void 0,z=v!==void 0&&!y;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun)){const h=e.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);h?s.region=h[1]:d?s.region=d:u&&g?s.region=u:i||(s.region="us-east-1"),y&&(s.credentials={accessKeyId:"dummy-access-key",secretAccessKey:"dummy-secret-key"});const p=Ie(t.env);!y&&p&&(s.credentials=p);const m=ne(e.baseUrl,t.env);m?s.requestHandler=new P({httpAgent:new V(m),httpsAgent:new Y(m)}):f("AWS_BEDROCK_FORCE_HTTP1",t.env)==="1"&&(s.requestHandler=new P)}else s.region=d||(u&&g?u:void 0)||"us-east-1";z&&(s.token={token:v},s.authSchemePreference=["httpBearerAuth"]);try{const h=new j(s),p=te(t.headers);p&&pe(h,p);const m=Re(t.cacheRetention,t.env),A=t.maxTokens??(C(e)?e.maxTokens:void 0);let w={modelId:e.id,messages:be(n,e,m,t.env),system:Te(n.systemPrompt,e,m,t.env),inferenceConfig:{...A!==void 0&&{maxTokens:A},...t.temperature!==void 0&&{temperature:t.temperature}},toolConfig:_e(n.tools,t.toolChoice,e.compat?.supportsStrictMode??!1),additionalModelRequestFields:Ue(e,t),...t.requestMetadata!==void 0&&{requestMetadata:t.requestMetadata}};const U=await t?.onPayload?.(w,e);U!==void 0&&(w=U);const F=new G(w),k=await h.send(F,{abortSignal:t.signal});if(k.$metadata.httpStatusCode!==void 0){const l={};k.$metadata.requestId&&(l["x-amzn-requestid"]=k.$metadata.requestId),await t?.onResponse?.({status:k.$metadata.httpStatusCode,headers:l},e)}for await(const l of k.stream)if(l.messageStart){if(l.messageStart.role!==x.ASSISTANT)throw new Error("Unexpected assistant message start but got user message start instead");a.push({type:"start",partial:r})}else if(l.contentBlockStart)he(l.contentBlockStart,o,r,a);else if(l.contentBlockDelta)me(l.contentBlockDelta,o,r,a);else if(l.contentBlockStop)Ee(l.contentBlockStop,o,r,a);else if(l.messageStop){const{stopReason:$,errorMessage:M}=Be(l.messageStop.stopReason);r.stopReason=$,M&&(r.errorMessage=M)}else if(l.metadata)ke(l.metadata,e,r);else{if(l.internalServerException)throw l.internalServerException;if(l.modelStreamErrorException)throw l.modelStreamErrorException;if(l.validationException)throw l.validationException;if(l.throttlingException)throw l.throttlingException;if(l.serviceUnavailableException)throw l.serviceUnavailableException}if(t.signal?.aborted)throw new Error("Request was aborted");if(r.stopReason==="error"||r.stopReason==="aborted")throw new Error(r.errorMessage||"An unknown error occurred");a.push({type:"done",reason:r.stopReason,message:r}),a.end()}catch(h){for(const p of r.content)delete p.index,delete p.partialJson;r.stopReason=t.signal?.aborted?"aborted":"error",r.errorMessage=le(h),a.push({type:"error",reason:r.stopReason,error:r}),a.end()}})(),a},"stream");const ue={InternalServerException:"Internal server error",ModelStreamErrorException:"Model stream error",ValidationException:"Validation error",ThrottlingException:"Throttling error",ServiceUnavailableException:"Service unavailable"},de="https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html";function le(e){const n=Z(e),t=!n.messageCarriesBody&&n.status!==void 0&&n.body!==void 0?`${n.status}: ${n.body}`:n.message,a=/data retention mode/i.test(t)?` See ${de} for supported data retention modes.`:"";return e instanceof X?`${ue[e.name]??e.name}: ${t}${a}`:`${t}${a}`}c(le,"formatBedrockError");const ge=new Set(["authorization","host"]);function fe(e){const n=e.toLowerCase();return n.startsWith("x-amz-")||ge.has(n)}c(fe,"isReservedHeader");function pe(e,n){const t=c(a=>async r=>{const o=r.request;if(o&&typeof o=="object"&&"headers"in o){const s=o.headers;for(const[d,i]of Object.entries(n))fe(d)||(s[d]=i)}return a(r)},"middleware");e.middlewareStack.add(t,{step:"build",name:"pi-ai-custom-headers",priority:"low"})}c(pe,"addCustomHeadersMiddleware");export const streamSimple=c((e,n,t)=>{const a=oe(e,n,t,void 0);if(!t?.reasoning)return stream(e,n,{...a,reasoning:void 0});if(C(e)){if(I(e.id,e.name))return stream(e,n,{...a,reasoning:t.reasoning,thinkingBudgets:t.thinkingBudgets});const r=ae(a.maxTokens,e.maxTokens,t.reasoning,t.thinkingBudgets),o=se(e,n,r.maxTokens);return stream(e,n,{...a,maxTokens:o,reasoning:t.reasoning,thinkingBudgets:{...t.thinkingBudgets||{},[ie(t.reasoning)]:Math.min(r.thinkingBudget,Math.max(0,o-1024))}})}return stream(e,n,{...a,reasoning:t.reasoning,thinkingBudgets:t.thinkingBudgets})},"streamSimple");function he(e,n,t,a){const r=e.contentBlockIndex,o=e.start;if(o?.toolUse){const s={type:"toolCall",id:o.toolUse.toolUseId||"",name:o.toolUse.name||"",arguments:{},partialJson:"",index:r};t.content.push(s),a.push({type:"toolcall_start",contentIndex:n.length-1,partial:t})}}c(he,"handleContentBlockStart");function me(e,n,t,a){const r=e.contentBlockIndex,o=e.delta;let s=n.findIndex(i=>i.index===r),d=n[s];if(o?.text!==void 0){if(!d){const i={type:"text",text:"",index:r};t.content.push(i),s=n.length-1,d=n[s],a.push({type:"text_start",contentIndex:s,partial:t})}d.type==="text"&&(d.text+=o.text,a.push({type:"text_delta",contentIndex:s,delta:o.text,partial:t}))}else if(o?.toolUse&&d?.type==="toolCall")d.partialJson=(d.partialJson||"")+(o.toolUse.input||""),d.arguments=H(d.partialJson),a.push({type:"toolcall_delta",contentIndex:s,delta:o.toolUse.input||"",partial:t});else if(o?.reasoningContent){let i=d,u=s;if(!i){const g={type:"thinking",thinking:"",thinkingSignature:"",index:r};t.content.push(g),u=n.length-1,i=n[u],a.push({type:"thinking_start",contentIndex:u,partial:t})}i?.type==="thinking"&&(o.reasoningContent.text&&(i.thinking+=o.reasoningContent.text,a.push({type:"thinking_delta",contentIndex:u,delta:o.reasoningContent.text,partial:t})),o.reasoningContent.signature&&(i.thinkingSignature=(i.thinkingSignature||"")+o.reasoningContent.signature))}}c(me,"handleContentBlockDelta");function ke(e,n,t){e.usage&&(t.usage.input=e.usage.inputTokens||0,t.usage.output=e.usage.outputTokens||0,t.usage.cacheRead=e.usage.cacheReadInputTokens||0,t.usage.cacheWrite=e.usage.cacheWriteInputTokens||0,t.usage.totalTokens=e.usage.totalTokens||t.usage.input+t.usage.output,Q(n,t.usage))}c(ke,"handleMetadata");function Ee(e,n,t,a){const r=n.findIndex(s=>s.index===e.contentBlockIndex),o=n[r];if(o)switch(delete o.index,o.type){case"text":a.push({type:"text_end",contentIndex:r,content:o.text,partial:t});break;case"thinking":a.push({type:"thinking_end",contentIndex:r,content:o.thinking,partial:t});break;case"toolCall":o.arguments=H(o.partialJson),delete o.partialJson,a.push({type:"toolcall_end",contentIndex:r,toolCall:o,partial:t});break}}c(Ee,"handleContentBlockStop");function B(e,n){return(n?[e,n]:[e]).flatMap(a=>{const r=a.toLowerCase();return[r,r.replace(/[\s_.:]+/g,"-")]})}c(B,"getModelMatchCandidates");function I(e,n){return B(e,n).some(a=>a.includes("opus-4-6")||a.includes("opus-4-7")||a.includes("opus-4-8")||a.includes("opus-5")||a.includes("sonnet-4-6")||a.includes("sonnet-5")||a.includes("fable-5"))}c(I,"supportsAdaptiveThinking");function xe(e){return B(e.id,e.name).some(t=>t.includes("opus-4-7")||t.includes("opus-4-8")||t.includes("opus-5")||t.includes("sonnet-5")||t.includes("fable-5"))}c(xe,"supportsNativeXhighEffort");function Se(e,n){if(n==="xhigh"&&xe(e))return"xhigh";const t=n?e.thinkingLevelMap?.[n]:void 0;if(typeof t=="string")return t;switch(n){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}c(Se,"mapThinkingLevelToEffort");function Re(e,n){return e||(f("PI_CACHE_RETENTION",n)==="long"?"long":"short")}c(Re,"resolveCacheRetention");function C(e){const n=e.id.toLowerCase(),t=e.name?.toLowerCase()??"";return n.includes("anthropic.claude")||n.includes("anthropic/claude")||t.includes("anthropic.claude")||t.includes("anthropic/claude")||t.includes("claude")}c(C,"isAnthropicClaudeModel");function N(e,n){const t=B(e.id,e.name);return t.some(r=>r.includes("claude"))?!!(t.some(r=>r.includes("fable-5")||r.includes("opus-5")||r.includes("sonnet-5"))||t.some(r=>r.includes("-4-"))||t.some(r=>r.includes("claude-3-7-sonnet"))||t.some(r=>r.includes("claude-3-5-haiku"))):f("AWS_BEDROCK_FORCE_CACHE",n)==="1"}c(N,"supportsPromptCaching");function Ce(e){return C(e)}c(Ce,"supportsThinkingSignature");function Te(e,n,t,a){if(!e)return;const r=[{text:b(e)}];return t!=="none"&&N(n,a)&&r.push({cachePoint:{type:O.DEFAULT,...t==="long"?{ttl:D.ONE_HOUR}:{}}}),r}c(Te,"buildSystemPrompt");function ye(e){const n=e.replace(/[^a-zA-Z0-9_-]/g,"_");return n.length>64?n.slice(0,64):n}c(ye,"normalizeToolCallId");function T(e){const n=b(e);return n.trim().length===0?void 0:{text:n}}c(T,"createNonBlankTextBlock");function we(e){return T(e)??{text:_}}c(we,"createRequiredTextBlock");function W(e){const n=[];for(const t of e)if(t.type==="image")n.push({image:q(t.mimeType,t.data)});else{const a=T(t.text);a&&n.push(a)}return n.length===0&&n.push({text:_}),n}c(W,"convertToolResultContent");function be(e,n,t,a){const r=[],o=ce(e.messages,n,ye);for(let s=0;s<o.length;s++){const d=o[s];switch(d.role){case"user":{const i=[];if(typeof d.content=="string")i.push(we(d.content));else{for(const u of d.content)switch(u.type){case"text":{const g=T(u.text);g&&i.push(g);break}case"image":i.push({image:q(u.mimeType,u.data)});break;default:continue}i.length===0&&i.push({text:_})}r.push({role:x.USER,content:i});break}case"assistant":{if(d.content.length===0)continue;const i=[];for(const u of d.content)switch(u.type){case"text":{const g=T(u.text);if(!g)continue;i.push(g);break}case"toolCall":i.push({toolUse:{toolUseId:u.id,name:u.name,input:u.arguments}});break;case"thinking":{const g=b(u.thinking);if(g.trim().length===0)continue;Ce(n)?!u.thinkingSignature||u.thinkingSignature.trim().length===0?i.push({text:g}):i.push({reasoningContent:{reasoningText:{text:g,signature:u.thinkingSignature}}}):i.push({reasoningContent:{reasoningText:{text:g}}});break}default:continue}if(i.length===0)continue;r.push({role:x.ASSISTANT,content:i});break}case"toolResult":{const i=[];i.push({toolResult:{toolUseId:d.toolCallId,content:W(d.content),status:d.isError?R.ERROR:R.SUCCESS}});let u=s+1;for(;u<o.length&&o[u].role==="toolResult";){const g=o[u];i.push({toolResult:{toolUseId:g.toolCallId,content:W(g.content),status:g.isError?R.ERROR:R.SUCCESS}}),u++}s=u-1,r.push({role:x.USER,content:i});break}default:continue}}if(t!=="none"&&N(n,a)&&r.length>0){const s=r[r.length-1];s.role===x.USER&&s.content&&s.content.push({cachePoint:{type:O.DEFAULT,...t==="long"?{ttl:D.ONE_HOUR}:{}}})}return r}c(be,"convertMessages");function _e(e,n,t){if(!e?.length||n==="none")return;const a=e.map(o=>{const s=re(o,t);return{toolSpec:{name:o.name,description:o.description,inputSchema:{json:o.parameters},...s===!0?{strict:!0}:{}}}});let r;switch(n){case"auto":r={auto:{}};break;case"any":r={any:{}};break;default:n?.type==="tool"&&(r={tool:{name:n.name}})}return{tools:a,toolChoice:r}}c(_e,"convertToolConfig");function Be(e){switch(e){case E.END_TURN:case E.STOP_SEQUENCE:return{stopReason:"stop"};case E.MAX_TOKENS:case E.MODEL_CONTEXT_WINDOW_EXCEEDED:return{stopReason:"length"};case E.TOOL_USE:return{stopReason:"toolUse"};default:return e?{stopReason:"error",errorMessage:e}:{stopReason:"error"}}}c(Be,"mapStopReason");function L(e){return e.region||f("AWS_REGION",e.env)||f("AWS_DEFAULT_REGION",e.env)||void 0}c(L,"getConfiguredBedrockRegion");function Ie(e){const n=f("AWS_ACCESS_KEY_ID",e),t=f("AWS_SECRET_ACCESS_KEY",e);if(!n||!t)return;const a=f("AWS_SESSION_TOKEN",e);return{accessKeyId:n,secretAccessKey:t,...a?{sessionToken:a}:{}}}c(Ie,"getConfiguredBedrockCredentials");function K(e){if(e)try{const{hostname:n}=new URL(e);return n.toLowerCase().match(/^bedrock-runtime(?:-fips)?\.([a-z0-9-]+)\.amazonaws\.com(?:\.cn)?$/)?.[1]}catch{return}}c(K,"getStandardBedrockEndpointRegion");function ve(e,n,t){return K(e)?!n&&!t:!0}c(ve,"shouldUseExplicitBedrockEndpoint");function Ae(e,n){if(L(n)?.toLowerCase().startsWith("us-gov-"))return!0;const a=e.id.toLowerCase();return a.startsWith("us-gov.")||a.startsWith("arn:aws-us-gov:")}c(Ae,"isGovCloudBedrockTarget");function Ue(e,n){if(!(!n.reasoning||!e.reasoning)&&C(e)){const t=Ae(e,n)?void 0:n.thinkingDisplay??"summarized",a=I(e.id,e.name)?{thinking:{type:"adaptive",...t!==void 0?{display:t}:{}},output_config:{effort:Se(e,n.reasoning)}}:(()=>{const r={minimal:1024,low:2048,medium:8192,high:16384,xhigh:16384,max:16384},o=n.reasoning==="xhigh"||n.reasoning==="max"?"high":n.reasoning;return{thinking:{type:"enabled",budget_tokens:n.thinkingBudgets?.[o]??r[n.reasoning],...t!==void 0?{display:t}:{}}}})();return!I(e.id,e.name)&&(n.interleavedThinking??!0)&&(a.anthropic_beta=["interleaved-thinking-2025-05-14"]),a}}c(Ue,"buildAdditionalModelRequestFields");function q(e,n){let t;switch(e){case"image/jpeg":case"image/jpg":t=S.JPEG;break;case"image/png":t=S.PNG;break;case"image/gif":t=S.GIF;break;case"image/webp":t=S.WEBP;break;default:throw new Error(`Unknown image type: ${e}`)}const a=atob(n),r=new Uint8Array(a.length);for(let o=0;o<a.length;o++)r[o]=a.charCodeAt(o);return{source:{bytes:r},format:t}}c(q,"createImageBlock");
@@ -1 +1 @@
1
- var M=Object.defineProperty;var g=(t,a)=>M(t,"name",{value:a,configurable:!0});import{GoogleGenAI as v}from"@google/genai";import{calculateCost as T,clampThinkingLevel as R}from"../models.js";import{formatProviderError as S,normalizeProviderError as L}from"../utils/error-body.js";import{AssistantMessageEventStream as _}from"../utils/event-stream.js";import{providerHeadersToRecord as G}from"../utils/headers.js";import{sanitizeSurrogates as P}from"../utils/sanitize-unicode.js";import{convertMessages as E,convertTools as A,isThinkingPart as O,mapStopReason as N,resolveGoogleFunctionCallingMode as H,retainThoughtSignature as I,supportsGoogleStrictToolSampling as W}from"./google-shared.js";import{buildBaseOptions as $}from"./simple-options.js";let B=0;export const stream=g((t,a,n)=>{const i=new _;return(async()=>{const e={role:"assistant",content:[],api:"google-generative-ai",provider:t.provider,model:t.id,usage:{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(n?.fetch&&n.fetch!==globalThis.fetch)throw new Error("Custom fetch is not supported by the Google Generative AI adapter");const d=n?.apiKey;if(!d)throw new Error(`No API key for provider: ${t.provider}`);const s=U(t,d,n?.headers);let c=D(t,a,n);const p=await n?.onPayload?.(c,t);p!==void 0&&(c=p);const x=await s.models.generateContentStream(c);i.push({type:"start",partial:e});let o=null;const w=e.content,u=g(()=>w.length-1,"blockIndex");for await(const l of x){e.responseId||=l.responseId;const f=l.candidates?.[0];if(f?.content?.parts)for(const r of f.content.parts){if(r.text!==void 0){const h=O(r);(!o||h&&o.type!=="thinking"||!h&&o.type!=="text")&&(o&&(o.type==="text"?i.push({type:"text_end",contentIndex:w.length-1,content:o.text,partial:e}):i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:e})),h?(o={type:"thinking",thinking:"",thinkingSignature:void 0},e.content.push(o),i.push({type:"thinking_start",contentIndex:u(),partial:e})):(o={type:"text",text:""},e.content.push(o),i.push({type:"text_start",contentIndex:u(),partial:e}))),o.type==="thinking"?(o.thinking+=r.text,o.thinkingSignature=I(o.thinkingSignature,r.thoughtSignature),i.push({type:"thinking_delta",contentIndex:u(),delta:r.text,partial:e})):(o.text+=r.text,o.textSignature=I(o.textSignature,r.thoughtSignature),i.push({type:"text_delta",contentIndex:u(),delta:r.text,partial:e}))}if(r.functionCall){o&&(o.type==="text"?i.push({type:"text_end",contentIndex:u(),content:o.text,partial:e}):i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:e}),o=null);const h=r.functionCall.id,m={type:"toolCall",id:!h||e.content.some(C=>C.type==="toolCall"&&C.id===h)?`${r.functionCall.name}_${Date.now()}_${++B}`:h,name:r.functionCall.name||"",arguments:r.functionCall.args??{},...r.thoughtSignature&&{thoughtSignature:r.thoughtSignature}};e.content.push(m),i.push({type:"toolcall_start",contentIndex:u(),partial:e}),i.push({type:"toolcall_delta",contentIndex:u(),delta:JSON.stringify(m.arguments),partial:e}),i.push({type:"toolcall_end",contentIndex:u(),toolCall:m,partial:e})}}f?.finishReason&&(e.rawStopReason=f.finishReason,e.stopReason=N(f.finishReason),e.content.some(r=>r.type==="toolCall")&&(e.stopReason="toolUse")),l.usageMetadata&&(e.usage={input:(l.usageMetadata.promptTokenCount||0)-(l.usageMetadata.cachedContentTokenCount||0),output:(l.usageMetadata.candidatesTokenCount||0)+(l.usageMetadata.thoughtsTokenCount||0),cacheRead:l.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:l.usageMetadata.thoughtsTokenCount||0,totalTokens:l.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},T(t,e.usage))}if(o&&(o.type==="text"?i.push({type:"text_end",contentIndex:u(),content:o.text,partial:e}):i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:e})),n?.signal?.aborted)throw new Error("Request was aborted");if(e.stopReason==="pending")throw new Error("Google stream ended without a finish reason");if(e.stopReason==="aborted"||e.stopReason==="error"){const l=e.rawStopReason?`Provider stopped with: ${e.rawStopReason}`:"An unknown error occurred";throw new Error(l)}i.push({type:"done",reason:e.stopReason,message:e}),i.end()}catch(d){for(const s of e.content)"index"in s&&delete s.index;e.stopReason=n?.signal?.aborted?"aborted":"error",e.errorMessage=S(L(d)),i.push({type:"error",reason:e.stopReason,error:e}),i.end()}})(),i},"stream"),streamSimple=g((t,a,n)=>{const i=n?.apiKey;if(!i)throw new Error(`No API key for provider: ${t.provider}`);const e=$(t,a,n,i);if(!n?.reasoning)return stream(t,a,{...e,thinking:{enabled:!1}});const d=R(t,n.reasoning),s=d==="off"?"high":d,c=t;return y(c)||b(c)||k(c)?stream(t,a,{...e,thinking:{enabled:!0,level:j(s,c)}}):stream(t,a,{...e,thinking:{enabled:!0,budgetTokens:q(c,s,n.thinkingBudgets)}})},"streamSimple");function U(t,a,n){const i={};t.baseUrl&&(i.baseUrl=t.baseUrl,i.apiVersion="");const e=G({...t.headers,...n});return e&&(i.headers=e),new v({apiKey:a,httpOptions:Object.keys(i).length>0?i:void 0})}g(U,"createClient");function D(t,a,n={}){const i=E(t,a),e={};n.temperature!==void 0&&(e.temperature=n.temperature),n.maxTokens!==void 0&&(e.maxOutputTokens=n.maxTokens);const d=a.tools?.length?H(a.tools,n.toolChoice,W(t.id)):void 0,s={...Object.keys(e).length>0&&e,...a.systemPrompt&&{systemInstruction:P(a.systemPrompt)},...a.tools&&a.tools.length>0&&{tools:A(a.tools)},...d!==void 0&&{toolConfig:{functionCallingConfig:{mode:d}}}};if(n.thinking?.enabled&&t.reasoning){const p={includeThoughts:!0};n.thinking.level!==void 0?p.thinkingLevel=n.thinking.level:n.thinking.budgetTokens!==void 0&&(p.thinkingBudget=n.thinking.budgetTokens),s.thinkingConfig=p}else t.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=K(t));if(n.signal){if(n.signal.aborted)throw new Error("Request aborted");s.abortSignal=n.signal}return{model:t.id,contents:i,config:s}}g(D,"buildParams");function k(t){return/gemma-?4/.test(t.id.toLowerCase())}g(k,"isGemma4Model");function y(t){return/gemini-3(?:\.\d+)?-pro/.test(t.id.toLowerCase())}g(y,"isGemini3ProModel");function b(t){const a=t.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(a)||a==="gemini-flash-latest"||a==="gemini-flash-lite-latest"}g(b,"isGemini3FlashModel");function K(t){return y(t)?{thinkingLevel:"LOW"}:b(t)?{thinkingLevel:"MINIMAL"}:k(t)?{thinkingLevel:"MINIMAL"}:{thinkingBudget:0}}g(K,"getDisabledThinkingConfig");function j(t,a){if(y(a))switch(t){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}if(k(a))switch(t){case"minimal":case"low":return"MINIMAL";case"medium":case"high":return"HIGH"}switch(t){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}g(j,"getThinkingLevel");function q(t,a,n){return n?.[a]!==void 0?n[a]:t.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[a]:t.id.includes("2.5-flash-lite")?{minimal:512,low:2048,medium:8192,high:24576}[a]:t.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[a]:-1}g(q,"getGoogleBudget");
1
+ var M=Object.defineProperty;var l=(t,a)=>M(t,"name",{value:a,configurable:!0});import{GoogleGenAI as T}from"@google/genai";import{calculateCost as v,clampThinkingLevel as S}from"../models.js";import{formatProviderError as R,normalizeProviderError as L}from"../utils/error-body.js";import{AssistantMessageEventStream as _}from"../utils/event-stream.js";import{providerHeadersToRecord as G}from"../utils/headers.js";import{sanitizeSurrogates as P}from"../utils/sanitize-unicode.js";import{convertMessages as O,convertTools as A,isThinkingPart as E,mapStopReason as N,resolveGoogleFunctionCallingMode as H,retainThoughtSignature as x,supportsGoogleStrictToolSampling as W}from"./google-shared.js";import{buildBaseOptions as B}from"./simple-options.js";let U=0;export const stream=l((t,a,n)=>{const i=new _;return(async()=>{const e={role:"assistant",content:[],api:"google-generative-ai",provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{const g=n?.apiKey;if(!g)throw new Error(`No API key for provider: ${t.provider}`);const s=$(t,g,n?.headers);let c=D(t,a,n);const p=await n?.onPayload?.(c,t);p!==void 0&&(c=p);const w=await s.models.generateContentStream(c);i.push({type:"start",partial:e});let o=null;const C=e.content,u=l(()=>C.length-1,"blockIndex");for await(const d of w){e.responseId||=d.responseId;const f=d.candidates?.[0];if(f?.content?.parts)for(const r of f.content.parts){if(r.text!==void 0){const h=E(r);(!o||h&&o.type!=="thinking"||!h&&o.type!=="text")&&(o&&(o.type==="text"?i.push({type:"text_end",contentIndex:C.length-1,content:o.text,partial:e}):i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:e})),h?(o={type:"thinking",thinking:"",thinkingSignature:void 0},e.content.push(o),i.push({type:"thinking_start",contentIndex:u(),partial:e})):(o={type:"text",text:""},e.content.push(o),i.push({type:"text_start",contentIndex:u(),partial:e}))),o.type==="thinking"?(o.thinking+=r.text,o.thinkingSignature=x(o.thinkingSignature,r.thoughtSignature),i.push({type:"thinking_delta",contentIndex:u(),delta:r.text,partial:e})):(o.text+=r.text,o.textSignature=x(o.textSignature,r.thoughtSignature),i.push({type:"text_delta",contentIndex:u(),delta:r.text,partial:e}))}if(r.functionCall){o&&(o.type==="text"?i.push({type:"text_end",contentIndex:u(),content:o.text,partial:e}):i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:e}),o=null);const h=r.functionCall.id,m={type:"toolCall",id:!h||e.content.some(I=>I.type==="toolCall"&&I.id===h)?`${r.functionCall.name}_${Date.now()}_${++U}`:h,name:r.functionCall.name||"",arguments:r.functionCall.args??{},...r.thoughtSignature&&{thoughtSignature:r.thoughtSignature}};e.content.push(m),i.push({type:"toolcall_start",contentIndex:u(),partial:e}),i.push({type:"toolcall_delta",contentIndex:u(),delta:JSON.stringify(m.arguments),partial:e}),i.push({type:"toolcall_end",contentIndex:u(),toolCall:m,partial:e})}}f?.finishReason&&(e.stopReason=N(f.finishReason),e.content.some(r=>r.type==="toolCall")&&(e.stopReason="toolUse")),d.usageMetadata&&(e.usage={input:(d.usageMetadata.promptTokenCount||0)-(d.usageMetadata.cachedContentTokenCount||0),output:(d.usageMetadata.candidatesTokenCount||0)+(d.usageMetadata.thoughtsTokenCount||0),cacheRead:d.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:d.usageMetadata.thoughtsTokenCount||0,totalTokens:d.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},v(t,e.usage))}if(o&&(o.type==="text"?i.push({type:"text_end",contentIndex:u(),content:o.text,partial:e}):i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:e})),n?.signal?.aborted)throw new Error("Request was aborted");if(e.stopReason==="aborted"||e.stopReason==="error")throw new Error("An unknown error occurred");i.push({type:"done",reason:e.stopReason,message:e}),i.end()}catch(g){for(const s of e.content)"index"in s&&delete s.index;e.stopReason=n?.signal?.aborted?"aborted":"error",e.errorMessage=R(L(g)),i.push({type:"error",reason:e.stopReason,error:e}),i.end()}})(),i},"stream"),streamSimple=l((t,a,n)=>{const i=n?.apiKey;if(!i)throw new Error(`No API key for provider: ${t.provider}`);const e=B(t,a,n,i);if(!n?.reasoning)return stream(t,a,{...e,thinking:{enabled:!1}});const g=S(t,n.reasoning),s=g==="off"?"high":g,c=t;return y(c)||b(c)||k(c)?stream(t,a,{...e,thinking:{enabled:!0,level:j(s,c)}}):stream(t,a,{...e,thinking:{enabled:!0,budgetTokens:q(c,s,n.thinkingBudgets)}})},"streamSimple");function $(t,a,n){const i={};t.baseUrl&&(i.baseUrl=t.baseUrl,i.apiVersion="");const e=G({...t.headers,...n});return e&&(i.headers=e),new T({apiKey:a,httpOptions:Object.keys(i).length>0?i:void 0})}l($,"createClient");function D(t,a,n={}){const i=O(t,a),e={};n.temperature!==void 0&&(e.temperature=n.temperature),n.maxTokens!==void 0&&(e.maxOutputTokens=n.maxTokens);const g=a.tools?.length?H(a.tools,n.toolChoice,W(t.id)):void 0,s={...Object.keys(e).length>0&&e,...a.systemPrompt&&{systemInstruction:P(a.systemPrompt)},...a.tools&&a.tools.length>0&&{tools:A(a.tools)},...g!==void 0&&{toolConfig:{functionCallingConfig:{mode:g}}}};if(n.thinking?.enabled&&t.reasoning){const p={includeThoughts:!0};n.thinking.level!==void 0?p.thinkingLevel=n.thinking.level:n.thinking.budgetTokens!==void 0&&(p.thinkingBudget=n.thinking.budgetTokens),s.thinkingConfig=p}else t.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=K(t));if(n.signal){if(n.signal.aborted)throw new Error("Request aborted");s.abortSignal=n.signal}return{model:t.id,contents:i,config:s}}l(D,"buildParams");function k(t){return/gemma-?4/.test(t.id.toLowerCase())}l(k,"isGemma4Model");function y(t){return/gemini-3(?:\.\d+)?-pro/.test(t.id.toLowerCase())}l(y,"isGemini3ProModel");function b(t){const a=t.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(a)||a==="gemini-flash-latest"||a==="gemini-flash-lite-latest"}l(b,"isGemini3FlashModel");function K(t){return y(t)?{thinkingLevel:"LOW"}:b(t)?{thinkingLevel:"MINIMAL"}:k(t)?{thinkingLevel:"MINIMAL"}:{thinkingBudget:0}}l(K,"getDisabledThinkingConfig");function j(t,a){if(y(a))switch(t){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}if(k(a))switch(t){case"minimal":case"low":return"MINIMAL";case"medium":case"high":return"HIGH"}switch(t){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}l(j,"getThinkingLevel");function q(t,a,n){return n?.[a]!==void 0?n[a]:t.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[a]:t.id.includes("2.5-flash-lite")?{minimal:512,low:2048,medium:8192,high:24576}[a]:t.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[a]:-1}l(q,"getGoogleBudget");