minimal-agent 0.12.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 +62 -5
- 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 +204 -185
- package/plugins/workflow-runner/src/index.ts +249 -224
- 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 +404 -467
- package/plugins/workflow-runner/src/runner.ts +491 -535
- 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 +172 -152
- package/plugins/workflow-runner/src/taskIdentity.ts +233 -200
- 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 -105
- package/plugins/workflow-runner/src/types.ts +155 -520
- 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 +542 -469
- package/plugins/workflow-runner/src/workflowState.ts +639 -589
- 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/skill-creator/scripts/run_eval.py +3 -2
- 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 +44 -6
- package/src/cli/print.ts +73 -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 +443 -74
- package/src/config/configService.ts +723 -142
- 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 +56 -20
- package/src/infra/verification.ts +87 -20
- 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 +152 -9
- package/src/plugins/pluginRunner.ts +186 -8
- package/src/plugins/slashFallback.js +113 -0
- package/src/plugins/slashFallback.ts +137 -0
- package/src/prompts/policyRegistry.js +15 -8
- package/src/prompts/policyRegistry.ts +18 -8
- 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 +148 -37
- package/src/tools/advisor/advisor.ts +161 -38
- 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 +70 -18
- package/src/tools/bash/bash.ts +75 -20
- 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/powershell/powershell.js +18 -1
- package/src/tools/powershell/powershell.ts +18 -2
- package/src/tools/presentresult/presentresult.js +6 -15
- package/src/tools/presentresult/presentresult.ts +6 -15
- package/src/tools/read/read.js +69 -11
- package/src/tools/read/read.ts +70 -11
- package/src/tools/shared/fileUtils.js +1 -2
- package/src/tools/shared/fileUtils.ts +1 -2
- package/src/tools/shared/permanentDeleteGuard.js +34 -3
- package/src/tools/shared/permanentDeleteGuard.ts +43 -6
- 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 -30
- package/src/tools/webbrowser/browserControl.ts +210 -50
- 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 +683 -144
- package/src/tools/webbrowser/webbrowser.ts +979 -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 +450 -42
- 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/DESIGN.md +449 -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 -618
- package/plugins/workflow-runner/src/expressions.ts +0 -622
- 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 -119
- package/plugins/workflow-runner/src/recovery.ts +0 -149
- 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 -41
- package/plugins/workflow-runner/src/stepExecutors/assert.ts +0 -50
- 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 -208
- package/plugins/workflow-runner/src/stepExecutors/tool.ts +0 -256
- package/plugins/workflow-runner/src/stepExecutors/verify.js +0 -58
- package/plugins/workflow-runner/src/stepExecutors/verify.ts +0 -68
- 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 -147
- 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/engineRobustness.test.ts +0 -226
- package/plugins/workflow-runner/test/expressions.test.ts +0 -397
- 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 -87
- 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 -220
- package/plugins/workflow-runner/test/recovery.test.ts +0 -265
- package/plugins/workflow-runner/test/runner.test.ts +0 -911
- package/plugins/workflow-runner/test/runnerPreflight.test.ts +0 -379
- package/plugins/workflow-runner/test/skillTurnDone.test.ts +0 -71
- package/plugins/workflow-runner/test/stateLifecycle.test.ts +0 -150
- package/plugins/workflow-runner/test/stepPipeline.test.ts +0 -114
- package/plugins/workflow-runner/test/taskArbitration.test.ts +0 -338
- package/plugins/workflow-runner/test/taskLifecycle.test.ts +0 -270
- 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 -199
- 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/src/tools/bash/bash.ts
CHANGED
|
@@ -63,7 +63,10 @@ import { requestUserChoice } from '../../askBridge.js';
|
|
|
63
63
|
import { classifyCommand } from '../../irreversible/rules.js';
|
|
64
64
|
import { startBackgroundTask } from '../tasks/backgroundTaskService.js';
|
|
65
65
|
import { processExecutionMetadata } from '../tasks/processEvidence.js';
|
|
66
|
-
import {
|
|
66
|
+
import {
|
|
67
|
+
permanentDeleteReason,
|
|
68
|
+
type ShellKind,
|
|
69
|
+
} from '../shared/permanentDeleteGuard.js';
|
|
67
70
|
import { ToolOutputStore } from '../shared/toolOutputStore.js';
|
|
68
71
|
|
|
69
72
|
// ---------------- 0. 常量 ----------------
|
|
@@ -112,6 +115,37 @@ function detectWindowsBash(): string | null {
|
|
|
112
115
|
|
|
113
116
|
const WIN_BASH = detectWindowsBash();
|
|
114
117
|
|
|
118
|
+
/**
|
|
119
|
+
* 本工具这一刻**真正**把命令交给谁执行。
|
|
120
|
+
*
|
|
121
|
+
* 单一出处:description(告诉模型该写哪种语法)与 permanentDeleteGuard(按哪套动词
|
|
122
|
+
* 匹配删除命令)必须看同一个判断,否则就会出现「description 说这是 cmd、守卫却按
|
|
123
|
+
* bash 匹配」这种两头对不上的裂缝 —— del / rd 会因此直接穿过全部三层防护。
|
|
124
|
+
*/
|
|
125
|
+
function effectiveShellKind(): ShellKind {
|
|
126
|
+
return process.platform === 'win32' && !WIN_BASH ? 'cmd' : 'bash';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 每台机器不同、只能运行时探测的 shell 方言警告(K1 事故修复的核心内容)。
|
|
131
|
+
* 单一出处:完整 description(下方)和 toolPromptGuides.ts 的压缩 override
|
|
132
|
+
* 都调这个函数,不允许各自抄一份文案——否则「压缩省 token」的那份会在
|
|
133
|
+
* 无 Git Bash 的机器上悄悄丢掉这条警告,模型照抄 POSIX 语法必挂
|
|
134
|
+
* (`mkdir -p` 在 cmd.exe 下不生成中间目录、`$VAR`/`export` 不存在)。
|
|
135
|
+
*/
|
|
136
|
+
export function bashShellNotice(): string {
|
|
137
|
+
if (process.platform !== 'win32') return '';
|
|
138
|
+
return WIN_BASH
|
|
139
|
+
? `# Shell (this machine)
|
|
140
|
+
Commands run in a real bash (Git Bash at ${WIN_BASH}). POSIX syntax works: \`mkdir -p\`, \`$VAR\`, \`$(...)\`, \`&&\`, \`[ -f x ]\` are all fine. Note the working directory is a Windows path — both \`D:\\path\` and \`/d/path\` forms work in this bash.`
|
|
141
|
+
: `# Shell (this machine) — IMPORTANT
|
|
142
|
+
No bash found on this Windows machine: commands run in cmd.exe (UTF-8 enforced). POSIX syntax does NOT work here:
|
|
143
|
+
- NO \`mkdir -p\` — cmd's \`mkdir a\\b\\c\` creates intermediate directories by default; better: the Write tool auto-creates parent directories
|
|
144
|
+
- NO \`$VAR\` / \`$(...)\` / \`[ -f x ]\` / \`export\` — use \`%VAR%\`, \`if exist\`, \`set\`
|
|
145
|
+
- Use \`dir\` / \`copy\` / \`del\` / \`type\` instead of \`ls\` / \`cp\` / \`rm\` / \`cat\`
|
|
146
|
+
\`&&\` and \`;\`-style chaining: \`&&\` works in cmd; \`;\` does not (use \`&\`).`;
|
|
147
|
+
}
|
|
148
|
+
|
|
115
149
|
/**
|
|
116
150
|
* G1:stdout / stderr 即时缓冲上限(各自)。命令狂输出(如 cat 大文件 / yes)时,
|
|
117
151
|
* 在最终统一截断之前先把内存封顶,防 OOM。取最终展示截断阈值的 2 倍 —— 正常输出不受影响,
|
|
@@ -289,6 +323,8 @@ const parameters = toToolParameters(inputSchema);
|
|
|
289
323
|
// - 先点明"专用工具优先"的原则,把每类操作映射到对应工具
|
|
290
324
|
// - 再列 Bash 自身的使用规范(绝对路径 / 不 cd / 超时 / 多命令并行...)
|
|
291
325
|
// - 最后强调安全黑名单(让模型知道哪些命令会被拒,避免反复试)
|
|
326
|
+
const shellNotice = bashShellNotice();
|
|
327
|
+
|
|
292
328
|
const description = `Executes a given bash command and returns its output.
|
|
293
329
|
|
|
294
330
|
The working directory persists between commands, but shell state does not. The shell environment is initialized from the user's profile.
|
|
@@ -332,8 +368,11 @@ Some commands return non-zero exit codes for informational (non-error) reasons.
|
|
|
332
368
|
- \`test\` / \`[\` exit 1 → condition is false (the answer to a question, not a failure)
|
|
333
369
|
Only exit codes ≥ 2 from these commands indicate a real failure. For all other commands, non-zero exit codes are treated as failures normally.
|
|
334
370
|
|
|
335
|
-
# Safety
|
|
336
|
-
|
|
371
|
+
# Safety - three levels, from strict to lenient
|
|
372
|
+
|
|
373
|
+
## 1. Blocked outright (fails before execution - do NOT retry with variants)
|
|
374
|
+
|
|
375
|
+
Catastrophic commands (no legitimate use):
|
|
337
376
|
- \`rm -rf /\` and variants targeting root, $HOME, ~, or system directories (/etc, /usr, /bin, /Windows, /Users, /home, ...)
|
|
338
377
|
- Filesystem destruction: \`mkfs\`, \`format X:\`, \`dd of=/dev/sdX\`, redirects to raw block devices
|
|
339
378
|
- Power management: \`shutdown\`, \`reboot\`, \`halt\`, \`poweroff\`, \`init 0/6\`
|
|
@@ -341,25 +380,37 @@ The following command patterns are blocked at the tool level and will fail befor
|
|
|
341
380
|
- Pipe-to-shell from network: \`curl ... | sh\`, \`wget ... | bash\`, etc.
|
|
342
381
|
- \`chmod 777 /\`, Windows full-disk \`del /s\` / \`rmdir /s\`, \`diskpart\`
|
|
343
382
|
|
|
344
|
-
|
|
383
|
+
Permanent deletion (bypasses the OS Trash / Recycle Bin - use the Trash tool instead):
|
|
384
|
+
- \`rm\`, \`unlink\`, \`rmdir\` (any shell-level file/dir deletion, any target)
|
|
385
|
+
- \`find ... -delete\`
|
|
386
|
+
- \`git clean -f\` / \`git clean --force\` (\`-n\` / \`--dry-run\` is fine)
|
|
345
387
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
: WIN_BASH
|
|
350
|
-
? `
|
|
388
|
+
To delete files or directories use the **Trash** tool (\`action: "move"\` - recoverable); to clean Git untracked files use Trash with \`action: "git-clean"\`.
|
|
389
|
+
Do NOT work around this by switching to \`find -delete\`, Python \`os.remove\`, Node \`fs.rm\`, or other shell variants - they are blocked the same way.
|
|
390
|
+
If a permanent deletion is truly required, ask the user to run it themselves in their terminal.
|
|
351
391
|
|
|
352
|
-
|
|
353
|
-
Commands run in a real bash (Git Bash at ${WIN_BASH}). POSIX syntax works: \`mkdir -p\`, \`$VAR\`, \`$(...)\`, \`&&\`, \`[ -f x ]\` are all fine. Note the working directory is a Windows path — both \`D:\\path\` and \`/d/path\` forms work in this bash.`
|
|
354
|
-
: `
|
|
392
|
+
## 2. Requires user confirmation (irreversible)
|
|
355
393
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
-
|
|
359
|
-
-
|
|
360
|
-
-
|
|
361
|
-
|
|
362
|
-
|
|
394
|
+
These have legitimate uses but destroy the last copy - execution pauses and asks the user to confirm. In non-interactive contexts (sub-agents, cron, batch mode) they are automatically cancelled.
|
|
395
|
+
- \`git push --force\` / \`-f\`, and \`git push origin +branch\` (+refspec = force push)
|
|
396
|
+
- \`git push --delete <branch>\` / \`git push :<branch>\` (deleting remote branches)
|
|
397
|
+
- \`git filter-branch\` / \`git filter-repo\` (rewriting history)
|
|
398
|
+
- \`git reflog expire --expire=now\` / \`git gc --prune=now\` (destroying reflog)
|
|
399
|
+
- \`shred -u\` / \`shred --remove\` (overwrite and delete - unrecoverable)
|
|
400
|
+
- SQL data destruction: \`DROP DATABASE\`, \`DROP TABLE\`, \`TRUNCATE TABLE\`
|
|
401
|
+
|
|
402
|
+
## 3. Warning only (command still runs)
|
|
403
|
+
|
|
404
|
+
These execute normally; a \`⚠️ 警告:\` line is prepended to the output as a reminder. They are NOT blocked.
|
|
405
|
+
- \`git reset --hard\` (reflog keeps it recoverable)
|
|
406
|
+
- \`git push --force-with-lease\` (rejects if the remote has unseen commits - the safe force-push form)
|
|
407
|
+
- \`git checkout -- .\` / \`git restore .\` (discards uncommitted changes)
|
|
408
|
+
- \`git branch -D\`, \`git stash drop\` / \`git stash clear\` (local, recoverable via reflog in most cases)
|
|
409
|
+
- \`git commit --amend\`, \`git commit --no-verify\`
|
|
410
|
+
- \`DELETE FROM ...\` (SQL row deletion; DROP/TRUNCATE are in level 2)
|
|
411
|
+
- \`kubectl delete\`, \`terraform destroy\`
|
|
412
|
+
|
|
413
|
+
Regular Git operations (commit, add, status, log, diff, pull, fetch, checkout <branch>, merge, rebase, etc.) run without extra restrictions.${shellNotice ? `\n\n${shellNotice}` : ''}`;
|
|
363
414
|
|
|
364
415
|
// ---------------- 4. call() —— 真正干活 ----------------
|
|
365
416
|
async function call(input: BashInput, signal?: AbortSignal, context?: ToolCallContext): Promise<ToolResult> {
|
|
@@ -374,7 +425,11 @@ async function call(input: BashInput, signal?: AbortSignal, context?: ToolCallCo
|
|
|
374
425
|
error: `安全检查拒绝执行:${forbiddenReason}\n命令:${command}`,
|
|
375
426
|
};
|
|
376
427
|
}
|
|
377
|
-
|
|
428
|
+
// 传**实际执行命令的 shell**,不是工具名:win32 上找不到 Git Bash 时下面走的是
|
|
429
|
+
// cmd.exe(见 WIN_BASH 探测),description 也会告诉模型「这里是 cmd」,模型于是写
|
|
430
|
+
// del / rd —— 按 'bash' 匹配的话这两个词一个都拦不住(黑名单与 irreversible 规则表
|
|
431
|
+
// 同样只认 POSIX 形态),等于三层全空。
|
|
432
|
+
const permanentDelete = permanentDeleteReason(command, effectiveShellKind());
|
|
378
433
|
if (permanentDelete) return { ok:false, error:`永久删除检查拒绝执行:${permanentDelete}\n命令:${command}` };
|
|
379
434
|
|
|
380
435
|
// 4a-1. 不可逆动作闸门:毁掉「最后一份副本」的命令要**停下来问人**。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const TOOL_CAPABILITIES = Object.freeze({
|
|
2
2
|
Read: 'files.read', Glob: 'files.read', Grep: 'files.read',
|
|
3
3
|
Snip: 'files.read',
|
|
4
|
-
Edit: 'files.write', MultiEdit: 'files.write', Write: 'files.write',
|
|
4
|
+
Edit: 'files.write', MultiEdit: 'files.write', Write: 'files.write', ApplyPatch: 'files.write',
|
|
5
5
|
Bash: 'shell',
|
|
6
6
|
PowerShell: 'shell', TaskOutput: 'background.process', TaskStop: 'background.process',
|
|
7
7
|
Trash: 'files.trash',
|
|
@@ -9,9 +9,11 @@ const TOOL_CAPABILITIES = Object.freeze({
|
|
|
9
9
|
Skill: 'skill.invoke', EnterWorktree: 'worktree.session', ExitWorktree: 'worktree.session',
|
|
10
10
|
TerminalCapture: 'terminal.capture',
|
|
11
11
|
LSP: 'code.intelligence', NotebookEdit: 'files.write',
|
|
12
|
-
WebSearch: 'web.search', WebFetch: 'web.fetch', WebBrowser: 'web.browser',
|
|
12
|
+
WebSearch: 'web.search', WebFetch: 'web.fetch', WebBrowser: 'web.browser', BrowserBatch: 'web.browser', BrowserCDP: 'web.browser',
|
|
13
13
|
Download: 'network.download',
|
|
14
|
-
ComputerUse: 'computer.use', AskUserQuestion: 'ask', Advisor: 'advisor',
|
|
14
|
+
ComputerUse: 'computer.use', AskUserQuestion: 'ask', Advisor: 'advisor', AdvisorDecision: 'advisor',
|
|
15
|
+
Agent: 'subagent', AgentMessage: 'subagent', AgentList: 'subagent', AgentWait: 'subagent',
|
|
16
|
+
AgentInterrupt: 'subagent', AgentFollowup: 'subagent',
|
|
15
17
|
PresentResult: 'delivery', GenerateImage: 'media', GenerateSpeech: 'media',
|
|
16
18
|
RecallMemory: 'memory', RememberMemory: 'memory', UpdateMemory: 'memory',
|
|
17
19
|
ListMemories: 'memory', ForgetMemory: 'memory', SetPersona: 'memory',
|
|
@@ -19,9 +21,12 @@ const TOOL_CAPABILITIES = Object.freeze({
|
|
|
19
21
|
SearchConversations: 'memory',
|
|
20
22
|
});
|
|
21
23
|
const CORE_TOOLS = new Set([
|
|
22
|
-
'Read', 'Glob', 'Grep', 'Edit', 'MultiEdit', 'Write', 'NotebookEdit', 'Bash',
|
|
24
|
+
'Read', 'Glob', 'Grep', 'Edit', 'MultiEdit', 'Write', 'ApplyPatch', 'NotebookEdit', 'Bash',
|
|
25
|
+
]);
|
|
26
|
+
const AUXILIARY_TOOLS = new Set([
|
|
27
|
+
'Advisor', 'AdvisorDecision', 'Agent', 'AgentMessage', 'AgentList',
|
|
28
|
+
'AgentWait', 'AgentInterrupt', 'AgentFollowup',
|
|
23
29
|
]);
|
|
24
|
-
const AUXILIARY_TOOLS = new Set(['Advisor', 'Agent']);
|
|
25
30
|
export function budgetClassForToolName(name) {
|
|
26
31
|
if (CORE_TOOLS.has(name))
|
|
27
32
|
return 'core';
|
|
@@ -26,7 +26,7 @@ export type ToolBudgetClass = 'core' | 'task' | 'auxiliary';
|
|
|
26
26
|
const TOOL_CAPABILITIES: Readonly<Record<string, CapabilityId>> = Object.freeze({
|
|
27
27
|
Read: 'files.read', Glob: 'files.read', Grep: 'files.read',
|
|
28
28
|
Snip: 'files.read',
|
|
29
|
-
Edit: 'files.write', MultiEdit: 'files.write', Write: 'files.write',
|
|
29
|
+
Edit: 'files.write', MultiEdit: 'files.write', Write: 'files.write', ApplyPatch: 'files.write',
|
|
30
30
|
Bash: 'shell',
|
|
31
31
|
PowerShell: 'shell', TaskOutput: 'background.process', TaskStop: 'background.process',
|
|
32
32
|
Trash: 'files.trash',
|
|
@@ -34,9 +34,11 @@ const TOOL_CAPABILITIES: Readonly<Record<string, CapabilityId>> = Object.freeze(
|
|
|
34
34
|
Skill: 'skill.invoke', EnterWorktree: 'worktree.session', ExitWorktree: 'worktree.session',
|
|
35
35
|
TerminalCapture: 'terminal.capture',
|
|
36
36
|
LSP: 'code.intelligence', NotebookEdit: 'files.write',
|
|
37
|
-
WebSearch: 'web.search', WebFetch: 'web.fetch', WebBrowser: 'web.browser',
|
|
37
|
+
WebSearch: 'web.search', WebFetch: 'web.fetch', WebBrowser: 'web.browser', BrowserBatch: 'web.browser', BrowserCDP: 'web.browser',
|
|
38
38
|
Download: 'network.download',
|
|
39
|
-
ComputerUse: 'computer.use', AskUserQuestion: 'ask', Advisor: 'advisor',
|
|
39
|
+
ComputerUse: 'computer.use', AskUserQuestion: 'ask', Advisor: 'advisor', AdvisorDecision: 'advisor',
|
|
40
|
+
Agent: 'subagent', AgentMessage: 'subagent', AgentList: 'subagent', AgentWait: 'subagent',
|
|
41
|
+
AgentInterrupt: 'subagent', AgentFollowup: 'subagent',
|
|
40
42
|
PresentResult: 'delivery', GenerateImage: 'media', GenerateSpeech: 'media',
|
|
41
43
|
RecallMemory: 'memory', RememberMemory: 'memory', UpdateMemory: 'memory',
|
|
42
44
|
ListMemories: 'memory', ForgetMemory: 'memory', SetPersona: 'memory',
|
|
@@ -45,9 +47,12 @@ const TOOL_CAPABILITIES: Readonly<Record<string, CapabilityId>> = Object.freeze(
|
|
|
45
47
|
});
|
|
46
48
|
|
|
47
49
|
const CORE_TOOLS = new Set([
|
|
48
|
-
'Read', 'Glob', 'Grep', 'Edit', 'MultiEdit', 'Write', 'NotebookEdit', 'Bash',
|
|
50
|
+
'Read', 'Glob', 'Grep', 'Edit', 'MultiEdit', 'Write', 'ApplyPatch', 'NotebookEdit', 'Bash',
|
|
51
|
+
]);
|
|
52
|
+
const AUXILIARY_TOOLS = new Set([
|
|
53
|
+
'Advisor', 'AdvisorDecision', 'Agent', 'AgentMessage', 'AgentList',
|
|
54
|
+
'AgentWait', 'AgentInterrupt', 'AgentFollowup',
|
|
49
55
|
]);
|
|
50
|
-
const AUXILIARY_TOOLS = new Set(['Advisor', 'Agent']);
|
|
51
56
|
|
|
52
57
|
export function budgetClassForToolName(name: string): ToolBudgetClass {
|
|
53
58
|
if (CORE_TOOLS.has(name)) return 'core';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const CONTINUATION_WINDOW_MS = 30 * 60_000;
|
|
2
|
+
const CONTINUATION_ONLY = /^(?:请)?(?:继续|接着(?:做|操作)?|重试|再试一次|往下做|恢复操作)[。!!\s]*$/i;
|
|
3
|
+
const DIRECT_DESKTOP = /(?:操作(?:电脑|桌面|屏幕|窗口|系统|本机)|电脑自动化|桌面自动化|查看(?:当前)?(?:桌面|屏幕|前台窗口)|截(?:取)?(?:当前)?屏|系统设置|控制面板|任务管理器|资源管理器|访达|Finder)/i;
|
|
4
|
+
const GUI_ACTION = /(?:点击|双击|右键|拖拽|滚动|输入|粘贴|按(?:键|快捷键)|切换|激活|关闭|移动|调整窗口|发送|发布|上传)/i;
|
|
5
|
+
const APP_TARGET = /(?:在|用|打开|切换到|进入)[^,。\n]{0,28}(?:应用|软件|客户端|微信|WeChat|钉钉|飞书|Slack|QQ|邮件|Outlook|Word|Excel|PowerPoint|设置|窗口)(?:里|中|上|内|给|向|并|,|。|\s|$)/i;
|
|
6
|
+
const DISCUSSION_ONLY = /(?:解释|介绍|讨论|分析|评审|代码|源码|实现|设计|为什么|是什么|如何实现|测试.*ComputerUse|ComputerUse.*测试)/i;
|
|
7
|
+
const DIRECT_TOOL_TASK = /(?:读取|分析|查看|理解).{0,12}(?:图片|照片|截图文件|PDF|文件|附件)|(?:搜索|修改|编写|重构|构建|运行测试|查找).{0,12}(?:代码|文件|网页)|(?:搜索网页|打开网址|访问网站|网页中)/i;
|
|
8
|
+
/**
|
|
9
|
+
* Conservative, deterministic exposure classifier. It only consumes the
|
|
10
|
+
* current human input and a short-lived record of a real prior ComputerUse
|
|
11
|
+
* call; model output, page content, and tool arguments can never enable it.
|
|
12
|
+
*/
|
|
13
|
+
export function classifyComputerAutomationIntent(input, continuation, now = Date.now()) {
|
|
14
|
+
const text = input.trim();
|
|
15
|
+
if (continuation
|
|
16
|
+
&& now - continuation.lastUsedAt <= CONTINUATION_WINDOW_MS
|
|
17
|
+
&& CONTINUATION_ONLY.test(text)) {
|
|
18
|
+
return { needed: true, source: 'continuation', reason: '继续最近一次桌面自动化任务' };
|
|
19
|
+
}
|
|
20
|
+
if (!text)
|
|
21
|
+
return { needed: false, source: 'none', reason: '没有桌面操作请求' };
|
|
22
|
+
if (DIRECT_TOOL_TASK.test(text) && !DIRECT_DESKTOP.test(text)) {
|
|
23
|
+
return { needed: false, source: 'none', reason: '专用文件、图片或 Web 工具可直接完成' };
|
|
24
|
+
}
|
|
25
|
+
if (DISCUSSION_ONLY.test(text) && !DIRECT_DESKTOP.test(text) && !GUI_ACTION.test(text)) {
|
|
26
|
+
return { needed: false, source: 'none', reason: '仅讨论桌面能力,没有要求实际操作' };
|
|
27
|
+
}
|
|
28
|
+
if (DIRECT_DESKTOP.test(text) || (GUI_ACTION.test(text) && APP_TARGET.test(text))) {
|
|
29
|
+
return { needed: true, source: 'explicit-current', reason: '用户明确要求操作原生桌面界面' };
|
|
30
|
+
}
|
|
31
|
+
return { needed: false, source: 'none', reason: '未发现明确的原生桌面操作意图' };
|
|
32
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type ComputerAutomationIntent =
|
|
2
|
+
| { needed: true; source: 'explicit-current' | 'continuation'; reason: string }
|
|
3
|
+
| { needed: false; source: 'none'; reason: string };
|
|
4
|
+
|
|
5
|
+
export interface ComputerAutomationContinuationState {
|
|
6
|
+
lastUsedAt: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const CONTINUATION_WINDOW_MS = 30 * 60_000;
|
|
10
|
+
const CONTINUATION_ONLY = /^(?:请)?(?:继续|接着(?:做|操作)?|重试|再试一次|往下做|恢复操作)[。!!\s]*$/i;
|
|
11
|
+
const DIRECT_DESKTOP = /(?:操作(?:电脑|桌面|屏幕|窗口|系统|本机)|电脑自动化|桌面自动化|查看(?:当前)?(?:桌面|屏幕|前台窗口)|截(?:取)?(?:当前)?屏|系统设置|控制面板|任务管理器|资源管理器|访达|Finder)/i;
|
|
12
|
+
const GUI_ACTION = /(?:点击|双击|右键|拖拽|滚动|输入|粘贴|按(?:键|快捷键)|切换|激活|关闭|移动|调整窗口|发送|发布|上传)/i;
|
|
13
|
+
const APP_TARGET = /(?:在|用|打开|切换到|进入)[^,。\n]{0,28}(?:应用|软件|客户端|微信|WeChat|钉钉|飞书|Slack|QQ|邮件|Outlook|Word|Excel|PowerPoint|设置|窗口)(?:里|中|上|内|给|向|并|,|。|\s|$)/i;
|
|
14
|
+
const DISCUSSION_ONLY = /(?:解释|介绍|讨论|分析|评审|代码|源码|实现|设计|为什么|是什么|如何实现|测试.*ComputerUse|ComputerUse.*测试)/i;
|
|
15
|
+
const DIRECT_TOOL_TASK = /(?:读取|分析|查看|理解).{0,12}(?:图片|照片|截图文件|PDF|文件|附件)|(?:搜索|修改|编写|重构|构建|运行测试|查找).{0,12}(?:代码|文件|网页)|(?:搜索网页|打开网址|访问网站|网页中)/i;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Conservative, deterministic exposure classifier. It only consumes the
|
|
19
|
+
* current human input and a short-lived record of a real prior ComputerUse
|
|
20
|
+
* call; model output, page content, and tool arguments can never enable it.
|
|
21
|
+
*/
|
|
22
|
+
export function classifyComputerAutomationIntent(
|
|
23
|
+
input: string,
|
|
24
|
+
continuation?: ComputerAutomationContinuationState,
|
|
25
|
+
now = Date.now(),
|
|
26
|
+
): ComputerAutomationIntent {
|
|
27
|
+
const text = input.trim();
|
|
28
|
+
if (
|
|
29
|
+
continuation
|
|
30
|
+
&& now - continuation.lastUsedAt <= CONTINUATION_WINDOW_MS
|
|
31
|
+
&& CONTINUATION_ONLY.test(text)
|
|
32
|
+
) {
|
|
33
|
+
return { needed: true, source: 'continuation', reason: '继续最近一次桌面自动化任务' };
|
|
34
|
+
}
|
|
35
|
+
if (!text) return { needed: false, source: 'none', reason: '没有桌面操作请求' };
|
|
36
|
+
if (DIRECT_TOOL_TASK.test(text) && !DIRECT_DESKTOP.test(text)) {
|
|
37
|
+
return { needed: false, source: 'none', reason: '专用文件、图片或 Web 工具可直接完成' };
|
|
38
|
+
}
|
|
39
|
+
if (DISCUSSION_ONLY.test(text) && !DIRECT_DESKTOP.test(text) && !GUI_ACTION.test(text)) {
|
|
40
|
+
return { needed: false, source: 'none', reason: '仅讨论桌面能力,没有要求实际操作' };
|
|
41
|
+
}
|
|
42
|
+
if (DIRECT_DESKTOP.test(text) || (GUI_ACTION.test(text) && APP_TARGET.test(text))) {
|
|
43
|
+
return { needed: true, source: 'explicit-current', reason: '用户明确要求操作原生桌面界面' };
|
|
44
|
+
}
|
|
45
|
+
return { needed: false, source: 'none', reason: '未发现明确的原生桌面操作意图' };
|
|
46
|
+
}
|
|
@@ -28,6 +28,9 @@ import { CONSECUTIVE_FAILURE_LIMIT, readRecords, record, renderReport, summarize
|
|
|
28
28
|
function logPath() {
|
|
29
29
|
return join(computerUseStateDir(), 'telemetry.jsonl');
|
|
30
30
|
}
|
|
31
|
+
function exposureLogPath() {
|
|
32
|
+
return join(computerUseStateDir(), 'exposure.jsonl');
|
|
33
|
+
}
|
|
31
34
|
/**
|
|
32
35
|
* 记一条调用元数据。
|
|
33
36
|
*
|
|
@@ -42,6 +45,15 @@ export async function recordComputerUseCall(raw) {
|
|
|
42
45
|
/* 观测失败不影响功能 */
|
|
43
46
|
}
|
|
44
47
|
}
|
|
48
|
+
/** Records only the boolean exposure decision and a bounded enum source. */
|
|
49
|
+
export async function recordComputerUseExposure(exposed, intentSource) {
|
|
50
|
+
try {
|
|
51
|
+
await record(exposureLogPath(), { exposed, intentSource });
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
/* observability must never affect a turn */
|
|
55
|
+
}
|
|
56
|
+
}
|
|
45
57
|
export { CONSECUTIVE_FAILURE_LIMIT };
|
|
46
58
|
/**
|
|
47
59
|
* 人类可读的遥测汇总,给 CLI/诊断用。
|
|
@@ -38,6 +38,10 @@ function logPath(): string {
|
|
|
38
38
|
return join(computerUseStateDir(), 'telemetry.jsonl');
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
function exposureLogPath(): string {
|
|
42
|
+
return join(computerUseStateDir(), 'exposure.jsonl');
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
/**
|
|
42
46
|
* 记一条调用元数据。
|
|
43
47
|
*
|
|
@@ -52,6 +56,18 @@ export async function recordComputerUseCall(raw: Record<string, unknown>): Promi
|
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
/** Records only the boolean exposure decision and a bounded enum source. */
|
|
60
|
+
export async function recordComputerUseExposure(
|
|
61
|
+
exposed: boolean,
|
|
62
|
+
intentSource: 'explicit-current' | 'continuation' | 'none',
|
|
63
|
+
): Promise<void> {
|
|
64
|
+
try {
|
|
65
|
+
await record(exposureLogPath(), { exposed, intentSource });
|
|
66
|
+
} catch {
|
|
67
|
+
/* observability must never affect a turn */
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
55
71
|
export { CONSECUTIVE_FAILURE_LIMIT };
|
|
56
72
|
|
|
57
73
|
/**
|
|
@@ -30,6 +30,7 @@ const ALLOWED_FIELDS = new Set([
|
|
|
30
30
|
'changeRatio', 'settled', 'stableMs', 'settleConfidence', 'focusChange',
|
|
31
31
|
'settleMode', 'interrupted', 'refused', 'ok',
|
|
32
32
|
'frames', 'axNodes', 'axTruncated',
|
|
33
|
+
'exposed', 'intentSource',
|
|
33
34
|
// 不可逆动作审批的结局(短枚举,如 irreversible_approved / irreversible_denied)。
|
|
34
35
|
//
|
|
35
36
|
// 刻意**不**复用 `refused`:那个字段参与连续失败计数,而「用户不批准这次
|
|
@@ -33,6 +33,7 @@ const ALLOWED_FIELDS = new Set([
|
|
|
33
33
|
'changeRatio', 'settled', 'stableMs', 'settleConfidence', 'focusChange',
|
|
34
34
|
'settleMode', 'interrupted', 'refused', 'ok',
|
|
35
35
|
'frames', 'axNodes', 'axTruncated',
|
|
36
|
+
'exposed', 'intentSource',
|
|
36
37
|
// 不可逆动作审批的结局(短枚举,如 irreversible_approved / irreversible_denied)。
|
|
37
38
|
//
|
|
38
39
|
// 刻意**不**复用 `refused`:那个字段参与连续失败计数,而「用户不批准这次
|
|
@@ -29,9 +29,13 @@ export function createEffectiveToolSet(input) {
|
|
|
29
29
|
input.runtime.cwd,
|
|
30
30
|
input.runtime.surface,
|
|
31
31
|
input.runtime.profile,
|
|
32
|
+
input.runtime.conversationMode ?? 'private',
|
|
32
33
|
input.runtime.memoryAccess,
|
|
33
34
|
input.runtime.browser?.supervised === true ? 'supervised-browser' : 'no-browser',
|
|
34
35
|
input.runtime.computer ? 'computer' : 'no-computer',
|
|
36
|
+
input.runtime.computerIntent?.needed === true
|
|
37
|
+
? `computer-intent:${input.runtime.computerIntent.source}`
|
|
38
|
+
: 'no-computer-intent',
|
|
35
39
|
input.availableTools.map(identity).join(','),
|
|
36
40
|
availability.join(','),
|
|
37
41
|
input.allowedNames?.join(',') ?? '*',
|
|
@@ -46,9 +46,13 @@ export function createEffectiveToolSet(input: {
|
|
|
46
46
|
input.runtime.cwd,
|
|
47
47
|
input.runtime.surface,
|
|
48
48
|
input.runtime.profile,
|
|
49
|
+
input.runtime.conversationMode ?? 'private',
|
|
49
50
|
input.runtime.memoryAccess,
|
|
50
51
|
input.runtime.browser?.supervised === true ? 'supervised-browser' : 'no-browser',
|
|
51
52
|
input.runtime.computer ? 'computer' : 'no-computer',
|
|
53
|
+
input.runtime.computerIntent?.needed === true
|
|
54
|
+
? `computer-intent:${input.runtime.computerIntent.source}`
|
|
55
|
+
: 'no-computer-intent',
|
|
52
56
|
input.availableTools.map(identity).join(','),
|
|
53
57
|
availability.join(','),
|
|
54
58
|
input.allowedNames?.join(',') ?? '*',
|
package/src/tools/index.js
CHANGED
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
* ============================================================
|
|
14
14
|
*/
|
|
15
15
|
import { advisorTool } from './advisor/advisor.js';
|
|
16
|
+
import { advisorDecisionTool } from './advisor/advisorDecision.js';
|
|
17
|
+
import { applyPatchTool } from './applypatch/applyPatch.js';
|
|
16
18
|
// ⚠️ agent.ts 与本模块构成环(tools/index → agent → loop → tools/index):
|
|
17
19
|
// agent.ts 顶层不求值本模块/loop 的任何导出、loop.ts 的工具 token 估算已懒化,
|
|
18
20
|
// 环在运行时是安全的(详见 agent.ts 文件头「循环依赖纪律」)。
|
|
19
21
|
import { agentTool } from './agent/agent.js';
|
|
22
|
+
import { agentFollowupTool, agentInterruptTool, agentListTool, agentMessageTool, agentWaitTool, } from './agent/agentControl.js';
|
|
20
23
|
import { askUserQuestionTool } from './ask/ask.js';
|
|
21
24
|
import { bashTool } from './bash/bash.js';
|
|
22
25
|
import { assertCapabilityRegistry } from './capabilities.js';
|
|
@@ -40,14 +43,17 @@ import { taskCreateTool, taskGetTool, taskListTool, taskUpdateTool, } from './ta
|
|
|
40
43
|
import { taskOutputTool } from './tasks/taskOutput.js';
|
|
41
44
|
import { taskStopTool } from './tasks/taskStop.js';
|
|
42
45
|
import { terminalCaptureTool } from './terminal/terminalCapture.js';
|
|
46
|
+
import { attachBuiltinPromptGuides } from './toolPromptGuides.js';
|
|
43
47
|
import { trashTool } from './trash/trash.js';
|
|
44
48
|
import { webbrowserTool } from './webbrowser/webbrowser.js';
|
|
49
|
+
import { browserBatchTool } from './webbrowser/browserBatch.js';
|
|
50
|
+
import { browserCdpTool } from './webbrowser/browserCdp.js';
|
|
45
51
|
import { webfetchTool } from './webfetch/webfetch.js';
|
|
46
52
|
import { webSearchTool } from './websearch/websearch.js';
|
|
47
53
|
import { enterWorktreeTool, exitWorktreeTool, } from './worktree/sessionWorktree.js';
|
|
48
54
|
import { writeTool } from './write/write.js';
|
|
49
55
|
/** 所有内置工具(顺序 = 给 LLM 呈现的顺序,不影响代码执行,但会影响模型的优先级直觉) */
|
|
50
|
-
export const ALL_TOOLS = [
|
|
56
|
+
export const ALL_TOOLS = attachBuiltinPromptGuides([
|
|
51
57
|
readTool,
|
|
52
58
|
editTool,
|
|
53
59
|
multiEditTool,
|
|
@@ -79,9 +85,15 @@ export const ALL_TOOLS = [
|
|
|
79
85
|
taskStopTool,
|
|
80
86
|
askUserQuestionTool,
|
|
81
87
|
advisorTool,
|
|
88
|
+
advisorDecisionTool,
|
|
82
89
|
computerUseTool,
|
|
83
90
|
// 追加在末尾:主循环 tools schema 的原有前缀字节不动(提示词缓存友好)
|
|
84
91
|
agentTool,
|
|
92
|
+
agentMessageTool,
|
|
93
|
+
agentListTool,
|
|
94
|
+
agentWaitTool,
|
|
95
|
+
agentInterruptTool,
|
|
96
|
+
agentFollowupTool,
|
|
85
97
|
// Product tools append at the end to preserve the existing schema prefix cache.
|
|
86
98
|
trashTool,
|
|
87
99
|
taskCreateTool,
|
|
@@ -93,7 +105,11 @@ export const ALL_TOOLS = [
|
|
|
93
105
|
exitWorktreeTool,
|
|
94
106
|
terminalCaptureTool,
|
|
95
107
|
snipTool,
|
|
96
|
-
|
|
108
|
+
applyPatchTool,
|
|
109
|
+
// Browser extensions append after the stable legacy schema prefix.
|
|
110
|
+
browserBatchTool,
|
|
111
|
+
browserCdpTool,
|
|
112
|
+
]);
|
|
97
113
|
assertCapabilityRegistry(ALL_TOOLS.map((tool) => tool.name));
|
|
98
114
|
/** 按名字查表 */
|
|
99
115
|
export function getToolByName(name) {
|
|
@@ -197,7 +213,10 @@ export { clearPersonaTool, confirmMemoryTool, forgetMemoryTool, listMemoriesTool
|
|
|
197
213
|
export { multiEditTool } from './edit/multi-edit.js';
|
|
198
214
|
export { genImageTool } from './genimage/genimage.js';
|
|
199
215
|
export { advisorTool } from './advisor/advisor.js';
|
|
216
|
+
export { advisorDecisionTool } from './advisor/advisorDecision.js';
|
|
217
|
+
export { applyPatchTool } from './applypatch/applyPatch.js';
|
|
200
218
|
export { agentTool } from './agent/agent.js';
|
|
219
|
+
export { agentFollowupTool, agentInterruptTool, agentListTool, agentMessageTool, agentWaitTool, } from './agent/agentControl.js';
|
|
201
220
|
export { createGenerateSpeechTool, generateSpeechTool, } from './genspeech/genspeech.js';
|
|
202
221
|
export { createWebSearchTool } from './websearch/websearch.js';
|
|
203
222
|
export { lspTool } from './lsp/lsp.js';
|
package/src/tools/index.ts
CHANGED
|
@@ -15,10 +15,19 @@
|
|
|
15
15
|
|
|
16
16
|
import type { Tool, ToolCallContext, ToolResult } from '../types.js';
|
|
17
17
|
import { advisorTool } from './advisor/advisor.js';
|
|
18
|
+
import { advisorDecisionTool } from './advisor/advisorDecision.js';
|
|
19
|
+
import { applyPatchTool } from './applypatch/applyPatch.js';
|
|
18
20
|
// ⚠️ agent.ts 与本模块构成环(tools/index → agent → loop → tools/index):
|
|
19
21
|
// agent.ts 顶层不求值本模块/loop 的任何导出、loop.ts 的工具 token 估算已懒化,
|
|
20
22
|
// 环在运行时是安全的(详见 agent.ts 文件头「循环依赖纪律」)。
|
|
21
23
|
import { agentTool } from './agent/agent.js';
|
|
24
|
+
import {
|
|
25
|
+
agentFollowupTool,
|
|
26
|
+
agentInterruptTool,
|
|
27
|
+
agentListTool,
|
|
28
|
+
agentMessageTool,
|
|
29
|
+
agentWaitTool,
|
|
30
|
+
} from './agent/agentControl.js';
|
|
22
31
|
import { askUserQuestionTool } from './ask/ask.js';
|
|
23
32
|
import { bashTool } from './bash/bash.js';
|
|
24
33
|
import { assertCapabilityRegistry } from './capabilities.js';
|
|
@@ -58,8 +67,11 @@ import {
|
|
|
58
67
|
import { taskOutputTool } from './tasks/taskOutput.js';
|
|
59
68
|
import { taskStopTool } from './tasks/taskStop.js';
|
|
60
69
|
import { terminalCaptureTool } from './terminal/terminalCapture.js';
|
|
70
|
+
import { attachBuiltinPromptGuides } from './toolPromptGuides.js';
|
|
61
71
|
import { trashTool } from './trash/trash.js';
|
|
62
72
|
import { webbrowserTool } from './webbrowser/webbrowser.js';
|
|
73
|
+
import { browserBatchTool } from './webbrowser/browserBatch.js';
|
|
74
|
+
import { browserCdpTool } from './webbrowser/browserCdp.js';
|
|
63
75
|
import { webfetchTool } from './webfetch/webfetch.js';
|
|
64
76
|
import { webSearchTool } from './websearch/websearch.js';
|
|
65
77
|
import {
|
|
@@ -69,7 +81,7 @@ import {
|
|
|
69
81
|
import { writeTool } from './write/write.js';
|
|
70
82
|
|
|
71
83
|
/** 所有内置工具(顺序 = 给 LLM 呈现的顺序,不影响代码执行,但会影响模型的优先级直觉) */
|
|
72
|
-
export const ALL_TOOLS: Tool[] = [
|
|
84
|
+
export const ALL_TOOLS: Tool[] = attachBuiltinPromptGuides([
|
|
73
85
|
readTool,
|
|
74
86
|
editTool,
|
|
75
87
|
multiEditTool,
|
|
@@ -101,9 +113,15 @@ export const ALL_TOOLS: Tool[] = [
|
|
|
101
113
|
taskStopTool,
|
|
102
114
|
askUserQuestionTool,
|
|
103
115
|
advisorTool,
|
|
116
|
+
advisorDecisionTool,
|
|
104
117
|
computerUseTool,
|
|
105
118
|
// 追加在末尾:主循环 tools schema 的原有前缀字节不动(提示词缓存友好)
|
|
106
119
|
agentTool,
|
|
120
|
+
agentMessageTool,
|
|
121
|
+
agentListTool,
|
|
122
|
+
agentWaitTool,
|
|
123
|
+
agentInterruptTool,
|
|
124
|
+
agentFollowupTool,
|
|
107
125
|
// Product tools append at the end to preserve the existing schema prefix cache.
|
|
108
126
|
trashTool,
|
|
109
127
|
taskCreateTool,
|
|
@@ -115,7 +133,11 @@ export const ALL_TOOLS: Tool[] = [
|
|
|
115
133
|
exitWorktreeTool,
|
|
116
134
|
terminalCaptureTool,
|
|
117
135
|
snipTool,
|
|
118
|
-
|
|
136
|
+
applyPatchTool,
|
|
137
|
+
// Browser extensions append after the stable legacy schema prefix.
|
|
138
|
+
browserBatchTool,
|
|
139
|
+
browserCdpTool,
|
|
140
|
+
]);
|
|
119
141
|
|
|
120
142
|
assertCapabilityRegistry(ALL_TOOLS.map((tool) => tool.name));
|
|
121
143
|
|
|
@@ -263,7 +285,16 @@ export {
|
|
|
263
285
|
export { multiEditTool } from './edit/multi-edit.js';
|
|
264
286
|
export { genImageTool } from './genimage/genimage.js';
|
|
265
287
|
export { advisorTool } from './advisor/advisor.js';
|
|
288
|
+
export { advisorDecisionTool } from './advisor/advisorDecision.js';
|
|
289
|
+
export { applyPatchTool } from './applypatch/applyPatch.js';
|
|
266
290
|
export { agentTool } from './agent/agent.js';
|
|
291
|
+
export {
|
|
292
|
+
agentFollowupTool,
|
|
293
|
+
agentInterruptTool,
|
|
294
|
+
agentListTool,
|
|
295
|
+
agentMessageTool,
|
|
296
|
+
agentWaitTool,
|
|
297
|
+
} from './agent/agentControl.js';
|
|
267
298
|
export {
|
|
268
299
|
createGenerateSpeechTool,
|
|
269
300
|
generateSpeechTool,
|
|
@@ -191,7 +191,24 @@ async function call(input, signal, context) {
|
|
|
191
191
|
}
|
|
192
192
|
export const powerShellTool = {
|
|
193
193
|
name: 'PowerShell',
|
|
194
|
-
description:
|
|
194
|
+
description: `Executes native PowerShell on Windows. Use for Windows-specific administration and scripts; use run_in_background for long builds, tests, or servers, then TaskOutput/TaskStop.
|
|
195
|
+
|
|
196
|
+
# Safety - two levels, from strict to lenient
|
|
197
|
+
|
|
198
|
+
## 1. Blocked outright (fails before execution - do NOT retry with variants)
|
|
199
|
+
|
|
200
|
+
Catastrophic commands (no legitimate use): \`rm -rf /\`-class deletions of root/$HOME/system directories, \`mkfs\`, \`format X:\`, \`dd\` to raw devices, shutdown/reboot, fork bombs, pipe-to-shell from network (\`curl ... | sh\`), \`chmod 777 /\`, full-disk \`del /s\` / \`rmdir /s\`, \`diskpart\`.
|
|
201
|
+
|
|
202
|
+
Permanent deletion (bypasses the Recycle Bin - use the Trash tool instead): \`Remove-Item\`, \`Clear-RecycleBin\`, \`del\` / \`erase\` / \`rd\` / \`rmdir\` / \`rm\` / \`ri\`, and \`.Delete()\` method calls - all fail before execution.
|
|
203
|
+
To delete files or directories use the **Trash** tool (\`action: "move"\` - recoverable); to clean Git untracked files use Trash with \`action: "git-clean"\`. Do NOT try other deletion spellings - they are blocked the same way. If a permanent deletion is truly required, ask the user to run it themselves.
|
|
204
|
+
|
|
205
|
+
## 2. Requires user confirmation (irreversible)
|
|
206
|
+
|
|
207
|
+
These have legitimate uses but destroy the last copy - execution pauses and asks the user to confirm. In non-interactive contexts they are automatically cancelled.
|
|
208
|
+
- \`git push --force\` / \`-f\` / \`+refspec\`, \`git push --delete <branch>\`
|
|
209
|
+
- \`git filter-branch\` / \`git filter-repo\`, \`git reflog expire --expire=now\` / \`git gc --prune=now\`
|
|
210
|
+
- \`shred -u\` / \`shred --remove\`
|
|
211
|
+
- SQL data destruction: \`DROP DATABASE\`, \`DROP TABLE\`, \`TRUNCATE TABLE\``,
|
|
195
212
|
inputSchema,
|
|
196
213
|
parameters: toToolParameters(inputSchema),
|
|
197
214
|
isReadOnly: false,
|
|
@@ -219,8 +219,24 @@ async function call(
|
|
|
219
219
|
|
|
220
220
|
export const powerShellTool: Tool<PowerShellInput> = {
|
|
221
221
|
name: 'PowerShell',
|
|
222
|
-
description:
|
|
223
|
-
|
|
222
|
+
description: `Executes native PowerShell on Windows. Use for Windows-specific administration and scripts; use run_in_background for long builds, tests, or servers, then TaskOutput/TaskStop.
|
|
223
|
+
|
|
224
|
+
# Safety - two levels, from strict to lenient
|
|
225
|
+
|
|
226
|
+
## 1. Blocked outright (fails before execution - do NOT retry with variants)
|
|
227
|
+
|
|
228
|
+
Catastrophic commands (no legitimate use): \`rm -rf /\`-class deletions of root/$HOME/system directories, \`mkfs\`, \`format X:\`, \`dd\` to raw devices, shutdown/reboot, fork bombs, pipe-to-shell from network (\`curl ... | sh\`), \`chmod 777 /\`, full-disk \`del /s\` / \`rmdir /s\`, \`diskpart\`.
|
|
229
|
+
|
|
230
|
+
Permanent deletion (bypasses the Recycle Bin - use the Trash tool instead): \`Remove-Item\`, \`Clear-RecycleBin\`, \`del\` / \`erase\` / \`rd\` / \`rmdir\` / \`rm\` / \`ri\`, and \`.Delete()\` method calls - all fail before execution.
|
|
231
|
+
To delete files or directories use the **Trash** tool (\`action: "move"\` - recoverable); to clean Git untracked files use Trash with \`action: "git-clean"\`. Do NOT try other deletion spellings - they are blocked the same way. If a permanent deletion is truly required, ask the user to run it themselves.
|
|
232
|
+
|
|
233
|
+
## 2. Requires user confirmation (irreversible)
|
|
234
|
+
|
|
235
|
+
These have legitimate uses but destroy the last copy - execution pauses and asks the user to confirm. In non-interactive contexts they are automatically cancelled.
|
|
236
|
+
- \`git push --force\` / \`-f\` / \`+refspec\`, \`git push --delete <branch>\`
|
|
237
|
+
- \`git filter-branch\` / \`git filter-repo\`, \`git reflog expire --expire=now\` / \`git gc --prune=now\`
|
|
238
|
+
- \`shred -u\` / \`shred --remove\`
|
|
239
|
+
- SQL data destruction: \`DROP DATABASE\`, \`DROP TABLE\`, \`TRUNCATE TABLE\``,
|
|
224
240
|
inputSchema,
|
|
225
241
|
parameters: toToolParameters(inputSchema),
|
|
226
242
|
isReadOnly: false,
|