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.
- package/dist/auth/snapshot.d.ts +24 -0
- package/dist/auth/snapshot.d.ts.map +1 -0
- package/dist/auth/snapshot.js +144 -0
- package/dist/auth/snapshot.js.map +1 -0
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/index.d.ts +30 -15
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +13 -2
- package/dist/config/index.js.map +1 -1
- package/dist/core/client.d.ts +7 -2
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +50 -18
- package/dist/core/client.js.map +1 -1
- package/dist/core/loop.d.ts +2 -7
- package/dist/core/loop.d.ts.map +1 -1
- package/dist/core/loop.js +16 -38
- package/dist/core/loop.js.map +1 -1
- package/dist/core/max-tokens.d.ts +24 -0
- package/dist/core/max-tokens.d.ts.map +1 -0
- package/dist/core/max-tokens.js +64 -0
- package/dist/core/max-tokens.js.map +1 -0
- package/dist/goals/goal-store.d.ts +1 -1
- package/dist/goals/goal-store.d.ts.map +1 -1
- package/dist/goals/goal-store.js.map +1 -1
- package/dist/hooks/auto-verify.d.ts +86 -0
- package/dist/hooks/auto-verify.d.ts.map +1 -0
- package/dist/hooks/auto-verify.js +297 -0
- package/dist/hooks/auto-verify.js.map +1 -0
- package/dist/mcp/config.d.ts +8 -8
- package/dist/media/index.d.ts +1 -0
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +2 -0
- package/dist/media/index.js.map +1 -1
- package/dist/media/office-visual.d.ts +66 -0
- package/dist/media/office-visual.d.ts.map +1 -0
- package/dist/media/office-visual.js +409 -0
- package/dist/media/office-visual.js.map +1 -0
- package/dist/memory/long-term-store.d.ts +6 -0
- package/dist/memory/long-term-store.d.ts.map +1 -1
- package/dist/memory/long-term-store.js +66 -48
- package/dist/memory/long-term-store.js.map +1 -1
- package/dist/memory/memory-search.d.ts +5 -2
- package/dist/memory/memory-search.d.ts.map +1 -1
- package/dist/memory/memory-search.js +27 -10
- package/dist/memory/memory-search.js.map +1 -1
- package/dist/memory/memory-sync.d.ts.map +1 -1
- package/dist/memory/memory-sync.js +4 -0
- package/dist/memory/memory-sync.js.map +1 -1
- package/dist/memory/notebook.d.ts +7 -0
- package/dist/memory/notebook.d.ts.map +1 -1
- package/dist/memory/notebook.js +62 -9
- package/dist/memory/notebook.js.map +1 -1
- package/dist/network/discovery.d.ts +2 -0
- package/dist/network/discovery.d.ts.map +1 -1
- package/dist/network/discovery.js +10 -5
- package/dist/network/discovery.js.map +1 -1
- package/dist/network/global-proxy.d.ts +7 -0
- package/dist/network/global-proxy.d.ts.map +1 -1
- package/dist/network/global-proxy.js +67 -0
- package/dist/network/global-proxy.js.map +1 -1
- package/dist/network/index.d.ts +6 -1
- package/dist/network/index.d.ts.map +1 -1
- package/dist/network/index.js +16 -11
- package/dist/network/index.js.map +1 -1
- package/dist/network/transport.d.ts +41 -4
- package/dist/network/transport.d.ts.map +1 -1
- package/dist/network/transport.js +234 -61
- package/dist/network/transport.js.map +1 -1
- package/dist/network/types.d.ts +19 -1
- package/dist/network/types.d.ts.map +1 -1
- package/dist/network/types.js.map +1 -1
- package/dist/notifications/cmux.d.ts +115 -0
- package/dist/notifications/cmux.d.ts.map +1 -0
- package/dist/notifications/cmux.js +436 -0
- package/dist/notifications/cmux.js.map +1 -0
- package/dist/prompt/attachments.d.ts +7 -0
- package/dist/prompt/attachments.d.ts.map +1 -1
- package/dist/prompt/attachments.js +57 -0
- package/dist/prompt/attachments.js.map +1 -1
- package/dist/prompt/builder.js +1 -1
- package/dist/prompt/builder.js.map +1 -1
- package/dist/prompt/cache.d.ts +2 -0
- package/dist/prompt/cache.d.ts.map +1 -1
- package/dist/prompt/cache.js +2 -0
- package/dist/prompt/cache.js.map +1 -1
- package/dist/prompt/templates.d.ts +1 -1
- package/dist/prompt/templates.d.ts.map +1 -1
- package/dist/prompt/templates.js +4 -3
- package/dist/prompt/templates.js.map +1 -1
- package/dist/prompt/types.d.ts +3 -1
- package/dist/prompt/types.d.ts.map +1 -1
- package/dist/prompt/types.js.map +1 -1
- package/dist/proxy/server.d.ts.map +1 -1
- package/dist/proxy/server.js +32 -11
- package/dist/proxy/server.js.map +1 -1
- package/dist/search/ripgrep.d.ts.map +1 -1
- package/dist/search/ripgrep.js +11 -0
- package/dist/search/ripgrep.js.map +1 -1
- package/dist/session/index.d.ts +2 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +1 -0
- package/dist/session/index.js.map +1 -1
- package/dist/skills/builtin/algorithmic-art/LICENSE.txt +202 -0
- package/dist/skills/builtin/algorithmic-art/SKILL.md +405 -0
- package/dist/skills/builtin/algorithmic-art/templates/generator_template.js +223 -0
- package/dist/skills/builtin/algorithmic-art/templates/viewer.html +599 -0
- package/dist/skills/builtin/analyze-logs/SKILL.md +75 -0
- package/dist/skills/builtin/audit-official/SKILL.md +81 -0
- package/dist/skills/builtin/brand-guidelines/LICENSE.txt +202 -0
- package/dist/skills/builtin/brand-guidelines/SKILL.md +73 -0
- package/dist/skills/builtin/build-portable/SKILL.md +53 -0
- package/dist/skills/builtin/canvas-design/SKILL.md +130 -0
- package/dist/skills/builtin/changelog/SKILL.md +65 -0
- package/dist/skills/builtin/code-review/SKILL.md +75 -0
- package/dist/skills/builtin/doc-coauthoring/SKILL.md +375 -0
- package/dist/skills/builtin/doctor/SKILL.md +166 -0
- package/dist/skills/builtin/docx/LICENSE.txt +30 -0
- package/dist/skills/builtin/docx/SKILL.md +590 -0
- package/dist/skills/builtin/docx/scripts/__init__.py +1 -0
- package/dist/skills/builtin/docx/scripts/accept_changes.py +135 -0
- package/dist/skills/builtin/docx/scripts/comment.py +318 -0
- package/dist/skills/builtin/docx/scripts/office/helpers/__init__.py +0 -0
- package/dist/skills/builtin/docx/scripts/office/helpers/merge_runs.py +199 -0
- package/dist/skills/builtin/docx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/dist/skills/builtin/docx/scripts/office/pack.py +159 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/dist/skills/builtin/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/dist/skills/builtin/docx/scripts/office/soffice.py +183 -0
- package/dist/skills/builtin/docx/scripts/office/unpack.py +132 -0
- package/dist/skills/builtin/docx/scripts/office/validate.py +111 -0
- package/dist/skills/builtin/docx/scripts/office/validators/__init__.py +15 -0
- package/dist/skills/builtin/docx/scripts/office/validators/base.py +847 -0
- package/dist/skills/builtin/docx/scripts/office/validators/docx.py +446 -0
- package/dist/skills/builtin/docx/scripts/office/validators/pptx.py +275 -0
- package/dist/skills/builtin/docx/scripts/office/validators/redlining.py +247 -0
- package/dist/skills/builtin/docx/scripts/templates/comments.xml +3 -0
- package/dist/skills/builtin/docx/scripts/templates/commentsExtended.xml +3 -0
- package/dist/skills/builtin/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/dist/skills/builtin/docx/scripts/templates/commentsIds.xml +3 -0
- package/dist/skills/builtin/docx/scripts/templates/people.xml +3 -0
- package/dist/skills/builtin/frontend-design/LICENSE.txt +177 -0
- package/dist/skills/builtin/frontend-design/SKILL.md +42 -0
- package/dist/skills/builtin/i18n-check/SKILL.md +56 -0
- package/dist/skills/builtin/internal-comms/LICENSE.txt +202 -0
- package/dist/skills/builtin/internal-comms/SKILL.md +32 -0
- package/dist/skills/builtin/internal-comms/examples/3p-updates.md +47 -0
- package/dist/skills/builtin/internal-comms/examples/company-newsletter.md +65 -0
- package/dist/skills/builtin/internal-comms/examples/faq-answers.md +30 -0
- package/dist/skills/builtin/internal-comms/examples/general-comms.md +16 -0
- package/dist/skills/builtin/mcp-builder/LICENSE.txt +202 -0
- package/dist/skills/builtin/mcp-builder/SKILL.md +236 -0
- package/dist/skills/builtin/mcp-builder/reference/evaluation.md +602 -0
- package/dist/skills/builtin/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/dist/skills/builtin/mcp-builder/reference/node_mcp_server.md +970 -0
- package/dist/skills/builtin/mcp-builder/reference/python_mcp_server.md +719 -0
- package/dist/skills/builtin/mcp-builder/scripts/connections.py +151 -0
- package/dist/skills/builtin/mcp-builder/scripts/evaluation.py +373 -0
- package/dist/skills/builtin/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/dist/skills/builtin/mcp-builder/scripts/requirements.txt +2 -0
- package/dist/skills/builtin/pdf/LICENSE.txt +30 -0
- package/dist/skills/builtin/pdf/SKILL.md +314 -0
- package/dist/skills/builtin/pdf/forms.md +294 -0
- package/dist/skills/builtin/pdf/reference.md +612 -0
- package/dist/skills/builtin/pdf/scripts/check_bounding_boxes.py +65 -0
- package/dist/skills/builtin/pdf/scripts/check_fillable_fields.py +11 -0
- package/dist/skills/builtin/pdf/scripts/convert_pdf_to_images.py +33 -0
- package/dist/skills/builtin/pdf/scripts/create_validation_image.py +37 -0
- package/dist/skills/builtin/pdf/scripts/extract_form_field_info.py +122 -0
- package/dist/skills/builtin/pdf/scripts/extract_form_structure.py +115 -0
- package/dist/skills/builtin/pdf/scripts/fill_fillable_fields.py +98 -0
- package/dist/skills/builtin/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/dist/skills/builtin/pptx/LICENSE.txt +30 -0
- package/dist/skills/builtin/pptx/SKILL.md +232 -0
- package/dist/skills/builtin/pptx/editing.md +205 -0
- package/dist/skills/builtin/pptx/pptxgenjs.md +420 -0
- package/dist/skills/builtin/pptx/scripts/__init__.py +0 -0
- package/dist/skills/builtin/pptx/scripts/add_slide.py +195 -0
- package/dist/skills/builtin/pptx/scripts/clean.py +286 -0
- package/dist/skills/builtin/pptx/scripts/office/helpers/__init__.py +0 -0
- package/dist/skills/builtin/pptx/scripts/office/helpers/merge_runs.py +199 -0
- package/dist/skills/builtin/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/dist/skills/builtin/pptx/scripts/office/pack.py +159 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/dist/skills/builtin/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/dist/skills/builtin/pptx/scripts/office/soffice.py +183 -0
- package/dist/skills/builtin/pptx/scripts/office/unpack.py +132 -0
- package/dist/skills/builtin/pptx/scripts/office/validate.py +111 -0
- package/dist/skills/builtin/pptx/scripts/office/validators/__init__.py +15 -0
- package/dist/skills/builtin/pptx/scripts/office/validators/base.py +847 -0
- package/dist/skills/builtin/pptx/scripts/office/validators/docx.py +446 -0
- package/dist/skills/builtin/pptx/scripts/office/validators/pptx.py +275 -0
- package/dist/skills/builtin/pptx/scripts/office/validators/redlining.py +247 -0
- package/dist/skills/builtin/pptx/scripts/thumbnail.py +289 -0
- package/dist/skills/builtin/promo-video/SKILL.md +124 -0
- package/dist/skills/builtin/promote/SKILL.md +77 -0
- package/dist/skills/builtin/skill-creator/LICENSE.txt +202 -0
- package/dist/skills/builtin/skill-creator/SKILL.md +598 -0
- package/dist/skills/builtin/skill-creator/agents/analyzer.md +274 -0
- package/dist/skills/builtin/skill-creator/agents/comparator.md +202 -0
- package/dist/skills/builtin/skill-creator/agents/grader.md +223 -0
- package/dist/skills/builtin/skill-creator/assets/eval_review.html +146 -0
- package/dist/skills/builtin/skill-creator/eval-viewer/generate_review.py +471 -0
- package/dist/skills/builtin/skill-creator/eval-viewer/viewer.html +1325 -0
- package/dist/skills/builtin/skill-creator/references/schemas.md +430 -0
- package/dist/skills/builtin/skill-creator/scripts/__init__.py +0 -0
- package/dist/skills/builtin/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/dist/skills/builtin/skill-creator/scripts/generate_report.py +326 -0
- package/dist/skills/builtin/skill-creator/scripts/improve_description.py +248 -0
- package/dist/skills/builtin/skill-creator/scripts/package_skill.py +136 -0
- package/dist/skills/builtin/skill-creator/scripts/quick_validate.py +103 -0
- package/dist/skills/builtin/skill-creator/scripts/run_eval.py +310 -0
- package/dist/skills/builtin/skill-creator/scripts/run_loop.py +332 -0
- package/dist/skills/builtin/skill-creator/scripts/utils.py +47 -0
- package/dist/skills/builtin/slack-gif-creator/LICENSE.txt +202 -0
- package/dist/skills/builtin/slack-gif-creator/SKILL.md +254 -0
- package/dist/skills/builtin/slack-gif-creator/core/easing.py +234 -0
- package/dist/skills/builtin/slack-gif-creator/core/frame_composer.py +176 -0
- package/dist/skills/builtin/slack-gif-creator/core/gif_builder.py +269 -0
- package/dist/skills/builtin/slack-gif-creator/core/validators.py +136 -0
- package/dist/skills/builtin/slack-gif-creator/requirements.txt +4 -0
- package/dist/skills/builtin/sync-version/SKILL.md +39 -0
- package/dist/skills/builtin/theme-factory/LICENSE.txt +202 -0
- package/dist/skills/builtin/theme-factory/SKILL.md +59 -0
- package/dist/skills/builtin/theme-factory/theme-showcase.pdf +0 -0
- package/dist/skills/builtin/theme-factory/themes/arctic-frost.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/botanical-garden.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/desert-rose.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/forest-canopy.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/golden-hour.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/midnight-galaxy.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/modern-minimalist.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/ocean-depths.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/sunset-boulevard.md +19 -0
- package/dist/skills/builtin/theme-factory/themes/tech-innovation.md +19 -0
- package/dist/skills/builtin/web-artifacts-builder/LICENSE.txt +202 -0
- package/dist/skills/builtin/web-artifacts-builder/SKILL.md +74 -0
- package/dist/skills/builtin/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/dist/skills/builtin/web-artifacts-builder/scripts/init-artifact.sh +322 -0
- package/dist/skills/builtin/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/dist/skills/builtin/webapp-testing/LICENSE.txt +202 -0
- package/dist/skills/builtin/webapp-testing/SKILL.md +96 -0
- package/dist/skills/builtin/webapp-testing/examples/console_logging.py +35 -0
- package/dist/skills/builtin/webapp-testing/examples/element_discovery.py +40 -0
- package/dist/skills/builtin/webapp-testing/examples/static_html_automation.py +33 -0
- package/dist/skills/builtin/webapp-testing/scripts/with_server.py +106 -0
- package/dist/skills/builtin/xlsx/LICENSE.txt +30 -0
- package/dist/skills/builtin/xlsx/SKILL.md +292 -0
- package/dist/skills/builtin/xlsx/scripts/office/helpers/__init__.py +0 -0
- package/dist/skills/builtin/xlsx/scripts/office/helpers/merge_runs.py +199 -0
- package/dist/skills/builtin/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/dist/skills/builtin/xlsx/scripts/office/pack.py +159 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/dist/skills/builtin/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/dist/skills/builtin/xlsx/scripts/office/soffice.py +183 -0
- package/dist/skills/builtin/xlsx/scripts/office/unpack.py +132 -0
- package/dist/skills/builtin/xlsx/scripts/office/validate.py +111 -0
- package/dist/skills/builtin/xlsx/scripts/office/validators/__init__.py +15 -0
- package/dist/skills/builtin/xlsx/scripts/office/validators/base.py +847 -0
- package/dist/skills/builtin/xlsx/scripts/office/validators/docx.py +446 -0
- package/dist/skills/builtin/xlsx/scripts/office/validators/pptx.py +275 -0
- package/dist/skills/builtin/xlsx/scripts/office/validators/redlining.py +247 -0
- package/dist/skills/builtin/xlsx/scripts/recalc.py +184 -0
- package/dist/tools/base.d.ts +16 -0
- package/dist/tools/base.d.ts.map +1 -1
- package/dist/tools/base.js +32 -0
- package/dist/tools/base.js.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +8 -0
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/file.d.ts +3 -1
- package/dist/tools/file.d.ts.map +1 -1
- package/dist/tools/file.js +116 -126
- package/dist/tools/file.js.map +1 -1
- package/dist/tools/generate-design.d.ts +5 -1
- package/dist/tools/generate-design.d.ts.map +1 -1
- package/dist/tools/generate-design.js +25 -3
- package/dist/tools/generate-design.js.map +1 -1
- package/dist/tools/goal.d.ts +1 -1
- package/dist/tools/goal.d.ts.map +1 -1
- package/dist/tools/goal.js +18 -9
- package/dist/tools/goal.js.map +1 -1
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +67 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/network-agent.js +2 -1
- package/dist/tools/network-agent.js.map +1 -1
- package/dist/tools/schedule.d.ts.map +1 -1
- package/dist/tools/schedule.js +2 -26
- package/dist/tools/schedule.js.map +1 -1
- package/dist/tools/skill.d.ts +1 -1
- package/dist/tools/skill.d.ts.map +1 -1
- package/dist/tools/skill.js +18 -31
- package/dist/tools/skill.js.map +1 -1
- package/dist/web/server/api-manager.d.ts +3 -0
- package/dist/web/server/api-manager.d.ts.map +1 -1
- package/dist/web/server/api-manager.js +128 -12
- package/dist/web/server/api-manager.js.map +1 -1
- package/dist/web/server/app-manager.d.ts +71 -0
- package/dist/web/server/app-manager.d.ts.map +1 -0
- package/dist/web/server/app-manager.js +364 -0
- package/dist/web/server/app-manager.js.map +1 -0
- package/dist/web/server/channels/bridge.d.ts.map +1 -1
- package/dist/web/server/channels/bridge.js +2 -1
- package/dist/web/server/channels/bridge.js.map +1 -1
- package/dist/web/server/codex-auth-manager.d.ts +43 -0
- package/dist/web/server/codex-auth-manager.d.ts.map +1 -0
- package/dist/web/server/codex-auth-manager.js +429 -0
- package/dist/web/server/codex-auth-manager.js.map +1 -0
- package/dist/web/server/conversation.d.ts +34 -5
- package/dist/web/server/conversation.d.ts.map +1 -1
- package/dist/web/server/conversation.js +408 -132
- package/dist/web/server/conversation.js.map +1 -1
- package/dist/web/server/image-attachments.d.ts +23 -0
- package/dist/web/server/image-attachments.d.ts.map +1 -0
- package/dist/web/server/image-attachments.js +93 -0
- package/dist/web/server/image-attachments.js.map +1 -0
- package/dist/web/server/index.d.ts.map +1 -1
- package/dist/web/server/index.js +28 -0
- package/dist/web/server/index.js.map +1 -1
- package/dist/web/server/routes/__tests__/app-api.test.d.ts +5 -0
- package/dist/web/server/routes/__tests__/app-api.test.d.ts.map +1 -0
- package/dist/web/server/routes/__tests__/app-api.test.js +48 -0
- package/dist/web/server/routes/__tests__/app-api.test.js.map +1 -0
- package/dist/web/server/routes/__tests__/tunnel-api.test.d.ts +2 -0
- package/dist/web/server/routes/__tests__/tunnel-api.test.d.ts.map +1 -0
- package/dist/web/server/routes/__tests__/tunnel-api.test.js +96 -0
- package/dist/web/server/routes/__tests__/tunnel-api.test.js.map +1 -0
- package/dist/web/server/routes/ai-editor.d.ts.map +1 -1
- package/dist/web/server/routes/ai-editor.js +9 -45
- package/dist/web/server/routes/ai-editor.js.map +1 -1
- package/dist/web/server/routes/ai-hover.d.ts.map +1 -1
- package/dist/web/server/routes/ai-hover.js +6 -23
- package/dist/web/server/routes/ai-hover.js.map +1 -1
- package/dist/web/server/routes/api.d.ts.map +1 -1
- package/dist/web/server/routes/api.js +27 -20
- package/dist/web/server/routes/api.js.map +1 -1
- package/dist/web/server/routes/app-api.d.ts +8 -0
- package/dist/web/server/routes/app-api.d.ts.map +1 -0
- package/dist/web/server/routes/app-api.js +191 -0
- package/dist/web/server/routes/app-api.js.map +1 -0
- package/dist/web/server/routes/auth.d.ts.map +1 -1
- package/dist/web/server/routes/auth.js +306 -5
- package/dist/web/server/routes/auth.js.map +1 -1
- package/dist/web/server/routes/autocomplete-api.d.ts.map +1 -1
- package/dist/web/server/routes/autocomplete-api.js +5 -43
- package/dist/web/server/routes/autocomplete-api.js.map +1 -1
- package/dist/web/server/routes/axon-cloud.d.ts.map +1 -1
- package/dist/web/server/routes/axon-cloud.js +2 -0
- package/dist/web/server/routes/axon-cloud.js.map +1 -1
- package/dist/web/server/routes/network-api.d.ts +1 -0
- package/dist/web/server/routes/network-api.d.ts.map +1 -1
- package/dist/web/server/routes/network-api.js +36 -11
- package/dist/web/server/routes/network-api.js.map +1 -1
- package/dist/web/server/routes/port-forward.d.ts.map +1 -1
- package/dist/web/server/routes/port-forward.js +3 -2
- package/dist/web/server/routes/port-forward.js.map +1 -1
- package/dist/web/server/routes/schedule-api.d.ts.map +1 -1
- package/dist/web/server/routes/schedule-api.js +5 -1
- package/dist/web/server/routes/schedule-api.js.map +1 -1
- package/dist/web/server/routes/tunnel-api.d.ts +14 -0
- package/dist/web/server/routes/tunnel-api.d.ts.map +1 -0
- package/dist/web/server/routes/tunnel-api.js +52 -0
- package/dist/web/server/routes/tunnel-api.js.map +1 -0
- package/dist/web/server/runtime/codex-client.d.ts +30 -0
- package/dist/web/server/runtime/codex-client.d.ts.map +1 -0
- package/dist/web/server/runtime/codex-client.js +1002 -0
- package/dist/web/server/runtime/codex-client.js.map +1 -0
- package/dist/web/server/runtime/factory.d.ts +3 -0
- package/dist/web/server/runtime/factory.d.ts.map +1 -0
- package/dist/web/server/runtime/factory.js +16 -0
- package/dist/web/server/runtime/factory.js.map +1 -0
- package/dist/web/server/runtime/runtime-selection.d.ts +16 -0
- package/dist/web/server/runtime/runtime-selection.d.ts.map +1 -0
- package/dist/web/server/runtime/runtime-selection.js +33 -0
- package/dist/web/server/runtime/runtime-selection.js.map +1 -0
- package/dist/web/server/runtime/tool-input-normalizer.d.ts +3 -0
- package/dist/web/server/runtime/tool-input-normalizer.d.ts.map +1 -0
- package/dist/web/server/runtime/tool-input-normalizer.js +52 -0
- package/dist/web/server/runtime/tool-input-normalizer.js.map +1 -0
- package/dist/web/server/runtime/types.d.ts +97 -0
- package/dist/web/server/runtime/types.d.ts.map +1 -0
- package/dist/web/server/runtime/types.js +2 -0
- package/dist/web/server/runtime/types.js.map +1 -0
- package/dist/web/server/runtime/utility-client.d.ts +5 -0
- package/dist/web/server/runtime/utility-client.d.ts.map +1 -0
- package/dist/web/server/runtime/utility-client.js +65 -0
- package/dist/web/server/runtime/utility-client.js.map +1 -0
- package/dist/web/server/services/config-service.d.ts +7 -2
- package/dist/web/server/services/config-service.d.ts.map +1 -1
- package/dist/web/server/services/config-service.js +41 -0
- package/dist/web/server/services/config-service.js.map +1 -1
- package/dist/web/server/services/gemini-image-service.d.ts +20 -1
- package/dist/web/server/services/gemini-image-service.d.ts.map +1 -1
- package/dist/web/server/services/gemini-image-service.js +121 -13
- package/dist/web/server/services/gemini-image-service.js.map +1 -1
- package/dist/web/server/session-manager.d.ts +1 -0
- package/dist/web/server/session-manager.d.ts.map +1 -1
- package/dist/web/server/session-manager.js +1 -0
- package/dist/web/server/session-manager.js.map +1 -1
- package/dist/web/server/slash-commands.d.ts.map +1 -1
- package/dist/web/server/slash-commands.js +59 -17
- package/dist/web/server/slash-commands.js.map +1 -1
- package/dist/web/server/tunnel.d.ts +47 -0
- package/dist/web/server/tunnel.d.ts.map +1 -0
- package/dist/web/server/tunnel.js +165 -0
- package/dist/web/server/tunnel.js.map +1 -0
- package/dist/web/server/user-interaction.d.ts +10 -0
- package/dist/web/server/user-interaction.d.ts.map +1 -1
- package/dist/web/server/user-interaction.js +28 -0
- package/dist/web/server/user-interaction.js.map +1 -1
- package/dist/web/server/web-auth.d.ts +35 -3
- package/dist/web/server/web-auth.d.ts.map +1 -1
- package/dist/web/server/web-auth.js +298 -29
- package/dist/web/server/web-auth.js.map +1 -1
- package/dist/web/server/web-scheduler.d.ts.map +1 -1
- package/dist/web/server/web-scheduler.js +9 -0
- package/dist/web/server/web-scheduler.js.map +1 -1
- package/dist/web/server/websocket-git-handlers.d.ts.map +1 -1
- package/dist/web/server/websocket-git-handlers.js +5 -29
- package/dist/web/server/websocket-git-handlers.js.map +1 -1
- package/dist/web/server/websocket.d.ts.map +1 -1
- package/dist/web/server/websocket.js +193 -44
- package/dist/web/server/websocket.js.map +1 -1
- package/dist/web/shared/auth-summary.d.ts +28 -0
- package/dist/web/shared/auth-summary.d.ts.map +1 -0
- package/dist/web/shared/auth-summary.js +53 -0
- package/dist/web/shared/auth-summary.js.map +1 -0
- package/dist/web/shared/model-catalog.d.ts +30 -0
- package/dist/web/shared/model-catalog.d.ts.map +1 -0
- package/dist/web/shared/model-catalog.js +373 -0
- package/dist/web/shared/model-catalog.js.map +1 -0
- package/dist/web/shared/model-preferences.d.ts +5 -0
- package/dist/web/shared/model-preferences.d.ts.map +1 -0
- package/dist/web/shared/model-preferences.js +13 -0
- package/dist/web/shared/model-preferences.js.map +1 -0
- package/dist/web/shared/setup-runtime.d.ts +27 -0
- package/dist/web/shared/setup-runtime.d.ts.map +1 -0
- package/dist/web/shared/setup-runtime.js +114 -0
- package/dist/web/shared/setup-runtime.js.map +1 -0
- package/dist/web/shared/thinking-config.d.ts +20 -0
- package/dist/web/shared/thinking-config.d.ts.map +1 -0
- package/dist/web/shared/thinking-config.js +99 -0
- package/dist/web/shared/thinking-config.js.map +1 -0
- package/dist/web/shared/types.d.ts +22 -2
- package/dist/web/shared/types.d.ts.map +1 -1
- package/dist/web/shared/types.js.map +1 -1
- package/electron/main.cjs +7 -2
- package/package.json +4 -2
- package/src/web/client/dist/assets/index-B0gwq5PJ.js +727 -0
- package/src/web/client/dist/assets/index-CwhuMLtk.css +32 -0
- package/src/web/client/dist/icons/icon-192.png +0 -0
- package/src/web/client/dist/icons/icon-512.png +0 -0
- package/src/web/client/dist/index.html +31 -0
- package/src/web/client/dist/logo.png +0 -0
- package/src/web/client/dist/manifest.webmanifest +25 -0
- 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:
|
|
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:
|
|
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
|
-
//
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
client.
|
|
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,
|
|
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
|
|
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
|
-
|
|
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
|
-
//
|
|
1991
|
+
// 提取图片附件(视觉输入 + 稳定临时文件路径)
|
|
1957
1992
|
mediaAttachments = typedAttachments
|
|
1958
1993
|
.filter(att => att.type === 'image')
|
|
1959
|
-
.map(att =>
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
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
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
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
|
-
},
|
|
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
|
|
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
|
|
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:
|
|
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 =
|
|
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:
|
|
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
|
|
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: {
|
|
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.
|
|
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: {
|
|
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 {
|