axon-code 2.4.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (644) hide show
  1. package/dist/auth/snapshot.d.ts +24 -0
  2. package/dist/auth/snapshot.d.ts.map +1 -0
  3. package/dist/auth/snapshot.js +144 -0
  4. package/dist/auth/snapshot.js.map +1 -0
  5. package/dist/cli.js +3 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/config/axon-md-parser.d.ts.map +1 -1
  8. package/dist/config/axon-md-parser.js +21 -4
  9. package/dist/config/axon-md-parser.js.map +1 -1
  10. package/dist/config/index.d.ts +39 -21
  11. package/dist/config/index.d.ts.map +1 -1
  12. package/dist/config/index.js +14 -2
  13. package/dist/config/index.js.map +1 -1
  14. package/dist/context/enhanced.d.ts.map +1 -1
  15. package/dist/context/enhanced.js +5 -0
  16. package/dist/context/enhanced.js.map +1 -1
  17. package/dist/core/client.d.ts +7 -2
  18. package/dist/core/client.d.ts.map +1 -1
  19. package/dist/core/client.js +50 -18
  20. package/dist/core/client.js.map +1 -1
  21. package/dist/core/loop.d.ts +47 -8
  22. package/dist/core/loop.d.ts.map +1 -1
  23. package/dist/core/loop.js +333 -149
  24. package/dist/core/loop.js.map +1 -1
  25. package/dist/core/max-tokens.d.ts +24 -0
  26. package/dist/core/max-tokens.d.ts.map +1 -0
  27. package/dist/core/max-tokens.js +69 -0
  28. package/dist/core/max-tokens.js.map +1 -0
  29. package/dist/core/session.d.ts.map +1 -1
  30. package/dist/core/session.js +7 -14
  31. package/dist/core/session.js.map +1 -1
  32. package/dist/daemon/config.d.ts +6 -6
  33. package/dist/daemon/executor.d.ts.map +1 -1
  34. package/dist/daemon/executor.js +24 -30
  35. package/dist/daemon/executor.js.map +1 -1
  36. package/dist/goals/goal-store.d.ts +1 -1
  37. package/dist/goals/goal-store.d.ts.map +1 -1
  38. package/dist/goals/goal-store.js.map +1 -1
  39. package/dist/hooks/auto-verify.d.ts +86 -0
  40. package/dist/hooks/auto-verify.d.ts.map +1 -0
  41. package/dist/hooks/auto-verify.js +297 -0
  42. package/dist/hooks/auto-verify.js.map +1 -0
  43. package/dist/mcp/config.d.ts +16 -16
  44. package/dist/media/index.d.ts +2 -1
  45. package/dist/media/index.d.ts.map +1 -1
  46. package/dist/media/index.js +5 -3
  47. package/dist/media/index.js.map +1 -1
  48. package/dist/media/office-visual.d.ts +66 -0
  49. package/dist/media/office-visual.d.ts.map +1 -0
  50. package/dist/media/office-visual.js +409 -0
  51. package/dist/media/office-visual.js.map +1 -0
  52. package/dist/media/office.d.ts +17 -0
  53. package/dist/media/office.d.ts.map +1 -1
  54. package/dist/media/office.js +227 -2
  55. package/dist/media/office.js.map +1 -1
  56. package/dist/memory/long-term-store.d.ts +6 -0
  57. package/dist/memory/long-term-store.d.ts.map +1 -1
  58. package/dist/memory/long-term-store.js +66 -48
  59. package/dist/memory/long-term-store.js.map +1 -1
  60. package/dist/memory/memory-search.d.ts +9 -3
  61. package/dist/memory/memory-search.d.ts.map +1 -1
  62. package/dist/memory/memory-search.js +58 -12
  63. package/dist/memory/memory-search.js.map +1 -1
  64. package/dist/memory/memory-sync.d.ts +7 -0
  65. package/dist/memory/memory-sync.d.ts.map +1 -1
  66. package/dist/memory/memory-sync.js +92 -0
  67. package/dist/memory/memory-sync.js.map +1 -1
  68. package/dist/memory/notebook.d.ts +7 -0
  69. package/dist/memory/notebook.d.ts.map +1 -1
  70. package/dist/memory/notebook.js +624 -24
  71. package/dist/memory/notebook.js.map +1 -1
  72. package/dist/models/config.d.ts.map +1 -1
  73. package/dist/models/config.js +7 -4
  74. package/dist/models/config.js.map +1 -1
  75. package/dist/models/index.d.ts +1 -0
  76. package/dist/models/index.d.ts.map +1 -1
  77. package/dist/models/index.js +1 -0
  78. package/dist/models/index.js.map +1 -1
  79. package/dist/models/model-limits.d.ts +13 -0
  80. package/dist/models/model-limits.d.ts.map +1 -0
  81. package/dist/models/model-limits.js +79 -0
  82. package/dist/models/model-limits.js.map +1 -0
  83. package/dist/network/discovery.d.ts +2 -0
  84. package/dist/network/discovery.d.ts.map +1 -1
  85. package/dist/network/discovery.js +10 -5
  86. package/dist/network/discovery.js.map +1 -1
  87. package/dist/network/global-proxy.d.ts +7 -0
  88. package/dist/network/global-proxy.d.ts.map +1 -1
  89. package/dist/network/global-proxy.js +67 -0
  90. package/dist/network/global-proxy.js.map +1 -1
  91. package/dist/network/index.d.ts +6 -1
  92. package/dist/network/index.d.ts.map +1 -1
  93. package/dist/network/index.js +16 -11
  94. package/dist/network/index.js.map +1 -1
  95. package/dist/network/transport.d.ts +41 -4
  96. package/dist/network/transport.d.ts.map +1 -1
  97. package/dist/network/transport.js +234 -61
  98. package/dist/network/transport.js.map +1 -1
  99. package/dist/network/types.d.ts +19 -1
  100. package/dist/network/types.d.ts.map +1 -1
  101. package/dist/network/types.js.map +1 -1
  102. package/dist/notifications/cmux.d.ts +115 -0
  103. package/dist/notifications/cmux.d.ts.map +1 -0
  104. package/dist/notifications/cmux.js +436 -0
  105. package/dist/notifications/cmux.js.map +1 -0
  106. package/dist/prompt/attachments.d.ts +8 -0
  107. package/dist/prompt/attachments.d.ts.map +1 -1
  108. package/dist/prompt/attachments.js +74 -2
  109. package/dist/prompt/attachments.js.map +1 -1
  110. package/dist/prompt/builder.js +1 -1
  111. package/dist/prompt/builder.js.map +1 -1
  112. package/dist/prompt/cache.d.ts +1 -6
  113. package/dist/prompt/cache.d.ts.map +1 -1
  114. package/dist/prompt/cache.js +37 -7
  115. package/dist/prompt/cache.js.map +1 -1
  116. package/dist/prompt/templates.d.ts +1 -1
  117. package/dist/prompt/templates.d.ts.map +1 -1
  118. package/dist/prompt/templates.js +4 -3
  119. package/dist/prompt/templates.js.map +1 -1
  120. package/dist/prompt/types.d.ts +3 -1
  121. package/dist/prompt/types.d.ts.map +1 -1
  122. package/dist/prompt/types.js.map +1 -1
  123. package/dist/proxy/server.d.ts.map +1 -1
  124. package/dist/proxy/server.js +32 -11
  125. package/dist/proxy/server.js.map +1 -1
  126. package/dist/search/ripgrep.d.ts.map +1 -1
  127. package/dist/search/ripgrep.js +11 -0
  128. package/dist/search/ripgrep.js.map +1 -1
  129. package/dist/session/index.d.ts +3 -0
  130. package/dist/session/index.d.ts.map +1 -1
  131. package/dist/session/index.js +1 -0
  132. package/dist/session/index.js.map +1 -1
  133. package/dist/skills/builtin/algorithmic-art/LICENSE.txt +202 -0
  134. package/dist/skills/builtin/algorithmic-art/SKILL.md +405 -0
  135. package/dist/skills/builtin/algorithmic-art/templates/generator_template.js +223 -0
  136. package/dist/skills/builtin/algorithmic-art/templates/viewer.html +599 -0
  137. package/dist/skills/builtin/analyze-logs/SKILL.md +75 -0
  138. package/dist/skills/builtin/audit-official/SKILL.md +81 -0
  139. package/dist/skills/builtin/brand-guidelines/LICENSE.txt +202 -0
  140. package/dist/skills/builtin/brand-guidelines/SKILL.md +73 -0
  141. package/dist/skills/builtin/build-portable/SKILL.md +53 -0
  142. package/dist/skills/builtin/canvas-design/SKILL.md +130 -0
  143. package/dist/skills/builtin/changelog/SKILL.md +65 -0
  144. package/dist/skills/builtin/code-review/SKILL.md +75 -0
  145. package/dist/skills/builtin/doc-coauthoring/SKILL.md +375 -0
  146. package/dist/skills/builtin/doctor/SKILL.md +166 -0
  147. package/dist/skills/builtin/docx/LICENSE.txt +30 -0
  148. package/dist/skills/builtin/docx/SKILL.md +590 -0
  149. package/dist/skills/builtin/docx/scripts/__init__.py +1 -0
  150. package/dist/skills/builtin/docx/scripts/accept_changes.py +135 -0
  151. package/dist/skills/builtin/docx/scripts/comment.py +318 -0
  152. package/dist/skills/builtin/docx/scripts/office/helpers/__init__.py +0 -0
  153. package/dist/skills/builtin/docx/scripts/office/helpers/merge_runs.py +199 -0
  154. package/dist/skills/builtin/docx/scripts/office/helpers/simplify_redlines.py +197 -0
  155. package/dist/skills/builtin/docx/scripts/office/pack.py +159 -0
  156. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  157. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  158. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  159. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  160. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  161. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  162. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  163. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  164. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  165. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  166. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  167. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  168. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  169. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  170. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  171. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  172. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  173. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  174. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  175. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  176. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  177. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  178. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  179. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  180. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  181. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  182. package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  183. package/dist/skills/builtin/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  184. package/dist/skills/builtin/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  185. package/dist/skills/builtin/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  186. package/dist/skills/builtin/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  187. package/dist/skills/builtin/docx/scripts/office/schemas/mce/mc.xsd +75 -0
  188. package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  189. package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  190. package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  191. package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  192. package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  193. package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  194. package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  195. package/dist/skills/builtin/docx/scripts/office/soffice.py +183 -0
  196. package/dist/skills/builtin/docx/scripts/office/unpack.py +132 -0
  197. package/dist/skills/builtin/docx/scripts/office/validate.py +111 -0
  198. package/dist/skills/builtin/docx/scripts/office/validators/__init__.py +15 -0
  199. package/dist/skills/builtin/docx/scripts/office/validators/base.py +847 -0
  200. package/dist/skills/builtin/docx/scripts/office/validators/docx.py +446 -0
  201. package/dist/skills/builtin/docx/scripts/office/validators/pptx.py +275 -0
  202. package/dist/skills/builtin/docx/scripts/office/validators/redlining.py +247 -0
  203. package/dist/skills/builtin/docx/scripts/templates/comments.xml +3 -0
  204. package/dist/skills/builtin/docx/scripts/templates/commentsExtended.xml +3 -0
  205. package/dist/skills/builtin/docx/scripts/templates/commentsExtensible.xml +3 -0
  206. package/dist/skills/builtin/docx/scripts/templates/commentsIds.xml +3 -0
  207. package/dist/skills/builtin/docx/scripts/templates/people.xml +3 -0
  208. package/dist/skills/builtin/frontend-design/LICENSE.txt +177 -0
  209. package/dist/skills/builtin/frontend-design/SKILL.md +42 -0
  210. package/dist/skills/builtin/i18n-check/SKILL.md +56 -0
  211. package/dist/skills/builtin/internal-comms/LICENSE.txt +202 -0
  212. package/dist/skills/builtin/internal-comms/SKILL.md +32 -0
  213. package/dist/skills/builtin/internal-comms/examples/3p-updates.md +47 -0
  214. package/dist/skills/builtin/internal-comms/examples/company-newsletter.md +65 -0
  215. package/dist/skills/builtin/internal-comms/examples/faq-answers.md +30 -0
  216. package/dist/skills/builtin/internal-comms/examples/general-comms.md +16 -0
  217. package/dist/skills/builtin/mcp-builder/LICENSE.txt +202 -0
  218. package/dist/skills/builtin/mcp-builder/SKILL.md +236 -0
  219. package/dist/skills/builtin/mcp-builder/reference/evaluation.md +602 -0
  220. package/dist/skills/builtin/mcp-builder/reference/mcp_best_practices.md +249 -0
  221. package/dist/skills/builtin/mcp-builder/reference/node_mcp_server.md +970 -0
  222. package/dist/skills/builtin/mcp-builder/reference/python_mcp_server.md +719 -0
  223. package/dist/skills/builtin/mcp-builder/scripts/connections.py +151 -0
  224. package/dist/skills/builtin/mcp-builder/scripts/evaluation.py +373 -0
  225. package/dist/skills/builtin/mcp-builder/scripts/example_evaluation.xml +22 -0
  226. package/dist/skills/builtin/mcp-builder/scripts/requirements.txt +2 -0
  227. package/dist/skills/builtin/pdf/LICENSE.txt +30 -0
  228. package/dist/skills/builtin/pdf/SKILL.md +314 -0
  229. package/dist/skills/builtin/pdf/forms.md +294 -0
  230. package/dist/skills/builtin/pdf/reference.md +612 -0
  231. package/dist/skills/builtin/pdf/scripts/check_bounding_boxes.py +65 -0
  232. package/dist/skills/builtin/pdf/scripts/check_fillable_fields.py +11 -0
  233. package/dist/skills/builtin/pdf/scripts/convert_pdf_to_images.py +33 -0
  234. package/dist/skills/builtin/pdf/scripts/create_validation_image.py +37 -0
  235. package/dist/skills/builtin/pdf/scripts/extract_form_field_info.py +122 -0
  236. package/dist/skills/builtin/pdf/scripts/extract_form_structure.py +115 -0
  237. package/dist/skills/builtin/pdf/scripts/fill_fillable_fields.py +98 -0
  238. package/dist/skills/builtin/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
  239. package/dist/skills/builtin/pptx/LICENSE.txt +30 -0
  240. package/dist/skills/builtin/pptx/SKILL.md +232 -0
  241. package/dist/skills/builtin/pptx/editing.md +205 -0
  242. package/dist/skills/builtin/pptx/pptxgenjs.md +420 -0
  243. package/dist/skills/builtin/pptx/scripts/__init__.py +0 -0
  244. package/dist/skills/builtin/pptx/scripts/add_slide.py +195 -0
  245. package/dist/skills/builtin/pptx/scripts/clean.py +286 -0
  246. package/dist/skills/builtin/pptx/scripts/office/helpers/__init__.py +0 -0
  247. package/dist/skills/builtin/pptx/scripts/office/helpers/merge_runs.py +199 -0
  248. package/dist/skills/builtin/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
  249. package/dist/skills/builtin/pptx/scripts/office/pack.py +159 -0
  250. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  251. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  252. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  253. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  254. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  255. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  256. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  257. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  258. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  259. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  260. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  261. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  262. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  263. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  264. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  265. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  266. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  267. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  268. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  269. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  270. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  271. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  272. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  273. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  274. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  275. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  276. package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  277. package/dist/skills/builtin/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  278. package/dist/skills/builtin/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  279. package/dist/skills/builtin/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  280. package/dist/skills/builtin/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  281. package/dist/skills/builtin/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
  282. package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  283. package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  284. package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  285. package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  286. package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  287. package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  288. package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  289. package/dist/skills/builtin/pptx/scripts/office/soffice.py +183 -0
  290. package/dist/skills/builtin/pptx/scripts/office/unpack.py +132 -0
  291. package/dist/skills/builtin/pptx/scripts/office/validate.py +111 -0
  292. package/dist/skills/builtin/pptx/scripts/office/validators/__init__.py +15 -0
  293. package/dist/skills/builtin/pptx/scripts/office/validators/base.py +847 -0
  294. package/dist/skills/builtin/pptx/scripts/office/validators/docx.py +446 -0
  295. package/dist/skills/builtin/pptx/scripts/office/validators/pptx.py +275 -0
  296. package/dist/skills/builtin/pptx/scripts/office/validators/redlining.py +247 -0
  297. package/dist/skills/builtin/pptx/scripts/thumbnail.py +289 -0
  298. package/dist/skills/builtin/promo-video/SKILL.md +124 -0
  299. package/dist/skills/builtin/promote/SKILL.md +77 -0
  300. package/dist/skills/builtin/skill-creator/LICENSE.txt +202 -0
  301. package/dist/skills/builtin/skill-creator/SKILL.md +598 -0
  302. package/dist/skills/builtin/skill-creator/agents/analyzer.md +274 -0
  303. package/dist/skills/builtin/skill-creator/agents/comparator.md +202 -0
  304. package/dist/skills/builtin/skill-creator/agents/grader.md +223 -0
  305. package/dist/skills/builtin/skill-creator/assets/eval_review.html +146 -0
  306. package/dist/skills/builtin/skill-creator/eval-viewer/generate_review.py +471 -0
  307. package/dist/skills/builtin/skill-creator/eval-viewer/viewer.html +1325 -0
  308. package/dist/skills/builtin/skill-creator/references/schemas.md +430 -0
  309. package/dist/skills/builtin/skill-creator/scripts/__init__.py +0 -0
  310. package/dist/skills/builtin/skill-creator/scripts/aggregate_benchmark.py +401 -0
  311. package/dist/skills/builtin/skill-creator/scripts/generate_report.py +326 -0
  312. package/dist/skills/builtin/skill-creator/scripts/improve_description.py +248 -0
  313. package/dist/skills/builtin/skill-creator/scripts/package_skill.py +136 -0
  314. package/dist/skills/builtin/skill-creator/scripts/quick_validate.py +103 -0
  315. package/dist/skills/builtin/skill-creator/scripts/run_eval.py +310 -0
  316. package/dist/skills/builtin/skill-creator/scripts/run_loop.py +332 -0
  317. package/dist/skills/builtin/skill-creator/scripts/utils.py +47 -0
  318. package/dist/skills/builtin/slack-gif-creator/LICENSE.txt +202 -0
  319. package/dist/skills/builtin/slack-gif-creator/SKILL.md +254 -0
  320. package/dist/skills/builtin/slack-gif-creator/core/easing.py +234 -0
  321. package/dist/skills/builtin/slack-gif-creator/core/frame_composer.py +176 -0
  322. package/dist/skills/builtin/slack-gif-creator/core/gif_builder.py +269 -0
  323. package/dist/skills/builtin/slack-gif-creator/core/validators.py +136 -0
  324. package/dist/skills/builtin/slack-gif-creator/requirements.txt +4 -0
  325. package/dist/skills/builtin/sync-version/SKILL.md +39 -0
  326. package/dist/skills/builtin/theme-factory/LICENSE.txt +202 -0
  327. package/dist/skills/builtin/theme-factory/SKILL.md +59 -0
  328. package/dist/skills/builtin/theme-factory/theme-showcase.pdf +0 -0
  329. package/dist/skills/builtin/theme-factory/themes/arctic-frost.md +19 -0
  330. package/dist/skills/builtin/theme-factory/themes/botanical-garden.md +19 -0
  331. package/dist/skills/builtin/theme-factory/themes/desert-rose.md +19 -0
  332. package/dist/skills/builtin/theme-factory/themes/forest-canopy.md +19 -0
  333. package/dist/skills/builtin/theme-factory/themes/golden-hour.md +19 -0
  334. package/dist/skills/builtin/theme-factory/themes/midnight-galaxy.md +19 -0
  335. package/dist/skills/builtin/theme-factory/themes/modern-minimalist.md +19 -0
  336. package/dist/skills/builtin/theme-factory/themes/ocean-depths.md +19 -0
  337. package/dist/skills/builtin/theme-factory/themes/sunset-boulevard.md +19 -0
  338. package/dist/skills/builtin/theme-factory/themes/tech-innovation.md +19 -0
  339. package/dist/skills/builtin/web-artifacts-builder/LICENSE.txt +202 -0
  340. package/dist/skills/builtin/web-artifacts-builder/SKILL.md +74 -0
  341. package/dist/skills/builtin/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
  342. package/dist/skills/builtin/web-artifacts-builder/scripts/init-artifact.sh +322 -0
  343. package/dist/skills/builtin/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
  344. package/dist/skills/builtin/webapp-testing/LICENSE.txt +202 -0
  345. package/dist/skills/builtin/webapp-testing/SKILL.md +96 -0
  346. package/dist/skills/builtin/webapp-testing/examples/console_logging.py +35 -0
  347. package/dist/skills/builtin/webapp-testing/examples/element_discovery.py +40 -0
  348. package/dist/skills/builtin/webapp-testing/examples/static_html_automation.py +33 -0
  349. package/dist/skills/builtin/webapp-testing/scripts/with_server.py +106 -0
  350. package/dist/skills/builtin/xlsx/LICENSE.txt +30 -0
  351. package/dist/skills/builtin/xlsx/SKILL.md +292 -0
  352. package/dist/skills/builtin/xlsx/scripts/office/helpers/__init__.py +0 -0
  353. package/dist/skills/builtin/xlsx/scripts/office/helpers/merge_runs.py +199 -0
  354. package/dist/skills/builtin/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
  355. package/dist/skills/builtin/xlsx/scripts/office/pack.py +159 -0
  356. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  357. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  358. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  359. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  360. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  361. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  362. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  363. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  364. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  365. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  366. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  367. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  368. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  369. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  370. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  371. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  372. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  373. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  374. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  375. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  376. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  377. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  378. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  379. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  380. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  381. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  382. package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  383. package/dist/skills/builtin/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  384. package/dist/skills/builtin/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  385. package/dist/skills/builtin/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  386. package/dist/skills/builtin/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  387. package/dist/skills/builtin/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
  388. package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  389. package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  390. package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  391. package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  392. package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  393. package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  394. package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  395. package/dist/skills/builtin/xlsx/scripts/office/soffice.py +183 -0
  396. package/dist/skills/builtin/xlsx/scripts/office/unpack.py +132 -0
  397. package/dist/skills/builtin/xlsx/scripts/office/validate.py +111 -0
  398. package/dist/skills/builtin/xlsx/scripts/office/validators/__init__.py +15 -0
  399. package/dist/skills/builtin/xlsx/scripts/office/validators/base.py +847 -0
  400. package/dist/skills/builtin/xlsx/scripts/office/validators/docx.py +446 -0
  401. package/dist/skills/builtin/xlsx/scripts/office/validators/pptx.py +275 -0
  402. package/dist/skills/builtin/xlsx/scripts/office/validators/redlining.py +247 -0
  403. package/dist/skills/builtin/xlsx/scripts/recalc.py +184 -0
  404. package/dist/tools/agent.d.ts +8 -0
  405. package/dist/tools/agent.d.ts.map +1 -1
  406. package/dist/tools/agent.js +66 -2
  407. package/dist/tools/agent.js.map +1 -1
  408. package/dist/tools/base.d.ts +16 -0
  409. package/dist/tools/base.d.ts.map +1 -1
  410. package/dist/tools/base.js +32 -0
  411. package/dist/tools/base.js.map +1 -1
  412. package/dist/tools/bash.d.ts.map +1 -1
  413. package/dist/tools/bash.js +8 -0
  414. package/dist/tools/bash.js.map +1 -1
  415. package/dist/tools/file.d.ts +3 -1
  416. package/dist/tools/file.d.ts.map +1 -1
  417. package/dist/tools/file.js +176 -117
  418. package/dist/tools/file.js.map +1 -1
  419. package/dist/tools/generate-design.d.ts +5 -1
  420. package/dist/tools/generate-design.d.ts.map +1 -1
  421. package/dist/tools/generate-design.js +25 -3
  422. package/dist/tools/generate-design.js.map +1 -1
  423. package/dist/tools/goal.d.ts +1 -1
  424. package/dist/tools/goal.d.ts.map +1 -1
  425. package/dist/tools/goal.js +18 -9
  426. package/dist/tools/goal.js.map +1 -1
  427. package/dist/tools/index.d.ts +7 -0
  428. package/dist/tools/index.d.ts.map +1 -1
  429. package/dist/tools/index.js +74 -5
  430. package/dist/tools/index.js.map +1 -1
  431. package/dist/tools/mcp.d.ts.map +1 -1
  432. package/dist/tools/mcp.js +5 -0
  433. package/dist/tools/mcp.js.map +1 -1
  434. package/dist/tools/memory-search.d.ts +1 -1
  435. package/dist/tools/memory-search.d.ts.map +1 -1
  436. package/dist/tools/memory-search.js +1 -1
  437. package/dist/tools/memory-search.js.map +1 -1
  438. package/dist/tools/network-agent.js +2 -1
  439. package/dist/tools/network-agent.js.map +1 -1
  440. package/dist/tools/notebook-write.d.ts.map +1 -1
  441. package/dist/tools/notebook-write.js +3 -1
  442. package/dist/tools/notebook-write.js.map +1 -1
  443. package/dist/tools/schedule.d.ts.map +1 -1
  444. package/dist/tools/schedule.js +2 -26
  445. package/dist/tools/schedule.js.map +1 -1
  446. package/dist/tools/skill.d.ts +1 -7
  447. package/dist/tools/skill.d.ts.map +1 -1
  448. package/dist/tools/skill.js +225 -61
  449. package/dist/tools/skill.js.map +1 -1
  450. package/dist/types/messages.d.ts +1 -5
  451. package/dist/types/messages.d.ts.map +1 -1
  452. package/dist/web/server/api-manager.d.ts +9 -4
  453. package/dist/web/server/api-manager.d.ts.map +1 -1
  454. package/dist/web/server/api-manager.js +173 -63
  455. package/dist/web/server/api-manager.js.map +1 -1
  456. package/dist/web/server/app-manager.d.ts +71 -0
  457. package/dist/web/server/app-manager.d.ts.map +1 -0
  458. package/dist/web/server/app-manager.js +364 -0
  459. package/dist/web/server/app-manager.js.map +1 -0
  460. package/dist/web/server/channels/bridge.d.ts.map +1 -1
  461. package/dist/web/server/channels/bridge.js +2 -1
  462. package/dist/web/server/channels/bridge.js.map +1 -1
  463. package/dist/web/server/codex-auth-manager.d.ts +43 -0
  464. package/dist/web/server/codex-auth-manager.d.ts.map +1 -0
  465. package/dist/web/server/codex-auth-manager.js +429 -0
  466. package/dist/web/server/codex-auth-manager.js.map +1 -0
  467. package/dist/web/server/conversation.d.ts +34 -5
  468. package/dist/web/server/conversation.d.ts.map +1 -1
  469. package/dist/web/server/conversation.js +435 -142
  470. package/dist/web/server/conversation.js.map +1 -1
  471. package/dist/web/server/image-attachments.d.ts +23 -0
  472. package/dist/web/server/image-attachments.d.ts.map +1 -0
  473. package/dist/web/server/image-attachments.js +93 -0
  474. package/dist/web/server/image-attachments.js.map +1 -0
  475. package/dist/web/server/index.d.ts.map +1 -1
  476. package/dist/web/server/index.js +28 -0
  477. package/dist/web/server/index.js.map +1 -1
  478. package/dist/web/server/routes/__tests__/app-api.test.d.ts +5 -0
  479. package/dist/web/server/routes/__tests__/app-api.test.d.ts.map +1 -0
  480. package/dist/web/server/routes/__tests__/app-api.test.js +48 -0
  481. package/dist/web/server/routes/__tests__/app-api.test.js.map +1 -0
  482. package/dist/web/server/routes/__tests__/tunnel-api.test.d.ts +2 -0
  483. package/dist/web/server/routes/__tests__/tunnel-api.test.d.ts.map +1 -0
  484. package/dist/web/server/routes/__tests__/tunnel-api.test.js +96 -0
  485. package/dist/web/server/routes/__tests__/tunnel-api.test.js.map +1 -0
  486. package/dist/web/server/routes/ai-editor.d.ts.map +1 -1
  487. package/dist/web/server/routes/ai-editor.js +9 -45
  488. package/dist/web/server/routes/ai-editor.js.map +1 -1
  489. package/dist/web/server/routes/ai-hover.d.ts.map +1 -1
  490. package/dist/web/server/routes/ai-hover.js +6 -23
  491. package/dist/web/server/routes/ai-hover.js.map +1 -1
  492. package/dist/web/server/routes/api.d.ts.map +1 -1
  493. package/dist/web/server/routes/api.js +27 -23
  494. package/dist/web/server/routes/api.js.map +1 -1
  495. package/dist/web/server/routes/app-api.d.ts +8 -0
  496. package/dist/web/server/routes/app-api.d.ts.map +1 -0
  497. package/dist/web/server/routes/app-api.js +191 -0
  498. package/dist/web/server/routes/app-api.js.map +1 -0
  499. package/dist/web/server/routes/auth.d.ts.map +1 -1
  500. package/dist/web/server/routes/auth.js +306 -5
  501. package/dist/web/server/routes/auth.js.map +1 -1
  502. package/dist/web/server/routes/autocomplete-api.d.ts.map +1 -1
  503. package/dist/web/server/routes/autocomplete-api.js +5 -43
  504. package/dist/web/server/routes/autocomplete-api.js.map +1 -1
  505. package/dist/web/server/routes/axon-cloud.d.ts.map +1 -1
  506. package/dist/web/server/routes/axon-cloud.js +352 -1
  507. package/dist/web/server/routes/axon-cloud.js.map +1 -1
  508. package/dist/web/server/routes/config-api.d.ts.map +1 -1
  509. package/dist/web/server/routes/config-api.js +12 -20
  510. package/dist/web/server/routes/config-api.js.map +1 -1
  511. package/dist/web/server/routes/download-proxy.d.ts.map +1 -1
  512. package/dist/web/server/routes/download-proxy.js +234 -12
  513. package/dist/web/server/routes/download-proxy.js.map +1 -1
  514. package/dist/web/server/routes/network-api.d.ts +1 -0
  515. package/dist/web/server/routes/network-api.d.ts.map +1 -1
  516. package/dist/web/server/routes/network-api.js +36 -11
  517. package/dist/web/server/routes/network-api.js.map +1 -1
  518. package/dist/web/server/routes/port-forward.d.ts.map +1 -1
  519. package/dist/web/server/routes/port-forward.js +3 -2
  520. package/dist/web/server/routes/port-forward.js.map +1 -1
  521. package/dist/web/server/routes/schedule-api.d.ts.map +1 -1
  522. package/dist/web/server/routes/schedule-api.js +5 -1
  523. package/dist/web/server/routes/schedule-api.js.map +1 -1
  524. package/dist/web/server/routes/tunnel-api.d.ts +14 -0
  525. package/dist/web/server/routes/tunnel-api.d.ts.map +1 -0
  526. package/dist/web/server/routes/tunnel-api.js +52 -0
  527. package/dist/web/server/routes/tunnel-api.js.map +1 -0
  528. package/dist/web/server/runtime/api-connection-test.d.ts +18 -0
  529. package/dist/web/server/runtime/api-connection-test.d.ts.map +1 -0
  530. package/dist/web/server/runtime/api-connection-test.js +62 -0
  531. package/dist/web/server/runtime/api-connection-test.js.map +1 -0
  532. package/dist/web/server/runtime/codex-client.d.ts +35 -0
  533. package/dist/web/server/runtime/codex-client.d.ts.map +1 -0
  534. package/dist/web/server/runtime/codex-client.js +1202 -0
  535. package/dist/web/server/runtime/codex-client.js.map +1 -0
  536. package/dist/web/server/runtime/factory.d.ts +3 -0
  537. package/dist/web/server/runtime/factory.d.ts.map +1 -0
  538. package/dist/web/server/runtime/factory.js +16 -0
  539. package/dist/web/server/runtime/factory.js.map +1 -0
  540. package/dist/web/server/runtime/runtime-model-catalog.d.ts +10 -0
  541. package/dist/web/server/runtime/runtime-model-catalog.d.ts.map +1 -0
  542. package/dist/web/server/runtime/runtime-model-catalog.js +85 -0
  543. package/dist/web/server/runtime/runtime-model-catalog.js.map +1 -0
  544. package/dist/web/server/runtime/runtime-model-list.d.ts +24 -0
  545. package/dist/web/server/runtime/runtime-model-list.d.ts.map +1 -0
  546. package/dist/web/server/runtime/runtime-model-list.js +43 -0
  547. package/dist/web/server/runtime/runtime-model-list.js.map +1 -0
  548. package/dist/web/server/runtime/runtime-selection.d.ts +17 -0
  549. package/dist/web/server/runtime/runtime-selection.d.ts.map +1 -0
  550. package/dist/web/server/runtime/runtime-selection.js +35 -0
  551. package/dist/web/server/runtime/runtime-selection.js.map +1 -0
  552. package/dist/web/server/runtime/tool-input-normalizer.d.ts +3 -0
  553. package/dist/web/server/runtime/tool-input-normalizer.d.ts.map +1 -0
  554. package/dist/web/server/runtime/tool-input-normalizer.js +52 -0
  555. package/dist/web/server/runtime/tool-input-normalizer.js.map +1 -0
  556. package/dist/web/server/runtime/types.d.ts +102 -0
  557. package/dist/web/server/runtime/types.d.ts.map +1 -0
  558. package/dist/web/server/runtime/types.js +2 -0
  559. package/dist/web/server/runtime/types.js.map +1 -0
  560. package/dist/web/server/runtime/utility-client.d.ts +5 -0
  561. package/dist/web/server/runtime/utility-client.d.ts.map +1 -0
  562. package/dist/web/server/runtime/utility-client.js +68 -0
  563. package/dist/web/server/runtime/utility-client.js.map +1 -0
  564. package/dist/web/server/services/axon-cloud-service.d.ts +24 -0
  565. package/dist/web/server/services/axon-cloud-service.d.ts.map +1 -1
  566. package/dist/web/server/services/axon-cloud-service.js +93 -0
  567. package/dist/web/server/services/axon-cloud-service.js.map +1 -1
  568. package/dist/web/server/services/config-service.d.ts +8 -2
  569. package/dist/web/server/services/config-service.d.ts.map +1 -1
  570. package/dist/web/server/services/config-service.js +51 -0
  571. package/dist/web/server/services/config-service.js.map +1 -1
  572. package/dist/web/server/services/gemini-image-service.d.ts +20 -1
  573. package/dist/web/server/services/gemini-image-service.d.ts.map +1 -1
  574. package/dist/web/server/services/gemini-image-service.js +121 -13
  575. package/dist/web/server/services/gemini-image-service.js.map +1 -1
  576. package/dist/web/server/session-manager.d.ts +10 -0
  577. package/dist/web/server/session-manager.d.ts.map +1 -1
  578. package/dist/web/server/session-manager.js +39 -0
  579. package/dist/web/server/session-manager.js.map +1 -1
  580. package/dist/web/server/slash-commands.d.ts.map +1 -1
  581. package/dist/web/server/slash-commands.js +127 -25
  582. package/dist/web/server/slash-commands.js.map +1 -1
  583. package/dist/web/server/task-manager.d.ts +4 -15
  584. package/dist/web/server/task-manager.d.ts.map +1 -1
  585. package/dist/web/server/task-manager.js +11 -4
  586. package/dist/web/server/task-manager.js.map +1 -1
  587. package/dist/web/server/tunnel.d.ts +47 -0
  588. package/dist/web/server/tunnel.d.ts.map +1 -0
  589. package/dist/web/server/tunnel.js +165 -0
  590. package/dist/web/server/tunnel.js.map +1 -0
  591. package/dist/web/server/user-interaction.d.ts +10 -0
  592. package/dist/web/server/user-interaction.d.ts.map +1 -1
  593. package/dist/web/server/user-interaction.js +28 -0
  594. package/dist/web/server/user-interaction.js.map +1 -1
  595. package/dist/web/server/web-auth.d.ts +35 -3
  596. package/dist/web/server/web-auth.d.ts.map +1 -1
  597. package/dist/web/server/web-auth.js +302 -29
  598. package/dist/web/server/web-auth.js.map +1 -1
  599. package/dist/web/server/web-scheduler.d.ts.map +1 -1
  600. package/dist/web/server/web-scheduler.js +9 -0
  601. package/dist/web/server/web-scheduler.js.map +1 -1
  602. package/dist/web/server/websocket-git-handlers.d.ts.map +1 -1
  603. package/dist/web/server/websocket-git-handlers.js +5 -29
  604. package/dist/web/server/websocket-git-handlers.js.map +1 -1
  605. package/dist/web/server/websocket.d.ts.map +1 -1
  606. package/dist/web/server/websocket.js +246 -70
  607. package/dist/web/server/websocket.js.map +1 -1
  608. package/dist/web/shared/auth-summary.d.ts +28 -0
  609. package/dist/web/shared/auth-summary.d.ts.map +1 -0
  610. package/dist/web/shared/auth-summary.js +56 -0
  611. package/dist/web/shared/auth-summary.js.map +1 -0
  612. package/dist/web/shared/model-catalog.d.ts +31 -0
  613. package/dist/web/shared/model-catalog.d.ts.map +1 -0
  614. package/dist/web/shared/model-catalog.js +365 -0
  615. package/dist/web/shared/model-catalog.js.map +1 -0
  616. package/dist/web/shared/model-preferences.d.ts +5 -0
  617. package/dist/web/shared/model-preferences.d.ts.map +1 -0
  618. package/dist/web/shared/model-preferences.js +13 -0
  619. package/dist/web/shared/model-preferences.js.map +1 -0
  620. package/dist/web/shared/runtime-capabilities.d.ts +37 -0
  621. package/dist/web/shared/runtime-capabilities.d.ts.map +1 -0
  622. package/dist/web/shared/runtime-capabilities.js +101 -0
  623. package/dist/web/shared/runtime-capabilities.js.map +1 -0
  624. package/dist/web/shared/setup-runtime.d.ts +50 -0
  625. package/dist/web/shared/setup-runtime.d.ts.map +1 -0
  626. package/dist/web/shared/setup-runtime.js +214 -0
  627. package/dist/web/shared/setup-runtime.js.map +1 -0
  628. package/dist/web/shared/thinking-config.d.ts +20 -0
  629. package/dist/web/shared/thinking-config.d.ts.map +1 -0
  630. package/dist/web/shared/thinking-config.js +104 -0
  631. package/dist/web/shared/thinking-config.js.map +1 -0
  632. package/dist/web/shared/types.d.ts +30 -2
  633. package/dist/web/shared/types.d.ts.map +1 -1
  634. package/dist/web/shared/types.js.map +1 -1
  635. package/electron/main.cjs +15 -3
  636. package/package.json +6 -2
  637. package/src/web/client/dist/assets/index-B2M5Nr-5.js +736 -0
  638. package/src/web/client/dist/assets/index-COEqamS-.css +32 -0
  639. package/src/web/client/dist/icons/icon-192.png +0 -0
  640. package/src/web/client/dist/icons/icon-512.png +0 -0
  641. package/src/web/client/dist/index.html +31 -0
  642. package/src/web/client/dist/logo.png +0 -0
  643. package/src/web/client/dist/manifest.webmanifest +25 -0
  644. package/src/web/client/dist/sw.js +78 -0
@@ -0,0 +1,1202 @@
1
+ const DEFAULT_CODEX_BASE_URL = 'https://chatgpt.com/backend-api/codex';
2
+ const DEFAULT_CODEX_INSTRUCTIONS = 'You are Axon, a coding assistant helping inside a web IDE.';
3
+ function safeJsonParse(value, fallback) {
4
+ if (!value)
5
+ return fallback;
6
+ try {
7
+ return JSON.parse(value);
8
+ }
9
+ catch {
10
+ return fallback;
11
+ }
12
+ }
13
+ function coerceTextContent(content) {
14
+ if (typeof content === 'string')
15
+ return content;
16
+ if (!Array.isArray(content))
17
+ return '';
18
+ return content
19
+ .map(part => {
20
+ if (!part || typeof part !== 'object')
21
+ return '';
22
+ const text = part.text;
23
+ if (typeof text === 'string')
24
+ return text;
25
+ return '';
26
+ })
27
+ .filter(Boolean)
28
+ .join('\n');
29
+ }
30
+ function extractTextFromOutput(output) {
31
+ if (!Array.isArray(output))
32
+ return '';
33
+ return output
34
+ .flatMap(item => Array.isArray(item.content) ? item.content : [])
35
+ .map(part => part.text || '')
36
+ .join('');
37
+ }
38
+ function getResponseToolCallId(item) {
39
+ return item.call_id || item.id || `call_${Date.now()}`;
40
+ }
41
+ function collectResponseToolCallAliases(item) {
42
+ const aliases = [item.call_id, item.id]
43
+ .filter((value) => typeof value === 'string' && value.trim().length > 0);
44
+ return Array.from(new Set(aliases));
45
+ }
46
+ function resolveCanonicalToolCallId(replayState, identifiers, fallback) {
47
+ const aliases = Array.from(new Set(identifiers.filter((value) => typeof value === 'string' && value.trim().length > 0)));
48
+ if (replayState) {
49
+ for (const alias of aliases) {
50
+ const canonical = replayState.toolCallAliases.get(alias);
51
+ if (canonical) {
52
+ for (const candidate of aliases) {
53
+ replayState.toolCallAliases.set(candidate, canonical);
54
+ }
55
+ return canonical;
56
+ }
57
+ }
58
+ }
59
+ const canonical = fallback || aliases[0] || `call_${Date.now()}`;
60
+ if (replayState) {
61
+ replayState.toolCallAliases.set(canonical, canonical);
62
+ for (const alias of aliases) {
63
+ replayState.toolCallAliases.set(alias, canonical);
64
+ }
65
+ }
66
+ return canonical;
67
+ }
68
+ function getReasoningEventKey(payload) {
69
+ const itemId = typeof payload.item_id === 'string' && payload.item_id
70
+ ? payload.item_id
71
+ : typeof payload.item?.id === 'string' && payload.item.id
72
+ ? payload.item.id
73
+ : `reasoning-${typeof payload.output_index === 'number' ? payload.output_index : 0}`;
74
+ const partIndex = typeof payload.summary_index === 'number'
75
+ ? payload.summary_index
76
+ : typeof payload.content_index === 'number'
77
+ ? payload.content_index
78
+ : 0;
79
+ return `${itemId}:${partIndex}`;
80
+ }
81
+ function extractReasoningText(value) {
82
+ if (typeof value === 'string') {
83
+ return value;
84
+ }
85
+ if (!value || typeof value !== 'object') {
86
+ return '';
87
+ }
88
+ if (typeof value.text === 'string') {
89
+ return value.text;
90
+ }
91
+ const part = value.part;
92
+ if (part && typeof part.text === 'string') {
93
+ return part.text;
94
+ }
95
+ if (Array.isArray(value.summary)) {
96
+ return value.summary
97
+ .map(part => typeof part.text === 'string' ? part.text : '')
98
+ .join('');
99
+ }
100
+ return '';
101
+ }
102
+ function recordReasoningText(replayState, key, text, mode) {
103
+ if (!text) {
104
+ return undefined;
105
+ }
106
+ const previous = replayState.reasoningByKey.get(key) || '';
107
+ if (mode === 'delta') {
108
+ replayState.reasoningByKey.set(key, previous + text);
109
+ replayState.sawThinkingDelta = true;
110
+ return text;
111
+ }
112
+ if (!previous) {
113
+ replayState.reasoningByKey.set(key, text);
114
+ replayState.sawThinkingDelta = true;
115
+ return text;
116
+ }
117
+ if (text === previous) {
118
+ return undefined;
119
+ }
120
+ if (text.startsWith(previous)) {
121
+ const delta = text.slice(previous.length);
122
+ if (!delta) {
123
+ return undefined;
124
+ }
125
+ replayState.reasoningByKey.set(key, text);
126
+ replayState.sawThinkingDelta = true;
127
+ return delta;
128
+ }
129
+ replayState.reasoningByKey.set(key, text);
130
+ replayState.sawThinkingDelta = true;
131
+ return text;
132
+ }
133
+ function isCodexCompatibleModel(model) {
134
+ if (!model)
135
+ return false;
136
+ const normalized = model.trim();
137
+ if (!normalized)
138
+ return false;
139
+ return /^(gpt-|o\d(?:$|[-_])|codex)/i.test(normalized) || normalized.toLowerCase().includes('codex');
140
+ }
141
+ function getMessageTextContentType(role) {
142
+ return role === 'assistant' ? 'output_text' : 'input_text';
143
+ }
144
+ function isImageBlock(block) {
145
+ return !!block
146
+ && typeof block === 'object'
147
+ && block.type === 'image'
148
+ && !!block.source?.data;
149
+ }
150
+ function isThinkingBlock(block) {
151
+ return !!block
152
+ && typeof block === 'object'
153
+ && block.type === 'thinking'
154
+ && typeof block.thinking === 'string';
155
+ }
156
+ function parseResponsesApiResult(value) {
157
+ const trimmed = value?.trim();
158
+ if (!trimmed) {
159
+ return null;
160
+ }
161
+ try {
162
+ return JSON.parse(trimmed);
163
+ }
164
+ catch {
165
+ return null;
166
+ }
167
+ }
168
+ function collapseWhitespace(value) {
169
+ return value.replace(/\s+/g, ' ').trim();
170
+ }
171
+ function truncateForError(value, maxLength = 240) {
172
+ if (value.length <= maxLength) {
173
+ return value;
174
+ }
175
+ return `${value.slice(0, maxLength - 3)}...`;
176
+ }
177
+ function looksLikeHtmlPayload(value) {
178
+ const trimmed = value?.trim().toLowerCase() || '';
179
+ return trimmed.startsWith('<!doctype html') || trimmed.startsWith('<html');
180
+ }
181
+ function extractErrorDetail(value) {
182
+ const trimmed = value?.trim();
183
+ if (!trimmed) {
184
+ return undefined;
185
+ }
186
+ const parsed = safeJsonParse(trimmed, null);
187
+ if (parsed && typeof parsed === 'object') {
188
+ if (typeof parsed.message === 'string' && parsed.message.trim()) {
189
+ return collapseWhitespace(parsed.message);
190
+ }
191
+ const nestedError = parsed.error;
192
+ if (typeof nestedError === 'string' && nestedError.trim()) {
193
+ return collapseWhitespace(nestedError);
194
+ }
195
+ if (nestedError && typeof nestedError === 'object') {
196
+ if (typeof nestedError.message === 'string' && nestedError.message.trim()) {
197
+ return collapseWhitespace(nestedError.message);
198
+ }
199
+ if (typeof nestedError.type === 'string' && nestedError.type.trim()) {
200
+ return collapseWhitespace(nestedError.type);
201
+ }
202
+ }
203
+ }
204
+ if (looksLikeHtmlPayload(trimmed)) {
205
+ const titleMatch = trimmed.match(/<title>\s*([^<]+?)\s*<\/title>/i);
206
+ if (titleMatch?.[1]) {
207
+ return collapseWhitespace(titleMatch[1]);
208
+ }
209
+ return 'upstream proxy returned an HTML error page';
210
+ }
211
+ return collapseWhitespace(trimmed);
212
+ }
213
+ function formatHttpErrorMessage(transportName, response, payload) {
214
+ const detail = extractErrorDetail(payload);
215
+ const statusParts = [];
216
+ if (response.status) {
217
+ statusParts.push(`HTTP ${response.status}`);
218
+ }
219
+ if (response.statusText) {
220
+ statusParts.push(response.statusText);
221
+ }
222
+ const statusSuffix = statusParts.length > 0 ? ` (${statusParts.join(' ')})` : '';
223
+ if (!detail) {
224
+ return `${transportName} request failed${statusSuffix}`;
225
+ }
226
+ return `${transportName} request failed${statusSuffix}: ${truncateForError(detail)}`;
227
+ }
228
+ function buildResponsesEndpoint(baseUrl) {
229
+ const normalized = baseUrl.replace(/\/+$/, '');
230
+ try {
231
+ const parsed = new URL(normalized);
232
+ const pathname = parsed.pathname.replace(/\/+$/, '');
233
+ if (pathname.endsWith('/backend-api/codex') || pathname.endsWith('/v1')) {
234
+ return `${normalized}/responses`;
235
+ }
236
+ return `${normalized}/v1/responses`;
237
+ }
238
+ catch {
239
+ if (normalized.endsWith('/backend-api/codex') || normalized.endsWith('/v1')) {
240
+ return `${normalized}/responses`;
241
+ }
242
+ return `${normalized}/v1/responses`;
243
+ }
244
+ }
245
+ function buildChatCompletionsEndpoint(baseUrl) {
246
+ const normalized = baseUrl.replace(/\/+$/, '');
247
+ try {
248
+ const parsed = new URL(normalized);
249
+ const pathname = parsed.pathname.replace(/\/+$/, '');
250
+ if (pathname.endsWith('/backend-api/codex')) {
251
+ return `${normalized}/chat/completions`;
252
+ }
253
+ if (pathname.endsWith('/v1')) {
254
+ return `${normalized}/chat/completions`;
255
+ }
256
+ return `${normalized}/v1/chat/completions`;
257
+ }
258
+ catch {
259
+ if (normalized.endsWith('/backend-api/codex') || normalized.endsWith('/v1')) {
260
+ return `${normalized}/chat/completions`;
261
+ }
262
+ return `${normalized}/v1/chat/completions`;
263
+ }
264
+ }
265
+ function isCustomResponsesEndpoint(baseUrl) {
266
+ const normalized = baseUrl.replace(/\/+$/, '');
267
+ return !/chatgpt\.com\/backend-api\/codex$/i.test(normalized);
268
+ }
269
+ function shouldFallbackToChatCompletions(response, errorText) {
270
+ const normalized = errorText?.toLowerCase() || '';
271
+ if (normalized.includes('convert_request_failed') || normalized.includes('not implemented')) {
272
+ return true;
273
+ }
274
+ const contentType = response.headers.get('content-type') || '';
275
+ const isHtmlError = /text\/html/i.test(contentType) || looksLikeHtmlPayload(errorText);
276
+ return response.status >= 500 && isHtmlError;
277
+ }
278
+ function shouldIncludeThinkingHistory(options) {
279
+ return options?.enableThinking !== false && options?.reasoningEffort !== 'none';
280
+ }
281
+ export class CodexConversationClient {
282
+ model;
283
+ authToken;
284
+ apiKey;
285
+ baseUrl;
286
+ accountId;
287
+ timeout;
288
+ customModelName;
289
+ constructor(config) {
290
+ this.model = config.model;
291
+ this.authToken = config.authToken;
292
+ this.apiKey = config.apiKey;
293
+ this.baseUrl = (config.baseUrl || DEFAULT_CODEX_BASE_URL).replace(/\/+$/, '');
294
+ this.accountId = config.accountId;
295
+ this.timeout = config.timeout || 300000;
296
+ this.customModelName = config.customModelName;
297
+ }
298
+ async createMessage(messages, tools, systemPrompt, options) {
299
+ if (this.shouldUseChatCompletionsTransport()) {
300
+ const response = await this.callChatCompletionsApi(messages, tools, systemPrompt, options, false);
301
+ return this.mapChatCompletionResponse(response);
302
+ }
303
+ const response = await this.callResponsesApi(messages, tools, systemPrompt, options, false);
304
+ const content = this.mapOutputToContentBlocks(response.output);
305
+ const hasToolUse = content.some(block => block.type === 'tool_use');
306
+ return {
307
+ content,
308
+ stopReason: hasToolUse ? 'tool_use' : 'end_turn',
309
+ usage: {
310
+ inputTokens: response.usage?.input_tokens || 0,
311
+ outputTokens: response.usage?.output_tokens || 0,
312
+ thinkingTokens: response.usage?.reasoning_tokens || 0,
313
+ },
314
+ model: response.model || this.resolveModelName(),
315
+ };
316
+ }
317
+ async *createMessageStream(messages, tools, systemPrompt, options) {
318
+ const controller = new AbortController();
319
+ const timeoutId = setTimeout(() => controller.abort(new Error('Codex request timed out')), this.timeout);
320
+ if (options?.signal) {
321
+ options.signal.addEventListener('abort', () => controller.abort(options.signal?.reason), { once: true });
322
+ }
323
+ if (this.shouldUseChatCompletionsTransport()) {
324
+ yield* this.createChatCompletionsStream(messages, tools, systemPrompt, options);
325
+ return;
326
+ }
327
+ const endpoint = buildResponsesEndpoint(this.baseUrl);
328
+ const response = await fetch(endpoint, {
329
+ method: 'POST',
330
+ headers: this.buildHeaders(),
331
+ body: JSON.stringify(this.buildRequestBody(messages, tools, systemPrompt, options, true)),
332
+ signal: controller.signal,
333
+ });
334
+ if (!response.ok) {
335
+ const text = await response.text();
336
+ if (isCustomResponsesEndpoint(this.baseUrl) && shouldFallbackToChatCompletions(response, text)) {
337
+ yield* this.createChatCompletionsStream(messages, tools, systemPrompt, options);
338
+ return;
339
+ }
340
+ clearTimeout(timeoutId);
341
+ yield { type: 'response_headers', headers: response.headers };
342
+ yield { type: 'error', error: formatHttpErrorMessage('Codex', response, text) };
343
+ return;
344
+ }
345
+ clearTimeout(timeoutId);
346
+ yield { type: 'response_headers', headers: response.headers };
347
+ const contentType = response.headers.get('content-type') || '';
348
+ if (!/text\/event-stream/i.test(contentType)) {
349
+ const text = await response.text();
350
+ const apiResponse = parseResponsesApiResult(text);
351
+ if (!apiResponse) {
352
+ yield {
353
+ type: 'error',
354
+ error: `Codex request returned a non-stream payload that could not be parsed: ${truncateForError(extractErrorDetail(text) || 'empty response')}`,
355
+ };
356
+ return;
357
+ }
358
+ yield* this.emitCompletedResponse(apiResponse);
359
+ return;
360
+ }
361
+ if (!response.body) {
362
+ yield { type: 'error', error: 'Codex response body is empty' };
363
+ return;
364
+ }
365
+ const decoder = new TextDecoder();
366
+ let buffer = '';
367
+ let activeToolCallId;
368
+ let activeToolCallName;
369
+ let completed = false;
370
+ const replayState = {
371
+ sawTextDelta: false,
372
+ sawThinkingDelta: false,
373
+ startedToolCallIds: new Set(),
374
+ completedToolCallIds: new Set(),
375
+ reasoningByKey: new Map(),
376
+ toolCallAliases: new Map(),
377
+ };
378
+ for await (const chunk of response.body) {
379
+ buffer += decoder.decode(chunk, { stream: true });
380
+ while (true) {
381
+ const boundary = buffer.indexOf('\n\n');
382
+ if (boundary === -1)
383
+ break;
384
+ const rawEvent = buffer.slice(0, boundary);
385
+ buffer = buffer.slice(boundary + 2);
386
+ const lines = rawEvent.split(/\r?\n/);
387
+ let eventType = 'message';
388
+ const dataLines = [];
389
+ for (const line of lines) {
390
+ if (line.startsWith('event:')) {
391
+ eventType = line.slice(6).trim();
392
+ }
393
+ else if (line.startsWith('data:')) {
394
+ dataLines.push(line.slice(5).trim());
395
+ }
396
+ }
397
+ const dataString = dataLines.join('\n');
398
+ if (!dataString || dataString === '[DONE]') {
399
+ continue;
400
+ }
401
+ const payload = safeJsonParse(dataString, {});
402
+ const eventName = typeof payload.type === 'string' ? payload.type : eventType;
403
+ switch (eventName) {
404
+ case 'response.output_text.delta':
405
+ if (payload.delta) {
406
+ replayState.sawTextDelta = true;
407
+ }
408
+ yield { type: 'text', text: payload.delta || '' };
409
+ break;
410
+ case 'response.reasoning_summary_text.delta':
411
+ case 'response.reasoning.delta':
412
+ case 'response.reasoning_summary.delta': {
413
+ const thinkingText = recordReasoningText(replayState, getReasoningEventKey(payload), extractReasoningText(payload.delta), 'delta');
414
+ if (thinkingText) {
415
+ yield { type: 'thinking', thinking: thinkingText };
416
+ }
417
+ break;
418
+ }
419
+ case 'response.reasoning.done':
420
+ case 'response.reasoning_summary.done':
421
+ case 'response.reasoning_summary_text.done':
422
+ case 'response.reasoning_summary_part.done': {
423
+ const thinkingText = recordReasoningText(replayState, getReasoningEventKey(payload), extractReasoningText(payload), 'snapshot');
424
+ if (thinkingText) {
425
+ yield { type: 'thinking', thinking: thinkingText };
426
+ }
427
+ break;
428
+ }
429
+ case 'response.output_item.added': {
430
+ const item = payload.item || {};
431
+ if (item.type === 'function_call') {
432
+ activeToolCallId = resolveCanonicalToolCallId(replayState, collectResponseToolCallAliases(item), getResponseToolCallId(item));
433
+ activeToolCallName = item.name;
434
+ if (!replayState.startedToolCallIds.has(activeToolCallId)) {
435
+ replayState.startedToolCallIds.add(activeToolCallId);
436
+ yield {
437
+ type: 'tool_use_start',
438
+ id: activeToolCallId,
439
+ name: activeToolCallName,
440
+ };
441
+ }
442
+ }
443
+ break;
444
+ }
445
+ case 'response.output_item.done': {
446
+ const item = payload.item || {};
447
+ if (item.type === 'reasoning' && Array.isArray(item.summary)) {
448
+ const itemId = typeof item.id === 'string' && item.id
449
+ ? item.id
450
+ : `reasoning-${typeof payload.output_index === 'number' ? payload.output_index : 0}`;
451
+ for (let index = 0; index < item.summary.length; index += 1) {
452
+ const part = item.summary[index];
453
+ const thinkingText = recordReasoningText(replayState, `${itemId}:${index}`, extractReasoningText(part), 'snapshot');
454
+ if (thinkingText) {
455
+ yield { type: 'thinking', thinking: thinkingText };
456
+ }
457
+ }
458
+ }
459
+ break;
460
+ }
461
+ case 'response.function_call_arguments.delta':
462
+ activeToolCallId = resolveCanonicalToolCallId(replayState, [payload.call_id], activeToolCallId);
463
+ yield {
464
+ type: 'tool_use_delta',
465
+ id: activeToolCallId,
466
+ input: payload.delta || '',
467
+ };
468
+ break;
469
+ case 'response.function_call_arguments.done':
470
+ activeToolCallId = resolveCanonicalToolCallId(replayState, [payload.call_id], activeToolCallId);
471
+ if (!replayState.completedToolCallIds.has(activeToolCallId)) {
472
+ replayState.completedToolCallIds.add(activeToolCallId);
473
+ yield {
474
+ type: 'tool_use_complete',
475
+ id: activeToolCallId,
476
+ input: safeJsonParse(payload.arguments, {}),
477
+ };
478
+ }
479
+ break;
480
+ case 'response.completed': {
481
+ const apiResponse = payload.response;
482
+ completed = true;
483
+ yield* this.emitCompletedResponse(apiResponse, replayState);
484
+ break;
485
+ }
486
+ case 'response.error':
487
+ yield { type: 'error', error: payload.error?.message || payload.message || 'Codex stream error' };
488
+ return;
489
+ }
490
+ }
491
+ }
492
+ const trailingText = buffer.trim();
493
+ if (!completed && trailingText) {
494
+ const apiResponse = parseResponsesApiResult(trailingText);
495
+ if (apiResponse) {
496
+ yield* this.emitCompletedResponse(apiResponse, replayState);
497
+ return;
498
+ }
499
+ }
500
+ if (!completed) {
501
+ yield {
502
+ type: 'error',
503
+ error: 'Codex stream ended without a completion event',
504
+ };
505
+ }
506
+ }
507
+ async callResponsesApi(messages, tools, systemPrompt, options, stream) {
508
+ const controller = new AbortController();
509
+ const timeoutId = setTimeout(() => controller.abort(new Error('Codex request timed out')), this.timeout);
510
+ try {
511
+ const endpoint = buildResponsesEndpoint(this.baseUrl);
512
+ const response = await fetch(endpoint, {
513
+ method: 'POST',
514
+ headers: this.buildHeaders(),
515
+ body: JSON.stringify(this.buildRequestBody(messages, tools, systemPrompt, options, stream)),
516
+ signal: controller.signal,
517
+ });
518
+ if (!response.ok) {
519
+ const text = await response.text();
520
+ if (isCustomResponsesEndpoint(this.baseUrl) && shouldFallbackToChatCompletions(response, text)) {
521
+ const fallback = await this.callChatCompletionsApi(messages, tools, systemPrompt, options, stream);
522
+ return this.mapChatCompletionApiResultToResponses(fallback);
523
+ }
524
+ throw new Error(formatHttpErrorMessage('Codex', response, text));
525
+ }
526
+ return await response.json();
527
+ }
528
+ catch (error) {
529
+ if (error instanceof Error) {
530
+ throw error;
531
+ }
532
+ throw new Error(`Codex request failed: ${String(error)}`);
533
+ }
534
+ finally {
535
+ clearTimeout(timeoutId);
536
+ }
537
+ }
538
+ async callChatCompletionsApi(messages, tools, systemPrompt, options, stream) {
539
+ const controller = new AbortController();
540
+ const timeoutId = setTimeout(() => controller.abort(new Error('OpenAI-compatible request timed out')), this.timeout);
541
+ try {
542
+ const endpoint = buildChatCompletionsEndpoint(this.baseUrl);
543
+ const response = await fetch(endpoint, {
544
+ method: 'POST',
545
+ headers: this.buildHeaders(),
546
+ body: JSON.stringify(this.buildChatCompletionsBody(messages, tools, systemPrompt, options, stream)),
547
+ signal: controller.signal,
548
+ });
549
+ if (!response.ok) {
550
+ const text = await response.text();
551
+ throw new Error(formatHttpErrorMessage('OpenAI-compatible', response, text));
552
+ }
553
+ return await response.json();
554
+ }
555
+ catch (error) {
556
+ if (error instanceof Error) {
557
+ throw error;
558
+ }
559
+ throw new Error(`OpenAI-compatible request failed: ${String(error)}`);
560
+ }
561
+ finally {
562
+ clearTimeout(timeoutId);
563
+ }
564
+ }
565
+ async *createChatCompletionsStream(messages, tools, systemPrompt, options) {
566
+ const controller = new AbortController();
567
+ const timeoutId = setTimeout(() => controller.abort(new Error('OpenAI-compatible request timed out')), this.timeout);
568
+ if (options?.signal) {
569
+ options.signal.addEventListener('abort', () => controller.abort(options.signal?.reason), { once: true });
570
+ }
571
+ const endpoint = buildChatCompletionsEndpoint(this.baseUrl);
572
+ const response = await fetch(endpoint, {
573
+ method: 'POST',
574
+ headers: this.buildHeaders(),
575
+ body: JSON.stringify(this.buildChatCompletionsBody(messages, tools, systemPrompt, options, true)),
576
+ signal: controller.signal,
577
+ });
578
+ clearTimeout(timeoutId);
579
+ yield { type: 'response_headers', headers: response.headers };
580
+ if (!response.ok) {
581
+ const text = await response.text();
582
+ yield { type: 'error', error: formatHttpErrorMessage('OpenAI-compatible', response, text) };
583
+ return;
584
+ }
585
+ if (!response.body) {
586
+ yield { type: 'error', error: 'OpenAI-compatible response body is empty' };
587
+ return;
588
+ }
589
+ const decoder = new TextDecoder();
590
+ let buffer = '';
591
+ let finishReason = null;
592
+ let usage;
593
+ const toolCalls = new Map();
594
+ const toolCallAliases = new Map();
595
+ let generatedToolCallCounter = 0;
596
+ const resolveToolCall = (toolCall) => {
597
+ const rawId = typeof toolCall.id === 'string' && toolCall.id.trim()
598
+ ? toolCall.id
599
+ : undefined;
600
+ const explicitIndex = typeof toolCall.index === 'number'
601
+ ? toolCall.index
602
+ : undefined;
603
+ if (rawId) {
604
+ const aliasedIndex = toolCallAliases.get(rawId);
605
+ if (aliasedIndex != null) {
606
+ return toolCalls.get(aliasedIndex) || null;
607
+ }
608
+ for (const candidate of toolCalls.values()) {
609
+ if (candidate.id === rawId) {
610
+ toolCallAliases.set(rawId, candidate.index);
611
+ return candidate;
612
+ }
613
+ }
614
+ }
615
+ if (explicitIndex != null) {
616
+ return toolCalls.get(explicitIndex) || null;
617
+ }
618
+ return null;
619
+ };
620
+ const appendToolArguments = (entry, nextChunk) => {
621
+ if (!nextChunk) {
622
+ return undefined;
623
+ }
624
+ if (!entry.arguments) {
625
+ entry.arguments = nextChunk;
626
+ return nextChunk;
627
+ }
628
+ if (nextChunk === entry.arguments || entry.arguments.endsWith(nextChunk)) {
629
+ return undefined;
630
+ }
631
+ if (nextChunk.startsWith(entry.arguments)) {
632
+ const delta = nextChunk.slice(entry.arguments.length);
633
+ if (!delta) {
634
+ return undefined;
635
+ }
636
+ entry.arguments = nextChunk;
637
+ return delta;
638
+ }
639
+ entry.arguments += nextChunk;
640
+ return nextChunk;
641
+ };
642
+ for await (const chunk of response.body) {
643
+ buffer += decoder.decode(chunk, { stream: true });
644
+ const lines = buffer.split(/\r?\n/);
645
+ buffer = lines.pop() || '';
646
+ for (const line of lines) {
647
+ if (!line.startsWith('data:')) {
648
+ continue;
649
+ }
650
+ const data = line.slice(5).trim();
651
+ if (!data || data === '[DONE]') {
652
+ continue;
653
+ }
654
+ const payload = safeJsonParse(data, {});
655
+ const choice = payload.choices?.[0];
656
+ if (payload.usage) {
657
+ usage = payload.usage;
658
+ }
659
+ if (!choice) {
660
+ continue;
661
+ }
662
+ const delta = choice.delta || {};
663
+ const reasoning = delta.reasoning_content;
664
+ if (reasoning) {
665
+ yield { type: 'thinking', thinking: reasoning };
666
+ }
667
+ if (typeof delta.content === 'string' && delta.content) {
668
+ yield { type: 'text', text: delta.content };
669
+ }
670
+ for (const toolCall of delta.tool_calls || []) {
671
+ const rawId = typeof toolCall.id === 'string' && toolCall.id.trim()
672
+ ? toolCall.id
673
+ : undefined;
674
+ const explicitIndex = typeof toolCall.index === 'number'
675
+ ? toolCall.index
676
+ : undefined;
677
+ const existing = resolveToolCall(toolCall);
678
+ if (!existing) {
679
+ const nextIndex = explicitIndex ?? generatedToolCallCounter++;
680
+ const next = {
681
+ id: rawId || `call_${Date.now()}_${nextIndex}`,
682
+ name: toolCall.function?.name || 'unknown_tool',
683
+ arguments: '',
684
+ index: nextIndex,
685
+ };
686
+ toolCalls.set(nextIndex, next);
687
+ if (rawId) {
688
+ toolCallAliases.set(rawId, nextIndex);
689
+ }
690
+ yield {
691
+ type: 'tool_use_start',
692
+ id: next.id,
693
+ name: next.name,
694
+ };
695
+ const initialDelta = appendToolArguments(next, toolCall.function?.arguments);
696
+ if (initialDelta) {
697
+ yield {
698
+ type: 'tool_use_delta',
699
+ id: next.id,
700
+ input: initialDelta,
701
+ };
702
+ }
703
+ continue;
704
+ }
705
+ if (rawId) {
706
+ toolCallAliases.set(rawId, existing.index);
707
+ }
708
+ if (toolCall.function?.name && existing.name === 'unknown_tool') {
709
+ existing.name = toolCall.function.name;
710
+ }
711
+ const deltaChunk = appendToolArguments(existing, toolCall.function?.arguments);
712
+ if (deltaChunk) {
713
+ yield {
714
+ type: 'tool_use_delta',
715
+ id: existing.id,
716
+ input: deltaChunk,
717
+ };
718
+ }
719
+ }
720
+ if (choice.finish_reason) {
721
+ finishReason = choice.finish_reason;
722
+ }
723
+ }
724
+ }
725
+ for (const toolCall of toolCalls.values()) {
726
+ yield {
727
+ type: 'tool_use_complete',
728
+ id: toolCall.id,
729
+ input: safeJsonParse(toolCall.arguments, {}),
730
+ };
731
+ }
732
+ yield {
733
+ type: 'usage',
734
+ usage: {
735
+ inputTokens: usage?.prompt_tokens || 0,
736
+ outputTokens: usage?.completion_tokens || 0,
737
+ thinkingTokens: usage?.completion_tokens_details?.reasoning_tokens || 0,
738
+ },
739
+ };
740
+ yield {
741
+ type: 'stop',
742
+ stopReason: finishReason === 'tool_calls' ? 'tool_use' : finishReason === 'length' ? 'max_tokens' : 'end_turn',
743
+ };
744
+ }
745
+ buildChatCompletionsBody(messages, tools, systemPrompt, options, stream) {
746
+ const body = {
747
+ model: this.resolveModelName(),
748
+ messages: this.convertMessagesToChatCompletions(messages, systemPrompt, shouldIncludeThinkingHistory(options)),
749
+ stream,
750
+ };
751
+ if (stream) {
752
+ body.stream_options = { include_usage: true };
753
+ }
754
+ if (tools && tools.length > 0) {
755
+ body.tools = tools.map(tool => ({
756
+ type: 'function',
757
+ function: {
758
+ name: tool.name,
759
+ description: tool.description,
760
+ parameters: tool.inputSchema,
761
+ },
762
+ }));
763
+ }
764
+ if (options?.toolChoice) {
765
+ if (options.toolChoice.type === 'tool') {
766
+ body.tool_choice = {
767
+ type: 'function',
768
+ function: { name: options.toolChoice.name },
769
+ };
770
+ }
771
+ else {
772
+ body.tool_choice = options.toolChoice.type;
773
+ }
774
+ }
775
+ return body;
776
+ }
777
+ convertMessagesToChatCompletions(messages, systemPrompt, includeThinkingHistory = true) {
778
+ const openAiMessages = [];
779
+ if (systemPrompt?.trim()) {
780
+ openAiMessages.push({
781
+ role: 'system',
782
+ content: systemPrompt.trim(),
783
+ });
784
+ }
785
+ for (const message of messages) {
786
+ const contentBlocks = typeof message.content === 'string'
787
+ ? [{ type: 'text', text: message.content }]
788
+ : message.content;
789
+ if (!Array.isArray(contentBlocks)) {
790
+ continue;
791
+ }
792
+ if (message.role === 'assistant') {
793
+ const textParts = [];
794
+ const toolCalls = [];
795
+ const reasoningParts = [];
796
+ for (const block of contentBlocks) {
797
+ if (block.type === 'text' && block.text) {
798
+ textParts.push(block.text);
799
+ continue;
800
+ }
801
+ if (includeThinkingHistory && isThinkingBlock(block)) {
802
+ const normalizedThinking = block.thinking.trim();
803
+ if (normalizedThinking) {
804
+ reasoningParts.push(normalizedThinking);
805
+ }
806
+ continue;
807
+ }
808
+ if (block.type === 'tool_use') {
809
+ const toolUse = block;
810
+ toolCalls.push({
811
+ id: toolUse.id,
812
+ type: 'function',
813
+ function: {
814
+ name: toolUse.name,
815
+ arguments: JSON.stringify(toolUse.input || {}),
816
+ },
817
+ });
818
+ }
819
+ }
820
+ const assistantMessage = {
821
+ role: 'assistant',
822
+ content: textParts.length > 0 ? textParts.join('') : null,
823
+ ...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}),
824
+ };
825
+ const reasoningContent = reasoningParts.join('\n').trim();
826
+ if (reasoningContent) {
827
+ assistantMessage.reasoning_content = reasoningContent;
828
+ }
829
+ else if (includeThinkingHistory && toolCalls.length > 0) {
830
+ // 一些 OpenAI-compatible 网关在 assistant tool_calls 历史里强制要求该字段存在,
831
+ // 即使当前无法恢复完整 reasoning trace,也至少补空字符串避免恢复会话时报错。
832
+ assistantMessage.reasoning_content = '';
833
+ }
834
+ openAiMessages.push(assistantMessage);
835
+ continue;
836
+ }
837
+ const userTextParts = [];
838
+ const userVisionParts = [];
839
+ const toolResults = [];
840
+ for (const block of contentBlocks) {
841
+ if (block.type === 'text' && block.text) {
842
+ userTextParts.push(block.text);
843
+ continue;
844
+ }
845
+ if (isImageBlock(block)) {
846
+ userVisionParts.push({
847
+ type: 'image_url',
848
+ image_url: {
849
+ url: `data:${block.source.media_type};base64,${block.source.data}`,
850
+ },
851
+ });
852
+ continue;
853
+ }
854
+ if (block.type === 'tool_result') {
855
+ const toolResult = block;
856
+ toolResults.push({
857
+ tool_call_id: toolResult.tool_use_id,
858
+ content: coerceTextContent(toolResult.content),
859
+ });
860
+ }
861
+ }
862
+ for (const toolResult of toolResults) {
863
+ openAiMessages.push({
864
+ role: 'tool',
865
+ tool_call_id: toolResult.tool_call_id,
866
+ content: toolResult.content,
867
+ });
868
+ }
869
+ if (userTextParts.length > 0 || userVisionParts.length > 0) {
870
+ if (userVisionParts.length > 0) {
871
+ const content = [];
872
+ if (userTextParts.length > 0) {
873
+ content.push({
874
+ type: 'text',
875
+ text: userTextParts.join('\n'),
876
+ });
877
+ }
878
+ content.push(...userVisionParts);
879
+ openAiMessages.push({
880
+ role: 'user',
881
+ content,
882
+ });
883
+ }
884
+ else {
885
+ openAiMessages.push({
886
+ role: 'user',
887
+ content: userTextParts.join('\n'),
888
+ });
889
+ }
890
+ }
891
+ }
892
+ return openAiMessages;
893
+ }
894
+ mapChatCompletionResponse(response) {
895
+ const choice = response.choices?.[0];
896
+ const message = choice?.message || {};
897
+ const content = [];
898
+ if (message.reasoning_content) {
899
+ content.push({ type: 'thinking', thinking: message.reasoning_content });
900
+ }
901
+ for (const toolCall of message.tool_calls || []) {
902
+ content.push({
903
+ type: 'tool_use',
904
+ id: toolCall.id || `call_${Date.now()}`,
905
+ name: toolCall.function?.name || 'unknown_tool',
906
+ input: safeJsonParse(toolCall.function?.arguments, {}),
907
+ });
908
+ }
909
+ if (typeof message.content === 'string' && message.content) {
910
+ content.push({ type: 'text', text: message.content });
911
+ }
912
+ return {
913
+ content,
914
+ stopReason: choice?.finish_reason === 'tool_calls' ? 'tool_use' : choice?.finish_reason === 'length' ? 'max_tokens' : 'end_turn',
915
+ usage: {
916
+ inputTokens: response.usage?.prompt_tokens || 0,
917
+ outputTokens: response.usage?.completion_tokens || 0,
918
+ thinkingTokens: response.usage?.completion_tokens_details?.reasoning_tokens || 0,
919
+ },
920
+ model: response.model || this.resolveModelName(),
921
+ };
922
+ }
923
+ mapChatCompletionApiResultToResponses(response) {
924
+ const mapped = this.mapChatCompletionResponse(response);
925
+ const output = [];
926
+ for (const block of mapped.content) {
927
+ if (block.type === 'thinking') {
928
+ output.push({
929
+ type: 'reasoning',
930
+ summary: [{ text: block.thinking }],
931
+ });
932
+ continue;
933
+ }
934
+ if (block.type === 'tool_use') {
935
+ const toolUse = block;
936
+ output.push({
937
+ type: 'function_call',
938
+ call_id: toolUse.id,
939
+ name: toolUse.name,
940
+ arguments: JSON.stringify(toolUse.input || {}),
941
+ });
942
+ continue;
943
+ }
944
+ if (block.type === 'text') {
945
+ output.push({
946
+ type: 'message',
947
+ content: [{ type: 'output_text', text: block.text }],
948
+ });
949
+ }
950
+ }
951
+ return {
952
+ model: mapped.model,
953
+ output,
954
+ usage: {
955
+ input_tokens: mapped.usage.inputTokens,
956
+ output_tokens: mapped.usage.outputTokens,
957
+ reasoning_tokens: mapped.usage.thinkingTokens,
958
+ },
959
+ };
960
+ }
961
+ shouldUseChatCompletionsTransport() {
962
+ return isCustomResponsesEndpoint(this.baseUrl) && !isCodexCompatibleModel(this.resolveModelName());
963
+ }
964
+ buildHeaders() {
965
+ const token = this.apiKey || this.authToken;
966
+ if (!token) {
967
+ throw new Error('Codex credentials are not configured');
968
+ }
969
+ const headers = {
970
+ 'Content-Type': 'application/json',
971
+ 'Authorization': `Bearer ${token}`,
972
+ };
973
+ if (this.authToken && this.accountId) {
974
+ headers['ChatGPT-Account-ID'] = this.accountId;
975
+ }
976
+ return headers;
977
+ }
978
+ buildRequestBody(messages, tools, systemPrompt, options, stream) {
979
+ const input = this.convertMessages(messages);
980
+ const instructions = systemPrompt?.trim() || DEFAULT_CODEX_INSTRUCTIONS;
981
+ const resolvedModel = this.resolveModelName();
982
+ const body = {
983
+ model: resolvedModel,
984
+ input,
985
+ stream,
986
+ store: false,
987
+ instructions,
988
+ };
989
+ if (tools && tools.length > 0) {
990
+ body.tools = tools.map(tool => ({
991
+ type: 'function',
992
+ name: tool.name,
993
+ description: tool.description,
994
+ parameters: tool.inputSchema,
995
+ }));
996
+ }
997
+ if (options?.toolChoice) {
998
+ if (options.toolChoice.type === 'tool') {
999
+ body.tool_choice = {
1000
+ type: 'function',
1001
+ name: options.toolChoice.name,
1002
+ };
1003
+ }
1004
+ else {
1005
+ body.tool_choice = options.toolChoice.type;
1006
+ }
1007
+ }
1008
+ if (this.supportsReasoning(resolvedModel)) {
1009
+ const reasoningEffort = options?.enableThinking === false
1010
+ ? 'none'
1011
+ : options?.reasoningEffort || (options?.enableThinking ? 'medium' : undefined);
1012
+ if (reasoningEffort) {
1013
+ body.reasoning = {
1014
+ effort: reasoningEffort,
1015
+ summary: 'auto',
1016
+ };
1017
+ }
1018
+ }
1019
+ return body;
1020
+ }
1021
+ convertMessages(messages) {
1022
+ const input = [];
1023
+ for (const message of messages) {
1024
+ const contentBlocks = typeof message.content === 'string'
1025
+ ? [{ type: 'text', text: message.content }]
1026
+ : message.content;
1027
+ const textParts = [];
1028
+ const imageParts = [];
1029
+ for (const block of contentBlocks) {
1030
+ if (block.type === 'text') {
1031
+ textParts.push(block.text);
1032
+ continue;
1033
+ }
1034
+ if (isImageBlock(block)) {
1035
+ imageParts.push({
1036
+ type: 'input_image',
1037
+ image_url: `data:${block.source.media_type};base64,${block.source.data}`,
1038
+ });
1039
+ continue;
1040
+ }
1041
+ if (block.type === 'tool_result') {
1042
+ const toolResult = block;
1043
+ input.push({
1044
+ type: 'function_call_output',
1045
+ call_id: toolResult.tool_use_id,
1046
+ output: coerceTextContent(toolResult.content),
1047
+ });
1048
+ continue;
1049
+ }
1050
+ if (message.role === 'assistant' && block.type === 'tool_use') {
1051
+ const toolUse = block;
1052
+ input.push({
1053
+ type: 'function_call',
1054
+ call_id: toolUse.id,
1055
+ name: toolUse.name,
1056
+ arguments: JSON.stringify(toolUse.input || {}),
1057
+ });
1058
+ }
1059
+ }
1060
+ if (textParts.length > 0 || imageParts.length > 0) {
1061
+ const content = [];
1062
+ if (textParts.length > 0) {
1063
+ content.push({
1064
+ type: getMessageTextContentType(message.role),
1065
+ text: textParts.join('\n'),
1066
+ });
1067
+ }
1068
+ if (message.role !== 'assistant') {
1069
+ content.push(...imageParts);
1070
+ }
1071
+ input.push({
1072
+ type: 'message',
1073
+ role: message.role,
1074
+ content,
1075
+ });
1076
+ }
1077
+ }
1078
+ return input;
1079
+ }
1080
+ mapOutputToContentBlocks(output) {
1081
+ if (!Array.isArray(output)) {
1082
+ return [{ type: 'text', text: '' }];
1083
+ }
1084
+ const contentBlocks = [];
1085
+ for (const item of output) {
1086
+ if (item.type === 'message' && Array.isArray(item.content)) {
1087
+ const text = item.content
1088
+ .map(part => part.text || '')
1089
+ .join('');
1090
+ if (text) {
1091
+ contentBlocks.push({ type: 'text', text });
1092
+ }
1093
+ continue;
1094
+ }
1095
+ if (item.type === 'reasoning' && Array.isArray(item.summary)) {
1096
+ const text = item.summary.map(part => part.text || '').join('');
1097
+ if (text) {
1098
+ contentBlocks.push({ type: 'thinking', thinking: text });
1099
+ }
1100
+ continue;
1101
+ }
1102
+ if (item.type === 'function_call') {
1103
+ contentBlocks.push({
1104
+ type: 'tool_use',
1105
+ id: item.call_id || item.id || `call_${Date.now()}`,
1106
+ name: item.name || 'unknown_tool',
1107
+ input: safeJsonParse(item.arguments, {}),
1108
+ });
1109
+ }
1110
+ }
1111
+ if (contentBlocks.length === 0) {
1112
+ const text = extractTextFromOutput(output);
1113
+ if (text) {
1114
+ contentBlocks.push({ type: 'text', text });
1115
+ }
1116
+ }
1117
+ return contentBlocks;
1118
+ }
1119
+ *emitCompletedResponse(response, replayState) {
1120
+ const output = response?.output || [];
1121
+ for (const item of output) {
1122
+ if (item.type === 'reasoning' && Array.isArray(item.summary)) {
1123
+ if (replayState?.sawThinkingDelta) {
1124
+ continue;
1125
+ }
1126
+ const text = item.summary.map(part => part.text || '').join('');
1127
+ if (text) {
1128
+ yield { type: 'thinking', thinking: text };
1129
+ }
1130
+ continue;
1131
+ }
1132
+ if (item.type === 'function_call') {
1133
+ const callId = resolveCanonicalToolCallId(replayState, collectResponseToolCallAliases(item), getResponseToolCallId(item));
1134
+ if (!replayState?.startedToolCallIds.has(callId)) {
1135
+ yield {
1136
+ type: 'tool_use_start',
1137
+ id: callId,
1138
+ name: item.name || 'unknown_tool',
1139
+ };
1140
+ }
1141
+ if (!replayState?.completedToolCallIds.has(callId)) {
1142
+ yield {
1143
+ type: 'tool_use_complete',
1144
+ id: callId,
1145
+ input: safeJsonParse(item.arguments, {}),
1146
+ };
1147
+ }
1148
+ continue;
1149
+ }
1150
+ if (item.type === 'message' && Array.isArray(item.content)) {
1151
+ if (replayState?.sawTextDelta) {
1152
+ continue;
1153
+ }
1154
+ for (const part of item.content) {
1155
+ if (part.type === 'output_text' && part.text) {
1156
+ yield { type: 'text', text: part.text };
1157
+ }
1158
+ }
1159
+ }
1160
+ }
1161
+ const hasToolUse = output.some(item => item.type === 'function_call');
1162
+ yield {
1163
+ type: 'usage',
1164
+ usage: {
1165
+ inputTokens: response?.usage?.input_tokens || 0,
1166
+ outputTokens: response?.usage?.output_tokens || 0,
1167
+ thinkingTokens: response?.usage?.reasoning_tokens || 0,
1168
+ },
1169
+ };
1170
+ yield {
1171
+ type: 'stop',
1172
+ stopReason: hasToolUse ? 'tool_use' : 'end_turn',
1173
+ };
1174
+ }
1175
+ resolveModelName() {
1176
+ const allowArbitraryModel = isCustomResponsesEndpoint(this.baseUrl);
1177
+ if (this.customModelName?.trim() && (allowArbitraryModel || isCodexCompatibleModel(this.customModelName))) {
1178
+ return this.customModelName.trim();
1179
+ }
1180
+ const normalized = this.model.trim();
1181
+ if (normalized && (allowArbitraryModel || isCodexCompatibleModel(normalized))) {
1182
+ return normalized;
1183
+ }
1184
+ return 'gpt-5-codex';
1185
+ }
1186
+ supportsReasoning(model) {
1187
+ return isCodexCompatibleModel(model);
1188
+ }
1189
+ setModel(model) {
1190
+ this.model = model;
1191
+ }
1192
+ getModel() {
1193
+ return this.model;
1194
+ }
1195
+ getIsOAuth() {
1196
+ return !this.apiKey && !!this.authToken;
1197
+ }
1198
+ getAnthropicClient() {
1199
+ return undefined;
1200
+ }
1201
+ }
1202
+ //# sourceMappingURL=codex-client.js.map