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.
Files changed (484) hide show
  1. package/README.md +14 -12
  2. package/package.json +34 -1
  3. package/plugins/cron-runner/.claude-plugin/plugin.json +5 -0
  4. package/plugins/cron-runner/commands/cron.md +26 -0
  5. package/plugins/cron-runner/commands/crons.md +7 -0
  6. package/plugins/cron-runner/plugin.js +34 -0
  7. package/plugins/cron-runner/src/commands.js +348 -0
  8. package/plugins/cron-runner/src/cronTime.js +148 -0
  9. package/plugins/cron-runner/src/lock.js +68 -0
  10. package/plugins/cron-runner/src/runs.js +89 -0
  11. package/plugins/cron-runner/src/scheduleEngine.js +72 -0
  12. package/plugins/cron-runner/src/scheduler.js +355 -0
  13. package/plugins/cron-runner/src/schema.js +140 -0
  14. package/plugins/cron-runner/src/service.js +167 -0
  15. package/plugins/cron-runner/src/store.js +298 -0
  16. package/plugins/cron-runner/src/types.js +1 -0
  17. package/plugins/workflow-runner/commands/workflow.md +4 -4
  18. package/plugins/workflow-runner/commands/workflows.md +1 -1
  19. package/plugins/workflow-runner/plugin.js +3 -1
  20. package/plugins/workflow-runner/src/agentCommon.js +249 -51
  21. package/plugins/workflow-runner/src/dslManifest.js +72 -0
  22. package/plugins/workflow-runner/src/expressions.js +198 -15
  23. package/plugins/workflow-runner/src/index.js +40 -8
  24. package/plugins/workflow-runner/src/jsonPayload.js +1 -1
  25. package/plugins/workflow-runner/src/loader.js +286 -72
  26. package/plugins/workflow-runner/src/multimodal.js +37 -0
  27. package/plugins/workflow-runner/src/recovery.js +49 -39
  28. package/plugins/workflow-runner/src/runner.js +802 -287
  29. package/plugins/workflow-runner/src/stepExecutors/agent.js +157 -39
  30. package/plugins/workflow-runner/src/stepExecutors/assert.js +16 -3
  31. package/plugins/workflow-runner/src/stepExecutors/llm.js +60 -111
  32. package/plugins/workflow-runner/src/stepExecutors/skill.js +47 -47
  33. package/plugins/workflow-runner/src/stepExecutors/tool.js +76 -10
  34. package/plugins/workflow-runner/src/stepExecutors/verify.js +27 -10
  35. package/plugins/workflow-runner/src/taskIdentity.js +296 -0
  36. package/plugins/workflow-runner/src/types.js +19 -9
  37. package/plugins/workflow-runner/src/workflowState.js +516 -33
  38. package/skills/adversarial-review/SKILL.md +0 -1
  39. package/skills/ai-image/SKILL.md +89 -0
  40. package/skills/ai-image/scripts/generate.mjs +497 -0
  41. package/skills/ai-image/scripts/generate_from_plan.mjs +469 -0
  42. package/skills/ai-image/scripts/generate_from_plan_test.mjs +223 -0
  43. package/skills/ai-image/scripts/generate_test.mjs +74 -0
  44. package/skills/browser-automation/SKILL.md +47 -0
  45. package/skills/docx/SKILL.md +25 -3
  46. package/skills/docx/scripts/office/helpers/__pycache__/__init__.cpython-314.pyc +0 -0
  47. package/skills/docx/scripts/office/helpers/__pycache__/merge_runs.cpython-314.pyc +0 -0
  48. package/skills/docx/scripts/office/helpers/__pycache__/simplify_redlines.cpython-314.pyc +0 -0
  49. package/skills/docx/scripts/office/validators/__pycache__/__init__.cpython-314.pyc +0 -0
  50. package/skills/docx/scripts/office/validators/__pycache__/base.cpython-314.pyc +0 -0
  51. package/skills/docx/scripts/office/validators/__pycache__/docx.cpython-314.pyc +0 -0
  52. package/skills/docx/scripts/office/validators/__pycache__/pptx.cpython-314.pyc +0 -0
  53. package/skills/docx/scripts/office/validators/__pycache__/redlining.cpython-314.pyc +0 -0
  54. package/skills/docx/scripts/opc_check.py +253 -0
  55. package/skills/image-gen-openrouter/SKILL.md +10 -2
  56. package/skills/image-stats/SKILL.md +65 -0
  57. package/skills/image-stats/scripts/__pycache__/image_stats.cpython-314.pyc +0 -0
  58. package/skills/image-stats/scripts/__pycache__/image_stats_test.cpython-314.pyc +0 -0
  59. package/skills/image-stats/scripts/image_stats.py +368 -0
  60. package/skills/image-stats/scripts/image_stats_test.py +181 -0
  61. package/skills/pptx/SKILL.md +123 -95
  62. package/skills/pptx/design.md +82 -0
  63. package/skills/pptx/examples/README.md +29 -0
  64. package/skills/pptx/examples/hybrid_example.mjs +107 -0
  65. package/skills/pptx/examples/hybrid_example.pptx +0 -0
  66. package/skills/pptx/pptxgenjs.md +41 -0
  67. package/skills/pptx/scripts/deck_helpers.mjs +224 -0
  68. package/skills/pptx/scripts/layout_lint.py +293 -0
  69. package/skills/pptx/scripts/layout_lint_test.py +160 -0
  70. package/skills/pptx/scripts/opc_check.py +339 -0
  71. package/skills/pptx/scripts/svg_fallback.mjs +145 -0
  72. package/skills/pptx/svg.md +67 -0
  73. package/skills/tts-zh/SKILL.md +19 -2
  74. package/skills/ui-design/SKILL.md +158 -0
  75. package/skills/ui-design/claude_design.md +309 -0
  76. package/skills/ui-design/evals/evals.json +254 -0
  77. package/skills/ui-design/references/aesthetic-direction.md +83 -0
  78. package/skills/ui-design/references/claude-design-protocol.md +36 -0
  79. package/skills/ui-design/references/design-context.md +53 -0
  80. package/skills/ui-design/references/design-execution-playbook.md +82 -0
  81. package/skills/ui-design/references/export-pptx.md +124 -0
  82. package/skills/ui-design/references/layout-composition.md +654 -0
  83. package/skills/ui-design/references/preview-feedback.md +37 -0
  84. package/skills/ui-design/references/source-image-layout.md +189 -0
  85. package/skills/ui-design/references/starter-components.md +78 -0
  86. package/skills/ui-design/references/vi-aegis-vector.md +144 -0
  87. package/skills/ui-design/references/vi-amber-prism.md +133 -0
  88. package/skills/ui-design/references/vi-aqua-glass.md +200 -0
  89. package/skills/ui-design/references/vi-comfort-vision.md +147 -0
  90. package/skills/ui-design/references/vi-ember-prism.md +140 -0
  91. package/skills/ui-design/references/vi-nebula-console.md +151 -0
  92. package/skills/ui-design/references/vi-obsidian-optics.md +139 -0
  93. package/skills/ui-design/references/vi-obsidian-xui.md +143 -0
  94. package/skills/ui-design/references/vi-precision-horizon-dark.md +117 -0
  95. package/skills/ui-design/references/vi-precision-horizon.md +215 -0
  96. package/skills/ui-design/references/vi-solar-relay.md +130 -0
  97. package/skills/ui-design/references/vi-template-workflow.md +48 -0
  98. package/skills/ui-design/references/vi-verdant-grid.md +141 -0
  99. package/skills/ui-design/references/vi-violet-meridian.md +172 -0
  100. package/skills/ui-design/scripts/__pycache__/assemble_material.cpython-314.pyc +0 -0
  101. package/skills/ui-design/scripts/__pycache__/assemble_material_test.cpython-314.pyc +0 -0
  102. package/skills/ui-design/scripts/__pycache__/chart_sanity_check.cpython-314.pyc +0 -0
  103. package/skills/ui-design/scripts/__pycache__/check_language_policy.cpython-314.pyc +0 -0
  104. package/skills/ui-design/scripts/__pycache__/check_ui_artifact.cpython-314.pyc +0 -0
  105. package/skills/ui-design/scripts/__pycache__/check_ui_artifact_pptx_test.cpython-314.pyc +0 -0
  106. package/skills/ui-design/scripts/__pycache__/deck_pages_check.cpython-314.pyc +0 -0
  107. package/skills/ui-design/scripts/__pycache__/deck_pages_check_test.cpython-314.pyc +0 -0
  108. package/skills/ui-design/scripts/__pycache__/deck_visual_style_check.cpython-314.pyc +0 -0
  109. package/skills/ui-design/scripts/__pycache__/deck_visual_style_check_test.cpython-314.pyc +0 -0
  110. package/skills/ui-design/scripts/__pycache__/design_budget_check.cpython-314.pyc +0 -0
  111. package/skills/ui-design/scripts/__pycache__/design_budget_check_test.cpython-314.pyc +0 -0
  112. package/skills/ui-design/scripts/__pycache__/design_repair_hints.cpython-314.pyc +0 -0
  113. package/skills/ui-design/scripts/__pycache__/design_repair_hints_test.cpython-314.pyc +0 -0
  114. package/skills/ui-design/scripts/__pycache__/design_style_check.cpython-314.pyc +0 -0
  115. package/skills/ui-design/scripts/__pycache__/design_style_check_test.cpython-314.pyc +0 -0
  116. package/skills/ui-design/scripts/__pycache__/draft_coverage_check.cpython-314.pyc +0 -0
  117. package/skills/ui-design/scripts/__pycache__/extract_source_assets.cpython-314.pyc +0 -0
  118. package/skills/ui-design/scripts/__pycache__/extract_source_assets_test.cpython-314.pyc +0 -0
  119. package/skills/ui-design/scripts/__pycache__/generated_image_review_collect.cpython-314.pyc +0 -0
  120. package/skills/ui-design/scripts/__pycache__/generated_image_review_collect_test.cpython-314.pyc +0 -0
  121. package/skills/ui-design/scripts/__pycache__/image_plan_lint.cpython-314.pyc +0 -0
  122. package/skills/ui-design/scripts/__pycache__/image_plan_lint_test.cpython-314.pyc +0 -0
  123. package/skills/ui-design/scripts/__pycache__/image_prompt_rewrite.cpython-314.pyc +0 -0
  124. package/skills/ui-design/scripts/__pycache__/image_prompt_rewrite_test.cpython-314.pyc +0 -0
  125. package/skills/ui-design/scripts/__pycache__/layout_balance.cpython-314.pyc +0 -0
  126. package/skills/ui-design/scripts/__pycache__/layout_balance_test.cpython-314.pyc +0 -0
  127. package/skills/ui-design/scripts/__pycache__/normalize_design_json.cpython-314.pyc +0 -0
  128. package/skills/ui-design/scripts/__pycache__/normalize_design_json_test.cpython-314.pyc +0 -0
  129. package/skills/ui-design/scripts/__pycache__/plan_source_layout.cpython-314.pyc +0 -0
  130. package/skills/ui-design/scripts/__pycache__/plan_source_layout_test.cpython-314.pyc +0 -0
  131. package/skills/ui-design/scripts/__pycache__/resolve_source_hint.cpython-314.pyc +0 -0
  132. package/skills/ui-design/scripts/__pycache__/resolve_source_hint_test.cpython-314.pyc +0 -0
  133. package/skills/ui-design/scripts/__pycache__/resolve_source_input.cpython-314.pyc +0 -0
  134. package/skills/ui-design/scripts/__pycache__/resolve_source_input_test.cpython-314.pyc +0 -0
  135. package/skills/ui-design/scripts/__pycache__/scaffold_ui_artifact.cpython-314.pyc +0 -0
  136. package/skills/ui-design/scripts/__pycache__/source_usage_check.cpython-314.pyc +0 -0
  137. package/skills/ui-design/scripts/__pycache__/source_usage_check_test.cpython-314.pyc +0 -0
  138. package/skills/ui-design/scripts/__pycache__/text_readability_pixel.cpython-314.pyc +0 -0
  139. package/skills/ui-design/scripts/__pycache__/visual_quality_gate.cpython-314.pyc +0 -0
  140. package/skills/ui-design/scripts/__pycache__/visual_quality_gate_test.cpython-314.pyc +0 -0
  141. package/skills/ui-design/scripts/assemble_material.py +217 -0
  142. package/skills/ui-design/scripts/assemble_material_test.py +149 -0
  143. package/skills/ui-design/scripts/browser_check_ui_artifact.mjs +221 -0
  144. package/skills/ui-design/scripts/chart_sanity_check.py +261 -0
  145. package/skills/ui-design/scripts/chart_sanity_check_test.py +165 -0
  146. package/skills/ui-design/scripts/check_language_policy.py +351 -0
  147. package/skills/ui-design/scripts/check_ui_artifact.py +435 -0
  148. package/skills/ui-design/scripts/check_ui_artifact_pptx_test.py +251 -0
  149. package/skills/ui-design/scripts/deck_pages_check.py +158 -0
  150. package/skills/ui-design/scripts/deck_pages_check_test.py +134 -0
  151. package/skills/ui-design/scripts/deck_visual_style_check.py +767 -0
  152. package/skills/ui-design/scripts/deck_visual_style_check_test.py +713 -0
  153. package/skills/ui-design/scripts/design_budget_check.py +271 -0
  154. package/skills/ui-design/scripts/design_budget_check_test.py +183 -0
  155. package/skills/ui-design/scripts/design_repair_hints.py +162 -0
  156. package/skills/ui-design/scripts/design_repair_hints_test.py +54 -0
  157. package/skills/ui-design/scripts/design_style_check.py +397 -0
  158. package/skills/ui-design/scripts/design_style_check_test.py +233 -0
  159. package/skills/ui-design/scripts/draft_coverage_check.py +184 -0
  160. package/skills/ui-design/scripts/draft_coverage_check_test.py +131 -0
  161. package/skills/ui-design/scripts/export_pptx_from_html.mjs +2367 -0
  162. package/skills/ui-design/scripts/extract_source_assets.py +607 -0
  163. package/skills/ui-design/scripts/extract_source_assets_test.py +256 -0
  164. package/skills/ui-design/scripts/generated_image_review_collect.py +206 -0
  165. package/skills/ui-design/scripts/generated_image_review_collect_test.py +91 -0
  166. package/skills/ui-design/scripts/image_plan_lint.py +571 -0
  167. package/skills/ui-design/scripts/image_plan_lint_test.py +515 -0
  168. package/skills/ui-design/scripts/image_prompt_rewrite.py +713 -0
  169. package/skills/ui-design/scripts/image_prompt_rewrite_test.py +966 -0
  170. package/skills/ui-design/scripts/layout_balance.py +881 -0
  171. package/skills/ui-design/scripts/layout_balance_test.py +927 -0
  172. package/skills/ui-design/scripts/normalize_design_json.py +272 -0
  173. package/skills/ui-design/scripts/normalize_design_json_test.py +119 -0
  174. package/skills/ui-design/scripts/plan_source_layout.py +1450 -0
  175. package/skills/ui-design/scripts/plan_source_layout_test.py +1136 -0
  176. package/skills/ui-design/scripts/resolve_source_input.py +270 -0
  177. package/skills/ui-design/scripts/resolve_source_input_test.py +98 -0
  178. package/skills/ui-design/scripts/scaffold_ui_artifact.py +377 -0
  179. package/skills/ui-design/scripts/source_usage_check.py +581 -0
  180. package/skills/ui-design/scripts/source_usage_check_test.py +427 -0
  181. package/skills/ui-design/scripts/text_readability_pixel.py +340 -0
  182. package/skills/ui-design/scripts/text_readability_pixel_test.py +219 -0
  183. package/skills/ui-design/scripts/visual_quality_gate.py +301 -0
  184. package/skills/ui-design/scripts/visual_quality_gate_test.py +233 -0
  185. package/skills/ui-design/tests/e2e/prompts/deck.md +19 -0
  186. package/skills/ui-design/tests/e2e/prompts/webpage.md +17 -0
  187. package/skills/ui-design/tests/e2e/render_check.mjs +101 -0
  188. package/skills/ui-design/tests/e2e/rubric.json +54 -0
  189. package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/browser-check.json +49 -0
  190. package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/language-check.txt +12 -0
  191. package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/static-check.txt +15 -0
  192. package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/outputs/index.html +837 -0
  193. package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/prompt.md +12 -0
  194. package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/review.md +21 -0
  195. package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/screenshots/desktop.png +0 -0
  196. package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/screenshots/mobile.png +0 -0
  197. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/outputs/homepage.html +373 -0
  198. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/outputs/platform.html +378 -0
  199. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/prompt.md +13 -0
  200. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/review.md +26 -0
  201. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/browser-check.json +49 -0
  202. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/desktop.png +0 -0
  203. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/mobile.png +0 -0
  204. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/browser-check.json +49 -0
  205. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/desktop.png +0 -0
  206. package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/mobile.png +0 -0
  207. package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/checks/static-check.txt +2 -0
  208. package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/outputs/index.html +656 -0
  209. package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/prompt.md +12 -0
  210. package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/render_check.mjs +67 -0
  211. package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/checks/static-check.txt +2 -0
  212. package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/outputs/index.html +587 -0
  213. package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/prompt.md +12 -0
  214. package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/review.md +36 -0
  215. package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/browser-check.json +49 -0
  216. package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/language-check.txt +8 -0
  217. package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/static-check.txt +16 -0
  218. package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/outputs/index.html +739 -0
  219. package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/prompt.md +11 -0
  220. package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/review.md +22 -0
  221. package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/screenshots/desktop.png +0 -0
  222. package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/screenshots/mobile.png +0 -0
  223. package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/checks/browser-check.json +52 -0
  224. package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/outputs/index.html +641 -0
  225. package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/screenshots/desktop.png +0 -0
  226. package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/screenshots/mobile.png +0 -0
  227. package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/outputs/index.html +467 -0
  228. package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/browser-check.json +49 -0
  229. package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/desktop.png +0 -0
  230. package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/mobile.png +0 -0
  231. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/outputs/homepage.html +373 -0
  232. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/outputs/platform.html +378 -0
  233. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/prompt.md +13 -0
  234. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/review.md +26 -0
  235. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/browser-check.json +49 -0
  236. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/desktop.png +0 -0
  237. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/mobile.png +0 -0
  238. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/browser-check.json +49 -0
  239. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/desktop.png +0 -0
  240. package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/mobile.png +0 -0
  241. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/browser-check.json +49 -0
  242. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/language-check.txt +4 -0
  243. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/static-check.txt +2 -0
  244. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/execution_notes.md +10 -0
  245. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/outputs/index.html +587 -0
  246. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/prompt.md +14 -0
  247. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/review.md +13 -0
  248. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/screenshots/desktop.png +0 -0
  249. package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/screenshots/mobile.png +0 -0
  250. package/skills/ui-design/tests/e2e/runs/iteration-1/deck/checks/browser-check.json +24 -0
  251. package/skills/ui-design/tests/e2e/runs/iteration-1/deck/checks/static-check.txt +2 -0
  252. package/skills/ui-design/tests/e2e/runs/iteration-1/deck/execution_notes.md +21 -0
  253. package/skills/ui-design/tests/e2e/runs/iteration-1/deck/outputs/deck.html +451 -0
  254. package/skills/ui-design/tests/e2e/runs/iteration-1/deck/screenshots/slide-01.png +0 -0
  255. package/skills/ui-design/tests/e2e/runs/iteration-1/deck/screenshots/slide-02.png +0 -0
  256. package/skills/ui-design/tests/e2e/runs/iteration-1/review.md +79 -0
  257. package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/checks/browser-check.json +26 -0
  258. package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/checks/static-check.txt +2 -0
  259. package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/execution_notes.md +20 -0
  260. package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/outputs/index.html +534 -0
  261. package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/screenshots/desktop.png +0 -0
  262. package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/screenshots/mobile.png +0 -0
  263. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/browser-check.json +64 -0
  264. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/language-check.txt +7 -0
  265. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/quick-validate.txt +1 -0
  266. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/static-console.txt +2 -0
  267. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/static-homepage.txt +2 -0
  268. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/outputs/console.html +600 -0
  269. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/outputs/homepage.html +556 -0
  270. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/prompt.md +29 -0
  271. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/review.md +57 -0
  272. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/console-desktop.png +0 -0
  273. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/console-mobile.png +0 -0
  274. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/homepage-desktop.png +0 -0
  275. package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/homepage-mobile.png +0 -0
  276. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/browser-check.json +33 -0
  277. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/language-check.txt +6 -0
  278. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/quick-validate.txt +1 -0
  279. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/static-check.txt +2 -0
  280. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/outputs/index.html +682 -0
  281. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/prompt.md +13 -0
  282. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/review.md +59 -0
  283. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/screenshots/desktop.png +0 -0
  284. package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/screenshots/mobile.png +0 -0
  285. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/outputs/page-01.html +466 -0
  286. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/outputs/page-02.html +433 -0
  287. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/prompt.md +13 -0
  288. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/browser-check.json +49 -0
  289. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/desktop.png +0 -0
  290. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/mobile.png +0 -0
  291. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/browser-check.json +49 -0
  292. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/desktop.png +0 -0
  293. package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/mobile.png +0 -0
  294. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/browser-check.json +49 -0
  295. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/language-check.txt +3 -0
  296. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/static-check.txt +2 -0
  297. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/execution_notes.md +24 -0
  298. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/outputs/index.html +723 -0
  299. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/prompt.md +15 -0
  300. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/review.md +26 -0
  301. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/screenshots/desktop.png +0 -0
  302. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/screenshots/mobile.png +0 -0
  303. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/browser-dark.json +49 -0
  304. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/browser-light.json +49 -0
  305. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/language-check.txt +11 -0
  306. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/static-dark.txt +2 -0
  307. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/static-light.txt +3 -0
  308. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/execution_notes.md +23 -0
  309. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/outputs/dark.html +392 -0
  310. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/outputs/light.html +476 -0
  311. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/prompt.md +23 -0
  312. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/review.md +41 -0
  313. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/dark/desktop.png +0 -0
  314. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/dark/mobile.png +0 -0
  315. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/light/desktop.png +0 -0
  316. package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/light/mobile.png +0 -0
  317. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/browser-check.json +54 -0
  318. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/language-check.txt +5 -0
  319. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/quick-validate.txt +1 -0
  320. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/static-check.txt +2 -0
  321. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/outputs/index.html +765 -0
  322. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/prompt.md +15 -0
  323. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/review.md +59 -0
  324. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/screenshots/desktop.png +0 -0
  325. package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/screenshots/mobile.png +0 -0
  326. package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/outputs/index.html +508 -0
  327. package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/browser-check.json +49 -0
  328. package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/desktop.png +0 -0
  329. package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/mobile.png +0 -0
  330. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/browser-check.json +54 -0
  331. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/language-check.txt +6 -0
  332. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/quick-validate.txt +1 -0
  333. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/static-check.txt +2 -0
  334. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/outputs/index.html +788 -0
  335. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/prompt.md +14 -0
  336. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/review.md +60 -0
  337. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/screenshots/desktop.png +0 -0
  338. package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/screenshots/mobile.png +0 -0
  339. package/skills/video-compose/SKILL.md +8 -1
  340. package/skills/web-crawler/SKILL.md +70 -0
  341. package/skills/web-crawler/scripts/crawl.mjs +538 -0
  342. package/skills/web-crawler/scripts/crawl.test.mjs +204 -0
  343. package/skills/xlsx/SKILL.md +12 -0
  344. package/skills/xlsx/scripts/opc_check.py +253 -0
  345. package/src/advisorState.js +22 -0
  346. package/src/askBridge.js +97 -3
  347. package/src/bootstrap/workingDir.js +12 -1
  348. package/src/cli/args.js +17 -1
  349. package/src/cli/configMenu.js +236 -0
  350. package/src/cli/configWizard.js +7 -5
  351. package/src/cli/print.js +37 -4
  352. package/src/cli/streamJson.js +77 -24
  353. package/src/cli/wizards/advisorWizard.js +147 -0
  354. package/src/cli/wizards/fieldForm.js +149 -0
  355. package/src/cli/wizards/imageWizard.js +60 -0
  356. package/src/cli/wizards/openRouterWizard.js +23 -0
  357. package/src/cli/wizards/providerPresets.js +95 -0
  358. package/src/cli/wizards/providerWizard.js +219 -0
  359. package/src/cli/wizards/searchWizard.js +23 -0
  360. package/src/cli/wizards/ttsWizard.js +34 -0
  361. package/src/config/configFile.js +441 -83
  362. package/src/config/configService.js +446 -0
  363. package/src/config.js +24 -64
  364. package/src/context/agentHome.js +9 -0
  365. package/src/context/archive.js +7 -2
  366. package/src/context/compact.js +8 -5
  367. package/src/context/contextLock.js +81 -0
  368. package/src/context/persistContext.js +30 -11
  369. package/src/context/reactiveCompact.js +4 -2
  370. package/src/context/recentDirs.js +21 -61
  371. package/src/context/sessionPath.js +97 -23
  372. package/src/context/sessionRegistry.js +303 -24
  373. package/src/context/tokenCounter.js +18 -0
  374. package/src/context/workspaceIndex.js +731 -0
  375. package/src/infra/verification.js +28 -15
  376. package/src/llm/client.js +394 -159
  377. package/src/llm/providers/anthropicFormat.js +241 -0
  378. package/src/llm/providers/openaiFormat.js +190 -0
  379. package/src/loop.js +219 -32
  380. package/src/main.js +61 -11
  381. package/src/messageQueue.js +97 -0
  382. package/src/multimodal.js +203 -0
  383. package/src/plugin-sdk.js +15 -0
  384. package/src/plugins/commandRouter.js +3 -0
  385. package/src/plugins/hookEngine.js +5 -1
  386. package/src/plugins/pluginLifecycle.js +28 -0
  387. package/src/plugins/pluginLoader.js +2 -1
  388. package/src/plugins/pluginRunner.js +49 -21
  389. package/src/plugins/transcript.js +4 -3
  390. package/src/prompts/pluginList.js +5 -5
  391. package/src/prompts/projectInstructions.js +3 -3
  392. package/src/prompts/promptAssembly.js +133 -144
  393. package/src/prompts/skillList.js +12 -22
  394. package/src/prompts/system.js +0 -1
  395. package/src/session/runAgentTurn.js +70 -0
  396. package/src/session/runTurn.js +41 -6
  397. package/src/toolGate.js +17 -0
  398. package/src/tools/advisor/advisor.js +379 -0
  399. package/src/tools/agent/agent.js +555 -0
  400. package/src/tools/agent/agentTypes.js +59 -0
  401. package/src/tools/agent/coordinator.js +93 -0
  402. package/src/tools/agent/worktree.js +270 -0
  403. package/src/tools/ask/ask.js +7 -2
  404. package/src/tools/bash/bash.js +112 -18
  405. package/src/tools/download/download.js +144 -0
  406. package/src/tools/edit/edit.js +1 -0
  407. package/src/tools/edit/multi-edit.js +1 -0
  408. package/src/tools/genimage/genimage.js +242 -0
  409. package/src/tools/genspeech/genspeech.js +67 -0
  410. package/src/tools/glob/glob.js +1 -0
  411. package/src/tools/grep/grep.js +3 -0
  412. package/src/tools/grep/rgPath.js +2 -0
  413. package/src/tools/index.js +25 -2
  414. package/src/tools/read/read.js +1 -0
  415. package/src/tools/shared/killTree.js +52 -0
  416. package/src/tools/toolProgressBridge.js +48 -0
  417. package/src/tools/webbrowser/agentBrowserPath.js +258 -0
  418. package/src/tools/webbrowser/browser.js +59 -42
  419. package/src/tools/webbrowser/browserControl.js +118 -0
  420. package/src/tools/webbrowser/browserDaemon.js +97 -0
  421. package/src/tools/webbrowser/browserService.js +27 -0
  422. package/src/tools/webbrowser/browserStream.js +119 -0
  423. package/src/tools/webbrowser/webbrowser.js +699 -130
  424. package/src/tools/webfetch/webfetch.js +1 -0
  425. package/src/tools/websearch/websearch.js +134 -51
  426. package/src/tools/write/write.js +1 -0
  427. package/src/ui/App.js +249 -22
  428. package/src/ui/AskQuestion.js +29 -10
  429. package/src/ui/InputBox.js +104 -12
  430. package/src/ui/LiveArea.js +112 -19
  431. package/src/ui/MessageList.js +100 -14
  432. package/src/ui/ModelPicker.js +56 -0
  433. package/src/ui/QueuedMessagesBanner.js +14 -0
  434. package/src/ui/Root.js +18 -10
  435. package/src/ui/SessionPicker.js +102 -0
  436. package/src/ui/StatusLine.js +13 -4
  437. package/src/ui/WorkspacePicker.js +55 -0
  438. package/src/ui/figures.js +44 -0
  439. package/src/ui/hooks/askSlot.js +82 -0
  440. package/src/ui/hooks/useChat.js +358 -64
  441. package/src/ui/hooks/usePasteHandler.js +11 -1
  442. package/src/ui/hooks/useTextBuffer.js +1 -3
  443. package/src/ui/liveViewport.js +5 -1
  444. package/src/ui/markdown.js +206 -0
  445. package/src/ui/textBuffer.js +0 -7
  446. package/src/ui/theme.js +32 -0
  447. package/src/utils/debugLog.js +0 -4
  448. package/src/utils/resourcePaths.js +2 -2
  449. package/src/utils/stripThink.js +50 -0
  450. package/src/web/browserBridge.js +447 -0
  451. package/src/web/protocol.js +19 -0
  452. package/workflows/adaptive-research.yaml +13 -5
  453. package/workflows/book-review-short.yaml +36 -10
  454. package/workflows/e2e-write-greet.yaml +6 -2
  455. package/workflows/illustrate.yaml +227 -0
  456. package/workflows/plan.yaml +460 -179
  457. package/workflows/ppt.yaml +1659 -0
  458. package/workflows/ralph-loop.yaml +199 -0
  459. package/workflows/schema.json +81 -23
  460. package/workflows/webppt.yaml +496 -0
  461. package/workflows/word.yaml +710 -0
  462. package/workflows/youtube-shorts.yaml +46 -15
  463. package/MINIMAL-TRACE.md +0 -77
  464. package/plugins/HOW-TO-WRITE-A-PLUGIN.md +0 -186
  465. package/plugins/ralph-wiggum/.claude-plugin/plugin.json +0 -9
  466. package/plugins/ralph-wiggum/README.md +0 -197
  467. package/plugins/ralph-wiggum/commands/cancel-ralph.md +0 -18
  468. package/plugins/ralph-wiggum/commands/help.md +0 -137
  469. package/plugins/ralph-wiggum/commands/ralph-loop.md +0 -85
  470. package/plugins/ralph-wiggum/hooks/hooks.json +0 -15
  471. package/plugins/ralph-wiggum/hooks/stop-hook.sh +0 -191
  472. package/plugins/ralph-wiggum/plugin.js +0 -280
  473. package/plugins/ralph-wiggum/src/goalState.js +0 -258
  474. package/plugins/ralph-wiggum/src/sentinels.js +0 -76
  475. package/plugins/ralph-wiggum/src/stopHookRunner.js +0 -104
  476. package/plugins/ralph-wiggum/src/verificationGate.js +0 -202
  477. package/plugins/workflow-runner/src/miniReAct.js +0 -223
  478. package/plugins/workflow-runner/src/voteHelpers.js +0 -110
  479. package/skills/config/SKILL.md +0 -123
  480. package/skills/frontend-design/LICENSE.txt +0 -177
  481. package/skills/frontend-design/SKILL.md +0 -42
  482. package/src/ui/ProgressPanel.js +0 -54
  483. package/src/ui/StreamingBlock.js +0 -11
  484. 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
- ...process.env,
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
+ }
@@ -124,7 +124,8 @@ export async function loadPluginApi(pluginRoot) {
124
124
  return null;
125
125
  }
126
126
  }
127
- /** 测试用:重置加载器缓存。 */
127
+ /** 测试用:重置加载器缓存 + 绿色版内置注册表。 */
128
128
  export function _resetPluginLoader() {
129
129
  loaderCache.clear();
130
+ builtinApis.clear();
130
131
  }
@@ -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) 未命中 → 当普通问句喂给 runQuery(让 LLM 自己解释 / 未知命令)
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
- const manifests = await discoverPlugins();
45
+ // 确保插件已发现(resolveCommand 依赖 pluginCache)
46
+ await discoverPlugins();
32
47
  const matched = resolveCommand(userInput);
33
48
  if (!matched) {
34
- // 提取命令名用于错误提示
35
- const cmdName = userInput.trimStart().split(/\s+/)[0]; // "/workflow" 或 "/plan"
36
- // 有插件但未命中该命令 → 明确提示可用命令
37
- if (manifests.length > 0) {
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(homedir(), '.minimal-agent', 'transcripts');
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
- // 如果指定了 sessionId 且与当前不同 → 切到新文件
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
- * - 明确标注触发方式("必须由用户输入 /xxx 触发")
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
- '以下是当前已安装的插件。**插件只能由用户通过 /xxx 命令触发——你绝对不能代替用户执行、模拟或建议使用插件功能**。',
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(`- **命令**: ${cmdList}`);
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. 实时读取:每次 buildInitialHistory 都重新读(用户改了立即生效)
17
- * 4. 独立消息:作为单独的 system message 插入,
18
- * 不污染全局 system prompt 的 token 结构
16
+ * 3. 实时读取:每次组装系统提示词都重新读(用户改了立即生效)
17
+ * 4. 注入位置:由 assembleBasePrompt 拼进同一个 system prompt 字符串的
18
+ * Layer 5(带时效性声明前缀),不是独立的 system message
19
19
  * ============================================================
20
20
  */
21
21
  import { readFile } from 'node:fs/promises';