patchwarden 1.5.1 → 1.6.1

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 (573) hide show
  1. package/PatchWarden.cmd +32 -2
  2. package/README.en.md +152 -25
  3. package/README.md +120 -23
  4. package/dist/assessments/agentAssessor.js +21 -12
  5. package/dist/assessments/assessmentStore.js +42 -34
  6. package/dist/config.d.ts +15 -0
  7. package/dist/config.js +66 -13
  8. package/dist/control/fileManager.d.ts +2 -0
  9. package/dist/control/fileManager.js +39 -0
  10. package/dist/control/middleware/auth.d.ts +6 -0
  11. package/dist/control/middleware/auth.js +14 -5
  12. package/dist/control/middleware/static.js +16 -3
  13. package/dist/control/routeTable.d.ts +24 -0
  14. package/dist/control/routeTable.js +263 -0
  15. package/dist/control/routes/audit.js +17 -7
  16. package/dist/control/routes/evidence.js +1 -1
  17. package/dist/control/routes/lineage.js +1 -1
  18. package/dist/control/routes/process.d.ts +7 -0
  19. package/dist/control/routes/process.js +329 -42
  20. package/dist/control/routes/sessions.d.ts +9 -1
  21. package/dist/control/routes/sessions.js +84 -21
  22. package/dist/control/routes/status.d.ts +46 -1
  23. package/dist/control/routes/status.js +72 -15
  24. package/dist/control/routes/taskActions.js +24 -60
  25. package/dist/control/routes/tasks.d.ts +4 -0
  26. package/dist/control/routes/tasks.js +61 -62
  27. package/dist/control/routes/workspace.js +50 -23
  28. package/dist/control/runtime.d.ts +3 -2
  29. package/dist/control/runtime.js +63 -30
  30. package/dist/control/server.js +36 -365
  31. package/dist/control/shared.d.ts +25 -1
  32. package/dist/control/shared.js +64 -11
  33. package/dist/direct/directAudit.js +234 -225
  34. package/dist/direct/directGuards.d.ts +2 -1
  35. package/dist/direct/directGuards.js +42 -29
  36. package/dist/direct/directPatch.d.ts +6 -1
  37. package/dist/direct/directPatch.js +55 -8
  38. package/dist/direct/directSessionStore.d.ts +16 -6
  39. package/dist/direct/directSessionStore.js +127 -35
  40. package/dist/direct/directVerification.js +8 -16
  41. package/dist/doctor.js +62 -52
  42. package/dist/goal/acceptanceEngine.d.ts +1 -1
  43. package/dist/goal/goalProgress.js +75 -69
  44. package/dist/goal/goalReport.js +5 -12
  45. package/dist/goal/goalStatus.d.ts +2 -0
  46. package/dist/goal/goalStatus.js +10 -3
  47. package/dist/goal/goalStore.d.ts +9 -2
  48. package/dist/goal/goalStore.js +152 -45
  49. package/dist/goal/handoffExport.js +6 -6
  50. package/dist/goal/specKitImport.js +97 -96
  51. package/dist/goal/subgoalSync.js +11 -9
  52. package/dist/goal/worktreeManager.d.ts +2 -0
  53. package/dist/goal/worktreeManager.js +209 -136
  54. package/dist/httpServer.js +111 -32
  55. package/dist/logging.js +5 -3
  56. package/dist/policy/projectPolicy.js +5 -2
  57. package/dist/release/releaseGate.d.ts +1 -1
  58. package/dist/release/releaseGate.js +78 -25
  59. package/dist/runner/agentInvocation.d.ts +14 -0
  60. package/dist/runner/agentInvocation.js +96 -4
  61. package/dist/runner/changeCapture.d.ts +13 -5
  62. package/dist/runner/changeCapture.js +243 -61
  63. package/dist/runner/postTaskCleanup.js +48 -19
  64. package/dist/runner/processSecurity.d.ts +56 -0
  65. package/dist/runner/processSecurity.js +373 -0
  66. package/dist/runner/runTask.d.ts +1 -1
  67. package/dist/runner/runTask.js +115 -87
  68. package/dist/runner/simpleProcess.d.ts +3 -0
  69. package/dist/runner/simpleProcess.js +50 -36
  70. package/dist/{taskProgress.d.ts → runner/taskProgress.d.ts} +1 -1
  71. package/dist/{taskProgress.js → runner/taskProgress.js} +2 -2
  72. package/dist/{taskRuntime.d.ts → runner/taskRuntime.d.ts} +1 -1
  73. package/dist/{taskRuntime.js → runner/taskRuntime.js} +3 -2
  74. package/dist/runner/taskStatusStore.d.ts +11 -0
  75. package/dist/runner/taskStatusStore.js +24 -0
  76. package/dist/runner/watch.d.ts +14 -1
  77. package/dist/runner/watch.js +256 -48
  78. package/dist/security/contentRedaction.js +2 -2
  79. package/dist/security/discoveryTokenStore.d.ts +3 -2
  80. package/dist/security/discoveryTokenStore.js +17 -2
  81. package/dist/security/loopbackHost.d.ts +2 -0
  82. package/dist/security/loopbackHost.js +16 -0
  83. package/dist/security/pathGuard.js +32 -17
  84. package/dist/security/planGuard.js +2 -1
  85. package/dist/security/runtimeGuard.js +9 -6
  86. package/dist/security/secretComparison.d.ts +3 -0
  87. package/dist/security/secretComparison.js +11 -0
  88. package/dist/security/sensitiveGuard.d.ts +5 -0
  89. package/dist/security/sensitiveGuard.js +27 -8
  90. package/dist/security/toolInvocationGuard.d.ts +2 -2
  91. package/dist/security/toolInvocationGuard.js +1 -1
  92. package/dist/security/workspaceRootGuard.d.ts +8 -0
  93. package/dist/security/workspaceRootGuard.js +47 -0
  94. package/dist/smoke-test.js +24 -23
  95. package/dist/tools/catalog/index.d.ts +4 -0
  96. package/dist/tools/catalog/index.js +4 -0
  97. package/dist/tools/{toolCatalog.js → catalog/toolCatalog.js} +3 -12
  98. package/dist/tools/{toolRegistry.d.ts → catalog/toolRegistry.d.ts} +3 -3
  99. package/dist/tools/{toolRegistry.js → catalog/toolRegistry.js} +6 -15
  100. package/dist/tools/definitions/toolDefs.d.ts +18 -0
  101. package/dist/tools/definitions/toolDefs.js +1177 -0
  102. package/dist/tools/{auditSession.d.ts → diagnostics/auditSession.d.ts} +1 -1
  103. package/dist/tools/{auditSession.js → diagnostics/auditSession.js} +2 -2
  104. package/dist/tools/{auditTask.d.ts → diagnostics/auditTask.d.ts} +1 -1
  105. package/dist/tools/{auditTask.js → diagnostics/auditTask.js} +99 -29
  106. package/dist/tools/{healthCheck.d.ts → diagnostics/healthCheck.d.ts} +6 -6
  107. package/dist/tools/{healthCheck.js → diagnostics/healthCheck.js} +7 -7
  108. package/dist/tools/diagnostics/index.d.ts +6 -0
  109. package/dist/tools/diagnostics/index.js +6 -0
  110. package/dist/tools/{safeStatus.d.ts → diagnostics/safeStatus.d.ts} +3 -3
  111. package/dist/tools/{safeStatus.js → diagnostics/safeStatus.js} +6 -6
  112. package/dist/tools/{safeViews.d.ts → diagnostics/safeViews.d.ts} +12 -8
  113. package/dist/tools/{safeViews.js → diagnostics/safeViews.js} +23 -13
  114. package/dist/tools/{schemaDriftCheck.d.ts → diagnostics/schemaDriftCheck.d.ts} +1 -1
  115. package/dist/tools/{schemaDriftCheck.js → diagnostics/schemaDriftCheck.js} +2 -2
  116. package/dist/tools/{createDirectSession.js → direct/createDirectSession.js} +6 -6
  117. package/dist/tools/{finalizeDirectSession.d.ts → direct/finalizeDirectSession.d.ts} +1 -1
  118. package/dist/tools/direct/finalizeDirectSession.js +86 -0
  119. package/dist/tools/direct/index.d.ts +3 -0
  120. package/dist/tools/direct/index.js +3 -0
  121. package/dist/tools/{runDirectVerificationBundle.js → direct/runDirectVerificationBundle.js} +2 -2
  122. package/dist/tools/{discoverTools.d.ts → discovery/discoverTools.d.ts} +2 -2
  123. package/dist/tools/{discoverTools.js → discovery/discoverTools.js} +5 -5
  124. package/dist/tools/{explainTool.d.ts → discovery/explainTool.d.ts} +2 -2
  125. package/dist/tools/{explainTool.js → discovery/explainTool.js} +2 -2
  126. package/dist/tools/discovery/index.d.ts +3 -0
  127. package/dist/tools/discovery/index.js +3 -0
  128. package/dist/tools/{invokeDiscoveredTool.d.ts → discovery/invokeDiscoveredTool.d.ts} +2 -2
  129. package/dist/tools/{invokeDiscoveredTool.js → discovery/invokeDiscoveredTool.js} +5 -5
  130. package/dist/tools/dispatch/coreDispatch.js +32 -31
  131. package/dist/tools/dispatch/diagnosticDispatch.d.ts +3 -5
  132. package/dist/tools/dispatch/diagnosticDispatch.js +70 -68
  133. package/dist/tools/dispatch/directDispatch.js +11 -10
  134. package/dist/tools/dispatch/goalDispatch.js +5 -4
  135. package/dist/tools/dispatch/releaseDispatch.js +3 -2
  136. package/dist/tools/dispatch/validation.d.ts +7 -0
  137. package/dist/tools/dispatch/validation.js +71 -0
  138. package/dist/tools/{getPlan.js → goals/getPlan.js} +4 -4
  139. package/dist/tools/{goalSubgoalTask.d.ts → goals/goalSubgoalTask.d.ts} +1 -1
  140. package/dist/tools/goals/goalSubgoalTask.js +118 -0
  141. package/dist/tools/goals/index.d.ts +3 -0
  142. package/dist/tools/goals/index.js +3 -0
  143. package/dist/tools/{savePlan.js → goals/savePlan.js} +28 -8
  144. package/dist/tools/registry.d.ts +7 -11
  145. package/dist/tools/registry.js +17 -1178
  146. package/dist/tools/{checkReleaseGate.d.ts → release/checkReleaseGate.d.ts} +1 -1
  147. package/dist/tools/{checkReleaseGate.js → release/checkReleaseGate.js} +3 -3
  148. package/dist/tools/release/index.d.ts +2 -0
  149. package/dist/tools/release/index.js +2 -0
  150. package/dist/tools/{releaseMode.d.ts → release/releaseMode.d.ts} +2 -2
  151. package/dist/tools/{releaseMode.js → release/releaseMode.js} +46 -26
  152. package/dist/tools/tasks/cancelTask.d.ts +11 -0
  153. package/dist/tools/tasks/cancelTask.js +85 -0
  154. package/dist/tools/{createTask.d.ts → tasks/createTask.d.ts} +10 -2
  155. package/dist/tools/{createTask.js → tasks/createTask.js} +42 -27
  156. package/dist/tools/{diagnoseTask.d.ts → tasks/diagnoseTask.d.ts} +1 -1
  157. package/dist/tools/{diagnoseTask.js → tasks/diagnoseTask.js} +8 -8
  158. package/dist/tools/{evidencePack.js → tasks/evidencePack.js} +34 -22
  159. package/dist/tools/{getTaskFile.js → tasks/getTaskFile.js} +4 -4
  160. package/dist/tools/{getTaskStatus.d.ts → tasks/getTaskStatus.d.ts} +6 -1
  161. package/dist/tools/{getTaskStatus.js → tasks/getTaskStatus.js} +5 -5
  162. package/dist/tools/{getTaskStdoutTail.js → tasks/getTaskStdoutTail.js} +13 -11
  163. package/dist/tools/{getTaskSummary.js → tasks/getTaskSummary.js} +33 -26
  164. package/dist/tools/tasks/index.d.ts +18 -0
  165. package/dist/tools/tasks/index.js +18 -0
  166. package/dist/tools/tasks/killTask.d.ts +1 -0
  167. package/dist/tools/{listTasks.d.ts → tasks/listTasks.d.ts} +1 -1
  168. package/dist/tools/{listTasks.js → tasks/listTasks.js} +3 -3
  169. package/dist/tools/{reconcileTasks.d.ts → tasks/reconcileTasks.d.ts} +1 -1
  170. package/dist/tools/{reconcileTasks.js → tasks/reconcileTasks.js} +64 -66
  171. package/dist/tools/tasks/retryTask.js +60 -0
  172. package/dist/tools/{runTaskLoop.d.ts → tasks/runTaskLoop.d.ts} +6 -6
  173. package/dist/tools/{runTaskLoop.js → tasks/runTaskLoop.js} +58 -30
  174. package/dist/tools/tasks/runVerification.js +38 -0
  175. package/dist/tools/{taskLineage.js → tasks/taskLineage.js} +8 -7
  176. package/dist/tools/{taskOutputs.js → tasks/taskOutputs.js} +17 -16
  177. package/dist/tools/{androidDoctor.js → workspace/androidDoctor.js} +16 -10
  178. package/dist/tools/{applyPatch.d.ts → workspace/applyPatch.d.ts} +1 -1
  179. package/dist/tools/workspace/applyPatch.js +53 -0
  180. package/dist/tools/{discardWorktree.js → workspace/discardWorktree.js} +3 -3
  181. package/dist/tools/workspace/index.d.ts +10 -0
  182. package/dist/tools/workspace/index.js +10 -0
  183. package/dist/tools/{listAgents.d.ts → workspace/listAgents.d.ts} +5 -0
  184. package/dist/tools/{listAgents.js → workspace/listAgents.js} +8 -4
  185. package/dist/tools/{listWorkspace.js → workspace/listWorkspace.js} +3 -3
  186. package/dist/tools/{mergeWorktree.js → workspace/mergeWorktree.js} +3 -3
  187. package/dist/tools/{readWorkspaceFile.js → workspace/readWorkspaceFile.js} +8 -8
  188. package/dist/tools/{recommendAgentForTask.js → workspace/recommendAgentForTask.js} +3 -3
  189. package/dist/tools/{searchWorkspace.js → workspace/searchWorkspace.js} +5 -5
  190. package/dist/tools/{syncFile.d.ts → workspace/syncFile.d.ts} +1 -1
  191. package/dist/tools/workspace/syncFile.js +134 -0
  192. package/dist/utils/atomicFile.d.ts +7 -0
  193. package/dist/utils/atomicFile.js +48 -0
  194. package/dist/utils/boundedFile.d.ts +8 -0
  195. package/dist/utils/boundedFile.js +93 -0
  196. package/dist/utils/lockedJsonFile.d.ts +15 -0
  197. package/dist/utils/lockedJsonFile.js +224 -0
  198. package/dist/utils/platform.d.ts +11 -0
  199. package/dist/utils/platform.js +26 -0
  200. package/dist/utils/stableJson.d.ts +2 -0
  201. package/dist/utils/stableJson.js +12 -0
  202. package/dist/version.d.ts +3 -2
  203. package/dist/version.js +3 -2
  204. package/dist/watcherStatus.d.ts +2 -2
  205. package/dist/watcherStatus.js +18 -0
  206. package/docs/CODE_WIKI.md +808 -143
  207. package/docs/architecture.md +15 -55
  208. package/docs/assets/patchwarden-desktop-onboarding.png +0 -0
  209. package/docs/control-center/README.md +4 -4
  210. package/docs/dashboard-overview.md +4 -4
  211. package/docs/desktop-app.md +175 -0
  212. package/docs/evidence-pack-schema.md +3 -3
  213. package/docs/open-source-application.md +17 -11
  214. package/docs/release-checklist.md +1 -1
  215. package/docs/release-evidence.md +39 -29
  216. package/docs/task-safe-review-workflow.md +5 -5
  217. package/docs/threat-model.md +19 -1
  218. package/examples/config.example.json +4 -2
  219. package/package.json +27 -10
  220. package/scripts/README.md +15 -6
  221. package/scripts/build.js +11 -0
  222. package/scripts/checks/brand-check.js +3 -0
  223. package/scripts/checks/build-output-check.js +37 -0
  224. package/scripts/checks/control-center-smoke.js +91 -6
  225. package/scripts/checks/control-smoke.js +19 -8
  226. package/scripts/checks/http-mcp-smoke.js +82 -4
  227. package/scripts/checks/lifecycle-smoke.js +10 -10
  228. package/scripts/checks/mcp-manifest-check.js +1 -1
  229. package/scripts/checks/mcp-smoke.js +27 -3
  230. package/scripts/checks/package-manifest-check.js +20 -7
  231. package/scripts/checks/unit-tests.js +3 -5
  232. package/scripts/checks/watcher-supervisor-smoke.js +9 -0
  233. package/scripts/control/get-patchwarden-health.ps1 +1 -1
  234. package/scripts/control/manage-patchwarden.ps1 +69 -4
  235. package/scripts/control/provision-patchwarden-tunnel.ps1 +127 -0
  236. package/scripts/control/run-background-supervisor.ps1 +41 -0
  237. package/scripts/control/start-patchwarden-tunnel.ps1 +126 -32
  238. package/{PatchWarden-Control-Tray.cmd → scripts/launchers/PatchWarden-Control-Tray.cmd} +3 -3
  239. package/scripts/launchers/PatchWarden-Control.cmd +6 -0
  240. package/{PatchWarden-Desktop.cmd → scripts/launchers/PatchWarden-Desktop.cmd} +2 -2
  241. package/scripts/launchers/Restart-PatchWarden-Control.cmd +6 -0
  242. package/{Stop-PatchWarden.cmd → scripts/launchers/Stop-PatchWarden.cmd} +2 -2
  243. package/scripts/lib/clean-generated-output.js +11 -0
  244. package/scripts/lib/file-discovery.js +12 -0
  245. package/scripts/release/desktop-preflight.js +211 -0
  246. package/scripts/release/pack-clean.js +59 -14
  247. package/src/assessments/agentAssessor.ts +26 -12
  248. package/src/assessments/assessmentStore.ts +52 -40
  249. package/src/config.ts +70 -13
  250. package/src/control/fileManager.ts +40 -0
  251. package/src/control/middleware/auth.ts +22 -4
  252. package/src/control/middleware/static.ts +16 -3
  253. package/src/control/routeTable.ts +301 -0
  254. package/src/control/routes/audit.ts +14 -6
  255. package/src/control/routes/evidence.ts +1 -1
  256. package/src/control/routes/lineage.ts +1 -1
  257. package/src/control/routes/process.ts +341 -40
  258. package/src/control/routes/sessions.ts +88 -25
  259. package/src/control/routes/status.ts +97 -17
  260. package/src/control/routes/taskActions.ts +24 -58
  261. package/src/control/routes/tasks.ts +66 -58
  262. package/src/control/routes/workspace.ts +56 -25
  263. package/src/control/runtime.ts +69 -33
  264. package/src/control/server.ts +36 -342
  265. package/src/control/shared.ts +77 -11
  266. package/src/direct/directAudit.ts +17 -9
  267. package/src/direct/directGuards.ts +72 -44
  268. package/src/direct/directPatch.ts +95 -8
  269. package/src/direct/directSessionStore.ts +211 -55
  270. package/src/direct/directVerification.ts +9 -23
  271. package/src/doctor.ts +73 -59
  272. package/src/goal/acceptanceEngine.ts +1 -1
  273. package/src/goal/goalProgress.ts +17 -13
  274. package/src/goal/goalReport.ts +5 -13
  275. package/src/goal/goalStatus.ts +19 -3
  276. package/src/goal/goalStore.ts +241 -54
  277. package/src/goal/handoffExport.ts +6 -6
  278. package/src/goal/specKitImport.ts +12 -12
  279. package/src/goal/subgoalSync.ts +11 -8
  280. package/src/goal/worktreeManager.ts +139 -22
  281. package/src/httpServer.ts +113 -30
  282. package/src/logging.ts +10 -3
  283. package/src/policy/projectPolicy.ts +5 -2
  284. package/src/release/releaseGate.ts +74 -27
  285. package/src/runner/agentInvocation.ts +126 -4
  286. package/src/runner/changeCapture.ts +291 -57
  287. package/src/runner/postTaskCleanup.ts +41 -17
  288. package/src/runner/processSecurity.ts +433 -0
  289. package/src/runner/runTask.ts +138 -91
  290. package/src/runner/simpleProcess.ts +66 -31
  291. package/src/{taskProgress.ts → runner/taskProgress.ts} +3 -3
  292. package/src/{taskRuntime.ts → runner/taskRuntime.ts} +4 -3
  293. package/src/runner/taskStatusStore.ts +54 -0
  294. package/src/runner/watch.ts +281 -51
  295. package/src/security/contentRedaction.ts +2 -2
  296. package/src/security/discoveryTokenStore.ts +18 -4
  297. package/src/security/loopbackHost.ts +19 -0
  298. package/src/security/pathGuard.ts +35 -16
  299. package/src/security/planGuard.ts +2 -1
  300. package/src/security/runtimeGuard.ts +9 -6
  301. package/src/security/secretComparison.ts +13 -0
  302. package/src/security/sensitiveGuard.ts +27 -8
  303. package/src/security/toolInvocationGuard.ts +2 -2
  304. package/src/security/workspaceRootGuard.ts +53 -0
  305. package/src/smoke-test.ts +25 -24
  306. package/src/tools/catalog/index.ts +4 -0
  307. package/src/tools/{toolCatalog.ts → catalog/toolCatalog.ts} +3 -12
  308. package/src/tools/{toolRegistry.ts → catalog/toolRegistry.ts} +7 -16
  309. package/src/tools/definitions/toolDefs.ts +1264 -0
  310. package/src/tools/{auditSession.ts → diagnostics/auditSession.ts} +2 -2
  311. package/src/tools/{auditTask.ts → diagnostics/auditTask.ts} +99 -32
  312. package/src/tools/{healthCheck.ts → diagnostics/healthCheck.ts} +8 -8
  313. package/src/tools/diagnostics/index.ts +6 -0
  314. package/src/tools/{safeStatus.ts → diagnostics/safeStatus.ts} +7 -7
  315. package/src/tools/{safeViews.ts → diagnostics/safeViews.ts} +27 -17
  316. package/src/tools/{schemaDriftCheck.ts → diagnostics/schemaDriftCheck.ts} +3 -3
  317. package/src/tools/{createDirectSession.ts → direct/createDirectSession.ts} +6 -6
  318. package/src/tools/{finalizeDirectSession.ts → direct/finalizeDirectSession.ts} +7 -5
  319. package/src/tools/direct/index.ts +3 -0
  320. package/src/tools/{runDirectVerificationBundle.ts → direct/runDirectVerificationBundle.ts} +2 -2
  321. package/src/tools/{discoverTools.ts → discovery/discoverTools.ts} +6 -6
  322. package/src/tools/{explainTool.ts → discovery/explainTool.ts} +3 -3
  323. package/src/tools/discovery/index.ts +3 -0
  324. package/src/tools/{invokeDiscoveredTool.ts → discovery/invokeDiscoveredTool.ts} +7 -7
  325. package/src/tools/dispatch/coreDispatch.ts +36 -31
  326. package/src/tools/dispatch/diagnosticDispatch.ts +26 -21
  327. package/src/tools/dispatch/directDispatch.ts +11 -10
  328. package/src/tools/dispatch/goalDispatch.ts +5 -4
  329. package/src/tools/dispatch/releaseDispatch.ts +3 -2
  330. package/src/tools/dispatch/validation.ts +78 -0
  331. package/src/tools/{getPlan.ts → goals/getPlan.ts} +4 -4
  332. package/src/tools/{goalSubgoalTask.ts → goals/goalSubgoalTask.ts} +41 -26
  333. package/src/tools/goals/index.ts +3 -0
  334. package/src/tools/{savePlan.ts → goals/savePlan.ts} +38 -8
  335. package/src/tools/registry.ts +17 -1261
  336. package/src/tools/{checkReleaseGate.ts → release/checkReleaseGate.ts} +3 -3
  337. package/src/tools/release/index.ts +2 -0
  338. package/src/tools/{releaseMode.ts → release/releaseMode.ts} +42 -24
  339. package/src/tools/tasks/cancelTask.ts +109 -0
  340. package/src/tools/{createTask.ts → tasks/createTask.ts} +49 -26
  341. package/src/tools/{diagnoseTask.ts → tasks/diagnoseTask.ts} +8 -8
  342. package/src/tools/{evidencePack.ts → tasks/evidencePack.ts} +36 -22
  343. package/src/tools/{getTaskFile.ts → tasks/getTaskFile.ts} +4 -4
  344. package/src/tools/{getTaskStatus.ts → tasks/getTaskStatus.ts} +7 -5
  345. package/src/tools/{getTaskStdoutTail.ts → tasks/getTaskStdoutTail.ts} +13 -11
  346. package/src/tools/{getTaskSummary.ts → tasks/getTaskSummary.ts} +44 -33
  347. package/src/tools/tasks/index.ts +18 -0
  348. package/src/tools/{listTasks.ts → tasks/listTasks.ts} +4 -4
  349. package/src/tools/{reconcileTasks.ts → tasks/reconcileTasks.ts} +68 -66
  350. package/src/tools/tasks/retryTask.ts +69 -0
  351. package/src/tools/{runTaskLoop.ts → tasks/runTaskLoop.ts} +69 -34
  352. package/src/tools/{runVerification.ts → tasks/runVerification.ts} +6 -3
  353. package/src/tools/{taskLineage.ts → tasks/taskLineage.ts} +8 -7
  354. package/src/tools/{taskOutputs.ts → tasks/taskOutputs.ts} +27 -20
  355. package/src/tools/{androidDoctor.ts → workspace/androidDoctor.ts} +15 -10
  356. package/src/tools/{applyPatch.ts → workspace/applyPatch.ts} +38 -16
  357. package/src/tools/{discardWorktree.ts → workspace/discardWorktree.ts} +3 -3
  358. package/src/tools/workspace/index.ts +10 -0
  359. package/src/tools/{listAgents.ts → workspace/listAgents.ts} +11 -4
  360. package/src/tools/{listWorkspace.ts → workspace/listWorkspace.ts} +3 -3
  361. package/src/tools/{mergeWorktree.ts → workspace/mergeWorktree.ts} +3 -3
  362. package/src/tools/{readWorkspaceFile.ts → workspace/readWorkspaceFile.ts} +8 -8
  363. package/src/tools/{recommendAgentForTask.ts → workspace/recommendAgentForTask.ts} +3 -3
  364. package/src/tools/{searchWorkspace.ts → workspace/searchWorkspace.ts} +5 -5
  365. package/src/tools/workspace/syncFile.ts +292 -0
  366. package/src/utils/atomicFile.ts +58 -0
  367. package/src/utils/boundedFile.ts +116 -0
  368. package/src/utils/lockedJsonFile.ts +251 -0
  369. package/src/utils/platform.ts +31 -0
  370. package/src/utils/stableJson.ts +12 -0
  371. package/src/version.ts +3 -2
  372. package/src/watcherStatus.ts +19 -1
  373. package/ui/desktop-bootstrap.js +11 -0
  374. package/ui/desktop-bridge.js +36 -0
  375. package/ui/desktop.css +160 -0
  376. package/ui/getting-started.js +93 -0
  377. package/ui/i18n.js +484 -0
  378. package/ui/log-parser.js +30 -0
  379. package/ui/pages/audit.html +12 -0
  380. package/ui/pages/dashboard.html +90 -147
  381. package/ui/pages/direct-sessions.html +123 -26
  382. package/ui/pages/getting-started.html +43 -0
  383. package/ui/pages/logs.html +105 -22
  384. package/ui/pages/settings.html +101 -0
  385. package/ui/pages/task-detail.html +12 -0
  386. package/ui/pages/tasks.html +54 -8
  387. package/ui/pages/workspace.html +38 -1
  388. package/ui/settings.js +245 -0
  389. package/PatchWarden-Control.cmd +0 -6
  390. package/Restart-PatchWarden-Control.cmd +0 -6
  391. package/dist/test/unit/acceptance-engine.test.d.ts +0 -1
  392. package/dist/test/unit/acceptance-engine.test.js +0 -228
  393. package/dist/test/unit/agent-router.test.d.ts +0 -1
  394. package/dist/test/unit/agent-router.test.js +0 -287
  395. package/dist/test/unit/android-doctor.test.d.ts +0 -1
  396. package/dist/test/unit/android-doctor.test.js +0 -118
  397. package/dist/test/unit/apply-patch.test.d.ts +0 -1
  398. package/dist/test/unit/apply-patch.test.js +0 -225
  399. package/dist/test/unit/audit-checks.test.d.ts +0 -1
  400. package/dist/test/unit/audit-checks.test.js +0 -350
  401. package/dist/test/unit/chinese-path.test.d.ts +0 -1
  402. package/dist/test/unit/chinese-path.test.js +0 -91
  403. package/dist/test/unit/command-guard.test.d.ts +0 -1
  404. package/dist/test/unit/command-guard.test.js +0 -160
  405. package/dist/test/unit/create-task.test.d.ts +0 -1
  406. package/dist/test/unit/create-task.test.js +0 -197
  407. package/dist/test/unit/diagnose-task.test.d.ts +0 -1
  408. package/dist/test/unit/diagnose-task.test.js +0 -457
  409. package/dist/test/unit/direct-guards.test.d.ts +0 -1
  410. package/dist/test/unit/direct-guards.test.js +0 -328
  411. package/dist/test/unit/discovery-token-store.test.d.ts +0 -1
  412. package/dist/test/unit/discovery-token-store.test.js +0 -139
  413. package/dist/test/unit/evidence-pack.test.d.ts +0 -1
  414. package/dist/test/unit/evidence-pack.test.js +0 -224
  415. package/dist/test/unit/get-task-status.test.d.ts +0 -1
  416. package/dist/test/unit/get-task-status.test.js +0 -174
  417. package/dist/test/unit/get-task-summary.test.d.ts +0 -1
  418. package/dist/test/unit/get-task-summary.test.js +0 -146
  419. package/dist/test/unit/goal-graph.test.d.ts +0 -1
  420. package/dist/test/unit/goal-graph.test.js +0 -298
  421. package/dist/test/unit/goal-progress.test.d.ts +0 -1
  422. package/dist/test/unit/goal-progress.test.js +0 -381
  423. package/dist/test/unit/goal-report.test.d.ts +0 -1
  424. package/dist/test/unit/goal-report.test.js +0 -159
  425. package/dist/test/unit/goal-status.test.d.ts +0 -1
  426. package/dist/test/unit/goal-status.test.js +0 -215
  427. package/dist/test/unit/goal-store.test.d.ts +0 -1
  428. package/dist/test/unit/goal-store.test.js +0 -253
  429. package/dist/test/unit/goal-subgoal-task.test.d.ts +0 -1
  430. package/dist/test/unit/goal-subgoal-task.test.js +0 -55
  431. package/dist/test/unit/goal-tools-registry.test.d.ts +0 -1
  432. package/dist/test/unit/goal-tools-registry.test.js +0 -192
  433. package/dist/test/unit/handoff-export.test.d.ts +0 -1
  434. package/dist/test/unit/handoff-export.test.js +0 -263
  435. package/dist/test/unit/invoke-discovered-tool.test.d.ts +0 -1
  436. package/dist/test/unit/invoke-discovered-tool.test.js +0 -167
  437. package/dist/test/unit/logging.test.d.ts +0 -1
  438. package/dist/test/unit/logging.test.js +0 -397
  439. package/dist/test/unit/path-guard.test.d.ts +0 -1
  440. package/dist/test/unit/path-guard.test.js +0 -133
  441. package/dist/test/unit/post-task-cleanup.test.d.ts +0 -1
  442. package/dist/test/unit/post-task-cleanup.test.js +0 -48
  443. package/dist/test/unit/project-policy-release-mode.test.d.ts +0 -1
  444. package/dist/test/unit/project-policy-release-mode.test.js +0 -125
  445. package/dist/test/unit/reconcile-tasks.test.d.ts +0 -1
  446. package/dist/test/unit/reconcile-tasks.test.js +0 -456
  447. package/dist/test/unit/release-gate.test.d.ts +0 -1
  448. package/dist/test/unit/release-gate.test.js +0 -242
  449. package/dist/test/unit/run-task-loop.test.d.ts +0 -1
  450. package/dist/test/unit/run-task-loop.test.js +0 -380
  451. package/dist/test/unit/safe-status.test.d.ts +0 -1
  452. package/dist/test/unit/safe-status.test.js +0 -165
  453. package/dist/test/unit/safe-views.test.d.ts +0 -1
  454. package/dist/test/unit/safe-views.test.js +0 -171
  455. package/dist/test/unit/schema-drift-check.test.d.ts +0 -1
  456. package/dist/test/unit/schema-drift-check.test.js +0 -176
  457. package/dist/test/unit/sensitive-guard.test.d.ts +0 -1
  458. package/dist/test/unit/sensitive-guard.test.js +0 -104
  459. package/dist/test/unit/spec-kit-import.test.d.ts +0 -1
  460. package/dist/test/unit/spec-kit-import.test.js +0 -341
  461. package/dist/test/unit/subgoal-sync.test.d.ts +0 -1
  462. package/dist/test/unit/subgoal-sync.test.js +0 -183
  463. package/dist/test/unit/sync-file.test.d.ts +0 -1
  464. package/dist/test/unit/sync-file.test.js +0 -154
  465. package/dist/test/unit/tool-invocation-guard.test.d.ts +0 -1
  466. package/dist/test/unit/tool-invocation-guard.test.js +0 -432
  467. package/dist/test/unit/tool-usage-stats.test.d.ts +0 -1
  468. package/dist/test/unit/tool-usage-stats.test.js +0 -300
  469. package/dist/test/unit/toolSearch.test.d.ts +0 -1
  470. package/dist/test/unit/toolSearch.test.js +0 -571
  471. package/dist/test/unit/wait-for-task.test.d.ts +0 -1
  472. package/dist/test/unit/wait-for-task.test.js +0 -144
  473. package/dist/test/unit/watcher-status.test.d.ts +0 -1
  474. package/dist/test/unit/watcher-status.test.js +0 -169
  475. package/dist/test/unit/worktree-manager.test.d.ts +0 -1
  476. package/dist/test/unit/worktree-manager.test.js +0 -176
  477. package/dist/tools/applyPatch.js +0 -41
  478. package/dist/tools/cancelTask.d.ts +0 -30
  479. package/dist/tools/cancelTask.js +0 -64
  480. package/dist/tools/finalizeDirectSession.js +0 -84
  481. package/dist/tools/goalSubgoalTask.js +0 -110
  482. package/dist/tools/killTask.d.ts +0 -15
  483. package/dist/tools/retryTask.js +0 -45
  484. package/dist/tools/runVerification.js +0 -36
  485. package/dist/tools/syncFile.js +0 -65
  486. package/docs/control-center/control-center-daily-driver.md +0 -211
  487. package/docs/control-center/control-center-mvp.md +0 -205
  488. package/docs/control-center/control-center-phase2.md +0 -159
  489. package/docs/execution-plan-2026-07-09.md +0 -315
  490. package/docs/release-v0.6.0.md +0 -71
  491. package/docs/release-v0.6.1.md +0 -75
  492. package/docs/release-v0.6.4.md +0 -45
  493. package/docs/roadmap-execution-and-acceptance.md +0 -365
  494. package/src/test/unit/acceptance-engine.test.ts +0 -261
  495. package/src/test/unit/agent-router.test.ts +0 -342
  496. package/src/test/unit/android-doctor.test.ts +0 -158
  497. package/src/test/unit/apply-patch.test.ts +0 -293
  498. package/src/test/unit/audit-checks.test.ts +0 -567
  499. package/src/test/unit/chinese-path.test.ts +0 -106
  500. package/src/test/unit/command-guard.test.ts +0 -221
  501. package/src/test/unit/create-task.test.ts +0 -255
  502. package/src/test/unit/diagnose-task.test.ts +0 -544
  503. package/src/test/unit/direct-guards.test.ts +0 -467
  504. package/src/test/unit/discovery-token-store.test.ts +0 -181
  505. package/src/test/unit/evidence-pack.test.ts +0 -251
  506. package/src/test/unit/get-task-status.test.ts +0 -203
  507. package/src/test/unit/get-task-summary.test.ts +0 -173
  508. package/src/test/unit/goal-graph.test.ts +0 -347
  509. package/src/test/unit/goal-progress.test.ts +0 -538
  510. package/src/test/unit/goal-report.test.ts +0 -189
  511. package/src/test/unit/goal-status.test.ts +0 -270
  512. package/src/test/unit/goal-store.test.ts +0 -318
  513. package/src/test/unit/goal-subgoal-task.test.ts +0 -72
  514. package/src/test/unit/goal-tools-registry.test.ts +0 -245
  515. package/src/test/unit/handoff-export.test.ts +0 -295
  516. package/src/test/unit/invoke-discovered-tool.test.ts +0 -216
  517. package/src/test/unit/logging.test.ts +0 -497
  518. package/src/test/unit/path-guard.test.ts +0 -180
  519. package/src/test/unit/post-task-cleanup.test.ts +0 -53
  520. package/src/test/unit/project-policy-release-mode.test.ts +0 -156
  521. package/src/test/unit/reconcile-tasks.test.ts +0 -551
  522. package/src/test/unit/release-gate.test.ts +0 -314
  523. package/src/test/unit/run-task-loop.test.ts +0 -425
  524. package/src/test/unit/safe-status.test.ts +0 -187
  525. package/src/test/unit/safe-views.test.ts +0 -184
  526. package/src/test/unit/schema-drift-check.test.ts +0 -260
  527. package/src/test/unit/sensitive-guard.test.ts +0 -124
  528. package/src/test/unit/spec-kit-import.test.ts +0 -429
  529. package/src/test/unit/subgoal-sync.test.ts +0 -236
  530. package/src/test/unit/sync-file.test.ts +0 -231
  531. package/src/test/unit/tool-invocation-guard.test.ts +0 -542
  532. package/src/test/unit/tool-usage-stats.test.ts +0 -384
  533. package/src/test/unit/toolSearch.test.ts +0 -756
  534. package/src/test/unit/wait-for-task.test.ts +0 -176
  535. package/src/test/unit/watcher-status.test.ts +0 -190
  536. package/src/test/unit/worktree-manager.test.ts +0 -247
  537. package/src/tools/cancelTask.ts +0 -70
  538. package/src/tools/retryTask.ts +0 -53
  539. package/src/tools/syncFile.ts +0 -122
  540. /package/dist/tools/{toolCatalog.d.ts → catalog/toolCatalog.d.ts} +0 -0
  541. /package/dist/tools/{toolSearch.d.ts → catalog/toolSearch.d.ts} +0 -0
  542. /package/dist/tools/{toolSearch.js → catalog/toolSearch.js} +0 -0
  543. /package/dist/tools/{toolUsageStats.d.ts → catalog/toolUsageStats.d.ts} +0 -0
  544. /package/dist/tools/{toolUsageStats.js → catalog/toolUsageStats.js} +0 -0
  545. /package/dist/tools/{createDirectSession.d.ts → direct/createDirectSession.d.ts} +0 -0
  546. /package/dist/tools/{runDirectVerificationBundle.d.ts → direct/runDirectVerificationBundle.d.ts} +0 -0
  547. /package/dist/tools/{getPlan.d.ts → goals/getPlan.d.ts} +0 -0
  548. /package/dist/tools/{savePlan.d.ts → goals/savePlan.d.ts} +0 -0
  549. /package/dist/tools/{evidencePack.d.ts → tasks/evidencePack.d.ts} +0 -0
  550. /package/dist/tools/{getTaskFile.d.ts → tasks/getTaskFile.d.ts} +0 -0
  551. /package/dist/tools/{getTaskProgress.d.ts → tasks/getTaskProgress.d.ts} +0 -0
  552. /package/dist/tools/{getTaskProgress.js → tasks/getTaskProgress.js} +0 -0
  553. /package/dist/tools/{getTaskStdoutTail.d.ts → tasks/getTaskStdoutTail.d.ts} +0 -0
  554. /package/dist/tools/{getTaskSummary.d.ts → tasks/getTaskSummary.d.ts} +0 -0
  555. /package/dist/tools/{killTask.js → tasks/killTask.js} +0 -0
  556. /package/dist/tools/{retryTask.d.ts → tasks/retryTask.d.ts} +0 -0
  557. /package/dist/tools/{runVerification.d.ts → tasks/runVerification.d.ts} +0 -0
  558. /package/dist/tools/{taskLineage.d.ts → tasks/taskLineage.d.ts} +0 -0
  559. /package/dist/tools/{taskOutputs.d.ts → tasks/taskOutputs.d.ts} +0 -0
  560. /package/dist/tools/{waitForTask.d.ts → tasks/waitForTask.d.ts} +0 -0
  561. /package/dist/tools/{waitForTask.js → tasks/waitForTask.js} +0 -0
  562. /package/dist/tools/{androidDoctor.d.ts → workspace/androidDoctor.d.ts} +0 -0
  563. /package/dist/tools/{discardWorktree.d.ts → workspace/discardWorktree.d.ts} +0 -0
  564. /package/dist/tools/{listWorkspace.d.ts → workspace/listWorkspace.d.ts} +0 -0
  565. /package/dist/tools/{mergeWorktree.d.ts → workspace/mergeWorktree.d.ts} +0 -0
  566. /package/dist/tools/{readWorkspaceFile.d.ts → workspace/readWorkspaceFile.d.ts} +0 -0
  567. /package/dist/tools/{recommendAgentForTask.d.ts → workspace/recommendAgentForTask.d.ts} +0 -0
  568. /package/dist/tools/{searchWorkspace.d.ts → workspace/searchWorkspace.d.ts} +0 -0
  569. /package/src/tools/{toolSearch.ts → catalog/toolSearch.ts} +0 -0
  570. /package/src/tools/{toolUsageStats.ts → catalog/toolUsageStats.ts} +0 -0
  571. /package/src/tools/{getTaskProgress.ts → tasks/getTaskProgress.ts} +0 -0
  572. /package/src/tools/{killTask.ts → tasks/killTask.ts} +0 -0
  573. /package/src/tools/{waitForTask.ts → tasks/waitForTask.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-19:
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: 9
65
+ - Open pull requests: 4
66
+ - GitHub latest release: `v1.6.0`, published on 2026-07-16
67
+ - npm latest dist-tag: `patchwarden@1.5.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
+ - Local working branch: `codex/windows-desktop-tunnel-fixes`
73
+
74
+ Local source is `v1.6.1`; the 2026-07-19 remote snapshot still records GitHub
75
+ Release `v1.6.0` and npm `latest` `1.5.1`. Treat the publication surfaces as out
76
+ of sync; local builds do not establish that either remote surface was updated.
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,9 @@ 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
+ - resolve the release lag through the reviewed workflow; local source is
121
+ `1.6.1`, while the last verified GitHub Release is `1.6.0` and npm `latest`
122
+ / `dist-tags.latest` are `1.5.1`
117
123
  - add small contributor-friendly roadmap issues such as macOS docs, Codex CLI
118
124
  examples, and a minimal demo repository
119
125
 
@@ -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,28 @@ 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-19. Local source and branch values were read
9
+ from the PatchWarden workspace and are not evidence that a public package was
10
+ published.
9
11
 
10
12
  | Surface | Current evidence |
11
13
  | --- | --- |
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` |
14
+ | Local branch | `codex/windows-desktop-tunnel-fixes` |
15
+ | Local `package.json` | `patchwarden@1.6.1` |
16
+ | GitHub latest release | `v1.6.0` |
17
+ | GitHub release URL | https://github.com/jiezeng2004-design/PatchWarden/releases/tag/v1.6.0 |
18
+ | GitHub release published on | 2026-07-16 |
19
+ | npm latest | `patchwarden@1.5.1` |
20
+ | npm `dist-tags.latest` | `1.5.1` |
19
21
  | GitHub stars | 2 |
20
22
  | GitHub forks | 0 |
21
- | Open issues | 9 (`#25`, `#26`, `#28`–`#34`) |
22
- | Open pull requests | 2 (`#24`, `#37`, both draft) |
23
+ | Open issues | 9 |
24
+ | Open pull requests | 4 |
23
25
 
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.
26
+ Conclusion: local source is `v1.6.1`; the last verified GitHub Release is
27
+ `v1.6.0`, while npm `latest` remains `1.5.1`. Do not describe the public
28
+ release surfaces as synchronized until GitHub, npm, and `dist-tags.latest` are
29
+ independently verified at the intended version.
27
30
 
28
31
  ## Commands Used
29
32
 
@@ -31,29 +34,36 @@ Windows PowerShell:
31
34
 
32
35
  ```powershell
33
36
  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
37
+ gh release view v1.6.0 --repo jiezeng2004-design/PatchWarden --json tagName,name,publishedAt,isDraft,isPrerelease,url
35
38
  gh release view --repo jiezeng2004-design/PatchWarden --json tagName,name,publishedAt,isDraft,isPrerelease,url
36
39
  npm.cmd view patchwarden version dist-tags --json --cache .\.npm-cache
37
40
  ```
38
41
 
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`.
42
+ The npm query was verified on 2026-07-19: `version=1.5.1` and
43
+ `dist-tags.latest=1.5.1`.
41
44
 
42
- ## Local Verification Snapshot
45
+ ## Local Verification Snapshot (Separate From Remote Truth)
43
46
 
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.
47
+ The following 2026-07-19 baseline checks describe the local working tree only.
48
+ They do not prove GitHub/npm publication state, and the complete gate must be
49
+ rerun after the current optimization work finishes.
50
+
51
+ - Root TypeScript `--noEmit` and the Desktop TypeScript build: passed.
52
+ - Targeted reliability/security tests: 49 passed; targeted Desktop backend
53
+ lifecycle tests: 8 passed.
54
+ - `npm.cmd test`: passed on the second baseline run, including 139/139 security
55
+ checks, 747 passed and 2 skipped unit tests, 22/22 lifecycle checks, and
56
+ 32/32 Control Center checks. An earlier run exposed one Git commit setup
57
+ flake; the test setup was then hardened.
52
58
  - `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.
59
+ - `npm.cmd run test:http-mcp`: 13 passed, 0 failed.
60
+ - `npm.cmd run desktop:test`: 41 passed, 0 failed at the baseline snapshot.
61
+ - Root and Desktop dependency audits: 0 known vulnerabilities.
62
+ - `npm.cmd run pack:clean` was not run for this historical baseline. Current
63
+ versions recreate only `release/package/` plus the two root package archives;
64
+ Desktop and preflight siblings under `release/` are preserved. It still
65
+ overwrites those package artifacts, so run it only during explicitly approved
66
+ release preparation.
57
67
 
58
68
  ## Release Verification Checklist
59
69
 
@@ -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": [