@entelligentsia/forgecli 0.11.3 → 0.19.0

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 (1099) hide show
  1. package/CHANGELOG.md +380 -0
  2. package/README.md +2 -1
  3. package/dist/CHANGELOG-forge-plugin.md +183 -0
  4. package/dist/CHANGELOG-pi.md +55 -0
  5. package/dist/bin/argv.d.ts +2 -0
  6. package/dist/bin/argv.js +3 -1
  7. package/dist/bin/argv.js.map +1 -1
  8. package/dist/bin/config.d.ts +5 -0
  9. package/dist/bin/config.js +25 -4
  10. package/dist/bin/config.js.map +1 -1
  11. package/dist/bin/forge.js +12 -37
  12. package/dist/bin/forge.js.map +1 -1
  13. package/dist/bin/shared-parser.d.ts +23 -0
  14. package/dist/bin/shared-parser.js +12 -0
  15. package/dist/bin/shared-parser.js.map +1 -0
  16. package/dist/bin/update-cli.js +5 -0
  17. package/dist/bin/update-cli.js.map +1 -1
  18. package/dist/extensions/forgecli/approve.d.ts +4 -6
  19. package/dist/extensions/forgecli/approve.js +8 -73
  20. package/dist/extensions/forgecli/approve.js.map +1 -1
  21. package/dist/extensions/forgecli/audience-gate.d.ts +1 -1
  22. package/dist/extensions/forgecli/calibrate.d.ts +4 -1
  23. package/dist/extensions/forgecli/calibrate.js +4 -12
  24. package/dist/extensions/forgecli/calibrate.js.map +1 -1
  25. package/dist/extensions/forgecli/collate.d.ts +4 -6
  26. package/dist/extensions/forgecli/collate.js +8 -73
  27. package/dist/extensions/forgecli/collate.js.map +1 -1
  28. package/dist/extensions/forgecli/commit.d.ts +4 -6
  29. package/dist/extensions/forgecli/commit.js +8 -73
  30. package/dist/extensions/forgecli/commit.js.map +1 -1
  31. package/dist/extensions/forgecli/config-layer.d.ts +15 -0
  32. package/dist/extensions/forgecli/config-layer.js.map +1 -1
  33. package/dist/extensions/forgecli/config-tui/handler.js +1 -0
  34. package/dist/extensions/forgecli/config-tui/handler.js.map +1 -1
  35. package/dist/extensions/forgecli/config-tui/screens/tier-menu.js +8 -1
  36. package/dist/extensions/forgecli/config-tui/screens/tier-menu.js.map +1 -1
  37. package/dist/extensions/forgecli/config-tui/state/init.js +1 -0
  38. package/dist/extensions/forgecli/config-tui/state/init.js.map +1 -1
  39. package/dist/extensions/forgecli/config-tui/state/model.d.ts +4 -0
  40. package/dist/extensions/forgecli/enhance.d.ts +4 -6
  41. package/dist/extensions/forgecli/enhance.js +9 -74
  42. package/dist/extensions/forgecli/enhance.js.map +1 -1
  43. package/dist/extensions/forgecli/fix-bug.d.ts +3 -0
  44. package/dist/extensions/forgecli/fix-bug.js +58 -46
  45. package/dist/extensions/forgecli/fix-bug.js.map +1 -1
  46. package/dist/extensions/forgecli/forge-artifact-tool.d.ts +2 -0
  47. package/dist/extensions/forgecli/forge-artifact-tool.js +185 -0
  48. package/dist/extensions/forgecli/forge-artifact-tool.js.map +1 -0
  49. package/dist/extensions/forgecli/forge-cli-schema.json +19 -0
  50. package/dist/extensions/forgecli/forge-init/phase-descriptors.d.ts +72 -0
  51. package/dist/extensions/forgecli/forge-init/phase-descriptors.js +350 -0
  52. package/dist/extensions/forgecli/forge-init/phase-descriptors.js.map +1 -0
  53. package/dist/extensions/forgecli/forge-init/phase4-register.d.ts +20 -0
  54. package/dist/extensions/forgecli/forge-init/phase4-register.js +353 -0
  55. package/dist/extensions/forgecli/forge-init/phase4-register.js.map +1 -0
  56. package/dist/extensions/forgecli/forge-init/prompts.d.ts +10 -0
  57. package/dist/extensions/forgecli/forge-init/prompts.js +91 -0
  58. package/dist/extensions/forgecli/forge-init/prompts.js.map +1 -0
  59. package/dist/extensions/forgecli/forge-init/verifiers.d.ts +20 -0
  60. package/dist/extensions/forgecli/forge-init/verifiers.js +81 -0
  61. package/dist/extensions/forgecli/forge-init/verifiers.js.map +1 -0
  62. package/dist/extensions/forgecli/forge-init.js +106 -748
  63. package/dist/extensions/forgecli/forge-init.js.map +1 -1
  64. package/dist/extensions/forgecli/forge-root.d.ts +0 -1
  65. package/dist/extensions/forgecli/forge-root.js +1 -11
  66. package/dist/extensions/forgecli/forge-root.js.map +1 -1
  67. package/dist/extensions/forgecli/forge-subagent.d.ts +11 -1
  68. package/dist/extensions/forgecli/forge-subagent.js +6 -1
  69. package/dist/extensions/forgecli/forge-subagent.js.map +1 -1
  70. package/dist/extensions/forgecli/forge-tools.d.ts +27 -7
  71. package/dist/extensions/forgecli/forge-tools.js +183 -64
  72. package/dist/extensions/forgecli/forge-tools.js.map +1 -1
  73. package/dist/extensions/forgecli/forge-update-command.js +29 -18
  74. package/dist/extensions/forgecli/forge-update-command.js.map +1 -1
  75. package/dist/extensions/forgecli/friction-emit.d.ts +99 -0
  76. package/dist/extensions/forgecli/friction-emit.js +247 -0
  77. package/dist/extensions/forgecli/friction-emit.js.map +1 -0
  78. package/dist/extensions/forgecli/health-check.js +1 -1
  79. package/dist/extensions/forgecli/health-check.js.map +1 -1
  80. package/dist/extensions/forgecli/hook-dispatcher.d.ts +1 -0
  81. package/dist/extensions/forgecli/hook-dispatcher.js +25 -0
  82. package/dist/extensions/forgecli/hook-dispatcher.js.map +1 -1
  83. package/dist/extensions/forgecli/hooks/post-init-hook.js +1 -1
  84. package/dist/extensions/forgecli/hooks/post-sprint-hook.js +1 -1
  85. package/dist/extensions/forgecli/hooks/write-guard.js +1 -1
  86. package/dist/extensions/forgecli/hooks/write-guard.js.map +1 -1
  87. package/dist/extensions/forgecli/implement.d.ts +4 -6
  88. package/dist/extensions/forgecli/implement.js +8 -73
  89. package/dist/extensions/forgecli/implement.js.map +1 -1
  90. package/dist/extensions/forgecli/index.js +27 -26
  91. package/dist/extensions/forgecli/index.js.map +1 -1
  92. package/dist/extensions/forgecli/lib/catalog-helpers.d.ts +13 -0
  93. package/dist/extensions/forgecli/lib/catalog-helpers.js +51 -0
  94. package/dist/extensions/forgecli/lib/catalog-helpers.js.map +1 -0
  95. package/dist/extensions/forgecli/lib/catalog-loader.d.ts +46 -0
  96. package/dist/extensions/forgecli/lib/catalog-loader.js +176 -0
  97. package/dist/extensions/forgecli/lib/catalog-loader.js.map +1 -0
  98. package/dist/extensions/forgecli/lib/catalog-types.d.ts +16 -0
  99. package/dist/extensions/forgecli/lib/catalog-types.js +161 -0
  100. package/dist/extensions/forgecli/lib/catalog-types.js.map +1 -0
  101. package/dist/extensions/forgecli/lib/exec-helpers.d.ts +25 -0
  102. package/dist/extensions/forgecli/lib/exec-helpers.js +52 -0
  103. package/dist/extensions/forgecli/lib/exec-helpers.js.map +1 -0
  104. package/dist/extensions/forgecli/lib/forge-config.d.ts +20 -0
  105. package/dist/extensions/forgecli/lib/forge-config.js +43 -0
  106. package/dist/extensions/forgecli/lib/forge-config.js.map +1 -0
  107. package/dist/extensions/forgecli/lib/frontmatter-parser.d.ts +13 -0
  108. package/dist/extensions/forgecli/lib/frontmatter-parser.js +56 -0
  109. package/dist/extensions/forgecli/lib/frontmatter-parser.js.map +1 -0
  110. package/dist/extensions/forgecli/lib/manifest-checker.d.ts +22 -0
  111. package/dist/extensions/forgecli/lib/manifest-checker.js +64 -0
  112. package/dist/extensions/forgecli/lib/manifest-checker.js.map +1 -0
  113. package/dist/extensions/forgecli/lib/orchestrator-preflight.d.ts +46 -0
  114. package/dist/extensions/forgecli/lib/orchestrator-preflight.js +64 -0
  115. package/dist/extensions/forgecli/lib/orchestrator-preflight.js.map +1 -0
  116. package/dist/extensions/forgecli/lib/orchestrator-types.d.ts +20 -0
  117. package/dist/extensions/forgecli/lib/orchestrator-types.js +14 -0
  118. package/dist/extensions/forgecli/lib/orchestrator-types.js.map +1 -0
  119. package/dist/extensions/forgecli/lib/parsers.d.ts +25 -0
  120. package/dist/extensions/forgecli/lib/parsers.js +164 -0
  121. package/dist/extensions/forgecli/lib/parsers.js.map +1 -0
  122. package/dist/extensions/forgecli/lib/shared-fs-utils.d.ts +12 -0
  123. package/dist/extensions/forgecli/lib/shared-fs-utils.js +37 -0
  124. package/dist/extensions/forgecli/lib/shared-fs-utils.js.map +1 -0
  125. package/dist/extensions/forgecli/lib/spawn-store-cli.d.ts +44 -0
  126. package/dist/extensions/forgecli/lib/spawn-store-cli.js +93 -0
  127. package/dist/extensions/forgecli/lib/spawn-store-cli.js.map +1 -0
  128. package/dist/extensions/forgecli/lib/state-helpers.d.ts +33 -0
  129. package/dist/extensions/forgecli/lib/state-helpers.js +69 -0
  130. package/dist/extensions/forgecli/lib/state-helpers.js.map +1 -0
  131. package/dist/extensions/forgecli/lib/store-cli-timeouts.d.ts +4 -0
  132. package/dist/extensions/forgecli/lib/store-cli-timeouts.js +10 -0
  133. package/dist/extensions/forgecli/lib/store-cli-timeouts.js.map +1 -0
  134. package/dist/extensions/forgecli/lib/versions.d.ts +56 -0
  135. package/dist/extensions/forgecli/lib/versions.js +116 -0
  136. package/dist/extensions/forgecli/lib/versions.js.map +1 -0
  137. package/dist/extensions/forgecli/loaders/persona-skill-loader.js +2 -2
  138. package/dist/extensions/forgecli/loaders/persona-skill-loader.js.map +1 -1
  139. package/dist/extensions/forgecli/migration-engine.d.ts +6 -0
  140. package/dist/extensions/forgecli/migration-engine.js +59 -39
  141. package/dist/extensions/forgecli/migration-engine.js.map +1 -1
  142. package/dist/extensions/forgecli/parsers/persona-skill-loader.d.ts +45 -0
  143. package/dist/extensions/forgecli/parsers/persona-skill-loader.js +201 -0
  144. package/dist/extensions/forgecli/parsers/persona-skill-loader.js.map +1 -0
  145. package/dist/extensions/forgecli/parsers/workflow-loader.d.ts +41 -0
  146. package/dist/extensions/forgecli/parsers/workflow-loader.js +87 -0
  147. package/dist/extensions/forgecli/parsers/workflow-loader.js.map +1 -0
  148. package/dist/extensions/forgecli/plan.d.ts +4 -6
  149. package/dist/extensions/forgecli/plan.js +9 -73
  150. package/dist/extensions/forgecli/plan.js.map +1 -1
  151. package/dist/extensions/forgecli/regenerate.d.ts +22 -0
  152. package/dist/extensions/forgecli/regenerate.js +133 -3
  153. package/dist/extensions/forgecli/regenerate.js.map +1 -1
  154. package/dist/extensions/forgecli/retrospective.d.ts +2 -1
  155. package/dist/extensions/forgecli/retrospective.js +6 -36
  156. package/dist/extensions/forgecli/retrospective.js.map +1 -1
  157. package/dist/extensions/forgecli/review-code.d.ts +4 -6
  158. package/dist/extensions/forgecli/review-code.js +8 -73
  159. package/dist/extensions/forgecli/review-code.js.map +1 -1
  160. package/dist/extensions/forgecli/review-plan.d.ts +4 -6
  161. package/dist/extensions/forgecli/review-plan.js +8 -73
  162. package/dist/extensions/forgecli/review-plan.js.map +1 -1
  163. package/dist/extensions/forgecli/run-sprint.d.ts +2 -0
  164. package/dist/extensions/forgecli/run-sprint.js +53 -52
  165. package/dist/extensions/forgecli/run-sprint.js.map +1 -1
  166. package/dist/extensions/forgecli/run-task.d.ts +3 -0
  167. package/dist/extensions/forgecli/run-task.js +39 -68
  168. package/dist/extensions/forgecli/run-task.js.map +1 -1
  169. package/dist/extensions/forgecli/skill-curation-flag.d.ts +21 -0
  170. package/dist/extensions/forgecli/skill-curation-flag.js +71 -0
  171. package/dist/extensions/forgecli/skill-curation-flag.js.map +1 -0
  172. package/dist/extensions/forgecli/skill-curator-subagent.d.ts +101 -0
  173. package/dist/extensions/forgecli/skill-curator-subagent.js +342 -0
  174. package/dist/extensions/forgecli/skill-curator-subagent.js.map +1 -0
  175. package/dist/extensions/forgecli/skill-retriever.d.ts +84 -0
  176. package/dist/extensions/forgecli/skill-retriever.js +246 -0
  177. package/dist/extensions/forgecli/skill-retriever.js.map +1 -0
  178. package/dist/extensions/forgecli/skill-usage-tracker.d.ts +91 -0
  179. package/dist/extensions/forgecli/skill-usage-tracker.js +224 -0
  180. package/dist/extensions/forgecli/skill-usage-tracker.js.map +1 -0
  181. package/dist/extensions/forgecli/store-error-remediation.d.ts +65 -0
  182. package/dist/extensions/forgecli/store-error-remediation.js +299 -0
  183. package/dist/extensions/forgecli/store-error-remediation.js.map +1 -0
  184. package/dist/extensions/forgecli/store-resolver.js +3 -12
  185. package/dist/extensions/forgecli/store-resolver.js.map +1 -1
  186. package/dist/extensions/forgecli/store-validator.js +6 -11
  187. package/dist/extensions/forgecli/store-validator.js.map +1 -1
  188. package/dist/extensions/forgecli/subagent/agents.d.ts +4 -0
  189. package/dist/extensions/forgecli/subagent/agents.js +5 -8
  190. package/dist/extensions/forgecli/subagent/agents.js.map +1 -1
  191. package/dist/extensions/forgecli/transition-guard.js +20 -61
  192. package/dist/extensions/forgecli/transition-guard.js.map +1 -1
  193. package/dist/extensions/forgecli/validate.d.ts +4 -6
  194. package/dist/extensions/forgecli/validate.js +8 -73
  195. package/dist/extensions/forgecli/validate.js.map +1 -1
  196. package/dist/extensions/forgecli/wf-engine/engine.js +2 -2
  197. package/dist/extensions/forgecli/wf-engine/engine.js.map +1 -1
  198. package/dist/extensions/forgecli/wf-engine/loader.d.ts +1 -1
  199. package/dist/extensions/forgecli/wf-engine/loader.js +1 -1
  200. package/dist/extensions/forgecli/wf-engine/loader.js.map +1 -1
  201. package/dist/forge-payload/.base-pack/skills/architect-skills.md +1 -0
  202. package/dist/forge-payload/.base-pack/skills/bug-fixer-skills.md +1 -0
  203. package/dist/forge-payload/.base-pack/skills/collator-skills.md +1 -0
  204. package/dist/forge-payload/.base-pack/skills/engineer-skills.md +1 -0
  205. package/dist/forge-payload/.base-pack/skills/generic-skills.md +1 -0
  206. package/dist/forge-payload/.base-pack/skills/qa-engineer-skills.md +1 -0
  207. package/dist/forge-payload/.base-pack/skills/supervisor-skills.md +1 -0
  208. package/dist/forge-payload/.base-pack/workflows/_fragments/generation-instructions.md +81 -0
  209. package/dist/forge-payload/.base-pack/workflows/_fragments/iron-laws.md +72 -0
  210. package/dist/forge-payload/.base-pack/workflows/_fragments/store-cli-verbs.md +11 -1
  211. package/dist/forge-payload/.base-pack/workflows/_fragments/store-write-verification.md +11 -0
  212. package/dist/forge-payload/.base-pack/workflows/architect_approve.md +11 -12
  213. package/dist/forge-payload/.base-pack/workflows/architect_review_sprint_completion.md +4 -1
  214. package/dist/forge-payload/.base-pack/workflows/architect_sprint_intake.md +10 -1
  215. package/dist/forge-payload/.base-pack/workflows/architect_sprint_plan.md +8 -1
  216. package/dist/forge-payload/.base-pack/workflows/collator_agent.md +18 -1
  217. package/dist/forge-payload/.base-pack/workflows/commit_task.md +5 -10
  218. package/dist/forge-payload/.base-pack/workflows/enhance.md +338 -11
  219. package/dist/forge-payload/.base-pack/workflows/fix_bug.md +9 -2
  220. package/dist/forge-payload/.base-pack/workflows/implement_plan.md +22 -35
  221. package/dist/forge-payload/.base-pack/workflows/migrate_structural.md +9 -0
  222. package/dist/forge-payload/.base-pack/workflows/orchestrate_task.md +4 -0
  223. package/dist/forge-payload/.base-pack/workflows/plan_task.md +17 -21
  224. package/dist/forge-payload/.base-pack/workflows/review_code.md +13 -20
  225. package/dist/forge-payload/.base-pack/workflows/review_plan.md +10 -21
  226. package/dist/forge-payload/.base-pack/workflows/sprint_retrospective.md +10 -1
  227. package/dist/forge-payload/.base-pack/workflows/update_implementation.md +5 -10
  228. package/dist/forge-payload/.base-pack/workflows/update_plan.md +5 -10
  229. package/dist/forge-payload/.base-pack/workflows/validate_task.md +11 -12
  230. package/dist/forge-payload/.claude-plugin/plugin.json +5 -5
  231. package/dist/forge-payload/.schemas/_defs/phaseSummary.schema.json +18 -0
  232. package/dist/forge-payload/.schemas/bug.schema.json +8 -24
  233. package/dist/forge-payload/.schemas/config.schema.json +165 -33
  234. package/dist/forge-payload/.schemas/enum-catalog.json +71 -0
  235. package/dist/forge-payload/.schemas/event.schema.json +20 -2
  236. package/dist/forge-payload/.schemas/migrations.json +452 -134
  237. package/dist/forge-payload/.schemas/proposal.schema.json +40 -0
  238. package/dist/forge-payload/.schemas/task.schema.json +6 -21
  239. package/dist/forge-payload/.schemas/transitions/bug.json +31 -0
  240. package/dist/forge-payload/.schemas/transitions/sprint.json +46 -0
  241. package/dist/forge-payload/.schemas/transitions/task.json +109 -0
  242. package/dist/forge-payload/agents/store-query-validator.md +103 -0
  243. package/dist/forge-payload/agents/tomoshibi.md +185 -0
  244. package/dist/forge-payload/commands/health.md +3 -3
  245. package/dist/forge-payload/commands/regenerate.md +109 -20
  246. package/dist/forge-payload/hooks/check-update.cjs +255 -0
  247. package/dist/forge-payload/hooks/check-update.js +378 -0
  248. package/dist/forge-payload/hooks/forge-permissions.cjs +171 -0
  249. package/dist/forge-payload/hooks/forge-permissions.js +164 -0
  250. package/dist/forge-payload/hooks/post-init.cjs +120 -0
  251. package/dist/forge-payload/hooks/post-sprint.cjs +108 -0
  252. package/dist/forge-payload/hooks/triage-error.cjs +104 -0
  253. package/dist/forge-payload/hooks/triage-error.js +77 -0
  254. package/dist/forge-payload/hooks/validate-write.cjs +250 -0
  255. package/dist/forge-payload/hooks/validate-write.js +250 -0
  256. package/dist/forge-payload/integrity.json +38 -0
  257. package/dist/forge-payload/meta/workflows/_fragments/generation-instructions.md +81 -0
  258. package/dist/forge-payload/meta/workflows/_fragments/iron-laws.md +72 -0
  259. package/dist/forge-payload/meta/workflows/_fragments/store-cli-verbs.md +11 -1
  260. package/dist/forge-payload/meta/workflows/_fragments/store-write-verification.md +11 -0
  261. package/dist/forge-payload/meta/workflows/meta-approve.md +9 -11
  262. package/dist/forge-payload/meta/workflows/meta-collate.md +16 -0
  263. package/dist/forge-payload/meta/workflows/meta-commit.md +3 -9
  264. package/dist/forge-payload/meta/workflows/meta-enhance.md +347 -12
  265. package/dist/forge-payload/meta/workflows/meta-fix-bug.md +8 -2
  266. package/dist/forge-payload/meta/workflows/meta-implement.md +20 -35
  267. package/dist/forge-payload/meta/workflows/meta-migrate.md +18 -0
  268. package/dist/forge-payload/meta/workflows/meta-orchestrate.md +2 -0
  269. package/dist/forge-payload/meta/workflows/meta-plan-task.md +15 -21
  270. package/dist/forge-payload/meta/workflows/meta-quiz-agent.md +4 -1
  271. package/dist/forge-payload/meta/workflows/meta-retrospective.md +8 -0
  272. package/dist/forge-payload/meta/workflows/meta-review-implementation.md +11 -19
  273. package/dist/forge-payload/meta/workflows/meta-review-plan.md +10 -16
  274. package/dist/forge-payload/meta/workflows/meta-review-sprint-completion.md +3 -0
  275. package/dist/forge-payload/meta/workflows/meta-sprint-intake.md +8 -0
  276. package/dist/forge-payload/meta/workflows/meta-sprint-plan.md +5 -0
  277. package/dist/forge-payload/meta/workflows/meta-update-implementation.md +3 -9
  278. package/dist/forge-payload/meta/workflows/meta-update-plan.md +3 -9
  279. package/dist/forge-payload/meta/workflows/meta-validate.md +9 -11
  280. package/dist/forge-payload/schemas/structure-manifest.json +513 -0
  281. package/dist/forge-payload/tools/build-context-pack.cjs +3 -2
  282. package/dist/forge-payload/tools/compression-gate.cjs +192 -0
  283. package/dist/forge-payload/tools/delete-candidate-detector.cjs +114 -0
  284. package/dist/forge-payload/tools/friction-emit.cjs +2 -1
  285. package/dist/forge-payload/tools/judge-proposal.cjs +177 -0
  286. package/dist/forge-payload/tools/lib/frontmatter.cjs +62 -0
  287. package/dist/forge-payload/tools/lib/fsutil.cjs +61 -0
  288. package/dist/forge-payload/tools/lib/json-io.cjs +43 -0
  289. package/dist/forge-payload/tools/lib/schema-loader.cjs +139 -0
  290. package/dist/forge-payload/tools/lib/slug.cjs +39 -0
  291. package/dist/forge-payload/tools/lib/store-facade.cjs +6 -5
  292. package/dist/forge-payload/tools/manage-versions.cjs +132 -4
  293. package/dist/forge-payload/tools/preflight-gate.cjs +55 -7
  294. package/dist/forge-payload/tools/queue-drain.cjs +152 -0
  295. package/dist/forge-payload/tools/replay-scoring.cjs +117 -0
  296. package/dist/forge-payload/tools/seed-store.cjs +1 -13
  297. package/dist/forge-payload/tools/store-cli.cjs +55 -108
  298. package/dist/forge-payload/tools/store.cjs +26 -37
  299. package/dist/forge-payload/tools/substitute-placeholders.cjs +74 -35
  300. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +1 -1
  301. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  302. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +23 -0
  303. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  304. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +2 -2
  305. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  306. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +1 -1
  307. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  308. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +2 -2
  309. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  310. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  311. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +5 -5
  312. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  313. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
  314. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +4 -4
  315. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
  316. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
  317. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +1 -1
  318. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -1
  319. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -1
  320. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +1 -1
  321. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
  322. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
  323. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.d.ts +4 -0
  324. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.d.ts.map +1 -0
  325. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js +3 -0
  326. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js.map +1 -0
  327. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +2 -2
  328. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
  329. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
  330. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +1 -1
  331. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -1
  332. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -1
  333. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +1 -1
  334. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -1
  335. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +1 -1
  336. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +1 -1
  337. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -1
  338. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -1
  339. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +1 -1
  340. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -1
  341. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +1 -1
  342. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +1 -1
  343. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -1
  344. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -1
  345. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.d.ts +20 -0
  346. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.d.ts.map +1 -0
  347. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js +92 -0
  348. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js.map +1 -0
  349. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.d.ts +18 -0
  350. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.d.ts.map +1 -0
  351. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js +42 -0
  352. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js.map +1 -0
  353. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.d.ts +10 -0
  354. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.d.ts.map +1 -0
  355. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js +31 -0
  356. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js.map +1 -0
  357. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +2 -2
  358. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -1
  359. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -1
  360. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +2 -2
  361. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
  362. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
  363. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.d.ts +30 -0
  364. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.d.ts.map +1 -0
  365. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js +170 -0
  366. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js.map +1 -0
  367. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.d.ts +26 -0
  368. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.d.ts.map +1 -0
  369. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js +90 -0
  370. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js.map +1 -0
  371. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +1 -1
  372. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -1
  373. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -1
  374. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +1 -1
  375. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts.map +1 -1
  376. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js.map +1 -1
  377. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +10 -22
  378. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
  379. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +17 -23
  380. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
  381. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +1 -1
  382. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -1
  383. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -1
  384. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +19 -19
  385. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  386. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  387. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts +2 -2
  388. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts.map +1 -1
  389. package/node_modules/@earendil-works/pi-agent-core/dist/node.js.map +1 -1
  390. package/node_modules/@earendil-works/pi-agent-core/package.json +9 -10
  391. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +1 -1
  392. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -1
  393. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -1
  394. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts +2 -2
  395. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -1
  396. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js.map +1 -1
  397. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts.map +1 -1
  398. package/node_modules/@earendil-works/pi-ai/dist/cli.js +14 -0
  399. package/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -1
  400. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +1 -1
  401. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
  402. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +10 -2
  403. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  404. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +2 -2
  405. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts.map +1 -1
  406. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  407. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  408. package/node_modules/@earendil-works/pi-ai/dist/image-models.js.map +1 -1
  409. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +1 -1
  410. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -1
  411. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -1
  412. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts +2 -2
  413. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -1
  414. package/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -1
  415. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +29 -29
  416. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  417. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  418. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +2 -2
  419. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  420. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +317 -509
  421. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  422. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +400 -620
  423. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  424. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  425. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts +1 -1
  426. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -1
  427. package/node_modules/@earendil-works/pi-ai/dist/oauth.js.map +1 -1
  428. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +1 -1
  429. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  430. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +5 -2
  431. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  432. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +23 -6
  433. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  434. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +11 -23
  435. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
  436. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +1 -1
  437. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
  438. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +2 -1
  439. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
  440. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts +1 -1
  441. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts.map +1 -1
  442. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js.map +1 -1
  443. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +1 -1
  444. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  445. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  446. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts +1 -1
  447. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
  448. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
  449. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts +1 -1
  450. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
  451. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -1
  452. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts +2 -2
  453. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -1
  454. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -1
  455. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts +2 -2
  456. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -1
  457. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -1
  458. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts +1 -1
  459. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -1
  460. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -1
  461. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +1 -1
  462. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -1
  463. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -1
  464. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts +1 -1
  465. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -1
  466. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -1
  467. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts +1 -1
  468. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
  469. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +12 -3
  470. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
  471. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts +1 -1
  472. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
  473. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +2 -1
  474. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
  475. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts +3 -0
  476. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
  477. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js +10 -0
  478. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js.map +1 -0
  479. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts +2 -2
  480. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -1
  481. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
  482. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts +1 -1
  483. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
  484. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +2 -1
  485. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
  486. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts +10 -10
  487. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
  488. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +13 -2
  489. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js.map +1 -1
  490. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +3 -3
  491. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
  492. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +6 -11
  493. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -1
  494. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts +1 -1
  495. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts.map +1 -1
  496. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js.map +1 -1
  497. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts +3 -3
  498. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -1
  499. package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -1
  500. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +13 -3
  501. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  502. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  503. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +3 -3
  504. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
  505. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +2 -2
  506. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
  507. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts +1 -1
  508. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -1
  509. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +1 -1
  510. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.d.ts +19 -0
  511. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.d.ts.map +1 -0
  512. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js +55 -0
  513. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js.map +1 -0
  514. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts +3 -3
  515. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  516. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +45 -69
  517. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  518. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts +6 -5
  519. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +1 -1
  520. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +1 -0
  521. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +1 -1
  522. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +1 -1
  523. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
  524. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +1 -1
  525. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
  526. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts +9 -2
  527. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts.map +1 -1
  528. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js.map +1 -1
  529. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +1 -1
  530. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  531. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
  532. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +1 -1
  533. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -1
  534. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -1
  535. package/node_modules/@earendil-works/pi-ai/package.json +15 -16
  536. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +55 -0
  537. package/node_modules/@earendil-works/pi-coding-agent/README.md +6 -4
  538. package/node_modules/@earendil-works/pi-coding-agent/dist/bun/cli.d.ts.map +1 -1
  539. package/node_modules/@earendil-works/pi-coding-agent/dist/bun/cli.js.map +1 -1
  540. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts +1 -1
  541. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  542. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
  543. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.d.ts +2 -2
  544. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.d.ts.map +1 -1
  545. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.js.map +1 -1
  546. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.d.ts.map +1 -1
  547. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js.map +1 -1
  548. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/initial-message.d.ts +1 -1
  549. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/initial-message.d.ts.map +1 -1
  550. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/initial-message.js.map +1 -1
  551. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/list-models.d.ts +1 -1
  552. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/list-models.d.ts.map +1 -1
  553. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/list-models.js.map +1 -1
  554. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/session-picker.d.ts +1 -1
  555. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/session-picker.d.ts.map +1 -1
  556. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/session-picker.js.map +1 -1
  557. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.d.ts.map +1 -1
  558. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js +4 -10
  559. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js.map +1 -1
  560. package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
  561. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +13 -14
  562. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
  563. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.d.ts +9 -9
  564. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -1
  565. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +6 -6
  566. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js.map +1 -1
  567. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.d.ts +7 -7
  568. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.d.ts.map +1 -1
  569. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +3 -2
  570. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js.map +1 -1
  571. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +23 -21
  572. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  573. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +99 -137
  574. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  575. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-guidance.d.ts.map +1 -1
  576. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-guidance.js.map +1 -1
  577. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts +1 -1
  578. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  579. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +3 -2
  580. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  581. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.d.ts +1 -1
  582. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.d.ts.map +1 -1
  583. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js.map +1 -1
  584. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts +3 -3
  585. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  586. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
  587. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.d.ts +2 -2
  588. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
  589. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
  590. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/index.d.ts +3 -3
  591. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/index.d.ts.map +1 -1
  592. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/index.js.map +1 -1
  593. package/node_modules/@earendil-works/pi-coding-agent/dist/core/exec.d.ts.map +1 -1
  594. package/node_modules/@earendil-works/pi-coding-agent/dist/core/exec.js.map +1 -1
  595. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.d.ts +1 -1
  596. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.d.ts.map +1 -1
  597. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.js +8 -6
  598. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.js.map +1 -1
  599. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +6 -3
  600. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts +2 -2
  601. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  602. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.js.map +1 -1
  603. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts +8 -8
  604. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  605. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  606. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.d.ts +2 -2
  607. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  608. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +12 -29
  609. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  610. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +6 -6
  611. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  612. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  613. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +19 -19
  614. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  615. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  616. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/wrapper.d.ts +2 -2
  617. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -1
  618. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/wrapper.js.map +1 -1
  619. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.d.ts.map +1 -1
  620. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.js.map +1 -1
  621. package/node_modules/@earendil-works/pi-coding-agent/dist/core/http-dispatcher.d.ts +21 -0
  622. package/node_modules/@earendil-works/pi-coding-agent/dist/core/http-dispatcher.d.ts.map +1 -0
  623. package/node_modules/@earendil-works/pi-coding-agent/dist/core/http-dispatcher.js +48 -0
  624. package/node_modules/@earendil-works/pi-coding-agent/dist/core/http-dispatcher.js.map +1 -0
  625. package/node_modules/@earendil-works/pi-coding-agent/dist/core/index.d.ts +8 -8
  626. package/node_modules/@earendil-works/pi-coding-agent/dist/core/index.d.ts.map +1 -1
  627. package/node_modules/@earendil-works/pi-coding-agent/dist/core/index.js.map +1 -1
  628. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
  629. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js.map +1 -1
  630. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.d.ts +4 -4
  631. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  632. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +7 -3
  633. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  634. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.d.ts +1 -1
  635. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  636. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  637. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts +2 -1
  638. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  639. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +48 -32
  640. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  641. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.d.ts +1 -1
  642. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
  643. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +6 -20
  644. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
  645. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resolve-config-value.d.ts.map +1 -1
  646. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resolve-config-value.js.map +1 -1
  647. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts +9 -9
  648. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  649. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +38 -31
  650. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  651. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts +13 -13
  652. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  653. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +9 -4
  654. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js.map +1 -1
  655. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.d.ts +1 -1
  656. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
  657. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +32 -24
  658. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js.map +1 -1
  659. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts +3 -0
  660. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  661. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +26 -13
  662. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  663. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.d.ts +2 -2
  664. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
  665. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +8 -22
  666. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js.map +1 -1
  667. package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.d.ts +1 -1
  668. package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.d.ts.map +1 -1
  669. package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.js.map +1 -1
  670. package/node_modules/@earendil-works/pi-coding-agent/dist/core/source-info.d.ts +1 -1
  671. package/node_modules/@earendil-works/pi-coding-agent/dist/core/source-info.d.ts.map +1 -1
  672. package/node_modules/@earendil-works/pi-coding-agent/dist/core/source-info.js.map +1 -1
  673. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts +1 -1
  674. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
  675. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +1 -0
  676. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
  677. package/node_modules/@earendil-works/pi-coding-agent/dist/core/telemetry.d.ts +1 -1
  678. package/node_modules/@earendil-works/pi-coding-agent/dist/core/telemetry.d.ts.map +1 -1
  679. package/node_modules/@earendil-works/pi-coding-agent/dist/core/telemetry.js.map +1 -1
  680. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts +2 -2
  681. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  682. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +9 -3
  683. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  684. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.d.ts +3 -1
  685. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -1
  686. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js +8 -1
  687. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -1
  688. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts +5 -3
  689. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
  690. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +3 -2
  691. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
  692. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts +2 -2
  693. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
  694. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js.map +1 -1
  695. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts +2 -2
  696. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
  697. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
  698. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/index.d.ts +17 -17
  699. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
  700. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/index.js.map +1 -1
  701. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts +2 -2
  702. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
  703. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
  704. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.d.ts +3 -1
  705. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.d.ts.map +1 -1
  706. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js +9 -3
  707. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js.map +1 -1
  708. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.d.ts.map +1 -1
  709. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js +3 -22
  710. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js.map +1 -1
  711. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts +2 -2
  712. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  713. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  714. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts.map +1 -1
  715. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js.map +1 -1
  716. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/tool-definition-wrapper.d.ts +1 -1
  717. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  718. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  719. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.d.ts.map +1 -1
  720. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +12 -2
  721. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js.map +1 -1
  722. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts +1 -1
  723. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
  724. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js.map +1 -1
  725. package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts +30 -29
  726. package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts.map +1 -1
  727. package/node_modules/@earendil-works/pi-coding-agent/dist/index.js +2 -1
  728. package/node_modules/@earendil-works/pi-coding-agent/dist/index.js.map +1 -1
  729. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts +1 -1
  730. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  731. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +7 -6
  732. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  733. package/node_modules/@earendil-works/pi-coding-agent/dist/migrations.d.ts.map +1 -1
  734. package/node_modules/@earendil-works/pi-coding-agent/dist/migrations.js.map +1 -1
  735. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/index.d.ts +5 -5
  736. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/index.d.ts.map +1 -1
  737. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/index.js.map +1 -1
  738. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/armin.d.ts.map +1 -1
  739. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/armin.js.map +1 -1
  740. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  741. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  742. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +1 -1
  743. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  744. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
  745. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
  746. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  747. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  748. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
  749. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  750. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  751. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
  752. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  753. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  754. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts +2 -2
  755. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  756. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js +1 -1
  757. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -1
  758. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +2 -2
  759. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  760. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +2 -2
  761. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  762. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-editor.d.ts +1 -1
  763. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  764. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -1
  765. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts +2 -2
  766. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  767. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -1
  768. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  769. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/daxnuts.js.map +1 -1
  770. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -1
  771. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/diff.js.map +1 -1
  772. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  773. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  774. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  775. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  776. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts +1 -1
  777. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  778. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -1
  779. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  780. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -1
  781. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  782. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -1
  783. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.d.ts +4 -3
  784. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  785. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js +16 -7
  786. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  787. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/index.d.ts +31 -31
  788. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -1
  789. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/index.js.map +1 -1
  790. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  791. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  792. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts +10 -2
  793. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  794. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +31 -6
  795. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -1
  796. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts +2 -2
  797. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  798. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
  799. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  800. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  801. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  802. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  803. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  804. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +1 -1
  805. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  806. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  807. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +3 -3
  808. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  809. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
  810. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  811. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  812. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +15 -0
  813. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  814. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  815. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  816. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
  817. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  818. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  819. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  820. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -1
  821. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  822. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  823. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +1 -1
  824. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  825. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  826. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts +1 -1
  827. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  828. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -1
  829. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  830. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  831. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  832. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
  833. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +4 -3
  834. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  835. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +37 -14
  836. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  837. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -1
  838. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  839. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +37 -28
  840. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  841. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.d.ts +1 -1
  842. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
  843. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
  844. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts +5 -5
  845. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  846. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +1 -1
  847. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js.map +1 -1
  848. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts +2 -2
  849. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  850. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
  851. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts +4 -4
  852. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  853. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-types.js.map +1 -1
  854. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts.map +1 -1
  855. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +40 -1
  856. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js.map +1 -1
  857. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.d.ts +1 -1
  858. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
  859. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.js.map +1 -1
  860. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
  861. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
  862. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.d.ts.map +1 -1
  863. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js.map +1 -1
  864. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/exif-orientation.d.ts +1 -1
  865. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/exif-orientation.d.ts.map +1 -1
  866. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/exif-orientation.js.map +1 -1
  867. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-convert.d.ts.map +1 -1
  868. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-convert.js.map +1 -1
  869. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -1
  870. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js.map +1 -1
  871. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.d.ts +16 -1
  872. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.d.ts.map +1 -1
  873. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.js +49 -7
  874. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.js.map +1 -1
  875. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.d.ts.map +1 -1
  876. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js.map +1 -1
  877. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.d.ts.map +1 -1
  878. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js.map +1 -1
  879. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
  880. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
  881. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/version-check.d.ts +2 -1
  882. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/version-check.d.ts.map +1 -1
  883. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/version-check.js +9 -4
  884. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/version-check.js.map +1 -1
  885. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.d.ts.map +1 -1
  886. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.js.map +1 -1
  887. package/node_modules/@earendil-works/pi-coding-agent/docs/custom-provider.md +44 -12
  888. package/node_modules/@earendil-works/pi-coding-agent/docs/index.md +6 -4
  889. package/node_modules/@earendil-works/pi-coding-agent/docs/models.md +8 -2
  890. package/node_modules/@earendil-works/pi-coding-agent/docs/packages.md +5 -4
  891. package/node_modules/@earendil-works/pi-coding-agent/docs/quickstart.md +3 -1
  892. package/node_modules/@earendil-works/pi-coding-agent/docs/sdk.md +2 -0
  893. package/node_modules/@earendil-works/pi-coding-agent/docs/termux.md +1 -1
  894. package/node_modules/@earendil-works/pi-coding-agent/docs/usage.md +2 -2
  895. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +2 -2
  896. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  897. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
  898. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/doom-overlay/doom-component.ts +2 -2
  899. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/doom-overlay/index.ts +3 -3
  900. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/overlay-qa-tests.ts +97 -66
  901. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/overlay-test.ts +7 -4
  902. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/plan-mode/index.ts +1 -1
  903. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +2 -2
  904. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/index.ts +1 -1
  905. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +3 -3
  906. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +1425 -0
  907. package/node_modules/@earendil-works/pi-coding-agent/package.json +32 -31
  908. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
  909. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
  910. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +1 -1
  911. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -1
  912. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -1
  913. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +1 -1
  914. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -1
  915. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +1 -1
  916. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +3 -3
  917. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
  918. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  919. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +2 -2
  920. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -1
  921. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -1
  922. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +1 -1
  923. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
  924. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
  925. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +5 -5
  926. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -1
  927. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +4 -4
  928. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -1
  929. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +1 -1
  930. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
  931. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
  932. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +1 -1
  933. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -1
  934. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -1
  935. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +1 -1
  936. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
  937. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
  938. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +1 -1
  939. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +1 -1
  940. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +1 -1
  941. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +1 -1
  942. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -1
  943. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -1
  944. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +1 -1
  945. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +1 -1
  946. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +1 -1
  947. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +2 -2
  948. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +1 -1
  949. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +1 -1
  950. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +22 -22
  951. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  952. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  953. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +1 -1
  954. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  955. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  956. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  957. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +25 -15
  958. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  959. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +2 -2
  960. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  961. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  962. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  963. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  964. package/node_modules/@earendil-works/pi-tui/package.json +8 -11
  965. package/node_modules/@mariozechner/clipboard/package.json +2 -1
  966. package/node_modules/@mariozechner/clipboard-linux-x64-musl/README.md +3 -0
  967. package/node_modules/@mariozechner/clipboard-linux-x64-musl/clipboard.linux-x64-musl.node +0 -0
  968. package/node_modules/@mariozechner/clipboard-linux-x64-musl/package.json +25 -0
  969. package/package.json +15 -8
  970. package/dist/bin/forgecli.d.ts +0 -2
  971. package/dist/bin/forgecli.js +0 -6
  972. package/dist/bin/forgecli.js.map +0 -1
  973. package/node_modules/koffi/CHANGELOG.md +0 -1093
  974. package/node_modules/koffi/LICENSE.txt +0 -22
  975. package/node_modules/koffi/README.md +0 -43
  976. package/node_modules/koffi/build/koffi/darwin_arm64/koffi.node +0 -0
  977. package/node_modules/koffi/build/koffi/darwin_x64/koffi.node +0 -0
  978. package/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node +0 -0
  979. package/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node +0 -0
  980. package/node_modules/koffi/build/koffi/freebsd_x64/koffi.node +0 -0
  981. package/node_modules/koffi/build/koffi/linux_arm64/koffi.node +0 -0
  982. package/node_modules/koffi/build/koffi/linux_armhf/koffi.node +0 -0
  983. package/node_modules/koffi/build/koffi/linux_ia32/koffi.node +0 -0
  984. package/node_modules/koffi/build/koffi/linux_loong64/koffi.node +0 -0
  985. package/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node +0 -0
  986. package/node_modules/koffi/build/koffi/linux_x64/koffi.node +0 -0
  987. package/node_modules/koffi/build/koffi/musl_arm64/koffi.node +0 -0
  988. package/node_modules/koffi/build/koffi/musl_x64/koffi.node +0 -0
  989. package/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node +0 -0
  990. package/node_modules/koffi/build/koffi/openbsd_x64/koffi.node +0 -0
  991. package/node_modules/koffi/build/koffi/win32_arm64/koffi.exp +0 -0
  992. package/node_modules/koffi/build/koffi/win32_arm64/koffi.lib +0 -0
  993. package/node_modules/koffi/build/koffi/win32_arm64/koffi.node +0 -0
  994. package/node_modules/koffi/build/koffi/win32_ia32/koffi.exp +0 -0
  995. package/node_modules/koffi/build/koffi/win32_ia32/koffi.lib +0 -0
  996. package/node_modules/koffi/build/koffi/win32_ia32/koffi.node +0 -0
  997. package/node_modules/koffi/build/koffi/win32_x64/koffi.exp +0 -0
  998. package/node_modules/koffi/build/koffi/win32_x64/koffi.lib +0 -0
  999. package/node_modules/koffi/build/koffi/win32_x64/koffi.node +0 -0
  1000. package/node_modules/koffi/doc/benchmarks.md +0 -126
  1001. package/node_modules/koffi/doc/callbacks.md +0 -210
  1002. package/node_modules/koffi/doc/contribute.md +0 -148
  1003. package/node_modules/koffi/doc/functions.md +0 -250
  1004. package/node_modules/koffi/doc/index.md +0 -61
  1005. package/node_modules/koffi/doc/input.md +0 -471
  1006. package/node_modules/koffi/doc/migration.md +0 -159
  1007. package/node_modules/koffi/doc/misc.md +0 -180
  1008. package/node_modules/koffi/doc/output.md +0 -305
  1009. package/node_modules/koffi/doc/packaging.md +0 -88
  1010. package/node_modules/koffi/doc/platforms.md +0 -36
  1011. package/node_modules/koffi/doc/pointers.md +0 -328
  1012. package/node_modules/koffi/doc/start.md +0 -118
  1013. package/node_modules/koffi/doc/unions.md +0 -186
  1014. package/node_modules/koffi/doc/variables.md +0 -102
  1015. package/node_modules/koffi/index.d.ts +0 -288
  1016. package/node_modules/koffi/index.js +0 -634
  1017. package/node_modules/koffi/indirect.js +0 -533
  1018. package/node_modules/koffi/lib/native/base/base.cc +0 -11015
  1019. package/node_modules/koffi/lib/native/base/base.hh +0 -6003
  1020. package/node_modules/koffi/lib/native/base/crc.inc +0 -2214
  1021. package/node_modules/koffi/lib/native/base/crc_gen.py +0 -72
  1022. package/node_modules/koffi/lib/native/base/mimetypes.inc +0 -1248
  1023. package/node_modules/koffi/lib/native/base/mimetypes_gen.py +0 -58
  1024. package/node_modules/koffi/lib/native/base/tower.cc +0 -821
  1025. package/node_modules/koffi/lib/native/base/tower.hh +0 -81
  1026. package/node_modules/koffi/lib/native/base/unicode.inc +0 -408
  1027. package/node_modules/koffi/lib/native/base/unicode_gen.py +0 -152
  1028. package/node_modules/koffi/package.json +0 -38
  1029. package/node_modules/koffi/src/cnoke/LICENSE.txt +0 -22
  1030. package/node_modules/koffi/src/cnoke/README.md +0 -99
  1031. package/node_modules/koffi/src/cnoke/assets/FindCNoke.cmake +0 -127
  1032. package/node_modules/koffi/src/cnoke/assets/toolchains.json +0 -126
  1033. package/node_modules/koffi/src/cnoke/assets/win_delay_hook.c +0 -36
  1034. package/node_modules/koffi/src/cnoke/cnoke.js +0 -170
  1035. package/node_modules/koffi/src/cnoke/package.json +0 -24
  1036. package/node_modules/koffi/src/cnoke/src/builder.js +0 -511
  1037. package/node_modules/koffi/src/cnoke/src/index.js +0 -10
  1038. package/node_modules/koffi/src/cnoke/src/tools.js +0 -407
  1039. package/node_modules/koffi/src/koffi/CMakeLists.txt +0 -182
  1040. package/node_modules/koffi/src/koffi/src/abi_arm32.cc +0 -1018
  1041. package/node_modules/koffi/src/koffi/src/abi_arm32_asm.S +0 -169
  1042. package/node_modules/koffi/src/koffi/src/abi_arm64.cc +0 -1295
  1043. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.S +0 -195
  1044. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.asm +0 -174
  1045. package/node_modules/koffi/src/koffi/src/abi_loong64.cc +0 -5
  1046. package/node_modules/koffi/src/koffi/src/abi_loong64_asm.S +0 -204
  1047. package/node_modules/koffi/src/koffi/src/abi_riscv64.cc +0 -915
  1048. package/node_modules/koffi/src/koffi/src/abi_riscv64_asm.S +0 -203
  1049. package/node_modules/koffi/src/koffi/src/abi_x64_sysv.cc +0 -939
  1050. package/node_modules/koffi/src/koffi/src/abi_x64_sysv_asm.S +0 -231
  1051. package/node_modules/koffi/src/koffi/src/abi_x64_win.cc +0 -715
  1052. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.S +0 -166
  1053. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.asm +0 -192
  1054. package/node_modules/koffi/src/koffi/src/abi_x86.cc +0 -860
  1055. package/node_modules/koffi/src/koffi/src/abi_x86_asm.S +0 -193
  1056. package/node_modules/koffi/src/koffi/src/abi_x86_asm.asm +0 -177
  1057. package/node_modules/koffi/src/koffi/src/call.cc +0 -1326
  1058. package/node_modules/koffi/src/koffi/src/call.hh +0 -179
  1059. package/node_modules/koffi/src/koffi/src/errno.inc +0 -462
  1060. package/node_modules/koffi/src/koffi/src/ffi.cc +0 -2702
  1061. package/node_modules/koffi/src/koffi/src/ffi.hh +0 -354
  1062. package/node_modules/koffi/src/koffi/src/init.js +0 -105
  1063. package/node_modules/koffi/src/koffi/src/parser.cc +0 -220
  1064. package/node_modules/koffi/src/koffi/src/parser.hh +0 -54
  1065. package/node_modules/koffi/src/koffi/src/util.cc +0 -1807
  1066. package/node_modules/koffi/src/koffi/src/util.hh +0 -221
  1067. package/node_modules/koffi/src/koffi/src/uv.cc +0 -193
  1068. package/node_modules/koffi/src/koffi/src/uv.def +0 -10
  1069. package/node_modules/koffi/src/koffi/src/uv.hh +0 -40
  1070. package/node_modules/koffi/src/koffi/src/win32.cc +0 -198
  1071. package/node_modules/koffi/src/koffi/src/win32.hh +0 -119
  1072. package/node_modules/koffi/src/koffi/tools/write_trampolines.js +0 -77
  1073. package/node_modules/koffi/vendor/node-addon-api/LICENSE.md +0 -9
  1074. package/node_modules/koffi/vendor/node-addon-api/README.md +0 -95
  1075. package/node_modules/koffi/vendor/node-addon-api/napi-inl.deprecated.h +0 -186
  1076. package/node_modules/koffi/vendor/node-addon-api/napi-inl.h +0 -7033
  1077. package/node_modules/koffi/vendor/node-addon-api/napi.h +0 -3309
  1078. package/node_modules/koffi/vendor/node-api-headers/LICENSE +0 -21
  1079. package/node_modules/koffi/vendor/node-api-headers/README.md +0 -95
  1080. package/node_modules/koffi/vendor/node-api-headers/def/js_native_api.def +0 -125
  1081. package/node_modules/koffi/vendor/node-api-headers/def/node_api.def +0 -157
  1082. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api.h +0 -591
  1083. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api_types.h +0 -210
  1084. package/node_modules/koffi/vendor/node-api-headers/include/node_api.h +0 -265
  1085. package/node_modules/koffi/vendor/node-api-headers/include/node_api_types.h +0 -58
  1086. package/node_modules/koffi/vendor/node-api-headers/include/uv/aix.h +0 -32
  1087. package/node_modules/koffi/vendor/node-api-headers/include/uv/bsd.h +0 -34
  1088. package/node_modules/koffi/vendor/node-api-headers/include/uv/darwin.h +0 -61
  1089. package/node_modules/koffi/vendor/node-api-headers/include/uv/errno.h +0 -483
  1090. package/node_modules/koffi/vendor/node-api-headers/include/uv/linux.h +0 -34
  1091. package/node_modules/koffi/vendor/node-api-headers/include/uv/os390.h +0 -33
  1092. package/node_modules/koffi/vendor/node-api-headers/include/uv/posix.h +0 -31
  1093. package/node_modules/koffi/vendor/node-api-headers/include/uv/sunos.h +0 -44
  1094. package/node_modules/koffi/vendor/node-api-headers/include/uv/threadpool.h +0 -37
  1095. package/node_modules/koffi/vendor/node-api-headers/include/uv/tree.h +0 -521
  1096. package/node_modules/koffi/vendor/node-api-headers/include/uv/unix.h +0 -512
  1097. package/node_modules/koffi/vendor/node-api-headers/include/uv/version.h +0 -43
  1098. package/node_modules/koffi/vendor/node-api-headers/include/uv/win.h +0 -698
  1099. package/node_modules/koffi/vendor/node-api-headers/include/uv.h +0 -1990
@@ -1 +1 @@
1
- {"version":3,"file":"openai-codex-responses.js","sourceRoot":"","sources":["../../src/providers/openai-codex-responses.ts"],"names":[],"mappings":"AAQA,mFAAmF;AACnF,IAAI,GAAG,GAAyB,IAAI,CAAC;AAIrC,MAAM,aAAa,GAAkB,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACtE,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AAEzC,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACzF,aAAa,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC5C,GAAG,GAAG,CAAkB,CAAC;IAAA,CACzB,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAWzE,OAAO,EACN,gCAAgC,EAChC,gCAAgC,EAChC,iBAAiB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACvH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,MAAM,sBAAsB,GAAG,iCAAiC,CAAC;AACjE,MAAM,cAAc,GAAG,6BAAsC,CAAC;AAC9D,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MA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,CAAC,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACxF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC/B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,gCAAgC,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC;AAAA,CACf","sourcesContent":["import type * as NodeOs from \"node:os\";\nimport type {\n\tTool as OpenAITool,\n\tResponseCreateParamsStreaming,\n\tResponseInput,\n\tResponseStreamEvent,\n} from \"openai/resources/responses/responses.js\";\n\n// NEVER convert to top-level runtime imports - breaks browser/Vite builds (web-ui)\nlet _os: typeof NodeOs | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\n\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_os = m as typeof NodeOs;\n\t});\n}\n\nimport { getEnvApiKey } from \"../env-api-keys.js\";\nimport { clampThinkingLevel } from \"../models.js\";\nimport { registerSessionResourceCleanup } from \"../session-resources.js\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tContext,\n\tModel,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tUsage,\n} from \"../types.js\";\nimport {\n\tappendAssistantMessageDiagnostic,\n\tcreateAssistantMessageDiagnostic,\n\tformatThrownValue,\n} from \"../utils/diagnostics.js\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.js\";\nimport { headersToRecord } from \"../utils/headers.js\";\nimport { convertResponsesMessages, convertResponsesTools, processResponsesStream } from \"./openai-responses-shared.js\";\nimport { buildBaseOptions } from \"./simple-options.js\";\n\n// ============================================================================\n// Configuration\n// ============================================================================\n\nconst DEFAULT_CODEX_BASE_URL = \"https://chatgpt.com/backend-api\";\nconst JWT_CLAIM_PATH = \"https://api.openai.com/auth\" as const;\nconst MAX_RETRIES = 3;\nconst BASE_DELAY_MS = 1000;\nconst CODEX_TOOL_CALL_PROVIDERS = new Set([\"openai\", \"openai-codex\", \"opencode\"]);\nconst WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE = 1009;\n\nconst CODEX_RESPONSE_STATUSES = new Set<CodexResponseStatus>([\n\t\"completed\",\n\t\"incomplete\",\n\t\"failed\",\n\t\"cancelled\",\n\t\"queued\",\n\t\"in_progress\",\n]);\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface OpenAICodexResponsesOptions extends StreamOptions {\n\treasoningEffort?: \"none\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n\treasoningSummary?: \"auto\" | \"concise\" | \"detailed\" | \"off\" | \"on\" | null;\n\tserviceTier?: ResponseCreateParamsStreaming[\"service_tier\"];\n\ttextVerbosity?: \"low\" | \"medium\" | \"high\";\n}\n\ntype CodexResponseStatus = \"completed\" | \"incomplete\" | \"failed\" | \"cancelled\" | \"queued\" | \"in_progress\";\n\ninterface RequestBody {\n\tmodel: string;\n\tstore?: boolean;\n\tstream?: boolean;\n\tinstructions?: string;\n\tprevious_response_id?: string;\n\tinput?: ResponseInput;\n\ttools?: OpenAITool[];\n\ttool_choice?: \"auto\";\n\tparallel_tool_calls?: boolean;\n\ttemperature?: number;\n\treasoning?: { effort?: string; summary?: string };\n\tservice_tier?: ResponseCreateParamsStreaming[\"service_tier\"];\n\ttext?: { verbosity?: string };\n\tinclude?: string[];\n\tprompt_cache_key?: string;\n\t[key: string]: unknown;\n}\n\n// ============================================================================\n// Retry Helpers\n// ============================================================================\n\nfunction isRetryableError(status: number, errorText: string): boolean {\n\tif (status === 429 || status === 500 || status === 502 || status === 503 || status === 504) {\n\t\treturn true;\n\t}\n\treturn /rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(errorText);\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new Error(\"Request was aborted\"));\n\t\t\treturn;\n\t\t}\n\t\tconst timeout = setTimeout(resolve, ms);\n\t\tsignal?.addEventListener(\"abort\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\treject(new Error(\"Request was aborted\"));\n\t\t});\n\t});\n}\n\n// ============================================================================\n// Main Stream Function\n// ============================================================================\n\nexport const streamOpenAICodexResponses: StreamFunction<\"openai-codex-responses\", OpenAICodexResponsesOptions> = (\n\tmodel: Model<\"openai-codex-responses\">,\n\tcontext: Context,\n\toptions?: OpenAICodexResponsesOptions,\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\n\t(async () => {\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: \"openai-codex-responses\" as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"stop\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\ttry {\n\t\t\tconst apiKey = options?.apiKey || getEnvApiKey(model.provider) || \"\";\n\t\t\tif (!apiKey) {\n\t\t\t\tthrow new Error(`No API key for provider: ${model.provider}`);\n\t\t\t}\n\n\t\t\tconst accountId = extractAccountId(apiKey);\n\t\t\tlet body = buildRequestBody(model, context, options);\n\t\t\tconst nextBody = await options?.onPayload?.(body, model);\n\t\t\tif (nextBody !== undefined) {\n\t\t\t\tbody = nextBody as RequestBody;\n\t\t\t}\n\t\t\tconst websocketRequestId = options?.sessionId || createCodexRequestId();\n\t\t\tconst sseHeaders = buildSSEHeaders(model.headers, options?.headers, accountId, apiKey, options?.sessionId);\n\t\t\tconst websocketHeaders = buildWebSocketHeaders(\n\t\t\t\tmodel.headers,\n\t\t\t\toptions?.headers,\n\t\t\t\taccountId,\n\t\t\t\tapiKey,\n\t\t\t\twebsocketRequestId,\n\t\t\t);\n\t\t\tconst bodyJson = JSON.stringify(body);\n\t\t\tconst transport = options?.transport || \"auto\";\n\t\t\tconst websocketDisabledForSession = transport !== \"sse\" && isWebSocketSseFallbackActive(options?.sessionId);\n\t\t\tif (websocketDisabledForSession) {\n\t\t\t\trecordWebSocketSseFallback(options?.sessionId);\n\t\t\t}\n\n\t\t\tif (transport !== \"sse\" && !websocketDisabledForSession) {\n\t\t\t\tlet websocketStarted = false;\n\t\t\t\ttry {\n\t\t\t\t\tawait processWebSocketStream(\n\t\t\t\t\t\tresolveCodexWebSocketUrl(model.baseUrl),\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\twebsocketHeaders,\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tstream,\n\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\twebsocketStarted = true;\n\t\t\t\t\t\t},\n\t\t\t\t\t\toptions,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t\t\t}\n\t\t\t\t\tstream.push({\n\t\t\t\t\t\ttype: \"done\",\n\t\t\t\t\t\treason: output.stopReason as \"stop\" | \"length\" | \"toolUse\",\n\t\t\t\t\t\tmessage: output,\n\t\t\t\t\t});\n\t\t\t\t\tstream.end();\n\t\t\t\t\treturn;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst aborted = options?.signal?.aborted;\n\t\t\t\t\tif (aborted || isCodexNonTransportError(error)) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\tappendAssistantMessageDiagnostic(\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tcreateAssistantMessageDiagnostic(\"provider_transport_failure\", error, {\n\t\t\t\t\t\t\tconfiguredTransport: transport,\n\t\t\t\t\t\t\tfallbackTransport: websocketStarted ? undefined : \"sse\",\n\t\t\t\t\t\t\teventsEmitted: websocketStarted,\n\t\t\t\t\t\t\tphase: websocketStarted ? \"after_message_stream_start\" : \"before_message_stream_start\",\n\t\t\t\t\t\t\trequestBytes: new TextEncoder().encode(bodyJson).byteLength,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t\trecordWebSocketFailure(options?.sessionId, error);\n\t\t\t\t\tif (websocketStarted) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\trecordWebSocketSseFallback(options?.sessionId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Fetch with retry logic for rate limits and transient errors\n\t\t\tlet response: Response | undefined;\n\t\t\tlet lastError: Error | undefined;\n\n\t\t\tfor (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {\n\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tresponse = await fetch(resolveCodexUrl(model.baseUrl), {\n\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\theaders: sseHeaders,\n\t\t\t\t\t\tbody: bodyJson,\n\t\t\t\t\t\tsignal: options?.signal,\n\t\t\t\t\t});\n\t\t\t\t\tawait options?.onResponse?.(\n\t\t\t\t\t\t{ status: response.status, headers: headersToRecord(response.headers) },\n\t\t\t\t\t\tmodel,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst errorText = await response.text();\n\t\t\t\t\tif (attempt < MAX_RETRIES && isRetryableError(response.status, errorText)) {\n\t\t\t\t\t\tlet delayMs = BASE_DELAY_MS * 2 ** attempt;\n\n\t\t\t\t\t\tconst retryAfterMs = response.headers.get(\"retry-after-ms\");\n\t\t\t\t\t\tif (retryAfterMs !== null) {\n\t\t\t\t\t\t\tconst millis = Number(retryAfterMs);\n\t\t\t\t\t\t\tif (Number.isFinite(millis)) {\n\t\t\t\t\t\t\t\tdelayMs = Math.max(0, millis);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst retryAfter = response.headers.get(\"retry-after\");\n\t\t\t\t\t\t\tif (retryAfter) {\n\t\t\t\t\t\t\t\tconst seconds = Number(retryAfter);\n\t\t\t\t\t\t\t\tif (Number.isFinite(seconds)) {\n\t\t\t\t\t\t\t\t\tdelayMs = Math.max(0, seconds * 1000);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst date = Date.parse(retryAfter);\n\t\t\t\t\t\t\t\t\tif (!Number.isNaN(date)) {\n\t\t\t\t\t\t\t\t\t\tdelayMs = Math.max(0, date - Date.now());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait sleep(delayMs, options?.signal);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Parse error for friendly message on final attempt or non-retryable error\n\t\t\t\t\tconst fakeResponse = new Response(errorText, {\n\t\t\t\t\t\tstatus: response.status,\n\t\t\t\t\t\tstatusText: response.statusText,\n\t\t\t\t\t});\n\t\t\t\t\tconst info = await parseErrorResponse(fakeResponse);\n\t\t\t\t\tthrow new Error(info.friendlyMessage || info.message);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof Error) {\n\t\t\t\t\t\tif (error.name === \"AbortError\" || error.message === \"Request was aborted\") {\n\t\t\t\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlastError = error instanceof Error ? error : new Error(String(error));\n\t\t\t\t\t// Network errors are retryable\n\t\t\t\t\tif (attempt < MAX_RETRIES && !lastError.message.includes(\"usage limit\")) {\n\t\t\t\t\t\tconst delayMs = BASE_DELAY_MS * 2 ** attempt;\n\t\t\t\t\t\tawait sleep(delayMs, options?.signal);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow lastError;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!response?.ok) {\n\t\t\t\tthrow lastError ?? new Error(\"Failed after retries\");\n\t\t\t}\n\n\t\t\tif (!response.body) {\n\t\t\t\tthrow new Error(\"No response body\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t\tawait processStream(response, output, stream, model, options);\n\n\t\t\tif (options?.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason as \"stop\" | \"length\" | \"toolUse\", message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tfor (const block of output.content) {\n\t\t\t\t// partialJson is only a streaming scratch buffer; never persist it.\n\t\t\t\tdelete (block as { partialJson?: string }).partialJson;\n\t\t\t}\n\t\t\toutput.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\nexport const streamSimpleOpenAICodexResponses: StreamFunction<\"openai-codex-responses\", SimpleStreamOptions> = (\n\tmodel: Model<\"openai-codex-responses\">,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tconst apiKey = options?.apiKey || getEnvApiKey(model.provider);\n\tif (!apiKey) {\n\t\tthrow new Error(`No API key for provider: ${model.provider}`);\n\t}\n\n\tconst base = buildBaseOptions(model, options, apiKey);\n\tconst clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;\n\tconst reasoningEffort = clampedReasoning === \"off\" ? undefined : clampedReasoning;\n\n\treturn streamOpenAICodexResponses(model, context, {\n\t\t...base,\n\t\treasoningEffort,\n\t} satisfies OpenAICodexResponsesOptions);\n};\n\n// ============================================================================\n// Request Building\n// ============================================================================\n\nfunction buildRequestBody(\n\tmodel: Model<\"openai-codex-responses\">,\n\tcontext: Context,\n\toptions?: OpenAICodexResponsesOptions,\n): RequestBody {\n\tconst messages = convertResponsesMessages(model, context, CODEX_TOOL_CALL_PROVIDERS, {\n\t\tincludeSystemPrompt: false,\n\t});\n\n\tconst body: RequestBody = {\n\t\tmodel: model.id,\n\t\tstore: false,\n\t\tstream: true,\n\t\tinstructions: context.systemPrompt || \"You are a helpful assistant.\",\n\t\tinput: messages,\n\t\ttext: { verbosity: options?.textVerbosity || \"low\" },\n\t\tinclude: [\"reasoning.encrypted_content\"],\n\t\tprompt_cache_key: options?.sessionId,\n\t\ttool_choice: \"auto\",\n\t\tparallel_tool_calls: true,\n\t};\n\n\tif (options?.temperature !== undefined) {\n\t\tbody.temperature = options.temperature;\n\t}\n\n\tif (options?.serviceTier !== undefined) {\n\t\tbody.service_tier = options.serviceTier;\n\t}\n\n\tif (context.tools && context.tools.length > 0) {\n\t\tbody.tools = convertResponsesTools(context.tools, { strict: null });\n\t}\n\n\tif (options?.reasoningEffort !== undefined) {\n\t\tconst effort =\n\t\t\toptions.reasoningEffort === \"none\"\n\t\t\t\t? (model.thinkingLevelMap?.off ?? \"none\")\n\t\t\t\t: (model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort);\n\t\tif (effort !== null) {\n\t\t\tbody.reasoning = {\n\t\t\t\teffort,\n\t\t\t\tsummary: options.reasoningSummary ?? \"auto\",\n\t\t\t};\n\t\t}\n\t}\n\n\treturn body;\n}\n\nfunction getServiceTierCostMultiplier(\n\tmodel: Pick<Model<\"openai-codex-responses\">, \"id\">,\n\tserviceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n): number {\n\tswitch (serviceTier) {\n\t\tcase \"flex\":\n\t\t\treturn 0.5;\n\t\tcase \"priority\":\n\t\t\treturn model.id === \"gpt-5.5\" ? 2.5 : 2;\n\t\tdefault:\n\t\t\treturn 1;\n\t}\n}\n\nfunction applyServiceTierPricing(\n\tusage: Usage,\n\tserviceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n\tmodel: Pick<Model<\"openai-codex-responses\">, \"id\">,\n) {\n\tconst multiplier = getServiceTierCostMultiplier(model, serviceTier);\n\tif (multiplier === 1) return;\n\n\tusage.cost.input *= multiplier;\n\tusage.cost.output *= multiplier;\n\tusage.cost.cacheRead *= multiplier;\n\tusage.cost.cacheWrite *= multiplier;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n}\n\nfunction resolveCodexServiceTier(\n\tresponseServiceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n\trequestServiceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n): ResponseCreateParamsStreaming[\"service_tier\"] | undefined {\n\tif (responseServiceTier === \"default\" && (requestServiceTier === \"flex\" || requestServiceTier === \"priority\")) {\n\t\treturn requestServiceTier;\n\t}\n\treturn responseServiceTier ?? requestServiceTier;\n}\n\nfunction resolveCodexUrl(baseUrl?: string): string {\n\tconst raw = baseUrl && baseUrl.trim().length > 0 ? baseUrl : DEFAULT_CODEX_BASE_URL;\n\tconst normalized = raw.replace(/\\/+$/, \"\");\n\tif (normalized.endsWith(\"/codex/responses\")) return normalized;\n\tif (normalized.endsWith(\"/codex\")) return `${normalized}/responses`;\n\treturn `${normalized}/codex/responses`;\n}\n\nfunction resolveCodexWebSocketUrl(baseUrl?: string): string {\n\tconst url = new URL(resolveCodexUrl(baseUrl));\n\tif (url.protocol === \"https:\") url.protocol = \"wss:\";\n\tif (url.protocol === \"http:\") url.protocol = \"ws:\";\n\treturn url.toString();\n}\n\n// ============================================================================\n// Response Processing\n// ============================================================================\n\nasync function processStream(\n\tresponse: Response,\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n\tmodel: Model<\"openai-codex-responses\">,\n\toptions?: OpenAICodexResponsesOptions,\n): Promise<void> {\n\tawait processResponsesStream(mapCodexEvents(parseSSE(response)), output, stream, model, {\n\t\tserviceTier: options?.serviceTier,\n\t\tresolveServiceTier: resolveCodexServiceTier,\n\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t});\n}\n\nclass CodexApiError extends Error {\n\treadonly code?: string;\n\treadonly payload?: Record<string, unknown>;\n\n\tconstructor(message: string, options?: { code?: string; payload?: Record<string, unknown>; cause?: unknown }) {\n\t\tsuper(message);\n\t\tthis.name = \"CodexApiError\";\n\t\tthis.code = options?.code;\n\t\tthis.payload = options?.payload;\n\t\tthis.cause = options?.cause;\n\t}\n}\n\nclass CodexProtocolError extends Error {\n\treadonly payload?: unknown;\n\n\tconstructor(message: string, options?: { payload?: unknown; cause?: unknown }) {\n\t\tsuper(message);\n\t\tthis.name = \"CodexProtocolError\";\n\t\tthis.payload = options?.payload;\n\t\tthis.cause = options?.cause;\n\t}\n}\n\nfunction isCodexNonTransportError(error: unknown): boolean {\n\treturn error instanceof CodexApiError || error instanceof CodexProtocolError;\n}\n\nasync function* mapCodexEvents(events: AsyncIterable<Record<string, unknown>>): AsyncGenerator<ResponseStreamEvent> {\n\tfor await (const event of events) {\n\t\tconst type = typeof event.type === \"string\" ? event.type : undefined;\n\t\tif (!type) continue;\n\n\t\tif (type === \"error\") {\n\t\t\tconst code = (event as { code?: string }).code || \"\";\n\t\t\tconst message = (event as { message?: string }).message || \"\";\n\t\t\tthrow new CodexApiError(`Codex error: ${message || code || JSON.stringify(event)}`, {\n\t\t\t\tcode: code || undefined,\n\t\t\t\tpayload: event,\n\t\t\t});\n\t\t}\n\n\t\tif (type === \"response.failed\") {\n\t\t\tconst response = (event as { response?: { error?: { code?: string; message?: string } } }).response;\n\t\t\tconst code = response?.error?.code;\n\t\t\tconst message = response?.error?.message;\n\t\t\tthrow new CodexApiError(message || \"Codex response failed\", { code, payload: event });\n\t\t}\n\n\t\tif (type === \"response.done\" || type === \"response.completed\" || type === \"response.incomplete\") {\n\t\t\tconst response = (event as { response?: { status?: unknown } }).response;\n\t\t\tconst normalizedResponse = response\n\t\t\t\t? { ...response, status: normalizeCodexStatus(response.status) }\n\t\t\t\t: response;\n\t\t\tyield { ...event, type: \"response.completed\", response: normalizedResponse } as ResponseStreamEvent;\n\t\t\treturn;\n\t\t}\n\n\t\tyield event as unknown as ResponseStreamEvent;\n\t}\n}\n\nfunction normalizeCodexStatus(status: unknown): CodexResponseStatus | undefined {\n\tif (typeof status !== \"string\") return undefined;\n\treturn CODEX_RESPONSE_STATUSES.has(status as CodexResponseStatus) ? (status as CodexResponseStatus) : undefined;\n}\n\n// ============================================================================\n// SSE Parsing\n// ============================================================================\n\nasync function* parseSSE(response: Response): AsyncGenerator<Record<string, unknown>> {\n\tif (!response.body) return;\n\n\tconst reader = response.body.getReader();\n\tconst decoder = new TextDecoder();\n\tlet buffer = \"\";\n\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = await reader.read();\n\t\t\tif (done) break;\n\t\t\tbuffer += decoder.decode(value, { stream: true });\n\n\t\t\tlet idx = buffer.indexOf(\"\\n\\n\");\n\t\t\twhile (idx !== -1) {\n\t\t\t\tconst chunk = buffer.slice(0, idx);\n\t\t\t\tbuffer = buffer.slice(idx + 2);\n\n\t\t\t\tconst dataLines = chunk\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.filter((l) => l.startsWith(\"data:\"))\n\t\t\t\t\t.map((l) => l.slice(5).trim());\n\t\t\t\tif (dataLines.length > 0) {\n\t\t\t\t\tconst data = dataLines.join(\"\\n\").trim();\n\t\t\t\t\tif (data && data !== \"[DONE]\") {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tyield JSON.parse(data) as Record<string, unknown>;\n\t\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\t\tthrow new CodexProtocolError(`Invalid Codex SSE JSON: ${formatThrownValue(cause)}`, {\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\tpayload: data,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tidx = buffer.indexOf(\"\\n\\n\");\n\t\t\t}\n\t\t}\n\t} finally {\n\t\ttry {\n\t\t\tawait reader.cancel();\n\t\t} catch {}\n\t\ttry {\n\t\t\treader.releaseLock();\n\t\t} catch {}\n\t}\n}\n\n// ============================================================================\n// WebSocket Parsing\n// ============================================================================\n\nconst OPENAI_BETA_RESPONSES_WEBSOCKETS = \"responses_websockets=2026-02-06\";\nconst SESSION_WEBSOCKET_CACHE_TTL_MS = 5 * 60 * 1000;\n\ntype WebSocketEventType = \"open\" | \"message\" | \"error\" | \"close\";\ntype WebSocketListener = (event: unknown) => void;\n\ninterface WebSocketLike {\n\tclose(code?: number, reason?: string): void;\n\tsend(data: string): void;\n\taddEventListener(type: WebSocketEventType, listener: WebSocketListener): void;\n\tremoveEventListener(type: WebSocketEventType, listener: WebSocketListener): void;\n}\n\ninterface CachedWebSocketContinuationState {\n\tlastRequestBody: RequestBody;\n\tlastResponseId: string;\n\tlastResponseItems: ResponseInput;\n}\n\ninterface CachedWebSocketConnection {\n\tsocket: WebSocketLike;\n\tbusy: boolean;\n\tidleTimer?: ReturnType<typeof setTimeout>;\n\tcontinuation?: CachedWebSocketContinuationState;\n}\n\nexport interface OpenAICodexWebSocketDebugStats {\n\trequests: number;\n\tconnectionsCreated: number;\n\tconnectionsReused: number;\n\tcachedContextRequests: number;\n\tstoreTrueRequests: number;\n\tfullContextRequests: number;\n\tdeltaRequests: number;\n\tlastInputItems: number;\n\tlastDeltaInputItems?: number;\n\tlastPreviousResponseId?: string;\n\twebsocketFailures: number;\n\tsseFallbacks: number;\n\twebsocketFallbackActive?: boolean;\n\tlastWebSocketError?: string;\n}\n\nconst websocketSessionCache = new Map<string, CachedWebSocketConnection>();\nconst websocketDebugStats = new Map<string, OpenAICodexWebSocketDebugStats>();\nconst websocketSseFallbackSessions = new Set<string>();\n\nfunction getOrCreateWebSocketDebugStats(sessionId: string): OpenAICodexWebSocketDebugStats {\n\tlet stats = websocketDebugStats.get(sessionId);\n\tif (!stats) {\n\t\tstats = {\n\t\t\trequests: 0,\n\t\t\tconnectionsCreated: 0,\n\t\t\tconnectionsReused: 0,\n\t\t\tcachedContextRequests: 0,\n\t\t\tstoreTrueRequests: 0,\n\t\t\tfullContextRequests: 0,\n\t\t\tdeltaRequests: 0,\n\t\t\tlastInputItems: 0,\n\t\t\twebsocketFailures: 0,\n\t\t\tsseFallbacks: 0,\n\t\t};\n\t\twebsocketDebugStats.set(sessionId, stats);\n\t}\n\treturn stats;\n}\n\nexport function getOpenAICodexWebSocketDebugStats(sessionId: string): OpenAICodexWebSocketDebugStats | undefined {\n\tconst stats = websocketDebugStats.get(sessionId);\n\treturn stats ? { ...stats } : undefined;\n}\n\nexport function resetOpenAICodexWebSocketDebugStats(sessionId?: string): void {\n\tif (sessionId) {\n\t\twebsocketDebugStats.delete(sessionId);\n\t\twebsocketSseFallbackSessions.delete(sessionId);\n\t\treturn;\n\t}\n\twebsocketDebugStats.clear();\n\twebsocketSseFallbackSessions.clear();\n}\n\nexport function closeOpenAICodexWebSocketSessions(sessionId?: string): void {\n\tconst closeEntry = (entry: CachedWebSocketConnection) => {\n\t\tif (entry.idleTimer) clearTimeout(entry.idleTimer);\n\t\tcloseWebSocketSilently(entry.socket, 1000, \"debug_close\");\n\t};\n\tif (sessionId) {\n\t\tconst entry = websocketSessionCache.get(sessionId);\n\t\tif (entry) closeEntry(entry);\n\t\twebsocketSessionCache.delete(sessionId);\n\t\treturn;\n\t}\n\tfor (const entry of websocketSessionCache.values()) {\n\t\tcloseEntry(entry);\n\t}\n\twebsocketSessionCache.clear();\n}\n\nregisterSessionResourceCleanup(closeOpenAICodexWebSocketSessions);\n\nfunction isWebSocketSseFallbackActive(sessionId: string | undefined): boolean {\n\treturn sessionId ? websocketSseFallbackSessions.has(sessionId) : false;\n}\n\nfunction recordWebSocketSseFallback(sessionId: string | undefined): void {\n\tif (!sessionId) return;\n\tconst stats = getOrCreateWebSocketDebugStats(sessionId);\n\tstats.sseFallbacks++;\n\tstats.websocketFallbackActive = isWebSocketSseFallbackActive(sessionId);\n}\n\nfunction recordWebSocketFailure(sessionId: string | undefined, error: unknown): void {\n\tif (!sessionId) return;\n\twebsocketSseFallbackSessions.add(sessionId);\n\n\tconst stats = getOrCreateWebSocketDebugStats(sessionId);\n\tstats.websocketFailures++;\n\tstats.lastWebSocketError = formatThrownValue(error);\n\tstats.websocketFallbackActive = true;\n}\n\ntype WebSocketConstructor = new (\n\turl: string,\n\tprotocols?: string | string[] | { headers?: Record<string, string> },\n) => WebSocketLike;\n\nlet _cachedWebsocket: WebSocketConstructor | null = null;\nasync function getWebSocketConstructor(): Promise<WebSocketConstructor | null> {\n\tif (_cachedWebsocket) return _cachedWebsocket;\n\n\t// bun doesn't respect http proxy envs, ref: https://github.com/oven-sh/bun/issues/15489\n\t// TODO: remove this when bun supports proxy envs in websocket.\n\tif (\n\t\tprocess?.versions?.bun &&\n\t\t(process.env.HTTP_PROXY || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.https_proxy)\n\t) {\n\t\tconst m = await dynamicImport(\"proxy-from-env\");\n\t\tconst getProxyForUrl = (m as { getProxyForUrl: (url: string | object | URL) => string }).getProxyForUrl;\n\n\t\t_cachedWebsocket = class extends WebSocket {\n\t\t\tconstructor(url: string | URL, options?: string | string[] | Record<string, unknown>) {\n\t\t\t\tlet _opts: Record<string, unknown> = {};\n\t\t\t\tif (Array.isArray(options) || typeof options === \"string\") {\n\t\t\t\t\t_opts = { protocols: options };\n\t\t\t\t} else {\n\t\t\t\t\t_opts = { ...options };\n\t\t\t\t}\n\n\t\t\t\tconst proxy = getProxyForUrl(url.toString().replace(/^wss:/, \"https:\").replace(/^ws:/, \"http:\"));\n\t\t\t\tsuper(url, { ..._opts, ...(proxy ? { proxy } : {}) } as any);\n\t\t\t}\n\t\t};\n\t\treturn _cachedWebsocket;\n\t}\n\n\tconst ctor = (globalThis as { WebSocket?: unknown }).WebSocket;\n\tif (typeof ctor !== \"function\") return null;\n\treturn ctor as unknown as WebSocketConstructor;\n}\n\nclass WebSocketCloseError extends Error {\n\treadonly code?: number;\n\treadonly reason?: string;\n\treadonly wasClean?: boolean;\n\n\tconstructor(message: string, options?: { code?: number; reason?: string; wasClean?: boolean }) {\n\t\tsuper(message);\n\t\tthis.name = \"WebSocketCloseError\";\n\t\tthis.code = options?.code;\n\t\tthis.reason = options?.reason;\n\t\tthis.wasClean = options?.wasClean;\n\t}\n}\n\nfunction getWebSocketReadyState(socket: WebSocketLike): number | undefined {\n\tconst readyState = (socket as { readyState?: unknown }).readyState;\n\treturn typeof readyState === \"number\" ? readyState : undefined;\n}\n\nfunction isWebSocketReusable(socket: WebSocketLike): boolean {\n\tconst readyState = getWebSocketReadyState(socket);\n\t// If readyState is unavailable, assume the runtime keeps it open/reusable.\n\treturn readyState === undefined || readyState === 1;\n}\n\nfunction closeWebSocketSilently(socket: WebSocketLike, code = 1000, reason = \"done\"): void {\n\ttry {\n\t\tsocket.close(code, reason);\n\t} catch {}\n}\n\nfunction scheduleSessionWebSocketExpiry(sessionId: string, entry: CachedWebSocketConnection): void {\n\tif (entry.idleTimer) {\n\t\tclearTimeout(entry.idleTimer);\n\t}\n\tentry.idleTimer = setTimeout(() => {\n\t\tif (entry.busy) return;\n\t\tcloseWebSocketSilently(entry.socket, 1000, \"idle_timeout\");\n\t\twebsocketSessionCache.delete(sessionId);\n\t}, SESSION_WEBSOCKET_CACHE_TTL_MS);\n}\n\nasync function connectWebSocket(url: string, headers: Headers, signal?: AbortSignal): Promise<WebSocketLike> {\n\tconst WebSocketCtor = await getWebSocketConstructor();\n\tif (!WebSocketCtor) {\n\t\tthrow new Error(\"WebSocket transport is not available in this runtime\");\n\t}\n\n\tconst wsHeaders = headersToRecord(headers);\n\tdelete wsHeaders[\"OpenAI-Beta\"];\n\n\treturn new Promise<WebSocketLike>((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet socket: WebSocketLike;\n\n\t\ttry {\n\t\t\tsocket = new WebSocketCtor(url, { headers: wsHeaders });\n\t\t} catch (error) {\n\t\t\treject(error instanceof Error ? error : new Error(String(error)));\n\t\t\treturn;\n\t\t}\n\n\t\tconst onOpen: WebSocketListener = () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tresolve(socket);\n\t\t};\n\t\tconst onError: WebSocketListener = (event) => {\n\t\t\tconst error = extractWebSocketError(event);\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t};\n\t\tconst onClose: WebSocketListener = (event) => {\n\t\t\tconst error = extractWebSocketCloseError(event);\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t};\n\t\tconst onAbort = () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tsocket.close(1000, \"aborted\");\n\t\t\treject(new Error(\"Request was aborted\"));\n\t\t};\n\n\t\tconst cleanup = () => {\n\t\t\tsocket.removeEventListener(\"open\", onOpen);\n\t\t\tsocket.removeEventListener(\"error\", onError);\n\t\t\tsocket.removeEventListener(\"close\", onClose);\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t};\n\n\t\tsocket.addEventListener(\"open\", onOpen);\n\t\tsocket.addEventListener(\"error\", onError);\n\t\tsocket.addEventListener(\"close\", onClose);\n\t\tsignal?.addEventListener(\"abort\", onAbort);\n\t});\n}\n\nasync function acquireWebSocket(\n\turl: string,\n\theaders: Headers,\n\tsessionId: string | undefined,\n\tsignal?: AbortSignal,\n): Promise<{\n\tsocket: WebSocketLike;\n\tentry?: CachedWebSocketConnection;\n\treused: boolean;\n\trelease: (options?: { keep?: boolean }) => void;\n}> {\n\tif (!sessionId) {\n\t\tconst socket = await connectWebSocket(url, headers, signal);\n\t\treturn {\n\t\t\tsocket,\n\t\t\treused: false,\n\t\t\trelease: ({ keep } = {}) => {\n\t\t\t\tif (keep === false) {\n\t\t\t\t\tcloseWebSocketSilently(socket);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcloseWebSocketSilently(socket);\n\t\t\t},\n\t\t};\n\t}\n\n\tconst cached = websocketSessionCache.get(sessionId);\n\tif (cached) {\n\t\tif (cached.idleTimer) {\n\t\t\tclearTimeout(cached.idleTimer);\n\t\t\tcached.idleTimer = undefined;\n\t\t}\n\t\tif (!cached.busy && isWebSocketReusable(cached.socket)) {\n\t\t\tcached.busy = true;\n\t\t\treturn {\n\t\t\t\tsocket: cached.socket,\n\t\t\t\tentry: cached,\n\t\t\t\treused: true,\n\t\t\t\trelease: ({ keep } = {}) => {\n\t\t\t\t\tif (!keep || !isWebSocketReusable(cached.socket)) {\n\t\t\t\t\t\tcloseWebSocketSilently(cached.socket);\n\t\t\t\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcached.busy = false;\n\t\t\t\t\tscheduleSessionWebSocketExpiry(sessionId, cached);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (cached.busy) {\n\t\t\tconst socket = await connectWebSocket(url, headers, signal);\n\t\t\treturn {\n\t\t\t\tsocket,\n\t\t\t\treused: false,\n\t\t\t\trelease: () => {\n\t\t\t\t\tcloseWebSocketSilently(socket);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (!isWebSocketReusable(cached.socket)) {\n\t\t\tcloseWebSocketSilently(cached.socket);\n\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t}\n\t}\n\n\tconst socket = await connectWebSocket(url, headers, signal);\n\tconst entry: CachedWebSocketConnection = { socket, busy: true };\n\twebsocketSessionCache.set(sessionId, entry);\n\treturn {\n\t\tsocket,\n\t\tentry,\n\t\treused: false,\n\t\trelease: ({ keep } = {}) => {\n\t\t\tif (!keep || !isWebSocketReusable(entry.socket)) {\n\t\t\t\tcloseWebSocketSilently(entry.socket);\n\t\t\t\tif (entry.idleTimer) clearTimeout(entry.idleTimer);\n\t\t\t\tif (websocketSessionCache.get(sessionId) === entry) {\n\t\t\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tentry.busy = false;\n\t\t\tscheduleSessionWebSocketExpiry(sessionId, entry);\n\t\t},\n\t};\n}\n\nfunction extractWebSocketError(event: unknown): Error {\n\tif (event && typeof event === \"object\") {\n\t\tconst message = \"message\" in event ? (event as { message?: unknown }).message : undefined;\n\t\tif (typeof message === \"string\" && message.length > 0) {\n\t\t\treturn new Error(message);\n\t\t}\n\n\t\tconst nestedError = \"error\" in event ? (event as { error?: unknown }).error : undefined;\n\t\tif (nestedError instanceof Error && nestedError.message.length > 0) {\n\t\t\treturn nestedError;\n\t\t}\n\t\tif (nestedError && typeof nestedError === \"object\" && \"message\" in nestedError) {\n\t\t\tconst nestedMessage = (nestedError as { message?: unknown }).message;\n\t\t\tif (typeof nestedMessage === \"string\" && nestedMessage.length > 0) {\n\t\t\t\treturn new Error(nestedMessage);\n\t\t\t}\n\t\t}\n\t}\n\treturn new Error(\"WebSocket error\");\n}\n\nfunction extractWebSocketCloseError(event: unknown): Error {\n\tif (event && typeof event === \"object\") {\n\t\tconst code = \"code\" in event ? (event as { code?: unknown }).code : undefined;\n\t\tconst reason = \"reason\" in event ? (event as { reason?: unknown }).reason : undefined;\n\t\tconst wasClean = \"wasClean\" in event ? (event as { wasClean?: unknown }).wasClean : undefined;\n\t\tconst codeText = typeof code === \"number\" ? ` ${code}` : \"\";\n\t\tlet reasonText = typeof reason === \"string\" && reason.length > 0 ? ` ${reason}` : \"\";\n\t\tif (!reasonText && code === WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE) {\n\t\t\treasonText = \" message too big\";\n\t\t}\n\t\treturn new WebSocketCloseError(`WebSocket closed${codeText}${reasonText}`.trim(), {\n\t\t\tcode: typeof code === \"number\" ? code : undefined,\n\t\t\treason: typeof reason === \"string\" && reason.length > 0 ? reason : undefined,\n\t\t\twasClean: typeof wasClean === \"boolean\" ? wasClean : undefined,\n\t\t});\n\t}\n\treturn new Error(\"WebSocket closed\");\n}\n\nasync function decodeWebSocketData(data: unknown): Promise<string | null> {\n\tif (typeof data === \"string\") return data;\n\tif (data instanceof ArrayBuffer) {\n\t\treturn new TextDecoder().decode(new Uint8Array(data));\n\t}\n\tif (ArrayBuffer.isView(data)) {\n\t\tconst view = data as ArrayBufferView;\n\t\treturn new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset, view.byteLength));\n\t}\n\tif (data && typeof data === \"object\" && \"arrayBuffer\" in data) {\n\t\tconst blobLike = data as { arrayBuffer: () => Promise<ArrayBuffer> };\n\t\tconst arrayBuffer = await blobLike.arrayBuffer();\n\t\treturn new TextDecoder().decode(new Uint8Array(arrayBuffer));\n\t}\n\treturn null;\n}\n\nasync function* parseWebSocket(socket: WebSocketLike, signal?: AbortSignal): AsyncGenerator<Record<string, unknown>> {\n\tconst queue: Record<string, unknown>[] = [];\n\tlet pending: (() => void) | null = null;\n\tlet done = false;\n\tlet failed: Error | null = null;\n\tlet sawCompletion = false;\n\n\tconst wake = () => {\n\t\tif (!pending) return;\n\t\tconst resolve = pending;\n\t\tpending = null;\n\t\tresolve();\n\t};\n\n\tconst onMessage: WebSocketListener = (event) => {\n\t\tvoid (async () => {\n\t\t\tlet text: string | null = null;\n\t\t\ttry {\n\t\t\t\tif (!event || typeof event !== \"object\" || !(\"data\" in event)) return;\n\t\t\t\ttext = await decodeWebSocketData((event as { data?: unknown }).data);\n\t\t\t\tif (!text) return;\n\t\t\t\tconst parsed = JSON.parse(text) as Record<string, unknown>;\n\t\t\t\tconst type = typeof parsed.type === \"string\" ? parsed.type : \"\";\n\t\t\t\tif (type === \"response.completed\" || type === \"response.done\" || type === \"response.incomplete\") {\n\t\t\t\t\tsawCompletion = true;\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t\tqueue.push(parsed);\n\t\t\t\twake();\n\t\t\t} catch (cause) {\n\t\t\t\tfailed = new CodexProtocolError(`Invalid Codex WebSocket JSON: ${formatThrownValue(cause)}`, {\n\t\t\t\t\tcause,\n\t\t\t\t\tpayload: text,\n\t\t\t\t});\n\t\t\t\tdone = true;\n\t\t\t\twake();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst onError: WebSocketListener = (event) => {\n\t\tfailed = extractWebSocketError(event);\n\t\tdone = true;\n\t\twake();\n\t};\n\n\tconst onClose: WebSocketListener = (event) => {\n\t\tif (sawCompletion) {\n\t\t\tdone = true;\n\t\t\twake();\n\t\t\treturn;\n\t\t}\n\t\tif (!failed) {\n\t\t\tfailed = extractWebSocketCloseError(event);\n\t\t}\n\t\tdone = true;\n\t\twake();\n\t};\n\n\tconst onAbort = () => {\n\t\tfailed = new Error(\"Request was aborted\");\n\t\tdone = true;\n\t\twake();\n\t};\n\n\tsocket.addEventListener(\"message\", onMessage);\n\tsocket.addEventListener(\"error\", onError);\n\tsocket.addEventListener(\"close\", onClose);\n\tsignal?.addEventListener(\"abort\", onAbort);\n\n\ttry {\n\t\twhile (true) {\n\t\t\tif (signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\t\t\tif (queue.length > 0) {\n\t\t\t\tyield queue.shift()!;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (done) break;\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tpending = resolve;\n\t\t\t});\n\t\t}\n\n\t\tif (failed) {\n\t\t\tthrow failed;\n\t\t}\n\t\tif (!sawCompletion) {\n\t\t\tthrow new Error(\"WebSocket stream closed before response.completed\");\n\t\t}\n\t} finally {\n\t\tsocket.removeEventListener(\"message\", onMessage);\n\t\tsocket.removeEventListener(\"error\", onError);\n\t\tsocket.removeEventListener(\"close\", onClose);\n\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\nfunction requestBodyWithoutInput(body: RequestBody): RequestBody {\n\tconst { input: _input, previous_response_id: _previousResponseId, ...rest } = body;\n\treturn rest;\n}\n\nfunction responseInputsEqual(a: ResponseInput | undefined, b: ResponseInput | undefined): boolean {\n\treturn JSON.stringify(a ?? []) === JSON.stringify(b ?? []);\n}\n\nfunction requestBodiesMatchExceptInput(a: RequestBody, b: RequestBody): boolean {\n\treturn JSON.stringify(requestBodyWithoutInput(a)) === JSON.stringify(requestBodyWithoutInput(b));\n}\n\nfunction getCachedWebSocketInputDelta(\n\tbody: RequestBody,\n\tcontinuation: CachedWebSocketContinuationState,\n): ResponseInput | undefined {\n\tif (!requestBodiesMatchExceptInput(body, continuation.lastRequestBody)) {\n\t\treturn undefined;\n\t}\n\n\tconst currentInput = body.input ?? [];\n\tconst baseline = [...(continuation.lastRequestBody.input ?? []), ...continuation.lastResponseItems];\n\tif (currentInput.length < baseline.length) {\n\t\treturn undefined;\n\t}\n\n\tconst prefix = currentInput.slice(0, baseline.length);\n\tif (!responseInputsEqual(prefix, baseline)) {\n\t\treturn undefined;\n\t}\n\n\treturn currentInput.slice(baseline.length);\n}\n\nfunction buildCachedWebSocketRequestBody(entry: CachedWebSocketConnection, body: RequestBody): RequestBody {\n\tconst continuation = entry.continuation;\n\tif (!continuation) {\n\t\treturn body;\n\t}\n\n\tconst delta = getCachedWebSocketInputDelta(body, continuation);\n\tif (!delta || !continuation.lastResponseId) {\n\t\tentry.continuation = undefined;\n\t\treturn body;\n\t}\n\n\treturn {\n\t\t...body,\n\t\tprevious_response_id: continuation.lastResponseId,\n\t\tinput: delta,\n\t};\n}\n\nasync function* startWebSocketOutputOnFirstEvent(\n\tevents: AsyncIterable<ResponseStreamEvent>,\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n\tonStart: () => void,\n): AsyncGenerator<ResponseStreamEvent> {\n\tlet started = false;\n\tfor await (const event of events) {\n\t\tif (!started) {\n\t\t\tstarted = true;\n\t\t\tonStart();\n\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t}\n\t\tyield event;\n\t}\n}\n\nasync function processWebSocketStream(\n\turl: string,\n\tbody: RequestBody,\n\theaders: Headers,\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n\tmodel: Model<\"openai-codex-responses\">,\n\tonStart: () => void,\n\toptions?: OpenAICodexResponsesOptions,\n): Promise<void> {\n\tconst { socket, entry, reused, release } = await acquireWebSocket(url, headers, options?.sessionId, options?.signal);\n\tlet keepConnection = true;\n\tconst useCachedContext = options?.transport === \"websocket-cached\" || options?.transport === \"auto\";\n\t// ChatGPT Codex Responses rejects `store: true` (\"Store must be set to false\").\n\t// WebSocket continuation still works via connection-scoped previous_response_id state.\n\tconst fullBody = body;\n\tconst requestBody = useCachedContext && entry ? buildCachedWebSocketRequestBody(entry, fullBody) : fullBody;\n\tconst stats = options?.sessionId ? getOrCreateWebSocketDebugStats(options.sessionId) : undefined;\n\tif (stats) {\n\t\tstats.requests++;\n\t\tif (reused) stats.connectionsReused++;\n\t\telse stats.connectionsCreated++;\n\t\tif (useCachedContext) stats.cachedContextRequests++;\n\t\tif (requestBody.store === true) stats.storeTrueRequests++;\n\t\tstats.lastInputItems = requestBody.input?.length ?? 0;\n\t\tif (requestBody.previous_response_id) {\n\t\t\tstats.deltaRequests++;\n\t\t\tstats.lastDeltaInputItems = requestBody.input?.length ?? 0;\n\t\t\tstats.lastPreviousResponseId = requestBody.previous_response_id;\n\t\t} else {\n\t\t\tstats.fullContextRequests++;\n\t\t\tstats.lastDeltaInputItems = undefined;\n\t\t\tstats.lastPreviousResponseId = undefined;\n\t\t}\n\t}\n\ttry {\n\t\tsocket.send(JSON.stringify({ type: \"response.create\", ...requestBody }));\n\t\tawait processResponsesStream(\n\t\t\tstartWebSocketOutputOnFirstEvent(\n\t\t\t\tmapCodexEvents(parseWebSocket(socket, options?.signal)),\n\t\t\t\toutput,\n\t\t\t\tstream,\n\t\t\t\tonStart,\n\t\t\t),\n\t\t\toutput,\n\t\t\tstream,\n\t\t\tmodel,\n\t\t\t{\n\t\t\t\tserviceTier: options?.serviceTier,\n\t\t\t\tresolveServiceTier: resolveCodexServiceTier,\n\t\t\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t\t\t},\n\t\t);\n\t\tif (options?.signal?.aborted) {\n\t\t\tkeepConnection = false;\n\t\t} else if (useCachedContext && entry && output.responseId) {\n\t\t\tconst responseItems = convertResponsesMessages(model, { messages: [output] }, CODEX_TOOL_CALL_PROVIDERS, {\n\t\t\t\tincludeSystemPrompt: false,\n\t\t\t}).filter((item) => item.type !== \"function_call_output\");\n\t\t\tentry.continuation = {\n\t\t\t\tlastRequestBody: fullBody,\n\t\t\t\tlastResponseId: output.responseId,\n\t\t\t\tlastResponseItems: responseItems,\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\tif (entry) {\n\t\t\tentry.continuation = undefined;\n\t\t}\n\t\tkeepConnection = false;\n\t\tthrow error;\n\t} finally {\n\t\trelease({ keep: keepConnection });\n\t}\n}\n\n// ============================================================================\n// Error Handling\n// ============================================================================\n\nasync function parseErrorResponse(response: Response): Promise<{ message: string; friendlyMessage?: string }> {\n\tconst raw = await response.text();\n\tlet message = raw || response.statusText || \"Request failed\";\n\tlet friendlyMessage: string | undefined;\n\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as {\n\t\t\terror?: { code?: string; type?: string; message?: string; plan_type?: string; resets_at?: number };\n\t\t};\n\t\tconst err = parsed?.error;\n\t\tif (err) {\n\t\t\tconst code = err.code || err.type || \"\";\n\t\t\tif (/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(code) || response.status === 429) {\n\t\t\t\tconst plan = err.plan_type ? ` (${err.plan_type.toLowerCase()} plan)` : \"\";\n\t\t\t\tconst mins = err.resets_at\n\t\t\t\t\t? Math.max(0, Math.round((err.resets_at * 1000 - Date.now()) / 60000))\n\t\t\t\t\t: undefined;\n\t\t\t\tconst when = mins !== undefined ? ` Try again in ~${mins} min.` : \"\";\n\t\t\t\tfriendlyMessage = `You have hit your ChatGPT usage limit${plan}.${when}`.trim();\n\t\t\t}\n\t\t\tmessage = err.message || friendlyMessage || message;\n\t\t}\n\t} catch {}\n\n\treturn { message, friendlyMessage };\n}\n\n// ============================================================================\n// Auth & Headers\n// ============================================================================\n\nfunction extractAccountId(token: string): string {\n\ttry {\n\t\tconst parts = token.split(\".\");\n\t\tif (parts.length !== 3) throw new Error(\"Invalid token\");\n\t\tconst payload = JSON.parse(atob(parts[1]));\n\t\tconst accountId = payload?.[JWT_CLAIM_PATH]?.chatgpt_account_id;\n\t\tif (!accountId) throw new Error(\"No account ID in token\");\n\t\treturn accountId;\n\t} catch {\n\t\tthrow new Error(\"Failed to extract accountId from token\");\n\t}\n}\n\nfunction createCodexRequestId(): string {\n\tif (typeof globalThis.crypto?.randomUUID === \"function\") {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\treturn `codex_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction buildBaseCodexHeaders(\n\tinitHeaders: Record<string, string> | undefined,\n\tadditionalHeaders: Record<string, string> | undefined,\n\taccountId: string,\n\ttoken: string,\n): Headers {\n\tconst headers = new Headers(initHeaders);\n\tfor (const [key, value] of Object.entries(additionalHeaders || {})) {\n\t\theaders.set(key, value);\n\t}\n\theaders.set(\"Authorization\", `Bearer ${token}`);\n\theaders.set(\"chatgpt-account-id\", accountId);\n\theaders.set(\"originator\", \"pi\");\n\tconst userAgent = _os ? `pi (${_os.platform()} ${_os.release()}; ${_os.arch()})` : \"pi (browser)\";\n\theaders.set(\"User-Agent\", userAgent);\n\treturn headers;\n}\n\nfunction buildSSEHeaders(\n\tinitHeaders: Record<string, string> | undefined,\n\tadditionalHeaders: Record<string, string> | undefined,\n\taccountId: string,\n\ttoken: string,\n\tsessionId?: string,\n): Headers {\n\tconst headers = buildBaseCodexHeaders(initHeaders, additionalHeaders, accountId, token);\n\theaders.set(\"OpenAI-Beta\", \"responses=experimental\");\n\theaders.set(\"accept\", \"text/event-stream\");\n\theaders.set(\"content-type\", \"application/json\");\n\n\tif (sessionId) {\n\t\theaders.set(\"session_id\", sessionId);\n\t\theaders.set(\"x-client-request-id\", sessionId);\n\t}\n\n\treturn headers;\n}\n\nfunction buildWebSocketHeaders(\n\tinitHeaders: Record<string, string> | undefined,\n\tadditionalHeaders: Record<string, string> | undefined,\n\taccountId: string,\n\ttoken: string,\n\trequestId: string,\n): Headers {\n\tconst headers = buildBaseCodexHeaders(initHeaders, additionalHeaders, accountId, token);\n\theaders.delete(\"accept\");\n\theaders.delete(\"content-type\");\n\theaders.delete(\"OpenAI-Beta\");\n\theaders.delete(\"openai-beta\");\n\theaders.set(\"OpenAI-Beta\", OPENAI_BETA_RESPONSES_WEBSOCKETS);\n\theaders.set(\"x-client-request-id\", requestId);\n\theaders.set(\"session_id\", requestId);\n\treturn headers;\n}\n"]}
1
+ {"version":3,"file":"openai-codex-responses.js","sourceRoot":"","sources":["../../src/providers/openai-codex-responses.ts"],"names":[],"mappings":";;;;;;;;AAQA,0EAA0E;AAC1E,IAAI,GAAG,GAAyB,IAAI,CAAC;AAIrC,MAAM,aAAa,GAAkB,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,kCAAC,SAAS,EAAC,CAAC;AACtE,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AAEzC,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,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C,aAAa,EAAE,gCAAgC,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC;AAAA,CACf","sourcesContent":["import type * as NodeOs from \"node:os\";\nimport type {\n\tTool as OpenAITool,\n\tResponseCreateParamsStreaming,\n\tResponseInput,\n\tResponseStreamEvent,\n} from \"openai/resources/responses/responses.js\";\n\n// NEVER convert to top-level runtime imports - breaks browser/Vite builds\nlet _os: typeof NodeOs | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\n\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_os = m as typeof NodeOs;\n\t});\n}\n\nimport { getEnvApiKey } from \"../env-api-keys.ts\";\nimport { clampThinkingLevel } from \"../models.ts\";\nimport { registerSessionResourceCleanup } from \"../session-resources.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tContext,\n\tModel,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tUsage,\n} from \"../types.ts\";\nimport {\n\tappendAssistantMessageDiagnostic,\n\tcreateAssistantMessageDiagnostic,\n\tformatThrownValue,\n} from \"../utils/diagnostics.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { headersToRecord } from \"../utils/headers.ts\";\nimport { clampOpenAIPromptCacheKey } from \"./openai-prompt-cache.ts\";\nimport { convertResponsesMessages, convertResponsesTools, processResponsesStream } from \"./openai-responses-shared.ts\";\nimport { buildBaseOptions } from \"./simple-options.ts\";\n\n// ============================================================================\n// Configuration\n// ============================================================================\n\nconst DEFAULT_CODEX_BASE_URL = \"https://chatgpt.com/backend-api\";\nconst JWT_CLAIM_PATH = \"https://api.openai.com/auth\" as const;\nconst MAX_RETRIES = 3;\nconst BASE_DELAY_MS = 1000;\nconst CODEX_TOOL_CALL_PROVIDERS = new Set([\"openai\", \"openai-codex\", \"opencode\"]);\nconst WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE = 1009;\n\nconst CODEX_RESPONSE_STATUSES = new Set<CodexResponseStatus>([\n\t\"completed\",\n\t\"incomplete\",\n\t\"failed\",\n\t\"cancelled\",\n\t\"queued\",\n\t\"in_progress\",\n]);\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface OpenAICodexResponsesOptions extends StreamOptions {\n\treasoningEffort?: \"none\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n\treasoningSummary?: \"auto\" | \"concise\" | \"detailed\" | \"off\" | \"on\" | null;\n\tserviceTier?: ResponseCreateParamsStreaming[\"service_tier\"];\n\ttextVerbosity?: \"low\" | \"medium\" | \"high\";\n}\n\ntype CodexResponseStatus = \"completed\" | \"incomplete\" | \"failed\" | \"cancelled\" | \"queued\" | \"in_progress\";\n\ninterface RequestBody {\n\tmodel: string;\n\tstore?: boolean;\n\tstream?: boolean;\n\tinstructions?: string;\n\tprevious_response_id?: string;\n\tinput?: ResponseInput;\n\ttools?: OpenAITool[];\n\ttool_choice?: \"auto\";\n\tparallel_tool_calls?: boolean;\n\ttemperature?: number;\n\treasoning?: { effort?: string; summary?: string };\n\tservice_tier?: ResponseCreateParamsStreaming[\"service_tier\"];\n\ttext?: { verbosity?: string };\n\tinclude?: string[];\n\tprompt_cache_key?: string;\n\t[key: string]: unknown;\n}\n\n// ============================================================================\n// Retry Helpers\n// ============================================================================\n\nfunction isRetryableError(status: number, errorText: string): boolean {\n\tif (status === 429 || status === 500 || status === 502 || status === 503 || status === 504) {\n\t\treturn true;\n\t}\n\treturn /rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(errorText);\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new Error(\"Request was aborted\"));\n\t\t\treturn;\n\t\t}\n\t\tconst timeout = setTimeout(resolve, ms);\n\t\tsignal?.addEventListener(\"abort\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\treject(new Error(\"Request was aborted\"));\n\t\t});\n\t});\n}\n\n// ============================================================================\n// Main Stream Function\n// ============================================================================\n\nexport const streamOpenAICodexResponses: StreamFunction<\"openai-codex-responses\", OpenAICodexResponsesOptions> = (\n\tmodel: Model<\"openai-codex-responses\">,\n\tcontext: Context,\n\toptions?: OpenAICodexResponsesOptions,\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\n\t(async () => {\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: \"openai-codex-responses\" as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"stop\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\ttry {\n\t\t\tconst apiKey = options?.apiKey || getEnvApiKey(model.provider) || \"\";\n\t\t\tif (!apiKey) {\n\t\t\t\tthrow new Error(`No API key for provider: ${model.provider}`);\n\t\t\t}\n\n\t\t\tconst accountId = extractAccountId(apiKey);\n\t\t\tlet body = buildRequestBody(model, context, options);\n\t\t\tconst nextBody = await options?.onPayload?.(body, model);\n\t\t\tif (nextBody !== undefined) {\n\t\t\t\tbody = nextBody as RequestBody;\n\t\t\t}\n\t\t\tconst websocketRequestId = options?.sessionId || createCodexRequestId();\n\t\t\tconst sseHeaders = buildSSEHeaders(model.headers, options?.headers, accountId, apiKey, options?.sessionId);\n\t\t\tconst websocketHeaders = buildWebSocketHeaders(\n\t\t\t\tmodel.headers,\n\t\t\t\toptions?.headers,\n\t\t\t\taccountId,\n\t\t\t\tapiKey,\n\t\t\t\twebsocketRequestId,\n\t\t\t);\n\t\t\tconst bodyJson = JSON.stringify(body);\n\t\t\tconst transport = options?.transport || \"auto\";\n\t\t\tconst websocketDisabledForSession = transport !== \"sse\" && isWebSocketSseFallbackActive(options?.sessionId);\n\t\t\tif (websocketDisabledForSession) {\n\t\t\t\trecordWebSocketSseFallback(options?.sessionId);\n\t\t\t}\n\n\t\t\tif (transport !== \"sse\" && !websocketDisabledForSession) {\n\t\t\t\tlet websocketStarted = false;\n\t\t\t\ttry {\n\t\t\t\t\tawait processWebSocketStream(\n\t\t\t\t\t\tresolveCodexWebSocketUrl(model.baseUrl),\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\twebsocketHeaders,\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tstream,\n\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\twebsocketStarted = true;\n\t\t\t\t\t\t},\n\t\t\t\t\t\toptions,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t\t\t}\n\t\t\t\t\tstream.push({\n\t\t\t\t\t\ttype: \"done\",\n\t\t\t\t\t\treason: output.stopReason as \"stop\" | \"length\" | \"toolUse\",\n\t\t\t\t\t\tmessage: output,\n\t\t\t\t\t});\n\t\t\t\t\tstream.end();\n\t\t\t\t\treturn;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst aborted = options?.signal?.aborted;\n\t\t\t\t\tif (aborted || isCodexNonTransportError(error)) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\tappendAssistantMessageDiagnostic(\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tcreateAssistantMessageDiagnostic(\"provider_transport_failure\", error, {\n\t\t\t\t\t\t\tconfiguredTransport: transport,\n\t\t\t\t\t\t\tfallbackTransport: websocketStarted ? undefined : \"sse\",\n\t\t\t\t\t\t\teventsEmitted: websocketStarted,\n\t\t\t\t\t\t\tphase: websocketStarted ? \"after_message_stream_start\" : \"before_message_stream_start\",\n\t\t\t\t\t\t\trequestBytes: new TextEncoder().encode(bodyJson).byteLength,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t\trecordWebSocketFailure(options?.sessionId, error);\n\t\t\t\t\tif (websocketStarted) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\trecordWebSocketSseFallback(options?.sessionId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Fetch with retry logic for rate limits and transient errors\n\t\t\tlet response: Response | undefined;\n\t\t\tlet lastError: Error | undefined;\n\n\t\t\tfor (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {\n\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tresponse = await fetch(resolveCodexUrl(model.baseUrl), {\n\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\theaders: sseHeaders,\n\t\t\t\t\t\tbody: bodyJson,\n\t\t\t\t\t\tsignal: options?.signal,\n\t\t\t\t\t});\n\t\t\t\t\tawait options?.onResponse?.(\n\t\t\t\t\t\t{ status: response.status, headers: headersToRecord(response.headers) },\n\t\t\t\t\t\tmodel,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst errorText = await response.text();\n\t\t\t\t\tif (attempt < MAX_RETRIES && isRetryableError(response.status, errorText)) {\n\t\t\t\t\t\tlet delayMs = BASE_DELAY_MS * 2 ** attempt;\n\n\t\t\t\t\t\tconst retryAfterMs = response.headers.get(\"retry-after-ms\");\n\t\t\t\t\t\tif (retryAfterMs !== null) {\n\t\t\t\t\t\t\tconst millis = Number(retryAfterMs);\n\t\t\t\t\t\t\tif (Number.isFinite(millis)) {\n\t\t\t\t\t\t\t\tdelayMs = Math.max(0, millis);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst retryAfter = response.headers.get(\"retry-after\");\n\t\t\t\t\t\t\tif (retryAfter) {\n\t\t\t\t\t\t\t\tconst seconds = Number(retryAfter);\n\t\t\t\t\t\t\t\tif (Number.isFinite(seconds)) {\n\t\t\t\t\t\t\t\t\tdelayMs = Math.max(0, seconds * 1000);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst date = Date.parse(retryAfter);\n\t\t\t\t\t\t\t\t\tif (!Number.isNaN(date)) {\n\t\t\t\t\t\t\t\t\t\tdelayMs = Math.max(0, date - Date.now());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait sleep(delayMs, options?.signal);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Parse error for friendly message on final attempt or non-retryable error\n\t\t\t\t\tconst fakeResponse = new Response(errorText, {\n\t\t\t\t\t\tstatus: response.status,\n\t\t\t\t\t\tstatusText: response.statusText,\n\t\t\t\t\t});\n\t\t\t\t\tconst info = await parseErrorResponse(fakeResponse);\n\t\t\t\t\tthrow new Error(info.friendlyMessage || info.message);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof Error) {\n\t\t\t\t\t\tif (error.name === \"AbortError\" || error.message === \"Request was aborted\") {\n\t\t\t\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlastError = error instanceof Error ? error : new Error(String(error));\n\t\t\t\t\t// Network errors are retryable\n\t\t\t\t\tif (attempt < MAX_RETRIES && !lastError.message.includes(\"usage limit\")) {\n\t\t\t\t\t\tconst delayMs = BASE_DELAY_MS * 2 ** attempt;\n\t\t\t\t\t\tawait sleep(delayMs, options?.signal);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow lastError;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!response?.ok) {\n\t\t\t\tthrow lastError ?? new Error(\"Failed after retries\");\n\t\t\t}\n\n\t\t\tif (!response.body) {\n\t\t\t\tthrow new Error(\"No response body\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t\tawait processStream(response, output, stream, model, options);\n\n\t\t\tif (options?.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason as \"stop\" | \"length\" | \"toolUse\", message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tfor (const block of output.content) {\n\t\t\t\t// partialJson is only a streaming scratch buffer; never persist it.\n\t\t\t\tdelete (block as { partialJson?: string }).partialJson;\n\t\t\t}\n\t\t\toutput.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\nexport const streamSimpleOpenAICodexResponses: StreamFunction<\"openai-codex-responses\", SimpleStreamOptions> = (\n\tmodel: Model<\"openai-codex-responses\">,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tconst apiKey = options?.apiKey || getEnvApiKey(model.provider);\n\tif (!apiKey) {\n\t\tthrow new Error(`No API key for provider: ${model.provider}`);\n\t}\n\n\tconst base = buildBaseOptions(model, options, apiKey);\n\tconst clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;\n\tconst reasoningEffort = clampedReasoning === \"off\" ? undefined : clampedReasoning;\n\n\treturn streamOpenAICodexResponses(model, context, {\n\t\t...base,\n\t\treasoningEffort,\n\t} satisfies OpenAICodexResponsesOptions);\n};\n\n// ============================================================================\n// Request Building\n// ============================================================================\n\nfunction buildRequestBody(\n\tmodel: Model<\"openai-codex-responses\">,\n\tcontext: Context,\n\toptions?: OpenAICodexResponsesOptions,\n): RequestBody {\n\tconst messages = convertResponsesMessages(model, context, CODEX_TOOL_CALL_PROVIDERS, {\n\t\tincludeSystemPrompt: false,\n\t});\n\n\tconst body: RequestBody = {\n\t\tmodel: model.id,\n\t\tstore: false,\n\t\tstream: true,\n\t\tinstructions: context.systemPrompt || \"You are a helpful assistant.\",\n\t\tinput: messages,\n\t\ttext: { verbosity: options?.textVerbosity || \"low\" },\n\t\tinclude: [\"reasoning.encrypted_content\"],\n\t\tprompt_cache_key: clampOpenAIPromptCacheKey(options?.sessionId),\n\t\ttool_choice: \"auto\",\n\t\tparallel_tool_calls: true,\n\t};\n\n\tif (options?.temperature !== undefined) {\n\t\tbody.temperature = options.temperature;\n\t}\n\n\tif (options?.serviceTier !== undefined) {\n\t\tbody.service_tier = options.serviceTier;\n\t}\n\n\tif (context.tools && context.tools.length > 0) {\n\t\tbody.tools = convertResponsesTools(context.tools, { strict: null });\n\t}\n\n\tif (options?.reasoningEffort !== undefined) {\n\t\tconst effort =\n\t\t\toptions.reasoningEffort === \"none\"\n\t\t\t\t? (model.thinkingLevelMap?.off ?? \"none\")\n\t\t\t\t: (model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort);\n\t\tif (effort !== null) {\n\t\t\tbody.reasoning = {\n\t\t\t\teffort,\n\t\t\t\tsummary: options.reasoningSummary ?? \"auto\",\n\t\t\t};\n\t\t}\n\t}\n\n\treturn body;\n}\n\nfunction getServiceTierCostMultiplier(\n\tmodel: Pick<Model<\"openai-codex-responses\">, \"id\">,\n\tserviceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n): number {\n\tswitch (serviceTier) {\n\t\tcase \"flex\":\n\t\t\treturn 0.5;\n\t\tcase \"priority\":\n\t\t\treturn model.id === \"gpt-5.5\" ? 2.5 : 2;\n\t\tdefault:\n\t\t\treturn 1;\n\t}\n}\n\nfunction applyServiceTierPricing(\n\tusage: Usage,\n\tserviceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n\tmodel: Pick<Model<\"openai-codex-responses\">, \"id\">,\n) {\n\tconst multiplier = getServiceTierCostMultiplier(model, serviceTier);\n\tif (multiplier === 1) return;\n\n\tusage.cost.input *= multiplier;\n\tusage.cost.output *= multiplier;\n\tusage.cost.cacheRead *= multiplier;\n\tusage.cost.cacheWrite *= multiplier;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n}\n\nfunction resolveCodexServiceTier(\n\tresponseServiceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n\trequestServiceTier: ResponseCreateParamsStreaming[\"service_tier\"] | undefined,\n): ResponseCreateParamsStreaming[\"service_tier\"] | undefined {\n\tif (responseServiceTier === \"default\" && (requestServiceTier === \"flex\" || requestServiceTier === \"priority\")) {\n\t\treturn requestServiceTier;\n\t}\n\treturn responseServiceTier ?? requestServiceTier;\n}\n\nfunction resolveCodexUrl(baseUrl?: string): string {\n\tconst raw = baseUrl && baseUrl.trim().length > 0 ? baseUrl : DEFAULT_CODEX_BASE_URL;\n\tconst normalized = raw.replace(/\\/+$/, \"\");\n\tif (normalized.endsWith(\"/codex/responses\")) return normalized;\n\tif (normalized.endsWith(\"/codex\")) return `${normalized}/responses`;\n\treturn `${normalized}/codex/responses`;\n}\n\nfunction resolveCodexWebSocketUrl(baseUrl?: string): string {\n\tconst url = new URL(resolveCodexUrl(baseUrl));\n\tif (url.protocol === \"https:\") url.protocol = \"wss:\";\n\tif (url.protocol === \"http:\") url.protocol = \"ws:\";\n\treturn url.toString();\n}\n\n// ============================================================================\n// Response Processing\n// ============================================================================\n\nasync function processStream(\n\tresponse: Response,\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n\tmodel: Model<\"openai-codex-responses\">,\n\toptions?: OpenAICodexResponsesOptions,\n): Promise<void> {\n\tawait processResponsesStream(mapCodexEvents(parseSSE(response)), output, stream, model, {\n\t\tserviceTier: options?.serviceTier,\n\t\tresolveServiceTier: resolveCodexServiceTier,\n\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t});\n}\n\nclass CodexApiError extends Error {\n\treadonly code?: string;\n\treadonly payload?: Record<string, unknown>;\n\n\tconstructor(message: string, options?: { code?: string; payload?: Record<string, unknown>; cause?: unknown }) {\n\t\tsuper(message);\n\t\tthis.name = \"CodexApiError\";\n\t\tthis.code = options?.code;\n\t\tthis.payload = options?.payload;\n\t\tthis.cause = options?.cause;\n\t}\n}\n\nclass CodexProtocolError extends Error {\n\treadonly payload?: unknown;\n\n\tconstructor(message: string, options?: { payload?: unknown; cause?: unknown }) {\n\t\tsuper(message);\n\t\tthis.name = \"CodexProtocolError\";\n\t\tthis.payload = options?.payload;\n\t\tthis.cause = options?.cause;\n\t}\n}\n\nfunction isCodexNonTransportError(error: unknown): boolean {\n\treturn error instanceof CodexApiError || error instanceof CodexProtocolError;\n}\n\nasync function* mapCodexEvents(events: AsyncIterable<Record<string, unknown>>): AsyncGenerator<ResponseStreamEvent> {\n\tfor await (const event of events) {\n\t\tconst type = typeof event.type === \"string\" ? event.type : undefined;\n\t\tif (!type) continue;\n\n\t\tif (type === \"error\") {\n\t\t\tconst code = (event as { code?: string }).code || \"\";\n\t\t\tconst message = (event as { message?: string }).message || \"\";\n\t\t\tthrow new CodexApiError(`Codex error: ${message || code || JSON.stringify(event)}`, {\n\t\t\t\tcode: code || undefined,\n\t\t\t\tpayload: event,\n\t\t\t});\n\t\t}\n\n\t\tif (type === \"response.failed\") {\n\t\t\tconst response = (event as { response?: { error?: { code?: string; message?: string } } }).response;\n\t\t\tconst code = response?.error?.code;\n\t\t\tconst message = response?.error?.message;\n\t\t\tthrow new CodexApiError(message || \"Codex response failed\", { code, payload: event });\n\t\t}\n\n\t\tif (type === \"response.done\" || type === \"response.completed\" || type === \"response.incomplete\") {\n\t\t\tconst response = (event as { response?: { status?: unknown } }).response;\n\t\t\tconst normalizedResponse = response\n\t\t\t\t? { ...response, status: normalizeCodexStatus(response.status) }\n\t\t\t\t: response;\n\t\t\tyield { ...event, type: \"response.completed\", response: normalizedResponse } as ResponseStreamEvent;\n\t\t\treturn;\n\t\t}\n\n\t\tyield event as unknown as ResponseStreamEvent;\n\t}\n}\n\nfunction normalizeCodexStatus(status: unknown): CodexResponseStatus | undefined {\n\tif (typeof status !== \"string\") return undefined;\n\treturn CODEX_RESPONSE_STATUSES.has(status as CodexResponseStatus) ? (status as CodexResponseStatus) : undefined;\n}\n\n// ============================================================================\n// SSE Parsing\n// ============================================================================\n\nasync function* parseSSE(response: Response): AsyncGenerator<Record<string, unknown>> {\n\tif (!response.body) return;\n\n\tconst reader = response.body.getReader();\n\tconst decoder = new TextDecoder();\n\tlet buffer = \"\";\n\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = await reader.read();\n\t\t\tif (done) break;\n\t\t\tbuffer += decoder.decode(value, { stream: true });\n\n\t\t\tlet idx = buffer.indexOf(\"\\n\\n\");\n\t\t\twhile (idx !== -1) {\n\t\t\t\tconst chunk = buffer.slice(0, idx);\n\t\t\t\tbuffer = buffer.slice(idx + 2);\n\n\t\t\t\tconst dataLines = chunk\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.filter((l) => l.startsWith(\"data:\"))\n\t\t\t\t\t.map((l) => l.slice(5).trim());\n\t\t\t\tif (dataLines.length > 0) {\n\t\t\t\t\tconst data = dataLines.join(\"\\n\").trim();\n\t\t\t\t\tif (data && data !== \"[DONE]\") {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tyield JSON.parse(data) as Record<string, unknown>;\n\t\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\t\tthrow new CodexProtocolError(`Invalid Codex SSE JSON: ${formatThrownValue(cause)}`, {\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\tpayload: data,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tidx = buffer.indexOf(\"\\n\\n\");\n\t\t\t}\n\t\t}\n\t} finally {\n\t\ttry {\n\t\t\tawait reader.cancel();\n\t\t} catch {}\n\t\ttry {\n\t\t\treader.releaseLock();\n\t\t} catch {}\n\t}\n}\n\n// ============================================================================\n// WebSocket Parsing\n// ============================================================================\n\nconst OPENAI_BETA_RESPONSES_WEBSOCKETS = \"responses_websockets=2026-02-06\";\nconst SESSION_WEBSOCKET_CACHE_TTL_MS = 5 * 60 * 1000;\n\ntype WebSocketEventType = \"open\" | \"message\" | \"error\" | \"close\";\ntype WebSocketListener = (event: unknown) => void;\n\ninterface WebSocketLike {\n\tclose(code?: number, reason?: string): void;\n\tsend(data: string): void;\n\taddEventListener(type: WebSocketEventType, listener: WebSocketListener): void;\n\tremoveEventListener(type: WebSocketEventType, listener: WebSocketListener): void;\n}\n\ninterface CachedWebSocketContinuationState {\n\tlastRequestBody: RequestBody;\n\tlastResponseId: string;\n\tlastResponseItems: ResponseInput;\n}\n\ninterface CachedWebSocketConnection {\n\tsocket: WebSocketLike;\n\tbusy: boolean;\n\tidleTimer?: ReturnType<typeof setTimeout>;\n\tcontinuation?: CachedWebSocketContinuationState;\n}\n\nexport interface OpenAICodexWebSocketDebugStats {\n\trequests: number;\n\tconnectionsCreated: number;\n\tconnectionsReused: number;\n\tcachedContextRequests: number;\n\tstoreTrueRequests: number;\n\tfullContextRequests: number;\n\tdeltaRequests: number;\n\tlastInputItems: number;\n\tlastDeltaInputItems?: number;\n\tlastPreviousResponseId?: string;\n\twebsocketFailures: number;\n\tsseFallbacks: number;\n\twebsocketFallbackActive?: boolean;\n\tlastWebSocketError?: string;\n}\n\nconst websocketSessionCache = new Map<string, CachedWebSocketConnection>();\nconst websocketDebugStats = new Map<string, OpenAICodexWebSocketDebugStats>();\nconst websocketSseFallbackSessions = new Set<string>();\n\nfunction getOrCreateWebSocketDebugStats(sessionId: string): OpenAICodexWebSocketDebugStats {\n\tlet stats = websocketDebugStats.get(sessionId);\n\tif (!stats) {\n\t\tstats = {\n\t\t\trequests: 0,\n\t\t\tconnectionsCreated: 0,\n\t\t\tconnectionsReused: 0,\n\t\t\tcachedContextRequests: 0,\n\t\t\tstoreTrueRequests: 0,\n\t\t\tfullContextRequests: 0,\n\t\t\tdeltaRequests: 0,\n\t\t\tlastInputItems: 0,\n\t\t\twebsocketFailures: 0,\n\t\t\tsseFallbacks: 0,\n\t\t};\n\t\twebsocketDebugStats.set(sessionId, stats);\n\t}\n\treturn stats;\n}\n\nexport function getOpenAICodexWebSocketDebugStats(sessionId: string): OpenAICodexWebSocketDebugStats | undefined {\n\tconst stats = websocketDebugStats.get(sessionId);\n\treturn stats ? { ...stats } : undefined;\n}\n\nexport function resetOpenAICodexWebSocketDebugStats(sessionId?: string): void {\n\tif (sessionId) {\n\t\twebsocketDebugStats.delete(sessionId);\n\t\twebsocketSseFallbackSessions.delete(sessionId);\n\t\treturn;\n\t}\n\twebsocketDebugStats.clear();\n\twebsocketSseFallbackSessions.clear();\n}\n\nexport function closeOpenAICodexWebSocketSessions(sessionId?: string): void {\n\tconst closeEntry = (entry: CachedWebSocketConnection) => {\n\t\tif (entry.idleTimer) clearTimeout(entry.idleTimer);\n\t\tcloseWebSocketSilently(entry.socket, 1000, \"debug_close\");\n\t};\n\tif (sessionId) {\n\t\tconst entry = websocketSessionCache.get(sessionId);\n\t\tif (entry) closeEntry(entry);\n\t\twebsocketSessionCache.delete(sessionId);\n\t\treturn;\n\t}\n\tfor (const entry of websocketSessionCache.values()) {\n\t\tcloseEntry(entry);\n\t}\n\twebsocketSessionCache.clear();\n}\n\nregisterSessionResourceCleanup(closeOpenAICodexWebSocketSessions);\n\nfunction isWebSocketSseFallbackActive(sessionId: string | undefined): boolean {\n\treturn sessionId ? websocketSseFallbackSessions.has(sessionId) : false;\n}\n\nfunction recordWebSocketSseFallback(sessionId: string | undefined): void {\n\tif (!sessionId) return;\n\tconst stats = getOrCreateWebSocketDebugStats(sessionId);\n\tstats.sseFallbacks++;\n\tstats.websocketFallbackActive = isWebSocketSseFallbackActive(sessionId);\n}\n\nfunction recordWebSocketFailure(sessionId: string | undefined, error: unknown): void {\n\tif (!sessionId) return;\n\twebsocketSseFallbackSessions.add(sessionId);\n\n\tconst stats = getOrCreateWebSocketDebugStats(sessionId);\n\tstats.websocketFailures++;\n\tstats.lastWebSocketError = formatThrownValue(error);\n\tstats.websocketFallbackActive = true;\n}\n\ntype WebSocketConstructor = new (\n\turl: string,\n\tprotocols?: string | string[] | { headers?: Record<string, string> },\n) => WebSocketLike;\n\nlet _cachedWebsocket: WebSocketConstructor | null = null;\nasync function getWebSocketConstructor(): Promise<WebSocketConstructor | null> {\n\tif (_cachedWebsocket) return _cachedWebsocket;\n\n\t// bun doesn't respect http proxy envs, ref: https://github.com/oven-sh/bun/issues/15489\n\t// TODO: remove this when bun supports proxy envs in websocket.\n\tif (\n\t\tprocess?.versions?.bun &&\n\t\t(process.env.HTTP_PROXY || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.https_proxy)\n\t) {\n\t\tconst m = await dynamicImport(\"proxy-from-env\");\n\t\tconst getProxyForUrl = (m as { getProxyForUrl: (url: string | object | URL) => string }).getProxyForUrl;\n\n\t\t_cachedWebsocket = class extends WebSocket {\n\t\t\tconstructor(url: string | URL, options?: string | string[] | Record<string, unknown>) {\n\t\t\t\tlet _opts: Record<string, unknown> = {};\n\t\t\t\tif (Array.isArray(options) || typeof options === \"string\") {\n\t\t\t\t\t_opts = { protocols: options };\n\t\t\t\t} else {\n\t\t\t\t\t_opts = { ...options };\n\t\t\t\t}\n\n\t\t\t\tconst proxy = getProxyForUrl(url.toString().replace(/^wss:/, \"https:\").replace(/^ws:/, \"http:\"));\n\t\t\t\tsuper(url, { ..._opts, ...(proxy ? { proxy } : {}) } as any);\n\t\t\t}\n\t\t};\n\t\treturn _cachedWebsocket;\n\t}\n\n\tconst ctor = (globalThis as { WebSocket?: unknown }).WebSocket;\n\tif (typeof ctor !== \"function\") return null;\n\treturn ctor as unknown as WebSocketConstructor;\n}\n\nclass WebSocketCloseError extends Error {\n\treadonly code?: number;\n\treadonly reason?: string;\n\treadonly wasClean?: boolean;\n\n\tconstructor(message: string, options?: { code?: number; reason?: string; wasClean?: boolean }) {\n\t\tsuper(message);\n\t\tthis.name = \"WebSocketCloseError\";\n\t\tthis.code = options?.code;\n\t\tthis.reason = options?.reason;\n\t\tthis.wasClean = options?.wasClean;\n\t}\n}\n\nfunction getWebSocketReadyState(socket: WebSocketLike): number | undefined {\n\tconst readyState = (socket as { readyState?: unknown }).readyState;\n\treturn typeof readyState === \"number\" ? readyState : undefined;\n}\n\nfunction isWebSocketReusable(socket: WebSocketLike): boolean {\n\tconst readyState = getWebSocketReadyState(socket);\n\t// If readyState is unavailable, assume the runtime keeps it open/reusable.\n\treturn readyState === undefined || readyState === 1;\n}\n\nfunction closeWebSocketSilently(socket: WebSocketLike, code = 1000, reason = \"done\"): void {\n\ttry {\n\t\tsocket.close(code, reason);\n\t} catch {}\n}\n\nfunction scheduleSessionWebSocketExpiry(sessionId: string, entry: CachedWebSocketConnection): void {\n\tif (entry.idleTimer) {\n\t\tclearTimeout(entry.idleTimer);\n\t}\n\tentry.idleTimer = setTimeout(() => {\n\t\tif (entry.busy) return;\n\t\tcloseWebSocketSilently(entry.socket, 1000, \"idle_timeout\");\n\t\twebsocketSessionCache.delete(sessionId);\n\t}, SESSION_WEBSOCKET_CACHE_TTL_MS);\n}\n\nasync function connectWebSocket(url: string, headers: Headers, signal?: AbortSignal): Promise<WebSocketLike> {\n\tconst WebSocketCtor = await getWebSocketConstructor();\n\tif (!WebSocketCtor) {\n\t\tthrow new Error(\"WebSocket transport is not available in this runtime\");\n\t}\n\n\tconst wsHeaders = headersToRecord(headers);\n\tdelete wsHeaders[\"OpenAI-Beta\"];\n\n\treturn new Promise<WebSocketLike>((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet socket: WebSocketLike;\n\n\t\ttry {\n\t\t\tsocket = new WebSocketCtor(url, { headers: wsHeaders });\n\t\t} catch (error) {\n\t\t\treject(error instanceof Error ? error : new Error(String(error)));\n\t\t\treturn;\n\t\t}\n\n\t\tconst onOpen: WebSocketListener = () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tresolve(socket);\n\t\t};\n\t\tconst onError: WebSocketListener = (event) => {\n\t\t\tconst error = extractWebSocketError(event);\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t};\n\t\tconst onClose: WebSocketListener = (event) => {\n\t\t\tconst error = extractWebSocketCloseError(event);\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t};\n\t\tconst onAbort = () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tsocket.close(1000, \"aborted\");\n\t\t\treject(new Error(\"Request was aborted\"));\n\t\t};\n\n\t\tconst cleanup = () => {\n\t\t\tsocket.removeEventListener(\"open\", onOpen);\n\t\t\tsocket.removeEventListener(\"error\", onError);\n\t\t\tsocket.removeEventListener(\"close\", onClose);\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t};\n\n\t\tsocket.addEventListener(\"open\", onOpen);\n\t\tsocket.addEventListener(\"error\", onError);\n\t\tsocket.addEventListener(\"close\", onClose);\n\t\tsignal?.addEventListener(\"abort\", onAbort);\n\t});\n}\n\nasync function acquireWebSocket(\n\turl: string,\n\theaders: Headers,\n\tsessionId: string | undefined,\n\tsignal?: AbortSignal,\n): Promise<{\n\tsocket: WebSocketLike;\n\tentry?: CachedWebSocketConnection;\n\treused: boolean;\n\trelease: (options?: { keep?: boolean }) => void;\n}> {\n\tif (!sessionId) {\n\t\tconst socket = await connectWebSocket(url, headers, signal);\n\t\treturn {\n\t\t\tsocket,\n\t\t\treused: false,\n\t\t\trelease: ({ keep } = {}) => {\n\t\t\t\tif (keep === false) {\n\t\t\t\t\tcloseWebSocketSilently(socket);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcloseWebSocketSilently(socket);\n\t\t\t},\n\t\t};\n\t}\n\n\tconst cached = websocketSessionCache.get(sessionId);\n\tif (cached) {\n\t\tif (cached.idleTimer) {\n\t\t\tclearTimeout(cached.idleTimer);\n\t\t\tcached.idleTimer = undefined;\n\t\t}\n\t\tif (!cached.busy && isWebSocketReusable(cached.socket)) {\n\t\t\tcached.busy = true;\n\t\t\treturn {\n\t\t\t\tsocket: cached.socket,\n\t\t\t\tentry: cached,\n\t\t\t\treused: true,\n\t\t\t\trelease: ({ keep } = {}) => {\n\t\t\t\t\tif (!keep || !isWebSocketReusable(cached.socket)) {\n\t\t\t\t\t\tcloseWebSocketSilently(cached.socket);\n\t\t\t\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcached.busy = false;\n\t\t\t\t\tscheduleSessionWebSocketExpiry(sessionId, cached);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (cached.busy) {\n\t\t\tconst socket = await connectWebSocket(url, headers, signal);\n\t\t\treturn {\n\t\t\t\tsocket,\n\t\t\t\treused: false,\n\t\t\t\trelease: () => {\n\t\t\t\t\tcloseWebSocketSilently(socket);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (!isWebSocketReusable(cached.socket)) {\n\t\t\tcloseWebSocketSilently(cached.socket);\n\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t}\n\t}\n\n\tconst socket = await connectWebSocket(url, headers, signal);\n\tconst entry: CachedWebSocketConnection = { socket, busy: true };\n\twebsocketSessionCache.set(sessionId, entry);\n\treturn {\n\t\tsocket,\n\t\tentry,\n\t\treused: false,\n\t\trelease: ({ keep } = {}) => {\n\t\t\tif (!keep || !isWebSocketReusable(entry.socket)) {\n\t\t\t\tcloseWebSocketSilently(entry.socket);\n\t\t\t\tif (entry.idleTimer) clearTimeout(entry.idleTimer);\n\t\t\t\tif (websocketSessionCache.get(sessionId) === entry) {\n\t\t\t\t\twebsocketSessionCache.delete(sessionId);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tentry.busy = false;\n\t\t\tscheduleSessionWebSocketExpiry(sessionId, entry);\n\t\t},\n\t};\n}\n\nfunction extractWebSocketError(event: unknown): Error {\n\tif (event && typeof event === \"object\") {\n\t\tconst message = \"message\" in event ? (event as { message?: unknown }).message : undefined;\n\t\tif (typeof message === \"string\" && message.length > 0) {\n\t\t\treturn new Error(message);\n\t\t}\n\n\t\tconst nestedError = \"error\" in event ? (event as { error?: unknown }).error : undefined;\n\t\tif (nestedError instanceof Error && nestedError.message.length > 0) {\n\t\t\treturn nestedError;\n\t\t}\n\t\tif (nestedError && typeof nestedError === \"object\" && \"message\" in nestedError) {\n\t\t\tconst nestedMessage = (nestedError as { message?: unknown }).message;\n\t\t\tif (typeof nestedMessage === \"string\" && nestedMessage.length > 0) {\n\t\t\t\treturn new Error(nestedMessage);\n\t\t\t}\n\t\t}\n\t}\n\treturn new Error(\"WebSocket error\");\n}\n\nfunction extractWebSocketCloseError(event: unknown): Error {\n\tif (event && typeof event === \"object\") {\n\t\tconst code = \"code\" in event ? (event as { code?: unknown }).code : undefined;\n\t\tconst reason = \"reason\" in event ? (event as { reason?: unknown }).reason : undefined;\n\t\tconst wasClean = \"wasClean\" in event ? (event as { wasClean?: unknown }).wasClean : undefined;\n\t\tconst codeText = typeof code === \"number\" ? ` ${code}` : \"\";\n\t\tlet reasonText = typeof reason === \"string\" && reason.length > 0 ? ` ${reason}` : \"\";\n\t\tif (!reasonText && code === WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE) {\n\t\t\treasonText = \" message too big\";\n\t\t}\n\t\treturn new WebSocketCloseError(`WebSocket closed${codeText}${reasonText}`.trim(), {\n\t\t\tcode: typeof code === \"number\" ? code : undefined,\n\t\t\treason: typeof reason === \"string\" && reason.length > 0 ? reason : undefined,\n\t\t\twasClean: typeof wasClean === \"boolean\" ? wasClean : undefined,\n\t\t});\n\t}\n\treturn new Error(\"WebSocket closed\");\n}\n\nasync function decodeWebSocketData(data: unknown): Promise<string | null> {\n\tif (typeof data === \"string\") return data;\n\tif (data instanceof ArrayBuffer) {\n\t\treturn new TextDecoder().decode(new Uint8Array(data));\n\t}\n\tif (ArrayBuffer.isView(data)) {\n\t\tconst view = data as ArrayBufferView;\n\t\treturn new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset, view.byteLength));\n\t}\n\tif (data && typeof data === \"object\" && \"arrayBuffer\" in data) {\n\t\tconst blobLike = data as { arrayBuffer: () => Promise<ArrayBuffer> };\n\t\tconst arrayBuffer = await blobLike.arrayBuffer();\n\t\treturn new TextDecoder().decode(new Uint8Array(arrayBuffer));\n\t}\n\treturn null;\n}\n\nasync function* parseWebSocket(socket: WebSocketLike, signal?: AbortSignal): AsyncGenerator<Record<string, unknown>> {\n\tconst queue: Record<string, unknown>[] = [];\n\tlet pending: (() => void) | null = null;\n\tlet done = false;\n\tlet failed: Error | null = null;\n\tlet sawCompletion = false;\n\n\tconst wake = () => {\n\t\tif (!pending) return;\n\t\tconst resolve = pending;\n\t\tpending = null;\n\t\tresolve();\n\t};\n\n\tconst onMessage: WebSocketListener = (event) => {\n\t\tvoid (async () => {\n\t\t\tlet text: string | null = null;\n\t\t\ttry {\n\t\t\t\tif (!event || typeof event !== \"object\" || !(\"data\" in event)) return;\n\t\t\t\ttext = await decodeWebSocketData((event as { data?: unknown }).data);\n\t\t\t\tif (!text) return;\n\t\t\t\tconst parsed = JSON.parse(text) as Record<string, unknown>;\n\t\t\t\tconst type = typeof parsed.type === \"string\" ? parsed.type : \"\";\n\t\t\t\tif (type === \"response.completed\" || type === \"response.done\" || type === \"response.incomplete\") {\n\t\t\t\t\tsawCompletion = true;\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t\tqueue.push(parsed);\n\t\t\t\twake();\n\t\t\t} catch (cause) {\n\t\t\t\tfailed = new CodexProtocolError(`Invalid Codex WebSocket JSON: ${formatThrownValue(cause)}`, {\n\t\t\t\t\tcause,\n\t\t\t\t\tpayload: text,\n\t\t\t\t});\n\t\t\t\tdone = true;\n\t\t\t\twake();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst onError: WebSocketListener = (event) => {\n\t\tfailed = extractWebSocketError(event);\n\t\tdone = true;\n\t\twake();\n\t};\n\n\tconst onClose: WebSocketListener = (event) => {\n\t\tif (sawCompletion) {\n\t\t\tdone = true;\n\t\t\twake();\n\t\t\treturn;\n\t\t}\n\t\tif (!failed) {\n\t\t\tfailed = extractWebSocketCloseError(event);\n\t\t}\n\t\tdone = true;\n\t\twake();\n\t};\n\n\tconst onAbort = () => {\n\t\tfailed = new Error(\"Request was aborted\");\n\t\tdone = true;\n\t\twake();\n\t};\n\n\tsocket.addEventListener(\"message\", onMessage);\n\tsocket.addEventListener(\"error\", onError);\n\tsocket.addEventListener(\"close\", onClose);\n\tsignal?.addEventListener(\"abort\", onAbort);\n\n\ttry {\n\t\twhile (true) {\n\t\t\tif (signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\t\t\tif (queue.length > 0) {\n\t\t\t\tyield queue.shift()!;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (done) break;\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tpending = resolve;\n\t\t\t});\n\t\t}\n\n\t\tif (failed) {\n\t\t\tthrow failed;\n\t\t}\n\t\tif (!sawCompletion) {\n\t\t\tthrow new Error(\"WebSocket stream closed before response.completed\");\n\t\t}\n\t} finally {\n\t\tsocket.removeEventListener(\"message\", onMessage);\n\t\tsocket.removeEventListener(\"error\", onError);\n\t\tsocket.removeEventListener(\"close\", onClose);\n\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\nfunction requestBodyWithoutInput(body: RequestBody): RequestBody {\n\tconst { input: _input, previous_response_id: _previousResponseId, ...rest } = body;\n\treturn rest;\n}\n\nfunction responseInputsEqual(a: ResponseInput | undefined, b: ResponseInput | undefined): boolean {\n\treturn JSON.stringify(a ?? []) === JSON.stringify(b ?? []);\n}\n\nfunction requestBodiesMatchExceptInput(a: RequestBody, b: RequestBody): boolean {\n\treturn JSON.stringify(requestBodyWithoutInput(a)) === JSON.stringify(requestBodyWithoutInput(b));\n}\n\nfunction getCachedWebSocketInputDelta(\n\tbody: RequestBody,\n\tcontinuation: CachedWebSocketContinuationState,\n): ResponseInput | undefined {\n\tif (!requestBodiesMatchExceptInput(body, continuation.lastRequestBody)) {\n\t\treturn undefined;\n\t}\n\n\tconst currentInput = body.input ?? [];\n\tconst baseline = [...(continuation.lastRequestBody.input ?? []), ...continuation.lastResponseItems];\n\tif (currentInput.length < baseline.length) {\n\t\treturn undefined;\n\t}\n\n\tconst prefix = currentInput.slice(0, baseline.length);\n\tif (!responseInputsEqual(prefix, baseline)) {\n\t\treturn undefined;\n\t}\n\n\treturn currentInput.slice(baseline.length);\n}\n\nfunction buildCachedWebSocketRequestBody(entry: CachedWebSocketConnection, body: RequestBody): RequestBody {\n\tconst continuation = entry.continuation;\n\tif (!continuation) {\n\t\treturn body;\n\t}\n\n\tconst delta = getCachedWebSocketInputDelta(body, continuation);\n\tif (!delta || !continuation.lastResponseId) {\n\t\tentry.continuation = undefined;\n\t\treturn body;\n\t}\n\n\treturn {\n\t\t...body,\n\t\tprevious_response_id: continuation.lastResponseId,\n\t\tinput: delta,\n\t};\n}\n\nasync function* startWebSocketOutputOnFirstEvent(\n\tevents: AsyncIterable<ResponseStreamEvent>,\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n\tonStart: () => void,\n): AsyncGenerator<ResponseStreamEvent> {\n\tlet started = false;\n\tfor await (const event of events) {\n\t\tif (!started) {\n\t\t\tstarted = true;\n\t\t\tonStart();\n\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t}\n\t\tyield event;\n\t}\n}\n\nasync function processWebSocketStream(\n\turl: string,\n\tbody: RequestBody,\n\theaders: Headers,\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n\tmodel: Model<\"openai-codex-responses\">,\n\tonStart: () => void,\n\toptions?: OpenAICodexResponsesOptions,\n): Promise<void> {\n\tconst { socket, entry, reused, release } = await acquireWebSocket(url, headers, options?.sessionId, options?.signal);\n\tlet keepConnection = true;\n\tconst useCachedContext = options?.transport === \"websocket-cached\" || options?.transport === \"auto\";\n\t// ChatGPT Codex Responses rejects `store: true` (\"Store must be set to false\").\n\t// WebSocket continuation still works via connection-scoped previous_response_id state.\n\tconst fullBody = body;\n\tconst requestBody = useCachedContext && entry ? buildCachedWebSocketRequestBody(entry, fullBody) : fullBody;\n\tconst stats = options?.sessionId ? getOrCreateWebSocketDebugStats(options.sessionId) : undefined;\n\tif (stats) {\n\t\tstats.requests++;\n\t\tif (reused) stats.connectionsReused++;\n\t\telse stats.connectionsCreated++;\n\t\tif (useCachedContext) stats.cachedContextRequests++;\n\t\tif (requestBody.store === true) stats.storeTrueRequests++;\n\t\tstats.lastInputItems = requestBody.input?.length ?? 0;\n\t\tif (requestBody.previous_response_id) {\n\t\t\tstats.deltaRequests++;\n\t\t\tstats.lastDeltaInputItems = requestBody.input?.length ?? 0;\n\t\t\tstats.lastPreviousResponseId = requestBody.previous_response_id;\n\t\t} else {\n\t\t\tstats.fullContextRequests++;\n\t\t\tstats.lastDeltaInputItems = undefined;\n\t\t\tstats.lastPreviousResponseId = undefined;\n\t\t}\n\t}\n\ttry {\n\t\tsocket.send(JSON.stringify({ type: \"response.create\", ...requestBody }));\n\t\tawait processResponsesStream(\n\t\t\tstartWebSocketOutputOnFirstEvent(\n\t\t\t\tmapCodexEvents(parseWebSocket(socket, options?.signal)),\n\t\t\t\toutput,\n\t\t\t\tstream,\n\t\t\t\tonStart,\n\t\t\t),\n\t\t\toutput,\n\t\t\tstream,\n\t\t\tmodel,\n\t\t\t{\n\t\t\t\tserviceTier: options?.serviceTier,\n\t\t\t\tresolveServiceTier: resolveCodexServiceTier,\n\t\t\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t\t\t},\n\t\t);\n\t\tif (options?.signal?.aborted) {\n\t\t\tkeepConnection = false;\n\t\t} else if (useCachedContext && entry && output.responseId) {\n\t\t\tconst responseItems = convertResponsesMessages(model, { messages: [output] }, CODEX_TOOL_CALL_PROVIDERS, {\n\t\t\t\tincludeSystemPrompt: false,\n\t\t\t}).filter((item) => item.type !== \"function_call_output\");\n\t\t\tentry.continuation = {\n\t\t\t\tlastRequestBody: fullBody,\n\t\t\t\tlastResponseId: output.responseId,\n\t\t\t\tlastResponseItems: responseItems,\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\tif (entry) {\n\t\t\tentry.continuation = undefined;\n\t\t}\n\t\tkeepConnection = false;\n\t\tthrow error;\n\t} finally {\n\t\trelease({ keep: keepConnection });\n\t}\n}\n\n// ============================================================================\n// Error Handling\n// ============================================================================\n\nasync function parseErrorResponse(response: Response): Promise<{ message: string; friendlyMessage?: string }> {\n\tconst raw = await response.text();\n\tlet message = raw || response.statusText || \"Request failed\";\n\tlet friendlyMessage: string | undefined;\n\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as {\n\t\t\terror?: { code?: string; type?: string; message?: string; plan_type?: string; resets_at?: number };\n\t\t};\n\t\tconst err = parsed?.error;\n\t\tif (err) {\n\t\t\tconst code = err.code || err.type || \"\";\n\t\t\tif (/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(code) || response.status === 429) {\n\t\t\t\tconst plan = err.plan_type ? ` (${err.plan_type.toLowerCase()} plan)` : \"\";\n\t\t\t\tconst mins = err.resets_at\n\t\t\t\t\t? Math.max(0, Math.round((err.resets_at * 1000 - Date.now()) / 60000))\n\t\t\t\t\t: undefined;\n\t\t\t\tconst when = mins !== undefined ? ` Try again in ~${mins} min.` : \"\";\n\t\t\t\tfriendlyMessage = `You have hit your ChatGPT usage limit${plan}.${when}`.trim();\n\t\t\t}\n\t\t\tmessage = err.message || friendlyMessage || message;\n\t\t}\n\t} catch {}\n\n\treturn { message, friendlyMessage };\n}\n\n// ============================================================================\n// Auth & Headers\n// ============================================================================\n\nfunction extractAccountId(token: string): string {\n\ttry {\n\t\tconst parts = token.split(\".\");\n\t\tif (parts.length !== 3) throw new Error(\"Invalid token\");\n\t\tconst payload = JSON.parse(atob(parts[1]));\n\t\tconst accountId = payload?.[JWT_CLAIM_PATH]?.chatgpt_account_id;\n\t\tif (!accountId) throw new Error(\"No account ID in token\");\n\t\treturn accountId;\n\t} catch {\n\t\tthrow new Error(\"Failed to extract accountId from token\");\n\t}\n}\n\nfunction createCodexRequestId(): string {\n\tif (typeof globalThis.crypto?.randomUUID === \"function\") {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\treturn `codex_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction buildBaseCodexHeaders(\n\tinitHeaders: Record<string, string> | undefined,\n\tadditionalHeaders: Record<string, string> | undefined,\n\taccountId: string,\n\ttoken: string,\n): Headers {\n\tconst headers = new Headers(initHeaders);\n\tfor (const [key, value] of Object.entries(additionalHeaders || {})) {\n\t\theaders.set(key, value);\n\t}\n\theaders.set(\"Authorization\", `Bearer ${token}`);\n\theaders.set(\"chatgpt-account-id\", accountId);\n\theaders.set(\"originator\", \"pi\");\n\tconst userAgent = _os ? `pi (${_os.platform()} ${_os.release()}; ${_os.arch()})` : \"pi (browser)\";\n\theaders.set(\"User-Agent\", userAgent);\n\treturn headers;\n}\n\nfunction buildSSEHeaders(\n\tinitHeaders: Record<string, string> | undefined,\n\tadditionalHeaders: Record<string, string> | undefined,\n\taccountId: string,\n\ttoken: string,\n\tsessionId?: string,\n): Headers {\n\tconst headers = buildBaseCodexHeaders(initHeaders, additionalHeaders, accountId, token);\n\theaders.set(\"OpenAI-Beta\", \"responses=experimental\");\n\theaders.set(\"accept\", \"text/event-stream\");\n\theaders.set(\"content-type\", \"application/json\");\n\n\tif (sessionId) {\n\t\theaders.set(\"session_id\", sessionId);\n\t\theaders.set(\"x-client-request-id\", sessionId);\n\t}\n\n\treturn headers;\n}\n\nfunction buildWebSocketHeaders(\n\tinitHeaders: Record<string, string> | undefined,\n\tadditionalHeaders: Record<string, string> | undefined,\n\taccountId: string,\n\ttoken: string,\n\trequestId: string,\n): Headers {\n\tconst headers = buildBaseCodexHeaders(initHeaders, additionalHeaders, accountId, token);\n\theaders.delete(\"accept\");\n\theaders.delete(\"content-type\");\n\theaders.delete(\"OpenAI-Beta\");\n\theaders.delete(\"openai-beta\");\n\theaders.set(\"OpenAI-Beta\", OPENAI_BETA_RESPONSES_WEBSOCKETS);\n\theaders.set(\"x-client-request-id\", requestId);\n\theaders.set(\"session_id\", requestId);\n\treturn headers;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
2
- import type { Context, Model, OpenAICompletionsCompat, SimpleStreamOptions, StreamFunction, StreamOptions } from "../types.js";
2
+ import type { Context, Model, OpenAICompletionsCompat, SimpleStreamOptions, StreamFunction, StreamOptions } from "../types.ts";
3
3
  export interface OpenAICompletionsOptions extends StreamOptions {
4
4
  toolChoice?: "auto" | "none" | "required" | {
5
5
  type: "function";