@psnext/slingcli 2.4.20260507-3 → 2.4.20260509-1

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 (393) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/bin/sling.js +12 -12
  4. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +2 -2
  5. package/node_modules/@aws-sdk/token-providers/package.json +1 -1
  6. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/agent-loop.js +1 -1
  7. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/agent.js +4 -3
  8. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +526 -0
  9. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +243 -0
  10. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +616 -0
  11. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +348 -0
  12. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js +3 -0
  13. package/node_modules/@earendil-works/pi-agent-core/dist/harness/factory.js +9 -0
  14. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
  15. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +194 -0
  16. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js +92 -0
  17. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js +42 -0
  18. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js +31 -0
  19. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +196 -0
  20. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js +170 -0
  21. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js +90 -0
  22. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +258 -0
  23. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
  24. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +16 -0
  25. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +97 -0
  26. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +26 -0
  27. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/proxy.js +1 -1
  28. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/package.json +7 -5
  29. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/cli.js +6 -6
  30. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/env-api-keys.js +1 -0
  31. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +307 -0
  32. package/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
  33. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
  34. package/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
  35. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/index.js +4 -0
  36. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/models.generated.js +427 -122
  37. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +129 -0
  38. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  39. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-codex-responses.js +1 -1
  40. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-completions.js +150 -122
  41. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-responses-shared.js +14 -1
  42. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/openai-codex.js +25 -14
  43. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/overflow.js +3 -0
  44. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/package.json +5 -4
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/bun/register-bedrock.js +4 -0
  46. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/args.js +1 -0
  47. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/config-selector.js +1 -1
  48. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/list-models.js +1 -1
  49. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/session-picker.js +1 -1
  50. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/config.js +52 -30
  51. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session.js +1 -1
  52. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/auth-storage.js +2 -2
  53. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/branch-summarization.js +1 -1
  54. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/compaction.js +1 -1
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +153 -0
  56. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.css +45 -1
  57. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.js +68 -4
  58. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/loader.js +26 -12
  59. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/keybindings.js +1 -1
  60. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/model-registry.js +3 -2
  61. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/model-resolver.js +2 -1
  62. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/package-manager.js +22 -5
  63. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/provider-display-names.js +1 -0
  64. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/sdk.js +3 -3
  65. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/bash.js +1 -1
  66. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/edit.js +1 -1
  67. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/find.js +1 -1
  68. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/grep.js +1 -1
  69. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/ls.js +1 -1
  70. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/read.js +3 -2
  71. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/render-utils.js +1 -1
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +205 -0
  73. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/write.js +1 -1
  74. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/main.js +2 -2
  75. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/migrations.js +3 -3
  76. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +1 -1
  77. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +1 -1
  78. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js +1 -1
  79. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +1 -1
  80. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  81. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/config-selector.js +25 -3
  82. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/custom-editor.js +1 -1
  83. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/custom-message.js +1 -1
  84. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/earendil-announcement.js +1 -1
  85. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +1 -1
  86. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-input.js +1 -1
  87. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +1 -1
  88. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/footer.js +1 -1
  89. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js +36 -0
  90. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +4 -3
  91. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/model-selector.js +2 -2
  92. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js +1 -1
  93. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  94. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +1 -1
  95. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/session-selector.js +1 -1
  96. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +4 -2
  97. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/show-images-selector.js +1 -1
  98. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +1 -1
  99. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/theme-selector.js +1 -1
  100. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/thinking-selector.js +1 -1
  101. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -1
  102. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +3 -2
  103. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js +1 -1
  104. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/user-message.js +1 -1
  105. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/visual-truncate.js +1 -1
  106. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/interactive-mode.js +47 -32
  107. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/dark.json +1 -1
  108. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/light.json +1 -1
  109. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/theme.js +1 -1
  110. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/package-manager-cli.js +42 -39
  111. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard.js +9 -2
  112. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/paths.js +16 -0
  113. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/version-check.js +9 -2
  114. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/package.json +9 -8
  115. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/image.js +14 -7
  116. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/markdown.js +24 -84
  117. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/terminal-image.js +10 -4
  118. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/tui.js +73 -4
  119. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/utils.js +33 -7
  120. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/package.json +3 -3
  121. package/node_modules/@mariozechner/clipboard/README.md +58 -0
  122. package/node_modules/@mariozechner/clipboard/index.d.ts +23 -0
  123. package/node_modules/@mariozechner/clipboard-linux-x64-gnu/README.md +3 -0
  124. package/node_modules/@types/node/README.md +1 -1
  125. package/node_modules/@types/node/http2.d.ts +4 -1
  126. package/node_modules/@types/node/package.json +2 -2
  127. package/node_modules/@types/node/stream/web.d.ts +4 -0
  128. package/node_modules/brace-expansion/dist/commonjs/index.js +1 -1
  129. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  130. package/node_modules/brace-expansion/dist/esm/index.js +1 -1
  131. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  132. package/node_modules/brace-expansion/package.json +1 -1
  133. package/node_modules/fast-xml-builder/CHANGELOG.md +4 -0
  134. package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -1
  135. package/node_modules/fast-xml-builder/lib/fxb.d.cts +91 -1
  136. package/node_modules/fast-xml-builder/lib/fxb.min.js +1 -1
  137. package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -1
  138. package/node_modules/fast-xml-builder/package.json +3 -2
  139. package/node_modules/fast-xml-builder/src/fxb.d.ts +92 -3
  140. package/node_modules/fast-xml-builder/src/fxb.js +92 -31
  141. package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +87 -33
  142. package/node_modules/get-east-asian-width/lookup-data.js +15 -12
  143. package/node_modules/get-east-asian-width/lookup.js +25 -22
  144. package/node_modules/get-east-asian-width/package.json +1 -1
  145. package/node_modules/jiti/README.md +258 -0
  146. package/node_modules/jiti/dist/babel.cjs +257 -0
  147. package/node_modules/jiti/dist/jiti.cjs +1 -0
  148. package/node_modules/jiti/lib/jiti.mjs +29 -0
  149. package/node_modules/jiti/lib/types.d.ts +420 -0
  150. package/node_modules/jiti/package.json +146 -0
  151. package/node_modules/protobufjs/dist/light/protobuf.js +5 -3
  152. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  153. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  154. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  155. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  156. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  157. package/node_modules/protobufjs/dist/protobuf.js +5 -3
  158. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  159. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  160. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  161. package/node_modules/protobufjs/package.json +1 -1
  162. package/node_modules/protobufjs/src/namespace.js +3 -1
  163. package/node_modules/semver/README.md +19 -4
  164. package/node_modules/semver/bin/semver.js +14 -10
  165. package/node_modules/semver/functions/truncate.js +48 -0
  166. package/node_modules/semver/index.js +2 -0
  167. package/node_modules/semver/internal/re.js +1 -1
  168. package/node_modules/semver/package.json +3 -3
  169. package/node_modules/semver/range.bnf +5 -4
  170. package/node_modules/socks/package.json +2 -2
  171. package/node_modules/xml-naming/README.md +189 -0
  172. package/node_modules/xml-naming/package.json +54 -0
  173. package/node_modules/xml-naming/src/index.d.ts +74 -0
  174. package/node_modules/xml-naming/src/index.js +270 -0
  175. package/package.json +6 -6
  176. package/sling-default-packages.json +2 -1
  177. package/slingshot/index.js +442 -23
  178. package/node_modules/@mariozechner/jiti/dist/babel.cjs +0 -246
  179. package/node_modules/@mariozechner/jiti/dist/jiti.cjs +0 -1
  180. package/node_modules/@mariozechner/jiti/package.json +0 -96
  181. package/node_modules/@mariozechner/pi-agent-core/dist/index.js +0 -9
  182. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/cli.js +0 -116
  183. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/env-api-keys.js +0 -166
  184. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/index.js +0 -15
  185. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/models.generated.js +0 -16568
  186. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/amazon-bedrock.js +0 -753
  187. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/openai-codex-responses.js +0 -909
  188. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/openai-responses-shared.js +0 -479
  189. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/utils/oauth/openai-codex.js +0 -374
  190. package/node_modules/@mariozechner/pi-ai/dist/api-registry.js +0 -44
  191. package/node_modules/@mariozechner/pi-ai/dist/bedrock-provider.js +0 -6
  192. package/node_modules/@mariozechner/pi-ai/dist/models.js +0 -71
  193. package/node_modules/@mariozechner/pi-ai/dist/oauth.js +0 -2
  194. package/node_modules/@mariozechner/pi-ai/dist/providers/anthropic.js +0 -951
  195. package/node_modules/@mariozechner/pi-ai/dist/providers/azure-openai-responses.js +0 -208
  196. package/node_modules/@mariozechner/pi-ai/dist/providers/cloudflare.js +0 -26
  197. package/node_modules/@mariozechner/pi-ai/dist/providers/faux.js +0 -368
  198. package/node_modules/@mariozechner/pi-ai/dist/providers/github-copilot-headers.js +0 -29
  199. package/node_modules/@mariozechner/pi-ai/dist/providers/google-shared.js +0 -329
  200. package/node_modules/@mariozechner/pi-ai/dist/providers/google-vertex.js +0 -442
  201. package/node_modules/@mariozechner/pi-ai/dist/providers/google.js +0 -400
  202. package/node_modules/@mariozechner/pi-ai/dist/providers/mistral.js +0 -535
  203. package/node_modules/@mariozechner/pi-ai/dist/providers/openai-completions.js +0 -908
  204. package/node_modules/@mariozechner/pi-ai/dist/providers/openai-responses.js +0 -220
  205. package/node_modules/@mariozechner/pi-ai/dist/providers/register-builtins.js +0 -243
  206. package/node_modules/@mariozechner/pi-ai/dist/providers/simple-options.js +0 -39
  207. package/node_modules/@mariozechner/pi-ai/dist/providers/transform-messages.js +0 -184
  208. package/node_modules/@mariozechner/pi-ai/dist/stream.js +0 -27
  209. package/node_modules/@mariozechner/pi-ai/dist/types.js +0 -2
  210. package/node_modules/@mariozechner/pi-ai/dist/utils/event-stream.js +0 -81
  211. package/node_modules/@mariozechner/pi-ai/dist/utils/hash.js +0 -14
  212. package/node_modules/@mariozechner/pi-ai/dist/utils/headers.js +0 -8
  213. package/node_modules/@mariozechner/pi-ai/dist/utils/json-parse.js +0 -113
  214. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/anthropic.js +0 -335
  215. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/github-copilot.js +0 -292
  216. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/index.js +0 -121
  217. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/oauth-page.js +0 -105
  218. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/pkce.js +0 -31
  219. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/types.js +0 -2
  220. package/node_modules/@mariozechner/pi-ai/dist/utils/overflow.js +0 -146
  221. package/node_modules/@mariozechner/pi-ai/dist/utils/sanitize-unicode.js +0 -26
  222. package/node_modules/@mariozechner/pi-ai/dist/utils/typebox-helpers.js +0 -21
  223. package/node_modules/@mariozechner/pi-ai/dist/utils/validation.js +0 -281
  224. package/node_modules/@mariozechner/pi-ai/package.json +0 -108
  225. package/node_modules/@mariozechner/pi-coding-agent/dist/bun/register-bedrock.js +0 -4
  226. package/node_modules/@mariozechner/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js +0 -22
  227. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/agent-loop.js +0 -458
  228. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/agent.js +0 -398
  229. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/index.js +0 -9
  230. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/proxy.js +0 -278
  231. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/types.js +0 -2
  232. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/package.json +0 -45
  233. package/node_modules/socks/.claude/settings.local.json +0 -26
  234. package/node_modules/std-env/LICENCE +0 -22
  235. package/node_modules/std-env/README.md +0 -118
  236. package/node_modules/std-env/dist/index.cjs +0 -1
  237. package/node_modules/std-env/dist/index.d.cts +0 -92
  238. package/node_modules/std-env/dist/index.d.mts +0 -92
  239. package/node_modules/std-env/dist/index.d.ts +0 -92
  240. package/node_modules/std-env/dist/index.mjs +0 -1
  241. package/node_modules/std-env/package.json +0 -46
  242. package/node_modules/yoctocolors/base.d.ts +0 -47
  243. package/node_modules/yoctocolors/base.js +0 -94
  244. package/node_modules/yoctocolors/index.d.ts +0 -2
  245. package/node_modules/yoctocolors/index.js +0 -2
  246. package/node_modules/yoctocolors/license +0 -9
  247. package/node_modules/yoctocolors/package.json +0 -69
  248. package/node_modules/yoctocolors/readme.md +0 -138
  249. /package/node_modules/{@mariozechner/pi-coding-agent/dist/core → @earendil-works/pi-agent-core/dist/harness}/compaction/utils.js +0 -0
  250. /package/node_modules/{@mariozechner/pi-coding-agent/dist/core/tools → @earendil-works/pi-agent-core/dist/harness/utils}/truncate.js +0 -0
  251. /package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/types.js +0 -0
  252. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/api-registry.js +0 -0
  253. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/bedrock-provider.js +0 -0
  254. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/models.js +0 -0
  255. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/oauth.js +0 -0
  256. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/amazon-bedrock.js +0 -0
  257. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/anthropic.js +0 -0
  258. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/azure-openai-responses.js +0 -0
  259. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/cloudflare.js +0 -0
  260. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/faux.js +0 -0
  261. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/github-copilot-headers.js +0 -0
  262. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google-shared.js +0 -0
  263. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google-vertex.js +0 -0
  264. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google.js +0 -0
  265. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/mistral.js +0 -0
  266. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-responses.js +0 -0
  267. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/register-builtins.js +0 -0
  268. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/simple-options.js +0 -0
  269. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/transform-messages.js +0 -0
  270. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/session-resources.js +0 -0
  271. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/stream.js +0 -0
  272. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/types.js +0 -0
  273. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/utils/diagnostics.js +0 -0
  274. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/event-stream.js +0 -0
  275. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/hash.js +0 -0
  276. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/headers.js +0 -0
  277. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/json-parse.js +0 -0
  278. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/anthropic.js +0 -0
  279. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/github-copilot.js +0 -0
  280. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/index.js +0 -0
  281. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/oauth-page.js +0 -0
  282. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/pkce.js +0 -0
  283. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/types.js +0 -0
  284. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/sanitize-unicode.js +0 -0
  285. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/typebox-helpers.js +0 -0
  286. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/validation.js +0 -0
  287. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/bun/cli.js +0 -0
  288. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/bun/restore-sandbox-env.js +0 -0
  289. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/file-processor.js +0 -0
  290. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/initial-message.js +0 -0
  291. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli.js +0 -0
  292. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session-runtime.js +0 -0
  293. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session-services.js +0 -0
  294. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/auth-guidance.js +0 -0
  295. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/bash-executor.js +0 -0
  296. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/index.js +0 -0
  297. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/defaults.js +0 -0
  298. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/diagnostics.js +0 -0
  299. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/event-bus.js +0 -0
  300. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/exec.js +0 -0
  301. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/ansi-to-html.js +0 -0
  302. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/index.js +0 -0
  303. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.html +0 -0
  304. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/tool-renderer.js +0 -0
  305. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/vendor/highlight.min.js +0 -0
  306. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/vendor/marked.min.js +0 -0
  307. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/index.js +0 -0
  308. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/runner.js +0 -0
  309. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/types.js +0 -0
  310. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/wrapper.js +0 -0
  311. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/footer-data-provider.js +0 -0
  312. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/index.js +0 -0
  313. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/messages.js +0 -0
  314. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/output-guard.js +0 -0
  315. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/prompt-templates.js +0 -0
  316. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/resolve-config-value.js +0 -0
  317. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/resource-loader.js +0 -0
  318. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/session-cwd.js +0 -0
  319. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/session-manager.js +0 -0
  320. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/settings-manager.js +0 -0
  321. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/skills.js +0 -0
  322. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/slash-commands.js +0 -0
  323. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/source-info.js +0 -0
  324. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/system-prompt.js +0 -0
  325. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/telemetry.js +0 -0
  326. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/timings.js +0 -0
  327. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/edit-diff.js +0 -0
  328. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/file-mutation-queue.js +0 -0
  329. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/index.js +0 -0
  330. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/output-accumulator.js +0 -0
  331. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/path-utils.js +0 -0
  332. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/tool-definition-wrapper.js +0 -0
  333. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/index.js +0 -0
  334. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/index.js +0 -0
  335. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/assets/clankolas.png +0 -0
  336. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/armin.js +0 -0
  337. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +0 -0
  338. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/daxnuts.js +0 -0
  339. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/diff.js +0 -0
  340. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +0 -0
  341. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/index.js +0 -0
  342. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -0
  343. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/print-mode.js +0 -0
  344. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/jsonl.js +0 -0
  345. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-client.js +0 -0
  346. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-mode.js +0 -0
  347. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-types.js +0 -0
  348. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/changelog.js +0 -0
  349. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/child-process.js +0 -0
  350. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard-image.js +0 -0
  351. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard-native.js +0 -0
  352. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/exif-orientation.js +0 -0
  353. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/frontmatter.js +0 -0
  354. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/fs-watch.js +0 -0
  355. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/git.js +0 -0
  356. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/image-convert.js +0 -0
  357. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/image-resize.js +0 -0
  358. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/mime.js +0 -0
  359. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/photon.js +0 -0
  360. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/pi-user-agent.js +0 -0
  361. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/shell.js +0 -0
  362. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/sleep.js +0 -0
  363. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/tools-manager.js +0 -0
  364. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/autocomplete.js +0 -0
  365. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/box.js +0 -0
  366. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/cancellable-loader.js +0 -0
  367. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/editor.js +0 -0
  368. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/input.js +0 -0
  369. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/loader.js +0 -0
  370. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/select-list.js +0 -0
  371. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/settings-list.js +0 -0
  372. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/spacer.js +0 -0
  373. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/text.js +0 -0
  374. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/truncated-text.js +0 -0
  375. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/editor-component.js +0 -0
  376. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/fuzzy.js +0 -0
  377. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/index.js +0 -0
  378. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/keybindings.js +0 -0
  379. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/keys.js +0 -0
  380. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/kill-ring.js +0 -0
  381. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/stdin-buffer.js +0 -0
  382. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/terminal.js +0 -0
  383. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/undo-stack.js +0 -0
  384. /package/node_modules/{@mariozechner/jiti → jiti}/LICENSE +0 -0
  385. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-cli.mjs +0 -0
  386. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-hooks.mjs +0 -0
  387. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-native.mjs +0 -0
  388. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-register.d.mts +0 -0
  389. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-register.mjs +0 -0
  390. /package/node_modules/{@mariozechner/jiti/lib/jiti.mjs → jiti/lib/jiti-static.mjs} +0 -0
  391. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.cjs +0 -0
  392. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.d.cts +0 -0
  393. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.d.mts +0 -0
@@ -1,208 +0,0 @@
1
- import { AzureOpenAI } from "openai";
2
- import { getEnvApiKey } from "../env-api-keys.js";
3
- import { clampThinkingLevel } from "../models.js";
4
- import { AssistantMessageEventStream } from "../utils/event-stream.js";
5
- import { headersToRecord } from "../utils/headers.js";
6
- import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
7
- import { buildBaseOptions } from "./simple-options.js";
8
- const DEFAULT_AZURE_API_VERSION = "v1";
9
- const AZURE_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode", "azure-openai-responses"]);
10
- function parseDeploymentNameMap(value) {
11
- const map = new Map();
12
- if (!value)
13
- return map;
14
- for (const entry of value.split(",")) {
15
- const trimmed = entry.trim();
16
- if (!trimmed)
17
- continue;
18
- const [modelId, deploymentName] = trimmed.split("=", 2);
19
- if (!modelId || !deploymentName)
20
- continue;
21
- map.set(modelId.trim(), deploymentName.trim());
22
- }
23
- return map;
24
- }
25
- function resolveDeploymentName(model, options) {
26
- if (options?.azureDeploymentName) {
27
- return options.azureDeploymentName;
28
- }
29
- const mappedDeployment = parseDeploymentNameMap(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(model.id);
30
- return mappedDeployment || model.id;
31
- }
32
- /**
33
- * Generate function for Azure OpenAI Responses API
34
- */
35
- export const streamAzureOpenAIResponses = (model, context, options) => {
36
- const stream = new AssistantMessageEventStream();
37
- // Start async processing
38
- (async () => {
39
- const deploymentName = resolveDeploymentName(model, options);
40
- const output = {
41
- role: "assistant",
42
- content: [],
43
- api: "azure-openai-responses",
44
- provider: model.provider,
45
- model: model.id,
46
- usage: {
47
- input: 0,
48
- output: 0,
49
- cacheRead: 0,
50
- cacheWrite: 0,
51
- totalTokens: 0,
52
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
53
- },
54
- stopReason: "stop",
55
- timestamp: Date.now(),
56
- };
57
- try {
58
- // Create Azure OpenAI client
59
- const apiKey = options?.apiKey || getEnvApiKey(model.provider) || "";
60
- const client = createClient(model, apiKey, options);
61
- let params = buildParams(model, context, options, deploymentName);
62
- const nextParams = await options?.onPayload?.(params, model);
63
- if (nextParams !== undefined) {
64
- params = nextParams;
65
- }
66
- const requestOptions = {
67
- ...(options?.signal ? { signal: options.signal } : {}),
68
- ...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),
69
- ...(options?.maxRetries !== undefined ? { maxRetries: options.maxRetries } : {}),
70
- };
71
- const { data: openaiStream, response } = await client.responses.create(params, requestOptions).withResponse();
72
- await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
73
- stream.push({ type: "start", partial: output });
74
- await processResponsesStream(openaiStream, output, stream, model);
75
- if (options?.signal?.aborted) {
76
- throw new Error("Request was aborted");
77
- }
78
- if (output.stopReason === "aborted" || output.stopReason === "error") {
79
- throw new Error("An unknown error occurred");
80
- }
81
- stream.push({ type: "done", reason: output.stopReason, message: output });
82
- stream.end();
83
- }
84
- catch (error) {
85
- for (const block of output.content) {
86
- delete block.index;
87
- // partialJson is only a streaming scratch buffer; never persist it.
88
- delete block.partialJson;
89
- }
90
- output.stopReason = options?.signal?.aborted ? "aborted" : "error";
91
- output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
92
- stream.push({ type: "error", reason: output.stopReason, error: output });
93
- stream.end();
94
- }
95
- })();
96
- return stream;
97
- };
98
- export const streamSimpleAzureOpenAIResponses = (model, context, options) => {
99
- const apiKey = options?.apiKey || getEnvApiKey(model.provider);
100
- if (!apiKey) {
101
- throw new Error(`No API key for provider: ${model.provider}`);
102
- }
103
- const base = buildBaseOptions(model, options, apiKey);
104
- const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;
105
- const reasoningEffort = clampedReasoning === "off" ? undefined : clampedReasoning;
106
- return streamAzureOpenAIResponses(model, context, {
107
- ...base,
108
- reasoningEffort,
109
- });
110
- };
111
- function normalizeAzureBaseUrl(baseUrl) {
112
- const trimmed = baseUrl.trim().replace(/\/+$/, "");
113
- let url;
114
- try {
115
- url = new URL(trimmed);
116
- }
117
- catch {
118
- throw new Error(`Invalid Azure OpenAI base URL: ${baseUrl}`);
119
- }
120
- const isAzureHost = url.hostname.endsWith(".openai.azure.com") || url.hostname.endsWith(".cognitiveservices.azure.com");
121
- const normalizedPath = url.pathname.replace(/\/+$/, "");
122
- // Ensure Azure hosts have /openai/v1 as base path so the AzureOpenAI SDK
123
- // can append /deployments/<model>/... and ?api-version=v1 correctly.
124
- if (isAzureHost && (normalizedPath === "" || normalizedPath === "/" || normalizedPath === "/openai")) {
125
- url.pathname = "/openai/v1";
126
- url.search = "";
127
- }
128
- return url.toString().replace(/\/+$/, "");
129
- }
130
- function buildDefaultBaseUrl(resourceName) {
131
- return `https://${resourceName}.openai.azure.com/openai/v1`;
132
- }
133
- function resolveAzureConfig(model, options) {
134
- const apiVersion = options?.azureApiVersion || process.env.AZURE_OPENAI_API_VERSION || DEFAULT_AZURE_API_VERSION;
135
- const baseUrl = options?.azureBaseUrl?.trim() || process.env.AZURE_OPENAI_BASE_URL?.trim() || undefined;
136
- const resourceName = options?.azureResourceName || process.env.AZURE_OPENAI_RESOURCE_NAME;
137
- let resolvedBaseUrl = baseUrl;
138
- if (!resolvedBaseUrl && resourceName) {
139
- resolvedBaseUrl = buildDefaultBaseUrl(resourceName);
140
- }
141
- if (!resolvedBaseUrl && model.baseUrl) {
142
- resolvedBaseUrl = model.baseUrl;
143
- }
144
- if (!resolvedBaseUrl) {
145
- throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");
146
- }
147
- return {
148
- baseUrl: normalizeAzureBaseUrl(resolvedBaseUrl),
149
- apiVersion,
150
- };
151
- }
152
- function createClient(model, apiKey, options) {
153
- if (!apiKey) {
154
- if (!process.env.AZURE_OPENAI_API_KEY) {
155
- throw new Error("Azure OpenAI API key is required. Set AZURE_OPENAI_API_KEY environment variable or pass it as an argument.");
156
- }
157
- apiKey = process.env.AZURE_OPENAI_API_KEY;
158
- }
159
- const headers = { ...model.headers };
160
- if (options?.headers) {
161
- Object.assign(headers, options.headers);
162
- }
163
- const { baseUrl, apiVersion } = resolveAzureConfig(model, options);
164
- return new AzureOpenAI({
165
- apiKey,
166
- apiVersion,
167
- dangerouslyAllowBrowser: true,
168
- defaultHeaders: headers,
169
- baseURL: baseUrl,
170
- });
171
- }
172
- function buildParams(model, context, options, deploymentName) {
173
- const messages = convertResponsesMessages(model, context, AZURE_TOOL_CALL_PROVIDERS);
174
- const params = {
175
- model: deploymentName,
176
- input: messages,
177
- stream: true,
178
- prompt_cache_key: options?.sessionId,
179
- };
180
- if (options?.maxTokens) {
181
- params.max_output_tokens = options?.maxTokens;
182
- }
183
- if (options?.temperature !== undefined) {
184
- params.temperature = options?.temperature;
185
- }
186
- if (context.tools && context.tools.length > 0) {
187
- params.tools = convertResponsesTools(context.tools);
188
- }
189
- if (model.reasoning) {
190
- if (options?.reasoningEffort || options?.reasoningSummary) {
191
- const effort = options?.reasoningEffort
192
- ? (model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort)
193
- : "medium";
194
- params.reasoning = {
195
- effort: effort,
196
- summary: options?.reasoningSummary || "auto",
197
- };
198
- params.include = ["reasoning.encrypted_content"];
199
- }
200
- else if (model.thinkingLevelMap?.off !== null) {
201
- params.reasoning = {
202
- effort: (model.thinkingLevelMap?.off ?? "none"),
203
- };
204
- }
205
- }
206
- return params;
207
- }
208
- //# sourceMappingURL=azure-openai-responses.js.map
@@ -1,26 +0,0 @@
1
- /** Workers AI direct endpoint. */
2
- export const CLOUDFLARE_WORKERS_AI_BASE_URL = "https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1";
3
- /** AI Gateway Unified API. https://developers.cloudflare.com/ai-gateway/usage/unified-api/ */
4
- export const CLOUDFLARE_AI_GATEWAY_COMPAT_BASE_URL = "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat";
5
- /** AI Gateway → OpenAI passthrough. Used until /compat supports /v1/responses. */
6
- export const CLOUDFLARE_AI_GATEWAY_OPENAI_BASE_URL = "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai";
7
- /** AI Gateway → Anthropic passthrough. */
8
- export const CLOUDFLARE_AI_GATEWAY_ANTHROPIC_BASE_URL = "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic";
9
- export function isCloudflareProvider(provider) {
10
- return provider === "cloudflare-workers-ai" || provider === "cloudflare-ai-gateway";
11
- }
12
- /** Substitute `{VAR}` placeholders in a Cloudflare baseUrl from process.env. */
13
- export function resolveCloudflareBaseUrl(model) {
14
- const url = model.baseUrl;
15
- if (!url.includes("{"))
16
- return url;
17
- const baseUrl = url.replace(/\{([A-Z_][A-Z0-9_]*)\}/g, (_match, name) => {
18
- const value = process.env[name];
19
- if (!value) {
20
- throw new Error(`${name} is required for provider ${model.provider} but is not set.`);
21
- }
22
- return value;
23
- });
24
- return baseUrl;
25
- }
26
- //# sourceMappingURL=cloudflare.js.map
@@ -1,368 +0,0 @@
1
- import { registerApiProvider, unregisterApiProviders } from "../api-registry.js";
2
- import { createAssistantMessageEventStream } from "../utils/event-stream.js";
3
- const DEFAULT_API = "faux";
4
- const DEFAULT_PROVIDER = "faux";
5
- const DEFAULT_MODEL_ID = "faux-1";
6
- const DEFAULT_MODEL_NAME = "Faux Model";
7
- const DEFAULT_BASE_URL = "http://localhost:0";
8
- const DEFAULT_MIN_TOKEN_SIZE = 3;
9
- const DEFAULT_MAX_TOKEN_SIZE = 5;
10
- const DEFAULT_USAGE = {
11
- input: 0,
12
- output: 0,
13
- cacheRead: 0,
14
- cacheWrite: 0,
15
- totalTokens: 0,
16
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
17
- };
18
- export function fauxText(text) {
19
- return { type: "text", text };
20
- }
21
- export function fauxThinking(thinking) {
22
- return { type: "thinking", thinking };
23
- }
24
- export function fauxToolCall(name, arguments_, options = {}) {
25
- return {
26
- type: "toolCall",
27
- id: options.id ?? randomId("tool"),
28
- name,
29
- arguments: arguments_,
30
- };
31
- }
32
- function normalizeFauxAssistantContent(content) {
33
- if (typeof content === "string") {
34
- return [fauxText(content)];
35
- }
36
- return Array.isArray(content) ? content : [content];
37
- }
38
- export function fauxAssistantMessage(content, options = {}) {
39
- return {
40
- role: "assistant",
41
- content: normalizeFauxAssistantContent(content),
42
- api: DEFAULT_API,
43
- provider: DEFAULT_PROVIDER,
44
- model: DEFAULT_MODEL_ID,
45
- usage: DEFAULT_USAGE,
46
- stopReason: options.stopReason ?? "stop",
47
- errorMessage: options.errorMessage,
48
- responseId: options.responseId,
49
- timestamp: options.timestamp ?? Date.now(),
50
- };
51
- }
52
- function estimateTokens(text) {
53
- return Math.ceil(text.length / 4);
54
- }
55
- function randomId(prefix) {
56
- return `${prefix}:${Date.now()}:${Math.random().toString(36).slice(2)}`;
57
- }
58
- function contentToText(content) {
59
- if (typeof content === "string") {
60
- return content;
61
- }
62
- return content
63
- .map((block) => {
64
- if (block.type === "text") {
65
- return block.text;
66
- }
67
- return `[image:${block.mimeType}:${block.data.length}]`;
68
- })
69
- .join("\n");
70
- }
71
- function assistantContentToText(content) {
72
- return content
73
- .map((block) => {
74
- if (block.type === "text") {
75
- return block.text;
76
- }
77
- if (block.type === "thinking") {
78
- return block.thinking;
79
- }
80
- return `${block.name}:${JSON.stringify(block.arguments)}`;
81
- })
82
- .join("\n");
83
- }
84
- function toolResultToText(message) {
85
- return [message.toolName, ...message.content.map((block) => contentToText([block]))].join("\n");
86
- }
87
- function messageToText(message) {
88
- if (message.role === "user") {
89
- return contentToText(message.content);
90
- }
91
- if (message.role === "assistant") {
92
- return assistantContentToText(message.content);
93
- }
94
- return toolResultToText(message);
95
- }
96
- function serializeContext(context) {
97
- const parts = [];
98
- if (context.systemPrompt) {
99
- parts.push(`system:${context.systemPrompt}`);
100
- }
101
- for (const message of context.messages) {
102
- parts.push(`${message.role}:${messageToText(message)}`);
103
- }
104
- if (context.tools?.length) {
105
- parts.push(`tools:${JSON.stringify(context.tools)}`);
106
- }
107
- return parts.join("\n\n");
108
- }
109
- function commonPrefixLength(a, b) {
110
- const length = Math.min(a.length, b.length);
111
- let index = 0;
112
- while (index < length && a[index] === b[index]) {
113
- index++;
114
- }
115
- return index;
116
- }
117
- function withUsageEstimate(message, context, options, promptCache) {
118
- const promptText = serializeContext(context);
119
- const promptTokens = estimateTokens(promptText);
120
- const outputTokens = estimateTokens(assistantContentToText(message.content));
121
- let input = promptTokens;
122
- let cacheRead = 0;
123
- let cacheWrite = 0;
124
- const sessionId = options?.sessionId;
125
- if (sessionId && options?.cacheRetention !== "none") {
126
- const previousPrompt = promptCache.get(sessionId);
127
- if (previousPrompt) {
128
- const cachedChars = commonPrefixLength(previousPrompt, promptText);
129
- cacheRead = estimateTokens(previousPrompt.slice(0, cachedChars));
130
- cacheWrite = estimateTokens(promptText.slice(cachedChars));
131
- input = Math.max(0, promptTokens - cacheRead);
132
- }
133
- else {
134
- cacheWrite = promptTokens;
135
- }
136
- promptCache.set(sessionId, promptText);
137
- }
138
- return {
139
- ...message,
140
- usage: {
141
- input,
142
- output: outputTokens,
143
- cacheRead,
144
- cacheWrite,
145
- totalTokens: input + outputTokens + cacheRead + cacheWrite,
146
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
147
- },
148
- };
149
- }
150
- function splitStringByTokenSize(text, minTokenSize, maxTokenSize) {
151
- const chunks = [];
152
- let index = 0;
153
- while (index < text.length) {
154
- const tokenSize = minTokenSize + Math.floor(Math.random() * (maxTokenSize - minTokenSize + 1));
155
- const charSize = Math.max(1, tokenSize * 4);
156
- chunks.push(text.slice(index, index + charSize));
157
- index += charSize;
158
- }
159
- return chunks.length > 0 ? chunks : [""];
160
- }
161
- function cloneMessage(message, api, provider, modelId) {
162
- const cloned = structuredClone(message);
163
- return {
164
- ...cloned,
165
- api,
166
- provider,
167
- model: modelId,
168
- timestamp: cloned.timestamp ?? Date.now(),
169
- usage: cloned.usage ?? DEFAULT_USAGE,
170
- };
171
- }
172
- function createErrorMessage(error, api, provider, modelId) {
173
- return {
174
- role: "assistant",
175
- content: [],
176
- api,
177
- provider,
178
- model: modelId,
179
- usage: DEFAULT_USAGE,
180
- stopReason: "error",
181
- errorMessage: error instanceof Error ? error.message : String(error),
182
- timestamp: Date.now(),
183
- };
184
- }
185
- function createAbortedMessage(partial) {
186
- return {
187
- ...partial,
188
- stopReason: "aborted",
189
- errorMessage: "Request was aborted",
190
- timestamp: Date.now(),
191
- };
192
- }
193
- function scheduleChunk(chunk, tokensPerSecond) {
194
- if (!tokensPerSecond || tokensPerSecond <= 0) {
195
- return new Promise((resolve) => queueMicrotask(resolve));
196
- }
197
- const delayMs = (estimateTokens(chunk) / tokensPerSecond) * 1000;
198
- return new Promise((resolve) => setTimeout(resolve, delayMs));
199
- }
200
- async function streamWithDeltas(stream, message, minTokenSize, maxTokenSize, tokensPerSecond, signal) {
201
- const partial = { ...message, content: [] };
202
- if (signal?.aborted) {
203
- const aborted = createAbortedMessage(partial);
204
- stream.push({ type: "error", reason: "aborted", error: aborted });
205
- stream.end(aborted);
206
- return;
207
- }
208
- stream.push({ type: "start", partial: { ...partial } });
209
- for (let index = 0; index < message.content.length; index++) {
210
- if (signal?.aborted) {
211
- const aborted = createAbortedMessage(partial);
212
- stream.push({ type: "error", reason: "aborted", error: aborted });
213
- stream.end(aborted);
214
- return;
215
- }
216
- const block = message.content[index];
217
- if (block.type === "thinking") {
218
- partial.content = [...partial.content, { type: "thinking", thinking: "" }];
219
- stream.push({ type: "thinking_start", contentIndex: index, partial: { ...partial } });
220
- for (const chunk of splitStringByTokenSize(block.thinking, minTokenSize, maxTokenSize)) {
221
- await scheduleChunk(chunk, tokensPerSecond);
222
- if (signal?.aborted) {
223
- const aborted = createAbortedMessage(partial);
224
- stream.push({ type: "error", reason: "aborted", error: aborted });
225
- stream.end(aborted);
226
- return;
227
- }
228
- partial.content[index].thinking += chunk;
229
- stream.push({ type: "thinking_delta", contentIndex: index, delta: chunk, partial: { ...partial } });
230
- }
231
- stream.push({
232
- type: "thinking_end",
233
- contentIndex: index,
234
- content: block.thinking,
235
- partial: { ...partial },
236
- });
237
- continue;
238
- }
239
- if (block.type === "text") {
240
- partial.content = [...partial.content, { type: "text", text: "" }];
241
- stream.push({ type: "text_start", contentIndex: index, partial: { ...partial } });
242
- for (const chunk of splitStringByTokenSize(block.text, minTokenSize, maxTokenSize)) {
243
- await scheduleChunk(chunk, tokensPerSecond);
244
- if (signal?.aborted) {
245
- const aborted = createAbortedMessage(partial);
246
- stream.push({ type: "error", reason: "aborted", error: aborted });
247
- stream.end(aborted);
248
- return;
249
- }
250
- partial.content[index].text += chunk;
251
- stream.push({ type: "text_delta", contentIndex: index, delta: chunk, partial: { ...partial } });
252
- }
253
- stream.push({ type: "text_end", contentIndex: index, content: block.text, partial: { ...partial } });
254
- continue;
255
- }
256
- partial.content = [...partial.content, { type: "toolCall", id: block.id, name: block.name, arguments: {} }];
257
- stream.push({ type: "toolcall_start", contentIndex: index, partial: { ...partial } });
258
- for (const chunk of splitStringByTokenSize(JSON.stringify(block.arguments), minTokenSize, maxTokenSize)) {
259
- await scheduleChunk(chunk, tokensPerSecond);
260
- if (signal?.aborted) {
261
- const aborted = createAbortedMessage(partial);
262
- stream.push({ type: "error", reason: "aborted", error: aborted });
263
- stream.end(aborted);
264
- return;
265
- }
266
- stream.push({ type: "toolcall_delta", contentIndex: index, delta: chunk, partial: { ...partial } });
267
- }
268
- partial.content[index].arguments = block.arguments;
269
- stream.push({ type: "toolcall_end", contentIndex: index, toolCall: block, partial: { ...partial } });
270
- }
271
- if (message.stopReason === "error" || message.stopReason === "aborted") {
272
- stream.push({ type: "error", reason: message.stopReason, error: message });
273
- stream.end(message);
274
- return;
275
- }
276
- stream.push({ type: "done", reason: message.stopReason, message });
277
- stream.end(message);
278
- }
279
- export function registerFauxProvider(options = {}) {
280
- const api = options.api ?? randomId(DEFAULT_API);
281
- const provider = options.provider ?? DEFAULT_PROVIDER;
282
- const sourceId = randomId("faux-provider");
283
- const minTokenSize = Math.max(1, Math.min(options.tokenSize?.min ?? DEFAULT_MIN_TOKEN_SIZE, options.tokenSize?.max ?? DEFAULT_MAX_TOKEN_SIZE));
284
- const maxTokenSize = Math.max(minTokenSize, options.tokenSize?.max ?? DEFAULT_MAX_TOKEN_SIZE);
285
- let pendingResponses = [];
286
- const tokensPerSecond = options.tokensPerSecond;
287
- const state = { callCount: 0 };
288
- const promptCache = new Map();
289
- const modelDefinitions = options.models?.length
290
- ? options.models
291
- : [
292
- {
293
- id: DEFAULT_MODEL_ID,
294
- name: DEFAULT_MODEL_NAME,
295
- reasoning: false,
296
- input: ["text", "image"],
297
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
298
- contextWindow: 128000,
299
- maxTokens: 16384,
300
- },
301
- ];
302
- const models = modelDefinitions.map((definition) => ({
303
- id: definition.id,
304
- name: definition.name ?? definition.id,
305
- api,
306
- provider,
307
- baseUrl: DEFAULT_BASE_URL,
308
- reasoning: definition.reasoning ?? false,
309
- input: definition.input ?? ["text", "image"],
310
- cost: definition.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
311
- contextWindow: definition.contextWindow ?? 128000,
312
- maxTokens: definition.maxTokens ?? 16384,
313
- }));
314
- const stream = (requestModel, context, streamOptions) => {
315
- const outer = createAssistantMessageEventStream();
316
- const step = pendingResponses.shift();
317
- state.callCount++;
318
- queueMicrotask(async () => {
319
- try {
320
- await streamOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);
321
- if (!step) {
322
- let message = createErrorMessage(new Error("No more faux responses queued"), api, provider, requestModel.id);
323
- message = withUsageEstimate(message, context, streamOptions, promptCache);
324
- outer.push({ type: "error", reason: "error", error: message });
325
- outer.end(message);
326
- return;
327
- }
328
- const resolved = typeof step === "function" ? await step(context, streamOptions, state, requestModel) : step;
329
- let message = cloneMessage(resolved, api, provider, requestModel.id);
330
- message = withUsageEstimate(message, context, streamOptions, promptCache);
331
- await streamWithDeltas(outer, message, minTokenSize, maxTokenSize, tokensPerSecond, streamOptions?.signal);
332
- }
333
- catch (error) {
334
- const message = createErrorMessage(error, api, provider, requestModel.id);
335
- outer.push({ type: "error", reason: "error", error: message });
336
- outer.end(message);
337
- }
338
- });
339
- return outer;
340
- };
341
- const streamSimple = (streamModel, context, streamOptions) => stream(streamModel, context, streamOptions);
342
- registerApiProvider({ api, stream, streamSimple }, sourceId);
343
- function getModel(requestedModelId) {
344
- if (!requestedModelId) {
345
- return models[0];
346
- }
347
- return models.find((candidate) => candidate.id === requestedModelId);
348
- }
349
- return {
350
- api,
351
- models,
352
- getModel,
353
- state,
354
- setResponses(responses) {
355
- pendingResponses = [...responses];
356
- },
357
- appendResponses(responses) {
358
- pendingResponses.push(...responses);
359
- },
360
- getPendingResponseCount() {
361
- return pendingResponses.length;
362
- },
363
- unregister() {
364
- unregisterApiProviders(sourceId);
365
- },
366
- };
367
- }
368
- //# sourceMappingURL=faux.js.map
@@ -1,29 +0,0 @@
1
- // Copilot expects X-Initiator to indicate whether the request is user-initiated
2
- // or agent-initiated (e.g. follow-up after assistant/tool messages).
3
- export function inferCopilotInitiator(messages) {
4
- const last = messages[messages.length - 1];
5
- return last && last.role !== "user" ? "agent" : "user";
6
- }
7
- // Copilot requires Copilot-Vision-Request header when sending images
8
- export function hasCopilotVisionInput(messages) {
9
- return messages.some((msg) => {
10
- if (msg.role === "user" && Array.isArray(msg.content)) {
11
- return msg.content.some((c) => c.type === "image");
12
- }
13
- if (msg.role === "toolResult" && Array.isArray(msg.content)) {
14
- return msg.content.some((c) => c.type === "image");
15
- }
16
- return false;
17
- });
18
- }
19
- export function buildCopilotDynamicHeaders(params) {
20
- const headers = {
21
- "X-Initiator": inferCopilotInitiator(params.messages),
22
- "Openai-Intent": "conversation-edits",
23
- };
24
- if (params.hasImages) {
25
- headers["Copilot-Vision-Request"] = "true";
26
- }
27
- return headers;
28
- }
29
- //# sourceMappingURL=github-copilot-headers.js.map