patchwarden 1.5.1 → 1.6.2
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/PatchWarden.cmd +32 -2
- package/README.en.md +158 -26
- package/README.md +124 -24
- package/dist/assessments/agentAssessor.js +21 -12
- package/dist/assessments/assessmentDiagnostics.d.ts +29 -0
- package/dist/assessments/assessmentDiagnostics.js +132 -0
- package/dist/assessments/assessmentStore.d.ts +39 -0
- package/dist/assessments/assessmentStore.js +207 -45
- package/dist/assessments/securitySnapshot.d.ts +50 -0
- package/dist/assessments/securitySnapshot.js +158 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +66 -13
- package/dist/control/fileManager.d.ts +2 -0
- package/dist/control/fileManager.js +39 -0
- package/dist/control/middleware/auth.d.ts +6 -0
- package/dist/control/middleware/auth.js +14 -5
- package/dist/control/middleware/static.js +16 -3
- package/dist/control/routeTable.d.ts +24 -0
- package/dist/control/routeTable.js +263 -0
- package/dist/control/routes/audit.js +17 -7
- package/dist/control/routes/evidence.js +1 -1
- package/dist/control/routes/lineage.js +1 -1
- package/dist/control/routes/process.d.ts +7 -0
- package/dist/control/routes/process.js +329 -42
- package/dist/control/routes/sessions.d.ts +9 -1
- package/dist/control/routes/sessions.js +84 -21
- package/dist/control/routes/status.d.ts +60 -1
- package/dist/control/routes/status.js +94 -15
- package/dist/control/routes/taskActions.js +24 -60
- package/dist/control/routes/tasks.d.ts +4 -0
- package/dist/control/routes/tasks.js +61 -62
- package/dist/control/routes/workspace.js +50 -23
- package/dist/control/runtime.d.ts +3 -2
- package/dist/control/runtime.js +65 -40
- package/dist/control/server.js +37 -365
- package/dist/control/shared.d.ts +25 -1
- package/dist/control/shared.js +64 -11
- package/dist/diagnostics/allowedTestCommandSafety.d.ts +1 -0
- package/dist/diagnostics/allowedTestCommandSafety.js +11 -0
- package/dist/direct/directAudit.js +234 -225
- package/dist/direct/directGuards.d.ts +2 -1
- package/dist/direct/directGuards.js +42 -29
- package/dist/direct/directPatch.d.ts +6 -1
- package/dist/direct/directPatch.js +55 -8
- package/dist/direct/directSessionStore.d.ts +16 -6
- package/dist/direct/directSessionStore.js +128 -35
- package/dist/direct/directVerification.js +8 -16
- package/dist/doctor.js +65 -57
- package/dist/goal/acceptanceEngine.d.ts +1 -1
- package/dist/goal/goalProgress.js +75 -69
- package/dist/goal/goalReport.js +5 -12
- package/dist/goal/goalStatus.d.ts +2 -0
- package/dist/goal/goalStatus.js +10 -3
- package/dist/goal/goalStore.d.ts +9 -2
- package/dist/goal/goalStore.js +152 -45
- package/dist/goal/handoffExport.js +6 -6
- package/dist/goal/specKitImport.js +97 -96
- package/dist/goal/subgoalSync.js +11 -9
- package/dist/goal/worktreeManager.d.ts +2 -0
- package/dist/goal/worktreeManager.js +209 -136
- package/dist/httpServer.js +111 -32
- package/dist/logging.js +5 -3
- package/dist/policy/projectPolicy.js +5 -2
- package/dist/release/releaseGate.d.ts +1 -1
- package/dist/release/releaseGate.js +78 -25
- package/dist/runner/agentInvocation.d.ts +14 -0
- package/dist/runner/agentInvocation.js +96 -4
- package/dist/runner/changeCapture.d.ts +13 -5
- package/dist/runner/changeCapture.js +243 -61
- package/dist/runner/postTaskCleanup.js +48 -19
- package/dist/runner/processSecurity.d.ts +56 -0
- package/dist/runner/processSecurity.js +373 -0
- package/dist/runner/runTask.d.ts +2 -1
- package/dist/runner/runTask.js +162 -93
- package/dist/runner/simpleProcess.d.ts +3 -0
- package/dist/runner/simpleProcess.js +50 -36
- package/dist/{taskProgress.d.ts → runner/taskProgress.d.ts} +1 -1
- package/dist/{taskProgress.js → runner/taskProgress.js} +2 -2
- package/dist/{taskRuntime.d.ts → runner/taskRuntime.d.ts} +3 -1
- package/dist/{taskRuntime.js → runner/taskRuntime.js} +3 -2
- package/dist/runner/taskStatusStore.d.ts +11 -0
- package/dist/runner/taskStatusStore.js +35 -0
- package/dist/runner/watch.d.ts +14 -1
- package/dist/runner/watch.js +320 -49
- package/dist/security/contentRedaction.js +2 -2
- package/dist/security/discoveryTokenStore.d.ts +3 -2
- package/dist/security/discoveryTokenStore.js +17 -2
- package/dist/security/loopbackHost.d.ts +2 -0
- package/dist/security/loopbackHost.js +16 -0
- package/dist/security/pathGuard.js +32 -17
- package/dist/security/planGuard.js +2 -1
- package/dist/security/runtimeGuard.js +9 -6
- package/dist/security/secretComparison.d.ts +3 -0
- package/dist/security/secretComparison.js +11 -0
- package/dist/security/sensitiveGuard.d.ts +5 -0
- package/dist/security/sensitiveGuard.js +27 -8
- package/dist/security/toolInvocationGuard.d.ts +2 -2
- package/dist/security/toolInvocationGuard.js +1 -1
- package/dist/security/workspaceRootGuard.d.ts +8 -0
- package/dist/security/workspaceRootGuard.js +47 -0
- package/dist/smoke-test.js +27 -26
- package/dist/tools/catalog/index.d.ts +4 -0
- package/dist/tools/catalog/index.js +4 -0
- package/dist/tools/{toolCatalog.js → catalog/toolCatalog.js} +3 -12
- package/dist/tools/{toolRegistry.d.ts → catalog/toolRegistry.d.ts} +3 -3
- package/dist/tools/{toolRegistry.js → catalog/toolRegistry.js} +6 -15
- package/dist/tools/definitions/toolDefs.d.ts +18 -0
- package/dist/tools/definitions/toolDefs.js +1177 -0
- package/dist/tools/{auditSession.d.ts → diagnostics/auditSession.d.ts} +1 -1
- package/dist/tools/{auditSession.js → diagnostics/auditSession.js} +2 -2
- package/dist/tools/{auditTask.d.ts → diagnostics/auditTask.d.ts} +2 -1
- package/dist/tools/{auditTask.js → diagnostics/auditTask.js} +134 -36
- package/dist/tools/{healthCheck.d.ts → diagnostics/healthCheck.d.ts} +18 -6
- package/dist/tools/{healthCheck.js → diagnostics/healthCheck.js} +36 -8
- package/dist/tools/diagnostics/index.d.ts +6 -0
- package/dist/tools/diagnostics/index.js +6 -0
- package/dist/tools/{safeStatus.d.ts → diagnostics/safeStatus.d.ts} +3 -3
- package/dist/tools/{safeStatus.js → diagnostics/safeStatus.js} +6 -6
- package/dist/tools/{safeViews.d.ts → diagnostics/safeViews.d.ts} +12 -8
- package/dist/tools/{safeViews.js → diagnostics/safeViews.js} +23 -13
- package/dist/tools/{schemaDriftCheck.d.ts → diagnostics/schemaDriftCheck.d.ts} +1 -1
- package/dist/tools/{schemaDriftCheck.js → diagnostics/schemaDriftCheck.js} +2 -2
- package/dist/tools/{createDirectSession.js → direct/createDirectSession.js} +6 -6
- package/dist/tools/{finalizeDirectSession.d.ts → direct/finalizeDirectSession.d.ts} +1 -1
- package/dist/tools/direct/finalizeDirectSession.js +86 -0
- package/dist/tools/direct/index.d.ts +3 -0
- package/dist/tools/direct/index.js +3 -0
- package/dist/tools/{runDirectVerificationBundle.js → direct/runDirectVerificationBundle.js} +2 -2
- package/dist/tools/{discoverTools.d.ts → discovery/discoverTools.d.ts} +2 -2
- package/dist/tools/{discoverTools.js → discovery/discoverTools.js} +5 -5
- package/dist/tools/{explainTool.d.ts → discovery/explainTool.d.ts} +2 -2
- package/dist/tools/{explainTool.js → discovery/explainTool.js} +2 -2
- package/dist/tools/discovery/index.d.ts +3 -0
- package/dist/tools/discovery/index.js +3 -0
- package/dist/tools/{invokeDiscoveredTool.d.ts → discovery/invokeDiscoveredTool.d.ts} +2 -2
- package/dist/tools/{invokeDiscoveredTool.js → discovery/invokeDiscoveredTool.js} +5 -5
- package/dist/tools/dispatch/coreDispatch.js +32 -31
- package/dist/tools/dispatch/diagnosticDispatch.d.ts +3 -5
- package/dist/tools/dispatch/diagnosticDispatch.js +70 -68
- package/dist/tools/dispatch/directDispatch.js +11 -10
- package/dist/tools/dispatch/goalDispatch.js +5 -4
- package/dist/tools/dispatch/releaseDispatch.js +3 -2
- package/dist/tools/dispatch/validation.d.ts +7 -0
- package/dist/tools/dispatch/validation.js +71 -0
- package/dist/tools/{getPlan.js → goals/getPlan.js} +4 -4
- package/dist/tools/{goalSubgoalTask.d.ts → goals/goalSubgoalTask.d.ts} +1 -1
- package/dist/tools/goals/goalSubgoalTask.js +118 -0
- package/dist/tools/goals/index.d.ts +3 -0
- package/dist/tools/goals/index.js +3 -0
- package/dist/tools/{savePlan.js → goals/savePlan.js} +28 -8
- package/dist/tools/registry.d.ts +7 -11
- package/dist/tools/registry.js +17 -1178
- package/dist/tools/{checkReleaseGate.d.ts → release/checkReleaseGate.d.ts} +1 -1
- package/dist/tools/{checkReleaseGate.js → release/checkReleaseGate.js} +3 -3
- package/dist/tools/release/index.d.ts +2 -0
- package/dist/tools/release/index.js +2 -0
- package/dist/tools/{releaseMode.d.ts → release/releaseMode.d.ts} +2 -2
- package/dist/tools/{releaseMode.js → release/releaseMode.js} +46 -26
- package/dist/tools/tasks/cancelTask.d.ts +11 -0
- package/dist/tools/tasks/cancelTask.js +86 -0
- package/dist/tools/{createTask.d.ts → tasks/createTask.d.ts} +12 -4
- package/dist/tools/{createTask.js → tasks/createTask.js} +110 -34
- package/dist/tools/{diagnoseTask.d.ts → tasks/diagnoseTask.d.ts} +1 -1
- package/dist/tools/{diagnoseTask.js → tasks/diagnoseTask.js} +12 -16
- package/dist/tools/{evidencePack.js → tasks/evidencePack.js} +34 -22
- package/dist/tools/{getTaskFile.js → tasks/getTaskFile.js} +4 -4
- package/dist/tools/{getTaskStatus.d.ts → tasks/getTaskStatus.d.ts} +6 -1
- package/dist/tools/{getTaskStatus.js → tasks/getTaskStatus.js} +11 -6
- package/dist/tools/{getTaskStdoutTail.js → tasks/getTaskStdoutTail.js} +13 -11
- package/dist/tools/{getTaskSummary.js → tasks/getTaskSummary.js} +35 -36
- package/dist/tools/tasks/index.d.ts +18 -0
- package/dist/tools/tasks/index.js +18 -0
- package/dist/tools/tasks/killTask.d.ts +1 -0
- package/dist/tools/{listTasks.d.ts → tasks/listTasks.d.ts} +1 -1
- package/dist/tools/{listTasks.js → tasks/listTasks.js} +5 -4
- package/dist/tools/{reconcileTasks.d.ts → tasks/reconcileTasks.d.ts} +3 -2
- package/dist/tools/tasks/reconcileTasks.js +496 -0
- package/dist/tools/tasks/retryTask.js +60 -0
- package/dist/tools/{runTaskLoop.d.ts → tasks/runTaskLoop.d.ts} +6 -6
- package/dist/tools/{runTaskLoop.js → tasks/runTaskLoop.js} +63 -41
- package/dist/tools/tasks/runVerification.js +38 -0
- package/dist/tools/{taskLineage.js → tasks/taskLineage.js} +8 -7
- package/dist/tools/{taskOutputs.d.ts → tasks/taskOutputs.d.ts} +2 -2
- package/dist/tools/{taskOutputs.js → tasks/taskOutputs.js} +17 -16
- package/dist/tools/tasks/taskStates.d.ts +6 -0
- package/dist/tools/tasks/taskStates.js +52 -0
- package/dist/tools/{waitForTask.js → tasks/waitForTask.js} +3 -11
- package/dist/tools/{androidDoctor.js → workspace/androidDoctor.js} +16 -10
- package/dist/tools/{applyPatch.d.ts → workspace/applyPatch.d.ts} +1 -1
- package/dist/tools/workspace/applyPatch.js +53 -0
- package/dist/tools/{discardWorktree.js → workspace/discardWorktree.js} +3 -3
- package/dist/tools/workspace/index.d.ts +10 -0
- package/dist/tools/workspace/index.js +10 -0
- package/dist/tools/workspace/listAgents.d.ts +23 -0
- package/dist/tools/workspace/listAgents.js +56 -0
- package/dist/tools/{listWorkspace.js → workspace/listWorkspace.js} +3 -3
- package/dist/tools/{mergeWorktree.js → workspace/mergeWorktree.js} +3 -3
- package/dist/tools/{readWorkspaceFile.js → workspace/readWorkspaceFile.js} +8 -8
- package/dist/tools/{recommendAgentForTask.js → workspace/recommendAgentForTask.js} +3 -3
- package/dist/tools/{searchWorkspace.js → workspace/searchWorkspace.js} +5 -5
- package/dist/tools/{syncFile.d.ts → workspace/syncFile.d.ts} +1 -1
- package/dist/tools/workspace/syncFile.js +134 -0
- package/dist/utils/atomicFile.d.ts +7 -0
- package/dist/utils/atomicFile.js +67 -0
- package/dist/utils/boundedFile.d.ts +8 -0
- package/dist/utils/boundedFile.js +93 -0
- package/dist/utils/lockedJsonFile.d.ts +15 -0
- package/dist/utils/lockedJsonFile.js +224 -0
- package/dist/utils/platform.d.ts +11 -0
- package/dist/utils/platform.js +26 -0
- package/dist/utils/stableJson.d.ts +2 -0
- package/dist/utils/stableJson.js +12 -0
- package/dist/version.d.ts +3 -2
- package/dist/version.js +3 -2
- package/dist/watcherStatus.d.ts +2 -2
- package/dist/watcherStatus.js +18 -0
- package/docs/CODE_WIKI.md +808 -143
- package/docs/architecture.md +15 -55
- package/docs/assets/patchwarden-desktop-onboarding.png +0 -0
- package/docs/control-center/README.md +4 -4
- package/docs/dashboard-overview.md +4 -4
- package/docs/desktop-app.md +175 -0
- package/docs/evidence-pack-schema.md +3 -3
- package/docs/open-source-application.md +16 -11
- package/docs/release-checklist.md +1 -1
- package/docs/release-evidence.md +35 -39
- package/docs/task-safe-review-workflow.md +5 -5
- package/docs/threat-model.md +19 -1
- package/examples/config.example.json +4 -2
- package/package.json +27 -10
- package/scripts/README.md +15 -6
- package/scripts/build.js +11 -0
- package/scripts/checks/brand-check.js +3 -0
- package/scripts/checks/build-output-check.js +37 -0
- package/scripts/checks/control-center-smoke.js +102 -10
- package/scripts/checks/control-smoke.js +19 -8
- package/scripts/checks/http-mcp-smoke.js +82 -4
- package/scripts/checks/lifecycle-smoke.js +15 -12
- package/scripts/checks/mcp-manifest-check.js +1 -1
- package/scripts/checks/mcp-smoke.js +58 -4
- package/scripts/checks/package-manifest-check.js +20 -7
- package/scripts/checks/unit-tests.js +3 -5
- package/scripts/checks/watcher-supervisor-smoke.js +38 -1
- package/scripts/control/get-patchwarden-health.ps1 +1 -1
- package/scripts/control/manage-patchwarden.ps1 +69 -4
- package/scripts/control/provision-patchwarden-tunnel.ps1 +127 -0
- package/scripts/control/run-background-supervisor.ps1 +41 -0
- package/scripts/control/start-patchwarden-tunnel.ps1 +191 -33
- package/scripts/e2e/demo-runtime.mjs +153 -0
- package/{PatchWarden-Control-Tray.cmd → scripts/launchers/PatchWarden-Control-Tray.cmd} +3 -3
- package/scripts/launchers/PatchWarden-Control.cmd +6 -0
- package/{PatchWarden-Desktop.cmd → scripts/launchers/PatchWarden-Desktop.cmd} +2 -2
- package/scripts/launchers/Restart-PatchWarden-Control.cmd +6 -0
- package/{Stop-PatchWarden.cmd → scripts/launchers/Stop-PatchWarden.cmd} +2 -2
- package/scripts/lib/clean-generated-output.js +11 -0
- package/scripts/lib/file-discovery.js +12 -0
- package/scripts/release/desktop-preflight.js +211 -0
- package/scripts/release/pack-clean.js +59 -14
- package/src/assessments/agentAssessor.ts +26 -12
- package/src/assessments/assessmentDiagnostics.ts +172 -0
- package/src/assessments/assessmentStore.ts +288 -51
- package/src/assessments/securitySnapshot.ts +231 -0
- package/src/config.ts +70 -13
- package/src/control/fileManager.ts +40 -0
- package/src/control/middleware/auth.ts +22 -4
- package/src/control/middleware/static.ts +16 -3
- package/src/control/routeTable.ts +301 -0
- package/src/control/routes/audit.ts +14 -6
- package/src/control/routes/evidence.ts +1 -1
- package/src/control/routes/lineage.ts +1 -1
- package/src/control/routes/process.ts +341 -40
- package/src/control/routes/sessions.ts +88 -25
- package/src/control/routes/status.ts +134 -17
- package/src/control/routes/taskActions.ts +24 -58
- package/src/control/routes/tasks.ts +66 -58
- package/src/control/routes/workspace.ts +56 -25
- package/src/control/runtime.ts +71 -43
- package/src/control/server.ts +37 -342
- package/src/control/shared.ts +77 -11
- package/src/diagnostics/allowedTestCommandSafety.ts +12 -0
- package/src/direct/directAudit.ts +17 -9
- package/src/direct/directGuards.ts +72 -44
- package/src/direct/directPatch.ts +95 -8
- package/src/direct/directSessionStore.ts +213 -55
- package/src/direct/directVerification.ts +9 -23
- package/src/doctor.ts +76 -64
- package/src/goal/acceptanceEngine.ts +1 -1
- package/src/goal/goalProgress.ts +17 -13
- package/src/goal/goalReport.ts +5 -13
- package/src/goal/goalStatus.ts +19 -3
- package/src/goal/goalStore.ts +241 -54
- package/src/goal/handoffExport.ts +6 -6
- package/src/goal/specKitImport.ts +12 -12
- package/src/goal/subgoalSync.ts +11 -8
- package/src/goal/worktreeManager.ts +139 -22
- package/src/httpServer.ts +113 -30
- package/src/logging.ts +10 -3
- package/src/policy/projectPolicy.ts +5 -2
- package/src/release/releaseGate.ts +74 -27
- package/src/runner/agentInvocation.ts +126 -4
- package/src/runner/changeCapture.ts +291 -57
- package/src/runner/postTaskCleanup.ts +41 -17
- package/src/runner/processSecurity.ts +433 -0
- package/src/runner/runTask.ts +197 -97
- package/src/runner/simpleProcess.ts +66 -31
- package/src/{taskProgress.ts → runner/taskProgress.ts} +3 -3
- package/src/{taskRuntime.ts → runner/taskRuntime.ts} +6 -3
- package/src/runner/taskStatusStore.ts +69 -0
- package/src/runner/watch.ts +348 -52
- package/src/security/contentRedaction.ts +2 -2
- package/src/security/discoveryTokenStore.ts +18 -4
- package/src/security/loopbackHost.ts +19 -0
- package/src/security/pathGuard.ts +35 -16
- package/src/security/planGuard.ts +2 -1
- package/src/security/runtimeGuard.ts +9 -6
- package/src/security/secretComparison.ts +13 -0
- package/src/security/sensitiveGuard.ts +27 -8
- package/src/security/toolInvocationGuard.ts +2 -2
- package/src/security/workspaceRootGuard.ts +53 -0
- package/src/smoke-test.ts +27 -26
- package/src/tools/catalog/index.ts +4 -0
- package/src/tools/{toolCatalog.ts → catalog/toolCatalog.ts} +3 -12
- package/src/tools/{toolRegistry.ts → catalog/toolRegistry.ts} +7 -16
- package/src/tools/definitions/toolDefs.ts +1264 -0
- package/src/tools/{auditSession.ts → diagnostics/auditSession.ts} +2 -2
- package/src/tools/{auditTask.ts → diagnostics/auditTask.ts} +136 -39
- package/src/tools/{healthCheck.ts → diagnostics/healthCheck.ts} +37 -9
- package/src/tools/diagnostics/index.ts +6 -0
- package/src/tools/{safeStatus.ts → diagnostics/safeStatus.ts} +7 -7
- package/src/tools/{safeViews.ts → diagnostics/safeViews.ts} +27 -17
- package/src/tools/{schemaDriftCheck.ts → diagnostics/schemaDriftCheck.ts} +3 -3
- package/src/tools/{createDirectSession.ts → direct/createDirectSession.ts} +6 -6
- package/src/tools/{finalizeDirectSession.ts → direct/finalizeDirectSession.ts} +7 -5
- package/src/tools/direct/index.ts +3 -0
- package/src/tools/{runDirectVerificationBundle.ts → direct/runDirectVerificationBundle.ts} +2 -2
- package/src/tools/{discoverTools.ts → discovery/discoverTools.ts} +6 -6
- package/src/tools/{explainTool.ts → discovery/explainTool.ts} +3 -3
- package/src/tools/discovery/index.ts +3 -0
- package/src/tools/{invokeDiscoveredTool.ts → discovery/invokeDiscoveredTool.ts} +7 -7
- package/src/tools/dispatch/coreDispatch.ts +36 -31
- package/src/tools/dispatch/diagnosticDispatch.ts +26 -21
- package/src/tools/dispatch/directDispatch.ts +11 -10
- package/src/tools/dispatch/goalDispatch.ts +5 -4
- package/src/tools/dispatch/releaseDispatch.ts +3 -2
- package/src/tools/dispatch/validation.ts +78 -0
- package/src/tools/{getPlan.ts → goals/getPlan.ts} +4 -4
- package/src/tools/{goalSubgoalTask.ts → goals/goalSubgoalTask.ts} +41 -26
- package/src/tools/goals/index.ts +3 -0
- package/src/tools/{savePlan.ts → goals/savePlan.ts} +38 -8
- package/src/tools/registry.ts +17 -1261
- package/src/tools/{checkReleaseGate.ts → release/checkReleaseGate.ts} +3 -3
- package/src/tools/release/index.ts +2 -0
- package/src/tools/{releaseMode.ts → release/releaseMode.ts} +42 -24
- package/src/tools/tasks/cancelTask.ts +110 -0
- package/src/tools/{createTask.ts → tasks/createTask.ts} +161 -33
- package/src/tools/{diagnoseTask.ts → tasks/diagnoseTask.ts} +12 -16
- package/src/tools/{evidencePack.ts → tasks/evidencePack.ts} +36 -22
- package/src/tools/{getTaskFile.ts → tasks/getTaskFile.ts} +4 -4
- package/src/tools/{getTaskStatus.ts → tasks/getTaskStatus.ts} +13 -6
- package/src/tools/{getTaskStdoutTail.ts → tasks/getTaskStdoutTail.ts} +13 -11
- package/src/tools/{getTaskSummary.ts → tasks/getTaskSummary.ts} +46 -44
- package/src/tools/tasks/index.ts +18 -0
- package/src/tools/{listTasks.ts → tasks/listTasks.ts} +6 -5
- package/src/tools/{reconcileTasks.ts → tasks/reconcileTasks.ts} +228 -77
- package/src/tools/tasks/retryTask.ts +69 -0
- package/src/tools/{runTaskLoop.ts → tasks/runTaskLoop.ts} +73 -46
- package/src/tools/{runVerification.ts → tasks/runVerification.ts} +6 -3
- package/src/tools/{taskLineage.ts → tasks/taskLineage.ts} +8 -7
- package/src/tools/{taskOutputs.ts → tasks/taskOutputs.ts} +27 -20
- package/src/tools/tasks/taskStates.ts +54 -0
- package/src/tools/{waitForTask.ts → tasks/waitForTask.ts} +3 -12
- package/src/tools/{androidDoctor.ts → workspace/androidDoctor.ts} +15 -10
- package/src/tools/{applyPatch.ts → workspace/applyPatch.ts} +38 -16
- package/src/tools/{discardWorktree.ts → workspace/discardWorktree.ts} +3 -3
- package/src/tools/workspace/index.ts +10 -0
- package/src/tools/workspace/listAgents.ts +75 -0
- package/src/tools/{listWorkspace.ts → workspace/listWorkspace.ts} +3 -3
- package/src/tools/{mergeWorktree.ts → workspace/mergeWorktree.ts} +3 -3
- package/src/tools/{readWorkspaceFile.ts → workspace/readWorkspaceFile.ts} +8 -8
- package/src/tools/{recommendAgentForTask.ts → workspace/recommendAgentForTask.ts} +3 -3
- package/src/tools/{searchWorkspace.ts → workspace/searchWorkspace.ts} +5 -5
- package/src/tools/workspace/syncFile.ts +292 -0
- package/src/utils/atomicFile.ts +74 -0
- package/src/utils/boundedFile.ts +116 -0
- package/src/utils/lockedJsonFile.ts +251 -0
- package/src/utils/platform.ts +31 -0
- package/src/utils/stableJson.ts +12 -0
- package/src/version.ts +3 -2
- package/src/watcherStatus.ts +19 -1
- package/ui/desktop-bootstrap.js +11 -0
- package/ui/desktop-bridge.js +36 -0
- package/ui/desktop.css +160 -0
- package/ui/getting-started.js +93 -0
- package/ui/i18n.js +484 -0
- package/ui/log-parser.js +30 -0
- package/ui/pages/audit.html +12 -0
- package/ui/pages/dashboard.html +94 -147
- package/ui/pages/direct-sessions.html +123 -26
- package/ui/pages/getting-started.html +43 -0
- package/ui/pages/logs.html +134 -22
- package/ui/pages/settings.html +101 -0
- package/ui/pages/task-detail.html +12 -0
- package/ui/pages/tasks.html +54 -8
- package/ui/pages/workspace.html +38 -1
- package/ui/settings.js +254 -0
- package/PatchWarden-Control.cmd +0 -6
- package/Restart-PatchWarden-Control.cmd +0 -6
- package/dist/test/unit/acceptance-engine.test.d.ts +0 -1
- package/dist/test/unit/acceptance-engine.test.js +0 -228
- package/dist/test/unit/agent-router.test.d.ts +0 -1
- package/dist/test/unit/agent-router.test.js +0 -287
- package/dist/test/unit/android-doctor.test.d.ts +0 -1
- package/dist/test/unit/android-doctor.test.js +0 -118
- package/dist/test/unit/apply-patch.test.d.ts +0 -1
- package/dist/test/unit/apply-patch.test.js +0 -225
- package/dist/test/unit/audit-checks.test.d.ts +0 -1
- package/dist/test/unit/audit-checks.test.js +0 -350
- package/dist/test/unit/chinese-path.test.d.ts +0 -1
- package/dist/test/unit/chinese-path.test.js +0 -91
- package/dist/test/unit/command-guard.test.d.ts +0 -1
- package/dist/test/unit/command-guard.test.js +0 -160
- package/dist/test/unit/create-task.test.d.ts +0 -1
- package/dist/test/unit/create-task.test.js +0 -197
- package/dist/test/unit/diagnose-task.test.d.ts +0 -1
- package/dist/test/unit/diagnose-task.test.js +0 -457
- package/dist/test/unit/direct-guards.test.d.ts +0 -1
- package/dist/test/unit/direct-guards.test.js +0 -328
- package/dist/test/unit/discovery-token-store.test.d.ts +0 -1
- package/dist/test/unit/discovery-token-store.test.js +0 -139
- package/dist/test/unit/evidence-pack.test.d.ts +0 -1
- package/dist/test/unit/evidence-pack.test.js +0 -224
- package/dist/test/unit/get-task-status.test.d.ts +0 -1
- package/dist/test/unit/get-task-status.test.js +0 -174
- package/dist/test/unit/get-task-summary.test.d.ts +0 -1
- package/dist/test/unit/get-task-summary.test.js +0 -146
- package/dist/test/unit/goal-graph.test.d.ts +0 -1
- package/dist/test/unit/goal-graph.test.js +0 -298
- package/dist/test/unit/goal-progress.test.d.ts +0 -1
- package/dist/test/unit/goal-progress.test.js +0 -381
- package/dist/test/unit/goal-report.test.d.ts +0 -1
- package/dist/test/unit/goal-report.test.js +0 -159
- package/dist/test/unit/goal-status.test.d.ts +0 -1
- package/dist/test/unit/goal-status.test.js +0 -215
- package/dist/test/unit/goal-store.test.d.ts +0 -1
- package/dist/test/unit/goal-store.test.js +0 -253
- package/dist/test/unit/goal-subgoal-task.test.d.ts +0 -1
- package/dist/test/unit/goal-subgoal-task.test.js +0 -55
- package/dist/test/unit/goal-tools-registry.test.d.ts +0 -1
- package/dist/test/unit/goal-tools-registry.test.js +0 -192
- package/dist/test/unit/handoff-export.test.d.ts +0 -1
- package/dist/test/unit/handoff-export.test.js +0 -263
- package/dist/test/unit/invoke-discovered-tool.test.d.ts +0 -1
- package/dist/test/unit/invoke-discovered-tool.test.js +0 -167
- package/dist/test/unit/logging.test.d.ts +0 -1
- package/dist/test/unit/logging.test.js +0 -397
- package/dist/test/unit/path-guard.test.d.ts +0 -1
- package/dist/test/unit/path-guard.test.js +0 -133
- package/dist/test/unit/post-task-cleanup.test.d.ts +0 -1
- package/dist/test/unit/post-task-cleanup.test.js +0 -48
- package/dist/test/unit/project-policy-release-mode.test.d.ts +0 -1
- package/dist/test/unit/project-policy-release-mode.test.js +0 -125
- package/dist/test/unit/reconcile-tasks.test.d.ts +0 -1
- package/dist/test/unit/reconcile-tasks.test.js +0 -456
- package/dist/test/unit/release-gate.test.d.ts +0 -1
- package/dist/test/unit/release-gate.test.js +0 -242
- package/dist/test/unit/run-task-loop.test.d.ts +0 -1
- package/dist/test/unit/run-task-loop.test.js +0 -380
- package/dist/test/unit/safe-status.test.d.ts +0 -1
- package/dist/test/unit/safe-status.test.js +0 -165
- package/dist/test/unit/safe-views.test.d.ts +0 -1
- package/dist/test/unit/safe-views.test.js +0 -171
- package/dist/test/unit/schema-drift-check.test.d.ts +0 -1
- package/dist/test/unit/schema-drift-check.test.js +0 -176
- package/dist/test/unit/sensitive-guard.test.d.ts +0 -1
- package/dist/test/unit/sensitive-guard.test.js +0 -104
- package/dist/test/unit/spec-kit-import.test.d.ts +0 -1
- package/dist/test/unit/spec-kit-import.test.js +0 -341
- package/dist/test/unit/subgoal-sync.test.d.ts +0 -1
- package/dist/test/unit/subgoal-sync.test.js +0 -183
- package/dist/test/unit/sync-file.test.d.ts +0 -1
- package/dist/test/unit/sync-file.test.js +0 -154
- package/dist/test/unit/tool-invocation-guard.test.d.ts +0 -1
- package/dist/test/unit/tool-invocation-guard.test.js +0 -432
- package/dist/test/unit/tool-usage-stats.test.d.ts +0 -1
- package/dist/test/unit/tool-usage-stats.test.js +0 -300
- package/dist/test/unit/toolSearch.test.d.ts +0 -1
- package/dist/test/unit/toolSearch.test.js +0 -571
- package/dist/test/unit/wait-for-task.test.d.ts +0 -1
- package/dist/test/unit/wait-for-task.test.js +0 -144
- package/dist/test/unit/watcher-status.test.d.ts +0 -1
- package/dist/test/unit/watcher-status.test.js +0 -169
- package/dist/test/unit/worktree-manager.test.d.ts +0 -1
- package/dist/test/unit/worktree-manager.test.js +0 -176
- package/dist/tools/applyPatch.js +0 -41
- package/dist/tools/cancelTask.d.ts +0 -30
- package/dist/tools/cancelTask.js +0 -64
- package/dist/tools/finalizeDirectSession.js +0 -84
- package/dist/tools/goalSubgoalTask.js +0 -110
- package/dist/tools/killTask.d.ts +0 -15
- package/dist/tools/listAgents.d.ts +0 -12
- package/dist/tools/listAgents.js +0 -42
- package/dist/tools/reconcileTasks.js +0 -352
- package/dist/tools/retryTask.js +0 -45
- package/dist/tools/runVerification.js +0 -36
- package/dist/tools/syncFile.js +0 -65
- package/docs/control-center/control-center-daily-driver.md +0 -211
- package/docs/control-center/control-center-mvp.md +0 -205
- package/docs/control-center/control-center-phase2.md +0 -159
- package/docs/execution-plan-2026-07-09.md +0 -315
- package/docs/release-v0.6.0.md +0 -71
- package/docs/release-v0.6.1.md +0 -75
- package/docs/release-v0.6.4.md +0 -45
- package/docs/roadmap-execution-and-acceptance.md +0 -365
- package/src/test/unit/acceptance-engine.test.ts +0 -261
- package/src/test/unit/agent-router.test.ts +0 -342
- package/src/test/unit/android-doctor.test.ts +0 -158
- package/src/test/unit/apply-patch.test.ts +0 -293
- package/src/test/unit/audit-checks.test.ts +0 -567
- package/src/test/unit/chinese-path.test.ts +0 -106
- package/src/test/unit/command-guard.test.ts +0 -221
- package/src/test/unit/create-task.test.ts +0 -255
- package/src/test/unit/diagnose-task.test.ts +0 -544
- package/src/test/unit/direct-guards.test.ts +0 -467
- package/src/test/unit/discovery-token-store.test.ts +0 -181
- package/src/test/unit/evidence-pack.test.ts +0 -251
- package/src/test/unit/get-task-status.test.ts +0 -203
- package/src/test/unit/get-task-summary.test.ts +0 -173
- package/src/test/unit/goal-graph.test.ts +0 -347
- package/src/test/unit/goal-progress.test.ts +0 -538
- package/src/test/unit/goal-report.test.ts +0 -189
- package/src/test/unit/goal-status.test.ts +0 -270
- package/src/test/unit/goal-store.test.ts +0 -318
- package/src/test/unit/goal-subgoal-task.test.ts +0 -72
- package/src/test/unit/goal-tools-registry.test.ts +0 -245
- package/src/test/unit/handoff-export.test.ts +0 -295
- package/src/test/unit/invoke-discovered-tool.test.ts +0 -216
- package/src/test/unit/logging.test.ts +0 -497
- package/src/test/unit/path-guard.test.ts +0 -180
- package/src/test/unit/post-task-cleanup.test.ts +0 -53
- package/src/test/unit/project-policy-release-mode.test.ts +0 -156
- package/src/test/unit/reconcile-tasks.test.ts +0 -551
- package/src/test/unit/release-gate.test.ts +0 -314
- package/src/test/unit/run-task-loop.test.ts +0 -425
- package/src/test/unit/safe-status.test.ts +0 -187
- package/src/test/unit/safe-views.test.ts +0 -184
- package/src/test/unit/schema-drift-check.test.ts +0 -260
- package/src/test/unit/sensitive-guard.test.ts +0 -124
- package/src/test/unit/spec-kit-import.test.ts +0 -429
- package/src/test/unit/subgoal-sync.test.ts +0 -236
- package/src/test/unit/sync-file.test.ts +0 -231
- package/src/test/unit/tool-invocation-guard.test.ts +0 -542
- package/src/test/unit/tool-usage-stats.test.ts +0 -384
- package/src/test/unit/toolSearch.test.ts +0 -756
- package/src/test/unit/wait-for-task.test.ts +0 -176
- package/src/test/unit/watcher-status.test.ts +0 -190
- package/src/test/unit/worktree-manager.test.ts +0 -247
- package/src/tools/cancelTask.ts +0 -70
- package/src/tools/listAgents.ts +0 -54
- package/src/tools/retryTask.ts +0 -53
- package/src/tools/syncFile.ts +0 -122
- /package/dist/tools/{toolCatalog.d.ts → catalog/toolCatalog.d.ts} +0 -0
- /package/dist/tools/{toolSearch.d.ts → catalog/toolSearch.d.ts} +0 -0
- /package/dist/tools/{toolSearch.js → catalog/toolSearch.js} +0 -0
- /package/dist/tools/{toolUsageStats.d.ts → catalog/toolUsageStats.d.ts} +0 -0
- /package/dist/tools/{toolUsageStats.js → catalog/toolUsageStats.js} +0 -0
- /package/dist/tools/{createDirectSession.d.ts → direct/createDirectSession.d.ts} +0 -0
- /package/dist/tools/{runDirectVerificationBundle.d.ts → direct/runDirectVerificationBundle.d.ts} +0 -0
- /package/dist/tools/{getPlan.d.ts → goals/getPlan.d.ts} +0 -0
- /package/dist/tools/{savePlan.d.ts → goals/savePlan.d.ts} +0 -0
- /package/dist/tools/{evidencePack.d.ts → tasks/evidencePack.d.ts} +0 -0
- /package/dist/tools/{getTaskFile.d.ts → tasks/getTaskFile.d.ts} +0 -0
- /package/dist/tools/{getTaskProgress.d.ts → tasks/getTaskProgress.d.ts} +0 -0
- /package/dist/tools/{getTaskProgress.js → tasks/getTaskProgress.js} +0 -0
- /package/dist/tools/{getTaskStdoutTail.d.ts → tasks/getTaskStdoutTail.d.ts} +0 -0
- /package/dist/tools/{getTaskSummary.d.ts → tasks/getTaskSummary.d.ts} +0 -0
- /package/dist/tools/{killTask.js → tasks/killTask.js} +0 -0
- /package/dist/tools/{retryTask.d.ts → tasks/retryTask.d.ts} +0 -0
- /package/dist/tools/{runVerification.d.ts → tasks/runVerification.d.ts} +0 -0
- /package/dist/tools/{taskLineage.d.ts → tasks/taskLineage.d.ts} +0 -0
- /package/dist/tools/{waitForTask.d.ts → tasks/waitForTask.d.ts} +0 -0
- /package/dist/tools/{androidDoctor.d.ts → workspace/androidDoctor.d.ts} +0 -0
- /package/dist/tools/{discardWorktree.d.ts → workspace/discardWorktree.d.ts} +0 -0
- /package/dist/tools/{listWorkspace.d.ts → workspace/listWorkspace.d.ts} +0 -0
- /package/dist/tools/{mergeWorktree.d.ts → workspace/mergeWorktree.d.ts} +0 -0
- /package/dist/tools/{readWorkspaceFile.d.ts → workspace/readWorkspaceFile.d.ts} +0 -0
- /package/dist/tools/{recommendAgentForTask.d.ts → workspace/recommendAgentForTask.d.ts} +0 -0
- /package/dist/tools/{searchWorkspace.d.ts → workspace/searchWorkspace.d.ts} +0 -0
- /package/src/tools/{toolSearch.ts → catalog/toolSearch.ts} +0 -0
- /package/src/tools/{toolUsageStats.ts → catalog/toolUsageStats.ts} +0 -0
- /package/src/tools/{getTaskProgress.ts → tasks/getTaskProgress.ts} +0 -0
- /package/src/tools/{killTask.ts → tasks/killTask.ts} +0 -0
|
@@ -0,0 +1,1264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool definitions for PatchWarden MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from registry.ts to keep the registry focused on dispatch
|
|
5
|
+
* wiring. getToolDefs() builds the active tool list based on config
|
|
6
|
+
* (test/direct allow-lists, agent names, profile selection) and refreshes
|
|
7
|
+
* the tool catalog snapshot as a side effect.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { getAllConfiguredTestCommands, getAllConfiguredDirectCommands, getConfig } from "../../config.js";
|
|
11
|
+
import { TASK_TEMPLATE_NAMES } from "../taskTemplates.js";
|
|
12
|
+
import {
|
|
13
|
+
buildToolCatalogSnapshot,
|
|
14
|
+
resolveToolProfile,
|
|
15
|
+
selectToolsForProfile,
|
|
16
|
+
} from "../catalog/toolCatalog.js";
|
|
17
|
+
|
|
18
|
+
export interface ToolDef {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object";
|
|
23
|
+
properties: Record<string, unknown>;
|
|
24
|
+
required?: string[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getToolDefs(): ToolDef[] {
|
|
29
|
+
const config = getConfig();
|
|
30
|
+
const agentNames = Object.keys(config.agents).sort();
|
|
31
|
+
const routableAgentNames = [...agentNames, "auto"];
|
|
32
|
+
const agentDescription = agentNames.length > 0
|
|
33
|
+
? `Configured local agent name. Available agents: ${agentNames.map((name) => JSON.stringify(name)).join(", ")}. run_task_loop also accepts "auto" for bounded routing.`
|
|
34
|
+
: "Configured local agent name. No agents are currently configured.";
|
|
35
|
+
const testCommands = getAllConfiguredTestCommands(config).sort();
|
|
36
|
+
const directCommands = getAllConfiguredDirectCommands(config);
|
|
37
|
+
const tools: ToolDef[] = [
|
|
38
|
+
{
|
|
39
|
+
name: "save_plan",
|
|
40
|
+
description:
|
|
41
|
+
"Save an execution plan — ChatGPT writes the plan, PatchWarden stores it for local agent execution. Supports plan_ref to load a plan file already placed inside .patchwarden/plans.",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
title: { type: "string", description: "Plan title. Defaults to 'Inline plan' or 'Plan from file' when omitted." },
|
|
46
|
+
content: { type: "string", description: "Plan content in Markdown. Required unless plan_ref is provided." },
|
|
47
|
+
plan_ref: { type: "string", description: "Relative path to a plan file already inside .patchwarden/plans. When provided, the file content is loaded and title defaults to 'Plan from file' if title is empty." },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "get_plan",
|
|
53
|
+
description: "Read a saved plan by its plan_id.",
|
|
54
|
+
inputSchema: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: {
|
|
57
|
+
plan_id: { type: "string", description: "Plan ID returned by save_plan" },
|
|
58
|
+
},
|
|
59
|
+
required: ["plan_id"],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "health_check",
|
|
64
|
+
description:
|
|
65
|
+
"Check MCP catalog consistency, watcher freshness/supervisor state, workspace readiness, and configured agents. Agent availability is executable-only unless an explicit provider probe is requested. Use detail=self_diagnostic for expanded read-only evidence.",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
properties: {
|
|
69
|
+
detail: {
|
|
70
|
+
type: "string",
|
|
71
|
+
enum: ["standard", "self_diagnostic"],
|
|
72
|
+
default: "standard",
|
|
73
|
+
description: "Use self_diagnostic for catalog, watcher, agent, allowlist, workspace, and recent failure evidence.",
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "list_agents",
|
|
80
|
+
description:
|
|
81
|
+
"List agents from the active runtime config, verify executable and model-argument wiring, and report the config path used by this process. provider_status remains not_checked because this read-only check does not contact a model provider or test account balance.",
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
properties: {},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "create_task",
|
|
89
|
+
description:
|
|
90
|
+
"Create a repo-scoped task from exactly one source. For ChatGPT, prefer the guarded inspect_only, feature_small, or fix_tests template when it fits. A stale watcher preserves the task but returns execution_blocked and directs the client to health_check; otherwise call wait_for_task until terminal. Use execution_mode=assess_only to pre-assess risk and get an assessment_id without creating a task; then invoke the returned next_tool_call using only execution_mode=execute and the full assessment_id.",
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: "object",
|
|
93
|
+
properties: {
|
|
94
|
+
plan_id: { type: "string", description: "Plan ID from save_plan" },
|
|
95
|
+
inline_plan: { type: "string", description: "Inline Markdown plan. It is safety-checked and persisted as an auditable saved plan before task creation." },
|
|
96
|
+
plan_title: { type: "string", description: "Optional title used when inline_plan is supplied." },
|
|
97
|
+
template: {
|
|
98
|
+
type: "string",
|
|
99
|
+
enum: [...TASK_TEMPLATE_NAMES],
|
|
100
|
+
description: "Built-in guarded task template. ChatGPT should prefer inspect_only for diagnosis, feature_small for a scoped change, and fix_tests for known failing verification. Use with goal; rollback_scope_violation also requires source_task_id.",
|
|
101
|
+
},
|
|
102
|
+
goal: { type: "string", description: "Required task goal when template is supplied." },
|
|
103
|
+
source_task_id: { type: "string", description: "Required source task for rollback_scope_violation review." },
|
|
104
|
+
agent: {
|
|
105
|
+
type: "string",
|
|
106
|
+
description: agentDescription,
|
|
107
|
+
...(agentNames.length > 0 ? { enum: agentNames } : {}),
|
|
108
|
+
},
|
|
109
|
+
repo_path: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "Required repository path inside workspaceRoot. No implicit workspace-root fallback is allowed.",
|
|
112
|
+
},
|
|
113
|
+
test_command: {
|
|
114
|
+
type: "string",
|
|
115
|
+
description: testCommands.length
|
|
116
|
+
? `Optional exact-match verification command. Allowed: ${testCommands.map((command) => JSON.stringify(command)).join(", ")}`
|
|
117
|
+
: "Optional exact-match verification command. No commands are currently allowed.",
|
|
118
|
+
...(testCommands.length > 0 ? { enum: testCommands } : {}),
|
|
119
|
+
},
|
|
120
|
+
verify_commands: {
|
|
121
|
+
type: "array",
|
|
122
|
+
maxItems: 20,
|
|
123
|
+
items: {
|
|
124
|
+
type: "string",
|
|
125
|
+
...(testCommands.length > 0 ? { enum: testCommands } : {}),
|
|
126
|
+
},
|
|
127
|
+
description: "Recommended exact-match commands PatchWarden runs independently after the agent exits. Repository-scoped commands are re-authorized after repo_path is resolved.",
|
|
128
|
+
},
|
|
129
|
+
timeout_seconds: {
|
|
130
|
+
type: "integer",
|
|
131
|
+
minimum: 1,
|
|
132
|
+
maximum: config.maxTaskTimeoutSeconds,
|
|
133
|
+
default: config.defaultTaskTimeoutSeconds,
|
|
134
|
+
description: `Total task timeout in seconds (default ${config.defaultTaskTimeoutSeconds}, max ${config.maxTaskTimeoutSeconds})`,
|
|
135
|
+
},
|
|
136
|
+
execution_mode: {
|
|
137
|
+
type: "string",
|
|
138
|
+
enum: ["assess_only", "execute"],
|
|
139
|
+
default: "execute",
|
|
140
|
+
description: "assess_only: run deterministic risk checks and return an assessment_id without creating a task. execute (default): create and queue the task. When combined with assessment_id, the task parameters are loaded from the assessment record and freshness is revalidated.",
|
|
141
|
+
},
|
|
142
|
+
assessment_id: {
|
|
143
|
+
type: "string",
|
|
144
|
+
description: "Assessment ID from a prior assess_only call. When provided with execution_mode=execute, task parameters are loaded from the assessment record and locked to it. The full 128-bit ID (32 hex chars) must be provided; short IDs are display-only.",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
required: [],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "run_task_loop",
|
|
152
|
+
description:
|
|
153
|
+
"Run a guarded PatchWarden task loop by composing create_task, wait_for_task, safe summaries, and audit_task. It does not bypass the watcher, command allow-list, workspace confinement, or confirmation boundaries. Returns only bounded structured lineage and final status.",
|
|
154
|
+
inputSchema: {
|
|
155
|
+
type: "object",
|
|
156
|
+
properties: {
|
|
157
|
+
repo_path: {
|
|
158
|
+
type: "string",
|
|
159
|
+
description: "Required repository path inside workspaceRoot. No implicit workspace-root fallback is allowed.",
|
|
160
|
+
},
|
|
161
|
+
goal: { type: "string", description: "Task goal to execute through the guarded loop." },
|
|
162
|
+
verify_commands: {
|
|
163
|
+
type: "array",
|
|
164
|
+
minItems: 1,
|
|
165
|
+
maxItems: 20,
|
|
166
|
+
items: {
|
|
167
|
+
type: "string",
|
|
168
|
+
...(testCommands.length > 0 ? { enum: testCommands } : {}),
|
|
169
|
+
},
|
|
170
|
+
description: "Exact-match verification commands. The loop reuses create_task validation and will not run commands outside the allow-list.",
|
|
171
|
+
},
|
|
172
|
+
agent: {
|
|
173
|
+
type: "string",
|
|
174
|
+
description: agentDescription,
|
|
175
|
+
...(agentNames.length > 0 ? { enum: routableAgentNames } : {}),
|
|
176
|
+
},
|
|
177
|
+
template: {
|
|
178
|
+
type: "string",
|
|
179
|
+
enum: ["inspect_only", "feature_small", "release_check"],
|
|
180
|
+
default: "feature_small",
|
|
181
|
+
description: "Initial guarded task template. Follow-up repair tasks use fix_tests automatically when verification fails.",
|
|
182
|
+
},
|
|
183
|
+
max_iterations: {
|
|
184
|
+
type: "integer",
|
|
185
|
+
minimum: 1,
|
|
186
|
+
maximum: 5,
|
|
187
|
+
default: 3,
|
|
188
|
+
description: "Maximum total main/fix task attempts.",
|
|
189
|
+
},
|
|
190
|
+
task_timeout_seconds: {
|
|
191
|
+
type: "integer",
|
|
192
|
+
minimum: 1,
|
|
193
|
+
maximum: config.maxTaskTimeoutSeconds,
|
|
194
|
+
default: config.defaultTaskTimeoutSeconds,
|
|
195
|
+
description: `Per-task wait budget in seconds (default ${config.defaultTaskTimeoutSeconds}, max ${config.maxTaskTimeoutSeconds}).`,
|
|
196
|
+
},
|
|
197
|
+
auto_fix_tests: {
|
|
198
|
+
type: "boolean",
|
|
199
|
+
default: true,
|
|
200
|
+
description: "When true, create a fix_tests follow-up task after failed_verification until max_iterations is reached.",
|
|
201
|
+
},
|
|
202
|
+
auto_cleanup_artifacts: {
|
|
203
|
+
type: "boolean",
|
|
204
|
+
default: true,
|
|
205
|
+
description: "Records cleanup intent in lineage. Low-risk cleanup remains handled by runTask post-task cleanup.",
|
|
206
|
+
},
|
|
207
|
+
stop_on_high_risk: {
|
|
208
|
+
type: "boolean",
|
|
209
|
+
default: true,
|
|
210
|
+
description: "When true, stop immediately on non-policy high-risk audit evidence. Scope, policy, sensitive-path, release/publish, and confirmation boundaries always stop regardless of this flag.",
|
|
211
|
+
},
|
|
212
|
+
direct_verify: {
|
|
213
|
+
type: "boolean",
|
|
214
|
+
default: false,
|
|
215
|
+
description: "When true, run an independent Direct verification session after the guarded task/audit succeeds. Direct never patches files in this loop.",
|
|
216
|
+
},
|
|
217
|
+
direct_verify_commands: {
|
|
218
|
+
type: "array",
|
|
219
|
+
minItems: 1,
|
|
220
|
+
maxItems: 20,
|
|
221
|
+
items: {
|
|
222
|
+
type: "string",
|
|
223
|
+
...(directCommands.length > 0 ? { enum: directCommands } : {}),
|
|
224
|
+
},
|
|
225
|
+
description: "Optional Direct verification commands. Defaults to verify_commands and still must pass the Direct command allow-list.",
|
|
226
|
+
},
|
|
227
|
+
direct_verify_timeout_seconds: {
|
|
228
|
+
type: "integer",
|
|
229
|
+
minimum: 1,
|
|
230
|
+
maximum: Math.min(config.maxTaskTimeoutSeconds, config.directSessionTtlSeconds),
|
|
231
|
+
default: 120,
|
|
232
|
+
description: "Per-command timeout for Direct verification.",
|
|
233
|
+
},
|
|
234
|
+
scope_files: {
|
|
235
|
+
type: "array",
|
|
236
|
+
maxItems: 50,
|
|
237
|
+
items: { type: "string" },
|
|
238
|
+
description: "Optional bounded file scope used only for agent routing hints.",
|
|
239
|
+
},
|
|
240
|
+
isolation_mode: {
|
|
241
|
+
type: "string",
|
|
242
|
+
enum: ["current_repo", "worktree"],
|
|
243
|
+
default: "current_repo",
|
|
244
|
+
description: "Use current_repo by default. worktree creates an isolated git worktree for the task but never auto-merges it.",
|
|
245
|
+
},
|
|
246
|
+
worktree_base_branch: {
|
|
247
|
+
type: "string",
|
|
248
|
+
description: "Optional base-branch label recorded in lineage. v1.5 does not auto-checkout or merge this branch.",
|
|
249
|
+
},
|
|
250
|
+
worktree_cleanup: {
|
|
251
|
+
type: "string",
|
|
252
|
+
enum: ["keep", "archive", "delete_ignored_only"],
|
|
253
|
+
default: "keep",
|
|
254
|
+
description: "Cleanup intent recorded in lineage. v1.5 keeps worktrees by default and does not auto-delete them.",
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
required: ["repo_path", "goal", "verify_commands"],
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "recommend_agent_for_task",
|
|
262
|
+
description:
|
|
263
|
+
"Return a bounded read-only agent routing recommendation for a repo-scoped task. Does not start an agent, create a task, or read logs.",
|
|
264
|
+
inputSchema: {
|
|
265
|
+
type: "object",
|
|
266
|
+
properties: {
|
|
267
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
268
|
+
goal: { type: "string", description: "Task goal used for routing hints." },
|
|
269
|
+
scope_files: {
|
|
270
|
+
type: "array",
|
|
271
|
+
maxItems: 50,
|
|
272
|
+
items: { type: "string" },
|
|
273
|
+
description: "Optional bounded list of files or directories expected to be in scope.",
|
|
274
|
+
},
|
|
275
|
+
template: { type: "string", description: "Optional task template hint." },
|
|
276
|
+
risk_hint: { type: "string", description: "Optional compact risk hint text." },
|
|
277
|
+
},
|
|
278
|
+
required: ["repo_path", "goal"],
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "get_task_lineage",
|
|
283
|
+
description:
|
|
284
|
+
"Read a bounded safe summary for a run_task_loop lineage. Does not return full logs, diffs, stdout, stderr, or markdown artifacts.",
|
|
285
|
+
inputSchema: {
|
|
286
|
+
type: "object",
|
|
287
|
+
properties: {
|
|
288
|
+
lineage_id: { type: "string", description: "Lineage ID returned by run_task_loop." },
|
|
289
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum rounds/tasks/warnings to return." },
|
|
290
|
+
},
|
|
291
|
+
required: ["lineage_id"],
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "export_task_evidence_pack",
|
|
296
|
+
description:
|
|
297
|
+
"Export a bounded evidence pack for a run_task_loop lineage. Writes evidence.json and EVIDENCE.md without stdout, stderr, full logs, full diff, or sensitive file contents.",
|
|
298
|
+
inputSchema: {
|
|
299
|
+
type: "object",
|
|
300
|
+
properties: {
|
|
301
|
+
lineage_id: { type: "string", description: "Lineage ID returned by run_task_loop." },
|
|
302
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 12, description: "Maximum rounds/tasks/warnings to include." },
|
|
303
|
+
},
|
|
304
|
+
required: ["lineage_id"],
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: "get_project_policy",
|
|
309
|
+
description:
|
|
310
|
+
"Read the bounded effective .patchwarden/project-policy.json summary for a repository. Missing policy returns safe defaults. Project policy never expands PatchWarden command allow-lists, workspace confinement, sensitive-path blocking, or watcher/audit boundaries.",
|
|
311
|
+
inputSchema: {
|
|
312
|
+
type: "object",
|
|
313
|
+
properties: {
|
|
314
|
+
repo_path: {
|
|
315
|
+
type: "string",
|
|
316
|
+
description: "Repository path inside workspaceRoot.",
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
required: ["repo_path"],
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: "get_task_status",
|
|
324
|
+
description: "Check task status, execution phase, watcher health, pending reason, current command, timeout, and change evidence.",
|
|
325
|
+
inputSchema: {
|
|
326
|
+
type: "object",
|
|
327
|
+
properties: {
|
|
328
|
+
task_id: { type: "string", description: "Task ID from create_task" },
|
|
329
|
+
},
|
|
330
|
+
required: ["task_id"],
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: "get_result",
|
|
335
|
+
description: "Read result.md, or return structured availability and watcher evidence while the task is not terminal.",
|
|
336
|
+
inputSchema: {
|
|
337
|
+
type: "object",
|
|
338
|
+
properties: {
|
|
339
|
+
task_id: { type: "string", description: "Task ID" },
|
|
340
|
+
},
|
|
341
|
+
required: ["task_id"],
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: "get_result_json",
|
|
346
|
+
description: "Read the structured result.json for deterministic task acceptance.",
|
|
347
|
+
inputSchema: {
|
|
348
|
+
type: "object",
|
|
349
|
+
properties: {
|
|
350
|
+
task_id: { type: "string", description: "Task ID" },
|
|
351
|
+
},
|
|
352
|
+
required: ["task_id"],
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "get_diff",
|
|
357
|
+
description: "Read task diff evidence, or return structured availability and watcher evidence while it is not ready.",
|
|
358
|
+
inputSchema: {
|
|
359
|
+
type: "object",
|
|
360
|
+
properties: {
|
|
361
|
+
task_id: { type: "string", description: "Task ID" },
|
|
362
|
+
},
|
|
363
|
+
required: ["task_id"],
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
name: "get_test_log",
|
|
368
|
+
description: "Read test.log, or return structured availability and watcher evidence while it is not ready.",
|
|
369
|
+
inputSchema: {
|
|
370
|
+
type: "object",
|
|
371
|
+
properties: {
|
|
372
|
+
task_id: { type: "string", description: "Task ID" },
|
|
373
|
+
},
|
|
374
|
+
required: ["task_id"],
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
name: "list_workspace",
|
|
379
|
+
description:
|
|
380
|
+
"List files and directories within the workspace (sensitive files excluded).",
|
|
381
|
+
inputSchema: {
|
|
382
|
+
type: "object",
|
|
383
|
+
properties: {
|
|
384
|
+
path: {
|
|
385
|
+
type: "string",
|
|
386
|
+
description: "Optional relative path within workspace (default: root)",
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: "read_workspace_file",
|
|
393
|
+
description:
|
|
394
|
+
"Read a file within the workspace. Sensitive files (secrets, keys, tokens) are blocked. In Direct mode (with session_id), reads are scoped to the session's repo_path and return sha256.",
|
|
395
|
+
inputSchema: {
|
|
396
|
+
type: "object",
|
|
397
|
+
properties: {
|
|
398
|
+
path: {
|
|
399
|
+
type: "string",
|
|
400
|
+
description: "Relative path to a file inside the workspace or session repo",
|
|
401
|
+
},
|
|
402
|
+
session_id: {
|
|
403
|
+
type: "string",
|
|
404
|
+
description: "Optional Direct session ID. When provided, read scope is limited to the session's repo_path and sha256 is returned.",
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
required: ["path"],
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: "list_tasks",
|
|
412
|
+
description:
|
|
413
|
+
"List recent tasks with status/repo/active filters plus watcher state and computed pending reasons.",
|
|
414
|
+
inputSchema: {
|
|
415
|
+
type: "object",
|
|
416
|
+
properties: {
|
|
417
|
+
status: {
|
|
418
|
+
type: "string",
|
|
419
|
+
description: "Filter by status: pending, running, done, failed, failed_verification, failed_scope_violation, failed_policy_violation, timeout, canceled",
|
|
420
|
+
},
|
|
421
|
+
limit: {
|
|
422
|
+
type: "number",
|
|
423
|
+
description: "Max tasks to return (default 20, max 100)",
|
|
424
|
+
},
|
|
425
|
+
repo_path: {
|
|
426
|
+
type: "string",
|
|
427
|
+
description: "Optional exact repo_path or resolved_repo_path filter.",
|
|
428
|
+
},
|
|
429
|
+
active_only: {
|
|
430
|
+
type: "boolean",
|
|
431
|
+
description: "When true, return only pending and running tasks.",
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
name: "cancel_task",
|
|
438
|
+
description:
|
|
439
|
+
"Request graceful cancellation. The runner that owns the child process performs termination; the MCP server never kills a PID read from task files.",
|
|
440
|
+
inputSchema: {
|
|
441
|
+
type: "object",
|
|
442
|
+
properties: {
|
|
443
|
+
task_id: { type: "string", description: "Task ID to cancel" },
|
|
444
|
+
},
|
|
445
|
+
required: ["task_id"],
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: "kill_task",
|
|
450
|
+
description:
|
|
451
|
+
"Request immediate termination of a pending or running task. The runner validates and kills only the child process it owns.",
|
|
452
|
+
inputSchema: {
|
|
453
|
+
type: "object",
|
|
454
|
+
properties: {
|
|
455
|
+
task_id: { type: "string", description: "Task ID to terminate" },
|
|
456
|
+
},
|
|
457
|
+
required: ["task_id"],
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
name: "retry_task",
|
|
462
|
+
description:
|
|
463
|
+
"Create a new task with the same plan, agent, repo_path, and test_command as an existing task. The original task is unchanged.",
|
|
464
|
+
inputSchema: {
|
|
465
|
+
type: "object",
|
|
466
|
+
properties: {
|
|
467
|
+
task_id: { type: "string", description: "Task ID to retry" },
|
|
468
|
+
},
|
|
469
|
+
required: ["task_id"],
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "get_task_stdout_tail",
|
|
474
|
+
description:
|
|
475
|
+
"Read the last N lines of agent stdout/stderr. Reads from real-time stdout.log/stderr.log during execution, falls back to result.md after completion. Works on pending, running, and completed tasks. Default 80 lines.",
|
|
476
|
+
inputSchema: {
|
|
477
|
+
type: "object",
|
|
478
|
+
properties: {
|
|
479
|
+
task_id: { type: "string", description: "Task ID" },
|
|
480
|
+
lines: { type: "number", description: "Tail line count (default 80, max 200)" },
|
|
481
|
+
},
|
|
482
|
+
required: ["task_id"],
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
name: "get_task_log_tail",
|
|
487
|
+
description:
|
|
488
|
+
"Read the last N lines of a task log file (stdout/stderr/test/verify) with automatic secret redaction. Default 80 lines, max 200. Always returns tail only — never the full file. Use this instead of read_workspace_file to avoid triggering platform content filters on log output.",
|
|
489
|
+
inputSchema: {
|
|
490
|
+
type: "object",
|
|
491
|
+
properties: {
|
|
492
|
+
task_id: { type: "string", description: "Task ID" },
|
|
493
|
+
file: {
|
|
494
|
+
type: "string",
|
|
495
|
+
enum: ["stdout", "stderr", "test", "verify"],
|
|
496
|
+
description: "Log file to read: stdout (stdout.log), stderr (stderr.log), test (test.log), verify (verify.log)",
|
|
497
|
+
},
|
|
498
|
+
lines: { type: "number", description: "Tail line count (default 80, max 200)" },
|
|
499
|
+
redact: { type: "boolean", description: "Apply secret redaction (default true)" },
|
|
500
|
+
},
|
|
501
|
+
required: ["task_id", "file"],
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
name: "get_task_progress",
|
|
506
|
+
description:
|
|
507
|
+
"Read progress.md for task phases and the most recent heartbeat/current command.",
|
|
508
|
+
inputSchema: {
|
|
509
|
+
type: "object",
|
|
510
|
+
properties: {
|
|
511
|
+
task_id: { type: "string", description: "Task ID" },
|
|
512
|
+
},
|
|
513
|
+
required: ["task_id"],
|
|
514
|
+
},
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
name: "wait_for_task",
|
|
518
|
+
description:
|
|
519
|
+
"Long-poll a task for up to 30 seconds. If continuation_required=true, call wait_for_task again immediately and do not finish the assistant turn. Terminal responses include get_task_summary acceptance evidence.",
|
|
520
|
+
inputSchema: {
|
|
521
|
+
type: "object",
|
|
522
|
+
properties: {
|
|
523
|
+
task_id: { type: "string", description: "Task ID from create_task" },
|
|
524
|
+
wait_seconds: { type: "integer", minimum: 1, maximum: 30, default: 25 },
|
|
525
|
+
timeout_seconds: {
|
|
526
|
+
type: "integer",
|
|
527
|
+
minimum: 1,
|
|
528
|
+
maximum: 30,
|
|
529
|
+
description: "Preferred alias for wait_seconds. Maximum 30 seconds to stay within connector request limits.",
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
required: ["task_id"],
|
|
533
|
+
},
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
name: "get_task_summary",
|
|
537
|
+
description:
|
|
538
|
+
"Return structured acceptance evidence. Use view=compact first for bounded counts and risk excerpts; use standard only when full changed-file and log-tail detail is required.",
|
|
539
|
+
inputSchema: {
|
|
540
|
+
type: "object",
|
|
541
|
+
properties: {
|
|
542
|
+
task_id: { type: "string", description: "Task ID" },
|
|
543
|
+
view: { type: "string", enum: ["compact", "standard"], default: "standard", description: "Compact returns bounded acceptance evidence; standard preserves the full legacy summary." },
|
|
544
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum entries per compact evidence group." },
|
|
545
|
+
},
|
|
546
|
+
required: ["task_id"],
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
name: "audit_task",
|
|
551
|
+
description:
|
|
552
|
+
"Independently audit a task's outputs. Verifies status, result.md, test.log, git.diff, repo_path consistency, cross-references agent claims with package.json scripts, and flags unverified release/publish claims. Evidence-backed failures, possible heuristic false positives, and manual-verification items are returned separately. Writes independent-review.md to the task directory.",
|
|
553
|
+
inputSchema: {
|
|
554
|
+
type: "object",
|
|
555
|
+
properties: {
|
|
556
|
+
task_id: { type: "string", description: "Task ID to audit" },
|
|
557
|
+
},
|
|
558
|
+
required: ["task_id"],
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
name: "safe_status",
|
|
563
|
+
description:
|
|
564
|
+
"Return minimal task lifecycle status without exposing diff, log content, file contents, or sensitive paths. Use this when only task state is needed and content-bearing tools may be blocked by upper-layer security.",
|
|
565
|
+
inputSchema: {
|
|
566
|
+
type: "object",
|
|
567
|
+
properties: {
|
|
568
|
+
task_id: { type: "string", description: "Task ID to check" },
|
|
569
|
+
},
|
|
570
|
+
required: ["task_id"],
|
|
571
|
+
},
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: "safe_result",
|
|
575
|
+
description:
|
|
576
|
+
"Return a low-noise structured task result summary without full logs, markdown, or diff content.",
|
|
577
|
+
inputSchema: {
|
|
578
|
+
type: "object",
|
|
579
|
+
properties: {
|
|
580
|
+
task_id: { type: "string", description: "Task ID to summarize" },
|
|
581
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum list entries to return per evidence group." },
|
|
582
|
+
},
|
|
583
|
+
required: ["task_id"],
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
name: "safe_audit",
|
|
588
|
+
description:
|
|
589
|
+
"Run audit_task and return only bounded structured audit evidence without full review markdown.",
|
|
590
|
+
inputSchema: {
|
|
591
|
+
type: "object",
|
|
592
|
+
properties: {
|
|
593
|
+
task_id: { type: "string", description: "Task ID to audit" },
|
|
594
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum list entries to return per evidence group." },
|
|
595
|
+
},
|
|
596
|
+
required: ["task_id"],
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: "safe_test_summary",
|
|
601
|
+
description:
|
|
602
|
+
"Return a compact verification summary for a task without stdout/stderr or test log content.",
|
|
603
|
+
inputSchema: {
|
|
604
|
+
type: "object",
|
|
605
|
+
properties: {
|
|
606
|
+
task_id: { type: "string", description: "Task ID to summarize" },
|
|
607
|
+
},
|
|
608
|
+
required: ["task_id"],
|
|
609
|
+
},
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: "safe_diff_summary",
|
|
613
|
+
description:
|
|
614
|
+
"Return changed-file counts and bounded path metadata without returning diff content.",
|
|
615
|
+
inputSchema: {
|
|
616
|
+
type: "object",
|
|
617
|
+
properties: {
|
|
618
|
+
task_id: { type: "string", description: "Task ID to summarize" },
|
|
619
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum changed files to return." },
|
|
620
|
+
},
|
|
621
|
+
required: ["task_id"],
|
|
622
|
+
},
|
|
623
|
+
}, {
|
|
624
|
+
name: "diagnose_task",
|
|
625
|
+
description:
|
|
626
|
+
"v0.7.0: Diagnose a running or collecting_artifacts task using multi-signal evidence (heartbeat age, log freshness, child PID liveness, watcher ownership, artifact presence). Returns a conservative diagnosis (active_running, stale_running, possibly_stale_running, orphaned_running, artifact_collection_stuck, done_candidate, unknown, terminal) with confidence level and safe_actions. Never relies on a single signal; refuses to call PID-alive tasks 'active' when other signals are stale (PID reuse protection). Read-only — does not modify task state.",
|
|
627
|
+
inputSchema: {
|
|
628
|
+
type: "object",
|
|
629
|
+
properties: {
|
|
630
|
+
task_id: { type: "string", description: "Task ID to diagnose" },
|
|
631
|
+
include_logs: {
|
|
632
|
+
type: "boolean",
|
|
633
|
+
default: false,
|
|
634
|
+
description: "When true, include redacted stdout/stderr tails in the output. Default false to keep output minimal.",
|
|
635
|
+
},
|
|
636
|
+
},
|
|
637
|
+
required: ["task_id"],
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
name: "reconcile_tasks",
|
|
642
|
+
description:
|
|
643
|
+
"v0.7.0: Scan stale running/collecting_artifacts tasks and either report or safely fix them. report_only (default) returns a diagnosis report without modifying state. safe_fix additionally writes high-confidence status transitions (failed_stale/orphaned/done_by_agent) atomically with backup (status.json.bak), audit fields, and an appended reconcile.log. Never touches tasks still owned by an active watcher; never applies medium/low confidence fixes.",
|
|
644
|
+
inputSchema: {
|
|
645
|
+
type: "object",
|
|
646
|
+
properties: {
|
|
647
|
+
mode: {
|
|
648
|
+
type: "string",
|
|
649
|
+
enum: ["report_only", "safe_fix"],
|
|
650
|
+
default: "report_only",
|
|
651
|
+
description: "report_only: read-only diagnosis report. safe_fix: additionally apply high-confidence status transitions with backup + atomic write + reconcile.log.",
|
|
652
|
+
},
|
|
653
|
+
max_age_minutes: {
|
|
654
|
+
type: "number",
|
|
655
|
+
minimum: 1,
|
|
656
|
+
maximum: 1440,
|
|
657
|
+
default: 30,
|
|
658
|
+
description: "Only consider tasks older than this (based on created_at or status.json mtime). Default 30 minutes.",
|
|
659
|
+
},
|
|
660
|
+
include_done_candidates: {
|
|
661
|
+
type: "boolean",
|
|
662
|
+
default: true,
|
|
663
|
+
description: "Include done_by_agent tasks as candidates (useful for auditing acceptance_status). Default true.",
|
|
664
|
+
},
|
|
665
|
+
},
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
name: "discover_tools",
|
|
670
|
+
description:
|
|
671
|
+
"v0.7.1: Search candidate tools by natural-language query (Chinese or English). Returns compressed summaries with risk level and schema digest. Filters by profile/mode/riskCeiling. High-risk tools (command/release/credential_sensitive) are hidden by default unless includeHighRisk=true. Read-only — never invokes tools.",
|
|
672
|
+
inputSchema: {
|
|
673
|
+
type: "object",
|
|
674
|
+
properties: {
|
|
675
|
+
query: {
|
|
676
|
+
type: "string",
|
|
677
|
+
description: "Natural-language search query. Supports Chinese intent terms (验收/改文件/发布/状态/差异/卡住/旧任务/搜索/工具/诊断 etc.) and English keywords.",
|
|
678
|
+
},
|
|
679
|
+
profile: {
|
|
680
|
+
type: "string",
|
|
681
|
+
enum: ["full", "chatgpt_core", "chatgpt_direct", "chatgpt_search"],
|
|
682
|
+
description: "Filter tools by profile. Default: no filter (all profiles).",
|
|
683
|
+
},
|
|
684
|
+
mode: {
|
|
685
|
+
type: "string",
|
|
686
|
+
enum: ["delegate", "direct", "audit", "release", "diagnostic"],
|
|
687
|
+
description: "Filter tools by mode. Default: no filter.",
|
|
688
|
+
},
|
|
689
|
+
maxResults: {
|
|
690
|
+
type: "number",
|
|
691
|
+
minimum: 1,
|
|
692
|
+
maximum: 50,
|
|
693
|
+
default: 8,
|
|
694
|
+
description: "Maximum number of results. Default 8.",
|
|
695
|
+
},
|
|
696
|
+
riskCeiling: {
|
|
697
|
+
type: "string",
|
|
698
|
+
enum: ["readonly", "workspace_read_sensitive", "workspace_write", "command", "release", "credential_sensitive"],
|
|
699
|
+
description: "Maximum risk level to include. Tools above this level are hidden. Overrides includeHighRisk.",
|
|
700
|
+
},
|
|
701
|
+
includeHighRisk: {
|
|
702
|
+
type: "boolean",
|
|
703
|
+
default: false,
|
|
704
|
+
description: "When true, include high-risk tools (command/release/credential_sensitive) in results. Default false.",
|
|
705
|
+
},
|
|
706
|
+
},
|
|
707
|
+
required: ["query"],
|
|
708
|
+
},
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
name: "explain_tool",
|
|
712
|
+
description:
|
|
713
|
+
"v0.7.1: Expand a single tool's metadata — title, summary, risk level, tags, aliases, profiles, modes, schema digest, and optionally the full inputSchema. Use after discover_tools to understand a specific tool before calling it. Read-only.",
|
|
714
|
+
inputSchema: {
|
|
715
|
+
type: "object",
|
|
716
|
+
properties: {
|
|
717
|
+
name: {
|
|
718
|
+
type: "string",
|
|
719
|
+
description: "Tool name or alias to explain. Accepts both the canonical name (e.g. 'create_task') and aliases (e.g. 'new_task').",
|
|
720
|
+
},
|
|
721
|
+
includeSchema: {
|
|
722
|
+
type: "boolean",
|
|
723
|
+
default: false,
|
|
724
|
+
description: "When true, include the full inputSchema in the response. Default false to keep output minimal.",
|
|
725
|
+
},
|
|
726
|
+
},
|
|
727
|
+
required: ["name"],
|
|
728
|
+
},
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
name: "invoke_discovered_tool",
|
|
732
|
+
description:
|
|
733
|
+
"v0.8.1: Invoke a previously discovered tool using a discoveryToken. The token must be obtained from discover_tools first. Enforces 10 security checks: token validity, toolName match, profile allowance, risk ceiling, sensitive path guard, assessment requirement, command whitelist, release confirmation, credential block, and invocation logging. Cannot call itself recursively.",
|
|
734
|
+
inputSchema: {
|
|
735
|
+
type: "object",
|
|
736
|
+
properties: {
|
|
737
|
+
toolName: { type: "string", description: "Name of the tool to invoke (must match the discoveryToken's toolName)." },
|
|
738
|
+
arguments: {
|
|
739
|
+
type: "object",
|
|
740
|
+
description: "Arguments to pass to the tool. Must match the tool's inputSchema.",
|
|
741
|
+
additionalProperties: true,
|
|
742
|
+
},
|
|
743
|
+
discoveryToken: { type: "string", description: "Token id from discover_tools. Single-use, expires after 10 minutes." },
|
|
744
|
+
assessmentId: { type: "string", description: "Required for workspace_write/release risk tools. Obtained from the assessment flow." },
|
|
745
|
+
},
|
|
746
|
+
required: ["toolName", "arguments", "discoveryToken"],
|
|
747
|
+
},
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
name: "create_goal",
|
|
751
|
+
description:
|
|
752
|
+
"v0.8.0: Create a Goal Session for managing a multi-task objective with subgoal dependencies. Generates a structured directory under .patchwarden/goals/{goal_id}/ with GOAL.md, GOALS.md, and goal_status.json. Use list_goals to enumerate existing goals and read_goal to inspect details.",
|
|
753
|
+
inputSchema: {
|
|
754
|
+
type: "object",
|
|
755
|
+
properties: {
|
|
756
|
+
title: { type: "string", description: "Goal title (human-readable)." },
|
|
757
|
+
goal_description: { type: "string", description: "Markdown description of the goal, success criteria, and context." },
|
|
758
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot. Must be inside the configured workspace." },
|
|
759
|
+
},
|
|
760
|
+
required: ["title", "goal_description", "repo_path"],
|
|
761
|
+
},
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
name: "list_goals",
|
|
765
|
+
description:
|
|
766
|
+
"v0.8.0: List all Goal Sessions with completion summaries. Returns goal_id, title, status, subgoal counts, and last update time. Sorted by updated_at descending.",
|
|
767
|
+
inputSchema: {
|
|
768
|
+
type: "object",
|
|
769
|
+
properties: {},
|
|
770
|
+
},
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
name: "read_goal",
|
|
774
|
+
description:
|
|
775
|
+
"v0.8.0: Read full Goal Session details including GOAL.md content, goal_status.json, and all subgoals with dependency info. Use after list_goals to inspect a specific goal.",
|
|
776
|
+
inputSchema: {
|
|
777
|
+
type: "object",
|
|
778
|
+
properties: {
|
|
779
|
+
goal_id: { type: "string", description: "Goal ID from list_goals or create_goal." },
|
|
780
|
+
},
|
|
781
|
+
required: ["goal_id"],
|
|
782
|
+
},
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
name: "create_subgoal_task",
|
|
786
|
+
description:
|
|
787
|
+
"v0.8.0: Create a subgoal within a Goal Session and immediately launch an associated task. Atomically: addSubgoal → create_task → linkTask → mark subgoal running. The subgoal depends_on other subgoals (by id) which must be accepted before suggest_next_subgoal returns it.",
|
|
788
|
+
inputSchema: {
|
|
789
|
+
type: "object",
|
|
790
|
+
properties: {
|
|
791
|
+
goal_id: { type: "string", description: "Goal ID to add the subgoal to." },
|
|
792
|
+
subgoal_title: { type: "string", description: "Title of the new subgoal." },
|
|
793
|
+
depends_on: {
|
|
794
|
+
type: "array",
|
|
795
|
+
items: { type: "string" },
|
|
796
|
+
description: "Subgoal IDs this subgoal depends on. Dependencies must be accepted before this subgoal is suggested.",
|
|
797
|
+
},
|
|
798
|
+
plan_id: { type: "string", description: "Plan ID from save_plan. One of plan_id/inline_plan/template+goal is required." },
|
|
799
|
+
inline_plan: { type: "string", description: "Inline Markdown plan." },
|
|
800
|
+
plan_title: { type: "string", description: "Optional title for inline_plan." },
|
|
801
|
+
template: {
|
|
802
|
+
type: "string",
|
|
803
|
+
enum: [...TASK_TEMPLATE_NAMES],
|
|
804
|
+
description: "Built-in task template. Use with goal.",
|
|
805
|
+
},
|
|
806
|
+
goal: { type: "string", description: "Task goal when template is supplied." },
|
|
807
|
+
agent: { type: "string", description: "Agent name." },
|
|
808
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
809
|
+
test_command: { type: "string", description: "Verification command." },
|
|
810
|
+
verify_commands: {
|
|
811
|
+
type: "array",
|
|
812
|
+
maxItems: 20,
|
|
813
|
+
items: { type: "string" },
|
|
814
|
+
description: "Additional verification commands.",
|
|
815
|
+
},
|
|
816
|
+
timeout_seconds: { type: "integer", minimum: 1, description: "Task timeout in seconds." },
|
|
817
|
+
scope: { type: "array", items: { type: "string" }, description: "Allowed file/directory scope." },
|
|
818
|
+
forbidden: { type: "array", items: { type: "string" }, description: "Forbidden file/directory paths." },
|
|
819
|
+
verification: { type: "array", items: { type: "string" }, description: "Acceptance verification commands." },
|
|
820
|
+
done_evidence: { type: "array", items: { type: "string" }, description: "Required done evidence files." },
|
|
821
|
+
isolate_worktree: { type: "boolean", default: true, description: "v1.0.0: If true (default), create the task in an isolated git worktree under _workspacetrees/. Set false to run in the main workspace (v0.8.0 behavior)" },
|
|
822
|
+
},
|
|
823
|
+
required: ["goal_id", "subgoal_title", "repo_path"],
|
|
824
|
+
},
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
name: "accept_subgoal",
|
|
828
|
+
description:
|
|
829
|
+
"v0.8.0: Accept a subgoal after all its associated tasks are accepted (via audit_task). Validates every task in subgoal.task_ids has status 'accepted'. Throws subgoal_not_ready if any task is not yet accepted.",
|
|
830
|
+
inputSchema: {
|
|
831
|
+
type: "object",
|
|
832
|
+
properties: {
|
|
833
|
+
goal_id: { type: "string", description: "Goal ID." },
|
|
834
|
+
subgoal_id: { type: "string", description: "Subgoal ID to accept." },
|
|
835
|
+
},
|
|
836
|
+
required: ["goal_id", "subgoal_id"],
|
|
837
|
+
},
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
name: "reject_subgoal",
|
|
841
|
+
description:
|
|
842
|
+
"v0.8.0: Reject a subgoal with a reason. Allowed from any non-terminal status (ready/running/done_by_agent/needs_fix). Records rejected_reason in goal_status.json.",
|
|
843
|
+
inputSchema: {
|
|
844
|
+
type: "object",
|
|
845
|
+
properties: {
|
|
846
|
+
goal_id: { type: "string", description: "Goal ID." },
|
|
847
|
+
subgoal_id: { type: "string", description: "Subgoal ID to reject." },
|
|
848
|
+
reason: { type: "string", description: "Rejection reason (required)." },
|
|
849
|
+
},
|
|
850
|
+
required: ["goal_id", "subgoal_id", "reason"],
|
|
851
|
+
},
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
name: "suggest_next_subgoal",
|
|
855
|
+
description:
|
|
856
|
+
"v0.8.0: Suggest the next executable subgoal based on the dependency graph. Returns a ready subgoal whose dependencies are all accepted. If none ready, returns blocked_by list. Use to drive goal-directed task sequencing.",
|
|
857
|
+
inputSchema: {
|
|
858
|
+
type: "object",
|
|
859
|
+
properties: {
|
|
860
|
+
goal_id: { type: "string", description: "Goal ID." },
|
|
861
|
+
},
|
|
862
|
+
required: ["goal_id"],
|
|
863
|
+
},
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
name: "summarize_goal_progress",
|
|
867
|
+
description:
|
|
868
|
+
"v0.8.0: Summarize goal completion: counts by status (accepted/rejected/running/ready/needs_fix/done_by_agent), completion_rate percentage, blocked_subgoals, and risks (needs_fix or running subgoals).",
|
|
869
|
+
inputSchema: {
|
|
870
|
+
type: "object",
|
|
871
|
+
properties: {
|
|
872
|
+
goal_id: { type: "string", description: "Goal ID." },
|
|
873
|
+
},
|
|
874
|
+
required: ["goal_id"],
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
name: "export_handoff",
|
|
879
|
+
description:
|
|
880
|
+
"v0.8.0: Export a handoff.md document for transferring a Goal Session to a new conversation. Includes current goal, completed/pending subgoals, recent diff/test results, blockers, next steps, and risks. Writes to .patchwarden/goals/{goal_id}/handoff.md.",
|
|
881
|
+
inputSchema: {
|
|
882
|
+
type: "object",
|
|
883
|
+
properties: {
|
|
884
|
+
goal_id: { type: "string", description: "Goal ID." },
|
|
885
|
+
},
|
|
886
|
+
required: ["goal_id"],
|
|
887
|
+
},
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
name: "export_goal_report",
|
|
891
|
+
description: "Export a structured final report for a Goal session, aggregating subgoal completion, task evidence, and risk summary.",
|
|
892
|
+
inputSchema: {
|
|
893
|
+
type: "object",
|
|
894
|
+
properties: {
|
|
895
|
+
goal_id: { type: "string", description: "The goal id to export report for." },
|
|
896
|
+
},
|
|
897
|
+
required: ["goal_id"],
|
|
898
|
+
},
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
name: "import_speckit_tasks",
|
|
902
|
+
description: "Import Spec Kit tasks into a Goal session as subgoals, mapping task files to scope hints and acceptance criteria.",
|
|
903
|
+
inputSchema: {
|
|
904
|
+
type: "object",
|
|
905
|
+
properties: {
|
|
906
|
+
goal_id: { type: "string", description: "The goal id to import tasks into." },
|
|
907
|
+
spec_kit_json: { type: "string", description: "Spec Kit JSON text containing spec, tasks[], and acceptance[] fields." },
|
|
908
|
+
},
|
|
909
|
+
required: ["goal_id", "spec_kit_json"],
|
|
910
|
+
},
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
name: "check_release_gate",
|
|
914
|
+
description:
|
|
915
|
+
"v1.0.0: Verify release readiness across five sequential stages: local_ready → packed_ready → published_verified → github_release_verified → ci_verified. Remote stages (published/github/ci) query npm registry and GitHub API via node:https read-only GET; network errors return 'not_checked' (not 'failed'). Never claims release complete before published_verified passes. Does not execute shell commands for remote queries.",
|
|
916
|
+
inputSchema: {
|
|
917
|
+
type: "object",
|
|
918
|
+
properties: {
|
|
919
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
920
|
+
target_stage: {
|
|
921
|
+
type: "string",
|
|
922
|
+
enum: ["local_ready", "packed_ready", "published_verified", "github_release_verified", "ci_verified"],
|
|
923
|
+
description: "Target stage to verify. Stages before target are checked; stages after a failure are 'not_checked'.",
|
|
924
|
+
},
|
|
925
|
+
package_name: { type: "string", description: "npm package name for published_verified (e.g. 'patchwarden'). Required for published_verified stage." },
|
|
926
|
+
version: { type: "string", description: "Version string for published_verified (e.g. '1.0.0'). Required for published_verified stage." },
|
|
927
|
+
github_repo: { type: "string", description: "GitHub repo in 'owner/repo' form for github_release_verified and ci_verified." },
|
|
928
|
+
branch: { type: "string", description: "Git branch for ci_verified (e.g. 'main')." },
|
|
929
|
+
},
|
|
930
|
+
required: ["repo_path", "target_stage"],
|
|
931
|
+
},
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
name: "release_check",
|
|
935
|
+
description:
|
|
936
|
+
"v1.3.0: Run a bounded release readiness check by wrapping the existing release gate. Local stages use existing guarded release-gate commands; remote stages are read-only. Does not publish, push, tag, or create a GitHub Release.",
|
|
937
|
+
inputSchema: {
|
|
938
|
+
type: "object",
|
|
939
|
+
properties: {
|
|
940
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
941
|
+
target_stage: {
|
|
942
|
+
type: "string",
|
|
943
|
+
enum: ["local_ready", "packed_ready", "published_verified", "github_release_verified", "ci_verified"],
|
|
944
|
+
default: "local_ready",
|
|
945
|
+
description: "Release gate stage to check. Defaults to local_ready.",
|
|
946
|
+
},
|
|
947
|
+
package_name: { type: "string", description: "npm package name for remote verification." },
|
|
948
|
+
version: { type: "string", description: "Version to verify. Defaults to project policy/package.json when omitted." },
|
|
949
|
+
github_repo: { type: "string", description: "GitHub repo in owner/repo form for release/CI verification." },
|
|
950
|
+
branch: { type: "string", default: "main", description: "Branch for CI verification." },
|
|
951
|
+
},
|
|
952
|
+
required: ["repo_path"],
|
|
953
|
+
},
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
name: "release_prepare",
|
|
957
|
+
description:
|
|
958
|
+
"v1.3.0: Run project-policy release preparation commands only when each command is already accepted by the existing PatchWarden command guard. Returns command status only, never stdout/stderr. Does not publish, push, tag, or create a GitHub Release.",
|
|
959
|
+
inputSchema: {
|
|
960
|
+
type: "object",
|
|
961
|
+
properties: {
|
|
962
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
963
|
+
required_commands: {
|
|
964
|
+
type: "array",
|
|
965
|
+
maxItems: 10,
|
|
966
|
+
items: {
|
|
967
|
+
type: "string",
|
|
968
|
+
...(testCommands.length > 0 ? { enum: testCommands } : {}),
|
|
969
|
+
},
|
|
970
|
+
description: "Optional exact-match release preparation commands. Defaults to project policy release_mode.required_commands.",
|
|
971
|
+
},
|
|
972
|
+
timeout_seconds: {
|
|
973
|
+
type: "integer",
|
|
974
|
+
minimum: 1,
|
|
975
|
+
maximum: config.maxTaskTimeoutSeconds,
|
|
976
|
+
default: 300,
|
|
977
|
+
description: "Per-command timeout in seconds.",
|
|
978
|
+
},
|
|
979
|
+
},
|
|
980
|
+
required: ["repo_path"],
|
|
981
|
+
},
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
name: "release_verify",
|
|
985
|
+
description:
|
|
986
|
+
"v1.3.0: Verify npm/GitHub/CI release facts with read-only HTTPS requests. Does not run local shell commands and does not publish, push, tag, or create a GitHub Release.",
|
|
987
|
+
inputSchema: {
|
|
988
|
+
type: "object",
|
|
989
|
+
properties: {
|
|
990
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
991
|
+
package_name: { type: "string", description: "npm package name. Defaults to package.json name." },
|
|
992
|
+
version: { type: "string", description: "Version to verify. Defaults to project policy/package.json." },
|
|
993
|
+
github_repo: { type: "string", description: "GitHub repo in owner/repo form. Defaults to package.json repository when available." },
|
|
994
|
+
branch: { type: "string", default: "main", description: "Branch for CI verification." },
|
|
995
|
+
},
|
|
996
|
+
required: ["repo_path"],
|
|
997
|
+
},
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
name: "release_cleanup",
|
|
1001
|
+
description:
|
|
1002
|
+
"v1.3.0: Clean up release artifacts using project-policy auto_cleanup rules. Defaults to dry_run=true. Non-dry-run cleanup only removes low-risk ignored/untracked artifacts under repo_path and writes an audit summary.",
|
|
1003
|
+
inputSchema: {
|
|
1004
|
+
type: "object",
|
|
1005
|
+
properties: {
|
|
1006
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
1007
|
+
dry_run: { type: "boolean", default: true, description: "Preview cleanup by default. Set false to remove eligible artifacts." },
|
|
1008
|
+
patterns: {
|
|
1009
|
+
type: "array",
|
|
1010
|
+
maxItems: 20,
|
|
1011
|
+
items: { type: "string" },
|
|
1012
|
+
description: "Optional cleanup patterns. Defaults to project policy auto_cleanup.patterns.",
|
|
1013
|
+
},
|
|
1014
|
+
},
|
|
1015
|
+
required: ["repo_path"],
|
|
1016
|
+
},
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
name: "merge_worktree",
|
|
1020
|
+
description:
|
|
1021
|
+
"v1.0.0: Merge an isolated git worktree's changes back into the main workspace. Use after a subgoal task (created with isolate_worktree=true) is accepted. Updates worktree_status.json to status='merged'. Merge failures do NOT delete the worktree (preserved for manual inspection).",
|
|
1022
|
+
inputSchema: {
|
|
1023
|
+
type: "object",
|
|
1024
|
+
properties: {
|
|
1025
|
+
worktree_id: { type: "string", description: "Worktree ID (wt_...) from create_subgoal_task." },
|
|
1026
|
+
repo_path: { type: "string", description: "Main workspace repository path inside workspaceRoot." },
|
|
1027
|
+
},
|
|
1028
|
+
required: ["worktree_id", "repo_path"],
|
|
1029
|
+
},
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
name: "discard_worktree",
|
|
1033
|
+
description:
|
|
1034
|
+
"v1.0.0: Discard an isolated git worktree safely. Removes the worktree (git worktree remove --force), deletes its branch, and archives status as 'discarded'. Use when a subgoal is rejected or abandoned. All paths pass guardWorkspacePath + sensitiveGuard.",
|
|
1035
|
+
inputSchema: {
|
|
1036
|
+
type: "object",
|
|
1037
|
+
properties: {
|
|
1038
|
+
worktree_id: { type: "string", description: "Worktree ID (wt_...) to discard." },
|
|
1039
|
+
repo_path: { type: "string", description: "Main workspace repository path inside workspaceRoot." },
|
|
1040
|
+
},
|
|
1041
|
+
required: ["worktree_id", "repo_path"],
|
|
1042
|
+
},
|
|
1043
|
+
},
|
|
1044
|
+
];
|
|
1045
|
+
|
|
1046
|
+
// Direct session tools
|
|
1047
|
+
tools.push({
|
|
1048
|
+
name: "create_direct_session",
|
|
1049
|
+
description:
|
|
1050
|
+
"Create a Direct editing session for ChatGPT to apply patches directly. Requires enableDirectProfile: true in config.",
|
|
1051
|
+
inputSchema: {
|
|
1052
|
+
type: "object",
|
|
1053
|
+
properties: {
|
|
1054
|
+
repo_path: {
|
|
1055
|
+
type: "string",
|
|
1056
|
+
description: "Repository path inside workspaceRoot (e.g., 'my-project')",
|
|
1057
|
+
},
|
|
1058
|
+
title: {
|
|
1059
|
+
type: "string",
|
|
1060
|
+
description: "Optional title describing the session's purpose",
|
|
1061
|
+
},
|
|
1062
|
+
},
|
|
1063
|
+
required: ["repo_path"],
|
|
1064
|
+
},
|
|
1065
|
+
});
|
|
1066
|
+
|
|
1067
|
+
tools.push({
|
|
1068
|
+
name: "search_workspace",
|
|
1069
|
+
description:
|
|
1070
|
+
"Search file contents (grep-like) within a Direct session's repo_path. Skips .git, node_modules, dist, release, and sensitive files.",
|
|
1071
|
+
inputSchema: {
|
|
1072
|
+
type: "object",
|
|
1073
|
+
properties: {
|
|
1074
|
+
session_id: { type: "string", description: "Session ID from create_direct_session" },
|
|
1075
|
+
query: { type: "string", description: "Search query string" },
|
|
1076
|
+
max_results: { type: "number", description: "Max results (default 20)" },
|
|
1077
|
+
case_sensitive: { type: "boolean", description: "Case sensitive search (default false)" },
|
|
1078
|
+
max_preview_chars: { type: "number", description: "Max preview chars per match (default 200)" },
|
|
1079
|
+
include_globs: {
|
|
1080
|
+
type: "array",
|
|
1081
|
+
items: { type: "string" },
|
|
1082
|
+
description: "Optional file name glob patterns to include (e.g., ['*.ts', '*.js'])",
|
|
1083
|
+
},
|
|
1084
|
+
},
|
|
1085
|
+
required: ["session_id", "query"],
|
|
1086
|
+
},
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
tools.push({
|
|
1090
|
+
name: "apply_patch",
|
|
1091
|
+
description:
|
|
1092
|
+
"Apply JSON patch operations to a file within a Direct session's repo_path. Validates expected_sha256 before applying. Supports replace_exact, insert_before, insert_after, replace_whole_file.",
|
|
1093
|
+
inputSchema: {
|
|
1094
|
+
type: "object",
|
|
1095
|
+
properties: {
|
|
1096
|
+
session_id: { type: "string", description: "Session ID" },
|
|
1097
|
+
path: { type: "string", description: "Relative file path within the session repo" },
|
|
1098
|
+
expected_sha256: { type: "string", description: "Expected SHA-256 hash of the current file content" },
|
|
1099
|
+
operations: {
|
|
1100
|
+
type: "array",
|
|
1101
|
+
items: {
|
|
1102
|
+
type: "object",
|
|
1103
|
+
properties: {
|
|
1104
|
+
type: { type: "string", enum: ["replace_exact", "insert_before", "insert_after", "replace_whole_file"] },
|
|
1105
|
+
old_text: { type: "string", description: "Text to find (required for replace_exact, insert_before, insert_after)" },
|
|
1106
|
+
new_text: { type: "string", description: "Replacement or insertion text" },
|
|
1107
|
+
occurrence: { type: "string", enum: ["first", "all", "exactly_once"], description: "Match mode for replace_exact (default first)" },
|
|
1108
|
+
},
|
|
1109
|
+
required: ["type", "new_text"],
|
|
1110
|
+
},
|
|
1111
|
+
},
|
|
1112
|
+
},
|
|
1113
|
+
required: ["session_id", "path", "expected_sha256", "operations"],
|
|
1114
|
+
},
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1117
|
+
tools.push({
|
|
1118
|
+
name: "run_verification",
|
|
1119
|
+
description:
|
|
1120
|
+
"Run a whitelisted verification command within a Direct session. Command must be in the Direct allowlist.",
|
|
1121
|
+
inputSchema: {
|
|
1122
|
+
type: "object",
|
|
1123
|
+
properties: {
|
|
1124
|
+
session_id: { type: "string", description: "Session ID" },
|
|
1125
|
+
command: {
|
|
1126
|
+
type: "string",
|
|
1127
|
+
description: "Verification command to run",
|
|
1128
|
+
...(directCommands.length > 0 ? { enum: directCommands } : {}),
|
|
1129
|
+
},
|
|
1130
|
+
timeout_seconds: { type: "number", description: "Timeout in seconds (default 120)" },
|
|
1131
|
+
},
|
|
1132
|
+
required: ["session_id", "command"],
|
|
1133
|
+
},
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
tools.push({
|
|
1137
|
+
name: "run_direct_verification_bundle",
|
|
1138
|
+
description:
|
|
1139
|
+
"Run multiple allowlisted Direct verification commands sequentially and return only bounded structured status. Omits stdout/stderr tails and log content.",
|
|
1140
|
+
inputSchema: {
|
|
1141
|
+
type: "object",
|
|
1142
|
+
properties: {
|
|
1143
|
+
session_id: { type: "string", description: "Direct session ID" },
|
|
1144
|
+
commands: {
|
|
1145
|
+
type: "array",
|
|
1146
|
+
minItems: 1,
|
|
1147
|
+
maxItems: 20,
|
|
1148
|
+
items: {
|
|
1149
|
+
type: "string",
|
|
1150
|
+
...(directCommands.length > 0 ? { enum: directCommands } : {}),
|
|
1151
|
+
},
|
|
1152
|
+
description: "Verification commands to run in order. Each command must be accepted by the existing Direct command guard.",
|
|
1153
|
+
},
|
|
1154
|
+
timeout_seconds: { type: "integer", minimum: 1, maximum: Math.min(config.maxTaskTimeoutSeconds, config.directSessionTtlSeconds), default: 120 },
|
|
1155
|
+
},
|
|
1156
|
+
required: ["session_id", "commands"],
|
|
1157
|
+
},
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
tools.push({
|
|
1161
|
+
name: "finalize_direct_session",
|
|
1162
|
+
description:
|
|
1163
|
+
"Finalize a Direct session: capture after snapshot, generate diff/summary/change artifacts, mark session as finalized. Must be called before audit_session.",
|
|
1164
|
+
inputSchema: {
|
|
1165
|
+
type: "object",
|
|
1166
|
+
properties: {
|
|
1167
|
+
session_id: { type: "string", description: "Session ID to finalize" },
|
|
1168
|
+
},
|
|
1169
|
+
required: ["session_id"],
|
|
1170
|
+
},
|
|
1171
|
+
});
|
|
1172
|
+
|
|
1173
|
+
tools.push({
|
|
1174
|
+
name: "audit_session",
|
|
1175
|
+
description:
|
|
1176
|
+
"Independently audit a Direct session's changes. Performs 16 deterministic checks and returns pass/warn/fail decision. Requires session to be finalized first.",
|
|
1177
|
+
inputSchema: {
|
|
1178
|
+
type: "object",
|
|
1179
|
+
properties: {
|
|
1180
|
+
session_id: { type: "string", description: "Session ID to audit" },
|
|
1181
|
+
},
|
|
1182
|
+
required: ["session_id"],
|
|
1183
|
+
},
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
tools.push({
|
|
1187
|
+
name: "safe_direct_summary",
|
|
1188
|
+
description:
|
|
1189
|
+
"Return a low-noise Direct session summary without diff content or verification stdout/stderr tails.",
|
|
1190
|
+
inputSchema: {
|
|
1191
|
+
type: "object",
|
|
1192
|
+
properties: {
|
|
1193
|
+
session_id: { type: "string", description: "Direct session ID" },
|
|
1194
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum list entries to return per evidence group." },
|
|
1195
|
+
},
|
|
1196
|
+
required: ["session_id"],
|
|
1197
|
+
},
|
|
1198
|
+
});
|
|
1199
|
+
|
|
1200
|
+
tools.push({
|
|
1201
|
+
name: "safe_finalize_direct_session",
|
|
1202
|
+
description:
|
|
1203
|
+
"Finalize a Direct session and return only bounded structured evidence, omitting diff and verification log content.",
|
|
1204
|
+
inputSchema: {
|
|
1205
|
+
type: "object",
|
|
1206
|
+
properties: {
|
|
1207
|
+
session_id: { type: "string", description: "Direct session ID to finalize" },
|
|
1208
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum list entries to return per evidence group." },
|
|
1209
|
+
},
|
|
1210
|
+
required: ["session_id"],
|
|
1211
|
+
},
|
|
1212
|
+
});
|
|
1213
|
+
|
|
1214
|
+
tools.push({
|
|
1215
|
+
name: "safe_audit_direct_session",
|
|
1216
|
+
description:
|
|
1217
|
+
"Audit a Direct session and return only bounded structured evidence without verification stdout/stderr tails.",
|
|
1218
|
+
inputSchema: {
|
|
1219
|
+
type: "object",
|
|
1220
|
+
properties: {
|
|
1221
|
+
session_id: { type: "string", description: "Direct session ID to audit" },
|
|
1222
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum list entries to return per evidence group." },
|
|
1223
|
+
},
|
|
1224
|
+
required: ["session_id"],
|
|
1225
|
+
},
|
|
1226
|
+
});
|
|
1227
|
+
tools.push({
|
|
1228
|
+
name: "sync_file",
|
|
1229
|
+
description:
|
|
1230
|
+
"Copy a file from source to target within the same Direct session repo. Both paths must be inside the session repo_path. Returns before/after sha256 hashes and whether the target changed.",
|
|
1231
|
+
inputSchema: {
|
|
1232
|
+
type: "object",
|
|
1233
|
+
properties: {
|
|
1234
|
+
session_id: { type: "string", description: "Direct session ID" },
|
|
1235
|
+
source_path: { type: "string", description: "Relative path to source file within repo" },
|
|
1236
|
+
target_path: { type: "string", description: "Relative path to target file within repo" },
|
|
1237
|
+
expected_source_sha256: { type: "string", description: "Optional: expected sha256 of source file" },
|
|
1238
|
+
expected_target_sha256: { type: "string", description: "Optional: expected sha256 of target file before copy" },
|
|
1239
|
+
},
|
|
1240
|
+
required: ["session_id", "source_path", "target_path"],
|
|
1241
|
+
},
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
// run_task: only available when explicitly enabled
|
|
1245
|
+
if (config.enableRunTaskTool === true) {
|
|
1246
|
+
tools.push({
|
|
1247
|
+
name: "run_task",
|
|
1248
|
+
description:
|
|
1249
|
+
"Manually trigger execution of a pending task. WARNING: requires enableRunTaskTool=true in config. Prefer using the local watcher instead.",
|
|
1250
|
+
inputSchema: {
|
|
1251
|
+
type: "object",
|
|
1252
|
+
properties: {
|
|
1253
|
+
task_id: { type: "string", description: "Task ID to execute" },
|
|
1254
|
+
},
|
|
1255
|
+
required: ["task_id"],
|
|
1256
|
+
},
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
const profile = resolveToolProfile(config.toolProfile);
|
|
1261
|
+
const selected = selectToolsForProfile(tools, profile, config.enableDirectProfile);
|
|
1262
|
+
buildToolCatalogSnapshot(selected, profile);
|
|
1263
|
+
return selected;
|
|
1264
|
+
}
|