@code-yeongyu/senpi 2026.5.20-3 → 2026.5.21

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 (794) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +4 -10
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +10 -4
  7. package/dist/config.js.map +1 -1
  8. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  9. package/dist/core/agent-session-runtime.js +2 -3
  10. package/dist/core/agent-session-runtime.js.map +1 -1
  11. package/dist/core/http-dispatcher.d.ts +21 -0
  12. package/dist/core/http-dispatcher.d.ts.map +1 -0
  13. package/dist/core/http-dispatcher.js +48 -0
  14. package/dist/core/http-dispatcher.js.map +1 -0
  15. package/dist/core/package-manager.d.ts.map +1 -1
  16. package/dist/core/package-manager.js +2 -1
  17. package/dist/core/package-manager.js.map +1 -1
  18. package/dist/core/settings-manager.d.ts +3 -0
  19. package/dist/core/settings-manager.d.ts.map +1 -1
  20. package/dist/core/settings-manager.js +20 -0
  21. package/dist/core/settings-manager.js.map +1 -1
  22. package/dist/main.d.ts.map +1 -1
  23. package/dist/main.js +2 -0
  24. package/dist/main.js.map +1 -1
  25. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  26. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  27. package/dist/modes/interactive/components/settings-selector.js +15 -0
  28. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  29. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  30. package/dist/modes/interactive/interactive-mode.js +10 -1
  31. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  32. package/dist/senpi +4 -10
  33. package/dist/utils/paths.d.ts +1 -0
  34. package/dist/utils/paths.d.ts.map +1 -1
  35. package/dist/utils/paths.js +16 -0
  36. package/dist/utils/paths.js.map +1 -1
  37. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  38. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  39. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  40. package/examples/extensions/sandbox/package-lock.json +2 -2
  41. package/examples/extensions/sandbox/package.json +2 -2
  42. package/examples/extensions/with-deps/package-lock.json +2 -2
  43. package/examples/extensions/with-deps/package.json +3 -3
  44. package/node_modules/@earendil-works/pi-agent-core/README.md +488 -0
  45. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +24 -0
  46. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -0
  47. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +610 -0
  48. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -0
  49. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +120 -0
  50. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -0
  51. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +405 -0
  52. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -0
  53. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +92 -0
  54. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
  55. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +904 -0
  56. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -0
  57. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +53 -0
  58. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
  59. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +174 -0
  60. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
  61. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +95 -0
  62. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
  63. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +533 -0
  64. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -0
  65. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +25 -0
  66. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
  67. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +131 -0
  68. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -0
  69. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +51 -0
  70. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
  71. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +486 -0
  72. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -0
  73. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +52 -0
  74. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -0
  75. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
  76. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -0
  77. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +48 -0
  78. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
  79. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +230 -0
  80. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -0
  81. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
  82. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
  83. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +101 -0
  84. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
  85. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +33 -0
  86. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
  87. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +231 -0
  88. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
  89. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
  90. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
  91. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +42 -0
  92. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +1 -0
  93. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +25 -0
  94. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
  95. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +114 -0
  96. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -0
  97. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
  98. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
  99. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +39 -0
  100. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -0
  101. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +32 -0
  102. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -0
  103. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +197 -0
  104. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -0
  105. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts +2 -0
  106. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts.map +1 -0
  107. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js +50 -0
  108. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js.map +1 -0
  109. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +44 -0
  110. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -0
  111. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +311 -0
  112. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -0
  113. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +3 -0
  114. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
  115. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
  116. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js.map +1 -0
  117. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +604 -0
  118. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -0
  119. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +103 -0
  120. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -0
  121. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +14 -0
  122. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
  123. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +126 -0
  124. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -0
  125. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +70 -0
  126. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
  127. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +290 -0
  128. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -0
  129. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +20 -0
  130. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -0
  131. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +25 -0
  132. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -0
  133. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts +3 -0
  134. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts.map +1 -0
  135. package/node_modules/@earendil-works/pi-agent-core/dist/node.js +3 -0
  136. package/node_modules/@earendil-works/pi-agent-core/dist/node.js.map +1 -0
  137. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +69 -0
  138. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -0
  139. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +278 -0
  140. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -0
  141. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +394 -0
  142. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -0
  143. package/node_modules/@earendil-works/pi-agent-core/dist/types.js +2 -0
  144. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -0
  145. package/node_modules/@earendil-works/pi-agent-core/package.json +61 -0
  146. package/node_modules/@earendil-works/pi-ai/README.md +1386 -0
  147. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +20 -0
  148. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -0
  149. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +44 -0
  150. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -0
  151. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts +5 -0
  152. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -0
  153. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js +6 -0
  154. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js.map +1 -0
  155. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts +3 -0
  156. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts.map +1 -0
  157. package/node_modules/@earendil-works/pi-ai/dist/cli.js +116 -0
  158. package/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -0
  159. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +18 -0
  160. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -0
  161. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +178 -0
  162. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -0
  163. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +10 -0
  164. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts.map +1 -0
  165. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +440 -0
  166. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -0
  167. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +442 -0
  168. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -0
  169. package/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
  170. package/node_modules/@earendil-works/pi-ai/dist/image-models.js.map +1 -0
  171. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +14 -0
  172. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -0
  173. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
  174. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -0
  175. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts +4 -0
  176. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -0
  177. package/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
  178. package/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -0
  179. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +33 -0
  180. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -0
  181. package/node_modules/@earendil-works/pi-ai/dist/index.js +21 -0
  182. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -0
  183. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +37 -0
  184. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -0
  185. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +17658 -0
  186. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -0
  187. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +16510 -0
  188. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -0
  189. package/node_modules/@earendil-works/pi-ai/dist/models.js +114 -0
  190. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -0
  191. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts +2 -0
  192. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -0
  193. package/node_modules/@earendil-works/pi-ai/dist/oauth.js +2 -0
  194. package/node_modules/@earendil-works/pi-ai/dist/oauth.js.map +1 -0
  195. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +38 -0
  196. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  197. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +787 -0
  198. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -0
  199. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +52 -0
  200. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -0
  201. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +1127 -0
  202. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -0
  203. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +15 -0
  204. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  205. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +229 -0
  206. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -0
  207. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts +13 -0
  208. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts.map +1 -0
  209. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js +26 -0
  210. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js.map +1 -0
  211. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +66 -0
  212. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -0
  213. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +401 -0
  214. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -0
  215. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts +8 -0
  216. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  217. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js +29 -0
  218. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js.map +1 -0
  219. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts +73 -0
  220. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -0
  221. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js +359 -0
  222. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -0
  223. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts +15 -0
  224. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -0
  225. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +465 -0
  226. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -0
  227. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts +13 -0
  228. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -0
  229. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js +431 -0
  230. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -0
  231. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts +3 -0
  232. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -0
  233. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +129 -0
  234. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -0
  235. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +4 -0
  236. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
  237. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  238. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -0
  239. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts +25 -0
  240. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -0
  241. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +542 -0
  242. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -0
  243. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts +30 -0
  244. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  245. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +1112 -0
  246. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -0
  247. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts +22 -0
  248. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -0
  249. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +977 -0
  250. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -0
  251. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts +3 -0
  252. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
  253. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js +10 -0
  254. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js.map +1 -0
  255. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts +19 -0
  256. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  257. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +579 -0
  258. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -0
  259. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts +13 -0
  260. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -0
  261. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +651 -0
  262. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -0
  263. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts +35 -0
  264. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts.map +1 -0
  265. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +254 -0
  266. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js.map +1 -0
  267. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +38 -0
  268. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -0
  269. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +174 -0
  270. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -0
  271. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts +16 -0
  272. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts.map +1 -0
  273. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js +186 -0
  274. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js.map +1 -0
  275. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +4 -0
  276. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts.map +1 -0
  277. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js +22 -0
  278. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js.map +1 -0
  279. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts +8 -0
  280. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -0
  281. package/node_modules/@earendil-works/pi-ai/dist/stream.js +42 -0
  282. package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -0
  283. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts +22 -0
  284. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts.map +1 -0
  285. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js +161 -0
  286. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map +1 -0
  287. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts +13 -0
  288. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts.map +1 -0
  289. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js +23 -0
  290. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js.map +1 -0
  291. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts +21 -0
  292. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts.map +1 -0
  293. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js +559 -0
  294. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js.map +1 -0
  295. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts +21 -0
  296. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts.map +1 -0
  297. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js +69 -0
  298. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js.map +1 -0
  299. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts +12 -0
  300. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts.map +1 -0
  301. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js +570 -0
  302. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js.map +1 -0
  303. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts +15 -0
  304. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts.map +1 -0
  305. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js +935 -0
  306. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js.map +1 -0
  307. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts +14 -0
  308. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts.map +1 -0
  309. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js +54 -0
  310. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js.map +1 -0
  311. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts +8 -0
  312. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts.map +1 -0
  313. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js +295 -0
  314. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js.map +1 -0
  315. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts +4 -0
  316. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts.map +1 -0
  317. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js +336 -0
  318. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js.map +1 -0
  319. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts +103 -0
  320. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts.map +1 -0
  321. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js +2 -0
  322. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js.map +1 -0
  323. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +543 -0
  324. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -0
  325. package/node_modules/@earendil-works/pi-ai/dist/types.js +2 -0
  326. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -0
  327. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
  328. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts.map +1 -0
  329. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js +25 -0
  330. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js.map +1 -0
  331. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +21 -0
  332. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -0
  333. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +81 -0
  334. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -0
  335. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts +3 -0
  336. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts.map +1 -0
  337. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js +14 -0
  338. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js.map +1 -0
  339. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts +2 -0
  340. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts.map +1 -0
  341. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +8 -0
  342. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js.map +1 -0
  343. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +16 -0
  344. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts.map +1 -0
  345. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js +113 -0
  346. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js.map +1 -0
  347. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts +10 -0
  348. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
  349. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +97 -0
  350. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -0
  351. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts +25 -0
  352. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  353. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js +335 -0
  354. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +1 -0
  355. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  356. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  357. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +292 -0
  358. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -0
  359. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts +57 -0
  360. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +1 -0
  361. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +121 -0
  362. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +1 -0
  363. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  364. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  365. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js +105 -0
  366. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js.map +1 -0
  367. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +34 -0
  368. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  369. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +385 -0
  370. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -0
  371. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts +13 -0
  372. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  373. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js +31 -0
  374. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js.map +1 -0
  375. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts +57 -0
  376. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts.map +1 -0
  377. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js +2 -0
  378. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js.map +1 -0
  379. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +56 -0
  380. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -0
  381. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +151 -0
  382. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -0
  383. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts +22 -0
  384. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  385. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js +26 -0
  386. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js.map +1 -0
  387. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts +5 -0
  388. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts.map +1 -0
  389. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js +49 -0
  390. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js.map +1 -0
  391. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +17 -0
  392. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  393. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js +21 -0
  394. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js.map +1 -0
  395. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +18 -0
  396. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -0
  397. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +281 -0
  398. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -0
  399. package/node_modules/@earendil-works/pi-ai/package.json +113 -0
  400. package/node_modules/@earendil-works/pi-tui/README.md +779 -0
  401. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +54 -0
  402. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -0
  403. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +632 -0
  404. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -0
  405. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +22 -0
  406. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -0
  407. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +104 -0
  408. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -0
  409. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
  410. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
  411. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +35 -0
  412. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +1 -0
  413. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +249 -0
  414. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -0
  415. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +1916 -0
  416. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -0
  417. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +28 -0
  418. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -0
  419. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +89 -0
  420. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -0
  421. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +37 -0
  422. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -0
  423. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +426 -0
  424. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -0
  425. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +40 -0
  426. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -0
  427. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +95 -0
  428. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -0
  429. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +90 -0
  430. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -0
  431. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +634 -0
  432. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -0
  433. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +50 -0
  434. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -0
  435. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +159 -0
  436. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -0
  437. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +50 -0
  438. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -0
  439. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +185 -0
  440. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -0
  441. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +12 -0
  442. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +1 -0
  443. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +23 -0
  444. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +1 -0
  445. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +19 -0
  446. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -0
  447. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +89 -0
  448. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -0
  449. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +13 -0
  450. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
  451. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +51 -0
  452. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +1 -0
  453. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +39 -0
  454. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +1 -0
  455. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +2 -0
  456. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +1 -0
  457. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +16 -0
  458. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -0
  459. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +110 -0
  460. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -0
  461. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +23 -0
  462. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -0
  463. package/node_modules/@earendil-works/pi-tui/dist/index.js +32 -0
  464. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -0
  465. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +193 -0
  466. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -0
  467. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +174 -0
  468. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -0
  469. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +184 -0
  470. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -0
  471. package/node_modules/@earendil-works/pi-tui/dist/keys.js +1173 -0
  472. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -0
  473. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +28 -0
  474. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +1 -0
  475. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +44 -0
  476. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +1 -0
  477. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +50 -0
  478. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
  479. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +361 -0
  480. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -0
  481. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +90 -0
  482. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -0
  483. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +336 -0
  484. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -0
  485. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +88 -0
  486. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -0
  487. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +329 -0
  488. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -0
  489. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +231 -0
  490. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -0
  491. package/node_modules/@earendil-works/pi-tui/dist/tui.js +1230 -0
  492. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -0
  493. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +17 -0
  494. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +1 -0
  495. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +25 -0
  496. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +1 -0
  497. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +79 -0
  498. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -0
  499. package/node_modules/@earendil-works/pi-tui/dist/utils.js +1031 -0
  500. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -0
  501. package/node_modules/@earendil-works/pi-tui/package.json +48 -0
  502. package/node_modules/@smithy/node-http-handler/LICENSE +201 -0
  503. package/node_modules/@smithy/node-http-handler/README.md +9 -0
  504. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +724 -0
  505. package/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
  506. package/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
  507. package/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
  508. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +216 -0
  509. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +87 -0
  510. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -0
  511. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +170 -0
  512. package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +21 -0
  513. package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +88 -0
  514. package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
  515. package/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  516. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
  517. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
  518. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +8 -0
  519. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +41 -0
  520. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +21 -0
  521. package/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
  522. package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +56 -0
  523. package/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
  524. package/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
  525. package/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
  526. package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +46 -0
  527. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +24 -0
  528. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +12 -0
  529. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +63 -0
  530. package/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +13 -0
  531. package/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +12 -0
  532. package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
  533. package/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
  534. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
  535. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
  536. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +5 -0
  537. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +6 -0
  538. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +13 -0
  539. package/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +8 -0
  540. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
  541. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
  542. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
  543. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +46 -0
  544. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +24 -0
  545. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +12 -0
  546. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +63 -0
  547. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +13 -0
  548. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +12 -0
  549. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
  550. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
  551. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
  552. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
  553. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +5 -0
  554. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +6 -0
  555. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +13 -0
  556. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +8 -0
  557. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +11 -0
  558. package/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +11 -0
  559. package/node_modules/@smithy/node-http-handler/package.json +68 -0
  560. package/node_modules/@smithy/types/LICENSE +201 -0
  561. package/node_modules/@smithy/types/README.md +115 -0
  562. package/node_modules/@smithy/types/dist-cjs/index.js +91 -0
  563. package/node_modules/@smithy/types/dist-es/abort-handler.js +1 -0
  564. package/node_modules/@smithy/types/dist-es/abort.js +1 -0
  565. package/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js +5 -0
  566. package/node_modules/@smithy/types/dist-es/auth/HttpAuthScheme.js +1 -0
  567. package/node_modules/@smithy/types/dist-es/auth/HttpAuthSchemeProvider.js +1 -0
  568. package/node_modules/@smithy/types/dist-es/auth/HttpSigner.js +1 -0
  569. package/node_modules/@smithy/types/dist-es/auth/IdentityProviderConfig.js +1 -0
  570. package/node_modules/@smithy/types/dist-es/auth/auth.js +5 -0
  571. package/node_modules/@smithy/types/dist-es/auth/index.js +6 -0
  572. package/node_modules/@smithy/types/dist-es/blob/blob-payload-input-types.js +1 -0
  573. package/node_modules/@smithy/types/dist-es/checksum.js +1 -0
  574. package/node_modules/@smithy/types/dist-es/client.js +1 -0
  575. package/node_modules/@smithy/types/dist-es/command.js +1 -0
  576. package/node_modules/@smithy/types/dist-es/connection/config.js +1 -0
  577. package/node_modules/@smithy/types/dist-es/connection/index.js +3 -0
  578. package/node_modules/@smithy/types/dist-es/connection/manager.js +1 -0
  579. package/node_modules/@smithy/types/dist-es/connection/pool.js +1 -0
  580. package/node_modules/@smithy/types/dist-es/crypto.js +1 -0
  581. package/node_modules/@smithy/types/dist-es/downlevel-ts3.4/transform/type-transform.js +1 -0
  582. package/node_modules/@smithy/types/dist-es/encode.js +1 -0
  583. package/node_modules/@smithy/types/dist-es/endpoint.js +5 -0
  584. package/node_modules/@smithy/types/dist-es/endpoints/EndpointRuleObject.js +1 -0
  585. package/node_modules/@smithy/types/dist-es/endpoints/ErrorRuleObject.js +1 -0
  586. package/node_modules/@smithy/types/dist-es/endpoints/RuleSetObject.js +1 -0
  587. package/node_modules/@smithy/types/dist-es/endpoints/TreeRuleObject.js +1 -0
  588. package/node_modules/@smithy/types/dist-es/endpoints/index.js +5 -0
  589. package/node_modules/@smithy/types/dist-es/endpoints/shared.js +1 -0
  590. package/node_modules/@smithy/types/dist-es/eventStream.js +1 -0
  591. package/node_modules/@smithy/types/dist-es/extensions/checksum.js +38 -0
  592. package/node_modules/@smithy/types/dist-es/extensions/defaultClientConfiguration.js +7 -0
  593. package/node_modules/@smithy/types/dist-es/extensions/defaultExtensionConfiguration.js +1 -0
  594. package/node_modules/@smithy/types/dist-es/extensions/index.js +3 -0
  595. package/node_modules/@smithy/types/dist-es/extensions/retry.js +1 -0
  596. package/node_modules/@smithy/types/dist-es/externals-check/browser-externals-check.js +1 -0
  597. package/node_modules/@smithy/types/dist-es/feature-ids.js +1 -0
  598. package/node_modules/@smithy/types/dist-es/http/httpHandlerInitialization.js +1 -0
  599. package/node_modules/@smithy/types/dist-es/http.js +5 -0
  600. package/node_modules/@smithy/types/dist-es/identity/apiKeyIdentity.js +1 -0
  601. package/node_modules/@smithy/types/dist-es/identity/awsCredentialIdentity.js +1 -0
  602. package/node_modules/@smithy/types/dist-es/identity/identity.js +1 -0
  603. package/node_modules/@smithy/types/dist-es/identity/index.js +4 -0
  604. package/node_modules/@smithy/types/dist-es/identity/tokenIdentity.js +1 -0
  605. package/node_modules/@smithy/types/dist-es/index.js +42 -0
  606. package/node_modules/@smithy/types/dist-es/logger.js +1 -0
  607. package/node_modules/@smithy/types/dist-es/middleware.js +1 -0
  608. package/node_modules/@smithy/types/dist-es/pagination.js +1 -0
  609. package/node_modules/@smithy/types/dist-es/profile.js +6 -0
  610. package/node_modules/@smithy/types/dist-es/response.js +1 -0
  611. package/node_modules/@smithy/types/dist-es/retry.js +1 -0
  612. package/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +1 -0
  613. package/node_modules/@smithy/types/dist-es/schema/schema.js +1 -0
  614. package/node_modules/@smithy/types/dist-es/schema/sentinels.js +1 -0
  615. package/node_modules/@smithy/types/dist-es/schema/static-schemas.js +1 -0
  616. package/node_modules/@smithy/types/dist-es/schema/traits.js +1 -0
  617. package/node_modules/@smithy/types/dist-es/serde.js +1 -0
  618. package/node_modules/@smithy/types/dist-es/shapes.js +1 -0
  619. package/node_modules/@smithy/types/dist-es/signature.js +1 -0
  620. package/node_modules/@smithy/types/dist-es/stream.js +1 -0
  621. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-common-types.js +1 -0
  622. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-input-types.js +1 -0
  623. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-output-types.js +1 -0
  624. package/node_modules/@smithy/types/dist-es/transfer.js +6 -0
  625. package/node_modules/@smithy/types/dist-es/transform/client-method-transforms.js +1 -0
  626. package/node_modules/@smithy/types/dist-es/transform/client-payload-blob-type-narrow.js +1 -0
  627. package/node_modules/@smithy/types/dist-es/transform/exact.js +1 -0
  628. package/node_modules/@smithy/types/dist-es/transform/mutable.js +1 -0
  629. package/node_modules/@smithy/types/dist-es/transform/no-undefined.js +1 -0
  630. package/node_modules/@smithy/types/dist-es/transform/type-transform.js +1 -0
  631. package/node_modules/@smithy/types/dist-es/uri.js +1 -0
  632. package/node_modules/@smithy/types/dist-es/util.js +1 -0
  633. package/node_modules/@smithy/types/dist-es/waiter.js +1 -0
  634. package/node_modules/@smithy/types/dist-types/abort-handler.d.ts +7 -0
  635. package/node_modules/@smithy/types/dist-types/abort.d.ts +50 -0
  636. package/node_modules/@smithy/types/dist-types/auth/HttpApiKeyAuth.d.ts +7 -0
  637. package/node_modules/@smithy/types/dist-types/auth/HttpAuthScheme.d.ts +49 -0
  638. package/node_modules/@smithy/types/dist-types/auth/HttpAuthSchemeProvider.d.ts +20 -0
  639. package/node_modules/@smithy/types/dist-types/auth/HttpSigner.d.ts +41 -0
  640. package/node_modules/@smithy/types/dist-types/auth/IdentityProviderConfig.d.ts +14 -0
  641. package/node_modules/@smithy/types/dist-types/auth/auth.d.ts +57 -0
  642. package/node_modules/@smithy/types/dist-types/auth/index.d.ts +6 -0
  643. package/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +40 -0
  644. package/node_modules/@smithy/types/dist-types/checksum.d.ts +63 -0
  645. package/node_modules/@smithy/types/dist-types/client.d.ts +57 -0
  646. package/node_modules/@smithy/types/dist-types/command.d.ts +28 -0
  647. package/node_modules/@smithy/types/dist-types/connection/config.d.ts +10 -0
  648. package/node_modules/@smithy/types/dist-types/connection/index.d.ts +3 -0
  649. package/node_modules/@smithy/types/dist-types/connection/manager.d.ts +34 -0
  650. package/node_modules/@smithy/types/dist-types/connection/pool.d.ts +32 -0
  651. package/node_modules/@smithy/types/dist-types/crypto.d.ts +60 -0
  652. package/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +25 -0
  653. package/node_modules/@smithy/types/dist-types/encode.d.ts +31 -0
  654. package/node_modules/@smithy/types/dist-types/endpoint.d.ts +77 -0
  655. package/node_modules/@smithy/types/dist-types/endpoints/EndpointRuleObject.d.ts +27 -0
  656. package/node_modules/@smithy/types/dist-types/endpoints/ErrorRuleObject.d.ts +10 -0
  657. package/node_modules/@smithy/types/dist-types/endpoints/RuleSetObject.d.ts +28 -0
  658. package/node_modules/@smithy/types/dist-types/endpoints/TreeRuleObject.d.ts +16 -0
  659. package/node_modules/@smithy/types/dist-types/endpoints/index.d.ts +5 -0
  660. package/node_modules/@smithy/types/dist-types/endpoints/shared.d.ts +55 -0
  661. package/node_modules/@smithy/types/dist-types/eventStream.d.ts +137 -0
  662. package/node_modules/@smithy/types/dist-types/extensions/checksum.d.ts +58 -0
  663. package/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +33 -0
  664. package/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +9 -0
  665. package/node_modules/@smithy/types/dist-types/extensions/index.d.ts +4 -0
  666. package/node_modules/@smithy/types/dist-types/extensions/retry.d.ts +18 -0
  667. package/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +35 -0
  668. package/node_modules/@smithy/types/dist-types/feature-ids.d.ts +16 -0
  669. package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +128 -0
  670. package/node_modules/@smithy/types/dist-types/http.d.ts +112 -0
  671. package/node_modules/@smithy/types/dist-types/identity/apiKeyIdentity.d.ts +14 -0
  672. package/node_modules/@smithy/types/dist-types/identity/awsCredentialIdentity.d.ts +31 -0
  673. package/node_modules/@smithy/types/dist-types/identity/identity.d.ts +15 -0
  674. package/node_modules/@smithy/types/dist-types/identity/index.d.ts +4 -0
  675. package/node_modules/@smithy/types/dist-types/identity/tokenIdentity.d.ts +14 -0
  676. package/node_modules/@smithy/types/dist-types/index.d.ts +42 -0
  677. package/node_modules/@smithy/types/dist-types/logger.d.ts +13 -0
  678. package/node_modules/@smithy/types/dist-types/middleware.d.ts +534 -0
  679. package/node_modules/@smithy/types/dist-types/pagination.d.ts +33 -0
  680. package/node_modules/@smithy/types/dist-types/profile.d.ts +30 -0
  681. package/node_modules/@smithy/types/dist-types/response.d.ts +40 -0
  682. package/node_modules/@smithy/types/dist-types/retry.d.ts +133 -0
  683. package/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +136 -0
  684. package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +230 -0
  685. package/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +65 -0
  686. package/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +82 -0
  687. package/node_modules/@smithy/types/dist-types/schema/traits.d.ts +46 -0
  688. package/node_modules/@smithy/types/dist-types/serde.d.ts +114 -0
  689. package/node_modules/@smithy/types/dist-types/shapes.d.ts +82 -0
  690. package/node_modules/@smithy/types/dist-types/signature.d.ts +155 -0
  691. package/node_modules/@smithy/types/dist-types/stream.d.ts +22 -0
  692. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +32 -0
  693. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
  694. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
  695. package/node_modules/@smithy/types/dist-types/transfer.d.ts +41 -0
  696. package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +26 -0
  697. package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +77 -0
  698. package/node_modules/@smithy/types/dist-types/transform/exact.d.ts +6 -0
  699. package/node_modules/@smithy/types/dist-types/transform/mutable.d.ts +6 -0
  700. package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +68 -0
  701. package/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +34 -0
  702. package/node_modules/@smithy/types/dist-types/ts3.4/abort-handler.d.ts +7 -0
  703. package/node_modules/@smithy/types/dist-types/ts3.4/abort.d.ts +50 -0
  704. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpApiKeyAuth.d.ts +7 -0
  705. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthScheme.d.ts +49 -0
  706. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthSchemeProvider.d.ts +20 -0
  707. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpSigner.d.ts +41 -0
  708. package/node_modules/@smithy/types/dist-types/ts3.4/auth/IdentityProviderConfig.d.ts +14 -0
  709. package/node_modules/@smithy/types/dist-types/ts3.4/auth/auth.d.ts +57 -0
  710. package/node_modules/@smithy/types/dist-types/ts3.4/auth/index.d.ts +6 -0
  711. package/node_modules/@smithy/types/dist-types/ts3.4/blob/blob-payload-input-types.d.ts +40 -0
  712. package/node_modules/@smithy/types/dist-types/ts3.4/checksum.d.ts +63 -0
  713. package/node_modules/@smithy/types/dist-types/ts3.4/client.d.ts +57 -0
  714. package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +28 -0
  715. package/node_modules/@smithy/types/dist-types/ts3.4/connection/config.d.ts +10 -0
  716. package/node_modules/@smithy/types/dist-types/ts3.4/connection/index.d.ts +3 -0
  717. package/node_modules/@smithy/types/dist-types/ts3.4/connection/manager.d.ts +34 -0
  718. package/node_modules/@smithy/types/dist-types/ts3.4/connection/pool.d.ts +32 -0
  719. package/node_modules/@smithy/types/dist-types/ts3.4/crypto.d.ts +60 -0
  720. package/node_modules/@smithy/types/dist-types/ts3.4/downlevel-ts3.4/transform/type-transform.d.ts +41 -0
  721. package/node_modules/@smithy/types/dist-types/ts3.4/encode.d.ts +31 -0
  722. package/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +77 -0
  723. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointRuleObject.d.ts +27 -0
  724. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/ErrorRuleObject.d.ts +10 -0
  725. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/RuleSetObject.d.ts +28 -0
  726. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/TreeRuleObject.d.ts +16 -0
  727. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/index.d.ts +5 -0
  728. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/shared.d.ts +55 -0
  729. package/node_modules/@smithy/types/dist-types/ts3.4/eventStream.d.ts +137 -0
  730. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/checksum.d.ts +58 -0
  731. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultClientConfiguration.d.ts +33 -0
  732. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultExtensionConfiguration.d.ts +9 -0
  733. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/index.d.ts +4 -0
  734. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/retry.d.ts +18 -0
  735. package/node_modules/@smithy/types/dist-types/ts3.4/externals-check/browser-externals-check.d.ts +35 -0
  736. package/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +16 -0
  737. package/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +128 -0
  738. package/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +112 -0
  739. package/node_modules/@smithy/types/dist-types/ts3.4/identity/apiKeyIdentity.d.ts +14 -0
  740. package/node_modules/@smithy/types/dist-types/ts3.4/identity/awsCredentialIdentity.d.ts +31 -0
  741. package/node_modules/@smithy/types/dist-types/ts3.4/identity/identity.d.ts +15 -0
  742. package/node_modules/@smithy/types/dist-types/ts3.4/identity/index.d.ts +4 -0
  743. package/node_modules/@smithy/types/dist-types/ts3.4/identity/tokenIdentity.d.ts +14 -0
  744. package/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +42 -0
  745. package/node_modules/@smithy/types/dist-types/ts3.4/logger.d.ts +13 -0
  746. package/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +534 -0
  747. package/node_modules/@smithy/types/dist-types/ts3.4/pagination.d.ts +33 -0
  748. package/node_modules/@smithy/types/dist-types/ts3.4/profile.d.ts +30 -0
  749. package/node_modules/@smithy/types/dist-types/ts3.4/response.d.ts +40 -0
  750. package/node_modules/@smithy/types/dist-types/ts3.4/retry.d.ts +133 -0
  751. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +142 -0
  752. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +245 -0
  753. package/node_modules/@smithy/types/dist-types/ts3.4/schema/sentinels.d.ts +65 -0
  754. package/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +101 -0
  755. package/node_modules/@smithy/types/dist-types/ts3.4/schema/traits.d.ts +46 -0
  756. package/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +114 -0
  757. package/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +82 -0
  758. package/node_modules/@smithy/types/dist-types/ts3.4/signature.d.ts +155 -0
  759. package/node_modules/@smithy/types/dist-types/ts3.4/stream.d.ts +22 -0
  760. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-common-types.d.ts +32 -0
  761. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
  762. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
  763. package/node_modules/@smithy/types/dist-types/ts3.4/transfer.d.ts +41 -0
  764. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +26 -0
  765. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +81 -0
  766. package/node_modules/@smithy/types/dist-types/ts3.4/transform/exact.d.ts +14 -0
  767. package/node_modules/@smithy/types/dist-types/ts3.4/transform/mutable.d.ts +6 -0
  768. package/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +88 -0
  769. package/node_modules/@smithy/types/dist-types/ts3.4/transform/type-transform.d.ts +41 -0
  770. package/node_modules/@smithy/types/dist-types/ts3.4/uri.d.ts +17 -0
  771. package/node_modules/@smithy/types/dist-types/ts3.4/util.d.ts +192 -0
  772. package/node_modules/@smithy/types/dist-types/ts3.4/waiter.d.ts +35 -0
  773. package/node_modules/@smithy/types/dist-types/uri.d.ts +17 -0
  774. package/node_modules/@smithy/types/dist-types/util.d.ts +176 -0
  775. package/node_modules/@smithy/types/dist-types/waiter.d.ts +35 -0
  776. package/node_modules/@smithy/types/package.json +61 -0
  777. package/node_modules/marked/LICENSE.md +44 -0
  778. package/node_modules/marked/README.md +106 -0
  779. package/node_modules/marked/bin/main.js +282 -0
  780. package/node_modules/marked/bin/marked.js +15 -0
  781. package/node_modules/marked/lib/marked.cjs +2211 -0
  782. package/node_modules/marked/lib/marked.cjs.map +7 -0
  783. package/node_modules/marked/lib/marked.d.cts +728 -0
  784. package/node_modules/marked/lib/marked.d.ts +728 -0
  785. package/node_modules/marked/lib/marked.esm.js +2189 -0
  786. package/node_modules/marked/lib/marked.esm.js.map +7 -0
  787. package/node_modules/marked/lib/marked.umd.js +2213 -0
  788. package/node_modules/marked/lib/marked.umd.js.map +7 -0
  789. package/node_modules/marked/man/marked.1 +111 -0
  790. package/node_modules/marked/man/marked.1.md +92 -0
  791. package/node_modules/marked/marked.min.js +69 -0
  792. package/node_modules/marked/package.json +111 -0
  793. package/npm-shrinkwrap.json +1841 -0
  794. package/package.json +49 -31
@@ -0,0 +1,1112 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
9
+ // NEVER convert to top-level runtime imports - breaks browser/Vite builds
10
+ let _os = null;
11
+ const dynamicImport = (specifier) => import(__rewriteRelativeImportExtension(specifier));
12
+ const NODE_OS_SPECIFIER = "node:" + "os";
13
+ if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) {
14
+ dynamicImport(NODE_OS_SPECIFIER).then((m) => {
15
+ _os = m;
16
+ });
17
+ }
18
+ import { getEnvApiKey } from "../env-api-keys.js";
19
+ import { clampThinkingLevel, supportsXhigh } from "../models.js";
20
+ import { registerSessionResourceCleanup } from "../session-resources.js";
21
+ import { appendAssistantMessageDiagnostic, createAssistantMessageDiagnostic, formatThrownValue, } from "../utils/diagnostics.js";
22
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
23
+ import { headersToRecord } from "../utils/headers.js";
24
+ import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
25
+ import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
26
+ import { applyExtraBody, buildBaseOptions, clampMaxForOpenAI, OPENAI_RESPONSES_RESERVED_BODY_KEYS, } from "./simple-options.js";
27
+ // ============================================================================
28
+ // Configuration
29
+ // ============================================================================
30
+ const DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api";
31
+ const JWT_CLAIM_PATH = "https://api.openai.com/auth";
32
+ const MAX_RETRIES = 3;
33
+ const BASE_DELAY_MS = 1000;
34
+ const CODEX_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode"]);
35
+ const WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE = 1009;
36
+ const CODEX_RESPONSE_STATUSES = new Set([
37
+ "completed",
38
+ "incomplete",
39
+ "failed",
40
+ "cancelled",
41
+ "queued",
42
+ "in_progress",
43
+ ]);
44
+ // ============================================================================
45
+ // Retry Helpers
46
+ // ============================================================================
47
+ function isRetryableError(status, errorText) {
48
+ if (status === 429 || status === 500 || status === 502 || status === 503 || status === 504) {
49
+ return true;
50
+ }
51
+ return /rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(errorText);
52
+ }
53
+ function sleep(ms, signal) {
54
+ return new Promise((resolve, reject) => {
55
+ if (signal?.aborted) {
56
+ reject(new Error("Request was aborted"));
57
+ return;
58
+ }
59
+ const timeout = setTimeout(resolve, ms);
60
+ signal?.addEventListener("abort", () => {
61
+ clearTimeout(timeout);
62
+ reject(new Error("Request was aborted"));
63
+ });
64
+ });
65
+ }
66
+ // ============================================================================
67
+ // Main Stream Function
68
+ // ============================================================================
69
+ export const streamOpenAICodexResponses = (model, context, options) => {
70
+ const stream = new AssistantMessageEventStream();
71
+ (async () => {
72
+ const output = {
73
+ role: "assistant",
74
+ content: [],
75
+ api: "openai-codex-responses",
76
+ provider: model.provider,
77
+ model: model.id,
78
+ usage: {
79
+ input: 0,
80
+ output: 0,
81
+ cacheRead: 0,
82
+ cacheWrite: 0,
83
+ totalTokens: 0,
84
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
85
+ },
86
+ stopReason: "stop",
87
+ timestamp: Date.now(),
88
+ };
89
+ try {
90
+ const apiKey = options?.apiKey || getEnvApiKey(model.provider) || "";
91
+ if (!apiKey) {
92
+ throw new Error(`No API key for provider: ${model.provider}`);
93
+ }
94
+ const accountId = extractAccountId(apiKey);
95
+ let body = buildRequestBody(model, context, options);
96
+ const nextBody = await options?.onPayload?.(body, model);
97
+ if (nextBody !== undefined) {
98
+ body = nextBody;
99
+ }
100
+ const websocketRequestId = options?.sessionId || createCodexRequestId();
101
+ const sseHeaders = buildSSEHeaders(model.headers, options?.headers, accountId, apiKey, options?.sessionId);
102
+ const websocketHeaders = buildWebSocketHeaders(model.headers, options?.headers, accountId, apiKey, websocketRequestId);
103
+ const bodyJson = JSON.stringify(body);
104
+ const transport = options?.transport || "auto";
105
+ const websocketDisabledForSession = transport !== "sse" && isWebSocketSseFallbackActive(options?.sessionId);
106
+ if (websocketDisabledForSession) {
107
+ recordWebSocketSseFallback(options?.sessionId);
108
+ }
109
+ if (transport !== "sse" && !websocketDisabledForSession) {
110
+ let websocketStarted = false;
111
+ try {
112
+ await processWebSocketStream(resolveCodexWebSocketUrl(model.baseUrl), body, websocketHeaders, output, stream, model, () => {
113
+ websocketStarted = true;
114
+ }, options);
115
+ if (options?.signal?.aborted) {
116
+ throw new Error("Request was aborted");
117
+ }
118
+ stream.push({
119
+ type: "done",
120
+ reason: output.stopReason,
121
+ message: output,
122
+ });
123
+ stream.end();
124
+ return;
125
+ }
126
+ catch (error) {
127
+ const aborted = options?.signal?.aborted;
128
+ if (aborted || isCodexNonTransportError(error)) {
129
+ throw error;
130
+ }
131
+ appendAssistantMessageDiagnostic(output, createAssistantMessageDiagnostic("provider_transport_failure", error, {
132
+ configuredTransport: transport,
133
+ fallbackTransport: websocketStarted ? undefined : "sse",
134
+ eventsEmitted: websocketStarted,
135
+ phase: websocketStarted ? "after_message_stream_start" : "before_message_stream_start",
136
+ requestBytes: new TextEncoder().encode(bodyJson).byteLength,
137
+ }));
138
+ recordWebSocketFailure(options?.sessionId, error);
139
+ if (websocketStarted) {
140
+ throw error;
141
+ }
142
+ recordWebSocketSseFallback(options?.sessionId);
143
+ }
144
+ }
145
+ // Fetch with retry logic for rate limits and transient errors
146
+ let response;
147
+ let lastError;
148
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
149
+ if (options?.signal?.aborted) {
150
+ throw new Error("Request was aborted");
151
+ }
152
+ try {
153
+ response = await fetch(resolveCodexUrl(model.baseUrl), {
154
+ method: "POST",
155
+ headers: sseHeaders,
156
+ body: bodyJson,
157
+ signal: options?.signal,
158
+ });
159
+ await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
160
+ if (response.ok) {
161
+ break;
162
+ }
163
+ const errorText = await response.text();
164
+ if (attempt < MAX_RETRIES && isRetryableError(response.status, errorText)) {
165
+ let delayMs = BASE_DELAY_MS * 2 ** attempt;
166
+ const retryAfterMs = response.headers.get("retry-after-ms");
167
+ if (retryAfterMs !== null) {
168
+ const millis = Number(retryAfterMs);
169
+ if (Number.isFinite(millis)) {
170
+ delayMs = Math.max(0, millis);
171
+ }
172
+ }
173
+ else {
174
+ const retryAfter = response.headers.get("retry-after");
175
+ if (retryAfter) {
176
+ const seconds = Number(retryAfter);
177
+ if (Number.isFinite(seconds)) {
178
+ delayMs = Math.max(0, seconds * 1000);
179
+ }
180
+ else {
181
+ const date = Date.parse(retryAfter);
182
+ if (!Number.isNaN(date)) {
183
+ delayMs = Math.max(0, date - Date.now());
184
+ }
185
+ }
186
+ }
187
+ }
188
+ await sleep(delayMs, options?.signal);
189
+ continue;
190
+ }
191
+ // Parse error for friendly message on final attempt or non-retryable error
192
+ const fakeResponse = new Response(errorText, {
193
+ status: response.status,
194
+ statusText: response.statusText,
195
+ });
196
+ const info = await parseErrorResponse(fakeResponse);
197
+ throw new Error(info.friendlyMessage || info.message);
198
+ }
199
+ catch (error) {
200
+ if (error instanceof Error) {
201
+ if (error.name === "AbortError" || error.message === "Request was aborted") {
202
+ throw new Error("Request was aborted");
203
+ }
204
+ }
205
+ lastError = error instanceof Error ? error : new Error(String(error));
206
+ // Network errors are retryable
207
+ if (attempt < MAX_RETRIES && !lastError.message.includes("usage limit")) {
208
+ const delayMs = BASE_DELAY_MS * 2 ** attempt;
209
+ await sleep(delayMs, options?.signal);
210
+ continue;
211
+ }
212
+ throw lastError;
213
+ }
214
+ }
215
+ if (!response?.ok) {
216
+ throw lastError ?? new Error("Failed after retries");
217
+ }
218
+ if (!response.body) {
219
+ throw new Error("No response body");
220
+ }
221
+ stream.push({ type: "start", partial: output });
222
+ await processStream(response, output, stream, model, options);
223
+ if (options?.signal?.aborted) {
224
+ throw new Error("Request was aborted");
225
+ }
226
+ stream.push({ type: "done", reason: output.stopReason, message: output });
227
+ stream.end();
228
+ }
229
+ catch (error) {
230
+ for (const block of output.content) {
231
+ // partialJson is only a streaming scratch buffer; never persist it.
232
+ delete block.partialJson;
233
+ }
234
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
235
+ output.errorMessage = error instanceof Error ? error.message : String(error);
236
+ stream.push({ type: "error", reason: output.stopReason, error: output });
237
+ stream.end();
238
+ }
239
+ })();
240
+ return stream;
241
+ };
242
+ export const streamSimpleOpenAICodexResponses = (model, context, options) => {
243
+ const apiKey = options?.apiKey || getEnvApiKey(model.provider);
244
+ if (!apiKey) {
245
+ throw new Error(`No API key for provider: ${model.provider}`);
246
+ }
247
+ const base = buildBaseOptions(model, options, apiKey);
248
+ const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;
249
+ const reasoningEffort = clampedReasoning === "off" ? undefined : clampMaxForOpenAI(clampedReasoning, supportsXhigh(model));
250
+ return streamOpenAICodexResponses(model, context, {
251
+ ...base,
252
+ reasoningEffort,
253
+ });
254
+ };
255
+ // ============================================================================
256
+ // Request Building
257
+ // ============================================================================
258
+ function buildRequestBody(model, context, options) {
259
+ const reasoningRequested = options?.reasoningEffort !== undefined && options.reasoningEffort !== "none";
260
+ const messages = convertResponsesMessages(model, context, CODEX_TOOL_CALL_PROVIDERS, {
261
+ includeSystemPrompt: false,
262
+ preserveThinking: reasoningRequested,
263
+ });
264
+ const body = {
265
+ model: model.id,
266
+ store: false,
267
+ stream: true,
268
+ instructions: context.systemPrompt || "You are a helpful assistant.",
269
+ input: messages,
270
+ text: { verbosity: options?.textVerbosity || "low" },
271
+ include: ["reasoning.encrypted_content"],
272
+ prompt_cache_key: clampOpenAIPromptCacheKey(options?.sessionId),
273
+ tool_choice: "auto",
274
+ parallel_tool_calls: true,
275
+ };
276
+ if (options?.temperature !== undefined) {
277
+ body.temperature = options.temperature;
278
+ }
279
+ if (options?.serviceTier !== undefined) {
280
+ body.service_tier = options.serviceTier;
281
+ }
282
+ if (context.tools && context.tools.length > 0) {
283
+ body.tools = convertResponsesTools(context.tools, { strict: null });
284
+ }
285
+ if (options?.reasoningEffort !== undefined) {
286
+ const effort = options.reasoningEffort === "none"
287
+ ? (model.thinkingLevelMap?.off ?? "none")
288
+ : (model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort);
289
+ if (effort !== null) {
290
+ body.reasoning = {
291
+ effort,
292
+ summary: options.reasoningSummary ?? "auto",
293
+ };
294
+ }
295
+ }
296
+ applyExtraBody(body, options?.extraBody, OPENAI_RESPONSES_RESERVED_BODY_KEYS);
297
+ return body;
298
+ }
299
+ function getServiceTierCostMultiplier(model, serviceTier) {
300
+ switch (serviceTier) {
301
+ case "flex":
302
+ return 0.5;
303
+ case "priority":
304
+ return model.id === "gpt-5.5" ? 2.5 : 2;
305
+ default:
306
+ return 1;
307
+ }
308
+ }
309
+ function applyServiceTierPricing(usage, serviceTier, model) {
310
+ const multiplier = getServiceTierCostMultiplier(model, serviceTier);
311
+ if (multiplier === 1)
312
+ return;
313
+ usage.cost.input *= multiplier;
314
+ usage.cost.output *= multiplier;
315
+ usage.cost.cacheRead *= multiplier;
316
+ usage.cost.cacheWrite *= multiplier;
317
+ usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
318
+ }
319
+ function resolveCodexServiceTier(responseServiceTier, requestServiceTier) {
320
+ if (responseServiceTier === "default" && (requestServiceTier === "flex" || requestServiceTier === "priority")) {
321
+ return requestServiceTier;
322
+ }
323
+ return responseServiceTier ?? requestServiceTier;
324
+ }
325
+ function resolveCodexUrl(baseUrl) {
326
+ const raw = baseUrl && baseUrl.trim().length > 0 ? baseUrl : DEFAULT_CODEX_BASE_URL;
327
+ const normalized = raw.replace(/\/+$/, "");
328
+ if (normalized.endsWith("/codex/responses"))
329
+ return normalized;
330
+ if (normalized.endsWith("/codex"))
331
+ return `${normalized}/responses`;
332
+ return `${normalized}/codex/responses`;
333
+ }
334
+ function resolveCodexWebSocketUrl(baseUrl) {
335
+ const url = new URL(resolveCodexUrl(baseUrl));
336
+ if (url.protocol === "https:")
337
+ url.protocol = "wss:";
338
+ if (url.protocol === "http:")
339
+ url.protocol = "ws:";
340
+ return url.toString();
341
+ }
342
+ // ============================================================================
343
+ // Response Processing
344
+ // ============================================================================
345
+ async function processStream(response, output, stream, model, options) {
346
+ await processResponsesStream(mapCodexEvents(parseSSE(response)), output, stream, model, {
347
+ serviceTier: options?.serviceTier,
348
+ resolveServiceTier: resolveCodexServiceTier,
349
+ applyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),
350
+ });
351
+ }
352
+ class CodexApiError extends Error {
353
+ code;
354
+ payload;
355
+ constructor(message, options) {
356
+ super(message);
357
+ this.name = "CodexApiError";
358
+ this.code = options?.code;
359
+ this.payload = options?.payload;
360
+ this.cause = options?.cause;
361
+ }
362
+ }
363
+ class CodexProtocolError extends Error {
364
+ payload;
365
+ constructor(message, options) {
366
+ super(message);
367
+ this.name = "CodexProtocolError";
368
+ this.payload = options?.payload;
369
+ this.cause = options?.cause;
370
+ }
371
+ }
372
+ function isCodexNonTransportError(error) {
373
+ return error instanceof CodexApiError || error instanceof CodexProtocolError;
374
+ }
375
+ async function* mapCodexEvents(events) {
376
+ for await (const event of events) {
377
+ const type = typeof event.type === "string" ? event.type : undefined;
378
+ if (!type)
379
+ continue;
380
+ if (type === "error") {
381
+ const code = event.code || "";
382
+ const message = event.message || "";
383
+ throw new CodexApiError(`Codex error: ${message || code || JSON.stringify(event)}`, {
384
+ code: code || undefined,
385
+ payload: event,
386
+ });
387
+ }
388
+ if (type === "response.failed") {
389
+ const response = event.response;
390
+ const code = response?.error?.code;
391
+ const message = response?.error?.message;
392
+ throw new CodexApiError(message || "Codex response failed", { code, payload: event });
393
+ }
394
+ if (type === "response.done" || type === "response.completed" || type === "response.incomplete") {
395
+ const response = event.response;
396
+ const normalizedResponse = response
397
+ ? { ...response, status: normalizeCodexStatus(response.status) }
398
+ : response;
399
+ yield { ...event, type: "response.completed", response: normalizedResponse };
400
+ return;
401
+ }
402
+ const responseEvent = JSON.parse(JSON.stringify(event));
403
+ yield responseEvent;
404
+ }
405
+ }
406
+ function normalizeCodexStatus(status) {
407
+ if (typeof status !== "string")
408
+ return undefined;
409
+ return CODEX_RESPONSE_STATUSES.has(status) ? status : undefined;
410
+ }
411
+ // ============================================================================
412
+ // SSE Parsing
413
+ // ============================================================================
414
+ async function* parseSSE(response) {
415
+ if (!response.body)
416
+ return;
417
+ const reader = response.body.getReader();
418
+ const decoder = new TextDecoder();
419
+ let buffer = "";
420
+ try {
421
+ while (true) {
422
+ const { done, value } = await reader.read();
423
+ if (done)
424
+ break;
425
+ buffer += decoder.decode(value, { stream: true });
426
+ let idx = buffer.indexOf("\n\n");
427
+ while (idx !== -1) {
428
+ const chunk = buffer.slice(0, idx);
429
+ buffer = buffer.slice(idx + 2);
430
+ const dataLines = chunk
431
+ .split("\n")
432
+ .filter((l) => l.startsWith("data:"))
433
+ .map((l) => l.slice(5).trim());
434
+ if (dataLines.length > 0) {
435
+ const data = dataLines.join("\n").trim();
436
+ if (data && data !== "[DONE]") {
437
+ try {
438
+ yield JSON.parse(data);
439
+ }
440
+ catch (cause) {
441
+ throw new CodexProtocolError(`Invalid Codex SSE JSON: ${formatThrownValue(cause)}`, {
442
+ cause,
443
+ payload: data,
444
+ });
445
+ }
446
+ }
447
+ }
448
+ idx = buffer.indexOf("\n\n");
449
+ }
450
+ }
451
+ }
452
+ finally {
453
+ try {
454
+ await reader.cancel();
455
+ }
456
+ catch { }
457
+ try {
458
+ reader.releaseLock();
459
+ }
460
+ catch { }
461
+ }
462
+ }
463
+ // ============================================================================
464
+ // WebSocket Parsing
465
+ // ============================================================================
466
+ const OPENAI_BETA_RESPONSES_WEBSOCKETS = "responses_websockets=2026-02-06";
467
+ const SESSION_WEBSOCKET_CACHE_TTL_MS = 5 * 60 * 1000;
468
+ const websocketSessionCache = new Map();
469
+ const websocketDebugStats = new Map();
470
+ const websocketSseFallbackSessions = new Set();
471
+ function getOrCreateWebSocketDebugStats(sessionId) {
472
+ let stats = websocketDebugStats.get(sessionId);
473
+ if (!stats) {
474
+ stats = {
475
+ requests: 0,
476
+ connectionsCreated: 0,
477
+ connectionsReused: 0,
478
+ cachedContextRequests: 0,
479
+ storeTrueRequests: 0,
480
+ fullContextRequests: 0,
481
+ deltaRequests: 0,
482
+ lastInputItems: 0,
483
+ websocketFailures: 0,
484
+ sseFallbacks: 0,
485
+ };
486
+ websocketDebugStats.set(sessionId, stats);
487
+ }
488
+ return stats;
489
+ }
490
+ export function getOpenAICodexWebSocketDebugStats(sessionId) {
491
+ const stats = websocketDebugStats.get(sessionId);
492
+ return stats ? { ...stats } : undefined;
493
+ }
494
+ export function resetOpenAICodexWebSocketDebugStats(sessionId) {
495
+ if (sessionId) {
496
+ websocketDebugStats.delete(sessionId);
497
+ websocketSseFallbackSessions.delete(sessionId);
498
+ return;
499
+ }
500
+ websocketDebugStats.clear();
501
+ websocketSseFallbackSessions.clear();
502
+ }
503
+ export function closeOpenAICodexWebSocketSessions(sessionId) {
504
+ const closeEntry = (entry) => {
505
+ if (entry.idleTimer)
506
+ clearTimeout(entry.idleTimer);
507
+ closeWebSocketSilently(entry.socket, 1000, "debug_close");
508
+ };
509
+ if (sessionId) {
510
+ const entry = websocketSessionCache.get(sessionId);
511
+ if (entry)
512
+ closeEntry(entry);
513
+ websocketSessionCache.delete(sessionId);
514
+ return;
515
+ }
516
+ for (const entry of websocketSessionCache.values()) {
517
+ closeEntry(entry);
518
+ }
519
+ websocketSessionCache.clear();
520
+ }
521
+ registerSessionResourceCleanup(closeOpenAICodexWebSocketSessions);
522
+ function isWebSocketSseFallbackActive(sessionId) {
523
+ return sessionId ? websocketSseFallbackSessions.has(sessionId) : false;
524
+ }
525
+ function recordWebSocketSseFallback(sessionId) {
526
+ if (!sessionId)
527
+ return;
528
+ const stats = getOrCreateWebSocketDebugStats(sessionId);
529
+ stats.sseFallbacks++;
530
+ stats.websocketFallbackActive = isWebSocketSseFallbackActive(sessionId);
531
+ }
532
+ function recordWebSocketFailure(sessionId, error) {
533
+ if (!sessionId)
534
+ return;
535
+ websocketSseFallbackSessions.add(sessionId);
536
+ const stats = getOrCreateWebSocketDebugStats(sessionId);
537
+ stats.websocketFailures++;
538
+ stats.lastWebSocketError = formatThrownValue(error);
539
+ stats.websocketFallbackActive = true;
540
+ }
541
+ let _cachedWebsocket = null;
542
+ async function getWebSocketConstructor() {
543
+ if (_cachedWebsocket)
544
+ return _cachedWebsocket;
545
+ // bun doesn't respect http proxy envs, ref: https://github.com/oven-sh/bun/issues/15489
546
+ // TODO: remove this when bun supports proxy envs in websocket.
547
+ if (process?.versions?.bun &&
548
+ (process.env.HTTP_PROXY || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.https_proxy)) {
549
+ const m = await dynamicImport("proxy-from-env");
550
+ const getProxyForUrl = m.getProxyForUrl;
551
+ _cachedWebsocket = class {
552
+ socket;
553
+ constructor(url, options) {
554
+ let _opts = {};
555
+ if (Array.isArray(options) || typeof options === "string") {
556
+ _opts = { protocols: options };
557
+ }
558
+ else {
559
+ _opts = { ...options };
560
+ }
561
+ const proxy = getProxyForUrl(url.toString().replace(/^wss:/, "https:").replace(/^ws:/, "http:"));
562
+ this.socket = Reflect.construct(WebSocket, [
563
+ url,
564
+ { ..._opts, ...(proxy ? { proxy } : {}) },
565
+ ]);
566
+ }
567
+ close(code, reason) {
568
+ this.socket.close(code, reason);
569
+ }
570
+ send(data) {
571
+ this.socket.send(data);
572
+ }
573
+ addEventListener(type, listener) {
574
+ this.socket.addEventListener(type, listener);
575
+ }
576
+ removeEventListener(type, listener) {
577
+ this.socket.removeEventListener(type, listener);
578
+ }
579
+ };
580
+ return _cachedWebsocket;
581
+ }
582
+ const ctor = globalThis.WebSocket;
583
+ if (!isWebSocketConstructor(ctor))
584
+ return null;
585
+ return ctor;
586
+ }
587
+ function isWebSocketConstructor(value) {
588
+ return typeof value === "function";
589
+ }
590
+ class WebSocketCloseError extends Error {
591
+ code;
592
+ reason;
593
+ wasClean;
594
+ constructor(message, options) {
595
+ super(message);
596
+ this.name = "WebSocketCloseError";
597
+ this.code = options?.code;
598
+ this.reason = options?.reason;
599
+ this.wasClean = options?.wasClean;
600
+ }
601
+ }
602
+ function getWebSocketReadyState(socket) {
603
+ const readyState = socket.readyState;
604
+ return typeof readyState === "number" ? readyState : undefined;
605
+ }
606
+ function isWebSocketReusable(socket) {
607
+ const readyState = getWebSocketReadyState(socket);
608
+ // If readyState is unavailable, assume the runtime keeps it open/reusable.
609
+ return readyState === undefined || readyState === 1;
610
+ }
611
+ function closeWebSocketSilently(socket, code = 1000, reason = "done") {
612
+ try {
613
+ socket.close(code, reason);
614
+ }
615
+ catch { }
616
+ }
617
+ function scheduleSessionWebSocketExpiry(sessionId, entry) {
618
+ if (entry.idleTimer) {
619
+ clearTimeout(entry.idleTimer);
620
+ }
621
+ entry.idleTimer = setTimeout(() => {
622
+ if (entry.busy)
623
+ return;
624
+ closeWebSocketSilently(entry.socket, 1000, "idle_timeout");
625
+ websocketSessionCache.delete(sessionId);
626
+ }, SESSION_WEBSOCKET_CACHE_TTL_MS);
627
+ }
628
+ async function connectWebSocket(url, headers, signal) {
629
+ const WebSocketCtor = await getWebSocketConstructor();
630
+ if (!WebSocketCtor) {
631
+ throw new Error("WebSocket transport is not available in this runtime");
632
+ }
633
+ const wsHeaders = headersToRecord(headers);
634
+ delete wsHeaders["OpenAI-Beta"];
635
+ return new Promise((resolve, reject) => {
636
+ let settled = false;
637
+ let socket;
638
+ try {
639
+ socket = new WebSocketCtor(url, { headers: wsHeaders });
640
+ }
641
+ catch (error) {
642
+ reject(error instanceof Error ? error : new Error(String(error)));
643
+ return;
644
+ }
645
+ const onOpen = () => {
646
+ if (settled)
647
+ return;
648
+ settled = true;
649
+ cleanup();
650
+ resolve(socket);
651
+ };
652
+ const onError = (event) => {
653
+ const error = extractWebSocketError(event);
654
+ if (settled)
655
+ return;
656
+ settled = true;
657
+ cleanup();
658
+ reject(error);
659
+ };
660
+ const onClose = (event) => {
661
+ const error = extractWebSocketCloseError(event);
662
+ if (settled)
663
+ return;
664
+ settled = true;
665
+ cleanup();
666
+ reject(error);
667
+ };
668
+ const onAbort = () => {
669
+ if (settled)
670
+ return;
671
+ settled = true;
672
+ cleanup();
673
+ socket.close(1000, "aborted");
674
+ reject(new Error("Request was aborted"));
675
+ };
676
+ const cleanup = () => {
677
+ socket.removeEventListener("open", onOpen);
678
+ socket.removeEventListener("error", onError);
679
+ socket.removeEventListener("close", onClose);
680
+ signal?.removeEventListener("abort", onAbort);
681
+ };
682
+ socket.addEventListener("open", onOpen);
683
+ socket.addEventListener("error", onError);
684
+ socket.addEventListener("close", onClose);
685
+ signal?.addEventListener("abort", onAbort);
686
+ });
687
+ }
688
+ async function acquireWebSocket(url, headers, sessionId, signal) {
689
+ if (!sessionId) {
690
+ const socket = await connectWebSocket(url, headers, signal);
691
+ return {
692
+ socket,
693
+ reused: false,
694
+ release: ({ keep } = {}) => {
695
+ if (keep === false) {
696
+ closeWebSocketSilently(socket);
697
+ return;
698
+ }
699
+ closeWebSocketSilently(socket);
700
+ },
701
+ };
702
+ }
703
+ const cached = websocketSessionCache.get(sessionId);
704
+ if (cached) {
705
+ if (cached.idleTimer) {
706
+ clearTimeout(cached.idleTimer);
707
+ cached.idleTimer = undefined;
708
+ }
709
+ if (!cached.busy && isWebSocketReusable(cached.socket)) {
710
+ cached.busy = true;
711
+ return {
712
+ socket: cached.socket,
713
+ entry: cached,
714
+ reused: true,
715
+ release: ({ keep } = {}) => {
716
+ if (!keep || !isWebSocketReusable(cached.socket)) {
717
+ closeWebSocketSilently(cached.socket);
718
+ websocketSessionCache.delete(sessionId);
719
+ return;
720
+ }
721
+ cached.busy = false;
722
+ scheduleSessionWebSocketExpiry(sessionId, cached);
723
+ },
724
+ };
725
+ }
726
+ if (cached.busy) {
727
+ const socket = await connectWebSocket(url, headers, signal);
728
+ return {
729
+ socket,
730
+ reused: false,
731
+ release: () => {
732
+ closeWebSocketSilently(socket);
733
+ },
734
+ };
735
+ }
736
+ if (!isWebSocketReusable(cached.socket)) {
737
+ closeWebSocketSilently(cached.socket);
738
+ websocketSessionCache.delete(sessionId);
739
+ }
740
+ }
741
+ const socket = await connectWebSocket(url, headers, signal);
742
+ const entry = { socket, busy: true };
743
+ websocketSessionCache.set(sessionId, entry);
744
+ return {
745
+ socket,
746
+ entry,
747
+ reused: false,
748
+ release: ({ keep } = {}) => {
749
+ if (!keep || !isWebSocketReusable(entry.socket)) {
750
+ closeWebSocketSilently(entry.socket);
751
+ if (entry.idleTimer)
752
+ clearTimeout(entry.idleTimer);
753
+ if (websocketSessionCache.get(sessionId) === entry) {
754
+ websocketSessionCache.delete(sessionId);
755
+ }
756
+ return;
757
+ }
758
+ entry.busy = false;
759
+ scheduleSessionWebSocketExpiry(sessionId, entry);
760
+ },
761
+ };
762
+ }
763
+ function extractWebSocketError(event) {
764
+ if (event && typeof event === "object") {
765
+ const message = "message" in event ? event.message : undefined;
766
+ if (typeof message === "string" && message.length > 0) {
767
+ return new Error(message);
768
+ }
769
+ const nestedError = "error" in event ? event.error : undefined;
770
+ if (nestedError instanceof Error && nestedError.message.length > 0) {
771
+ return nestedError;
772
+ }
773
+ if (nestedError && typeof nestedError === "object" && "message" in nestedError) {
774
+ const nestedMessage = nestedError.message;
775
+ if (typeof nestedMessage === "string" && nestedMessage.length > 0) {
776
+ return new Error(nestedMessage);
777
+ }
778
+ }
779
+ }
780
+ return new Error("WebSocket error");
781
+ }
782
+ function extractWebSocketCloseError(event) {
783
+ if (event && typeof event === "object") {
784
+ const code = "code" in event ? event.code : undefined;
785
+ const reason = "reason" in event ? event.reason : undefined;
786
+ const wasClean = "wasClean" in event ? event.wasClean : undefined;
787
+ const codeText = typeof code === "number" ? ` ${code}` : "";
788
+ let reasonText = typeof reason === "string" && reason.length > 0 ? ` ${reason}` : "";
789
+ if (!reasonText && code === WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE) {
790
+ reasonText = " message too big";
791
+ }
792
+ return new WebSocketCloseError(`WebSocket closed${codeText}${reasonText}`.trim(), {
793
+ code: typeof code === "number" ? code : undefined,
794
+ reason: typeof reason === "string" && reason.length > 0 ? reason : undefined,
795
+ wasClean: typeof wasClean === "boolean" ? wasClean : undefined,
796
+ });
797
+ }
798
+ return new Error("WebSocket closed");
799
+ }
800
+ async function decodeWebSocketData(data) {
801
+ if (typeof data === "string")
802
+ return data;
803
+ if (data instanceof ArrayBuffer) {
804
+ return new TextDecoder().decode(new Uint8Array(data));
805
+ }
806
+ if (ArrayBuffer.isView(data)) {
807
+ const view = data;
808
+ return new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset, view.byteLength));
809
+ }
810
+ if (data && typeof data === "object" && "arrayBuffer" in data) {
811
+ const blobLike = data;
812
+ const arrayBuffer = await blobLike.arrayBuffer();
813
+ return new TextDecoder().decode(new Uint8Array(arrayBuffer));
814
+ }
815
+ return null;
816
+ }
817
+ async function* parseWebSocket(socket, signal) {
818
+ const queue = [];
819
+ let pending = null;
820
+ let done = false;
821
+ let failed = null;
822
+ let sawCompletion = false;
823
+ const wake = () => {
824
+ if (!pending)
825
+ return;
826
+ const resolve = pending;
827
+ pending = null;
828
+ resolve();
829
+ };
830
+ const onMessage = (event) => {
831
+ void (async () => {
832
+ let text = null;
833
+ try {
834
+ if (!event || typeof event !== "object" || !("data" in event))
835
+ return;
836
+ text = await decodeWebSocketData(event.data);
837
+ if (!text)
838
+ return;
839
+ const parsed = JSON.parse(text);
840
+ const type = typeof parsed.type === "string" ? parsed.type : "";
841
+ if (type === "response.completed" || type === "response.done" || type === "response.incomplete") {
842
+ sawCompletion = true;
843
+ done = true;
844
+ }
845
+ queue.push(parsed);
846
+ wake();
847
+ }
848
+ catch (cause) {
849
+ failed = new CodexProtocolError(`Invalid Codex WebSocket JSON: ${formatThrownValue(cause)}`, {
850
+ cause,
851
+ payload: text,
852
+ });
853
+ done = true;
854
+ wake();
855
+ }
856
+ })();
857
+ };
858
+ const onError = (event) => {
859
+ failed = extractWebSocketError(event);
860
+ done = true;
861
+ wake();
862
+ };
863
+ const onClose = (event) => {
864
+ if (sawCompletion) {
865
+ done = true;
866
+ wake();
867
+ return;
868
+ }
869
+ if (!failed) {
870
+ failed = extractWebSocketCloseError(event);
871
+ }
872
+ done = true;
873
+ wake();
874
+ };
875
+ const onAbort = () => {
876
+ failed = new Error("Request was aborted");
877
+ done = true;
878
+ wake();
879
+ };
880
+ socket.addEventListener("message", onMessage);
881
+ socket.addEventListener("error", onError);
882
+ socket.addEventListener("close", onClose);
883
+ signal?.addEventListener("abort", onAbort);
884
+ try {
885
+ while (true) {
886
+ if (signal?.aborted) {
887
+ throw new Error("Request was aborted");
888
+ }
889
+ if (queue.length > 0) {
890
+ yield queue.shift();
891
+ continue;
892
+ }
893
+ if (done)
894
+ break;
895
+ await new Promise((resolve) => {
896
+ pending = resolve;
897
+ });
898
+ }
899
+ if (failed) {
900
+ throw failed;
901
+ }
902
+ if (!sawCompletion) {
903
+ throw new Error("WebSocket stream closed before response.completed");
904
+ }
905
+ }
906
+ finally {
907
+ socket.removeEventListener("message", onMessage);
908
+ socket.removeEventListener("error", onError);
909
+ socket.removeEventListener("close", onClose);
910
+ signal?.removeEventListener("abort", onAbort);
911
+ }
912
+ }
913
+ function requestBodyWithoutInput(body) {
914
+ const { input: _input, previous_response_id: _previousResponseId, ...rest } = body;
915
+ return rest;
916
+ }
917
+ function responseInputsEqual(a, b) {
918
+ return JSON.stringify(a ?? []) === JSON.stringify(b ?? []);
919
+ }
920
+ function requestBodiesMatchExceptInput(a, b) {
921
+ return JSON.stringify(requestBodyWithoutInput(a)) === JSON.stringify(requestBodyWithoutInput(b));
922
+ }
923
+ function getCachedWebSocketInputDelta(body, continuation) {
924
+ if (!requestBodiesMatchExceptInput(body, continuation.lastRequestBody)) {
925
+ return undefined;
926
+ }
927
+ const currentInput = body.input ?? [];
928
+ const baseline = [...(continuation.lastRequestBody.input ?? []), ...continuation.lastResponseItems];
929
+ if (currentInput.length < baseline.length) {
930
+ return undefined;
931
+ }
932
+ const prefix = currentInput.slice(0, baseline.length);
933
+ if (!responseInputsEqual(prefix, baseline)) {
934
+ return undefined;
935
+ }
936
+ return currentInput.slice(baseline.length);
937
+ }
938
+ function buildCachedWebSocketRequestBody(entry, body) {
939
+ const continuation = entry.continuation;
940
+ if (!continuation) {
941
+ return body;
942
+ }
943
+ const delta = getCachedWebSocketInputDelta(body, continuation);
944
+ if (!delta || !continuation.lastResponseId) {
945
+ entry.continuation = undefined;
946
+ return body;
947
+ }
948
+ return {
949
+ ...body,
950
+ previous_response_id: continuation.lastResponseId,
951
+ input: delta,
952
+ };
953
+ }
954
+ async function* startWebSocketOutputOnFirstEvent(events, output, stream, onStart) {
955
+ let started = false;
956
+ for await (const event of events) {
957
+ if (!started) {
958
+ started = true;
959
+ onStart();
960
+ stream.push({ type: "start", partial: output });
961
+ }
962
+ yield event;
963
+ }
964
+ }
965
+ async function processWebSocketStream(url, body, headers, output, stream, model, onStart, options) {
966
+ const { socket, entry, reused, release } = await acquireWebSocket(url, headers, options?.sessionId, options?.signal);
967
+ let keepConnection = true;
968
+ const useCachedContext = options?.transport === "websocket-cached" || options?.transport === "auto";
969
+ // ChatGPT Codex Responses rejects `store: true` ("Store must be set to false").
970
+ // WebSocket continuation still works via connection-scoped previous_response_id state.
971
+ const fullBody = body;
972
+ const requestBody = useCachedContext && entry ? buildCachedWebSocketRequestBody(entry, fullBody) : fullBody;
973
+ const stats = options?.sessionId ? getOrCreateWebSocketDebugStats(options.sessionId) : undefined;
974
+ if (stats) {
975
+ stats.requests++;
976
+ if (reused)
977
+ stats.connectionsReused++;
978
+ else
979
+ stats.connectionsCreated++;
980
+ if (useCachedContext)
981
+ stats.cachedContextRequests++;
982
+ if (requestBody.store === true)
983
+ stats.storeTrueRequests++;
984
+ stats.lastInputItems = requestBody.input?.length ?? 0;
985
+ if (requestBody.previous_response_id) {
986
+ stats.deltaRequests++;
987
+ stats.lastDeltaInputItems = requestBody.input?.length ?? 0;
988
+ stats.lastPreviousResponseId = requestBody.previous_response_id;
989
+ }
990
+ else {
991
+ stats.fullContextRequests++;
992
+ stats.lastDeltaInputItems = undefined;
993
+ stats.lastPreviousResponseId = undefined;
994
+ }
995
+ }
996
+ try {
997
+ socket.send(JSON.stringify({ type: "response.create", ...requestBody }));
998
+ await processResponsesStream(startWebSocketOutputOnFirstEvent(mapCodexEvents(parseWebSocket(socket, options?.signal)), output, stream, onStart), output, stream, model, {
999
+ serviceTier: options?.serviceTier,
1000
+ resolveServiceTier: resolveCodexServiceTier,
1001
+ applyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),
1002
+ });
1003
+ if (options?.signal?.aborted) {
1004
+ keepConnection = false;
1005
+ }
1006
+ else if (useCachedContext && entry && output.responseId) {
1007
+ const responseItems = convertResponsesMessages(model, { messages: [output] }, CODEX_TOOL_CALL_PROVIDERS, {
1008
+ includeSystemPrompt: false,
1009
+ }).filter((item) => item.type !== "function_call_output");
1010
+ entry.continuation = {
1011
+ lastRequestBody: fullBody,
1012
+ lastResponseId: output.responseId,
1013
+ lastResponseItems: responseItems,
1014
+ };
1015
+ }
1016
+ }
1017
+ catch (error) {
1018
+ if (entry) {
1019
+ entry.continuation = undefined;
1020
+ }
1021
+ keepConnection = false;
1022
+ throw error;
1023
+ }
1024
+ finally {
1025
+ release({ keep: keepConnection });
1026
+ }
1027
+ }
1028
+ // ============================================================================
1029
+ // Error Handling
1030
+ // ============================================================================
1031
+ async function parseErrorResponse(response) {
1032
+ const raw = await response.text();
1033
+ let message = raw || response.statusText || "Request failed";
1034
+ let friendlyMessage;
1035
+ try {
1036
+ const parsed = JSON.parse(raw);
1037
+ const err = parsed?.error;
1038
+ if (err) {
1039
+ const code = err.code || err.type || "";
1040
+ if (/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(code) || response.status === 429) {
1041
+ const plan = err.plan_type ? ` (${err.plan_type.toLowerCase()} plan)` : "";
1042
+ const mins = err.resets_at
1043
+ ? Math.max(0, Math.round((err.resets_at * 1000 - Date.now()) / 60000))
1044
+ : undefined;
1045
+ const when = mins !== undefined ? ` Try again in ~${mins} min.` : "";
1046
+ friendlyMessage = `You have hit your ChatGPT usage limit${plan}.${when}`.trim();
1047
+ }
1048
+ message = err.message || friendlyMessage || message;
1049
+ }
1050
+ }
1051
+ catch { }
1052
+ return { message, friendlyMessage };
1053
+ }
1054
+ // ============================================================================
1055
+ // Auth & Headers
1056
+ // ============================================================================
1057
+ function extractAccountId(token) {
1058
+ try {
1059
+ const parts = token.split(".");
1060
+ if (parts.length !== 3)
1061
+ throw new Error("Invalid token");
1062
+ const payload = JSON.parse(atob(parts[1]));
1063
+ const accountId = payload?.[JWT_CLAIM_PATH]?.chatgpt_account_id;
1064
+ if (!accountId)
1065
+ throw new Error("No account ID in token");
1066
+ return accountId;
1067
+ }
1068
+ catch {
1069
+ throw new Error("Failed to extract accountId from token");
1070
+ }
1071
+ }
1072
+ function createCodexRequestId() {
1073
+ if (typeof globalThis.crypto?.randomUUID === "function") {
1074
+ return globalThis.crypto.randomUUID();
1075
+ }
1076
+ return `codex_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
1077
+ }
1078
+ function buildBaseCodexHeaders(initHeaders, additionalHeaders, accountId, token) {
1079
+ const headers = new Headers(initHeaders);
1080
+ for (const [key, value] of Object.entries(additionalHeaders || {})) {
1081
+ headers.set(key, value);
1082
+ }
1083
+ headers.set("Authorization", `Bearer ${token}`);
1084
+ headers.set("chatgpt-account-id", accountId);
1085
+ headers.set("originator", "senpi");
1086
+ const userAgent = _os ? `senpi (${_os.platform()} ${_os.release()}; ${_os.arch()})` : "senpi (browser)";
1087
+ headers.set("User-Agent", userAgent);
1088
+ return headers;
1089
+ }
1090
+ function buildSSEHeaders(initHeaders, additionalHeaders, accountId, token, sessionId) {
1091
+ const headers = buildBaseCodexHeaders(initHeaders, additionalHeaders, accountId, token);
1092
+ headers.set("OpenAI-Beta", "responses=experimental");
1093
+ headers.set("accept", "text/event-stream");
1094
+ headers.set("content-type", "application/json");
1095
+ if (sessionId) {
1096
+ headers.set("session_id", sessionId);
1097
+ headers.set("x-client-request-id", sessionId);
1098
+ }
1099
+ return headers;
1100
+ }
1101
+ function buildWebSocketHeaders(initHeaders, additionalHeaders, accountId, token, requestId) {
1102
+ const headers = buildBaseCodexHeaders(initHeaders, additionalHeaders, accountId, token);
1103
+ headers.delete("accept");
1104
+ headers.delete("content-type");
1105
+ headers.delete("OpenAI-Beta");
1106
+ headers.delete("openai-beta");
1107
+ headers.set("OpenAI-Beta", OPENAI_BETA_RESPONSES_WEBSOCKETS);
1108
+ headers.set("x-client-request-id", requestId);
1109
+ headers.set("session_id", requestId);
1110
+ return headers;
1111
+ }
1112
+ //# sourceMappingURL=openai-codex-responses.js.map