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