@opengsd/gsd-pi 1.2.0-dev.e8563f58 → 1.2.0-dev.fbdca60b

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 (432) hide show
  1. package/dist/cli-model-override.d.ts +15 -0
  2. package/dist/cli-model-override.js +21 -0
  3. package/dist/cli.js +1 -18
  4. package/dist/loader.js +6 -4
  5. package/dist/register-agent-bundles.d.ts +11 -2
  6. package/dist/register-agent-bundles.js +18 -4
  7. package/dist/resource-loader.d.ts +10 -5
  8. package/dist/resource-loader.js +121 -6
  9. package/dist/resources/.managed-resources-content-hash +1 -1
  10. package/dist/resources/extensions/ask-user-questions.js +3 -2
  11. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +447 -215
  12. package/dist/resources/extensions/claude-code-cli/turn-assembler.js +33 -1
  13. package/dist/resources/extensions/gsd/auto/closeout.js +215 -0
  14. package/dist/resources/extensions/gsd/auto/dispatch-history.js +21 -6
  15. package/dist/resources/extensions/gsd/auto/dispatch.js +365 -0
  16. package/dist/resources/extensions/gsd/auto/finalize.js +347 -0
  17. package/dist/resources/extensions/gsd/auto/loop.js +4 -1
  18. package/dist/resources/extensions/gsd/auto/milestone-lease-reclaim.js +56 -0
  19. package/dist/resources/extensions/gsd/auto/orchestrator.js +85 -15
  20. package/dist/resources/extensions/gsd/auto/phase-helpers.js +146 -0
  21. package/dist/resources/extensions/gsd/auto/phases.js +17 -2329
  22. package/dist/resources/extensions/gsd/auto/pre-dispatch.js +534 -0
  23. package/dist/resources/extensions/gsd/auto/session.js +3 -0
  24. package/dist/resources/extensions/gsd/auto/unit-phase.js +694 -0
  25. package/dist/resources/extensions/gsd/auto/workflow-unit-dispatch.js +1 -1
  26. package/dist/resources/extensions/gsd/auto/worktree-safety-phase.js +125 -0
  27. package/dist/resources/extensions/gsd/auto-direct-dispatch.js +3 -2
  28. package/dist/resources/extensions/gsd/auto-dispatch.js +11 -2
  29. package/dist/resources/extensions/gsd/auto-post-unit.js +18 -6
  30. package/dist/resources/extensions/gsd/auto-start.js +23 -3
  31. package/dist/resources/extensions/gsd/auto-unit-closeout.js +45 -21
  32. package/dist/resources/extensions/gsd/auto-verification.js +14 -2
  33. package/dist/resources/extensions/gsd/auto-worktree.js +15 -2
  34. package/dist/resources/extensions/gsd/auto.js +45 -2
  35. package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +37 -7
  36. package/dist/resources/extensions/gsd/commands/context.js +16 -2
  37. package/dist/resources/extensions/gsd/commands-mcp-status.js +2 -2
  38. package/dist/resources/extensions/gsd/commands-workflow-templates.js +9 -2
  39. package/dist/resources/extensions/gsd/crash-recovery.js +8 -3
  40. package/dist/resources/extensions/gsd/db/engine.js +24 -6
  41. package/dist/resources/extensions/gsd/db/queries.js +30 -0
  42. package/dist/resources/extensions/gsd/db-migration-backup.js +51 -8
  43. package/dist/resources/extensions/gsd/db-transaction.js +27 -23
  44. package/dist/resources/extensions/gsd/db-writer.js +8 -17
  45. package/dist/resources/extensions/gsd/doctor-engine-checks.js +5 -5
  46. package/dist/resources/extensions/gsd/doctor-environment.js +256 -125
  47. package/dist/resources/extensions/gsd/gsd-db.js +15 -20
  48. package/dist/resources/extensions/gsd/guided-flow.js +93 -4
  49. package/dist/resources/extensions/gsd/health-widget.js +87 -28
  50. package/dist/resources/extensions/gsd/mcp-bridge.js +10 -0
  51. package/dist/resources/extensions/gsd/memory-relations.js +1 -1
  52. package/dist/resources/extensions/gsd/milestone-planning-persistence.js +2 -2
  53. package/dist/resources/extensions/gsd/milestone-reopen-events.js +3 -5
  54. package/dist/resources/extensions/gsd/milestone-settlement.js +2 -2
  55. package/dist/resources/extensions/gsd/notifications.js +12 -7
  56. package/dist/resources/extensions/gsd/projection-flush.js +7 -0
  57. package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -2
  58. package/dist/resources/extensions/gsd/prompts/execute-task.md +3 -2
  59. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
  60. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  61. package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -1
  62. package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
  63. package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -1
  64. package/dist/resources/extensions/gsd/prompts/replan-slice.md +1 -1
  65. package/dist/resources/extensions/gsd/prompts/research-milestone.md +1 -1
  66. package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
  67. package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
  68. package/dist/resources/extensions/gsd/prompts/run-uat.md +3 -1
  69. package/dist/resources/extensions/gsd/prompts/triage-captures.md +1 -1
  70. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +1 -1
  71. package/dist/resources/extensions/gsd/prompts/workflow-start.md +2 -1
  72. package/dist/resources/extensions/gsd/roadmap-slices.js +25 -3
  73. package/dist/resources/extensions/gsd/session-lock.js +1 -1
  74. package/dist/resources/extensions/gsd/skill-activation.js +3 -6
  75. package/dist/resources/extensions/gsd/state.js +6 -2
  76. package/dist/resources/extensions/gsd/tool-contract.js +14 -3
  77. package/dist/resources/extensions/gsd/tool-surface-readiness.js +83 -31
  78. package/dist/resources/extensions/gsd/tools/complete-milestone.js +3 -2
  79. package/dist/resources/extensions/gsd/tools/complete-slice.js +2 -2
  80. package/dist/resources/extensions/gsd/tools/complete-task.js +65 -2
  81. package/dist/resources/extensions/gsd/tools/plan-slice.js +2 -2
  82. package/dist/resources/extensions/gsd/tools/plan-task.js +2 -2
  83. package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +2 -2
  84. package/dist/resources/extensions/gsd/tools/reopen-milestone.js +2 -2
  85. package/dist/resources/extensions/gsd/tools/reopen-slice.js +2 -2
  86. package/dist/resources/extensions/gsd/tools/reopen-task.js +2 -2
  87. package/dist/resources/extensions/gsd/tools/replan-slice.js +2 -2
  88. package/dist/resources/extensions/gsd/unit-context-composer.js +1 -1
  89. package/dist/resources/extensions/gsd/unit-registry.js +34 -4
  90. package/dist/resources/extensions/gsd/verification-verdict.js +2 -1
  91. package/dist/resources/extensions/gsd/workflow-event-ledger.js +91 -0
  92. package/dist/resources/extensions/gsd/workflow-event-vocabulary.js +46 -0
  93. package/dist/resources/extensions/gsd/workflow-events.js +6 -18
  94. package/dist/resources/extensions/gsd/workflow-mcp-auto-prep.js +2 -0
  95. package/dist/resources/extensions/gsd/workflow-mcp-readiness-cache.js +105 -0
  96. package/dist/resources/extensions/gsd/workflow-reconcile.js +21 -56
  97. package/dist/resources/extensions/gsd/worktree-manager.js +7 -1
  98. package/dist/resources/extensions/gsd/worktree-safety.js +28 -26
  99. package/dist/resources/extensions/gsd/worktree.js +8 -1
  100. package/dist/resources/extensions/mcp-client/manager.js +6 -1
  101. package/dist/resources/skills/create-skill/SKILL.md +3 -0
  102. package/dist/resources/skills/create-skill/references/skill-structure.md +1 -0
  103. package/dist/runtime-checks.d.ts +10 -0
  104. package/dist/runtime-checks.js +27 -0
  105. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  106. package/dist/web/standalone/.next/BUILD_ID +1 -1
  107. package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -7
  108. package/dist/web/standalone/.next/build-manifest.json +2 -2
  109. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  110. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  111. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  112. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  113. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  114. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  115. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  116. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  117. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  118. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  119. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  120. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  121. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  122. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  123. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  124. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  125. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  126. package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
  127. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
  128. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
  129. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
  130. package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
  131. package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
  132. package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
  133. package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
  134. package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  135. package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
  136. package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  137. package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
  138. package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
  139. package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
  140. package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
  141. package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
  142. package/dist/web/standalone/.next/server/app/api/mcp-connections/route.js.nft.json +1 -1
  143. package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
  144. package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  145. package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  146. package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
  147. package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
  148. package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
  149. package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
  150. package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
  151. package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
  152. package/dist/web/standalone/.next/server/app/api/shutdown/route.js.nft.json +1 -1
  153. package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
  154. package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
  155. package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
  156. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
  157. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
  158. package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
  159. package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
  160. package/dist/web/standalone/.next/server/app/index.html +1 -1
  161. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  162. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  163. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  164. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  165. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  166. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  167. package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -7
  168. package/dist/web/standalone/.next/server/chunks/{5942.js → 1128.js} +1 -1
  169. package/dist/web/standalone/.next/server/chunks/8357.js +1 -1
  170. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  171. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  172. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  173. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  174. package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
  175. package/package.json +3 -3
  176. package/packages/cloud-mcp-gateway/package.json +2 -2
  177. package/packages/contracts/package.json +1 -1
  178. package/packages/daemon/package.json +4 -4
  179. package/packages/gsd-agent-core/dist/sdk.d.ts.map +1 -1
  180. package/packages/gsd-agent-core/dist/sdk.js +6 -4
  181. package/packages/gsd-agent-core/dist/sdk.js.map +1 -1
  182. package/packages/gsd-agent-core/package.json +5 -5
  183. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  184. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  185. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js +10 -0
  186. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js.map +1 -1
  187. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts +8 -0
  188. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  189. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +50 -6
  190. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
  191. package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.d.ts +2 -0
  192. package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.d.ts.map +1 -1
  193. package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.js +34 -5
  194. package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.js.map +1 -1
  195. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts +1 -0
  196. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  197. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js +17 -0
  198. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js.map +1 -1
  199. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.d.ts.map +1 -1
  200. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.js +4 -0
  201. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.js.map +1 -1
  202. package/packages/gsd-agent-modes/package.json +7 -7
  203. package/packages/mcp-server/README.md +12 -3
  204. package/packages/mcp-server/dist/cli-runner.d.ts +40 -0
  205. package/packages/mcp-server/dist/cli-runner.d.ts.map +1 -0
  206. package/packages/mcp-server/dist/cli-runner.js +137 -0
  207. package/packages/mcp-server/dist/cli-runner.js.map +1 -0
  208. package/packages/mcp-server/dist/cli.js +2 -53
  209. package/packages/mcp-server/dist/cli.js.map +1 -1
  210. package/packages/mcp-server/dist/pid-registry.d.ts +46 -0
  211. package/packages/mcp-server/dist/pid-registry.d.ts.map +1 -0
  212. package/packages/mcp-server/dist/pid-registry.js +459 -0
  213. package/packages/mcp-server/dist/pid-registry.js.map +1 -0
  214. package/packages/mcp-server/dist/probe-mode.d.ts +4 -0
  215. package/packages/mcp-server/dist/probe-mode.d.ts.map +1 -0
  216. package/packages/mcp-server/dist/probe-mode.js +10 -0
  217. package/packages/mcp-server/dist/probe-mode.js.map +1 -0
  218. package/packages/mcp-server/dist/stdio-watchdog.d.ts +8 -0
  219. package/packages/mcp-server/dist/stdio-watchdog.d.ts.map +1 -0
  220. package/packages/mcp-server/dist/stdio-watchdog.js +40 -0
  221. package/packages/mcp-server/dist/stdio-watchdog.js.map +1 -0
  222. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  223. package/packages/mcp-server/dist/workflow-tools.js +62 -43
  224. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  225. package/packages/mcp-server/package.json +5 -5
  226. package/packages/native/package.json +1 -1
  227. package/packages/pi-agent-core/dist/agent-loop.js +43 -2
  228. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  229. package/packages/pi-agent-core/package.json +1 -1
  230. package/packages/pi-ai/package.json +1 -1
  231. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +3 -0
  232. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  233. package/packages/pi-coding-agent/dist/core/settings-manager.js +11 -0
  234. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  235. package/packages/pi-coding-agent/dist/theme/theme.d.ts.map +1 -1
  236. package/packages/pi-coding-agent/dist/theme/theme.js +45 -17
  237. package/packages/pi-coding-agent/dist/theme/theme.js.map +1 -1
  238. package/packages/pi-coding-agent/package.json +7 -7
  239. package/packages/pi-tui/README.md +15 -0
  240. package/packages/pi-tui/dist/index.d.ts +2 -2
  241. package/packages/pi-tui/dist/index.d.ts.map +1 -1
  242. package/packages/pi-tui/dist/index.js +2 -2
  243. package/packages/pi-tui/dist/index.js.map +1 -1
  244. package/packages/pi-tui/dist/terminal-image.d.ts +33 -0
  245. package/packages/pi-tui/dist/terminal-image.d.ts.map +1 -1
  246. package/packages/pi-tui/dist/terminal-image.js +54 -2
  247. package/packages/pi-tui/dist/terminal-image.js.map +1 -1
  248. package/packages/pi-tui/dist/terminal.d.ts +12 -0
  249. package/packages/pi-tui/dist/terminal.d.ts.map +1 -1
  250. package/packages/pi-tui/dist/terminal.js +70 -25
  251. package/packages/pi-tui/dist/terminal.js.map +1 -1
  252. package/packages/pi-tui/dist/tui.d.ts +15 -0
  253. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  254. package/packages/pi-tui/dist/tui.js +106 -21
  255. package/packages/pi-tui/dist/tui.js.map +1 -1
  256. package/packages/pi-tui/dist/utils.d.ts.map +1 -1
  257. package/packages/pi-tui/dist/utils.js +110 -36
  258. package/packages/pi-tui/dist/utils.js.map +1 -1
  259. package/packages/pi-tui/package.json +2 -2
  260. package/packages/rpc-client/package.json +2 -2
  261. package/pkg/dist/theme/theme.d.ts.map +1 -1
  262. package/pkg/dist/theme/theme.js +45 -17
  263. package/pkg/dist/theme/theme.js.map +1 -1
  264. package/pkg/package.json +1 -1
  265. package/src/resources/extensions/ask-user-questions.ts +7 -2
  266. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +531 -226
  267. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +672 -7
  268. package/src/resources/extensions/claude-code-cli/turn-assembler.ts +38 -1
  269. package/src/resources/extensions/gsd/auto/closeout.ts +309 -0
  270. package/src/resources/extensions/gsd/auto/dispatch-history.ts +22 -6
  271. package/src/resources/extensions/gsd/auto/dispatch.ts +449 -0
  272. package/src/resources/extensions/gsd/auto/finalize.ts +445 -0
  273. package/src/resources/extensions/gsd/auto/loop.ts +4 -1
  274. package/src/resources/extensions/gsd/auto/milestone-lease-reclaim.ts +74 -0
  275. package/src/resources/extensions/gsd/auto/orchestrator.ts +95 -15
  276. package/src/resources/extensions/gsd/auto/phase-helpers.ts +199 -0
  277. package/src/resources/extensions/gsd/auto/phases.ts +58 -3022
  278. package/src/resources/extensions/gsd/auto/pre-dispatch.ts +704 -0
  279. package/src/resources/extensions/gsd/auto/session.ts +3 -0
  280. package/src/resources/extensions/gsd/auto/unit-phase.ts +910 -0
  281. package/src/resources/extensions/gsd/auto/workflow-unit-dispatch.ts +1 -1
  282. package/src/resources/extensions/gsd/auto/worktree-safety-phase.ts +149 -0
  283. package/src/resources/extensions/gsd/auto-direct-dispatch.ts +10 -16
  284. package/src/resources/extensions/gsd/auto-dispatch.ts +11 -10
  285. package/src/resources/extensions/gsd/auto-post-unit.ts +21 -6
  286. package/src/resources/extensions/gsd/auto-start.ts +24 -4
  287. package/src/resources/extensions/gsd/auto-unit-closeout.ts +83 -28
  288. package/src/resources/extensions/gsd/auto-verification.ts +18 -2
  289. package/src/resources/extensions/gsd/auto-worktree.ts +15 -2
  290. package/src/resources/extensions/gsd/auto.ts +56 -2
  291. package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +56 -6
  292. package/src/resources/extensions/gsd/commands/context.ts +16 -2
  293. package/src/resources/extensions/gsd/commands-mcp-status.ts +2 -2
  294. package/src/resources/extensions/gsd/commands-workflow-templates.ts +11 -4
  295. package/src/resources/extensions/gsd/crash-recovery.ts +10 -2
  296. package/src/resources/extensions/gsd/db/engine.ts +26 -6
  297. package/src/resources/extensions/gsd/db/queries.ts +29 -0
  298. package/src/resources/extensions/gsd/db-migration-backup.ts +56 -7
  299. package/src/resources/extensions/gsd/db-transaction.ts +37 -20
  300. package/src/resources/extensions/gsd/db-writer.ts +11 -19
  301. package/src/resources/extensions/gsd/doctor-engine-checks.ts +5 -4
  302. package/src/resources/extensions/gsd/doctor-environment.ts +267 -142
  303. package/src/resources/extensions/gsd/gsd-db.ts +15 -19
  304. package/src/resources/extensions/gsd/guided-flow.ts +145 -24
  305. package/src/resources/extensions/gsd/health-widget.ts +91 -27
  306. package/src/resources/extensions/gsd/mcp-bridge.ts +39 -0
  307. package/src/resources/extensions/gsd/memory-relations.ts +1 -1
  308. package/src/resources/extensions/gsd/milestone-planning-persistence.ts +2 -2
  309. package/src/resources/extensions/gsd/milestone-reopen-events.ts +3 -6
  310. package/src/resources/extensions/gsd/milestone-settlement.ts +2 -2
  311. package/src/resources/extensions/gsd/notifications.ts +13 -6
  312. package/src/resources/extensions/gsd/projection-flush.ts +20 -0
  313. package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -2
  314. package/src/resources/extensions/gsd/prompts/execute-task.md +3 -2
  315. package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
  316. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  317. package/src/resources/extensions/gsd/prompts/quick-task.md +1 -1
  318. package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
  319. package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -1
  320. package/src/resources/extensions/gsd/prompts/replan-slice.md +1 -1
  321. package/src/resources/extensions/gsd/prompts/research-milestone.md +1 -1
  322. package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
  323. package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
  324. package/src/resources/extensions/gsd/prompts/run-uat.md +3 -1
  325. package/src/resources/extensions/gsd/prompts/triage-captures.md +1 -1
  326. package/src/resources/extensions/gsd/prompts/validate-milestone.md +1 -1
  327. package/src/resources/extensions/gsd/prompts/workflow-start.md +2 -1
  328. package/src/resources/extensions/gsd/roadmap-slices.ts +28 -3
  329. package/src/resources/extensions/gsd/session-lock.ts +1 -1
  330. package/src/resources/extensions/gsd/skill-activation.ts +3 -6
  331. package/src/resources/extensions/gsd/state.ts +7 -1
  332. package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +1 -1
  333. package/src/resources/extensions/gsd/tests/auto-blocked-remediation-message.test.ts +1 -1
  334. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +206 -22
  335. package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +6 -1
  336. package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +76 -12
  337. package/src/resources/extensions/gsd/tests/auto-pause-double-entry-guard.test.ts +1 -1
  338. package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +77 -1
  339. package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +2 -1
  340. package/src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts +65 -3
  341. package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +236 -0
  342. package/src/resources/extensions/gsd/tests/auto-unit-closeout.test.ts +169 -1
  343. package/src/resources/extensions/gsd/tests/complete-task.test.ts +141 -5
  344. package/src/resources/extensions/gsd/tests/db-migration-backup.test.ts +68 -19
  345. package/src/resources/extensions/gsd/tests/db-transaction.test.ts +59 -0
  346. package/src/resources/extensions/gsd/tests/db-writer.test.ts +15 -4
  347. package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +2 -1
  348. package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +62 -0
  349. package/src/resources/extensions/gsd/tests/discuss-routing-fixes.test.ts +12 -2
  350. package/src/resources/extensions/gsd/tests/dispatch-history.test.ts +55 -0
  351. package/src/resources/extensions/gsd/tests/dist-redirect.mjs +8 -0
  352. package/src/resources/extensions/gsd/tests/engine-interfaces-contract.test.ts +117 -91
  353. package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +113 -0
  354. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +19 -0
  355. package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +18 -6
  356. package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +15 -0
  357. package/src/resources/extensions/gsd/tests/integration/doctor-environment-async.test.ts +104 -0
  358. package/src/resources/extensions/gsd/tests/integration/run-uat.test.ts +18 -0
  359. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +47 -16
  360. package/src/resources/extensions/gsd/tests/mcp-readiness-preflight.test.ts +205 -0
  361. package/src/resources/extensions/gsd/tests/mcp-status.test.ts +6 -5
  362. package/src/resources/extensions/gsd/tests/milestone-merge-stash-restore.test.ts +1 -1
  363. package/src/resources/extensions/gsd/tests/milestone-report-path.test.ts +1 -1
  364. package/src/resources/extensions/gsd/tests/milestone-settlement.test.ts +92 -0
  365. package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +1 -1
  366. package/src/resources/extensions/gsd/tests/notifications.test.ts +64 -9
  367. package/src/resources/extensions/gsd/tests/parallel-skill-prompt-integration.test.ts +2 -2
  368. package/src/resources/extensions/gsd/tests/parsers-legacy-importers.test.ts +5 -0
  369. package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +1 -1
  370. package/src/resources/extensions/gsd/tests/phases-terminal-complete-idempotent.test.ts +242 -0
  371. package/src/resources/extensions/gsd/tests/plan-gate-failed-doctor-heal-hint.test.ts +3 -3
  372. package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +63 -2
  373. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +10 -2
  374. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +2 -4
  375. package/src/resources/extensions/gsd/tests/remote-notification-from-desktop.test.ts +31 -81
  376. package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +68 -0
  377. package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +26 -2
  378. package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +170 -48
  379. package/src/resources/extensions/gsd/tests/skill-activation.test.ts +20 -17
  380. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +7 -3
  381. package/src/resources/extensions/gsd/tests/stop-auto-race-null-unit.test.ts +1 -1
  382. package/src/resources/extensions/gsd/tests/teardown-chdir-failure-clears-registry.test.ts +17 -0
  383. package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +4 -2
  384. package/src/resources/extensions/gsd/tests/tool-surface-readiness.test.ts +184 -10
  385. package/src/resources/extensions/gsd/tests/tool-unavailable-retry.test.ts +33 -0
  386. package/src/resources/extensions/gsd/tests/transport-gate-double-complete.test.ts +139 -0
  387. package/src/resources/extensions/gsd/tests/uok-audit-unified.test.ts +8 -0
  388. package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +1 -1
  389. package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +2 -0
  390. package/src/resources/extensions/gsd/tests/workflow-events.test.ts +19 -0
  391. package/src/resources/extensions/gsd/tests/workflow-mcp-readiness-cache.test.ts +119 -0
  392. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +65 -2
  393. package/src/resources/extensions/gsd/tests/workflow-phase-contract-matrix.test.ts +332 -0
  394. package/src/resources/extensions/gsd/tests/workflow-reconcile.test.ts +20 -0
  395. package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +92 -0
  396. package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +1 -1
  397. package/src/resources/extensions/gsd/tests/worktree-project-root-degrade.test.ts +1 -1
  398. package/src/resources/extensions/gsd/tests/worktree-safety-phase.test.ts +100 -0
  399. package/src/resources/extensions/gsd/tests/worktree-safety.test.ts +72 -0
  400. package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +22 -0
  401. package/src/resources/extensions/gsd/tests/worktree.test.ts +18 -0
  402. package/src/resources/extensions/gsd/tool-contract.ts +38 -3
  403. package/src/resources/extensions/gsd/tool-surface-readiness.ts +126 -19
  404. package/src/resources/extensions/gsd/tools/complete-milestone.ts +3 -2
  405. package/src/resources/extensions/gsd/tools/complete-slice.ts +2 -2
  406. package/src/resources/extensions/gsd/tools/complete-task.ts +90 -2
  407. package/src/resources/extensions/gsd/tools/plan-slice.ts +2 -2
  408. package/src/resources/extensions/gsd/tools/plan-task.ts +2 -2
  409. package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +2 -2
  410. package/src/resources/extensions/gsd/tools/reopen-milestone.ts +2 -2
  411. package/src/resources/extensions/gsd/tools/reopen-slice.ts +2 -2
  412. package/src/resources/extensions/gsd/tools/reopen-task.ts +2 -2
  413. package/src/resources/extensions/gsd/tools/replan-slice.ts +2 -2
  414. package/src/resources/extensions/gsd/unit-context-composer.ts +1 -1
  415. package/src/resources/extensions/gsd/unit-registry.ts +34 -4
  416. package/src/resources/extensions/gsd/verification-verdict.ts +4 -2
  417. package/src/resources/extensions/gsd/workflow-event-ledger.ts +131 -0
  418. package/src/resources/extensions/gsd/workflow-event-vocabulary.ts +59 -0
  419. package/src/resources/extensions/gsd/workflow-events.ts +12 -20
  420. package/src/resources/extensions/gsd/workflow-mcp-auto-prep.ts +2 -0
  421. package/src/resources/extensions/gsd/workflow-mcp-readiness-cache.ts +150 -0
  422. package/src/resources/extensions/gsd/workflow-reconcile.ts +29 -62
  423. package/src/resources/extensions/gsd/worktree-manager.ts +6 -1
  424. package/src/resources/extensions/gsd/worktree-safety.ts +41 -39
  425. package/src/resources/extensions/gsd/worktree.ts +7 -1
  426. package/src/resources/extensions/mcp-client/manager.ts +7 -1
  427. package/src/resources/skills/create-skill/SKILL.md +3 -0
  428. package/src/resources/skills/create-skill/references/skill-structure.md +1 -0
  429. package/dist/resources/skills/gsd-browser/SKILL.md +0 -41
  430. package/src/resources/skills/gsd-browser/SKILL.md +0 -41
  431. /package/dist/web/standalone/.next/static/{LDHRKiRBIVZmiuMjrL1Vy → 2T9IOdiiM3o3gZ4UbPi8E}/_buildManifest.js +0 -0
  432. /package/dist/web/standalone/.next/static/{LDHRKiRBIVZmiuMjrL1Vy → 2T9IOdiiM3o3gZ4UbPi8E}/_ssgManifest.js +0 -0
@@ -76,13 +76,25 @@ import {
76
76
  countUnmappedActiveRequirements,
77
77
  showRequirementsBacklogReview,
78
78
  } from "./requirements-backlog.js";
79
- import { selectAndApplyModel } from "./auto-model-selection.js";
79
+ import { selectAndApplyModel, getRegisteredToolSnapshot } from "./auto-model-selection.js";
80
80
  import { DISCUSS_TOOLS_ALLOWLIST } from "./constants.js";
81
81
  import {
82
- getWorkflowTransportSupportError,
83
- getRequiredWorkflowToolsForGuidedUnit,
82
+ detectWorkflowMcpLaunchConfig,
83
+ resolveWorkflowMcpProjectRoot,
84
84
  supportsStructuredQuestions,
85
85
  } from "./workflow-mcp.js";
86
+ import { usesWorkflowMcpTransport } from "./question-transport.js";
87
+ import {
88
+ getCachedWorkflowMcpProbe,
89
+ probeAndCacheWorkflowMcp,
90
+ warmWorkflowMcpProbeInBackground,
91
+ workflowMcpProbeAdvertisesSurface,
92
+ WORKFLOW_MCP_PROBE_TIMEOUT_MS,
93
+ } from "./workflow-mcp-readiness-cache.js";
94
+ import { probeCoversRequiredWorkflowTools } from "./tool-surface-readiness.js";
95
+ import { getRequiredWorkflowToolsForUnit } from "./unit-tool-contracts.js";
96
+ import { isWorkflowToolSurfaceName } from "./workflow-tool-surface.js";
97
+ import { getUnitWorkflowDispatchReadinessError } from "./tool-contract.js";
86
98
  import {
87
99
  runPreparation,
88
100
  formatCodebaseBrief,
@@ -555,7 +567,7 @@ interface DispatchWorkflowOptions {
555
567
  deps?: {
556
568
  loadPreferences?: typeof loadEffectiveGSDPreferences;
557
569
  selectModel?: typeof selectAndApplyModel;
558
- getTransportSupportError?: typeof getWorkflowTransportSupportError;
570
+ getDispatchReadinessError?: typeof getUnitWorkflowDispatchReadinessError;
559
571
  };
560
572
  }
561
573
 
@@ -563,6 +575,93 @@ export function resolveGuidedDispatchProjectRoot(basePath?: string): string {
563
575
  return basePath ?? process.cwd();
564
576
  }
565
577
 
578
+ /**
579
+ * Wait until the workflow MCP server is reachable and advertising its tool
580
+ * surface. Returns failure details when timed out, or null when ready (or MCP
581
+ * is not the transport). Called inside dispatchWorkflow() so every guided-flow
582
+ * dispatch path is gated automatically.
583
+ */
584
+ const MCP_READINESS_TIMEOUT_MS = 15_000;
585
+ const MCP_READINESS_POLL_MS = 200;
586
+
587
+ export interface WorkflowMcpReadinessFailure {
588
+ server: string;
589
+ error?: string;
590
+ }
591
+
592
+ async function awaitWorkflowMcpReadiness(
593
+ pi: ExtensionAPI,
594
+ ctx: ExtensionContext,
595
+ basePath: string,
596
+ options: {
597
+ unitType?: string;
598
+ timeoutMs?: number;
599
+ pollMs?: number;
600
+ probeTimeoutMs?: number;
601
+ probe?: typeof probeAndCacheWorkflowMcp;
602
+ } = {},
603
+ ): Promise<WorkflowMcpReadinessFailure | null> {
604
+ const provider = ctx.model?.provider;
605
+ const authMode = provider ? ctx.modelRegistry.getProviderAuthMode(provider) : undefined;
606
+ if (!usesWorkflowMcpTransport(authMode, ctx.model?.baseUrl)) return null;
607
+
608
+ const projectRoot = resolveWorkflowMcpProjectRoot(basePath);
609
+ const launch = detectWorkflowMcpLaunchConfig(projectRoot);
610
+ if (!launch) return null;
611
+
612
+ const requiredTools = options.unitType
613
+ ? getRequiredWorkflowToolsForUnit(options.unitType).filter(isWorkflowToolSurfaceName)
614
+ : [];
615
+ const coversExpectedSurface = (tools: readonly string[]) =>
616
+ requiredTools.length > 0
617
+ ? probeCoversRequiredWorkflowTools(tools, requiredTools)
618
+ : workflowMcpProbeAdvertisesSurface(tools);
619
+
620
+ const serverPrefix = `mcp__${launch.name}__`;
621
+ const systemPrompt = () => typeof ctx.getSystemPrompt === "function" ? ctx.getSystemPrompt() : "";
622
+ const systemPromptCoversExpectedSurface = () => {
623
+ const prompt = systemPrompt();
624
+ return requiredTools.length > 0
625
+ ? requiredTools.every((tool) => prompt.includes(`${serverPrefix}${tool}`))
626
+ : prompt.includes(serverPrefix);
627
+ };
628
+ const sessionAlreadyReady = () =>
629
+ coversExpectedSurface(getRegisteredToolSnapshot(pi)) ||
630
+ systemPromptCoversExpectedSurface();
631
+ if (sessionAlreadyReady()) return null;
632
+
633
+ if (coversExpectedSurface(getCachedWorkflowMcpProbe(projectRoot)?.tools ?? [])) {
634
+ return null;
635
+ }
636
+
637
+ const probe = options.probe ?? probeAndCacheWorkflowMcp;
638
+ const probeTimeoutMs = options.probeTimeoutMs ?? WORKFLOW_MCP_PROBE_TIMEOUT_MS;
639
+
640
+ ctx.ui.setStatus("gsd-step", `Waiting for ${launch.name} MCP server…`);
641
+ let lastError: string | undefined;
642
+ const deadline = Date.now() + (options.timeoutMs ?? MCP_READINESS_TIMEOUT_MS);
643
+ const pollMs = options.pollMs ?? MCP_READINESS_POLL_MS;
644
+ while (Date.now() < deadline) {
645
+ if (sessionAlreadyReady()) {
646
+ ctx.ui.setStatus("gsd-step", "");
647
+ return null;
648
+ }
649
+
650
+ const result = await probe(projectRoot, { timeoutMs: probeTimeoutMs });
651
+ if (result.ok && coversExpectedSurface(result.tools)) {
652
+ ctx.ui.setStatus("gsd-step", "");
653
+ return null;
654
+ }
655
+ lastError = result.error;
656
+
657
+ await new Promise((r) => setTimeout(r, pollMs));
658
+ }
659
+ ctx.ui.setStatus("gsd-step", "");
660
+ return lastError ? { server: launch.name, error: lastError } : { server: launch.name };
661
+ }
662
+
663
+ export const _awaitWorkflowMcpReadinessForTest = awaitWorkflowMcpReadiness;
664
+
566
665
  /**
567
666
  * Read GSD-WORKFLOW.md and dispatch it to the LLM with a contextual note.
568
667
  * This is the only way the wizard triggers work — everything else is the LLM's job.
@@ -584,7 +683,8 @@ async function dispatchWorkflow(
584
683
  const projectRoot = resolveGuidedDispatchProjectRoot(resolvedOptions.basePath);
585
684
  const loadPreferences = resolvedOptions.deps?.loadPreferences ?? loadEffectiveGSDPreferences;
586
685
  const selectModel = resolvedOptions.deps?.selectModel ?? selectAndApplyModel;
587
- const getTransportSupportError = resolvedOptions.deps?.getTransportSupportError ?? getWorkflowTransportSupportError;
686
+ const getDispatchReadinessError = resolvedOptions.deps?.getDispatchReadinessError
687
+ ?? getUnitWorkflowDispatchReadinessError;
588
688
 
589
689
  // Route through the dynamic routing pipeline (complexity classification,
590
690
  // tier downgrade, fallback chains) — same path as auto-mode dispatches (#2958).
@@ -603,29 +703,49 @@ async function dispatchWorkflow(
603
703
  });
604
704
  }
605
705
 
606
- const compatibilityError = getTransportSupportError(
607
- result.appliedModel?.provider ?? ctx.model?.provider,
608
- getRequiredWorkflowToolsForGuidedUnit(unitType),
609
- {
610
- projectRoot,
611
- surface: "guided flow",
612
- unitType,
613
- authMode: result.appliedModel?.provider
614
- ? ctx.modelRegistry.getProviderAuthMode(result.appliedModel.provider)
615
- : ctx.model?.provider
616
- ? ctx.modelRegistry.getProviderAuthMode(ctx.model.provider)
617
- : undefined,
618
- baseUrl: result.appliedModel?.baseUrl ?? ctx.model?.baseUrl,
619
- // Guided flow starts the MCP workflow server as part of dispatch, so the
620
- // parent session's activeTools doesn't include MCP tools yet. The MCP
621
- // launch config check (detectWorkflowMcpLaunchConfig) is the right gate
622
- // here — not whether MCP tools are pre-registered in the parent session.
623
- },
624
- );
706
+ const compatibilityError = getDispatchReadinessError({
707
+ provider: result.appliedModel?.provider ?? ctx.model?.provider,
708
+ projectRoot,
709
+ surface: "guided flow",
710
+ unitType,
711
+ authMode: result.appliedModel?.provider
712
+ ? ctx.modelRegistry.getProviderAuthMode(result.appliedModel.provider)
713
+ : ctx.model?.provider
714
+ ? ctx.modelRegistry.getProviderAuthMode(ctx.model.provider)
715
+ : undefined,
716
+ baseUrl: result.appliedModel?.baseUrl ?? ctx.model?.baseUrl,
717
+ // Guided flow starts the MCP workflow server as part of dispatch, so the
718
+ // parent session's activeTools doesn't include MCP tools yet. The MCP
719
+ // launch config check (detectWorkflowMcpLaunchConfig) is the right gate
720
+ // here not whether MCP tools are pre-registered in the parent session.
721
+ });
625
722
  if (compatibilityError) {
626
723
  ctx.ui.notify(compatibilityError, "error");
627
724
  return;
628
725
  }
726
+
727
+ // ── Live MCP readiness gate ────────────────────────────────────────
728
+ // Units with required workflow tools must not dispatch until the MCP
729
+ // surface covers that exact contract; otherwise the model can race into
730
+ // "No such tool available" before recovery sees a clean readiness error.
731
+ warmWorkflowMcpProbeInBackground(projectRoot);
732
+ const requiredWorkflowTools = getRequiredWorkflowToolsForUnit(unitType).filter(isWorkflowToolSurfaceName);
733
+ const strictBlocking = requiredWorkflowTools.length > 0
734
+ && (process.env.GSD_GUIDED_MCP_BLOCKING ?? "").trim() !== "0";
735
+ if (strictBlocking) {
736
+ // If the workflow MCP server is configured but still connecting, wait
737
+ // for it instead of dispatching into a child session that will abort.
738
+ const readinessFailure = await awaitWorkflowMcpReadiness(pi, ctx, projectRoot, { unitType });
739
+ if (readinessFailure) {
740
+ const detail = readinessFailure.error ? ` ${readinessFailure.error}` : "";
741
+ ctx.ui.notify(
742
+ `GSD workflow server "${readinessFailure.server}" did not connect in time.${detail} ` +
743
+ `Run \`/gsd mcp check ${readinessFailure.server}\` for details.`,
744
+ "warning",
745
+ );
746
+ return;
747
+ }
748
+ }
629
749
  }
630
750
 
631
751
  // Scope tools for guided workflow turns (#2949, token-consumption savings).
@@ -1708,6 +1828,7 @@ export async function showSmartEntry(
1708
1828
  options?: { step?: boolean },
1709
1829
  ): Promise<void> {
1710
1830
  const stepMode = options?.step ?? true;
1831
+ warmWorkflowMcpProbeInBackground(basePath);
1711
1832
 
1712
1833
  // ── Clear stale milestone ID reservations from previous cancelled sessions ──
1713
1834
  // Reservations only need to survive within a single /gsd interaction.
@@ -4,7 +4,7 @@
4
4
  import type { ExtensionContext } from "@gsd/pi-coding-agent";
5
5
  import type { GSDState } from "./types.js";
6
6
  import { runProviderChecks, summariseProviderIssues } from "./doctor-providers.js";
7
- import { runEnvironmentChecks } from "./doctor-environment.js";
7
+ import { runEnvironmentChecks, runEnvironmentChecksAsync } from "./doctor-environment.js";
8
8
  import { loadEffectiveGSDPreferences } from "./preferences.js";
9
9
  import { nativeIsRepo, nativeLastCommitEpoch, nativeGetCurrentBranch, nativeCommitSubject } from "./native-git-bridge.js";
10
10
  import { loadLedgerFromDisk, getProjectTotals } from "./metrics.js";
@@ -22,7 +22,31 @@ export const HEALTH_WIDGET_ACTIVE_HINTS =
22
22
 
23
23
  // ── Data loader ────────────────────────────────────────────────────────────────
24
24
 
25
- function loadHealthWidgetData(basePath: string): HealthWidgetData {
25
+ // Last-commit lookup is subprocess-backed (native-git-bridge git spawns),
26
+ // so it is treated like the other expensive checks: skipped on first paint,
27
+ // run only by the background refresh.
28
+ function loadLastCommitInfo(basePath: string): { epoch: number | null; message: string | null } {
29
+ try {
30
+ if (nativeIsRepo(basePath)) {
31
+ const branch = nativeGetCurrentBranch(basePath);
32
+ const epoch = nativeLastCommitEpoch(basePath, branch || "HEAD");
33
+ if (epoch > 0) {
34
+ return { epoch, message: nativeCommitSubject(basePath, branch || "HEAD") || null };
35
+ }
36
+ }
37
+ } catch { /* non-fatal */ }
38
+ return { epoch: null, message: null };
39
+ }
40
+
41
+ function loadHealthWidgetData(
42
+ basePath: string,
43
+ options?: { includeChecks?: boolean },
44
+ ): HealthWidgetData {
45
+ // `includeChecks` gates the expensive subprocess-backed checks (provider +
46
+ // environment doctor: `lsof`, `docker`, `node --version`, ...). The initial
47
+ // synchronous render passes `false` so first paint is never blocked on them;
48
+ // the async refresh (off the first-paint path) runs the full suite.
49
+ const includeChecks = options?.includeChecks ?? true;
26
50
  let budgetCeiling: number | undefined;
27
51
  let budgetSpent = 0;
28
52
  let providerIssue: string | null = null;
@@ -44,40 +68,73 @@ function loadHealthWidgetData(basePath: string): HealthWidgetData {
44
68
  }
45
69
  } catch { /* non-fatal */ }
46
70
 
71
+ if (includeChecks) {
72
+ try {
73
+ const providerResults = runProviderChecks();
74
+ providerIssue = summariseProviderIssues(providerResults);
75
+ } catch { /* non-fatal */ }
76
+
77
+ try {
78
+ const envResults = runEnvironmentChecks(basePath);
79
+ for (const r of envResults) {
80
+ if (r.status === "error") environmentErrorCount++;
81
+ else if (r.status === "warning") environmentWarningCount++;
82
+ }
83
+ } catch { /* non-fatal */ }
84
+ }
85
+
86
+ // ── Last commit info ── (git spawns — gated like the other expensive checks)
87
+ if (includeChecks) {
88
+ const commit = loadLastCommitInfo(basePath);
89
+ lastCommitEpoch = commit.epoch;
90
+ lastCommitMessage = commit.message;
91
+ }
92
+
93
+ return {
94
+ projectState,
95
+ budgetCeiling,
96
+ budgetSpent,
97
+ providerIssue,
98
+ environmentErrorCount,
99
+ environmentWarningCount,
100
+ lastCommitEpoch,
101
+ lastCommitMessage,
102
+ lastRefreshed: Date.now(),
103
+ };
104
+ }
105
+
106
+ // Non-blocking variant used by the widget's background refresh: the cheap fields
107
+ // come from the synchronous snapshot, then provider + environment checks are
108
+ // layered in off the event-loop critical path (env checks run concurrently via
109
+ // runEnvironmentChecksAsync). Keeps the always-on widget from stalling the UI on
110
+ // its initial enrichment or its 60s refresh.
111
+ async function loadHealthWidgetDataAsync(basePath: string): Promise<HealthWidgetData> {
112
+ const data = loadHealthWidgetData(basePath, { includeChecks: false });
113
+ let providerIssue = data.providerIssue;
114
+ let environmentErrorCount = 0;
115
+ let environmentWarningCount = 0;
116
+
47
117
  try {
48
- const providerResults = runProviderChecks();
49
- providerIssue = summariseProviderIssues(providerResults);
118
+ providerIssue = summariseProviderIssues(runProviderChecks());
50
119
  } catch { /* non-fatal */ }
51
120
 
52
121
  try {
53
- const envResults = runEnvironmentChecks(basePath);
122
+ const envResults = await runEnvironmentChecksAsync(basePath);
54
123
  for (const r of envResults) {
55
124
  if (r.status === "error") environmentErrorCount++;
56
125
  else if (r.status === "warning") environmentWarningCount++;
57
126
  }
58
127
  } catch { /* non-fatal */ }
59
128
 
60
- // ── Last commit info ──
61
- try {
62
- if (nativeIsRepo(basePath)) {
63
- const branch = nativeGetCurrentBranch(basePath);
64
- const epoch = nativeLastCommitEpoch(basePath, branch || "HEAD");
65
- if (epoch > 0) {
66
- lastCommitEpoch = epoch;
67
- lastCommitMessage = nativeCommitSubject(basePath, branch || "HEAD") || null;
68
- }
69
- }
70
- } catch { /* non-fatal */ }
129
+ const commit = loadLastCommitInfo(basePath);
71
130
 
72
131
  return {
73
- projectState,
74
- budgetCeiling,
75
- budgetSpent,
132
+ ...data,
76
133
  providerIssue,
77
134
  environmentErrorCount,
78
135
  environmentWarningCount,
79
- lastCommitEpoch,
80
- lastCommitMessage,
136
+ lastCommitEpoch: commit.epoch,
137
+ lastCommitMessage: commit.message,
81
138
  lastRefreshed: Date.now(),
82
139
  };
83
140
  }
@@ -95,8 +152,13 @@ export function initHealthWidget(ctx: ExtensionContext): void {
95
152
 
96
153
  const basePath = projectRoot();
97
154
 
98
- // String-array fallback — used in RPC mode (factory is a no-op there)
99
- const initialData = loadHealthWidgetData(basePath);
155
+ // String-array fallback — used in RPC mode (factory is a no-op there).
156
+ // Skip the expensive provider/environment doctor checks here: this runs
157
+ // synchronously on the interactive-startup path, where running them would
158
+ // block first paint by ~0.9s (lsof/docker probes, otherwise run again
159
+ // immediately by the factory below). The factory's async refresh fills in
160
+ // real health once the screen is up.
161
+ const initialData = loadHealthWidgetData(basePath, { includeChecks: false });
100
162
  ctx.ui.setWidget("gsd-health", buildHealthLines(initialData), { placement: "belowEditor" });
101
163
 
102
164
  // Factory-based widget for TUI mode — replaces the string-array above
@@ -110,7 +172,7 @@ export function initHealthWidget(ctx: ExtensionContext): void {
110
172
  if (refreshInFlight) return;
111
173
  refreshInFlight = true;
112
174
  try {
113
- data = loadHealthWidgetData(basePath);
175
+ data = await loadHealthWidgetDataAsync(basePath);
114
176
  cachedLines = undefined;
115
177
  if (!isDisposed) _tui.requestRender();
116
178
  } catch { /* non-fatal */ } finally {
@@ -118,9 +180,11 @@ export function initHealthWidget(ctx: ExtensionContext): void {
118
180
  }
119
181
  };
120
182
 
121
- // Fire first enrichment immediately. requestRender() inside is a no-op
122
- // if the widget has not yet rendered, so this is safe before factory return.
123
- void refresh();
183
+ // Fire the first full enrichment off the first-paint path. setTimeout(0)
184
+ // yields to the initial render + input loop, so the expensive doctor checks
185
+ // (provider + environment) never delay the moment the user sees the UI.
186
+ // requestRender() inside refresh repaints the widget once data is ready.
187
+ setTimeout(() => { void refresh(); }, 0);
124
188
 
125
189
  const refreshTimer = setInterval(() => {
126
190
  void refresh();
@@ -0,0 +1,39 @@
1
+ // mcp-bridge.ts — stable runtime seam for MCP server consumption (phase 1).
2
+ export {
3
+ loadWriteGateSnapshot,
4
+ shouldBlockPendingGateInSnapshot,
5
+ shouldBlockQueueExecutionInSnapshot,
6
+ } from "./bootstrap/write-gate.js";
7
+ export { ensureDbOpen } from "./bootstrap/dynamic-tools.js";
8
+ export {
9
+ _getAdapter,
10
+ checkpointDatabase,
11
+ closeDatabase,
12
+ getAllMilestones,
13
+ getDb,
14
+ getGateResults,
15
+ getMilestoneSlices,
16
+ getPendingGates,
17
+ getSliceTasks,
18
+ insertDecision,
19
+ insertMilestone,
20
+ insertSlice,
21
+ openDatabase,
22
+ upsertMilestonePlanning,
23
+ } from "./gsd-db.js";
24
+ export { invalidateStateCache, isReusableGhostMilestone } from "./state.js";
25
+ export { loadEffectiveGSDPreferences } from "./preferences.js";
26
+ export {
27
+ saveDecisionToDb,
28
+ saveRequirementToDb,
29
+ updateRequirementInDb,
30
+ } from "./db-writer.js";
31
+ export { rebuildState } from "./doctor.js";
32
+ export { queryJournal } from "./journal.js";
33
+ export {
34
+ claimReservedId,
35
+ findMilestoneIds,
36
+ getReservedMilestoneIds,
37
+ milestoneIdSort,
38
+ nextMilestoneId,
39
+ } from "./milestone-ids.js";
@@ -3,7 +3,7 @@
3
3
  // Phase 4 companion to memory-store.ts. Edges live in the `memory_relations`
4
4
  // table and are created by (a) explicit LINK actions emitted by the memory
5
5
  // extractor, or (b) future `/gsd memory link` CLI commands. All writes go
6
- // through the single-writer gate in `gsd-db.ts`.
6
+ // through typed writer wrappers re-exported by `gsd-db.ts`.
7
7
 
8
8
  import {
9
9
  _getAdapter,
@@ -15,7 +15,7 @@ import {
15
15
  } from "./gsd-db.js";
16
16
  import { invalidateStateCache } from "./state.js";
17
17
  import { renderRoadmapFromDb } from "./markdown-renderer.js";
18
- import { renderAllProjections } from "./workflow-projections.js";
18
+ import { flushWorkflowProjections } from "./projection-flush.js";
19
19
  import { writeManifest } from "./workflow-manifest.js";
20
20
  import { appendEvent } from "./workflow-events.js";
21
21
  import { logWarning } from "./workflow-logger.js";
@@ -171,7 +171,7 @@ async function renderPlanArtifacts(
171
171
 
172
172
  async function runPostPlanHooks(basePath: string, params: PersistMilestonePlanParams): Promise<void> {
173
173
  try {
174
- await renderAllProjections(basePath, params.milestoneId);
174
+ await flushWorkflowProjections(basePath, { milestoneId: params.milestoneId });
175
175
  writeManifest(basePath);
176
176
  appendEvent(basePath, {
177
177
  cmd: "plan-milestone",
@@ -1,13 +1,10 @@
1
- import { join } from "node:path";
2
-
3
- import { gsdRoot } from "./paths.js";
1
+ import { workflowEventArchivePath, workflowEventLogPath } from "./workflow-event-ledger.js";
4
2
  import { readEvents } from "./workflow-events.js";
5
3
 
6
4
  export function latestExplicitReopenAt(basePath: string, milestoneId: string): string | null {
7
- const root = gsdRoot(basePath);
8
5
  const candidates = [
9
- join(root, "event-log.jsonl"),
10
- join(root, `event-log-${milestoneId}.jsonl.archived`),
6
+ workflowEventLogPath(basePath),
7
+ workflowEventArchivePath(basePath, milestoneId),
11
8
  ];
12
9
 
13
10
  let latest: string | null = null;
@@ -74,8 +74,8 @@ export function evaluateAllCompleteSettlement(
74
74
  action: "pause",
75
75
  message:
76
76
  `Milestone ${milestoneId} is complete, but its worktree branch has not been merged to main. ` +
77
- `Retry with \`/gsd dispatch complete-milestone ${milestoneId}\` or merge manually.`,
78
- nextAction: `Retry \`/gsd dispatch complete-milestone ${milestoneId}\` or merge manually.`,
77
+ `Retry with \`/gsd dispatch complete-milestone ${milestoneId}\` to finish the system-owned merge.`,
78
+ nextAction: `Retry \`/gsd dispatch complete-milestone ${milestoneId}\`.`,
79
79
  milestoneId,
80
80
  };
81
81
  }
@@ -4,7 +4,12 @@
4
4
  import { execFileSync } from "node:child_process";
5
5
  import type { NotificationPreferences } from "./types.js";
6
6
  import { loadEffectiveGSDPreferences } from "./preferences.js";
7
- import { sendRemoteNotification } from "../remote-questions/notify.js";
7
+ import { sendRemoteNotification as _sendRemoteNotification } from "../remote-questions/notify.js";
8
+
9
+ /** Swappable dispatcher for remote notifications — exported so tests can mock it. */
10
+ export const remoteNotificationDispatcher = {
11
+ send: _sendRemoteNotification,
12
+ };
8
13
 
9
14
  export type NotifyLevel = "info" | "success" | "warning" | "error";
10
15
  export type NotificationKind = "complete" | "error" | "budget" | "milestone" | "attention";
@@ -30,28 +35,30 @@ export function sendDesktopNotification(
30
35
  level: NotifyLevel = "info",
31
36
  kind: NotificationKind = "complete",
32
37
  projectName?: string,
38
+ deps: { notifications?: NotificationPreferences } = {},
33
39
  ): void {
34
40
  // When a projectName is provided and the title is the default "GSD",
35
41
  // replace it with a project-qualified title for multi-project clarity.
36
42
  if (projectName && title === "GSD") {
37
43
  title = formatNotificationTitle(projectName);
38
44
  }
39
- const loaded = loadEffectiveGSDPreferences()?.preferences;
45
+ const loadedPreferences = loadEffectiveGSDPreferences()?.preferences;
46
+ const notifications = deps.notifications ?? loadedPreferences?.notifications;
40
47
 
41
48
  // Remote notifications fire independently of desktop preferences.
42
49
  // sendRemoteNotification handles "not configured" gracefully (early return).
43
- void sendRemoteNotification(title, message).catch(() => {});
50
+ void remoteNotificationDispatcher.send(title, message).catch(() => {});
44
51
 
45
- if (!shouldSendDesktopNotification(kind, loaded?.notifications)) return;
52
+ if (!shouldSendDesktopNotification(kind, notifications)) return;
46
53
 
47
54
  // cmux delivery and desktop delivery are independent — if cmux import or
48
55
  // delivery fails, we must still attempt the native desktop notification.
49
56
  const runCmux = async () => {
50
57
  try {
51
58
  const { CmuxClient, emitOsc777Notification, resolveCmuxConfig } = await import("../cmux/index.js");
52
- const cmux = resolveCmuxConfig(loaded);
59
+ const cmux = resolveCmuxConfig(loadedPreferences);
53
60
  if (cmux.notifications) {
54
- const delivered = CmuxClient.fromPreferences(loaded).notify(title, message);
61
+ const delivered = CmuxClient.fromPreferences(loadedPreferences).notify(title, message);
55
62
  if (delivered) return true;
56
63
  emitOsc777Notification(title, message);
57
64
  }
@@ -0,0 +1,20 @@
1
+ // Project/App: gsd-pi
2
+ // File Purpose: Single workflow projection flush seam for mutation exits.
3
+
4
+ import { renderAllProjections } from "./workflow-projections.js";
5
+
6
+ export interface ProjectionFlushScope {
7
+ milestoneId: string;
8
+ }
9
+
10
+ export interface ProjectionFlushResult {
11
+ milestoneId: string;
12
+ }
13
+
14
+ export async function flushWorkflowProjections(
15
+ basePath: string,
16
+ scope: ProjectionFlushScope,
17
+ ): Promise<ProjectionFlushResult> {
18
+ await renderAllProjections(basePath, scope.milestoneId);
19
+ return { milestoneId: scope.milestoneId };
20
+ }
@@ -38,7 +38,7 @@ Use `subagent` only when useful: reviewer, security, or tester. Apply findings b
38
38
  10. Prepare `gsd_slice_complete` content with camelCase fields `milestoneId`, `sliceId`, `sliceTitle`, `oneLiner`, `narrative`, `verification`, and `uatContent`.
39
39
  11. Draft concrete UAT with preconditions, steps, expected outcomes, edge cases, and UAT Type. Declare the type as a bullet under a `## UAT Type` heading, exactly like `- UAT mode: browser-executable`.
40
40
  **Web apps:** when inlined Web App UAT guidance is present, declare `browser-executable` or `runtime-executable` (not `artifact-driven`) for localhost/browser/screenshot steps; include dev-server preconditions and name Playwright specs when they exist.
41
- 12. Review the inlined task-summary excerpts for DECISIONS.md/KNOWLEDGE.md-worthy decisions and gotchas. Read full `*-SUMMARY.md` only if needed. Capture with `capture_thought`; do not append knowledge files.
41
+ 12. Review the inlined task-summary excerpts for DECISIONS.md/KNOWLEDGE.md-worthy decisions and gotchas. Read full `*-SUMMARY.md` only if needed. Capture with `gsd_capture_thought` (MCP-scoped `mcp__...__gsd_capture_thought`), not bare `capture_thought`; do not append knowledge files.
42
42
  13. When verification passes, call `gsd_slice_complete`. The DB-backed tool is the canonical write path. Do **not** manually write `{{sliceSummaryPath}}`. Do **not** manually write `{{sliceUatPath}}`. Do not edit roadmap checkboxes.
43
43
  14. Do not run git commands.
44
44
  15. If the current project state needs refresh, call `gsd_summary_save` with `artifact_type: "PROJECT"` and the full updated project markdown as `content`; omit `milestone_id`. Do not write or edit `.gsd/PROJECT.md` directly.
@@ -49,4 +49,4 @@ Use `subagent` only when useful: reviewer, security, or tester. Apply findings b
49
49
 
50
50
  **You MUST call `gsd_slice_complete` with summary and UAT content only after verification passes.**
51
51
 
52
- When done, say: "Slice {{sliceId}} complete."
52
+ When done, say: "Slice {{sliceId}} complete." Say this exactly once — if you already said it in a prior message, do not repeat it.
@@ -52,6 +52,7 @@ You execute. The inlined task plan is authoritative. Verify referenced files and
52
52
 
53
53
  - If task sections exist for Failure Modes (Q5), Load Profile (Q6), Negative Tests (Q7), or Observability Impact, implement and verify them.
54
54
  - Verify must-haves with concrete commands or observable behavior.
55
+ - Run verification commands through `gsd_exec` / Context Mode evidence when workflow MCP tools are presented. Use `gsd_exec_search` before rerunning noisy checks, and `gsd_resume` after compaction or resume. Do not call direct `bash` for final verification evidence in this unit.
55
56
  - Run slice-level verification from the slice plan. Final tasks need all checks passing; intermediate tasks should record partial passes.
56
57
  - Populate `## Verification Evidence` with `formatEvidenceTable` rows: command, exit code, verdict, duration. If no checks were found, say so.
57
58
  - For UI/browser/DOM/user-visible web changes, exercise the real flow and record explicit checks.
@@ -64,7 +65,7 @@ Keep about **{{verificationBudget}}** for verification and summary. If context i
64
65
 
65
66
  - If the plan is fundamentally invalid, set `blocker_discovered: true` in the summary and explain.
66
67
  - For downstream-impacting ambiguity that cannot be resolved from code, plans, or decisions, include an `escalation` object with question, options, recommendation, rationale, and `continueWithDefault`.
67
- - Capture meaningful architecture/pattern/observability decisions with `capture_thought`; capture non-obvious gotchas or conventions only when they save future investigation.
68
+ - Capture meaningful architecture/pattern/observability decisions with `gsd_capture_thought` (or MCP-scoped `mcp__...__gsd_capture_thought`) when workflow MCP tools are presented; capture non-obvious gotchas or conventions only when they save future investigation.
68
69
  - Use the inlined Task Summary template below. Read `{{taskSummaryTemplatePath}}` only if the inlined template is absent or visibly truncated.
69
70
  - Call `gsd_task_complete` with camelCase fields `milestoneId`, `sliceId`, `taskId`, `oneLiner`, `narrative`, `verification`, and `verificationEvidence`. Include `blockerDiscovered: true` when a stale-path safety failure or other plan-invalidating blocker prevents execution.
70
71
  - The DB-backed tool is the canonical write path. Do **not** manually write `{{taskSummaryPath}}` or edit PLAN.md checkboxes; the tool renders the summary and updates state.
@@ -76,4 +77,4 @@ Keep about **{{verificationBudget}}** for verification and summary. If context i
76
77
 
77
78
  **You MUST call `gsd_task_complete` before finishing, including when the stale-path safety rule stops execution.**
78
79
 
79
- When done, say: "Task {{taskId}} complete."
80
+ When done, say: "Task {{taskId}} complete." Say this exactly once — if you already said it in a prior message, do not repeat it.
@@ -118,4 +118,4 @@ If external API keys or secrets are required, use the inlined **Secrets Manifest
118
118
 
119
119
  If no external API keys or secrets are required, skip this step; do not create an empty manifest.
120
120
 
121
- When done, say: "Milestone {{milestoneId}} planned."
121
+ When done, say: "Milestone {{milestoneId}} planned." Say this exactly once — if you already said it in a prior message, do not repeat it.
@@ -57,4 +57,4 @@ The slice directory already exists. Do not mkdir.
57
57
 
58
58
  **You MUST call `gsd_plan_slice` to persist planning state before finishing, unless the stale-path safety rule above stops the unit before safe planning can occur.**
59
59
 
60
- When done, say: "Slice {{sliceId}} planned."
60
+ When done, say: "Slice {{sliceId}} planned." Say this exactly once — if you already said it in a prior message, do not repeat it.
@@ -37,4 +37,4 @@ You are executing a GSD quick task — a lightweight, focused unit of work outsi
37
37
  - <what was tested/verified>
38
38
  ```
39
39
 
40
- When done, say: "Quick task {{taskNum}} complete."
40
+ When done, say: "Quick task {{taskNum}} complete." Say this exactly once — if you already said it in a prior message, do not repeat it.
@@ -67,4 +67,4 @@ If `.gsd/REQUIREMENTS.md` exists and requirement ownership or status changed, up
67
67
 
68
68
  **DB access safety:** Do NOT query `.gsd/gsd.db` directly via `sqlite3` or `node -e require('better-sqlite3')`. Use `gsd_milestone_status` to read current milestone and slice state. All roadmap mutations go through `gsd_reassess_roadmap` — the tool writes to the DB and re-renders ROADMAP.md atomically.
69
69
 
70
- When done, say: "Roadmap reassessed."
70
+ When done, say: "Roadmap reassessed." Say this exactly once — if you already said it in a prior message, do not repeat it.
@@ -77,4 +77,4 @@ The slice directory and tasks/ subdirectory already exist. Do NOT mkdir.
77
77
 
78
78
  **You MUST call `gsd_plan_slice` to persist planning state before finishing.** After success, the pipeline clears the sketch flag on next state derivation; the on-disk PLAN file is the signal.
79
79
 
80
- When done, say: "Slice {{sliceId}} refined."
80
+ When done, say: "Slice {{sliceId}} refined." Say this exactly once — if you already said it in a prior message, do not repeat it.
@@ -38,4 +38,4 @@ Consider these captures when rewriting the remaining tasks — they represent th
38
38
  4. If any incomplete task had a `T0x-PLAN.md`, remove or rewrite it to match the new task description.
39
39
  5. Do not commit manually — the system auto-commits your changes after this unit completes.
40
40
 
41
- When done, say: "Slice {{sliceId}} replanned."
41
+ When done, say: "Slice {{sliceId}} replanned." Say this exactly once — if you already said it in a prior message, do not repeat it.
@@ -46,4 +46,4 @@ Then research the codebase and relevant technologies. Narrate key findings and s
46
46
 
47
47
  **You MUST call `gsd_summary_save` with the research content before finishing.**
48
48
 
49
- When done, say: "Milestone {{milestoneId}} researched."
49
+ When done, say: "Milestone {{milestoneId}} researched." Say this exactly once — if you already said it in a prior message, do not repeat it.