minimal-agent 0.13.0 → 0.14.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 +6 -5
- package/package.json +60 -4
- package/plugins/computer_use/.claude-plugin/plugin.json +1 -1
- package/plugins/cron-runner/src/commands.js +4 -4
- package/plugins/cron-runner/src/commands.ts +4 -4
- package/plugins/workflow-runner/.claude-plugin/plugin.json +2 -2
- package/plugins/workflow-runner/commands/workflow.md +57 -90
- package/plugins/workflow-runner/commands/workflows.md +4 -4
- package/plugins/workflow-runner/plugin.js +24 -13
- package/plugins/workflow-runner/plugin.ts +28 -13
- package/plugins/workflow-runner/src/discovery.js +160 -0
- package/plugins/workflow-runner/src/discovery.ts +194 -0
- package/plugins/workflow-runner/src/goalAnchor.js +53 -0
- package/plugins/workflow-runner/src/goalAnchor.ts +59 -0
- package/plugins/workflow-runner/src/index.js +197 -206
- package/plugins/workflow-runner/src/index.ts +248 -249
- package/plugins/workflow-runner/src/inputCoercion.js +40 -0
- package/plugins/workflow-runner/src/inputCoercion.ts +43 -0
- package/plugins/workflow-runner/src/journal.js +224 -0
- package/plugins/workflow-runner/src/journal.ts +274 -0
- package/plugins/workflow-runner/src/jsonSchema.js +132 -0
- package/plugins/workflow-runner/src/jsonSchema.ts +162 -0
- package/plugins/workflow-runner/src/moduleResolution.js +64 -0
- package/plugins/workflow-runner/src/moduleResolution.ts +71 -0
- package/plugins/workflow-runner/src/resourceInputs.js +220 -0
- package/plugins/workflow-runner/src/resourceInputs.ts +300 -0
- package/plugins/workflow-runner/src/runner.js +400 -489
- package/plugins/workflow-runner/src/runner.ts +488 -560
- package/plugins/workflow-runner/src/runtime/config.js +46 -0
- package/plugins/workflow-runner/src/runtime/config.ts +69 -0
- package/plugins/workflow-runner/src/runtime/context.js +1304 -0
- package/plugins/workflow-runner/src/runtime/context.ts +1786 -0
- package/plugins/workflow-runner/src/runtime/exec.js +34 -0
- package/plugins/workflow-runner/src/runtime/exec.ts +53 -0
- package/plugins/workflow-runner/src/runtime/flow.js +8 -0
- package/plugins/workflow-runner/src/runtime/flow.ts +12 -0
- package/plugins/workflow-runner/src/runtime/fs.js +27 -0
- package/plugins/workflow-runner/src/runtime/fs.ts +41 -0
- package/plugins/workflow-runner/src/runtime/model.js +6 -0
- package/plugins/workflow-runner/src/runtime/model.ts +8 -0
- package/plugins/workflow-runner/src/runtime/output.js +7 -0
- package/plugins/workflow-runner/src/runtime/output.ts +21 -0
- package/plugins/workflow-runner/src/runtime/scheduler.js +141 -0
- package/plugins/workflow-runner/src/runtime/scheduler.ts +166 -0
- package/plugins/workflow-runner/src/runtime/state.js +16 -0
- package/plugins/workflow-runner/src/runtime/state.ts +19 -0
- package/plugins/workflow-runner/src/runtime/tools.js +3 -0
- package/plugins/workflow-runner/src/runtime/tools.ts +6 -0
- package/plugins/workflow-runner/src/sandbox.js +141 -0
- package/plugins/workflow-runner/src/sandbox.ts +182 -0
- package/plugins/workflow-runner/src/scriptGuard.d.mts +38 -0
- package/plugins/workflow-runner/src/scriptGuard.mjs +449 -0
- package/plugins/workflow-runner/src/taskIdentity.js +151 -307
- package/plugins/workflow-runner/src/taskIdentity.ts +207 -355
- package/plugins/workflow-runner/src/toolRuntime.js +29 -8
- package/plugins/workflow-runner/src/toolRuntime.ts +36 -11
- package/plugins/workflow-runner/src/types.js +7 -211
- package/plugins/workflow-runner/src/types.ts +154 -623
- package/plugins/workflow-runner/src/util.js +47 -0
- package/plugins/workflow-runner/src/util.ts +51 -0
- package/plugins/workflow-runner/src/workflowContext.js +20 -0
- package/plugins/workflow-runner/src/workflowContext.ts +58 -0
- package/plugins/workflow-runner/src/workflowDependencies.js +36 -0
- package/plugins/workflow-runner/src/workflowDependencies.ts +59 -0
- package/plugins/workflow-runner/src/workflowFingerprint.js +118 -0
- package/plugins/workflow-runner/src/workflowFingerprint.ts +122 -0
- package/plugins/workflow-runner/src/workflowState.js +474 -802
- package/plugins/workflow-runner/src/workflowState.ts +575 -970
- package/plugins/workflow-runner/test/api.test.ts +223 -0
- package/plugins/workflow-runner/test/apiCapabilities.test.ts +614 -0
- package/plugins/workflow-runner/test/apiConcurrencyGate.test.ts +104 -0
- package/plugins/workflow-runner/test/apiEcho.test.ts +210 -0
- package/plugins/workflow-runner/test/apiReadText.test.ts +178 -0
- package/plugins/workflow-runner/test/apiResourceLedger.test.ts +184 -0
- package/plugins/workflow-runner/test/childWorkflow.test.ts +304 -0
- package/plugins/workflow-runner/test/discovery.test.ts +234 -0
- package/plugins/workflow-runner/test/goalAnchor.test.ts +106 -0
- package/plugins/workflow-runner/test/goalController.test.ts +317 -0
- package/plugins/workflow-runner/test/journalLanes.test.ts +198 -0
- package/plugins/workflow-runner/test/listResources.test.ts +106 -0
- package/plugins/workflow-runner/test/resourceInputs.test.ts +294 -0
- package/plugins/workflow-runner/test/sandbox.test.ts +126 -0
- package/plugins/workflow-runner/test/scheduler.test.ts +70 -0
- package/plugins/workflow-runner/test/scriptGuard.test.ts +276 -0
- package/plugins/workflow-runner/test/skillDocSync.test.ts +78 -0
- package/plugins/workflow-runner/test/taskIdentity.test.ts +288 -179
- package/plugins/workflow-runner/test/workflowFingerprint.test.ts +106 -0
- package/plugins/workflow-runner/test/workflowState.test.ts +429 -0
- package/skills/pptx/examples/assets/cover-bg.svg +23 -0
- package/skills/pptx/examples/assets/icon-spark.svg +5 -0
- package/skills/ui-design/SKILL.md +5 -2
- package/skills/ui-design/references/layout-composition.md +1 -1
- package/skills/workflow-creator/SKILL.md +344 -0
- package/skills/workflow-creator/assets/template/workflow.mjs +48 -0
- package/skills/workflow-creator/references/api.md +216 -0
- package/skills/workflow-creator/references/migration.md +103 -0
- package/skills/workflow-creator/references/patterns.md +779 -0
- package/skills/workflow-creator/scripts/list-resources.mjs +205 -0
- package/skills/workflow-creator/scripts/scaffold.mjs +148 -0
- package/skills/workflow-creator/scripts/validate.mjs +275 -0
- package/skills/workflow-creator/scripts/workflow-creator.test.mjs +82 -0
- package/src/advisor/advisorCoordinator.js +503 -0
- package/src/advisor/advisorCoordinator.ts +657 -0
- package/src/cli/configMenu.tsx +0 -1
- package/src/cli/print.js +27 -6
- package/src/cli/print.ts +48 -4
- package/src/cli/streamJson.js +5 -6
- package/src/cli/streamJson.ts +8 -4
- package/src/cli/wizards/advisorWizard.js +4 -2
- package/src/cli/wizards/advisorWizard.tsx +8 -2
- package/src/cli/wizards/contextAdvisorWizard.js +5 -4
- package/src/cli/wizards/contextAdvisorWizard.tsx +7 -6
- package/src/collaboration/taskFlow.js +115 -0
- package/src/collaboration/taskFlow.ts +169 -0
- package/src/config/configDefaults.js +41 -1
- package/src/config/configDefaults.ts +43 -1
- package/src/config/configDiagnostics.ts +2 -2
- package/src/config/configFile.js +40 -9
- package/src/config/configFile.ts +60 -11
- package/src/config/configService.js +419 -74
- package/src/config/configService.ts +703 -145
- package/src/config/numericLimits.js +22 -0
- package/src/config/numericLimits.ts +24 -0
- package/src/config.js +1 -0
- package/src/config.ts +3 -2
- package/src/context/budgetPlan.js +1 -1
- package/src/context/budgetPlan.ts +1 -1
- package/src/context/compact.js +7 -2
- package/src/context/compact.ts +9 -2
- package/src/context/microCompactLite.js +212 -13
- package/src/context/microCompactLite.ts +261 -12
- package/src/context/sessionRegistry.js +8 -1
- package/src/context/sessionRegistry.ts +18 -5
- package/src/context/toolResultArchive.js +72 -0
- package/src/context/toolResultArchive.ts +95 -0
- package/src/goal/errors.js +8 -0
- package/src/goal/errors.ts +18 -0
- package/src/goal/goalRuntime.js +344 -0
- package/src/goal/goalRuntime.ts +466 -0
- package/src/goal/goalStore.js +200 -0
- package/src/goal/goalStore.ts +219 -0
- package/src/goal/index.js +4 -0
- package/src/goal/index.ts +4 -0
- package/src/goal/statusMapping.js +71 -0
- package/src/goal/statusMapping.ts +95 -0
- package/src/goal/types.js +7 -0
- package/src/goal/types.ts +179 -0
- package/src/goal/workflowController.js +306 -0
- package/src/goal/workflowController.ts +360 -0
- package/src/harness/evidenceLedger.js +2 -0
- package/src/harness/evidenceLedger.ts +1 -0
- package/src/harness/stallGuard.js +9 -3
- package/src/harness/stallGuard.ts +7 -3
- package/src/images/imageResolver.js +161 -0
- package/src/images/imageResolver.ts +189 -0
- package/src/infra/verification.js +34 -5
- package/src/infra/verification.ts +39 -4
- package/src/llm/client.js +79 -21
- package/src/llm/client.ts +182 -35
- package/src/llm/gatewayClient.js +201 -0
- package/src/llm/gatewayClient.ts +299 -0
- package/src/llm/messageProvenance.js +46 -0
- package/src/llm/messageProvenance.ts +58 -0
- package/src/llm/modelProvider.js +1 -0
- package/src/llm/modelProvider.ts +22 -0
- package/src/llm/providers/anthropicFormat.js +108 -1
- package/src/llm/providers/anthropicFormat.ts +115 -4
- package/src/llm/providers/openaiFormat.js +9 -0
- package/src/llm/providers/openaiFormat.ts +12 -3
- package/src/loop.js +319 -54
- package/src/loop.ts +373 -57
- package/src/main.js +4 -1
- package/src/main.tsx +4 -1
- package/src/managedExecution/index.js +2 -0
- package/src/managedExecution/index.ts +2 -0
- package/src/managedExecution/registry.js +15 -0
- package/src/managedExecution/registry.ts +20 -0
- package/src/managedExecution/types.js +1 -0
- package/src/managedExecution/types.ts +86 -0
- package/src/modelRef.js +9 -0
- package/src/modelRef.ts +31 -0
- package/src/multimodal.js +14 -28
- package/src/multimodal.ts +17 -33
- package/src/net/lanDiscovery.js +65 -0
- package/src/net/lanDiscovery.ts +82 -0
- package/src/plugin-sdk.js +28 -3
- package/src/plugin-sdk.ts +39 -6
- package/src/plugins/pluginApi.ts +16 -1
- package/src/plugins/pluginLoader.js +4 -0
- package/src/plugins/pluginLoader.ts +6 -0
- package/src/plugins/pluginRunner.js +139 -7
- package/src/plugins/pluginRunner.ts +173 -9
- package/src/plugins/slashFallback.js +113 -0
- package/src/plugins/slashFallback.ts +137 -0
- package/src/prompts/policyRegistry.js +12 -32
- package/src/prompts/policyRegistry.ts +15 -32
- package/src/prompts/promptAssembly.js +103 -12
- package/src/prompts/promptAssembly.ts +114 -12
- package/src/prompts/skillList.js +21 -3
- package/src/prompts/skillList.ts +27 -2
- package/src/prompts/stableSystemPrompt.js +18 -0
- package/src/prompts/stableSystemPrompt.ts +33 -0
- package/src/runtime/agentRuntimeContext.js +8 -2
- package/src/runtime/agentRuntimeContext.ts +17 -4
- package/src/session/runAgentTurn.js +78 -12
- package/src/session/runAgentTurn.ts +105 -23
- package/src/session/runTurn.js +10 -9
- package/src/session/runTurn.ts +17 -8
- package/src/session/sessionState.ts +2 -0
- package/src/team/auth.js +186 -0
- package/src/team/auth.ts +298 -0
- package/src/team/cli.js +105 -0
- package/src/team/cli.ts +122 -0
- package/src/team/onlineToolContract.js +64 -0
- package/src/team/onlineToolContract.ts +109 -0
- package/src/team/toolPolicy.js +36 -0
- package/src/team/toolPolicy.ts +75 -0
- package/src/tools/advisor/advisor.js +90 -46
- package/src/tools/advisor/advisor.ts +100 -47
- package/src/tools/advisor/advisorDecision.js +71 -0
- package/src/tools/advisor/advisorDecision.ts +85 -0
- package/src/tools/agent/agent.js +18 -5
- package/src/tools/agent/agent.ts +21 -7
- package/src/tools/agent/agentControl.js +246 -0
- package/src/tools/agent/agentControl.ts +284 -0
- package/src/tools/agent/agentTaskService.js +40 -1
- package/src/tools/agent/agentTaskService.ts +44 -1
- package/src/tools/agent/agentTypes.js +14 -2
- package/src/tools/agent/agentTypes.ts +15 -2
- package/src/tools/applypatch/applyPatch.js +362 -0
- package/src/tools/applypatch/applyPatch.ts +428 -0
- package/src/tools/bash/bash.js +22 -15
- package/src/tools/bash/bash.ts +23 -17
- package/src/tools/capabilities.js +10 -5
- package/src/tools/capabilities.ts +10 -5
- package/src/tools/computeruse/computerIntent.js +32 -0
- package/src/tools/computeruse/computerIntent.ts +46 -0
- package/src/tools/computeruse/telemetryLog.js +12 -0
- package/src/tools/computeruse/telemetryLog.ts +16 -0
- package/src/tools/computeruse/vision/telemetry.js +1 -0
- package/src/tools/computeruse/vision/telemetry.ts +1 -0
- package/src/tools/effectiveToolSet.js +4 -0
- package/src/tools/effectiveToolSet.ts +4 -0
- package/src/tools/index.js +21 -2
- package/src/tools/index.ts +33 -2
- package/src/tools/presentresult/presentresult.js +6 -15
- package/src/tools/presentresult/presentresult.ts +6 -15
- package/src/tools/read/read.js +62 -9
- package/src/tools/read/read.ts +63 -9
- package/src/tools/shared/fileUtils.js +1 -2
- package/src/tools/shared/fileUtils.ts +1 -2
- package/src/tools/shared/toolOutputStore.js +23 -1
- package/src/tools/shared/toolOutputStore.ts +22 -1
- package/src/tools/skill/skill.js +9 -3
- package/src/tools/skill/skill.ts +8 -4
- package/src/tools/toolPromptGuides.js +117 -0
- package/src/tools/toolPromptGuides.ts +137 -0
- package/src/tools/webbrowser/agentBrowserPath.js +19 -9
- package/src/tools/webbrowser/agentBrowserPath.ts +70 -28
- package/src/tools/webbrowser/browser.js +27 -11
- package/src/tools/webbrowser/browser.ts +68 -24
- package/src/tools/webbrowser/browserAutomation.js +329 -0
- package/src/tools/webbrowser/browserAutomation.ts +467 -0
- package/src/tools/webbrowser/browserAxState.js +97 -0
- package/src/tools/webbrowser/browserAxState.ts +142 -0
- package/src/tools/webbrowser/browserBatch.js +1578 -0
- package/src/tools/webbrowser/browserBatch.ts +2382 -0
- package/src/tools/webbrowser/browserCdp.js +208 -0
- package/src/tools/webbrowser/browserCdp.ts +255 -0
- package/src/tools/webbrowser/browserConditions.js +24 -0
- package/src/tools/webbrowser/browserConditions.ts +45 -0
- package/src/tools/webbrowser/browserContent.js +281 -0
- package/src/tools/webbrowser/browserContent.ts +438 -0
- package/src/tools/webbrowser/browserControl.js +131 -34
- package/src/tools/webbrowser/browserControl.ts +210 -56
- package/src/tools/webbrowser/browserDaemon.js +22 -14
- package/src/tools/webbrowser/browserDaemon.ts +54 -21
- package/src/tools/webbrowser/browserFrames.js +47 -0
- package/src/tools/webbrowser/browserFrames.ts +54 -0
- package/src/tools/webbrowser/browserInteractionResolver.js +17 -0
- package/src/tools/webbrowser/browserInteractionResolver.ts +40 -0
- package/src/tools/webbrowser/browserLocator.js +140 -0
- package/src/tools/webbrowser/browserLocator.ts +194 -0
- package/src/tools/webbrowser/browserOutcome.js +10 -17
- package/src/tools/webbrowser/browserOutcome.ts +48 -31
- package/src/tools/webbrowser/browserRecovery.js +58 -0
- package/src/tools/webbrowser/browserRecovery.ts +83 -0
- package/src/tools/webbrowser/browserRunRegistry.js +35 -3
- package/src/tools/webbrowser/browserRunRegistry.ts +91 -15
- package/src/tools/webbrowser/browserService.js +28 -2
- package/src/tools/webbrowser/browserService.ts +49 -9
- package/src/tools/webbrowser/browserStream.js +132 -33
- package/src/tools/webbrowser/browserStream.ts +224 -50
- package/src/tools/webbrowser/browserTabs.js +48 -15
- package/src/tools/webbrowser/browserTabs.ts +178 -96
- package/src/tools/webbrowser/webbrowser.js +679 -144
- package/src/tools/webbrowser/webbrowser.ts +975 -236
- package/src/tools/webfetch/preapproved.js +0 -2
- package/src/tools/webfetch/preapproved.ts +0 -2
- package/src/tools/websearch/websearch.js +129 -8
- package/src/tools/websearch/websearch.ts +138 -6
- package/src/types.ts +440 -38
- package/src/ui/App.js +377 -58
- package/src/ui/App.tsx +576 -111
- package/src/ui/LiveArea.js +14 -8
- package/src/ui/LiveArea.tsx +14 -10
- package/src/ui/MessageList.js +63 -20
- package/src/ui/MessageList.tsx +101 -16
- package/src/ui/ModelPicker.js +7 -4
- package/src/ui/ModelPicker.tsx +55 -8
- package/src/ui/hooks/useChat.js +152 -163
- package/src/ui/hooks/useChat.ts +396 -334
- package/src/ui/loginCommand.js +56 -0
- package/src/ui/loginCommand.ts +63 -0
- package/src/ui/toolProgress.js +41 -0
- package/src/ui/toolProgress.ts +44 -0
- package/src/web/browserBridge.js +20 -2
- package/src/web/browserBridge.ts +20 -2
- package/src/web/protocol.ts +1897 -194
- package/workflows/adaptive-research/workflow.mjs +86 -0
- package/workflows/e2e-capabilities/workflow.mjs +102 -0
- package/workflows/e2e-llm/workflow.mjs +52 -0
- package/workflows/e2e-smoke/workflow.mjs +59 -0
- package/workflows/e2e-vision-schema/README.md +48 -0
- package/workflows/e2e-vision-schema/workflow.mjs +149 -0
- package/workflows/e2e-write-greet/workflow.mjs +37 -0
- package/workflows/file-census/README.md +14 -0
- package/workflows/file-census/scripts/.gitkeep +2 -0
- package/workflows/file-census/workflow.mjs +110 -0
- package/workflows/goal/README.md +166 -0
- package/workflows/goal/prompts/audit.md +57 -0
- package/workflows/goal/prompts/contract.md +56 -0
- package/workflows/goal/prompts/iterate.md +37 -0
- package/workflows/goal/workflow.mjs +501 -0
- package/workflows/illustrate/README.md +90 -0
- package/workflows/illustrate/assets/engines.json +20 -0
- package/workflows/illustrate/assets/extract-baidu.js +21 -0
- package/workflows/illustrate/assets/extract-bing.js +33 -0
- package/workflows/illustrate/assets/extract-google.js +31 -0
- package/workflows/illustrate/workflow.mjs +301 -0
- package/workflows/plan/workflow.mjs +389 -0
- package/workflows/question-crops/README.md +35 -0
- package/workflows/question-crops/prompts/inventory.md +23 -0
- package/workflows/question-crops/scripts/image-ops.mjs +305 -0
- package/workflows/question-crops/scripts/image-ops.test.mjs +95 -0
- package/workflows/question-crops/workflow.mjs +172 -0
- package/workflows/ralph-loop/workflow.mjs +162 -0
- package/workflows/research/README.md +74 -0
- package/workflows/research/prompts/s0-goal.md +43 -0
- package/workflows/research/prompts/s1-early-exit.md +22 -0
- package/workflows/research/prompts/s1-map.md +58 -0
- package/workflows/research/prompts/s2-options.md +53 -0
- package/workflows/research/prompts/s3-deep-dive.md +56 -0
- package/workflows/research/prompts/s4-verify.md +74 -0
- package/workflows/research/prompts/s5-synthesis.md +81 -0
- package/workflows/research/prompts/s5b-fill-gaps.md +32 -0
- package/workflows/research/prompts/s6-package.md +32 -0
- package/workflows/research/scripts/build-report.mjs +98 -0
- package/workflows/research/workflow.mjs +288 -0
- package/workflows/wechat-reading-shots/prompts/collect-params.md +16 -0
- package/workflows/wechat-reading-shots/prompts/evaluate.md +20 -0
- package/workflows/wechat-reading-shots/prompts/open-book.md +28 -0
- package/workflows/wechat-reading-shots/prompts/read-page.md +13 -0
- package/workflows/wechat-reading-shots/prompts/turn-batch.md +24 -0
- package/workflows/wechat-reading-shots/test/control-flow.test.ts +329 -0
- package/workflows/wechat-reading-shots/workflow.mjs +266 -0
- package/workflows/wrong-question-docx/README.md +55 -0
- package/workflows/wrong-question-docx/prompts/figure-qa.md +8 -0
- package/workflows/wrong-question-docx/prompts/transcribe.md +25 -0
- package/workflows/wrong-question-docx/scripts/workbook.mjs +857 -0
- package/workflows/wrong-question-docx/test/control-flow.test.ts +165 -0
- package/workflows/wrong-question-docx/test/workbook.test.mjs +303 -0
- package/workflows/wrong-question-docx/workflow.mjs +485 -0
- package/plugins/workflow-runner/src/agentCommon.js +0 -354
- package/plugins/workflow-runner/src/agentCommon.ts +0 -435
- package/plugins/workflow-runner/src/controlFlow/branch.js +0 -40
- package/plugins/workflow-runner/src/controlFlow/branch.ts +0 -46
- package/plugins/workflow-runner/src/controlFlow/loop.js +0 -211
- package/plugins/workflow-runner/src/controlFlow/loop.ts +0 -248
- package/plugins/workflow-runner/src/controlFlow/pause.js +0 -129
- package/plugins/workflow-runner/src/controlFlow/pause.ts +0 -141
- package/plugins/workflow-runner/src/controlFlow/signal.js +0 -21
- package/plugins/workflow-runner/src/controlFlow/signal.ts +0 -29
- package/plugins/workflow-runner/src/controlFlow/types.js +0 -18
- package/plugins/workflow-runner/src/controlFlow/types.ts +0 -63
- package/plugins/workflow-runner/src/dslManifest.js +0 -72
- package/plugins/workflow-runner/src/dslManifest.ts +0 -127
- package/plugins/workflow-runner/src/expressions.js +0 -639
- package/plugins/workflow-runner/src/expressions.ts +0 -640
- package/plugins/workflow-runner/src/loader.js +0 -573
- package/plugins/workflow-runner/src/loader.ts +0 -721
- package/plugins/workflow-runner/src/multimodal.js +0 -38
- package/plugins/workflow-runner/src/multimodal.ts +0 -64
- package/plugins/workflow-runner/src/recovery.js +0 -126
- package/plugins/workflow-runner/src/recovery.ts +0 -156
- package/plugins/workflow-runner/src/stepExecutors/agent.js +0 -173
- package/plugins/workflow-runner/src/stepExecutors/agent.ts +0 -234
- package/plugins/workflow-runner/src/stepExecutors/assert.js +0 -42
- package/plugins/workflow-runner/src/stepExecutors/assert.ts +0 -52
- package/plugins/workflow-runner/src/stepExecutors/echo.js +0 -31
- package/plugins/workflow-runner/src/stepExecutors/echo.ts +0 -38
- package/plugins/workflow-runner/src/stepExecutors/llm.js +0 -99
- package/plugins/workflow-runner/src/stepExecutors/llm.ts +0 -133
- package/plugins/workflow-runner/src/stepExecutors/set.js +0 -49
- package/plugins/workflow-runner/src/stepExecutors/set.ts +0 -56
- package/plugins/workflow-runner/src/stepExecutors/skill.js +0 -111
- package/plugins/workflow-runner/src/stepExecutors/skill.ts +0 -140
- package/plugins/workflow-runner/src/stepExecutors/tool.js +0 -227
- package/plugins/workflow-runner/src/stepExecutors/tool.ts +0 -274
- package/plugins/workflow-runner/src/stepExecutors/verify.js +0 -61
- package/plugins/workflow-runner/src/stepExecutors/verify.ts +0 -72
- package/plugins/workflow-runner/src/stepPipeline.js +0 -277
- package/plugins/workflow-runner/src/stepPipeline.ts +0 -366
- package/plugins/workflow-runner/test/agent.test.ts +0 -587
- package/plugins/workflow-runner/test/agentLlmError.test.ts +0 -373
- package/plugins/workflow-runner/test/bashBlacklist.sweep.test.ts +0 -65
- package/plugins/workflow-runner/test/captureMisbind.test.ts +0 -99
- package/plugins/workflow-runner/test/cli.e2e.test.ts +0 -167
- package/plugins/workflow-runner/test/context-files.test.ts +0 -320
- package/plugins/workflow-runner/test/e2e.test.ts +0 -370
- package/plugins/workflow-runner/test/e2eNewLayout.test.ts +0 -314
- package/plugins/workflow-runner/test/engineRobustness.test.ts +0 -234
- package/plugins/workflow-runner/test/expressions.test.ts +0 -439
- package/plugins/workflow-runner/test/foundation.test.ts +0 -126
- package/plugins/workflow-runner/test/graceful.test.ts +0 -139
- package/plugins/workflow-runner/test/greedyInputs.load.test.ts +0 -47
- package/plugins/workflow-runner/test/hostCapability.test.ts +0 -108
- package/plugins/workflow-runner/test/illustrate.load.test.ts +0 -183
- package/plugins/workflow-runner/test/jsonPayload.test.ts +0 -83
- package/plugins/workflow-runner/test/loader.test.ts +0 -617
- package/plugins/workflow-runner/test/maxTurnsRetryDelay.test.ts +0 -33
- package/plugins/workflow-runner/test/multimodal.test.ts +0 -342
- package/plugins/workflow-runner/test/output-schema.test.ts +0 -213
- package/plugins/workflow-runner/test/parseWorkflowArgs.test.ts +0 -106
- package/plugins/workflow-runner/test/pluginRunner.isolation.test.ts +0 -269
- package/plugins/workflow-runner/test/ppt.load.test.ts +0 -1220
- package/plugins/workflow-runner/test/ralphLoop.e2e.test.ts +0 -221
- package/plugins/workflow-runner/test/recovery.test.ts +0 -265
- package/plugins/workflow-runner/test/research.load.test.ts +0 -328
- package/plugins/workflow-runner/test/runner.test.ts +0 -911
- package/plugins/workflow-runner/test/runnerPreflight.test.ts +0 -436
- package/plugins/workflow-runner/test/skillTurnDone.test.ts +0 -71
- package/plugins/workflow-runner/test/stateLifecycle.test.ts +0 -198
- package/plugins/workflow-runner/test/stepPipeline.test.ts +0 -114
- package/plugins/workflow-runner/test/taskArbitration.test.ts +0 -354
- package/plugins/workflow-runner/test/taskLifecycle.test.ts +0 -324
- package/plugins/workflow-runner/test/toolArtifactOverwrite.test.ts +0 -221
- package/plugins/workflow-runner/test/toolCapabilityBoundary.test.ts +0 -29
- package/plugins/workflow-runner/test/toolRuntimeIntegration.test.ts +0 -168
- package/plugins/workflow-runner/test/webppt.load.test.ts +0 -250
- package/plugins/workflow-runner/test/word.load.test.ts +0 -208
- package/plugins/workflow-runner/test/workflows.smoke.test.ts +0 -76
- package/plugins/workflow-runner/test/yamlGuardConditions.test.ts +0 -207
- package/src/advisorState.js +0 -22
- package/src/cli/configWizard.js +0 -293
- package/src/tools/toolProgressBridge.js +0 -48
- package/workflows/adaptive-research.yaml +0 -50
- package/workflows/book-review-short.yaml +0 -125
- package/workflows/e2e-write-greet.yaml +0 -31
- package/workflows/illustrate.yaml +0 -227
- package/workflows/plan.yaml +0 -470
- package/workflows/ppt.yaml +0 -1670
- package/workflows/ralph-loop.yaml +0 -201
- package/workflows/research.yaml +0 -873
- package/workflows/schema.json +0 -176
- package/workflows/webppt.yaml +0 -496
- package/workflows/wechat-reading-shots.yaml +0 -315
- package/workflows/word.yaml +0 -720
- package/workflows/youtube-shorts.yaml +0 -202
- /package/workflows/{research.md → research/DESIGN.md} +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
name: adaptive-research
|
|
2
|
-
description: |
|
|
3
|
-
演示「受工作流指导的 TAOR」:确定性骨架 + 两处随机应变。
|
|
4
|
-
- research 步是 agent: 节点 —— 把一个开放任务(调研主题、整理笔记落盘)交给有界子 agent
|
|
5
|
-
自主用工具完成(思考→搜→写→自我验证)。
|
|
6
|
-
- count_lines 步是确定性 tool,但声明 onError: recover —— 万一路径/前置不对,
|
|
7
|
-
不整条崩,临时起恢复 agent 把这一步救回。
|
|
8
|
-
最后 assert 守门。这就是「指导 + 随机应变」按节点滑动的旋钮。
|
|
9
|
-
version: "0.1"
|
|
10
|
-
|
|
11
|
-
inputs:
|
|
12
|
-
- name: topic
|
|
13
|
-
type: string
|
|
14
|
-
required: true
|
|
15
|
-
greedy: true
|
|
16
|
-
description: "调研主题(可直接一句话自然语言;命令行整句进 topic,不被空格拆碎)"
|
|
17
|
-
|
|
18
|
-
steps:
|
|
19
|
-
# 1. agent 节点:开放式调研,自主决定怎么做,产出笔记并自我验证
|
|
20
|
-
- id: research
|
|
21
|
-
title: "1/3·自主调研写笔记"
|
|
22
|
-
agent: |
|
|
23
|
-
调研主题「${inputs.topic}」:用你手上的工具搜集 3-5 个关键要点,
|
|
24
|
-
整理成简洁的中文 markdown,写到 out/adaptive-research/${session}/notes.md(目录不存在就先创建)。
|
|
25
|
-
写完后用 Read 自检文件确实写好了再收尾。
|
|
26
|
-
allowed_tools: [Read, Write, Edit, Bash, Grep, Glob]
|
|
27
|
-
# 确定性完成条件:模型「宣告要写却没写」时引擎自动提醒续跑(announce-not-do 兜底)
|
|
28
|
-
done_when: "fileExists('out/adaptive-research/${session}/notes.md')"
|
|
29
|
-
capture:
|
|
30
|
-
# agent 步 raw 只有 text/result(无 content)——曾绑 content 导致 notes 恒 undefined
|
|
31
|
-
text: notes
|
|
32
|
-
|
|
33
|
-
# 2. 确定性工具,但带 onError: recover —— 出意外就地自愈,而非崩停
|
|
34
|
-
- id: count_lines
|
|
35
|
-
title: "2/3·统计笔记行数"
|
|
36
|
-
tool: Bash
|
|
37
|
-
args:
|
|
38
|
-
command: "wc -l out/adaptive-research/${session}/notes.md"
|
|
39
|
-
onError: recover
|
|
40
|
-
recover_hint: "文件不存在或路径不对,就先用 Glob/Read 定位 notes.md 再统计行数"
|
|
41
|
-
capture:
|
|
42
|
-
content: line_report
|
|
43
|
-
|
|
44
|
-
# 3. 守门 verify(升级自 assert,享受 verify 的 file_exists 检查器)
|
|
45
|
-
- id: verify
|
|
46
|
-
title: "3/3·守门校验"
|
|
47
|
-
type: verify
|
|
48
|
-
checks:
|
|
49
|
-
- 'file_exists:out/adaptive-research/${session}/notes.md'
|
|
50
|
-
onFail: "调研笔记 out/adaptive-research/${session}/notes.md 未生成,检查 research 步"
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
name: book-review-short
|
|
2
|
-
description: |
|
|
3
|
-
从书名生成 YouTube Shorts 书评短视频(60 秒):
|
|
4
|
-
调研 → 60 秒口播脚本 → 缩略图 prompt + 真生图(可降级)→ meta.json。
|
|
5
|
-
step 4(loop 生成钩子标题)P1 启用。
|
|
6
|
-
version: "0.1"
|
|
7
|
-
|
|
8
|
-
inputs:
|
|
9
|
-
- name: book
|
|
10
|
-
type: string
|
|
11
|
-
required: true
|
|
12
|
-
greedy: true
|
|
13
|
-
description: "书名(中英都行,可一句话自然语言;命令行整句进 book,不被空格拆碎)"
|
|
14
|
-
- name: angle
|
|
15
|
-
type: enum
|
|
16
|
-
values: [insight, contrarian, beginner]
|
|
17
|
-
default: insight
|
|
18
|
-
description: "【高级·用 --input angle=...】切入角度"
|
|
19
|
-
- name: lang
|
|
20
|
-
type: enum
|
|
21
|
-
values: [zh, en]
|
|
22
|
-
default: zh
|
|
23
|
-
description: "【高级·用 --input lang=...】输出语言"
|
|
24
|
-
|
|
25
|
-
steps:
|
|
26
|
-
# 1. 调研(确定性工具)
|
|
27
|
-
- id: research
|
|
28
|
-
title: "1/7·调研书评素材"
|
|
29
|
-
tool: WebSearch
|
|
30
|
-
args:
|
|
31
|
-
query: "${inputs.book} 核心观点 书评 ${inputs.lang}"
|
|
32
|
-
capture:
|
|
33
|
-
content: research_data
|
|
34
|
-
|
|
35
|
-
# 2. 60 秒短视频脚本(llm 单轮,不开工具)
|
|
36
|
-
- id: script
|
|
37
|
-
title: "2/7·写 60 秒口播脚本"
|
|
38
|
-
llm: |
|
|
39
|
-
你是一名 YouTube Shorts 创作者。基于以下调研,为书 "${inputs.book}" 写一段
|
|
40
|
-
60 秒口播脚本,视角是 ${inputs.angle}(insight=洞察、contrarian=逆向、beginner=入门)。
|
|
41
|
-
语言:${inputs.lang}。
|
|
42
|
-
要求:
|
|
43
|
-
- 开头 3 秒强钩子(一个反直觉论断 / 数字 / 提问)
|
|
44
|
-
- 中段 40 秒展开 2-3 个核心要点,每点配一句金句
|
|
45
|
-
- 结尾 10 秒行动号召
|
|
46
|
-
- 全文 ≤ 180 字(中文)/ 150 词(英文)
|
|
47
|
-
只输出脚本本体,不要注释/标题/分段标记。
|
|
48
|
-
|
|
49
|
-
调研材料:
|
|
50
|
-
${research_data}
|
|
51
|
-
capture:
|
|
52
|
-
text: script_text
|
|
53
|
-
|
|
54
|
-
# 3. 写脚本到文件(确定性工具)
|
|
55
|
-
- id: write_script
|
|
56
|
-
title: "3/7·脚本落盘"
|
|
57
|
-
tool: Write
|
|
58
|
-
args:
|
|
59
|
-
file_path: "out/book-review-short/${session}/script.txt"
|
|
60
|
-
content: "${script_text}"
|
|
61
|
-
|
|
62
|
-
# 4. 生成 3 个钩子标题(loop + llm)—— P1 启用
|
|
63
|
-
# ⚠️ 启用前注意:step id 必须是静态字符串(id: hook_${idx} 这种动态 id 会破坏
|
|
64
|
-
# checkpoint/resume 的步骤寻址)。正确写法:静态 id + 累积变量拼接,如下。
|
|
65
|
-
# - id: gen_hooks
|
|
66
|
-
# type: loop
|
|
67
|
-
# over: "[1, 2, 3]"
|
|
68
|
-
# as: idx
|
|
69
|
-
# do:
|
|
70
|
-
# - id: gen_one_hook
|
|
71
|
-
# title: "生成第 ${idx} 个钩子标题"
|
|
72
|
-
# llm: |
|
|
73
|
-
# 为 "${inputs.book}" 书评 Shorts 生成第 ${idx} 个标题(≤20 字 / ≤8 words)。
|
|
74
|
-
# 风格序号 1=金句、2=反问、3=数字承诺。
|
|
75
|
-
# 只输出标题本体。
|
|
76
|
-
# capture:
|
|
77
|
-
# text: hook_text
|
|
78
|
-
# - id: accumulate_hook
|
|
79
|
-
# type: set
|
|
80
|
-
# set:
|
|
81
|
-
# hooks_text: "${hooks_text}${idx}. ${hook_text}\n"
|
|
82
|
-
|
|
83
|
-
# 5. 缩略图 prompt(llm 单轮)
|
|
84
|
-
- id: thumbnail
|
|
85
|
-
title: "4/7·生成缩略图提示词"
|
|
86
|
-
llm: |
|
|
87
|
-
为书 "${inputs.book}" 的 YouTube Shorts 缩略图生成英文文生图 prompt:
|
|
88
|
-
- 主体:书 + 一个隐喻物
|
|
89
|
-
- 色调:高饱和对比
|
|
90
|
-
- 构图:竖屏 9:16,主体居中
|
|
91
|
-
- 风格:editorial, photorealistic
|
|
92
|
-
≤100 词,单段。
|
|
93
|
-
capture:
|
|
94
|
-
text: thumb_prompt
|
|
95
|
-
|
|
96
|
-
# 5b. 真生成缩略图(可选:缺 OPENROUTER_API_KEY 时降级只留 prompt,不挡流水线)
|
|
97
|
-
- id: gen_thumbnail
|
|
98
|
-
title: "5/7·生成缩略图(可降级)"
|
|
99
|
-
skill: image-gen-openrouter
|
|
100
|
-
input: 'prompt=${thumb_prompt} output=out/book-review-short/${session}/thumbnail.png aspect=9:16'
|
|
101
|
-
onError: continue
|
|
102
|
-
|
|
103
|
-
# 6. 元数据汇总(确定性工具)
|
|
104
|
-
# json() 生成含外层引号的合法 JSON 字符串——裸 "${thumb_prompt}" 在值含引号/换行时产坏 JSON
|
|
105
|
-
- id: meta
|
|
106
|
-
title: "6/7·汇总 meta.json"
|
|
107
|
-
tool: Write
|
|
108
|
-
args:
|
|
109
|
-
file_path: "out/book-review-short/${session}/meta.json"
|
|
110
|
-
content: |
|
|
111
|
-
{
|
|
112
|
-
"book": ${json(inputs.book)},
|
|
113
|
-
"angle": "${inputs.angle}",
|
|
114
|
-
"lang": "${inputs.lang}",
|
|
115
|
-
"thumbnail_prompt": ${json(thumb_prompt)}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
# 7. 守门 verify(升级自 assert;多条 file_exists 拆成 checks 数组)
|
|
119
|
-
- id: verify
|
|
120
|
-
title: "7/7·守门校验"
|
|
121
|
-
type: verify
|
|
122
|
-
checks:
|
|
123
|
-
- 'file_exists:out/book-review-short/${session}/script.txt'
|
|
124
|
-
- 'file_exists:out/book-review-short/${session}/meta.json'
|
|
125
|
-
onFail: "脚本或 meta 未写盘,请检查 Write 工具"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
name: e2e-write-greet
|
|
2
|
-
description: E2E 极简 workflow,证明 /workflow CLI 端到端通(无 LLM 无网络)
|
|
3
|
-
version: "0.1"
|
|
4
|
-
|
|
5
|
-
inputs:
|
|
6
|
-
- name: topic
|
|
7
|
-
type: string
|
|
8
|
-
required: true
|
|
9
|
-
|
|
10
|
-
steps:
|
|
11
|
-
- id: write_note
|
|
12
|
-
title: "1/3·写入便签"
|
|
13
|
-
tool: Write
|
|
14
|
-
args:
|
|
15
|
-
file_path: "out/e2e-write-greet/${session}/note.txt"
|
|
16
|
-
content: "topic=${inputs.topic} ok"
|
|
17
|
-
capture:
|
|
18
|
-
args.content: note_body
|
|
19
|
-
|
|
20
|
-
- id: verify_file
|
|
21
|
-
title: "2/3·校验落盘"
|
|
22
|
-
type: verify
|
|
23
|
-
checks:
|
|
24
|
-
- 'file_exists:out/e2e-write-greet/${session}/note.txt'
|
|
25
|
-
onFail: "note.txt 未落盘"
|
|
26
|
-
|
|
27
|
-
- id: verify_capture
|
|
28
|
-
title: "3/3·校验 capture"
|
|
29
|
-
type: assert
|
|
30
|
-
condition: 'length(note_body) > 0'
|
|
31
|
-
onFail: "capture 没绑到 note_body"
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
name: illustrate
|
|
2
|
-
description: >
|
|
3
|
-
网上抓图配图(illustrate):给一个关键词/描述(写 PPT 或文章用),从 **Google→Bing→Baidu 图片有序降级搜索**
|
|
4
|
-
(某家被墙/不够就自动换下一家),下载若干候选图,**用 LLM 识图逐张打分(相关度/质量、识别并跳过广告图)**,
|
|
5
|
-
选出最合适的 `count` 张,落 `build/illustrations.json`(含图路径 + 源 URL + 分数),供 PPT/文章工作流消费。
|
|
6
|
-
纯 YAML:浏览器走内置 agent-browser(WebBrowser 工具),下载走 Download 工具,URL 抽取走 eval+parseJson。
|
|
7
|
-
version: "0.1"
|
|
8
|
-
|
|
9
|
-
# 最终交付物(new-task 清旧 / completed 报产物 / 完成闸门校验落盘)。中间候选图与分文件不声明(scratch)。
|
|
10
|
-
artifacts:
|
|
11
|
-
- "out/illustrate/${session}/build/illustrations.json"
|
|
12
|
-
|
|
13
|
-
# 自愈:浏览器/网络瞬态故障 in-run 重跑。
|
|
14
|
-
self_heal:
|
|
15
|
-
max_retries: 1
|
|
16
|
-
retry_delay_ms: 10000
|
|
17
|
-
|
|
18
|
-
inputs:
|
|
19
|
-
- name: topic
|
|
20
|
-
type: string
|
|
21
|
-
required: true
|
|
22
|
-
greedy: true
|
|
23
|
-
description: "配图主题 / 关键词(中文或英文,可一句话自然语言,如「太空探索 科技感 蓝色」)。"
|
|
24
|
-
- name: count
|
|
25
|
-
type: number
|
|
26
|
-
default: 3
|
|
27
|
-
description: "【可选 --input】最终选出的图片张数(默认 3)。"
|
|
28
|
-
- name: min_candidates
|
|
29
|
-
type: number
|
|
30
|
-
default: 6
|
|
31
|
-
description: "【可选 --input】候选图下限:某家图搜抓到的候选少于这个数就降级到下一家(默认 6)。"
|
|
32
|
-
|
|
33
|
-
steps:
|
|
34
|
-
# ---------- 初始化:候选清单置空(让 length() 可用、记录最终采用的搜索引擎)----------
|
|
35
|
-
- id: init
|
|
36
|
-
title: "配图·初始化"
|
|
37
|
-
type: set
|
|
38
|
-
set:
|
|
39
|
-
urls: []
|
|
40
|
-
engine_used: ""
|
|
41
|
-
|
|
42
|
-
# ---------- 阶段1:Google 图片(首选)----------
|
|
43
|
-
# WebBrowser navigate 打开图搜页 → eval 抽 http(s) 图 URL(优先结果锚点的 imgurl/mediaurl/objurl 全图参数,
|
|
44
|
-
# 退而取 <img> src;过滤 svg/引擎自身 chrome 资源),parseJson 成数组写进 urls。某家失败/被墙 onError:continue 不阻断。
|
|
45
|
-
# ⚠️ 双重解码:eval 的 JS 用 JSON.stringify 返回字符串,agent-browser 显示时会再 JSON 编码一次 →
|
|
46
|
-
# capture 到的是带外层引号的双编码串,故 parseJson(parseJson(x_raw)) 套两层才得数组(已实测确认)。
|
|
47
|
-
# ⚠️ eval 抽取规则随各家页面改版可能失效(固有脆弱,与脚本/YAML 无关)——失效时调这段 JS 即可。
|
|
48
|
-
- id: g_nav
|
|
49
|
-
title: "配图·Google 图搜"
|
|
50
|
-
tool: WebBrowser
|
|
51
|
-
args:
|
|
52
|
-
action: navigate
|
|
53
|
-
url: "https://www.google.com/search?tbm=isch&hl=en&q=${inputs.topic}"
|
|
54
|
-
onError: continue
|
|
55
|
-
- id: g_eval
|
|
56
|
-
title: "配图·Google 抽图 URL"
|
|
57
|
-
tool: WebBrowser
|
|
58
|
-
args:
|
|
59
|
-
action: eval
|
|
60
|
-
js: |
|
|
61
|
-
JSON.stringify(Array.from(new Set([].concat(
|
|
62
|
-
Array.from(document.querySelectorAll('a')).map(a=>{try{const u=new URL(a.href);return u.searchParams.get('imgurl')||u.searchParams.get('mediaurl')||u.searchParams.get('objurl')||''}catch(e){return ''}}),
|
|
63
|
-
Array.from(document.querySelectorAll('img')).map(i=>i.currentSrc||i.src||i.getAttribute('data-src')||'')
|
|
64
|
-
))).filter(s=>/^https?:\/\//.test(s)&&!/\.svg($|\?)/i.test(s)&&!/gstatic\.com|bing\.com\/(rp|th\/id\/(?!OIP))|baidu\.com\/static|google\.com\/images\/branding|w3\.org/i.test(s)).slice(0,24))
|
|
65
|
-
capture:
|
|
66
|
-
content: g_raw
|
|
67
|
-
onError: continue
|
|
68
|
-
- id: g_set
|
|
69
|
-
title: "配图·收下 Google 候选"
|
|
70
|
-
type: set
|
|
71
|
-
when: "length(asArray(parseJson(parseJson(g_raw)))) > length(urls)"
|
|
72
|
-
set:
|
|
73
|
-
urls: "${asArray(parseJson(parseJson(g_raw)))}"
|
|
74
|
-
engine_used: "google"
|
|
75
|
-
|
|
76
|
-
# ---------- 阶段2:Bing 图片(Google 不够才降级)----------
|
|
77
|
-
- id: b_nav
|
|
78
|
-
title: "配图·Bing 图搜(降级)"
|
|
79
|
-
tool: WebBrowser
|
|
80
|
-
when: "length(urls) < inputs.min_candidates"
|
|
81
|
-
args:
|
|
82
|
-
action: navigate
|
|
83
|
-
url: "https://www.bing.com/images/search?q=${inputs.topic}"
|
|
84
|
-
onError: continue
|
|
85
|
-
- id: b_eval
|
|
86
|
-
title: "配图·Bing 抽图 URL"
|
|
87
|
-
tool: WebBrowser
|
|
88
|
-
when: "length(urls) < inputs.min_candidates"
|
|
89
|
-
args:
|
|
90
|
-
action: eval
|
|
91
|
-
js: |
|
|
92
|
-
JSON.stringify(Array.from(new Set([].concat(
|
|
93
|
-
Array.from(document.querySelectorAll('a.iusc')).map(a=>{try{return (JSON.parse(a.getAttribute('m')||'{}').murl)||''}catch(e){return ''}}),
|
|
94
|
-
Array.from(document.querySelectorAll('a')).map(a=>{try{const u=new URL(a.href);return u.searchParams.get('mediaurl')||u.searchParams.get('imgurl')||''}catch(e){return ''}}),
|
|
95
|
-
Array.from(document.querySelectorAll('img')).map(i=>i.currentSrc||i.src||i.getAttribute('data-src')||'')
|
|
96
|
-
))).filter(s=>/^https?:\/\//.test(s)&&!/\.svg($|\?)/i.test(s)&&!/bing\.com\/(rp|sa\/)|gstatic\.com|w3\.org/i.test(s)).slice(0,24))
|
|
97
|
-
capture:
|
|
98
|
-
content: b_raw
|
|
99
|
-
onError: continue
|
|
100
|
-
- id: b_set
|
|
101
|
-
title: "配图·收下 Bing 候选"
|
|
102
|
-
type: set
|
|
103
|
-
when: "length(asArray(parseJson(parseJson(b_raw)))) > length(urls)"
|
|
104
|
-
set:
|
|
105
|
-
urls: "${asArray(parseJson(parseJson(b_raw)))}"
|
|
106
|
-
engine_used: "bing"
|
|
107
|
-
|
|
108
|
-
# ---------- 阶段3:Baidu 图片(仍不够才降级)----------
|
|
109
|
-
- id: d_nav
|
|
110
|
-
title: "配图·Baidu 图搜(降级)"
|
|
111
|
-
tool: WebBrowser
|
|
112
|
-
when: "length(urls) < inputs.min_candidates"
|
|
113
|
-
args:
|
|
114
|
-
action: navigate
|
|
115
|
-
url: "https://image.baidu.com/search/index?tn=baiduimage&word=${inputs.topic}"
|
|
116
|
-
onError: continue
|
|
117
|
-
- id: d_eval
|
|
118
|
-
title: "配图·Baidu 抽图 URL"
|
|
119
|
-
tool: WebBrowser
|
|
120
|
-
when: "length(urls) < inputs.min_candidates"
|
|
121
|
-
args:
|
|
122
|
-
action: eval
|
|
123
|
-
js: |
|
|
124
|
-
JSON.stringify(Array.from(new Set(
|
|
125
|
-
Array.from(document.querySelectorAll('img')).map(i=>i.getAttribute('data-imgurl')||i.currentSrc||i.src||i.getAttribute('data-src')||'')
|
|
126
|
-
)).filter(s=>/^https?:\/\//.test(s)&&!/\.svg($|\?)/i.test(s)&&!/baidu\.com\/(static|img|aladdin)|bdstatic\.com|w3\.org/i.test(s)).slice(0,24))
|
|
127
|
-
capture:
|
|
128
|
-
content: d_raw
|
|
129
|
-
onError: continue
|
|
130
|
-
- id: d_set
|
|
131
|
-
title: "配图·收下 Baidu 候选"
|
|
132
|
-
type: set
|
|
133
|
-
when: "length(asArray(parseJson(parseJson(d_raw)))) > length(urls)"
|
|
134
|
-
set:
|
|
135
|
-
urls: "${asArray(parseJson(parseJson(d_raw)))}"
|
|
136
|
-
engine_used: "baidu"
|
|
137
|
-
|
|
138
|
-
# ---------- 守门:三家都没抓到候选 → 诚实停(多半全被墙/反爬,现场保留可续跑)----------
|
|
139
|
-
- id: assert_candidates
|
|
140
|
-
title: "配图·候选校验"
|
|
141
|
-
type: assert
|
|
142
|
-
condition: "length(urls) > 0"
|
|
143
|
-
onFail: "Google/Bing/Baidu 三家图搜都没抓到候选图(可能全被墙/反爬,或 eval 抽取规则需随页面改版调整)。"
|
|
144
|
-
|
|
145
|
-
# ---------- 阶段4:下载候选图(逐条,跳死链)----------
|
|
146
|
-
- id: download_loop
|
|
147
|
-
title: "配图·下载候选"
|
|
148
|
-
type: loop
|
|
149
|
-
over: "${asArray(urls)}"
|
|
150
|
-
as: u
|
|
151
|
-
do:
|
|
152
|
-
- id: dl_one
|
|
153
|
-
title: "配图·下载 #${u_idx}"
|
|
154
|
-
tool: Download
|
|
155
|
-
args:
|
|
156
|
-
url: "${u}"
|
|
157
|
-
path: "out/illustrate/${session}/build/illustrations/cand_${u_idx}.img"
|
|
158
|
-
timeout: 30000
|
|
159
|
-
headers:
|
|
160
|
-
User-Agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36"
|
|
161
|
-
Referer: "https://www.google.com/"
|
|
162
|
-
onError: continue
|
|
163
|
-
|
|
164
|
-
# ---------- 阶段5:逐图识图打分 → 写分文件(避开 loop 累积难题,每图一个 score_K.json)----------
|
|
165
|
-
- id: score_loop
|
|
166
|
-
title: "配图·识图打分"
|
|
167
|
-
type: loop
|
|
168
|
-
over: "${asArray(urls)}"
|
|
169
|
-
as: u
|
|
170
|
-
do:
|
|
171
|
-
- id: score_one
|
|
172
|
-
title: "配图·打分 #${u_idx}"
|
|
173
|
-
when: "fileExists('out/illustrate/${session}/build/illustrations/cand_' + u_idx + '.img')"
|
|
174
|
-
llm: |
|
|
175
|
-
下方附上一张候选配图(用于主题:「${inputs.topic}」)。请**只看这张图**给出客观评估,输出 JSON。
|
|
176
|
-
- relevance:0-10,图片内容与主题的契合度(画的东西是否切题)。
|
|
177
|
-
- quality:0-10,作为 PPT/文章配图的观感质量(清晰、构图、专业、无明显水印/拼接)。
|
|
178
|
-
- is_ad:true/false——这是不是**广告/促销/带营销文案或店铺水印/比价图**等不适合当配图的图。
|
|
179
|
-
- reason:一句话理由(中文)。
|
|
180
|
-
只输出 JSON 对象本身,不要 markdown 代码块、不要解释。
|
|
181
|
-
images: ["out/illustrate/${session}/build/illustrations/cand_${u_idx}.img"]
|
|
182
|
-
image_detail: high
|
|
183
|
-
capture:
|
|
184
|
-
text: score_text
|
|
185
|
-
onError: continue
|
|
186
|
-
max_retries: 1
|
|
187
|
-
- id: write_score
|
|
188
|
-
title: "配图·记录分数 #${u_idx}"
|
|
189
|
-
when: "fileExists('out/illustrate/${session}/build/illustrations/cand_' + u_idx + '.img')"
|
|
190
|
-
tool: Write
|
|
191
|
-
args:
|
|
192
|
-
file_path: "out/illustrate/${session}/build/illustrations/score_${u_idx}.json"
|
|
193
|
-
content: |
|
|
194
|
-
{"index": ${u_idx}, "url": ${json(u)}, "engine": ${json(engine_used)}, "path": "build/illustrations/cand_${u_idx}.img", "score": ${score_text}}
|
|
195
|
-
onError: continue
|
|
196
|
-
|
|
197
|
-
# ---------- 阶段6:聚合选优(剔广告、按 relevance×quality 排序取前 count,确定性落盘)----------
|
|
198
|
-
- id: select
|
|
199
|
-
title: "配图·选出最合适的 ${inputs.count} 张"
|
|
200
|
-
agent: |
|
|
201
|
-
你是配图验收员。**唯一任务**:从已打分的候选里选出最合适的 ${inputs.count} 张配图,写 `out/illustrate/${session}/build/illustrations.json`。不要做别的。
|
|
202
|
-
|
|
203
|
-
1. 用 Glob 列出 `out/illustrate/${session}/build/illustrations/score_*.json`,逐个 Read。每个文件形如
|
|
204
|
-
`{"index","url","engine","path","score":{"relevance","quality","is_ad","reason"}}`(坏文件/缺 score 的跳过)。
|
|
205
|
-
2. **先剔除 `score.is_ad == true` 的**(广告/促销/水印图绝不入选)。
|
|
206
|
-
3. 其余按 **relevance×quality 降序**排序,取前 ${inputs.count} 张(不足就有几张给几张)。
|
|
207
|
-
4. 用 Write 写 `out/illustrate/${session}/build/illustrations.json`(严格 JSON、无注释、无 ``` 包裹):
|
|
208
|
-
`{"topic": "...", "engine_used": "${engine_used}", "count": <实际入选数>,
|
|
209
|
-
"picks": [{"path","url","engine","relevance","quality","reason"}, ...]}`
|
|
210
|
-
path 用 score 文件里的 path(如 build/illustrations/cand_3.img)。
|
|
211
|
-
完成后简述:扫了几个候选、剔了几张广告、最终选了哪几张(序号 + 一句理由)。
|
|
212
|
-
allowed_tools: [Glob, Read, Write]
|
|
213
|
-
maxTurns: 12
|
|
214
|
-
done_when: "fileExists('out/illustrate/${session}/build/illustrations.json')"
|
|
215
|
-
onError: halt
|
|
216
|
-
max_retries: 1
|
|
217
|
-
artifacts:
|
|
218
|
-
- "out/illustrate/${session}/build/illustrations.json"
|
|
219
|
-
|
|
220
|
-
# ---------- 阶段7:完成报告(确定性输出,不烧 LLM)----------
|
|
221
|
-
- id: report
|
|
222
|
-
title: "配图·完成"
|
|
223
|
-
type: echo
|
|
224
|
-
message: |
|
|
225
|
-
✅ 配图完成(主题:${inputs.topic},来源:${engine_used})。
|
|
226
|
-
选中的图片清单见 out/illustrate/${session}/build/illustrations.json(每条含 path/url/engine/分数)。
|
|
227
|
-
下游 PPT/文章工作流可读 illustrations.json 取用这 ${inputs.count} 张配图。
|