@opengsd/gsd-pi 1.1.1-dev.616a1a1 → 1.1.1-dev.75048e7

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 (452) hide show
  1. package/dist/cli.js +3 -2
  2. package/dist/help-text.js +10 -6
  3. package/dist/resources/.managed-resources-content-hash +1 -1
  4. package/dist/resources/extensions/browser-tools/engine/managed-gsd-browser.js +495 -0
  5. package/dist/resources/extensions/browser-tools/engine/selection.js +16 -0
  6. package/dist/resources/extensions/browser-tools/extension-manifest.json +2 -2
  7. package/dist/resources/extensions/browser-tools/index.js +57 -9
  8. package/dist/resources/extensions/browser-tools/package.json +5 -1
  9. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +167 -16
  10. package/dist/resources/extensions/gsd/auto/orchestrator.js +0 -1
  11. package/dist/resources/extensions/gsd/auto/phases.js +4 -3
  12. package/dist/resources/extensions/gsd/auto-dashboard.js +92 -17
  13. package/dist/resources/extensions/gsd/auto-dispatch.js +55 -0
  14. package/dist/resources/extensions/gsd/auto-post-unit.js +134 -10
  15. package/dist/resources/extensions/gsd/auto-prompts.js +72 -22
  16. package/dist/resources/extensions/gsd/auto-recovery.js +7 -8
  17. package/dist/resources/extensions/gsd/auto-runtime-state.js +3 -0
  18. package/dist/resources/extensions/gsd/auto-start.js +94 -15
  19. package/dist/resources/extensions/gsd/auto-tool-tracking.js +1 -1
  20. package/dist/resources/extensions/gsd/auto-unit-tool-scope.js +18 -65
  21. package/dist/resources/extensions/gsd/auto-worktree.js +18 -5
  22. package/dist/resources/extensions/gsd/auto.js +31 -6
  23. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +89 -4
  24. package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +43 -0
  25. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +56 -20
  26. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +33 -38
  27. package/dist/resources/extensions/gsd/browser-evidence.js +29 -2
  28. package/dist/resources/extensions/gsd/closeout-consistency-gate.js +61 -0
  29. package/dist/resources/extensions/gsd/commands/catalog.js +6 -1
  30. package/dist/resources/extensions/gsd/commands/handlers/core.js +6 -2
  31. package/dist/resources/extensions/gsd/commands/handlers/ops.js +9 -5
  32. package/dist/resources/extensions/gsd/commands-handlers.js +76 -11
  33. package/dist/resources/extensions/gsd/commands-maintenance.js +172 -2
  34. package/dist/resources/extensions/gsd/commands-mcp-status.js +109 -60
  35. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +3 -1
  36. package/dist/resources/extensions/gsd/commands-verdict.js +1 -1
  37. package/dist/resources/extensions/gsd/config-overlay.js +2 -1
  38. package/dist/resources/extensions/gsd/dashboard-overlay.js +21 -7
  39. package/dist/resources/extensions/gsd/docs/preferences-reference.md +8 -0
  40. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +2 -2
  41. package/dist/resources/extensions/gsd/error-classifier.js +2 -1
  42. package/dist/resources/extensions/gsd/escalation.js +4 -4
  43. package/dist/resources/extensions/gsd/exec-sandbox.js +2 -0
  44. package/dist/resources/extensions/gsd/forensics.js +74 -2
  45. package/dist/resources/extensions/gsd/gsd-db.js +42 -6
  46. package/dist/resources/extensions/gsd/guided-flow.js +119 -176
  47. package/dist/resources/extensions/gsd/mcp-filter.js +3 -0
  48. package/dist/resources/extensions/gsd/mcp-project-config.js +76 -84
  49. package/dist/resources/extensions/gsd/memory-store.js +4 -1
  50. package/dist/resources/extensions/gsd/migration-auto-check.js +2 -2
  51. package/dist/resources/extensions/gsd/milestone-closeout.js +3 -1
  52. package/dist/resources/extensions/gsd/pending-auto-start.js +0 -1
  53. package/dist/resources/extensions/gsd/post-unit-hooks.js +9 -0
  54. package/dist/resources/extensions/gsd/preferences-validation.js +39 -0
  55. package/dist/resources/extensions/gsd/prompt-loader.js +7 -0
  56. package/dist/resources/extensions/gsd/prompts/forensics.md +61 -1
  57. package/dist/resources/extensions/gsd/prompts/gate-evaluate.md +3 -1
  58. package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +3 -1
  59. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  60. package/dist/resources/extensions/gsd/prompts/reactive-execute.md +3 -1
  61. package/dist/resources/extensions/gsd/prompts/run-uat.md +33 -23
  62. package/dist/resources/extensions/gsd/prompts/system.md +3 -1
  63. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +3 -3
  64. package/dist/resources/extensions/gsd/recovery-classification.js +20 -0
  65. package/dist/resources/extensions/gsd/rule-registry.js +428 -52
  66. package/dist/resources/extensions/gsd/safety/destructive-guard.js +3 -0
  67. package/dist/resources/extensions/gsd/skill-activation.js +20 -3
  68. package/dist/resources/extensions/gsd/state-reconciliation/drift/artifact-db.js +4 -2
  69. package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +1 -1
  70. package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +18 -1
  71. package/dist/resources/extensions/gsd/state-reconciliation/index.js +6 -0
  72. package/dist/resources/extensions/gsd/state.js +17 -14
  73. package/dist/resources/extensions/gsd/templates/plan.md +3 -1
  74. package/dist/resources/extensions/gsd/tool-contract.js +5 -0
  75. package/dist/resources/extensions/gsd/tool-presentation-plan.js +143 -0
  76. package/dist/resources/extensions/gsd/tools/complete-slice.js +15 -1
  77. package/dist/resources/extensions/gsd/tools/complete-task.js +11 -1
  78. package/dist/resources/extensions/gsd/tools/exec-tool.js +109 -0
  79. package/dist/resources/extensions/gsd/tools/plan-slice.js +14 -9
  80. package/dist/resources/extensions/gsd/tools/reopen-milestone.js +2 -2
  81. package/dist/resources/extensions/gsd/tools/validate-milestone.js +46 -16
  82. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +483 -6
  83. package/dist/resources/extensions/gsd/unit-context-manifest.js +8 -3
  84. package/dist/resources/extensions/gsd/unit-tool-contracts.js +169 -0
  85. package/dist/resources/extensions/gsd/validation-block-guard.js +2 -0
  86. package/dist/resources/extensions/gsd/verdict-parser.js +59 -15
  87. package/dist/resources/extensions/gsd/verification-gate.js +72 -1
  88. package/dist/resources/extensions/gsd/workflow-mcp-auto-prep.js +3 -1
  89. package/dist/resources/extensions/gsd/workflow-mcp.js +5 -73
  90. package/dist/resources/extensions/gsd/worktree-lifecycle.js +24 -0
  91. package/dist/resources/extensions/mcp-client/manager.js +31 -1
  92. package/dist/resources/extensions/shared/gsd-browser-cli.js +145 -0
  93. package/dist/rtk.d.ts +7 -1
  94. package/dist/rtk.js +27 -11
  95. package/dist/update-check.d.ts +15 -1
  96. package/dist/update-check.js +87 -12
  97. package/dist/update-cmd.d.ts +1 -0
  98. package/dist/update-cmd.js +53 -2
  99. package/dist/web/standalone/.next/BUILD_ID +1 -1
  100. package/dist/web/standalone/.next/app-path-routes-manifest.json +5 -5
  101. package/dist/web/standalone/.next/build-manifest.json +2 -2
  102. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  103. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  104. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  105. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  106. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  107. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  108. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  109. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  110. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  111. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  112. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  113. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  114. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  115. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  116. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  117. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  118. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  119. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  120. package/dist/web/standalone/.next/server/app/index.html +1 -1
  121. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  122. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  123. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  124. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  125. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  126. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  127. package/dist/web/standalone/.next/server/app-paths-manifest.json +5 -5
  128. package/dist/web/standalone/.next/server/chunks/8357.js +1 -1
  129. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  130. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  131. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  132. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  133. package/package.json +5 -3
  134. package/packages/cloud-mcp-gateway/package.json +2 -2
  135. package/packages/contracts/dist/workflow.d.ts +14 -0
  136. package/packages/contracts/dist/workflow.d.ts.map +1 -1
  137. package/packages/contracts/dist/workflow.js +16 -0
  138. package/packages/contracts/dist/workflow.js.map +1 -1
  139. package/packages/contracts/package.json +1 -1
  140. package/packages/daemon/package.json +4 -4
  141. package/packages/gsd-agent-core/dist/agent-session.d.ts +9 -0
  142. package/packages/gsd-agent-core/dist/agent-session.d.ts.map +1 -1
  143. package/packages/gsd-agent-core/dist/agent-session.js +32 -0
  144. package/packages/gsd-agent-core/dist/agent-session.js.map +1 -1
  145. package/packages/gsd-agent-core/dist/index.d.ts +1 -0
  146. package/packages/gsd-agent-core/dist/index.d.ts.map +1 -1
  147. package/packages/gsd-agent-core/dist/index.js +1 -0
  148. package/packages/gsd-agent-core/dist/index.js.map +1 -1
  149. package/packages/gsd-agent-core/dist/session/agent-session-compaction.d.ts +2 -0
  150. package/packages/gsd-agent-core/dist/session/agent-session-compaction.d.ts.map +1 -1
  151. package/packages/gsd-agent-core/dist/session/agent-session-compaction.js +8 -2
  152. package/packages/gsd-agent-core/dist/session/agent-session-compaction.js.map +1 -1
  153. package/packages/gsd-agent-core/dist/session/agent-session-host.d.ts +7 -0
  154. package/packages/gsd-agent-core/dist/session/agent-session-host.d.ts.map +1 -1
  155. package/packages/gsd-agent-core/dist/session/agent-session-host.js.map +1 -1
  156. package/packages/gsd-agent-core/dist/session/agent-session-prompt.d.ts.map +1 -1
  157. package/packages/gsd-agent-core/dist/session/agent-session-prompt.js +69 -1
  158. package/packages/gsd-agent-core/dist/session/agent-session-prompt.js.map +1 -1
  159. package/packages/gsd-agent-core/dist/turn-latency.d.ts +47 -0
  160. package/packages/gsd-agent-core/dist/turn-latency.d.ts.map +1 -0
  161. package/packages/gsd-agent-core/dist/turn-latency.js +123 -0
  162. package/packages/gsd-agent-core/dist/turn-latency.js.map +1 -0
  163. package/packages/gsd-agent-core/package.json +6 -6
  164. package/packages/gsd-agent-modes/dist/modes/interactive/components/__prototype__/gsd-widget-prototype.d.ts +21 -0
  165. package/packages/gsd-agent-modes/dist/modes/interactive/components/__prototype__/gsd-widget-prototype.d.ts.map +1 -0
  166. package/packages/gsd-agent-modes/dist/modes/interactive/components/__prototype__/gsd-widget-prototype.js +213 -0
  167. package/packages/gsd-agent-modes/dist/modes/interactive/components/__prototype__/gsd-widget-prototype.js.map +1 -0
  168. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  169. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  170. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js +10 -0
  171. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js.map +1 -1
  172. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  173. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +5 -0
  174. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
  175. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts +1 -0
  176. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  177. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +92 -31
  178. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  179. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
  180. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js +7 -1
  181. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js.map +1 -1
  182. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-command-handlers.d.ts.map +1 -1
  183. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-command-handlers.js +6 -0
  184. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-command-handlers.js.map +1 -1
  185. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-dialogs.d.ts.map +1 -1
  186. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-dialogs.js +2 -0
  187. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
  188. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-class-constants.d.ts +1 -1
  189. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-class-constants.d.ts.map +1 -1
  190. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-class-constants.js +1 -1
  191. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-class-constants.js.map +1 -1
  192. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  193. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js +1 -0
  194. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js.map +1 -1
  195. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.d.ts.map +1 -1
  196. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.js +5 -0
  197. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.js.map +1 -1
  198. package/packages/gsd-agent-modes/package.json +7 -7
  199. package/packages/mcp-server/dist/remote-questions.d.ts.map +1 -1
  200. package/packages/mcp-server/dist/remote-questions.js +23 -9
  201. package/packages/mcp-server/dist/remote-questions.js.map +1 -1
  202. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  203. package/packages/mcp-server/dist/workflow-tools.js +84 -2
  204. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  205. package/packages/mcp-server/package.json +3 -3
  206. package/packages/native/package.json +1 -1
  207. package/packages/pi-agent-core/dist/agent-loop.js +42 -3
  208. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  209. package/packages/pi-agent-core/dist/agent.d.ts +5 -1
  210. package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
  211. package/packages/pi-agent-core/dist/agent.js +2 -0
  212. package/packages/pi-agent-core/dist/agent.js.map +1 -1
  213. package/packages/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  214. package/packages/pi-agent-core/dist/harness/agent-harness.js +3 -1
  215. package/packages/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  216. package/packages/pi-agent-core/dist/harness/types.d.ts +1 -0
  217. package/packages/pi-agent-core/dist/harness/types.d.ts.map +1 -1
  218. package/packages/pi-agent-core/dist/harness/types.js.map +1 -1
  219. package/packages/pi-agent-core/dist/types.d.ts +6 -1
  220. package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
  221. package/packages/pi-agent-core/dist/types.js.map +1 -1
  222. package/packages/pi-agent-core/package.json +1 -1
  223. package/packages/pi-ai/dist/api-registry.d.ts +2 -0
  224. package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
  225. package/packages/pi-ai/dist/api-registry.js +23 -0
  226. package/packages/pi-ai/dist/api-registry.js.map +1 -1
  227. package/packages/pi-ai/dist/image-models.generated.d.ts +15 -0
  228. package/packages/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  229. package/packages/pi-ai/dist/image-models.generated.js +15 -0
  230. package/packages/pi-ai/dist/image-models.generated.js.map +1 -1
  231. package/packages/pi-ai/dist/models.generated.d.ts +411 -39
  232. package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
  233. package/packages/pi-ai/dist/models.generated.js +504 -153
  234. package/packages/pi-ai/dist/models.generated.js.map +1 -1
  235. package/packages/pi-ai/dist/stream.js +6 -6
  236. package/packages/pi-ai/dist/stream.js.map +1 -1
  237. package/packages/pi-ai/package.json +1 -1
  238. package/packages/pi-coding-agent/dist/core/extensions/extension-upstream-types.d.ts +3 -0
  239. package/packages/pi-coding-agent/dist/core/extensions/extension-upstream-types.d.ts.map +1 -1
  240. package/packages/pi-coding-agent/dist/core/extensions/extension-upstream-types.js.map +1 -1
  241. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  242. package/packages/pi-coding-agent/dist/core/model-registry.js +2 -2
  243. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  244. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +3 -0
  245. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  246. package/packages/pi-coding-agent/dist/core/settings-manager.js +11 -0
  247. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  248. package/packages/pi-coding-agent/dist/core/tools/bash.js +2 -2
  249. package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  250. package/packages/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
  251. package/packages/pi-coding-agent/dist/core/tools/edit.js +3 -2
  252. package/packages/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
  253. package/packages/pi-coding-agent/dist/core/tools/render-utils.d.ts +1 -0
  254. package/packages/pi-coding-agent/dist/core/tools/render-utils.d.ts.map +1 -1
  255. package/packages/pi-coding-agent/dist/core/tools/render-utils.js +6 -0
  256. package/packages/pi-coding-agent/dist/core/tools/render-utils.js.map +1 -1
  257. package/packages/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
  258. package/packages/pi-coding-agent/dist/core/tools/write.js +3 -2
  259. package/packages/pi-coding-agent/dist/core/tools/write.js.map +1 -1
  260. package/packages/pi-coding-agent/package.json +7 -7
  261. package/packages/pi-tui/dist/terminal.d.ts +1 -0
  262. package/packages/pi-tui/dist/terminal.d.ts.map +1 -1
  263. package/packages/pi-tui/dist/terminal.js +8 -4
  264. package/packages/pi-tui/dist/terminal.js.map +1 -1
  265. package/packages/pi-tui/package.json +1 -1
  266. package/packages/rpc-client/package.json +2 -2
  267. package/pkg/package.json +1 -1
  268. package/src/resources/extensions/browser-tools/engine/managed-gsd-browser.ts +579 -0
  269. package/src/resources/extensions/browser-tools/engine/selection.ts +19 -0
  270. package/src/resources/extensions/browser-tools/extension-manifest.json +2 -2
  271. package/src/resources/extensions/browser-tools/index.ts +60 -9
  272. package/src/resources/extensions/browser-tools/package.json +5 -1
  273. package/src/resources/extensions/browser-tools/tests/browser-engine-selection.test.mjs +35 -0
  274. package/src/resources/extensions/browser-tools/tests/managed-gsd-browser-tools.test.mjs +33 -0
  275. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +196 -16
  276. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +239 -63
  277. package/src/resources/extensions/gsd/auto/orchestrator.ts +0 -1
  278. package/src/resources/extensions/gsd/auto/phases.ts +5 -3
  279. package/src/resources/extensions/gsd/auto-dashboard.ts +98 -18
  280. package/src/resources/extensions/gsd/auto-dispatch.ts +67 -0
  281. package/src/resources/extensions/gsd/auto-post-unit.ts +166 -9
  282. package/src/resources/extensions/gsd/auto-prompts.ts +106 -15
  283. package/src/resources/extensions/gsd/auto-recovery.ts +7 -7
  284. package/src/resources/extensions/gsd/auto-runtime-state.ts +4 -0
  285. package/src/resources/extensions/gsd/auto-start.ts +112 -17
  286. package/src/resources/extensions/gsd/auto-tool-tracking.ts +1 -1
  287. package/src/resources/extensions/gsd/auto-unit-tool-scope.ts +43 -73
  288. package/src/resources/extensions/gsd/auto-worktree.ts +23 -5
  289. package/src/resources/extensions/gsd/auto.ts +47 -5
  290. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +96 -4
  291. package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +51 -0
  292. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +81 -25
  293. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +70 -63
  294. package/src/resources/extensions/gsd/browser-evidence.ts +26 -2
  295. package/src/resources/extensions/gsd/closeout-consistency-gate.ts +137 -0
  296. package/src/resources/extensions/gsd/commands/catalog.ts +6 -1
  297. package/src/resources/extensions/gsd/commands/handlers/core.ts +6 -2
  298. package/src/resources/extensions/gsd/commands/handlers/ops.ts +9 -5
  299. package/src/resources/extensions/gsd/commands-handlers.ts +76 -11
  300. package/src/resources/extensions/gsd/commands-maintenance.ts +197 -2
  301. package/src/resources/extensions/gsd/commands-mcp-status.ts +136 -58
  302. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +4 -1
  303. package/src/resources/extensions/gsd/commands-verdict.ts +1 -1
  304. package/src/resources/extensions/gsd/config-overlay.ts +3 -1
  305. package/src/resources/extensions/gsd/dashboard-overlay.ts +28 -7
  306. package/src/resources/extensions/gsd/docs/preferences-reference.md +8 -0
  307. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +2 -2
  308. package/src/resources/extensions/gsd/error-classifier.ts +2 -1
  309. package/src/resources/extensions/gsd/escalation.ts +4 -4
  310. package/src/resources/extensions/gsd/exec-sandbox.ts +4 -0
  311. package/src/resources/extensions/gsd/forensics.ts +99 -5
  312. package/src/resources/extensions/gsd/gsd-db.ts +46 -8
  313. package/src/resources/extensions/gsd/guided-flow.ts +215 -217
  314. package/src/resources/extensions/gsd/mcp-filter.ts +3 -0
  315. package/src/resources/extensions/gsd/mcp-project-config.ts +105 -88
  316. package/src/resources/extensions/gsd/memory-store.ts +4 -1
  317. package/src/resources/extensions/gsd/migration-auto-check.ts +2 -2
  318. package/src/resources/extensions/gsd/milestone-closeout.ts +3 -1
  319. package/src/resources/extensions/gsd/pending-auto-start.ts +0 -2
  320. package/src/resources/extensions/gsd/post-unit-hooks.ts +14 -1
  321. package/src/resources/extensions/gsd/preferences-types.ts +1 -1
  322. package/src/resources/extensions/gsd/preferences-validation.ts +36 -0
  323. package/src/resources/extensions/gsd/prompt-loader.ts +8 -0
  324. package/src/resources/extensions/gsd/prompts/forensics.md +61 -1
  325. package/src/resources/extensions/gsd/prompts/gate-evaluate.md +3 -1
  326. package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +3 -1
  327. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  328. package/src/resources/extensions/gsd/prompts/reactive-execute.md +3 -1
  329. package/src/resources/extensions/gsd/prompts/run-uat.md +33 -23
  330. package/src/resources/extensions/gsd/prompts/system.md +3 -1
  331. package/src/resources/extensions/gsd/prompts/validate-milestone.md +3 -3
  332. package/src/resources/extensions/gsd/recovery-classification.ts +20 -0
  333. package/src/resources/extensions/gsd/rule-registry.ts +558 -58
  334. package/src/resources/extensions/gsd/rule-types.ts +2 -0
  335. package/src/resources/extensions/gsd/safety/destructive-guard.ts +3 -0
  336. package/src/resources/extensions/gsd/skill-activation.ts +20 -2
  337. package/src/resources/extensions/gsd/state-reconciliation/drift/artifact-db.ts +4 -2
  338. package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +1 -1
  339. package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +20 -0
  340. package/src/resources/extensions/gsd/state-reconciliation/index.ts +6 -0
  341. package/src/resources/extensions/gsd/state-reconciliation/types.ts +1 -0
  342. package/src/resources/extensions/gsd/state.ts +18 -14
  343. package/src/resources/extensions/gsd/templates/plan.md +3 -1
  344. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +156 -4
  345. package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +123 -0
  346. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +10 -2
  347. package/src/resources/extensions/gsd/tests/auto-start-bootstrap-await-3420.test.ts +4 -1
  348. package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +143 -2
  349. package/src/resources/extensions/gsd/tests/auto-start-project-milestone-reconcile.test.ts +24 -2
  350. package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +12 -2
  351. package/src/resources/extensions/gsd/tests/browser-evidence.test.ts +142 -0
  352. package/src/resources/extensions/gsd/tests/check-auto-start-pending-gate.test.ts +9 -15
  353. package/src/resources/extensions/gsd/tests/check-auto-start-ready-guard.test.ts +26 -16
  354. package/src/resources/extensions/gsd/tests/commands-dispatcher-unmerged-milestone.test.ts +21 -0
  355. package/src/resources/extensions/gsd/tests/commands-dispatcher-validation-block.test.ts +38 -3
  356. package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +6 -2
  357. package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +30 -0
  358. package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +42 -0
  359. package/src/resources/extensions/gsd/tests/dashboard-overlay.test.ts +45 -0
  360. package/src/resources/extensions/gsd/tests/deep-planning-mode-dispatch.test.ts +53 -0
  361. package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +8 -0
  362. package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +50 -13
  363. package/src/resources/extensions/gsd/tests/discuss-milestone-structured-questions.test.ts +31 -0
  364. package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +40 -1
  365. package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +60 -0
  366. package/src/resources/extensions/gsd/tests/doctor-runtime-checks.test.ts +27 -0
  367. package/src/resources/extensions/gsd/tests/escalation.test.ts +16 -27
  368. package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +18 -0
  369. package/src/resources/extensions/gsd/tests/exec-tool.test.ts +69 -0
  370. package/src/resources/extensions/gsd/tests/forensics-issue-routing.test.ts +20 -0
  371. package/src/resources/extensions/gsd/tests/forensics-prompt-rendering.test.ts +3 -0
  372. package/src/resources/extensions/gsd/tests/forensics-tool-scope.test.ts +69 -0
  373. package/src/resources/extensions/gsd/tests/gate-1b-orphan-discrimination.test.ts +31 -79
  374. package/src/resources/extensions/gsd/tests/gsd-rebuild.test.ts +199 -0
  375. package/src/resources/extensions/gsd/tests/gsd-recover.test.ts +75 -0
  376. package/src/resources/extensions/gsd/tests/guided-discuss-milestone-prompt-rendering.test.ts +40 -1
  377. package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +86 -0
  378. package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +5 -3
  379. package/src/resources/extensions/gsd/tests/guided-flow-state-rebuild.test.ts +40 -4
  380. package/src/resources/extensions/gsd/tests/guided-flow.test.ts +12 -9
  381. package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +4 -4
  382. package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +8 -0
  383. package/src/resources/extensions/gsd/tests/integration/parallel-merge.test.ts +16 -0
  384. package/src/resources/extensions/gsd/tests/integration/run-uat.test.ts +72 -10
  385. package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +13 -6
  386. package/src/resources/extensions/gsd/tests/mcp-filter.test.ts +15 -0
  387. package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +100 -0
  388. package/src/resources/extensions/gsd/tests/mcp-status.test.ts +179 -0
  389. package/src/resources/extensions/gsd/tests/memory-maintenance.test.ts +39 -8
  390. package/src/resources/extensions/gsd/tests/merge-closeout-consistency-gate.test.ts +63 -0
  391. package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +10 -1
  392. package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +3 -3
  393. package/src/resources/extensions/gsd/tests/milestone-closeout.test.ts +9 -1
  394. package/src/resources/extensions/gsd/tests/new-milestone-discuss-routing.test.ts +3 -3
  395. package/src/resources/extensions/gsd/tests/parallel-skill-prompt-integration.test.ts +54 -7
  396. package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +9 -0
  397. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +39 -1
  398. package/src/resources/extensions/gsd/tests/post-unit-hooks.test.ts +157 -0
  399. package/src/resources/extensions/gsd/tests/post-unit-retry-on-orchestrator-bridge.test.ts +179 -0
  400. package/src/resources/extensions/gsd/tests/preferences.test.ts +29 -0
  401. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +83 -1
  402. package/src/resources/extensions/gsd/tests/prompt-loader-extension-dir.test.ts +14 -0
  403. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +18 -1
  404. package/src/resources/extensions/gsd/tests/queued-discuss-fast-path.test.ts +7 -8
  405. package/src/resources/extensions/gsd/tests/reactive-executor.test.ts +36 -0
  406. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +79 -0
  407. package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +1 -1
  408. package/src/resources/extensions/gsd/tests/rule-registry.test.ts +75 -0
  409. package/src/resources/extensions/gsd/tests/run-uat-composer.test.ts +4 -0
  410. package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +36 -0
  411. package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +100 -0
  412. package/src/resources/extensions/gsd/tests/skill-activation.test.ts +55 -0
  413. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +6 -2
  414. package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +191 -0
  415. package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +84 -10
  416. package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +19 -0
  417. package/src/resources/extensions/gsd/tests/tool-naming.test.ts +12 -2
  418. package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +7 -1
  419. package/src/resources/extensions/gsd/tests/tui-header-lifecycle.test.ts +29 -6
  420. package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +29 -6
  421. package/src/resources/extensions/gsd/tests/validate-milestone-prompt-verification-classes.test.ts +6 -3
  422. package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +133 -0
  423. package/src/resources/extensions/gsd/tests/validation-block-guard.test.ts +21 -0
  424. package/src/resources/extensions/gsd/tests/verification-gate.test.ts +51 -0
  425. package/src/resources/extensions/gsd/tests/workflow-mcp-auto-prep.test.ts +17 -2
  426. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +493 -0
  427. package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +40 -0
  428. package/src/resources/extensions/gsd/tool-contract.ts +6 -0
  429. package/src/resources/extensions/gsd/tool-presentation-plan.ts +223 -0
  430. package/src/resources/extensions/gsd/tools/complete-slice.ts +14 -1
  431. package/src/resources/extensions/gsd/tools/complete-task.ts +20 -2
  432. package/src/resources/extensions/gsd/tools/exec-tool.ts +130 -0
  433. package/src/resources/extensions/gsd/tools/plan-slice.ts +14 -9
  434. package/src/resources/extensions/gsd/tools/reopen-milestone.ts +2 -2
  435. package/src/resources/extensions/gsd/tools/validate-milestone.ts +46 -15
  436. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +589 -8
  437. package/src/resources/extensions/gsd/types.ts +69 -5
  438. package/src/resources/extensions/gsd/unit-context-manifest.ts +14 -5
  439. package/src/resources/extensions/gsd/unit-tool-contracts.ts +186 -0
  440. package/src/resources/extensions/gsd/validation-block-guard.ts +2 -0
  441. package/src/resources/extensions/gsd/verdict-parser.ts +54 -13
  442. package/src/resources/extensions/gsd/verification-gate.ts +87 -1
  443. package/src/resources/extensions/gsd/workflow-mcp-auto-prep.ts +2 -1
  444. package/src/resources/extensions/gsd/workflow-mcp.ts +5 -73
  445. package/src/resources/extensions/gsd/worktree-lifecycle.ts +26 -0
  446. package/src/resources/extensions/mcp-client/manager.ts +33 -1
  447. package/src/resources/extensions/mcp-client/tests/manager.test.ts +35 -0
  448. package/src/resources/extensions/shared/gsd-browser-cli.ts +172 -0
  449. package/src/resources/extensions/gsd/tests/gate-1b-recovery-bound-corrections.test.ts +0 -246
  450. package/src/resources/extensions/gsd/tests/gate-1b-recovery-bound.test.ts +0 -218
  451. /package/dist/web/standalone/.next/static/{L9N5SPFi7f-Ne4u2uXzCe → h4TGni4xJzlZjGkxaT6uU}/_buildManifest.js +0 -0
  452. /package/dist/web/standalone/.next/static/{L9N5SPFi7f-Ne4u2uXzCe → h4TGni4xJzlZjGkxaT6uU}/_ssgManifest.js +0 -0
@@ -0,0 +1,223 @@
1
+ // Project/App: gsd-pi
2
+ // File Purpose: Resolve phase-aware tool surfaces for GSD model presentations.
3
+
4
+ import {
5
+ RUN_UAT_BROWSER_TOOL_NAMES,
6
+ RUN_UAT_READ_ONLY_TOOL_NAMES,
7
+ RUN_UAT_TOOL_PRESENTATION_PLAN_ID,
8
+ RUN_UAT_WORKFLOW_TOOL_NAMES,
9
+ } from "./unit-tool-contracts.js";
10
+
11
+ export {
12
+ RUN_UAT_BROWSER_TOOL_NAMES,
13
+ RUN_UAT_READ_ONLY_TOOL_NAMES,
14
+ RUN_UAT_TOOL_PRESENTATION_PLAN_ID,
15
+ RUN_UAT_WORKFLOW_TOOL_NAMES,
16
+ } from "./unit-tool-contracts.js";
17
+
18
+ export type ToolPresentationSurface = "provider-tools" | "claude-code-sdk" | "mcp" | "hybrid";
19
+
20
+ export interface ToolPresentationModel {
21
+ provider?: string;
22
+ api?: string;
23
+ id?: string;
24
+ }
25
+
26
+ export interface ToolPresentationPlan {
27
+ phase: string;
28
+ surface: ToolPresentationSurface;
29
+ model?: ToolPresentationModel;
30
+ allowedToolNames: string[];
31
+ presentedToolNames: string[];
32
+ blockedToolNames: Array<{ name: string; reason: string }>;
33
+ aliases: Array<{ requested: string; canonical: string }>;
34
+ diagnostics: string[];
35
+ }
36
+
37
+ export interface RunUatResultPresentation {
38
+ surface: ToolPresentationSurface;
39
+ presentedTools: string[];
40
+ blockedTools: Array<{ name: string; reason: string }>;
41
+ toolPresentationPlanId: string;
42
+ }
43
+
44
+ export const RUN_UAT_FORBIDDEN_TOOL_NAMES = [
45
+ "edit",
46
+ "write",
47
+ "gsd_exec",
48
+ "gsd_summary_save",
49
+ "gsd_save_gate_result",
50
+ "search-the-web",
51
+ "WebSearch",
52
+ "Bash",
53
+ "Write",
54
+ "Edit",
55
+ "mcp__gsd-workflow__*",
56
+ ] as const;
57
+
58
+ export const RUN_UAT_CLAUDE_NATIVE_TOOL_NAMES = [
59
+ "Read",
60
+ "Glob",
61
+ "Grep",
62
+ ] as const;
63
+
64
+ const WORKFLOW_ALIAS_TO_CANONICAL: Record<string, string> = {
65
+ gsd_save_decision: "gsd_decision_save",
66
+ gsd_update_requirement: "gsd_requirement_update",
67
+ gsd_save_requirement: "gsd_requirement_save",
68
+ gsd_save_summary: "gsd_summary_save",
69
+ gsd_generate_milestone_id: "gsd_milestone_generate_id",
70
+ gsd_milestone_plan: "gsd_plan_milestone",
71
+ gsd_slice_plan: "gsd_plan_slice",
72
+ gsd_task_plan: "gsd_plan_task",
73
+ gsd_slice_replan: "gsd_replan_slice",
74
+ gsd_complete_slice: "gsd_slice_complete",
75
+ gsd_milestone_complete: "gsd_complete_milestone",
76
+ gsd_milestone_validate: "gsd_validate_milestone",
77
+ gsd_roadmap_reassess: "gsd_reassess_roadmap",
78
+ gsd_complete_task: "gsd_task_complete",
79
+ gsd_reopen_task: "gsd_task_reopen",
80
+ gsd_reopen_slice: "gsd_slice_reopen",
81
+ gsd_reopen_milestone: "gsd_milestone_reopen",
82
+ };
83
+
84
+ export function canonicalWorkflowToolName(toolName: string): string {
85
+ const mcp = parseMcpToolName(toolName);
86
+ const baseName = mcp?.tool ?? toolName;
87
+ return WORKFLOW_ALIAS_TO_CANONICAL[baseName] ?? baseName;
88
+ }
89
+
90
+ export function parseMcpToolName(toolName: string): { server: string; tool: string } | null {
91
+ if (!toolName.startsWith("mcp__")) return null;
92
+ const toolSeparator = toolName.indexOf("__", "mcp__".length);
93
+ if (toolSeparator < 0) return null;
94
+ return {
95
+ server: toolName.slice("mcp__".length, toolSeparator),
96
+ tool: toolName.slice(toolSeparator + 2),
97
+ };
98
+ }
99
+
100
+ export function toWorkflowMcpToolName(serverName: string, toolName: string): string {
101
+ return `mcp__${serverName}__${canonicalWorkflowToolName(toolName)}`;
102
+ }
103
+
104
+ function dedupe(values: readonly string[]): string[] {
105
+ return [...new Set(values)];
106
+ }
107
+
108
+ function addBlockedTool(
109
+ blocked: ToolPresentationPlan["blockedToolNames"],
110
+ name: string,
111
+ reason: string,
112
+ ): void {
113
+ if (!blocked.some((entry) => entry.name === name)) {
114
+ blocked.push({ name, reason });
115
+ }
116
+ }
117
+
118
+ export function buildRunUatCanonicalToolNames(options: { includeBrowserTools?: readonly string[] } = {}): string[] {
119
+ return dedupe([
120
+ ...RUN_UAT_WORKFLOW_TOOL_NAMES,
121
+ ...RUN_UAT_READ_ONLY_TOOL_NAMES,
122
+ ...(options.includeBrowserTools ?? []),
123
+ ]);
124
+ }
125
+
126
+ export function runUatBrowserToolsForType(uatType: string | undefined): readonly string[] {
127
+ return uatType === "browser-executable" ? RUN_UAT_BROWSER_TOOL_NAMES : [];
128
+ }
129
+
130
+ export function runUatPresentationSurfaceForType(uatType: string | undefined): ToolPresentationSurface {
131
+ return uatType === "browser-executable" ? "hybrid" : "mcp";
132
+ }
133
+
134
+ export function buildRunUatPresentationForType(
135
+ uatType: string | undefined,
136
+ options: {
137
+ surface?: ToolPresentationSurface;
138
+ presentedTools?: readonly string[];
139
+ } = {},
140
+ ): RunUatResultPresentation {
141
+ return buildRunUatResultPresentation({
142
+ ...options,
143
+ surface: options.surface ?? runUatPresentationSurfaceForType(uatType),
144
+ includeBrowserTools: runUatBrowserToolsForType(uatType),
145
+ });
146
+ }
147
+
148
+ export function buildRunUatResultPresentation(options: {
149
+ surface?: ToolPresentationSurface;
150
+ includeBrowserTools?: readonly string[];
151
+ presentedTools?: readonly string[];
152
+ } = {}): RunUatResultPresentation {
153
+ const presentedTools = options.presentedTools
154
+ ? dedupe(options.presentedTools)
155
+ : buildRunUatCanonicalToolNames({ includeBrowserTools: options.includeBrowserTools });
156
+ const blockedTools = RUN_UAT_FORBIDDEN_TOOL_NAMES
157
+ .filter((toolName) => !toolName.includes("*"))
158
+ .map((name) => ({ name, reason: "forbidden during run-uat" }));
159
+
160
+ return {
161
+ surface: options.surface ?? "mcp",
162
+ presentedTools,
163
+ blockedTools,
164
+ toolPresentationPlanId: RUN_UAT_TOOL_PRESENTATION_PLAN_ID,
165
+ };
166
+ }
167
+
168
+ export function resolveToolPresentationPlan(options: {
169
+ phase: string;
170
+ surface: ToolPresentationSurface;
171
+ model?: ToolPresentationModel;
172
+ workflowMcpServerName?: string | null;
173
+ requestedToolNames?: readonly string[];
174
+ availableToolNames?: readonly string[];
175
+ includeBrowserTools?: readonly string[];
176
+ }): ToolPresentationPlan {
177
+ const requested = options.requestedToolNames ?? (
178
+ options.phase === "run-uat"
179
+ ? buildRunUatCanonicalToolNames({ includeBrowserTools: options.includeBrowserTools })
180
+ : []
181
+ );
182
+ const available = new Set(options.availableToolNames ?? requested);
183
+ const aliases: ToolPresentationPlan["aliases"] = [];
184
+ const blockedToolNames: ToolPresentationPlan["blockedToolNames"] = [];
185
+ const allowed: string[] = [];
186
+
187
+ for (const name of requested) {
188
+ const canonical = canonicalWorkflowToolName(name);
189
+ if (canonical !== name) aliases.push({ requested: name, canonical });
190
+ if (!available.has(name) && !available.has(canonical)) {
191
+ addBlockedTool(blockedToolNames, canonical, "not registered or provider-incompatible");
192
+ continue;
193
+ }
194
+ allowed.push(canonical);
195
+ }
196
+
197
+ const allowedToolNames = dedupe(allowed);
198
+ const workflowServerName = options.workflowMcpServerName || "gsd-workflow";
199
+ const presentedToolNames = options.surface === "claude-code-sdk" || options.surface === "mcp"
200
+ ? allowedToolNames.map((name) =>
201
+ name.startsWith("gsd_") || name === "ask_user_questions"
202
+ ? toWorkflowMcpToolName(workflowServerName, name)
203
+ : name
204
+ )
205
+ : allowedToolNames;
206
+
207
+ if (options.phase === "run-uat") {
208
+ for (const forbidden of RUN_UAT_FORBIDDEN_TOOL_NAMES) {
209
+ addBlockedTool(blockedToolNames, forbidden, "forbidden during run-uat");
210
+ }
211
+ }
212
+
213
+ return {
214
+ phase: options.phase,
215
+ surface: options.surface,
216
+ model: options.model,
217
+ allowedToolNames,
218
+ presentedToolNames,
219
+ blockedToolNames,
220
+ aliases,
221
+ diagnostics: [],
222
+ };
223
+ }
@@ -217,7 +217,7 @@ ${params.narrative}
217
217
 
218
218
  ## Verification
219
219
 
220
- ${params.verification}
220
+ ${params.verification ?? ""}
221
221
 
222
222
  ## Requirements Advanced
223
223
 
@@ -440,6 +440,19 @@ export async function handleCompleteSlice(
440
440
  const parsed = parseRequirementSection(existingSummaryMd, "Requirements Invalidated or Re-scoped", "what");
441
441
  if (parsed.length > 0) effectiveParams.requirementsInvalidated = parsed as Array<{ id: string; what: string }>;
442
442
  }
443
+ if (effectiveParams.verification === undefined) {
444
+ const headingLine = "## Verification\n\n";
445
+ const start = existingSummaryMd.indexOf(headingLine);
446
+ if (start !== -1) {
447
+ const contentStart = start + headingLine.length;
448
+ const nextHeading = existingSummaryMd.indexOf("\n\n## ", contentStart);
449
+ const prior = nextHeading === -1
450
+ ? existingSummaryMd.slice(contentStart)
451
+ : existingSummaryMd.slice(contentStart, nextHeading);
452
+ const trimmed = prior.trim();
453
+ if (trimmed) effectiveParams.verification = trimmed;
454
+ }
455
+ }
443
456
  }
444
457
 
445
458
  // Render summary markdown
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { join } from "node:path";
14
14
 
15
- import type { CompleteTaskParams } from "../types.js";
15
+ import type { CompleteTaskParams, EscalationArtifact } from "../types.js";
16
16
  import { isClosedStatus } from "../status-guards.js";
17
17
  import {
18
18
  transaction,
@@ -48,6 +48,14 @@ export interface CompleteTaskResult {
48
48
  sliceId: string;
49
49
  milestoneId: string;
50
50
  summaryPath: string;
51
+ escalation?: {
52
+ artifactPath: string;
53
+ question: string;
54
+ options: EscalationArtifact["options"];
55
+ recommendation: string;
56
+ recommendationRationale: string;
57
+ continueWithDefault: boolean;
58
+ };
51
59
  /**
52
60
  * True when this call re-completed an already-closed task from a turn that
53
61
  * had been superseded by timeout recovery or cancellation. The underlying
@@ -407,9 +415,18 @@ export async function handleCompleteTask(
407
415
  // overwrite it; gate rows are UPSERT-keyed per task and will also be
408
416
  // overwritten. This restores the invariant that deriveState() sees a
409
417
  // consistent "task not done" view so the loop re-dispatches the task.
418
+ let escalationMetadata: CompleteTaskResult["escalation"] | undefined;
410
419
  if (validatedEscalationArtifact) {
411
420
  try {
412
- writeEscalationArtifact(artifactBasePath, validatedEscalationArtifact);
421
+ const escalationPath = writeEscalationArtifact(artifactBasePath, validatedEscalationArtifact);
422
+ escalationMetadata = {
423
+ artifactPath: escalationPath,
424
+ question: validatedEscalationArtifact.question,
425
+ options: validatedEscalationArtifact.options,
426
+ recommendation: validatedEscalationArtifact.recommendation,
427
+ recommendationRationale: validatedEscalationArtifact.recommendationRationale,
428
+ continueWithDefault: validatedEscalationArtifact.continueWithDefault,
429
+ };
413
430
  } catch (escalationErr) {
414
431
  const msg = `complete-task escalation write failed for ${params.milestoneId}/${params.sliceId}/${params.taskId}: ${(escalationErr as Error).message}`;
415
432
  logWarning("tool", msg);
@@ -477,6 +494,7 @@ export async function handleCompleteTask(
477
494
  sliceId: params.sliceId,
478
495
  milestoneId: params.milestoneId,
479
496
  summaryPath,
497
+ ...(escalationMetadata ? { escalation: escalationMetadata } : {}),
480
498
  ...(projectionStale ? { stale: true } : {}),
481
499
  };
482
500
  }
@@ -20,6 +20,7 @@ export interface ExecToolParams {
20
20
  cmd?: unknown;
21
21
  code?: unknown;
22
22
  purpose?: string;
23
+ metadata?: Record<string, unknown>;
23
24
  timeout_ms?: number;
24
25
  }
25
26
 
@@ -33,6 +34,44 @@ export interface ExecToolDeps {
33
34
  generateId?: () => string;
34
35
  }
35
36
 
37
+ export type UatExecIntent =
38
+ | "uat-artifact-check"
39
+ | "uat-runtime-check"
40
+ | "uat-browser-check"
41
+ | "uat-service-start"
42
+ | "uat-log-inspection";
43
+
44
+ export interface UatExecToolParams extends ExecToolParams {
45
+ milestoneId?: unknown;
46
+ sliceId?: unknown;
47
+ checkId?: unknown;
48
+ intent?: unknown;
49
+ expected?: unknown;
50
+ }
51
+
52
+ const UAT_EXEC_INTENTS: readonly UatExecIntent[] = [
53
+ "uat-artifact-check",
54
+ "uat-runtime-check",
55
+ "uat-browser-check",
56
+ "uat-service-start",
57
+ "uat-log-inspection",
58
+ ] as const;
59
+
60
+ const UAT_EXEC_INTENT_ALIASES: Record<string, UatExecIntent> = {
61
+ artifact: "uat-artifact-check",
62
+ "artifact-driven": "uat-artifact-check",
63
+ runtime: "uat-runtime-check",
64
+ "runtime-executable": "uat-runtime-check",
65
+ "live-runtime": "uat-runtime-check",
66
+ browser: "uat-browser-check",
67
+ "browser-executable": "uat-browser-check",
68
+ service: "uat-service-start",
69
+ "service-start": "uat-service-start",
70
+ log: "uat-log-inspection",
71
+ logs: "uat-log-inspection",
72
+ "log-inspection": "uat-log-inspection",
73
+ };
74
+
36
75
  export function buildExecOptions(
37
76
  baseDir: string,
38
77
  cfg: ContextModeConfig | undefined,
@@ -112,6 +151,39 @@ function normalizeScript(params: ExecToolParams): string | ToolExecutionResult {
112
151
  return paramError("script is required and must be a non-empty string");
113
152
  }
114
153
 
154
+ function normalizeRequiredString(value: unknown, field: string): string | ToolExecutionResult {
155
+ if (typeof value !== "string" || value.trim().length === 0) {
156
+ return paramError(`${field} is required and must be a non-empty string`);
157
+ }
158
+ return value.trim();
159
+ }
160
+
161
+ function normalizeUatIntent(value: unknown): UatExecIntent | ToolExecutionResult {
162
+ if (typeof value !== "string") {
163
+ return paramError(`intent is required and must be one of: ${UAT_EXEC_INTENTS.join(", ")}`);
164
+ }
165
+ const normalized = value.trim().toLowerCase();
166
+ if ((UAT_EXEC_INTENTS as readonly string[]).includes(normalized)) return normalized as UatExecIntent;
167
+ const alias = UAT_EXEC_INTENT_ALIASES[normalized];
168
+ if (alias) return alias;
169
+ return paramError(`invalid intent "${value}" — must be one of: ${UAT_EXEC_INTENTS.join(", ")}`);
170
+ }
171
+
172
+ function rejectUatScript(script: string): string | null {
173
+ const patterns: Array<{ re: RegExp; reason: string }> = [
174
+ { re: /\b(?:npm|pnpm|yarn|bun)\s+(?:i|install|add|remove|update|upgrade)\b/i, reason: "package dependency mutation is not allowed during UAT" },
175
+ { re: /\b(?:pip|pip3|python\s+-m\s+pip)\s+install\b/i, reason: "package dependency mutation is not allowed during UAT" },
176
+ { re: /\bgit\s+(?:add|commit|push|reset|checkout|switch|merge|rebase|clean|rm|mv|tag|branch)\b/i, reason: "git mutations are not allowed during UAT" },
177
+ { re: /\brm\s+-[^\n\r;|&]*r[^\n\r;|&]*f\b/i, reason: "destructive filesystem cleanup is not allowed during UAT" },
178
+ { re: /\b(?:env|printenv)\b(?:\s|$)/i, reason: "dumping environment variables is not allowed during UAT" },
179
+ { re: /\bcat\s+\.env(?:\b|\.|$)/i, reason: "reading credential files is not allowed during UAT" },
180
+ ];
181
+ for (const pattern of patterns) {
182
+ if (pattern.re.test(script)) return pattern.reason;
183
+ }
184
+ return null;
185
+ }
186
+
115
187
  function isToolExecutionResult(value: unknown): value is ToolExecutionResult {
116
188
  return typeof value === "object" && value !== null && Array.isArray((value as { content?: unknown }).content);
117
189
  }
@@ -266,6 +338,7 @@ export async function executeGsdExec(
266
338
  runtime,
267
339
  script,
268
340
  ...(typeof params.purpose === "string" ? { purpose: params.purpose } : {}),
341
+ ...(params.metadata && typeof params.metadata === "object" ? { metadata: params.metadata } : {}),
269
342
  ...(typeof params.timeout_ms === "number" ? { timeout_ms: params.timeout_ms } : {}),
270
343
  },
271
344
  opts,
@@ -281,6 +354,63 @@ export async function executeGsdExec(
281
354
  }
282
355
  }
283
356
 
357
+ export async function executeUatExec(
358
+ params: UatExecToolParams,
359
+ deps: ExecToolDeps,
360
+ ): Promise<ToolExecutionResult> {
361
+ const milestoneId = normalizeRequiredString(params.milestoneId, "milestoneId");
362
+ if (isToolExecutionResult(milestoneId)) return milestoneId;
363
+ const sliceId = normalizeRequiredString(params.sliceId, "sliceId");
364
+ if (isToolExecutionResult(sliceId)) return sliceId;
365
+ const checkId = normalizeRequiredString(params.checkId, "checkId");
366
+ if (isToolExecutionResult(checkId)) return checkId;
367
+ const intent = normalizeUatIntent(params.intent);
368
+ if (isToolExecutionResult(intent)) return intent;
369
+ const script = normalizeScript(params);
370
+ if (isToolExecutionResult(script)) return script;
371
+ const rejected = rejectUatScript(script);
372
+ if (rejected) {
373
+ return {
374
+ content: [{ type: "text", text: `Error: gsd_uat_exec blocked command — ${rejected}` }],
375
+ details: { operation: "gsd_uat_exec", error: "uat_exec_policy_block", reason: rejected },
376
+ isError: true,
377
+ };
378
+ }
379
+
380
+ const result = await executeGsdExec(
381
+ {
382
+ ...params,
383
+ script,
384
+ purpose: typeof params.purpose === "string" && params.purpose.trim().length > 0
385
+ ? params.purpose
386
+ : `UAT ${milestoneId}/${sliceId}/${checkId} (${intent})`,
387
+ metadata: {
388
+ kind: "uat_exec",
389
+ milestoneId,
390
+ sliceId,
391
+ checkId,
392
+ intent,
393
+ ...(typeof params.expected === "string" && params.expected.trim().length > 0
394
+ ? { expected: params.expected.trim() }
395
+ : {}),
396
+ },
397
+ },
398
+ deps,
399
+ );
400
+ const details = result.details ?? {};
401
+ return {
402
+ ...result,
403
+ details: {
404
+ ...details,
405
+ operation: "gsd_uat_exec",
406
+ milestoneId,
407
+ sliceId,
408
+ checkId,
409
+ intent,
410
+ },
411
+ };
412
+ }
413
+
284
414
  function formatResult(result: ExecSandboxResult): ToolExecutionResult {
285
415
  const headerLines = [
286
416
  `gsd_exec[${result.id}] runtime=${result.runtime} exit=${formatExit(result)} duration=${result.duration_ms}ms`,
@@ -355,15 +355,9 @@ export async function handlePlanSlice(
355
355
  deleteTask(params.milestoneId, params.sliceId, taskId);
356
356
  }
357
357
 
358
+ const existingTaskById = new Map(existingTasks.map((task) => [task.id, task]));
358
359
  for (const task of params.tasks) {
359
- insertTask({
360
- id: task.taskId,
361
- sliceId: params.sliceId,
362
- milestoneId: params.milestoneId,
363
- title: task.title,
364
- status: "pending",
365
- });
366
- upsertTaskPlanning(params.milestoneId, params.sliceId, task.taskId, {
360
+ const planning = {
367
361
  title: task.title,
368
362
  description: task.description,
369
363
  estimate: task.estimate,
@@ -374,7 +368,18 @@ export async function handlePlanSlice(
374
368
  observabilityImpact: task.observabilityImpact ?? "",
375
369
  fullPlanMd: task.fullPlanMd,
376
370
  targetRepositories: task.targetRepositories ?? params.targetRepositories ?? defaultTargets,
377
- });
371
+ };
372
+ const existingTask = existingTaskById.get(task.taskId);
373
+ if (!existingTask || !isClosedStatus(existingTask.status)) {
374
+ insertTask({
375
+ id: task.taskId,
376
+ sliceId: params.sliceId,
377
+ milestoneId: params.milestoneId,
378
+ title: task.title,
379
+ status: "pending",
380
+ });
381
+ }
382
+ upsertTaskPlanning(params.milestoneId, params.sliceId, task.taskId, planning);
378
383
  }
379
384
 
380
385
  // Seed quality gate rows inside the transaction — all-or-nothing with
@@ -13,7 +13,7 @@ import {
13
13
  getMilestone,
14
14
  getMilestoneSlices,
15
15
  getSliceTasks,
16
- updateMilestoneStatus,
16
+ reopenMilestoneStatus,
17
17
  updateSliceStatus,
18
18
  updateTaskStatus,
19
19
  transaction,
@@ -69,7 +69,7 @@ export async function handleReopenMilestone(
69
69
  return;
70
70
  }
71
71
 
72
- updateMilestoneStatus(params.milestoneId, "active", null);
72
+ reopenMilestoneStatus(params.milestoneId);
73
73
 
74
74
  const slices = getMilestoneSlices(params.milestoneId);
75
75
  slicesResetCount = slices.length;
@@ -78,18 +78,10 @@ function getRequiredVerificationClasses(milestoneId: string): string[] {
78
78
  return required;
79
79
  }
80
80
 
81
- async function collectPersistedBrowserEvidence(basePath: string, milestoneId: string): Promise<string> {
82
- const chunks: string[] = [];
83
- for (const slice of getMilestoneSlices(milestoneId)) {
84
- const artifactPath = `milestones/${milestoneId}/slices/${slice.id}/${slice.id}-ASSESSMENT.md`;
85
- const artifact = getArtifact(artifactPath);
86
- if (artifact?.full_content) chunks.push(artifact.full_content);
87
-
88
- const assessmentPath = resolveSliceFile(basePath, milestoneId, slice.id, "ASSESSMENT");
89
- const assessmentContent = assessmentPath ? await loadFile(assessmentPath) : null;
90
- if (assessmentContent) chunks.push(assessmentContent);
91
- }
92
- return chunks.join("\n\n");
81
+ function hasRuntimeExecutableUatEvidenceText(text: string): boolean {
82
+ if (!/\buatType:\s*runtime-executable\b/i.test(text)) return false;
83
+ if (!/\bverdict:\s*PASS\b/i.test(text)) return false;
84
+ return /^\|\s*[^|\n]+\s*\|\s*runtime\s*\|\s*PASS\s*\|[^|\n]*\bgsd_uat_exec\b/mi.test(text);
93
85
  }
94
86
 
95
87
  async function browserEvidenceGateRequiresAttention(
@@ -114,7 +106,38 @@ async function browserEvidenceGateRequiresAttention(
114
106
  ]);
115
107
  if (!hasBrowserRequiredText(requirementText)) return false;
116
108
 
117
- const persistedEvidence = await collectPersistedBrowserEvidence(basePath, params.milestoneId);
109
+ // Collect per-slice evidence so the runtime bypass is checked independently
110
+ // for each slice. Concatenating all slices before checking would allow runtime
111
+ // evidence from one slice to cover another slice's browser requirements.
112
+ const sliceEvidencePairs: Array<{ sliceRequirementText: string; evidenceText: string }> = [];
113
+ for (const slice of slices) {
114
+ const chunks: string[] = [];
115
+ const artifactPath = `milestones/${params.milestoneId}/slices/${slice.id}/${slice.id}-ASSESSMENT.md`;
116
+ const artifact = getArtifact(artifactPath);
117
+ if (artifact?.full_content) chunks.push(artifact.full_content);
118
+ const assessmentPath = resolveSliceFile(basePath, params.milestoneId, slice.id, "ASSESSMENT");
119
+ const assessmentContent = assessmentPath ? await loadFile(assessmentPath) : null;
120
+ if (assessmentContent) chunks.push(assessmentContent);
121
+ sliceEvidencePairs.push({
122
+ sliceRequirementText: compactTextParts([slice.demo, slice.goal, slice.success_criteria]),
123
+ evidenceText: chunks.join("\n\n"),
124
+ });
125
+ }
126
+ const persistedEvidence = sliceEvidencePairs.map((s) => s.evidenceText).join("\n\n");
127
+
128
+ // Runtime bypass: each slice whose own requirement text has browser-observable
129
+ // criteria must have its own runtime-executable UAT evidence. When no individual
130
+ // slice has slice-level browser requirements (e.g., they come from milestone-level
131
+ // fields only), fall back to checking whether any slice has runtime evidence.
132
+ const browserRequiringSlices = sliceEvidencePairs.filter((s) =>
133
+ hasBrowserRequiredText(s.sliceRequirementText),
134
+ );
135
+ const runtimeBypasses =
136
+ browserRequiringSlices.length > 0
137
+ ? browserRequiringSlices.every((s) => hasRuntimeExecutableUatEvidenceText(s.evidenceText))
138
+ : sliceEvidencePairs.some((s) => hasRuntimeExecutableUatEvidenceText(s.evidenceText));
139
+ if (runtimeBypasses) return false;
140
+
118
141
  const validationEvidence = compactTextParts([
119
142
  params.successCriteriaChecklist,
120
143
  params.verificationClasses,
@@ -184,14 +207,22 @@ export async function handleValidateMilestone(
184
207
  const requiredClasses = getRequiredVerificationClasses(params.milestoneId);
185
208
  if (requiredClasses.length > 0) {
186
209
  const verificationClasses = params.verificationClasses ?? "";
187
- const missingClass = requiredClasses.find(
210
+ const missingClasses = requiredClasses.filter(
188
211
  (className) => !new RegExp(`\\b${className}\\b`, "i").test(verificationClasses),
189
212
  );
190
- if (missingClass) {
213
+ if (missingClasses.length === 1) {
214
+ const missingClass = missingClasses[0];
191
215
  return {
192
216
  error: `verificationClasses must include canonical row "${missingClass}" because this milestone planned ${missingClass.toLowerCase()} verification`,
193
217
  };
194
218
  }
219
+ if (missingClasses.length > 1) {
220
+ const quotedClasses = missingClasses.map((className) => `"${className}"`).join(", ");
221
+ const plannedClasses = missingClasses.map((className) => className.toLowerCase()).join(", ");
222
+ return {
223
+ error: `verificationClasses must include canonical rows ${quotedClasses} because this milestone planned ${plannedClasses} verification`,
224
+ };
225
+ }
195
226
  }
196
227
 
197
228
  const artifactBasePath = resolveCanonicalMilestoneRoot(basePath, params.milestoneId);