@code-yeongyu/senpi 2026.8.24 → 2026.8.26

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 (1589) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/dist/cli/args.d.ts.map +1 -1
  3. package/dist/cli/args.js +24 -9
  4. package/dist/cli/args.js.map +1 -1
  5. package/dist/cli/file-processor.d.ts.map +1 -1
  6. package/dist/cli/file-processor.js +2 -1
  7. package/dist/cli/file-processor.js.map +1 -1
  8. package/dist/config.d.ts +6 -3
  9. package/dist/config.d.ts.map +1 -1
  10. package/dist/config.js +24 -14
  11. package/dist/config.js.map +1 -1
  12. package/dist/core/agent-abort-provenance.d.ts.map +1 -1
  13. package/dist/core/agent-abort-provenance.js +5 -1
  14. package/dist/core/agent-abort-provenance.js.map +1 -1
  15. package/dist/core/agent-session.d.ts +11 -0
  16. package/dist/core/agent-session.d.ts.map +1 -1
  17. package/dist/core/agent-session.js +154 -29
  18. package/dist/core/agent-session.js.map +1 -1
  19. package/dist/core/auth-storage.d.ts +4 -0
  20. package/dist/core/auth-storage.d.ts.map +1 -1
  21. package/dist/core/auth-storage.js +35 -8
  22. package/dist/core/auth-storage.js.map +1 -1
  23. package/dist/core/brand.d.ts +2 -0
  24. package/dist/core/brand.d.ts.map +1 -1
  25. package/dist/core/brand.js +1 -0
  26. package/dist/core/brand.js.map +1 -1
  27. package/dist/core/compaction/compaction.d.ts +1 -0
  28. package/dist/core/compaction/compaction.d.ts.map +1 -1
  29. package/dist/core/compaction/compaction.js +24 -8
  30. package/dist/core/compaction/compaction.js.map +1 -1
  31. package/dist/core/defaults.d.ts +1 -0
  32. package/dist/core/defaults.d.ts.map +1 -1
  33. package/dist/core/defaults.js +9 -0
  34. package/dist/core/defaults.js.map +1 -1
  35. package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts +5 -9
  36. package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts.map +1 -1
  37. package/dist/core/extensions/builtin/compaction/per-turn-cap.js +5 -11
  38. package/dist/core/extensions/builtin/compaction/per-turn-cap.js.map +1 -1
  39. package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts +2 -3
  40. package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts.map +1 -1
  41. package/dist/core/extensions/builtin/compaction/todo-bridge.js +53 -14
  42. package/dist/core/extensions/builtin/compaction/todo-bridge.js.map +1 -1
  43. package/dist/core/extensions/builtin/goal/terminal-provider-error.js +1 -1
  44. package/dist/core/extensions/builtin/goal/terminal-provider-error.js.map +1 -1
  45. package/dist/core/extensions/builtin/loop-guard/notice.d.ts.map +1 -1
  46. package/dist/core/extensions/builtin/loop-guard/notice.js +5 -1
  47. package/dist/core/extensions/builtin/loop-guard/notice.js.map +1 -1
  48. package/dist/core/extensions/builtin/mcp/config-schema.d.ts +2 -2
  49. package/dist/core/extensions/builtin/ttsr/index.d.ts.map +1 -1
  50. package/dist/core/extensions/builtin/ttsr/index.js +6 -6
  51. package/dist/core/extensions/builtin/ttsr/index.js.map +1 -1
  52. package/dist/core/extensions/builtin/ttsr/message-update.d.ts +10 -0
  53. package/dist/core/extensions/builtin/ttsr/message-update.d.ts.map +1 -0
  54. package/dist/core/extensions/builtin/ttsr/message-update.js +38 -0
  55. package/dist/core/extensions/builtin/ttsr/message-update.js.map +1 -0
  56. package/dist/core/extensions/builtin/ttsr/remediation.d.ts +5 -10
  57. package/dist/core/extensions/builtin/ttsr/remediation.d.ts.map +1 -1
  58. package/dist/core/extensions/builtin/ttsr/remediation.js +19 -3
  59. package/dist/core/extensions/builtin/ttsr/remediation.js.map +1 -1
  60. package/dist/core/extensions/builtin/ttsr/stream-remediation.d.ts +1 -1
  61. package/dist/core/extensions/builtin/ttsr/stream-remediation.d.ts.map +1 -1
  62. package/dist/core/extensions/builtin/ttsr/stream-remediation.js.map +1 -1
  63. package/dist/core/extensions/builtin/ttsr/types.d.ts +1 -1
  64. package/dist/core/extensions/builtin/ttsr/types.d.ts.map +1 -1
  65. package/dist/core/extensions/builtin/ttsr/types.js.map +1 -1
  66. package/dist/core/extensions/builtin/ttsr/watch.d.ts +1 -1
  67. package/dist/core/extensions/builtin/ttsr/watch.d.ts.map +1 -1
  68. package/dist/core/extensions/builtin/ttsr/watch.js +2 -2
  69. package/dist/core/extensions/builtin/ttsr/watch.js.map +1 -1
  70. package/dist/core/extensions/index.d.ts +2 -2
  71. package/dist/core/extensions/index.d.ts.map +1 -1
  72. package/dist/core/extensions/index.js +1 -1
  73. package/dist/core/extensions/index.js.map +1 -1
  74. package/dist/core/extensions/loader.d.ts.map +1 -1
  75. package/dist/core/extensions/loader.js +107 -45
  76. package/dist/core/extensions/loader.js.map +1 -1
  77. package/dist/core/extensions/types.d.ts +17 -6
  78. package/dist/core/extensions/types.d.ts.map +1 -1
  79. package/dist/core/extensions/types.js +3 -0
  80. package/dist/core/extensions/types.js.map +1 -1
  81. package/dist/core/footer-data-provider.d.ts +1 -1
  82. package/dist/core/footer-data-provider.js +1 -1
  83. package/dist/core/footer-data-provider.js.map +1 -1
  84. package/dist/core/keybindings.d.ts +20 -19
  85. package/dist/core/keybindings.d.ts.map +1 -1
  86. package/dist/core/keybindings.js +26 -5
  87. package/dist/core/keybindings.js.map +1 -1
  88. package/dist/core/model-config-schema.d.ts +17 -5
  89. package/dist/core/model-config-schema.d.ts.map +1 -1
  90. package/dist/core/model-config-schema.js +1 -1
  91. package/dist/core/model-config-schema.js.map +1 -1
  92. package/dist/core/model-config.d.ts.map +1 -1
  93. package/dist/core/model-config.js +7 -5
  94. package/dist/core/model-config.js.map +1 -1
  95. package/dist/core/model-resolver.d.ts +3 -2
  96. package/dist/core/model-resolver.d.ts.map +1 -1
  97. package/dist/core/model-resolver.js +3 -2
  98. package/dist/core/model-resolver.js.map +1 -1
  99. package/dist/core/model-runtime.d.ts +0 -1
  100. package/dist/core/model-runtime.d.ts.map +1 -1
  101. package/dist/core/model-runtime.js +0 -18
  102. package/dist/core/model-runtime.js.map +1 -1
  103. package/dist/core/models-store.d.ts.map +1 -1
  104. package/dist/core/models-store.js +2 -1
  105. package/dist/core/models-store.js.map +1 -1
  106. package/dist/core/package-manager.d.ts.map +1 -1
  107. package/dist/core/package-manager.js +14 -10
  108. package/dist/core/package-manager.js.map +1 -1
  109. package/dist/core/pi-manifest.d.ts.map +1 -1
  110. package/dist/core/pi-manifest.js +2 -1
  111. package/dist/core/pi-manifest.js.map +1 -1
  112. package/dist/core/provider-composer.d.ts +2 -0
  113. package/dist/core/provider-composer.d.ts.map +1 -1
  114. package/dist/core/provider-composer.js +3 -6
  115. package/dist/core/provider-composer.js.map +1 -1
  116. package/dist/core/provider-display-names.d.ts.map +1 -1
  117. package/dist/core/provider-display-names.js +0 -1
  118. package/dist/core/provider-display-names.js.map +1 -1
  119. package/dist/core/provider-timeout-retry.d.ts.map +1 -1
  120. package/dist/core/provider-timeout-retry.js +8 -12
  121. package/dist/core/provider-timeout-retry.js.map +1 -1
  122. package/dist/core/resource-loader.d.ts.map +1 -1
  123. package/dist/core/resource-loader.js +3 -2
  124. package/dist/core/resource-loader.js.map +1 -1
  125. package/dist/core/retry-fallback/profile-override.d.ts +24 -0
  126. package/dist/core/retry-fallback/profile-override.d.ts.map +1 -0
  127. package/dist/core/retry-fallback/profile-override.js +138 -0
  128. package/dist/core/retry-fallback/profile-override.js.map +1 -0
  129. package/dist/core/retry-fallback/settings.d.ts +1 -0
  130. package/dist/core/retry-fallback/settings.d.ts.map +1 -1
  131. package/dist/core/retry-fallback/settings.js.map +1 -1
  132. package/dist/core/sdk.d.ts +2 -2
  133. package/dist/core/sdk.d.ts.map +1 -1
  134. package/dist/core/sdk.js +20 -5
  135. package/dist/core/sdk.js.map +1 -1
  136. package/dist/core/session-export.d.ts +4 -0
  137. package/dist/core/session-export.d.ts.map +1 -0
  138. package/dist/core/session-export.js +32 -0
  139. package/dist/core/session-export.js.map +1 -0
  140. package/dist/core/session-manager.d.ts.map +1 -1
  141. package/dist/core/session-manager.js +2 -1
  142. package/dist/core/session-manager.js.map +1 -1
  143. package/dist/core/settings-diagnostics.d.ts +9 -0
  144. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  145. package/dist/core/settings-diagnostics.js +21 -0
  146. package/dist/core/settings-diagnostics.js.map +1 -0
  147. package/dist/core/settings-manager.d.ts +18 -0
  148. package/dist/core/settings-manager.d.ts.map +1 -1
  149. package/dist/core/settings-manager.js +88 -7
  150. package/dist/core/settings-manager.js.map +1 -1
  151. package/dist/core/slash-commands.d.ts.map +1 -1
  152. package/dist/core/slash-commands.js +2 -1
  153. package/dist/core/slash-commands.js.map +1 -1
  154. package/dist/core/system-prompt.d.ts.map +1 -1
  155. package/dist/core/system-prompt.js +11 -2
  156. package/dist/core/system-prompt.js.map +1 -1
  157. package/dist/core/tools/bash.d.ts +14 -1
  158. package/dist/core/tools/bash.d.ts.map +1 -1
  159. package/dist/core/tools/bash.js +35 -19
  160. package/dist/core/tools/bash.js.map +1 -1
  161. package/dist/core/tools/edit-diff.d.ts +0 -5
  162. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  163. package/dist/core/tools/edit-diff.js +2 -5
  164. package/dist/core/tools/edit-diff.js.map +1 -1
  165. package/dist/core/tools/edit.d.ts.map +1 -1
  166. package/dist/core/tools/edit.js +3 -2
  167. package/dist/core/tools/edit.js.map +1 -1
  168. package/dist/core/tools/index.d.ts +4 -1
  169. package/dist/core/tools/index.d.ts.map +1 -1
  170. package/dist/core/tools/index.js +13 -1
  171. package/dist/core/tools/index.js.map +1 -1
  172. package/dist/core/tools/powershell.d.ts +16 -0
  173. package/dist/core/tools/powershell.d.ts.map +1 -0
  174. package/dist/core/tools/powershell.js +39 -0
  175. package/dist/core/tools/powershell.js.map +1 -0
  176. package/dist/core/trust-manager.d.ts.map +1 -1
  177. package/dist/core/trust-manager.js +2 -1
  178. package/dist/core/trust-manager.js.map +1 -1
  179. package/dist/extensions/llama/client.d.ts +6 -0
  180. package/dist/extensions/llama/client.d.ts.map +1 -1
  181. package/dist/extensions/llama/client.js +7 -0
  182. package/dist/extensions/llama/client.js.map +1 -1
  183. package/dist/extensions/llama/provider.d.ts +3 -1
  184. package/dist/extensions/llama/provider.d.ts.map +1 -1
  185. package/dist/extensions/llama/provider.js +27 -6
  186. package/dist/extensions/llama/provider.js.map +1 -1
  187. package/dist/index.d.ts +5 -4
  188. package/dist/index.d.ts.map +1 -1
  189. package/dist/index.js +4 -3
  190. package/dist/index.js.map +1 -1
  191. package/dist/main.d.ts.map +1 -1
  192. package/dist/main.js +13 -2
  193. package/dist/main.js.map +1 -1
  194. package/dist/migrations.d.ts.map +1 -1
  195. package/dist/migrations.js +4 -3
  196. package/dist/migrations.js.map +1 -1
  197. package/dist/modes/app-server/daemon/probe.js +1 -1
  198. package/dist/modes/app-server/daemon/probe.js.map +1 -1
  199. package/dist/modes/app-server/daemon.js +13 -2
  200. package/dist/modes/app-server/daemon.js.map +1 -1
  201. package/dist/modes/app-server/transports/websocket-connection-handler.d.ts.map +1 -1
  202. package/dist/modes/app-server/transports/websocket-connection-handler.js +4 -0
  203. package/dist/modes/app-server/transports/websocket-connection-handler.js.map +1 -1
  204. package/dist/modes/interactive/aborted-error-label.d.ts +2 -0
  205. package/dist/modes/interactive/aborted-error-label.d.ts.map +1 -1
  206. package/dist/modes/interactive/aborted-error-label.js +7 -0
  207. package/dist/modes/interactive/aborted-error-label.js.map +1 -1
  208. package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
  209. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  210. package/dist/modes/interactive/components/thinking-selector.js +68 -17
  211. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  212. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  213. package/dist/modes/interactive/external-editor.js +2 -1
  214. package/dist/modes/interactive/external-editor.js.map +1 -1
  215. package/dist/modes/interactive/interactive-mode.d.ts +6 -0
  216. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  217. package/dist/modes/interactive/interactive-mode.js +19 -12
  218. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  219. package/dist/modes/json-event.d.ts +16 -13
  220. package/dist/modes/json-event.d.ts.map +1 -1
  221. package/dist/modes/json-event.js +20 -6
  222. package/dist/modes/json-event.js.map +1 -1
  223. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  224. package/dist/modes/rpc/connection-handler.js +3 -0
  225. package/dist/modes/rpc/connection-handler.js.map +1 -1
  226. package/dist/modes/rpc/rpc-client.d.ts +7 -0
  227. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  228. package/dist/modes/rpc/rpc-client.js +7 -0
  229. package/dist/modes/rpc/rpc-client.js.map +1 -1
  230. package/dist/modes/rpc/rpc-types.d.ts +12 -0
  231. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  232. package/dist/modes/rpc/rpc-types.js.map +1 -1
  233. package/dist/package-manager-cli.d.ts +1 -0
  234. package/dist/package-manager-cli.d.ts.map +1 -1
  235. package/dist/package-manager-cli.js +186 -2
  236. package/dist/package-manager-cli.js.map +1 -1
  237. package/dist/utils/frontmatter.d.ts.map +1 -1
  238. package/dist/utils/frontmatter.js +2 -1
  239. package/dist/utils/frontmatter.js.map +1 -1
  240. package/dist/utils/shell.d.ts +3 -0
  241. package/dist/utils/shell.d.ts.map +1 -1
  242. package/dist/utils/shell.js +17 -5
  243. package/dist/utils/shell.js.map +1 -1
  244. package/dist/utils/syntax-highlight.d.ts +1 -0
  245. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  246. package/dist/utils/syntax-highlight.js +60 -1
  247. package/dist/utils/syntax-highlight.js.map +1 -1
  248. package/dist/utils/text.d.ts +8 -0
  249. package/dist/utils/text.d.ts.map +1 -0
  250. package/dist/utils/text.js +9 -0
  251. package/dist/utils/text.js.map +1 -0
  252. package/docs/compaction.md +0 -2
  253. package/docs/custom-provider.md +6 -6
  254. package/docs/environment-variables.md +8 -8
  255. package/docs/extensions.md +6 -5
  256. package/docs/json.md +7 -2
  257. package/docs/keybindings.md +1 -1
  258. package/docs/packages.md +2 -2
  259. package/docs/rpc.md +32 -3
  260. package/docs/sdk.md +7 -2
  261. package/docs/settings.md +9 -1
  262. package/docs/terminal-setup.md +11 -9
  263. package/docs/usage.md +4 -1
  264. package/docs/windows.md +24 -2
  265. package/examples/extensions/custom-provider-anthropic/package-lock.json +28 -5
  266. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  267. package/node_modules/@anthropic-ai/sdk/CHANGELOG.md +558 -0
  268. package/node_modules/@anthropic-ai/sdk/README.md +16 -1
  269. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.mts.map +1 -1
  270. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.ts.map +1 -1
  271. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js +14 -2
  272. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js.map +1 -1
  273. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs +14 -2
  274. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs.map +1 -1
  275. package/node_modules/@anthropic-ai/sdk/api-promise.d.mts +1 -0
  276. package/node_modules/@anthropic-ai/sdk/api-promise.d.mts.map +1 -1
  277. package/node_modules/@anthropic-ai/sdk/api-promise.d.ts +1 -0
  278. package/node_modules/@anthropic-ai/sdk/api-promise.d.ts.map +1 -1
  279. package/node_modules/@anthropic-ai/sdk/api-promise.mjs +1 -0
  280. package/node_modules/@anthropic-ai/sdk/api-promise.mjs.map +1 -1
  281. package/node_modules/@anthropic-ai/sdk/bin/migration-config.json +481 -0
  282. package/node_modules/@anthropic-ai/sdk/client.d.mts +165 -11
  283. package/node_modules/@anthropic-ai/sdk/client.d.mts.map +1 -1
  284. package/node_modules/@anthropic-ai/sdk/client.d.ts +165 -11
  285. package/node_modules/@anthropic-ai/sdk/client.d.ts.map +1 -1
  286. package/node_modules/@anthropic-ai/sdk/client.js +415 -38
  287. package/node_modules/@anthropic-ai/sdk/client.js.map +1 -1
  288. package/node_modules/@anthropic-ai/sdk/client.mjs +414 -37
  289. package/node_modules/@anthropic-ai/sdk/client.mjs.map +1 -1
  290. package/node_modules/@anthropic-ai/sdk/core/api-promise.d.mts +1 -0
  291. package/node_modules/@anthropic-ai/sdk/core/api-promise.d.mts.map +1 -1
  292. package/node_modules/@anthropic-ai/sdk/core/api-promise.d.ts +1 -0
  293. package/node_modules/@anthropic-ai/sdk/core/api-promise.d.ts.map +1 -1
  294. package/node_modules/@anthropic-ai/sdk/core/api-promise.js +7 -2
  295. package/node_modules/@anthropic-ai/sdk/core/api-promise.js.map +1 -1
  296. package/node_modules/@anthropic-ai/sdk/core/api-promise.mjs +8 -3
  297. package/node_modules/@anthropic-ai/sdk/core/api-promise.mjs.map +1 -1
  298. package/node_modules/@anthropic-ai/sdk/core/api.d.mts +11 -0
  299. package/node_modules/@anthropic-ai/sdk/core/api.d.mts.map +1 -0
  300. package/node_modules/@anthropic-ai/sdk/core/api.d.ts +11 -0
  301. package/node_modules/@anthropic-ai/sdk/core/api.d.ts.map +1 -0
  302. package/node_modules/@anthropic-ai/sdk/core/api.js +3 -0
  303. package/node_modules/@anthropic-ai/sdk/core/api.js.map +1 -0
  304. package/node_modules/@anthropic-ai/sdk/core/api.mjs +2 -0
  305. package/node_modules/@anthropic-ai/sdk/core/api.mjs.map +1 -0
  306. package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts +131 -0
  307. package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts.map +1 -0
  308. package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts +131 -0
  309. package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts.map +1 -0
  310. package/node_modules/@anthropic-ai/sdk/core/credentials.js +317 -0
  311. package/node_modules/@anthropic-ai/sdk/core/credentials.js.map +1 -0
  312. package/node_modules/@anthropic-ai/sdk/core/credentials.mjs +277 -0
  313. package/node_modules/@anthropic-ai/sdk/core/credentials.mjs.map +1 -0
  314. package/node_modules/@anthropic-ai/sdk/core/error.d.mts +12 -0
  315. package/node_modules/@anthropic-ai/sdk/core/error.d.mts.map +1 -1
  316. package/node_modules/@anthropic-ai/sdk/core/error.d.ts +12 -0
  317. package/node_modules/@anthropic-ai/sdk/core/error.d.ts.map +1 -1
  318. package/node_modules/@anthropic-ai/sdk/core/error.js +18 -1
  319. package/node_modules/@anthropic-ai/sdk/core/error.js.map +1 -1
  320. package/node_modules/@anthropic-ai/sdk/core/error.mjs +16 -0
  321. package/node_modules/@anthropic-ai/sdk/core/error.mjs.map +1 -1
  322. package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts +154 -0
  323. package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts.map +1 -0
  324. package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts +154 -0
  325. package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts.map +1 -0
  326. package/node_modules/@anthropic-ai/sdk/core/middleware.js +174 -0
  327. package/node_modules/@anthropic-ai/sdk/core/middleware.js.map +1 -0
  328. package/node_modules/@anthropic-ai/sdk/core/middleware.mjs +168 -0
  329. package/node_modules/@anthropic-ai/sdk/core/middleware.mjs.map +1 -0
  330. package/node_modules/@anthropic-ai/sdk/core/pagination.d.mts +20 -0
  331. package/node_modules/@anthropic-ai/sdk/core/pagination.d.mts.map +1 -1
  332. package/node_modules/@anthropic-ai/sdk/core/pagination.d.ts +20 -0
  333. package/node_modules/@anthropic-ai/sdk/core/pagination.d.ts.map +1 -1
  334. package/node_modules/@anthropic-ai/sdk/core/pagination.js +26 -1
  335. package/node_modules/@anthropic-ai/sdk/core/pagination.js.map +1 -1
  336. package/node_modules/@anthropic-ai/sdk/core/pagination.mjs +24 -0
  337. package/node_modules/@anthropic-ai/sdk/core/pagination.mjs.map +1 -1
  338. package/node_modules/@anthropic-ai/sdk/core/resource.d.mts.map +1 -1
  339. package/node_modules/@anthropic-ai/sdk/core/resource.d.ts.map +1 -1
  340. package/node_modules/@anthropic-ai/sdk/core/streaming.d.mts +9 -0
  341. package/node_modules/@anthropic-ai/sdk/core/streaming.d.mts.map +1 -1
  342. package/node_modules/@anthropic-ai/sdk/core/streaming.d.ts +9 -0
  343. package/node_modules/@anthropic-ai/sdk/core/streaming.d.ts.map +1 -1
  344. package/node_modules/@anthropic-ai/sdk/core/streaming.js +34 -1
  345. package/node_modules/@anthropic-ai/sdk/core/streaming.js.map +1 -1
  346. package/node_modules/@anthropic-ai/sdk/core/streaming.mjs +34 -1
  347. package/node_modules/@anthropic-ai/sdk/core/streaming.mjs.map +1 -1
  348. package/node_modules/@anthropic-ai/sdk/core/uploads.d.mts.map +1 -1
  349. package/node_modules/@anthropic-ai/sdk/core/uploads.d.ts.map +1 -1
  350. package/node_modules/@anthropic-ai/sdk/core/uploads.mjs.map +1 -1
  351. package/node_modules/@anthropic-ai/sdk/error.d.mts +1 -0
  352. package/node_modules/@anthropic-ai/sdk/error.d.mts.map +1 -1
  353. package/node_modules/@anthropic-ai/sdk/error.d.ts +1 -0
  354. package/node_modules/@anthropic-ai/sdk/error.d.ts.map +1 -1
  355. package/node_modules/@anthropic-ai/sdk/error.mjs +1 -0
  356. package/node_modules/@anthropic-ai/sdk/error.mjs.map +1 -1
  357. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.mts +23 -0
  358. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.mts.map +1 -0
  359. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.ts +23 -0
  360. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.ts.map +1 -0
  361. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.js +31 -0
  362. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.js.map +1 -0
  363. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.mjs +23 -0
  364. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.mjs.map +1 -0
  365. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.mts +6 -0
  366. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.mts.map +1 -1
  367. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.ts +6 -0
  368. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.ts.map +1 -1
  369. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.js +1 -0
  370. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.js.map +1 -1
  371. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.mjs +1 -0
  372. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.mjs.map +1 -1
  373. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.mts +1 -1
  374. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.mts.map +1 -1
  375. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.ts +1 -1
  376. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.ts.map +1 -1
  377. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.js +1 -1
  378. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.js.map +1 -1
  379. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.mjs +1 -1
  380. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.mjs.map +1 -1
  381. package/node_modules/@anthropic-ai/sdk/helpers/beta/memory.d.mts.map +1 -1
  382. package/node_modules/@anthropic-ai/sdk/helpers/beta/memory.d.ts.map +1 -1
  383. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.mts +11 -5
  384. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.mts.map +1 -1
  385. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.ts +11 -5
  386. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.ts.map +1 -1
  387. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.js +2 -2
  388. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.js.map +1 -1
  389. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.mjs +2 -2
  390. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.mjs.map +1 -1
  391. package/node_modules/@anthropic-ai/sdk/helpers/index.d.mts.map +1 -1
  392. package/node_modules/@anthropic-ai/sdk/helpers/index.d.ts.map +1 -1
  393. package/node_modules/@anthropic-ai/sdk/helpers/index.mjs.map +1 -1
  394. package/node_modules/@anthropic-ai/sdk/helpers/json-schema.d.mts.map +1 -1
  395. package/node_modules/@anthropic-ai/sdk/helpers/json-schema.d.ts.map +1 -1
  396. package/node_modules/@anthropic-ai/sdk/helpers/json-schema.mjs.map +1 -1
  397. package/node_modules/@anthropic-ai/sdk/helpers/zod.d.mts +2 -2
  398. package/node_modules/@anthropic-ai/sdk/helpers/zod.d.mts.map +1 -1
  399. package/node_modules/@anthropic-ai/sdk/helpers/zod.d.ts +2 -2
  400. package/node_modules/@anthropic-ai/sdk/helpers/zod.d.ts.map +1 -1
  401. package/node_modules/@anthropic-ai/sdk/helpers/zod.js +1 -2
  402. package/node_modules/@anthropic-ai/sdk/helpers/zod.js.map +1 -1
  403. package/node_modules/@anthropic-ai/sdk/helpers/zod.mjs +1 -2
  404. package/node_modules/@anthropic-ai/sdk/helpers/zod.mjs.map +1 -1
  405. package/node_modules/@anthropic-ai/sdk/index.d.mts +4 -2
  406. package/node_modules/@anthropic-ai/sdk/index.d.mts.map +1 -1
  407. package/node_modules/@anthropic-ai/sdk/index.d.ts +4 -2
  408. package/node_modules/@anthropic-ai/sdk/index.d.ts.map +1 -1
  409. package/node_modules/@anthropic-ai/sdk/index.js +5 -1
  410. package/node_modules/@anthropic-ai/sdk/index.js.map +1 -1
  411. package/node_modules/@anthropic-ai/sdk/index.mjs +3 -2
  412. package/node_modules/@anthropic-ai/sdk/index.mjs.map +1 -1
  413. package/node_modules/@anthropic-ai/sdk/internal/constants.d.mts.map +1 -1
  414. package/node_modules/@anthropic-ai/sdk/internal/constants.d.ts.map +1 -1
  415. package/node_modules/@anthropic-ai/sdk/internal/constants.js +0 -5
  416. package/node_modules/@anthropic-ai/sdk/internal/constants.js.map +1 -1
  417. package/node_modules/@anthropic-ai/sdk/internal/constants.mjs +0 -5
  418. package/node_modules/@anthropic-ai/sdk/internal/constants.mjs.map +1 -1
  419. package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.mts.map +1 -1
  420. package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.ts.map +1 -1
  421. package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.mjs.map +1 -1
  422. package/node_modules/@anthropic-ai/sdk/internal/decoders/line.mjs.map +1 -1
  423. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs.map +1 -1
  424. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts +136 -0
  425. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts.map +1 -0
  426. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts +136 -0
  427. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts.map +1 -0
  428. package/node_modules/@anthropic-ai/sdk/internal/file-store.js +531 -0
  429. package/node_modules/@anthropic-ai/sdk/internal/file-store.js.map +1 -0
  430. package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs +523 -0
  431. package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs.map +1 -0
  432. package/node_modules/@anthropic-ai/sdk/internal/headers.d.mts +7 -0
  433. package/node_modules/@anthropic-ai/sdk/internal/headers.d.mts.map +1 -1
  434. package/node_modules/@anthropic-ai/sdk/internal/headers.d.ts +7 -0
  435. package/node_modules/@anthropic-ai/sdk/internal/headers.d.ts.map +1 -1
  436. package/node_modules/@anthropic-ai/sdk/internal/headers.js +45 -4
  437. package/node_modules/@anthropic-ai/sdk/internal/headers.js.map +1 -1
  438. package/node_modules/@anthropic-ai/sdk/internal/headers.mjs +43 -3
  439. package/node_modules/@anthropic-ai/sdk/internal/headers.mjs.map +1 -1
  440. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.mts +10 -0
  441. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.mts.map +1 -0
  442. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.ts +10 -0
  443. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.ts.map +1 -0
  444. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.js +34 -0
  445. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.js.map +1 -0
  446. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.mjs +30 -0
  447. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.mjs.map +1 -0
  448. package/node_modules/@anthropic-ai/sdk/internal/parse.d.mts +2 -1
  449. package/node_modules/@anthropic-ai/sdk/internal/parse.d.mts.map +1 -1
  450. package/node_modules/@anthropic-ai/sdk/internal/parse.d.ts +2 -1
  451. package/node_modules/@anthropic-ai/sdk/internal/parse.d.ts.map +1 -1
  452. package/node_modules/@anthropic-ai/sdk/internal/parse.js +16 -10
  453. package/node_modules/@anthropic-ai/sdk/internal/parse.js.map +1 -1
  454. package/node_modules/@anthropic-ai/sdk/internal/parse.mjs +15 -9
  455. package/node_modules/@anthropic-ai/sdk/internal/parse.mjs.map +1 -1
  456. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.mts +7 -0
  457. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.mts.map +1 -0
  458. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.ts +7 -0
  459. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.ts.map +1 -0
  460. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.js +13 -0
  461. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.js.map +1 -0
  462. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.mjs +9 -0
  463. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.mjs.map +1 -0
  464. package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.mts +10 -0
  465. package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.mts.map +1 -0
  466. package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.ts +10 -0
  467. package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.ts.map +1 -0
  468. package/node_modules/@anthropic-ai/sdk/internal/qs/index.js +14 -0
  469. package/node_modules/@anthropic-ai/sdk/internal/qs/index.js.map +1 -0
  470. package/node_modules/@anthropic-ai/sdk/internal/qs/index.mjs +10 -0
  471. package/node_modules/@anthropic-ai/sdk/internal/qs/index.mjs.map +1 -0
  472. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.mts +3 -0
  473. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.mts.map +1 -0
  474. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.ts +3 -0
  475. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.ts.map +1 -0
  476. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.js +277 -0
  477. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.js.map +1 -0
  478. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.mjs +274 -0
  479. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.mjs.map +1 -0
  480. package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.mts +57 -0
  481. package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.mts.map +1 -0
  482. package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.ts +57 -0
  483. package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.ts.map +1 -0
  484. package/node_modules/@anthropic-ai/sdk/internal/qs/types.js +3 -0
  485. package/node_modules/@anthropic-ai/sdk/internal/qs/types.js.map +1 -0
  486. package/node_modules/@anthropic-ai/sdk/internal/qs/types.mjs +2 -0
  487. package/node_modules/@anthropic-ai/sdk/internal/qs/types.mjs.map +1 -0
  488. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.mts +15 -0
  489. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.mts.map +1 -0
  490. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.ts +15 -0
  491. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.ts.map +1 -0
  492. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.js +230 -0
  493. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.js.map +1 -0
  494. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.mjs +217 -0
  495. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.mjs.map +1 -0
  496. package/node_modules/@anthropic-ai/sdk/internal/request-options.d.mts +52 -2
  497. package/node_modules/@anthropic-ai/sdk/internal/request-options.d.mts.map +1 -1
  498. package/node_modules/@anthropic-ai/sdk/internal/request-options.d.ts +52 -2
  499. package/node_modules/@anthropic-ai/sdk/internal/request-options.d.ts.map +1 -1
  500. package/node_modules/@anthropic-ai/sdk/internal/request-options.js +12 -1
  501. package/node_modules/@anthropic-ai/sdk/internal/request-options.js.map +1 -1
  502. package/node_modules/@anthropic-ai/sdk/internal/request-options.mjs +10 -0
  503. package/node_modules/@anthropic-ai/sdk/internal/request-options.mjs.map +1 -1
  504. package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.mts +4 -0
  505. package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.mts.map +1 -0
  506. package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.ts +4 -0
  507. package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.ts.map +1 -0
  508. package/node_modules/@anthropic-ai/sdk/internal/request-signal.js +50 -0
  509. package/node_modules/@anthropic-ai/sdk/internal/request-signal.js.map +1 -0
  510. package/node_modules/@anthropic-ai/sdk/internal/request-signal.mjs +45 -0
  511. package/node_modules/@anthropic-ai/sdk/internal/request-signal.mjs.map +1 -0
  512. package/node_modules/@anthropic-ai/sdk/internal/shims.d.mts +6 -0
  513. package/node_modules/@anthropic-ai/sdk/internal/shims.d.mts.map +1 -1
  514. package/node_modules/@anthropic-ai/sdk/internal/shims.d.ts +6 -0
  515. package/node_modules/@anthropic-ai/sdk/internal/shims.d.ts.map +1 -1
  516. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.mts +60 -0
  517. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.mts.map +1 -0
  518. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.ts +60 -0
  519. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.ts.map +1 -0
  520. package/node_modules/@anthropic-ai/sdk/{lib → internal}/stainless-helper-header.js +27 -6
  521. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.js.map +1 -0
  522. package/node_modules/@anthropic-ai/sdk/{lib → internal}/stainless-helper-header.mjs +25 -5
  523. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.mjs.map +1 -0
  524. package/node_modules/@anthropic-ai/sdk/internal/to-file.d.mts.map +1 -1
  525. package/node_modules/@anthropic-ai/sdk/internal/to-file.d.ts.map +1 -1
  526. package/node_modules/@anthropic-ai/sdk/internal/to-file.mjs.map +1 -1
  527. package/node_modules/@anthropic-ai/sdk/internal/types.d.mts +12 -6
  528. package/node_modules/@anthropic-ai/sdk/internal/types.d.mts.map +1 -1
  529. package/node_modules/@anthropic-ai/sdk/internal/types.d.ts +12 -6
  530. package/node_modules/@anthropic-ai/sdk/internal/types.d.ts.map +1 -1
  531. package/node_modules/@anthropic-ai/sdk/internal/uploads.d.mts.map +1 -1
  532. package/node_modules/@anthropic-ai/sdk/internal/uploads.d.ts.map +1 -1
  533. package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs.map +1 -1
  534. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.mts +13 -0
  535. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.mts.map +1 -0
  536. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.ts +13 -0
  537. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.ts.map +1 -0
  538. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.js +26 -0
  539. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.js.map +1 -0
  540. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.mjs +23 -0
  541. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.mjs.map +1 -0
  542. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.mts +31 -0
  543. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.mts.map +1 -0
  544. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.ts +31 -0
  545. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.ts.map +1 -0
  546. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.js +75 -0
  547. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.js.map +1 -0
  548. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.mjs +71 -0
  549. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.mjs.map +1 -0
  550. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.mts +23 -0
  551. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.mts.map +1 -0
  552. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.ts +23 -0
  553. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.ts.map +1 -0
  554. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.js +44 -0
  555. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.js.map +1 -0
  556. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.mjs +36 -0
  557. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.mjs.map +1 -0
  558. package/node_modules/@anthropic-ai/sdk/internal/utils/base64.mjs.map +1 -1
  559. package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.mts +11 -1
  560. package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.mts.map +1 -1
  561. package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.ts +11 -1
  562. package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.ts.map +1 -1
  563. package/node_modules/@anthropic-ai/sdk/internal/utils/log.js +37 -11
  564. package/node_modules/@anthropic-ai/sdk/internal/utils/log.js.map +1 -1
  565. package/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs +35 -10
  566. package/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs.map +1 -1
  567. package/node_modules/@anthropic-ai/sdk/internal/utils/path.mjs.map +1 -1
  568. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.mts +11 -0
  569. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.mts.map +1 -0
  570. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.ts +11 -0
  571. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.ts.map +1 -0
  572. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.js +18 -0
  573. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.js.map +1 -0
  574. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs +15 -0
  575. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs.map +1 -0
  576. package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.mts +0 -3
  577. package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.mts.map +1 -1
  578. package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.ts +0 -3
  579. package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.ts.map +1 -1
  580. package/node_modules/@anthropic-ai/sdk/internal/utils/query.js +3 -16
  581. package/node_modules/@anthropic-ai/sdk/internal/utils/query.js.map +1 -1
  582. package/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs +2 -16
  583. package/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs.map +1 -1
  584. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.mts +9 -1
  585. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.mts.map +1 -1
  586. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.ts +9 -1
  587. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.ts.map +1 -1
  588. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js +23 -2
  589. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js.map +1 -1
  590. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs +23 -2
  591. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs.map +1 -1
  592. package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.mts +3 -0
  593. package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.mts.map +1 -0
  594. package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.ts +3 -0
  595. package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.ts.map +1 -0
  596. package/node_modules/@anthropic-ai/sdk/internal/utils/time.js +8 -0
  597. package/node_modules/@anthropic-ai/sdk/internal/utils/time.js.map +1 -0
  598. package/node_modules/@anthropic-ai/sdk/internal/utils/time.mjs +5 -0
  599. package/node_modules/@anthropic-ai/sdk/internal/utils/time.mjs.map +1 -0
  600. package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -1
  601. package/node_modules/@anthropic-ai/sdk/internal/utils.d.mts.map +1 -1
  602. package/node_modules/@anthropic-ai/sdk/internal/utils.d.ts.map +1 -1
  603. package/node_modules/@anthropic-ai/sdk/internal/utils.mjs.map +1 -1
  604. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts +2 -0
  605. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts.map +1 -1
  606. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts +2 -0
  607. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts.map +1 -1
  608. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +66 -31
  609. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js.map +1 -1
  610. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs +66 -31
  611. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs.map +1 -1
  612. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts +2 -0
  613. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts.map +1 -1
  614. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts +2 -0
  615. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +1 -1
  616. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +37 -26
  617. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +1 -1
  618. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +34 -23
  619. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -1
  620. package/node_modules/@anthropic-ai/sdk/lib/beta-parser.d.mts.map +1 -1
  621. package/node_modules/@anthropic-ai/sdk/lib/beta-parser.d.ts.map +1 -1
  622. package/node_modules/@anthropic-ai/sdk/lib/beta-parser.mjs.map +1 -1
  623. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.mts +39 -0
  624. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.mts.map +1 -0
  625. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.ts +39 -0
  626. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.ts.map +1 -0
  627. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js +245 -0
  628. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js.map +1 -0
  629. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs +208 -0
  630. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs.map +1 -0
  631. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.mts +11 -0
  632. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.mts.map +1 -0
  633. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.ts +11 -0
  634. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.ts.map +1 -0
  635. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js +72 -0
  636. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js.map +1 -0
  637. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs +35 -0
  638. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs.map +1 -0
  639. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.mts +40 -0
  640. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.mts.map +1 -0
  641. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.ts +40 -0
  642. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.ts.map +1 -0
  643. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.js +82 -0
  644. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.js.map +1 -0
  645. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.mjs +79 -0
  646. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.mjs.map +1 -0
  647. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.mts +54 -0
  648. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.mts.map +1 -0
  649. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.ts +54 -0
  650. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.ts.map +1 -0
  651. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.js +112 -0
  652. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.js.map +1 -0
  653. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.mjs +108 -0
  654. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.mjs.map +1 -0
  655. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts +96 -0
  656. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts.map +1 -0
  657. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts +96 -0
  658. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts.map +1 -0
  659. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js +266 -0
  660. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js.map +1 -0
  661. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs +224 -0
  662. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs.map +1 -0
  663. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.mts +21 -0
  664. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.mts.map +1 -0
  665. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.ts +21 -0
  666. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.ts.map +1 -0
  667. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js +130 -0
  668. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js.map +1 -0
  669. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs +94 -0
  670. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs.map +1 -0
  671. package/node_modules/@anthropic-ai/sdk/lib/credentials.d.mts +4 -0
  672. package/node_modules/@anthropic-ai/sdk/lib/credentials.d.mts.map +1 -0
  673. package/node_modules/@anthropic-ai/sdk/lib/credentials.d.ts +4 -0
  674. package/node_modules/@anthropic-ai/sdk/lib/credentials.d.ts.map +1 -0
  675. package/node_modules/@anthropic-ai/sdk/lib/credentials.js +8 -0
  676. package/node_modules/@anthropic-ai/sdk/lib/credentials.js.map +1 -0
  677. package/node_modules/@anthropic-ai/sdk/lib/credentials.mjs +3 -0
  678. package/node_modules/@anthropic-ai/sdk/lib/credentials.mjs.map +1 -0
  679. package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.mts +4 -0
  680. package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.mts.map +1 -0
  681. package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.ts +4 -0
  682. package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.ts.map +1 -0
  683. package/node_modules/@anthropic-ai/sdk/lib/environments/index.js +18 -0
  684. package/node_modules/@anthropic-ai/sdk/lib/environments/index.js.map +1 -0
  685. package/node_modules/@anthropic-ai/sdk/lib/environments/index.mjs +4 -0
  686. package/node_modules/@anthropic-ai/sdk/lib/environments/index.mjs.map +1 -0
  687. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.mts +95 -0
  688. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.mts.map +1 -0
  689. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.ts +95 -0
  690. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.ts.map +1 -0
  691. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.js +226 -0
  692. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.js.map +1 -0
  693. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.mjs +217 -0
  694. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.mjs.map +1 -0
  695. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.mts +227 -0
  696. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.mts.map +1 -0
  697. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.ts +227 -0
  698. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.ts.map +1 -0
  699. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.js +569 -0
  700. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.js.map +1 -0
  701. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.mjs +564 -0
  702. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.mjs.map +1 -0
  703. package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.mts +31 -0
  704. package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.mts.map +1 -0
  705. package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.ts +31 -0
  706. package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.ts.map +1 -0
  707. package/node_modules/@anthropic-ai/sdk/lib/helper-client.js +58 -0
  708. package/node_modules/@anthropic-ai/sdk/lib/helper-client.js.map +1 -0
  709. package/node_modules/@anthropic-ai/sdk/lib/helper-client.mjs +55 -0
  710. package/node_modules/@anthropic-ai/sdk/lib/helper-client.mjs.map +1 -0
  711. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts +98 -0
  712. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts.map +1 -0
  713. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts +98 -0
  714. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts.map +1 -0
  715. package/node_modules/@anthropic-ai/sdk/lib/middleware.js +754 -0
  716. package/node_modules/@anthropic-ai/sdk/lib/middleware.js.map +1 -0
  717. package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs +749 -0
  718. package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs.map +1 -0
  719. package/node_modules/@anthropic-ai/sdk/lib/parser.d.mts.map +1 -1
  720. package/node_modules/@anthropic-ai/sdk/lib/parser.d.ts.map +1 -1
  721. package/node_modules/@anthropic-ai/sdk/lib/parser.mjs.map +1 -1
  722. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts +22 -0
  723. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts.map +1 -0
  724. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts +22 -0
  725. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts.map +1 -0
  726. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js +88 -0
  727. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js.map +1 -0
  728. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs +85 -0
  729. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs.map +1 -0
  730. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.mts +38 -5
  731. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.mts.map +1 -1
  732. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.ts +38 -5
  733. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.ts.map +1 -1
  734. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.js +28 -0
  735. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.js.map +1 -1
  736. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.mjs +25 -1
  737. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.mjs.map +1 -1
  738. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts +1 -1
  739. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts.map +1 -1
  740. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts +1 -1
  741. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts.map +1 -1
  742. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js +107 -29
  743. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js.map +1 -1
  744. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs +105 -27
  745. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs.map +1 -1
  746. package/node_modules/@anthropic-ai/sdk/lib/tools/CompactionControl.d.mts.map +1 -1
  747. package/node_modules/@anthropic-ai/sdk/lib/tools/CompactionControl.d.ts.map +1 -1
  748. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.mts +179 -0
  749. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.mts.map +1 -0
  750. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.ts +179 -0
  751. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.ts.map +1 -0
  752. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.js +728 -0
  753. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.js.map +1 -0
  754. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.mjs +724 -0
  755. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.mjs.map +1 -0
  756. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.d.mts.map +1 -1
  757. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.d.ts.map +1 -1
  758. package/node_modules/@anthropic-ai/sdk/lib/transform-json-schema.mjs.map +1 -1
  759. package/node_modules/@anthropic-ai/sdk/package.json +32 -15
  760. package/node_modules/@anthropic-ai/sdk/pagination.d.mts +1 -0
  761. package/node_modules/@anthropic-ai/sdk/pagination.d.mts.map +1 -1
  762. package/node_modules/@anthropic-ai/sdk/pagination.d.ts +1 -0
  763. package/node_modules/@anthropic-ai/sdk/pagination.d.ts.map +1 -1
  764. package/node_modules/@anthropic-ai/sdk/pagination.mjs +1 -0
  765. package/node_modules/@anthropic-ai/sdk/pagination.mjs.map +1 -1
  766. package/node_modules/@anthropic-ai/sdk/resource.d.mts +1 -0
  767. package/node_modules/@anthropic-ai/sdk/resource.d.mts.map +1 -1
  768. package/node_modules/@anthropic-ai/sdk/resource.d.ts +1 -0
  769. package/node_modules/@anthropic-ai/sdk/resource.d.ts.map +1 -1
  770. package/node_modules/@anthropic-ai/sdk/resource.mjs +1 -0
  771. package/node_modules/@anthropic-ai/sdk/resource.mjs.map +1 -1
  772. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts +608 -68
  773. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts.map +1 -1
  774. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts +608 -68
  775. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts.map +1 -1
  776. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js +2 -2
  777. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js.map +1 -1
  778. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs +2 -2
  779. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs.map +1 -1
  780. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.mts +1 -1
  781. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.mts.map +1 -1
  782. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.ts +1 -1
  783. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.ts.map +1 -1
  784. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.js.map +1 -1
  785. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.mjs.map +1 -1
  786. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.d.mts.map +1 -1
  787. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.d.ts.map +1 -1
  788. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.mjs.map +1 -1
  789. package/node_modules/@anthropic-ai/sdk/resources/beta/agents.d.mts.map +1 -1
  790. package/node_modules/@anthropic-ai/sdk/resources/beta/agents.d.ts.map +1 -1
  791. package/node_modules/@anthropic-ai/sdk/resources/beta/agents.mjs.map +1 -1
  792. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts +51 -13
  793. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -1
  794. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +51 -13
  795. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -1
  796. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +22 -2
  797. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +1 -1
  798. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +22 -2
  799. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -1
  800. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts +306 -0
  801. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts.map +1 -0
  802. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts +306 -0
  803. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts.map +1 -0
  804. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.js +55 -0
  805. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.js.map +1 -0
  806. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.mjs +51 -0
  807. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.mjs.map +1 -0
  808. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts +698 -0
  809. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts.map +1 -0
  810. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts +698 -0
  811. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts.map +1 -0
  812. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.js +196 -0
  813. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.js.map +1 -0
  814. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.mjs +192 -0
  815. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.mjs.map +1 -0
  816. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts +309 -0
  817. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts.map +1 -0
  818. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts +309 -0
  819. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts.map +1 -0
  820. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.js +116 -0
  821. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.js.map +1 -0
  822. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.mjs +112 -0
  823. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.mjs.map +1 -0
  824. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts +426 -0
  825. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts.map +1 -0
  826. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts +426 -0
  827. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts.map +1 -0
  828. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js +150 -0
  829. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js.map +1 -0
  830. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs +145 -0
  831. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs.map +1 -0
  832. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.mts +3 -0
  833. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.mts.map +1 -0
  834. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.ts +3 -0
  835. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.ts.map +1 -0
  836. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.js +9 -0
  837. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.js.map +1 -0
  838. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.mjs +4 -0
  839. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.mjs.map +1 -0
  840. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.mts +501 -0
  841. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.mts.map +1 -0
  842. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.ts +501 -0
  843. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.ts.map +1 -0
  844. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.js +257 -0
  845. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.js.map +1 -0
  846. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.mjs +251 -0
  847. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.mjs.map +1 -0
  848. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.mts +1 -388
  849. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.mts.map +1 -1
  850. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.ts +1 -388
  851. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.ts.map +1 -1
  852. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.js +2 -138
  853. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.js.map +1 -1
  854. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.mjs +1 -136
  855. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.mjs.map +1 -1
  856. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts +22 -22
  857. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -1
  858. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts +22 -22
  859. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -1
  860. package/node_modules/@anthropic-ai/sdk/resources/beta/files.js +5 -5
  861. package/node_modules/@anthropic-ai/sdk/resources/beta/files.js.map +1 -1
  862. package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs +5 -5
  863. package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs.map +1 -1
  864. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +11 -6
  865. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts.map +1 -1
  866. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +11 -6
  867. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +1 -1
  868. package/node_modules/@anthropic-ai/sdk/resources/beta/index.js +23 -13
  869. package/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +1 -1
  870. package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +6 -1
  871. package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +1 -1
  872. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.mts +1 -1
  873. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.mts.map +1 -1
  874. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.ts +1 -1
  875. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.ts.map +1 -1
  876. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.js.map +1 -1
  877. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.mjs.map +1 -1
  878. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts +136 -24
  879. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts.map +1 -1
  880. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts +136 -24
  881. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts.map +1 -1
  882. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.js +10 -10
  883. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.js.map +1 -1
  884. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.mjs +10 -10
  885. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.mjs.map +1 -1
  886. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.mts +60 -16
  887. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
  888. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.ts +60 -16
  889. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
  890. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.js +12 -12
  891. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.js.map +1 -1
  892. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.mjs +12 -12
  893. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
  894. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts +105 -7
  895. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
  896. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts +105 -7
  897. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
  898. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.js +6 -6
  899. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.js.map +1 -1
  900. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.mjs +6 -6
  901. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.mjs.map +1 -1
  902. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.d.mts.map +1 -1
  903. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.d.ts.map +1 -1
  904. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.mjs.map +1 -1
  905. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts +81 -30
  906. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts.map +1 -1
  907. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts +81 -30
  908. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts.map +1 -1
  909. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js +12 -9
  910. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js.map +1 -1
  911. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs +12 -9
  912. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs.map +1 -1
  913. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts +1 -1
  914. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts.map +1 -1
  915. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts +1 -1
  916. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts.map +1 -1
  917. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js.map +1 -1
  918. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs.map +1 -1
  919. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +2453 -380
  920. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts.map +1 -1
  921. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts +2453 -380
  922. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts.map +1 -1
  923. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js +16 -22
  924. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -1
  925. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs +16 -22
  926. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -1
  927. package/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.mts.map +1 -1
  928. package/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.ts.map +1 -1
  929. package/node_modules/@anthropic-ai/sdk/resources/beta/messages.mjs.map +1 -1
  930. package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.mts +6 -0
  931. package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.mts.map +1 -1
  932. package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.ts +6 -0
  933. package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.ts.map +1 -1
  934. package/node_modules/@anthropic-ai/sdk/resources/beta/models.mjs.map +1 -1
  935. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts +643 -19
  936. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts.map +1 -1
  937. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts +643 -19
  938. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts.map +1 -1
  939. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.js +29 -2
  940. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.js.map +1 -1
  941. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.mjs +27 -1
  942. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.mjs.map +1 -1
  943. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.mts +3 -2
  944. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.mts.map +1 -1
  945. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.ts +3 -2
  946. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.ts.map +1 -1
  947. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.js +3 -1
  948. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.js.map +1 -1
  949. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.mjs +1 -0
  950. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.mjs.map +1 -1
  951. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.d.mts.map +1 -1
  952. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.d.ts.map +1 -1
  953. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.mjs.map +1 -1
  954. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts +455 -8
  955. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts.map +1 -1
  956. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts +455 -8
  957. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts.map +1 -1
  958. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.js +5 -1
  959. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.js.map +1 -1
  960. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.mjs +6 -2
  961. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.mjs.map +1 -1
  962. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.mts +78 -0
  963. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.mts.map +1 -0
  964. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.ts +78 -0
  965. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.ts.map +1 -0
  966. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.js +61 -0
  967. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.js.map +1 -0
  968. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.mjs +57 -0
  969. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.mjs.map +1 -0
  970. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.mts +3 -0
  971. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.mts.map +1 -0
  972. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.ts +3 -0
  973. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.ts.map +1 -0
  974. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.js +9 -0
  975. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.js.map +1 -0
  976. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.mjs +4 -0
  977. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.mjs.map +1 -0
  978. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts +195 -0
  979. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts.map +1 -0
  980. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts +195 -0
  981. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts.map +1 -0
  982. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js +88 -0
  983. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js.map +1 -0
  984. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs +83 -0
  985. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs.map +1 -0
  986. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.mts +2 -0
  987. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.mts.map +1 -0
  988. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.ts +2 -0
  989. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.ts.map +1 -0
  990. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.js +6 -0
  991. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.js.map +1 -0
  992. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.mjs +3 -0
  993. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.mjs.map +1 -0
  994. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.d.mts.map +1 -1
  995. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.d.ts.map +1 -1
  996. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.mjs.map +1 -1
  997. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts +1 -1
  998. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts.map +1 -1
  999. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts +1 -1
  1000. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts.map +1 -1
  1001. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.js.map +1 -1
  1002. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.mjs.map +1 -1
  1003. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts +13 -11
  1004. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts.map +1 -1
  1005. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts +13 -11
  1006. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts.map +1 -1
  1007. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js +5 -3
  1008. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js.map +1 -1
  1009. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs +5 -3
  1010. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs.map +1 -1
  1011. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts +31 -3
  1012. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts.map +1 -1
  1013. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts +31 -3
  1014. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts.map +1 -1
  1015. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js +32 -3
  1016. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js.map +1 -1
  1017. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs +32 -3
  1018. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs.map +1 -1
  1019. package/node_modules/@anthropic-ai/sdk/resources/beta/skills.d.mts.map +1 -1
  1020. package/node_modules/@anthropic-ai/sdk/resources/beta/skills.d.ts.map +1 -1
  1021. package/node_modules/@anthropic-ai/sdk/resources/beta/skills.mjs.map +1 -1
  1022. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.mts +163 -0
  1023. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.mts.map +1 -0
  1024. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.ts +163 -0
  1025. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.ts.map +1 -0
  1026. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.js +129 -0
  1027. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.js.map +1 -0
  1028. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.mjs +125 -0
  1029. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.mjs.map +1 -0
  1030. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.mts +3 -0
  1031. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.mts.map +1 -0
  1032. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.ts +3 -0
  1033. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.ts.map +1 -0
  1034. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.js +9 -0
  1035. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.js.map +1 -0
  1036. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.mjs +4 -0
  1037. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.mjs.map +1 -0
  1038. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.mts +212 -0
  1039. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.mts.map +1 -0
  1040. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.ts +212 -0
  1041. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.ts.map +1 -0
  1042. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.js +181 -0
  1043. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.js.map +1 -0
  1044. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.mjs +176 -0
  1045. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.mjs.map +1 -0
  1046. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.mts +2 -0
  1047. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.mts.map +1 -0
  1048. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.ts +2 -0
  1049. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.ts.map +1 -0
  1050. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.js +6 -0
  1051. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.js.map +1 -0
  1052. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.mjs +3 -0
  1053. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.mjs.map +1 -0
  1054. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts +62 -0
  1055. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts.map +1 -1
  1056. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts +62 -0
  1057. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts.map +1 -1
  1058. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.js +5 -5
  1059. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.mjs +5 -5
  1060. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.mjs.map +1 -1
  1061. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.mts +256 -4
  1062. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.mts.map +1 -1
  1063. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.ts +256 -4
  1064. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.ts.map +1 -1
  1065. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.js +22 -0
  1066. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.js.map +1 -1
  1067. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.mjs +22 -0
  1068. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.mjs.map +1 -1
  1069. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.mts +1 -1
  1070. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.mts.map +1 -1
  1071. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.ts +1 -1
  1072. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.ts.map +1 -1
  1073. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.js.map +1 -1
  1074. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.mjs.map +1 -1
  1075. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.mts +2 -2
  1076. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.mts.map +1 -1
  1077. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.ts +2 -2
  1078. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.ts.map +1 -1
  1079. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.js.map +1 -1
  1080. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.mjs.map +1 -1
  1081. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.d.mts.map +1 -1
  1082. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.d.ts.map +1 -1
  1083. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.mjs.map +1 -1
  1084. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts +466 -0
  1085. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts.map +1 -0
  1086. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts +466 -0
  1087. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts.map +1 -0
  1088. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js +20 -0
  1089. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js.map +1 -0
  1090. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs +16 -0
  1091. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs.map +1 -0
  1092. package/node_modules/@anthropic-ai/sdk/resources/beta.d.mts.map +1 -1
  1093. package/node_modules/@anthropic-ai/sdk/resources/beta.d.ts.map +1 -1
  1094. package/node_modules/@anthropic-ai/sdk/resources/beta.mjs.map +1 -1
  1095. package/node_modules/@anthropic-ai/sdk/resources/completions.d.mts +18 -11
  1096. package/node_modules/@anthropic-ai/sdk/resources/completions.d.mts.map +1 -1
  1097. package/node_modules/@anthropic-ai/sdk/resources/completions.d.ts +18 -11
  1098. package/node_modules/@anthropic-ai/sdk/resources/completions.d.ts.map +1 -1
  1099. package/node_modules/@anthropic-ai/sdk/resources/completions.mjs.map +1 -1
  1100. package/node_modules/@anthropic-ai/sdk/resources/files.d.mts +105 -0
  1101. package/node_modules/@anthropic-ai/sdk/resources/files.d.mts.map +1 -0
  1102. package/node_modules/@anthropic-ai/sdk/resources/files.d.ts +105 -0
  1103. package/node_modules/@anthropic-ai/sdk/resources/files.d.ts.map +1 -0
  1104. package/node_modules/@anthropic-ai/sdk/resources/files.js +52 -0
  1105. package/node_modules/@anthropic-ai/sdk/resources/files.js.map +1 -0
  1106. package/node_modules/@anthropic-ai/sdk/resources/files.mjs +48 -0
  1107. package/node_modules/@anthropic-ai/sdk/resources/files.mjs.map +1 -0
  1108. package/node_modules/@anthropic-ai/sdk/resources/index.d.mts +4 -2
  1109. package/node_modules/@anthropic-ai/sdk/resources/index.d.mts.map +1 -1
  1110. package/node_modules/@anthropic-ai/sdk/resources/index.d.ts +4 -2
  1111. package/node_modules/@anthropic-ai/sdk/resources/index.d.ts.map +1 -1
  1112. package/node_modules/@anthropic-ai/sdk/resources/index.js +5 -1
  1113. package/node_modules/@anthropic-ai/sdk/resources/index.js.map +1 -1
  1114. package/node_modules/@anthropic-ai/sdk/resources/index.mjs +2 -0
  1115. package/node_modules/@anthropic-ai/sdk/resources/index.mjs.map +1 -1
  1116. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.mts +20 -11
  1117. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.mts.map +1 -1
  1118. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts +20 -11
  1119. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts.map +1 -1
  1120. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.js +17 -9
  1121. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.js.map +1 -1
  1122. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs +17 -9
  1123. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs.map +1 -1
  1124. package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.mts +1 -1
  1125. package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.mts.map +1 -1
  1126. package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts +1 -1
  1127. package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts.map +1 -1
  1128. package/node_modules/@anthropic-ai/sdk/resources/messages/index.js.map +1 -1
  1129. package/node_modules/@anthropic-ai/sdk/resources/messages/index.mjs.map +1 -1
  1130. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1782 -162
  1131. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts.map +1 -1
  1132. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts +1782 -162
  1133. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts.map +1 -1
  1134. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js +23 -28
  1135. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js.map +1 -1
  1136. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs +23 -28
  1137. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -1
  1138. package/node_modules/@anthropic-ai/sdk/resources/messages.d.mts.map +1 -1
  1139. package/node_modules/@anthropic-ai/sdk/resources/messages.d.ts.map +1 -1
  1140. package/node_modules/@anthropic-ai/sdk/resources/messages.mjs.map +1 -1
  1141. package/node_modules/@anthropic-ai/sdk/resources/models.d.mts.map +1 -1
  1142. package/node_modules/@anthropic-ai/sdk/resources/models.d.ts.map +1 -1
  1143. package/node_modules/@anthropic-ai/sdk/resources/models.mjs.map +1 -1
  1144. package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.mts +3 -0
  1145. package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.mts.map +1 -0
  1146. package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.ts +3 -0
  1147. package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.ts.map +1 -0
  1148. package/node_modules/@anthropic-ai/sdk/resources/skills/index.js +9 -0
  1149. package/node_modules/@anthropic-ai/sdk/resources/skills/index.js.map +1 -0
  1150. package/node_modules/@anthropic-ai/sdk/resources/skills/index.mjs +4 -0
  1151. package/node_modules/@anthropic-ai/sdk/resources/skills/index.mjs.map +1 -0
  1152. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.mts +129 -0
  1153. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.mts.map +1 -0
  1154. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.ts +129 -0
  1155. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.ts.map +1 -0
  1156. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.js +44 -0
  1157. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.js.map +1 -0
  1158. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.mjs +39 -0
  1159. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.mjs.map +1 -0
  1160. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.mts +104 -0
  1161. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.mts.map +1 -0
  1162. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.ts +104 -0
  1163. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.ts.map +1 -0
  1164. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.js +41 -0
  1165. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.js.map +1 -0
  1166. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.mjs +37 -0
  1167. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.mjs.map +1 -0
  1168. package/node_modules/@anthropic-ai/sdk/resources/skills.d.mts +2 -0
  1169. package/node_modules/@anthropic-ai/sdk/resources/skills.d.mts.map +1 -0
  1170. package/node_modules/@anthropic-ai/sdk/resources/skills.d.ts +2 -0
  1171. package/node_modules/@anthropic-ai/sdk/resources/skills.d.ts.map +1 -0
  1172. package/node_modules/@anthropic-ai/sdk/resources/skills.js +6 -0
  1173. package/node_modules/@anthropic-ai/sdk/resources/skills.js.map +1 -0
  1174. package/node_modules/@anthropic-ai/sdk/resources/skills.mjs +3 -0
  1175. package/node_modules/@anthropic-ai/sdk/resources/skills.mjs.map +1 -0
  1176. package/node_modules/@anthropic-ai/sdk/resources.d.mts.map +1 -1
  1177. package/node_modules/@anthropic-ai/sdk/resources.d.ts.map +1 -1
  1178. package/node_modules/@anthropic-ai/sdk/resources.mjs.map +1 -1
  1179. package/node_modules/@anthropic-ai/sdk/src/_vendor/partial-json-parser/parser.ts +18 -2
  1180. package/node_modules/@anthropic-ai/sdk/src/client.ts +749 -42
  1181. package/node_modules/@anthropic-ai/sdk/src/core/api-promise.ts +14 -4
  1182. package/node_modules/@anthropic-ai/sdk/src/core/api.ts +11 -0
  1183. package/node_modules/@anthropic-ai/sdk/src/core/credentials.ts +379 -0
  1184. package/node_modules/@anthropic-ai/sdk/src/core/error.ts +17 -0
  1185. package/node_modules/@anthropic-ai/sdk/src/core/middleware.ts +339 -0
  1186. package/node_modules/@anthropic-ai/sdk/src/core/pagination.ts +60 -0
  1187. package/node_modules/@anthropic-ai/sdk/src/core/streaming.ts +38 -1
  1188. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/environments.ts +34 -0
  1189. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/json-schema.ts +7 -0
  1190. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/mcp.ts +1 -1
  1191. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/zod.ts +14 -10
  1192. package/node_modules/@anthropic-ai/sdk/src/helpers/zod.ts +3 -6
  1193. package/node_modules/@anthropic-ai/sdk/src/index.ts +16 -1
  1194. package/node_modules/@anthropic-ai/sdk/src/internal/constants.ts +0 -5
  1195. package/node_modules/@anthropic-ai/sdk/src/internal/file-store.ts +550 -0
  1196. package/node_modules/@anthropic-ai/sdk/src/internal/headers.ts +47 -4
  1197. package/node_modules/@anthropic-ai/sdk/src/internal/message-stream-utils.ts +30 -0
  1198. package/node_modules/@anthropic-ai/sdk/src/internal/parse.ts +16 -11
  1199. package/node_modules/@anthropic-ai/sdk/src/internal/qs/LICENSE.md +13 -0
  1200. package/node_modules/@anthropic-ai/sdk/src/internal/qs/README.md +3 -0
  1201. package/node_modules/@anthropic-ai/sdk/src/internal/qs/formats.ts +10 -0
  1202. package/node_modules/@anthropic-ai/sdk/src/internal/qs/index.ts +13 -0
  1203. package/node_modules/@anthropic-ai/sdk/src/internal/qs/stringify.ts +385 -0
  1204. package/node_modules/@anthropic-ai/sdk/src/internal/qs/types.ts +71 -0
  1205. package/node_modules/@anthropic-ai/sdk/src/internal/qs/utils.ts +265 -0
  1206. package/node_modules/@anthropic-ai/sdk/src/internal/request-options.ts +55 -2
  1207. package/node_modules/@anthropic-ai/sdk/src/internal/request-signal.ts +68 -0
  1208. package/node_modules/@anthropic-ai/sdk/src/internal/stainless-helper-header.ts +122 -0
  1209. package/node_modules/@anthropic-ai/sdk/src/internal/utils/abort.ts +21 -0
  1210. package/node_modules/@anthropic-ai/sdk/src/internal/utils/async-queue.ts +66 -0
  1211. package/node_modules/@anthropic-ai/sdk/src/internal/utils/backoff.ts +41 -0
  1212. package/node_modules/@anthropic-ai/sdk/src/internal/utils/log.ts +41 -10
  1213. package/node_modules/@anthropic-ai/sdk/src/internal/utils/promise.ts +18 -0
  1214. package/node_modules/@anthropic-ai/sdk/src/internal/utils/query.ts +2 -18
  1215. package/node_modules/@anthropic-ai/sdk/src/internal/utils/sleep.ts +25 -2
  1216. package/node_modules/@anthropic-ai/sdk/src/internal/utils/time.ts +4 -0
  1217. package/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +72 -33
  1218. package/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +36 -24
  1219. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/credential-chain.ts +292 -0
  1220. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/identity-token.ts +37 -0
  1221. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/oidc-federation.ts +140 -0
  1222. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/token-cache.ts +130 -0
  1223. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/types.ts +295 -0
  1224. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/user-oauth.ts +144 -0
  1225. package/node_modules/@anthropic-ai/sdk/src/lib/credentials.ts +3 -0
  1226. package/node_modules/@anthropic-ai/sdk/src/lib/environments/index.ts +23 -0
  1227. package/node_modules/@anthropic-ai/sdk/src/lib/environments/poller.ts +299 -0
  1228. package/node_modules/@anthropic-ai/sdk/src/lib/environments/worker.ts +779 -0
  1229. package/node_modules/@anthropic-ai/sdk/src/lib/helper-client.ts +86 -0
  1230. package/node_modules/@anthropic-ai/sdk/src/lib/middleware.ts +994 -0
  1231. package/node_modules/@anthropic-ai/sdk/src/lib/sessions/accumulate.ts +130 -0
  1232. package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaRunnableTool.ts +71 -7
  1233. package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts +135 -35
  1234. package/node_modules/@anthropic-ai/sdk/src/lib/tools/SessionToolRunner.ts +885 -0
  1235. package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/agents.ts +806 -69
  1236. package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/index.ts +34 -0
  1237. package/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +690 -28
  1238. package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployment-runs.ts +441 -0
  1239. package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployments.ts +996 -0
  1240. package/node_modules/@anthropic-ai/sdk/src/resources/beta/dreams.ts +453 -0
  1241. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/environments.ts +626 -0
  1242. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/index.ts +42 -0
  1243. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/work.ts +705 -0
  1244. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments.ts +1 -540
  1245. package/node_modules/@anthropic-ai/sdk/src/resources/beta/files.ts +28 -28
  1246. package/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +312 -5
  1247. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/index.ts +1 -0
  1248. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memories.ts +141 -31
  1249. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-stores.ts +66 -20
  1250. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-versions.ts +112 -9
  1251. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/batches.ts +90 -33
  1252. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/index.ts +90 -0
  1253. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts +2755 -211
  1254. package/node_modules/@anthropic-ai/sdk/src/resources/beta/models.ts +7 -0
  1255. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/events.ts +888 -18
  1256. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/index.ts +60 -1
  1257. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/sessions.ts +669 -14
  1258. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/events.ts +123 -0
  1259. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/index.ts +15 -0
  1260. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/threads.ts +330 -0
  1261. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads.ts +3 -0
  1262. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/index.ts +1 -0
  1263. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/skills.ts +15 -14
  1264. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/versions.ts +49 -3
  1265. package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/certificates.ts +252 -0
  1266. package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/index.ts +23 -0
  1267. package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/tunnels.ts +347 -0
  1268. package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels.ts +3 -0
  1269. package/node_modules/@anthropic-ai/sdk/src/resources/beta/user-profiles.ts +76 -5
  1270. package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/credentials.ts +347 -3
  1271. package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/index.ts +17 -0
  1272. package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/vaults.ts +34 -0
  1273. package/node_modules/@anthropic-ai/sdk/src/resources/beta/webhooks.ts +762 -0
  1274. package/node_modules/@anthropic-ai/sdk/src/resources/completions.ts +18 -11
  1275. package/node_modules/@anthropic-ai/sdk/src/resources/files.ts +163 -0
  1276. package/node_modules/@anthropic-ai/sdk/src/resources/index.ts +89 -0
  1277. package/node_modules/@anthropic-ai/sdk/src/resources/messages/batches.ts +30 -12
  1278. package/node_modules/@anthropic-ai/sdk/src/resources/messages/index.ts +70 -0
  1279. package/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +2202 -226
  1280. package/node_modules/@anthropic-ai/sdk/src/resources/skills/index.ts +21 -0
  1281. package/node_modules/@anthropic-ai/sdk/src/resources/skills/skills.ts +194 -0
  1282. package/node_modules/@anthropic-ai/sdk/src/resources/skills/versions.ts +160 -0
  1283. package/node_modules/@anthropic-ai/sdk/src/resources/skills.ts +3 -0
  1284. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/fs-util.ts +190 -0
  1285. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/memories.ts +1017 -0
  1286. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.browser.ts +172 -0
  1287. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.ts +914 -0
  1288. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/skills.ts +372 -0
  1289. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/sync-interval.ts +30 -0
  1290. package/node_modules/@anthropic-ai/sdk/src/tools/memory/node.browser.ts +64 -0
  1291. package/node_modules/@anthropic-ai/sdk/src/version.ts +1 -1
  1292. package/node_modules/@anthropic-ai/sdk/streaming.d.mts +1 -0
  1293. package/node_modules/@anthropic-ai/sdk/streaming.d.mts.map +1 -1
  1294. package/node_modules/@anthropic-ai/sdk/streaming.d.ts +1 -0
  1295. package/node_modules/@anthropic-ai/sdk/streaming.d.ts.map +1 -1
  1296. package/node_modules/@anthropic-ai/sdk/streaming.mjs +1 -0
  1297. package/node_modules/@anthropic-ai/sdk/streaming.mjs.map +1 -1
  1298. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts +75 -0
  1299. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts.map +1 -0
  1300. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts +75 -0
  1301. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts.map +1 -0
  1302. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js +196 -0
  1303. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js.map +1 -0
  1304. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs +185 -0
  1305. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs.map +1 -0
  1306. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts +173 -0
  1307. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts.map +1 -0
  1308. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts +173 -0
  1309. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts.map +1 -0
  1310. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js +902 -0
  1311. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js.map +1 -0
  1312. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs +895 -0
  1313. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs.map +1 -0
  1314. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts +82 -0
  1315. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts.map +1 -0
  1316. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts +82 -0
  1317. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts.map +1 -0
  1318. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js +151 -0
  1319. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js.map +1 -0
  1320. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs +131 -0
  1321. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs.map +1 -0
  1322. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts +190 -0
  1323. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts.map +1 -0
  1324. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts +190 -0
  1325. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts.map +1 -0
  1326. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js +819 -0
  1327. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js.map +1 -0
  1328. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs +797 -0
  1329. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs.map +1 -0
  1330. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts +82 -0
  1331. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts.map +1 -0
  1332. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts +82 -0
  1333. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts.map +1 -0
  1334. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js +352 -0
  1335. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js.map +1 -0
  1336. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs +344 -0
  1337. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs.map +1 -0
  1338. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.mts +19 -0
  1339. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.mts.map +1 -0
  1340. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.ts +19 -0
  1341. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.ts.map +1 -0
  1342. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.js +29 -0
  1343. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.js.map +1 -0
  1344. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.mjs +25 -0
  1345. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.mjs.map +1 -0
  1346. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.mts +27 -0
  1347. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.mts.map +1 -0
  1348. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.ts +27 -0
  1349. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.ts.map +1 -0
  1350. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.js +49 -0
  1351. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.js.map +1 -0
  1352. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.mjs +44 -0
  1353. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.mjs.map +1 -0
  1354. package/node_modules/@anthropic-ai/sdk/tools/memory/node.d.mts.map +1 -1
  1355. package/node_modules/@anthropic-ai/sdk/tools/memory/node.d.ts.map +1 -1
  1356. package/node_modules/@anthropic-ai/sdk/tools/memory/node.mjs.map +1 -1
  1357. package/node_modules/@anthropic-ai/sdk/uploads.d.mts +1 -0
  1358. package/node_modules/@anthropic-ai/sdk/uploads.d.mts.map +1 -1
  1359. package/node_modules/@anthropic-ai/sdk/uploads.d.ts +1 -0
  1360. package/node_modules/@anthropic-ai/sdk/uploads.d.ts.map +1 -1
  1361. package/node_modules/@anthropic-ai/sdk/uploads.mjs +1 -0
  1362. package/node_modules/@anthropic-ai/sdk/uploads.mjs.map +1 -1
  1363. package/node_modules/@anthropic-ai/sdk/version.d.mts +1 -1
  1364. package/node_modules/@anthropic-ai/sdk/version.d.mts.map +1 -1
  1365. package/node_modules/@anthropic-ai/sdk/version.d.ts +1 -1
  1366. package/node_modules/@anthropic-ai/sdk/version.d.ts.map +1 -1
  1367. package/node_modules/@anthropic-ai/sdk/version.js +1 -1
  1368. package/node_modules/@anthropic-ai/sdk/version.js.map +1 -1
  1369. package/node_modules/@anthropic-ai/sdk/version.mjs +1 -1
  1370. package/node_modules/@anthropic-ai/sdk/version.mjs.map +1 -1
  1371. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +24 -0
  1372. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  1373. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager-proxy.ts +39 -5
  1374. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  1375. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +7 -4
  1376. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  1377. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +2 -3
  1378. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  1379. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +7 -6
  1380. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  1381. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts +4 -0
  1382. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts.map +1 -1
  1383. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js +8 -0
  1384. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js.map +1 -1
  1385. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +1 -0
  1386. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  1387. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +1 -0
  1388. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  1389. package/node_modules/@earendil-works/pi-agent-core/package.json +5 -5
  1390. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +1 -5
  1391. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  1392. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +25 -13
  1393. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  1394. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  1395. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +2 -1
  1396. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  1397. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  1398. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +91 -5
  1399. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  1400. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
  1401. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +4 -2
  1402. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
  1403. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
  1404. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +4 -2
  1405. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
  1406. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  1407. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +2 -0
  1408. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  1409. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  1410. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +93 -54
  1411. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  1412. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +2 -5
  1413. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  1414. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js +1 -1
  1415. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js.map +1 -1
  1416. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts.map +1 -1
  1417. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js +97 -46
  1418. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js.map +1 -1
  1419. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts.map +1 -1
  1420. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +1 -14
  1421. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js.map +1 -1
  1422. package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts +50 -0
  1423. package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts.map +1 -0
  1424. package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js +129 -0
  1425. package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js.map +1 -0
  1426. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
  1427. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +3 -1
  1428. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
  1429. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +8 -1
  1430. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  1431. package/node_modules/@earendil-works/pi-ai/dist/models.js +16 -3
  1432. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  1433. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts +3 -1
  1434. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
  1435. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +10 -1
  1436. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js.map +1 -1
  1437. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  1438. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  1439. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  1440. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  1441. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  1442. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  1443. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  1444. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  1445. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  1446. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opengateway.json +1 -1
  1447. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  1448. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  1449. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  1450. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  1451. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +1 -0
  1452. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  1453. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +1 -0
  1454. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  1455. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts.map +1 -1
  1456. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +4 -0
  1457. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js.map +1 -1
  1458. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +8 -1
  1459. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  1460. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  1461. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +16 -0
  1462. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  1463. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +17 -1
  1464. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
  1465. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.d.ts +14 -0
  1466. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.d.ts.map +1 -0
  1467. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.js +24 -0
  1468. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.js.map +1 -0
  1469. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.d.ts +36 -0
  1470. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.d.ts.map +1 -0
  1471. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.js +109 -0
  1472. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.js.map +1 -0
  1473. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.d.ts +12 -0
  1474. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.d.ts.map +1 -0
  1475. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.js +109 -0
  1476. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.js.map +1 -0
  1477. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.d.ts +9 -0
  1478. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.d.ts.map +1 -0
  1479. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.js +6 -0
  1480. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.js.map +1 -0
  1481. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.d.ts +46 -0
  1482. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.d.ts.map +1 -0
  1483. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.js +41 -0
  1484. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.js.map +1 -0
  1485. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.d.ts +4 -0
  1486. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.d.ts.map +1 -0
  1487. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.js +93 -0
  1488. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.js.map +1 -0
  1489. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts +121 -0
  1490. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts.map +1 -0
  1491. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.js +11 -0
  1492. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.js.map +1 -0
  1493. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +12 -0
  1494. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  1495. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +25 -5
  1496. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  1497. package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.d.ts +2 -0
  1498. package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.d.ts.map +1 -0
  1499. package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.js +15 -0
  1500. package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.js.map +1 -0
  1501. package/node_modules/@earendil-works/pi-ai/package.json +21 -17
  1502. package/node_modules/@earendil-works/pi-pty/dist/index.d.ts +1 -0
  1503. package/node_modules/@earendil-works/pi-pty/dist/index.d.ts.map +1 -1
  1504. package/node_modules/@earendil-works/pi-pty/dist/index.js +1 -0
  1505. package/node_modules/@earendil-works/pi-pty/dist/index.js.map +1 -1
  1506. package/node_modules/@earendil-works/pi-pty/dist/session-bun.d.ts +30 -0
  1507. package/node_modules/@earendil-works/pi-pty/dist/session-bun.d.ts.map +1 -0
  1508. package/node_modules/@earendil-works/pi-pty/dist/session-bun.js +76 -0
  1509. package/node_modules/@earendil-works/pi-pty/dist/session-bun.js.map +1 -0
  1510. package/node_modules/@earendil-works/pi-pty/dist/session-types.d.ts +3 -1
  1511. package/node_modules/@earendil-works/pi-pty/dist/session-types.d.ts.map +1 -1
  1512. package/node_modules/@earendil-works/pi-pty/dist/session-types.js.map +1 -1
  1513. package/node_modules/@earendil-works/pi-pty/dist/session.d.ts +2 -0
  1514. package/node_modules/@earendil-works/pi-pty/dist/session.d.ts.map +1 -1
  1515. package/node_modules/@earendil-works/pi-pty/dist/session.js +19 -9
  1516. package/node_modules/@earendil-works/pi-pty/dist/session.js.map +1 -1
  1517. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  1518. package/node_modules/@earendil-works/pi-telemetry/package.json +3 -3
  1519. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
  1520. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +9 -4
  1521. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
  1522. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +8 -2
  1523. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
  1524. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +24 -4
  1525. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
  1526. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +2 -2
  1527. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +2 -2
  1528. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  1529. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -1
  1530. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +2 -8
  1531. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -1
  1532. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.d.ts +7 -0
  1533. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.d.ts.map +1 -0
  1534. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.js +19 -0
  1535. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.js.map +1 -0
  1536. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  1537. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +4 -10
  1538. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  1539. package/node_modules/@earendil-works/pi-tui/package.json +5 -5
  1540. package/node_modules/@stablelib/base64/LICENSE +21 -0
  1541. package/node_modules/@stablelib/base64/base64.bench.ts +25 -0
  1542. package/node_modules/@stablelib/base64/base64.test.ts +85 -0
  1543. package/node_modules/@stablelib/base64/base64.ts +283 -0
  1544. package/node_modules/@stablelib/base64/lib/base64.bench.d.ts +1 -0
  1545. package/node_modules/@stablelib/base64/lib/base64.bench.js +23 -0
  1546. package/node_modules/@stablelib/base64/lib/base64.bench.js.map +1 -0
  1547. package/node_modules/@stablelib/base64/lib/base64.d.ts +34 -0
  1548. package/node_modules/@stablelib/base64/lib/base64.js +282 -0
  1549. package/node_modules/@stablelib/base64/lib/base64.js.map +1 -0
  1550. package/node_modules/@stablelib/base64/lib/base64.test.d.ts +1 -0
  1551. package/node_modules/@stablelib/base64/lib/base64.test.js +82 -0
  1552. package/node_modules/@stablelib/base64/lib/base64.test.js.map +1 -0
  1553. package/node_modules/@stablelib/base64/package.json +25 -0
  1554. package/node_modules/@stablelib/base64/tsconfig.json +27 -0
  1555. package/node_modules/fast-sha256/LICENSE +24 -0
  1556. package/node_modules/fast-sha256/README.md +127 -0
  1557. package/node_modules/fast-sha256/package.json +42 -0
  1558. package/node_modules/fast-sha256/sha256.d.ts +39 -0
  1559. package/node_modules/fast-sha256/sha256.js +427 -0
  1560. package/node_modules/fast-sha256/sha256.min.js +1 -0
  1561. package/node_modules/standardwebhooks/README.md +41 -0
  1562. package/node_modules/standardwebhooks/dist/index.d.ts +24 -0
  1563. package/node_modules/standardwebhooks/dist/index.js +106 -0
  1564. package/node_modules/standardwebhooks/dist/index.js.map +1 -0
  1565. package/node_modules/standardwebhooks/dist/timing_safe_equal.d.ts +1 -0
  1566. package/node_modules/standardwebhooks/dist/timing_safe_equal.js +30 -0
  1567. package/node_modules/standardwebhooks/dist/timing_safe_equal.js.map +1 -0
  1568. package/node_modules/standardwebhooks/package.json +45 -0
  1569. package/package.json +100 -89
  1570. package/dist/core/radius.d.ts +0 -2
  1571. package/dist/core/radius.d.ts.map +0 -1
  1572. package/dist/core/radius.js +0 -2
  1573. package/dist/core/radius.js.map +0 -1
  1574. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.mts +0 -34
  1575. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.mts.map +0 -1
  1576. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.ts +0 -34
  1577. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.ts.map +0 -1
  1578. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.js.map +0 -1
  1579. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.mjs.map +0 -1
  1580. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.mts +0 -132
  1581. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.mts.map +0 -1
  1582. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.ts +0 -132
  1583. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.ts.map +0 -1
  1584. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.js +0 -294
  1585. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.js.map +0 -1
  1586. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.mjs +0 -290
  1587. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.mjs.map +0 -1
  1588. package/node_modules/@anthropic-ai/sdk/src/lib/stainless-helper-header.ts +0 -80
  1589. package/node_modules/@anthropic-ai/sdk/src/lib/tools/ToolRunner.ts +0 -381
@@ -4,7 +4,7 @@ import { splitDeferredTools } from "../utils/deferred-tools.js";
4
4
  import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
5
5
  import { AssistantMessageEventStream } from "../utils/event-stream.js";
6
6
  import { headersToRecord } from "../utils/headers.js";
7
- import { forcePiUserAgent } from "../utils/pi-user-agent.js";
7
+ import { getPiUserAgent } from "../utils/pi-user-agent.js";
8
8
  import { getProviderEnvValue } from "../utils/provider-env.js";
9
9
  import { retryProviderRequest } from "../utils/provider-retry.js";
10
10
  import { isCloudflareProvider, resolveCloudflareBaseUrl } from "./cloudflare.js";
@@ -234,7 +234,7 @@ export const streamSimple = (model, context, options) => {
234
234
  };
235
235
  function createClient(model, context, apiKey, optionsHeaders, fetch, sessionId, env) {
236
236
  const compat = getCompat(model, env);
237
- const headers = { ...model.headers };
237
+ const headers = { "User-Agent": getPiUserAgent(), ...model.headers };
238
238
  if (model.provider === "github-copilot") {
239
239
  const hasImages = hasCopilotVisionInput(context.messages);
240
240
  const copilotHeaders = buildCopilotDynamicHeaders({
@@ -258,9 +258,6 @@ function createClient(model, context, apiKey, optionsHeaders, fetch, sessionId,
258
258
  if (optionsHeaders) {
259
259
  Object.assign(headers, optionsHeaders);
260
260
  }
261
- if (model.provider === "xai") {
262
- forcePiUserAgent(headers);
263
- }
264
261
  return new OpenAI({
265
262
  apiKey,
266
263
  baseURL: isCloudflareProvider(model.provider) ? resolveCloudflareBaseUrl(model, env) : model.baseUrl,
@@ -1 +1 @@
1
- {"version":3,"file":"openai-responses.js","sourceRoot":"","sources":["../../src/api/openai-responses.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAA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MAAM,CAAC,cAAc,CAAC,CAAC;IAC/B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,gCAAgC,CAAC,CAAC;IAC7D,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,SAAS,4BAA4B,CACpC,KAA4C,EAC5C,WAAsE;IAEtE,QAAQ,WAAW,EAAE,CAAC;QACrB,KAAK,MAAM;YACV,OAAO,GAAG,CAAC;QACZ,KAAK,UAAU;YACd,OAAO,KAAK,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC;YACC,OAAO,CAAC,CAAC;IACX,CAAC;AACF,CAAC;AAED,SAAS,uBAAuB,CAC/B,KAAY,EACZ,WAAsE,EACtE,KAA4C;IAE5C,MAAM,UAAU,GAAG,4BAA4B,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACpE,IAAI,UAAU,KAAK,CAAC;QAAE,OAAO;IAE7B,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC;IAC/B,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC;IAChC,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC;IACpC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;AACxG,CAAC","sourcesContent":["import OpenAI from \"openai\";\nimport type { ResponseCreateParamsStreaming, ResponseStreamEvent } from \"openai/resources/responses/responses.js\";\nimport { clampThinkingLevel, supportsMax, supportsXhigh } from \"../models.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tCacheRetention,\n\tContext,\n\tModel,\n\tOpenAIResponsesCompat,\n\tProviderEnv,\n\tProviderHeaders,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tUsage,\n} from \"../types.ts\";\nimport { splitDeferredTools } from \"../utils/deferred-tools.ts\";\nimport { formatProviderError, normalizeProviderError } from \"../utils/error-body.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { headersToRecord } from \"../utils/headers.ts\";\nimport { forcePiUserAgent } from \"../utils/pi-user-agent.ts\";\nimport { getProviderEnvValue } from \"../utils/provider-env.ts\";\nimport { retryProviderRequest } from \"../utils/provider-retry.ts\";\nimport { isCloudflareProvider, resolveCloudflareBaseUrl } from \"./cloudflare.ts\";\nimport { createGrammarToolInputProperties } from \"./constrained-sampling.ts\";\nimport { buildCopilotDynamicHeaders, hasCopilotVisionInput } from \"./github-copilot-headers.ts\";\nimport { resolveOpenAIClientAuth } from \"./openai-client-auth.ts\";\nimport { clampOpenAIPromptCacheKey } from \"./openai-prompt-cache.ts\";\nimport { convertResponsesMessages, convertResponsesTools, processResponsesStream } from \"./openai-responses-shared.ts\";\nimport { buildBaseOptions, clampMaxForOpenAI, OPENAI_RESPONSES_RESERVED_BODY_KEYS } from \"./simple-options.ts\";\n\nconst OPENAI_TOOL_CALL_PROVIDERS = new Set([\"openai\", \"openai-codex\", \"opencode\"]);\nconst OPENAI_BETA_RESPONSES_WEBSOCKETS = \"responses_websockets=2026-02-06\";\nconst OPENAI_WEB_SEARCH_SOURCES_INCLUDE = \"web_search_call.action.sources\";\nconst SESSION_WEBSOCKET_CACHE_TTL_MS = 5 * 60 * 1000;\n// OpenAI Responses rejects max_output_tokens below 16: https://github.com/earendil-works/pi/issues/6265\nconst OPENAI_RESPONSES_MIN_OUTPUT_TOKENS = 16;\n\ntype WebSocketEventType = \"open\" | \"message\" | \"error\" | \"close\";\ntype WebSocketListener = (event: unknown) => void;\n\ninterface WebSocketLike {\n\tclose(code?: number, reason?: string): void;\n\tsend(data: string): void;\n\taddEventListener(type: WebSocketEventType, listener: WebSocketListener): void;\n\tremoveEventListener(type: WebSocketEventType, listener: WebSocketListener): void;\n}\n\ninterface CachedWebSocketConnection {\n\tsocket: WebSocketLike;\n\tbusy: boolean;\n\tidleTimer?: ReturnType<typeof setTimeout>;\n}\n\ntype WebSocketConstructor = new (\n\turl: string,\n\tprotocols?: string | string[] | { headers?: Record<string, string> },\n) => WebSocketLike;\n\ntype MutableResponsesPayload = ResponseCreateParamsStreaming & {\n\tprompt_cache_options?: { mode?: \"explicit\" | \"implicit\" };\n};\n\nconst websocketSessionCache = new Map<string, CachedWebSocketConnection>();\n\nfunction detectSessionAffinityFormat(model: Pick<Model<\"openai-responses\">, \"provider\" | \"baseUrl\">) {\n\treturn model.provider === \"openrouter\" || model.baseUrl.includes(\"openrouter.ai\") ? \"openrouter\" : \"openai\";\n}\n\n/**\n * Resolve cache retention preference.\n * Defaults to \"short\" and uses PI_CACHE_RETENTION for backward compatibility.\n */\nfunction resolveCacheRetention(cacheRetention?: CacheRetention, env?: ProviderEnv): CacheRetention {\n\tif (cacheRetention) {\n\t\treturn cacheRetention;\n\t}\n\tif (getProviderEnvValue(\"PI_CACHE_RETENTION\", env) === \"long\") {\n\t\treturn \"long\";\n\t}\n\treturn \"short\";\n}\n\nfunction getCompat(model: Model<\"openai-responses\">, env?: ProviderEnv): Required<OpenAIResponsesCompat> {\n\tconst isNativeEndpoint = isOpenAIResponsesNativeEndpoint(model, env);\n\treturn {\n\t\tsupportsDeveloperRole: model.compat?.supportsDeveloperRole ?? true,\n\t\tsessionAffinityFormat: model.compat?.sessionAffinityFormat ?? detectSessionAffinityFormat(model),\n\t\tsupportsLongCacheRetention: model.compat?.supportsLongCacheRetention ?? true,\n\t\tsupportsWebSocket: model.compat?.supportsWebSocket ?? isNativeEndpoint,\n\t\tsupportsRemoteCompactionV2: model.compat?.supportsRemoteCompactionV2 ?? isNativeEndpoint,\n\t\tsupportsWebSearchPreview: model.compat?.supportsWebSearchPreview ?? isNativeEndpoint,\n\t\tsupportsImageGeneration: model.compat?.supportsImageGeneration ?? isNativeEndpoint,\n\t\tsupportsStrictMode: model.compat?.supportsStrictMode ?? false,\n\t\tsupportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false,\n\t\tsupportsAdditionalTools: model.compat?.supportsAdditionalTools ?? false,\n\t\tsupportsToolSearch: model.compat?.supportsToolSearch ?? false,\n\t\tsupportsExplicitPromptCacheMode: model.compat?.supportsExplicitPromptCacheMode ?? false,\n\t};\n}\n\nfunction isOpenAIResponsesNativeEndpoint(model: Model<\"openai-responses\">, env?: ProviderEnv): boolean {\n\tconst baseUrl = isCloudflareProvider(model.provider) ? resolveCloudflareBaseUrl(model, env) : model.baseUrl;\n\ttry {\n\t\treturn new URL(baseUrl || \"https://api.openai.com/v1\").hostname === \"api.openai.com\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction getPromptCacheRetention(\n\tcompat: Required<OpenAIResponsesCompat>,\n\tcacheRetention: CacheRetention,\n): \"24h\" | undefined {\n\treturn cacheRetention === \"long\" && compat.supportsLongCacheRetention ? \"24h\" : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isOpenAiWebSearchPreviewTool(value: unknown): boolean {\n\treturn isRecord(value) && (value.type === \"web_search_preview\" || value.type === \"web_search_preview_2025_03_11\");\n}\n\nfunction sanitizeUnsupportedNativeTools(\n\tparams: MutableResponsesPayload,\n\tcompat: Required<OpenAIResponsesCompat>,\n): MutableResponsesPayload {\n\tif (compat.supportsWebSearchPreview) {\n\t\treturn params;\n\t}\n\n\tconst payload = params as MutableResponsesPayload;\n\tlet sanitized: MutableResponsesPayload | undefined;\n\tconst nextPayload = (): MutableResponsesPayload => {\n\t\tsanitized ??= { ...payload };\n\t\treturn sanitized;\n\t};\n\n\tif (Array.isArray(payload.tools)) {\n\t\tconst tools = payload.tools.filter((tool) => !isOpenAiWebSearchPreviewTool(tool));\n\t\tif (tools.length !== payload.tools.length) {\n\t\t\tconst next = nextPayload();\n\t\t\tif (tools.length > 0) {\n\t\t\t\tnext.tools = tools;\n\t\t\t} else {\n\t\t\t\tdelete next.tools;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (Array.isArray(payload.include)) {\n\t\tconst include = payload.include.filter((value) => value !== OPENAI_WEB_SEARCH_SOURCES_INCLUDE);\n\t\tif (include.length !== payload.include.length) {\n\t\t\tconst next = nextPayload();\n\t\t\tif (include.length > 0) {\n\t\t\t\tnext.include = include;\n\t\t\t} else {\n\t\t\t\tdelete next.include;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (isOpenAiWebSearchPreviewTool(payload.tool_choice)) {\n\t\tdelete nextPayload().tool_choice;\n\t}\n\n\treturn sanitized ? (sanitized as ResponseCreateParamsStreaming) : params;\n}\n\nfunction formatOpenAIResponsesError(error: unknown): string {\n\treturn formatProviderError(normalizeProviderError(error), \"OpenAI API error\");\n}\n\n// OpenAI Responses-specific options\nexport interface OpenAIResponsesOptions extends StreamOptions {\n\treasoningEffort?: \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\treasoningSummary?: \"auto\" | \"detailed\" | \"concise\" | null;\n\tserviceTier?: ResponseCreateParamsStreaming[\"service_tier\"];\n\ttoolChoice?: ResponseCreateParamsStreaming[\"tool_choice\"];\n}\n\n/**\n * Generate function for OpenAI Responses API\n */\nexport const stream: StreamFunction<\"openai-responses\", OpenAIResponsesOptions> = (\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\toptions?: OpenAIResponsesOptions,\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\n\t// Start async processing\n\t(async () => {\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: model.api as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"pending\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\ttry {\n\t\t\tconst clientAuth = resolveOpenAIClientAuth(model.provider, options?.apiKey, options?.headers);\n\t\t\tconst cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);\n\t\t\tconst cacheSessionId = cacheRetention === \"none\" ? undefined : options?.sessionId;\n\t\t\tconst compat = getCompat(model, options?.env);\n\t\t\tconst grammarToolInputProperties = createGrammarToolInputProperties(\n\t\t\t\tcontext.tools,\n\t\t\t\tcompat.supportsOpenAIGrammarTools,\n\t\t\t);\n\t\t\tconst client = createClient(\n\t\t\t\tmodel,\n\t\t\t\tcontext,\n\t\t\t\tclientAuth.apiKey,\n\t\t\t\tclientAuth.headers,\n\t\t\t\toptions?.fetch,\n\t\t\t\tcacheSessionId,\n\t\t\t\toptions?.env,\n\t\t\t);\n\t\t\tlet params = buildParams(model, context, options, compat, grammarToolInputProperties);\n\t\t\tconst nextParams = await options?.onPayload?.(params, model);\n\t\t\tif (nextParams !== undefined) {\n\t\t\t\tparams = nextParams as MutableResponsesPayload;\n\t\t\t}\n\n\t\t\tparams = sanitizeUnsupportedNativeTools(params, compat);\n\t\t\tconst transport = options?.transport ?? \"sse\";\n\t\t\tif (transport !== \"sse\" && compat.supportsWebSocket) {\n\t\t\t\tlet websocketStarted = false;\n\t\t\t\ttry {\n\t\t\t\t\tawait processWebSocketStream(\n\t\t\t\t\t\tresolveOpenAIResponsesWebSocketUrl(model, options?.env),\n\t\t\t\t\t\tparams,\n\t\t\t\t\t\tbuildWebSocketHeaders(\n\t\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tclientAuth.apiKey,\n\t\t\t\t\t\t\tclientAuth.headers,\n\t\t\t\t\t\t\tcacheSessionId,\n\t\t\t\t\t\t\toptions?.env,\n\t\t\t\t\t\t),\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tstream,\n\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\twebsocketStarted = true;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcacheSessionId,\n\t\t\t\t\t\tgrammarToolInputProperties,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t\t\t}\n\n\t\t\t\t\tstream.push({ type: \"done\", reason: getDoneReason(output.stopReason), message: output });\n\t\t\t\t\tstream.end();\n\t\t\t\t\treturn;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (transport === \"websocket\" || websocketStarted) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst requestOptions = {\n\t\t\t\t...(options?.signal ? { signal: options.signal } : {}),\n\t\t\t\t...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),\n\t\t\t\tmaxRetries: 0,\n\t\t\t};\n\t\t\tconst { data: openaiStream, response } = await retryProviderRequest(\n\t\t\t\t() => client.responses.create(params, requestOptions).withResponse(),\n\t\t\t\t{\n\t\t\t\t\tmaxRetries: options?.maxRetries,\n\t\t\t\t\tmaxRetryDelayMs: options?.maxRetryDelayMs,\n\t\t\t\t\tsignal: options?.signal,\n\t\t\t\t},\n\t\t\t);\n\t\t\tawait options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);\n\t\t\tstream.push({ type: \"start\", partial: output });\n\n\t\t\tawait processResponsesStream(openaiStream, output, stream, model, {\n\t\t\t\tserviceTier: options?.serviceTier,\n\t\t\t\tgrammarToolInputProperties,\n\t\t\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t\t\t});\n\n\t\t\tif (options?.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tif (output.stopReason === \"pending\") {\n\t\t\t\tthrow new Error(\"OpenAI Responses stream ended without a stop reason\");\n\t\t\t}\n\t\t\tif (output.stopReason === \"aborted\" || output.stopReason === \"error\") {\n\t\t\t\tthrow new Error(output.errorMessage || \"An unknown error occurred\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason, message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tfor (const block of output.content) {\n\t\t\t\tdelete (block as { index?: number }).index;\n\t\t\t\t// Streaming scratch buffers are only used during parsing; never persist them.\n\t\t\t\tdelete (block as { partialJson?: string }).partialJson;\n\t\t\t\tdelete (block as { customInput?: unknown }).customInput;\n\t\t\t}\n\t\t\toutput.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.errorMessage = formatOpenAIResponsesError(error);\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\nexport const streamSimple: StreamFunction<\"openai-responses\", SimpleStreamOptions> = (\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tresolveOpenAIClientAuth(model.provider, options?.apiKey, options?.headers);\n\n\tconst base = {\n\t\t...buildBaseOptions(model, context, options, options?.apiKey),\n\t\ttoolChoice: options?.toolChoice,\n\t} satisfies OpenAIResponsesOptions;\n\tconst clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;\n\tconst reasoningEffort =\n\t\tclampedReasoning === \"off\"\n\t\t\t? undefined\n\t\t\t: clampedReasoning === \"max\" && supportsMax(model)\n\t\t\t\t? \"max\"\n\t\t\t\t: clampMaxForOpenAI(clampedReasoning, supportsXhigh(model));\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\treasoningEffort,\n\t} satisfies OpenAIResponsesOptions);\n};\n\nfunction createClient(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\tapiKey: string,\n\toptionsHeaders?: ProviderHeaders,\n\tfetch?: typeof globalThis.fetch,\n\tsessionId?: string,\n\tenv?: ProviderEnv,\n) {\n\tconst compat = getCompat(model, env);\n\tconst headers: ProviderHeaders = { ...model.headers };\n\tif (model.provider === \"github-copilot\") {\n\t\tconst hasImages = hasCopilotVisionInput(context.messages);\n\t\tconst copilotHeaders = buildCopilotDynamicHeaders({\n\t\t\tmessages: context.messages,\n\t\t\thasImages,\n\t\t});\n\t\tObject.assign(headers, copilotHeaders);\n\t}\n\n\tif (sessionId) {\n\t\tif (compat.sessionAffinityFormat === \"openrouter\") {\n\t\t\theaders[\"x-session-id\"] = sessionId;\n\t\t} else {\n\t\t\tif (compat.sessionAffinityFormat === \"openai\") {\n\t\t\t\theaders.session_id = sessionId;\n\t\t\t}\n\t\t\theaders[\"x-client-request-id\"] = sessionId;\n\t\t}\n\t}\n\n\t// Merge options headers last so they can override defaults\n\tif (optionsHeaders) {\n\t\tObject.assign(headers, optionsHeaders);\n\t}\n\n\tif (model.provider === \"xai\") {\n\t\tforcePiUserAgent(headers);\n\t}\n\n\treturn new OpenAI({\n\t\tapiKey,\n\t\tbaseURL: isCloudflareProvider(model.provider) ? resolveCloudflareBaseUrl(model, env) : model.baseUrl,\n\t\tdangerouslyAllowBrowser: true,\n\t\tfetch,\n\t\tdefaultHeaders: headers,\n\t});\n}\n\nfunction buildParams(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\toptions: OpenAIResponsesOptions | undefined,\n\tcompat: Required<OpenAIResponsesCompat> = getCompat(model, options?.env),\n\tgrammarToolInputProperties: ReadonlyMap<string, string> = createGrammarToolInputProperties(\n\t\tcontext.tools,\n\t\tcompat.supportsOpenAIGrammarTools,\n\t),\n) {\n\tconst deferredToolsMode = compat.supportsAdditionalTools\n\t\t? \"additional-tools\"\n\t\t: compat.supportsToolSearch\n\t\t\t? \"tool-search\"\n\t\t\t: undefined;\n\tconst toolPlacement = splitDeferredTools(context, deferredToolsMode !== undefined);\n\tconst requestedReasoningEffort = options?.reasoningEffort ?? (options?.reasoningSummary ? \"medium\" : undefined);\n\tconst mappedReasoningEffort =\n\t\trequestedReasoningEffort === undefined ? undefined : model.thinkingLevelMap?.[requestedReasoningEffort];\n\tconst reasoningEffort = mappedReasoningEffort === undefined ? requestedReasoningEffort : mappedReasoningEffort;\n\tconst reasoningRequested = reasoningEffort !== undefined && reasoningEffort !== null;\n\tconst reasoningUnavailable = reasoningEffort === null;\n\tconst messages = convertResponsesMessages(model, context, OPENAI_TOOL_CALL_PROVIDERS, {\n\t\tpreserveThinking: reasoningRequested,\n\t\tgrammarToolInputProperties,\n\t\tdeferredTools: toolPlacement.deferred,\n\t\tdeferredToolsMode,\n\t\ttoolOptions: {\n\t\t\tsupportsStrictMode: compat.supportsStrictMode,\n\t\t\tsupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,\n\t\t},\n\t});\n\n\tconst cacheRetention = resolveCacheRetention(options?.cacheRetention ?? model.cacheRetention, options?.env);\n\tconst disableImplicitPromptCache = cacheRetention === \"none\" && compat.supportsExplicitPromptCacheMode;\n\tconst params: MutableResponsesPayload = {\n\t\tmodel: model.id,\n\t\tinput: messages,\n\t\tstream: true,\n\t\tprompt_cache_key: cacheRetention === \"none\" ? undefined : clampOpenAIPromptCacheKey(options?.sessionId),\n\t\tprompt_cache_retention: getPromptCacheRetention(compat, cacheRetention),\n\t\tprompt_cache_options: disableImplicitPromptCache ? { mode: \"explicit\" } : undefined,\n\t\tstore: false,\n\t};\n\n\tif (options?.maxTokens) {\n\t\tparams.max_output_tokens = Math.max(options.maxTokens, OPENAI_RESPONSES_MIN_OUTPUT_TOKENS);\n\t}\n\n\tif (options?.temperature !== undefined) {\n\t\tparams.temperature = options?.temperature;\n\t}\n\n\tif (options?.serviceTier !== undefined) {\n\t\tparams.service_tier = options.serviceTier;\n\t}\n\n\tif (toolPlacement.immediate.length > 0) {\n\t\tparams.tools = convertResponsesTools(toolPlacement.immediate, {\n\t\t\tsupportsStrictMode: compat.supportsStrictMode,\n\t\t\tsupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,\n\t\t});\n\t}\n\n\tif (options?.toolChoice !== undefined) {\n\t\tparams.tool_choice = options.toolChoice;\n\t}\n\n\tif (model.reasoning) {\n\t\tif (reasoningRequested) {\n\t\t\tparams.reasoning = {\n\t\t\t\teffort: reasoningEffort as NonNullable<typeof params.reasoning>[\"effort\"],\n\t\t\t\t...(options?.reasoningSummary === null ? {} : { summary: options?.reasoningSummary || \"auto\" }),\n\t\t\t};\n\t\t\tparams.include = [\"reasoning.encrypted_content\"];\n\t\t} else if (!reasoningUnavailable && model.provider !== \"github-copilot\" && model.thinkingLevelMap?.off !== null) {\n\t\t\tparams.reasoning = {\n\t\t\t\teffort: (model.thinkingLevelMap?.off ?? \"none\") as NonNullable<typeof params.reasoning>[\"effort\"],\n\t\t\t};\n\t\t}\n\t\tif (model.provider === \"xai\") params.include = [\"reasoning.encrypted_content\"];\n\t}\n\n\tapplyExtraBodyToResponsesParams(params, options?.extraBody);\n\n\t// Last so custom keys override the named request fields.\n\tif (options?.samplingParams) {\n\t\tObject.assign(params, options.samplingParams);\n\t}\n\n\treturn params;\n}\n\nfunction applyExtraBodyToResponsesParams(\n\tparams: ResponseCreateParamsStreaming,\n\textraBody: Record<string, unknown> | undefined,\n): void {\n\tif (!extraBody) return;\n\tfor (const [key, value] of Object.entries(extraBody)) {\n\t\tif (OPENAI_RESPONSES_RESERVED_BODY_KEYS.has(key)) continue;\n\t\tObject.defineProperty(params, key, { value, writable: true, enumerable: true, configurable: true });\n\t}\n}\n\nfunction getDoneReason(stopReason: AssistantMessage[\"stopReason\"]): \"stop\" | \"length\" | \"toolUse\" {\n\tif (stopReason === \"length\" || stopReason === \"toolUse\") return stopReason;\n\treturn \"stop\";\n}\n\nfunction getWebSocketConstructor(): WebSocketConstructor | null {\n\tconst wsConstructor = (globalThis as { WebSocket?: WebSocketConstructor }).WebSocket;\n\treturn typeof wsConstructor === \"function\" ? wsConstructor : null;\n}\n\nfunction getWebSocketReadyState(socket: WebSocketLike): number | undefined {\n\tconst readyState = (socket as { readyState?: number }).readyState;\n\treturn typeof readyState === \"number\" ? readyState : undefined;\n}\n\nfunction isWebSocketReusable(socket: WebSocketLike): boolean {\n\tconst readyState = getWebSocketReadyState(socket);\n\treturn readyState === undefined || readyState === 1;\n}\n\nfunction closeWebSocketSilently(socket: WebSocketLike, code = 1000, reason = \"done\"): void {\n\ttry {\n\t\tsocket.close(code, reason);\n\t} catch {}\n}\n\nfunction scheduleSessionWebSocketExpiry(sessionId: string, entry: CachedWebSocketConnection): void {\n\tif (entry.idleTimer) {\n\t\tclearTimeout(entry.idleTimer);\n\t}\n\tentry.idleTimer = setTimeout(() => {\n\t\tif (entry.busy) return;\n\t\tcloseWebSocketSilently(entry.socket, 1000, \"idle_timeout\");\n\t\twebsocketSessionCache.delete(sessionId);\n\t}, SESSION_WEBSOCKET_CACHE_TTL_MS);\n\tconst unref = (entry.idleTimer as { unref?: () => void }).unref;\n\tif (unref) unref.call(entry.idleTimer);\n}\n\nasync function connectWebSocket(url: string, headers: Headers, signal?: AbortSignal): Promise<WebSocketLike> {\n\tconst WebSocketConstructorValue = getWebSocketConstructor();\n\tif (!WebSocketConstructorValue) {\n\t\tthrow new Error(\"WebSocket transport is not available in this runtime\");\n\t}\n\n\tconst websocketHeaders = headersToRecord(headers);\n\n\treturn new Promise<WebSocketLike>((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet socket: WebSocketLike;\n\n\t\tconst cleanup = () => {\n\t\t\tsocket.removeEventListener(\"open\", onOpen);\n\t\t\tsocket.removeEventListener(\"error\", onError);\n\t\t\tsocket.removeEventListener(\"close\", onClose);\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t};\n\t\tconst settleReject = (error: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t};\n\t\tconst onOpen: WebSocketListener = () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tresolve(socket);\n\t\t};\n\t\tconst onError: WebSocketListener = (event) => {\n\t\t\tsettleReject(extractWebSocketError(event));\n\t\t};\n\t\tconst onClose: WebSocketListener = (event) => {\n\t\t\tsettleReject(extractWebSocketCloseError(event));\n\t\t};\n\t\tconst onAbort = () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tcloseWebSocketSilently(socket, 1000, \"aborted\");\n\t\t\treject(new Error(\"Request was aborted\"));\n\t\t};\n\n\t\ttry {\n\t\t\tsocket = new WebSocketConstructorValue(url, { headers: websocketHeaders });\n\t\t} catch (error) {\n\t\t\treject(error instanceof Error ? error : new Error(String(error)));\n\t\t\treturn;\n\t\t}\n\n\t\tsocket.addEventListener(\"open\", onOpen);\n\t\tsocket.addEventListener(\"error\", onError);\n\t\tsocket.addEventListener(\"close\", onClose);\n\t\tsignal?.addEventListener(\"abort\", onAbort);\n\t});\n}\n\nasync function acquireWebSocket(\n\turl: string,\n\theaders: Headers,\n\tsessionId: string | undefined,\n\tsignal?: AbortSignal,\n): Promise<{ socket: WebSocketLike; release: (options?: { keep?: boolean }) => void }> {\n\tif (!sessionId) {\n\t\tconst socket = await connectWebSocket(url, headers, signal);\n\t\treturn { socket, release: () => closeWebSocketSilently(socket) };\n\t}\n\n\tconst cached = websocketSessionCache.get(sessionId);\n\tif (cached) {\n\t\tif (cached.idleTimer) {\n\t\t\tclearTimeout(cached.idleTimer);\n\t\t\tcached.idleTimer = undefined;\n\t\t}\n\t\tif (!cached.busy && isWebSocketReusable(cached.socket)) {\n\t\t\tcached.busy = true;\n\t\t\treturn {\n\t\t\t\tsocket: cached.socket,\n\t\t\t\trelease: ({ keep } = {}) => {\n\t\t\t\t\tif (!keep || !isWebSocketReusable(cached.socket)) {\n\t\t\t\t\t\tcloseWebSocketSilently(cached.socket);\n\t\t\t\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcached.busy = false;\n\t\t\t\t\tscheduleSessionWebSocketExpiry(sessionId, cached);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (!cached.busy) {\n\t\t\tcloseWebSocketSilently(cached.socket);\n\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t}\n\t}\n\n\tconst socket = await connectWebSocket(url, headers, signal);\n\tconst entry: CachedWebSocketConnection = { socket, busy: true };\n\twebsocketSessionCache.set(sessionId, entry);\n\treturn {\n\t\tsocket,\n\t\trelease: ({ keep } = {}) => {\n\t\t\tif (!keep || !isWebSocketReusable(entry.socket)) {\n\t\t\t\tcloseWebSocketSilently(entry.socket);\n\t\t\t\tif (entry.idleTimer) clearTimeout(entry.idleTimer);\n\t\t\t\tif (websocketSessionCache.get(sessionId) === entry) {\n\t\t\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tentry.busy = false;\n\t\t\tscheduleSessionWebSocketExpiry(sessionId, entry);\n\t\t},\n\t};\n}\n\nfunction extractWebSocketError(event: unknown): Error {\n\tif (event && typeof event === \"object\" && \"message\" in event) {\n\t\tconst message = (event as { message?: string }).message;\n\t\tif (typeof message === \"string\" && message.length > 0) {\n\t\t\treturn new Error(message);\n\t\t}\n\t}\n\treturn new Error(\"WebSocket error\");\n}\n\nfunction extractWebSocketCloseError(event: unknown): Error {\n\tif (event && typeof event === \"object\") {\n\t\tconst code = \"code\" in event ? (event as { code?: number }).code : undefined;\n\t\tconst reason = \"reason\" in event ? (event as { reason?: string }).reason : undefined;\n\t\tconst codeText = typeof code === \"number\" ? ` ${code}` : \"\";\n\t\tconst reasonText = typeof reason === \"string\" && reason.length > 0 ? ` ${reason}` : \"\";\n\t\treturn new Error(`WebSocket closed${codeText}${reasonText}`.trim());\n\t}\n\treturn new Error(\"WebSocket closed\");\n}\n\nasync function decodeWebSocketData(data: unknown): Promise<string | null> {\n\tif (typeof data === \"string\") return data;\n\tif (data instanceof ArrayBuffer) {\n\t\treturn new TextDecoder().decode(new Uint8Array(data));\n\t}\n\tif (ArrayBuffer.isView(data)) {\n\t\treturn new TextDecoder().decode(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));\n\t}\n\tif (data && typeof data === \"object\" && \"arrayBuffer\" in data) {\n\t\tconst arrayBuffer = await (data as { arrayBuffer: () => Promise<ArrayBuffer> }).arrayBuffer();\n\t\treturn new TextDecoder().decode(new Uint8Array(arrayBuffer));\n\t}\n\treturn null;\n}\n\nasync function* parseWebSocket(socket: WebSocketLike, signal?: AbortSignal): AsyncGenerator<ResponseStreamEvent> {\n\tconst queue: ResponseStreamEvent[] = [];\n\tlet pending: (() => void) | null = null;\n\tlet done = false;\n\tlet failed: Error | null = null;\n\tlet sawCompletion = false;\n\n\tconst wake = () => {\n\t\tif (!pending) return;\n\t\tconst resolve = pending;\n\t\tpending = null;\n\t\tresolve();\n\t};\n\tconst onMessage: WebSocketListener = (event) => {\n\t\tvoid (async () => {\n\t\t\tif (!event || typeof event !== \"object\" || !(\"data\" in event)) return;\n\t\t\tconst text = await decodeWebSocketData((event as { data?: unknown }).data);\n\t\t\tif (!text) return;\n\t\t\ttry {\n\t\t\t\tconst parsed = JSON.parse(text) as ResponseStreamEvent;\n\t\t\t\tif (parsed.type === \"response.completed\" || parsed.type === \"response.incomplete\") {\n\t\t\t\t\tsawCompletion = true;\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t\tqueue.push(parsed);\n\t\t\t\twake();\n\t\t\t} catch {}\n\t\t})();\n\t};\n\tconst onError: WebSocketListener = (event) => {\n\t\tfailed = extractWebSocketError(event);\n\t\tdone = true;\n\t\twake();\n\t};\n\tconst onClose: WebSocketListener = (event) => {\n\t\tif (!sawCompletion && !failed) {\n\t\t\tfailed = extractWebSocketCloseError(event);\n\t\t}\n\t\tdone = true;\n\t\twake();\n\t};\n\tconst onAbort = () => {\n\t\tfailed = new Error(\"Request was aborted\");\n\t\tdone = true;\n\t\twake();\n\t};\n\n\tsocket.addEventListener(\"message\", onMessage);\n\tsocket.addEventListener(\"error\", onError);\n\tsocket.addEventListener(\"close\", onClose);\n\tsignal?.addEventListener(\"abort\", onAbort);\n\ttry {\n\t\twhile (true) {\n\t\t\tif (signal?.aborted) throw new Error(\"Request was aborted\");\n\t\t\tif (queue.length > 0) {\n\t\t\t\tconst event = queue.shift();\n\t\t\t\tif (event) yield event;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (done) break;\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tpending = resolve;\n\t\t\t});\n\t\t}\n\t\tif (failed) throw failed;\n\t\tif (!sawCompletion) throw new Error(\"WebSocket stream closed before response.completed\");\n\t} finally {\n\t\tsocket.removeEventListener(\"message\", onMessage);\n\t\tsocket.removeEventListener(\"error\", onError);\n\t\tsocket.removeEventListener(\"close\", onClose);\n\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\nasync function processWebSocketStream(\n\turl: string,\n\tparams: ResponseCreateParamsStreaming,\n\theaders: Headers,\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n\tmodel: Model<\"openai-responses\">,\n\tonStart: () => void,\n\tcacheSessionId: string | undefined,\n\tgrammarToolInputProperties: ReadonlyMap<string, string>,\n\toptions?: OpenAIResponsesOptions,\n): Promise<void> {\n\tconst { socket, release } = await acquireWebSocket(url, headers, cacheSessionId, options?.signal);\n\ttry {\n\t\tsocket.send(JSON.stringify({ type: \"response.create\", ...params }));\n\t\tonStart();\n\t\tawait options?.onResponse?.({ status: 101, headers: {} }, model);\n\t\tstream.push({ type: \"start\", partial: output });\n\t\tawait processResponsesStream(parseWebSocket(socket, options?.signal), output, stream, model, {\n\t\t\tserviceTier: options?.serviceTier,\n\t\t\tgrammarToolInputProperties,\n\t\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t\t});\n\t} finally {\n\t\trelease({ keep: false });\n\t}\n}\n\nfunction resolveOpenAIResponsesWebSocketUrl(model: Model<\"openai-responses\">, env?: ProviderEnv): string {\n\tconst baseUrl = isCloudflareProvider(model.provider)\n\t\t? resolveCloudflareBaseUrl(model, env)\n\t\t: model.baseUrl || \"https://api.openai.com/v1\";\n\tconst url = new URL(baseUrl);\n\tif (!url.pathname.endsWith(\"/responses\")) {\n\t\turl.pathname = `${url.pathname.replace(/\\/$/, \"\")}/responses`;\n\t}\n\tif (url.protocol === \"https:\") url.protocol = \"wss:\";\n\telse if (url.protocol === \"http:\") url.protocol = \"ws:\";\n\treturn url.toString();\n}\n\nfunction buildWebSocketHeaders(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\tapiKey: string,\n\toptionsHeaders?: ProviderHeaders,\n\tsessionId?: string,\n\tenv?: ProviderEnv,\n): Headers {\n\tconst headers = new Headers(model.headers);\n\tlet suppressDefaultAuthorization = false;\n\tif (model.provider === \"github-copilot\") {\n\t\tconst hasImages = hasCopilotVisionInput(context.messages);\n\t\tconst copilotHeaders = buildCopilotDynamicHeaders({ messages: context.messages, hasImages });\n\t\tfor (const [key, value] of Object.entries(copilotHeaders)) {\n\t\t\theaders.set(key, value);\n\t\t}\n\t}\n\tfor (const [key, value] of Object.entries(optionsHeaders || {})) {\n\t\tif (value === null) {\n\t\t\tif (key.toLowerCase() === \"authorization\") suppressDefaultAuthorization = true;\n\t\t\theaders.delete(key);\n\t\t} else {\n\t\t\theaders.set(key, value);\n\t\t}\n\t}\n\tif (!suppressDefaultAuthorization && !headers.has(\"Authorization\")) {\n\t\theaders.set(\"Authorization\", `Bearer ${apiKey}`);\n\t}\n\tif (sessionId) {\n\t\tconst compat = getCompat(model, env);\n\t\tif (compat.sessionAffinityFormat === \"openai\") {\n\t\t\theaders.set(\"session_id\", sessionId);\n\t\t}\n\t\tif (compat.sessionAffinityFormat === \"openai\" || compat.sessionAffinityFormat === \"openai-nosession\") {\n\t\t\theaders.set(\"x-client-request-id\", sessionId);\n\t\t} else if (compat.sessionAffinityFormat === \"openrouter\") {\n\t\t\theaders.set(\"x-session-id\", sessionId);\n\t\t}\n\t}\n\theaders.delete(\"accept\");\n\theaders.delete(\"content-type\");\n\theaders.delete(\"OpenAI-Beta\");\n\theaders.delete(\"openai-beta\");\n\theaders.set(\"OpenAI-Beta\", OPENAI_BETA_RESPONSES_WEBSOCKETS);\n\treturn headers;\n}\n\nfunction getServiceTierCostMultiplier(\n\tmodel: Pick<Model<\"openai-responses\">, \"id\">,\n\tserviceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n): number {\n\tswitch (serviceTier) {\n\t\tcase \"flex\":\n\t\t\treturn 0.5;\n\t\tcase \"priority\":\n\t\t\treturn model.id === \"gpt-5.5\" ? 2.5 : 2;\n\t\tdefault:\n\t\t\treturn 1;\n\t}\n}\n\nfunction applyServiceTierPricing(\n\tusage: Usage,\n\tserviceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n\tmodel: Pick<Model<\"openai-responses\">, \"id\">,\n) {\n\tconst multiplier = getServiceTierCostMultiplier(model, serviceTier);\n\tif (multiplier === 1) return;\n\n\tusage.cost.input *= multiplier;\n\tusage.cost.output *= multiplier;\n\tusage.cost.cacheRead *= multiplier;\n\tusage.cost.cacheWrite *= multiplier;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n}\n"]}
1
+ {"version":3,"file":"openai-responses.js","sourceRoot":"","sources":["../../src/api/openai-responses.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,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AC,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,gCAAgC,CAAC,CAAC;IAC7D,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,SAAS,4BAA4B,CACpC,KAA4C,EAC5C,WAAsE;IAEtE,QAAQ,WAAW,EAAE,CAAC;QACrB,KAAK,MAAM;YACV,OAAO,GAAG,CAAC;QACZ,KAAK,UAAU;YACd,OAAO,KAAK,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC;YACC,OAAO,CAAC,CAAC;IACX,CAAC;AACF,CAAC;AAED,SAAS,uBAAuB,CAC/B,KAAY,EACZ,WAAsE,EACtE,KAA4C;IAE5C,MAAM,UAAU,GAAG,4BAA4B,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACpE,IAAI,UAAU,KAAK,CAAC;QAAE,OAAO;IAE7B,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC;IAC/B,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC;IAChC,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC;IACpC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;AACxG,CAAC","sourcesContent":["import OpenAI from \"openai\";\nimport type { ResponseCreateParamsStreaming, ResponseStreamEvent } from \"openai/resources/responses/responses.js\";\nimport { clampThinkingLevel, supportsMax, supportsXhigh } from \"../models.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tCacheRetention,\n\tContext,\n\tModel,\n\tOpenAIResponsesCompat,\n\tProviderEnv,\n\tProviderHeaders,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tUsage,\n} from \"../types.ts\";\nimport { splitDeferredTools } from \"../utils/deferred-tools.ts\";\nimport { formatProviderError, normalizeProviderError } from \"../utils/error-body.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { headersToRecord } from \"../utils/headers.ts\";\nimport { getPiUserAgent } from \"../utils/pi-user-agent.ts\";\nimport { getProviderEnvValue } from \"../utils/provider-env.ts\";\nimport { retryProviderRequest } from \"../utils/provider-retry.ts\";\nimport { isCloudflareProvider, resolveCloudflareBaseUrl } from \"./cloudflare.ts\";\nimport { createGrammarToolInputProperties } from \"./constrained-sampling.ts\";\nimport { buildCopilotDynamicHeaders, hasCopilotVisionInput } from \"./github-copilot-headers.ts\";\nimport { resolveOpenAIClientAuth } from \"./openai-client-auth.ts\";\nimport { clampOpenAIPromptCacheKey } from \"./openai-prompt-cache.ts\";\nimport { convertResponsesMessages, convertResponsesTools, processResponsesStream } from \"./openai-responses-shared.ts\";\nimport { buildBaseOptions, clampMaxForOpenAI, OPENAI_RESPONSES_RESERVED_BODY_KEYS } from \"./simple-options.ts\";\n\nconst OPENAI_TOOL_CALL_PROVIDERS = new Set([\"openai\", \"openai-codex\", \"opencode\"]);\nconst OPENAI_BETA_RESPONSES_WEBSOCKETS = \"responses_websockets=2026-02-06\";\nconst OPENAI_WEB_SEARCH_SOURCES_INCLUDE = \"web_search_call.action.sources\";\nconst SESSION_WEBSOCKET_CACHE_TTL_MS = 5 * 60 * 1000;\n// OpenAI Responses rejects max_output_tokens below 16: https://github.com/earendil-works/pi/issues/6265\nconst OPENAI_RESPONSES_MIN_OUTPUT_TOKENS = 16;\n\ntype WebSocketEventType = \"open\" | \"message\" | \"error\" | \"close\";\ntype WebSocketListener = (event: unknown) => void;\n\ninterface WebSocketLike {\n\tclose(code?: number, reason?: string): void;\n\tsend(data: string): void;\n\taddEventListener(type: WebSocketEventType, listener: WebSocketListener): void;\n\tremoveEventListener(type: WebSocketEventType, listener: WebSocketListener): void;\n}\n\ninterface CachedWebSocketConnection {\n\tsocket: WebSocketLike;\n\tbusy: boolean;\n\tidleTimer?: ReturnType<typeof setTimeout>;\n}\n\ntype WebSocketConstructor = new (\n\turl: string,\n\tprotocols?: string | string[] | { headers?: Record<string, string> },\n) => WebSocketLike;\n\ntype MutableResponsesPayload = ResponseCreateParamsStreaming & {\n\tprompt_cache_options?: { mode?: \"explicit\" | \"implicit\" };\n};\n\nconst websocketSessionCache = new Map<string, CachedWebSocketConnection>();\n\nfunction detectSessionAffinityFormat(model: Pick<Model<\"openai-responses\">, \"provider\" | \"baseUrl\">) {\n\treturn model.provider === \"openrouter\" || model.baseUrl.includes(\"openrouter.ai\") ? \"openrouter\" : \"openai\";\n}\n\n/**\n * Resolve cache retention preference.\n * Defaults to \"short\" and uses PI_CACHE_RETENTION for backward compatibility.\n */\nfunction resolveCacheRetention(cacheRetention?: CacheRetention, env?: ProviderEnv): CacheRetention {\n\tif (cacheRetention) {\n\t\treturn cacheRetention;\n\t}\n\tif (getProviderEnvValue(\"PI_CACHE_RETENTION\", env) === \"long\") {\n\t\treturn \"long\";\n\t}\n\treturn \"short\";\n}\n\nfunction getCompat(model: Model<\"openai-responses\">, env?: ProviderEnv): Required<OpenAIResponsesCompat> {\n\tconst isNativeEndpoint = isOpenAIResponsesNativeEndpoint(model, env);\n\treturn {\n\t\tsupportsDeveloperRole: model.compat?.supportsDeveloperRole ?? true,\n\t\tsessionAffinityFormat: model.compat?.sessionAffinityFormat ?? detectSessionAffinityFormat(model),\n\t\tsupportsLongCacheRetention: model.compat?.supportsLongCacheRetention ?? true,\n\t\tsupportsWebSocket: model.compat?.supportsWebSocket ?? isNativeEndpoint,\n\t\tsupportsRemoteCompactionV2: model.compat?.supportsRemoteCompactionV2 ?? isNativeEndpoint,\n\t\tsupportsWebSearchPreview: model.compat?.supportsWebSearchPreview ?? isNativeEndpoint,\n\t\tsupportsImageGeneration: model.compat?.supportsImageGeneration ?? isNativeEndpoint,\n\t\tsupportsStrictMode: model.compat?.supportsStrictMode ?? false,\n\t\tsupportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false,\n\t\tsupportsAdditionalTools: model.compat?.supportsAdditionalTools ?? false,\n\t\tsupportsToolSearch: model.compat?.supportsToolSearch ?? false,\n\t\tsupportsExplicitPromptCacheMode: model.compat?.supportsExplicitPromptCacheMode ?? false,\n\t};\n}\n\nfunction isOpenAIResponsesNativeEndpoint(model: Model<\"openai-responses\">, env?: ProviderEnv): boolean {\n\tconst baseUrl = isCloudflareProvider(model.provider) ? resolveCloudflareBaseUrl(model, env) : model.baseUrl;\n\ttry {\n\t\treturn new URL(baseUrl || \"https://api.openai.com/v1\").hostname === \"api.openai.com\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction getPromptCacheRetention(\n\tcompat: Required<OpenAIResponsesCompat>,\n\tcacheRetention: CacheRetention,\n): \"24h\" | undefined {\n\treturn cacheRetention === \"long\" && compat.supportsLongCacheRetention ? \"24h\" : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isOpenAiWebSearchPreviewTool(value: unknown): boolean {\n\treturn isRecord(value) && (value.type === \"web_search_preview\" || value.type === \"web_search_preview_2025_03_11\");\n}\n\nfunction sanitizeUnsupportedNativeTools(\n\tparams: MutableResponsesPayload,\n\tcompat: Required<OpenAIResponsesCompat>,\n): MutableResponsesPayload {\n\tif (compat.supportsWebSearchPreview) {\n\t\treturn params;\n\t}\n\n\tconst payload = params as MutableResponsesPayload;\n\tlet sanitized: MutableResponsesPayload | undefined;\n\tconst nextPayload = (): MutableResponsesPayload => {\n\t\tsanitized ??= { ...payload };\n\t\treturn sanitized;\n\t};\n\n\tif (Array.isArray(payload.tools)) {\n\t\tconst tools = payload.tools.filter((tool) => !isOpenAiWebSearchPreviewTool(tool));\n\t\tif (tools.length !== payload.tools.length) {\n\t\t\tconst next = nextPayload();\n\t\t\tif (tools.length > 0) {\n\t\t\t\tnext.tools = tools;\n\t\t\t} else {\n\t\t\t\tdelete next.tools;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (Array.isArray(payload.include)) {\n\t\tconst include = payload.include.filter((value) => value !== OPENAI_WEB_SEARCH_SOURCES_INCLUDE);\n\t\tif (include.length !== payload.include.length) {\n\t\t\tconst next = nextPayload();\n\t\t\tif (include.length > 0) {\n\t\t\t\tnext.include = include;\n\t\t\t} else {\n\t\t\t\tdelete next.include;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (isOpenAiWebSearchPreviewTool(payload.tool_choice)) {\n\t\tdelete nextPayload().tool_choice;\n\t}\n\n\treturn sanitized ? (sanitized as ResponseCreateParamsStreaming) : params;\n}\n\nfunction formatOpenAIResponsesError(error: unknown): string {\n\treturn formatProviderError(normalizeProviderError(error), \"OpenAI API error\");\n}\n\n// OpenAI Responses-specific options\nexport interface OpenAIResponsesOptions extends StreamOptions {\n\treasoningEffort?: \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\treasoningSummary?: \"auto\" | \"detailed\" | \"concise\" | null;\n\tserviceTier?: ResponseCreateParamsStreaming[\"service_tier\"];\n\ttoolChoice?: ResponseCreateParamsStreaming[\"tool_choice\"];\n}\n\n/**\n * Generate function for OpenAI Responses API\n */\nexport const stream: StreamFunction<\"openai-responses\", OpenAIResponsesOptions> = (\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\toptions?: OpenAIResponsesOptions,\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\n\t// Start async processing\n\t(async () => {\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: model.api as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"pending\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\ttry {\n\t\t\tconst clientAuth = resolveOpenAIClientAuth(model.provider, options?.apiKey, options?.headers);\n\t\t\tconst cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);\n\t\t\tconst cacheSessionId = cacheRetention === \"none\" ? undefined : options?.sessionId;\n\t\t\tconst compat = getCompat(model, options?.env);\n\t\t\tconst grammarToolInputProperties = createGrammarToolInputProperties(\n\t\t\t\tcontext.tools,\n\t\t\t\tcompat.supportsOpenAIGrammarTools,\n\t\t\t);\n\t\t\tconst client = createClient(\n\t\t\t\tmodel,\n\t\t\t\tcontext,\n\t\t\t\tclientAuth.apiKey,\n\t\t\t\tclientAuth.headers,\n\t\t\t\toptions?.fetch,\n\t\t\t\tcacheSessionId,\n\t\t\t\toptions?.env,\n\t\t\t);\n\t\t\tlet params = buildParams(model, context, options, compat, grammarToolInputProperties);\n\t\t\tconst nextParams = await options?.onPayload?.(params, model);\n\t\t\tif (nextParams !== undefined) {\n\t\t\t\tparams = nextParams as MutableResponsesPayload;\n\t\t\t}\n\n\t\t\tparams = sanitizeUnsupportedNativeTools(params, compat);\n\t\t\tconst transport = options?.transport ?? \"sse\";\n\t\t\tif (transport !== \"sse\" && compat.supportsWebSocket) {\n\t\t\t\tlet websocketStarted = false;\n\t\t\t\ttry {\n\t\t\t\t\tawait processWebSocketStream(\n\t\t\t\t\t\tresolveOpenAIResponsesWebSocketUrl(model, options?.env),\n\t\t\t\t\t\tparams,\n\t\t\t\t\t\tbuildWebSocketHeaders(\n\t\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tclientAuth.apiKey,\n\t\t\t\t\t\t\tclientAuth.headers,\n\t\t\t\t\t\t\tcacheSessionId,\n\t\t\t\t\t\t\toptions?.env,\n\t\t\t\t\t\t),\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tstream,\n\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\twebsocketStarted = true;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcacheSessionId,\n\t\t\t\t\t\tgrammarToolInputProperties,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t\t\t}\n\n\t\t\t\t\tstream.push({ type: \"done\", reason: getDoneReason(output.stopReason), message: output });\n\t\t\t\t\tstream.end();\n\t\t\t\t\treturn;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (transport === \"websocket\" || websocketStarted) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst requestOptions = {\n\t\t\t\t...(options?.signal ? { signal: options.signal } : {}),\n\t\t\t\t...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),\n\t\t\t\tmaxRetries: 0,\n\t\t\t};\n\t\t\tconst { data: openaiStream, response } = await retryProviderRequest(\n\t\t\t\t() => client.responses.create(params, requestOptions).withResponse(),\n\t\t\t\t{\n\t\t\t\t\tmaxRetries: options?.maxRetries,\n\t\t\t\t\tmaxRetryDelayMs: options?.maxRetryDelayMs,\n\t\t\t\t\tsignal: options?.signal,\n\t\t\t\t},\n\t\t\t);\n\t\t\tawait options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);\n\t\t\tstream.push({ type: \"start\", partial: output });\n\n\t\t\tawait processResponsesStream(openaiStream, output, stream, model, {\n\t\t\t\tserviceTier: options?.serviceTier,\n\t\t\t\tgrammarToolInputProperties,\n\t\t\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t\t\t});\n\n\t\t\tif (options?.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tif (output.stopReason === \"pending\") {\n\t\t\t\tthrow new Error(\"OpenAI Responses stream ended without a stop reason\");\n\t\t\t}\n\t\t\tif (output.stopReason === \"aborted\" || output.stopReason === \"error\") {\n\t\t\t\tthrow new Error(output.errorMessage || \"An unknown error occurred\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason, message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tfor (const block of output.content) {\n\t\t\t\tdelete (block as { index?: number }).index;\n\t\t\t\t// Streaming scratch buffers are only used during parsing; never persist them.\n\t\t\t\tdelete (block as { partialJson?: string }).partialJson;\n\t\t\t\tdelete (block as { customInput?: unknown }).customInput;\n\t\t\t}\n\t\t\toutput.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.errorMessage = formatOpenAIResponsesError(error);\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\nexport const streamSimple: StreamFunction<\"openai-responses\", SimpleStreamOptions> = (\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tresolveOpenAIClientAuth(model.provider, options?.apiKey, options?.headers);\n\n\tconst base = {\n\t\t...buildBaseOptions(model, context, options, options?.apiKey),\n\t\ttoolChoice: options?.toolChoice,\n\t} satisfies OpenAIResponsesOptions;\n\tconst clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;\n\tconst reasoningEffort =\n\t\tclampedReasoning === \"off\"\n\t\t\t? undefined\n\t\t\t: clampedReasoning === \"max\" && supportsMax(model)\n\t\t\t\t? \"max\"\n\t\t\t\t: clampMaxForOpenAI(clampedReasoning, supportsXhigh(model));\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\treasoningEffort,\n\t} satisfies OpenAIResponsesOptions);\n};\n\nfunction createClient(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\tapiKey: string,\n\toptionsHeaders?: ProviderHeaders,\n\tfetch?: typeof globalThis.fetch,\n\tsessionId?: string,\n\tenv?: ProviderEnv,\n) {\n\tconst compat = getCompat(model, env);\n\tconst headers: ProviderHeaders = { \"User-Agent\": getPiUserAgent(), ...model.headers };\n\tif (model.provider === \"github-copilot\") {\n\t\tconst hasImages = hasCopilotVisionInput(context.messages);\n\t\tconst copilotHeaders = buildCopilotDynamicHeaders({\n\t\t\tmessages: context.messages,\n\t\t\thasImages,\n\t\t});\n\t\tObject.assign(headers, copilotHeaders);\n\t}\n\n\tif (sessionId) {\n\t\tif (compat.sessionAffinityFormat === \"openrouter\") {\n\t\t\theaders[\"x-session-id\"] = sessionId;\n\t\t} else {\n\t\t\tif (compat.sessionAffinityFormat === \"openai\") {\n\t\t\t\theaders.session_id = sessionId;\n\t\t\t}\n\t\t\theaders[\"x-client-request-id\"] = sessionId;\n\t\t}\n\t}\n\n\t// Merge options headers last so they can override defaults\n\tif (optionsHeaders) {\n\t\tObject.assign(headers, optionsHeaders);\n\t}\n\n\treturn new OpenAI({\n\t\tapiKey,\n\t\tbaseURL: isCloudflareProvider(model.provider) ? resolveCloudflareBaseUrl(model, env) : model.baseUrl,\n\t\tdangerouslyAllowBrowser: true,\n\t\tfetch,\n\t\tdefaultHeaders: headers,\n\t});\n}\n\nfunction buildParams(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\toptions: OpenAIResponsesOptions | undefined,\n\tcompat: Required<OpenAIResponsesCompat> = getCompat(model, options?.env),\n\tgrammarToolInputProperties: ReadonlyMap<string, string> = createGrammarToolInputProperties(\n\t\tcontext.tools,\n\t\tcompat.supportsOpenAIGrammarTools,\n\t),\n) {\n\tconst deferredToolsMode = compat.supportsAdditionalTools\n\t\t? \"additional-tools\"\n\t\t: compat.supportsToolSearch\n\t\t\t? \"tool-search\"\n\t\t\t: undefined;\n\tconst toolPlacement = splitDeferredTools(context, deferredToolsMode !== undefined);\n\tconst requestedReasoningEffort = options?.reasoningEffort ?? (options?.reasoningSummary ? \"medium\" : undefined);\n\tconst mappedReasoningEffort =\n\t\trequestedReasoningEffort === undefined ? undefined : model.thinkingLevelMap?.[requestedReasoningEffort];\n\tconst reasoningEffort = mappedReasoningEffort === undefined ? requestedReasoningEffort : mappedReasoningEffort;\n\tconst reasoningRequested = reasoningEffort !== undefined && reasoningEffort !== null;\n\tconst reasoningUnavailable = reasoningEffort === null;\n\tconst messages = convertResponsesMessages(model, context, OPENAI_TOOL_CALL_PROVIDERS, {\n\t\tpreserveThinking: reasoningRequested,\n\t\tgrammarToolInputProperties,\n\t\tdeferredTools: toolPlacement.deferred,\n\t\tdeferredToolsMode,\n\t\ttoolOptions: {\n\t\t\tsupportsStrictMode: compat.supportsStrictMode,\n\t\t\tsupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,\n\t\t},\n\t});\n\n\tconst cacheRetention = resolveCacheRetention(options?.cacheRetention ?? model.cacheRetention, options?.env);\n\tconst disableImplicitPromptCache = cacheRetention === \"none\" && compat.supportsExplicitPromptCacheMode;\n\tconst params: MutableResponsesPayload = {\n\t\tmodel: model.id,\n\t\tinput: messages,\n\t\tstream: true,\n\t\tprompt_cache_key: cacheRetention === \"none\" ? undefined : clampOpenAIPromptCacheKey(options?.sessionId),\n\t\tprompt_cache_retention: getPromptCacheRetention(compat, cacheRetention),\n\t\tprompt_cache_options: disableImplicitPromptCache ? { mode: \"explicit\" } : undefined,\n\t\tstore: false,\n\t};\n\n\tif (options?.maxTokens) {\n\t\tparams.max_output_tokens = Math.max(options.maxTokens, OPENAI_RESPONSES_MIN_OUTPUT_TOKENS);\n\t}\n\n\tif (options?.temperature !== undefined) {\n\t\tparams.temperature = options?.temperature;\n\t}\n\n\tif (options?.serviceTier !== undefined) {\n\t\tparams.service_tier = options.serviceTier;\n\t}\n\n\tif (toolPlacement.immediate.length > 0) {\n\t\tparams.tools = convertResponsesTools(toolPlacement.immediate, {\n\t\t\tsupportsStrictMode: compat.supportsStrictMode,\n\t\t\tsupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,\n\t\t});\n\t}\n\n\tif (options?.toolChoice !== undefined) {\n\t\tparams.tool_choice = options.toolChoice;\n\t}\n\n\tif (model.reasoning) {\n\t\tif (reasoningRequested) {\n\t\t\tparams.reasoning = {\n\t\t\t\teffort: reasoningEffort as NonNullable<typeof params.reasoning>[\"effort\"],\n\t\t\t\t...(options?.reasoningSummary === null ? {} : { summary: options?.reasoningSummary || \"auto\" }),\n\t\t\t};\n\t\t\tparams.include = [\"reasoning.encrypted_content\"];\n\t\t} else if (!reasoningUnavailable && model.provider !== \"github-copilot\" && model.thinkingLevelMap?.off !== null) {\n\t\t\tparams.reasoning = {\n\t\t\t\teffort: (model.thinkingLevelMap?.off ?? \"none\") as NonNullable<typeof params.reasoning>[\"effort\"],\n\t\t\t};\n\t\t}\n\t\tif (model.provider === \"xai\") params.include = [\"reasoning.encrypted_content\"];\n\t}\n\n\tapplyExtraBodyToResponsesParams(params, options?.extraBody);\n\n\t// Last so custom keys override the named request fields.\n\tif (options?.samplingParams) {\n\t\tObject.assign(params, options.samplingParams);\n\t}\n\n\treturn params;\n}\n\nfunction applyExtraBodyToResponsesParams(\n\tparams: ResponseCreateParamsStreaming,\n\textraBody: Record<string, unknown> | undefined,\n): void {\n\tif (!extraBody) return;\n\tfor (const [key, value] of Object.entries(extraBody)) {\n\t\tif (OPENAI_RESPONSES_RESERVED_BODY_KEYS.has(key)) continue;\n\t\tObject.defineProperty(params, key, { value, writable: true, enumerable: true, configurable: true });\n\t}\n}\n\nfunction getDoneReason(stopReason: AssistantMessage[\"stopReason\"]): \"stop\" | \"length\" | \"toolUse\" {\n\tif (stopReason === \"length\" || stopReason === \"toolUse\") return stopReason;\n\treturn \"stop\";\n}\n\nfunction getWebSocketConstructor(): WebSocketConstructor | null {\n\tconst wsConstructor = (globalThis as { WebSocket?: WebSocketConstructor }).WebSocket;\n\treturn typeof wsConstructor === \"function\" ? wsConstructor : null;\n}\n\nfunction getWebSocketReadyState(socket: WebSocketLike): number | undefined {\n\tconst readyState = (socket as { readyState?: number }).readyState;\n\treturn typeof readyState === \"number\" ? readyState : undefined;\n}\n\nfunction isWebSocketReusable(socket: WebSocketLike): boolean {\n\tconst readyState = getWebSocketReadyState(socket);\n\treturn readyState === undefined || readyState === 1;\n}\n\nfunction closeWebSocketSilently(socket: WebSocketLike, code = 1000, reason = \"done\"): void {\n\ttry {\n\t\tsocket.close(code, reason);\n\t} catch {}\n}\n\nfunction scheduleSessionWebSocketExpiry(sessionId: string, entry: CachedWebSocketConnection): void {\n\tif (entry.idleTimer) {\n\t\tclearTimeout(entry.idleTimer);\n\t}\n\tentry.idleTimer = setTimeout(() => {\n\t\tif (entry.busy) return;\n\t\tcloseWebSocketSilently(entry.socket, 1000, \"idle_timeout\");\n\t\twebsocketSessionCache.delete(sessionId);\n\t}, SESSION_WEBSOCKET_CACHE_TTL_MS);\n\tconst unref = (entry.idleTimer as { unref?: () => void }).unref;\n\tif (unref) unref.call(entry.idleTimer);\n}\n\nasync function connectWebSocket(url: string, headers: Headers, signal?: AbortSignal): Promise<WebSocketLike> {\n\tconst WebSocketConstructorValue = getWebSocketConstructor();\n\tif (!WebSocketConstructorValue) {\n\t\tthrow new Error(\"WebSocket transport is not available in this runtime\");\n\t}\n\n\tconst websocketHeaders = headersToRecord(headers);\n\n\treturn new Promise<WebSocketLike>((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet socket: WebSocketLike;\n\n\t\tconst cleanup = () => {\n\t\t\tsocket.removeEventListener(\"open\", onOpen);\n\t\t\tsocket.removeEventListener(\"error\", onError);\n\t\t\tsocket.removeEventListener(\"close\", onClose);\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t};\n\t\tconst settleReject = (error: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t};\n\t\tconst onOpen: WebSocketListener = () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tresolve(socket);\n\t\t};\n\t\tconst onError: WebSocketListener = (event) => {\n\t\t\tsettleReject(extractWebSocketError(event));\n\t\t};\n\t\tconst onClose: WebSocketListener = (event) => {\n\t\t\tsettleReject(extractWebSocketCloseError(event));\n\t\t};\n\t\tconst onAbort = () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tcloseWebSocketSilently(socket, 1000, \"aborted\");\n\t\t\treject(new Error(\"Request was aborted\"));\n\t\t};\n\n\t\ttry {\n\t\t\tsocket = new WebSocketConstructorValue(url, { headers: websocketHeaders });\n\t\t} catch (error) {\n\t\t\treject(error instanceof Error ? error : new Error(String(error)));\n\t\t\treturn;\n\t\t}\n\n\t\tsocket.addEventListener(\"open\", onOpen);\n\t\tsocket.addEventListener(\"error\", onError);\n\t\tsocket.addEventListener(\"close\", onClose);\n\t\tsignal?.addEventListener(\"abort\", onAbort);\n\t});\n}\n\nasync function acquireWebSocket(\n\turl: string,\n\theaders: Headers,\n\tsessionId: string | undefined,\n\tsignal?: AbortSignal,\n): Promise<{ socket: WebSocketLike; release: (options?: { keep?: boolean }) => void }> {\n\tif (!sessionId) {\n\t\tconst socket = await connectWebSocket(url, headers, signal);\n\t\treturn { socket, release: () => closeWebSocketSilently(socket) };\n\t}\n\n\tconst cached = websocketSessionCache.get(sessionId);\n\tif (cached) {\n\t\tif (cached.idleTimer) {\n\t\t\tclearTimeout(cached.idleTimer);\n\t\t\tcached.idleTimer = undefined;\n\t\t}\n\t\tif (!cached.busy && isWebSocketReusable(cached.socket)) {\n\t\t\tcached.busy = true;\n\t\t\treturn {\n\t\t\t\tsocket: cached.socket,\n\t\t\t\trelease: ({ keep } = {}) => {\n\t\t\t\t\tif (!keep || !isWebSocketReusable(cached.socket)) {\n\t\t\t\t\t\tcloseWebSocketSilently(cached.socket);\n\t\t\t\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcached.busy = false;\n\t\t\t\t\tscheduleSessionWebSocketExpiry(sessionId, cached);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (!cached.busy) {\n\t\t\tcloseWebSocketSilently(cached.socket);\n\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t}\n\t}\n\n\tconst socket = await connectWebSocket(url, headers, signal);\n\tconst entry: CachedWebSocketConnection = { socket, busy: true };\n\twebsocketSessionCache.set(sessionId, entry);\n\treturn {\n\t\tsocket,\n\t\trelease: ({ keep } = {}) => {\n\t\t\tif (!keep || !isWebSocketReusable(entry.socket)) {\n\t\t\t\tcloseWebSocketSilently(entry.socket);\n\t\t\t\tif (entry.idleTimer) clearTimeout(entry.idleTimer);\n\t\t\t\tif (websocketSessionCache.get(sessionId) === entry) {\n\t\t\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tentry.busy = false;\n\t\t\tscheduleSessionWebSocketExpiry(sessionId, entry);\n\t\t},\n\t};\n}\n\nfunction extractWebSocketError(event: unknown): Error {\n\tif (event && typeof event === \"object\" && \"message\" in event) {\n\t\tconst message = (event as { message?: string }).message;\n\t\tif (typeof message === \"string\" && message.length > 0) {\n\t\t\treturn new Error(message);\n\t\t}\n\t}\n\treturn new Error(\"WebSocket error\");\n}\n\nfunction extractWebSocketCloseError(event: unknown): Error {\n\tif (event && typeof event === \"object\") {\n\t\tconst code = \"code\" in event ? (event as { code?: number }).code : undefined;\n\t\tconst reason = \"reason\" in event ? (event as { reason?: string }).reason : undefined;\n\t\tconst codeText = typeof code === \"number\" ? ` ${code}` : \"\";\n\t\tconst reasonText = typeof reason === \"string\" && reason.length > 0 ? ` ${reason}` : \"\";\n\t\treturn new Error(`WebSocket closed${codeText}${reasonText}`.trim());\n\t}\n\treturn new Error(\"WebSocket closed\");\n}\n\nasync function decodeWebSocketData(data: unknown): Promise<string | null> {\n\tif (typeof data === \"string\") return data;\n\tif (data instanceof ArrayBuffer) {\n\t\treturn new TextDecoder().decode(new Uint8Array(data));\n\t}\n\tif (ArrayBuffer.isView(data)) {\n\t\treturn new TextDecoder().decode(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));\n\t}\n\tif (data && typeof data === \"object\" && \"arrayBuffer\" in data) {\n\t\tconst arrayBuffer = await (data as { arrayBuffer: () => Promise<ArrayBuffer> }).arrayBuffer();\n\t\treturn new TextDecoder().decode(new Uint8Array(arrayBuffer));\n\t}\n\treturn null;\n}\n\nasync function* parseWebSocket(socket: WebSocketLike, signal?: AbortSignal): AsyncGenerator<ResponseStreamEvent> {\n\tconst queue: ResponseStreamEvent[] = [];\n\tlet pending: (() => void) | null = null;\n\tlet done = false;\n\tlet failed: Error | null = null;\n\tlet sawCompletion = false;\n\n\tconst wake = () => {\n\t\tif (!pending) return;\n\t\tconst resolve = pending;\n\t\tpending = null;\n\t\tresolve();\n\t};\n\tconst onMessage: WebSocketListener = (event) => {\n\t\tvoid (async () => {\n\t\t\tif (!event || typeof event !== \"object\" || !(\"data\" in event)) return;\n\t\t\tconst text = await decodeWebSocketData((event as { data?: unknown }).data);\n\t\t\tif (!text) return;\n\t\t\ttry {\n\t\t\t\tconst parsed = JSON.parse(text) as ResponseStreamEvent;\n\t\t\t\tif (parsed.type === \"response.completed\" || parsed.type === \"response.incomplete\") {\n\t\t\t\t\tsawCompletion = true;\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t\tqueue.push(parsed);\n\t\t\t\twake();\n\t\t\t} catch {}\n\t\t})();\n\t};\n\tconst onError: WebSocketListener = (event) => {\n\t\tfailed = extractWebSocketError(event);\n\t\tdone = true;\n\t\twake();\n\t};\n\tconst onClose: WebSocketListener = (event) => {\n\t\tif (!sawCompletion && !failed) {\n\t\t\tfailed = extractWebSocketCloseError(event);\n\t\t}\n\t\tdone = true;\n\t\twake();\n\t};\n\tconst onAbort = () => {\n\t\tfailed = new Error(\"Request was aborted\");\n\t\tdone = true;\n\t\twake();\n\t};\n\n\tsocket.addEventListener(\"message\", onMessage);\n\tsocket.addEventListener(\"error\", onError);\n\tsocket.addEventListener(\"close\", onClose);\n\tsignal?.addEventListener(\"abort\", onAbort);\n\ttry {\n\t\twhile (true) {\n\t\t\tif (signal?.aborted) throw new Error(\"Request was aborted\");\n\t\t\tif (queue.length > 0) {\n\t\t\t\tconst event = queue.shift();\n\t\t\t\tif (event) yield event;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (done) break;\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tpending = resolve;\n\t\t\t});\n\t\t}\n\t\tif (failed) throw failed;\n\t\tif (!sawCompletion) throw new Error(\"WebSocket stream closed before response.completed\");\n\t} finally {\n\t\tsocket.removeEventListener(\"message\", onMessage);\n\t\tsocket.removeEventListener(\"error\", onError);\n\t\tsocket.removeEventListener(\"close\", onClose);\n\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\nasync function processWebSocketStream(\n\turl: string,\n\tparams: ResponseCreateParamsStreaming,\n\theaders: Headers,\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n\tmodel: Model<\"openai-responses\">,\n\tonStart: () => void,\n\tcacheSessionId: string | undefined,\n\tgrammarToolInputProperties: ReadonlyMap<string, string>,\n\toptions?: OpenAIResponsesOptions,\n): Promise<void> {\n\tconst { socket, release } = await acquireWebSocket(url, headers, cacheSessionId, options?.signal);\n\ttry {\n\t\tsocket.send(JSON.stringify({ type: \"response.create\", ...params }));\n\t\tonStart();\n\t\tawait options?.onResponse?.({ status: 101, headers: {} }, model);\n\t\tstream.push({ type: \"start\", partial: output });\n\t\tawait processResponsesStream(parseWebSocket(socket, options?.signal), output, stream, model, {\n\t\t\tserviceTier: options?.serviceTier,\n\t\t\tgrammarToolInputProperties,\n\t\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t\t});\n\t} finally {\n\t\trelease({ keep: false });\n\t}\n}\n\nfunction resolveOpenAIResponsesWebSocketUrl(model: Model<\"openai-responses\">, env?: ProviderEnv): string {\n\tconst baseUrl = isCloudflareProvider(model.provider)\n\t\t? resolveCloudflareBaseUrl(model, env)\n\t\t: model.baseUrl || \"https://api.openai.com/v1\";\n\tconst url = new URL(baseUrl);\n\tif (!url.pathname.endsWith(\"/responses\")) {\n\t\turl.pathname = `${url.pathname.replace(/\\/$/, \"\")}/responses`;\n\t}\n\tif (url.protocol === \"https:\") url.protocol = \"wss:\";\n\telse if (url.protocol === \"http:\") url.protocol = \"ws:\";\n\treturn url.toString();\n}\n\nfunction buildWebSocketHeaders(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: Context,\n\tapiKey: string,\n\toptionsHeaders?: ProviderHeaders,\n\tsessionId?: string,\n\tenv?: ProviderEnv,\n): Headers {\n\tconst headers = new Headers(model.headers);\n\tlet suppressDefaultAuthorization = false;\n\tif (model.provider === \"github-copilot\") {\n\t\tconst hasImages = hasCopilotVisionInput(context.messages);\n\t\tconst copilotHeaders = buildCopilotDynamicHeaders({ messages: context.messages, hasImages });\n\t\tfor (const [key, value] of Object.entries(copilotHeaders)) {\n\t\t\theaders.set(key, value);\n\t\t}\n\t}\n\tfor (const [key, value] of Object.entries(optionsHeaders || {})) {\n\t\tif (value === null) {\n\t\t\tif (key.toLowerCase() === \"authorization\") suppressDefaultAuthorization = true;\n\t\t\theaders.delete(key);\n\t\t} else {\n\t\t\theaders.set(key, value);\n\t\t}\n\t}\n\tif (!suppressDefaultAuthorization && !headers.has(\"Authorization\")) {\n\t\theaders.set(\"Authorization\", `Bearer ${apiKey}`);\n\t}\n\tif (sessionId) {\n\t\tconst compat = getCompat(model, env);\n\t\tif (compat.sessionAffinityFormat === \"openai\") {\n\t\t\theaders.set(\"session_id\", sessionId);\n\t\t}\n\t\tif (compat.sessionAffinityFormat === \"openai\" || compat.sessionAffinityFormat === \"openai-nosession\") {\n\t\t\theaders.set(\"x-client-request-id\", sessionId);\n\t\t} else if (compat.sessionAffinityFormat === \"openrouter\") {\n\t\t\theaders.set(\"x-session-id\", sessionId);\n\t\t}\n\t}\n\theaders.delete(\"accept\");\n\theaders.delete(\"content-type\");\n\theaders.delete(\"OpenAI-Beta\");\n\theaders.delete(\"openai-beta\");\n\theaders.set(\"OpenAI-Beta\", OPENAI_BETA_RESPONSES_WEBSOCKETS);\n\treturn headers;\n}\n\nfunction getServiceTierCostMultiplier(\n\tmodel: Pick<Model<\"openai-responses\">, \"id\">,\n\tserviceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n): number {\n\tswitch (serviceTier) {\n\t\tcase \"flex\":\n\t\t\treturn 0.5;\n\t\tcase \"priority\":\n\t\t\treturn model.id === \"gpt-5.5\" ? 2.5 : 2;\n\t\tdefault:\n\t\t\treturn 1;\n\t}\n}\n\nfunction applyServiceTierPricing(\n\tusage: Usage,\n\tserviceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n\tmodel: Pick<Model<\"openai-responses\">, \"id\">,\n) {\n\tconst multiplier = getServiceTierCostMultiplier(model, serviceTier);\n\tif (multiplier === 1) return;\n\n\tusage.cost.input *= multiplier;\n\tusage.cost.output *= multiplier;\n\tusage.cost.cacheRead *= multiplier;\n\tusage.cost.cacheWrite *= multiplier;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n}\n"]}
@@ -113,7 +113,7 @@ export function transformMessages(messages, model, normalizeToolCallId, options
113
113
  // Redacted thinking is opaque encrypted content, only valid for the same model.
114
114
  // Drop it for cross-model to avoid API errors.
115
115
  if (block.redacted) {
116
- return isSameModel && preserveProviderState ? { ...block } : [];
116
+ return isSameModel ? { ...block } : [];
117
117
  }
118
118
  const hasUsableSignature = typeof block.thinkingSignature === "string" && block.thinkingSignature.trim().length > 0;
119
119
  // For same model: keep signed thinking only while replaying provider state.
@@ -1 +1 @@
1
- {"version":3,"file":"transform-messages.js","sourceRoot":"","sources":["../../src/api/transform-messages.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,iCAAiC,GAAG,gDAAgD,CAAC;AAC3F,MAAM,iCAAiC,GAAG,qDAAqD,CAAC;AAChG,MAAM,yBAAyB,GAAG,qDAAqD,CAAC;AACxF,MAAM,yBAAyB,GAAG,0DAA0D,CAAC;AAE7F,SAAS,2BAA2B,CACnC,OAAuC,EACvC,WAAmB,EACnB,OAAyC;IAEzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,OAAO,CAAC;IAChB,CAAC;IACD,MAAM,MAAM,GAAmC,EAAE,CAAC;IAClD,IAAI,sBAAsB,GAAG,KAAK,CAAC;IAEnC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,sBAAsB,EAAE,CAAC;gBAC7B,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;YAClD,CAAC;YACD,sBAAsB,GAAG,IAAI,CAAC;YAC9B,SAAS;QACV,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,sBAAsB,GAAG,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;IAC9E,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,4BAA4B,CAAC,OAAuC,EAAE,WAAmB;IACjG,MA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CAAC,IAAI,KAAK,UAAU;gBAAE,SAAS;YACxC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;YACpE,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,QAAQ,CAAC;YAChG,MAAM,aAAa,GAAG,eAAe;iBACnC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACd,EAAE,IAAI,CACL,CAAC,SAAS,EAAE,EAAE,CACb,CAAC,SAAS,CAAC,QAAQ;gBACnB,SAAS,CAAC,WAAW,GAAG,WAAW;gBACnC,SAAS,CAAC,WAAW,GAAG,oBAAoB,CAC7C,CAAC;YAEH,IAAI,aAAa,EAAE,CAAC;gBACnB,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC;gBAC9B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBACnC,SAAS;YACV,CAAC;YAED,MAAM,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,YAAY;gBAClB,UAAU,EAAE,KAAK,CAAC,EAAE;gBACpB,QAAQ,EAAE,KAAK,CAAC,IAAI;gBACpB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;gBACvD,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACA,CAAC,CAAC;QACzB,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tImageContent,\n\tMessage,\n\tModel,\n\tTextContent,\n\tToolCall,\n\tToolResultMessage,\n} from \"../types.ts\";\nimport { isVideoMimeType } from \"../types.ts\";\n\nconst NON_VISION_USER_IMAGE_PLACEHOLDER = \"(image omitted: model does not support images)\";\nconst NON_VISION_TOOL_IMAGE_PLACEHOLDER = \"(tool image omitted: model does not support images)\";\nconst NO_VIDEO_USER_PLACEHOLDER = \"(video omitted: model does not support video input)\";\nconst NO_VIDEO_TOOL_PLACEHOLDER = \"(tool video omitted: model does not support video input)\";\n\nfunction replaceMediaWithPlaceholder(\n\tcontent: (TextContent | ImageContent)[],\n\tplaceholder: string,\n\tmatches: (block: ImageContent) => boolean,\n): (TextContent | ImageContent)[] {\n\tif (!content.some((block) => block.type === \"image\" && matches(block))) {\n\t\treturn content;\n\t}\n\tconst result: (TextContent | ImageContent)[] = [];\n\tlet previousWasPlaceholder = false;\n\n\tfor (const block of content) {\n\t\tif (block.type === \"image\" && matches(block)) {\n\t\t\tif (!previousWasPlaceholder) {\n\t\t\t\tresult.push({ type: \"text\", text: placeholder });\n\t\t\t}\n\t\t\tpreviousWasPlaceholder = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult.push(block);\n\t\tpreviousWasPlaceholder = block.type === \"text\" && block.text === placeholder;\n\t}\n\n\treturn result;\n}\n\nfunction replaceImagesWithPlaceholder(content: (TextContent | ImageContent)[], placeholder: string): TextContent[] {\n\tconst result: TextContent[] = [];\n\tlet previousWasPlaceholder = false;\n\n\tfor (const block of content) {\n\t\tif (block.type === \"image\") {\n\t\t\tif (!previousWasPlaceholder) {\n\t\t\t\tresult.push({ type: \"text\", text: placeholder });\n\t\t\t}\n\t\t\tpreviousWasPlaceholder = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult.push(block);\n\t\tpreviousWasPlaceholder = block.text === placeholder;\n\t}\n\n\treturn result;\n}\n\nfunction downgradeUnsupportedImages<TApi extends Api>(messages: Message[], model: Model<TApi>): Message[] {\n\tconst supportsImages = model.input.includes(\"image\");\n\tconst supportsVideo = model.input.includes(\"video\");\n\tif (supportsImages && supportsVideo) {\n\t\treturn messages;\n\t}\n\n\treturn messages.map((msg) => {\n\t\tif (msg.role === \"user\" && Array.isArray(msg.content)) {\n\t\t\tlet content = msg.content;\n\t\t\t// Video payloads ride ImageContent blocks; strip them first for models\n\t\t\t// without the \"video\" modality so they never hit an incompatible wire.\n\t\t\tif (!supportsVideo) {\n\t\t\t\tcontent = replaceMediaWithPlaceholder(content, NO_VIDEO_USER_PLACEHOLDER, (b) =>\n\t\t\t\t\tisVideoMimeType(b.mimeType),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!supportsImages) {\n\t\t\t\tcontent = replaceImagesWithPlaceholder(content, NON_VISION_USER_IMAGE_PLACEHOLDER);\n\t\t\t}\n\t\t\treturn { ...msg, content };\n\t\t}\n\n\t\tif (msg.role === \"toolResult\") {\n\t\t\tlet content = msg.content;\n\t\t\tif (!supportsVideo) {\n\t\t\t\tcontent = replaceMediaWithPlaceholder(content, NO_VIDEO_TOOL_PLACEHOLDER, (b) =>\n\t\t\t\t\tisVideoMimeType(b.mimeType),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!supportsImages) {\n\t\t\t\tcontent = replaceImagesWithPlaceholder(content, NON_VISION_TOOL_IMAGE_PLACEHOLDER);\n\t\t\t}\n\t\t\treturn { ...msg, content };\n\t\t}\n\n\t\treturn msg;\n\t});\n}\n\nexport interface TransformMessagesOptions {\n\t/**\n\t * Preserve provider-native thinking/reasoning replay state for the current\n\t * model. When false, standalone same-model thinking is omitted, while\n\t * thinking attached to tool calls is preserved for provider validation.\n\t */\n\tpreserveThinking?: boolean;\n\tpreserveTextSignatures?: boolean;\n\t/**\n\t * Preserve same-model thinking blocks that do not carry a usable signature\n\t * so provider adapters can downgrade them to plain text or provider-specific\n\t * compatibility payloads.\n\t */\n\tpreserveUnsignedThinking?: boolean;\n\t/**\n\t * Normalize tool-call IDs even when stored provider/API/model metadata match\n\t * the target. Enable only for target protocols whose wire contract requires it.\n\t */\n\tnormalizeSameModelToolCallIds?: boolean;\n}\n\n/**\n * Normalize tool call ID for cross-provider compatibility.\n * OpenAI Responses API generates IDs that are 450+ chars with special characters like `|`.\n * Anthropic APIs require IDs matching ^[a-zA-Z0-9_-]+$ (max 64 chars).\n */\nexport function transformMessages<TApi extends Api>(\n\tmessages: Message[],\n\tmodel: Model<TApi>,\n\tnormalizeToolCallId?: (id: string, model: Model<TApi>, source: AssistantMessage) => string,\n\toptions: TransformMessagesOptions = {},\n): Message[] {\n\t// Build a map of original tool call IDs to normalized IDs\n\tconst toolCallIdMap = new Map<string, string>();\n\t// Normalize null/undefined content from untyped callers (custom tools, hand-built\n\t// histories, old session files) so downstream code can rely on the type contract.\n\tconst normalizedMessages = messages.map((msg) => (msg.content == null ? { ...msg, content: [] } : msg));\n\tconst imageAwareMessages = downgradeUnsupportedImages(normalizedMessages, model);\n\tconst preserveThinking = options.preserveThinking ?? true;\n\tconst preserveTextSignatures = options.preserveTextSignatures ?? false;\n\tconst preserveUnsignedThinking = options.preserveUnsignedThinking ?? false;\n\tconst normalizeSameModelToolCallIds = options.normalizeSameModelToolCallIds ?? false;\n\n\t// First pass: transform messages (unsupported image downgrade, thinking blocks, tool call ID normalization)\n\tconst transformed = imageAwareMessages.map((msg) => {\n\t\t// User messages pass through unchanged\n\t\tif (msg.role === \"user\") {\n\t\t\treturn msg;\n\t\t}\n\n\t\t// Handle toolResult messages - normalize toolCallId if we have a mapping\n\t\tif (msg.role === \"toolResult\") {\n\t\t\tconst normalizedId = toolCallIdMap.get(msg.toolCallId);\n\t\t\tif (normalizedId && normalizedId !== msg.toolCallId) {\n\t\t\t\treturn { ...msg, toolCallId: normalizedId };\n\t\t\t}\n\t\t\treturn msg;\n\t\t}\n\n\t\t// Assistant messages need transformation check\n\t\tif (msg.role === \"assistant\") {\n\t\t\tconst assistantMsg = msg as AssistantMessage;\n\t\t\tconst isSameModel =\n\t\t\t\tassistantMsg.provider === model.provider &&\n\t\t\t\tassistantMsg.api === model.api &&\n\t\t\t\tassistantMsg.model === model.id;\n\t\t\tconst hasToolCalls = assistantMsg.content.some((block) => block.type === \"toolCall\");\n\t\t\tconst preserveProviderState = preserveThinking || hasToolCalls;\n\n\t\t\tconst transformedContent = assistantMsg.content.flatMap((block) => {\n\t\t\t\tif (block.type === \"thinking\") {\n\t\t\t\t\t// Redacted thinking is opaque encrypted content, only valid for the same model.\n\t\t\t\t\t// Drop it for cross-model to avoid API errors.\n\t\t\t\t\tif (block.redacted) {\n\t\t\t\t\t\treturn isSameModel && preserveProviderState ? { ...block } : [];\n\t\t\t\t\t}\n\t\t\t\t\tconst hasUsableSignature =\n\t\t\t\t\t\ttypeof block.thinkingSignature === \"string\" && block.thinkingSignature.trim().length > 0;\n\t\t\t\t\t// For same model: keep signed thinking only while replaying provider state.\n\t\t\t\t\t// Empty signed blocks are opaque compatibility state, not visible reasoning.\n\t\t\t\t\tif (isSameModel && hasUsableSignature && (preserveProviderState || block.thinking.trim() === \"\")) {\n\t\t\t\t\t\treturn { ...block };\n\t\t\t\t\t}\n\t\t\t\t\t// Skip empty thinking blocks, convert others to plain text\n\t\t\t\t\tif (!block.thinking || block.thinking.trim() === \"\") return [];\n\t\t\t\t\tif (isSameModel) {\n\t\t\t\t\t\treturn preserveProviderState || (preserveUnsignedThinking && !hasUsableSignature) ? { ...block } : [];\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\ttext: block.thinking,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (block.type === \"text\") {\n\t\t\t\t\tif (isSameModel && (preserveProviderState || preserveTextSignatures)) return { ...block };\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\ttext: block.text,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (block.type === \"toolCall\") {\n\t\t\t\t\tconst toolCall = block as ToolCall;\n\t\t\t\t\tlet normalizedToolCall: ToolCall = { ...toolCall };\n\n\t\t\t\t\tif ((!isSameModel || !preserveProviderState) && toolCall.thoughtSignature) {\n\t\t\t\t\t\tdelete (normalizedToolCall as { thoughtSignature?: string }).thoughtSignature;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ((!isSameModel || normalizeSameModelToolCallIds) && normalizeToolCallId) {\n\t\t\t\t\t\tconst normalizedId = normalizeToolCallId(toolCall.id, model, assistantMsg);\n\t\t\t\t\t\tif (normalizedId !== toolCall.id) {\n\t\t\t\t\t\t\ttoolCallIdMap.set(toolCall.id, normalizedId);\n\t\t\t\t\t\t\tnormalizedToolCall = { ...normalizedToolCall, id: normalizedId };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn normalizedToolCall;\n\t\t\t\t}\n\n\t\t\t\treturn block;\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t...assistantMsg,\n\t\t\t\tcontent: transformedContent,\n\t\t\t};\n\t\t}\n\t\treturn msg;\n\t});\n\n\t// Second pass: pair every replayable tool call with the earliest unconsumed\n\t// result after its declaring assistant. Results are emitted adjacent to their\n\t// calls because Anthropic requires that ordering. A reused ID starts a new\n\t// pairing window, so a later result cannot repair an earlier call.\n\tconst result: Message[] = [];\n\tconst toolResultsById = new Map<string, { message: ToolResultMessage; sourceIndex: number; consumed: boolean }[]>();\n\tconst nextToolCallIndexById = new Map<string, number[]>();\n\t// Tool calls declared only by assistants the emit loop drops (errored/aborted).\n\t// Their results must not be emitted either: a strict provider rejects a tool\n\t// message whose tool_call_id no assistant in the request declares.\n\tconst droppedCallIds = new Set<string>();\n\n\tfor (let sourceIndex = 0; sourceIndex < transformed.length; sourceIndex++) {\n\t\tconst message = transformed[sourceIndex];\n\t\tif (message.role === \"toolResult\") {\n\t\t\tconst entries = toolResultsById.get(message.toolCallId) ?? [];\n\t\t\tentries.push({ message, sourceIndex, consumed: false });\n\t\t\ttoolResultsById.set(message.toolCallId, entries);\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role !== \"assistant\") {\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.stopReason === \"error\" || message.stopReason === \"aborted\") {\n\t\t\tfor (const block of message.content) {\n\t\t\t\tif (block.type === \"toolCall\") droppedCallIds.add(block.id);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const block of message.content) {\n\t\t\tif (block.type !== \"toolCall\") continue;\n\t\t\tconst indexes = nextToolCallIndexById.get(block.id) ?? [];\n\t\t\tindexes.push(sourceIndex);\n\t\t\tnextToolCallIndexById.set(block.id, indexes);\n\t\t}\n\t}\n\n\tfor (let sourceIndex = 0; sourceIndex < transformed.length; sourceIndex++) {\n\t\tconst message = transformed[sourceIndex];\n\t\tif (message.role === \"toolResult\") {\n\t\t\tconst entry = toolResultsById\n\t\t\t\t.get(message.toolCallId)\n\t\t\t\t?.find((candidate) => candidate.sourceIndex === sourceIndex);\n\t\t\tif (!entry?.consumed) {\n\t\t\t\t// Skip results whose call was declared only by a dropped\n\t\t\t\t// (errored/aborted) assistant. An id re-declared by a kept assistant\n\t\t\t\t// still pairs through the normal windows, so keep those results.\n\t\t\t\tif (!droppedCallIds.has(message.toolCallId) || nextToolCallIndexById.has(message.toolCallId)) {\n\t\t\t\t\tresult.push(message);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role !== \"assistant\") {\n\t\t\tresult.push(message);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Skip errored/aborted assistant messages entirely. These incomplete turns\n\t\t// must not be revived merely because a matching result appears later.\n\t\tif (message.stopReason === \"error\" || message.stopReason === \"aborted\") continue;\n\n\t\tresult.push(message);\n\t\tfor (const block of message.content) {\n\t\t\tif (block.type !== \"toolCall\") continue;\n\t\t\tconst laterDeclarations = nextToolCallIndexById.get(block.id) ?? [];\n\t\t\tconst nextDeclarationIndex = laterDeclarations.find((index) => index > sourceIndex) ?? Infinity;\n\t\t\tconst matchedResult = toolResultsById\n\t\t\t\t.get(block.id)\n\t\t\t\t?.find(\n\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t!candidate.consumed &&\n\t\t\t\t\t\tcandidate.sourceIndex > sourceIndex &&\n\t\t\t\t\t\tcandidate.sourceIndex < nextDeclarationIndex,\n\t\t\t\t);\n\n\t\t\tif (matchedResult) {\n\t\t\t\tmatchedResult.consumed = true;\n\t\t\t\tresult.push(matchedResult.message);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tresult.push({\n\t\t\t\trole: \"toolResult\",\n\t\t\t\ttoolCallId: block.id,\n\t\t\t\ttoolName: block.name,\n\t\t\t\tcontent: [{ type: \"text\", text: \"No result provided\" }],\n\t\t\t\tisError: true,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t} as ToolResultMessage);\n\t\t}\n\t}\n\n\treturn result;\n}\n"]}
1
+ {"version":3,"file":"transform-messages.js","sourceRoot":"","sources":["../../src/api/transform-messages.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,iCAAiC,GAAG,gDAAgD,CAAC;AAC3F,MAAM,iCAAiC,GAAG,qDAAqD,CAAC;AAChG,MAAM,yBAAyB,GAAG,qDAAqD,CAAC;AACxF,MAAM,yBAAyB,GAAG,0DAA0D,CAAC;AAE7F,SAAS,2BAA2B,CACnC,OAAuC,EACvC,WAAmB,EACnB,OAAyC;IAEzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,OAAO,CAAC;IAChB,CAAC;IACD,MAAM,MAAM,GAAmC,EAAE,CAAC;IAClD,IAAI,sBAAsB,GAAG,KAAK,CAAC;IAEnC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,sBAAsB,EAAE,CAAC;gBAC7B,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,W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AAE,IAAI,CAAC,GAAG,EAAE;aACA,CAAC,CAAC;QACzB,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tImageContent,\n\tMessage,\n\tModel,\n\tTextContent,\n\tToolCall,\n\tToolResultMessage,\n} from \"../types.ts\";\nimport { isVideoMimeType } from \"../types.ts\";\n\nconst NON_VISION_USER_IMAGE_PLACEHOLDER = \"(image omitted: model does not support images)\";\nconst NON_VISION_TOOL_IMAGE_PLACEHOLDER = \"(tool image omitted: model does not support images)\";\nconst NO_VIDEO_USER_PLACEHOLDER = \"(video omitted: model does not support video input)\";\nconst NO_VIDEO_TOOL_PLACEHOLDER = \"(tool video omitted: model does not support video input)\";\n\nfunction replaceMediaWithPlaceholder(\n\tcontent: (TextContent | ImageContent)[],\n\tplaceholder: string,\n\tmatches: (block: ImageContent) => boolean,\n): (TextContent | ImageContent)[] {\n\tif (!content.some((block) => block.type === \"image\" && matches(block))) {\n\t\treturn content;\n\t}\n\tconst result: (TextContent | ImageContent)[] = [];\n\tlet previousWasPlaceholder = false;\n\n\tfor (const block of content) {\n\t\tif (block.type === \"image\" && matches(block)) {\n\t\t\tif (!previousWasPlaceholder) {\n\t\t\t\tresult.push({ type: \"text\", text: placeholder });\n\t\t\t}\n\t\t\tpreviousWasPlaceholder = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult.push(block);\n\t\tpreviousWasPlaceholder = block.type === \"text\" && block.text === placeholder;\n\t}\n\n\treturn result;\n}\n\nfunction replaceImagesWithPlaceholder(content: (TextContent | ImageContent)[], placeholder: string): TextContent[] {\n\tconst result: TextContent[] = [];\n\tlet previousWasPlaceholder = false;\n\n\tfor (const block of content) {\n\t\tif (block.type === \"image\") {\n\t\t\tif (!previousWasPlaceholder) {\n\t\t\t\tresult.push({ type: \"text\", text: placeholder });\n\t\t\t}\n\t\t\tpreviousWasPlaceholder = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult.push(block);\n\t\tpreviousWasPlaceholder = block.text === placeholder;\n\t}\n\n\treturn result;\n}\n\nfunction downgradeUnsupportedImages<TApi extends Api>(messages: Message[], model: Model<TApi>): Message[] {\n\tconst supportsImages = model.input.includes(\"image\");\n\tconst supportsVideo = model.input.includes(\"video\");\n\tif (supportsImages && supportsVideo) {\n\t\treturn messages;\n\t}\n\n\treturn messages.map((msg) => {\n\t\tif (msg.role === \"user\" && Array.isArray(msg.content)) {\n\t\t\tlet content = msg.content;\n\t\t\t// Video payloads ride ImageContent blocks; strip them first for models\n\t\t\t// without the \"video\" modality so they never hit an incompatible wire.\n\t\t\tif (!supportsVideo) {\n\t\t\t\tcontent = replaceMediaWithPlaceholder(content, NO_VIDEO_USER_PLACEHOLDER, (b) =>\n\t\t\t\t\tisVideoMimeType(b.mimeType),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!supportsImages) {\n\t\t\t\tcontent = replaceImagesWithPlaceholder(content, NON_VISION_USER_IMAGE_PLACEHOLDER);\n\t\t\t}\n\t\t\treturn { ...msg, content };\n\t\t}\n\n\t\tif (msg.role === \"toolResult\") {\n\t\t\tlet content = msg.content;\n\t\t\tif (!supportsVideo) {\n\t\t\t\tcontent = replaceMediaWithPlaceholder(content, NO_VIDEO_TOOL_PLACEHOLDER, (b) =>\n\t\t\t\t\tisVideoMimeType(b.mimeType),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!supportsImages) {\n\t\t\t\tcontent = replaceImagesWithPlaceholder(content, NON_VISION_TOOL_IMAGE_PLACEHOLDER);\n\t\t\t}\n\t\t\treturn { ...msg, content };\n\t\t}\n\n\t\treturn msg;\n\t});\n}\n\nexport interface TransformMessagesOptions {\n\t/**\n\t * Preserve provider-native thinking/reasoning replay state for the current\n\t * model. When false, standalone same-model thinking is omitted, while\n\t * thinking attached to tool calls is preserved for provider validation.\n\t */\n\tpreserveThinking?: boolean;\n\tpreserveTextSignatures?: boolean;\n\t/**\n\t * Preserve same-model thinking blocks that do not carry a usable signature\n\t * so provider adapters can downgrade them to plain text or provider-specific\n\t * compatibility payloads.\n\t */\n\tpreserveUnsignedThinking?: boolean;\n\t/**\n\t * Normalize tool-call IDs even when stored provider/API/model metadata match\n\t * the target. Enable only for target protocols whose wire contract requires it.\n\t */\n\tnormalizeSameModelToolCallIds?: boolean;\n}\n\n/**\n * Normalize tool call ID for cross-provider compatibility.\n * OpenAI Responses API generates IDs that are 450+ chars with special characters like `|`.\n * Anthropic APIs require IDs matching ^[a-zA-Z0-9_-]+$ (max 64 chars).\n */\nexport function transformMessages<TApi extends Api>(\n\tmessages: Message[],\n\tmodel: Model<TApi>,\n\tnormalizeToolCallId?: (id: string, model: Model<TApi>, source: AssistantMessage) => string,\n\toptions: TransformMessagesOptions = {},\n): Message[] {\n\t// Build a map of original tool call IDs to normalized IDs\n\tconst toolCallIdMap = new Map<string, string>();\n\t// Normalize null/undefined content from untyped callers (custom tools, hand-built\n\t// histories, old session files) so downstream code can rely on the type contract.\n\tconst normalizedMessages = messages.map((msg) => (msg.content == null ? { ...msg, content: [] } : msg));\n\tconst imageAwareMessages = downgradeUnsupportedImages(normalizedMessages, model);\n\tconst preserveThinking = options.preserveThinking ?? true;\n\tconst preserveTextSignatures = options.preserveTextSignatures ?? false;\n\tconst preserveUnsignedThinking = options.preserveUnsignedThinking ?? false;\n\tconst normalizeSameModelToolCallIds = options.normalizeSameModelToolCallIds ?? false;\n\n\t// First pass: transform messages (unsupported image downgrade, thinking blocks, tool call ID normalization)\n\tconst transformed = imageAwareMessages.map((msg) => {\n\t\t// User messages pass through unchanged\n\t\tif (msg.role === \"user\") {\n\t\t\treturn msg;\n\t\t}\n\n\t\t// Handle toolResult messages - normalize toolCallId if we have a mapping\n\t\tif (msg.role === \"toolResult\") {\n\t\t\tconst normalizedId = toolCallIdMap.get(msg.toolCallId);\n\t\t\tif (normalizedId && normalizedId !== msg.toolCallId) {\n\t\t\t\treturn { ...msg, toolCallId: normalizedId };\n\t\t\t}\n\t\t\treturn msg;\n\t\t}\n\n\t\t// Assistant messages need transformation check\n\t\tif (msg.role === \"assistant\") {\n\t\t\tconst assistantMsg = msg as AssistantMessage;\n\t\t\tconst isSameModel =\n\t\t\t\tassistantMsg.provider === model.provider &&\n\t\t\t\tassistantMsg.api === model.api &&\n\t\t\t\tassistantMsg.model === model.id;\n\t\t\tconst hasToolCalls = assistantMsg.content.some((block) => block.type === \"toolCall\");\n\t\t\tconst preserveProviderState = preserveThinking || hasToolCalls;\n\n\t\t\tconst transformedContent = assistantMsg.content.flatMap((block) => {\n\t\t\t\tif (block.type === \"thinking\") {\n\t\t\t\t\t// Redacted thinking is opaque encrypted content, only valid for the same model.\n\t\t\t\t\t// Drop it for cross-model to avoid API errors.\n\t\t\t\t\tif (block.redacted) {\n\t\t\t\t\t\treturn isSameModel ? { ...block } : [];\n\t\t\t\t\t}\n\t\t\t\t\tconst hasUsableSignature =\n\t\t\t\t\t\ttypeof block.thinkingSignature === \"string\" && block.thinkingSignature.trim().length > 0;\n\t\t\t\t\t// For same model: keep signed thinking only while replaying provider state.\n\t\t\t\t\t// Empty signed blocks are opaque compatibility state, not visible reasoning.\n\t\t\t\t\tif (isSameModel && hasUsableSignature && (preserveProviderState || block.thinking.trim() === \"\")) {\n\t\t\t\t\t\treturn { ...block };\n\t\t\t\t\t}\n\t\t\t\t\t// Skip empty thinking blocks, convert others to plain text\n\t\t\t\t\tif (!block.thinking || block.thinking.trim() === \"\") return [];\n\t\t\t\t\tif (isSameModel) {\n\t\t\t\t\t\treturn preserveProviderState || (preserveUnsignedThinking && !hasUsableSignature) ? { ...block } : [];\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\ttext: block.thinking,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (block.type === \"text\") {\n\t\t\t\t\tif (isSameModel && (preserveProviderState || preserveTextSignatures)) return { ...block };\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\ttext: block.text,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (block.type === \"toolCall\") {\n\t\t\t\t\tconst toolCall = block as ToolCall;\n\t\t\t\t\tlet normalizedToolCall: ToolCall = { ...toolCall };\n\n\t\t\t\t\tif ((!isSameModel || !preserveProviderState) && toolCall.thoughtSignature) {\n\t\t\t\t\t\tdelete (normalizedToolCall as { thoughtSignature?: string }).thoughtSignature;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ((!isSameModel || normalizeSameModelToolCallIds) && normalizeToolCallId) {\n\t\t\t\t\t\tconst normalizedId = normalizeToolCallId(toolCall.id, model, assistantMsg);\n\t\t\t\t\t\tif (normalizedId !== toolCall.id) {\n\t\t\t\t\t\t\ttoolCallIdMap.set(toolCall.id, normalizedId);\n\t\t\t\t\t\t\tnormalizedToolCall = { ...normalizedToolCall, id: normalizedId };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn normalizedToolCall;\n\t\t\t\t}\n\n\t\t\t\treturn block;\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t...assistantMsg,\n\t\t\t\tcontent: transformedContent,\n\t\t\t};\n\t\t}\n\t\treturn msg;\n\t});\n\n\t// Second pass: pair every replayable tool call with the earliest unconsumed\n\t// result after its declaring assistant. Results are emitted adjacent to their\n\t// calls because Anthropic requires that ordering. A reused ID starts a new\n\t// pairing window, so a later result cannot repair an earlier call.\n\tconst result: Message[] = [];\n\tconst toolResultsById = new Map<string, { message: ToolResultMessage; sourceIndex: number; consumed: boolean }[]>();\n\tconst nextToolCallIndexById = new Map<string, number[]>();\n\t// Tool calls declared only by assistants the emit loop drops (errored/aborted).\n\t// Their results must not be emitted either: a strict provider rejects a tool\n\t// message whose tool_call_id no assistant in the request declares.\n\tconst droppedCallIds = new Set<string>();\n\n\tfor (let sourceIndex = 0; sourceIndex < transformed.length; sourceIndex++) {\n\t\tconst message = transformed[sourceIndex];\n\t\tif (message.role === \"toolResult\") {\n\t\t\tconst entries = toolResultsById.get(message.toolCallId) ?? [];\n\t\t\tentries.push({ message, sourceIndex, consumed: false });\n\t\t\ttoolResultsById.set(message.toolCallId, entries);\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role !== \"assistant\") {\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.stopReason === \"error\" || message.stopReason === \"aborted\") {\n\t\t\tfor (const block of message.content) {\n\t\t\t\tif (block.type === \"toolCall\") droppedCallIds.add(block.id);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const block of message.content) {\n\t\t\tif (block.type !== \"toolCall\") continue;\n\t\t\tconst indexes = nextToolCallIndexById.get(block.id) ?? [];\n\t\t\tindexes.push(sourceIndex);\n\t\t\tnextToolCallIndexById.set(block.id, indexes);\n\t\t}\n\t}\n\n\tfor (let sourceIndex = 0; sourceIndex < transformed.length; sourceIndex++) {\n\t\tconst message = transformed[sourceIndex];\n\t\tif (message.role === \"toolResult\") {\n\t\t\tconst entry = toolResultsById\n\t\t\t\t.get(message.toolCallId)\n\t\t\t\t?.find((candidate) => candidate.sourceIndex === sourceIndex);\n\t\t\tif (!entry?.consumed) {\n\t\t\t\t// Skip results whose call was declared only by a dropped\n\t\t\t\t// (errored/aborted) assistant. An id re-declared by a kept assistant\n\t\t\t\t// still pairs through the normal windows, so keep those results.\n\t\t\t\tif (!droppedCallIds.has(message.toolCallId) || nextToolCallIndexById.has(message.toolCallId)) {\n\t\t\t\t\tresult.push(message);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role !== \"assistant\") {\n\t\t\tresult.push(message);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Skip errored/aborted assistant messages entirely. These incomplete turns\n\t\t// must not be revived merely because a matching result appears later.\n\t\tif (message.stopReason === \"error\" || message.stopReason === \"aborted\") continue;\n\n\t\tresult.push(message);\n\t\tfor (const block of message.content) {\n\t\t\tif (block.type !== \"toolCall\") continue;\n\t\t\tconst laterDeclarations = nextToolCallIndexById.get(block.id) ?? [];\n\t\t\tconst nextDeclarationIndex = laterDeclarations.find((index) => index > sourceIndex) ?? Infinity;\n\t\t\tconst matchedResult = toolResultsById\n\t\t\t\t.get(block.id)\n\t\t\t\t?.find(\n\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t!candidate.consumed &&\n\t\t\t\t\t\tcandidate.sourceIndex > sourceIndex &&\n\t\t\t\t\t\tcandidate.sourceIndex < nextDeclarationIndex,\n\t\t\t\t);\n\n\t\t\tif (matchedResult) {\n\t\t\t\tmatchedResult.consumed = true;\n\t\t\t\tresult.push(matchedResult.message);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tresult.push({\n\t\t\t\trole: \"toolResult\",\n\t\t\t\ttoolCallId: block.id,\n\t\t\t\ttoolName: block.name,\n\t\t\t\tcontent: [{ type: \"text\", text: \"No result provided\" }],\n\t\t\t\tisError: true,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t} as ToolResultMessage);\n\t\t}\n\t}\n\n\treturn result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"github-copilot.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/github-copilot.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,SAAS,EAA4C,MAAM,aAAa,CAAC;AA2ZvF,eAAO,MAAM,kBAAkB,EAAE,SAchC,CAAC"}
1
+ {"version":3,"file":"github-copilot.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/github-copilot.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,SAAS,EAA4C,MAAM,aAAa,CAAC;AAsevF,eAAO,MAAM,kBAAkB,EAAE,SAchC,CAAC"}