gsd-pi 2.71.0 → 2.72.0-dev.3118184

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 (578) hide show
  1. package/README.md +69 -19
  2. package/dist/cli.js +88 -6
  3. package/dist/headless-events.d.ts +2 -0
  4. package/dist/headless-events.js +7 -0
  5. package/dist/headless.js +16 -3
  6. package/dist/mcp-server.js +40 -17
  7. package/dist/onboarding.js +10 -0
  8. package/dist/provider-migrations.d.ts +10 -0
  9. package/dist/provider-migrations.js +12 -0
  10. package/dist/resource-loader.js +139 -13
  11. package/dist/resources/GSD-WORKFLOW.md +1 -1
  12. package/dist/resources/agents/debugger.md +58 -0
  13. package/dist/resources/agents/doc-writer.md +43 -0
  14. package/dist/resources/agents/git-ops.md +56 -0
  15. package/dist/resources/agents/javascript-pro.md +46 -271
  16. package/dist/resources/agents/planner.md +55 -0
  17. package/dist/resources/agents/refactorer.md +47 -0
  18. package/dist/resources/agents/reviewer.md +48 -0
  19. package/dist/resources/agents/security.md +59 -0
  20. package/dist/resources/agents/tester.md +50 -0
  21. package/dist/resources/agents/typescript-pro.md +41 -235
  22. package/dist/resources/extensions/async-jobs/await-tool.js +7 -4
  23. package/dist/resources/extensions/async-jobs/job-manager.js +28 -3
  24. package/dist/resources/extensions/claude-code-cli/partial-builder.js +40 -12
  25. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +142 -14
  26. package/dist/resources/extensions/gsd/auto/infra-errors.js +34 -0
  27. package/dist/resources/extensions/gsd/auto/loop.js +116 -2
  28. package/dist/resources/extensions/gsd/auto/phases.js +5 -1
  29. package/dist/resources/extensions/gsd/auto/session.js +11 -0
  30. package/dist/resources/extensions/gsd/auto-dashboard.js +22 -16
  31. package/dist/resources/extensions/gsd/auto-model-selection.js +10 -2
  32. package/dist/resources/extensions/gsd/auto-post-unit.js +6 -0
  33. package/dist/resources/extensions/gsd/auto-prompts.js +88 -33
  34. package/dist/resources/extensions/gsd/auto-recovery.js +11 -0
  35. package/dist/resources/extensions/gsd/auto-start.js +34 -7
  36. package/dist/resources/extensions/gsd/auto-tool-tracking.js +1 -1
  37. package/dist/resources/extensions/gsd/auto-worktree.js +1 -1
  38. package/dist/resources/extensions/gsd/auto.js +81 -19
  39. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +3 -3
  40. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +11 -11
  41. package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +63 -51
  42. package/dist/resources/extensions/gsd/bootstrap/system-context.js +6 -0
  43. package/dist/resources/extensions/gsd/commands/context.js +15 -6
  44. package/dist/resources/extensions/gsd/commands/dispatcher.js +12 -2
  45. package/dist/resources/extensions/gsd/commands/handlers/auto.js +10 -33
  46. package/dist/resources/extensions/gsd/commands/handlers/core.js +56 -11
  47. package/dist/resources/extensions/gsd/commands/handlers/notifications-handler.js +15 -6
  48. package/dist/resources/extensions/gsd/commands/handlers/workflow.js +4 -10
  49. package/dist/resources/extensions/gsd/commands-handlers.js +4 -1
  50. package/dist/resources/extensions/gsd/context-injector.js +1 -1
  51. package/dist/resources/extensions/gsd/custom-workflow-engine.js +3 -7
  52. package/dist/resources/extensions/gsd/dashboard-overlay.js +8 -3
  53. package/dist/resources/extensions/gsd/definition-io.js +15 -0
  54. package/dist/resources/extensions/gsd/dispatch-guard.js +22 -1
  55. package/dist/resources/extensions/gsd/doctor-providers.js +23 -0
  56. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +6 -3
  57. package/dist/resources/extensions/gsd/error-classifier.js +5 -2
  58. package/dist/resources/extensions/gsd/forensics.js +19 -6
  59. package/dist/resources/extensions/gsd/gate-registry.js +208 -0
  60. package/dist/resources/extensions/gsd/git-service.js +11 -8
  61. package/dist/resources/extensions/gsd/gitignore.js +12 -6
  62. package/dist/resources/extensions/gsd/gsd-db.js +90 -6
  63. package/dist/resources/extensions/gsd/guided-flow.js +5 -10
  64. package/dist/resources/extensions/gsd/key-manager.js +2 -0
  65. package/dist/resources/extensions/gsd/metrics.js +1 -0
  66. package/dist/resources/extensions/gsd/milestone-actions.js +10 -4
  67. package/dist/resources/extensions/gsd/milestone-validation-gates.js +11 -12
  68. package/dist/resources/extensions/gsd/notification-overlay.js +42 -13
  69. package/dist/resources/extensions/gsd/notification-store.js +56 -5
  70. package/dist/resources/extensions/gsd/notification-widget.js +5 -13
  71. package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +8 -3
  72. package/dist/resources/extensions/gsd/pre-execution-checks.js +35 -2
  73. package/dist/resources/extensions/gsd/preferences-skills.js +2 -34
  74. package/dist/resources/extensions/gsd/preferences-types.js +15 -0
  75. package/dist/resources/extensions/gsd/preferences.js +16 -3
  76. package/dist/resources/extensions/gsd/prompt-loader.js +4 -1
  77. package/dist/resources/extensions/gsd/prompt-validation.js +126 -0
  78. package/dist/resources/extensions/gsd/prompts/complete-slice.md +5 -3
  79. package/dist/resources/extensions/gsd/prompts/discuss.md +123 -12
  80. package/dist/resources/extensions/gsd/prompts/execute-task.md +22 -19
  81. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +2 -0
  82. package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +2 -0
  83. package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
  84. package/dist/resources/extensions/gsd/prompts/queue.md +3 -2
  85. package/dist/resources/extensions/gsd/prompts/system.md +1 -0
  86. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +4 -1
  87. package/dist/resources/extensions/gsd/session-model-override.js +25 -0
  88. package/dist/resources/extensions/gsd/shortcut-defs.js +40 -0
  89. package/dist/resources/extensions/gsd/state.js +29 -2
  90. package/dist/resources/extensions/gsd/tools/complete-slice.js +52 -1
  91. package/dist/resources/extensions/gsd/tools/complete-task.js +51 -1
  92. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +4 -1
  93. package/dist/resources/extensions/gsd/workflow-projections.js +7 -0
  94. package/dist/resources/extensions/gsd/worktree-manager.js +30 -3
  95. package/dist/resources/extensions/gsd/write-intercept.js +10 -1
  96. package/dist/resources/extensions/ollama/index.js +17 -10
  97. package/dist/resources/extensions/ollama/ollama-client.js +35 -6
  98. package/dist/resources/extensions/ollama/ollama-discovery.js +32 -6
  99. package/dist/resources/extensions/shared/gsd-phase-state.js +35 -0
  100. package/dist/resources/extensions/subagent/agents.js +8 -0
  101. package/dist/resources/extensions/subagent/index.js +17 -0
  102. package/dist/resources/skills/create-skill/SKILL.md +2 -0
  103. package/dist/startup-model-validation.d.ts +0 -1
  104. package/dist/startup-model-validation.js +6 -2
  105. package/dist/web/standalone/.next/BUILD_ID +1 -1
  106. package/dist/web/standalone/.next/app-path-routes-manifest.json +15 -15
  107. package/dist/web/standalone/.next/build-manifest.json +3 -3
  108. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  109. package/dist/web/standalone/.next/required-server-files.json +3 -3
  110. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  111. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  112. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  113. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  114. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  115. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  116. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  117. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  118. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  119. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  120. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  121. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  122. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  123. package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
  124. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  125. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  126. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  127. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  128. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  129. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  130. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  131. package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
  132. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  133. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
  134. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  135. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
  136. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  137. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
  138. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  139. package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
  140. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  141. package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
  142. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  143. package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
  144. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  145. package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
  146. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  147. package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
  148. package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
  149. package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
  150. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  151. package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
  152. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  153. package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  154. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  155. package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
  156. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  157. package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  158. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  159. package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
  160. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  161. package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
  162. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  163. package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
  164. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  165. package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
  166. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  167. package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
  168. package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
  169. package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
  170. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  171. package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  172. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  173. package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
  174. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  175. package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  176. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  177. package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
  178. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
  179. package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
  180. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  181. package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
  182. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  183. package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
  184. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  185. package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
  186. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  187. package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
  188. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  189. package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
  190. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  191. package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  192. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  193. package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
  194. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  195. package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
  196. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  197. package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
  198. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
  199. package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
  200. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  201. package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
  202. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  203. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
  204. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +3 -3
  205. package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
  206. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  207. package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
  208. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  209. package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
  210. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  211. package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  212. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  213. package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
  214. package/dist/web/standalone/.next/server/app/index.html +1 -1
  215. package/dist/web/standalone/.next/server/app/index.rsc +4 -4
  216. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  217. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
  218. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  219. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
  220. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  221. package/dist/web/standalone/.next/server/app/page.js +2 -2
  222. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  223. package/dist/web/standalone/.next/server/app-paths-manifest.json +15 -15
  224. package/dist/web/standalone/.next/server/chunks/2331.js +16 -16
  225. package/dist/web/standalone/.next/server/chunks/4741.js +12 -12
  226. package/dist/web/standalone/.next/server/chunks/5822.js +2 -2
  227. package/dist/web/standalone/.next/server/chunks/63.js +8 -8
  228. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  229. package/dist/web/standalone/.next/server/edge-runtime-webpack.js +2 -0
  230. package/dist/web/standalone/.next/server/functions-config-manifest.json +0 -9
  231. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  232. package/dist/web/standalone/.next/server/middleware-manifest.json +29 -2
  233. package/dist/web/standalone/.next/server/middleware.js +4 -12
  234. package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
  235. package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
  236. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  237. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  238. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  239. package/dist/web/standalone/.next/server/webpack-runtime.js +1 -1
  240. package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
  241. package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
  242. package/dist/web/standalone/.next/static/chunks/app/page-f1e30ab6bb269149.js +1 -0
  243. package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
  244. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
  245. package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
  246. package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
  247. package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
  248. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
  249. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
  250. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
  251. package/dist/web/standalone/server.js +1 -1
  252. package/package.json +1 -1
  253. package/packages/mcp-server/dist/server.d.ts +12 -1
  254. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  255. package/packages/mcp-server/dist/server.js +90 -42
  256. package/packages/mcp-server/dist/server.js.map +1 -1
  257. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  258. package/packages/mcp-server/dist/workflow-tools.js +22 -12
  259. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  260. package/packages/mcp-server/src/server.ts +110 -38
  261. package/packages/mcp-server/src/workflow-tools.test.ts +110 -0
  262. package/packages/mcp-server/src/workflow-tools.ts +32 -12
  263. package/packages/pi-ai/dist/env-api-keys.js +1 -0
  264. package/packages/pi-ai/dist/env-api-keys.js.map +1 -1
  265. package/packages/pi-ai/dist/models.custom.d.ts +105 -0
  266. package/packages/pi-ai/dist/models.custom.d.ts.map +1 -1
  267. package/packages/pi-ai/dist/models.custom.js +97 -0
  268. package/packages/pi-ai/dist/models.custom.js.map +1 -1
  269. package/packages/pi-ai/dist/models.generated.d.ts +648 -140
  270. package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
  271. package/packages/pi-ai/dist/models.generated.js +867 -370
  272. package/packages/pi-ai/dist/models.generated.js.map +1 -1
  273. package/packages/pi-ai/dist/models.generated.test.d.ts +2 -0
  274. package/packages/pi-ai/dist/models.generated.test.d.ts.map +1 -0
  275. package/packages/pi-ai/dist/models.generated.test.js +334 -0
  276. package/packages/pi-ai/dist/models.generated.test.js.map +1 -0
  277. package/packages/pi-ai/dist/models.test.js +105 -0
  278. package/packages/pi-ai/dist/models.test.js.map +1 -1
  279. package/packages/pi-ai/dist/providers/amazon-bedrock.js +11 -2
  280. package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  281. package/packages/pi-ai/dist/providers/anthropic-auth.test.d.ts +2 -0
  282. package/packages/pi-ai/dist/providers/anthropic-auth.test.d.ts.map +1 -0
  283. package/packages/pi-ai/dist/providers/anthropic-auth.test.js +20 -0
  284. package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -0
  285. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +4 -1
  286. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
  287. package/packages/pi-ai/dist/providers/anthropic-shared.js +8 -3
  288. package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
  289. package/packages/pi-ai/dist/providers/anthropic-shared.test.js +44 -1
  290. package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -1
  291. package/packages/pi-ai/dist/providers/anthropic.d.ts +2 -1
  292. package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  293. package/packages/pi-ai/dist/providers/anthropic.js +7 -4
  294. package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
  295. package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
  296. package/packages/pi-ai/dist/providers/openai-completions.js +11 -0
  297. package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
  298. package/packages/pi-ai/dist/types.d.ts +1 -1
  299. package/packages/pi-ai/dist/types.d.ts.map +1 -1
  300. package/packages/pi-ai/dist/types.js.map +1 -1
  301. package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  302. package/packages/pi-ai/dist/utils/oauth/github-copilot.js +5 -1
  303. package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  304. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.d.ts +2 -0
  305. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.d.ts.map +1 -0
  306. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +57 -0
  307. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -0
  308. package/packages/pi-ai/src/env-api-keys.ts +1 -0
  309. package/packages/pi-ai/src/models.custom.ts +98 -0
  310. package/packages/pi-ai/src/models.generated.test.ts +373 -0
  311. package/packages/pi-ai/src/models.generated.ts +867 -370
  312. package/packages/pi-ai/src/models.test.ts +135 -0
  313. package/packages/pi-ai/src/providers/amazon-bedrock.ts +13 -1
  314. package/packages/pi-ai/src/providers/anthropic-auth.test.ts +32 -0
  315. package/packages/pi-ai/src/providers/anthropic-shared.test.ts +55 -1
  316. package/packages/pi-ai/src/providers/anthropic-shared.ts +14 -3
  317. package/packages/pi-ai/src/providers/anthropic.ts +8 -4
  318. package/packages/pi-ai/src/providers/openai-completions.ts +14 -0
  319. package/packages/pi-ai/src/types.ts +1 -0
  320. package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +71 -0
  321. package/packages/pi-ai/src/utils/oauth/github-copilot.ts +4 -1
  322. package/packages/pi-coding-agent/dist/core/agent-session-renderable-tools.test.d.ts +2 -0
  323. package/packages/pi-coding-agent/dist/core/agent-session-renderable-tools.test.d.ts.map +1 -0
  324. package/packages/pi-coding-agent/dist/core/agent-session-renderable-tools.test.js +61 -0
  325. package/packages/pi-coding-agent/dist/core/agent-session-renderable-tools.test.js.map +1 -0
  326. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  327. package/packages/pi-coding-agent/dist/core/agent-session.js +2 -1
  328. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  329. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +10 -0
  330. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  331. package/packages/pi-coding-agent/dist/core/auth-storage.js +27 -0
  332. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  333. package/packages/pi-coding-agent/dist/core/auth-storage.test.js +85 -0
  334. package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
  335. package/packages/pi-coding-agent/dist/core/model-resolver-initial-model-auth.test.d.ts +2 -0
  336. package/packages/pi-coding-agent/dist/core/model-resolver-initial-model-auth.test.d.ts.map +1 -0
  337. package/packages/pi-coding-agent/dist/core/model-resolver-initial-model-auth.test.js +64 -0
  338. package/packages/pi-coding-agent/dist/core/model-resolver-initial-model-auth.test.js.map +1 -0
  339. package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  340. package/packages/pi-coding-agent/dist/core/model-resolver.js +23 -18
  341. package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  342. package/packages/pi-coding-agent/dist/core/model-resolver.test.d.ts +8 -0
  343. package/packages/pi-coding-agent/dist/core/model-resolver.test.d.ts.map +1 -0
  344. package/packages/pi-coding-agent/dist/core/model-resolver.test.js +75 -0
  345. package/packages/pi-coding-agent/dist/core/model-resolver.test.js.map +1 -0
  346. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +5 -0
  347. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
  348. package/packages/pi-coding-agent/dist/core/retry-handler.js +55 -1
  349. package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
  350. package/packages/pi-coding-agent/dist/core/retry-handler.test.js +57 -0
  351. package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
  352. package/packages/pi-coding-agent/dist/core/sdk.d.ts +11 -0
  353. package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  354. package/packages/pi-coding-agent/dist/core/sdk.js +47 -5
  355. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  356. package/packages/pi-coding-agent/dist/core/sdk.test.d.ts +2 -0
  357. package/packages/pi-coding-agent/dist/core/sdk.test.d.ts.map +1 -0
  358. package/packages/pi-coding-agent/dist/core/sdk.test.js +71 -0
  359. package/packages/pi-coding-agent/dist/core/sdk.test.js.map +1 -0
  360. package/packages/pi-coding-agent/dist/index.d.ts +1 -1
  361. package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
  362. package/packages/pi-coding-agent/dist/index.js +1 -1
  363. package/packages/pi-coding-agent/dist/index.js.map +1 -1
  364. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/login-dialog.test.d.ts +2 -0
  365. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/login-dialog.test.d.ts.map +1 -0
  366. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/login-dialog.test.js +13 -0
  367. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/login-dialog.test.js.map +1 -0
  368. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +36 -0
  369. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
  370. package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts +4 -0
  371. package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  372. package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +24 -2
  373. package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -1
  374. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  375. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +9 -2
  376. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
  377. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +4 -0
  378. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  379. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +130 -12
  380. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  381. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  382. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +7 -2
  383. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  384. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.d.ts.map +1 -1
  385. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js +6 -1
  386. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js.map +1 -1
  387. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  388. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +4 -3
  389. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  390. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +4 -2
  391. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -1
  392. package/packages/pi-coding-agent/package.json +1 -1
  393. package/packages/pi-coding-agent/src/core/agent-session-renderable-tools.test.ts +70 -0
  394. package/packages/pi-coding-agent/src/core/agent-session.ts +2 -1
  395. package/packages/pi-coding-agent/src/core/auth-storage.test.ts +108 -0
  396. package/packages/pi-coding-agent/src/core/auth-storage.ts +30 -0
  397. package/packages/pi-coding-agent/src/core/model-resolver-initial-model-auth.test.ts +78 -0
  398. package/packages/pi-coding-agent/src/core/model-resolver.test.ts +85 -0
  399. package/packages/pi-coding-agent/src/core/model-resolver.ts +23 -18
  400. package/packages/pi-coding-agent/src/core/retry-handler.test.ts +83 -0
  401. package/packages/pi-coding-agent/src/core/retry-handler.ts +60 -1
  402. package/packages/pi-coding-agent/src/core/sdk.test.ts +89 -0
  403. package/packages/pi-coding-agent/src/core/sdk.ts +55 -9
  404. package/packages/pi-coding-agent/src/index.ts +1 -0
  405. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/login-dialog.test.ts +24 -0
  406. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +72 -0
  407. package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +30 -2
  408. package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +15 -6
  409. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +131 -12
  410. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +7 -2
  411. package/packages/pi-coding-agent/src/modes/interactive/controllers/model-controller.ts +6 -1
  412. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +4 -3
  413. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +4 -2
  414. package/packages/pi-tui/dist/components/__tests__/editor.test.js +12 -0
  415. package/packages/pi-tui/dist/components/__tests__/editor.test.js.map +1 -1
  416. package/packages/pi-tui/dist/components/__tests__/input.test.js +12 -0
  417. package/packages/pi-tui/dist/components/__tests__/input.test.js.map +1 -1
  418. package/packages/pi-tui/dist/keys.d.ts.map +1 -1
  419. package/packages/pi-tui/dist/keys.js +27 -0
  420. package/packages/pi-tui/dist/keys.js.map +1 -1
  421. package/packages/pi-tui/src/components/__tests__/editor.test.ts +18 -0
  422. package/packages/pi-tui/src/components/__tests__/input.test.ts +18 -0
  423. package/packages/pi-tui/src/keys.ts +32 -0
  424. package/pkg/package.json +1 -1
  425. package/src/resources/GSD-WORKFLOW.md +1 -1
  426. package/src/resources/agents/debugger.md +58 -0
  427. package/src/resources/agents/doc-writer.md +43 -0
  428. package/src/resources/agents/git-ops.md +56 -0
  429. package/src/resources/agents/javascript-pro.md +46 -271
  430. package/src/resources/agents/planner.md +55 -0
  431. package/src/resources/agents/refactorer.md +47 -0
  432. package/src/resources/agents/reviewer.md +48 -0
  433. package/src/resources/agents/security.md +59 -0
  434. package/src/resources/agents/tester.md +50 -0
  435. package/src/resources/agents/typescript-pro.md +41 -235
  436. package/src/resources/extensions/async-jobs/await-tool.test.ts +40 -7
  437. package/src/resources/extensions/async-jobs/await-tool.ts +7 -4
  438. package/src/resources/extensions/async-jobs/job-manager.ts +33 -3
  439. package/src/resources/extensions/claude-code-cli/partial-builder.ts +45 -12
  440. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +152 -13
  441. package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +91 -2
  442. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +301 -6
  443. package/src/resources/extensions/gsd/auto/infra-errors.ts +38 -0
  444. package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -0
  445. package/src/resources/extensions/gsd/auto/loop.ts +134 -2
  446. package/src/resources/extensions/gsd/auto/phases.ts +6 -0
  447. package/src/resources/extensions/gsd/auto/session.ts +11 -0
  448. package/src/resources/extensions/gsd/auto-dashboard.ts +29 -18
  449. package/src/resources/extensions/gsd/auto-model-selection.ts +9 -1
  450. package/src/resources/extensions/gsd/auto-post-unit.ts +7 -0
  451. package/src/resources/extensions/gsd/auto-prompts.ts +111 -33
  452. package/src/resources/extensions/gsd/auto-recovery.ts +10 -0
  453. package/src/resources/extensions/gsd/auto-start.ts +41 -7
  454. package/src/resources/extensions/gsd/auto-tool-tracking.ts +1 -1
  455. package/src/resources/extensions/gsd/auto-worktree.ts +1 -1
  456. package/src/resources/extensions/gsd/auto.ts +97 -20
  457. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +3 -3
  458. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +10 -10
  459. package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +79 -60
  460. package/src/resources/extensions/gsd/bootstrap/system-context.ts +7 -0
  461. package/src/resources/extensions/gsd/commands/context.ts +16 -5
  462. package/src/resources/extensions/gsd/commands/dispatcher.ts +14 -2
  463. package/src/resources/extensions/gsd/commands/handlers/auto.ts +10 -36
  464. package/src/resources/extensions/gsd/commands/handlers/core.ts +58 -11
  465. package/src/resources/extensions/gsd/commands/handlers/notifications-handler.ts +17 -7
  466. package/src/resources/extensions/gsd/commands/handlers/workflow.ts +4 -10
  467. package/src/resources/extensions/gsd/commands-handlers.ts +5 -1
  468. package/src/resources/extensions/gsd/context-injector.ts +1 -1
  469. package/src/resources/extensions/gsd/custom-workflow-engine.ts +4 -8
  470. package/src/resources/extensions/gsd/dashboard-overlay.ts +10 -3
  471. package/src/resources/extensions/gsd/definition-io.ts +18 -0
  472. package/src/resources/extensions/gsd/dispatch-guard.ts +23 -1
  473. package/src/resources/extensions/gsd/doctor-providers.ts +24 -0
  474. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +6 -3
  475. package/src/resources/extensions/gsd/error-classifier.ts +5 -2
  476. package/src/resources/extensions/gsd/forensics.ts +23 -7
  477. package/src/resources/extensions/gsd/gate-registry.ts +251 -0
  478. package/src/resources/extensions/gsd/git-service.ts +11 -8
  479. package/src/resources/extensions/gsd/gitignore.ts +12 -6
  480. package/src/resources/extensions/gsd/gsd-db.ts +105 -6
  481. package/src/resources/extensions/gsd/guided-flow.ts +5 -10
  482. package/src/resources/extensions/gsd/interrupted-session.ts +1 -0
  483. package/src/resources/extensions/gsd/key-manager.ts +2 -0
  484. package/src/resources/extensions/gsd/metrics.ts +12 -1
  485. package/src/resources/extensions/gsd/milestone-actions.ts +10 -3
  486. package/src/resources/extensions/gsd/milestone-validation-gates.ts +11 -13
  487. package/src/resources/extensions/gsd/notification-overlay.ts +47 -14
  488. package/src/resources/extensions/gsd/notification-store.ts +54 -5
  489. package/src/resources/extensions/gsd/notification-widget.ts +5 -14
  490. package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +10 -3
  491. package/src/resources/extensions/gsd/pre-execution-checks.ts +39 -2
  492. package/src/resources/extensions/gsd/preferences-skills.ts +2 -36
  493. package/src/resources/extensions/gsd/preferences-types.ts +16 -0
  494. package/src/resources/extensions/gsd/preferences.ts +19 -6
  495. package/src/resources/extensions/gsd/prompt-loader.ts +6 -1
  496. package/src/resources/extensions/gsd/prompt-validation.ts +157 -0
  497. package/src/resources/extensions/gsd/prompts/complete-slice.md +5 -3
  498. package/src/resources/extensions/gsd/prompts/discuss.md +123 -12
  499. package/src/resources/extensions/gsd/prompts/execute-task.md +22 -19
  500. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +2 -0
  501. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +2 -0
  502. package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
  503. package/src/resources/extensions/gsd/prompts/queue.md +3 -2
  504. package/src/resources/extensions/gsd/prompts/system.md +1 -0
  505. package/src/resources/extensions/gsd/prompts/validate-milestone.md +4 -1
  506. package/src/resources/extensions/gsd/session-model-override.ts +36 -0
  507. package/src/resources/extensions/gsd/shortcut-defs.ts +56 -0
  508. package/src/resources/extensions/gsd/state.ts +33 -2
  509. package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +27 -0
  510. package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +25 -9
  511. package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +28 -0
  512. package/src/resources/extensions/gsd/tests/block-db-writes.test.ts +63 -0
  513. package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +39 -0
  514. package/src/resources/extensions/gsd/tests/complete-slice-gate-closure.test.ts +167 -0
  515. package/src/resources/extensions/gsd/tests/complete-slice-prompt-task-summary-layout.test.ts +18 -0
  516. package/src/resources/extensions/gsd/tests/definition-io.test.ts +57 -0
  517. package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +53 -0
  518. package/src/resources/extensions/gsd/tests/doctor-heal-fixable-warnings.test.ts +14 -0
  519. package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +36 -0
  520. package/src/resources/extensions/gsd/tests/execute-task-prompt-existing-artifact-guard.test.ts +33 -0
  521. package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +104 -0
  522. package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +62 -0
  523. package/src/resources/extensions/gsd/tests/format-shortcut.test.ts +31 -0
  524. package/src/resources/extensions/gsd/tests/gate-dispatch.test.ts +27 -0
  525. package/src/resources/extensions/gsd/tests/gate-registry.test.ts +140 -0
  526. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +107 -5
  527. package/src/resources/extensions/gsd/tests/gsd-no-project-error.test.ts +73 -0
  528. package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +180 -0
  529. package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +66 -1
  530. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +8 -6
  531. package/src/resources/extensions/gsd/tests/key-manager.test.ts +63 -0
  532. package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +54 -0
  533. package/src/resources/extensions/gsd/tests/model-isolation.test.ts +36 -51
  534. package/src/resources/extensions/gsd/tests/notification-store.test.ts +35 -0
  535. package/src/resources/extensions/gsd/tests/notification-widget.test.ts +26 -0
  536. package/src/resources/extensions/gsd/tests/notifications-handler.test.ts +90 -0
  537. package/src/resources/extensions/gsd/tests/parallel-monitor-overlay.test.ts +1 -0
  538. package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +18 -0
  539. package/src/resources/extensions/gsd/tests/plan-milestone-artifact-verification.test.ts +62 -0
  540. package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +34 -0
  541. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +49 -0
  542. package/src/resources/extensions/gsd/tests/preferences-formatting.test.ts +87 -0
  543. package/src/resources/extensions/gsd/tests/preferences.test.ts +53 -0
  544. package/src/resources/extensions/gsd/tests/projection-regression.test.ts +96 -1
  545. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +19 -0
  546. package/src/resources/extensions/gsd/tests/prompt-loader-working-directory.test.ts +19 -0
  547. package/src/resources/extensions/gsd/tests/prompt-system-gate-coverage.test.ts +208 -0
  548. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +16 -0
  549. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +97 -0
  550. package/src/resources/extensions/gsd/tests/register-shortcuts.test.ts +63 -5
  551. package/src/resources/extensions/gsd/tests/session-model-override.test.ts +35 -0
  552. package/src/resources/extensions/gsd/tests/stale-slice-rows.test.ts +41 -0
  553. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +90 -0
  554. package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +7 -0
  555. package/src/resources/extensions/gsd/tests/validate-milestone-prompt-verification-classes.test.ts +18 -0
  556. package/src/resources/extensions/gsd/tools/complete-slice.ts +63 -0
  557. package/src/resources/extensions/gsd/tools/complete-task.ts +63 -0
  558. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +4 -1
  559. package/src/resources/extensions/gsd/types.ts +26 -0
  560. package/src/resources/extensions/gsd/workflow-projections.ts +8 -0
  561. package/src/resources/extensions/gsd/worktree-manager.ts +29 -3
  562. package/src/resources/extensions/gsd/write-intercept.ts +10 -1
  563. package/src/resources/extensions/ollama/index.ts +17 -8
  564. package/src/resources/extensions/ollama/ollama-client.ts +35 -6
  565. package/src/resources/extensions/ollama/ollama-discovery.ts +37 -6
  566. package/src/resources/extensions/ollama/ollama-status-indicator.test.ts +28 -0
  567. package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +54 -0
  568. package/src/resources/extensions/shared/gsd-phase-state.ts +42 -0
  569. package/src/resources/extensions/shared/tests/gsd-phase-state.test.ts +48 -0
  570. package/src/resources/extensions/subagent/agents.ts +10 -0
  571. package/src/resources/extensions/subagent/index.ts +18 -0
  572. package/src/resources/extensions/subagent/tests/agents-conflicts.test.ts +33 -0
  573. package/src/resources/skills/create-skill/SKILL.md +2 -0
  574. package/dist/web/standalone/.next/static/chunks/app/page-7115e62689b5fd84.js +0 -1
  575. package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
  576. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
  577. /package/dist/web/standalone/.next/static/{nPky_WQC28aBD77eZsRAB → NzO79SOz9jHX-VY5-0t2O}/_buildManifest.js +0 -0
  578. /package/dist/web/standalone/.next/static/{nPky_WQC28aBD77eZsRAB → NzO79SOz9jHX-VY5-0t2O}/_ssgManifest.js +0 -0
@@ -0,0 +1,157 @@
1
+ /**
2
+ * GSD Prompt Validation — Validates enhanced context and turn output
3
+ * artifacts before writing.
4
+ *
5
+ * Implements R109 validation requirement: CONTEXT.md must have required
6
+ * sections before being written to disk. Additionally, per-turn validators
7
+ * check that artifacts produced by gate-owning turns contain the gate
8
+ * sections declared in gate-registry.ts, so a malformed summary/validation
9
+ * markdown file cannot silently drop a quality gate.
10
+ */
11
+
12
+ import { getGatesForTurn, type OwnerTurn } from "./gate-registry.js";
13
+
14
+ /**
15
+ * Result of validating enhanced context output.
16
+ */
17
+ export interface ValidationResult {
18
+ /** Whether all required sections are present. */
19
+ valid: boolean;
20
+ /** List of missing required sections. */
21
+ missing: string[];
22
+ }
23
+
24
+ /**
25
+ * Validate that enhanced context content has all required sections.
26
+ *
27
+ * Required sections per R109:
28
+ * - Scope section (## Scope, ## Milestone Scope, or ## Why This Milestone)
29
+ * - Architectural Decisions section (## Architectural Decisions)
30
+ * - Acceptance Criteria section (## Acceptance Criteria or ## Final Integrated Acceptance)
31
+ *
32
+ * Additionally validates that the Architectural Decisions section contains
33
+ * at least one decision entry (### heading or **Decision marker).
34
+ *
35
+ * @param content - The enhanced context markdown content
36
+ * @returns ValidationResult with valid flag and list of missing sections
37
+ */
38
+ export function validateEnhancedContext(content: string): ValidationResult {
39
+ const missing: string[] = [];
40
+
41
+ // Required section 1: Scope (multiple acceptable header variants)
42
+ const hasScopeSection =
43
+ /^## Scope\b/m.test(content) ||
44
+ /^## Milestone Scope\b/m.test(content) ||
45
+ /^## Why This Milestone\b/m.test(content);
46
+
47
+ if (!hasScopeSection) {
48
+ missing.push("Milestone Scope or Why This Milestone");
49
+ }
50
+
51
+ // Required section 2: Architectural Decisions
52
+ const hasArchitecturalDecisions = /^## Architectural Decisions\b/m.test(content);
53
+ if (!hasArchitecturalDecisions) {
54
+ missing.push("Architectural Decisions");
55
+ }
56
+
57
+ // Required section 3: Acceptance Criteria (multiple acceptable header variants)
58
+ const hasAcceptanceCriteria =
59
+ /^## Acceptance Criteria\b/m.test(content) ||
60
+ /^## Final Integrated Acceptance\b/m.test(content);
61
+
62
+ if (!hasAcceptanceCriteria) {
63
+ missing.push("Acceptance Criteria");
64
+ }
65
+
66
+ // Additional validation: Architectural Decisions must have at least one entry
67
+ if (hasArchitecturalDecisions) {
68
+ // Extract the section content between ## Architectural Decisions and the next ## heading.
69
+ // Uses indexOf-based extraction instead of regex with \z (which is invalid in JavaScript
70
+ // regex — it's PCRE/Ruby syntax and JS treats it as literal 'z').
71
+ const sectionStart = content.indexOf("## Architectural Decisions");
72
+ if (sectionStart === -1) {
73
+ missing.push("Architectural Decisions");
74
+ } else {
75
+ const afterHeading = content.slice(sectionStart + "## Architectural Decisions".length);
76
+ const nextSection = afterHeading.search(/^## /m);
77
+ const sectionContent = nextSection === -1 ? afterHeading : afterHeading.slice(0, nextSection);
78
+
79
+ // Check for actual decision entries:
80
+ // - ### heading (subsection per decision)
81
+ // - **Decision marker (inline decision format)
82
+ const hasDecisionEntry = /^### /m.test(sectionContent) || /^\*\*Decision/m.test(sectionContent);
83
+
84
+ if (!hasDecisionEntry) {
85
+ missing.push("At least one architectural decision entry");
86
+ }
87
+ }
88
+ }
89
+
90
+ return {
91
+ valid: missing.length === 0,
92
+ missing,
93
+ };
94
+ }
95
+
96
+ // ─── Per-Turn Gate Section Validators ─────────────────────────────────────
97
+ //
98
+ // Each validator checks that the artifact written by a turn contains a
99
+ // heading for every gate owned by that turn. The registry is the source
100
+ // of truth for which sections must exist; adding a new gate automatically
101
+ // flows through via `getGatesForTurn(turn)`.
102
+
103
+ /**
104
+ * Escape a string so it can be embedded safely inside a regular expression.
105
+ */
106
+ function escapeRegExp(value: string): string {
107
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
108
+ }
109
+
110
+ /**
111
+ * Validate that an artifact contains an `## H2` heading for every gate the
112
+ * named turn owns. Returns the list of missing gate section headers.
113
+ *
114
+ * Soft rule: a section counts as "present" if it is declared (H2 heading
115
+ * exists) — empty-body sections are allowed and handled by the tool
116
+ * handler, which will record such gates as `omitted`.
117
+ */
118
+ export function validateGateSections(
119
+ content: string,
120
+ turn: OwnerTurn,
121
+ ): ValidationResult {
122
+ const missing: string[] = [];
123
+ for (const def of getGatesForTurn(turn)) {
124
+ const pattern = new RegExp(`^##\\s+${escapeRegExp(def.promptSection)}\\b`, "m");
125
+ if (!pattern.test(content)) {
126
+ missing.push(`${def.id} (## ${def.promptSection})`);
127
+ }
128
+ }
129
+ return { valid: missing.length === 0, missing };
130
+ }
131
+
132
+ /**
133
+ * Validate a SUMMARY.md produced by the complete-slice turn. Requires
134
+ * an H2 heading for every gate owned by complete-slice (e.g. Q8 →
135
+ * "## Operational Readiness"). Intended for use in the tool handler's
136
+ * pre-write checks or in the post-unit validation sweep.
137
+ */
138
+ export function validateSliceSummaryOutput(content: string): ValidationResult {
139
+ return validateGateSections(content, "complete-slice");
140
+ }
141
+
142
+ /**
143
+ * Validate a task SUMMARY.md produced by the execute-task turn. Only
144
+ * flags gates that are still pending for the task; skips the check
145
+ * when no rows are seeded (simple task).
146
+ */
147
+ export function validateTaskSummaryOutput(content: string): ValidationResult {
148
+ return validateGateSections(content, "execute-task");
149
+ }
150
+
151
+ /**
152
+ * Validate a VALIDATION.md produced by the validate-milestone turn.
153
+ * Requires an H2 heading for every MV gate declared in the registry.
154
+ */
155
+ export function validateMilestoneValidationOutput(content: string): ValidationResult {
156
+ return validateGateSections(content, "validate-milestone");
157
+ }
@@ -16,14 +16,16 @@ All relevant context has been preloaded below — the slice plan, all task summa
16
16
 
17
17
  {{inlinedContext}}
18
18
 
19
+ {{gatesToClose}}
20
+
19
21
  **Match effort to complexity.** A simple slice with 1-2 tasks needs a brief summary and lightweight verification. A complex slice with 5 tasks across multiple subsystems needs thorough verification and a detailed summary. Scale the work below accordingly.
20
22
 
21
23
  Then:
22
24
  1. Use the **Slice Summary** and **UAT** output templates from the inlined context above
23
25
  2. {{skillActivation}}
24
- 3. Run all slice-level verification checks defined in the slice plan. All must pass before marking the slice done. If any fail, fix them first.
26
+ 3. Run all slice-level verification checks defined in the slice plan. All must pass before marking the slice done. If any fail, fix them first. Task artifacts use a **flat file layout** directly inside `tasks/` (for example `T01-SUMMARY.md`, `T02-SUMMARY.md`) rather than per-task subdirectories. If you need to count or re-read task summaries during verification, use `find .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks -name "*-SUMMARY.md"` or `ls .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks/*-SUMMARY.md`. Never use `tasks/*/SUMMARY.md` — that glob expects subdirectories that do not exist.
25
27
  4. If the slice plan includes observability/diagnostic surfaces, confirm they work. Skip this for simple slices that don't have observability sections.
26
- 5. If the slice involved runtime behavior, fill the **Operational Readiness** section (Q8) in the slice summary: health signal, failure signal, recovery procedure, and monitoring gaps. Omit entirely for simple slices with no runtime concerns.
28
+ 5. Address every gate listed in the **Gates to Close** section above — each gate maps to a specific slice-summary section the handler inspects (for example, Q8 maps to **Operational Readiness**: health signal, failure signal, recovery procedure, and monitoring gaps). Leaving a section empty records the gate as `omitted`.
27
29
  6. If this slice produced evidence that a requirement changed status (Active → Validated, Active → Deferred, etc.), call `gsd_requirement_update` with the requirement ID, updated `status`, and `validation` evidence. Do NOT write `.gsd/REQUIREMENTS.md` directly — the engine renders it from the database.
28
30
  7. Prepare the slice completion content you will pass to `gsd_complete_slice` using the camelCase fields `milestoneId`, `sliceId`, `sliceTitle`, `oneLiner`, `narrative`, `verification`, and `uatContent`. Do **not** manually write `{{sliceSummaryPath}}`. Do **not** manually write `{{sliceUatPath}}` — the DB-backed tool is the canonical write path for both artifacts.
29
31
  8. Draft the UAT content you will pass as `uatContent` — a concrete UAT script with real test cases derived from the slice plan and task summaries. Include preconditions, numbered steps with expected outcomes, and edge cases. This must NOT be a placeholder or generic template — tailor every test case to what this slice actually built.
@@ -35,7 +37,7 @@ Then:
35
37
 
36
38
  **Autonomous execution:** Do not call `ask_user_questions` or `secure_env_collect`. You are running in auto-mode — there is no human available to answer questions. Make reasonable assumptions and document them in the slice summary. If a decision genuinely requires human input, note it in the summary and proceed with the best available option.
37
39
 
38
- **File system safety:** Task summaries are preloaded in the inlined context above. If you need to re-read any of them, use `find .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks -name "*-SUMMARY.md"` to list file paths first never pass `{{slicePath}}` or any other directory path directly to the `read` tool. The `read` tool only accepts file paths, not directories.
40
+ **File system safety:** Task summaries are preloaded in the inlined context above. Task artifacts use a **flat file layout** — files such as `T01-SUMMARY.md` and `T02-SUMMARY.md` live directly inside the `tasks/` directory, not inside per-task subdirectories like `tasks/T01/SUMMARY.md`. If you need to re-read any of them, use `find .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks -name "*-SUMMARY.md"` to list file paths first. Never use `tasks/*/SUMMARY.md`, and never pass `{{slicePath}}` or any other directory path directly to the `read` tool. The `read` tool only accepts file paths, not directories.
39
41
 
40
42
  **You MUST call `gsd_complete_slice` with the slice summary and UAT content before finishing. The tool persists to both DB and disk and renders `{{sliceSummaryPath}}` and `{{sliceUatPath}}` automatically.**
41
43
 
@@ -49,30 +49,133 @@ This happens ONCE, before the first round. The goal: your first questions should
49
49
 
50
50
  For subsequent rounds, continue investigating between rounds — check docs, search, or scout as needed to make each round's questions smarter. But the first-round investigation is mandatory and explicit. Distribute searches across turns rather than clustering them in one turn.
51
51
 
52
- ## Question Rounds
52
+ ## Layered Question Rounds
53
53
 
54
- Ask **1–3 questions per round**. Keep each round tightly focused on one or two of the depth checklist dimensions do not try to cover all six in one round.
54
+ Questions are organized into four layers. Each layer targets a specific depth dimension. At each layer: ask 1-3 open questions per round, investigate between rounds as needed, and gate before advancing.
55
55
 
56
- **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` for each round. 1–3 questions per call, each as a separate question object. Keep option labels short (3–5 words). Always include a freeform "Other / let me explain" option. When the user picks that option or writes a long freeform answer, switch to plain text follow-up for that thread before resuming structured questions. **IMPORTANT: Call `ask_user_questions` exactly once per turn. Never make multiple calls with the same or overlapping questions — wait for the user's response before asking the next round.**
56
+ **Default to open questions.** Use `ask_user_questions` only when there are 2-3 genuinely distinct paths with clear tradeoffs (e.g., "REST vs GraphQL" or "Postgres vs SQLite"). For nuanced design questions, ask in plain text and let the user explain.
57
57
 
58
- **If `{{structuredQuestionsAvailable}}` is `false`:** ask questions in plain text. Keep each round to 1–3 focused questions. Wait for answers before asking the next round.
58
+ **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` for binary/ternary choices. Keep option labels short (3-5 words). Always include a freeform "Other / let me explain" option. When the user picks that option or writes a long freeform answer, switch to plain text follow-up for that thread before resuming structured questions. **IMPORTANT: Call `ask_user_questions` exactly once per turn. Never make multiple calls with the same or overlapping questions — wait for the user's response before asking the next round.**
59
59
 
60
- After each answer set, investigate further if any answer opens a new unknown, then ask the next round.
60
+ **If `{{structuredQuestionsAvailable}}` is `false`:** ask questions in plain text. Keep each round to 1-3 focused questions. Wait for answers before asking the next round.
61
61
 
62
- ### Round cadence
62
+ **Incremental persistence:** After every 2 question rounds (across any layer), silently save a `{{milestoneId}}-CONTEXT-DRAFT.md` using `gsd_summary_save` with `artifact_type: "CONTEXT-DRAFT"` and `milestone_id: "{{milestoneId}}"`. This protects confirmed work against session crashes. Do NOT mention this save to the user.
63
63
 
64
- After each round of answers, decide whether you already have enough depth to write strong output.
64
+ ### Identify Work Type
65
65
 
66
- - **Incremental persistence:** After every 2 question rounds, silently save a `{{milestoneId}}-CONTEXT-DRAFT.md` using `gsd_summary_save` with `artifact_type: "CONTEXT-DRAFT"` and `milestone_id: "{{milestoneId}}"`. This protects confirmed work against session crashes. Do NOT mention this save to the user.
67
- - If not ready, continue to the next round immediately. Do **not** ask a meta "ready to wrap up?" question after every round.
68
- - **Depth-matching rule:** Simple, well-defined work needs fewer rounds — maybe 1–2. Large, ambiguous visions need more maybe 4+. Do not pad rounds to hit a number. Stop when the Depth Enforcement checklist below is fully satisfied.
69
- - Do not count the reflection step as a question round. Rounds start after reflection is confirmed.
70
- - When you genuinely believe the depth checklist is satisfied, move to the Depth Verification step below. Do not ask a separate "ready to wrap up?" gate the depth verification IS the gate.
66
+ Before starting Layer 1, identify the primary work type and state it:
67
+
68
+ "Based on your description and the codebase, this is primarily **[work type]** work."
69
+
70
+ Work types include: API/backend, UI/frontend, CLI/developer tool, data pipeline, ML/AI, infrastructure/platform, refactoring/migration, or a combination. The user can correct this. The classification shapes which questions deserve deep exploration at each layer.
71
+
72
+ ### Layer 1 — Scope
73
+
74
+ Resolve what's in and what's out. Ask about:
75
+ - Feature boundaries — what exactly ships in this milestone vs later
76
+ - Ambiguities in the user's description — anything you're unsure about, ask
77
+ - Dependencies — what does this work depend on, what depends on it
78
+ - Priority — if scope needs trimming, what matters most
79
+
80
+ Adapt depth to work type:
81
+ - **CLI work:** Focus on user mental model, command grammar, what existing commands do
82
+ - **Refactoring:** Focus on what changes vs what must stay identical
83
+
84
+ **Depth-matching:** Simple, well-defined scope may need 1 round. Ambiguous or large scope may need 3-4 rounds. Don't pad rounds to hit a number.
85
+
86
+ #### Layer 1 Gate
87
+
88
+ Summarize scope decisions in the user's own terminology:
89
+ - What's included, what's excluded, what's deferred
90
+ - Key boundaries and constraints
91
+
92
+ Then ask: **"Does this capture the scope? Adjust anything before we move on."**
93
+
94
+ If the user adjusts, reflect the updated understanding and ask again. Do not advance until the user explicitly confirms. If the user says "looks good, let's move faster" at any gate, respect that and advance.
95
+
96
+ ---
97
+
98
+ ### Layer 2 — Architecture
99
+
100
+ Resolve how it's built. Ask about:
101
+ - Per-slice technical decisions — what approach for each major piece
102
+ - Inter-slice contracts — how do the pieces connect
103
+ - Library/framework choices — with evidence from investigation, not assumptions
104
+ - Integration with existing code — what patterns to follow, what to change
105
+
106
+ Adapt depth to work type:
107
+ - **API work:** Contracts, versioning, backwards compatibility, auth boundaries
108
+ - **UI work:** Component boundaries, state management, data flow
109
+ - **Infrastructure:** Deployment topology, failure domains, rollback
110
+
111
+ Between rounds, use your available web search tools to research technologies from the Codebase Brief. Search for "[technology] [version] best practices [current year]" and "[technology] [version] known issues". Present findings alongside your questions.
112
+
113
+ #### Layer 2 Gate
114
+
115
+ Summarize architecture decisions, each with:
116
+ - The decision and rationale
117
+ - Evidence source (codebase patterns, library docs, web research)
118
+ - Alternatives considered
119
+
120
+ Then ask: **"Does this capture the architecture? Adjust anything before we move on."**
121
+
122
+ Same gate rules: reflect adjustments, wait for confirmation.
123
+
124
+ ---
125
+
126
+ ### Layer 3 — Error States
127
+
128
+ Resolve what happens when things fail. Present this layer with an option:
129
+
130
+ "We can go deep on error handling and failure modes, or I can apply sensible defaults based on the architecture decisions above. Which do you prefer?"
131
+
132
+ If the user chooses defaults, summarize what the defaults are and gate. If the user chooses to go deep, ask about:
133
+ - Failure modes for each major component
134
+ - Error propagation between layers (API → frontend, service → database)
135
+ - Timeout, retry, and circuit-breaker strategies
136
+ - What the user sees when something fails
137
+
138
+ Adapt depth to work type:
139
+ - **API work:** Rate limiting, timeout cascades, partial failure, status codes
140
+ - **UI work:** Loading states, optimistic updates, offline behavior, error boundaries
141
+ - **Data pipelines:** Data corruption, checkpoint recovery, idempotency
142
+
143
+ #### Layer 3 Gate
144
+
145
+ Summarize error handling strategy. Then ask: **"Does this capture how errors should be handled? Adjust anything before we move on."**
146
+
147
+ ---
148
+
149
+ ### Layer 4 — Quality Bar
150
+
151
+ Resolve what "done" means concretely. Ask about:
152
+ - Per-slice acceptance criteria — specific enough for automated verification
153
+ - Test strategy — what types of tests, what coverage expectations
154
+ - Definition of done — what must be true before the milestone ships
155
+ - Non-functional requirements — performance, accessibility, security if relevant
156
+
157
+ Adapt depth to work type:
158
+ - **CLI work:** Shell compatibility, error message clarity, exit code semantics
159
+ - **Refactoring:** Behavioral equivalence tests, not just code coverage
160
+ - **UI work:** Visual regression criteria, responsive breakpoints
161
+
162
+ #### Layer 4 Gate
163
+
164
+ Summarize quality bar: acceptance criteria, test strategy, definition of done. Then ask: **"Does this capture the quality bar? Adjust anything before we move on to requirements and roadmap?"**
165
+
166
+ ---
167
+
168
+ ### Layer cadence
169
+
170
+ - Do not count the reflection step as a question round. Rounds start at Layer 1 after reflection is confirmed.
171
+ - When all four layer gates have been confirmed (or skipped by the user), move to the Depth Verification step below. Do not ask a separate "ready to wrap up?" gate — the depth verification confirms the full picture.
71
172
 
72
173
  ## Questioning Philosophy
73
174
 
74
175
  You are a thinking partner, not an interviewer.
75
176
 
177
+ **Turn-taking contract (non-bypassable).** Never fabricate, simulate, or role-play user responses. Never generate fake transcript markers like `[User]`, `[Human]`, or `User:` to invent input. Prior conversation context may be provided to you inside `<conversation_history>` with `<user_message>` / `<assistant_message>` XML tags — treat those as read-only context and never emit those tags in your response. Ask one question round (1-3 questions) per turn, then stop and wait for the user's actual response before continuing. If you use `ask_user_questions`, call it at most once per turn and treat its returned response as the only valid structured user input for that round.
178
+
76
179
  **Start open, follow energy.** Let the user's enthusiasm guide where you dig deeper. If they light up about a particular aspect, explore it. If they're vague about something, that's where you probe.
77
180
 
78
181
  **Challenge vagueness, make abstract concrete.** When the user says something abstract ("it should be smart" / "it needs to handle edge cases" / "good UX"), push for specifics. What does "smart" mean in practice? Which edge cases? What does good UX look like for this specific interaction?
@@ -223,6 +326,14 @@ Once the user is satisfied, in a single pass:
223
326
  **Depth-Preservation Guidance for context.md:**
224
327
  When writing context.md, preserve the user's exact terminology, emphasis, and specific framing from the discussion. Do not paraphrase user nuance into generic summaries. If the user said "craft feel," write "craft feel" — not "high-quality user experience." If they emphasized a specific constraint or negative requirement, carry that emphasis through verbatim. The context file is downstream agents' only window into this conversation — flattening specifics into generics loses the signal that shaped every decision.
225
328
 
329
+ **Structured sections from discussion layers:**
330
+ When writing CONTEXT.md, include structured sections that map to the discussion layers:
331
+ - **Scope** — what's in, what's out, what's deferred (from Layer 1 gate summary)
332
+ - **Architectural Decisions** — each with rationale, evidence source, alternatives considered (from Layer 2 gate summary)
333
+ - **Error Handling Strategy** — failure modes, propagation, user-facing error behavior (from Layer 3 gate summary)
334
+ - **Acceptance Criteria** — per-slice criteria specific enough for the planner to use directly (from Layer 4 gate summary)
335
+ These sections are in addition to whatever other context the discussion surfaced.
336
+
226
337
  4. Write `{{contextPath}}` — use the **Context** output template below. Preserve key risks, unknowns, existing codebase constraints, integration points, and relevant requirements surfaced during discussion.
227
338
  5. Call `gsd_plan_milestone` to create the roadmap. Decompose into demoable vertical slices with risk, depends, demo sentences, proof strategy, verification classes, milestone definition of done, requirement coverage, and a boundary map. If the milestone crosses multiple runtime boundaries, include an explicit final integration slice that proves the assembled system works end-to-end in a real environment. Use the **Roadmap** output template below to structure the tool call parameters.
228
339
  6. For each architectural or pattern decision made during discussion, call `gsd_decision_save` — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically.
@@ -22,6 +22,8 @@ A researcher explored the codebase and a planner decomposed the work — you are
22
22
 
23
23
  {{slicePlanExcerpt}}
24
24
 
25
+ {{gatesToClose}}
26
+
25
27
  ## Backing Source Artifacts
26
28
  - Slice plan: `{{planPath}}`
27
29
  - Task plan source: `{{taskPlanPath}}`
@@ -32,29 +34,30 @@ Then:
32
34
  0. Narrate step transitions, key implementation decisions, and verification outcomes as you work. Keep it terse — one line between tool-call clusters, not between every call — but write complete sentences in user-facing prose, not shorthand notes or scratchpad fragments.
33
35
  1. {{skillActivation}} Follow any activated skills before writing code. If no skills match this task, skip this step.
34
36
  2. Execute the steps in the inlined task plan, adapting minor local mismatches when the surrounding code differs from the planner's snapshot
35
- 3. Build the real thing. If the task plan says "create login endpoint", build an endpoint that actually authenticates against a real store, not one that returns a hardcoded success response. If the task plan says "create dashboard page", build a page that renders real data from the API, not a component with hardcoded props. Stubs and mocks are for tests, not for the shipped feature.
36
- 4. Write or update tests as part of execution tests are verification, not an afterthought. If the slice plan defines test files in its Verification section and this is the first task, create them (they should initially fail).
37
- 5. When implementing non-trivial runtime behavior (async flows, API boundaries, background processes, error paths), add or preserve agent-usable observability. Skip this for simple changes where it doesn't apply.
37
+ 3. Before any `Write` that creates an artifact or output file, check whether that path already exists. If it does, read it first and decide whether the work is already done, should be extended, or truly needs replacement. "Create" in the plan does **not** mean the file is missing a prior session may already have started it.
38
+ 4. Build the real thing. If the task plan says "create login endpoint", build an endpoint that actually authenticates against a real store, not one that returns a hardcoded success response. If the task plan says "create dashboard page", build a page that renders real data from the API, not a component with hardcoded props. Stubs and mocks are for tests, not for the shipped feature.
39
+ 5. Write or update tests as part of execution tests are verification, not an afterthought. If the slice plan defines test files in its Verification section and this is the first task, create them (they should initially fail).
40
+ 6. When implementing non-trivial runtime behavior (async flows, API boundaries, background processes, error paths), add or preserve agent-usable observability. Skip this for simple changes where it doesn't apply.
38
41
 
39
42
  **Background process rule:** Never use bare `command &` to run background processes. The shell's `&` operator leaves stdout/stderr attached to the parent, which causes the Bash tool to hang indefinitely waiting for those streams to close. Always redirect output before backgrounding:
40
43
  - Correct: `command > /dev/null 2>&1 &` or `nohup command > /dev/null 2>&1 &`
41
44
  - Example: `python -m http.server 8080 > /dev/null 2>&1 &` (NOT `python -m http.server 8080 &`)
42
45
  - Preferred: use the `bg_shell` tool if available — it manages process lifecycle correctly without stream-inheritance issues
43
- 6. If the task plan includes a **Failure Modes** section (Q5), implement the error/timeout/malformed handling specified. Verify each dependency's failure path is handled. Skip if the section is absent.
44
- 7. If the task plan includes a **Load Profile** section (Q6), implement protections for the identified 10x breakpoint (connection pooling, rate limiting, pagination, etc.). Skip if absent.
45
- 8. If the task plan includes a **Negative Tests** section (Q7), write the specified negative test cases alongside the happy-path tests — malformed inputs, error paths, and boundary conditions. Skip if absent.
46
- 9. Verify must-haves are met by running concrete checks (tests, commands, observable behaviors)
47
- 10. Run the slice-level verification checks defined in the slice plan's Verification section. Track which pass. On the final task of the slice, all must pass before marking done. On intermediate tasks, partial passes are expected — note which ones pass in the summary.
48
- 11. After the verification gate runs (you'll see gate results in stderr/notify output), populate the `## Verification Evidence` table in your task summary with the check results. Use the `formatEvidenceTable` format: one row per check with command, exit code, verdict (✅ pass / ❌ fail), and duration. If no verification commands were discovered, note that in the section.
49
- 12. If the task touches UI, browser flows, DOM behavior, or user-visible web state:
46
+ 7. If the task plan includes a **Failure Modes** section (Q5), implement the error/timeout/malformed handling specified. Verify each dependency's failure path is handled. Skip if the section is absent.
47
+ 8. If the task plan includes a **Load Profile** section (Q6), implement protections for the identified 10x breakpoint (connection pooling, rate limiting, pagination, etc.). Skip if absent.
48
+ 9. If the task plan includes a **Negative Tests** section (Q7), write the specified negative test cases alongside the happy-path tests — malformed inputs, error paths, and boundary conditions. Skip if absent.
49
+ 10. Verify must-haves are met by running concrete checks (tests, commands, observable behaviors)
50
+ 11. Run the slice-level verification checks defined in the slice plan's Verification section. Track which pass. On the final task of the slice, all must pass before marking done. On intermediate tasks, partial passes are expected — note which ones pass in the summary.
51
+ 12. After the verification gate runs (you'll see gate results in stderr/notify output), populate the `## Verification Evidence` table in your task summary with the check results. Use the `formatEvidenceTable` format: one row per check with command, exit code, verdict (✅ pass / ❌ fail), and duration. If no verification commands were discovered, note that in the section.
52
+ 13. If the task touches UI, browser flows, DOM behavior, or user-visible web state:
50
53
  - exercise the real flow in the browser
51
54
  - prefer `browser_batch` when the next few actions are obvious and sequential
52
55
  - prefer `browser_assert` for explicit pass/fail verification of the intended outcome
53
56
  - use `browser_diff` when an action's effect is ambiguous
54
57
  - use console/network/dialog diagnostics when validating async, stateful, or failure-prone UI
55
58
  - record verification in terms of explicit checks passed/failed, not only prose interpretation
56
- 13. If the task plan includes an Observability Impact section, verify those signals directly. Skip this step if the task plan omits the section.
57
- 14. **If execution is running long or verification fails:**
59
+ 14. If the task plan includes an Observability Impact section, verify those signals directly. Skip this step if the task plan omits the section.
60
+ 15. **If execution is running long or verification fails:**
58
61
 
59
62
  **Context budget:** You have approximately **{{verificationBudget}}** reserved for verification context. If you've used most of your context and haven't finished all steps, stop implementing and prioritize writing the task summary with clear notes on what's done and what remains. A partial summary that enables clean resumption is more valuable than one more half-finished step with no documentation. Never sacrifice summary quality for one more implementation step.
60
63
 
@@ -65,13 +68,13 @@ Then:
65
68
  - Distinguish "I know" from "I assume." Observable facts (the error says X) are strong evidence. Assumptions (this library should work this way) need verification.
66
69
  - Know when to stop. If you've tried 3+ fixes without progress, your mental model is probably wrong. Stop. List what you know for certain. List what you've ruled out. Form fresh hypotheses from there.
67
70
  - Don't fix symptoms. Understand *why* something fails before changing code. A test that passes after a change you don't understand is luck, not a fix.
68
- 15. **Blocker discovery:** If execution reveals that the remaining slice plan is fundamentally invalid — not just a bug or minor deviation, but a plan-invalidating finding like a wrong API, missing capability, or architectural mismatch — set `blocker_discovered: true` in the task summary frontmatter and describe the blocker clearly in the summary narrative. Do NOT set `blocker_discovered: true` for ordinary debugging, minor deviations, or issues that can be fixed within the current task or the remaining plan. This flag triggers an automatic replan of the slice.
69
- 16. If you made an architectural, pattern, library, or observability decision during this task that downstream work should know about, append it to `.gsd/DECISIONS.md` (read the template at `~/.gsd/agent/extensions/gsd/templates/decisions.md` if the file doesn't exist yet). Not every task produces decisions — only append when a meaningful choice was made.
70
- 17. If you discover a non-obvious rule, recurring gotcha, or useful pattern during execution, append it to `.gsd/KNOWLEDGE.md`. Only add entries that would save future agents from repeating your investigation. Don't add obvious things.
71
- 18. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
72
- 19. Use that template to prepare the completion content you will pass to `gsd_complete_task` using the camelCase fields `milestoneId`, `sliceId`, `taskId`, `oneLiner`, `narrative`, `verification`, and `verificationEvidence`. Do **not** manually write `{{taskSummaryPath}}` — the DB-backed tool is the canonical write path and renders the summary file for you.
73
- 20. Call `gsd_complete_task` with milestoneId, sliceId, taskId, and the completion fields derived from the template. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, renders `{{taskSummaryPath}}`, and updates PLAN.md automatically.
74
- 21. Do not run git commands — the system reads your task summary after completion and creates a meaningful commit from it (type inferred from title, message from your one-liner, key files from frontmatter). Write a clear, specific one-liner in the summary — it becomes the commit message.
71
+ 16. **Blocker discovery:** If execution reveals that the remaining slice plan is fundamentally invalid — not just a bug or minor deviation, but a plan-invalidating finding like a wrong API, missing capability, or architectural mismatch — set `blocker_discovered: true` in the task summary frontmatter and describe the blocker clearly in the summary narrative. Do NOT set `blocker_discovered: true` for ordinary debugging, minor deviations, or issues that can be fixed within the current task or the remaining plan. This flag triggers an automatic replan of the slice.
72
+ 17. If you made an architectural, pattern, library, or observability decision during this task that downstream work should know about, append it to `.gsd/DECISIONS.md` (read the template at `~/.gsd/agent/extensions/gsd/templates/decisions.md` if the file doesn't exist yet). Not every task produces decisions — only append when a meaningful choice was made.
73
+ 18. If you discover a non-obvious rule, recurring gotcha, or useful pattern during execution, append it to `.gsd/KNOWLEDGE.md`. Only add entries that would save future agents from repeating your investigation. Don't add obvious things.
74
+ 19. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
75
+ 20. Use that template to prepare the completion content you will pass to `gsd_complete_task` using the camelCase fields `milestoneId`, `sliceId`, `taskId`, `oneLiner`, `narrative`, `verification`, and `verificationEvidence`. Do **not** manually write `{{taskSummaryPath}}` — the DB-backed tool is the canonical write path and renders the summary file for you.
76
+ 21. Call `gsd_complete_task` with milestoneId, sliceId, taskId, and the completion fields derived from the template. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, renders `{{taskSummaryPath}}`, and updates PLAN.md automatically.
77
+ 22. Do not run git commands — the system reads your task summary after completion and creates a meaningful commit from it (type inferred from title, message from your one-liner, key files from frontmatter). Write a clear, specific one-liner in the summary — it becomes the commit message.
75
78
 
76
79
  All work stays in your working directory: `{{workingDirectory}}`.
77
80
 
@@ -32,6 +32,8 @@ Ask **1–3 questions per round**. Keep each question focused on one of:
32
32
  - **The biggest technical unknowns / risks** — what could fail, what hasn't been proven
33
33
  - **What external systems/services this touches** — APIs, databases, third-party services
34
34
 
35
+ **Never fabricate or simulate user input.** Never generate fake transcript markers like `[User]`, `[Human]`, or `User:`. Ask one question round, then wait for the user's actual response before continuing.
36
+
35
37
  **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` for each round. 1–3 questions per call, each as a separate question object. Keep option labels short (3–5 words). Always include a freeform "Other / let me explain" option. When the user picks that option or writes a long freeform answer, switch to plain text follow-up for that thread before resuming structured questions. **IMPORTANT: Call `ask_user_questions` exactly once per turn. Never make multiple calls with the same or overlapping questions — wait for the user's response before asking the next round.**
36
38
 
37
39
  **If `{{structuredQuestionsAvailable}}` is `false`:** ask questions in plain text. Keep each round to 1–3 focused questions. Wait for answers before asking the next round.
@@ -22,6 +22,8 @@ Do **not** go deep — just enough that your questions reflect what's actually t
22
22
 
23
23
  ### Question rounds
24
24
 
25
+ **Never fabricate or simulate user input.** Never generate fake transcript markers like `[User]`, `[Human]`, or `User:`. Ask one question round, then wait for the user's actual response before continuing.
26
+
25
27
  **If `{{structuredQuestionsAvailable}}` is `true`:** Ask **1–3 questions per round** using `ask_user_questions`. **Call `ask_user_questions` exactly once per turn — never make multiple calls with the same or overlapping questions. Wait for the user's response before asking the next round.**
26
28
  **If `{{structuredQuestionsAvailable}}` is `false`:** Ask **1–3 questions per round** in plain text. Number them and wait for the user's response before asking the next round.
27
29
  Keep each question focused on one of:
@@ -1 +1 @@
1
- Resume interrupted work. Find the continue file (`{{sliceId}}-CONTINUE.md` or `continue.md`) in slice {{sliceId}} of milestone {{milestoneId}}, read it, and use it as the recovery contract for where to pick up. Do **not** delete the continue file immediately. Keep it until the task is successfully completed or you have written a newer summary/continue artifact that clearly supersedes it. If the resumed attempt fails again, update or replace the continue file so no recovery context is lost. {{skillActivation}}
1
+ Resume interrupted work. Find the continue file (`{{sliceId}}-CONTINUE.md` or `continue.md`) in slice {{sliceId}} of milestone {{milestoneId}}, read it, and use it as the recovery contract for where to pick up. Before you create any expected artifact or output file, check whether it already exists and read it first — a prior session may already have started or completed that work. Do **not** delete the continue file immediately. Keep it until the task is successfully completed or you have written a newer summary/continue artifact that clearly supersedes it. If the resumed attempt fails again, update or replace the continue file so no recovery context is lost. {{skillActivation}}
@@ -18,6 +18,7 @@ Say exactly: "What do you want to add?" — nothing else. Wait for the user's an
18
18
  ## Discussion Phase
19
19
 
20
20
  After they describe it, your job is to understand the new work deeply enough to create context files that a future planning session can use.
21
+ Never fabricate or simulate user input during this discussion. Never generate fake transcript markers like `[User]`, `[Human]`, or `User:`. Ask one question round, then wait for the user's actual response before continuing.
21
22
 
22
23
  **If the user provides a file path or pastes a large document** (spec, design doc, product plan, chat export), read it fully before asking questions. Use it as the starting point — don't ask them to re-explain what's already in the document. Your questions should fill gaps and resolve ambiguities the document doesn't cover.
23
24
 
@@ -36,11 +37,11 @@ Don't go deep — just enough that your next question reflects what's actually t
36
37
  - How the new work relates to existing milestones — overlap, dependencies, prerequisites
37
38
  - If `.gsd/REQUIREMENTS.md` exists: which unmet Active or Deferred requirements this queued work advances
38
39
 
39
- **Then use ask_user_questions** to dig into gray areas — scope boundaries, proof expectations, integration choices, tech preferences when they materially matter, and what's in vs out. 1-3 questions per round.
40
+ **Then use ask_user_questions** to dig into gray areas — scope boundaries, proof expectations, integration choices, tech preferences when they materially matter, and what's in vs out. Ask 1-3 questions per round, then wait for the user's response before asking the next round.
40
41
 
41
42
  If a `GSD Skill Preferences` block is present in system context, use it to decide which skills to load and follow during discuss/planning work, but do not let it override the required discuss flow or artifact requirements.
42
43
 
43
- **Self-regulate:** Do **not** ask a meta "ready to queue?" question after every round. Keep going until you have enough depth to write the context well, then use a single wrap-up prompt if needed. If the user clearly keeps adding detail instead of objecting, treat that as permission to continue.
44
+ **Self-regulate:** Do **not** ask a meta "ready to queue?" question after every round. Keep going until you have enough depth to write the context well, then use a single wrap-up prompt if needed. Do not infer permission to continue from silence or from partial prior answers each new round requires an actual user response.
44
45
 
45
46
  ## Existing Milestone Awareness
46
47
 
@@ -35,6 +35,7 @@ GSD ships with bundled skills. Load the relevant skill file with the `read` tool
35
35
  - Read before edit.
36
36
  - Reproduce before fix when possible.
37
37
  - Work is not done until the relevant verification has passed.
38
+ - **Never fabricate, simulate, or role-play user responses.** Never generate markers like `[User]`, `[Human]`, `User:`, or similar to represent user input inside your own output. Prior conversation context may be provided to you inside `<conversation_history>` with `<user_message>` / `<assistant_message>` XML tags — treat those as read-only context and never emit those tags in your response. Ask one question round (1-3 questions), then stop and wait for the user's actual response before continuing. If `ask_user_questions` is available, treat its returned response as the only valid structured user input for that round.
38
39
  - Never print, echo, log, or restate secrets or credentials. Report only key names and applied/skipped status.
39
40
  - Never ask the user to edit `.env` files or set secrets manually. Use `secure_env_collect`.
40
41
  - In enduring files, write current state only unless the file is explicitly historical.
@@ -18,6 +18,8 @@ All relevant context has been preloaded below — the roadmap, all slice summari
18
18
 
19
19
  {{inlinedContext}}
20
20
 
21
+ {{gatesToEvaluate}}
22
+
21
23
  ## Execution Protocol
22
24
 
23
25
  ### Step 1 — Dispatch Parallel Reviewers
@@ -31,7 +33,7 @@ Prompt: "Review milestone {{milestoneId}} requirements coverage. Working directo
31
33
  Prompt: "Review milestone {{milestoneId}} cross-slice integration. Working directory: {{workingDirectory}}. Read `{{roadmapPath}}` and find the boundary map (produces/consumes contracts). For each boundary, check that the producing slice's SUMMARY confirms it produced the artifact, and the consuming slice's SUMMARY confirms it consumed it. Output a markdown table: Boundary | Producer Summary | Consumer Summary | Status. End with a one-line verdict: PASS if all boundaries honored, NEEDS-ATTENTION if any gaps."
32
34
 
33
35
  **Reviewer C — Assessment & Acceptance Criteria**
34
- Prompt: "Review milestone {{milestoneId}} assessment evidence and acceptance criteria. Working directory: {{workingDirectory}}. Read `.gsd/{{milestoneId}}/CONTEXT.md` for acceptance criteria. Check for ASSESSMENT files in each slice directory. Verify each acceptance criterion maps to either a passing assessment result or clear SUMMARY evidence. Output a checklist: [ ] Criterion | Evidence. End with a one-line verdict: PASS if all criteria met, NEEDS-ATTENTION if gaps exist."
36
+ Prompt: "Review milestone {{milestoneId}} assessment evidence and acceptance criteria. Working directory: {{workingDirectory}}. Read `.gsd/{{milestoneId}}/CONTEXT.md` for acceptance criteria. Check for ASSESSMENT files in each slice directory. Verify each acceptance criterion maps to either a passing assessment result or clear SUMMARY evidence. Then review the inlined milestone verification classes from planning. For each non-empty planned class, output a markdown table: Class | Planned Check | Evidence | Verdict. Use the exact class names `Contract`, `Integration`, `Operational`, and `UAT` whenever those classes are present. If no verification classes were planned, say that explicitly. Output two sections: `Acceptance Criteria` with a checklist `[ ] Criterion | Evidence`, and `Verification Classes` with the table. End with a one-line verdict: PASS if all criteria and verification classes are covered, NEEDS-ATTENTION if gaps exist."
35
37
 
36
38
  ### Step 2 — Synthesize Findings
37
39
 
@@ -70,6 +72,7 @@ reviewers: 3
70
72
  ```
71
73
 
72
74
  Call `gsd_validate_milestone` with the camelCase fields `milestoneId`, `verdict`, `remediationRound`, `successCriteriaChecklist`, `sliceDeliveryAudit`, `crossSliceIntegration`, `requirementCoverage`, `verdictRationale`, and `remediationPlan` when needed. If you include verification-class analysis, pass it in `verificationClasses`.
75
+ Extract the `Verification Classes` subsection from Reviewer C and pass it verbatim in `verificationClasses` so the persisted validation output uses the canonical class names `Contract`, `Integration`, `Operational`, and `UAT`.
73
76
 
74
77
  **DB access safety:** Do NOT query `.gsd/gsd.db` directly via `sqlite3` or `node -e require('better-sqlite3')` — the engine owns the WAL connection. Use `gsd_milestone_status` to read milestone and slice state. All data you need is already inlined in the context above or accessible via the `gsd_*` tools. Direct DB access corrupts the WAL and bypasses tool-level validation.
75
78
 
@@ -0,0 +1,36 @@
1
+ export interface SessionModelOverride {
2
+ provider: string;
3
+ id: string;
4
+ }
5
+
6
+ const sessionOverrides = new Map<string, SessionModelOverride>();
7
+
8
+ function normalizeSessionId(sessionId: string): string {
9
+ return typeof sessionId === "string" ? sessionId.trim() : "";
10
+ }
11
+
12
+ export function setSessionModelOverride(
13
+ sessionId: string,
14
+ override: SessionModelOverride,
15
+ ): void {
16
+ const key = normalizeSessionId(sessionId);
17
+ if (!key) return;
18
+ sessionOverrides.set(key, {
19
+ provider: override.provider,
20
+ id: override.id,
21
+ });
22
+ }
23
+
24
+ export function getSessionModelOverride(
25
+ sessionId: string,
26
+ ): SessionModelOverride | undefined {
27
+ const key = normalizeSessionId(sessionId);
28
+ if (!key) return undefined;
29
+ return sessionOverrides.get(key);
30
+ }
31
+
32
+ export function clearSessionModelOverride(sessionId: string): void {
33
+ const key = normalizeSessionId(sessionId);
34
+ if (!key) return;
35
+ sessionOverrides.delete(key);
36
+ }