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.
Files changed (591) hide show
  1. package/PatchWarden.cmd +32 -2
  2. package/README.en.md +158 -26
  3. package/README.md +124 -24
  4. package/dist/assessments/agentAssessor.js +21 -12
  5. package/dist/assessments/assessmentDiagnostics.d.ts +29 -0
  6. package/dist/assessments/assessmentDiagnostics.js +132 -0
  7. package/dist/assessments/assessmentStore.d.ts +39 -0
  8. package/dist/assessments/assessmentStore.js +207 -45
  9. package/dist/assessments/securitySnapshot.d.ts +50 -0
  10. package/dist/assessments/securitySnapshot.js +158 -0
  11. package/dist/config.d.ts +15 -0
  12. package/dist/config.js +66 -13
  13. package/dist/control/fileManager.d.ts +2 -0
  14. package/dist/control/fileManager.js +39 -0
  15. package/dist/control/middleware/auth.d.ts +6 -0
  16. package/dist/control/middleware/auth.js +14 -5
  17. package/dist/control/middleware/static.js +16 -3
  18. package/dist/control/routeTable.d.ts +24 -0
  19. package/dist/control/routeTable.js +263 -0
  20. package/dist/control/routes/audit.js +17 -7
  21. package/dist/control/routes/evidence.js +1 -1
  22. package/dist/control/routes/lineage.js +1 -1
  23. package/dist/control/routes/process.d.ts +7 -0
  24. package/dist/control/routes/process.js +329 -42
  25. package/dist/control/routes/sessions.d.ts +9 -1
  26. package/dist/control/routes/sessions.js +84 -21
  27. package/dist/control/routes/status.d.ts +60 -1
  28. package/dist/control/routes/status.js +94 -15
  29. package/dist/control/routes/taskActions.js +24 -60
  30. package/dist/control/routes/tasks.d.ts +4 -0
  31. package/dist/control/routes/tasks.js +61 -62
  32. package/dist/control/routes/workspace.js +50 -23
  33. package/dist/control/runtime.d.ts +3 -2
  34. package/dist/control/runtime.js +65 -40
  35. package/dist/control/server.js +37 -365
  36. package/dist/control/shared.d.ts +25 -1
  37. package/dist/control/shared.js +64 -11
  38. package/dist/diagnostics/allowedTestCommandSafety.d.ts +1 -0
  39. package/dist/diagnostics/allowedTestCommandSafety.js +11 -0
  40. package/dist/direct/directAudit.js +234 -225
  41. package/dist/direct/directGuards.d.ts +2 -1
  42. package/dist/direct/directGuards.js +42 -29
  43. package/dist/direct/directPatch.d.ts +6 -1
  44. package/dist/direct/directPatch.js +55 -8
  45. package/dist/direct/directSessionStore.d.ts +16 -6
  46. package/dist/direct/directSessionStore.js +128 -35
  47. package/dist/direct/directVerification.js +8 -16
  48. package/dist/doctor.js +65 -57
  49. package/dist/goal/acceptanceEngine.d.ts +1 -1
  50. package/dist/goal/goalProgress.js +75 -69
  51. package/dist/goal/goalReport.js +5 -12
  52. package/dist/goal/goalStatus.d.ts +2 -0
  53. package/dist/goal/goalStatus.js +10 -3
  54. package/dist/goal/goalStore.d.ts +9 -2
  55. package/dist/goal/goalStore.js +152 -45
  56. package/dist/goal/handoffExport.js +6 -6
  57. package/dist/goal/specKitImport.js +97 -96
  58. package/dist/goal/subgoalSync.js +11 -9
  59. package/dist/goal/worktreeManager.d.ts +2 -0
  60. package/dist/goal/worktreeManager.js +209 -136
  61. package/dist/httpServer.js +111 -32
  62. package/dist/logging.js +5 -3
  63. package/dist/policy/projectPolicy.js +5 -2
  64. package/dist/release/releaseGate.d.ts +1 -1
  65. package/dist/release/releaseGate.js +78 -25
  66. package/dist/runner/agentInvocation.d.ts +14 -0
  67. package/dist/runner/agentInvocation.js +96 -4
  68. package/dist/runner/changeCapture.d.ts +13 -5
  69. package/dist/runner/changeCapture.js +243 -61
  70. package/dist/runner/postTaskCleanup.js +48 -19
  71. package/dist/runner/processSecurity.d.ts +56 -0
  72. package/dist/runner/processSecurity.js +373 -0
  73. package/dist/runner/runTask.d.ts +2 -1
  74. package/dist/runner/runTask.js +162 -93
  75. package/dist/runner/simpleProcess.d.ts +3 -0
  76. package/dist/runner/simpleProcess.js +50 -36
  77. package/dist/{taskProgress.d.ts → runner/taskProgress.d.ts} +1 -1
  78. package/dist/{taskProgress.js → runner/taskProgress.js} +2 -2
  79. package/dist/{taskRuntime.d.ts → runner/taskRuntime.d.ts} +3 -1
  80. package/dist/{taskRuntime.js → runner/taskRuntime.js} +3 -2
  81. package/dist/runner/taskStatusStore.d.ts +11 -0
  82. package/dist/runner/taskStatusStore.js +35 -0
  83. package/dist/runner/watch.d.ts +14 -1
  84. package/dist/runner/watch.js +320 -49
  85. package/dist/security/contentRedaction.js +2 -2
  86. package/dist/security/discoveryTokenStore.d.ts +3 -2
  87. package/dist/security/discoveryTokenStore.js +17 -2
  88. package/dist/security/loopbackHost.d.ts +2 -0
  89. package/dist/security/loopbackHost.js +16 -0
  90. package/dist/security/pathGuard.js +32 -17
  91. package/dist/security/planGuard.js +2 -1
  92. package/dist/security/runtimeGuard.js +9 -6
  93. package/dist/security/secretComparison.d.ts +3 -0
  94. package/dist/security/secretComparison.js +11 -0
  95. package/dist/security/sensitiveGuard.d.ts +5 -0
  96. package/dist/security/sensitiveGuard.js +27 -8
  97. package/dist/security/toolInvocationGuard.d.ts +2 -2
  98. package/dist/security/toolInvocationGuard.js +1 -1
  99. package/dist/security/workspaceRootGuard.d.ts +8 -0
  100. package/dist/security/workspaceRootGuard.js +47 -0
  101. package/dist/smoke-test.js +27 -26
  102. package/dist/tools/catalog/index.d.ts +4 -0
  103. package/dist/tools/catalog/index.js +4 -0
  104. package/dist/tools/{toolCatalog.js → catalog/toolCatalog.js} +3 -12
  105. package/dist/tools/{toolRegistry.d.ts → catalog/toolRegistry.d.ts} +3 -3
  106. package/dist/tools/{toolRegistry.js → catalog/toolRegistry.js} +6 -15
  107. package/dist/tools/definitions/toolDefs.d.ts +18 -0
  108. package/dist/tools/definitions/toolDefs.js +1177 -0
  109. package/dist/tools/{auditSession.d.ts → diagnostics/auditSession.d.ts} +1 -1
  110. package/dist/tools/{auditSession.js → diagnostics/auditSession.js} +2 -2
  111. package/dist/tools/{auditTask.d.ts → diagnostics/auditTask.d.ts} +2 -1
  112. package/dist/tools/{auditTask.js → diagnostics/auditTask.js} +134 -36
  113. package/dist/tools/{healthCheck.d.ts → diagnostics/healthCheck.d.ts} +18 -6
  114. package/dist/tools/{healthCheck.js → diagnostics/healthCheck.js} +36 -8
  115. package/dist/tools/diagnostics/index.d.ts +6 -0
  116. package/dist/tools/diagnostics/index.js +6 -0
  117. package/dist/tools/{safeStatus.d.ts → diagnostics/safeStatus.d.ts} +3 -3
  118. package/dist/tools/{safeStatus.js → diagnostics/safeStatus.js} +6 -6
  119. package/dist/tools/{safeViews.d.ts → diagnostics/safeViews.d.ts} +12 -8
  120. package/dist/tools/{safeViews.js → diagnostics/safeViews.js} +23 -13
  121. package/dist/tools/{schemaDriftCheck.d.ts → diagnostics/schemaDriftCheck.d.ts} +1 -1
  122. package/dist/tools/{schemaDriftCheck.js → diagnostics/schemaDriftCheck.js} +2 -2
  123. package/dist/tools/{createDirectSession.js → direct/createDirectSession.js} +6 -6
  124. package/dist/tools/{finalizeDirectSession.d.ts → direct/finalizeDirectSession.d.ts} +1 -1
  125. package/dist/tools/direct/finalizeDirectSession.js +86 -0
  126. package/dist/tools/direct/index.d.ts +3 -0
  127. package/dist/tools/direct/index.js +3 -0
  128. package/dist/tools/{runDirectVerificationBundle.js → direct/runDirectVerificationBundle.js} +2 -2
  129. package/dist/tools/{discoverTools.d.ts → discovery/discoverTools.d.ts} +2 -2
  130. package/dist/tools/{discoverTools.js → discovery/discoverTools.js} +5 -5
  131. package/dist/tools/{explainTool.d.ts → discovery/explainTool.d.ts} +2 -2
  132. package/dist/tools/{explainTool.js → discovery/explainTool.js} +2 -2
  133. package/dist/tools/discovery/index.d.ts +3 -0
  134. package/dist/tools/discovery/index.js +3 -0
  135. package/dist/tools/{invokeDiscoveredTool.d.ts → discovery/invokeDiscoveredTool.d.ts} +2 -2
  136. package/dist/tools/{invokeDiscoveredTool.js → discovery/invokeDiscoveredTool.js} +5 -5
  137. package/dist/tools/dispatch/coreDispatch.js +32 -31
  138. package/dist/tools/dispatch/diagnosticDispatch.d.ts +3 -5
  139. package/dist/tools/dispatch/diagnosticDispatch.js +70 -68
  140. package/dist/tools/dispatch/directDispatch.js +11 -10
  141. package/dist/tools/dispatch/goalDispatch.js +5 -4
  142. package/dist/tools/dispatch/releaseDispatch.js +3 -2
  143. package/dist/tools/dispatch/validation.d.ts +7 -0
  144. package/dist/tools/dispatch/validation.js +71 -0
  145. package/dist/tools/{getPlan.js → goals/getPlan.js} +4 -4
  146. package/dist/tools/{goalSubgoalTask.d.ts → goals/goalSubgoalTask.d.ts} +1 -1
  147. package/dist/tools/goals/goalSubgoalTask.js +118 -0
  148. package/dist/tools/goals/index.d.ts +3 -0
  149. package/dist/tools/goals/index.js +3 -0
  150. package/dist/tools/{savePlan.js → goals/savePlan.js} +28 -8
  151. package/dist/tools/registry.d.ts +7 -11
  152. package/dist/tools/registry.js +17 -1178
  153. package/dist/tools/{checkReleaseGate.d.ts → release/checkReleaseGate.d.ts} +1 -1
  154. package/dist/tools/{checkReleaseGate.js → release/checkReleaseGate.js} +3 -3
  155. package/dist/tools/release/index.d.ts +2 -0
  156. package/dist/tools/release/index.js +2 -0
  157. package/dist/tools/{releaseMode.d.ts → release/releaseMode.d.ts} +2 -2
  158. package/dist/tools/{releaseMode.js → release/releaseMode.js} +46 -26
  159. package/dist/tools/tasks/cancelTask.d.ts +11 -0
  160. package/dist/tools/tasks/cancelTask.js +86 -0
  161. package/dist/tools/{createTask.d.ts → tasks/createTask.d.ts} +12 -4
  162. package/dist/tools/{createTask.js → tasks/createTask.js} +110 -34
  163. package/dist/tools/{diagnoseTask.d.ts → tasks/diagnoseTask.d.ts} +1 -1
  164. package/dist/tools/{diagnoseTask.js → tasks/diagnoseTask.js} +12 -16
  165. package/dist/tools/{evidencePack.js → tasks/evidencePack.js} +34 -22
  166. package/dist/tools/{getTaskFile.js → tasks/getTaskFile.js} +4 -4
  167. package/dist/tools/{getTaskStatus.d.ts → tasks/getTaskStatus.d.ts} +6 -1
  168. package/dist/tools/{getTaskStatus.js → tasks/getTaskStatus.js} +11 -6
  169. package/dist/tools/{getTaskStdoutTail.js → tasks/getTaskStdoutTail.js} +13 -11
  170. package/dist/tools/{getTaskSummary.js → tasks/getTaskSummary.js} +35 -36
  171. package/dist/tools/tasks/index.d.ts +18 -0
  172. package/dist/tools/tasks/index.js +18 -0
  173. package/dist/tools/tasks/killTask.d.ts +1 -0
  174. package/dist/tools/{listTasks.d.ts → tasks/listTasks.d.ts} +1 -1
  175. package/dist/tools/{listTasks.js → tasks/listTasks.js} +5 -4
  176. package/dist/tools/{reconcileTasks.d.ts → tasks/reconcileTasks.d.ts} +3 -2
  177. package/dist/tools/tasks/reconcileTasks.js +496 -0
  178. package/dist/tools/tasks/retryTask.js +60 -0
  179. package/dist/tools/{runTaskLoop.d.ts → tasks/runTaskLoop.d.ts} +6 -6
  180. package/dist/tools/{runTaskLoop.js → tasks/runTaskLoop.js} +63 -41
  181. package/dist/tools/tasks/runVerification.js +38 -0
  182. package/dist/tools/{taskLineage.js → tasks/taskLineage.js} +8 -7
  183. package/dist/tools/{taskOutputs.d.ts → tasks/taskOutputs.d.ts} +2 -2
  184. package/dist/tools/{taskOutputs.js → tasks/taskOutputs.js} +17 -16
  185. package/dist/tools/tasks/taskStates.d.ts +6 -0
  186. package/dist/tools/tasks/taskStates.js +52 -0
  187. package/dist/tools/{waitForTask.js → tasks/waitForTask.js} +3 -11
  188. package/dist/tools/{androidDoctor.js → workspace/androidDoctor.js} +16 -10
  189. package/dist/tools/{applyPatch.d.ts → workspace/applyPatch.d.ts} +1 -1
  190. package/dist/tools/workspace/applyPatch.js +53 -0
  191. package/dist/tools/{discardWorktree.js → workspace/discardWorktree.js} +3 -3
  192. package/dist/tools/workspace/index.d.ts +10 -0
  193. package/dist/tools/workspace/index.js +10 -0
  194. package/dist/tools/workspace/listAgents.d.ts +23 -0
  195. package/dist/tools/workspace/listAgents.js +56 -0
  196. package/dist/tools/{listWorkspace.js → workspace/listWorkspace.js} +3 -3
  197. package/dist/tools/{mergeWorktree.js → workspace/mergeWorktree.js} +3 -3
  198. package/dist/tools/{readWorkspaceFile.js → workspace/readWorkspaceFile.js} +8 -8
  199. package/dist/tools/{recommendAgentForTask.js → workspace/recommendAgentForTask.js} +3 -3
  200. package/dist/tools/{searchWorkspace.js → workspace/searchWorkspace.js} +5 -5
  201. package/dist/tools/{syncFile.d.ts → workspace/syncFile.d.ts} +1 -1
  202. package/dist/tools/workspace/syncFile.js +134 -0
  203. package/dist/utils/atomicFile.d.ts +7 -0
  204. package/dist/utils/atomicFile.js +67 -0
  205. package/dist/utils/boundedFile.d.ts +8 -0
  206. package/dist/utils/boundedFile.js +93 -0
  207. package/dist/utils/lockedJsonFile.d.ts +15 -0
  208. package/dist/utils/lockedJsonFile.js +224 -0
  209. package/dist/utils/platform.d.ts +11 -0
  210. package/dist/utils/platform.js +26 -0
  211. package/dist/utils/stableJson.d.ts +2 -0
  212. package/dist/utils/stableJson.js +12 -0
  213. package/dist/version.d.ts +3 -2
  214. package/dist/version.js +3 -2
  215. package/dist/watcherStatus.d.ts +2 -2
  216. package/dist/watcherStatus.js +18 -0
  217. package/docs/CODE_WIKI.md +808 -143
  218. package/docs/architecture.md +15 -55
  219. package/docs/assets/patchwarden-desktop-onboarding.png +0 -0
  220. package/docs/control-center/README.md +4 -4
  221. package/docs/dashboard-overview.md +4 -4
  222. package/docs/desktop-app.md +175 -0
  223. package/docs/evidence-pack-schema.md +3 -3
  224. package/docs/open-source-application.md +16 -11
  225. package/docs/release-checklist.md +1 -1
  226. package/docs/release-evidence.md +35 -39
  227. package/docs/task-safe-review-workflow.md +5 -5
  228. package/docs/threat-model.md +19 -1
  229. package/examples/config.example.json +4 -2
  230. package/package.json +27 -10
  231. package/scripts/README.md +15 -6
  232. package/scripts/build.js +11 -0
  233. package/scripts/checks/brand-check.js +3 -0
  234. package/scripts/checks/build-output-check.js +37 -0
  235. package/scripts/checks/control-center-smoke.js +102 -10
  236. package/scripts/checks/control-smoke.js +19 -8
  237. package/scripts/checks/http-mcp-smoke.js +82 -4
  238. package/scripts/checks/lifecycle-smoke.js +15 -12
  239. package/scripts/checks/mcp-manifest-check.js +1 -1
  240. package/scripts/checks/mcp-smoke.js +58 -4
  241. package/scripts/checks/package-manifest-check.js +20 -7
  242. package/scripts/checks/unit-tests.js +3 -5
  243. package/scripts/checks/watcher-supervisor-smoke.js +38 -1
  244. package/scripts/control/get-patchwarden-health.ps1 +1 -1
  245. package/scripts/control/manage-patchwarden.ps1 +69 -4
  246. package/scripts/control/provision-patchwarden-tunnel.ps1 +127 -0
  247. package/scripts/control/run-background-supervisor.ps1 +41 -0
  248. package/scripts/control/start-patchwarden-tunnel.ps1 +191 -33
  249. package/scripts/e2e/demo-runtime.mjs +153 -0
  250. package/{PatchWarden-Control-Tray.cmd → scripts/launchers/PatchWarden-Control-Tray.cmd} +3 -3
  251. package/scripts/launchers/PatchWarden-Control.cmd +6 -0
  252. package/{PatchWarden-Desktop.cmd → scripts/launchers/PatchWarden-Desktop.cmd} +2 -2
  253. package/scripts/launchers/Restart-PatchWarden-Control.cmd +6 -0
  254. package/{Stop-PatchWarden.cmd → scripts/launchers/Stop-PatchWarden.cmd} +2 -2
  255. package/scripts/lib/clean-generated-output.js +11 -0
  256. package/scripts/lib/file-discovery.js +12 -0
  257. package/scripts/release/desktop-preflight.js +211 -0
  258. package/scripts/release/pack-clean.js +59 -14
  259. package/src/assessments/agentAssessor.ts +26 -12
  260. package/src/assessments/assessmentDiagnostics.ts +172 -0
  261. package/src/assessments/assessmentStore.ts +288 -51
  262. package/src/assessments/securitySnapshot.ts +231 -0
  263. package/src/config.ts +70 -13
  264. package/src/control/fileManager.ts +40 -0
  265. package/src/control/middleware/auth.ts +22 -4
  266. package/src/control/middleware/static.ts +16 -3
  267. package/src/control/routeTable.ts +301 -0
  268. package/src/control/routes/audit.ts +14 -6
  269. package/src/control/routes/evidence.ts +1 -1
  270. package/src/control/routes/lineage.ts +1 -1
  271. package/src/control/routes/process.ts +341 -40
  272. package/src/control/routes/sessions.ts +88 -25
  273. package/src/control/routes/status.ts +134 -17
  274. package/src/control/routes/taskActions.ts +24 -58
  275. package/src/control/routes/tasks.ts +66 -58
  276. package/src/control/routes/workspace.ts +56 -25
  277. package/src/control/runtime.ts +71 -43
  278. package/src/control/server.ts +37 -342
  279. package/src/control/shared.ts +77 -11
  280. package/src/diagnostics/allowedTestCommandSafety.ts +12 -0
  281. package/src/direct/directAudit.ts +17 -9
  282. package/src/direct/directGuards.ts +72 -44
  283. package/src/direct/directPatch.ts +95 -8
  284. package/src/direct/directSessionStore.ts +213 -55
  285. package/src/direct/directVerification.ts +9 -23
  286. package/src/doctor.ts +76 -64
  287. package/src/goal/acceptanceEngine.ts +1 -1
  288. package/src/goal/goalProgress.ts +17 -13
  289. package/src/goal/goalReport.ts +5 -13
  290. package/src/goal/goalStatus.ts +19 -3
  291. package/src/goal/goalStore.ts +241 -54
  292. package/src/goal/handoffExport.ts +6 -6
  293. package/src/goal/specKitImport.ts +12 -12
  294. package/src/goal/subgoalSync.ts +11 -8
  295. package/src/goal/worktreeManager.ts +139 -22
  296. package/src/httpServer.ts +113 -30
  297. package/src/logging.ts +10 -3
  298. package/src/policy/projectPolicy.ts +5 -2
  299. package/src/release/releaseGate.ts +74 -27
  300. package/src/runner/agentInvocation.ts +126 -4
  301. package/src/runner/changeCapture.ts +291 -57
  302. package/src/runner/postTaskCleanup.ts +41 -17
  303. package/src/runner/processSecurity.ts +433 -0
  304. package/src/runner/runTask.ts +197 -97
  305. package/src/runner/simpleProcess.ts +66 -31
  306. package/src/{taskProgress.ts → runner/taskProgress.ts} +3 -3
  307. package/src/{taskRuntime.ts → runner/taskRuntime.ts} +6 -3
  308. package/src/runner/taskStatusStore.ts +69 -0
  309. package/src/runner/watch.ts +348 -52
  310. package/src/security/contentRedaction.ts +2 -2
  311. package/src/security/discoveryTokenStore.ts +18 -4
  312. package/src/security/loopbackHost.ts +19 -0
  313. package/src/security/pathGuard.ts +35 -16
  314. package/src/security/planGuard.ts +2 -1
  315. package/src/security/runtimeGuard.ts +9 -6
  316. package/src/security/secretComparison.ts +13 -0
  317. package/src/security/sensitiveGuard.ts +27 -8
  318. package/src/security/toolInvocationGuard.ts +2 -2
  319. package/src/security/workspaceRootGuard.ts +53 -0
  320. package/src/smoke-test.ts +27 -26
  321. package/src/tools/catalog/index.ts +4 -0
  322. package/src/tools/{toolCatalog.ts → catalog/toolCatalog.ts} +3 -12
  323. package/src/tools/{toolRegistry.ts → catalog/toolRegistry.ts} +7 -16
  324. package/src/tools/definitions/toolDefs.ts +1264 -0
  325. package/src/tools/{auditSession.ts → diagnostics/auditSession.ts} +2 -2
  326. package/src/tools/{auditTask.ts → diagnostics/auditTask.ts} +136 -39
  327. package/src/tools/{healthCheck.ts → diagnostics/healthCheck.ts} +37 -9
  328. package/src/tools/diagnostics/index.ts +6 -0
  329. package/src/tools/{safeStatus.ts → diagnostics/safeStatus.ts} +7 -7
  330. package/src/tools/{safeViews.ts → diagnostics/safeViews.ts} +27 -17
  331. package/src/tools/{schemaDriftCheck.ts → diagnostics/schemaDriftCheck.ts} +3 -3
  332. package/src/tools/{createDirectSession.ts → direct/createDirectSession.ts} +6 -6
  333. package/src/tools/{finalizeDirectSession.ts → direct/finalizeDirectSession.ts} +7 -5
  334. package/src/tools/direct/index.ts +3 -0
  335. package/src/tools/{runDirectVerificationBundle.ts → direct/runDirectVerificationBundle.ts} +2 -2
  336. package/src/tools/{discoverTools.ts → discovery/discoverTools.ts} +6 -6
  337. package/src/tools/{explainTool.ts → discovery/explainTool.ts} +3 -3
  338. package/src/tools/discovery/index.ts +3 -0
  339. package/src/tools/{invokeDiscoveredTool.ts → discovery/invokeDiscoveredTool.ts} +7 -7
  340. package/src/tools/dispatch/coreDispatch.ts +36 -31
  341. package/src/tools/dispatch/diagnosticDispatch.ts +26 -21
  342. package/src/tools/dispatch/directDispatch.ts +11 -10
  343. package/src/tools/dispatch/goalDispatch.ts +5 -4
  344. package/src/tools/dispatch/releaseDispatch.ts +3 -2
  345. package/src/tools/dispatch/validation.ts +78 -0
  346. package/src/tools/{getPlan.ts → goals/getPlan.ts} +4 -4
  347. package/src/tools/{goalSubgoalTask.ts → goals/goalSubgoalTask.ts} +41 -26
  348. package/src/tools/goals/index.ts +3 -0
  349. package/src/tools/{savePlan.ts → goals/savePlan.ts} +38 -8
  350. package/src/tools/registry.ts +17 -1261
  351. package/src/tools/{checkReleaseGate.ts → release/checkReleaseGate.ts} +3 -3
  352. package/src/tools/release/index.ts +2 -0
  353. package/src/tools/{releaseMode.ts → release/releaseMode.ts} +42 -24
  354. package/src/tools/tasks/cancelTask.ts +110 -0
  355. package/src/tools/{createTask.ts → tasks/createTask.ts} +161 -33
  356. package/src/tools/{diagnoseTask.ts → tasks/diagnoseTask.ts} +12 -16
  357. package/src/tools/{evidencePack.ts → tasks/evidencePack.ts} +36 -22
  358. package/src/tools/{getTaskFile.ts → tasks/getTaskFile.ts} +4 -4
  359. package/src/tools/{getTaskStatus.ts → tasks/getTaskStatus.ts} +13 -6
  360. package/src/tools/{getTaskStdoutTail.ts → tasks/getTaskStdoutTail.ts} +13 -11
  361. package/src/tools/{getTaskSummary.ts → tasks/getTaskSummary.ts} +46 -44
  362. package/src/tools/tasks/index.ts +18 -0
  363. package/src/tools/{listTasks.ts → tasks/listTasks.ts} +6 -5
  364. package/src/tools/{reconcileTasks.ts → tasks/reconcileTasks.ts} +228 -77
  365. package/src/tools/tasks/retryTask.ts +69 -0
  366. package/src/tools/{runTaskLoop.ts → tasks/runTaskLoop.ts} +73 -46
  367. package/src/tools/{runVerification.ts → tasks/runVerification.ts} +6 -3
  368. package/src/tools/{taskLineage.ts → tasks/taskLineage.ts} +8 -7
  369. package/src/tools/{taskOutputs.ts → tasks/taskOutputs.ts} +27 -20
  370. package/src/tools/tasks/taskStates.ts +54 -0
  371. package/src/tools/{waitForTask.ts → tasks/waitForTask.ts} +3 -12
  372. package/src/tools/{androidDoctor.ts → workspace/androidDoctor.ts} +15 -10
  373. package/src/tools/{applyPatch.ts → workspace/applyPatch.ts} +38 -16
  374. package/src/tools/{discardWorktree.ts → workspace/discardWorktree.ts} +3 -3
  375. package/src/tools/workspace/index.ts +10 -0
  376. package/src/tools/workspace/listAgents.ts +75 -0
  377. package/src/tools/{listWorkspace.ts → workspace/listWorkspace.ts} +3 -3
  378. package/src/tools/{mergeWorktree.ts → workspace/mergeWorktree.ts} +3 -3
  379. package/src/tools/{readWorkspaceFile.ts → workspace/readWorkspaceFile.ts} +8 -8
  380. package/src/tools/{recommendAgentForTask.ts → workspace/recommendAgentForTask.ts} +3 -3
  381. package/src/tools/{searchWorkspace.ts → workspace/searchWorkspace.ts} +5 -5
  382. package/src/tools/workspace/syncFile.ts +292 -0
  383. package/src/utils/atomicFile.ts +74 -0
  384. package/src/utils/boundedFile.ts +116 -0
  385. package/src/utils/lockedJsonFile.ts +251 -0
  386. package/src/utils/platform.ts +31 -0
  387. package/src/utils/stableJson.ts +12 -0
  388. package/src/version.ts +3 -2
  389. package/src/watcherStatus.ts +19 -1
  390. package/ui/desktop-bootstrap.js +11 -0
  391. package/ui/desktop-bridge.js +36 -0
  392. package/ui/desktop.css +160 -0
  393. package/ui/getting-started.js +93 -0
  394. package/ui/i18n.js +484 -0
  395. package/ui/log-parser.js +30 -0
  396. package/ui/pages/audit.html +12 -0
  397. package/ui/pages/dashboard.html +94 -147
  398. package/ui/pages/direct-sessions.html +123 -26
  399. package/ui/pages/getting-started.html +43 -0
  400. package/ui/pages/logs.html +134 -22
  401. package/ui/pages/settings.html +101 -0
  402. package/ui/pages/task-detail.html +12 -0
  403. package/ui/pages/tasks.html +54 -8
  404. package/ui/pages/workspace.html +38 -1
  405. package/ui/settings.js +254 -0
  406. package/PatchWarden-Control.cmd +0 -6
  407. package/Restart-PatchWarden-Control.cmd +0 -6
  408. package/dist/test/unit/acceptance-engine.test.d.ts +0 -1
  409. package/dist/test/unit/acceptance-engine.test.js +0 -228
  410. package/dist/test/unit/agent-router.test.d.ts +0 -1
  411. package/dist/test/unit/agent-router.test.js +0 -287
  412. package/dist/test/unit/android-doctor.test.d.ts +0 -1
  413. package/dist/test/unit/android-doctor.test.js +0 -118
  414. package/dist/test/unit/apply-patch.test.d.ts +0 -1
  415. package/dist/test/unit/apply-patch.test.js +0 -225
  416. package/dist/test/unit/audit-checks.test.d.ts +0 -1
  417. package/dist/test/unit/audit-checks.test.js +0 -350
  418. package/dist/test/unit/chinese-path.test.d.ts +0 -1
  419. package/dist/test/unit/chinese-path.test.js +0 -91
  420. package/dist/test/unit/command-guard.test.d.ts +0 -1
  421. package/dist/test/unit/command-guard.test.js +0 -160
  422. package/dist/test/unit/create-task.test.d.ts +0 -1
  423. package/dist/test/unit/create-task.test.js +0 -197
  424. package/dist/test/unit/diagnose-task.test.d.ts +0 -1
  425. package/dist/test/unit/diagnose-task.test.js +0 -457
  426. package/dist/test/unit/direct-guards.test.d.ts +0 -1
  427. package/dist/test/unit/direct-guards.test.js +0 -328
  428. package/dist/test/unit/discovery-token-store.test.d.ts +0 -1
  429. package/dist/test/unit/discovery-token-store.test.js +0 -139
  430. package/dist/test/unit/evidence-pack.test.d.ts +0 -1
  431. package/dist/test/unit/evidence-pack.test.js +0 -224
  432. package/dist/test/unit/get-task-status.test.d.ts +0 -1
  433. package/dist/test/unit/get-task-status.test.js +0 -174
  434. package/dist/test/unit/get-task-summary.test.d.ts +0 -1
  435. package/dist/test/unit/get-task-summary.test.js +0 -146
  436. package/dist/test/unit/goal-graph.test.d.ts +0 -1
  437. package/dist/test/unit/goal-graph.test.js +0 -298
  438. package/dist/test/unit/goal-progress.test.d.ts +0 -1
  439. package/dist/test/unit/goal-progress.test.js +0 -381
  440. package/dist/test/unit/goal-report.test.d.ts +0 -1
  441. package/dist/test/unit/goal-report.test.js +0 -159
  442. package/dist/test/unit/goal-status.test.d.ts +0 -1
  443. package/dist/test/unit/goal-status.test.js +0 -215
  444. package/dist/test/unit/goal-store.test.d.ts +0 -1
  445. package/dist/test/unit/goal-store.test.js +0 -253
  446. package/dist/test/unit/goal-subgoal-task.test.d.ts +0 -1
  447. package/dist/test/unit/goal-subgoal-task.test.js +0 -55
  448. package/dist/test/unit/goal-tools-registry.test.d.ts +0 -1
  449. package/dist/test/unit/goal-tools-registry.test.js +0 -192
  450. package/dist/test/unit/handoff-export.test.d.ts +0 -1
  451. package/dist/test/unit/handoff-export.test.js +0 -263
  452. package/dist/test/unit/invoke-discovered-tool.test.d.ts +0 -1
  453. package/dist/test/unit/invoke-discovered-tool.test.js +0 -167
  454. package/dist/test/unit/logging.test.d.ts +0 -1
  455. package/dist/test/unit/logging.test.js +0 -397
  456. package/dist/test/unit/path-guard.test.d.ts +0 -1
  457. package/dist/test/unit/path-guard.test.js +0 -133
  458. package/dist/test/unit/post-task-cleanup.test.d.ts +0 -1
  459. package/dist/test/unit/post-task-cleanup.test.js +0 -48
  460. package/dist/test/unit/project-policy-release-mode.test.d.ts +0 -1
  461. package/dist/test/unit/project-policy-release-mode.test.js +0 -125
  462. package/dist/test/unit/reconcile-tasks.test.d.ts +0 -1
  463. package/dist/test/unit/reconcile-tasks.test.js +0 -456
  464. package/dist/test/unit/release-gate.test.d.ts +0 -1
  465. package/dist/test/unit/release-gate.test.js +0 -242
  466. package/dist/test/unit/run-task-loop.test.d.ts +0 -1
  467. package/dist/test/unit/run-task-loop.test.js +0 -380
  468. package/dist/test/unit/safe-status.test.d.ts +0 -1
  469. package/dist/test/unit/safe-status.test.js +0 -165
  470. package/dist/test/unit/safe-views.test.d.ts +0 -1
  471. package/dist/test/unit/safe-views.test.js +0 -171
  472. package/dist/test/unit/schema-drift-check.test.d.ts +0 -1
  473. package/dist/test/unit/schema-drift-check.test.js +0 -176
  474. package/dist/test/unit/sensitive-guard.test.d.ts +0 -1
  475. package/dist/test/unit/sensitive-guard.test.js +0 -104
  476. package/dist/test/unit/spec-kit-import.test.d.ts +0 -1
  477. package/dist/test/unit/spec-kit-import.test.js +0 -341
  478. package/dist/test/unit/subgoal-sync.test.d.ts +0 -1
  479. package/dist/test/unit/subgoal-sync.test.js +0 -183
  480. package/dist/test/unit/sync-file.test.d.ts +0 -1
  481. package/dist/test/unit/sync-file.test.js +0 -154
  482. package/dist/test/unit/tool-invocation-guard.test.d.ts +0 -1
  483. package/dist/test/unit/tool-invocation-guard.test.js +0 -432
  484. package/dist/test/unit/tool-usage-stats.test.d.ts +0 -1
  485. package/dist/test/unit/tool-usage-stats.test.js +0 -300
  486. package/dist/test/unit/toolSearch.test.d.ts +0 -1
  487. package/dist/test/unit/toolSearch.test.js +0 -571
  488. package/dist/test/unit/wait-for-task.test.d.ts +0 -1
  489. package/dist/test/unit/wait-for-task.test.js +0 -144
  490. package/dist/test/unit/watcher-status.test.d.ts +0 -1
  491. package/dist/test/unit/watcher-status.test.js +0 -169
  492. package/dist/test/unit/worktree-manager.test.d.ts +0 -1
  493. package/dist/test/unit/worktree-manager.test.js +0 -176
  494. package/dist/tools/applyPatch.js +0 -41
  495. package/dist/tools/cancelTask.d.ts +0 -30
  496. package/dist/tools/cancelTask.js +0 -64
  497. package/dist/tools/finalizeDirectSession.js +0 -84
  498. package/dist/tools/goalSubgoalTask.js +0 -110
  499. package/dist/tools/killTask.d.ts +0 -15
  500. package/dist/tools/listAgents.d.ts +0 -12
  501. package/dist/tools/listAgents.js +0 -42
  502. package/dist/tools/reconcileTasks.js +0 -352
  503. package/dist/tools/retryTask.js +0 -45
  504. package/dist/tools/runVerification.js +0 -36
  505. package/dist/tools/syncFile.js +0 -65
  506. package/docs/control-center/control-center-daily-driver.md +0 -211
  507. package/docs/control-center/control-center-mvp.md +0 -205
  508. package/docs/control-center/control-center-phase2.md +0 -159
  509. package/docs/execution-plan-2026-07-09.md +0 -315
  510. package/docs/release-v0.6.0.md +0 -71
  511. package/docs/release-v0.6.1.md +0 -75
  512. package/docs/release-v0.6.4.md +0 -45
  513. package/docs/roadmap-execution-and-acceptance.md +0 -365
  514. package/src/test/unit/acceptance-engine.test.ts +0 -261
  515. package/src/test/unit/agent-router.test.ts +0 -342
  516. package/src/test/unit/android-doctor.test.ts +0 -158
  517. package/src/test/unit/apply-patch.test.ts +0 -293
  518. package/src/test/unit/audit-checks.test.ts +0 -567
  519. package/src/test/unit/chinese-path.test.ts +0 -106
  520. package/src/test/unit/command-guard.test.ts +0 -221
  521. package/src/test/unit/create-task.test.ts +0 -255
  522. package/src/test/unit/diagnose-task.test.ts +0 -544
  523. package/src/test/unit/direct-guards.test.ts +0 -467
  524. package/src/test/unit/discovery-token-store.test.ts +0 -181
  525. package/src/test/unit/evidence-pack.test.ts +0 -251
  526. package/src/test/unit/get-task-status.test.ts +0 -203
  527. package/src/test/unit/get-task-summary.test.ts +0 -173
  528. package/src/test/unit/goal-graph.test.ts +0 -347
  529. package/src/test/unit/goal-progress.test.ts +0 -538
  530. package/src/test/unit/goal-report.test.ts +0 -189
  531. package/src/test/unit/goal-status.test.ts +0 -270
  532. package/src/test/unit/goal-store.test.ts +0 -318
  533. package/src/test/unit/goal-subgoal-task.test.ts +0 -72
  534. package/src/test/unit/goal-tools-registry.test.ts +0 -245
  535. package/src/test/unit/handoff-export.test.ts +0 -295
  536. package/src/test/unit/invoke-discovered-tool.test.ts +0 -216
  537. package/src/test/unit/logging.test.ts +0 -497
  538. package/src/test/unit/path-guard.test.ts +0 -180
  539. package/src/test/unit/post-task-cleanup.test.ts +0 -53
  540. package/src/test/unit/project-policy-release-mode.test.ts +0 -156
  541. package/src/test/unit/reconcile-tasks.test.ts +0 -551
  542. package/src/test/unit/release-gate.test.ts +0 -314
  543. package/src/test/unit/run-task-loop.test.ts +0 -425
  544. package/src/test/unit/safe-status.test.ts +0 -187
  545. package/src/test/unit/safe-views.test.ts +0 -184
  546. package/src/test/unit/schema-drift-check.test.ts +0 -260
  547. package/src/test/unit/sensitive-guard.test.ts +0 -124
  548. package/src/test/unit/spec-kit-import.test.ts +0 -429
  549. package/src/test/unit/subgoal-sync.test.ts +0 -236
  550. package/src/test/unit/sync-file.test.ts +0 -231
  551. package/src/test/unit/tool-invocation-guard.test.ts +0 -542
  552. package/src/test/unit/tool-usage-stats.test.ts +0 -384
  553. package/src/test/unit/toolSearch.test.ts +0 -756
  554. package/src/test/unit/wait-for-task.test.ts +0 -176
  555. package/src/test/unit/watcher-status.test.ts +0 -190
  556. package/src/test/unit/worktree-manager.test.ts +0 -247
  557. package/src/tools/cancelTask.ts +0 -70
  558. package/src/tools/listAgents.ts +0 -54
  559. package/src/tools/retryTask.ts +0 -53
  560. package/src/tools/syncFile.ts +0 -122
  561. /package/dist/tools/{toolCatalog.d.ts → catalog/toolCatalog.d.ts} +0 -0
  562. /package/dist/tools/{toolSearch.d.ts → catalog/toolSearch.d.ts} +0 -0
  563. /package/dist/tools/{toolSearch.js → catalog/toolSearch.js} +0 -0
  564. /package/dist/tools/{toolUsageStats.d.ts → catalog/toolUsageStats.d.ts} +0 -0
  565. /package/dist/tools/{toolUsageStats.js → catalog/toolUsageStats.js} +0 -0
  566. /package/dist/tools/{createDirectSession.d.ts → direct/createDirectSession.d.ts} +0 -0
  567. /package/dist/tools/{runDirectVerificationBundle.d.ts → direct/runDirectVerificationBundle.d.ts} +0 -0
  568. /package/dist/tools/{getPlan.d.ts → goals/getPlan.d.ts} +0 -0
  569. /package/dist/tools/{savePlan.d.ts → goals/savePlan.d.ts} +0 -0
  570. /package/dist/tools/{evidencePack.d.ts → tasks/evidencePack.d.ts} +0 -0
  571. /package/dist/tools/{getTaskFile.d.ts → tasks/getTaskFile.d.ts} +0 -0
  572. /package/dist/tools/{getTaskProgress.d.ts → tasks/getTaskProgress.d.ts} +0 -0
  573. /package/dist/tools/{getTaskProgress.js → tasks/getTaskProgress.js} +0 -0
  574. /package/dist/tools/{getTaskStdoutTail.d.ts → tasks/getTaskStdoutTail.d.ts} +0 -0
  575. /package/dist/tools/{getTaskSummary.d.ts → tasks/getTaskSummary.d.ts} +0 -0
  576. /package/dist/tools/{killTask.js → tasks/killTask.js} +0 -0
  577. /package/dist/tools/{retryTask.d.ts → tasks/retryTask.d.ts} +0 -0
  578. /package/dist/tools/{runVerification.d.ts → tasks/runVerification.d.ts} +0 -0
  579. /package/dist/tools/{taskLineage.d.ts → tasks/taskLineage.d.ts} +0 -0
  580. /package/dist/tools/{waitForTask.d.ts → tasks/waitForTask.d.ts} +0 -0
  581. /package/dist/tools/{androidDoctor.d.ts → workspace/androidDoctor.d.ts} +0 -0
  582. /package/dist/tools/{discardWorktree.d.ts → workspace/discardWorktree.d.ts} +0 -0
  583. /package/dist/tools/{listWorkspace.d.ts → workspace/listWorkspace.d.ts} +0 -0
  584. /package/dist/tools/{mergeWorktree.d.ts → workspace/mergeWorktree.d.ts} +0 -0
  585. /package/dist/tools/{readWorkspaceFile.d.ts → workspace/readWorkspaceFile.d.ts} +0 -0
  586. /package/dist/tools/{recommendAgentForTask.d.ts → workspace/recommendAgentForTask.d.ts} +0 -0
  587. /package/dist/tools/{searchWorkspace.d.ts → workspace/searchWorkspace.d.ts} +0 -0
  588. /package/src/tools/{toolSearch.ts → catalog/toolSearch.ts} +0 -0
  589. /package/src/tools/{toolUsageStats.ts → catalog/toolUsageStats.ts} +0 -0
  590. /package/src/tools/{getTaskProgress.ts → tasks/getTaskProgress.ts} +0 -0
  591. /package/src/tools/{killTask.ts → tasks/killTask.ts} +0 -0
@@ -1,63 +1,23 @@
1
1
  # PatchWarden Architecture
2
2
 
3
- PatchWarden is designed as a narrow control layer between an MCP client and
4
- local coding agents.
3
+ PatchWarden 是一个本地优先的 MCP(Model Context Protocol)安全桥接器,通过 5 种运行角色(MCP Server / Watcher / Agent / Control Center / Desktop App)协同,为 AI agent 提供任务编排、安全守卫、变更证据收集与审计能力。
5
4
 
6
- ## Roles
5
+ ## 详细文档
7
6
 
8
- ```text
9
- ChatGPT / Codex / OpenCode / another MCP client
10
- |
11
- v
12
- PatchWarden MCP Server
13
- |
14
- save_plan / create_task
15
- |
16
- v
17
- .patchwarden/tasks/<task_id>/
18
- |
19
- Watcher finds task
20
- |
21
- v
22
- Local agent (OpenCode / Codex)
23
- |
24
- v
25
- result.json / diff.patch / verify.json / status.json
26
- |
27
- v
28
- MCP client reads safe summaries and audit evidence
29
- ```
7
+ - [Code Wiki](./CODE_WIKI.md) —— 完整项目架构、模块职责、关键类与函数说明、依赖关系、运行方式、现有缺陷
8
+ - [Threat Model](./threat-model.md) —— 安全威胁模型与防护设计
9
+ - [Control Center](./control-center/README.md) —— Control Center HTTP 管理界面文档
10
+ - [Desktop App](./desktop-app.md) —— Electron 桌面应用文档
11
+ - [Direct Session Workflow](./direct-session-workflow.md) —— Direct 模式会话工作流
12
+ - [Task Safe Review Workflow](./task-safe-review-workflow.md) —— 任务安全审查工作流
30
13
 
31
- ## Core Components
14
+ ## 一致性与资源边界
32
15
 
33
- | Component | Responsibility |
34
- | --- | --- |
35
- | MCP server | Exposes constrained planning, task, summary, audit, and status tools. |
36
- | Watcher | Polls queued tasks and starts preconfigured local agents. |
37
- | Agent registry | Defines trusted agent commands and argument templates. |
38
- | Command guard | Allows only exact verification commands from trusted configuration. |
39
- | Path guard | Keeps task paths under `workspaceRoot` and reports out-of-scope changes. |
40
- | Sensitive path guard | Blocks known credential and private-data file names. |
41
- | Evidence writer | Records status, result, verification, changed files, and audit artifacts. |
42
- | Control Center | Provides safe-first local review pages for tasks, direct sessions, lineage, warnings, and evidence packs. |
16
+ - `.patchwarden/` 只是证据存储位置,不是敏感路径豁免区;敏感文件名在任意目录深度都阻断。
17
+ - Goal 状态变更由跨进程 mutation lock 串行化并原子落盘;非空 Goal 的子目标全部 accepted 后自动转为 `completed`。
18
+ - 子目标任务以 Goal 保存的 `repo_path` 为权威并拒绝 mismatch;worktree create/merge/discard 共享该仓库的 lifecycle lock。
19
+ - task diff/summary/log tail 采用有界读取,`audit_task` 对文档数量和总字节设置预算,持续 invocation/reconcile 日志采用锁内有界追加并明确标记截断。
43
20
 
44
- ## Data Flow
21
+ ## 历史版本
45
22
 
46
- 1. A client saves a plan or creates a task with an explicit `repo_path`.
47
- 2. PatchWarden validates the repository path and requested verification
48
- commands.
49
- 3. The task is written under `.patchwarden/tasks/<task_id>/`.
50
- 4. The Watcher starts the selected registered agent.
51
- 5. PatchWarden captures task status, changed files, Git diff evidence where
52
- available, verification output, and audit summaries.
53
- 6. The client reviews safe summaries first and asks for deeper artifacts only
54
- when needed.
55
-
56
- ## Safety Design
57
-
58
- PatchWarden treats model instructions as untrusted input. The local maintainer
59
- controls the workspace root, allowed commands, registered agents, and release
60
- process. The project intentionally keeps push, publish, tag, GitHub Release,
61
- and live service changes outside ordinary task execution.
62
-
63
- For the security model, see `docs/threat-model.md`.
23
+ 历史架构文档与阶段性设计已归档至 [archive/](./archive/)。
@@ -15,13 +15,13 @@ PatchWarden has three control layers:
15
15
  From the repository root:
16
16
 
17
17
  ```powershell
18
- .\PatchWarden-Desktop.cmd
19
- .\PatchWarden-Control.cmd
20
- .\PatchWarden-Control-Tray.cmd --foreground
18
+ .\scripts\launchers\PatchWarden-Desktop.cmd
19
+ .\scripts\launchers\PatchWarden-Control.cmd
20
+ .\scripts\launchers\PatchWarden-Control-Tray.cmd --foreground
21
21
  .\PatchWarden.cmd status all
22
22
  ```
23
23
 
24
- Use `PatchWarden-Control.cmd` for normal desktop use. Use the tray when you only
24
+ Use `scripts\launchers\PatchWarden-Control.cmd` for normal desktop use. Use the tray when you only
25
25
  need quick controls. Use `PatchWarden.cmd` when you need explicit CLI output or
26
26
  automation-friendly commands.
27
27
 
@@ -1,12 +1,12 @@
1
1
  # Dashboard 概览
2
2
 
3
3
  > 本文基于 v1.5.1 源码编写;安装时请使用已验证发布的 <published-version>。
4
- > 入口:`PatchWarden-Control.cmd` 或托盘菜单中的 "Open Control Center"。
4
+ > 入口:`scripts\launchers\PatchWarden-Control.cmd` 或托盘菜单中的 "Open Control Center"。
5
5
 
6
6
  ## 目的
7
7
 
8
8
  PatchWarden Dashboard(Control Center)把本地 Agent 工作流从“只能看的状态面板”
9
- 升级为“可操作的工作流控制中心”。所有操作默认走 safe 摘要接口,完整日志、diff、
9
+ 升级为“可操作的工作流控制中心”。所有操作默认走 safe 摘要接口,有界日志、diff、
10
10
  test log 仅在折叠的“高级区”按需加载,不改变 PatchWarden 的安全边界。
11
11
 
12
12
  ## 核心概念
@@ -28,7 +28,7 @@ test log 仅在折叠的“高级区”按需加载,不改变 PatchWarden 的
28
28
  | --- | --- |
29
29
  | Dashboard | Repo selector、Health Score、服务状态、Release 卡片、Project Policy、Lineage、Evidence Pack、Stale 任务提示、最近任务列表、系统状态(含 Copy diagnostics) |
30
30
  | Tasks | 任务列表,支持按 repo_path / status / acceptance_status / warning_type / agent / date range 过滤 |
31
- | Task Detail | safe 摘要默认视图 + 折叠的高级区(完整 result / diff / test_log) |
31
+ | Task Detail | safe 摘要默认视图 + 折叠的高级区(配置上限内的 result / diff / test_log) |
32
32
  | Direct Sessions | 按 active / finalized / audited / expired 分组的 Direct 会话 |
33
33
  | Audit / Warnings | 按 warning 类型聚合的诊断页 |
34
34
  | Workspace | workspace 一级目录与项目列表 |
@@ -72,7 +72,7 @@ release_mode 摘要。
72
72
  ## 安全边界
73
73
 
74
74
  - 所有 safe 接口返回有界摘要,不包含完整日志、stdout/stderr tail、diff、密钥内容。
75
- - 完整 result / diff / test_log 只在折叠的高级区按需加载,永不自动加载。
75
+ - 有界 result / diff / test_log 只在折叠的高级区按需加载,永不自动加载。
76
76
  - Project Policy 卡片只读,不能从 UI 修改策略。
77
77
  - 不执行远程写操作(npm publish / git push / git tag / gh release)。
78
78
  - Diagnostics 输出经过 `redactSensitiveContent` 脱敏。
@@ -0,0 +1,175 @@
1
+ # PatchWarden Windows Desktop
2
+
3
+ PatchWarden Desktop is the installable Windows shell for the existing local
4
+ Control Center. It does not add a remote shell or replace the MCP server. The
5
+ desktop process starts the same loopback-only Control Center, displays it in an
6
+ isolated Electron window, and keeps quick controls in the system tray.
7
+
8
+ ## Install
9
+
10
+ 1. Download `PatchWarden-Setup-<version>-x64.exe` (installed) or
11
+ `PatchWarden-Portable-<version>-x64.zip` (no install), plus
12
+ `PatchWarden-Desktop-SHA256SUMS.txt` from the matching GitHub Release.
13
+ 2. Verify the SHA256 value before running the installer.
14
+ 3. Install for the current Windows user. Administrator access is not required.
15
+ 4. Select a dedicated workspace, review detected local CLIs and models, and let
16
+ the read-only doctor finish.
17
+
18
+ ## First-run routes
19
+
20
+ The first screen asks whether PatchWarden will be used through **ChatGPT
21
+ Tunnel** or **Local MCP**. Local MCP can skip Platform Tunnel configuration.
22
+ For ChatGPT, use the same eight steps shown in both READMEs:
23
+
24
+ 1. Confirm Platform Tunnel access and enable developer mode for the target ChatGPT workspace.
25
+ 2. Create a Tunnel in [Platform Tunnel settings](https://platform.openai.com/settings/organization/tunnels) and associate that workspace.
26
+ 3. Detect or choose an existing `tunnel-client.exe` in Desktop Settings.
27
+ 4. Enter the Core Tunnel ID and dedicated Tunnel runtime API key used as `CONTROL_PLANE_API_KEY`. It is not an application `OPENAI_API_KEY`.
28
+ 5. Configure and test the environment, direct, or credential-free HTTP/HTTPS/SOCKS5 (Mixed) proxy.
29
+ 6. Configure the Core profile, run `tunnel-client doctor --explain --json`, and start Core. The runtime key travels from the isolated renderer to the main process over bounded IPC, then to a one-time PowerShell process over stdin. It is DPAPI-encrypted only after doctor succeeds and is never placed in repository config, HTTP APIs, command arguments, logs, or returned objects.
30
+ 7. Confirm Tunnel ready, Watcher healthy, and the fixed 26-tool `chatgpt_core` catalog on Getting Started.
31
+ 8. In ChatGPT **Settings → Plugins**, create a developer-mode app, choose the Tunnel, reconnect, open a new chat, and call `health_check`.
32
+
33
+ The current term is **developer-mode app / Plugins**; older releases called it
34
+ a Connector. Direct remains optional and must be enabled explicitly. Start All
35
+ starts Core and reports Direct as skipped while Direct is disabled; Stop All
36
+ still covers both profiles.
37
+
38
+ The setup flow searches `PATH`, current-user application directories, and a
39
+ bounded area next to the selected workspace for `tunnel-client.exe`. If it is
40
+ not found, continue into the read-only console and open **Settings > MCP and
41
+ tunnel**. Use **Detect** or the dedicated file picker; it accepts only an
42
+ existing file named `tunnel-client.exe`. PatchWarden never downloads or runs
43
+ new software automatically. Download the Windows x64 build only from the
44
+ trusted release source named by your tunnel provider and compare its SHA256
45
+ with that release before selecting it.
46
+
47
+ Prerequisites are Windows x64, Node.js 18 or newer, and the configured
48
+ tunnel-client used by the existing Core/Direct launcher chain. Electron runs
49
+ the desktop window and Control Center child, but does not replace those runtime
50
+ requirements.
51
+
52
+ The first unsigned desktop release may show Windows SmartScreen. Verify the
53
+ checksum and GitHub Release source before choosing to continue. No updater or
54
+ login startup entry is installed in v1.
55
+
56
+ ## Local agents and models
57
+
58
+ Desktop supports Codex, OpenCode, Claude Code, Gemini CLI, GitHub Copilot CLI,
59
+ Qwen Code, Kimi Code, and Aider. Settings detects only verified native
60
+ executables or known npm package entry points and never launches Windows shell
61
+ shims through a command shell.
62
+
63
+ Model discovery reads only allowlisted model fields from each agent's normal
64
+ JSON/JSONC, TOML, or YAML settings. It does not read `.env`, API keys, browser
65
+ state, provider secrets, or session history. Online model listing is never run
66
+ automatically; the user must select the refresh control for an agent that
67
+ supports a bounded model-list command. Choosing **Follow agent default** omits
68
+ the model argument so the agent retains its own precedence rules.
69
+
70
+ ## Local state
71
+
72
+ - Desktop config: `%LOCALAPPDATA%\PatchWarden\patchwarden.config.json`
73
+ - Desktop preferences: `%LOCALAPPDATA%\PatchWarden\desktop-preferences.json`
74
+ - Desktop startup log: `%LOCALAPPDATA%\PatchWarden\desktop.log`
75
+ - Control Center logs: `%LOCALAPPDATA%\patchwarden\control-center`
76
+ - Tasks and evidence remain below the selected workspace.
77
+
78
+ If `PATCHWARDEN_CONFIG` points to a valid config, the desktop app uses that path
79
+ instead of creating the LocalAppData config. Config changes are written
80
+ atomically and the previous file is retained as a timestamped `.bak-*` copy.
81
+ Uninstalling the app does not remove config, tasks, evidence, or workspace data.
82
+
83
+ ## Runtime behavior
84
+
85
+ - The app binds only to `127.0.0.1:8090` and reuses an existing verified
86
+ PatchWarden Control Center on that address.
87
+ - A foreign listener on port 8090 is reported; the app never kills it or takes
88
+ the port.
89
+ - Closing the window hides it to the tray by default. `Exit desktop app` stops
90
+ only the Control Center child owned by that app process.
91
+ - Desktop-owned utility and PowerShell children receive a minimal runtime and
92
+ proxy environment. Provider variables require an explicit Agent allow-list,
93
+ while Control/Tunnel owner credentials are always removed. Windows
94
+ PowerShell and `where.exe` are resolved from the system directory rather than
95
+ the selected workspace or its current directory.
96
+ - Backend restarts are serialized. A restart waits for the exact owned child to
97
+ emit `exit` (or reach a bounded timeout), and a configuration change received
98
+ during an active restart schedules one further restart instead of racing it.
99
+ - `Stop all and exit` explicitly requests the existing bounded stop action for
100
+ Core/Direct before closing.
101
+ - Start/restart succeeds only after the selected tunnel health endpoint is
102
+ ready and the Core watcher heartbeat is healthy. Early supervisor exits and
103
+ timeouts are reported with a reason and next steps.
104
+ - Background start uses `run-background-supervisor.ps1` so the lifecycle API
105
+ returns without holding the long-running supervisor's output handles. The
106
+ wrapper writes bounded `supervisor.stdout.log` and `supervisor.stderr.log`
107
+ files while `supervisor-status.json` records only PID, state, timestamps, and
108
+ log paths.
109
+ - The legacy CMD, PowerShell tray, and browser Dashboard remain supported.
110
+
111
+ ## MCP and proxy settings
112
+
113
+ The desktop settings page can enable the Direct profile and configure tunnel
114
+ proxy behavior. Direct remains disabled until the user explicitly enables it.
115
+
116
+ - **Use environment proxy** inherits `HTTPS_PROXY` when it is present.
117
+ - **No proxy** removes proxy variables for the launcher-owned tunnel process.
118
+ - **Manual proxy** accepts only `http`, `https`, or `socks5` URLs without an
119
+ embedded username or password.
120
+
121
+ Core and Direct can share one proxy definition or use separate definitions.
122
+ PatchWarden does not store proxy credentials in URLs or logs.
123
+
124
+ ## Build from source
125
+
126
+ Run from the repository in Windows PowerShell:
127
+
128
+ ```powershell
129
+ npm.cmd ci
130
+ npm.cmd run build
131
+ npm.cmd install --prefix desktop --cache .\.npm-cache
132
+ npm.cmd run desktop:test
133
+ npm.cmd run desktop:preflight
134
+ npm.cmd run desktop:package
135
+ ```
136
+
137
+ Artifacts are written below `release\desktop`. Desktop dependencies remain in
138
+ the private `desktop` package and are not included in the `patchwarden` npm
139
+ package.
140
+
141
+ Desktop staging must include `scripts/checks/mcp-manifest-check.js` and the
142
+ root package-lock production dependency closure below `resources/core/node_modules`.
143
+ Validate the unpacked runtime from a directory outside the repository so it
144
+ cannot accidentally resolve dependencies from the developer checkout.
145
+
146
+ `npm.cmd run desktop:preflight` automates that isolated validation and writes a
147
+ privacy-bounded receipt in a unique `release/desktop-preflight-*` directory.
148
+ The receipt records the branch, commit, dirty-state hashes, toolchain versions,
149
+ check durations, package file count, runtime manifest digest, unpacked
150
+ executable digest, and UI smoke result. It stores no diff content, credentials,
151
+ configuration values, or browser state. The smoke process uses temporary
152
+ `LOCALAPPDATA` / `APPDATA`, a nonexistent isolated config, and launcher-owned
153
+ processes only.
154
+
155
+ Viewport DOM metrics, page readiness, and the single-instance result are hard
156
+ smoke gates. Electron screenshots are best-effort evidence because Windows
157
+ graphics capture can be unavailable in CI sessions; capture failures are
158
+ counted in the receipt without crashing Desktop. Local visual acceptance can
159
+ pass `--require-screenshots` to `desktop/scripts/smoke-unpacked.mjs`, or use
160
+ `--no-capture` while an external UI automation tool owns Windows Graphics
161
+ Capture.
162
+
163
+ For a release candidate, run `npm.cmd run desktop:preflight:release`. It rejects
164
+ dirty worktrees. The regular preflight remains available for validating an
165
+ intentional local working-tree baseline before it is committed.
166
+
167
+ ## Release checklist
168
+
169
+ 1. From a clean checkout, run `npm.cmd run desktop:preflight:release`, then the
170
+ full core validation chain and `npm.cmd run desktop:package`.
171
+ 2. Install and uninstall on a clean Windows x64 environment without elevation.
172
+ 3. Verify first-run setup, tray behavior, restart, explicit exit, and retained
173
+ user data after uninstall.
174
+ 4. Compare the installer SHA256 with the generated checksum file.
175
+ 5. Publish GitHub assets manually. npm publication remains a separate action.
@@ -155,13 +155,13 @@ lineage 的有界摘要,不含完整 rounds 详情或 warnings/errors 原文
155
155
 
156
156
  ```json
157
157
  {
158
- "patchwarden_version": "1.5.1",
159
- "package_version": "1.5.1",
158
+ "patchwarden_version": "1.6.1",
159
+ "package_version": "1.6.1",
160
160
  "commit": "bc950a2",
161
161
  "node_version": "v20.11.0",
162
162
  "os": { "platform": "win32", "arch": "x64" },
163
163
  "tool_profile": "full",
164
- "schema_epoch": "2026-07-05-v13",
164
+ "schema_epoch": "2026-07-19-v15",
165
165
  "generated_at": "2026-07-09T12:00:00.000Z"
166
166
  }
167
167
  ```
@@ -56,19 +56,24 @@ evidence packs.
56
56
 
57
57
  ## Current Public Evidence
58
58
 
59
- Snapshot checked on 2026-07-12:
59
+ Remote snapshot checked on 2026-07-23:
60
60
 
61
61
  - GitHub repository: `jiezeng2004-design/PatchWarden`
62
62
  - Stars: 2
63
63
  - Forks: 0
64
- - Open issues: 9 (`#25`, `#26`, `#28`–`#34`)
65
- - Open pull requests: 2 (`#24`, `#37`, both draft)
66
- - GitHub latest release: `v1.5.0`
67
- - npm latest dist-tag: `patchwarden@1.5.0`
68
- - Local source version in `package.json`: `1.5.1`
64
+ - Open issues: 5
65
+ - Open pull requests: 1
66
+ - GitHub latest release: `v1.6.1`, published on 2026-07-23
67
+ - npm latest dist-tag: `patchwarden@1.6.1`
69
68
 
70
- The source version is ahead of the latest public Release/npm package. Treat
71
- `1.5.1` as pending release work until GitHub Release and npm are verified.
69
+ Local workspace facts, kept separate from the public snapshot:
70
+
71
+ - Local source version in `package.json`: `1.6.1`
72
+ - Verified release commit: `2ab2b7405d89b12c4ef10febf56404de59c04053`
73
+
74
+ The local source, GitHub Release, and npm `latest` are synchronized at `v1.6.1`.
75
+ The GitHub Release contains reviewed Core and Windows Desktop assets plus
76
+ SHA-256 manifests.
72
77
 
73
78
  ## Existing Project Evidence
74
79
 
@@ -76,7 +81,7 @@ Repository-facing evidence already present:
76
81
 
77
82
  - `README.md` and `README.en.md` explain the MCP bridge model, safety boundary,
78
83
  setup, ChatGPT/Codex/OpenCode usage, and local data handling.
79
- - `CHANGELOG.md` records ongoing releases from the 1.0 line through 1.5.x.
84
+ - `CHANGELOG.md` records ongoing releases from the 1.0 line through 1.6.1.
80
85
  - `SECURITY.md` directs vulnerability reports to GitHub private security
81
86
  advisories.
82
87
  - `CONTRIBUTING.md` documents local verification and safety expectations.
@@ -112,8 +117,8 @@ Known gaps before submission:
112
117
  - collect 3 to 5 real user reports through GitHub issues or discussions
113
118
  - record a live screencast if stronger evidence is needed; a privacy-safe
114
119
  scripted GIF now exists for the public maintainer workflow
115
- - finish the `1.5.1` release only after PR/CI, GitHub Release, npm, and
116
- `dist-tags.latest` are all verified
120
+ - keep future source, GitHub Release, and npm publication facts synchronized
121
+ through the reviewed release workflow
117
122
  - add small contributor-friendly roadmap issues such as macOS docs, Codex CLI
118
123
  examples, and a minimal demo repository
119
124
 
@@ -3,7 +3,7 @@
3
3
  PatchWarden releases remain confirmation-gated. Creating a tag or GitHub Release does not publish npm automatically.
4
4
 
5
5
  1. Work on a release branch and update `package.json`, changelog/release notes, README, examples, and tool manifests together.
6
- 2. Run the complete local quality gates from `AGENTS.md`.
6
+ 2. Run the complete local quality gates from `AGENTS.md`. For Desktop, run `npm.cmd run desktop:preflight:release` from a clean checkout before creating the installer.
7
7
  3. Open a pull request, wait for `CI gate`, review the diff and package contents, then merge.
8
8
  4. Create the version tag from the verified merge commit.
9
9
  5. Create the GitHub Release and attach only reviewed release artifacts and checksums.
@@ -5,25 +5,24 @@ before submitting external applications or publishing a release.
5
5
 
6
6
  ## Current Snapshot
7
7
 
8
- Checked on 2026-07-12 from the PatchWarden workspace.
8
+ Remote facts checked on 2026-07-23 after the v1.6.1 release completed.
9
9
 
10
10
  | Surface | Current evidence |
11
11
  | --- | --- |
12
- | Local branch | `codex/evidence-pack-v2` |
13
- | Local `package.json` | `patchwarden@1.5.1` |
14
- | GitHub latest release | `v1.5.0` |
15
- | GitHub release URL | https://github.com/jiezeng2004-design/PatchWarden/releases/tag/v1.5.0 |
16
- | GitHub release published at | 2026-07-07T11:36:48Z |
17
- | npm latest | `patchwarden@1.5.0` |
18
- | npm `dist-tags.latest` | `1.5.0` |
12
+ | Verified merge commit | `2ab2b7405d89b12c4ef10febf56404de59c04053` |
13
+ | Local `package.json` | `patchwarden@1.6.1` |
14
+ | GitHub latest release | `v1.6.1` |
15
+ | GitHub release URL | https://github.com/jiezeng2004-design/PatchWarden/releases/tag/v1.6.1 |
16
+ | GitHub release published on | 2026-07-23 |
17
+ | npm latest | `patchwarden@1.6.1` |
18
+ | npm `dist-tags.latest` | `1.6.1` |
19
19
  | GitHub stars | 2 |
20
20
  | GitHub forks | 0 |
21
- | Open issues | 9 (`#25`, `#26`, `#28`–`#34`) |
22
- | Open pull requests | 2 (`#24`, `#37`, both draft) |
21
+ | Open issues | 5 |
22
+ | Open pull requests | 1 |
23
23
 
24
- Conclusion: `1.5.0` is the latest verified public release. The local `1.5.1`
25
- source state is ahead of the public release and should be treated as pending
26
- until PR, CI, GitHub Release, npm, and `dist-tags.latest` are all verified.
24
+ Conclusion: source, Git tag, GitHub Release, npm package version, and
25
+ `dist-tags.latest` are independently verified at `v1.6.1`.
27
26
 
28
27
  ## Commands Used
29
28
 
@@ -31,42 +30,39 @@ Windows PowerShell:
31
30
 
32
31
  ```powershell
33
32
  gh repo view jiezeng2004-design/PatchWarden --json nameWithOwner,stargazerCount,forkCount,issues,pullRequests,defaultBranchRef,pushedAt,url,description,licenseInfo,repositoryTopics,latestRelease,hasDiscussionsEnabled,hasIssuesEnabled,securityPolicyUrl
34
- gh release view v1.5.1 --repo jiezeng2004-design/PatchWarden --json tagName,name,publishedAt,isDraft,isPrerelease,url
33
+ gh release view v1.6.1 --repo jiezeng2004-design/PatchWarden --json tagName,name,publishedAt,isDraft,isPrerelease,url
35
34
  gh release view --repo jiezeng2004-design/PatchWarden --json tagName,name,publishedAt,isDraft,isPrerelease,url
36
35
  npm.cmd view patchwarden version dist-tags --json --cache .\.npm-cache
37
36
  ```
38
37
 
39
- The npm query succeeded on 2026-07-12 with the repository-local `.npm-cache`:
40
- `version=1.5.0`, `dist-tags.latest=1.5.0`.
38
+ The npm query was verified on 2026-07-23: `version=1.6.1` and
39
+ `dist-tags.latest=1.6.1`.
41
40
 
42
- ## Local Verification Snapshot
41
+ ## v1.6.1 Verification Snapshot
43
42
 
44
- - `npm.cmd run build`: passed.
45
- - `npm.cmd run test:unit`: 716 tests, 714 passed, 2 skipped, 0 failed.
46
- - `npm.cmd run doctor:ci`: 83 OK, 0 warnings, 0 failures.
47
- - `npm.cmd run verify:package`: passed; 584 package files, no private local launchers.
48
- - `npm.cmd test`: passed in 284.5 seconds in an approved Windows child-process
49
- environment. This includes 139 security smoke checks, 716 unit tests (714
50
- passed, 2 skipped), 22 lifecycle checks, doctor, tunnel/watcher supervisors,
51
- Windows control, MCP manifest, brand, and 32 Control Center checks.
52
- - `npm.cmd run test:mcp`: passed.
53
- - `npm.cmd run test:http-mcp`: 13 passed, 0 failed, including owner-token checks.
54
- - `npm.cmd run pack:clean` was not run here because it removes and recreates
55
- release artifacts; run it only in an explicitly approved release-preparation
56
- workspace.
43
+ - GitHub CI: Node.js 18, Ubuntu Node.js 20, Windows Node.js 20, secret scan,
44
+ Windows Desktop installer, and final CI gate passed.
45
+ - Core security smoke: 141/141; unit tests: 855 passed and 3 skipped;
46
+ lifecycle: 22/22; HTTP MCP: 17/17; MCP smoke and Doctor passed.
47
+ - Desktop tests: 54/54; clean-source Desktop preflight and packaged UI smoke
48
+ passed from the verified merge commit.
49
+ - Root and Desktop dependency audits: 0 known vulnerabilities.
50
+ - Clean release directory: 532 files; npm package manifest: 531 files.
51
+ - GitHub Release: six reviewed assets with GitHub-computed and local SHA-256
52
+ digests; installer signature status is explicitly documented as unsigned.
57
53
 
58
54
  ## Release Verification Checklist
59
55
 
60
- - [ ] Confirm the target version in `package.json`.
61
- - [ ] Confirm `src/version.ts`, package metadata, README version text, and
56
+ - [x] Confirm the target version in `package.json`.
57
+ - [x] Confirm `src/version.ts`, package metadata, README version text, and
62
58
  changelog agree.
63
- - [ ] Run the complete local gate chain from `AGENTS.md`.
64
- - [ ] Open a PR and wait for the GitHub CI gate.
65
- - [ ] Merge only after review.
66
- - [ ] Create the tag from the verified merge commit.
67
- - [ ] Create the GitHub Release with reviewed artifacts and checksums.
68
- - [ ] Publish `patchwarden` to npm using process-scoped authentication.
69
- - [ ] Verify the remote tag, GitHub Release, npm package version, and
59
+ - [x] Run the complete local gate chain from `AGENTS.md`.
60
+ - [x] Open a PR and wait for the GitHub CI gate.
61
+ - [x] Merge only after review.
62
+ - [x] Create the tag from the verified merge commit.
63
+ - [x] Create the GitHub Release with reviewed artifacts and checksums.
64
+ - [x] Publish `patchwarden` to npm using process-scoped authentication.
65
+ - [x] Verify the remote tag, GitHub Release, npm package version, and
70
66
  `dist-tags.latest`.
71
67
 
72
68
  Do not publish new versions under the frozen pre-rename package name.
@@ -18,7 +18,7 @@
18
18
  - **safe_audit**:审计摘要,包含 artifact 完整性、scope_changes、命令白名单合规性
19
19
  的有界摘要。
20
20
  - **acceptance_status**:任务的验收状态,比 `status` 更能反映“是否真的通过”。
21
- - **Advanced 区**:折叠区域,包含完整 result / diff / test_log,需手动展开。
21
+ - **Advanced 区**:折叠区域,包含配置上限内的 result / diff / test_log,需手动展开。
22
22
 
23
23
  ## 验收工作流
24
24
 
@@ -54,11 +54,11 @@ Task Detail 默认展示 safe 摘要视图:
54
54
  ### 4. 仅在必要时展开高级区
55
55
 
56
56
  只有当 safe 摘要无法定论时(例如 `manual_verification_required` 为 true,
57
- 或 `fail_checks` 指向某个具体失败),才展开高级区查看完整产物:
57
+ 或 `fail_checks` 指向某个具体失败),才展开高级区查看配置上限内的产物:
58
58
 
59
- - 完整 result(JSON)
60
- - 完整 diff
61
- - 完整 test_log
59
+ - 有界并脱敏的 result(JSON)
60
+ - 有界并脱敏的 diff
61
+ - 有界并脱敏的 test_log
62
62
 
63
63
  > 高级区内容不会自动加载,必须手动点击展开。展开不会触发任何写操作。
64
64
 
@@ -41,6 +41,11 @@ local confirmation tickets.
41
41
  | Prompt injection | Repository text instructs the model to ignore safety constraints. | Safety is enforced by local code and configuration, not by prompt instructions alone. |
42
42
  | Unsafe release claims | A local build passes and the agent claims npm/GitHub publish is complete. | Release docs require separate verification of PR/CI, GitHub Release, npm version, and `dist-tags.latest`. |
43
43
  | Evidence overload | A client requests full logs, diffs, or private task history by default. | Safe summary tools and bounded evidence packs are the preferred review surfaces. |
44
+ | Evidence secret persistence | An agent writes a token into a normal source file and the Git diff duplicates it under `.patchwarden`. | Diff evidence is capped at 20 MiB, redacted before persistence, and credential-like content produces a policy violation. |
45
+ | Artifact-directory confusion | A secret-shaped filename is placed under `.patchwarden` and assumed safe because it is an internal artifact. | The sensitive-name guard applies at every depth; `.patchwarden` has no blanket exemption. |
46
+ | Concurrent Goal/worktree mutation | Two MCP processes accept subgoals or create/merge/discard worktrees at the same time and lose state or corrupt repository lifecycle. | Goal mutations share a cross-process lock and atomic replacement; worktree repository mutations share a lifecycle lock. |
47
+ | Evidence resource exhaustion | Oversized task logs or a large documentation tree consume unbounded memory, response size, or disk. | Task and Control reads use bounded prefix/tail reads, audit scans enforce file/byte budgets, and persistent invocation/reconcile logs use locked bounded append with explicit truncation. |
48
+ | DNS rebinding | A hostile web origin resolves to `127.0.0.1` and tries to read the Control token or call HTTP MCP. | Control Center and HTTP MCP reject Host headers other than the configured `127.0.0.1`/`localhost` origin. |
44
49
  | Live-service disruption | A task restarts tunnels, watchers, or unrelated processes. | Project rules forbid blanket process kills; live cutover must be explicit and separately approved. |
45
50
 
46
51
  ## Security Invariants
@@ -50,10 +55,23 @@ PatchWarden changes should preserve these invariants:
50
55
  - no general-purpose remote shell
51
56
  - all task repositories stay under `workspaceRoot`
52
57
  - agents are explicitly registered before use
58
+ - child processes receive a minimal environment; provider variables require an
59
+ explicit per-agent `envAllowlist`, and Tunnel owner credentials are never
60
+ forwarded
53
61
  - model input cannot define arbitrary agent launch commands
54
62
  - verification commands use exact allowlist matching
55
- - sensitive paths remain blocked
63
+ - sensitive paths remain blocked at every directory depth, including under
64
+ `.patchwarden`
56
65
  - task artifacts remain auditable and redacted where appropriate
66
+ - Goal status mutations and worktree repository lifecycle changes are
67
+ cross-process serialized; a non-empty Goal becomes completed only after all
68
+ subgoals are accepted
69
+ - subgoal tasks use the Goal's stored `repo_path` as authority and reject a
70
+ caller-supplied repository mismatch
71
+ - task/audit/log read and append paths enforce explicit byte, line, or file
72
+ budgets and report truncation
73
+ - Direct patch/sync accepts only bounded UTF-8 text, rejects credential-like
74
+ results, and serializes session mutations
57
75
  - scope violations are surfaced, not silently accepted
58
76
  - publish, push, tag, release, and live-service operations remain
59
77
  confirmation-gated
@@ -6,11 +6,13 @@
6
6
  "agents": {
7
7
  "codex": {
8
8
  "command": "codex",
9
- "args": ["exec", "--cd", "{repo}", "{prompt}"]
9
+ "args": ["exec", "--cd", "{repo}", "{prompt}"],
10
+ "envAllowlist": []
10
11
  },
11
12
  "opencode": {
12
13
  "command": "opencode",
13
- "args": ["run", "{prompt}"]
14
+ "args": ["run", "{prompt}"],
15
+ "envAllowlist": []
14
16
  }
15
17
  },
16
18
  "allowedTestCommands": [