patchwarden 0.6.0 → 0.6.4
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-Control-Tray.cmd +11 -0
- package/PatchWarden-Control.cmd +6 -0
- package/PatchWarden-Desktop.cmd +5 -0
- package/PatchWarden.cmd +1 -1
- package/README.en.md +106 -18
- package/README.md +30 -19
- package/Restart-PatchWarden-Control.cmd +6 -0
- package/Stop-PatchWarden.cmd +11 -0
- package/dist/controlCenter.d.ts +14 -0
- package/dist/controlCenter.js +2002 -0
- package/dist/doctor.js +4 -4
- package/dist/logging.d.ts +52 -0
- package/dist/logging.js +123 -0
- package/dist/runner/changeCapture.d.ts +41 -0
- package/dist/runner/changeCapture.js +171 -1
- package/dist/runner/runTask.js +204 -24
- package/dist/smoke-test.js +8 -8
- package/dist/test/unit/android-doctor.test.d.ts +1 -0
- package/dist/test/unit/android-doctor.test.js +118 -0
- package/dist/test/unit/chinese-path.test.d.ts +1 -0
- package/dist/test/unit/chinese-path.test.js +91 -0
- package/dist/test/unit/command-guard.test.d.ts +1 -0
- package/dist/test/unit/command-guard.test.js +160 -0
- package/dist/test/unit/direct-guards.test.d.ts +1 -0
- package/dist/test/unit/direct-guards.test.js +213 -0
- package/dist/test/unit/logging.test.d.ts +1 -0
- package/dist/test/unit/logging.test.js +275 -0
- package/dist/test/unit/path-guard.test.d.ts +1 -0
- package/dist/test/unit/path-guard.test.js +109 -0
- package/dist/test/unit/safe-status.test.d.ts +1 -0
- package/dist/test/unit/safe-status.test.js +165 -0
- package/dist/test/unit/sensitive-guard.test.d.ts +1 -0
- package/dist/test/unit/sensitive-guard.test.js +104 -0
- package/dist/test/unit/sync-file.test.d.ts +1 -0
- package/dist/test/unit/sync-file.test.js +154 -0
- package/dist/test/unit/watcher-status.test.d.ts +1 -0
- package/dist/test/unit/watcher-status.test.js +169 -0
- package/dist/tools/androidDoctor.d.ts +38 -0
- package/dist/tools/androidDoctor.js +391 -0
- package/dist/tools/auditTask.js +11 -5
- package/dist/tools/getTaskSummary.d.ts +3 -0
- package/dist/tools/getTaskSummary.js +15 -1
- package/dist/tools/healthCheck.d.ts +5 -0
- package/dist/tools/healthCheck.js +21 -0
- package/dist/tools/registry.js +53 -0
- package/dist/tools/safeStatus.d.ts +19 -0
- package/dist/tools/safeStatus.js +72 -0
- package/dist/tools/syncFile.d.ts +18 -0
- package/dist/tools/syncFile.js +65 -0
- package/dist/tools/taskOutputs.d.ts +2 -2
- package/dist/tools/toolCatalog.d.ts +2 -2
- package/dist/tools/toolCatalog.js +2 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/dist/watcherStatus.d.ts +1 -0
- package/dist/watcherStatus.js +96 -4
- package/docs/control-center/README.md +33 -0
- package/docs/control-center/control-center-daily-driver.md +211 -0
- package/docs/control-center/control-center-mvp.md +205 -0
- package/docs/control-center/control-center-phase2.md +159 -0
- package/docs/demo.md +3 -0
- package/docs/performance-notes.md +55 -0
- package/docs/release-v0.6.1.md +75 -0
- package/docs/release-v0.6.4.md +45 -0
- package/examples/openai-tunnel/README.md +5 -5
- package/examples/openai-tunnel/tunnel-client.example.yaml +3 -3
- package/package.json +23 -14
- package/scripts/README.md +47 -0
- package/scripts/{brand-check.js → checks/brand-check.js} +2 -2
- package/scripts/checks/control-center-smoke.js +1098 -0
- package/scripts/{control-smoke.js → checks/control-smoke.js} +17 -3
- package/scripts/{doctor-smoke.js → checks/doctor-smoke.js} +1 -1
- package/scripts/{http-mcp-smoke.js → checks/http-mcp-smoke.js} +12 -4
- package/scripts/{lifecycle-smoke.js → checks/lifecycle-smoke.js} +347 -13
- package/scripts/{mcp-manifest-check.js → checks/mcp-manifest-check.js} +32 -9
- package/scripts/{mcp-smoke.js → checks/mcp-smoke.js} +14 -9
- package/scripts/{package-manifest-check.js → checks/package-manifest-check.js} +2 -1
- package/scripts/{tunnel-supervisor-smoke.js → checks/tunnel-supervisor-smoke.js} +2 -2
- package/scripts/checks/unit-tests.js +36 -0
- package/scripts/{watcher-supervisor-smoke.js → checks/watcher-supervisor-smoke.js} +11 -5
- package/scripts/control/control-center-tray.ps1 +281 -0
- package/scripts/{get-patchwarden-health.ps1 → control/get-patchwarden-health.ps1} +3 -3
- package/scripts/{manage-patchwarden.ps1 → control/manage-patchwarden.ps1} +30 -4
- package/scripts/control/restart-control-center.ps1 +173 -0
- package/scripts/{restart-patchwarden.ps1 → control/restart-patchwarden.ps1} +1 -1
- package/scripts/control/start-control-center.ps1 +263 -0
- package/scripts/{start-patchwarden-tunnel.ps1 → control/start-patchwarden-tunnel.ps1} +48 -6
- package/scripts/control/stop-patchwarden.ps1 +114 -0
- package/scripts/launchers/Check-PatchWarden-Health.cmd +1 -1
- package/scripts/launchers/Reset-PatchWarden-Tunnel-Key.cmd +1 -1
- package/scripts/launchers/Restart-PatchWarden.cmd +1 -1
- package/scripts/launchers/Start-PatchWarden-Direct-Tunnel.cmd +1 -1
- package/scripts/launchers/Start-PatchWarden-Tunnel.cmd +1 -1
- package/scripts/{patchwarden-mcp-direct.cmd → mcp/patchwarden-mcp-direct.cmd} +1 -1
- package/scripts/{patchwarden-mcp-stdio.cmd → mcp/patchwarden-mcp-stdio.cmd} +1 -1
- package/scripts/release/pack-clean.js +305 -0
- package/src/controlCenter.ts +2152 -0
- package/src/doctor.ts +5 -5
- package/src/logging.ts +152 -0
- package/src/runner/changeCapture.ts +212 -1
- package/src/runner/runTask.ts +220 -22
- package/src/smoke-test.ts +5 -5
- package/src/test/unit/android-doctor.test.ts +158 -0
- package/src/test/unit/chinese-path.test.ts +106 -0
- package/src/test/unit/command-guard.test.ts +221 -0
- package/src/test/unit/direct-guards.test.ts +297 -0
- package/src/test/unit/logging.test.ts +325 -0
- package/src/test/unit/path-guard.test.ts +150 -0
- package/src/test/unit/safe-status.test.ts +187 -0
- package/src/test/unit/sensitive-guard.test.ts +124 -0
- package/src/test/unit/sync-file.test.ts +231 -0
- package/src/test/unit/watcher-status.test.ts +190 -0
- package/src/tools/androidDoctor.ts +424 -0
- package/src/tools/auditTask.ts +11 -5
- package/src/tools/getTaskSummary.ts +22 -1
- package/src/tools/healthCheck.ts +22 -0
- package/src/tools/registry.ts +63 -0
- package/src/tools/safeStatus.ts +96 -0
- package/src/tools/syncFile.ts +122 -0
- package/src/tools/toolCatalog.ts +2 -0
- package/src/version.ts +2 -2
- package/src/watcherStatus.ts +101 -4
- package/ui/colors_and_type.css +141 -0
- package/ui/pages/audit.html +743 -0
- package/ui/pages/dashboard.html +1154 -0
- package/ui/pages/direct-sessions.html +652 -0
- package/ui/pages/logs.html +502 -0
- package/ui/pages/task-detail.html +1229 -0
- package/ui/pages/tasks.html +702 -0
- package/ui/pages/workspace.html +947 -0
- package/ui/partials/project-shell.html +362 -0
- package/ui/vendor/lucide.js +12 -0
- package/ui/vendor/tailwindcss-browser.js +947 -0
- package/scripts/pack-clean.js +0 -141
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal
|
|
3
|
+
cd /d "%~dp0"
|
|
4
|
+
if /i "%~1"=="--foreground" (
|
|
5
|
+
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\control\control-center-tray.ps1" %*
|
|
6
|
+
set EXITCODE=%ERRORLEVEL%
|
|
7
|
+
endlocal & exit /b %EXITCODE%
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
start "" powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "%~dp0scripts\control\control-center-tray.ps1" %*
|
|
11
|
+
endlocal & exit /b 0
|
package/PatchWarden.cmd
CHANGED
|
@@ -20,7 +20,7 @@ set "HTTPS_PROXY=%PATCHWARDEN_PROXY_URL%"
|
|
|
20
20
|
set "ALL_PROXY=%PATCHWARDEN_PROXY_URL%"
|
|
21
21
|
set "NO_PROXY=localhost,127.0.0.1,::1"
|
|
22
22
|
|
|
23
|
-
set "SCRIPTS_DIR=%~dp0scripts"
|
|
23
|
+
set "SCRIPTS_DIR=%~dp0scripts\control"
|
|
24
24
|
set "MANAGER=%SCRIPTS_DIR%\manage-patchwarden.ps1"
|
|
25
25
|
|
|
26
26
|
if not exist "%MANAGER%" (
|
package/README.en.md
CHANGED
|
@@ -8,16 +8,19 @@
|
|
|
8
8
|
[](https://nodejs.org/)
|
|
9
9
|
[](LICENSE)
|
|
10
10
|
|
|
11
|
-
Current stable release: **v0.6.
|
|
12
|
-
[release notes](docs/release-v0.6.
|
|
11
|
+
Current stable release: **v0.6.4**. See the
|
|
12
|
+
[release notes](docs/release-v0.6.4.md),
|
|
13
13
|
[migration guide](docs/migration-from-safe-bifrost.md), and
|
|
14
|
-
[GitHub Release](https://github.com/jiezeng2004-design/PatchWarden/releases/tag/v0.6.
|
|
14
|
+
[GitHub Release](https://github.com/jiezeng2004-design/PatchWarden/releases/tag/v0.6.4).
|
|
15
15
|
|
|
16
|
-
PatchWarden is a
|
|
17
|
-
|
|
16
|
+
PatchWarden is a local-first MCP safety and verification layer for AI coding
|
|
17
|
+
agents, with workspace confinement, command allowlists, scope-violation
|
|
18
|
+
detection, and auditable task evidence.
|
|
19
|
+
|
|
20
|
+
ChatGPT, Codex, OpenCode, or another MCP client can plan and review work.
|
|
18
21
|
PatchWarden stores that plan as a workspace-scoped task, lets a preconfigured
|
|
19
|
-
local agent execute it, and returns results, diffs, and
|
|
20
|
-
verification evidence.
|
|
22
|
+
local agent execute it, and returns results, diffs, artifact manifests, and
|
|
23
|
+
independent verification evidence.
|
|
21
24
|
|
|
22
25
|

|
|
23
26
|
|
|
@@ -30,6 +33,8 @@ verification evidence.
|
|
|
30
33
|
## Contents
|
|
31
34
|
|
|
32
35
|
- [What PatchWarden solves](#what-patchwarden-solves)
|
|
36
|
+
- [How PatchWarden differs](#how-patchwarden-differs)
|
|
37
|
+
- [Evidence example](#evidence-example)
|
|
33
38
|
- [Runtime architecture](#runtime-architecture)
|
|
34
39
|
- [Requirements](#requirements)
|
|
35
40
|
- [Five-minute quick start](#five-minute-quick-start)
|
|
@@ -77,6 +82,83 @@ PatchWarden is not designed for:
|
|
|
77
82
|
- Managing an entire drive, home directory, or directory full of private data.
|
|
78
83
|
- Unattended commits, pushes, releases, or production changes.
|
|
79
84
|
|
|
85
|
+
## How PatchWarden differs
|
|
86
|
+
|
|
87
|
+
PatchWarden sits between an MCP client and local coding tools. It is not a
|
|
88
|
+
replacement for every adjacent layer:
|
|
89
|
+
|
|
90
|
+
| Layer | Primary job | PatchWarden's role |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| Sandbox | Isolate a process or filesystem at runtime. | Add task-level policy, evidence, verification, and review records around local agent work. |
|
|
93
|
+
| Coding agent | Edit code and run local tools. | Launch only preconfigured agents with trusted argument templates and bounded repositories. |
|
|
94
|
+
| Generic MCP server | Expose tools to an MCP client. | Expose a constrained task workflow instead of a broad shell or arbitrary filesystem access. |
|
|
95
|
+
|
|
96
|
+
The first reusable capability to evaluate independently is:
|
|
97
|
+
|
|
98
|
+
> Artifact manifest + verified completion evidence
|
|
99
|
+
|
|
100
|
+
This capability is intentionally small: a task can finish with structured
|
|
101
|
+
status, changed-file groups, release-artifact metadata, verification records,
|
|
102
|
+
and scope-violation evidence in JSON. Other projects can inspect or adapt that
|
|
103
|
+
evidence model without adopting PatchWarden's full runtime.
|
|
104
|
+
|
|
105
|
+
## Evidence example
|
|
106
|
+
|
|
107
|
+
A completed task writes bounded, reviewable artifacts under
|
|
108
|
+
`.patchwarden/tasks/<task_id>/`. The high-signal files are:
|
|
109
|
+
|
|
110
|
+
- `result.json` - final status, verification status, changed-file groups, and warnings.
|
|
111
|
+
- `artifact_manifest.json` - generated artifacts with size, type, and SHA-256.
|
|
112
|
+
- `verify.json` - exact verification commands and exit codes.
|
|
113
|
+
- `diff.patch` - complete source diff when Git evidence is available.
|
|
114
|
+
- `rollback_scope_violation_plan.md` - review plan when a task changes files outside `repo_path`.
|
|
115
|
+
|
|
116
|
+
Example compact evidence:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"task_id": "task_20260625_010513_ad59bb",
|
|
121
|
+
"status": "done",
|
|
122
|
+
"verify_status": "passed",
|
|
123
|
+
"changed_file_groups": {
|
|
124
|
+
"source_changes": 2,
|
|
125
|
+
"docs_changes": 1,
|
|
126
|
+
"config_changes": 0,
|
|
127
|
+
"test_changes": 1,
|
|
128
|
+
"release_artifacts": 1,
|
|
129
|
+
"runtime_generated_files": 0
|
|
130
|
+
},
|
|
131
|
+
"artifact_status": "collected",
|
|
132
|
+
"artifact_manifest": {
|
|
133
|
+
"artifacts": [
|
|
134
|
+
{
|
|
135
|
+
"path": "release/app.zip",
|
|
136
|
+
"type": "zip",
|
|
137
|
+
"size": 467725,
|
|
138
|
+
"sha256": "03731a12990718325d3cb9ecdc9dbc899fc840e8ef6e2de3e810577999b5f864"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"new_out_of_scope_changes": []
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
A scope violation remains explicit:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"status": "failed_scope_violation",
|
|
152
|
+
"verify_status": "failed",
|
|
153
|
+
"new_out_of_scope_changes": [
|
|
154
|
+
{
|
|
155
|
+
"path": "external/external-renamed.txt",
|
|
156
|
+
"change": "modified"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
80
162
|
## Runtime architecture
|
|
81
163
|
|
|
82
164
|
```text
|
|
@@ -184,7 +266,7 @@ execution still requires a separate Watcher.
|
|
|
184
266
|
New-Item -ItemType Directory .\patchwarden-runtime
|
|
185
267
|
Set-Location .\patchwarden-runtime
|
|
186
268
|
npm.cmd init -y
|
|
187
|
-
npm.cmd install patchwarden@0.6.
|
|
269
|
+
npm.cmd install patchwarden@0.6.4
|
|
188
270
|
Copy-Item .\node_modules\patchwarden\examples\config.example.json .\patchwarden.config.json
|
|
189
271
|
$env:PATCHWARDEN_CONFIG = (Resolve-Path .\patchwarden.config.json)
|
|
190
272
|
node .\node_modules\patchwarden\dist\runner\watch.js
|
|
@@ -193,7 +275,7 @@ node .\node_modules\patchwarden\dist\runner\watch.js
|
|
|
193
275
|
An MCP client can launch:
|
|
194
276
|
|
|
195
277
|
```text
|
|
196
|
-
npx.cmd -y patchwarden@0.6.
|
|
278
|
+
npx.cmd -y patchwarden@0.6.4
|
|
197
279
|
```
|
|
198
280
|
|
|
199
281
|
Pin the version in important environments instead of using `latest`
|
|
@@ -352,7 +434,7 @@ Pinned npm configuration:
|
|
|
352
434
|
```toml
|
|
353
435
|
[mcp_servers.patchwarden]
|
|
354
436
|
command = "npx.cmd"
|
|
355
|
-
args = ["-y", "patchwarden@0.6.
|
|
437
|
+
args = ["-y", "patchwarden@0.6.4"]
|
|
356
438
|
|
|
357
439
|
[mcp_servers.patchwarden.env]
|
|
358
440
|
PATCHWARDEN_CONFIG = "D:\\path\\to\\patchwarden.config.json"
|
|
@@ -412,7 +494,7 @@ PatchWarden.cmd start core
|
|
|
412
494
|
The launcher:
|
|
413
495
|
|
|
414
496
|
- Builds `dist/index.js` if it is missing.
|
|
415
|
-
- Verifies v0.6.
|
|
497
|
+
- Verifies v0.6.4, the fixed 17-tool `chatgpt_core` catalog, and its schema
|
|
416
498
|
manifest.
|
|
417
499
|
- Reads or prompts for the Tunnel ID.
|
|
418
500
|
- Reads or prompts for the runtime API key.
|
|
@@ -446,7 +528,7 @@ the expanded tunnel examples.
|
|
|
446
528
|
|
|
447
529
|
### Launcher default
|
|
448
530
|
|
|
449
|
-
`scripts/start-patchwarden-tunnel.ps1` first reads `HTTPS_PROXY` from the
|
|
531
|
+
`scripts/control/start-patchwarden-tunnel.ps1` first reads `HTTPS_PROXY` from the
|
|
450
532
|
current process. If it is absent, the launcher defaults to:
|
|
451
533
|
|
|
452
534
|
```text
|
|
@@ -606,6 +688,7 @@ mean the task is wrong.
|
|
|
606
688
|
| `result.md` | Human-readable execution report. |
|
|
607
689
|
| `result.json` | Structured result, paths, changes, warnings, and next steps. |
|
|
608
690
|
| `diff.patch` | Complete task change evidence. |
|
|
691
|
+
| `artifact_manifest.json` | Generated artifact paths, types, sizes, and SHA-256 hashes. |
|
|
609
692
|
| `file-stats.json` | Per-file addition and deletion statistics. |
|
|
610
693
|
| `verify.json` | Structured record for every independent verification command. |
|
|
611
694
|
| `verify.log` | Human-readable independent verification output. |
|
|
@@ -695,8 +778,11 @@ available from PowerShell:
|
|
|
695
778
|
.\PatchWarden.cmd restart all
|
|
696
779
|
.\PatchWarden.cmd status all
|
|
697
780
|
.\PatchWarden.cmd kill all
|
|
781
|
+
.\Stop-PatchWarden.cmd
|
|
698
782
|
```
|
|
699
783
|
|
|
784
|
+
For daily desktop use, start with `PatchWarden-Desktop.cmd`; it starts the tray and keeps Control Center available without opening extra browser windows. Use `PatchWarden-Control-Tray.cmd --foreground` only for tray debugging, `PatchWarden-Control.cmd` for the full local Web dashboard, and `Stop-PatchWarden.cmd` for one-click shutdown of Core/Direct, Control Center, and the tray.
|
|
785
|
+
|
|
700
786
|
The old single-purpose launchers remain under `scripts/launchers/` as a
|
|
701
787
|
compatibility layer. Personal launchers live under `.local/launchers/` and
|
|
702
788
|
remain excluded from Git and release packages. `stop` and `restart` correlate
|
|
@@ -768,7 +854,7 @@ terminate unrelated PatchWarden, OpenCode, or Codex instances.
|
|
|
768
854
|
| --- | --- | --- |
|
|
769
855
|
| Tunnel connection keeps timing out | No proxy is listening on default port 7892 | Find the real HTTP/Mixed port, set `HTTPS_PROXY`, and start from the same terminal. |
|
|
770
856
|
| Logs show 403 and `unsupported_country_region_territory` | Unsupported proxy exit region | Switch exit region and restart the tunnel. |
|
|
771
|
-
| `list_workspace` only shows `tunnel-client.exe` | MCP started in the wrong directory or did not receive the config path | Use `scripts/patchwarden-mcp-stdio.cmd`. |
|
|
857
|
+
| `list_workspace` only shows `tunnel-client.exe` | MCP started in the wrong directory or did not receive the config path | Use `scripts/mcp/patchwarden-mcp-stdio.cmd`. |
|
|
772
858
|
| MCP is connected, but tasks do not run | Watcher is missing or stale | Start `npm.cmd run watch` and inspect `health_check`. |
|
|
773
859
|
| `Agent command not found` | Agent is not on PATH, or Codex Desktop was mistaken for the CLI | Run `where.exe` and use the real CLI path in `agents.command`. |
|
|
774
860
|
| Verification command is rejected | It does not exactly match the allowlist | Add the exact command to `allowedTestCommands`. |
|
|
@@ -845,13 +931,13 @@ names.
|
|
|
845
931
|
|
|
846
932
|
## MCP tools and profiles
|
|
847
933
|
|
|
848
|
-
`chatgpt_core` is the fixed
|
|
934
|
+
`chatgpt_core` is the fixed 17-tool profile used by the ChatGPT tunnel:
|
|
849
935
|
|
|
850
936
|
`health_check`, `list_agents`, `list_workspace`,
|
|
851
937
|
`read_workspace_file`, `save_plan`, `create_task`,
|
|
852
938
|
`wait_for_task`, `get_task_summary`, `get_diff`, `get_result`,
|
|
853
939
|
`get_result_json`, `get_test_log`, `get_task_status`, `list_tasks`,
|
|
854
|
-
`cancel_task`, and `
|
|
940
|
+
`cancel_task`, `audit_task`, and `safe_status`.
|
|
855
941
|
|
|
856
942
|
`get_task_summary` keeps the backward-compatible `standard` view by default.
|
|
857
943
|
ChatGPT should request `view: "compact"` first; terminal `wait_for_task`
|
|
@@ -871,7 +957,7 @@ to `full`.
|
|
|
871
957
|
|
|
872
958
|
### ChatGPT Direct mode
|
|
873
959
|
|
|
874
|
-
Direct mode exposes
|
|
960
|
+
Direct mode exposes ten guarded tools so ChatGPT can create an editing
|
|
875
961
|
session, read and search source files, apply hash-bound JSON patches, run
|
|
876
962
|
exactly allowlisted verification commands, finalize the evidence, and audit
|
|
877
963
|
the result without a local execution agent.
|
|
@@ -895,7 +981,7 @@ On first use, provide the `tunnel-client.exe` path and a Tunnel ID dedicated
|
|
|
895
981
|
to the Direct Connector. The launcher uses the `patchwarden-direct` profile,
|
|
896
982
|
stores runtime state under `%LOCALAPPDATA%\patchwarden\runtime-direct`, skips
|
|
897
983
|
the Watcher, and retains the existing DPAPI credential handling. In a fresh
|
|
898
|
-
ChatGPT conversation, `health_check` should report `chatgpt_direct`,
|
|
984
|
+
ChatGPT conversation, `health_check` should report `chatgpt_direct`, ten
|
|
899
985
|
tools, and `direct_profile_enabled=true`.
|
|
900
986
|
|
|
901
987
|
## Security boundaries and local data
|
|
@@ -931,7 +1017,7 @@ Start with a dedicated test workspace and a repository you can recover.
|
|
|
931
1017
|
Upgrade a pinned npm installation:
|
|
932
1018
|
|
|
933
1019
|
```powershell
|
|
934
|
-
npm.cmd install patchwarden@0.6.
|
|
1020
|
+
npm.cmd install patchwarden@0.6.4
|
|
935
1021
|
```
|
|
936
1022
|
|
|
937
1023
|
Upgrade a source checkout:
|
|
@@ -997,6 +1083,8 @@ and release-asset checksums independently.
|
|
|
997
1083
|
|
|
998
1084
|
## Related documentation
|
|
999
1085
|
|
|
1086
|
+
- [v0.6.4 release notes](docs/release-v0.6.4.md)
|
|
1087
|
+
- [v0.6.1 release notes](docs/release-v0.6.1.md)
|
|
1000
1088
|
- [v0.6.0 release notes](docs/release-v0.6.0.md)
|
|
1001
1089
|
- [ChatGPT usage guide](docs/chatgpt-usage.md)
|
|
1002
1090
|
- [Migration guide](docs/migration-from-safe-bifrost.md)
|
package/README.md
CHANGED
|
@@ -8,16 +8,20 @@
|
|
|
8
8
|
[](https://nodejs.org/)
|
|
9
9
|
[](LICENSE)
|
|
10
10
|
|
|
11
|
-
当前稳定版本:**v0.6.
|
|
12
|
-
[发布说明](docs/release-v0.6.
|
|
11
|
+
当前稳定版本:**v0.6.4**。查看
|
|
12
|
+
[发布说明](docs/release-v0.6.4.md)、
|
|
13
13
|
[迁移指南](docs/migration-from-safe-bifrost.md)和
|
|
14
|
-
[GitHub Release](https://github.com/jiezeng2004-design/PatchWarden/releases/tag/v0.6.
|
|
14
|
+
[GitHub Release](https://github.com/jiezeng2004-design/PatchWarden/releases/tag/v0.6.4)。
|
|
15
15
|
|
|
16
16
|
PatchWarden 是一个面向本地编程 Agent 的安全 MCP 桥接器。上游的
|
|
17
17
|
ChatGPT、Codex、OpenCode 或其他 MCP 客户端负责规划与验收,
|
|
18
18
|
PatchWarden 负责把计划保存成工作区内任务,再由预先配置的本地 Agent
|
|
19
19
|
执行,并返回结果、代码差异和独立测试记录。
|
|
20
20
|
|
|
21
|
+
统一英文定位:
|
|
22
|
+
|
|
23
|
+
> PatchWarden is a local-first MCP safety and verification layer for AI coding agents, with workspace confinement, command allowlists, scope-violation detection, and auditable task evidence.
|
|
24
|
+
|
|
21
25
|

|
|
22
26
|
|
|
23
27
|
> [!IMPORTANT]
|
|
@@ -96,6 +100,7 @@ ChatGPT / Codex / OpenCode / 其他 MCP 客户端
|
|
|
96
100
|
MCP 客户端读取、审计、人工验收
|
|
97
101
|
```
|
|
98
102
|
|
|
103
|
+
|
|
99
104
|
一次完整运行通常包含三个角色:
|
|
100
105
|
|
|
101
106
|
1. **MCP Server**:由 Codex、OpenCode 或 Tunnel 启动。
|
|
@@ -175,7 +180,7 @@ npm 包适合让 MCP 客户端通过固定版本启动 PatchWarden。为了执
|
|
|
175
180
|
New-Item -ItemType Directory .\patchwarden-runtime
|
|
176
181
|
Set-Location .\patchwarden-runtime
|
|
177
182
|
npm.cmd init -y
|
|
178
|
-
npm.cmd install patchwarden@0.6.
|
|
183
|
+
npm.cmd install patchwarden@0.6.4
|
|
179
184
|
Copy-Item .\node_modules\patchwarden\examples\config.example.json .\patchwarden.config.json
|
|
180
185
|
$env:PATCHWARDEN_CONFIG = (Resolve-Path .\patchwarden.config.json)
|
|
181
186
|
node .\node_modules\patchwarden\dist\runner\watch.js
|
|
@@ -184,7 +189,7 @@ node .\node_modules\patchwarden\dist\runner\watch.js
|
|
|
184
189
|
MCP 客户端可以使用:
|
|
185
190
|
|
|
186
191
|
```text
|
|
187
|
-
npx.cmd -y patchwarden@0.6.
|
|
192
|
+
npx.cmd -y patchwarden@0.6.4
|
|
188
193
|
```
|
|
189
194
|
|
|
190
195
|
建议固定版本号,不要在重要环境中无条件使用 `latest`。
|
|
@@ -337,7 +342,7 @@ npm.cmd run watch
|
|
|
337
342
|
```toml
|
|
338
343
|
[mcp_servers.patchwarden]
|
|
339
344
|
command = "npx.cmd"
|
|
340
|
-
args = ["-y", "patchwarden@0.6.
|
|
345
|
+
args = ["-y", "patchwarden@0.6.4"]
|
|
341
346
|
|
|
342
347
|
[mcp_servers.patchwarden.env]
|
|
343
348
|
PATCHWARDEN_CONFIG = "D:\\path\\to\\patchwarden.config.json"
|
|
@@ -426,7 +431,7 @@ ChatGPT Connector 创建时:
|
|
|
426
431
|
|
|
427
432
|
### 一键脚本的默认值
|
|
428
433
|
|
|
429
|
-
`scripts/start-patchwarden-tunnel.ps1` 优先读取当前进程的
|
|
434
|
+
`scripts/control/start-patchwarden-tunnel.ps1` 优先读取当前进程的
|
|
430
435
|
`HTTPS_PROXY`。如果没有设置,它会默认使用:
|
|
431
436
|
|
|
432
437
|
```text
|
|
@@ -568,6 +573,7 @@ ChatGPT 任务应优先选择前三个守护模板:只读诊断使用 `inspect
|
|
|
568
573
|
| `result.md` | 人类可读的执行报告。 |
|
|
569
574
|
| `result.json` | 结构化结果、路径、变更、警告和后续建议。 |
|
|
570
575
|
| `diff.patch` | 完整任务差异证据。 |
|
|
576
|
+
| `artifact_manifest.json` | 构建或发布产物的路径、类型、大小与 SHA-256。 |
|
|
571
577
|
| `file-stats.json` | 文件级增删统计。 |
|
|
572
578
|
| `verify.json` | 每条独立验证命令的结构化记录。 |
|
|
573
579
|
| `verify.log` | 独立验证的可读日志。 |
|
|
@@ -653,8 +659,11 @@ Direct 两种模式的启动、停止、重启与状态。也可以在 PowerShel
|
|
|
653
659
|
.\PatchWarden.cmd restart all
|
|
654
660
|
.\PatchWarden.cmd status all
|
|
655
661
|
.\PatchWarden.cmd kill all
|
|
662
|
+
.\Stop-PatchWarden.cmd
|
|
656
663
|
```
|
|
657
664
|
|
|
665
|
+
日常桌面入口:`PatchWarden-Desktop.cmd` 启动托盘并确保 Control Center 可用,不自动打开额外浏览器窗口。只有调试托盘时才使用 `PatchWarden-Control-Tray.cmd --foreground`;需要完整 Web 控制台时打开 `PatchWarden-Control.cmd`;需要一键收尾时使用 `Stop-PatchWarden.cmd` 关闭 Core/Direct、Control Center 和托盘。
|
|
666
|
+
|
|
658
667
|
旧的单用途入口保留在 `scripts/launchers/` 作为兼容层;个人入口位于
|
|
659
668
|
`.local/launchers/`,并继续被 Git 和发布包排除。`stop` / `restart` 会同时检查
|
|
660
669
|
运行状态、精确的 Tunnel Profile、项目启动器和进程树,因此可以清理同一 Profile
|
|
@@ -726,13 +735,13 @@ Core Agent 和 Direct 可以**同时运行**,使用不同的 `tunnel-client` p
|
|
|
726
735
|
**Core 启动示例:**
|
|
727
736
|
|
|
728
737
|
```cmd
|
|
729
|
-
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%CD%\scripts\start-patchwarden-tunnel.ps1" -ToolProfile chatgpt_core -Profile patchwarden -HealthListenAddr 127.0.0.1:8080
|
|
738
|
+
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%CD%\scripts\control\start-patchwarden-tunnel.ps1" -ToolProfile chatgpt_core -Profile patchwarden -HealthListenAddr 127.0.0.1:8080
|
|
730
739
|
```
|
|
731
740
|
|
|
732
741
|
**Direct 启动示例:**
|
|
733
742
|
|
|
734
743
|
```cmd
|
|
735
|
-
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%CD%\scripts\start-patchwarden-tunnel.ps1" -ToolProfile chatgpt_direct -Profile patchwarden-direct -HealthListenAddr 127.0.0.1:8081 -SkipWatcher
|
|
744
|
+
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%CD%\scripts\control\start-patchwarden-tunnel.ps1" -ToolProfile chatgpt_direct -Profile patchwarden-direct -HealthListenAddr 127.0.0.1:8081 -SkipWatcher
|
|
736
745
|
```
|
|
737
746
|
|
|
738
747
|
如果使用 `.local\launchers\` 下的个人启动器,也需要同步追加对应
|
|
@@ -751,7 +760,7 @@ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%CD%\scripts\start-patc
|
|
|
751
760
|
| --- | --- | --- |
|
|
752
761
|
| Tunnel 一直连接超时 | 默认 7892 没有代理服务 | 确认实际 HTTP/Mixed 端口,设置 `HTTPS_PROXY` 后从同一窗口启动。 |
|
|
753
762
|
| 日志出现 403 和 `unsupported_country_region_territory` | 代理出口区域不受支持 | 切换出口区域,再重启 Tunnel。 |
|
|
754
|
-
| `list_workspace` 只看到 `tunnel-client.exe` | MCP 从错误目录启动或没收到配置路径 | 使用 `scripts/patchwarden-mcp-stdio.cmd`。 |
|
|
763
|
+
| `list_workspace` 只看到 `tunnel-client.exe` | MCP 从错误目录启动或没收到配置路径 | 使用 `scripts/mcp/patchwarden-mcp-stdio.cmd`。 |
|
|
755
764
|
| MCP 显示 connected,但任务不执行 | Watcher 没启动或心跳过期 | 启动 `npm.cmd run watch`,再看 `health_check`。 |
|
|
756
765
|
| `Agent command not found` | Agent 不在 PATH,或 Codex Desktop 被误当成 CLI | 运行 `where.exe`,必要时在 `agents.command` 写真实 CLI 路径。 |
|
|
757
766
|
| 验证命令被拒绝 | 与白名单不是逐字一致 | 把确切命令加入 `allowedTestCommands`,不要扩大成任意 Shell。 |
|
|
@@ -828,19 +837,19 @@ PatchWarden v0.4.0 不自动读取旧 CLI、旧环境变量、旧 Header、旧
|
|
|
828
837
|
|
|
829
838
|
## MCP 工具与 Profile
|
|
830
839
|
|
|
831
|
-
`chatgpt_core` 是固定的
|
|
840
|
+
`chatgpt_core` 是固定的 17 工具 Profile,适合 ChatGPT Tunnel:
|
|
832
841
|
|
|
833
842
|
`health_check`、`list_agents`、`list_workspace`、
|
|
834
843
|
`read_workspace_file`、`save_plan`、`create_task`、
|
|
835
844
|
`wait_for_task`、`get_task_summary`、`get_diff`、`get_result`、
|
|
836
845
|
`get_result_json`、`get_test_log`、`get_task_status`、`list_tasks`、
|
|
837
|
-
`cancel_task`、`audit_task`。
|
|
846
|
+
`cancel_task`、`audit_task`、`safe_status`。
|
|
838
847
|
|
|
839
848
|
`get_task_summary` 默认保留兼容的 `standard` 视图;ChatGPT 应优先使用
|
|
840
849
|
`view: "compact"`,终态 `wait_for_task` 也只内嵌 compact 验收证据。
|
|
841
850
|
|
|
842
|
-
`full`
|
|
843
|
-
|
|
851
|
+
`full` 提供完整 30 工具本地开发目录,包含核心工具、管理工具和 Direct
|
|
852
|
+
工具。除 `chatgpt_core` 外,常用额外管理工具包括:
|
|
844
853
|
|
|
845
854
|
- `get_plan`
|
|
846
855
|
- `kill_task`
|
|
@@ -849,15 +858,15 @@ PatchWarden v0.4.0 不自动读取旧 CLI、旧环境变量、旧 Header、旧
|
|
|
849
858
|
- `get_task_stdout_tail`
|
|
850
859
|
- `get_task_log_tail`
|
|
851
860
|
|
|
852
|
-
`chatgpt_direct` 是 v0.6.0 新增的 Direct 直接开发 Profile
|
|
861
|
+
`chatgpt_direct` 是 v0.6.0 新增的 Direct 直接开发 Profile,v0.6.4 包含 10 个工具:
|
|
853
862
|
|
|
854
863
|
`health_check`、`list_workspace`、`create_direct_session`、
|
|
855
864
|
`search_workspace`、`read_workspace_file`、`apply_patch`、
|
|
856
|
-
`run_verification`、`finalize_direct_session`、`audit_session`。
|
|
865
|
+
`run_verification`、`finalize_direct_session`、`audit_session`、`sync_file`。
|
|
857
866
|
|
|
858
867
|
`chatgpt_direct` 默认关闭,需要通过 `enableDirectProfile: true` 或
|
|
859
868
|
`PATCHWARDEN_TOOL_PROFILE=chatgpt_direct` 显式启用。`chatgpt_core` 保持
|
|
860
|
-
|
|
869
|
+
17 工具不变。
|
|
861
870
|
|
|
862
871
|
Tunnel 包装脚本会强制使用 `chatgpt_core`;普通本地开发默认使用 `full`。
|
|
863
872
|
|
|
@@ -912,7 +921,7 @@ Tunnel ID。启动器使用 `patchwarden-direct` Profile、独立的
|
|
|
912
921
|
Tunnel API Key 仍通过现有 Windows DPAPI 缓存处理,不会写入仓库。
|
|
913
922
|
|
|
914
923
|
连接 ChatGPT 后新建对话并先调用 `health_check`。预期
|
|
915
|
-
`tool_profile=chatgpt_direct`、`tool_count=
|
|
924
|
+
`tool_profile=chatgpt_direct`、`tool_count=10`、
|
|
916
925
|
`direct_profile_enabled=true`。已有对话可能缓存旧工具清单,需要重新连接
|
|
917
926
|
Connector 后再新建对话。
|
|
918
927
|
|
|
@@ -975,7 +984,7 @@ PatchWarden 能降低误操作风险,但不能替代人工审查。第一次
|
|
|
975
984
|
升级 npm 固定版本:
|
|
976
985
|
|
|
977
986
|
```powershell
|
|
978
|
-
npm.cmd install patchwarden@0.6.
|
|
987
|
+
npm.cmd install patchwarden@0.6.4
|
|
979
988
|
```
|
|
980
989
|
|
|
981
990
|
源码升级:
|
|
@@ -1040,6 +1049,8 @@ Release 和发布资产校验值。
|
|
|
1040
1049
|
|
|
1041
1050
|
## 相关文档
|
|
1042
1051
|
|
|
1052
|
+
- [v0.6.4 发布说明](docs/release-v0.6.4.md)
|
|
1053
|
+
- [v0.6.1 发布说明](docs/release-v0.6.1.md)
|
|
1043
1054
|
- [v0.6.0 发布说明](docs/release-v0.6.0.md)
|
|
1044
1055
|
- [ChatGPT 调用规范](docs/chatgpt-usage.md)
|
|
1045
1056
|
- [旧版本迁移指南](docs/migration-from-safe-bifrost.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal
|
|
3
|
+
cd /d "%~dp0"
|
|
4
|
+
powershell -ExecutionPolicy Bypass -NoProfile -File "%~dp0scripts\control\stop-patchwarden.ps1" %*
|
|
5
|
+
set EXITCODE=%ERRORLEVEL%
|
|
6
|
+
if not "%EXITCODE%"=="0" (
|
|
7
|
+
echo.
|
|
8
|
+
echo PatchWarden stop exited with code %EXITCODE%.
|
|
9
|
+
pause
|
|
10
|
+
)
|
|
11
|
+
endlocal & exit /b %EXITCODE%
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PatchWarden Control Center — local HTTP dashboard service.
|
|
4
|
+
*
|
|
5
|
+
* Binds to 127.0.0.1 only. Serves the static UI from `ui/` and exposes a set
|
|
6
|
+
* of fault-tolerant JSON APIs for inspecting runtime state and driving
|
|
7
|
+
* `scripts/control/manage-patchwarden.ps1` for process lifecycle.
|
|
8
|
+
*
|
|
9
|
+
* Run: node dist/controlCenter.js
|
|
10
|
+
* or: npm run start:control
|
|
11
|
+
*
|
|
12
|
+
* Port override: PATCHWARDEN_CONTROL_PORT=<n> or --port <n>
|
|
13
|
+
*/
|
|
14
|
+
export {};
|