minimal-agent 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -12
- package/package.json +34 -1
- package/plugins/cron-runner/.claude-plugin/plugin.json +5 -0
- package/plugins/cron-runner/commands/cron.md +26 -0
- package/plugins/cron-runner/commands/crons.md +7 -0
- package/plugins/cron-runner/plugin.js +34 -0
- package/plugins/cron-runner/src/commands.js +348 -0
- package/plugins/cron-runner/src/cronTime.js +148 -0
- package/plugins/cron-runner/src/lock.js +68 -0
- package/plugins/cron-runner/src/runs.js +89 -0
- package/plugins/cron-runner/src/scheduleEngine.js +72 -0
- package/plugins/cron-runner/src/scheduler.js +355 -0
- package/plugins/cron-runner/src/schema.js +140 -0
- package/plugins/cron-runner/src/service.js +167 -0
- package/plugins/cron-runner/src/store.js +298 -0
- package/plugins/cron-runner/src/types.js +1 -0
- package/plugins/workflow-runner/commands/workflow.md +4 -4
- package/plugins/workflow-runner/commands/workflows.md +1 -1
- package/plugins/workflow-runner/plugin.js +3 -1
- package/plugins/workflow-runner/src/agentCommon.js +249 -51
- package/plugins/workflow-runner/src/dslManifest.js +72 -0
- package/plugins/workflow-runner/src/expressions.js +198 -15
- package/plugins/workflow-runner/src/index.js +40 -8
- package/plugins/workflow-runner/src/jsonPayload.js +1 -1
- package/plugins/workflow-runner/src/loader.js +286 -72
- package/plugins/workflow-runner/src/multimodal.js +37 -0
- package/plugins/workflow-runner/src/recovery.js +49 -39
- package/plugins/workflow-runner/src/runner.js +802 -287
- package/plugins/workflow-runner/src/stepExecutors/agent.js +157 -39
- package/plugins/workflow-runner/src/stepExecutors/assert.js +16 -3
- package/plugins/workflow-runner/src/stepExecutors/llm.js +60 -111
- package/plugins/workflow-runner/src/stepExecutors/skill.js +47 -47
- package/plugins/workflow-runner/src/stepExecutors/tool.js +76 -10
- package/plugins/workflow-runner/src/stepExecutors/verify.js +27 -10
- package/plugins/workflow-runner/src/taskIdentity.js +296 -0
- package/plugins/workflow-runner/src/types.js +19 -9
- package/plugins/workflow-runner/src/workflowState.js +516 -33
- package/skills/adversarial-review/SKILL.md +0 -1
- package/skills/ai-image/SKILL.md +89 -0
- package/skills/ai-image/scripts/generate.mjs +497 -0
- package/skills/ai-image/scripts/generate_from_plan.mjs +469 -0
- package/skills/ai-image/scripts/generate_from_plan_test.mjs +223 -0
- package/skills/ai-image/scripts/generate_test.mjs +74 -0
- package/skills/browser-automation/SKILL.md +47 -0
- package/skills/docx/SKILL.md +25 -3
- package/skills/docx/scripts/office/helpers/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/helpers/__pycache__/merge_runs.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/helpers/__pycache__/simplify_redlines.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/base.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/docx.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/pptx.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/redlining.cpython-314.pyc +0 -0
- package/skills/docx/scripts/opc_check.py +253 -0
- package/skills/image-gen-openrouter/SKILL.md +10 -2
- package/skills/image-stats/SKILL.md +65 -0
- package/skills/image-stats/scripts/__pycache__/image_stats.cpython-314.pyc +0 -0
- package/skills/image-stats/scripts/__pycache__/image_stats_test.cpython-314.pyc +0 -0
- package/skills/image-stats/scripts/image_stats.py +368 -0
- package/skills/image-stats/scripts/image_stats_test.py +181 -0
- package/skills/pptx/SKILL.md +123 -95
- package/skills/pptx/design.md +82 -0
- package/skills/pptx/examples/README.md +29 -0
- package/skills/pptx/examples/hybrid_example.mjs +107 -0
- package/skills/pptx/examples/hybrid_example.pptx +0 -0
- package/skills/pptx/pptxgenjs.md +41 -0
- package/skills/pptx/scripts/deck_helpers.mjs +224 -0
- package/skills/pptx/scripts/layout_lint.py +293 -0
- package/skills/pptx/scripts/layout_lint_test.py +160 -0
- package/skills/pptx/scripts/opc_check.py +339 -0
- package/skills/pptx/scripts/svg_fallback.mjs +145 -0
- package/skills/pptx/svg.md +67 -0
- package/skills/tts-zh/SKILL.md +19 -2
- package/skills/ui-design/SKILL.md +158 -0
- package/skills/ui-design/claude_design.md +309 -0
- package/skills/ui-design/evals/evals.json +254 -0
- package/skills/ui-design/references/aesthetic-direction.md +83 -0
- package/skills/ui-design/references/claude-design-protocol.md +36 -0
- package/skills/ui-design/references/design-context.md +53 -0
- package/skills/ui-design/references/design-execution-playbook.md +82 -0
- package/skills/ui-design/references/export-pptx.md +124 -0
- package/skills/ui-design/references/layout-composition.md +654 -0
- package/skills/ui-design/references/preview-feedback.md +37 -0
- package/skills/ui-design/references/source-image-layout.md +189 -0
- package/skills/ui-design/references/starter-components.md +78 -0
- package/skills/ui-design/references/vi-aegis-vector.md +144 -0
- package/skills/ui-design/references/vi-amber-prism.md +133 -0
- package/skills/ui-design/references/vi-aqua-glass.md +200 -0
- package/skills/ui-design/references/vi-comfort-vision.md +147 -0
- package/skills/ui-design/references/vi-ember-prism.md +140 -0
- package/skills/ui-design/references/vi-nebula-console.md +151 -0
- package/skills/ui-design/references/vi-obsidian-optics.md +139 -0
- package/skills/ui-design/references/vi-obsidian-xui.md +143 -0
- package/skills/ui-design/references/vi-precision-horizon-dark.md +117 -0
- package/skills/ui-design/references/vi-precision-horizon.md +215 -0
- package/skills/ui-design/references/vi-solar-relay.md +130 -0
- package/skills/ui-design/references/vi-template-workflow.md +48 -0
- package/skills/ui-design/references/vi-verdant-grid.md +141 -0
- package/skills/ui-design/references/vi-violet-meridian.md +172 -0
- package/skills/ui-design/scripts/__pycache__/assemble_material.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/assemble_material_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/chart_sanity_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_language_policy.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_ui_artifact.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_ui_artifact_pptx_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_pages_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_pages_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_visual_style_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_visual_style_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_budget_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_budget_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_repair_hints.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_repair_hints_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_style_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_style_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/draft_coverage_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/extract_source_assets.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/extract_source_assets_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/generated_image_review_collect.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/generated_image_review_collect_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_plan_lint.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_plan_lint_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_prompt_rewrite.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_prompt_rewrite_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/layout_balance.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/layout_balance_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/normalize_design_json.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/normalize_design_json_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/plan_source_layout.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/plan_source_layout_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_hint.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_hint_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_input.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_input_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/scaffold_ui_artifact.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/source_usage_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/source_usage_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/text_readability_pixel.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/visual_quality_gate.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/visual_quality_gate_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/assemble_material.py +217 -0
- package/skills/ui-design/scripts/assemble_material_test.py +149 -0
- package/skills/ui-design/scripts/browser_check_ui_artifact.mjs +221 -0
- package/skills/ui-design/scripts/chart_sanity_check.py +261 -0
- package/skills/ui-design/scripts/chart_sanity_check_test.py +165 -0
- package/skills/ui-design/scripts/check_language_policy.py +351 -0
- package/skills/ui-design/scripts/check_ui_artifact.py +435 -0
- package/skills/ui-design/scripts/check_ui_artifact_pptx_test.py +251 -0
- package/skills/ui-design/scripts/deck_pages_check.py +158 -0
- package/skills/ui-design/scripts/deck_pages_check_test.py +134 -0
- package/skills/ui-design/scripts/deck_visual_style_check.py +767 -0
- package/skills/ui-design/scripts/deck_visual_style_check_test.py +713 -0
- package/skills/ui-design/scripts/design_budget_check.py +271 -0
- package/skills/ui-design/scripts/design_budget_check_test.py +183 -0
- package/skills/ui-design/scripts/design_repair_hints.py +162 -0
- package/skills/ui-design/scripts/design_repair_hints_test.py +54 -0
- package/skills/ui-design/scripts/design_style_check.py +397 -0
- package/skills/ui-design/scripts/design_style_check_test.py +233 -0
- package/skills/ui-design/scripts/draft_coverage_check.py +184 -0
- package/skills/ui-design/scripts/draft_coverage_check_test.py +131 -0
- package/skills/ui-design/scripts/export_pptx_from_html.mjs +2367 -0
- package/skills/ui-design/scripts/extract_source_assets.py +607 -0
- package/skills/ui-design/scripts/extract_source_assets_test.py +256 -0
- package/skills/ui-design/scripts/generated_image_review_collect.py +206 -0
- package/skills/ui-design/scripts/generated_image_review_collect_test.py +91 -0
- package/skills/ui-design/scripts/image_plan_lint.py +571 -0
- package/skills/ui-design/scripts/image_plan_lint_test.py +515 -0
- package/skills/ui-design/scripts/image_prompt_rewrite.py +713 -0
- package/skills/ui-design/scripts/image_prompt_rewrite_test.py +966 -0
- package/skills/ui-design/scripts/layout_balance.py +881 -0
- package/skills/ui-design/scripts/layout_balance_test.py +927 -0
- package/skills/ui-design/scripts/normalize_design_json.py +272 -0
- package/skills/ui-design/scripts/normalize_design_json_test.py +119 -0
- package/skills/ui-design/scripts/plan_source_layout.py +1450 -0
- package/skills/ui-design/scripts/plan_source_layout_test.py +1136 -0
- package/skills/ui-design/scripts/resolve_source_input.py +270 -0
- package/skills/ui-design/scripts/resolve_source_input_test.py +98 -0
- package/skills/ui-design/scripts/scaffold_ui_artifact.py +377 -0
- package/skills/ui-design/scripts/source_usage_check.py +581 -0
- package/skills/ui-design/scripts/source_usage_check_test.py +427 -0
- package/skills/ui-design/scripts/text_readability_pixel.py +340 -0
- package/skills/ui-design/scripts/text_readability_pixel_test.py +219 -0
- package/skills/ui-design/scripts/visual_quality_gate.py +301 -0
- package/skills/ui-design/scripts/visual_quality_gate_test.py +233 -0
- package/skills/ui-design/tests/e2e/prompts/deck.md +19 -0
- package/skills/ui-design/tests/e2e/prompts/webpage.md +17 -0
- package/skills/ui-design/tests/e2e/render_check.mjs +101 -0
- package/skills/ui-design/tests/e2e/rubric.json +54 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/language-check.txt +12 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/static-check.txt +15 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/outputs/index.html +837 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/review.md +21 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/outputs/homepage.html +373 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/outputs/platform.html +378 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/outputs/index.html +656 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/render_check.mjs +67 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/outputs/index.html +587 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/review.md +36 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/language-check.txt +8 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/static-check.txt +16 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/outputs/index.html +739 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/prompt.md +11 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/review.md +22 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/checks/browser-check.json +52 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/outputs/index.html +641 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/outputs/index.html +467 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/outputs/homepage.html +373 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/outputs/platform.html +378 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/language-check.txt +4 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/execution_notes.md +10 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/outputs/index.html +587 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/prompt.md +14 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/review.md +13 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/checks/browser-check.json +24 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/execution_notes.md +21 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/outputs/deck.html +451 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/screenshots/slide-01.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/screenshots/slide-02.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/review.md +79 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/checks/browser-check.json +26 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/execution_notes.md +20 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/outputs/index.html +534 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/browser-check.json +64 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/language-check.txt +7 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/static-console.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/static-homepage.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/outputs/console.html +600 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/outputs/homepage.html +556 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/prompt.md +29 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/review.md +57 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/console-desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/console-mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/homepage-desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/homepage-mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/browser-check.json +33 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/language-check.txt +6 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/outputs/index.html +682 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/review.md +59 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/outputs/page-01.html +466 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/outputs/page-02.html +433 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/language-check.txt +3 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/execution_notes.md +24 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/outputs/index.html +723 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/prompt.md +15 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/browser-dark.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/browser-light.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/language-check.txt +11 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/static-dark.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/static-light.txt +3 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/execution_notes.md +23 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/outputs/dark.html +392 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/outputs/light.html +476 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/prompt.md +23 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/review.md +41 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/dark/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/dark/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/light/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/light/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/browser-check.json +54 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/language-check.txt +5 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/outputs/index.html +765 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/prompt.md +15 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/review.md +59 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/outputs/index.html +508 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/browser-check.json +54 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/language-check.txt +6 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/outputs/index.html +788 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/prompt.md +14 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/review.md +60 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/screenshots/mobile.png +0 -0
- package/skills/video-compose/SKILL.md +8 -1
- package/skills/web-crawler/SKILL.md +70 -0
- package/skills/web-crawler/scripts/crawl.mjs +538 -0
- package/skills/web-crawler/scripts/crawl.test.mjs +204 -0
- package/skills/xlsx/SKILL.md +12 -0
- package/skills/xlsx/scripts/opc_check.py +253 -0
- package/src/advisorState.js +22 -0
- package/src/askBridge.js +97 -3
- package/src/bootstrap/workingDir.js +12 -1
- package/src/cli/args.js +17 -1
- package/src/cli/configMenu.js +236 -0
- package/src/cli/configWizard.js +7 -5
- package/src/cli/print.js +37 -4
- package/src/cli/streamJson.js +77 -24
- package/src/cli/wizards/advisorWizard.js +147 -0
- package/src/cli/wizards/fieldForm.js +149 -0
- package/src/cli/wizards/imageWizard.js +60 -0
- package/src/cli/wizards/openRouterWizard.js +23 -0
- package/src/cli/wizards/providerPresets.js +95 -0
- package/src/cli/wizards/providerWizard.js +219 -0
- package/src/cli/wizards/searchWizard.js +23 -0
- package/src/cli/wizards/ttsWizard.js +34 -0
- package/src/config/configFile.js +441 -83
- package/src/config/configService.js +446 -0
- package/src/config.js +24 -64
- package/src/context/agentHome.js +9 -0
- package/src/context/archive.js +7 -2
- package/src/context/compact.js +8 -5
- package/src/context/contextLock.js +81 -0
- package/src/context/persistContext.js +30 -11
- package/src/context/reactiveCompact.js +4 -2
- package/src/context/recentDirs.js +21 -61
- package/src/context/sessionPath.js +97 -23
- package/src/context/sessionRegistry.js +303 -24
- package/src/context/tokenCounter.js +18 -0
- package/src/context/workspaceIndex.js +731 -0
- package/src/infra/verification.js +28 -15
- package/src/llm/client.js +394 -159
- package/src/llm/providers/anthropicFormat.js +241 -0
- package/src/llm/providers/openaiFormat.js +190 -0
- package/src/loop.js +219 -32
- package/src/main.js +61 -11
- package/src/messageQueue.js +97 -0
- package/src/multimodal.js +203 -0
- package/src/plugin-sdk.js +15 -0
- package/src/plugins/commandRouter.js +3 -0
- package/src/plugins/hookEngine.js +5 -1
- package/src/plugins/pluginLifecycle.js +28 -0
- package/src/plugins/pluginLoader.js +2 -1
- package/src/plugins/pluginRunner.js +49 -21
- package/src/plugins/transcript.js +4 -3
- package/src/prompts/pluginList.js +5 -5
- package/src/prompts/projectInstructions.js +3 -3
- package/src/prompts/promptAssembly.js +133 -144
- package/src/prompts/skillList.js +12 -22
- package/src/prompts/system.js +0 -1
- package/src/session/runAgentTurn.js +70 -0
- package/src/session/runTurn.js +41 -6
- package/src/toolGate.js +17 -0
- package/src/tools/advisor/advisor.js +379 -0
- package/src/tools/agent/agent.js +555 -0
- package/src/tools/agent/agentTypes.js +59 -0
- package/src/tools/agent/coordinator.js +93 -0
- package/src/tools/agent/worktree.js +270 -0
- package/src/tools/ask/ask.js +7 -2
- package/src/tools/bash/bash.js +112 -18
- package/src/tools/download/download.js +144 -0
- package/src/tools/edit/edit.js +1 -0
- package/src/tools/edit/multi-edit.js +1 -0
- package/src/tools/genimage/genimage.js +242 -0
- package/src/tools/genspeech/genspeech.js +67 -0
- package/src/tools/glob/glob.js +1 -0
- package/src/tools/grep/grep.js +3 -0
- package/src/tools/grep/rgPath.js +2 -0
- package/src/tools/index.js +25 -2
- package/src/tools/read/read.js +1 -0
- package/src/tools/shared/killTree.js +52 -0
- package/src/tools/toolProgressBridge.js +48 -0
- package/src/tools/webbrowser/agentBrowserPath.js +258 -0
- package/src/tools/webbrowser/browser.js +59 -42
- package/src/tools/webbrowser/browserControl.js +118 -0
- package/src/tools/webbrowser/browserDaemon.js +97 -0
- package/src/tools/webbrowser/browserService.js +27 -0
- package/src/tools/webbrowser/browserStream.js +119 -0
- package/src/tools/webbrowser/webbrowser.js +699 -130
- package/src/tools/webfetch/webfetch.js +1 -0
- package/src/tools/websearch/websearch.js +134 -51
- package/src/tools/write/write.js +1 -0
- package/src/ui/App.js +249 -22
- package/src/ui/AskQuestion.js +29 -10
- package/src/ui/InputBox.js +104 -12
- package/src/ui/LiveArea.js +112 -19
- package/src/ui/MessageList.js +100 -14
- package/src/ui/ModelPicker.js +56 -0
- package/src/ui/QueuedMessagesBanner.js +14 -0
- package/src/ui/Root.js +18 -10
- package/src/ui/SessionPicker.js +102 -0
- package/src/ui/StatusLine.js +13 -4
- package/src/ui/WorkspacePicker.js +55 -0
- package/src/ui/figures.js +44 -0
- package/src/ui/hooks/askSlot.js +82 -0
- package/src/ui/hooks/useChat.js +358 -64
- package/src/ui/hooks/usePasteHandler.js +11 -1
- package/src/ui/hooks/useTextBuffer.js +1 -3
- package/src/ui/liveViewport.js +5 -1
- package/src/ui/markdown.js +206 -0
- package/src/ui/textBuffer.js +0 -7
- package/src/ui/theme.js +32 -0
- package/src/utils/debugLog.js +0 -4
- package/src/utils/resourcePaths.js +2 -2
- package/src/utils/stripThink.js +50 -0
- package/src/web/browserBridge.js +447 -0
- package/src/web/protocol.js +19 -0
- package/workflows/adaptive-research.yaml +13 -5
- package/workflows/book-review-short.yaml +36 -10
- package/workflows/e2e-write-greet.yaml +6 -2
- package/workflows/illustrate.yaml +227 -0
- package/workflows/plan.yaml +460 -179
- package/workflows/ppt.yaml +1659 -0
- package/workflows/ralph-loop.yaml +199 -0
- package/workflows/schema.json +81 -23
- package/workflows/webppt.yaml +496 -0
- package/workflows/word.yaml +710 -0
- package/workflows/youtube-shorts.yaml +46 -15
- package/MINIMAL-TRACE.md +0 -77
- package/plugins/HOW-TO-WRITE-A-PLUGIN.md +0 -186
- package/plugins/ralph-wiggum/.claude-plugin/plugin.json +0 -9
- package/plugins/ralph-wiggum/README.md +0 -197
- package/plugins/ralph-wiggum/commands/cancel-ralph.md +0 -18
- package/plugins/ralph-wiggum/commands/help.md +0 -137
- package/plugins/ralph-wiggum/commands/ralph-loop.md +0 -85
- package/plugins/ralph-wiggum/hooks/hooks.json +0 -15
- package/plugins/ralph-wiggum/hooks/stop-hook.sh +0 -191
- package/plugins/ralph-wiggum/plugin.js +0 -280
- package/plugins/ralph-wiggum/src/goalState.js +0 -258
- package/plugins/ralph-wiggum/src/sentinels.js +0 -76
- package/plugins/ralph-wiggum/src/stopHookRunner.js +0 -104
- package/plugins/ralph-wiggum/src/verificationGate.js +0 -202
- package/plugins/workflow-runner/src/miniReAct.js +0 -223
- package/plugins/workflow-runner/src/voteHelpers.js +0 -110
- package/skills/config/SKILL.md +0 -123
- package/skills/frontend-design/LICENSE.txt +0 -177
- package/skills/frontend-design/SKILL.md +0 -42
- package/src/ui/ProgressPanel.js +0 -54
- package/src/ui/StreamingBlock.js +0 -11
- package/src/ui/ToolStatus.js +0 -11
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ============================================================
|
|
4
|
+
* src/cli/wizards/advisorWizard.tsx —— 顾问模型子向导
|
|
5
|
+
* ------------------------------------------------------------
|
|
6
|
+
* v4 模型列表 schema 下,顾问不再自带一整套独立凭据——默认从已配置的模型列表
|
|
7
|
+
* 选一个复用。但顾问常常需要一个跟基座完全不同的 provider(对比不同模型的
|
|
8
|
+
* 第二意见才有意义),而 CLI 的「配置基座模型」向导只管理基座这一个槽位、
|
|
9
|
+
* 没有别的入口能新增模型——所以这里的模型选择字段里多一项「+ 新建模型」,
|
|
10
|
+
* 选它会先走一小段收集新模型字段的表单,新建成功后再回落到常规的顾问行为
|
|
11
|
+
* 字段(启用/调用模式/预算/超时/敏感共享)。三阶段状态机,全部落盘只发生在
|
|
12
|
+
* 最后一步提交时(ESC 在任何阶段取消都不留半成品模型)。
|
|
13
|
+
* ============================================================
|
|
14
|
+
*/
|
|
15
|
+
import { useState } from 'react';
|
|
16
|
+
import { configService } from '../../config/configService.js';
|
|
17
|
+
import { FieldForm } from './fieldForm.js';
|
|
18
|
+
const NEW_MODEL_OPTION = '+ 新建模型(作为顾问专用,可与基座用不同 provider)';
|
|
19
|
+
function parsePositiveInt(value, fallback) {
|
|
20
|
+
const parsed = Number.parseInt(String(value ?? ''), 10);
|
|
21
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
22
|
+
}
|
|
23
|
+
export function AdvisorWizard({ existing, models, onDone, onCancel }) {
|
|
24
|
+
const enabledModels = models.filter((m) => m.enabled);
|
|
25
|
+
const labelFor = (m, index) => `${index + 1}. ${m.displayName || m.model}`;
|
|
26
|
+
const existingOptions = enabledModels.map(labelFor);
|
|
27
|
+
const labelToId = new Map(enabledModels.map((m, i) => [labelFor(m, i), m.id]));
|
|
28
|
+
const currentLabel = (() => {
|
|
29
|
+
const index = enabledModels.findIndex((m) => m.id === existing?.modelId);
|
|
30
|
+
return index >= 0 ? labelFor(enabledModels[index], index) : undefined;
|
|
31
|
+
})();
|
|
32
|
+
const [phase, setPhase] = useState('model-choice');
|
|
33
|
+
const [chosenModelId, setChosenModelId] = useState(null);
|
|
34
|
+
const [newModelDraft, setNewModelDraft] = useState(null);
|
|
35
|
+
if (phase === 'model-choice') {
|
|
36
|
+
return (_jsx(FieldForm, { title: "\u914D\u7F6E\u987E\u95EE\u6A21\u578B\uFF08Advisor \u5DE5\u5177\uFF09", fields: [
|
|
37
|
+
{
|
|
38
|
+
key: 'modelLabel',
|
|
39
|
+
label: '使用哪个模型',
|
|
40
|
+
type: 'select',
|
|
41
|
+
options: [...existingOptions, NEW_MODEL_OPTION],
|
|
42
|
+
default: currentLabel ?? (existingOptions[0] ?? NEW_MODEL_OPTION),
|
|
43
|
+
hint: enabledModels.length === 0
|
|
44
|
+
? '还没有已配置的模型,只能新建'
|
|
45
|
+
: '可以直接复用基座模型,也可以新建一个专属 provider',
|
|
46
|
+
},
|
|
47
|
+
], onSubmit: async (values) => {
|
|
48
|
+
const label = String(values.modelLabel ?? '');
|
|
49
|
+
if (label === NEW_MODEL_OPTION) {
|
|
50
|
+
setPhase('new-model');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const id = labelToId.get(label);
|
|
54
|
+
if (!id)
|
|
55
|
+
throw new Error('请选择一个模型');
|
|
56
|
+
setChosenModelId(id);
|
|
57
|
+
setPhase('advisor-fields');
|
|
58
|
+
}, onCancel: onCancel }));
|
|
59
|
+
}
|
|
60
|
+
if (phase === 'new-model') {
|
|
61
|
+
return (_jsx(FieldForm, { title: "\u65B0\u5EFA\u987E\u95EE\u4E13\u7528\u6A21\u578B\uFF08\u56FA\u5B9A OpenAI \u517C\u5BB9\u683C\u5F0F\uFF1BAnthropic \u683C\u5F0F\u8BF7\u7528 Desktop \u6DFB\u52A0\uFF09", fields: [
|
|
62
|
+
{ key: 'baseURL', label: 'API 完整端点地址(含 /chat/completions 后缀)', type: 'text', default: '' },
|
|
63
|
+
{ key: 'apiKey', label: 'API Key', type: 'password', default: '' },
|
|
64
|
+
{ key: 'model', label: 'Model', type: 'text', default: '' },
|
|
65
|
+
{ key: 'contextWindow', label: 'Context Window(token 数)', type: 'text', default: '128000', optional: true },
|
|
66
|
+
], onSubmit: async (values) => {
|
|
67
|
+
const baseURL = String(values.baseURL ?? '').trim();
|
|
68
|
+
const apiKey = String(values.apiKey ?? '').trim();
|
|
69
|
+
const model = String(values.model ?? '').trim();
|
|
70
|
+
if (!baseURL || !apiKey || !model)
|
|
71
|
+
throw new Error('Base URL / API Key / Model 均不能为空');
|
|
72
|
+
setNewModelDraft({
|
|
73
|
+
baseURL,
|
|
74
|
+
apiKey,
|
|
75
|
+
model,
|
|
76
|
+
contextWindow: parsePositiveInt(values.contextWindow, 128_000),
|
|
77
|
+
supportsVision: true,
|
|
78
|
+
});
|
|
79
|
+
setPhase('advisor-fields');
|
|
80
|
+
}, onCancel: onCancel }));
|
|
81
|
+
}
|
|
82
|
+
// phase === 'advisor-fields'
|
|
83
|
+
return (_jsx(FieldForm, { title: "\u914D\u7F6E\u987E\u95EE\u6A21\u578B \u00B7 \u884C\u4E3A\u8BBE\u7F6E", fields: [
|
|
84
|
+
{ key: 'enabled', label: '是否启用', type: 'boolean', default: existing?.enabled ?? true },
|
|
85
|
+
{
|
|
86
|
+
key: 'mode',
|
|
87
|
+
label: '调用模式',
|
|
88
|
+
type: 'select',
|
|
89
|
+
options: ['auto', 'manual'],
|
|
90
|
+
default: existing?.mode ?? 'auto',
|
|
91
|
+
hint: 'auto=主循环自主判断时机调用 · manual=仅 /advisor ask 手动触发',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: 'timeoutSeconds',
|
|
95
|
+
label: '最长等待(秒)',
|
|
96
|
+
type: 'text',
|
|
97
|
+
default: String(Math.round((existing?.timeoutMs ?? 180_000) / 1000)),
|
|
98
|
+
optional: true,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: 'shareSensitive',
|
|
102
|
+
label: '是否允许把敏感内容一并发给顾问',
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
default: existing?.shareSensitive ?? false,
|
|
105
|
+
},
|
|
106
|
+
], onSubmit: async (values) => {
|
|
107
|
+
// 只在这最后一步才真正落盘——ESC 在任何前置阶段取消都不留半成品模型。
|
|
108
|
+
// newModelDraft 在 add 成功后立即清空 + 把新 id 记入 chosenModelId:若紧接着
|
|
109
|
+
// 的顾问 patch 失败,FieldForm 在同一 phase 内回到第 1 项重试会重新调这个
|
|
110
|
+
// onSubmit,若不清空 newModelDraft 会重新执行一次 add,产生重复模型。
|
|
111
|
+
let modelId = chosenModelId;
|
|
112
|
+
if (!modelId && newModelDraft) {
|
|
113
|
+
const beforeIds = new Set(models.map((m) => m.id));
|
|
114
|
+
const saved = await configService.savePatch({
|
|
115
|
+
models: [{
|
|
116
|
+
op: 'add',
|
|
117
|
+
model: {
|
|
118
|
+
apiFormat: 'openai',
|
|
119
|
+
baseURL: newModelDraft.baseURL,
|
|
120
|
+
apiKey: newModelDraft.apiKey,
|
|
121
|
+
model: newModelDraft.model,
|
|
122
|
+
contextWindow: newModelDraft.contextWindow,
|
|
123
|
+
supportsVision: newModelDraft.supportsVision,
|
|
124
|
+
enabled: true,
|
|
125
|
+
},
|
|
126
|
+
}],
|
|
127
|
+
});
|
|
128
|
+
modelId = saved.config?.models.find((m) => !beforeIds.has(m.id))?.id ?? null;
|
|
129
|
+
if (modelId) {
|
|
130
|
+
setChosenModelId(modelId);
|
|
131
|
+
setNewModelDraft(null);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!modelId)
|
|
135
|
+
throw new Error('未能确定要使用的模型');
|
|
136
|
+
await configService.savePatch({
|
|
137
|
+
advisor: {
|
|
138
|
+
enabled: values.enabled,
|
|
139
|
+
mode: values.mode === 'manual' ? 'manual' : 'auto',
|
|
140
|
+
modelId,
|
|
141
|
+
shareSensitive: values.shareSensitive,
|
|
142
|
+
timeoutMs: Math.min(180_000, Math.max(15_000, parsePositiveInt(values.timeoutSeconds, 180) * 1000)),
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
onDone();
|
|
146
|
+
}, onCancel: onCancel }));
|
|
147
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ============================================================
|
|
4
|
+
* src/cli/wizards/fieldForm.tsx —— 通用顺序字段录入组件
|
|
5
|
+
* ------------------------------------------------------------
|
|
6
|
+
* 搜索引擎/生图模型/顾问模型/语音合成/OpenRouter 这 5 个子向导只是
|
|
7
|
+
* "字段不同、保存目标不同",录入交互本身完全一样:一次问一个字段,
|
|
8
|
+
* Enter 确认进入下一个,最后一个字段确认后调用 onSubmit(values)。
|
|
9
|
+
* 抽成通用组件避免 5 份几乎相同的状态机(仓库"轻量简洁"原则)。
|
|
10
|
+
*
|
|
11
|
+
* 不支持"返回上一步"——和旧版 configWizard 一致的取舍:ESC 直接取消
|
|
12
|
+
* 整个表单回上一级菜单,不做逐字段回退,简化键位逻辑。
|
|
13
|
+
* ============================================================
|
|
14
|
+
*/
|
|
15
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
16
|
+
import { Box, Text, useInput } from 'ink';
|
|
17
|
+
/** 进入某字段时的 draft 预填:以 seed(已录入值或 default)为准。 */
|
|
18
|
+
function initialDraft(f, seed) {
|
|
19
|
+
if (!f)
|
|
20
|
+
return '';
|
|
21
|
+
if (f.type === 'select') {
|
|
22
|
+
const opts = f.options ?? [];
|
|
23
|
+
const idx = opts.indexOf(String(seed ?? ''));
|
|
24
|
+
return opts[idx >= 0 ? idx : 0] ?? '';
|
|
25
|
+
}
|
|
26
|
+
if (f.type === 'boolean')
|
|
27
|
+
return '';
|
|
28
|
+
return seed !== undefined ? String(seed) : '';
|
|
29
|
+
}
|
|
30
|
+
/** 进入某字段时的高亮预选:boolean 按 seed 定 是/否,select 定位到 seed 项。 */
|
|
31
|
+
function initialSelect(f, seed) {
|
|
32
|
+
if (!f)
|
|
33
|
+
return 0;
|
|
34
|
+
if (f.type === 'select') {
|
|
35
|
+
const opts = f.options ?? [];
|
|
36
|
+
const idx = opts.indexOf(String(seed ?? ''));
|
|
37
|
+
return idx >= 0 ? idx : 0;
|
|
38
|
+
}
|
|
39
|
+
if (f.type === 'boolean')
|
|
40
|
+
return seed === true ? 0 : 1;
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
export function FieldForm({ title, fields, onSubmit, onCancel }) {
|
|
44
|
+
const [index, setIndex] = useState(0);
|
|
45
|
+
const [values, setValues] = useState(() => {
|
|
46
|
+
const initial = {};
|
|
47
|
+
for (const f of fields)
|
|
48
|
+
if (f.default !== undefined)
|
|
49
|
+
initial[f.key] = f.default;
|
|
50
|
+
return initial;
|
|
51
|
+
});
|
|
52
|
+
// 首字段不经过 enterField,预填必须在 useState 初始化器里做——否则
|
|
53
|
+
// boolean 首字段的高亮永远停在"是"(default=false 时直接 Enter 会误改值)。
|
|
54
|
+
const [draft, setDraft] = useState(() => initialDraft(fields[0], fields[0]?.default));
|
|
55
|
+
const [selectIndex, setSelectIndex] = useState(() => initialSelect(fields[0], fields[0]?.default));
|
|
56
|
+
const [phase, setPhase] = useState('input');
|
|
57
|
+
const [errorMsg, setErrorMsg] = useState(null);
|
|
58
|
+
const field = fields[index];
|
|
59
|
+
const enterField = useCallback((i) => {
|
|
60
|
+
const f = fields[i];
|
|
61
|
+
setErrorMsg(null);
|
|
62
|
+
// 优先用已录入的值(保存失败重试时不吞用户敲过的输入),其次才是 default。
|
|
63
|
+
const seed = values[f.key] !== undefined ? values[f.key] : f.default;
|
|
64
|
+
setSelectIndex(initialSelect(f, seed));
|
|
65
|
+
setDraft(initialDraft(f, seed));
|
|
66
|
+
setIndex(i);
|
|
67
|
+
setPhase('input');
|
|
68
|
+
}, [fields, values]);
|
|
69
|
+
const finish = useCallback(async (finalValues) => {
|
|
70
|
+
setPhase('submitting');
|
|
71
|
+
setErrorMsg(null);
|
|
72
|
+
try {
|
|
73
|
+
await onSubmit(finalValues);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
setErrorMsg(e.message || '保存失败');
|
|
77
|
+
setPhase('error');
|
|
78
|
+
}
|
|
79
|
+
}, [onSubmit]);
|
|
80
|
+
const commitField = useCallback((value) => {
|
|
81
|
+
const next = { ...values, [field.key]: value };
|
|
82
|
+
setValues(next);
|
|
83
|
+
if (index + 1 < fields.length) {
|
|
84
|
+
enterField(index + 1);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
void finish(next);
|
|
88
|
+
}
|
|
89
|
+
}, [values, field, index, fields, enterField, finish]);
|
|
90
|
+
useInput((input, key) => {
|
|
91
|
+
if (phase === 'submitting')
|
|
92
|
+
return;
|
|
93
|
+
if (phase === 'error') {
|
|
94
|
+
if (key.return)
|
|
95
|
+
enterField(0);
|
|
96
|
+
else if (key.escape)
|
|
97
|
+
onCancel();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (key.escape) {
|
|
101
|
+
onCancel();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (!field)
|
|
105
|
+
return;
|
|
106
|
+
if (field.type === 'boolean') {
|
|
107
|
+
if (key.upArrow || key.downArrow) {
|
|
108
|
+
setSelectIndex((i) => (i === 0 ? 1 : 0));
|
|
109
|
+
}
|
|
110
|
+
else if (key.return) {
|
|
111
|
+
commitField(selectIndex === 0);
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (field.type === 'select') {
|
|
116
|
+
const opts = field.options ?? [];
|
|
117
|
+
if (key.upArrow) {
|
|
118
|
+
setSelectIndex((i) => (i - 1 + opts.length) % opts.length);
|
|
119
|
+
}
|
|
120
|
+
else if (key.downArrow) {
|
|
121
|
+
setSelectIndex((i) => (i + 1) % opts.length);
|
|
122
|
+
}
|
|
123
|
+
else if (key.return) {
|
|
124
|
+
commitField(opts[selectIndex] ?? '');
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
// text / password
|
|
129
|
+
if (key.return) {
|
|
130
|
+
const trimmed = draft.trim();
|
|
131
|
+
if (trimmed.length === 0) {
|
|
132
|
+
// 留空 Enter:可选字段沿用 default(通常是"保持原值不变");必填字段拦下不提交。
|
|
133
|
+
if (!field.optional)
|
|
134
|
+
return;
|
|
135
|
+
commitField(field.default !== undefined ? String(field.default) : '');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
commitField(trimmed);
|
|
139
|
+
}
|
|
140
|
+
else if (key.backspace || key.delete) {
|
|
141
|
+
setDraft((s) => s.slice(0, -1));
|
|
142
|
+
}
|
|
143
|
+
else if (input && !key.meta && !key.ctrl) {
|
|
144
|
+
setDraft((s) => s + input);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const masked = useMemo(() => '*'.repeat(Math.min(draft.length, 32)), [draft]);
|
|
148
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "cyan", bold: true, children: title }) }), phase !== 'error' && field && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["\u7B2C ", index + 1, "/", fields.length, " \u9879 \u00B7 ", field.label] }), field.type === 'boolean' && (_jsx(Box, { flexDirection: "column", marginTop: 1, children: ['是', '否'].map((label, i) => (_jsxs(Text, { color: i === selectIndex ? 'cyan' : undefined, children: [i === selectIndex ? '> ' : ' ', label] }, label))) })), field.type === 'select' && (_jsx(Box, { flexDirection: "column", marginTop: 1, children: (field.options ?? []).map((opt, i) => (_jsxs(Text, { color: i === selectIndex ? 'cyan' : undefined, children: [i === selectIndex ? '> ' : ' ', opt] }, opt))) })), (field.type === 'text' || field.type === 'password') && (_jsx(Box, { marginTop: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: _jsx(Text, { children: (field.type === 'password' ? masked : draft) || ' ' }) })), field.hint && (_jsx(Text, { color: "gray", children: field.hint })), _jsxs(Text, { color: "gray", children: ["Enter \u786E\u8BA4", field.optional ? '(留空保持不变)' : '', " \u00B7 ESC \u53D6\u6D88\u56DE\u83DC\u5355"] })] })), phase === 'submitting' && (_jsx(Text, { color: "yellow", children: "\u23F3 \u6B63\u5728\u4FDD\u5B58..." })), phase === 'error' && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "red", children: "\u2717 \u4FDD\u5B58\u5931\u8D25" }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "red", children: errorMsg ?? '未知错误' }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "yellow", children: "\u6309 Enter \u56DE\u5230\u7B2C 1 \u9879\u91CD\u8BD5 \u00B7 ESC \u53D6\u6D88\u56DE\u83DC\u5355" }) })] }))] }));
|
|
149
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { configService } from '../../config/configService.js';
|
|
3
|
+
import { FieldForm } from './fieldForm.js';
|
|
4
|
+
export function ImageWizard({ existing, onDone, onCancel }) {
|
|
5
|
+
return (_jsx(FieldForm, { title: "\u914D\u7F6E\u751F\u56FE\u6A21\u578B\uFF08GenerateImage \u5DE5\u5177\uFF09", fields: [
|
|
6
|
+
{
|
|
7
|
+
key: 'provider',
|
|
8
|
+
label: 'Provider 名称(自由填,如 volces / openrouter)',
|
|
9
|
+
type: 'text',
|
|
10
|
+
default: existing?.provider ?? 'custom',
|
|
11
|
+
optional: true,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
key: 'baseURL',
|
|
15
|
+
label: 'API Base URL(OpenAI 兼容协议)',
|
|
16
|
+
type: 'text',
|
|
17
|
+
default: existing?.baseURL ?? '',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
key: 'apiKey',
|
|
21
|
+
label: 'API Key',
|
|
22
|
+
type: 'password',
|
|
23
|
+
default: existing?.apiKey ?? '',
|
|
24
|
+
optional: true,
|
|
25
|
+
hint: '留空 = 保持现有值不变',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: 'model',
|
|
29
|
+
label: 'Model',
|
|
30
|
+
type: 'text',
|
|
31
|
+
default: existing?.model ?? '',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: 'protocol',
|
|
35
|
+
label: '协议(不确定选 auto)',
|
|
36
|
+
type: 'select',
|
|
37
|
+
options: ['auto', 'chat', 'images'],
|
|
38
|
+
default: existing?.protocol ?? 'auto',
|
|
39
|
+
},
|
|
40
|
+
], onSubmit: async (values) => {
|
|
41
|
+
const baseURL = String(values.baseURL ?? '').trim();
|
|
42
|
+
const apiKey = String(values.apiKey ?? '').trim();
|
|
43
|
+
const model = String(values.model ?? '').trim();
|
|
44
|
+
if (!baseURL || !apiKey || !model) {
|
|
45
|
+
throw new Error('Base URL / API Key / Model 均不能为空');
|
|
46
|
+
}
|
|
47
|
+
await configService.savePatch({
|
|
48
|
+
tools: {
|
|
49
|
+
imageGeneration: {
|
|
50
|
+
provider: String(values.provider ?? 'custom').trim() || 'custom',
|
|
51
|
+
baseURL,
|
|
52
|
+
apiKey,
|
|
53
|
+
model,
|
|
54
|
+
protocol: values.protocol ?? 'auto',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
onDone();
|
|
59
|
+
}, onCancel: onCancel }));
|
|
60
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { configService } from '../../config/configService.js';
|
|
3
|
+
import { FieldForm } from './fieldForm.js';
|
|
4
|
+
export function OpenRouterWizard({ existing, onDone, onCancel }) {
|
|
5
|
+
return (_jsx(FieldForm, { title: "\u914D\u7F6E OpenRouter", fields: [
|
|
6
|
+
{
|
|
7
|
+
key: 'apiKey',
|
|
8
|
+
label: 'OpenRouter API Key',
|
|
9
|
+
type: 'password',
|
|
10
|
+
default: existing?.apiKey ?? '',
|
|
11
|
+
optional: true,
|
|
12
|
+
hint: '留空 = 保持现有值不变。申请:https://openrouter.ai/keys',
|
|
13
|
+
},
|
|
14
|
+
], onSubmit: async (values) => {
|
|
15
|
+
const apiKey = String(values.apiKey ?? '').trim();
|
|
16
|
+
if (!apiKey) {
|
|
17
|
+
onDone();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
await configService.savePatch({ tools: { openRouter: { apiKey } } });
|
|
21
|
+
onDone();
|
|
22
|
+
}, onCancel: onCancel }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* src/cli/wizards/providerPresets.ts —— 基座模型预设表(纯逻辑)
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 从旧版 configWizard.tsx 抽出,供 providerWizard.tsx 使用;独立成模块
|
|
6
|
+
* 是为了可以脱离 Ink 单测,也方便以后别的向导(如生图模型)复用同一份
|
|
7
|
+
* baseURL 预设表。
|
|
8
|
+
* ============================================================
|
|
9
|
+
*/
|
|
10
|
+
// 兜底值:custom 或表外 model 都退到这里。
|
|
11
|
+
// 与 src/config.ts 的同名常量含义对齐("既没 env、saved 也没填 contextWindow" 的最终兜底)。
|
|
12
|
+
export const FALLBACK_CONTEXT_WINDOW = 128_000;
|
|
13
|
+
export const PRESETS = [
|
|
14
|
+
{
|
|
15
|
+
name: 'minimax',
|
|
16
|
+
label: 'MiniMax (海螺)',
|
|
17
|
+
baseURL: 'https://api.minimax.chat/v1/chat/completions',
|
|
18
|
+
models: ['MiniMax-M3', 'MiniMax-M2.7', 'MiniMax-M1', 'abab6.5s-chat'],
|
|
19
|
+
contextWindow: 204_800,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
// 火山方舟 ARK Coding Plan —— 一个 endpoint 后挂多个 model id,
|
|
23
|
+
// model 字段大小写严格匹配('glm-5.1' 而非 'GLM-5.1')。
|
|
24
|
+
name: 'volces',
|
|
25
|
+
label: '火山方舟 Coding Plan (ARK)',
|
|
26
|
+
baseURL: 'https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions',
|
|
27
|
+
models: [
|
|
28
|
+
'doubao-seed-2.0-pro',
|
|
29
|
+
'doubao-seed-2.0-code',
|
|
30
|
+
'doubao-seed-code',
|
|
31
|
+
'glm-5.1',
|
|
32
|
+
'minimax-latest',
|
|
33
|
+
'deepseek-v3.2',
|
|
34
|
+
'kimi-k2.7-code',
|
|
35
|
+
'kimi-k2.6',
|
|
36
|
+
],
|
|
37
|
+
contextWindow: 204_800,
|
|
38
|
+
modelContextWindows: {
|
|
39
|
+
'kimi-k2.7-code': 512_000,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'deepseek',
|
|
44
|
+
label: 'DeepSeek',
|
|
45
|
+
baseURL: 'https://api.deepseek.com/v1/chat/completions',
|
|
46
|
+
models: ['deepseek-chat', 'deepseek-reasoner'],
|
|
47
|
+
contextWindow: 128_000,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'openai',
|
|
51
|
+
label: 'OpenAI',
|
|
52
|
+
baseURL: 'https://api.openai.com/v1/chat/completions',
|
|
53
|
+
models: ['gpt-4o', 'gpt-4o-mini'],
|
|
54
|
+
contextWindow: 128_000,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'anthropic',
|
|
58
|
+
label: 'Anthropic',
|
|
59
|
+
baseURL: 'https://api.anthropic.com/v1/messages',
|
|
60
|
+
models: ['claude-sonnet-4-5', 'claude-opus-4-1'],
|
|
61
|
+
contextWindow: 200_000,
|
|
62
|
+
apiFormat: 'anthropic',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'moonshot',
|
|
66
|
+
label: 'Moonshot (Kimi)',
|
|
67
|
+
baseURL: 'https://api.moonshot.cn/v1/chat/completions',
|
|
68
|
+
models: ['moonshot-v1-8k', 'moonshot-v1-32k', 'moonshot-v1-128k'],
|
|
69
|
+
contextWindow: 128_000,
|
|
70
|
+
modelContextWindows: {
|
|
71
|
+
'moonshot-v1-8k': 8_000,
|
|
72
|
+
'moonshot-v1-32k': 32_000,
|
|
73
|
+
'moonshot-v1-128k': 128_000,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'custom',
|
|
78
|
+
label: '自定义(手动填完整请求地址)',
|
|
79
|
+
baseURL: '',
|
|
80
|
+
models: [],
|
|
81
|
+
contextWindow: FALLBACK_CONTEXT_WINDOW,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
export function resolveContextWindow(preset, model) {
|
|
85
|
+
return (preset.modelContextWindows?.[model] ??
|
|
86
|
+
preset.contextWindow ??
|
|
87
|
+
FALLBACK_CONTEXT_WINDOW);
|
|
88
|
+
}
|
|
89
|
+
/** 按 name 找预设索引;找不到(如已有配置是自定义 baseURL)落到 'custom'。 */
|
|
90
|
+
export function findPresetIndex(name) {
|
|
91
|
+
if (!name)
|
|
92
|
+
return 0;
|
|
93
|
+
const i = PRESETS.findIndex((p) => p.name === name);
|
|
94
|
+
return i >= 0 ? i : PRESETS.findIndex((p) => p.name === 'custom');
|
|
95
|
+
}
|