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,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* src/multimodal.ts —— OpenAI 兼容多模态输入辅助
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* v1 支持图片:本地路径 → data URL,公网 URL → 原样 image_url。
|
|
6
|
+
* 这里不调用模型,只负责把 TUI / -p / stream-json 的输入规整成
|
|
7
|
+
* Chat Completions 的 content blocks。
|
|
8
|
+
* ============================================================
|
|
9
|
+
*/
|
|
10
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
11
|
+
import { extname, resolve } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { getWorkingDir } from './bootstrap/workingDir.js';
|
|
14
|
+
export const MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
15
|
+
const IMAGE_MIME_BY_EXT = {
|
|
16
|
+
'.jpg': 'image/jpeg',
|
|
17
|
+
'.jpeg': 'image/jpeg',
|
|
18
|
+
'.png': 'image/png',
|
|
19
|
+
'.gif': 'image/gif',
|
|
20
|
+
'.webp': 'image/webp',
|
|
21
|
+
};
|
|
22
|
+
const IMAGE_EXT_PATTERN = String.raw `(?:png|jpe?g|gif|webp)`;
|
|
23
|
+
export function isSupportedImageSource(source) {
|
|
24
|
+
const clean = stripWrappingQuotes(source.trim());
|
|
25
|
+
if (isHttpUrl(clean)) {
|
|
26
|
+
try {
|
|
27
|
+
const u = new URL(clean);
|
|
28
|
+
return new RegExp(`\\.(${IMAGE_EXT_PATTERN})(?:$|[?#])`, 'i').test(u.pathname);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return Object.hasOwn(IMAGE_MIME_BY_EXT, extname(clean).toLowerCase());
|
|
35
|
+
}
|
|
36
|
+
export function normalizeImageDetail(value) {
|
|
37
|
+
if (value === 'low' || value === 'high' || value === 'default')
|
|
38
|
+
return value;
|
|
39
|
+
return 'default';
|
|
40
|
+
}
|
|
41
|
+
export function contentToPlainText(content) {
|
|
42
|
+
if (typeof content === 'string')
|
|
43
|
+
return content;
|
|
44
|
+
if (content === null)
|
|
45
|
+
return '';
|
|
46
|
+
return content
|
|
47
|
+
.map((part) => {
|
|
48
|
+
if (part.type === 'text')
|
|
49
|
+
return part.text;
|
|
50
|
+
if (part.type === 'image_url')
|
|
51
|
+
return '[图片]';
|
|
52
|
+
if (part.type === 'video_url')
|
|
53
|
+
return '[视频]';
|
|
54
|
+
return '';
|
|
55
|
+
})
|
|
56
|
+
.filter(Boolean)
|
|
57
|
+
.join(' ');
|
|
58
|
+
}
|
|
59
|
+
export function contentToDisplayText(content) {
|
|
60
|
+
if (typeof content === 'string')
|
|
61
|
+
return content;
|
|
62
|
+
if (content === null)
|
|
63
|
+
return '';
|
|
64
|
+
const imageCount = content.filter((p) => p.type === 'image_url').length;
|
|
65
|
+
const videoCount = content.filter((p) => p.type === 'video_url').length;
|
|
66
|
+
const text = content
|
|
67
|
+
.filter((p) => p.type === 'text')
|
|
68
|
+
.map((p) => p.text)
|
|
69
|
+
.join('\n')
|
|
70
|
+
.trim();
|
|
71
|
+
const badges = [
|
|
72
|
+
imageCount > 0 ? `[已附加 ${imageCount} 张图片]` : '',
|
|
73
|
+
videoCount > 0 ? `[已附加 ${videoCount} 个视频]` : '',
|
|
74
|
+
].filter(Boolean);
|
|
75
|
+
return [text, ...badges].filter(Boolean).join('\n');
|
|
76
|
+
}
|
|
77
|
+
export function extractInlineImageInputs(input, defaults = {}) {
|
|
78
|
+
const images = [];
|
|
79
|
+
let text = input;
|
|
80
|
+
const consume = (raw) => {
|
|
81
|
+
const source = stripWrappingQuotes(raw.trim());
|
|
82
|
+
if (!source || !isSupportedImageSource(source))
|
|
83
|
+
return raw;
|
|
84
|
+
images.push({
|
|
85
|
+
source,
|
|
86
|
+
detail: defaults.detail,
|
|
87
|
+
maxLongSidePixel: defaults.maxLongSidePixel,
|
|
88
|
+
});
|
|
89
|
+
return '';
|
|
90
|
+
};
|
|
91
|
+
// @"/path with spaces/a.png" / @'path' / @./a.png / @https://x/a.png
|
|
92
|
+
text = text.replace(/(^|\s)@(?:"([^"]+)"|'([^']+)'|(\S+))/g, (match, prefix, dq, sq, bare) => {
|
|
93
|
+
const before = prefix ?? '';
|
|
94
|
+
const source = dq ?? sq ?? bare ?? '';
|
|
95
|
+
const out = consume(source);
|
|
96
|
+
return out === '' ? before : match;
|
|
97
|
+
});
|
|
98
|
+
// 裸 URL 图片。
|
|
99
|
+
text = text.replace(new RegExp(String.raw `(^|\s)(https?:\/\/\S+?\.${IMAGE_EXT_PATTERN}(?:[?#]\S*)?)`, 'gi'), (match, prefix, source) => {
|
|
100
|
+
const out = consume(source);
|
|
101
|
+
return out === '' ? prefix : match;
|
|
102
|
+
});
|
|
103
|
+
// 裸本地图片路径只支持无空格写法;含空格请用 @"/path with spaces/a.png"。
|
|
104
|
+
text = text.replace(new RegExp(String.raw `(^|\s)((?:\.{1,2}\/|\/|~\/)\S+?\.${IMAGE_EXT_PATTERN})`, 'gi'), (match, prefix, source) => {
|
|
105
|
+
const out = consume(source);
|
|
106
|
+
return out === '' ? prefix : match;
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
text: text.replace(/[ \t]{2,}/g, ' ').replace(/\n{3,}/g, '\n\n').trim(),
|
|
110
|
+
images,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export async function buildUserContent(args) {
|
|
114
|
+
let text = args.text;
|
|
115
|
+
const images = [...(args.images ?? [])];
|
|
116
|
+
if (args.parseInlineImages) {
|
|
117
|
+
const parsed = extractInlineImageInputs(text, {
|
|
118
|
+
detail: args.detail,
|
|
119
|
+
maxLongSidePixel: args.maxLongSidePixel,
|
|
120
|
+
});
|
|
121
|
+
text = parsed.text;
|
|
122
|
+
images.push(...parsed.images);
|
|
123
|
+
}
|
|
124
|
+
if (images.length === 0)
|
|
125
|
+
return text;
|
|
126
|
+
const parts = [];
|
|
127
|
+
const finalText = text.trim() || '请分析这张图片。';
|
|
128
|
+
parts.push({ type: 'text', text: finalText });
|
|
129
|
+
for (const image of images) {
|
|
130
|
+
parts.push(await imageToContentPart(image));
|
|
131
|
+
}
|
|
132
|
+
return parts;
|
|
133
|
+
}
|
|
134
|
+
export async function imageToContentPart(input) {
|
|
135
|
+
const url = await imageSourceToUrl(input.source);
|
|
136
|
+
const image_url = {
|
|
137
|
+
url,
|
|
138
|
+
detail: input.detail ?? 'default',
|
|
139
|
+
};
|
|
140
|
+
if (typeof input.maxLongSidePixel === 'number' && input.maxLongSidePixel > 0) {
|
|
141
|
+
image_url.max_long_side_pixel = Math.floor(input.maxLongSidePixel);
|
|
142
|
+
}
|
|
143
|
+
return { type: 'image_url', image_url };
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 按文件头魔数嗅探图片 MIME(扩展名认不出时的回退)。只认 JPEG/PNG/GIF/WEBP——
|
|
147
|
+
* 与 IMAGE_MIME_BY_EXT 支持集一致(OpenAI 兼容接口可吃这四类)。非图返回 null。
|
|
148
|
+
* 动机:下载来的图常带非标准/无扩展名(如爬虫/配图工作流把候选存成 cand_K.img),
|
|
149
|
+
* 仅按扩展名查会误判「不支持」而拒图——魔数嗅探让任意扩展名的真图都能用。
|
|
150
|
+
*/
|
|
151
|
+
export function sniffImageMime(buf) {
|
|
152
|
+
if (buf.length >= 4 && buf[0] === 0x89 && buf[1] === 0x50 && buf[2] === 0x4e && buf[3] === 0x47)
|
|
153
|
+
return 'image/png';
|
|
154
|
+
if (buf.length >= 3 && buf[0] === 0xff && buf[1] === 0xd8 && buf[2] === 0xff)
|
|
155
|
+
return 'image/jpeg';
|
|
156
|
+
if (buf.length >= 4 && buf[0] === 0x47 && buf[1] === 0x49 && buf[2] === 0x46 && buf[3] === 0x38)
|
|
157
|
+
return 'image/gif';
|
|
158
|
+
if (buf.length >= 12 &&
|
|
159
|
+
buf.toString('ascii', 0, 4) === 'RIFF' &&
|
|
160
|
+
buf.toString('ascii', 8, 12) === 'WEBP')
|
|
161
|
+
return 'image/webp';
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
async function imageSourceToUrl(source) {
|
|
165
|
+
const clean = stripWrappingQuotes(source.trim());
|
|
166
|
+
if (isHttpUrl(clean) || clean.startsWith('data:image/'))
|
|
167
|
+
return clean;
|
|
168
|
+
const filePath = resolveImagePath(clean);
|
|
169
|
+
const st = await stat(filePath).catch((e) => {
|
|
170
|
+
throw new Error(`无法读取图片:${source}(${e.message})`);
|
|
171
|
+
});
|
|
172
|
+
if (!st.isFile())
|
|
173
|
+
throw new Error(`图片路径不是文件:${source}`);
|
|
174
|
+
if (st.size > MAX_IMAGE_BYTES) {
|
|
175
|
+
throw new Error(`图片过大:${source} ${(st.size / 1024 / 1024).toFixed(1)}MB,` +
|
|
176
|
+
`OpenAI 兼容接口单图上限按 10MB 处理。`);
|
|
177
|
+
}
|
|
178
|
+
const data = await readFile(filePath);
|
|
179
|
+
// 先按扩展名查 MIME;认不出(无扩展名 / .img / 扩展名错)再按文件头魔数嗅探,都不认才拒。
|
|
180
|
+
const mime = IMAGE_MIME_BY_EXT[extname(filePath).toLowerCase()] ?? sniffImageMime(data);
|
|
181
|
+
if (!mime) {
|
|
182
|
+
throw new Error(`不支持的图片格式:${source}。仅支持 JPEG/PNG/GIF/WEBP(按扩展名与文件头都未识别)。`);
|
|
183
|
+
}
|
|
184
|
+
return `data:${mime};base64,${data.toString('base64')}`;
|
|
185
|
+
}
|
|
186
|
+
function resolveImagePath(source) {
|
|
187
|
+
if (source.startsWith('file://'))
|
|
188
|
+
return fileURLToPath(source);
|
|
189
|
+
if (source.startsWith('~/')) {
|
|
190
|
+
return resolve(process.env.HOME ?? '', source.slice(2));
|
|
191
|
+
}
|
|
192
|
+
return resolve(getWorkingDir(), source);
|
|
193
|
+
}
|
|
194
|
+
function isHttpUrl(source) {
|
|
195
|
+
return /^https?:\/\//i.test(source);
|
|
196
|
+
}
|
|
197
|
+
function stripWrappingQuotes(value) {
|
|
198
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
199
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
200
|
+
return value.slice(1, -1);
|
|
201
|
+
}
|
|
202
|
+
return value;
|
|
203
|
+
}
|
package/src/plugin-sdk.js
CHANGED
|
@@ -16,9 +16,24 @@
|
|
|
16
16
|
*/
|
|
17
17
|
// --- 运行时入口 ---
|
|
18
18
|
export { runQuery } from './loop.js';
|
|
19
|
+
export { runAgentTurn } from './session/runAgentTurn.js';
|
|
19
20
|
export { chat } from './llm/client.js';
|
|
20
21
|
export { ALL_TOOLS, executeTool, getToolByName } from './tools/index.js';
|
|
22
|
+
// pre-read 守卫状态登记:tool 步覆盖「声明产物」时用来解除内核「先读后写 / 截断禁写」
|
|
23
|
+
// 守卫(确定性步的 args 写死、模型没机会先 Read)。详见 stepExecutors/tool.ts。
|
|
24
|
+
export { recordRead } from './tools/shared/fileState.js';
|
|
21
25
|
export { getWorkingDir } from './bootstrap/workingDir.js';
|
|
26
|
+
export { dlog } from './utils/debugLog.js';
|
|
27
|
+
// <think> 思维链剥离:内核与 workflow-runner 共享(原住 agentCommon.ts,
|
|
28
|
+
// Agent 子任务工具也需要 → 上移内核,插件经此 re-export)。
|
|
29
|
+
export { stripThinkBlocks } from './utils/stripThink.js';
|
|
30
|
+
export { buildFullSystemPrompt } from './prompts/system.js';
|
|
22
31
|
export { getResourceSearchPaths } from './utils/resourcePaths.js';
|
|
32
|
+
// 确定性检查设施:verify 步(shell/file_exists/file_contains/test_count)经此跑校验。
|
|
33
|
+
export { parseCheckString, runVerification } from './infra/verification.js';
|
|
23
34
|
export { triggerHook } from './plugins/hookEngine.js';
|
|
24
35
|
export { createSessionState } from './session/sessionState.js';
|
|
36
|
+
// 会话文件是否真实存在(含 default session 的 legacy 路径回退):
|
|
37
|
+
// cron-runner 等需要在发起回合前判断"绑定的 session 是否还在"时用它,
|
|
38
|
+
// 不要绕过 legacy 回退逻辑自己拼路径。
|
|
39
|
+
export { resolveSessionFile } from './context/sessionPath.js';
|
|
@@ -178,6 +178,9 @@ export function buildCommandInput(resolved) {
|
|
|
178
178
|
}
|
|
179
179
|
return input;
|
|
180
180
|
}
|
|
181
|
+
// 消费方是测试与宿主侧枚举(V1 红线守护测试 pluginRunner.isolation.test.ts 用它
|
|
182
|
+
// 断言「非 / 输入零 discovery 副作用」;commandRouter.test.ts 断言命令清单)——
|
|
183
|
+
// src 内无调用不代表死代码,勿删。
|
|
181
184
|
export function listAvailableCommands() {
|
|
182
185
|
const result = [];
|
|
183
186
|
for (const plugin of pluginCache.values()) {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
import { spawn } from 'node:child_process';
|
|
31
31
|
import { readFile } from 'node:fs/promises';
|
|
32
32
|
import { join } from 'node:path';
|
|
33
|
+
import { sanitizeCredentialEnv } from '../config/configService.js';
|
|
33
34
|
const HOOK_EVENT_NAMES = new Set([
|
|
34
35
|
'PreToolUse',
|
|
35
36
|
'PostToolUse',
|
|
@@ -143,7 +144,7 @@ function runOneHook(hook, payload) {
|
|
|
143
144
|
return;
|
|
144
145
|
}
|
|
145
146
|
const env = {
|
|
146
|
-
...
|
|
147
|
+
...sanitizeCredentialEnv(),
|
|
147
148
|
CLAUDE_PLUGIN_ROOT: hook.pluginRoot,
|
|
148
149
|
};
|
|
149
150
|
let child;
|
|
@@ -183,6 +184,9 @@ function runOneHook(hook, payload) {
|
|
|
183
184
|
child.stdout?.on('data', (data) => {
|
|
184
185
|
stdout += data.toString();
|
|
185
186
|
});
|
|
187
|
+
// stderr 内容不消费但必须排空:spawn 默认 pipe,无 reader 时 hook 往 stderr
|
|
188
|
+
// 写满 ~64KB 管道缓冲会阻塞,硬等到 30s 超时被 SIGTERM。
|
|
189
|
+
child.stderr?.resume();
|
|
186
190
|
child.on('error', () => {
|
|
187
191
|
finalize({ decision: 'pass' });
|
|
188
192
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { discoverPlugins } from './commandRouter.js';
|
|
2
|
+
import { loadPluginApi } from './pluginLoader.js';
|
|
3
|
+
export async function activatePlugins(ctx) {
|
|
4
|
+
const manifests = await discoverPlugins();
|
|
5
|
+
const cleanups = [];
|
|
6
|
+
for (const manifest of manifests) {
|
|
7
|
+
const api = await loadPluginApi(manifest.root);
|
|
8
|
+
if (!api?.activate)
|
|
9
|
+
continue;
|
|
10
|
+
try {
|
|
11
|
+
const cleanup = await api.activate(ctx);
|
|
12
|
+
if (typeof cleanup === 'function')
|
|
13
|
+
cleanups.push(cleanup);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
console.warn(`[minimal-agent] plugin activate failed (${manifest.name}): ${err instanceof Error ? err.message : String(err)}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return () => {
|
|
20
|
+
for (const cleanup of cleanups.reverse()) {
|
|
21
|
+
try {
|
|
22
|
+
cleanup();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ============================================================
|
|
3
|
-
* src/plugins/pluginRunner.ts —— 框架级 slash
|
|
3
|
+
* src/plugins/pluginRunner.ts —— 框架级 slash-激活分发器
|
|
4
4
|
* ------------------------------------------------------------
|
|
5
5
|
* 通用分发器,**不含任何插件特定逻辑**。
|
|
6
6
|
*
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* 2) / 输入 → discoverPlugins → resolveCommand
|
|
10
10
|
* a) 命中插件且其 plugin.ts 暴露 runCommand → 让 plugin.ts 接管
|
|
11
11
|
* b) 命中插件但只有声明式 commands/*.md → 把 prompt 拼好喂给 runQuery
|
|
12
|
-
* c) 未命中 →
|
|
12
|
+
* c) 未命中 → 静默透传 runQuery(/ 只是激活前缀,不是严格命令系统;
|
|
13
|
+
* 未知的 /xxx 当普通用户输入处理,不报错)
|
|
13
14
|
* ============================================================
|
|
14
15
|
*/
|
|
15
16
|
import { discoverPlugins, resolveCommand, buildCommandInput, } from './commandRouter.js';
|
|
@@ -25,36 +26,49 @@ export async function* runWithPlugins(userInput, options) {
|
|
|
25
26
|
signal,
|
|
26
27
|
maxTurns: options.maxTurns,
|
|
27
28
|
sessionState: options.sessionState,
|
|
29
|
+
chat: options.chat,
|
|
30
|
+
executeTool: options.executeTool,
|
|
31
|
+
toolGate: options.toolGate,
|
|
32
|
+
transientContext: options.transientContext,
|
|
33
|
+
userAttachments: options.userAttachments,
|
|
34
|
+
imageInputs: options.imageInputs,
|
|
35
|
+
parseInlineImages: options.parseInlineImages,
|
|
36
|
+
imageDetail: options.imageDetail,
|
|
37
|
+
imageMaxLongSidePixel: options.imageMaxLongSidePixel,
|
|
38
|
+
hasQueuedInput: options.hasQueuedInput,
|
|
39
|
+
onToolStart: options.onToolStart,
|
|
40
|
+
onToolEnd: options.onToolEnd,
|
|
41
|
+
browserRun: options.browserRun,
|
|
28
42
|
});
|
|
29
43
|
return;
|
|
30
44
|
}
|
|
31
|
-
|
|
45
|
+
// 确保插件已发现(resolveCommand 依赖 pluginCache)
|
|
46
|
+
await discoverPlugins();
|
|
32
47
|
const matched = resolveCommand(userInput);
|
|
33
48
|
if (!matched) {
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
const cmdList = manifests.flatMap((m) => m.commands.map((c) => `/${c.name}`)).join('、');
|
|
39
|
-
yield {
|
|
40
|
-
type: 'error',
|
|
41
|
-
error: `未找到命令 "${cmdName}"。已安装的插件命令:${cmdList || '(无)'}。`,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// 无任何插件 → 告知用户
|
|
46
|
-
yield {
|
|
47
|
-
type: 'error',
|
|
48
|
-
error: `当前未安装任何插件。命令 "${cmdName}" 无法执行。`,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
// fallback 到普通 TAOR 对话,用户可继续操作
|
|
49
|
+
// 未命中任何插件命令 → 静默透传 runQuery。
|
|
50
|
+
// / 只是激活前缀(类似 Claude Code 的 / 模式),不是严格命令系统。
|
|
51
|
+
// 用户可能输入 /init、/help、/任何东西 —— 不匹配就当普通对话处理,
|
|
52
|
+
// 让 LLM 自行理解意图。不报错、不提示、不打断用户体验。
|
|
52
53
|
yield* runQuery(userInput, {
|
|
53
54
|
provider,
|
|
54
55
|
history,
|
|
55
56
|
signal,
|
|
56
57
|
maxTurns: options.maxTurns,
|
|
57
58
|
sessionState: options.sessionState,
|
|
59
|
+
chat: options.chat,
|
|
60
|
+
executeTool: options.executeTool,
|
|
61
|
+
toolGate: options.toolGate,
|
|
62
|
+
transientContext: options.transientContext,
|
|
63
|
+
userAttachments: options.userAttachments,
|
|
64
|
+
imageInputs: options.imageInputs,
|
|
65
|
+
parseInlineImages: options.parseInlineImages,
|
|
66
|
+
imageDetail: options.imageDetail,
|
|
67
|
+
imageMaxLongSidePixel: options.imageMaxLongSidePixel,
|
|
68
|
+
hasQueuedInput: options.hasQueuedInput,
|
|
69
|
+
onToolStart: options.onToolStart,
|
|
70
|
+
onToolEnd: options.onToolEnd,
|
|
71
|
+
browserRun: options.browserRun,
|
|
58
72
|
});
|
|
59
73
|
return;
|
|
60
74
|
}
|
|
@@ -67,6 +81,7 @@ export async function* runWithPlugins(userInput, options) {
|
|
|
67
81
|
signal,
|
|
68
82
|
sessionState: options.sessionState,
|
|
69
83
|
maxTurns: options.maxTurns,
|
|
84
|
+
transientContext: options.transientContext,
|
|
70
85
|
});
|
|
71
86
|
return;
|
|
72
87
|
}
|
|
@@ -78,5 +93,18 @@ export async function* runWithPlugins(userInput, options) {
|
|
|
78
93
|
signal,
|
|
79
94
|
maxTurns: options.maxTurns,
|
|
80
95
|
sessionState: options.sessionState,
|
|
96
|
+
chat: options.chat,
|
|
97
|
+
executeTool: options.executeTool,
|
|
98
|
+
toolGate: options.toolGate,
|
|
99
|
+
transientContext: options.transientContext,
|
|
100
|
+
userAttachments: options.userAttachments,
|
|
101
|
+
imageInputs: options.imageInputs,
|
|
102
|
+
parseInlineImages: options.parseInlineImages,
|
|
103
|
+
imageDetail: options.imageDetail,
|
|
104
|
+
imageMaxLongSidePixel: options.imageMaxLongSidePixel,
|
|
105
|
+
hasQueuedInput: options.hasQueuedInput,
|
|
106
|
+
onToolStart: options.onToolStart,
|
|
107
|
+
onToolEnd: options.onToolEnd,
|
|
108
|
+
browserRun: options.browserRun,
|
|
81
109
|
});
|
|
82
110
|
}
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
* ============================================================
|
|
21
21
|
*/
|
|
22
22
|
import { appendFileSync, mkdirSync } from 'node:fs';
|
|
23
|
-
import { homedir } from 'node:os';
|
|
24
23
|
import { join } from 'node:path';
|
|
25
24
|
import { randomUUID } from 'node:crypto';
|
|
25
|
+
import { agentStateDir } from '../context/agentHome.js';
|
|
26
26
|
// 模块级状态:当前会话的 handle(lazy 初始化)
|
|
27
27
|
let current = null;
|
|
28
28
|
function transcriptDir() {
|
|
29
|
-
return join(
|
|
29
|
+
return join(agentStateDir(), 'transcripts');
|
|
30
30
|
}
|
|
31
31
|
function generateSessionId() {
|
|
32
32
|
return `${Date.now().toString(36)}-${randomUUID().slice(0, 8)}`;
|
|
33
33
|
}
|
|
34
34
|
function ensureHandle(sessionId) {
|
|
35
|
-
//
|
|
35
|
+
// 三分支:指定 sessionId 且与当前相同 → 复用;未指定且已有当前 → 复用;
|
|
36
|
+
// 其余(指定了不同 sessionId / 尚无当前)→ 新建句柄(即"切到新文件")。
|
|
36
37
|
if (sessionId && current && current.sessionId === sessionId) {
|
|
37
38
|
return current;
|
|
38
39
|
}
|
|
@@ -28,17 +28,17 @@ export async function getPluginMetaList() {
|
|
|
28
28
|
*
|
|
29
29
|
* 风格对齐 skillList.formatSkillHint():
|
|
30
30
|
* - 每个插件固定格式
|
|
31
|
-
* - 明确标注触发方式("
|
|
31
|
+
* - 明确标注触发方式("由用户通过 /xxx 激活")
|
|
32
32
|
* - 无插件时返回空字符串(调用方自行决定是否追加)
|
|
33
33
|
*/
|
|
34
34
|
export function formatPluginHint(plugins) {
|
|
35
35
|
if (plugins.length === 0)
|
|
36
36
|
return '';
|
|
37
37
|
const lines = [
|
|
38
|
-
'#
|
|
38
|
+
'# 可用插件(/激活)',
|
|
39
39
|
'',
|
|
40
|
-
'
|
|
41
|
-
'
|
|
40
|
+
'以下是当前已安装的插件。插件只能由用户输入 /xxx 激活——**你不能代替用户执行插件命令,也绝不能模拟/伪造插件的输出**。',
|
|
41
|
+
'当用户的需求明显匹配某个插件时(如想定时执行任务而装有 cron 类插件),可以一句话告知对应的 /xxx 命令存在,由用户自己决定是否运行;其余时候不必主动提及插件。',
|
|
42
42
|
'',
|
|
43
43
|
];
|
|
44
44
|
for (const p of plugins) {
|
|
@@ -46,7 +46,7 @@ export function formatPluginHint(plugins) {
|
|
|
46
46
|
lines.push(`- **描述**: ${p.description}`);
|
|
47
47
|
if (p.commands.length > 0) {
|
|
48
48
|
const cmdList = p.commands.map((c) => `\`/${c.name}\``).join('、');
|
|
49
|
-
lines.push(`-
|
|
49
|
+
lines.push(`- **激活**: ${cmdList}`);
|
|
50
50
|
}
|
|
51
51
|
lines.push('');
|
|
52
52
|
}
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* 设计原则:
|
|
14
14
|
* 1. 静默失败:文件不存在时不报错、不打印警告、返回 null
|
|
15
15
|
* 2. 全量注入:不做截断或摘要,原样拼入 messages 数组
|
|
16
|
-
* 3.
|
|
17
|
-
* 4.
|
|
18
|
-
*
|
|
16
|
+
* 3. 实时读取:每次组装系统提示词都重新读(用户改了立即生效)
|
|
17
|
+
* 4. 注入位置:由 assembleBasePrompt 拼进同一个 system prompt 字符串的
|
|
18
|
+
* Layer 5(带时效性声明前缀),不是独立的 system message
|
|
19
19
|
* ============================================================
|
|
20
20
|
*/
|
|
21
21
|
import { readFile } from 'node:fs/promises';
|