gsd-pi 2.82.0-dev.ed17d078d → 3.0.0-dev.1b44e695b

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 (619) hide show
  1. package/README.md +93 -18
  2. package/dist/cli.js +20 -9
  3. package/dist/headless-ui.js +13 -6
  4. package/dist/headless.js +9 -2
  5. package/dist/resources/.managed-resources-content-hash +1 -1
  6. package/dist/resources/GSD-WORKFLOW.md +10 -1
  7. package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
  8. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +44 -6
  9. package/dist/resources/extensions/cmux/index.js +5 -0
  10. package/dist/resources/extensions/gsd/auto/detect-stuck.js +1 -1
  11. package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
  12. package/dist/resources/extensions/gsd/auto/loop.js +122 -40
  13. package/dist/resources/extensions/gsd/auto/orchestrator.js +15 -4
  14. package/dist/resources/extensions/gsd/auto/phases.js +134 -49
  15. package/dist/resources/extensions/gsd/auto/session.js +6 -0
  16. package/dist/resources/extensions/gsd/auto/unit-runner-events.js +7 -1
  17. package/dist/resources/extensions/gsd/auto/workflow-kernel.js +3 -0
  18. package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
  19. package/dist/resources/extensions/gsd/auto-budget.js +9 -0
  20. package/dist/resources/extensions/gsd/auto-dashboard.js +66 -1
  21. package/dist/resources/extensions/gsd/auto-direct-dispatch.js +1 -0
  22. package/dist/resources/extensions/gsd/auto-dispatch.js +144 -30
  23. package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
  24. package/dist/resources/extensions/gsd/auto-post-unit.js +329 -137
  25. package/dist/resources/extensions/gsd/auto-prompts.js +36 -10
  26. package/dist/resources/extensions/gsd/auto-recovery.js +82 -16
  27. package/dist/resources/extensions/gsd/auto-start.js +99 -16
  28. package/dist/resources/extensions/gsd/auto-timers.js +11 -3
  29. package/dist/resources/extensions/gsd/auto-verification.js +146 -34
  30. package/dist/resources/extensions/gsd/auto-worktree.js +185 -26
  31. package/dist/resources/extensions/gsd/auto.js +135 -74
  32. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +65 -10
  33. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +13 -10
  34. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +14 -4
  35. package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
  36. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +24 -9
  37. package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
  38. package/dist/resources/extensions/gsd/commands/catalog.js +10 -1
  39. package/dist/resources/extensions/gsd/commands/handlers/core.js +38 -0
  40. package/dist/resources/extensions/gsd/commands/handlers/ops.js +20 -0
  41. package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
  42. package/dist/resources/extensions/gsd/commands-handlers.js +2 -0
  43. package/dist/resources/extensions/gsd/commands-mcp-status.js +9 -0
  44. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +10 -2
  45. package/dist/resources/extensions/gsd/commands-verdict.js +139 -0
  46. package/dist/resources/extensions/gsd/crash-recovery.js +55 -7
  47. package/dist/resources/extensions/gsd/db/auto-workers.js +30 -0
  48. package/dist/resources/extensions/gsd/db/milestone-leases.js +24 -0
  49. package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
  50. package/dist/resources/extensions/gsd/db-base-schema.js +2 -0
  51. package/dist/resources/extensions/gsd/db-migration-steps.js +4 -0
  52. package/dist/resources/extensions/gsd/db-task-slice-rows.js +2 -0
  53. package/dist/resources/extensions/gsd/dispatch-guard.js +46 -2
  54. package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
  55. package/dist/resources/extensions/gsd/doctor-git-checks.js +46 -1
  56. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
  57. package/dist/resources/extensions/gsd/doctor.js +2 -28
  58. package/dist/resources/extensions/gsd/export-html.js +27 -425
  59. package/dist/resources/extensions/gsd/forensics.js +10 -3
  60. package/dist/resources/extensions/gsd/git-service.js +152 -15
  61. package/dist/resources/extensions/gsd/gsd-db.js +76 -33
  62. package/dist/resources/extensions/gsd/guided-flow-queue.js +4 -3
  63. package/dist/resources/extensions/gsd/guided-flow.js +110 -117
  64. package/dist/resources/extensions/gsd/guided-unit-context.js +23 -0
  65. package/dist/resources/extensions/gsd/init-wizard.js +17 -2
  66. package/dist/resources/extensions/gsd/markdown-renderer.js +14 -11
  67. package/dist/resources/extensions/gsd/mcp-filter.js +58 -0
  68. package/dist/resources/extensions/gsd/migrate/parsers.js +121 -2
  69. package/dist/resources/extensions/gsd/migration-auto-check.js +12 -17
  70. package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
  71. package/dist/resources/extensions/gsd/native-git-bridge.js +57 -14
  72. package/dist/resources/extensions/gsd/parallel-orchestrator.js +3 -0
  73. package/dist/resources/extensions/gsd/paths.js +4 -0
  74. package/dist/resources/extensions/gsd/pending-auto-start.js +52 -0
  75. package/dist/resources/extensions/gsd/planning-path-scope.js +9 -3
  76. package/dist/resources/extensions/gsd/post-execution-checks.js +73 -9
  77. package/dist/resources/extensions/gsd/pre-execution-checks.js +54 -19
  78. package/dist/resources/extensions/gsd/preferences-mcp.js +19 -0
  79. package/dist/resources/extensions/gsd/preferences-types.js +3 -0
  80. package/dist/resources/extensions/gsd/preferences-validation.js +147 -0
  81. package/dist/resources/extensions/gsd/preferences.js +6 -0
  82. package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
  83. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  84. package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  85. package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
  86. package/dist/resources/extensions/gsd/prompts/discuss.md +9 -9
  87. package/dist/resources/extensions/gsd/prompts/forensics.md +3 -3
  88. package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
  89. package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
  90. package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -4
  91. package/dist/resources/extensions/gsd/prompts/queue.md +4 -4
  92. package/dist/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
  93. package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
  94. package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
  95. package/dist/resources/extensions/gsd/queue-reorder-ui.js +30 -13
  96. package/dist/resources/extensions/gsd/repo-identity.js +39 -22
  97. package/dist/resources/extensions/gsd/repository-registry.js +44 -0
  98. package/dist/resources/extensions/gsd/safety/evidence-collector.js +2 -0
  99. package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +42 -18
  100. package/dist/resources/extensions/gsd/session-lock.js +15 -2
  101. package/dist/resources/extensions/gsd/slice-parallel-conflict.js +2 -2
  102. package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +84 -5
  103. package/dist/resources/extensions/gsd/smart-entry-routing.js +36 -0
  104. package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
  105. package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +9 -14
  106. package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +19 -24
  107. package/dist/resources/extensions/gsd/state.js +28 -7
  108. package/dist/resources/extensions/gsd/status-guards.js +14 -2
  109. package/dist/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
  110. package/dist/resources/extensions/gsd/templates/plan.md +9 -5
  111. package/dist/resources/extensions/gsd/templates/task-plan.md +10 -2
  112. package/dist/resources/extensions/gsd/tools/complete-milestone.js +15 -9
  113. package/dist/resources/extensions/gsd/tools/complete-slice.js +56 -10
  114. package/dist/resources/extensions/gsd/tools/exec-tool.js +87 -5
  115. package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
  116. package/dist/resources/extensions/gsd/tools/plan-slice.js +151 -15
  117. package/dist/resources/extensions/gsd/tools/validate-milestone.js +32 -1
  118. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +185 -40
  119. package/dist/resources/extensions/gsd/unit-context-composer.js +2 -0
  120. package/dist/resources/extensions/gsd/unit-context-manifest.js +69 -17
  121. package/dist/resources/extensions/gsd/validation.js +23 -1
  122. package/dist/resources/extensions/gsd/verification-gate.js +142 -7
  123. package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
  124. package/dist/resources/extensions/gsd/workflow-manifest.js +2 -0
  125. package/dist/resources/extensions/gsd/workflow-mcp.js +17 -1
  126. package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
  127. package/dist/resources/extensions/gsd/worktree-lifecycle.js +86 -19
  128. package/dist/resources/extensions/gsd/worktree-manager.js +11 -2
  129. package/dist/resources/extensions/gsd/worktree-safety.js +43 -4
  130. package/dist/resources/extensions/gsd/worktree-state-projection.js +31 -0
  131. package/dist/resources/extensions/gsd/worktree-telemetry.js +32 -0
  132. package/dist/resources/extensions/shared/html-shell.js +388 -0
  133. package/dist/resources/extensions/shared/interview-ui.js +6 -4
  134. package/dist/resources/extensions/shared/next-action-ui.js +13 -5
  135. package/dist/resources/extensions/subagent/index.js +448 -78
  136. package/dist/resources/extensions/subagent/launch.js +77 -0
  137. package/dist/resources/extensions/subagent/run-store.js +148 -0
  138. package/dist/resources/extensions/ttsr/ttsr-manager.js +3 -1
  139. package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
  140. package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
  141. package/dist/resources/extensions/visual-brief/index.js +5 -0
  142. package/dist/resources/extensions/visual-brief/page-contract.js +124 -0
  143. package/dist/resources/extensions/visual-brief/prompts.js +140 -0
  144. package/dist/resources/skills/forensics/SKILL.md +1 -1
  145. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  146. package/dist/web/standalone/.next/BUILD_ID +1 -1
  147. package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -7
  148. package/dist/web/standalone/.next/build-manifest.json +3 -3
  149. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  150. package/dist/web/standalone/.next/react-loadable-manifest.json +5 -5
  151. package/dist/web/standalone/.next/required-server-files.json +1 -1
  152. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  153. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  154. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  155. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  156. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  157. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  158. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  159. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  160. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  161. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  162. package/dist/web/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  163. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  164. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  165. package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -7
  166. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
  167. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  168. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -5
  169. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  170. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  171. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -5
  172. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  173. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  174. package/dist/web/standalone/.next/server/app/index.html +1 -1
  175. package/dist/web/standalone/.next/server/app/index.rsc +4 -7
  176. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  177. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -7
  178. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  179. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +4 -5
  180. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
  181. package/dist/web/standalone/.next/server/app/page.js +2 -2
  182. package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
  183. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  184. package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -7
  185. package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
  186. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  187. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  188. package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
  189. package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
  190. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  191. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  192. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  193. package/dist/web/standalone/.next/static/chunks/2973.33f26573894b6153.js +2 -0
  194. package/dist/web/standalone/.next/static/chunks/8359.65b24fac92188a6b.js +10 -0
  195. package/dist/web/standalone/.next/static/chunks/9441.ff70bb53f6835771.js +1 -0
  196. package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
  197. package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-855d616060cb6e59.js} +1 -1
  198. package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
  199. package/dist/web/standalone/server.js +1 -1
  200. package/package.json +4 -4
  201. package/packages/contracts/dist/rpc.test.js +7 -0
  202. package/packages/contracts/dist/rpc.test.js.map +1 -1
  203. package/packages/contracts/dist/workflow.d.ts +21 -0
  204. package/packages/contracts/dist/workflow.d.ts.map +1 -1
  205. package/packages/contracts/dist/workflow.js +24 -0
  206. package/packages/contracts/dist/workflow.js.map +1 -1
  207. package/packages/contracts/src/rpc.test.ts +8 -0
  208. package/packages/contracts/src/workflow.ts +24 -0
  209. package/packages/daemon/package.json +2 -2
  210. package/packages/mcp-server/README.md +13 -4
  211. package/packages/mcp-server/dist/workflow-tools.d.ts +0 -3
  212. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  213. package/packages/mcp-server/dist/workflow-tools.js +80 -0
  214. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  215. package/packages/mcp-server/package.json +2 -2
  216. package/packages/mcp-server/src/workflow-tools.test.ts +23 -1
  217. package/packages/mcp-server/src/workflow-tools.ts +168 -0
  218. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  219. package/packages/native/package.json +1 -1
  220. package/packages/native/tsconfig.json +2 -1
  221. package/packages/native/tsconfig.tsbuildinfo +1 -1
  222. package/packages/pi-agent-core/package.json +1 -1
  223. package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
  224. package/packages/pi-ai/dist/providers/google-gemini-cli.js +5 -0
  225. package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
  226. package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts +2 -0
  227. package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts.map +1 -0
  228. package/packages/pi-ai/dist/providers/google-gemini-cli.test.js +41 -0
  229. package/packages/pi-ai/dist/providers/google-gemini-cli.test.js.map +1 -0
  230. package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
  231. package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
  232. package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
  233. package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
  234. package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
  235. package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
  236. package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
  237. package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
  238. package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
  239. package/packages/pi-ai/dist/providers/simple-options.js +5 -6
  240. package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
  241. package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
  242. package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
  243. package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
  244. package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
  245. package/packages/pi-ai/package.json +1 -1
  246. package/packages/pi-ai/src/providers/google-gemini-cli.test.ts +49 -0
  247. package/packages/pi-ai/src/providers/google-gemini-cli.ts +7 -0
  248. package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
  249. package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
  250. package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
  251. package/packages/pi-ai/src/providers/simple-options.ts +5 -6
  252. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  253. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
  254. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
  255. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
  256. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
  257. package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
  258. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  259. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +44 -3
  260. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  261. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +6 -1
  262. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
  263. package/packages/pi-coding-agent/dist/core/compaction/compaction.js +7 -2
  264. package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
  265. package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js +14 -1
  266. package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js.map +1 -1
  267. package/packages/pi-coding-agent/dist/core/sdk.js +1 -1
  268. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  269. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +8 -2
  270. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
  271. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  272. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +24 -6
  273. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  274. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -1
  275. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  276. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  277. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +82 -97
  278. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  279. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +7 -7
  280. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
  281. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +11 -0
  282. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
  283. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js +25 -1
  284. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js.map +1 -1
  285. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +2 -0
  286. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  287. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +24 -10
  288. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  289. package/packages/pi-coding-agent/package.json +1 -1
  290. package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
  291. package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
  292. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +53 -3
  293. package/packages/pi-coding-agent/src/core/compaction/compaction.test.ts +23 -1
  294. package/packages/pi-coding-agent/src/core/compaction/compaction.ts +7 -2
  295. package/packages/pi-coding-agent/src/core/sdk.ts +1 -1
  296. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +17 -1
  297. package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +23 -7
  298. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1 -1
  299. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +91 -102
  300. package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +15 -1
  301. package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +9 -9
  302. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +30 -1
  303. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +29 -10
  304. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  305. package/packages/pi-tui/dist/__tests__/terminal.test.d.ts +2 -0
  306. package/packages/pi-tui/dist/__tests__/terminal.test.d.ts.map +1 -0
  307. package/packages/pi-tui/dist/__tests__/terminal.test.js +103 -0
  308. package/packages/pi-tui/dist/__tests__/terminal.test.js.map +1 -0
  309. package/packages/pi-tui/dist/__tests__/tui.test.js +45 -2
  310. package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
  311. package/packages/pi-tui/dist/terminal.d.ts +2 -0
  312. package/packages/pi-tui/dist/terminal.d.ts.map +1 -1
  313. package/packages/pi-tui/dist/terminal.js +12 -0
  314. package/packages/pi-tui/dist/terminal.js.map +1 -1
  315. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  316. package/packages/pi-tui/dist/tui.js +106 -27
  317. package/packages/pi-tui/dist/tui.js.map +1 -1
  318. package/packages/pi-tui/package.json +1 -1
  319. package/packages/pi-tui/src/__tests__/terminal.test.ts +121 -0
  320. package/packages/pi-tui/src/__tests__/tui.test.ts +59 -2
  321. package/packages/pi-tui/src/terminal.ts +11 -0
  322. package/packages/pi-tui/src/tui.ts +108 -27
  323. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  324. package/packages/rpc-client/package.json +1 -1
  325. package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
  326. package/pkg/package.json +1 -1
  327. package/src/resources/GSD-WORKFLOW.md +10 -1
  328. package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
  329. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +52 -6
  330. package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
  331. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +49 -2
  332. package/src/resources/extensions/cmux/index.ts +6 -0
  333. package/src/resources/extensions/gsd/auto/contracts.ts +19 -6
  334. package/src/resources/extensions/gsd/auto/detect-stuck.ts +1 -0
  335. package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
  336. package/src/resources/extensions/gsd/auto/loop.ts +123 -40
  337. package/src/resources/extensions/gsd/auto/orchestrator.ts +15 -4
  338. package/src/resources/extensions/gsd/auto/phases.ts +160 -60
  339. package/src/resources/extensions/gsd/auto/session.ts +16 -0
  340. package/src/resources/extensions/gsd/auto/types.ts +3 -0
  341. package/src/resources/extensions/gsd/auto/unit-runner-events.ts +6 -2
  342. package/src/resources/extensions/gsd/auto/workflow-kernel.ts +5 -1
  343. package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
  344. package/src/resources/extensions/gsd/auto-budget.ts +11 -0
  345. package/src/resources/extensions/gsd/auto-dashboard.ts +72 -1
  346. package/src/resources/extensions/gsd/auto-direct-dispatch.ts +1 -0
  347. package/src/resources/extensions/gsd/auto-dispatch.ts +164 -29
  348. package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
  349. package/src/resources/extensions/gsd/auto-post-unit.ts +369 -148
  350. package/src/resources/extensions/gsd/auto-prompts.ts +36 -13
  351. package/src/resources/extensions/gsd/auto-recovery.ts +86 -13
  352. package/src/resources/extensions/gsd/auto-start.ts +109 -14
  353. package/src/resources/extensions/gsd/auto-timers.ts +10 -3
  354. package/src/resources/extensions/gsd/auto-verification.ts +174 -42
  355. package/src/resources/extensions/gsd/auto-worktree.ts +202 -30
  356. package/src/resources/extensions/gsd/auto.ts +172 -81
  357. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +66 -10
  358. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +13 -10
  359. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +13 -4
  360. package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
  361. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +27 -10
  362. package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
  363. package/src/resources/extensions/gsd/commands/catalog.ts +10 -1
  364. package/src/resources/extensions/gsd/commands/handlers/core.ts +41 -0
  365. package/src/resources/extensions/gsd/commands/handlers/ops.ts +21 -0
  366. package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
  367. package/src/resources/extensions/gsd/commands-handlers.ts +2 -0
  368. package/src/resources/extensions/gsd/commands-mcp-status.ts +8 -0
  369. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +11 -3
  370. package/src/resources/extensions/gsd/commands-verdict.ts +202 -0
  371. package/src/resources/extensions/gsd/crash-recovery.ts +55 -6
  372. package/src/resources/extensions/gsd/db/auto-workers.ts +37 -0
  373. package/src/resources/extensions/gsd/db/milestone-leases.ts +26 -0
  374. package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
  375. package/src/resources/extensions/gsd/db-base-schema.ts +2 -0
  376. package/src/resources/extensions/gsd/db-migration-steps.ts +5 -0
  377. package/src/resources/extensions/gsd/db-task-slice-rows.ts +4 -0
  378. package/src/resources/extensions/gsd/dispatch-guard.ts +60 -2
  379. package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
  380. package/src/resources/extensions/gsd/doctor-git-checks.ts +45 -1
  381. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
  382. package/src/resources/extensions/gsd/doctor-types.ts +1 -0
  383. package/src/resources/extensions/gsd/doctor.ts +2 -27
  384. package/src/resources/extensions/gsd/export-html.ts +27 -427
  385. package/src/resources/extensions/gsd/forensics.ts +9 -3
  386. package/src/resources/extensions/gsd/git-service.ts +182 -16
  387. package/src/resources/extensions/gsd/gsd-db.ts +80 -31
  388. package/src/resources/extensions/gsd/guided-flow-queue.ts +4 -3
  389. package/src/resources/extensions/gsd/guided-flow.ts +142 -134
  390. package/src/resources/extensions/gsd/guided-unit-context.ts +30 -0
  391. package/src/resources/extensions/gsd/init-wizard.ts +17 -2
  392. package/src/resources/extensions/gsd/journal.ts +8 -1
  393. package/src/resources/extensions/gsd/markdown-renderer.ts +14 -11
  394. package/src/resources/extensions/gsd/mcp-filter.ts +80 -0
  395. package/src/resources/extensions/gsd/migrate/parsers.ts +139 -2
  396. package/src/resources/extensions/gsd/migration-auto-check.ts +15 -23
  397. package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
  398. package/src/resources/extensions/gsd/native-git-bridge.ts +63 -14
  399. package/src/resources/extensions/gsd/parallel-orchestrator.ts +3 -0
  400. package/src/resources/extensions/gsd/paths.ts +5 -0
  401. package/src/resources/extensions/gsd/pending-auto-start.ts +79 -0
  402. package/src/resources/extensions/gsd/planning-path-scope.ts +10 -2
  403. package/src/resources/extensions/gsd/post-execution-checks.ts +87 -12
  404. package/src/resources/extensions/gsd/pre-execution-checks.ts +67 -19
  405. package/src/resources/extensions/gsd/preferences-mcp.ts +27 -0
  406. package/src/resources/extensions/gsd/preferences-types.ts +35 -0
  407. package/src/resources/extensions/gsd/preferences-validation.ts +154 -0
  408. package/src/resources/extensions/gsd/preferences.ts +9 -0
  409. package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
  410. package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  411. package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  412. package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
  413. package/src/resources/extensions/gsd/prompts/discuss.md +9 -9
  414. package/src/resources/extensions/gsd/prompts/forensics.md +3 -3
  415. package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
  416. package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
  417. package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -4
  418. package/src/resources/extensions/gsd/prompts/queue.md +4 -4
  419. package/src/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
  420. package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
  421. package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
  422. package/src/resources/extensions/gsd/queue-reorder-ui.ts +31 -13
  423. package/src/resources/extensions/gsd/repo-identity.ts +45 -25
  424. package/src/resources/extensions/gsd/repository-registry.ts +77 -0
  425. package/src/resources/extensions/gsd/safety/evidence-collector.ts +2 -0
  426. package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +54 -19
  427. package/src/resources/extensions/gsd/session-lock.ts +15 -2
  428. package/src/resources/extensions/gsd/slice-parallel-conflict.ts +2 -2
  429. package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +75 -3
  430. package/src/resources/extensions/gsd/smart-entry-routing.ts +77 -0
  431. package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
  432. package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +12 -15
  433. package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +17 -25
  434. package/src/resources/extensions/gsd/state.ts +33 -7
  435. package/src/resources/extensions/gsd/status-guards.ts +16 -2
  436. package/src/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
  437. package/src/resources/extensions/gsd/templates/plan.md +9 -5
  438. package/src/resources/extensions/gsd/templates/task-plan.md +10 -2
  439. package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +1 -1
  440. package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +10 -1
  441. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +71 -0
  442. package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
  443. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +775 -34
  444. package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +245 -28
  445. package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +151 -12
  446. package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +53 -2
  447. package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +18 -6
  448. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +136 -13
  449. package/src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts +64 -0
  450. package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +12 -0
  451. package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
  452. package/src/resources/extensions/gsd/tests/auto-stop-notification.test.ts +20 -0
  453. package/src/resources/extensions/gsd/tests/auto-workers.test.ts +29 -0
  454. package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
  455. package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +21 -0
  456. package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
  457. package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +87 -0
  458. package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
  459. package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +32 -4
  460. package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
  461. package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +378 -0
  462. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +55 -2
  463. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +60 -9
  464. package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
  465. package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +104 -2
  466. package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +2 -0
  467. package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
  468. package/src/resources/extensions/gsd/tests/db-task-slice-rows.test.ts +1 -0
  469. package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +61 -2
  470. package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +111 -1
  471. package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +68 -1
  472. package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +140 -1
  473. package/src/resources/extensions/gsd/tests/doctor-empty-worktree.test.ts +65 -0
  474. package/src/resources/extensions/gsd/tests/doctor-forensics-db-open-regression.test.ts +50 -0
  475. package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +97 -0
  476. package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +99 -1
  477. package/src/resources/extensions/gsd/tests/execution-entry-missing-context-4671.test.ts +15 -1
  478. package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
  479. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +28 -0
  480. package/src/resources/extensions/gsd/tests/gsdroot-worktree-detection.test.ts +5 -2
  481. package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
  482. package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +106 -0
  483. package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +59 -11
  484. package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
  485. package/src/resources/extensions/gsd/tests/guided-tool-contract.test.ts +65 -0
  486. package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +7 -7
  487. package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
  488. package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
  489. package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
  490. package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +22 -0
  491. package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
  492. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +226 -2
  493. package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +5 -21
  494. package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +15 -0
  495. package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
  496. package/src/resources/extensions/gsd/tests/interrupted-session-auto.test.ts +40 -0
  497. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +49 -3
  498. package/src/resources/extensions/gsd/tests/journal.test.ts +32 -0
  499. package/src/resources/extensions/gsd/tests/mcp-filter.test.ts +287 -0
  500. package/src/resources/extensions/gsd/tests/mcp-status.test.ts +11 -0
  501. package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +179 -0
  502. package/src/resources/extensions/gsd/tests/merge-self-branch-guard.test.ts +21 -40
  503. package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +59 -1
  504. package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +26 -18
  505. package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +80 -2
  506. package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
  507. package/src/resources/extensions/gsd/tests/parallel-orchestrator-zombie-cleanup.test.ts +55 -0
  508. package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
  509. package/src/resources/extensions/gsd/tests/pending-autostart-scope.test.ts +29 -5
  510. package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +2 -1
  511. package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
  512. package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
  513. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +343 -3
  514. package/src/resources/extensions/gsd/tests/plan-task.test.ts +18 -1
  515. package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
  516. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -3
  517. package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +8 -1
  518. package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +84 -0
  519. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +147 -0
  520. package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +54 -0
  521. package/src/resources/extensions/gsd/tests/preferences-mcp.test.ts +128 -0
  522. package/src/resources/extensions/gsd/tests/preferences.test.ts +75 -0
  523. package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +79 -0
  524. package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +42 -1
  525. package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
  526. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +37 -1
  527. package/src/resources/extensions/gsd/tests/quality-gates.test.ts +6 -0
  528. package/src/resources/extensions/gsd/tests/queue-reorder-ui.test.ts +54 -0
  529. package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +89 -2
  530. package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +28 -1
  531. package/src/resources/extensions/gsd/tests/repository-registry.test.ts +52 -0
  532. package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +2 -3
  533. package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +35 -0
  534. package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +59 -1
  535. package/src/resources/extensions/gsd/tests/slice-parallel-conflict.test.ts +2 -2
  536. package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +112 -1
  537. package/src/resources/extensions/gsd/tests/smart-entry-routing.test.ts +113 -0
  538. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +94 -2
  539. package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +6 -0
  540. package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +119 -23
  541. package/src/resources/extensions/gsd/tests/status-guards.test.ts +17 -1
  542. package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -1
  543. package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +2 -1
  544. package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
  545. package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +1 -0
  546. package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +131 -9
  547. package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +111 -1
  548. package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +29 -2
  549. package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +68 -0
  550. package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +42 -1
  551. package/src/resources/extensions/gsd/tests/verification-gate.test.ts +188 -1
  552. package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
  553. package/src/resources/extensions/gsd/tests/workflow-kernel.test.ts +7 -0
  554. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +19 -1
  555. package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
  556. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +153 -1
  557. package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
  558. package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
  559. package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +73 -2
  560. package/src/resources/extensions/gsd/tests/worktree-preferences-sync.test.ts +25 -0
  561. package/src/resources/extensions/gsd/tests/worktree-safety.test.ts +90 -0
  562. package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +95 -0
  563. package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +16 -0
  564. package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +27 -0
  565. package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +59 -0
  566. package/src/resources/extensions/gsd/tools/complete-milestone.ts +18 -10
  567. package/src/resources/extensions/gsd/tools/complete-slice.ts +57 -10
  568. package/src/resources/extensions/gsd/tools/exec-tool.ts +98 -5
  569. package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
  570. package/src/resources/extensions/gsd/tools/plan-slice.ts +172 -12
  571. package/src/resources/extensions/gsd/tools/validate-milestone.ts +31 -0
  572. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +166 -17
  573. package/src/resources/extensions/gsd/types.ts +1 -1
  574. package/src/resources/extensions/gsd/unit-context-composer.ts +3 -0
  575. package/src/resources/extensions/gsd/unit-context-manifest.ts +86 -19
  576. package/src/resources/extensions/gsd/validation.ts +23 -1
  577. package/src/resources/extensions/gsd/verification-gate.ts +170 -6
  578. package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
  579. package/src/resources/extensions/gsd/workflow-manifest.ts +2 -0
  580. package/src/resources/extensions/gsd/workflow-mcp.ts +18 -1
  581. package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
  582. package/src/resources/extensions/gsd/worktree-lifecycle.ts +98 -20
  583. package/src/resources/extensions/gsd/worktree-manager.ts +14 -2
  584. package/src/resources/extensions/gsd/worktree-safety.ts +57 -10
  585. package/src/resources/extensions/gsd/worktree-state-projection.ts +43 -0
  586. package/src/resources/extensions/gsd/worktree-telemetry.ts +39 -0
  587. package/src/resources/extensions/shared/html-shell.ts +412 -0
  588. package/src/resources/extensions/shared/interview-ui.ts +6 -4
  589. package/src/resources/extensions/shared/next-action-ui.ts +11 -5
  590. package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +15 -0
  591. package/src/resources/extensions/shared/tests/next-action-ui-hasui.test.ts +32 -0
  592. package/src/resources/extensions/subagent/index.ts +567 -103
  593. package/src/resources/extensions/subagent/launch.ts +131 -0
  594. package/src/resources/extensions/subagent/run-store.ts +218 -0
  595. package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
  596. package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
  597. package/src/resources/extensions/ttsr/ttsr-manager.ts +5 -1
  598. package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
  599. package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
  600. package/src/resources/extensions/visual-brief/index.ts +8 -0
  601. package/src/resources/extensions/visual-brief/page-contract.ts +136 -0
  602. package/src/resources/extensions/visual-brief/prompts.ts +183 -0
  603. package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +212 -0
  604. package/src/resources/skills/forensics/SKILL.md +1 -1
  605. package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
  606. package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
  607. package/dist/web/standalone/.next/static/chunks/8359.e059d86b255fce1c.js +0 -10
  608. package/dist/web/standalone/.next/static/chunks/9441.1081da1125d1764f.js +0 -1
  609. package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
  610. package/dist/web/standalone/.next/static/css/54ec2745c1da488b.css +0 -1
  611. package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
  612. package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
  613. package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
  614. package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
  615. package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
  616. package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
  617. package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
  618. /package/dist/web/standalone/.next/static/{YEvjuT-fsFfYQhDSWtueS → Z8H5evS-hDo0qdP22XJPA}/_buildManifest.js +0 -0
  619. /package/dist/web/standalone/.next/static/{YEvjuT-fsFfYQhDSWtueS → Z8H5evS-hDo0qdP22XJPA}/_ssgManifest.js +0 -0
@@ -50,11 +50,11 @@ GSD extension source: `{{gsdSourceDir}}`
50
50
 
51
51
  The journal is a structured event log for auto-mode iterations. Daily files contain JSONL:
52
52
 
53
- ```
54
- { ts: "ISO-8601", flowId: "UUID", seq: 0, eventType: "iteration-start", rule?: "rule-name", causedBy?: { flowId, seq }, data?: { unitId, status, ... } }
53
+ ```json
54
+ { ts: "ISO-8601", flowId: "UUID", seq: 0, eventType: "orchestrator-iteration-start", rule?: "rule-name", causedBy?: { flowId, seq }, data?: { unitId, status, ... } }
55
55
  ```
56
56
 
57
- Key events: `iteration-start/end`, `dispatch-match/stop`, `unit-start/end`, `terminal`, `guard-block`, `stuck-detected`, `milestone-transition`, worktree events. `flowId` groups one loop; `causedBy` links causal events; `seq` orders events. Trace stuck loops with `stuck-detected` -> `flowId`; guard blocks with `guard-block` and `data.reason`.
57
+ Key orchestrator events: `orchestrator-iteration-start/end`, `orchestrator-dispatch-match/stop`, `orchestrator-guard-block`, `orchestrator-terminal`. Legacy loop and phase events (`iteration-start/end`, `dispatch-match/stop`, `unit-start/end`, `terminal`, `guard-block`, `stuck-detected`, `milestone-transition`) still appear for non-orchestrator paths, along with worktree events. `flowId` groups one loop; `causedBy` links causal events; `seq` orders events. Trace orchestrator stalls with `orchestrator-guard-block`/`orchestrator-dispatch-stop` and `data.reason`.
58
58
 
59
59
  ### Crash Lock Format (`auto.lock`)
60
60
 
@@ -1,6 +1,6 @@
1
1
  **Working directory:** `{{workingDirectory}}`. All file reads, writes, and shell commands MUST operate relative to this directory. Do NOT `cd` elsewhere. For `.gsd` files, use absolute paths rooted at `{{workingDirectory}}`, not `Glob`.
2
2
 
3
- Discuss the **project** as a whole: vision, users, anti-goals, constraints, and rough milestone sequence. Ask only real gray areas, then write `.gsd/PROJECT.md` with the **Project** template below. If a `GSD Skill Preferences` block exists, use it; artifact rules still apply.
3
+ Discuss the **project** as a whole: vision, users, anti-goals, constraints, and rough milestone sequence. Ask only real gray areas, then persist the final Project template through `gsd_summary_save` with `artifact_type: "PROJECT"`. The tool renders `.gsd/PROJECT.md`; do not write the projection directly. If a `GSD Skill Preferences` block exists, use it; artifact rules still apply.
4
4
 
5
5
  This runs once before milestone discussion. Later milestones, requirements, and roadmaps depend on it.
6
6
 
@@ -34,7 +34,7 @@ After the opening answer, classify project shape as **`simple`** or **`complex`*
34
34
 
35
35
  **Default to `complex` when uncertain.** The user can override the verdict in plain text; if they do, accept it and proceed.
36
36
 
37
- Persist the verdict to PROJECT.md -> `## Project Shape`; downstream `discuss-requirements`, `discuss-milestone`, and `discuss-slice` read it from there.
37
+ Persist the verdict through `gsd_summary_save` with `artifact_type: "PROJECT"` into `## Project Shape`; downstream `discuss-requirements`, `discuss-milestone`, and `discuss-slice` read the rendered projection.
38
38
 
39
39
  ### Before deeper rounds
40
40
 
@@ -95,7 +95,7 @@ If they clarify, absorb the correction and re-verify.
95
95
 
96
96
  The depth verification is the only required confirmation gate. Do not add a second "ready to proceed?" gate after it.
97
97
 
98
- **CRITICAL — Confirmation gate:** Do not write final PROJECT.md until the user selects the "(Recommended)" option (structured path) or explicitly confirms (plain-text path). If the user declines, cancels, does not respond, or the tool fails, re-ask.
98
+ **CRITICAL — Confirmation gate:** Do not persist final PROJECT content until the user selects the "(Recommended)" option (structured path) or explicitly confirms (plain-text path). If the user declines, cancels, does not respond, or the tool fails, re-ask.
99
99
 
100
100
  ---
101
101
 
@@ -104,7 +104,7 @@ The depth verification is the only required confirmation gate. Do not add a seco
104
104
  Once the user confirms depth:
105
105
 
106
106
  1. Use the **Project** output template (inlined above).
107
- 2. Call `gsd_summary_save` with `artifact_type: "PROJECT"` and full project markdown as `content`; omit `milestone_id`. The tool writes `.gsd/PROJECT.md` and persists to DB. Preserve the user's terms and framing.
107
+ 2. Call `gsd_summary_save` with `artifact_type: "PROJECT"` and full project markdown as `content`; omit `milestone_id`. The tool persists the DB-backed PROJECT artifact and renders `.gsd/PROJECT.md`. Preserve the user's terms and framing.
108
108
  3. The `## Project Shape` section MUST contain `**Complexity:** simple` or `**Complexity:** complex` (matching the verdict you announced) plus a one-line `**Why:**` rationale. Downstream stages read this line.
109
109
  4. The `## Capability Contract` section MUST reference `.gsd/REQUIREMENTS.md` — that file does not yet exist; the next stage (`discuss-requirements`) will produce it.
110
110
  5. The `## Milestone Sequence` MUST list at least M001 with title and one-liner. Subsequent milestones may be listed as known intents; they will be elaborated in their own discuss-milestone stages.
@@ -1,6 +1,6 @@
1
1
  **Working directory:** `{{workingDirectory}}`. All file reads, writes, and shell commands MUST operate relative to this directory. Do NOT `cd` elsewhere. For `.gsd` files, use absolute paths rooted at `{{workingDirectory}}`, not `Glob`.
2
2
 
3
- Discuss **project-level requirements**. Read `.gsd/PROJECT.md` first; it is authoritative for vision, core value, anti-goals, and milestone sequence. Requirements must trace to it. Ask capability gray areas, then write `.gsd/REQUIREMENTS.md` using v2 `R###` format and the **Requirements** template.
3
+ Discuss **project-level requirements**. Read `.gsd/PROJECT.md` first; it is the rendered project artifact for vision, core value, anti-goals, and milestone sequence. Requirements must trace to it. Ask capability gray areas, then persist requirements with `gsd_requirement_save` and render `.gsd/REQUIREMENTS.md` through `gsd_summary_save` using v2 `R###` format and the **Requirements** template.
4
4
 
5
5
  This runs once after `discuss-project` and before milestone work, creating the capability contract for milestones, slices, and verification.
6
6
 
@@ -25,7 +25,7 @@ Before your first action, print this banner verbatim in chat:
25
25
  3. If `.gsd/REQUIREMENTS.md` exists, read it as the working set.
26
26
 
27
27
  **Shape-dependent cadence:**
28
- - **`simple`**: one fast pass. Extract from PROJECT.md, ask 1-2 plain-text clarifiers only when class/status is ambiguous, then write REQUIREMENTS.md.
28
+ - **`simple`**: one fast pass. Extract from PROJECT.md, ask 1-2 plain-text clarifiers only when class/status is ambiguous, then persist requirements through the DB-backed tools.
29
29
  - **`complex`**: multi-round questioning with structured 3-4-option questions where alternatives matter.
30
30
 
31
31
  ---
@@ -81,7 +81,7 @@ Before the wrap-up gate, verify: every milestone has an Active requirement; Core
81
81
 
82
82
  If they adjust, absorb and re-verify.
83
83
 
84
- **CRITICAL — Confirmation gate:** Do not write final REQUIREMENTS.md until explicit confirmation. Never rationalize past it.
84
+ **CRITICAL — Confirmation gate:** Do not persist final REQUIREMENTS content until explicit confirmation. Never rationalize past it.
85
85
 
86
86
  ---
87
87
 
@@ -26,7 +26,7 @@ Before planning, validate roadmap assumptions against code and dependency summar
26
26
 
27
27
  {{sourceFilePaths}}
28
28
 
29
- If slice research is inlined, trust it. Explore enough code to confirm paths, boundaries, and verification. Executors later get only task plans, slice excerpt, and prior summaries, so put required paths, steps, inputs, and outputs in task plans.
29
+ If slice research is inlined, trust its architectural findings, but verify every concrete file path you place in task `inputs` or `expectedOutput` against the current tree or prior/same-task outputs. Explore enough code to confirm paths, boundaries, and verification. Executors later get only task plans, slice excerpt, and prior summaries, so put required paths, steps, inputs, and outputs in task plans.
30
30
 
31
31
  {{executorContextConstraints}}
32
32
 
@@ -39,10 +39,10 @@ If slice research is inlined, trust it. Explore enough code to confirm paths, bo
39
39
  5. Define slice verification before tasks. Non-trivial slices need real tests or executable assertions; boundary contracts need contract-exercising checks. Tests must not read .gitignore/gitignored paths such as `.gsd/`, `.planning/`, or `.audits/`.
40
40
  6. Include Threat Surface (Q3), Requirement Impact (Q4), proof level, observability, integration closure, Failure Modes (Q5), Load Profile (Q6), and Negative Tests (Q7) only where applicable.
41
41
  7. Right-size tasks. Simple slices can be one task; split only when context, ownership, or verification boundaries justify it.
42
- 8. Each task needs a concrete title, Why / Files / Do / Verify / Done when, plus task-plan description, steps, must-haves, verification, inputs, and expected output. Inputs and Expected Output must include concrete backtick-wrapped paths. Use paths relative to `{{workingDirectory}}`; do not put absolute paths to the original checkout or any directory outside `{{workingDirectory}}` in `files`, `inputs`, `expectedOutput`, or verification commands. **`expected_output` must only list files the task actually creates or overwrites on disk.** Do NOT include files the task merely reads, verifies, or tests — those belong only in `inputs`. If a task is a pure verification or test task that produces no new files, its `expected_output` may be empty or limited to test-result artifacts (e.g. a log or assertion output). A file that does not yet exist on disk and is needed as an `input` must be produced by an earlier task's `expected_output` — if no prior task creates it, add a task before this one that does.
43
- 9. Persist with `gsd_plan_slice` using goal, successCriteria, optional proofLevel/integrationClosure/observabilityImpact, and tasks. `gsd_plan_slice` handles task persistence transactionally and renders `{{outputPath}}` plus task plans; do not call `gsd_plan_task`. The DB-backed tool is the canonical write path. Do **not** rely on direct `PLAN.md` writes as the source of truth.
42
+ 8. Each task needs the exact `gsd_plan_slice.tasks[]` shape: `taskId`, `title`, `description`, `estimate`, `files`, `verify`, `inputs`, `expectedOutput`, and optional `observabilityImpact`. `description` should contain the Why / Do / Done-when narrative. `files`, `inputs`, and `expectedOutput` must be JSON arrays of strings, even when there is only one path (for example, `"inputs": ["src/index.ts"]`, never `"inputs": "src/index.ts"`). Use paths relative to `{{workingDirectory}}`; do not put absolute paths to the original checkout or any directory outside `{{workingDirectory}}` in `files`, `inputs`, `expectedOutput`, or verification commands. **`expectedOutput` must only list files the task actually creates or overwrites on disk.** Do NOT include files the task merely reads, verifies, or tests — those belong only in `inputs`. If a task is a pure verification or test task that produces no new files, `expectedOutput` may be `[]` or limited to test-result artifacts (e.g. a log or assertion output). A file that does not yet exist on disk and is needed as an `input` must be produced by an earlier task's `expectedOutput` — if no prior task creates it, add a task before this one that does.
43
+ 9. Persist with `gsd_plan_slice` using `milestoneId`, `sliceId`, `goal`, optional `successCriteria`/`proofLevel`/`integrationClosure`/`observabilityImpact`, and `tasks`. `gsd_plan_slice` handles task persistence transactionally and renders `{{outputPath}}` plus task plans; do not call `gsd_plan_task`. The DB-backed tool is the canonical write path. Do **not** rely on direct `PLAN.md` writes as the source of truth.
44
44
  10. Self-audit before finishing: goal/demo closure, requirement coverage, locked decisions, concrete paths, dependency order, wiring, scope size, proof truthfulness, feature completeness, and quality gates. Quality gates: non-trivial slices/tasks include specific Q3-Q7 coverage where applicable.
45
- 11. If planning creates structural decisions, append them to `.gsd/DECISIONS.md`.
45
+ 11. If planning creates structural decisions, call `gsd_decision_save` for each; the tool persists the decision and regenerates `.gsd/DECISIONS.md`.
46
46
  12. {{commitInstruction}}
47
47
 
48
48
  The slice directory already exists. Do not mkdir.
@@ -114,10 +114,10 @@ Once the user is satisfied, in one pass for **each** new milestone:
114
114
 
115
115
  After all milestone directories and context files are written:
116
116
 
117
- 3. Update `.gsd/PROJECT.md` by adding new milestones to the Milestone Sequence. Keep existing entries exactly as-is; only add new lines.
118
- 4. If `.gsd/REQUIREMENTS.md` exists and the queued work introduces new in-scope capabilities or promotes Deferred items, update it.
119
- 5. If discussion produced decisions relevant to existing work, append to `.gsd/DECISIONS.md`.
120
- 6. Append to `.gsd/QUEUE.md`.
117
+ 3. Refresh project state through `gsd_summary_save` with `artifact_type: "PROJECT"` and full PROJECT content that includes the new milestones in the Milestone Sequence; omit `milestone_id`.
118
+ 4. If the queued work introduces new in-scope capabilities or promotes Deferred items, persist those changes with `gsd_requirement_save` or `gsd_requirement_update`, then call `gsd_summary_save` with `artifact_type: "REQUIREMENTS"` so `.gsd/REQUIREMENTS.md` renders from DB rows.
119
+ 5. If discussion produced decisions relevant to existing work, call `gsd_decision_save` for each decision; the tool regenerates `.gsd/DECISIONS.md`.
120
+ 6. If `.gsd/QUEUE.md` is maintained, update it only as an audit projection of queued intent. Runtime queue state must come from the DB-backed milestone/context tool calls above.
121
121
  7. {{commitInstruction}}
122
122
 
123
123
  **Do NOT write roadmaps for queued milestones.**
@@ -8,7 +8,7 @@
8
8
 
9
9
  You are executing **multiple tasks in parallel** for this slice. The task graph below shows which tasks are ready for simultaneous execution based on their input/output dependencies.
10
10
 
11
- **Critical rule:** Use the `subagent` tool in **parallel mode** to dispatch all ready tasks simultaneously. Each subagent gets a full `execute-task` prompt and is responsible for its own implementation, verification, task summary, and completion tool calls. The parent batch agent orchestrates, verifies, and records failures only when a dispatched task failed before it could leave its own summary behind.
11
+ **Critical rule:** Use the `subagent` tool in **parallel mode** to dispatch all ready tasks simultaneously. Each subagent gets a task-specific execution packet (task plan + dependency carry-forward + completion contract) and is responsible for its own implementation, verification, task summary, and completion tool calls. The parent batch agent orchestrates, verifies, and records failures only when a dispatched task failed before it could leave its own summary behind.
12
12
 
13
13
  ## Task Dependency Graph
14
14
 
@@ -64,10 +64,10 @@ Then:
64
64
  2. {{skillActivation}} Record the installed skills you expect executors to use in each task plan's `skills_used` frontmatter.
65
65
  3. Define slice-level verification: the objective stopping condition. Plan real test files with real assertions; for simple slices, executable commands are fine.
66
66
  4. For non-trivial slices, plan observability / proof level / integration closure, threat surface, and requirement impact. Omit entirely for simple slices.
67
- 5. Decompose the slice into tasks that fit one context window each. Every task must have Why / Files / Do / Verify / Done-when, plus a task plan with description, steps, must-haves, verification, inputs (backtick-wrapped paths), and expected output (backtick-wrapped paths).
67
+ 5. Decompose the slice into tasks that fit one context window each. Every task passed to `gsd_plan_slice` must use the exact keys `taskId`, `title`, `description`, `estimate`, `files`, `verify`, `inputs`, `expectedOutput`, and optional `observabilityImpact`. Put Why / Do / Done-when detail in `description`. `files`, `inputs`, and `expectedOutput` must be JSON arrays of strings, even for one path (for example, `"expectedOutput": ["src/index.ts"]`, never `"expectedOutput": "src/index.ts"`).
68
68
  6. **Persist planning state through `gsd_plan_slice`.** Call it with the full payload. The tool writes to the DB and renders `{{outputPath}}` and `{{slicePath}}/tasks/T##-PLAN.md` automatically. Do NOT rely on direct `PLAN.md` writes.
69
69
  7. **Self-audit the plan.** If every task were completed exactly as written, the slice goal/demo should be true. Every must-have maps to a task. Inputs and Expected Output are backtick-wrapped file paths.
70
- 8. If refinement produced structural decisions that diverge from the sketch, append them to `.gsd/DECISIONS.md`.
70
+ 8. If refinement produced structural decisions that diverge from the sketch, call `gsd_decision_save` for each; the tool persists the decision and regenerates `.gsd/DECISIONS.md`.
71
71
  9. {{commitInstruction}}
72
72
 
73
73
  The slice directory and tasks/ subdirectory already exist. Do NOT mkdir.
@@ -23,7 +23,7 @@ An override was issued by the user that changes a fundamental decision or approa
23
23
  - For DECISIONS.md: append a new decision entry documenting the override and why. Do NOT delete prior decisions — mark them as superseded with a note.
24
24
  - For slice plans (S##-PLAN.md): update Goal, Demo, and Verification sections if affected. Update Files Likely Touched if the override changes scope. Do NOT modify completed task entries.
25
25
  - For REQUIREMENTS.md: update requirement descriptions if the override changes what "done" means, but do not remove requirements.
26
- - For PROJECT.md: update if the override changes project-level facts.
26
+ - For PROJECT.md: do not edit the projection directly. If the override changes project-level facts, persist the revised Project content through `gsd_summary_save` with `artifact_type: "PROJECT"` so the DB remains authoritative.
27
27
  - Milestone context files are reference only — do not modify them.
28
28
  4. Mark all active overrides as resolved: change `**Scope:** active` to `**Scope:** resolved` in `{{overridesPath}}`
29
29
  5. Do not commit manually — the system auto-commits your changes after this unit completes.
@@ -24,6 +24,7 @@ export async function showQueueReorder(ctx, completed, pending) {
24
24
  const items = [...pending];
25
25
  let cursor = 0;
26
26
  let grabbed = false;
27
+ let scrollOffset = 0;
27
28
  let cachedLines;
28
29
  let validation;
29
30
  // Mutable deps map — tracks removals during this session
@@ -128,9 +129,11 @@ export async function showQueueReorder(ctx, completed, pending) {
128
129
  return cachedLines;
129
130
  const ui = makeUI(theme, width);
130
131
  const lines = [];
132
+ const queueRows = [];
131
133
  const push = (...rows) => { for (const r of rows)
132
134
  lines.push(...r); };
133
135
  const add = (s) => truncateToWidth(s, width);
136
+ let cursorQueueRow = 0;
134
137
  const headerText = grabbed ? " Queue Reorder — Moving Item" : " Queue Reorder";
135
138
  push(ui.bar(), ui.blank(), ui.header(headerText), ui.blank());
136
139
  // Completed milestones (dimmed)
@@ -153,13 +156,15 @@ export async function showQueueReorder(ctx, completed, pending) {
153
156
  const num = i + 1;
154
157
  const label = item.title && item.title !== item.id ? `${item.id} ${item.title}` : item.id;
155
158
  if (isCursor && grabbed) {
156
- lines.push(add(` ${theme.fg("warning", `▸▸ ${num}. ${label}`)}`));
159
+ cursorQueueRow = queueRows.length;
160
+ queueRows.push(add(` ${theme.fg("warning", `▸▸ ${num}. ${label}`)}`));
157
161
  }
158
162
  else if (isCursor) {
159
- lines.push(add(` ${theme.fg("accent", `${GLYPH.cursor} ${num}. ${label}`)}`));
163
+ cursorQueueRow = queueRows.length;
164
+ queueRows.push(add(` ${theme.fg("accent", `${GLYPH.cursor} ${num}. ${label}`)}`));
160
165
  }
161
166
  else {
162
- lines.push(add(` ${theme.fg("text", `${num}. ${label}`)}`));
167
+ queueRows.push(add(` ${theme.fg("text", `${num}. ${label}`)}`));
163
168
  }
164
169
  // depends_on annotations
165
170
  const deps = liveDeps.get(item.id) ?? [];
@@ -168,34 +173,35 @@ export async function showQueueReorder(ctx, completed, pending) {
168
173
  continue;
169
174
  const pairKey = `${item.id}:${dep}`;
170
175
  if (violatedPairs.has(pairKey)) {
171
- lines.push(add(` ${theme.fg("warning", `${GLYPH.statusWarning} depends_on: ${dep} — auto-removed on confirm`)}`));
176
+ queueRows.push(add(` ${theme.fg("warning", `${GLYPH.statusWarning} depends_on: ${dep} — auto-removed on confirm`)}`));
172
177
  }
173
178
  else if (redundantPairs.has(pairKey)) {
174
- lines.push(add(` ${theme.fg("dim", `↳ depends_on: ${dep} (redundant)`)}`));
179
+ queueRows.push(add(` ${theme.fg("dim", `↳ depends_on: ${dep} (redundant)`)}`));
175
180
  }
176
181
  else {
177
- lines.push(add(` ${theme.fg("dim", `↳ depends_on: ${dep}`)}`));
182
+ queueRows.push(add(` ${theme.fg("dim", `↳ depends_on: ${dep}`)}`));
178
183
  }
179
184
  }
180
185
  // Missing deps
181
186
  for (const v of validation.violations.filter(v => v.milestone === item.id && v.type === 'missing_dep')) {
182
- lines.push(add(` ${theme.fg("error", `${GLYPH.statusWarning} depends_on: ${v.dependsOn} (does not exist)`)}`));
187
+ queueRows.push(add(` ${theme.fg("error", `${GLYPH.statusWarning} depends_on: ${v.dependsOn} (does not exist)`)}`));
183
188
  }
184
189
  }
185
190
  // Removed deps feedback
191
+ const trailingLines = [];
186
192
  if (removedDeps.length > 0) {
187
- push(ui.blank());
193
+ trailingLines.push(...ui.blank());
188
194
  for (const r of removedDeps) {
189
- lines.push(add(` ${theme.fg("success", `${GLYPH.statusDone} Removed: ${r.milestone} depends_on ${r.dep}`)}`));
195
+ trailingLines.push(add(` ${theme.fg("success", `${GLYPH.statusDone} Removed: ${r.milestone} depends_on ${r.dep}`)}`));
190
196
  }
191
197
  }
192
198
  // Circular warning
193
199
  const circ = validation.violations.find(v => v.type === 'circular');
194
200
  if (circ) {
195
- push(ui.blank());
196
- lines.push(add(` ${theme.fg("error", `${GLYPH.statusWarning} ${circ.message}`)}`));
201
+ trailingLines.push(...ui.blank());
202
+ trailingLines.push(add(` ${theme.fg("error", `${GLYPH.statusWarning} ${circ.message}`)}`));
197
203
  }
198
- push(ui.blank());
204
+ trailingLines.push(...ui.blank());
199
205
  // Hints — context-sensitive based on grab state
200
206
  const hints = [];
201
207
  if (grabbed) {
@@ -215,7 +221,18 @@ export async function showQueueReorder(ctx, completed, pending) {
215
221
  hints.push("enter ok");
216
222
  }
217
223
  hints.push("esc");
218
- push(ui.hints(hints), ui.bar());
224
+ trailingLines.push(...ui.hints(hints), ...ui.bar());
225
+ const maxOverlayRows = Math.max(10, process.stdout.rows ? Math.floor(process.stdout.rows * 0.8) : 24);
226
+ const availableQueueRows = Math.max(1, maxOverlayRows - lines.length - trailingLines.length);
227
+ const maxScroll = Math.max(0, queueRows.length - availableQueueRows);
228
+ if (cursorQueueRow < scrollOffset) {
229
+ scrollOffset = cursorQueueRow;
230
+ }
231
+ else if (cursorQueueRow >= scrollOffset + availableQueueRows) {
232
+ scrollOffset = cursorQueueRow - availableQueueRows + 1;
233
+ }
234
+ scrollOffset = Math.min(Math.max(scrollOffset, 0), maxScroll);
235
+ lines.push(...queueRows.slice(scrollOffset, scrollOffset + availableQueueRows), ...trailingLines);
219
236
  cachedLines = lines;
220
237
  return lines;
221
238
  }
@@ -405,19 +405,32 @@ function hasProjectState(externalPath) {
405
405
  * Returns the resolved external path (may differ from the computed identity).
406
406
  */
407
407
  function resolveExternalPathWithRecovery(projectPath) {
408
- const computedPath = externalGsdRoot(projectPath);
408
+ const base = process.env.GSD_STATE_DIR || gsdHome();
409
409
  const computedId = repoIdentity(projectPath);
410
+ const computedPath = join(base, "projects", computedId);
411
+ const computedHasState = hasProjectState(computedPath);
412
+ const markerId = readGsdIdMarker(projectPath);
413
+ const markerPath = markerId ? join(base, "projects", markerId) : null;
414
+ const markerHasState = markerPath ? hasProjectState(markerPath) : false;
415
+ // Split-brain guard: when marker and computed identities disagree and both
416
+ // directories contain state, prefer the marker-backed directory. This keeps
417
+ // all writers anchored to a single canonical project identity even if a
418
+ // transient identity computation produced a stale computed hash.
419
+ if (markerId
420
+ && markerPath
421
+ && markerId !== computedId
422
+ && markerHasState
423
+ && computedHasState) {
424
+ return { path: markerPath, identity: markerId };
425
+ }
410
426
  // Check if computed path already has state — fast path, no recovery needed.
411
- if (hasProjectState(computedPath)) {
412
- return computedPath;
427
+ if (computedHasState) {
428
+ return { path: computedPath, identity: computedId };
413
429
  }
414
430
  // Check for .gsd-id marker from a previous location.
415
- const markerId = readGsdIdMarker(projectPath);
416
- if (markerId && markerId !== computedId) {
431
+ if (markerId && markerPath && markerId !== computedId) {
417
432
  // The marker points to a different identity — the repo was likely moved.
418
- const base = process.env.GSD_STATE_DIR || gsdHome();
419
- const markerPath = join(base, "projects", markerId);
420
- if (hasProjectState(markerPath)) {
433
+ if (markerHasState) {
421
434
  // Recover: use the old state directory and update the marker to the new identity.
422
435
  // Move the state from the old hash dir to the new one so future lookups work
423
436
  // without the marker.
@@ -446,11 +459,11 @@ function resolveExternalPathWithRecovery(projectPath) {
446
459
  }
447
460
  catch {
448
461
  // If migration fails, just point at the old directory.
449
- return markerPath;
462
+ return { path: markerPath, identity: markerId };
450
463
  }
451
464
  }
452
465
  }
453
- return computedPath;
466
+ return { path: computedPath, identity: computedId };
454
467
  }
455
468
  // ─── Symlink Management ─────────────────────────────────────────────────────
456
469
  /**
@@ -467,17 +480,18 @@ function resolveExternalPathWithRecovery(projectPath) {
467
480
  * Returns the resolved external path.
468
481
  */
469
482
  export function ensureGsdSymlink(projectPath) {
470
- const result = ensureGsdSymlinkCore(projectPath);
483
+ const { path: result, identity } = ensureGsdSymlinkCore(projectPath);
471
484
  // Write .gsd-id marker so future relocations can recover this state (#2750).
472
485
  // Only write for the project root (not subdirectories or worktrees that
473
486
  // delegate to a parent .gsd).
474
487
  if (!isInsideWorktree(projectPath)) {
475
- writeGsdIdMarker(projectPath, repoIdentity(projectPath));
488
+ writeGsdIdMarker(projectPath, identity);
476
489
  }
477
490
  return result;
478
491
  }
479
492
  function ensureGsdSymlinkCore(projectPath) {
480
- const externalPath = resolveExternalPathWithRecovery(projectPath);
493
+ const resolved = resolveExternalPathWithRecovery(projectPath);
494
+ const externalPath = resolved.path;
481
495
  const localGsd = join(projectPath, ".gsd");
482
496
  const inWorktree = isInsideWorktree(projectPath);
483
497
  // Guard: Never create a symlink at ~/.gsd — that's the user-level GSD home,
@@ -498,7 +512,7 @@ function ensureGsdSymlinkCore(projectPath) {
498
512
  const localGsdNormalized = normalizeForGuard(localGsd);
499
513
  const gsdHomeNorm = normalizeForGuard(gsdHome());
500
514
  if (localGsdNormalized === gsdHomeNorm) {
501
- return localGsd;
515
+ return { path: localGsd, identity: resolved.identity };
502
516
  }
503
517
  // Guard: If projectPath is a plain subdirectory (not a worktree) of a git
504
518
  // repo that already has a .gsd at the git root, do not create a duplicate
@@ -516,7 +530,10 @@ function ensureGsdSymlinkCore(projectPath) {
516
530
  try {
517
531
  const rootStat = lstatSync(rootGsd);
518
532
  if (rootStat.isSymbolicLink() || rootStat.isDirectory()) {
519
- return rootStat.isSymbolicLink() ? realpathSync(rootGsd) : rootGsd;
533
+ return {
534
+ path: rootStat.isSymbolicLink() ? realpathSync(rootGsd) : rootGsd,
535
+ identity: resolved.identity,
536
+ };
520
537
  }
521
538
  }
522
539
  catch {
@@ -544,7 +561,7 @@ function ensureGsdSymlinkCore(projectPath) {
544
561
  }
545
562
  catch { /* already gone */ }
546
563
  symlinkSync(externalPath, localGsd, "junction");
547
- return externalPath;
564
+ return resolved;
548
565
  };
549
566
  // Check for dangling symlinks (e.g. after relocation recovery removed the old
550
567
  // state dir). existsSync follows symlinks, so it returns false for dangling ones.
@@ -567,7 +584,7 @@ function ensureGsdSymlinkCore(projectPath) {
567
584
  }
568
585
  catch { /* nothing to remove */ }
569
586
  symlinkSync(externalPath, localGsd, "junction");
570
- return externalPath;
587
+ return resolved;
571
588
  }
572
589
  try {
573
590
  const stat = lstatSync(localGsd);
@@ -575,7 +592,7 @@ function ensureGsdSymlinkCore(projectPath) {
575
592
  // Already a symlink — verify it points to the right place
576
593
  const target = realpathSync(localGsd);
577
594
  if (target === externalPath) {
578
- return externalPath; // correct symlink, no-op
595
+ return resolved; // correct symlink, no-op
579
596
  }
580
597
  // In a worktree, mismatched symlinks are always stale. Heal them so
581
598
  // the worktree points at the same external state dir as the main repo.
@@ -610,24 +627,24 @@ function ensureGsdSymlinkCore(projectPath) {
610
627
  }
611
628
  catch {
612
629
  // Migration failed — preserve old symlink
613
- return target;
630
+ return { path: target, identity: resolved.identity };
614
631
  }
615
632
  }
616
633
  // Outside worktrees, preserve custom overrides or legacy symlinks.
617
- return target;
634
+ return { path: target, identity: resolved.identity };
618
635
  }
619
636
  if (stat.isDirectory()) {
620
637
  // Real directory in the main repo — migration will handle this later.
621
638
  // In worktrees, keep the directory in place and let syncGsdStateToWorktree
622
639
  // refresh its contents. Replacing a git-tracked .gsd directory with a
623
640
  // symlink makes git think tracked planning files were deleted.
624
- return localGsd;
641
+ return { path: localGsd, identity: resolved.identity };
625
642
  }
626
643
  }
627
644
  catch {
628
645
  // lstat failed — path exists but we can't stat it
629
646
  }
630
- return localGsd;
647
+ return { path: localGsd, identity: resolved.identity };
631
648
  }
632
649
  // ─── Worktree Detection ─────────────────────────────────────────────────────
633
650
  /**
@@ -0,0 +1,44 @@
1
+ // GSD-2 + Repository registry seam for parent workspace multi-repo resolution.
2
+ import { isAbsolute, relative, resolve } from "node:path";
3
+ import { resolveGsdPathContract } from "./paths.js";
4
+ function assertInsideProjectRoot(projectRoot, candidateRoot, repoId) {
5
+ const rel = relative(projectRoot, candidateRoot);
6
+ if (rel === "")
7
+ return;
8
+ if (rel.startsWith("..") || isAbsolute(rel)) {
9
+ throw new Error(`workspace.repositories.${repoId}.path resolves outside project root: ${candidateRoot}`);
10
+ }
11
+ }
12
+ function resolveRepositoryRoot(projectRoot, repoId, repo) {
13
+ const root = resolve(projectRoot, repo.path);
14
+ assertInsideProjectRoot(projectRoot, root, repoId);
15
+ return {
16
+ id: repoId,
17
+ root,
18
+ role: repo.role,
19
+ verification: repo.verification,
20
+ commitPolicy: repo.commit_policy,
21
+ };
22
+ }
23
+ export function createRepositoryRegistry(basePath, workspacePrefs) {
24
+ const contract = resolveGsdPathContract(basePath);
25
+ const projectRoot = contract.projectRoot;
26
+ const mode = workspacePrefs?.mode ?? "project";
27
+ const repoMap = new Map();
28
+ // Backward-compatible default for single-repo projects.
29
+ // Explicit workspacePrefs?.repositories entries can override "project"
30
+ // via resolveRepositoryRoot to customize role/verification/commit policy.
31
+ repoMap.set("project", { id: "project", root: projectRoot });
32
+ for (const [repoId, repoConfig] of Object.entries(workspacePrefs?.repositories ?? {})) {
33
+ repoMap.set(repoId, resolveRepositoryRoot(projectRoot, repoId, repoConfig));
34
+ }
35
+ return {
36
+ projectRoot,
37
+ mode,
38
+ repositories: Array.from(repoMap.values()),
39
+ byId: repoMap,
40
+ };
41
+ }
42
+ export function createRepositoryRegistryFromPreferences(basePath, preferences) {
43
+ return createRepositoryRegistry(basePath, preferences?.workspace);
44
+ }
@@ -17,6 +17,8 @@ import { randomBytes } from "node:crypto";
17
17
  const EXECUTION_TOOL_NAMES = new Set([
18
18
  "bash",
19
19
  "Bash",
20
+ "PowerShell",
21
+ "async_bash",
20
22
  "gsd_exec",
21
23
  "gsd_exec_search",
22
24
  "mcp__gsd-workflow__gsd_exec",
@@ -15,7 +15,7 @@
15
15
  export function crossReferenceEvidence(claimedEvidence, actualEvidence) {
16
16
  const bashCalls = actualEvidence.filter((e) => e.kind === "bash");
17
17
  const mismatches = [];
18
- for (const claimed of claimedEvidence) {
18
+ for (const claimed of latestClaimBatch(claimedEvidence)) {
19
19
  // Skip coerced entries — they're already flagged with exitCode: -1
20
20
  // and verdict: "unknown (coerced from string)" by db-tools.ts
21
21
  if (claimed.verdict?.includes("coerced from string"))
@@ -25,9 +25,11 @@ export function crossReferenceEvidence(claimedEvidence, actualEvidence) {
25
25
  // Skip entries with empty or generic commands
26
26
  if (!claimed.command || claimed.command.length < 3)
27
27
  continue;
28
- // Find matching bash call by command substring match
29
- const match = findBestMatch(claimed.command, bashCalls);
30
- if (!match) {
28
+ // Find matching bash calls by command similarity. A command may be retried
29
+ // after a failed first run; the newest matching execution is the one that
30
+ // supports or rejects a claimed pass.
31
+ const matches = findMatches(claimed.command, bashCalls);
32
+ if (matches.length === 0) {
31
33
  mismatches.push({
32
34
  severity: "warning",
33
35
  claimed,
@@ -37,6 +39,7 @@ export function crossReferenceEvidence(claimedEvidence, actualEvidence) {
37
39
  continue;
38
40
  }
39
41
  // Exit code mismatch: LLM claims success but actual command failed
42
+ const match = latestMatch(matches);
40
43
  if (claimed.exitCode === 0 && match.exitCode !== 0) {
41
44
  mismatches.push({
42
45
  severity: "error",
@@ -50,34 +53,55 @@ export function crossReferenceEvidence(claimedEvidence, actualEvidence) {
50
53
  }
51
54
  // ─── Internals ──────────────────────────────────────────────────────────────
52
55
  /**
53
- * Find the best matching bash evidence entry for a claimed command.
56
+ * Verification evidence rows are append-only across retries, but a task
57
+ * completion inserts one batch at a single created_at timestamp. When that
58
+ * timestamp is present, safety should judge the newest completion claim only.
59
+ */
60
+ function latestClaimBatch(claimedEvidence) {
61
+ const dated = claimedEvidence
62
+ .map((claim) => ({
63
+ claim,
64
+ time: typeof claim.createdAt === "string" ? Date.parse(claim.createdAt) : Number.NaN,
65
+ }))
66
+ .filter((entry) => Number.isFinite(entry.time));
67
+ if (dated.length === 0)
68
+ return claimedEvidence;
69
+ const latestTime = Math.max(...dated.map((entry) => entry.time));
70
+ return claimedEvidence.filter((claim) => (typeof claim.createdAt === "string" && Date.parse(claim.createdAt) === latestTime));
71
+ }
72
+ /**
73
+ * Find bash evidence entries matching a claimed command.
54
74
  * Uses substring matching — the claimed command may be a shortened version
55
75
  * of the actual command, or vice versa.
56
76
  */
57
- function findBestMatch(claimedCommand, bashCalls) {
77
+ function findMatches(claimedCommand, bashCalls) {
58
78
  const normalized = claimedCommand.trim();
59
- // Exact match first
60
- const exact = bashCalls.find(b => b.command.trim() === normalized);
61
- if (exact)
79
+ // Exact matches first
80
+ const exact = bashCalls.filter(b => b.command.trim() === normalized);
81
+ if (exact.length > 0)
62
82
  return exact;
63
83
  // Substring match: claimed is contained in actual or actual in claimed
64
- const substring = bashCalls.find(b => b.command.includes(normalized) || normalized.includes(b.command));
65
- if (substring)
84
+ const substring = bashCalls.filter(b => b.command.includes(normalized) || normalized.includes(b.command));
85
+ if (substring.length > 0)
66
86
  return substring;
67
87
  // Token match: split on whitespace and check significant overlap
68
88
  const claimedTokens = normalized.split(/\s+/).filter(t => t.length > 2);
69
89
  if (claimedTokens.length === 0)
70
- return null;
71
- let bestMatch = null;
72
- let bestScore = 0;
90
+ return [];
91
+ const scoredMatches = [];
73
92
  for (const call of bashCalls) {
74
93
  const callTokens = new Set(call.command.split(/\s+/));
75
94
  const matchCount = claimedTokens.filter(t => callTokens.has(t)).length;
76
95
  const score = matchCount / claimedTokens.length;
77
- if (score > bestScore && score >= 0.5) {
78
- bestScore = score;
79
- bestMatch = call;
96
+ if (score >= 0.5) {
97
+ scoredMatches.push({ call, score });
80
98
  }
81
99
  }
82
- return bestMatch;
100
+ const bestScore = Math.max(0, ...scoredMatches.map((match) => match.score));
101
+ return scoredMatches
102
+ .filter((match) => match.score === bestScore)
103
+ .map((match) => match.call);
104
+ }
105
+ function latestMatch(matches) {
106
+ return matches.reduce((latest, match) => (match.timestamp > latest.timestamp ? match : latest));
83
107
  }
@@ -18,8 +18,9 @@
18
18
  import { createRequire } from "node:module";
19
19
  import { existsSync, readFileSync, readdirSync, mkdirSync, unlinkSync, rmSync, statSync } from "node:fs";
20
20
  import { join, dirname } from "node:path";
21
- import { gsdRoot } from "./paths.js";
21
+ import { gsdRoot, normalizeRealPath } from "./paths.js";
22
22
  import { atomicWriteSync } from "./atomic-write.js";
23
+ import { markWorkerStoppingByPid } from "./db/auto-workers.js";
23
24
  const _require = createRequire(import.meta.url);
24
25
  // ─── Module State ───────────────────────────────────────────────────────────
25
26
  /** Release function from proper-lockfile — calling it releases the OS lock. */
@@ -225,6 +226,12 @@ export function acquireSessionLock(basePath) {
225
226
  mkdirSync(dirname(lp), { recursive: true });
226
227
  // Clean up numbered lock file variants from cloud sync conflicts (#1315)
227
228
  cleanupStrayLockFiles(basePath);
229
+ // If lock metadata points to a dead PID, mark that worker row stopping so
230
+ // crash diagnostics do not keep surfacing it as active.
231
+ const existingPreflight = readExistingLockData(lp);
232
+ if (existingPreflight?.pid && !isPidAlive(existingPreflight.pid)) {
233
+ markWorkerStoppingByPid(normalizeRealPath(basePath), existingPreflight.pid);
234
+ }
228
235
  // Write our lock data first (the content is informational; the OS lock is the real guard)
229
236
  const lockData = {
230
237
  pid: process.pid,
@@ -250,7 +257,10 @@ export function acquireSessionLock(basePath) {
250
257
  const lockDir = lockTarget + ".lock";
251
258
  if (existsSync(lockDir)) {
252
259
  const existingData = readExistingLockData(lp);
253
- const isOrphan = !existingData || (existingData.pid && !isPidAlive(existingData.pid));
260
+ const deadPid = existingData?.pid && !isPidAlive(existingData.pid) ? existingData.pid : null;
261
+ if (deadPid)
262
+ markWorkerStoppingByPid(normalizeRealPath(basePath), deadPid);
263
+ const isOrphan = !existingData || !!deadPid;
254
264
  if (isOrphan) {
255
265
  try {
256
266
  rmSync(lockDir, { recursive: true, force: true });
@@ -288,6 +298,9 @@ export function acquireSessionLock(basePath) {
288
298
  // Check: if auto.lock is gone and no process is alive, the lock dir is stale.
289
299
  const existingData = readExistingLockData(lp);
290
300
  const existingPid = existingData?.pid;
301
+ if (existingPid && !isPidAlive(existingPid)) {
302
+ markWorkerStoppingByPid(normalizeRealPath(basePath), existingPid);
303
+ }
291
304
  // If no lock file or no alive process, try to clean up and re-acquire (#1245)
292
305
  if (!existingData || (existingPid && !isPidAlive(existingPid))) {
293
306
  try {