@code-yeongyu/senpi 2026.7.23 → 2026.7.24

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 (825) hide show
  1. package/CHANGELOG.md +131 -6
  2. package/README.md +14 -1
  3. package/dist/cli/args.d.ts +2 -0
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +6 -0
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/config-selector.js +1 -1
  8. package/dist/cli/config-selector.js.map +1 -1
  9. package/dist/core/agent-session-runtime.d.ts +15 -1
  10. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  11. package/dist/core/agent-session-runtime.js +12 -2
  12. package/dist/core/agent-session-runtime.js.map +1 -1
  13. package/dist/core/agent-session.d.ts +102 -4
  14. package/dist/core/agent-session.d.ts.map +1 -1
  15. package/dist/core/agent-session.js +1295 -320
  16. package/dist/core/agent-session.js.map +1 -1
  17. package/dist/core/compaction/branch-summarization.d.ts +7 -1
  18. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  19. package/dist/core/compaction/branch-summarization.js +8 -12
  20. package/dist/core/compaction/branch-summarization.js.map +1 -1
  21. package/dist/core/compaction/compaction.d.ts +22 -4
  22. package/dist/core/compaction/compaction.d.ts.map +1 -1
  23. package/dist/core/compaction/compaction.js +114 -51
  24. package/dist/core/compaction/compaction.js.map +1 -1
  25. package/dist/core/compaction/lifecycle.d.ts +69 -0
  26. package/dist/core/compaction/lifecycle.d.ts.map +1 -0
  27. package/dist/core/compaction/lifecycle.js +104 -0
  28. package/dist/core/compaction/lifecycle.js.map +1 -0
  29. package/dist/core/compaction/utils.d.ts +12 -1
  30. package/dist/core/compaction/utils.d.ts.map +1 -1
  31. package/dist/core/compaction/utils.js +22 -17
  32. package/dist/core/compaction/utils.js.map +1 -1
  33. package/dist/core/event-bus.d.ts.map +1 -1
  34. package/dist/core/event-bus.js +11 -1
  35. package/dist/core/event-bus.js.map +1 -1
  36. package/dist/core/extensions/builtin/compaction/index.d.ts +2 -1
  37. package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
  38. package/dist/core/extensions/builtin/compaction/index.js +42 -30
  39. package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
  40. package/dist/core/extensions/builtin/compaction/openai-remote-model.d.ts +9 -2
  41. package/dist/core/extensions/builtin/compaction/openai-remote-model.d.ts.map +1 -1
  42. package/dist/core/extensions/builtin/compaction/openai-remote-model.js +78 -28
  43. package/dist/core/extensions/builtin/compaction/openai-remote-model.js.map +1 -1
  44. package/dist/core/extensions/builtin/compaction/openai-remote-schema.d.ts +3 -1
  45. package/dist/core/extensions/builtin/compaction/openai-remote-schema.d.ts.map +1 -1
  46. package/dist/core/extensions/builtin/compaction/openai-remote-schema.js +19 -1
  47. package/dist/core/extensions/builtin/compaction/openai-remote-schema.js.map +1 -1
  48. package/dist/core/extensions/builtin/compaction/openai-remote.d.ts +20 -6
  49. package/dist/core/extensions/builtin/compaction/openai-remote.d.ts.map +1 -1
  50. package/dist/core/extensions/builtin/compaction/openai-remote.js +207 -22
  51. package/dist/core/extensions/builtin/compaction/openai-remote.js.map +1 -1
  52. package/dist/core/extensions/builtin/compaction/speculative.d.ts +4 -2
  53. package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
  54. package/dist/core/extensions/builtin/compaction/speculative.js +25 -13
  55. package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
  56. package/dist/core/extensions/builtin/config-reload/index.d.ts +7 -0
  57. package/dist/core/extensions/builtin/config-reload/index.d.ts.map +1 -1
  58. package/dist/core/extensions/builtin/config-reload/index.js +49 -17
  59. package/dist/core/extensions/builtin/config-reload/index.js.map +1 -1
  60. package/dist/core/extensions/builtin/hooks/index.js +1 -1
  61. package/dist/core/extensions/builtin/hooks/index.js.map +1 -1
  62. package/dist/core/extensions/builtin/hooks/lifecycle-adapter.d.ts +3 -1
  63. package/dist/core/extensions/builtin/hooks/lifecycle-adapter.d.ts.map +1 -1
  64. package/dist/core/extensions/builtin/hooks/lifecycle-adapter.js +2 -1
  65. package/dist/core/extensions/builtin/hooks/lifecycle-adapter.js.map +1 -1
  66. package/dist/core/extensions/builtin/mcp/auth/commands-auth-dispatch.d.ts +2 -1
  67. package/dist/core/extensions/builtin/mcp/auth/commands-auth-dispatch.d.ts.map +1 -1
  68. package/dist/core/extensions/builtin/mcp/auth/commands-auth-dispatch.js +5 -3
  69. package/dist/core/extensions/builtin/mcp/auth/commands-auth-dispatch.js.map +1 -1
  70. package/dist/core/extensions/builtin/mcp/auth/commands-auth.d.ts +5 -0
  71. package/dist/core/extensions/builtin/mcp/auth/commands-auth.d.ts.map +1 -1
  72. package/dist/core/extensions/builtin/mcp/auth/commands-auth.js +8 -3
  73. package/dist/core/extensions/builtin/mcp/auth/commands-auth.js.map +1 -1
  74. package/dist/core/extensions/builtin/mcp/catalog.d.ts +3 -1
  75. package/dist/core/extensions/builtin/mcp/catalog.d.ts.map +1 -1
  76. package/dist/core/extensions/builtin/mcp/catalog.js +2 -0
  77. package/dist/core/extensions/builtin/mcp/catalog.js.map +1 -1
  78. package/dist/core/extensions/builtin/mcp/commands.d.ts +1 -1
  79. package/dist/core/extensions/builtin/mcp/commands.d.ts.map +1 -1
  80. package/dist/core/extensions/builtin/mcp/commands.js +34 -39
  81. package/dist/core/extensions/builtin/mcp/commands.js.map +1 -1
  82. package/dist/core/extensions/builtin/mcp/connection-types.d.ts +2 -0
  83. package/dist/core/extensions/builtin/mcp/connection-types.d.ts.map +1 -1
  84. package/dist/core/extensions/builtin/mcp/connection-types.js.map +1 -1
  85. package/dist/core/extensions/builtin/mcp/connection.d.ts.map +1 -1
  86. package/dist/core/extensions/builtin/mcp/connection.js +3 -0
  87. package/dist/core/extensions/builtin/mcp/connection.js.map +1 -1
  88. package/dist/core/extensions/builtin/mcp/elicitation.d.ts +7 -3
  89. package/dist/core/extensions/builtin/mcp/elicitation.d.ts.map +1 -1
  90. package/dist/core/extensions/builtin/mcp/elicitation.js +5 -5
  91. package/dist/core/extensions/builtin/mcp/elicitation.js.map +1 -1
  92. package/dist/core/extensions/builtin/mcp/expose/register.d.ts.map +1 -1
  93. package/dist/core/extensions/builtin/mcp/expose/register.js +1 -0
  94. package/dist/core/extensions/builtin/mcp/expose/register.js.map +1 -1
  95. package/dist/core/extensions/builtin/mcp/expose/session.d.ts +2 -0
  96. package/dist/core/extensions/builtin/mcp/expose/session.d.ts.map +1 -1
  97. package/dist/core/extensions/builtin/mcp/expose/session.js +3 -0
  98. package/dist/core/extensions/builtin/mcp/expose/session.js.map +1 -1
  99. package/dist/core/extensions/builtin/mcp/guard/output-guard.d.ts +9 -1
  100. package/dist/core/extensions/builtin/mcp/guard/output-guard.d.ts.map +1 -1
  101. package/dist/core/extensions/builtin/mcp/guard/output-guard.js +18 -6
  102. package/dist/core/extensions/builtin/mcp/guard/output-guard.js.map +1 -1
  103. package/dist/core/extensions/builtin/mcp/index.d.ts +4 -2
  104. package/dist/core/extensions/builtin/mcp/index.d.ts.map +1 -1
  105. package/dist/core/extensions/builtin/mcp/index.js +150 -127
  106. package/dist/core/extensions/builtin/mcp/index.js.map +1 -1
  107. package/dist/core/extensions/builtin/mcp/instructions.d.ts +1 -1
  108. package/dist/core/extensions/builtin/mcp/instructions.d.ts.map +1 -1
  109. package/dist/core/extensions/builtin/mcp/instructions.js +6 -6
  110. package/dist/core/extensions/builtin/mcp/instructions.js.map +1 -1
  111. package/dist/core/extensions/builtin/mcp/prompts.d.ts +2 -0
  112. package/dist/core/extensions/builtin/mcp/prompts.d.ts.map +1 -1
  113. package/dist/core/extensions/builtin/mcp/prompts.js +9 -3
  114. package/dist/core/extensions/builtin/mcp/prompts.js.map +1 -1
  115. package/dist/core/extensions/builtin/mcp/resources.d.ts +2 -0
  116. package/dist/core/extensions/builtin/mcp/resources.d.ts.map +1 -1
  117. package/dist/core/extensions/builtin/mcp/resources.js +1 -0
  118. package/dist/core/extensions/builtin/mcp/resources.js.map +1 -1
  119. package/dist/core/extensions/builtin/mcp/service-register.d.ts.map +1 -1
  120. package/dist/core/extensions/builtin/mcp/service-register.js +1 -0
  121. package/dist/core/extensions/builtin/mcp/service-register.js.map +1 -1
  122. package/dist/core/extensions/builtin/mcp/service-types.d.ts +2 -0
  123. package/dist/core/extensions/builtin/mcp/service-types.d.ts.map +1 -1
  124. package/dist/core/extensions/builtin/mcp/service-types.js.map +1 -1
  125. package/dist/core/extensions/builtin/mcp/service.d.ts +12 -1
  126. package/dist/core/extensions/builtin/mcp/service.d.ts.map +1 -1
  127. package/dist/core/extensions/builtin/mcp/service.js +44 -2
  128. package/dist/core/extensions/builtin/mcp/service.js.map +1 -1
  129. package/dist/core/extensions/builtin/mcp/transport.d.ts +2 -0
  130. package/dist/core/extensions/builtin/mcp/transport.d.ts.map +1 -1
  131. package/dist/core/extensions/builtin/mcp/transport.js +7 -7
  132. package/dist/core/extensions/builtin/mcp/transport.js.map +1 -1
  133. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.d.ts.map +1 -1
  134. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js +86 -7
  135. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js.map +1 -1
  136. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.d.ts +3 -0
  137. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.d.ts.map +1 -0
  138. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js +102 -0
  139. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js.map +1 -0
  140. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
  141. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +96 -6
  142. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
  143. package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
  144. package/dist/core/extensions/builtin/prompt-preset/presets.js +9 -0
  145. package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
  146. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
  147. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
  148. package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
  149. package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
  150. package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
  151. package/dist/core/extensions/builtin/terminal/extension.js +1 -0
  152. package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
  153. package/dist/core/extensions/builtin/terminal/tools/bash.d.ts +15 -3
  154. package/dist/core/extensions/builtin/terminal/tools/bash.d.ts.map +1 -1
  155. package/dist/core/extensions/builtin/terminal/tools/bash.js +30 -6
  156. package/dist/core/extensions/builtin/terminal/tools/bash.js.map +1 -1
  157. package/dist/core/extensions/builtin/terminal/tools/context.d.ts +5 -0
  158. package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
  159. package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
  160. package/dist/core/extensions/runner.d.ts +14 -7
  161. package/dist/core/extensions/runner.d.ts.map +1 -1
  162. package/dist/core/extensions/runner.js +64 -37
  163. package/dist/core/extensions/runner.js.map +1 -1
  164. package/dist/core/extensions/types.d.ts +30 -3
  165. package/dist/core/extensions/types.d.ts.map +1 -1
  166. package/dist/core/extensions/types.js.map +1 -1
  167. package/dist/core/http-dispatcher.d.ts.map +1 -1
  168. package/dist/core/http-dispatcher.js +16 -0
  169. package/dist/core/http-dispatcher.js.map +1 -1
  170. package/dist/core/messages.d.ts +1 -1
  171. package/dist/core/messages.d.ts.map +1 -1
  172. package/dist/core/messages.js +10 -8
  173. package/dist/core/messages.js.map +1 -1
  174. package/dist/core/model-registry.d.ts +1 -0
  175. package/dist/core/model-registry.d.ts.map +1 -1
  176. package/dist/core/model-registry.js +3 -2
  177. package/dist/core/model-registry.js.map +1 -1
  178. package/dist/core/model-resolver.d.ts.map +1 -1
  179. package/dist/core/model-resolver.js +9 -0
  180. package/dist/core/model-resolver.js.map +1 -1
  181. package/dist/core/model-runtime.d.ts +4 -2
  182. package/dist/core/model-runtime.d.ts.map +1 -1
  183. package/dist/core/model-runtime.js +34 -18
  184. package/dist/core/model-runtime.js.map +1 -1
  185. package/dist/core/remote-catalog-provider.d.ts +1 -1
  186. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  187. package/dist/core/remote-catalog-provider.js +21 -7
  188. package/dist/core/remote-catalog-provider.js.map +1 -1
  189. package/dist/core/resolve-config-value.d.ts.map +1 -1
  190. package/dist/core/resolve-config-value.js +12 -8
  191. package/dist/core/resolve-config-value.js.map +1 -1
  192. package/dist/core/sdk.d.ts +1 -1
  193. package/dist/core/sdk.d.ts.map +1 -1
  194. package/dist/core/sdk.js +8 -3
  195. package/dist/core/sdk.js.map +1 -1
  196. package/dist/core/session-manager.d.ts +22 -3
  197. package/dist/core/session-manager.d.ts.map +1 -1
  198. package/dist/core/session-manager.js +155 -58
  199. package/dist/core/session-manager.js.map +1 -1
  200. package/dist/core/settings-manager.d.ts +1 -1
  201. package/dist/core/settings-manager.d.ts.map +1 -1
  202. package/dist/core/settings-manager.js.map +1 -1
  203. package/dist/core/system-prompt.js +1 -1
  204. package/dist/core/system-prompt.js.map +1 -1
  205. package/dist/core/tools/bash.d.ts +2 -0
  206. package/dist/core/tools/bash.d.ts.map +1 -1
  207. package/dist/core/tools/bash.js +34 -5
  208. package/dist/core/tools/bash.js.map +1 -1
  209. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  210. package/dist/core/tools/tool-definition-wrapper.js +3 -1
  211. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  212. package/dist/core/usage-totals.d.ts +19 -0
  213. package/dist/core/usage-totals.d.ts.map +1 -0
  214. package/dist/core/usage-totals.js +52 -0
  215. package/dist/core/usage-totals.js.map +1 -0
  216. package/dist/extensions/llama/client.d.ts.map +1 -1
  217. package/dist/extensions/llama/client.js +3 -1
  218. package/dist/extensions/llama/client.js.map +1 -1
  219. package/dist/extensions/llama/index.js +3 -3
  220. package/dist/extensions/llama/index.js.map +1 -1
  221. package/dist/extensions/llama/provider.d.ts.map +1 -1
  222. package/dist/extensions/llama/provider.js +1 -2
  223. package/dist/extensions/llama/provider.js.map +1 -1
  224. package/dist/index.d.ts +2 -2
  225. package/dist/index.d.ts.map +1 -1
  226. package/dist/index.js +1 -1
  227. package/dist/index.js.map +1 -1
  228. package/dist/main.d.ts.map +1 -1
  229. package/dist/main.js +37 -5
  230. package/dist/main.js.map +1 -1
  231. package/dist/modes/app-server/daemon/occupancy.d.ts +22 -0
  232. package/dist/modes/app-server/daemon/occupancy.d.ts.map +1 -0
  233. package/dist/modes/app-server/daemon/occupancy.js +67 -0
  234. package/dist/modes/app-server/daemon/occupancy.js.map +1 -0
  235. package/dist/modes/app-server/daemon/probe.d.ts +3 -3
  236. package/dist/modes/app-server/daemon/probe.d.ts.map +1 -1
  237. package/dist/modes/app-server/daemon/probe.js +33 -10
  238. package/dist/modes/app-server/daemon/probe.js.map +1 -1
  239. package/dist/modes/app-server/daemon.d.ts.map +1 -1
  240. package/dist/modes/app-server/daemon.js +58 -18
  241. package/dist/modes/app-server/daemon.js.map +1 -1
  242. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  243. package/dist/modes/interactive/components/compaction-summary-message.js +8 -1
  244. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  245. package/dist/modes/interactive/components/extension-editor.d.ts +1 -2
  246. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  247. package/dist/modes/interactive/components/extension-editor.js +16 -46
  248. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  249. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  250. package/dist/modes/interactive/components/footer.js.map +1 -1
  251. package/dist/modes/interactive/components/status-indicator.d.ts +4 -0
  252. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  253. package/dist/modes/interactive/components/status-indicator.js +13 -0
  254. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  255. package/dist/modes/interactive/external-editor.d.ts +12 -0
  256. package/dist/modes/interactive/external-editor.d.ts.map +1 -0
  257. package/dist/modes/interactive/external-editor.js +37 -0
  258. package/dist/modes/interactive/external-editor.js.map +1 -0
  259. package/dist/modes/interactive/interactive-mode.d.ts +3 -1
  260. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  261. package/dist/modes/interactive/interactive-mode.js +96 -78
  262. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  263. package/dist/modes/rpc/connection-handler.d.ts +6 -0
  264. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  265. package/dist/modes/rpc/connection-handler.js +34 -9
  266. package/dist/modes/rpc/connection-handler.js.map +1 -1
  267. package/dist/modes/rpc/multi-session-host.d.ts +15 -0
  268. package/dist/modes/rpc/multi-session-host.d.ts.map +1 -0
  269. package/dist/modes/rpc/multi-session-host.js +60 -0
  270. package/dist/modes/rpc/multi-session-host.js.map +1 -0
  271. package/dist/modes/rpc/neo-runtime-options.d.ts.map +1 -1
  272. package/dist/modes/rpc/neo-runtime-options.js +1 -0
  273. package/dist/modes/rpc/neo-runtime-options.js.map +1 -1
  274. package/dist/modes/rpc/rpc-client.d.ts +4 -0
  275. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  276. package/dist/modes/rpc/rpc-client.js +7 -0
  277. package/dist/modes/rpc/rpc-client.js.map +1 -1
  278. package/dist/modes/rpc/rpc-mode.d.ts +49 -0
  279. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  280. package/dist/modes/rpc/rpc-mode.js +49 -0
  281. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  282. package/dist/modes/rpc/rpc-types.d.ts +85 -1
  283. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  284. package/dist/modes/rpc/rpc-types.js +8 -1
  285. package/dist/modes/rpc/rpc-types.js.map +1 -1
  286. package/dist/modes/rpc/session-binding.d.ts +13 -0
  287. package/dist/modes/rpc/session-binding.d.ts.map +1 -0
  288. package/dist/modes/rpc/session-binding.js +33 -0
  289. package/dist/modes/rpc/session-binding.js.map +1 -0
  290. package/dist/modes/rpc/session-command-router.d.ts +19 -0
  291. package/dist/modes/rpc/session-command-router.d.ts.map +1 -0
  292. package/dist/modes/rpc/session-command-router.js +159 -0
  293. package/dist/modes/rpc/session-command-router.js.map +1 -0
  294. package/dist/modes/rpc/session-event-writer.d.ts +34 -0
  295. package/dist/modes/rpc/session-event-writer.d.ts.map +1 -0
  296. package/dist/modes/rpc/session-event-writer.js +92 -0
  297. package/dist/modes/rpc/session-event-writer.js.map +1 -0
  298. package/dist/modes/rpc/session-extension-ui-requests.d.ts +15 -0
  299. package/dist/modes/rpc/session-extension-ui-requests.d.ts.map +1 -0
  300. package/dist/modes/rpc/session-extension-ui-requests.js +27 -0
  301. package/dist/modes/rpc/session-extension-ui-requests.js.map +1 -0
  302. package/dist/modes/rpc/session-registry.d.ts +58 -0
  303. package/dist/modes/rpc/session-registry.d.ts.map +1 -0
  304. package/dist/modes/rpc/session-registry.js +162 -0
  305. package/dist/modes/rpc/session-registry.js.map +1 -0
  306. package/dist/utils/clipboard.d.ts.map +1 -1
  307. package/dist/utils/clipboard.js +19 -8
  308. package/dist/utils/clipboard.js.map +1 -1
  309. package/dist/utils/version-check.d.ts.map +1 -1
  310. package/dist/utils/version-check.js +3 -1
  311. package/dist/utils/version-check.js.map +1 -1
  312. package/docs/app-server-daemon.md +3 -2
  313. package/docs/compaction.md +9 -4
  314. package/docs/custom-provider.md +5 -2
  315. package/docs/environment-variables.md +88 -0
  316. package/docs/extensions.md +25 -7
  317. package/docs/index.md +1 -0
  318. package/docs/json.md +5 -1
  319. package/docs/models.md +6 -2
  320. package/docs/providers.md +12 -1
  321. package/docs/rpc.md +154 -8
  322. package/docs/sdk.md +3 -0
  323. package/docs/session-format.md +17 -3
  324. package/docs/settings.md +2 -2
  325. package/docs/usage.md +1 -14
  326. package/examples/extensions/custom-compaction.ts +4 -0
  327. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  328. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  329. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  330. package/examples/extensions/gondolin/package-lock.json +2 -2
  331. package/examples/extensions/gondolin/package.json +1 -1
  332. package/examples/extensions/handoff.ts +9 -1
  333. package/examples/extensions/sandbox/package-lock.json +2 -2
  334. package/examples/extensions/sandbox/package.json +1 -1
  335. package/examples/extensions/summarize.ts +3 -0
  336. package/examples/extensions/with-deps/package-lock.json +2 -2
  337. package/examples/extensions/with-deps/package.json +1 -1
  338. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +24 -0
  339. package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
  340. package/node_modules/@earendil-works/pi-agent-core/README.md +31 -12
  341. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +4 -4
  342. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  343. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +8 -7
  344. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  345. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +10 -3
  346. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  347. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +61 -27
  348. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  349. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +11 -12
  350. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  351. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +47 -22
  352. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  353. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +5 -1
  354. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  355. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +6 -8
  356. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
  357. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +17 -5
  358. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
  359. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +82 -27
  360. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
  361. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +12 -1
  362. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -1
  363. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +22 -17
  364. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -1
  365. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +3 -9
  366. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
  367. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +118 -11
  368. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
  369. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +11 -3
  370. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -1
  371. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +56 -4
  372. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -1
  373. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +11 -3
  374. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -1
  375. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +56 -4
  376. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -1
  377. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -1
  378. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +2 -2
  379. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -1
  380. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +6 -4
  381. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
  382. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +30 -14
  383. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
  384. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts +27 -0
  385. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts.map +1 -0
  386. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +132 -0
  387. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js.map +1 -0
  388. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.d.ts +89 -0
  389. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.d.ts.map +1 -0
  390. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js +386 -0
  391. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js.map +1 -0
  392. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts +19 -0
  393. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts.map +1 -0
  394. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +95 -0
  395. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js.map +1 -0
  396. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.d.ts +4 -0
  397. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.d.ts.map +1 -0
  398. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +46 -0
  399. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js.map +1 -0
  400. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.d.ts +3 -0
  401. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.d.ts.map +1 -0
  402. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js +106 -0
  403. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js.map +1 -0
  404. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts +6 -0
  405. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts.map +1 -0
  406. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js +5 -0
  407. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js.map +1 -0
  408. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.d.ts +4 -0
  409. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.d.ts.map +1 -0
  410. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +26 -0
  411. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js.map +1 -0
  412. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts +34 -0
  413. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts.map +1 -0
  414. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +110 -0
  415. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js.map +1 -0
  416. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts +6 -0
  417. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts.map +1 -0
  418. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js +2 -0
  419. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js.map +1 -0
  420. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts +11 -0
  421. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts.map +1 -0
  422. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +31 -0
  423. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -0
  424. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +80 -18
  425. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
  426. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
  427. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +12 -4
  428. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -1
  429. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +90 -35
  430. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -1
  431. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -1
  432. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +10 -4
  433. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -1
  434. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +4 -2
  435. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  436. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +5 -2
  437. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  438. package/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.d.ts +10 -0
  439. package/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.d.ts.map +1 -0
  440. package/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.js +17 -0
  441. package/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.js.map +1 -0
  442. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +8 -2
  443. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  444. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  445. package/node_modules/@earendil-works/pi-agent-core/package.json +4 -3
  446. package/node_modules/@earendil-works/pi-ai/README.md +44 -4
  447. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  448. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +45 -27
  449. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  450. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  451. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +21 -8
  452. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  453. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  454. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +17 -10
  455. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  456. package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.d.ts +17 -0
  457. package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.d.ts.map +1 -0
  458. package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +104 -0
  459. package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js.map +1 -0
  460. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
  461. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +7 -11
  462. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
  463. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts +4 -3
  464. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -1
  465. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +17 -3
  466. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -1
  467. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
  468. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +7 -11
  469. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
  470. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  471. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +13 -9
  472. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  473. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  474. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +73 -47
  475. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  476. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +7 -9
  477. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  478. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +142 -33
  479. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  480. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts +7 -0
  481. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  482. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +180 -80
  483. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  484. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  485. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +37 -15
  486. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  487. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.d.ts.map +1 -1
  488. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +8 -3
  489. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js.map +1 -1
  490. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
  491. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -4
  492. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
  493. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +15 -0
  494. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -1
  495. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +52 -6
  496. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -1
  497. package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts.map +1 -1
  498. package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js +3 -2
  499. package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js.map +1 -1
  500. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts +10 -0
  501. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts.map +1 -0
  502. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +249 -0
  503. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js.map +1 -0
  504. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts +4 -0
  505. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts.map +1 -1
  506. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +10 -0
  507. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js.map +1 -1
  508. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +1 -1
  509. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +2 -18
  510. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +1 -1
  511. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts +13 -0
  512. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts.map +1 -0
  513. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +222 -0
  514. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js.map +1 -0
  515. package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.d.ts.map +1 -1
  516. package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js +4 -0
  517. package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js.map +1 -1
  518. package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts.map +1 -1
  519. package/node_modules/@earendil-works/pi-ai/dist/compat.js +2 -1
  520. package/node_modules/@earendil-works/pi-ai/dist/compat.js.map +1 -1
  521. package/node_modules/@earendil-works/pi-ai/dist/context-provenance.d.ts +16 -0
  522. package/node_modules/@earendil-works/pi-ai/dist/context-provenance.d.ts.map +1 -0
  523. package/node_modules/@earendil-works/pi-ai/dist/context-provenance.js +32 -0
  524. package/node_modules/@earendil-works/pi-ai/dist/context-provenance.js.map +1 -0
  525. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +3 -0
  526. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
  527. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +11 -3
  528. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  529. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +15 -0
  530. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  531. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +15 -0
  532. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  533. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +19 -2
  534. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -1
  535. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +68 -3
  536. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -1
  537. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +5 -0
  538. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  539. package/node_modules/@earendil-works/pi-ai/dist/index.js +5 -0
  540. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  541. package/node_modules/@earendil-works/pi-ai/dist/model-catalog.d.ts +17 -0
  542. package/node_modules/@earendil-works/pi-ai/dist/model-catalog.d.ts.map +1 -0
  543. package/node_modules/@earendil-works/pi-ai/dist/model-catalog.js +4 -0
  544. package/node_modules/@earendil-works/pi-ai/dist/model-catalog.js.map +1 -0
  545. package/node_modules/@earendil-works/pi-ai/dist/model.d.ts +2 -2
  546. package/node_modules/@earendil-works/pi-ai/dist/model.d.ts.map +1 -1
  547. package/node_modules/@earendil-works/pi-ai/dist/model.js.map +1 -1
  548. package/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts +2 -0
  549. package/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts.map +1 -1
  550. package/node_modules/@earendil-works/pi-ai/dist/models-store.js.map +1 -1
  551. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +0 -6
  552. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  553. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +76 -4448
  554. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  555. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +4 -0
  556. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  557. package/node_modules/@earendil-works/pi-ai/dist/models.js +0 -53
  558. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  559. package/node_modules/@earendil-works/pi-ai/dist/node/provider-scope.d.ts +12 -0
  560. package/node_modules/@earendil-works/pi-ai/dist/node/provider-scope.d.ts.map +1 -0
  561. package/node_modules/@earendil-works/pi-ai/dist/node/provider-scope.js +34 -0
  562. package/node_modules/@earendil-works/pi-ai/dist/node/provider-scope.js.map +1 -0
  563. package/node_modules/@earendil-works/pi-ai/dist/providers/alibaba-token-plan.models.d.ts +3 -63
  564. package/node_modules/@earendil-works/pi-ai/dist/providers/alibaba-token-plan.models.d.ts.map +1 -1
  565. package/node_modules/@earendil-works/pi-ai/dist/providers/alibaba-token-plan.models.js +2 -1
  566. package/node_modules/@earendil-works/pi-ai/dist/providers/alibaba-token-plan.models.js.map +1 -1
  567. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +2 -0
  568. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
  569. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +10 -0
  570. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
  571. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  572. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +3 -2
  573. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  574. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts +3 -439
  575. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts.map +1 -1
  576. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +2 -1
  577. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js.map +1 -1
  578. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts +3 -15
  579. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts.map +1 -1
  580. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js +2 -1
  581. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js.map +1 -1
  582. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  583. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +30 -3
  584. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
  585. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts +3 -59
  586. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts.map +1 -1
  587. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +2 -1
  588. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js.map +1 -1
  589. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +3 -187
  590. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts.map +1 -1
  591. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +2 -1
  592. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js.map +1 -1
  593. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts +3 -15
  594. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts.map +1 -1
  595. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js +2 -1
  596. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js.map +1 -1
  597. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts +3 -171
  598. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -1
  599. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +2 -1
  600. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js.map +1 -1
  601. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts +3 -55
  602. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts.map +1 -1
  603. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js +2 -1
  604. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js.map +1 -1
  605. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -0
  606. package/node_modules/@earendil-works/pi-ai/dist/providers/data/alibaba-token-plan.json +1 -1
  607. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  608. package/node_modules/@earendil-works/pi-ai/dist/providers/data/ant-ling.json +1 -1
  609. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  610. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  611. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
  612. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  613. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  614. package/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -1
  615. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  616. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  617. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
  618. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  619. package/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -1
  620. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  621. package/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
  622. package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
  623. package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
  624. package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  625. package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
  626. package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
  627. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  628. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  629. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  630. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  631. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  632. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  633. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -0
  634. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -0
  635. package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  636. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  637. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
  638. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
  639. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
  640. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
  641. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
  642. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  643. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  644. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts +3 -11
  645. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts.map +1 -1
  646. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +2 -1
  647. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js.map +1 -1
  648. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts +3 -67
  649. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts.map +1 -1
  650. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +2 -1
  651. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js.map +1 -1
  652. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +3 -115
  653. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts.map +1 -1
  654. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +2 -1
  655. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js.map +1 -1
  656. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts +3 -51
  657. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts.map +1 -1
  658. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js +2 -1
  659. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js.map +1 -1
  660. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts +3 -75
  661. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts.map +1 -1
  662. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js +2 -1
  663. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js.map +1 -1
  664. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts +3 -31
  665. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts.map +1 -1
  666. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js +2 -1
  667. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js.map +1 -1
  668. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts +3 -203
  669. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts.map +1 -1
  670. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js +2 -1
  671. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js.map +1 -1
  672. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +2 -2
  673. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -1
  674. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts.map +1 -1
  675. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +10 -2
  676. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js.map +1 -1
  677. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +3 -19
  678. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts.map +1 -1
  679. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +2 -1
  680. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js.map +1 -1
  681. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts +3 -15
  682. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts.map +1 -1
  683. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js +2 -1
  684. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js.map +1 -1
  685. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts +3 -15
  686. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts.map +1 -1
  687. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js +2 -1
  688. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js.map +1 -1
  689. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts +3 -123
  690. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts.map +1 -1
  691. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js +2 -1
  692. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js.map +1 -1
  693. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts +3 -43
  694. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts.map +1 -1
  695. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +2 -1
  696. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js.map +1 -1
  697. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts +3 -43
  698. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts.map +1 -1
  699. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +2 -1
  700. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js.map +1 -1
  701. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts +3 -79
  702. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts.map +1 -1
  703. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js +2 -1
  704. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js.map +1 -1
  705. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +3 -31
  706. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts.map +1 -1
  707. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +2 -1
  708. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js.map +1 -1
  709. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts +3 -187
  710. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts.map +1 -1
  711. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js +2 -1
  712. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js.map +1 -1
  713. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +3 -67
  714. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts.map +1 -1
  715. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +2 -1
  716. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js.map +1 -1
  717. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +3 -227
  718. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts.map +1 -1
  719. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +2 -1
  720. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js.map +1 -1
  721. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.d.ts.map +1 -1
  722. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +10 -2
  723. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js.map +1 -1
  724. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -1
  725. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +10 -2
  726. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -1
  727. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +3 -1095
  728. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts.map +1 -1
  729. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +2 -1
  730. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -1
  731. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.d.ts +3 -0
  732. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.d.ts.map +1 -0
  733. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.js +15 -0
  734. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.js.map +1 -0
  735. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.d.ts +4 -0
  736. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.d.ts.map +1 -0
  737. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.js +6 -0
  738. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.js.map +1 -0
  739. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.d.ts +3 -0
  740. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.d.ts.map +1 -0
  741. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.js +15 -0
  742. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.js.map +1 -0
  743. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.d.ts +4 -0
  744. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.d.ts.map +1 -0
  745. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.js +6 -0
  746. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.js.map +1 -0
  747. package/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.d.ts.map +1 -1
  748. package/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js +18 -14
  749. package/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js.map +1 -1
  750. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts +3 -67
  751. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts.map +1 -1
  752. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js +2 -1
  753. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js.map +1 -1
  754. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +3 -775
  755. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
  756. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +2 -1
  757. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js.map +1 -1
  758. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +3 -15
  759. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts.map +1 -1
  760. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +2 -1
  761. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js.map +1 -1
  762. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts +3 -15
  763. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts.map +1 -1
  764. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js +2 -1
  765. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js.map +1 -1
  766. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts +3 -15
  767. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts.map +1 -1
  768. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js +2 -1
  769. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js.map +1 -1
  770. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts +3 -15
  771. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts.map +1 -1
  772. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js +2 -1
  773. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js.map +1 -1
  774. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts +3 -27
  775. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts.map +1 -1
  776. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js +2 -1
  777. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js.map +1 -1
  778. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts +3 -27
  779. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts.map +1 -1
  780. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +2 -1
  781. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js.map +1 -1
  782. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts +3 -27
  783. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts.map +1 -1
  784. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +2 -1
  785. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js.map +1 -1
  786. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +43 -3
  787. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  788. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  789. package/node_modules/@earendil-works/pi-ai/dist/utils/openai-codex-auth.d.ts +11 -0
  790. package/node_modules/@earendil-works/pi-ai/dist/utils/openai-codex-auth.d.ts.map +1 -0
  791. package/node_modules/@earendil-works/pi-ai/dist/utils/openai-codex-auth.js +30 -0
  792. package/node_modules/@earendil-works/pi-ai/dist/utils/openai-codex-auth.js.map +1 -0
  793. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +1 -0
  794. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  795. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +3 -0
  796. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
  797. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts +16 -0
  798. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts.map +1 -0
  799. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +94 -0
  800. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js.map +1 -0
  801. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +41 -0
  802. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  803. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +82 -0
  804. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  805. package/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +6 -0
  806. package/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts.map +1 -0
  807. package/node_modules/@earendil-works/pi-ai/dist/utils/text.js +10 -0
  808. package/node_modules/@earendil-works/pi-ai/dist/utils/text.js.map +1 -0
  809. package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts +3 -0
  810. package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts.map +1 -0
  811. package/node_modules/@earendil-works/{pi-agent-core/dist/harness/session → pi-ai/dist/utils}/uuid.js +2 -2
  812. package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js.map +1 -0
  813. package/node_modules/@earendil-works/pi-ai/package.json +11 -4
  814. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  815. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
  816. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +31 -22
  817. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  818. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  819. package/node_modules/@earendil-works/pi-tui/dist/tui.js +2 -0
  820. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  821. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  822. package/package.json +7 -6
  823. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts +0 -2
  824. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts.map +0 -1
  825. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js.map +0 -1
@@ -17,7 +17,7 @@ export type KnownApi = "openai-completions" | "mistral-conversations" | "openai-
17
17
  export type Api = KnownApi | (string & {});
18
18
  export type KnownImagesApi = "openrouter-images";
19
19
  export type ImagesApi = KnownImagesApi | (string & {});
20
- export type KnownProvider = "alibaba-token-plan" | "amazon-bedrock" | "ant-ling" | "anthropic" | "google" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "radius" | "nvidia" | "deepseek" | "github-copilot" | "xai" | "groq" | "cerebras" | "openrouter" | "vercel-ai-gateway" | "zai" | "zai-coding-cn" | "mistral" | "minimax" | "minimax-cn" | "moonshotai" | "moonshotai-cn" | "huggingface" | "fireworks" | "together" | "opencode" | "opencode-go" | "kimi-coding" | "cloudflare-workers-ai" | "cloudflare-ai-gateway" | "xiaomi" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-sgp";
20
+ export type KnownProvider = "alibaba-token-plan" | "amazon-bedrock" | "ant-ling" | "anthropic" | "google" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "radius" | "nvidia" | "deepseek" | "github-copilot" | "xai" | "groq" | "cerebras" | "openrouter" | "vercel-ai-gateway" | "zai" | "zai-coding-cn" | "mistral" | "minimax" | "minimax-cn" | "moonshotai" | "moonshotai-cn" | "huggingface" | "fireworks" | "together" | "opencode" | "opencode-go" | "kimi-coding" | "cloudflare-workers-ai" | "cloudflare-ai-gateway" | "qwen-token-plan" | "qwen-token-plan-cn" | "xiaomi" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-sgp";
21
21
  export type ProviderId = KnownProvider | string;
22
22
  export type KnownImagesProvider = "openrouter";
23
23
  export type ImagesProviderId = KnownImagesProvider | string;
@@ -42,6 +42,11 @@ export type Transport = "sse" | "websocket" | "websocket-cached" | "auto";
42
42
  export type ProviderEnv = Record<string, string>;
43
43
  export type ProviderHeaders = Record<string, string | null>;
44
44
  export type SessionAffinityFormat = "openai" | "openai-nosession" | "openrouter";
45
+ /** Effective model and fully transformed headers for a request payload hook. */
46
+ export type ProviderRequestMetadata = {
47
+ model: Model<Api>;
48
+ headers: ProviderHeaders;
49
+ };
45
50
  export interface ProviderResponse {
46
51
  status: number;
47
52
  headers: Record<string, string>;
@@ -71,7 +76,7 @@ export interface StreamOptions {
71
76
  * Optional callback for inspecting or replacing provider payloads before sending.
72
77
  * Return undefined to keep the payload unchanged.
73
78
  */
74
- onPayload?: (payload: unknown, model: Model<Api>) => unknown | undefined | Promise<unknown | undefined>;
79
+ onPayload?: (payload: unknown, model: Model<Api>, request?: ProviderRequestMetadata) => unknown | undefined | Promise<unknown | undefined>;
75
80
  /**
76
81
  * Optional callback invoked after an HTTP response is received and before
77
82
  * its body stream is consumed.
@@ -346,6 +351,8 @@ export interface ToolResultMessage<TDetails = any> {
346
351
  toolName: string;
347
352
  content: (TextContent | ImageContent)[];
348
353
  details?: TDetails;
354
+ /** Usage from the tool execution itself, if available. Not part of main LLM context accounting. */
355
+ usage?: Usage;
349
356
  /**
350
357
  * Names from `Context.tools` that became available after this result.
351
358
  * Providers with native deferred tool loading use this as the load point;
@@ -379,11 +386,29 @@ export interface FreeformToolFormat {
379
386
  syntax: "lark";
380
387
  definition: string;
381
388
  }
389
+ /** OpenAI grammar variants for constrained sampling. */
390
+ export type GrammarFormat = "openai_lark" | "openai_regex";
391
+ export type GrammarVariants = Partial<Record<GrammarFormat, string>>;
392
+ /**
393
+ * Optional provider-side constrained sampling configs for a tool.
394
+ *
395
+ * The `json_schema` value roughly maps to the concept of `strict` in APIs which is
396
+ * implemented as json-schema constrained sampling by APIs. Grammar variants let
397
+ * callers provide provider-specific encodings of the same intended language.
398
+ */
399
+ export type ConstrainedSamplingConfig = {
400
+ type: "json_schema";
401
+ strict: "prefer" | "require";
402
+ } | {
403
+ type: "grammar";
404
+ variants: GrammarVariants;
405
+ };
382
406
  export interface Tool<TParameters extends TSchema = TSchema> {
383
407
  name: string;
384
408
  description: string;
385
409
  parameters: TParameters;
386
410
  freeform?: FreeformToolFormat;
411
+ constrainedSampling?: false | ConstrainedSamplingConfig;
387
412
  }
388
413
  export interface Context {
389
414
  systemPrompt?: string;
@@ -489,6 +514,8 @@ export interface OpenAICompletionsCompat {
489
514
  vercelGatewayRouting?: VercelGatewayRouting;
490
515
  /** Whether z.ai supports top-level `tool_stream: true` for streaming tool call deltas. Default: false. */
491
516
  zaiToolStream?: boolean;
517
+ /** Whether the provider supports OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */
518
+ supportsOpenAIGrammarTools?: boolean;
492
519
  /** Whether the provider supports the `strict` field in tool definitions. Default: true. */
493
520
  supportsStrictMode?: boolean;
494
521
  /**
@@ -502,7 +529,7 @@ export interface OpenAICompletionsCompat {
502
529
  * Supported values: "hermes", "morph-xml", "xml" (deprecated alias for "morph-xml"), "yaml-xml", "gemma4-delimiter", "anthropic-xml", "antml"
503
530
  */
504
531
  toolCallFormat?: string;
505
- /** Cache control convention for prompt caching. "anthropic" applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user/assistant text content. */
532
+ /** Cache control convention for prompt caching. "anthropic" applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content. */
506
533
  cacheControlFormat?: "anthropic";
507
534
  /** Whether to send session-affinity data from `options.sessionId`. Default: false. */
508
535
  sendSessionAffinityHeaders?: boolean;
@@ -525,8 +552,14 @@ export interface OpenAIResponsesCompat {
525
552
  supportsWebSocket?: boolean;
526
553
  /** Whether the provider supports the OpenAI Responses native `web_search_preview` tool. Default: true for api.openai.com only. */
527
554
  supportsWebSearchPreview?: boolean;
555
+ /** Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly. */
556
+ supportsStrictMode?: boolean;
557
+ /** Whether to emit OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */
558
+ supportsOpenAIGrammarTools?: boolean;
528
559
  /** Whether the model supports client-executed tool search for deferred tools. Default: false. */
529
560
  supportsToolSearch?: boolean;
561
+ /** Whether the model accepts `prompt_cache_options` (OpenAI GPT-5.6+ explicit prompt caching). Older OpenAI models reject the parameter. Default: false. */
562
+ supportsExplicitPromptCacheMode?: boolean;
530
563
  }
531
564
  /** Compatibility settings for Anthropic Messages-compatible APIs. */
532
565
  export interface AnthropicMessagesCompat {
@@ -588,6 +621,8 @@ export interface AnthropicMessagesCompat {
588
621
  forceAdaptiveThinking?: boolean;
589
622
  /** Whether to replay empty thinking signatures as `signature: ""` instead of converting thinking to text. Default: false. */
590
623
  allowEmptySignature?: boolean;
624
+ /** Whether the provider supports Anthropic strict tool schemas. Default: false; generated Anthropic models enable it explicitly. */
625
+ supportsStrictTools?: boolean;
591
626
  /**
592
627
  * How to replay thinking blocks that have no usable Anthropic signature.
593
628
  * `"text"` demotes them to text; `"empty-signature"` preserves Anthropic's
@@ -612,6 +647,11 @@ export interface AnthropicMessagesCompat {
612
647
  */
613
648
  supportsWebSearch?: boolean;
614
649
  }
650
+ /** Compatibility settings for Amazon Bedrock models. */
651
+ export interface BedrockCompat {
652
+ /** Whether the model supports Bedrock strict tool schemas. Default: false. */
653
+ supportsStrictMode?: boolean;
654
+ }
615
655
  /**
616
656
  * OpenRouter provider routing preferences.
617
657
  * Controls which upstream providers OpenRouter routes requests to.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,KAAK,E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,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA4WA,sFAAsF;AACtF,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC/C,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { AnthropicOptions } from \"./api/anthropic-messages.ts\";\nimport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nimport type { BedrockOptions } from \"./api/bedrock-converse-stream.ts\";\nimport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nimport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nimport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nimport type { OpenAICodexResponsesOptions } from \"./api/openai-codex-responses.ts\";\nimport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nimport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nimport type { PiMessagesOptions } from \"./api/pi-messages.ts\";\nimport type { Model } from \"./model.ts\";\nimport type { AssistantMessageDiagnostic } from \"./utils/diagnostics.ts\";\nimport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\nexport type { Model } from \"./model.ts\";\nexport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\nexport type KnownApi =\n\t| \"openai-completions\"\n\t| \"mistral-conversations\"\n\t| \"openai-responses\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex-responses\"\n\t| \"anthropic-messages\"\n\t| \"bedrock-converse-stream\"\n\t| \"google-generative-ai\"\n\t| \"google-vertex\"\n\t| \"pi-messages\";\n\nexport type Api = KnownApi | (string & {});\n\nexport type KnownImagesApi = \"openrouter-images\";\n\nexport type ImagesApi = KnownImagesApi | (string & {});\n\nexport type KnownProvider =\n\t| \"alibaba-token-plan\"\n\t| \"amazon-bedrock\"\n\t| \"ant-ling\"\n\t| \"anthropic\"\n\t| \"google\"\n\t| \"google-vertex\"\n\t| \"openai\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex\"\n\t| \"radius\"\n\t| \"nvidia\"\n\t| \"deepseek\"\n\t| \"github-copilot\"\n\t| \"xai\"\n\t| \"groq\"\n\t| \"cerebras\"\n\t| \"openrouter\"\n\t| \"vercel-ai-gateway\"\n\t| \"zai\"\n\t| \"zai-coding-cn\"\n\t| \"mistral\"\n\t| \"minimax\"\n\t| \"minimax-cn\"\n\t| \"moonshotai\"\n\t| \"moonshotai-cn\"\n\t| \"huggingface\"\n\t| \"fireworks\"\n\t| \"together\"\n\t| \"opencode\"\n\t| \"opencode-go\"\n\t| \"kimi-coding\"\n\t| \"cloudflare-workers-ai\"\n\t| \"cloudflare-ai-gateway\"\n\t| \"xiaomi\"\n\t| \"xiaomi-token-plan-cn\"\n\t| \"xiaomi-token-plan-ams\"\n\t| \"xiaomi-token-plan-sgp\";\nexport type ProviderId = KnownProvider | string;\n\nexport type KnownImagesProvider = \"openrouter\";\n\nexport type ImagesProviderId = KnownImagesProvider | string;\n\nexport type ThinkingLevel = \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\nexport type ModelThinkingLevel = \"off\" | ThinkingLevel;\nexport type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;\nexport type ChatTemplateKwargValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| {\n\t\t\t$var: \"thinking.enabled\" | \"thinking.effort\";\n\t\t\tomitWhenOff?: boolean;\n\t };\n\n/** Token budgets for each thinking level (token-based providers only) */\nexport interface ThinkingBudgets {\n\tminimal?: number;\n\tlow?: number;\n\tmedium?: number;\n\thigh?: number;\n\tmax?: number;\n}\n\n// Base options all providers share\nexport type CacheRetention = \"none\" | \"short\" | \"long\";\n\nexport type Transport = \"sse\" | \"websocket\" | \"websocket-cached\" | \"auto\";\n\n/** Provider-scoped environment overrides. Values take precedence over process.env. */\nexport type ProviderEnv = Record<string, string>;\nexport type ProviderHeaders = Record<string, string | null>;\nexport type SessionAffinityFormat = \"openai\" | \"openai-nosession\" | \"openrouter\";\n\nexport interface ProviderResponse {\n\tstatus: number;\n\theaders: Record<string, string>;\n}\n\nexport interface StreamOptions {\n\ttemperature?: number;\n\tmaxTokens?: number;\n\tsignal?: AbortSignal;\n\tapiKey?: string;\n\t/**\n\t * Preferred transport for providers that support multiple transports.\n\t * Providers that do not support this option ignore it.\n\t */\n\ttransport?: Transport;\n\t/**\n\t * Prompt cache retention preference. Providers map this to their supported values.\n\t * Default: \"short\".\n\t */\n\tcacheRetention?: CacheRetention;\n\t/**\n\t * Optional session identifier for providers that support session-based caching.\n\t * Providers can use this to enable prompt caching, request routing, or other\n\t * session-aware features. Ignored by providers that don't support it.\n\t */\n\tsessionId?: string;\n\t/**\n\t * Optional callback for inspecting or replacing provider payloads before sending.\n\t * Return undefined to keep the payload unchanged.\n\t */\n\tonPayload?: (payload: unknown, model: Model<Api>) => unknown | undefined | Promise<unknown | undefined>;\n\t/**\n\t * Optional callback invoked after an HTTP response is received and before\n\t * its body stream is consumed.\n\t */\n\tonResponse?: (response: ProviderResponse, model: Model<Api>) => void | Promise<void>;\n\t/**\n\t * Optional custom HTTP headers to include in API requests.\n\t * Merged with provider defaults; caller values override default headers.\n\t * On AWS Bedrock these are injected via a Smithy `build`-step middleware so\n\t * they are covered by SigV4 signing; reserved headers (`x-amz-*`,\n\t * `authorization`, `host`) are silently ignored to preserve SigV4 / bearer auth.\n\t * A null value suppresses a provider/API default header with the same name.\n\t */\n\theaders?: ProviderHeaders;\n\t/**\n\t * Optional custom fields to merge into the outgoing provider request body.\n\t * Applied before `onPayload` so `onPayload` can observe/override them.\n\t * Provider-managed fields (e.g. `model`, `messages`, `stream`) are preserved\n\t * and cannot be overridden to avoid breaking core request semantics.\n\t */\n\textraBody?: Record<string, unknown>;\n\t/**\n\t * HTTP request timeout in milliseconds for providers/SDKs that support it.\n\t * For example, OpenAI and Anthropic SDK clients default to 10 minutes.\n\t */\n\ttimeoutMs?: number;\n\t/**\n\t * WebSocket connect timeout in milliseconds for providers that support\n\t * WebSocket transports. This covers the connection/open handshake only;\n\t * stream idleness after connection uses timeoutMs.\n\t */\n\twebsocketConnectTimeoutMs?: number;\n\t/**\n\t * Maximum retry attempts for providers/SDKs that support client-side retries.\n\t * For example, OpenAI and Anthropic SDK clients default to 2.\n\t */\n\tmaxRetries?: number;\n\t/**\n\t * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.\n\t * If the server's requested delay exceeds this value, the request fails immediately\n\t * with an error containing the requested delay, allowing higher-level retry logic\n\t * to handle it with user visibility.\n\t * Default: 60000 (60 seconds). Set to 0 to disable the cap.\n\t */\n\tmaxRetryDelayMs?: number;\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t * For example, Anthropic uses `user_id` for abuse tracking and rate limiting.\n\t */\n\tmetadata?: Record<string, unknown>;\n\t/**\n\t * Provider-scoped environment values. These take precedence over process.env for\n\t * provider configuration such as regional settings, endpoint placeholders, and\n\t * proxy variables.\n\t */\n\tenv?: ProviderEnv;\n}\n\nexport type ProviderStreamOptions = StreamOptions & Record<string, unknown>;\n\n/**\n * Maps known APIs to their full provider-specific stream option types.\n * Type-only imports from API implementation modules are erased at emit, so\n * this is tree-shake safe.\n */\nexport interface ApiOptionsMap {\n\t\"anthropic-messages\": AnthropicOptions;\n\t\"openai-completions\": OpenAICompletionsOptions;\n\t\"openai-responses\": OpenAIResponsesOptions;\n\t\"openai-codex-responses\": OpenAICodexResponsesOptions;\n\t\"azure-openai-responses\": AzureOpenAIResponsesOptions;\n\t\"google-generative-ai\": GoogleOptions;\n\t\"google-vertex\": GoogleVertexOptions;\n\t\"mistral-conversations\": MistralOptions;\n\t\"bedrock-converse-stream\": BedrockOptions;\n\t\"pi-messages\": PiMessagesOptions;\n}\n\n/**\n * Full stream options for an API. Known APIs resolve to their concrete option\n * type; custom API strings fall back to the generic shape.\n */\nexport type ApiStreamOptions<TApi extends Api> = TApi extends keyof ApiOptionsMap\n\t? ApiOptionsMap[TApi]\n\t: StreamOptions & Record<string, unknown>;\n\n/**\n * The uniform stream contract of an API implementation module: every module\n * under `src/api/` exports exactly `stream` and `streamSimple`, so the module\n * itself satisfies this interface. Lazy wrappers (`lazyApi()`) and provider\n * factories pass these around as values. This is the untyped dispatch shape;\n * per-API option typing lives on the implementation modules themselves and on\n * `Provider.stream()` via `ApiStreamOptions`.\n */\nexport interface ProviderStreams {\n\tstream(model: Model<Api>, context: Context, options?: StreamOptions): AssistantMessageEventStream;\n\tstreamSimple(model: Model<Api>, context: Context, options?: SimpleStreamOptions): AssistantMessageEventStream;\n}\n\n/**\n * The uniform contract of an image-generation API implementation module:\n * every image API module under `src/api/` exports exactly `generateImages`,\n * so the module itself satisfies this interface. Lazy wrappers and image\n * provider factories pass these around as values.\n */\nexport interface ProviderImages {\n\tgenerateImages(\n\t\tmodel: ImagesModel<ImagesApi>,\n\t\tcontext: ImagesContext,\n\t\toptions?: ImagesOptions,\n\t): Promise<AssistantImages>;\n}\n\nexport interface ImagesOptions {\n\tsignal?: AbortSignal;\n\tapiKey?: string;\n\t/**\n\t * Provider-scoped environment values. These take precedence over process.env for\n\t * provider configuration such as endpoint placeholders and proxy variables.\n\t */\n\tenv?: ProviderEnv;\n\t/**\n\t * Optional callback for inspecting or replacing provider payloads before sending.\n\t * Return undefined to keep the payload unchanged.\n\t */\n\tonPayload?: (payload: unknown, model: ImagesModel<ImagesApi>) => unknown | undefined | Promise<unknown | undefined>;\n\t/**\n\t * Optional callback invoked after an HTTP response is received.\n\t */\n\tonResponse?: (response: ProviderResponse, model: ImagesModel<ImagesApi>) => void | Promise<void>;\n\t/**\n\t * Optional custom HTTP headers to include in API requests.\n\t * Merged with provider defaults; can override default headers.\n\t * A null value suppresses a provider/API default header with the same name.\n\t */\n\theaders?: ProviderHeaders;\n\t/**\n\t * HTTP request timeout in milliseconds for providers/SDKs that support it.\n\t */\n\ttimeoutMs?: number;\n\t/**\n\t * Maximum retry attempts for providers/SDKs that support client-side retries.\n\t */\n\tmaxRetries?: number;\n\t/**\n\t * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.\n\t * If the server's requested delay exceeds this value, the request fails immediately\n\t * with an error containing the requested delay, allowing higher-level retry logic\n\t * to handle it with user visibility.\n\t * Default: 60000 (60 seconds). Set to 0 to disable the cap.\n\t */\n\tmaxRetryDelayMs?: number;\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t */\n\tmetadata?: Record<string, unknown>;\n}\n\nexport type ProviderImagesOptions = ImagesOptions & Record<string, unknown>;\n\n// Unified options with reasoning passed to streamSimple() and completeSimple()\nexport interface SimpleStreamOptions extends StreamOptions {\n\treasoning?: ThinkingLevel;\n\t/** Custom token budgets for thinking levels (token-based providers only) */\n\tthinkingBudgets?: ThinkingBudgets;\n}\n\n// Generic StreamFunction with typed options.\n//\n// Contract:\n// - Must return an AssistantMessageEventStream.\n// - Once invoked, request/model/runtime failures should be encoded in the\n// returned stream, not thrown.\n// - Error termination must produce an AssistantMessage with stopReason\n// \"error\" or \"aborted\" and errorMessage, emitted via the stream protocol.\nexport type StreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = StreamOptions> = (\n\tmodel: Model<TApi>,\n\tcontext: Context,\n\toptions?: TOptions,\n) => AssistantMessageEventStream;\n\nexport type ImagesFunction<TApi extends ImagesApi = ImagesApi, TOptions extends ImagesOptions = ImagesOptions> = (\n\tmodel: ImagesModel<TApi>,\n\tcontext: ImagesContext,\n\toptions?: TOptions,\n) => Promise<AssistantImages>;\n\nexport interface TextSignatureV1 {\n\tv: 1;\n\tid: string;\n\tphase?: \"commentary\" | \"final_answer\";\n}\n\nexport interface TextContent {\n\ttype: \"text\";\n\ttext: string;\n\ttextSignature?: string; // e.g., for OpenAI responses, message metadata (legacy id string or TextSignatureV1 JSON)\n}\n\nexport interface ThinkingContent {\n\ttype: \"thinking\";\n\tthinking: string;\n\t/** Epoch ms, stamped by the agent loop at stream-event receipt, best-effort. */\n\tstartedAt?: number;\n\t/** Epoch ms, stamped by the agent loop at stream-event receipt, best-effort. */\n\tendedAt?: number;\n\tthinkingSignature?: string; // e.g., for OpenAI responses, the reasoning item ID\n\t/** When true, the thinking content was redacted by safety filters. The opaque\n\t * encrypted payload is stored in `thinkingSignature` so it can be passed back\n\t * to the API for multi-turn continuity. */\n\tredacted?: boolean;\n}\n\nexport interface ImageContent {\n\ttype: \"image\";\n\tdata: string; // base64 encoded image data\n\tmimeType: string; // e.g., \"image/jpeg\", \"image/png\". Video payloads (e.g. \"video/mp4\") ride this\n\t// same block for models that declare the \"video\" input modality; use isVideoMimeType() to branch.\n}\n\n/** True when an ImageContent block actually carries video data (e.g. \"video/mp4\"). */\nexport function isVideoMimeType(mimeType: string): boolean {\n\treturn mimeType.toLowerCase().startsWith(\"video/\");\n}\n\nexport interface ToolCall {\n\ttype: \"toolCall\";\n\tid: string;\n\tname: string;\n\targuments: Record<string, any>;\n\t/** Set by text tool-call middleware when a truncated call could not be recovered. Carriers of `incomplete` MUST NOT be executed. */\n\tincomplete?: true;\n\t/** Error explaining why an incomplete tool call could not be recovered. */\n\terrorMessage?: string;\n\tthoughtSignature?: string; // Google-specific: opaque signature for reusing thought context\n}\n\n/**\n * Provider-emitted content block whose semantics are owned by the originating\n * provider. Surfaces server-side tool invocations (web_search), server-side\n * tool results (web_search_tool_result), code execution traces, grounding\n * metadata fragments, and any other vendor-specific block the core does not\n * normalize.\n *\n * `subtype` mirrors the provider's wire `type` discriminator (e.g.\n * \"server_tool_use\", \"web_search_tool_result\", \"executableCode\"). `raw` is\n * the verbatim wire payload — extensions interpret it per provider+subtype.\n *\n * The owning provider id lives on the parent `AssistantMessage.provider`, not\n * here, to avoid drift on replay.\n *\n * On replay across providers, `convertMessages` implementations MUST drop\n * these blocks (they are not portable). This mirrors the existing\n * `redacted_thinking` skip pattern.\n */\nexport interface ProviderNativeContent {\n\ttype: \"providerNative\";\n\tsubtype: string;\n\traw: unknown;\n}\n\nexport interface Usage {\n\tinput: number;\n\toutput: number;\n\tcacheRead: number;\n\tcacheWrite: number;\n\t/** Subset of `cacheWrite` written with 1h retention. Only Anthropic reports this split. */\n\tcacheWrite1h?: number;\n\t/**\n\t * Reasoning/thinking tokens, when the provider reports them. This is a subset of\n\t * `output`: `output` already includes these tokens. Set to a number (possibly 0) by\n\t * providers that expose a reasoning breakdown; left undefined by providers that don't.\n\t */\n\treasoning?: number;\n\ttotalTokens: number;\n\tcost: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n}\n\nexport type StopReason = \"stop\" | \"length\" | \"toolUse\" | \"error\" | \"aborted\";\n\nexport type AssistantStopDetails = { type: \"refusal\"; explanation?: string } | { type: \"sensitive\" };\n\nexport interface UserMessage {\n\trole: \"user\";\n\tcontent: string | (TextContent | ImageContent)[];\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface AssistantMessage {\n\trole: \"assistant\";\n\tcontent: (TextContent | ThinkingContent | ToolCall | ProviderNativeContent)[];\n\tapi: Api;\n\tprovider: ProviderId;\n\tmodel: string;\n\tresponseModel?: string; // Concrete `chunk.model` when different from the requested `model` (e.g. OpenRouter `auto` -> `anthropic/...`)\n\tresponseId?: string; // Provider-specific response/message identifier when the upstream API exposes one\n\tdiagnostics?: AssistantMessageDiagnostic[]; // Redacted provider/runtime diagnostics for failures and recoveries.\n\tusage: Usage;\n\tstopReason: StopReason;\n\tstopDetails?: AssistantStopDetails;\n\terrorMessage?: string;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface ToolResultMessage<TDetails = any> {\n\trole: \"toolResult\";\n\ttoolCallId: string;\n\ttoolName: string;\n\tcontent: (TextContent | ImageContent)[]; // Supports text and images\n\tdetails?: TDetails;\n\t/**\n\t * Names from `Context.tools` that became available after this result.\n\t * Providers with native deferred tool loading use this as the load point;\n\t * other providers ignore it and use `Context.tools` normally.\n\t */\n\taddedToolNames?: string[];\n\tisError: boolean;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport type Message = UserMessage | AssistantMessage | ToolResultMessage;\n\nexport type ImagesInputContent = TextContent | ImageContent;\nexport type ImagesOutputContent = TextContent | ImageContent;\n\nexport interface ImagesContext {\n\tinput: ImagesInputContent[];\n}\n\nexport type ImagesStopReason = \"stop\" | \"error\" | \"aborted\";\n\nexport interface AssistantImages {\n\tapi: ImagesApi;\n\tprovider: ImagesProviderId;\n\tmodel: string;\n\toutput: ImagesOutputContent[];\n\tresponseId?: string;\n\tusage?: Usage;\n\tstopReason: ImagesStopReason;\n\terrorMessage?: string;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nimport type { TSchema } from \"typebox\";\n\nexport interface FreeformToolFormat {\n\ttype: \"grammar\";\n\tsyntax: \"lark\";\n\tdefinition: string;\n}\n\nexport interface Tool<TParameters extends TSchema = TSchema> {\n\tname: string;\n\tdescription: string;\n\tparameters: TParameters;\n\tfreeform?: FreeformToolFormat;\n}\n\nexport interface Context {\n\tsystemPrompt?: string;\n\tmessages: Message[];\n\ttools?: Tool[];\n}\n\n/**\n * Event protocol for AssistantMessageEventStream.\n *\n * Streams should emit `start` before partial updates, then terminate with either:\n * - `done` carrying the final successful AssistantMessage, or\n * - `error` carrying the final AssistantMessage with stopReason \"error\" or \"aborted\"\n * and errorMessage.\n */\nexport type AssistantMessageEvent =\n\t| { type: \"start\"; partial: AssistantMessage }\n\t| { type: \"text_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"text_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"text_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"thinking_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"thinking_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"thinking_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"toolcall_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"toolcall_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t/** Finalized - executable iff `incomplete !== true` on `toolCall`. */\n\t| { type: \"toolcall_end\"; contentIndex: number; toolCall: ToolCall; partial: AssistantMessage }\n\t| { type: \"done\"; reason: Extract<StopReason, \"stop\" | \"length\" | \"toolUse\">; message: AssistantMessage }\n\t| { type: \"error\"; reason: Extract<StopReason, \"aborted\" | \"error\">; error: AssistantMessage };\n\n/**\n * Compatibility settings for OpenAI-compatible completions APIs.\n * Use this to override URL-based auto-detection for custom providers.\n */\nexport interface OpenAICompletionsCompat {\n\t/** Whether the provider supports the `store` field. Default: auto-detected from URL. */\n\tsupportsStore?: boolean;\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: auto-detected from URL. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */\n\tsupportsReasoningEffort?: boolean;\n\t/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */\n\tsupportsUsageInStreaming?: boolean;\n\t/** Which field to use for max tokens. Default: auto-detected from URL. */\n\tmaxTokensField?: \"max_completion_tokens\" | \"max_tokens\";\n\t/** Whether tool results require the `name` field. Default: auto-detected from URL. */\n\trequiresToolResultName?: boolean;\n\t/** Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. */\n\trequiresAssistantAfterToolResult?: boolean;\n\t/** Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL. */\n\trequiresThinkingAsText?: boolean;\n\t/** Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. */\n\trequiresReasoningContentOnAssistantMessages?: boolean;\n\t/** Format for reasoning/thinking parameter. \"openai\" uses reasoning_effort, \"openrouter\" uses reasoning: { effort }, \"deepseek\" uses thinking: { type } plus reasoning_effort when supported, \"together\" uses reasoning: { enabled } plus reasoning_effort when supported, \"zai\" uses thinking: { type }, \"qwen\" uses top-level enable_thinking: boolean, \"qwen-chat-template\" uses chat_template_kwargs.enable_thinking and preserve_thinking, \"chat-template\" uses configurable chat_template_kwargs, \"string-thinking\" uses top-level thinking: string, and \"ant-ling\" uses reasoning: { effort } only when the mapped effort is non-null. Default: \"openai\". */\n\tthinkingFormat?:\n\t\t| \"openai\"\n\t\t| \"openrouter\"\n\t\t| \"deepseek\"\n\t\t| \"together\"\n\t\t| \"zai\"\n\t\t| \"qwen\"\n\t\t| \"chat-template\"\n\t\t| \"qwen-chat-template\"\n\t\t| \"string-thinking\"\n\t\t| \"ant-ling\";\n\t/** Whether the provider accepts explicit disabled-thinking markers when thinking is off. Default: true. */\n\tsupportsDisabledThinking?: boolean;\n\t/** Kwargs to send as `chat_template_kwargs` when `thinkingFormat` is `chat-template`. Use `{ \"$var\": \"thinking.enabled\" }` or `{ \"$var\": \"thinking.effort\" }` for pi-controlled thinking values. */\n\tchatTemplateKwargs?: Record<string, ChatTemplateKwargValue>;\n\t/** OpenRouter-compatible routing preferences sent as the `provider` request field. */\n\topenRouterRouting?: OpenRouterRouting;\n\t/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */\n\tvercelGatewayRouting?: VercelGatewayRouting;\n\t/** Whether z.ai supports top-level `tool_stream: true` for streaming tool call deltas. Default: false. */\n\tzaiToolStream?: boolean;\n\t/** Whether the provider supports the `strict` field in tool definitions. Default: true. */\n\tsupportsStrictMode?: boolean;\n\t/**\n\t * Provider-specific JSON Schema flavor for tool parameters. `\"moonshot-mfjs\"`\n\t * normalizes schemas for Moonshot / Kimi backends that enforce a stricter subset.\n\t */\n\ttoolSchemaFlavor?: \"moonshot-mfjs\";\n\t/**\n\t * Tool call format for models that don't natively support tool calling.\n\t * When set, the middleware will intercept tool calls and format them as text.\n\t * Supported values: \"hermes\", \"morph-xml\", \"xml\" (deprecated alias for \"morph-xml\"), \"yaml-xml\", \"gemma4-delimiter\", \"anthropic-xml\", \"antml\"\n\t */\n\ttoolCallFormat?: string;\n\t/** Cache control convention for prompt caching. \"anthropic\" applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user/assistant text content. */\n\tcacheControlFormat?: \"anthropic\";\n\t/** Whether to send session-affinity data from `options.sessionId`. Default: false. */\n\tsendSessionAffinityHeaders?: boolean;\n\t/** Provider-specific deferred tool serialization mode. */\n\tdeferredToolsMode?: \"kimi\";\n\t/** Session-affinity header format: `openai` sends `session_id`, `x-client-request-id`, and `x-session-affinity`; `openai-nosession` sends `x-client-request-id` and `x-session-affinity`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */\n\tsessionAffinityFormat?: SessionAffinityFormat;\n\t/** Whether the provider supports long prompt cache retention (`prompt_cache_retention: \"24h\"` or Anthropic-style `cache_control.ttl: \"1h\"`, depending on format). Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n}\n\n/** Compatibility settings for OpenAI Responses APIs. */\nexport interface OpenAIResponsesCompat {\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: true. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Session-affinity header format: `openai` sends `session_id` and `x-client-request-id`; `openai-nosession` sends `x-client-request-id`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */\n\tsessionAffinityFormat?: SessionAffinityFormat;\n\t/** Whether the provider supports `prompt_cache_retention: \"24h\"`. Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/** Whether the provider supports the OpenAI Responses WebSocket transport. Default: true for api.openai.com only. */\n\tsupportsWebSocket?: boolean;\n\t/** Whether the provider supports the OpenAI Responses native `web_search_preview` tool. Default: true for api.openai.com only. */\n\tsupportsWebSearchPreview?: boolean;\n\t/** Whether the model supports client-executed tool search for deferred tools. Default: false. */\n\tsupportsToolSearch?: boolean;\n}\n\n/** Compatibility settings for Anthropic Messages-compatible APIs. */\nexport interface AnthropicMessagesCompat {\n\t/**\n\t * Whether the provider accepts per-tool `eager_input_streaming`.\n\t * When false, the Anthropic provider omits `tools[].eager_input_streaming`\n\t * and sends the legacy `fine-grained-tool-streaming-2025-05-14` beta header\n\t * for tool-enabled requests.\n\t * Default: true.\n\t */\n\tsupportsEagerToolInputStreaming?: boolean;\n\t/** Whether the provider supports Anthropic long cache retention (`cache_control.ttl: \"1h\"`). Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/**\n\t * Whether to send the `x-session-affinity` header from `options.sessionId`\n\t * when caching is enabled. Required for providers like Fireworks that use\n\t * session affinity for prompt cache routing (requests to the same replica\n\t * maximize cache hits).\n\t * Default: false.\n\t */\n\tsendSessionAffinityHeaders?: boolean;\n\t/**\n\t * Whether the provider supports Anthropic-style `cache_control` markers on\n\t * tool definitions. When false, `cache_control` is omitted from tool params.\n\t * Some Anthropic-compatible providers (e.g., Fireworks) do not support this\n\t * field on tools and may reject or ignore it.\n\t * Default: true.\n\t */\n\tsupportsCacheControlOnTools?: boolean;\n\t/**\n\t * Whether the provider accepts `thinking: { type: \"disabled\" }` when\n\t * extended thinking is off. Some Anthropic-compatible providers support\n\t * thinking but reject Anthropic's explicit disabled marker.\n\t * Default: true.\n\t */\n\tsupportsDisabledThinking?: boolean;\n\t/**\n\t * Whether the model accepts the Anthropic `temperature` request field.\n\t * Claude Opus 4.7+ rejects non-default temperature values.\n\t * Default: true.\n\t */\n\tsupportsTemperature?: boolean;\n\t/** Whether the model accepts Anthropic `tool_choice`. Default: true. */\n\tsupportsToolChoice?: boolean;\n\t/**\n\t * Whether the model accepts forced Anthropic tool choices (`any` or a named\n\t * tool). Default: true, except Claude Fable/Mythos models.\n\t */\n\tsupportsForcedToolChoice?: boolean;\n\t/**\n\t * Whether to force adaptive thinking (`thinking.type: \"adaptive\"` plus\n\t * `output_config.effort`) regardless of the model id. Built-in models that\n\t * require adaptive thinking set this in generated metadata. Custom\n\t * Anthropic-compatible providers can set this to `true` for any model whose\n\t * upstream requires the adaptive format. Set to `false` to opt out on\n\t * overridden built-in models and disable model id/name inference.\n\t * Default: infer from adaptive Claude model ids/names when possible.\n\t */\n\tforceAdaptiveThinking?: boolean;\n\t/** Whether to replay empty thinking signatures as `signature: \"\"` instead of converting thinking to text. Default: false. */\n\tallowEmptySignature?: boolean;\n\t/**\n\t * How to replay thinking blocks that have no usable Anthropic signature.\n\t * `\"text\"` demotes them to text; `\"empty-signature\"` preserves Anthropic's\n\t * thinking shape with `signature: \"\"`. Defaults to `\"text\"`; the legacy\n\t * `allowEmptySignature` setting remains a compatibility alias for\n\t * `\"empty-signature\"`.\n\t */\n\tunsignedThinkingReplay?: \"text\" | \"empty-signature\";\n\t/**\n\t * Whether the provider supports deferred tools loaded by `tool_reference`\n\t * blocks in tool results. Default: true for first-party Anthropic models\n\t * except Haiku and models older than Claude 4.5; false for other providers.\n\t */\n\tsupportsToolReferences?: boolean;\n\t/**\n\t * Whether the provider executes Anthropic server-side `web_search_*` native\n\t * tools and accepts their `server_tool_use` / `web_search_tool_result`\n\t * blocks on replay. Anthropic-compatible endpoints (e.g., kimi-coding) may\n\t * run the search but reject the replayed server-tool blocks on the next\n\t * request. When false, hook-injected `web_search_*` tools are stripped from\n\t * the payload. Default: true only for the first-party Anthropic endpoint.\n\t */\n\tsupportsWebSearch?: boolean;\n}\n\n/**\n * OpenRouter provider routing preferences.\n * Controls which upstream providers OpenRouter routes requests to.\n * Sent as the `provider` field in the OpenRouter API request body.\n * @see https://openrouter.ai/docs/guides/routing/provider-selection\n */\nexport interface OpenRouterRouting {\n\t/** Whether to allow backup providers to serve requests. Default: true. */\n\tallow_fallbacks?: boolean;\n\t/** Whether to filter providers to only those that support all parameters in the request. Default: false. */\n\trequire_parameters?: boolean;\n\t/** Data collection setting. \"allow\" (default): allow providers that may store/train on data. \"deny\": only use providers that don't collect user data. */\n\tdata_collection?: \"deny\" | \"allow\";\n\t/** Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. */\n\tzdr?: boolean;\n\t/** Whether to restrict routing to only models that allow text distillation. */\n\tenforce_distillable_text?: boolean;\n\t/** An ordered list of provider names/slugs to try in sequence, falling back to the next if unavailable. */\n\torder?: string[];\n\t/** List of provider names/slugs to exclusively allow for this request. */\n\tonly?: string[];\n\t/** List of provider names/slugs to skip for this request. */\n\tignore?: string[];\n\t/** A list of quantization levels to filter providers by (e.g., [\"fp16\", \"bf16\", \"fp8\", \"fp6\", \"int8\", \"int4\", \"fp4\", \"fp32\"]). */\n\tquantizations?: string[];\n\t/** Sorting strategy. Can be a string (e.g., \"price\", \"throughput\", \"latency\") or an object with `by` and `partition`. */\n\tsort?:\n\t\t| string\n\t\t| {\n\t\t\t\t/** The sorting metric: \"price\", \"throughput\", \"latency\". */\n\t\t\t\tby?: string;\n\t\t\t\t/** Partitioning strategy: \"model\" (default) or \"none\". */\n\t\t\t\tpartition?: string | null;\n\t\t };\n\t/** Maximum price per million tokens (USD). */\n\tmax_price?: {\n\t\t/** Price per million prompt tokens. */\n\t\tprompt?: number | string;\n\t\t/** Price per million completion tokens. */\n\t\tcompletion?: number | string;\n\t\t/** Price per image. */\n\t\timage?: number | string;\n\t\t/** Price per audio unit. */\n\t\taudio?: number | string;\n\t\t/** Price per request. */\n\t\trequest?: number | string;\n\t};\n\t/** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */\n\tpreferred_min_throughput?:\n\t\t| number\n\t\t| {\n\t\t\t\t/** Minimum tokens/second at the 50th percentile. */\n\t\t\t\tp50?: number;\n\t\t\t\t/** Minimum tokens/second at the 75th percentile. */\n\t\t\t\tp75?: number;\n\t\t\t\t/** Minimum tokens/second at the 90th percentile. */\n\t\t\t\tp90?: number;\n\t\t\t\t/** Minimum tokens/second at the 99th percentile. */\n\t\t\t\tp99?: number;\n\t\t };\n\t/** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */\n\tpreferred_max_latency?:\n\t\t| number\n\t\t| {\n\t\t\t\t/** Maximum latency in seconds at the 50th percentile. */\n\t\t\t\tp50?: number;\n\t\t\t\t/** Maximum latency in seconds at the 75th percentile. */\n\t\t\t\tp75?: number;\n\t\t\t\t/** Maximum latency in seconds at the 90th percentile. */\n\t\t\t\tp90?: number;\n\t\t\t\t/** Maximum latency in seconds at the 99th percentile. */\n\t\t\t\tp99?: number;\n\t\t };\n}\n\n/**\n * Vercel AI Gateway routing preferences.\n * Controls which upstream providers the gateway routes requests to.\n * @see https://vercel.com/docs/ai-gateway/models-and-providers/provider-options\n */\nexport interface VercelGatewayRouting {\n\t/** List of provider slugs to exclusively use for this request (e.g., [\"bedrock\", \"anthropic\"]). */\n\tonly?: string[];\n\t/** List of provider slugs to try in order (e.g., [\"anthropic\", \"openai\"]). */\n\torder?: string[];\n}\n\nexport interface ModelCostRates {\n\tinput: number; // $/million tokens\n\toutput: number; // $/million tokens\n\tcacheRead: number; // $/million tokens\n\tcacheWrite: number; // $/million tokens\n}\n\nexport interface ModelCostTier extends ModelCostRates {\n\t/** Use this tier for requests whose total input usage exceeds this token count. */\n\tinputTokensAbove: number;\n}\n\nexport interface ModelCost extends ModelCostRates {\n\t/** Request-wide pricing tiers. The highest matching input threshold applies to the full request. */\n\ttiers?: ModelCostTier[];\n}\n\nexport interface ImagesModel<TApi extends ImagesApi>\n\textends Omit<Model<Api>, \"api\" | \"provider\" | \"reasoning\" | \"contextWindow\" | \"maxTokens\" | \"compat\"> {\n\tapi: TApi;\n\tprovider: ImagesProviderId;\n\toutput: (\"text\" | \"image\")[];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAwXA,sFAAsF;AACtF,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC/C,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { AnthropicOptions } from \"./api/anthropic-messages.ts\";\nimport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nimport type { BedrockOptions } from \"./api/bedrock-converse-stream.ts\";\nimport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nimport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nimport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nimport type { OpenAICodexResponsesOptions } from \"./api/openai-codex-responses.ts\";\nimport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nimport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nimport type { PiMessagesOptions } from \"./api/pi-messages.ts\";\nimport type { Model } from \"./model.ts\";\nimport type { AssistantMessageDiagnostic } from \"./utils/diagnostics.ts\";\nimport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\nexport type { Model } from \"./model.ts\";\nexport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\nexport type KnownApi =\n\t| \"openai-completions\"\n\t| \"mistral-conversations\"\n\t| \"openai-responses\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex-responses\"\n\t| \"anthropic-messages\"\n\t| \"bedrock-converse-stream\"\n\t| \"google-generative-ai\"\n\t| \"google-vertex\"\n\t| \"pi-messages\";\n\nexport type Api = KnownApi | (string & {});\n\nexport type KnownImagesApi = \"openrouter-images\";\n\nexport type ImagesApi = KnownImagesApi | (string & {});\n\nexport type KnownProvider =\n\t| \"alibaba-token-plan\"\n\t| \"amazon-bedrock\"\n\t| \"ant-ling\"\n\t| \"anthropic\"\n\t| \"google\"\n\t| \"google-vertex\"\n\t| \"openai\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex\"\n\t| \"radius\"\n\t| \"nvidia\"\n\t| \"deepseek\"\n\t| \"github-copilot\"\n\t| \"xai\"\n\t| \"groq\"\n\t| \"cerebras\"\n\t| \"openrouter\"\n\t| \"vercel-ai-gateway\"\n\t| \"zai\"\n\t| \"zai-coding-cn\"\n\t| \"mistral\"\n\t| \"minimax\"\n\t| \"minimax-cn\"\n\t| \"moonshotai\"\n\t| \"moonshotai-cn\"\n\t| \"huggingface\"\n\t| \"fireworks\"\n\t| \"together\"\n\t| \"opencode\"\n\t| \"opencode-go\"\n\t| \"kimi-coding\"\n\t| \"cloudflare-workers-ai\"\n\t| \"cloudflare-ai-gateway\"\n\t| \"qwen-token-plan\"\n\t| \"qwen-token-plan-cn\"\n\t| \"xiaomi\"\n\t| \"xiaomi-token-plan-cn\"\n\t| \"xiaomi-token-plan-ams\"\n\t| \"xiaomi-token-plan-sgp\";\nexport type ProviderId = KnownProvider | string;\n\nexport type KnownImagesProvider = \"openrouter\";\n\nexport type ImagesProviderId = KnownImagesProvider | string;\n\nexport type ThinkingLevel = \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\nexport type ModelThinkingLevel = \"off\" | ThinkingLevel;\nexport type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;\nexport type ChatTemplateKwargValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| {\n\t\t\t$var: \"thinking.enabled\" | \"thinking.effort\";\n\t\t\tomitWhenOff?: boolean;\n\t };\n\n/** Token budgets for each thinking level (token-based providers only) */\nexport interface ThinkingBudgets {\n\tminimal?: number;\n\tlow?: number;\n\tmedium?: number;\n\thigh?: number;\n\tmax?: number;\n}\n\n// Base options all providers share\nexport type CacheRetention = \"none\" | \"short\" | \"long\";\n\nexport type Transport = \"sse\" | \"websocket\" | \"websocket-cached\" | \"auto\";\n\n/** Provider-scoped environment overrides. Values take precedence over process.env. */\nexport type ProviderEnv = Record<string, string>;\nexport type ProviderHeaders = Record<string, string | null>;\nexport type SessionAffinityFormat = \"openai\" | \"openai-nosession\" | \"openrouter\";\n\n/** Effective model and fully transformed headers for a request payload hook. */\nexport type ProviderRequestMetadata = {\n\tmodel: Model<Api>;\n\theaders: ProviderHeaders;\n};\n\nexport interface ProviderResponse {\n\tstatus: number;\n\theaders: Record<string, string>;\n}\n\nexport interface StreamOptions {\n\ttemperature?: number;\n\tmaxTokens?: number;\n\tsignal?: AbortSignal;\n\tapiKey?: string;\n\t/**\n\t * Preferred transport for providers that support multiple transports.\n\t * Providers that do not support this option ignore it.\n\t */\n\ttransport?: Transport;\n\t/**\n\t * Prompt cache retention preference. Providers map this to their supported values.\n\t * Default: \"short\".\n\t */\n\tcacheRetention?: CacheRetention;\n\t/**\n\t * Optional session identifier for providers that support session-based caching.\n\t * Providers can use this to enable prompt caching, request routing, or other\n\t * session-aware features. Ignored by providers that don't support it.\n\t */\n\tsessionId?: string;\n\t/**\n\t * Optional callback for inspecting or replacing provider payloads before sending.\n\t * Return undefined to keep the payload unchanged.\n\t */\n\tonPayload?: (\n\t\tpayload: unknown,\n\t\tmodel: Model<Api>,\n\t\trequest?: ProviderRequestMetadata,\n\t) => unknown | undefined | Promise<unknown | undefined>;\n\t/**\n\t * Optional callback invoked after an HTTP response is received and before\n\t * its body stream is consumed.\n\t */\n\tonResponse?: (response: ProviderResponse, model: Model<Api>) => void | Promise<void>;\n\t/**\n\t * Optional custom HTTP headers to include in API requests.\n\t * Merged with provider defaults; caller values override default headers.\n\t * On AWS Bedrock these are injected via a Smithy `build`-step middleware so\n\t * they are covered by SigV4 signing; reserved headers (`x-amz-*`,\n\t * `authorization`, `host`) are silently ignored to preserve SigV4 / bearer auth.\n\t * A null value suppresses a provider/API default header with the same name.\n\t */\n\theaders?: ProviderHeaders;\n\t/**\n\t * Optional custom fields to merge into the outgoing provider request body.\n\t * Applied before `onPayload` so `onPayload` can observe/override them.\n\t * Provider-managed fields (e.g. `model`, `messages`, `stream`) are preserved\n\t * and cannot be overridden to avoid breaking core request semantics.\n\t */\n\textraBody?: Record<string, unknown>;\n\t/**\n\t * HTTP request timeout in milliseconds for providers/SDKs that support it.\n\t * For example, OpenAI and Anthropic SDK clients default to 10 minutes.\n\t */\n\ttimeoutMs?: number;\n\t/**\n\t * WebSocket connect timeout in milliseconds for providers that support\n\t * WebSocket transports. This covers the connection/open handshake only;\n\t * stream idleness after connection uses timeoutMs.\n\t */\n\twebsocketConnectTimeoutMs?: number;\n\t/**\n\t * Maximum retry attempts for providers/SDKs that support client-side retries.\n\t * For example, OpenAI and Anthropic SDK clients default to 2.\n\t */\n\tmaxRetries?: number;\n\t/**\n\t * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.\n\t * If the server's requested delay exceeds this value, the request fails immediately\n\t * with an error containing the requested delay, allowing higher-level retry logic\n\t * to handle it with user visibility.\n\t * Default: 60000 (60 seconds). Set to 0 to disable the cap.\n\t */\n\tmaxRetryDelayMs?: number;\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t * For example, Anthropic uses `user_id` for abuse tracking and rate limiting.\n\t */\n\tmetadata?: Record<string, unknown>;\n\t/**\n\t * Provider-scoped environment values. These take precedence over process.env for\n\t * provider configuration such as regional settings, endpoint placeholders, and\n\t * proxy variables.\n\t */\n\tenv?: ProviderEnv;\n}\n\nexport type ProviderStreamOptions = StreamOptions & Record<string, unknown>;\n\n/**\n * Maps known APIs to their full provider-specific stream option types.\n * Type-only imports from API implementation modules are erased at emit, so\n * this is tree-shake safe.\n */\nexport interface ApiOptionsMap {\n\t\"anthropic-messages\": AnthropicOptions;\n\t\"openai-completions\": OpenAICompletionsOptions;\n\t\"openai-responses\": OpenAIResponsesOptions;\n\t\"openai-codex-responses\": OpenAICodexResponsesOptions;\n\t\"azure-openai-responses\": AzureOpenAIResponsesOptions;\n\t\"google-generative-ai\": GoogleOptions;\n\t\"google-vertex\": GoogleVertexOptions;\n\t\"mistral-conversations\": MistralOptions;\n\t\"bedrock-converse-stream\": BedrockOptions;\n\t\"pi-messages\": PiMessagesOptions;\n}\n\n/**\n * Full stream options for an API. Known APIs resolve to their concrete option\n * type; custom API strings fall back to the generic shape.\n */\nexport type ApiStreamOptions<TApi extends Api> = TApi extends keyof ApiOptionsMap\n\t? ApiOptionsMap[TApi]\n\t: StreamOptions & Record<string, unknown>;\n\n/**\n * The uniform stream contract of an API implementation module: every module\n * under `src/api/` exports exactly `stream` and `streamSimple`, so the module\n * itself satisfies this interface. Lazy wrappers (`lazyApi()`) and provider\n * factories pass these around as values. This is the untyped dispatch shape;\n * per-API option typing lives on the implementation modules themselves and on\n * `Provider.stream()` via `ApiStreamOptions`.\n */\nexport interface ProviderStreams {\n\tstream(model: Model<Api>, context: Context, options?: StreamOptions): AssistantMessageEventStream;\n\tstreamSimple(model: Model<Api>, context: Context, options?: SimpleStreamOptions): AssistantMessageEventStream;\n}\n\n/**\n * The uniform contract of an image-generation API implementation module:\n * every image API module under `src/api/` exports exactly `generateImages`,\n * so the module itself satisfies this interface. Lazy wrappers and image\n * provider factories pass these around as values.\n */\nexport interface ProviderImages {\n\tgenerateImages(\n\t\tmodel: ImagesModel<ImagesApi>,\n\t\tcontext: ImagesContext,\n\t\toptions?: ImagesOptions,\n\t): Promise<AssistantImages>;\n}\n\nexport interface ImagesOptions {\n\tsignal?: AbortSignal;\n\tapiKey?: string;\n\t/**\n\t * Provider-scoped environment values. These take precedence over process.env for\n\t * provider configuration such as endpoint placeholders and proxy variables.\n\t */\n\tenv?: ProviderEnv;\n\t/**\n\t * Optional callback for inspecting or replacing provider payloads before sending.\n\t * Return undefined to keep the payload unchanged.\n\t */\n\tonPayload?: (payload: unknown, model: ImagesModel<ImagesApi>) => unknown | undefined | Promise<unknown | undefined>;\n\t/**\n\t * Optional callback invoked after an HTTP response is received.\n\t */\n\tonResponse?: (response: ProviderResponse, model: ImagesModel<ImagesApi>) => void | Promise<void>;\n\t/**\n\t * Optional custom HTTP headers to include in API requests.\n\t * Merged with provider defaults; can override default headers.\n\t * A null value suppresses a provider/API default header with the same name.\n\t */\n\theaders?: ProviderHeaders;\n\t/**\n\t * HTTP request timeout in milliseconds for providers/SDKs that support it.\n\t */\n\ttimeoutMs?: number;\n\t/**\n\t * Maximum retry attempts for providers/SDKs that support client-side retries.\n\t */\n\tmaxRetries?: number;\n\t/**\n\t * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.\n\t * If the server's requested delay exceeds this value, the request fails immediately\n\t * with an error containing the requested delay, allowing higher-level retry logic\n\t * to handle it with user visibility.\n\t * Default: 60000 (60 seconds). Set to 0 to disable the cap.\n\t */\n\tmaxRetryDelayMs?: number;\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t */\n\tmetadata?: Record<string, unknown>;\n}\n\nexport type ProviderImagesOptions = ImagesOptions & Record<string, unknown>;\n\n// Unified options with reasoning passed to streamSimple() and completeSimple()\nexport interface SimpleStreamOptions extends StreamOptions {\n\treasoning?: ThinkingLevel;\n\t/** Custom token budgets for thinking levels (token-based providers only) */\n\tthinkingBudgets?: ThinkingBudgets;\n}\n\n// Generic StreamFunction with typed options.\n//\n// Contract:\n// - Must return an AssistantMessageEventStream.\n// - Once invoked, request/model/runtime failures should be encoded in the\n// returned stream, not thrown.\n// - Error termination must produce an AssistantMessage with stopReason\n// \"error\" or \"aborted\" and errorMessage, emitted via the stream protocol.\nexport type StreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = StreamOptions> = (\n\tmodel: Model<TApi>,\n\tcontext: Context,\n\toptions?: TOptions,\n) => AssistantMessageEventStream;\n\nexport type ImagesFunction<TApi extends ImagesApi = ImagesApi, TOptions extends ImagesOptions = ImagesOptions> = (\n\tmodel: ImagesModel<TApi>,\n\tcontext: ImagesContext,\n\toptions?: TOptions,\n) => Promise<AssistantImages>;\n\nexport interface TextSignatureV1 {\n\tv: 1;\n\tid: string;\n\tphase?: \"commentary\" | \"final_answer\";\n}\n\nexport interface TextContent {\n\ttype: \"text\";\n\ttext: string;\n\ttextSignature?: string; // e.g., for OpenAI responses, message metadata (legacy id string or TextSignatureV1 JSON)\n}\n\nexport interface ThinkingContent {\n\ttype: \"thinking\";\n\tthinking: string;\n\t/** Epoch ms, stamped by the agent loop at stream-event receipt, best-effort. */\n\tstartedAt?: number;\n\t/** Epoch ms, stamped by the agent loop at stream-event receipt, best-effort. */\n\tendedAt?: number;\n\tthinkingSignature?: string; // e.g., for OpenAI responses, the reasoning item ID\n\t/** When true, the thinking content was redacted by safety filters. The opaque\n\t * encrypted payload is stored in `thinkingSignature` so it can be passed back\n\t * to the API for multi-turn continuity. */\n\tredacted?: boolean;\n}\n\nexport interface ImageContent {\n\ttype: \"image\";\n\tdata: string; // base64 encoded image data\n\tmimeType: string; // e.g., \"image/jpeg\", \"image/png\". Video payloads (e.g. \"video/mp4\") ride this\n\t// same block for models that declare the \"video\" input modality; use isVideoMimeType() to branch.\n}\n\n/** True when an ImageContent block actually carries video data (e.g. \"video/mp4\"). */\nexport function isVideoMimeType(mimeType: string): boolean {\n\treturn mimeType.toLowerCase().startsWith(\"video/\");\n}\n\nexport interface ToolCall {\n\ttype: \"toolCall\";\n\tid: string;\n\tname: string;\n\targuments: Record<string, any>;\n\t/** Set by text tool-call middleware when a truncated call could not be recovered. Carriers of `incomplete` MUST NOT be executed. */\n\tincomplete?: true;\n\t/** Error explaining why an incomplete tool call could not be recovered. */\n\terrorMessage?: string;\n\tthoughtSignature?: string; // Google-specific: opaque signature for reusing thought context\n}\n\n/**\n * Provider-emitted content block whose semantics are owned by the originating\n * provider. Surfaces server-side tool invocations (web_search), server-side\n * tool results (web_search_tool_result), code execution traces, grounding\n * metadata fragments, and any other vendor-specific block the core does not\n * normalize.\n *\n * `subtype` mirrors the provider's wire `type` discriminator (e.g.\n * \"server_tool_use\", \"web_search_tool_result\", \"executableCode\"). `raw` is\n * the verbatim wire payload — extensions interpret it per provider+subtype.\n *\n * The owning provider id lives on the parent `AssistantMessage.provider`, not\n * here, to avoid drift on replay.\n *\n * On replay across providers, `convertMessages` implementations MUST drop\n * these blocks (they are not portable). This mirrors the existing\n * `redacted_thinking` skip pattern.\n */\nexport interface ProviderNativeContent {\n\ttype: \"providerNative\";\n\tsubtype: string;\n\traw: unknown;\n}\n\nexport interface Usage {\n\tinput: number;\n\toutput: number;\n\tcacheRead: number;\n\tcacheWrite: number;\n\t/** Subset of `cacheWrite` written with 1h retention. Only Anthropic reports this split. */\n\tcacheWrite1h?: number;\n\t/**\n\t * Reasoning/thinking tokens, when the provider reports them. This is a subset of\n\t * `output`: `output` already includes these tokens. Set to a number (possibly 0) by\n\t * providers that expose a reasoning breakdown; left undefined by providers that don't.\n\t */\n\treasoning?: number;\n\ttotalTokens: number;\n\tcost: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n}\n\nexport type StopReason = \"stop\" | \"length\" | \"toolUse\" | \"error\" | \"aborted\";\n\nexport type AssistantStopDetails = { type: \"refusal\"; explanation?: string } | { type: \"sensitive\" };\n\nexport interface UserMessage {\n\trole: \"user\";\n\tcontent: string | (TextContent | ImageContent)[];\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface AssistantMessage {\n\trole: \"assistant\";\n\tcontent: (TextContent | ThinkingContent | ToolCall | ProviderNativeContent)[];\n\tapi: Api;\n\tprovider: ProviderId;\n\tmodel: string;\n\tresponseModel?: string; // Concrete `chunk.model` when different from the requested `model` (e.g. OpenRouter `auto` -> `anthropic/...`)\n\tresponseId?: string; // Provider-specific response/message identifier when the upstream API exposes one\n\tdiagnostics?: AssistantMessageDiagnostic[]; // Redacted provider/runtime diagnostics for failures and recoveries.\n\tusage: Usage;\n\tstopReason: StopReason;\n\tstopDetails?: AssistantStopDetails;\n\terrorMessage?: string;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface ToolResultMessage<TDetails = any> {\n\trole: \"toolResult\";\n\ttoolCallId: string;\n\ttoolName: string;\n\tcontent: (TextContent | ImageContent)[]; // Supports text and images\n\tdetails?: TDetails;\n\t/** Usage from the tool execution itself, if available. Not part of main LLM context accounting. */\n\tusage?: Usage;\n\t/**\n\t * Names from `Context.tools` that became available after this result.\n\t * Providers with native deferred tool loading use this as the load point;\n\t * other providers ignore it and use `Context.tools` normally.\n\t */\n\taddedToolNames?: string[];\n\tisError: boolean;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport type Message = UserMessage | AssistantMessage | ToolResultMessage;\n\nexport type ImagesInputContent = TextContent | ImageContent;\nexport type ImagesOutputContent = TextContent | ImageContent;\n\nexport interface ImagesContext {\n\tinput: ImagesInputContent[];\n}\n\nexport type ImagesStopReason = \"stop\" | \"error\" | \"aborted\";\n\nexport interface AssistantImages {\n\tapi: ImagesApi;\n\tprovider: ImagesProviderId;\n\tmodel: string;\n\toutput: ImagesOutputContent[];\n\tresponseId?: string;\n\tusage?: Usage;\n\tstopReason: ImagesStopReason;\n\terrorMessage?: string;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nimport type { TSchema } from \"typebox\";\n\nexport interface FreeformToolFormat {\n\ttype: \"grammar\";\n\tsyntax: \"lark\";\n\tdefinition: string;\n}\n\n/** OpenAI grammar variants for constrained sampling. */\nexport type GrammarFormat = \"openai_lark\" | \"openai_regex\";\n\nexport type GrammarVariants = Partial<Record<GrammarFormat, string>>;\n\n/**\n * Optional provider-side constrained sampling configs for a tool.\n *\n * The `json_schema` value roughly maps to the concept of `strict` in APIs which is\n * implemented as json-schema constrained sampling by APIs. Grammar variants let\n * callers provide provider-specific encodings of the same intended language.\n */\nexport type ConstrainedSamplingConfig =\n\t| {\n\t\t\ttype: \"json_schema\";\n\t\t\tstrict: \"prefer\" | \"require\";\n\t }\n\t| {\n\t\t\ttype: \"grammar\";\n\t\t\tvariants: GrammarVariants;\n\t };\nexport interface Tool<TParameters extends TSchema = TSchema> {\n\tname: string;\n\tdescription: string;\n\tparameters: TParameters;\n\tfreeform?: FreeformToolFormat;\n\tconstrainedSampling?: false | ConstrainedSamplingConfig;\n}\n\nexport interface Context {\n\tsystemPrompt?: string;\n\tmessages: Message[];\n\ttools?: Tool[];\n}\n\n/**\n * Event protocol for AssistantMessageEventStream.\n *\n * Streams should emit `start` before partial updates, then terminate with either:\n * - `done` carrying the final successful AssistantMessage, or\n * - `error` carrying the final AssistantMessage with stopReason \"error\" or \"aborted\"\n * and errorMessage.\n */\nexport type AssistantMessageEvent =\n\t| { type: \"start\"; partial: AssistantMessage }\n\t| { type: \"text_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"text_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"text_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"thinking_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"thinking_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"thinking_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"toolcall_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"toolcall_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t/** Finalized - executable iff `incomplete !== true` on `toolCall`. */\n\t| { type: \"toolcall_end\"; contentIndex: number; toolCall: ToolCall; partial: AssistantMessage }\n\t| { type: \"done\"; reason: Extract<StopReason, \"stop\" | \"length\" | \"toolUse\">; message: AssistantMessage }\n\t| { type: \"error\"; reason: Extract<StopReason, \"aborted\" | \"error\">; error: AssistantMessage };\n\n/**\n * Compatibility settings for OpenAI-compatible completions APIs.\n * Use this to override URL-based auto-detection for custom providers.\n */\nexport interface OpenAICompletionsCompat {\n\t/** Whether the provider supports the `store` field. Default: auto-detected from URL. */\n\tsupportsStore?: boolean;\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: auto-detected from URL. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */\n\tsupportsReasoningEffort?: boolean;\n\t/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */\n\tsupportsUsageInStreaming?: boolean;\n\t/** Which field to use for max tokens. Default: auto-detected from URL. */\n\tmaxTokensField?: \"max_completion_tokens\" | \"max_tokens\";\n\t/** Whether tool results require the `name` field. Default: auto-detected from URL. */\n\trequiresToolResultName?: boolean;\n\t/** Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. */\n\trequiresAssistantAfterToolResult?: boolean;\n\t/** Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL. */\n\trequiresThinkingAsText?: boolean;\n\t/** Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. */\n\trequiresReasoningContentOnAssistantMessages?: boolean;\n\t/** Format for reasoning/thinking parameter. \"openai\" uses reasoning_effort, \"openrouter\" uses reasoning: { effort }, \"deepseek\" uses thinking: { type } plus reasoning_effort when supported, \"together\" uses reasoning: { enabled } plus reasoning_effort when supported, \"zai\" uses thinking: { type }, \"qwen\" uses top-level enable_thinking: boolean, \"qwen-chat-template\" uses chat_template_kwargs.enable_thinking and preserve_thinking, \"chat-template\" uses configurable chat_template_kwargs, \"string-thinking\" uses top-level thinking: string, and \"ant-ling\" uses reasoning: { effort } only when the mapped effort is non-null. Default: \"openai\". */\n\tthinkingFormat?:\n\t\t| \"openai\"\n\t\t| \"openrouter\"\n\t\t| \"deepseek\"\n\t\t| \"together\"\n\t\t| \"zai\"\n\t\t| \"qwen\"\n\t\t| \"chat-template\"\n\t\t| \"qwen-chat-template\"\n\t\t| \"string-thinking\"\n\t\t| \"ant-ling\";\n\t/** Whether the provider accepts explicit disabled-thinking markers when thinking is off. Default: true. */\n\tsupportsDisabledThinking?: boolean;\n\t/** Kwargs to send as `chat_template_kwargs` when `thinkingFormat` is `chat-template`. Use `{ \"$var\": \"thinking.enabled\" }` or `{ \"$var\": \"thinking.effort\" }` for pi-controlled thinking values. */\n\tchatTemplateKwargs?: Record<string, ChatTemplateKwargValue>;\n\t/** OpenRouter-compatible routing preferences sent as the `provider` request field. */\n\topenRouterRouting?: OpenRouterRouting;\n\t/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */\n\tvercelGatewayRouting?: VercelGatewayRouting;\n\t/** Whether z.ai supports top-level `tool_stream: true` for streaming tool call deltas. Default: false. */\n\tzaiToolStream?: boolean;\n\t/** Whether the provider supports OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */\n\tsupportsOpenAIGrammarTools?: boolean;\n\t/** Whether the provider supports the `strict` field in tool definitions. Default: true. */\n\tsupportsStrictMode?: boolean;\n\t/**\n\t * Provider-specific JSON Schema flavor for tool parameters. `\"moonshot-mfjs\"`\n\t * normalizes schemas for Moonshot / Kimi backends that enforce a stricter subset.\n\t */\n\ttoolSchemaFlavor?: \"moonshot-mfjs\";\n\t/**\n\t * Tool call format for models that don't natively support tool calling.\n\t * When set, the middleware will intercept tool calls and format them as text.\n\t * Supported values: \"hermes\", \"morph-xml\", \"xml\" (deprecated alias for \"morph-xml\"), \"yaml-xml\", \"gemma4-delimiter\", \"anthropic-xml\", \"antml\"\n\t */\n\ttoolCallFormat?: string;\n\t/** Cache control convention for prompt caching. \"anthropic\" applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content. */\n\tcacheControlFormat?: \"anthropic\";\n\t/** Whether to send session-affinity data from `options.sessionId`. Default: false. */\n\tsendSessionAffinityHeaders?: boolean;\n\t/** Provider-specific deferred tool serialization mode. */\n\tdeferredToolsMode?: \"kimi\";\n\t/** Session-affinity header format: `openai` sends `session_id`, `x-client-request-id`, and `x-session-affinity`; `openai-nosession` sends `x-client-request-id` and `x-session-affinity`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */\n\tsessionAffinityFormat?: SessionAffinityFormat;\n\t/** Whether the provider supports long prompt cache retention (`prompt_cache_retention: \"24h\"` or Anthropic-style `cache_control.ttl: \"1h\"`, depending on format). Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n}\n\n/** Compatibility settings for OpenAI Responses APIs. */\nexport interface OpenAIResponsesCompat {\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: true. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Session-affinity header format: `openai` sends `session_id` and `x-client-request-id`; `openai-nosession` sends `x-client-request-id`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */\n\tsessionAffinityFormat?: SessionAffinityFormat;\n\t/** Whether the provider supports `prompt_cache_retention: \"24h\"`. Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/** Whether the provider supports the OpenAI Responses WebSocket transport. Default: true for api.openai.com only. */\n\tsupportsWebSocket?: boolean;\n\t/** Whether the provider supports the OpenAI Responses native `web_search_preview` tool. Default: true for api.openai.com only. */\n\tsupportsWebSearchPreview?: boolean;\n\t/** Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly. */\n\tsupportsStrictMode?: boolean;\n\t/** Whether to emit OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */\n\tsupportsOpenAIGrammarTools?: boolean;\n\t/** Whether the model supports client-executed tool search for deferred tools. Default: false. */\n\tsupportsToolSearch?: boolean;\n\t/** Whether the model accepts `prompt_cache_options` (OpenAI GPT-5.6+ explicit prompt caching). Older OpenAI models reject the parameter. Default: false. */\n\tsupportsExplicitPromptCacheMode?: boolean;\n}\n\n/** Compatibility settings for Anthropic Messages-compatible APIs. */\nexport interface AnthropicMessagesCompat {\n\t/**\n\t * Whether the provider accepts per-tool `eager_input_streaming`.\n\t * When false, the Anthropic provider omits `tools[].eager_input_streaming`\n\t * and sends the legacy `fine-grained-tool-streaming-2025-05-14` beta header\n\t * for tool-enabled requests.\n\t * Default: true.\n\t */\n\tsupportsEagerToolInputStreaming?: boolean;\n\t/** Whether the provider supports Anthropic long cache retention (`cache_control.ttl: \"1h\"`). Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/**\n\t * Whether to send the `x-session-affinity` header from `options.sessionId`\n\t * when caching is enabled. Required for providers like Fireworks that use\n\t * session affinity for prompt cache routing (requests to the same replica\n\t * maximize cache hits).\n\t * Default: false.\n\t */\n\tsendSessionAffinityHeaders?: boolean;\n\t/**\n\t * Whether the provider supports Anthropic-style `cache_control` markers on\n\t * tool definitions. When false, `cache_control` is omitted from tool params.\n\t * Some Anthropic-compatible providers (e.g., Fireworks) do not support this\n\t * field on tools and may reject or ignore it.\n\t * Default: true.\n\t */\n\tsupportsCacheControlOnTools?: boolean;\n\t/**\n\t * Whether the provider accepts `thinking: { type: \"disabled\" }` when\n\t * extended thinking is off. Some Anthropic-compatible providers support\n\t * thinking but reject Anthropic's explicit disabled marker.\n\t * Default: true.\n\t */\n\tsupportsDisabledThinking?: boolean;\n\t/**\n\t * Whether the model accepts the Anthropic `temperature` request field.\n\t * Claude Opus 4.7+ rejects non-default temperature values.\n\t * Default: true.\n\t */\n\tsupportsTemperature?: boolean;\n\t/** Whether the model accepts Anthropic `tool_choice`. Default: true. */\n\tsupportsToolChoice?: boolean;\n\t/**\n\t * Whether the model accepts forced Anthropic tool choices (`any` or a named\n\t * tool). Default: true, except Claude Fable/Mythos models.\n\t */\n\tsupportsForcedToolChoice?: boolean;\n\t/**\n\t * Whether to force adaptive thinking (`thinking.type: \"adaptive\"` plus\n\t * `output_config.effort`) regardless of the model id. Built-in models that\n\t * require adaptive thinking set this in generated metadata. Custom\n\t * Anthropic-compatible providers can set this to `true` for any model whose\n\t * upstream requires the adaptive format. Set to `false` to opt out on\n\t * overridden built-in models and disable model id/name inference.\n\t * Default: infer from adaptive Claude model ids/names when possible.\n\t */\n\tforceAdaptiveThinking?: boolean;\n\t/** Whether to replay empty thinking signatures as `signature: \"\"` instead of converting thinking to text. Default: false. */\n\tallowEmptySignature?: boolean;\n\t/** Whether the provider supports Anthropic strict tool schemas. Default: false; generated Anthropic models enable it explicitly. */\n\tsupportsStrictTools?: boolean;\n\t/**\n\t * How to replay thinking blocks that have no usable Anthropic signature.\n\t * `\"text\"` demotes them to text; `\"empty-signature\"` preserves Anthropic's\n\t * thinking shape with `signature: \"\"`. Defaults to `\"text\"`; the legacy\n\t * `allowEmptySignature` setting remains a compatibility alias for\n\t * `\"empty-signature\"`.\n\t */\n\tunsignedThinkingReplay?: \"text\" | \"empty-signature\";\n\t/**\n\t * Whether the provider supports deferred tools loaded by `tool_reference`\n\t * blocks in tool results. Default: true for first-party Anthropic models\n\t * except Haiku and models older than Claude 4.5; false for other providers.\n\t */\n\tsupportsToolReferences?: boolean;\n\t/**\n\t * Whether the provider executes Anthropic server-side `web_search_*` native\n\t * tools and accepts their `server_tool_use` / `web_search_tool_result`\n\t * blocks on replay. Anthropic-compatible endpoints (e.g., kimi-coding) may\n\t * run the search but reject the replayed server-tool blocks on the next\n\t * request. When false, hook-injected `web_search_*` tools are stripped from\n\t * the payload. Default: true only for the first-party Anthropic endpoint.\n\t */\n\tsupportsWebSearch?: boolean;\n}\n\n/** Compatibility settings for Amazon Bedrock models. */\nexport interface BedrockCompat {\n\t/** Whether the model supports Bedrock strict tool schemas. Default: false. */\n\tsupportsStrictMode?: boolean;\n}\n\n/**\n * OpenRouter provider routing preferences.\n * Controls which upstream providers OpenRouter routes requests to.\n * Sent as the `provider` field in the OpenRouter API request body.\n * @see https://openrouter.ai/docs/guides/routing/provider-selection\n */\nexport interface OpenRouterRouting {\n\t/** Whether to allow backup providers to serve requests. Default: true. */\n\tallow_fallbacks?: boolean;\n\t/** Whether to filter providers to only those that support all parameters in the request. Default: false. */\n\trequire_parameters?: boolean;\n\t/** Data collection setting. \"allow\" (default): allow providers that may store/train on data. \"deny\": only use providers that don't collect user data. */\n\tdata_collection?: \"deny\" | \"allow\";\n\t/** Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. */\n\tzdr?: boolean;\n\t/** Whether to restrict routing to only models that allow text distillation. */\n\tenforce_distillable_text?: boolean;\n\t/** An ordered list of provider names/slugs to try in sequence, falling back to the next if unavailable. */\n\torder?: string[];\n\t/** List of provider names/slugs to exclusively allow for this request. */\n\tonly?: string[];\n\t/** List of provider names/slugs to skip for this request. */\n\tignore?: string[];\n\t/** A list of quantization levels to filter providers by (e.g., [\"fp16\", \"bf16\", \"fp8\", \"fp6\", \"int8\", \"int4\", \"fp4\", \"fp32\"]). */\n\tquantizations?: string[];\n\t/** Sorting strategy. Can be a string (e.g., \"price\", \"throughput\", \"latency\") or an object with `by` and `partition`. */\n\tsort?:\n\t\t| string\n\t\t| {\n\t\t\t\t/** The sorting metric: \"price\", \"throughput\", \"latency\". */\n\t\t\t\tby?: string;\n\t\t\t\t/** Partitioning strategy: \"model\" (default) or \"none\". */\n\t\t\t\tpartition?: string | null;\n\t\t };\n\t/** Maximum price per million tokens (USD). */\n\tmax_price?: {\n\t\t/** Price per million prompt tokens. */\n\t\tprompt?: number | string;\n\t\t/** Price per million completion tokens. */\n\t\tcompletion?: number | string;\n\t\t/** Price per image. */\n\t\timage?: number | string;\n\t\t/** Price per audio unit. */\n\t\taudio?: number | string;\n\t\t/** Price per request. */\n\t\trequest?: number | string;\n\t};\n\t/** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */\n\tpreferred_min_throughput?:\n\t\t| number\n\t\t| {\n\t\t\t\t/** Minimum tokens/second at the 50th percentile. */\n\t\t\t\tp50?: number;\n\t\t\t\t/** Minimum tokens/second at the 75th percentile. */\n\t\t\t\tp75?: number;\n\t\t\t\t/** Minimum tokens/second at the 90th percentile. */\n\t\t\t\tp90?: number;\n\t\t\t\t/** Minimum tokens/second at the 99th percentile. */\n\t\t\t\tp99?: number;\n\t\t };\n\t/** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */\n\tpreferred_max_latency?:\n\t\t| number\n\t\t| {\n\t\t\t\t/** Maximum latency in seconds at the 50th percentile. */\n\t\t\t\tp50?: number;\n\t\t\t\t/** Maximum latency in seconds at the 75th percentile. */\n\t\t\t\tp75?: number;\n\t\t\t\t/** Maximum latency in seconds at the 90th percentile. */\n\t\t\t\tp90?: number;\n\t\t\t\t/** Maximum latency in seconds at the 99th percentile. */\n\t\t\t\tp99?: number;\n\t\t };\n}\n\n/**\n * Vercel AI Gateway routing preferences.\n * Controls which upstream providers the gateway routes requests to.\n * @see https://vercel.com/docs/ai-gateway/models-and-providers/provider-options\n */\nexport interface VercelGatewayRouting {\n\t/** List of provider slugs to exclusively use for this request (e.g., [\"bedrock\", \"anthropic\"]). */\n\tonly?: string[];\n\t/** List of provider slugs to try in order (e.g., [\"anthropic\", \"openai\"]). */\n\torder?: string[];\n}\n\nexport interface ModelCostRates {\n\tinput: number; // $/million tokens\n\toutput: number; // $/million tokens\n\tcacheRead: number; // $/million tokens\n\tcacheWrite: number; // $/million tokens\n}\n\nexport interface ModelCostTier extends ModelCostRates {\n\t/** Use this tier for requests whose total input usage exceeds this token count. */\n\tinputTokensAbove: number;\n}\n\nexport interface ModelCost extends ModelCostRates {\n\t/** Request-wide pricing tiers. The highest matching input threshold applies to the full request. */\n\ttiers?: ModelCostTier[];\n}\n\nexport interface ImagesModel<TApi extends ImagesApi>\n\textends Omit<Model<Api>, \"api\" | \"provider\" | \"reasoning\" | \"contextWindow\" | \"maxTokens\" | \"compat\"> {\n\tapi: TApi;\n\tprovider: ImagesProviderId;\n\toutput: (\"text\" | \"image\")[];\n}\n"]}
@@ -0,0 +1,11 @@
1
+ /** The JWT claim holding the ChatGPT account that owns a Codex credential. */
2
+ export declare const OPENAI_CODEX_AUTH_CLAIM_PATH = "https://api.openai.com/auth";
3
+ /**
4
+ * Reads the stable ChatGPT account identifier from a Codex access token.
5
+ *
6
+ * This deliberately uses only browser primitives so request code and OAuth
7
+ * code can share it without pulling Node-only authentication modules into
8
+ * browser consumers.
9
+ */
10
+ export declare function extractOpenAiCodexAccountId(token: string): string | undefined;
11
+ //# sourceMappingURL=openai-codex-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-codex-auth.d.ts","sourceRoot":"","sources":["../../src/utils/openai-codex-auth.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,gCAAgC,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAe7E"}
@@ -0,0 +1,30 @@
1
+ /** The JWT claim holding the ChatGPT account that owns a Codex credential. */
2
+ export const OPENAI_CODEX_AUTH_CLAIM_PATH = "https://api.openai.com/auth";
3
+ /**
4
+ * Reads the stable ChatGPT account identifier from a Codex access token.
5
+ *
6
+ * This deliberately uses only browser primitives so request code and OAuth
7
+ * code can share it without pulling Node-only authentication modules into
8
+ * browser consumers.
9
+ */
10
+ export function extractOpenAiCodexAccountId(token) {
11
+ try {
12
+ const parts = token.split(".");
13
+ const encodedPayload = parts.length === 3 ? parts[1] : undefined;
14
+ if (!encodedPayload)
15
+ return undefined;
16
+ const base64 = encodedPayload.replaceAll("-", "+").replaceAll("_", "/");
17
+ const payload = JSON.parse(atob(base64.padEnd(Math.ceil(base64.length / 4) * 4, "=")));
18
+ if (!payload || typeof payload !== "object")
19
+ return undefined;
20
+ const auth = Reflect.get(payload, OPENAI_CODEX_AUTH_CLAIM_PATH);
21
+ if (!auth || typeof auth !== "object")
22
+ return undefined;
23
+ const accountId = Reflect.get(auth, "chatgpt_account_id");
24
+ return typeof accountId === "string" && accountId.length > 0 ? accountId : undefined;
25
+ }
26
+ catch {
27
+ return undefined;
28
+ }
29
+ }
30
+ //# sourceMappingURL=openai-codex-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-codex-auth.js","sourceRoot":"","sources":["../../src/utils/openai-codex-auth.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,4BAA4B,GAAG,6BAA6B,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAAa;IACxD,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACjE,IAAI,CAAC,cAAc;YAAE,OAAO,SAAS,CAAC;QACtC,MAAM,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACxE,MAAM,OAAO,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QAChG,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QAC9D,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QACxD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QAC1D,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACtF,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["/** The JWT claim holding the ChatGPT account that owns a Codex credential. */\nexport const OPENAI_CODEX_AUTH_CLAIM_PATH = \"https://api.openai.com/auth\";\n\n/**\n * Reads the stable ChatGPT account identifier from a Codex access token.\n *\n * This deliberately uses only browser primitives so request code and OAuth\n * code can share it without pulling Node-only authentication modules into\n * browser consumers.\n */\nexport function extractOpenAiCodexAccountId(token: string): string | undefined {\n\ttry {\n\t\tconst parts = token.split(\".\");\n\t\tconst encodedPayload = parts.length === 3 ? parts[1] : undefined;\n\t\tif (!encodedPayload) return undefined;\n\t\tconst base64 = encodedPayload.replaceAll(\"-\", \"+\").replaceAll(\"_\", \"/\");\n\t\tconst payload: unknown = JSON.parse(atob(base64.padEnd(Math.ceil(base64.length / 4) * 4, \"=\")));\n\t\tif (!payload || typeof payload !== \"object\") return undefined;\n\t\tconst auth = Reflect.get(payload, OPENAI_CODEX_AUTH_CLAIM_PATH);\n\t\tif (!auth || typeof auth !== \"object\") return undefined;\n\t\tconst accountId = Reflect.get(auth, \"chatgpt_account_id\");\n\t\treturn typeof accountId === \"string\" && accountId.length > 0 ? accountId : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -25,6 +25,7 @@ import type { AssistantMessage } from "../types.ts";
25
25
  * - LM Studio: "greater than the context length"
26
26
  * - Kimi For Coding: "exceeded model token limit: X (requested: Y)"
27
27
  * - DS4: "Prompt has X tokens, but the configured context size is Y tokens"
28
+ * - DashScope/Qwen: "Range of input length should be [1, X]"
28
29
  *
29
30
  * **Unreliable detection:**
30
31
  * - z.ai: Sometimes accepts overflow silently (detectable via usage.input > contextWindow),
@@ -1 +1 @@
1
- {"version":3,"file":"overflow.d.ts","sourceRoot":"","sources":["../../src/utils/overflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA6EpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CA6B5F"}
1
+ {"version":3,"file":"overflow.d.ts","sourceRoot":"","sources":["../../src/utils/overflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA+EpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CA6B5F"}
@@ -29,6 +29,7 @@
29
29
  * - Xiaomi MiMo: Truncates input to fill contextWindow exactly, then returns finish_reason "length"
30
30
  * with output=0 (no room left to generate). Detected via stopReason "length" + zero output +
31
31
  * input filling the context window.
32
+ * - DashScope/Qwen: "Range of input length should be [1, X]" (HTTP 400 invalid_parameter_error)
32
33
  * - Ollama: Some deployments truncate silently, others return errors like "prompt too long; exceeded max context length by X tokens"
33
34
  */
34
35
  const OVERFLOW_PATTERNS = [
@@ -52,6 +53,7 @@ const OVERFLOW_PATTERNS = [
52
53
  /prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i, // DS4 server
53
54
  /model_context_window_exceeded/i, // z.ai non-standard finish_reason surfaced as error text
54
55
  /prompt too long; exceeded (?:max )?context length/i, // Ollama explicit overflow error
56
+ /range of input length should be/i, // DashScope / Qwen Token Plan
55
57
  /context[_ ]length[_ ]exceeded/i, // Generic fallback
56
58
  /too many tokens/i, // Generic fallback
57
59
  /token limit exceeded/i, // Generic fallback
@@ -97,6 +99,7 @@ const NON_OVERFLOW_PATTERNS = [
97
99
  * - LM Studio: "greater than the context length"
98
100
  * - Kimi For Coding: "exceeded model token limit: X (requested: Y)"
99
101
  * - DS4: "Prompt has X tokens, but the configured context size is Y tokens"
102
+ * - DashScope/Qwen: "Range of input length should be [1, X]"
100
103
  *
101
104
  * **Unreliable detection:**
102
105
  * - z.ai: Sometimes accepts overflow silently (detectable via usage.input > contextWindow),
@@ -1 +1 @@
1
- {"version":3,"file":"overflow.js","sourceRoot":"","sources":["../../src/utils/overflow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,iBAAiB,GAAG;IACzB,qBAAqB,EAAE,2BAA2B;IAClD,oBAAoB,EAAE,kDAAkD;IACxE,wCAAwC,EAAE,iBAAiB;IAC3D,6BAA6B,EAAE,uCAAuC;IACtE,4FAA4F,EAAE,sCAAsC;IACpI,yCAAyC,E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C;QACb,CAAC;IACF,CAAC;IAED,8EAA8E;IAC9E,IAAI,aAAa,IAAI,OAAO,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;QACpD,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QAClE,IAAI,WAAW,GAAG,aAAa,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAED,sFAAsF;IACtF,qFAAqF;IACrF,gEAAgE;IAChE,IAAI,aAAa,IAAI,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpF,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QAClE,IAAI,WAAW,IAAI,aAAa,GAAG,IAAI,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import type { AssistantMessage } from \"../types.ts\";\n\n/**\n * Regex patterns to detect context overflow errors from different providers.\n *\n * These patterns match error messages returned when the input exceeds\n * the model's context window.\n *\n * Provider-specific patterns (with example error messages):\n *\n * - Anthropic: \"prompt is too long: 213462 tokens > 200000 maximum\"\n * - Anthropic: \"413 {\\\"error\\\":{\\\"type\\\":\\\"request_too_large\\\",\\\"message\\\":\\\"Request exceeds the maximum size\\\"}}\"\n * - OpenAI: \"Your input exceeds the context window of this model\"\n * - OpenAI/LiteLLM: \"Requested token count exceeds the model's maximum context length of 131072 tokens\"\n * - OpenAI-compatible: \"Input length (265330) exceeds model's maximum context length (262144).\"\n * - Google: \"The input token count (1196265) exceeds the maximum number of tokens allowed (1048575)\"\n * - xAI: \"This model's maximum prompt length is 131072 but the request contains 537812 tokens\"\n * - Groq: \"Please reduce the length of the messages or completion\"\n * - OpenRouter: \"This endpoint's maximum context length is X tokens. However, you requested about Y tokens\"\n * - OpenRouter/Poolside: \"Input length X exceeds the maximum allowed input length of Y tokens.\"\n * - Together AI: \"The input (X tokens) is longer than the model's context length (Y tokens).\"\n * - llama.cpp: \"the request exceeds the available context size, try increasing it\"\n * - LM Studio: \"tokens to keep from the initial prompt is greater than the context length\"\n * - GitHub Copilot: \"prompt token count of X exceeds the limit of Y\"\n * - MiniMax: \"invalid params, context window exceeds limit\"\n * - Kimi For Coding: \"Your request exceeded model token limit: X (requested: Y)\"\n * - DS4: \"Prompt has X tokens, but the configured context size is Y tokens\"\n * - Cerebras: \"400/413 status code (no body)\"\n * - Mistral: \"Prompt contains X tokens ... too large for model with Y maximum context length\"\n * - z.ai: Does NOT error, accepts overflow silently - handled via usage.input > contextWindow\n * - Xiaomi MiMo: Truncates input to fill contextWindow exactly, then returns finish_reason \"length\"\n * with output=0 (no room left to generate). Detected via stopReason \"length\" + zero output +\n * input filling the context window.\n * - Ollama: Some deployments truncate silently, others return errors like \"prompt too long; exceeded max context length by X tokens\"\n */\nconst OVERFLOW_PATTERNS = [\n\t/prompt is too long/i, // Anthropic token overflow\n\t/request_too_large/i, // Anthropic request byte-size overflow (HTTP 413)\n\t/input is too long for requested model/i, // Amazon Bedrock\n\t/exceeds the context window/i, // OpenAI (Completions & Responses API)\n\t/exceeds (?:the )?(?:model'?s )?maximum context length(?: of [\\d,]+ tokens?|\\s*\\([\\d,]+\\))/i, // OpenAI-compatible proxies (LiteLLM)\n\t/input token count.*exceeds the maximum/i, // Google (Gemini)\n\t/maximum prompt length is \\d+/i, // xAI (Grok)\n\t/reduce the length of the messages/i, // Groq\n\t/maximum context length is \\d+ tokens/i, // OpenRouter (most backends)\n\t/exceeds (?:the )?maximum allowed input length of [\\d,]+ tokens?/i, // OpenRouter/Poolside\n\t/input \\(\\d+ tokens\\) is longer than the model'?s context length \\(\\d+ tokens\\)/i, // Together AI\n\t/exceeds the limit of \\d+/i, // GitHub Copilot\n\t/exceeds the available context size/i, // llama.cpp server\n\t/greater than the context length/i, // LM Studio\n\t/context window exceeds limit/i, // MiniMax\n\t/exceeded model token limit/i, // Kimi For Coding\n\t/too large for model with \\d+ maximum context length/i, // Mistral\n\t/prompt has [\\d,]+ tokens?, but the configured context size is [\\d,]+ tokens?/i, // DS4 server\n\t/model_context_window_exceeded/i, // z.ai non-standard finish_reason surfaced as error text\n\t/prompt too long; exceeded (?:max )?context length/i, // Ollama explicit overflow error\n\t/context[_ ]length[_ ]exceeded/i, // Generic fallback\n\t/too many tokens/i, // Generic fallback\n\t/token limit exceeded/i, // Generic fallback\n\t/^4(?:00|13)\\s*(?:status code)?\\s*\\(no body\\)/i, // Cerebras: 400/413 with no body\n];\n\n/**\n * Patterns that indicate non-overflow errors (e.g. rate limiting, server errors).\n * Error messages matching any of these are excluded from overflow detection\n * even if they also match an OVERFLOW_PATTERN.\n *\n * Example: Bedrock formats throttling errors as \"ThrottlingException: Too many tokens,\n * please wait before trying again.\" which would match the /too many tokens/i overflow\n * pattern without this exclusion.\n */\nconst NON_OVERFLOW_PATTERNS = [\n\t/^(Throttling error|Service unavailable):/i, // AWS Bedrock non-overflow errors (human-readable prefixes from formatBedrockError)\n\t/rate limit/i, // Generic rate limiting\n\t/too many requests/i, // Generic HTTP 429 style\n];\n\n/**\n * Check if an assistant message represents a context overflow error.\n *\n * This handles two cases:\n * 1. Error-based overflow: Most providers return stopReason \"error\" with a\n * specific error message pattern.\n * 2. Silent overflow: Some providers accept overflow requests and return\n * successfully. For these, we check if usage.input exceeds the context window.\n *\n * ## Reliability by Provider\n *\n * **Reliable detection (returns error with detectable message):**\n * - Anthropic: \"prompt is too long: X tokens > Y maximum\" or \"request_too_large\"\n * - OpenAI (Completions & Responses): \"exceeds the context window\", \"exceeds the model's maximum context length of X tokens\", or \"exceeds model's maximum context length (X)\"\n * - Google Gemini: \"input token count exceeds the maximum\"\n * - xAI (Grok): \"maximum prompt length is X but request contains Y\"\n * - Groq: \"reduce the length of the messages\"\n * - Cerebras: 400/413 status code (no body)\n * - Mistral: \"Prompt contains X tokens ... too large for model with Y maximum context length\"\n * - OpenRouter (most backends): \"maximum context length is X tokens\"\n * - OpenRouter/Poolside: \"Input length X exceeds the maximum allowed input length of Y tokens.\"\n * - Together AI: \"The input (X tokens) is longer than the model's context length (Y tokens).\"\n * - llama.cpp: \"exceeds the available context size\"\n * - LM Studio: \"greater than the context length\"\n * - Kimi For Coding: \"exceeded model token limit: X (requested: Y)\"\n * - DS4: \"Prompt has X tokens, but the configured context size is Y tokens\"\n *\n * **Unreliable detection:**\n * - z.ai: Sometimes accepts overflow silently (detectable via usage.input > contextWindow),\n * sometimes returns rate limit errors. Pass contextWindow param to detect silent overflow.\n * - Xiaomi MiMo: Truncates input to fit contextWindow then returns stopReason \"length\" with\n * output=0. Pass contextWindow param to detect via the \"filled context + zero output\" signal.\n * - Ollama: May truncate input silently for some setups, but may also return explicit\n * overflow errors that match the patterns above. Silent truncation still cannot be\n * detected here because we do not know the expected token count.\n *\n * ## Custom Providers\n *\n * If you've added custom models via settings.json, this function may not detect\n * overflow errors from those providers. To add support:\n *\n * 1. Send a request that exceeds the model's context window\n * 2. Check the errorMessage in the response\n * 3. Create a regex pattern that matches the error\n * 4. The pattern should be added to OVERFLOW_PATTERNS in this file, or\n * check the errorMessage yourself before calling this function\n *\n * @param message - The assistant message to check\n * @param contextWindow - Optional context window size for detecting silent overflow (z.ai)\n * @returns true if the message indicates a context overflow\n */\nexport function isContextOverflow(message: AssistantMessage, contextWindow?: number): boolean {\n\t// Case 1: Check error message patterns\n\tif (message.stopReason === \"error\" && message.errorMessage) {\n\t\t// Skip messages matching known non-overflow patterns (e.g. throttling / rate-limit)\n\t\tconst isNonOverflow = NON_OVERFLOW_PATTERNS.some((p) => p.test(message.errorMessage!));\n\t\tif (!isNonOverflow && OVERFLOW_PATTERNS.some((p) => p.test(message.errorMessage!))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Case 2: Silent overflow (z.ai style) - successful but usage exceeds context\n\tif (contextWindow && message.stopReason === \"stop\") {\n\t\tconst inputTokens = message.usage.input + message.usage.cacheRead;\n\t\tif (inputTokens > contextWindow) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Case 3: Length-stop overflow (Xiaomi MiMo style) - server truncates oversized input\n\t// to fit the context window, leaving no room for output. Returns stopReason \"length\"\n\t// with output=0 and input+cacheRead filling the context window.\n\tif (contextWindow && message.stopReason === \"length\" && message.usage.output === 0) {\n\t\tconst inputTokens = message.usage.input + message.usage.cacheRead;\n\t\tif (inputTokens >= contextWindow * 0.99) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"file":"overflow.js","sourceRoot":"","sources":["../../src/utils/overflow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,iBAAiB,GAAG;IACzB,qBAAqB,EAAE,2BAA2B;IAClD,oBAAoB,EAAE,kDAAkD;IACxE,wCAAwC,EAAE,iBAAiB;IAC3D,6BAA6B,EAAE,uCAAuC;IACtE,4FAA4F,EAAE,sCAAsC;IACpI,yCAAyC,EAAE,kBAAkB;IAC7D,+BAA+B,EAAE,aAAa;IAC9C,oCAAoC,EAAE,OAAO;IAC7C,uCAAuC,EAAE,6BAA6B;IACtE,kEAAkE,EAAE,sBAAsB;IAC1F,iFAAiF,EAAE,cAAc;IACjG,2BAA2B,EAAE,iBAAiB;IAC9C,qCAAqC,EAAE,mBAAmB;IAC1D,kCAAkC,EAAE,YAAY;IAChD,+BAA+B,EAAE,UAAU;IAC3C,6BAA6B,EAAE,kBAAkB;IACjD,sDAAsD,EAAE,UAAU;IAClE,+EAA+E,EAAE,aAAa;IAC9F,gCAAgC,EAAE,yDAAyD;IAC3F,oDAAoD,EAAE,iCAAiC;IACvF,kCAAkC,EAAE,8BAA8B;IAClE,gCAAgC,EAAE,mBAAmB;IACrD,kBAAkB,EAAE,mBAAmB;IACvC,u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,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QAClE,IAAI,WAAW,IAAI,aAAa,GAAG,IAAI,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import type { AssistantMessage } from \"../types.ts\";\n\n/**\n * Regex patterns to detect context overflow errors from different providers.\n *\n * These patterns match error messages returned when the input exceeds\n * the model's context window.\n *\n * Provider-specific patterns (with example error messages):\n *\n * - Anthropic: \"prompt is too long: 213462 tokens > 200000 maximum\"\n * - Anthropic: \"413 {\\\"error\\\":{\\\"type\\\":\\\"request_too_large\\\",\\\"message\\\":\\\"Request exceeds the maximum size\\\"}}\"\n * - OpenAI: \"Your input exceeds the context window of this model\"\n * - OpenAI/LiteLLM: \"Requested token count exceeds the model's maximum context length of 131072 tokens\"\n * - OpenAI-compatible: \"Input length (265330) exceeds model's maximum context length (262144).\"\n * - Google: \"The input token count (1196265) exceeds the maximum number of tokens allowed (1048575)\"\n * - xAI: \"This model's maximum prompt length is 131072 but the request contains 537812 tokens\"\n * - Groq: \"Please reduce the length of the messages or completion\"\n * - OpenRouter: \"This endpoint's maximum context length is X tokens. However, you requested about Y tokens\"\n * - OpenRouter/Poolside: \"Input length X exceeds the maximum allowed input length of Y tokens.\"\n * - Together AI: \"The input (X tokens) is longer than the model's context length (Y tokens).\"\n * - llama.cpp: \"the request exceeds the available context size, try increasing it\"\n * - LM Studio: \"tokens to keep from the initial prompt is greater than the context length\"\n * - GitHub Copilot: \"prompt token count of X exceeds the limit of Y\"\n * - MiniMax: \"invalid params, context window exceeds limit\"\n * - Kimi For Coding: \"Your request exceeded model token limit: X (requested: Y)\"\n * - DS4: \"Prompt has X tokens, but the configured context size is Y tokens\"\n * - Cerebras: \"400/413 status code (no body)\"\n * - Mistral: \"Prompt contains X tokens ... too large for model with Y maximum context length\"\n * - z.ai: Does NOT error, accepts overflow silently - handled via usage.input > contextWindow\n * - Xiaomi MiMo: Truncates input to fill contextWindow exactly, then returns finish_reason \"length\"\n * with output=0 (no room left to generate). Detected via stopReason \"length\" + zero output +\n * input filling the context window.\n * - DashScope/Qwen: \"Range of input length should be [1, X]\" (HTTP 400 invalid_parameter_error)\n * - Ollama: Some deployments truncate silently, others return errors like \"prompt too long; exceeded max context length by X tokens\"\n */\nconst OVERFLOW_PATTERNS = [\n\t/prompt is too long/i, // Anthropic token overflow\n\t/request_too_large/i, // Anthropic request byte-size overflow (HTTP 413)\n\t/input is too long for requested model/i, // Amazon Bedrock\n\t/exceeds the context window/i, // OpenAI (Completions & Responses API)\n\t/exceeds (?:the )?(?:model'?s )?maximum context length(?: of [\\d,]+ tokens?|\\s*\\([\\d,]+\\))/i, // OpenAI-compatible proxies (LiteLLM)\n\t/input token count.*exceeds the maximum/i, // Google (Gemini)\n\t/maximum prompt length is \\d+/i, // xAI (Grok)\n\t/reduce the length of the messages/i, // Groq\n\t/maximum context length is \\d+ tokens/i, // OpenRouter (most backends)\n\t/exceeds (?:the )?maximum allowed input length of [\\d,]+ tokens?/i, // OpenRouter/Poolside\n\t/input \\(\\d+ tokens\\) is longer than the model'?s context length \\(\\d+ tokens\\)/i, // Together AI\n\t/exceeds the limit of \\d+/i, // GitHub Copilot\n\t/exceeds the available context size/i, // llama.cpp server\n\t/greater than the context length/i, // LM Studio\n\t/context window exceeds limit/i, // MiniMax\n\t/exceeded model token limit/i, // Kimi For Coding\n\t/too large for model with \\d+ maximum context length/i, // Mistral\n\t/prompt has [\\d,]+ tokens?, but the configured context size is [\\d,]+ tokens?/i, // DS4 server\n\t/model_context_window_exceeded/i, // z.ai non-standard finish_reason surfaced as error text\n\t/prompt too long; exceeded (?:max )?context length/i, // Ollama explicit overflow error\n\t/range of input length should be/i, // DashScope / Qwen Token Plan\n\t/context[_ ]length[_ ]exceeded/i, // Generic fallback\n\t/too many tokens/i, // Generic fallback\n\t/token limit exceeded/i, // Generic fallback\n\t/^4(?:00|13)\\s*(?:status code)?\\s*\\(no body\\)/i, // Cerebras: 400/413 with no body\n];\n\n/**\n * Patterns that indicate non-overflow errors (e.g. rate limiting, server errors).\n * Error messages matching any of these are excluded from overflow detection\n * even if they also match an OVERFLOW_PATTERN.\n *\n * Example: Bedrock formats throttling errors as \"ThrottlingException: Too many tokens,\n * please wait before trying again.\" which would match the /too many tokens/i overflow\n * pattern without this exclusion.\n */\nconst NON_OVERFLOW_PATTERNS = [\n\t/^(Throttling error|Service unavailable):/i, // AWS Bedrock non-overflow errors (human-readable prefixes from formatBedrockError)\n\t/rate limit/i, // Generic rate limiting\n\t/too many requests/i, // Generic HTTP 429 style\n];\n\n/**\n * Check if an assistant message represents a context overflow error.\n *\n * This handles two cases:\n * 1. Error-based overflow: Most providers return stopReason \"error\" with a\n * specific error message pattern.\n * 2. Silent overflow: Some providers accept overflow requests and return\n * successfully. For these, we check if usage.input exceeds the context window.\n *\n * ## Reliability by Provider\n *\n * **Reliable detection (returns error with detectable message):**\n * - Anthropic: \"prompt is too long: X tokens > Y maximum\" or \"request_too_large\"\n * - OpenAI (Completions & Responses): \"exceeds the context window\", \"exceeds the model's maximum context length of X tokens\", or \"exceeds model's maximum context length (X)\"\n * - Google Gemini: \"input token count exceeds the maximum\"\n * - xAI (Grok): \"maximum prompt length is X but request contains Y\"\n * - Groq: \"reduce the length of the messages\"\n * - Cerebras: 400/413 status code (no body)\n * - Mistral: \"Prompt contains X tokens ... too large for model with Y maximum context length\"\n * - OpenRouter (most backends): \"maximum context length is X tokens\"\n * - OpenRouter/Poolside: \"Input length X exceeds the maximum allowed input length of Y tokens.\"\n * - Together AI: \"The input (X tokens) is longer than the model's context length (Y tokens).\"\n * - llama.cpp: \"exceeds the available context size\"\n * - LM Studio: \"greater than the context length\"\n * - Kimi For Coding: \"exceeded model token limit: X (requested: Y)\"\n * - DS4: \"Prompt has X tokens, but the configured context size is Y tokens\"\n * - DashScope/Qwen: \"Range of input length should be [1, X]\"\n *\n * **Unreliable detection:**\n * - z.ai: Sometimes accepts overflow silently (detectable via usage.input > contextWindow),\n * sometimes returns rate limit errors. Pass contextWindow param to detect silent overflow.\n * - Xiaomi MiMo: Truncates input to fit contextWindow then returns stopReason \"length\" with\n * output=0. Pass contextWindow param to detect via the \"filled context + zero output\" signal.\n * - Ollama: May truncate input silently for some setups, but may also return explicit\n * overflow errors that match the patterns above. Silent truncation still cannot be\n * detected here because we do not know the expected token count.\n *\n * ## Custom Providers\n *\n * If you've added custom models via settings.json, this function may not detect\n * overflow errors from those providers. To add support:\n *\n * 1. Send a request that exceeds the model's context window\n * 2. Check the errorMessage in the response\n * 3. Create a regex pattern that matches the error\n * 4. The pattern should be added to OVERFLOW_PATTERNS in this file, or\n * check the errorMessage yourself before calling this function\n *\n * @param message - The assistant message to check\n * @param contextWindow - Optional context window size for detecting silent overflow (z.ai)\n * @returns true if the message indicates a context overflow\n */\nexport function isContextOverflow(message: AssistantMessage, contextWindow?: number): boolean {\n\t// Case 1: Check error message patterns\n\tif (message.stopReason === \"error\" && message.errorMessage) {\n\t\t// Skip messages matching known non-overflow patterns (e.g. throttling / rate-limit)\n\t\tconst isNonOverflow = NON_OVERFLOW_PATTERNS.some((p) => p.test(message.errorMessage!));\n\t\tif (!isNonOverflow && OVERFLOW_PATTERNS.some((p) => p.test(message.errorMessage!))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Case 2: Silent overflow (z.ai style) - successful but usage exceeds context\n\tif (contextWindow && message.stopReason === \"stop\") {\n\t\tconst inputTokens = message.usage.input + message.usage.cacheRead;\n\t\tif (inputTokens > contextWindow) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Case 3: Length-stop overflow (Xiaomi MiMo style) - server truncates oversized input\n\t// to fit the context window, leaving no room for output. Returns stopReason \"length\"\n\t// with output=0 and input+cacheRead filling the context window.\n\tif (contextWindow && message.stopReason === \"length\" && message.usage.output === 0) {\n\t\tconst inputTokens = message.usage.input + message.usage.cacheRead;\n\t\tif (inputTokens >= contextWindow * 0.99) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"]}
@@ -0,0 +1,16 @@
1
+ interface ProviderRetryOptions {
2
+ maxRetries?: number;
3
+ maxRetryDelayMs?: number;
4
+ signal?: AbortSignal;
5
+ }
6
+ /**
7
+ * Reproduce the retry behavior used by the OpenAI and Anthropic SDKs while making
8
+ * their backoff sleep interruptible. Their built-in retry timers ignore the
9
+ * request AbortSignal, so callers must invoke the SDK with `maxRetries: 0` and
10
+ * wrap the request with this helper. Provider-requested delays above
11
+ * `maxRetryDelayMs` fail immediately (60 seconds by default); set it to zero to
12
+ * disable the limit.
13
+ */
14
+ export declare function retryProviderRequest<T>(request: () => Promise<T>, options?: ProviderRetryOptions): Promise<T>;
15
+ export {};
16
+ //# sourceMappingURL=provider-retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-retry.d.ts","sourceRoot":"","sources":["../../src/utils/provider-retry.ts"],"names":[],"mappings":"AAEA,UAAU,oBAAoB;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AA0FD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC3C,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,OAAO,GAAE,oBAAyB,GAChC,OAAO,CAAC,CAAC,CAAC,CAiBZ"}