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
@@ -26,8 +26,12 @@ import { TerminalManager } from './terminal-manager.js';
26
26
  import { logger } from '../../utils/logger.js';
27
27
  // 错误感知
28
28
  import { errorWatcher } from '../../utils/error-watcher.js';
29
+ import { buildImageAttachmentPathHints, saveBase64AttachmentToTempFile, } from './image-attachments.js';
30
+ import { getDefaultWebModelForBackend, normalizeWebRuntimeModelForBackend, } from '../shared/model-catalog.js';
29
31
  // Git WebSocket 处理函数
30
32
  import { handleGitGetStatus, handleGitGetLog, handleGitGetBranches, handleGitGetStashes, handleGitStage, handleGitUnstage, handleGitCommit, handleGitPush, handleGitPull, handleGitCheckout, handleGitStashAndCheckout, handleGitForceCheckout, handleGitCreateBranch, handleGitDeleteBranch, handleGitStashSave, handleGitStashPop, handleGitStashDrop, handleGitStashApply, handleGitGetDiff, handleGitGetCommitDetail, handleGitGetCommitFileDiff, handleGitSmartCommit, handleGitSmartReview, handleGitSmartCommitAndReview, handleGitExplainCommit, handleGitMerge, handleGitRebase, handleGitMergeAbort, handleGitRebaseContinue, handleGitRebaseAbort, handleGitReset, handleGitDiscardFile, handleGitStageAll, handleGitUnstageAll, handleGitDiscardAll, handleGitAmendCommit, handleGitRevertCommit, handleGitCherryPick, handleGitGetTags, handleGitCreateTag, handleGitDeleteTag, handleGitPushTags, handleGitGetRemotes, handleGitAddRemote, handleGitRemoveRemote, handleGitFetch, handleGitSearchCommits, handleGitGetFileHistory, handleGitGetBlame, handleGitCompareBranches, handleGitGetMergeStatus, handleGitGetConflicts, handleGitResolveLock, } from './websocket-git-handlers.js';
33
+ // cmux 终端集成(macOS 原生 AI 终端 https://github.com/manaflow-ai/cmux)
34
+ import { getCmuxBridge } from '../../notifications/cmux.js';
31
35
  // ============================================================================
32
36
  // 工具分类函数 - 用于 Web UI 状态反馈
33
37
  // ============================================================================
@@ -63,6 +67,19 @@ const activeE2EState = new Map();
63
67
  const activeLeadAgentState = new Map();
64
68
  // 背压阈值:单连接缓冲区超过此字节数则视为慢客户端(参考 OpenClaw server-broadcast.ts)
65
69
  const MAX_BUFFERED_BYTES = 10 * 1024 * 1024; // 10MB
70
+ function getDefaultChatModel(runtimeBackend = webAuth.getRuntimeBackend()) {
71
+ return getDefaultWebModelForBackend(runtimeBackend, webAuth.getDefaultModelByBackend()[runtimeBackend]);
72
+ }
73
+ /**
74
+ * 会话操作互斥锁:确保修改 client.sessionId 的操作不会并发执行
75
+ * 使用 Promise 链模式:每个操作 await 上一个操作完成后才开始
76
+ */
77
+ function withSessionMutex(client, fn) {
78
+ const prev = client.sessionMutex || Promise.resolve();
79
+ let resolve;
80
+ client.sessionMutex = new Promise(r => { resolve = r; });
81
+ return prev.then(() => fn()).finally(() => resolve());
82
+ }
66
83
  // 全局检查点管理器实例(惰性初始化,避免模块加载时的副作用日志)
67
84
  let _checkpointManager = null;
68
85
  function getCheckpointManager() {
@@ -1026,11 +1043,14 @@ export function setupWebSocket(wss, conversationManager) {
1026
1043
  wss.on('connection', (ws) => {
1027
1044
  const clientId = randomUUID();
1028
1045
  const sessionId = randomUUID();
1046
+ const runtimeBackend = webAuth.getRuntimeBackend();
1047
+ const defaultModel = getDefaultChatModel(runtimeBackend);
1029
1048
  const client = {
1030
1049
  id: clientId,
1031
1050
  ws,
1032
1051
  sessionId,
1033
- model: 'opus',
1052
+ model: defaultModel,
1053
+ runtimeBackend,
1034
1054
  isAlive: true,
1035
1055
  swarmSubscriptions: new Set(),
1036
1056
  permissionMode: 'bypassPermissions',
@@ -1042,7 +1062,8 @@ export function setupWebSocket(wss, conversationManager) {
1042
1062
  type: 'connected',
1043
1063
  payload: {
1044
1064
  sessionId,
1045
- model: client.model,
1065
+ model: defaultModel,
1066
+ runtimeBackend,
1046
1067
  serverStartTime,
1047
1068
  },
1048
1069
  });
@@ -1192,15 +1213,27 @@ async function handleClientMessage(client, message, conversationManager, swarmSu
1192
1213
  });
1193
1214
  break;
1194
1215
  }
1195
- case 'chat':
1196
- // 确保会话关联 WebSocket
1197
- conversationManager.setWebSocket(client.sessionId, ws);
1198
- // 如果消息中包含 projectPath,更新 client.projectPath
1199
- if (message.payload.projectPath !== undefined) {
1200
- client.projectPath = message.payload.projectPath;
1216
+ case 'chat': {
1217
+ // 使用会话互斥锁保护 session 初始化阶段(读取/修改 client.sessionId)
1218
+ // 但不锁住整个流式响应,否则 session_new/session_switch 会被阻塞到 AI 回复完成
1219
+ const chatContext = await withSessionMutex(client, async () => {
1220
+ // 确保会话关联 WebSocket
1221
+ conversationManager.setWebSocket(client.sessionId, ws);
1222
+ // 如果消息中包含 projectPath,更新 client.projectPath
1223
+ if (message.payload.projectPath !== undefined) {
1224
+ client.projectPath = message.payload.projectPath;
1225
+ }
1226
+ // prepareChatSession: 初始化会话并返回闭包需要的上下文
1227
+ // 这里完成所有需要互斥保护的操作:读取 sessionId、创建持久化会话、更新 client.sessionId
1228
+ const ctx = await prepareChatSession(client, message.payload.content, message.payload.attachments || message.payload.images, conversationManager, message.payload.thinkingConfig);
1229
+ return ctx;
1230
+ });
1231
+ // Phase 2: 在锁外执行流式 chat(chatContext 中的 chatSessionId 已是闭包安全值)
1232
+ if (chatContext) {
1233
+ await executeChatStreaming(chatContext, conversationManager, message.payload.messageId);
1201
1234
  }
1202
- await handleChatMessage(client, message.payload.content, message.payload.attachments || message.payload.images, conversationManager, message.payload.messageId);
1203
1235
  break;
1236
+ }
1204
1237
  case 'cancel':
1205
1238
  conversationManager.cancel(client.sessionId);
1206
1239
  sendMessage(ws, {
@@ -1223,8 +1256,8 @@ async function handleClientMessage(client, message, conversationManager, swarmSu
1223
1256
  });
1224
1257
  break;
1225
1258
  case 'set_model':
1226
- client.model = message.payload.model;
1227
- conversationManager.setModel(client.sessionId, message.payload.model);
1259
+ client.model = normalizeWebRuntimeModelForBackend(client.runtimeBackend, message.payload.model, webAuth.getDefaultModelByBackend()[client.runtimeBackend]);
1260
+ conversationManager.setModel(client.sessionId, client.model);
1228
1261
  break;
1229
1262
  case 'set_language':
1230
1263
  try {
@@ -1279,15 +1312,15 @@ async function handleClientMessage(client, message, conversationManager, swarmSu
1279
1312
  await handleSessionList(client, message.payload, conversationManager);
1280
1313
  break;
1281
1314
  case 'session_create':
1282
- await handleSessionCreate(client, message.payload, conversationManager);
1315
+ await withSessionMutex(client, () => handleSessionCreate(client, message.payload, conversationManager));
1283
1316
  break;
1284
1317
  case 'session_new':
1285
1318
  // 官方规范:创建新的临时会话(不立即持久化)
1286
1319
  // 会话只有在发送第一条消息后才会真正创建
1287
- await handleSessionNew(client, message.payload, conversationManager);
1320
+ await withSessionMutex(client, () => handleSessionNew(client, message.payload, conversationManager));
1288
1321
  break;
1289
1322
  case 'session_switch':
1290
- await handleSessionSwitch(client, message.payload.sessionId, conversationManager);
1323
+ await withSessionMutex(client, () => handleSessionSwitch(client, message.payload.sessionId, conversationManager));
1291
1324
  break;
1292
1325
  case 'session_delete':
1293
1326
  await handleSessionDelete(client, message.payload.sessionId, conversationManager);
@@ -1882,9 +1915,10 @@ async function handleClientMessage(client, message, conversationManager, swarmSu
1882
1915
  }
1883
1916
  }
1884
1917
  /**
1885
- * 处理聊天消息
1918
+ * Phase 1: 在互斥锁内执行 — 初始化会话并返回流式 chat 所需的上下文
1919
+ * 所有读取/修改 client.sessionId 的操作在此完成
1886
1920
  */
1887
- async function handleChatMessage(client, content, attachments, conversationManager, userMessageId) {
1921
+ async function prepareChatSession(client, content, attachments, conversationManager, thinkingConfig) {
1888
1922
  const { ws, model, projectPath } = client;
1889
1923
  let { sessionId } = client;
1890
1924
  console.log(`[WebSocket] handleChatMessage - sessionId: ${sessionId}, projectPath: ${projectPath || 'undefined'}`);
@@ -1894,12 +1928,12 @@ async function handleChatMessage(client, content, attachments, conversationManag
1894
1928
  type: 'error',
1895
1929
  payload: { message: 'API Key not configured. Please configure an API Key in settings or log in via OAuth before sending messages.' },
1896
1930
  });
1897
- return;
1931
+ return null;
1898
1932
  }
1899
1933
  // 检查是否为斜杠命令
1900
1934
  if (isSlashCommand(content)) {
1901
- await handleSlashCommand(client, content, conversationManager);
1902
- return;
1935
+ await handleSlashCommand(client, content, conversationManager, thinkingConfig);
1936
+ return null;
1903
1937
  }
1904
1938
  // 确保会话存在于 sessionManager 中(处理临时会话 ID 的情况)
1905
1939
  const sessionManager = conversationManager.getSessionManager();
@@ -1913,6 +1947,7 @@ async function handleChatMessage(client, content, attachments, conversationManag
1913
1947
  const newSession = sessionManager.createSession({
1914
1948
  name: firstPrompt, // 使用 firstPrompt 作为会话标题
1915
1949
  model: model,
1950
+ runtimeBackend: client.runtimeBackend,
1916
1951
  tags: ['webui'],
1917
1952
  projectPath: client.projectPath, // 传递项目路径
1918
1953
  });
@@ -1928,6 +1963,7 @@ async function handleChatMessage(client, content, attachments, conversationManag
1928
1963
  sessionId: newSession.metadata.id,
1929
1964
  name: newSession.metadata.name,
1930
1965
  model: newSession.metadata.model,
1966
+ runtimeBackend: client.runtimeBackend,
1931
1967
  createdAt: newSession.metadata.createdAt,
1932
1968
  },
1933
1969
  });
@@ -1945,22 +1981,43 @@ async function handleChatMessage(client, content, attachments, conversationManag
1945
1981
  console.log(`[WebSocket] Updating session title to firstPrompt: ${firstPrompt}`);
1946
1982
  }
1947
1983
  }
1948
- const messageId = randomUUID();
1949
- // 处理附件:图片直接传递给 Claude API,其他文件保存为临时文件传路径
1984
+ // 处理附件:图片传递给模型视觉输入,同时也落盘为稳定的临时文件引用
1950
1985
  let mediaAttachments;
1951
1986
  let fileAttachments;
1952
1987
  let enhancedContent = content;
1953
1988
  if (attachments && Array.isArray(attachments)) {
1954
1989
  if (attachments.length > 0 && typeof attachments[0] === 'object') {
1955
1990
  const typedAttachments = attachments;
1956
- // 提取图片附件(直接传递给 Claude API)
1991
+ // 提取图片附件(视觉输入 + 稳定临时文件路径)
1957
1992
  mediaAttachments = typedAttachments
1958
1993
  .filter(att => att.type === 'image')
1959
- .map(att => ({
1960
- data: att.data,
1961
- mimeType: att.mimeType || 'image/png',
1962
- type: 'image',
1963
- }));
1994
+ .map(att => {
1995
+ const imageAttachment = {
1996
+ name: att.name,
1997
+ data: att.data,
1998
+ mimeType: att.mimeType || 'image/png',
1999
+ type: 'image',
2000
+ };
2001
+ try {
2002
+ imageAttachment.filePath = saveBase64AttachmentToTempFile(att.name, att.data);
2003
+ console.log('[WebSocket] Image attachment saved to temp file: ' + imageAttachment.filePath);
2004
+ }
2005
+ catch (error) {
2006
+ console.warn(`[WebSocket] Failed to persist image attachment ${att.name}:`, error);
2007
+ }
2008
+ return imageAttachment;
2009
+ });
2010
+ const imagePathHints = buildImageAttachmentPathHints(mediaAttachments);
2011
+ if (imagePathHints.length > 0) {
2012
+ enhancedContent = `Uploaded image files:\n${imagePathHints.join('\n')}\nUse the exact local image path above if you call ImageGen for one of these uploads.${enhancedContent ? `\n\n${enhancedContent}` : ''}`;
2013
+ }
2014
+ // 将图片编辑偏好显式注入到本轮文本上下文,降低模型忽略附件元数据的概率
2015
+ const imageEditHints = typedAttachments
2016
+ .filter(att => att.type === 'image' && att.imageEditStrength)
2017
+ .map(att => `- ${att.name}: preferred image edit strength = ${att.imageEditStrength}`);
2018
+ if (imageEditHints.length > 0) {
2019
+ enhancedContent = `Image attachment edit preferences:\n${imageEditHints.join('\n')}${enhancedContent ? `\n\n${enhancedContent}` : ''}`;
2020
+ }
1964
2021
  // 所有非图片附件统一保存为临时文件(包括 pdf/docx/xlsx/pptx/text/file 等任意格式)
1965
2022
  fileAttachments = typedAttachments
1966
2023
  .filter(att => att.type !== 'image')
@@ -1972,11 +2029,26 @@ async function handleChatMessage(client, content, attachments, conversationManag
1972
2029
  }
1973
2030
  else {
1974
2031
  // 旧格式:直接是 base64 字符串数组(默认图片 png)
1975
- mediaAttachments = attachments.map(data => ({
1976
- data,
1977
- mimeType: 'image/png',
1978
- type: 'image',
1979
- }));
2032
+ mediaAttachments = attachments.map((data, index) => {
2033
+ const imageAttachment = {
2034
+ name: `uploaded-image-${index + 1}.png`,
2035
+ data,
2036
+ mimeType: 'image/png',
2037
+ type: 'image',
2038
+ };
2039
+ try {
2040
+ imageAttachment.filePath = saveBase64AttachmentToTempFile(imageAttachment.name, data);
2041
+ console.log('[WebSocket] Legacy image attachment saved to temp file: ' + imageAttachment.filePath);
2042
+ }
2043
+ catch (error) {
2044
+ console.warn(`[WebSocket] Failed to persist legacy image attachment ${imageAttachment.name}:`, error);
2045
+ }
2046
+ return imageAttachment;
2047
+ });
2048
+ const imagePathHints = buildImageAttachmentPathHints(mediaAttachments);
2049
+ if (imagePathHints.length > 0) {
2050
+ enhancedContent = `Uploaded image files:\n${imagePathHints.join('\n')}\nUse the exact local image path above if you call ImageGen for one of these uploads.${enhancedContent ? `\n\n${enhancedContent}` : ''}`;
2051
+ }
1980
2052
  }
1981
2053
  }
1982
2054
  // 处理非图片文件附件:保存到临时目录,将文件路径告知模型
@@ -2007,6 +2079,26 @@ async function handleChatMessage(client, content, attachments, conversationManag
2007
2079
  const getActiveWs = () => {
2008
2080
  return conversationManager.getWebSocket(chatSessionId) || ws;
2009
2081
  };
2082
+ return {
2083
+ chatSessionId,
2084
+ model,
2085
+ projectPath: client.projectPath,
2086
+ ws,
2087
+ enhancedContent,
2088
+ mediaAttachments,
2089
+ permissionMode: client.permissionMode,
2090
+ runtimeBackend: client.runtimeBackend,
2091
+ thinkingConfig,
2092
+ getActiveWs,
2093
+ };
2094
+ }
2095
+ /**
2096
+ * Phase 2: 在互斥锁外执行 — 实际的流式 AI 对话
2097
+ * 使用 chatSessionId 闭包值,不再读写 client.sessionId
2098
+ */
2099
+ async function executeChatStreaming(ctx, conversationManager, userMessageId) {
2100
+ const { chatSessionId, model, enhancedContent, mediaAttachments, thinkingConfig, getActiveWs } = ctx;
2101
+ const messageId = randomUUID();
2010
2102
  // 始终发送流式消息到 WebSocket,不做服务端门控
2011
2103
  // 客户端已有基于 sessionId 的会话隔离过滤(useMessageHandler),
2012
2104
  // 服务端门控(isActiveSession)会导致用户切换会话或刷新页面时消息永久丢失,
@@ -2019,6 +2111,9 @@ async function handleChatMessage(client, content, attachments, conversationManag
2019
2111
  type: 'status',
2020
2112
  payload: { status: 'thinking', sessionId: chatSessionId },
2021
2113
  });
2114
+ // cmux 集成:通知 cmux 终端 Agent 开始思考
2115
+ const cmux = getCmuxBridge();
2116
+ cmux.onThinking();
2022
2117
  try {
2023
2118
  // 调用对话管理器,传入流式回调(媒体附件包含 mimeType 和类型)
2024
2119
  // 所有回调使用 getActiveWs() 动态获取 WebSocket,确保刷新后消息仍能送达
@@ -2057,6 +2152,13 @@ async function handleChatMessage(client, content, attachments, conversationManag
2057
2152
  type: 'status',
2058
2153
  payload: { status: 'tool_executing', message: `Executing ${toolName}...`, sessionId: chatSessionId },
2059
2154
  });
2155
+ cmux.onToolStart(toolName);
2156
+ },
2157
+ onToolUseInputReady: (toolUseId, input) => {
2158
+ sendMessage(getActiveWs(), {
2159
+ type: 'tool_use_input_ready',
2160
+ payload: { toolUseId, input, sessionId: chatSessionId },
2161
+ });
2060
2162
  },
2061
2163
  onToolUseDelta: (toolUseId, partialJson) => {
2062
2164
  sendMessage(getActiveWs(), {
@@ -2083,6 +2185,7 @@ async function handleChatMessage(client, content, attachments, conversationManag
2083
2185
  type: 'permission_request',
2084
2186
  payload: { ...request, sessionId: chatSessionId },
2085
2187
  });
2188
+ cmux.onPermissionRequest(request.toolName || 'Unknown', request.description || 'execute');
2086
2189
  },
2087
2190
  onComplete: async (stopReason, usage) => {
2088
2191
  // 保存会话到磁盘(确保 messageCount 正确更新)
@@ -2112,6 +2215,7 @@ async function handleChatMessage(client, content, attachments, conversationManag
2112
2215
  type: 'status',
2113
2216
  payload: { status: 'idle', sessionId: chatSessionId },
2114
2217
  });
2218
+ cmux.onComplete();
2115
2219
  },
2116
2220
  onError: (error) => {
2117
2221
  // 页面刷新恢复:错误时也需要重发 history 确保客户端状态一致
@@ -2130,6 +2234,7 @@ async function handleChatMessage(client, content, attachments, conversationManag
2130
2234
  type: 'status',
2131
2235
  payload: { status: 'idle', sessionId: chatSessionId },
2132
2236
  });
2237
+ cmux.onError(error.message);
2133
2238
  },
2134
2239
  onContextUpdate: (usage) => {
2135
2240
  sendMessage(getActiveWs(), {
@@ -2160,7 +2265,7 @@ async function handleChatMessage(client, content, attachments, conversationManag
2160
2265
  });
2161
2266
  }
2162
2267
  },
2163
- }, client.projectPath, getActiveWs(), client.permissionMode, userMessageId); // 传入动态 ws、权限模式和前端消息 ID,确保跨会话持久化
2268
+ }, ctx.projectPath, getActiveWs(), ctx.permissionMode, userMessageId, thinkingConfig); // 传入动态 ws、权限模式和前端消息 ID,确保跨会话持久化
2164
2269
  }
2165
2270
  catch (error) {
2166
2271
  console.error('[WebSocket] Chat handling error:', error);
@@ -2177,7 +2282,7 @@ async function handleChatMessage(client, content, attachments, conversationManag
2177
2282
  /**
2178
2283
  * 处理斜杠命令
2179
2284
  */
2180
- async function handleSlashCommand(client, command, conversationManager) {
2285
+ async function handleSlashCommand(client, command, conversationManager, thinkingConfig) {
2181
2286
  const { ws, sessionId, model, projectPath } = client;
2182
2287
  try {
2183
2288
  // 获取当前工作目录(优先使用项目路径)
@@ -2221,7 +2326,9 @@ async function handleSlashCommand(client, command, conversationManager) {
2221
2326
  }
2222
2327
  // 如果命令返回 chatPrompt,将其作为聊天消息发送给 AI(用于 /init 等命令)
2223
2328
  if (result.success && result.data?.chatPrompt) {
2224
- await handleChatMessage(client, result.data.chatPrompt, undefined, conversationManager);
2329
+ const ctx = await withSessionMutex(client, () => prepareChatSession(client, result.data.chatPrompt, undefined, conversationManager, thinkingConfig));
2330
+ if (ctx)
2331
+ await executeChatStreaming(ctx, conversationManager);
2225
2332
  return;
2226
2333
  }
2227
2334
  // 如果内置命令未找到,尝试作为 skill 执行
@@ -2246,7 +2353,9 @@ async function handleSlashCommand(client, command, conversationManager) {
2246
2353
  }
2247
2354
  const messageContent = `[Skill: ${skill.skillName}]\n\n${skillContent}`;
2248
2355
  console.log(`[WebSocket] Executing skill ${skill.skillName}, content length: ${skillContent.length}`);
2249
- await handleChatMessage(client, messageContent, undefined, conversationManager);
2356
+ const skillCtx = await withSessionMutex(client, () => prepareChatSession(client, messageContent, undefined, conversationManager, thinkingConfig));
2357
+ if (skillCtx)
2358
+ await executeChatStreaming(skillCtx, conversationManager);
2250
2359
  return;
2251
2360
  }
2252
2361
  }
@@ -2326,6 +2435,7 @@ async function handleSessionList(client, payload, conversationManager) {
2326
2435
  updatedAt: s.updatedAt,
2327
2436
  messageCount: s.messageCount,
2328
2437
  model: s.model,
2438
+ runtimeBackend: s.runtimeBackend,
2329
2439
  cost: s.cost,
2330
2440
  tokenUsage: s.tokenUsage,
2331
2441
  tags: s.tags,
@@ -2357,22 +2467,27 @@ async function handleSessionCreate(client, payload, conversationManager) {
2357
2467
  try {
2358
2468
  const { name, model, tags, projectPath } = payload;
2359
2469
  const sessionManager = conversationManager.getSessionManager();
2470
+ const runtimeBackend = payload?.runtimeBackend || client.runtimeBackend || webAuth.getRuntimeBackend();
2471
+ const effectiveModel = normalizeWebRuntimeModelForBackend(runtimeBackend, model || client.model || getDefaultChatModel(runtimeBackend), webAuth.getDefaultModelByBackend()[runtimeBackend]);
2360
2472
  const newSession = sessionManager.createSession({
2361
2473
  name: name || `WebUI Session - ${new Date().toLocaleString('en-US')}`,
2362
- model: model || 'opus',
2474
+ model: effectiveModel,
2475
+ runtimeBackend,
2363
2476
  tags: tags || ['webui'],
2364
2477
  projectPath,
2365
2478
  });
2366
2479
  // 更新客户端会话状态
2367
2480
  client.sessionId = newSession.metadata.id;
2368
- client.model = model || 'opus';
2481
+ client.model = effectiveModel;
2482
+ client.runtimeBackend = runtimeBackend;
2369
2483
  client.projectPath = projectPath;
2370
2484
  sendMessage(ws, {
2371
2485
  type: 'session_created',
2372
2486
  payload: {
2373
2487
  sessionId: newSession.metadata.id,
2374
2488
  name: newSession.metadata.name,
2375
- model: newSession.metadata.model,
2489
+ model: effectiveModel,
2490
+ runtimeBackend,
2376
2491
  createdAt: newSession.metadata.createdAt,
2377
2492
  projectPath: newSession.metadata.projectPath,
2378
2493
  },
@@ -2400,11 +2515,13 @@ async function handleSessionNew(client, payload, conversationManager) {
2400
2515
  await conversationManager.persistSession(client.sessionId);
2401
2516
  // 生成新的临时 sessionId(使用 crypto 生成 UUID)
2402
2517
  const tempSessionId = randomUUID();
2403
- const model = payload?.model || client.model || 'opus';
2518
+ const runtimeBackend = payload?.runtimeBackend || client.runtimeBackend || webAuth.getRuntimeBackend();
2519
+ const model = normalizeWebRuntimeModelForBackend(runtimeBackend, payload?.model || client.model || getDefaultChatModel(runtimeBackend), webAuth.getDefaultModelByBackend()[runtimeBackend]);
2404
2520
  const projectPath = payload?.projectPath;
2405
2521
  // 更新 client 的 sessionId、model 和 projectPath
2406
2522
  client.sessionId = tempSessionId;
2407
2523
  client.model = model;
2524
+ client.runtimeBackend = runtimeBackend;
2408
2525
  client.projectPath = projectPath;
2409
2526
  // 清空内存中的会话状态(如果存在)
2410
2527
  // 不创建持久化会话,等待用户发送第一条消息时再创建
@@ -2415,6 +2532,7 @@ async function handleSessionNew(client, payload, conversationManager) {
2415
2532
  payload: {
2416
2533
  sessionId: tempSessionId,
2417
2534
  model: model,
2535
+ runtimeBackend,
2418
2536
  projectPath,
2419
2537
  },
2420
2538
  });
@@ -2456,9 +2574,21 @@ async function handleSessionSwitch(client, sessionId, conversationManager) {
2456
2574
  // 获取会话历史(使用 getLiveHistory:处理中时从 messages 实时构建,确保工具调用中间 turn 不丢失)
2457
2575
  const history = conversationManager.getLiveHistory(sessionId);
2458
2576
  console.log(`[WebSocket] handleSessionSwitch: sessionId=${sessionId}, history.length=${history.length}, isProcessing=${conversationManager.isSessionProcessing(sessionId)}`);
2577
+ const sessionName = conversationManager.getSessionName(sessionId);
2578
+ const sessionRuntimeBackend = conversationManager.getSessionRuntimeBackend(sessionId) || webAuth.getRuntimeBackend();
2579
+ const sessionModel = conversationManager.getSessionModel(sessionId) || getDefaultChatModel(sessionRuntimeBackend);
2580
+ client.model = sessionModel;
2581
+ client.runtimeBackend = sessionRuntimeBackend;
2459
2582
  sendMessage(ws, {
2460
2583
  type: 'session_switched',
2461
- payload: { sessionId, projectPath: client.projectPath, history },
2584
+ payload: {
2585
+ sessionId,
2586
+ sessionName,
2587
+ projectPath: client.projectPath,
2588
+ history,
2589
+ model: sessionModel,
2590
+ runtimeBackend: sessionRuntimeBackend,
2591
+ },
2462
2592
  });
2463
2593
  // 同步权限配置到客户端(刷新后客户端 permissionMode 会重置为 'default',需要从服务端恢复)
2464
2594
  const permConfig = conversationManager.getPermissionConfig(sessionId);
@@ -2527,12 +2657,13 @@ async function handleSessionSwitch(client, sessionId, conversationManager) {
2527
2657
  });
2528
2658
  console.log(`[WebSocket] Resending pending permission request: ${req.tool} (${req.requestId})`);
2529
2659
  }
2530
- const pendingQuestions = conversationManager.getPendingUserQuestions(sessionId);
2660
+ const pendingQuestions = conversationManager.getUndeliveredPendingUserQuestions(sessionId);
2531
2661
  for (const q of pendingQuestions) {
2532
2662
  sendMessage(ws, {
2533
2663
  type: 'user_question',
2534
2664
  payload: { ...q, sessionId },
2535
2665
  });
2666
+ conversationManager.markPendingUserQuestionDelivered(sessionId, q.requestId);
2536
2667
  console.log(`[WebSocket] Resending pending user question: ${q.header} (${q.requestId})`);
2537
2668
  }
2538
2669
  }
@@ -2589,6 +2720,12 @@ async function handleSessionSwitch(client, sessionId, conversationManager) {
2589
2720
  payload: { status: 'tool_executing', message: `Executing ${toolName}...`, sessionId: chatSessionId },
2590
2721
  });
2591
2722
  },
2723
+ onToolUseInputReady: (toolUseId, input) => {
2724
+ sendMessage(getActiveWs(), {
2725
+ type: 'tool_use_input_ready',
2726
+ payload: { toolUseId, input, sessionId: chatSessionId },
2727
+ });
2728
+ },
2592
2729
  onToolUseDelta: (toolUseId, partialJson) => {
2593
2730
  sendMessage(getActiveWs(), {
2594
2731
  type: 'tool_use_delta',
@@ -2682,9 +2819,17 @@ async function handleSessionSwitch(client, sessionId, conversationManager) {
2682
2819
  // IM 会话尚未创建(首条消息还在处理中),预先切换过去
2683
2820
  // chat() 运行时会在内存中创建该会话,流式消息会正常显示
2684
2821
  client.sessionId = sessionId;
2822
+ client.runtimeBackend = webAuth.getRuntimeBackend();
2823
+ client.model = getDefaultChatModel(client.runtimeBackend);
2685
2824
  sendMessage(ws, {
2686
2825
  type: 'session_switched',
2687
- payload: { sessionId, projectPath: client.projectPath, history: [] },
2826
+ payload: {
2827
+ sessionId,
2828
+ projectPath: client.projectPath,
2829
+ history: [],
2830
+ model: client.model,
2831
+ runtimeBackend: client.runtimeBackend,
2832
+ },
2688
2833
  });
2689
2834
  }
2690
2835
  else {
@@ -2844,9 +2989,13 @@ async function handleSessionResume(client, sessionId, conversationManager) {
2844
2989
  // 重要:更新会话的 WebSocket 连接,确保 UserInteractionHandler 和 TaskManager 使用新连接
2845
2990
  conversationManager.setWebSocket(sessionId, ws);
2846
2991
  const history = conversationManager.getHistory(sessionId);
2992
+ const sessionRuntimeBackend = conversationManager.getSessionRuntimeBackend(sessionId) || webAuth.getRuntimeBackend();
2993
+ const sessionModel = conversationManager.getSessionModel(sessionId) || getDefaultChatModel(sessionRuntimeBackend);
2994
+ client.model = sessionModel;
2995
+ client.runtimeBackend = sessionRuntimeBackend;
2847
2996
  sendMessage(ws, {
2848
2997
  type: 'session_switched',
2849
- payload: { sessionId, history },
2998
+ payload: { sessionId, history, model: sessionModel, runtimeBackend: sessionRuntimeBackend },
2850
2999
  });
2851
3000
  }
2852
3001
  else {