@code-yeongyu/senpi 2026.6.21 → 2026.6.30

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 (1048) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/README.md +41 -5
  3. package/dist/bun/register-bedrock.js +1 -1
  4. package/dist/bun/register-bedrock.js.map +1 -1
  5. package/dist/cli/args.js +1 -1
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/file-processor.d.ts.map +1 -1
  8. package/dist/cli/file-processor.js +13 -25
  9. package/dist/cli/file-processor.js.map +1 -1
  10. package/dist/cli/session-picker.d.ts +2 -1
  11. package/dist/cli/session-picker.d.ts.map +1 -1
  12. package/dist/cli/session-picker.js +5 -4
  13. package/dist/cli/session-picker.js.map +1 -1
  14. package/dist/cli/startup-ui.d.ts +4 -1
  15. package/dist/cli/startup-ui.d.ts.map +1 -1
  16. package/dist/cli/startup-ui.js +63 -14
  17. package/dist/cli/startup-ui.js.map +1 -1
  18. package/dist/core/agent-session.d.ts +4 -3
  19. package/dist/core/agent-session.d.ts.map +1 -1
  20. package/dist/core/agent-session.js +34 -26
  21. package/dist/core/agent-session.js.map +1 -1
  22. package/dist/core/auth-storage.d.ts +6 -12
  23. package/dist/core/auth-storage.d.ts.map +1 -1
  24. package/dist/core/auth-storage.js +4 -19
  25. package/dist/core/auth-storage.js.map +1 -1
  26. package/dist/core/compaction/branch-summarization.d.ts +1 -1
  27. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  28. package/dist/core/compaction/branch-summarization.js +1 -1
  29. package/dist/core/compaction/branch-summarization.js.map +1 -1
  30. package/dist/core/compaction/compaction.d.ts +2 -2
  31. package/dist/core/compaction/compaction.d.ts.map +1 -1
  32. package/dist/core/compaction/compaction.js +7 -4
  33. package/dist/core/compaction/compaction.js.map +1 -1
  34. package/dist/core/dynamic-prompt/style.d.ts.map +1 -1
  35. package/dist/core/dynamic-prompt/style.js +26 -1
  36. package/dist/core/dynamic-prompt/style.js.map +1 -1
  37. package/dist/core/experimental.d.ts +2 -0
  38. package/dist/core/experimental.d.ts.map +1 -0
  39. package/dist/core/experimental.js +4 -0
  40. package/dist/core/experimental.js.map +1 -0
  41. package/dist/core/extensions/builtin/compaction/openai-remote.d.ts +1 -1
  42. package/dist/core/extensions/builtin/compaction/openai-remote.d.ts.map +1 -1
  43. package/dist/core/extensions/builtin/compaction/openai-remote.js +1 -1
  44. package/dist/core/extensions/builtin/compaction/openai-remote.js.map +1 -1
  45. package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
  46. package/dist/core/extensions/builtin/compaction/speculative.js +2 -1
  47. package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
  48. package/dist/core/extensions/builtin/goal/command-registration.d.ts +12 -0
  49. package/dist/core/extensions/builtin/goal/command-registration.d.ts.map +1 -0
  50. package/dist/core/extensions/builtin/goal/command-registration.js +86 -0
  51. package/dist/core/extensions/builtin/goal/command-registration.js.map +1 -0
  52. package/dist/core/extensions/builtin/goal/continuation.d.ts +2 -1
  53. package/dist/core/extensions/builtin/goal/continuation.d.ts.map +1 -1
  54. package/dist/core/extensions/builtin/goal/continuation.js +33 -2
  55. package/dist/core/extensions/builtin/goal/continuation.js.map +1 -1
  56. package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
  57. package/dist/core/extensions/builtin/goal/index.js +19 -136
  58. package/dist/core/extensions/builtin/goal/index.js.map +1 -1
  59. package/dist/core/extensions/builtin/goal/tool-registration.d.ts +10 -0
  60. package/dist/core/extensions/builtin/goal/tool-registration.d.ts.map +1 -0
  61. package/dist/core/extensions/builtin/goal/tool-registration.js +63 -0
  62. package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -0
  63. package/dist/core/extensions/builtin/hooks/command-runner.d.ts +25 -0
  64. package/dist/core/extensions/builtin/hooks/command-runner.d.ts.map +1 -0
  65. package/dist/core/extensions/builtin/hooks/command-runner.js +152 -0
  66. package/dist/core/extensions/builtin/hooks/command-runner.js.map +1 -0
  67. package/dist/core/extensions/builtin/hooks/command.d.ts +11 -0
  68. package/dist/core/extensions/builtin/hooks/command.d.ts.map +1 -0
  69. package/dist/core/extensions/builtin/hooks/command.js +180 -0
  70. package/dist/core/extensions/builtin/hooks/command.js.map +1 -0
  71. package/dist/core/extensions/builtin/hooks/config-loader.d.ts +19 -0
  72. package/dist/core/extensions/builtin/hooks/config-loader.d.ts.map +1 -0
  73. package/dist/core/extensions/builtin/hooks/config-loader.js +125 -0
  74. package/dist/core/extensions/builtin/hooks/config-loader.js.map +1 -0
  75. package/dist/core/extensions/builtin/hooks/diagnostics.d.ts +10 -0
  76. package/dist/core/extensions/builtin/hooks/diagnostics.d.ts.map +1 -0
  77. package/dist/core/extensions/builtin/hooks/diagnostics.js +14 -0
  78. package/dist/core/extensions/builtin/hooks/diagnostics.js.map +1 -0
  79. package/dist/core/extensions/builtin/hooks/dispatcher.d.ts +60 -0
  80. package/dist/core/extensions/builtin/hooks/dispatcher.d.ts.map +1 -0
  81. package/dist/core/extensions/builtin/hooks/dispatcher.js +161 -0
  82. package/dist/core/extensions/builtin/hooks/dispatcher.js.map +1 -0
  83. package/dist/core/extensions/builtin/hooks/handler.d.ts +12 -0
  84. package/dist/core/extensions/builtin/hooks/handler.d.ts.map +1 -0
  85. package/dist/core/extensions/builtin/hooks/handler.js +128 -0
  86. package/dist/core/extensions/builtin/hooks/handler.js.map +1 -0
  87. package/dist/core/extensions/builtin/hooks/index.d.ts +6 -0
  88. package/dist/core/extensions/builtin/hooks/index.d.ts.map +1 -0
  89. package/dist/core/extensions/builtin/hooks/index.js +216 -0
  90. package/dist/core/extensions/builtin/hooks/index.js.map +1 -0
  91. package/dist/core/extensions/builtin/hooks/lifecycle-adapter.d.ts +29 -0
  92. package/dist/core/extensions/builtin/hooks/lifecycle-adapter.d.ts.map +1 -0
  93. package/dist/core/extensions/builtin/hooks/lifecycle-adapter.js +276 -0
  94. package/dist/core/extensions/builtin/hooks/lifecycle-adapter.js.map +1 -0
  95. package/dist/core/extensions/builtin/hooks/matcher.d.ts +7 -0
  96. package/dist/core/extensions/builtin/hooks/matcher.d.ts.map +1 -0
  97. package/dist/core/extensions/builtin/hooks/matcher.js +109 -0
  98. package/dist/core/extensions/builtin/hooks/matcher.js.map +1 -0
  99. package/dist/core/extensions/builtin/hooks/output-bounds.d.ts +29 -0
  100. package/dist/core/extensions/builtin/hooks/output-bounds.d.ts.map +1 -0
  101. package/dist/core/extensions/builtin/hooks/output-bounds.js +47 -0
  102. package/dist/core/extensions/builtin/hooks/output-bounds.js.map +1 -0
  103. package/dist/core/extensions/builtin/hooks/output-parser.d.ts +27 -0
  104. package/dist/core/extensions/builtin/hooks/output-parser.d.ts.map +1 -0
  105. package/dist/core/extensions/builtin/hooks/output-parser.js +168 -0
  106. package/dist/core/extensions/builtin/hooks/output-parser.js.map +1 -0
  107. package/dist/core/extensions/builtin/hooks/plugin-loader.d.ts +11 -0
  108. package/dist/core/extensions/builtin/hooks/plugin-loader.d.ts.map +1 -0
  109. package/dist/core/extensions/builtin/hooks/plugin-loader.js +138 -0
  110. package/dist/core/extensions/builtin/hooks/plugin-loader.js.map +1 -0
  111. package/dist/core/extensions/builtin/hooks/plugin-manifest.d.ts +47 -0
  112. package/dist/core/extensions/builtin/hooks/plugin-manifest.d.ts.map +1 -0
  113. package/dist/core/extensions/builtin/hooks/plugin-manifest.js +86 -0
  114. package/dist/core/extensions/builtin/hooks/plugin-manifest.js.map +1 -0
  115. package/dist/core/extensions/builtin/hooks/prompt-adapter.d.ts +30 -0
  116. package/dist/core/extensions/builtin/hooks/prompt-adapter.d.ts.map +1 -0
  117. package/dist/core/extensions/builtin/hooks/prompt-adapter.js +59 -0
  118. package/dist/core/extensions/builtin/hooks/prompt-adapter.js.map +1 -0
  119. package/dist/core/extensions/builtin/hooks/safety.d.ts +14 -0
  120. package/dist/core/extensions/builtin/hooks/safety.d.ts.map +1 -0
  121. package/dist/core/extensions/builtin/hooks/safety.js +179 -0
  122. package/dist/core/extensions/builtin/hooks/safety.js.map +1 -0
  123. package/dist/core/extensions/builtin/hooks/schema.d.ts +3 -0
  124. package/dist/core/extensions/builtin/hooks/schema.d.ts.map +1 -0
  125. package/dist/core/extensions/builtin/hooks/schema.js +94 -0
  126. package/dist/core/extensions/builtin/hooks/schema.js.map +1 -0
  127. package/dist/core/extensions/builtin/hooks/stop-adapter.d.ts +18 -0
  128. package/dist/core/extensions/builtin/hooks/stop-adapter.d.ts.map +1 -0
  129. package/dist/core/extensions/builtin/hooks/stop-adapter.js +282 -0
  130. package/dist/core/extensions/builtin/hooks/stop-adapter.js.map +1 -0
  131. package/dist/core/extensions/builtin/hooks/tool-adapter.d.ts +11 -0
  132. package/dist/core/extensions/builtin/hooks/tool-adapter.d.ts.map +1 -0
  133. package/dist/core/extensions/builtin/hooks/tool-adapter.js +158 -0
  134. package/dist/core/extensions/builtin/hooks/tool-adapter.js.map +1 -0
  135. package/dist/core/extensions/builtin/hooks/trust-storage.d.ts +24 -0
  136. package/dist/core/extensions/builtin/hooks/trust-storage.d.ts.map +1 -0
  137. package/dist/core/extensions/builtin/hooks/trust-storage.js +102 -0
  138. package/dist/core/extensions/builtin/hooks/trust-storage.js.map +1 -0
  139. package/dist/core/extensions/builtin/hooks/trust.d.ts +34 -0
  140. package/dist/core/extensions/builtin/hooks/trust.d.ts.map +1 -0
  141. package/dist/core/extensions/builtin/hooks/trust.js +194 -0
  142. package/dist/core/extensions/builtin/hooks/trust.js.map +1 -0
  143. package/dist/core/extensions/builtin/hooks/types.d.ts +134 -0
  144. package/dist/core/extensions/builtin/hooks/types.d.ts.map +1 -0
  145. package/dist/core/extensions/builtin/hooks/types.js +36 -0
  146. package/dist/core/extensions/builtin/hooks/types.js.map +1 -0
  147. package/dist/core/extensions/builtin/index.d.ts.map +1 -1
  148. package/dist/core/extensions/builtin/index.js +4 -0
  149. package/dist/core/extensions/builtin/index.js.map +1 -1
  150. package/dist/core/extensions/builtin/permission-system/cli.d.ts +3 -1
  151. package/dist/core/extensions/builtin/permission-system/cli.d.ts.map +1 -1
  152. package/dist/core/extensions/builtin/permission-system/cli.js +14 -0
  153. package/dist/core/extensions/builtin/permission-system/cli.js.map +1 -1
  154. package/dist/core/extensions/builtin/permission-system/config.d.ts +3 -1
  155. package/dist/core/extensions/builtin/permission-system/config.d.ts.map +1 -1
  156. package/dist/core/extensions/builtin/permission-system/config.js +26 -0
  157. package/dist/core/extensions/builtin/permission-system/config.js.map +1 -1
  158. package/dist/core/extensions/builtin/permission-system/external-dir.js +2 -2
  159. package/dist/core/extensions/builtin/permission-system/external-dir.js.map +1 -1
  160. package/dist/core/extensions/builtin/permission-system/index.d.ts.map +1 -1
  161. package/dist/core/extensions/builtin/permission-system/index.js +11 -2
  162. package/dist/core/extensions/builtin/permission-system/index.js.map +1 -1
  163. package/dist/core/extensions/builtin/permission-system/parsers.d.ts.map +1 -1
  164. package/dist/core/extensions/builtin/permission-system/parsers.js +39 -16
  165. package/dist/core/extensions/builtin/permission-system/parsers.js.map +1 -1
  166. package/dist/core/extensions/builtin/permission-system/settings.d.ts +6 -5
  167. package/dist/core/extensions/builtin/permission-system/settings.d.ts.map +1 -1
  168. package/dist/core/extensions/builtin/permission-system/settings.js +26 -6
  169. package/dist/core/extensions/builtin/permission-system/settings.js.map +1 -1
  170. package/dist/core/extensions/builtin/permission-system/types.d.ts +1 -0
  171. package/dist/core/extensions/builtin/permission-system/types.d.ts.map +1 -1
  172. package/dist/core/extensions/builtin/permission-system/types.js.map +1 -1
  173. package/dist/core/extensions/builtin/pi-codex-app-server/capability-negotiator.d.ts +42 -0
  174. package/dist/core/extensions/builtin/pi-codex-app-server/capability-negotiator.d.ts.map +1 -0
  175. package/dist/core/extensions/builtin/pi-codex-app-server/capability-negotiator.js +130 -0
  176. package/dist/core/extensions/builtin/pi-codex-app-server/capability-negotiator.js.map +1 -0
  177. package/dist/core/extensions/builtin/pi-codex-app-server/error-mapper.d.ts +27 -0
  178. package/dist/core/extensions/builtin/pi-codex-app-server/error-mapper.d.ts.map +1 -0
  179. package/dist/core/extensions/builtin/pi-codex-app-server/error-mapper.js +18 -0
  180. package/dist/core/extensions/builtin/pi-codex-app-server/error-mapper.js.map +1 -0
  181. package/dist/core/extensions/builtin/pi-codex-app-server/extension.d.ts +25 -0
  182. package/dist/core/extensions/builtin/pi-codex-app-server/extension.d.ts.map +1 -0
  183. package/dist/core/extensions/builtin/pi-codex-app-server/extension.js +110 -0
  184. package/dist/core/extensions/builtin/pi-codex-app-server/extension.js.map +1 -0
  185. package/dist/core/extensions/builtin/pi-codex-app-server/id-mapper.d.ts +48 -0
  186. package/dist/core/extensions/builtin/pi-codex-app-server/id-mapper.d.ts.map +1 -0
  187. package/dist/core/extensions/builtin/pi-codex-app-server/id-mapper.js +74 -0
  188. package/dist/core/extensions/builtin/pi-codex-app-server/id-mapper.js.map +1 -0
  189. package/dist/core/extensions/builtin/pi-codex-app-server/index.d.ts +3 -0
  190. package/dist/core/extensions/builtin/pi-codex-app-server/index.d.ts.map +1 -0
  191. package/dist/core/extensions/builtin/pi-codex-app-server/index.js +5 -0
  192. package/dist/core/extensions/builtin/pi-codex-app-server/index.js.map +1 -0
  193. package/dist/core/extensions/builtin/pi-codex-app-server/item-stream-projector.d.ts +29 -0
  194. package/dist/core/extensions/builtin/pi-codex-app-server/item-stream-projector.d.ts.map +1 -0
  195. package/dist/core/extensions/builtin/pi-codex-app-server/item-stream-projector.js +105 -0
  196. package/dist/core/extensions/builtin/pi-codex-app-server/item-stream-projector.js.map +1 -0
  197. package/dist/core/extensions/builtin/pi-codex-app-server/notification-projector.d.ts +49 -0
  198. package/dist/core/extensions/builtin/pi-codex-app-server/notification-projector.d.ts.map +1 -0
  199. package/dist/core/extensions/builtin/pi-codex-app-server/notification-projector.js +99 -0
  200. package/dist/core/extensions/builtin/pi-codex-app-server/notification-projector.js.map +1 -0
  201. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-core.d.ts +42 -0
  202. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-core.d.ts.map +1 -0
  203. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-core.js +191 -0
  204. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-core.js.map +1 -0
  205. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-inventory.d.ts +3 -0
  206. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-inventory.d.ts.map +1 -0
  207. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-inventory.js +103 -0
  208. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-inventory.js.map +1 -0
  209. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-required-surfaces.d.ts +7 -0
  210. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-required-surfaces.d.ts.map +1 -0
  211. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-required-surfaces.js +234 -0
  212. package/dist/core/extensions/builtin/pi-codex-app-server/protocol-required-surfaces.js.map +1 -0
  213. package/dist/core/extensions/builtin/pi-codex-app-server/reconnect-resume-token.d.ts +18 -0
  214. package/dist/core/extensions/builtin/pi-codex-app-server/reconnect-resume-token.d.ts.map +1 -0
  215. package/dist/core/extensions/builtin/pi-codex-app-server/reconnect-resume-token.js +77 -0
  216. package/dist/core/extensions/builtin/pi-codex-app-server/reconnect-resume-token.js.map +1 -0
  217. package/dist/core/extensions/builtin/pi-codex-app-server/reconnect-resume.d.ts +70 -0
  218. package/dist/core/extensions/builtin/pi-codex-app-server/reconnect-resume.d.ts.map +1 -0
  219. package/dist/core/extensions/builtin/pi-codex-app-server/reconnect-resume.js +138 -0
  220. package/dist/core/extensions/builtin/pi-codex-app-server/reconnect-resume.js.map +1 -0
  221. package/dist/core/extensions/builtin/pi-codex-app-server/request-router-params.d.ts +34 -0
  222. package/dist/core/extensions/builtin/pi-codex-app-server/request-router-params.d.ts.map +1 -0
  223. package/dist/core/extensions/builtin/pi-codex-app-server/request-router-params.js +92 -0
  224. package/dist/core/extensions/builtin/pi-codex-app-server/request-router-params.js.map +1 -0
  225. package/dist/core/extensions/builtin/pi-codex-app-server/request-router.d.ts +32 -0
  226. package/dist/core/extensions/builtin/pi-codex-app-server/request-router.d.ts.map +1 -0
  227. package/dist/core/extensions/builtin/pi-codex-app-server/request-router.js +279 -0
  228. package/dist/core/extensions/builtin/pi-codex-app-server/request-router.js.map +1 -0
  229. package/dist/core/extensions/builtin/pi-codex-app-server/runtime-errors.d.ts +6 -0
  230. package/dist/core/extensions/builtin/pi-codex-app-server/runtime-errors.d.ts.map +1 -0
  231. package/dist/core/extensions/builtin/pi-codex-app-server/runtime-errors.js +8 -0
  232. package/dist/core/extensions/builtin/pi-codex-app-server/runtime-errors.js.map +1 -0
  233. package/dist/core/extensions/builtin/pi-codex-app-server/server-request-bridge.d.ts +76 -0
  234. package/dist/core/extensions/builtin/pi-codex-app-server/server-request-bridge.d.ts.map +1 -0
  235. package/dist/core/extensions/builtin/pi-codex-app-server/server-request-bridge.js +169 -0
  236. package/dist/core/extensions/builtin/pi-codex-app-server/server-request-bridge.js.map +1 -0
  237. package/dist/core/extensions/builtin/pi-codex-app-server/server-request-fields.d.ts +24 -0
  238. package/dist/core/extensions/builtin/pi-codex-app-server/server-request-fields.d.ts.map +1 -0
  239. package/dist/core/extensions/builtin/pi-codex-app-server/server-request-fields.js +81 -0
  240. package/dist/core/extensions/builtin/pi-codex-app-server/server-request-fields.js.map +1 -0
  241. package/dist/core/extensions/builtin/pi-codex-app-server/session-registry.d.ts +42 -0
  242. package/dist/core/extensions/builtin/pi-codex-app-server/session-registry.d.ts.map +1 -0
  243. package/dist/core/extensions/builtin/pi-codex-app-server/session-registry.js +89 -0
  244. package/dist/core/extensions/builtin/pi-codex-app-server/session-registry.js.map +1 -0
  245. package/dist/core/extensions/builtin/pi-codex-app-server/stream-backpressure.d.ts +36 -0
  246. package/dist/core/extensions/builtin/pi-codex-app-server/stream-backpressure.d.ts.map +1 -0
  247. package/dist/core/extensions/builtin/pi-codex-app-server/stream-backpressure.js +94 -0
  248. package/dist/core/extensions/builtin/pi-codex-app-server/stream-backpressure.js.map +1 -0
  249. package/dist/core/extensions/builtin/pi-codex-app-server/transport-runtime.d.ts +34 -0
  250. package/dist/core/extensions/builtin/pi-codex-app-server/transport-runtime.d.ts.map +1 -0
  251. package/dist/core/extensions/builtin/pi-codex-app-server/transport-runtime.js +179 -0
  252. package/dist/core/extensions/builtin/pi-codex-app-server/transport-runtime.js.map +1 -0
  253. package/dist/core/extensions/builtin/pi-codex-app-server/websocket-transport.d.ts +20 -0
  254. package/dist/core/extensions/builtin/pi-codex-app-server/websocket-transport.d.ts.map +1 -0
  255. package/dist/core/extensions/builtin/pi-codex-app-server/websocket-transport.js +90 -0
  256. package/dist/core/extensions/builtin/pi-codex-app-server/websocket-transport.js.map +1 -0
  257. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.d.ts +3 -0
  258. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.d.ts.map +1 -0
  259. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js +12 -0
  260. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js.map +1 -0
  261. package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
  262. package/dist/core/extensions/builtin/prompt-preset/presets.js +6 -0
  263. package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
  264. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
  265. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
  266. package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
  267. package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
  268. package/dist/core/extensions/builtin/webfetch/webfetch/content.d.ts +2 -2
  269. package/dist/core/extensions/builtin/webfetch/webfetch/content.d.ts.map +1 -1
  270. package/dist/core/extensions/builtin/webfetch/webfetch/content.js +170 -7
  271. package/dist/core/extensions/builtin/webfetch/webfetch/content.js.map +1 -1
  272. package/dist/core/extensions/builtin/webfetch/webfetch/fetcher.d.ts.map +1 -1
  273. package/dist/core/extensions/builtin/webfetch/webfetch/fetcher.js +101 -43
  274. package/dist/core/extensions/builtin/webfetch/webfetch/fetcher.js.map +1 -1
  275. package/dist/core/extensions/builtin/webfetch/webfetch/tool.js +2 -2
  276. package/dist/core/extensions/builtin/webfetch/webfetch/tool.js.map +1 -1
  277. package/dist/core/extensions/loader.d.ts.map +1 -1
  278. package/dist/core/extensions/loader.js +25 -14
  279. package/dist/core/extensions/loader.js.map +1 -1
  280. package/dist/core/extensions/runner.d.ts +5 -0
  281. package/dist/core/extensions/runner.d.ts.map +1 -1
  282. package/dist/core/extensions/runner.js +20 -1
  283. package/dist/core/extensions/runner.js.map +1 -1
  284. package/dist/core/extensions/types.d.ts +19 -0
  285. package/dist/core/extensions/types.d.ts.map +1 -1
  286. package/dist/core/extensions/types.js.map +1 -1
  287. package/dist/core/keybindings.d.ts +1 -1
  288. package/dist/core/model-registry.d.ts +1 -1
  289. package/dist/core/model-registry.d.ts.map +1 -1
  290. package/dist/core/model-registry.js +4 -6
  291. package/dist/core/model-registry.js.map +1 -1
  292. package/dist/core/model-resolver.js +1 -1
  293. package/dist/core/model-resolver.js.map +1 -1
  294. package/dist/core/package-manager.d.ts +1 -0
  295. package/dist/core/package-manager.d.ts.map +1 -1
  296. package/dist/core/package-manager.js +14 -1
  297. package/dist/core/package-manager.js.map +1 -1
  298. package/dist/core/provider-attribution.d.ts +2 -2
  299. package/dist/core/provider-attribution.d.ts.map +1 -1
  300. package/dist/core/provider-attribution.js.map +1 -1
  301. package/dist/core/provider-display-names.js +1 -1
  302. package/dist/core/provider-display-names.js.map +1 -1
  303. package/dist/core/resource-loader.d.ts +14 -1
  304. package/dist/core/resource-loader.d.ts.map +1 -1
  305. package/dist/core/resource-loader.js +40 -0
  306. package/dist/core/resource-loader.js.map +1 -1
  307. package/dist/core/sdk.d.ts +1 -1
  308. package/dist/core/sdk.d.ts.map +1 -1
  309. package/dist/core/sdk.js +20 -14
  310. package/dist/core/sdk.js.map +1 -1
  311. package/dist/core/session-manager.d.ts +5 -1
  312. package/dist/core/session-manager.d.ts.map +1 -1
  313. package/dist/core/session-manager.js +75 -14
  314. package/dist/core/session-manager.js.map +1 -1
  315. package/dist/core/session-resident-store.d.ts.map +1 -1
  316. package/dist/core/session-resident-store.js +63 -2
  317. package/dist/core/session-resident-store.js.map +1 -1
  318. package/dist/core/settings-manager.d.ts +5 -1
  319. package/dist/core/settings-manager.d.ts.map +1 -1
  320. package/dist/core/settings-manager.js +14 -6
  321. package/dist/core/settings-manager.js.map +1 -1
  322. package/dist/core/timings.d.ts +4 -2
  323. package/dist/core/timings.d.ts.map +1 -1
  324. package/dist/core/timings.js +24 -14
  325. package/dist/core/timings.js.map +1 -1
  326. package/dist/core/tools/find.d.ts.map +1 -1
  327. package/dist/core/tools/find.js +19 -11
  328. package/dist/core/tools/find.js.map +1 -1
  329. package/dist/core/tools/read.d.ts.map +1 -1
  330. package/dist/core/tools/read.js +12 -25
  331. package/dist/core/tools/read.js.map +1 -1
  332. package/dist/main.d.ts.map +1 -1
  333. package/dist/main.js +22 -7
  334. package/dist/main.js.map +1 -1
  335. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  336. package/dist/modes/interactive/components/assistant-message.js +13 -11
  337. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  338. package/dist/modes/interactive/components/extension-editor.d.ts +3 -1
  339. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  340. package/dist/modes/interactive/components/extension-editor.js +11 -3
  341. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  342. package/dist/modes/interactive/components/render-signature.d.ts +2 -0
  343. package/dist/modes/interactive/components/render-signature.d.ts.map +1 -0
  344. package/dist/modes/interactive/components/render-signature.js +101 -0
  345. package/dist/modes/interactive/components/render-signature.js.map +1 -0
  346. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  347. package/dist/modes/interactive/components/session-selector.js +14 -3
  348. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  349. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  350. package/dist/modes/interactive/components/tool-execution.js +4 -1
  351. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  352. package/dist/modes/interactive/components/user-message.js +1 -1
  353. package/dist/modes/interactive/components/user-message.js.map +1 -1
  354. package/dist/modes/interactive/interactive-mode.d.ts +2 -1
  355. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  356. package/dist/modes/interactive/interactive-mode.js +64 -48
  357. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  358. package/dist/modes/interactive/theme/theme-controller.d.ts +0 -1
  359. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  360. package/dist/modes/interactive/theme/theme-controller.js +2 -13
  361. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  362. package/dist/modes/interactive/theme/theme.d.ts +10 -0
  363. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  364. package/dist/modes/interactive/theme/theme.js +11 -0
  365. package/dist/modes/interactive/theme/theme.js.map +1 -1
  366. package/dist/rpc-entry.d.ts +3 -0
  367. package/dist/rpc-entry.d.ts.map +1 -0
  368. package/dist/rpc-entry.js +10 -0
  369. package/dist/rpc-entry.js.map +1 -0
  370. package/dist/utils/child-process.js +1 -1
  371. package/dist/utils/child-process.js.map +1 -1
  372. package/dist/utils/image-convert.d.ts +1 -0
  373. package/dist/utils/image-convert.d.ts.map +1 -1
  374. package/dist/utils/image-convert.js +21 -15
  375. package/dist/utils/image-convert.js.map +1 -1
  376. package/dist/utils/image-process.d.ts +18 -0
  377. package/dist/utils/image-process.d.ts.map +1 -0
  378. package/dist/utils/image-process.js +83 -0
  379. package/dist/utils/image-process.js.map +1 -0
  380. package/dist/utils/mime.d.ts.map +1 -1
  381. package/dist/utils/mime.js +41 -0
  382. package/dist/utils/mime.js.map +1 -1
  383. package/dist/utils/version-check.d.ts +1 -0
  384. package/dist/utils/version-check.d.ts.map +1 -1
  385. package/dist/utils/version-check.js +7 -0
  386. package/dist/utils/version-check.js.map +1 -1
  387. package/docs/compaction.md +3 -1
  388. package/docs/extensions.md +456 -1
  389. package/docs/index.md +1 -1
  390. package/docs/keybindings.md +2 -2
  391. package/docs/models.md +4 -2
  392. package/docs/packages.md +9 -6
  393. package/docs/providers.md +3 -2
  394. package/docs/security.md +4 -0
  395. package/docs/settings.md +63 -0
  396. package/docs/terminal-setup.md +1 -7
  397. package/docs/tui.md +3 -3
  398. package/docs/usage.md +6 -4
  399. package/examples/extensions/README.md +1 -0
  400. package/examples/extensions/custom-compaction.ts +5 -4
  401. package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
  402. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  403. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  404. package/examples/extensions/custom-provider-gitlab-duo/index.ts +11 -7
  405. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  406. package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
  407. package/examples/extensions/gondolin/package-lock.json +5 -5
  408. package/examples/extensions/gondolin/package.json +1 -1
  409. package/examples/extensions/handoff.ts +4 -4
  410. package/examples/extensions/plan-mode/README.md +3 -2
  411. package/examples/extensions/plan-mode/index.ts +87 -37
  412. package/examples/extensions/qna.ts +4 -4
  413. package/examples/extensions/sandbox/package-lock.json +2 -2
  414. package/examples/extensions/sandbox/package.json +1 -1
  415. package/examples/extensions/summarize.ts +4 -3
  416. package/examples/extensions/with-deps/package-lock.json +2 -2
  417. package/examples/extensions/with-deps/package.json +1 -1
  418. package/examples/sdk/02-custom-model.ts +2 -2
  419. package/examples/sdk/12-full-control.ts +2 -2
  420. package/node_modules/@earendil-works/pi-agent-core/README.md +0 -18
  421. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +1 -1
  422. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  423. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +2 -1
  424. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  425. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +1 -1
  426. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  427. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +1 -1
  428. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  429. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +2 -2
  430. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  431. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +6 -19
  432. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  433. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +3 -5
  434. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  435. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +2 -3
  436. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
  437. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +4 -4
  438. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
  439. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +17 -15
  440. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
  441. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +1 -1
  442. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -1
  443. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -1
  444. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +1 -1
  445. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
  446. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
  447. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +1 -1
  448. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
  449. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +2 -1
  450. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
  451. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +24 -22
  452. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
  453. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
  454. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +2 -2
  455. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -1
  456. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +1 -1
  457. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -1
  458. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +19 -2
  459. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  460. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +24 -4
  461. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  462. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +1 -1
  463. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
  464. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +1 -1
  465. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  466. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +4 -3
  467. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  468. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  469. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  470. package/node_modules/@earendil-works/pi-ai/README.md +651 -526
  471. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +71 -0
  472. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -0
  473. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +1277 -0
  474. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -0
  475. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.d.ts +3 -0
  476. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.d.ts.map +1 -0
  477. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.js +3 -0
  478. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.js.map +1 -0
  479. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +15 -0
  480. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -0
  481. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +231 -0
  482. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -0
  483. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.d.ts +3 -0
  484. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.d.ts.map +1 -0
  485. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.js +3 -0
  486. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.js.map +1 -0
  487. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts +38 -0
  488. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -0
  489. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +895 -0
  490. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -0
  491. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +9 -0
  492. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts.map +1 -0
  493. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js +30 -0
  494. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js.map +1 -0
  495. package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/cloudflare.d.ts +0 -1
  496. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.d.ts.map +1 -0
  497. package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/cloudflare.js +7 -12
  498. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.js.map +1 -0
  499. package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-headers.d.ts.map +1 -0
  500. package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-headers.js.map +1 -0
  501. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts +13 -0
  502. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -0
  503. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +436 -0
  504. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -0
  505. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.d.ts +3 -0
  506. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.d.ts.map +1 -0
  507. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.js +3 -0
  508. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.js.map +1 -0
  509. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts +69 -0
  510. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -0
  511. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +346 -0
  512. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -0
  513. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts +15 -0
  514. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -0
  515. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +478 -0
  516. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -0
  517. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.d.ts +3 -0
  518. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.d.ts.map +1 -0
  519. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.js +3 -0
  520. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.js.map +1 -0
  521. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +15 -0
  522. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts.map +1 -0
  523. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +59 -0
  524. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js.map +1 -0
  525. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts +25 -0
  526. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -0
  527. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +562 -0
  528. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -0
  529. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.d.ts +3 -0
  530. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.d.ts.map +1 -0
  531. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js +3 -0
  532. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js.map +1 -0
  533. package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/openai-codex-responses.d.ts +2 -3
  534. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -0
  535. package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/openai-codex-responses.js +54 -43
  536. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -0
  537. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.d.ts +3 -0
  538. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.d.ts.map +1 -0
  539. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js +3 -0
  540. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js.map +1 -0
  541. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +22 -0
  542. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -0
  543. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +1094 -0
  544. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -0
  545. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.d.ts +3 -0
  546. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.d.ts.map +1 -0
  547. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.js +3 -0
  548. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.js.map +1 -0
  549. package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.d.ts.map +1 -0
  550. package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.js.map +1 -0
  551. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts +20 -0
  552. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -0
  553. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +568 -0
  554. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -0
  555. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +13 -0
  556. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -0
  557. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +657 -0
  558. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -0
  559. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.d.ts +3 -0
  560. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.d.ts.map +1 -0
  561. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.js +3 -0
  562. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.js.map +1 -0
  563. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.d.ts +3 -0
  564. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.d.ts.map +1 -0
  565. package/node_modules/@earendil-works/pi-ai/dist/{providers/images/openrouter.js → api/openrouter-images.js} +5 -15
  566. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js.map +1 -0
  567. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.lazy.d.ts +3 -0
  568. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.lazy.d.ts.map +1 -0
  569. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.lazy.js +4 -0
  570. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.lazy.js.map +1 -0
  571. package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/simple-options.d.ts +3 -2
  572. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -0
  573. package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/simple-options.js +11 -2
  574. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -0
  575. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.d.ts.map +1 -0
  576. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js.map +1 -0
  577. package/node_modules/@earendil-works/pi-ai/dist/auth/context.d.ts +7 -0
  578. package/node_modules/@earendil-works/pi-ai/dist/auth/context.d.ts.map +1 -0
  579. package/node_modules/@earendil-works/pi-ai/dist/auth/context.js +42 -0
  580. package/node_modules/@earendil-works/pi-ai/dist/auth/context.js.map +1 -0
  581. package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts +16 -0
  582. package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts.map +1 -0
  583. package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js +39 -0
  584. package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js.map +1 -0
  585. package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts +20 -0
  586. package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts.map +1 -0
  587. package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js +46 -0
  588. package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js.map +1 -0
  589. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +26 -0
  590. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -0
  591. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +100 -0
  592. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -0
  593. package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +180 -0
  594. package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -0
  595. package/node_modules/@earendil-works/pi-ai/dist/auth/types.js +2 -0
  596. package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -0
  597. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts +2 -4
  598. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -1
  599. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js +3 -4
  600. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js.map +1 -1
  601. package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +65 -0
  602. package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts.map +1 -0
  603. package/node_modules/@earendil-works/pi-ai/dist/compat.js +195 -0
  604. package/node_modules/@earendil-works/pi-ai/dist/compat.js.map +1 -0
  605. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +45 -0
  606. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  607. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +45 -0
  608. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  609. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +0 -1
  610. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -1
  611. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +0 -3
  612. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -1
  613. package/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts +93 -0
  614. package/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts.map +1 -0
  615. package/node_modules/@earendil-works/pi-ai/dist/images-models.js +139 -0
  616. package/node_modules/@earendil-works/pi-ai/dist/images-models.js.map +1 -0
  617. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts +1 -0
  618. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -1
  619. package/node_modules/@earendil-works/pi-ai/dist/images.js +1 -0
  620. package/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -1
  621. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +21 -3
  622. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  623. package/node_modules/@earendil-works/pi-ai/dist/index.js +10 -5
  624. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  625. package/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.d.ts +42 -0
  626. package/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.d.ts.map +1 -0
  627. package/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.js +49 -0
  628. package/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.js.map +1 -0
  629. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +134 -25
  630. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  631. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +2343 -399
  632. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  633. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +70 -17244
  634. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  635. package/node_modules/@earendil-works/pi-ai/dist/models.js +239 -65
  636. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  637. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +21 -0
  638. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -0
  639. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +147 -0
  640. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -0
  641. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +2 -38
  642. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  643. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +35 -896
  644. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  645. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts +1735 -0
  646. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts.map +1 -0
  647. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +1692 -0
  648. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js.map +1 -0
  649. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.d.ts +3 -0
  650. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.d.ts.map +1 -0
  651. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.js +15 -0
  652. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.js.map +1 -0
  653. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts +86 -0
  654. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts.map +1 -0
  655. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js +60 -0
  656. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js.map +1 -0
  657. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +4 -69
  658. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  659. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +20 -1273
  660. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
  661. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts +424 -0
  662. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts.map +1 -0
  663. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +405 -0
  664. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js.map +1 -0
  665. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +2 -15
  666. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
  667. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +11 -234
  668. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
  669. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +804 -0
  670. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts.map +1 -0
  671. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +743 -0
  672. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js.map +1 -0
  673. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.d.ts +3 -0
  674. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.d.ts.map +1 -0
  675. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.js +15 -0
  676. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.js.map +1 -0
  677. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts +45 -0
  678. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts.map +1 -0
  679. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js +41 -0
  680. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js.map +1 -0
  681. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts +3 -0
  682. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -0
  683. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +20 -0
  684. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js.map +1 -0
  685. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts +765 -0
  686. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -0
  687. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +666 -0
  688. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js.map +1 -0
  689. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.d.ts +4 -0
  690. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.d.ts.map +1 -0
  691. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js +85 -0
  692. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js.map +1 -0
  693. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.d.ts +3 -0
  694. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.d.ts.map +1 -0
  695. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js +14 -0
  696. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js.map +1 -0
  697. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts +302 -0
  698. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts.map +1 -0
  699. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js +239 -0
  700. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js.map +1 -0
  701. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.d.ts +3 -0
  702. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.d.ts.map +1 -0
  703. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.js +15 -0
  704. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.js.map +1 -0
  705. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts +63 -0
  706. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts.map +1 -0
  707. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +43 -0
  708. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js.map +1 -0
  709. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +60 -11
  710. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  711. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +86 -22
  712. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  713. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.d.ts +3 -0
  714. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.d.ts.map +1 -0
  715. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.js +19 -0
  716. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.js.map +1 -0
  717. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts +376 -0
  718. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts.map +1 -0
  719. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +294 -0
  720. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js.map +1 -0
  721. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.d.ts +3 -0
  722. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.d.ts.map +1 -0
  723. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js +25 -0
  724. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js.map +1 -0
  725. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +616 -0
  726. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts.map +1 -0
  727. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +426 -0
  728. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js.map +1 -0
  729. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts +1 -68
  730. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
  731. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js +1 -345
  732. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -1
  733. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts +4 -13
  734. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -1
  735. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +33 -478
  736. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -1
  737. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts +202 -0
  738. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts.map +1 -0
  739. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js +182 -0
  740. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js.map +1 -0
  741. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts +4 -11
  742. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -1
  743. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js +15 -439
  744. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -1
  745. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts +328 -0
  746. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts.map +1 -0
  747. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js +288 -0
  748. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js.map +1 -0
  749. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.d.ts +3 -0
  750. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.d.ts.map +1 -0
  751. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.js +15 -0
  752. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.js.map +1 -0
  753. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts +128 -0
  754. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts.map +1 -0
  755. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js +125 -0
  756. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js.map +1 -0
  757. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.d.ts +3 -0
  758. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.d.ts.map +1 -0
  759. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.js +15 -0
  760. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.js.map +1 -0
  761. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts +963 -0
  762. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts.map +1 -0
  763. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js +869 -0
  764. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js.map +1 -0
  765. package/node_modules/@earendil-works/pi-ai/dist/providers/images/{openrouter.d.ts → register-builtins.d.ts} +2 -2
  766. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
  767. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  768. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -0
  769. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts +3 -0
  770. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts.map +1 -0
  771. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +15 -0
  772. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js.map +1 -0
  773. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +63 -0
  774. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts.map +1 -0
  775. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +59 -0
  776. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js.map +1 -0
  777. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.d.ts +3 -0
  778. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.d.ts.map +1 -0
  779. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.js +15 -0
  780. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.js.map +1 -0
  781. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts +54 -0
  782. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts.map +1 -0
  783. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js +56 -0
  784. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js.map +1 -0
  785. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.d.ts +3 -0
  786. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.d.ts.map +1 -0
  787. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.js +15 -0
  788. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.js.map +1 -0
  789. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts +54 -0
  790. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts.map +1 -0
  791. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js +56 -0
  792. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js.map +1 -0
  793. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts +2 -25
  794. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -1
  795. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +12 -567
  796. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -1
  797. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts +513 -0
  798. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts.map +1 -0
  799. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js +515 -0
  800. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js.map +1 -0
  801. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.d.ts +3 -0
  802. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.d.ts.map +1 -0
  803. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.js +15 -0
  804. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.js.map +1 -0
  805. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts +234 -0
  806. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts.map +1 -0
  807. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +169 -0
  808. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js.map +1 -0
  809. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.d.ts +3 -0
  810. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.d.ts.map +1 -0
  811. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.js +15 -0
  812. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.js.map +1 -0
  813. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts +234 -0
  814. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts.map +1 -0
  815. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +169 -0
  816. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js.map +1 -0
  817. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.d.ts +3 -0
  818. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.d.ts.map +1 -0
  819. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.js +15 -0
  820. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.js.map +1 -0
  821. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts +563 -0
  822. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts.map +1 -0
  823. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js +385 -0
  824. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js.map +1 -0
  825. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.d.ts +3 -0
  826. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.d.ts.map +1 -0
  827. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +18 -0
  828. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js.map +1 -0
  829. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +87 -0
  830. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts.map +1 -0
  831. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +77 -0
  832. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js.map +1 -0
  833. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts +2 -22
  834. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
  835. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +1 -1070
  836. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
  837. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts +1 -19
  838. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -1
  839. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +1 -584
  840. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
  841. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts +2 -13
  842. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
  843. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +1 -656
  844. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
  845. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.d.ts +3 -0
  846. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.d.ts.map +1 -0
  847. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js +15 -0
  848. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js.map +1 -0
  849. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts +805 -0
  850. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts.map +1 -0
  851. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js +743 -0
  852. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js.map +1 -0
  853. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.d.ts +3 -0
  854. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.d.ts.map +1 -0
  855. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +18 -0
  856. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js.map +1 -0
  857. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +309 -0
  858. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts.map +1 -0
  859. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +240 -0
  860. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js.map +1 -0
  861. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.d.ts +3 -0
  862. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.d.ts.map +1 -0
  863. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js +22 -0
  864. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js.map +1 -0
  865. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +976 -0
  866. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts.map +1 -0
  867. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +815 -0
  868. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js.map +1 -0
  869. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.d.ts +3 -0
  870. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.d.ts.map +1 -0
  871. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +14 -0
  872. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js.map +1 -0
  873. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts +3 -0
  874. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -0
  875. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +15 -0
  876. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -0
  877. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +5402 -0
  878. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts.map +1 -0
  879. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +4634 -0
  880. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -0
  881. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts +1 -36
  882. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
  883. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +1 -190
  884. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js.map +1 -1
  885. package/node_modules/@earendil-works/pi-ai/dist/providers/together.d.ts +3 -0
  886. package/node_modules/@earendil-works/pi-ai/dist/providers/together.d.ts.map +1 -0
  887. package/node_modules/@earendil-works/pi-ai/dist/providers/together.js +15 -0
  888. package/node_modules/@earendil-works/pi-ai/dist/providers/together.js.map +1 -0
  889. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts +598 -0
  890. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts.map +1 -0
  891. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js +380 -0
  892. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js.map +1 -0
  893. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.d.ts +3 -0
  894. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.d.ts.map +1 -0
  895. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.js +15 -0
  896. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.js.map +1 -0
  897. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +3210 -0
  898. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -0
  899. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +3169 -0
  900. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js.map +1 -0
  901. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.d.ts +3 -0
  902. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.d.ts.map +1 -0
  903. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.js +15 -0
  904. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.js.map +1 -0
  905. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +157 -0
  906. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts.map +1 -0
  907. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +131 -0
  908. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js.map +1 -0
  909. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.d.ts +3 -0
  910. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.d.ts.map +1 -0
  911. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.js +15 -0
  912. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.js.map +1 -0
  913. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts +113 -0
  914. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts.map +1 -0
  915. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js +95 -0
  916. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js.map +1 -0
  917. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.d.ts +3 -0
  918. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.d.ts.map +1 -0
  919. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.js +15 -0
  920. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.js.map +1 -0
  921. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts +113 -0
  922. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts.map +1 -0
  923. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js +95 -0
  924. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js.map +1 -0
  925. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.d.ts +3 -0
  926. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.d.ts.map +1 -0
  927. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.js +15 -0
  928. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.js.map +1 -0
  929. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts +113 -0
  930. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts.map +1 -0
  931. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js +95 -0
  932. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js.map +1 -0
  933. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.d.ts +3 -0
  934. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.d.ts.map +1 -0
  935. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.js +15 -0
  936. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.js.map +1 -0
  937. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts +135 -0
  938. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts.map +1 -0
  939. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js +113 -0
  940. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js.map +1 -0
  941. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.d.ts +3 -0
  942. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.d.ts.map +1 -0
  943. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.js +15 -0
  944. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.js.map +1 -0
  945. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts +153 -0
  946. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts.map +1 -0
  947. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +114 -0
  948. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js.map +1 -0
  949. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.d.ts +3 -0
  950. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.d.ts.map +1 -0
  951. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.js +15 -0
  952. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.js.map +1 -0
  953. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts +153 -0
  954. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts.map +1 -0
  955. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +114 -0
  956. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js.map +1 -0
  957. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts +1 -5
  958. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -1
  959. package/node_modules/@earendil-works/pi-ai/dist/stream.js +1 -53
  960. package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -1
  961. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +74 -8
  962. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  963. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  964. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.d.ts +17 -0
  965. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.d.ts.map +1 -0
  966. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +98 -0
  967. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js.map +1 -0
  968. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts +2 -0
  969. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts.map +1 -1
  970. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +10 -0
  971. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js.map +1 -1
  972. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts +2 -0
  973. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -1
  974. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js +31 -0
  975. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +1 -1
  976. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts +2 -0
  977. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  978. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +33 -2
  979. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  980. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/load.d.ts +5 -0
  981. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/load.d.ts.map +1 -0
  982. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/load.js +22 -0
  983. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/load.js.map +1 -0
  984. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +2 -0
  985. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
  986. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +49 -0
  987. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
  988. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +12 -0
  989. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -0
  990. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +86 -0
  991. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -0
  992. package/node_modules/@earendil-works/pi-ai/package.json +15 -42
  993. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +2 -0
  994. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
  995. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +5 -1
  996. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
  997. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +1 -1
  998. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  999. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +1 -1
  1000. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  1001. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  1002. package/node_modules/@earendil-works/pi-tui/dist/tui.js +3 -0
  1003. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  1004. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  1005. package/node_modules/marked/README.md +8 -0
  1006. package/node_modules/marked/bin/main.js +12 -11
  1007. package/node_modules/marked/lib/marked.d.ts +22 -11
  1008. package/node_modules/marked/lib/marked.esm.js +50 -46
  1009. package/node_modules/marked/lib/marked.esm.js.map +3 -3
  1010. package/node_modules/marked/lib/marked.umd.js +50 -46
  1011. package/node_modules/marked/lib/marked.umd.js.map +3 -3
  1012. package/node_modules/marked/man/marked.1 +1 -1
  1013. package/node_modules/marked/package.json +17 -17
  1014. package/npm-shrinkwrap.json +788 -38
  1015. package/package.json +11 -5
  1016. package/node_modules/@earendil-works/pi-agent-core/dist/base.d.ts +0 -20
  1017. package/node_modules/@earendil-works/pi-agent-core/dist/base.d.ts.map +0 -1
  1018. package/node_modules/@earendil-works/pi-agent-core/dist/base.js +0 -20
  1019. package/node_modules/@earendil-works/pi-agent-core/dist/base.js.map +0 -1
  1020. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +0 -20
  1021. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +0 -1
  1022. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +0 -44
  1023. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +0 -1
  1024. package/node_modules/@earendil-works/pi-ai/dist/base.d.ts +0 -30
  1025. package/node_modules/@earendil-works/pi-ai/dist/base.d.ts.map +0 -1
  1026. package/node_modules/@earendil-works/pi-ai/dist/base.js +0 -18
  1027. package/node_modules/@earendil-works/pi-ai/dist/base.js.map +0 -1
  1028. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts.map +0 -1
  1029. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js.map +0 -1
  1030. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts.map +0 -1
  1031. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js.map +0 -1
  1032. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +0 -1
  1033. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +0 -1
  1034. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +0 -1
  1035. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +0 -1
  1036. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts.map +0 -1
  1037. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js.map +0 -1
  1038. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +0 -1
  1039. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +0 -1
  1040. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts.map +0 -1
  1041. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js.map +0 -1
  1042. /package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/github-copilot-headers.d.ts +0 -0
  1043. /package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/github-copilot-headers.js +0 -0
  1044. /package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/openai-prompt-cache.d.ts +0 -0
  1045. /package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/openai-prompt-cache.js +0 -0
  1046. /package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/transform-messages.d.ts +0 -0
  1047. /package/node_modules/@earendil-works/pi-ai/dist/{providers → api}/transform-messages.js +0 -0
  1048. /package/node_modules/marked/{LICENSE.md → LICENSE} +0 -0
@@ -1,54 +1,2 @@
1
- import { getApiProvider } from "./api-registry.js";
2
- import { getEnvApiKey } from "./env-api-keys.js";
3
- import { getProtocol, getToolCallFormat, transformContext, wrapStreamWithToolCallMiddleware, } from "./tool-call-middleware/index.js";
4
- function hasExplicitApiKey(apiKey) {
5
- return typeof apiKey === "string" && apiKey.trim().length > 0;
6
- }
7
- function withEnvApiKey(model, options) {
8
- if (hasExplicitApiKey(options?.apiKey))
9
- return options;
10
- const apiKey = getEnvApiKey(model.provider, options?.env);
11
- if (!apiKey)
12
- return options;
13
- return { ...options, apiKey };
14
- }
15
- function resolveApiProvider(api) {
16
- const provider = getApiProvider(api);
17
- if (!provider) {
18
- throw new Error(`No API provider registered for api: ${api}`);
19
- }
20
- return provider;
21
- }
22
- export function stream(model, context, options) {
23
- const provider = resolveApiProvider(model.api);
24
- const format = getToolCallFormat(model);
25
- if (format && context.tools && context.tools.length > 0) {
26
- const protocol = getProtocol(format);
27
- const transformedContext = transformContext(context, protocol);
28
- const streamOptions = withEnvApiKey(model, options);
29
- const innerStream = provider.stream(model, transformedContext, streamOptions);
30
- return wrapStreamWithToolCallMiddleware(innerStream, protocol, context.tools);
31
- }
32
- return provider.stream(model, context, withEnvApiKey(model, options));
33
- }
34
- export async function complete(model, context, options) {
35
- const s = stream(model, context, options);
36
- return s.result();
37
- }
38
- export function streamSimple(model, context, options) {
39
- const provider = resolveApiProvider(model.api);
40
- const format = getToolCallFormat(model);
41
- if (format && context.tools && context.tools.length > 0) {
42
- const protocol = getProtocol(format);
43
- const transformedContext = transformContext(context, protocol);
44
- const streamOptions = withEnvApiKey(model, options);
45
- const innerStream = provider.streamSimple(model, transformedContext, streamOptions);
46
- return wrapStreamWithToolCallMiddleware(innerStream, protocol, context.tools);
47
- }
48
- return provider.streamSimple(model, context, withEnvApiKey(model, options));
49
- }
50
- export async function completeSimple(model, context, options) {
51
- const s = streamSimple(model, context, options);
52
- return s.result();
53
- }
1
+ export { complete, completeSimple, stream, streamSimple } from "./compat.js";
54
2
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,GAChC,MAAM,iCAAiC,CAAC;AAYzC,SAAS,iBAAiB,CAAC,MAA0B;IACpD,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,aAAa,CACrB,KAAiB,EACjB,OAA6B;IAE7B,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC;QAAE,OAAO,OAAO,CAAC;IACvD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC1D,IAAI,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC;IAC5B,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AAE,OAAO,CAAC,CAAC;IAC1C,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,YAAY,CAC3B,KAAkB,EAClB,OAAgB,EAChB,OAA6B;IAE7B,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE/C,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,MAAM,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC/D,MAAM,aAAa,GAAG,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,WAAW,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,kBAAkB,EAAE,aAAa,CAAC,CAAC;QACpF,OAAO,gCAAgC,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,KAAkB,EAClB,OAAgB,EAChB,OAA6B;IAE7B,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AACnB,CAAC","sourcesContent":["import { getApiProvider } from \"./api-registry.ts\";\nimport { getEnvApiKey } from \"./env-api-keys.ts\";\nimport {\n\tgetProtocol,\n\tgetToolCallFormat,\n\ttransformContext,\n\twrapStreamWithToolCallMiddleware,\n} from \"./tool-call-middleware/index.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEventStream,\n\tContext,\n\tModel,\n\tProviderStreamOptions,\n\tSimpleStreamOptions,\n\tStreamOptions,\n} from \"./types.ts\";\n\nfunction hasExplicitApiKey(apiKey: string | undefined): apiKey is string {\n\treturn typeof apiKey === \"string\" && apiKey.trim().length > 0;\n}\n\nfunction withEnvApiKey<TOptions extends StreamOptions>(\n\tmodel: Model<Api>,\n\toptions: TOptions | undefined,\n): TOptions | undefined {\n\tif (hasExplicitApiKey(options?.apiKey)) return options;\n\tconst apiKey = getEnvApiKey(model.provider, options?.env);\n\tif (!apiKey) return options;\n\treturn { ...options, apiKey } as TOptions;\n}\n\nfunction resolveApiProvider(api: Api) {\n\tconst provider = getApiProvider(api);\n\tif (!provider) {\n\t\tthrow new Error(`No API provider registered for api: ${api}`);\n\t}\n\treturn provider;\n}\n\nexport function stream<TApi extends Api>(\n\tmodel: Model<TApi>,\n\tcontext: Context,\n\toptions?: ProviderStreamOptions,\n): AssistantMessageEventStream {\n\tconst provider = resolveApiProvider(model.api);\n\n\tconst format = getToolCallFormat(model);\n\tif (format && context.tools && context.tools.length > 0) {\n\t\tconst protocol = getProtocol(format);\n\t\tconst transformedContext = transformContext(context, protocol);\n\t\tconst streamOptions = withEnvApiKey(model, options) as StreamOptions;\n\t\tconst innerStream = provider.stream(model, transformedContext, streamOptions);\n\t\treturn wrapStreamWithToolCallMiddleware(innerStream, protocol, context.tools);\n\t}\n\n\treturn provider.stream(model, context, withEnvApiKey(model, options) as StreamOptions);\n}\n\nexport async function complete<TApi extends Api>(\n\tmodel: Model<TApi>,\n\tcontext: Context,\n\toptions?: ProviderStreamOptions,\n): Promise<AssistantMessage> {\n\tconst s = stream(model, context, options);\n\treturn s.result();\n}\n\nexport function streamSimple<TApi extends Api>(\n\tmodel: Model<TApi>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream {\n\tconst provider = resolveApiProvider(model.api);\n\n\tconst format = getToolCallFormat(model);\n\tif (format && context.tools && context.tools.length > 0) {\n\t\tconst protocol = getProtocol(format);\n\t\tconst transformedContext = transformContext(context, protocol);\n\t\tconst streamOptions = withEnvApiKey(model, options);\n\t\tconst innerStream = provider.streamSimple(model, transformedContext, streamOptions);\n\t\treturn wrapStreamWithToolCallMiddleware(innerStream, protocol, context.tools);\n\t}\n\n\treturn provider.streamSimple(model, context, withEnvApiKey(model, options));\n}\n\nexport async function completeSimple<TApi extends Api>(\n\tmodel: Model<TApi>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): Promise<AssistantMessage> {\n\tconst s = streamSimple(model, context, options);\n\treturn s.result();\n}\n"]}
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { complete, completeSimple, stream, streamSimple } from \"./compat.ts\";\n"]}
@@ -1,3 +1,12 @@
1
+ import type { AnthropicOptions } from "./api/anthropic-messages.ts";
2
+ import type { AzureOpenAIResponsesOptions } from "./api/azure-openai-responses.ts";
3
+ import type { BedrockOptions } from "./api/bedrock-converse-stream.ts";
4
+ import type { GoogleOptions } from "./api/google-generative-ai.ts";
5
+ import type { GoogleVertexOptions } from "./api/google-vertex.ts";
6
+ import type { MistralOptions } from "./api/mistral-conversations.ts";
7
+ import type { OpenAICodexResponsesOptions } from "./api/openai-codex-responses.ts";
8
+ import type { OpenAICompletionsOptions } from "./api/openai-completions.ts";
9
+ import type { OpenAIResponsesOptions } from "./api/openai-responses.ts";
1
10
  import type { AssistantMessageDiagnostic } from "./utils/diagnostics.ts";
2
11
  import type { AssistantMessageEventStream } from "./utils/event-stream.ts";
3
12
  export type { AssistantMessageEventStream } from "./utils/event-stream.ts";
@@ -6,9 +15,9 @@ export type Api = KnownApi | (string & {});
6
15
  export type KnownImagesApi = "openrouter-images";
7
16
  export type ImagesApi = KnownImagesApi | (string & {});
8
17
  export type KnownProvider = "amazon-bedrock" | "ant-ling" | "anthropic" | "google" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "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";
9
- export type Provider = KnownProvider | string;
18
+ export type ProviderId = KnownProvider | string;
10
19
  export type KnownImagesProvider = "openrouter";
11
- export type ImagesProvider = KnownImagesProvider | string;
20
+ export type ImagesProviderId = KnownImagesProvider | string;
12
21
  export type ThinkingLevel = "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
13
22
  export type ModelThinkingLevel = "off" | ThinkingLevel;
14
23
  export type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;
@@ -22,11 +31,13 @@ export interface ThinkingBudgets {
22
31
  low?: number;
23
32
  medium?: number;
24
33
  high?: number;
34
+ max?: number;
25
35
  }
26
36
  export type CacheRetention = "none" | "short" | "long";
27
37
  export type Transport = "sse" | "websocket" | "websocket-cached" | "auto";
28
38
  /** Provider-scoped environment overrides. Values take precedence over process.env. */
29
39
  export type ProviderEnv = Record<string, string>;
40
+ export type ProviderHeaders = Record<string, string | null>;
30
41
  export interface ProviderResponse {
31
42
  status: number;
32
43
  headers: Record<string, string>;
@@ -68,8 +79,9 @@ export interface StreamOptions {
68
79
  * On AWS Bedrock these are injected via a Smithy `build`-step middleware so
69
80
  * they are covered by SigV4 signing; reserved headers (`x-amz-*`,
70
81
  * `authorization`, `host`) are silently ignored to preserve SigV4 / bearer auth.
82
+ * A null value suppresses a provider/API default header with the same name.
71
83
  */
72
- headers?: Record<string, string>;
84
+ headers?: ProviderHeaders;
73
85
  /**
74
86
  * Optional custom fields to merge into the outgoing provider request body.
75
87
  * Applied before `onPayload` so `onPayload` can observe/override them.
@@ -115,9 +127,56 @@ export interface StreamOptions {
115
127
  env?: ProviderEnv;
116
128
  }
117
129
  export type ProviderStreamOptions = StreamOptions & Record<string, unknown>;
130
+ /**
131
+ * Maps known APIs to their full provider-specific stream option types.
132
+ * Type-only imports from API implementation modules are erased at emit, so
133
+ * this is tree-shake safe.
134
+ */
135
+ export interface ApiOptionsMap {
136
+ "anthropic-messages": AnthropicOptions;
137
+ "openai-completions": OpenAICompletionsOptions;
138
+ "openai-responses": OpenAIResponsesOptions;
139
+ "openai-codex-responses": OpenAICodexResponsesOptions;
140
+ "azure-openai-responses": AzureOpenAIResponsesOptions;
141
+ "google-generative-ai": GoogleOptions;
142
+ "google-vertex": GoogleVertexOptions;
143
+ "mistral-conversations": MistralOptions;
144
+ "bedrock-converse-stream": BedrockOptions;
145
+ }
146
+ /**
147
+ * Full stream options for an API. Known APIs resolve to their concrete option
148
+ * type; custom API strings fall back to the generic shape.
149
+ */
150
+ export type ApiStreamOptions<TApi extends Api> = TApi extends keyof ApiOptionsMap ? ApiOptionsMap[TApi] : StreamOptions & Record<string, unknown>;
151
+ /**
152
+ * The uniform stream contract of an API implementation module: every module
153
+ * under `src/api/` exports exactly `stream` and `streamSimple`, so the module
154
+ * itself satisfies this interface. Lazy wrappers (`lazyApi()`) and provider
155
+ * factories pass these around as values. This is the untyped dispatch shape;
156
+ * per-API option typing lives on the implementation modules themselves and on
157
+ * `Provider.stream()` via `ApiStreamOptions`.
158
+ */
159
+ export interface ProviderStreams {
160
+ stream(model: Model<Api>, context: Context, options?: StreamOptions): AssistantMessageEventStream;
161
+ streamSimple(model: Model<Api>, context: Context, options?: SimpleStreamOptions): AssistantMessageEventStream;
162
+ }
163
+ /**
164
+ * The uniform contract of an image-generation API implementation module:
165
+ * every image API module under `src/api/` exports exactly `generateImages`,
166
+ * so the module itself satisfies this interface. Lazy wrappers and image
167
+ * provider factories pass these around as values.
168
+ */
169
+ export interface ProviderImages {
170
+ generateImages(model: ImagesModel<ImagesApi>, context: ImagesContext, options?: ImagesOptions): Promise<AssistantImages>;
171
+ }
118
172
  export interface ImagesOptions {
119
173
  signal?: AbortSignal;
120
174
  apiKey?: string;
175
+ /**
176
+ * Provider-scoped environment values. These take precedence over process.env for
177
+ * provider configuration such as endpoint placeholders and proxy variables.
178
+ */
179
+ env?: ProviderEnv;
121
180
  /**
122
181
  * Optional callback for inspecting or replacing provider payloads before sending.
123
182
  * Return undefined to keep the payload unchanged.
@@ -130,8 +189,9 @@ export interface ImagesOptions {
130
189
  /**
131
190
  * Optional custom HTTP headers to include in API requests.
132
191
  * Merged with provider defaults; can override default headers.
192
+ * A null value suppresses a provider/API default header with the same name.
133
193
  */
134
- headers?: Record<string, string>;
194
+ headers?: ProviderHeaders;
135
195
  /**
136
196
  * HTTP request timeout in milliseconds for providers/SDKs that support it.
137
197
  */
@@ -223,6 +283,12 @@ export interface Usage {
223
283
  cacheWrite: number;
224
284
  /** Subset of `cacheWrite` written with 1h retention. Only Anthropic reports this split. */
225
285
  cacheWrite1h?: number;
286
+ /**
287
+ * Reasoning/thinking tokens, when the provider reports them. This is a subset of
288
+ * `output`: `output` already includes these tokens. Set to a number (possibly 0) by
289
+ * providers that expose a reasoning breakdown; left undefined by providers that don't.
290
+ */
291
+ reasoning?: number;
226
292
  totalTokens: number;
227
293
  cost: {
228
294
  input: number;
@@ -242,7 +308,7 @@ export interface AssistantMessage {
242
308
  role: "assistant";
243
309
  content: (TextContent | ThinkingContent | ToolCall | ProviderNativeContent)[];
244
310
  api: Api;
245
- provider: Provider;
311
+ provider: ProviderId;
246
312
  model: string;
247
313
  responseModel?: string;
248
314
  responseId?: string;
@@ -270,7 +336,7 @@ export interface ImagesContext {
270
336
  export type ImagesStopReason = "stop" | "error" | "aborted";
271
337
  export interface AssistantImages {
272
338
  api: ImagesApi;
273
- provider: ImagesProvider;
339
+ provider: ImagesProviderId;
274
340
  model: string;
275
341
  output: ImagesOutputContent[];
276
342
  responseId?: string;
@@ -565,7 +631,7 @@ export interface Model<TApi extends Api> {
565
631
  id: string;
566
632
  name: string;
567
633
  api: TApi;
568
- provider: Provider;
634
+ provider: ProviderId;
569
635
  baseUrl: string;
570
636
  reasoning: boolean;
571
637
  /**
@@ -590,7 +656,7 @@ export interface Model<TApi extends Api> {
590
656
  }
591
657
  export interface ImagesModel<TApi extends ImagesApi> extends Omit<Model<Api>, "api" | "provider" | "reasoning" | "contextWindow" | "maxTokens" | "compat"> {
592
658
  api: TApi;
593
- provider: ImagesProvider;
659
+ provider: ImagesProviderId;
594
660
  output: ("text" | "image")[];
595
661
  }
596
662
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,YAAY,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,MAAM,QAAQ,GACjB,oBAAoB,GACpB,uBAAuB,GACvB,kBAAkB,GAClB,wBAAwB,GACxB,wBAAwB,GACxB,oBAAoB,GACpB,yBAAyB,GACzB,sBAAsB,GACtB,eAAe,CAAC;AAEnB,MAAM,MAAM,GAAG,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEvD,MAAM,MAAM,aAAa,GACtB,gBAAgB,GAChB,UAAU,GACV,WAAW,GACX,QAAQ,GACR,eAAe,GACf,QAAQ,GACR,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GACvC,uBAAuB,GACvB,IAAI,SAAS,kBAAkB,GAC9B,qBAAqB,GACrB,IAAI,SAAS,oBAAoB,GAChC,uBAAuB,GACvB,KAAK,CAAC;CACX;AAED,MAAM,WAAW,WAAW,CAAC,IAAI,SAAS,SAAS,CAClD,SAAQ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,eAAe,GAAG,WAAW,GAAG,QAAQ,CAAC;IACrG,GAAG,EAAE,IAAI,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;CAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AssistantMessageDiagnostic } from \"./utils/diagnostics.ts\";\nimport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\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\nexport type Api = KnownApi | (string & {});\n\nexport type KnownImagesApi = \"openrouter-images\";\n\nexport type ImagesApi = KnownImagesApi | (string & {});\n\nexport type KnownProvider =\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| \"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 Provider = KnownProvider | string;\n\nexport type KnownImagesProvider = \"openrouter\";\n\nexport type ImagesProvider = 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}\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>;\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 */\n\theaders?: Record<string, string>;\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\nexport interface ImagesOptions {\n\tsignal?: AbortSignal;\n\tapiKey?: 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: 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 */\n\theaders?: Record<string, string>;\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\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\"\n}\n\nexport interface ToolCall {\n\ttype: \"toolCall\";\n\tid: string;\n\tname: string;\n\targuments: Record<string, any>;\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\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 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: Provider;\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\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\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: ImagesProvider;\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| { 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 * 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\", \"xml\", \"yaml-xml\", \"gemma4-delimiter\"\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 known session-affinity headers (`session_id`, `x-client-request-id`, `x-session-affinity`) from `options.sessionId` when caching is enabled. Default: false. */\n\tsendSessionAffinityHeaders?: boolean;\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/** Whether to send the OpenAI `session_id` cache-affinity header from `options.sessionId` when caching is enabled. Default: true. */\n\tsendSessionIdHeader?: boolean;\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}\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}\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\n// Model interface for the unified model system\nexport interface Model<TApi extends Api> {\n\tid: string;\n\tname: string;\n\tapi: TApi;\n\tprovider: Provider;\n\tbaseUrl: string;\n\treasoning: boolean;\n\t/**\n\t * Maps pi thinking levels to provider/model-specific values.\n\t * Missing keys use provider defaults. null marks a level as unsupported.\n\t */\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\")[];\n\tcost: {\n\t\tinput: number; // $/million tokens\n\t\toutput: number; // $/million tokens\n\t\tcacheRead: number; // $/million tokens\n\t\tcacheWrite: number; // $/million tokens\n\t};\n\tcontextWindow: number;\n\tmaxTokens: number;\n\theaders?: Record<string, string>;\n\t/** Default prompt-cache retention preference when the request omits one. */\n\tcacheRetention?: CacheRetention;\n\t/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */\n\tcompat?: TApi extends \"openai-completions\"\n\t\t? OpenAICompletionsCompat\n\t\t: TApi extends \"openai-responses\"\n\t\t\t? OpenAIResponsesCompat\n\t\t\t: TApi extends \"anthropic-messages\"\n\t\t\t\t? AnthropicMessagesCompat\n\t\t\t\t: never;\n}\n\nexport interface ImagesModel<TApi extends ImagesApi>\n\textends Omit<Model<Api>, \"api\" | \"provider\" | \"reasoning\" | \"contextWindow\" | \"maxTokens\" | \"compat\"> {\n\tapi: TApi;\n\tprovider: ImagesProvider;\n\toutput: (\"text\" | \"image\")[];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","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 { AssistantMessageDiagnostic } from \"./utils/diagnostics.ts\";\nimport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\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\nexport type Api = KnownApi | (string & {});\n\nexport type KnownImagesApi = \"openrouter-images\";\n\nexport type ImagesApi = KnownImagesApi | (string & {});\n\nexport type KnownProvider =\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| \"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>;\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}\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\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\"\n}\n\nexport interface ToolCall {\n\ttype: \"toolCall\";\n\tid: string;\n\tname: string;\n\targuments: Record<string, any>;\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 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\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\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| { 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 * 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\", \"xml\", \"yaml-xml\", \"gemma4-delimiter\"\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 known session-affinity headers (`session_id`, `x-client-request-id`, `x-session-affinity`) from `options.sessionId` when caching is enabled. Default: false. */\n\tsendSessionAffinityHeaders?: boolean;\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/** Whether to send the OpenAI `session_id` cache-affinity header from `options.sessionId` when caching is enabled. Default: true. */\n\tsendSessionIdHeader?: boolean;\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}\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}\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\n// Model interface for the unified model system\nexport interface Model<TApi extends Api> {\n\tid: string;\n\tname: string;\n\tapi: TApi;\n\tprovider: ProviderId;\n\tbaseUrl: string;\n\treasoning: boolean;\n\t/**\n\t * Maps pi thinking levels to provider/model-specific values.\n\t * Missing keys use provider defaults. null marks a level as unsupported.\n\t */\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\")[];\n\tcost: {\n\t\tinput: number; // $/million tokens\n\t\toutput: number; // $/million tokens\n\t\tcacheRead: number; // $/million tokens\n\t\tcacheWrite: number; // $/million tokens\n\t};\n\tcontextWindow: number;\n\tmaxTokens: number;\n\theaders?: Record<string, string>;\n\t/** Default prompt-cache retention preference when the request omits one. */\n\tcacheRetention?: CacheRetention;\n\t/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */\n\tcompat?: TApi extends \"openai-completions\"\n\t\t? OpenAICompletionsCompat\n\t\t: TApi extends \"openai-responses\"\n\t\t\t? OpenAIResponsesCompat\n\t\t\t: TApi extends \"anthropic-messages\"\n\t\t\t\t? AnthropicMessagesCompat\n\t\t\t\t: never;\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,17 @@
1
+ import type { Context, ImageContent, Message, TextContent, Usage } from "../types.ts";
2
+ export interface ContextUsageEstimate {
3
+ /** Estimated total context tokens. */
4
+ tokens: number;
5
+ /** Tokens reported by the most recent assistant usage block. */
6
+ usageTokens: number;
7
+ /** Estimated tokens after the most recent assistant usage block. */
8
+ trailingTokens: number;
9
+ /** Index of the message that provided usage, or null when none exists. */
10
+ lastUsageIndex: number | null;
11
+ }
12
+ export declare function calculateContextTokens(usage: Usage): number;
13
+ export declare function estimateTextTokens(text: string): number;
14
+ export declare function estimateTextAndImageContentTokens(content: string | Array<TextContent | ImageContent>): number;
15
+ export declare function estimateMessageTokens(message: Message): number;
16
+ export declare function estimateContextTokens(context: Context | readonly Message[]): ContextUsageEstimate;
17
+ //# sourceMappingURL=estimate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate.d.ts","sourceRoot":"","sources":["../../src/utils/estimate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAExG,MAAM,WAAW,oBAAoB;IACpC,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAKD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAE3D;AAkBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC,GAAG,MAAM,CAE7G;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAkB9D;AAiCD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,OAAO,EAAE,GAAG,oBAAoB,CAiBjG"}
@@ -0,0 +1,98 @@
1
+ const CHARS_PER_TOKEN = 4;
2
+ const ESTIMATED_IMAGE_CHARS = 4800;
3
+ export function calculateContextTokens(usage) {
4
+ return usage.totalTokens || usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
5
+ }
6
+ function safeJsonStringify(value) {
7
+ try {
8
+ return JSON.stringify(value) ?? "undefined";
9
+ }
10
+ catch {
11
+ return "[unserializable]";
12
+ }
13
+ }
14
+ function estimateTextAndImageContentChars(content) {
15
+ if (typeof content === "string")
16
+ return content.length;
17
+ let chars = 0;
18
+ for (const block of content)
19
+ chars += block.type === "text" ? block.text.length : ESTIMATED_IMAGE_CHARS;
20
+ return chars;
21
+ }
22
+ export function estimateTextTokens(text) {
23
+ return Math.ceil(text.length / CHARS_PER_TOKEN);
24
+ }
25
+ export function estimateTextAndImageContentTokens(content) {
26
+ return Math.ceil(estimateTextAndImageContentChars(content) / CHARS_PER_TOKEN);
27
+ }
28
+ export function estimateMessageTokens(message) {
29
+ let chars = 0;
30
+ if (message.role === "user")
31
+ return estimateTextAndImageContentTokens(message.content);
32
+ if (message.role === "toolResult")
33
+ return estimateTextAndImageContentTokens(message.content);
34
+ for (const block of message.content) {
35
+ if (block.type === "text") {
36
+ chars += block.text.length;
37
+ }
38
+ else if (block.type === "thinking") {
39
+ chars += block.thinking.length;
40
+ }
41
+ else if (block.type === "toolCall") {
42
+ chars += block.name.length + safeJsonStringify(block.arguments).length;
43
+ }
44
+ else {
45
+ chars += block.subtype.length + safeJsonStringify(block.raw).length;
46
+ }
47
+ }
48
+ return Math.ceil(chars / CHARS_PER_TOKEN);
49
+ }
50
+ function getLastAssistantUsageInfo(messages) {
51
+ for (let i = messages.length - 1; i >= 0; i--) {
52
+ const message = messages[i];
53
+ if (message.role !== "assistant")
54
+ continue;
55
+ const assistant = message;
56
+ if (assistant.stopReason === "aborted" || assistant.stopReason === "error")
57
+ continue;
58
+ if (calculateContextTokens(assistant.usage) > 0)
59
+ return { usage: assistant.usage, index: i };
60
+ }
61
+ return undefined;
62
+ }
63
+ function estimateMessages(messages) {
64
+ const usageInfo = getLastAssistantUsageInfo(messages);
65
+ if (usageInfo) {
66
+ const usageTokens = calculateContextTokens(usageInfo.usage);
67
+ let trailingTokens = 0;
68
+ for (let i = usageInfo.index + 1; i < messages.length; i++) {
69
+ trailingTokens += estimateMessageTokens(messages[i]);
70
+ }
71
+ return { tokens: usageTokens + trailingTokens, usageTokens, trailingTokens, lastUsageIndex: usageInfo.index };
72
+ }
73
+ let tokens = 0;
74
+ for (const message of messages)
75
+ tokens += estimateMessageTokens(message);
76
+ return { tokens, usageTokens: 0, trailingTokens: tokens, lastUsageIndex: null };
77
+ }
78
+ function isMessageArray(value) {
79
+ return Array.isArray(value);
80
+ }
81
+ export function estimateContextTokens(context) {
82
+ if (isMessageArray(context))
83
+ return estimateMessages(context);
84
+ const estimate = estimateMessages(context.messages);
85
+ if (estimate.lastUsageIndex !== null)
86
+ return estimate;
87
+ let prefixTokens = context.systemPrompt ? estimateTextTokens(context.systemPrompt) : 0;
88
+ if (context.tools && context.tools.length > 0) {
89
+ prefixTokens += estimateTextTokens(safeJsonStringify(context.tools));
90
+ }
91
+ return {
92
+ tokens: estimate.tokens + prefixTokens,
93
+ usageTokens: estimate.usageTokens,
94
+ trailingTokens: estimate.trailingTokens + prefixTokens,
95
+ lastUsageIndex: estimate.lastUsageIndex,
96
+ };
97
+ }
98
+ //# sourceMappingURL=estimate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate.js","sourceRoot":"","sources":["../../src/utils/estimate.ts"],"names":[],"mappings":"AAaA,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,UAAU,sBAAsB,CAAC,KAAY;IAClD,OAAO,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC;AAC7F,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACxC,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,kBAAkB,CAAC;IAC3B,CAAC;AACF,CAAC;AAED,SAAS,gCAAgC,CAAC,OAAmD;IAC5F,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAEvD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,KAAK,IAAI,OAAO;QAAE,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC;IACxG,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,C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AE,WAAW,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;AACjF,CAAC;AAED,SAAS,cAAc,CAAC,KAAmC;IAC1D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAqC;IAC1E,IAAI,cAAc,CAAC,OAAO,CAAC;QAAE,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE9D,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpD,IAAI,QAAQ,CAAC,cAAc,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC;IAEtD,IAAI,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvF,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/C,YAAY,IAAI,kBAAkB,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACN,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,YAAY;QACtC,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,cAAc,EAAE,QAAQ,CAAC,cAAc,GAAG,YAAY;QACtD,cAAc,EAAE,QAAQ,CAAC,cAAc;KACvC,CAAC;AACH,CAAC","sourcesContent":["import type { AssistantMessage, Context, ImageContent, Message, TextContent, Usage } from \"../types.ts\";\n\nexport interface ContextUsageEstimate {\n\t/** Estimated total context tokens. */\n\ttokens: number;\n\t/** Tokens reported by the most recent assistant usage block. */\n\tusageTokens: number;\n\t/** Estimated tokens after the most recent assistant usage block. */\n\ttrailingTokens: number;\n\t/** Index of the message that provided usage, or null when none exists. */\n\tlastUsageIndex: number | null;\n}\n\nconst CHARS_PER_TOKEN = 4;\nconst ESTIMATED_IMAGE_CHARS = 4800;\n\nexport function calculateContextTokens(usage: Usage): number {\n\treturn usage.totalTokens || usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n}\n\nfunction safeJsonStringify(value: unknown): string {\n\ttry {\n\t\treturn JSON.stringify(value) ?? \"undefined\";\n\t} catch {\n\t\treturn \"[unserializable]\";\n\t}\n}\n\nfunction estimateTextAndImageContentChars(content: string | Array<TextContent | ImageContent>): number {\n\tif (typeof content === \"string\") return content.length;\n\n\tlet chars = 0;\n\tfor (const block of content) chars += block.type === \"text\" ? block.text.length : ESTIMATED_IMAGE_CHARS;\n\treturn chars;\n}\n\nexport function estimateTextTokens(text: string): number {\n\treturn Math.ceil(text.length / CHARS_PER_TOKEN);\n}\n\nexport function estimateTextAndImageContentTokens(content: string | Array<TextContent | ImageContent>): number {\n\treturn Math.ceil(estimateTextAndImageContentChars(content) / CHARS_PER_TOKEN);\n}\n\nexport function estimateMessageTokens(message: Message): number {\n\tlet chars = 0;\n\n\tif (message.role === \"user\") return estimateTextAndImageContentTokens(message.content);\n\tif (message.role === \"toolResult\") return estimateTextAndImageContentTokens(message.content);\n\n\tfor (const block of message.content) {\n\t\tif (block.type === \"text\") {\n\t\t\tchars += block.text.length;\n\t\t} else if (block.type === \"thinking\") {\n\t\t\tchars += block.thinking.length;\n\t\t} else if (block.type === \"toolCall\") {\n\t\t\tchars += block.name.length + safeJsonStringify(block.arguments).length;\n\t\t} else {\n\t\t\tchars += block.subtype.length + safeJsonStringify(block.raw).length;\n\t\t}\n\t}\n\treturn Math.ceil(chars / CHARS_PER_TOKEN);\n}\n\nfunction getLastAssistantUsageInfo(messages: readonly Message[]): { usage: Usage; index: number } | undefined {\n\tfor (let i = messages.length - 1; i >= 0; i--) {\n\t\tconst message = messages[i];\n\t\tif (message.role !== \"assistant\") continue;\n\t\tconst assistant = message as AssistantMessage;\n\t\tif (assistant.stopReason === \"aborted\" || assistant.stopReason === \"error\") continue;\n\t\tif (calculateContextTokens(assistant.usage) > 0) return { usage: assistant.usage, index: i };\n\t}\n\treturn undefined;\n}\n\nfunction estimateMessages(messages: readonly Message[]): ContextUsageEstimate {\n\tconst usageInfo = getLastAssistantUsageInfo(messages);\n\tif (usageInfo) {\n\t\tconst usageTokens = calculateContextTokens(usageInfo.usage);\n\t\tlet trailingTokens = 0;\n\t\tfor (let i = usageInfo.index + 1; i < messages.length; i++) {\n\t\t\ttrailingTokens += estimateMessageTokens(messages[i]);\n\t\t}\n\t\treturn { tokens: usageTokens + trailingTokens, usageTokens, trailingTokens, lastUsageIndex: usageInfo.index };\n\t}\n\n\tlet tokens = 0;\n\tfor (const message of messages) tokens += estimateMessageTokens(message);\n\treturn { tokens, usageTokens: 0, trailingTokens: tokens, lastUsageIndex: null };\n}\n\nfunction isMessageArray(value: Context | readonly Message[]): value is readonly Message[] {\n\treturn Array.isArray(value);\n}\n\nexport function estimateContextTokens(context: Context | readonly Message[]): ContextUsageEstimate {\n\tif (isMessageArray(context)) return estimateMessages(context);\n\n\tconst estimate = estimateMessages(context.messages);\n\tif (estimate.lastUsageIndex !== null) return estimate;\n\n\tlet prefixTokens = context.systemPrompt ? estimateTextTokens(context.systemPrompt) : 0;\n\tif (context.tools && context.tools.length > 0) {\n\t\tprefixTokens += estimateTextTokens(safeJsonStringify(context.tools));\n\t}\n\n\treturn {\n\t\ttokens: estimate.tokens + prefixTokens,\n\t\tusageTokens: estimate.usageTokens,\n\t\ttrailingTokens: estimate.trailingTokens + prefixTokens,\n\t\tlastUsageIndex: estimate.lastUsageIndex,\n\t};\n}\n"]}
@@ -1,2 +1,4 @@
1
+ import type { ProviderHeaders } from "../types.ts";
1
2
  export declare function headersToRecord(headers: Headers): Record<string, string>;
3
+ export declare function providerHeadersToRecord(headers: ProviderHeaders | undefined): Record<string, string> | undefined;
2
4
  //# sourceMappingURL=headers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/utils/headers.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxE"}
1
+ {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/utils/headers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAOhH"}